PageSourceSearch

https://chessagenda.com/assets/index-DoiMzrJI.js

js chessagenda.com collected 2026-10-06 09:24:19 UTC 3,477,039 bytes, 2,834 lines download raw bytes

vendor: 6,431 bytes, lines 1-9
1var mhe=Object.defineProperty;var rL=e=>{throw TypeError(e)};var phe=(e,t,n)=>t in e?mhe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var vt=(e,t,n)=>phe(e,typeof t!="symbol"?t+"":t,n),_S=(e,t,n)=>t.has(e)||rL("Cannot "+n);var xe=(e,t,n)=>(_S(e,t,"read from private field"),n?n.call(e):t.get(e)),$t=(e,t,n)=>t.has(e)?rL("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),mt=(e,t,n,r)=>(_S(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),_n=(e,t,n)=>(_S(e,t,"access private method"),n);var kw=(e,t,n,r)=>({set _(i){mt(e,t,i,n)},get _(){return xe(e,t,r)}});function ghe(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();var Lo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var QW={exports:{}},xk={},JW={exports:{}},In={};/**
2 * @license React
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var vb=Symbol.for("react.element"),xhe=Symbol.for("react.portal"),yhe=Symbol.for("react.fragment"),vhe=Symbol.for("react.strict_mode"),bhe=Symbol.for("react.profiler"),whe=Symbol.for("react.provider"),_he=Symbol.for("react.context"),jhe=Symbol.for("react.forward_ref"),Nhe=Symbol.for("react.suspense"),khe=Symbol.for("react.memo"),Che=Symbol.for("react.lazy"),sL=Symbol.iterator;function Ehe(e){return e===null||typeof e!="object"?null:(e=sL&&e[sL]||e["@@iterator"],typeof e=="function"?e:null)}var ZW={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},eG=Object.assign,tG={};function h0(e,t,n){this.props=e,this.context=t,this.refs=tG,this.updater=n||ZW}h0.prototype.isReactComponent={};h0.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};h0.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function nG(){}nG.prototype=h0.prototype;function oD(e,t,n){this.props=e,this.context=t,this.refs=tG,this.updater=n||ZW}var lD=oD.prototype=new nG;lD.constructor=oD;eG(lD,h0.prototype);lD.isPureReactComponent=!0;var iL=Array.isArray,rG=Object.prototype.hasOwnProperty,cD={current:null},sG={key:!0,ref:!0,__self:!0,__source:!0};function iG(e,t,n){var r,i={},a=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(a=""+t.key),t)rG.call(t,r)&&!sG.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)i[r]===void 0&&(i[r]=l[r]);return{$$typeof:vb,type:e,key:a,ref:o,props:i,_owner:cD.current}}function She(e,t){return{$$typeof:vb,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function uD(e){return typeof e=="object"&&e!==null&&e.$$typeof===vb}function Ahe(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var aL=/\/+/g;function jS(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Ahe(""+e.key):t.toString(36)}function G_(e,t,n,r,i){var a=typeof e;(a==="undefined"||a==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(a){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case vb:case xhe:o=!0}}if(o)return o=e,i=i(o),e=r===""?"."+jS(o,0):r,iL(i)?(n="",e!=null&&(n=e.replace(aL,"$&/")+"/"),G_(i,t,n,"",function(u){return u})):i!=null&&(uD(i)&&(i=She(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(aL,"$&/")+"/")+e)),t.push(i)),1;if(o=0,r=r===""?".":r+":",iL(e))for(var l=0;l<e.length;l++){a=e[l];var c=r+jS(a,l);o+=G_(a,t,n,c,i)}else if(c=Ehe(e),typeof c=="function")for(e=c.call(e),l=0;!(a=e.next()).done;)a=a.value,c=r+jS(a,l++),o+=G_(a,t,n,c,i);else if(a==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Cw(e,t,n){if(e==null)return e;var r=[],i=0;return G_(e,r,"","",function(a){return t.call(n,a,i++)}),r}function The(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Va={current:null},K_={transition:null},Phe={ReactCurrentDispatcher:Va,ReactCurrentBatchConfig:K_,ReactCurrentOwner:cD};function aG(){throw Error("act(...) is not supported in production builds of React.")}In.Children={map:Cw,forEach:function(e,t,n){Cw(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Cw(e,function(){t++}),t},toArray:function(e){return Cw(e,function(t){return t})||[]},only:function(e){if(!uD(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};In.Component=h0;In.Fragment=yhe;In.Profiler=bhe;In.PureComponent=oD;In.StrictMode=vhe;In.Suspense=Nhe;
vendor: 7,428 bytes, lines 9-25
9In.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Phe;In.act=aG;In.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=eG({},e.props),i=e.key,a=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(a=t.ref,o=cD.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)rG.call(t,c)&&!sG.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:vb,type:e.type,key:i,ref:a,props:r,_owner:o}};In.createContext=function(e){return e={$$typeof:_he,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:whe,_context:e},e.Consumer=e};In.createElement=iG;In.createFactory=function(e){var t=iG.bind(null,e);return t.type=e,t};In.createRef=function(){return{current:null}};In.forwardRef=function(e){return{$$typeof:jhe,render:e}};In.isValidElement=uD;In.lazy=function(e){return{$$typeof:Che,_payload:{_status:-1,_result:e},_init:The}};In.memo=function(e,t){return{$$typeof:khe,type:e,compare:t===void 0?null:t}};In.startTransition=function(e){var t=K_.transition;K_.transition={};try{e()}finally{K_.transition=t}};In.unstable_act=aG;In.useCallback=function(e,t){return Va.current.useCallback(e,t)};In.useContext=function(e){return Va.current.useContext(e)};In.useDebugValue=function(){};In.useDeferredValue=function(e){return Va.current.useDeferredValue(e)};In.useEffect=function(e,t){return Va.current.useEffect(e,t)};In.useId=function(){return Va.current.useId()};In.useImperativeHandle=function(e,t,n){return Va.current.useImperativeHandle(e,t,n)};In.useInsertionEffect=function(e,t){return Va.current.useInsertionEffect(e,t)};In.useLayoutEffect=function(e,t){return Va.current.useLayoutEffect(e,t)};In.useMemo=function(e,t){return Va.current.useMemo(e,t)};In.useReducer=function(e,t,n){return Va.current.useReducer(e,t,n)};In.useRef=function(e){return Va.current.useRef(e)};In.useState=function(e){return Va.current.useState(e)};In.useSyncExternalStore=function(e,t,n){return Va.current.useSyncExternalStore(e,t,n)};In.useTransition=function(){return Va.current.useTransition()};In.version="18.3.1";JW.exports=In;var N=JW.exports;const ee=dr(N),oG=ghe({__proto__:null,default:ee},[N]);/**
10 * @license React
11 * react-jsx-runtime.production.min.js
12 *
13 * Copyright (c) Facebook, Inc. and its affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var Ohe=N,Dhe=Symbol.for("react.element"),Ihe=Symbol.for("react.fragment"),Rhe=Object.prototype.hasOwnProperty,Mhe=Ohe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Lhe={key:!0,ref:!0,__self:!0,__source:!0};function lG(e,t,n){var r,i={},a=null,o=null;n!==void 0&&(a=""+n),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)Rhe.call(t,r)&&!Lhe.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:Dhe,type:e,key:a,ref:o,props:i,_owner:Mhe.current}}xk.Fragment=Ihe;xk.jsx=lG;xk.jsxs=lG;QW.exports=xk;var s=QW.exports,cG={exports:{}},Jo={},uG={exports:{}},dG={};/**
18 * @license React
19 * scheduler.production.min.js
20 *
21 * Copyright (c) Facebook, Inc. and its affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */(function(e){function t(K,W){var q=K.length;K.push(W);e:for(;0<q;){var oe=q-1>>>1,J=K[oe];if(0<i(J,W))K[oe]=W,K[q]=J,q=oe;else break e}}function n(K){return K.length===0?null:K[0]}function r(K){if(K.length===0)return null;var W=K[0],q=K.pop();if(q!==W){K[0]=q;e:for(var oe=0,J=K.length,Y=J>>>1;oe<Y;){var Z=2*(oe+1)-1,G=K[Z],se=Z+1,ce=K[se];if(0>i(G,q))se<J&&0>i(ce,G)?(K[oe]=ce,K[se]=q,oe=se):(K[oe]=G,K[Z]=q,oe=Z);else if(se<J&&0>i(ce,q))K[oe]=ce,K[se]=q,oe=se;else break e}}return W}function i(K,W){var q=K.sortIndex-W.sortIndex;return q!==0?q:K.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,x=!1,y=!1,b=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function j(K){for(var W=n(u);W!==null;){if(W.callback===null)r(u);else if(W.startTime<=K)r(u),W.sortIndex=W.expirationTime,t(c,W);else break;W=n(u)}}function E(K){if(y=!1,j(K),!x)if(n(c)!==null)x=!0,H(S);else{var W=n(u);W!==null&&z(E,W.startTime-K)}}function S(K,W){x=!1,y&&(y=!1,w(O),O=-1),p=!0;var q=h;try{for(j(W),f=n(c);f!==null&&(!(f.expirationTime>W)||K&&!L());){var oe=f.callback;if(typeof oe=="function"){f.callback=null,h=f.priorityLevel;var J=oe(f.expirationTime<=W);W=e.unstable_now(),typeof J=="function"?f.callback=J:f===n(c)&&r(c),j(W)}else r(c);f=n(c)}if(f!==null)var Y=!0;else{var Z=n(u);Z!==null&&z(E,Z.startTime-W),Y=!1}return Y}finally{f=null,h=q,p=!1}}var T=!1,P=null,O=-1,D=5,R=-1;function L(){return!(e.unstable_now()-R<D)}function M(){if(P!==null){var K=e.unstable_now();R=K;var W=!0;try{W=P(!0,K)}finally{W?B():(T=!1,P=null)}}else T=!1}var B;if(typeof _=="function")B=function(){_(M)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,F=U.port2;U.port1.onmessage=M,B=function(){F.postMessage(null)}}else B=function(){b(M,0)};function H(K){P=K,T||(T=!0,B())}function z(K,W){O=b(function(){K(e.unstable_now())},W)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(K){K.callback=null},e.unstable_continueExecution=function(){x||p||(x=!0,H(S))},e.unstable_forceFrameRate=function(K){0>K||125<K?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<K?Math.floor(1e3/K):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(K){switch(h){case 1:case 2:case 3:var W=3;break;default:W=h}var q=h;h=W;try{return K()}finally{h=q}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(K,W){switch(K){case 1:case 2:case 3:case 4:case 5:break;default:K=3}var q=h;h=K;try{return W()}finally{h=q}},e.unstable_scheduleCallback=function(K,W,q){var oe=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?oe+q:oe):q=oe,K){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=q+J,K={id:d++,callback:W,priorityLevel:K,startTime:q,expirationTime:J,sortIndex:-1},q>oe?(K.sortIndex=q,t(u,K),n(c)===null&&K===n(u)&&(y?(w(O),O=-1):y=!0,z(E,q-oe))):(K.sortIndex=J,t(c,K),x||p||(x=!0,H(S))),K},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(K){var W=h;return function(){var q=h;h=W;try{return K.apply(this,arguments)}finally{h=q}}}})(dG);
vendor: 4,252 bytes, lines 25-33
25uG.exports=dG;var Fhe=uG.exports;/**
26 * @license React
27 * react-dom.production.min.js
28 *
29 * Copyright (c) Facebook, Inc. and its affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var $he=N,Go=Fhe;function et(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var fG=new Set,Uv={};function lp(e,t){fx(e,t),fx(e+"Capture",t)}function fx(e,t){for(Uv[e]=t,e=0;e<t.length;e++)fG.add(t[e])}var Qu=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),b3=Object.prototype.hasOwnProperty,Bhe=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,oL={},lL={};function zhe(e){return b3.call(lL,e)?!0:b3.call(oL,e)?!1:Bhe.test(e)?lL[e]=!0:(oL[e]=!0,!1)}function Uhe(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function qhe(e,t,n,r){if(t===null||typeof t>"u"||Uhe(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ha(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var oa={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){oa[e]=new Ha(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];oa[t]=new Ha(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){oa[e]=new Ha(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){oa[e]=new Ha(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){oa[e]=new Ha(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){oa[e]=new Ha(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){oa[e]=new Ha(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){oa[e]=new Ha(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){oa[e]=new Ha(e,5,!1,e.toLowerCase(),null,!1,!1)});var dD=/[\-:]([a-z])/g;function fD(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode
33-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(dD,fD);oa[t]=new Ha(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(dD,fD);oa[t]=new Ha(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(dD,fD);oa[t]=new Ha(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){oa[e]=new Ha(e,1,!1,e.toLowerCase(),null,!1,!1)});oa.xlinkHref=new Ha("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){oa[e]=new Ha(e,1,!1,e.toLowerCase(),null,!0,!0)});function hD(e,t,n,r){var i=oa.hasOwnProperty(t)?oa[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(qhe(t,n,i,r)&&(n=null),r||i===null?zhe(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var md=$he.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ew=Symbol.for("react.element"),lg=Symbol.for("react.portal"),cg=Symbol.for("react.fragment"),mD=Symbol.for("react.strict_mode"),w3=Symbol.for("react.profiler"),hG=Symbol.for("react.provider"),mG=Symbol.for("react.context"),pD=Symbol.for("react.forward_ref"),_3=Symbol.for("react.suspense"),j3=Symbol.for("react.suspense_list"),gD=Symbol.for("react.memo"),Wd=Symbol.for("react.lazy"),pG=Symbol.for("react.offscreen"),cL=Symbol.iterator;function uy(e){return e===null||typeof e!="object"?null:(e=cL&&e[cL]||e["@@iterator"],typeof e=="function"?e:null)}var ks=Object.assign,NS;function Qy(e){if(NS===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);NS=t&&t[1]||""}return`
34`+NS+e}var kS=!1;function CS(e,t){if(!e||kS)return"";kS=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var i=u.stack.split(`
35`),a=r.stack.split(`
36`),o=i.length-1,l=a.length-1;1<=o&&0<=l&&i[o]!==a[l];)l--;for(;1<=o&&0<=l;o--,l--)if(i[o]!==a[l]){if(o!==1||l!==1)do if(o--,l--,0>l||i[o]!==a[l]){var c=`
37`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{kS=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Qy(e):""}function Vhe(e){switch(e.tag){case 5:return Qy(e.type);case 16:return Qy("Lazy");case 13:return Qy("Suspense");case 19:return Qy("SuspenseList");case 0:case 2:case 15:return e=CS(e.type,!1),e;case 11:return e=CS(e.type.render,!1),e;case 1:return e=CS(e.type,!0),e;default:return""}}function N3(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case cg:return"Fragment";case lg:return"Portal";case w3:return"Profiler";case mD:return"StrictMode";case _3:return"Suspense";case j3:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case mG:return(e.displayName||"Context")+".Consumer";case hG:return(e._context.displayName||"Context")+".Provider";case pD:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case gD:return t=e.displayName||null,t!==null?t:N3(e.type)||"Memo";case Wd:t=e._payload,e=e._init;try{return N3(e(t))}catch{}}return null}function Hhe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return N3(t);case 8:return t===mD?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Pf(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gG(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Whe(e){var t=gG(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,a.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Sw(e){e._valueTracker||(e._valueTracker=Whe(e))}function xG(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=gG(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Rj(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function k3(e,t){var n=t.checked;return ks({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function uL(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Pf(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function yG(e,t){t=t.checked,t!=null&&hD(e,"checked",t,!1)}function C3(e,t){yG(e,t);var n=Pf(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?E3(e,t.type,n):t.hasOwnProperty("defaultValue")&&E3(e,t.type,Pf(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function dL(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function E3(e,t,n){(t!=="number"||Rj(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Jy=Array.isArray;function Rg(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Pf(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function S3(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(et(91));return ks({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function fL(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(et(92));if(Jy(n)){if(1<n.length)throw Error(et(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Pf(n)}}function vG(e,t){var n=Pf(t.value),r=Pf(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function hL(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function bG(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function A3(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?bG(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Aw,wG=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Aw=Aw||document.createElement("div"),Aw.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Aw.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function qv(e,t){if(t){var n=e.firstChild;
vendor: 8,078 bytes, line 37
37if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var uv={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ghe=["Webkit","ms","Moz","O"];Object.keys(uv).forEach(function(e){Ghe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),uv[t]=uv[e]})});function _G(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||uv.hasOwnProperty(e)&&uv[e]?(""+t).trim():t+"px"}function jG(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=_G(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Khe=ks({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function T3(e,t){if(t){if(Khe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(et(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(et(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(et(61))}if(t.style!=null&&typeof t.style!="object")throw Error(et(62))}}function P3(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var O3=null;function xD(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var D3=null,Mg=null,Lg=null;function mL(e){if(e=_b(e)){if(typeof D3!="function")throw Error(et(280));var t=e.stateNode;t&&(t=_k(t),D3(e.stateNode,e.type,t))}}function NG(e){Mg?Lg?Lg.push(e):Lg=[e]:Mg=e}function kG(){if(Mg){var e=Mg,t=Lg;if(Lg=Mg=null,mL(e),t)for(e=0;e<t.length;e++)mL(t[e])}}function CG(e,t){return e(t)}function EG(){}var ES=!1;function SG(e,t,n){if(ES)return e(t,n);ES=!0;try{return CG(e,t,n)}finally{ES=!1,(Mg!==null||Lg!==null)&&(EG(),kG())}}function Vv(e,t){var n=e.stateNode;if(n===null)return null;var r=_k(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(et(231,t,typeof n));return n}var I3=!1;if(Qu)try{var dy={};Object.defineProperty(dy,"passive",{get:function(){I3=!0}}),window.addEventListener("test",dy,dy),window.removeEventListener("test",dy,dy)}catch{I3=!1}function Yhe(e,t,n,r,i,a,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var dv=!1,Mj=null,Lj=!1,R3=null,Xhe={onError:function(e){dv=!0,Mj=e}};function Qhe(e,t,n,r,i,a,o,l,c){dv=!1,Mj=null,Yhe.apply(Xhe,arguments)}function Jhe(e,t,n,r,i,a,o,l,c){if(Qhe.apply(this,arguments),dv){if(dv){var u=Mj;dv=!1,Mj=null}else throw Error(et(198));Lj||(Lj=!0,R3=u)}}function cp(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function AG(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function pL(e){if(cp(e)!==e)throw Error(et(188))}function Zhe(e){var t=e.alternate;if(!t){if(t=cp(e),t===null)throw Error(et(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return pL(i),e;if(a===r)return pL(i),t;a=a.sibling}throw Error(et(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,l=i.child;l;){if(l===n){o=!0,n=i,r=a;break}if(l===r){o=!0,r=i,n=a;break}l=l.sibling}if(!o){for(l=a.child;l;){if(l===n){o=!0,n=a,r=i;break}if(l===r){o=!0,r=a,n=i;break}l=l.sibling}if(!o)throw Error(et(189))}}if(n.alternate!==r)throw Error(et(190))}if(n.tag!==3)throw Error(et(188));return n.stateNode.current===n?e:t}function TG(e){return e=Zhe(e),e!==null?PG(e):null}function PG(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=PG(e);if(t!==null)return t;e=e.sibling}return null}var OG=Go.unstable_scheduleCallback,gL=Go.unstable_cancelCallback,eme=Go.unstable_shouldYield,tme=Go.unstable_requestPaint,Ws=Go.unstable_now,nme=Go.unstable_getCurrentPriorityLevel,yD=Go.unstable_ImmediatePriority,DG=Go.unstable_UserBlockingPriority,Fj=Go.unstable_NormalPriority,rme=Go.unstable_LowPriority,IG=Go.unstable_IdlePriority,yk=null,Jc=null;function sme(e){if(Jc&&typeof Jc.onCommitFiberRoot=="function")try{Jc.onCommitFiberRoot(yk,e,void 0,(e.current.flags&128)===128)}catch{}}var fc=Math.clz32?Math.clz32:ome,ime=Math.log,ame=Math.LN2;function ome(e){return e>>>=0,e===0?32:31-(ime(e)/ame|0)|0}var Tw=64,Pw=4194304;function Zy(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function $j(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Zy(l):(a&=o,a!==0&&(r=Zy(a)))}else o=n&~i,o!==0?r=Zy(o):a!==0&&(r=Zy(a));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,a=t&-t,i>=a||i===16&&(a&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-fc(t),i=1<<n,r|=e[n],t&=~i;return r}function lme(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function cme(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-fc(a),l=1<<o,c=i[o];c===-1?(!(l&n)||l&r)&&(i[o]=lme(l,t)):c<=t&&(e.expiredLanes|=l),a&=~l}}function M3(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function RG(){var e=Tw;return Tw<<=1,!(Tw&4194240)&&(Tw=64),e}function SS(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function bb(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-fc(t),e[t]=n}function ume(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-fc(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function vD(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-fc(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var Ar=0;function MG(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var LG,bD,FG,$G,BG,L3=!1,Ow=[],xf=null,yf=null,vf=null,Hv=new Map,Wv=new Map,Jd=[],dme="mou
37sedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function xL(e,t){switch(e){case"focusin":case"focusout":xf=null;break;case"dragenter":case"dragleave":yf=null;break;case"mouseover":case"mouseout":vf=null;break;case"pointerover":case"pointerout":Hv.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Wv.delete(t.pointerId)}}function fy(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=_b(t),t!==null&&bD(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function fme(e,t,n,r,i){switch(t){case"focusin":return xf=fy(xf,e,t,n,r,i),!0;case"dragenter":return yf=fy(yf,e,t,n,r,i),!0;case"mouseover":return vf=fy(vf,e,t,n,r,i),!0;case"pointerover":var a=i.pointerId;return Hv.set(a,fy(Hv.get(a)||null,e,t,n,r,i)),!0;case"gotpointercapture":return a=i.pointerId,Wv.set(a,fy(Wv.get(a)||null,e,t,n,r,i)),!0}return!1}function zG(e){var t=Xh(e.target);if(t!==null){var n=cp(t);if(n!==null){if(t=n.tag,t===13){if(t=AG(n),t!==null){e.blockedOn=t,BG(e.priority,function(){FG(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Y_(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=F3(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);O3=r,n.target.dispatchEvent(r),O3=null}else return t=_b(n),t!==null&&bD(t),e.blockedOn=n,!1;t.shift()}return!0}function yL(e,t,n){Y_(e)&&n.delete(t)}function hme(){L3=!1,xf!==null&&Y_(xf)&&(xf=null),yf!==null&&Y_(yf)&&(yf=null),vf!==null&&Y_(vf)&&(vf=null),Hv.forEach(yL),Wv.forEach(yL)}function hy(e,t){e.blockedOn===t&&(e.blockedOn=null,L3||(L3=!0,Go.unstable_scheduleCallback(Go.unstable_NormalPriority,hme)))}function Gv(e){function t(i){return hy(i,e)}if(0<Ow.length){hy(Ow[0],e);for(var n=1;n<Ow.length;n++){var r=Ow[n];r.blockedOn===e&&(r.blockedOn=null)}}for(xf!==null&&hy(xf,e),yf!==null&&hy(yf,e),vf!==null&&hy(vf,e),Hv.forEach(t),Wv.forEach(t),n=0;n<Jd.length;n++)r=Jd[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Jd.length&&(n=Jd[0],n.blockedOn===null);)zG(n),n.blockedOn===null&&Jd.shift()}var Fg=md.ReactCurrentBatchConfig,Bj=!0;function mme(e,t,n,r){var i=Ar,a=Fg.transition;Fg.transition=null;try{Ar=1,wD(e,t,n,r)}finally{Ar=i,Fg.transition=a}}function pme(e,t,n,r){var i=Ar,a=Fg.transition;Fg.transition=null;try{Ar=4,wD(e,t,n,r)}finally{Ar=i,Fg.transition=a}}function wD(e,t,n,r){if(Bj){var i=F3(e,t,n,r);if(i===null)FS(e,t,r,zj,n),xL(e,r);else if(fme(i,e,t,n,r))r.stopPropagation();else if(xL(e,r),t&4&&-1<dme.indexOf(e)){for(;i!==null;){var a=_b(i);if(a!==null&&LG(a),a=F3(e,t,n,r),a===null&&FS(e,t,r,zj,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else FS(e,t,r,null,n)}}var zj=null;function F3(e,t,n,r){if(zj=null,e=xD(r),e=Xh(e),e!==null)if(t=cp(e),t===null)e=null;else if(n=t.tag,n===13){if(e=AG(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return zj=e,null}function UG(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(nme()){case yD:return 1;case DG:return 4;case Fj:case rme:return 16;case IG:return 536870912;default:return 16}default:return 16}}var ff=null,_D=null,X_=null;function qG(){if(X_)return X_;var e,t=_D,n=t.length,r,i="value"in ff?ff.value:ff.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return X_=i.slice(e,1<r?1-r:void 0)}function Q_(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Dw(){return!0}function vL(){return!1}function Zo(e){function t(n,r,i,a,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=a,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(a):a[l]);return this.isDefaultPrevented=(a.defaultPrevented!=null?a.defaultPrevented:a.returnValue===!1)?Dw:vL,this.isPropagationStopped=vL,this}return ks(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Dw)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Dw)},persist:function(){},isPersistent:Dw}),t}var m0={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},jD=Zo(m0),wb=ks({},m0,{view:0,detail:0}),gme=Zo(wb),AS,TS,my,vk=ks({},wb,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ND,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==my&&(my&&e.type==="mousemove"?(AS=e.screenX-my.screenX,TS=e.screenY-my.screenY):TS=AS=0,my=e),AS)},movementY:function(e){return"movementY"in e?e.movementY:TS}}),bL=Zo(vk),xme=ks({},vk,{dataTransfer:0}),yme=Zo(xme),vme=ks({},wb,{relatedTarget:0}),PS=Zo(vme),bme=ks({},m0,{animationName:0,elapsedTime:0,pseudoElement:0}),wme=Zo(bme),_me=ks({},m0,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),jme=Zo(_me),Nme=ks({},m0,{data:0}),wL=Zo(Nme),kme={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Cme={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Eme={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sme(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Eme[e])?!!t[e]:!1}function ND(){return Sme}var Ame=ks({},wb,{key:function(e){if(e.key){var t=kme[e.key]||e.key;if(t!=="Unidentified")return t}
vendor: 5,740 bytes, line 37
37return e.type==="keypress"?(e=Q_(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Cme[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ND,charCode:function(e){return e.type==="keypress"?Q_(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Q_(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Tme=Zo(Ame),Pme=ks({},vk,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_L=Zo(Pme),Ome=ks({},wb,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ND}),Dme=Zo(Ome),Ime=ks({},m0,{propertyName:0,elapsedTime:0,pseudoElement:0}),Rme=Zo(Ime),Mme=ks({},vk,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Lme=Zo(Mme),Fme=[9,13,27,32],kD=Qu&&"CompositionEvent"in window,fv=null;Qu&&"documentMode"in document&&(fv=document.documentMode);var $me=Qu&&"TextEvent"in window&&!fv,VG=Qu&&(!kD||fv&&8<fv&&11>=fv),jL=" ",NL=!1;function HG(e,t){switch(e){case"keyup":return Fme.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function WG(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ug=!1;function Bme(e,t){switch(e){case"compositionend":return WG(t);case"keypress":return t.which!==32?null:(NL=!0,jL);case"textInput":return e=t.data,e===jL&&NL?null:e;default:return null}}function zme(e,t){if(ug)return e==="compositionend"||!kD&&HG(e,t)?(e=qG(),X_=_D=ff=null,ug=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return VG&&t.locale!=="ko"?null:t.data;default:return null}}var Ume={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function kL(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Ume[e.type]:t==="textarea"}function GG(e,t,n,r){NG(r),t=Uj(t,"onChange"),0<t.length&&(n=new jD("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var hv=null,Kv=null;function qme(e){sK(e,0)}function bk(e){var t=hg(e);if(xG(t))return e}function Vme(e,t){if(e==="change")return t}var KG=!1;if(Qu){var OS;if(Qu){var DS="oninput"in document;if(!DS){var CL=document.createElement("div");CL.setAttribute("oninput","return;"),DS=typeof CL.oninput=="function"}OS=DS}else OS=!1;KG=OS&&(!document.documentMode||9<document.documentMode)}function EL(){hv&&(hv.detachEvent("onpropertychange",YG),Kv=hv=null)}function YG(e){if(e.propertyName==="value"&&bk(Kv)){var t=[];GG(t,Kv,e,xD(e)),SG(qme,t)}}function Hme(e,t,n){e==="focusin"?(EL(),hv=t,Kv=n,hv.attachEvent("onpropertychange",YG)):e==="focusout"&&EL()}function Wme(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return bk(Kv)}function Gme(e,t){if(e==="click")return bk(t)}function Kme(e,t){if(e==="input"||e==="change")return bk(t)}function Yme(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var gc=typeof Object.is=="function"?Object.is:Yme;function Yv(e,t){if(gc(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!b3.call(t,i)||!gc(e[i],t[i]))return!1}return!0}function SL(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function AL(e,t){var n=SL(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=SL(n)}}function XG(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?XG(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function QG(){for(var e=window,t=Rj();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Rj(e.document)}return t}function CD(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Xme(e){var t=QG(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&XG(n.ownerDocument.documentElement,n)){if(r!==null&&CD(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=AL(n,a);var o=AL(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Qme=Qu&&"documentMode"in document&&11>=document.documentMode,dg=null,$3=null,mv=null,B3=!1;
vendor: 4,830 bytes, line 37
37function TL(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;B3||dg==null||dg!==Rj(r)||(r=dg,"selectionStart"in r&&CD(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),mv&&Yv(mv,r)||(mv=r,r=Uj($3,"onSelect"),0<r.length&&(t=new jD("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=dg)))}function Iw(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var fg={animationend:Iw("Animation","AnimationEnd"),animationiteration:Iw("Animation","AnimationIteration"),animationstart:Iw("Animation","AnimationStart"),transitionend:Iw("Transition","TransitionEnd")},IS={},JG={};Qu&&(JG=document.createElement("div").style,"AnimationEvent"in window||(delete fg.animationend.animation,delete fg.animationiteration.animation,delete fg.animationstart.animation),"TransitionEvent"in window||delete fg.transitionend.transition);function wk(e){if(IS[e])return IS[e];if(!fg[e])return e;var t=fg[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in JG)return IS[e]=t[n];return e}var ZG=wk("animationend"),eK=wk("animationiteration"),tK=wk("animationstart"),nK=wk("transitionend"),rK=new Map,PL="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Wf(e,t){rK.set(e,t),lp(t,[e])}for(var RS=0;RS<PL.length;RS++){var MS=PL[RS],Jme=MS.toLowerCase(),Zme=MS[0].toUpperCase()+MS.slice(1);Wf(Jme,"on"+Zme)}Wf(ZG,"onAnimationEnd");Wf(eK,"onAnimationIteration");Wf(tK,"onAnimationStart");Wf("dblclick","onDoubleClick");Wf("focusin","onFocus");Wf("focusout","onBlur");Wf(nK,"onTransitionEnd");fx("onMouseEnter",["mouseout","mouseover"]);fx("onMouseLeave",["mouseout","mouseover"]);fx("onPointerEnter",["pointerout","pointerover"]);fx("onPointerLeave",["pointerout","pointerover"]);lp("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));lp("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));lp("onBeforeInput",["compositionend","keypress","textInput","paste"]);lp("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));lp("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));lp("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ev="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),epe=new Set("cancel close invalid load scroll toggle".split(" ").concat(ev));function OL(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Jhe(r,t,void 0,e),e.currentTarget=null}function sK(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==a&&i.isPropagationStopped())break e;OL(i,l,u),a=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==a&&i.isPropagationStopped())break e;OL(i,l,u),a=c}}}if(Lj)throw e=R3,Lj=!1,R3=null,e}function rs(e,t){var n=t[H3];n===void 0&&(n=t[H3]=new Set);var r=e+"__bubble";n.has(r)||(iK(t,e,2,!1),n.add(r))}function LS(e,t,n){var r=0;t&&(r|=4),iK(n,e,r,t)}var Rw="_reactListening"+Math.random().toString(36).slice(2);function Xv(e){if(!e[Rw]){e[Rw]=!0,fG.forEach(function(n){n!=="selectionchange"&&(epe.has(n)||LS(n,!1,e),LS(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Rw]||(t[Rw]=!0,LS("selectionchange",!1,t))}}function iK(e,t,n,r){switch(UG(t)){case 1:var i=mme;break;case 4:i=pme;break;default:i=wD}n=i.bind(null,t,n,e),i=void 0,!I3||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function FS(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;
vendor: 35,813 bytes, lines 37-40
37if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;l!==null;){if(o=Xh(l),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue e}l=l.parentNode}}r=r.return}SG(function(){var u=a,d=xD(n),f=[];e:{var h=rK.get(e);if(h!==void 0){var p=jD,x=e;switch(e){case"keypress":if(Q_(n)===0)break e;case"keydown":case"keyup":p=Tme;break;case"focusin":x="focus",p=PS;break;case"focusout":x="blur",p=PS;break;case"beforeblur":case"afterblur":p=PS;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=bL;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=yme;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Dme;break;case ZG:case eK:case tK:p=wme;break;case nK:p=Rme;break;case"scroll":p=gme;break;case"wheel":p=Lme;break;case"copy":case"cut":case"paste":p=jme;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=_L}var y=(t&4)!==0,b=!y&&e==="scroll",w=y?h!==null?h+"Capture":null:h;y=[];for(var _=u,j;_!==null;){j=_;var E=j.stateNode;if(j.tag===5&&E!==null&&(j=E,w!==null&&(E=Vv(_,w),E!=null&&y.push(Qv(_,E,j)))),b)break;_=_.return}0<y.length&&(h=new p(h,x,null,n,d),f.push({event:h,listeners:y}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",h&&n!==O3&&(x=n.relatedTarget||n.fromElement)&&(Xh(x)||x[Ju]))break e;if((p||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,p?(x=n.relatedTarget||n.toElement,p=u,x=x?Xh(x):null,x!==null&&(b=cp(x),x!==b||x.tag!==5&&x.tag!==6)&&(x=null)):(p=null,x=u),p!==x)){if(y=bL,E="onMouseLeave",w="onMouseEnter",_="mouse",(e==="pointerout"||e==="pointerover")&&(y=_L,E="onPointerLeave",w="onPointerEnter",_="pointer"),b=p==null?h:hg(p),j=x==null?h:hg(x),h=new y(E,_+"leave",p,n,d),h.target=b,h.relatedTarget=j,E=null,Xh(d)===u&&(y=new y(w,_+"enter",x,n,d),y.target=j,y.relatedTarget=b,E=y),b=E,p&&x)t:{for(y=p,w=x,_=0,j=y;j;j=Ip(j))_++;for(j=0,E=w;E;E=Ip(E))j++;for(;0<_-j;)y=Ip(y),_--;for(;0<j-_;)w=Ip(w),j--;for(;_--;){if(y===w||w!==null&&y===w.alternate)break t;y=Ip(y),w=Ip(w)}y=null}else y=null;p!==null&&DL(f,h,p,y,!1),x!==null&&b!==null&&DL(f,b,x,y,!0)}}e:{if(h=u?hg(u):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var S=Vme;else if(kL(h))if(KG)S=Kme;else{S=Wme;var T=Hme}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(S=Gme);if(S&&(S=S(e,u))){GG(f,S,n,d);break e}T&&T(e,h,u),e==="focusout"&&(T=h._wrapperState)&&T.controlled&&h.type==="number"&&E3(h,"number",h.value)}switch(T=u?hg(u):window,e){case"focusin":(kL(T)||T.contentEditable==="true")&&(dg=T,$3=u,mv=null);break;case"focusout":mv=$3=dg=null;break;case"mousedown":B3=!0;break;case"contextmenu":case"mouseup":case"dragend":B3=!1,TL(f,n,d);break;case"selectionchange":if(Qme)break;case"keydown":case"keyup":TL(f,n,d)}var P;if(kD)e:{switch(e){case"compositionstart":var O="onCompositionStart";break e;case"compositionend":O="onCompositionEnd";break e;case"compositionupdate":O="onCompositionUpdate";break e}O=void 0}else ug?HG(e,n)&&(O="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(O="onCompositionStart");O&&(VG&&n.locale!=="ko"&&(ug||O!=="onCompositionStart"?O==="onCompositionEnd"&&ug&&(P=qG()):(ff=d,_D="value"in ff?ff.value:ff.textContent,ug=!0)),T=Uj(u,O),0<T.length&&(O=new wL(O,e,null,n,d),f.push({event:O,listeners:T}),P?O.data=P:(P=WG(n),P!==null&&(O.data=P)))),(P=$me?Bme(e,n):zme(e,n))&&(u=Uj(u,"onBeforeInput"),0<u.length&&(d=new wL("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=P))}sK(f,t)})}function Qv(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Uj(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Vv(e,n),a!=null&&r.unshift(Qv(e,a,i)),a=Vv(e,t),a!=null&&r.push(Qv(e,a,i))),e=e.return}return r}function Ip(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function DL(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,i?(c=Vv(n,a),c!=null&&o.unshift(Qv(n,c,l))):i||(c=Vv(n,a),c!=null&&o.push(Qv(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var tpe=/\r\n?/g,npe=/\u0000|\uFFFD/g;function IL(e){return(typeof e=="string"?e:""+e).replace(tpe,`
38`).replace(npe,"")}function Mw(e,t,n){if(t=IL(t),IL(e)!==t&&n)throw Error(et(425))}function qj(){}var z3=null,U3=null;function q3(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var V3=typeof setTimeout=="function"?setTimeout:void 0,rpe=typeof clearTimeout=="function"?clearTimeout:void 0,RL=typeof Promise=="function"?Promise:void 0,spe=typeof queueMicrotask=="function"?queueMicrotask:typeof RL<"u"?function(e){return RL.resolve(null).then(e).catch(ipe)}:V3;function ipe(e){setTimeout(function(){throw e})}function $S(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),Gv(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);Gv(t)}function bf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function ML(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var p0=Math.random().toString(36).slice(2),zc="__reactFiber$"+p0,Jv="__reactProps$"+p0,Ju="__reactContainer$"+p0,H3="__reactEvents$"+p0,ape="__reactListeners$"+p0,ope="__reactHandles$"+p0;function Xh(e){var t=e[zc];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ju]||n[zc]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ML(e);e!==null;){if(n=e[zc])return n;e=ML(e)}return t}e=n,n=e.parentNode}return null}function _b(e){return e=e[zc]||e[Ju],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function hg(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(et(33))}function _k(e){return e[Jv]||null}var W3=[],mg=-1;function Gf(e){return{current:e}}function os(e){0>mg||(e.current=W3[mg],W3[mg]=null,mg--)}function Qr(e,t){mg++,W3[mg]=e.current,e.current=t}var Of={},ja=Gf(Of),ho=Gf(!1),Dm=Of;function hx(e,t){var n=e.type.contextTypes;if(!n)return Of;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function mo(e){return e=e.childContextTypes,e!=null}function Vj(){os(ho),os(ja)}function LL(e,t,n){if(ja.current!==Of)throw Error(et(168));Qr(ja,t),Qr(ho,n)}function aK(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(et(108,Hhe(e)||"Unknown",i));return ks({},n,r)}function Hj(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Of,Dm=ja.current,Qr(ja,e),Qr(ho,ho.current),!0}function FL(e,t,n){var r=e.stateNode;if(!r)throw Error(et(169));n?(e=aK(e,t,Dm),r.__reactInternalMemoizedMergedChildContext=e,os(ho),os(ja),Qr(ja,e)):os(ho),Qr(ho,n)}var Su=null,jk=!1,BS=!1;function oK(e){Su===null?Su=[e]:Su.push(e)}function lpe(e){jk=!0,oK(e)}function Kf(){if(!BS&&Su!==null){BS=!0;var e=0,t=Ar;try{var n=Su;for(Ar=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Su=null,jk=!1}catch(i){throw Su!==null&&(Su=Su.slice(e+1)),OG(yD,Kf),i}finally{Ar=t,BS=!1}}return null}var pg=[],gg=0,Wj=null,Gj=0,pl=[],gl=0,Im=null,Ru=1,Mu="";function Rh(e,t){pg[gg++]=Gj,pg[gg++]=Wj,Wj=e,Gj=t}function lK(e,t,n){pl[gl++]=Ru,pl[gl++]=Mu,pl[gl++]=Im,Im=e;var r=Ru;e=Mu;var i=32-fc(r)-1;r&=~(1<<i),n+=1;var a=32-fc(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ru=1<<32-fc(t)+i|n<<i|r,Mu=a+e}else Ru=1<<a|n<<i|r,Mu=e}function ED(e){e.return!==null&&(Rh(e,1),lK(e,1,0))}function SD(e){for(;e===Wj;)Wj=pg[--gg],pg[gg]=null,Gj=pg[--gg],pg[gg]=null;for(;e===Im;)Im=pl[--gl],pl[gl]=null,Mu=pl[--gl],pl[gl]=null,Ru=pl[--gl],pl[gl]=null}var Uo=null,zo=null,hs=!1,ac=null;function cK(e,t){var n=bl(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function $L(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Uo=e,zo=bf(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Uo=e,zo=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Im!==null?{id:Ru,overflow:Mu}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=bl(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Uo=e,zo=null,!0):!1;default:return!1}}function G3(e){return(e.mode&1)!==0&&(e.flags&128)===0}function K3(e){if(hs){var t=zo;if(t){var n=t;if(!$L(e,t)){if(G3(e))throw Error(et(418));t=bf(n.nextSibling);var r=Uo;t&&$L(e,t)?cK(r,n):(e.flags=e.flags&-4097|2,hs=!1,Uo=e)}}else{if(G3(e))throw Error(et(418));e.flags=e.flags&-4097|2,hs=!1,Uo=e}}}function BL(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Uo=e}function Lw(e){if(e!==Uo)return!1;if(!hs)return BL(e),hs=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!q3(e.type,e.memoizedProps)),t&&(t=zo)){if(G3(e))throw uK(),Error(et(418));for(;t;)cK(e,t),t=bf(t.nextSibling)}if(BL(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(et(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){zo=bf(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}zo=null}}else zo=Uo?bf(e.stateNode.nextSibling):null;return!0}function uK(){for(var e=zo;e;)e=bf(e.nextSibling)}function mx(){zo=Uo=null,hs=!1}function AD(e){ac===null?ac=[e]:ac.push(e)}var cpe=md.ReactCurrentBatchConfig;function py(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(et(309));var r=n.stateNode}if(!r)throw Error(et(147,e));var i=r,a=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===a?t.ref:(t=function(o){var l=i.refs;o===null?delete l[a]:l[a]=o},t._stringRef=a,t)}if(typeof e!="string")throw Error(et(284));if(!n._owner)throw Error(et(290,e))}return e}function Fw(e,t){throw e=Object.prototype.toString.call(t),Error(et(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function zL(e){var t=e._init;return t(e._payload)}function dK(e){function t(w,_){if(e){var j=w.deletions;j===null?(w.deletions=[_],w.flags|=16):j.push(_)}}function n(w,_){if(!e)return null;for(;_!==null;)t(w,_),_=_.sibling;return null}function r(w,_){for(w=new Map;_!==null;)_.key!==null?w.set(_.key,_):w.set(_.index,_),_=_.sibling;return w}function i(w,_){return w=Nf(w,_),w.index=0,w.sibling=null,w}function a(w,_,j){return w.index=j,e?(j=w.alternate,j!==null?(j=j.index,j<_?(w.flags|=2,_):j):(w.flags|=2,_)):(w.flags|=1048576,_)}function o(w){return e&&w.alternate===null&&(w.flags|=2),w}function l(w,_,j,E){return _===null||_.tag!==6?(_=GS(j,w.mode,E),_.return=w,_):(_=i(_,j),_.return=w,_)}function c(w,_,j,E){var S=j.type;return S===cg?d(w,_,j.props.children,E,j.key):_!==null&&(_.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Wd&&zL(S)===_.type)?(E=i(_,j.props),E.ref=py(w,_,j),E.return=w,E):(E=sj(j.type,j.key,j.props,null,w.mode,E),E.ref=py(w,_,j),E.return=w,E)}function u(w,_,j,E){return _===null||_.tag!==4||_.stateNode.containerInfo!==j.containerInfo||_.stateNode.implementation!==j.implementation?(_=KS(j,w.mode,E),_.return=w,_):(_=i(_,j.children||[]),_.return=w,_)}function d(w,_,j,E,S){return _===null||_.tag!==7?(_=Nm(j,w.mode,E,S),_.return=w,_):(_=i(_,j),_.return=w,_)}function f(w,_,j){if(typeof _=="string"&&_!==""||typeof _=="number")return _=GS(""+_,w.mode,j),_.return=w,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Ew:return j=sj(_.type,_.key,_.props,null,w.mode,j),j.ref=py(w,null,_),j.return=w,j;case lg:return _=KS(_,w.mode,j),_.return=w,_;case Wd:var E=_._init;return f(w,E(_._payload),j)}if(Jy(_)||uy(_))return _=Nm(_,w.mode,j,null),_.return=w,_;Fw(w,_)}return null}function h(w,_,j,E){var S=_!==null?_.key:null;if(typeof j=="string"&&j!==""||typeof j=="number")return S!==null?null:l(w,_,""+j,E);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case Ew:return j.key===S?c(w,_,j,E):null;case lg:return j.key===S?u(w,_,j,E):null;case Wd:return S=j._init,h(w,_,S(j._payload),E)}if(Jy(j)||uy(j))return S!==null?null:d(w,_,j,E,null);Fw(w,j)}return null}function p(w,_,j,E,S){if(typeof E=="string"&&E!==""||typeof E=="number")return w=w.get(j)||null,l(_,w,""+E,S);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case Ew:return w=w.get(E.key===null?j:E.key)||null,c(_,w,E,S);case lg:return w=w.get(E.key===null?j:E.key)||null,u(_,w,E,S);case Wd:var T=E._init;return p(w,_,j,T(E._payload),S)}if(Jy(E)||uy(E))return w=w.get(j)||null,d(_,w,E,S,null);Fw(_,E)}return null}function x(w,_,j,E){for(var S=null,T=null,P=_,O=_=0,D=null;P!==null&&O<j.length;O++){P.index>O?(D=P,P=null):D=P.sibling;var R=h(w,P,j[O],E);if(R===null){P===null&&(P=D);break}e&&P&&R.alternate===null&&t(w,P),_=a(R,_,O),T===null?S=R:T.sibling=R,T=R,P=D}if(O===j.length)return n(w,P),hs&&Rh(w,O),S;if(P===null){for(;O<j.length;O++)P=f(w,j[O],E),P!==null&&(_=a(P,_,O),T===null?S=P:T.sibling=P,T=P);return hs&&Rh(w,O),S}for(P=r(w,P);O<j.length;O++)D=p(P,w,O,j[O],E),D!==null&&(e&&D.alternate!==null&&P.delete(D.key===null?O:D.key),_=a(D,_,O),T===null?S=D:T.sibling=D,T=D);return e&&P.forEach(function(L){return t(w,L)}),hs&&Rh(w,O),S}function y(w,_,j,E){var S=uy(j);if(typeof S!="function")throw Error(et(150));if(j=S.call(j),j==null)throw Error(et(151));for(var T=S=null,P=_,O=_=0,D=null,R=j.next();P!==null&&!R.done;O++,R=j.next()){P.index>O?(D=P,P=null):D=P.sibling;var L=h(w,P,R.value,E);if(L===null){P===null&&(P=D);break}e&&P&&L.alternate===null&&t(w,P),_=a(L,_,O),T===null?S=L:T.sibling=L,T=L,P=D}if(R.done)return n(w,P),hs&&Rh(w,O),S;if(P===null){for(;!R.done;O++,R=j.next())R=f(w,R.value,E),R!==null&&(_=a(R,_,O),T===null?S=R:T.sibling=R,T=R);return hs&&Rh(w,O),S}for(P=r(w,P);!R.done;O++,R=j.next())R=p(P,w,O,R.value,E),R!==null&&(e&&R.alternate!==null&&P.delete(R.key===null?O:R.key),_=a(R,_,O),T===null?S=R:T.sibling=R,T=R);return e&&P.forEach(function(M){return t(w,M)}),hs&&Rh(w,O),S}function b(w,_,j,E){if(typeof j=="object"&&j!==null&&j.type===cg&&j.key===null&&(j=j.props.children),typeof j=="object"&&j!==null){switch(j.$$typeof){case Ew:e:{for(var S=j.key,T=_;T!==null;){if(T.key===S){if(S=j.type,S===cg){if(T.tag===7){n(w,T.sibling),_=i(T,j.props.children),_.return=w,w=_;break e}}else if(T.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Wd&&zL(S)===T.type){n(w,T.sibling),_=i(T,j.props),_.ref=py(w,T,j),_.return=w,w=_;break e}n(w,T);break}else t(w,T);T=T.sibling}j.type===cg?(_=Nm(j.props.children,w.mode,E,j.key),_.return=w,w=_):(E=sj(j.type,j.key,j.props,null,w.mode,E),E.ref=py(w,_,j),E.return=w,w=E)}return o(w);case lg:e:{for(T=j.key;_!==null;){if(_.key===T)if(_.tag===4&&_.stateNode.containerInfo===j.containerInfo&&_.stateNode.implementation===j.implementation){n(w,_.sibling),_=i(_,j.children||[]),_.return=w,w=_;break e}else{n(w,_);break}else t(w,_);_=_.sibling}_=KS(j,w.mode,E),_.return=w,w=_}return o(w);case Wd:return T=j._init,b(w,_,T(j._payload),E)}if(Jy(j))return x(w,_,j,E);if(uy(j))return y(w,_,j,E);Fw(w,j)}return typeof j=="string"&&j!==""||typeof j=="number"?(j=""+j,_!==null&&_.tag===6?(n(w,_.sibling),_=i(_,j),_.return=w,w=_):(n(w,_),_=GS(j,w.mode,E),_.return=w,w=_),o(w)):n(w,_)}return b}var px=dK(!0),fK=dK(!1),Kj=Gf(null),Yj=null,xg=null,TD=null;function PD(){TD=xg=Yj=null}function OD(e){var t=Kj.current;os(Kj),e._currentValue=t}function Y3(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function $g(e,t){Yj=e,TD=xg=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(uo=!0),e.firstContext=null)}function Ol(e){var t=e._currentValue;if(TD!==e)if(e={context:e,memoizedValue:t,next:null},xg===null){if(Yj===null)throw Error(et(308));xg=e,Yj.dependencies={lanes:0,firstContext:e}}else xg=xg.next=e;return t}var Qh=null;function DD(e){Qh===null?Qh=[e]:Qh.push(e)}function hK(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,DD(t)):(n.next=i.next,i.next=n),t.interleaved=n,Zu(e,r)}function Zu(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Gd=!1;function ID(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function mK(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Uu(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function wf(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Qn&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Zu(e,n)}return i=r.interleaved,i===null?(t.next=t,DD(r)):(t.next=i.next,i.next=t),r.interleaved=t,Zu(e,n)}function J_(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,vD(e,n)}}function UL(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Xj(e,t,n,r){var i=e.updateQueue;Gd=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?a=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(a!==null){var f=i.baseState;o=0,d=u=c=null,l=a;do{var h=l.lane,p=l.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,y=l;switch(h=t,p=n,y.tag){case 1:if(x=y.payload,typeof x=="function"){f=x.call(p,f,h);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=y.payload,h=typeof x=="function"?x.call(p,f,h):x,h==null)break e;f=ks({},f,h);break e;case 2:Gd=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,h=i.effects,h===null?i.effects=[l]:h.push(l))}else p={eventTime:p,lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,o|=h;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;h=l,l=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Mm|=o,e.lanes=o,e.memoizedState=f}}function qL(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(et(191,i));i.call(r)}}}var jb={},Zc=Gf(jb),Zv=Gf(jb),e1=Gf(jb);function Jh(e){if(e===jb)throw Error(et(174));return e}function RD(e,t){switch(Qr(e1,t),Qr(Zv,e),Qr(Zc,jb),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:A3(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=A3(t,e)}os(Zc),Qr(Zc,t)}function gx(){os(Zc),os(Zv),os(e1)}function pK(e){Jh(e1.current);var t=Jh(Zc.current),n=A3(t,e.type);t!==n&&(Qr(Zv,e),Qr(Zc,n))}function MD(e){Zv.current===e&&(os(Zc),os(Zv))}var ws=Gf(0);function Qj(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var zS=[];function LD(){for(var e=0;e<zS.length;e++)zS[e]._workInProgressVersionPrimary=null;zS.length=0}var Z_=md.ReactCurrentDispatcher,US=md.ReactCurrentBatchConfig,Rm=0,Ns=null,ki=null,Fi=null,Jj=!1,pv=!1,t1=0,upe=0;function ma(){throw Error(et(321))}function FD(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!gc(e[n],t[n]))return!1;return!0}function $D(e,t,n,r,i,a){if(Rm=a,Ns=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Z_.current=e===null||e.memoizedState===null?mpe:ppe,e=n(r,i),pv){a=0;do{if(pv=!1,t1=0,25<=a)throw Error(et(301));a+=1,Fi=ki=null,t.updateQueue=null,Z_.current=gpe,e=n(r,i)}while(pv)}if(Z_.current=Zj,t=ki!==null&&ki.next!==null,Rm=0,Fi=ki=Ns=null,Jj=!1,t)throw Error(et(300));return e}function BD(){var e=t1!==0;return t1=0,e}function Ic(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Fi===null?Ns.memoizedState=Fi=e:Fi=Fi.next=e,Fi}function Dl(){if(ki===null){var e=Ns.alternate;e=e!==null?e.memoizedState:null}else e=ki.next;var t=Fi===null?Ns.memoizedState:Fi.next;if(t!==null)Fi=t,ki=e;else{if(e===null)throw Error(et(310));ki=e,e={memoizedState:ki.memoizedState,baseState:ki.baseState,baseQueue:ki.baseQueue,queue:ki.queue,next:null},Fi===null?Ns.memoizedState=Fi=e:Fi=Fi.next=e}return Fi}function n1(e,t){return typeof t=="function"?t(e):t}function qS(e){var t=Dl(),n=t.queue;if(n===null)throw Error(et(311));n.lastRenderedReducer=e;var r=ki,i=r.baseQueue,a=n.pending;if(a!==null){if(i!==null){var o=i.next;i.next=a.next,a.next=o}r.baseQueue=i=a,n.pending=null}if(i!==null){a=i.next,r=r.baseState;var l=o=null,c=null,u=a;do{var d=u.lane;if((Rm&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,o=r):c=c.next=f,Ns.lanes|=d,Mm|=d}u=u.next}while(u!==null&&u!==a);c===null?o=r:c.next=l,gc(r,t.memoizedState)||(uo=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do a=i.lane,Ns.lanes|=a,Mm|=a,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function VS(e){var t=Dl(),n=t.queue;if(n===null)throw Error(et(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do a=e(a,o.action),o=o.next;while(o!==i);gc(a,t.memoizedState)||(uo=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function gK(){}function xK(e,t){var n=Ns,r=Dl(),i=t(),a=!gc(r.memoizedState,i);if(a&&(r.memoizedState=i,uo=!0),r=r.queue,zD(bK.bind(null,n,r,e),[e]),r.getSnapshot!==t||a||Fi!==null&&Fi.memoizedState.tag&1){if(n.flags|=2048,r1(9,vK.bind(null,n,r,i,t),void 0,null),qi===null)throw Error(et(349));Rm&30||yK(n,t,i)}return i}function yK(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ns.updateQueue,t===null?(t={lastEffect:null,stores:null},Ns.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function vK(e,t,n,r){t.value=n,t.getSnapshot=r,wK(t)&&_K(e)}function bK(e,t,n){return n(function(){wK(t)&&_K(e)})}function wK(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!gc(e,n)}catch{return!0}}function _K(e){var t=Zu(e,1);t!==null&&hc(t,e,1,-1)}function VL(e){var t=Ic();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n1,lastRenderedState:e},t.queue=e,e=e.dispatch=hpe.bind(null,Ns,e),[t.memoizedState,e]}function r1(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ns.updateQueue,t===null?(t={lastEffect:null,stores:null},Ns.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function jK(){return Dl().memoizedState}function ej(e,t,n,r){var i=Ic();Ns.flags|=e,i.memoizedState=r1(1|t,n,void 0,r===void 0?null:r)}function Nk(e,t,n,r){var i=Dl();r=r===void 0?null:r;var a=void 0;if(ki!==null){var o=ki.memoizedState;if(a=o.destroy,r!==null&&FD(r,o.deps)){i.memoizedState=r1(t,n,a,r);return}}Ns.flags|=e,i.memoizedState=r1(1|t,n,a,r)}function HL(e,t){return ej(8390656,8,e,t)}function zD(e,t){return Nk(2048,8,e,t)}function NK(e,t){return Nk(4,2,e,t)}function kK(e,t){return Nk(4,4,e,t)}function CK(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function EK(e,t,n){return n=n!=null?n.concat([e]):null,Nk(4,4,CK.bind(null,t,e),n)}function UD(){}function SK(e,t){var n=Dl();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&FD(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function AK(e,t){var n=Dl();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&FD(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function TK(e,t,n){return Rm&21?(gc(n,t)||(n=RG(),Ns.lanes|=n,Mm|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,uo=!0),e.memoizedState=n)}function dpe(e,t){var n=Ar;Ar=n!==0&&4>n?n:4,e(!0);var r=US.transition;US.transition={};try{e(!1),t()}finally{Ar=n,US.transition=r}}function PK(){return Dl().memoizedState}function fpe(e,t,n){var r=jf(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},OK(e))DK(t,n);else if(n=hK(e,t,n,r),n!==null){var i=Ua();hc(n,e,r,i),IK(n,t,r)}}function hpe(e,t,n){var r=jf(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(OK(e))DK(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,l=a(o,n);if(i.hasEagerState=!0,i.eagerState=l,gc(l,o)){var c=t.interleaved;c===null?(i.next=i,DD(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=hK(e,t,i,r),n!==null&&(i=Ua(),hc(n,e,r,i),IK(n,t,r))}}function OK(e){var t=e.alternate;return e===Ns||t!==null&&t===Ns}function DK(e,t){pv=Jj=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function IK(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,vD(e,n)}}var Zj={readContext:Ol,useCallback:ma,useContext:ma,useEffect:ma,useImperativeHandle:ma,useInsertionEffect:ma,useLayoutEffect:ma,useMemo:ma,useReducer:ma,useRef:ma,useState:ma,useDebugValue:ma,useDeferredValue:ma,useTransition:ma,useMutableSource:ma,useSyncExternalStore:ma,useId:ma,unstable_isNewReconciler:!1},mpe={readContext:Ol,useCallback:function(e,t){return Ic().memoizedState=[e,t===void 0?null:t],e},useContext:Ol,useEffect:HL,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ej(4194308,4,CK.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ej(4194308,4,e,t)},useInsertionEffect:function(e,t){return ej(4,2,e,t)},useMemo:function(e,t){var n=Ic();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ic();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=fpe.bind(null,Ns,e),[r.memoizedState,e]},useRef:function(e){var t=Ic();return e={current:e},t.memoizedState=e},useState:VL,useDebugValue:UD,useDeferredValue:function(e){return Ic().memoizedState=e},useTransition:function(){var e=VL(!1),t=e[0];return e=dpe.bind(null,e[1]),Ic().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ns,i=Ic();if(hs){if(n===void 0)throw Error(et(407));n=n()}else{if(n=t(),qi===null)throw Error(et(349));Rm&30||yK(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,HL(bK.bind(null,r,a,e),[e]),r.flags|=2048,r1(9,vK.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=Ic(),t=qi.identifierPrefix;if(hs){var n=Mu,r=Ru;n=(r&~(1<<32-fc(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=t1++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=upe++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ppe={readContext:Ol,useCallback:SK,useContext:Ol,useEffect:zD,useImperativeHandle:EK,useInsertionEffect:NK,useLayoutEffect:kK,useMemo:AK,useReducer:qS,useRef:jK,useState:function(){return qS(n1)},useDebugValue:UD,useDeferredValue:function(e){var t=Dl();return TK(t,ki.memoizedState,e)},useTransition:function(){var e=qS(n1)[0],t=Dl().memoizedState;return[e,t]},useMutableSource:gK,useSyncExternalStore:xK,useId:PK,unstable_isNewReconciler:!1},gpe={readContext:Ol,useCallback:SK,useContext:Ol,useEffect:zD,useImperativeHandle:EK,useInsertionEffect:NK,useLayoutEffect:kK,useMemo:AK,useReducer:VS,useRef:jK,useState:function(){return VS(n1)},useDebugValue:UD,useDeferredValue:function(e){var t=Dl();return ki===null?t.memoizedState=e:TK(t,ki.memoizedState,e)},useTransition:function(){var e=VS(n1)[0],t=Dl().memoizedState;return[e,t]},useMutableSource:gK,useSyncExternalStore:xK,useId:PK,unstable_isNewReconciler:!1};function Jl(e,t){if(e&&e.defaultProps){t=ks({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function X3(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:ks({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var kk={isMounted:function(e){return(e=e._reactInternals)?cp(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ua(),i=jf(e),a=Uu(r,i);a.payload=t,n!=null&&(a.callback=n),t=wf(e,a,i),t!==null&&(hc(t,e,i,r),J_(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ua(),i=jf(e),a=Uu(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=wf(e,a,i),t!==null&&(hc(t,e,i,r),J_(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ua(),r=jf(e),i=Uu(n,r);i.tag=2,t!=null&&(i.callback=t),t=wf(e,i,r),t!==null&&(hc(t,e,r,n),J_(t,e,r))}};function WL(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Yv(n,r)||!Yv(i,a):!0}function RK(e,t,n){var r=!1,i=Of,a=t.contextType;return typeof a=="object"&&a!==null?a=Ol(a):(i=mo(t)?Dm:ja.current,r=t.contextTypes,a=(r=r!=null)?hx(e,i):Of),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=kk,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function GL(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&kk.enqueueReplaceState(t,t.state,null)}function Q3(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},ID(e);var a=t.contextType;typeof a=="object"&&a!==null?i.context=Ol(a):(a=mo(t)?Dm:ja.current,i.context=hx(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a=="function"&&(X3(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&kk.enqueueReplaceState(i,i.state,null),Xj(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function xx(e,t){try{var n="",r=t;do n+=Vhe(r),r=r.return;while(r);var i=n}catch(a){i=`
39Error generating stack: `+a.message+`
40`+a.stack}return{value:e,source:t,stack:i,digest:null}}function HS(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function J3(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var xpe=typeof WeakMap=="function"?WeakMap:Map;function MK(e,t,n){n=Uu(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){t2||(t2=!0,l5=r),J3(e,t)},n}function LK(e,t,n){n=Uu(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){J3(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(n.callback=function(){J3(e,t),typeof r!="function"&&(_f===null?_f=new Set([this]):_f.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function KL(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new xpe;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Ppe.bind(null,e,t,n),t.then(e,e))}function YL(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function XL(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Uu(-1,1),t.tag=2,wf(n,t,1))),n.lanes|=1),e)}var ype=md.ReactCurrentOwner,uo=!1;function Pa(e,t,n,r){t.child=e===null?fK(t,null,n,r):px(t,e.child,n,r)}function QL(e,t,n,r,i){n=n.render;var a=t.ref;return $g(t,i),r=$D(e,t,n,r,a,i),n=BD(),e!==null&&!uo?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ed(e,t,i)):(hs&&n&&ED(t),t.flags|=1,Pa(e,t,r,i),t.child)}function JL(e,t,n,r,i){if(e===null){var a=n.type;return typeof a=="function"&&!XD(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,FK(e,t,a,r,i)):(e=sj(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!(e.lanes&i)){var o=a.memoizedProps;if(n=n.compare,n=n!==null?n:Yv,n(o,r)&&e.ref===t.ref)return ed(e,t,i)}return t.flags|=1,e=Nf(a,r),e.ref=t.ref,e.return=t,t.child=e}function FK(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Yv(a,r)&&e.ref===t.ref)if(uo=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(uo=!0);else return t.lanes=e.lanes,ed(e,t,i)}return Z3(e,t,n,r,i)}function $K(e,t,n){var r=t.pendingProps,i=r.children,a=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Qr(vg,Po),Po|=n;else{if(!(n&1073741824))return e=a!==null?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Qr(vg,Po),Po|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a!==null?a.baseLanes:n,Qr(vg,Po),Po|=r}else a!==null?(r=a.baseLanes|n,t.memoizedState=null):r=n,Qr(vg,Po),Po|=r;return Pa(e,t,i,n),t.child}function BK(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}
vendor: 8,186 bytes, line 40
40function Z3(e,t,n,r,i){var a=mo(n)?Dm:ja.current;return a=hx(t,a),$g(t,i),n=$D(e,t,n,r,a,i),r=BD(),e!==null&&!uo?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ed(e,t,i)):(hs&&r&&ED(t),t.flags|=1,Pa(e,t,n,i),t.child)}function ZL(e,t,n,r,i){if(mo(n)){var a=!0;Hj(t)}else a=!1;if($g(t,i),t.stateNode===null)tj(e,t),RK(t,n,r),Q3(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Ol(u):(u=mo(n)?Dm:ja.current,u=hx(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||c!==u)&&GL(t,o,r,u),Gd=!1;var h=t.memoizedState;o.state=h,Xj(t,r,o,i),c=t.memoizedState,l!==r||h!==c||ho.current||Gd?(typeof d=="function"&&(X3(t,n,d,r),c=t.memoizedState),(l=Gd||WL(t,n,l,r,h,c,u))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=u,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,mK(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Jl(t.type,l),o.props=u,f=t.pendingProps,h=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=Ol(c):(c=mo(n)?Dm:ja.current,c=hx(t,c));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==f||h!==c)&&GL(t,o,r,c),Gd=!1,h=t.memoizedState,o.state=h,Xj(t,r,o,i);var x=t.memoizedState;l!==f||h!==x||ho.current||Gd?(typeof p=="function"&&(X3(t,n,p,r),x=t.memoizedState),(u=Gd||WL(t,n,u,r,h,x,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,x,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,x,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=x),o.props=r,o.state=x,o.context=c,r=u):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return e5(e,t,n,r,a,i)}function e5(e,t,n,r,i,a){BK(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return i&&FL(t,n,!1),ed(e,t,a);r=t.stateNode,ype.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=px(t,e.child,null,a),t.child=px(t,null,l,a)):Pa(e,t,l,a),t.memoizedState=r.state,i&&FL(t,n,!0),t.child}function zK(e){var t=e.stateNode;t.pendingContext?LL(e,t.pendingContext,t.pendingContext!==t.context):t.context&&LL(e,t.context,!1),RD(e,t.containerInfo)}function eF(e,t,n,r,i){return mx(),AD(i),t.flags|=256,Pa(e,t,n,r),t.child}var t5={dehydrated:null,treeContext:null,retryLane:0};function n5(e){return{baseLanes:e,cachePool:null,transitions:null}}function UK(e,t,n){var r=t.pendingProps,i=ws.current,a=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(i&2)!==0),l?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Qr(ws,i&1),e===null)return K3(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:"hidden",children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=Sk(o,r,0,null),e=Nm(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=n5(n),t.memoizedState=t5,e):qD(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return vpe(e,t,o,r,l,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,l=i.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Nf(i,c),r.subtreeFlags=i.subtreeFlags&14680064),l!==null?a=Nf(l,a):(a=Nm(a,o,n,null),a.flags|=2),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?n5(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=t5,r}return a=e.child,e=a.sibling,r=Nf(a,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function qD(e,t){return t=Sk({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function $w(e,t,n,r){return r!==null&&AD(r),px(t,e.child,null,n),e=qD(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function vpe(e,t,n,r,i,a,o){if(n)return t.flags&256?(t.flags&=-257,r=HS(Error(et(422))),$w(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(a=r.fallback,i=t.mode,r=Sk({mode:"visible",children:r.children},i,0,null),a=Nm(a,i,o,null),a.flags|=2,r.return=t,a.return=t,r.sibling=a,t.child=r,t.mode&1&&px(t,e.child,null,o),t.child.memoizedState=n5(o),t.memoizedState=t5,a);if(!(t.mode&1))return $w(e,t,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var l=r.dgst;return r=l,a=Error(et(419)),r=HS(a,r,void 0),$w(e,t,o,r)}if(l=(o&e.childLanes)!==0,uo||l){if(r=qi,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==a.retryLane&&(a.retryLane=i,Zu(e,i),hc(r,e,i,-1))}return YD(),r=HS(Error(et(421))),$w(e,t,o,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=Ope.bind(null,e),i._reactRetry=t,null):(e=a.treeContext,zo=bf(i.nextSibling),Uo=t,hs=!0,ac=null,e!==null&&(pl[gl++]=Ru,pl[gl++]=Mu,pl[gl++]=Im,Ru=e.id,Mu=e.overflow,Im=t),t=qD(t,r.children),t.flags|=4096,t)}function tF(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Y3(e.return,t,n)}function WS(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function qK(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Pa(e,t,r.children,n),r=ws.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&tF(e,n,t);else if(e.tag===19)tF(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Qr(ws,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Qj(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),WS(t,!1,i,n,a);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Qj(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}WS(t,!0,n,null,a);break;case"together":WS(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function tj(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ed(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Mm|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(et(153));
vendor: 5,454 bytes, line 40
40if(t.child!==null){for(e=t.child,n=Nf(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Nf(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function bpe(e,t,n){switch(t.tag){case 3:zK(t),mx();break;case 5:pK(t);break;case 1:mo(t.type)&&Hj(t);break;case 4:RD(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Qr(Kj,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Qr(ws,ws.current&1),t.flags|=128,null):n&t.child.childLanes?UK(e,t,n):(Qr(ws,ws.current&1),e=ed(e,t,n),e!==null?e.sibling:null);Qr(ws,ws.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return qK(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Qr(ws,ws.current),r)break;return null;case 22:case 23:return t.lanes=0,$K(e,t,n)}return ed(e,t,n)}var VK,r5,HK,WK;VK=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};r5=function(){};HK=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,Jh(Zc.current);var a=null;switch(n){case"input":i=k3(e,i),r=k3(e,r),a=[];break;case"select":i=ks({},i,{value:void 0}),r=ks({},r,{value:void 0}),a=[];break;case"textarea":i=S3(e,i),r=S3(e,r),a=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=qj)}T3(n,r);var o;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var l=i[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Uv.hasOwnProperty(u)?a||(a=[]):(a=a||[]).push(u,null));for(u in r){var c=r[u];if(l=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(a||(a=[]),a.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(a=a||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(a=a||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Uv.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&rs("scroll",e),a||l===c||(a=[])):(a=a||[]).push(u,c))}n&&(a=a||[]).push("style",n);var u=a;(t.updateQueue=u)&&(t.flags|=4)}};WK=function(e,t,n,r){n!==r&&(t.flags|=4)};function gy(e,t){if(!hs)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function pa(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function wpe(e,t,n){var r=t.pendingProps;switch(SD(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pa(t),null;case 1:return mo(t.type)&&Vj(),pa(t),null;case 3:return r=t.stateNode,gx(),os(ho),os(ja),LD(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Lw(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ac!==null&&(d5(ac),ac=null))),r5(e,t),pa(t),null;case 5:MD(t);var i=Jh(e1.current);if(n=t.type,e!==null&&t.stateNode!=null)HK(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(et(166));return pa(t),null}if(e=Jh(Zc.current),Lw(t)){r=t.stateNode,n=t.type;var a=t.memoizedProps;switch(r[zc]=t,r[Jv]=a,e=(t.mode&1)!==0,n){case"dialog":rs("cancel",r),rs("close",r);break;case"iframe":case"object":case"embed":rs("load",r);break;case"video":case"audio":for(i=0;i<ev.length;i++)rs(ev[i],r);break;case"source":rs("error",r);break;case"img":case"image":case"link":rs("error",r),rs("load",r);break;case"details":rs("toggle",r);break;case"input":uL(r,a),rs("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!a.multiple},rs("invalid",r);break;case"textarea":fL(r,a),rs("invalid",r)}T3(n,a),i=null;for(var o in a)if(a.hasOwnProperty(o)){var l=a[o];o==="children"?typeof l=="string"?r.textContent!==l&&(a.suppressHydrationWarning!==!0&&Mw(r.textContent,l,e),i=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(a.suppressHydrationWarning!==!0&&Mw(r.textContent,l,e),i=["children",""+l]):Uv.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&rs("scroll",r)}switch(n){case"input":Sw(r),dL(r,a,!0);break;case"textarea":Sw(r),hL(r);break;case"select":case"option":break;default:typeof a.onClick=="function"&&(r.onclick=qj)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=bG(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>
40",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[zc]=t,e[Jv]=r,VK(e,t,!1,!1),t.stateNode=e;e:{switch(o=P3(n,r),n){case"dialog":rs("cancel",e),rs("close",e),i=r;break;case"iframe":case"object":case"embed":rs("load",e),i=r;break;case"video":case"audio":for(i=0;i<ev.length;i++)rs(ev[i],e);i=r;break;case"source":rs("error",e),i=r;break;case"img":case"image":case"link":rs("error",e),rs("load",e),i=r;break;case"details":rs("toggle",e),i=r;break;case"input":uL(e,r),i=k3(e,r),rs("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=ks({},r,{value:void 0}),rs("invalid",e);break;case"textarea":fL(e,r),i=S3(e,r),rs("invalid",e);break;default:i=r}T3(n,i),l=i;for(a in l)if(l.hasOwnProperty(a)){var c=l[a];a==="style"?jG(e,c):a==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&wG(e,c)):a==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&qv(e,c):typeof c=="number"&&qv(e,""+c):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(Uv.hasOwnProperty(a)?c!=null&&a==="onScroll"&&rs("scroll",e):c!=null&&hD(e,a,c,o))}switch(n){case"input":Sw(e),dL(e,r,!1);break;case"textarea":Sw(e),hL(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Pf(r.value));break;case"select":e.multiple=!!r.multiple,a=r.value,a!=null?Rg(e,!!r.multiple,a,!1):r.defaultValue!=null&&Rg(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=qj)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return pa(t),null;case 6:if(e&&t.stateNode!=null)WK(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(et(166));if(n=Jh(e1.current),Jh(Zc.current),Lw(t)){if(r=t.stateNode,n=t.memoizedProps,r[zc]=t,(a=r.nodeValue!==n)&&(e=Uo,e!==null))switch(e.tag){case 3:Mw(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Mw(r.nodeValue,n,(e.mode&1)!==0)}a&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[zc]=t,t.stateNode=r}return pa(t),null;case 13:if(os(ws),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(hs&&zo!==null&&t.mode&1&&!(t.flags&128))uK(),mx(),t.flags|=98560,a=!1;else if(a=Lw(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(et(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(et(317));a[zc]=t}else mx(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;pa(t),a=!1}else ac!==null&&(d5(ac),ac=null),a=!0;if(!a)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||ws.current&1?Si===0&&(Si=3):YD())),t.updateQueue!==null&&(t.flags|=4),pa(t),null);case 4:return gx(),r5(e,t),e===null&&Xv(t.stateNode.containerInfo),pa(t),null;case 10:return OD(t.type._context),pa(t),null;case 17:return mo(t.type)&&Vj(),pa(t),null;case 19:if(os(ws),a=t.memoizedState,a===null)return pa(t),null;if(r=(t.flags&128)!==0,o=a.rendering,o===null)if(r)gy(a,!1);else{if(Si!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Qj(e),o!==null){for(t.flags|=128,gy(a,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)a=n,e=r,a.flags&=14680066,o=a.alternate,o===null?(a.childLanes=0,a.lanes=e,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=o.childLanes,a.lanes=o.lanes,a.child=o.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=o.memoizedProps,a.memoizedState=o.memoizedState,a.updateQueue=o.updateQueue,a.type=o.type,e=o.dependencies,a.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Qr(ws,ws.current&1|2),t.child}e=e.sibling}a.tail!==null&&Ws()>yx&&(t.flags|=128,r=!0,gy(a,!1),t.lanes=4194304)}else{if(!r)if(e=Qj(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),gy(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!hs)return pa(t),null}else 2*Ws()-a.renderingStartTime>yx&&n!==1073741824&&(t.flags|=128,r=!0,gy(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(n=a.last,n!==null?n.sibling=o:t.child=o,a.last=o)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Ws(),t.sibling=null,n=ws.current,Qr(ws,r?n&1|2:n&1),t):(pa(t),null);case 22:case 23:return KD(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Po&1073741824&&(pa(t),t.subtreeFlags&6&&(t.flags|=8192)):pa(t),null;case 24:return null;case 25:return null}throw Error(et(156,t.tag))}function _pe(e,t){switch(SD(t),t.tag){case 1:return mo(t.type)&&Vj(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;
vendor: 25,474 bytes, line 40
40case 3:return gx(),os(ho),os(ja),LD(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return MD(t),null;case 13:if(os(ws),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(et(340));mx()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return os(ws),null;case 4:return gx(),null;case 10:return OD(t.type._context),null;case 22:case 23:return KD(),null;case 24:return null;default:return null}}var Bw=!1,va=!1,jpe=typeof WeakSet=="function"?WeakSet:Set,jt=null;function yg(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Is(e,t,r)}else n.current=null}function s5(e,t,n){try{n()}catch(r){Is(e,t,r)}}var nF=!1;function Npe(e,t){if(z3=Bj,e=QG(),CD(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==a||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===i&&(l=o),h===a&&++d===r&&(c=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(U3={focusedElem:e,selectionRange:n},Bj=!1,jt=t;jt!==null;)if(t=jt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,jt=e;else for(;jt!==null;){t=jt;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var y=x.memoizedProps,b=x.memoizedState,w=t.stateNode,_=w.getSnapshotBeforeUpdate(t.elementType===t.type?y:Jl(t.type,y),b);w.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var j=t.stateNode.containerInfo;j.nodeType===1?j.textContent="":j.nodeType===9&&j.documentElement&&j.removeChild(j.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(et(163))}}catch(E){Is(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,jt=e;break}jt=t.return}return x=nF,nF=!1,x}function gv(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&s5(t,n,a)}i=i.next}while(i!==r)}}function Ck(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function i5(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function GK(e){var t=e.alternate;t!==null&&(e.alternate=null,GK(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[zc],delete t[Jv],delete t[H3],delete t[ape],delete t[ope])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function KK(e){return e.tag===5||e.tag===3||e.tag===4}function rF(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||KK(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function a5(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=qj));else if(r!==4&&(e=e.child,e!==null))for(a5(e,t,n),e=e.sibling;e!==null;)a5(e,t,n),e=e.sibling}function o5(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(o5(e,t,n),e=e.sibling;e!==null;)o5(e,t,n),e=e.sibling}var ta=null,nc=!1;function Rd(e,t,n){for(n=n.child;n!==null;)YK(e,t,n),n=n.sibling}function YK(e,t,n){if(Jc&&typeof Jc.onCommitFiberUnmount=="function")try{Jc.onCommitFiberUnmount(yk,n)}catch{}switch(n.tag){case 5:va||yg(n,t);case 6:var r=ta,i=nc;ta=null,Rd(e,t,n),ta=r,nc=i,ta!==null&&(nc?(e=ta,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ta.removeChild(n.stateNode));break;case 18:ta!==null&&(nc?(e=ta,n=n.stateNode,e.nodeType===8?$S(e.parentNode,n):e.nodeType===1&&$S(e,n),Gv(e)):$S(ta,n.stateNode));break;case 4:r=ta,i=nc,ta=n.stateNode.containerInfo,nc=!0,Rd(e,t,n),ta=r,nc=i;break;case 0:case 11:case 14:case 15:if(!va&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&s5(n,t,o),i=i.next}while(i!==r)}Rd(e,t,n);break;case 1:if(!va&&(yg(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Is(n,t,l)}Rd(e,t,n);break;case 21:Rd(e,t,n);break;case 22:n.mode&1?(va=(r=va)||n.memoizedState!==null,Rd(e,t,n),va=r):Rd(e,t,n);break;default:Rd(e,t,n)}}function sF(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new jpe),t.forEach(function(r){var i=Dpe.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Vl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var a=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:ta=l.stateNode,nc=!1;break e;case 3:ta=l.stateNode.containerInfo,nc=!0;break e;case 4:ta=l.stateNode.containerInfo,nc=!0;break e}l=l.return}if(ta===null)throw Error(et(160));YK(a,o,i),ta=null,nc=!1;var c=i.alternate;c!==null&&(c.return=null),i.return=null}catch(u){Is(i,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)XK(t,e),t=t.sibling}function XK(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Vl(t,e),Tc(e),r&4){try{gv(3,e,e.return),Ck(3,e)}catch(y){Is(e,e.return,y)}try{gv(5,e,e.return)}catch(y){Is(e,e.return,y)}}break;case 1:Vl(t,e),Tc(e),r&512&&n!==null&&yg(n,n.return);break;case 5:if(Vl(t,e),Tc(e),r&512&&n!==null&&yg(n,n.return),e.flags&32){var i=e.stateNode;try{qv(i,"")}catch(y){Is(e,e.return,y)}}if(r&4&&(i=e.stateNode,i!=null)){var a=e.memoizedProps,o=n!==null?n.memoizedProps:a,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&a.type==="radio"&&a.name!=null&&yG(i,a),P3(l,o);var u=P3(l,a);for(o=0;o<c.length;o+=2){var d=c[o],f=c[o+1];d==="style"?jG(i,f):d==="dangerouslySetInnerHTML"?wG(i,f):d==="children"?qv(i,f):hD(i,d,f,u)}switch(l){case"input":C3(i,a);break;case"textarea":vG(i,a);break;case"select":var h=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!a.multiple;var p=a.value;p!=null?Rg(i,!!a.multiple,p,!1):h!==!!a.multiple&&(a.defaultValue!=null?Rg(i,!!a.multiple,a.defaultValue,!0):Rg(i,!!a.multiple,a.multiple?[]:"",!1))}i[Jv]=a}catch(y){Is(e,e.return,y)}}break;case 6:if(Vl(t,e),Tc(e),r&4){if(e.stateNode===null)throw Error(et(162));i=e.stateNode,a=e.memoizedProps;try{i.nodeValue=a}catch(y){Is(e,e.return,y)}}break;case 3:if(Vl(t,e),Tc(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Gv(t.containerInfo)}catch(y){Is(e,e.return,y)}break;case 4:Vl(t,e),Tc(e);break;case 13:Vl(t,e),Tc(e),i=e.child,i.flags&8192&&(a=i.memoizedState!==null,i.stateNode.isHidden=a,!a||i.alternate!==null&&i.alternate.memoizedState!==null||(WD=Ws())),r&4&&sF(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(va=(u=va)||d,Vl(t,e),va=u):Vl(t,e),Tc(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(jt=e,d=e.child;d!==null;){for(f=jt=d;jt!==null;){switch(h=jt,p=h.child,h.tag){case 0:case 11:case 14:case 15:gv(4,h,h.return);break;case 1:yg(h,h.return);var x=h.stateNode;if(typeof x.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,x.props=t.memoizedProps,x.state=t.memoizedState,x.componentWillUnmount()}catch(y){Is(r,n,y)}}break;case 5:yg(h,h.return);break;case 22:if(h.memoizedState!==null){aF(f);continue}}p!==null?(p.return=h,jt=p):aF(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{i=f.stateNode,u?(a=i.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"):(l=f.stateNode,c=f.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=_G("display",o))}catch(y){Is(e,e.return,y)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(y){Is(e,e.return,y)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Vl(t,e),Tc(e),r&4&&sF(e);break;case 21:break;default:Vl(t,e),Tc(e)}}function Tc(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(KK(n)){var r=n;break e}n=n.return}throw Error(et(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(qv(i,""),r.flags&=-33);var a=rF(e);o5(e,a,i);break;case 3:case 4:var o=r.stateNode.containerInfo,l=rF(e);a5(e,l,o);break;default:throw Error(et(161))}}catch(c){Is(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function kpe(e,t,n){jt=e,QK(e)}function QK(e,t,n){for(var r=(e.mode&1)!==0;jt!==null;){var i=jt,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||Bw;if(!o){var l=i.alternate,c=l!==null&&l.memoizedState!==null||va;l=Bw;var u=va;if(Bw=o,(va=c)&&!u)for(jt=i;jt!==null;)o=jt,c=o.child,o.tag===22&&o.memoizedState!==null?oF(i):c!==null?(c.return=o,jt=c):oF(i);for(;a!==null;)jt=a,QK(a),a=a.sibling;jt=i,Bw=l,va=u}iF(e)}else i.subtreeFlags&8772&&a!==null?(a.return=i,jt=a):iF(e)}}function iF(e){for(;jt!==null;){var t=jt;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:va||Ck(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!va)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:Jl(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var a=t.updateQueue;a!==null&&qL(t,a,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}qL(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&Gv(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(et(163))}va||t.flags&512&&i5(t)}catch(h){Is(t,t.return,h)}}if(t===e){jt=null;break}if(n=t.sibling,n!==null){n.return=t.return,jt=n;break}jt=t.return}}function aF(e){for(;jt!==null;){var t=jt;if(t===e){jt=null;break}var n=t.sibling;if(n!==null){n.return=t.return,jt=n;break}jt=t.return}}function oF(e){for(;jt!==null;){var t=jt;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Ck(4,t)}catch(c){Is(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(c){Is(t,i,c)}}var a=t.return;try{i5(t)}catch(c){Is(t,a,c)}break;case 5:var o=t.return;try{i5(t)}catch(c){Is(t,o,c)}}}catch(c){Is(t,t.return,c)}if(t===e){jt=null;break}var l=t.sibling;if(l!==null){l.return=t.return,jt=l;break}jt=t.return}}var Cpe=Math.ceil,e2=md.ReactCurrentDispatcher,VD=md.ReactCurrentOwner,Cl=md.ReactCurrentBatchConfig,Qn=0,qi=null,oi=null,ia=0,Po=0,vg=Gf(0),Si=0,s1=null,Mm=0,Ek=0,HD=0,xv=null,oo=null,WD=0,yx=1/0,ku=null,t2=!1,l5=null,_f=null,zw=!1,hf=null,n2=0,yv=0,c5=null,nj=-1,rj=0;function Ua(){return Qn&6?Ws():nj!==-1?nj:nj=Ws()}function jf(e){return e.mode&1?Qn&2&&ia!==0?ia&-ia:cpe.transition!==null?(rj===0&&(rj=RG()),rj):(e=Ar,e!==0||(e=window.event,e=e===void 0?16:UG(e.type)),e):1}function hc(e,t,n,r){if(50<yv)throw yv=0,c5=null,Error(et(185));bb(e,n,r),(!(Qn&2)||e!==qi)&&(e===qi&&(!(Qn&2)&&(Ek|=n),Si===4&&Zd(e,ia)),po(e,r),n===1&&Qn===0&&!(t.mode&1)&&(yx=Ws()+500,jk&&Kf()))}function po(e,t){var n=e.callbackNode;cme(e,t);var r=$j(e,e===qi?ia:0);if(r===0)n!==null&&gL(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&gL(n),t===1)e.tag===0?lpe(lF.bind(null,e)):oK(lF.bind(null,e)),spe(function(){!(Qn&6)&&Kf()}),n=null;else{switch(MG(r)){case 1:n=yD;break;case 4:n=DG;break;case 16:n=Fj;break;case 536870912:n=IG;break;default:n=Fj}n=iY(n,JK.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function JK(e,t){if(nj=-1,rj=0,Qn&6)throw Error(et(327));var n=e.callbackNode;if(Bg()&&e.callbackNode!==n)return null;var r=$j(e,e===qi?ia:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=r2(e,r);else{t=r;var i=Qn;Qn|=2;var a=eY();(qi!==e||ia!==t)&&(ku=null,yx=Ws()+500,jm(e,t));do try{Ape();break}catch(l){ZK(e,l)}while(!0);PD(),e2.current=a,Qn=i,oi!==null?t=0:(qi=null,ia=0,t=Si)}if(t!==0){if(t===2&&(i=M3(e),i!==0&&(r=i,t=u5(e,i))),t===1)throw n=s1,jm(e,0),Zd(e,r),po(e,Ws()),n;if(t===6)Zd(e,r);else{if(i=e.current.alternate,!(r&30)&&!Epe(i)&&(t=r2(e,r),t===2&&(a=M3(e),a!==0&&(r=a,t=u5(e,a))),t===1))throw n=s1,jm(e,0),Zd(e,r),po(e,Ws()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(et(345));case 2:Mh(e,oo,ku);break;case 3:if(Zd(e,r),(r&130023424)===r&&(t=WD+500-Ws(),10<t)){if($j(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Ua(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=V3(Mh.bind(null,e,oo,ku),t);break}Mh(e,oo,ku);break;case 4:if(Zd(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var o=31-fc(r);a=1<<o,o=t[o],o>i&&(i=o),r&=~a}if(r=i,r=Ws()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Cpe(r/1960))-r,10<r){e.timeoutHandle=V3(Mh.bind(null,e,oo,ku),r);break}Mh(e,oo,ku);break;case 5:Mh(e,oo,ku);break;default:throw Error(et(329))}}}return po(e,Ws()),e.callbackNode===n?JK.bind(null,e):null}function u5(e,t){var n=xv;return e.current.memoizedState.isDehydrated&&(jm(e,t).flags|=256),e=r2(e,t),e!==2&&(t=oo,oo=n,t!==null&&d5(t)),e}function d5(e){oo===null?oo=e:oo.push.apply(oo,e)}function Epe(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!gc(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Zd(e,t){for(t&=~HD,t&=~Ek,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-fc(t),r=1<<n;e[n]=-1,t&=~r}}function lF(e){if(Qn&6)throw Error(et(327));Bg();var t=$j(e,0);if(!(t&1))return po(e,Ws()),null;var n=r2(e,t);if(e.tag!==0&&n===2){var r=M3(e);r!==0&&(t=r,n=u5(e,r))}if(n===1)throw n=s1,jm(e,0),Zd(e,t),po(e,Ws()),n;if(n===6)throw Error(et(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Mh(e,oo,ku),po(e,Ws()),null}function GD(e,t){var n=Qn;Qn|=1;try{return e(t)}finally{Qn=n,Qn===0&&(yx=Ws()+500,jk&&Kf())}}function Lm(e){hf!==null&&hf.tag===0&&!(Qn&6)&&Bg();var t=Qn;Qn|=1;var n=Cl.transition,r=Ar;try{if(Cl.transition=null,Ar=1,e)return e()}finally{Ar=r,Cl.transition=n,Qn=t,!(Qn&6)&&Kf()}}function KD(){Po=vg.current,os(vg)}function jm(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,rpe(n)),oi!==null)for(n=oi.return;n!==null;){var r=n;switch(SD(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Vj();break;case 3:gx(),os(ho),os(ja),LD();break;case 5:MD(r);break;case 4:gx();break;case 13:os(ws);break;case 19:os(ws);break;case 10:OD(r.type._context);break;case 22:case 23:KD()}n=n.return}if(qi=e,oi=e=Nf(e.current,null),ia=Po=t,Si=0,s1=null,HD=Ek=Mm=0,oo=xv=null,Qh!==null){for(t=0;t<Qh.length;t++)if(n=Qh[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}Qh=null}return e}function ZK(e,t){do{var n=oi;try{if(PD(),Z_.current=Zj,Jj){for(var r=Ns.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Jj=!1}if(Rm=0,Fi=ki=Ns=null,pv=!1,t1=0,VD.current=null,n===null||n.return===null){Si=1,s1=t,oi=null;break}e:{var a=e,o=n.return,l=n,c=t;if(t=ia,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=YL(o);if(p!==null){p.flags&=-257,XL(p,o,l,a,t),p.mode&1&&KL(a,u,t),t=p,c=u;var x=t.updateQueue;if(x===null){var y=new Set;y.add(c),t.updateQueue=y}else x.add(c);break e}else{if(!(t&1)){KL(a,u,t),YD();break e}c=Error(et(426))}}else if(hs&&l.mode&1){var b=YL(o);if(b!==null){!(b.flags&65536)&&(b.flags|=256),XL(b,o,l,a,t),AD(xx(c,l));break e}}a=c=xx(c,l),Si!==4&&(Si=2),xv===null?xv=[a]:xv.push(a),a=o;do{switch(a.tag){case 3:a.flags|=65536,t&=-t,a.lanes|=t;var w=MK(a,c,t);UL(a,w);break e;case 1:l=c;var _=a.type,j=a.stateNode;if(!(a.flags&128)&&(typeof _.getDerivedStateFromError=="function"||j!==null&&typeof j.componentDidCatch=="function"&&(_f===null||!_f.has(j)))){a.flags|=65536,t&=-t,a.lanes|=t;var E=LK(a,l,t);UL(a,E);break e}}a=a.return}while(a!==null)}nY(n)}catch(S){t=S,oi===n&&n!==null&&(oi=n=n.return);continue}break}while(!0)}function eY(){var e=e2.current;return e2.current=Zj,e===null?Zj:e}function YD(){(Si===0||Si===3||Si===2)&&(Si=4),qi===null||!(Mm&268435455)&&!(Ek&268435455)||Zd(qi,ia)}function r2(e,t){var n=Qn;Qn|=2;var r=eY();(qi!==e||ia!==t)&&(ku=null,jm(e,t));do try{Spe();break}catch(i){ZK(e,i)}while(!0);if(PD(),Qn=n,e2.current=r,oi!==null)throw Error(et(261));return qi=null,ia=0,Si}function Spe(){for(;oi!==null;)tY(oi)}function Ape(){for(;oi!==null&&!eme();)tY(oi)}function tY(e){var t=sY(e.alternate,e,Po);e.memoizedProps=e.pendingProps,t===null?nY(e):oi=t,VD.current=null}function nY(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=_pe(n,t),n!==null){n.flags&=32767,oi=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Si=6,oi=null;return}}else if(n=wpe(n,t,Po),n!==null){oi=n;return}if(t=t.sibling,t!==null){oi=t;return}oi=t=e}while(t!==null);Si===0&&(Si=5)}function Mh(e,t,n){var r=Ar,i=Cl.transition;try{Cl.transition=null,Ar=1,Tpe(e,t,n,r)}finally{Cl.transition=i,Ar=r}return null}function Tpe(e,t,n,r){do Bg();while(hf!==null);if(Qn&6)throw Error(et(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(et(177));e.callbackNode=null,e.callbackPriority=0;var a=n.lanes|n.childLanes;if(ume(e,a),e===qi&&(oi=qi=null,ia=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||zw||(zw=!0,iY(Fj,function(){return Bg(),null})),a=(n.flags&15990)!==0,n.subtreeFlags&15990||a){a=Cl.transition,Cl.transition=null;var o=Ar;Ar=1;var l=Qn;Qn|=4,VD.current=null,Npe(e,n),XK(n,e),Xme(U3),Bj=!!z3,U3=z3=null,e.current=n,kpe(n),tme(),Qn=l,Ar=o,Cl.transition=a}else e.current=n;if(zw&&(zw=!1,hf=e,n2=i),a=e.pendingLanes,a===0&&(_f=null),sme(n.stateNode),po(e,Ws()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(t2)throw t2=!1,e=l5,l5=null,e;return n2&1&&e.tag!==0&&Bg(),a=e.pendingLanes,a&1?e===c5?yv++:(yv=0,c5=e):yv=0,Kf(),null}function Bg(){if(hf!==null){var e=MG(n2),t=Cl.transition,n=Ar;try{if(Cl.transition=null,Ar=16>e?16:e,hf===null)var r=!1;else{if(e=hf,hf=null,n2=0,Qn&6)throw Error(et(331));var i=Qn;for(Qn|=4,jt=e.current;jt!==null;){var a=jt,o=a.child;if(jt.flags&16){var l=a.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(jt=u;jt!==null;){var d=jt;switch(d.tag){case 0:case 11:case 15:gv(8,d,a)}var f=d.child;if(f!==null)f.return=d,jt=f;else for(;jt!==null;){d=jt;var h=d.sibling,p=d.return;if(GK(d),d===u){jt=null;break}if(h!==null){h.return=p,jt=h;break}jt=p}}}var x=a.alternate;if(x!==null){var y=x.child;if(y!==null){x.child=null;do{var b=y.sibling;y.sibling=null,y=b}while(y!==null)}}jt=a}}if(a.subtreeFlags&2064&&o!==null)o.return=a,jt=o;else e:for(;jt!==null;){if(a=jt,a.flags&2048)switch(a.tag){case 0:case 11:case 15:gv(9,a,a.return)}var w=a.sibling;if(w!==null){w.return=a.return,jt=w;break e}jt=a.return}}var _=e.current;for(jt=_;jt!==null;){o=jt;var j=o.child;if(o.subtreeFlags&2064&&j!==null)j.return=o,jt=j;else e:for(o=_;jt!==null;){if(l=jt,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Ck(9,l)}}catch(S){Is(l,l.return,S)}if(l===o){jt=null;break e}var E=l.sibling;if(E!==null){E.return=l.return,jt=E;break e}jt=l.return}}if(Qn=i,Kf(),Jc&&typeof Jc.onPostCommitFiberRoot=="function")try{Jc.onPostCommitFiberRoot(yk,e)}catch{}r=!0}return r}finally{Ar=n,Cl.transition=t}}return!1}function cF(e,t,n){t=xx(n,t),t=MK(e,t,1),e=wf(e,t,1),t=Ua(),e!==null&&(bb(e,1,t),po(e,t))}function Is(e,t,n){if(e.tag===3)cF(e,e,n);else for(;t!==null;){if(t.tag===3){cF(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(_f===null||!_f.has(r))){e=xx(n,e),e=LK(t,e,1),t=wf(t,e,1),e=Ua(),t!==null&&(bb(t,1,e),po(t,e));break}}t=t.return}}function Ppe(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Ua(),e.pingedLanes|=e.suspendedLanes&n,qi===e&&(ia&n)===n&&(Si===4||Si===3&&(ia&130023424)===ia&&500>Ws()-WD?jm(e,0):HD|=n),po(e,t)}function rY(e,t){t===0&&(e.mode&1?(t=Pw,Pw<<=1,!(Pw&130023424)&&(Pw=4194304)):t=1);var n=Ua();e=Zu(e,t),e!==null&&(bb(e,t,n),po(e,n))}function Ope(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),rY(e,n)}function Dpe(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(et(314))}r!==null&&r.delete(t),rY(e,n)}var sY;sY=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ho.current)uo=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return uo=!1,bpe(e,t,n);uo=!!(e.flags&131072)}else uo=!1,hs&&t.flags&1048576&&lK(t,Gj,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;tj(e,t),e=t.pendingProps;var i=hx(t,ja.current);$g(t,n),i=$D(null,t,r,e,i,n);var a=BD();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,mo(r)?(a=!0,Hj(t)):a=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,ID(t),i.updater=kk,t.stateNode=i,i._reactInternals=t,Q3(t,r,e,n),t=e5(null,t,r,!0,a,n)):(t.tag=0,hs&&a&&ED(t),Pa(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(tj(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=Rpe(r),e=Jl(r,e),i){case 0:t=Z3(null,t,r,e,n);break e;case 1:t=ZL(null,t,r,e,n);break e;case 11:t=QL(null,t,r,e,n);break e;case 14:t=JL(null,t,r,Jl(r.type,e),n);break e}throw Error(et(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Jl(r,i),Z3(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Jl(r,i),ZL(e,t,r,i,n);case 3:e:{if(zK(t),e===null)throw Error(et(387));r=t.pendingProps,a=t.memoizedState,i=a.element,mK(e,t),Xj(t,r,null,n);var o=t.memoizedState;if(r=o.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){i=xx(Error(et(423)),t),t=eF(e,t,r,n,i);break e}else if(r!==i){i=xx(Error(et(424)),t),t=eF(e,t,r,n,i);break e}else for(zo=bf(t.stateNode.containerInfo.firstChild),Uo=t,hs=!0,ac=null,n=fK(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(mx(),r===i){t=ed(e,t,n);break e}Pa(e,t,r,n)}t=t.child}return t;case 5:return pK(t),e===null&&K3(t),r=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,o=i.children,q3(r,i)?o=null:a!==null&&q3(r,a)&&(t.flags|=32),BK(e,t),Pa(e,t,o,n),t.child;case 6:return e===null&&K3(t),null;case 13:return UK(e,t,n);case 4:return RD(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=px(t,null,r,n):Pa(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Jl(r,i),QL(e,t,r,i,n);case 7:return Pa(e,t,t.pendingProps,n),t.child;case 8:return Pa(e,t,t.pendingProps.children,n),t.child;case 12:return Pa(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value,Qr(Kj,r._currentValue),r._currentValue=o,a!==null)if(gc(a.value,o)){if(a.children===i.children&&!ho.current){t=ed(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){o=a.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(a.tag===1){c=Uu(-1,n&-n),c.tag=2;var u=a.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Y3(a.return,n,t),l.lanes|=n;break}c=c.next}}else if(a.tag===10)o=a.type===t.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(et(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Y3(o,n,t),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}Pa(e,t,i.children,n),t=t.child}return t;
vendor: 6,247 bytes, line 40
40case 9:return i=t.type,r=t.pendingProps.children,$g(t,n),i=Ol(i),r=r(i),t.flags|=1,Pa(e,t,r,n),t.child;case 14:return r=t.type,i=Jl(r,t.pendingProps),i=Jl(r.type,i),JL(e,t,r,i,n);case 15:return FK(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Jl(r,i),tj(e,t),t.tag=1,mo(r)?(e=!0,Hj(t)):e=!1,$g(t,n),RK(t,r,i),Q3(t,r,i,n),e5(null,t,r,!0,e,n);case 19:return qK(e,t,n);case 22:return $K(e,t,n)}throw Error(et(156,t.tag))};function iY(e,t){return OG(e,t)}function Ipe(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bl(e,t,n,r){return new Ipe(e,t,n,r)}function XD(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Rpe(e){if(typeof e=="function")return XD(e)?1:0;if(e!=null){if(e=e.$$typeof,e===pD)return 11;if(e===gD)return 14}return 2}function Nf(e,t){var n=e.alternate;return n===null?(n=bl(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function sj(e,t,n,r,i,a){var o=2;if(r=e,typeof e=="function")XD(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case cg:return Nm(n.children,i,a,t);case mD:o=8,i|=8;break;case w3:return e=bl(12,n,t,i|2),e.elementType=w3,e.lanes=a,e;case _3:return e=bl(13,n,t,i),e.elementType=_3,e.lanes=a,e;case j3:return e=bl(19,n,t,i),e.elementType=j3,e.lanes=a,e;case pG:return Sk(n,i,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case hG:o=10;break e;case mG:o=9;break e;case pD:o=11;break e;case gD:o=14;break e;case Wd:o=16,r=null;break e}throw Error(et(130,e==null?e:typeof e,""))}return t=bl(o,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function Nm(e,t,n,r){return e=bl(7,e,r,t),e.lanes=n,e}function Sk(e,t,n,r){return e=bl(22,e,r,t),e.elementType=pG,e.lanes=n,e.stateNode={isHidden:!1},e}function GS(e,t,n){return e=bl(6,e,null,t),e.lanes=n,e}function KS(e,t,n){return t=bl(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Mpe(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=SS(0),this.expirationTimes=SS(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=SS(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function QD(e,t,n,r,i,a,o,l,c){return e=new Mpe(e,t,n,l,c),t===1?(t=1,a===!0&&(t|=8)):t=0,a=bl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ID(a),e}function Lpe(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:lg,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function aY(e){if(!e)return Of;e=e._reactInternals;e:{if(cp(e)!==e||e.tag!==1)throw Error(et(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(mo(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(et(171))}if(e.tag===1){var n=e.type;if(mo(n))return aK(e,n,t)}return t}function oY(e,t,n,r,i,a,o,l,c){return e=QD(n,r,!0,e,i,a,o,l,c),e.context=aY(null),n=e.current,r=Ua(),i=jf(n),a=Uu(r,i),a.callback=t??null,wf(n,a,i),e.current.lanes=i,bb(e,i,r),po(e,r),e}function Ak(e,t,n,r){var i=t.current,a=Ua(),o=jf(i);return n=aY(n),t.context===null?t.context=n:t.pendingContext=n,t=Uu(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=wf(i,t,o),e!==null&&(hc(e,i,o,a),J_(e,i,o)),o}function s2(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function uF(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function JD(e,t){uF(e,t),(e=e.alternate)&&uF(e,t)}function Fpe(){return null}var lY=typeof reportError=="function"?reportError:function(e){console.error(e)};function ZD(e){this._internalRoot=e}Tk.prototype.render=ZD.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(et(409));Ak(e,t,null,null)};Tk.prototype.unmount=ZD.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Lm(function(){Ak(null,e,null,null)}),t[Ju]=null}};function Tk(e){this._internalRoot=e}Tk.prototype.unstable_scheduleHydration=function(e){if(e){var t=$G();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Jd.length&&t!==0&&t<Jd[n].priority;n++);Jd.splice(n,0,e),n===0&&zG(e)}};function eI(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Pk(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function dF(){}function $pe(e,t,n,r,i){if(i){if(typeof r=="function"){var a=r;r=function(){var u=s2(o);a.call(u)}}var o=oY(t,r,e,0,null,!1,!1,"",dF);return e._reactRootContainer=o,e[Ju]=o.current,Xv(e.nodeType===8?e.parentNode:e),Lm(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var l=r;r=function(){var u=s2(c);l.call(u)}}var c=QD(e,0,!1,null,null,!1,!1,"",dF);return e._reactRootContainer=c,e[Ju]=c.current,Xv(e.nodeType===8?e.parentNode:e),Lm(function(){Ak(t,c,n,r)}),c}function Ok(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i=="function"){var l=i;
vendor: 4,824 bytes, line 40
40i=function(){var c=s2(o);l.call(c)}}Ak(t,o,e,i)}else o=$pe(n,t,e,i,r);return s2(o)}LG=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Zy(t.pendingLanes);n!==0&&(vD(t,n|1),po(t,Ws()),!(Qn&6)&&(yx=Ws()+500,Kf()))}break;case 13:Lm(function(){var r=Zu(e,1);if(r!==null){var i=Ua();hc(r,e,1,i)}}),JD(e,1)}};bD=function(e){if(e.tag===13){var t=Zu(e,134217728);if(t!==null){var n=Ua();hc(t,e,134217728,n)}JD(e,134217728)}};FG=function(e){if(e.tag===13){var t=jf(e),n=Zu(e,t);if(n!==null){var r=Ua();hc(n,e,t,r)}JD(e,t)}};$G=function(){return Ar};BG=function(e,t){var n=Ar;try{return Ar=e,t()}finally{Ar=n}};D3=function(e,t,n){switch(t){case"input":if(C3(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=_k(r);if(!i)throw Error(et(90));xG(r),C3(r,i)}}}break;case"textarea":vG(e,n);break;case"select":t=n.value,t!=null&&Rg(e,!!n.multiple,t,!1)}};CG=GD;EG=Lm;var Bpe={usingClientEntryPoint:!1,Events:[_b,hg,_k,NG,kG,GD]},xy={findFiberByHostInstance:Xh,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},zpe={bundleType:xy.bundleType,version:xy.version,rendererPackageName:xy.rendererPackageName,rendererConfig:xy.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:md.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=TG(e),e===null?null:e.stateNode},findFiberByHostInstance:xy.findFiberByHostInstance||Fpe,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Uw=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Uw.isDisabled&&Uw.supportsFiber)try{yk=Uw.inject(zpe),Jc=Uw}catch{}}Jo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Bpe;Jo.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!eI(t))throw Error(et(200));return Lpe(e,t,null,n)};Jo.createRoot=function(e,t){if(!eI(e))throw Error(et(299));var n=!1,r="",i=lY;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=QD(e,1,!1,null,null,n,!1,r,i),e[Ju]=t.current,Xv(e.nodeType===8?e.parentNode:e),new ZD(t)};Jo.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(et(188)):(e=Object.keys(e).join(","),Error(et(268,e)));return e=TG(t),e=e===null?null:e.stateNode,e};Jo.flushSync=function(e){return Lm(e)};Jo.hydrate=function(e,t,n){if(!Pk(t))throw Error(et(200));return Ok(null,e,t,!0,n)};Jo.hydrateRoot=function(e,t,n){if(!eI(e))throw Error(et(405));var r=n!=null&&n.hydratedSources||null,i=!1,a="",o=lY;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=oY(t,null,e,1,n??null,i,!1,a,o),e[Ju]=t.current,Xv(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new Tk(t)};Jo.render=function(e,t,n){if(!Pk(t))throw Error(et(200));return Ok(null,e,t,!1,n)};Jo.unmountComponentAtNode=function(e){if(!Pk(e))throw Error(et(40));return e._reactRootContainer?(Lm(function(){Ok(null,null,e,!1,function(){e._reactRootContainer=null,e[Ju]=null})}),!0):!1};Jo.unstable_batchedUpdates=GD;Jo.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Pk(n))throw Error(et(200));if(e==null||e._reactInternals===void 0)throw Error(et(38));return Ok(e,t,n,!1,r)};Jo.version="18.3.1-next-f1338f8080-20240426";function cY(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(cY)}catch(e){console.error(e)}}cY(),cG.exports=Jo;var Yf=cG.exports;const uY=dr(Yf);var dY,fF=Yf;dY=fF.createRoot,fF.hydrateRoot;const Upe=1,qpe=1e6;let YS=0;function Vpe(){return YS=(YS+1)%Number.MAX_SAFE_INTEGER,YS.toString()}const XS=new Map,hF=e=>{if(XS.has(e))return;const t=setTimeout(()=>{XS.delete(e),vv({type:"REMOVE_TOAST",toastId:e})},qpe);XS.set(e,t)},Hpe=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,Upe)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;
40return n?hF(n):e.toasts.forEach(r=>{hF(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},ij=[];let aj={toasts:[]};function vv(e){aj=Hpe(aj,e),ij.forEach(t=>{t(aj)})}function dn({...e}){const t=Vpe(),n=i=>vv({type:"UPDATE_TOAST",toast:{...i,id:t}}),r=()=>vv({type:"DISMISS_TOAST",toastId:t});return vv({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:i=>{i||r()}}}),{id:t,dismiss:r,update:n}}function _r(){const[e,t]=N.useState(aj);return N.useEffect(()=>(ij.push(t),()=>{const n=ij.indexOf(t);n>-1&&ij.splice(n,1)}),[e]),{...e,toast:dn,dismiss:n=>vv({type:"DISMISS_TOAST",toastId:n})}}function Je(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function mF(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function td(...e){return t=>{let n=!1;const r=e.map(i=>{const a=mF(i,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i<r.length;i++){const a=r[i];typeof a=="function"?a():mF(e[i],null)}}}}function Qt(...e){return N.useCallback(td(...e),e)}function Wpe(e,t){const n=N.createContext(t),r=a=>{const{children:o,...l}=a,c=N.useMemo(()=>l,Object.values(l));return s.jsx(n.Provider,{value:c,children:o})};r.displayName=e+"Provider";function i(a){const o=N.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[r,i]}function Us(e,t=[]){let n=[];function r(a,o){const l=N.createContext(o),c=n.length;n=[...n,o];const u=f=>{var w;const{scope:h,children:p,...x}=f,y=((w=h==null?void 0:h[e])==null?void 0:w[c])||l,b=N.useMemo(()=>x,Object.values(x));return s.jsx(y.Provider,{value:b,children:p})};u.displayName=a+"Provider";function d(f,h){var y;const p=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,x=N.useContext(p);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[u,d]}const i=()=>{const a=n.map(o=>N.createContext(o));return function(l){const c=(l==null?void 0:l[e])||a;return N.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return i.scopeName=e,[r,Gpe(i,...t)]}function Gpe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(a)[`__scope${u}`];return{...l,...f}},{});return N.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function Df(e){const t=Kpe(e),n=N.forwardRef((r,i)=>{const{children:a,...o}=r,l=N.Children.toArray(a),c=l.find(Ype);if(c){const u=c.props.children,d=l.map(f=>f===c?N.Children.count(u)>1?N.Children.only(null):N.isValidElement(u)?u.props.children:null:f);return s.jsx(t,{...o,ref:i,children:N.isValidElement(u)?N.cloneElement(u,void 0,d):null})}return s.jsx(t,{...o,ref:i,children:a})});return n.displayName=`${e}.Slot`,n}var fY=Df("Slot");function Kpe(e){const t=N.forwardRef((n,r)=>{const{children:i,...a}=n;if(N.isValidElement(i)){const o=Qpe(i),l=Xpe(a,i.props);return i.type!==N.Fragment&&(l.ref=r?td(r,o):o),N.cloneElement(i,l)}return N.Children.count(i)>1?N.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hY=Symbol("radix.slottable");function mY(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=hY,t}function Ype(e){return N.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hY}function Xpe(e,t){const n={...t};for(const r in t){const i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...l)=>{const c=a(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}function Qpe(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Nb(e){const t=e+"CollectionProvider",[n,r]=Us(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:b,children:w}=y,_=ee.useRef(null),j=ee.useRef(new Map).current;return s.jsx(i,{scope:b,itemMap:j,collectionRef:_,children:w})};o.displayName=t;const l=e+"CollectionSlot",c=Df(l),u=ee.forwardRef((y,b)=>{const{scope:w,children:_}=y,j=a(l,w),E=Qt(b,j.collectionRef);return s.jsx(c,{ref:E,children:_})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=Df(d),p=ee.forwardRef((y,b)=>{const{scope:w,children:_,...j}=y,E=ee.useRef(null),S=Qt(b,E),T=a(d,w);return ee.useEffect(()=>(T.itemMap.set(E,{ref:E,...j}),()=>
vendor: 9,207 bytes, line 40
40void T.itemMap.delete(E))),s.jsx(h,{[f]:"",ref:S,children:_})});p.displayName=d;function x(y){const b=a(e+"CollectionConsumer",y);return ee.useCallback(()=>{const _=b.collectionRef.current;if(!_)return[];const j=Array.from(_.querySelectorAll(`[${f}]`));return Array.from(b.itemMap.values()).sort((T,P)=>j.indexOf(T.ref.current)-j.indexOf(P.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:o,Slot:u,ItemSlot:p},x,r]}var Jpe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ut=Jpe.reduce((e,t)=>{const n=Df(`Primitive.${t}`),r=N.forwardRef((i,a)=>{const{asChild:o,...l}=i,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function tI(e,t){e&&Yf.flushSync(()=>e.dispatchEvent(t))}function Ms(e){const t=N.useRef(e);return N.useEffect(()=>{t.current=e}),N.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Zpe(e,t=globalThis==null?void 0:globalThis.document){const n=Ms(e);N.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var ege="DismissableLayer",f5="dismissableLayer.update",tge="dismissableLayer.pointerDownOutside",nge="dismissableLayer.focusOutside",pF,pY=N.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),up=N.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:l,...c}=e,u=N.useContext(pY),[d,f]=N.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=N.useState({}),x=Qt(t,P=>f(P)),y=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),w=y.indexOf(b),_=d?y.indexOf(d):-1,j=u.layersWithOutsidePointerEventsDisabled.size>0,E=_>=w,S=sge(P=>{const O=P.target,D=[...u.branches].some(R=>R.contains(O));!E||D||(i==null||i(P),o==null||o(P),P.defaultPrevented||l==null||l())},h),T=ige(P=>{const O=P.target;[...u.branches].some(R=>R.contains(O))||(a==null||a(P),o==null||o(P),P.defaultPrevented||l==null||l())},h);return Zpe(P=>{_===u.layers.size-1&&(r==null||r(P),!P.defaultPrevented&&l&&(P.preventDefault(),l()))},h),N.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(pF=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),gF(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=pF)}},[d,h,n,u]),N.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),gF())},[d,u]),N.useEffect(()=>{const P=()=>p({});return document.addEventListener(f5,P),()=>document.removeEventListener(f5,P)},[]),s.jsx(ut.div,{...c,ref:x,style:{pointerEvents:j?E?"auto":"none":void 0,...e.style},onFocusCapture:Je(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Je(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Je(e.onPointerDownCapture,S.onPointerDownCapture)})});up.displayName=ege;var rge="DismissableLayerBranch",gY=N.forwardRef((e,t)=>{const n=N.useContext(pY),r=N.useRef(null),i=Qt(t,r);return N.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),s.jsx(ut.div,{...e,ref:i})});gY.displayName=rge;function sge(e,t=globalThis==null?void 0:globalThis.document){const n=Ms(e),r=N.useRef(!1),i=N.useRef(()=>{});return N.useEffect(()=>{const a=l=>{if(l.target&&!r.current){let c=function(){xY(tge,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=c,t.addEventListener("click",i.current,{once:!0})):c()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",a),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ige(e,t=globalThis==null?void 0:globalThis.document){const n=Ms(e),r=N.useRef(!1);return N.useEffect(()=>{const i=a=>{a.target&&!r.current&&xY(nge,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function gF(){const e=new CustomEvent(f5);document.dispatchEvent(e)}function xY(e,t,n,{discrete:r}){const i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?tI(i,a):i.dispatchEvent(a)}var age=up,oge=gY,Bs=globalThis!=null&&globalThis.document?N.useLayoutEffect:()=>{},lge="Portal",g0=N.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[i,a]=N.useState(!1);Bs(()=>a(!0),[]);const o=n||i&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?uY.createPortal(s.jsx(ut.div,{...r,ref:t}),o):null});g0.displayName=lge;function cge(e,t){return N.useReducer((n,r)=>t[n][r]??n,e)}var mi=e=>{const{present:t,children:n}=e,r=uge(t),i=typeof n=="function"?n({present:r.isPresent}):N.Children.only(n),a=Qt(r.ref,dge(i));return typeof n=="function"||r.isPresent?N.cloneElement(i,{ref:a}):null};mi.displayName="Presence";function uge(e){const[t,n]=N.useState(),r=N.useRef(null),i=N.useRef(e),a=N.useRef("none"),o=e?"mounted":"unmounted",[l,c]=cge(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return N.useEffect(()=>{const u=qw(r.current);a.current=l==="mounted"?u:"none"},[l]),Bs(()=>{const u=r.current,d=i.current;if(d!==e){const h=a.current,p=qw(u);e?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),Bs(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const y=qw(r.current).includes(p.animationName);if(p.target===t&&y&&(c("ANIMATION_END"),!i.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=p=>{p.target===t&&(a.current=qw(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:N.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function qw(e){return(e==null?void 0:e.animationName)||"none"}function dge(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var fge=oG[" useInsertionEffect ".trim().toString()]||Bs;function Hi({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,a,o]=hge({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:i;{const d=N.useRef(e!==void 0);N.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,r])}const u=N.useCallback(d=>{var f;if(l){const h=mge(d)?d(e):d;h!==e&&((f=o.current)==null||f.call(o,h))}else a(d)},[l,e,a,o]);return[c,u]}function hge({defaultProp:e,onChange:t}){const[n,r]=N.useState(e),i=N.useRef(n),a=N.useRef(t);return fge(()=>{a.current=t},[t]),N.useEffect(()=>{var o;i.current!==n&&((o=a.current)==null||o.call(a,n),i.current=n)},[n,i]),[n,r,a]}function mge(e){return typeof e=="function"}var yY=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),pge="VisuallyHidden",Dk=N.forwardRef((e,t)=>s.jsx(ut.span,{...e,ref:t,style:{...yY,...e.style}}));Dk.displayName=pge;var gge=Dk,nI="ToastProvider",[rI,xge,yge]=Nb("Toast"),[vY]=Us("Toast",[yge]),[vge,Ik]=vY(nI),bY=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:i="right",swipeThreshold:a=50,children:o}=e,[l,c]=N.useState(null),[u,d]=N.useState(0),f=N.useRef(!1),h=N.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${nI}\`. Expected non-empty \`string\`.`),s.jsx(rI.Provider,{scope:t,children:s.jsx(vge,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:u,viewport:l,onViewportChange:c,onToastAdd:N.useCallback(()=>d(p=>p+1),[]),onToastRemove:N.useCallback(()=>d(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:h,children:o})})};bY.displayName=nI;var wY="ToastViewport",bge=["F8"],h5="toast.viewportPause",m5="toast.viewportResume",_Y=N.forwardRef((e,t)=>
40{const{__scopeToast:n,hotkey:r=bge,label:i="Notifications ({hotkey})",...a}=e,o=Ik(wY,n),l=xge(n),c=N.useRef(null),u=N.useRef(null),d=N.useRef(null),f=N.useRef(null),h=Qt(t,f,o.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=o.toastCount>0;N.useEffect(()=>{const b=w=>{var j;r.length!==0&&r.every(E=>w[E]||w.code===E)&&((j=f.current)==null||j.focus())};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[r]),N.useEffect(()=>{const b=c.current,w=f.current;if(x&&b&&w){const _=()=>{if(!o.isClosePausedRef.current){const T=new CustomEvent(h5);w.dispatchEvent(T),o.isClosePausedRef.current=!0}},j=()=>{if(o.isClosePausedRef.current){const T=new CustomEvent(m5);w.dispatchEvent(T),o.isClosePausedRef.current=!1}},E=T=>{!b.contains(T.relatedTarget)&&j()},S=()=>{b.contains(document.activeElement)||j()};return b.addEventListener("focusin",_),b.addEventListener("focusout",E),b.addEventListener("pointermove",_),b.addEventListener("pointerleave",S),window.addEventListener("blur",_),window.addEventListener("focus",j),()=>{b.removeEventListener("focusin",_),b.removeEventListener("focusout",E),b.removeEventListener("pointermove",_),b.removeEventListener("pointerleave",S),window.removeEventListener("blur",_),window.removeEventListener("focus",j)}}},[x,o.isClosePausedRef]);const y=N.useCallback(({tabbingDirection:b})=>{const _=l().map(j=>{const E=j.ref.current,S=[E,...Dge(E)];return b==="forwards"?S:S.reverse()});return(b==="forwards"?_.reverse():_).flat()},[l]);return N.useEffect(()=>{const b=f.current;if(b){const w=_=>{var S,T,P;const j=_.altKey||_.ctrlKey||_.metaKey;if(_.key==="Tab"&&!j){const O=document.activeElement,D=_.shiftKey;if(_.target===b&&D){(S=u.current)==null||S.focus();return}const M=y({tabbingDirection:D?"backwards":"forwards"}),B=M.findIndex(U=>U===O);QS(M.slice(B+1))?_.preventDefault():D?(T=u.current)==null||T.focus():(P=d.current)==null||P.focus()}};return b.addEventListener("keydown",w),()=>b.removeEventListener("keydown",w)}},[l,y]),s.jsxs(oge,{ref:c,role:"region","aria-label":i.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&s.jsx(p5,{ref:u,onFocusFromOutsideViewport:()=>{const b=y({tabbingDirection:"forwards"});QS(b)}}),s.jsx(rI.Slot,{scope:n,children:s.jsx(ut.ol,{tabIndex:-1,...a,ref:h})}),x&&s.jsx(p5,{ref:d,onFocusFromOutsideViewport:()=>{const b=y({tabbingDirection:"backwards"});QS(b)}})]})});_Y.displayName=wY;var jY="ToastFocusProxy",p5=N.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=Ik(jY,n);return s.jsx(Dk,{"aria-hidden":!0,tabIndex:0,...i,ref:t,style:{position:"fixed"},onFocus:o=>{var u;const l=o.relatedTarget;!((u=a.viewport)!=null&&u.contains(l))&&r()}})});p5.displayName=jY;var kb="Toast",wge="toast.swipeStart",_ge="toast.swipeMove",jge="toast.swipeCancel",Nge="toast.swipeEnd",NY=N.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[l,c]=Hi({prop:r,defaultProp:i??!0,onChange:a,caller:kb});return s.jsx(mi,{present:n||l,children:s.jsx(Ege,{open:l,...o,ref:t,onClose:()=>c(!1),onPause:Ms(e.onPause),onResume:Ms(e.onResume),onSwipeStart:Je(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Je(e.onSwipeMove,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:Je(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Je(e.onSwipeEnd,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});NY.displayName=kb;var[kge,Cge]=vY(kb,{onClose(){}}),Ege=N.forwardRef((e,t)=>
40{const{__scopeToast:n,type:r="foreground",duration:i,open:a,onClose:o,onEscapeKeyDown:l,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:h,onSwipeEnd:p,...x}=e,y=Ik(kb,n),[b,w]=N.useState(null),_=Qt(t,U=>w(U)),j=N.useRef(null),E=N.useRef(null),S=i||y.duration,T=N.useRef(0),P=N.useRef(S),O=N.useRef(0),{onToastAdd:D,onToastRemove:R}=y,L=Ms(()=>{var F;(b==null?void 0:b.contains(document.activeElement))&&((F=y.viewport)==null||F.focus()),o()}),M=N.useCallback(U=>{!U||U===1/0||(window.clearTimeout(O.current),T.current=new Date().getTime(),O.current=window.setTimeout(L,U))},[L]);N.useEffect(()=>{const U=y.viewport;if(U){const F=()=>{M(P.current),u==null||u()},H=()=>{const z=new Date().getTime()-T.current;P.current=P.current-z,window.clearTimeout(O.current),c==null||c()};return U.addEventListener(h5,H),U.addEventListener(m5,F),()=>{U.removeEventListener(h5,H),U.removeEventListener(m5,F)}}},[y.viewport,S,c,u,M]),N.useEffect(()=>{a&&!y.isClosePausedRef.current&&M(S)},[a,S,y.isClosePausedRef,M]),N.useEffect(()=>(D(),()=>R()),[D,R]);const B=N.useMemo(()=>b?PY(b):null,[b]);return y.viewport?s.jsxs(s.Fragment,{children:[B&&s.jsx(Sge,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:B}),s.jsx(kge,{scope:n,onClose:L,children:Yf.createPortal(s.jsx(rI.ItemSlot,{scope:n,children:s.jsx(age,{asChild:!0,onEscapeKeyDown:Je(l,()=>{y.isFocusedToastEscapeKeyDownRef.current||L(),y.isFocusedToastEscapeKeyDownRef.current=!1}),children:s.jsx(ut.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":a?"open":"closed","data-swipe-direction":y.swipeDirection,...x,ref:_,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Je(e.onKeyDown,U=>{U.key==="Escape"&&(l==null||l(U.nativeEvent),U.nativeEvent.defaultPrevented||(y.isFocusedToastEscapeKeyDownRef.current=!0,L()))}),onPointerDown:Je(e.onPointerDown,U=>{U.button===0&&(j.current={x:U.clientX,y:U.clientY})}),onPointerMove:Je(e.onPointerMove,U=>{if(!j.current)return;const F=U.clientX-j.current.x,H=U.clientY-j.current.y,z=!!E.current,K=["left","right"].includes(y.swipeDirection),W=["left","up"].includes(y.swipeDirection)?Math.min:Math.max,q=K?W(0,F):0,oe=K?0:W(0,H),J=U.pointerType==="touch"?10:2,Y={x:q,y:oe},Z={originalEvent:U,delta:Y};z?(E.current=Y,Vw(_ge,f,Z,{discrete:!1})):xF(Y,y.swipeDirection,J)?(E.current=Y,Vw(wge,d,Z,{discrete:!1}),U.target.setPointerCapture(U.pointerId)):(Math.abs(F)>J||Math.abs(H)>J)&&(j.current=null)}),onPointerUp:Je(e.onPointerUp,U=>{const F=E.current,H=U.target;if(H.hasPointerCapture(U.pointerId)&&H.releasePointerCapture(U.pointerId),E.current=null,j.current=null,F){const z=U.currentTarget,K={originalEvent:U,delta:F};xF(F,y.swipeDirection,y.swipeThreshold)?Vw(Nge,p,K,{discrete:!0}):Vw(jge,h,K,{discrete:!0}),z.addEventListener("click",W=>W.preventDefault(),{once:!0})}})})})}),y.viewport)})]}):null}),Sge=e=>{const{__scopeToast:t,children:n,...r}=e,i=Ik(kb,t),[a,o]=N.useState(!1),[l,c]=N.useState(!1);return Pge(()=>o(!0)),N.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),l?null:s.jsx(g0,{asChild:!0,children:s.jsx(Dk,{...r,children:a&&s.jsxs(s.Fragment,{children:[i.label," ",n]})})})},Age="ToastTitle",kY=N.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return s.jsx(ut.div,{...r,ref:t})});kY.displayName=Age;var Tge="ToastDescription",CY=N.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return s.jsx(ut.div,{...r,ref:t})});CY.displayName=Tge;var EY="ToastAction",SY=N.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?s.jsx(TY,{altText:n,asChild:!0,children:s.jsx(sI,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${EY}\`. Expected non-empty \`string\`.`),null)});SY.displayName=EY;var AY="ToastClose",sI=N.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,i=Cge(AY,n);return s.jsx(TY,{asChild:!0,children:s.jsx(ut.button,{type:"button",...r,ref:t,onClick:Je(e.onClick,i.onClose)})})});sI.displayName=AY;var TY=N.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...i}=e;return s.jsx(ut.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function PY(e){const t=[];
vendor: 10,169 bytes, lines 40-135
40return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),Oge(r)){const i=r.ariaHidden||r.hidden||r.style.display==="none",a=r.dataset.radixToastAnnounceExclude==="";if(!i)if(a){const o=r.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...PY(r))}}),t}function Vw(e,t,n,{discrete:r}){const i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?tI(i,a):i.dispatchEvent(a)}var xF=(e,t,n=0)=>{const r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t==="left"||t==="right"?a&&r>n:!a&&i>n};function Pge(e=()=>{}){const t=Ms(e);Bs(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function Oge(e){return e.nodeType===e.ELEMENT_NODE}function Dge(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function QS(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var Ige=bY,OY=_Y,DY=NY,IY=kY,RY=CY,MY=SY,LY=sI;function FY(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=FY(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function hn(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=FY(e))&&(r&&(r+=" "),r+=t);return r}const yF=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,vF=hn,dp=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return vF(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:a}=t,o=Object.keys(i).map(u=>{const d=n==null?void 0:n[u],f=a==null?void 0:a[u];if(d===null)return null;const h=yF(d)||yF(f);return i[u][h]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(x=>{let[y,b]=x;return Array.isArray(b)?b.includes({...a,...l}[y]):{...a,...l}[y]===b})?[...u,f,h]:u},[]);return vF(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)};/**
41 * @license lucide-react v0.462.0 - ISC
42 *
43 * This source code is licensed under the ISC license.
44 * See the LICENSE file in the root directory of this source tree.
45 */const Rge=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$Y=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
46 * @license lucide-react v0.462.0 - ISC
47 *
48 * This source code is licensed under the ISC license.
49 * See the LICENSE file in the root directory of this source tree.
50 */var Mge={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
51 * @license lucide-react v0.462.0 - ISC
52 *
53 * This source code is licensed under the ISC license.
54 * See the LICENSE file in the root directory of this source tree.
55 */const Lge=N.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:a,iconNode:o,...l},c)=>N.createElement("svg",{ref:c,...Mge,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:$Y("lucide",i),...l},[...o.map(([u,d])=>N.createElement(u,d)),...Array.isArray(a)?a:[a]]));/**
56 * @license lucide-react v0.462.0 - ISC
57 *
58 * This source code is licensed under the ISC license.
59 * See the LICENSE file in the root directory of this source tree.
60 */const Oe=(e,t)=>{const n=N.forwardRef(({className:r,...i},a)=>N.createElement(Lge,{ref:a,iconNode:t,className:$Y(`lucide-${Rge(e)}`,r),...i}));return n.displayName=`${e}`,n};/**
61 * @license lucide-react v0.462.0 - ISC
62 *
63 * This source code is licensed under the ISC license.
64 * See the LICENSE file in the root directory of this source tree.
65 */const g5=Oe("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
66 * @license lucide-react v0.462.0 - ISC
67 *
68 * This source code is licensed under the ISC license.
69 * See the LICENSE file in the root directory of this source tree.
70 */const BY=Oe("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
71 * @license lucide-react v0.462.0 - ISC
72 *
73 * This source code is licensed under the ISC license.
74 * See the LICENSE file in the root directory of this source tree.
75 */const Fn=Oe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
76 * @license lucide-react v0.462.0 - ISC
77 *
78 * This source code is licensed under the ISC license.
79 * See the LICENSE file in the root directory of this source tree.
80 */const Sr=Oe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
81 * @license lucide-react v0.462.0 - ISC
82 *
83 * This source code is licensed under the ISC license.
84 * See the LICENSE file in the root directory of this source tree.
85 */const Fge=Oe("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/**
86 * @license lucide-react v0.462.0 - ISC
87 *
88 * This source code is licensed under the ISC license.
89 * See the LICENSE file in the root directory of this source tree.
90 */const $ge=Oe("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
91 * @license lucide-react v0.462.0 - ISC
92 *
93 * This source code is licensed under the ISC license.
94 * See the LICENSE file in the root directory of this source tree.
95 */const zY=Oe("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
96 * @license lucide-react v0.462.0 - ISC
97 *
98 * This source code is licensed under the ISC license.
99 * See the LICENSE file in the root directory of this source tree.
100 */const x5=Oe("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);/**
101 * @license lucide-react v0.462.0 - ISC
102 *
103 * This source code is licensed under the ISC license.
104 * See the LICENSE file in the root directory of this source tree.
105 */const Bge=Oe("BadgeEuro",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M7 12h5",key:"gblrwe"}],["path",{d:"M15 9.4a4 4 0 1 0 0 5.2",key:"1makmb"}]]);/**
106 * @license lucide-react v0.462.0 - ISC
107 *
108 * This source code is licensed under the ISC license.
109 * See the LICENSE file in the root directory of this source tree.
110 */const zge=Oe("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/**
111 * @license lucide-react v0.462.0 - ISC
112 *
113 * This source code is licensed under the ISC license.
114 * See the LICENSE file in the root directory of this source tree.
115 */const Uge=Oe("Beer",[["path",{d:"M17 11h1a3 3 0 0 1 0 6h-1",key:"1yp76v"}],["path",{d:"M9 12v6",key:"1u1cab"}],["path",{d:"M13 12v6",key:"1sugkk"}],["path",{d:"M14 7.5c-1 0-1.44.5-3 .5s-2-.5-3-.5-1.72.5-2.5.5a2.5 2.5 0 0 1 0-5c.78 0 1.57.5 2.5.5S9.44 2 11 2s2 1.5 3 1.5 1.72-.5 2.5-.5a2.5 2.5 0 0 1 0 5c-.78 0-1.5-.5-2.5-.5Z",key:"1510fo"}],["path",{d:"M5 8v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"19jb7n"}]]);/**
116 * @license lucide-react v0.462.0 - ISC
117 *
118 * This source code is licensed under the ISC license.
119 * See the LICENSE file in the root directory of this source tree.
120 */const qge=Oe("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
121 * @license lucide-react v0.462.0 - ISC
122 *
123 * This source code is licensed under the ISC license.
124 * See the LICENSE file in the root directory of this source tree.
125 */const Rk=Oe("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
126 * @license lucide-react v0.462.0 - ISC
127 *
128 * This source code is licensed under the ISC license.
129 * See the LICENSE file in the root directory of this source tree.
130 */const Vge=Oe("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
131 * @license lucide-react v0.462.0 - ISC
132 *
133 * This source code is licensed under the ISC license.
134 * See the LICENSE file in the root directory of this source tree.
135 */const y5=Oe("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}
135],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/**
136 * @license lucide-react v0.462.0 - ISC
137 *
138 * This source code is licensed under the ISC license.
139 * See the LICENSE file in the root directory of this source tree.
140 */const km=Oe("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
141 * @license lucide-react v0.462.0 - ISC
142 *
143 * This source code is licensed under the ISC license.
144 * See the LICENSE file in the root directory of this source tree.
145 */const Mk=Oe("CalendarCheck",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]]);/**
146 * @license lucide-react v0.462.0 - ISC
147 *
148 * This source code is licensed under the ISC license.
149 * See the LICENSE file in the root directory of this source tree.
150 */const UY=Oe("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
151 * @license lucide-react v0.462.0 - ISC
152 *
153 * This source code is licensed under the ISC license.
154 * See the LICENSE file in the root directory of this source tree.
155 */const x0=Oe("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/**
156 * @license lucide-react v0.462.0 - ISC
157 *
158 * This source code is licensed under the ISC license.
159 * See the LICENSE file in the root directory of this source tree.
160 */const Hge=Oe("CalendarX",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m14 14-4 4",key:"rymu2i"}],["path",{d:"m10 14 4 4",key:"3sz06r"}]]);/**
161 * @license lucide-react v0.462.0 - ISC
162 *
163 * This source code is licensed under the ISC license.
164 * See the LICENSE file in the root directory of this source tree.
165 */const Jn=Oe("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
166 * @license lucide-react v0.462.0 - ISC
167 *
168 * This source code is licensed under the ISC license.
169 * See the LICENSE file in the root directory of this source tree.
170 */const kf=Oe("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
171 * @license lucide-react v0.462.0 - ISC
172 *
173 * This source code is licensed under the ISC license.
174 * See the LICENSE file in the root directory of this source tree.
175 */const iI=Oe("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
176 * @license lucide-react v0.462.0 - ISC
177 *
178 * This source code is licensed under the ISC license.
179 * See the LICENSE file in the root directory of this source tree.
180 */const Wge=Oe("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/**
181 * @license lucide-react v0.462.0 - ISC
182 *
183 * This source code is licensed under the ISC license.
184 * See the LICENSE file in the root directory of this source tree.
185 */const is=Oe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
186 * @license lucide-react v0.462.0 - ISC
187 *
188 * This source code is licensed under the ISC license.
189 * See the LICENSE file in the root directory of this source tree.
190 */const Wa=Oe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
191 * @license lucide-react v0.462.0 - ISC
192 *
193 * This source code is licensed under the ISC license.
194 * See the LICENSE file in the root directory of this source tree.
195 */const fp=Oe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
196 * @license lucide-react v0.462.0 - ISC
197 *
198 * This source code is licensed under the ISC license.
199 * See the LICENSE file in the root directory of this source tree.
200 */const la=Oe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
201 * @license lucide-react v0.462.0 - ISC
202 *
203 * This source code is licensed under the ISC license.
204 * See the LICENSE file in the root directory of this source tree.
205 */const aI=Oe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
206 * @license lucide-react v0.462.0 - ISC
207 *
208 * This source code is licensed under the ISC license.
209 * See the LICENSE file in the root directory of this source tree.
210 */const Gge=Oe("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
211 * @license lucide-react v0.462.0 - ISC
212 *
213 * This source code is licensed under the ISC license.
214 * See the LICENSE file in the root directory of this source tree.
215 */const El=Oe("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
216 * @license lucide-react v0.462.0 - ISC
217 *
218 * This source code is licensed under the ISC license.
219 * See the LICENSE file in the root directory of this source tree.
220 */const Cn=Oe("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
221 * @license lucide-react v0.462.0 - ISC
222 *
223 * This source code is licensed under the ISC license.
224 * See the LICENSE file in the root directory of this source tree.
225 */const Jr=Oe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
226 * @license lucide-react v0.462.0 - ISC
227 *
228 * This source code is licensed under the ISC license.
229 * See the LICENSE file in the root directory of this source tree.
230 */const Lk=Oe("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
231 * @license lucide-react v0.462.0 - ISC
232 *
233 * This source code is licensed under the ISC license.
234 * See the LICENSE file in the root directory of this source tree.
235 */const Kge=Oe("CircleMinus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/**
236 * @license lucide-react v0.462.0 - ISC
237 *
238 * This source code is licensed under the ISC license.
239 * See the LICENSE file in the root directory of this source tree.
240 */const hi=Oe("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
241 * @license lucide-react v0.462.0 - ISC
242 *
243 * This source code is licensed under the ISC license.
244 * See the LICENSE file in the root directory of this source tree.
245 */const qY=Oe("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
246 * @license lucide-react v0.462.0 - ISC
247 *
248 * This source code is licensed under the ISC license.
249 * See the LICENSE file in the root directory of this source tree.
250 */const Vt=Oe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
251 * @license lucide-react v0.462.0 - ISC
252 *
253 * This source code is licensed under the ISC license.
254 * See the LICENSE file in the root directory of this source tree.
255 */const VY=Oe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
256 * @license lucide-react v0.462.0 - ISC
257 *
258 * This source code is licensed under the ISC license.
259 * See the LICENSE file in the root directory of this source tree.
260 */const eu=Oe("Coffee",[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]]);/**
261 * @license lucide-react v0.462.0 - ISC
262 *
263 * This source code is licensed under the ISC license.
264 * See the LICENSE file in the root directory of this source tree.
265 */const Yge=Oe("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
266 * @license lucide-react v0.462.0 - ISC
267 *
268 * This source code is licensed under the ISC license.
269 * See the LICENSE file in the root directory of this source tree.
270 */const Ko=Oe("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
271 * @license lucide-react v0.462.0 - ISC
272 *
273 * This source code is licensed under the ISC license.
274 * See the LICENSE file in the root directory of this source tree.
275 */const el=Oe("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
276 * @license lucide-react v0.462.0 - ISC
277 *
278 * This source code is licensed under the ISC license.
279 * See the LICENSE file in the root directory of this source tree.
280 */const sa=Oe("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
281 * @license lucide-react v0.462.0 - ISC
282 *
283 * This source code is licensed under the ISC license.
284 * See the LICENSE file in the root directory of this source tree.
285 */const Xge=Oe("Delete",[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]]);/**
286 * @license lucide-react v0.462.0 - ISC
287 *
288 * This source code is licensed under the ISC license.
289 * See the LICENSE file in the root directory of this source tree.
290 */const mc=Oe("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
291 * @license lucide-react v0.462.0 - ISC
292 *
293 * This source code is licensed under the ISC license.
294 * See the LICENSE file in the root directory of this source tree.
295 */const Qge=Oe("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
296 * @license lucide-react v0.462.0 - ISC
297 *
298 * This source code is licensed under the ISC license.
299 * See the LICENSE file in the root directory of this source tree.
300 */const Cb=Oe("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
301 * @license lucide-react v0.462.0 - ISC
302 *
303 * This source code is licensed under the ISC license.
304 * See the LICENSE file in the root directory of this source tree.
305 */const Fk=Oe("Euro",[["path",{d:"M4 10h12",key:"1y6xl8"}],["path",{d:"M4 14h9",key:"1loblj"}],["path",{d:"M19 6a7.7 7.7 0 0 0-5.2-2A7.9 7.9 0 0 0 6 12c0 4.4 3.5 8 7.8 8 2 0 3.8-.8 5.2-2",key:"1j6lzo"}]]);/**
306 * @license lucide-react v0.462.0 - ISC
307 *
308 * This source code is licensed under the ISC license.
309 * See the LICENSE file in the root directory of this source tree.
310 */const pd=Oe("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
311 * @license lucide-react v0.462.0 - ISC
312 *
313 * This source code is licensed under the ISC license.
314 * See the LICENSE file in the root directory of this source tree.
315 */const Cf=Oe("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
316 * @license lucide-react v0.462.0 - ISC
317 *
318 * This source code is licensed under the ISC license.
319 * See the LICENSE file in the root directory of this source tree.
320 */const go=Oe("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
321 * @license lucide-react v0.462.0 - ISC
322 *
323 * This source code is licensed under the ISC license.
324 * See the LICENSE file in the root directory of this source tree.
325 */const Jge=Oe("FileCheck",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);/**
326 * @license lucide-react v0.462.0 - ISC
327 *
328 * This source code is licensed under the ISC license.
329 * See the LICENSE file in the root directory of this source tree.
330 */const HY=Oe("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/**
331 * @license lucide-react v0.462.0 - ISC
332 *
333 * This source code is licensed under the ISC license.
334 * See the LICENSE file in the root directory of this source tree.
335 */const Zge=Oe("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/**
336 * @license lucide-react v0.462.0 - ISC
337 *
338 * This source code is licensed under the ISC license.
339 * See the LICENSE file in the root directory of this source tree.
340 */const WY=Oe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
341 * @license lucide-react v0.462.0 - ISC
342 *
343 * This source code is licensed under the ISC license.
344 * See the LICENSE file in the root directory of this source tree.
345 */const JS=Oe("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
346 * @license lucide-react v0.462.0 - ISC
347 *
348 * This source code is licensed under the ISC license.
349 * See the LICENSE file in the root directory of this source tree.
350 */const GY=Oe("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/**
351 * @license lucide-react v0.462.0 - ISC
352 *
353 * This source code is licensed under the ISC license.
354 * See the LICENSE file in the root directory of this source tree.
355 */const oj=Oe("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/**
356 * @license lucide-react v0.462.0 - ISC
357 *
358 * This source code is licensed under the ISC license.
359 * See the LICENSE file in the root directory of this source tree.
360 */const v5=Oe("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/**
361 * @license lucide-react v0.462.0 - ISC
362 *
363 * This source code is licensed under the ISC license.
364 * See the LICENSE file in the root directory of this source tree.
365 */const KY=Oe("Gamepad2",[["line",{x1:"6",x2:"10",y1:"11",y2:"11",key:"1gktln"}],["line",{x1:"8",x2:"8",y1:"9",y2:"13",key:"qnk9ow"}],["line",{x1:"15",x2:"15.01",y1:"12",y2:"12",key:"krot7o"}],["line",{x1:"18",x2:"18.01",y1:"10",y2:"10",key:"1lcuu1"}],["path",{d:"M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z",key:"mfqc10"}]]);/**
366 * @license lucide-react v0.462.0 - ISC
367 *
368 * This source code is licensed under the ISC license.
369 * See the LICENSE file in the root directory of this source tree.
370 */const exe=Oe("Gavel",[["path",{d:"m14.5 12.5-8 8a2.119 2.119 0 1 1-3-3l8-8",key:"15492f"}],["path",{d:"m16 16 6-6",key:"vzrcl6"}],["path",{d:"m8 8 6-6",key:"18bi4p"}],["path",{d:"m9 7 8 8",key:"5jnvq1"}],["path",{d:"m21 11-8-8",key:"z4y7zo"}]]);/**
371 * @license lucide-react v0.462.0 - ISC
372 *
373 * This source code is licensed under the ISC license.
374 * See the LICENSE file in the root directory of this source tree.
375 */const vx=Oe("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/**
376 * @license lucide-react v0.462.0 - ISC
377 *
378 * This source code is licensed under the ISC license.
379 * See the LICENSE file in the root directory of this source tree.
380 */const txe=Oe("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
381 * @license lucide-react v0.462.0 - ISC
382 *
383 * This source code is licensed under the ISC license.
384 * See the LICENSE file in the root directory of this source tree.
385 */const Fm=Oe("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
386 * @license lucide-react v0.462.0 - ISC
387 *
388 * This source code is licensed under the ISC license.
389 * See the LICENSE file in the root directory of this source tree.
390 */const b5=Oe("HeartHandshake",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M12 5 9.04 7.96a2.17 2.17 0 0 0 0 3.08c.82.82 2.13.85 3 .07l2.07-1.9a2.82 2.82 0 0 1 3.79 0l2.96 2.66",key:"4oyue0"}],["path",{d:"m18 15-2-2",key:"60u0ii"}],["path",{d:"m15 18-2-2",key:"6p76be"}]]);/**
391 * @license lucide-react v0.462.0 - ISC
392 *
393 * This source code is licensed under the ISC license.
394 * See the LICENSE file in the root directory of this source tree.
395 */const tu=Oe("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
396 * @license lucide-react v0.462.0 - ISC
397 *
398 * This source code is licensed under the ISC license.
399 * See the LICENSE file in the root directory of this source tree.
400 */const i1=Oe("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
401 * @license lucide-react v0.462.0 - ISC
402 *
403 * This source code is licensed under the ISC license.
404 * See the LICENSE file in the root directory of this source tree.
405 */const nxe=Oe("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);/**
406 * @license lucide-react v0.462.0 - ISC
407 *
408 * This source code is licensed under the ISC license.
409 * See the LICENSE file in the root directory of this source tree.
410 */const w5=Oe("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/**
411 * @license lucide-react v0.462.0 - ISC
412 *
413 * This source code is licensed under the ISC license.
414 * See the LICENSE file in the root directory of this source tree.
415 */const rxe=Oe("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
416 * @license lucide-react v0.462.0 - ISC
417 *
418 * This source code is licensed under the ISC license.
419 * See the LICENSE file in the root directory of this source tree.
420 */const sxe=Oe("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
421 * @license lucide-react v0.462.0 - ISC
422 *
423 * This source code is licensed under the ISC license.
424 * See the LICENSE file in the root directory of this source tree.
425 */const wl=Oe("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
426 * @license lucide-react v0.462.0 - ISC
427 *
428 * This source code is licensed under the ISC license.
429 * See the LICENSE file in the root directory of this source tree.
430 */const ixe=Oe("Instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]]);/**
431 * @license lucide-react v0.462.0 - ISC
432 *
433 * This source code is licensed under the ISC license.
434 * See the LICENSE file in the root directory of this source tree.
435 */const bF=Oe("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
436 * @license lucide-react v0.462.0 - ISC
437 *
438 * This source code is licensed under the ISC license.
439 * See the LICENSE file in the root directory of this source tree.
440 */const Hw=Oe("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/**
441 * @license lucide-react v0.462.0 - ISC
442 *
443 * This source code is licensed under the ISC license.
444 * See the LICENSE file in the root directory of this source tree.
445 */const _5=Oe("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
446 * @license lucide-react v0.462.0 - ISC
447 *
448 * This source code is licensed under the ISC license.
449 * See the LICENSE file in the root directory of this source tree.
450 */const axe=Oe("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
451 * @license lucide-react v0.462.0 - ISC
452 *
453 * This source code is licensed under the ISC license.
454 * See the LICENSE file in the root directory of this source tree.
455 */const i2=Oe("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
456 * @license lucide-react v0.462.0 - ISC
457 *
458 * This source code is licensed under the ISC license.
459 * See the LICENSE file in the root directory of this source tree.
460 */const YY=Oe("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
461 * @license lucide-react v0.462.0 - ISC
462 *
463 * This source code is licensed under the ISC license.
464 * See the LICENSE file in the root directory of this source tree.
465 */const oxe=Oe("Linkedin",[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]]);/**
466 * @license lucide-react v0.462.0 - ISC
467 *
468 * This source code is licensed under the ISC license.
469 * See the LICENSE file in the root directory of this source tree.
470 */const XY=Oe("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
471 * @license lucide-react v0.462.0 - ISC
472 *
473 * This source code is licensed under the ISC license.
474 * See the LICENSE file in the root directory of this source tree.
475 */const We=Oe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
476 * @license lucide-react v0.462.0 - ISC
477 *
478 * This source code is licensed under the ISC license.
479 * See the LICENSE file in the root directory of this source tree.
480 */const yo=Oe("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
481 * @license lucide-react v0.462.0 - ISC
482 *
483 * This source code is licensed under the ISC license.
484 * See the LICENSE file in the root directory of this source tree.
485 */const a1=Oe("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
486 * @license lucide-react v0.462.0 - ISC
487 *
488 * This source code is licensed under the ISC license.
489 * See the LICENSE file in the root directory of this source tree.
490 */const lxe=Oe("MailCheck",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/**
491 * @license lucide-react v0.462.0 - ISC
492 *
493 * This source code is licensed under the ISC license.
494 * See the LICENSE file in the root directory of this source tree.
495 */const wr=Oe("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
496 * @license lucide-react v0.462.0 - ISC
497 *
498 * This source code is licensed under the ISC license.
499 * See the LICENSE file in the root directory of this source tree.
500 */const gn=Oe("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
501 * @license lucide-react v0.462.0 - ISC
502 *
503 * This source code is licensed under the ISC license.
504 * See the LICENSE file in the root directory of this source tree.
505 */const cxe=Oe("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/**
506 * @license lucide-react v0.462.0 - ISC
507 *
508 * This source code is licensed under the ISC license.
509 * See the LICENSE file in the root directory of this source tree.
510 */const QY=Oe("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
511 * @license lucide-react v0.462.0 - ISC
512 *
513 * This source code is licensed under the ISC license.
514 * See the LICENSE file in the root directory of this source tree.
515 */const JY=Oe("Medal",[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]]);/**
516 * @license lucide-react v0.462.0 - ISC
517 *
518 * This source code is licensed under the ISC license.
519 * See the LICENSE file in the root directory of this source tree.
520 */const uxe=Oe("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/**
521 * @license lucide-react v0.462.0 - ISC
522 *
523 * This source code is licensed under the ISC license.
524 * See the LICENSE file in the root directory of this source tree.
525 */const ZY=Oe("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
526 * @license lucide-react v0.462.0 - ISC
527 *
528 * This source code is licensed under the ISC license.
529 * See the LICENSE file in the root directory of this source tree.
530 */const dxe=Oe("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
531 * @license lucide-react v0.462.0 - ISC
532 *
533 * This source code is licensed under the ISC license.
534 * See the LICENSE file in the root directory of this source tree.
535 */const eX=Oe("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
536 * @license lucide-react v0.462.0 - ISC
537 *
538 * This source code is licensed under the ISC license.
539 * See the LICENSE file in the root directory of this source tree.
540 */const fxe=Oe("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
541 * @license lucide-react v0.462.0 - ISC
542 *
543 * This source code is licensed under the ISC license.
544 * See the LICENSE file in the root directory of this source tree.
545 */const hxe=Oe("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
546 * @license lucide-react v0.462.0 - ISC
547 *
548 * This source code is licensed under the ISC license.
549 * See the LICENSE file in the root directory of this source tree.
550 */const Eb=Oe("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
551 * @license lucide-react v0.462.0 - ISC
552 *
553 * This source code is licensed under the ISC license.
554 * See the LICENSE file in the root directory of this source tree.
555 */const mxe=Oe("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
556 * @license lucide-react v0.462.0 - ISC
557 *
558 * This source code is licensed under the ISC license.
559 * See the LICENSE file in the root directory of this source tree.
560 */const bv=Oe("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/**
561 * @license lucide-react v0.462.0 - ISC
562 *
563 * This source code is licensed under the ISC license.
564 * See the LICENSE file in the root directory of this source tree.
565 */const pxe=Oe("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
566 * @license lucide-react v0.462.0 - ISC
567 *
568 * This source code is licensed under the ISC license.
569 * See the LICENSE file in the root directory of this source tree.
570 */const tX=Oe("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
571 * @license lucide-react v0.462.0 - ISC
572 *
573 * This source code is licensed under the ISC license.
574 * See the LICENSE file in the root directory of this source tree.
575 */const oI=Oe("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/**
576 * @license lucide-react v0.462.0 - ISC
577 *
578 * This source code is licensed under the ISC license.
579 * See the LICENSE file in the root directory of this source tree.
580 */const o1=Oe("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
581 * @license lucide-react v0.462.0 - ISC
582 *
583 * This source code is licensed under the ISC license.
584 * See the LICENSE file in the root directory of this source tree.
585 */const gxe=Oe("Percent",[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]]);/**
586 * @license lucide-react v0.462.0 - ISC
587 *
588 * This source code is licensed under the ISC license.
589 * See the LICENSE file in the root directory of this source tree.
590 */const nX=Oe("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
591 * @license lucide-react v0.462.0 - ISC
592 *
593 * This source code is licensed under the ISC license.
594 * See the LICENSE file in the root directory of this source tree.
595 */const Na=Oe("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
596 * @license lucide-react v0.462.0 - ISC
597 *
598 * This source code is licensed under the ISC license.
599 * See the LICENSE file in the root directory of this source tree.
600 */const xxe=Oe("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}
600],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
601 * @license lucide-react v0.462.0 - ISC
602 *
603 * This source code is licensed under the ISC license.
604 * See the LICENSE file in the root directory of this source tree.
605 */const qa=Oe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
606 * @license lucide-react v0.462.0 - ISC
607 *
608 * This source code is licensed under the ISC license.
609 * See the LICENSE file in the root directory of this source tree.
610 */const ZS=Oe("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/**
611 * @license lucide-react v0.462.0 - ISC
612 *
613 * This source code is licensed under the ISC license.
614 * See the LICENSE file in the root directory of this source tree.
615 */const nu=Oe("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
616 * @license lucide-react v0.462.0 - ISC
617 *
618 * This source code is licensed under the ISC license.
619 * See the LICENSE file in the root directory of this source tree.
620 */const yxe=Oe("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
621 * @license lucide-react v0.462.0 - ISC
622 *
623 * This source code is licensed under the ISC license.
624 * See the LICENSE file in the root directory of this source tree.
625 */const lI=Oe("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/**
626 * @license lucide-react v0.462.0 - ISC
627 *
628 * This source code is licensed under the ISC license.
629 * See the LICENSE file in the root directory of this source tree.
630 */const xo=Oe("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
631 * @license lucide-react v0.462.0 - ISC
632 *
633 * This source code is licensed under the ISC license.
634 * See the LICENSE file in the root directory of this source tree.
635 */const Il=Oe("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
636 * @license lucide-react v0.462.0 - ISC
637 *
638 * This source code is licensed under the ISC license.
639 * See the LICENSE file in the root directory of this source tree.
640 */const cI=Oe("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
641 * @license lucide-react v0.462.0 - ISC
642 *
643 * This source code is licensed under the ISC license.
644 * See the LICENSE file in the root directory of this source tree.
645 */const vxe=Oe("Scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);/**
646 * @license lucide-react v0.462.0 - ISC
647 *
648 * This source code is licensed under the ISC license.
649 * See the LICENSE file in the root directory of this source tree.
650 */const _o=Oe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
651 * @license lucide-react v0.462.0 - ISC
652 *
653 * This source code is licensed under the ISC license.
654 * See the LICENSE file in the root directory of this source tree.
655 */const ca=Oe("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
656 * @license lucide-react v0.462.0 - ISC
657 *
658 * This source code is licensed under the ISC license.
659 * See the LICENSE file in the root directory of this source tree.
660 */const bxe=Oe("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
661 * @license lucide-react v0.462.0 - ISC
662 *
663 * This source code is licensed under the ISC license.
664 * See the LICENSE file in the root directory of this source tree.
665 */const uI=Oe("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
666 * @license lucide-react v0.462.0 - ISC
667 *
668 * This source code is licensed under the ISC license.
669 * See the LICENSE file in the root directory of this source tree.
670 */const Cm=Oe("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
671 * @license lucide-react v0.462.0 - ISC
672 *
673 * This source code is licensed under the ISC license.
674 * See the LICENSE file in the root directory of this source tree.
675 */const dI=Oe("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
676 * @license lucide-react v0.462.0 - ISC
677 *
678 * This source code is licensed under the ISC license.
679 * See the LICENSE file in the root directory of this source tree.
680 */const nd=Oe("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
681 * @license lucide-react v0.462.0 - ISC
682 *
683 * This source code is licensed under the ISC license.
684 * See the LICENSE file in the root directory of this source tree.
685 */const wxe=Oe("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
686 * @license lucide-react v0.462.0 - ISC
687 *
688 * This source code is licensed under the ISC license.
689 * See the LICENSE file in the root directory of this source tree.
690 */const Ti=Oe("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
691 * @license lucide-react v0.462.0 - ISC
692 *
693 * This source code is licensed under the ISC license.
694 * See the LICENSE file in the root directory of this source tree.
695 */const $k=Oe("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
696 * @license lucide-react v0.462.0 - ISC
697 *
698 * This source code is licensed under the ISC license.
699 * See the LICENSE file in the root directory of this source tree.
700 */const rX=Oe("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
701 * @license lucide-react v0.462.0 - ISC
702 *
703 * This source code is licensed under the ISC license.
704 * See the LICENSE file in the root directory of this source tree.
705 */const Vi=Oe("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);/**
706 * @license lucide-react v0.462.0 - ISC
707 *
708 * This source code is licensed under the ISC license.
709 * See the LICENSE file in the root directory of this source tree.
710 */const sX=Oe("Swords",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]]);/**
711 * @license lucide-react v0.462.0 - ISC
712 *
713 * This source code is licensed under the ISC license.
714 * See the LICENSE file in the root directory of this source tree.
715 */const _xe=Oe("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
716 * @license lucide-react v0.462.0 - ISC
717 *
718 * This source code is licensed under the ISC license.
719 * See the LICENSE file in the root directory of this source tree.
720 */const iX=Oe("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
721 * @license lucide-react v0.462.0 - ISC
722 *
723 * This source code is licensed under the ISC license.
724 * See the LICENSE file in the root directory of this source tree.
725 */const jxe=Oe("TestTubeDiagonal",[["path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",key:"1ub6xw"}],["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"M12 16H4",key:"1cjfip"}]]);/**
726 * @license lucide-react v0.462.0 - ISC
727 *
728 * This source code is licensed under the ISC license.
729 * See the LICENSE file in the root directory of this source tree.
730 */const vo=Oe("Ticket",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]);/**
731 * @license lucide-react v0.462.0 - ISC
732 *
733 * This source code is licensed under the ISC license.
734 * See the LICENSE file in the root directory of this source tree.
735 */const wF=Oe("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
736 * @license lucide-react v0.462.0 - ISC
737 *
738 * This source code is licensed under the ISC license.
739 * See the LICENSE file in the root directory of this source tree.
740 */const aX=Oe("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/**
741 * @license lucide-react v0.462.0 - ISC
742 *
743 * This source code is licensed under the ISC license.
744 * See the LICENSE file in the root directory of this source tree.
745 */const oX=Oe("ToggleRight",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]);/**
746 * @license lucide-react v0.462.0 - ISC
747 *
748 * This source code is licensed under the ISC license.
749 * See the LICENSE file in the root directory of this source tree.
750 */const Nxe=Oe("TrainFront",[["path",{d:"M8 3.1V7a4 4 0 0 0 8 0V3.1",key:"1v71zp"}],["path",{d:"m9 15-1-1",key:"1yrq24"}],["path",{d:"m15 15 1-1",key:"1t0d6s"}
750],["path",{d:"M9 19c-2.8 0-5-2.2-5-5v-4a8 8 0 0 1 16 0v4c0 2.8-2.2 5-5 5Z",key:"1p0hjs"}],["path",{d:"m8 19-2 3",key:"13i0xs"}],["path",{d:"m16 19 2 3",key:"xo31yx"}]]);/**
751 * @license lucide-react v0.462.0 - ISC
752 *
753 * This source code is licensed under the ISC license.
754 * See the LICENSE file in the root directory of this source tree.
755 */const ua=Oe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
756 * @license lucide-react v0.462.0 - ISC
757 *
758 * This source code is licensed under the ISC license.
759 * See the LICENSE file in the root directory of this source tree.
760 */const kxe=Oe("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/**
761 * @license lucide-react v0.462.0 - ISC
762 *
763 * This source code is licensed under the ISC license.
764 * See the LICENSE file in the root directory of this source tree.
765 */const lu=Oe("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
766 * @license lucide-react v0.462.0 - ISC
767 *
768 * This source code is licensed under the ISC license.
769 * See the LICENSE file in the root directory of this source tree.
770 */const ur=Oe("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
771 * @license lucide-react v0.462.0 - ISC
772 *
773 * This source code is licensed under the ISC license.
774 * See the LICENSE file in the root directory of this source tree.
775 */const Xt=Oe("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
776 * @license lucide-react v0.462.0 - ISC
777 *
778 * This source code is licensed under the ISC license.
779 * See the LICENSE file in the root directory of this source tree.
780 */const _F=Oe("Unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]);/**
781 * @license lucide-react v0.462.0 - ISC
782 *
783 * This source code is licensed under the ISC license.
784 * See the LICENSE file in the root directory of this source tree.
785 */const a2=Oe("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
786 * @license lucide-react v0.462.0 - ISC
787 *
788 * This source code is licensed under the ISC license.
789 * See the LICENSE file in the root directory of this source tree.
790 */const Sb=Oe("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/**
791 * @license lucide-react v0.462.0 - ISC
792 *
793 * This source code is licensed under the ISC license.
794 * See the LICENSE file in the root directory of this source tree.
795 */const cs=Oe("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
796 * @license lucide-react v0.462.0 - ISC
797 *
798 * This source code is licensed under the ISC license.
799 * See the LICENSE file in the root directory of this source tree.
800 */const Cxe=Oe("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/**
801 * @license lucide-react v0.462.0 - ISC
802 *
803 * This source code is licensed under the ISC license.
804 * See the LICENSE file in the root directory of this source tree.
805 */const Cs=Oe("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
806 * @license lucide-react v0.462.0 - ISC
807 *
808 * This source code is licensed under the ISC license.
809 * See the LICENSE file in the root directory of this source tree.
810 */const sn=Oe("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
811 * @license lucide-react v0.462.0 - ISC
812 *
813 * This source code is licensed under the ISC license.
814 * See the LICENSE file in the root directory of this source tree.
815 */const l1=Oe("Wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);/**
816 * @license lucide-react v0.462.0 - ISC
817 *
818 * This source code is licensed under the ISC license.
819 * See the LICENSE file in the root directory of this source tree.
820 */const Exe=Oe("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
821 * @license lucide-react v0.462.0 - ISC
822 *
823 * This source code is licensed under the ISC license.
824 * See the LICENSE file in the root directory of this source tree.
825 */const j5=Oe("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}
vendor: 6,738 bytes, lines 825-835
825],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
826 * @license lucide-react v0.462.0 - ISC
827 *
828 * This source code is licensed under the ISC license.
829 * See the LICENSE file in the root directory of this source tree.
830 */const Er=Oe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
831 * @license lucide-react v0.462.0 - ISC
832 *
833 * This source code is licensed under the ISC license.
834 * See the LICENSE file in the root directory of this source tree.
835 */const gd=Oe("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),fI="-",Sxe=e=>{const t=Txe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(fI);return l[0]===""&&l.length!==1&&l.shift(),lX(l,t)||Axe(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},lX=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?lX(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const a=e.join(fI);return(o=t.validators.find(({validator:l})=>l(a)))==null?void 0:o.classGroupId},jF=/^\[(.+)\]$/,Axe=e=>{if(jF.test(e)){const t=jF.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Txe=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return Oxe(Object.entries(e.classGroups),n).forEach(([a,o])=>{N5(o,r,a,t)}),r},N5=(e,t,n,r)=>{e.forEach(i=>{if(typeof i=="string"){const a=i===""?t:NF(t,i);a.classGroupId=n;return}if(typeof i=="function"){if(Pxe(i)){N5(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([a,o])=>{N5(o,NF(t,a),n,r)})})},NF=(e,t)=>{let n=e;return t.split(fI).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Pxe=e=>e.isThemeGetter,Oxe=(e,t)=>t?e.map(([n,r])=>{const i=r.map(a=>typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([o,l])=>[t+o,l])):a);return[n,i]}):e,Dxe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const i=(a,o)=>{n.set(a,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(a){let o=n.get(a);if(o!==void 0)return o;if((o=r.get(a))!==void 0)return i(a,o),o},set(a,o){n.has(a)?n.set(a,o):i(a,o)}}},cX="!",Ixe=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],a=t.length,o=l=>{const c=[];let u=0,d=0,f;for(let b=0;b<l.length;b++){let w=l[b];if(u===0){if(w===i&&(r||l.slice(b,b+a)===t)){c.push(l.slice(d,b)),d=b+a;continue}if(w==="/"){f=b;continue}}w==="["?u++:w==="]"&&u--}const h=c.length===0?l:l.substring(d),p=h.startsWith(cX),x=p?h.substring(1):h,y=f&&f>d?f-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:x,maybePostfixModifierPosition:y}};return n?l=>n({className:l,parseClassName:o}):o},Rxe=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},Mxe=e=>({cache:Dxe(e.cacheSize),parseClassName:Ixe(e),...Sxe(e)}),Lxe=/\s+/,Fxe=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,a=[],o=e.trim().split(Lxe);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=n(u);let x=!!p,y=r(x?h.substring(0,p):h);if(!y){if(!x){l=u+(l.length>0?" "+l:l);continue}if(y=r(h),!y){l=u+(l.length>0?" "+l:l);continue}x=!1}const b=Rxe(d).join(":"),w=f?b+cX:b,_=w+y;if(a.includes(_))continue;a.push(_);const j=i(y,x);for(let E=0;E<j.length;++E){const S=j[E];a.push(w+S)}l=u+(l.length>0?" "+l:l)}return l};function $xe(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=uX(t))&&(r&&(r+=" "),r+=n);return r}const uX=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=uX(e[r]))&&(n&&(n+=" "),n+=t);return n};function Bxe(e,...t){let n,r,i,a=o;function o(c){const u=t.reduce((d,f)=>f(d),e());return n=Mxe(u),r=n.cache.get,i=n.cache.set,a=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=Fxe(c,n);return i(c,d),d}return function(){return a($xe.apply(null,arguments))}}const ns=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},dX=/^\[(?:([a-z-]+):)?(.+)\]$/i,zxe=/^\d+\/\d+$/,Uxe=new Set(["px","full","screen"]),qxe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Vxe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Hxe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Wxe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Gxe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vu=e=>zg(e)||Uxe.has(e)||zxe.test(e),Md=e=>y0(e,"length",t0e),zg=e=>!!e&&!Number.isNaN(Number(e)),eA=e=>y0(e,"number",zg),yy=e=>!!e&&Number.isInteger(Number(e)),Kxe=e=>e.endsWith("%")&&zg(e.slice(0,-1)),xn=e=>dX.test(e),Ld=e=>qxe.test(e),Yxe=new Set(["length","size","percentage"]),Xxe=e=>y0(e,Yxe,fX),Qxe=e=>y0(e,"position",fX),Jxe=new Set(["image","url"]),Zxe=e=>y0(e,Jxe,r0e),e0e=e=>y0(e,"",n0e),vy=()=>!0,y0=(e,t,n)=>{const r=dX.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},t0e=e=>Vxe.test(e)&&!Hxe.test(e),fX=()=>!1,n0e=e=>Wxe.test(e),r0e=e=>Gxe.test(e),s0e=()=>{const e=ns("colors"),t=ns("spacing"),n=ns("blur"),r=ns("brightness"),i=ns("borderColor"),a=ns("borderRadius"),o=ns("borderSpacing"),l=ns("borderWidth"),c=ns("contrast"),u=ns("grayscale"),d=ns("hueRotate"),f=ns("invert"),h=ns("gap"),p=ns("gradientColorStops"),x=ns("gradientColorStopPositions"),y=ns("inset"),b=ns("margin"),w=ns("opacity"),_=ns("padding"),j=ns("saturate"),E=ns("scale"),S=ns("sepia"),T=ns("skew"),P=ns("space"),O=ns("translate"),D=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto",xn,t],M=()=>[xn,t],B=()=>["",vu,Md],U=()=>["auto",zg,xn],F=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],H=()=>["solid","dashed","dotted","double","none"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],W=()=>["","0",xn],q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],oe=()=>[zg,xn];return{cacheSize:500,separator:":",theme:{colors:[vy],spacing:[vu,Md],blur:["none","",Ld,xn],brightness:oe(),borderColor:[e],borderRadius:["n
835one","","full",Ld,xn],borderSpacing:M(),borderWidth:B(),contrast:oe(),grayscale:W(),hueRotate:oe(),invert:W(),gap:M(),gradientColorStops:[e],gradientColorStopPositions:[Kxe,Md],inset:L(),margin:L(),opacity:oe(),padding:M(),saturate:oe(),scale:oe(),sepia:W(),skew:oe(),space:M(),translate:M()},classGroups:{aspect:[{aspect:["auto","square","video",xn]}],container:["container"],columns:[{columns:[Ld]}],"break-after":[{"break-after":q()}],"break-before":[{"break-before":q()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...F(),xn]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",yy,xn]}],basis:[{basis:L()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",xn]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",yy,xn]}],"grid-cols":[{"grid-cols":[vy]}],"col-start-end":[{col:["auto",{span:["full",yy,xn]},xn]}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":[vy]}],"row-start-end":[{row:["auto",{span:[yy,xn]},xn]}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",xn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",xn]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[_]}],px:[{px:[_]}],py:[{py:[_]}],ps:[{ps:[_]}],pe:[{pe:[_]}],pt:[{pt:[_]}],pr:[{pr:[_]}],pb:[{pb:[_]}],pl:[{pl:[_]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",xn,t]}],"min-w":[{"min-w":[xn,t,"min","max","fit"]}],"max-w":[{"max-w":[xn,t,"none","full","min","max","fit","prose",{screen:[Ld]},Ld]}],h:[{h:[xn,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[xn,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[xn,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[xn,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ld,Md]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",eA]}],"font-family":[{font:[vy]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",xn]}],"line-clamp":[{"line-clamp":["none",zg,eA]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",vu,xn]}],"list-image":[{"list-image":["none",xn]}],"list-style-type":[{list:["none","disc","decimal",xn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",vu,Md]}],"underline-offset":[{"underline-offset":["auto",vu,xn]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",xn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",xn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...F(),Qxe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Xxe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Zxe]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}
vendor: 5,183 bytes, line 835
835],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[...H(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:H()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...H()]}],"outline-offset":[{"outline-offset":[vu,xn]}],"outline-w":[{outline:[vu,Md]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[vu,Md]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ld,e0e]}],"shadow-color":[{shadow:[vy]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":[...z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Ld,xn]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[j]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[j]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",xn]}],duration:[{duration:oe()}],ease:[{ease:["linear","in","out","in-out",xn]}],delay:[{delay:oe()}],animate:[{animate:["none","spin","ping","pulse","bounce",xn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[yy,xn]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",xn]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",xn]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}
835],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",xn]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[vu,Md,eA]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},i0e=Bxe(s0e);function ae(...e){return i0e(hn(e))}function hI(e){return e.replace(/[%_\\]/g,"\\$&")}function o2(e){if(!e)return null;const t=new Date(e);if(Number.isNaN(t.getTime()))return null;const n="Europe/Paris",r=o=>new Intl.DateTimeFormat("fr-FR",{timeZone:n,year:"numeric",month:"2-digit",day:"2-digit"}).format(o),i=new Intl.DateTimeFormat("fr-FR",{timeZone:n,hour:"2-digit",minute:"2-digit"}).format(t).replace(":","h");return r(t)===r(new Date)?`aujourd'hui à ${i}`:`${new Intl.DateTimeFormat("fr-FR",{timeZone:n,weekday:"short",day:"numeric",month:"short"}).format(t)} à ${i}`}const a0e=Ige,hX=N.forwardRef(({className:e,...t},n)=>s.jsx(OY,{ref:n,className:ae("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));hX.displayName=OY.displayName;const o0e=dp("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),mX=N.forwardRef(({className:e,variant:t,...n},r)=>s.jsx(DY,{ref:r,className:ae(o0e({variant:t}),e),...n}));mX.displayName=DY.displayName;const l0e=N.forwardRef(({className:e,...t},n)=>s.jsx(MY,{ref:n,className:ae("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));l0e.displayName=MY.displayName;const pX=N.forwardRef(({className:e,...t},n)=>s.jsx(LY,{ref:n,className:ae("absolute right-2 top-2 rounded-md p-1 text-foreground
835/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:s.jsx(Er,{className:"h-4 w-4"})}));pX.displayName=LY.displayName;const gX=N.forwardRef(({className:e,...t},n)=>s.jsx(IY,{ref:n,className:ae("text-sm font-semibold",e),...t}));gX.displayName=IY.displayName;const xX=N.forwardRef(({className:e,...t},n)=>s.jsx(RY,{ref:n,className:ae("text-sm opacity-90",e),...t}));xX.displayName=RY.displayName;function c0e(){const{toasts:e}=_r();return s.jsxs(a0e,{children:[e.map(function({id:t,title:n,description:r,action:i,...a}){return s.jsxs(mX,{...a,children:[s.jsxs("div",{className:"grid gap-1",children:[n&&s.jsx(gX,{children:n}),r&&s.jsx(xX,{children:r})]}),i,s.jsx(pX,{})]},t)}),s.jsx(hX,{})]})}var kF=["light","dark"],u0e="(prefers-color-scheme: dark)",d0e=N.createContext(void 0),f0e={setTheme:e=>{},themes:[]},h0e=()=>{var e;return(e=N.useContext(d0e))!=null?e:f0e};N.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,attrs:l,nonce:c})=>{let u=a==="system",d=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(x=>`'${x}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,f=i?kF.includes(a)&&a?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${a}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",h=(x,y=!1,b=!0)=>{let w=o?o[x]:x,_=y?x+"|| ''":`'${w}'`,j="";return i&&b&&!y&&kF.includes(x)&&(j+=`d.style.colorScheme = '${x}';`),n==="class"?y||w?j+=`c.add(${_})`:j+="null":w&&(j+=`d[s](n,${_})`),j},p=e?`!function(){${d}${h(e)}}()`:r?`!function(){try{${d}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${u})){var t='${u0e}',m=window.matchMedia(t);if(m.media!==t||m.matches){${h("dark")}}else{${h("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${h(o?"x[e]":"e",!0)}}${u?"":"else{"+h(a,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${h(o?"x[e]":"e",!0)}}else{${h(a,!1,!1)};}${f}}catch(t){}}();`;return N.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:p}})});var m0e=e=>{switch(e){case"success":return x0e;case"info":return v0e;case"warning":return y0e;case"error":return b0e;default:return null}},p0e=Array(12).fill(0),g0e=({visible:e,className:t})=>ee.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ee.createElement("div",{className:"sonner-spinner"},p0e.map((n,r)=>ee.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),x0e=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),y0e=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),v0e=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),b0e=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),w0e=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ee.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ee.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),_0e=()=>{let[e,t]=ee.useState(document.hidden);return ee.useEffect(()=>{let n=()=>{t(document.hidden)};
835return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},k5=1,j0e=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,i=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:k5++,a=this.toasts.find(l=>l.id===i),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),a?this.toasts=this.toasts.map(l=>l.id===i?(this.publish({...l,...e,id:i,title:n}),{...l,...e,id:i,dismissible:o,title:n}):l):this.addToast({title:n,...r,dismissible:o,id:i}),i},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>
835this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),i=n!==void 0,a,o=r.then(async c=>{if(a=["resolve",c],ee.isValidElement(c))i=!1,this.create({id:n,type:"default",message:c});else if(k0e(c)&&!c.ok){i=!1;let u=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,d=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:n,type:"error",message:u,description:d})}else if(t.success!==void 0){i=!1;let u=typeof t.success=="function"?await t.success(c):t.success,d=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"success",message:u,description:d})}}).catch(async c=>{if(a=["reject",c],t.error!==void 0){i=!1;let u=typeof t.error=="function"?await t.error(c):t.error,d=typeof t.description=="function"?await t.description(c):t.description;this.create({id:n,type:"error",message:u,description:d})}}).finally(()=>{var c;i&&(this.dismiss(n),n=void 0),(c=t.finally)==null||c.call(t)}),l=()=>new Promise((c,u)=>o.then(()=>a[0]==="reject"?u(a[1]):c(a[1])).catch(u));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||k5++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},ao=new j0e,N0e=(e,t)=>{let n=(t==null?void 0:t.id)||k5++;return ao.addToast({title:e,...t,id:n}),n},k0e=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",C0e=N0e,E0e=()=>ao.toasts,S0e=()=>ao.getActiveToasts(),je=Object.assign(C0e,{success:ao.success,info:ao.info,warning:ao.warning,error:ao.error,custom:ao.custom,message:ao.message,promise:ao.promise,dismiss:ao.dismiss,loading:ao.loading},{getHistory:E0e,getToasts:S0e});function A0e(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}A0e(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;
835left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}
835:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);
835--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
836`);function Ww(e){return e.label!==void 0}var T0e=3,P0e="32px",O0e="16px",CF=4e3,D0e=356,I0e=14,R0e=20,M0e=200;function Hl(...e){return e.filter(Boolean).join(" ")}function L0e(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var F0e=e=>{var t,n,r,i,a,o,l,c,u,d,f;let{invert:h,toast:p,unstyled:x,interacting:y,setHeights:b,visibleToasts:w,heights:_,index:j,toasts:E,expanded:S,removeToast:T,defaultRichColors:P,closeButton:O,style:D,cancelButtonStyle:R,actionButtonStyle:L,className:M="",descriptionClassName:B="",duration:U,position:F,gap:H,loadingIcon:z,expandByDefault:K,classNames:W,icons:q,closeButtonAriaLabel:oe="Close toast",pauseWhenPageIsHidden:J}=e,[Y,Z]=ee.useState(null),[G,se]=ee.useState(null),[ce,le]=ee.useState(!1),[fe,be]=ee.useState(!1),[_e,pe]=ee.useState(!1),[Te,Ge]=ee.useState(!1),[Ne,it]=ee.useState(!1),[qe,Qe]=ee.useState(0),[ot,de]=ee.useState(0),me=ee.useRef(p.duration||U||CF),ke=ee.useRef(null),Be=ee.useRef(null),Ae=j===0,$e=j+1<=w,ge=p.type,Le=p.dismissible!==!1,Ve=p.className||"",ct=p.descriptionClassName||"",yt=ee.useMemo(()=>_.findIndex(ht=>ht.toastId===p.id)||0,[_,p.id]),nn=ee.useMemo(()=>{var ht;return(ht=p.closeButton)!=null?ht:O},[p.closeButton,O]),Vn=ee.useMemo(()=>p.duration||U||CF,[p.duration,U]),zt=ee.useRef(0),He=ee.useRef(0),bn=ee.useRef(0),Rt=ee.useRef(null),[An,gt]=F.split("-"),kn=ee.useMemo(()=>_.reduce((ht,rn,Mt)=>Mt>=yt?ht:ht+rn.height,0),[_,yt]),Tn=_0e(),Pt=p.invert||h,Jt=ge==="loading";He.current=ee.useMemo(()=>yt*H+kn,[yt,kn]),ee.useEffect(()=>{me.current=Vn},[Vn]),ee.useEffect(()=>{le(!0)},[]),ee.useEffect(()=>{let ht=Be.current;if(ht){let rn=ht.getBoundingClientRect().height;return de(rn),b(Mt=>[{toastId:p.id,height:rn,position:p.position},...Mt]),()=>b(Mt=>Mt.filter($n=>$n.toastId!==p.id))}},[b,p.id]),ee.useLayoutEffect(()=>{if(!ce)return;let ht=Be.current,rn=ht.style.height;ht.style.height="auto";let Mt=ht.getBoundingClientRect().height;ht.style.height=rn,de(Mt),b($n=>$n.find(Lr=>Lr.toastId===p.id)?$n.map(Lr=>Lr.toastId===p.id?{...Lr,height:Mt}:Lr):[{toastId:p.id,height:Mt,position:p.position},...$n])},[ce,p.title,p.description,b,p.id]);let Gn=ee.useCallback(()=>{be(!0),Qe(He.current),b(ht=>ht.filter(rn=>rn.toastId!==p.id)),setTimeout(()=>{T(p)},M0e)},[p,T,b,He]);ee.useEffect(()=>{if(p.promise&&ge==="loading"||p.duration===1/0||p.type==="loading")return;let ht;return S||y||J&&Tn?(()=>{if(bn.current<zt.current){let rn=new Date().getTime()-zt.current;me.current=me.current-rn}
836bn.current=new Date().getTime()})():me.current!==1/0&&(zt.current=new Date().getTime(),ht=setTimeout(()=>{var rn;(rn=p.onAutoClose)==null||rn.call(p,p),Gn()},me.current)),()=>clearTimeout(ht)},[S,y,p,ge,J,Tn,Gn]),ee.useEffect(()=>{p.delete&&Gn()},[Gn,p.delete]);function Mr(){var ht,rn,Mt;return q!=null&&q.loading?ee.createElement("div",{className:Hl(W==null?void 0:W.loader,(ht=p==null?void 0:p.classNames)==null?void 0:ht.loader,"sonner-loader"),"data-visible":ge==="loading"},q.loading):z?ee.createElement("div",{className:Hl(W==null?void 0:W.loader,(rn=p==null?void 0:p.classNames)==null?void 0:rn.loader,"sonner-loader"),"data-visible":ge==="loading"},z):ee.createElement(g0e,{className:Hl(W==null?void 0:W.loader,(Mt=p==null?void 0:p.classNames)==null?void 0:Mt.loader),visible:ge==="loading"})}return ee.createElement("li",{tabIndex:0,ref:Be,className:Hl(M,Ve,W==null?void 0:W.toast,(t=p==null?void 0:p.classNames)==null?void 0:t.toast,W==null?void 0:W.default,W==null?void 0:W[ge],(n=p==null?void 0:p.classNames)==null?void 0:n[ge]),"data-sonner-toast":"","data-rich-colors":(r=p.richColors)!=null?r:P,"data-styled":!(p.jsx||p.unstyled||x),"data-mounted":ce,"data-promise":!!p.promise,"data-swiped":Ne,"data-removed":fe,"data-visible":$e,"data-y-position":An,"data-x-position":gt,"data-index":j,"data-front":Ae,"data-swiping":_e,"data-dismissible":Le,"data-type":ge,"data-invert":Pt,"data-swipe-out":Te,"data-swipe-direction":G,"data-expanded":!!(S||K&&ce),style:{"--index":j,"--toasts-before":j,"--z-index":E.length-j,"--offset":`${fe?qe:He.current}px`,"--initial-height":K?"auto":`${ot}px`,...D,...p.style},onDragEnd:()=>{pe(!1),Z(null),Rt.current=null},onPointerDown:ht=>{Jt||!Le||(ke.current=new Date,Qe(He.current),ht.target.setPointerCapture(ht.pointerId),ht.target.tagName!=="BUTTON"&&(pe(!0),Rt.current={x:ht.clientX,y:ht.clientY}))},onPointerUp:()=>{var ht,rn,Mt,$n;if(Te||!Le)return;Rt.current=null;let Lr=Number(((ht=Be.current)==null?void 0:ht.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),us=Number(((rn=Be.current)==null?void 0:rn.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),nl=new Date().getTime()-((Mt=ke.current)==null?void 0:Mt.getTime()),pi=Y==="x"?Lr:us,rl=Math.abs(pi)/nl;if(Math.abs(pi)>=R0e||rl>.11){Qe(He.current),($n=p.onDismiss)==null||$n.call(p,p),se(Y==="x"?Lr>0?"right":"left":us>0?"down":"up"),Gn(),Ge(!0),it(!1);return}pe(!1),Z(null)},onPointerMove:ht=>{var rn,Mt,$n,Lr;if(!Rt.current||!Le||((rn=window.getSelection())==null?void 0:rn.toString().length)>0)return;let us=ht.clientY-Rt.current.y,nl=ht.clientX-Rt.current.x,pi=(Mt=e.swipeDirections)!=null?Mt:L0e(F);!Y&&(Math.abs(nl)>1||Math.abs(us)>1)&&Z(Math.abs(nl)>Math.abs(us)?"x":"y");let rl={x:0,y:0};Y==="y"?(pi.includes("top")||pi.includes("bottom"))&&(pi.includes("top")&&us<0||pi.includes("bottom")&&us>0)&&(rl.y=us):Y==="x"&&(pi.includes("left")||pi.includes("right"))&&(pi.includes("left")&&nl<0||pi.includes("right")&&nl>0)&&(rl.x=nl),(Math.abs(rl.x)>0||Math.abs(rl.y)>0)&&it(!0),($n=Be.current)==null||$n.style.setProperty("--swipe-amount-x",`${rl.x}px`),(Lr=Be.current)==null||Lr.style.setProperty("--swipe-amount-y",`${rl.y}px`)}},nn&&!p.jsx?ee.createElement("button",{"aria-label":oe,"data-disabled":Jt,"data-close-button":!0,onClick:Jt||!Le?()=>{}:()=>{var ht;Gn(),(ht=p.onDismiss)==null||ht.call(p,p)},className:Hl(W==null?void 0:W.closeButton,(i=p==null?void 0:p.classNames)==null?void 0:i.closeButton)},(a=q==null?void 0:q.close)!=null?a:w0e):null,p.jsx||N.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:ee.createElement(ee.Fragment,null,ge||p.icon||p.promise?ee.createElement("div",{"data-icon":"",className:Hl(W==null?void 0:W.icon,(o=p==null?void 0:p.classNames)==null?void 0:o.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||Mr():null,p.type!=="loading"?p.icon||(q==null?void 0:q[ge])||m0e(ge):null):null,ee.createElement("div",{"data-content":"",className:Hl(W==null?void 0:W.content,(l=p==null?void 0:p.classNames)==null?void 0:l.content)},ee.createElement("div",{"data-title":"",className:Hl(W==null?void 0:W.title,(c=p==null?void 0:p.classNames)==null?void 0:c.title)},typeof p.title=="function"?p.title():p.title),p.description?ee.createElement("div",{"data-description":"",className:Hl(B,ct,W==null?void 0:W.description,(u=p==null?void 0:p.classNames)==null?void 0:u.description)},typeof p.description=="function"?p.description():p.description):null),N.isValidElement(p.cancel)?p.cancel:p.cancel&&Ww(p.cancel)?ee.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||R,onClick:ht=>{var rn,Mt;Ww(p.cancel)&&Le&&((Mt=(rn=p.cancel).onClick)==null||Mt.call(rn,ht),Gn())},className:Hl(W==null?void 0:W.cancelButton,(d=p==null?void 0:p.classNames)==null?void 0:d.cancelButton)},p.cancel.label):null,N.isValidElement(p.action)?p.action:p.action&&Ww(p.action)?ee.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||L,onClick:ht=>{var rn,Mt;Ww(p.action)&&((Mt=(rn=p.action).onClick)==null||Mt.call(rn,ht),!ht.defaultPrevented&&Gn())},className:Hl(W==null?void 0:W.actionButton,(f=p==null?void 0:p.classNames)==null?void 0:f.actionButton)},p.action.label):null))};function EF(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function $0e(e,t){let n={};return[e,t].forEach((r,i)=>{let a=i===1,o=a?"--mobile-offset":"--offset",l=a?O0e:P0e;function c(u){["top","right","bottom","left"].forEach(d=>{n[`${o}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${o}-${u}`]=l:n[`${o}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):c(l)}),n}var yX=N.forwardRef(function(e,t){let{invert:n,position:r="bottom-right",hotkey:i=["altKey","KeyT"],expand:a,closeButton:o,className:l,offset:c,mobileOffset:u,theme:d="light",richColors:f,duration:h,style:p,visibleToasts:x=T0e,toastOptions:y,dir:b=EF(),gap:w=I0e,loadingIcon:_,icons:j,containerAriaLabel:E="Notifications",pauseWhenPageIsHidden:S}=e,[T,P]=ee.useState([]),O=ee.useMemo(()=>Array.from(new Set([r].concat(T.filter(J=>J.position).map(J=>J.position)))),[T,r]),[D,R]=ee.useState([]),[L,M]=ee.useState(!1),[B,U]=ee.useState(!1),[F,H]=ee.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dar
836k":"light"),z=ee.useRef(null),K=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),W=ee.useRef(null),q=ee.useRef(!1),oe=ee.useCallback(J=>{P(Y=>{var Z;return(Z=Y.find(G=>G.id===J.id))!=null&&Z.delete||ao.dismiss(J.id),Y.filter(({id:G})=>G!==J.id)})},[]);return ee.useEffect(()=>ao.subscribe(J=>{if(J.dismiss){P(Y=>Y.map(Z=>Z.id===J.id?{...Z,delete:!0}:Z));return}setTimeout(()=>{uY.flushSync(()=>{P(Y=>{let Z=Y.findIndex(G=>G.id===J.id);return Z!==-1?[...Y.slice(0,Z),{...Y[Z],...J},...Y.slice(Z+1)]:[J,...Y]})})})}),[]),ee.useEffect(()=>{if(d!=="system"){H(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?H("dark"):H("light")),typeof window>"u")return;let J=window.matchMedia("(prefers-color-scheme: dark)");try{J.addEventListener("change",({matches:Y})=>{H(Y?"dark":"light")})}catch{J.addListener(({matches:Z})=>{try{H(Z?"dark":"light")}catch(G){console.error(G)}})}},[d]),ee.useEffect(()=>{T.length<=1&&M(!1)},[T]),ee.useEffect(()=>{let J=Y=>{var Z,G;i.every(se=>Y[se]||Y.code===se)&&(M(!0),(Z=z.current)==null||Z.focus()),Y.code==="Escape"&&(document.activeElement===z.current||(G=z.current)!=null&&G.contains(document.activeElement))&&M(!1)};return document.addEventListener("keydown",J),()=>document.removeEventListener("keydown",J)},[i]),ee.useEffect(()=>{if(z.current)return()=>{W.current&&(W.current.focus({preventScroll:!0}),W.current=null,q.current=!1)}},[z.current]),ee.createElement("section",{ref:t,"aria-label":`${E} ${K}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},O.map((J,Y)=>{var Z;let[G,se]=J.split("-");return T.length?ee.createElement("ol",{key:J,dir:b==="auto"?EF():b,tabIndex:-1,ref:z,className:l,"data-sonner-toaster":!0,"data-theme":F,"data-y-position":G,"data-lifted":L&&T.length>1&&!a,"data-x-position":se,style:{"--front-toast-height":`${((Z=D[0])==null?void 0:Z.height)||0}px`,"--width":`${D0e}px`,"--gap":`${w}px`,...p,...$0e(c,u)},onBlur:ce=>{q.current&&!ce.currentTarget.contains(ce.relatedTarget)&&(q.current=!1,W.current&&(W.current.focus({preventScroll:!0}),W.current=null))},onFocus:ce=>{ce.target instanceof HTMLElement&&ce.target.dataset.dismissible==="false"||q.current||(q.current=!0,W.current=ce.relatedTarget)},onMouseEnter:()=>M(!0),onMouseMove:()=>M(!0),onMouseLeave:()=>{B||M(!1)},onDragEnd:()=>M(!1),onPointerDown:ce=>{ce.target instanceof HTMLElement&&ce.target.dataset.dismissible==="false"||U(!0)},onPointerUp:()=>U(!1)},T.filter(ce=>!ce.position&&Y===0||ce.position===J).map((ce,le)=>{var fe,be;return ee.createElement(F0e,{key:ce.id,icons:j,index:le,toast:ce,defaultRichColors:f,duration:(fe=y==null?void 0:y.duration)!=null?fe:h,className:y==null?void 0:y.className,descriptionClassName:y==null?void 0:y.descriptionClassName,invert:n,visibleToasts:x,closeButton:(be=y==null?void 0:y.closeButton)!=null?be:o,interacting:B,position:J,style:y==null?void 0:y.style,unstyled:y==null?void 0:y.unstyled,classNames:y==null?void 0:y.classNames,cancelButtonStyle:y==null?void 0:y.cancelButtonStyle,actionButtonStyle:y==null?void 0:y.actionButtonStyle,removeToast:oe,toasts:T.filter(_e=>_e.position==ce.position),heights:D.filter(_e=>_e.position==ce.position),setHeights:R,expandByDefault:a,gap:w,loadingIcon:_,expanded:L,pauseWhenPageIsHidden:S,swipeDirections:e.swipeDirections})})):null}))});const SF=Object.freeze(Object.defineProperty({__proto__:null,Toaster:yX,toast:je},Symbol.toStringTag,{value:"Module"})),B0e=({...e})=>{const{theme:t="system"}=h0e();return s.jsx(yX,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})};var z0e=oG[" useId ".trim().toString()]||(()=>{}),U0e=0;function di(e){const[t,n]=N.useState(z0e());return Bs(()=>{n(r=>r??String(U0e++))},[e]),t?`radix-${t}`:""}const q0e=["top","right","bottom","left"],If=Math.min,Mo=Math.max,l2=Math.round,Gw=Math.floor,ru=e=>({x:e,y:e}
vendor: 10,378 bytes, line 836
836),V0e={left:"right",right:"left",bottom:"top",top:"bottom"},H0e={start:"end",end:"start"};function C5(e,t,n){return Mo(e,If(t,n))}function rd(e,t){return typeof e=="function"?e(t):e}function sd(e){return e.split("-")[0]}function v0(e){return e.split("-")[1]}function mI(e){return e==="x"?"y":"x"}function pI(e){return e==="y"?"height":"width"}const W0e=new Set(["top","bottom"]);function Kc(e){return W0e.has(sd(e))?"y":"x"}function gI(e){return mI(Kc(e))}function G0e(e,t,n){n===void 0&&(n=!1);const r=v0(e),i=gI(e),a=pI(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(o=c2(o)),[o,c2(o)]}function K0e(e){const t=c2(e);return[E5(e),t,E5(t)]}function E5(e){return e.replace(/start|end/g,t=>H0e[t])}const AF=["left","right"],TF=["right","left"],Y0e=["top","bottom"],X0e=["bottom","top"];function Q0e(e,t,n){switch(e){case"top":case"bottom":return n?t?TF:AF:t?AF:TF;case"left":case"right":return t?Y0e:X0e;default:return[]}}function J0e(e,t,n,r){const i=v0(e);let a=Q0e(sd(e),n==="start",r);return i&&(a=a.map(o=>o+"-"+i),t&&(a=a.concat(a.map(E5)))),a}function c2(e){return e.replace(/left|right|bottom|top/g,t=>V0e[t])}function Z0e(e){return{top:0,right:0,bottom:0,left:0,...e}}function vX(e){return typeof e!="number"?Z0e(e):{top:e,right:e,bottom:e,left:e}}function u2(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function PF(e,t,n){let{reference:r,floating:i}=e;const a=Kc(t),o=gI(t),l=pI(o),c=sd(t),u=a==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[l]/2-i[l]/2;let p;switch(c){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(v0(t)){case"start":p[o]-=h*(n&&u?-1:1);break;case"end":p[o]+=h*(n&&u?-1:1);break}return p}const eye=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:a=[],platform:o}=n,l=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:f}=PF(u,r,c),h=r,p={},x=0;for(let y=0;y<l.length;y++){const{name:b,fn:w}=l[y],{x:_,y:j,data:E,reset:S}=await w({x:d,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:u,platform:o,elements:{reference:e,floating:t}});d=_??d,f=j??f,p={...p,[b]:{...p[b],...E}},S&&x<=50&&(x++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(u=S.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):S.rects),{x:d,y:f}=PF(u,h,c)),y=-1)}return{x:d,y:f,placement:h,strategy:i,middlewareData:p}};async function c1(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:a,rects:o,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=rd(t,e),x=vX(p),b=l[h?f==="floating"?"reference":"floating":f],w=u2(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(b)))==null||n?b:b.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),_=f==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,j=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),E=await(a.isElement==null?void 0:a.isElement(j))?await(a.getScale==null?void 0:a.getScale(j))||{x:1,y:1}:{x:1,y:1},S=u2(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:_,offsetParent:j,strategy:c}):_);return{top:(w.top-S.top+x.top)/E.y,bottom:(S.bottom-w.bottom+x.bottom)/E.y,left:(w.left-S.left+x.left)/E.x,right:(S.right-w.right+x.right)/E.x}}const tye=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:a,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=rd(e,t)||{};if(u==null)return{};const f=vX(d),h={x:n,y:r},p=gI(i),x=pI(p),y=await o.getDimensions(u),b=p==="y",w=b?"top":"left",_=b?"bottom":"right",j=b?"clientHeight":"clientWidth",E=a.reference[x]+a.reference[p]-h[p]-a.floating[x],S=h[p]-a.reference[p],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let P=T?T[j]:0;(!P||!await(o.isElement==null?void 0:o.isElement(T)))&&(P=l.floating[j]||a.floating[x]);const O=E/2-S/2,D=P/2-y[x]/2-1,R=If(f[w],D),L=If(f[_],D),M=R,B=P-y[x]-L,U=P/2-y[x]/2+O,F=C5(M,U,B),H=!c.arrow&&v0(i)!=null&&U!==F&&a.reference[x]/2-(U<M?R:L)-y[x]/2<0,z=H?U<M?U-M:U-B:0;return{[p]:h[p]+z,data:{[p]:F,centerOffset:U-F-z,...H&&{alignmentOffset:z}},reset:H}}}),nye=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:a,rects:o,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:y=!0,...b}=rd(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const w=sd(i),_=Kc(l),j=sd(l)===l,E=await(c.isRTL==null?void 0:c.isRTL(u.floating)),S=h||(j||!y?[c2(l)]:K0e(l)),T=x!=="none";!h&&T&&S.push(...J0e(l,y,x,E));const P=[l,...S],O=await c1(t,b),D=[];let R=((r=a.flip)==null?void 0:r.overflows)||[];if(d&&D.push(O[w]),f){const U=G0e(i,o,E);D.push(O[U[0]],O[U[1]])}if(R=[...R,{placement:i,overflows:D}],!D.every(U=>U<=0)){var L,M;const U=(((L=a.flip)==null?void 0:L.index)||0)+1,F=P[U];if(F&&(!(f==="alignment"?_!==Kc(F):!1)||R.every(K=>K.overflows[0]>0&&Kc(K.placement)===_)))return{data:{index:U,overflows:R},reset:{placement:F}};let H=(M=R.filter(z=>z.overflows[0]<=0).sort((z,K)=>z.overflows[1]-K.overflows[1])[0])==null?void 0:M.placement;if(!H)switch(p){case"bestFit":{var B;const z=(B=R.filter(K=>{if(T){const W=Kc(K.placement);return W===_||W==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(W=>W>0).reduce((W,q)=>W+q,0)]).sort((K,W)=>K[1]-W[1])[0])==null?void 0:B[0];z&&(H=z);break}case"initialPlacement":H=l;break}if(i!==H)return{reset:{placement:H}}}return{}}}};function OF(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function DF(e){return q0e.some(t=>e[t]>=0)}const rye=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=rd(e,t);switch(r){case"referenceHidden":{const a=await c1(t,{...i,elementContext:"reference"}),o=OF(a,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:DF(o)}}}case"escaped":{const a=await c1(t,{...i,altBoundary:!0}),o=OF(a,n.floating);return{data:{escapedOffsets:o,escaped:DF(o)}}}default:return{}}}}},bX=new Set(["left","top"]);async function sye(e,t){const{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=sd(n),l=v0(n),c=Kc(n)==="y",u=bX.has(o)?-1:1,d=a&&c?-1:1,f=rd(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:x}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof x=="number"&&(p=l==="end"?x*-1:x),c?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const iye=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:a,placement:o,middlewareData:l}=t,c=await sye(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:a+c.y,data:{...c,placement:o}}}}},aye=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:b=>{let{x:w,y:_}=b;return{x:w,y:_}}},...c}=rd(e,t),u={x:n,y:r},d=await c1(t,c),f=Kc(sd(i)),h=mI(f);let p=u[h],x=u[f];if(a){const b=h==="y"?"top":"left",w=h==="y"?"bottom":"right",_=p+d[b],j=p-d[w];p=C5(_,p,j)}if(o){const b=f==="y"?"top":"left",w=f==="y"?"bottom":"right",_=x+d[b],j=x-d[w];x=C5(_,x,j)}const y=l.fn({...t,[h]:p,[f]:x});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:a,[f]:o}}}}}},oye=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=rd(e,t),d={x:n,y:r},f=Kc(i),h=mI(f);let p=d[h],x=d[f];const y=rd(l,t),b=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(c){const j=h==="y"?"height":"width",E=a.reference[h]-a.floating[j]+b.mainAxis,S=a.reference[h]+a.reference[j]-b.mainAxis;p<E?p=E:p>S&&(p=S)}if(u){var w,_;const j=h==="y"?"width":"height",E=bX.has(sd(i)),S=a.reference[f]-a.floating[j]+(E&&((w=o.offset)==null?void 0:w[f])||0)+(E?0:b.crossAxis),T=a.reference[f]+a.reference[j]+(E?0:((_=o.offset)==null?void 0:_[f])||0)-(E?b.crossAxis:0);x<S?x=S:x>T&&(x=T)}return{[h]:p,[f]:x}}}},lye=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:a,platform:o,elements:l}=t,{apply:c=()=>{},...u}=rd(e,t),d=await c1(t,u),f=sd(i),h=v0(i),p=Kc(i)==="y",{width:x,height:y}=a.floating;let b,w;f==="top"||f==="bottom"?(b=f,w=h===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(w=f,b=h==="end"?"top":"bottom");const _=y-d.top-d.bottom,j=x-d.left-d.right,E=If(y-d[b],_),S=If(x-d[w],j),T=!t.middlewareData.shift;let P=E,O=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=j),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=_),T&&!h){const R=Mo(d.left,0),L=Mo(d.right,0),M=Mo(d.top,0),B=Mo(d.bottom,0);p?O=x-2*(R!==0||L!==0?R+L:Mo(d.left,d.right)):P=y-2*(M!==0||B!==0?M+B:Mo(d.top,d.bottom))}await c({...t,availableWidth:O,availableHeight:P});const D=await o.getDimensions(l.floating);return x!==D.width||y!==D.height?{reset:{rects:!0}}:{}}}};function Bk(){return typeof window<"u"}function b0(e){return wX(e)?(e.nodeName||"").toLowerCase():"#document"}function qo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mu(e){var t;return(t=(wX(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function wX(e){return Bk()?e instanceof Node||e instanceof qo(e).Node:!1}function xc(e){return Bk()?e instanceof Element||e instanceof qo(e).Element:!1}function cu(e){return Bk()?e instanceof HTMLElement||e instanceof qo(e).HTMLElement:!1}function IF(e){return!Bk()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof qo(e).ShadowRoot}const cye=new Set(["inline","contents"]);function Ab(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=yc(e);
vendor: 4,143 bytes, line 836
836return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!cye.has(i)}const uye=new Set(["table","td","th"]);function dye(e){return uye.has(b0(e))}const fye=[":popover-open",":modal"];function zk(e){return fye.some(t=>{try{return e.matches(t)}catch{return!1}})}const hye=["transform","translate","scale","rotate","perspective"],mye=["transform","translate","scale","rotate","perspective","filter"],pye=["paint","layout","strict","content"];function xI(e){const t=yI(),n=xc(e)?yc(e):e;return hye.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||mye.some(r=>(n.willChange||"").includes(r))||pye.some(r=>(n.contain||"").includes(r))}function gye(e){let t=Rf(e);for(;cu(t)&&!bx(t);){if(xI(t))return t;if(zk(t))return null;t=Rf(t)}return null}function yI(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const xye=new Set(["html","body","#document"]);function bx(e){return xye.has(b0(e))}function yc(e){return qo(e).getComputedStyle(e)}function Uk(e){return xc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Rf(e){if(b0(e)==="html")return e;const t=e.assignedSlot||e.parentNode||IF(e)&&e.host||mu(e);return IF(t)?t.host:t}function _X(e){const t=Rf(e);return bx(t)?e.ownerDocument?e.ownerDocument.body:e.body:cu(t)&&Ab(t)?t:_X(t)}function u1(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=_X(e),a=i===((r=e.ownerDocument)==null?void 0:r.body),o=qo(i);if(a){const l=S5(o);return t.concat(o,o.visualViewport||[],Ab(i)?i:[],l&&n?u1(l):[])}return t.concat(i,u1(i,[],n))}function S5(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function jX(e){const t=yc(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=cu(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,l=l2(n)!==a||l2(r)!==o;return l&&(n=a,r=o),{width:n,height:r,$:l}}function vI(e){return xc(e)?e:e.contextElement}function Ug(e){const t=vI(e);if(!cu(t))return ru(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:a}=jX(t);let o=(a?l2(n.width):n.width)/r,l=(a?l2(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const yye=ru(0);function NX(e){const t=qo(e);return!yI()||!t.visualViewport?yye:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function vye(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==qo(e)?!1:t}function $m(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),a=vI(e);let o=ru(1);t&&(r?xc(r)&&(o=Ug(r)):o=Ug(e));const l=vye(a,n,r)?NX(a):ru(0);let c=(i.left+l.x)/o.x,u=(i.top+l.y)/o.y,d=i.width/o.x,f=i.height/o.y;if(a){const h=qo(a),p=r&&xc(r)?qo(r):r;let x=h,y=S5(x);for(;y&&r&&p!==x;){const b=Ug(y),w=y.getBoundingClientRect(),_=yc(y),j=w.left+(y.clientLeft+parseFloat(_.paddingLeft))*b.x,E=w.top+(y.clientTop+parseFloat(_.paddingTop))*b.y;c*=b.x,u*=b.y,d*=b.x,f*=b.y,c+=j,u+=E,x=qo(y),y=S5(x)}}return u2({width:d,height:f,x:c,y:u})}function bI(e,t){const n=Uk(e).scrollLeft;return t?t.left+n:$m(mu(e)).left+n}function kX(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-(n?0:bI(e,r)),a=r.top+t.scrollTop;return{x:i,y:a}}function bye(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const a=i==="fixed",o=mu(r),l=t?zk(t.floating):!1;if(r===o||l&&a)return n;let c={scrollLeft:0,scrollTop:0},u=ru(1);const d=ru(0),f=cu(r);if((f||!f&&!a)&&((b0(r)!=="body"||Ab(o))&&(c=Uk(r)),cu(r))){const p=$m(r);u=Ug(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const h=o&&!f&&!a?kX(o,c,!0):ru(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+h.x,y:n.y*u.y-c.scrollTop*u.y+d.y+h.y}}function wye(e){return Array.from(e.getClientRects())}function _ye(e){const t=mu(e),n=Uk(e),r=e.ownerDocument.body,i=Mo(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Mo(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+bI(e);const l=-n.scrollTop;return yc(r).direction==="rtl"&&(o+=Mo(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:l}}
vendor: 4,617 bytes, line 836
836function jye(e,t){const n=qo(e),r=mu(e),i=n.visualViewport;let a=r.clientWidth,o=r.clientHeight,l=0,c=0;if(i){a=i.width,o=i.height;const u=yI();(!u||u&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}return{width:a,height:o,x:l,y:c}}const Nye=new Set(["absolute","fixed"]);function kye(e,t){const n=$m(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=cu(e)?Ug(e):ru(1),o=e.clientWidth*a.x,l=e.clientHeight*a.y,c=i*a.x,u=r*a.y;return{width:o,height:l,x:c,y:u}}function RF(e,t,n){let r;if(t==="viewport")r=jye(e,n);else if(t==="document")r=_ye(mu(e));else if(xc(t))r=kye(t,n);else{const i=NX(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return u2(r)}function CX(e,t){const n=Rf(e);return n===t||!xc(n)||bx(n)?!1:yc(n).position==="fixed"||CX(n,t)}function Cye(e,t){const n=t.get(e);if(n)return n;let r=u1(e,[],!1).filter(l=>xc(l)&&b0(l)!=="body"),i=null;const a=yc(e).position==="fixed";let o=a?Rf(e):e;for(;xc(o)&&!bx(o);){const l=yc(o),c=xI(o);!c&&l.position==="fixed"&&(i=null),(a?!c&&!i:!c&&l.position==="static"&&!!i&&Nye.has(i.position)||Ab(o)&&!c&&CX(e,o))?r=r.filter(d=>d!==o):i=l,o=Rf(o)}return t.set(e,r),r}function Eye(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?zk(t)?[]:Cye(t,this._c):[].concat(n),r],l=o[0],c=o.reduce((u,d)=>{const f=RF(t,d,i);return u.top=Mo(f.top,u.top),u.right=If(f.right,u.right),u.bottom=If(f.bottom,u.bottom),u.left=Mo(f.left,u.left),u},RF(t,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Sye(e){const{width:t,height:n}=jX(e);return{width:t,height:n}}function Aye(e,t,n){const r=cu(t),i=mu(t),a=n==="fixed",o=$m(e,!0,a,t);let l={scrollLeft:0,scrollTop:0};const c=ru(0);function u(){c.x=bI(i)}if(r||!r&&!a)if((b0(t)!=="body"||Ab(i))&&(l=Uk(t)),r){const p=$m(t,!0,a,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else i&&u();a&&!r&&i&&u();const d=i&&!r&&!a?kX(i,l):ru(0),f=o.left+l.scrollLeft-c.x-d.x,h=o.top+l.scrollTop-c.y-d.y;return{x:f,y:h,width:o.width,height:o.height}}function tA(e){return yc(e).position==="static"}function MF(e,t){if(!cu(e)||yc(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return mu(e)===n&&(n=n.ownerDocument.body),n}function EX(e,t){const n=qo(e);if(zk(e))return n;if(!cu(e)){let i=Rf(e);for(;i&&!bx(i);){if(xc(i)&&!tA(i))return i;i=Rf(i)}return n}let r=MF(e,t);for(;r&&dye(r)&&tA(r);)r=MF(r,t);return r&&bx(r)&&tA(r)&&!xI(r)?n:r||gye(e)||n}const Tye=async function(e){const t=this.getOffsetParent||EX,n=this.getDimensions,r=await n(e.floating);return{reference:Aye(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Pye(e){return yc(e).direction==="rtl"}const Oye={convertOffsetParentRelativeRectToViewportRelativeRect:bye,getDocumentElement:mu,getClippingRect:Eye,getOffsetParent:EX,getElementRects:Tye,getClientRects:wye,getDimensions:Sye,getScale:Ug,isElement:xc,isRTL:Pye};function SX(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Dye(e,t){let n=null,r;const i=mu(e);function a(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),a();const u=e.getBoundingClientRect(),{left:d,top:f,width:h,height:p}=u;if(l||t(),!h||!p)return;const x=Gw(f),y=Gw(i.clientWidth-(d+h)),b=Gw(i.clientHeight-(f+p)),w=Gw(d),j={rootMargin:-x+"px "+-y+"px "+-b+"px "+-w+"px",threshold:Mo(0,If(1,c))||1};let E=!0;function S(T){const P=T[0].intersectionRatio;if(P!==c){if(!E)return o();P?o(!1,P):r=setTimeout(()=>{o(!1,1e-7)},1e3)}P===1&&!SX(u,e.getBoundingClientRect())&&o(),E=!1}try{n=new IntersectionObserver(S,{...j,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,j)}n.observe(e)}return o(!0),a}function Iye(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=vI(e),d=i||a?[...u?u1(u):[],...u1(t)]:[];d.forEach(w=>{i&&w.addEventListener("scroll",n,{passive:!0}),a&&w.addEventListener("resize",n)});const f=u&&l?Dye(u,n):null;let h=-1,p=null;o&&(p=new ResizeObserver(w=>{let[_]=w;_&&_.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var j;(j=p)==null||j.observe(t)})),n()}),u&&!c&&p.observe(u),p.observe(t));let x,y=c?$m(e):null;c&&b();function b(){const w=$m(e);y&&!SX(y,w)&&n(),y=w,x=requestAnimationFrame(b)}return n(),()=>{var w;d.forEach(_=>{i&&_.removeEventListener("scroll",n),a&&_.removeEventListener("resize",n)}),f==null||f(),(w=p)==null||w.disconnect(),p=null,c&&cancelAnimationFrame(x)}}
vendor: 3,533 bytes, line 836
836const Rye=iye,Mye=aye,Lye=nye,Fye=lye,$ye=rye,LF=tye,Bye=oye,zye=(e,t,n)=>{const r=new Map,i={platform:Oye,...n},a={...i.platform,_c:r};return eye(e,t,{...i,platform:a})};var Uye=typeof document<"u",qye=function(){},lj=Uye?N.useLayoutEffect:qye;function d2(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!d2(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const a=i[r];if(!(a==="_owner"&&e.$$typeof)&&!d2(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function AX(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function FF(e,t){const n=AX(e);return Math.round(t*n)/n}function nA(e){const t=N.useRef(e);return lj(()=>{t.current=e}),t}function Vye(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=N.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=N.useState(r);d2(h,r)||p(r);const[x,y]=N.useState(null),[b,w]=N.useState(null),_=N.useCallback(K=>{K!==T.current&&(T.current=K,y(K))},[]),j=N.useCallback(K=>{K!==P.current&&(P.current=K,w(K))},[]),E=a||x,S=o||b,T=N.useRef(null),P=N.useRef(null),O=N.useRef(d),D=c!=null,R=nA(c),L=nA(i),M=nA(u),B=N.useCallback(()=>{if(!T.current||!P.current)return;const K={placement:t,strategy:n,middleware:h};L.current&&(K.platform=L.current),zye(T.current,P.current,K).then(W=>{const q={...W,isPositioned:M.current!==!1};U.current&&!d2(O.current,q)&&(O.current=q,Yf.flushSync(()=>{f(q)}))})},[h,t,n,L,M]);lj(()=>{u===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,f(K=>({...K,isPositioned:!1})))},[u]);const U=N.useRef(!1);lj(()=>(U.current=!0,()=>{U.current=!1}),[]),lj(()=>{if(E&&(T.current=E),S&&(P.current=S),E&&S){if(R.current)return R.current(E,S,B);B()}},[E,S,B,R,D]);const F=N.useMemo(()=>({reference:T,floating:P,setReference:_,setFloating:j}),[_,j]),H=N.useMemo(()=>({reference:E,floating:S}),[E,S]),z=N.useMemo(()=>{const K={position:n,left:0,top:0};if(!H.floating)return K;const W=FF(H.floating,d.x),q=FF(H.floating,d.y);return l?{...K,transform:"translate("+W+"px, "+q+"px)",...AX(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:q}},[n,l,H.floating,d.x,d.y]);return N.useMemo(()=>({...d,update:B,refs:F,elements:H,floatingStyles:z}),[d,B,F,H,z])}const Hye=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?LF({element:r.current,padding:i}).fn(n):{}:r?LF({element:r,padding:i}).fn(n):{}}}},Wye=(e,t)=>({...Rye(e),options:[e,t]}),Gye=(e,t)=>({...Mye(e),options:[e,t]}),Kye=(e,t)=>({...Bye(e),options:[e,t]}),Yye=(e,t)=>({...Lye(e),options:[e,t]}),Xye=(e,t)=>({...Fye(e),options:[e,t]}),Qye=(e,t)=>({...$ye(e),options:[e,t]}),Jye=(e,t)=>({...Hye(e),options:[e,t]});var Zye="Arrow",TX=N.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...a}=e;return s.jsx(ut.svg,{...a,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});TX.displayName=Zye;var eve=TX;function qk(e){const[t,n]=N.useState(void 0);return Bs(()=>
vendor: 5,145 bytes, line 836
836{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const a=i[0];let o,l;if("borderBoxSize"in a){const c=a.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var wI="Popper",[PX,Xf]=Us(wI),[tve,OX]=PX(wI),DX=e=>{const{__scopePopper:t,children:n}=e,[r,i]=N.useState(null);return s.jsx(tve,{scope:t,anchor:r,onAnchorChange:i,children:n})};DX.displayName=wI;var IX="PopperAnchor",RX=N.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,a=OX(IX,n),o=N.useRef(null),l=Qt(t,o);return N.useEffect(()=>{a.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:s.jsx(ut.div,{...i,ref:l})});RX.displayName=IX;var _I="PopperContent",[nve,rve]=PX(_I),MX=N.forwardRef((e,t)=>{var ce,le,fe,be,_e,pe;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:a="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:x,...y}=e,b=OX(_I,n),[w,_]=N.useState(null),j=Qt(t,Te=>_(Te)),[E,S]=N.useState(null),T=qk(E),P=(T==null?void 0:T.width)??0,O=(T==null?void 0:T.height)??0,D=r+(a!=="center"?"-"+a:""),R=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},L=Array.isArray(u)?u:[u],M=L.length>0,B={padding:R,boundary:L.filter(ive),altBoundary:M},{refs:U,floatingStyles:F,placement:H,isPositioned:z,middlewareData:K}=Vye({strategy:"fixed",placement:D,whileElementsMounted:(...Te)=>Iye(...Te,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[Wye({mainAxis:i+O,alignmentAxis:o}),c&&Gye({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?Kye():void 0,...B}),c&&Yye({...B}),Xye({...B,apply:({elements:Te,rects:Ge,availableWidth:Ne,availableHeight:it})=>{const{width:qe,height:Qe}=Ge.reference,ot=Te.floating.style;ot.setProperty("--radix-popper-available-width",`${Ne}px`),ot.setProperty("--radix-popper-available-height",`${it}px`),ot.setProperty("--radix-popper-anchor-width",`${qe}px`),ot.setProperty("--radix-popper-anchor-height",`${Qe}px`)}}),E&&Jye({element:E,padding:l}),ave({arrowWidth:P,arrowHeight:O}),h&&Qye({strategy:"referenceHidden",...B})]}),[W,q]=$X(H),oe=Ms(x);Bs(()=>{z&&(oe==null||oe())},[z,oe]);const J=(ce=K.arrow)==null?void 0:ce.x,Y=(le=K.arrow)==null?void 0:le.y,Z=((fe=K.arrow)==null?void 0:fe.centerOffset)!==0,[G,se]=N.useState();return Bs(()=>{w&&se(window.getComputedStyle(w).zIndex)},[w]),s.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:z?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:G,"--radix-popper-transform-origin":[(be=K.transformOrigin)==null?void 0:be.x,(_e=K.transformOrigin)==null?void 0:_e.y].join(" "),...((pe=K.hide)==null?void 0:pe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(nve,{scope:n,placedSide:W,onArrowChange:S,arrowX:J,arrowY:Y,shouldHideArrow:Z,children:s.jsx(ut.div,{"data-side":W,"data-align":q,...y,ref:j,style:{...y.style,animation:z?void 0:"none"}})})})});MX.displayName=_I;var LX="PopperArrow",sve={top:"bottom",right:"left",bottom:"top",left:"right"},FX=N.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,a=rve(LX,r),o=sve[a.placedSide];return s.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:s.jsx(eve,{...i,ref:n,style:{...i.style,display:"block"}})})});FX.displayName=LX;function ive(e){return e!==null}var ave=e=>({name:"transformOrigin",options:e,fn(t){var b,w,_;const{placement:n,rects:r,middlewareData:i}=t,o=((b=i.arrow)==null?void 0:b.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=$X(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((w=i.arrow)==null?void 0:w.x)??0)+l/2,p=(((_=i.arrow)==null?void 0:_.y)??0)+c/2;let x="",y="";return u==="bottom"?(x=o?f:`${h}px`,y=`${-c}px`):u==="top"?(x=o?f:`${h}px`,y=`${r.floating.height+c}px`):u==="right"?(x=`${-c}px`,y=o?f:`${p}px`):u==="left"&&(x=`${r.floating.width+c}px`,y=o?f:`${p}px`),{data:{x,y}}}});function $X(e){const[t,n="center"]=e.split("-");return[t,n]}var Vk=DX,Tb=RX,Hk=MX,Wk=FX,[Gk]=Us("Tooltip",[Xf]),Kk=Xf(),BX="TooltipProvider",ove=700,A5="tooltip.open",[lve,jI]=Gk(BX),zX=e=>{const{__scopeTooltip:t,delayDuration:n=ove,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=N.useRef(!0),l=N.useRef(!1),c=N.useRef(0);return N.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),s.jsx(lve,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:N.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:N.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>
vendor: 5,070 bytes, line 836
836o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:N.useCallback(u=>{l.current=u},[]),disableHoverableContent:i,children:a})};zX.displayName=BX;var d1="Tooltip",[cve,Yk]=Gk(d1),UX=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:l}=e,c=jI(d1,e.__scopeTooltip),u=Kk(t),[d,f]=N.useState(null),h=di(),p=N.useRef(0),x=o??c.disableHoverableContent,y=l??c.delayDuration,b=N.useRef(!1),[w,_]=Hi({prop:r,defaultProp:i??!1,onChange:P=>{P?(c.onOpen(),document.dispatchEvent(new CustomEvent(A5))):c.onClose(),a==null||a(P)},caller:d1}),j=N.useMemo(()=>w?b.current?"delayed-open":"instant-open":"closed",[w]),E=N.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b.current=!1,_(!0)},[_]),S=N.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),T=N.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{b.current=!0,_(!0),p.current=0},y)},[y,_]);return N.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),s.jsx(Vk,{...u,children:s.jsx(cve,{scope:t,contentId:h,open:w,stateAttribute:j,trigger:d,onTriggerChange:f,onTriggerEnter:N.useCallback(()=>{c.isOpenDelayedRef.current?T():E()},[c.isOpenDelayedRef,T,E]),onTriggerLeave:N.useCallback(()=>{x?S():(window.clearTimeout(p.current),p.current=0)},[S,x]),onOpen:E,onClose:S,disableHoverableContent:x,children:n})})};UX.displayName=d1;var T5="TooltipTrigger",qX=N.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Yk(T5,n),a=jI(T5,n),o=Kk(n),l=N.useRef(null),c=Qt(t,l,i.onTriggerChange),u=N.useRef(!1),d=N.useRef(!1),f=N.useCallback(()=>u.current=!1,[]);return N.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),s.jsx(Tb,{asChild:!0,...o,children:s.jsx(ut.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:Je(e.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:Je(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:Je(e.onPointerDown,()=>{i.open&&i.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Je(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:Je(e.onBlur,i.onClose),onClick:Je(e.onClick,i.onClose)})})});qX.displayName=T5;var uve="TooltipPortal",[Ewt,dve]=Gk(uve,{forceMount:void 0}),wx="TooltipContent",VX=N.forwardRef((e,t)=>{const n=dve(wx,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...a}=e,o=Yk(wx,e.__scopeTooltip);return s.jsx(mi,{present:r||o.open,children:o.disableHoverableContent?s.jsx(HX,{side:i,...a,ref:t}):s.jsx(fve,{side:i,...a,ref:t})})}),fve=N.forwardRef((e,t)=>{const n=Yk(wx,e.__scopeTooltip),r=jI(wx,e.__scopeTooltip),i=N.useRef(null),a=Qt(t,i),[o,l]=N.useState(null),{trigger:c,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,h=N.useCallback(()=>{l(null),f(!1)},[f]),p=N.useCallback((x,y)=>{const b=x.currentTarget,w={x:x.clientX,y:x.clientY},_=xve(w,b.getBoundingClientRect()),j=yve(w,_),E=vve(y.getBoundingClientRect()),S=wve([...j,...E]);l(S),f(!0)},[f]);return N.useEffect(()=>()=>h(),[h]),N.useEffect(()=>{if(c&&d){const x=b=>p(b,d),y=b=>p(b,c);return c.addEventListener("pointerleave",x),d.addEventListener("pointerleave",y),()=>{c.removeEventListener("pointerleave",x),d.removeEventListener("pointerleave",y)}}},[c,d,p,h]),N.useEffect(()=>{if(o){const x=y=>{const b=y.target,w={x:y.clientX,y:y.clientY},_=(c==null?void 0:c.contains(b))||(d==null?void 0:d.contains(b)),j=!bve(w,o);_?h():j&&(h(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,d,o,u,h]),s.jsx(HX,{...e,ref:a})}),[hve,mve]=Gk(d1,{isInside:!1}),pve=mY("TooltipContent"),HX=N.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...l}=e,c=Yk(wx,n),u=Kk(n),{onClose:d}=c;return N.useEffect(()=>(document.addEventListener(A5,d),()=>document.removeEventListener(A5,d)),[d]),N.useEffect(()=>{if(c.trigger){const f=h=>{const p=h.target;p!=null&&p.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),s.jsx(up,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:s.jsxs(Hk,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[s.jsx(pve,{children:r}),s.jsx(hve,{scope:n,isInside:!0,children:s.jsx(gge,{id:c.contentId,role:"tooltip",children:i||r})})]})})});VX.displayName=wx;var WX="TooltipArrow",gve=N.forwardRef((e,t)=>
836{const{__scopeTooltip:n,...r}=e,i=Kk(n);return mve(WX,n).isInside?null:s.jsx(Wk,{...i,...r,ref:t})});gve.displayName=WX;function xve(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function yve(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function vve(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function bve(e,t){const{x:n,y:r}=e;let i=!1;for(let a=0,o=t.length-1;a<t.length;o=a++){const l=t[a],c=t[o],u=l.x,d=l.y,f=c.x,h=c.y;d>r!=h>r&&n<(f-u)*(r-d)/(h-d)+u&&(i=!i)}return i}function wve(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),_ve(t)}function _ve(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const a=t[t.length-1],o=t[t.length-2];if((a.x-o.x)*(i.y-o.y)>=(a.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const a=n[n.length-1],o=n[n.length-2];if((a.x-o.x)*(i.y-o.y)>=(a.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var jve=zX,Nve=UX,kve=qX,GX=VX;const Xk=jve,Qk=Nve,Jk=kve,Pb=N.forwardRef(({className:e,sideOffset:t=4,...n},r)=>s.jsx(GX,{ref:r,sideOffset:t,className:ae("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));Pb.displayName=GX.displayName;var w0=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Cve={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},nf,aD,BW,Eve=(BW=class{constructor(){$t(this,nf,Cve);$t(this,aD,!1)}setTimeoutProvider(e){mt(this,nf,e)}setTimeout(e,t){return xe(this,nf).setTimeout(e,t)}clearTimeout(e){xe(this,nf).clearTimeout(e)}setInterval(e,t){return xe(this,nf).setInterval(e,t)}clearInterval(e){xe(this,nf).clearInterval(e)}},nf=new WeakMap,aD=new WeakMap,BW),Zh=new Eve;function Sve(e){setTimeout(e,0)}var Bm=typeof window>"u"||"Deno"in globalThis;function Da(){}function Ave(e,t){return typeof e=="function"?e(t):e}function P5(e){return typeof e=="number"&&e>=0&&e!==1/0}function KX(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ef(e,t){return typeof e=="function"?e(t):e}function hl(e,t){return typeof e=="function"?e(t):e}function $F(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==NI(o,t.options))return!1}else if(!f1(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||i&&i!==t.state.fetchStatus||a&&!a(t))}function BF(e,t){const{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(zm(t.options.mutationKey)!==zm(a))return!1}else if(!f1(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function NI(e,t){return((t==null?void 0:t.queryKeyHashFn)||zm)(e)}function zm(e){return JSON.stringify(e,(t,n)=>O5(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function f1(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>f1(e[n],t[n])):!1}var Tve=Object.prototype.hasOwnProperty;function YX(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=zF(e)&&zF(t);if(!r&&!(O5(e)&&O5(t)))return t;const a=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),l=o.length,c=r?new Array(l):{};let u=0;for(let d=0;d<l;d++){const f=r?d:o[d],h=e[f],p=t[f];if(h===p){c[f]=h,(r?d<a:Tve.call(e,f))&&u++;continue}if(h===null||p===null||typeof h!="object"||typeof p!="object"){c[f]=p;continue}const x=YX(h,p,n+1);c[f]=x,x===h&&u++}return a===l&&u===a?e:c}function f2(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function zF(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function O5(e){if(!UF(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!UF(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function UF(e){return Object.prototype.toString.call(e)==="[object Object]"}function Pve(e){return new Promise(t=>{Zh.setTimeout(t,e)})}function D5(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?YX(e,t):t}function hp(e){return e}function Ove(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Dve(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var kI=Symbol();function XX(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===kI?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function CI(e,t){return typeof e=="function"?e(...t):!!e}function Ive(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),e}var mm,rf,ex,zW,Rve=(zW=class extends w0{constructor(){super();$t(this,mm);$t(this,rf);$t(this,ex);mt(this,ex,t=>{if(!Bm&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){xe(this,rf)||this.setEventListener(xe(this,ex))}onUnsubscribe(){var t;this.hasListeners()||((t=xe(this,rf))==null||t.call(this),mt(this,rf,void 0))}setEventListener(t){var n;mt(this,ex,t),(n=xe(this,rf))==null||n.call(this),mt(this,rf,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){xe(this,mm)!==t&&(mt(this,mm,t),this.onFocus())}onFocus(){const t=this.isFocused();
vendor: 5,036 bytes, line 836
836this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof xe(this,mm)=="boolean"?xe(this,mm):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},mm=new WeakMap,rf=new WeakMap,ex=new WeakMap,zW),EI=new Rve;function I5(){let e,t;const n=new Promise((i,a)=>{e=i,t=a});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}var Mve=Sve;function Lve(){let e=[],t=0,n=l=>{l()},r=l=>{l()},i=Mve;const a=l=>{t?e.push(l):i(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&i(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{a(()=>{l(...c)})},schedule:a,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{i=l}}}var Ci=Lve(),tx,sf,nx,UW,Fve=(UW=class extends w0{constructor(){super();$t(this,tx,!0);$t(this,sf);$t(this,nx);mt(this,nx,t=>{if(!Bm&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){xe(this,sf)||this.setEventListener(xe(this,nx))}onUnsubscribe(){var t;this.hasListeners()||((t=xe(this,sf))==null||t.call(this),mt(this,sf,void 0))}setEventListener(t){var n;mt(this,nx,t),(n=xe(this,sf))==null||n.call(this),mt(this,sf,t(this.setOnline.bind(this)))}setOnline(t){xe(this,tx)!==t&&(mt(this,tx,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return xe(this,tx)}},tx=new WeakMap,sf=new WeakMap,nx=new WeakMap,UW),h2=new Fve;function $ve(e){return Math.min(1e3*2**e,3e4)}function QX(e){return(e??"online")==="online"?h2.isOnline():!0}var R5=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function JX(e){let t=!1,n=0,r;const i=I5(),a=()=>i.status!=="pending",o=y=>{var b;if(!a()){const w=new R5(y);h(w),(b=e.onCancel)==null||b.call(e,w)}},l=()=>{t=!0},c=()=>{t=!1},u=()=>EI.isFocused()&&(e.networkMode==="always"||h2.isOnline())&&e.canRun(),d=()=>QX(e.networkMode)&&e.canRun(),f=y=>{a()||(r==null||r(),i.resolve(y))},h=y=>{a()||(r==null||r(),i.reject(y))},p=()=>new Promise(y=>{var b;r=w=>{(a()||u())&&y(w)},(b=e.onPause)==null||b.call(e)}).then(()=>{var y;r=void 0,a()||(y=e.onContinue)==null||y.call(e)}),x=()=>{if(a())return;let y;const b=n===0?e.initialPromise:void 0;try{y=b??e.fn()}catch(w){y=Promise.reject(w)}Promise.resolve(y).then(f).catch(w=>{var T;if(a())return;const _=e.retry??(Bm?0:3),j=e.retryDelay??$ve,E=typeof j=="function"?j(n,w):j,S=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,w);if(t||!S){h(w);return}n++,(T=e.onFail)==null||T.call(e,n,w),Pve(E).then(()=>u()?void 0:p()).then(()=>{t?h(w):x()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?x():p().then(x),i)}}var pm,qW,ZX=(qW=class{constructor(){$t(this,pm)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),P5(this.gcTime)&&mt(this,pm,Zh.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Bm?1/0:5*60*1e3))}clearGcTimeout(){xe(this,pm)&&(Zh.clearTimeout(xe(this,pm)),mt(this,pm,void 0))}},pm=new WeakMap,qW),gm,rx,fl,xm,Mi,mb,ym,ec,ju,VW,Bve=(VW=class extends ZX{constructor(t){super();$t(this,ec);$t(this,gm);$t(this,rx);$t(this,fl);$t(this,xm);$t(this,Mi);$t(this,mb);$t(this,ym);mt(this,ym,!1),mt(this,mb,t.defaultOptions),this.setOptions(t.options),this.observers=[],mt(this,xm,t.client),mt(this,fl,xe(this,xm).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,mt(this,gm,VF(this.options)),this.state=t.state??xe(this,gm),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=xe(this,Mi))==null?void 0:t.promise}setOptions(t){if(this.options={...xe(this,mb),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=VF(this.options);n.data!==void 0&&(this.setState(qF(n.data,n.dataUpdatedAt)),mt(this,gm,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&xe(this,fl).remove(this)}setData(t,n){const r=D5(this.state.data,t,this.options);return _n(this,ec,ju).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){_n(this,ec,ju).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=xe(this,Mi))==null?void 0:r.promise;return(i=xe(this,Mi))==null||i.cancel(t),n?n.then(Da).catch(Da):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(xe(this,gm))}isActive(){return this.observers.some(t=>hl(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===kI||this.state.dataUpdateCount+this.state.errorUpdate
836Count===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ef(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!KX(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=xe(this,Mi))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=xe(this,Mi))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),xe(this,fl).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(xe(this,Mi)&&(xe(this,ym)?xe(this,Mi).cancel({revert:!0}):xe(this,Mi).cancelRetry()),this.scheduleGc()),xe(this,fl).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_n(this,ec,ju).call(this,{type:"invalidate"})}async fetch(t,n){var c,u,d,f,h,p,x,y,b,w,_,j;if(this.state.fetchStatus!=="idle"&&((c=xe(this,Mi))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(xe(this,Mi))return xe(this,Mi).continueRetry(),xe(this,Mi).promise}if(t&&this.setOptions(t),!this.options.queryFn){const E=this.observers.find(S=>S.options.queryFn);E&&this.setOptions(E.options)}const r=new AbortController,i=E=>{Object.defineProperty(E,"signal",{enumerable:!0,get:()=>(mt(this,ym,!0),r.signal)})},a=()=>{const E=XX(this.options,n),T=(()=>{const P={client:xe(this,xm),queryKey:this.queryKey,meta:this.meta};return i(P),P})();return mt(this,ym,!1),this.options.persister?this.options.persister(E,T,this):E(T)},l=(()=>{const E={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:xe(this,xm),state:this.state,fetchFn:a};return i(E),E})();(u=this.options.behavior)==null||u.onFetch(l,this),mt(this,rx,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=l.fetchOptions)==null?void 0:d.meta))&&_n(this,ec,ju).call(this,{type:"fetch",meta:(f=l.fetchOptions)==null?void 0:f.meta}),mt(this,Mi,JX({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,onCancel:E=>{E instanceof R5&&E.revert&&this.setState({...xe(this,rx),fetchStatus:"idle"}),r.abort()},onFail:(E,S)=>{_n(this,ec,ju).call(this,{type:"failed",failureCount:E,error:S})},onPause:()=>{_n(this,ec,ju).call(this,{type:"pause"})},onContinue:()=>{_n(this,ec,ju).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const E=await xe(this,Mi).start();if(E===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(E),(p=(h=xe(this,fl).config).onSuccess)==null||p.call(h,E,this),(y=(x=xe(this,fl).config).onSettled)==null||y.call(x,E,this.state.error,this),E}catch(E){if(E instanceof R5){if(E.silent)return xe(this,Mi).promise;if(E.revert){if(this.state.data===void 0)throw E;return this.state.data}}throw _n(this,ec,ju).call(this,{type:"error",error:E}),(w=(b=xe(this,fl).config).onError)==null||w.call(b,E,this),(j=(_=xe(this,fl).config).onSettled)==null||j.call(_,this.state.data,E,this),E}finally{this.scheduleGc()}}},gm=new WeakMap,rx=new WeakMap,fl=new WeakMap,xm=new WeakMap,Mi=new WeakMap,mb=new WeakMap,ym=new WeakMap,ec=new WeakSet,ju=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...eQ(r.data,this.options),fetchMeta:t.meta??null};case"success":const i={...r,...qF(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return mt(this,rx,t.manual?i:void 0),i;case"error":const a=t.error;
vendor: 4,276 bytes, line 836
836return{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Ci.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),xe(this,fl).notify({query:this,type:"updated",action:t})})},VW);function eQ(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:QX(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function qF(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function VF(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var ro,zn,pb,Ta,vm,sx,Au,af,gb,ix,ax,bm,wm,of,ox,br,tv,M5,L5,F5,$5,B5,z5,U5,nQ,HW,tQ=(HW=class extends w0{constructor(t,n){super();$t(this,br);$t(this,ro);$t(this,zn);$t(this,pb);$t(this,Ta);$t(this,vm);$t(this,sx);$t(this,Au);$t(this,af);$t(this,gb);$t(this,ix);$t(this,ax);$t(this,bm);$t(this,wm);$t(this,of);$t(this,ox,new Set);this.options=n,mt(this,ro,t),mt(this,af,null),mt(this,Au,I5()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(xe(this,zn).addObserver(this),HF(xe(this,zn),this.options)?_n(this,br,tv).call(this):this.updateResult(),_n(this,br,$5).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return q5(xe(this,zn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return q5(xe(this,zn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_n(this,br,B5).call(this),_n(this,br,z5).call(this),xe(this,zn).removeObserver(this)}setOptions(t){const n=this.options,r=xe(this,zn);if(this.options=xe(this,ro).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof hl(this.options.enabled,xe(this,zn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_n(this,br,U5).call(this),xe(this,zn).setOptions(this.options),n._defaulted&&!f2(this.options,n)&&xe(this,ro).getQueryCache().notify({type:"observerOptionsUpdated",query:xe(this,zn),observer:this});const i=this.hasListeners();i&&WF(xe(this,zn),r,this.options,n)&&_n(this,br,tv).call(this),this.updateResult(),i&&(xe(this,zn)!==r||hl(this.options.enabled,xe(this,zn))!==hl(n.enabled,xe(this,zn))||Ef(this.options.staleTime,xe(this,zn))!==Ef(n.staleTime,xe(this,zn)))&&_n(this,br,M5).call(this);const a=_n(this,br,L5).call(this);i&&(xe(this,zn)!==r||hl(this.options.enabled,xe(this,zn))!==hl(n.enabled,xe(this,zn))||a!==xe(this,of))&&_n(this,br,F5).call(this,a)}getOptimisticResult(t){const n=xe(this,ro).getQueryCache().build(xe(this,ro),t),r=this.createResult(n,t);return Uve(this,r)&&(mt(this,Ta,r),mt(this,sx,this.options),mt(this,vm,xe(this,zn).state)),r}getCurrentResult(){return xe(this,Ta)}trackResult(t,n){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&xe(this,Au).status==="pending"&&xe(this,Au).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(t){xe(this,ox).add(t)}getCurrentQuery(){return xe(this,zn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=xe(this,ro).defaultQueryOptions(t),r=xe(this,ro).getQueryCache().build(xe(this,ro),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return _n(this,br,tv).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),xe(this,Ta)))}createResult(t,n){var D;const r=xe(this,zn),i=this.options,a=xe(this,Ta),o=xe(this,vm),l=xe(this,sx),u=t!==r?t.state:xe(this,pb),{state:d}=t;let f={...d},h=!1,p;
836if(n._optimisticResults){const R=this.hasListeners(),L=!R&&HF(t,n),M=R&&WF(t,r,n,i);(L||M)&&(f={...f,...eQ(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:x,errorUpdatedAt:y,status:b}=f;p=f.data;let w=!1;if(n.placeholderData!==void 0&&p===void 0&&b==="pending"){let R;a!=null&&a.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(R=a.data,w=!0):R=typeof n.placeholderData=="function"?n.placeholderData((D=xe(this,ax))==null?void 0:D.state.data,xe(this,ax)):n.placeholderData,R!==void 0&&(b="success",p=D5(a==null?void 0:a.data,R,n),h=!0)}if(n.select&&p!==void 0&&!w)if(a&&p===(o==null?void 0:o.data)&&n.select===xe(this,gb))p=xe(this,ix);else try{mt(this,gb,n.select),p=n.select(p),p=D5(a==null?void 0:a.data,p,n),mt(this,ix,p),mt(this,af,null)}catch(R){mt(this,af,R)}xe(this,af)&&(x=xe(this,af),p=xe(this,ix),y=Date.now(),b="error");const _=f.fetchStatus==="fetching",j=b==="pending",E=b==="error",S=j&&_,T=p!==void 0,O={status:b,fetchStatus:f.fetchStatus,isPending:j,isSuccess:b==="success",isError:E,isInitialLoading:S,isLoading:S,data:p,dataUpdatedAt:f.dataUpdatedAt,error:x,errorUpdatedAt:y,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:_,isRefetching:_&&!j,isLoadingError:E&&!T,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:E&&T,isStale:SI(t,n),refetch:this.refetch,promise:xe(this,Au),isEnabled:hl(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=O.data!==void 0,L=O.status==="error"&&!R,M=F=>{L?F.reject(O.error):R&&F.resolve(O.data)},B=()=>{const F=mt(this,Au,O.promise=I5());M(F)},U=xe(this,Au);switch(U.status){case"pending":t.queryHash===r.queryHash&&M(U);break;case"fulfilled":(L||O.data!==U.value)&&B();break;case"rejected":(!L||O.error!==U.reason)&&B();break}}return O}updateResult(){const t=xe(this,Ta),n=this.createResult(xe(this,zn),this.options);if(mt(this,vm,xe(this,zn).state),mt(this,sx,this.options),xe(this,vm).data!==void 0&&mt(this,ax,xe(this,zn)),f2(n,t))return;mt(this,Ta,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,a=typeof i=="function"?i():i;if(a==="all"||!a&&!xe(this,ox).size)return!0;const o=new Set(a??xe(this,ox));return this.options.throwOnError&&o.add("error"),Object.keys(xe(this,Ta)).some(l=>{const c=l;return xe(this,Ta)[c]!==t[c]&&o.has(c)})};_n(this,br,nQ).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_n(this,br,$5).call(this)}},ro=new WeakMap,zn=new WeakMap,pb=new WeakMap,Ta=new WeakMap,vm=new WeakMap,sx=new WeakMap,Au=new WeakMap,af=new WeakMap,gb=new WeakMap,ix=new WeakMap,ax=new WeakMap,bm=new WeakMap,wm=new WeakMap,of=new WeakMap,ox=new WeakMap,br=new WeakSet,tv=function(t){_n(this,br,U5).call(this);let n=xe(this,zn).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Da)),n},M5=function(){_n(this,br,B5).call(this);const t=Ef(this.options.staleTime,xe(this,zn));if(Bm||xe(this,Ta).isStale||!P5(t))return;const r=KX(xe(this,Ta).dataUpdatedAt,t)+1;mt(this,bm,Zh.setTimeout(()=>{xe(this,Ta).isStale||this.updateResult()},r))},L5=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(xe(this,zn)):this.options.refetchInterval)??!1},F5=function(t){_n(this,br,z5).call(this),mt(this,of,t),!(Bm||hl(this.options.enabled,xe(this,zn))===!1||!P5(xe(this,of))||xe(this,of)===0)&&mt(this,wm,Zh.setInterval(()=>{(this.options.refetchIntervalInBackground||EI.isFocused())&&_n(this,br,tv).call(this)},xe(this,of)))},$5=function(){_n(this,br,M5).call(this),_n(this,br,F5).call(this,_n(this,br,L5).call(this))},B5=function(){xe(this,bm)&&(Zh.clearTimeout(xe(this,bm)),mt(this,bm,void 0))},z5=function(){xe(this,wm)&&(Zh.clearInterval(xe(this,wm)),mt(this,wm,void 0))},U5=function(){const t=xe(this,ro).getQueryCache().build(xe(this,ro),this.options);if(t===xe(this,zn))return;const n=xe(this,zn);mt(this,zn,t),mt(this,pb,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},nQ=function(t){Ci.batch(()=>
836{t.listeners&&this.listeners.forEach(n=>{n(xe(this,Ta))}),xe(this,ro).getQueryCache().notify({query:xe(this,zn),type:"observerResultsUpdated"})})},HW);function zve(e,t){return hl(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function HF(e,t){return zve(e,t)||e.state.data!==void 0&&q5(e,t,t.refetchOnMount)}function q5(e,t,n){if(hl(t.enabled,e)!==!1&&Ef(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&SI(e,t)}return!1}function WF(e,t,n,r){return(e!==t||hl(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&SI(e,n)}function SI(e,t){return hl(t.enabled,e)!==!1&&e.isStaleByTime(Ef(t.staleTime,e))}function Uve(e,t){return!f2(e.getCurrentResult(),t)}function m2(e){return{onFetch:(t,n)=>{var d,f,h,p,x;const r=t.options,i=(h=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,a=((p=t.state.data)==null?void 0:p.pages)||[],o=((x=t.state.data)==null?void 0:x.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let y=!1;const b=j=>{Ive(j,()=>t.signal,()=>y=!0)},w=XX(t.options,t.fetchOptions),_=async(j,E,S)=>{if(y)return Promise.reject();if(E==null&&j.pages.length)return Promise.resolve(j);const P=(()=>{const L={client:t.client,queryKey:t.queryKey,pageParam:E,direction:S?"backward":"forward",meta:t.options.meta};return b(L),L})(),O=await w(P),{maxPages:D}=t.options,R=S?Dve:Ove;return{pages:R(j.pages,O,D),pageParams:R(j.pageParams,E,D)}};if(i&&a.length){const j=i==="backward",E=j?rQ:V5,S={pages:a,pageParams:o},T=E(r,S);l=await _(S,T,j)}else{const j=e??a.length;do{const E=c===0?o[0]??r.initialPageParam:V5(r,l);if(c>0&&E==null)break;l=await _(l,E),c++}while(c<j)}return l};t.options.persister?t.fetchFn=()=>{var y,b;return(b=(y=t.options).persister)==null?void 0:b.call(y,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function V5(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function rQ(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}function qve(e,t){return t?V5(e,t)!=null:!1}function Vve(e,t){return!t||!e.getPreviousPageParam?!1:rQ(e,t)!=null}var Hve=class extends tQ{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:m2()})}getOptimisticResult(e){return e.behavior=m2(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var x,y;const{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:l}=r,c=(y=(x=n.fetchMeta)==null?void 0:x.fetchMore)==null?void 0:y.direction,u=o&&c==="forward",d=i&&c==="forward",f=o&&c==="backward",h=i&&c==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:qve(t,n.data),hasPreviousPage:Vve(t,n.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:h,isRefetchError:l&&!u&&!f,isRefetching:a&&!d&&!h}}},xb,Mc,ga,_m,Lc,Ud,WW,Wve=(WW=class extends ZX{constructor(t){super();$t(this,Lc);$t(this,xb);$t(this,Mc);$t(this,ga);$t(this,_m);mt(this,xb,t.client),this.mutationId=t.mutationId,mt(this,ga,t.mutationCache),mt(this,Mc,[]),this.state=t.state||sQ(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){xe(this,Mc).includes(t)||(xe(this,Mc).push(t),this.clearGcTimeout(),xe(this,ga).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){mt(this,Mc,xe(this,Mc).filter(n=>n!==t)),this.scheduleGc(),xe(this,ga).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){xe(this,Mc).length||(this.state.status==="pending"?this.scheduleGc():xe(this,ga).remove(this))}continue(){var t;return((t=xe(this,_m))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,c,u,d,f,h,p,x,y,b,w,_,j,E,S,T,P;const n=()=>{_n(this,Lc,Ud).call(this,{type:"continue"})},r={client:xe(this,xb),meta:this.options.meta,mutationKey:this.options.mutationKey};mt(this,_m,JX({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(O,D)=>{_n(this,Lc,Ud).call(this,{type:"failed",failureCount:O,error:D})},onPause:()=>{_n(this,Lc,Ud).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>xe(this,ga).canRun(this)}));const i=this.state.status==="pending",a=!xe(this,_m).canStart();try{if(i)n();else{_n(this,Lc,Ud).call(this,{type:"pending",variables:t,isPaused:a}),xe(this,ga).config.onMutate&&await xe(this,ga).config.onMutate(t,this,r);
836const D=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t,r));D!==this.state.context&&_n(this,Lc,Ud).call(this,{type:"pending",context:D,variables:t,isPaused:a})}const O=await xe(this,_m).start();return await((u=(c=xe(this,ga).config).onSuccess)==null?void 0:u.call(c,O,t,this.state.context,this,r)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,O,t,this.state.context,r)),await((p=(h=xe(this,ga).config).onSettled)==null?void 0:p.call(h,O,null,this.state.variables,this.state.context,this,r)),await((y=(x=this.options).onSettled)==null?void 0:y.call(x,O,null,t,this.state.context,r)),_n(this,Lc,Ud).call(this,{type:"success",data:O}),O}catch(O){try{await((w=(b=xe(this,ga).config).onError)==null?void 0:w.call(b,O,t,this.state.context,this,r))}catch(D){Promise.reject(D)}try{await((j=(_=this.options).onError)==null?void 0:j.call(_,O,t,this.state.context,r))}catch(D){Promise.reject(D)}try{await((S=(E=xe(this,ga).config).onSettled)==null?void 0:S.call(E,void 0,O,this.state.variables,this.state.context,this,r))}catch(D){Promise.reject(D)}try{await((P=(T=this.options).onSettled)==null?void 0:P.call(T,void 0,O,t,this.state.context,r))}catch(D){Promise.reject(D)}throw _n(this,Lc,Ud).call(this,{type:"error",error:O}),O}finally{xe(this,ga).runNext(this)}}},xb=new WeakMap,Mc=new WeakMap,ga=new WeakMap,_m=new WeakMap,Lc=new WeakSet,Ud=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Ci.batch(()=>{xe(this,Mc).forEach(r=>{r.onMutationUpdate(t)}),xe(this,ga).notify({mutation:this,type:"updated",action:t})})},WW);function sQ(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Tu,tc,yb,GW,Gve=(GW=class extends w0{constructor(t={}){super();$t(this,Tu);$t(this,tc);$t(this,yb);this.config=t,mt(this,Tu,new Set),mt(this,tc,new Map),mt(this,yb,0)}build(t,n,r){const i=new Wve({client:t,mutationCache:this,mutationId:++kw(this,yb)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){xe(this,Tu).add(t);const n=Kw(t);if(typeof n=="string"){const r=xe(this,tc).get(n);r?r.push(t):xe(this,tc).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(xe(this,Tu).delete(t)){const n=Kw(t);if(typeof n=="string"){const r=xe(this,tc).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&xe(this,tc).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Kw(t);if(typeof n=="string"){const r=xe(this,tc).get(n),i=r==null?void 0:r.find(a=>a.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=Kw(t);if(typeof n=="string"){const i=(r=xe(this,tc).get(n))==null?void 0:r.find(a=>a!==t&&a.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ci.batch(()=>{xe(this,Tu).forEach(t=>{this.notify({type:"removed",mutation:t})}),xe(this,Tu).clear(),xe(this,tc).clear()})}getAll(){return Array.from(xe(this,Tu))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>BF(n,r))}findAll(t={}){return this.getAll().filter(n=>BF(t,n))}notify(t){Ci.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ci.batch(()=>Promise.all(t.map(n=>n.continue().catch(Da))))}},Tu=new WeakMap,tc=new WeakMap,yb=new WeakMap,GW);function Kw(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Pu,lf,so,Ou,Xu,cj,H5,KW,Kve=(KW=class extends w0{constructor(n,r){super();$t(this,Xu);$t(this,Pu);$t(this,lf);$t(this,so);$t(this,Ou);mt(this,Pu,n),this.setOptions(r),this.bindMethods(),_n(this,Xu,cj).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const r=this.options;this.options=xe(this,Pu).defaultMutationOptions(n),f2(this.options,r)||xe(this,Pu).getMutationCache().notify({type:"observerOptionsUpdated",mutation:xe(this,so),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&zm(r.mutationKey)!==zm(this.options.mutationKey)?this.reset():((i=xe(this,so))==null?void 0:i.state.status)==="pending"&&xe(this,so).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=xe(this,so))==null||n.removeObserver(this)}onMutationUpdate(n){_n(this,Xu,cj).call(this),_n(this,Xu,H5).call(this,n)}getCurrentResult(){return xe(this,lf)}reset(){var n;(n=xe(this,so))==null||n.removeObserver(this),mt(this,so,void 0),_n(this,Xu,cj).call(this),_n(this,Xu,H5).call(this)}mutate(n,r){var i;return mt(this,Ou,r),(i=xe(this,so))==null||i.removeObserver(this),mt(this,so,xe(this,Pu).getMutationCache().build(xe(this,Pu),this.options)),xe(this,so).addObserver(this),xe(this,so).execute(n)}},Pu=new WeakMap,lf=new WeakMap,so=new WeakMap,Ou=new WeakMap,Xu=new WeakSet,cj=function(){var r;const n=((r=xe(this,so))==null?void 0:r.state)??sQ();mt(this,lf,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},H5=function(n){Ci.batch(()=>{var r,i,a,o,l,c,u,d;if(xe(this,Ou)&&this.hasListeners()){const f=xe(this,lf).variables,h=xe(this,lf).
vendor: 6,258 bytes, line 836
836context,p={client:xe(this,Pu),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(i=(r=xe(this,Ou)).onSuccess)==null||i.call(r,n.data,f,h,p)}catch(x){Promise.reject(x)}try{(o=(a=xe(this,Ou)).onSettled)==null||o.call(a,n.data,null,f,h,p)}catch(x){Promise.reject(x)}}else if((n==null?void 0:n.type)==="error"){try{(c=(l=xe(this,Ou)).onError)==null||c.call(l,n.error,f,h,p)}catch(x){Promise.reject(x)}try{(d=(u=xe(this,Ou)).onSettled)==null||d.call(u,void 0,n.error,f,h,p)}catch(x){Promise.reject(x)}}}this.listeners.forEach(f=>{f(xe(this,lf))})})},KW),Fc,YW,Yve=(YW=class extends w0{constructor(t={}){super();$t(this,Fc);this.config=t,mt(this,Fc,new Map)}build(t,n,r){const i=n.queryKey,a=n.queryHash??NI(i,n);let o=this.get(a);return o||(o=new Bve({client:t,queryKey:i,queryHash:a,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(o)),o}add(t){xe(this,Fc).has(t.queryHash)||(xe(this,Fc).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=xe(this,Fc).get(t.queryHash);n&&(t.destroy(),n===t&&xe(this,Fc).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ci.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return xe(this,Fc).get(t)}getAll(){return[...xe(this,Fc).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>$F(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>$F(t,r)):n}notify(t){Ci.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ci.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ci.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Fc=new WeakMap,YW),Ts,cf,uf,lx,cx,df,ux,dx,XW,Xve=(XW=class{constructor(e={}){$t(this,Ts);$t(this,cf);$t(this,uf);$t(this,lx);$t(this,cx);$t(this,df);$t(this,ux);$t(this,dx);mt(this,Ts,e.queryCache||new Yve),mt(this,cf,e.mutationCache||new Gve),mt(this,uf,e.defaultOptions||{}),mt(this,lx,new Map),mt(this,cx,new Map),mt(this,df,0)}mount(){kw(this,df)._++,xe(this,df)===1&&(mt(this,ux,EI.subscribe(async e=>{e&&(await this.resumePausedMutations(),xe(this,Ts).onFocus())})),mt(this,dx,h2.subscribe(async e=>{e&&(await this.resumePausedMutations(),xe(this,Ts).onOnline())})))}unmount(){var e,t;kw(this,df)._--,xe(this,df)===0&&((e=xe(this,ux))==null||e.call(this),mt(this,ux,void 0),(t=xe(this,dx))==null||t.call(this),mt(this,dx,void 0))}isFetching(e){return xe(this,Ts).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return xe(this,cf).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=xe(this,Ts).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=xe(this,Ts).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ef(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return xe(this,Ts).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=xe(this,Ts).get(r.queryHash),a=i==null?void 0:i.state.data,o=Ave(t,a);if(o!==void 0)return xe(this,Ts).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Ci.batch(()=>xe(this,Ts).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=xe(this,Ts).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=xe(this,Ts);Ci.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=xe(this,Ts);return Ci.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ci.batch(()=>xe(this,Ts).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(Da).catch(Da)}invalidateQueries(e,t={}){return Ci.batch(()=>(xe(this,Ts).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Ci.batch(()=>xe(this,Ts).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let a=i.fetch(void 0,n);return n.throwOnError||(a=a.catch(Da)),i.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(Da)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=xe(this,Ts).build(this,t);return n.isStaleByTime(Ef(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Da).catch(Da)}fetchInfiniteQuery(e){return e.behavior=m2(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Da).catch(Da)}ensureInfiniteQueryData(e){return e.behavior=m2(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return h2.isOnline()?xe(this,cf).resumePausedMutations():Promise.resolve()}getQueryCache(){return xe(this,Ts)}getMutationCache(){return xe(this,cf)}getDefaultOptions(){return xe(this,uf)}setDefaultOptions(e){mt(this,uf,e)}setQueryDefaults(e,t){xe(this,lx).set(zm(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...xe(this,lx).values()],n={};return t.forEach(r=>{f1(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){xe(this,cx).set(zm(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...xe(this,cx).values()],n={};return t.forEach(r=>{f1(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...xe(this,uf).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=NI(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===kI&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...xe(this,uf).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){xe(this,Ts).clear(),xe(this,cf).clear()}}
836,Ts=new WeakMap,cf=new WeakMap,uf=new WeakMap,lx=new WeakMap,cx=new WeakMap,df=new WeakMap,ux=new WeakMap,dx=new WeakMap,XW),iQ=N.createContext(void 0),Ye=e=>{const t=N.useContext(iQ);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Qve=({client:e,children:t})=>(N.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),s.jsx(iQ.Provider,{value:e,children:t})),aQ=N.createContext(!1),Jve=()=>N.useContext(aQ);aQ.Provider;function Zve(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var e1e=N.createContext(Zve()),t1e=()=>N.useContext(e1e),n1e=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?CI(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},r1e=e=>{N.useEffect(()=>{e.clearReset()},[e])},s1e=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||CI(n,[e.error,r])),i1e=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},a1e=(e,t)=>e.isLoading&&e.isFetching&&!t,o1e=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,GF=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function oQ(e,t,n){var h,p,x,y;const r=Jve(),i=t1e(),a=Ye(),o=a.defaultQueryOptions(e);(p=(h=a.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||p.call(h,o);const l=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",i1e(o),n1e(o,i,l),r1e(i);const c=!a.getQueryCache().get(o.queryHash),[u]=N.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&e.subscribed!==!1;if(N.useSyncExternalStore(N.useCallback(b=>{const w=f?u.subscribe(Ci.batchCalls(b)):Da;return u.updateResult(),w},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),N.useEffect(()=>{u.setOptions(o)},[o,u]),o1e(o,d))throw GF(o,u,i);if(s1e({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw d.error;if((y=(x=a.getDefaultOptions().queries)==null?void 0:x._experimental_afterQuery)==null||y.call(x,o,d),o.experimental_prefetchInRender&&!Bm&&a1e(d,r)){const b=c?GF(o,u,i):l==null?void 0:l.promise;b==null||b.catch(Da).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?d:u.trackResult(d)}function st(e,t){return oQ(e,tQ)}function dt(e,t){const n=Ye(),[r]=N.useState(()=>new Kve(n,e));N.useEffect(()=>{r.setOptions(e)},[r,e]);const i=N.useSyncExternalStore(N.useCallback(o=>r.subscribe(Ci.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=N.useCallback((o,l)=>{r.mutate(o,l).catch(Da)},[r]);if(i.error&&CI(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function l1e(e,t){return oQ(e,Hve)}/**
837 * react-router v7.12.0
838 *
839 * Copyright (c) Remix Software Inc.
840 *
841 * This source code is licensed under the MIT license found in the
842 * LICENSE.md file in the root directory of this source tree.
843 *
844 * @license MIT
845 */var KF="popstate";function c1e(e={}){function t(r,i){let{pathname:a,search:o,hash:l}=r.location;return W5("",{pathname:a,search:o,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:h1(i)}return d1e(t,n,null,e)}function ps(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Yo(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function u1e(){return Math.random().toString(36).substring(2,10)}function YF(e,t){return{usr:e.state,key:e.key,idx:t}}function W5(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?_0(t):t,state:n,key:t&&t.key||r||u1e()}}function h1({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function _0(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function d1e(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,l="POP",c=null,u=d();u==null&&(u=0,o.replaceState({...o.state,idx:u},""));function d(){return(o.state||{idx:null}).idx}function f(){l="POP";let b=d(),w=b==null?null:b-u;u=b,c&&c({action:l,location:y.location,delta:w})}function h(b,w){l="PUSH";let _=W5(y.location,b,w);u=d()+1;let j=YF(_,u),E=y.createHref(_);try{o.pushState(j,"",E)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;i.location.assign(E)}a&&c&&c({action:l,location:y.location,delta:1})}function p(b,w){l="REPLACE";let _=W5(y.location,b,w);u=d();let j=YF(_,u),E=y.createHref(_);o.replaceState(j,"",E),a&&c&&c({action:l,location:y.location,delta:0})}function x(b){return f1e(b)}let y={get action(){return l},get location(){return e(i,o)},listen(b){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(KF,f),c=b,()=>{i.removeEventListener(KF,f),c=null}},createHref(b){return t(i,b)},createURL:x,encodeLocation(b){let w=x(b);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:h,replace:p,go(b){return o.go(b)}};return y}function f1e(e,t=!1){let n="http://localhost";
845typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),ps(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:h1(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function lQ(e,t,n="/"){return h1e(e,t,n,!1)}function h1e(e,t,n,r){let i=typeof t=="string"?_0(t):t,a=id(i.pathname||"/",n);if(a==null)return null;let o=cQ(e);m1e(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let u=k1e(a);l=j1e(o[c],u,r)}return l}function cQ(e,t=[],n=[],r="",i=!1){let a=(o,l,c=i,u)=>{let d={relativePath:u===void 0?o.path||"":u,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&c)return;ps(d.relativePath.startsWith(r),`Absolute route path "${d.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(r.length)}let f=qu([r,d.relativePath]),h=n.concat(d);o.children&&o.children.length>0&&(ps(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),cQ(o.children,t,h,f,c)),!(o.path==null&&!o.index)&&t.push({path:f,score:w1e(f,o.index),routesMeta:h})};return e.forEach((o,l)=>{var c;if(o.path===""||!((c=o.path)!=null&&c.includes("?")))a(o,l);else for(let u of uQ(o.path))a(o,l,!0,u)}),t}function uQ(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let o=uQ(r.join("/")),l=[];return l.push(...o.map(c=>c===""?a:[a,c].join("/"))),i&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function m1e(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:_1e(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var p1e=/^:[\w-]+$/,g1e=3,x1e=2,y1e=1,v1e=10,b1e=-2,XF=e=>e==="*";function w1e(e,t){let n=e.split("/"),r=n.length;return n.some(XF)&&(r+=b1e),t&&(r+=x1e),n.filter(i=>!XF(i)).reduce((i,a)=>i+(p1e.test(a)?g1e:a===""?y1e:v1e),r)}function _1e(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function j1e(e,t,n=!1){let{routesMeta:r}=e,i={},a="/",o=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,d=a==="/"?t:t.slice(a.length)||"/",f=p2({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),h=c.route;if(!f&&u&&n&&!r[r.length-1].route.index&&(f=p2({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!f)return null;
845Object.assign(i,f.params),o.push({params:i,pathname:qu([a,f.pathname]),pathnameBase:A1e(qu([a,f.pathnameBase])),route:h}),f.pathnameBase!=="/"&&(a=qu([a,f.pathnameBase]))}return o}function p2(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=N1e(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,"$1"),l=i.slice(1);return{params:r.reduce((u,{paramName:d,isOptional:f},h)=>{if(d==="*"){let x=l[h]||"";o=a.slice(0,a.length-x.length).replace(/(.)\/+$/,"$1")}const p=l[h];return f&&!p?u[d]=void 0:u[d]=(p||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:o,pattern:e}}function N1e(e,t=!1,n=!0){Yo(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function k1e(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Yo(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function id(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var dQ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,C1e=e=>dQ.test(e);function E1e(e,t="/"){let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?_0(e):e,a;if(n)if(C1e(n))a=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Yo(!1,`Pathnames cannot have embedded double slashes - normalizing ${o} -> ${n}`)}n.startsWith("/")?a=QF(n.substring(1),"/"):a=QF(n,t)}else a=t;return{pathname:a,search:T1e(r),hash:P1e(i)}}function QF(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function rA(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}].  Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function S1e(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function AI(e){let t=S1e(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function TI(e,t,n,r=!1){let i;typeof e=="string"?i=_0(e):(i={...e},ps(!i.pathname||!i.pathname.includes("?"),rA("?","pathname","search",i)),ps(!i.pathname||!i.pathname.includes("#"),rA("#","pathname","hash",i)),ps(!i.search||!i.search.includes("#"),rA("#","search","hash",i)));let a=e===""||i.pathname==="",o=a?"/":i.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),f-=1;i.pathname=h.join("/")}l=f>=0?t[f]:"/"}let c=E1e(i,l),u=o&&o!=="/"&&o.endsWith("/"),d=(a||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}var qu=e=>e.join("/").replace(/\/\/+/g,"/"),A1e=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),T1e=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,P1e=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,O1e=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function D1e(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function I1e(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var fQ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function hQ(e,t){let n=e;
845if(typeof n!="string"||!dQ.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(fQ)try{let a=new URL(window.location.href),o=n.startsWith("//")?new URL(a.protocol+n):new URL(n),l=id(o.pathname,t);o.origin===a.origin&&l!=null?n=l+o.search+o.hash:i=!0}catch{Yo(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var mQ=["POST","PUT","PATCH","DELETE"];new Set(mQ);var R1e=["GET",...mQ];new Set(R1e);var j0=N.createContext(null);j0.displayName="DataRouter";var Zk=N.createContext(null);Zk.displayName="DataRouterState";var M1e=N.createContext(!1),pQ=N.createContext({isTransitioning:!1});pQ.displayName="ViewTransition";var L1e=N.createContext(new Map);L1e.displayName="Fetchers";var F1e=N.createContext(null);F1e.displayName="Await";var tl=N.createContext(null);tl.displayName="Navigation";var Ob=N.createContext(null);Ob.displayName="Location";var Ll=N.createContext({outlet:null,matches:[],isDataRoute:!1});Ll.displayName="Route";var PI=N.createContext(null);PI.displayName="RouteError";var gQ="REACT_ROUTER_ERROR",$1e="REDIRECT",B1e="ROUTE_ERROR_RESPONSE";function z1e(e){if(e.startsWith(`${gQ}:${$1e}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function U1e(e){if(e.startsWith(`${gQ}:${B1e}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new O1e(t.status,t.statusText,t.data)}catch{}}function q1e(e,{relative:t}={}){ps(N0(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=N.useContext(tl),{hash:i,pathname:a,search:o}=Db(e,{relative:t}),l=a;return n!=="/"&&(l=a==="/"?n:qu([n,a])),r.createHref({pathname:l,search:o,hash:i})}function N0(){return N.useContext(Ob)!=null}function fa(){return ps(N0(),"useLocation() may be used only in the context of a <Router> component."),N.useContext(Ob).location}var xQ="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function yQ(e){N.useContext(tl).static||N.useLayoutEffect(e)}function Rr(){let{isDataRoute:e}=N.useContext(Ll);return e?sbe():V1e()}function V1e(){ps(N0(),"useNavigate() may be used only in the context of a <Router> component.");let e=N.useContext(j0),{basename:t,navigator:n}=N.useContext(tl),{matches:r}=N.useContext(Ll),{pathname:i}=fa(),a=JSON.stringify(AI(r)),o=N.useRef(!1);return yQ(()=>{o.current=!0}),N.useCallback((c,u={})=>{if(Yo(o.current,xQ),!o.current)return;if(typeof c=="number"){n.go(c);return}let d=TI(c,JSON.parse(a),i,u.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:qu([t,d.pathname])),(u.replace?n.replace:n.push)(d,u.state,u)},[t,n,a,i,e])}var H1e=N.createContext(null);function W1e(e){let t=N.useContext(Ll).outlet;return N.useMemo(()=>t&&N.createElement(H1e.Provider,{value:e},t),[t,e])}function Wi(){let{matches:e}=N.useContext(Ll),t=e[e.length-1];return t?t.params:{}}function Db(e,{relative:t}={}){let{matches:n}=N.useContext(Ll),{pathname:r}=fa(),i=JSON.stringify(AI(n));return N.useMemo(()=>TI(e,JSON.parse(i),r,t==="path"),[e,i,r,t])}function G1e(e,t){return vQ(e,t)}function vQ(e,t,n,r,i){var _;ps(N0(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=N.useContext(tl),{matches:o}=N.useContext(Ll),l=o[o.length-1],c=l?l.params:{},u=l?l.pathname:"/",d=l?l.pathnameBase:"/",f=l&&l.route;{let j=f&&f.path||"";wQ(u,!f||j.endsWith("*")||j.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${j}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
846
847Please change the parent <Route path="${j}"> to <Route path="${j==="/"?"*":`${j}/*`}">.`)}let h=fa(),p;if(t){let j=typeof t=="string"?_0(t):t;ps(d==="/"||((_=j.pathname)==null?void 0:_.startsWith(d)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${j.pathname}" was given in the \`location\` prop.`),p=j}else p=h;let x=p.pathname||"/",y=x;if(d!=="/"){let j=d.replace(/^\//,"").split("/");y="/"+x.replace(/^\//,"").split("/").slice(j.length).join("/")}let b=lQ(e,{pathname:y});Yo(f||b!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Yo(b==null||b[b.length-1].route.element!==void 0||b[b.length-1].route.Component!==void 0||b[b.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=J1e(b&&b.map(j=>Object.assign({},j,{params:Object.assign({},c,j.params),pathname:qu([d,a.encodeLocation?a.encodeLocation(j.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?d:qu([d,a.encodeLocation?a.encodeLocation(j.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathnameBase])})),o,n,r,i);return t&&w?N.createElement(Ob.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...p},navigationType:"POP"}},w):w}function K1e(){let e=rbe(),t=D1e(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",e),o=N.createElement(N.Fragment,null,N.createElement("p",null,"💿 Hey developer 👋"),N.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",N.createElement("code",{style:a},"ErrorBoundary")," or"," ",N.createElement("code",{style:a},"errorElement")," prop on your route.")),N.createElement(N.Fragment,null,N.createElement("h2",null,"Unexpected Application 
847Error!"),N.createElement("h3",{style:{fontStyle:"italic"}},t),n?N.createElement("pre",{style:i},n):null,o)}var Y1e=N.createElement(K1e,null),bQ=class extends N.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=U1e(e.digest);n&&(e=n)}let t=e!==void 0?N.createElement(Ll.Provider,{value:this.props.routeContext},N.createElement(PI.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?N.createElement(X1e,{error:e},t):t}};bQ.contextType=M1e;var sA=new WeakMap;function X1e({children:e,error:t}){let{basename:n}=N.useContext(tl);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=z1e(t.digest);if(r){let i=sA.get(t);if(i)throw i;let a=hQ(r.location,n);if(fQ&&!sA.get(t))if(a.isExternal||r.reloadDocument)window.location.href=a.absoluteURL||a.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:r.replace}));throw sA.set(t,o),o}return N.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return e}function Q1e({routeContext:e,match:t,children:n}){let r=N.useContext(j0);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),N.createElement(Ll.Provider,{value:e},n)}function J1e(e,t=[],n=null,r=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n==null?void 0:n.errors;if(o!=null){let d=a.findIndex(f=>f.route.id&&(o==null?void 0:o[f.route.id])!==void 0);ps(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),a=a.slice(0,Math.min(a.length,d+1))}let l=!1,c=-1;if(n)for(let d=0;d<a.length;d++){let f=a[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(c=d),f.route.id){let{loaderData:h,errors:p}=n,x=f.route.loader&&!h.hasOwnProperty(f.route.id)&&(!p||p[f.route.id]===void 0);if(f.route.lazy||x){l=!0,c>=0?a=a.slice(0,c+1):a=[a[0]];break}}}let u=n&&r?(d,f)=>{var h,p;r(d,{location:n.location,params:((p=(h=n.matches)==null?void 0:h[0])==null?void 0:p.params)??{},unstable_pattern:I1e(n.matches),errorInfo:f})}:void 0;return a.reduceRight((d,f,h)=>{let p,x=!1,y=null,b=null;n&&(p=o&&f.route.id?o[f.route.id]:void 0,y=f.route.errorElement||Y1e,l&&(c<0&&h===0?(wQ("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,b=null):c===h&&(x=!0,b=f.route.hydrateFallbackElement||null)));let w=t.concat(a.slice(0,h+1)),_=()=>{let j;return p?j=y:x?j=b:f.route.Component?j=N.createElement(f.route.Component,null):f.route.element?j=f.route.element:j=d,N.createElement(Q1e,{match:f,routeContext:{outlet:d,matches:w,isDataRoute:n!=null},children:j})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?N.createElement(bQ,{location:n.location,revalidation:n.revalidation,component:y,error:p,children:_(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:u}):_()},null)}function OI(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function Z1e(e){let t=N.useContext(j0);return ps(t,OI(e)),t}function ebe(e){let t=N.useContext(Zk);return ps(t,OI(e)),t}function tbe(e){let t=N.useContext(Ll);return ps(t,OI(e)),t}function DI(e){let t=tbe(e),n=t.matches[t.matches.length-1];return ps(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function nbe(){return DI("useRouteId")}function rbe(){var r;let e=N.useContext(PI),t=ebe("useRouteError"),n=DI("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function sbe(){let{router:e}=Z1e("useNavigate"),t=DI("useNavigate"),n=N.useRef(!1);return yQ(()=>{n.current=!0}),N.useCallback(async(i,a={})=>{Yo(n.current,xQ),n.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...a}))},[e,t])}var JF={};
847function wQ(e,t,n){!t&&!JF[e]&&(JF[e]=!0,Yo(!1,n))}N.memo(ibe);function ibe({routes:e,future:t,state:n,onError:r}){return vQ(e,void 0,n,r,t)}function em({to:e,replace:t,state:n,relative:r}){ps(N0(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=N.useContext(tl);Yo(!i,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:a}=N.useContext(Ll),{pathname:o}=fa(),l=Rr(),c=TI(e,AI(a),o,r==="path"),u=JSON.stringify(c);return N.useEffect(()=>{l(JSON.parse(u),{replace:t,state:n,relative:r})},[l,u,r,t,n]),null}function II(e){return W1e(e.context)}function Bt(e){ps(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function abe({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:i,static:a=!1,unstable_useTransitions:o}){ps(!N0(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=N.useMemo(()=>({basename:l,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[l,i,a,o]);typeof n=="string"&&(n=_0(n));let{pathname:u="/",search:d="",hash:f="",state:h=null,key:p="default"}=n,x=N.useMemo(()=>{let y=id(u,l);return y==null?null:{location:{pathname:y,search:d,hash:f,state:h,key:p},navigationType:r}},[l,u,d,f,h,p,r]);return Yo(x!=null,`<Router basename="${l}"> is not able to match the URL "${u}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:N.createElement(tl.Provider,{value:c},N.createElement(Ob.Provider,{children:t,value:x}))}function obe({children:e,location:t}){return G1e(G5(e),t)}function G5(e,t=[]){let n=[];return N.Children.forEach(e,(r,i)=>{if(!N.isValidElement(r))return;let a=[...t,i];if(r.type===N.Fragment){n.push.apply(n,G5(r.props.children,a));return}ps(r.type===Bt,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ps(!r.props.index||!r.props.children,"An index route cannot have child routes.");let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=G5(r.props.children,a)),n.push(o)}),n}var uj="get",dj="application/x-www-form-urlencoded";function eC(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function lbe(e){return eC(e)&&e.tagName.toLowerCase()==="button"}function cbe(e){return eC(e)&&e.tagName.toLowerCase()==="form"}function ube(e){return eC(e)&&e.tagName.toLowerCase()==="input"}function dbe(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function fbe(e,t){return e.button===0&&(!t||t==="_self")&&!dbe(e)}function K5(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function hbe(e,t){let n=K5(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(a=>{n.append(i,a)})}),n}var Yw=null;function mbe(){if(Yw===null)try{new FormData(document.createElement("form"),0),Yw=!1}catch{Yw=!0}return Yw}var pbe=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function iA(e){return e!=null&&!pbe.has(e)?(Yo(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${dj}"`),null):e}function gbe(e,t){let n,r,i,a,o;if(cbe(e)){let l=e.getAttribute("action");r=l?id(l,t):null,n=e.getAttribute("method")||uj,i=iA(e.getAttribute("enctype"))||dj,a=new FormData(e)}else if(lbe(e)||ube(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(r=c?id(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||uj,i=iA(e.getAttribute("formenctype"))||iA(l.getAttribute("enctype"))||dj,a=new FormData(l,e),!mbe()){let{name:u,type:d,value:f}=e;if(d==="image"){let h=u?`${u}.`:"";a.append(`${h}x`,"0"),a.append(`${h}y`,"0")}else u&&a.append(u,f)}}else{if(eC(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=uj,r=null,i=dj,o=e}return a&&i==="text/plain"&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function RI(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function xbe(e,t,n,r){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname==="/"?i.pathname=`_root.${r}`:t&&id(i.pathname,t)==="/"?i.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${r}`,i}async function ybe(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.
847isSpaMode,window.location.reload(),new Promise(()=>{})}}function vbe(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function bbe(e,t,n){let r=await Promise.all(e.map(async i=>{let a=t.routes[i.route.id];if(a){let o=await ybe(a,n);return o.links?o.links():[]}return[]}));return Nbe(r.flat(1).filter(vbe).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function ZF(e,t,n,r,i,a){let o=(c,u)=>n[u]?c.route.id!==n[u].route.id:!0,l=(c,u)=>{var d;return n[u].pathname!==c.pathname||((d=n[u].route.path)==null?void 0:d.endsWith("*"))&&n[u].params["*"]!==c.params["*"]};return a==="assets"?t.filter((c,u)=>o(c,u)||l(c,u)):a==="data"?t.filter((c,u)=>{var f;let d=r.routes[c.route.id];if(!d||!d.hasLoader)return!1;if(o(c,u)||l(c,u))return!0;if(c.route.shouldRevalidate){let h=c.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((f=n[0])==null?void 0:f.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function wbe(e,t,{includeHydrateFallback:n}={}){return _be(e.map(r=>{let i=t.routes[r.route.id];if(!i)return[];let a=[i.module];return i.clientActionModule&&(a=a.concat(i.clientActionModule)),i.clientLoaderModule&&(a=a.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(a=a.concat(i.hydrateFallbackModule)),i.imports&&(a=a.concat(i.imports)),a}).flat(1))}function _be(e){return[...new Set(e)]}function jbe(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Nbe(e,t){let n=new Set;return new Set(t),e.reduce((r,i)=>{let a=JSON.stringify(jbe(i));return n.has(a)||(n.add(a),r.push({key:a,link:i})),r},[])}function _Q(){let e=N.useContext(j0);return RI(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function kbe(){let e=N.useContext(Zk);return RI(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var MI=N.createContext(void 0);MI.displayName="FrameworkContext";function jQ(){let e=N.useContext(MI);return RI(e,"You must render this element inside a <HydratedRouter> element"),e}function Cbe(e,t){let n=N.useContext(MI),[r,i]=N.useState(!1),[a,o]=N.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,h=N.useRef(null);N.useEffect(()=>{if(e==="render"&&o(!0),e==="viewport"){let y=w=>{w.forEach(_=>{o(_.isIntersecting)})},b=new IntersectionObserver(y,{threshold:.5});return h.current&&b.observe(h.current),()=>{b.disconnect()}}},[e]),N.useEffect(()=>{if(r){let y=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(y)}}},[r]);let p=()=>{i(!0)},x=()=>{i(!1),o(!1)};return n?e!=="intent"?[a,h,{}]:[a,h,{onFocus:by(l,p),onBlur:by(c,x),onMouseEnter:by(u,p),onMouseLeave:by(d,x),onTouchStart:by(f,p)}]:[!1,h,{}]}function by(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Ebe({page:e,...t}){let{router:n}=_Q(),r=N.useMemo(()=>lQ(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?N.createElement(Abe,{page:e,matches:r,...t}):null}function Sbe(e){let{manifest:t,routeModules:n}=jQ(),[r,i]=N.useState([]);return N.useEffect(()=>{let a=!1;return bbe(e,t,n).then(o=>{a||i(o)}),()=>{a=!0}},[e,t,n]),r}function Abe({page:e,matches:t,...n}){let r=fa(),{future:i,manifest:a,routeModules:o}=jQ(),{basename:l}=_Q(),{loaderData:c,matches:u}=kbe(),d=N.useMemo(()=>ZF(e,t,u,a,r,"data"),[e,t,u,a,r]),f=N.useMemo(()=>ZF(e,t,u,a,r,"assets"),[e,t,u,a,r]),h=N.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let y=new Set,b=!1;if(t.forEach(_=>{var E;let j=a.routes[_.route.id];!j||!j.hasLoader||(!d.some(S=>S.route.id===_.route.id)&&_.route.id in c&&((E=o[_.route.id])!=null&&E.shouldRevalidate)||j.hasClientLoader?b=!0:y.add(_.route.id))}),y.size===0)return[];let w=xbe(e,l,i.unstable_trailingSlashAwareDataRequests,"data");return b&&y.size>0&&w.searchParams.set("_routes",t.filter(_=>y.has(_.route.id)).map(_=>_.route.id).join(",")),[w.pathname+w.search]},[l,i.unstable_trailingSlashAwareDataRequests,c,r,a,d,t,e,o]),p=N.useMemo(()=>wbe(f,a),[f,a]),x=Sbe(f);return N.createElement(N.Fragment,null,h.map(y=>N.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...n})),p.map(y=>N.createElement("link",{key:y,rel:"modulepreload",href:y,...n})),x.map(({key:y,link:b})=>N.createElement("link",{key:y,nonce:n.nonce,...b})))}function Tbe(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Pbe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Pbe&&(window.__reactRouterVersion="7.12.0")}catch{}function Obe({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=N.useRef();i.current==null&&(i.current=c1e({window:r,v5Compat:!0}));let a=i.current,[o,l]=N.useState({action:a.action,location:a.location}),c=N.useCallback(u=>{n===!1?l(u):N.startTransition(()=>l(u))},[n]);return N.useLayoutEffect(()=>a.listen(c),[a,c]),N.createElement(abe,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}var NQ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Pe=N.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:i,reloadDocument:a,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:h,...p},x){let{basename:y,unstable_useTransitions:b}=N.useContext(tl),w=typeof u=="string"&&NQ.test(u),_=hQ(u,y);u=_.to;let j=q1e(u,{relative:i}),[E,S,T]=Cbe(r,p),P=Rbe(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f,unstable_defaultShouldRevalidate:h,unstable_useTransitions:b});
847function O(R){t&&t(R),R.defaultPrevented||P(R)}let D=N.createElement("a",{...p,...T,href:_.absoluteURL||j,onClick:_.isExternal||a?t:O,ref:Tbe(x,S),target:c,"data-discover":!w&&n==="render"?"true":void 0});return E&&!w?N.createElement(N.Fragment,null,D,N.createElement(Ebe,{page:j})):D});Pe.displayName="Link";var g2=N.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:i=!1,style:a,to:o,viewTransition:l,children:c,...u},d){let f=Db(o,{relative:u.relative}),h=fa(),p=N.useContext(Zk),{navigator:x,basename:y}=N.useContext(tl),b=p!=null&&Bbe(f)&&l===!0,w=x.encodeLocation?x.encodeLocation(f).pathname:f.pathname,_=h.pathname,j=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;n||(_=_.toLowerCase(),j=j?j.toLowerCase():null,w=w.toLowerCase()),j&&y&&(j=id(j,y)||j);const E=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let S=_===w||!i&&_.startsWith(w)&&_.charAt(E)==="/",T=j!=null&&(j===w||!i&&j.startsWith(w)&&j.charAt(w.length)==="/"),P={isActive:S,isPending:T,isTransitioning:b},O=S?t:void 0,D;typeof r=="function"?D=r(P):D=[r,S?"active":null,T?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let R=typeof a=="function"?a(P):a;return N.createElement(Pe,{...u,"aria-current":O,className:D,ref:d,style:R,to:o,viewTransition:l},typeof c=="function"?c(P):c)});g2.displayName="NavLink";var Dbe=N.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=uj,action:l,onSubmit:c,relative:u,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:h,...p},x)=>{let{unstable_useTransitions:y}=N.useContext(tl),b=Fbe(),w=$be(l,{relative:u}),_=o.toLowerCase()==="get"?"get":"post",j=typeof l=="string"&&NQ.test(l),E=S=>{if(c&&c(S),S.defaultPrevented)return;S.preventDefault();let T=S.nativeEvent.submitter,P=(T==null?void 0:T.getAttribute("formmethod"))||o,O=()=>b(T||S.currentTarget,{fetcherKey:t,method:P,navigate:n,replace:i,state:a,relative:u,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:h});y&&n!==!1?N.startTransition(()=>O()):O()};return N.createElement("form",{ref:x,method:_,action:w,onSubmit:r?c:E,...p,"data-discover":!j&&e==="render"?"true":void 0})});Dbe.displayName="Form";function Ibe(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function kQ(e){let t=N.useContext(j0);return ps(t,Ibe(e)),t}function Rbe(e,{target:t,replace:n,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:l,unstable_useTransitions:c}={}){let u=Rr(),d=fa(),f=Db(e,{relative:a});return N.useCallback(h=>{if(fbe(h,t)){h.preventDefault();let p=n!==void 0?n:h1(d)===h1(f),x=()=>u(e,{replace:p,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:l});c?N.startTransition(()=>x()):x()}},[d,u,f,n,r,t,e,i,a,o,l,c])}function wc(e){Yo(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=N.useRef(K5(e)),n=N.useRef(!1),r=fa(),i=N.useMemo(()=>hbe(r.search,n.current?null:t.current),[r.search]),a=Rr(),o=N.useCallback((l,c)=>{const u=K5(typeof l=="function"?l(new URLSearchParams(i)):l);n.current=!0,a("?"+u,c)},[a,i]);return[i,o]}var Mbe=0,Lbe=()=>`__${String(++Mbe)}__`;function Fbe(){let{router:e}=kQ("useSubmit"),{basename:t}=N.useContext(tl),n=nbe(),r=e.fetch,i=e.navigate;return N.useCallback(async(a,o={})=>{let{action:l,method:c,encType:u,formData:d,body:f}=gbe(a,t);if(o.navigate===!1){let h=o.fetcherKey||Lbe();await r(h,n,o.action||l,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:f,formMethod:o.method||c,formEncType:o.encType||u,flushSync:o.flushSync})}else await i(o.action||l,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:f,formMethod:o.method||c,formEncType:o.encType||u,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,i,t,n])}function $be(e,{relative:t}={}){let{basename:n}=N.useContext(tl),r=N.useContext(Ll);ps(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),a={...Db(e||".",{relative:t})},o=fa();if(e==null){a.search=o.search;let l=new URLSearchParams(a.search),c=l.getAll("index");if(c.some(d=>d==="")){l.delete("index"),c.filter(f=>f).forEach(f=>l.append("index",f));let d=l.toString();a.search=d?`?${d}`:""}}return(!e||e===".")&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(
847a.pathname=a.pathname==="/"?n:qu([n,a.pathname])),h1(a)}function Bbe(e,{relative:t}={}){let n=N.useContext(pQ);ps(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=kQ("useViewTransitionState"),i=Db(e,{relative:t});if(!n.isTransitioning)return!1;let a=id(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=id(n.nextLocation.pathname,r)||n.nextLocation.pathname;return p2(i.pathname,o)!=null||p2(i.pathname,a)!=null}var Uc=function(){return Uc=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},Uc.apply(this,arguments)};function k0(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 i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function zbe(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):i(d.value).then(l,c)}u((r=r.apply(e,t||[])).next())})}function Ube(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}const qbe=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class LI extends Error{constructor(t,n="FunctionsError",r){super(t),this.name=n,this.context=r}}class Vbe extends LI{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class e$ extends LI{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class _x extends LI{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Y5;(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"})(Y5||(Y5={}));class Hbe{constructor(t,{headers:n={},customFetch:r,region:i=Y5.Any}={}){this.url=t,this.headers=n,this.region=i,this.fetch=qbe(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return zbe(this,arguments,void 0,function*(n,r={}){var i;let a,o;try{const{headers:l,method:c,body:u,signal:d,timeout:f}=r;let h={},{region:p}=r;p||(p=this.region);const x=new URL(`${this.url}/${n}`);p&&p!=="any"&&(h["x-region"]=p,x.searchParams.set("forceFunctionRegion",p));let y;u&&(l&&!Object.prototype.hasOwnProperty.call(l,"Content-Type")||!l)?typeof Blob<"u"&&u instanceof Blob||u instanceof ArrayBuffer?(h["Content-Type"]="application/octet-stream",y=u):typeof u=="string"?(h["Content-Type"]="text/plain",y=u):typeof FormData<"u"&&u instanceof FormData?y=u:(h["Content-Type"]="application/json",y=JSON.stringify(u)):y=u;let b=d;f&&(o=new AbortController,a=setTimeout(()=>o.abort(),f),d?(b=o.signal,d.addEventListener("abort",()=>o.abort())):b=o.signal);const w=yield this.fetch(x.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},h),this.headers),l),body:y,signal:b}).catch(S=>{throw new Vbe(S)}),_=w.headers.get("x-relay-error");if(_&&_==="true")throw new e$(w);if(!w.ok)throw new _x(w);let j=((i=w.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),E;return j==="application/json"?E=yield w.json():j==="application/octet-stream"||j==="application/pdf"?E=yield w.blob():j==="text/event-stream"?E=w:j==="multipart/form-data"?E=yield w.formData():E=yield w.text(),{data:E,error:null,response:w}}catch(l){return{data:null,error:l,response:l instanceof _x||l instanceof e$?l.context:void 0}}finally{a&&clearTimeout(a)}})}}
847var Wbe=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}},Gbe=class{constructor(e){var t,n;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){var n=this;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");const r=this.fetch;let i=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async a=>{let o=null,l=null,c=null,u=a.status,d=a.statusText;if(a.ok){var f,h;if(n.method!=="HEAD"){var p;const w=await a.text();w===""||(n.headers.get("Accept")==="text/csv"||n.headers.get("Accept")&&(!((p=n.headers.get("Accept"))===null||p===void 0)&&p.includes("application/vnd.pgrst.plan+text"))?l=w:l=JSON.parse(w))}const y=(f=n.headers.get("Prefer"))===null||f===void 0?void 0:f.match(/count=(exact|planned|estimated)/),b=(h=a.headers.get("content-range"))===null||h===void 0?void 0:h.split("/");y&&b&&b.length>1&&(c=parseInt(b[1])),n.isMaybeSingle&&n.method==="GET"&&Array.isArray(l)&&(l.length>1?(o={code:"PGRST116",details:`Results contain ${l.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},l=null,c=null,u=406,d="Not Acceptable"):l.length===1?l=l[0]:l=null)}else{var x;const y=await a.text();try{o=JSON.parse(y),Array.isArray(o)&&a.status===404&&(l=[],o=null,u=200,d="OK")}catch{a.status===404&&y===""?(u=204,d="No Content"):o={message:y}}if(o&&n.isMaybeSingle&&(!(o==null||(x=o.details)===null||x===void 0)&&x.includes("0 rows"))&&(o=null,u=200,d="OK"),o&&n.shouldThrowOnError)throw new Wbe(o)}return{error:o,data:l,count:c,status:u,statusText:d}});return this.shouldThrowOnError||(i=i.catch(a=>{var o;let l="";const c=a==null?void 0:a.cause;if(c){var u,d,f,h;const x=(u=c==null?void 0:c.message)!==null&&u!==void 0?u:"",y=(d=c==null?void 0:c.code)!==null&&d!==void 0?d:"";l=`${(f=a==null?void 0:a.name)!==null&&f!==void 0?f:"FetchError"}: ${a==null?void 0:a.message}`,l+=`
848
849Caused by: ${(h=c==null?void 0:c.name)!==null&&h!==void 0?h:"Error"}: ${x}`,y&&(l+=` (${y})`),c!=null&&c.stack&&(l+=`
850${c.stack}`)}else{var p;l=(p=a==null?void 0:a.stack)!==null&&p!==void 0?p:""}return{error:{message:`${(o=a==null?void 0:a.name)!==null&&o!==void 0?o:"FetchError"}: ${a==null?void 0:a.message}`,details:l,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),i.then(e,t)}returns(){return this}overrideTypes(){return this}},Kbe=class extends Gbe{select(e){let t=!1;const n=(e??"*").split("").map(r=>/\s/.test(r)&&!t?"":(r==='"'&&(t=!t),r)).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:i=r}={}){const a=i?`${i}.order`:"order",o=this.url.searchParams.get(a);return this.url.searchParams.set(a,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){const i=typeof r>"u"?"offset":`${r}.offset`,a=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(a,`${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.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
850explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:i=!1,format:a="text"}={}){var o;const l=[e?"analyze":null,t?"verbose":null,n?"settings":null,r?"buffers":null,i?"wal":null].filter(Boolean).join("|"),c=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${a}; for="${c}"; options=${l};`),a==="json"?this: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}};const t$=new RegExp("[,()]");var Jp=class extends Kbe{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){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&t$.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&t$.test(r)?`"${r}"`:`${r}`).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 i="";r==="plain"?i="pl":r==="phrase"?i="ph":r==="websearch"&&(i="w");const a=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${i}fts${a}.${t}`),this}match(e){return Object.entries(e).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){const 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}},Ybe=class{constructor(e,{headers:t={},schema:n,fetch:r}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r}select(e,t){const{head:n=!1,count:r}=t??{},i=n?"HEAD":"GET";let a=!1;const o=(e??"*").split("").map(l=>/\s/.test(l)&&!a?"":(l==='"'&&(a=!a),l)).join("");return this.url.searchParams.set("select",o),r&&this.headers.append("Prefer",`count=${r}`),new Jp({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;const i="POST";if(t&&this.headers.append("Prefer",`count=${t}`),n||this.headers.append("Prefer","missing=default"),Array.isArray(e)){const a=e.reduce((o,l)=>o.concat(Object.keys(l)),[]);if(a.length>
8500){const o=[...new Set(a)].map(l=>`"${l}"`);this.url.searchParams.set("columns",o.join(","))}}return new Jp({method:i,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:i=!0}={}){var a;const o="POST";if(this.headers.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&this.url.searchParams.set("on_conflict",t),r&&this.headers.append("Prefer",`count=${r}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(e)){const l=e.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(l.length>0){const c=[...new Set(l)].map(u=>`"${u}"`);this.url.searchParams.set("columns",c.join(","))}}return new Jp({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}update(e,{count:t}={}){var n;const r="PATCH";return t&&this.headers.append("Prefer",`count=${t}`),new Jp({method:r,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:e}={}){var t;const n="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new Jp({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch})}},Xbe=class CQ{constructor(t,{headers:n={},schema:r,fetch:i}={}){this.url=t,this.headers=new Headers(n),this.schemaName=r,this.fetch=i}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Ybe(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(t){return new CQ(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}rpc(t,n={},{head:r=!1,get:i=!1,count:a}={}){var o;let l;const c=new URL(`${this.url}/rpc/${t}`);let u;r||i?(l=r?"HEAD":"GET",Object.entries(n).filter(([f,h])=>h!==void 0).map(([f,h])=>[f,Array.isArray(h)?`{${h.join(",")}}`:`${h}`]).forEach(([f,h])=>{c.searchParams.append(f,h)})):(l="POST",u=n);const d=new Headers(this.headers);return a&&d.set("Prefer",`count=${a}`),new Jp({method:l,url:c,headers:d,schema:this.schemaName,body:u,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};class Qbe{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")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"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.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."};if(typeof process<"u"){const n=process.versions;if(n&&n.node){const r=n.node,i=parseInt(r.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
851import ws from "ws"
852new 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(){const t=this.detectEnvironment();if(t.constructor)return t.constructor;let n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=`
853
854Suggested solution: ${t.workaround}`),new Error(n)}static createWebSocket(t,n){const r=this.getWebSocketConstructor();return new r(t,n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const Jbe="2.89.0",Zbe=`realtime-js/${Jbe}`,EQ="1.0.0",ewe="2.0.0",n$=EQ,X5=1e4,twe=1e3,nwe=100;var Kd;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(Kd||(Kd={}));var bi;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(bi||(bi={}));var rc;(function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"})(rc||(rc={}));var Q5;(function(e){e.websocket="websocket"})(Q5||(Q5={}));var Vh;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"}
854)(Vh||(Vh={}));class rwe{constructor(t){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=t??[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(t));let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer((n=t.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,r;const i=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,i)}_encodeJsonUserBroadcastPush(t){var n,r;const i=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},o=new TextEncoder().encode(JSON.stringify(i)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(t,n,r){var i,a;const o=t.topic,l=(i=t.ref)!==null&&i!==void 0?i:"",c=(a=t.join_ref)!==null&&a!==void 0?a:"",u=t.payload.event,d=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},f=Object.keys(d).length===0?"":JSON.stringify(d);if(c.length>255)throw new Error(`joinRef length ${c.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`ref length ${l.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`userEvent length ${u.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`metadata length ${f.length} exceeds maximum of 255`);const h=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+l.length+o.length+u.length+f.length,p=new ArrayBuffer(this.HEADER_LENGTH+h);let x=new DataView(p),y=0;x.setUint8(y++,this.KINDS.userBroadcastPush),x.setUint8(y++,c.length),x.setUint8(y++,l.length),x.setUint8(y++,o.length),x.setUint8(y++,u.length),x.setUint8(y++,f.length),x.setUint8(y++,n),Array.from(c,w=>x.setUint8(y++,w.charCodeAt(0))),Array.from(l,w=>x.setUint8(y++,w.charCodeAt(0))),Array.from(o,w=>x.setUint8(y++,w.charCodeAt(0))),Array.from(u,w=>x.setUint8(y++,w.charCodeAt(0))),Array.from(f,w=>x.setUint8(y++,w.charCodeAt(0)));var b=new Uint8Array(p.byteLength+r.byteLength);return b.set(new Uint8Array(p),0),b.set(new Uint8Array(r),p.byteLength),b.buffer}decode(t,n){if(this._isArrayBuffer(t)){let r=this._binaryDecode(t);return n(r)}if(typeof t=="string"){const r=JSON.parse(t),[i,a,o,l,c]=r;return n({join_ref:i,ref:a,topic:o,event:l,payload:c})}return n({})}_binaryDecode(t){const n=new DataView(t),r=n.getUint8(0),i=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,n,i)}}_decodeUserBroadcast(t,n,r){const i=n.getUint8(1),a=n.getUint8(2),o=n.getUint8(3),l=n.getUint8(4);let c=this.HEADER_LENGTH+4;const u=r.decode(t.slice(c,c+i));c=c+i;const d=r.decode(t.slice(c,c+a));c=c+a;const f=r.decode(t.slice(c,c+o));c=c+o;const h=t.slice(c,t.byteLength),p=l===this.JSON_ENCODING?JSON.parse(r.decode(h)):h,x={type:this.BROADCAST_EVENT,event:d,payload:p};return o>0&&(x.meta=JSON.parse(f)),{join_ref:null,ref:null,topic:u,event:this.BROADCAST_EVENT,payload:x}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||((n=t==null?void 0:t.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(t,n){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([r])=>n.includes(r)))}}class SQ{constructor(t,n){this.callback=t,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Wr;(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"})(Wr||(Wr={}));const r$=(e,t,n={})=>{var r;const i=(r=n.skipTypes)!==null&&r!==void 0?r:[];return t?Object.keys(t).reduce((a,o)=>(a[o]=swe(o,e,t,i),a),{}):{}},swe=(e,t,n,r)=>{const i=t.find(l=>
854l.name===e),a=i==null?void 0:i.type,o=n[e];return a&&!r.includes(a)?AQ(a,o):J5(o)},AQ=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return lwe(t,n)}switch(e){case Wr.bool:return iwe(t);case Wr.float4:case Wr.float8:case Wr.int2:case Wr.int4:case Wr.int8:case Wr.numeric:case Wr.oid:return awe(t);case Wr.json:case Wr.jsonb:return owe(t);case Wr.timestamp:return cwe(t);case Wr.abstime:case Wr.date:case Wr.daterange:case Wr.int4range:case Wr.int8range:case Wr.money:case Wr.reltime:case Wr.text:case Wr.time:case Wr.timestamptz:case Wr.timetz:case Wr.tsrange:case Wr.tstzrange:return J5(t);default:return J5(t)}},J5=e=>e,iwe=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},awe=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},owe=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},lwe=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,r=e[n];if(e[0]==="{"&&r==="}"){let a;const o=e.slice(1,n);try{a=JSON.parse("["+o+"]")}catch{a=o?o.split(","):[]}return a.map(l=>AQ(t,l))}return e},cwe=e=>typeof e=="string"?e.replace(" ","T"):e,TQ=e=>{const 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=t.pathname+"/api/broadcast",t.href};class aA{constructor(t,n,r={},i=X5){this.channel=t,this.event=n,this.payload=r,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(t){this.timeout=t,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,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()}))}updatePayload(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,n){var r;return this._hasReceived(t)&&n((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:t,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:n}){this.recHooks.filter(r=>r.status===t).forEach(r=>r.callback(n))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var s$;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(s$||(s$={}));class wv{constructor(t,n){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=(n==null?void 0:n.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},i=>{const{onJoin:a,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=wv.syncState(this.state,i,a,o),this.pendingDiffs.forEach(c=>{this.state=wv.syncDiff(this.state,c,a,o)}),this.pendingDiffs=[],l()}),this.channel._on(r.diff,{},i=>{const{onJoin:a,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=wv.syncDiff(this.state,i,a,o),l())}),this.onJoin((i,a,o)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:a,newPresences:o})}),this.onLeave((i,a,o)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:a,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,n,r,i){const a=this.cloneDeep(t),o=this.transformState(n),l={},c={};return this.map(a,(u,d)=>{o[u]||(c[u]=d)}),this.map(o,(u,d)=>{const f=a[u];if(f){const h=d.map(b=>b.presence_ref),p=f.map(b=>b.presence_ref),x=d.filter(b=>p.indexOf(b.presence_ref)<0),y=f.filter(b=>h.indexOf(b.presence_ref)<0);x.length>0&&(l[u]=x),y.length>0&&(c[u]=y)}else l[u]=d}),this.syncDiff(a,{joins:l,leaves:c},r,i)}static syncDiff(t,n,r,i){const{joins:a,leaves:o}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),i||(i=()=>{}),this.map(a,(l,c)=>{var u;
854const d=(u=t[l])!==null&&u!==void 0?u:[];if(t[l]=this.cloneDeep(c),d.length>0){const f=t[l].map(p=>p.presence_ref),h=d.filter(p=>f.indexOf(p.presence_ref)<0);t[l].unshift(...h)}r(l,d,c)}),this.map(o,(l,c)=>{let u=t[l];if(!u)return;const d=c.map(f=>f.presence_ref);u=u.filter(f=>d.indexOf(f.presence_ref)<0),t[l]=u,i(l,u,c),u.length===0&&delete t[l]}),t}static map(t,n){return Object.getOwnPropertyNames(t).map(r=>n(r,t[r]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((n,r)=>{const i=t[r];return"metas"in i?n[r]=i.metas.map(a=>(a.presence_ref=a.phx_ref,delete a.phx_ref,delete a.phx_ref_prev,a)):n[r]=i,n},{})}static cloneDeep(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var i$;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(i$||(i$={}));var _v;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(_v||(_v={}));var Cu;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Cu||(Cu={}));class bg{constructor(t,n={config:{}},r){var i,a;if(this.topic=t,this.params=n,this.socket=r,this.bindings={},this.state=bi.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new aA(this,rc.join,this.params,this.timeout),this.rejoinTimer=new SQ(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=bi.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(o=>o.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=bi.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=bi.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=bi.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=bi.errored,this.rejoinTimer.scheduleTimeout())}),this._on(rc.reply,{},(o,l)=>{this._trigger(this._replyEventName(l),o)}),this.presence=new wv(this),this.broadcastEndpointURL=TQ(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((a=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||a===void 0)&&a.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(t,n=this.timeout){var r,i,a;if(this.socket.isConnected()||this.socket.connect(),this.state==bi.closed){const{config:{broadcast:o,presence:l,private:c}}=this.params,u=(i=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(p=>p.filter))!==null&&i!==void 0?i:[],d=!!this.bindings[_v.PRESENCE]&&this.bindings[_v.PRESENCE].length>0||((a=this.params.config.presence)===null||a===void 0?void 0:a.enabled)===!0,f={},h={broadcast:o,presence:Object.assign(Object.assign({},l),{enabled:d}),postgres_changes:u,private:c};this.socket.accessTokenValue&&(f.access_token=this.socket.accessTokenValue),this._onError(p=>t==null?void 0:t(Cu.CHANNEL_ERROR,p)),this._onClose(()=>t==null?void 0:t(Cu.CLOSED)),this.updateJoinPayload(Object.assign({config:h},f)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:p})=>{var x;if(this.socket._isManualToken()||this.socket.setAuth(),p===void 0){t==null||t(Cu.SUBSCRIBED);return}else{const y=this.bindings.postgres_changes,b=(x=y==null?void 0:y.length)!==null&&x!==void 0?x:0,w=[];for(let _=0;_<b;_++){const j=y[_],{filter:{event:E,schema:S,table:T,filter:P}}=j,O=p&&p[_];if(O&&O.event===E&&bg.isFilterValueEqual(O.schema,S)&&bg.isFilterValueEqual(O.table,T)&&bg.isFilterValueEqual(O.filter,P))w.push(Object.assign(Object.assign({},j),{id:O.id}));else{this.unsubscribe(),this.state=bi.errored,t==null||t(Cu.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=w,t&&t(Cu.SUBSCRIBED);return}}).receive("error",p=>{this.state=bi.errored,t==null||t(Cu.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(p).join(", ")||"error")))}).receive("timeout",()=>{t==null||t(Cu.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,r){return this.state===bi.joined&&t===_v.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(t,n,r)}async httpSend(t,n,r={}){var i;if(n==null)return Promise.reject("Payload is required for httpSend()");const a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:n,private:this.private}]})},l=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(i=r.timeout)!==null&&i!==void 0?i:this.timeout);if(l.status===202)return{success:!0};let c=l.statusText;
854try{const u=await l.json();c=u.error||u.message||c}catch{}return Promise.reject(new Error(c))}async send(t,n={}){var r,i;if(!this._canPush()&&t.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.");const{event:a,payload:o}=t,l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:a,payload:o,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((i=u.body)===null||i===void 0?void 0:i.cancel()),u.ok?"ok":"error"}catch(u){return u.name==="AbortError"?"timed out":"error"}}else return new Promise(a=>{var o,l,c;const u=this._push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((c=(l=(o=this.params)===null||o===void 0?void 0:o.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&a("ok"),u.receive("ok",()=>a("ok")),u.receive("error",()=>a("error")),u.receive("timeout",()=>a("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=bi.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(rc.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(i=>{r=new aA(this,rc.leave,{},t),r.receive("ok",()=>{n(),i("ok")}).receive("timeout",()=>{n(),i("timed out")}).receive("error",()=>{i("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r==null||r.destroy()})}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=bi.closed,this.bindings={}}async _fetchWithTimeout(t,n,r){const i=new AbortController,a=setTimeout(()=>i.abort(),r),o=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:i.signal}));return clearTimeout(a),o}_push(t,n,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new aA(this,t,n,r);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>nwe){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(t,n,r){return n}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,n,r){var i,a;const o=t.toLocaleLowerCase(),{close:l,error:c,leave:u,join:d}=rc;if(r&&[l,c,u,d].indexOf(o)>=0&&r!==this._joinRef())return;let h=this._onMessage(o,n,r);if(n&&!h)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(p=>{var x,y,b;return((x=p.filter)===null||x===void 0?void 0:x.event)==="*"||((b=(y=p.filter)===null||y===void 0?void 0:y.event)===null||b===void 0?void 0:b.toLocaleLowerCase())===o}).map(p=>p.callback(h,r)):(a=this.bindings[o])===null||a===void 0||a.filter(p=>{var x,y,b,w,_,j;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in p){const E=p.id,S=(x=p.filter)===null||x===void 0?void 0:x.event;return E&&((y=n.ids)===null||y===void 0?void 0:y.includes(E))&&(S==="*"||(S==null?void 0:S.toLocaleLowerCase())===((b=n.data)===null||b===void 0?void 0:b.type.toLocaleLowerCase()))}else{const E=(_=(w=p==null?void 0:p.filter)===null||w===void 0?void 0:w.event)===null||_===void 0?void 0:_.toLocaleLowerCase();return E==="*"||E===((j=n==null?void 0:n.event)===null||j===void 0?void 0:j.toLocaleLowerCase())}else return p.type.toLocaleLowerCase()===o}).map(p=>{if(typeof h=="object"&&"ids"in h){const x=h.data,{schema:y,table:b,commit_timestamp:w,type:_,errors:j}=x;h=Object.assign(Object.assign({},{schema:y,table:b,commit_timestamp:w,eventType:_,new:{},old:{},errors:j}),this._getPayloadRecords(x))}p.callback(h,r)})}_isClosed(){return this.state===bi.closed}_isJoined(){return this.state===bi.joined}_isJoining(){return this.state===bi.joining}_isLeaving(){return this.state===bi.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,n,r){const i=t.toLocaleLowerCase(),a={type:i,filter:n,callback:r};return this.bindings[i]?this.bindings[i].push(a):this.bindings[i]=[a],this}_off(t,n){const r=t.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(i=>{var a;return!(((a=i.type)===null||a===void 0?void 0:a.toLocaleLowerCase())===r&&bg.isEqual(i.filter,n))})),this}static isEqual(t,n){if(Object.keys(t).length!==Object.keys(n).length)return!1;for(const r in t)if(t[r]!==n[r])return!1;return!0}static isFilterValueEqual(t,n){return(t??void 0)===(n??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(rc.close,{},t)}_onError(t){this._on(rc.error,{},n=>t(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=bi.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=r$(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=r$(t.columns,t.old_record)),n}}const oA=()=>{},Xw={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},uwe=[1e3,2e3,5e3,1e4],dwe=1e4,fwe=`
855  addEventListener("message", (e) => {
856    if (e.data.event === "start") {
857      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
858    }
859  });`;class hwe{constructor(t,n){var r;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=X5,this.transport=null,this.heartbeatIntervalMs=Xw.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=oA,this.ref=0,this.reconnectTimer=null,this.vsn=n$,this.logger=oA,this.conn=null,this.sendBuffer=[],this.serializer
859=new rwe,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=i=>i?(...a)=>i(...a):(...a)=>fetch(...a),!(!((r=n==null?void 0:n.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${t}/${Q5.websocket}`,this.httpEndpoint=TQ(t),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=Qbe.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");const n=t.message;throw n.includes("Node.js")?new Error(`${n}
860
861To use Realtime in Node.js, you need to provide a WebSocket implementation:
862
863Option 1: Use Node.js 22+ which has native WebSocket support
864Option 2: Install and provide the "ws" package:
865
866  npm install ws
867
868  import ws from "ws"
869  const client = new RealtimeClient(url, {
870    ...options,
871    transport: ws
872  })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(t,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(t?this.conn.close(t,n??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const t=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),t}log(t,n,r){this.logger(t,n,r)}connectionState(){switch(this.conn&&this.conn.readyState){case Kd.connecting:return Vh.Connecting;case Kd.open:return Vh.Open;case Kd.closing:return Vh.Closing;default:return Vh.Closed}}isConnected(){return this.connectionState()===Vh.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,n={config:{}}){const r=`realtime:${t}`,i=this.getChannels().find(a=>a.topic===r);if(i)return i;{const a=new bg(`realtime:${t}`,n,this);return this.channels.push(a),a}}push(t){const{topic:n,event:r,payload:i,ref:a}=t,o=()=>{this.encode(t,l=>{var c;(c=this.conn)===null||c===void 0||c.send(l)})};this.log("push",`${n} ${r} (${a})`,i),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var t;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(t=this.conn)===null||t===void 0||t.close(twe,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},Xw.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(t){this.heartbeatCallback=t}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let n=this.channels.find(r=>r.topic===t&&(r._isJoined()||r._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${t}"`),n.unsubscribe())}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic)}_onConnMessage(t){this.decode(t.data,n=>
872{if(n.topic==="phoenix"&&n.event==="phx_reply")try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error")}catch(u){this.log("error","error in heartbeat callback",u)}n.ref&&n.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:r,event:i,payload:a,ref:o}=n,l=o?`(${o})`:"",c=a.status||"";this.log("receive",`${c} ${r} ${i} ${l}`.trim(),a),this.channels.filter(u=>u._isMember(r)).forEach(u=>u._trigger(i,a,o)),this._triggerStateCallbacks("message",n)})}_clearTimer(t){var n;t==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):t==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t),this.conn.readyState===Kd.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Kd.open||this.conn.readyState===Kd.connecting)try{this.conn.close()}catch(t){this.log("error","Error closing connection",t)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(t=>t.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(n=>{this.log("error","error waiting for auth on connect",n),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this._terminateWorker()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(t){var n;this._setConnectionState("disconnected"),this.log("transport","close",t),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",t)}_onConnError(t){this._setConnectionState("disconnected"),this.log("transport",`${t}`),this._triggerChanError(),this._triggerStateCallbacks("error",t)}_triggerChanError(){this.channels.forEach(t=>t._trigger(rc.error))}_appendParams(t,n){if(Object.keys(n).length===0)return t;const r=t.match(/\?/)?"&":"?",i=new URLSearchParams(n);return`${t}${r}${i}`}_workerObjectUrl(t){let n;if(t)n=t;else{const r=new Blob([fwe],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_setConnectionState(t,n=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(t=null){let n,r=!1;if(t)n=t,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(i){this.log("error","Error fetching access token from callback",i),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(i=>{const a={access_token:n,version:Zbe};n&&i.updateJoinPayload(a),i.joinedOnce&&i._isJoined()&&i._push(rc.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${t}`,n)})}_triggerStateCallbacks(t,n){try{this.stateChangeCallbacks[t].forEach(r=>{try{r(n)}catch(i){this.log("error",`error in ${t} callback`,i)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new SQ(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Xw.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var n,r,i,a,o,l,c,u,d,f,h,p;switch(this.transport=(n=t==null?void 0:t.transport)!==null&&n!==void 0?n:null,this.timeout=(r=t==null?void 0:t.t
872imeout)!==null&&r!==void 0?r:X5,this.heartbeatIntervalMs=(i=t==null?void 0:t.heartbeatIntervalMs)!==null&&i!==void 0?i:Xw.HEARTBEAT_INTERVAL,this.worker=(a=t==null?void 0:t.worker)!==null&&a!==void 0?a:!1,this.accessToken=(o=t==null?void 0:t.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(l=t==null?void 0:t.heartbeatCallback)!==null&&l!==void 0?l:oA,this.vsn=(c=t==null?void 0:t.vsn)!==null&&c!==void 0?c:n$,t!=null&&t.params&&(this.params=t.params),t!=null&&t.logger&&(this.logger=t.logger),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(u=t==null?void 0:t.reconnectAfterMs)!==null&&u!==void 0?u:x=>uwe[x-1]||dwe,this.vsn){case EQ:this.encode=(d=t==null?void 0:t.encode)!==null&&d!==void 0?d:(x,y)=>y(JSON.stringify(x)),this.decode=(f=t==null?void 0:t.decode)!==null&&f!==void 0?f:(x,y)=>y(JSON.parse(x));break;case ewe:this.encode=(h=t==null?void 0:t.encode)!==null&&h!==void 0?h:this.serializer.encode.bind(this.serializer),this.decode=(p=t==null?void 0:t.decode)!==null&&p!==void 0?p:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl}}}var m1=class extends Error{constructor(e,t){var n;super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&((n=t.icebergType)==null?void 0:n.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function mwe(e,t,n){const r=new URL(t,e);if(n)for(const[i,a]of Object.entries(n))a!==void 0&&r.searchParams.set(i,a);return r.toString()}async function pwe(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function gwe(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:i,body:a,headers:o}){const l=mwe(e.baseUrl,r,i),c=await pwe(e.auth),u=await t(l,{method:n,headers:{...a?{"Content-Type":"application/json"}:{},...c,...o},body:a?JSON.stringify(a):void 0}),d=await u.text(),f=(u.headers.get("content-type")||"").includes("application/json"),h=f&&d?JSON.parse(d):d;if(!u.ok){const p=f?h:void 0,x=p==null?void 0:p.error;throw new m1((x==null?void 0:x.message)??`Request failed with status ${u.status}`,{status:u.status,icebergType:x==null?void 0:x.type,icebergCode:x==null?void 0:x.code,details:p})}return{status:u.status,headers:u.headers,data:h}}}}function Qw(e){return e.join("�")}var xwe=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:Qw(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(e,t){const n={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Qw(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Qw(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Qw(e.namespace)}`}),!0}catch(t){if(t instanceof m1&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof m1&&n.status===409)return;throw n}}};function Rp(e){return e.join("�")}var ywe=class{constructor(e,t="",n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Rp(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Rp(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Rp(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Rp(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String((t==null?void 0:t.purge)??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Rp(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Rp(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof m1&&n.status===404)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof m1&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},vwe=class{constructor(e){var r;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=gwe({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(r=e.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new xwe(this.client,t),this.tableOps=new ywe(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}
872async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}},tC=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};function vs(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var bwe=class extends tC{constructor(e,t,n){super(e),this.name="StorageApiError",this.status=t,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Z5=class extends tC{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}};const FI=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),wwe=()=>Response,eT=e=>{if(Array.isArray(e))return e.map(n=>eT(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,r])=>{const i=n.replace(/([-_][a-z])/gi,a=>a.toUpperCase().replace(/[-_]/g,""));t[i]=eT(r)}),t},_we=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},jwe=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e);function p1(e){"@babel/helpers - typeof";return p1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},p1(e)}function Nwe(e,t){if(p1(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(p1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function kwe(e){var t=Nwe(e,"string");return p1(t)=="symbol"?t:t+""}function Cwe(e,t,n){return(t=kwe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Yt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?a$(Object(n),!0).forEach(function(r){Cwe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const lA=e=>{var t;return e.msg||e.message||e.error_description||(typeof e.error=="string"?e.error:(t=e.error)===null||t===void 0?void 0:t.message)||JSON.stringify(e)},Ewe=async(e,t,n)=>{e instanceof await wwe()&&!(n!=null&&n.noResolveJson)?e.json().then(r=>{const i=e.status||500,a=(r==null?void 0:r.statusCode)||i+"";t(new bwe(lA(r),i,a))}).catch(r=>{t(new Z5(lA(r),r))}):t(new Z5(lA(e),e))},Swe=(e,t,n,r)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"||!r?i:(_we(r)?(i.headers=Yt({"Content-Type":"application/json"},t==null?void 0:t.headers),i.body=JSON.stringify(r)):i.body=r,t!=null&&t.duplex&&(i.duplex=t.duplex),Yt(Yt({},i),n))};async function Ib(e,t,n,r,i,a){return new Promise((o,l)=>{e(n,Swe(t,r,i,a)).then(c=>{if(!c.ok)throw c;return r!=null&&r.noResolveJson?c:c.json()}).then(c=>o(c)).catch(c=>Ewe(c,l,r))})}async function g1(e,t,n,r){return Ib(e,"GET",t,n,r)}async function Zl(e,t,n,r,i){return Ib(e,"POST",t,r,i,n)}async function tT(e,t,n,r,i){return Ib(e,"PUT",t,r,i,n)}async function Awe(e,t,n,r){return Ib(e,"HEAD",t,Yt(Yt({},n),{},{noResolveJson:!0}),r)}async function $I(e,t,n,r,i){return Ib(e,"DELETE",t,r,i,n)}var Twe=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(vs(t))return{data:null,error:t};throw t}}};let PQ;PQ=Symbol.toStringTag;var Pwe=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[PQ]="BlobDownloadBuilder",this.promise=null}asStream(){return new Twe(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(vs(t))return{data:null,error:t};throw t}}};const Owe={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},o$={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Dwe=class{constructor(e,t={},n,r){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.bucketId=n,this.fetch=FI(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(e,t,n,r){var i=this;try{let a;const o=Yt(Yt({},o$),r);let l=Yt(Yt({},i.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const c=o.metadata;typeof Blob<"u"&&n instanceof Blob?(a=new FormData,a.append("cacheControl",o.cacheControl),c&&a.append("metadata",i.encodeMetadata(c)),a.append("",n)):typeof FormData<"u"&&n instanceof FormData?(a=n,a.has("cacheControl")||a.append("cacheControl",o.cacheControl),c&&!a.has("metadata")&&a.append("metadata",i.encodeMetadata(c))):(a=n,l["cache-control"]=`max-age=${o.cacheControl}`,l["content-type"]=o.contentType,c&&(l["x-metadata"]=i.toBase64(i.encodeMetadata(c))),(typeof ReadableStream<"u"&&a 
872instanceof ReadableStream||a&&typeof a=="object"&&"pipe"in a&&typeof a.pipe=="function")&&!o.duplex&&(o.duplex="half")),r!=null&&r.headers&&(l=Yt(Yt({},l),r.headers));const u=i._removeEmptyFolders(t),d=i._getFinalPath(u),f=await(e=="PUT"?tT:Zl)(i.fetch,`${i.url}/object/${d}`,a,Yt({headers:l},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{data:{path:u,id:f.Id,fullPath:f.Key},error:null}}catch(a){if(i.shouldThrowOnError)throw a;if(vs(a))return{data:null,error:a};throw a}}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,r){var i=this;const a=i._removeEmptyFolders(e),o=i._getFinalPath(a),l=new URL(i.url+`/object/upload/sign/${o}`);l.searchParams.set("token",t);try{let c;const u=Yt({upsert:o$.upsert},r),d=Yt(Yt({},i.headers),{"x-upsert":String(u.upsert)});return typeof Blob<"u"&&n instanceof Blob?(c=new FormData,c.append("cacheControl",u.cacheControl),c.append("",n)):typeof FormData<"u"&&n instanceof FormData?(c=n,c.append("cacheControl",u.cacheControl)):(c=n,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType),{data:{path:a,fullPath:(await tT(i.fetch,l.toString(),c,{headers:d})).Key},error:null}}catch(c){if(i.shouldThrowOnError)throw c;if(vs(c))return{data:null,error:c};throw c}}async createSignedUploadUrl(e,t){var n=this;try{let r=n._getFinalPath(e);const i=Yt({},n.headers);t!=null&&t.upsert&&(i["x-upsert"]="true");const a=await Zl(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:i}),o=new URL(n.url+a.url),l=o.searchParams.get("token");if(!l)throw new tC("No token returned by API");return{data:{signedUrl:o.toString(),path:e,token:l},error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(vs(r))return{data:null,error:r};throw r}}async update(e,t,n){return this.uploadOrUpdate("PUT",e,t,n)}async move(e,t,n){var r=this;try{return{data:await Zl(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,de
872stinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers}),error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(vs(i))return{data:null,error:i};throw i}}async copy(e,t,n){var r=this;try{return{data:{path:(await Zl(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers})).Key},error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(vs(i))return{data:null,error:i};throw i}}async createSignedUrl(e,t,n){var r=this;try{let i=r._getFinalPath(e),a=await Zl(r.fetch,`${r.url}/object/sign/${i}`,Yt({expiresIn:t},n!=null&&n.transform?{transform:n.transform}:{}),{headers:r.headers});const o=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return a={signedUrl:encodeURI(`${r.url}${a.signedURL}${o}`)},{data:a,error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(vs(i))return{data:null,error:i};throw i}}async createSignedUrls(e,t,n){var r=this;try{const i=await Zl(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:e},{headers:r.headers}),a=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return{data:i.map(o=>Yt(Yt({},o),{},{signedUrl:o.signedURL?encodeURI(`${r.url}${o.signedURL}${a}`):null})),error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(vs(i))return{data:null,error:i};throw i}}download(e,t){const n=typeof(t==null?void 0:t.transform)<"u"?"render/image/authenticated":"object",r=this.transformOptsToQueryString((t==null?void 0:t.transform)||{}),i=r?`?${r}`:"",a=this._getFinalPath(e),o=()=>g1(this.fetch,`${this.url}/${n}/${a}${i}`,{headers:this.headers,noResolveJson:!0});return new Pwe(o,this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);try{return{data:eT(await g1(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(vs(r))return{data:null,error:r};throw r}}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await Awe(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(vs(r)&&r instanceof Z5){const i=r.originalError;if([400,404].includes(i==null?void 0:i.status))return{data:!1,error:r}}throw r}}getPublicUrl(e,t){const n=this._getFinalPath(e),r=[],i=t!=null&&t.download?`download=${t.download===!0?"":t.download}`:"";i!==""&&r.push(i);const a=typeof(t==null?void 0:t.transform)<"u"?"render/image":"object",o=this.transformOptsToQueryString((t==null?void 0:t.transform)||{});o!==""&&r.push(o);let l=r.join("&");return l!==""&&(l=`?${l}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${n}${l}`)}}}async remove(e){var t=this;try{return{data:await $I(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(vs(n))return{data:null,error:n};throw n}}async list(e,t,n){var r=this;try{const i=Yt(Yt(Yt({},Owe),t),{},{prefix:e||""});return{data:await Zl(r.fetch,`${r.url}/object/list/${r.bucketId}`,i,{headers:r.headers},n),error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(vs(i))return{data:null,error:i};throw i}}async listV2(e,t){var n=this;try{const r=Yt({},e);return{data:await Zl(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},t),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(vs(r))return{data:null,error:r};throw r}}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}};const OQ="2.89.0",DQ={"X-Client-Info":`storage-js/${OQ}`};var Iwe=class{constructor(e,t={},n,r){this.shouldThrowOnError=!1;const i=new URL(e);r!=null&&r.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href.replace(/\/$/,""),this.headers=Yt(Yt({},DQ),t),this.fetch=FI(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(e){var t=this;try{const n=t.listBucketOptionsToQueryString(e);return{data:await g1(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(vs(n))return{data:null,error:n};throw n}}async getBucket(e){var t=this;try{return{data:await g1(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(vs(n))return{data:null,error:n};throw n}}async createBucket(e,t={public:!1}){var n=this;try{return{data:await Zl(n.fetch,`${n.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(vs(r))return{data:null,error:r};throw r}}async updateBucket(e,t){var n=this;try{return{data:await tT(n.fetch,`${n.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(vs(r))return{data:null,error:r};throw r}}async emptyBucket(e){var t=this;try{return{data:await Zl(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(vs(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await $I(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(vs(n))return{data:null,error:n};throw n}}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},Rwe=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Yt(Yt({},DQ),t),this.fetch=FI(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(e){var t=this;try{return{data:await Zl(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(vs(n))return{data:null,error:n};throw n}}async listBuckets(e){var t=this;try{const n=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&n.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&n.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&n.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&n.set("sortOrder",e.sortOrder),e!=null&&e.search&&n.set("search",e.search);const r=n.toString(),i=r?`${t.url}/bucket?${r}`:`${t.url}/bucket`;return{data:await g1(t.fetch,i,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(vs(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await $I(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(vs(n))return{data:null,error:n};throw n}}from(e){var t=this;if(!jwe(e))throw new tC("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new vwe({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}
872),r=this.shouldThrowOnError;return new Proxy(n,{get(i,a){const o=i[a];return typeof o!="function"?o:async(...l)=>{try{return{data:await o.apply(i,l),error:null}}catch(c){if(r)throw c;return{data:null,error:c}}}}})}};const BI={"X-Client-Info":`storage-js/${OQ}`,"Content-Type":"application/json"};var IQ=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Fo(e){return typeof e=="object"&&e!==null&&"__isStorageVectorsError"in e}var cA=class extends IQ{constructor(e,t,n){super(e),this.name="StorageVectorsApiError",this.status=t,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Mwe=class extends IQ{constructor(e,t){super(e),this.name="StorageVectorsUnknownError",this.originalError=t}};const zI=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Lwe=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},l$=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),Fwe=async(e,t,n)=>{if(e&&typeof e=="object"&&"status"in e&&"ok"in e&&typeof e.status=="number"&&!(n!=null&&n.noResolveJson)){const r=e.status||500,i=e;if(typeof i.json=="function")i.json().then(a=>{const o=(a==null?void 0:a.statusCode)||(a==null?void 0:a.code)||r+"";t(new cA(l$(a),r,o))}).catch(()=>{const a=r+"";t(new cA(i.statusText||`HTTP ${r} error`,r,a))});else{const a=r+"";t(new cA(i.statusText||`HTTP ${r} error`,r,a))}}else t(new Mwe(l$(e),e))},$we=(e,t,n,r)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};return r?(Lwe(r)?(i.headers=Yt({"Content-Type":"application/json"},t==null?void 0:t.headers),i.body=JSON.stringify(r)):i.body=r,Yt(Yt({},i),n)):i};async function Bwe(e,t,n,r,i,a){return new Promise((o,l)=>{e(n,$we(t,r,i,a)).then(c=>{if(!c.ok)throw c;if(r!=null&&r.noResolveJson)return c;const u=c.headers.get("content-type");return!u||!u.includes("application/json")?{}:c.json()}).then(c=>o(c)).catch(c=>Fwe(c,l,r))})}async function $o(e,t,n,r,i){return Bwe(e,"POST",t,r,i,n)}var zwe=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Yt(Yt({},BI),t),this.fetch=zI(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(e){var t=this;try{return{data:await $o(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Fo(n))return{data:null,error:n};throw n}}async getIndex(e,t){var n=this;try{return{data:await $o(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Fo(r))return{data:null,error:r};throw r}}async listIndexes(e){var t=this;try{return{data:await $o(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Fo(n))return{data:null,error:n};throw n}}async deleteIndex(e,t){var n=this;try{return{data:await $o(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{},error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Fo(r))return{data:null,error:r};throw r}}},Uwe=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Yt(Yt({},BI),t),this.fetch=zI(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(e){var t=this;try{if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await $o(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Fo(n))return{data:null,error:n};throw n}}async getVectors(e){var t=this;try{return{data:await $o(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Fo(n))return{data:null,error:n};throw n}}async listVectors(e){var t=this;try{if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");
872if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return{data:await $o(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Fo(n))return{data:null,error:n};throw n}}async queryVectors(e){var t=this;try{return{data:await $o(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Fo(n))return{data:null,error:n};throw n}}async deleteVectors(e){var t=this;try{if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await $o(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Fo(n))return{data:null,error:n};throw n}}},qwe=class{constructor(e,t={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Yt(Yt({},BI),t),this.fetch=zI(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(e){var t=this;try{return{data:await $o(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Fo(n))return{data:null,error:n};throw n}}async getBucket(e){var t=this;try{return{data:await $o(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Fo(n))return{data:null,error:n};throw n}}async listBuckets(e={}){var t=this;try{return{data:await $o(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Fo(n))return{data:null,error:n};throw n}}async deleteBucket(e){var t=this;try{return{data:await $o(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{},error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Fo(n))return{data:null,error:n};throw n}}},Vwe=class extends qwe{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Hwe(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,n=this;return t().call(n,e)}async getBucket(e){var t=()=>super.getBucket,n=this;return t().call(n,e)}async listBuckets(e={}){var t=()=>super.listBuckets,n=this;return t().call(n,e)}async deleteBucket(e){var t=()=>super.deleteBucket,n=this;return t().call(n,e)}},Hwe=class extends zwe{constructor(e,t,n,r){super(e,t,r),this.vectorBucketName=n}async createIndex(e){var t=()=>super.createIndex,n=this;return t().call(n,Yt(Yt({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,Yt(Yt({},e),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,n=this;return t().call(n,n.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,n=this;return t().call(n,n.vectorBucketName,e)}index(e){return new Wwe(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Wwe=class extends Uwe{constructor(e,t,n,r,i){super(e,t,i),this.vectorBucketName=n,this.indexName=r}async putVectors(e){var t=()=>super.putVectors,n=this;return t().call(n,Yt(Yt({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,Yt(Yt({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,Yt(Yt({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,Yt(Yt({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,Yt(Yt({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},Gwe=class extends Iwe{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new Dwe(this.url,this.headers,e,this.fetch)}get vectors(){return new Vwe(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Rwe(this.url+"/iceberg",this.headers,this.fetch)}};const RQ="2.89.0",Zp=30*1e3,nT=3,uA=nT*Zp,Kwe="http://localhost:9999",Ywe="supabase.auth.token",Xwe={"X-Client-Info":`gotrue-js/${RQ}`},rT="X-Supabase-Api-Version",MQ={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Qwe=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Jwe=10*60*1e3;
872class x1 extends Error{constructor(t,n,r){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}}function Dt(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class Zwe extends x1{constructor(t,n,r){super(t,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function e_e(e){return Dt(e)&&e.name==="AuthApiError"}class Hh extends x1{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class xd extends x1{constructor(t,n,r,i){super(t,r,i),this.name=n,this.status=r}}class Eo extends xd{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function t_e(e){return Dt(e)&&e.name==="AuthSessionMissingError"}class Mp extends xd{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Jw extends xd{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class Zw extends xd{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function n_e(e){return Dt(e)&&e.name==="AuthImplicitGrantRedirectError"}class c$ extends xd{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class r_e extends xd{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class sT extends xd{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function dA(e){return Dt(e)&&e.name==="AuthRetryableFetchError"}class u$ extends xd{constructor(t,n,r){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}}class iT extends xd{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const x2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),d$=` 	
873\r=`.split(""),s_e=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<d$.length;t+=1)e[d$[t].charCodeAt(0)]=-2;for(let t=0;t<x2.length;t+=1)e[x2[t].charCodeAt(0)]=t;return e})();function f$(e,t,n){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(x2[r]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(x2[r]),t.queuedBits-=6}}function LQ(e,t,n){const r=s_e[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;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function h$(e){const t=[],n=o=>{t.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},a=o=>{o_e(o,r,n)};for(let o=0;o<e.length;o+=1)LQ(e.charCodeAt(o),i,a);return t.join("")}function i_e(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function a_e(e,t){for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r>55295&&r<=56319){const i=(r-55296)*1024&65535;r=(e.charCodeAt(n+1)-56320&65535|i)+65536,n+=1}i_e(r,t)}}function o_e(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let r=1;r<6;r+=1)if(!(e>>7-r&1)){t.utf8seq=r;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 new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&n(t.codepoint)}}function qg(e){const t=[],n={queue:0,queuedBits:0},r=i=>{t.push(i)};for(let i=0;i<e.length;i+=1)LQ(e.charCodeAt(i),n,r);return new Uint8Array(t)}function l_e(e){const t=[];return a_e(e,n=>t.push(n)),new Uint8Array(t)}function tm(e){const t=[],n={queue:0,queuedBits:0},r=i=>{t.push(i)};return e.forEach(i=>
873f$(i,n,r)),f$(null,n,r),t.join("")}function c_e(e){return Math.round(Date.now()/1e3)+e}function u_e(){return Symbol("auth-callback")}const Ji=()=>typeof window<"u"&&typeof document<"u",Nh={tested:!1,writable:!1},FQ=()=>{if(!Ji())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Nh.tested)return Nh.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Nh.tested=!0,Nh.writable=!0}catch{Nh.tested=!0,Nh.writable=!1}return Nh.writable};function d_e(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((i,a)=>{t[a]=i})}catch{}return n.searchParams.forEach((r,i)=>{t[i]=r}),t}const $Q=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),f_e=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",eg=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},kh=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},Qi=async(e,t)=>{await e.removeItem(t)};class nC{constructor(){this.promise=new nC.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}nC.promiseConstructor=Promise;function fA(e){const t=e.split(".");if(t.length!==3)throw new iT("Invalid JWT structure");for(let r=0;r<t.length;r++)if(!Qwe.test(t[r]))throw new iT("JWT not in base64url format");return{header:JSON.parse(h$(t[0])),payload:JSON.parse(h$(t[1])),signature:qg(t[2]),raw:{header:t[0],payload:t[1]}}}async function h_e(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function m_e(e,t){return new Promise((r,i)=>{(async()=>{for(let a=0;a<1/0;a++)try{const o=await e(a);if(!t(a,null,o)){r(o);return}}catch(o){if(!t(a,o)){i(o);return}}})()})}function p_e(e){return("0"+e.toString(16)).substr(-2)}function g_e(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let i="";for(let a=0;a<56;a++)i+=n.charAt(Math.floor(Math.random()*r));return i}return crypto.getRandomValues(t),Array.from(t,p_e).join("")}async function x_e(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),i=new Uint8Array(r);return Array.from(i).map(a=>String.fromCharCode(a)).join("")}async function y_e(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const n=await x_e(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Lp(e,t,n=!1){const r=g_e();let i=r;n&&(i+="/PASSWORD_RECOVERY"),await eg(e,`${t}-code-verifier`,i);const a=await y_e(r);return[a,r===a?"plain":"s256"]}const v_e=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function b_e(e){const t=e.headers.get(rT);if(!t||!t.match(v_e))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function w_e(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function __e(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 new Error("Invalid alg claim")}}const j_e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Fp(e){if(!j_e.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function hA(){const e={};return new Proxy(e,{get:(t,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function N_e(e,t){return new Proxy(e,{get:(n,r,i)=>{if(r==="__isInsecureUserWarningProxy")return!0;
873if(typeof r=="symbol"){const a=r.toString();if(a==="Symbol(Symbol.toPrimitive)"||a==="Symbol(Symbol.toStringTag)"||a==="Symbol(util.inspect.custom)"||a==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,i)}return!t.value&&typeof r=="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(n,r,i)}})}function m$(e){return JSON.parse(JSON.stringify(e))}const Lh=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),k_e=[502,503,504];async function p$(e){var t;if(!f_e(e))throw new sT(Lh(e),0);if(k_e.includes(e.status))throw new sT(Lh(e),e.status);let n;try{n=await e.json()}catch(a){throw new Hh(Lh(a),a)}let r;const i=b_e(e);if(i&&i.getTime()>=MQ["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(r==="weak_password")throw new u$(Lh(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(r==="session_not_found")throw new Eo}else 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((a,o)=>a&&typeof o=="string",!0))throw new u$(Lh(n),e.status,n.weak_password.reasons);throw new Zwe(Lh(n),e.status||500,r)}const C_e=(e,t,n,r)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),n))};async function Kt(e,t,n,r){var i;const a=Object.assign({},r==null?void 0:r.headers);a[rT]||(a[rT]=MQ["2024-01-01"].name),r!=null&&r.jwt&&(a.Authorization=`Bearer ${r.jwt}`);const o=(i=r==null?void 0:r.query)!==null&&i!==void 0?i:{};r!=null&&r.redirectTo&&(o.redirect_to=r.redirectTo);const l=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await E_e(e,t,n+l,{headers:a,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(c):{data:Object.assign({},c),error:null}}async function E_e(e,t,n,r,i,a){const o=C_e(t,r,i,a);let l;try{l=await e(n,Object.assign({},o))}catch(c){throw console.error(c),new sT(Lh(c),0)}if(l.ok||await p$(l),r!=null&&r.noResolveJson)return l;try{return await l.json()}catch(c){await p$(c)}}function Kl(e){var t;let n=null;T_e(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=c_e(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:r},error:null}}function g$(e){const t=Kl(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((n,r)=>n&&typeof r=="string",!0)&&(t.data.weak_password=e.weak_password),t}function ef(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function S_e(e){return{data:e,error:null}}function A_e(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:i,verification_type:a}=e,o=k0(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:t,email_otp:n,hashed_token:r,redirect_to:i,verification_type:a},c=Object.assign({},o);return{data:{properties:l,user:c},error:null}}function x$(e){return e}function T_e(e){return e.access_token&&e.refresh_token&&e.expires_in}const mA=["global","local","others"];class P_e{constructor({url:t="",headers:n={},fetch:r}){this.url=t,this.headers=n,this.fetch=$Q(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)}}async signOut(t,n=mA[0]){if(mA.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${mA.join(", ")}`);try{return await Kt(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(r){if(Dt(r))return{data:null,error:r};throw r}}async inviteUserByEmail(t,n={}){try{return await Kt(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:ef})}catch(r){if(Dt(r))return{data:{user:null},error:r};throw r}}async generateLink(t){try{const{options:n}=t,r=k0(t,["options"]),i=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(i.new_email=r==null?void 0:r.newEmail,delete i.newEmail),await Kt(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:A_e,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(Dt(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await Kt(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:ef})}catch(n){if(Dt(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,r,i,a,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await Kt(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(a=(i=t==null?void 0:t.perPage)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:""},xform:x$});if(d.error)throw d.error;const f=await d.json(),h=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,p=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return p.length>
8730&&(p.forEach(x=>{const y=parseInt(x.split(";")[0].split("=")[1].substring(0,1)),b=JSON.parse(x.split(";")[1].split("=")[1]);u[`${b}Page`]=y}),u.total=parseInt(h)),{data:Object.assign(Object.assign({},f),u),error:null}}catch(u){if(Dt(u))return{data:{users:[]},error:u};throw u}}async getUserById(t){Fp(t);try{return await Kt(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:ef})}catch(n){if(Dt(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){Fp(t);try{return await Kt(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:ef})}catch(r){if(Dt(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,n=!1){Fp(t);try{return await Kt(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:ef})}catch(r){if(Dt(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){Fp(t.userId);try{const{data:n,error:r}=await Kt(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:n,error:r}}catch(n){if(Dt(n))return{data:null,error:n};throw n}}async _deleteFactor(t){Fp(t.userId),Fp(t.id);try{return{data:await Kt(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(Dt(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,r,i,a,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await Kt(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(a=(i=t==null?void 0:t.perPage)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:""},xform:x$});if(d.error)throw d.error;const f=await d.json(),h=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,p=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return p.length>0&&(p.forEach(x=>{const y=parseInt(x.split(";")[0].split("=")[1].substring(0,1)),b=JSON.parse(x.split(";")[1].split("=")[1]);u[`${b}Page`]=y}),u.total=parseInt(h)),{data:Object.assign(Object.assign({},f),u),error:null}}catch(u){if(Dt(u))return{data:{clients:[]},error:u};throw u}}async _createOAuthClient(t){try{return await Kt(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Dt(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await Kt(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Dt(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await Kt(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Dt(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(t){try{return await Kt(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Dt(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await Kt(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Dt(n))return{data:null,error:n};throw n}}}function y$(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const $p={debug:!!(globalThis&&FQ()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class BQ extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class O_e extends BQ{}async function D_e(e,t,n){$p.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;return t>0&&setTimeout(()=>{r.abort(),$p.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal}
873,async i=>{if(i){$p.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await n()}finally{$p.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}else{if(t===0)throw $p.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new O_e(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if($p.debug)try{const a=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(a,null,"  "))}catch(a){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",a)}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"),await n()}}))}function I_e(){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 zQ(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function R_e(e){return parseInt(e,16)}function M_e(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function L_e(e){var t;const{chainId:n,domain:r,expirationTime:i,issuedAt:a=new Date,nonce:o,notBefore:l,requestId:c,resources:u,scheme:d,uri:f,version:h}=e;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!f)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(h!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${h}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(`
874`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const p=zQ(e.address),x=d?`${d}://${r}`:r,y=e.statement?`${e.statement}
875`:"",b=`${x} wants you to sign in with your Ethereum account:
876${p}
877
878${y}`;let w=`URI: ${f}
879Version: ${h}
880Chain ID: ${n}${o?`
881Nonce: ${o}`:""}
882Issued At: ${a.toISOString()}`;if(i&&(w+=`
883Expiration Time: ${i.toISOString()}`),l&&(w+=`
884Not Before: ${l.toISOString()}`),c&&(w+=`
885Request ID: ${c}`),u){let _=`
886Resources:`;for(const j of u){if(!j||typeof j!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${j}`);_+=`
887- ${j}`}w+=_}return`${b}
888${w}`}
888class ni extends Error{constructor({message:t,code:n,cause:r,name:i}){var a;super(t,{cause:r}),this.__isWebAuthnError=!0,this.name=(a=i??(r instanceof Error?r.name:void 0))!==null&&a!==void 0?a:"Unknown Error",this.code=n}}class y2 extends ni{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function F_e({error:e,options:t}){var n,r,i;const{publicKey:a}=t;if(!a)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new ni({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=a.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new ni({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((r=a.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new ni({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((i=a.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new ni({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 ni({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new ni({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return a.pubKeyCredParams.filter(l=>l.type==="public-key").length===0?new ni({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new ni({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const o=window.location.hostname;if(UQ(o)){if(a.rp.id!==o)return new ni({message:`The RP ID "${a.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new ni({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(a.user.id.byteLength<1||a.user.id.byteLength>64)return new ni({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 ni({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 ni({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function $_e({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new ni({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new ni({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const r=window.location.hostname;if(UQ(r)){if(n.rpId!==r)return new ni({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new ni({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new ni({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 ni({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class B_e{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const z_e=new B_e;function U_e(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:r}=e,i=k0(e,["challenge","user","excludeCredentials"]),a=qg(t).buffer,o=Object.assign(Object.assign({},n),{id:qg(n.id).buffer}),l=Object.assign(Object.assign({},i),{challenge:a,user:o});if(r&&r.length>0){l.excludeCredentials=new Array(r.length);for(let c=0;c<r.length;c++){const u=r[c];l.excludeCredentials[c]=Object.assign(Object.assign({},u),{id:qg(u.id).buffer,type:u.type||"public-key",transports:u.transports})}}return l}function q_e(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:n}=e,r=k0(e,["challenge","allowCredentials"]),i=qg(t).buffer,a=Object.assign(Object.assign({},r),{challenge:i});if(n&&n.length>0){a.allowCredentials=new Array(n.length);for(let o=0;o<n.length;o++){const l=n[o];a.allowCredentials[o]=Object.assign(Object.assign({},l),{id:qg(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return a}function V_e(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e;return{id:e.id,rawId:e.id,response:{attestationObject:tm(new Uint8Array(e.response.attestationObject)),clientDataJSON:tm(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function H_e(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e,r=e.getClientExtensionResults(),i=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:tm(new Uint8Array(i.authenticatorData)),clientDataJSON:tm(new Uint8Array(i.clientDataJSON)),signature:tm(new Uint8Array(i.signature)),userHandle:i.userHandle?tm(new 
888Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function UQ(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function v$(){var e,t;return!!(Ji()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.get)=="function")}async function W_e(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new y2("Browser returned unexpected credential type",t)}:{data:null,error:new y2("Empty credential response",t)}}catch(t){return{data:null,error:F_e({error:t,options:e})}}}async function G_e(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new y2("Browser returned unexpected credential type",t)}:{data:null,error:new y2("Empty credential response",t)}}catch(t){return{data:null,error:$_e({error:t,options:e})}}}const K_e={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Y_e={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function v2(...e){const t=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),n=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),r={};for(const i of e)if(i)for(const a in i){const o=i[a];if(o!==void 0)if(Array.isArray(o))r[a]=o;else if(n(o))r[a]=o;else if(t(o)){const l=r[a];t(l)?r[a]=v2(l,o):r[a]=v2(o)}else r[a]=o}return r}function X_e(e,t){return v2(K_e,e,t||{})}function Q_e(e,t){return v2(Y_e,e,t||{})}class J_e{constructor(t){this.client=t,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(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:n,friendlyName:r,signal:i},a){try{const{data:o,error:l}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!o)return{data:null,error:l};const c=i??z_e.createNewAbortSignal();if(o.webauthn.type==="create"){const{user:u}=o.webauthn.credential_options.publicKey;u.name||(u.name=`${u.id}:${r}`),u.displayName||(u.displayName=u.name)}switch(o.webauthn.type){case"create":{const u=X_e(o.webauthn.credential_options.publicKey,a==null?void 0:a.create),{data:d,error:f}=await W_e({publicKey:u,signal:c});return d?{data:{factorId:t,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:d}},error:null}:{data:null,error:f}}case"request":{const u=Q_e(o.webauthn.credential_options.publicKey,a==null?void 0:a.request),{data:d,error:f}=await G_e(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:u,signal:c}));return d?{data:{factorId:t,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:d}},error:null}:{data:null,error:f}}}}catch(o){return Dt(o)?{data:null,error:o}:{data:null,error:new Hh("Unexpected error in challenge",o)}}}async _verify({challengeId:t,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:r})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},a){if(!n)return{data:null,error:new x1("rpId is required for WebAuthn authentication")};try{if(!v$())return{data:null,error:new Hh("Browser does not support WebAuthn",null)};const{data:o,error:l}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:r},signal:i},{request:a});if(!o)return{data:null,error:l};const{webauthn:c}=o;return this._verify({factorId:t,challengeId:o.challengeId,webauthn:{type:c.type,rpId:n,rpOrigins:r,credential_response:c.credential_response}})}catch(o){return Dt(o)?{data:null,error:o}:{data:null,error:new Hh("Unexpected error in authenticate",o)}}}async _register({friendlyName:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},a){if(!n)return{data:null,error:new x1("rpId is required for WebAuthn registration")};try{if(!v$())return{data:null,error:new Hh("Browser does not support WebAuthn",null)};const{data:o,error:l}=await this._enroll({friendlyName:t});if(!o)return await this.client.mfa.listFactors().then(d=>{var f;return(f=d.data)===null||f===void 0?void 0:f.all.find(h=>h.factor_type==="webauthn"&&h.friendly_name===t&&h.status!=="unverified")}).then(d=>d?this.client.mfa.unenroll({factorId:d==null?void 0:d.id}):void 0),{data:null,error:l};const{data:c,error:u}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:i},{create:a});return c?this._verify({factorId:o.id,challengeId:c.challengeId,webauthn:{rpId:n,rpOrigins:r,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:u}}catch(o){return Dt(o)?{data:null,error:o}:{data:null,error:new Hh("Unexpected error in register",o)}}}}I_e();const Z_e={url:Kwe,storageKey:Ywe,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Xwe,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function b$(e,t,n){return await n()}const Bp={};class y1{get jwks(){var t,n;return(n=(t=Bp[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){Bp[this.storageKey]=Object.assign(Object.assign({},Bp[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=Bp[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Bp[this.storageKey]=Object.assign(Object.assign({},Bp[this.storageKey]),{cachedAt:t})}constructor(t){var n,r,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=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;const a=Object.assign(Object.assign({},Z_e),t);if(this.storageKey=a.storageKey,this.instanceID=(n=y1.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,y1.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!a.debug,typeof a.debug=="function"&&(this.logger=a.debug),this.instanceID>0&&Ji()){const o=`${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(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=a.persistSession,this.autoRefreshToken=a.autoRefreshToken,this.admin=new P_e({url:a.url,headers:a.headers,fetch:a.fetch}),this.url=a.url,this.headers=a.headers,this.fetch=$Q(a.fetch),this.lock=a.lock||b$,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,this.throwOnError=a.throwOnError,a.lock?this.lock=a.lock:this.persistSession&&Ji()&&(!((r=globalThis==null?void 0:globalThis.navigator)===null||r===void 0)&&r.locks)?this.lock=D_e:this.lock=b$,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),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 J_e(this)}
888,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.persistSession?(a.storage?this.storage=a.storage:FQ()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=y$(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=y$(this.memoryStorage)),Ji()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o),await this._notifyAllSubscribers(o.data.event,o.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${RQ}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{let n={},r="none";if(Ji()&&(n=d_e(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),Ji()&&this.detectSessionInUrl&&r!=="none"){const{data:i,error:a}=await this._getSessionFromURL(n,r);if(a){if(this._debug("#_initialize()","error detecting session from URL",a),n_e(a)){const c=(t=a.details)===null||t===void 0?void 0:t.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:a}}return await this._removeSession(),{error:a}}const{session:o,redirectType:l}=i;return this._debug("#_initialize()","detected session in URL",o,"redirect type",l),await this._saveSession(o),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return Dt(n)?this._returnResult({error:n}):this._returnResult({error:new Hh("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,r,i;try{const a=await Kt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(i=t==null?void 0:t.options)===null||i===void 0?void 0:i.captchaToken}},xform:Kl}),{data:o,error:l}=a;if(l||!o)return this._returnResult({data:{user:null,session:null},error:l});const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(a){if(Dt(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signUp(t){var n,r,i;try{let a;if("email"in t){const{email:d,password:f,options:h}=t;let p=null,x=null;this.flowType==="pkce"&&([p,x]=await Lp(this.storage,this.storageKey)),a=await Kt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:h==null?void 0:h.emailRedirectTo,body:{email:d,password:f,data:(n=h==null?void 0:h.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},code_challenge:p,code_challenge_method:x},xform:Kl})}else if("phone"in t){const{phone:d,password:f,options:h}=t;a=await Kt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:f,data:(r=h==null?void 0:h.data)!==null&&r!==void 0?r:{},channel:(i=h==null?void 0:h.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken}},xform:Kl})}else throw new Jw("You must provide either an email or phone number and a password");const{data:o,error:l}=a;if(l||!o)return await Qi(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:l});const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(a){if(await Qi(this.storage,`${this.storageKey}-code-verifier`),Dt(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithPassword(t){try{let n;if("email"in t){const{email:a,password:o,options:l}=t;n=await Kt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:a,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:g$})}else if("phone"in t){const{phone:a,password:o,options:l}=t;n=await Kt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:a,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:g$})}else throw new Jw("You must provide either an email or phone number and a password");const{data:r,error:i}=n;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!r||!r.session||!r.user){const a=new Mp;return this._returnResult({data:{user:null,session:null},error:a})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:i})}catch(n){if(Dt(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(t){var n,r,i,a;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=t.options)===null||r===void 0?void 0:r.scopes,queryParams:(i=t.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(a=t.o
888ptions)===null||a===void 0?void 0:a.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,r,i,a,o,l,c,u,d,f,h;let p,x;if("message"in t)p=t.message,x=t.signature;else{const{chain:y,wallet:b,statement:w,options:_}=t;let j;if(Ji())if(typeof b=="object")j=b;else{const D=window;if("ethereum"in D&&typeof D.ethereum=="object"&&"request"in D.ethereum&&typeof D.ethereum.request=="function")j=D.ethereum;else throw new 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.")}else{if(typeof b!="object"||!(_!=null&&_.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");j=b}const E=new URL((n=_==null?void 0:_.url)!==null&&n!==void 0?n:window.location.href),S=await j.request({method:"eth_requestAccounts"}).then(D=>D).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!S||S.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const T=zQ(S[0]);let P=(r=_==null?void 0:_.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!P){const D=await j.request({method:"eth_chainId"});P=R_e(D)}const O={domain:E.host,address:T,statement:w,uri:E.href,version:"1",chainId:P,nonce:(i=_==null?void 0:_.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(o=(a=_==null?void 0:_.signInWithEthereum)===null||a===void 0?void 0:a.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(l=_==null?void 0:_.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(c=_==null?void 0:_.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(u=_==null?void 0:_.signInWithEthereum)===null||u===void 0?void 0:u.requestId,resources:(d=_==null?void 0:_.signInWithEthereum)===null||d===void 0?void 0:d.resources};p=L_e(O),x=await j.request({method:"personal_sign",params:[M_e(p),T]})}try{const{data:y,error:b}=await Kt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:x},!((f=t.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(h=t.options)===null||h===void 0?void 0:h.captchaToken}}:null),xform:Kl});if(b)throw b;if(!y||!y.session||!y.user){const w=new Mp;return this._returnResult({data:{user:null,session:null},error:w})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:b})}catch(y){if(Dt(y))return this._returnResult({data:{user:null,session:null},error:y});throw y}}async signInWithSolana(t){var n,r,i,a,o,l,c,u,d,f,h,p;let x,y;if("message"in t)x=t.message,y=t.signature;else{const{chain:b,wallet:w,statement:_,options:j}=t;let E;if(Ji())if(typeof w=="object")E=w;else{const T=window;if("solana"in T&&typeof T.solana=="object"&&("signIn"in T.solana&&typeof T.solana.signIn=="function"||"signMessage"in T.solana&&typeof T.solana.signMessage=="function"))E=T.solana;else throw new 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.")}else{if(typeof w!="object"||!(j!=null&&j.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");E=w}const S=new URL((n=j==null?void 0:j.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in E&&E.signIn){const T=await E.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},j==null?void 0:j.signInWithSolana),{version:"1",domain:S.host,uri:S.href}),_?{statement:_}:null));let P;if(Array.isArray(T)&&T[0]&&typeof T[0]=="object")P=T[0];else if(T&&typeof T=="object"&&"signedMessage"in T&&"signature"in T)P=T;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in P&&"signature"in P&&(typeof P.signedMessage=="string"||P.signedMessage instanceof Uint8Array)&&P.signature instanceof Uint8Array)x=typeof P.signedMessage=="string"?P.signedMessage:new TextDecoder().decode(P.signedMessage),y=P.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in E)||typeof E.signMessage!="function"||!("publicKey"in E)||typeof E!="object"||!E.publicKey||!("toBase58"in E.publicKey)||typeof E.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");x=[`${S.host} wants you to sign in with your Solana account:`,E.publicKey.toBase58(),..._?["",_,""]:[""],"Version: 1",`URI: ${S.href}`,`Issued At: ${(i=(r=j==null?void 0:j.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((a=j==null?void 0:j.signInWithSolana)===null||a===void 0)&&a.notBefore?[`Not Before: ${j.signInWithSolana.notBefore}`]:[],...!((o=j==null?void 0:j.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${j.signInWithSolana.expirationTime}`]:[],...!((l=j==null?void 0:j.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${j.signInWithSolana.chainId}`]:[],...!((c=j==null?void 0:j.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${j.signInWithSolana.nonce}`]:[],...!((u=j==null?void 0:j.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${j.signInWithSolana.requestId}`]:[],...!((f=(d=j==null?void 0:j.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||f===void 0)&&f.length?["Resources",...j.sign
888InWithSolana.resources.map(P=>`- ${P}`)]:[]].join(`
889`);const T=await E.signMessage(new TextEncoder().encode(x),"utf8");if(!T||!(T instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=T}}try{const{data:b,error:w}=await Kt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:x,signature:tm(y)},!((h=t.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(p=t.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:Kl});if(w)throw w;if(!b||!b.session||!b.user){const _=new Mp;return this._returnResult({data:{user:null,session:null},error:_})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:w})}catch(b){if(Dt(b))return this._returnResult({data:{user:null,session:null},error:b});throw b}}async _exchangeCodeForSession(t){const n=await kh(this.storage,`${this.storageKey}-code-verifier`),[r,i]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new r_e;const{data:a,error:o}=await Kt(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:r},xform:Kl});if(await Qi(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!a||!a.session||!a.user){const l=new Mp;return this._returnResult({data:{user:null,session:null,redirectType:null},error:l})}return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),this._returnResult({data:Object.assign(Object.assign({},a),{redirectType:i??null}),error:o})}catch(a){if(await Qi(this.storage,`${this.storageKey}-code-verifier`),Dt(a))return this._returnResult({data:{user:null,session:null,redirectType:null},error:a});throw a}}async signInWithIdToken(t){try{const{options:n,provider:r,token:i,access_token:a,nonce:o}=t,l=await Kt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:i,access_token:a,nonce:o,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:Kl}),{data:c,error:u}=l;if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!c||!c.session||!c.user){const d=new Mp;return this._returnResult({data:{user:null,session:null},error:d})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:c,error:u})}catch(n){if(Dt(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(t){var n,r,i,a,o;try{if("email"in t){const{email:l,options:c}=t;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await Lp(this.storage,this.storageKey));const{error:f}=await Kt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(n=c==null?void 0:c.data)!==null&&n!==void 0?n:{},create_user:(r=c==null?void 0:c.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:u,code_challenge_method:d},redirectTo:c==null?void 0:c.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:f})}if("phone"in t){const{phone:l,options:c}=t,{data:u,error:d}=await Kt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(i=c==null?void 0:c.data)!==null&&i!==void 0?i:{},create_user:(a=c==null?void 0:c.shouldCreateUser)!==null&&a!==void 0?a:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(o=c==null?void 0:c.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:d})}throw new Jw("You must provide either an email or phone number.")}catch(l){if(await Qi(this.storage,`${this.storageKey}-code-verifier`),Dt(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async verifyOtp(t){var n,r;try{let i,a;"options"in t&&(i=(n=t.options)===null||n===void 0?void 0:n.redirectTo,a=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:o,error:l}=await Kt(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:a}}),redirectTo:i,xform:Kl});if(l)throw l;if(!o)throw new Error("An error occurred on token verification.");const c=o.session,u=o.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(i){if(Dt(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(t){var n,r,i,a,o;try{let l=null,c=null;this.flowType==="pkce"&&([l,c]=await Lp(this.storage,this.storageKey));const u=await Kt(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(r=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((i=t==null?void 0:t.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:l,code_challenge_method:c}),headers:this.headers,xform:S_e});return!((a=u.data)===null||a===void 0)&&a.url&&Ji()&&!(!((o=t.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(u.data.url),this._returnResult(u)}catch(l){if(await Qi(this.storage,`${this.storageKey}-code-verifier`),Dt(l))return this._returnResult({data:null,error:l});throw l}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)throw r;if(!n)throw new Eo;const{error:i}=await Kt(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(t){if(Dt(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:r,type:i,options:a}=t,{error:o}=await Kt(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:i,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},redirectTo:a==null?void 0:a.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in t){const{phone:r,type:i,options:a}=t,{data:o,error:l}=await Kt(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:i,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:l})}throw new Jw("You must provide either an email or phone number and a type")}catch(n){if(Dt(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const n=await kh(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not val
889id"),await this._removeSession())),!t)return{data:{session:null},error:null};const r=t.expires_at?t.expires_at*1e3-Date.now()<uA:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r){if(this.userStorage){const o=await kh(this.userStorage,this.storageKey+"-user");o!=null&&o.user?t.user=o.user:t.user=hA()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};t.user=N_e(t.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:i,error:a}=await this._callRefreshToken(t.refresh_token);return a?this._returnResult({data:{session:null},error:a}):this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const n=await this._acquireLock(-1,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(t){try{return t?await Kt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:ef}):await this._useSession(async n=>{var r,i,a;const{data:o,error:l}=n;if(l)throw l;return!(!((r=o.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Eo}:await Kt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(a=(i=o.session)===null||i===void 0?void 0:i.access_token)!==null&&a!==void 0?a:void 0,xform:ef})})}catch(n){if(Dt(n))return t_e(n)&&(await this._removeSession(),await Qi(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async r=>{const{data:i,error:a}=r;if(a)throw a;if(!i.session)throw new Eo;const o=i.session;let l=null,c=null;this.flowType==="pkce"&&t.email!=null&&([l,c]=await Lp(this.storage,this.storageKey));const{data:u,error:d}=await Kt(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:l,code_challenge_method:c}),jwt:o.access_token,xform:ef});if(d)throw d;return o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(r){if(await Qi(this.storage,`${this.storageKey}-code-verifier`),Dt(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new Eo;const n=Date.now()/1e3;let r=n,i=!0,a=null;const{payload:o}=fA(t.access_token);if(o.exp&&(r=o.exp,i=r<=n),i){const{data:l,error:c}=await this._callRefreshToken(t.refresh_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l)return{data:{user:null,session:null},error:null};a=l}else{const{data:l,error:c}=await this._getUser(t.access_token);if(c)throw c;a={access_token:t.access_token,refresh_token:t.refresh_token,user:l.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)}return this._returnResult({data:{user:a.user,session:a},error:null})}catch(n){if(Dt(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var r;if(!t){const{data:o,error:l}=n;if(l)throw l;t=(r=o.session)!==null&&r!==void 0?r:void 0}if(!(t!=null&&t.refresh_token))throw new Eo;const{data:i,error:a}=await this._callRefreshToken(t.refresh_token);return a?this._returnResult({data:{user:null,session:null},error:a}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(Dt(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(t,n){try{if(!Ji())throw new Zw("No browser detected.");
889if(t.error||t.error_description||t.error_code)throw new Zw(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new c$("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Zw("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new c$("No code detected.");const{data:_,error:j}=await this._exchangeCodeForSession(t.code);if(j)throw j;const E=new URL(window.location.href);return E.searchParams.delete("code"),window.history.replaceState(window.history.state,"",E.toString()),{data:{session:_.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:a,refresh_token:o,expires_in:l,expires_at:c,token_type:u}=t;if(!a||!l||!o||!u)throw new Zw("No session defined in URL");const d=Math.round(Date.now()/1e3),f=parseInt(l);let h=d+f;c&&(h=parseInt(c));const p=h-d;p*1e3<=Zp&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${f}s`);const x=h-f;d-x>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",x,h,d):d-x<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",x,h,d);const{data:y,error:b}=await this._getUser(a);if(b)throw b;const w={provider_token:r,provider_refresh_token:i,access_token:a,expires_in:f,expires_at:h,refresh_token:o,token_type:u,user:y.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:w,redirectType:t.type},error:null})}catch(r){if(Dt(r))return this._returnResult({data:{session:null,redirectType:null},error:r});throw r}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const n=await kh(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:i,error:a}=n;if(a)return this._returnResult({error:a});const o=(r=i.session)===null||r===void 0?void 0:r.access_token;if(o){const{error:l}=await this.admin.signOut(o,t);if(l&&!(e_e(l)&&(l.status===404||l.status===401||l.status===403)))return this._returnResult({error:l})}return t!=="others"&&(await this._removeSession(),await Qi(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const n=u_e(),r={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async n=>{var r,i;try{const{data:{session:a},error:o}=n;if(o)throw o;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",a)),this._debug("INITIAL_SESSION","callback id",t,"session",a)}catch(a){await((i=this.stateChangeEmitters.get(t))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",a),console.error(a)}})}async resetPasswordForEmail(t,n={}){let r=null,i=null;this.flowType==="pkce"&&([r,i]=await Lp(this.storage,this.storageKey,!0));try{return await Kt(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:r,code_challenge_method:i,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(a){if(await Qi(this.storage,`${this.storageKey}-code-verifier`),Dt(a))return this._returnResult({data:null,error:a});throw a}}async getUserIdentities(){var t;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(n){if(Dt(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:r,error:i}=await this._useSession(async a=>{var o,l,c,u,d;const{data:f,error:h}=a;if(h)throw h;const p=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(o=t.options)===null||o===void 0?void 0:o.redirectTo,scopes:(l=t.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=t.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await Kt(this.fetch,"GET",p,{headers:this.headers,jwt:(d=(u=f.session)===null||u===void 0?void 0:u.access_token)!==null&&d!==void 0?d:void 0})});if(i)throw i;return Ji()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),this._returnResult({data:{provider:t.provider,url:r==null?void 0:r.url},error:null})}catch(r){if(Dt(r))return this._returnResult({data:{provider:t.provider,url:null},error:r});throw r}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var r;try{const{error:i,data:{session:a}}=n;if(i)throw i;const{options:o,provider:l,token:c,access_token:u,nonce:d}=t,f=await Kt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=a==null?void 0:a.access_token)!==null&&r!==void 0?r:void 0,body:{provider:l,id_token:c,access_token:u,nonce:d,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:Kl}),{data:h,error:p}=f;return p?this._returnResult({data:{user:null,session:null},error:p}):!h||!h.session||!h.user?this._returnResult({data:{user:null,session:null},error:new Mp}):(h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("USER_UPDATED",h.session)),this._returnResult({data:h,error:p}))}catch(i){if(await Qi(this.storage,`${this.storageKey}-code-verifier`),Dt(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var r,i;const{data:a,error:o}=n;
889if(o)throw o;return await Kt(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(i=(r=a.session)===null||r===void 0?void 0:r.access_token)!==null&&i!==void 0?i:void 0})})}catch(n){if(Dt(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await m_e(async i=>(i>0&&await h_e(200*Math.pow(2,i-1)),this._debug(n,"refreshing attempt",i),await Kt(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:Kl})),(i,a)=>{const o=200*Math.pow(2,i);return a&&dA(a)&&Date.now()+o-r<Zp})}catch(r){if(this._debug(n,"error",r),Dt(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(n,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",n,"url",r),Ji()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:t,url:r},error:null}}async _recoverAndRefresh(){var t,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const i=await kh(this.storage,this.storageKey);if(i&&this.userStorage){let o=await kh(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:i.user},await eg(this.userStorage,this.storageKey+"-user",o)),i.user=(t=o==null?void 0:o.user)!==null&&t!==void 0?t:hA()}else if(i&&!i.user&&!i.user){const o=await kh(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(i.user=o.user,await Qi(this.storage,this.storageKey+"-user"),await eg(this.storage,this.storageKey,i)):i.user=hA()}if(this._debug(r,"session from storage",i),!this._isValidSession(i)){this._debug(r,"session is not valid"),i!==null&&await this._removeSession();return}const a=((n=i.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<uA;if(this._debug(r,`session has${a?"":" not"} expired with margin of ${uA}s`),a){if(this.autoRefreshToken&&i.refresh_token){const{error:o}=await this._callRefreshToken(i.refresh_token);o&&(console.error(o),dA(o)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:l}=await this._getUser(i.access_token);!l&&(o!=null&&o.user)?(i.user=o.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(r,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(r,"error",i),console.error(i);return}finally{this._debug(r,"end")}}async _callRefreshToken(t){var n,r;if(!t)throw new Eo;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const i=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new nC;const{data:a,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!a.session)throw new Eo;await this._saveSession(a.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",a.session);const l={data:a.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(a){if(this._debug(i,"error",a),Dt(a)){const o={data:null,error:a};return dA(a)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(o),o}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(a),a}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(t,n,r=!0){const i=`#_notifyAllSubscribers(${t})`;this._debug(i,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:t,session:n});const a=[],o=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(t,n)}catch(c){a.push(c)}});if(await Promise.all(o),a.length>0){for(let l=0;l<a.length;l+=1)console.error(a[l]);throw a[0]}}finally{this._debug(i,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await Qi(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},t),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await eg(this.userStorage,this.storageKey+"-user",{user:n.user});const i=Object.assign({},n);delete i.user;const a=m$(i);await eg(this.storage,this.storageKey,a)}else{const i=m$(n);await eg(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Qi(this.storage,this.storageKey),await Qi(this.storage,this.storageKey+"-code-verifier"),await Qi(this.storage,this.storageKey+"-user"),this.userStorage&&await Qi(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Ji()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}
889catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Zp);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(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{const t=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((r.expires_at*1e3-t)/Zp);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${Zp}ms, refresh threshold is ${nT} ticks`),i<=nT&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof BQ)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ji()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,n,r){const i=[`provider=${encodeURIComponent(n)}`];if(r!=null&&r.redirectTo&&i.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&i.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[a,o]=await Lp(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(a)}`,code_challenge_method:`${encodeURIComponent(o)}`});i.push(l.toString())}if(r!=null&&r.queryParams){const a=new URLSearchParams(r.queryParams);i.push(a.toString())}return r!=null&&r.skipBrowserRedirect&&i.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${t}?${i.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var r;const{data:i,error:a}=n;return a?this._returnResult({data:null,error:a}):await Kt(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(Dt(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(t){try{return await this._useSession(async n=>{var r,i;const{data:a,error:o}=n;if(o)return this._returnResult({data:null,error:o});const l=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:c,error:u}=await Kt(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(r=a==null?void 0:a.session)===null||r===void 0?void 0:r.access_token});return u?this._returnResult({data:null,error:u}):(t.factorType==="totp"&&c.type==="totp"&&(!((i=c==null?void 0:c.totp)===null||i===void 0)&&i.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),this._returnResult({data:c,error:null}))})}catch(n){if(Dt(n))return this._returnResult({data:null,error:n});throw n}}async _verify(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:a}=n;
889if(a)return this._returnResult({data:null,error:a});const o=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?V_e(t.webauthn.credential_response):H_e(t.webauthn.credential_response)})}:{code:t.code}),{data:l,error:c}=await Kt(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:o,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return c?this._returnResult({data:null,error:c}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+l.expires_in},l)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),this._returnResult({data:l,error:c}))})}catch(n){if(Dt(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:a}=n;if(a)return this._returnResult({data:null,error:a});const o=await Kt(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});if(o.error)return o;const{data:l}=o;if(l.type!=="webauthn")return{data:l,error:null};switch(l.webauthn.type){case"create":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:U_e(l.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:q_e(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(Dt(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(t){const{data:n,error:r}=await this._challenge({factorId:t.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const i={all:[],phone:[],totp:[],webauthn:[]};for(const a of(t=n==null?void 0:n.factors)!==null&&t!==void 0?t:[])i.all.push(a),a.status==="verified"&&i[a.factor_type].push(a);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(){var t,n;const{data:{session:r},error:i}
889=await this.getSession();if(i)return this._returnResult({data:null,error:i});if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:a}=fA(r.access_token);let o=null;a.aal&&(o=a.aal);let l=o;((n=(t=r.user.factors)===null||t===void 0?void 0:t.filter(d=>d.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(l="aal2");const u=a.amr||[];return{data:{currentLevel:o,nextLevel:l,currentAuthenticationMethods:u},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;return i?this._returnResult({data:null,error:i}):r?await Kt(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:r.access_token,xform:a=>({data:a,error:null})}):this._returnResult({data:null,error:new Eo})})}catch(n){if(Dt(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:i},error:a}=r;if(a)return this._returnResult({data:null,error:a});if(!i)return this._returnResult({data:null,error:new Eo});const o=await Kt(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:l=>({data:l,error:null})});return o.data&&o.data.redirect_url&&Ji()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(Dt(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:i},error:a}=r;if(a)return this._returnResult({data:null,error:a});if(!i)return this._returnResult({data:null,error:new Eo});const o=await Kt(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:l=>({data:l,error:null})});return o.data&&o.data.redirect_url&&Ji()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(Dt(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?await Kt(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Eo})})}catch(t){if(Dt(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;return i?this._returnResult({data:null,error:i}):r?(await Kt(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Eo})})}catch(n){if(Dt(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(t,n={keys:[]}){let r=n.keys.find(l=>l.kid===t);if(r)return r;const i=Date.now();if(r=this.jwks.keys.find(l=>l.kid===t),r&&this.jwks_cached_at+Jwe>i)return r;const{data:a,error:o}=await Kt(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=i,r=a.keys.find(l=>l.kid===t),!r)?null:r}async getClaims(t,n={}){try{let r=t;if(!r){const{data:p,error:x}
889=await this.getSession();if(x||!p.session)return this._returnResult({data:null,error:x});r=p.session.access_token}const{header:i,payload:a,signature:o,raw:{header:l,payload:c}}=fA(r);n!=null&&n.allowExpired||w_e(a.exp);const u=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!u){const{error:p}=await this.getUser(r);if(p)throw p;return{data:{claims:a,header:i,signature:o},error:null}}const d=__e(i.alg),f=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,f,o,l_e(`${l}.${c}`)))throw new iT("Invalid JWT signature");return{data:{claims:a,header:i,signature:o},error:null}}catch(r){if(Dt(r))return this._returnResult({data:null,error:r});throw r}}}y1.nextInstanceID={};const eje=y1,tje="2.89.0";let nv="";typeof Deno<"u"?nv="deno":typeof document<"u"?nv="web":typeof navigator<"u"&&navigator.product==="ReactNative"?nv="react-native":nv="node";const nje={"X-Client-Info":`supabase-js-${nv}/${tje}`},rje={headers:nje},sje={schema:"public"},ije={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},aje={};function v1(e){"@babel/helpers - typeof";return v1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v1(e)}function oje(e,t){if(v1(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(v1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lje(e){var t=oje(e,"string");return v1(t)=="symbol"?t:t+""}function cje(e,t,n){return(t=lje(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Os(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?w$(Object(n),!0).forEach(function(r){cje(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w$(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const uje=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),dje=()=>Headers,fje=(e,t,n)=>{const r=uje(n),i=dje();return async(a,o)=>{var l;const c=(l=await t())!==null&&l!==void 0?l:e;let u=new i(o==null?void 0:o.headers);return u.has("apikey")||u.set("apikey",e),u.has("Authorization")||u.set("Authorization",`Bearer ${c}`),r(a,Os(Os({},o),{},{headers:u}))}};function hje(e){return e.endsWith("/")?e:e+"/"}function mje(e,t){var n,r;const{db:i,auth:a,realtime:o,global:l}=e,{db:c,auth:u,realtime:d,global:f}=t,h={db:Os(Os({},c),i),auth:Os(Os({},u),a),realtime:Os(Os({},d),o),storage:{},global:Os(Os(Os({},f),l),{},{headers:Os(Os({},(n=f==null?void 0:f.headers)!==null&&n!==void 0?n:{}),(r=l==null?void 0:l.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return e.accessToken?h.accessToken=e.accessToken:delete h.accessToken,h}function pje(e){const t=e==null?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(hje(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var gje=class extends eje{constructor(e){super(e)}},xje=class{constructor(e,t,n){var r,i;this.supabaseUrl=e,this.supabaseKey=t;const a=pje(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const o=`sb-${a.hostname.split(".")[0]}-auth-token`,l={db:sje,realtime:aje,auth:Os(Os({},ije),{},{storageKey:o}),global:rje},c=mje(n??{},l);if(this.storageKey=(r=c.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(i=c.global.headers)!==null&&i!==void 0?i:{},c.accessToken)this.accessToken=c.accessToken,this.auth=new Proxy({},{get:(d,f)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(f)} is not possible`)}});else{var u;this.auth=this._initSupabaseAuthClient((u=c.auth)!==null&&u!==void 0?u:{},this.headers,c.global.fetch)}this.fetch=fje(t,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(Os({headers:this.headers,accessToken:this._getAccessToken.bind(this)},c.realtime)),this.accessToken&&this.accessToken().then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new Xbe(new URL("rest/v1",a).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch}),this.storage=new Gwe(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),c.accessToken||this._listenForAuthEvents()}get functions(){return new Hbe(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)}
889channel(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();const{data:r}=await e.auth.getSession();return(t=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:i,storageKey:a,flowType:o,lock:l,debug:c,throwOnError:u},d,f){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new gje({url:this.authUrl.href,headers:Os(Os({},h),d),storageKey:a,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:i,flowType:o,lock:l,debug:c,throwOnError:u,fetch:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(p=>p.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new hwe(this.realtimeUrl.href,Os(Os({},e),{},{params:Os(Os({},{apikey:this.supabaseKey}),e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t==null?void 0: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)}};const yje=(e,t,n)=>new xje(e,t,n);function vje(){if(typeof window<"u"||typeof process>"u")return!1;const e=process.version;if(e==null)return!1;const t=e.match(/^v(\d+)\./);return t?parseInt(t[1],10)<=18:!1}vje()&&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");function bje(){var b,w;if(typeof window>"u")return;const e=location.hostname,n=["lovableproject.com","lovableproject-dev.com","lovable.app","gpt-eng.com","gptengineer.run"].some(_=>e===_||e.endsWith("."+_)),r="[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}",i=n?((b=e.match(new RegExp("^(?:id-preview(?:-[a-z0-9]+)?|project)--("+r+")(?:-dev)?(?=\\.|$)","i")))==null?void 0:b[1])??((w=e.match(new RegExp("^("+r+")(?=[.-])","i")))==null?void 0:w[1]):void 0,a=window.parent&&window.parent!==window;if(!i||!a)return localStorage;const o=e.endsWith(".lovableproject-dev.com")||e.endsWith(".gpt-eng.com"),l=o?/^https:\/\/([a-z0-9-]+\.)*(lovable\.dev|gptengineer\.app)$|^http:\/\/localhost:3000$/:/^https:\/\/([a-z0-9-]+\.)*(lovable\.dev|gptengineer\.app)$/,c=location.ancestorOrigins&&location.ancestorOrigins[0]||(document.referrer?new URL(document.referrer).origin:""),u=c&&l.test(c)?[c]:o?["https://lovable.dev","http://localhost:3000"]:["https://lovable.dev"],d="lovable-preview-auth:result",f=2e3,h=()=>Math.random().toString(36).slice(2)+Date.now().toString(36),p=(_,j,E)=>new Promise(S=>{const T=h();let P=!1,O;const D=M=>{P||(P=!0,clearTimeout(O),window.removeEventListener("message",R),S(M))},R=M=>{if(u.indexOf(M.origin)<0)return;const B=M.data;B&&B.type===d&&B.requestId===T&&D(B)};window.addEventListener("message",R);const L={type:_,requestId:T,projectId:i,key:j};E!==void 0&&(L.value=E);for(const M of u)window.parent.postMessage(L,M);O=setTimeout(()=>D(null),f)});let x=!0;const y=250;return{getItem:async _=>{let j=await p("lovable-preview-auth:get",_);return!j&&x&&(await new Promise(E=>setTimeout(E,y)),j=await p("lovable-preview-auth:get",_)),x=!1,j&&j.ok&&typeof j.value=="string"?j.value===""?(localStorage.removeItem(_),null):j.value:localStorage.getItem(_)},setItem:(_,j)=>(localStorage.setItem(_,j),p("lovable-preview-auth:set",_,j).then(()=>{})),removeItem:_=>(localStorage.removeItem(_),p("lovable-preview-auth:remove",_).then(()=>{}))}}const wje="https://panllzgwiadaxweewisk.supabase.co",_je="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBhbmxsemd3aWFkYXh3ZWV3aXNrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjY4MjE5MjYsImV4cCI6MjA4MjM5NzkyNn0.M_VA_bQ5gqQeiyHbxzjiMZhcIB1U_kCH02dKBar45Jg",re=yje(wje,_je,{auth:{storage:bje(),persistSession:!0,autoRefreshToken:!0}}),qQ=N.createContext(void 0);function jje({children:e}){const[t,n]=N.useState(null),[r,i]=N.useState(null),[a,o]=N.useState(null),[l,c]=N.useState([]),[u,d]=N.useState(!0),f=N.useCallback(async _=>{try{const{data:j,error:E}=await re.from("profiles").select("*").eq("id",_).maybeSingle();return E?(console.error("Error fetching profile:",E),null):j}catch(j){return console.error("Error in fetchProfile:",j),null}},[]),h=N.useCallback(async _=>{try{const{data:j,error:E}=await re.from("user_roles").select("role").eq("user_id",_);return E?(console.error("Error fetching roles:",E),[]):(j||[]).map(S=>S.role)}catch(j){return console.error("Error in fetchRoles:",j),[]}},[]),p=N.useCallback(async()=>
889{if(!t)return;const[_,j]=await Promise.all([f(t.id),h(t.id)]);o(_),c(j)},[t,f,h]),x=N.useCallback(async(_,j,E)=>{const S=`${window.location.origin}/`,{error:T}=await re.auth.signUp({email:_,password:j,options:{emailRedirectTo:S,data:E}});return{error:T}},[]),y=N.useCallback(async(_,j)=>{const{error:E}=await re.auth.signInWithPassword({email:_,password:j});return{error:E}},[]),b=N.useCallback(async()=>{await re.auth.signOut(),n(null),i(null),o(null),c([])},[]);N.useEffect(()=>{const{data:{subscription:_}}=re.auth.onAuthStateChange((j,E)=>{i(E),n((E==null?void 0:E.user)??null),E!=null&&E.user?setTimeout(async()=>{const[S,T]=await Promise.all([f(E.user.id),h(E.user.id)]);o(S),c(T),d(!1)},0):(o(null),c([]),d(!1))});return re.auth.getSession().then(({data:{session:j}})=>{i(j),n((j==null?void 0:j.user)??null),j!=null&&j.user?Promise.all([f(j.user.id),h(j.user.id)]).then(([E,S])=>{o(E),c(S),d(!1)}):d(!1)}),()=>_.unsubscribe()},[f,h]);const w={user:t,session:r,profile:a,roles:l,isLoading:u,isAdmin:l.includes("admin"),isVenue:l.includes("venue"),isPlayer:l.includes("player"),signUp:x,signIn:y,signOut:b,refreshProfile:p};return s.jsx(qQ.Provider,{value:w,children:e})}function Tt(){const e=N.useContext(qQ);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e}function Nje(){const{pathname:e}=fa();return N.useLayoutEffect(()=>{window.scrollTo({top:0,left:0,behavior:"instant"})},[e]),null}const kje=dp("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function we({className:e,variant:t,...n}){return s.jsx("div",{className:ae(kje({variant:t}),e),...n})}function Cje(){const{user:e,isLoading:t}=Tt(),n=Ye();return N.useEffect(()=>{if(!(e!=null&&e.id))return;const r=re.channel("active-tournament-events").on("postgres_changes",{event:"UPDATE",schema:"public",table:"events"},i=>{var a,o;((a=i.old)==null?void 0:a.status)!==((o=i.new)==null?void 0:o.status)&&setTimeout(()=>{n.invalidateQueries({queryKey:["active-tournament-light",e.id]})},0)}).subscribe();return()=>{re.removeChannel(r)}},[e==null?void 0:e.id,n]),st({queryKey:["active-tournament-light",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return null;const{data:r,error:i}=await re.from("checkins").select(`
890          ticket:tickets!inner(
891            user_id,
892            is_for_self,
893            event:events!inner(
894              id,
895              title,
896              status,
897              rounds_count,
898              venue:venues!inner(name)
899            )
900          )
901        `).eq("ticket.user_id",e.id).eq("ticket.is_for_self",!0).eq("ticket.event.status","ongoing").limit(1).maybeSingle();if(i||!r)return null;const a=Array.isArray(r.ticket)?r.ticket[0]:r.ticket,o=a?Array.isArray(a.event)?a.event[0]:a.event:null,l=o?Array.isArray(o.venue)?o.venue[0]:o.venue:null;if(!o)return null;const{data:c}=await re.from("rounds").select("round_number").eq("event_id",o.id).order("round_number",{ascending:!1}).limit(1).maybeSingle();return{eventId:o.id,eventTitle:o.title,venueName:(l==null?void 0:l.name)||"",currentRound:(c==null?void 0:c.round_number)||0,totalRounds:o.rounds_count||4}},enabled:!!(e!=null&&e.id)&&!t,staleTime:3e4,gcTime:10*60*1e3,placeholderData:hp,refetchOnWindowFocus:!0,refetchInterval:!1})}function Eje(){const e=fa(),{user:t}=Tt(),{data:n}=Cje(),r=e.pathname.startsWith("/player/tournament")||e.pathname.includes("/tournament"),i=e.pathname.startsWith("/admin");return N.useEffect(()=>(n&&!r&&!i?document.body.classList.add("has-tournament-banner"):document.body.classList.remove("has-tournament-banner"),()=>document.body.classList.remove("has-tournament-banner")),[n,r,i]),!t||r||i||!n?null:s.jsx("div",{className:"fixed top-16 left-0 right-0 z-40 animate-in slide-in-from-top-2 duration-300",children:s.jsx("div",{className:"bg-primary/95 backdrop-blur-sm border-b border-primary-foreground
901/20 shadow-lg",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs(Pe,{to:`/player/tournament/${n.eventId}`,className:"flex items-center justify-between gap-3 py-2.5 text-primary-foreground min-h-[44px]",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:"shrink-0 p-1 rounded-full bg-primary-foreground/10",children:s.jsx(Xt,{className:"w-4 h-4"})}),s.jsx("span",{className:"font-medium truncate text-sm",children:n.eventTitle}),n.currentRound>0&&s.jsxs(we,{variant:"secondary",className:"shrink-0 text-xs bg-primary-foreground/20 text-primary-foreground border-0",children:[n.currentRound,"/",n.totalRounds]})]}),s.jsxs("div",{className:"flex items-center gap-1 shrink-0 text-sm font-medium",children:[s.jsx("span",{className:"hidden sm:inline",children:"Accéder au tournoi"}),s.jsx(Sr,{className:"w-4 h-4"})]})]})})})})}function Sje(){const{user:e}=Tt();return st({queryKey:["my-venue-request",e==null?void 0:e.id],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await re.from("venue_requests").select("*").eq("user_id",e.id).maybeSingle();if(n)throw n;return t},enabled:!!e,staleTime:3e4})}function UI(){const{user:e}=Tt();return st({queryKey:["my-venues",e==null?void 0:e.id],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await re.from("venue_users").select(`
902          role,
903          venue:venues(id, name, address, city, capacity, is_active, image_url, description)
904        `).eq("user_id",e.id);if(n)throw n;return t||[]},enabled:!!e,staleTime:3e4,placeholderData:hp})}function Aje(){const{user:e,isLoading:t}=Tt(),{data:n,isLoading:r}=UI(),i=Ye(),a=(n||[]).map(l=>{var c;return(c=l.venue)==null?void 0:c.id}).filter(Boolean),o=a.slice().sort().join(",");return N.useEffect(()=>{if(!(e!=null&&e.id)||a.length===0)return;const l=re.channel("venue-active-event").on("postgres_changes",{event:"UPDATE",schema:"public",table:"events"},c=>{var d;const u=(d=c.new)==null?void 0:d.venue_id;u&&a.includes(u)&&setTimeout(()=>{i.invalidateQueries({queryKey:["venue-active-event",e.id,o]})},0)}).subscribe();return()=>{re.removeChannel(l)}},[e==null?void 0:e.id,o,i]),st({queryKey:["venue-active-event",e==null?void 0:e.id,o],queryFn:async()=>{if(!(e!=null&&e.id)||a.length===0)return null;const l=new Date,c=new Date(l.getTime()-30*6e4).toISOString(),u=new Date(l.getTime()+60*6e4).toISOString(),{data:d,error:f}=await re.from("events").select("id, title, status, event_date, venue:venues!inner(name)").in("venue_id",a).in("status",["ongoing","published"]).gte("event_date",c).lte("event_date",u).order("status",{ascending:!0}).order("event_date",{ascending:!0});if(f||!d||d.length===0){const{data:y}=await re.from("events").select("id, title, status, event_date, venue:venues!inner(name)").in("venue_id",a).eq("status","ongoing").order("event_date",{ascending:!0}).limit(1);if(!y||y.length===0)return null;const b=y[0],w=Array.isArray(b.venue)?b.venue[0]:b.venue;return{eventId:b.id,eventTitle:b.title,venueName:(w==null?void 0:w.name)||"",status:"ongoing",startsInMin:Math.round((new Date(b.event_date).getTime()-Date.now())/6e4)}}const p=d.find(y=>y.status==="ongoing")||d[0],x=Array.isArray(p.venue)?p.venue[0]:p.venue;return{eventId:p.id,eventTitle:p.title,venueName:(x==null?void 0:x.name)||"",status:p.status,startsInMin:Math.round((new Date(p.event_date).getTime()-Date.now())/6e4)}},enabled:!!(e!=null&&e.id)&&!t&&!r,staleTime:3e4,gcTime:10*6e4,refetchInterval:6e4,refetchOnWindowFocus:!0,placeholderData:hp})}function Tje(){const e=fa(),{user:t}=Tt(),{data:n}=Aje(),r=n?e.pathname.startsWith(`/venue/events/${n.eventId}`):!1;if(N.useEffect(()=>(n&&!r?document.body.classList.add("has-venue-banner"):document.body.classList.remove("has-venue-banner"),()=>document.body.classList.remove("has-venue-banner")),[n,r]),!t||!n||r)return null;const i=n.status==="ongoing",a=n.startsInMin;let o;return i?o="EN COURS":a<=0?o="VIENT DE COMMENCER":o=`DÉMARRE DANS ${a} MIN`,s.jsx("div",{className:"fixed top-16 left-0 right-0 z-40 animate-in slide-in-from-top-2 duration-300",children:s.jsx(Pe,{to:`/venue/events/${n.eventId}/checkin`,className:"block bg-[#0D0D0D] border-b-2 border-[#AAFF00] shadow-xl active:bg-[#1a1a1a] transition-colors",children:s.jsx("div",{className:"container mx-auto px-4 py-3",children:s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsxs("div",{className:"shrink-0 relative",children:[s.jsx(yxe,{className:"w-5 h-5 text-[#AAFF00]"}),i&&s.jsx("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 bg-[#AAFF00] rounded-full animate-ping"})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[10px] font-bold tracking-wider text-[#AAFF00] leading-none",children:o}),s.jsxs("div",{className:"text-sm font-semibold text-[#F5F3EE] truncate mt-0.5",children:[n.eventTitle,s.jsxs("span",{className:"text-[#F5F3EE]/60 font-normal",children:[" · ",n.venueName]})]})]})]}),s.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 bg-[#AAFF00] text-[#0D0D0D] px-3 py-2 rounded-full font-bold text-sm",children:[s.jsx(nu,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden xs:inline sm:inline",children:"Scanner"}),s.jsx(Sr,{className:"w-4 h-4"})]})]})})})})}function e_({children:e,allowedRoles:t,requireAuth:n=!0}){const{user:r,roles:i,isLoading:a}=Tt(),o=fa();return a?s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:s.jsxs("div",{className:"flex flex-col items-center gap-4",children:[s.jsx(We,{className:"w-8 h-8 animate-spin text-primary"}),s.jsx("p",{className:"text-muted-foreground",children:"Chargement..."})]})}
904):n&&!r?s.jsx(em,{to:"/auth",state:{from:o},replace:!0}):t&&t.length>0&&!t.some(c=>i.includes(c))?i.includes("admin")?s.jsx(em,{to:"/admin",replace:!0}):i.includes("venue")?s.jsx(em,{to:"/venue",replace:!0}):s.jsx(em,{to:"/player",replace:!0}):s.jsx(s.Fragment,{children:e})}function It(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function zr(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function ai(e,t){const n=It(e);return isNaN(t)?zr(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function bo(e,t){const n=It(e);if(isNaN(t))return zr(e,NaN);if(!t)return n;const r=n.getDate(),i=zr(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);const a=i.getDate();return r>=a?i:(n.setFullYear(i.getFullYear(),i.getMonth(),r),n)}const qI=6048e5,Pje=864e5,VI=6e4,rC=36e5,Oje=1e3,t_=43200,_$=1440;let Dje={};function Qf(){return Dje}function wo(e,t){var l,c,u,d;const n=Qf(),r=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,i=It(e),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function ad(e){return wo(e,{weekStartsOn:1})}function VQ(e){const t=It(e),n=t.getFullYear(),r=zr(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const i=ad(r),a=zr(e,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const o=ad(a);return t.getTime()>=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function Sl(e){const t=It(e);return t.setHours(0,0,0,0),t}function Mf(e){const t=It(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function dc(e,t){const n=Sl(e),r=Sl(t),i=+n-Mf(n),a=+r-Mf(r);return Math.round((i-a)/Pje)}function Ije(e){const t=VQ(e),n=zr(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),ad(n)}function Vg(e,t){const n=t*7;return ai(e,n)}function Rje(e,t){return bo(e,t*12)}function Mje(e){let t;return e.forEach(function(n){const r=It(n);(t===void 0||t<r||isNaN(Number(r)))&&(t=r)}),t||new Date(NaN)}function Lje(e){let t;return e.forEach(n=>{const r=It(n);(!t||t>r||isNaN(+r))&&(t=r)}),t||new Date(NaN)}function fj(e,t){const n=It(e),r=It(t),i=n.getTime()-r.getTime();return i<0?-1:i>0?1:i}function HI(e){return zr(e,Date.now())}function Ui(e,t){const n=Sl(e),r=Sl(t);return+n==+r}function WI(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Fje(e){if(!WI(e)&&typeof e!="number")return!1;const t=It(e);return!isNaN(Number(t))}function jx(e,t){const n=It(e),r=It(t),i=n.getFullYear()-r.getFullYear(),a=n.getMonth()-r.getMonth();return i*12+a}function $je(e,t,n){const r=wo(e,n),i=wo(t,n),a=+r-Mf(r),o=+i-Mf(i);return Math.round((a-o)/qI)}function Bje(e,t){const n=It(e),r=It(t),i=j$(n,r),a=Math.abs(dc(n,r));n.setDate(n.getDate()-i*a);const o=+(j$(n,r)===-i),l=i*(a-o);return l===0?0:l}function j$(e,t){const n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function HQ(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function WQ(e,t){return+It(e)-+It(t)}function C0(e,t,n){const r=WQ(e,t)/rC;return HQ(n==null?void 0:n.roundingMethod)(r)}function GQ(e){const t=It(e);return t.setHours(23,59,59,999),t}function mp(e){const t=It(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function zje(e){const t=It(e);return+GQ(t)==+mp(t)}function Uje(e,t){const n=It(e),r=It(t),i=fj(n,r),a=Math.abs(jx(n,r));let o;if(a<1)o=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*a);let l=fj(n,r)===-i;zje(It(e))&&a===1&&fj(e,r)===1&&(l=!1),o=i*(a-Number(l))}return o===0?0:o}function qje(e,t,n){const r=WQ(e,t)/1e3;return HQ(n==null?void 0:n.roundingMethod)(r)}
vendor: 4,625 bytes, line 904
904function Vje(e,t){const n=It(e.start),r=It(e.end);let i=+n>+r;const a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0);let l=1;const c=[];for(;+o<=a;)c.push(It(o)),o.setDate(o.getDate()+l),o.setHours(0,0,0,0);return i?c.reverse():c}function aa(e){const t=It(e);return t.setDate(1),t.setHours(0,0,0,0),t}function KQ(e){const t=It(e),n=zr(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function E0(e,t){var l,c,u,d;const n=Qf(),r=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,i=It(e),a=i.getDay(),o=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function YQ(e){return E0(e,{weekStartsOn:1})}const Hje={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Wje=(e,t,n)=>{let r;const i=Hje[e];return typeof i=="string"?r=i:t===1?r=i.one:r=i.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Hg(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Gje={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Kje={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Yje={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Xje={date:Hg({formats:Gje,defaultWidth:"full"}),time:Hg({formats:Kje,defaultWidth:"full"}),dateTime:Hg({formats:Yje,defaultWidth:"full"})},Qje={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Jje=(e,t,n,r)=>Qje[e];function qc(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let i;if(r==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,l=n!=null&&n.width?String(n.width):o;i=e.formattingValues[l]||e.formattingValues[o]}else{const o=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[l]||e.values[o]}const a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}const Zje={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},e2e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},t2e={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},n2e={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},r2e={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},s2e={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},i2e=(e,t)=>
vendor: 9,937 bytes, line 904
904{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},a2e={ordinalNumber:i2e,era:qc({values:Zje,defaultWidth:"wide"}),quarter:qc({values:e2e,defaultWidth:"wide",argumentCallback:e=>e-1}),month:qc({values:t2e,defaultWidth:"wide"}),day:qc({values:n2e,defaultWidth:"wide"}),dayPeriod:qc({values:r2e,defaultWidth:"wide",formattingValues:s2e,defaultFormattingWidth:"wide"})};function Vc(e){return(t,n={})=>{const r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;const o=a[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?l2e(l,f=>f.test(o)):o2e(l,f=>f.test(o));let u;u=e.valueCallback?e.valueCallback(c):c,u=n.valueCallback?n.valueCallback(u):u;const d=t.slice(o.length);return{value:u,rest:d}}}function o2e(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function l2e(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function XQ(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;const l=t.slice(i.length);return{value:o,rest:l}}}const c2e=/^(\d+)(th|st|nd|rd)?/i,u2e=/\d+/i,d2e={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},f2e={any:[/^b/i,/^(a|c)/i]},h2e={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},m2e={any:[/1/i,/2/i,/3/i,/4/i]},p2e={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},g2e={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},x2e={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},y2e={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},v2e={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},b2e={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},w2e={ordinalNumber:XQ({matchPattern:c2e,parsePattern:u2e,valueCallback:e=>parseInt(e,10)}),era:Vc({matchPatterns:d2e,defaultMatchWidth:"wide",parsePatterns:f2e,defaultParseWidth:"any"}),quarter:Vc({matchPatterns:h2e,defaultMatchWidth:"wide",parsePatterns:m2e,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Vc({matchPatterns:p2e,defaultMatchWidth:"wide",parsePatterns:g2e,defaultParseWidth:"any"}),day:Vc({matchPatterns:x2e,defaultMatchWidth:"wide",parsePatterns:y2e,defaultParseWidth:"any"}),dayPeriod:Vc({matchPatterns:v2e,defaultMatchWidth:"any",parsePatterns:b2e,defaultParseWidth:"any"})},sC={code:"en-US",formatDistance:Wje,formatLong:Xje,formatRelative:Jje,localize:a2e,match:w2e,options:{weekStartsOn:0,firstWeekContainsDate:1}};function _2e(e){const t=It(e);return dc(t,KQ(t))+1}function GI(e){const t=It(e),n=+ad(t)-+Ije(t);return Math.round(n/qI)+1}function KI(e,t){var d,f,h,p;const n=It(e),r=n.getFullYear(),i=Qf(),a=(t==null?void 0:t.firstWeekContainsDate)??((f=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??i.firstWeekContainsDate??((p=(h=i.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,o=zr(e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);const l=wo(o,t),c=zr(e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);const u=wo(c,t);return n.getTime()>=l.getTime()?r+1:n.getTime()>=u.getTime()?r:r-1}function j2e(e,t){var l,c,u,d;const n=Qf(),r=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,i=KI(e,t),a=zr(e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),wo(a,t)}function YI(e,t){const n=It(e),r=+wo(n,t)-+j2e(n,t);return Math.round(r/qI)+1}function Cr(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const Fd={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return Cr(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Cr(n+1,2)},d(e,t){return Cr(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return Cr(e.getHours()%12||12,t.length)},H(e,t){return Cr(e.getHours(),t.length)},m(e,t){return Cr(e.getMinutes(),t.length)},s(e,t){return Cr(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return Cr(i,t.length)}},zp={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},N$={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return Fd.y(e,t)},Y:function(e,t,n,r){const i=KI(e,r),a=i>0?i:1-i;if(t==="YY"){const o=a%100;return Cr(o,2)}return t==="Yo"?n.ordinalNumber(a,{unit:"year"}):Cr(a,t.length)},R:function(e,t){const n=VQ(e);return Cr(n,t.length)},u:function(e,t){const n=e.getFullYear();return Cr(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Cr(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Cr(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return Fd.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return Cr(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const i=YI(e,r);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):Cr(i,t.length)},I:function(e,t,n){const r=GI(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):Cr(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Fd.d(e,t)},D:function(e,t,n){const r=_2e(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Cr(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return Cr(a,2);case"eo":return n.ordinalNumber(a,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return Cr(a,t.length);case"co":return n.ordinalNumber(a,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),i=r===0?7:r;switch(t){case"i":return String(i);case"ii":return Cr(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let i;switch(r===12?i=zp.noon:r===0?i=zp.midnight:i=r/12>
vendor: 4,386 bytes, line 904
904=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let i;switch(r>=17?i=zp.evening:r>=12?i=zp.afternoon:r>=4?i=zp.morning:i=zp.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Fd.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Fd.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Cr(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):Cr(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Fd.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Fd.s(e,t)},S:function(e,t){return Fd.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return C$(r);case"XXXX":case"XX":return Fh(r);case"XXXXX":case"XXX":default:return Fh(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return C$(r);case"xxxx":case"xx":return Fh(r);case"xxxxx":case"xxx":default:return Fh(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+k$(r,":");case"OOOO":default:return"GMT"+Fh(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+k$(r,":");case"zzzz":default:return"GMT"+Fh(r,":")}},t:function(e,t,n){const r=Math.trunc(e.getTime()/1e3);return Cr(r,t.length)},T:function(e,t,n){const r=e.getTime();return Cr(r,t.length)}};function k$(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+Cr(a,2)}function C$(e,t){return e%60===0?(e>0?"-":"+")+Cr(Math.abs(e)/60,2):Fh(e,t)}function Fh(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Cr(Math.trunc(r/60),2),a=Cr(r%60,2);return n+i+t+a}const E$=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},QQ=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},N2e=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return E$(e,t);let a;switch(r){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;case"PPPP":default:a=t.dateTime({width:"full"});break}return a.replace("{{date}}",E$(r,t)).replace("{{time}}",QQ(i,t))},aT={p:QQ,P:N2e},k2e=/^D+$/,C2e=/^Y+$/,E2e=["D","DD","YY","YYYY"];function JQ(e){return k2e.test(e)}function ZQ(e){return C2e.test(e)}function oT(e,t,n){const r=S2e(e,t,n);if(console.warn(r),E2e.includes(e))throw new RangeError(r)}function S2e(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const A2e=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,T2e=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,P2e=/^'([^]*?)'?$/,O2e=/''/g,D2e=/[a-zA-Z]/;function Ze(e,t,n){var d,f,h,p,x,y,b,w;const r=Qf(),i=(n==null?void 0:n.locale)??r.locale??sC,a=(n==null?void 0:n.firstWeekContainsDate)??((f=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??r.firstWeekContainsDate??((p=(h=r.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,o=(n==null?void 0:n.weekStartsOn)??((y=(x=n==null?void 0:n.locale)==null?void 0:x.options)==null?void 0:y.weekStartsOn)??r.weekStartsOn??((w=(b=r.locale)==null?void 0:b.options)==null?void 0:w.weekStartsOn)??0,l=It(e);
904if(!Fje(l))throw new RangeError("Invalid time value");let c=t.match(T2e).map(_=>{const j=_[0];if(j==="p"||j==="P"){const E=aT[j];return E(_,i.formatLong)}return _}).join("").match(A2e).map(_=>{if(_==="''")return{isToken:!1,value:"'"};const j=_[0];if(j==="'")return{isToken:!1,value:I2e(_)};if(N$[j])return{isToken:!0,value:_};if(j.match(D2e))throw new RangeError("Format string contains an unescaped latin alphabet character `"+j+"`");return{isToken:!1,value:_}});i.localize.preprocessor&&(c=i.localize.preprocessor(l,c));const u={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(_=>{if(!_.isToken)return _.value;const j=_.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&ZQ(j)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&JQ(j))&&oT(j,t,String(e));const E=N$[j[0]];return E(l,j,i.localize,u)}).join("")}function I2e(e){const t=e.match(P2e);return t?t[1].replace(O2e,"'"):e}function R2e(e,t,n){const r=Qf(),i=(n==null?void 0:n.locale)??r.locale??sC,a=2520,o=fj(e,t);if(isNaN(o))throw new RangeError("Invalid time value");const l=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:o});let c,u;o>0?(c=It(t),u=It(e)):(c=It(e),u=It(t));const d=qje(u,c),f=(Mf(u)-Mf(c))/1e3,h=Math.round((d-f)/60);let p;if(h<2)return n!=null&&n.includeSeconds?d<5?i.formatDistance("lessThanXSeconds",5,l):d<10?i.formatDistance("lessThanXSeconds",10,l):d<20?i.formatDistance("lessThanXSeconds",20,l):d<40?i.formatDistance("halfAMinute",0,l):d<60?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",1,l):h===0?i.formatDistance("lessThanXMinutes",1,l):i.formatDistance("xMinutes",h,l);if(h<45)return i.formatDistance("xMinutes",h,l);if(h<90)return i.formatDistance("aboutXHours",1,l);if(h<_$){const x=Math.round(h/60);return i.formatDistance("aboutXHours",x,l)}else{if(h<a)return i.formatDistance("xDays",1,l);if(h<t_){const x=Math.round(h/_$);return i.formatDistance("xDays",x,l)}else if(h<t_*2)return p=Math.round(h/t_),i.formatDistance("aboutXMonths",p,l)}if(p=Uje(u,c),p<12){const x=Math.round(h/t_);return i.formatDistance("xMonths",x,l)}else{const x=p%12,y=Math.trunc(p/12);return x<3?i.formatDistance("aboutXYears",y,l):x<9?i.formatDistance("overXYears",y,l):i.formatDistance("almostXYears",y+1,l)}}function eJ(e,t){return R2e(e,HI(e),t)}function M2e(e){const t=It(e),n=t.getFullYear(),r=t.getMonth(),i=zr(e,0);return i.setFullYear(n,r+1,0),i.setHours(0,0,0,0),i.getDate()}function L2e(){return Object.assign({},Qf())}function F2e(e){let n=It(e).getDay();return n===0&&(n=7),n}function $2e(e){return Math.trunc(+It(e)/1e3)}function B2e(e){const t=It(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}function z2e(e,t){return $je(B2e(e),aa(e),t)+1}function lT(e,t){const n=It(e),r=It(t);return n.getTime()>r.getTime()}function tJ(e,t){const n=It(e),r=It(t);return+n<+r}function U2e(e,t){const n=t instanceof Date?zr(t,0):new t(0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}const q2e=10;class nJ{constructor(){vt(this,"subPriority",0)}validate(t,n){return!0}}class V2e extends nJ{constructor(t,n,r,i,a){super(),this.value=t,this.validateValue=n,this.setValue=r,this.priority=i,a&&(this.subPriority=a)}validate(t,n){return this.validateValue(t,this.value,n)}set(t,n,r){return this.setValue(t,n,this.value,r)}}class H2e extends nJ{constructor(){super(...arguments);vt(this,"priority",q2e);vt(this,"subPriority",-1)}set(n,r){return r.timestampIsSet?n:zr(n,U2e(n,Date))}}class fr{run(t,n,r,i){const a=this.parse(t,n,r,i);return a?{setter:new V2e(a.value,this.validate,this.set,this.priority,this.subPriority),rest:a.rest}:null}validate(t,n,r){return!0}}class W2e extends fr{constructor(){super(...arguments);vt(this,"priority",140);vt(this,"incompatibleTokens",["R","u","t","T"])}parse(n,r,i){switch(r){case"G":case"GG":case"GGG":return i.era(n,{width:"abbreviated"})||i.era(n,{width:"narrow"});case"GGGGG":return i.era(n,{width:"narrow"});case"GGGG":default:return i.era(n,{width:"wide"})||i.era(n,{width:"abbreviated"})||i.era(n,{width:"narrow"})}}set(n,r,i){return r.era=i,n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}}const Ys={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/}
vendor: 18,420 bytes, line 904
904,Hc={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function Xs(e,t){return e&&{value:t(e.value),rest:e.rest}}function _s(e,t){const n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function Wc(e,t){const n=t.match(e);if(!n)return null;if(n[0]==="Z")return{value:0,rest:t.slice(1)};const r=n[1]==="+"?1:-1,i=n[2]?parseInt(n[2],10):0,a=n[3]?parseInt(n[3],10):0,o=n[5]?parseInt(n[5],10):0;return{value:r*(i*rC+a*VI+o*Oje),rest:t.slice(n[0].length)}}function rJ(e){return _s(Ys.anyDigitsSigned,e)}function zs(e,t){switch(e){case 1:return _s(Ys.singleDigit,t);case 2:return _s(Ys.twoDigits,t);case 3:return _s(Ys.threeDigits,t);case 4:return _s(Ys.fourDigits,t);default:return _s(new RegExp("^\\d{1,"+e+"}"),t)}}function b2(e,t){switch(e){case 1:return _s(Ys.singleDigitSigned,t);case 2:return _s(Ys.twoDigitsSigned,t);case 3:return _s(Ys.threeDigitsSigned,t);case 4:return _s(Ys.fourDigitsSigned,t);default:return _s(new RegExp("^-?\\d{1,"+e+"}"),t)}}function XI(e){switch(e){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function sJ(e,t){const n=t>0,r=n?t:1-t;let i;if(r<=50)i=e||100;else{const a=r+50,o=Math.trunc(a/100)*100,l=e>=a%100;i=e+o-(l?100:0)}return n?i:1-i}function iJ(e){return e%400===0||e%4===0&&e%100!==0}class G2e extends fr{constructor(){super(...arguments);vt(this,"priority",130);vt(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(n,r,i){const a=o=>({year:o,isTwoDigitYear:r==="yy"});switch(r){case"y":return Xs(zs(4,n),a);case"yo":return Xs(i.ordinalNumber(n,{unit:"year"}),a);default:return Xs(zs(r.length,n),a)}}validate(n,r){return r.isTwoDigitYear||r.year>0}set(n,r,i){const a=n.getFullYear();if(i.isTwoDigitYear){const l=sJ(i.year,a);return n.setFullYear(l,0,1),n.setHours(0,0,0,0),n}const o=!("era"in r)||r.era===1?i.year:1-i.year;return n.setFullYear(o,0,1),n.setHours(0,0,0,0),n}}class K2e extends fr{constructor(){super(...arguments);vt(this,"priority",130);vt(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(n,r,i){const a=o=>({year:o,isTwoDigitYear:r==="YY"});switch(r){case"Y":return Xs(zs(4,n),a);case"Yo":return Xs(i.ordinalNumber(n,{unit:"year"}),a);default:return Xs(zs(r.length,n),a)}}validate(n,r){return r.isTwoDigitYear||r.year>0}set(n,r,i,a){const o=KI(n,a);if(i.isTwoDigitYear){const c=sJ(i.year,o);return n.setFullYear(c,0,a.firstWeekContainsDate),n.setHours(0,0,0,0),wo(n,a)}const l=!("era"in r)||r.era===1?i.year:1-i.year;return n.setFullYear(l,0,a.firstWeekContainsDate),n.setHours(0,0,0,0),wo(n,a)}}class Y2e extends fr{constructor(){super(...arguments);vt(this,"priority",130);vt(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,r){return b2(r==="R"?4:r.length,n)}set(n,r,i){const a=zr(n,0);return a.setFullYear(i,0,4),a.setHours(0,0,0,0),ad(a)}}class X2e extends fr{constructor(){super(...arguments);vt(this,"priority",130);vt(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,r){return b2(r==="u"?4:r.length,n)}set(n,r,i){return n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}}class Q2e extends fr{constructor(){super(...arguments);vt(this,"priority",120);vt(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,r,i){switch(r){case"Q":case"QQ":return zs(r.length,n);case"Qo":return i.ordinalNumber(n,{unit:"quarter"});case"QQQ":return i.quarter(n,{width:"abbreviated",context:"formatting"})||i.quarter(n,{width:"narrow",context:"formatting"});case"QQQQQ":return i.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return i.quarter(n,{width:"wide",context:"formatting"})||i.quarter(n,{width:"abbreviated",context:"formatting"})||i.quarter(n,{width:"narrow",context:"formatting"})}}validate(n,r){return r>=1&&r<=4}set(n,r,i){return n.setMonth((i-1)*3,1),n.setHours(0,0,0,0),n}}class J2e extends fr{constructor(){super(...arguments);vt(this,"priority",120);vt(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,r,i){switch(r){case"q":case"qq":return zs(r.length,n);case"qo":return i.ordinalNumber(n,{unit:"quarter"});case"qqq":return i.quarter(n,{width:"abbreviated",context:"standalone"})||i.quarter(n,{width:"narrow",context:"standalone"});case"qqqqq":return i.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return i.quarter(n,{width:"wide",context:"standalone"})||i.quarter(n,{width:"abbreviated",context:"standalone"})||i.quarter(n,{width:"narrow",context:"standalone"})}}validate(n,r){return r>=1&&r<=4}set(n,r,i){return n.setMonth((i-1)*3,1),n.setHours(0,0,0,0),n}}class Z2e extends fr{constructor(){super(...arguments);vt(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);vt(this,"priority",110)}parse(n,r,i){const a=o=>o-1;switch(r){case"M":return Xs(_s(Ys.month,n),a);case"MM":return Xs(zs(2,n),a);case"Mo":return Xs(i.ordinalNumber(n,{unit:"month"}),a);case"MMM":return i.month(n,{width:"abbreviated",context:"formatting"})||i.month(n,{width:"narrow",context:"formatting"});case"MMMMM":return i.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return i.month(n,{width:"wide",context:"formatting"})||i.month(n,{width:"abbreviated",context:"formatting"})||i.month(n,{width:"narrow",context:"formatting"})}}validate(n,r){return r>=0&&r<=11}set(n,r,i){return n.setMonth(i,1),n.setHours(0,0,0,0),n}}class eNe extends fr{constructor(){super(...arguments);vt(this,"priority",110);vt(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(n,r,i){const a=o=>o-1;switch(r){case"L":return Xs(_s(Ys.month,n),a);case"LL":return Xs(zs(2,n),a);case"Lo":return Xs(i.ordinalNumber(n,{unit:"month"}),a);case"LLL":return i.month(n,{width:"abbreviated",context:"standalone"})||i.month(n,{width:"narrow",context:"standalone"});case"LLLLL":return i.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return i.month(n,{width:"wide",context:"standalone"})||i.month(n,{width:"abbreviated",context:"standalone"})||i.month(n,{width:"narrow",context:"standalone"})}}validate(n,r){return r>=0&&r<=11}set(n,r,i){return n.setMonth(i,1),n.setHours(0,0,0,0),n}}function tNe(e,t,n){const r=It(e),i=YI(r,n)-t;return r.setDate(r.getDate()-i*7),r}class nNe extends fr{constructor(){super(...arguments);vt(this,"priority",100);vt(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,r,i){switch(r){case"w":return _s(Ys.week,n);case"wo":return i.ordinalNumber(n,{unit:"week"});default:return zs(r.length,n)}}validate(n,r){return r>=1&&r<=53}set(n,r,i,a){return wo(tNe(n,i,a),a)}}function rNe(e,t){const n=It(e),r=GI(n)-t;return n.setDate(n.getDate()-r*7),n}class sNe extends fr{constructor(){super(...arguments);vt(this,"priority",100);vt(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(n,r,i){switch(r){case"I":return _s(Ys.week,n);case"Io":return i.ordinalNumber(n,{unit:"week"});default:return zs(r.length,n)}}validate(n,r){return r>=1&&r<=53}set(n,r,i){return ad(rNe(n,i))}}const iNe=[31,28,31,30,31,30,31,31,30,31,30,31],aNe=[31,29,31,30,31,30,31,31,30,31,30,31];class oNe extends fr{constructor(){super(...arguments);vt(this,"priority",90);vt(this,"subPriority",1);vt(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,r,i){switch(r){case"d":return _s(Ys.date,n);case"do":return i.ordinalNumber(n,{unit:"date"});default:return zs(r.length,n)}}validate(n,r){const i=n.getFullYear(),a=iJ(i),o=n.getMonth();return a?r>=1&&r<=aNe[o]:r>=1&&r<=iNe[o]}set(n,r,i){return n.setDate(i),n.setHours(0,0,0,0),n}}class lNe extends fr{constructor(){super(...arguments);vt(this,"priority",90);vt(this,"subpriority",1);vt(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(n,r,i){switch(r){case"D":case"DD":return _s(Ys.dayOfYear,n);case"Do":return i.ordinalNumber(n,{unit:"date"});default:return zs(r.length,n)}}validate(n,r){const i=n.getFullYear();return iJ(i)?r>=1&&r<=366:r>=1&&r<=365}set(n,r,i){return n.setMonth(0,i),n.setHours(0,0,0,0),n}}function iC(e,t,n){var f,h,p,x;const r=Qf(),i=(n==null?void 0:n.weekStartsOn)??((h=(f=n==null?void 0:n.locale)==null?void 0:f.options)==null?void 0:h.weekStartsOn)??r.weekStartsOn??((x=(p=r.locale)==null?void 0:p.options)==null?void 0:x.weekStartsOn)??0,a=It(e),o=a.getDay(),c=(t%7+7)%7,u=7-i,d=t<0||t>6?t-(o+u)%7:(c+u)%7-(o+u)%7;return ai(a,d)}class cNe extends fr{constructor(){super(...arguments);vt(this,"priority",90);vt(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(n,r,i){switch(r){case"E":case"EE":case"EEE":return i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"EEEEE":return i.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"EEEE":default:return i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"})}}validate(n,r){return r>=0&&r<=6}set(n,r,i,a){return n=iC(n,i,a),n.setHours(0,0,0,0),n}}class uNe extends fr{constructor(){super(...arguments);vt(this,"priority",90);vt(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(n,r,i,a){const o=l=>{const c=Math.floor((l-1)/7)*7;return(l+a.weekStartsOn+6)%7+c};switch(r){case"e":case"ee":return Xs(zs(r.length,n),o);case"eo":return Xs(i.ordinalNumber(n,{unit:"day"}),o);case"eee":return i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"eeeee":return i.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"eeee":default:return i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"})}}validate(n,r){return r>=0&&r<=6}set(n,r,i,a){return n=iC(n,i,a),n.setHours(0,0,0,0),n}}class dNe extends fr{constructor(){super(...arguments);vt(this,"priority",90);vt(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(n,r,i,a){const o=l=>{const c=Math.floor((l-1)/7)*7;return(l+a.weekStartsOn+6)%7+c};switch(r){case"c":case"cc":return Xs(zs(r.length,n),o);case"co":return Xs(i.ordinalNumber(n,{unit:"day"}),o);case"ccc":return i.day(n,{width:"abbreviated",context:"standalone"})||i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"});case"ccccc":return i.day(n,{width:"narrow",context:"standalone"});case"cccccc":return i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"});case"cccc":default:return i.day(n,{width:"wide",context:"standalone"})||i.day(n,{width:"abbreviated",context:"standalone"})||i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"})}}validate(n,r){return r>=0&&r<=6}set(n,r,i,a){return n=iC(n,i,a),n.setHours(0,0,0,0),n}}function fNe(e,t){const n=It(e),r=F2e(n),i=t-r;return ai(n,i)}class hNe extends fr{constructor(){super(...arguments);vt(this,"priority",90);vt(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(n,r,i){const a=o=>o===0?7:o;switch(r){case"i":case"ii":return zs(r.length,n);case"io":return i.ordinalNumber(n,{unit:"day"});case"iii":return Xs(i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),a);case"iiiii":return Xs(i.day(n,{width:"narrow",context:"formatting"}),a);case"iiiiii":return Xs(i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),a);case"iiii":default:return Xs(i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),a)}}validate(n,r){return r>=1&&r<=7}set(n,r,i){return n=fNe(n,i),n.setHours(0,0,0,0),n}}class mNe extends fr{constructor(){super(...arguments);vt(this,"priority",80);vt(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(n,r,i){switch(r){case"a":case"aa":case"aaa":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaaa":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,r,i){return n.setHours(XI(i),0,0,0),n}}class pNe extends fr{constructor(){super(...arguments);vt(this,"priority",80);vt(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(n,r,i){switch(r){case"b":case"bb":case"bbb":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbbb":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,r,i){return n.setHours(XI(i),0,0,0),n}}class gNe extends fr{constructor(){super(...arguments);vt(this,"priority",80);vt(this,"incompatibleTokens",["a","b","t","T"])}parse(n,r,i){switch(r){case"B":case"BB":case"BBB":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBBB":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,r,i){return n.setHours(XI(i),0,0,0),n}}class xNe extends fr{constructor(){super(...arguments);vt(this,"priority",70);vt(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,r,i){switch(r){case"h":return _s(Ys.hour12h,n);case"ho":return i.ordinalNumber(n,{unit:"hour"});default:return zs(r.length,n)}}validate(n,r){return r>=1&&r<=12}set(n,r,i){const a=n.getHours()>=12;return a&&i<12?n.setHours(i+12,0,0,0):!a&&i===12?n.setHours(0,0,0,0):n.setHours(i,0,0,0),n}}class yNe extends fr{constructor(){super(...arguments);vt(this,"priority",70);vt(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,r,i){switch(r){case"H":return _s(Ys.hour23h,n);case"Ho":return i.ordinalNumber(n,{unit:"hour"});default:return zs(r.length,n)}}validate(n,r){return r>=0&&r<=23}set(n,r,i){return n.setHours(i,0,0,0),n}}class vNe extends fr{constructor(){super(...arguments);vt(this,"priority",70);vt(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,r,i){switch(r){case"K":return _s(Ys.hour11h,n);case"Ko":return i.ordinalNumber(n,{unit:"hour"});default:return zs(r.length,n)}}validate(n,r){return r>=0&&r<=11}set(n,r,i){return n.getHours()>=12&&i<12?n.setHours(i+12,0,0,0):n.setHours(i,0,0,0),n}}class bNe extends fr{constructor(){super(...arguments);vt(this,"priority",70);vt(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,r,i){switch(r){case"k":return _s(Ys.hour24h,n);case"ko":return i.ordinalNumber(n,{unit:"hour"});default:return zs(r.length,n)}}validate(n,r){return r>=1&&r<=24}set(n,r,i){const a=i<=24?i%24:i;return n.setHours(a,0,0,0),n}}class wNe extends fr{constructor(){super(...arguments);vt(this,"priority",60);vt(this,"incompatibleTokens",["t","T"])}parse(n,r,i){switch(r){case"m":return _s(Ys.minute,n);case"mo":return i.ordinalNumber(n,{unit:"minute"});default:return zs(r.length,n)}}validate(n,r){return r>=0&&r<=59}set(n,r,i){return n.setMinutes(i,0,0),n}}class _Ne extends fr{constructor(){super(...arguments);vt(this,"priority",50);vt(this,"incompatibleTokens",["t","T"])}parse(n,r,i){switch(r){case"s":return _s(Ys.second,n);case"so":return i.ordinalNumber(n,{unit:"second"});default:return zs(r.length,n)}}validate(n,r){return r>=0&&r<=59}set(n,r,i){return n.setSeconds(i,0),n}}class jNe extends fr{constructor(){super(...arguments);vt(this,"priority",30);vt(this,"incompatibleTokens",["t","T"])}parse(n,r){const i=a=>Math.trunc(a*Math.pow(10,-r.length+3));return Xs(zs(r.length,n),i)}set(n,r,i){return n.setMilliseconds(i),n}}class NNe extends fr{constructor(){super(...arguments);vt(this,"priority",10);vt(this,"incompatibleTokens",["t","T","x"])}parse(n,r){switch(r){case"X":return Wc(Hc.basicOptionalMinutes,n);case"XX":return Wc(Hc.basic,n);case"XXXX":return Wc(Hc.basicOptionalSeconds,n);case"XXXXX":return Wc(Hc.extendedOptionalSeconds,n);case"XXX":default:return Wc(Hc.extended,n)}}set(n,r,i){return r.timestampIsSet?n:zr(n,n.getTime()-Mf(n)-i)}}class kNe extends fr{constructor(){super(...arguments);vt(this,"priority",10);vt(this,"incompatibleTokens",["t","T","X"])}parse(n,r){switch(r){case"x":return Wc(Hc.basicOptionalMinutes,n);case"xx":return Wc(Hc.basic,n);case"xxxx":return Wc(Hc.basicOptionalSeconds,n);case"xxxxx":return Wc(Hc.extendedOptionalSeconds,n);case"xxx":default:return Wc(Hc.extended,n)}}set(n,r,i){return r.timestampIsSet?n:zr(n,n.getTime()-Mf(n)-i)}}class CNe extends fr{constructor(){super(...arguments);vt(this,"priority",40);vt(this,"incompatibleTokens","*")}parse(n){return rJ(n)}set(n,r,i){return[zr(n,i*1e3),{timestampIsSet:!0}]}}class ENe extends fr{constructor(){super(...arguments);vt(this,"priority",20);vt(this,"incompatibleTokens","*")}parse(n){return rJ(n)}set(n,r,i){return[zr(n,i),{timestampIsSet:!0}]}}const SNe={G:new W2e,y:new G2e,Y:new K2e,R:new Y2e,u:new X2e,Q:new Q2e,q:new J2e,M:new Z2e,L:new eNe,w:new nNe,I:new sNe,d:new oNe,D:new lNe,E:new cNe,e:new uNe,c:new dNe,i:new hNe,a:new mNe,b:new pNe,B:new gNe,h:new xNe,H:new yNe,K:new vNe,k:new bNe,m:new wNe,s:new _Ne,S:new jNe,X:new NNe,x:new kNe,t:new CNe,T:ne
904w ENe},ANe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,TNe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,PNe=/^'([^]*?)'?$/,ONe=/''/g,DNe=/\S/,INe=/[a-zA-Z]/;function pA(e,t,n,r){var y,b,w,_;const i=L2e(),a=i.locale??sC,o=i.firstWeekContainsDate??((b=(y=i.locale)==null?void 0:y.options)==null?void 0:b.firstWeekContainsDate)??1,l=i.weekStartsOn??((_=(w=i.locale)==null?void 0:w.options)==null?void 0:_.weekStartsOn)??0,c={firstWeekContainsDate:o,weekStartsOn:l,locale:a},u=[new H2e],d=t.match(TNe).map(j=>{const E=j[0];if(E in aT){const S=aT[E];return S(j,a.formatLong)}return j}).join("").match(ANe),f=[];for(let j of d){ZQ(j)&&oT(j,t,e),JQ(j)&&oT(j,t,e);const E=j[0],S=SNe[E];if(S){const{incompatibleTokens:T}=S;if(Array.isArray(T)){const O=f.find(D=>T.includes(D.token)||D.token===E);if(O)throw new RangeError(`The format string mustn't contain \`${O.fullToken}\` and \`${j}\` at the same time`)}else if(S.incompatibleTokens==="*"&&f.length>0)throw new RangeError(`The format string mustn't contain \`${j}\` and any other token at the same time`);f.push({token:E,fullToken:j});const P=S.run(e,j,a.match,c);if(!P)return zr(n,NaN);u.push(P.setter),e=P.rest}else{if(E.match(INe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+E+"`");if(j==="''"?j="'":E==="'"&&(j=RNe(j)),e.indexOf(j)===0)e=e.slice(j.length);else return zr(n,NaN)}}if(e.length>0&&DNe.test(e))return zr(n,NaN);const h=u.map(j=>j.priority).sort((j,E)=>E-j).filter((j,E,S)=>S.indexOf(j)===E).map(j=>u.filter(E=>E.priority===j).sort((E,S)=>S.subPriority-E.subPriority)).map(j=>j[0]);let p=It(n);if(isNaN(p.getTime()))return zr(n,NaN);const x={};for(const j of h){if(!j.validate(p,c))return zr(n,NaN);const E=j.set(p,x,c);Array.isArray(E)?(p=E[0],Object.assign(x,E[1])):p=E}return zr(n,p)}function RNe(e){return e.match(PNe)[1].replace(ONe,"'")}function MNe(e){return+It(e)<Date.now()}function aC(e,t){const n=It(e),r=It(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function LNe(e,t){const n=It(e),r=It(t);return n.getFullYear()===r.getFullYear()}function QI(e){return Ui(e,HI(e))}function FNe(e){return Ui(e,ai(HI(e),1))}function hj(e,t){return ai(e,-t)}function $Ne(e,t){const r=qNe(e);let i;if(r.date){const c=VNe(r.date,2);i=HNe(c.restDateString,c.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);const a=i.getTime();let o=0,l;if(r.time&&(o=WNe(r.time),isNaN(o)))return new Date(NaN);
vendor: 4,424 bytes, line 904
904if(r.timezone){if(l=GNe(r.timezone),isNaN(l))return new Date(NaN)}else{const c=new Date(a+o),u=new Date(0);return u.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),u.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),u}return new Date(a+o+l)}const n_={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},BNe=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,zNe=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,UNe=/^([+-])(\d{2})(?::?(\d{2}))?$/;function qNe(e){const t={},n=e.split(n_.dateTimeDelimiter);let r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],n_.timeZoneDelimiter.test(t.date)&&(t.date=e.split(n_.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){const i=n_.timezone.exec(r);i?(t.time=r.replace(i[1],""),t.timezone=i[1]):t.time=r}return t}function VNe(e,t){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:NaN,restDateString:""};const i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function HNe(e,t){if(t===null)return new Date(NaN);const n=e.match(BNe);if(!n)return new Date(NaN);const r=!!n[4],i=wy(n[1]),a=wy(n[2])-1,o=wy(n[3]),l=wy(n[4]),c=wy(n[5])-1;if(r)return JNe(t,l,c)?KNe(t,l,c):new Date(NaN);{const u=new Date(0);return!XNe(t,a,o)||!QNe(t,i)?new Date(NaN):(u.setUTCFullYear(t,a,Math.max(i,o)),u)}}function wy(e){return e?parseInt(e):1}function WNe(e){const t=e.match(zNe);if(!t)return NaN;const n=gA(t[1]),r=gA(t[2]),i=gA(t[3]);return ZNe(n,r,i)?n*rC+r*VI+i*1e3:NaN}function gA(e){return e&&parseFloat(e.replace(",","."))||0}function GNe(e){if(e==="Z")return 0;const t=e.match(UNe);if(!t)return 0;const n=t[1]==="+"?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return eke(r,i)?n*(r*rC+i*VI):NaN}function KNe(e,t,n){const r=new Date(0);r.setUTCFullYear(e,0,4);const i=r.getUTCDay()||7,a=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}const YNe=[31,null,31,30,31,30,31,31,30,31,30,31];function aJ(e){return e%400===0||e%4===0&&e%100!==0}function XNe(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(YNe[t]||(aJ(e)?29:28))}function QNe(e,t){return t>=1&&t<=(aJ(e)?366:365)}function JNe(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function ZNe(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function eke(e,t){return t>=0&&t<=59}function xA(e,t){const n=It(e),r=n.getFullYear(),i=n.getDate(),a=zr(e,0);a.setFullYear(r,t,15),a.setHours(0,0,0,0);const o=M2e(a);return n.setMonth(t,Math.min(i,o)),n}function S$(e,t){const n=It(e);return isNaN(+n)?zr(e,NaN):(n.setFullYear(t),n)}function tke(e,t){return bo(e,-1)}const nke={lessThanXSeconds:{one:"moins d’une seconde",other:"moins de {{count}} secondes"},xSeconds:{one:"1 seconde",other:"{{count}} secondes"},halfAMinute:"30 secondes",lessThanXMinutes:{one:"moins d’une minute",other:"moins de {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"environ 1 heure",other:"environ {{count}} heures"},xHours:{one:"1 heure",other:"{{count}} heures"},xDays:{one:"1 jour",other:"{{count}} jours"},aboutXWeeks:{one:"environ 1 semaine",other:"environ {{count}} semaines"},xWeeks:{one:"1 semaine",other:"{{count}} semaines"},aboutXMonths:{one:"environ 1 mois",other:"environ {{count}} mois"},xMonths:{one:"1 mois",other:"{{count}} mois"},aboutXYears:{one:"environ 1 an",other:"environ {{count}} ans"},xYears:{one:"1 an",other:"{{count}} ans"},overXYears:{one:"plus d’un an",other:"plus de {{count}} ans"},almostXYears:{one:"presqu’un an",other:"presque {{count}} ans"}},rke=(e,t,n)=>{let r;const i=nke[e];return typeof i=="string"?r=i:t===1?r=i.one:r=i.other.replace("{{count}}",String(t)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"dans "+r:"il y a "+r:r},ske={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},ike={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},ake={full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},oke={date:Hg({formats:ske,defaultWidth:"full"}),time:Hg({formats:ike,defaultWidth:"full"}),dateTime:Hg({formats:ake,defaultWidth:"full"})},lke={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'proch
904ain à' p",other:"P"},cke=(e,t,n,r)=>lke[e],uke={narrow:["av. J.-C","ap. J.-C"],abbreviated:["av. J.-C","ap. J.-C"],wide:["avant Jésus-Christ","après Jésus-Christ"]},dke={narrow:["T1","T2","T3","T4"],abbreviated:["1er trim.","2ème trim.","3ème trim.","4ème trim."],wide:["1er trimestre","2ème trimestre","3ème trimestre","4ème trimestre"]},fke={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],wide:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},hke={narrow:["D","L","M","M","J","V","S"],short:["di","lu","ma","me","je","ve","sa"],abbreviated:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],wide:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},mke={narrow:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"mat.",afternoon:"ap.m.",evening:"soir",night:"mat."},abbreviated:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"matin",afternoon:"après-midi",evening:"soir",night:"matin"},wide:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"du matin",afternoon:"de l’après-midi",evening:"du soir",night:"du matin"}},pke=(e,t)=>{const n=Number(e),r=t==null?void 0:t.unit;if(n===0)return"0";const i=["year","week","hour","minute","second"];let a;return n===1?a=r&&i.includes(r)?"ère":"er":a="ème",n+a},gke=["MMM","MMMM"],xke={preprocessor:(e,t)=>e.getDate()===1||!t.some(r=>r.isToken&&gke.includes(r.value))?t:t.map(r=>r.isToken&&r.value==="do"?{isToken:!0,value:"d"}:r),ordinalNumber:pke,era:qc({values:uke,defaultWidth:"wide"}),quarter:qc({values:dke,defaultWidth:"wide",argumentCallback:e=>e-1}),month:qc({values:fke,defaultWidth:"wide"}),day:qc({values:hke,defaultWidth:"wide"}),dayPeriod:qc({values:mke,defaultWidth:"wide"})},yke=/^(\d+)(ième|ère|ème|er|e)?/i,vke=/\d+/i,bke={narrow:/^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,abbreviated:/^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,wide:/^(avant Jésus-Christ|après Jésus-Christ)/i},wke={any:[/^av/i,/^ap/i]},_ke={narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},jke={any:[/1/i,/2/i,/3/i,/4/i]},Nke={narrow:/^[jfmasond]/i,abbreviated:/^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,wide:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i},kke={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^av/i,/^ma/i,/^juin/i,/^juil/i,/^ao/i,/^s/i,/^o/i,/^n/i,/^d/i]},Cke={narrow:/^[lmjvsd]/i,short:/^(di|lu|ma|me|je|ve|sa)/i,abbreviated:/^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,wide:/^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i},Eke={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^di/i,/^lu/i,/^ma/i,/^me/i,/^je/i,/^ve/i,/^sa/i]},Ske={narrow:/^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,any:/^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i},Ake={any:{am:/^a/i,pm:/^p/i,midnight:/^min/i,noon:/^mid/i,morning:/mat/i,afternoon:/ap/i,evening:/soir/i,night:/nuit/i}},Tke={ordinalNumber:XQ({matchPattern:yke,parsePattern:vke,valueCallback:e=>parseInt(e)}),era:Vc({matchPatterns:bke,defaultMatchWidth:"wide",parsePatterns:wke,defaultParseWidth:"any"}),quarter:Vc({matchPatterns:_ke,defaultMatchWidth:"wide",parsePatterns:jke,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Vc({matchPatterns:Nke,defaultMatchWidth:"wide",parsePatterns:kke,defaultParseWidth:"any"}),day:Vc({matchPatterns:Cke,defaultMatchWidth:"wide",parsePatterns:Eke,defaultParseWidth:"any"}),dayPeriod:Vc({matchPatterns:Ske,defaultMatchWidth:"any",parsePatterns:Ake,defaultParseWidth:"any"})},pt={code:"fr",formatDistance:rke,formatLong:oke,formatRelative:cke,localize:xke,match:Tke,options:{weekStartsOn:1,firstWeekContainsDate:4}},b1=dp("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90 hover:-translate-y-0.5",accent:"bg-accent text-accent-foreground hover:bg-accent/90 hover:-translate-y-0.5 font-semibold",payment:"bg-[#AAFF00] text-[#0D0D0D] font-black uppercase tracking-wide hover:bg-[#9EF000] hover:-translate-y-0.5 active:translate-y-0 shadow-[0_6px_0_-2px_#0D0D0D] hover:shadow-[0_8px_0_-2px_#0D0D0D]",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-foreground
904/80 bg-transparent text-foreground hover:bg-foreground hover:text-background",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-secondary hover:text-foreground",link:"text-foreground underline-offset-4 hover:underline rounded-none"},size:{default:"h-10 px-5 py-2",sm:"h-9 px-4",lg:"h-12 px-7 text-base",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Q=N.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>{const o=r?fY:"button";return s.jsx(o,{className:ae(b1({variant:t,size:n,className:e})),ref:a,...i})});Q.displayName="Button";var yA="focusScope.autoFocusOnMount",vA="focusScope.autoFocusOnUnmount",A$={bubbles:!1,cancelable:!0},Pke="FocusScope",Rb=N.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[l,c]=N.useState(null),u=Ms(i),d=Ms(a),f=N.useRef(null),h=Qt(t,y=>c(y)),p=N.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;N.useEffect(()=>{if(r){let y=function(j){if(p.paused||!l)return;const E=j.target;l.contains(E)?f.current=E:qd(f.current,{select:!0})},b=function(j){if(p.paused||!l)return;const E=j.relatedTarget;E!==null&&(l.contains(E)||qd(f.current,{select:!0}))},w=function(j){if(document.activeElement===document.body)for(const S of j)S.removedNodes.length>0&&qd(l)};document.addEventListener("focusin",y),document.addEventListener("focusout",b);const _=new MutationObserver(w);return l&&_.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",b),_.disconnect()}}},[r,l,p.paused]),N.useEffect(()=>{if(l){P$.add(p);const y=document.activeElement;if(!l.contains(y)){const w=new CustomEvent(yA,A$);l.addEventListener(yA,u),l.dispatchEvent(w),w.defaultPrevented||(Oke(Lke(oJ(l)),{select:!0}),document.activeElement===y&&qd(l))}return()=>{l.removeEventListener(yA,u),setTimeout(()=>{const w=new CustomEvent(vA,A$);l.addEventListener(vA,d),l.dispatchEvent(w),w.defaultPrevented||qd(y??document.body,{select:!0}),l.removeEventListener(vA,d),P$.remove(p)},0)}}},[l,u,d,p]);const x=N.useCallback(y=>{if(!n&&!r||p.paused)return;const b=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,w=document.activeElement;if(b&&w){const _=y.currentTarget,[j,E]=Dke(_);j&&E?!y.shiftKey&&w===E?(y.preventDefault(),n&&qd(j,{select:!0})):y.shiftKey&&w===j&&(y.preventDefault(),n&&qd(E,{select:!0})):w===_&&y.preventDefault()}},[n,r,p.paused]);return s.jsx(ut.div,{tabIndex:-1,...o,ref:h,onKeyDown:x})});Rb.displayName=Pke;function Oke(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(qd(r,{select:t}),document.activeElement!==n)return}function Dke(e){const t=oJ(e),n=T$(t,e),r=T$(t.reverse(),e);return[n,r]}function oJ(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function T$(e,t){for(const n of e)if(!Ike(n,{upTo:t}))return n}function Ike(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Rke(e){return e instanceof HTMLInputElement&&"select"in e}function qd(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Rke(e)&&t&&e.select()}}var P$=Mke();function Mke(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=O$(e,t),e.unshift(t)},remove(t){var n;e=O$(e,t),(n=e[0])==null||n.resume()}}}function O$(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Lke(e){return e.filter(t=>t.tagName!=="A")}var bA=0;function oC(){N.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??D$()),document.body.insertAdjacentElement("beforeend",e[1]??D$()),bA++,()=>{bA===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),bA--}},[])}function D$(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.
vendor: 4,939 bytes, lines 904-919
904style.position="fixed",e.style.pointerEvents="none",e}var mj="right-scroll-bar-position",pj="width-before-scroll-bar",Fke="with-scroll-bars-hidden",$ke="--removed-body-scroll-bar-size";function wA(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Bke(e,t){var n=N.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var zke=typeof window<"u"?N.useLayoutEffect:N.useEffect,I$=new WeakMap;function Uke(e,t){var n=Bke(null,function(r){return e.forEach(function(i){return wA(i,r)})});return zke(function(){var r=I$.get(n);if(r){var i=new Set(r),a=new Set(e),o=n.current;i.forEach(function(l){a.has(l)||wA(l,null)}),a.forEach(function(l){i.has(l)||wA(l,o)})}I$.set(n,e)},[e]),n}function qke(e){return e}function Vke(e,t){t===void 0&&(t=qke);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var o=t(a,r);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(a){for(r=!0;n.length;){var o=n;n=[],o.forEach(a)}n={push:function(l){return a(l)},filter:function(){return n}}},assignMedium:function(a){r=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(a),o=n}var c=function(){var d=o;o=[],d.forEach(a)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),n}}}};return i}function Hke(e){e===void 0&&(e={});var t=Vke(null);return t.options=Uc({async:!0,ssr:!1},e),t}var lJ=function(e){var t=e.sideCar,n=k0(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return N.createElement(r,Uc({},n))};lJ.isSideCarExport=!0;function Wke(e,t){return e.useMedium(t),lJ}var cJ=Hke(),_A=function(){},lC=N.forwardRef(function(e,t){var n=N.useRef(null),r=N.useState({onScrollCapture:_A,onWheelCapture:_A,onTouchMoveCapture:_A}),i=r[0],a=r[1],o=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,h=e.sideCar,p=e.noRelative,x=e.noIsolation,y=e.inert,b=e.allowPinchZoom,w=e.as,_=w===void 0?"div":w,j=e.gapMode,E=k0(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,T=Uke([n,t]),P=Uc(Uc({},E),i);return N.createElement(N.Fragment,null,d&&N.createElement(S,{sideCar:cJ,removeScrollBar:u,shards:f,noRelative:p,noIsolation:x,inert:y,setCallbacks:a,allowPinchZoom:!!b,lockRef:n,gapMode:j}),o?N.cloneElement(N.Children.only(l),Uc(Uc({},P),{ref:T})):N.createElement(_,Uc({},P,{className:c,ref:T}),l))});lC.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};lC.classNames={fullWidth:pj,zeroRight:mj};var Gke=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Kke(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Gke();return t&&e.setAttribute("nonce",t),e}function Yke(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Xke(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Qke=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Kke())&&(Yke(t,n),Xke(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Jke=function(){var e=Qke();return function(t,n){N.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},uJ=function(){var e=Jke(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},Zke={left:0,top:0,right:0,gap:0},jA=function(e){return parseInt(e||"",10)||0},eCe=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[jA(n),jA(r),jA(i)]},tCe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Zke;var t=eCe(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},nCe=uJ(),Wg="data-scroll-locked",rCe=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),`
905  .`.concat(Fke,` {
906   overflow: hidden `).concat(r,`;
907   padding-right: `).concat(l,"px ").concat(r,`;
908  }
909  body[`).concat(Wg,`] {
910    overflow: hidden `).concat(r,`;
911    overscroll-behavior: contain;
912    `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
913    padding-left: `.concat(i,`px;
914    padding-top: `).concat(a,`px;
915    padding-right: `).concat(o,`px;
916    margin-left:0;
917    margin-top:0;
918    margin-right: `).concat(l,"px ").concat(r,`;
919    `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";
919")].filter(Boolean).join(""),`
920  }
921  
922  .`).concat(mj,` {
923    right: `).concat(l,"px ").concat(r,`;
924  }
925  
926  .`).concat(pj,` {
927    margin-right: `).concat(l,"px ").concat(r,`;
928  }
929  
930  .`).concat(mj," .").concat(mj,` {
931    right: 0 `).concat(r,`;
932  }
933  
934  .`).concat(pj," .").concat(pj,` {
935    margin-right: 0 `).concat(r,`;
936  }
937  
938  body[`).concat(Wg,`] {
939    `).concat($ke,": ").concat(l,`px;
940  }
941`)},R$=function(){var e=parseInt(document.body.getAttribute(Wg)||"0",10);return isFinite(e)?e:0},sCe=function(){N.useEffect(function(){return document.body.setAttribute(Wg,(R$()+1).toString()),function(){var e=R$()-1;e<=0?document.body.removeAttribute(Wg):document.body.setAttribute(Wg,e.toString())}},[])},iCe=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;sCe();var a=N.useMemo(function(){return tCe(i)},[i]);return N.createElement(nCe,{styles:rCe(a,!t,i,n?"":"!important")})},cT=!1;if(typeof window<"u")try{var r_=Object.defineProperty({},"passive",{get:function(){return cT=!0,!0}});window.addEventListener("test",r_,r_),window.removeEventListener("test",r_,r_)}catch{cT=!1}var Up=cT?{passive:!1}:!1,aCe=function(e){return e.tagName==="TEXTAREA"},dJ=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!aCe(e)&&n[t]==="visible")},oCe=function(e){return dJ(e,"overflowY")},lCe=function(e){return dJ(e,"overflowX")},M$=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=fJ(e,r);if(i){var a=hJ(e,r),o=a[1],l=a[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},cCe=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},uCe=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},fJ=function(e,t){return e==="v"?oCe(t):lCe(t)},hJ=function(e,t){return e==="v"?cCe(t):uCe(t)},dCe=function(e,t){return e==="h"&&t==="rtl"?-1:1},fCe=function(e,t,n,r,i){var a=dCe(e,window.getComputedStyle(t).direction),o=a*r,l=n.target,c=t.contains(l),u=!1,d=o>0,f=0,h=0;do{if(!l)break;var p=hJ(e,l),x=p[0],y=p[1],b=p[2],w=y-b-a*x;(x||w)&&fJ(e,l)&&(f+=w,h+=x);var _=l.parentNode;l=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(f)<1||!d&&Math.abs(h)<1)&&(u=!0),u},s_=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},L$=function(e){return[e.deltaX,e.deltaY]},F$=function(e){return e&&"current"in e?e.current:e},hCe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},mCe=function(e){return`
942  .block-interactivity-`.concat(e,` {pointer-events: none;}
943  .allow-interactivity-`).concat(e,` {pointer-events: all;}
944`)},pCe=0,qp=[];function gCe(e){var t=N.useRef([]),n=N.useRef([0,0]),r=N.useRef(),i=N.useState(pCe++)[0],a=N.useState(uJ)[0],o=N.useRef(e);N.useEffect(function(){o.current=e},[e]),N.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var y=Ube([e.lockRef.current],(e.shards||[]).map(F$),!0).filter(Boolean);return y.forEach(function(b){return b.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),y.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var l=N.useCallback(function(y,b){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!o.current.allowPinchZoom;var w=s_(y),_=n.current,j="deltaX"in y?y.deltaX:_[0]-w[0],E="deltaY"in y?y.deltaY:_[1]-w[1],S,T=y.target,P=Math.abs(j)>Math.abs(E)?"h":"v";if("touches"in y&&P==="h"&&T.type==="range")return!1;var O=M$(P,T);if(!O)return!0;if(O?S=P:(S=P==="v"?"h":"v",O=M$(P,T)),!O)return!1;if(!r.current&&"changedTouches"in y&&(j||E)&&(r.current=S),!S)return!0;var D=r.current||S;return fCe(D,b,y,D==="h"?j:E)},[]),c=N.useCallback(function(y){var b=y;if(!(!qp.length||qp[qp.length-1]!==a)){var w="deltaY"in b?L$(b):s_(b),_=t.current.filter(function(S){return S.name===b.type&&(S.target===b.target||b.target===S.shadowParent)&&hCe(S.delta,w)})[0];if(_&&_.should){b.cancelable&&b.preventDefault();return}
vendor: 4,354 bytes, line 944
944if(!_){var j=(o.current.shards||[]).map(F$).filter(Boolean).filter(function(S){return S.contains(b.target)}),E=j.length>0?l(b,j[0]):!o.current.noIsolation;E&&b.cancelable&&b.preventDefault()}}},[]),u=N.useCallback(function(y,b,w,_){var j={name:y,delta:b,target:w,should:_,shadowParent:xCe(w)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(E){return E!==j})},1)},[]),d=N.useCallback(function(y){n.current=s_(y),r.current=void 0},[]),f=N.useCallback(function(y){u(y.type,L$(y),y.target,l(y,e.lockRef.current))},[]),h=N.useCallback(function(y){u(y.type,s_(y),y.target,l(y,e.lockRef.current))},[]);N.useEffect(function(){return qp.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Up),document.addEventListener("touchmove",c,Up),document.addEventListener("touchstart",d,Up),function(){qp=qp.filter(function(y){return y!==a}),document.removeEventListener("wheel",c,Up),document.removeEventListener("touchmove",c,Up),document.removeEventListener("touchstart",d,Up)}},[]);var p=e.removeScrollBar,x=e.inert;return N.createElement(N.Fragment,null,x?N.createElement(a,{styles:mCe(i)}):null,p?N.createElement(iCe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function xCe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const yCe=Wke(cJ,gCe);var Mb=N.forwardRef(function(e,t){return N.createElement(lC,Uc({},e,{ref:t,sideCar:yCe}))});Mb.classNames=lC.classNames;var vCe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Vp=new WeakMap,i_=new WeakMap,a_={},NA=0,mJ=function(e){return e&&(e.host||mJ(e.parentNode))},bCe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=mJ(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},wCe=function(e,t,n,r){var i=bCe(t,Array.isArray(e)?e:[e]);a_[n]||(a_[n]=new WeakMap);var a=a_[n],o=[],l=new Set,c=new Set(i),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};i.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(l.has(h))d(h);else try{var p=h.getAttribute(r),x=p!==null&&p!=="false",y=(Vp.get(h)||0)+1,b=(a.get(h)||0)+1;Vp.set(h,y),a.set(h,b),o.push(h),y===1&&x&&i_.set(h,!0),b===1&&h.setAttribute(n,"true"),x||h.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",h,w)}})};return d(t),l.clear(),NA++,function(){o.forEach(function(f){var h=Vp.get(f)-1,p=a.get(f)-1;Vp.set(f,h),a.set(f,p),h||(i_.has(f)||f.removeAttribute(r),i_.delete(f)),p||f.removeAttribute(n)}),NA--,NA||(Vp=new WeakMap,Vp=new WeakMap,i_=new WeakMap,a_={})}},cC=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=vCe(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),wCe(r,i,n,"aria-hidden")):function(){return null}},uC="Dialog",[pJ,gJ]=Us(uC),[_Ce,_c]=pJ(uC),xJ=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,l=N.useRef(null),c=N.useRef(null),[u,d]=Hi({prop:r,defaultProp:i??!1,onChange:a,caller:uC});return s.jsx(_Ce,{scope:t,triggerRef:l,contentRef:c,contentId:di(),titleId:di(),descriptionId:di(),open:u,onOpenChange:d,onOpenToggle:N.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};xJ.displayName=uC;var yJ="DialogTrigger",vJ=N.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=_c(yJ,n),a=Qt(t,i.triggerRef);return s.jsx(ut.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":eR(i.open),...r,ref:a,onClick:Je(e.onClick,i.onOpenToggle)})});vJ.displayName=yJ;var JI="DialogPortal",[jCe,bJ]=pJ(JI,{forceMount:void 0}),wJ=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=_c(JI,t);return s.jsx(jCe,{scope:t,forceMount:n,children:N.Children.map(r,o=>s.jsx(mi,{present:n||a.open,children:s.jsx(g0,{asChild:!0,container:i,children:o})}))})};wJ.displayName=JI;var w2="DialogOverlay",_J=N.forwardRef((e,t)=>{const n=bJ(w2,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=_c(w2,e.__scopeDialog);return a.modal?s.jsx(mi,{present:r||a.open,children:s.jsx(kCe,{...i,ref:t})}):null});_J.displayName=w2;var NCe=Df("DialogOverlay.RemoveScroll"),kCe=N.forwardRef((e,t)=>
vendor: 5,004 bytes, lines 944-948
944{const{__scopeDialog:n,...r}=e,i=_c(w2,n);return s.jsx(Mb,{as:NCe,allowPinchZoom:!0,shards:[i.contentRef],children:s.jsx(ut.div,{"data-state":eR(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Um="DialogContent",jJ=N.forwardRef((e,t)=>{const n=bJ(Um,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=_c(Um,e.__scopeDialog);return s.jsx(mi,{present:r||a.open,children:a.modal?s.jsx(CCe,{...i,ref:t}):s.jsx(ECe,{...i,ref:t})})});jJ.displayName=Um;var CCe=N.forwardRef((e,t)=>{const n=_c(Um,e.__scopeDialog),r=N.useRef(null),i=Qt(t,n.contentRef,r);return N.useEffect(()=>{const a=r.current;if(a)return cC(a)},[]),s.jsx(NJ,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Je(e.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Je(e.onPointerDownOutside,a=>{const o=a.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&a.preventDefault()}),onFocusOutside:Je(e.onFocusOutside,a=>a.preventDefault())})}),ECe=N.forwardRef((e,t)=>{const n=_c(Um,e.__scopeDialog),r=N.useRef(!1),i=N.useRef(!1);return s.jsx(NJ,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,a),a.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),a.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:a=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=a.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),NJ=N.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,l=_c(Um,n),c=N.useRef(null),u=Qt(t,c);return oC(),s.jsxs(s.Fragment,{children:[s.jsx(Rb,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:s.jsx(up,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":eR(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(ACe,{titleId:l.titleId}),s.jsx(PCe,{contentRef:c,descriptionId:l.descriptionId})]})]})}),ZI="DialogTitle",kJ=N.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=_c(ZI,n);return s.jsx(ut.h2,{id:i.titleId,...r,ref:t})});kJ.displayName=ZI;var CJ="DialogDescription",EJ=N.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=_c(CJ,n);return s.jsx(ut.p,{id:i.descriptionId,...r,ref:t})});EJ.displayName=CJ;var SJ="DialogClose",AJ=N.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=_c(SJ,n);return s.jsx(ut.button,{type:"button",...r,ref:t,onClick:Je(e.onClick,()=>i.onOpenChange(!1))})});AJ.displayName=SJ;function eR(e){return e?"open":"closed"}var TJ="DialogTitleWarning",[SCe,PJ]=Wpe(TJ,{contentName:Um,titleName:ZI,docsSlug:"dialog"}),ACe=({titleId:e})=>{const t=PJ(TJ),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
945
946If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
947
948For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return N.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},TCe="DialogDescriptionWarning",PCe=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${PJ(TCe).contentName}}.`;return N.useEffect(()=>{var a;const i=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Lb=xJ,tR=vJ,Fb=wJ,pp=_J,gp=jJ,S0=kJ,A0=EJ,T0=AJ;const dC=Lb,OCe=tR,_y=T0,DCe=Fb,OJ=N.forwardRef(({className:e,...t},n)=>s.jsx(pp,{className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));OJ.displayName=pp.displayName;const ICe=dp("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4  border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),$b=N.forwardRef(({side:e="right",className:t,children:n,...r},i)=>s.jsxs(DCe,{children:[s.jsx(OJ,{}),s.jsxs(gp,{ref:i,className:ae(ICe({side:e}),t),...r,children:[n,s.jsxs(T0,{className:"absolute right-4 top-4 roun
948ded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[s.jsx(Er,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));$b.displayName=gp.displayName;const nR=({className:e,...t})=>s.jsx("div",{className:ae("flex flex-col space-y-2 text-center sm:text-left",e),...t});nR.displayName="SheetHeader";const fC=N.forwardRef(({className:e,...t},n)=>s.jsx(S0,{ref:n,className:ae("text-lg font-semibold text-foreground",e),...t}));fC.displayName=S0.displayName;const DJ=N.forwardRef(({className:e,...t},n)=>s.jsx(A0,{ref:n,className:ae("text-sm text-muted-foreground",e),...t}));DJ.displayName=A0.displayName;var IJ={exports:{}},RJ={};/**
949 * @license React
950 * use-sync-external-store-shim.production.js
951 *
952 * Copyright (c) Meta Platforms, Inc. and affiliates.
953 *
954 * This source code is licensed under the MIT license found in the
955 * LICENSE file in the root directory of this source tree.
956 */var Nx=N;function RCe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var MCe=typeof Object.is=="function"?Object.is:RCe,LCe=Nx.useState,FCe=Nx.useEffect,$Ce=Nx.useLayoutEffect,BCe=Nx.useDebugValue;function zCe(e,t){var n=t(),r=LCe({inst:{value:n,getSnapshot:t}}),i=r[0].inst,a=r[1];return $Ce(function(){i.value=n,i.getSnapshot=t,kA(i)&&a({inst:i})},[e,n,t]),FCe(function(){return kA(i)&&a({inst:i}),e(function(){kA(i)&&a({inst:i})})},[e]),BCe(n),n}function kA(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!MCe(e,n)}catch{return!0}}function UCe(e,t){return t()}var qCe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?UCe:zCe;RJ.useSyncExternalStore=Nx.useSyncExternalStore!==void 0?Nx.useSyncExternalStore:qCe;IJ.exports=RJ;var VCe=IJ.exports;function HCe(){return VCe.useSyncExternalStore(WCe,()=>!0,()=>!1)}function WCe(){return()=>{}}var rR="Avatar",[GCe]=Us(rR),[KCe,MJ]=GCe(rR),LJ=N.forwardRef((e,t)=>{const{__scopeAvatar:n,...r}=e,[i,a]=N.useState("idle");return s.jsx(KCe,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:s.jsx(ut.span,{...r,ref:t})})});LJ.displayName=rR;var FJ="AvatarImage",$J=N.forwardRef((e,t)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=MJ(FJ,n),l=YCe(r,a),c=Ms(u=>{i(u),o.onImageLoadingStatusChange(u)});return Bs(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?s.jsx(ut.img,{...a,ref:t,src:r}):null});$J.displayName=FJ;var BJ="AvatarFallback",zJ=N.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:r,...i}=e,a=MJ(BJ,n),[o,l]=N.useState(r===void 0);return N.useEffect(()=>{if(r!==void 0){const c=window.setTimeout(()=>l(!0),r);return()=>window.clearTimeout(c)}},[r]),o&&a.imageLoadingStatus!=="loaded"?s.jsx(ut.span,{...i,ref:t}):null});zJ.displayName=BJ;function $$(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function YCe(e,{referrerPolicy:t,crossOrigin:n}){const r=HCe(),i=N.useRef(null),a=r?(i.current||(i.current=new window.Image),i.current):null,[o,l]=N.useState(()=>$$(a,e));return Bs(()=>{l($$(a,e))},[a,e]),Bs(()=>{const c=f=>()=>{l(f)};if(!a)return;const u=c("loaded"),d=c("error");return a.addEventListener("load",u),a.addEventListener("error",d),t&&(a.referrerPolicy=t),typeof n=="string"&&(a.crossOrigin=n),()=>{a.removeEventListener("load",u),a.removeEventListener("error",d)}},[a,n,t]),o}var UJ=LJ,qJ=$J,VJ=zJ;const Bi=N.forwardRef(({className:e,...t},n)=>s.jsx(UJ,{ref:n,className:ae("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));Bi.displayName=UJ.displayName;const Ra=N.forwardRef(({className:e,...t},n)=>s.jsx(qJ,{ref:n,className:ae("aspect-square h-full w-full",e),...t}));Ra.displayName=qJ.displayName;const zi=N.forwardRef(({className:e,...t},n)=>s.jsx(VJ,{ref:n,className:ae("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));zi.displayName=VJ.displayName;var XCe=N.createContext(void 0);function Jf(e){const t=N.useContext(XCe);return e||t||"ltr"}var CA="rovingFocusGroup.onEntryFocus",QCe={bubbles:!1,cancelable:!0},Bb="RovingFocusGroup",[uT,HJ,JCe]=Nb(Bb),[ZCe,Zf]=Us(Bb,[JCe]),[eEe,tEe]=ZCe(Bb),WJ=N.forwardRef((e,t)=>
vendor: 20,794 bytes, line 956
956s.jsx(uT.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(uT.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(nEe,{...e,ref:t})})}));WJ.displayName=Bb;var nEe=N.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=N.useRef(null),p=Qt(t,h),x=Jf(a),[y,b]=Hi({prop:o,defaultProp:l??null,onChange:c,caller:Bb}),[w,_]=N.useState(!1),j=Ms(u),E=HJ(n),S=N.useRef(!1),[T,P]=N.useState(0);return N.useEffect(()=>{const O=h.current;if(O)return O.addEventListener(CA,j),()=>O.removeEventListener(CA,j)},[j]),s.jsx(eEe,{scope:n,orientation:r,dir:x,loop:i,currentTabStopId:y,onItemFocus:N.useCallback(O=>b(O),[b]),onItemShiftTab:N.useCallback(()=>_(!0),[]),onFocusableItemAdd:N.useCallback(()=>P(O=>O+1),[]),onFocusableItemRemove:N.useCallback(()=>P(O=>O-1),[]),children:s.jsx(ut.div,{tabIndex:w||T===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:Je(e.onMouseDown,()=>{S.current=!0}),onFocus:Je(e.onFocus,O=>{const D=!S.current;if(O.target===O.currentTarget&&D&&!w){const R=new CustomEvent(CA,QCe);if(O.currentTarget.dispatchEvent(R),!R.defaultPrevented){const L=E().filter(H=>H.focusable),M=L.find(H=>H.active),B=L.find(H=>H.id===y),F=[M,B,...L].filter(Boolean).map(H=>H.ref.current);YJ(F,d)}}S.current=!1}),onBlur:Je(e.onBlur,()=>_(!1))})})}),GJ="RovingFocusGroupItem",KJ=N.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...l}=e,c=di(),u=a||c,d=tEe(GJ,n),f=d.currentTabStopId===u,h=HJ(n),{onFocusableItemAdd:p,onFocusableItemRemove:x,currentTabStopId:y}=d;return N.useEffect(()=>{if(r)return p(),()=>x()},[r,p,x]),s.jsx(uT.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:s.jsx(ut.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:Je(e.onMouseDown,b=>{r?d.onItemFocus(u):b.preventDefault()}),onFocus:Je(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:Je(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){d.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const w=iEe(b,d.orientation,d.dir);if(w!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let j=h().filter(E=>E.focusable).map(E=>E.ref.current);if(w==="last")j.reverse();else if(w==="prev"||w==="next"){w==="prev"&&j.reverse();const E=j.indexOf(b.currentTarget);j=d.loop?aEe(j,E+1):j.slice(E+1)}setTimeout(()=>YJ(j))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:y!=null}):o})})});KJ.displayName=GJ;var rEe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function sEe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function iEe(e,t,n){const r=sEe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return rEe[r]}function YJ(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function aEe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var hC=WJ,mC=KJ,dT=["Enter"," "],oEe=["ArrowDown","PageUp","Home"],XJ=["ArrowUp","PageDown","End"],lEe=[...oEe,...XJ],cEe={ltr:[...dT,"ArrowRight"],rtl:[...dT,"ArrowLeft"]},uEe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},zb="Menu",[w1,dEe,fEe]=Nb(zb),[xp,QJ]=Us(zb,[fEe,Xf,Zf]),pC=Xf(),JJ=Zf(),[hEe,yp]=xp(zb),[mEe,Ub]=xp(zb),ZJ=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,l=pC(t),[c,u]=N.useState(null),d=N.useRef(!1),f=Ms(a),h=Jf(i);return N.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),s.jsx(Vk,{...l,children:s.jsx(hEe,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:s.jsx(mEe,{scope:t,onClose:N.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:o,children:r})})})};ZJ.displayName=zb;var pEe="MenuAnchor",sR=N.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=pC(n);return s.jsx(Tb,{...i,...r,ref:t})});sR.displayName=pEe;var iR="MenuPortal",[gEe,eZ]=xp(iR,{forceMount:void 0}),tZ=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=yp(iR,t);return s.jsx(gEe,{scope:t,forceMount:n,children:s.jsx(mi,{present:n||a.open,children:s.jsx(g0,{asChild:!0,container:i,children:r})})})};tZ.displayName=iR;var Al="MenuContent",[xEe,aR]=xp(Al),nZ=N.forwardRef((e,t)=>{const n=eZ(Al,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=yp(Al,e.__scopeMenu),o=Ub(Al,e.__scopeMenu);return s.jsx(w1.Provider,{scope:e.__scopeMenu,children:s.jsx(mi,{present:r||a.open,children:s.jsx(w1.Slot,{scope:e.__scopeMenu,children:o.modal?s.jsx(yEe,{...i,ref:t}):s.jsx(vEe,{...i,ref:t})})})})}),yEe=N.forwardRef((e,t)=>{const n=yp(Al,e.__scopeMenu),r=N.useRef(null),i=Qt(t,r);return N.useEffect(()=>{const a=r.current;if(a)return cC(a)},[]),s.jsx(oR,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Je(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),vEe=N.forwardRef((e,t)=>{const n=yp(Al,e.__scopeMenu);return s.jsx(oR,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),bEe=Df("MenuContent.ScrollLock"),oR=N.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:x,...y}=e,b=yp(Al,n),w=Ub(Al,n),_=pC(n),j=JJ(n),E=dEe(n),[S,T]=N.useState(null),P=N.useRef(null),O=Qt(t,P,b.onContentChange),D=N.useRef(0),R=N.useRef(""),L=N.useRef(0),M=N.useRef(null),B=N.useRef("right"),U=N.useRef(0),F=x?Mb:N.Fragment,H=x?{as:bEe,allowPinchZoom:!0}:void 0,z=W=>{var ce,le;const q=R.current+W,oe=E().filter(fe=>!fe.disabled),J=document.activeElement,Y=(ce=oe.find(fe=>fe.ref.current===J))==null?void 0:ce.textValue,Z=oe.map(fe=>fe.textValue),G=OEe(Z,q,Y),se=(le=oe.find(fe=>fe.textValue===G))==null?void 0:le.ref.current;(function fe(be){R.current=be,window.clearTimeout(D.current),be!==""&&(D.current=window.setTimeout(()=>fe(""),1e3))})(q),se&&setTimeout(()=>se.focus())};N.useEffect(()=>()=>window.clearTimeout(D.current),[]),oC();const K=N.useCallback(W=>{var oe,J;return B.current===((oe=M.current)==null?void 0:oe.side)&&IEe(W,(J=M.current)==null?void 0:J.area)},[]);return s.jsx(xEe,{scope:n,searchRef:R,onItemEnter:N.useCallback(W=>{K(W)&&W.preventDefault()},[K]),onItemLeave:N.useCallback(W=>{var q;K(W)||((q=P.current)==null||q.focus(),T(null))},[K]),onTriggerLeave:N.useCallback(W=>{K(W)&&W.preventDefault()},[K]),pointerGraceTimerRef:L,onPointerGraceIntentChange:N.useCallback(W=>{M.current=W},[]),children:s.jsx(F,{...H,children:s.jsx(Rb,{asChild:!0,trapped:i,onMountAutoFocus:Je(a,W=>{var q;W.preventDefault(),(q=P.current)==null||q.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:s.jsx(up,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:s.jsx(hC,{asChild:!0,...j,dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:T,onEntryFocus:Je(c,W=>{w.isUsingKeyboardRef.current||W.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(Hk,{role:"menu","aria-orientation":"vertical","data-state":yZ(b.open),"data-radix-menu-content":"",dir:w.dir,..._,...y,ref:O,style:{outline:"none",...y.style},onKeyDown:Je(y.onKeyDown,W=>{const oe=W.target.closest("[data-radix-menu-content]")===W.currentTarget,J=W.ctrlKey||W.altKey||W.metaKey,Y=W.key.length===1;oe&&(W.key==="Tab"&&W.preventDefault(),!J&&Y&&z(W.key));const Z=P.current;if(W.target!==Z||!lEe.includes(W.key))return;W.preventDefault();const se=E().filter(ce=>!ce.disabled).map(ce=>ce.ref.current);XJ.includes(W.key)&&se.reverse(),TEe(se)}),onBlur:Je(e.onBlur,W=>{W.currentTarget.contains(W.target)||(window.clearTimeout(D.current),R.current="")}),onPointerMove:Je(e.onPointerMove,_1(W=>{const q=W.target,oe=U.current!==W.clientX;if(W.currentTarget.contains(q)&&oe){const J=W.clientX>U.current?"right":"left";B.current=J,U.current=W.clientX}}))})})})})})})});nZ.displayName=Al;var wEe="MenuGroup",lR=N.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return s.jsx(ut.div,{role:"group",...r,ref:t})});lR.displayName=wEe;var _Ee="MenuLabel",rZ=N.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return s.jsx(ut.div,{...r,ref:t})});rZ.displayName=_Ee;var _2="MenuItem",B$="menu.itemSelect",gC=N.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,a=N.useRef(null),o=Ub(_2,e.__scopeMenu),l=aR(_2,e.__scopeMenu),c=Qt(t,a),u=N.useRef(!1),d=()=>{const f=a.current;if(!n&&f){const h=new CustomEvent(B$,{bubbles:!0,cancelable:!0});f.addEventListener(B$,p=>r==null?void 0:r(p),{once:!0}),tI(f,h),h.defaultPrevented?u.current=!1:o.onClose()}};return s.jsx(sZ,{...i,ref:c,disabled:n,onClick:Je(e.onClick,d),onPointerDown:f=>{var h;(h=e.onPointerDown)==null||h.call(e,f),u.current=!0},onPointerUp:Je(e.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:Je(e.onKeyDown,f=>{const h=l.searchRef.current!=="";n||h&&f.key===" "||dT.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});gC.displayName=_2;var sZ=N.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=aR(_2,n),l=JJ(n),c=N.useRef(null),u=Qt(t,c),[d,f]=N.useState(!1),[h,p]=N.useState("");return N.useEffect(()=>{const x=c.current;x&&p((x.textContent??"").trim())},[a.children]),s.jsx(w1.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:s.jsx(mC,{asChild:!0,...l,focusable:!r,children:s.jsx(ut.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:u,onPointerMove:Je(e.onPointerMove,_1(x=>{r?o.onItemLeave(x):(o.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Je(e.onPointerLeave,_1(x=>o.onItemLeave(x))),onFocus:Je(e.onFocus,()=>f(!0)),onBlur:Je(e.onBlur,()=>f(!1))})})})}),jEe="MenuCheckboxItem",iZ=N.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return s.jsx(uZ,{scope:e.__scopeMenu,checked:n,children:s.jsx(gC,{role:"menuitemcheckbox","aria-checked":j2(n)?"mixed":n,...i,ref:t,"data-state":uR(n),onSelect:Je(i.onSelect,()=>r==null?void 0:r(j2(n)?!0:!n),{checkForDefaultPrevented:!1})})})});iZ.displayName=jEe;var aZ="MenuRadioGroup",[NEe,kEe]=xp(aZ,{value:void 0,onValueChange:()=>{}}),oZ=N.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,a=Ms(r);return s.jsx(NEe,{scope:e.__scopeMenu,value:n,onValueChange:a,children:s.jsx(lR,{...i,ref:t})})});oZ.displayName=aZ;var lZ="MenuRadioItem",cZ=N.forwardRef((e,t)=>{const{value:n,...r}=e,i=kEe(lZ,e.__scopeMenu),a=n===i.value;return s.jsx(uZ,{scope:e.__scopeMenu,checked:a,children:s.jsx(gC,{role:"menuitemradio","aria-checked":a,...r,ref:t,"data-state":uR(a),onSelect:Je(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});cZ.displayName=lZ;var cR="MenuItemIndicator",[uZ,CEe]=xp(cR,{checked:!1}),dZ=N.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,a=CEe(cR,n);return s.jsx(mi,{present:r||j2(a.checked)||a.checked===!0,children:s.jsx(ut.span,{...i,ref:t,"data-state":uR(a.checked)})})});dZ.displayName=cR;var EEe="MenuSeparator",fZ=N.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return s.jsx(ut.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});fZ.displayName=EEe;var SEe="MenuArrow",hZ=N.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=pC(n);return s.jsx(Wk,{...i,...r,ref:t})});hZ.displayName=SEe;var AEe="MenuSub",[Awt,mZ]=xp(AEe),rv="MenuSubTrigger",pZ=N.forwardRef((e,t)=>{const n=yp(rv,e.__scopeMenu),r=Ub(rv,e.__scopeMenu),i=mZ(rv,e.__scopeMenu),a=aR(rv,e.__scopeMenu),o=N.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=a,u={__scopeMenu:e.__scopeMenu},d=N.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return N.useEffect(()=>d,[d]),N.useEffect(()=>{const f=l.current;return()=>{window.clearTimeout(f),c(null)}},[l,c]),s.jsx(sR,{asChild:!0,...u,children:s.jsx(sZ,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":yZ(n.open),...e,ref:td(t,i.onTriggerChange),onClick:f=>{var h;(h=e.onClick)==null||h.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Je(e.onPointerMove,_1(f=>{a.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Je(e.onPointerLeave,_1(f=>{var p,x;d();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const y=(x=n.content)==null?void 0:x.dataset.side,b=y==="right",w=b?-5:5,_=h[b?"left":"right"],j=h[b?"right":"left"];a.onPointerGraceIntentChange({area:[{x:f.clientX+w,y:f.clientY},{x:_,y:h.top},{x:j,y:h.top},{x:j,y:h.bottom},{x:_,y:h.bottom}],side:y}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(f),f.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:Je(e.onKeyDown,f=>{var p;const h=a.searchRef.current!=="";e.disabled||h&&f.key===" "||cEe[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});pZ.displayName=rv;var gZ="MenuSubContent",xZ=N.forwardRef((e,t)=>{const n=eZ(Al,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=yp(Al,e.__scopeMenu),o=Ub(Al,e.__scopeMenu),l=mZ(gZ,e.__scopeMenu),c=N.useRef(null),u=Qt(t,c);return s.jsx(w1.Provider,{scope:e.__scopeMenu,children:s.jsx(mi,{present:r||a.open,children:s.jsx(w1.Slot,{scope:e.__scopeMenu,children:s.jsx(oR,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Je(e.onFocusOutside,d=>{d.target!==l.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:Je(e.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:Je(e.onKeyDown,d=>{var p;const f=d.currentTarget.contains(d.target),h=uEe[o.dir].includes(d.key);f&&h&&(a.onOpenChange(!1),(p=l.trigger)==null||p.focus(),d.preventDefault())})})})})})});xZ.displayName=gZ;function yZ(e){return e?"open":"closed"}function j2(e){return e==="indeterminate"}function uR(e){return j2(e)?"indeterminate":e?"checked":"unchecked"}function TEe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function PEe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function OEe(e,t,n){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let o=PEe(e,Math.max(a,0));i.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function DEe(e,t){const{x:n,y:r}=e;let i=!1;for(let a=0,o=t.length-1;a<t.length;o=a++){const l=t[a],c=t[o],u=l.x,d=l.y,f=c.x,h=c.y;d>r!=h>r&&n<(f-u)*(r-d)/(h-d)+u&&(i=!i)}return i}function IEe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return DEe(n,t)}function _1(e){return t=>t.pointerType==="mouse"?e(t):void 0}var REe=ZJ,MEe=sR,LEe=tZ,FEe=nZ,$Ee=lR,BEe=rZ,zEe=gC,UEe=iZ,qEe=oZ,VEe=cZ,HEe=dZ,WEe=fZ,GEe=hZ,KEe=pZ,YEe=xZ,xC="DropdownMenu",[XEe]=Us(xC,[QJ]),Ga=QJ(),[QEe,vZ]=XEe(xC),bZ=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:l=!0}=e,c=Ga(t),u=N.useRef(null),[d,f]=Hi({prop:i,defaultProp:a??!1,onChange:o,caller:xC});return s.jsx(QEe,{scope:t,triggerId:di(),triggerRef:u,contentId:di(),open:d,onOpenChange:f,onOpenToggle:N.useCallback(()=>f(h=>!h),[f]),modal:l,children:s.jsx(REe,{...c,open:d,onOpenChange:f,dir:r,modal:l,children:n})})};bZ.displayName=xC;var wZ="DropdownMenuTrigger",_Z=N.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=vZ(wZ,n),o=Ga(n);return s.jsx(MEe,{asChild:!0,...o,children:s.jsx(ut.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:td(t,a.triggerRef),onPointerDown:Je(e.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(a.onOpenToggle(),a.open||l.preventDefault())}),onKeyDown:Je(e.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&a.onOpenToggle(),l.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});_Z.displayName=wZ;var JEe="DropdownMenuPortal",jZ=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Ga(t);return s.jsx(LEe,{...r,...n})};jZ.displayName=JEe;var NZ="DropdownMenuContent",kZ=N.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=vZ(NZ,n),a=Ga(n),o=N.useRef(!1);return s.jsx(FEe,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:Je(e.onCloseAutoFocus,l=>{var c;o.current||(c=i.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:Je(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!i.modal||d)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});kZ.displayName=NZ;var ZEe="DropdownMenuGroup",eSe=N.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ga(n);return s.jsx($Ee,{...i,...r,ref:t})});eSe.displayName=ZEe;var tSe="DropdownMenuLabel",CZ=N.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ga(n);return s.jsx(BEe,{...i,...r,ref:t})});CZ.displayName=tSe;var nSe="DropdownMenuItem",EZ=N.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ga(n);return s.jsx(zEe,{...i,...r,ref:t})});EZ.displayName=nSe;var rSe="DropdownMenuCheckboxItem",SZ=N.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ga(n);return s.jsx(UEe,{...i,...r,ref:t})});SZ.displayName=rSe;var sSe="DropdownMenuRadioGroup",iSe=N.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ga(n);return s.jsx(qEe,{...i,...r,ref:t})});iSe.displayName=sSe;var aSe="DropdownMenuRadioItem",AZ=N.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ga(n);return s.jsx(VEe,{...i,...r,ref:t})});AZ.displayName=aSe;var oSe="DropdownMenuItemIndicator",TZ=N.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ga(n);return s.jsx(HEe,{...i,...r,ref:t})});TZ.displayName=oSe;var lSe="DropdownMenuSeparator",PZ=N.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ga(n);return s.jsx(WEe,{...i,...r,ref:t})});PZ.displayName=lSe;var cSe="DropdownMenuArrow",uSe=N.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ga(n);return s.jsx(GEe,{...i,...r,ref:t})});uSe.displayName=cSe;var dSe="DropdownMenuSubTrigger",OZ=N.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ga(n);return s.jsx(KEe,{...i,...r,ref:t})});OZ.displayName=dSe;var fSe="DropdownMenuSubContent",DZ=N.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ga(n);return s.jsx(YEe,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});DZ.displayName=fSe;var hSe=bZ,mSe=_Z,pSe=jZ,IZ=kZ,RZ=CZ,MZ=EZ,LZ=SZ,FZ=AZ,$Z=TZ,BZ=PZ,zZ=OZ,UZ=DZ;const eh=hSe,th=mSe,gSe=N.forwardRef(({className:e,inset:t,children:n,...r},i)=>s.jsxs(zZ,{ref:i,className:ae("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",t&&"pl-8",e),...r,children:[n,s.jsx(la,{className:"ml-auto h-4 w-4"})]}));
956gSe.displayName=zZ.displayName;const xSe=N.forwardRef(({className:e,...t},n)=>s.jsx(UZ,{ref:n,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));xSe.displayName=UZ.displayName;const yd=N.forwardRef(({className:e,sideOffset:t=4,...n},r)=>s.jsx(pSe,{children:s.jsx(IZ,{ref:r,sideOffset:t,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));
956yd.displayName=IZ.displayName;const Dr=N.forwardRef(({className:e,inset:t,...n},r)=>s.jsx(MZ,{ref:r,className:ae("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...n}));Dr.displayName=MZ.displayName;const ySe=N.forwardRef(({className:e,children:t,checked:n,...r},i)=>s.jsxs(LZ,{ref:i,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),checked:n,...r,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx($Z,{children:s.jsx(is,{className:"h-4 w-4"})})}),t]}));ySe.displayName=LZ.displayName;const vSe=N.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(FZ,{ref:r,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx($Z,{children:s.jsx(qY,{className:"h-2 w-2 fill-current"})})}),t]}));vSe.displayName=FZ.displayName;const gj=N.forwardRef(({className:e,inset:t,...n},r)=>s.jsx(RZ,{ref:r,className:ae("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));gj.displayName=RZ.displayName;const Vu=N.forwardRef(({className:e,...t},n)=>s.jsx(BZ,{ref:n,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));Vu.displayName=BZ.displayName;const bSe={sm:{chess:"text-[1.25rem] md:text-[1.4rem]",agenda:"text-[0.78rem] md:text-[0.85rem]",gap:"gap-1.5",tracking:"0.18em"},md:{chess:"text-[1.6rem] md:text-[1.8rem]",agenda:"text-[0.95rem] md:text-[1.05rem]",gap:"gap-2",tracking:"0.20em"},lg:{chess:"text-[2.2rem] md:text-[2.6rem]",agenda:"text-[1.2rem] md:text-[1.35rem]",gap:"gap-2.5",tracking:"0.22em"}},vc=({size:e="md",variant:t="default",className:n})=>{const r=bSe[e],a=t==="inverse"?"text-[#F5F3EE]":"text-[#0D0D0D]";return s.jsxs("div",{className:ae("inline-flex items-baseline leading-none select-none",r.gap,a,n),"aria-label":"Chess Agenda",children:[s.jsx("span",{className:ae("italic font-medium",r.chess),style:{fontFamily:"'Playfair Display', serif",fontStyle:"italic",letterSpacing:"-0.01em"},children:"chess"}),s.jsx("span",{className:ae("uppercase font-normal",r.agenda),style:{fontFamily:"'Barlow Condensed', system-ui, sans-serif",letterSpacing:r.tracking},children:"agenda"})]})},wSe=e=>{const[t,n]=e.split("@");if(!n)return e;const r=Math.min(4,Math.floor(t.length/2));return`${t.slice(0,r)}***@${n}`},tr=()=>{var y;const[e,t]=N.useState(!1),{user:n,profile:r,isAdmin:i,isVenue:a,isPlayer:o,signOut:l,isLoading:c}=Tt(),u=Rr(),d=()=>i?"/admin":a?"/venue":o?"/player":"/",f=()=>r!=null&&r.display_name?r.display_name.slice(0,2).toUpperCase():n!=null&&n.email?n.email.slice(0,2).toUpperCase():"U",h=()=>i?"Administrateur":a?"Lieu partenaire":"Joueur",p=[{to:"/events",label:"Tournois"},{to:"/venues",label:"Lieux"}],x=async()=>{t(!1),await l(),u("/")};return s.jsx("header",{className:"fixed top-0 left-0 right-0 z-50 glass border-b border-border/50",children:s.jsxs("div",{className:"container mx-auto px-4 h-16 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-8",children:[s.jsx(Pe,{to:"/",className:"group",children:s.jsx(vc,{size:"md",className:"[&>img]:w-10 [&>img]:h-10"})}),s.jsx("nav",{className:"hidden md:flex items-center gap-6",children:p.map(b=>s.jsx(g2,{to:b.to,className:({isActive:w})=>ae("text-sm font-medium transition-colors hover:text-primary",w?"text-primary":"text-muted-foreground"),children:b.label},b.to))})]}),s.jsx("div",{className:"hidden md:flex items-center gap-4",children:c?s.jsx("div",{className:"h-9 w-24 bg-muted animate-pulse rounded-md"}):n?s.jsxs(eh,{children:[s.jsx(th,{asChild:!0,children:s.jsxs(Q,{variant:"ghost",className:"gap-2 px-2",children:[s.jsx(Bi,{className:"h-7 w-7",children:s.jsx(zi,{className:"text-xs bg-primary/10 text-primary font-medium",children:f()})}),s.jsx("span",{className:"max-w-32 truncate text-sm",children:(r==null?void 0:r.display_name)||((y=n.email)==null?void 0:y.split("@")[0])}),s.jsx(Wa,{className:"h-4 w-4 opacity-50"})]})}),s.jsxs(yd,{align:"end",className:"w-48",children:[s.jsx(Dr,{asChild:!0,children:s.jsxs(Pe,{to:d(),className:"gap-2 cursor-pointer",children:[s.jsx(_5,{className:"h-4 w-4"}),"Mon espace"]})}),s.jsx(Vu,{}),s.jsxs(Dr,{onClick:x,className:"gap-2 text-destructive focus:text-destructive cursor-pointer",children:[s.jsx(a1,{className:"h-4 w-4"}),"Déconnexion"]})]})]}):s.jsx(Pe,{to:"/auth",className:"text-sm font-medium text-foreground
956/80 hover:text-foreground transition-colors underline-offset-4 hover:underline",children:"Connexion"})}),s.jsx("div",{className:"md:hidden",children:s.jsxs(dC,{open:e,onOpenChange:t,children:[s.jsx(OCe,{asChild:!0,children:s.jsx(Q,{variant:"ghost",size:"icon","aria-label":"Ouvrir le menu",children:s.jsx(ZY,{className:"h-5 w-5"})})}),s.jsxs($b,{side:"right",className:"w-72 flex flex-col",children:[s.jsx("div",{className:"flex items-center pb-4 border-b border-border",children:s.jsx(vc,{size:"sm"})}),s.jsx("nav",{className:"flex flex-col gap-1 py-6 flex-1",children:p.map(b=>s.jsx(_y,{asChild:!0,children:s.jsx(g2,{to:b.to,className:({isActive:w})=>ae("flex items-center gap-3 px-3 py-2.5 rounded-lg text-base font-medium transition-colors",w?"bg-primary/10 text-primary":"text-foreground hover:bg-muted"),children:b.label})},b.to))}),s.jsx("div",{className:"pt-4 border-t border-border",children:c?s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"h-12 bg-muted animate-pulse rounded-lg"}),s.jsx("div",{className:"h-10 bg-muted animate-pulse rounded-md"})]}):n?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 bg-muted/50 rounded-lg",children:[s.jsx(Bi,{className:"h-9 w-9",children:s.jsx(zi,{className:"bg-primary/10 text-primary font-medium",children:f()})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:(r==null?void 0:r.display_name)||n.email}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:r!=null&&r.email?wSe(r.email):""}),s.jsx("p",{className:"text-xs text-muted-foreground",children:h()})]})]}),s.jsx(_y,{asChild:!0,children:s.jsx(Pe,{to:d(),className:"block",children:s.jsxs(Q,{variant:"outline",className:"w-full justify-start gap-2",children:[s.jsx(_5,{className:"h-4 w-4"}),"Mon espace"]})})}),o&&s.jsxs(s.Fragment,{children:[s.jsx(_y,{asChild:!0,children:s.jsx(Pe,{to:"/player/history",className:"block",children:s.jsxs(Q,{variant:"ghost",className:"w-full justify-start gap-2",children:[s.jsx(vo,{className:"h-4 w-4"}),"Mes inscriptions"]})})}),s.jsx(_y,{asChild:!0,children:s.jsx(Pe,{to:"/player/profile",className:"block",children:s.jsxs(Q,{variant:"ghost",className:"w-full justify-start gap-2",children:[s.jsx(Cs,{className:"h-4 w-4"}),"Mon profil"]})})})]}),s.jsxs(Q,{variant:"ghost",className:"w-full justify-start gap-2 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:x,children:[s.jsx(a1,{className:"h-4 w-4"}),"Déconnexion"]})]}):s.jsx(_y,{asChild:!0,children:s.jsx(Pe,{to:"/auth",className:"block",children:s.jsx(Q,{variant:"outline",className:"w-full rounded-full border-foreground
956/80 text-foreground hover:bg-foreground hover:text-background transition-colors",children:"Connexion"})})})})]})]})})]})})};var yC="Collapsible",[_Se,qZ]=Us(yC),[jSe,dR]=_Se(yC),VZ=N.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...l}=e,[c,u]=Hi({prop:r,defaultProp:i??!1,onChange:o,caller:yC});return s.jsx(jSe,{scope:n,disabled:a,contentId:di(),open:c,onOpenToggle:N.useCallback(()=>u(d=>!d),[u]),children:s.jsx(ut.div,{"data-state":pR(c),"data-disabled":a?"":void 0,...l,ref:t})})});VZ.displayName=yC;var HZ="CollapsibleTrigger",fR=N.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=dR(HZ,n);return s.jsx(ut.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":pR(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:Je(e.onClick,i.onOpenToggle)})});fR.displayName=HZ;var hR="CollapsibleContent",mR=N.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=dR(hR,e.__scopeCollapsible);return s.jsx(mi,{present:n||i.open,children:({present:a})=>s.jsx(NSe,{...r,ref:t,present:a})})});mR.displayName=hR;var NSe=N.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:i,...a}=e,o=dR(hR,n),[l,c]=N.useState(r),u=N.useRef(null),d=Qt(t,u),f=N.useRef(0),h=f.current,p=N.useRef(0),x=p.current,y=o.open||l,b=N.useRef(y),w=N.useRef(void 0);return N.useEffect(()=>{const _=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(_)},[]),Bs(()=>{const _=u.current;if(_){w.current=w.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const j=_.getBoundingClientRect();f.current=j.height,p.current=j.width,b.current||(_.style.transitionDuration=w.current.transitionDuration,_.style.animationName=w.current.animationName),c(r)}},[o.open,r]),s.jsx(ut.div,{"data-state":pR(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!y,...a,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:y&&i})});function pR(e){return e?"open":"closed"}var WZ=VZ,kSe=fR,CSe=mR,jc="Accordion",ESe=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[gR,SSe,ASe]=Nb(jc),[vC]=Us(jc,[ASe,qZ]),xR=qZ(),GZ=ee.forwardRef((e,t)=>{const{type:n,...r}=e,i=r,a=r;return s.jsx(gR.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?s.jsx(DSe,{...a,ref:t}):s.jsx(OSe,{...i,ref:t})})});GZ.displayName=jc;var[KZ,TSe]=vC(jc),[YZ,PSe]=vC(jc,{collapsible:!1}),OSe=ee.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:a=!1,...o}=e,[l,c]=Hi({prop:n,defaultProp:r??"",onChange:i,caller:jc});return s.jsx(KZ,{scope:e.__scopeAccordion,value:ee.useMemo(()=>l?[l]:[],[l]),onItemOpen:c,onItemClose:ee.useCallback(()=>a&&c(""),[a,c]),children:s.jsx(YZ,{scope:e.__scopeAccordion,collapsible:a,children:s.jsx(XZ,{...o,ref:t})})})}),DSe=ee.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,l]=Hi({prop:n,defaultProp:r??[],onChange:i,caller:jc}),c=ee.useCallback(d=>l((f=[])=>[...f,d]),[l]),u=ee.useCallback(d=>l((f=[])=>f.filter(h=>h!==d)),[l]);return s.jsx(KZ,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:u,children:s.jsx(YZ,{scope:e.__scopeAccordion,collapsible:!0,children:s.jsx(XZ,{...a,ref:t})})})}),[ISe,bC]=vC(jc),XZ=ee.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:i,orientation:a="vertical",...o}=e,l=ee.useRef(null),c=Qt(l,t),u=SSe(n),f=Jf(i)==="ltr",h=Je(e.onKeyDown,p=>{var O;if(!ESe.includes(p.key))return;const x=p.target,y=u().filter(D=>{var R;return!((R=D.ref.current)!=null&&R.disabled)}),b=y.findIndex(D=>D.ref.current===x),w=y.length;if(b===-1)return;p.preventDefault();let _=b;const j=0,E=w-1,S=()=>{_=b+1,_>E&&(_=j)},T=()=>{_=b-1,_<j&&(_=E)};switch(p.key){case"Home":_=j;break;case"End":_=E;break;case"ArrowRight":a==="horizontal"&&(f?S():T());break;case"ArrowDown":a==="vertical"&&S();break;case"ArrowLeft":a==="horizontal"&&(f?T():S());break;case"ArrowUp":a==="vertical"&&T();break}const P=_%w;(O=y[P].ref.current)==null||O.focus()});return s.jsx(ISe,{scope:n,disabled:r,direction:i,orientation:a,children:s.jsx(gR.Slot,{scope:n,children:s.jsx(ut.div,{...o,"data-orientation":a,ref:c,onKeyDown:r?void 0:h})})})}),N2="AccordionItem",[RSe,yR]=vC(N2),QZ=ee.forwardRef((e,t)=>
956{const{__scopeAccordion:n,value:r,...i}=e,a=bC(N2,n),o=TSe(N2,n),l=xR(n),c=di(),u=r&&o.value.includes(r)||!1,d=a.disabled||e.disabled;return s.jsx(RSe,{scope:n,open:u,disabled:d,triggerId:c,children:s.jsx(WZ,{"data-orientation":a.orientation,"data-state":ree(u),...l,...i,ref:t,disabled:d,open:u,onOpenChange:f=>{f?o.onItemOpen(r):o.onItemClose(r)}})})});QZ.displayName=N2;var JZ="AccordionHeader",ZZ=ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=bC(jc,n),a=yR(JZ,n);return s.jsx(ut.h3,{"data-orientation":i.orientation,"data-state":ree(a.open),"data-disabled":a.disabled?"":void 0,...r,ref:t})});ZZ.displayName=JZ;var fT="AccordionTrigger",eee=ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=bC(jc,n),a=yR(fT,n),o=PSe(fT,n),l=xR(n);return s.jsx(gR.ItemSlot,{scope:n,children:s.jsx(kSe,{"aria-disabled":a.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...l,...r,ref:t})})});eee.displayName=fT;var tee="AccordionContent",nee=ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=bC(jc,n),a=yR(tee,n),o=xR(n);return s.jsx(CSe,{role:"region","aria-labelledby":a.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});nee.displayName=tee;function ree(e){return e?"open":"closed"}var MSe=GZ,LSe=QZ,FSe=ZZ,see=eee,iee=nee;const wC=MSe,kx=N.forwardRef(({className:e,...t},n)=>s.jsx(LSe,{ref:n,className:ae("border-b",e),...t}));kx.displayName="AccordionItem";const Cx=N.forwardRef(({className:e,children:t,...n},r)=>s.jsx(FSe,{className:"flex",children:s.jsxs(see,{ref:r,className:ae("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,s.jsx(Wa,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Cx.displayName=see.displayName;const Ex=N.forwardRef(({className:e,children:t,...n},r)=>s.jsx(iee,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:s.jsx("div",{className:ae("pb-4 pt-0",e),children:t})}));Ex.displayName=iee.displayName;function Ie({className:e,...t}){return s.jsx("div",{className:ae("animate-pulse rounded-md bg-muted",e),...t})}const vR=[{value:"01",label:"1er",postalCode:"75001"},{value:"02",label:"2e",postalCode:"75002"},{value:"03",label:"3e",postalCode:"75003"},{value:"04",label:"4e",postalCode:"75004"},{value:"05",label:"5e",postalCode:"75005"},{value:"06",label:"6e",postalCode:"75006"},{value:"07",label:"7e",postalCode:"75007"},{value:"08",label:"8e",postalCode:"75008"},{value:"09",label:"9e",postalCode:"75009"},{value:"10",label:"10e",postalCode:"75010"},{value:"11",label:"11e",postalCode:"75011"},{value:"12",label:"12e",postalCode:"75012"},{value:"13",label:"13e",postalCode:"75013"},{value:"14",label:"14e",postalCode:"75014"},{value:"15",label:"15e",postalCode:"75015"},{value:"16",label:"16e",postalCode:"75016"},{value:"17",label:"17e",postalCode:"75017"},{value:"18",label:"18e",postalCode:"75018"},{value:"19",label:"19e",postalCode:"75019"},{value:"20",label:"20e",postalCode:"75020"}];function bR(e,t){const n=aee(e,t);return(n==null?void 0:n.city)==="Paris"?n.arr:null}function aee(e,t){const n=[{prefix:"750",city:"Paris",max:20},{prefix:"690",city:"Lyon",max:9},{prefix:"130",city:"Marseille",max:16}],r=i=>{for(const{prefix:a,city:o,max:l}of n){if(!i.startsWith(a))continue;const c=parseInt(i.slice(3),10);if(!(!Number.isFinite(c)||c<1||c>l))return{city:o,arr:String(c).padStart(2,"0")}}return null};if(e){const i=r(e.trim());if(i)return i}if(t){const i=t.match(/\b(750\d{2}|690\d{2}|130\d{2})\b/);if(i){const a=r(i[1]);if(a)return a}}return null}function qm(e){if(!e)return!1;const t=e.toLowerCase().trim();return t==="paris"||t.startsWith("paris ")}function $Se(e){const t=parseInt(e,10);return t===1?"1er":`${t}e`}function wR(e,t,n,r){const i=aee(t,r);return i?`${i.city} ${$Se(i.arr)}`:t&&e?`${t} ${e}`:n&&n!=="France"?`${e}, ${n}`:e}function oee(e,t){const n=e==null?void 0:e.trim();return!n||t&&n.toUpperCase()===t.trim().toUpperCase()||/^\d{4,5}$/.test(n)?null:n}const xj=[{value:"blitz",label:"Blitz",description:"5-7 min"},{value:"rapid",label:"Rapide",description:"10 min"}],yj=[{value:"swiss",label:"Suisse"}];function BSe(e,t){if(!e)return!1;const n=parseInt(e.split("+")[0]||"0");switch(t){case"blitz":return n<10;case"rapid":return n>=10;default:return!0}}function lee(e={}){return st({queryKey:["events",e],queryFn:async()=>{let t=re.from("events").select(`
957          *,
958          venue:venues!events_venue_id_fkey (
959            id,
960            name,
961            slug,
962            city,
963            address,
964            postal_code,
965            country,
966            latitude,
967            longitude,
968            brand_color,
969            logo_url,
970            cover_image_url,
971            district_label,
972            default_coupon_mode,
973            default_paper_coupon_label,
974            default_paper_coupon_description,
975            default_paper_coupon_formulas
976          )
977        `).order("event_date",{ascending:!0});e.status&&(Array.isArray(e.status)?t=t.in("status",e.status):t=t.eq("status",e.status)),e.venueId&&(t=t.eq("venue_id",e.venueId));const n=Sl(new Date);if(e.dateRange==="today"){const o=ai(n,1);t=t.gte("event_date",n.toISOString()).lt("event_date",o.toISOString())}else if(e.dateRange==="week"){const o=E0(n,{weekStartsOn:1}
977);t=t.gte("event_date",n.toISOString()).lte("event_date",o.toISOString())}else if(e.dateRange==="month"){const o=mp(n);t=t.gte("event_date",n.toISOString()).lte("event_date",o.toISOString())}else e.upcoming&&(t=t.gte("event_date",new Date().toISOString()));if(e.search){const o=hI(e.search);t=t.ilike("title",`%${o}%`)}const{data:r,error:i}=await t;if(i)throw i;let a=r;return e.arrondissement&&(a=a.filter(o=>{var c,u,d;return qm((c=o.venue)==null?void 0:c.city)?bR((u=o.venue)==null?void 0:u.postal_code,(d=o.venue)==null?void 0:d.address)===e.arrondissement:!1})),e.city&&(e.country?a=a.filter(o=>{var l,c;return((l=o.venue)==null?void 0:l.city)===e.city&&((c=o.venue)==null?void 0:c.country)===e.country}):a=a.filter(o=>{var l,c,u,d;return((c=(l=o.venue)==null?void 0:l.city)==null?void 0:c.toLowerCase())===((u=e.city)==null?void 0:u.toLowerCase())&&!qm((d=o.venue)==null?void 0:d.city)})),e.format&&(a=a.filter(o=>o.format===e.format)),e.cadence&&(a=a.filter(o=>BSe(o.time_control,e.cadence))),a}})}function nh(e){return st({queryKey:["event",e],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await re.from("events").select(`
978          *,
979          venue:venues!events_venue_id_fkey (
980            id,
981            name,
982            slug,
983            city,
984            address,
985            description,
986            postal_code,
987            country,
988            brand_color,
989            logo_url,
990            cover_image_url,
991            district_label,
992            default_coupon_mode,
993            default_paper_coupon_label,
994            default_paper_coupon_description,
995            default_paper_coupon_formulas
996          )
997        `).eq("id",e).maybeSingle();if(n)throw n;return t},enabled:!!e,placeholderData:t=>t,staleTime:1e4})}function _C(e){return st({queryKey:["event-tickets-count",e],queryFn:async()=>{if(!e)return 0;const{data:t,error:n}=await re.rpc("get_event_ticket_count",{p_event_id:e});if(n)throw n;return t??0},enabled:!!e,staleTime:2e3,refetchOnWindowFocus:!0})}function zSe(e){const t=Ye(),n=_C(e);return N.useEffect(()=>{if(!e)return;const r=re.channel(`event-ticket-count-${e}`).on("postgres_changes",{event:"*",schema:"public",table:"tickets",filter:`event_id=eq.${e}`},()=>{t.invalidateQueries({queryKey:["event-tickets-count",e]}),t.refetchQueries({queryKey:["event-tickets-count",e]})}).subscribe();return()=>{re.removeChannel(r)}},[e,t]),n}function USe(){const e=Ye();return dt({mutationFn:async({baseEvent:t,dates:n,startTime:r})=>{const i=n.map(l=>{const[c,u]=r.split(":").map(Number),d=new Date(l);
997d.setHours(c,u,0,0);const f=new Date(d.getTime()-2*60*60*1e3);return{...t,event_date:d.toISOString(),registration_deadline:f.toISOString(),status:"draft"}}),{data:a,error:o}=await re.from("events").insert(i).select();if(o)throw o;return a},onSuccess:t=>{e.invalidateQueries({queryKey:["events"]}),e.invalidateQueries({queryKey:["venue-events"]}),e.invalidateQueries({queryKey:["venue-events-upcoming"]}),e.invalidateQueries({queryKey:["venue-events-past"]}),e.invalidateQueries({queryKey:["venue-event-stats"]}),dn({title:t.length>1?`${t.length} événements créés`:"Événement créé",description:t.length>1?`${t.length} événements ont été créés avec succès.`:"L'événement a été créé avec succès."})},onError:t=>{dn({title:"Erreur",description:`Impossible de créer les événements: ${t.message}`,variant:"destructive"})}})}function qSe(){const e=Ye();return dt({mutationFn:async({id:t,...n})=>{const{data:r,error:i}=await re.from("events").update(n).eq("id",t).select().maybeSingle();if(i)throw i.code==="PGRST116"?new Error("Vous n'avez pas les droits pour modifier cet événement, ou son statut ne permet plus cette modification."):i;if(!r)throw new Error("Vous n'avez pas les droits pour modifier cet événement, ou son statut ne permet plus cette modification.");return r},onSuccess:t=>{e.invalidateQueries({queryKey:["events"]}),e.invalidateQueries({queryKey:["event",t.id]}),e.invalidateQueries({queryKey:["venue-events"]}),e.invalidateQueries({queryKey:["venue-events-upcoming"]}),e.invalidateQueries({queryKey:["venue-events-past"]}),e.invalidateQueries({queryKey:["venue-event-stats"]}),dn({title:"Événement mis à jour",description:"Les modifications ont été enregistrées."})},onError:t=>{dn({title:"Erreur",description:`Impossible de mettre à jour l'événement: ${t.message}`,variant:"destructive"})}})}function qb(){const e=Ye();return dt({mutationFn:async({id:t,status:n})=>{const{data:r,error:i}=await re.from("events").update({status:n}).eq("id",t).select(`
998          *,
999          venue:venues!events_venue_id_fkey (
1000            id,
1001            name,
1002            slug,
1003            city,
1004            address,
1005            description
1006          )
1007        `).single();if(i)throw i;return r},onSuccess:t=>{dn({title:"Statut mis à jour",description:`L'événement est maintenant ${{draft:"en brouillon",published:"publié",ongoing:"en cours",completed:"terminé",cancelled:"annulé"}[t.status]}.`}),setTimeout(()=>{e.invalidateQueries({queryKey:["events"]}),e.invalidateQueries({queryKey:["event",t.id]}),e.invalidateQueries({queryKey:["venue-events"]}),e.invalidateQueries({queryKey:["venue-events-upcoming"]}),e.invalidateQueries({queryKey:["venue-events-past"]}),e.invalidateQueries({queryKey:["venue-event-stats"]}),e.invalidateQueries({queryKey:["upcoming-events"]}),e.invalidateQueries({queryKey:["tournament-threshold",t.id]})},100)},onError:t=>{dn({title:"Erreur",description:`Impossible de changer le statut: ${t.message}`,variant:"destructive"})}})}function cee(){const e=Ye();return dt({mutationFn:async t=>{const{data:n,error:r}=await re.from("events").select("*").eq("id",t).single();if(r)throw r;const{id:i,created_at:a,updated_at:o,status:l,...c}=n,{data:u,error:d}=await re.from("events").insert({...c,title:`${c.title} (copie)`,status:"draft",event_date:new Date(Date.now()+7*24*60*60*1e3).toISOString()}).select().single();if(d)throw d;return u},onSuccess:()=>{e.invalidateQueries({queryKey:["events"]}),dn({title:"Événement dupliqué",description:"La copie a été créée en brouillon."})},onError:t=>{dn({title:"Erreur",description:`Impossible de dupliquer l'événement: ${t.message}`,variant:"destructive"})}})}function uee(e=3){return st({queryKey:["upcoming-events",e],queryFn:async()=>{const{data:t,error:n}=await re.from("events").select(`
1008          *,
1009          venue:venues!events_venue_id_fkey (
1010            id,
1011            name,
1012            slug,
1013            city,
1014            address,
1015            postal_code,
1016            country,
1017            latitude,
1018            longitude,
1019            logo_url,
1020            cover_image_url,
1021            brand_color,
1022            district_label,
1023            default_coupon_mode,
1024            default_paper_coupon_label,
1025            default_paper_coupon_description,
1026            default_paper_coupon_formulas
1027          )
1028        `).eq("status","published").gte("event_date",new Date().toISOString()).order("event_date",{ascending:!0}).limit(e);
1028if(n)throw n;return t}})}function _R(e){return st({queryKey:["events-ticket-counts",[...e].sort()],queryFn:async()=>{if(e.length===0)return{};const{data:t,error:n}=await re.rpc("get_events_ticket_counts",{p_event_ids:e});if(n)throw n;const r={};return e.forEach(i=>r[i]=0),t==null||t.forEach(i=>{r[i.event_id]=i.ticket_count}),r},enabled:e.length>0,staleTime:2e3,refetchOnWindowFocus:!0})}function jR(e){const t=Ye(),n=_R(e),r=N.useMemo(()=>[...e].sort().join(","),[e]);return N.useEffect(()=>{if(!r)return;const i=r.split(",").filter(Boolean);if(i.length===0)return;const a=re.channel(`tickets-realtime-global-${Date.now()}`).on("postgres_changes",{event:"*",schema:"public",table:"tickets"},o=>{var c,u;const l=((c=o.new)==null?void 0:c.event_id)||((u=o.old)==null?void 0:u.event_id);l&&i.includes(l)&&(t.invalidateQueries({queryKey:["events-ticket-counts"]}),t.refetchQueries({queryKey:["events-ticket-counts"]}),t.invalidateQueries({queryKey:["event-tickets-count",l]}))}).subscribe();return()=>{re.removeChannel(a)}},[r,t]),n}function VSe(e){return st({queryKey:["event-interested-count",e],queryFn:async()=>{if(!e)return 0;const{data:t,error:n}=await re.rpc("get_event_interested_count",{p_event_id:e});if(n)throw n;return t??0},enabled:!!e,staleTime:3e4})}function HSe(e){return st({queryKey:["events-interested-counts",[...e].sort()],queryFn:async()=>{if(e.length===0)return{};const{data:t,error:n}=await re.rpc("get_events_interested_counts",{p_event_ids:e});if(n)throw n;const r={};return e.forEach(i=>r[i]=0),t==null||t.forEach(i=>{r[i.event_id]=i.interested_count}),r},enabled:e.length>0,staleTime:3e4})}function dee({event:e,ticketCount:t}){const n=e.venue,r=(n==null?void 0:n.brand_color)||"#C4B5FD",i=e.logo_url||(n==null?void 0:n.logo_url)||null,a=e.cover_image_url||(n==null?void 0:n.cover_image_url)||null,o=((n==null?void 0:n.district_label)||(n==null?void 0:n.name)||"—").toString(),c=e.capacity-t<=0,u=((n==null?void 0:n.name)||"??").split(" ").map(y=>y[0]).join("").slice(0,2).toUpperCase(),d=e.card_subtitle||`${(n==null?void 0:n.name)??""}${n!=null&&n.city?" · "+n.city:""}`.trim();let f=null;n&&(qm(n.city)?f=n.postal_code||"Paris":n.city?f=n.city:n.postal_code&&(f=n.postal_code));const h=new Date(e.event_date),p=Ze(h,"dd",{locale:pt}),x=Ze(h,"MMM",{locale:pt}).toUpperCase().replace(".","");return s.jsxs(Pe,{to:`/events/${e.id}`,className:"group block","aria-label":`${e.title} — ${o}${c?" — Complet":""}`,children:[s.jsxs("div",{className:"relative aspect-square w-full rounded-2xl overflow-hidden transition-transform duration-300 group-hover:-translate-y-1 group-hover:rotate-[-1deg] shadow-lg",style:{backgroundColor:r,color:"#0D0D0D"},children:[c?s.jsx("div",{className:"absolute top-3 left-3 z-10 inline-flex items-center rounded-full px-2 py-0.5 sm:px-2.5 sm:py-1 text-[9px] sm:text-[10px] uppercase tracking-[0.18em]",style:{fontFamily:"'Fragment Mono', ui-monospace, monospace",backgroundColor:"#0D0D0D",color:"#F5F3EE"},children:"Complet"}):f&&s.jsx("div",{className:"absolute top-3 left-3 z-10 inline-flex items-center rounded-full backdrop-blur-sm border border-black/10 px-2 py-0.5 sm:px-2.5 sm:py-1 text-[9px] sm:text-[10px] uppercase tracking-[0.18em] bg-transparent",style:{fontFamily:"'Fragment Mono', ui-monospace, monospace",color:"rgba(13,13,13,0.7)"},children:f}),s.jsxs("div",{className:"absolute top-3 right-3 z-10 text-right font-bricolage",style:{color:"#0D0D0D"},children:[s.jsx("div",{className:"text-2xl sm:text-3xl md:text-4xl font-black leading-none",children:p}),s.jsx("div",{className:"text-[10px] sm:text-[11px] tracking-[0.2em] font-bold uppercase mt-0.5",children:x})]}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center px-4",children:s.jsxs("div",{className:"relative flex items-center w-full justify-center",children:[s.jsx("div",{className:"aspect-square rounded-full bg-white/30 backdrop-blur-sm flex items-center justify-center overflow-hidden ring-1 ring-black/5",style:{width:"44%",marginRight:"-14%"},children:i?s.jsx("img",{src:i,alt:"",className:"w-full h-full object-cover"}):s.jsx("span",{className:"text-2xl font-black opacity-70",style:{fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:u})}),s.jsx("div",{className:"aspect-square rounded-full bg-white/60 flex items-center justify-center overflow-hidden shadow-2xl ring-2 ring-black/10 z-10",style:{width:"54%"},children:a?s.jsx("img",{src:a,alt:"",className:"w-full h-full object-cover"}):s.jsx("span",{className:"text-3xl font-black",style:{fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:u})})]})}),s.jsx("div",{className:"absolute bottom-3 left-4 right-4 z-10",children:s.jsx("div",{className:"font-bricolage text-xl sm:text-2xl md:text-3xl leading-none truncate",title:o,children:o})})]}),s.jsxs("div",{className:"mt-3 px-1",children:[s.jsx("p",{className:"text-sm font-semibold line-clamp-1",style:{color:"#F5F3EE"},children:e.title}),s.jsx("p",{className:"text-xs opacity-60 line-clamp-2 mt-0.5",style:{color:"#F5F3EE"},children:d})]})]})}function WSe(){const[e,t]=N.useState(!1);return N.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const n=window.matchMedia("(pointer: coarse)"),r=()=>t(n.matches);return r(),n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const fee="#F5F3EE",z$="#0D0D0D",U$="#AAFF00";function GSe({events:e,ticketCounts:t}){return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"md:hidden",children:s.jsx(KSe,{events:e,ticketCounts:t})}),s.jsx("div",{className:"hidden md:grid md:grid-cols-3 lg:grid-cols-4 gap-6",children:e.map(n=>s.jsx(dee,{event:n,ticketCount:(t==null?void 0:t[n.id])||0},n.id))})]})}function KSe({events:e,ticketCounts:t}){const n=N.useRef(null),r=WSe(),[i,a]=N.useState({ratio:1,offset:0,atStart:!0,atEnd:!0}),o=N.useCallback(()=>{const c=n.current;if(!c)return;const u=c.scrollWidth-c.clientWidth;a({ratio:u>0?Math.min(1,c.clientWidth/c.scrollWidth):1,offset:u>0?Math.min(1,Math.max(0,c.scrollLeft/u)):0,atStart:c.scrollLeft<=4,atEnd:u<=0||c.scrollLeft>=u-4})},[]);N.useEffect(()=>{o();const c=n.current;if(c)return c.addEventListener("scroll",o,{passive:!0}),window.addEventListener("resize",o),()=>{c.removeEventListener("scroll",o),window.removeEventListener("resize",o)}},[o,e.length]),N.useEffect(()=>{if(r)return;const c=n.current;if(!c)return;const u=d=>{if(Math.abs(d.deltaY)<=Math.abs(d.deltaX))return;const f=c.scrollWidth-c.clientWidth;if(f<=0)return;const h=c.scrollLeft+d.deltaY;h<0||h>f||(d.preventDefault(),c.scrollLeft=h)};return c.addEventListener("wheel",u,{passive:!1}),()=>c.removeEventListener("wheel",u)},[r]);const l=c=>{const u=n.current;if(!u)return;const d=u.querySelector("[data-rail-item]"),f=((d==null?void 0:d.offsetWidth)??u.clientWidth*.8)+16;u.scrollBy({left:c*f,behavior:"smooth"})};return s.jsxs("div",{className:"relative",children:[s.jsxs("div",{ref:n,className:"-mx-4 px-4 flex gap-4 overflow-x-auto scrollbar-hide snap-x snap-mandatory scroll-pl-4 pb-1",children:[e.map(c=>s.jsx("div",{"data-rail-item":!0,className:"shrink-0 snap-start w-[78vw] max-w-[320px]",children:s.jsx(dee,{event:c,ticketCount:(t==null?void 0:t[c.id])||0})},c.id)),s.jsxs(Pe,{to:"/events","data-rail-item":!0,className:"shrink-0 snap-start w-[62vw] max-w-[240px] rounded-3xl border-2 border-dashed flex flex-col items-center justify-center gap-3 text-center px-6 py-10 transition-colors",style:{borderColor:"rgba(245,243,238,0.3)",color:fee},children:[s.jsx("span",{className:"inline-flex items-center justify-center w-11 h-11 rounded-full",style:{backgroundColor:U$,color:z$},children:s.jsx(Sr,{className:"w-5 h-5"})}),s.jsx("span",{className:"font-bricolage font-black text-lg leading-tight",children:"Voir tous les tournois"})]})]}),s.jsxs("div",{className:"mt-4 flex items-center justify-center gap-3",children:[!r&&s.jsx(q$,{direction:"prev",disabled:i.atStart,onClick:()=>l(-1)}),s.jsx("div",{className:"h-[3px] w-24 rounded-full overflow-hidden",style:{backgroundColor:"rgba(245,243,238,0.18)"},children:s.jsx("div",{className:"h-full rounded-full transition-transform duration-150",style:{backgroundColor:U$,width:`${Math.max(15,i.ratio*100)}%`,transform:`translateX(${i.offset*(100/Math.max(.15,i.ratio)-100)}%)`}})}),!r&&s.jsx(q$,{direction:"next",disabled:i.atEnd,onClick:()=>l(1)})]}),!i.atEnd&&s.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute top-0 right-[-1rem] h-full w-10",style:{background:`linear-gradient(to left, ${z$}, transparent)`}})]})}function q$({direction:e,disabled:t,onClick:n}){const r=e==="prev"?fp:la;return s.jsx("button",{type:"button",onClick:n,disabled:t,"aria-label":e==="prev"?"Tournois précédents":"Tournois suivants",className:"inline-flex items-center justify-center w-9 h-9 rounded-full border-2 transition-opacity disabled:opacity-30",style:{borderColor:"rgba(245,243,238,0.4)",color:fee},children:s.jsx(r,{className:"w-4 h-4"})})}function YSe({Skeleton:e}){return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"md:hidden -mx-4 px-4 flex gap-4 overflow-x-auto scrollbar-hide",children:[1,2,3,4].map(t=>s.jsx(e,{className:"h-52 rounded-3xl shrink-0 w-[78vw] max-w-[320px]"},t))}),s.jsx("div",{className:"hidden md:grid md:grid-cols-3 lg:grid-cols-4 gap-6",children:[1,2,3,4,5,6,7,8].map(t=>s.jsx(e,{className:"h-52 rounded-3xl"},t))})]})}const NR="CHESS AGENDA",hee=2026,XSe=[{value:0,label:"Dimanche"},{value:1,label:"Lundi"},{value:2,label:"Mardi"},{value:3,label:"Mercredi"},{value:4,label:"Jeudi"},{value:5,label:"Vendredi"},{value:6,label:"Samedi"}],QSe=[{value:"once",label:"Événement unique",description:"Une seule date"},{value:"weekly",label:"Hebdomadaire",description:"Chaque semaine"},{value:"biweekly",label:"Bimensuel",description:"Une semaine sur deux"},{value:"monthly",label:"Mensuel",description:"Une fois par mois"}],vj=[{value:"blitz-5",timeControl:"5+2",label:"Blitz",sublabel:"5 min + 2 sec",description:"Parties dynamiques avec incrément rassurant",durationHint:"~2h",icon:"⚡",roundsCount:7},{value:"blitz-7",timeControl:"7+2",label:"Blitz rapide",sublabel:"7 min + 2 sec",description:"Équilibre vitesse et réflexion",durationHint:"~2h",icon:"🔥",recommended:!0,roundsCount:5},{value:"rapid-10",timeControl:"10+0",label:"Rapide",sublabel:"10 min",description:"Cadence longue, pas d'ajout nécessaire",durationHint:"~2h",icon:"⏱️",roundsCount:5}],V$=4,nm=12,rm=6,EA=15,SA=10;function mee(e){return Math.max(rm,e+1)}function pee(e){const t=vj.find(n=>n.value===e);return(t==null?void 0:t.roundsCount)??5}function JSe(e){const t=pee(e);return mee(t)}
1028function gee(e){switch(e){case"blitz":case"blitz-5":return"blitz-5";case"blitz-7":return"blitz-7";case"rapid":case"rapid-10":case"semi-rapid":case"classical":return"rapid-10";default:return"blitz-7"}}const j1=[{value:"buchholz_cut1",label:"Buchholz Cut-1",shortLabel:"BC1",description:"Buchholz moins le score le plus bas"},{value:"buchholz",label:"Buchholz",shortLabel:"Buch",description:"Somme des scores des adversaires"},{value:"sonneborn_berger",label:"Sonneborn-Berger",shortLabel:"SB",description:"Score pondéré par la force des adversaires"},{value:"progressive",label:"Score progressif",shortLabel:"Prog",description:"Somme cumulée des scores ronde par ronde"},{value:"wins",label:"Victoires",shortLabel:"V",description:"Nombre de parties gagnées"},{value:"black_games",label:"Parties avec Noirs",shortLabel:"N",description:"Nombre de parties jouées avec les Noirs"},{value:"direct",label:"Résultat direct",shortLabel:"Dir",description:"Résultat entre joueurs ex æquo (sous-tournoi)"}],Wh=["buchholz_cut1","buchholz","sonneborn_berger","wins","direct"],H$=e=>e==="digital"||e==="paper";function Vb(e,t){if(e&&H$(e.coupon_mode))return e.coupon_mode;const n=(e==null?void 0:e.venue)??t;return n&&H$(n.default_coupon_mode)?n.default_coupon_mode:"digital"}function W$(e){return Array.isArray(e)?e.map(t=>{if(!t||typeof t!="object")return null;const n=String(t.name??"").trim();if(!n)return null;const r=String(t.description??"").trim();return r?{name:n,description:r}:{name:n}}).filter(t=>t!==null):[]}function ZSe(e,t){const n=(e==null?void 0:e.venue)??t??null,r=(c,u)=>{const d=typeof c=="string"?c.trim():"";return d||(typeof u=="string"?u.trim():"")||null},i=r(e==null?void 0:e.paper_coupon_label,n==null?void 0:n.default_paper_coupon_label),a=r(e==null?void 0:e.paper_coupon_description,n==null?void 0:n.default_paper_coupon_description),o=W$(e==null?void 0:e.paper_coupon_formulas),l=o.length?o:W$(n==null?void 0:n.default_paper_coupon_formulas);return{label:i,description:a,formulas:l,hasContent:!!(i||a||l.length)}}const G$=e=>({mode:e,hasPerk:!1,shortLabel:"",longDescription:"",bullets:[]});function od(e,t){var a;const n=Vb(e,t),r=Number((e==null?void 0:e.credit_amount_cents)??0),i=Math.round(r/100);if(n==="paper"){const o=ZSe(e,t);if(!o.hasContent&&i<=0)return G$(n);const l=(a=o.label)==null?void 0:a.trim(),c=l||(i>0?`Coupon ${i}€ remis sur place`:"Coupon remis sur place"),u=l?`${l} (remis sur place par le lieu)`:i>0?`Coupon ${i}€ remis sur place par le lieu`:"Coupon remis sur place par le lieu";return{mode:n,hasPerk:!0,shortLabel:c,longDescription:u,hint:o.description||void 0,bullets:o.formulas}}return i<=0?G$(n):{mode:n,hasPerk:!0,shortLabel:`${i}€ crédit conso`,longDescription:`${i}€ de crédit boisson/repas (sélection du lieu)`,hint:"Utilisable sur la sélection du lieu, le soir de l'événement.",bullets:[]}}const eAe={credit:{label:"Crédit consommation",icon:"CreditCard"},level:{label:"Niveaux et accessibilité",icon:"Users"},rules:{label:"Règles du jeu",icon:"BookOpen"},registration:{label:"Inscription",icon:"Ticket"},day:{label:"Le jour J",icon:"Calendar"},security:{label:"Paiement et sécurité",icon:"Shield"}},xee=[{id:"credit-how",question:"Comment fonctionne le crédit consommation inclus ?",answer:"Chaque inscription inclut automatiquement un crédit (ex. 10€) utilisable le soir du tournoi. Il s'applique sur une sélection de boissons et plats définie par chaque lieu partenaire (bières, softs, snacks, petite restauration… la sélection peut varier d'un lieu à l'autre). Au-delà du crédit, vous réglez le complément directement au bar.",category:"credit",featured:!0},{id:"credit-unused",question:"Que se passe-t-il si je ne consomme pas tout mon crédit ?",answer:"Le crédit est valable uniquement le soir du tournoi. S'il n'est pas utilisé, il n'est ni remboursable, ni transférable sur un autre événement. Autant en profiter !",category:"credit",featured:!0},{id:"credit-exceed",question:"Puis-je consommer plus que mon crédit ?",answer:"Absolument ! Si vous dépassez votre crédit inclus, vous réglez simplement la différence directement au bar, comme une consommation classique.",category:"credit",featured:!1},{id:"level-required",question:"Quel niveau faut-il pour participer ?",answer:"Aucun niveau minimum n'est requis ! Nos tournois sont ouverts à tous : débutants curieux, joueurs occasionnels. Et puis si on avait voulu être sérieux, on aurait organisé des tournois dans des clubs, pas dans des bars et des salles d’escalade !",category:"level",featured:!0},{id:"level-first-time",question:"Je n'ai jamais fait de tournoi, c'est pour moi ?",answer:"Oui ! La majorité de nos participants découvrent les tournois avec nous. On explique tout sur place, le format est simple, et l'ambiance décontractée vous mettra à l'aise.",category:"level",featured:!1},{id:"level-categories",question:"Y a-t-il des tournois par niveau ?",answer:"Certains tournois peuvent être organisés par catégorie (débutants, confirmés). Consultez la description de chaque événement pour connaître le format.",category:"level",featured:!1},{id:"rules-applied",question:"Quelles sont les règles appliquées pendant le tournoi ?",answer:`C’est un tournoi convivial. Pour cette raison, nous n’appliquons pas la règle : "Pièce touchée, pièce à jouer". Si vous touchez une pièce, vous pouvez encore en jouer une autre.  
1029
1030En revanche, pour avoir un certain cadre, une pièce lâchée est une pièce jouée. Une fois la pièce lâchée sur une case, le coup est joué : on ne peut plus la jouer autre part.
1031 
1032En cas de coup interdit, votre adversaire peut vous le faire remarquer et vous jouez un autre coup.
1033
1034Pendule : chaque joueur dispose d'un temps limite (indiqué avant le tournoi). 
1035
1036Comportement fair-play : bon bah ça, ça va sans dire.`,category:"rules",featured:!0},{id:"rules-dispute",question:"Que se passe-t-il en cas de litige sur le score ?",answer:"Chaque joueur soumet son résultat. Si les résultats correspondent, c'est validé automatiquement. En cas de désaccord, un j
1036oueur tiers ou le staff peut trancher.",category:"rules",featured:!1},{id:"rules-swiss",question:"C'est quoi le format Suisse (Swiss) ?",answer:"Le principe du système suisse est qu'à chaque partie, vous rencontrez quelqu’un qui a le même nombre de points que vous dans le tournoi. Cela permet à tous les joueurs de jouer toutes les parties. Pas d'élimination directe ! Et de rencontrer des joueurs de niveau similaire.",category:"rules",featured:!1},{id:"registration-how",question:"Comment se passe l'inscription ?",answer:`1. Créez votre compte en 30 secondes
10372. Choisissez un tournoi près de chez vous
10383. Payez en ligne (CB, Apple Pay, Google Pay)
10394. Recevez votre QR code de confirmation
1040
1041C'est tout !`,category:"registration",featured:!1},{id:"registration-cancel",question:"Puis-je annuler ma réservation ?",answer:"Les conditions d'annulation sont indiquées sur chaque événement. En général, l'annulation est possible jusqu'à 24-48h avant le tournoi.",category:"registration",featured:!1},{id:"registration-confirm",question:"Comment savoir si ma place est confirmée ?",answer:"Après paiement, vous recevez un email de confirmation avec votre QR code. Vous pouvez aussi consulter vos billets dans votre espace joueur.",category:"registration",featured:!1},{id:"day-how",question:"Comment se déroule un tournoi ?",answer:`1. Arrivez 15 min avant la première partie
10422. Présentez votre QR code au staff
10433. Récupérez un échiquier et installez-vous
10444. Avant chaque partie, un tableau est affiché pour voir contre qui vous jouez
10455. Jouez vos parties et saisissez vos résultats pour lancer les matchs suivants.
1046
1047Entre chaque match, on attend que tout le monde ait fini pour avoir les résultats et savoir qui joue contre qui au match suivant.
1048
1049Il y a généralement 5 à 7 parties, selon le format, et pas d’éliminatoire.`,category:"day",featured:!0},{id:"day-duration",question:"Combien de temps dure un tournoi ?",answer:"Généralement 2 heures. La durée estimée est indiquée sur chaque événement.",category:"day",featured:!1},{id:"day-bring",question:"Que dois-je apporter ?",answer:"Nous fournissons les échiquiers et les pièces. Venez juste avec votre téléphone pour montrer votre QR code au bar, et aussi car les portables font de très bonnes pendules.",category:"day",featured:!1},{id:"security-payment",question:"Le paiement est-il sécurisé ?",answer:"Oui, nous utilisons Stripe, leader mondial du paiement en ligne. Vos données bancaires ne sont jamais stockées sur notre plateforme.",category:"security",featured:!0},{id:"security-cancelled",question:"Et si le tournoi est annulé ?",answer:"En cas d'annulation par l'organisateur, vous êtes intégralement remboursé sur votre moyen de paiement initial.",category:"security",featured:!1}],K$=["level-required","day-how"],yee=()=>xee.filter(e=>e.featured).sort((e,t)=>{const n=K$.indexOf(e.id),r=K$.indexOf(t.id);return n===-1&&r===-1?0:n===-1?1:r===-1?-1:n-r});function vee(){const{toast:e}=_r(),t=Ye();return dt({mutationFn:async n=>{var o,l;const r=n.email.trim().toLowerCase();if(!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(r))throw new Error("Email invalide");const{data:i,error:a}=await re.functions.invoke("newsletter-subscribe",{body:{email:r,first_name:((o=n.first_name)==null?void 0:o.trim())||null,last_name:((l=n.last_name)==null?void 0:l.trim())||null,source:n.source||"footer",create_account:n.create_account??!0}});if(a)throw a;return i},onSuccess:n=>{e({title:n.already_subscribed?"Déjà inscrit·e":"Merci !",description:n.account_invited?"Vous recevrez un email pour créer votre compte et confirmer votre inscription.":"Vous êtes bien inscrit·e à la newsletter."}),t.invalidateQueries({queryKey:["newsletter","me"]})},onError:n=>{e({title:"Inscription impossible",description:n.message,variant:"destructive"})}})}function tAe(){const{user:e}=Tt();return st({queryKey:["newsletter","me",e==null?void 0:e.id],enabled:!!(e!=null&&e.id),queryFn:async()=>{const{data:t,error:n}=await re.from("newsletter_subscribers").select("*").eq("user_id",e.id).maybeSingle();if(n)throw n;return t}})}function nAe(){const{user:e}=Tt(),{toast:t}=_r(),n=Ye();return dt({mutationFn:async r=>{const{error:i}=await re.from("newsletter_subscribers").update({status:"unsubscribed",unsubscribed_at:new Date().toISOString()}).eq("id",r);
1049if(i)throw i},onSuccess:()=>{t({title:"Désinscription effectuée"}),n.invalidateQueries({queryKey:["newsletter","me",e==null?void 0:e.id]})},onError:r=>t({title:"Erreur",description:r.message,variant:"destructive"})})}function rAe(){return st({queryKey:["newsletter","admin","list"],queryFn:async()=>{const{data:e,error:t}=await re.from("newsletter_subscribers").select("*").order("created_at",{ascending:!1}).limit(2e3);if(t)throw t;return e??[]}})}function sAe(){const{toast:e}=_r(),t=Ye();return dt({mutationFn:async n=>{const{error:r}=await re.from("newsletter_subscribers").delete().eq("id",n);if(r)throw r},onSuccess:()=>{e({title:"Inscrit supprimé"}),t.invalidateQueries({queryKey:["newsletter","admin","list"]})},onError:n=>e({title:"Erreur",description:n.message,variant:"destructive"})})}function iAe(){const{toast:e}=_r(),t=Ye();return dt({mutationFn:async({id:n,status:r})=>{const{error:i}=await re.from("newsletter_subscribers").update({status:r,unsubscribed_at:r==="unsubscribed"?new Date().toISOString():null}).eq("id",n);if(i)throw i},onSuccess:()=>{t.invalidateQueries({queryKey:["newsletter","admin","list"]})},onError:n=>e({title:"Erreur",description:n.message,variant:"destructive"})})}function aAe(){return st({queryKey:["newsletter","admin","campaigns"],queryFn:async()=>{const{data:e,error:t}=await re.from("newsletter_campaigns").select("*").order("created_at",{ascending:!1}).limit(200);if(t)throw t;return e??[]}})}function oAe(){const{toast:e}=_r(),t=Ye();return dt({mutationFn:async n=>{const{id:r,...i}=n,a=i;if(r){const{data:c,error:u}=await re.from("newsletter_campaigns").update(a).eq("id",r).select().single();if(u)throw u;return c}const{data:o,error:l}=await re.from("newsletter_campaigns").insert({subject:a.subject??"Nouvelle campagne",html_content:a.html_content??"<p>Contenu…</p>",preheader:a.preheader??null,text_content:a.text_content??null,audience_filter:a.audience_filter??{},status:"draft"}).select().single();if(l)throw l;return o},onSuccess:()=>{e({title:"Campagne enregistrée"}),t.invalidateQueries({queryKey:["newsletter","admin","campaigns"]})},onError:n=>e({title:"Erreur",description:n.message,variant:"destructive"})})}function lAe(){const{toast:e}=_r(),t=Ye();return dt({mutationFn:async n=>{const{error:r}=await re.from("newsletter_campaigns").delete().eq("id",n);if(r)throw r},onSuccess:()=>{e({title:"Campagne supprimée"}),t.invalidateQueries({queryKey:["newsletter","admin","campaigns"]})},onError:n=>e({title:"Erreur",description:n.message,variant:"destructive"})})}function cAe(){const{toast:e}=_r(),t=Ye();return dt({mutationFn:async({campaign_id:n,test_only:r,test_email:i})=>{const{data:a,error:o}=await re.functions.invoke("newsletter-send-campaign",{body:{campaign_id:n,test_only:!!r,test_email:i}});if(o)throw o;return a},onSuccess:(n,r)=>{r.test_only?e({title:"Email de test envoyé"}):e({title:"Campagne envoyée",description:`${n.sent??0} sur ${n.total??0} destinataires`}),t.invalidateQueries({queryKey:["newsletter","admin","campaigns"]})},onError:n=>e({title:"Envoi impossible",description:n.message,variant:"destructive"})})}function uAe(e){return st({queryKey:["newsletter","admin","audience-count",e],queryFn:async()=>{let t=re.from("newsletter_subscribers").select("id",{count:"exact",head:!0}).eq("status","subscribed");e.source&&(t=t.eq("source",e.source)),e.since&&(t=t.gte("created_at",e.since));const{count:n,error:r}=await t;if(r)throw r;return n??0}})}function kR({source:e="footer",className:t="",variant:n="footer"}){const[r,i]=N.useState(""),a=vee(),o=async l=>{l.preventDefault(),r.trim()&&(await a.mutateAsync({email:r,source:e}),i(""))};return n==="footer"?s.jsxs("form",{onSubmit:o,className:`flex flex-col sm:flex-row items-stretch gap-2 ${t}`,children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 bg-background/80 border border-foreground
1049/20 rounded-md px-3 py-2",children:[s.jsx(wr,{className:"w-4 h-4 opacity-60 flex-shrink-0"}),s.jsx("input",{type:"email",required:!0,value:r,onChange:l=>i(l.target.value),placeholder:"[email protected]","aria-label":"Email pour la newsletter",className:"bg-transparent outline-none text-sm flex-1 min-w-0",disabled:a.isPending})]}),s.jsxs("button",{type:"submit",disabled:a.isPending,className:"inline-flex items-center justify-center gap-1.5 px-4 py-2 text-sm font-semibold rounded-md bg-foreground text-background hover:opacity-80 transition disabled:opacity-50",children:[s.jsx(ca,{className:"w-3.5 h-3.5"}),a.isPending?"...":"Je m'inscris"]})]}):s.jsxs("form",{onSubmit:o,className:`flex flex-col gap-3 ${t}`,children:[s.jsxs("div",{className:"flex items-center gap-2 bg-background border border-input rounded-md px-3 py-2",children:[s.jsx(wr,{className:"w-4 h-4 text-muted-foreground"}),s.jsx("input",{type:"email",required:!0,value:r,onChange:l=>i(l.target.value),placeholder:"[email protected]","aria-label":"Email pour la newsletter",className:"bg-transparent outline-none text-sm flex-1",disabled:a.isPending})]}),s.jsxs("button",{type:"submit",disabled:a.isPending,className:"w-full inline-flex items-center justify-center gap-2 px-4 py-2.5 text-sm font-semibold rounded-md bg-primary text-primary-foreground hover:opacity-90 transition disabled:opacity-50",children:[s.jsx(ca,{className:"w-4 h-4"}),a.isPending?"Inscription...":"S'inscrire"]})]})}const AA="#0D0D0D",dAe="#AAFF00",fAe=[{icon:vo,label:"Les tournois en avant-première",desc:"inscris-toi avant que ça affiche complet."},{icon:Ti,label:"Des offres exclusives",desc:"places offertes et bons plans pour les grandes occasions."},{icon:Vge,label:"Des conseils pour progresser",desc:"tactiques, ouvertures et analyses signées Chess Agenda."}];function bee(){return s.jsxs("div",{children:[s.jsx("h3",{className:"text-2xl md:text-3xl font-black mb-1 leading-tight",style:{fontFamily:"'Bricolage Grotesque', system-ui, sans-serif",color:AA},children:"Les échecs avec un coup d'avance..."}),s.jsx("p",{className:"text-sm mb-4",style:{color:"rgba(13,13,13,0.7)",fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:"Rejoins la newsletter Chess Agenda et reçois :"}),s.jsx("ul",{className:"space-y-2",style:{fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:fAe.map(({icon:e,label:t,desc:n})=>s.jsxs("li",{className:"flex items-start gap-3 text-sm",children:[s.jsx("span",{className:"inline-flex items-center justify-center w-6 h-6 rounded-full shrink-0 mt-0.5",style:{backgroundColor:AA},"aria-hidden":!0,children:s.jsx(e,{size:13,color:dAe,strokeWidth:2.5})}),s.jsxs("span",{style:{color:"rgba(13,13,13,0.85)"},children:[s.jsx("span",{className:"font-semibold",style:{color:AA},children:t})," ","— ",n]})]},t))})]})}function CR(e=.15){const t=N.useRef(null),[n,r]=N.useState(!1);return N.useEffect(()=>{const a=t.current;if(!a)return;if(typeof IntersectionObserver>"u"){r(!0);return}const o=new IntersectionObserver(([l])=>{l.isIntersecting&&(r(!0),o.disconnect())},{threshold:e});return o.observe(a),()=>o.disconnect()},[e]),{ref:t,visible:n,reveal:(a=0)=>({className:`transition-all duration-700 ease-out motion-reduce:transition-opacity ${n?"opacity-100 translate-y-0":"opacity-0 translate-y-4 motion-reduce:translate-y-0"}`,style:{transitionDelay:n?`${a*80}ms`:"0ms"}})}}const TA=768;function vd(){const[e,t]=N.useState(void 0);return N.useEffect(()=>{const n=window.matchMedia(`(max-width: ${TA-1}px)`),r=()=>{t(window.innerWidth<TA)};return n.addEventListener("change",r),t(window.innerWidth<TA),()=>n.removeEventListener("change",r)},[]),!!e}const hAe="/hero-odeon-nuit.png",Aa="#F5F3EE",na="#0D0D0D",Yd="#AAFF00",ER={fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},mAe=({className:e})=>s.jsxs("svg",{className:e,...ER,children:[s.jsx("path",{d:"M16 19c-.2-3 1.6-5.6 4.6-5.8 3.1-.2 5.2 2.1 5.4 5 .2 2.9-1.7 5.4-4.7 5.6-3 .2-5.1-1.9-5.3-4.8z"}),s.jsx("path",{d:"M11 36c.4-4.6 4.4-7.8 9.8-8.1 5.6-.3 10 2.6 10.7 7.5"}),s.jsx("path",{d:"M30 16.5c-.1-1.9 1.2-3.6 3.2-3.7 2-.1 3.5 1.4 3.6 3.3.1 1.9-1.2 3.6-3.2 3.7-2 .1-3.5-1.4-3.6-3.3z"}),s.jsx("path",{d:"M31 27.5c3.7-.4 7.6 1.2 8.4 4.6"})]}),pAe=({className:e})=>s.jsxs("svg",{className:e,...ER,children:[s.jsx("path",{d:"M24 7c-6.2 0-11 4.6-11 10.6 0 7.
10496 9.7 19.5 10.5 20.4.3.3.7.3 1 0 .8-.9 10.5-12.8 10.5-20.4C35 11.6 30.2 7 24 7z"}),s.jsx("circle",{cx:"24",cy:"17.5",r:"3.6"}),s.jsx("path",{d:"M19 41c1.6.6 3.4 1 5 1s3.4-.4 5-1",opacity:"0.5"})]}),gAe=({className:e})=>s.jsxs("svg",{className:e,...ER,children:[s.jsx("path",{d:"M16 9h16c.2 4.5-.4 9.6-2.4 12.7-1.6 2.5-3.5 3.8-5.6 3.8s-4-1.3-5.6-3.8C16.4 18.6 15.8 13.5 16 9z"}),s.jsx("path",{d:"M16 12c-2.4 0-4 1.4-4 3.4 0 2.6 2.2 4 4.5 4.4"}),s.jsx("path",{d:"M32 12c2.4 0 4 1.4 4 3.4 0 2.6-2.2 4-4.5 4.4"}),s.jsx("path",{d:"M24 25.5v6"}),s.jsx("path",{d:"M19 31.5h10c.6 0 1 .5 1 1.1V35h-12v-2.4c0-.6.4-1.1 1-1.1z"}),s.jsx("path",{d:"M24 14l1 2 2 .3-1.5 1.4.4 2.1L24 18.7l-1.9 1.1.4-2.1L21 16.3l2-.3 1-2z",opacity:"0.6"})]}),xAe=[{Icon:mAe,n:"01",t:"Inscrivez-vous",emoji:"✍️",d:"Créez votre profil en 30 secondes. Aucun niveau requis, tout le monde est bienvenu.",halo:"pastel-halo-peach",dot:"hsl(var(--pastel-peach))"},{Icon:pAe,n:"02",t:"Trouvez un tournoi",emoji:"📍",d:"Choisissez parmi nos lieux partenaires et prenez votre place en quelques clics.",halo:"pastel-halo-lilac",dot:"hsl(var(--pastel-lilac))"},{Icon:gAe,n:"03",t:"Jouez & gagnez (peut-être)",emoji:"🏆",d:"Affrontez d'autres joueurs dans une ambiance conviviale. Grimpez dans le classement !",halo:"pastel-halo-mint",dot:"hsl(var(--pastel-mint))"}],yAe=()=>{const{ref:e,reveal:t}=CR();return s.jsxs("section",{className:"relative py-16 md:py-24 overflow-hidden",ref:e,children:[s.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 pointer-events-none opacity-60",style:{background:"radial-gradient(ellipse 60% 50% at 20% 30%, hsl(var(--pastel-peach) / 0.35), transparent 60%), radial-gradient(ellipse 50% 45% at 85% 70%, hsl(var(--pastel-mint) / 0.30), transparent 60%)"}}),s.jsxs("div",{className:"container relative mx-auto px-4",children:[s.jsxs("div",{className:"text-center mb-12",...t(0),children:[s.jsx("p",{className:"text-xs uppercase tracking-[0.2em] mb-2",style:{fontFamily:"'Fragment Mono', ui-monospace, monospace",color:"rgba(13,13,13,0.6)"},children:"[002] · Mode d'emploi"}),s.jsx("h2",{className:"font-bricolage font-black text-4xl md:text-5xl mb-4 tracking-tight leading-[0.95]",children:"Comment ça marche ?"}),s.jsx("p",{className:"max-w-xl mx-auto",style:{color:"rgba(13,13,13,0.7)"},children:"Simple, convivial, accessible à tous les niveaux."})]}),s.jsx("div",{className:"grid md:grid-cols-3 gap-4 max-w-5xl mx-auto",children:xAe.map(({Icon:n,n:r,t:i,d:a,emoji:o,halo:l,dot:c},u)=>{const d=t(u+1);return s.jsxs("div",{className:`group relative p-8 border rounded-3xl overflow-hidden transition hover:-translate-y-1 hover:shadow-[0_20px_50px_-25px_rgba(13,13,13,0.35)] ${l} ${d.className}`,style:{borderColor:"rgba(13,13,13,0.08)",...d.style},children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center",style:{backgroundColor:c,color:na},children:s.jsx(n,{className:"w-8 h-8"})}),s.jsx("div",{className:"font-bricolage font-black italic text-5xl leading-none select-none",style:{color:"rgba(13,13,13,0.14)"},children:r})]}),s.jsxs("h3",{className:"font-semibold text-xl mb-2 flex items-center gap-2",style:{fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:[i,s.jsx("span",{"aria-hidden":"true",className:"text-xl inline-block transition-transform duration-300 group-hover:rotate-12 group-hover:scale-110",children:o})]}),s.jsx("p",{className:"text-sm",style:{color:"rgba(13,13,13,0.72)"},children:a})]},r)})}),s.jsxs("div",{className:"text-center mt-10 md:mt-12",...t(4),children:[s.jsx(Pe,{to:"/events",children:s.jsxs("button",{className:"inline-flex items-center gap-2 px-6 py-4 rounded-full font-semibold tracking-wide text-sm group transition-shadow hover:shadow-[0_0_0_4px_rgba(170,255,0,0.25)]",style:{backgroundColor:na,color:Aa,fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:["Voir les tournois à venir",s.jsx(Sr,{className:"w-4 h-4 transition-transform group-hover:translate-x-1"})]})}),s.jsx("p",{className:"text-[10px] uppercase tracking-widest mt-3",style:{fontFamily:"'Fragment Mono', ui-monospace, monospace",color:"rgba(13,13,13,0.55)"},children:"Inscription en 30 secondes · Paiement sécurisé"})]})]})]})},vAe=[{n:"01",t:"Un ticket unique",emoji:"🎟️",d:"Vous payez en ligne, tout est compris : tournoi + avantage food/drinks.",tint:"hsl(var(--pastel-peach) / 0.35)"},{n:"02",t:"L'avantage inclus",emoji:"🍹",d:"Crédit conso digital ou coupon/formule papier — chaque lieu choisit son format.",tint:"hsl(var(--pastel-lilac) / 0.35)"},{n:"03",t:"À consommer sur place",emoji:"🥨",d:"Pendant l'événement, sur la sélection proposée par le lieu.",tint:"hsl(var(--pastel-mint) / 0.35)"}],bAe=()=>{const{ref:e,reveal:t}=CR();return s.jsxs("section",{ref:e,className:"relative py-20 md:py-28 overflow-hidden",style:{backgroundColor:"#EDEAE0"},children:[s.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 pointer-events-none",style:{background:"radial-gradient(ellipse 55% 45% at 80% 20%, hsl(var(--pastel-peach) / 0.45), transparent 65%), radial-gradient(ellipse 45% 40% at 15% 85%, hsl(var(--pastel-sky) / 0.40), transparent 65%)"}}),s.jsx("div",{className:"container relative mx-auto px-4",children:s.jsxs("div",{className:"max-w-5xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-12",...t(0),children:[s.jsx("p",{className:"text-xs uppercase tracking-[0.2em] mb-2",style:{fontFamily:"'Fragment Mono', ui-monospace, monospace",color:"rgba(13,13,13,0.6)"}
1049,children:"[003] · Le concept"}),s.jsxs("h2",{className:"font-bricolage font-black text-4xl md:text-5xl mb-4 tracking-tight leading-[0.95]",children:["Un ticket, un tournoi, un"," ",s.jsx("span",{className:"relative inline-block",style:{backgroundImage:`linear-gradient(180deg, transparent 62%, ${Yd} 62%, ${Yd} 92%, transparent 92%)`},children:"avantage"})," ","food & drinks."]}),s.jsx("p",{className:"max-w-xl mx-auto",style:{color:"rgba(13,13,13,0.7)"},children:"Chaque inscription inclut un avantage à utiliser sur place — crédit conso ou coupon/formule, selon le lieu partenaire."})]}),s.jsxs("div",{className:"rounded-3xl p-6 md:p-10 border shadow-[0_30px_80px_-40px_rgba(13,13,13,0.35)]",style:{borderColor:"rgba(13,13,13,0.10)",backgroundColor:"#FFFFFF"},...t(1),children:[s.jsx("div",{className:"grid sm:grid-cols-3 gap-4",children:vAe.map((n,r)=>{const i=t(r+2);return s.jsxs("div",{className:`rounded-2xl p-5 transition hover:-translate-y-0.5 ${i.className}`,style:{backgroundColor:n.tint,...i.style},children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("p",{className:"text-xs uppercase tracking-[0.2em]",style:{fontFamily:"'Fragment Mono', ui-monospace, monospace",color:"rgba(13,13,13,0.55)"},children:n.n}),s.jsx("span",{"aria-hidden":"true",className:"text-2xl transition-transform hover:scale-110",children:n.emoji})]}),s.jsx("h3",{className:"font-semibold text-lg mb-1",style:{fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:n.t}),s.jsx("p",{className:"text-sm",style:{color:"rgba(13,13,13,0.75)"},children:n.d})]},n.n)})}),s.jsx("p",{className:"text-[10px] uppercase tracking-widest text-center mt-8",style:{fontFamily:"'Fragment Mono', ui-monospace, monospace",color:"rgba(13,13,13,0.5)"},children:"Le format de l'avantage et la sélection éligible dépendent du lieu partenaire."}),s.jsx("div",{className:"text-center mt-8",...t(5),children:s.jsx(Pe,{to:"/events",children:s.jsxs("button",{className:"inline-flex items-center gap-2 px-6 py-4 rounded-full font-semibold tracking-wide text-sm group transition-shadow hover:shadow-[0_0_0_4px_rgba(170,255,0,0.3)]",style:{backgroundColor:na,color:Aa,fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:["Réserver ma place",s.jsx(Sr,{className:"w-4 h-4 transition-transform group-hover:translate-x-1"})]})})})]})]})})]})},wAe={"credit-how":"🎟️","credit-unused":"⏳","level-required":"🎯","rules-applied":"♟️","day-how":"🕹️","security-payment":"🔒"},Y$=["rgba(255, 193, 168, 0.22)","rgba(196, 181, 253, 0.22)","rgba(167, 243, 208, 0.22)","rgba(186, 230, 253, 0.22)"],_Ae=()=>{const{ref:e,reveal:t}=CR(),n=yee();return s.jsxs("section",{ref:e,className:"relative py-20 md:py-28 overflow-hidden",children:[s.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 pointer-events-none",style:{background:"radial-gradient(ellipse 40% 35% at 90% 10%, hsl(var(--pastel-lilac) / 0.35), transparent 65%), radial-gradient(ellipse 40% 35% at 10% 95%, hsl(var(--pastel-mint) / 0.28), transparent 65%)"}}),s.jsx("div",{className:"container relative mx-auto px-4",children:s.jsxs("div",{className:"max-w-3xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-12",...t(0),children:[s.jsxs("p",{className:"text-xs uppercase tracking-[0.2em] mb-2",style:{fontFamily:"'Fragment Mono', ui-monospace, monospace",color:"rgba(13,13,13,0.6)"},children:[s.jsx("span",{"aria-hidden":"true",className:"mr-1",children:"💬"}),"[004] · FAQ"]}),s.jsx("h2",{className:"font-bricolage font-black text-4xl md:text-5xl mb-4 tracking-tight leading-[0.95]",children:"Questions fréquentes"}),s.jsx("p",{className:"max-w-xl mx-auto",style:{color:"rgba(13,13,13,0.7)"},children:"Tout ce que vous devez savoir avant de jouer."})]}),s.jsx("div",{className:"rounded-3xl p-2 md:p-4 border shadow-[0_20px_60px_-30px_rgba(13,13,13,0.25)]",style:{borderColor:"rgba(13,13,13,0.10)",backgroundColor:"#FFFFFF"},...t(1),children:s.jsx(wC,{type:"single",collapsible:!0,className:"space-y-1",children:n.map((r,i)=>{const a=wAe[r.id]??"•",o=Y$[i%Y$.length],l=t(i+2);
1049return s.jsxs(kx,{value:r.id,className:`px-3 border-0 rounded-2xl transition-colors ${l.className}`,style:{...l.style,"--faq-tint":o},"data-tint":!0,children:[s.jsx(Cx,{className:"text-left hover:no-underline py-4 text-sm md:text-base font-semibold [&[data-state=open]]:bg-[var(--faq-tint)] rounded-xl px-2 -mx-2",style:{fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:s.jsxs("span",{className:"flex items-start gap-3",children:[s.jsx("span",{"aria-hidden":"true",className:"text-lg leading-none pt-0.5",children:a}),s.jsx("span",{children:r.question})]})}),s.jsx(Ex,{className:"text-sm leading-relaxed pb-4 whitespace-pre-line pl-9",style:{color:"rgba(13,13,13,0.75)"},children:r.answer})]},r.id)})})}),s.jsxs("div",{className:"text-center mt-10",...t(n.length+2),children:[s.jsx("p",{className:"text-sm mb-4",style:{color:"rgba(13,13,13,0.7)"},children:"Convaincu ? Réservez votre place ou explorez la FAQ complète."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[s.jsx(Pe,{to:"/events",children:s.jsxs("button",{className:"w-full sm:w-auto inline-flex items-center justify-center gap-2 px-6 py-4 rounded-full font-semibold tracking-wide text-sm group transition-shadow hover:shadow-[0_0_0_4px_rgba(170,255,0,0.3)]",style:{backgroundColor:na,color:Aa,fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:["Réserver maintenant",s.jsx(Sr,{className:"w-4 h-4 transition-transform group-hover:translate-x-1"})]})}),s.jsx(Pe,{to:"/faq",children:s.jsx("button",{className:"w-full sm:w-auto inline-flex items-center justify-center gap-2 px-6 py-4 rounded-full font-semibold tracking-wide text-sm border-2",style:{borderColor:na,color:na,backgroundColor:"transparent",fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:"Voir toutes les questions"})})]})]})]})})]})},jAe=()=>{const{data:e,isLoading:t}=uee(8),n=N.useMemo(()=>(e==null?void 0:e.map(x=>x.id))||[],[e]),{data:r}=jR(n),i=N.useRef(null),a=N.useRef(null),[o,l]=N.useState(!1),[c,u]=N.useState(!1),d=o&&!c;N.useEffect(()=>{const x=i.current;if(!x)return;const y=new IntersectionObserver(([b])=>l(!b.isIntersecting),{rootMargin:"0px"});return y.observe(x),()=>y.disconnect()},[]),N.useEffect(()=>{const x=a.current;if(!x)return;const y=new IntersectionObserver(([b])=>u(b.isIntersecting),{rootMargin:"0px 0px -40px 0px"});return y.observe(x),()=>y.disconnect()},[]);const f=vd(),[h,p]=N.useState(0);return N.useEffect(()=>{if(typeof window>"u"||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let y=0;const b=()=>{y||(y=requestAnimationFrame(()=>{y=0;const w=window.scrollY;p(w<window.innerHeight?w*.12:window.innerHeight*.12)}))};return window.addEventListener("scroll",b,{passive:!0}),()=>{window.removeEventListener("scroll",b),y&&cancelAnimationFrame(y)}},[]),s.jsxs("div",{className:"min-h-screen",style:{backgroundColor:Aa,color:na,fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:[s.jsx(tr,{}),s.jsx("section",{className:"relative overflow-hidden",children:s.jsxs("div",{className:"relative min-h-[520px] md:min-h-[min(72svh,760px)] flex items-center justify-center",children:[s.jsx("img",{src:hAe,alt:"Joueurs d'échecs en plein tournoi à la tombée de la nuit, Place de l'Odéon",className:"absolute inset-0 w-full h-full object-cover will-change-transform",width:1200,height:1500,style:{objectPosition:"center 75%",transform:`scale(1.02) translate3d(0, ${h}px, 0)`,filter:`contrast(1.32) saturate(0.78) brightness(0.62) sepia(0.18) blur(${f?"1.2":"2.5"}px)`},loading:"eager",decoding:"async",fetchPriority:"high"}),s.jsx("div",{className:"absolute inset-0 pointer-events-none mix-blend-screen",style:{background:"radial-gradient(ellipse 75% 60% at 72% 15%, rgba(255,176,68,0.75) 0%, rgba(255,140,40,0.30) 30%, rgba(0,0,0,0) 65%), radial-gradient(ellipse 50% 40% at 25% 25%, rgba(255,200,120,0.25) 0%, rgba(0,0,0,0) 60%)"}}),s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"radial-gradient(ellipse 95% 70% at 50% 50%, rgba(0,0,0,0) 30%, rgba(0,0,0,0.75) 100%), linear-gradient(180deg, rgba(13,13,13,0.55) 0%, rgba(13,13,13,0.20) 35%, rgba(13,13,13,0.25) 60%, rgba(13,13,13,0.92) 92%, #0D0D0D 100%)"}}),s.jsx("div",{className:"absolute inset-0 pointer-events-none mix-blend-color opacity-40",style:{background:"linear-gradient(135deg, rgba(20,40,60,0.6) 0%, rgba(0,0,0,0) 45%, rgba(0,0,0,0) 55%, rgba(120,70,20,0.55) 100%)"}}),s.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.28] mix-blend-overlay",style:{backgroundImage:`url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.85 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>")`,backgroundSize:"200px 200px"}}),s.jsx("div",{className:"container relative mx-auto px-4 py-10 md:py-16",children:s.jsxs("div",{className:"max-w-4xl mx-auto text-center",style:{color:Aa},children:[s.jsxs("h1",{className:"font-normal italic text-[clamp(2.5rem,7vw,6.5rem)] leading-[1.02] tracking-[-0.02em] mb-10 text-balance",style:{fontFamily:"'Playfair Display', serif",textShadow:"0 2px 40px rgba(0,0,0,0.6)"},children:["L’agenda des sorties échiquéennes",s.jsx("span",{style:{color:Yd},children:"."})]}),s.jsxs("div",{className:"flex flex-wrap gap-3 justify-center",children:[s.jsx(Pe,{to:"/events",children:s.jsxs("button",{className:"inline-flex items-center gap-2 px-6 py-3.5 rounded-full font-medium text-sm group transition-transform hover:-translate-y-0.5",style:{backgroundColor:Yd,color:na,fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:["Trouver un tournoi",s.jsx(Sr,{className:"w-4 h-4 transition-transform group-hover:translate-x-1"})]})}),s.jsx(Pe,{to:"/venues",children:s.jsx("button",{className:"inline-flex items-center gap-2 px-6 py-3.5 rounded-full font-medium text-sm border transition-transform hover:-translate-y-0.5 backdrop-blur-sm",style:{borderColor:"rgba(245,243,238,0.4)",color:Aa,backgroundColor:"rgba(13,13,13,0.25)",fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:"Explorer les lieux"})})]})]})}),s.jsxs("div",{"aria-hidden":"true",className:`absolute bottom-5 left-1/2 -translate-x-1/2 flex flex-col items-center gap-1.5 pointer-events-none transition-opacity duration-500 ${d?"opacity-0":"opacity-100"}`,style:{color:Aa},children:[s.jsx("span",{className:"text-[10px] uppercase",style:{fontFamily:"'Fragment Mono', ui-monospace, monospace",letterSpacing:"0.3em",color:"rgba(245,243,238,0.65)"},children:"Scroll"}),s.jsx(Wa,{className:"w-4 h-4 animate-scroll-hint",style:{color:"rgba(245,243,238,0.75)"}})]}),s.jsx("div",{ref:i,"aria-hidden":"true",className:"absolute bottom-0 left-0 h-px w-full pointer-events-none"})]})}),s.jsx("div",{"aria-hidden":"true",className:"relative flex justify-center",style:{backgroundColor:na},children:s.jsx("div",{className:"h-[3px] w-16 md:w-24 rounded-full -mt-[1.5px]",style:{backgroundColor:Yd}})}),s.jsx("section",{className:"py-16 md:py-24",style:{backgroundColor:na,color:Aa},children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-10",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs uppercase tracking-[0.2em] mb-2 opacity-60 text-inherit font-thin",style:{fontFamily:"'Fragment Mono', ui-monospace, monospace"},children:"[001] · Agenda"}),s.jsx("h2",{className:"font-bricolage font-black text-4xl md:text-5xl tracking-tight leading-[0.95]",children:"Prochains tournois"}),s.jsx("p",{className:"opacity-70 mt-2",children:"Réservez votre place maintenant"})]}),s.jsx(Pe,{to:"/events",className:"self-start sm:self-auto",children:s.jsxs("button",{className:"inline-flex items-center gap-2 px-5 py-3 rounded-full font-semibold tracking-wide text-sm border-2 group transition-colors bg-transparent text-[var(--btn-fg)] hover:bg-[var(--btn-hover-bg)] hover:text-[var(--btn-hover-fg)]",style:{borderColor:Aa,fontFamily:"'Space Grotesk', system-ui, sans-serif","--btn-fg":Aa,"--btn-hover-bg":Aa,"--btn-hover-fg":na},children:["Voir tous les tournois",s.jsx(Sr,{className:"w-4 h-4 transition-transform group-hover:translate-x-1"})]})})]}),t?s.jsx(YSe,{Skeleton:Ie}):e&&e.length>0?s.jsx(GSe,{events:e,ticketCounts:r}):s.jsxs("div",{className:"text-center py-16 border-2 border-dashed rounded-3xl",style:{borderColor:"rgba(13,13,13,0.2)"},children:[s.jsx(Jn,{className:"w-12 h-12 mx-auto mb-4 opacity-60"}),s.jsx("h3",{className:"font-semibold text-2xl mb-2",style:{fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:"Aucun tournoi à venir"}),s.jsx("p",{className:"opacity-70 mb-6 max-w-md mx-auto",children:"De nouveaux événements arrivent bientôt ! Inscrivez-vous pour être notifié."}),s.jsx(Pe,{to:"/auth?tab=signup&role=player",children:s.jsxs("button",{className:"inline-flex items-center gap-2 px-6 py-3 rounded-full font-semibold tracking-wide text-sm",style:{backgroundColor:Yd,color:na,fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:["Créer un compte",s.jsx(Sr,{className:"w-4 h-4"})]})})]})]})}),s.jsx(yAe,{}),s.jsx(bAe,{}),s.jsx(_Ae,{}),s.jsx("section",{className:"py-10 border-t",style:{borderColor:"rgba(13,13,13,0.15)",backgroundColor:Aa},children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-3xl mx-auto flex flex-col sm:flex-row items-center justify-between gap-4 text-center sm:text-left",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-2xl flex items-center justify-center flex-shrink-0",style:{backgroundColor:Yd,color:na},children:s.jsx(b5,{className:"w-5 h-5"})}),s.jsx("p",{className:"text-sm",style:{color:"rgba(13,13,13,0.75)"},children:"Vous gérez un bar ? Découvrez comment accueillir un tournoi chez vous."})]}),s.jsxs(Pe,{to:"/partenaires",className:"text-sm font-semibold tracking-wide inl
1049ine-flex items-center gap-1 whitespace-nowrap border-b-2 pb-0.5",style:{borderColor:na,fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:["En savoir plus",s.jsx(Sr,{className:"w-3.5 h-3.5"})]})]})})}),s.jsx("footer",{ref:a,className:"py-10 border-t pb-[calc(6rem+env(safe-area-inset-bottom))] md:pb-10",style:{borderColor:"rgba(13,13,13,0.15)",backgroundColor:Aa},children:s.jsxs("div",{className:"container mx-auto px-4 space-y-8",children:[s.jsxs("div",{className:"grid md:grid-cols-2 gap-8 items-start pb-8 border-b",style:{borderColor:"rgba(13,13,13,0.12)"},children:[s.jsx(bee,{}),s.jsx(kR,{source:"footer"})]}),s.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(vc,{size:"sm"}),s.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-black",style:{backgroundColor:Yd,color:na,fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:"by WIT."})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-6 text-sm",children:[s.jsx(Pe,{to:"/partenaires",className:"hover:opacity-60 transition",children:"Devenir partenaire"}),s.jsxs("p",{className:"text-[10px] uppercase tracking-widest",style:{fontFamily:"'Fragment Mono', ui-monospace, monospace",color:"rgba(13,13,13,0.6)"},children:["© ",hee," WIT — ",NR]})]})]})]})}),s.jsx("div",{className:`md:hidden fixed inset-x-0 bottom-0 z-40 transition-transform duration-300 ${d?"translate-y-0":"translate-y-full"}`,style:{paddingBottom:"env(safe-area-inset-bottom)"},"aria-hidden":!d,children:s.jsx("div",{className:"border-t px-4 py-3 shadow-2xl",style:{backgroundColor:Aa,borderColor:na},children:s.jsx(Pe,{to:"/events",tabIndex:d?0:-1,children:s.jsxs("button",{className:"w-full inline-flex items-center justify-center gap-2 px-6 py-4 rounded-full font-semibold tracking-wide text-sm",style:{backgroundColor:na,color:Aa,fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:["Voir les tournois à venir",s.jsx(Sr,{className:"w-4 h-4"})]})})})})]})},NAe="modulepreload",kAe=function(e){return"/"+e},X$={},ka=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=kAe(c),c in X$)return;X$[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":NAe,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function a(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&a(l.reason);return t().catch(a)})},Ue=N.forwardRef(({className:e,type:t,...n},r)=>s.jsx("input",{type:t,className:ae("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));Ue.displayName="Input";var CAe="Label",wee=N.forwardRef((e,t)=>s.jsx(ut.label,{...e,ref:t,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=e.onMouseDown)==null||i.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));wee.displayName=CAe;var _ee=wee;const EAe=dp("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Fe=N.forwardRef(({className:e,...t},n)=>s.jsx(_ee,{ref:n,className:ae(EAe(),e),...t}));Fe.displayName=_ee.displayName;const Se=N.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ae("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));
1049Se.displayName="Card";const kt=N.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ae("flex flex-col space-y-1.5 p-6",e),...t}));kt.displayName="CardHeader";const Et=N.forwardRef(({className:e,...t},n)=>s.jsx("h3",{ref:n,className:ae("text-2xl font-semibold leading-none tracking-tight",e),...t}));Et.displayName="CardTitle";const Qs=N.forwardRef(({className:e,...t},n)=>s.jsx("p",{ref:n,className:ae("text-sm text-muted-foreground",e),...t}));Qs.displayName="CardDescription";const De=N.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ae("p-6 pt-0",e),...t}));De.displayName="CardContent";const jee=N.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ae("flex items-center p-6 pt-0",e),...t}));jee.displayName="CardFooter";var jC="Tabs",[SAe]=Us(jC,[Zf]),Nee=Zf(),[AAe,SR]=SAe(jC),kee=N.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=Jf(l),[f,h]=Hi({prop:r,onChange:i,defaultProp:a??"",caller:jC});return s.jsx(AAe,{scope:n,baseId:di(),value:f,onValueChange:h,orientation:o,dir:d,activationMode:c,children:s.jsx(ut.div,{dir:d,"data-orientation":o,...u,ref:t})})});kee.displayName=jC;var Cee="TabsList",Eee=N.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,a=SR(Cee,n),o=Nee(n);return s.jsx(hC,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:s.jsx(ut.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:t})})});Eee.displayName=Cee;var See="TabsTrigger",Aee=N.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=SR(See,n),l=Nee(n),c=Oee(o.baseId,r),u=Dee(o.baseId,r),d=r===o.value;return s.jsx(mC,{asChild:!0,...l,focusable:!i,active:d,children:s.jsx(ut.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:c,...a,ref:t,onMouseDown:Je(e.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?o.onValueChange(r):f.preventDefault()}),onKeyDown:Je(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(r)}),onFocus:Je(e.onFocus,()=>{const f=o.activationMode!=="manual";!d&&!i&&f&&o.onValueChange(r)})})})});Aee.displayName=See;var Tee="TabsContent",Pee=N.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,l=SR(Tee,n),c=Oee(l.baseId,r),u=Dee(l.baseId,r),d=r===l.value,f=N.useRef(d);return N.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),s.jsx(mi,{present:i||d,children:({present:h})=>s.jsx(ut.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&a})})});Pee.displayName=Tee;function Oee(e,t){return`${e}-trigger-${t}`}function Dee(e,t){return`${e}-content-${t}`}var TAe=kee,Iee=Eee,Ree=Aee,Mee=Pee;const Ka=TAe,Ca=N.forwardRef(({className:e,...t},n)=>s.jsx(Iee,{ref:n,className:ae("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Ca.displayName=Iee.displayName;const vn=N.forwardRef(({className:e,...t},n)=>s.jsx(Ree,{ref:n,className:ae("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",e),...t}));vn.displayName=Ree.displayName;const Sn=N.forwardRef(({className:e,...t},n)=>s.jsx(Mee,{ref:n,className:ae("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Sn.displayName=Mee.displayName;const PAe=({selected:e,onSelect:t})=>s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium",children:"Je suis..."}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("button",{type:"button",onClick:()=>t("player"),className:ae("flex flex-col items-center gap-2 p-4 rounded-lg border-2 transition-all","hover:border-primary/50 hover:bg-secondary/50",e==="player"?"border-primary bg-secondary":"border-border bg-background"),children:[s.jsx("div",{className:ae("w-12 h-12 rounded-full flex items-center justify-center transition-colors",e==="player"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:s.jsx(Cs,{className:"w-6 h-6"})}),s.jsx("span",{className:ae("font-medium text-sm",e==="player"?"text-foreground":"text-muted-foreground"),children:"Un joueur"})]}),s.jsxs("button",{type:"button",onClick:()=>t("venue"),className:ae("flex flex-col items-center gap-2 p-4 rounded-lg border-2 transition-all","hover:border-primary/50 hover:bg-secondary/50",e==="venue"?"border-primary bg-secondary":"border-border bg-background"),children:[s.jsx("div",{className:ae("w-12 h-12 rounded-full flex items-center justify-center transition-colors",e==="venue"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:s.jsx(Vi,{className:"w-6 h-6"})}),s.jsx("span",{className:ae("font-medium text-sm",e==="venue"?"text-foreground":"text-muted-foreground"),children:"Un bar / lieu"})]})]})]}),$s=N.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{className:ae("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
1049ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));$s.displayName="Textarea";var NC="Popover",[Lee]=Us(NC,[Xf]),Hb=Xf(),[OAe,rh]=Lee(NC),Fee=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,l=Hb(t),c=N.useRef(null),[u,d]=N.useState(!1),[f,h]=Hi({prop:r,defaultProp:i??!1,onChange:a,caller:NC});return s.jsx(Vk,{...l,children:s.jsx(OAe,{scope:t,contentId:di(),triggerRef:c,open:f,onOpenChange:h,onOpenToggle:N.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:u,onCustomAnchorAdd:N.useCallback(()=>d(!0),[]),onCustomAnchorRemove:N.useCallback(()=>d(!1),[]),modal:o,children:n})})};Fee.displayName=NC;var $ee="PopoverAnchor",DAe=N.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=rh($ee,n),a=Hb(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=i;return N.useEffect(()=>(o(),()=>l()),[o,l]),s.jsx(Tb,{...a,...r,ref:t})});DAe.displayName=$ee;var Bee="PopoverTrigger",zee=N.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=rh(Bee,n),a=Hb(n),o=Qt(t,i.triggerRef),l=s.jsx(ut.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Wee(i.open),...r,ref:o,onClick:Je(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?l:s.jsx(Tb,{asChild:!0,...a,children:l})});zee.displayName=Bee;var AR="PopoverPortal",[IAe,RAe]=Lee(AR,{forceMount:void 0}),Uee=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=rh(AR,t);return s.jsx(IAe,{scope:t,forceMount:n,children:s.jsx(mi,{present:n||a.open,children:s.jsx(g0,{asChild:!0,container:i,children:r})})})};Uee.displayName=AR;var Sx="PopoverContent",qee=N.forwardRef((e,t)=>{const n=RAe(Sx,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=rh(Sx,e.__scopePopover);return s.jsx(mi,{present:r||a.open,children:a.modal?s.jsx(LAe,{...i,ref:t}):s.jsx(FAe,{...i,ref:t})})});qee.displayName=Sx;var MAe=Df("PopoverContent.RemoveScroll"),LAe=N.forwardRef((e,t)=>{const n=rh(Sx,e.__scopePopover),r=N.useRef(null),i=Qt(t,r),a=N.useRef(!1);return N.useEffect(()=>{const o=r.current;if(o)return cC(o)},[]),s.jsx(Mb,{as:MAe,allowPinchZoom:!0,children:s.jsx(Vee,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Je(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),a.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Je(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;a.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:Je(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),FAe=N.forwardRef((e,t)=>{const n=rh(Sx,e.__scopePopover),r=N.useRef(!1),i=N.useRef(!1);return s.jsx(Vee,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,a),a.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),a.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:a=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=a.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),Vee=N.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...f}=e,h=rh(Sx,n),p=Hb(n);return oC(),s.jsx(Rb,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:s.jsx(up,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:s.jsx(Hk,{"data-state":Wee(h.open),role:"dialog",id:h.contentId,...p,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Hee="PopoverClose",$Ae=N.forwardRef((e,t)=>
vendor: 13,862 bytes, line 1049
1049{const{__scopePopover:n,...r}=e,i=rh(Hee,n);return s.jsx(ut.button,{type:"button",...r,ref:t,onClick:Je(e.onClick,()=>i.onOpenChange(!1))})});$Ae.displayName=Hee;var BAe="PopoverArrow",zAe=N.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Hb(n);return s.jsx(Wk,{...i,...r,ref:t})});zAe.displayName=BAe;function Wee(e){return e?"open":"closed"}var UAe=Fee,qAe=zee,VAe=Uee,Gee=qee;const Vm=UAe,Hm=qAe,Lf=N.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>s.jsx(VAe,{children:s.jsx(Gee,{ref:i,align:t,sideOffset:n,className:ae("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));Lf.displayName=Gee.displayName;var Q$=1,HAe=.9,WAe=.8,GAe=.17,PA=.1,OA=.999,KAe=.9999,YAe=.99,XAe=/[\\\/_+.#"@\[\(\{&]/,QAe=/[\\\/_+.#"@\[\(\{&]/g,JAe=/[\s-]/,Kee=/[\s-]/g;function hT(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Q$:YAe;var l=`${i},${a}`;if(o[l]!==void 0)return o[l];for(var c=r.charAt(a),u=n.indexOf(c,i),d=0,f,h,p,x;u>=0;)f=hT(e,t,n,r,u+1,a+1,o),f>d&&(u===i?f*=Q$:XAe.test(e.charAt(u-1))?(f*=WAe,p=e.slice(i,u-1).match(QAe),p&&i>0&&(f*=Math.pow(OA,p.length))):JAe.test(e.charAt(u-1))?(f*=HAe,x=e.slice(i,u-1).match(Kee),x&&i>0&&(f*=Math.pow(OA,x.length))):(f*=GAe,i>0&&(f*=Math.pow(OA,u-i))),e.charAt(u)!==t.charAt(a)&&(f*=KAe)),(f<PA&&n.charAt(u-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(u-1)!==r.charAt(a))&&(h=hT(e,t,n,r,u+1,a+2,o),h*PA>f&&(f=h*PA)),f>d&&(d=f),u=n.indexOf(c,u+1);return o[l]=d,d}function J$(e){return e.toLowerCase().replace(Kee," ")}function ZAe(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,hT(e,t,J$(e),J$(t),0,0,{})}var jy='[cmdk-group=""]',DA='[cmdk-group-items=""]',e4e='[cmdk-group-heading=""]',Yee='[cmdk-item=""]',Z$=`${Yee}:not([aria-disabled="true"])`,mT="cmdk-item-select",tg="data-value",t4e=(e,t,n)=>ZAe(e,t,n),Xee=N.createContext(void 0),Wb=()=>N.useContext(Xee),Qee=N.createContext(void 0),TR=()=>N.useContext(Qee),Jee=N.createContext(void 0),Zee=N.forwardRef((e,t)=>{let n=ng(()=>{var J,Y;return{search:"",value:(Y=(J=e.value)!=null?J:e.defaultValue)!=null?Y:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=ng(()=>new Set),i=ng(()=>new Map),a=ng(()=>new Map),o=ng(()=>new Set),l=ete(e),{label:c,children:u,value:d,onValueChange:f,filter:h,shouldFilter:p,loop:x,disablePointerSelection:y=!1,vimBindings:b=!0,...w}=e,_=di(),j=di(),E=di(),S=N.useRef(null),T=f4e();Wm(()=>{if(d!==void 0){let J=d.trim();n.current.value=J,P.emit()}},[d]),Wm(()=>{T(6,B)},[]);let P=N.useMemo(()=>({subscribe:J=>(o.current.add(J),()=>o.current.delete(J)),snapshot:()=>n.current,setState:(J,Y,Z)=>{var G,se,ce,le;if(!Object.is(n.current[J],Y)){if(n.current[J]=Y,J==="search")M(),R(),T(1,L);else if(J==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let fe=document.getElementById(E);fe?fe.focus():(G=document.getElementById(_))==null||G.focus()}if(T(7,()=>{var fe;n.current.selectedItemId=(fe=U())==null?void 0:fe.id,P.emit()}),Z||T(5,B),((se=l.current)==null?void 0:se.value)!==void 0){let fe=Y??"";(le=(ce=l.current).onValueChange)==null||le.call(ce,fe);return}}P.emit()}},emit:()=>{o.current.forEach(J=>J())}}),[]),O=N.useMemo(()=>({value:(J,Y,Z)=>{var G;Y!==((G=a.current.get(J))==null?void 0:G.value)&&(a.current.set(J,{value:Y,keywords:Z}),n.current.filtered.items.set(J,D(Y,Z)),T(2,()=>{R(),P.emit()}))},item:(J,Y)=>(r.current.add(J),Y&&(i.current.has(Y)?i.current.get(Y).add(J):i.current.set(Y,new Set([J]))),T(3,()=>{M(),R(),n.current.value||L(),P.emit()}),()=>{a.current.delete(J),r.current.delete(J),n.current.filtered.items.delete(J);let Z=U();T(4,()=>{M(),(Z==null?void 0:Z.getAttribute("id"))===J&&L(),P.emit()})}),group:J=>(i.current.has(J)||i.current.set(J,new Set),()=>{a.current.delete(J),i.current.delete(J)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:_,inputId:E,labelId:j,listInnerRef:S}),[]);function D(J,Y){var Z,G;let se=(G=(Z=l.current)==null?void 0:Z.filter)!=null?G:t4e;return J?se(J,n.current.search,Y):0}function R(){if(!n.current.search||l.current.shouldFilter===!1)return;let J=n.current.filtered.items,Y=[];n.current.filtered.groups.forEach(G=>{let se=i.current.get(G),ce=0;se.forEach(le=>{let fe=J.get(le);ce=Math.max(fe,ce)}),Y.push([G,ce])});let Z=S.current;F().sort((G,se)=>{var ce,le;let fe=G.getAttribute("id"),be=se.getAttribute("id");return((ce=J.get(be))!=null?ce:0)-((le=J.get(fe))!=null?le:0)}).forEach(G=>{let se=G.closest(DA);se?se.appendChild(G.parentElement===se?G:G.closest(`${DA} > *`)):Z.appendChild(G.parentElement===Z?G:G.closest(`${DA} > *`))}),Y.sort((G,se)=>se[1]-G[1]).forEach(G=>{var se;let ce=(se=S.current)==null?void 0:se.querySelector(`${jy}[${tg}="${encodeURIComponent(G[0])}"]`);ce==null||ce.parentElement.appendChild(ce)})}function L(){let J=F().find(Z=>Z.getAttribute("aria-disabled")!=="true"),Y=J==null?void 0:J.getAttribute(tg);P.setState("value",Y||void 0)}function M(){var J,Y,Z,G;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let se=0;for(let ce of r.current){let le=(Y=(J=a.current.get(ce))==null?void 0:J.value)!=null?Y:"",fe=(G=(Z=a.current.get(ce))==null?void 0:Z.keywords)!=null?G:[],be=D(le,fe);n.current.filtered.items.set(ce,be),be>0&&se++}for(let[ce,le]of i.current)for(let fe of le)if(n.current.filtered.items.get(fe)>0){n.current.filtered.groups.add(ce);break}n.current.filtered.count=se}function B(){var J,Y,Z;let G=U();G&&(((J=G.parentElement)==null?void 0:J.firstChild)===G&&((Z=(Y=G.closest(jy))==null?void 0:Y.querySelector(e4e))==null||Z.scrollIntoView({block:"nearest"})),G.scrollIntoView({block:"nearest"}))}function U(){var J;return(J=S.current)==null?void 0:J.querySelector(`${Yee}[aria-selected="true"]`)}function F(){var J;return Array.from(((J=S.current)==null?void 0:J.querySelectorAll(Z$))||[])}function H(J){let Y=F()[J];Y&&P.setState("value",Y.getAttribute(tg))}function z(J){var Y;let Z=U(),G=F(),se=G.findIndex(le=>le===Z),ce=G[se+J];(Y=l.current)!=null&&Y.loop&&(ce=se+J<0?G[G.length-1]:se+J===G.length?G[0]:G[se+J]),ce&&P.setState("value",ce.getAttribute(tg))}function K(J){let Y=U(),Z=Y==null?void 0:Y.closest(jy),G;for(;Z&&!G;)Z=J>0?u4e(Z,jy):d4e(Z,jy),G=Z==null?void 0:Z.querySelector(Z$);G?P.setState("value",G.getAttribute(tg)):z(J)}let W=()=>H(F().length-1),q=J=>{J.preventDefault(),J.metaKey?W():J.altKey?K(1):z(1)},oe=J=>{J.preventDefault(),J.metaKey?H(0):J.altKey?K(-1):z(-1)};return N.createElement(ut.div,{ref:t,tabIndex:-1,...w,"cmdk-root":"",onKeyDown:J=>{var Y;(Y=w.onKeyDown)==null||Y.call(w,J);let Z=J.nativeEvent.isComposing||J.keyCode===229;if(!(J.defaultPrevented||Z))switch(J.key){case"n":case"j":{b&&J.ctrlKey&&q(J);break}case"ArrowDown":{q(J);break}case"p":case"k":{b&&J.ctrlKey&&oe(J);break}case"ArrowUp":{oe(J);break}case"Home":{J.preventDefault(),H(0);break}case"End":{J.preventDefault(),W();break}case"Enter":{J.preventDefault();let G=U();if(G){let se=new Event(mT);G.dispatchEvent(se)}}}}},N.createElement("label",{"cmdk-label":"",htmlFor:O.inputId,id:O.labelId,style:m4e},c),kC(e,J=>N.createElement(Qee.Provider,{value:P},N.createElement(Xee.Provider,{value:O},J))))}),n4e=N.forwardRef((e,t)=>{var n,r;let i=di(),a=N.useRef(null),o=N.useContext(Jee),l=Wb(),c=ete(e),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;Wm(()=>{if(!u)return l.item(i,o==null?void 0:o.id)},[u]);let d=tte(i,a,[e.value,e.children,a],e.keywords),f=TR(),h=Ff(T=>T.value&&T.value===d.current),p=Ff(T=>u||l.filter()===!1?!0:T.search?T.filtered.items.get(i)>0:!0);N.useEffect(()=>{let T=a.current;if(!(!T||e.disabled))return T.addEventListener(mT,x),()=>T.removeEventListener(mT,x)},[p,e.onSelect,e.disabled]);function x(){var T,P;y(),(P=(T=c.current).onSelect)==null||P.call(T,d.current)}function y(){f.setState("value",d.current,!0)}if(!p)return null;let{disabled:b,value:w,onSelect:_,forceMount:j,keywords:E,...S}=e;return N.createElement(ut.div,{ref:td(a,t),...S,id:i,"cmdk-item":"",role:"option","aria-disabled":!!b,"aria-selected":!!h,"data-disabled":!!b,"data-selected":!!h,onPointerMove:b||l.getDisablePointerSelection()?void 0:y,onClick:b?void 0:x},e.children)}),r4e=N.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=di(),l=N.useRef(null),c=N.useRef(null),u=di(),d=Wb(),f=Ff(p=>i||d.filter()===!1?!0:p.search?p.filtered.groups.has(o):!0);Wm(()=>d.group(o),[]),tte(o,l,[e.value,e.heading,c]);let h=N.useMemo(()=>({id:o,forceMount:i}),[i]);return N.createElement(ut.div,{ref:td(l,t),...a,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&N.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),kC(e,p=>N.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},N.createElement(Jee.Provider,{value:h},p))))}),s4e=N.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=N.useRef(null),a=Ff(o=>!o.search);return!n&&!a?null:N.createElement(ut.div,{ref:td(i,t),...r,"cmdk-separator":"",role:"separator"})}),i4e=N.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=TR(),o=Ff(u=>u.search),l=Ff(u=>u.selectedItemId),c=Wb();return N.useEffect(()=>{e.value!=null&&a.setState("search",e.value)},[e.value]),N.createElement(ut.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:i?e.value:o,onChange:u=>{i||a.setState("search",u.target.value),n==null||n(u.target.value)}})}),a4e=N.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...i}=e,a=N.useRef(null),o=N.useRef(null),l=Ff(u=>u.selectedItemId),c=Wb();return N.useEffect(()=>{if(o.current&&a.current){let u=o.current,d=a.current,f,h=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let p=u.offsetHeight;d.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return h.observe(u),()=>{cancelAnimationFrame(f),h.unobserve(u)}}},[]),N.createElement(ut.div,{ref:td(a,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},kC(e,u=>N.createElement("div",{ref:td(o,c.listInnerRef),"cmdk-list-sizer":""},u)))}),o4e=N.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...l}=e;return N.createElement(Lb,{open:n,onOpenChange:r},N.createElement(Fb,{container:o},N.createElement(pp,{"cmdk-overlay":"",className:i}),N.createElement(gp,{"aria-label":e.label,"cmdk-dialog":"",className:a},N.createElement(Zee,{ref:t,...l}))))}),l4e=N.forwardRef((e,t)=>Ff(n=>n.filtered.count===0)?N.createElement(ut.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),c4e=N.forwardRef((e,t)=>{let{progress:n,children:r,label:i="Loading...",...a}=e;return N.createElement(ut.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},kC(e,o=>N.createElement("div",{"aria-hidden":!0},o)))}),jo=Object.assign(Zee,{List:a4e,Item:n4e,Input:i4e,Group:r4e,Separator:s4e,Dialog:o4e,Empty:l4e,Loading:c4e});function u4e(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function d4e(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ete(e){let t=N.useRef(e);return Wm(()=>{t.current=e}),t}var Wm=typeof window>"u"?N.useEffect:N.useLayoutEffect;function ng(e){let t=N.useRef();return t.current===void 0&&(t.current=e()),t}function Ff(e){let t=TR(),n=()=>e(t.snapshot());return N.useSyncExternalStore(t.subscribe,n,n)}function tte(e,t,n,r=[]){let i=N.useRef(),a=Wb();return Wm(()=>{var o;let l=(()=>{var u;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(u=d.current.textContent)==null?void 0:u.trim():i.current}})(),c=r.map(u=>u.trim());a.value(e,l,c),(o=t.current)==null||o.setAttribute(tg,l),i.current=l}),i}var f4e=()=>{let[e,t]=N.useState(),n=ng(()=>new Map);return Wm(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,i)=>{n.current.set(r,i),t({})}};function h4e(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function kC({asChild:e,children:t},n){return e&&N.isValidElement(t)?N.cloneElement(h4e(t),{ref:t.ref},n(t.props.children)):n(t)}var m4e={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Ln=Lb,nte=tR,p4e=Fb,rte=N.forwardRef(({className:e,...t},n)=>s.jsx(pp,{ref:n,className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));rte.displayName=pp.displayName;const Dn=N.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(p4e,{children:[s.jsx(rte,{}),s.jsxs(gp,{ref:r,className:ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
1049nded-lg",e),...n,children:[t,s.jsxs(T0,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[s.jsx(Er,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Dn.displayName=gp.displayName;const Un=({className:e,...t})=>s.jsx("div",{className:ae("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Un.displayName="DialogHeader";const Pi=({className:e,...t})=>s.jsx("div",{className:ae("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Pi.displayName="DialogFooter";const qn=N.forwardRef(({className:e,...t},n)=>s.jsx(S0,{ref:n,className:ae("text-lg font-semibold leading-none tracking-tight",e),...t}));qn.displayName=S0.displayName;const qr=N.forwardRef(({className:e,...t},n)=>s.jsx(A0,{ref:n,className:ae("text-sm text-muted-foreground",e),...t}));qr.displayName=A0.displayName;const Lu=N.forwardRef(({className:e,...t},n)=>s.jsx(jo,{ref:n,className:ae("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Lu.displayName=jo.displayName;const Gb=N.forwardRef(({className:e,...t},n)=>s.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[s.jsx(_o,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),s.jsx(jo.Input,{ref:n,className:ae("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));Gb.displayName=jo.Input.displayName;const Fu=N.forwardRef(({className:e,...t},n)=>s.jsx(jo.List,{ref:n,className:ae("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Fu.displayName=jo.List.displayName;const CC=N.forwardRef((e,t)=>s.jsx(jo.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));CC.displayName=jo.Empty.displayName;const ml=N.forwardRef(({className:e,...t},n)=>s.jsx(jo.Group,{ref:n,className:ae("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));ml.displayName=jo.Group.displayName;const jv=N.forwardRef(({className:e,...t},n)=>s.jsx(jo.Separator,{ref:n,className:ae("-mx-1 h-px bg-border",e),...t}));jv.displayName=jo.Separator.displayName;const Oa=N.forwardRef(({className:e,...t},n)=>s.jsx(jo.Item,{ref:n,className:ae("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),...t}));Oa.displayName=jo.Item.displayName;function g4e(e){var o;const t=e.properties,n=[];t.housenumber&&n.push(t.housenumber),t.street?n.push(t.street):t.name&&n.push(t.name);const r=n.join(" ")||t.name||"",i=[];r&&i.push(r),t.postcode&&i.push(t.postcode),t.city&&i.push(t.city),t.country&&t.country!==t.city&&i.push(t.country);const a=i.join(", ");return{id:`${t.osm_type}-${t.osm_id}`,label:a,address:r||a,city:t.city||t.state||"",postalCode:t.postcode,country:t.country||"",coordinates:(o=e.geometry)!=null&&o.coordinates?[e.geometry.coordinates[1],e.geometry.coordinates[0]]:void 0}}const x4e="https://photon.komoot.io/api/",y4e=300,v4e=3,b4e=5;function w4e(e){const[t,n]=N.useState([]),[r,i]=N.useState(!1),[a,o]=N.useState(null),l=N.useRef(null);return N.useEffect(()=>{var d;if((d=l.current)==null||d.abort(),e.trim().length<v4e){n([]),i(!1),o(null);return}const c=new AbortController;l.current=c;const u=setTimeout(async()=>{i(!0),o(null);try{const f=new URLSearchParams({q:e.trim(),limit:b4e.toString(),lang:"fr"}),h=await fetch(`${x4e}?${f}`,{signal:c.signal});if(!h.ok)throw new Error("Erreur réseau");const x=(await h.json()).features.map(g4e);n(x)}catch(f){f.name!=="AbortError"&&(o("Impossible de charger les suggestions"),n([]))}finally{c.signal.aborted||i(!1)}},y4e);return()=>{clearTimeout(u),c.abort()}},[e]),{suggestions:t,isLoading:r,error:a}}
1049function PR({value:e,onChange:t,onSelect:n,placeholder:r="Rechercher une adresse...",disabled:i,className:a,id:o}){const[l,c]=N.useState(!1),[u,d]=N.useState(e),f=N.useRef(null),{suggestions:h,isLoading:p,error:x}=w4e(u);N.useEffect(()=>{d(e)},[e]);const y=_=>{d(_),t(_),c(!0)},b=_=>{var j;d(_.label),t(_.label),n==null||n(_),c(!1),(j=f.current)==null||j.blur()},w=l&&(h.length>0||p||!!x);return s.jsxs(Vm,{open:w,children:[s.jsx(Hm,{asChild:!0,children:s.jsxs("div",{className:"relative w-full",children:[s.jsx(gn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none"}),s.jsx(Ue,{ref:f,id:o,value:u,onChange:_=>y(_.target.value),onFocus:()=>u.length>=3&&c(!0),placeholder:r,disabled:i,className:ae("pl-10 pr-10","bg-background/80 backdrop-blur-sm","border-border/50 hover:border-primary/30","focus:border-primary focus:ring-2 focus:ring-primary/20","transition-all duration-200",a)}),p&&s.jsx(We,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 animate-spin text-muted-foreground"})]})}),s.jsx(Lf,{className:ae("w-[var(--radix-popover-trigger-width)] p-0","bg-popover/95 backdrop-blur-md","border border-border/50","shadow-xl shadow-black/10","rounded-xl overflow-hidden"),align:"start",sideOffset:4,onOpenAutoFocus:_=>_.preventDefault(),children:s.jsx(Lu,{children:s.jsxs(Fu,{children:[p&&s.jsxs("div",{className:"flex items-center justify-center py-4 text-sm text-muted-foreground",children:[s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),"Recherche en cours..."]}),x&&s.jsx("div",{className:"py-4 px-3 text-sm text-destructive text-center",children:x}),!p&&!x&&h.length===0&&u.length>=3&&s.jsx(CC,{className:"py-4 text-center text-sm text-muted-foreground",children:"Aucune adresse trouvée"}),h.map(_=>s.jsxs(Oa,{onSelect:()=>b(_),className:ae("flex items-start gap-3 px-3 py-2.5","cursor-pointer","hover:bg-primary/5","data-[selected=true]:bg-primary/10","transition-colors duration-150"),children:[s.jsx(km,{className:"w-4 h-4 mt-0.5 text-primary shrink-0"}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsx("span",{className:"font-medium text-foreground truncate",children:_.address}),s.jsx("span",{className:"text-xs text-muted-foreground",children:[_.postalCode,_.city,_.country].filter(Boolean).join(", ")})]})]},_.id))]})})})]})}const _4e=({data:e,onChange:t,errors:n})=>s.jsxs("div",{className:"space-y-4 p-4 bg-secondary/50 rounded-lg border border-border animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(Vi,{className:"w-4 h-4"}),s.jsx("span",{children:"Parlez-nous de votre établissement"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"barName",children:"Nom du bar / lieu"}),s.jsxs("div",{className:"relative",children:[s.jsx(Vi,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{id:"barName",placeholder:"Le Café des Échecs",value:e.barName,onChange:r=>t({...e,barName:r.target.value}),className:"pl-10",required:!0})]}),(n==null?void 0:n.barName)&&s.jsx("p",{className:"text-sm text-destructive",children:n.barName})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"barAddress",children:"Adresse"}),s.jsx(PR,{id:"barAddress",value:e.barAddress,onChange:r=>t({...e,barAddress:r}),onSelect:r=>t({...e,barAddress:r.label}),placeholder:"Rechercher votre adresse..."}),(n==null?void 0:n.barAddress)&&s.jsx("p",{className:"text-sm text-destructive",children:n.barAddress})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"contactEmail",children:"Email de contact professionnel"}),s.jsxs("div",{className:"relative",children:[s.jsx(wr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{id:"contactEmail",type:"email",placeholder:"[email protected]",value:e.contactEmail,onChange:r=>t({...e,contactEmail:r.target.value}),className:"pl-10",required:!0})]}),(n==null?void 0:n.contactEmail)&&s.jsx("p",{className:"text-sm text-destructive",children:n.contactEmail})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"contactPhone",children:"Téléphone (optionnel)"}),s.jsxs("div",{className:"relative",children:[s.jsx(nX,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{id:"contactPhone",type:"tel",inputMode:"tel",autoComplete:"tel",placeholder:"06 12 34 56 78",value:e.contactPhone,onChange:r=>t({...e,contactPhone:r.target.value}),className:"pl-10"})]}),(n==null?void 0:n.contactPhone)&&s.jsx("p",{className:"text-sm text-destructive",children:n.contactPhone})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"message",children:"Message (optionnel)"}),s.jsxs("div",{className:"relative",children:[s.jsx(eX,{className:"absolute left-3 top-3 w-4 h-4 text-muted-foreground"}),s.jsx($s,{id:"message",placeholder:"Quelques mots sur votre établissement et vos motivations...",value:e.message,onChange:r=>t({...e,message:r.target.value}),className:"pl-10 min-h-[80px] resize-none"})]}),(n==null?void 0:n.message)&&s.jsx("p",{className:"text-sm text-destructive",children:n.message})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Votre demande sera examinée par notre équipe. Nous vous contacterons rapidement !"})]});function j4e(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const ste=ee.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{}
1049,openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),Kb=()=>{const e=ee.useContext(ste);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};j4e(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,100%,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,-100%,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(-100%,0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(100%,0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
1050[data-state=closed]
1051){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;
1051left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,100%,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,100%,0)}}@keyframes slideFromTop{from{transform:translate3d(0,-100%,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,-100%,0)}}@keyframes slideFromLeft{from{transform:translate3d(-100%,0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(-100%,0,0)}}@keyframes slideFromRight{from{transform:translate3d(100%,0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(100%,0,0)}}`);const N4e=24,k4e=typeof window<"u"?N.useLayoutEffect:N.useEffect;function e7(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}function C4e(){return OR(/^Mac/)}function E4e(){return OR(/^iPhone/)}function t7(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function S4e(){return OR(/^iPad/)||C4e()&&navigator.maxTouchPoints>1}function ite(){return E4e()||S4e()}function OR(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const IA=typeof document<"u"&&window.visualViewport;function n7(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function ate(e){for(n7(e)&&(e=e.parentElement);e&&!n7(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const A4e=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let o_=0,RA;function T4e(e={}){let{isDisabled:t}=e;k4e(()=>{if(!t)return o_++,o_===1&&ite()&&(RA=P4e()),()=>{o_--,o_===0&&(RA==null||RA())}},[t])}function P4e(){let e,t=0,n=f=>{e=ate(f.target),!(e===document.documentElement&&e===document.body)&&(t=f.changedTouches[0].pageY)},r=f=>{if(!e||e===document.documentElement||e===document.body){f.preventDefault();return}let h=f.changedTouches[0].pageY,p=e.scrollTop,x=e.scrollHeight-e.clientHeight;x!==0&&((p<=0&&h>t||p>=x&&h<t)&&f.preventDefault(),t=h)},i=f=>{let h=f.target;pT(h)&&h!==document.activeElement&&(f.preventDefault(),h.style.transform="translateY(-2000px)",h.focus(),requestAnimationFrame(()=>{h.style.transform=""}))},a=f=>{let h=f.target;pT(h)&&(h.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{h.style.transform="",IA&&(IA.height<window.innerHeight?requestAnimationFrame(()=>{r7(h)}):IA.addEventListener("resize",()=>r7(h),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},l=window.pageXOffset,c=window.pageYOffset,u=e7(O4e(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let d=e7(Ny(document,"touchstart",n,{passive:!1,capture:!0}),Ny(document,"touchmove",r,{passive:!1,capture:!0}),Ny(document,"touchend",i,{passive:!1,capture:!0}),Ny(document,"focus",a,!0),Ny(window,"scroll",o));return()=>{u(),d(),window.scrollTo(l,c)}}function O4e(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Ny(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function r7(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=ate(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,i=e.getBoundingClientRect().top,a=e.getBoundingClientRect().bottom;const o=n.getBoundingClientRect().bottom+N4e;a>o&&(n.scrollTop+=i-r)}e=n.parentElement}}function pT(e){return e instanceof HTMLInputElement&&!A4e.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function D4e(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function I4e(...e){return t=>e.forEach(n=>D4e(n,t))}function ote(...e){return N.useCallback(I4e(...e),e)}const lte=new WeakMap;function _i(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([i,a])=>{if(i.startsWith("--")){e.style.setProperty(i,a);return}r[i]=e.style[i],e.style[i]=a}),!n&&lte.set(e,r)}function R4e(e,t){if(!e||!(e instanceof HTMLElement))return;let n=lte.get(e);n&&(e.style[t]=n[t])}const Ni=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function l_(e,t){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let i=r.match(/^matrix3d\((.+)\)$/);return i?parseFloat(i[1].split(", ")[Ni(t)?13:12]):(i=r.match(/^matrix\((.+)\)$/),i?parseFloat(i[1].split(", ")[Ni(t)?5:4]):null)}function M4e(e){return 8*(Math.log(e+1)-2)}function MA(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function L4e(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const bs={DURATION:.5,EASE:[.32,.72,0,1]},cte=.4,F4e=.25,$4e=100,ute=8,Ch=16,gT=26,LA="vaul-dragging";function dte(e){const t=ee.useRef(e);return ee.useEffect(()=>{t.current=e}),ee.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function B4e({defaultProp:e,onChange:t}){const n=ee.useState(e),[r]=n,i=ee.useRef(r),a=dte(t);return ee.useEffect(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}function fte({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=B4e({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,l=dte(n),c=ee.useCallback(u=>{if(a){const f=typeof u=="function"?u(e):u;f!==e&&l(f)}else i(u)},[a,e,i,l]);return[o,c]}function z4e({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:i,fadeFromIndex:a,onSnapPointChange:o,direction:l="bottom",container:c,snapToSequentialPoint:u}){const[d,f]=fte({prop:e,defaultProp:n==null?void 0:n[0],onChange:t}),[h,p]=ee.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);ee.useEffect(()=>{function P(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",P),()=>window.removeEventListener("resize",P)},[]);const x=ee.useMemo(()=>d===(n==null?void 0:n[n.length-1])||null,[n,d]),y=ee.useMemo(()=>n==null?void 0:n.findIndex(P=>P===d),[n,d]),b=n&&n.length>0&&(a||a===0)&&!Number.isNaN(a)&&n[a]===d||!n,w=ee.useMemo(()=>{const P=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var O;return(O=n==null?void 0:n.map(D=>
1051{const R=typeof D=="string";let L=0;if(R&&(L=parseInt(D,10)),Ni(l)){const B=R?L:h?D*P.height:0;return h?l==="bottom"?P.height-B:-P.height+B:B}const M=R?L:h?D*P.width:0;return h?l==="right"?P.width-M:-P.width+M:M}))!=null?O:[]},[n,h,c]),_=ee.useMemo(()=>y!==null?w==null?void 0:w[y]:null,[w,y]),j=ee.useCallback(P=>{var O;const D=(O=w==null?void 0:w.findIndex(R=>R===P))!=null?O:null;o(D),_i(r.current,{transition:`transform ${bs.DURATION}s cubic-bezier(${bs.EASE.join(",")})`,transform:Ni(l)?`translate3d(0, ${P}px, 0)`:`translate3d(${P}px, 0, 0)`}),w&&D!==w.length-1&&D!==a&&D<a?_i(i.current,{transition:`opacity ${bs.DURATION}s cubic-bezier(${bs.EASE.join(",")})`,opacity:"0"}):_i(i.current,{transition:`opacity ${bs.DURATION}s cubic-bezier(${bs.EASE.join(",")})`,opacity:"1"}),f(n==null?void 0:n[Math.max(D,0)])},[r.current,n,w,a,i,f]);ee.useEffect(()=>{if(d||e){var P;const O=(P=n==null?void 0:n.findIndex(D=>D===e||D===d))!=null?P:-1;w&&O!==-1&&typeof w[O]=="number"&&j(w[O])}},[d,e,n,w,j]);function E({draggedDistance:P,closeDrawer:O,velocity:D,dismissible:R}){if(a===void 0)return;const L=l==="bottom"||l==="right"?(_??0)-P:(_??0)+P,M=y===a-1,B=y===0,U=P>0;if(M&&_i(i.current,{transition:`opacity ${bs.DURATION}s cubic-bezier(${bs.EASE.join(",")})`}),!u&&D>2&&!U){R?O():j(w[0]);return}if(!u&&D>2&&U&&w&&n){j(w[n.length-1]);return}const F=w==null?void 0:w.reduce((z,K)=>typeof z!="number"||typeof K!="number"?z:Math.abs(K-L)<Math.abs(z-L)?K:z),H=Ni(l)?window.innerHeight:window.innerWidth;if(D>cte&&Math.abs(P)<H*.4){const z=U?1:-1;if(z>0&&x){j(w[n.length-1]);return}if(B&&z<0&&R&&O(),y===null)return;j(w[y+z]);return}j(F)}function S({draggedDistance:P}){if(_===null)return;const O=l==="bottom"||l==="right"?_-P:_+P;(l==="bottom"||l==="right")&&O<w[w.length-1]||(l==="top"||l==="left")&&O>w[w.length-1]||_i(r.current,{transform:Ni(l)?`translate3d(0, ${O}px, 0)`:`translate3d(${O}px, 0, 0)`})}function T(P,O){if(!n||typeof y!="number"||!w||a===void 0)return null;const D=y===a-1;if(y>=a&&O)return 0;if(D&&!O)return 1;if(!b&&!D)return null;const L=D?y+1:y-1,M=D?w[L]-w[L-1]:w[L+1]-w[L],B=P/Math.abs(M);return D?1-B:B}return{isLastSnapPoint:x,activeSnapPoint:d,shouldFade:b,getPercentageDragged:T,setActiveSnapPoint:f,activeSnapPointIndex:y,onRelease:E,onDrag:S,snapPointsOffset:w}}const U4e=()=>()=>{};function q4e(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:i}=Kb(),a=ee.useRef(null),o=N.useMemo(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-gT)/window.innerWidth}ee.useEffect(()=>{if(t&&n){a.current&&clearTimeout(a.current);const c=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!c)return;L4e(r&&!i?MA(document.body,{background:"black"}):U4e,MA(c,{transformOrigin:Ni(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${bs.DURATION}s`,transitionTimingFunction:`cubic-bezier(${bs.EASE.join(",")})`}));const u=MA(c,{borderRadius:`${ute}px`,overflow:"hidden",...Ni(e)?{transform:`scale(${l()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${l()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{u(),a.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty("background")},bs.DURATION*1e3)}}},[t,n,o])}let ky=null;function V4e({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:i,noBodyStyles:a}){const[o,l]=ee.useState(()=>typeof window<"u"?window.location.href:""),c=ee.useRef(0),u=ee.useCallback(()=>{if(t7()&&ky===null&&e&&!a){ky={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:f,innerHeight:h}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const p=h-window.innerHeight;p&&c.current>=h&&(document.body.style.top=`${-(c.current+p)}px`)}),300)}},[e]),d=ee.useCallback(()=>
1051{if(t7()&&ky!==null&&!a){const f=-parseInt(document.body.style.top,10),h=-parseInt(document.body.style.left,10);Object.assign(document.body.style,ky),window.requestAnimationFrame(()=>{if(i&&o!==window.location.href){l(window.location.href);return}window.scrollTo(h,f)}),ky=null}},[o]);return ee.useEffect(()=>{function f(){c.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),ee.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&u(),t||window.setTimeout(()=>{d()},500)):d())},[e,r,o,t,n,u,d]),{restorePositionSetting:d}}function H4e({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:i,snapPoints:a,shouldScaleBackground:o=!1,setBackgroundColorOnScale:l=!0,closeThreshold:c=F4e,scrollLockTimeout:u=$4e,dismissible:d=!0,handleOnly:f=!1,fadeFromIndex:h=a&&a.length-1,activeSnapPoint:p,setActiveSnapPoint:x,fixed:y,modal:b=!0,onClose:w,nested:_,noBodyStyles:j,direction:E="bottom",defaultOpen:S=!1,disablePreventScroll:T=!0,snapToSequentialPoint:P=!1,preventScrollRestoration:O=!1,repositionInputs:D=!0,onAnimationEnd:R,container:L,autoFocus:M=!1}){var B,U;const[F=!1,H]=fte({defaultProp:S,prop:e,onChange:gt=>{t==null||t(gt),!gt&&!_&&ge(),setTimeout(()=>{R==null||R(gt)},bs.DURATION*1e3),gt&&!b&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),gt||(document.body.style.pointerEvents="auto")}}),[z,K]=ee.useState(!1),[W,q]=ee.useState(!1),[oe,J]=ee.useState(!1),Y=ee.useRef(null),Z=ee.useRef(null),G=ee.useRef(null),se=ee.useRef(null),ce=ee.useRef(null),le=ee.useRef(!1),fe=ee.useRef(null),be=ee.useRef(0),_e=ee.useRef(!1),pe=ee.useRef(0),Te=ee.useRef(null),Ge=ee.useRef(((B=Te.current)==null?void 0:B.getBoundingClientRect().height)||0),Ne=ee.useRef(((U=Te.current)==null?void 0:U.getBoundingClientRect().width)||0),it=ee.useRef(0),qe=ee.useCallback(gt=>{a&&gt===ke.length-1&&(Z.current=new Date)},[]),{activeSnapPoint:Qe,activeSnapPointIndex:ot,setActiveSnapPoint:de,onRelease:me,snapPointsOffset:ke,onDrag:Be,shouldFade:Ae,getPercentageDragged:$e}=z4e({snapPoints:a,activeSnapPointProp:p,setActiveSnapPointProp:x,drawerRef:Te,fadeFromIndex:h,overlayRef:Y,onSnapPointChange:qe,direction:E,container:L,snapToSequentialPoint:P});T4e({isDisabled:!F||W||!b||oe||!z||!D||!T});const{restorePositionSetting:ge}=V4e({isOpen:F,modal:b,nested:_,hasBeenOpened:z,preventScrollRestoration:O,noBodyStyles:j});function Le(){return(window.innerWidth-gT)/window.innerWidth}function Ve(gt){var kn,Tn;!d&&!a||Te.current&&!Te.current.contains(gt.target)||(Ge.current=((kn=Te.current)==null?void 0:kn.getBoundingClientRect().height)||0,Ne.current=((Tn=Te.current)==null?void 0:Tn.getBoundingClientRect().width)||0,q(!0),G.current=new Date,ite()&&window.addEventListener("touchend",()=>le.current=!1,{once:!0}),gt.target.setPointerCapture(gt.pointerId),be.current=Ni(E)?gt.pageY:gt.pageX)}function ct(gt,kn){var Tn,Pt;let Jt=gt;const Gn=(Tn=window.getSelection())==null?void 0:Tn.toString(),Mr=Te.current?l_(Te.current,E):null,ht=new Date;if(Jt.hasAttribute("data-vaul-no-drag")||Jt.closest("[data-vaul-no-drag]"))return!1;if(E==="right"||E==="left")return!0;if(Z.current&&ht.getTime()-Z.current.getTime()<500)return!1;if(Mr!==null&&(E==="bottom"?Mr>0:Mr<0))return!0;if(Gn&&Gn.length>0)return!1;if(ht.getTime()-((Pt=ce.current)==null?void 0:Pt.getTime())<u&&Mr===0||kn)return ce.current=ht,!1;for(;Jt;){if(Jt.scrollHeight>Jt.clientHeight){if(Jt.scrollTop!==0)return ce.current=new Date,!1;if(Jt.getAttribute("role")==="dialog")return!0}Jt=Jt.parentNode}return!0}function yt(gt){if(Te.current&&W){const kn=E==="bottom"||E==="right"?1:-1,Tn=(be.current-(Ni(E)?gt.pageY:gt.pageX))*kn,Pt=Tn>0,Jt=a&&!d&&!Pt;if(Jt&&ot===0)return;const Gn=Math.abs(Tn),Mr=document.querySelector("[data-vaul-drawer-wrapper]"),ht=E==="bottom"||E==="top"?Ge.current:Ne.current;let rn=Gn/ht;const Mt=$e(Gn,Pt);if(Mt!==null&&(rn=Mt),Jt&&rn>=1||!le.current&&!ct(gt.target,Pt))return;if(Te.current.classList.add(LA),le.current=!0,_i(Te.current,{transition:"none"}),_i(Y.current,{transition:"none"}),a&&Be({draggedDistance:Tn}),Pt&&!a){const Lr=M4e(Tn),us=Math.min(Lr*-1,0)*kn;_i(Te.current,{transform:Ni(E)?`translate3d(0, ${us}px, 0)`:`translate3d(${us}px, 0, 0)`});return}const $n=1-rn;if((Ae||h&&ot===h-1)&&(r==null||r(gt,rn),_i(Y.current,{opacity:`${$n}`,transition:"none"},!0)),Mr&&Y.current&&o){const Lr=Math.min(Le()+rn*(1-Le()),1),us=8-rn*8,nl=Math.max(0,14-rn*14);_i(Mr,{borderRadius:`${us}px`,transform:Ni(E)?`scale(${Lr}) translate3d(0, ${nl}px, 0)`:`scale(${Lr}) translate3d(${nl}px, 0, 0)`,transition:"none"},!0)}if(!a){const Lr=Gn*kn;_i(Te.current,{transform:Ni(E)?`translate3d(0, ${Lr}px, 0)`:`translate3d(${Lr}px, 0, 0)`})}}}ee.useEffect(()=>{var gt;function kn(){if(!Te.current||!D)return;const Tn=document.activeElement;if(pT(Tn)||_e.current){var Pt;
1051const Jt=((Pt=window.visualViewport)==null?void 0:Pt.height)||0,Gn=window.innerHeight;let Mr=Gn-Jt;const ht=Te.current.getBoundingClientRect().height||0,rn=ht>Gn*.8;it.current||(it.current=ht);const Mt=Te.current.getBoundingClientRect().top;if(Math.abs(pe.current-Mr)>60&&(_e.current=!_e.current),a&&a.length>0&&ke&&ot){const $n=ke[ot]||0;Mr+=$n}if(pe.current=Mr,ht>Jt||_e.current){const $n=Te.current.getBoundingClientRect().height;let Lr=$n;$n>Jt&&(Lr=Jt-(rn?Mt:gT)),y?Te.current.style.height=`${$n-Math.max(Mr,0)}px`:Te.current.style.height=`${Math.max(Lr,Jt-Mt)}px`}else Te.current.style.height=`${it.current}px`;a&&a.length>0&&!_e.current?Te.current.style.bottom="0px":Te.current.style.bottom=`${Math.max(Mr,0)}px`}}return(gt=window.visualViewport)==null||gt.addEventListener("resize",kn),()=>{var Tn;return(Tn=window.visualViewport)==null?void 0:Tn.removeEventListener("resize",kn)}},[ot,a,ke]);function nn(gt){zt(),w==null||w(),gt||H(!1),setTimeout(()=>{a&&de(a[0])},bs.DURATION*1e3)}function Vn(){if(!Te.current)return;const gt=document.querySelector("[data-vaul-drawer-wrapper]"),kn=l_(Te.current,E);_i(Te.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${bs.DURATION}s cubic-bezier(${bs.EASE.join(",")})`}),_i(Y.current,{transition:`opacity ${bs.DURATION}s cubic-bezier(${bs.EASE.join(",")})`,opacity:"1"}),o&&kn&&kn>0&&F&&_i(gt,{borderRadius:`${ute}px`,overflow:"hidden",...Ni(E)?{transform:`scale(${Le()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${Le()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${bs.DURATION}s`,transitionTimingFunction:`cubic-bezier(${bs.EASE.join(",")})`},!0)}function zt(){!W||!Te.current||(Te.current.classList.remove(LA),le.current=!1,q(!1),se.current=new Date)}function He(gt){if(!W||!Te.current)return;Te.current.classList.remove(LA),le.current=!1,q(!1),se.current=new Date;const kn=l_(Te.current,E);
1051if(!ct(gt.target,!1)||!kn||Number.isNaN(kn)||G.current===null)return;const Tn=se.current.getTime()-G.current.getTime(),Pt=be.current-(Ni(E)?gt.pageY:gt.pageX),Jt=Math.abs(Pt)/Tn;if(Jt>.05&&(J(!0),setTimeout(()=>{J(!1)},200)),a){me({draggedDistance:Pt*(E==="bottom"||E==="right"?1:-1),closeDrawer:nn,velocity:Jt,dismissible:d}),i==null||i(gt,!0);return}if(E==="bottom"||E==="right"?Pt>0:Pt<0){Vn(),i==null||i(gt,!0);return}if(Jt>cte){nn(),i==null||i(gt,!1);return}var Gn;const Mr=Math.min((Gn=Te.current.getBoundingClientRect().height)!=null?Gn:0,window.innerHeight);var ht;const rn=Math.min((ht=Te.current.getBoundingClientRect().width)!=null?ht:0,window.innerWidth),Mt=E==="left"||E==="right";if(Math.abs(kn)>=(Mt?rn:Mr)*c){nn(),i==null||i(gt,!1);return}i==null||i(gt,!0),Vn()}ee.useEffect(()=>(F&&(_i(document.documentElement,{scrollBehavior:"auto"}),Z.current=new Date),()=>{R4e(document.documentElement,"scrollBehavior")}),[F]);function bn(gt){const kn=gt?(window.innerWidth-Ch)/window.innerWidth:1,Tn=gt?-Ch:0;fe.current&&window.clearTimeout(fe.current),_i(Te.current,{transition:`transform ${bs.DURATION}s cubic-bezier(${bs.EASE.join(",")})`,transform:`scale(${kn}) translate3d(0, ${Tn}px, 0)`}),!gt&&Te.current&&(fe.current=setTimeout(()=>{const Pt=l_(Te.current,E);_i(Te.current,{transition:"none",transform:Ni(E)?`translate3d(0, ${Pt}px, 0)`:`translate3d(${Pt}px, 0, 0)`})},500))}function Rt(gt,kn){if(kn<0)return;const Tn=(window.innerWidth-Ch)/window.innerWidth,Pt=Tn+kn*(1-Tn),Jt=-Ch+kn*Ch;_i(Te.current,{transform:Ni(E)?`scale(${Pt}) translate3d(0, ${Jt}px, 0)`:`scale(${Pt}) translate3d(${Jt}px, 0, 0)`,transition:"none"})}function An(gt,kn){const Tn=Ni(E)?window.innerHeight:window.innerWidth,Pt=kn?(Tn-Ch)/Tn:1,Jt=kn?-Ch:0;kn&&_i(Te.current,{transition:`transform ${bs.DURATION}s cubic-bezier(${bs.EASE.join(",")})`,transform:Ni(E)?`scale(${Pt}) translate3d(0, ${Jt}px, 0)`:`scale(${Pt}) translate3d(${Jt}px, 0, 0)`})}return ee.createElement(Lb,{defaultOpen:S,onOpenChange:gt=>{!d&&!gt||(gt?K(!0):nn(!0),H(gt))},open:F},ee.createElement(ste.Provider,{value:{activeSnapPoint:Qe,snapPoints:a,setActiveSnapPoint:de,drawerRef:Te,overlayRef:Y,onOpenChange:t,onPress:Ve,onRelease:He,onDrag:yt,dismissible:d,handleOnly:f,isOpen:F,isDragging:W,shouldFade:Ae,closeDrawer:nn,onNestedDrag:Rt,onNestedOpenChange:bn,onNestedRelease:An,keyboardIsOpen:_e,modal:b,snapPointsOffset:ke,direction:E,shouldScaleBackground:o,setBackgroundColorOnScale:l,noBodyStyles:j,container:L,autoFocus:M}},n))}const hte=ee.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:r,onRelease:i,shouldFade:a,isOpen:o,modal:l}=Kb(),c=ote(t,n),u=r&&r.length>0;return l?ee.createElement(pp,{onMouseUp:i,ref:c,"data-vaul-overlay":"","data-vaul-snap-points":o&&u?"true":"false","data-vaul-snap-points-overlay":o&&a?"true":"false",...e}):(typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),null)});hte.displayName="Drawer.Overlay";const mte=ee.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},i){const{drawerRef:a,onPress:o,onRelease:l,onDrag:c,keyboardIsOpen:u,snapPointsOffset:d,modal:f,isOpen:h,direction:p,snapPoints:x,container:y,handleOnly:b,autoFocus:w}=Kb(),[_,j]=ee.useState(!1),E=ote(i,a),S=ee.useRef(null),T=ee.useRef(null),P=ee.useRef(!1),O=x&&x.length>0;q4e();const D=(L,M,B=0)=>{if(P.current)return!0;const U=Math.abs(L.y),F=Math.abs(L.x),H=F>U,z=["bottom","right"].includes(M)?1:-1;if(M==="left"||M==="right"){if(!(L.x*z<0)&&F>=0&&F<=B)return H}else if(!(L.y*z<0)&&U>=0&&U<=B)return!H;return P.current=!0,!0};ee.useEffect(()=>{O&&window.requestAnimationFrame(()=>{j(!0)})},[]);function R(L){S.current=null,P.current=!1,l(L)}return ee.createElement(gp,{"data-vaul-drawer-direction":p,"data-vaul-drawer":"","data-vaul-delayed-snap-points":_?"true":"false","data-vaul-snap-points":h&&O?"true":"false","data-vaul-custom-container":y?"true":"false",...r,ref:E,style:d&&d.length>0?{"--snap-point-height":`${d[0]}px`,...t}:t,onPointerDown:L=>{b||(r.onPointerDown==null||r.onPointerDown.call(r,L),S.current={x:L.pageX,y:L.pageY},o(L))},onOpenAutoFocus:L=>{n==null||n(L),w||L.preventDefault()},onPointerDownOutside:L=>{if(e==null||e(L),!f||L.defaultPrevented){L.preventDefault();return}u.current&&(u.current=!1)},onFocusOutside:L=>{if(!f){L.preventDefault();return}},onPointerMove:L=>{if(T.current=L,b||(r.onPointerMove==null||r.onPointerMove.call(r,L),!S.current))return;const M=L.pageY-S.current.y,B=L.pageX-S.current.x,U=L.pointerType==="touch"?10:2;D({x:B,y:M},p,U)?c(L):(Math.abs(B)>U||Math.abs(M)>U)&&(S.current=null)},onPointerUp:L=>{r.onPointerUp==null||r.onPointerUp.call(r,L),S.current=null,P.current=!1,l(L)},onPointerOut:L=>{r.onPointerOut==null||r.onPointerOut.call(r,L),R(T.current)},onContextMenu:L=>{r.onContextMenu==null||r.onContextMenu.call(r,L),R(T.current)}})});mte.displayName="Drawer.Content";const W4e=250,G4e=120,K4e=ee.forwardRef(function({preventCycle:e=!1,children:t,...n},r){const{closeDrawer:i,isDragging:a,snapPoints:o,activeSnapPoint:l,setActiveSnapPoint:c,dismissible:u,handleOnly:d,isOpen:f,onPress:h,onDrag:p}=Kb(),x=ee.useRef(null),y=ee.useRef(!1);function b(){if(y.current){j();return}window.setTimeout(()=>{w()},G4e)}function w(){if(a||e||y.current){j();return}if(j(),(!o||o.length===0)&&u){i();return}if(l===o[o.length-1]&&u){i();return}const S=o.findIndex(P=>P===l);if(S===-1)return;const T=o[S+1];c(T)}function _(){x.current=window.setTimeout(()=>{y.current=!0},W4e)}function j(){window.clearTimeout(x.current),y.current=!1}return ee.createElement("div",{onClick:b,onPointerCancel:j,onPointerDown:E=>{d&&h(E),_()},onPointerMove:E=>{d&&p(E)},ref:r,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},ee.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});K4e.displayName="Drawer.Handle";function Y4e(e){const t=Kb(),{container:n=t.container,...r}=e;return ee.createElement(Fb,{container:n,...r})}const pu={Root:H4e,Content:mte,Overlay:hte,Portal:Y4e,Close:T0,Title:S0,Description:A0}
1051,bd=({shouldScaleBackground:e=!0,...t})=>s.jsx(pu.Root,{shouldScaleBackground:e,...t});bd.displayName="Drawer";const X4e=pu.Portal,pte=pu.Close,gte=N.forwardRef(({className:e,...t},n)=>s.jsx(pu.Overlay,{ref:n,className:ae("fixed inset-0 z-50 bg-black/80",e),...t}));gte.displayName=pu.Overlay.displayName;const wd=N.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(X4e,{children:[s.jsx(gte,{}),s.jsxs(pu.Content,{ref:r,className:ae("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",e),...n,children:[s.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),t]})]}));wd.displayName="DrawerContent";const sh=({className:e,...t})=>s.jsx("div",{className:ae("grid gap-1.5 p-4 text-center sm:text-left",e),...t});sh.displayName="DrawerHeader";const DR=({className:e,...t})=>s.jsx("div",{className:ae("mt-auto flex flex-col gap-2 p-4",e),...t});DR.displayName="DrawerFooter";const _d=N.forwardRef(({className:e,...t},n)=>s.jsx(pu.Title,{ref:n,className:ae("text-lg font-semibold leading-none tracking-tight",e),...t}));_d.displayName=pu.Title.displayName;const Yb=N.forwardRef(({className:e,...t},n)=>s.jsx(pu.Description,{ref:n,className:ae("text-sm text-muted-foreground",e),...t}));Yb.displayName=pu.Description.displayName;var er;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const a={};for(const o of i)a[o]=o;return a},e.getValidEnumValues=i=>{const a=e.objectKeys(i).filter(l=>typeof i[i[l]]!="number"),o={};for(const l of a)o[l]=i[l];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(a){return i[a]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},e.find=(i,a)=>{for(const o of i)if(a(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}e.joinValues=r,e.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(er||(er={}));var s7;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(s7||(s7={}));const St=er.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Xd=e=>{switch(typeof e){case"undefined":return St.undefined;case"string":return St.string;case"number":return Number.isNaN(e)?St.nan:St.number;case"boolean":return St.boolean;case"function":return St.function;case"bigint":return St.bigint;case"symbol":return St.symbol;case"object":return Array.isArray(e)?St.array:e===null?St.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?St.promise:typeof Map<"u"&&e instanceof Map?St.map:typeof Set<"u"&&e instanceof Set?St.set:typeof Date<"u"&&e instanceof Date?St.date:St.object;default:return St.unknown}}
vendor: 4,379 bytes, line 1051
1051,at=er.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Xo extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(a){return a.message},r={_errors:[]},i=a=>{for(const o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let l=r,c=0;for(;c<o.path.length;){const u=o.path[c];c===o.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(n(o))):l[u]=l[u]||{_errors:[]},l=l[u],c++}}};return i(this),r}static assert(t){if(!(t instanceof Xo))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,er.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const a=i.path[0];n[a]=n[a]||[],n[a].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Xo.create=e=>new Xo(e);const xT=(e,t)=>{let n;switch(e.code){case at.invalid_type:e.received===St.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case at.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,er.jsonStringifyReplacer)}`;break;case at.unrecognized_keys:n=`Unrecognized key(s) in object: ${er.joinValues(e.keys,", ")}`;break;case at.invalid_union:n="Invalid input";break;case at.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${er.joinValues(e.options)}`;break;case at.invalid_enum_value:n=`Invalid enum value. Expected ${er.joinValues(e.options)}, received '${e.received}'`;break;case at.invalid_arguments:n="Invalid function arguments";break;case at.invalid_return_type:n="Invalid function return type";break;case at.invalid_date:n="Invalid date";break;case at.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:er.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case at.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case at.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case at.custom:n="Invalid input";break;
vendor: 5,283 bytes, line 1051
1051case at.invalid_intersection_types:n="Intersection results could not be merged";break;case at.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case at.not_finite:n="Number must be finite";break;default:n=t.defaultError,er.assertNever(e)}return{message:n}};let Q4e=xT;function J4e(){return Q4e}const Z4e=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let l="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)l=u(o,{data:t,defaultError:l}).message;return{...i,path:a,message:l}};function xt(e,t){const n=J4e(),r=Z4e({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===xT?void 0:xT].filter(i=>!!i)});e.common.issues.push(r)}class Qo{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return cn;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const a=await i.key,o=await i.value;r.push({key:a,value:o})}return Qo.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return cn;a.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[a.value]=o.value)}return{status:t.value,value:r}}}const cn=Object.freeze({status:"aborted"}),sv=e=>({status:"dirty",value:e}),Fl=e=>({status:"valid",value:e}),i7=e=>e.status==="aborted",a7=e=>e.status==="dirty",Ax=e=>e.status==="valid",k2=e=>typeof Promise<"u"&&e instanceof Promise;var Ot;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ot||(Ot={}));class $f{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const o7=(e,t)=>{if(Ax(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Xo(e.common.issues);return this._error=n,this._error}}};function En(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,l)=>{const{message:c}=e;return o.code==="invalid_enum_value"?{message:c??l.defaultError}:typeof l.data>"u"?{message:c??r??l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:c??n??l.defaultError}},description:i}}class Zn{get description(){return this._def.description}_getType(t){return Xd(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Xd(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Qo,ctx:{common:t.parent.common,data:t.data,parsedType:Xd(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(k2(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Xd(t)},i=this._parseSync({data:t,path:r.path,parent:r});return o7(r,i)}"~validate"(t){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Xd(t)};if(!this["~standard"].async)try{const a=this._parseSync({data:t,path:[],parent:n});return Ax(a)?{value:a.value}:{issues:n.common.issues}}catch(a){(i=(r=a==null?void 0:a.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(a=>Ax(a)?{value:a.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Xd(t)},i=this._parse({data:t,path:r.path,parent:r}),a=await(k2(i)?i:Promise.resolve(i));return o7(r,a)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,a)=>{const o=t(i),l=()=>a.addIssue({code:at.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(t,n){return this._refinement((r,i)=>
vendor: 5,984 bytes, line 1051
1051t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Ox({schema:this,typeName:un.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Sf.create(this,this._def)}nullable(){return Dx.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return su.create(this)}promise(){return A2.create(this,this._def)}or(t){return E2.create([this,t],this._def)}and(t){return S2.create(this,t,this._def)}transform(t){return new Ox({...En(this._def),schema:this,typeName:un.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new wT({...En(this._def),innerType:this,defaultValue:n,typeName:un.ZodDefault})}brand(){return new _3e({typeName:un.ZodBranded,type:this,...En(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new _T({...En(this._def),innerType:this,catchValue:n,typeName:un.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return IR.create(this,t)}readonly(){return jT.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const e3e=/^c[^\s-]{8,}$/i,t3e=/^[0-9a-z]+$/,n3e=/^[0-9A-HJKMNP-TV-Z]{26}$/i,r3e=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,s3e=/^[a-z0-9_-]{21}$/i,i3e=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,a3e=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,o3e=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,l3e="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let FA;const c3e=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,u3e=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,d3e=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,f3e=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,h3e=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,m3e=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xte="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",p3e=new RegExp(`^${xte}$`);function yte(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function g3e(e){return new RegExp(`^${yte(e)}$`)}function x3e(e){let t=`${xte}T${yte(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function y3e(e,t){return!!((t==="v4"||!t)&&c3e.test(e)||(t==="v6"||!t)&&d3e.test(e))}function v3e(e,t){if(!i3e.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function b3e(e,t){return!!((t==="v4"||!t)&&u3e.test(e)||(t==="v6"||!t)&&f3e.test(e))}class $u extends Zn{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==St.string){const a=this._getOrReturnCtx(t);
vendor: 17,372 bytes, line 1051
1051return xt(a,{code:at.invalid_type,expected:St.string,received:a.parsedType}),cn}const r=new Qo;let i;for(const a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(i=this._getOrReturnCtx(t,i),xt(i,{code:at.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")t.data.length>a.value&&(i=this._getOrReturnCtx(t,i),xt(i,{code:at.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const o=t.data.length>a.value,l=t.data.length<a.value;(o||l)&&(i=this._getOrReturnCtx(t,i),o?xt(i,{code:at.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):l&&xt(i,{code:at.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")o3e.test(t.data)||(i=this._getOrReturnCtx(t,i),xt(i,{validation:"email",code:at.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")FA||(FA=new RegExp(l3e,"u")),FA.test(t.data)||(i=this._getOrReturnCtx(t,i),xt(i,{validation:"emoji",code:at.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")r3e.test(t.data)||(i=this._getOrReturnCtx(t,i),xt(i,{validation:"uuid",code:at.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")s3e.test(t.data)||(i=this._getOrReturnCtx(t,i),xt(i,{validation:"nanoid",code:at.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")e3e.test(t.data)||(i=this._getOrReturnCtx(t,i),xt(i,{validation:"cuid",code:at.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")t3e.test(t.data)||(i=this._getOrReturnCtx(t,i),xt(i,{validation:"cuid2",code:at.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")n3e.test(t.data)||(i=this._getOrReturnCtx(t,i),xt(i,{validation:"ulid",code:at.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),xt(i,{validation:"url",code:at.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),xt(i,{validation:"regex",code:at.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(t,i),xt(i,{code:at.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(i=this._getOrReturnCtx(t,i),xt(i,{code:at.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(i=this._getOrReturnCtx(t,i),xt(i,{code:at.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?x3e(a).test(t.data)||(i=this._getOrReturnCtx(t,i),xt(i,{code:at.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?p3e.test(t.data)||(i=this._getOrReturnCtx(t,i),xt(i,{code:at.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?g3e(a).test(t.data)||(i=this._getOrReturnCtx(t,i),xt(i,{code:at.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?a3e.test(t.data)||(i=this._getOrReturnCtx(t,i),xt(i,{validation:"duration",code:at.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?y3e(t.data,a.version)||(i=this._getOrReturnCtx(t,i),xt(i,{validation:"ip",code:at.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?v3e(t.data,a.alg)||(i=this._getOrReturnCtx(t,i),xt(i,{validation:"jwt",code:at.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?b3e(t.data,a.version)||(i=this._getOrReturnCtx(t,i),xt(i,{validation:"cidr",code:at.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?h3e.test(t.data)||(i=this._getOrReturnCtx(t,i),xt(i,{validation:"base64",code:at.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?m3e.test(t.data)||(i=this._getOrReturnCtx(t,i),xt(i,{validation:"base64url",code:at.invalid_string,message:a.message}),r.dirty()):er.assertNever(a);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:at.invalid_string,...Ot.errToObj(r)})}_addCheck(t){return new $u({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ot.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ot.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ot.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ot.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Ot.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ot.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ot.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ot.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Ot.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Ot.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Ot.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ot.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Ot.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...Ot.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Ot.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Ot.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Ot.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Ot.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Ot.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Ot.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Ot.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Ot.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Ot.errToObj(n)})}nonempty(t){return this.min(1,Ot.errToObj(t))}trim(){return new $u({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new $u({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new $u({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}$u.create=e=>new $u({checks:[],typeName:un.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...En(e)});function w3e(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,a=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return a%o/10**i}class Gm extends Zn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==St.number){const a=this._getOrReturnCtx(t);return xt(a,{code:at.invalid_type,expected:St.number,received:a.parsedType}),cn}let r;const i=new Qo;for(const a of this._def.checks)a.kind==="int"?er.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),xt(r,{code:at.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(r=this._getOrReturnCtx(t,r),xt(r,{code:at.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(r=this._getOrReturnCtx(t,r),xt(r,{code:at.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?w3e(t.data,a.value)!==0&&(r=this._getOrReturnCtx(t,r),xt(r,{code:at.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),xt(r,{code:at.not_finite,message:a.message}),i.dirty()):er.assertNever(a);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ot.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ot.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ot.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ot.toString(n))}setLimit(t,n,r,i){return new Gm({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ot.toString(i)}]})}_addCheck(t){return new Gm({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ot.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ot.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ot.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ot.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ot.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ot.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Ot.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ot.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ot.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&er.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Gm.create=e=>new Gm({checks:[],typeName:un.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...En(e)});class Km extends Zn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==St.bigint)return this._getInvalidInput(t);let r;const i=new Qo;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(r=this._getOrReturnCtx(t,r),xt(r,{code:at.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(r=this._getOrReturnCtx(t,r),xt(r,{code:at.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),xt(r,{code:at.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):er.assertNever(a);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return xt(n,{code:at.invalid_type,expected:St.bigint,received:n.parsedType}),cn}gte(t,n){return this.setLimit("min",t,!0,Ot.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ot.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ot.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ot.toString(n))}setLimit(t,n,r,i){return new Km({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ot.toString(i)}]})}_addCheck(t){return new Km({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ot.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ot.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ot.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ot.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ot.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Km.create=e=>new Km({checks:[],typeName:un.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...En(e)});class C2 extends Zn{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==St.boolean){const r=this._getOrReturnCtx(t);return xt(r,{code:at.invalid_type,expected:St.boolean,received:r.parsedType}),cn}return Fl(t.data)}}C2.create=e=>new C2({typeName:un.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...En(e)});class Tx extends Zn{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==St.date){const a=this._getOrReturnCtx(t);return xt(a,{code:at.invalid_type,expected:St.date,received:a.parsedType}),cn}if(Number.isNaN(t.data.getTime())){const a=this._getOrReturnCtx(t);return xt(a,{code:at.invalid_date}),cn}const r=new Qo;let i;for(const a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(i=this._getOrReturnCtx(t,i),xt(i,{code:at.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(i=this._getOrReturnCtx(t,i),xt(i,{code:at.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):er.assertNever(a);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Tx({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Ot.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Ot.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Tx.create=e=>new Tx({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:un.ZodDate,...En(e)});class l7 extends Zn{_parse(t){if(this._getType(t)!==St.symbol){const r=this._getOrReturnCtx(t);return xt(r,{code:at.invalid_type,expected:St.symbol,received:r.parsedType}),cn}return Fl(t.data)}}l7.create=e=>new l7({typeName:un.ZodSymbol,...En(e)});class c7 extends Zn{_parse(t){if(this._getType(t)!==St.undefined){const r=this._getOrReturnCtx(t);return xt(r,{code:at.invalid_type,expected:St.undefined,received:r.parsedType}),cn}return Fl(t.data)}}c7.create=e=>new c7({typeName:un.ZodUndefined,...En(e)});class yT extends Zn{_parse(t){if(this._getType(t)!==St.null){const r=this._getOrReturnCtx(t);return xt(r,{code:at.invalid_type,expected:St.null,received:r.parsedType}),cn}return Fl(t.data)}}yT.create=e=>new yT({typeName:un.ZodNull,...En(e)});class u7 extends Zn{constructor(){super(...arguments),this._any=!0}_parse(t){return Fl(t.data)}}u7.create=e=>new u7({typeName:un.ZodAny,...En(e)});class d7 extends Zn{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Fl(t.data)}}d7.create=e=>new d7({typeName:un.ZodUnknown,...En(e)});class Bf extends Zn{_parse(t){const n=this._getOrReturnCtx(t);return xt(n,{code:at.invalid_type,expected:St.never,received:n.parsedType}),cn}}Bf.create=e=>new Bf({typeName:un.ZodNever,...En(e)});class f7 extends Zn{_parse(t){if(this._getType(t)!==St.undefined){const r=this._getOrReturnCtx(t);return xt(r,{code:at.invalid_type,expected:St.void,received:r.parsedType}),cn}return Fl(t.data)}}f7.create=e=>new f7({typeName:un.ZodVoid,...En(e)});class su extends Zn{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;
vendor: 4,852 bytes, line 1051
1051if(n.parsedType!==St.array)return xt(n,{code:at.invalid_type,expected:St.array,received:n.parsedType}),cn;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,l=n.data.length<i.exactLength.value;(o||l)&&(xt(n,{code:o?at.too_big:at.too_small,minimum:l?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(xt(n,{code:at.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(xt(n,{code:at.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>i.type._parseAsync(new $f(n,o,n.path,l)))).then(o=>Qo.mergeArray(r,o));const a=[...n.data].map((o,l)=>i.type._parseSync(new $f(n,o,n.path,l)));return Qo.mergeArray(r,a)}get element(){return this._def.type}min(t,n){return new su({...this._def,minLength:{value:t,message:Ot.toString(n)}})}max(t,n){return new su({...this._def,maxLength:{value:t,message:Ot.toString(n)}})}length(t,n){return new su({...this._def,exactLength:{value:t,message:Ot.toString(n)}})}nonempty(t){return this.min(1,t)}}su.create=(e,t)=>new su({type:e,minLength:null,maxLength:null,exactLength:null,typeName:un.ZodArray,...En(t)});function rg(e){if(e instanceof ri){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Sf.create(rg(r))}return new ri({...e._def,shape:()=>t})}else return e instanceof su?new su({...e._def,type:rg(e.element)}):e instanceof Sf?Sf.create(rg(e.unwrap())):e instanceof Dx?Dx.create(rg(e.unwrap())):e instanceof Ym?Ym.create(e.items.map(t=>rg(t))):e}class ri extends Zn{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=er.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==St.object){const u=this._getOrReturnCtx(t);return xt(u,{code:at.invalid_type,expected:St.object,received:u.parsedType}),cn}const{status:r,ctx:i}=this._processInputParams(t),{shape:a,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof Bf&&this._def.unknownKeys==="strip"))for(const u in i.data)o.includes(u)||l.push(u);const c=[];for(const u of o){const d=a[u],f=i.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new $f(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Bf){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(u==="strict")l.length>0&&(xt(i,{code:at.unrecognized_keys,keys:l}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of l){const f=i.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new $f(i,f,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>Qo.mergeObjectSync(r,u)):Qo.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return Ot.errToObj,new ri({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var a,o;const i=((o=(a=this._def).errorMap)==null?void 0:o.call(a,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:Ot.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new ri({...this._def,unknownKeys:"strip"})}passthrough(){return new ri({...this._def,unknownKeys:"passthrough"})}extend(t){return new ri({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new ri({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:un.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new ri({...this._def,catchall:t})}pick(t){const n={};for(const r of er.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new ri({...this._def,shape:()=>n})}omit(t){const n={};for(const r of er.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new ri({...this._def,shape:()=>n})}deepPartial(){return rg(this)}partial(t){const n={};for(const r of er.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new ri({...this._def,shape:()=>n})}required(t){const n={};for(const r of er.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof Sf;)a=a._def.innerType;n[r]=a}return new ri({...this._def,shape:()=>n})}keyof(){return vte(er.objectKeys(this.shape))}}ri.create=(e,t)=>
vendor: 3,987 bytes, line 1051
1051new ri({shape:()=>e,unknownKeys:"strip",catchall:Bf.create(),typeName:un.ZodObject,...En(t)});ri.strictCreate=(e,t)=>new ri({shape:()=>e,unknownKeys:"strict",catchall:Bf.create(),typeName:un.ZodObject,...En(t)});ri.lazycreate=(e,t)=>new ri({shape:e,unknownKeys:"strip",catchall:Bf.create(),typeName:un.ZodObject,...En(t)});class E2 extends Zn{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(a){for(const l of a)if(l.result.status==="valid")return l.result;for(const l of a)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=a.map(l=>new Xo(l.ctx.common.issues));return xt(n,{code:at.invalid_union,unionErrors:o}),cn}if(n.common.async)return Promise.all(r.map(async a=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let a;const o=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const l=o.map(c=>new Xo(c));return xt(n,{code:at.invalid_union,unionErrors:l}),cn}}get options(){return this._def.options}}E2.create=(e,t)=>new E2({options:e,typeName:un.ZodUnion,...En(t)});function vT(e,t){const n=Xd(e),r=Xd(t);if(e===t)return{valid:!0,data:e};if(n===St.object&&r===St.object){const i=er.objectKeys(t),a=er.objectKeys(e).filter(l=>i.indexOf(l)!==-1),o={...e,...t};for(const l of a){const c=vT(e[l],t[l]);if(!c.valid)return{valid:!1};o[l]=c.data}return{valid:!0,data:o}}else if(n===St.array&&r===St.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let a=0;a<e.length;a++){const o=e[a],l=t[a],c=vT(o,l);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return n===St.date&&r===St.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class S2 extends Zn{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(a,o)=>{if(i7(a)||i7(o))return cn;const l=vT(a.value,o.value);return l.valid?((a7(a)||a7(o))&&n.dirty(),{status:n.value,value:l.data}):(xt(r,{code:at.invalid_intersection_types}),cn)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}S2.create=(e,t,n)=>new S2({left:e,right:t,typeName:un.ZodIntersection,...En(n)});class Ym extends Zn{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==St.array)return xt(r,{code:at.invalid_type,expected:St.array,received:r.parsedType}),cn;if(r.data.length<this._def.items.length)return xt(r,{code:at.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),cn;!this._def.rest&&r.data.length>this._def.items.length&&(xt(r,{code:at.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const a=[...r.data].map((o,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new $f(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(a).then(o=>Qo.mergeArray(n,o)):Qo.mergeArray(n,a)}get items(){return this._def.items}rest(t){return new Ym({...this._def,rest:t})}}Ym.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ym({items:e,typeName:un.ZodTuple,rest:null,...En(t)})};class h7 extends Zn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==St.map)return xt(r,{code:at.invalid_type,expected:St.map,received:r.parsedType}),cn;const i=this._def.keyType,a=this._def.valueType,o=[...r.data.entries()].map(([l,c],u)=>
vendor: 4,126 bytes, line 1051
1051({key:i._parse(new $f(r,l,r.path,[u,"key"])),value:a._parse(new $f(r,c,r.path,[u,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return cn;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const c of o){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return cn;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}}}}h7.create=(e,t,n)=>new h7({valueType:t,keyType:e,typeName:un.ZodMap,...En(n)});class N1 extends Zn{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==St.set)return xt(r,{code:at.invalid_type,expected:St.set,received:r.parsedType}),cn;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(xt(r,{code:at.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(xt(r,{code:at.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const a=this._def.valueType;function o(c){const u=new Set;for(const d of c){if(d.status==="aborted")return cn;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const l=[...r.data.values()].map((c,u)=>a._parse(new $f(r,c,r.path,u)));return r.common.async?Promise.all(l).then(c=>o(c)):o(l)}min(t,n){return new N1({...this._def,minSize:{value:t,message:Ot.toString(n)}})}max(t,n){return new N1({...this._def,maxSize:{value:t,message:Ot.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}N1.create=(e,t)=>new N1({valueType:e,minSize:null,maxSize:null,typeName:un.ZodSet,...En(t)});class m7 extends Zn{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}m7.create=(e,t)=>new m7({getter:e,typeName:un.ZodLazy,...En(t)});class bT extends Zn{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return xt(n,{received:n.data,code:at.invalid_literal,expected:this._def.value}),cn}return{status:"valid",value:t.data}}get value(){return this._def.value}}bT.create=(e,t)=>new bT({value:e,typeName:un.ZodLiteral,...En(t)});function vte(e,t){return new Px({values:e,typeName:un.ZodEnum,...En(t)})}class Px extends Zn{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return xt(n,{expected:er.joinValues(r),received:n.parsedType,code:at.invalid_type}),cn}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return xt(n,{received:n.data,code:at.invalid_enum_value,options:r}),cn}return Fl(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Px.create(t,{...this._def,...n})}exclude(t,n=this._def){return Px.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Px.create=vte;class p7 extends Zn{_parse(t){const n=er.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==St.string&&r.parsedType!==St.number){const i=er.objectValues(n);return xt(r,{expected:er.joinValues(i),received:r.parsedType,code:at.invalid_type}),cn}if(this._cache||(this._cache=new Set(er.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=er.objectValues(n);return xt(r,{received:r.data,code:at.invalid_enum_value,options:i}),cn}return Fl(t.data)}get enum(){return this._def.values}}p7.create=(e,t)=>new p7({values:e,typeName:un.ZodNativeEnum,...En(t)});class A2 extends Zn{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==St.promise&&n.common.async===!1)return xt(n,{code:at.invali
vendor: 4,075 bytes, line 1051
1051d_type,expected:St.promise,received:n.parsedType}),cn;const r=n.parsedType===St.promise?n.data:Promise.resolve(n.data);return Fl(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}A2.create=(e,t)=>new A2({type:e,typeName:un.ZodPromise,...En(t)});class Ox extends Zn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===un.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,a={addIssue:o=>{xt(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){const o=i.transform(r.data,a);if(r.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return cn;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?cn:c.status==="dirty"||n.value==="dirty"?sv(c.value):c});{if(n.value==="aborted")return cn;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?cn:l.status==="dirty"||n.value==="dirty"?sv(l.value):l}}if(i.type==="refinement"){const o=l=>{const c=i.refinement(l,a);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?cn:(l.status==="dirty"&&n.dirty(),o(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?cn:(l.status==="dirty"&&n.dirty(),o(l.value).then(()=>({status:n.value,value:l.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ax(o))return cn;const l=i.transform(o.value,a);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Ax(o)?Promise.resolve(i.transform(o.value,a)).then(l=>({status:n.value,value:l})):cn);er.assertNever(i)}}Ox.create=(e,t,n)=>new Ox({schema:e,typeName:un.ZodEffects,effect:t,...En(n)});Ox.createWithPreprocess=(e,t,n)=>new Ox({schema:t,effect:{type:"preprocess",transform:e},typeName:un.ZodEffects,...En(n)});class Sf extends Zn{_parse(t){return this._getType(t)===St.undefined?Fl(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Sf.create=(e,t)=>new Sf({innerType:e,typeName:un.ZodOptional,...En(t)});class Dx extends Zn{_parse(t){return this._getType(t)===St.null?Fl(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Dx.create=(e,t)=>new Dx({innerType:e,typeName:un.ZodNullable,...En(t)});class wT extends Zn{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===St.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}wT.create=(e,t)=>new wT({innerType:e,typeName:un.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...En(t)});class _T extends Zn{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return k2(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Xo(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Xo(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}_T.create=(e,t)=>new _T({innerType:e,typeName:un.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...En(t)});class g7 extends Zn{_parse(t){if(this._getType(t)!==St.nan){const r=this._getOrReturnCtx(t);
1051return xt(r,{code:at.invalid_type,expected:St.nan,received:r.parsedType}),cn}return{status:"valid",value:t.data}}}g7.create=e=>new g7({typeName:un.ZodNaN,...En(e)});class _3e extends Zn{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class IR extends Zn{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?cn:a.status==="dirty"?(n.dirty(),sv(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?cn:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new IR({in:t,out:n,typeName:un.ZodPipeline})}}class jT extends Zn{_parse(t){const n=this._def.innerType._parse(t),r=i=>(Ax(i)&&(i.value=Object.freeze(i.value)),i);return k2(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}jT.create=(e,t)=>new jT({innerType:e,typeName:un.ZodReadonly,...En(t)});var un;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(un||(un={}));const Ct=$u.create,Io=Gm.create;Km.create;const bj=C2.create;Tx.create;const j3e=yT.create;Bf.create;const x7=su.create,da=ri.create,N3e=E2.create;S2.create;Ym.create;const xl=bT.create,tf=Px.create;A2.create;Sf.create;Dx.create;const RR={string:e=>$u.create({...e,coerce:!0}),number:e=>Gm.create({...e,coerce:!0}),boolean:e=>C2.create({...e,coerce:!0}),bigint:e=>Km.create({...e,coerce:!0}),date:e=>Tx.create({...e,coerce:!0})},k3e=da({email:Ct().trim().min(1,"L'email est requis").email("Adresse email invalide").max(255,"L'email ne doit pas dépasser 255 caractères")}),C3e=({open:e,onOpenChange:t,initialEmail:n,onEmailChange:r})=>{const[i,a]=N.useState(n??""),[o,l]=N.useState("idle"),[c,u]=N.useState(null),[d,f]=N.useState(null),[h,p]=N.useState(!1);N.useEffect(()=>{e&&n&&!i&&a(n)},[e]);const x=async w=>{var _;w.preventDefault(),f(null),u(null);try{k3e.parse({email:i})}catch(j){if(j instanceof Xo){f(((_=j.errors[0])==null?void 0:_.message)||"Email invalide");return}}l("loading");try{const j=await re.functions.invoke("request-password-reset",{body:{email:i.trim()}});if(j.error){console.error("Password reset request error:",j.error),l("success"),p(!0),setTimeout(()=>p(!1),6e4);return}l("success"),p(!0),setTimeout(()=>p(!1),6e4)}catch(j){console.error("Unexpected error:",j),u("Une erreur inattendue s'est produite. Veuillez réessayer."),l("error")}},y=()=>{r==null||r(i.trim()),t(!1),setTimeout(()=>{a(""),l("idle"),u(null),f(null)},300)},b=w=>{w||r==null||r(i.trim()),t(w)};return s.jsx(bd,{open:e,onOpenChange:b,children:s.jsx(wd,{className:"bg-card/95 backdrop-blur-xl border-primary/20",children:s.jsxs("div",{className:"mx-auto w-full max-w-md px-6 pb-8",children:[s.jsxs(sh,{className:"text-center px-0",children:[s.jsx(_d,{className:"font-display text-xl",children:o==="success"?"Email envoyé !":"Mot de passe oublié ?"}),s.jsx(Yb,{className:"text-muted-foreground",children:o==="success"?"Vérifiez votre boîte de réception":"Entrez votre email pour recevoir un lien de réinitialisation"})]}),o==="success"?s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx("div",{className:"w-16 h-16 rounded-full bg-success/10 flex items-center justify-center animate-pulse",children:s.jsx(Cn,{className:"w-8 h-8 text-success"})})}),s.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["Si un compte existe avec l'adresse ",s.jsx("strong",{className:"text-foreground",children:i}),", vous recevrez un email avec les instructions pour réinitialiser votre mot de passe."]}),s.jsxs("div",{className:"p-3 bg-primary/5 border border-primary/10 rounded-lg space-y-1",children:[s.jsxs("p",{className:"text-center text-xs text-muted-foreground",children:["💡 Le lien expire dans ",s.jsx("strong",{className:"text-primary",children:"1 heure"}),". Pensez à vérifier vos spams."]}),s.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"Si rien n'arrive sous 5 min, vous pourrez recommencer."})]}),s.jsxs(Q,{onClick:y,className:"w-full",variant:"outline",children:[s.jsx(Fn,{className:"w-4 h-4 mr-2"}),"Retour à la connexion"]})]}):s.jsxs("form",{onSubmit:x,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"forgot-email",children:"Adresse email"}),s.jsxs("div",{className:"relative",children:[s.jsx(wr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{id:"forgot-email",type:"email",placeholder:"[email protected]",value:i,onChange:w=>a(w.target.value),className:"pl-10",autoComplete:"email",autoFocus:!0,required:!0,disabled:o==="loading"})]}),d&&s.jsx("p",{className:"text-sm text-destructive",children:d})]}),c&&s.jsxs("div",{className:"p-3 bg-destructive/10 border border-destructive/20 rounded-lg text-destructive text-sm flex items-start gap-2",children:[s.jsx(ur,{className:"w-4 h-4 mt-0.5 shrink-0"}),s.jsx("span",{children:c})]}),s.jsx(Q,{type:"submit",className:"w-full",disabled:o==="loading"||h,children:o==="loading"?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 animate-spin mr-2"}),"Envoi en cours..."]}):h?"Veuillez patienter...":"Envoyer le lien"}),s.jsx(Q,{type:"button",variant:"ghost",className:"w-full text-muted-foreground",onClick:y,disabled:o==="loading",children:"Annuler"})]})]})})})},MR=/[<>"`\\{}\u0000-\u001F\u007F]/,LR='Les caractères < > " ` \\ { } ne sont pas autorisés',Vo=e=>e.trim().replace(/\s+/g," "),E3e=Ct().refine(e=>Vo(e).length>=2,"Le pseudo doit contenir au moins 2 caractères").refine(e=>Vo(e).length<=30,"Le pseudo ne doit pas dépasser 30 caractères").refine(e=>!MR.test(e),LR),S3e=Ct().refine(e=>Vo(e)===""||Vo(e).length>=2,"Le pseudo doit contenir au moins 2 caractères").refine(e=>Vo(e).length<=30,"Le pseudo ne doit pas dépasser 30 caractères").refine(e=>!MR.test(e),LR),T2=(e,t=50)=>Ct().refine(n=>Vo(n).length>=1,`${e} est requis`).refine(n=>Vo(n).length<=t,`${e} ne doit pas dépasser ${t} caractères`).refine(n=>
1051!MR.test(n),LR),A3e=da({email:Ct().trim().min(1,"L'email est requis").email("Adresse email invalide").max(255,"L'email ne doit pas dépasser 255 caractères"),password:Ct().min(1,"Le mot de passe est requis").min(8,"Le mot de passe doit contenir au moins 8 caractères").max(72,"Le mot de passe ne doit pas dépasser 72 caractères")}),T3e=da({email:Ct().trim().min(1,"L'email est requis").email("Adresse email invalide").max(255,"L'email ne doit pas dépasser 255 caractères"),password:Ct().min(8,"Le mot de passe doit contenir au moins 8 caractères").max(72,"Le mot de passe ne doit pas dépasser 72 caractères").regex(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/,"Le mot de passe doit contenir au moins une majuscule, une minuscule et un chiffre"),firstName:T2("Le prénom"),lastName:T2("Le nom"),displayName:S3e.optional().default(""),role:tf(["player","venue"])}),P3e=da({barName:Ct().min(1,"Le nom du bar est requis").max(100,"Le nom ne doit pas dépasser 100 caractères"),barAddress:Ct().min(1,"L'adresse est requise").max(200,"L'adresse ne doit pas dépasser 200 caractères"),contactEmail:Ct().trim().min(1,"L'email de contact est requis").email("Adresse email invalide"),contactPhone:Ct().max(20,"Le numéro ne doit pas dépasser 20 caractères").regex(/^(\+33|0)[1-9](\s?\d{2}){4}$|^$/,"Format invalide. Exemples : 06 12 34 56 78 ou +33 6 12 34 56 78").optional().or(xl("")),message:Ct().max(500,"Le message ne doit pas dépasser 500 caractères").optional()});da({venue_id:Ct().uuid("Veuillez sélectionner un lieu"),title:Ct().min(3,"Le titre doit contenir au moins 3 caractères").max(100,"Le titre ne doit pas dépasser 100 caractères"),description:Ct().max(5e3,"La description ne doit pas dépasser 5 000 caractères").optional().or(xl("")),event_date:Ct().min(1,"La date est requise"),registration_deadline:Ct().optional().or(xl("")),capacity:Io().int("La capacité doit être un nombre entier").min(4,"Minimum 4 joueurs").max(100,"Maximum 100 joueurs"),min_players:Io().int("Doit être un nombre entier").min(6,"Minimum 6 joueurs").max(50,"Maximum 50 joueurs"),price_cents:Io().int("Le prix doit être un nombre entier").min(0,"Le prix ne peut pas être négatif").max(1e4,"Prix maximum 100€"),credit_amount_cents:Io().int("Le crédit doit être un nombre entier").min(0,"Le crédit ne peut pas être négatif").max(5e3,"Crédit maximum 50€"),format:xl("swiss",{errorMap:()=>({message:"Format invalide"})}),time_control:Ct().max(20,"Le contrôle du temps ne doit pas dépasser 20 caractères").optional().or(xl("")),rounds_count:Io().int("Doit être un nombre entier").min(1,"Minimum 1 round").max(10,"Maximum 10 rounds"),rules:Ct().max(2e3,"Les règles ne doivent pas dépasser 2000 caractères").optional().or(xl(""))});const O3e=da({venue_id:Ct().uuid("Veuillez sélectionner un lieu"),title:Ct().min(3,"Le titre doit contenir au moins 3 caractères").max(100,"Le titre ne doit pas dépasser 100 caractères"),description:Ct().max(5e3,"La description ne doit pas dépasser 5 000 caractères").optional().or(xl("")),recurrence_type:tf(["once","weekly","biweekly","monthly"]),day_of_week:Io().min(0).max(6).optional(),start_time:Ct().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/,"Format HH:MM requis"),first_date:Ct().min(1,"La date de début est requise"),occurrences_count:Io().int().min(1,"Au moins 1 événement").max(12,"Maximum 12 événements").optional(),capacity:Io().int("La capacité doit être un nombre entier").min(4,"Minimum 4 joueurs").max(100,"Maximum 100 joueurs"),min_players:Io().int("Doit être un nombre entier").min(6,"Minimum 6 joueurs").max(50,"Maximum 50 joueurs"),price_euros:Io().min(0,"Le prix ne peut pas être négatif").max(100,"Prix maximum 100€"),credit_euros:Io().min(0,"Le crédit ne peut pas être négatif").max(50,"Crédit maximum 50€"),format:xl("swiss",{errorMap:()=>({message:"Format invalide"})}),time_control_preset:tf(["blitz-5","blitz-7","rapid-10"]),rounds_count:Io().int("Doit être un nombre entier").min(3,"Minimum 3 rondes (évite frustration avec exempts)").max(15,"Maximum 15 rounds"),rules:Ct().max(2e3,"Les règles ne doivent pas dépasser 2000 caractères").optional().or(xl("")),tiebreak_criteria:x7(tf(["buchholz_cut1","buchholz","sonneborn_berger","progressive","wins","black_games","direct"])).min(1,"Au moins un critère requis").default(["buchholz_cut1","buchholz","sonneborn_berger","wins","direct"]),pairing_engine:tf(["none","internal","javafo_api"]).default("internal"),coupon_mode:tf(["inherit","digital","paper"]).default("inherit"),paper_coupon_label:Ct().trim().max(80,"Max 80 caractères").optional().or(xl("")),paper_coupon_description:Ct().trim().max(500,"Max 500 caractères").optional().or(xl("")),paper_coupon_formulas:x7(da({name:Ct().trim().min(1,"Nom requis").max(60,"Max 60 caractères"),description:Ct().trim().max(200,"Max 200 caractères").optional().or(xl(""))})).max(6,"Maximum 6 formules").optional().default([])}).refine(e=>e.price_euros===0?e.credit_euros===0:e.credit_euros<=e.price_euros,{message:"Le crédit bar ne peut pas dépasser le prix du ticket (ou les deux doivent être à 0 pour un événement gratuit)",path:["credit_euros"]}).refine(e=>!(e.recurrence_type!=="once"&&e.day_of_week===void 0),{message:"Le jour de la semaine est requis pour les événements récurrents",path:["day_of_week"]}).refine(e=>!(e.recurrence_type!=="once"&&!e.occurrences_count),{message:"Le nombre d'événements est requis",path:["occurrences_count"]}).refine(e=>{const n=e.rounds_count+1;return e.min_players>=Math.max(6,n)},{message:"Minimum 6 joueurs ou nombre de rondes + 1 (le plus élevé)",path:["min_players"]});
1051da({email:Ct().trim().min(1,"L'email est requis").email("Adresse email invalide").max(255,"L'email ne doit pas dépasser 255 caractères")});da({password:Ct().min(8,"Le mot de passe doit contenir au moins 8 caractères").max(72,"Le mot de passe ne doit pas dépasser 72 caractères").regex(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/,"Le mot de passe doit contenir au moins une majuscule, une minuscule et un chiffre"),confirmPassword:Ct().min(1,"Veuillez confirmer le mot de passe")}).refine(e=>e.password===e.confirmPassword,{message:"Les mots de passe ne correspondent pas",path:["confirmPassword"]});const D3e=da({currentPassword:Ct().min(1,"Le mot de passe actuel est requis"),newPassword:Ct().min(8,"Le mot de passe doit contenir au moins 8 caractères").max(72,"Le mot de passe ne doit pas dépasser 72 caractères").regex(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/,"Le mot de passe doit contenir au moins une majuscule, une minuscule et un chiffre"),confirmPassword:Ct().min(1,"Veuillez confirmer le mot de passe")}).refine(e=>e.newPassword===e.confirmPassword,{message:"Les mots de passe ne correspondent pas",path:["confirmPassword"]}).refine(e=>e.currentPassword!==e.newPassword,{message:"Le nouveau mot de passe doit être différent de l'actuel",path:["newPassword"]}),I3e=e=>{e&&requestAnimationFrame(()=>{const t=document.getElementById(e);t&&(t.scrollIntoView({behavior:"smooth",block:"center"}),t.focus({preventScroll:!0}))})},R3e=()=>s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24","aria-hidden":"true",children:[s.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.76h3.56c2.08-1.92 3.28-4.74 3.28-8.09Z"}),s.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.56-2.76c-.98.66-2.24 1.05-3.72 1.05-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84A11 11 0 0 0 12 23Z"}),s.jsx("path",{fill:"#FBBC05",d:"M5.84 14.1a6.6 6.6 0 0 1 0-4.2V7.06H2.18a11 11 0 0 0 0 9.88l3.66-2.84Z"}),s.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1A11 11 0 0 0 2.18 7.06l3.66 2.84C6.71 7.31 9.14 5.38 12 5.38Z"})]}),y7=({label:e,onClick:t,disabled:n,loading:r,helper:i})=>s.jsxs("div",{className:"space-y-3 mb-4",children:[s.jsxs(Q,{type:"button",variant:"outline",className:"w-full",onClick:()=>{t()},disabled:n,children:[r?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(R3e,{}),s.jsx("span",{className:"ml-2",children:e})]}),i&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i}),s.jsxs("div",{className:"relative flex items-center",children:[s.jsx("div",{className:"flex-grow border-t border-border"}),s.jsx("span",{className:"mx-3 text-xs uppercase tracking-wider text-muted-foreground",children:"ou"}),s.jsx("div",{className:"flex-grow border-t border-border"})]})]}),M3e=({onLogin:e,onSignup:t,onMagicLink:n,onGoogleSignIn:r,isLoading:i=!1,isMagicLinkLoading:a=!1,isOAuthLoading:o=!1,error:l,initialEmail:c,initialTab:u})=>{const[d]=wc(),f=u??(d.get("tab")==="signup"?"signup":"login"),h=d.get("role")==="venue"?"venue":"player",[p,x]=N.useState(f),[y,b]=N.useState(!1),[w,_]=N.useState({}),[j,E]=N.useState(!1),[S,T]=N.useState(c??""),[P,O]=N.useState(""),[D,R]=N.useState(""),[L,M]=N.useState(""),[B,U]=N.useState(""),[F,H]=N.useState(h),[z,K]=N.useState({barName:"",barAddress:"",contactEmail:"",contactPhone:"",message:""}),W=()=>_({}),q=async J=>{J.preventDefault(),W();try{A3e.parse({email:S,password:P}),await e(S,P)}catch(Y){if(Y instanceof Xo){const Z={};Y.errors.forEach(G=>{const se=G.path[0];(se==="email"||se==="password"||se==="firstName"||se==="lastName")&&(Z[se]=G.message)}),_(Z)}}},oe=async J=>{var se;J.preventDefault(),W();const Y=Vo(D),Z=Vo(L),G=Vo(B);try{T3e.parse({email:S,password:P,firstName:Y,lastName:Z,displayName:G,role:F}),F==="venue"&&P3e.parse(z),await t({email:S,password:P,firstName:Y,lastName:Z,displayName:G||void 0,role:F,venueRequest:F==="venue"?z:void 0})}catch(ce){if(ce instanceof Xo){const le={};let fe;ce.errors.forEach(_e=>{const pe=_e.path[0];["barName","barAddress","contactEmail","contactPhone","message"].includes(pe)?(le.venueRequest||(le.venueRequest={}),le.venueRequest[pe]=_e.message):["email","password","firstName","lastName","displayName"].includes(pe)&&(le[pe]=_e.message,fe||(fe=pe))}),_(le);const be=(se=ce.errors[0])==null?void 0:se.message;je.error("Inscription impossible",{description:be??"Vérifiez les champs en rouge."}),I3e(fe)}}};return s.jsxs(Se,{className:"w-full max-w-md mx-auto border-border/50 shadow-lg animate-fade-in",children:[s.jsxs(kt,{className:"text-center pb-2",children:[s.jsx(Et,{className:"font-display text-2xl",children:p==="login"?"Bon retour !":"Rejoignez l'aventure"}),s.jsx(Qs,{className:"text-muted-foreground",children:p==="login"?"Connectez-vous pour accéder à vos tournois":"Créez votre compte en quelques secondes"})]}),s.jsx(De,{children:s.jsxs(Ka,{value:p,onValueChange:J=>{x(J),W()},children:[s.jsxs(Ca,{className:"grid w-full grid-cols-2 mb-6",children:[s.jsx(vn,{value:"login",children:"Connexion"}),s.jsx(vn,{value:"signup",children:"Inscription"})]}),l&&s.jsx("div",{className:"mb-4 p-3 bg-destructive/10 border border-destructive/20 rounded-lg text-destructive text-sm",children:l}),s.jsxs(Sn,{value:"login",children:[r&&s.jsx(y7,{label:"Se connecter avec Google",onClick:r,disabled:i||o,loading:o}),s.jsxs("form",{onSubmit:q,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"login-email",children:"Email"}),s.jsxs("div",{className:"relative",children:[s.jsx(wr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{id:"login-email",type:"email",placeholder:"[email protected]",value:S,onChange:J=>T(J.target.value),className:"pl-10",autoComplete:"email",required:!0})]}),w.email&&s.jsx("p",{className:"text-sm text-destructive",children:w.email})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"login-password",children:"Mot de passe"}),s.jsxs("div",{className:"relative",children:[s.jsx(yo,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{id:"login-password",type:y?"text":"password",placeholder:"••••••••",value:P,onChange:J=>O(J.target.value),className:"pl-10 pr-10",autoComplete:"current-password",required:!0}),s.jsx("button",{type:"button",onClick:()=>b(!y),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",children:y?s.jsx(Cf,{className:"w-4 h-4"}):s.jsx(go,{className:"w-4 h-4"})})]}),w.password&&s.jsx("p",{className:"text-sm text-destructive",children:w.password})]}),s.jsx("div",{className:"flex justify-end",children:s.jsx(Q,{type:"button",variant:"link",className:"text-sm text-muted-foreground hover:text-primary p-0 h-auto font-normal",onClick:()=>E(!0),children:"Mot de passe oublié ?"})}),s.jsx(Q,{type:"submit",className:"w-full",disabled:i||a,children:i?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 animate-spin"}),"Connexion..."]}):"Se connecter"}),n&&s.jsx(Q,{type:"button",variant:"outline",className:"w-full",disabled:i||a||!S,onClick:()=>{n(S)},children:a?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 animate-spin"}),"Envoi du lien..."]}):"Recevoir un lien magique par email"})]})]}),s.jsxs(Sn,{value:"signup",children:[r&&s.jsx(y7,{label:"S'inscrire avec Google",onClick:r,disabled:i||o||F==="venue",loading:o,helper:F==="venue"?"L'inscription Google n'est pas disponible pour les lieux. Utilisez le formulaire ci-dessous.":void 0}),s.jsxs("form",{onSubmit:oe,className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"firstName",children:"Prénom"}),s.jsxs("div",{className:"relative",children:[s.jsx(Cs,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{id:"firstName",placeholder:"Jean",value:D,onChange:J=>R(J.target.value),className:"pl-10",autoComplete:"given-name",required:!0})]}),w.firstName&&s.jsx("p",{className:"text-sm text-destructive",children:w.firstName})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"lastName",children:"Nom"}),s.jsx(Ue,{id:"lastName",placeholder:"Dupont",value:L,onChange:J=>M(J.target.value),autoComplete:"family-name",required:!0}),w.lastName&&s.jsx("p",{className:"text-sm text-destructive",children:w.lastName})]})]}),F==="player"&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"displayName",children:"Pseudo (optionnel)"}),s.jsxs("div",{className:"relative",children:[s.jsx(Cs,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{id:"displayName",placeholder:"Comment souhaitez-vous apparaître ?",value:B,onChange:J=>U(J.target.value),className:"pl-10",maxLength:30})]}),w.displayName&&s.jsx("p",{className:"text-sm text-destructive",children:w.displayName}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Soyez créatif : lettres, chiffres, symboles ($ * # …) et emoji acceptés. Visible dans les tournois."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"signup-email",children:"Email"}),s.jsxs("div",{className:"relative",children:[s.jsx(wr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{id:"signup-email",type:"email",placeholder:"[email protected]",value:S,onChange:J=>T(J.target.value),className:"pl-10",autoComplete:"email",required:!0})]}),w.email&&s.jsx("p",{className:"text-sm text-destructive",children:w.email})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"signup-password",children:"Mot de passe"}),s.jsxs("div",{className:"relative",children:[s.jsx(yo,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{id:"signup-password",type:y?"text":"password",placeholder:"Min. 8 caractères avec majuscule et chiffre",value:P,onChange:J=>O(J.target.value),className:"pl-10 pr-10",autoComplete:"new-password",required:!0}),s.jsx("button",{type:"button",onClick:()=>b(!y),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",children:y?s.jsx(Cf,{className:"w-4 h-4"}):s.jsx(go,{className:"w-4 h-4"})})]}),w.password&&s.jsx("p",{className:"text-sm text-destructive",children:w.password})]}),s.jsx(PAe,{selected:F,onSelect:H}),F==="venue"&&s.jsx(_4e,{data:z,onChange:K,errors:w.venueRequest}),s.jsx(Q,{type:"submit",className:"w-full",disabled:i,children:i?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 animate-spin"}),"Création..."]}):"Créer mon compte"})]})]})]})}),s.jsx(C3e,{open:j,onOpenChange:E,initialEmail:S,onEmailChange:J=>{J&&T(J)}})]})},$A="oauth_redirect_to",Hp="elo_onboarding_pending",L3e=()=>{var T;const e=Rr(),t=fa(),{user:n,roles:r,profile:i,isLoading:a}=Tt(),[o,l]=N.useState(!1),[c,u]=N.useState(!1),[d,f]=N.useState(!1),[h,p]=N.useState(null),x=t.state,y=(T=x==null?void 0:x.from)==null?void 0:T.pathname,b=x==null?void 0:x.email;N.useEffect(()=>{!a&&n&&r.length>0&&w()},[n,r,a,i]);const w=()=>
1051{if(y){sessionStorage.removeItem(Hp),e(y,{replace:!0});return}if(r.includes("admin")){e("/admin",{replace:!0});return}if(r.includes("venue")){e("/venue",{replace:!0});return}const P=sessionStorage.getItem(Hp)==="1",O=!!(i!=null&&i.onboarding_elo_completed_at);if(P&&!O){sessionStorage.removeItem(Hp),e("/onboarding/elo",{replace:!0});return}sessionStorage.removeItem(Hp),e("/player",{replace:!0})},_=async(P,O)=>{l(!0),p(null);try{const{error:D}=await re.auth.signInWithPassword({email:P,password:O});if(D){D.message.includes("Invalid login credentials")?p("Email ou mot de passe incorrect"):D.message.includes("Email not confirmed")?p("Veuillez confirmer votre email avant de vous connecter"):p(D.message);return}je.success("Connexion réussie !")}catch{p("Une erreur est survenue. Veuillez réessayer.")}finally{l(!1)}},j=async P=>{l(!0),p(null);try{const O={first_name:P.firstName,last_name:P.lastName,display_name:P.displayName||null,signup_role:P.role};P.role==="venue"&&P.venueRequest&&(O.bar_name=P.venueRequest.barName,O.bar_address=P.venueRequest.barAddress,O.contact_email=P.venueRequest.contactEmail,O.contact_phone=P.venueRequest.contactPhone||null,O.message=P.venueRequest.message||null);const{data:D,error:R}=await re.auth.signUp({email:P.email,password:P.password,options:{data:O}});if(R){R.message.includes("User already registered")?p("Un compte existe déjà avec cet email. Essayez de vous connecter."):R.message.includes("rate limit")||R.message.includes("429")?p("Trop de tentatives. Veuillez réessayer dans quelques minutes."):p(R.message);return}if(!D.user){p("Erreur lors de la création du compte. Veuillez réessayer.");return}P.role==="player"&&!y?sessionStorage.setItem(Hp,"1"):sessionStorage.removeItem(Hp),P.role==="venue"&&P.venueRequest?re.functions.invoke("send-venue-welcome-email",{body:{userId:D.user.id,barName:P.venueRequest.barName,barAddress:P.venueRequest.barAddress,contactEmail:P.venueRequest.contactEmail,contactName:P.firstName}}).catch(L=>{console.error("Failed to send venue welcome email:",L)}):re.functions.invoke("send-welcome-email",{body:{email:P.email,firstName:P.firstName}}).catch(L=>{console.error("Failed to send welcome email:",L)});try{const{trackMetaEvent:L}=await ka(async()=>{const{trackMetaEvent:M}=await Promise.resolve().then(()=>uh);return{trackMetaEvent:M}},[]);L("CompleteRegistration",{userData:{email:P.email,first_name:P.firstName,external_id:D.user.id},customData:{content_name:P.role}})}catch{}je.success("Compte créé avec succès !")}catch{p("Une erreur est survenue. Veuillez réessayer.")}finally{l(!1)}},E=async()=>{u(!0),p(null);
1051try{y&&y.startsWith("/")?sessionStorage.setItem($A,y):sessionStorage.removeItem($A);const{error:P}=await re.auth.signInWithOAuth({provider:"google",options:{redirectTo:`${window.location.origin}/auth/callback`,queryParams:{prompt:"select_account"}}});if(P)throw P}catch{sessionStorage.removeItem($A),p("Connexion Google indisponible. Veuillez réessayer."),u(!1)}},S=async P=>{p(null);const O=P.trim().toLowerCase();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(O)){p("Email invalide");return}f(!0);try{const D=y&&y.startsWith("/")?y:"",{error:R}=await re.auth.signInWithOtp({email:O,options:{shouldCreateUser:!1,emailRedirectTo:`${window.location.origin}${D}`}});if(R){R.message.toLowerCase().includes("rate")?p("Trop de tentatives. Réessayez dans quelques minutes."):p("Impossible d'envoyer le lien. Vérifiez votre email.");return}je.success("Lien magique envoyé — vérifiez votre boîte mail.")}catch{p("Une erreur est survenue. Veuillez réessayer.")}finally{f(!1)}};return a?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx("div",{className:"animate-pulse",children:s.jsx(vc,{size:"lg",showText:!1})})}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("main",{className:"pt-24 pb-16 px-4",children:s.jsxs("div",{className:"max-w-md mx-auto",children:[s.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[s.jsx("img",{src:"/pwa-512x512.png",alt:"Chess Agenda",width:80,height:80,className:"h-16 w-16 md:h-20 md:w-20 rounded-2xl shadow-sm",loading:"eager",decoding:"async"}),s.jsx(vc,{size:"lg"})]}),s.jsx(M3e,{onLogin:_,onSignup:j,onMagicLink:S,onGoogleSignIn:E,isLoading:o,isMagicLinkLoading:d,isOAuthLoading:c,error:h,initialEmail:b,initialTab:b?"login":void 0}),s.jsxs("p",{className:"text-center text-sm text-muted-foreground mt-6",children:["En vous inscrivant, vous acceptez nos"," ",s.jsx(Pe,{to:"/cgu",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"conditions d'utilisation"})," ","et notre"," ",s.jsx(Pe,{to:"/confidentialite",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"politique de confidentialité"}),"."]})]})})]})},sm="oauth_redirect_to",F3e=()=>{const e=Rr(),{user:t,roles:n,isLoading:r}=Tt(),i=N.useRef(!1);return N.useEffect(()=>{const a=new URLSearchParams(window.location.search),o=a.get("error_description")||a.get("error");o&&(sessionStorage.removeItem(sm),je.error("Connexion Google échouée",{description:decodeURIComponent(o)}),e("/auth",{replace:!0}))},[e]),N.useEffect(()=>{if(i.current||r||!t)return;i.current=!0;const a=sessionStorage.getItem(sm);if(sessionStorage.removeItem(sm),window.history.replaceState({},"",window.location.pathname),je.success("Connexion réussie !"),a&&a.startsWith("/")&&!a.startsWith("//")){e(a,{replace:!0});return}n.includes("admin")?e("/admin",{replace:!0}):n.includes("venue")?e("/venue",{replace:!0}):e("/player",{replace:!0})},[t,n,r,e]),N.useEffect(()=>{const a=setTimeout(()=>{!i.current&&!t&&(sessionStorage.removeItem(sm),je.error("Connexion impossible. Veuillez réessayer."),e("/auth",{replace:!0}))},8e3);return()=>clearTimeout(a)},[t,e]),s.jsxs("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center gap-4 px-4",children:[s.jsx("div",{className:"animate-pulse",children:s.jsx(vc,{size:"lg",showText:!1})}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Connexion en cours…"})]})},$3e=da({password:Ct().min(8,"Le mot de passe doit contenir au moins 8 caractères").max(72,"Le mot de passe ne doit pas dépasser 72 caractères").regex(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/,"Le mot de passe doit contenir au moins une majuscule, une minuscule et un chiffre"),confirmPassword:Ct().min(1,"Veuillez confirmer le mot de passe")}).refine(e=>e.password===e.confirmPassword,{message:"Les mots de passe ne correspondent pas",path:["confirmPassword"]}),B3e=e=>{let t=0;return e.length>=8&&t++,e.length>=12&&t++,/[A-Z]/.test(e)&&t++,/[a-z]/.test(e)&&t++,/\d/.test(e)&&t++,/[^a-zA-Z0-9]/.test(e)&&t++,t<=2?"weak":t<=4?"medium":"strong"},z3e={weak:{label:"Faible",color:"bg-destructive",width:"w-1/3"},medium:{label:"Moyen",color:"bg-warning",width:"w-2/3"},strong:{label:"Fort",color:"bg-success",width:"w-full"}},U3e=()=>{const e=Rr(),[t]=wc(),[n,r]=N.useState("loading"),[i,a]=N.useState(""),[o,l]=N.useState(""),[c,u]=N.useState(!1),[d,f]=N.useState(!1),[h,p]=N.useState({}),[x,y]=N.useState(null),b=t.get("token"),w=N.useMemo(()=>B3e(i),[i]),_=z3e[w];N.useEffect(()=>{const E=async()=>
1051{if(b){r("ready");return}const T=new URLSearchParams(window.location.hash.substring(1)),P=T.get("access_token"),O=T.get("type");if(P&&O==="recovery"){const{error:R}=await re.auth.setSession({access_token:P,refresh_token:T.get("refresh_token")||""});if(R){console.error("Session error:",R),r("invalid");return}r("ready"),window.history.replaceState({},document.title,window.location.pathname);return}const{data:{session:D}}=await re.auth.getSession();r(D?"ready":"invalid")},{data:{subscription:S}}=re.auth.onAuthStateChange(T=>{T==="PASSWORD_RECOVERY"&&r("ready")});return E(),()=>S.unsubscribe()},[b]);const j=async E=>{E.preventDefault(),p({}),y(null);try{$3e.parse({password:i,confirmPassword:o})}catch(S){if(S instanceof Xo){const T={};S.errors.forEach(P=>{const O=P.path[0];T[O]=P.message}),p(T);return}}r("submitting");try{if(b){const T=await re.functions.invoke("verify-password-reset",{body:{token:b,newPassword:i}});if(T.error){console.error("Verify password reset error:",T.error);let O=null;try{const D=T.error.context;if(D&&typeof D.json=="function"){const R=await D.clone().json();R!=null&&R.error&&(O=String(R.error))}}catch{}if(O!=null&&O.toLowerCase().includes("expir")){r("expired");return}y(O||T.error.message||"Une erreur s'est produite"),r("ready");return}const P=T.data;if(P!=null&&P.error){P.error.includes("expiré")?r("expired"):(y(P.error),r("ready"));return}r("success"),setTimeout(()=>{e("/auth",{replace:!0})},2e3);return}const{error:S}=await re.auth.updateUser({password:i});if(S){console.error("Update password error:",S),y("Une erreur s'est produite. Le lien a peut-être expiré."),r("ready");return}r("success"),setTimeout(()=>{e("/player",{replace:!0})},2e3)}catch(S){console.error("Unexpected error:",S),y("Une erreur inattendue s'est produite."),r("ready")}};return n==="loading"?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:s.jsxs("div",{className:"text-center space-y-4",children:[s.jsx(We,{className:"w-8 h-8 animate-spin text-primary mx-auto"}),s.jsx("p",{className:"text-muted-foreground",children:"Vérification du lien..."})]})}):n==="expired"?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:s.jsxs(Se,{className:"w-full max-w-md border-warning/20 bg-card/95 backdrop-blur-xl",children:[s.jsxs(kt,{className:"text-center",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-warning/10 flex items-center justify-center mx-auto mb-4",children:s.jsx(hi,{className:"w-8 h-8 text-warning"})}),s.jsx(Et,{className:"font-display text-xl",children:"Lien expiré"}),s.jsx(Qs,{children:"Ce lien de réinitialisation a expiré. Les liens sont valides pendant 1 heure."})]}),s.jsxs(De,{className:"space-y-3",children:[s.jsx(Q,{onClick:()=>e("/auth",{replace:!0}),className:"w-full",children:"Demander un nouveau lien"}),s.jsx("p",{className:"text-xs text-center text-muted-foreground",children:'Cliquez sur "Mot de passe oublié" sur la page de connexion'})]})]})}):n==="invalid"?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:s.jsxs(Se,{className:"w-full max-w-md border-destructive/20 bg-card/95 backdrop-blur-xl",children:[s.jsxs(kt,{className:"text-center",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-destructive/10 flex items-center justify-center mx-auto mb-4",children:s.jsx(hi,{className:"w-8 h-8 text-destructive"})}),s.jsx(Et,{className:"font-display text-xl",children:"Lien invalide"}),s.jsx(Qs,{children:"Ce lien de réinitialisation n'est pas valide. Il a peut-être déjà été utilisé."})]}),s.jsx(De,{children:s.jsx(Q,{onClick:()=>e("/auth",{replace:!0}),className:"w-full",children:"Retour à la connexion"})})]})}):n==="success"?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:s.jsxs(Se,{className:"w-full max-w-md border-success/20 bg-card/95 backdrop-blur-xl",children:[s.jsxs(kt,{className:"text-center",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-success/10 flex items-center justify-center mx-auto mb-4 animate-pulse",children:s.jsx(Cn,{className:"w-8 h-8 text-success"})}),s.jsx(Et,{className:"font-display text-xl",children:"Mot de passe modifié !"}),s.jsx(Qs,{children:"Votre mot de passe a été mis à jour avec succès. Vous allez être redirigé..."})]}),s.jsx(De,{children:s.jsx("div",{className:"flex items-center justify-center",children:s.jsx(We,{className:"w-5 h-5 animate-spin text-muted-foreground"})})})]})}):s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:s.jsxs(Se,{className:"w-full max-w-md border-primary/20 bg-card/95 backdrop-blur-xl shadow-lg",children:[s.jsxs(kt,{className:"text-center",children:[s.jsx("div",{className:"flex justify-center mb-4",children:s.jsx(vc,{className:"h-10"})}),s.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-2",children:s.jsx(dI,{className:"w-6 h-6 text-primary"})}),s.jsx(Et,{className:"font-display text-xl",children:"Nouveau mot de passe"}),s.jsx(Qs,{children:"Choisissez un mot de passe sécurisé pour votre compte"})]}),s.jsx(De,{children:s.jsxs("form",{onSubmit:j,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"new-password",children:"Nouveau mot de passe"}),s.jsxs("div",{className:"relative",children:[s.jsx(yo,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{id:"new-password",type:c?"text":"password",placeholder:"Min. 8 caractères",value:i,onChange:E=>a(E.target.value),className:"pl-10 pr-10",autoComplete:"new-password",autoFocus:!0,required:!0,disabled:n==="submitting"}),s.jsx("button",{type:"button",onClick:()=>u(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,
1051children:c?s.jsx(Cf,{className:"w-4 h-4"}):s.jsx(go,{className:"w-4 h-4"})})]}),h.password&&s.jsx("p",{className:"text-sm text-destructive",children:h.password}),i.length>0&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"h-1.5 bg-muted rounded-full overflow-hidden",children:s.jsx("div",{className:`h-full ${_.color} ${_.width} transition-all duration-300`})}),s.jsxs("p",{className:`text-xs ${w==="weak"?"text-destructive":w==="medium"?"text-warning":"text-success"}`,children:["Force : ",_.label]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"confirm-password",children:"Confirmer le mot de passe"}),s.jsxs("div",{className:"relative",children:[s.jsx(yo,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{id:"confirm-password",type:d?"text":"password",placeholder:"Répétez le mot de passe",value:o,onChange:E=>l(E.target.value),className:"pl-10 pr-10",autoComplete:"new-password",required:!0,disabled:n==="submitting"}),s.jsx("button",{type:"button",onClick:()=>f(!d),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:d?s.jsx(Cf,{className:"w-4 h-4"}):s.jsx(go,{className:"w-4 h-4"})})]}),h.confirmPassword&&s.jsx("p",{className:"text-sm text-destructive",children:h.confirmPassword}),o.length>0&&i===o&&s.jsxs("p",{className:"text-xs text-success flex items-center gap-1",children:[s.jsx(Cn,{className:"w-3 h-3"}),"Les mots de passe correspondent"]})]}),x&&s.jsx("div",{className:"p-3 bg-destructive/10 border border-destructive/20 rounded-lg text-destructive text-sm",children:x}),s.jsxs("div",{className:"p-3 bg-muted/50 rounded-lg text-xs text-muted-foreground space-y-1",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Le mot de passe doit contenir :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-0.5",children:[s.jsx("li",{className:i.length>=8?"text-success":"",children:"Au moins 8 caractères"}),s.jsx("li",{className:/[A-Z]/.test(i)?"text-success":"",children:"Une lettre majuscule"}),s.jsx("li",{className:/[a-z]/.test(i)?"text-success":"",children:"Une lettre minuscule"}),s.jsx("li",{className:/\d/.test(i)?"text-success":"",children:"Un chiffre"})]})]}),s.jsx(Q,{type:"submit",className:"w-full",disabled:n==="submitting",children:n==="submitting"?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 animate-spin mr-2"}),"Modification..."]}):"Modifier mon mot de passe"})]})})]})})},Ix=WZ,Rx=fR,Mx=mR;function EC(e){const{user:t}=Tt(),n=Ye(),r=e??(t==null?void 0:t.id);return N.useEffect(()=>{if(!r)return;const i=re.channel(`player-stats-${r}`).on("postgres_changes",{event:"*",schema:"public",table:"player_stats",filter:`user_id=eq.${r}`},()=>{n.invalidateQueries({queryKey:["player-stats",r]})}).subscribe();return()=>{re.removeChannel(i)}},[r,n]),st({queryKey:["player-stats",r],queryFn:async()=>{if(!r)return null;const{data:i,error:a}=await re.from("player_stats").select("*").eq("user_id",r).maybeSingle();if(a)throw a;return i},enabled:!!r})}const v7="ABCDEFGHJKLMNPQRSTUVWXYZ23456789",q3e=6;function V3e(){const e=new Uint8Array(q3e);return crypto.getRandomValues(e),Array.from(e,t=>v7[t%v7.length]).join("")}function NT(e){return e.trim().toUpperCase().replace(/^L-/,"").replace(/[\s-]/g,"")}function $c(e){if(!e)return!1;if(e.status==="checked_in")return!0;const t=e.checkin;return!!(Array.isArray(t)&&t.length>0||t&&typeof t=="object"&&!Array.isArray(t)&&"id"in t||e.is_checked_in===!0)}async function H3e(e){const{data:t,error:n}=await re.rpc("get_public_profiles_by_ids",{p_user_ids:[e]});return n?(console.error("[useTickets] Error fetching single profile via RPC:",n),null):(console.log("[useTickets] Fetched single profile for:",e,t!=null&&t[0]?"found":"not found"),(t==null?void 0:t[0])||null)}async function W3e(e){if(e.length===0)return new Map;const{data:t,error:n}=await re.rpc("get_public_profiles_by_ids",{p_user_ids:e});return n?(console.error("[useTickets] Error fetching profiles via RPC:",n),new Map):(console.log("[useTickets] Fetched profiles:",(t==null?void 0:t.length)||0,"for",e.length,"users"),new Map((t||[]).map(r=>[r.id,r])))}function G3e(e){return st({queryKey:["event-tickets",e],queryFn:async()=>
1051{if(!e)throw new Error("Event ID is required");const{data:t,error:n}=await re.from("tickets").select(`
1052          id,
1053          event_id,
1054          user_id,
1055          qr_code,
1056          reservation_code,
1057          price_paid_cents,
1058          credit_total_cents,
1059          credit_remaining_cents,
1060          status,
1061          is_for_self,
1062          is_walk_in,
1063          purchaser_id,
1064          guest_first_name,
1065          guest_last_name,
1066          guest_email,
1067          guest_notes,
1068          elo_rating,
1069          lead_source,
1070          created_at,
1071          updated_at,
1072          paid_at,
1073          checkin:checkins(id, checked_at, checked_by)
1074
1075        `).eq("event_id",e).or("status.in.(paid,checked_in,lead),and(status.eq.reserved,is_walk_in.eq.true)").order("created_at",{ascending:!0});if(n)throw n;const r=[...new Set(t.map(o=>o.user_id).filter(o=>o!==null))],i=await W3e(r);return t.map(o=>({...o,profile:i.get(o.user_id)||null}))},enabled:!!e,staleTime:1e4})}function FR(e){const t=Ye(),n=G3e(e);return N.useEffect(()=>{if(!e)return;const r=re.channel(`event-tickets-realtime-${e}`).on("postgres_changes",{event:"*",schema:"public",table:"tickets",filter:`event_id=eq.${e}`},()=>{t.invalidateQueries({queryKey:["event-tickets",e]}),t.invalidateQueries({queryKey:["event-tickets-count",e]}),t.invalidateQueries({queryKey:["tournament-threshold",e]})}).on("postgres_changes",{event:"INSERT",schema:"public",table:"checkins"},()=>{t.invalidateQueries({queryKey:["event-tickets",e]}),t.invalidateQueries({queryKey:["event-tickets-count",e]})}).subscribe();return()=>{re.removeChannel(r)}},[e,t]),n}function bte(e,t){return st({queryKey:["ticket-by-code",e,t],queryFn:async()=>{if(!e||!t)throw new Error("Code and Event ID are required");const n=e.replace(/[(),]/g,""),r=NT(e).replace(/[(),]/g,""),{data:i,error:a}=await re.from("tickets").select(`
1076          id,
1077          event_id,
1078          user_id,
1079          qr_code,
1080          reservation_code,
1081          price_paid_cents,
1082          credit_total_cents,
1083          credit_remaining_cents,
1084          status,
1085          is_for_self,
1086          is_walk_in,
1087          purchaser_id,
1088          guest_first_name,
1089          guest_last_name,
1090          guest_notes,
1091          created_at,
1092          updated_at,
1093          checkin:checkins(id, checked_at, checked_by)
1094        `).eq("event_id",t).or(`qr_code.eq.${n},reservation_code.eq.${r},access_token.eq.${n}`).maybeSingle();if(a)throw a;if(!i)return null;const o=await H3e(i.user_id);return{...i,profile:o}},enabled:!!e&&e.length>=4&&!!t})}function SC(){const e=Ye();return dt({mutationFn:async({ticketId:t,method:n="qr_scan",identityVerified:r=!1,notes:i})=>{const{data:{user:a}}=await re.auth.getUser();if(!a)throw new Error("Non authentifié");const{data:o}=await re.from("checkins").select("id").eq("ticket_id",t).maybeSingle();if(o)throw new Error("Ce ticket a déjà été validé");const{data:l,error:c}=await re.from("checkins").insert({ticket_id:t,checked_by:a.id,method:n,identity_verified:r,notes:i||null}).select().single();if(c)throw c;return l},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["ticket",n.ticketId]}),e.invalidateQueries({queryKey:["ticket-by-code"]}),e.invalidateQueries({queryKey:["event-tickets"]}),je.success("Check-in validé !")},onError:t=>{je.error(t.message)}})}function wte(){const e=Ye();return dt({mutationFn:async({ticketId:t,eventId:n})=>{const{error:r}=await re.from("checkins").delete().eq("ticket_id",t);if(r)throw r;return await re.from("tournament_withdrawals").delete().eq("event_id",n).eq("ticket_id",t),{ticketId:t,eventId:n}},onSuccess:({eventId:t,ticketId:n})=>{e.invalidateQueries({queryKey:["ticket",n]}),e.invalidateQueries({queryKey:["ticket-by-code"]}),e.invalidateQueries({queryKey:["event-tickets",t]}),e.invalidateQueries({queryKey:["event-tickets-count",t]}),e.invalidateQueries({queryKey:["event-participants",t]}),e.invalidateQueries({queryKey:["tournament-standings",t]}),e.invalidateQueries({queryKey:["tournament-withdrawals",t]}),e.invalidateQueries({queryKey:["checked-in-count",t]}),je.success("Check-in annulé")},onError:t=>{je.error((t==null?void 0:t.message)||"Impossible d'annuler le check-in")}})}function K3e(){const e=Ye();return dt({mutationFn:async({ticketId:t,eventId:n,amountDueCents:r,currentNotes:i})=>{const{data:{user:a}}=await re.auth.getUser();if(!a)throw new Error("Non authentifié");const l=`[RÉGLÉ: ${(r/100).toFixed(2).replace(/\.00$/,"")}€ ${new Date().toISOString().slice(0,16)}]`,c=(i??"").replace(/\[À RÉGLER:[^\]]*\]\s*/i,"").trim(),u=c?`${l} ${c}`:l,{error:d}=await re.from("tickets").update({status:"paid",price_paid_cents:r,guest_notes:u}).eq("id",t).eq("status","reserved");if(d)throw d;const{error:f}=await re.from("checkins").insert({ticket_id:t,checked_by:a.id,method:"name_search",identity_verified:!0,notes:"Encaissement sur place"});if(f)throw f;return{ticketId:t,eventId:n}},onSuccess:({eventId:t})=>
1094{e.invalidateQueries({queryKey:["event-tickets",t]}),e.invalidateQueries({queryKey:["event-tickets-count",t]}),e.invalidateQueries({queryKey:["event-participants",t]}),e.invalidateQueries({queryKey:["tournament-standings",t]}),je.success("Encaissé et check-in validé")},onError:t=>{je.error(t.message)}})}function _te(e,t){if(!e)return t;const n=e.match(/\[À RÉGLER:\s*([\d]+(?:[.,]\d+)?)\s*€?\]/i);if(!n)return t;const r=parseFloat(n[1].replace(",","."));return!isFinite(r)||r<0?t:Math.round(r*100)}function Y3e(){const e=Ye();return dt({mutationFn:async t=>{const{data:n,error:r}=await re.functions.invoke("admin-walkin-register",{body:{eventId:t.eventId,firstName:t.firstName,lastName:t.lastName,email:t.email,userId:t.userId,elo:t.elo,club:t.club,notes:t.notes,paymentMethod:t.paymentMethod,isFree:t.isFree??!1,grantCredit:t.grantCredit??!1,freeReason:t.freeReason,amountDueCents:t.amountDueCents}});if(r){const i=r.message??"Erreur serveur";throw new Error(i)}if(!(n!=null&&n.ok))throw new Error((n==null?void 0:n.error)??"Erreur serveur");return{id:n.ticket.id,status:n.ticket.status,reservation_code:n.ticket.reservation_code,credit_remaining_cents:n.ticket.credit_remaining_cents,price_paid_cents:n.ticket.price_paid_cents,amount_due_cents:n.ticket.amount_due_cents,alreadyRegistered:!!n.alreadyRegistered,accountCreated:!!n.accountCreated,convertedFromLead:!!n.convertedFromLead}},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["event-tickets",n.eventId]}),e.invalidateQueries({queryKey:["event-tickets-count",n.eventId]}),e.invalidateQueries({queryKey:["can-register",n.eventId]}),e.invalidateQueries({queryKey:["tournament-threshold",n.eventId]}),e.invalidateQueries({queryKey:["event-participants",n.eventId]}),e.invalidateQueries({queryKey:["tournament-standings",n.eventId]}),t.convertedFromLead?je.success("Paiement encaissé — ticket envoyé par email"):t.alreadyRegistered?je.info("Déjà inscrit·e — ticket existant réutilisé"):t.status==="lead"?je.success("Pré-inscription enregistrée — email envoyé"):je.success("Inscription confirmée + check-in effectué")},onError:t=>{je.error(t.message)}})}function X3e(){const{user:e}=Tt();return st({queryKey:["my-tickets",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return[];const{data:t,error:n}=await re.from("tickets").select(`
1095          *,
1096          event:events (
1097            id, title, event_date, status, venue_id,
1098            venue:venues (id, name, city)
1099          )
1100        `).eq("user_id",e.id).in("status",["reserved","paid","checked_in"]).order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!(e!=null&&e.id)})}function jte(e){const{user:t}=Tt();return st({queryKey:["my-event-ticket",e,t==null?void 0:t.id],queryFn:async()=>{if(!e||!(t!=null&&t.id))return null;const{data:n,error:r}=await re.from("tickets").select(`
1101          id,
1102          event_id,
1103          user_id,
1104          purchaser_id,
1105          qr_code,
1106          reservation_code,
1107          access_token,
1108          price_paid_cents,
1109          credit_total_cents,
1110          credit_remaining_cents,
1111          status,
1112          is_for_self,
1113          is_walk_in,
1114          guest_first_name,
1115          guest_last_name,
1116          guest_email,
1117          guest_notes,
1118          created_at,
1119          updated_at
1120        `).eq("event_id",e).eq("user_id",t.id).eq("is_for_self",!0).in("status",["paid","checked_in"]).maybeSingle();if(r)throw r;return n},enabled:!!e&&!!(t!=null&&t.id)})}function Q3e(e){const{user:t}=Tt();return st({queryKey:["my-event-lead",e,t==null?void 0:t.id],queryFn:async()=>{if(!e||!(t!=null&&t.id))return null;const{data:n,error:r}=await re.from("tickets").select("id, event_id, user_id, status, reservation_code, created_at").eq("event_id",e).eq("user_id",t.id).eq("is_for_self",!0).eq("status","lead").maybeSingle();if(r)throw r;return n},enabled:!!e&&!!(t!=null&&t.id)})}function Nte(e){const{user:t}=Tt();return st({queryKey:["my-tickets-for-event",e,t==null?void 0:t.id],queryFn:async()=>{if(!e||!(t!=null&&t.id))return[];const{data:n,error:r}=await re.from("tickets").select(`
1121          *,
1122          event:events (
1123            id, title, event_date, status, venue_id, price_cents, credit_amount_cents,
1124            coupon_mode, paper_coupon_label, paper_coupon_description, paper_coupon_formulas,
1125            venue:venues (
1126              id, name, city, address,
1127              default_coupon_mode, default_paper_coupon_label, default_paper_coupon_description, default_paper_coupon_formulas
1128            )
1129          ),
1130          checkin:checkins(id, checked_at, checked_by)
1131        `).eq("event_id",e).or(`user_id.eq.${t.id},purchaser_id.eq.${t.id}`).in("status",["reserved","paid","checked_in"]).order("is_for_self",{ascending:!1}).order("created_at",{ascending:!0});if(r)throw r;return n},enabled:!!e&&!!(t!=null&&t.id)})}function kte(){const e=Ye();return dt({mutationFn:async({ticketId:t})=>{const{data:n,error:r}=await re.functions.invoke("cancel-ticket",{body:{ticketId:t}});if(r)throw new Error(r.message||"Erreur lors de l'annulation");if(n!=null&&n.error)throw new Error(n.error);return n},onSuccess:t=>
1131{e.invalidateQueries({queryKey:["my-tickets"]}),e.invalidateQueries({queryKey:["my-tickets-for-event"]}),e.invalidateQueries({queryKey:["event-tickets"]}),e.invalidateQueries({queryKey:["ticket",t.ticketId]}),e.invalidateQueries({queryKey:["my-event-ticket"]}),e.invalidateQueries({queryKey:["player-history"]}),e.invalidateQueries({queryKey:["tournament-threshold",t.eventId]})},onError:t=>{je.error(t.message)}})}function Cte(e,t){return st({queryKey:["ticket-by-access-token",e,t],queryFn:async()=>{if(!e||!t)return null;const{data:n,error:r}=await re.rpc("get_ticket_by_access_token",{p_access_token:t,p_event_id:e});if(r)throw console.error("[useTicketByAccessToken] RPC error:",r),r;const i=(n==null?void 0:n[0])||null;return console.log("[useTicketByAccessToken] Fetched ticket:",i?"found":"not found"),i},enabled:!!e&&!!t&&t.length===32,staleTime:6e4,refetchInterval:n=>{const r=n.state.data,i=n.state.fetchFailureCount>0;return r||i||n.state.dataUpdateCount>5?!1:2500},refetchIntervalInBackground:!1,retry:1})}function Ete(e){const{user:t}=Tt();return st({queryKey:["venue-subscription",e,t==null?void 0:t.id],queryFn:async()=>{if(!e||!t)return!1;const{count:n,error:r}=await re.from("venue_subscriptions").select("*",{count:"exact",head:!0}).eq("venue_id",e).eq("user_id",t.id);if(r)throw r;return(n??0)>0},enabled:!!e&&!!t})}function Ste(){const e=Ye();return dt({mutationFn:async t=>{const{data:{user:n}}=await re.auth.getUser();if(!n)throw new Error("Non authentifié");const{error:r}=await re.from("venue_subscriptions").insert({venue_id:t,user_id:n.id});if(r)throw r},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["venue-subscription",n]}),e.invalidateQueries({queryKey:["my-venue-subscriptions"]})}})}function Ate(){const e=Ye();return dt({mutationFn:async t=>{const{data:{user:n}}=await re.auth.getUser();if(!n)throw new Error("Non authentifié");const{error:r}=await re.from("venue_subscriptions").delete().eq("venue_id",t).eq("user_id",n.id);if(r)throw r},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["venue-subscription",n]}),e.invalidateQueries({queryKey:["my-venue-subscriptions"]})}})}function Tte(){const{user:e}=Tt();return st({queryKey:["my-venue-subscriptions",e==null?void 0:e.id],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await re.from("venue_subscriptions").select(`
1132          id,
1133          venue_id,
1134          created_at,
1135          venue:venues!venue_subscriptions_venue_id_fkey (id, name, city, address, image_url, slug)
1136        `).eq("user_id",e.id).order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function b7({event:e,ticketCount:t=0}){var d,f;const n=e.capacity-t,r=n<=0,i=n>0&&n<=3,a=Ze(new Date(e.event_date),"EEE d MMM · HH'h'mm",{locale:pt}),o=(e.price_cents/100).toFixed(0),l=od(e,e.venue??null),c=l.mode==="paper"||e.credit_amount_cents>0,u=l.mode==="paper"?l.shortLabel:`dont ${(e.credit_amount_cents/100).toFixed(0)}€ d'avantage`;return s.jsx(Pe,{to:`/events/${e.id}`,className:"block group",children:s.jsx(Se,{className:ae("h-full transition-all duration-300","hover:shadow-lg hover:border-primary/30 hover:-translate-y-1",r&&"opacity-75"),children:s.jsxs(De,{className:"p-5 flex flex-col h-full",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2 mb-3",children:[s.jsx("h3",{className:"font-display font-semibold text-foreground line-clamp-2 group-hover:text-primary transition-colors",children:e.title}),r?s.jsx(we,{variant:"destructive",className:"flex-shrink-0",children:"Complet"}):i?s.jsxs(we,{variant:"secondary",className:"flex-shrink-0 bg-accent/30 text-foreground border-accent/50",children:[n," places"]}):null]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-2",children:[s.jsx(gn,{className:"w-4 h-4 flex-shrink-0"}),s.jsxs("span",{className:"truncate",children:[(d=e.venue)==null?void 0:d.name,((f=e.venue)==null?void 0:f.city)&&` · ${e.venue.city}`]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[s.jsx(Jn,{className:"w-4 h-4 flex-shrink-0"}),s.jsx("span",{className:"capitalize",children:a})]}),s.jsxs("div",{className:"mt-auto pt-4 border-t border-border/50 flex items-center justify-between",children:[s.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:r?s.jsxs(s.Fragment,{children:[s.jsx(sn,{className:"w-4 h-4"}),s.jsx("span",{children:"Complet"})]}):n<=3?s.jsxs(s.Fragment,{children:[s.jsx(sn,{className:"w-4 h-4"}),s.jsx("span",{children:"Dernières places"})]}):null}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"text-right",children:[s.jsxs("span",{className:"font-semibold text-foreground",children:[o,"€"]}),c&&s.jsx("span",{className:"block text-xs text-primary",children:u})]}),s.jsxs(Q,{size:"sm",variant:r?"outline":"default",className:"gap-1 group/btn",disabled:r,children:[r?"Complet":"Voir",!r&&s.jsx(Sr,{className:"w-3.5 h-3.5 transition-transform group-hover/btn:translate-x-0.5"})]})]})]})]})})})}function $R(e){const{user:t}=Tt();return st({queryKey:["waitlist","position",e,t==null?void 0:t.id],queryFn:async()=>
1136{if(!(t!=null&&t.id)||!e)return null;const{data:n,error:r}=await re.from("waitlist").select("*").eq("event_id",e).eq("user_id",t.id).in("status",["waiting","notified"]).maybeSingle();if(r)throw r;return n},enabled:!!e&&!!(t!=null&&t.id),staleTime:1e4})}function Pte(e){return st({queryKey:["waitlist","count",e],queryFn:async()=>{if(!e)return 0;const{count:t,error:n}=await re.from("waitlist").select("*",{count:"exact",head:!0}).eq("event_id",e).eq("status","waiting");if(n)throw n;return t||0},enabled:!!e,staleTime:3e4})}function J3e(e){return st({queryKey:["waitlist","full",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await re.from("waitlist").select("*").eq("event_id",e).in("status",["waiting","notified"]).order("position",{ascending:!0});if(n)throw n;if(!t||t.length===0)return[];const r=t.map(o=>o.user_id),{data:i}=await re.from("public_profiles").select("id, display_name, first_name, last_name, avatar_url").in("id",r),a=new Map((i==null?void 0:i.map(o=>[o.id,o]))||[]);return t.map(o=>({...o,status:o.status,profile:a.get(o.user_id)||void 0}))},enabled:!!e,staleTime:1e4})}function Z3e(){const e=Ye(),{user:t}=Tt();return dt({mutationFn:async n=>{if(!(t!=null&&t.id))throw new Error("Non connecté");const{data:r}=await re.from("tickets").select("id").eq("event_id",n).eq("user_id",t.id).not("status","in",'("cancelled","refunded")').maybeSingle();if(r)throw new Error("Vous avez déjà une inscription pour cet événement");const{data:i}=await re.from("waitlist").select("id").eq("event_id",n).eq("user_id",t.id).in("status",["waiting","notified"]).maybeSingle();if(i)throw new Error("Vous êtes déjà sur la liste d'attente");const{data:a,error:o}=await re.rpc("get_next_waitlist_position",{p_event_id:n});if(o)throw o;const{data:l,error:c}=await re.from("waitlist").insert({event_id:n,user_id:t.id,position:a,status:"waiting"}).select().single();if(c)throw c;return l},onSuccess:n=>{e.invalidateQueries({queryKey:["waitlist"]}),je.success(`Vous êtes #${n.position} sur la liste d'attente`,{description:"Vous serez notifié si une place se libère"})},onError:n=>{je.error("Impossible de rejoindre la liste",{description:n.message})}})}function Ote(){const e=Ye();return dt({mutationFn:async t=>{const{error:n}=await re.from("waitlist").update({status:"cancelled"}).eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["waitlist"]}),je.success("Vous avez quitté la liste d'attente")},onError:()=>{je.error("Impossible de quitter la liste")}})}function Dte(){const e=Ye(),{user:t}=Tt();return dt({mutationFn:async({waitlistEntryId:n,eventId:r,priceCents:i,creditCents:a})=>{if(!(t!=null&&t.id))throw new Error("Non connecté");const{data:o,error:l}=await re.from("waitlist").select("*").eq("id",n).eq("user_id",t.id).eq("status","notified").single();if(l||!o)throw new Error("Notification expirée ou invalide");if(o.expires_at&&new Date(o.expires_at)<new Date)throw await re.from("waitlist").update({status:"expired"}).eq("id",n),new Error("Le délai de réservation a expiré");const{count:c}=await re.from("tickets").select("*",{count:"exact",head:!0}).eq("event_id",r).not("status","in",'("cancelled","refunded")'),{data:u}=await re.from("events").select("capacity").eq("id",r).single();if(!u||(c||0)>=u.capacity)throw new Error("Plus de place disponible");const d=`TKT-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,f=V3e(),{data:h,error:p}=await re.from("tickets").insert({event_id:r,user_id:t.id,price_paid_cents:i,credit_total_cents:a,credit_remaining_cents:a,qr_code:d,reservation_code:f,status:"paid"}).select().single();if(p)throw p;return await re.from("waitlist").update({status:"converted"}).eq("id",n),h},onSuccess:()=>{e.invalidateQueries({queryKey:["waitlist"]}),e.invalidateQueries({queryKey:["tickets"]}),e.invalidateQueries({queryKey:["event"]}),je.success("Inscription confirmée !",{description:"Votre place est réservée"})},onError:n=>{je.error("Impossible de réserver",{description:n.message})}})}function Ite(e){const t=Ye(),{user:n}=Tt();N.useEffect(()=>{if(!(n!=null&&n.id)||!e)return;const r=re.channel(`waitlist-${n.id}-${e}`).on("postgres_changes",{event:"UPDATE",schema:"public",table:"waitlist",filter:`user_id=eq.${n.id}`},i=>{i.new.status==="notified"&&("Notification"in window&&Notification.permission==="granted"&&new Notification("🎉 Place disponible !",{body:"Une place s'est libérée. Réservez maintenant !",icon:"/favicon.png"}),je.success("🎉 Une place s'est libérée !",{description:"Réservez avant que le délai n'expire",duration:1e4})),t.invalidateQueries({queryKey:["waitlist"]})}).subscribe();return()=>{re.removeChannel(r)}},[n==null?void 0:n.id,e,t])}function e5e(){const{user:e}=Tt();return st({queryKey:["waitlist","user",e==null?void 0:e.id],queryFn:async()=>
1136{if(!(e!=null&&e.id))return[];const{data:t,error:n}=await re.from("waitlist").select(`
1137          *,
1138          event:event_id (
1139            id,
1140            title,
1141            event_date,
1142            price_cents,
1143            credit_amount_cents,
1144            venue:venue_id (
1145              name
1146            )
1147          )
1148        `).eq("user_id",e.id).in("status",["waiting","notified"]).order("created_at",{ascending:!1});if(n)throw n;return t||[]},enabled:!!(e!=null&&e.id),staleTime:3e4})}var Rte="AlertDialog",[t5e]=Us(Rte,[gJ]),jd=gJ(),Mte=e=>{const{__scopeAlertDialog:t,...n}=e,r=jd(t);return s.jsx(Lb,{...r,...n,modal:!0})};Mte.displayName=Rte;var n5e="AlertDialogTrigger",Lte=N.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=jd(n);return s.jsx(tR,{...i,...r,ref:t})});Lte.displayName=n5e;var r5e="AlertDialogPortal",Fte=e=>{const{__scopeAlertDialog:t,...n}=e,r=jd(t);return s.jsx(Fb,{...r,...n})};Fte.displayName=r5e;var s5e="AlertDialogOverlay",$te=N.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=jd(n);return s.jsx(pp,{...i,...r,ref:t})});$te.displayName=s5e;var Gg="AlertDialogContent",[i5e,a5e]=t5e(Gg),o5e=mY("AlertDialogContent"),Bte=N.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...i}=e,a=jd(n),o=N.useRef(null),l=Qt(t,o),c=N.useRef(null);return s.jsx(SCe,{contentName:Gg,titleName:zte,docsSlug:"alert-dialog",children:s.jsx(i5e,{scope:n,cancelRef:c,children:s.jsxs(gp,{role:"alertdialog",...a,...i,ref:l,onOpenAutoFocus:Je(i.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[s.jsx(o5e,{children:r}),s.jsx(c5e,{contentRef:o})]})})})});Bte.displayName=Gg;var zte="AlertDialogTitle",Ute=N.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=jd(n);return s.jsx(S0,{...i,...r,ref:t})});Ute.displayName=zte;var qte="AlertDialogDescription",Vte=N.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=jd(n);return s.jsx(A0,{...i,...r,ref:t})});Vte.displayName=qte;var l5e="AlertDialogAction",Hte=N.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=jd(n);return s.jsx(T0,{...i,...r,ref:t})});Hte.displayName=l5e;var Wte="AlertDialogCancel",Gte=N.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=a5e(Wte,n),a=jd(n),o=Qt(t,i);return s.jsx(T0,{...a,...r,ref:o})});Gte.displayName=Wte;var c5e=({contentRef:e})=>{const t=`\`${Gg}\` requires a description for the component to be accessible for screen reader users.
1149
1150You can add a description to the \`${Gg}\` by passing a \`${qte}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
1151
1152Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Gg}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
1153
1154For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return N.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},u5e=Mte,d5e=Lte,f5e=Fte,Kte=$te,Yte=Bte,Xte=Hte,Qte=Gte,Jte=Ute,Zte=Vte;const yr=u5e,P2=d5e,h5e=f5e,ene=N.forwardRef(({className:e,...t},n)=>s.jsx(Kte,{className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));ene.displayName=Kte.displayName;const sr=N.forwardRef(({className:e,...t},n)=>s.jsxs(h5e,{children:[s.jsx(ene,{}),s.jsx(Yte,{ref:n,className:ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
1154nded-lg",e),...t})]}));sr.displayName=Yte.displayName;const ir=({className:e,...t})=>s.jsx("div",{className:ae("flex flex-col space-y-2 text-center sm:text-left",e),...t});ir.displayName="AlertDialogHeader";const ar=({className:e,...t})=>s.jsx("div",{className:ae("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ar.displayName="AlertDialogFooter";const or=N.forwardRef(({className:e,...t},n)=>s.jsx(Jte,{ref:n,className:ae("text-lg font-semibold",e),...t}));or.displayName=Jte.displayName;const lr=N.forwardRef(({className:e,...t},n)=>s.jsx(Zte,{ref:n,className:ae("text-sm text-muted-foreground",e),...t}));lr.displayName=Zte.displayName;const vr=N.forwardRef(({className:e,...t},n)=>s.jsx(Xte,{ref:n,className:ae(b1(),e),...t}));vr.displayName=Xte.displayName;const cr=N.forwardRef(({className:e,...t},n)=>s.jsx(Qte,{ref:n,className:ae(b1({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));cr.displayName=Qte.displayName;function m5e({expiresAt:e}){const[t,n]=N.useState("");return N.useEffect(()=>{const r=()=>{const a=new Date,l=new Date(e).getTime()-a.getTime();if(l<=0){n("Expiré");return}const c=Math.floor(l/6e4),u=Math.floor(l%6e4/1e3);n(`${c}:${u.toString().padStart(2,"0")}`)};r();const i=setInterval(r,1e3);return()=>clearInterval(i)},[e]),s.jsx("span",{className:ae("font-mono font-bold",t==="Expiré"?"text-destructive":"text-primary"),children:t})}function p5e(){const{data:e,isLoading:t}=e5e(),n=Ote(),r=Dte(),[i,a]=N.useState(null);if(t)return s.jsxs(Se,{className:"waitlist-card",children:[s.jsx(kt,{children:s.jsx(Ie,{className:"h-6 w-48"})}),s.jsxs(De,{className:"space-y-3",children:[s.jsx(Ie,{className:"h-20 w-full"}),s.jsx(Ie,{className:"h-20 w-full"})]})]});if(!e||e.length===0)return null;const o=c=>{n.mutate(c),a(null)},l=c=>{var u,d;r.mutate({waitlistEntryId:c.id,eventId:c.event_id,priceCents:((u=c.event)==null?void 0:u.price_cents)||0,creditCents:((d=c.event)==null?void 0:d.credit_amount_cents)||0})};return s.jsxs(s.Fragment,{children:[s.jsxs(Se,{className:"waitlist-card overflow-hidden",children:[s.jsx(kt,{className:"pb-3",children:s.jsxs(Et,{className:"flex items-center gap-2 text-lg",children:[s.jsx(Vt,{className:"h-5 w-5 text-primary"}),"Listes d'attente"]})}),s.jsx(De,{className:"space-y-3",children:e.map(c=>{var f;const u=c.status==="notified",d=c.event;return d?s.jsxs("div",{className:ae("relative p-4 rounded-xl border transition-all",u?"waitlist-urgent border-primary/30":"bg-muted/30 border-border/50"),children:[u&&s.jsxs(we,{className:"absolute -top-2 right-3 bg-primary text-primary-foreground animate-pulse",children:[s.jsx(Ti,{className:"h-3 w-3 mr-1"}),"Place disponible !"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"font-semibold text-foreground pr-20",children:d.title}),s.jsxs("div",{className:"flex flex-wrap gap-3 text-sm text-muted-foreground",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(gn,{className:"h-3.5 w-3.5"}),(f=d.venue)==null?void 0:f.name]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Jn,{className:"h-3.5 w-3.5"}),Ze(new Date(d.event_date),"EEE d MMM - HH:mm",{locale:pt})]})]}),s.jsx("div",{className:"flex items-center gap-2 mt-3 pt-3 border-t border-border/30",children:u?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[s.jsx(Vt,{className:"h-4 w-4 text-primary"}),s.jsx("span",{className:"text-muted-foreground",children:"Expire :"}),s.jsx(m5e,{expiresAt:c.expires_at})]}),s.jsx(Q,{size:"sm",className:"ml-auto",onClick:()=>l(c),disabled:r.isPending,children:"Réserver"})]}):s.jsxs(s.Fragment,{children:[s.jsxs(we,{variant:"secondary",children:["Position #",c.position]}),s.jsxs(Pe,{to:`/events/${d.id}`,className:"ml-auto text-sm text-primary hover:underline flex items-center gap-1",children:["Voir ",s.jsx(pd,{className:"h-3 w-3"})]}),s.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>a(c.id),children:s.jsx(Er,{className:"h-4 w-4"})})]})})]})]},c.id):null})})]}),s.jsx(yr,{open:!!i,onOpenChange:()=>a(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Qu
1154itter la liste d'attente ?"}),s.jsx(lr,{children:"Vous perdrez votre position dans la file."})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsx(vr,{onClick:()=>i&&o(i),className:"bg-destructive text-destructive-foreground",children:"Quitter"})]})]})})]})}const BR=N.createContext({});function zR(e){const t=N.useRef(null);return t.current===null&&(t.current=e()),t.current}const UR=typeof window<"u",tne=UR?N.useLayoutEffect:N.useEffect,AC=N.createContext(null);function qR(e,t){e.indexOf(t)===-1&&e.push(t)}function VR(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const uu=(e,t,n)=>n>t?t:n<e?e:n;let HR=()=>{};const ld={},nne=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function rne(e){return typeof e=="object"&&e!==null}const sne=e=>/^0[^.\s]+$/u.test(e);function WR(e){let t;return()=>(t===void 0&&(t=e()),t)}const Tl=e=>e,g5e=(e,t)=>n=>t(e(n)),Xb=(...e)=>e.reduce(g5e),k1=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class GR{constructor(){this.subscriptions=[]}add(t){return qR(this.subscriptions,t),()=>VR(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let a=0;a<i;a++){const o=this.subscriptions[a];o&&o(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Hu=e=>e*1e3,_l=e=>e/1e3;function ine(e,t){return t?e*(1e3/t):0}const ane=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,x5e=1e-7,y5e=12;function v5e(e,t,n,r,i){let a,o,l=0;do o=t+(n-t)/2,a=ane(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>x5e&&++l<y5e);return o}function Qb(e,t,n,r){if(e===t&&n===r)return Tl;const i=a=>v5e(a,0,1,e,n);return a=>a===0||a===1?a:ane(i(a),t,r)}const one=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,lne=e=>t=>1-e(1-t),cne=Qb(.33,1.53,.69,.99),KR=lne(cne),une=one(KR),dne=e=>(e*=2)<1?.5*KR(e):.5*(2-Math.pow(2,-10*(e-1))),YR=e=>1-Math.sin(Math.acos(e)),fne=lne(YR),hne=one(YR),b5e=Qb(.42,0,1,1),w5e=Qb(0,0,.58,1),mne=Qb(.42,0,.58,1),_5e=e=>Array.isArray(e)&&typeof e[0]!="number",pne=e=>Array.isArray(e)&&typeof e[0]=="number",j5e={linear:Tl,easeIn:b5e,easeInOut:mne,easeOut:w5e,circIn:YR,circInOut:hne,circOut:fne,backIn:KR,backInOut:une,backOut:cne,anticipate:dne},N5e=e=>typeof e=="string",w7=e=>{if(pne(e)){HR(e.length===4);const[t,n,r,i]=e;return Qb(t,n,r,i)}else if(N5e(e))return j5e[e];return e},c_=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function k5e(e,t){let n=new Set,r=new Set,i=!1,a=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(d){o.has(d)&&(u.schedule(d),e()),d(l)}const u={schedule:(d,f=!1,h=!1)=>{const x=h&&i?n:r;return f&&o.add(d),x.has(d)||x.add(d),d},cancel:d=>{r.delete(d),o.delete(d)},process:d=>{if(l=d,i){a=!0;return}i=!0,[n,r]=[r,n],n.forEach(c),n.clear(),i=!1,a&&(a=!1,u.process(d))}};return u}const C5e=40;function gne(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=c_.reduce((j,E)=>(j[E]=k5e(a),j),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:f,preRender:h,render:p,postRender:x}=o,y=()=>{const j=ld.useManualTiming?i.timestamp:performance.now();n=!1,ld.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(j-i.timestamp,C5e),1)),i.timestamp=j,i.isProcessing=!0,l.process(i),c.process(i),u.process(i),d.process(i),f.process(i),h.process(i),p.process(i),x.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(y))},b=()=>{n=!0,r=!0,i.isProcessing||e(y)};return{schedule:c_.reduce((j,E)=>{const S=o[E];return j[E]=(T,P=!1,O=!1)=>(n||b(),S.schedule(T,P,O)),j},{}),cancel:j=>{for(let E=0;E<c_.length;E++)o[c_[E]].cancel(j)},state:i,steps:o}}const{schedule:ls,cancel:zf,state:ra,steps:BA}=gne(typeof requestAnimationFrame<"u"?requestAnimationFrame:Tl,!0);let wj;function E5e(){wj=void 0}const La={now:()=>(wj===void 0&&La.set(ra.isProcessing||ld.useManualTiming?ra.timestamp:performance.now()),wj),set:e=>{wj=e,queueMicrotask(E5e)}},xne=e=>t=>typeof t=="string"&&t.startsWith(e),yne=xne("--"),S5e=xne("var(--"),XR=e=>S5e(e)?A5e.test(e.split("/*")[0].trim()):!1,A5e=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function _7(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const P0={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},C1={...P0,transform:e=>uu(0,1,e)},u_={...P0,default:1},Nv=e=>Math.round(e*1e5)/1e5,QR=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function T5e(e){return e==null}const P5e=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,JR=(e,t)=>n=>!!(typeof n=="string"&&P5e.test(n)&&n.startsWith(e)||t&&!T5e(n)&&Object.prototype.hasOwnProperty.call(n,t)),vne=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,a,o,l]=r.match(QR);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},O5e=e=>uu(0,255,e),zA={...P0,transform:e=>Math.round(O5e(e))},im={test:JR("rgb","red"),parse:vne("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+zA.transform(e)+", "+zA.transform(t)+", "+zA.transform(n)+", "+Nv(C1.transform(r))+")"};function D5e(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alph
vendor: 23,275 bytes, line 1154
1154a:i?parseInt(i,16)/255:1}}const kT={test:JR("#"),parse:D5e,transform:im.transform},Jb=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Vd=Jb("deg"),iu=Jb("%"),_t=Jb("px"),I5e=Jb("vh"),R5e=Jb("vw"),j7={...iu,parse:e=>iu.parse(e)/100,transform:e=>iu.transform(e*100)},wg={test:JR("hsl","hue"),parse:vne("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+iu.transform(Nv(t))+", "+iu.transform(Nv(n))+", "+Nv(C1.transform(r))+")"},si={test:e=>im.test(e)||kT.test(e)||wg.test(e),parse:e=>im.test(e)?im.parse(e):wg.test(e)?wg.parse(e):kT.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?im.transform(e):wg.transform(e),getAnimatableNone:e=>{const t=si.parse(e);return t.alpha=0,si.transform(t)}},M5e=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function L5e(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(QR))==null?void 0:t.length)||0)+(((n=e.match(M5e))==null?void 0:n.length)||0)>0}const bne="number",wne="color",F5e="var",$5e="var(",N7="${}",B5e=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function E1(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let a=0;const l=t.replace(B5e,c=>(si.test(c)?(r.color.push(a),i.push(wne),n.push(si.parse(c))):c.startsWith($5e)?(r.var.push(a),i.push(F5e),n.push(c)):(r.number.push(a),i.push(bne),n.push(parseFloat(c))),++a,N7)).split(N7);return{values:n,split:l,indexes:r,types:i}}function _ne(e){return E1(e).values}function jne(e){const{split:t,types:n}=E1(e),r=t.length;return i=>{let a="";for(let o=0;o<r;o++)if(a+=t[o],i[o]!==void 0){const l=n[o];l===bne?a+=Nv(i[o]):l===wne?a+=si.transform(i[o]):a+=i[o]}return a}}const z5e=e=>typeof e=="number"?0:si.test(e)?si.getAnimatableNone(e):e;function U5e(e){const t=_ne(e);return jne(e)(t.map(z5e))}const Uf={test:L5e,parse:_ne,createTransformer:jne,getAnimatableNone:U5e};function UA(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function q5e({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;i=UA(c,l,e+1/3),a=UA(c,l,e),o=UA(c,l,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function O2(e,t){return n=>n>0?t:e}const js=(e,t,n)=>e+(t-e)*n,qA=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},V5e=[kT,im,wg],H5e=e=>V5e.find(t=>t.test(e));function k7(e){const t=H5e(e);if(!t)return!1;let n=t.parse(e);return t===wg&&(n=q5e(n)),n}const C7=(e,t)=>{const n=k7(e),r=k7(t);if(!n||!r)return O2(e,t);const i={...n};return a=>(i.red=qA(n.red,r.red,a),i.green=qA(n.green,r.green,a),i.blue=qA(n.blue,r.blue,a),i.alpha=js(n.alpha,r.alpha,a),im.transform(i))},CT=new Set(["none","hidden"]);function W5e(e,t){return CT.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function G5e(e,t){return n=>js(e,t,n)}function ZR(e){return typeof e=="number"?G5e:typeof e=="string"?XR(e)?O2:si.test(e)?C7:X5e:Array.isArray(e)?Nne:typeof e=="object"?si.test(e)?C7:K5e:O2}function Nne(e,t){const n=[...e],r=n.length,i=e.map((a,o)=>ZR(a)(a,t[o]));return a=>{for(let o=0;o<r;o++)n[o]=i[o](a);return n}}function K5e(e,t){const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=ZR(e[i])(e[i],t[i]));return i=>{for(const a in r)n[a]=r[a](i);return n}}function Y5e(e,t){const n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const a=t.types[i],o=e.indexes[a][r[a]],l=e.values[o]??0;n[i]=l,r[a]++}return n}const X5e=(e,t)=>{const n=Uf.createTransformer(t),r=E1(e),i=E1(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?CT.has(e)&&!i.values.length||CT.has(t)&&!r.values.length?W5e(e,t):Xb(Nne(Y5e(r,i),i.values),n):O2(e,t)};function kne(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?js(e,t,n):ZR(e)(e,t)}const Q5e=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>ls.update(t,n),stop:()=>zf(t),now:()=>ra.isProcessing?ra.timestamp:La.now()}},Cne=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let a=0;a<i;a++)r+=Math.round(e(a/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},D2=2e4;function eM(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<D2;)t+=n,r=e.next(t);return t>=D2?1/0:t}function J5e(e,t=100,n){const r=n({...e,keyframes:[0,t]}),i=Math.min(eM(r),D2);return{type:"keyframes",ease:a=>r.next(i*a).value/t,duration:_l(i)}}const Z5e=5;function Ene(e,t,n){const r=Math.max(t-Z5e,0);return ine(n-e(r),t-r)}const Ds={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},VA=.001;function eTe({duration:e=Ds.duration,bounce:t=Ds.bounce,velocity:n=Ds.velocity,mass:r=Ds.mass}){let i,a,o=1-t;o=uu(Ds.minDamping,Ds.maxDamping,o),e=uu(Ds.minDuration,Ds.maxDuration,_l(e)),o<1?(i=u=>{const d=u*o,f=d*e,h=d-n,p=ET(u,o),x=Math.exp(-f);return VA-h/p*x},a=u=>{const f=u*o*e,h=f*n+n,p=Math.pow(o,2)*Math.pow(u,2)*e,x=Math.exp(-f),y=ET(Math.pow(u,2),o);return(-i(u)+VA>0?-1:1)*((h-p)*x)/y}):(i=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-VA+d*f},a=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=nTe(i,a,l);if(e=Hu(e),isNaN(c))return{stiffness:Ds.stiffness,damping:Ds.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:e}}}const tTe=12;function nTe(e,t,n){let r=n;for(let i=1;i<tTe;i++)r=r-e(r)/t(r);return r}function ET(e,t){return e*Math.sqrt(1-t*t)}const rTe=["duration","bounce"],sTe=["stiffness","damping","mass"];function E7(e,t){return t.some(n=>e[n]!==void 0)}function iTe(e){let t={velocity:Ds.velocity,stiffness:Ds.stiffness,damping:Ds.damping,mass:Ds.mass,isResolvedFromDuration:!1,...e};if(!E7(e,sTe)&&E7(e,rTe))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*uu(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Ds.mass,stiffness:i,damping:a}}else{const n=eTe(e);t={...t,...n,mass:Ds.mass},t.isResolvedFromDuration=!0}return t}function I2(e=Ds.visualDuration,t=Ds.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=n;const a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:a},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=iTe({...n,velocity:-_l(n.velocity||0)}),x=h||0,y=u/(2*Math.sqrt(c*d)),b=o-a,w=_l(Math.sqrt(c/d)),_=Math.abs(b)<5;r||(r=_?Ds.restSpeed.granular:Ds.restSpeed.default),i||(i=_?Ds.restDelta.granular:Ds.restDelta.default);let j;if(y<1){const S=ET(w,y);j=T=>{const P=Math.exp(-y*w*T);return o-P*((x+y*w*b)/S*Math.sin(S*T)+b*Math.cos(S*T))}}else if(y===1)j=S=>o-Math.exp(-w*S)*(b+(x+w*b)*S);else{const S=w*Math.sqrt(y*y-1);j=T=>{const P=Math.exp(-y*w*T),O=Math.min(S*T,300);return o-P*((x+y*w*b)*Math.sinh(O)+S*b*Math.cosh(O))/S}}const E={calculatedDuration:p&&f||null,next:S=>{const T=j(S);if(p)l.done=S>=f;else{let P=S===0?x:0;y<1&&(P=S===0?Hu(x):Ene(j,S,T));const O=Math.abs(P)<=r,D=Math.abs(o-T)<=i;l.done=O&&D}return l.value=l.done?o:T,l},toString:()=>{const S=Math.min(eM(E),D2),T=Cne(P=>E.next(S*P).value,S,30);return S+"ms "+T},toTransition:()=>{}};return E}I2.applyToOptions=e=>{const t=J5e(e,100,I2);return e.ease=t.ease,e.duration=Hu(t.duration),e.type="keyframes",e};function ST({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=O=>l!==void 0&&O<l||c!==void 0&&O>c,x=O=>l===void 0?c:c===void 0||Math.abs(l-O)<Math.abs(c-O)?l:c;let y=n*t;const b=f+y,w=o===void 0?b:o(b);w!==b&&(y=w-f);const _=O=>-y*Math.exp(-O/r),j=O=>w+_(O),E=O=>{const D=_(O),R=j(O);h.done=Math.abs(D)<=u,h.value=h.done?w:R};let S,T;const P=O=>{p(h.value)&&(S=O,T=I2({keyframes:[h.value,x(h.value)],velocity:Ene(j,O,h.value),damping:i,stiffness:a,restDelta:u,restSpeed:d}))};return P(0),{calculatedDuration:null,next:O=>{let D=!1;return!T&&S===void 0&&(D=!0,E(O),P(O)),S!==void 0&&O>=S?T.next(O-S):(!D&&E(O),h)}}}function aTe(e,t,n){const r=[],i=n||ld.mix||kne,a=e.length-1;for(let o=0;o<a;o++){let l=i(e[o],e[o+1]);if(t){const c=Array.isArray(t)?t[o]||Tl:t;l=Xb(c,l)}r.push(l)}return r}function oTe(e,t,{clamp:n=!0,ease:r,mixer:i}={}){const a=e.length;if(HR(a===t.length),a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=aTe(t,r,i),c=l.length,u=d=>{if(o&&d<e[0])return t[0];let f=0;if(c>1)for(;f<e.length-2&&!(d<e[f+1]);f++);const h=k1(e[f],e[f+1],d);return l[f](h)};return n?d=>u(uu(e[0],e[a-1],d)):u}function lTe(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=k1(0,t,r);e.push(js(n,1,i))}}function cTe(e){const t=[0];return lTe(t,e.length-1),t}function uTe(e,t){return e.map(n=>n*t)}function dTe(e,t){return e.map(()=>t||mne).splice(0,e.length-1)}function kv({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=_5e(r)?r.map(w7):w7(r),a={done:!1,value:t[0]},o=uTe(n&&n.length===t.length?n:cTe(t),e),l=oTe(o,t,{ease:Array.isArray(i)?i:dTe(t,i)});return{calculatedDuration:e,next:c=>(a.value=l(c),a.done=c>=e,a)}}const fTe=e=>e!==null;function tM(e,{repeat:t,repeatType:n="loop"},r,i=1){const a=e.filter(fTe),l=i<0||t&&n!=="loop"&&t%2===1?0:a.length-1;return!l||r===void 0?a[l]:r}const hTe={decay:ST,inertia:ST,tween:kv,keyframes:kv,spring:I2};function Sne(e){typeof e.type=="string"&&(e.type=hTe[e.type])}class nM{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const mTe=e=>e/100;class rM extends nM{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var r,i;const{motionValue:n}=this.options;n&&n.updatedAt!==La.now()&&this.tick(La.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(i=(r=this.options).onStop)==null||i.call(r))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;Sne(t);const{type:n=kv,repeat:r=0,repeatDelay:i=0,repeatType:a,velocity:o=0}=t;let{keyframes:l}=t;const c=n||kv;c!==kv&&typeof l[0]!="number"&&(this.mixKeyframes=Xb(mTe,kne(l[0],l[1])),l=[0,100]);const u=c({...t,keyframes:l});a==="mirror"&&(this.mirroredGenerator=c({...t,keyframes:[...l].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=eM(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=u}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:i,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:d,repeat:f,repeatType:h,repeatDelay:p,type:x,onUpdate:y,finalKeyframe:b}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const w=this.currentTime-u*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?w<0:w>i;this.currentTime=Math.max(w,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let j=this.currentTime,E=r;if(f){const O=Math.min(this.currentTime,i)/l;let D=Math.floor(O),R=O%1;!R&&O>=1&&(R=1),R===1&&D--,D=Math.min(D,f+1),!!(D%2)&&(h==="reverse"?(R=1-R,p&&(R-=p/l)):h==="mirror"&&(E=o)),j=uu(0,1,R)*l}const S=_?{done:!1,value:d[0]}:E.next(j);a&&(S.value=a(S.value));let{done:T}=S;!_&&c!==null&&(T=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const P=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&T);return P&&x!==ST&&(S.value=tM(d,this.options,b,this.speed)),y&&y(S.value),P&&this.finish(),S}then(t,n){return this.finished.then(t,n)}get duration(){return _l(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+_l(t)}get time(){return _l(this.currentTime)}set time(t){var n;t=Hu(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(La.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=_l(this.currentTime))}play(){var i,a;if(this.isStopped)return;const{driver:t=Q5e,startTime:n}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),(a=(i=this.options).onPlay)==null||a.call(i);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(La.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function pTe(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const am=e=>e*180/Math.PI,AT=e=>{const t=am(Math.atan2(e[1],e[0]));return TT(t)},gTe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:AT,rotateZ:AT,skewX:e=>am(Math.atan(e[1])),skewY:e=>am(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},TT=e=>(e=e%360,e<0&&(e+=360),e),S7=AT,A7=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),T7=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),xTe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:A7,scaleY:T7,scale:e=>(A7(e)+T7(e))/2,rotateX:e=>TT(am(Math.atan2(e[6],e[5]))),rotateY:e=>TT(am(Math.atan2(-e[2],e[0]))),rotateZ:S7,rotate:S7,skewX:e=>am(Math.atan(e[4])),skewY:e=>am(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function PT(e){return e.includes("scale")?1:0}function OT(e,t){if(!e||e==="none")return PT(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=xTe,i=n;else{const l=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=gTe,i=l}if(!i)return PT(t);const a=r[t],o=i[1].split(",").map(vTe);return typeof a=="function"?a(o):o[a]}const yTe=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return OT(n,t)};function vTe(e){return parseFloat(e.trim())}const O0=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],D0=new Set(O0),P7=e=>e===P0||e===_t,bTe=new Set(["x","y","z"]),wTe=O0.filter(e=>!bTe.has(e));function _Te(e){const t=[];return wTe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const mf={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>OT(t,"x"),y:(e,{transform:t})=>OT(t,"y")};mf.translateX=mf.x;mf.translateY=mf.y;const Em=new Set;let DT=!1,IT=!1,RT=!1;function Ane(){if(IT){const e=Array.from(Em).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=_Te(r);i.length&&(n.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([a,o])=>{var l;(l=r.getValue(a))==null||l.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}IT=!1,DT=!1,Em.forEach(e=>e.complete(RT)),Em.clear()}function Tne(){Em.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(IT=!0)})}function jTe(){RT=!0,Tne(),Ane(),RT=!1}class sM{constructor(t,n,r,i,a,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=i,this.element=a,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Em.add(this),DT||(DT=!0,ls.read(Tne),ls.resolveKeyframes(Ane))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:i}=this;if(t[0]===null){const a=i==null?void 0:i.get(),o=t[t.length-1];if(a!==void 0)t[0]=a;else if(r&&n){const l=r.readValue(n,o);l!=null&&(t[0]=l)}t[0]===void 0&&(t[0]=o),i&&a===void 0&&i.set(t[0])}pTe(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Em.delete(this)}cancel(){this.state==="scheduled"&&(Em.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const NTe=e=>e.startsWith("--");function kTe(e,t,n){NTe(t)?e.style.setProperty(t,n):e.style[t]=n}const CTe=WR(()=>window.ScrollTimeline!==void 0),ETe={};function STe(e,t){const n=WR(e);return()=>ETe[t]??n()}const Pne=STe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),iv=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,O7={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:iv([0,.65,.55,1]),circOut:iv([.55,0,1,.45]),backIn:iv([.31,.01,.66,-.59]),backOut:iv([.33,1.53,.69,.99])};function One(e,t){if(e)return typeof e=="function"?Pne()?Cne(e,t):"ease-out":pne(e)?iv(e):Array.isArray(e)?e.map(n=>One(n,t)||O7.easeOut):O7[e]}function ATe(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o="loop",ease:l="easeOut",times:c}={},u=void 0){const d={[t]:n};c&&(d.offset=c);const f=One(l,i);Array.isArray(f)&&(d.easing=f);const h={delay:r,duration:i,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:a+1,direction:o==="reverse"?"alternate":"normal"};return u&&(h.pseudoElement=u),e.animate(d,h)}function Dne(e){return typeof e=="function"&&"applyToOptions"in e}function TTe({type:e,...t}){return Dne(e)&&Pne()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class PTe extends nM{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:i,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:l,onComplete:c}=t;this.isPseudoElement=!!a,this.allowFlatten=o,this.options=t,HR(typeof t.type!="string");const u=TTe(t);this.animation=ATe(n,r,i,u,a),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const d=tM(i,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(d):kTe(n,r,d),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,n;this.isPseudoElement||(n=(t=this.animation).commitStyles)==null||n.call(t)}get duration(){var n,r;const t=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return _l(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+_l(t)}get time(){return _l(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Hu(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){var r;return this.allowFlatten&&((r=this.animation.effect)==null||r.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&CTe()?(this.animation.timeline=t,Tl):n(this)}}const Ine={anticipate:dne,backInOut:une,circInOut:hne};function OTe(e){return e in Ine}function DTe(e){typeof e.ease=="string"&&OTe(e.ease)&&(e.ease=Ine[e.ease])}const HA=10;class ITe extends PTe{constructor(t){DTe(t),Sne(t),super(t),t.startTime!==void 0&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:i,element:a,...o}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const l=new rM({...o,autoplay:!1}),c=Math.max(HA,La.now()-this.startTime),u=uu(0,HA,c-HA);n.setWithVelocity(l.sample(Math.max(0,c-u)).value,l.sample(c).value,u),l.stop()}}const D7=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Uf.test(e)||e==="0")&&!e.startsWith("url("));function RTe(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function MTe(e,t,n,r){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const a=e[e.length-1],o=D7(i,t),l=D7(a,t);return!o||!l?!1:RTe(e)||(n==="spring"||Dne(n))&&r}function MT(e){e.duration=0,e.type="keyframes"}const LTe=new Set(["opacity","clipPath","filter","transform"]),FTe=WR(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function $Te(e){var d;const{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!(((d=t==null?void 0:t.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=t.owner.getProps();return FTe()&&n&&LTe.has(n)&&(n!=="transform"||!u)&&!c&&!r&&i!=="mirror"&&a!==0&&o!=="inertia"}const BTe=40;class zTe extends nM{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:a=0,repeatType:
1154o="loop",keyframes:l,name:c,motionValue:u,element:d,...f}){var x;super(),this.stop=()=>{var y,b;this._animation&&(this._animation.stop(),(y=this.stopTimeline)==null||y.call(this)),(b=this.keyframeResolver)==null||b.cancel()},this.createdAt=La.now();const h={autoplay:t,delay:n,type:r,repeat:i,repeatDelay:a,repeatType:o,name:c,motionValue:u,element:d,...f},p=(d==null?void 0:d.KeyframeResolver)||sM;this.keyframeResolver=new p(l,(y,b,w)=>this.onKeyframesResolved(y,b,h,!w),c,u,d),(x=this.keyframeResolver)==null||x.scheduleResolve()}onKeyframesResolved(t,n,r,i){this.keyframeResolver=void 0;const{name:a,type:o,velocity:l,delay:c,isHandoff:u,onUpdate:d}=r;this.resolvedAt=La.now(),MTe(t,a,o,l)||((ld.instantAnimations||!c)&&(d==null||d(tM(t,r,n))),t[0]=t[t.length-1],MT(r),r.repeat=0);const h={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>BTe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},p=!u&&$Te(h)?new ITe({...h,element:h.motionValue.owner.current}):new rM(h);p.finished.then(()=>this.notifyFinished()).catch(Tl),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),jTe()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}const UTe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function qTe(e){const t=UTe.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function Rne(e,t,n=1){const[r,i]=qTe(e);if(!r)return;const a=window.getComputedStyle(t).getPropertyValue(r);if(a){const o=a.trim();return nne(o)?parseFloat(o):o}return XR(i)?Rne(i,t,n+1):i}function iM(e,t){return(e==null?void 0:e[t])??(e==null?void 0:e.default)??e}const Mne=new Set(["width","height","top","left","right","bottom",...O0]),VTe={test:e=>e==="auto",parse:e=>e},Lne=e=>t=>t.test(e),Fne=[P0,_t,iu,Vd,R5e,I5e,VTe],I7=e=>Fne.find(Lne(e));function HTe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||sne(e):!0}const WTe=new Set(["brightness","contrast","saturate","opacity"]);function GTe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(QR)||[];if(!r)return e;const i=n.replace(r,"");let a=WTe.has(t)?1:0;return r!==n&&(a*=100),t+"("+a+i+")"}const KTe=/\b([a-z-]*)\(.*?\)/gu,LT={...Uf,getAnimatableNone:e=>{const t=e.match(KTe);return t?t.map(GTe).join(" "):e}},R7={...P0,transform:Math.round},YTe={rotate:Vd,rotateX:Vd,rotateY:Vd,rotateZ:Vd,scale:u_,scaleX:u_,scaleY:u_,scaleZ:u_,skew:Vd,skewX:Vd,skewY:Vd,distance:_t,translateX:_t,translateY:_t,translateZ:_t,x:_t,y:_t,z:_t,perspective:_t,transformPerspective:_t,opacity:C1,originX:j7,originY:j7,originZ:_t},aM={borderWidth:_t,borderTopWidth:_t,borderRightWidth:_t,borderBottomWidth:_t,borderLeftWidth:_t,borderRadius:_t,radius:_t,borderTopLeftRadius:_t,borderTopRightRadius:_t,borderBottomRightRadius:_t,borderBottomLeftRadius:_t,width:_t,maxWidth:_t,height:_t,maxHeight:_t,top:_t,right:_t,bottom:_t,left:_t,inset:_t,insetBlock:_t,insetBlockStart:_t,insetBlockEnd:_t,insetInline:_t,insetInlineStart:_t,insetInlineEnd:_t,padding:_t,paddingTop:_t,paddingRight:_t,paddingBottom:_t,paddingLeft:_t,paddingBlock:_t,paddingBlockStart:_t,paddingBlockEnd:_t,paddingInline:_t,paddingInlineStart:_t,paddingInlineEnd:_t,margin:_t,marginTop:_t,marginRight:_t,marginBottom:_t,marginLeft:_t,marginBlock:_t,marginBlockStart:_t,marginBlockEnd:_t,marginInline:_t,marginInlineStart:_t,marginInlineEnd:_t,backgroundPositionX:_t,backgroundPositionY:_t,...YTe,zIndex:R7,fillOpacity:C1,strokeOpacity:C1,numOctaves:R7},XTe={...aM,color:si,backgroundColor:si,outlineColor:si,fill:si,stroke:si,borderColor:si,borderTopColor:si,borderRightColor:si,borderBottomColor:si,borderLeftColor:si,filter:LT,WebkitFilter:LT},$ne=e=>XTe[e];function Bne(e,t){let n=$ne(e);return n!==LT&&(n=Uf),n.getAnimatableNone?n.getAnimatableNone(t):void 0}
vendor: 10,520 bytes, lines 1154-1162
1154const QTe=new Set(["auto","none","0"]);function JTe(e,t,n){let r=0,i;for(;r<e.length&&!i;){const a=e[r];typeof a=="string"&&!QTe.has(a)&&E1(a).values.length&&(i=e[r]),r++}if(i&&n)for(const a of t)e[a]=Bne(n,i)}class ZTe extends sM{constructor(t,n,r,i,a){super(t,n,r,i,a,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let d=0;d<t.length;d++){let f=t[d];if(typeof f=="string"&&(f=f.trim(),XR(f))){const h=Rne(f,n.current);h!==void 0&&(t[d]=h),d===t.length-1&&(this.finalKeyframe=f)}}if(this.resolveNoneKeyframes(),!Mne.has(r)||t.length!==2)return;const[i,a]=t,o=I7(i),l=I7(a),c=_7(i),u=_7(a);if(c!==u&&mf[r]){this.needsMeasurement=!0;return}if(o!==l)if(P7(o)&&P7(l))for(let d=0;d<t.length;d++){const f=t[d];typeof f=="string"&&(t[d]=parseFloat(f))}else mf[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let i=0;i<t.length;i++)(t[i]===null||HTe(t[i]))&&r.push(i);r.length&&JTe(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=mf[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&t.getValue(r,i).jump(i,!1)}measureEndState(){var l;const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const i=t.getValue(n);i&&i.jump(this.measuredOrigin,!1);const a=r.length-1,o=r[a];r[a]=mf[n](t.measureViewportBox(),window.getComputedStyle(t.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([c,u])=>{t.getValue(c).set(u)}),this.resolveNoneKeyframes()}}function ePe(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const i=(n==null?void 0:n[e])??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}const zne=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Une(e){return rne(e)&&"offsetHeight"in e}const M7=30,tPe=e=>!isNaN(parseFloat(e));class nPe{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var a;const i=La.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((a=this.events.change)==null||a.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=La.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=tPe(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new GR);const r=this.events[t].add(n);return t==="change"?()=>{r(),ls.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=La.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>M7)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,M7);return ine(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Lx(e,t){return new nPe(e,t)}const{schedule:oM}=gne(queueMicrotask,!1),Xl={x:!1,y:!1};function qne(){return Xl.x||Xl.y}function rPe(e){return e==="x"||e==="y"?Xl[e]?null:(Xl[e]=!0,()=>{Xl[e]=!1}):Xl.x||Xl.y?null:(Xl.x=Xl.y=!0,()=>{Xl.x=Xl.y=!1})}function Vne(e,t){const n=ePe(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function L7(e){return!(e.pointerType==="touch"||qne())}function sPe(e,t,n={}){const[r,i,a]=Vne(e,n),o=l=>{if(!L7(l))return;const{target:c}=l,u=t(c,l);if(typeof u!="function"||!c)return;const d=f=>{L7(f)&&(u(f),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,i)};return r.forEach(l=>{l.addEventListener("pointerenter",o,i)}),a}const Hne=(e,t)=>t?e===t?!0:Hne(e,t.parentElement):!1,lM=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,iPe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Wne(e){return iPe.has(e.tagName)||e.isContentEditable===!0}const _j=new WeakSet;function F7(e){return t=>{t.key==="Enter"&&e(t)}}function WA(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const aPe=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=F7(()=>{if(_j.has(n))return;WA(n,"down");const i=F7(()=>{WA(n,"up")}),a=()=>WA(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",a,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function $7(e){return lM(e)&&!qne()}function oPe(e,t,n={}){const[r,i,a]=Vne(e,n),o=l=>{const c=l.currentTarget;if(!$7(l))return;_j.add(c);const u=t(c,l),d=(p,x)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),_j.has(c)&&_j.delete(c),$7(p)&&typeof u=="function"&&u(p,{success:x})},f=p=>{d(p,c===window||c===document||n.useGlobalTarget||Hne(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",h,i)};return r.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,i),Une(l)&&(l.addEventListener("focus",u=>aPe(u,i)),!Wne(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),a}function Gne(e){return rne(e)&&"ownerSVGElement"in e}function lPe(e){return Gne(e)&&e.tagName==="svg"}const wa=e=>!!(e&&e.getVelocity),cPe=[...Fne,si,Uf],uPe=e=>cPe.find(Lne(e)),cM=N.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function B7(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function dPe(...e){return t=>{let n=!1;const r=e.map(i=>{const a=B7(i,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i<r.length;i++){const a=r[i];typeof a=="function"?a():B7(e[i],null)}}}}function fPe(...e){return N.useCallback(dPe(...e),e)}class hPe extends N.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=n.offsetParent,i=Une(r)&&r.offsetWidth||0,a=this.props.sizeRef.current;a.height=n.offsetHeight||0,a.width=n.offsetWidth||0,a.top=n.offsetTop,a.left=n.offsetLeft,a.right=i-a.width-a.left}return null}componentDidUpdate(){}render(){return this.props.children}}function mPe({children:e,isPresent:t,anchorX:n,root:r}){var d;const i=N.useId(),a=N.useRef(null),o=N.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:l}=N.useContext(cM),c=((d=e.props)==null?void 0:d.ref)??(e==null?void 0:e.ref),u=fPe(a,c);return N.useInsertionEffect(()=>{const{width:f,height:h,top:p,left:x,right:y}=o.current;if(t||!a.current||!f||!h)return;const b=n==="left"?`left: ${x}`:`right: ${y}`;a.current.dataset.motionPopId=i;const w=document.createElement("style");l&&(w.nonce=l);const _=r??document.head;return _.appendChild(w),w.sheet&&w.sheet.insertRule(`
1155          [data-motion-pop-id="${i}"] {
1156            position: absolute !important;
1157            width: ${f}px !important;
1158            height: ${h}px !important;
1159            ${b}px !important;
1160            top: ${p}px !important;
1161          }
1162        `),()=>{_.contains(w)&&_.removeChild(w)}},[t]),s.jsx(hPe,{isPresent:t,childRef:a,sizeRef:o,children:N.cloneElement(e,{ref:u})})}const pPe=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:l,root:c})=>{const u=zR(gPe),d=N.useId();let f=!0,h=N.useMemo(()=>(f=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:p=>{u.set(p,!0);for(const x of u.values())if(!x)return;r&&r()},register:p=>(u.set(p,!1),()=>u.delete(p))}),[n,u,r]);return a&&f&&(h={...h}),N.useMemo(()=>{u.forEach((p,x)=>u.set(x,!1))},[n]),N.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),o==="popLayout"&&(e=s.jsx(mPe,{isPresent:n,anchorX:l,root:c,children:e})),s.jsx(AC.Provider,{value:h,children:e})};function gPe(){return new Map}function Kne(e=!0){const t=N.useContext(AC);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,a=N.useId();N.useEffect(()=>{if(e)return i(a)},[e]);const o=N.useCallback(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}const d_=e=>e.key||"";function z7(e){const t=[];return N.Children.forEach(e,n=>{N.isValidElement(n)&&t.push(n)}),t}const R2=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a="sync",propagate:o=!1,anchorX:l="left",root:c})=>{const[u,d]=Kne(o),f=N.useMemo(()=>z7(e),[e]),h=o&&!u?[]:f.map(d_),p=N.useRef(!0),x=N.useRef(f),y=zR(()=>new Map),b=N.useRef(new Set),[w,_]=N.useState(f),[j,E]=N.useState(f);tne(()=>{p.current=!1,x.current=f;for(let P=0;P<j.length;P++){const O=d_(j[P]);h.includes(O)?(y.delete(O),b.current.delete(O)):y.get(O)!==!0&&y.set(O,!1)}},[j,h.length,h.join("-")]);const S=[];if(f!==w){let P=[...f];for(let O=0;O<j.length;O++){const D=j[O],R=d_(D);h.includes(R)||(P.splice(O,0,D),S.push(D))}return a==="wait"&&S.length&&(P=S),E(z7(P)),_(f),null}const{forceRender:T}=N.useContext(BR);return s.jsx(s.Fragment,{children:j.map(P=>{const O=d_(P),D=o&&!u?!1:f===j||h.includes(O),R=()=>
vendor: 4,936 bytes, line 1162
1162{if(b.current.has(O))return;if(b.current.add(O),y.has(O))y.set(O,!0);else return;let L=!0;y.forEach(M=>{M||(L=!1)}),L&&(T==null||T(),E(x.current),o&&(d==null||d()),r&&r())};return s.jsx(pPe,{isPresent:D,initial:!p.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:c,onExitComplete:D?void 0:R,anchorX:l,children:P},O)})})},Yne=N.createContext({strict:!1}),U7={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Fx={};for(const e in U7)Fx[e]={isEnabled:t=>U7[e].some(n=>!!t[n])};function xPe(e){for(const t in e)Fx[t]={...Fx[t],...e[t]}}const yPe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function M2(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||yPe.has(e)}let Xne=e=>!M2(e);function vPe(e){typeof e=="function"&&(Xne=t=>t.startsWith("on")?!M2(t):e(t))}try{vPe(require("@emotion/is-prop-valid").default)}catch{}function bPe(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(Xne(i)||n===!0&&M2(i)||!t&&!M2(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}const TC=N.createContext({});function PC(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function S1(e){return typeof e=="string"||Array.isArray(e)}const uM=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],dM=["initial",...uM];function OC(e){return PC(e.animate)||dM.some(t=>S1(e[t]))}function Qne(e){return!!(OC(e)||e.variants)}function wPe(e,t){if(OC(e)){const{initial:n,animate:r}=e;return{initial:n===!1||S1(n)?n:void 0,animate:S1(r)?r:void 0}}return e.inherit!==!1?t:{}}function _Pe(e){const{initial:t,animate:n}=wPe(e,N.useContext(TC));return N.useMemo(()=>({initial:t,animate:n}),[q7(t),q7(n)])}function q7(e){return Array.isArray(e)?e.join(" "):e}function V7(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Cy={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(_t.test(e))e=parseFloat(e);else return e;const n=V7(e,t.target.x),r=V7(e,t.target.y);return`${n}% ${r}%`}},jPe={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=Uf.parse(e);if(i.length>5)return r;const a=Uf.createTransformer(e),o=typeof i[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=l,i[1+o]/=c;const u=js(l,c,.5);return typeof i[2+o]=="number"&&(i[2+o]/=u),typeof i[3+o]=="number"&&(i[3+o]/=u),a(i)}},FT={borderRadius:{...Cy,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Cy,borderTopRightRadius:Cy,borderBottomLeftRadius:Cy,borderBottomRightRadius:Cy,boxShadow:jPe};function Jne(e,{layout:t,layoutId:n}){return D0.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!FT[e]||e==="opacity")}const NPe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},kPe=O0.length;function CPe(e,t,n){let r="",i=!0;for(let a=0;a<kPe;a++){const o=O0[a],l=e[o];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(o.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const u=zne(l,aM[o]);if(!c){i=!1;const d=NPe[o]||o;r+=`${d}(${u}) `}n&&(t[o]=u)}}return r=r.trim(),n?r=n(t,i?"":r):i&&(r="none"),r}function fM(e,t,n){const{style:r,vars:i,transformOrigin:a}=e;let o=!1,l=!1;for(const c in t){const u=t[c];if(D0.has(c)){o=!0;continue}else if(yne(c)){i[c]=u;continue}else{const d=zne(u,aM[c]);c.startsWith("origin")?(l=!0,a[c]=d):r[c]=d}}if(t.transform||(o||n?r.transform=CPe(t,e.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=a;r.transformOrigin=`${c} ${u} ${d}`}}const hM=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Zne(e,t,n){for(const r in t)!wa(t[r])&&!Jne(r,n)&&(e[r]=t[r])}function EPe({transformTemplate:e},t){return N.useMemo(()=>{const n=hM();return fM(n,t,e),Object.assign({},n.vars,n.style)},[t])}function SPe(e,t){const n=e.style||{},r={};return Zne(r,n,e),Object.assign(r,EPe(e,t)),r}function APe(e,t){const n={},r=SPe(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}
1162`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const TPe={offset:"stroke-dashoffset",array:"stroke-dasharray"},PPe={offset:"strokeDashoffset",array:"strokeDasharray"};function OPe(e,t,n=1,r=0,i=!0){e.pathLength=1;const a=i?TPe:PPe;e[a.offset]=_t.transform(-r);const o=_t.transform(t),l=_t.transform(n);e[a.array]=`${o} ${l}`}const DPe=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function ere(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...l},c,u,d){if(fM(e,l,u),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:h}=e;f.transform&&(h.transform=f.transform,delete f.transform),(h.transform||f.transformOrigin)&&(h.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),h.transform&&(h.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete f.transformBox);for(const p of DPe)f[p]!==void 0&&(h[p]=f[p],delete f[p]);t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),i!==void 0&&OPe(f,i,a,o,!1)}const tre=()=>({...hM(),attrs:{}}),nre=e=>typeof e=="string"&&e.toLowerCase()==="svg";function IPe(e,t,n,r){const i=N.useMemo(()=>{const a=tre();return ere(a,t,nre(r),e.transformTemplate,e.style),{...a.attrs,style:{...a.style}}},[t]);if(e.style){const a={};Zne(a,e.style,e),i.style={...a,...i.style}}return i}const RPe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function mM(e){return typeof e!="string"||e.includes("-")?!1:!!(RPe.indexOf(e)>-1||/[A-Z]/u.test(e))}function MPe(e,t,n,{latestValues:r},i,a=!1,o){const c=(o??mM(e)?IPe:APe)(t,r,i,e),u=bPe(t,typeof e=="string",a),d=e!==N.Fragment?{...u,...c,ref:n}:{},{children:f}=t,h=N.useMemo(()=>wa(f)?f.get():f,[f]);return N.createElement(e,{...d,children:h})}function H7(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function pM(e,t,n,r){if(typeof t=="function"){const[i,a]=H7(r);t=t(n!==void 0?n:e.custom,i,a)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,a]=H7(r);t=t(n!==void 0?n:e.custom,i,a)}return t}function jj(e){return wa(e)?e.get():e}function LPe({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:FPe(n,r,i,e),renderState:t()}}function FPe(e,t,n,r){const i={},a=r(e,{});for(const h in a)i[h]=jj(a[h]);let{initial:o,animate:l}=e;const c=OC(e),u=Qne(e);t&&u&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const f=d?l:o;if(f&&typeof f!="boolean"&&!PC(f)){const h=Array.isArray(f)?f:[f];for(let p=0;p<h.length;p++){const x=pM(e,h[p]);if(x){const{transitionEnd:y,transition:b,...w}=x;for(const _ in w){let j=w[_];if(Array.isArray(j)){const E=d?j.length-1:0;j=j[E]}j!==null&&(i[_]=j)}for(const _ in y)i[_]=y[_]}}}return i}const rre=e=>(t,n)=>{const r=N.useContext(TC),i=N.useContext(AC),a=()=>LPe(e,t,r,i);return n?a():zR(a)};function gM(e,t,n){var a;const{style:r}=e,i={};for(const o in r)(wa(r[o])||t.style&&wa(t.style[o])||Jne(o,e)||((a=n==null?void 0:n.getValue(o))==null?void 0:a.liveStyle)!==void 0)&&(i[o]=r[o]);return i}const $Pe=rre({scrapeMotionValuesFromProps:gM,createRenderState:hM});function sre(e,t,n){const r=gM(e,t,n);for(const i in e)if(wa(e[i])||wa(t[i])){const a=O0.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[a]=e[i]}return r}const BPe=rre({scrapeMotionValuesFromProps:sre,createRenderState:tre}),zPe=Symbol.for("motionComponentSymbol");function UPe(e,t,n){const r=N.useRef(n);N.useInsertionEffect(()=>{r.current=n});const i=N.useRef(null);return N.useCallback(a=>{var l;a&&((l=e.onMount)==null||l.call(e,a)),t&&(a?t.mount(a):t.unmount());const o=r.current;if(typeof o=="function")if(a){const c=o(a);typeof c=="function"&&(i.current=c)}else i.current?(i.current(),i.current=null):o(a);else o&&(o.current=a)},[t])}const xM=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),qPe="framerAppearId",ire="data-"+xM(qPe),are=N.createContext({});function av(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function VPe(e,t,n,r,i,a){var b,w;const{visualElement:o}=N.useContext(TC),l=N.useContext(Yne),c=N.useContext(AC),u=N.useContext(cM).reducedMotion,d=N.useRef(null);r=r||l.renderer,!d.current&&r&&(d.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,isSVG:a}));const f=d.current,h=N.useContext(are);f&&!f.projection&&i&&(f.type==="html"||f.type==="svg")&&HPe(d.current,n,i,h);const p=N.useRef(!1);N.useInsertionEffect(()=>{f&&p.current&&f.update(n,c)});const x=n[ire],y=N.useRef(!!x&&!((b=window.MotionHandoffIsComplete)!=null&&b.call(window,x))&&((w=window.MotionHasOptimisedAnimation)==null?void 0:w.call(window,x)));return tne(()=>{f&&(p.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),f.scheduleRenderMicrotask(),y.current&&f.animationState&&f.animationState.animateChanges())}),N.useEffect(()=>{f&&(!y.current&&f.animationState&&f.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{var _;(_=window.MotionHandoffMarkAsComplete)==null||_.call(window,x)}),y.current=!1),f.enteringChildren=void 0)}),f}function HPe(e,t,n,r){const{layoutId:i,layout:a,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:ore(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||l&&av(l),visualElement:e,animationType:typeof a=="str
1162ing"?a:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:u})}function ore(e){if(e)return e.options.allowProjection!==!1?e.projection:ore(e.parent)}function GA(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&xPe(r);const a=n?n==="svg":mM(e),o=a?BPe:$Pe;function l(u,d){let f;const h={...N.useContext(cM),...u,layoutId:WPe(u)},{isStatic:p}=h,x=_Pe(u),y=o(u,p);if(!p&&UR){GPe();const b=KPe(h);f=b.MeasureLayout,x.visualElement=VPe(e,y,h,i,b.ProjectionNode,a)}return s.jsxs(TC.Provider,{value:x,children:[f&&x.visualElement?s.jsx(f,{visualElement:x.visualElement,...h}):null,MPe(e,u,UPe(y,x.visualElement,d),y,p,t,a)]})}l.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const c=N.forwardRef(l);return c[zPe]=e,c}function WPe({layoutId:e}){const t=N.useContext(BR).id;return t&&e!==void 0?t+"-"+e:e}function GPe(e,t){N.useContext(Yne).strict}function KPe(e){const{drag:t,layout:n}=Fx;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function YPe(e,t){if(typeof Proxy>"u")return GA;const n=new Map,r=(a,o)=>GA(a,o,e,t),i=(a,o)=>r(a,o);return new Proxy(i,{get:(a,o)=>o==="create"?r:(n.has(o)||n.set(o,GA(o,void 0,e,t)),n.get(o))})}function lre({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function XPe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function QPe(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function KA(e){return e===void 0||e===1}function $T({scale:e,scaleX:t,scaleY:n}){return!KA(e)||!KA(t)||!KA(n)}function $h(e){return $T(e)||cre(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function cre(e){return W7(e.x)||W7(e.y)}function W7(e){return e&&e!=="0%"}function L2(e,t,n){const r=e-n,i=t*r;return n+i}function G7(e,t,n,r,i){return i!==void 0&&(e=L2(e,i,r)),L2(e,n,r)+t}function BT(e,t=0,n=1,r,i){e.min=G7(e.min,t,n,r,i),e.max=G7(e.max,t,n,r,i)}function ure(e,{x:t,y:n}){BT(e.x,t.translate,t.scale,t.originPoint),BT(e.y,n.translate,n.scale,n.originPoint)}const K7=.999999999999,Y7=1.0000000000001;function JPe(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let l=0;l<i;l++){a=n[l],o=a.projectionDelta;const{visualElement:c}=a.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&jg(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,ure(e,o)),r&&$h(a.latestValues)&&jg(e,a.latestValues))}t.x<Y7&&t.x>K7&&(t.x=1),t.y<Y7&&t.y>K7&&(t.y=1)}function _g(e,t){e.min=e.min+t,e.max=e.max+t}function X7(e,t,n,r,i=.5){const a=js(e.min,e.max,i);BT(e,t,n,a,r)}
vendor: 4,428 bytes, line 1162
1162function jg(e,t){X7(e.x,t.x,t.scaleX,t.scale,t.originX),X7(e.y,t.y,t.scaleY,t.scale,t.originY)}function dre(e,t){return lre(QPe(e.getBoundingClientRect(),t))}function ZPe(e,t,n){const r=dre(e,n),{scroll:i}=t;return i&&(_g(r.x,i.offset.x),_g(r.y,i.offset.y)),r}const Q7=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ng=()=>({x:Q7(),y:Q7()}),J7=()=>({min:0,max:0}),ji=()=>({x:J7(),y:J7()}),zT={current:null},fre={current:!1};function eOe(){if(fre.current=!0,!!UR)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>zT.current=e.matches;e.addEventListener("change",t),t()}else zT.current=!1}const tOe=new WeakMap;function nOe(e,t,n){for(const r in t){const i=t[r],a=n[r];if(wa(i))e.addValue(r,i);else if(wa(a))e.addValue(r,Lx(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=e.getStaticValue(r);e.addValue(r,Lx(o!==void 0?o:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const Z7=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class rOe{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,blockInitialAnimation:a,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=sM,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const h=La.now();this.renderScheduledAt<h&&(this.renderScheduledAt=h,ls.render(this.render,!1,!0))};const{latestValues:c,renderState:u}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=l,this.blockInitialAnimation=!!a,this.isControllingVariants=OC(n),this.isVariantNode=Qne(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:d,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const h in f){const p=f[h];c[h]!==void 0&&wa(p)&&p.set(c[h])}}mount(t){var n;this.current=t,tOe.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,i)=>this.bindToMotionValue(i,r)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(fre.current||eOe(),this.shouldReduceMotion=zT.current),(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var t;this.projection&&this.projection.unmount(),zf(this.notifyUpdate),zf(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=D0.has(t);r&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&ls.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),a&&a(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Fx){const n=Fx[t];
vendor: 5,109 bytes, line 1162
1162if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const a=this.features[t];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ji()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<Z7.length;r++){const i=Z7[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const a="on"+i,o=t[a];o&&(this.propEventSubscriptions[i]=this.on(i,o))}this.prevMotionValues=nOe(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Lx(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(nne(r)||sne(r))?r=parseFloat(r):!uPe(r)&&Uf.test(n)&&(r=Bne(t,n)),this.setBaseTarget(t,wa(r)?r.get():r)),wa(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var a;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=pM(this.props,n,(a=this.presenceContext)==null?void 0:a.custom);o&&(r=o[t])}if(n&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!wa(i)?i:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new GR),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){oM.render(this.render)}}class hre extends rOe{constructor(){super(...arguments),this.KeyframeResolver=ZTe}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;wa(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function mre(e,{style:t,vars:n},r,i){const a=e.style;let o;for(o in t)a[o]=t[o];i==null||i.applyProjectionStyles(a,r);for(o in n)a.setProperty(o,n[o])}function sOe(e){return window.getComputedStyle(e)}class iOe extends hre{constructor(){super(...arguments),this.type="html",this.renderInstance=mre}readValueFromInstance(t,n){var r;if(D0.has(n))return(r=this.projection)!=null&&r.isProjecting?PT(n):yTe(t,n);{const i=sOe(t),a=(yne(n)?i.getPropertyValue(n):i[n])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(t,{transformPagePoint:n}){return dre(t,n)}build(t,n,r){fM(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return gM(t,n,r)}}const pre=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function aOe(e,t,n,r){mre(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(pre.has(i)?i:xM(i),t.attrs[i])}class oOe extends hre{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ji}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(D0.has(n)){const r=$ne(n);return r&&r.default||0}return n=pre.has(n)?n:xM(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return sre(t,n,r)}build(t,n,r){ere(t,n,this.isSVGTag,r.transformTemplate,r.style)}
vendor: 4,401 bytes, line 1162
1162renderInstance(t,n,r,i){aOe(t,n,r,i)}mount(t){this.isSVGTag=nre(t.tagName),super.mount(t)}}const lOe=(e,t)=>t.isSVG??mM(e)?new oOe(t):new iOe(t,{allowProjection:e!==N.Fragment});function Kg(e,t,n){const r=e.getProps();return pM(r,t,n!==void 0?n:r.custom,e)}const UT=e=>Array.isArray(e);function cOe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Lx(n))}function uOe(e){return UT(e)?e[e.length-1]||0:e}function dOe(e,t){const n=Kg(e,t);let{transitionEnd:r={},transition:i={},...a}=n||{};a={...a,...r};for(const o in a){const l=uOe(a[o]);cOe(e,o,l)}}function fOe(e){return!!(wa(e)&&e.add)}function qT(e,t){const n=e.getValue("willChange");if(fOe(n))return n.add(t);if(!n&&ld.WillChange){const r=new ld.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function gre(e){return e.props[ire]}const hOe=e=>e!==null;function mOe(e,{repeat:t,repeatType:n="loop"},r){const i=e.filter(hOe),a=t&&n!=="loop"&&t%2===1?0:i.length-1;return i[a]}const pOe={type:"spring",stiffness:500,damping:25,restSpeed:10},gOe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),xOe={type:"keyframes",duration:.8},yOe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},vOe=(e,{keyframes:t})=>t.length>2?xOe:D0.has(e)?e.startsWith("scale")?gOe(t[1]):pOe:yOe;function bOe({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:a,repeatType:o,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const yM=(e,t,n,r={},i,a)=>o=>{const l=iM(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Hu(c);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:a?void 0:i};bOe(l)||Object.assign(d,vOe(e,d)),d.duration&&(d.duration=Hu(d.duration)),d.repeatDelay&&(d.repeatDelay=Hu(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(MT(d),d.delay===0&&(f=!0)),(ld.instantAnimations||ld.skipAnimations)&&(f=!0,MT(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,f&&!a&&t.get()!==void 0){const h=mOe(d.keyframes,l);if(h!==void 0){ls.update(()=>{d.onUpdate(h),d.onComplete()});return}}return l.isSync?new rM(d):new zTe(d)};function wOe({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function xre(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a=e.getDefaultTransition(),transitionEnd:o,...l}=t;r&&(a=r);const c=[],u=i&&e.animationState&&e.animationState.getState()[i];for(const d in l){const f=e.getValue(d,e.latestValues[d]??null),h=l[d];if(h===void 0||u&&wOe(u,d))continue;const p={delay:n,...iM(a||{},d)},x=f.get();if(x!==void 0&&!f.isAnimating&&!Array.isArray(h)&&h===x&&!p.velocity)continue;let y=!1;if(window.MotionHandoffAnimation){const w=gre(e);if(w){const _=window.MotionHandoffAnimation(w,d,ls);_!==null&&(p.startTime=_,y=!0)}}qT(e,d),f.start(yM(d,f,h,e.shouldReduceMotion&&Mne.has(d)?{type:!1}:p,e,y));const b=f.animation;b&&c.push(b)}return o&&Promise.all(c).then(()=>{ls.update(()=>{o&&dOe(e,o)})}),c}function yre(e,t,n,r=0,i=1){const a=Array.from(e).sort((u,d)=>u.sortNodePosition(d)).indexOf(t),o=e.size,l=(o-1)*r;return typeof n=="function"?n(a,o):i===1?a*r:l-a*r}function VT(e,t,n={}){var c;const r=Kg(e,t,n.type==="exit"?(c=e.presenceContext)==null?void 0:c.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const a=r?()=>Promise.all(xre(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=i;return _Oe(e,t,u,d,f,h,n)}:()=>Promise.resolve(),{when:l}=i;if(l){const[u,d]=l==="beforeChildren"?[a,o]:[o,a];return u().then(()=>d())}else return Promise.all([a(),o(n.delay)])}function _Oe(e,t,n=0,r=0,i=0,a=1,o){const l=[];for(const c of e.variantChildren)c.notify("AnimationStart",t),l.push(VT(c,t,{...o,delay:n+(typeof r=="function"?0:r)+yre(e.variantChildren,c,r,i,a)}).then(()=>c.notify("AnimationComplete",t)));return Promise.all(l)}function jOe(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(a=>VT(e,a,n));r=Promise.all(i)}else if(typeof t=="string")r=VT(e,t,n);else{const i=typeof t=="function"?Kg(e,t,n.custom):t;r=Promise.all(xre(e,i,n))}return r.then(()=>
vendor: 4,112 bytes, line 1162
1162{e.notify("AnimationComplete",t)})}function vre(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const NOe=dM.length;function bre(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?bre(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<NOe;n++){const r=dM[n],i=e.props[r];(S1(i)||i===!1)&&(t[r]=i)}return t}const kOe=[...uM].reverse(),COe=uM.length;function EOe(e){return t=>Promise.all(t.map(({animation:n,options:r})=>jOe(e,n,r)))}function SOe(e){let t=EOe(e),n=e9(),r=!0;const i=c=>(u,d)=>{var h;const f=Kg(e,d,c==="exit"?(h=e.presenceContext)==null?void 0:h.custom:void 0);if(f){const{transition:p,transitionEnd:x,...y}=f;u={...u,...y,...x}}return u};function a(c){t=c(e)}function o(c){const{props:u}=e,d=bre(e.parent)||{},f=[],h=new Set;let p={},x=1/0;for(let b=0;b<COe;b++){const w=kOe[b],_=n[w],j=u[w]!==void 0?u[w]:d[w],E=S1(j),S=w===c?_.isActive:null;S===!1&&(x=b);let T=j===d[w]&&j!==u[w]&&E;if(T&&r&&e.manuallyAnimateOnMount&&(T=!1),_.protectedKeys={...p},!_.isActive&&S===null||!j&&!_.prevProp||PC(j)||typeof j=="boolean")continue;const P=AOe(_.prevProp,j);let O=P||w===c&&_.isActive&&!T&&E||b>x&&E,D=!1;const R=Array.isArray(j)?j:[j];let L=R.reduce(i(w),{});S===!1&&(L={});const{prevResolvedValues:M={}}=_,B={...M,...L},U=z=>{O=!0,h.has(z)&&(D=!0,h.delete(z)),_.needsAnimating[z]=!0;const K=e.getValue(z);K&&(K.liveStyle=!1)};for(const z in B){const K=L[z],W=M[z];if(p.hasOwnProperty(z))continue;let q=!1;UT(K)&&UT(W)?q=!vre(K,W):q=K!==W,q?K!=null?U(z):h.add(z):K!==void 0&&h.has(z)?U(z):_.protectedKeys[z]=!0}_.prevProp=j,_.prevResolvedValues=L,_.isActive&&(p={...p,...L}),r&&e.blockInitialAnimation&&(O=!1);const F=T&&P;O&&(!F||D)&&f.push(...R.map(z=>{const K={type:w};if(typeof z=="string"&&r&&!F&&e.manuallyAnimateOnMount&&e.parent){const{parent:W}=e,q=Kg(W,z);if(W.enteringChildren&&q){const{delayChildren:oe}=q.transition||{};K.delay=yre(W.enteringChildren,e,oe)}}return{animation:z,options:K}}))}if(h.size){const b={};if(typeof u.initial!="boolean"){const w=Kg(e,Array.isArray(u.initial)?u.initial[0]:u.initial);w&&w.transition&&(b.transition=w.transition)}h.forEach(w=>{const _=e.getBaseTarget(w),j=e.getValue(w);j&&(j.liveStyle=!0),b[w]=_??null}),f.push({animation:b})}let y=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(y=!1),r=!1,y?t(f):Promise.resolve()}function l(c,u){var f;if(n[c].isActive===u)return Promise.resolve();(f=e.variantChildren)==null||f.forEach(h=>{var p;return(p=h.animationState)==null?void 0:p.setActive(c,u)}),n[c].isActive=u;const d=o(c);for(const h in n)n[h].protectedKeys={};return d}return{animateChanges:o,setActive:l,setAnimateFunction:a,getState:()=>n,reset:()=>{n=e9()}}}function AOe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!vre(t,e):!1}function Eh(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function e9(){return{animate:Eh(!0),whileInView:Eh(),whileHover:Eh(),whileTap:Eh(),whileDrag:Eh(),whileFocus:Eh(),exit:Eh()}}class ih{constructor(t){this.isMounted=!1,this.node=t}update(){}}class TOe extends ih{constructor(t){super(t),t.animationState||(t.animationState=SOe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();PC(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let POe=0;class OOe extends ih{constructor(){super(...arguments),this.id=POe++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};
vendor: 16,226 bytes, line 1162
1162n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const DOe={animation:{Feature:TOe},exit:{Feature:OOe}};function A1(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Zb(e){return{point:{x:e.pageX,y:e.pageY}}}const IOe=e=>t=>lM(t)&&e(t,Zb(t));function Cv(e,t,n,r){return A1(e,t,IOe(n),r)}const wre=1e-4,ROe=1-wre,MOe=1+wre,_re=.01,LOe=0-_re,FOe=0+_re;function Fa(e){return e.max-e.min}function $Oe(e,t,n){return Math.abs(e-t)<=n}function t9(e,t,n,r=.5){e.origin=r,e.originPoint=js(t.min,t.max,e.origin),e.scale=Fa(n)/Fa(t),e.translate=js(n.min,n.max,e.origin)-e.originPoint,(e.scale>=ROe&&e.scale<=MOe||isNaN(e.scale))&&(e.scale=1),(e.translate>=LOe&&e.translate<=FOe||isNaN(e.translate))&&(e.translate=0)}function Ev(e,t,n,r){t9(e.x,t.x,n.x,r?r.originX:void 0),t9(e.y,t.y,n.y,r?r.originY:void 0)}function n9(e,t,n){e.min=n.min+t.min,e.max=e.min+Fa(t)}function BOe(e,t,n){n9(e.x,t.x,n.x),n9(e.y,t.y,n.y)}function r9(e,t,n){e.min=t.min-n.min,e.max=e.min+Fa(t)}function F2(e,t,n){r9(e.x,t.x,n.x),r9(e.y,t.y,n.y)}function dl(e){return[e("x"),e("y")]}const jre=({current:e})=>e?e.ownerDocument.defaultView:null,s9=(e,t)=>Math.abs(e-t);function zOe(e,t){const n=s9(e.x,t.x),r=s9(e.y,t.y);return Math.sqrt(n**2+r**2)}const i9=new Set(["auto","scroll"]);class Nre{constructor(t,n,{transformPagePoint:r,contextWindow:i=window,dragSnapToOrigin:a=!1,distanceThreshold:o=3,element:l}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=p=>{this.handleScroll(p.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=XA(this.lastMoveEventInfo,this.history),x=this.startEvent!==null,y=zOe(p.offset,{x:0,y:0})>=this.distanceThreshold;if(!x&&!y)return;const{point:b}=p,{timestamp:w}=ra;this.history.push({...b,timestamp:w});const{onStart:_,onMove:j}=this.handlers;x||(_&&_(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),j&&j(this.lastMoveEvent,p)},this.handlePointerMove=(p,x)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=YA(x,this.transformPagePoint),ls.update(this.updatePoint,!0)},this.handlePointerUp=(p,x)=>{this.end();const{onEnd:y,onSessionEnd:b,resumeAnimation:w}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=XA(p.type==="pointercancel"?this.lastMoveEventInfo:YA(x,this.transformPagePoint),this.history);this.startEvent&&y&&y(p,_),b&&b(p,_)},!lM(t))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=i||window;const c=Zb(t),u=YA(c,this.transformPagePoint),{point:d}=u,{timestamp:f}=ra;this.history=[{...d,timestamp:f}];const{onSessionStart:h}=n;h&&h(t,XA(u,this.history)),this.removeListeners=Xb(Cv(this.contextWindow,"pointermove",this.handlePointerMove),Cv(this.contextWindow,"pointerup",this.handlePointerUp),Cv(this.contextWindow,"pointercancel",this.handlePointerUp)),l&&this.startScrollTracking(l)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(i9.has(r.overflowX)||i9.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,i=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},a={x:i.x-n.x,y:i.y-n.y};a.x===0&&a.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a.x,this.lastMoveEventInfo.point.y+=a.y):this.history.length>0&&(this.history[0].x-=a.x,this.history[0].y-=a.y),this.scrollPositions.set(t,i),ls.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),zf(this.updatePoint)}}function YA(e,t){return t?{point:t(e.point)}:e}function a9(e,t){return{x:e.x-t.x,y:e.y-t.y}}function XA({point:e},t){return{point:e,delta:a9(e,kre(t)),offset:a9(e,UOe(t)),velocity:qOe(t,.1)}}function UOe(e){return e[0]}function kre(e){return e[e.length-1]}function qOe(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=kre(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Hu(t)));)n--;if(!r)return{x:0,y:0};const a=_l(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};const o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function VOe(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?js(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?js(n,e,r.max):Math.min(e,n)),e}function o9(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function HOe(e,{top:t,left:n,bottom:r,right:i}){return{x:o9(e.x,n,i),y:o9(e.y,t,r)}}function l9(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function WOe(e,t){return{x:l9(e.x,t.x),y:l9(e.y,t.y)}}function GOe(e,t){let n=.5;const r=Fa(e),i=Fa(t);return i>r?n=k1(t.min,t.max-r,e.min):r>i&&(n=k1(e.min,e.max-i,t.min)),uu(0,1,n)}function KOe(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const HT=.35;function YOe(e=HT){return e===!1?e=0:e===!0&&(e=HT),{x:c9(e,"left","right"),y:c9(e,"top","bottom")}}function c9(e,t,n){return{min:u9(e,t),max:u9(e,n)}}function u9(e,t){return typeof e=="number"?e:e[t]||0}const XOe=new WeakMap;class QOe{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ji(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const a=f=>{n?(this.stopAnimation(),this.snapToCursor(Zb(f).point)):this.pauseAnimation()},o=(f,h)=>{this.stopAnimation();const{drag:p,dragPropagation:x,onDragStart:y}=this.getProps();if(p&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=rPe(p),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=h,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),dl(w=>{let _=this.getAxisMotionValue(w).get()||0;if(iu.test(_)){const{projection:j}=this.visualElement;if(j&&j.layout){const E=j.layout.layoutBox[w];E&&(_=Fa(E)*(parseFloat(_)/100))}}this.originPoint[w]=_}),y&&ls.postRender(()=>y(f,h)),qT(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},l=(f,h)=>{this.latestPointerEvent=f,this.latestPanInfo=h;const{dragPropagation:p,dragDirectionLock:x,onDirectionLock:y,onDrag:b}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:w}=h;if(x&&this.currentDirection===null){this.currentDirection=JOe(w),this.currentDirection!==null&&y&&y(this.currentDirection);return}this.updateAxis("x",h.point,w),this.updateAxis("y",h.point,w),this.visualElement.render(),b&&b(f,h)},c=(f,h)=>{this.latestPointerEvent=f,this.latestPanInfo=h,this.stop(f,h),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>dl(f=>{var h;return this.getAnimationState(f)==="paused"&&((h=this.getAxisMotionValue(f).animation)==null?void 0:h.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new Nre(t,{onSessionStart:a,onStart:o,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:jre(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,i=n||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!i||!r)return;const{velocity:o}=i;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&ls.postRender(()=>l(r,i))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!f_(t,i,this.currentDirection))return;const a=this.getAxisMotionValue(t);let o=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(o=VOe(o,this.constraints[t],this.elastic[t])),a.set(o)}resolveConstraints(){var a;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(a=this.visualElement.projection)==null?void 0:a.layout,i=this.constraints;t&&av(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=HOe(r.layoutBox,t):this.constraints=!1,this.elastic=YOe(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&dl(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=KOe(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!av(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const a=ZPe(r,i.root,this.visualElement.getTransformPagePoint());let o=WOe(i.layout.layoutBox,a);if(n){const l=n(XPe(o));this.hasMutatedConstraints=!!l,l&&(o=lre(l))}return o}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=dl(d=>{if(!f_(d,n,this.currentDirection))return;let f=c&&c[d]||{};o&&(f={min:0,max:0});const h=i?200:1e6,p=i?40:1e7,x={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...a,...f};return this.startAxisValueAnimation(d,x)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return qT(this.visualElement,t),r.start(yM(t,r,0,n,this.visualElement,!1))}stopAnimation(){dl(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){dl(t=>{var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){dl(n=>{const{drag:r}=this.getProps();if(!f_(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,a=this.getAxisMotionValue(n);if(i&&i.layout){const{min:o,max:l}=i.layout.layoutBox[n],c=a.get()||0;a.set(t[n]-js(o,l,.5)+c)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!av(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};dl(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();i[o]=GOe({min:c,max:c},this.constraints[o])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),dl(o=>{if(!f_(o,t,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(js(c,u,i[o]))})}addListeners(){if(!this.visualElement.current)return;XOe.set(this.visualElement,this);const t=this.visualElement.current,n=Cv(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&!Wne(c.target)&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();av(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,a=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),ls.read(r);const o=A1(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(dl(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{o(),n(),a(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:a=!1,dragElastic:o=HT,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:a,dragElastic:o,dragMomentum:l}}}function f_(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function JOe(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class ZOe extends ih{constructor(t){super(t),this.removeGroupControls=Tl,this.removeListeners=Tl,this.controls=new QOe(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Tl}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners()}}const d9=e=>(t,n)=>{e&&ls.postRender(()=>e(t,n))};class eDe extends ih{constructor(){super(...arguments),this.removePointerDownListener=Tl}onPointerDown(t){this.session=new Nre(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:jre(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:d9(t),onStart:d9(n),onMove:r,onEnd:(a,o)=>{delete this.session,i&&ls.postRender(()=>i(a,o))}}}mount(){this.removePointerDownListener=Cv(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Nj={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let QA=!1;class tDe extends N.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:a}=t;a&&(n.group&&n.group.add(a),r&&r.register&&i&&r.register(a),QA&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),Nj.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:a}=this.props,{projection:o}=r;return o&&(o.isPresent=a,QA=!0,i||t.layoutDependency!==n||n===void 0||t.isPresent!==a?o.willUpdate():this.safeToRemove(),t.isPresent!==a&&(a?o.promote():o.relegate()||ls.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),oM.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;QA=!0,i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Cre(e){const[t,n]=Kne(),r=N.useContext(BR);return s.jsx(tDe,{...e,layoutGroup:r,switchLayoutGroup:N.useContext(are),isPresent:t,safeToRemove:n})}function nDe(e,t,n){const r=wa(e)?e:Lx(e);return r.start(yM("",r,t,n)),r.animation}const rDe=(e,t)=>e.depth-t.depth;class sDe{constructor(){this.children=[],this.isDirty=!1}add(t){qR(this.children,t),this.isDirty=!0}remove(t){VR(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(rDe),this.isDirty=!1,this.children.forEac
vendor: 5,156 bytes, line 1162
1162h(t)}}function iDe(e,t){const n=La.now(),r=({timestamp:i})=>{const a=i-n;a>=t&&(zf(r),e(a-t))};return ls.setup(r,!0),()=>zf(r)}const Ere=["TopLeft","TopRight","BottomLeft","BottomRight"],aDe=Ere.length,f9=e=>typeof e=="string"?parseFloat(e):e,h9=e=>typeof e=="number"||_t.test(e);function oDe(e,t,n,r,i,a){i?(e.opacity=js(0,n.opacity??1,lDe(r)),e.opacityExit=js(t.opacity??1,0,cDe(r))):a&&(e.opacity=js(t.opacity??1,n.opacity??1,r));for(let o=0;o<aDe;o++){const l=`border${Ere[o]}Radius`;let c=m9(t,l),u=m9(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||h9(c)===h9(u)?(e[l]=Math.max(js(f9(c),f9(u),r),0),(iu.test(u)||iu.test(c))&&(e[l]+="%")):e[l]=u}(t.rotate||n.rotate)&&(e.rotate=js(t.rotate||0,n.rotate||0,r))}function m9(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const lDe=Sre(0,.5,fne),cDe=Sre(.5,.95,Tl);function Sre(e,t,n){return r=>r<e?0:r>t?1:n(k1(e,t,r))}function p9(e,t){e.min=t.min,e.max=t.max}function Wl(e,t){p9(e.x,t.x),p9(e.y,t.y)}function g9(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function x9(e,t,n,r,i){return e-=t,e=L2(e,1/n,r),i!==void 0&&(e=L2(e,1/i,r)),e}function uDe(e,t=0,n=1,r=.5,i,a=e,o=e){if(iu.test(t)&&(t=parseFloat(t),t=js(o.min,o.max,t/100)-o.min),typeof t!="number")return;let l=js(a.min,a.max,r);e===a&&(l-=t),e.min=x9(e.min,t,n,l,i),e.max=x9(e.max,t,n,l,i)}function y9(e,t,[n,r,i],a,o){uDe(e,t[n],t[r],t[i],t.scale,a,o)}const dDe=["x","scaleX","originX"],fDe=["y","scaleY","originY"];function v9(e,t,n,r){y9(e.x,t,dDe,n?n.x:void 0,r?r.x:void 0),y9(e.y,t,fDe,n?n.y:void 0,r?r.y:void 0)}function b9(e){return e.translate===0&&e.scale===1}function Are(e){return b9(e.x)&&b9(e.y)}function w9(e,t){return e.min===t.min&&e.max===t.max}function hDe(e,t){return w9(e.x,t.x)&&w9(e.y,t.y)}function _9(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Tre(e,t){return _9(e.x,t.x)&&_9(e.y,t.y)}function j9(e){return Fa(e.x)/Fa(e.y)}function N9(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class mDe{constructor(){this.members=[]}add(t){qR(this.members,t),t.scheduleRender()}remove(t){if(VR(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const a=this.members[i];if(a.isPresent!==!1){r=a;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function pDe(e,t,n){let r="";const i=e.x.translate/t.x,a=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:x}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),x&&(r+=`skewY(${x}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const JA=["","X","Y","Z"],gDe=1e3;let xDe=0;function ZA(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Pre(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=gre(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:a}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ls,!(i||a))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Pre(r)}function Ore({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(o={},l=t==null?void 0:t()){this.id=xDe++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>
vendor: 14,751 bytes, line 1162
1162{this.projectionUpdateScheduled=!1,this.nodes.forEach(bDe),this.nodes.forEach(NDe),this.nodes.forEach(kDe),this.nodes.forEach(wDe)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new sDe)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new GR),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=Gne(o)&&!lPe(o),this.instance=o;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),e){let d,f=0;const h=()=>this.root.updateBlockedByResize=!1;ls.read(()=>{f=window.innerWidth}),e(o,()=>{const p=window.innerWidth;p!==f&&(f=p,this.root.updateBlockedByResize=!0,d&&d(),d=iDe(h,250),Nj.hasAnimatedSinceResize&&(Nj.hasAnimatedSinceResize=!1,this.nodes.forEach(E9)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeLayoutChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||u.getDefaultTransition()||TDe,{onLayoutAnimationStart:y,onLayoutAnimationComplete:b}=u.getProps(),w=!this.targetLayout||!Tre(this.targetLayout,p),_=!f&&h;if(this.options.layoutRoot||this.resumeFrom||_||f&&(w||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const j={...iM(x,"layout"),onPlay:y,onComplete:b};(u.shouldReduceMotion||this.options.layoutRoot)&&(j.delay=0,j.type=!1),this.startAnimation(j),this.setAnimationOrigin(d,_)}else f||E9(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),zf(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(CDe),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Pre(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const f=this.path[d];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(k9);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(C9);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(jDe),this.nodes.forEach(yDe),this.nodes.forEach(vDe)):this.nodes.forEach(C9),this.clearAllSnapshots();const l=La.now();ra.delta=uu(0,1e3/60,l-ra.timestamp),ra.timestamp=l,ra.isProcessing=!0,BA.update.process(ra),BA.preRender.process(ra),BA.render.process(ra),ra.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,oM.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(_De),this.sharedNodes.forEach(EDe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ls.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ls.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Fa(this.snapshot.measuredBox.x)&&!Fa(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=ji(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l&&this.instance){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!i)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!Are(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&this.instance&&(l||$h(this.latestValues)||d)&&(i(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),PDe(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:o}=this.options;if(!o)return ji();const l=o.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(ODe))){const{scroll:d}=this.root;d&&(_g(l.x,d.offset.x),_g(l.y,d.offset.y))}return l}removeElementScroll(o){var c;const l=ji();if(Wl(l,o),(c=this.scroll)!=null&&c.wasRoot)return l;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:f,options:h}=d;d!==this.root&&f&&h.layoutScroll&&(f.wasRoot&&Wl(l,o),_g(l.x,f.offset.x),_g(l.y,f.offset.y))}return l}applyTransform(o,l=!1){const c=ji();Wl(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&jg(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),$h(d.latestValues)&&jg(c,d.latestValues)}return $h(this.latestValues)&&jg(c,this.latestValues),c}removeTransform(o){const l=ji();Wl(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!$h(u.latestValues))continue;$T(u.latestValues)&&u.updateSnapshot();const d=ji(),f=u.measurePageBox();Wl(d,f),v9(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return $h(this.latestValues)&&v9(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==ra.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var p;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(p=this.parent)!=null&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:f}=this.options;if(!this.layout||!(d||f))return;this.resolvedRelativeTargetAt=ra.timestamp;const h=this.getClosestProjectingParent();h&&this.linkedParentVersion!==h.layoutVersion&&!h.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(h&&h.layout?this.createRelativeTarget(h,this.layout.layoutBox,h.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ji(),this.targetWithTransforms=ji()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),BOe(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Wl(this.target,this.layout.layoutBox),ure(this.target,this.targetDelta)):Wl(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,h&&!!h.resumingFrom==!!this.resumingFrom&&!h.options.layoutScroll&&h.target&&this.animationProgress!==1?this.createRelativeTarget(h,this.target,h.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||$T(this.parent.latestValues)||cre(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,l,c){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ji(),this.relativeTargetOrigin=ji(),F2(this.relativeTargetOrigin,l,c),Wl(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var x;const o=this.getLead(),l=!!this.resumingFrom||this!==o;let c=!0;if((this.isProjectionDirty||(x=this.parent)!=null&&x.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===ra.timestamp&&(c=!1),c)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;Wl(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,h=this.treeScale.y;JPe(this.layoutCorrected,this.treeScale,this.path,l),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=ji());const{target:p}=o;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(g9(this.prevProjectionDelta.x,this.projectionDelta.x),g9(this.prevProjectionDelta.y,this.projectionDelta.y)),Ev(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==h||!N9(this.projectionDelta.x,this.prevProjectionDelta.x)||!N9(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ng(),this.projectionDelta=Ng(),this.projectionDeltaWithTransform=Ng()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},f=Ng();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const h=ji(),p=c?c.source:void 0,x=this.layout?this.layout.source:void 0,y=p!==x,b=this.getStack(),w=!b||b.members.length<=1,_=!!(y&&!w&&this.options.crossfade===!0&&!this.path.some(ADe));this.animationProgress=0;let j;this.mixTargetDelta=E=>{const S=E/1e3;S9(f.x,o.x,S),S9(f.y,o.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(F2(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),SDe(this.relativeTarget,this.relativeTargetOrigin,h,S),j&&hDe(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=ji()),Wl(j,this.relativeTarget)),y&&(this.animationValues=d,oDe(d,u,this.latestValues,S,_,w)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var l,c,u;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(u=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||u.stop(),this.pendingAnimation&&(zf(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ls.update(()=>{Nj.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Lx(0)),this.currentAnimation=nDe(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(gDe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&Dre(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||ji();const f=Fa(this.layout.layoutBox.x);
vendor: 9,597 bytes, line 1162
1162c.x.min=o.target.x.min,c.x.max=c.x.min+f;const h=Fa(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+h}Wl(l,c),jg(l,d),Ev(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new mDe),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var l;const{layoutId:o}=this.options;return o?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:o}=this.options;return o?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&ZA("z",o,u,this.animationValues);for(let d=0;d<JA.length;d++)ZA(`rotate${JA[d]}`,o,u,this.animationValues),ZA(`skew${JA[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}applyProjectionStyles(o,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=jj(l==null?void 0:l.pointerEvents)||"",o.transform=c?c(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=jj(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!$h(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let f=pDe(this.projectionDeltaWithTransform,this.treeScale,d);c&&(f=c(d,f)),o.transform=f;const{x:h,y:p}=this.projectionDelta;o.transformOrigin=`${h.origin*100}% ${p.origin*100}% 0`,u.animationValues?o.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const x in FT){if(d[x]===void 0)continue;const{correct:y,applyTo:b,isCSSVariable:w}=FT[x],_=f==="none"?d[x]:y(d[x],u);if(b){const j=b.length;for(let E=0;E<j;E++)o[b[E]]=_}else w?this.options.visualElement.renderState.vars[x]=_:o[x]=_}this.options.layoutId&&(o.pointerEvents=u===this?jj(l==null?void 0:l.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(k9),this.root.sharedNodes.clear()}}}function yDe(e){e.updateLayout()}function vDe(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:a}=e.options,o=t.source!==e.layout.source;a==="size"?dl(f=>{const h=o?t.measuredBox[f]:t.layoutBox[f],p=Fa(h);h.min=r[f].min,h.max=h.min+p}):Dre(a,t.layoutBox,r)&&dl(f=>{const h=o?t.measuredBox[f]:t.layoutBox[f],p=Fa(r[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const l=Ng();Ev(l,r,t.layoutBox);const c=Ng();o?Ev(c,e.applyTransform(i,!0),t.measuredBox):Ev(c,r,t.layoutBox);const u=!Are(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const x=ji();F2(x,t.layoutBox,h.layoutBox);const y=ji();F2(y,r,p.layoutBox),Tre(x,y)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=y,e.relativeTargetOrigin=x,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function bDe(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function wDe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function _De(e){e.clearSnapshot()}function k9(e){e.clearMeasurements()}function C9(e){e.isLayoutDirty=!1}function jDe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function E9(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function NDe(e){e.resolveTargetDelta()}function kDe(e){e.calcProjection()}function CDe(e){e.resetSkewAndRotation()}function EDe(e){e.removeLeadSnapshot()}function S9(e,t,n){e.translate=js(t.translate,0,n),e.scale=js(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function A9(e,t,n,r){e.min=js(t.min,n.min,r),e.max=js(t.max,n.max,r)}function SDe(e,t,n,r){A9(e.x,t.x,n.x,r),A9(e.y,t.y,n.y,r)}function ADe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const TDe={duration:.45,ease:[.4,0,.1,1]},T9=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),P9=T9("applewebkit/")&&!T9("chrome/")?Math.round:Tl;function O9(e){e.min=P9(e.min),e.max=P9(e.max)}function PDe(e){O9(e.x),O9(e.y)}function Dre(e,t,n){return e==="position"||e==="preserve-aspect"&&!$Oe(j9(t),j9(n),.2)}function ODe(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const DDe=Ore({attachResizeListener:(e,t)=>A1(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),e4={current:void 0},Ire=Ore({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!e4.current){const e=new DDe({});e.mount(window),e.setOptions({layoutScroll:!0}),e4.current=e}return e4.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),IDe={pan:{Feature:eDe},drag:{Feature:ZOe,ProjectionNode:Ire,MeasureLayout:Cre}};function D9(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,a=r[i];a&&ls.postRender(()=>a(t,Zb(t)))}class RDe extends ih{mount(){const{current:t}=this.node;t&&(this.unmount=sPe(t,(n,r)=>(D9(this.node,r,"Start"),i=>D9(this.node,i,"End"))))}unmount(){}}class MDe extends ih{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Xb(A1(this.node.current,"focus",()=>this.onFocus()),A1(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function I9(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),a=r[i];a&&ls.postRender(()=>a(t,Zb(t)))}class LDe extends ih{mount(){const{current:t}=this.node;t&&(this.unmount=oPe(t,(n,r)=>(I9(this.node,r,"Start"),(i,{success:a})=>I9(this.node,i,a?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const WT=new WeakMap,t4=new WeakMap,FDe=e=>{const t=WT.get(e.target);t&&t(e)},$De=e=>{e.forEach(FDe)};function BDe({root:e,...t}){const n=e||document;t4.has(n)||t4.set(n,{});const r=t4.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver($De,{root:e,...t})),r[i]}function zDe(e,t,n){const r=BDe(t);return WT.set(e,n),r.observe(e),()=>{WT.delete(e),r.unobserve(e)}}const UDe={some:0,all:1};class qDe extends ih{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:a}=t,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:UDe[i]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,a&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(c)};return zDe(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(VDe(t,n))&&this.startObserver()}unmount(){}}function VDe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const HDe={inView:{Feature:qDe},tap:{Feature:LDe},focus:{Feature:MDe},hover:{Feature:RDe}},WDe={layout:{ProjectionNode:Ire,MeasureLayout:Cre}}
1162,GDe={...DOe,...HDe,...IDe,...WDe},Xn=YPe(GDe,lOe);function Rre(e){return st({queryKey:["player-explorer-stats",e],queryFn:async()=>{if(!e)return{uniqueCities:[],uniqueArrondissements:[],uniqueVenues:0,bestFinish:null,bestFinishEventTitle:null,totalEvents:0,venueVisits:[],favoriteVenue:null,maxVisitsInSingleVenue:0};const{data:t,error:n}=await re.from("tickets").select(`
1163          id,
1164          event_id,
1165          events!inner (
1166            id,
1167            title,
1168            status,
1169            event_date,
1170            venue_id,
1171            venues!inner (
1172              id,
1173              name,
1174              city,
1175              postal_code
1176            )
1177          ),
1178          checkins!inner (
1179            id
1180          )
1181        `).eq("user_id",e).eq("status","checked_in");if(n)throw console.error("Error fetching explorer stats:",n),n;const r=new Set,i=new Set,a=new Map,o=[];t==null||t.forEach(h=>{const p=h.events,x=p==null?void 0:p.venues;if(!(x!=null&&x.id))return;if(x.city&&r.add(x.city),qm(x.city)){const b=bR(x.postal_code,null);b&&i.add(b)}const y=a.get(x.id);y?(y.visitCount++,p.event_date&&p.event_date>y.lastVisit&&(y.lastVisit=p.event_date)):a.set(x.id,{venueId:x.id,venueName:x.name,city:x.city,visit
1181Count:1,lastVisit:p.event_date||"",isFavorite:!1}),(p==null?void 0:p.status)==="completed"&&o.push(p.id)});const l=Array.from(a.values()).sort((h,p)=>p.visitCount!==h.visitCount?p.visitCount-h.visitCount:h.venueName.localeCompare(p.venueName));l.length>0&&(l[0].isFavorite=!0);const c=l[0]||null,u=(c==null?void 0:c.visitCount)||0,{data:d}=await re.from("player_stats").select("best_finish").eq("user_id",e).maybeSingle();let f=null;return d!=null&&d.best_finish&&o.length>0&&(f=null),{uniqueCities:Array.from(r).sort(),uniqueArrondissements:Array.from(i).sort((h,p)=>parseInt(h)-parseInt(p)),uniqueVenues:l.length,bestFinish:(d==null?void 0:d.best_finish)||null,bestFinishEventTitle:f,totalEvents:(t==null?void 0:t.length)||0,venueVisits:l,favoriteVenue:c,maxVisitsInSingleVenue:u}},enabled:!!e,staleTime:5*60*1e3})}const KDe=[{code:"podium_1st",category:"ranking",checkEarned:e=>e===1},{code:"podium_2nd",category:"ranking",checkEarned:e=>e===2},{code:"podium_3rd",category:"ranking",checkEarned:e=>e===3},{code:"top_5",category:"ranking",checkEarned:e=>e<=5&&e>3},{code:"top_10",category:"ranking",checkEarned:(e,t)=>e<=10&&e>5&&(t??0)>=10},{code:"top_20",category:"ranking",checkEarned:(e,t)=>e<=20&&e>10&&(t??0)>=20},{code:"top_half",category:"ranking",checkEarned:(e,t)=>{if(!t||t<4)return!1;const n=Math.ceil(t/2);return e<=n&&e>20}}],YDe=[{code:"first_tournament",category:"milestone",checkEarned:e=>e>=1,getProgress:e=>({current:Math.min(e,1),target:1})},{code:"first_game",category:"milestone",checkEarned:e=>e>=1,getProgress:e=>({current:Math.min(e,1),target:1})},{code:"first_win",category:"milestone",checkEarned:e=>e>=1,getProgress:e=>({current:Math.min(e,1),target:1})}],n4=[{code:"wins_3",category:"milestone",checkEarned:e=>e>=3,getProgress:e=>({current:Math.min(e,3),target:3})},{code:"wins_10",category:"milestone",checkEarned:e=>e>=10,getProgress:e=>({current:Math.min(e,10),target:10})},{code:"wins_25",category:"milestone",checkEarned:e=>e>=25,getProgress:e=>({current:Math.min(e,25),target:25})},{code:"games_50",category:"milestone",checkEarned:e=>e>=50,getProgress:e=>({current:Math.min(e,50),target:50})},{code:"games_100",category:"milestone",checkEarned:e=>e>=100,getProgress:e=>({current:Math.min(e,100),target:100})},{code:"tournaments_5",category:"milestone",checkEarned:e=>e>=5,getProgress:e=>({current:Math.min(e,5),target:5})},{code:"tournaments_10",category:"milestone",checkEarned:e=>e>=10,getProgress:e=>({current:Math.min(e,10),target:10})},{code:"tournaments_25",category:"milestone",checkEarned:e=>e>=25,getProgress:e=>({current:Math.min(e,25),target:25})}],XDe=[{code:"explorer_3",category:"exploration",checkEarned:e=>e>=3,getProgress:e=>({current:Math.min(e,3),target:3})},{code:"explorer_5",category:"exploration",checkEarned:e=>e>=5,getProgress:e=>({current:Math.min(e,5),target:5})},{code:"explorer_10",category:"exploration",checkEarned:e=>e>=10,getProgress:e=>({current:Math.min(e,10),target:10})}],QDe=[{code:"venues_3",category:"exploration",checkEarned:e=>e>=3,getProgress:e=>({current:Math.min(e,3),target:3})},{code:"venues_5",category:"exploration",checkEarned:e=>e>=5,getProgress:e=>({current:Math.min(e,5),target:5})},{code:"venues_10",category:"exploration",checkEarned:e=>e>=10,getProgress:e=>({current:Math.min(e,10),target:10})},{code:"venues_20",category:"exploration",checkEarned:e=>e>=20,getProgress:e=>({current:Math.min(e,20),target:20})}],JDe=[{code:"venue_regular_3",category:"loyalty",checkEarned:e=>e>=3,getProgress:e=>({current:Math.min(e,3),target:3})},{code:"venue_regular_5",category:"loyalty",checkEarned:e=>e>=5,getProgress:e=>({current:Math.min(e,5),target:5})},{code:"venue_regular_10",category:"loyalty",checkEarned:e=>e>=10,getProgress:e=>({current:Math.min(e,10),target:10})}];function ZDe(e){const{user:t}=Tt(),n=Ye(),{data:r,isLoading:i}=EC(e),{data:a,isLoading:o}=Rre(e);return N.useEffect(()=>{const l=e||(t==null?void 0:t.id);if(!l)return;const c=re.channel(`player-badges-${l}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"user_badges",filter:`user_id=eq.${l}`},()=>{n.invalidateQueries({queryKey:["player-achievements",l]})}).subscribe();return()=>{re.removeChannel(c)}},[e,t==null?void 0:t.id,n]),st({queryKey:["player-achievements",e,r,a],queryFn:async()=>
1181{if(!e)return{ranking:[],milestone:[],exploration:[],loyalty:[]};const{data:l,error:c}=await re.from("badges").select("*");if(c)throw console.error("Error fetching badges:",c),c;const{data:u,error:d}=await re.from("user_badges").select("badge_id, earned_at").eq("user_id",e);if(d)throw console.error("Error fetching user badges:",d),d;const f=new Map((u==null?void 0:u.map(O=>[O.badge_id,O.earned_at]))||[]),h=new Map((l==null?void 0:l.map(O=>[O.code,O]))||[]),p=(r==null?void 0:r.wins)||0,x=(r==null?void 0:r.games_played)||0,y=(r==null?void 0:r.tournaments_played)||0,b=(a==null?void 0:a.uniqueCities.length)||0,w=(a==null?void 0:a.uniqueVenues)||0,_=(a==null?void 0:a.maxVisitsInSingleVenue)||0,j=(r==null?void 0:r.best_finish)||(a==null?void 0:a.bestFinish),E=KDe.map(O=>{const D=h.get(O.code);if(!D)return null;const R=f.has(D.id)||j!=null&&O.checkEarned(j,100);return{badge:D,earned:R,earnedAt:f.get(D.id)}}).filter(O=>O!==null),S=[];YDe.forEach(O=>{var B;const D=h.get(O.code);if(!D)return;let R=0;O.code==="first_tournament"?R=y:O.code==="first_game"?R=x:O.code==="first_win"&&(R=p);const L=f.has(D.id)||O.checkEarned(R),M=(B=O.getProgress)==null?void 0:B.call(O,R);S.push({badge:D,earned:L,earnedAt:f.get(D.id),progress:M})}),n4.filter(O=>O.code.startsWith("wins_")).forEach(O=>{var M;const D=h.get(O.code);if(!D)return;const R=f.has(D.id)||O.checkEarned(p),L=(M=O.getProgress)==null?void 0:M.call(O,p);S.push({badge:D,earned:R,earnedAt:f.get(D.id),progress:L})}),n4.filter(O=>O.code.startsWith("games_")).forEach(O=>{var M;const D=h.get(O.code);if(!D)return;const R=f.has(D.id)||O.checkEarned(x),L=(M=O.getProgress)==null?void 0:M.call(O,x);S.push({badge:D,earned:R,earnedAt:f.get(D.id),progress:L})}),n4.filter(O=>O.code.startsWith("tournaments_")).forEach(O=>{var M;const D=h.get(O.code);if(!D)return;const R=f.has(D.id)||O.checkEarned(y),L=(M=O.getProgress)==null?void 0:M.call(O,y);S.push({badge:D,earned:R,earnedAt:f.get(D.id),progress:L})});const T=[];XDe.forEach(O=>{var M;const D=h.get(O.code);if(!D)return;const R=f.has(D.id)||O.checkEarned(b),L=(M=O.getProgress)==null?void 0:M.call(O,b);T.push({badge:D,earned:R,earnedAt:f.get(D.id),progress:L})}),QDe.forEach(O=>{var M;const D=h.get(O.code);if(!D)return;const R=f.has(D.id)||O.checkEarned(w),L=(M=O.getProgress)==null?void 0:M.call(O,w);T.push({badge:D,earned:R,earnedAt:f.get(D.id),progress:L})});const P=JDe.map(O=>{var B;const D=h.get(O.code);if(!D)return null;const R=f.has(D.id)||O.checkEarned(_),L=(B=O.getProgress)==null?void 0:B.call(O,_);return{badge:D,earned:R,earnedAt:f.get(D.id),progress:L}}).filter(O=>O!==null);return{ranking:E,milestone:S,exploration:T,loyalty:P}},enabled:!!e&&!i&&!o,staleTime:5*60*1e3})}var vM="Progress",bM=100,[eIe]=Us(vM),[tIe,nIe]=eIe(vM),Mre=N.forwardRef((e,t)=>{const{__scopeProgress:n,value:r=null,max:i,getValueLabel:a=rIe,...o}=e;(i||i===0)&&!R9(i)&&console.error(sIe(`${i}`,"Progress"));const l=R9(i)?i:bM;r!==null&&!M9(r,l)&&console.error(iIe(`${r}`,"Progress"));const c=M9(r,l)?r:null,u=$2(c)?a(c,l):void 0;return s.jsx(tIe,{scope:n,value:c,max:l,children:s.jsx(ut.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":$2(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":$re(c,l),"data-value":c??void 0,"data-max":l,...o,ref:t})})});Mre.displayName=vM;var Lre="ProgressIndicator",Fre=N.forwardRef((e,t)=>{const{__scopeProgress:n,...r}=e,i=nIe(Lre,n);return s.jsx(ut.div,{"data-state":$re(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:t})});Fre.displayName=Lre;function rIe(e,t){return`${Math.round(e/t*100)}%`}function $re(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function $2(e){return typeof e=="number"}function R9(e){return $2(e)&&!isNaN(e)&&e>0}function M9(e,t){return $2(e)&&!isNaN(e)&&e<=t&&e>=0}function sIe(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${bM}\`.`}function iIe(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
1182  - a positive number
1183  - less than the value passed to \`max\` (or ${bM} if no \`max\` prop is set)
1184  - \`null\` or \`undefined\` if the progress is indeterminate.
1185
1186Defaulting to \`null\`.`}var Bre=Mre,aIe=Fre;const du=N.forwardRef(({className:e,value:t,...n},r)=>s.jsx(Bre,{ref:r,className:ae("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:s.jsx(aIe,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));du.displayName=Bre.displayName;const oIe={sm:"w-12 h-12 text-lg",md:"w-16 h-16 text-2xl",lg:"w-20 h-20 text-3xl"}
1186,lIe={sm:10,md:14,lg:16},L9=ee.memo(function({achievement:t,size:n="md",showProgress:r=!1,className:i}){const a=vd(),[o,l]=N.useState(!1),{badge:c,earned:u,progress:d,earnedAt:f}=t,h=d?Math.round(d.current/d.target*100):0,p=s.jsxs("div",{className:ae("relative flex items-center justify-center rounded-full transition-all duration-300",oIe[n],u?"badge-earned":"badge-locked"),children:[u?s.jsx("span",{className:"select-none",children:c.icon||"🏆"}):s.jsx(yo,{className:"text-muted-foreground/50",size:lIe[n]}),u&&s.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/10 blur-md -z-10"}),!u&&r&&d&&h>0&&s.jsxs("svg",{className:"absolute inset-0 -rotate-90",viewBox:"0 0 36 36",children:[s.jsx("circle",{cx:"18",cy:"18",r:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-muted/20"}),s.jsx("circle",{cx:"18",cy:"18",r:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeDasharray:`${h} 100`,strokeLinecap:"round",className:"text-primary/60"})]})]}),x=n==="lg"&&s.jsx("span",{className:ae("text-xs font-medium text-center max-w-[80px] truncate",u?"text-foreground":"text-muted-foreground"),children:c.name});return a?s.jsxs(s.Fragment,{children:[s.jsxs(Xn.button,{type:"button",onClick:()=>l(!0),initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},whileTap:{scale:.95},className:ae("relative flex flex-col items-center gap-1 touch-manipulation",i),"aria-label":`Badge ${c.name}`,children:[p,x]}),s.jsx(bd,{open:o,onOpenChange:l,children:s.jsxs(wd,{className:"badge-detail-drawer pb-8",children:[s.jsx(_d,{className:"sr-only",children:c.name}),s.jsxs("div",{className:"p-6 flex flex-col items-center gap-4",children:[s.jsx(Xn.div,{initial:{scale:.8,opacity:0}
1186,animate:{scale:1,opacity:1},transition:{type:"spring",stiffness:300,damping:20},className:ae("w-24 h-24 rounded-full flex items-center justify-center text-5xl",u?"badge-earned":"badge-locked"),children:u?s.jsx("span",{className:"select-none",children:c.icon||"🏆"}):s.jsx(yo,{className:"text-muted-foreground/50",size:32})}),s.jsxs("div",{className:"text-center space-y-2",children:[s.jsx("h3",{className:"font-display text-xl font-semibold",children:c.name}),s.jsx("p",{className:"text-muted-foreground text-sm max-w-[280px]",children:c.description}),!u&&d&&s.jsxs("div",{className:"pt-3 w-full max-w-[200px] mx-auto",children:[s.jsx(du,{value:h,className:"h-2"}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:[d.current," / ",d.target]})]}),u&&f&&s.jsxs("p",{className:"text-xs text-muted-foreground pt-2",children:["Obtenu le ",Ze(new Date(f),"d MMMM yyyy",{locale:pt})]}),s.jsx("div",{className:"pt-3",children:u?s.jsxs("span",{className:"inline-flex items-center gap-2 text-sm font-medium text-primary",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-primary animate-pulse"}),"Débloqué"]}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Pas encore débloqué"})})]})]})]})})]}):s.jsxs(Qk,{children:[s.jsx(Jk,{asChild:!0,children:s.jsxs(Xn.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},whileHover:{scale:1.05},whileTap:{scale:.95},className:ae("relative flex flex-col items-center gap-1 cursor-pointer",i),children:[p,x]})}),s.jsx(Pb,{side:"top",className:"max-w-[200px] z-50",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"font-semibold",children:c.name}),s.jsx("p",{className:"text-xs text-muted-foreground",children:c.description}),!u&&d&&s.jsxs("p",{className:"text-xs text-primary mt-1",children:[d.current,"/",d.target]}),u&&f&&s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Obtenu le ",Ze(new Date(f),"d MMM yyyy",{locale:pt})]})]})})]})});function GT(e,[t,n]){return Math.min(n,Math.max(t,e))}function cIe(e,t){return N.useReducer((n,r)=>t[n][r]??n,e)}var wM="ScrollArea",[zre]=Us(wM),[uIe,$l]=zre(wM),Ure=N.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:a=600,...o}=e,[l,c]=N.useState(null),[u,d]=N.useState(null),[f,h]=N.useState(null),[p,x]=N.useState(null),[y,b]=N.useState(null),[w,_]=N.useState(0),[j,E]=N.useState(0),[S,T]=N.useState(!1),[P,O]=N.useState(!1),D=Qt(t,L=>c(L)),R=Jf(i);return s.jsx(uIe,{scope:n,type:r,dir:R,scrollHideDelay:a,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:x,scrollbarXEnabled:S,onScrollbarXEnabledChange:T,scrollbarY:y,onScrollbarYChange:b,scrollbarYEnabled:P,onScrollbarYEnabledChange:O,onCornerWidthChange:_,onCornerHeightChange:E,children:s.jsx(ut.div,{dir:R,...o,ref:D,style:{position:"relative","--radix-scroll-area-corner-width":w+"px","--radix-scroll-area-corner-height":j+"px",...e.style}})})});Ure.displayName=wM;var qre="ScrollAreaViewport",Vre=N.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=$l(qre,n),l=N.useRef(null),c=Qt(t,l,o.onViewportChange);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),s.jsx(ut.div,{"data-radix-scroll-area-viewport":"",...a,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:s.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Vre.displayName=qre;var gu="ScrollAreaScrollbar",_M=N.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=$l(gu,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,l=e.orientation==="horizontal";return N.useEffect(()=>(l?a(!0):o(!0),()=>{l?a(!1):o(!1)}),[l,a,o]),i.type==="hover"?s.jsx(dIe,{...r,ref:t,forceMount:n}):i.type==="scroll"?s.jsx(fIe,{...r,ref:t,forceMount:n}):i.type==="auto"?s.jsx(Hre,{...r,ref:t,forceMount:n}):i.type==="always"?s.jsx(jM,{...r,ref:t}):null});_M.displayName=gu;var dIe=N.forwardRef((e,t)=>
vendor: 4,244 bytes, line 1186
1186{const{forceMount:n,...r}=e,i=$l(gu,e.__scopeScrollArea),[a,o]=N.useState(!1);return N.useEffect(()=>{const l=i.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),o(!0)},d=()=>{c=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[i.scrollArea,i.scrollHideDelay]),s.jsx(mi,{present:n||a,children:s.jsx(Hre,{"data-state":a?"visible":"hidden",...r,ref:t})})}),fIe=N.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=$l(gu,e.__scopeScrollArea),a=e.orientation==="horizontal",o=IC(()=>c("SCROLL_END"),100),[l,c]=cIe("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return N.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,i.scrollHideDelay,c]),N.useEffect(()=>{const u=i.viewport,d=a?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const p=u[d];f!==p&&(c("SCROLL"),o()),f=p};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[i.viewport,a,c,o]),s.jsx(mi,{present:n||l!=="hidden",children:s.jsx(jM,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Je(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Je(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Hre=N.forwardRef((e,t)=>{const n=$l(gu,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=N.useState(!1),l=e.orientation==="horizontal",c=IC(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;o(l?u:d)}},10);return $x(n.viewport,c),$x(n.content,c),s.jsx(mi,{present:r||a,children:s.jsx(jM,{"data-state":a?"visible":"hidden",...i,ref:t})})}),jM=N.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,i=$l(gu,e.__scopeScrollArea),a=N.useRef(null),o=N.useRef(0),[l,c]=N.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Xre(l.viewport,l.content),d={...r,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>a.current=h,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:h=>o.current=h};function f(h,p){return yIe(h,o.current,l,p)}return n==="horizontal"?s.jsx(hIe,{...d,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){const h=i.viewport.scrollLeft,p=F9(h,l,i.dir);a.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollLeft=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollLeft=f(h,i.dir))}}):n==="vertical"?s.jsx(mIe,{...d,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){const h=i.viewport.scrollTop,p=F9(h,l);a.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollTop=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollTop=f(h))}}):null}),hIe=N.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...i}=e,a=$l(gu,e.__scopeScrollArea),[o,l]=N.useState(),c=N.useRef(null),u=Qt(t,c,a.onScrollbarXChange);return N.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),s.jsx(Gre,{"data-orientation":"horizontal",...i,ref:u,sizes:n,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":DC(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(a.viewport){const h=a.viewport.scrollLeft+d.deltaX;e.onWheelScroll(h),Jre(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:z2(o.paddingLeft),paddingEnd:z2(o.paddingRight)}})}})}),mIe=N.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...i}=e,a=$l(gu,e.__scopeScrollArea),[o,l]=N.useState(),c=N.useRef(null),u=Qt(t,c,a.onScrollbarYChange);return N.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),s.jsx(Gre,{"data-orientation":"vertical",...i,ref:u,sizes:n,style:{to
vendor: 5,605 bytes, line 1186
1186p:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":DC(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(a.viewport){const h=a.viewport.scrollTop+d.deltaY;e.onWheelScroll(h),Jre(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:z2(o.paddingTop),paddingEnd:z2(o.paddingBottom)}})}})}),[pIe,Wre]=zre(gu),Gre=N.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=e,p=$l(gu,n),[x,y]=N.useState(null),b=Qt(t,D=>y(D)),w=N.useRef(null),_=N.useRef(""),j=p.viewport,E=r.content-r.viewport,S=Ms(d),T=Ms(c),P=IC(f,10);function O(D){if(w.current){const R=D.clientX-w.current.left,L=D.clientY-w.current.top;u({x:R,y:L})}}return N.useEffect(()=>{const D=R=>{const L=R.target;(x==null?void 0:x.contains(L))&&S(R,E)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[j,x,E,S]),N.useEffect(T,[r,T]),$x(x,P),$x(p.content,P),s.jsx(pIe,{scope:n,scrollbar:x,hasThumb:i,onThumbChange:Ms(a),onThumbPointerUp:Ms(o),onThumbPositionChange:T,onThumbPointerDown:Ms(l),children:s.jsx(ut.div,{...h,ref:b,style:{position:"absolute",...h.style},onPointerDown:Je(e.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),w.current=x.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),O(D))}),onPointerMove:Je(e.onPointerMove,O),onPointerUp:Je(e.onPointerUp,D=>{const R=D.target;R.hasPointerCapture(D.pointerId)&&R.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=_.current,p.viewport&&(p.viewport.style.scrollBehavior=""),w.current=null})})})}),B2="ScrollAreaThumb",Kre=N.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=Wre(B2,e.__scopeScrollArea);return s.jsx(mi,{present:n||i.hasThumb,children:s.jsx(gIe,{ref:t,...r})})}),gIe=N.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...i}=e,a=$l(B2,n),o=Wre(B2,n),{onThumbPositionChange:l}=o,c=Qt(t,f=>o.onThumbChange(f)),u=N.useRef(void 0),d=IC(()=>{u.current&&(u.current(),u.current=void 0)},100);return N.useEffect(()=>{const f=a.viewport;if(f){const h=()=>{if(d(),!u.current){const p=vIe(f,l);u.current=p,l()}};return l(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[a.viewport,d,l]),s.jsx(ut.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Je(e.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),x=f.clientX-p.left,y=f.clientY-p.top;o.onThumbPointerDown({x,y})}),onPointerUp:Je(e.onPointerUp,o.onThumbPointerUp)})});Kre.displayName=B2;var NM="ScrollAreaCorner",Yre=N.forwardRef((e,t)=>{const n=$l(NM,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?s.jsx(xIe,{...e,ref:t}):null});Yre.displayName=NM;var xIe=N.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,i=$l(NM,n),[a,o]=N.useState(0),[l,c]=N.useState(0),u=!!(a&&l);return $x(i.scrollbarX,()=>{var f;const d=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(d),c(d)}),$x(i.scrollbarY,()=>{var f;const d=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(d),o(d)}),u?s.jsx(ut.div,{...r,ref:t,style:{width:a,height:l,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function z2(e){return e?parseInt(e,10):0}function Xre(e,t){const n=e/t;return isNaN(n)?0:n}function DC(e){const t=Xre(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function yIe(e,t,n,r="ltr"){const i=DC(n),a=i/2,o=t||a,l=i-o,c=n.scrollbar.paddingStart+o,u=n.scrollbar.size-n.scrollbar.paddingEnd-l,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return Qre([c,u],f)(e)}function F9(e,t,n="ltr"){const r=DC(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,l=a-r,c=n==="ltr"?[0,o]:[o*-1,0],u=GT(e,c);return Qre([0,o],[0,l])(u)}function Qre(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Jre(e,t){return e>0&&e<t}var vIe=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function i(){const a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,l=n.top!==a.top;(o||l)&&t(),n=a,r=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(r)};function IC(e,t){const n=Ms(e),r=N.useRef(0);return N.useEffect(()=>()=>window.clearTimeout(r.current),[]),N.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function $x(e,t){const n=Ms(t);Bs(()=>{let r=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(e),()=>{window.cancelAnimationFrame(r),i.unobserve(e)}}},[e,n])}var Zre=Ure,bIe=Vre,wIe=Yre;const cd=N.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(Zre,{ref:r,className:ae("relative overflow-hidden",e),...n,children:[s.jsx(bIe,{className:"h-full w-full rounded-[inherit]",children:t}),s.jsx(kM,{}),s.jsx(wIe,{})]}));cd.displayName=Zre.displayName;
1186const kM=N.forwardRef(({className:e,orientation:t="vertical",...n},r)=>s.jsx(_M,{ref:r,orientation:t,className:ae("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:s.jsx(Kre,{className:"relative flex-1 rounded-full bg-border"})}));kM.displayName=_M.displayName;const h_=ee.memo(function({achievements:t,title:n,icon:r,showProgress:i=!1,variant:a="grid",className:o}){const l=[...t].sort((f,h)=>f.earned&&!h.earned?-1:!f.earned&&h.earned?1:f.badge.code.localeCompare(h.badge.code)),c=t.filter(f=>f.earned).length,u={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.05}}},d={hidden:{opacity:0,y:10},visible:{opacity:1,y:0}};return t.length===0?null:s.jsxs("div",{className:ae("space-y-3",o),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[r&&s.jsx("span",{children:r}),n]}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[c,"/",t.length]})]}),a==="scroll"?s.jsxs(cd,{className:"w-full whitespace-nowrap",children:[s.jsx(Xn.div,{variants:u,initial:"hidden",animate:"visible",className:"flex gap-3 pb-2",children:l.map(f=>s.jsx(Xn.div,{variants:d,children:s.jsx(L9,{achievement:f,size:"md",showProgress:i})},f.badge.id))}),s.jsx(kM,{orientation:"horizontal"})]}):s.jsx(Xn.div,{variants:u,initial:"hidden",animate:"visible",className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 gap-2 sm:gap-3",children:l.map(f=>s.jsx(Xn.div,{variants:d,className:"flex justify-center",children:s.jsx(L9,{achievement:f,size:"md",showProgress:i})},f.badge.id))})]})}),_Ie=ee.memo(function({venue:t,rank:n}){return s.jsxs(Xn.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(n||0)*.05,duration:.2},className:ae("venue-visit-card flex items-center gap-3 p-3 rounded-xl","bg-gradient-to-r from-card/80 to-card/40","backdrop-blur-sm border border-border/30","transition-all duration-200 hover:translate-x-1",t.isFavorite&&"favorite-venue-glow border-amber-500/40"),children:[n!==void 0&&s.jsx("div",{className:ae("w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold shrink-0",n===0?"bg-amber-500/20 text-amber-500":"bg-muted text-muted-foreground"),children:n+1}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-medium text-sm truncate",children:t.venueName}),t.isFavorite&&s.jsx(tu,{className:"w-3.5 h-3.5 text-amber-500 fill-amber-500 shrink-0"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground mt-0.5",children:[s.jsx(gn,{className:"w-3 h-3 shrink-0"}),s.jsx("span",{className:"truncate",children:t.city})]})]}),s.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[s.jsx("span",{className:ae("text-lg font-bold tabular-nums",t.isFavorite?"text-amber-500":"text-foreground"),children:t.visitCount}),s.jsxs("span",{className:"text-[10px] text-muted-foreground leading-none",children:["visite",t.visitCount>1?"s":""]})]})]})}),$9=3,jIe=ee.memo(function({stats:t,isLoading:n,className:r,variant:i="full"}){var f,h;const[a,o]=N.useState(!1);if(n)return s.jsx(Se,{className:ae("bg-card/50 backdrop-blur-sm",r),children:s.jsx(De,{className:"p-4",children:s.jsxs("div",{className:"animate-pulse space-y-3",children:[s.jsx("div",{className:"h-4 bg-muted rounded w-1/3"}),s.jsx("div",{className:"h-10 bg-muted rounded"})]})})});if(!t)return null;const l=t.venueVisits.length>0,c=a?t.venueVisits:t.venueVisits.slice(0,$9),u=t.venueVisits.length-$9,d=[{icon:gn,value:((f=t.uniqueArrondissements)==null?void 0:f.length)??0,label:"Arrondts",color:"text-blue-500",bgColor:"bg-blue-500/10"},{icon:km,value:t.uniqueVenues,label:"Lieux",color:"text-amber-500",bgColor:"bg-amber-500/10"},{icon:Jn,value:t.totalEvents,label:"Tournois",color:"text-emerald-500",bgColor:"bg-emerald-500/10"}];return s.jsx(Se,{className:ae("explorer-card overflow-hidden",r),children:s.jsxs(De,{className:"p-4",children:[s.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-4 flex items-center gap-2",children:[s.jsx("span",{children:"🗺️"}),"Exploration"]}),s.jsx("div",{className:"grid grid-cols-3 gap-3",children:d.map((p,x)=>s.jsxs(Xn.div,{initial:{opacity:0,y:10}
1186,animate:{opacity:1,y:0},transition:{delay:x*.1},className:"flex flex-col items-center text-center",children:[s.jsx("div",{className:ae("w-10 h-10 rounded-full flex items-center justify-center mb-2",p.bgColor),children:s.jsx(p.icon,{className:ae("w-5 h-5",p.color)})}),s.jsx("span",{className:"text-lg font-bold tabular-nums",children:p.value}),s.jsx("span",{className:"text-xs text-muted-foreground",children:p.label})]},p.label))}),t.favoriteVenue&&i==="full"&&s.jsx(Xn.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{delay:.3},className:"mt-4 p-3 rounded-xl favorite-venue-highlight bg-gradient-to-r from-amber-500/10 to-amber-600/5 border border-amber-500/20",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-500/20 flex items-center justify-center shrink-0",children:s.jsx(tu,{className:"w-5 h-5 text-amber-500 fill-amber-500"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-[10px] text-amber-600 dark:text-amber-400 font-medium uppercase tracking-wider",children:"Lieu favori"}),s.jsx("p",{className:"font-semibold truncate",children:t.favoriteVenue.venueName}),s.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[s.jsx(gn,{className:"w-3 h-3"}),t.favoriteVenue.city]})]}),s.jsxs(we,{variant:"secondary",className:"shrink-0 bg-amber-500/20 text-amber-600 dark:text-amber-400 border-amber-500/30",children:[t.favoriteVenue.visitCount," visite",t.favoriteVenue.visitCount>1?"s":""]})]})}),l&&i==="full"&&s.jsxs("div",{className:"mt-4 pt-4 border-t border-border/50",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1.5",children:[s.jsx(km,{className:"w-3 h-3"}),"Lieux visités"]}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.uniqueVenues," lieu",t.uniqueVenues>1?"x":""]})]}),s.jsx("div",{className:"space-y-2",children:s.jsx(R2,{mode:"popLayout",children:c.map((p,x)=>s.jsx(_Ie,{venue:p,rank:x},p.venueId))})}),u>0&&s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>o(!a),className:"w-full mt-2 text-xs text-muted-foreground hover:text-foreground",children:a?s.jsxs(s.Fragment,{children:[s.jsx(aI,{className:"w-4 h-4 mr-1"}),"Voir moins"]}):s.jsxs(s.Fragment,{children:[s.jsx(Wa,{className:"w-4 h-4 mr-1"}),"Voir ",u," autre",u>1?"s":""," lieu",u>1?"x":""]})})]}),(((h=t.uniqueArrondissements)==null?void 0:h.length)??0)>0&&i==="full"&&s.jsxs("div",{className:"mt-4 pt-4 border-t border-border/50",children:[s.jsxs("p",{className:"text-xs text-muted-foreground mb-2 flex items-center gap-1.5",children:[s.jsx(gn,{className:"w-3 h-3"}),"Arrondissements explorés"]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.uniqueArrondissements.map(p=>s.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs bg-secondary/50 text-secondary-foreground",children:parseInt(p)===1?"1er":`${parseInt(p)}e`},p))})]}),!l&&i==="full"&&s.jsxs("div",{className:"mt-4 text-center py-6 text-muted-foreground",children:[s.jsx(km,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),s.jsx("p",{className:"text-sm",children:"Aucun lieu visité pour le moment"}),s.jsx("p",{className:"text-xs mt-1",children:"Participez à des tournois pour découvrir de nouveaux lieux !"})]})]})})}),ese=ee.memo(function({userId:t,variant:n="full",className:r}){const{data:i,isLoading:a}=ZDe(t),{data:o,isLoading:l}=Rre(t);if(a||l)return s.jsx(Se,{className:ae("bg-card/50 backdrop-blur-sm",r),children:s.jsx(De,{className:"p-6 flex items-center justify-center",children:s.jsx(We,{className:"w-6 h-6 animate-spin text-muted-foreground"})})});if(!i)return null;const u=[...i.ranking,...i.milestone,...i.exploration,...i.loyalty],d=u.filter(p=>p.earned).length,f=u.length,h=f>0?d/f*100:0;return n==="compact"?s.jsxs(Se,{className:ae("achievements-card",r),children:[s.jsx(kt,{className:"pb-3",children:s.jsxs(Et,{className:"text-base flex items-center gap-2",children:[s.jsx(x5,{className:"w-4 h-4 text-primary"}),"Achievements",s.jsxs("span",{className:"text-xs text-muted-foreground ml-auto",children:[d,"/",f]})]})}),s.jsxs(De,{className:"pt-0 space-y-4",children:[s.jsx(du,{value:h,className:"h-2"}),s.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-1",children:[i.ranking.filter(p=>p.earned).slice(0,5).map(p=>s.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full badge-earned flex items-center justify-center text-lg",children:p.badge.icon},p.badge.id)),i.ranking.filter(p=>p.earned).length===0&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"Participez à des tournois pour débloquer des badges !"})]})]})]}):s.jsxs(Xn.div,{initial:{opacity:0,y:20}
1186,animate:{opacity:1,y:0},className:ae("space-y-6",r),children:[s.jsxs(Se,{className:"achievements-card",children:[s.jsx(kt,{className:"pb-3",children:s.jsxs(Et,{className:"text-lg flex items-center gap-2",children:[s.jsx(x5,{className:"w-5 h-5 text-primary"}),"Mes Achievements"]})}),s.jsx(De,{className:"pt-0",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(du,{value:h,className:"flex-1 h-3"}),s.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:[d,"/",f]})]})})]}),s.jsx(jIe,{stats:o,isLoading:l}),s.jsx(Se,{className:"achievements-card",children:s.jsx(De,{className:"p-4",children:s.jsx(h_,{achievements:i.ranking,title:"Classements",icon:"🏆",variant:"scroll"})})}),s.jsx(Se,{className:"achievements-card",children:s.jsx(De,{className:"p-4",children:s.jsx(h_,{achievements:i.milestone,title:"Progression",icon:"⚔️",showProgress:!0,variant:"grid"})})}),s.jsx(Se,{className:"achievements-card",children:s.jsx(De,{className:"p-4",children:s.jsx(h_,{achievements:i.exploration,title:"Exploration",icon:"🗺️",showProgress:!0,variant:"scroll"})})}),i.loyalty.length>0&&s.jsx(Se,{className:"achievements-card",children:s.jsx(De,{className:"p-4",children:s.jsx(h_,{achievements:i.loyalty,title:"Fidélité",icon:"💎",showProgress:!0,variant:"scroll"})})})]})});function NIe({eventId:e,eventTitle:t,eventDate:n,venue:r,ticketCount:i,className:a,index:o=0}){const l=new Date(n),c=Ze(l,"EEE",{locale:pt}),u=Ze(l,"d MMM",{locale:pt}),d=Ze(l,"HH'h'mm",{locale:pt}),f=Ze(l,"EEEE d MMMM · HH'h'mm",{locale:pt});return s.jsx(Xn.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:o*.05,duration:.2},children:s.jsx(Pe,{to:`/events/${e}/ticket`,className:"block group",children:s.jsxs("div",{className:ae("flex items-center gap-3 p-3 min-h-[48px]","sm:gap-4 sm:p-4","rounded-xl border border-border/50","bg-gradient-to-br from-card/80 to-card/40 backdrop-blur-sm","hover:border-primary/40 hover:shadow-md hover:shadow-primary/5","transition-all duration-200",a),children:[s.jsx("div",{className:"hidden sm:flex w-10 h-10 rounded-lg bg-primary/10 items-center justify-center shrink-0",children:s.jsx(vo,{className:"w-5 h-5 text-primary"})}),s.jsx("div",{className:"sm:hidden w-1.5 h-1.5 rounded-full bg-primary shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h4",{className:"font-medium text-foreground truncate text-sm sm:text-base",children:t}),i>1&&s.jsxs(we,{variant:"secondary",className:"shrink-0 text-[10px] px-1.5 py-0 h-5 sm:text-xs sm:px-2",children:[s.jsx(sn,{className:"w-3 h-3 mr-0.5 sm:mr-1"}),i]})]}),r&&s.jsxs("p",{className:"flex items-center gap-1.5 text-xs sm:text-sm text-muted-foreground",children:[s.jsx(gn,{className:"w-3 h-3 sm:w-3.5 sm:h-3.5 shrink-0"}),s.jsx("span",{className:"truncate sm:hidden",children:r.city||r.name}),s.jsxs("span",{className:"truncate hidden sm:inline",children:[r.name,r.city&&` · ${r.city}`]})]}),s.jsxs("p",{className:"text-xs text-muted-foreground capitalize",children:[s.jsxs("span",{className:"sm:hidden",children:[c," ",u," · ",d]}),s.jsx("span",{className:"hidden sm:inline",children:f})]})]}),s.jsx(la,{className:ae("w-4 h-4 text-muted-foreground shrink-0","group-hover:text-primary group-hover:translate-x-0.5","transition-all duration-200")})]})})})}function tse({venueId:e,venueName:t,variant:n="floating",className:r}){const{user:i}=Tt(),a=Rr(),o=fa(),{data:l,isLoading:c}=Ete(e),u=Ste(),d=Ate(),f=u.isPending||d.isPending,h=l?"Retirer des favoris":"Ajouter aux favoris",p=async y=>{if(y.preventDefault(),y.stopPropagation(),!i){je.info("Connectez-vous pour ajouter ce lieu à vos favoris"),a("/auth",{state:{from:o}});return}try{l?(await d.mutateAsync(e),je.success(`${t} retiré des favoris`)):(await u.mutateAsync(e),je.success(`${t} ajouté aux favoris`))}catch(b){const w=b instanceof Error?b.message:"Une erreur est survenue";je.error(w)}},x=n==="floating"?"absolute top-3 right-3 z-10 h-10 w-10 rounded-full bg-background/80 backdrop-blur-sm hover:bg-background shadow-sm":"h-9 w-9";return s.jsx(Xk,{delayDuration:300,children:s.jsxs(Qk,{children:[s.jsx(Jk,{asChild:!0,children:s.jsx(Q,{type:"button",size:"icon",variant:"ghost",onClick:p,disabled:f||c,"aria-label":h,"aria-pressed":!!l,className:ae(x,r),children:f||c?s.jsx(We,{className:"w-5 h-5 animate-spin"}):s.jsx(tu,{className:ae("w-5 h-5 transition-colors",l?"fill-primary text-primary":"text-foreground")})})}),s.jsx(Pb,{side:"left",children:h})]})})}function nse({className:e,nextPath:t}){const{user:n,profile:r,isPlayer:i,refreshProfile:a}=Tt(),[o,l]=N.useState(!1),c=r==null?void 0:r.onboarding_elo_completed_at;if(!n||!i||!r||c)return null;const u=async()=>{n&&(l(!0),await re.from("profiles").update({onboarding_elo_completed_at:new Date().toISOString()}).eq("id",n.id),await a())},d=t?`/onboarding/elo?next=${encodeURIComponent(t)}`:"/onboarding/elo";return s.jsxs("div",{className:ae("relative rounded-2xl border border-primary/30 bg-primary/5 p-4 md:p-5 flex flex-col md:flex-row md:items-center gap-3",o&&"opacity-50 pointer-events-none",e),children:[s.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/15 text-primary flex items-center justify-center shrink-0",children:s.jsx(Ti,{className:"w-5 h-5"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"font-display text-base font-bold text-foreground",children:"Renseigne ton niveau (30 sec)"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Pour Ã
1186ªtre placé face à des adversaires de ton calibre — et suivre ta progression dès le prochain tournoi."})]})]}),s.jsxs("div",{className:"flex items-center gap-2 self-end md:self-auto",children:[s.jsx(Q,{asChild:!0,size:"sm",children:s.jsx(Pe,{to:d,children:"Commencer"})}),s.jsx(Q,{type:"button",variant:"ghost",size:"icon","aria-label":"Ignorer",onClick:u,disabled:o,className:"text-muted-foreground hover:text-foreground",children:s.jsx(Er,{className:"w-4 h-4"})})]})]})}const KT=600,rse="NC";function sse(e){return e==null||e<=0}function qf(e){return sse(e)?rse:String(e)}function Xm(e){return sse(e)?rse:`Elo ${e}`}const kIe=()=>{const{user:e,profile:t,signOut:n}=Tt(),r=Rr(),{data:i,isLoading:a}=uee(12),[o,l]=N.useState(!1),{data:c,isLoading:u}=EC(),{data:d=[],isLoading:f}=X3e(),{data:h=[],isLoading:p}=Tte(),x=(i==null?void 0:i.map(S=>S.id))||[],{data:y}=_R(x),b=N.useMemo(()=>{const S=new Date,T={};return d.forEach(P=>{if(!P.event||new Date(P.event.event_date)<=S||P.event.status==="cancelled")return;const D=P.event.id;T[D]||(T[D]={eventId:D,eventTitle:P.event.title,eventDate:P.event.event_date,venue:P.event.venue,ticketCount:0}),T[D].ticketCount+=1}),Object.values(T).sort((P,O)=>new Date(P.eventDate).getTime()-new Date(O.eventDate).getTime()).slice(0,3)},[d]),w=d.length,_=(t==null?void 0:t.display_name)||(t==null?void 0:t.first_name)||"Joueur",j=[{label:"Tournois joués",value:u?"-":((c==null?void 0:c.tournaments_played)||0).toString(),icon:Xt},{label:"Tournois gagnés",value:u?"-":((c==null?void 0:c.tournaments_won)||0).toString(),icon:sa},{label:"Parties gagnées",value:u?"-":((c==null?void 0:c.wins)||0).toString(),icon:iX},{label:"Elo",value:u?"-":qf(c==null?void 0:c.elo_rating),icon:rX}],E=async()=>{await n(),r("/")};return s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"mb-8",children:[s.jsxs("h1",{className:"font-display text-3xl md:text-4xl font-bold text-foreground mb-2",children:["Bienvenue, ",_," !"]}),s.jsx("p",{className:"text-muted-foreground",children:"Votre espace joueur pour suivre vos tournois et progresser."})]}),s.jsx(nse,{className:"mb-6"}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-8",children:j.map((S,T)=>s.jsx(Se,{className:"border-border/50",children:s.jsxs(De,{className:"p-4 text-center",children:[s.jsx(S.icon,{className:"w-5 h-5 text-primary mx-auto mb-2"}),s.jsx("p",{className:"text-2xl font-bold text-foreground",children:S.value}),s.jsx("p",{className:"text-xs text-muted-foreground",children:S.label})]})},T))}),s.jsxs(Se,{className:"border-border/50 mb-8",children:[s.jsxs(kt,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(vo,{className:"w-5 h-5 text-primary"}),s.jsx(Et,{className:"font-display text-xl",children:"Mes inscriptions"})]}),s.jsx(Qs,{children:"Vos prochains tournois"})]}),s.jsx(De,{children:f?s.jsx("div",{className:"space-y-3",children:[1,2].map(S=>s.jsx(Ie,{className:"h-20 w-full"},S))}):b.length>0?s.jsxs("div",{className:"space-y-3",children:[b.map((S,T)=>s.jsx(NIe,{eventId:S.eventId,eventTitle:S.eventTitle,eventDate:S.eventDate,venue:S.venue,ticketCount:S.ticketCount,index:T},S.eventId)),w>3&&s.jsx(Pe,{to:"/player/history",className:"block",children:s.jsxs(Q,{variant:"ghost",className:"w-full text-muted-foreground",children:["Voir tout (",w," inscriptions)"]})})]}):s.jsxs("div",{className:"text-center py-8",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-secondary flex items-center justify-center mx-auto mb-4",children:s.jsx(vo,{className:"w-8 h-8 text-muted-foreground"})}),s.jsx("h3",{className:"font-display text-lg font-semibold mb-2",children:"Aucune inscription"}),s.jsx("p",{className:"text-muted-foreground text-sm max-w-md mx-auto mb-4",children:"Inscrivez-vous à un tournoi pour le voir apparaître ici."}),s.jsx(Q,{variant:"outline",asChild:!0,children:s.jsx(Pe,{to:"/events",children:"Voir les tournois"})})]})})]}),s.jsx(p5e,{}),s.jsx(ese,{userId:e==null?void 0:e.id,variant:"compact"}),s.jsxs(Se,{className:"border-border/50 mb-8",children:[s.jsxs(kt,{children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(tu,{className:"w-5 h-5 text-primary fill-primary"}),s.jsx(Et,{className:"font-display text-xl",children:"Mes lieux favoris"})]}),h.length>6&&s.jsxs(Pe,{to:"/player/favorites",className:"text-sm text-primary hover:underline whitespace-nowrap",children:["Voir tout (",h.length,")"]})]}),s.jsx(Qs,{children:"Les lieux que vous suivez"})]}),s.jsx(De,{children:p?s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ie,{className:"h-14 roun
1186ded-lg"}),s.jsx(Ie,{className:"h-14 rounded-lg"})]}):h.length===0?s.jsxs("div",{className:"text-center py-6 space-y-3",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Aucun lieu favori pour l'instant."}),s.jsx(Pe,{to:"/venues",children:s.jsxs(Q,{variant:"outline",size:"sm",className:"gap-2",children:[s.jsx(gn,{className:"w-4 h-4"}),"Découvrir les lieux"]})})]}):s.jsx("div",{className:"space-y-2",children:h.slice(0,6).map(S=>{const T=S.venue;return T?s.jsxs(Pe,{to:`/venues/${T.slug||T.id}`,className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 transition-colors group",children:[T.image_url?s.jsx("img",{src:T.image_url,alt:T.name,className:"w-12 h-12 rounded-lg object-cover"}):s.jsx("div",{className:"w-12 h-12 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(gn,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-medium truncate group-hover:text-primary transition-colors",children:T.name}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:T.city})]}),s.jsx(tse,{venueId:T.id,venueName:T.name,variant:"inline"})]},S.id):null})})})]}),s.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[s.jsx(Pe,{to:"/player/profile",children:s.jsx(Se,{className:"border-border/50 hover:border-primary/30 transition-colors cursor-pointer h-full",children:s.jsxs(De,{className:"p-6 flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center",children:s.jsx(Cs,{className:"w-6 h-6 text-primary"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"font-semibold mb-1",children:"Mon profil"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Gérer mes informations"})]}),s.jsx(Sr,{className:"w-5 h-5 text-muted-foreground"})]})})}),s.jsx(Pe,{to:"/player/favorites",children:s.jsx(Se,{className:"border-border/50 hover:border-primary/30 transition-colors cursor-pointer h-full",children:s.jsxs(De,{className:"p-6 flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center",children:s.jsx(tu,{className:"w-6 h-6 text-primary"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"font-semibold mb-1",children:"Mes favoris"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Mes lieux préférés"})]}),s.jsx(Sr,{className:"w-5 h-5 text-muted-foreground"})]})})}),s.jsx(Pe,{to:"/player/history",children:s.jsx(Se,{className:"border-border/50 hover:border-primary/30 transition-colors cursor-pointer h-full",children:s.jsxs(De,{className:"p-6 flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center",children:s.jsx(Xt,{className:"w-6 h-6 text-primary"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"font-semibold mb-1",children:"Mon historique"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Voir mes parties passées"})]}),s.jsx(Sr,{className:"w-5 h-5 text-muted-foreground"})]})})})]}),s.jsxs(Se,{className:"border-border/50 mb-8",children:[s.jsxs(kt,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Jn,{className:"w-5 h-5 text-primary"}),s.jsx(Et,{className:"font-display text-xl",children:"Prochains tournois"})]}),s.jsx(Qs,{children:"Les tournois à venir près de chez vous"})]}),s.jsx(De,{children:a?s.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:[1,2].map(S=>s.jsx(Ie,{className:"h-48 w-full"},S))}):i&&i.length>0?s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:i.slice(0,3).map(S=>s.jsx(b7,{event:S,ticketCount:(y==null?void 0:y[S.id])||0},S.id))}),i.length>3&&s.jsxs(Ix,{open:o,onOpenChange:l,children:[s.jsx(Mx,{className:"data-[state=open]:animate-in data-[state=closed]:animate-out",children:s.jsx("div",{className:"grid gap-4 md:grid-cols-2 pt-4",children:i.slice(3).map(S=>s.jsx(b7,{event:S,ticketCount:(y==null?void 0:y[S.id])||0},S.id))})}),s.jsx(Rx,{asChild:!0,children:s.jsxs(Q,{variant:"ghost",className:"w-full mt-2 text-muted-foreground gap-2",children:[o?"Réduire":`Voir ${i.length-3} tournoi${i.length-3>1?"s":""} de plus`,s.jsx(Wa,{className:`w-4 h-4 transition-transform ${o?"rotate-180":""}`})]})})]}),s.jsx(Q,{variant:"outline",asChild:!0,className:"w-full mt-2 gap-2",children:s.jsxs(Pe,{to:"/events",children:["Découvrir plus de tournois",s.jsx(Sr,{className:"w-4 h-4"})]})})]}):s.jsxs("div",{className:"text-center py-8",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-secondary flex items-center justify-center mx-auto mb-4",children:s.jsx(gn,{className:"w-8 h-8 text-muted-foreground"})}),s.jsx("h3",{className:"font-display text-lg font-semibold mb-2",children:"Aucun tournoi prévu"}),s.jsx("p",{className:"text-muted-foreground text-sm max-w-md mx-auto mb-4",children:"Les proch
1186ains événements seront affichés ici. Revenez bientôt !"}),s.jsx(Q,{variant:"outline",asChild:!0,children:s.jsx(Pe,{to:"/events",children:"Voir tous les événements"})})]})})]}),s.jsx("div",{className:"text-center",children:s.jsxs(Q,{variant:"ghost",className:"text-muted-foreground gap-2",onClick:E,children:[s.jsx(a1,{className:"w-4 h-4"}),"Se déconnecter"]})})]})};function RC(e){const t=N.useRef({value:e,previous:e});return N.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var CIe=[" ","Enter","ArrowUp","ArrowDown"],EIe=[" ","Enter"],Qm="Select",[MC,LC,SIe]=Nb(Qm),[I0]=Us(Qm,[SIe,Xf]),FC=Xf(),[AIe,ah]=I0(Qm),[TIe,PIe]=I0(Qm),ise=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:x}=e,y=FC(t),[b,w]=N.useState(null),[_,j]=N.useState(null),[E,S]=N.useState(!1),T=Jf(u),[P,O]=Hi({prop:r,defaultProp:i??!1,onChange:a,caller:Qm}),[D,R]=Hi({prop:o,defaultProp:l,onChange:c,caller:Qm}),L=N.useRef(null),M=b?x||!!b.closest("form"):!0,[B,U]=N.useState(new Set),F=Array.from(B).map(H=>H.props.value).join(";");return s.jsx(Vk,{...y,children:s.jsxs(AIe,{required:p,scope:t,trigger:b,onTriggerChange:w,valueNode:_,onValueNodeChange:j,valueNodeHasChildren:E,onValueNodeHasChildrenChange:S,contentId:di(),value:D,onValueChange:R,open:P,onOpenChange:O,dir:T,triggerPointerDownPosRef:L,disabled:h,children:[s.jsx(MC.Provider,{scope:t,children:s.jsx(TIe,{scope:e.__scopeSelect,onNativeOptionAdd:N.useCallback(H=>{U(z=>new Set(z).add(H))},[]),onNativeOptionRemove:N.useCallback(H=>{U(z=>{const K=new Set(z);return K.delete(H),K})},[]),children:n})}),M?s.jsxs(Ase,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:D,onChange:H=>R(H.target.value),disabled:h,form:x,children:[D===void 0?s.jsx("option",{value:""}):null,Array.from(B)]},F):null]})})};ise.displayName=Qm;var ase="SelectTrigger",ose=N.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,a=FC(n),o=ah(ase,n),l=o.disabled||r,c=Qt(t,o.onTriggerChange),u=LC(n),d=N.useRef("touch"),[f,h,p]=Pse(y=>{const b=u().filter(j=>!j.disabled),w=b.find(j=>j.value===o.value),_=Ose(b,y,w);_!==void 0&&o.onValueChange(_.value)}),x=y=>{l||(o.onOpenChange(!0),p()),y&&(o.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)})};return s.jsx(Tb,{asChild:!0,...a,children:s.jsx(ut.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Tse(o.value)?"":void 0,...i,ref:c,onClick:Je(i.onClick,y=>{y.currentTarget.focus(),d.current!=="mouse"&&x(y)}),onPointerDown:Je(i.onPointerDown,y=>{d.current=y.pointerType;const b=y.target;b.hasPointerCapture(y.pointerId)&&b.releasePointerCapture(y.pointerId),y.button===0&&y.ctrlKey===!1&&y.pointerType==="mouse"&&(x(y),y.preventDefault())}),onKeyDown:Je(i.onKeyDown,y=>{const b=f.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&h(y.key),!(b&&y.key===" ")&&CIe.includes(y.key)&&(x(),y.preventDefault())})})})});ose.displayName=ase;var lse="SelectValue",cse=N.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:a,placeholder:o="",...l}=e,c=ah(lse,n),{onValueNodeHasChildrenChange:u}=c,d=a!==void 0,f=Qt(t,c.onValueNodeChange);return Bs(()=>{u(d)},[u,d]),s.jsx(ut.span,{...l,ref:f,style:{pointerEvents:"none"},children:Tse(c.value)?s.jsx(s.Fragment,{children:o}):a})});cse.displayName=lse;var OIe="SelectIcon",use=N.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return s.jsx(ut.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});use.displayName=OIe;var DIe="SelectPortal",dse=e=>s.jsx(g0,{asChild:!0,...e});dse.displayName=DIe;var Jm="SelectContent",fse=N.forwardRef((e,t)=>{const n=ah(Jm,e.__scopeSelect),[r,i]=N.useState();if(Bs(()=>{i(new DocumentFragment)},[]),!n.open){const a=r;return a?Yf.createPortal(s.jsx(hse,{scope:e.__scopeSelect,children:s.jsx(MC.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),a):null}return s.jsx(mse,{...e,ref:t})});fse.displayName=Jm;var Ql=10,[hse,oh]=I0(Jm),IIe="SelectContentImpl",RIe=Df("SelectContent.RemoveScroll"),mse=N.forwardRef((e,t)=>
vendor: 14,633 bytes, line 1186
1186{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:x,hideWhenDetached:y,avoidCollisions:b,...w}=e,_=ah(Jm,n),[j,E]=N.useState(null),[S,T]=N.useState(null),P=Qt(t,ce=>E(ce)),[O,D]=N.useState(null),[R,L]=N.useState(null),M=LC(n),[B,U]=N.useState(!1),F=N.useRef(!1);N.useEffect(()=>{if(j)return cC(j)},[j]),oC();const H=N.useCallback(ce=>{const[le,...fe]=M().map(pe=>pe.ref.current),[be]=fe.slice(-1),_e=document.activeElement;for(const pe of ce)if(pe===_e||(pe==null||pe.scrollIntoView({block:"nearest"}),pe===le&&S&&(S.scrollTop=0),pe===be&&S&&(S.scrollTop=S.scrollHeight),pe==null||pe.focus(),document.activeElement!==_e))return},[M,S]),z=N.useCallback(()=>H([O,j]),[H,O,j]);N.useEffect(()=>{B&&z()},[B,z]);const{onOpenChange:K,triggerPointerDownPosRef:W}=_;N.useEffect(()=>{if(j){let ce={x:0,y:0};const le=be=>{var _e,pe;ce={x:Math.abs(Math.round(be.pageX)-(((_e=W.current)==null?void 0:_e.x)??0)),y:Math.abs(Math.round(be.pageY)-(((pe=W.current)==null?void 0:pe.y)??0))}},fe=be=>{ce.x<=10&&ce.y<=10?be.preventDefault():j.contains(be.target)||K(!1),document.removeEventListener("pointermove",le),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",le),document.addEventListener("pointerup",fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",le),document.removeEventListener("pointerup",fe,{capture:!0})}}},[j,K,W]),N.useEffect(()=>{const ce=()=>K(!1);return window.addEventListener("blur",ce),window.addEventListener("resize",ce),()=>{window.removeEventListener("blur",ce),window.removeEventListener("resize",ce)}},[K]);const[q,oe]=Pse(ce=>{const le=M().filter(_e=>!_e.disabled),fe=le.find(_e=>_e.ref.current===document.activeElement),be=Ose(le,ce,fe);be&&setTimeout(()=>be.ref.current.focus())}),J=N.useCallback((ce,le,fe)=>{const be=!F.current&&!fe;(_.value!==void 0&&_.value===le||be)&&(D(ce),be&&(F.current=!0))},[_.value]),Y=N.useCallback(()=>j==null?void 0:j.focus(),[j]),Z=N.useCallback((ce,le,fe)=>{const be=!F.current&&!fe;(_.value!==void 0&&_.value===le||be)&&L(ce)},[_.value]),G=r==="popper"?YT:pse,se=G===YT?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:x,hideWhenDetached:y,avoidCollisions:b}:{};return s.jsx(hse,{scope:n,content:j,viewport:S,onViewportChange:T,itemRefCallback:J,selectedItem:O,onItemLeave:Y,itemTextRefCallback:Z,focusSelectedItem:z,selectedItemText:R,position:r,isPositioned:B,searchRef:q,children:s.jsx(Mb,{as:RIe,allowPinchZoom:!0,children:s.jsx(Rb,{asChild:!0,trapped:_.open,onMountAutoFocus:ce=>{ce.preventDefault()},onUnmountAutoFocus:Je(i,ce=>{var le;(le=_.trigger)==null||le.focus({preventScroll:!0}),ce.preventDefault()}),children:s.jsx(up,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:ce=>ce.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:s.jsx(G,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:ce=>ce.preventDefault(),...w,...se,onPlaced:()=>U(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:Je(w.onKeyDown,ce=>{const le=ce.ctrlKey||ce.altKey||ce.metaKey;if(ce.key==="Tab"&&ce.preventDefault(),!le&&ce.key.length===1&&oe(ce.key),["ArrowUp","ArrowDown","Home","End"].includes(ce.key)){let be=M().filter(_e=>!_e.disabled).map(_e=>_e.ref.current);if(["ArrowUp","End"].includes(ce.key)&&(be=be.slice().reverse()),["ArrowUp","ArrowDown"].includes(ce.key)){const _e=ce.target,pe=be.indexOf(_e);be=be.slice(pe+1)}setTimeout(()=>H(be)),ce.preventDefault()}})})})})})})});mse.displayName=IIe;var MIe="SelectItemAlignedPosition",pse=N.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,a=ah(Jm,n),o=oh(Jm,n),[l,c]=N.useState(null),[u,d]=N.useState(null),f=Qt(t,P=>d(P)),h=LC(n),p=N.useRef(!1),x=N.useRef(!0),{viewport:y,selectedItem:b,selectedItemText:w,focusSelectedItem:_}=o,j=N.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&u&&y&&b&&w){const P=a.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),D=a.valueNode.getBoundingClientRect(),R=w.getBoundingClientRect();if(a.dir!=="rtl"){const _e=R.left-O.left,pe=D.left-_e,Te=P.left-pe,Ge=P.width+Te,Ne=Math.max(Ge,O.width),it=window.innerWidth-Ql,qe=GT(pe,[Ql,Math.max(Ql,it-Ne)]);l.style.minWidth=Ge+"px",l.style.left=qe+"px"}else{const _e=O.right-R.right,pe=window.innerWidth-D.right-_e,Te=window.innerWidth-P.right-pe,Ge=P.width+Te,Ne=Math.max(Ge,O.width),it=window.innerWidth-Ql,qe=GT(pe,[Ql,Math.max(Ql,it-Ne)]);l.style.minWidth=Ge+"px",l.style.right=qe+"px"}const L=h(),M=window.innerHeight-Ql*2,B=y.scrollHeight,U=window.getComputedStyle(u),F=parseInt(U.borderTopWidth,10),H=parseInt(U.paddingTop,10),z=parseInt(U.borderBottomWidth,10),K=parseInt(U.paddingBottom,10),W=F+H+B+K+z,q=Math.min(b.offsetHeight*5,W),oe=window.getComputedStyle(y),J=parseInt(oe.paddingTop,10),Y=parseInt(oe.paddingBottom,10),Z=P.top+P.height/2-Ql,G=M-Z,se=b.offsetHeight/2,ce=b.offsetTop+se,le=F+H+ce,fe=W-le;if(le<=Z){const _e=L.length>0&&b===L[L.length-1].ref.current;l.style.bottom="0px";const pe=u.clientHeight-y.offsetTop-y.offsetHeight,Te=Math.max(G,se+(_e?Y:0)+pe+z),Ge=le+Te;l.style.height=Ge+"px"}else{const _e=L.length>0&&b===L[0].ref.current;l.style.top="0px";const Te=Math.max(Z,F+y.offsetTop+(_e?J:0)+se)+fe;l.style.height=Te+"px",y.scrollTop=le-Z+y.offsetTop}l.style.margin=`${Ql}px 0`,l.style.minHeight=q+"px",l.style.maxHeight=M+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,a.trigger,a.valueNode,l,u,y,b,w,a.dir,r]);Bs(()=>j(),[j]);const[E,S]=N.useState();Bs(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]);const T=N.useCallback(P=>{P&&x.current===!0&&(j(),_==null||_(),x.current=!1)},[j,_]);return s.jsx(FIe,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:T,children:s.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:s.jsx(ut.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});pse.displayName=MIe;var LIe="SelectPopperPosition",YT=N.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Ql,...a}=e,o=FC(n);return s.jsx(Hk,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});YT.displayName=LIe;var[FIe,CM]=I0(Jm,{}),XT="SelectViewport",gse=N.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,a=oh(XT,n),o=CM(XT,n),l=Qt(t,a.onViewportChange),c=N.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),s.jsx(MC.Slot,{scope:n,children:s.jsx(ut.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Je(i.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&f){const p=Math.abs(c.current-d.scrollTop);if(p>0){const x=window.innerHeight-Ql*2,y=parseFloat(f.style.minHeight),b=parseFloat(f.style.height),w=Math.max(y,b);if(w<x){const _=w+p,j=Math.min(x,_),E=_-j;f.style.height=j+"px",f.style.bottom==="0px"&&(d.scrollTop=E>0?E:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});gse.displayName=XT;var xse="SelectGroup",[$Ie,BIe]=I0(xse),zIe=N.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=di();return s.jsx($Ie,{scope:n,id:i,children:s.jsx(ut.div,{role:"group","aria-labelledby":i,...r,ref:t})})});zIe.displayName=xse;var yse="SelectLabel",vse=N.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=BIe(yse,n);return s.jsx(ut.div,{id:i.id,...r,ref:t})});vse.displayName=yse;var U2="SelectItem",[UIe,bse]=I0(U2),wse=N.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,l=ah(U2,n),c=oh(U2,n),u=l.value===r,[d,f]=N.useState(a??""),[h,p]=N.useState(!1),x=Qt(t,_=>{var j;return(j=c.itemRefCallback)==null?void 0:j.call(c,_,r,i)}),y=di(),b=N.useRef("touch"),w=()=>{i||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(UIe,{scope:n,value:r,disabled:i,textId:y,isSelected:u,onItemTextChange:N.useCallback(_=>{f(j=>j||((_==null?void 0:_.textContent)??"").trim())},[]),children:s.jsx(MC.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:s.jsx(ut.div,{role:"option","aria-labelledby":y,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:x,onFocus:Je(o.onFocus,()=>p(!0)),onBlur:Je(o.onBlur,()=>p(!1)),onClick:Je(o.onClick,()=>{b.current!=="mouse"&&w()}),onPointerUp:Je(o.onPointerUp,()=>{b.current==="mouse"&&w()}),onPointerDown:Je(o.onPointerDown,_=>{b.current=_.pointerType}),onPointerMove:Je(o.onPointerMove,_=>{var j;b.current=_.pointerType,i?(j=c.onItemLeave)==null||j.call(c):b.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Je(o.onPointerLeave,_=>{var j;_.currentTarget===document.activeElement&&((j=c.onItemLeave)==null||j.call(c))}),onKeyDown:Je(o.onKeyDown,_=>{var E;((E=c.searchRef)==null?void 0:E.current)!==""&&_.key===" "||(EIe.includes(_.key)&&w(),_.key===" "&&_.preventDefault())})})})})});wse.displayName=U2;var ov="SelectItemText",_se=N.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...a}=e,o=ah(ov,n),l=oh(ov,n),c=bse(ov,n),u=PIe(ov,n),[d,f]=N.useState(null),h=Qt(t,w=>f(w),c.onItemTextChange,w=>{var _;return(_=l.itemTextRefCallback)==null?void 0:_.call(l,w,c.value,c.disabled)}),p=d==null?void 0:d.textContent,x=N.useMemo(()=>s.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:y,onNativeOptionRemove:b}=u;return Bs(()=>(y(x),()=>b(x)),[y,b,x]),s.jsxs(s.Fragment,{children:[s.jsx(ut.span,{id:c.textId,...a,ref:h}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Yf.createPortal(a.children,o.valueNode):null]})});_se.displayName=ov;var jse="SelectItemIndicator",Nse=N.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return bse(jse,n).isSelected?s.jsx(ut.span,{"aria-hidden":!0,...r,ref:t}):null});Nse.displayName=jse;var QT="SelectScrollUpButton",kse=N.forwardRef((e,t)=>{const n=oh(QT,e.__scopeSelect),r=CM(QT,e.__scopeSelect),[i,a]=N.useState(!1),o=Qt(t,r.onScrollButtonChange);return Bs(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;a(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),i?s.jsx(Ese,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});kse.displayName=QT;var JT="SelectScrollDownButton",Cse=N.forwardRef((e,t)=>{const n=oh(JT,e.__scopeSelect),r=CM(JT,e.__scopeSelect),[i,a]=N.useState(!1),o=Qt(t,r.onScrollButtonChange);return Bs(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;a(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),i?s.jsx(Ese,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Cse.displayName=JT;var Ese=N.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,a=oh("SelectScrollButton",n),o=N.useRef(null),l=LC(n),c=N.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return N.useEffect(()=>()=>c(),[c]),Bs(()=>{var d;const u=l().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),s.jsx(ut.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Je(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Je(i.onPointerMove,()=>{var u;(u=a.onItemLeave)==null||u.call(a),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Je(i.onPointerLeave,()=>{c()})})}),qIe="SelectSeparator",Sse=N.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return s.jsx(ut.div,{"aria-hidden":!0,...r,ref:t})});Sse.displayName=qIe;var ZT="SelectArrow",VIe=N.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=FC(n),a=ah(ZT,n),o=oh(ZT,n);return a.open&&o.position==="popper"?s.jsx(Wk,{...i,...r,ref:t}):null});VIe.displayName=ZT;var HIe="SelectBubbleInput",Ase=N.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=N.useRef(null),a=Qt(r,i),o=RC(t);return N.useEffect(()=>{const l=i.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==t&&d){const f=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(f)}},[o,t]),s.jsx(ut.select,{...n,style:{...yY,...n.style},ref:a,defaultValue:t})});Ase.displayName=HIe;function Tse(e){return e===""||e===void 0}function Pse(e){const t=Ms(e),n=N.useRef(""),r=N.useRef(0),i=N.useCallback(o=>{const l=n.current+o;t(l),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),a=N.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return N.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Ose(e,t,n){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let o=WIe(e,Math.max(a,0));i.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.textValue.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function WIe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var GIe=ise,Dse=ose,KIe=cse,YIe=use,XIe=dse,Ise=fse,QIe=gse,Rse=vse,Mse=wse,JIe=_se,ZIe=Nse,Lse=kse,Fse=Cse,$se=Sse;const li=GIe,ci=KIe,Gs=N.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(Dse,{ref:r,className:ae("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
1186ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,s.jsx(YIe,{asChild:!0,children:s.jsx(Wa,{className:"h-4 w-4 opacity-50"})})]}));Gs.displayName=Dse.displayName;const Bse=N.forwardRef(({className:e,...t},n)=>s.jsx(Lse,{ref:n,className:ae("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(aI,{className:"h-4 w-4"})}));Bse.displayName=Lse.displayName;const zse=N.forwardRef(({className:e,...t},n)=>s.jsx(Fse,{ref:n,className:ae("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(Wa,{className:"h-4 w-4"})}));zse.displayName=Fse.displayName;const Ks=N.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>s.jsx(XIe,{children:s.jsxs(Ise,{ref:i,className:ae("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[s.jsx(Bse,{}),s.jsx(QIe,{className:ae("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(zse,{})]})}));Ks.displayName=Ise.displayName;const eRe=N.forwardRef(({className:e,...t},n)=>s.jsx(Rse,{ref:n,className:ae("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));eRe.displayName=Rse.displayName;const Yn=N.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(Mse,{ref:r,className:ae("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(ZIe,{children:s.jsx(is,{className:"h-4 w-4"})})}),s.jsx(JIe,{children:t})]}));Yn.displayName=Mse.displayName;const tRe=N.forwardRef(({className:e,...t},n)=>s.jsx($se,{ref:n,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));tRe.displayName=$se.displayName;const nRe=[{value:"ffe",label:"FFE (Fédération Française)",hint:"Aucune conversion"},{value:"fide",label:"FIDE (international)",hint:"Aucune conversion"},{value:"chesscom_rapid",label:"Chess.com Rapide",hint:"≈ FIDE − 200"},{value:"chesscom_blitz",label:"Chess.com Blitz",hint:"≈ FIDE − 100"},{value:"lichess_rapid",label:"Lichess Rapide",hint:"≈ FIDE − 150"},{value:"lichess_blitz",label:"Lichess Blitz",hint:"≈ FIDE − 100"},{value:"manual",label:"Estimation personnelle",hint:"Pas de conversion"}],B9=100,rRe=3e3;function eP(e){return Number.isNaN(e)?B9:Math.max(B9,Math.min(rRe,Math.round(e)))}function Use(e,t){const n=eP(t),r=e==="chesscom_rapid"?-200:e==="chesscom_blitz"?-100:e==="lichess_rapid"?-150:e==="lichess_blitz"?-100:0;if(r===0)return n;const i=2e3,a=2400;let o=r;if(n>i){const l=Math.min(1,(n-i)/(a-i));o=Math.round(r*(1-l))}return eP(n+o)}const qse=[{value:"green",label:"Découverte",emoji:"🟢",colorClass:"bg-emerald-500",bgClass:"bg-emerald-50",elo:600,headline:"Je connais les règles",description:"Je joue en famille ou entre amis, sans compétition régulière."},{value:"blue",label:"Loisir",emoji:"🔵",colorClass:"bg-sky-500",bgClass:"bg-sky-50",elo:900,headline:"Je joue régulièrement en ligne",description:"Chess.com / Lichess casual, j'aime améliorer mon jeu."},{value:"red",label:"Club",emoji:"🔴",colorClass:"bg-red-500",bgClass:"bg-red-50",elo:1300,headline:"J'ai déjà joué en club ou tournoi",description:"Je connais les ouvertures principales et je gère les finales de base."},{value:"black",label:"Confirmé",emoji:"⚫",colorClass:"bg-neutral-900",bgClass:"bg-neutral-100",elo:1650,headline:"Classé FFE/FIDE ou top 10% en ligne",description:"Joueur de club actif, expérience de tournois homologués."},{value:"expert",label:"Expert",emoji:"💎",colorClass:"bg-violet-600",bgClass:"bg-violet-50",elo:2e3,headline:"Titre national, MI/GM ou Elo FIDE > 2000",description:"Niveau expert, joueur régulier de tournois compétitifs."}],z9=3;function sRe(){const e=Rr(),[t]=wc(),{user:n,profile:r,refreshProfile:i}=Tt(),{toast:a}=_r(),[o,l]=N.useState("choice"),[c,u]=N.useState(!1),[d,f]=N.useState("fide"),[h,p]=N.useState(""),[x,y]=N.useState(null),b=t.get("next")||"/player";N.useEffect(()=>{r&&r.onboarding_elo_completed_at&&e(b,{replace:!0})},[r,e,b]);const w=N.useMemo(()=>o==="choice"?1:o==="test"?3:2,[o]),_=async()=>{n&&(await re.from("profiles").update({onboarding_elo_completed_at:new Date().toISOString()}).eq("id",n.id),await i())},j=async()=>{u(!0);try{await _(),a({title:"Pas de souci",description:"Tu pourras renseigner ton niveau depuis ton profil."}),e(b,{replace:!0})}finally{u(!1)}},E=async(P,O,D)=>{if(!n)throw new Error("no_user");const{data:R}=await re.from("player_stats").select("elo_rating").eq("user_id",n.id).maybeSingle(),L=(R==null?void 0:R.elo_rating)??null,{error:M}=await re.from("player_stats").update({elo_rating:P,elo_source:O,updated_at:new Date().toISOString()}).eq("user_id",n.id);if(M)throw M;await re.from("elo_history").insert({user_id:n.id,old_elo:L,new_elo:P,change_reason:"manual_entry"}),await re.from("profiles").update({elo_rating:P,elo_self_declared_level:D??null,onboarding_elo_completed_at:new Date().toISOString()}).eq("id",n.id),await i()},S=async()=>{const P=parseInt(h,10);if(Number.isNaN(P)||P<100||P>
11863e3){a({title:"Elo invalide",description:"Entre une valeur entre 100 et 3000.",variant:"destructive"});return}u(!0);try{const O=Use(d,P);await E(O,d,null),a({title:"Niveau enregistré",description:`Elo interne : ${O}. Il s'ajustera après tes premiers tournois.`}),e(b,{replace:!0})}catch(O){const D=O instanceof Error?O.message:"Erreur inconnue";a({title:"Impossible d'enregistrer",description:D,variant:"destructive"})}finally{u(!1)}},T=async()=>{if(!x)return;const P=qse.find(O=>O.value===x);if(P){u(!0);try{await E(eP(P.elo),"self_declared",x),a({title:"Niveau enregistré",description:`Palier ${P.label} · Elo de départ ${P.elo}. Tu progresseras à chaque tournoi.`}),e(b,{replace:!0})}catch(O){const D=O instanceof Error?O.message:"Erreur inconnue";a({title:"Impossible d'enregistrer",description:D,variant:"destructive"})}finally{u(!1)}}};return s.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[s.jsxs("header",{className:"sticky top-0 z-10 backdrop-blur bg-background/80 border-b border-border/50",children:[s.jsxs("div",{className:"max-w-2xl mx-auto flex items-center justify-between px-4 py-3",children:[s.jsx(vc,{size:"sm"}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("span",{className:"text-xs font-mono text-muted-foreground tabular-nums",children:[w," / ",z9]}),s.jsx(Q,{variant:"ghost",size:"sm",onClick:j,disabled:c,className:"text-muted-foreground hover:text-foreground",children:"Plus tard"})]})]}),s.jsx("div",{className:"h-1 bg-muted",children:s.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${w/z9*100}%`}})})]}),s.jsx("main",{className:"flex-1 px-4 py-8 md:py-14",children:s.jsxs("div",{className:"max-w-2xl mx-auto",children:[o==="choice"&&s.jsx(iRe,{onKnown:()=>l("known"),onLevel:()=>l("level"),onSkip:j,saving:c}),o==="known"&&s.jsx(aRe,{source:d,rating:h,onSourceChange:f,onRatingChange:p,onBack:()=>l("choice"),onSave:S,onTest:()=>l("test"),saving:c}),o==="level"&&s.jsx(oRe,{selected:x,onSelect:y,onBack:()=>l("choice"),onSave:T,saving:c}),o==="test"&&s.jsx(cRe,{onBack:()=>l("known"),onDone:()=>l("known")})]})})]})}function iRe({onKnown:e,onLevel:t,onSkip:n,saving:r}){return s.jsxs("div",{className:"space-y-6 animate-fade-in",children:[s.jsxs("div",{className:"text-center space-y-3",children:[s.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-border/60 bg-card px-3 py-1 text-xs font-mono uppercase tracking-wider text-muted-foreground",children:[s.jsx(Ti,{className:"w-3.5 h-3.5"})," 30 secondes"]}),s.jsx("h1",{className:"font-display italic text-3xl md:text-5xl leading-tight text-foreground",children:"À quel niveau joues-tu ?"}),s.jsx("p",{className:"text-muted-foreground max-w-md mx-auto text-sm md:text-base",children:"Ton niveau nous aide à te placer face à des adversaires de ton calibre — pour un premier tournoi vraiment sympa. Tu peux passer et le faire plus tard."})]}),s.jsxs("div",{className:"grid gap-3 mt-8",children:[s.jsx(r4,{title:"Je connais mon Elo",subtitle:"FFE, FIDE, Chess.com ou Lichess",onClick:e,disabled:r}),s.jsx(r4,{title:"Je ne sais pas trop",subtitle:"Choisis un niveau visuel façon pistes de ski",onClick:t,disabled:r}),s.jsx(r4,{title:"Plus tard",subtitle:"Je préfère y revenir depuis mon profil",onClick:n,disabled:r,muted:!0})]})]})}function r4({title:e,subtitle:t,onClick:n,disabled:r,muted:i}){return s.jsx("button",{type:"button",onClick:n,disabled:r,className:ae("group w-full text-left rounded-2xl border p-5 transition-all","hover:border-primary hover:shadow-md active:scale-[0.99]",i?"border-border/50 bg-muted/30 hover:bg-muted/50":"border-border bg-card",r&&"opacity-50 pointer-events-none"),children:s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-display text-lg font-bold text-foreground",children:e}),s.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:t})]}),s.jsx(la,{className:"w-5 h-5 text-muted-foreground group-hover:text-primary group-hover:translate-x-0.5 transition"})]})})}function aRe({source:e,rating:t,onSourceChange:n,onRatingChange:r,onBack:i,onSave:a,onTest:o,saving:l}){const c=parseInt(t,10),u=Number.isNaN(c)?null:Use(e,c);return s.jsxs("div",{className:"space-y-6 animate-fade-in",children:[s.jsxs("button",{type:"button",onClick:i,className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground",children:[s.jsx(Fn,{className:"w-4 h-4"})," Retour"]}
1186),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h2",{className:"font-display italic text-2xl md:text-4xl text-foreground",children:"Ton classement Elo"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Choisis ta source et saisis ton score actuel. On convertit automatiquement vers notre échelle interne (base FIDE)."})]}),s.jsx(Se,{children:s.jsxs(De,{className:"pt-6 space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"elo-source",children:"Source du classement"}),s.jsxs(li,{value:e,onValueChange:d=>n(d),children:[s.jsx(Gs,{id:"elo-source",children:s.jsx(ci,{})}),s.jsx(Ks,{children:nRe.map(d=>s.jsx(Yn,{value:d.value,children:s.jsxs("span",{className:"flex items-center justify-between gap-3 w-full",children:[s.jsx("span",{children:d.label}),d.hint&&s.jsx("span",{className:"text-xs text-muted-foreground",children:d.hint})]})},d.value))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"elo-value",children:"Score"}),s.jsx(Ue,{id:"elo-value",type:"number",inputMode:"numeric",min:100,max:3e3,placeholder:"ex. 1450",value:t,onChange:d=>r(d.target.value)})]}),u!==null&&s.jsxs("div",{className:"rounded-lg bg-muted/60 px-4 py-3 flex items-center justify-between",children:[s.jsx("span",{className:"text-xs uppercase tracking-wider text-muted-foreground font-mono",children:"Elo interne estimé"}),s.jsx("span",{className:"font-display text-xl font-bold tabular-nums",children:u})]})]})}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[s.jsx(Q,{type:"button",onClick:a,disabled:l||!t,className:"flex-1",children:l?s.jsx(We,{className:"w-4 h-4 animate-spin"}):"Enregistrer mon niveau"}),s.jsx(Q,{type:"button",variant:"outline",onClick:o,disabled:l,children:"Je ne connais pas encore mon Elo"})]}),s.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Ton Elo évoluera automatiquement à chaque tournoi."})]})}function oRe({selected:e,onSelect:t,onBack:n,onSave:r,saving:i}){return s.jsxs("div",{className:"space-y-6 animate-fade-in",children:[s.jsxs("button",{type:"button",onClick:n,className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground",children:[s.jsx(Fn,{className:"w-4 h-4"})," Retour"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h2",{className:"font-display italic text-2xl md:text-4xl text-foreground",children:"Quel palier te ressemble ?"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Comme les pistes de ski. Ton Elo sera ajusté après chaque tournoi — inutile de sur-évaluer."})]}),s.jsx("div",{className:"space-y-2",children:qse.map(a=>s.jsx(lRe,{preset:a,selected:e===a.value,onSelect:()=>t(a.value)},a.value))}),s.jsx(Q,{type:"button",onClick:r,disabled:i||!e,className:"w-full",children:i?s.jsx(We,{className:"w-4 h-4 animate-spin"}):"Valider mon niveau"})]})}function lRe({preset:e,selected:t,onSelect:n}){return s.jsxs("button",{type:"button",onClick:n,"aria-pressed":t,className:ae("w-full text-left flex items-start gap-4 roun
1186ded-2xl border p-4 transition-all","hover:border-primary hover:shadow-sm active:scale-[0.99]",t?"border-primary ring-2 ring-primary/30 bg-primary/5":"border-border bg-card"),children:[s.jsx("span",{className:ae("w-12 h-12 shrink-0 rounded-full flex items-center justify-center text-white text-xl font-bold shadow-inner",e.colorClass),"aria-hidden":!0,children:e.emoji}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("p",{className:"font-display text-lg font-bold text-foreground",children:e.label}),s.jsxs("span",{className:"text-xs font-mono px-2 py-0.5 rounded-full bg-muted text-muted-foreground tabular-nums",children:["~",e.elo]})]}),s.jsx("p",{className:"text-sm text-foreground/90 mt-0.5",children:e.headline}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.description})]})]})}function cRe({onBack:e,onDone:t}){const n=[{title:"Chess.com — Rapide (10 min)",description:"10 parties suffisent pour un rating fiable. Compte gratuit requis.",url:"https://www.chess.com/play/online",badge:"Recommandé"},{title:"Lichess — Rapide (10 min)",description:"100 % gratuit, sans pub, sans compte requis pour tester.",url:"https://lichess.org/"},{title:"Lichess — Puzzles",description:"Rating tactique rapide, bon proxy pour estimer ton niveau.",url:"https://lichess.org/training"}];return s.jsxs("div",{className:"space-y-6 animate-fade-in",children:[s.jsxs("button",{type:"button",onClick:e,className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground",children:[s.jsx(Fn,{className:"w-4 h-4"})," Retour"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h2",{className:"font-display italic text-2xl md:text-4xl text-foreground",children:"Teste ton niveau"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Quelques parties en ligne suffisent. Reviens ensuite pour saisir ton score."})]}),s.jsx("div",{className:"space-y-3",children:n.map(r=>s.jsx("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:"group block rounded-2xl border border-border bg-card p-4 hover:border-primary hover:shadow-sm transition-all",children:s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("p",{className:"font-display text-base font-bold text-foreground",children:r.title}),r.badge&&s.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider bg-primary/10 text-primary px-1.5 py-0.5 rounded",children:r.badge})]}),s.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:r.description})]}),s.jsx(pd,{className:"w-4 h-4 text-muted-foreground group-hover:text-primary shrink-0 mt-1"})]})},r.url))}),s.jsxs(Q,{type:"button",onClick:t,className:"w-full",variant:"outline",children:[s.jsx(Xt,{className:"w-4 h-4 mr-2"})," J'ai testé — je saisis mon score",s.jsx(Sr,{className:"w-4 h-4 ml-2"})]})]})}function uRe(e){return st({queryKey:["venue-events",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await re.from("events").select("*").eq("venue_id",e).order("event_date",{ascending:!0});if(n)throw n;return t},enabled:!!e})}function Vse(e,t=5){return st({queryKey:["venue-events-upcoming",e,t],queryFn:async()=>{if(!e)return[];const{data:n,error:r}=await re.from("events").select("*").eq("venue_id",e).gte("event_date",new Date().toISOString()).in("status",["draft","published","ongoing"]).order("event_date",{ascending:!0}).limit(t);if(r)throw r;return n},enabled:!!e})}function dRe(e,t=10){return st({queryKey:["venue-events-past",e,t],queryFn:async()=>{if(!e)return[];const{data:n,error:r}=await re.from("events").select("*").eq("venue_id",e).eq("status","completed").order("event_date",{ascending:!1}).limit(t);if(r)throw r;return n},enabled:!!e})}function fRe(e){return st({queryKey:["venue-event-stats",e],queryFn:async()=>{if(!e)return{total:0,completed:0,thisMonth:0,totalParticipants:0};const{data:t,error:n}=await re.from("events").select("id, status, event_date").eq("venue_id",e);if(n)throw n;const r=new Date,i=new Date(r.getFullYear(),r.getMonth(),1),a=(t==null?void 0:t.filter(u=>u.status==="completed").length)||0,o=(t==null?void 0:t.filter(u=>new Date(u.event_date)>=i).length)||0,l=(t==null?void 0:t.map(u=>u.id))||[];let c=0;if(l.length>0){const{count:u,error:d}=await re.from("tickets").select("*",{count:"exact",head:!0}).in("event_id",l).eq("status","checked_in");d||(c=u||0)}return{total:a,completed:a,thisMonth:o,totalParticipants:c}},enabled:!!e})}var ew=e=>e.type==="checkbox",om=e=>e instanceof Date,Ia=e=>e==null;const Hse=e=>typeof e=="object";var Js=e=>!Ia(e)&&!Array.isArray(e)&&Hse(e)&&!om(e),Wse=e=>Js(e)&&e.target?ew(e.target)?e.target.checked:e.target.value:e,hRe=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Gse=(e,t)=>e.has(hRe(t)),mRe=e=>{const t=e.constructor&&e.constructor.prototype;return Js(t)&&t.hasOwnProperty("isPrototypeOf")},EM=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function wi(e){let t;const n=Array.isArray(e),r=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(EM&&(e instanceof Blob||r))&&(n||Js(e)))if(t=n?[]:{},!n&&!mRe(e))t=e;else for(const i in e)e.hasOwnProperty(i)&&(t[i]=wi(e[i]));else return e;return t}var $C=e=>/^\w*$/.test(e),Hs=e=>e===void 0,SM=e=>Array.isArray(e)?e.filter(Boolean):[],AM=e=>SM(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ft=(e,t,n)=>{if(!t||!Js(e))return n;const r=($C(t)?[t]:AM(t)).reduce((i,a)=>Ia(i)?i:i[a],e);return Hs(r)||r===e?Hs(e[t])?n:e[t]:r},Ro=e=>
1186typeof e=="boolean",jr=(e,t,n)=>{let r=-1;const i=$C(t)?[t]:AM(t),a=i.length,o=a-1;for(;++r<a;){const l=i[r];let c=n;if(r!==o){const u=e[l];c=Js(u)||Array.isArray(u)?u:isNaN(+i[r+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=c,e=e[l]}};const q2={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},oc={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},bu={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},TM=ee.createContext(null);TM.displayName="HookFormContext";const BC=()=>ee.useContext(TM),pRe=e=>{const{children:t,...n}=e;return ee.createElement(TM.Provider,{value:n},t)};var Kse=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(i,a,{get:()=>{const o=a;return t._proxyFormState[o]!==oc.all&&(t._proxyFormState[o]=!r||oc.all),n&&(n[o]=!0),e[o]}});return i};const PM=typeof window<"u"?ee.useLayoutEffect:ee.useEffect;function gRe(e){const t=BC(),{control:n=t.control,disabled:r,name:i,exact:a}=e||{},[o,l]=ee.useState(n._formState),c=ee.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return PM(()=>n._subscribe({name:i,formState:c.current,exact:a,callback:u=>{!r&&l({...n._formState,...u})}}),[i,r,a]),ee.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),ee.useMemo(()=>Kse(o,n,c.current,!1),[o,n])}var Yc=e=>typeof e=="string",Yse=(e,t,n,r,i)=>Yc(e)?(r&&t.watch.add(e),ft(n,e,i)):Array.isArray(e)?e.map(a=>(r&&t.watch.add(a),ft(n,a))):(r&&(t.watchAll=!0),n),tP=e=>Ia(e)||!Hse(e);function Du(e,t,n=new WeakSet){if(tP(e)||tP(t))return e===t;if(om(e)&&om(t))return e.getTime()===t.getTime();const r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const a of r){const o=e[a];if(!i.includes(a))return!1;if(a!=="ref"){const l=t[a];if(om(o)&&om(l)||Js(o)&&Js(l)||Array.isArray(o)&&Array.isArray(l)?!Du(o,l,n):o!==l)return!1}}return!0}function xRe(e){const t=BC(),{control:n=t.control,name:r,defaultValue:i,disabled:a,exact:o,compute:l}=e||{},c=ee.useRef(i),u=ee.useRef(l),d=ee.useRef(void 0);u.current=l;const f=ee.useMemo(()=>n._getWatch(r,c.current),[n,r]),[h,p]=ee.useState(u.current?u.current(f):f);return PM(()=>n._subscribe({name:r,formState:{values:!0},exact:o,callback:x=>{if(!a){const y=Yse(r,n._names,x.values||n._formValues,!1,c.current);if(u.current){const b=u.current(y);Du(b,d.current)||(p(b),d.current=b)}else p(y)}}}),[n,a,r,o]),ee.useEffect(()=>n._removeUnmounted()),h}function yRe(e){const t=BC(),{name:n,disabled:r,control:i=t.control,shouldUnregister:a,defaultValue:o}=e,l=Gse(i._names.array,n),c=ee.useMemo(()=>
vendor: 12,388 bytes, line 1186
1186ft(i._formValues,n,ft(i._defaultValues,n,o)),[i,n,o]),u=xRe({control:i,name:n,defaultValue:c,exact:!0}),d=gRe({control:i,name:n,exact:!0}),f=ee.useRef(e),h=ee.useRef(i.register(n,{...e.rules,value:u,...Ro(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const p=ee.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ft(d.errors,n)},isDirty:{enumerable:!0,get:()=>!!ft(d.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!ft(d.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!ft(d.validatingFields,n)},error:{enumerable:!0,get:()=>ft(d.errors,n)}}),[d,n]),x=ee.useCallback(_=>h.current.onChange({target:{value:Wse(_),name:n},type:q2.CHANGE}),[n]),y=ee.useCallback(()=>h.current.onBlur({target:{value:ft(i._formValues,n),name:n},type:q2.BLUR}),[n,i._formValues]),b=ee.useCallback(_=>{const j=ft(i._fields,n);j&&_&&(j._f.ref={focus:()=>_.focus&&_.focus(),select:()=>_.select&&_.select(),setCustomValidity:E=>_.setCustomValidity(E),reportValidity:()=>_.reportValidity()})},[i._fields,n]),w=ee.useMemo(()=>({name:n,value:u,...Ro(r)||d.disabled?{disabled:d.disabled||r}:{},onChange:x,onBlur:y,ref:b}),[n,r,d.disabled,x,y,b,u]);return ee.useEffect(()=>{const _=i._options.shouldUnregister||a;i.register(n,{...f.current.rules,...Ro(f.current.disabled)?{disabled:f.current.disabled}:{}});const j=(E,S)=>{const T=ft(i._fields,E);T&&T._f&&(T._f.mount=S)};if(j(n,!0),_){const E=wi(ft(i._options.defaultValues,n));jr(i._defaultValues,n,E),Hs(ft(i._formValues,n))&&jr(i._formValues,n,E)}return!l&&i.register(n),()=>{(l?_&&!i._state.action:_)?i.unregister(n):j(n,!1)}},[n,i,l,a]),ee.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),ee.useMemo(()=>({field:w,formState:d,fieldState:p}),[w,d,p])}const vRe=e=>e.render(yRe(e));var Xse=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},Sv=e=>Array.isArray(e)?e:[e],U9=()=>{let e=[];return{get observers(){return e},next:i=>{for(const a of e)a.next&&a.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(a=>a!==i)}}),unsubscribe:()=>{e=[]}}},io=e=>Js(e)&&!Object.keys(e).length,OM=e=>e.type==="file",lc=e=>typeof e=="function",V2=e=>{if(!EM)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Qse=e=>e.type==="select-multiple",DM=e=>e.type==="radio",bRe=e=>DM(e)||ew(e),s4=e=>V2(e)&&e.isConnected;function wRe(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=Hs(e)?r++:e[t[r++]];return e}function _Re(e){for(const t in e)if(e.hasOwnProperty(t)&&!Hs(e[t]))return!1;return!0}function Zs(e,t){const n=Array.isArray(t)?t:$C(t)?[t]:AM(t),r=n.length===1?e:wRe(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(Js(r)&&io(r)||Array.isArray(r)&&_Re(r))&&Zs(e,n.slice(0,-1)),e}var Jse=e=>{for(const t in e)if(lc(e[t]))return!0;return!1};function H2(e,t={}){const n=Array.isArray(e);if(Js(e)||n)for(const r in e)Array.isArray(e[r])||Js(e[r])&&!Jse(e[r])?(t[r]=Array.isArray(e[r])?[]:{},H2(e[r],t[r])):Ia(e[r])||(t[r]=!0);return t}function Zse(e,t,n){const r=Array.isArray(e);if(Js(e)||r)for(const i in e)Array.isArray(e[i])||Js(e[i])&&!Jse(e[i])?Hs(t)||tP(n[i])?n[i]=Array.isArray(e[i])?H2(e[i],[]):{...H2(e[i])}:Zse(e[i],Ia(t)?{}:t[i],n[i]):n[i]=!Du(e[i],t[i]);return n}var Ey=(e,t)=>Zse(e,t,H2(t));const q9={value:!1,isValid:!1},V9={value:!0,isValid:!0};var eie=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Hs(e[0].attributes.value)?Hs(e[0].value)||e[0].value===""?V9:{value:e[0].value,isValid:!0}:V9:q9}return q9},tie=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Hs(e)?e:t?e===""?NaN:e&&+e:n&&Yc(e)?new Date(e):r?r(e):e;const H9={isValid:!1,value:null};var nie=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,H9):H9;function W9(e){const t=e.ref;return OM(t)?t.files:DM(t)?nie(e.refs).value:Qse(t)?[...t.selectedOptions].map(({value:n})=>n):ew(t)?eie(e.refs).value:tie(Hs(t.value)?e.ref.value:t.value,e)}var jRe=(e,t,n,r)=>{const i={};for(const a of e){const o=ft(t,a);o&&jr(i,a,o._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},W2=e=>e instanceof RegExp,Sy=e=>Hs(e)?e:W2(e)?e.source:Js(e)?W2(e.value)?e.value.source:e.value:e,G9=e=>({isOnSubmit:!e||e===oc.onSubmit,isOnBlur:e===oc.onBlur,isOnChange:e===oc.onChange,isOnAll:e===oc.all,isOnTouch:e===oc.onTouched});const K9="AsyncFunction";var NRe=e=>!!e&&!!e.validate&&!!(lc(e.validate)&&e.validate.constructor.name===K9||Js(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===K9)),kRe=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Y9=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Av=(e,t,n,r)=>{for(const i of n||Object.keys(e)){const a=ft(e,i);if(a){const{_f:o,...l}=a;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],i)&&!r)return!0;if(o.ref&&t(o.ref,o.name)&&!r)return!0;if(Av(l,t))break}else if(Js(l)&&Av(l,t))break}}};function X9(e,t,n){const r=ft(e,n);if(r||$C(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const a=i.join("."),o=ft(t,a),l=ft(e,a);if(o&&!Array.isArray(o)&&n!==a)return{name:n};if(l&&l.type)return{name:a,error:l};if(l&&l.root&&l.root.type)return{name:`${a}.root`,error:l.root};i.pop()}return{name:n}}var CRe=(e,t,n,r)=>{n(e);const{name:i,...a}=e;return io(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(o=>t[o]===(!r||oc.all))},ERe=(e,t,n)=>!e||!t||e===t||Sv(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),SRe=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,ARe=(e,t)=>!SM(ft(e,t)).length&&Zs(e,t),TRe=(e,t,n)=>{const r=Sv(ft(e,n));return jr(r,"root",t[n]),jr(e,n,r),e},kj=e=>Yc(e);function Q9(e,t,n="validate"){if(kj(e)||Array.isArray(e)&&e.every(kj)||Ro(e)&&!e)return{type:n,message:kj(e)?e:"",ref:t}}var Wp=e=>Js(e)&&!W2(e)?e:{value:e,message:""},J9=async(e,t,n,r,i,a)=>{const{ref:o,refs:l,required:c,maxLength:u,minLength:d,min:f,max:h,pattern:p,validate:x,name:y,valueAsNumber:b,mount:w}=e._f,_=ft(n,y);if(!w||t.has(y))return{};const j=l?l[0]:o,E=M=>{i&&j.reportValidity&&(j.setCustomValidity(Ro(M)?"":M||""),j.reportValidity())},S={},T=DM(o),P=ew(o),O=T||P,D=(b||OM(o))&&Hs(o.value)&&Hs(_)||V2(o)&&o.value===""||_===""||Array.isArray(_)&&!_.length,R=Xse.bind(null,y,r,S),L=(M,B,U,F=bu.maxLength,H=bu.minLength)=>{const z=M?B:U;S[y]={type:M?F:H,message:z,ref:o,...R(M?F:H,z)}};if(a?!Array.isArray(_)||!_.length:c&&(!O&&(D||Ia(_))||Ro(_)&&!_||P&&!eie(l).isValid||T&&!nie(l).isValid)){const{value:M,message:B}=kj(c)?{value:!!c,message:c}:Wp(c);if(M&&(S[y]={type:bu.required,message:B,ref:j,...R(bu.required,B)},!r))return E(B),S}if(!D&&(!Ia(f)||!Ia(h))){let M,B;const U=Wp(h),F=Wp(f);if(!Ia(_)&&!isNaN(_)){const H=o.valueAsNumber||_&&+_;Ia(U.value)||(M=H>U.value),Ia(F.value)||(B=H<F.value)}else{const H=o.valueAsDate||new Date(_),z=q=>new Date(new Date().toDateString()+" "+q),K=o.type=="time",W=o.type=="week";Yc(U.value)&&_&&(M=K?z(_)>z(U.value):W?_>U.value:H>new Date(U.value)),Yc(F.value)&&_&&(B=K?z(_)<z(F.value):W?_<F.value:H<new Date(F.value))}if((M||B)&&(L(!!M,U.message,F.message,bu.max,bu.min),!r))return E(S[y].message),S}if((u||d)&&!D&&(Yc(_)||a&&Array.isArray(_))){const M=Wp(u),B=Wp(d),U=!Ia(M.value)&&_.length>+M.value,F=!Ia(B.value)&&_.length<+B.value;if((U||F)&&(L(U,M.message,B.message),!r))return E(S[y].message),S}if(p&&!D&&Yc(_)){const{value:M,message:B}=Wp(p);if(W2(M)&&!_.match(M)&&(S[y]={type:bu.pattern,message:B,ref:o,...R(bu.pattern,B)},!r))return E(B),S}if(x){if(lc(x)){const M=await x(_,n),B=Q9(M,j);if(B&&(S[y]={...B,...R(bu.validate,B.message)},!r))return E(B.message),S}else if(Js(x)){let M={};for(const B in x){if(!io(M)&&!r)break;const U=Q9(await x[B](_,n),j,B);U&&(M={...U,...R(B,U.message)},E(U.message),r&&(S[y]=M))}if(!io(M)&&(S[y]={ref:j,...M},!r))return S}}return E(!0),S};const PRe={mode:oc.onSubmit,reValidateMode:oc.onChange,shouldFocusError:!0};function ORe(e={}){let t={...PRe,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:lc(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=Js(t.defaultValues)||Js(t.values)?wi(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:wi(i),o={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...d};const h={array:U9(),state:U9()},p=t.criteriaMode===oc.all,x=de=>me=>{clearTimeout(u),u=setTimeout(de,me)},y=async de=>{if(!t.disabled&&(d.isValid||f.isValid||de)){const me=t.resolver?io((await P()).errors):await D(r,!0);me!==n.isValid&&h.state.next({isValid:me})}},b=(de,me)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((de||Array.from(l.mount)).forEach(ke=>{ke&&(me?jr(n.validatingFields,ke,me):Zs(n.validatingFields,ke))}),h.state.next({validatingFields:n.validatingFields,isValidating:!io(n.validatingFields)}))},w=(de,me=[],ke,Be,Ae=!0,$e=!0)=>{if(Be&&ke&&!t.disabled){if(o.action=!0,$e&&Array.isArray(ft(r,de))){const ge=ke(ft(r,de),Be.argA,Be.argB);Ae&&jr(r,de,ge)}if($e&&Array.isArray(ft(n.errors,de))){const ge=ke(ft(n.errors,de),Be.argA,Be.argB);Ae&&jr(n.errors,de,ge),ARe(n.errors,de)}if((d.touchedFields||f.touchedFields)&&$e&&Array.isArray(ft(n.touchedFields,de))){const ge=ke(ft(n.touchedFields,de),Be.argA,Be.argB);Ae&&jr(n.touchedFields,de,ge)}(d.dirtyFields||f.dirtyFields)&&(n.dirtyFields=Ey(i,a)),h.state.next({name:de,isDirty:L(de,me),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else jr(a,de,me)},_=(de,me)=>{jr(n.errors,de,me),h.state.next({errors:n.errors})},j=de=>{n.errors=de,h.state.next({errors:n.errors,isValid:!1})},E=(de,me,ke,Be)=>{const Ae=ft(r,de);if(Ae){const $e=ft(a,de,Hs(ke)?ft(i,de):ke);Hs($e)||Be&&Be.defaultChecked||me?jr(a,de,me?$e:W9(Ae._f)):U(de,$e),o.mount&&y()}},S=(de,me,ke,Be,Ae)=>{let $e=!1,ge=!1;const Le={name:de};if(!t.disabled){if(!ke||Be){(d.isDirty||f.isDirty)&&(ge=n.isDirty,n.isDirty=Le.isDirty=L(),$e=ge!==Le.isDirty);const Ve=Du(ft(i,de),me);ge=!!ft(n.dirtyFields,de),Ve?Zs(n.dirtyFields,de):jr(n.dirtyFields,de,!0),Le.dirtyFields=n.dirtyFields,$e=$e||(d.dirtyFields||f.dirtyFields)&&ge!==!Ve}if(ke){const Ve=ft(n.touchedFields,de);Ve||(jr(n.touchedFields,de,ke),Le.touchedFields=n.touchedFields,$e=$e||(d.touchedFields||f.touchedFields)&&Ve!==ke)}$e&&Ae&&h.state.next(Le)}return $e?Le:{}},T=(de,me,ke,Be)=>{const Ae=ft(n.errors,de),$e=(d.isValid||f.isValid)&&Ro(me)&&n.isValid!==me;if(t.delayError&&ke?(c=x(()=>_(de,ke)),c(t.delayError)):(clearTimeout(u),c=null,ke?jr(n.errors,de,ke):Zs(n.errors,de)),(ke?!Du(Ae,ke):Ae)||!io(Be)||$e){const ge={...Be,...$e&&Ro(me)?{isValid:me}:{},errors:n.errors,name:de};n={...n,...ge},h.state.next(ge)}},P=async de=>{b(de,!0);const me=await t.resolver(a,t.context,jRe(de||l.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return b(de),me},O=async de=>{const{errors:me}=await P(de);if(de)for(const ke of de){const Be=ft(me,ke);Be?jr(n.errors,ke,Be):Zs(n.errors,ke)}else n.errors=me;return me},D=async(de,me,ke={valid:!0})=>{for(const Be in de){const Ae=de[Be];if(Ae){const{_f:$e,...ge}=Ae;if($e){const Le=l.array.has($e.name),Ve=Ae._f&&NRe(Ae._f);Ve&&d.validatingFields&&b([Be],!0);const ct=await J9(Ae,l.disabled,a,p,t.shouldUseNativeValidation&&!me,Le);if(Ve&&d.validatingFields&&b([Be]),ct[$e.name]&&(ke.valid=!1,me))break;!me&&(ft(ct,$e.name)?Le?TRe(n.errors,ct,$e.name):jr(n.errors,$e.name,ct[$e.name]):Zs(n.errors,$e.name))}!io(ge)&&await D(ge,me,ke)}}return ke.valid},R=()=>{for(const de of l.unMount){const me=ft(r,de);me&&(me._f.refs?me._f.refs.every(ke=>!s4(ke)):!s4(me._f.ref))&&ce(de)}l.unMount=new Set},L=(de,me)=>!t.disabled&&(de&&me&&jr(a,de,me),!Du(q(),i)),M=(de,me,ke)=>Yse(de,l,{...o.mount?a:Hs(me)?i:Yc(de)?{[de]:me}:me},ke,me),B=de=>SM(ft(o.mount?a:i,de,t.shouldUnregister?ft(i,de,[]):[])),U=(de,me,ke={})=>{const Be=ft(r,de);let Ae=me;if(Be){const $e=Be._f;$e&&(!$e.disabled&&jr(a,de,tie(me,$e)),Ae=V2($e.ref)&&Ia(me)?"":me,Qse($e.ref)?[...$e.ref.options].forEac
vendor: 9,565 bytes, line 1186
1186h(ge=>ge.selected=Ae.includes(ge.value)):$e.refs?ew($e.ref)?$e.refs.forEach(ge=>{(!ge.defaultChecked||!ge.disabled)&&(Array.isArray(Ae)?ge.checked=!!Ae.find(Le=>Le===ge.value):ge.checked=Ae===ge.value||!!Ae)}):$e.refs.forEach(ge=>ge.checked=ge.value===Ae):OM($e.ref)?$e.ref.value="":($e.ref.value=Ae,$e.ref.type||h.state.next({name:de,values:wi(a)})))}(ke.shouldDirty||ke.shouldTouch)&&S(de,Ae,ke.shouldTouch,ke.shouldDirty,!0),ke.shouldValidate&&W(de)},F=(de,me,ke)=>{for(const Be in me){if(!me.hasOwnProperty(Be))return;const Ae=me[Be],$e=de+"."+Be,ge=ft(r,$e);(l.array.has(de)||Js(Ae)||ge&&!ge._f)&&!om(Ae)?F($e,Ae,ke):U($e,Ae,ke)}},H=(de,me,ke={})=>{const Be=ft(r,de),Ae=l.array.has(de),$e=wi(me);jr(a,de,$e),Ae?(h.array.next({name:de,values:wi(a)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&ke.shouldDirty&&h.state.next({name:de,dirtyFields:Ey(i,a),isDirty:L(de,$e)})):Be&&!Be._f&&!Ia($e)?F(de,$e,ke):U(de,$e,ke),Y9(de,l)&&h.state.next({...n,name:de}),h.state.next({name:o.mount?de:void 0,values:wi(a)})},z=async de=>{o.mount=!0;const me=de.target;let ke=me.name,Be=!0;const Ae=ft(r,ke),$e=Ve=>{Be=Number.isNaN(Ve)||om(Ve)&&isNaN(Ve.getTime())||Du(Ve,ft(a,ke,Ve))},ge=G9(t.mode),Le=G9(t.reValidateMode);if(Ae){let Ve,ct;const yt=me.type?W9(Ae._f):Wse(de),nn=de.type===q2.BLUR||de.type===q2.FOCUS_OUT,Vn=!kRe(Ae._f)&&!t.resolver&&!ft(n.errors,ke)&&!Ae._f.deps||SRe(nn,ft(n.touchedFields,ke),n.isSubmitted,Le,ge),zt=Y9(ke,l,nn);jr(a,ke,yt),nn?(Ae._f.onBlur&&Ae._f.onBlur(de),c&&c(0)):Ae._f.onChange&&Ae._f.onChange(de);const He=S(ke,yt,nn),bn=!io(He)||zt;if(!nn&&h.state.next({name:ke,type:de.type,values:wi(a)}),Vn)return(d.isValid||f.isValid)&&(t.mode==="onBlur"?nn&&y():nn||y()),bn&&h.state.next({name:ke,...zt?{}:He});if(!nn&&zt&&h.state.next({...n}),t.resolver){const{errors:Rt}=await P([ke]);if($e(yt),Be){const An=X9(n.errors,r,ke),gt=X9(Rt,r,An.name||ke);Ve=gt.error,ke=gt.name,ct=io(Rt)}}else b([ke],!0),Ve=(await J9(Ae,l.disabled,a,p,t.shouldUseNativeValidation))[ke],b([ke]),$e(yt),Be&&(Ve?ct=!1:(d.isValid||f.isValid)&&(ct=await D(r,!0)));Be&&(Ae._f.deps&&W(Ae._f.deps),T(ke,ct,Ve,He))}},K=(de,me)=>{if(ft(n.errors,me)&&de.focus)return de.focus(),1},W=async(de,me={})=>{let ke,Be;const Ae=Sv(de);if(t.resolver){const $e=await O(Hs(de)?de:Ae);ke=io($e),Be=de?!Ae.some(ge=>ft($e,ge)):ke}else de?(Be=(await Promise.all(Ae.map(async $e=>{const ge=ft(r,$e);return await D(ge&&ge._f?{[$e]:ge}:ge)}))).every(Boolean),!(!Be&&!n.isValid)&&y()):Be=ke=await D(r);return h.state.next({...!Yc(de)||(d.isValid||f.isValid)&&ke!==n.isValid?{}:{name:de},...t.resolver||!de?{isValid:ke}:{},errors:n.errors}),me.shouldFocus&&!Be&&Av(r,K,de?Ae:l.mount),Be},q=de=>{const me={...o.mount?a:i};return Hs(de)?me:Yc(de)?ft(me,de):de.map(ke=>ft(me,ke))},oe=(de,me)=>({invalid:!!ft((me||n).errors,de),isDirty:!!ft((me||n).dirtyFields,de),error:ft((me||n).errors,de),isValidating:!!ft(n.validatingFields,de),isTouched:!!ft((me||n).touchedFields,de)}),J=de=>{de&&Sv(de).forEach(me=>Zs(n.errors,me)),h.state.next({errors:de?n.errors:{}})},Y=(de,me,ke)=>{const Be=(ft(r,de,{_f:{}})._f||{}).ref,Ae=ft(n.errors,de)||{},{ref:$e,message:ge,type:Le,...Ve}=Ae;jr(n.errors,de,{...Ve,...me,ref:Be}),h.state.next({name:de,errors:n.errors,isValid:!1}),ke&&ke.shouldFocus&&Be&&Be.focus&&Be.focus()},Z=(de,me)=>lc(de)?h.state.subscribe({next:ke=>"values"in ke&&de(M(void 0,me),ke)}):M(de,me,!0),G=de=>h.state.subscribe({next:me=>{ERe(de.name,me.name,de.exact)&&CRe(me,de.formState||d,qe,de.reRenderRoot)&&de.callback({values:{...a},...n,...me,defaultValues:i})}}).unsubscribe,se=de=>(o.mount=!0,f={...f,...de.formState},G({...de,formState:f})),ce=(de,me={})=>{for(const ke of de?Sv(de):l.mount)l.mount.delete(ke),l.array.delete(ke),me.keepValue||(Zs(r,ke),Zs(a,ke)),!me.keepError&&Zs(n.errors,ke),!me.keepDirty&&Zs(n.dirtyFields,ke),!me.keepTouched&&Zs(n.touchedFields,ke),!me.keepIsValidating&&Zs(n.validatingFields,ke),!t.shouldUnregister&&!me.keepDefaultValue&&Zs(i,ke);h.state.next({values:wi(a)}),h.state.next({...n,...me.keepDirty?{isDirty:L()}:{}}),!me.keepIsValid&&y()},le=({disabled:de,name:me})=>{(Ro(de)&&o.mount||de||l.disabled.has(me))&&(de?l.disabled.add(me):l.disabled.delete(me))},fe=(de,me={})=>{let ke=ft(r,de);const Be=Ro(me.disabled)||Ro(t.disabled);return jr(r,de,{...ke||{},_f:{...ke&&ke._f?ke._f:{ref:{name:de}},name:de,mount:!0,...me}}),l.mount.add(de),ke?le({disabled:Ro(me.disabled)?me.disabled:t.disabled,name:de}):E(de,!0,me.value),{...Be?{disabled:me.disabled||t.disabled}:{},...t.progressive?{required:!!me.required,min:Sy(me.min),max:Sy(me.max),minLength:Sy(me.minLength),maxLength:Sy(me.maxLength),pattern:Sy(me.pattern)}:{},name:de,onChange:z,onBlur:z,ref:Ae=>{if(Ae){fe(de,me),ke=ft(r,de);const $e=Hs(Ae.value)&&Ae.querySelectorAll&&Ae.querySelectorAll("input,select,textarea")[0]||Ae,ge=bRe($e),Le=ke._f.refs||[];if(ge?Le.find(Ve=>Ve===$e):$e===ke._f.ref)return;jr(r,de,{_f:{...ke._f,...ge?{refs:[...Le.filter(s4),$e,...Array.isArray(ft(i,de))?[{}]:[]],ref:{type:$e.type,name:de}}:{ref:$e}}}),E(de,!1,void 0,$e)}else ke=ft(r,de,{}),ke._f&&(ke._f.mount=!1),(t.shouldUnregister||me.shouldUnregister)&&!(Gse(l.array,de)&&o.action)&&l.unMount.add(de)}}},be=()=>t.shouldFocusError&&Av(r,K,l.mount),_e=de=>{Ro(de)&&(h.state.next({disabled:de}),Av(r,(me,ke)=>{const Be=ft(r,ke);Be&&(me.disabled=Be._f.disabled||de,Array.isArray(Be._f.refs)&&Be._f.refs.forEach(Ae=>{Ae.disabled=Be._f.disabled||de}))},0,!1))},pe=(de,me)=>async ke=>{let Be;ke&&(ke.preventDefault&&ke.preventDefault(),ke.persist&&ke.persist());let Ae=wi(a);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:$e,values:ge}=await P();n.errors=$e,Ae=wi(ge)}else await D(r);if(l.disabled.size)for(const $e of l.disabled)Zs(Ae,$e);if(Zs(n.errors,"root"),io(n.errors)){h.state.next({errors:{}});try{await de(Ae,ke)}catch($e){Be=$e}}else me&&await me({...n.errors},ke),be(),setTimeout(be);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:io(n.errors)&&!Be,submitCount:n.submitCount+1,errors:n.errors}),Be)throw Be},Te=(de,me={})=>{ft(r,de)&&(Hs(me.defaultValue)?H(de,wi(ft(i,de))):(H(de,me.defaultValue),jr(i,de,wi(me.defaultValue))),me.keepTouched||Zs(n.touchedFields,de),me.keepDirty||(Zs(n.dirtyFields,de),n.isDirty=me.defaultValue?L(de,wi(ft(i,de))):L()),me.keepError||(Zs(n.errors,de),d.isValid&&y()),h.state.next({...n}))},Ge=(de,me={})=>{const ke=de?wi(de):i,Be=wi(ke),Ae=io(de),$e=Ae?i:Be;if(me.keepDefaultValues||(i=ke),!me.keepValues){if(me.keepDirtyValues){const ge=new Set([...l.mount,...Object.keys(Ey(i,a))]);for(const Le of Array.from(ge))ft(n.dirtyFields,Le)?jr($e,Le,ft(a,Le)):H(Le,ft($e,Le))}else{if(EM&&Hs(de))for(const ge of l.mount){const Le=ft(r,ge);if(Le&&Le._f){const Ve=Array.isArray(Le._f.refs)?Le._f.refs[0]:Le._f.ref;if(V2(Ve)){const ct=Ve.closest("form");if(ct){ct.reset();break}}}}if(me.keepFieldsRef)for(const ge of l.mount)H(ge,ft($e,ge));else r={}}a=t.shouldUnregister?me.keepDefaultValues?wi(i):{}:wi($e),h.array.next({values:{...$e}}),h.state.next({values:{...$e}})}l={mount:me.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!d.isValid||!!me.keepIsValid||!!me.keepDirtyValues,o.watch=!!t.shouldUnregister,h.state.next({submitCount:me.keepSubmitCount?n.submitCount:0,isDirty:Ae?!1:me.keepDirty?n.isDirty:!!(me.keepDefaultValues&&!Du(de,i)),isSubmitted:me.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Ae?{}:me.keepDirtyValues?me.keepDefaultValues&&a?Ey(i,a):n.dirtyFields:me.keepDefaultValues&&de?Ey(i,de):me.keepDirty?n.dirtyFields:{},touchedFields:me.keepTouched?n.touchedFields:{},errors:me.keepErrors?n.errors:{},isSubmitSuccessful:me.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Ne=(de,me)=>Ge(lc(de)?de(a):de,me),it=(de,me={})=>{const ke=ft(r,de),Be=ke&&ke._f;if(Be){const Ae=Be.refs?Be.refs[0]:Be.ref;Ae.focus&&(Ae.focus(),me.shouldSelect&&lc(Ae.select)&&Ae.select())}},qe=de=>{n={...n,...de}},ot={control:{register:fe,unregister:ce,getFieldState:oe,handleSubmit:pe,setError:Y,_subscribe:G,_runSchema:P,_focusError:be,_getWatch:M,_getDirty:L,_setValid:y,_setFieldArray:w,_setDisabledField:le,_setErrors:j,_getFieldArray:B,_reset:Ge,_resetDefaultValues:()=>lc(t.defaultValues)&&t.defaultValues().then(de=>{Ne(de,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:R,_disableForm:_e,_subjects:h,_proxyFormState:d,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(de){o=de},get _defaultValues(){return i},get _names(){return l},set _names(de){l=de},get _formState(){return n},get _options(){return t},set _options(de){t={...t,...de}}},subscribe:se,trigger:W,register:fe,handleSubmit:pe,watch:Z,setValue:H,getValues:q,reset:Ne,resetField:Te,clearErrors:J,unregister:ce,setError:Y,setFocus:it,getFieldState:oe};return{...ot,formControl:ot}}function Zm(e={}){const t=ee.useRef(void 0),n=ee.useRef(void 0),[r,i]=ee.useState({isDirty:!1,isValidating:!1,isLoading:lc(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:lc(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!lc(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=ORe(e);t.current={...l,formState:r}}const a=t.current.control;return a._options=e,PM(()=>{const o=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}
vendor: 4,747 bytes, line 1186
1186),reRenderRoot:!0});return i(l=>({...l,isReady:!0})),a._formState.isReady=!0,o},[a]),ee.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),ee.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),ee.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),ee.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),ee.useEffect(()=>{if(a._proxyFormState.isDirty){const o=a._getDirty();o!==r.isDirty&&a._subjects.state.next({isDirty:o})}},[a,r.isDirty]),ee.useEffect(()=>{e.values&&!Du(e.values,n.current)?(a._reset(e.values,{keepFieldsRef:!0,...a._options.resetOptions}),n.current=e.values,i(o=>({...o}))):a._resetDefaultValues()},[a,e.values]),ee.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=Kse(r,a),t.current}const Z9=(e,t,n)=>{if(e&&"reportValidity"in e){const r=ft(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},rie=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Z9(r.ref,n,e):r.refs&&r.refs.forEach(i=>Z9(i,n,e))}},DRe=(e,t)=>{t.shouldUseNativeValidation&&rie(e,t);const n={};for(const r in e){const i=ft(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(IRe(t.names||Object.keys(e),r)){const o=Object.assign({},ft(n,r));jr(o,"root",a),jr(n,r,o)}else jr(n,r,a)}return n},IRe=(e,t)=>e.some(n=>n.startsWith(t+"."));var RRe=function(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[o]={message:l.message,type:l.code}}else n[o]={message:a,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=n[o].types,u=c&&c[r.code];n[o]=Xse(o,t,n,i,u?[].concat(u,r.message):r.message)}e.shift()}return n},ep=function(e,t,n){return n===void 0&&(n={}),function(r,i,a){try{return Promise.resolve(function(o,l){try{var c=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(u){return a.shouldUseNativeValidation&&rie({},a),{errors:{},values:n.raw?r:u}})}catch(u){return l(u)}return c&&c.then?c.then(void 0,l):c}(0,function(o){if(function(l){return Array.isArray(l==null?void 0:l.errors)}(o))return{values:{},errors:DRe(RRe(o.errors,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw o}))}catch(o){return Promise.reject(o)}}};const IM=pRe,sie=N.createContext({}),Nr=({...e})=>s.jsx(sie.Provider,{value:{name:e.name},children:s.jsx(vRe,{...e})}),zC=()=>{const e=N.useContext(sie),t=N.useContext(iie),{getFieldState:n,formState:r}=BC(),i=n(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...i}},iie=N.createContext({}),pr=N.forwardRef(({className:e,...t},n)=>{const r=N.useId();return s.jsx(iie.Provider,{value:{id:r},children:s.jsx("div",{ref:n,className:ae("space-y-2",e),...t})})});pr.displayName="FormItem";const gr=N.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:i}=zC();return s.jsx(Fe,{ref:n,className:ae(r&&"text-destructive",e),htmlFor:i,...t})});gr.displayName="FormLabel";const kr=N.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:i,formMessageId:a}=zC();return s.jsx(fY,{ref:t,id:r,"aria-describedby":n?`${i} ${a}`:`${i}`,"aria-invalid":!!n,...e})});kr.displayName="FormControl";const Iu=N.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=zC();return s.jsx("p",{ref:n,id:r,className:ae("text-sm text-muted-foreground",e),...t})});Iu.displayName="FormDescription";const xr=N.forwardRef(({className:e,children:t,...n},r)=>{const{error:i,formMessageId:a}=zC(),o=i?String(i==null?void 0:i.message):t;return o?s.jsx("p",{ref:r,id:a,className:ae("text-sm font-medium text-destructive",e),...n,children:o}):null});xr.displayName="FormMessage";var tn=function(){return tn=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},tn.apply(this,arguments)};function MRe(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 i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function aie(e,t,n){for(var r=0,i=t.length,a;r<i;
1186r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function tw(e){return e.mode==="multiple"}function nw(e){return e.mode==="range"}function UC(e){return e.mode==="single"}var LRe={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function FRe(e,t){return Ze(e,"LLLL y",t)}function $Re(e,t){return Ze(e,"d",t)}function BRe(e,t){return Ze(e,"LLLL",t)}function zRe(e){return"".concat(e)}function URe(e,t){return Ze(e,"cccccc",t)}function qRe(e,t){return Ze(e,"yyyy",t)}var VRe=Object.freeze({__proto__:null,formatCaption:FRe,formatDay:$Re,formatMonthCaption:BRe,formatWeekNumber:zRe,formatWeekdayName:URe,formatYearCaption:qRe}),HRe=function(e,t,n){return Ze(e,"do MMMM (EEEE)",n)},WRe=function(){return"Month: "},GRe=function(){return"Go to next month"},KRe=function(){return"Go to previous month"},YRe=function(e,t){return Ze(e,"cccc",t)},XRe=function(e){return"Week n. ".concat(e)},QRe=function(){return"Year: "},JRe=Object.freeze({__proto__:null,labelDay:HRe,labelMonthDropdown:WRe,labelNext:GRe,labelPrevious:KRe,labelWeekNumber:XRe,labelWeekday:YRe,labelYearDropdown:QRe});function ZRe(){var e="buttons",t=LRe,n=sC,r={},i={},a=1,o={},l=new Date;return{captionLayout:e,classNames:t,formatters:VRe,labels:JRe,locale:n,modifiersClassNames:r,modifiers:i,numberOfMonths:a,styles:o,today:l,mode:"default"}}function eMe(e){var t=e.fromYear,n=e.toYear,r=e.fromMonth,i=e.toMonth,a=e.fromDate,o=e.toDate;return r?a=aa(r):t&&(a=new Date(t,0,1)),i?o=mp(i):n&&(o=new Date(n,11,31)),{fromDate:a?Sl(a):void 0,toDate:o?Sl(o):void 0}}var oie=N.createContext(void 0);function tMe(e){var t,n=e.initialProps,r=ZRe(),i=eMe(n),a=i.fromDate,o=i.toDate,l=(t=n.captionLayout)!==null&&t!==void 0?t:r.captionLayout;l!=="buttons"&&(!a||!o)&&(l="buttons");var c;(UC(n)||tw(n)||nw(n))&&(c=n.onSelect);var u=tn(tn(tn({},r),n),{captionLayout:l,classNames:tn(tn({},r.classNames),n.classNames),components:tn({},n.components),formatters:tn(tn({},r.formatters),n.formatters),fromDate:a,labels:tn(tn({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:tn(tn({},r.modifiers),n.modifiers),modifiersClassNames:tn(tn({},r.modifiersClassNames),n.modifiersClassNames),onSelect:c,styles:tn(tn({},r.styles),n.styles),toDate:o});return s.jsx(oie.Provider,{value:u,children:e.children})}function es(){var e=N.useContext(oie);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function lie(e){var t=es(),n=t.locale,r=t.classNames,i=t.styles,a=t.formatters.formatCaption;return s.jsx("div",{className:r.caption_label,style:i.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:a(e.displayMonth,{locale:n})})}function nMe(e){return s.jsx("svg",tn({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:s.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.7
118678175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function cie(e){var t,n,r=e.onChange,i=e.value,a=e.children,o=e.caption,l=e.className,c=e.style,u=es(),d=(n=(t=u.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&n!==void 0?n:nMe;return s.jsxs("div",{className:l,style:c,children:[s.jsx("span",{className:u.classNames.vhidden,children:e["aria-label"]}),s.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:u.classNames.dropdown,style:u.styles.dropdown,value:i,onChange:r,children:a}),s.jsxs("div",{className:u.classNames.caption_label,style:u.styles.caption_label,"aria-hidden":"true",children:[o,s.jsx(d,{className:u.classNames.dropdown_icon,style:u.styles.dropdown_icon})]})]})}function rMe(e){var t,n=es(),r=n.fromDate,i=n.toDate,a=n.styles,o=n.locale,l=n.formatters.formatMonthCaption,c=n.classNames,u=n.components,d=n.labels.labelMonthDropdown;if(!r)return s.jsx(s.Fragment,{});if(!i)return s.jsx(s.Fragment,{});var f=[];if(LNe(r,i))for(var h=aa(r),p=r.getMonth();p<=i.getMonth();p++)f.push(xA(h,p));else for(var h=aa(new Date),p=0;p<=11;p++)f.push(xA(h,p));var x=function(b){var w=Number(b.target.value),_=xA(aa(e.displayMonth),w);e.onChange(_)},y=(t=u==null?void 0:u.Dropdown)!==null&&t!==void 0?t:cie;return s.jsx(y,{name:"months","aria-label":d(),className:c.dropdown_month,style:a.dropdown_month,onChange:x,value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:o}),children:f.map(function(b){return s.jsx("option",{value:b.getMonth(),children:l(b,{locale:o})},b.getMonth())})})}function sMe(e){var t,n=e.displayMonth,r=es(),i=r.fromDate,a=r.toDate,o=r.locale,l=r.styles,c=r.classNames,u=r.components,d=r.formatters.formatYearCaption,f=r.labels.labelYearDropdown,h=[];if(!i)return s.jsx(s.Fragment,{});if(!a)return s.jsx(s.Fragment,{});for(var p=i.getFullYear(),x=a.getFullYear(),y=p;y<=x;y++)h.push(S$(KQ(new Date),y));var b=function(_){var j=S$(aa(n),Number(_.target.value));e.onChange(j)},w=(t=u==null?void 0:u.Dropdown)!==null&&t!==void 0?t:cie;return s.jsx(w,{name:"years","aria-label":f(),className:c.dropdown_year,style:l.dropdown_year,onChange:b,value:n.getFullYear(),caption:d(n,{locale:o}),children:h.map(function(_){return s.jsx("option",{value:_.getFullYear(),children:d(_,{locale:o})},_.getFullYear())})})}function iMe(e,t){var n=N.useState(e),r=n[0],i=n[1],a=t===void 0?r:t;return[a,i]}function aMe(e){var t=e.month,n=e.defaultMonth,r=e.today,i=t||n||r||new Date,a=e.toDate,o=e.fromDate,l=e.numberOfMonths,c=l===void 0?1:l;if(a&&jx(a,i)<0){var u=-1*(c-1);i=bo(a,u)}return o&&jx(i,o)<0&&(i=o),aa(i)}function oMe(){var e=es(),t=aMe(e),n=iMe(t,e.month),r=n[0],i=n[1],a=function(o){var l;if(!e.disableNavigation){var c=aa(o);i(c),(l=e.onMonthChange)===null||l===void 0||l.call(e,c)}};return[r,a]}function lMe(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,i=aa(e),a=aa(bo(i,r)),o=jx(a,i),l=[],c=0;c<o;c++){var u=bo(i,c);l.push(u)}return n&&(l=l.reverse()),l}function cMe(e,t){if(!t.disableNavigation){var n=t.toDate,r=t.pagedNavigation,i=t.numberOfMonths,a=i===void 0?1:i,o=r?a:1,l=aa(e);if(!n)return bo(l,o);var c=jx(n,e);if(!(c<a))return bo(l,o)}}function uMe(e,t){if(!t.disableNavigation){var n=t.fromDate,r=t.pagedNavigation,i=t.numberOfMonths,a=i===void 0?1:i,o=r?a:1,l=aa(e);if(!n)return bo(l,-o);var c=jx(l,n);if(!(c<=0))return bo(l,-o)}}var uie=N.createContext(void 0);function dMe(e){var t=es(),n=oMe(),r=n[0],i=n[1],a=lMe(r,t),o=cMe(r,t),l=uMe(r,t),c=function(f){return a.some(function(h){return aC(f,h)})},u=function(f,h){c(f)||(h&&tJ(f,h)?i(bo(f,1+t.numberOfMonths*-1)):i(f))},d={currentMonth:r,displayMonths:a,goToMonth:i,goToDate:u,previousMonth:l,nextMonth:o,isDateDisplayed:c};return s.jsx(uie.Provider,{value:d,children:e.children})}function rw(){var e=N.useContext(uie);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function eB(e){var t,n=es(),r=n.classNames,i=n.styles,a=n.components,o=rw().goToMonth,l=function(d){o(bo(d,e.displayIndex?-e.dis
1186playIndex:0))},c=(t=a==null?void 0:a.CaptionLabel)!==null&&t!==void 0?t:lie,u=s.jsx(c,{id:e.id,displayMonth:e.displayMonth});return s.jsxs("div",{className:r.caption_dropdowns,style:i.caption_dropdowns,children:[s.jsx("div",{className:r.vhidden,children:u}),s.jsx(rMe,{onChange:l,displayMonth:e.displayMonth}),s.jsx(sMe,{onChange:l,displayMonth:e.displayMonth})]})}function fMe(e){return s.jsx("svg",tn({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:s.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function hMe(e){return s.jsx("svg",tn({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:s.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var G2=N.forwardRef(function(e,t){var n=es(),r=n.classNames,i=n.styles,a=[r.button_reset,r.button];e.className&&a.push(e.className);var o=a.join(" "),l=tn(tn({},i.button_reset),i.button);return e.style&&Object.assign(l,e.style),s.jsx("button",tn({},e,{ref:t,type:"button",className:o,style:l}))});function mMe(e){var t,n,r=es(),i=r.dir,a=r.locale,o=r.classNames,l=r.styles,c=r.labels,u=c.labelPrevious,d=c.labelNext,f=r.components;if(!e.nextMonth&&!e.previousMonth)return s.jsx(s.Fragment,{});var h=u(e.previousMonth,{locale:a}),p=[o.nav_button,o.nav_button_previous].join(" "),x=d(e.nextMonth,{locale:a}),y=[o.nav_button,o.nav_button_next].join(" "),b=(t=f==null?void 0:f.IconRight)!==null&&t!==void 0?t:hMe,w=(n=f==null?void 0:f.IconLeft)!==null&&n!==void 0?n:fMe;return s.jsxs("div",{className:o.nav,style:l.nav,children:[!e.hidePrevious&&s.jsx(G2,{name:"previous-month","aria-label":h,className:p,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:i==="rtl"?s.jsx(b,{className:o.nav_icon,style:l.nav_icon}):s.jsx(w,{className:o.nav_icon,style:l.nav_icon})}),!e.hideNext&&s.jsx(G2,{name:"next-month","aria-label":x,className:y,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:i==="rtl"?s.jsx(w,{className:o.nav_icon,style:l.nav_icon}):s.jsx(b,{className:o.nav_icon,style:l.nav_icon})})]})}function tB(e){var t=es().numberOfMonths,n=rw(),r=n.previousMonth,i=n.nextMonth,a=n.goToMonth,o=n.displayMonths,l=o.findIndex(function(x){return aC(e.displayMonth,x)}),c=l===0,u=l===o.length-1,d=t>1&&(c||!u),f=t>1&&(u||!c),h=function(){r&&a(r)},p=function(){i&&a(i)};return s.jsx(mMe,{displayMonth:e.displayMonth,hideNext:d,hidePrevious:f,nextMonth:i,previousMonth:r,onPreviousClick:h,onNextClick:p})}function pMe(e){var t,n=es(),r=n.classNames,i=n.disableNavigation,a=n.styles,o=n.captionLayout,l=n.components,c=(t=l==null?void 0:l.CaptionLabel)!==null&&t!==void 0?t:lie,u;return i?u=s.jsx(c,{id:e.id,displayMonth:e.displayMonth}):o==="dropdown"?u=s.jsx(eB,{displayMonth:e.displayMonth,id:e.id}):o==="dropdown-buttons"?u=s.jsxs(s.Fragment,{children:[s.jsx(eB,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),s.jsx(tB,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):u=s.jsxs(s.Fragment,{children:[s.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),s.jsx(tB,{displayMonth:e.displayMonth,id:e.id})]}),s.jsx("div",{className:r.caption,style:a.caption,children:u})}function gMe(e){var t=es(),n=t.footer,r=t.styles,i=t.classNames.tfoot;return n?s.jsx("tfoot",{className:i,style:r.tfoot,children:s.jsx("tr",{children:s.jsx("td",{colSpan:8,children:n})})}):s.jsx(s.Fragment,{})}function xMe(e,t,n){for(var r=n?ad(new Date):wo(new Date,{locale:e,weekStartsOn:t}),i=[],a=0;a<7;a++){var o=ai(r,a);i.push(o)}return i}function yMe(){var e=es(),t=e.classNames,n=e.styles,r=e.showWeekNumber,i=e.locale,a=e.weekStartsOn,o=e.ISOWeek,l=e.formatters.formatWeekdayName,c=e.labels.labelWeekday,u=xMe(i,a,o);return s.jsxs("tr",{style:n.head_row,className:t.head_row,children:[r&&s.jsx("td",{style:n.head_cell,className:t.head_cell}),u.map(function(d,f){return s.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":c(d,{locale:i}),children:l(d,{locale:i})},f)})]})}function vMe(){var e,t=es(),n=t.classNames,r=t.styles,i=t.components,a=(e=i==null?void 0:i.HeadRow)!==null&&e!==void 0?e:yMe;return s.jsx("thead",{style:r.head,className:n.head,children:s.jsx(a,{})})}function bMe(e){var t=es(),n=t.locale,r=t.formatters.formatDay;return s.jsx(s.Fragment,{children:r(e.date,{locale:n})})}var RM=N.createContext(void 0);function wMe(e){if(!tw(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return s.jsx(RM.Provider,{value:t,children:e.children})}return s.jsx(_Me,{initialProps:e.initialProps,children:e.children})}function _Me(e){var t=e.initialProps,n=e.children,r=t.selected,i=t.min,a=t.max,o=function(u,d,f){var h,p;(h=t.onDayClick)===null||h===void 0||h.call(t,u,d,f);var x=!!(d.selected&&i&&(r==null?void 0:r.length)===i);if(!x){var y=!!(!d.selected&&a&&(r==null?void 0:r.length)===a);if(!y){var b=r?aie([],r):[];if(d.selected){var w=b.findIndex(function(_){return Ui(u,_)});b.splice(w,1)}else b.push(u);(p=t.onSelect)===null||p===void 0||p.call(t,b,u,d,f)}}},l={disabled:[]};r&&l.disabled.push(function(u){var d=a&&r.length>a-1,f=r.some(function(h){return Ui(h,u)});return!!(d&&!f)});var c={selected:r,onDayClick:o,modifiers:l};return s.jsx(RM.Provider,{value:c,children:n})}function MM(){var e=N.useContext(RM);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function jMe(e,t){var n=t||{},r=n.from,i=n.to;return r&&i?Ui(i,e)&&Ui(r,e)?void 0:Ui(i,e)?{from:i,to:void 0}:Ui(r,e)?void 0:lT(r,e)?{from:e,to:i}:{from:r,to:e}:i?lT(e,i)?{from:i,to:e}:{from:e,to:i}:r?tJ(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}
1186var LM=N.createContext(void 0);function NMe(e){if(!nw(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return s.jsx(LM.Provider,{value:t,children:e.children})}return s.jsx(kMe,{initialProps:e.initialProps,children:e.children})}function kMe(e){var t=e.initialProps,n=e.children,r=t.selected,i=r||{},a=i.from,o=i.to,l=t.min,c=t.max,u=function(p,x,y){var b,w;(b=t.onDayClick)===null||b===void 0||b.call(t,p,x,y);var _=jMe(p,r);(w=t.onSelect)===null||w===void 0||w.call(t,_,p,x,y)},d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(a?(d.range_start=[a],o?(d.range_end=[o],Ui(a,o)||(d.range_middle=[{after:a,before:o}])):d.range_end=[a]):o&&(d.range_start=[o],d.range_end=[o]),l&&(a&&!o&&d.disabled.push({after:hj(a,l-1),before:ai(a,l-1)}),a&&o&&d.disabled.push({after:a,before:ai(a,l-1)}),!a&&o&&d.disabled.push({after:hj(o,l-1),before:ai(o,l-1)})),c){if(a&&!o&&(d.disabled.push({before:ai(a,-c+1)}),d.disabled.push({after:ai(a,c-1)})),a&&o){var f=dc(o,a)+1,h=c-f;d.disabled.push({before:hj(a,h)}),d.disabled.push({after:ai(o,h)})}!a&&o&&(d.disabled.push({before:ai(o,-c+1)}),d.disabled.push({after:ai(o,c-1)}))}return s.jsx(LM.Provider,{value:{selected:r,onDayClick:u,modifiers:d},children:n})}function FM(){var e=N.useContext(LM);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function Cj(e){return Array.isArray(e)?aie([],e):e!==void 0?[e]:[]}function CMe(e){var t={};return Object.entries(e).forEach(function(n){var r=n[0],i=n[1];t[r]=Cj(i)}),t}var bc;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(bc||(bc={}));var EMe=bc.Selected,wu=bc.Disabled,SMe=bc.Hidden,AMe=bc.Today,i4=bc.RangeEnd,a4=bc.RangeMiddle,o4=bc.RangeStart,TMe=bc.Outside;function PMe(e,t,n){var r,i=(r={},r[EMe]=Cj(e.selected),r[wu]=Cj(e.disabled),r[SMe]=Cj(e.hidden),r[AMe]=[e.today],r[i4]=[],r[a4]=[],r[o4]=[],r[TMe]=[],r);return e.fromDate&&i[wu].push({before:e.fromDate}),e.toDate&&i[wu].push({after:e.toDate}),tw(e)?i[wu]=i[wu].concat(t.modifiers[wu]):nw(e)&&(i[wu]=i[wu].concat(n.modifiers[wu]),i[o4]=n.modifiers[o4],i[a4]=n.modifiers[a4],i[i4]=n.modifiers[i4]),i}var die=N.createContext(void 0);function OMe(e){var t=es(),n=MM(),r=FM(),i=PMe(t,n,r),a=CMe(t.modifiers),o=tn(tn({},i),a);return s.jsx(die.Provider,{value:o,children:e.children})}function fie(){var e=N.useContext(die);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function DMe(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function IMe(e){return!!(e&&typeof e=="object"&&"from"in e)}function RMe(e){return!!(e&&typeof e=="object"&&"after"in e)}function MMe(e){return!!(e&&typeof e=="object"&&"before"in e)}function LMe(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function FMe(e,t){var n,r=t.from,i=t.to;if(r&&i){var a=dc(i,r)<0;a&&(n=[i,r],r=n[0],i=n[1]);var o=dc(e,r)>=0&&dc(i,e)>=0;return o}return i?Ui(i,e):r?Ui(r,e):!1}function $Me(e){return WI(e)}function BMe(e){return Array.isArray(e)&&e.every(WI)}function zMe(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if($Me(n))return Ui(e,n);if(BMe(n))return n.includes(e);if(IMe(n))return FMe(e,n);if(LMe(n))return n.dayOfWeek.includes(e.getDay());if(DMe(n)){var r=dc(n.before,e),i=dc(n.after,e),a=r>0,o=i<0,l=lT(n.before,n.after);return l?o&&a:a||o}return RMe(n)?dc(e,n.after)>0:MMe(n)?dc(n.before,e)>0:typeof n=="function"?n(e):!1})}function $M(e,t,n){var r=Object.keys(t).reduce(function(a,o){var l=t[o];return zMe(e,l)&&a.push(o),a},[]),i={};return r.forEach(function(a){return i[a]=!0}),n&&!aC(e,n)&&(i.outside=!0),i}function UMe(e,t){for(var n=aa(e[0]),r=mp(e[e.length-1]),i,a,o=n;o<=r;){var l=$M(o,t),c=!l.disabled&&!l.hidden;if(!c){o=ai(o,1);continue}if(l.selected)return o;l.today&&!a&&(a=o),i||(i=o),o=ai(o,1)}return a||i}var qMe=365;function hie(e,t){var n=t.moveBy,r=t.direction,i=t.context,a=t.modifiers,o=t.retry,l=o===void 0?{count:0,lastFocused:e}:o,c=i.weekStartsOn,u=i.fromDate,d=i.toDate,f=i.locale,h={day:ai,week:Vg,month:bo,year:Rje,startOfWeek:function(b){return i.ISOWeek?ad(b):wo(b,{locale:f,weekStartsOn:c})},endOfWeek:function(b){return i.ISOWeek?YQ(b):E0(b,{locale:f,weekStartsOn:c})}},p=h[n](e,r==="after"?1:-1);r==="before"&&u?p=Mje([u,p]):r==="after"&&d&&(p=Lje([d,p]));var x=!0;if(a){var y=$M(p,a);x=!y.disabled&&!y.hidden}return x?p:l.count>qMe?l.lastFocused:hie(p,{moveBy:n,direction:r,context:i,modifiers:a,retry:tn(tn({},l),{count:l.count+1})})}var mie=N.createContext(void 0);
1186function VMe(e){var t=rw(),n=fie(),r=N.useState(),i=r[0],a=r[1],o=N.useState(),l=o[0],c=o[1],u=UMe(t.displayMonths,n),d=i??(l&&t.isDateDisplayed(l))?l:u,f=function(){c(i),a(void 0)},h=function(b){a(b)},p=es(),x=function(b,w){if(i){var _=hie(i,{moveBy:b,direction:w,context:p,modifiers:n});Ui(i,_)||(t.goToDate(_,i),h(_))}},y={focusedDay:i,focusTarget:d,blur:f,focus:h,focusDayAfter:function(){return x("day","after")},focusDayBefore:function(){return x("day","before")},focusWeekAfter:function(){return x("week","after")},focusWeekBefore:function(){return x("week","before")},focusMonthBefore:function(){return x("month","before")},focusMonthAfter:function(){return x("month","after")},focusYearBefore:function(){return x("year","before")},focusYearAfter:function(){return x("year","after")},focusStartOfWeek:function(){return x("startOfWeek","before")},focusEndOfWeek:function(){return x("endOfWeek","after")}};return s.jsx(mie.Provider,{value:y,children:e.children})}function BM(){var e=N.useContext(mie);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function HMe(e,t){var n=fie(),r=$M(e,n,t);return r}var zM=N.createContext(void 0);function WMe(e){if(!UC(e.initialProps)){var t={selected:void 0};return s.jsx(zM.Provider,{value:t,children:e.children})}return s.jsx(GMe,{initialProps:e.initialProps,children:e.children})}function GMe(e){var t=e.initialProps,n=e.children,r=function(a,o,l){var c,u,d;if((c=t.onDayClick)===null||c===void 0||c.call(t,a,o,l),o.selected&&!t.required){(u=t.onSelect)===null||u===void 0||u.call(t,void 0,a,o,l);return}(d=t.onSelect)===null||d===void 0||d.call(t,a,a,o,l)},i={selected:t.selected,onDayClick:r};return s.jsx(zM.Provider,{value:i,children:n})}function pie(){var e=N.useContext(zM);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function KMe(e,t){var n=es(),r=pie(),i=MM(),a=FM(),o=BM(),l=o.focusDayAfter,c=o.focusDayBefore,u=o.focusWeekAfter,d=o.focusWeekBefore,f=o.blur,h=o.focus,p=o.focusMonthBefore,x=o.focusMonthAfter,y=o.focusYearBefore,b=o.focusYearAfter,w=o.focusStartOfWeek,_=o.focusEndOfWeek,j=function(z){var K,W,q,oe;UC(n)?(K=r.onDayClick)===null||K===void 0||K.call(r,e,t,z):tw(n)?(W=i.onDayClick)===null||W===void 0||W.call(i,e,t,z):nw(n)?(q=a.onDayClick)===null||q===void 0||q.call(a,e,t,z):(oe=n.onDayClick)===null||oe===void 0||oe.call(n,e,t,z)},E=function(z){var K;h(e),(K=n.onDayFocus)===null||K===void 0||K.call(n,e,t,z)},S=function(z){var K;f(),(K=n.onDayBlur)===null||K===void 0||K.call(n,e,t,z)},T=function(z){var K;(K=n.onDayMouseEnter)===null||K===void 0||K.call(n,e,t,z)},P=function(z){var K;(K=n.onDayMouseLeave)===null||K===void 0||K.call(n,e,t,z)},O=function(z){var K;(K=n.onDayPointerEnter)===null||K===void 0||K.call(n,e,t,z)},D=function(z){var K;(K=n.onDayPointerLeave)===null||K===void 0||K.call(n,e,t,z)},R=function(z){var K;(K=n.onDayTouchCancel)===null||K===void 0||K.call(n,e,t,z)},L=function(z){var K;(K=n.onDayTouchEnd)===null||K===void 0||K.call(n,e,t,z)},M=function(z){var K;(K=n.onDayTouchMove)===null||K===void 0||K.call(n,e,t,z)},B=function(z){var K;(K=n.onDayTouchStart)===null||K===void 0||K.call(n,e,t,z)},U=function(z){var K;(K=n.onDayKeyUp)===null||K===void 0||K.call(n,e,t,z)},F=function(z){var K;switch(z.key){case"ArrowLeft":z.preventDefault(),z.stopPropagation(),n.dir==="rtl"?l():c();break;case"ArrowRight":z.preventDefault(),z.stopPropagation(),n.dir==="rtl"?c():l();break;case"ArrowDown":z.preventDefault(),z.stopPropagation(),u();break;case"ArrowUp":z.preventDefault(),z.stopPropagation(),d();break;case"PageUp":z.preventDefault(),z.stopPropagation(),z.shiftKey?y():p();break;case"PageDown":z.preventDefault(),z.stopPropagation(),z.shiftKey?b():x();break;case"Home":z.preventDefault(),z.stopPropagation(),w();break;case"End":z.preventDefault(),z.stopPropagation(),_();break}(K=n.onDayKeyDown)===null||K===void 0||K.call(n,e,t,z)},H={onClick:j,onFocus:E,onBlur:S,onKeyDown:F,onKeyUp:U,onMouseEnter:T,onMouseLeave:P,onPointerEnter:O,onPointerLeave:D,onTouchCancel:R,onTouchEnd:L,onTouchMove:M,onTouchStart:B};return H}function YMe(){var e=es(),t=pie(),n=MM(),r=FM(),i=UC(e)?t.selected:tw(e)?n.selected:nw(e)?r.selected:void 0;return i}function XMe(e){return Object.values(bc).includes(e)}function QMe(e,t){var n=[e.classNames.day];return Object.keys(t).forEach(function(r){var i=e.modifiersClassNames[r];if(i)n.push(i);else if(XMe(r)){var a=e.classNames["day_".concat(r)];a&&n.push(a)}}),n}function JMe(e,t){var n=tn({},e.styles.day);return Object.keys(t).forEach(function(r){var i;n=tn(tn({},n),(i=e.modifiersStyles)===null||i===void 0?void 0:i[r])}),n}function ZMe(e,t,n){var r,i,a,o=es(),l=BM(),c=HMe(e,t),u=KMe(e,c),d=YMe(),f=!!(o.onDayCl
1186ick||o.mode!=="default");N.useEffect(function(){var T;c.outside||l.focusedDay&&f&&Ui(l.focusedDay,e)&&((T=n.current)===null||T===void 0||T.focus())},[l.focusedDay,e,n,f,c.outside]);var h=QMe(o,c).join(" "),p=JMe(o,c),x=!!(c.outside&&!o.showOutsideDays||c.hidden),y=(a=(i=o.components)===null||i===void 0?void 0:i.DayContent)!==null&&a!==void 0?a:bMe,b=s.jsx(y,{date:e,displayMonth:t,activeModifiers:c}),w={style:p,className:h,children:b,role:"gridcell"},_=l.focusTarget&&Ui(l.focusTarget,e)&&!c.outside,j=l.focusedDay&&Ui(l.focusedDay,e),E=tn(tn(tn({},w),(r={disabled:c.disabled,role:"gridcell"},r["aria-selected"]=c.selected,r.tabIndex=j||_?0:-1,r)),u),S={isButton:f,isHidden:x,activeModifiers:c,selectedDays:d,buttonProps:E,divProps:w};return S}function e6e(e){var t=N.useRef(null),n=ZMe(e.date,e.displayMonth,t);return n.isHidden?s.jsx("div",{role:"gridcell"}):n.isButton?s.jsx(G2,tn({name:"day",ref:t},n.buttonProps)):s.jsx("div",tn({},n.divProps))}function t6e(e){var t=e.number,n=e.dates,r=es(),i=r.onWeekNumberClick,a=r.styles,o=r.classNames,l=r.locale,c=r.labels.labelWeekNumber,u=r.formatters.formatWeekNumber,d=u(Number(t),{locale:l});if(!i)return s.jsx("span",{className:o.weeknumber,style:a.weeknumber,children:d});var f=c(Number(t),{locale:l}),h=function(p){i(t,n,p)};return s.jsx(G2,{name:"week-number","aria-label":f,className:o.weeknumber,style:a.weeknumber,onClick:h,children:d})}function n6e(e){var t,n,r=es(),i=r.styles,a=r.classNames,o=r.showWeekNumber,l=r.components,c=(t=l==null?void 0:l.Day)!==null&&t!==void 0?t:e6e,u=(n=l==null?void 0:l.WeekNumber)!==null&&n!==void 0?n:t6e,d;return o&&(d=s.jsx("td",{className:a.cell,style:i.cell,children:s.jsx(u,{number:e.weekNumber,dates:e.dates})})),s.jsxs("tr",{className:a.row,style:i.row,children:[d,e.dates.map(function(f){return s.jsx("td",{className:a.cell,style:i.cell,role:"presentation",children:s.jsx(c,{displayMonth:e.displayMonth,date:f})},$2e(f))})]})}function nB(e,t,n){for(var r=n!=null&&n.ISOWeek?YQ(t):E0(t,n),i=n!=null&&n.ISOWeek?ad(e):wo(e,n),a=dc(r,i),o=[],l=0;l<=a;l++)o.push(ai(i,l));var c=o.reduce(function(u,d){var f=n!=null&&n.ISOWeek?GI(d):YI(d,n),h=u.find(function(p){return p.weekNumber===f});return h?(h.dates.push(d),u):(u.push({weekNumber:f,dates:[d]}),u)},[]);return c}function r6e(e,t){var n=nB(aa(e),mp(e),t);if(t!=null&&t.useFixedWeeks){var r=z2e(e,t);if(r<6){var i=n[n.length-1],a=i.dates[i.dates.length-1],o=Vg(a,6-r),l=nB(Vg(a,1),o,t);n.push.apply(n,l)}}return n}function s6e(e){var t,n,r,i=es(),a=i.locale,o=i.classNames,l=i.styles,c=i.hideHead,u=i.fixedWeeks,d=i.components,f=i.weekStartsOn,h=i.firstWeekContainsDate,p=i.ISOWeek,x=r6e(e.displayMonth,{useFixedWeeks:!!u,ISOWeek:p,locale:a,weekStartsOn:f,firstWeekContainsDate:h}),y=(t=d==null?void 0:d.Head)!==null&&t!==void 0?t:vMe,b=(n=d==null?void 0:d.Row)!==null&&n!==void 0?n:n6e,w=(r=d==null?void 0:d.Footer)!==null&&r!==void 0?r:gMe;return s.jsxs("table",{id:e.id,className:o.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!c&&s.jsx(y,{}),s.jsx("tbody",{className:o.tbody,style:l.tbody,children:x.map(function(_){return s.jsx(b,{displayMonth:e.displayMonth,dates:_.dates,weekNumber:_.weekNumber},_.weekNumber)})}),s.jsx(w,{displayMonth:e.displayMonth})]})}function i6e(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var a6e=i6e()?N.useLayoutEffect:N.useEffect,l4=!1,o6e=0;function rB(){return"react-day-picker-".concat(++o6e)}function l6e(e){var t,n=e??(l4?rB():null),r=N.useState(n),i=r[0],a=r[1];return a6e(function(){i===null&&a(rB())},[]),N.useEffect(function(){l4===!1&&(l4=!0)},[]),(t=e??i)!==null&&t!==void 0?t:void 0}function c6e(e){var t,n,r=es(),i=r.dir,a=r.classNames,o=r.styles,l=r.components,c=rw().displayMonths,u=l6e(r.id?"".concat(r.id,"-").concat(e.displayIndex):void 0),d=r.id?"".concat(r.id,"-grid-").concat(e.displayIndex):void 0,f=[a.month],h=o.month,p=e.displayIndex===0,x=e.displayIndex===c.length-1,y=!p&&!x;i==="rtl"&&(t=[p,x],x=t[0],p=t[1]),p&&(f.push(a.caption_start),h=tn(tn({},h),o.caption_start)),x&&(f.push(a.caption_end),h=tn(tn({},h),o.caption_end)),y&&(f.push(a.caption_between),h=tn(tn({},h),o.caption_between));var b=(n=l==null?void 0:l.Caption)!==null&&n!==void 0?n:pMe;return s.jsxs("div",{className:f.join(" "),style:h,children:[s.jsx(b,{id:u,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),s.jsx(s6e,{id:d,"aria-labelledby":u,displayMonth:e.displayMonth})]},e.displayIndex)}function u6e(e){var t=es(),n=t.classNames,r=t.styles;return s.jsx("div",{className:n.months,style:r.months,children:e.children})}function d6e(e){var t,n,r=e.initialProps,i=es(),a=BM(),o=rw(),l=N.useState(!1),c=l[0],u=l[1];N.useEffect(function(){i.initialFocus&&a.focusTarget&&(c||(a.focus(a.focusTarget),u(!0)))},[i.initialFocus,c,a.focus,a.focusTarget,a]);var d=[i.classNames.root,i.className];i.numberOfMonths>1&&d.push(i.classNames.multiple_months),i.showWeekNumber&&d.push(i.classNames.with_weeknumber);var f=tn(tn({},i.styles.root),i.style),h=Object.keys(r).filter(function(x){return x.startsWith("data-")}).reduce(function(x,y){var b;return tn(tn({},x),(b={},b[y]=r[y],b))},{}),p=(n=(t=r.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:u6e;return s.jsx("div",tn({className:d.join(" "),style:f,dir:i.dir,id:i.id,nonce:r.nonce,title:r.title,lang:r.lang},h,{children:s.jsx(p,{children:o.displayMonths.map(function(x,y){return s.jsx(c6e,{displayIndex:y,displayMonth:x},y)})})}))}function f6e(e){var t=e.children,n=MRe(e,["children"]);return s.jsx(tMe,{initialProps:n,children:s.jsx(dMe,{children:s.jsx(WMe,{initialProps:n,children:s.jsx(wMe,{initialProps:n,children:s.jsx(NMe,{initialProps:n,children:s.jsx(OMe,{children:s.jsx(VMe,{children:t})})})})})})})}function h6e(e){return s.jsx(f6e,tn({},e,{children:s.jsx(d6e,{initialProps:e})}))}function K2({className:e,classNames:t,showOutsideDays:n=!0,...r}){return s.jsx(h6e,{showOutsideDays:n,className:ae("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:sp
1186ace-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:ae(b1({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:ae(b1({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:({...i})=>s.jsx(fp,{className:"h-4 w-4"}),IconRight:({...i})=>s.jsx(la,{className:"h-4 w-4"})},...r})}K2.displayName="Calendar";var UM="Radio",[m6e,gie]=Us(UM),[p6e,g6e]=m6e(UM),xie=N.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:i=!1,required:a,disabled:o,value:l="on",onCheck:c,form:u,...d}=e,[f,h]=N.useState(null),p=Qt(t,b=>h(b)),x=N.useRef(!1),y=f?u||!!f.closest("form"):!0;return s.jsxs(p6e,{scope:n,checked:i,disabled:o,children:[s.jsx(ut.button,{type:"button",role:"radio","aria-checked":i,"data-state":wie(i),"data-disabled":o?"":void 0,disabled:o,value:l,...d,ref:p,onClick:Je(e.onClick,b=>{i||c==null||c(),y&&(x.current=b.isPropagationStopped(),x.current||b.stopPropagation())})}),y&&s.jsx(bie,{control:f,bubbles:!x.current,name:r,value:l,checked:i,required:a,disabled:o,form:u,style:{transform:"translateX(-100%)"}})]})});xie.displayName=UM;var yie="RadioIndicator",vie=N.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...i}=e,a=g6e(yie,n);return s.jsx(mi,{present:r||a.checked,children:s.jsx(ut.span,{"data-state":wie(a.checked),"data-disabled":a.disabled?"":void 0,...i,ref:t})})});vie.displayName=yie;var x6e="RadioBubbleInput",bie=N.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{const o=N.useRef(null),l=Qt(o,a),c=RC(n),u=qk(t);return N.useEffect(()=>{const d=o.current;if(!d)return;const f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==n&&p){const x=new Event("click",{bubbles:r});p.call(d,n),d.dispatchEvent(x)}},[c,n,r]),s.jsx(ut.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});bie.displayName=x6e;function wie(e){return e?"checked":"unchecked"}var y6e=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],qC="RadioGroup",[v6e]=Us(qC,[Zf,gie]),_ie=Zf(),jie=gie(),[b6e,w6e]=v6e(qC),Nie=N.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:i,value:a,required:o=!1,disabled:l=!1,orientation:c,dir:u,loop:d=!0,onValueChange:f,...h}=e,p=_ie(n),x=Jf(u),[y,b]=Hi({prop:a,defaultProp:i??null,onChange:f,caller:qC});return s.jsx(b6e,{scope:n,name:r,required:o,disabled:l,value:y,onValueChange:b,children:s.jsx(hC,{asChild:!0,...p,orientation:c,dir:x,loop:d,children:s.jsx(ut.div,{role:"radiogroup","aria-required":o,"aria-orientation":c,"data-disabled":l?"":void 0,dir:x,...h,ref:t})})})});Nie.displayName=qC;var kie="RadioGroupItem",Cie=N.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...i}=e,a=w6e(kie,n),o=a.disabled||r,l=_ie(n),c=jie(n),u=N.useRef(null),d=Qt(t,u),f=a.value===i.value,h=N.useRef(!1);return N.useEffect(()=>{const p=y=>{y6e.includes(y.key)&&(h.current=!0)},x=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",x),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",x)}},[]),s.jsx(mC,{asChild:!0,...l,focusable:!o,active:f,children:s.jsx(xie,{disabled:o,required:a.required,
1186checked:f,...c,...i,name:a.name,ref:d,onCheck:()=>a.onValueChange(i.value),onKeyDown:Je(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:Je(i.onFocus,()=>{var p;h.current&&((p=u.current)==null||p.click())})})})});Cie.displayName=kie;var _6e="RadioGroupIndicator",Eie=N.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,i=jie(n);return s.jsx(vie,{...i,...r,ref:t})});Eie.displayName=_6e;var Sie=Nie,Aie=Cie,j6e=Eie;const ud=N.forwardRef(({className:e,...t},n)=>s.jsx(Sie,{className:ae("grid gap-2",e),...t,ref:n}));ud.displayName=Sie.displayName;const ui=N.forwardRef(({className:e,...t},n)=>s.jsx(Aie,{ref:n,className:ae("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:s.jsx(j6e,{className:"flex items-center justify-center",children:s.jsx(qY,{className:"h-2.5 w-2.5 fill-current text-current"})})}));ui.displayName=Aie.displayName;var VC="Switch",[N6e]=Us(VC),[k6e,C6e]=N6e(VC),Tie=N.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=e,[h,p]=N.useState(null),x=Qt(t,j=>p(j)),y=N.useRef(!1),b=h?d||!!h.closest("form"):!0,[w,_]=Hi({prop:i,defaultProp:a??!1,onChange:u,caller:VC});return s.jsxs(k6e,{scope:n,checked:w,disabled:l,children:[s.jsx(ut.button,{type:"button",role:"switch","aria-checked":w,"aria-required":o,"data-state":Iie(w),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:x,onClick:Je(e.onClick,j=>{_(E=>!E),b&&(y.current=j.isPropagationStopped(),y.current||j.stopPropagation())})}),b&&s.jsx(Die,{control:h,bubbles:!y.current,name:r,value:c,checked:w,required:o,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});Tie.displayName=VC;var Pie="SwitchThumb",Oie=N.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,i=C6e(Pie,n);return s.jsx(ut.span,{"data-state":Iie(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})});Oie.displayName=Pie;var E6e="SwitchBubbleInput",Die=N.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{const o=N.useRef(null),l=Qt(o,a),c=RC(n),u=qk(t);return N.useEffect(()=>{const d=o.current;if(!d)return;const f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==n&&p){const x=new Event("click",{bubbles:r});p.call(d,n),d.dispatchEvent(x)}},[c,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Die.displayName=E6e;function Iie(e){return e?"checked":"unchecked"}var Rie=Tie,S6e=Oie;const R0=N.forwardRef(({className:e,...t},n)=>s.jsx(Rie,{className:ae("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",e),...t,ref:n,children:s.jsx(S6e,{className:ae("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));R0.displayName=Rie.displayName;const A6e=Array.from({length:24},(e,t)=>t),sB=Array.from({length:12},(e,t)=>t*5),T6e=["12:00","14:00","18:00","19:00","20:00","20:30","21:00"],nP=/^([01]?[0-9]|2[0-3]):([0-5][0-9])$/,m_=e=>e.toString().padStart(2,"0");function P6e(e){if(!e)return{h:null,m:null};const t=nP.exec(e);return t?{h:parseInt(t[1],10),m:parseInt(t[2],10)}:{h:null,m:null}}const O6e=({value:e,onChange:t,placeholder:n="—:—",disabled:r,className:i})=>{const[a,o]=N.useState(!1),{h:l,m:c}=P6e(e),u=N.useRef(null),d=N.useRef(null),[f,h]=N.useState(e??"");N.useEffect(()=>{h(e??"")},[e]),N.useEffect(()=>{a&&requestAnimationFrame(()=>{if(l!==null&&u.current){const y=u.current.querySelector(`[data-h="${l}"]`);y==null||y.scrollIntoView({block:"center"})}if(c!==null&&d.current){const y=sB.reduce((w,_)=>Math.abs(_-c)<Math.abs(w-c)?_:w),b=d.current.querySelector(`[data-m="${y}"]`);b==null||b.scrollIntoView({block:"center"})}})},[a,l,c]);const p=(y,b)=>{const w=y??l??20,_=b??c??0;t(`${m_(w)}:${m_(_)}`)},x=y=>{const b=y.replace(/\D/g,"").slice(0,4);let w=b;b.length>=3&&(w=`${b.slice(0,2)}:${b.slice(2)}`),h(w),nP.test(w)&&t(w)};return s.jsxs(Vm,{open:a,onOpenChange:o,children:[s.jsx(Hm,{asChild:!0,children:s.jsxs(Q,{type:"button",variant:"outline",disabled:r,className:ae("w-full justify-between font-mono tabular-nums text-2xl h-14 px-4",!e&&"text-muted-foreground text-base font-sans",i),children:[e&&nP.test(e)?e:n,s.jsx(Vt,{className:"h-5 w-5 opacity-60"})]})}),s.jsxs(Lf,{className:"w-72 p-3 pointer-events-auto",align:"start",children:[s.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:T6e.map(y=>{const b=e===y;return s.jsx("button",{type:"button",onClick:()=>{t(y),o(!1)},className:ae("px-2.5 py-1 rounded-md text-xs font-mono tabular-nums border transition-colors",b?"bg-primary text-primary-foreground border-primary":"bg-background hover:bg-accent border-border"),children:y},y)})}),s.jsxs("div",{className:"flex gap-2 mb-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1 text-center",children:"Heures"}),s.jsx("div",{ref:u,className:"h-48 overflow-y-auto rounded-md border bg-muted/30 snap-y snap-mandatory",children:A6e.map(y=>{const b=y===l;return s.jsx("button",{type:"button","data-h":y,onClick:()=>p(y,c),className:ae("w-full h-10 snap-center font-mono tabular-nums text-lg transition-colors",b?"bg-primary/10 text-primary font-bold":"hover:bg-accent"),children:m_(y)},y)})})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1 text-center",children:"Minutes"}),s.jsx("div",{ref:d,className:"h-48 overflow-y-auto rounded-md border bg-muted/30 snap-y snap-mandatory",children:sB.map(y=>{const b=y===c;return s.jsx("button",{type:"button","data-m":y,onClick:()=>p(l,y),className:ae("w-full h-10 snap-center font-mono tabular-nums text-lg transition-colors",b?"bg-primary/10 text-primary font-bold":"hover:bg-accent"),children:m_(y)},y)})})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ue,{inputMode:"numeric",value:f,onChange:y=>x(y.target.value),placeholder:"HH:MM",className:"font-mono tabular-nums text-center h-9",maxLength:5}),s.jsx(Q,{type:"button",size:"sm",onClick:()=>o(!1),className:"h-9",children:"OK"})]})]})]})};function qM(e){return st({queryKey:["venues",e],queryFn:async()=>{let t=re.from("venues").select("*").order("created_at",{ascending:!1});e!=null&&e.activeOnly&&(t=t.eq("is_active",!0));const{data:n,error:r}=await t;if(r)throw r;return n}})}function D6e(e){return st({queryKey:["venue",e],queryFn:async()=>{const{data:t,error:n}=await re.from("venues").select("*").eq("id",e).single();if(n)throw n;return t},enabled:!!e})}function I6e(){return st({queryKey:["venues-manager-counts"],queryFn:async()=>{const{data:e,error:t}=await re.from("venue_users").select("venue_id, role");
1186if(t)throw t;const n={};for(const r of e??[])r.role==="manager"&&(n[r.venue_id]=(n[r.venue_id]??0)+1);return n},staleTime:6e4})}function Mie(e){return st({queryKey:["venue-staff",e],queryFn:async()=>{const{data:t,error:n}=await re.from("venue_users").select("id, role, created_at, user_id").eq("venue_id",e);if(n)throw n;if(!t||t.length===0)return[];const r=t.map(o=>o.user_id),{data:i,error:a}=await re.from("public_profiles").select("id, first_name, last_name, display_name").in("id",r);if(a)throw a;return t.map(o=>({...o,profile:(i==null?void 0:i.find(l=>l.id===o.user_id))||null}))},enabled:!!e})}function R6e(){const e=Ye(),{toast:t}=_r();return dt({mutationFn:async n=>{const{data:{user:r}}=await re.auth.getUser();if(!r)throw new Error("Non authentifié");const{data:i,error:a}=await re.from("venues").insert({...n,created_by:r.id}).select().single();if(a)throw a;return i},onSuccess:()=>{e.invalidateQueries({queryKey:["venues"]}),e.invalidateQueries({queryKey:["admin-stats"]}),t({title:"Lieu créé",description:"Le nouveau lieu a été ajouté avec succès."})},onError:n=>{t({title:"Erreur",description:n.message,variant:"destructive"})}})}function Lie(){const e=Ye(),{toast:t}=_r();return dt({mutationFn:async({id:n,...r})=>{const{data:i,error:a}=await re.from("venues").update(r).eq("id",n).select().single();if(a)throw a;return i},onSuccess:n=>{e.invalidateQueries({queryKey:["venues"]}),e.invalidateQueries({queryKey:["venue",n.id]}),e.invalidateQueries({queryKey:["admin-stats"]}),t({title:"Lieu mis à jour",description:"Les modifications ont été enregistrées."})},onError:n=>{t({title:"Erreur",description:n.message,variant:"destructive"})}})}function M6e(){const e=Ye(),{toast:t}=_r();return dt({mutationFn:async({id:n,isActive:r})=>{const{data:i,error:a}=await re.from("venues").update({is_active:r}).eq("id",n).select().single();if(a)throw a;return i},onSuccess:n=>{e.invalidateQueries({queryKey:["venues"]}),e.invalidateQueries({queryKey:["venue",n.id]}),e.invalidateQueries({queryKey:["admin-stats"]}),t({title:n.is_active?"Lieu activé":"Lieu désactivé",description:`${n.name} est maintenant ${n.is_active?"actif":"inactif"}.`})},onError:n=>{t({title:"Erreur",description:n.message,variant:"destructive"})}})}function L6e(){const e=Ye(),{toast:t}=_r();return dt({mutationFn:async n=>{const{error:r}=await re.from("venues").delete().eq("id",n);if(r)throw r},onSuccess:()=>{e.invalidateQueries({queryKey:["venues"]}),e.invalidateQueries({queryKey:["admin-stats"]}),t({title:"Lieu supprimé",description:"Le lieu et toutes ses données associées ont été supprimés."})},onError:n=>{t({title:"Erreur",description:n.message,variant:"destructive"})}})}function F6e(){return st({queryKey:["venues-without-gps-count"],queryFn:async()=>{const{count:e,error:t}=await re.from("venues").select("*",{count:"exact",head:!0}).is("latitude",null).eq("is_active",!0);if(t)throw t;return e||0}})}function $6e(){const e=Ye(),{toast:t}=_r();return dt({mutationFn:async()=>{const{data:n,error:r}=await re.functions.invoke("geocode-venues");if(r)throw r;return n},onSuccess:n=>{e.invalidateQueries({queryKey:["venues"]}),e.invalidateQueries({queryKey:["venues-without-gps-count"]}),e.invalidateQueries({queryKey:["events"]}),t({title:"Géocodage terminé",description:`${n.updated} lieu(x) mis à jour sur ${n.total}`})},onError:n=>{t({title:"Erreur de géocodage",description:n.message,variant:"destructive"})}})}async function Fie(e){const{data:t,error:n}=await re.functions.invoke("event-assist",{body:e});if(n){let r=n.message;if(n instanceof _x)try{const i=await n.context.json();r=(i==null?void 0:i.error)||r}catch{}throw/:402:/.test(r)?new Error("Crédits IA épuisés. Rédige manuellement ou recharge tes crédits."):/:429:/.test(r)?new Error("Trop de requêtes IA. Réessaie dans quelques secondes."):new Error(r)}return t}function B6e(){return dt({mutationFn:e=>Fie({action:"generate",...e})})}function z6e(){return dt({mutationFn:e=>Fie({action:"improve",...e})})}function iB(){return typeof window>"u"?null:window.SpeechRecognition||window.webkitSpeechRecognition||null}function U6e(e="fr-FR"){const[t,n]=N.useState(!1),[r,i]=N.useState(!1),[a,o]=N.useState(""),[l,c]=N.useState(null),u=N.useRef(null),d=N.useRef(null),f=N.useRef("");N.useEffect(()=>{n(!!iB())},[]);const h=N.useCallback(()=>{var x;try{(x=u.current)==null||x.stop()}catch{}},[]),p=N.useCallback(x=>{const y=iB();if(!y){c("Dictée vocale non supportée sur ce navigateur.");return}c(null);const b=new y;b.lang=e,b.continuous=!0,b.interimResults=!0,f.current=x.initialText?x.initialText.trim()+(x.initialText.trim()?" ":""):"",d.current=x.onFinal;let w="";b.onresult=_=>{var S;let j="";for(let T=_.resultIndex;T<_.results.length;T++){const P=_.results[T];P.isFinal?w+=P[0].transcript+" ":j+=P[0].transcript}o(j);const E=(f.current+w+j).trim();(S=d.current)==null||S.call(d,E)},b.onerror=_=>{c((_==null?void 0:_.error)??"Erreur dictée"),i(!1)},b.onend=()=>{var j;i(!1),o("");const _=(f.current+w).trim();_&&((j=d.current)==null||j.call(d,_))},b.start(),u.current=b,i(!0)},[e]);return N.useEffect(()=>()=>{var x,y;try{(y=(x=u.current)==null?void 0:x.abort)==null||y.call(x)}catch{}},[]),{supported:t,listening:r,interim:a,error:l,start:p,stop:h}}function q6e({venueId:e,onApply:t,currentTitle:n,currentDescription:r}){const[i,a]=N.useState(""),[o,l]=N.useState("convivial"),c=B6e(),u=U6e("fr-FR"),d=!!(n&&r),f=async()=>
1186{if(i.trim().length<3){je.error("Décris ton tournoi en quelques mots d'abord.");return}try{const p=await c.mutateAsync({context:i.trim(),tone:o,venue_id:e??null});t(p),je.success("Titre et description générés ✨")}catch(p){je.error((p==null?void 0:p.message)||"Génération échouée")}},h=()=>{if(u.listening){u.stop();return}u.start({initialText:i,onFinal:p=>a(p)})};return s.jsxs("div",{className:"rounded-lg border border-primary/30 bg-primary/5 p-3 space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[s.jsx(Ti,{className:"h-4 w-4 text-primary"}),"Assistant IA — titre & description"]}),s.jsxs(li,{value:o,onValueChange:p=>l(p),children:[s.jsx(Gs,{className:"h-7 w-32 text-xs",children:s.jsx(ci,{})}),s.jsxs(Ks,{children:[s.jsx(Yn,{value:"convivial",children:"Convivial"}),s.jsx(Yn,{value:"serieux",children:"Sérieux"}),s.jsx(Yn,{value:"fun",children:"Fun"})]})]})]}),s.jsx($s,{value:i,onChange:p=>a(p.target.value),placeholder:"Ex: blitz 5+2 mardi soir, 20 places, ambiance décontractée, débutants bienvenus",rows:2,className:"text-sm resize-none"}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(Xk,{children:s.jsxs(Qk,{children:[s.jsx(Jk,{asChild:!0,children:s.jsx("span",{children:s.jsxs(Q,{type:"button",size:"sm",variant:u.listening?"destructive":"outline",onClick:h,disabled:!u.supported,className:"h-8",children:[u.listening?s.jsx(fxe,{className:"h-3.5 w-3.5 mr-1"}):s.jsx(hxe,{className:"h-3.5 w-3.5 mr-1"}),u.listening?"Stop":"Dicter"]})})}),!u.supported&&s.jsx(Pb,{children:"Non supporté sur ce navigateur — tape directement."})]})}),s.jsxs(Q,{type:"button",size:"sm",onClick:f,disabled:c.isPending||i.trim().length<3,className:"h-8",children:[c.isPending?s.jsx(We,{className:"h-3.5 w-3.5 mr-1 animate-spin"}):s.jsx(Exe,{className:"h-3.5 w-3.5 mr-1"}),d?"Régénérer":"Générer titre + description"]}),u.listening&&s.jsx(we,{variant:"secondary",className:"animate-pulse text-xs",children:"Écoute…"}),u.error&&!u.listening&&s.jsx("span",{className:"text-xs text-destructive",children:u.error})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"L'IA s'inspire du style des meilleures descriptions du site. Elle n'invente jamais prix / date / capacité — remplis-les toi-même en dessous."})]})}function V6e({disabled:e,loading:t,onImprove:n}){return s.jsx("div",{className:"flex flex-wrap gap-1.5",children:["polish","shorter","longer"].map(r=>s.jsxs(Q,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-xs",disabled:e||t,onClick:()=>n(r),children:[t?s.jsx(We,{className:"h-3 w-3 mr-1 animate-spin"}):s.jsx(Ti,{className:"h-3 w-3 mr-1"}),r==="polish"?"Améliorer":r==="shorter"?"Plus court":"Plus long"]},r))})}function aB({className:e}){return s.jsxs(we,{variant:"secondary",className:ae("text-[10px] gap-1",e),children:[s.jsx(Ti,{className:"h-2.5 w-2.5"})," IA"]})}function H6e(e,t,n,r){const i=[];let a=e;t!=="once"&&r!==void 0&&(a=iC(e,r,{weekStartsOn:1}),a<e&&(a=Vg(a,1)));for(let o=0;o<n;o++)switch(i.push(a),t){case"weekly":a=Vg(a,1);break;case"biweekly":a=Vg(a,2);break;case"monthly":a=bo(a,1);break}return i}function sw({open:e,onOpenChange:t,event:n,preselectedVenueId:r,venueName:i}){var Z;const a=!!n,o=!!r,{data:l=[]}=qM({activeOnly:!0}),c=USe(),u=qSe(),{isAdmin:d}=Tt(),f=d,[h,p]=N.useState(a?(n==null?void 0:n.price_cents)===0:!1),{data:x=0}=st({queryKey:["event-rounds-count",n==null?void 0:n.id],queryFn:async()=>{if(!(n!=null&&n.id))return 0;const{count:G,error:se}=await re.from("rounds").select("id",{count:"exact",head:!0}).eq("event_id",n.id);return se?0:G||0},enabled:a&&e,staleTime:3e4}),y=a&&x>0,b={venue_id:r||"",title:"",description:"",recurrence_type:"once",day_of_week:2,start_time:"20:00",first_date:Ze(ai(new Date,7),"yyyy-MM-dd"),occurrences_count:4,capacity:16,min_players:rm,price_euros:EA,credit_euros:SA,format:"swiss",time_control_preset:"blitz-7",rounds_count:5,rules:"",tiebreak_criteria:[...Wh],pairing_engine:"internal",coupon_mode:"inherit",paper_coupon_label:"",paper_coupon_description:"",paper_coupon_formulas:[]}
1186,w=n?{venue_id:n.venue_id,title:n.title,description:n.description||"",recurrence_type:"once",day_of_week:new Date(n.event_date).getDay(),start_time:Ze(new Date(n.event_date),"HH:mm"),first_date:Ze(new Date(n.event_date),"yyyy-MM-dd"),occurrences_count:1,capacity:n.capacity,min_players:Math.max(rm,n.min_players||rm),price_euros:n.price_cents/100,credit_euros:n.credit_amount_cents/100,format:"swiss",time_control_preset:gee((Z=vj.find(G=>G.timeControl===n.time_control))==null?void 0:Z.value),rounds_count:n.rounds_count||4,rules:n.rules||"",tiebreak_criteria:n.tiebreak_criteria&&Array.isArray(n.tiebreak_criteria)?n.tiebreak_criteria:[...Wh],pairing_engine:(()=>{const G=n.pairing_engine;return G==="javafo_api"||G==="none"||G==="internal"?G:"internal"})(),coupon_mode:(()=>{const G=n.coupon_mode;return G==="digital"||G==="paper"?G:"inherit"})(),paper_coupon_label:n.paper_coupon_label||"",paper_coupon_description:n.paper_coupon_description||"",paper_coupon_formulas:(()=>{const G=n.paper_coupon_formulas;return Array.isArray(G)?G.filter(se=>se&&typeof se=="object"&&typeof se.name=="string"&&se.name.trim()).map(se=>({name:String(se.name).trim(),description:typeof se.description=="string"?se.description:""})):[]})()}:void 0,_=Zm({resolver:ep(O3e),defaultValues:a?w:b});N.useEffect(()=>{e&&_.reset(a?w:b)},[e,n==null?void 0:n.id]);const j=_.watch(),E=j.recurrence_type,S=E!=="once",[T,P]=N.useState({title:!1,description:!1}),O=z6e(),D=G=>{_.setValue("title",G.title,{shouldDirty:!0,shouldValidate:!0}),_.setValue("description",G.description,{shouldDirty:!0,shouldValidate:!0}),P({title:!0,description:!0})},R=async G=>{const se=_.getValues("description")||"";if(se.trim().length<20){je.error("Écris au moins une ébauche avant de demander à l'IA d'améliorer.");return}try{const ce=await O.mutateAsync({current_description:se,tone:"convivial",mode:G});_.setValue("description",ce.description,{shouldDirty:!0,shouldValidate:!0}),P(le=>({...le,description:!0})),je.success("Description mise à jour ✨")}catch(ce){je.error((ce==null?void 0:ce.message)||"Amélioration échouée")}},L=N.useMemo(()=>{if(!j.first_date)return[];try{const G=pA(j.first_date,"yyyy-MM-dd",new Date),se=S&&j.occurrences_count||1;return H6e(G,E,se,j.day_of_week)}catch{return[]}},[j.first_date,E,j.occurrences_count,j.day_of_week]),B=pee(j.time_control_preset),U=N.useMemo(()=>Math.max(rm,j.rounds_count+1),[j.rounds_count]);N.useEffect(()=>{a||_.setValue("rounds_count",B)},[j.format,j.capacity,j.time_control_preset,a]),N.useEffect(()=>{a||_.setValue("min_players",U)},[U,a]);const F=async G=>{const se=vj.find(Te=>Te.value===G.time_control_preset),ce=l.find(Te=>Te.id===G.venue_id),le=(ce==null?void 0:ce.default_coupon_mode)==="paper"?"paper":"digital",be=(G.coupon_mode==="inherit"?le:G.coupon_mode)==="paper",_e=(G.paper_coupon_formulas||[]).map(Te=>{var Ge;return{name:((Ge=Te.name)==null?void 0:Ge.trim())||"",description:(Te.description||"").trim()}}).filter(Te=>Te.name),pe=be?{paper_coupon_label:(G.paper_coupon_label||"").trim()||null,paper_coupon_description:(G.paper_coupon_description||"").trim()||null,paper_coupon_formulas:_e.length?_e:null}:{paper_coupon_label:null,paper_coupon_description:null,paper_coupon_formulas:null};if(a&&n){const Te=new Date(`${G.first_date}T${G.start_time}:00`),Ge=new Date(Te.getTime()-2*60*60*1e3);await u.mutateAsync({id:n.id,venue_id:G.venue_id,title:G.title,description:G.description||null,event_date:Te.toISOString(),registration_deadline:Ge.toISOString(),capacity:G.capacity,min_players:G.min_players,price_cents:Math.round(G.price_euros*100),credit_amount_cents:Math.round(G.credit_euros*100),format:G.format,time_control:(se==null?void 0:se.timeControl)||"10+0",rounds_count:G.rounds_count,rules:G.rules||null,tiebreak_criteria:G.tiebreak_criteria,pairing_engine:G.pairing_engine,coupon_mode:G.coupon_mode==="inherit"?null:G.coupon_mode,...pe})}else await c.mutateAsync({baseEvent:{venue_id:G.venue_id,title:G.title,description:G.description||null,capacity:G.capacity,min_players:G.min_players,price_cents:Math.round(G.price_euros*100),credit_amount_cents:Math.round(G.credit_euros*100),format:G.format,time_control:(se==null?void 0:se.timeControl)||"10+0",rounds_count:G.rounds_count,rules:G.rules||null,tiebreak_criteria:G.tiebreak_criteria,pairing_engine:G.pairing_engine,coupon_mode:G.coupon_mode==="inherit"?null:G.coupon_mode,...pe}
1186,dates:L,startTime:G.start_time});W.current=!0,t(!1),_.reset()},H=c.isPending||u.isPending,z=j.price_euros-j.credit_euros,K=_.formState.isDirty,W=N.useRef(!1),[q,oe]=N.useState(!1);N.useEffect(()=>{e&&(W.current=!1)},[e]),N.useEffect(()=>{if(!e||!K)return;const G=se=>{se.preventDefault(),se.returnValue=""};return window.addEventListener("beforeunload",G),()=>window.removeEventListener("beforeunload",G)},[e,K]);const J=()=>{if(!H){if(K&&!W.current){oe(!0);return}t(!1),_.reset()}},Y=()=>{W.current=!0,oe(!1),t(!1),_.reset()};return s.jsxs(s.Fragment,{children:[s.jsx(Ln,{open:e,onOpenChange:G=>{if(G){t(!0);return}J()},children:s.jsxs(Dn,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",onPointerDownOutside:G=>{K&&!W.current&&G.preventDefault()},onEscapeKeyDown:G=>{K&&!W.current&&G.preventDefault()},children:[s.jsx(Un,{children:s.jsx(qn,{className:"font-display text-xl",children:a?"Modifier l'événement":"Créer un tournoi"})}),s.jsx(IM,{..._,children:s.jsxs("form",{onSubmit:_.handleSubmit(F),className:"space-y-8",children:[s.jsxs("section",{className:"space-y-4",children:[s.jsx("h3",{className:"font-medium text-sm text-muted-foreground uppercase tracking-wider",children:"Informations générales"}),o?s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{className:"text-sm font-medium",children:"Lieu"}),s.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted/50 rounded-md border",children:[s.jsx("span",{className:"font-medium text-foreground",children:i||"Votre établissement"}),s.jsx(we,{variant:"secondary",className:"text-xs",children:"Votre lieu"})]}),s.jsx("input",{type:"hidden",..._.register("venue_id"),value:r})]}):s.jsx(Nr,{control:_.control,name:"venue_id",render:({field:G})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Lieu *"}),s.jsxs(li,{onValueChange:G.onChange,value:G.value,children:[s.jsx(kr,{children:s.jsx(Gs,{children:s.jsx(ci,{placeholder:"Sélectionner un lieu"})})}),s.jsx(Ks,{children:l.map(se=>s.jsxs(Yn,{value:se.id,children:[se.name," - ",se.city]},se.id))})]}),s.jsx(xr,{})]})}),!a&&s.jsx(q6e,{venueId:j.venue_id||r||null,onApply:D,currentTitle:j.title,currentDescription:j.description}),s.jsx(Nr,{control:_.control,name:"title",render:({field:G})=>s.jsxs(pr,{children:[s.jsxs(gr,{className:"flex items-center gap-2",children:["Titre *",T.title&&s.jsx(aB,{})]}),s.jsx(kr,{children:s.jsx(Ue,{placeholder:"Ex: Tournoi du Mardi Soir",...G,onChange:se=>{G.onChange(se),T.title&&P(ce=>({...ce,title:!1}))}})}),s.jsx(xr,{})]})}),s.jsx(Nr,{control:_.control,name:"description",render:({field:G})=>{const se=(G.value??"").length,ce=se>5e3;return s.jsxs(pr,{children:[s.jsxs(gr,{className:"flex items-center gap-2",children:["Description",T.description&&s.jsx(aB,{})]}),s.jsx(kr,{children:s.jsx($s,{placeholder:"Décrivez l'événement...",rows:6,className:"min-h-[160px]",...G,onChange:le=>{G.onChange(le),T.description&&P(fe=>({...fe,description:!1}))}})}),s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx(V6e,{disabled:(G.value??"").trim().length<20,loading:O.isPending,onImprove:R}),s.jsxs("div",{className:`text-xs ${ce?"text-destructive":"text-muted-foreground"}`,children:[se," / 5000"]})]}),s.jsx(xr,{})]})}})]}),s.jsxs("section",{className:"space-y-4",children:[s.jsx("h3",{className:"font-medium text-sm text-muted-foreground uppercase tracking-wider",children:"📅 Planification"}),!a&&s.jsx(Nr,{control:_.control,name:"recurrence_type",render:({field:G})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Fréquence"}),s.jsx(kr,{children:s.jsx(ud,{onValueChange:G.onChange,value:G.value,className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:QSe.map(se=>s.jsxs("div",{children:[s.jsx(ui,{value:se.value,id:`recurrence-${se.value}`,className:"peer sr-only"}),s.jsxs(Fe,{htmlFor:`recurrence-${se.value}`,className:ae("flex flex-col items-center justify-center rounded-lg border-2 border-muted bg-popover p-3 cursor-pointer transition-all","hover:bg-accent hover:text-accent-foreground","peer-data-[state=checked]:border-primary peer-data-[state=checked]:bg-primary/5"),children:[s.jsx("span",{className:"font-medium text-sm",children:se.label}),s.jsx("span",{className:"text-xs text-muted-foreground",children:se.description})]})]},se.value))})}),s.jsx(xr,{})]})}),s.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[S&&!a&&s.jsx(Nr,{control:_.control,name:"day_of_week",render:({field:G})=>{var se;return s.jsxs(pr,{children:[s.jsx(gr,{children:"Jour de la semaine *"}),s.jsxs(li,{onValueChange:ce=>G.onChange(parseInt(ce)),value:(se=G.value)==null?void 0:se.toString(),children:[s.jsx(kr,{children:s.jsx(Gs,{children:s.jsx(ci,{placeholder:"Choisir un jour"})})}),s.jsx(Ks,{children:XSe.map(ce=>s.jsx(Yn,{value:ce.value.toString(),children:ce.label},ce.value))})]}),s.jsx(xr,{})]})}}),s.jsx(Nr,{control:_.control,name:"start_time",render:({field:G})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Heure de début *"}),s.jsx(kr,{children:s.jsx(O6e,{value:G.value,onChange:G.onChange})}),s.jsx(xr,{})]})})]}),s.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[s.jsx(Nr,{control:_.control,name:"first_date",render:({field:G})=>s.jsxs(pr,{children:[s.jsx(gr,{children:S?"À partir du *":"Date *"}),s.jsxs(Vm,{children:[s.jsx(Hm,{asChild:!0,children:s.jsx(kr,{children:s.jsxs(Q,{variant:"outline",className:ae("w-full pl-3 text-left font-normal",!G.value&&"text-muted-foreground"),children:[G.value?Ze(pA(G.value,"yyyy-MM-dd",new Date),"PPP",{locale:pt}):s.jsx("span",{children:"Choisir une date"}),s.jsx(Jn,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),s.jsx(Lf,{className:"w-auto p-0",align:"start",children:s.jsx(K2,{mode:"single",selected:G.value?pA(G.value,"yyyy-MM-dd",new Date):void 0,onSelect:se=>se&&G.onChange(Ze(se,"yyyy-MM-dd")),disabled:se=>se<new Date,initialFocus:!0})})]}),s.jsx(xr,{})]})}),S&&!a&&s.jsx(Nr,{control:_.control,name:"occurrences_count",render:({field:G})=>{var se;return s.jsxs(pr,{children:[s.jsx(gr,{children:"Nombre d'événements *"}),s.jsxs(li,{onValueChange:ce=>G.onChange(parseInt(ce)),value:(se=G.value)==null?void 0:se.toString(),children:[s.jsx(kr,{children:s.jsx(Gs,{children:s.jsx(ci,{placeholder:"Nombre"})})}),s.jsx(Ks,{children:[1,2,3,4,5,6,8,10,12].map(ce=>s.jsxs(Yn,{value:ce.toString(),children:[ce," événement",ce>1?"s":""]},ce))})]}),s.jsx(xr,{})]})}})]}),L.length>0&&!a&&s.jsxs("div",{className:"rounded-lg bg-muted/50 p-3 space-y-2",children:[s.jsxs("p",{className:"text-sm font-medium flex items-center gap-2",children:[s.jsx(wl,{className:"h-4 w-4"}),L.length," événement",L.length>
11861?"s":""," sera créé :"]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[L.slice(0,6).map((G,se)=>s.jsx(we,{variant:"secondary",className:"text-xs",children:Ze(G,"EEE d MMM",{locale:pt})},se)),L.length>6&&s.jsxs(we,{variant:"outline",className:"text-xs",children:["+",L.length-6," autres"]})]})]})]}),s.jsxs("section",{className:"space-y-4",children:[s.jsx("h3",{className:"font-medium text-sm text-muted-foreground uppercase tracking-wider",children:"👥 Capacité"}),s.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[s.jsx(Nr,{control:_.control,name:"capacity",render:({field:G})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Places disponibles *"}),s.jsx(kr,{children:s.jsx(Ue,{type:"number",inputMode:"numeric",pattern:"[0-9]*",min:4,max:100,...G,value:G.value??"",onChange:se=>{const ce=se.target.value;G.onChange(ce===""?void 0:Number.parseInt(ce,10))},onBlur:se=>{const ce=Number.parseInt(se.target.value,10);Number.isNaN(ce)&&G.onChange(16)}})}),s.jsx(Iu,{children:"Nombre maximum de joueurs"}),s.jsx(xr,{})]})}),s.jsx(Nr,{control:_.control,name:"min_players",render:({field:G})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Joueurs minimum *"}),s.jsx(kr,{children:s.jsx(Ue,{type:"number",inputMode:"numeric",pattern:"[0-9]*",min:6,max:50,...G,value:G.value??"",onChange:se=>{const ce=se.target.value;G.onChange(ce===""?void 0:Number.parseInt(ce,10))},onBlur:se=>{const ce=Number.parseInt(se.target.value,10);Number.isNaN(ce)&&G.onChange(U)}})}),s.jsxs("div",{className:ae("rounded-xl p-3 text-xs space-y-1.5","bg-card/80 backdrop-blur-sm border shadow-sm",G.value>=U?"border-primary/30":"border-destructive/50 bg-destructive/10"),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(wl,{className:"w-3.5 h-3.5 shrink-0 text-primary"}),s.jsxs("span",{className:"font-medium",children:["Minimum requis : ",s.jsx("strong",{className:"text-primary",children:U})," joueurs"]})]}),s.jsxs("div",{className:"text-muted-foreground pl-5.5 space-y-0.5",children:[s.jsxs("p",{children:["• Plancher absolu : ",s.jsx("strong",{children:"6"})," joueurs"]}),s.jsxs("p",{children:["• Rondes (",j.rounds_count,") + 1 = ",s.jsx("strong",{children:j.rounds_count+1})," joueurs"]})]}),G.value>U&&s.jsxs(we,{variant:"secondary",className:"mt-1.5 text-xs font-normal",children:["+",G.value-U," au-dessus du minimum"]})]}),s.jsx(xr,{})]})})]})]}),s.jsxs("section",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h3",{className:"font-medium text-sm text-muted-foreground uppercase tracking-wider",children:"💰 Tarification"}),f&&s.jsxs(we,{variant:"outline",className:"text-xs gap-1 border-primary/30 text-primary",children:[s.jsx(uI,{className:"w-3 h-3"}),"Mode admin"]})]}),f&&s.jsxs("div",{className:"relative rounded-xl border border-amber-500/30 bg-gradient-to-br from-amber-500/10 to-transparent p-4 backdrop-blur-sm",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-500/20 flex items-center justify-center",children:s.jsx(vx,{className:"w-5 h-5 text-amber-500"})}),s.jsxs("div",{children:[s.jsx(Fe,{htmlFor:"isFreeEvent",className:"font-medium cursor-pointer",children:"Événement gratuit"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Tests, événements spéciaux, promos..."})]})]}),s.jsx(R0,{id:"isFreeEvent",checked:h,onCheckedChange:G=>{p(G),G?(_.setValue("price_euros",0),_.setValue("credit_euros",0)):a||(_.setValue("price_euros",EA),_.setValue("credit_euros",SA))}})]}),h&&s.jsxs("p",{className:"mt-3 text-xs text-amber-600 dark:text-amber-400 flex items-center gap-2",children:[s.jsx(ur,{className:"w-3.5 h-3.5"}),"Aucun paiement Stripe ne sera requis pour cet événement."]})]}),f?s.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[s.jsx(Nr,{control:_.control,name:"price_euros",render:({field:G})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Prix du ticket *"}),s.jsx(kr,{children:s.jsxs("div",{className:"relative",children:[s.jsx(Ue,{type:"number",min:0,max:100,step:.5,className:"pr-8",disabled:h,...G,onChange:se=>G.onChange(parseFloat(se.target.value)||0)}),s.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"€"})]})}),s.jsx(xr,{})]})}),s.jsx(Nr,{control:_.control,name:"credit_euros",render:({field:G})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Crédit bar inclus *"}),s.jsx(kr,{children:s.jsxs("div",{className:"relative",children:[s.jsx(Ue,{type:"number",min:0,max:50,step:.5,className:"pr-8",disabled:h,...G,onChange:se=>G.onChange(parseFloat(se.target.value)||0)}),s.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"€"})]})}),s.jsx(xr,{})]})})]}):s.jsx("div",{className:ae("rounded-xl p-4","bg-gradient-to-br from-primary/5 via-card to-card","border border-primary/20 backdrop-blur-sm"),children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-primary/10 shrink-0",children:s.jsx(yo,{className:"w-4 h-4 text-primary"})}),s.jsxs("div",{className:"flex-1 space-y-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-foreground",children:"Tarification standard"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Ces montants sont fixés par la plateforme pour garantir une expérience cohérente."})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"rounded-lg bg-background/60 border border-border/50 p-3 text-center",children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Prix ticket"}),s.jsxs("p",{className:"text-xl font-bold text-foreground",children:[EA,s.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"€"})]})]}),s.jsxs("div",{className:"rounded-lg bg-background/60 border border-border/50 p-3 text-center",children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Crédit bar"}),s.jsxs("p",{className:"text-xl font-bold text-primary",children:[SA,s.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"€"})]})]})]})]})]})}),s.jsxs("div",{className:"rounded-lg bg-muted/50 p-3 text-sm space-y-1",children:[s.jsxs("p",{className:"text-muted-foreground",children:["Le joueur paie ",s.jsxs("strong",{className:"text-foreground",children:[j.price_euros,"€"]}),", dont ",s.jsxs("strong",{className:"text-foreground",children:[j.credit_euros,"€"]})," de crédit consommation utilisable au bar."]}),d&&z>0&&s.jsxs("p",{className:"text-muted-foreground",children:["Marge plateforme : ",s.jsxs("strong",{className:"text-foreground",children:[z.toFixed(2),"€"]})," par participant."]})]}),(()=>{const G=l.find(le=>le.id===j.venue_id),ce=((G==null?void 0:G.default_coupon_mode)==="paper"?"paper":"digital")==="paper"?"Hériter du lieu (Coupon papier)":"Hériter du lieu (Crédit digital)";return s.jsx(Nr,{control:_.control,name:"coupon_mode",render:({field:le})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Mode coupon"}),s.jsxs(li,{onValueChange:le.onChange,value:le.value||"inherit",children:[s.jsx(kr,{children:s.jsx(Gs,{children:s.jsx(ci,{})})}),s.jsxs(Ks,{children:[s.jsx(Yn,{value:"inherit",children:ce}),s.jsx(Yn,{value:"digital",children:"Crédit digital (suivi in-app)"}),s.jsx(Yn,{value:"paper",children:"Coupon papier (remis au check-in)"})]})]}),s.jsxs(Iu,{children:["En mode ",s.jsx("strong",{children:"papier"}),", un coupon physique est remis au check-in. Le suivi conso in-app est masqué côté joueur. Modifiable à tout moment."]}),s.jsx(xr,{})]})})})(),(()=>{const G=l.find(Ne=>Ne.id===j.venue_id),se=(G==null?void 0:G.default_coupon_mode)==="paper"?"paper":"digital";if((j.coupon_mode==="inherit"?se:j.coupon_mode)!=="paper")return null;const le=j.paper_coupon_formulas||[],fe=Ne=>_.setValue("paper_coupon_formulas",Ne,{shouldDirty:!0}),be=()=>fe([...le,{name:"",description:""}]),_e=Ne=>fe(le.filter((it,qe)=>qe!==Ne)),pe=(Ne,it,qe)=>fe(le.map((Qe,ot)=>ot===Ne?{...Qe,[it]:qe}:Qe)),Te=()=>{const Ne=G;if(!Ne)return;_.setValue("paper_coupon_label",Ne.default_paper_coupon_label||"",{shouldDirty:!0}),_.setValue("paper_coupon_description",Ne.default_paper_coupon_description||"",{shouldDirty:!0});const it=Array.isArray(Ne.default_paper_coupon_formulas)?Ne.default_paper_coupon_formulas:[];fe(it.filter(qe=>qe&&typeof qe.name=="string"&&qe.name.trim()).map(qe=>
1186({name:String(qe.name).trim(),description:typeof qe.description=="string"?qe.description:""})))},Ge=(G==null?void 0:G.default_paper_coupon_label)||(G==null?void 0:G.default_paper_coupon_description)||Array.isArray(G==null?void 0:G.default_paper_coupon_formulas)&&G.default_paper_coupon_formulas.length;return s.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-semibold",children:"🎟️ Contenu du coupon papier (optionnel)"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Affiché au joueur sur son ticket et à l'équipe au check-in. Laissez vide pour un affichage générique."})]}),Ge?s.jsx(Q,{type:"button",variant:"outline",size:"sm",onClick:Te,children:"Pré-remplir depuis le lieu"}):null]}),s.jsx(Nr,{control:_.control,name:"paper_coupon_label",render:({field:Ne})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Intitulé"}),s.jsx(kr,{children:s.jsx(Ue,{placeholder:'Ex: "Formule Apéro" ou "Coupon 10€"',...Ne,value:Ne.value||""})}),s.jsx(xr,{})]})}),s.jsx(Nr,{control:_.control,name:"paper_coupon_description",render:({field:Ne})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Description libre"}),s.jsx(kr,{children:s.jsx($s,{rows:2,placeholder:"Ex: 1 bière 25cl + 1 planche apéro",...Ne,value:Ne.value||""})}),s.jsx(xr,{})]})}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Fe,{className:"text-sm",children:"Formules au choix (optionnel)"}),le.length<6&&s.jsx(Q,{type:"button",variant:"outline",size:"sm",onClick:be,children:"+ Ajouter une formule"})]}),le.length===0?s.jsx("p",{className:"text-xs text-muted-foreground",children:'Ajoutez plusieurs formules pour proposer un choix sur place (ex: "2 boissons" / "1 boisson + 1 plat").'}):s.jsx("div",{className:"space-y-2",children:le.map((Ne,it)=>s.jsxs("div",{className:"rounded-md border bg-card p-3 space-y-2",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Ue,{placeholder:"Nom de la formule",value:Ne.name,onChange:qe=>pe(it,"name",qe.target.value)}),s.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>_e(it),children:"Supprimer"})]}),s.jsx(Ue,{placeholder:"Description (ex: 1 bière 25cl + 1 planche)",value:Ne.description||"",onChange:qe=>pe(it,"description",qe.target.value)})]},it))})]})]})})()]}),s.jsxs("section",{className:"space-y-4",children:[s.jsx("h3",{className:"font-medium text-sm text-muted-foreground uppercase tracking-wider",children:"🏆 Format du tournoi"}),s.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-primary/5 p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-2xl",children:"🏆"}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-semibold",children:"Système Suisse"}),s.jsx(we,{variant:"default",className:"text-xs",children:"Format unique"})]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Chaque joueur fait plusieurs parties contre des adversaires de niveau similaire."})]})]})}),s.jsx("input",{type:"hidden",..._.register("format"),value:"swiss"}),s.jsx(Nr,{control:_.control,name:"time_control_preset",render:({field:G})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Cadence des parties *"}),s.jsx(kr,{children:s.jsx(ud,{onValueChange:G.onChange,value:G.value,className:"grid grid-cols-3 gap-2 sm:gap-3",children:vj.map(se=>s.jsxs("div",{className:"relative",children:[s.jsx(ui,{value:se.value,id:`time-${se.value}`,className:"peer sr-only"}),s.jsxs(Fe,{htmlFor:`time-${se.value}`,className:ae("flex flex-col items-center justify-center rounded-xl border-2 border-muted","bg-card/50 backdrop-blur-sm p-3 sm:p-4 cursor-pointer transition-all","hover:bg-accent/50 hover:border-accent","peer-data-[state=checked]:border-primary peer-data-[state=checked]:bg-primary/10","peer-data-[state=checked]:shadow-[0_0_12px_hsl(var(--primary)/0.3)]"),children:[s.jsx("span",{className:"text-2xl mb-1",children:se.icon}),s.jsx("span",{className:"font-semibold text-sm",children:se.label}),s.jsx("span",{className:"text-xs font-mono text-primary",children:se.sublabel}),s.jsx("span",{className:"text-[10px] text-muted-foreground mt-1",children:se.durationHint})]}),"recommended"in se&&se.recommended&&s.jsx("span",{className:"absolute -top-1.5 -right-1.5 text-xs",children:"⭐"})]},se.value))})}),s.jsxs(Iu,{className:"flex items-start gap-2 mt-2",children:[s.jsx(wl,{className:"w-4 h-4 mt-0.5 shrink-0 text-muted-foreground"}),s.jsx("span",{children:"L'incrément (+2 sec) ajoute du temps à chaque coup, rassurant pour les débutants."})]}),s.jsx(xr,{})]})}),s.jsx(Nr,{control:_.control,name:"rounds_count",render:({field:G})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Nombre de rondes"}),s.jsx(kr,{children:s.jsx(Ue,{type:"number",inputMode:"numeric",pattern:"[0-9]*",min:3,max:15,...G,value:G.value??"",onChange:se=>{const ce=se.target.value;G.onChange(ce===""?void 0:Number.parseInt(ce,10))},onBlur:se=>{const ce=Number.parseInt(se.target.value,10);Number.isNaN(ce)&&G.onChange(B)}})}),s.jsxs(Iu,{className:"flex items-start gap-2",children:[s.jsx(axe,{className:"w-4 h-4 mt-0.5 shrink-0 text-amber-500"}),s.jsxs("span",{children:[B," rondes recommandées pour ~2h de tournoi"]})]}),s.jsx(xr,{})]})}),d&&s.jsx(Nr,{control:_.control,name:"tiebreak_criteria",render:({field:G})=>{const se=G.value||[...Wh],ce=JSON.stringify(se)===JSON.stringify(Wh),le=be=>{if(be===0)return;const _e=[...se];[_e[be-1],_e[be]]=[_e[be],_e[be-1]],G.onChange(_e)},fe=be=>{if(be===se.length-1)return;const _e=[...se];[_e[be],_e[be+1]]=[_e[be+1],_e[be]],G.onChange(_e)};return s.jsxs(pr,{children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(gr,{children:"Critères de départage"}),ce&&s.jsxs(we,{variant:"secondary",className:"text-[10px] gap-1",children:[s.jsx(is,{className:"w-3 h-3"}),"Ordre FIDE"]})]}),s.jsx("div",{className:"space-y-1.5",children:se.map((be,_e)=>{const pe=j1.find(Te=>Te.value===be);return s.jsxs("div",{className:ae("flex items-center gap-2 rounded-lg border px-3 py-2","bg-card/80 backdrop-blur-sm",_e===0&&"border-primary/30 bg-primary/5"),children:[s.jsx("span",{className:"text-[10px] font-mono text-muted-foreground w-4 text-center",children:_e+1}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:(pe==null?void 0:pe.label)||be}),s.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:pe==null?void 0:pe.description})]}),s.jsxs("div",{className:"flex gap-0.5",children:[s.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",disabled:_e===0,onClick:()=>le(_e),children:s.jsx(zY,{className:"h-3.5 w-3.5"})}),s.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",disabled:_e===se.length-1,onClick:()=>fe(_e),children:s.jsx(BY,{className:"h-3.5 w-3.5"})})]})]},be)}
1186)}),!ce&&s.jsx(Q,{type:"button",variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:()=>G.onChange([...Wh]),children:"Réinitialiser l'ordre FIDE"}),s.jsx(xr,{})]})}}),d&&s.jsx(Nr,{control:_.control,name:"pairing_engine",render:({field:G})=>s.jsxs(pr,{children:[s.jsxs(gr,{className:"flex items-center gap-2",children:["Moteur d'appariement",s.jsx(we,{variant:"secondary",className:"text-[10px]",children:"Admin"}),y&&s.jsxs(we,{variant:"outline",className:"text-[10px] gap-1",children:[s.jsx(yo,{className:"w-3 h-3"})," Verrouillé"]})]}),s.jsxs(li,{onValueChange:G.onChange,value:G.value||"none",disabled:y,children:[s.jsx(kr,{children:s.jsx(Gs,{children:s.jsx(ci,{})})}),s.jsxs(Ks,{children:[s.jsx(Yn,{value:"none",children:"Manuel (sans appariement automatique) — défaut"}),s.jsx(Yn,{value:"internal",children:"Interne (FIDE Dutch / Chess Agenda)"}),s.jsx(Yn,{value:"javafo_api",children:"JaVaFo (API externe OpenPairing)"})]})]}),s.jsxs(Iu,{className:"flex items-start gap-2",children:[s.jsx(wl,{className:"w-4 h-4 mt-0.5 shrink-0 text-muted-foreground"}),s.jsx("span",{children:y?"Le moteur ne peut plus être modifié : des rondes ont déjà été créées.":"Manuel : vous créez les appariements à la main. Interne : moteur FIDE Dutch natif. JaVaFo : API externe OpenPairing."})]}),s.jsx(xr,{})]})}),s.jsx(Nr,{control:_.control,name:"rules",render:({field:G})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Règles spécifiques"}),s.jsx(kr,{children:s.jsx($s,{placeholder:"Règles additionnelles du tournoi (optionnel)...",rows:3,...G})}),s.jsx(xr,{})]})})]}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[s.jsx(Q,{type:"button",variant:"outline",onClick:J,children:"Annuler"}),s.jsx(Q,{type:"submit",disabled:H,children:H?"Enregistrement...":a?"Enregistrer":L.length>1?`Créer ${L.length} événements`:"Créer l'événement"})]})]})})]})}),s.jsx(yr,{open:q,onOpenChange:oe,children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Quitter sans enregistrer ?"}),s.jsx(lr,{children:"Vos modifications seront perdues. Voulez-vous vraiment fermer ce formulaire ?"})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Continuer l'édition"}),s.jsx(vr,{onClick:Y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Quitter sans enregistrer"})]})]})})]})}const oB={draft:{label:"Brouillon",variant:"secondary"},published:{label:"Publié",variant:"default"},ongoing:{label:"En cours",variant:"default"},completed:{label:"Terminé",variant:"outline"},cancelled:{label:"Annulé",variant:"destructive"}},W6e={swiss:"Suisse","round-robin":"Toutes rondes",knockout:"Élimination"};function lB({event:e,ticketCount:t=0}){const n=Rr(),r=new Date(e.event_date),i=oB[e.status]||oB.draft,a=W6e[e.format||"swiss"]||e.format,o=l=>{l.preventDefault(),l.stopPropagation(),n(`/venue/events/${e.id}/tournament`)};return s.jsx(Pe,{to:`/venue/events/${e.id}`,children:s.jsx(Se,{className:"border-border/50 hover:border-primary/50 hover:shadow-sm transition-all cursor-pointer",children:s.jsx(De,{className:"p-4",children:s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex-shrink-0 text-center bg-primary/5 rounded-lg p-2 min-w-[60px]",children:[s.jsx("p",{className:"text-xs text-muted-foreground uppercase",children:Ze(r,"EEE",{locale:pt})}),s.jsx("p",{className:"text-2xl font-bold text-primary",children:Ze(r,"d")}),s.jsx("p",{className:"text-xs text-muted-foreground",children:Ze(r,"MMM",{locale:pt})})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[s.jsx("h3",{className:"font-semibold text-foreground truncate",children:e.title}),s.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.status==="ongoing"&&s.jsxs(Q,{size:"sm",variant:"outline",onClick:o,className:"gap-1.5 bg-primary/10 hover:bg-primary/20 text-primary border-primary/20 h-6 px-2",children:[s.jsx(Xt,{className:"w-3.5 h-3.5"}),s.jsx("span",{className:"hidden sm:inline text-xs",children:"Tournoi"})]}),s.jsx(we,{variant:i.variant,children:i.label})]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-muted-foreground",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Vt,{className:"w-3.5 h-3.5"}),Ze(r,"HH:mm")]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(sn,{className:"w-3.5 h-3.5"}),t,"/",e.capacity]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Fk,{className:"w-3.5 h-3.5"}),(e.price_cents/100).toFixed(0),"€"]}),s.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-secondary rounded",children:a})]})]})]})})})})}const $ie=e=>["venue-products",e],VM=e=>["venue-products-all",e],Bie=e=>["product-library",e],G6e=e=>["venue-subcategories",e];
1186function iw(e,t){e.invalidateQueries({queryKey:$ie(t)}),e.invalidateQueries({queryKey:VM(t)}),e.invalidateQueries({queryKey:Bie(t)}),e.invalidateQueries({queryKey:G6e(t)})}function zie(e){if(e==null)return null;const t=e.trim();return t.length===0?null:t}function K6e(){const e=Ye();return dt({mutationFn:async t=>{const{data:n,error:r}=await re.from("products").insert({venue_id:t.venue_id,name:t.name,price_cents:t.price_cents,category:t.category||"drink",subcategory:zie(t.subcategory),description:t.description||null,is_active:t.is_active??!0,...t.vat_rate!=null?{vat_rate:t.vat_rate}:{}}).select().single();if(r)throw r;return n},onSuccess:(t,n)=>{iw(e,n.venue_id),je.success("Produit ajouté !")},onError:t=>{console.error("Create product error:",t),je.error("Erreur lors de l'ajout du produit")}})}function Y6e(){const e=Ye();return dt({mutationFn:async t=>{const{id:n,venue_id:r,...i}=t,a={...i};"subcategory"in i&&(a.subcategory=zie(i.subcategory));const{data:o,error:l}=await re.from("products").update(a).eq("id",n).select().single();if(l)throw l;return{...o,venue_id:r}},onSuccess:t=>{iw(e,t.venue_id),je.success("Produit modifié !")},onError:t=>{console.error("Update product error:",t),je.error("Erreur lors de la modification")}})}function X6e(){const e=Ye();return dt({mutationFn:async({productId:t,venueId:n,isActive:r})=>{const{data:i,error:a}=await re.from("products").update({is_active:r}).eq("id",t).select().single();if(a)throw a;return{...i,venue_id:n}},onSuccess:t=>{iw(e,t.venue_id),je.success(t.is_active?"Produit activé":"Produit désactivé")},onError:t=>{console.error("Toggle product error:",t),je.error("Erreur lors de la modification")}})}function Q6e(){const e=Ye();return dt({mutationFn:async({targetVenueId:t,products:n})=>{if(n.length===0)return{inserted:0};const{data:r,error:i}=await re.from("products").select("name").eq("venue_id",t);if(i)throw i;const a=new Set((r??[]).map(c=>c.name.toLowerCase().trim())),o=n.filter(c=>!a.has(c.name.toLowerCase().trim())).map(c=>({venue_id:t,name:c.name,category:c.category,price_cents:c.price_cents,...c.vat_rate!=null?{vat_rate:c.vat_rate}:{},description:c.description,is_active:c.is_active}));if(o.length===0)return{inserted:0};const{error:l}=await re.from("products").insert(o);if(l)throw l;return{inserted:o.length}},onSuccess:(t,n)=>{iw(e,n.targetVenueId),t.inserted===0?je.info("Aucun produit nouveau à importer"):je.success(`${t.inserted} produit${t.inserted>1?"s":""} importé${t.inserted>1?"s":""} depuis ${n.sourceVenueName}`)},onError:t=>{console.error("Bulk import products error:",t),je.error("Erreur lors de l'import des produits")}})}function J6e(){const e=Ye();return dt({mutationFn:async({productId:t,venueId:n})=>{const{error:r}=await re.from("products").delete().eq("id",t);if(r)throw r;return{venueId:n}},onSuccess:t=>{iw(e,t.venueId),je.success("Produit supprimé")},onError:t=>{console.error("Delete product error:",t),je.error("Erreur lors de la suppression")}})}function Z6e(e){const t=Ye();N.useEffect(()=>{if(!e)return;const n=re.channel(`venue-products-rt-${e}`).on("postgres_changes",{event:"*",schema:"public",table:"products",filter:`venue_id=eq.${e}`},()=>{t.invalidateQueries({queryKey:$ie(e)}),t.invalidateQueries({queryKey:VM(e)}),t.invalidateQueries({queryKey:Bie(e)})}).subscribe();return()=>{re.removeChannel(n)}},[e,t])}function Uie(e){const t=Ye();N.useEffect(()=>{if(!e)return;const n=re.channel(`venue-staff-rt-${e}`).on("postgres_changes",{event:"*",schema:"public",table:"venue_users",filter:`venue_id=eq.${e}`},()=>{t.invalidateQueries({queryKey:["venue-staff",e]})}).subscribe();return()=>{re.removeChannel(n)}},[e,t])}function e8e(e){return st({queryKey:["product-library",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await re.from("products").select("name").eq("venue_id",e);if(n)throw n;const r=new Set((t??[]).map(c=>c.name.toLowerCase().trim())),{data:i,error:a}=await re.from("products").select("name, category, price_cents, vat_rate, description").neq("venue_id",e).eq("is_active",!0).order("name");if(a)throw a;const o=new Set,l=[];for(const c of i??[]){const u=c.name.toLowerCase().trim();o.has(u)||r.has(u)||(o.add(u),l.push({name:c.name,category:c.category??"drink",price_cents:c.price_cents,vat_rate:Number(c.vat_rate??.2),description:c.description}))}return l},enabled:!!e,staleTime:6e4})}function t8e(e,t){return st({queryKey:["venue-subcategories",e,t??null],queryFn:async()=>
1186{if(!e)return[];let n=re.from("products").select("subcategory, category").eq("venue_id",e).not("subcategory","is",null);t&&(n=n.eq("category",t));const{data:r,error:i}=await n;if(i)throw i;const a=new Map;for(const o of r??[]){const l=(o.subcategory??"").trim();if(!l)continue;const c=l.toLowerCase();a.has(c)||a.set(c,l)}return Array.from(a.values()).sort((o,l)=>o.localeCompare(l,"fr",{sensitivity:"base"}))},enabled:!!e,staleTime:3e4})}const n8e=[.055,.1,.2],r8e={food:.1,coffee:.1,snack:.1,other:.1,drink:.2};function s8e(e){return e?r8e[e]??.2:.2}const i8e={"0.055":"5,5 %","0.1":"10 %","0.2":"20 %"};function qie(e){return i8e[String(e)]??`${(e*100).toFixed(1)} %`}const a8e=da({name:Ct().min(1,"Le nom est requis").max(100,"100 caractères maximum"),category:Ct().min(1,"La catégorie est requise"),subcategory:Ct().trim().max(60,"60 caractères maximum").optional(),priceEuros:Ct().refine(e=>!isNaN(parseFloat(e))&&parseFloat(e)>0,"Le prix doit être supérieur à 0"),vatRate:tf(["0.055","0.1","0.2"]),description:Ct().max(200,"200 caractères maximum").optional(),is_active:bj()}),HM=[{value:"drink",label:"🍺 Boissons",emoji:"🍺"},{value:"food",label:"🍔 Nourriture",emoji:"🍔"},{value:"snack",label:"🥨 Snacks",emoji:"🥨"},{value:"coffee",label:"☕ Café",emoji:"☕"},{value:"other",label:"🎁 Autre",emoji:"🎁"}],o8e=Object.fromEntries(HM.map(e=>[e.value,e.emoji]));function l8e({open:e,onOpenChange:t,venueId:n,product:r}){const i=K6e(),a=Y6e(),o=!!r,{data:l,isLoading:c}=e8e(!o&&e?n:void 0),[u,d]=N.useState(""),[f,h]=N.useState(null),[p,x]=N.useState(null),y=N.useMemo(()=>l?l.filter(F=>!(f&&F.category!==f||u&&!F.name.toLowerCase().includes(u.toLowerCase()))):[],[l,u,f]),{register:b,handleSubmit:w,reset:_,setValue:j,watch:E,formState:{errors:S}}=Zm({resolver:ep(a8e),defaultValues:{name:"",category:"drink",subcategory:"",priceEuros:"",vatRate:"0.2",description:"",is_active:!0}}),T=E("is_active"),P=E("category"),O=E("vatRate"),D=E("subcategory")??"",{data:R}=t8e(e?n:void 0,P);N.useEffect(()=>{if(e)if(d(""),h(null),x(null),r){const F=r.vat_rate!=null?Number(r.vat_rate):.2;_({name:r.name,category:r.category||"drink",subcategory:r.subcategory??"",priceEuros:(r.price_cents/100).toFixed(2),vatRate:String(F),description:r.description||"",is_active:r.is_active??!0})}else _({name:"",category:"drink",subcategory:"",priceEuros:"",vatRate:"0.2",description:"",is_active:!0})},[e,r,_]),N.useEffect(()=>{if(!e||r)return;const F=s8e(P);j("vatRate",String(F))},[P,e,r]);const L=async F=>{var W;const H=Math.round(parseFloat(F.priceEuros)*100),z=(W=F.subcategory)!=null&&W.trim()?F.subcategory.trim():null,K=parseFloat(F.vatRate);o&&r?await a.mutateAsync({id:r.id,venue_id:n,name:F.name,category:F.category,subcategory:z,price_cents:H,vat_rate:K,description:F.description||void 0,is_active:F.is_active}):await i.mutateAsync({venue_id:n,name:F.name,category:F.category,subcategory:z,price_cents:H,vat_rate:K,description:F.description||void 0,is_active:F.is_active}),t(!1)},M=async F=>{x(F.name);try{await i.mutateAsync({venue_id:n,name:F.name,category:F.category,price_cents:F.price_cents,vat_rate:F.vat_rate,description:F.description||void 0,is_active:!0})}finally{x(null)}},B=i.isPending||a.isPending,U=((l==null?void 0:l.length)??0)>0;return s.jsx(Ln,{open:e,onOpenChange:t,children:s.jsxs(Dn,{className:"sm:max-w-md max-h-[85vh] flex flex-col",children:[s.jsxs(Un,{children:[s.jsx(qn,{className:"font-display",children:o?"Modifier le produit":"Ajouter un produit"}),s.jsx(qr,{children:o?"Modifiez les informations du produit":"Choisissez depuis la bibliothèque ou créez manuellement"})]}),o?s.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto pr-1",children:s.jsx(cB,{register:b,handleSubmit:w,onSubmit:L,errors:S,watchCategory:P,watchVatRate:O,watchIsActive:T,setValue:j,isLoading:B,isEditing:!0,onCancel:()=>t(!1),subcategorySuggestions:R??[],watchSubcategory:D})}):s.jsxs(Ka,{defaultValue:U?"library":"manual",className:"flex-1 min-h-0 flex flex-col",children:[s.jsxs(Ca,{className:"w-full grid grid-cols-2",children:[s.jsx(vn,{value:"library",children:"📚 Bibliothèque"}),s.jsx(vn,{value:"manual",children:"✏️ Créer"})]}),s.jsxs(Sn,{value:"library",className:"flex-1 min-h-0 flex flex-col gap-3 mt-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx(_o,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Ue,{placeholder:"Rechercher un produit...",value:u,onChange:F=>d(F.target.value),className:"pl-9"})]}),s.jsxs("div",{className:"flex gap-1.5 flex-wrap",children:[s.jsx(we,{variant:f===null?"default":"outline",className:"cursor-pointer text-xs",onClick:()=>h(null),children:"Tout"}),HM.map(F=>s.jsxs(we,{variant:f===F.value?"default":"outline",className:"cursor-pointer text-xs",onClick:()=>
1186h(f===F.value?null:F.value),children:[F.emoji," ",F.label.split(" ").slice(1).join(" ")]},F.value))]}),s.jsx(cd,{className:"flex-1 min-h-0 max-h-[40vh]",children:c?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(We,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):y.length===0?s.jsx("p",{className:"text-center text-sm text-muted-foreground py-8",children:u||f?"Aucun produit trouvé":"La bibliothèque est vide. Créez un produit manuellement."}):s.jsx("div",{className:"space-y-1.5 pr-2",children:y.map(F=>s.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border bg-card p-3 hover:bg-accent/50 transition-colors",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:"text-lg shrink-0",children:o8e[F.category]??"🎁"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:F.name}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[(F.price_cents/100).toFixed(2)," €"]})]})]}),s.jsx(Q,{size:"sm",variant:"outline",className:"shrink-0 h-8 w-8 p-0",disabled:p===F.name,onClick:()=>M(F),children:p===F.name?s.jsx(We,{className:"h-3.5 w-3.5 animate-spin"}):s.jsx(qa,{className:"h-3.5 w-3.5"})})]},`${F.name}-${F.price_cents}`))})})]}),s.jsx(Sn,{value:"manual",className:"flex-1 min-h-0 overflow-y-auto pr-1 mt-3",children:s.jsx(cB,{register:b,handleSubmit:w,onSubmit:L,errors:S,watchCategory:P,watchVatRate:O,watchIsActive:T,setValue:j,isLoading:B,isEditing:!1,onCancel:()=>t(!1),subcategorySuggestions:R??[],watchSubcategory:D})})]})]})})}function cB({register:e,handleSubmit:t,onSubmit:n,errors:r,watchCategory:i,watchVatRate:a,watchIsActive:o,setValue:l,isLoading:c,isEditing:u,onCancel:d,subcategorySuggestions:f,watchSubcategory:h}){const p=h.trim().toLowerCase();return s.jsxs("form",{onSubmit:t(n),className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"name",children:"Nom du produit *"}),s.jsx(Ue,{id:"name",placeholder:"Ex: Pression 50cl",...e("name")}),r.name&&s.jsx("p",{className:"text-sm text-destructive",children:r.name.message})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{children:"Catégorie *"}),s.jsxs(li,{value:i,onValueChange:x=>l("category",x),children:[s.jsx(Gs,{children:s.jsx(ci,{placeholder:"Sélectionner une catégorie"})}),s.jsx(Ks,{children:HM.map(x=>s.jsx(Yn,{value:x.value,children:x.label},x.value))})]}),r.category&&s.jsx("p",{className:"text-sm text-destructive",children:r.category.message})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"subcategory",children:"Sous-catégorie (optionnel)"}),f.length>0&&s.jsx("div",{className:"flex flex-wrap gap-1.5",role:"group","aria-label":"Sous-catégories existantes",children:f.map(x=>{const y=x.toLowerCase()===p;return s.jsx(we,{variant:y?"default":"outline",role:"button",tabIndex:0,"aria-pressed":y,className:"cursor-pointer text-xs select-none px-2.5 py-1",onClick:()=>l("subcategory",x,{shouldDirty:!0,shouldValidate:!0}),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),l("subcategory",x,{shouldDirty:!0,shouldValidate:!0}))},children:x},x)})}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Ue,{id:"subcategory",placeholder:"Ex: Bières pression, Sodas, Boissons chaudes",autoComplete:"off",...e("subcategory")}),h.trim()&&s.jsx(Q,{type:"button",variant:"outline",size:"sm",className:"shrink-0",onClick:()=>l("subcategory","",{shouldDirty:!0,shouldValidate:!0}),children:"Effacer"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Cliquez une sous-catégorie existante ou saisissez-en une nouvelle."}),r.subcategory&&s.jsx("p",{className:"text-sm text-destructive",children:r.subcategory.message})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"priceEuros",children:"Prix (€) *"}),s.jsxs("div",{className:"relative",children:[s.jsx(Ue,{id:"priceEuros",type:"number",step:"0.01",min:"0.01",placeholder:"5.00",...e("priceEuros"),className:"pr-8"}),s.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"€"})]}),r.priceEuros&&s.jsx("p",{className:"text-sm text-destructive",children:r.priceEuros.message})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{children:"TVA *"}),s.jsxs(li,{value:a,onValueChange:x=>l("vatRate",x),children:[s.jsx(Gs,{children:s.jsx(ci,{})}),s.jsx(Ks,{children:n8e.map(x=>s.jsx(Yn,{value:String(x),children:qie(x)},x))})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"20 % : alcool. 10 % : nourriture, soft, café, snacks (et alcool sur place en Corse). 5,5 % : eau, produits spécifiques."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"description",children:"Description (optionnel)"}),s.jsx($s,{id:"description",placeholder:"Description courte du produit...",rows:2,...e("description")}),r.description&&s.jsx("p",{className:"text-sm text-destructive",children:r.description.message})]}),s.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(Fe,{htmlFor:"is_active",children:"Produit actif"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Les produits inactifs ne sont pas visibles par les joueurs"})]}),s.jsx(R0,{id:"is_active",checked:o,onCheckedChange:x=>l("is_active",x)})]}),s.jsxs(Pi,{children:[s.jsx(Q,{type:"button",variant:"outline",onClick:d,children:"Annuler"}
1186),s.jsxs(Q,{type:"submit",disabled:c,children:[c&&s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),u?"Enregistrer":"Ajouter"]})]})]})}var HC="Checkbox",[c8e]=Us(HC),[u8e,WM]=c8e(HC);function d8e(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,p]=Hi({prop:n,defaultProp:i??!1,onChange:c,caller:HC}),[x,y]=N.useState(null),[b,w]=N.useState(null),_=N.useRef(!1),j=x?!!o||!!x.closest("form"):!0,E={checked:h,disabled:a,setChecked:p,control:x,setControl:y,name:l,form:o,value:d,hasConsumerStoppedPropagationRef:_,required:u,defaultChecked:Af(i)?!1:i,isFormControl:j,bubbleInput:b,setBubbleInput:w};return s.jsx(u8e,{scope:t,...E,children:f8e(f)?f(E):r})}var Vie="CheckboxTrigger",Hie=N.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{const{control:a,value:o,disabled:l,checked:c,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:h,isFormControl:p,bubbleInput:x}=WM(Vie,e),y=Qt(i,d),b=N.useRef(c);return N.useEffect(()=>{const w=a==null?void 0:a.form;if(w){const _=()=>f(b.current);return w.addEventListener("reset",_),()=>w.removeEventListener("reset",_)}},[a,f]),s.jsx(ut.button,{type:"button",role:"checkbox","aria-checked":Af(c)?"mixed":c,"aria-required":u,"data-state":Xie(c),"data-disabled":l?"":void 0,disabled:l,value:o,...r,ref:y,onKeyDown:Je(t,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:Je(n,w=>{f(_=>Af(_)?!0:!_),x&&p&&(h.current=w.isPropagationStopped(),h.current||w.stopPropagation())})})});Hie.displayName=Vie;var GM=N.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:l,value:c,onCheckedChange:u,form:d,...f}=e;return s.jsx(d8e,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:l,required:o,onCheckedChange:u,name:r,form:d,value:c,internal_do_not_use_render:({isFormControl:h})=>s.jsxs(s.Fragment,{children:[s.jsx(Hie,{...f,ref:t,__scopeCheckbox:n}),h&&s.jsx(Yie,{__scopeCheckbox:n})]})})});GM.displayName=HC;var Wie="CheckboxIndicator",Gie=N.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,a=WM(Wie,n);return s.jsx(mi,{present:r||Af(a.checked)||a.checked===!0,children:s.jsx(ut.span,{"data-state":Xie(a.checked),"data-disabled":a.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});Gie.displayName=Wie;var Kie="CheckboxBubbleInput",Yie=N.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:h,setBubbleInput:p}=WM(Kie,e),x=Qt(n,p),y=RC(a),b=qk(r);N.useEffect(()=>{const _=h;if(!_)return;const j=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(j,"checked").set,T=!i.current;if(y!==a&&S){const P=new Event("click",{bubbles:T});_.indeterminate=Af(a),S.call(_,Af(a)?!1:a),_.dispatchEvent(P)}},[h,y,a,i]);const w=N.useRef(Af(a)?!1:a);return s.jsx(ut.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??w.current,required:l,disabled:c,name:u,value:d,form:f,...t,tabIndex:-1,ref:x,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Yie.displayName=Kie;function f8e(e){return typeof e=="function"}function Af(e){return e==="indeterminate"}function Xie(e){return Af(e)?"indeterminate":e?"checked":"unchecked"}const ya=N.forwardRef(({className:e,...t},n)=>s.jsx(GM,{ref:n,className:ae("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:s.jsx(Gie,{className:ae("flex items-center justify-center text-current"),children:s.jsx(is,{className:"h-4 w-4"})})}));ya.displayName=GM.displayName;function h8e(e){return st({queryKey:["importable-venues",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await re.from("products").select("venue_id, venues!inner(id, name)").neq("venue_id",e);if(n)throw n;const r=new Map;for(const i of t??[]){const a=i.venues;if(!a)continue;const o=r.get(a.id);o?o.count+=1:r.set(a.id,{name:a.name,count:1})}return Array.from(r.entries()).map(([i,{name:a,count:o}])=>
1186({id:i,name:a,productCount:o})).sort((i,a)=>i.name.localeCompare(a.name,"fr"))},enabled:!!e,staleTime:6e4})}function m8e(e){return st({queryKey:["venue-products-for-import",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await re.from("products").select("id, name, category, price_cents, description, is_active").eq("venue_id",e).order("category",{ascending:!0}).order("name",{ascending:!0});if(n)throw n;return(t??[]).map(r=>({id:r.id,name:r.name,category:r.category??"drink",price_cents:r.price_cents,description:r.description,is_active:r.is_active??!0}))},enabled:!!e,staleTime:3e4})}const p8e={drink:"Boissons",food:"Nourriture",snack:"Snacks",coffee:"Café",other:"Autres"},g8e={drink:"🍺",food:"🍔",snack:"🥨",coffee:"☕",other:"🎁"};function x8e({open:e,onOpenChange:t,venueId:n}){const[r,i]=N.useState(null),[a,o]=N.useState(""),[l,c]=N.useState(""),[u,d]=N.useState(new Set),{data:f,isLoading:h}=h8e(e?n:void 0),{data:p,isLoading:x}=m8e(e?r:null),{data:y}=st({queryKey:["target-venue-product-names",n,e],queryFn:async()=>{const{data:B,error:U}=await re.from("products").select("name").eq("venue_id",n);if(U)throw U;return new Set((B??[]).map(F=>F.name.toLowerCase().trim()))},enabled:e,staleTime:1e4}),b=Q6e();N.useEffect(()=>{e||(i(null),o(""),c(""),d(new Set))},[e]);const w=N.useMemo(()=>p?p.map(B=>({...B,alreadyExists:(y==null?void 0:y.has(B.name.toLowerCase().trim()))??!1})):[],[p,y]),_=N.useMemo(()=>{if(!l.trim())return w;const B=l.toLowerCase().trim();return w.filter(U=>U.name.toLowerCase().includes(B))},[w,l]),j=N.useMemo(()=>_.reduce((B,U)=>{const F=U.category||"other";return B[F]||(B[F]=[]),B[F].push(U),B},{}),[_]),E=N.useMemo(()=>_.filter(B=>!B.alreadyExists).map(B=>B.id),[_]),S=E.length>0&&E.every(B=>u.has(B)),T=()=>{d(S?B=>{const U=new Set(B);return E.forEach(F=>U.delete(F)),U}:B=>{const U=new Set(B);return E.forEach(F=>U.add(F)),U})},P=B=>{d(U=>{const F=new Set(U);return F.has(B)?F.delete(B):F.add(B),F})},O=()=>{i(null),o(""),c(""),d(new Set)},D=B=>{i(B.id),o(B.name)},R=async()=>{if(!p||u.size===0)return;const B=p.filter(U=>u.has(U.id)).map(U=>({name:U.name,category:U.category,price_cents:U.price_cents,description:U.description,is_active:U.is_active}));await b.mutateAsync({targetVenueId:n,sourceVenueName:a,products:B}),t(!1)},L=!!r,M=u.size;return s.jsx(Ln,{open:e,onOpenChange:t,children:s.jsxs(Dn,{className:"sm:max-w-lg max-h-[92vh] flex flex-col p-0 gap-0",children:[s.jsxs(Un,{className:"p-6 pb-3 border-b",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[L&&s.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 -ml-2",onClick:O,children:s.jsx(Fn,{className:"h-4 w-4"})}),s.jsx(qn,{className:"font-display",children:L?a:"Importer depuis un autre lieu"})]}),s.jsx(qr,{children:L?"Sélectionnez les produits à copier dans votre catalogue.":"Choisissez un lieu source pour copier sa carte."})]}),!L&&s.jsx(cd,{className:"flex-1 min-h-0",children:s.jsx("div",{className:"p-6 pt-3 space-y-2",children:h?s.jsxs(s.Fragment,{children:[s.jsx(Ie,{className:"h-14 w-full"}),s.jsx(Ie,{className:"h-14 w-full"}),s.jsx(Ie,{className:"h-14 w-full"})]}):!f||f.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Vi,{className:"w-10 h-10 text-muted-foreground mx-auto mb-3 opacity-50"}),s.jsx("p",{className:"font-medium mb-1",children:"Aucun lieu source disponible"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Aucun autre lieu n'a encore de catalogue produits."})]}):f.map(B=>s.jsxs("button",{type:"button",onClick:()=>D(B),className:"w-full flex items-center justify-between gap-3 p-3 rounded-lg border bg-card hover:bg-accent/50 transition-colors text-left",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx("div",{className:"h-9 w-9 rounded-md bg-primary/10 flex items-center justify-center shrink-0",children:s.jsx(eu,{className:"h-4 w-4 text-primary"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"font-medium text-sm truncate",children:B.name}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[B.productC
1186ount," produit",B.productCount>1?"s":""]})]})]}),s.jsx(la,{className:"h-4 w-4 text-muted-foreground shrink-0"})]},B.id))})}),L&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"px-6 pt-3 pb-2 space-y-2 border-b",children:[s.jsxs("div",{className:"relative",children:[s.jsx(_o,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Ue,{placeholder:"Rechercher un produit...",value:l,onChange:B=>c(B.target.value),className:"pl-9 h-9"})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("p",{className:"text-xs text-muted-foreground",children:[E.length," sélectionnable",E.length>1?"s":"",_.length!==E.length&&s.jsxs(s.Fragment,{children:[" · ",_.length-E.length," déjà présent",_.length-E.length>1?"s":""]})]}),s.jsx(Q,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:E.length===0,onClick:T,children:S?"Tout décocher":"Tout cocher"})]})]}),s.jsx(cd,{className:"flex-1 min-h-0",children:s.jsx("div",{className:"p-6 pt-3 space-y-5",children:x?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(We,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):_.length===0?s.jsx("p",{className:"text-center text-sm text-muted-foreground py-8",children:l?"Aucun produit trouvé.":"Ce lieu n'a aucun produit."}):Object.entries(j).map(([B,U])=>s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-medium text-muted-foreground mb-2 flex items-center gap-2",children:[s.jsx("span",{children:g8e[B]||"📦"}),s.jsx("span",{children:p8e[B]||B}),s.jsx(we,{variant:"outline",className:"ml-auto text-xs",children:U.length})]}),s.jsx("div",{className:"space-y-1.5",children:U.map(F=>s.jsx(y8e,{product:F,checked:u.has(F.id),onToggle:()=>P(F.id)},F.id))})]},B))})}),s.jsxs("div",{className:"p-4 border-t bg-background sticky bottom-0 flex items-center justify-between gap-2",children:[s.jsx(Q,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:b.isPending,children:"Annuler"}),s.jsxs(Q,{type:"button",onClick:R,disabled:M===0||b.isPending,className:"min-w-[140px]",children:[b.isPending?s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}):null,"Importer",M>0&&` (${M})`]})]})]})]})})}function y8e({product:e,checked:t,onToggle:n}){const r=e.alreadyExists;return s.jsxs("label",{className:ae("flex items-center gap-3 p-2.5 rounded-lg border transition-colors",r?"bg-muted/40 border-muted opacity-60 cursor-not-allowed":"bg-card hover:bg-accent/50 cursor-pointer",t&&!r&&"border-primary/40 bg-primary/5"),children:[s.jsx(ya,{checked:t,onCheckedChange:n,disabled:r,className:"shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("p",{className:"font-medium text-sm truncate",children:e.name}),r&&s.jsx(we,{variant:"secondary",className:"text-[10px] shrink-0",children:"Déjà présent"}),!e.is_active&&!r&&s.jsx(we,{variant:"outline",className:"text-[10px] shrink-0",children:"Inactif"})]}),e.description&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:e.description})]}),s.jsxs("p",{className:"font-semibold text-sm text-primary whitespace-nowrap",children:[(e.price_cents/100).toFixed(2),"€"]})]})}const v8e={drink:"Boissons",food:"Nourriture",snack:"Snacks",coffee:"Café",other:"Autres"},b8e={drink:"🍺",food:"🍔",snack:"🥨",coffee:"☕",other:"🎁"};function Qie({venueId:e}){const[t,n]=N.useState(!1),[r,i]=N.useState(!1),[a,o]=N.useState(null),[l,c]=N.useState(null),u=X6e(),d=J6e();Z6e(e);const{data:f,isLoading:h}=st({queryKey:VM(e),queryFn:async()=>{const{data:E,error:S}=await re.from("products").select("*").eq("venue_id",e).order("category",{ascending:!0}).order("name",{ascending:!0});if(S)throw S;return E},enabled:!!e,staleTime:3e4}),p=(f||[]).reduce((E,S)=>{const T=S.category||"other";return E[T]||(E[T]=[]),E[T].push(S),E},{}),x=async E=>{await u.mutateAsync({productId:E.id,venueId:e,isActive:!E.is_active})},y=async()=>{l&&(await d.mutateAsync({productId:l.id,venueId:e}),c(null))},b=E=>{o(E),n(!0)},w=()=>{n(!1),o(null)},_=(f==null?void 0:f.filter(E=>E.is_active).length)||0,j=(f==null?void 0:f.length)||0;return s.jsxs(s.Fragment,{children:[s.jsxs(Se,{className:"border-border/50",children:[s.jsx(kt,{children:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx(eu,{className:"w-5 h-5 text-primary shrink-0"}),s.jsx(Et,{className:"font-display text-lg sm:text-xl truncate",children:"Catalogue produits"}),j>0&&s.jsxs(we,{variant:"secondary",className:"shrink-0",children:[_,"/",j," actifs"]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs(Q,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>i(!0),children:[s.jsx(Ko,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Importer"})]}),s.jsxs(Q,{size:"sm",className:"gap-2",onClick:()=>n(!0),children:[s.jsx(qa,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Ajouter"})]})]})]})}),s.jsx(De,{children:h?s.jsx("div",{className:"space-y-3",children:[1,2,3].map(E=>s.jsx(Ie,{className:"h-14 w-full"},E))}):!f||f.length===0?s.jsxs("div",{className:"text-center py-8",children:[s.jsx(eu,{className:"w-12 h-12 text-muted-foreground mx-auto mb-4 opacity-50"}),s.jsx("h3",{className:"font-medium text-lg mb-2",children:"Aucun produit"}),s.jsx("p",{className:"text-muted-foreground text-sm max-w-md mx-auto mb-4",children:"Configurez les boissons et repas éligibles au crédit consommation des joueurs."}),s.jsxs(Q,{onClick:()=>n(!0),className:"gap-2",children:[s.jsx(qa,{className:"w-4 h-4"}),"Ajouter un produit"]})]}):s.jsx("div",{className:"space-y-6",children:Object.entries(p).map(([E,S])=>s.jsxs("div",{children:[s.jsxs("h4",{className:"text-sm font-medium text-muted-foreground mb-2 flex items-center gap-2",children:[s.jsx("span",{children:b8e[E]||"📦"}),s.jsx("span",{children:v8e[E]||E}),s.jsx(we,{variant:"outline",className:"ml-auto text-xs",children:S==null?void 0:S.length})]}),s.jsx("div",{className:"space-y-2",children:S==null?void 0:S.map(T=>s.jsxs("div",{className:ae("flex flex-wrap items-center gap-x-3 gap-y-2 p-3 rounded-lg border transition-all",T.is_active?"bg-card border-border":"bg-muted/30 border-muted opacity-60"),children:[s.jsxs("div",{className:"flex-1 basis-full sm:basis-0 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("p",{className:ae("font-medium text-sm truncate",!T.is_active&&"line-through"),children:T.name}),T.subcategory&&s.jsx(we,{variant:"outline",className:"text-[10px] shrink-0 px-1.5 py-0",children:T.subcategory}),!T.is_active&&s.jsx(we,{variant:"secondary",className:"text-xs shrink-0",children:"Inactif"})]}),T.description&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:T.description})]}),s.jsxs("div",{className:"flex flex-col items-start sm:items-end gap-0.5 whitespace-nowrap shrink-0",children:[s.jsxs("p",{className:"font-bold text-primary",children:[(T.price_cents/100).toFixed(2),"€"]}),s.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["TVA ",qie(Number(T.vat_rate??.2))]})]}),s.jsxs("div",{className:"flex items-center gap-1 ml-auto shrink-0",children:[s.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>x(T),disabled:u.isPending,children:T.is_active?s.jsx(oX,{className:"w-4 h-4 text-success"}):s.jsx(aX,{className:"w-4 h-4 text-muted-foreground"})}),s.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>b(T),children:s.jsx(oI,{className:"w-4 h-4"})}),s.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>c({id:T.id,name:T.name}),children:s.jsx(ua,{className:"w-4 h-4"})})]})]},T.id))})]},E))})})]}),s.jsx(l8e,{open:t,onOpenChange:w,venueId:e,product:a}),s.jsx(x8e,{open:r,onOpenChange:i,venueId:e}),s.jsx(yr,{open:!!l,onOpenChange:()=>c(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Supprimer ce produit ?"}),s.jsxs(lr,{children:['Le produit "',l==null?void 0:l.name,'" sera définitivement supprimé. Cette action est irréversible.']}
1186)]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsxs(vr,{onClick:y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[d.isPending?s.jsx(We,{className:"w-4 h-4 animate-spin mr-2"}):s.jsx(ua,{className:"w-4 h-4 mr-2"}),"Supprimer"]})]})]})})]})}function w8e(e){return st({queryKey:["search-users",e],queryFn:async()=>{if(!e||e.length<2)return[];const t=hI(e),{data:n,error:r}=await re.from("profiles").select("id, email, first_name, last_name, display_name").or(`email.ilike.%${t}%,first_name.ilike.%${t}%,last_name.ilike.%${t}%,display_name.ilike.%${t}%`).limit(10);if(r)throw r;return n},enabled:e.length>=2,staleTime:3e4})}function _8e(){const e=Ye();return dt({mutationFn:async t=>{var i;const{data:n,error:r}=await re.functions.invoke("venue-staff-manage",{body:{action:"add",...t}});if(r){const a=r.context;let o=r.message;try{const l=await((i=a==null?void 0:a.json)==null?void 0:i.call(a));l!=null&&l.error&&(o=l.error)}catch{}throw new Error(o)}if(n!=null&&n.error)throw new Error(n.error);return n.member},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["venue-staff",n.venueId]}),e.invalidateQueries({queryKey:["venues-manager-counts"]}),dn({title:"Membre ajouté",description:"L'utilisateur a été ajouté à l'équipe."})},onError:t=>{dn({title:"Erreur",description:t.message,variant:"destructive"})}})}function Jie(){const e=Ye();return dt({mutationFn:async({venueUserId:t,venueId:n})=>{const{error:r}=await re.from("venue_users").delete().eq("id",t);if(r)throw r},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["venue-staff",n.venueId]}),e.invalidateQueries({queryKey:["venues-manager-counts"]}),dn({title:"Membre retiré",description:"L'utilisateur a été retiré de l'équipe."})},onError:t=>{dn({title:"Erreur",description:t.message,variant:"destructive"})}})}function j8e(){return dt({mutationFn:async({email:e,firstName:t,lastName:n})=>{var c;const r=e.trim().toLowerCase(),{data:i,error:a}=await re.functions.invoke("admin-create-user",{body:{email:r,firstName:t,lastName:n,roles:["player"]}});if(a){const u=a.context;let d=a.message;try{const f=await((c=u==null?void 0:u.json)==null?void 0:c.call(u));f!=null&&f.error&&(d=f.error)}catch{}throw new Error(d)}if(i!=null&&i.error)throw new Error(i.error);const o=i.userId;let l=null;for(let u=0;u<6;u++){const{data:d}=await re.from("profiles").select("id, email, first_name, last_name, display_name").eq("id",o).maybeSingle();if(d){l=d;break}await new Promise(f=>setTimeout(f,400))}return l||(l={id:o,email:r,first_name:(t==null?void 0:t.trim())||null,last_name:(n==null?void 0:n.trim())||null,display_name:(t==null?void 0:t.trim())||r.split("@")[0]}),l},onError:e=>{dn({title:"Erreur de création",description:e.message,variant:"destructive"})}})}function Zie(){const e=Ye();return dt({mutationFn:async({venueUserId:t,venueId:n,role:r})=>{const{data:i,error:a}=await re.from("venue_users").update({role:r}).eq("id",t).select().single();if(a)throw a;return i},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["venue-staff",n.venueId]}),e.invalidateQueries({queryKey:["venues-manager-counts"]}),dn({title:"Rôle modifié",description:`Le rôle a été changé en ${n.role==="manager"?"Manager":"Staff"}.`})},onError:t=>{dn({title:"Erreur",description:t.message,variant:"destructive"})}})}function WC(e){var c,u;const{isAdmin:t}=Tt(),{data:n,isLoading:r,isFetching:i}=UI();if(t)return{hasAccess:!0,isManager:!0,myVenueId:e,isLoading:!1,isFetching:!1};const a=r?!0:(n==null?void 0:n.some(d=>{var f;return((f=d.venue)==null?void 0:f.id)===e}))||!1,o=r?!1:(n==null?void 0:n.some(d=>{var f;return((f=d.venue)==null?void 0:f.id)===e&&d.role==="manager"}))||!1,l=(u=(c=n==null?void 0:n[0])==null?void 0:c.venue)==null?void 0:u.id;return{hasAccess:a,isManager:o,myVenueId:l,isLoading:r,isFetching:i}}function N8e(e,t){return st({queryKey:["venue-staff-search",e,t],queryFn:async()=>{if(!t||t.length<2)return[];const{data:n,error:r}=await re.functions.invoke("venue-staff-manage",{body:{action:"search_users",venueId:e,query:t}});if(r)throw r;if(n!=null&&n.error)throw new Error(n.error);return(n==null?void 0:n.users)??[]},enabled:!!e&&t.length>=2,staleTime:3e4})}function k8e(){const e=Ye();return dt({mutationFn:async t=>{var i;const{data:n,error:r}=await re.functions.invoke("venue-staff-manage",{body:{action:"add",...t}});if(r){const a=r.context;let o=r.message;try{const l=await((i=a==null?void 0:a.json)==null?void 0:i.call(a));l!=null&&l.error&&(o=l.error)}catch{}throw new Error(o)}if(n!=null&&n.error)throw new Error(n.error);return n.member},onSuccess:(t,n)=>
1186{e.invalidateQueries({queryKey:["venue-staff",n.venueId]}),e.invalidateQueries({queryKey:["venues-manager-counts"]}),dn({title:"Membre ajouté",description:"L'utilisateur a été ajouté à l'équipe."})},onError:t=>{dn({title:"Erreur",description:t.message,variant:"destructive"})}})}function C8e(){const e=Ye();return dt({mutationFn:async t=>{var i;const{data:n,error:r}=await re.functions.invoke("venue-staff-manage",{body:{action:"add_by_email",...t}});if(r){const a=r.context;let o=r.message;try{const l=await((i=a==null?void 0:a.json)==null?void 0:i.call(a));l!=null&&l.error&&(o=l.error)}catch{}throw new Error(o)}if(n!=null&&n.error)throw new Error(n.error);return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["venue-staff",n.venueId]}),e.invalidateQueries({queryKey:["venues-manager-counts"]}),dn({title:t.accountCreated?"Invitation envoyée":"Membre ajouté",description:t.accountCreated?`Compte créé pour ${n.email}. Email d'invitation envoyé.`:"L'utilisateur a été ajouté à l'équipe."})},onError:t=>{dn({title:"Erreur",description:t.message,variant:"destructive"})}})}const E8e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function rP(e){return E8e.test(e.trim())}function S8e({email:e,isPending:t,onSubmit:n}){const[r,i]=N.useState(""),[a,o]=N.useState("staff"),l=rP(e);return s.jsxs("div",{className:"rounded-lg border border-dashed border-primary/40 bg-primary/5 p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"w-9 h-9 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:s.jsx(wr,{className:"w-4 h-4 text-primary"})}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium",children:"Aucun compte trouvé"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:l?`Inviter ${e} — un compte sera créé et un email d'invitation envoyé.`:"Tapez une adresse email valide pour inviter un nouveau membre."})]})]}),l&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"invite-firstname",className:"text-xs",children:"Prénom (optionnel)"}),s.jsx(Ue,{id:"invite-firstname",value:r,onChange:c=>i(c.target.value),placeholder:"Pour personnaliser l'email",maxLength:60})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{className:"text-xs",children:"Rôle"}),s.jsxs(ud,{value:a,onValueChange:c=>o(c),className:"space-y-2",children:[s.jsxs("label",{htmlFor:"invite-role-manager",className:"flex items-start gap-3 p-2.5 rounded-md border border-border cursor-pointer hover:bg-muted/50 transition-colors has-[:checked]:border-primary has-[:checked]:bg-primary/5",children:[s.jsx(ui,{value:"manager",id:"invite-role-manager"}),s.jsx("div",{className:"flex-1",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(sa,{className:"w-4 h-4 text-primary"}),s.jsx("span",{className:"font-medium text-sm",children:"Manager"})]})})]}),s.jsxs("label",{htmlFor:"invite-role-staff",className:"flex items-start gap-3 p-2.5 rounded-md border border-border cursor-pointer hover:bg-muted/50 transition-colors has-[:checked]:border-primary has-[:checked]:bg-primary/5",children:[s.jsx(ui,{value:"staff",id:"invite-role-staff"}),s.jsx("div",{className:"flex-1",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Cs,{className:"w-4 h-4 text-muted-foreground"}),s.jsx("span",{className:"font-medium text-sm",children:"Staff"})]})})]})]})]}),s.jsx(Q,{className:"w-full",disabled:t,onClick:()=>n({email:e.trim().toLowerCase(),role:a,firstName:r.trim()||void 0}),children:t?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),"Invitation..."]}):"Inviter et ajouter à l'équipe"})]})]})}function uB(e){return e.display_name?e.display_name:`${e.first_name||""} ${e.last_name||""}`.trim()||e.email.split("@")[0]}function A8e({venueId:e,venueName:t,open:n,onOpenChange:r}){const[i,a]=N.useState(""),[o,l]=N.useState(""),[c,u]=N.useState(null),[d,f]=N.useState("staff"),h=k8e(),p=C8e(),{data:x=[],isLoading:y}=N8e(e,o);N.useEffect(()=>{const j=setTimeout(()=>l(i),300);return()=>clearTimeout(j)},[i]);const b=()=>{u(null),f("staff"),a(""),l("")},w=()=>{b(),r(!1)},_=async()=>{c&&(await h.mutateAsync({venueId:e,userId:c.id,role:d}),b(),r(!1))};return s.jsx(Ln,{open:n,onOpenChange:j=>j?r(!0):w(),children:s.jsxs(Dn,{className:"sm:max-w-md",children:[s.jsxs(Un,{children:[s.jsxs(qn,{className:"flex items-center gap-2",children:[s.jsx(cs,{className:"w-5 h-5 text-primary"}),"Ajouter un membre"]}),s.jsxs(qr,{children:["Ajouter un collaborateur à l'équipe de ",t]})]}),s.jsxs("div",{className:"space-y-6 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{children:"Rechercher un utilisateur"}),c?s.jsxs("div",{className:"flex items-center justify-between p-3 bg-secondary/50 rounded-lg border border-border",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:s.jsx(Cs,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"font-medium text-sm truncate",children:uB(c)}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:c.email})]})]}),s.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>u(null),children:s.jsx(Er,{className:"w-4 h-4"})})]}):s.jsxs(Lu,{className:"border border-border rounded-lg",shouldFilter:!1,children:[s.jsx(Gb,{placeholder:"Email, nom ou prénom...",value:i,onValueChange:a,className:"h-11"}),s.jsx(Fu,{children:i.length<2?s.jsxs("div",{className:"py-6 text-center text-sm text-muted-foreground",children:[s.jsx(_o,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),"Tapez au moins 2 caractères"]}):y?s.jsxs("div",{className:"py-6 text-center text-sm text-muted-foreground",children:[s.jsx(We,{className:"w-6 h-6 mx-auto mb-2 animate-spin"}),"Recherche..."]}):x.length===0?s.jsxs("div",{className:"py-4 px-2 space-y-3",children:[s.jsx("div",{className:"text-center text-xs text-muted-foreground",children:"Aucun utilisateur trouvé."}),rP(i)&&s.jsx(S8e,{email:i,isPending:p.isPending,onSubmit:async j=>{await p.mutateAsync({venueId:e,...j}),b(),r(!1)}}),!rP(i)&&s.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"Tapez une adresse email pour inviter un nouveau membre."})]}):s.jsx(ml,{children:x.map(j=>s.jsx(Oa,{value:j.id,onSelect:()=>{u(j),a("")},className:"cursor-pointer",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"font-medium",children:uB(j)}),s.jsx("span",{className:"text-xs text-muted-foreground",children:j.email})]})},j.id))})})]})]}),c&&s.jsxs("div",{className:"space-y-3",children:[s.jsx(Fe,{children:"Rôle"}),s.jsxs(ud,{value:d,onValueChange:j=>
1186f(j),className:"space-y-3",children:[s.jsxs("label",{htmlFor:"vrole-manager",className:"flex items-start gap-3 p-3 rounded-lg border border-border cursor-pointer hover:bg-muted/50 transition-colors has-[:checked]:border-primary has-[:checked]:bg-primary/5",children:[s.jsx(ui,{value:"manager",id:"vrole-manager"}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(sa,{className:"w-4 h-4 text-primary"}),s.jsx("span",{className:"font-medium text-sm",children:"Manager"})]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Gestion complète du lieu, événements et équipe"})]})]}),s.jsxs("label",{htmlFor:"vrole-staff",className:"flex items-start gap-3 p-3 rounded-lg border border-border cursor-pointer hover:bg-muted/50 transition-colors has-[:checked]:border-primary has-[:checked]:bg-primary/5",children:[s.jsx(ui,{value:"staff",id:"vrole-staff"}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Cs,{className:"w-4 h-4 text-muted-foreground"}),s.jsx("span",{className:"font-medium text-sm",children:"Staff"})]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Check-in et consommations uniquement"})]})]})]})]})]}),s.jsxs(Pi,{children:[s.jsx(Q,{variant:"outline",onClick:w,children:"Annuler"}),s.jsx(Q,{onClick:_,disabled:!c||h.isPending,children:h.isPending?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),"Ajout..."]}):"Ajouter à l'équipe"})]})]})})}function T8e({venueId:e,venueName:t}){const{data:n,isLoading:r}=Mie(e),{isManager:i}=WC(e);Uie(e);const a=Jie(),o=Zie(),[l,c]=N.useState(!1),[u,d]=N.useState(null),[f,h]=N.useState(null),p=N.useMemo(()=>(n??[]).filter(b=>b.role==="manager").length,[n]),x=async()=>{u&&(await a.mutateAsync({venueUserId:u.id,venueId:e}),d(null))},y=async()=>{if(!f)return;const b=f.currentRole==="manager"?"staff":"manager";await o.mutateAsync({venueUserId:f.id,venueId:e,role:b}),h(null)};return s.jsxs(s.Fragment,{children:[s.jsxs(Se,{className:"border-border/50",children:[s.jsxs(kt,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[s.jsxs(Et,{className:"flex items-center gap-2 font-display text-xl",children:[s.jsx(sn,{className:"w-5 h-5 text-primary"}),"Équipe"]}),i&&s.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>c(!0),className:"gap-2",children:[s.jsx(cs,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Ajouter un membre"}),s.jsx("span",{className:"sm:hidden",children:"Ajouter"})]})]}),s.jsxs(De,{children:[r?s.jsx("div",{className:"space-y-3",children:[1,2].map(b=>s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ie,{className:"w-10 h-10 rounded-full"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(Ie,{className:"h-4 w-32 mb-1"}),s.jsx(Ie,{className:"h-3 w-16"})]})]},b))}):!n||n.length===0?s.jsxs("div",{className:"text-center py-8",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-muted flex items-center justify-center mx-auto mb-3",children:s.jsx(sn,{className:"w-6 h-6 text-muted-foreground"})}),s.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Aucun membre dans l'équipe pour le moment."}),i&&s.jsxs(Q,{size:"sm",onClick:()=>c(!0),className:"gap-2",children:[s.jsx(cs,{className:"w-4 h-4"}),"Ajouter votre premier collaborateur"]})]}):s.jsx("div",{className:"space-y-2",children:n.map(b=>{var E,S,T;const w=((E=b.profile)==null?void 0:E.display_name)||`${((S=b.profile)==null?void 0:S.first_name)||""} ${((T=b.profile)==null?void 0:T.last_name)||""}`.trim()||"Utilisateur",_=b.role==="manager",j=_&&p<=1;return s.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 group",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-secondary flex items-center justify-center shrink-0",children:_?s.jsx(sa,{className:"w-5 h-5 text-primary"}):s.jsx(Cs,{className:"w-5 h-5 text-muted-foreground"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-medium text-sm truncate",children:w}),s.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:b.role})]}),i&&s.jsxs(eh,{children:[s.jsx(th,{asChild:!0,children:s.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:s.jsx(Cb,{className:"w-4 h-4"})})}),s.jsxs(yd,{align:"end",children:[s.jsxs(Dr,{disabled:j,onClick:()=>h({id:b.id,name:w,currentRole:b.role}),children:[s.jsx(xo,{className:"w-4 h-4 mr-2"}),"Passer en ",_?"Staff":"Manager",j&&s.jsx("span",{className:"ml-2 text-[10px] text-muted-foreground",children:"(dernier manager)"})]}),s.jsx(Vu,{}),s.jsxs(Dr,{className:"text-destructive focus:text-destructive",disabled:j,onClick:()=>d({id:b.id,name:w}),children:[s.jsx(ua,{className:"w-4 h-4 mr-2"}),"Retirer de l'équipe"]})]})]})]},b.id)})}),!r&&!i&&s.jsxs("p",{className:"mt-4 text-xs text-muted-foreground",children:["Seul un manager du lieu peut ajouter, promouvoir ou retirer un membre. Demande à un manager de ",t," de te promouvoir."]})]})]}),s.jsx(A8e,{venueId:e,venueName:t,open:l,onOpenChange:c}),s.jsx(yr,{open:!!u,onOpenChange:b=>!b&&d(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Retirer ce membre ?"}),s.jsxs(lr,{children:["Êtes-vous sûr de vouloir retirer"," ",s.jsx("strong",{children:u==null?void 0:u.name})," de l'équipe de ",t," ? Cette personne perdra l'accès à la gestion du lieu."]})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsx(vr,{onClick:x,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Retirer"})]})]})}),s.jsx(yr,{open:!!f,onOpenChange:b=>!b&&h(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Changer le rôle ?"}),s.jsxs(lr,{children:["Passer ",s.jsx("strong",{children:f==null?void 0:f.name})," en"," ",(f==null?void 0:f.currentRole)==="manager"?"Staff":"Manager"," ","?"]})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsx(vr,{onClick:y,children:"Confirmer"})]})]})})]})}const P8e=()=>{const{signOut:e}=Tt(),{data:t,isLoading:n}=Sje(),{data:r,isLoading:i}=UI(),a=r&&r.length>0,o=a?r[0].venue:null,{data:l=[],isLoading:c}=Vse(o==null?void 0:o.id),{data:u=[],isLoading:d}=dRe(o==null?void 0:o.id),{data:f}=fRe(o==null?void 0:o.id),h=N.useMemo(()=>[...l,...u].map(S=>S.id),[l,u]),{data:p}=jR(h),[x,y]=N.useState(!1),b=n||i,w=(t==null?void 0:t.status)==="pending",_=(t==null?void 0:t.status)==="rejected",j=l.length>0?"upcoming":u.length>0?"past":"upcoming";if(b)return s.jsx(Se,{className:"border-border/50",children:s.jsx(De,{className:"py-12",children:s.jsxs("div",{className:"flex flex-col items-center gap-4",children:[s.jsx(Ie,{className:"w-20 h-20 rounded-full"}),s.jsx(Ie,{className:"h-8 w-64"}),s.jsx(Ie,{className:"h-4 w-80"})]})})});if(!t&&!a)return s.jsx(Se,{className:"border-border/50 text-center",children:s.jsxs(De,{className:"py-12",children:[s.jsx("div",{className:"w-20 h-20 rounded-full bg-muted flex items-center justify-center mx-auto mb-6",children:s.jsx(El,{className:"w-10 h-10 text-muted-foreground"})}),s.jsx("h1",{className:"font-display text-2xl font-bold text-foreground mb-4",children:"Aucune demande trouvée"}),s.jsx("p",{className:"text-muted-foreground mb-8",children:"Nous n'avons pas trouvé de demande de partenariat associée à votre compte."}),s.jsx(Q,{variant:"outline",onClick:()=>e(),children:"Se déconnecter"})]})});if(_)return s.jsxs("div",{className:"space-y-8",children:[s.jsx(Se,{className:"border-destructive/50 text-center",children:s.jsxs(De,{className:"py-12",children:[s.jsx("div",{className:"w-20 h-20 rounded-full bg-destructive/10 flex items-center justify-center mx-auto mb-6",children:s.jsx(hi,{className:"w-10 h-10 text-destructive"})}),s.jsx("h1",{className:"font-display text-2xl md:text-3xl font-bold text-foreground mb-4",children:"Demande non retenue"}),s.jsxs("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:['Malheureusement, votre demande de partenariat pour "',t==null?void 0:t.bar_name,`" n'a pas été retenue.`]}),(t==null?void 0:t.admin_notes)&&s.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 max-w-sm mx-auto mb-8 text-left",children:[s.jsx("p",{className:"text-sm font-medium mb-1",children:"Note de l'équipe :"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:t.admin_notes})]}),s.jsx("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:s.jsxs(Q,{variant:"outline",className:"gap-2",children:[s.jsx(wr,{className:"w-4 h-4"}),"Nous contacter"]})})]})}),s.jsx("div",{className:"text-center",children:s.jsx(Q,{variant:"ghost",className:"text-muted-foreground",onClick:()=>e(),children:"Se déconnecter"})})]});if(w)return s.jsxs("div",{className:"space-y-8",children:[s.jsx(Se,{className:"border-border/50 text-center",children:s.jsxs(De,{className:"py-12",children:[s.jsx("div",{className:"w-20 h-20 rounded-full bg-warning/10 flex items-center justify-center mx-auto mb-6",children:s.jsx(Vt,{className:"w-10 h-10 text-warning animate-pulse"})}),s.jsx("h1",{className:"font-display text-2xl md:text-3xl font-bold text-foreground mb-4",children:"Demande en cours d'examen"}),s.jsx("p",{className:"text-muted-foreground mb-2",children:s.jsx("span",{className:"font-medium text-foreground",children:t==null?void 0:t.bar_name})}),s.jsx("p",{className:"text-muted-foreground mb-8 max-w-md mx-auto",children:"Merci pour votre intérêt ! Notre équipe examine votre demande de partenariat. Vous recevrez une réponse par email dans les 48 heures."}),s.jsxs("div",{className:"bg-secondary/50 rounded-lg p-6 max-w-sm mx-auto mb-8",children:[s.jsxs("h3",{className:"font-semibold mb-4 flex items-center justify-center gap-2",children:[s.jsx(Vi,{className:"w-5 h-5 text-primary"}),"Prochaines étapes"]}),s.jsx("ul",{className:"space-y-3 text-left text-sm",children:["Validation de votre demande","Appel de présentation (15 min)","Configuration de votre espace","Premier tournoi organisé !"].map((S,T)=>s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-xs ${T===0?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:T+1}),s.jsx("span",{className:T===0?"text-foreground":"text-muted-foreground",children:S})]},T))})]}),s.jsx("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:s.jsxs(Q,{variant:"outline",className:"gap-2",children:[s.jsx(wr,{className:"w-4 h-4"}),"Nous contacter"]})})]})}),s.jsx("div",{className:"text-center",children:s.jsx(Q,{variant:"ghost",className:"text-muted-foreground",onClick:()=>e(),children:"Se déconnecter"})})]});const E=(o==null?void 0:o.name)||(t==null?void 0:t.bar_name)||"Votre établissement";return s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 bg-success/10 rounded-full text-sm text-success mb-4",children:[s.jsx(Jr,{className:"w-4 h-4"}),"Partenaire vérifié"]}),s.jsx("h1",{className:"font-display text-3xl md:text-4xl font-bold text-foreground mb-2",children:E}),s.jsx("p",{className:"text-muted-foreground",children:"Gérez vos tournois et suivez vos performances."})]}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{label:"Tournois organisés",value:(f==null?void 0:f.total)||0,icon:Jn},{label:"Participants total",value:(f==null?void 0:f.totalParticipants)||0,icon:sn},{label:"Ce mois",value:(f==null?void 0:f.thisMonth)||0,icon:Jn},{label:"Note moyenne",value:"-",icon:Vi}].map((S,T)=>s.jsx(Se,{className:"border-border/50",children:s.jsxs(De,{className:"p-4 text-center",children:[s.jsx(S.icon,{className:"w-5 h-5 text-primary mx-auto mb-2"}),s.jsx("p",{className:"text-2xl font-bold text-foreground",children:S.value}),s.jsx("p",{className:"text-xs text-muted-foreground",children:S.label})]})},T))}),s.jsxs(Se,{className:"border-border/50",children:[s.jsx(kt,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Jn,{className:"w-5 h-5 text-primary"}),s.jsx(Et,{className:"font-display text-xl",children:"Vos événements"})]}),s.jsxs(Q,{onClick:()=>y(!0),size:"sm",className:"gap-2",children:[s.jsx(qa,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Créer un tournoi"}),s.jsx("span",{className:"sm:hidden",children:"Créer"})]})]})}),s.jsx(De,{children:s.jsxs(Ka,{defaultValue:j,className:"w-full",children:[s.jsxs(Ca,{className:"grid w-full grid-cols-2 mb-4 bg-muted/30 backdrop-blur-sm p-1 h-auto",children:[s.jsxs(vn,{value:"upcoming",className:"flex items-center gap-1.5 py-2.5 text-sm data-[state=active]:bg-primary/10 data-[state=active]:text-primary transition-all",children:[s.jsx(Mk,{className:"w-4 h-4"}),s.jsx("span",{children:"À venir"}),l.length>0&&s.jsx(we,{variant:"secondary",className:"ml-1 h-5 min-w-5 px-1.5 text-xs bg-primary/20 text-primary border-0",children:l.length})]}),s.jsxs(vn,{value:"past",className:"flex items-center gap-1.5 py-2.5 text-sm data-[state=active]:bg-emerald-500/10 data-[state=active]:text-emerald-600 transition-all",children:[s.jsx(i1,{className:"w-4 h-4"}),s.jsx("span",{children:"Historique"}),u.length>0&&s.jsx(we,{variant:"secondary",className:"ml-1 h-5 min-w-5 px-1.5 text-xs border-0",children:u.length})]})]}),s.jsx(Sn,{value:"upcoming",className:"mt-0",children:c?s.jsx("div",{className:"space-y-3",children:[1,2].map(S=>s.jsx(Ie,{className:"h-20 w-full"},S))}):l.length>0?s.jsx("div",{className:"space-y-3",children:l.map(S=>s.jsx(lB,{event:S,ticketCount:(p==null?void 0:p[S.id])||0},S.id))}):s.jsxs("div",{className:"text-center py-8",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-secondary flex items-center justify-center mx-auto mb-4",children:s.jsx(Jn,{className:"w-8 h-8 text-muted-foreground"})}),s.jsx("h3",{className:"font-display text-lg font-semibold mb-2",children:"Aucun tournoi prévu"}),s.jsx("p",{className:"text-muted-foreground text-sm max-w-md mx-auto mb-6",children:"Créez votre premier tournoi ou contactez-nous pour être accompagné dans la création."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[s.jsxs(Q,{onClick:()=>y(!0),className:"gap-2",children:[s.jsx(qa,{className:"w-4 h-4"}),"Créer un tournoi"]}),s.jsxs(Q,{variant:"outline",className:"gap-2",children:[s.jsx(wr,{className:"w-4 h-4"}),"Nous contacter"]})]})]})}),s.jsx(Sn,{value:"past",className:"mt-0",children:d?s.jsx("div",{className:"space-y-3",children:[1,2].map(S=>s.jsx(Ie,{className:"h-20 w-full"},S))}):u.length>0?s.jsx("div",{className:"space-y-3",children:u.map(S=>s.jsx(lB,{event:S,ticketCount:(p==null?void 0:p[S.id])||0},S.id))}):s.jsxs("div",{className:"text-center py-8",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-500/10 flex items-center justify-center mx-auto mb-4",children:s.jsx(i1,{className:"w-8 h-8 text-emerald-600/50"})}),s.jsx("h3",{className:"font-display text-lg font-semibold mb-2",children:"Aucun tournoi terminé"}),s.jsx("p",{className:"text-muted-foreground text-sm max-w-md mx-auto",children:"Une fois vos premiers tournois terminés, vous pourrez consulter les résultats et statistiques ici."})]})})]})})]}),o&&s.jsx(T8e,{venueId:o.id,venueName:o.name}),o&&s.jsx(Qie,{venueId:o.id}),s.jsx("div",{className:"text-center",children:s.jsx(Q,{variant:"ghost",className:"text-muted-foreground",onClick:()=>e(),children:"Se déconnecter"})}),s.jsx(sw,{open:x,onOpenChange:y,preselectedVenueId:o==null?void 0:o.id,venueName:o==null?void 0:o.name})]})},O8e=()=>{const e=fa();return N.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),s.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),s.jsx("a",{href:"/",className:"text-primary underline hover:text-primary/90",children:"Return to Home"})]})})};function D8e(e){const t=e.match(/^#?([0-9a-f]{6})$/i);if(!t)return"#0D0D0D";const n=parseInt(t[1].slice(0,2),16),r=parseInt(t[1].slice(2,4),1
11866),i=parseInt(t[1].slice(4,6),16);return(.299*n+.587*r+.114*i)/255>.6?"#0D0D0D":"#F5F3EE"}function eae({event:e,ticketCount:t=0,interestedCount:n=0}){var R,L,M,B,U,F;const r=e.capacity-t,i=r<=0,a=!i&&r<=3,o=!i&&n>=10,l=new Date(e.event_date),c=Ze(l,"d",{locale:pt}),u=Ze(l,"MMM",{locale:pt}).replace(".","").toUpperCase(),d=Ze(l,"EEE",{locale:pt}).replace(".","").toUpperCase().slice(0,3),f=Ze(l,"HH:mm",{locale:pt}),h=Math.round(e.price_cents/100),p=Math.round((e.credit_amount_cents??0)/100),x=od(e,e.venue??null),y=x.mode==="paper",b=y?!0:p>0,w=y?x.hint||x.bullets.map(H=>H.name).join(" · ")||"Remis sur place par le lieu":"Boisson ou snack à consommer sur place",_=((R=e.venue)==null?void 0:R.cover_image_url)??null,j=((L=e.venue)==null?void 0:L.brand_color)||"#F5D3DC",E=D8e(j),S=C0(l,new Date),T=i?null:QI(l)&&S>=0?`Aujourd'hui · ${f}`:FNe(l)?`Demain · ${f}`:null,P=e.venue?wR(e.venue.city||"",e.venue.postal_code,e.venue.country,e.venue.address):null,O=oee((M=e.venue)==null?void 0:M.district_label,(B=e.venue)==null?void 0:B.name),D=[(U=e.venue)==null?void 0:U.name,O||P].filter(Boolean).join(" · ");return s.jsx(Se,{className:`group relative overflow-hidden rounded-2xl border border-[#0D0D0D]/5 bg-card transition-all duration-300
1187        ${i?"opacity-70":"hover:-translate-y-0.5 hover:shadow-[0_12px_40px_-14px_rgba(13,13,13,0.25)]"}`,children:s.jsxs(Pe,{to:`/events/${e.id}`,className:"flex flex-col h-full focus:outline-none focus-visible:ring-2 focus-visible:ring-[#AAFF00]",children:[s.jsxs("div",{className:"relative w-full aspect-[16/7] overflow-hidden",style:{backgroundColor:j},children:[_&&s.jsx("img",{src:_,alt:((F=e.venue)==null?void 0:F.name)??"",loading:"lazy",className:"absolute inset-0 w-full h-full object-cover transition-transform duration-500 group-hover:scale-[1.03]"}),s.jsxs("div",{className:"absolute top-3 left-3 rounded-xl px-3 py-2 backdrop-blur-sm shadow-sm flex flex-col items-center leading-none font-bricolage",style:{backgroundColor:_?"rgba(245,243,238,0.95)":"rgba(255,255,255,0.55)",color:_?"#0D0D0D":E,border:_?"none":"1px solid rgba(13,13,13,0.08)"},children:[s.jsx("span",{className:"font-mono text-[9px] tracking-[0.2em] opacity-60",children:d}),s.jsx("span",{className:"font-extrabold text-3xl leading-none mt-0.5",children:c}),s.jsx("span",{className:"font-mono text-[11px] tracking-[0.15em] mt-1 opacity-80",children:u})]}),s.jsxs("div",{className:"absolute top-3 right-3 flex flex-col items-end gap-1.5",children:[a&&s.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-[10px] font-bold uppercase tracking-wider bg-[#AAFF00] text-[#0D0D0D] shadow-sm",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#0D0D0D] animate-pulse"}),"Plus que ",r," ",r>1?"places":"place"]}),T&&s.jsx("span",{className:"px-2.5 py-1 rounded-full text-[10px] font-bold uppercase tracking-wider bg-[#0D0D0D] text-[#F5F3EE] shadow-sm",children:T}),o&&s.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-[10px] font-bold uppercase tracking-wider bg-[#F5F3EE]/95 text-[#0D0D0D] shadow-sm border border-[#0D0D0D]/10",children:[s.jsx(oj,{className:"w-3 h-3 text-[#FF6B35]",strokeWidth:2.5}),n," intéressés"]})]}),i&&s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40",children:s.jsx("span",{className:"px-4 py-1.5 rounded-full bg-[#F5F3EE] text-[#0D0D0D] text-xs font-bold uppercase tracking-[0.2em]",children:"Complet"})})]}),s.jsx("div",{className:"h-1 w-full",style:{backgroundColor:j}}),s.jsxs("div",{className:"p-4 flex flex-col gap-3 flex-1",children:[s.jsx("h3",{className:"font-bricolage font-extrabold text-base sm:text-lg leading-tight line-clamp-2 text-[#0D0D0D]",children:e.title}),s.jsxs("div",{className:"flex items-center gap-3 text-xs text-[#0D0D0D]/70 -mt-1 flex-wrap",children:[s.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono",children:[s.jsx(Vt,{className:"w-3 h-3 text-[#0D0D0D]/50",strokeWidth:2}),f]}),e.venue&&s.jsxs("span",{className:"inline-flex items-center gap-1.5 min-w-0",children:[s.jsx(gn,{className:"w-3 h-3 text-[#0D0D0D]/50 flex-shrink-0",strokeWidth:2}),s.jsx("span",{className:"truncate",children:D||e.venue.city})]})]}),b?s.jsxs("div",{className:"rounded-xl border border-[#AAFF00]/60 bg-[#AAFF00]/10 p-3 flex items-center gap-3",children:[s.jsx("div",{className:"flex items-center justify-center w-9 h-9 rounded-full bg-[#0D0D0D] flex-shrink-0",children:s.jsx(Uge,{className:"w-4 h-4 text-[#AAFF00]",strokeWidth:2.5})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-baseline gap-1.5 flex-wrap",children:[s.jsxs("span",{className:"font-bricolage font-extrabold text-xl text-[#0D0D0D] leading-none",children:[h,"€"]}),s.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-[#0D0D0D]/60",children:"ticket"}),s.jsx("span",{className:"text-[10px] text-[#0D0D0D]/40",children:"·"}),s.jsx("span",{className:"text-xs font-semibold text-[#0D0D0D]",children:y?x.shortLabel:s.jsxs(s.Fragment,{children:["dont ",s.jsxs("span",{className:"font-bricolage font-extrabold text-base",children:[p,"€"]})," offerts au bar"]})})]}),s.jsx("p",{className:"text-[10px] text-[#0D0D0D]/60 mt-0.5 leading-tight line-clamp-2",children:w})]})]}):s.jsxs("div",{className:"flex items-baseline gap-1.5",children:[s.jsx("span",{className:"font-bricolage font-extrabold text-2xl text-[#0D0D0D]",children:h===0?"Gratuit":`${h}€`}),h>
11870&&s.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-[#0D0D0D]/60",children:"ticket"})]}),s.jsx("div",{className:"mt-auto pt-1",children:s.jsx(Q,{disabled:i,tabIndex:-1,className:`w-full font-semibold text-sm h-11 rounded-full transition-all duration-300 border-none ${i?"bg-[#0D0D0D]/10 text-[#0D0D0D]/40 cursor-not-allowed":"bg-[#0D0D0D] text-[#F5F3EE] hover:bg-[#0D0D0D]/90"}`,children:i?"Rejoindre la liste d'attente":s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:["Voir le tournoi",s.jsx(Sr,{className:"w-3.5 h-3.5",strokeWidth:2.5})]})})})]})]})})}const I8e=[{value:"today",label:"Aujourd'hui"},{value:"week",label:"Cette semaine"},{value:"month",label:"Ce mois"}];function R8e({value:e,onChange:t}){const n=r=>{t(e===r?"all":r)};return s.jsx("div",{className:"flex flex-wrap gap-2",children:I8e.map(({value:r,label:i})=>s.jsx("button",{onClick:()=>n(r),className:ae("inline-flex items-center px-4 py-2 rounded-full","text-xs font-medium transition-all duration-200","border",e!==r&&["bg-card border-[#0D0D0D]/5 text-[#0D0D0D]/65","hover:border-[#AAFF00] hover:text-[#0D0D0D]"],e===r&&["bg-[#AAFF00] border-[#AAFF00] text-[#0D0D0D] shadow-[0_4px_14px_-4px_rgba(170,255,0,0.6)]"]),children:i},r))})}function sP(e){if(!e)return"";if(e==="paris:all")return"Paris - Tous";if(e.startsWith("paris:")){const t=e.slice(6),n=vR.find(r=>r.value===t);return n?`Paris ${n.label}`:`Paris ${t}e`}if(e.startsWith("city:"))return e.slice(5);if(e.startsWith("intl:")){const[t,n]=e.slice(5).split("|");return`${t}, ${n}`}return e}function M8e({value:e,onChange:t,parisArrondissements:n,frenchCities:r,internationalCities:i,hasParisVenues:a}){const[o,l]=N.useState(!1),c=N.useMemo(()=>vR.filter(h=>n.includes(h.value)),[n]),u=a,d=N.useMemo(()=>{const h=[];return h.push({value:"",label:"Tout Paris",group:"reset",searchTerms:"tout paris reset effacer"}),a&&(h.push({value:"paris:all",label:"Paris - Tous les arrondissements",group:"paris",searchTerms:"paris tous arrondissements"}),c.forEach(p=>{h.push({value:`paris:${p.value}`,label:`Paris ${p.label}`,group:"paris",searchTerms:`paris ${p.label} ${p.value} ${p.postalCode}`})})),h},[a,c]),f=e?sP(e):"Arrondissement";return u?s.jsxs(Vm,{open:o,onOpenChange:l,children:[s.jsx(Hm,{asChild:!0,children:s.jsxs(Q,{variant:"outline",role:"combobox","aria-expanded":o,className:ae("w-full sm:w-[240px] justify-between min-h-[40px] rounded-full","bg-card border border-[#0D0D0D]/5 hover:border-[#AAFF00] hover:bg-card","transition-all duration-200 text-sm font-medium"),children:[s.jsx("span",{className:"truncate",children:f}),s.jsx(Gge,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),s.jsx(Lf,{className:ae("w-[var(--radix-popover-trigger-width)] sm:w-[280px] p-0","bg-popover/95 backdrop-blur-lg border-primary/10"),align:"start",children:s.jsxs(Lu,{children:[s.jsx(Gb,{placeholder:"Rechercher un arrondissement...",className:"h-11"}),s.jsxs(Fu,{className:"max-h-[60vh]",children:[s.jsx(CC,{children:"Aucun arrondissement trouvé."}),s.jsx(ml,{children:d.filter(h=>h.group==="reset").map(h=>s.jsxs(Oa,{value:h.searchTerms,onSelect:()=>{t(""),l(!1)},className:"min-h-[44px] cursor-pointer",children:[s.jsx(is,{className:ae("mr-2 h-4 w-4",e===""?"opacity-100":"opacity-0")}),h.label]},h.value))}),a&&s.jsxs(s.Fragment,{children:[s.jsx(jv,{}),s.jsx(ml,{heading:"Paris",children:d.filter(h=>h.group==="paris").map(h=>s.jsxs(Oa,{value:h.searchTerms,onSelect:()=>{t(h.value),l(!1)},className:"min-h-[44px] cursor-pointer",children:[s.jsx(is,{className:ae("mr-2 h-4 w-4",e===h.value?"opacity-100":"opacity-0")}),h.label]},h.value))})]})]})]})})]}):null}function L8e({selectedFormat:e,selectedCadence:t,onFormatChange:n,onCadenceChange:r}){const[i,a]=N.useState(!1),o=[e,t].filter(l=>l&&l!=="all").length;return s.jsxs(Ix,{open:i,onOpenChange:a,children:[s.jsx(Rx,{asChild:!0,children:s.jsxs("button",{className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-primary transition-colors focus:outline-none focus-visible:text-primary",children:[s.jsx(uI,{className:"w-4 h-4"}),s.jsx("span",{children:"Filtres avancés"}),o>0&&s.jsx(we,{variant:"secondary",className:"ml-1 h-5 px-1.5 text-xs bg-primary/20 text-primary border-primary/30",children:o}),s.jsx(Wa,{className:ae("w-4 h-4 transition-transform duration-200",i&&"rotate-180")}
1187)]})}),s.jsx(Mx,{className:"pt-4 space-y-4 border-t border-primary/10 mt-4",children:s.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{className:"text-xs text-muted-foreground",children:"Format"}),s.jsxs(li,{value:e,onValueChange:n,children:[s.jsx(Gs,{className:"bg-card/80 backdrop-blur-sm",children:s.jsx(ci,{placeholder:"Tous les formats"})}),s.jsxs(Ks,{children:[s.jsx(Yn,{value:"all",children:"Tous les formats"}),yj.map(l=>s.jsx(Yn,{value:l.value,children:l.label},l.value))]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{className:"text-xs text-muted-foreground",children:"Cadence"}),s.jsxs(li,{value:t,onValueChange:r,children:[s.jsx(Gs,{className:"bg-card/80 backdrop-blur-sm",children:s.jsx(ci,{placeholder:"Toutes les cadences"})}),s.jsxs(Ks,{children:[s.jsx(Yn,{value:"all",children:"Toutes les cadences"}),xj.map(l=>s.jsxs(Yn,{value:l.value,children:[l.label," (",l.description,")"]},l.value))]})]})]})]})})]})}function p_({label:e,displayValue:t,isActive:n,icon:r,children:i,onClear:a}){const[o,l]=N.useState(!1);return s.jsxs(Vm,{open:o,onOpenChange:l,children:[s.jsx(Hm,{asChild:!0,children:s.jsxs("button",{className:ae("flex items-center gap-1.5 px-3 py-2 min-h-[44px] rounded-full","text-sm font-medium whitespace-nowrap shrink-0","border backdrop-blur-sm transition-all duration-200","snap-start scroll-ml-4","focus:outline-none focus-visible:ring-2 focus-visible:ring-primary",!n&&["bg-card/50 border-border/50 text-muted-foreground","hover:border-primary/30 hover:bg-card/70"],n&&["bg-primary/20 border-primary/50 text-primary","shadow-[0_0_12px_hsl(var(--primary)/0.2)]"]),children:[s.jsx(r,{className:"w-4 h-4"}),s.jsx("span",{className:"max-w-[120px] truncate",children:n&&t?t:e}),s.jsx(Wa,{className:ae("w-3 h-3 transition-transform duration-200",o&&"rotate-180")}),n&&s.jsx("button",{onClick:c=>{c.stopPropagation(),a()},className:"ml-0.5 p-0.5 rounded-full hover:bg-primary/30 transition-colors","aria-label":"Effacer le filtre",children:s.jsx(Er,{className:"w-3 h-3"})})]})}),s.jsx(Lf,{className:"w-72 p-0 bg-popover/95 backdrop-blur-lg border-primary/10",align:"start",sideOffset:8,children:i})]})}const dB="filter-swipe-hint-seen",F8e=3500;function $8e(){const[e,t]=N.useState(!1);return N.useEffect(()=>{if(localStorage.getItem(dB))return;t(!0);const r=setTimeout(()=>{t(!1),localStorage.setItem(dB,"1")},F8e);return()=>clearTimeout(r)},[]),e?s.jsx("div",{className:ae("absolute inset-x-0 -bottom-6 flex justify-center","animate-fade-in pointer-events-none"),children:s.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/80",children:[s.jsx(fp,{className:"w-3 h-3 animate-pulse"}),s.jsx("span",{children:"Swiper pour plus de filtres"}),s.jsx(la,{className:"w-3 h-3 animate-pulse"})]})}):null}const B8e=[{value:"all",label:"Toutes les dates"},{value:"today",label:"Aujourd'hui"},{value:"week",label:"Cette semaine"},{value:"month",label:"Ce mois"}],fB={today:"Aujourd'hui",week:"Cette semaine",month:"Ce mois"};function z8e({searchQuery:e,onSearchChange:t,dateRange:n,onDateRangeChange:r,selectedLocation:i,onLocationChange:a,parisArrondissements:o,hasParisVenues:l,frenchCities:c,internationalCities:u,selectedFormat:d,selectedCadence:f,onFormatChange:h,onCadenceChange:p,onClearFilters:x}){var j,E,S,T;const y=e||n!=="all"||i||d||f,b=N.useMemo(()=>vR.filter(P=>o.includes(P.value)),[o]),w=N.useMemo(()=>{const P=[];return P.push({value:"",label:"Toutes les villes",group:"reset",searchTerms:"toutes villes reset effacer"}),l&&(P.push({value:"paris:all",label:"Paris - Tous",group:"paris",searchTerms:"paris tous arrondissements"}),b.forEach(O=>{P.push({value:`paris:${O.value}`,label:`Paris ${O.label}`,group:"paris",searchTerms:`paris ${O.label} ${O.value} ${O.postalCode}`})})),c.forEach(O=>{P.push({value:`city:${O}`,label:O,group:"france",searchTerms:O.toLowerCase()})}),u.forEach(({city:O,country:D})=>{P.push({value:`intl:${O}|${D}`,label:`${O}, ${D}`,group:"international",searchTerms:`${O} ${D}`.toLowerCase()})}),P},[l,b,c,u]),_=l||c.length>0||u.length>0;return s.jsxs("div",{className:"bg-card rounded-2xl border border-[#0D0D0D]/5 p-5 md:p-6 space-y-5",children:[s.jsxs("div",{className:"relative",children:[s.jsx(_o,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[#0D0D0D]/40"}),s.jsx(Ue,{placeholder:"Où souhaitez-vous jouer ?",value:e,onCh
1187ange:P=>t(P.target.value),className:"pl-10 bg-background border border-[#0D0D0D]/5 rounded-full focus-visible:ring-1 focus-visible:ring-[#AAFF00] focus:border-[#AAFF00] text-sm h-10"})]}),s.jsxs("div",{className:"md:hidden relative pb-4",children:[s.jsx("div",{className:"absolute left-0 top-0 bottom-4 w-6 z-10 pointer-events-none",style:{background:"linear-gradient(to right, hsl(var(--card)), transparent)"}}),s.jsx("div",{className:"absolute right-0 top-0 bottom-4 w-6 z-10 pointer-events-none",style:{background:"linear-gradient(to left, hsl(var(--card)), transparent)"}}),s.jsxs("div",{className:ae("flex gap-2 overflow-x-auto pb-1 px-1 -mx-1","scrollbar-hide snap-x snap-mandatory","[&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]"),children:[s.jsx(p_,{label:"Quand",displayValue:fB[n],isActive:n!=="all",icon:Vt,onClear:()=>r("all"),children:s.jsx(Lu,{children:s.jsx(Fu,{children:s.jsx(ml,{children:B8e.map(P=>s.jsxs(Oa,{value:P.value,onSelect:()=>r(P.value),className:"min-h-[44px] cursor-pointer",children:[s.jsx(is,{className:ae("mr-2 h-4 w-4",n===P.value?"opacity-100":"opacity-0")}),P.label]},P.value))})})})}),_&&s.jsx(p_,{label:"Où",displayValue:sP(i),isActive:!!i,icon:gn,onClear:()=>a(""),children:s.jsxs(Lu,{children:[s.jsx(Gb,{placeholder:"Rechercher...",className:"h-10"}),s.jsxs(Fu,{className:"max-h-[50vh]",children:[s.jsx(CC,{children:"Aucune ville trouvée."}),s.jsx(ml,{children:w.filter(P=>P.group==="reset").map(P=>s.jsxs(Oa,{value:P.searchTerms,onSelect:()=>a(""),className:"min-h-[44px] cursor-pointer",children:[s.jsx(is,{className:ae("mr-2 h-4 w-4",i?"opacity-0":"opacity-100")}),P.label]},P.value))}),l&&s.jsxs(s.Fragment,{children:[s.jsx(jv,{}),s.jsx(ml,{heading:"Paris",children:w.filter(P=>P.group==="paris").map(P=>s.jsxs(Oa,{value:P.searchTerms,onSelect:()=>a(P.value),className:"min-h-[44px] cursor-pointer",children:[s.jsx(is,{className:ae("mr-2 h-4 w-4",i===P.value?"opacity-100":"opacity-0")}),P.label]},P.value))})]}),c.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(jv,{}),s.jsx(ml,{heading:"France",children:w.filter(P=>P.group==="france").map(P=>s.jsxs(Oa,{value:P.searchTerms,onSelect:()=>a(P.value),className:"min-h-[44px] cursor-pointer",children:[s.jsx(is,{className:ae("mr-2 h-4 w-4",i===P.value?"opacity-100":"opacity-0")}),P.label]},P.value))})]}),u.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(jv,{}),s.jsx(ml,{heading:"International",children:w.filter(P=>P.group==="international").map(P=>s.jsxs(Oa,{value:P.searchTerms,onSelect:()=>a(P.value),className:"min-h-[44px] cursor-pointer",children:[s.jsx(is,{className:ae("mr-2 h-4 w-4",i===P.value?"opacity-100":"opacity-0")}),P.label]},P.value))})]})]})]})}),s.jsx(p_,{label:"Cadence",displayValue:(j=xj.find(P=>P.value===f))==null?void 0:j.label,isActive:!!f&&f!=="all",icon:Vt,onClear:()=>p(""),children:s.jsx(Lu,{children:s.jsx(Fu,{children:s.jsxs(ml,{children:[s.jsxs(Oa,{value:"all",onSelect:()=>p(""),className:"min-h-[44px] cursor-pointer",children:[s.jsx(is,{className:ae("mr-2 h-4 w-4",!f||f==="all"?"opacity-100":"opacity-0")}),"Toutes les cadences"]}),xj.map(P=>s.jsxs(Oa,{value:P.value,onSelect:()=>p(P.value),className:"min-h-[44px] cursor-pointer",children:[s.jsx(is,{className:ae("mr-2 h-4 w-4",f===P.value?"opacity-100":"opacity-0")}),s.jsxs("div",{children:[s.jsx("span",{children:P.label}),s.jsxs("span",{className:"ml-1 text-xs text-muted-foreground",children:["(",P.description,")"]})]})]},P.value))]})})})}),s.jsx(p_,{label:"Format",displayValue:(E=yj.find(P=>P.value===d))==null?void 0:E.label,isActive:!!d&&d!=="all",icon:uI,onClear:()=>h(""),children:s.jsx(Lu,{children:s.jsx(Fu,{children:s.jsxs(ml,{children:[s.jsxs(Oa,{value:"all",onSelect:()=>h(""),className:"min-h-[44px] cursor-pointer",children:[s.jsx(is,{className:ae("mr-2 h-4 w-4",!d||d==="all"?"opacity-100":"opacity-0")}),"Tous les formats"]}),yj.map(P=>s.jsxs(Oa,{value:P.value,onSelect:()=>h(P.value),className:"min-h-[44px] cursor-pointer",children:[s.jsx(is,{className:ae("mr-2 h-4 w-4",d===P.value?"opacity-100":"opacity-0")}),P.label]},P.value))]})})})}),y&&s.jsxs("button",{onClick:x,className:ae("flex items-center gap-1.5 px-3 py-2 min-h-[44px] rounded-full","text-sm font-medium whitespace-nowrap shrink-0","border border-destructive/30 bg-destructive/10 text-destructive","hover:bg-destructive/20 transition-colors","snap-start scroll-ml-4"),children:[s.jsx(Er,{className:"w-4 h-4"}),"Effacer"]})]}),s.jsx($8e,{})]}),s.jsxs("div",{className:"hidden md:block space-y-5",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide flex items-center gap-1.5",children:[s.jsx(Vt,{className:"w-3.5 h-3.5"}),"Quand ?"]}),s.jsx(R8e,{value:n,onChange:r})]}),_&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide flex items-center gap-1.5",children:[s.jsx(gn,{className:"w-3.5 h-3.5"}),"Où ?"]}),s.jsx(M8e,{value:i,onChange:a,parisArrondissements:o,frenchCities:c,internationalCities:u,hasParisVenues:l})]}
1187),s.jsx(L8e,{selectedFormat:d,selectedCadence:f,onFormatChange:h,onCadenceChange:p}),y&&s.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-2 border-t border-border/50",children:[n!=="all"&&s.jsxs(we,{variant:"secondary",className:"gap-1 bg-primary/10 border-primary/20",children:[s.jsx(JS,{className:"w-3 h-3"}),fB[n],s.jsx("button",{onClick:()=>r("all"),className:"ml-1 hover:text-destructive transition-colors",children:s.jsx(Er,{className:"w-3 h-3"})})]}),i&&s.jsxs(we,{variant:"secondary",className:"gap-1 bg-primary/10 border-primary/20",children:[s.jsx(gn,{className:"w-3 h-3"}),sP(i),s.jsx("button",{onClick:()=>a(""),className:"ml-1 hover:text-destructive transition-colors",children:s.jsx(Er,{className:"w-3 h-3"})})]}),d&&s.jsxs(we,{variant:"secondary",className:"gap-1",children:[s.jsx(JS,{className:"w-3 h-3"}),(S=yj.find(P=>P.value===d))==null?void 0:S.label,s.jsx("button",{onClick:()=>h(""),className:"ml-1 hover:text-destructive transition-colors",children:s.jsx(Er,{className:"w-3 h-3"})})]}),f&&s.jsxs(we,{variant:"secondary",className:"gap-1",children:[s.jsx(JS,{className:"w-3 h-3"}),(T=xj.find(P=>P.value===f))==null?void 0:T.label,s.jsx("button",{onClick:()=>p(""),className:"ml-1 hover:text-destructive transition-colors",children:s.jsx(Er,{className:"w-3 h-3"})})]}),s.jsxs(Q,{variant:"ghost",size:"sm",onClick:x,className:"ml-auto text-muted-foreground hover:text-foreground",children:[s.jsx(Er,{className:"w-4 h-4 mr-1"}),"Effacer tout"]})]})]})]})}var tae="Toggle",KM=N.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,l]=Hi({prop:n,onChange:i,defaultProp:r??!1,caller:tae});return s.jsx(ut.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":e.disabled?"":void 0,...a,ref:t,onClick:Je(e.onClick,()=>{e.disabled||l(!o)})})});KM.displayName=tae;var nae=KM,lh="ToggleGroup",[rae]=Us(lh,[Zf]),sae=Zf(),YM=ee.forwardRef((e,t)=>{const{type:n,...r}=e;if(n==="single"){const i=r;return s.jsx(U8e,{...i,ref:t})}if(n==="multiple"){const i=r;return s.jsx(q8e,{...i,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${lh}\``)});YM.displayName=lh;var[iae,aae]=rae(lh),U8e=ee.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,l]=Hi({prop:n,defaultProp:r??"",onChange:i,caller:lh});return s.jsx(iae,{scope:e.__scopeToggleGroup,type:"single",value:ee.useMemo(()=>o?[o]:[],[o]),onItemActivate:l,onItemDeactivate:ee.useCallback(()=>l(""),[l]),children:s.jsx(oae,{...a,ref:t})})}),q8e=ee.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,l]=Hi({prop:n,defaultProp:r??[],onChange:i,caller:lh}),c=ee.useCallback(d=>l((f=[])=>[...f,d]),[l]),u=ee.useCallback(d=>l((f=[])=>f.filter(h=>h!==d)),[l]);return s.jsx(iae,{scope:e.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:c,onItemDeactivate:u,children:s.jsx(oae,{...a,ref:t})})});YM.displayName=lh;var[V8e,H8e]=rae(lh),oae=ee.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:l=!0,...c}=e,u=sae(n),d=Jf(o),f={role:"group",dir:d,...c};return s.jsx(V8e,{scope:n,rovingFocus:i,disabled:r,children:i?s.jsx(hC,{asChild:!0,...u,orientation:a,dir:d,loop:l,children:s.jsx(ut.div,{...f,ref:t})}):s.jsx(ut.div,{...f,ref:t})})}),Y2="ToggleGroupItem",lae=ee.forwardRef((e,t)=>{const n=aae(Y2,e.__scopeToggleGroup),r=H8e(Y2,e.__scopeToggleGroup),i=sae(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,l={...e,pressed:a,disabled:o},c=ee.useRef(null);return r.rovingFocus?s.jsx(mC,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:s.jsx(hB,{...l,ref:t})}):s.jsx(hB,{...l,ref:t})});lae.displayName=Y2;var hB=ee.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:r,...i}=e,a=aae(Y2,n),o={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},l=a.type==="single"?o:void 0;return s.jsx(KM,{...l,...i,ref:t,onPressedChange:c=>{c?a.onItemActivate(r):a.onItemDeactivate(r)}})}),cae=YM,uae=lae;const dae=dp("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),W8e=N.forwardRef(({className:e,variant:t,size:n,...r},i)=>
1187s.jsx(nae,{ref:i,className:ae(dae({variant:t,size:n,className:e})),...r}));W8e.displayName=nae.displayName;const fae=N.createContext({size:"default",variant:"default"}),XM=N.forwardRef(({className:e,variant:t,size:n,children:r,...i},a)=>s.jsx(cae,{ref:a,className:ae("flex items-center justify-center gap-1",e),...i,children:s.jsx(fae.Provider,{value:{variant:t,size:n},children:r})}));XM.displayName=cae.displayName;const X2=N.forwardRef(({className:e,children:t,variant:n,size:r,...i},a)=>{const o=N.useContext(fae);return s.jsx(uae,{ref:a,className:ae(dae({variant:o.variant||n,size:o.size||r}),e),...i,children:t})});X2.displayName=uae.displayName;const G8e=ae("flex items-center gap-1.5 px-3.5 sm:px-4 min-h-[40px] rounded-full text-xs font-medium transition-all","data-[state=on]:bg-[#AAFF00] data-[state=on]:text-[#0D0D0D] data-[state=on]:shadow-[0_2px_10px_-4px_rgba(170,255,0,0.9)]","data-[state=off]:text-[#0D0D0D]/60 data-[state=off]:hover:text-[#0D0D0D]"),K8e={list:{icon:XY,label:"Liste",aria:"Vue liste"},calendar:{icon:x0,label:"Agenda",aria:"Vue calendrier"},map:{icon:cxe,label:"Carte",aria:"Vue carte"}};function hae({value:e,onChange:t,className:n,modes:r=["list","calendar","map"]}){return s.jsx(XM,{type:"single",value:e,onValueChange:i=>i&&t(i),className:ae("inline-flex p-1 bg-card border border-[#0D0D0D]/5 rounded-full",n),children:r.map(i=>{const{icon:a,label:o,aria:l}=K8e[i];return s.jsxs(X2,{value:i,"aria-label":l,className:G8e,children:[s.jsx(a,{className:"w-4 h-4"}),s.jsx("span",{children:o})]},i)})})}function Y8e(){return st({queryKey:["event-locations"],queryFn:async()=>{const{data:e,error:t}=await re.from("venues").select("id, city, postal_code, address, country").eq("is_active",!0);if(t)throw t;const n=e.filter(l=>qm(l.city)),r=e.filter(l=>!qm(l.city)),i=[...new Set(n.map(l=>bR(l.postal_code,l.address)).filter(Boolean))].sort((l,c)=>parseInt(l)-parseInt(c)),a=[],o=[];return r.forEach(l=>{if(l.city)if(!l.country||l.country==="France")a.includes(l.city)||a.push(l.city);else{const c=`${l.city}-${l.country}`;o.find(u=>`${u.city}-${u.country}`===c)||o.push({city:l.city,country:l.country})}}),{parisArrondissements:i,frenchCities:a.sort(),internationalCities:o.sort((l,c)=>l.city.localeCompare(c.city)),hasParisVenues:n.length>0}},staleTime:5*60*1e3})}const X8e="#F5F3EE",Q8e="#0D0D0D",J8e="#AAFF00";function Rl({source:e="footer",hideNewsletter:t=!1}){return s.jsx("footer",{className:"py-10 border-t",style:{borderColor:"rgba(13,13,13,0.15)",backgroundColor:X8e},children:s.jsxs("div",{className:"container mx-auto px-4 space-y-8",children:[!t&&s.jsxs("div",{className:"grid md:grid-cols-2 gap-8 items-start pb-8 border-b",style:{borderColor:"rgba(13,13,13,0.12)"},children:[s.jsx(bee,{}),s.jsx(kR,{source:e})]}),s.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(vc,{size:"sm"}),s.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-black",style:{backgroundColor:J8e,color:Q8e,fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:"by WIT."})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-6 text-sm",children:[s.jsx(Pe,{to:"/partenaires",className:"hover:opacity-60 transition",children:"Devenir partenaire"}),s.jsx(Pe,{to:"/faq",className:"hover:opacity-60 transition",children:"FAQ"}),s.jsx(Pe,{to:"/confidentialite",className:"hover:opacity-60 transition",children:"Confidentialité"}),s.jsx(Pe,{to:"/confidentialite/photos",className:"hover:opacity-60 transition",children:"Photos"}),s.jsxs("p",{className:"text-[10px] uppercase tracking-widest",style:{fontFamily:"'Fragment Mono', ui-monospace, monospace",color:"rgba(13,13,13,0.6)"},children:["© ",hee," WIT — ",NR]})]})]})]})})}const Z8e=N.lazy(()=>ka(()=>import("./EventsMap-1NCXpW1N.js"),[])),eLe=N.lazy(()=>ka(()=>import("./EventsCalendar-DM8dFsGN.js"),[]));function mB(){return s.jsxs("div",{className:"relative rounded-2xl overflow-hidden border border-primary/20 h-[60vh] md:h-[70vh]",children:[s.jsx(Ie,{className:"absolute inset-0"}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx(gn,{className:"w-8 h-8 text-muted-foreground mx-auto mb-2 animate-pulse"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Chargement de la carte..."})]})})]})}function tLe(e){if(!e)return{};if(e==="paris:all")return{city:"Paris"};if(e.startsWith("paris:"))return{arrondissement:e.slice(6)};if(e.startsWith("city:"))return{city:e.slice(5)};if(e.startsWith("intl:")){const[t,n]=e.slice(5).split("|");return{city:t,country:n}}return{}}function nLe(){const[e,t]=N.useState(""),[n,r]=N.useState("all"),[i,a]=N.useState(""),[o,l]=N.useState(""),[c,u]=N.useState(""),f=vd()?"events-view-mode-mobile":"events-view-mode-
1187desktop",h=M=>{const B=localStorage.getItem(M);return B==="map"||B==="calendar"||B==="list"?B:"list"},[p,x]=N.useState(()=>h(f));N.useEffect(()=>{x(h(f)),localStorage.removeItem("events-view-mode")},[f]);const y=M=>{x(M),localStorage.setItem(f,M)},{data:b,isLoading:w}=Y8e(),_=N.useMemo(()=>tLe(i),[i]),{data:j,isLoading:E}=lee({status:["published","ongoing"],upcoming:n==="all",dateRange:n!=="all"?n:void 0,arrondissement:_.arrondissement,city:_.city&&!_.arrondissement?_.city:void 0,country:_.country,format:o&&o!=="all"?o:void 0,cadence:c&&c!=="all"?c:void 0,search:e||void 0}),S=N.useMemo(()=>j?i==="paris:all"?j.filter(M=>{var B;return qm((B=M.venue)==null?void 0:B.city)}):j:[],[j,i]),T=()=>{t(""),r("all"),a(""),l(""),u("")},P=N.useMemo(()=>(S==null?void 0:S.map(M=>M.id))||[],[S]),{data:O}=jR(P),{data:D}=HSe(P),R=E||w,L=N.useMemo(()=>(S==null?void 0:S.filter(M=>{var B,U;return((B=M.venue)==null?void 0:B.latitude)&&((U=M.venue)==null?void 0:U.longitude)}).length)||0,[S]);return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("section",{className:"pt-20 md:pt-24 pb-2",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("div",{className:"inline-flex items-center gap-2 mb-2 text-[11px] font-mono uppercase tracking-[0.2em] text-[#0D0D0D]/60",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#AAFF00] animate-pulse"}),s.jsx("span",{children:"AGENDA"})]}),s.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-end lg:justify-between gap-1 lg:gap-12",children:[s.jsxs("h1",{className:"font-bricolage text-4xl sm:text-5xl md:text-6xl font-extrabold text-foreground tracking-tight leading-[0.95]",children:["Tournois",s.jsx("span",{className:"text-[#AAFF00]",children:"."})]}),s.jsx("p",{className:"text-muted-foreground text-sm md:text-base max-w-sm lg:text-right lg:pb-2",children:"Les tournois d'échecs chaque mois, dans des lieux qui changent."})]})]})}),s.jsx("section",{className:"pt-3 pb-12",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsx("div",{className:"mb-6",children:s.jsx(z8e,{searchQuery:e,onSearchChange:t,dateRange:n,onDateRangeChange:r,selectedLocation:i,onLocationChange:a,parisArrondissements:(b==null?void 0:b.parisArrondissements)||[],hasParisVenues:(b==null?void 0:b.hasParisVenues)||!1,frenchCities:(b==null?void 0:b.frenchCities)||[],internationalCities:(b==null?void 0:b.internationalCities)||[],selectedFormat:o,selectedCadence:c,onFormatChange:l,onCadenceChange:u,onClearFilters:T})}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[!R&&S&&s.jsxs("p",{className:"text-muted-foreground",children:[S.length," tournoi",S.length!==1?"s":""," trouvé",S.length!==1?"s":"",p==="map"&&L<S.length&&s.jsxs("span",{className:"text-xs ml-2",children:["(",L," sur carte)"]})]}),s.jsx(hae,{value:p,onChange:y})]}),R?p==="list"?s.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((M,B)=>s.jsxs("div",{className:"rounded-xl border border-border p-5",children:[s.jsx(Ie,{className:"h-4 w-20 mb-4"}),s.jsx(Ie,{className:"h-6 w-3/4 mb-4"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ie,{className:"h-4 w-full"}),s.jsx(Ie,{className:"h-4 w-2/3"}),s.jsx(Ie,{className:"h-4 w-1/2"})]}),s.jsx(Ie,{className:"h-8 w-20 mt-4"}),s.jsx(Ie,{className:"h-10 w-full mt-4"})]},B))}):p==="calendar"?s.jsxs("div",{className:"rounded-2xl border border-[#0D0D0D]/10 p-6",children:[s.jsx(Ie,{className:"h-8 w-48 mb-6"}),s.jsx(Ie,{className:"h-[60vh] w-full"})]}):s.jsx(mB,{}):S&&S.length>0?p==="list"?s.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-6",children:S.map(M=>s.jsx(eae,{event:M,ticketCount:(O==null?void 0:O[M.id])||0,interestedCount:(D==null?void 0:D[M.id])||0},M.id))}):p==="calendar"?s.jsx(N.Suspense,{fallback:s.jsx("div",{className:"h-[60vh]",children:s.jsx(Ie,{className:"h-full w-full"})}),children:s.jsx(eLe,{events:S})}):s.jsx(N.Suspense,{fallback:s.jsx(mB,{}),children:s.jsx(Z8e,{events:S,className:"h-[60vh] md:h-[70vh]"})}):s.jsxs("div",{className:"text-center py-16",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-4",children:s.jsx(x0,{className:"w-8 h-8 text-muted-foreground"})}),s.jsx("h3",{className:"font-display text-xl font-semibold mb-2",children:"Aucun tournoi trouvé"}),s.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:e||i||o||n!=="all"?"Essayez de modifier vos filtres pour voir plus de résultats.":"Aucun tournoi n'est prévu pour le moment. Revenez bientôt !"}),(e||i||o||n!=="all")&&s.jsx(Q,{variant:"outline",onClick:T,children:"Effacer les filtres"})]})]})}),s.jsx("section",{className:"py-12 md:py-16 bg-card border-t border-border",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-2xl mx-auto text-center",children:[s.jsx("h2",{className:"font-display text-2xl md:text-3xl font-bold mb-4",children:"Vous êtes un bar ?"}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Accueillez des tournois et attirez une clientèle fidèle et passionnée."}),s.jsx(Pe,{to:"/auth?tab=signup&role=venue",children:s.jsxs(Q,{size:"lg",variant:"outline",className:"gap-2",children:[s.jsx(gn,{className:"w-4 h-4"}),"Devenir lieu partenaire"]})})]})})}),s.jsx(Rl,{source:"footer-events"})]})}function rLe({open:e,onOpenChange:t,eventId:n,eventTitle:r}){const{user:i}=Tt(),{toast:a}=_r(),o=Ye(),[l,c]=N.useState(""),[u,d]=N.useState(""),[f,h]=N.useState(""),[p,x]=N.useState(!1);N.useEffect(()=>{if(!e)return;const b=(i==null?void 0:i.user_metadata)||{};c(b.first_name||b.given_name||""),d(b.last_name||b.family_name||""),h((i==null?void 0:i.email)||"")},[e,i]);const y=async b=>
1187{if(b.preventDefault(),!p){if(!l.trim()||!u.trim()||!f.trim()){a({title:"Champs requis",description:"Prénom, nom et email sont obligatoires.",variant:"destructive"});return}x(!0);try{const{data:w,error:_}=await re.functions.invoke("landing-preregister",{body:{eventId:n,firstName:l.trim(),lastName:u.trim(),email:f.trim().toLowerCase()}});if(_)throw _;if(w!=null&&w.error)throw new Error(w.error);try{const{trackMetaEvent:j}=await ka(async()=>{const{trackMetaEvent:E}=await Promise.resolve().then(()=>uh);return{trackMetaEvent:E}},void 0);j("Lead",{userData:{email:f.trim().toLowerCase(),first_name:l.trim(),last_name:u.trim()},customData:{content_ids:[n],content_type:"event",content_name:"rsvp_dialog"}})}catch{}a({title:"Place réservée 🤔",description:`On te garde une place pour "${r}". Tu recevras un rappel par email pour confirmer.`}),o.invalidateQueries({queryKey:["my-event-lead",n]}),o.invalidateQueries({queryKey:["event-ticket-count",n]}),t(!1)}catch(w){const _=String((w==null?void 0:w.message)||w||""),j=/already|existe|unique|duplicate/i.test(_);a({title:j?"Déjà préinscrit(e)":"Oups",description:j?"Tu es déjà sur la liste pour ce tournoi.":_||"Impossible d'enregistrer ta préinscription.",variant:j?"default":"destructive"}),j&&(o.invalidateQueries({queryKey:["my-event-lead",n]}),t(!1))}finally{x(!1)}}};return s.jsx(Ln,{open:e,onOpenChange:t,children:s.jsxs(Dn,{className:"sm:max-w-md rounded-3xl",children:[s.jsxs(Un,{children:[s.jsx("div",{className:"text-xs font-mono uppercase tracking-[0.2em] text-muted-foreground mb-2",children:"🤔 RSVP · Bloque une place"}),s.jsx(qn,{className:"font-display text-2xl",children:"Décider plus tard"}),s.jsx(qr,{children:"On te garde une place au chaud. Tu recevras un email de rappel pour confirmer et payer avant le tournoi."})]}),s.jsxs("form",{onSubmit:y,className:"space-y-4 pt-2",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx(Fe,{htmlFor:"firstName",children:"Prénom"}),s.jsx(Ue,{id:"firstName",value:l,onChange:b=>c(b.target.value),required:!0,autoFocus:!0})]}),s.jsxs("div",{children:[s.jsx(Fe,{htmlFor:"lastName",children:"Nom"}),s.jsx(Ue,{id:"lastName",value:u,onChange:b=>d(b.target.value),required:!0})]})]}),s.jsxs("div",{children:[s.jsx(Fe,{htmlFor:"email",children:"Email"}),s.jsx(Ue,{id:"email",type:"email",value:f,onChange:b=>h(b.target.value),required:!0,disabled:!!(i!=null&&i.email)})]}),s.jsxs(Q,{type:"submit",className:"w-full",size:"lg",disabled:p,children:[p?s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}):null,"Tiens-moi au courant →"]}),s.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"Aucun paiement maintenant · Pas de spam"})]})]})})}function QM(e){return st({queryKey:["can-register",e],queryFn:async()=>{if(!e)return{canRegister:!1,reason:"closed",spotsLeft:0};const{data:t,error:n}=await re.from("events").select("status, capacity").eq("id",e).maybeSingle();if(n||!t)return{canRegister:!1,reason:"closed",spotsLeft:0};const{data:r,error:i}=await re.rpc("get_event_ticket_count",{p_event_id:e});if(i)return{canRegister:!1,reason:"closed",spotsLeft:0};const a=r||0,o=Math.max(0,t.capacity-a);if(o<=0)return{canRegister:!1,reason:"full",spotsLeft:0};if(t.status==="published")return{canRegister:!0,reason:"open",spotsLeft:o};if(t.status==="ongoing"){const{data:l}=await re.from("rounds").select("id").eq("event_id",e).eq("round_number",1).limit(1);if(!l||l.length===0)return{canRegister:!0,reason:"ongoing_no_pairings",spotsLeft:o};const{count:c}=await re.from("pairings").select("*",{count:"exact",head:!0}).eq("round_id",l[0].id);return!c||c===0?{canRegister:!0,reason:"ongoing_no_pairings",spotsLeft:o}:{canRegister:!1,reason:"pairings_started",spotsLeft:o}}return{canRegister:!1,reason:"closed",spotsLeft:o}},enabled:!!e,staleTime:2e3,refetchOnWindowFocus:!0})}function sLe(e){const t=Ye(),n=QM(e);return N.useEffect(()=>{if(!e)return;const r=re.channel(`can-register-${e}`).on("postgres_changes",{event:"*",schema:"public",table:"tickets",filter:`event_id=eq.${e}`},()=>{t.invalidateQueries({queryKey:["can-register",e]}),t.refetchQueries({queryKey:["can-register",e]})}).subscribe();return()=>{re.removeChannel(r)}},[e,t]),n}function pB({eventId:e,className:t}){const[n,r]=N.useState(!1),{data:i,isLoading:a}=$R(e),{data:o=0,isLoading:l}=Pte(e),c=Z3e(),u=Ote(),d=a||l,f=!!i,h=(i==null?void 0:i.status)==="notified",p=()=>{c.mutate(e)},x=()=>{i!=null&&i.id&&(u.mutate(i.id),r(!1))};return d?s.jsxs(Q,{disabled:!0,className:ae("w-full",t),children:[s.jsx(We,{className:"mr-2 h-4 w-4 animate-spin"}),"Chargement..."]}):f&&!h?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:ae("space-y-3",t),children:[s.jsxs("div",{className:"waitlist-card p-4 text-center",children:[s.jsxs("div",{className:"flex items-center justify-center gap-2 text-primary font-semibold",children:[s.jsx(Vt,{className:"h-5 w-5"}),s.jsxs("span",{children:["Vous êtes #",i.position," sur la liste"]})]}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Vous serez notifié si une place se libère"})]}),s.jsxs(Q,{variant:"outline",className:"w-full",onClick:()=>r(!0),children:[s.jsx(Er,{className:"mr-2 h-4 w-4"}),"Quitter la liste"]})]}),s.jsx(yr,{open:n,onOpenChange:r,children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Qu
1187itter la liste d'attente ?"}),s.jsxs(lr,{children:["Vous perdrez votre position #",i.position," dans la file. Vous pourrez rejoindre à nouveau, mais vous serez placé en fin de liste."]})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsx(vr,{onClick:x,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Quitter"})]})]})})]}):s.jsxs(Q,{onClick:p,disabled:c.isPending,className:ae("w-full waitlist-join-button",t),variant:"outline",children:[c.isPending?s.jsx(We,{className:"mr-2 h-4 w-4 animate-spin"}):s.jsx(cs,{className:"mr-2 h-4 w-4"}),s.jsx("span",{children:"Rejoindre la liste d'attente"}),o>0&&s.jsxs("span",{className:"ml-2 text-xs opacity-70",children:["(",o," en attente)"]})]})}function iLe({eventId:e,eventTitle:t,priceCents:n,creditCents:r,className:i}){const a=Rr(),{data:o}=$R(e),l=Dte(),[c,u]=N.useState("");Ite(e);const d=(o==null?void 0:o.status)==="notified",f=o==null?void 0:o.expires_at;N.useEffect(()=>{if(!d||!f)return;const x=()=>{const b=new Date,_=new Date(f).getTime()-b.getTime();if(_<=0){u("Expiré");return}const j=Math.floor(_/6e4),E=Math.floor(_%6e4/1e3);u(`${j}:${E.toString().padStart(2,"0")}`)};x();const y=setInterval(x,1e3);return()=>clearInterval(y)},[d,f]);const h=N.useCallback(()=>{o!=null&&o.id&&l.mutate({waitlistEntryId:o.id,eventId:e,priceCents:n,creditCents:r},{onSuccess:x=>{a(`/tickets/${x.id}/confirmation`)}})},[o==null?void 0:o.id,e,n,r,l,a]);if(!d)return null;const p=c==="Expiré";return s.jsx("div",{className:ae("waitlist-notification-banner","fixed bottom-0 left-0 right-0 z-50 p-4 md:p-0","md:relative md:mb-4",i),children:s.jsx("div",{className:ae("waitlist-urgent rounded-2xl p-4 md:p-6","border border-primary/20","animate-in slide-in-from-bottom-4 duration-500"),children:s.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-4",children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[s.jsx("div",{className:"waitlist-icon-glow p-2 rounded-full bg-primary/20",children:s.jsx(Ti,{className:"h-6 w-6 text-primary"})}),s.jsxs("div",{className:"text-center md:text-left",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:"🎉 Une place s'est libérée !"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:t})]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-primary font-mono font-bold",children:[s.jsx(Vt,{className:"h-4 w-4"}),s.jsx("span",{className:ae(p&&"text-destructive"),children:c})]}),s.jsx(Q,{onClick:h,disabled:p||l.isPending,className:ae("w-full md:w-auto min-w-[180px]","bg-primary hover:bg-primary/90","shadow-lg shadow-primary/25"),children:l.isPending?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"mr-2 h-4 w-4 animate-spin"}),"Réservation..."]}):p?"Délai expiré":"Réserver maintenant"})]})})})}function aLe({venueName:e,venueId:t,className:n}){return s.jsxs("div",{className:ae("tournament-started-banner rounded-2xl p-5 space-y-4 min-w-0 overflow-hidden",n),children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-warning/20 flex items-center justify-center shrink-0",children:s.jsx(ur,{className:"w-5 h-5 text-warning"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-display font-bold text-lg text-foreground",children:"Tournoi en cours"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Les inscriptions en ligne sont fermées"})]})]}),s.jsx("div",{className:"inner-card rounded-xl p-4 space-y-3",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(gn,{className:"w-4 h-4 text-primary mt-0.5 shrink-0"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium",children:"Vous êtes sur place ?"}),s.jsxs("p",{className:"text-muted-foreground",children:["Présentez-vous au manager ou à l'animateur du tournoi chez"," ",s.jsx("span",{className:"font-medium text-foreground",children:e})," ","pour une inscription de dernière minute (si places disponibles)."]})]})]})}),s.jsxs("div",{className:"flex flex-col gap-2 min-w-0",children:[s.jsx(Pe,{to:"/events",className:"block w-full min-w-0",children:s.jsxs(Q,{variant:"outline",className:"w-full min-w-0 gap-2",children:[s.jsx(Jn,{className:"w-4 h-4 shrink-0"}),s.jsx("span",{className:"truncate",children:"Voir les prochains tournois"})]})}),t&&s.jsx(Pe,{to:`/venues/${t}`,className:"block w-full min-w-0",children:s.jsxs(Q,{variant:"ghost",className:"w-full min-w-0 gap-2",children:[s.jsx(sn,{className:"w-4 h-4 shrink-0"}),s.jsx("span",{className:"truncate",children:"Autres événements ici"})]})})]})]})}const oLe=()=>{const e=yee();return s.jsx("section",{className:"py-20 md:py-28",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-3xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsxs("p",{className:"font-mono text-xs uppercase tracking-[0.2em] mb-2 text-foreground
1187/60",children:[s.jsx(Lk,{className:"inline w-3 h-3 mr-1 -mt-0.5"}),"FAQ"]}),s.jsx("h2",{className:"font-sans font-semibold text-4xl md:text-5xl mb-4 text-foreground",children:"Questions fréquentes"}),s.jsx("p",{className:"max-w-xl mx-auto text-foreground/70",children:"Tout ce que vous devez savoir avant de jouer."})]}),s.jsx("div",{className:"rounded-3xl p-2 md:p-4 border border-foreground/10 bg-card",children:s.jsx(wC,{type:"single",collapsible:!0,className:"space-y-1",children:e.map(t=>s.jsxs(kx,{value:t.id,className:"px-3 border-0 rounded-2xl data-[state=open]:bg-accent/10 transition-colors",children:[s.jsx(Cx,{className:"font-sans text-left hover:no-underline py-4 text-sm md:text-base font-semibold text-foreground",children:t.question}),s.jsx(Ex,{className:"text-sm leading-relaxed pb-4 whitespace-pre-line text-foreground/75",children:t.answer})]},t.id))})}),s.jsxs("div",{className:"text-center mt-10",children:[s.jsx("p",{className:"text-sm mb-4 text-foreground/70",children:"Convaincu ? Réservez votre place ou explorez la FAQ complète."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[s.jsx(Pe,{to:"/events",children:s.jsxs("button",{className:"w-full sm:w-auto inline-flex items-center justify-center gap-2 px-6 py-4 rounded-full font-sans font-semibold tracking-wide text-sm group bg-foreground text-background hover:bg-foreground
1187/90 transition-colors",children:["Réserver maintenant",s.jsx(Sr,{className:"w-4 h-4 transition-transform group-hover:translate-x-1"})]})}),s.jsx(Pe,{to:"/faq",children:s.jsx("button",{className:"w-full sm:w-auto inline-flex items-center justify-center gap-2 px-6 py-4 rounded-full font-sans font-semibold tracking-wide text-sm border-2 border-foreground text-foreground hover:bg-foreground hover:text-background transition-colors",children:"Voir toutes les questions"})})]})]})]})})})};function lLe({venue:e,className:t,addressClassName:n,cityClassName:r,separator:i=" · "}){const a=wR(e.city||"",e.postal_code,e.country,e.address),o=oee(e.district_label,e.name);return s.jsxs("span",{className:t,children:[e.address&&s.jsx("span",{className:n,children:e.address}),e.address&&a&&s.jsx("span",{"aria-hidden":"true",children:" · "}),a&&s.jsxs("span",{className:r,children:[a,o&&s.jsxs(s.Fragment,{children:[i,o]})]})]})}const cLe={1:{bg:"#FFCE00",text:"#0D0D0D"},2:{bg:"#0064B0",text:"#FFFFFF"},3:{bg:"#9F9825",text:"#FFFFFF"},"3B":{bg:"#98D4E2",text:"#0D0D0D"},4:{bg:"#C04191",text:"#FFFFFF"},5:{bg:"#F28E42",text:"#FFFFFF"},6:{bg:"#83C491",text:"#0D0D0D"},7:{bg:"#F3A4BA",text:"#0D0D0D"},"7B":{bg:"#83C491",text:"#0D0D0D"},8:{bg:"#CEADD2",text:"#0D0D0D"},9:{bg:"#D5C900",text:"#0D0D0D"},10:{bg:"#E3B32A",text:"#0D0D0D"},11:{bg:"#8D5E2A",text:"#FFFFFF"},12:{bg:"#00814F",text:"#FFFFFF"},13:{bg:"#98D4E2",text:"#0D0D0D"},14:{bg:"#662483",text:"#FFFFFF"},A:{bg:"#E2231A",text:"#FFFFFF"},B:{bg:"#7BA4DB",text:"#FFFFFF"},C:{bg:"#F3D311",text:"#0D0D0D"},D:{bg:"#00A88F",text:"#FFFFFF"},E:{bg:"#C29ECC",text:"#0D0D0D"}};function uLe(e){const t=e.trim().toUpperCase().replace(/^(M|MÉTRO|METRO|RER|LIGNE)\s*/,""),n=/^[A-E]$/.test(t);return{key:t,prefix:n?"RER":"M"}}function dLe({line:e,station:t,theme:n="dark",className:r=""}){if(!e||!t)return null;const{key:i,prefix:a}=uLe(e),o=cLe[i];if(!o)return null;const l=n==="dark"?"bg-white/10 backdrop-blur-xl border border-white/20 text-white shadow-lg":"bg-white border border-black/10 text-[#0D0D0D] shadow-sm";return s.jsxs("div",{className:`inline-flex items-center rounded-full pl-1.5 pr-4 py-1.5 ${l} ${r}`,children:[s.jsx("div",{className:`w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-black mr-1.5 ${n==="dark"?"bg-white text-[#0D0D0D]":"bg-[#0D0D0D] text-white"}`,children:a}),s.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-black mr-2",style:{backgroundColor:o.bg,color:o.text},children:i}),s.jsx("span",{className:`text-[11px] uppercase tracking-wider font-bold ${n==="dark"?"text-white":"text-[#0D0D0D]"}`,style:{fontFamily:"'Fragment Mono', monospace"},children:t})]})}function fLe(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(r){if(r!=="default"&&!(r in e)){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}})}),Object.freeze(e)}function mae(e,t){return new Promise(function(n,r){let i;return hLe(e).then(function(a){try{return i=a,n(new Blob([t.slice(0,2),i,t.slice(2)],{type:"image/jpeg"}))}catch(o){return r(o)}},r)})}const hLe=e=>new Promise((t,n)=>{const r=new FileReader;r.addEventListener("load",({target:{result:i}})=>{const a=new DataView(i);let o=0;if(a.getUint16(o)!==65496)return n("not a valid JPEG");for(o+=2;;){const l=a.getUint16(o);if(l===65498)break;const c=a.getUint16(o+2);if(l===65505&&a.getUint32(o+4)===1165519206){const u=o+10;let d;switch(a.getUint16(u)){case 18761:d=!0;break;case 19789:d=!1;break;default:return n("TIFF header contains invalid endian")}if(a.getUint16(u+2,d)!==42)return n("TIFF header contains invalid version");const f=a.getUint32(u+4,d),h=u+f+2+12*a.getUint16(u+f,d);for(let p=u+f+2;p<h;p+=12)if(a.getUint16(p,d)==274){if(a.getUint16(p+2,d)!==3)return n("Orientation data type is invalid");if(a.getUint32(p+4,d)!==1)return n("Orientation data count is invalid");a.setUint16(p+8,1,d);break}return t(i.slice(o,o+2+c))}o+=2+c}return t(new Blob)}),r.readAsArrayBuffer(e)});var Q2={},mLe={get exports(){return Q2},set exports(e){Q2=e}};(function(e){var t,n,r={};mLe.exports=r,r.parse=function(i,a){for(var o=r.bin.readUshort,l=r.bin.readUint,c=0,u={},d=new Uint8Array(i),f=d.length-4;l(d,f)!=101010256;)f--;c=f,c+=4;var h=o(d,c+=4);o(d,c+=2);var p=l(d,c+=2),x=l(d,c+=4);c+=4,c=x;for(var y=0;
vendor: 4,296 bytes, line 1187
1187y<h;y++){l(d,c),c+=4,c+=4,c+=4,l(d,c+=4),p=l(d,c+=4);var b=l(d,c+=4),w=o(d,c+=4),_=o(d,c+2),j=o(d,c+4);c+=6;var E=l(d,c+=8);c+=4,c+=w+_+j,r._readLocal(d,E,u,p,b,a)}return u},r._readLocal=function(i,a,o,l,c,u){var d=r.bin.readUshort,f=r.bin.readUint;f(i,a),d(i,a+=4),d(i,a+=2);var h=d(i,a+=2);f(i,a+=2),f(i,a+=4),a+=4;var p=d(i,a+=8),x=d(i,a+=2);a+=2;var y=r.bin.readUTF8(i,a,p);if(a+=p,a+=x,u)o[y]={size:c,csize:l};else{var b=new Uint8Array(i.buffer,a);if(h==0)o[y]=new Uint8Array(b.buffer.slice(a,a+l));else{if(h!=8)throw"unknown compression method: "+h;var w=new Uint8Array(c);r.inflateRaw(b,w),o[y]=w}}},r.inflateRaw=function(i,a){return r.F.inflate(i,a)},r.inflate=function(i,a){return i[0],i[1],r.inflateRaw(new Uint8Array(i.buffer,i.byteOffset+2,i.length-6),a)},r.deflate=function(i,a){a==null&&(a={level:6});var o=0,l=new Uint8Array(50+Math.floor(1.1*i.length));l[o]=120,l[o+1]=156,o+=2,o=r.F.deflateRaw(i,l,o,a.level);var c=r.adler(i,0,i.length);return l[o+0]=c>>>24&255,l[o+1]=c>>>16&255,l[o+2]=c>>>8&255,l[o+3]=c>>>0&255,new Uint8Array(l.buffer,0,o+4)},r.deflateRaw=function(i,a){a==null&&(a={level:6});var o=new Uint8Array(50+Math.floor(1.1*i.length)),l=r.F.deflateRaw(i,o,l,a.level);return new Uint8Array(o.buffer,0,l)},r.encode=function(i,a){a==null&&(a=!1);var o=0,l=r.bin.writeUint,c=r.bin.writeUshort,u={};for(var d in i){var f=!r._noNeed(d)&&!a,h=i[d],p=r.crc.crc(h,0,h.length);u[d]={cpr:f,usize:h.length,crc:p,file:f?r.deflateRaw(h):h}}for(var d in u)o+=u[d].file.length+30+46+2*r.bin.sizeUTF8(d);o+=22;var x=new Uint8Array(o),y=0,b=[];for(var d in u){var w=u[d];b.push(y),y=r._writeHeader(x,y,d,w,0)}var _=0,j=y;for(var d in u)w=u[d],b.push(y),y=r._writeHeader(x,y,d,w,1,b[_++]);var E=y-j;return l(x,y,101010256),y+=4,c(x,y+=4,_),c(x,y+=2,_),l(x,y+=2,E),l(x,y+=4,j),y+=4,y+=2,x.buffer},r._noNeed=function(i){var a=i.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(a)!=-1},r._writeHeader=function(i,a,o,l,c,u){var d=r.bin.writeUint,f=r.bin.writeUshort,h=l.file;return d(i,a,c==0?67324752:33639248),a+=4,c==1&&(a+=2),f(i,a,20),f(i,a+=2,0),f(i,a+=2,l.cpr?8:0),d(i,a+=2,0),d(i,a+=4,l.crc),d(i,a+=4,h.length),d(i,a+=4,l.usize),f(i,a+=4,r.bin.sizeUTF8(o)),f(i,a+=2,0),a+=2,c==1&&(a+=2,a+=2,d(i,a+=6,u),a+=4),a+=r.bin.writeUTF8(i,a,o),c==0&&(i.set(h,a),a+=h.length),a},r.crc={table:function(){for(var i=new Uint32Array(256),a=0;a<256;a++){for(var o=a,l=0;l<8;l++)1&o?o=3988292384^o>>>1:o>>>=1;i[a]=o}return i}(),update:function(i,a,o,l){for(var c=0;c<l;c++)i=r.crc.table[255&(i^a[o+c])]^i>>>8;return i},crc:function(i,a,o){return 4294967295^r.crc.update(4294967295,i,a,o)}},r.adler=function(i,a,o){for(var l=1,c=0,u=a,d=a+o;u<d;){for(var f=Math.min(u+5552,d);u<f;)c+=l+=i[u++];l%=65521,c%=65521}return c<<16|l},r.bin={readUshort:function(i,a){return i[a]|i[a+1]<<8},writeUshort:function(i,a,o){i[a]=255&o,i[a+1]=o>>8&255},readUint:function(i,a){return 16777216*i[a+3]+(i[a+2]<<16|i[a+1]<<8|i[a])},writeUint:function(i,a,o){i[a]=255&o,i[a+1]=o>>8&255,i[a+2]=o>>16&255,i[a+3]=o>>24&255},readASCII:function(i,a,o){for(var l="",c=0;c<o;c++)l+=String.fromCharCode(i[a+c]);return l},writeASCII:function(i,a,o){for(var l=0;l<o.length;l++)i[a+l]=o.charCodeAt(l)},pad:function(i){return i.length<2?"0"+i:i},readUTF8:function(i,a,o){for(var l,c="",u=0;u<o;u++)c+="%"+r.bin.pad(i[a+u].toString(16));try{l=decodeURIComponent(c)}catch{return r.bin.readASCII(i,a,o)}return l},writeUTF8:function(i,a,o){for(var l=o.length,c=0,u=0;u<l;u++){var d=o.charCodeAt(u);if(!(4294967168&d))i[a+c]=d,c++;else if(!(4294965248&d))i[a+c]=192|d>>6,i[a+c+1]=128|d>>0&63,c+=2;else if(!(4294901760&d))i[a+c]=224|d>>12,i[a+c+1]=128|d>>6&63,i[a+c+2]=128|d>>0&63,c+=3;else{if(4292870144&d)throw"e";i[a+c]=240|d>>18,i[a+c+1]=128|d>>12&63,i[a+c+2]=128|d>>6&63,i[a+c+3]=128|d>>0&63,c+=4}}return c},sizeUTF8:function(i){for(var a=i.length,o=0,l=0;l<a;l++){var c=i.charCodeAt(l);if(!(4294967168&c))o++;else if(!(4294965248&c))o+=2;else if(!(4294901760&c))o+=3;else{if(4292870144&c)throw"e";o+=4}}return o}},r.F={},r.F.deflateRaw=function(i,a,o,l){var c=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][l],u=r.F.U,d=r.F._goodIndex;r.F._hash;var f=r.F._putsE,h=0,p=o<<3,x=0,y=i.length;if(l==0){for(;h<y;
vendor: 5,446 bytes, line 1187
1187)f(a,p,h+(L=Math.min(65535,y-h))==y?1:0),p=r.F._copyExact(i,h,L,a,p+8),h+=L;return p>>>3}var b=u.lits,w=u.strt,_=u.prev,j=0,E=0,S=0,T=0,P=0,O=0;for(y>2&&(w[O=r.F._hash(i,0)]=0),h=0;h<y;h++){if(P=O,h+1<y-2){O=r.F._hash(i,h+1);var D=h+1&32767;_[D]=w[O],w[O]=D}if(x<=h){(j>14e3||E>26697)&&y-h>100&&(x<h&&(b[j]=h-x,j+=2,x=h),p=r.F._writeBlock(h==y-1||x==y?1:0,b,j,T,i,S,h-S,a,p),j=E=T=0,S=h);var R=0;h<y-2&&(R=r.F._bestMatch(i,h,_,P,Math.min(c[2],y-h),c[3]));var L=R>>>16,M=65535&R;if(R!=0){M=65535&R;var B=d(L=R>>>16,u.of0);u.lhst[257+B]++;var U=d(M,u.df0);u.dhst[U]++,T+=u.exb[B]+u.dxb[U],b[j]=L<<23|h-x,b[j+1]=M<<16|B<<8|U,j+=2,x=h+L}else u.lhst[i[h]]++;E++}}for(S==h&&i.length!=0||(x<h&&(b[j]=h-x,j+=2,x=h),p=r.F._writeBlock(1,b,j,T,i,S,h-S,a,p),j=0,E=0,j=E=T=0,S=h);7&p;)p++;return p>>>3},r.F._bestMatch=function(i,a,o,l,c,u){var d=32767&a,f=o[d],h=d-f+32768&32767;if(f==d||l!=r.F._hash(i,a-h))return 0;for(var p=0,x=0,y=Math.min(32767,a);h<=y&&--u!=0&&f!=d;){if(p==0||i[a+p]==i[a+p-h]){var b=r.F._howLong(i,a,h);if(b>p){if(x=h,(p=b)>=c)break;h+2<b&&(b=h+2);for(var w=0,_=0;_<b-2;_++){var j=a-h+_+32768&32767,E=j-o[j]+32768&32767;E>w&&(w=E,f=j)}}}h+=(d=f)-(f=o[d])+32768&32767}return p<<16|x},r.F._howLong=function(i,a,o){if(i[a]!=i[a-o]||i[a+1]!=i[a+1-o]||i[a+2]!=i[a+2-o])return 0;var l=a,c=Math.min(i.length,a+258);for(a+=3;a<c&&i[a]==i[a-o];)a++;return a-l},r.F._hash=function(i,a){return(i[a]<<8|i[a+1])+(i[a+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(i,a,o,l,c,u,d,f,h){var p,x,y,b,w,_,j,E,S,T=r.F.U,P=r.F._putsF,O=r.F._putsE;T.lhst[256]++,x=(p=r.F.getTrees())[0],y=p[1],b=p[2],w=p[3],_=p[4],j=p[5],E=p[6],S=p[7];var D=32+(h+3&7?8-(h+3&7):0)+(d<<3),R=l+r.F.contSize(T.fltree,T.lhst)+r.F.contSize(T.fdtree,T.dhst),L=l+r.F.contSize(T.ltree,T.lhst)+r.F.contSize(T.dtree,T.dhst);L+=14+3*j+r.F.contSize(T.itree,T.ihst)+(2*T.ihst[16]+3*T.ihst[17]+7*T.ihst[18]);for(var M=0;M<286;M++)T.lhst[M]=0;for(M=0;M<30;M++)T.dhst[M]=0;for(M=0;M<19;M++)T.ihst[M]=0;var B=D<R&&D<L?0:R<L?1:2;if(P(f,h,i),P(f,h+1,B),h+=3,B==0){for(;7&h;)h++;h=r.F._copyExact(c,u,d,f,h)}else{var U,F;if(B==1&&(U=T.fltree,F=T.fdtree),B==2){r.F.makeCodes(T.ltree,x),r.F.revCodes(T.ltree,x),r.F.makeCodes(T.dtree,y),r.F.revCodes(T.dtree,y),r.F.makeCodes(T.itree,b),r.F.revCodes(T.itree,b),U=T.ltree,F=T.dtree,O(f,h,w-257),O(f,h+=5,_-1),O(f,h+=5,j-4),h+=4;for(var H=0;H<j;H++)O(f,h+3*H,T.itree[1+(T.ordr[H]<<1)]);h+=3*j,h=r.F._codeTiny(E,T.itree,f,h),h=r.F._codeTiny(S,T.itree,f,h)}for(var z=u,K=0;K<o;K+=2){for(var W=a[K],q=W>>>23,oe=z+(8388607&W);z<oe;)h=r.F._writeLit(c[z++],U,f,h);if(q!=0){var J=a[K+1],Y=J>>16,Z=J>>8&255,G=255&J;O(f,h=r.F._writeLit(257+Z,U,f,h),q-T.of0[Z]),h+=T.exb[Z],P(f,h=r.F._writeLit(G,F,f,h),Y-T.df0[G]),h+=T.dxb[G],z+=q}}h=r.F._writeLit(256,U,f,h)}return h},r.F._copyExact=function(i,a,o,l,c){var u=c>>>3;return l[u]=o,l[u+1]=o>>>8,l[u+2]=255-l[u],l[u+3]=255-l[u+1],u+=4,l.set(new Uint8Array(i.buffer,a,o),u),c+(o+4<<3)},r.F.getTrees=function(){for(var i=r.F.U,a=r.F._hufTree(i.lhst,i.ltree,15),o=r.F._hufTree(i.dhst,i.dtree,15),l=[],c=r.F._lenCodes(i.ltree,l),u=[],d=r.F._lenCodes(i.dtree,u),f=0;f<l.length;f+=2)i.ihst[l[f]]++;for(f=0;f<u.length;f+=2)i.ihst[u[f]]++;for(var h=r.F._hufTree(i.ihst,i.itree,7),p=19;p>4&&i.itree[1+(i.ordr[p-1]<<1)]==0;)p--;return[a,o,h,c,d,p,l,u]},r.F.getSecond=function(i){for(var a=[],o=0;o<i.length;o+=2)a.push(i[o+1]);return a},r.F.nonZero=function(i){for(var a="",o=0;o<i.length;o+=2)i[o+1]!=0&&(a+=(o>>1)+",");return a},r.F.contSize=function(i,a){for(var o=0,l=0;l<a.length;l++)o+=a[l]*i[1+(l<<1)];return o},r.F._codeTiny=function(i,a,o,l){for(var c=0;c<i.length;c+=2){var u=i[c],d=i[c+1];l=r.F._writeLit(u,a,o,l);var f=u==16?2:u==17?3:7;u>15&&(r.F._putsE(o,l,d,f),l+=f)}return l},r.F._lenCodes=function(i,a){for(var o=i.length;o!=2&&i[o-1]==0;)o-=2;for(var l=0;l<o;l+=2){var c=i[l+1],u=l+3<o?i[l+3]:-1,d=l+5<o?i[l+5]:-1,f=l==0?-1:i[l-1];if(c==0&&u==c&&d==c){for(var h=l+5;h+2<o&&i[h+2]==c;)h+=2;(p=Math.min(h+1-l>>>1,138))<11?a.push(17,p-3):a.push(18,p-11),l+=2*p-2}else if(c==f&&u==c&&d==c){for(h=l+5;h+2<o&&i[h+2]==c;)h+=2;var p=Math.min(h+1-l>>>1,6);a.push(16,p-3),l+=2*p-2}else a.push(c,0)}return o>>>1},r.F._hufTree=function(i,a,o){var l=[],c=i.length,u=a.length,d=0;for(d=0;d<u;d+=2)a[d]=0,a[d+1]=0;for(d=0;d<c;d++)i[d]!=0&&l.push({lit:d,f:i[d]});var f=l.length,h=l.slice(0);if(f==0)return 0;if(f==1){var p=l[0].lit;return h=p==0?1:0,a[1+(p<<1)]=1,a[1+(h<<1)]=1,1}l.sort(function(E,S){return E.f-S.f});var x=l[0],y=l[1],b=0,w=1,_=2;for(l[0]={lit:-1,f:x.f+y.f,l:x,r:y,d:0};w!=f-1;)x=b!=w&&(_==f||l[b].f<l[_].f)?l[b++]:l[_++],y=b!=w&&(_==f||l[b].f<l[_].f)?l[b++]:l[_++],l[w++]={lit:-1,f:x.f+y.f,l:x,r:y};var j=r.F.setDepth(l[w-1],0);for(j>o&&(r.F.restrictDepth(h,o,j),j=o),d=0;d<f;d++)a[1+(h[d].lit<<1)]=h[d].d;return j},r.F.setDepth=function(i,a){return i.lit!=-1?(i.d=a,a):Math.max(r.F.setDepth(i.l,a+1),r.F.setDepth(i.r,a+1))},r.F.restrictDepth=function(i,a,o){var l=0,c=1<<o-a,u=0;for(i.sort(function(f,h){return h.d==f.d?f.f-h.f:h.d-f.d}),l=0;l<i.length&&i[l].d>a;l++){var d=i[l].d;i[l].d=a,u+=c-(1<<o-d)}for(u>>>=o-a;u>0;)(d=i[l].d)<a?(i[l].d++,u-=1<<a-d-1):l++;for(;l>=0;l--)i[l].d==a&&u<0&&(i[l].d--,u++);u!=0&&console.log("debt left")},r.F._goodIndex=function(i,a){var o=0;return a[16|o]<=i&&(o|=16),a[8|o]<=i&&(o|=8),a[4|o]<=i&&(o|=4),a[2|o]<=i&&(o|=2),a[1|o]<=i&&(o|=1),o},r.F._writeLit=function(i,a,o,l){return r.F._putsF(o,l,a[i<<1]),l+a[1+(i<<1)]},r.F.inflate=function(i,a){var o=Uint8Array;
vendor: 4,865 bytes, line 1187
1187if(i[0]==3&&i[1]==0)return a||new o(0);var l=r.F,c=l._bitsF,u=l._bitsE,d=l._decodeTiny,f=l.makeCodes,h=l.codes2map,p=l._get17,x=l.U,y=a==null;y&&(a=new o(i.length>>>2<<3));for(var b,w,_=0,j=0,E=0,S=0,T=0,P=0,O=0,D=0,R=0;_==0;)if(_=c(i,R,1),j=c(i,R+1,2),R+=3,j!=0){if(y&&(a=r.F._check(a,D+(1<<17))),j==1&&(b=x.flmap,w=x.fdmap,P=511,O=31),j==2){E=u(i,R,5)+257,S=u(i,R+5,5)+1,T=u(i,R+10,4)+4,R+=14;for(var L=0;L<38;L+=2)x.itree[L]=0,x.itree[L+1]=0;var M=1;for(L=0;L<T;L++){var B=u(i,R+3*L,3);x.itree[1+(x.ordr[L]<<1)]=B,B>M&&(M=B)}R+=3*T,f(x.itree,M),h(x.itree,M,x.imap),b=x.lmap,w=x.dmap,R=d(x.imap,(1<<M)-1,E+S,i,R,x.ttree);var U=l._copyOut(x.ttree,0,E,x.ltree);P=(1<<U)-1;var F=l._copyOut(x.ttree,E,S,x.dtree);O=(1<<F)-1,f(x.ltree,U),h(x.ltree,U,b),f(x.dtree,F),h(x.dtree,F,w)}for(;;){var H=b[p(i,R)&P];R+=15&H;var z=H>>>4;if(!(z>>>8))a[D++]=z;else{if(z==256)break;var K=D+z-254;if(z>264){var W=x.ldef[z-257];K=D+(W>>>3)+u(i,R,7&W),R+=7&W}var q=w[p(i,R)&O];R+=15&q;var oe=q>>>4,J=x.ddef[oe],Y=(J>>>4)+c(i,R,15&J);for(R+=15&J,y&&(a=r.F._check(a,D+(1<<17)));D<K;)a[D]=a[D++-Y],a[D]=a[D++-Y],a[D]=a[D++-Y],a[D]=a[D++-Y];D=K}}}else{7&R&&(R+=8-(7&R));var Z=4+(R>>>3),G=i[Z-4]|i[Z-3]<<8;y&&(a=r.F._check(a,D+G)),a.set(new o(i.buffer,i.byteOffset+Z,G),D),R=Z+G<<3,D+=G}return a.length==D?a:a.slice(0,D)},r.F._check=function(i,a){var o=i.length;if(a<=o)return i;var l=new Uint8Array(Math.max(o<<1,a));return l.set(i,0),l},r.F._decodeTiny=function(i,a,o,l,c,u){for(var d=r.F._bitsE,f=r.F._get17,h=0;h<o;){var p=i[f(l,c)&a];c+=15&p;var x=p>>>4;if(x<=15)u[h]=x,h++;else{var y=0,b=0;x==16?(b=3+d(l,c,2),c+=2,y=u[h-1]):x==17?(b=3+d(l,c,3),c+=3):x==18&&(b=11+d(l,c,7),c+=7);for(var w=h+b;h<w;)u[h]=y,h++}}return c},r.F._copyOut=function(i,a,o,l){for(var c=0,u=0,d=l.length>>>1;u<o;){var f=i[u+a];l[u<<1]=0,l[1+(u<<1)]=f,f>c&&(c=f),u++}for(;u<d;)l[u<<1]=0,l[1+(u<<1)]=0,u++;return c},r.F.makeCodes=function(i,a){for(var o,l,c,u,d=r.F.U,f=i.length,h=d.bl_count,p=0;p<=a;p++)h[p]=0;for(p=1;p<f;p+=2)h[i[p]]++;var x=d.next_code;for(o=0,h[0]=0,l=1;l<=a;l++)o=o+h[l-1]<<1,x[l]=o;for(c=0;c<f;c+=2)(u=i[c+1])!=0&&(i[c]=x[u],x[u]++)},r.F.codes2map=function(i,a,o){for(var l=i.length,c=r.F.U.rev15,u=0;u<l;u+=2)if(i[u+1]!=0)for(var d=u>>1,f=i[u+1],h=d<<4|f,p=a-f,x=i[u]<<p,y=x+(1<<p);x!=y;)o[c[x]>>>15-a]=h,x++},r.F.revCodes=function(i,a){for(var o=r.F.U.rev15,l=15-a,c=0;c<i.length;c+=2){var u=i[c]<<a-i[c+1];i[c]=o[u]>>>l}},r.F._putsE=function(i,a,o){o<<=7&a;var l=a>>>3;i[l]|=o,i[l+1]|=o>>>8},r.F._putsF=function(i,a,o){o<<=7&a;var l=a>>>3;i[l]|=o,i[l+1]|=o>>>8,i[l+2]|=o>>>16},r.F._bitsE=function(i,a,o){return(i[a>>>3]|i[1+(a>>>3)]<<8)>>>(7&a)&(1<<o)-1},r.F._bitsF=function(i,a,o){return(i[a>>>3]|i[1+(a>>>3)]<<8|i[2+(a>>>3)]<<16)>>>(7&a)&(1<<o)-1},r.F._get17=function(i,a){return(i[a>>>3]|i[1+(a>>>3)]<<8|i[2+(a>>>3)]<<16)>>>(7&a)},r.F._get25=function(i,a){return(i[a>>>3]|i[1+(a>>>3)]<<8|i[2+(a>>>3)]<<16|i[3+(a>>>3)]<<24)>>>(7&a)},r.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),function(){for(var i=r.F.U,a=0;a<32768;a++){var o=a;o=(4278255360&(o=(4042322160&(o=(3435973836&(o=(2863311530&o)>>>1|(1431655765&o)<<1))>>>2|(858993459&o)<<2))>>>4|(252645135&o)<<4))>>>8|(16711935&o)<<8,i.rev15[a]=(o>>>16|o<<16)>>>17}function l(c,u,d){for(;u--!=0;)c.push(0,d)}for(a=0;a<32;a++)i.ldef[a]=i.of0[a]<<3|i.exb[a],i.ddef[a]=i.df0[a]<<4|i.dxb[a];l(i.fltree,144,8),l(i.fltree,112,9),l(i.fltree,24,7),l(i.fltree,8,8),r.F.makeCodes(i.fltree,9),r.F.codes2map(i.fltree,9,i.flmap),r.F.revCodes(i.fltree,9),l(i.fdtree,32,5),r.F.makeCodes(i.fdtree,5),r.F.codes2map(i.fdtree,5,i.fdmap),r.F.revCodes(i.fdtree,5),l(i.itree,19,0),l(i.ltree,286,0),l(i.dtree,30,0),l(i.ttree,320,0)}()})();var pLe=fLe({__proto__:null,default:Q2},[Q2]);const Yl=function(){var e={nextZero(d,f){for(;d[f]!=0;)f++;return f},readUshort:(d,f)=>d[f]<<8|d[f+1],writeUshort(d,f,h){d[f]=h>>8&255,d[f+1]=255&h},readUint:(d,f)=>16777216*d[f]+(d[f+1]<<16|d[f+2]<<8|d[f+3]),writeUint(d,f,h){d[f]=h>>24&255,d[f+1]=h>>16&255,d[f+2]=h>>8&255,d[f+3]=255&h},readASCII(d,f,h){let p="";for(let x=0;x<h;x++)p+=String.fromCharCode(d[f+x]);return p},writeASCII(d,f,h){for(let p=0;p<h.length;
1187p++)d[f+p]=h.charCodeAt(p)},readBytes(d,f,h){const p=[];for(let x=0;x<h;x++)p.push(d[f+x]);return p},pad:d=>d.length<2?`0${d}`:d,readUTF8(d,f,h){let p,x="";for(let y=0;y<h;y++)x+=`%${e.pad(d[f+y].toString(16))}`;try{p=decodeURIComponent(x)}catch{return e.readASCII(d,f,h)}return p}};function t(d,f,h,p){const x=f*h,y=a(p),b=Math.ceil(f*y/8),w=new Uint8Array(4*x),_=new Uint32Array(w.buffer),{ctype:j}=p,{depth:E}=p,S=e.readUshort;if(j==6){const W=x<<2;if(E==8)for(var T=0;T<W;T+=4)w[T]=d[T],w[T+1]=d[T+1],w[T+2]=d[T+2],w[T+3]=d[T+3];if(E==16)for(T=0;T<W;T++)w[T]=d[T<<1]}else if(j==2){const W=p.tabs.tRNS;if(W==null){if(E==8)for(T=0;T<x;T++){var P=3*T;_[T]=255<<24|d[P+2]<<16|d[P+1]<<8|d[P]}if(E==16)for(T=0;T<x;T++)P=6*T,_[T]=255<<24|d[P+4]<<16|d[P+2]<<8|d[P]}else{var O=W[0];const q=W[1],oe=W[2];if(E==8)for(T=0;T<x;T++){var D=T<<2;P=3*T,_[T]=255<<24|d[P+2]<<16|d[P+1]<<8|d[P],d[P]==O&&d[P+1]==q&&d[P+2]==oe&&(w[D+3]=0)}if(E==16)for(T=0;T<x;T++)D=T<<2,P=6*T,_[T]=255<<24|d[P+4]<<16|d[P+2]<<8|d[P],S(d,P)==O&&S(d,P+2)==q&&S(d,P+4)==oe&&(w[D+3]=0)}}else if(j==3){const W=p.tabs.PLTE,q=p.tabs.tRNS,oe=q?q.length:0;if(E==1)for(var R=0;R<h;R++){var L=R*b,M=R*f;for(T=0;T<f;T++){D=M+T<<2;var B=3*(U=d[L+(T>>3)]>>7-((7&T)<<0)&1);w[D]=W[B],w[D+1]=W[B+1],w[D+2]=W[B+2],w[D+3]=U<oe?q[U]:255}}if(E==2)for(R=0;R<h;R++)for(L=R*b,M=R*f,T=0;T<f;T++)D=M+T<<2,B=3*(U=d[L+(T>>2)]>>6-((3&T)<<1)&3),w[D]=W[B],w[D+1]=W[B+1],w[D+2]=W[B+2],w[D+3]=U<oe?q[U]:255;if(E==4)for(R=0;R<h;R++)for(L=R*b,M=R*f,T=0;T<f;T++)D=M+T<<2,B=3*(U=d[L+(T>>1)]>>4-((1&T)<<2)&15),w[D]=W[B],w[D+1]=W[B+1],w[D+2]=W[B+2],w[D+3]=U<oe?q[U]:255;if(E==8)for(T=0;T<x;T++){var U;D=T<<2,B=3*(U=d[T]),w[D]=W[B],w[D+1]=W[B+1],w[D+2]=W[B+2],w[D+3]=U<oe?q[U]:255}}else if(j==4){if(E==8)for(T=0;T<x;T++){D=T<<2;var F=d[H=T<<1];w[D]=F,w[D+1]=F,w[D+2]=F,w[D+3]=d[H+1]}if(E==16)for(T=0;T<x;T++){var H;D=T<<2,F=d[H=T<<2],w[D]=F,w[D+1]=F,w[D+2]=F,w[D+3]=d[H+2]}}else if(j==0)for(O=p.tabs.tRNS?p.tabs.tRNS:-1,R=0;R<h;R++){const W=R*b,q=R*f;if(E==1)for(var z=0;z<f;z++){var K=(F=255*(d[W+(z>>>3)]>>>7-(7&z)&1))==255*O?0:255;_[q+z]=K<<24|F<<16|F<<8|F}else if(E==2)for(z=0;z<f;z++)K=(F=85*(d[W+(z>>>2)]>>>6-((3&z)<<1)&3))==85*O?0:255,_[q+z]=K<<24|F<<16|F<<8|F;else if(E==4)for(z=0;z<f;z++)K=(F=17*(d[W+(z>>>1)]>>>4-((1&z)<<2)&15))==17*O?0:255,_[q+z]=K<<24|F<<16|F<<8|F;else if(E==8)for(z=0;z<f;z++)K=(F=d[W+z])==O?0:255,_[q+z]=K<<24|F<<16|F<<8|F;else if(E==16)for(z=0;z<f;z++)F=d[W+(z<<1)],K=S(d,W+(z<<1))==O?0:255,_[q+z]=K<<24|F<<16|F<<8|F}return w}function n(d,f,h,p){const x=a(d),y=Math.ceil(h*x/8),b=new Uint8Array((y+1+d.interlace)*p);return f=d.tabs.CgBI?i(f,b):r(f,b),d.interlace==0?f=o(f,d,0,h,p):d.interlace==1&&(f=function(_,j){const E=j.width,S=j.height,T=a(j),P=T>>3,O=Math.ceil(E*T/8),D=new Uint8Array(S*O);let R=0;const L=[0,0,4,0,2,0,1],M=[0,4,0,2,0,1,0],B=[8,8,8,4,4,2,2],U=[8,8,4,4,2,2,1];let F=0;for(;F<7;){const z=B[F],K=U[F];let W=0,q=0,oe=L[F];for(;oe<S;)oe+=z,q++;let J=M[F];for(;J<E;)J+=K,W++;const Y=Math.ceil(W*T/8);o(_,j,R,W,q);let Z=0,G=L[F];for(;G<S;){let se=M[F],ce=R+Z*Y<<3;for(;se<E;){var H;if(T==1&&(H=(H=_[ce>>3])>>7-(7&ce)&1,D[G*O+(se>>3)]|=H<<7-((7&se)<<0)),T==2&&(H=(H=_[ce>>3])>>6-(7&ce)&3,D[G*O+(se>>2)]|=H<<6-((3&se)<<1)),T==4&&(H=(H=_[ce>>3])>>4-(7&ce)&15,D[G*O+(se>>1)]|=H<<4-((1&se)<<2)),T>=8){const le=G*O+se*P;for(let fe=0;fe<P;fe++)D[le+fe]=_[(ce>>3)+fe]}ce+=T,se+=K}Z++,G+=z}W*q!=0&&(R+=q*(1+Y)),F+=1}return D}(f,d)),f}function r(d,f){return i(new Uint8Array(d.buffer,2,d.length-6),f)}var i=function(){const d={H:{}};return d.H.N=function(f,h){const p=Uint8Array;let x,y,b=0,w=0,_=0,j=0,E=0,S=0,T=0,P=0,O=0;if(f[0]==3&&f[1]==0)return h||new p(0);const D=d.H,R=D.b,L=D.e,M=D.R,B=D.n,U=D.A,F=D.Z,H=D.m,z=h==null;for(z&&(h=new p(f.length>>>2<<5));b==0;)if(b=R(f,O,1),w=R(f,O+1,2),O+=3,w!=0){if(z&&(h=d.H.W(h,P+(1<<17))),w==1&&(x=H.J,y=H.h,S=511,T=31),w==2){_=L(f,O,5)+257,j=L(f,O+5,5)+1,E=L(f,O+10,4)+4,O+=14;let W=1;for(var K=0;K<38;K+=2)H.Q[K]=0,H.Q[K+1]=0;for(K=0;K<E;K++){const J=L(f,O+3*K,3);H.Q[1+(H.X[K]<<1)]=J,J>W&&(W=J)}O+=3*E,B(H.Q,W),U(H.Q,W,H.u),x=H.w,y=H.d,O=M(H.u,(1<<W)-1,_+j,f,O,H.v);const q=D.V(H.v,0,_,H.C);S=(1<<q)-1;const oe=D.V(H.v,_,j,H.D);T=(1<<oe)-1,B(H.C,q),U(H.C,q,x),B(H.D,oe),U(H.D,oe,y)}for(;;){const W=x[F(f,O)&S];O+=15&W;const q=W>>>4;if(!(q>>>8))h[P++]=q;else{if(q==256)break;{let oe=P+q-254;if(q>264){const se=H.q[q-257];oe=P+(se>>>3)+L(f,O,7&se),O+=7&se}const J=y[F(f,O)&T];O+=15&J;const Y=J>>>4,Z=H.c[Y],G=(Z>>>4)+R(f,O,15&Z);for(O+=15&Z;P<oe;)h[P]=h[P++-G],h[P]=h[P++-G],h[P]=h[P++-G],h[P]=h[P++-G];P=oe}}}}else{7&O&&(O+=8-(7&O));const W=4+(O>>>3),q=f[W-4]|f[W-3]<<8;z&&(h=d.H.W(h,P+q)),h.set(new p(f.buffer,f.byteOffset+W,q),P),O=W+q<<3,P+=q}return h.length==P?h:h.slice(0,P)},d.H.W=function(f,h){const p=f.length;if(h<=p)return f;const x=new Uint8Array(p<<1);return x.set(f,0),x},d.H.R=function(f,h,p,x,y,b){const w=d.H.e,_=d.H.Z;let j=0;for(;j<p;){const E=f[_(x,y)&h];y+=15&E;const S=E>>>4;if(S<=15)b[j]=S,j++;else{let T=0,P=0;S==16?(P=3+w(x,y,2),y+=2,T=b[j-1]):S==17?(P=3+w(x,y,3),y+=3):S==18&&(P=11+w(x,y,7),y+=7);const O=j+P;
vendor: 4,161 bytes, line 1187
1187for(;j<O;)b[j]=T,j++}}return y},d.H.V=function(f,h,p,x){let y=0,b=0;const w=x.length>>>1;for(;b<p;){const _=f[b+h];x[b<<1]=0,x[1+(b<<1)]=_,_>y&&(y=_),b++}for(;b<w;)x[b<<1]=0,x[1+(b<<1)]=0,b++;return y},d.H.n=function(f,h){const p=d.H.m,x=f.length;let y,b,w,_;const j=p.j;for(var E=0;E<=h;E++)j[E]=0;for(E=1;E<x;E+=2)j[f[E]]++;const S=p.K;for(y=0,j[0]=0,b=1;b<=h;b++)y=y+j[b-1]<<1,S[b]=y;for(w=0;w<x;w+=2)_=f[w+1],_!=0&&(f[w]=S[_],S[_]++)},d.H.A=function(f,h,p){const x=f.length,y=d.H.m.r;for(let b=0;b<x;b+=2)if(f[b+1]!=0){const w=b>>1,_=f[b+1],j=w<<4|_,E=h-_;let S=f[b]<<E;const T=S+(1<<E);for(;S!=T;)p[y[S]>>>15-h]=j,S++}},d.H.l=function(f,h){const p=d.H.m.r,x=15-h;for(let y=0;y<f.length;y+=2){const b=f[y]<<h-f[y+1];f[y]=p[b]>>>x}},d.H.M=function(f,h,p){p<<=7&h;const x=h>>>3;f[x]|=p,f[x+1]|=p>>>8},d.H.I=function(f,h,p){p<<=7&h;const x=h>>>3;f[x]|=p,f[x+1]|=p>>>8,f[x+2]|=p>>>16},d.H.e=function(f,h,p){return(f[h>>>3]|f[1+(h>>>3)]<<8)>>>(7&h)&(1<<p)-1},d.H.b=function(f,h,p){return(f[h>>>3]|f[1+(h>>>3)]<<8|f[2+(h>>>3)]<<16)>>>(7&h)&(1<<p)-1},d.H.Z=function(f,h){return(f[h>>>3]|f[1+(h>>>3)]<<8|f[2+(h>>>3)]<<16)>>>(7&h)},d.H.i=function(f,h){return(f[h>>>3]|f[1+(h>>>3)]<<8|f[2+(h>>>3)]<<16|f[3+(h>>>3)]<<24)>>>(7&h)},d.H.m=function(){const f=Uint16Array,h=Uint32Array;return{K:new f(16),j:new f(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new f(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new h(32),J:new f(512),_:[],h:new f(32),$:[],w:new f(32768),C:[],v:[],d:new f(32768),D:[],u:new f(512),Q:[],r:new f(32768),s:new h(286),Y:new h(30),a:new h(19),t:new h(15e3),k:new f(65536),g:new f(32768)}}(),function(){const f=d.H.m;for(var h=0;h<32768;h++){let x=h;x=(2863311530&x)>>>1|(1431655765&x)<<1,x=(3435973836&x)>>>2|(858993459&x)<<2,x=(4042322160&x)>>>4|(252645135&x)<<4,x=(4278255360&x)>>>8|(16711935&x)<<8,f.r[h]=(x>>>16|x<<16)>>>17}function p(x,y,b){for(;y--!=0;)x.push(0,b)}for(h=0;h<32;h++)f.q[h]=f.S[h]<<3|f.T[h],f.c[h]=f.p[h]<<4|f.z[h];p(f._,144,8),p(f._,112,9),p(f._,24,7),p(f._,8,8),d.H.n(f._,9),d.H.A(f._,9,f.J),d.H.l(f._,9),p(f.$,32,5),d.H.n(f.$,5),d.H.A(f.$,5,f.h),d.H.l(f.$,5),p(f.Q,19,0),p(f.C,286,0),p(f.D,30,0),p(f.v,320,0)}(),d.H.N}();function a(d){return[1,null,3,1,2,null,4][d.ctype]*d.depth}function o(d,f,h,p,x){let y=a(f);const b=Math.ceil(p*y/8);let w,_;y=Math.ceil(y/8);let j=d[h],E=0;if(j>1&&(d[h]=[0,0,1][j-2]),j==3)for(E=y;E<b;E++)d[E+1]=d[E+1]+(d[E+1-y]>>>1)&255;for(let S=0;S<x;S++)if(w=h+S*b,_=w+S+1,j=d[_-1],E=0,j==0)for(;E<b;E++)d[w+E]=d[_+E];else if(j==1){for(;E<y;E++)d[w+E]=d[_+E];for(;E<b;E++)d[w+E]=d[_+E]+d[w+E-y]}else if(j==2)for(;E<b;E++)d[w+E]=d[_+E]+d[w+E-b];else if(j==3){for(;E<y;E++)d[w+E]=d[_+E]+(d[w+E-b]>>>1);for(;E<b;E++)d[w+E]=d[_+E]+(d[w+E-b]+d[w+E-y]>>>1)}else{for(;E<y;E++)d[w+E]=d[_+E]+l(0,d[w+E-b],0);for(;E<b;E++)d[w+E]=d[_+E]+l(d[w+E-y],d[w+E-b],d[w+E-y-b])}return d}function l(d,f,h){const p=d+f-h,x=p-d,y=p-f,b=p-h;return x*x<=y*y&&x*x<=b*b?d:y*y<=b*b?f:h}function c(d,f,h){h.width=e.readUint(d,f),f+=4,h.height=e.readUint(d,f),f+=4,h.depth=d[f],f++,h.ctype=d[f],f++,h.compress=d[f],f++,h.filter=d[f],f++,h.interlace=d[f],f++}function u(d,f,h,p,x,y,b,w,_){const j=Math.min(f,x),E=Math.min(h,y);let S=0,T=0;for(let F=0;F<E;F++)for(let H=0;H<j;H++)if(b>=0&&w>=0?(S=F*f+H<<2,T=(w+F)*x+b+H<<2):(S=(-w+F)*f-b+H<<2,T=F*x+H<<2),_==0)p[T]=d[S],p[T+1]=d[S+1],p[T+2]=d[S+2],p[T+3]=d[S+3];else if(_==1){var P=d[S+3]*.00392156862745098,O=d[S]*P,D=d[S+1]*P,R=d[S+2]*P,L=p[T+3]*(1/255),M=p[T]*L,B=p[T+1]*L,U=p[T+2]*L;const z=1-P,K=P+L*z,W=K==0?0:1/K;p[T+3]=255*K,p[T+0]=(O+M*z)*W,p[T+1]=(D+B*z)*W,p[T+2]=(R+U*z)*W}else if(_==2)P=d[S+3],O=d[S],D=d[S+1],R=d[S+2],L=p[T+3],M=p[T],B=p[T+1],U=p[T+2],P==L&&O==M&&D==B&&R==U?(p[T]=0,p[T+1]=0,p[T+2]=0,p[T+3]=0):(p[T]=O,p[T+1]=D,p[T+2]=R,p[T+3]=P);else if(_==3){if(P=d[S+3],O=d[S],D=d[S+1],R=d[S+2],L=p[T+3],M=p[T],B=p[T
1187+1],U=p[T+2],P==L&&O==M&&D==B&&R==U)continue;if(P<220&&L>20)return!1}return!0}return{decode:function(f){const h=new Uint8Array(f);let p=8;const x=e,y=x.readUshort,b=x.readUint,w={tabs:{},frames:[]},_=new Uint8Array(h.length);let j,E=0,S=0;const T=[137,80,78,71,13,10,26,10];for(var P=0;P<8;P++)if(h[P]!=T[P])throw"The input is not a PNG file!";for(;p<h.length;){const F=x.readUint(h,p);p+=4;const H=x.readASCII(h,p,4);if(p+=4,H=="IHDR")c(h,p,w);else if(H=="iCCP"){for(var O=p;h[O]!=0;)O++;x.readASCII(h,p,O-p),h[O+1];const z=h.slice(O+2,p+F);let K=null;try{K=r(z)}catch{K=i(z)}w.tabs[H]=K}else if(H=="CgBI")w.tabs[H]=h.slice(p,p+4);else if(H=="IDAT"){for(P=0;P<F;P++)_[E+P]=h[p+P];E+=F}else if(H=="acTL")w.tabs[H]={num_frames:b(h,p),num_plays:b(h,p+4)},j=new Uint8Array(h.length);else if(H=="fcTL"){S!=0&&((U=w.frames[w.frames.length-1]).data=n(w,j.slice(0,S),U.rect.width,U.rect.height),S=0);const z={x:b(h,p+12),y:b(h,p+16),width:b(h,p+4),height:b(h,p+8)};let K=y(h,p+22);K=y(h,p+20)/(K==0?100:K);const W={rect:z,delay:Math.round(1e3*K),dispose:h[p+24],blend:h[p+25]};w.frames.push(W)}else if(H=="fdAT"){for(P=0;P<F-4;P++)j[S+P]=h[p+P+4];S+=F-4}else if(H=="pHYs")w.tabs[H]=[x.readUint(h,p),x.readUint(h,p+4),h[p+8]];else if(H=="cHRM")for(w.tabs[H]=[],P=0;P<8;P++)w.tabs[H].push(x.readUint(h,p+4*P));else if(H=="tEXt"||H=="zTXt"){w.tabs[H]==null&&(w.tabs[H]={});var D=x.nextZero(h,p),R=x.readASCII(h,p,D-p),L=p+F-D-1;if(H=="tEXt")B=x.readASCII(h,D+1,L);else{var M=r(h.slice(D+2,D+2+L));B=x.readUTF8(M,0,M.length)}w.tabs[H][R]=B}else if(H=="iTXt"){w.tabs[H]==null&&(w.tabs[H]={}),D=0,O=p,D=x.nextZero(h,O),R=x.readASCII(h,O,D-O);const z=h[O=D+1];var B;h[O+1],O+=2,D=x.nextZero(h,O),x.readASCII(h,O,D-O),O=D+1,D=x.nextZero(h,O),x.readUTF8(h,O,D-O),L=F-((O=D+1)-p),z==0?B=x.readUTF8(h,O,L):(M=r(h.slice(O,O+L)),B=x.readUTF8(M,0,M.length)),w.tabs[H][R]=B}else if(H=="PLTE")w.tabs[H]=x.readBytes(h,p,F);else if(H=="hIST"){const z=w.tabs.PLTE.length/3;for(w.tabs[H]=[],P=0;P<z;P++)w.tabs[H].push(y(h,p+2*P))}else if(H=="tRNS")w.ctype==3?w.tabs[H]=x.readBytes(h,p,F):w.ctype==0?w.tabs[H]=y(h,p):w.ctype==2&&(w.tabs[H]=[y(h,p),y(h,p+2),y(h,p+4)]);else if(H=="gAMA")w.tabs[H]=x.readUint(h,p)/1e5;else if(H=="sRGB")w.tabs[H]=h[p];else if(H=="bKGD")w.ctype==0||w.ctype==4?w.tabs[H]=[y(h,p)]:w.ctype==2||w.ctype==6?w.tabs[H]=[y(h,p),y(h,p+2),y(h,p+4)]:w.ctype==3&&(w.tabs[H]=h[p]);else if(H=="IEND")break;p+=F,x.readUint(h,p),p+=4}var U;return S!=0&&((U=w.frames[w.frames.length-1]).data=n(w,j.slice(0,S),U.rect.width,U.rect.height)),w.data=n(w,_,w.width,w.height),delete w.compress,delete w.interlace,delete w.filter,w},toRGBA8:function(f){const h=f.width,p=f.height;if(f.tabs.acTL==null)return[t(f.data,h,p,f).buffer];const x=[];f.frames[0].data==null&&(f.frames[0].data=f.data);const y=h*p*4,b=new Uint8Array(y),w=new Uint8Array(y),_=new Uint8Array(y);for(let E=0;E<f.frames.length;E++){const S=f.frames[E],T=S.rect.x,P=S.rect.y,O=S.rect.width,D=S.rect.height,R=t(S.data,O,D,f);if(E!=0)for(var j=0;j<y;j++)_[j]=b[j];if(S.blend==0?u(R,O,D,b,h,p,T,P,0):S.blend==1&&u(R,O,D,b,h,p,T,P,1),x.push(b.buffer.slice(0)),S.dispose!=0){if(S.dispose==1)u(w,O,D,b,h,p,T,P,0);else if(S.dispose==2)for(j=0;j<y;j++)b[j]=_[j]}}return x},_paeth:l,_copyTile:u,_bin:e}}();(function(){const{_copyTile:e}=Yl,{_bin:t}=Yl,n=Yl._paeth;var r={table:function(){const O=new Uint32Array(256);for(let D=0;D<256;D++){let R=D;for(let L=0;L<8;L++)1&R?R=3988292384^R>>>1:R>>>=1;O[D]=R}return O}(),update(O,D,R,L){for(let M=0;M<L;M++)O=r.table[255&(O^D[R+M])]^O>>>8;return O},crc:(O,D,R)=>4294967295^r.update(4294967295,O,D,R)};function i(O,D,R,L){D[R]+=O[0]*L>>4,D[R+1]+=O[1]*L>>4,D[R+2]+=O[2]*L>>4,D[R+3]+=O[3]*L>>4}function a(O){return Math.max(0,Math.min(255,O))}function o(O,D){const R=O[0]-D[0],L=O[1]-D[1],M=O[2]-D[2],B=O[3]-D[3];return R*R+L*L+M*M+B*B}function l(O,D,R,L,M,B,U){U==null&&(U=1);const F=L.length,H=[];for(var z=0;z<F;z++){const G=L[z];H.push([G>>>0&255,G>>>8&255,G>>>16&255,G>>>24&255])}for(z=0;z<F;z++){let G=4294967295;for(var K=0,W=0;W<F;W++){var q=o(H[z],H[W]);W!=z&&q<G&&(G=q,K=W)}}const oe=new Uint32Array(M.buffer),J=new Int16Array(D*R*4),Y=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(z=0;z<Y.length;z++)Y[z]=255*((Y[z]+.5)/16-.5);for(let G=0;G<R;G++)for(let se=0;se<D;se++){var Z;z=4*(G*D+se),U!=2?Z=[a(O[z]+J[z]),a(O[z+1]+J[z+1]),a(O[z+2]+J[z+2]),a(O[z+3]+J[z+3])]:(q=Y[4*(3&G)+(3&se)],Z=[a(O[z]+q),a(O[z+1]+q),a(O[z+2]+q),a(O[z+3]+q)]),K=0;let ce=16777215;for(W=0;W<F;W++){const be=o(Z,H[W]);be<ce&&(ce=be,K=W)}const le=H[K],fe=[Z[0]-le[0],Z[1]-le[1],Z[2]-le[2],Z[3]-le[3]];U==1&&(se!=D-1&&i(fe,J,z+4,7),G!=R-1&&(se!=0&&i(fe,J,z+4*D-4,3),i(fe,J,z+4*D,5),se!=D-1&&i(fe,J,z+4*D+4,1))),B[z>>2]=K,oe[z>>2]=L[K]}}function c(O,D,R,L,M){M==null&&(M={});const{crc:B}=r,U=t.writeUint,F=t.writeUshort,H=t.writeASCII;let z=8;const K=O.frames.length>1;let W,q=!1,oe=33+(K?20:0);if(M.sRGB!=null&&(oe+=13),M.pHYs!=null&&(oe+=21),M.iCCP!=null&&(W=pako.deflate(M.iCCP),oe+=21+W.length+4),O.ctype==3){for(var J=O.plte.length,Y=0;Y<J;Y++)O.plte[Y]>>>24!=255&&(q=!0);oe+=8+3*J+4+(q?8+1*J+4:0)}for(var Z=0;Z<O.frames.length;Z++)K&&(oe+=38),oe+=(le=O.frames[Z]).cimg.length+12,Z!=0&&(oe+=4);oe+=12;const G=new Uint8Array(oe),se=[137,80,78,71,13,10,26,10];for(Y=0;Y<8;Y++)G[Y]=se[Y];if(U(G,z,13),z+=4,H(G,z,"IHDR"),z+=4,U(G,z,D),z+=4,U(G,z,R),z+=4,G[z]=O.depth,z++,G[z]=O.ctype,z++,G[z]=0,z++,G[z]=0,z++,G[z]=0,z++,U(G,z,B(G,z-17,17)),z+=4,M.sRGB!=null&&(U(G,z,1),z+=4,H(G,z,"sRGB"),z+=4,G[z]=M.sRGB,z++,U(G,z,B(G,z-5,5)),z+=4),M.iCCP!=null){const fe=13+W.length;U(G,z,fe),z+=4,H(G,z,"iCCP"),z+=4,H(G,z,"ICC profile"),z+=11,z+=2,G.set(W,z),z+=W.length,U(G,z,B(G,z-(fe+4),fe+4)),z+=4}if(M.pHYs!=null&&(U(G,z,9),z+=4,H(G,z,"pHYs"),z+=4,U(G,z,M.pHYs[0]),z+=4,U(G,z,M.pHYs[1]),z+=4,G[z]=M.pHYs[2],z++,U(G,z,B(G,z-13,13)),z+=4),K&&(U(G,z,8),z+=4,H(G,z,"acTL"),z+=4,U(G,z,O.frames.length),z+=4,U(G,z,M.loop!=null?M.loop:0),z+=4,U(G,z,B(G,z-12,12)),z+=4),O.ctype==3){for(U(G,z,3*(J=O.plte.length)),z+=4,H(G,z,"PLTE"),z+=4,Y=0;Y<J;Y++){const fe=3*Y,be=O.plte[Y],_e=255&be,pe=be>>>8&255,Te=be>>>16&255;G[z+fe+0]=_e,G[z+fe+1]=pe,G[z+fe+2]=Te}if(z+=3*J,U(G,z,B(G,z-3*J-4,3*J+4)),z+=4,q){for(U(G,z,J),z+=4,H(G,z,"tRNS"),z+=4,Y=0;Y<J;Y++)G[z+Y]=O.plte[Y]>>>24&255;z+=J,U(G,z,B(G,z-J-4,J+4)),z+=4}}let ce=0;for(Z=0;Z<O.frames.length;Z++){var le=O.frames[Z];K&&(U(G,z,26),z+=4,H(G,z,"fcTL"),z+=4,U(G,z,ce++),z+=4,U(G,z,le.rect.width),z+=4,U(G,z,le.rect.height),z+=4,U(G,z,le.rect.x),z+=4,U(G,z,le.rect.y),z+=4,F(G,z,L[Z]),z+=2,F(G,z,1e3),z+=2,G[z]=le.dispose,z++,G[z]=le.blend,z++,U(G,z,B(G,z-30,30)),z+=4);const fe=le.cimg;U(G,z,(J=fe.length)+(Z==0?0:4)),z+=4;const be=z;H(G,z,Z==0?"IDAT":"fdAT"),z+=4,Z!=0&&(U(G,z,ce++),z+=4),G.set(fe,z),z+=J,U(G,z,B(G,be,z-be)),z+=4}return U(G,z,0),z+=4,H(G,z,"IEND"),z+=4,U(G,z,B(G,z-4,4)),z+=4,G.buffer}function u(O,D,R){for(let L=0;L<O.frames.length;L++){const M=O.frames[L];M.rect.width;const B=M.rect.height,U=new Uint8Array(B*M.bpl+B);M.cimg=p(M.img,B,M.bpp,M.bpl,U,D,R)}}function d(O,D,R,L,M){const B=M[0],U=M[1],F=M[2],H=M[3],z=M[4],K=M[5];let W=6,q=8,oe=255;for(var J=0;J<O.length;J++){const it=new Uint8Array(O[J]);for(var Y=it.length,Z=0;Z<Y;Z+=4)oe&=it[Z+3]}const G=oe!=255,se=function(qe,Qe,ot,de,me,ke){const Be=[];for(var Ae=0;Ae<qe.length;Ae++){const yt=new Uint8Array(qe[Ae]),nn=new Uint32Array(yt.buffer);var $e;let Vn=0,zt=0,He=Qe,bn=ot,Rt=de?1:0;if(Ae!=0){const An=ke||de||Ae==1||Be[Ae-2].dispose!=0?1:2;let gt=0,kn=1e9;for(let Tn=0;Tn<An;Tn++){var ge=new Uint8Array(qe[Ae-1-Tn]);
1187const Pt=new Uint32Array(qe[Ae-1-Tn]);let Jt=Qe,Gn=ot,Mr=-1,ht=-1;for(let Mt=0;Mt<ot;Mt++)for(let $n=0;$n<Qe;$n++)nn[Ve=Mt*Qe+$n]!=Pt[Ve]&&($n<Jt&&(Jt=$n),$n>Mr&&(Mr=$n),Mt<Gn&&(Gn=Mt),Mt>ht&&(ht=Mt));Mr==-1&&(Jt=Gn=Mr=ht=0),me&&((1&Jt)==1&&Jt--,(1&Gn)==1&&Gn--);const rn=(Mr-Jt+1)*(ht-Gn+1);rn<kn&&(kn=rn,gt=Tn,Vn=Jt,zt=Gn,He=Mr-Jt+1,bn=ht-Gn+1)}ge=new Uint8Array(qe[Ae-1-gt]),gt==1&&(Be[Ae-1].dispose=2),$e=new Uint8Array(He*bn*4),e(ge,Qe,ot,$e,He,bn,-Vn,-zt,0),Rt=e(yt,Qe,ot,$e,He,bn,-Vn,-zt,3)?1:0,Rt==1?h(yt,Qe,ot,$e,{x:Vn,y:zt,width:He,height:bn}):e(yt,Qe,ot,$e,He,bn,-Vn,-zt,0)}else $e=yt.slice(0);Be.push({rect:{x:Vn,y:zt,width:He,height:bn},img:$e,blend:Rt,dispose:0})}if(de)for(Ae=0;Ae<Be.length;Ae++){if((ct=Be[Ae]).blend==1)continue;const yt=ct.rect,nn=Be[Ae-1].rect,Vn=Math.min(yt.x,nn.x),zt=Math.min(yt.y,nn.y),He={x:Vn,y:zt,width:Math.max(yt.x+yt.width,nn.x+nn.width)-Vn,height:Math.max(yt.y+yt.height,nn.y+nn.height)-zt};Be[Ae-1].dispose=1,Ae-1!=0&&f(qe,Qe,ot,Be,Ae-1,He,me),f(qe,Qe,ot,Be,Ae,He,me)}let Le=0;if(qe.length!=1)for(var Ve=0;Ve<Be.length;Ve++){var ct;Le+=(ct=Be[Ve]).rect.width*ct.rect.height}return Be}(O,D,R,B,U,F),ce={},le=[],fe=[];if(L!=0){const it=[];for(Z=0;Z<se.length;Z++)it.push(se[Z].img.buffer);const qe=function(me){let ke=0;for(var Be=0;Be<me.length;Be++)ke+=me[Be].byteLength;const Ae=new Uint8Array(ke);let $e=0;for(Be=0;Be<me.length;Be++){const ge=new Uint8Array(me[Be]),Le=ge.length;for(let Ve=0;Ve<Le;Ve+=4){let ct=ge[Ve],yt=ge[Ve+1],nn=ge[Ve+2];const Vn=ge[Ve+3];Vn==0&&(ct=yt=nn=0),Ae[$e+Ve]=ct,Ae[$e+Ve+1]=yt,Ae[$e+Ve+2]=nn,Ae[$e+Ve+3]=Vn}$e+=Le}return Ae.buffer}(it),Qe=y(qe,L);for(Z=0;Z<Qe.plte.length;Z++)le.push(Qe.plte[Z].est.rgba);let ot=0;for(Z=0;Z<se.length;Z++){const de=(_e=se[Z]).img.length;var be=new Uint8Array(Qe.inds.buffer,ot>>2,de>>2);fe.push(be);const me=new Uint8Array(Qe.abuf,ot,de);K&&l(_e.img,_e.rect.width,_e.rect.height,le,me,be),_e.img.set(me),ot+=de}}else for(J=0;J<se.length;J++){var _e=se[J];const it=new Uint32Array(_e.img.buffer);var pe=_e.rect.width;for(Y=it.length,be=new Uint8Array(Y),fe.push(be),Z=0;Z<Y;Z++){const qe=it[Z];if(Z!=0&&qe==it[Z-1])be[Z]=be[Z-1];else if(Z>pe&&qe==it[Z-pe])be[Z]=be[Z-pe];else{let Qe=ce[qe];if(Qe==null&&(ce[qe]=Qe=le.length,le.push(qe),le.length>=300))break;be[Z]=Qe}}}const Te=le.length;for(Te<=256&&z==0&&(q=Te<=2?1:Te<=4?2:Te<=16?4:8,q=Math.max(q,H)),J=0;J<se.length;J++){(_e=se[J]).rect.x,_e.rect.y,pe=_e.rect.width;const it=_e.rect.height;let qe=_e.img;new Uint32Array(qe.buffer);let Qe=4*pe,ot=4;if(Te<=256&&z==0){Qe=Math.ceil(q*pe/8);var Ge=new Uint8Array(Qe*it);const de=fe[J];for(let me=0;me<it;me++){Z=me*Qe;const ke=me*pe;if(q==8)for(var Ne=0;Ne<pe;Ne++)Ge[Z+Ne]=de[ke+Ne];else if(q==4)for(Ne=0;Ne<pe;Ne++)Ge[Z+(Ne>>1)]|=de[ke+Ne]<<4-4*(1&Ne);else if(q==2)for(Ne=0;Ne<pe;Ne++)Ge[Z+(Ne>>2)]|=de[ke+Ne]<<6-2*(3&Ne);else if(q==1)for(Ne=0;Ne<pe;Ne++)Ge[Z+(Ne>>3)]|=de[ke+Ne]<<7-1*(7&Ne)}qe=Ge,W=3,ot=1}else if(G==0&&se.length==1){Ge=new Uint8Array(pe*it*3);const de=pe*it;for(Z=0;Z<de;Z++){const me=3*Z,ke=4*Z;Ge[me]=qe[ke],Ge[me+1]=qe[ke+1],Ge[me+2]=qe[ke+2]}qe=Ge,W=2,ot=3,Qe=3*pe}_e.img=qe,_e.bpl=Qe,_e.bpp=ot}return{ctype:W,depth:q,plte:le,frames:se}}function f(O,D,R,L,M,B,U){const F=Uint8Array,H=Uint32Array,z=new F(O[M-1]),K=new H(O[M-1]),W=M+1<O.length?new F(O[M+1]):null,q=new F(O[M]),oe=new H(q.buffer);let J=D,Y=R,Z=-1,G=-1;for(let ce=0;ce<B.height;ce++)for(let le=0;le<B.width;le++){const fe=B.x+le,be=B.y+ce,_e=be*D+fe,pe=oe[_e];
1187pe==0||L[M-1].dispose==0&&K[_e]==pe&&(W==null||W[4*_e+3]!=0)||(fe<J&&(J=fe),fe>Z&&(Z=fe),be<Y&&(Y=be),be>G&&(G=be))}Z==-1&&(J=Y=Z=G=0),U&&((1&J)==1&&J--,(1&Y)==1&&Y--),B={x:J,y:Y,width:Z-J+1,height:G-Y+1};const se=L[M];se.rect=B,se.blend=1,se.img=new Uint8Array(B.width*B.height*4),L[M-1].dispose==0?(e(z,D,R,se.img,B.width,B.height,-B.x,-B.y,0),h(q,D,R,se.img,B)):e(q,D,R,se.img,B.width,B.height,-B.x,-B.y,0)}function h(O,D,R,L,M){e(O,D,R,L,M.width,M.height,-M.x,-M.y,2)}function p(O,D,R,L,M,B,U){const F=[];let H,z=[0,1,2,3,4];B!=-1?z=[B]:(D*L>5e5||R==1)&&(z=[0]),U&&(H={level:0});const K=pLe;for(var W=0;W<z.length;W++){for(let J=0;J<D;J++)x(M,O,J,L,R,z[W]);F.push(K.deflate(M,H))}let q,oe=1e9;for(W=0;W<F.length;W++)F[W].length<oe&&(q=W,oe=F[W].length);return F[q]}function x(O,D,R,L,M,B){const U=R*L;let F=U+R;if(O[F]=B,F++,B==0)if(L<500)for(var H=0;H<L;H++)O[F+H]=D[U+H];else O.set(new Uint8Array(D.buffer,U,L),F);else if(B==1){for(H=0;H<M;H++)O[F+H]=D[U+H];for(H=M;H<L;H++)O[F+H]=D[U+H]-D[U+H-M]+256&255}else if(R==0){for(H=0;H<M;H++)O[F+H]=D[U+H];if(B==2)for(H=M;H<L;H++)O[F+H]=D[U+H];if(B==3)for(H=M;H<L;H++)O[F+H]=D[U+H]-(D[U+H-M]>>1)+256&255;if(B==4)for(H=M;H<L;H++)O[F+H]=D[U+H]-n(D[U+H-M],0,0)+256&255}else{if(B==2)for(H=0;H<L;H++)O[F+H]=D[U+H]+256-D[U+H-L]&255;if(B==3){for(H=0;H<M;H++)O[F+H]=D[U+H]+256-(D[U+H-L]>>1)&255;for(H=M;H<L;H++)O[F+H]=D[U+H]+256-(D[U+H-L]+D[U+H-M]>>1)&255}if(B==4){for(H=0;H<M;H++)O[F+H]=D[U+H]+256-n(0,D[U+H-L],0)&255;for(H=M;H<L;H++)O[F+H]=D[U+H]+256-n(D[U+H-M],D[U+H-L],D[U+H-M-L])&255}}}function y(O,D){const R=new Uint8Array(O),L=R.slice(0),M=new Uint32Array(L.buffer),B=b(L,D),U=B[0],F=B[1],H=R.length,z=new Uint8Array(H>>2);let K;if(R.length<2e7)for(var W=0;W<H;W+=4)K=w(U,q=R[W]*(1/255),oe=R[W+1]*(1/255),J=R[W+2]*(1/255),Y=R[W+3]*(1/255)),z[W>>2]=K.ind,M[W>>2]=K.est.rgba;else for(W=0;W<H;W+=4){var q=R[W]*.00392156862745098,oe=R[W+1]*(1/255),J=R[W+2]*(1/255),Y=R[W+3]*(1/255);for(K=U;K.left;)K=_(K.est,q,oe,J,Y)<=0?K.left:K.right;z[W>>2]=K.ind,M[W>>2]=K.est.rgba}return{abuf:L.buffer,inds:z,plte:F}}function b(O,D,R){R==null&&(R=1e-4);const L=new Uint32Array(O.buffer),M={i0:0,i1:O.length,bst:null,est:null,tdst:0,left:null,right:null};M.bst=S(O,M.i0,M.i1),M.est=T(M.bst);const B=[M];for(;B.length<D;){let F=0,H=0;for(var U=0;U<B.length;U++)B[U].est.L>F&&(F=B[U].est.L,H=U);if(F<R)break;const z=B[H],K=j(O,L,z.i0,z.i1,z.est.e,z.est.eMq255);if(z.i0>=K||z.i1<=K){z.est.L=0;continue}const W={i0:z.i0,i1:K,bst:null,est:null,tdst:0,left:null,right:null};W.bst=S(O,W.i0,W.i1),W.est=T(W.bst);const q={i0:K,i1:z.i1,bst:null,est:null,tdst:0,left:null,right:null};for(q.bst={R:[],m:[],N:z.bst.N-W.bst.N},U=0;U<16;U++)q.bst.R[U]=z.bst.R[U]-W.bst.R[U];for(U=0;U<4;U++)q.bst.m[U]=z.bst.m[U]-W.bst.m[U];q.est=T(q.bst),z.left=W,z.right=q,B[H]=W,B.push(q)}for(B.sort((F,H)=>H.bst.N-F.bst.N),U=0;U<B.length;U++)B[U].ind=U;return[M,B]}function w(O,D,R,L,M){if(O.left==null)return O.tdst=function(W,q,oe,J,Y){const Z=q-W[0],G=oe-W[1],se=J-W[2],ce=Y-W[3];return Z*Z+G*G+se*se+ce*ce}(O.est.q,D,R,L,M),O;const B=_(O.est,D,R,L,M);let U=O.left,F=O.right;B>0&&(U=O.right,F=O.left);const H=w(U,D,R,L,M);if(H.tdst<=B*B)return H;const z=w(F,D,R,L,M);return z.tdst<H.tdst?z:H}function _(O,D,R,L,M){const{e:B}=O;return B[0]*D+B[1]*R+B[2]*L+B[3]*M-O.eMq}function j(O,D,R,L,M,B){for(L-=4;R<L;){for(;E(O,R,M)<=B;)R+=4;for(;E(O,L,M)>B;)L-=4;if(R>=L)break;const U=D[R>>2];D[R>>2]=D[L>>2],D[L>>2]=U,R+=4,L-=4}for(;E(O,R,M)>B;)R-=4;return R+4}function E(O,D,R){return O[D]*R[0]+O[D+1]*R[1]+O[D+2]*R[2]+O[D+3]*R[3]}function S(O,D,R){const L=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],M=[0,0,0,0],B=R-D>>2;for(let U=D;U<R;U+=4){const F=O[U]*.00392156862745098,H=O[U+1]*(1/255),z=O[U+2]*(1/255),K=O[U+3]*(1/255);M[0]+=F,M[1]+=H,M[2]+=z,M[3]+=K,L[0]+=F*F,L[1]+=F*H,L[2]+=F*z,L[3]+=F*K,L[5]+=H*H,L[6]+=H*z,L[7]+=H*K,L[10]+=z*z,L[11]+=z*K,L[15]+=K*K}return L[4]=L[1],L[8]=L[2],L[9]=L[6],L[12]=L[3],L[13]=L[7],L[14]=L[11],{R:L,m:M,N:B}}function T(O){const{R:D}=O,{m:R}=O,{N:L}=O,M=R[0],B=R[1],U=R[2],F=R[3],H=L==0?0:1/L,z=[D[0]-M*M*H,D[1]-M*B*H,D[2]-M*U*H,D[3]-M*F*H,D[4]-B*M*H,D[5]-B*B*H,D[6]-B*U*H,D[7]-B*F*H,D[8]-U*M*H,D[9]-U*B*H,D[10]-U*U*H,D[11]-U*F*H,D[12]-F*M*H,D[13]-F*B*H,D[14]-F*U*H,D[15]-F*F*H],K=z,W=P;let q=[Math.random(),Math.random(),Math.random(),Math.random()],oe=0,J=0;if(L!=0)for(let Z=0;Z<16&&(q=W.multVec(K,q),J=Math.sqrt(W.dot(q,q)),q=W.sml(1/J,q),!(Z!=0&&Math.abs(J-oe)<1e-9));Z++)oe=J;const Y=[M*H,B*H,U*H,F*H];return{Cov:z,q:Y,e:q,L:oe,eMq255:W.dot(W.sml(255,Y),q),eMq:W.dot(q,Y),rgba:(Math.round(255*Y[3])<<24|Math.round(255*Y[2])<<16|Math.round(255*Y[1])<<8|Math.round(255*Y[0])<<0)>>>0}}var P={multVec:(O,D)=>
1187[O[0]*D[0]+O[1]*D[1]+O[2]*D[2]+O[3]*D[3],O[4]*D[0]+O[5]*D[1]+O[6]*D[2]+O[7]*D[3],O[8]*D[0]+O[9]*D[1]+O[10]*D[2]+O[11]*D[3],O[12]*D[0]+O[13]*D[1]+O[14]*D[2]+O[15]*D[3]],dot:(O,D)=>O[0]*D[0]+O[1]*D[1]+O[2]*D[2]+O[3]*D[3],sml:(O,D)=>[O*D[0],O*D[1],O*D[2],O*D[3]]};Yl.encode=function(D,R,L,M,B,U,F){M==null&&(M=0),F==null&&(F=!1);const H=d(D,R,L,M,[!1,!1,!1,0,F,!1]);return u(H,-1),c(H,R,L,B,U)},Yl.encodeLL=function(D,R,L,M,B,U,F,H){const z={ctype:0+(M==1?0:2)+(B==0?0:4),depth:U,frames:[]},K=(M+B)*U,W=K*R;for(let q=0;q<D.length;q++)z.frames.push({rect:{x:0,y:0,width:R,height:L},img:new Uint8Array(D[q]),blend:0,dispose:1,bpp:Math.ceil(K/8),bpl:Math.ceil(W/8)});return u(z,0,!0),c(z,R,L,F,H)},Yl.encode.compress=d,Yl.encode.dither=l,Yl.quantize=y,Yl.quantize.getKDtree=b,Yl.quantize.getNearest=w})();const pae={toArrayBuffer(e,t){const n=e.width,r=e.height,i=n<<2,a=e.getContext("2d").getImageData(0,0,n,r),o=new Uint32Array(a.data.buffer),l=(32*n+31)/32<<2,c=l*r,u=122+c,d=new ArrayBuffer(u),f=new DataView(d),h=1<<20;let p,x,y,b,w=h,_=0,j=0,E=0;function S(O){f.setUint16(j,O,!0),j+=2}function T(O){f.setUint32(j,O,!0),j+=4}function P(O){j+=O}S(19778),T(u),P(4),T(122),T(108),T(n),T(-r>>>0),S(1),S(32),T(3),T(c),T(2835),T(2835),P(8),T(16711680),T(65280),T(255),T(4278190080),T(1466527264),function O(){for(;_<r&&w>0;){for(b=122+_*l,p=0;p<i;)w--,x=o[E++],y=x>>>24,f.setUint32(b+p,x<<8|y),p+=4;_++}E<o.length?(w=h,setTimeout(O,pae._dly)):t(d)}()},toBlob(e,t){this.toArrayBuffer(e,n=>{t(new Blob([n],{type:"image/bmp"}))})},_dly:9};var lo={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},gLe={[lo.CHROME]:16384,[lo.FIREFOX]:11180,[lo.DESKTOP_SAFARI]:16384,[lo.IE]:8192,[lo.IOS]:4096,[lo.ETC]:8192};const JM=typeof window<"u",gae=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,J2=JM&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),xLe=(JM||gae)&&(J2&&J2.getOriginalSymbol(window,"File")||typeof File<"u"&&File),xae=(JM||gae)&&(J2&&J2.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function ZM(e,t,n=Date.now()){return new Promise(r=>{const i=e.split(","),a=i[0].match(/:(.*?);/)[1],o=globalThis.atob(i[1]);let l=o.length;const c=new Uint8Array(l);for(;l--;)c[l]=o.charCodeAt(l);const u=new Blob([c],{type:a});u.name=t,u.lastModified=n,r(u)})}function yae(e){return new Promise((t,n)=>{const r=new xae;r.onload=()=>t(r.result),r.onerror=i=>n(i),r.readAsDataURL(e)})}function vae(e){return new Promise((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=i=>n(i),r.src=e})}function lm(){if(lm.cachedResult!==void 0)return lm.cachedResult;let e=lo.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=lo.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=lo.IOS:/Safari/i.test(t)?e=lo.DESKTOP_SAFARI:/Firefox/i.test(t)?e=lo.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=lo.IE),lm.cachedResult=e,lm.cachedResult}function bae(e,t){const n=lm(),r=gLe[n];let i=e,a=t,o=i*a;const l=i>a?a/i:i/a;for(;o>r*r;){const c=(r+i)/2,u=(r+a)/2;c<u?(a=u,i=u*l):(a=c*l,i=c),o=i*a}return{width:i,height:a}}function GC(e,t){let n,r;try{if(n=new OffscreenCanvas(e,t),r=n.getContext("2d"),r===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),r=n.getContext("2d")}return n.width=e,n.height=t,[n,r]}function wae(e,t){const{width:n,height:r}=bae(e.width,e.height),[i,a]=GC(n,r);return t&&/jpe?g/.test(t)&&(a.fillStyle="white",a.fillRect(0,0,i.width,i.height)),a.drawImage(e,0,0,i.width,i.height),i}function Ej(){return Ej.cachedResult!==void 0||(Ej.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Ej.cachedResult}function Z2(e,t={}){return new Promise(function(n,r){let i,a;var o=function(){try{return a=wae(i,t.fileType||e.type),n([i,a])}catch(c){return r(c)}},l=function(c){try{var u=function(d){try{throw d}catch(f){return r(f)}};try{let d;return yae(e).then(function(f){try{return d=f,vae(d).then(function(h){try{return i=h,function(){try{return o()}catch(p){return r(p)}}()}catch(p){return u(p)}},u)}catch(h){return u(h)}},u)}catch(d){u(d)}}catch(d){return r(d)}};try{if(Ej()||[lo.DESKTOP_SAFARI,lo.MOBILE_SAFARI].includes(lm()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then(function(c){try{return i=c,o()}catch{return l()}},l)}catch{l()}})}function eN(e,t,n,r,i=1){return new Promise(function(a,o){let l;if(t==="image/png"){let u,d,f;return u=e.getContext("2d"),{data:d}=u.getImageData(0,0,e.width,e.height),f=Yl.encode([d.buffer],e.width,e.height,4096*i),l=new Blob([f],{type:t}),l.name=n,l.lastModified=r,c.call(this)}{let u=function(){return c.call(this)};if(t==="image/bmp")return new Promise(d=>pae.toBlob(e,d)).then((function(d){try{return l=d,l.name=n,l.lastModified=r,u.call(this)}catch(f){return o(f)}}).bind(this),o);{let d=function(){return u.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:i}).then((function(f){try{return l=f,l.name=n,l.lastModified=r,d.call(this)}catch(h){return o(h)}}).bind(this),o);{let f;return f=e.toDataURL(t,i),ZM(f,n,r).then((function(h){try{return l=h,d.call(this)}catch(p){return o(p)}}).bind(this),o)}}}function c(){return a(l)}})}function Bc(e){e.width=0,e.height=0}function kg(){return new Promise(function(e,t){let n,r,i,a;return kg.cachedResult!==void 0?e(kg.cachedResult):ZM("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then(function(o){try{return n=o,Z2(n).then(function(l){try{return r=l[1],eN(r,n.type,n.name,n.lastModified).then(function(c){try{return i=c,Bc(r),Z2(i).then(function(u){try{return a=u[0],kg.cachedResult=a.width===1&&a.height===2,e(kg.cachedResult)}catch(d){return t(d)}},t)}catch(u){return t(u)}},t)}catch(c){return t(c)}},t)}catch(l){return t(l)}},t)})}function _ae(e){return new Promise((t,n)=>{const r=new xae;r.onload=i=>{const a=new DataView(i.target.result);if(a.getUint16(0,!1)!=65496)return t(-2);const o=a.byteLength;let l=2;for(;
1187l<o;){if(a.getUint16(l+2,!1)<=8)return t(-1);const c=a.getUint16(l,!1);if(l+=2,c==65505){if(a.getUint32(l+=2,!1)!=1165519206)return t(-1);const u=a.getUint16(l+=6,!1)==18761;l+=a.getUint32(l+4,u);const d=a.getUint16(l,u);l+=2;for(let f=0;f<d;f++)if(a.getUint16(l+12*f,u)==274)return t(a.getUint16(l+12*f+8,u))}else{if((65280&c)!=65280)break;l+=a.getUint16(l,!1)}}return t(-1)},r.onerror=i=>n(i),r.readAsArrayBuffer(e)})}function jae(e,t){const{width:n}=e,{height:r}=e,{maxWidthOrHeight:i}=t;let a,o=e;return isFinite(i)&&(n>i||r>i)&&([o,a]=GC(n,r),n>r?(o.width=i,o.height=r/n*i):(o.width=n/r*i,o.height=i),a.drawImage(e,0,0,o.width,o.height),Bc(e)),o}function Nae(e,t){const{width:n}=e,{height:r}=e,[i,a]=GC(n,r);switch(t>4&&t<9?(i.width=r,i.height=n):(i.width=n,i.height=r),t){case 2:a.transform(-1,0,0,1,n,0);break;case 3:a.transform(-1,0,0,-1,n,r);break;case 4:a.transform(1,0,0,-1,0,r);break;case 5:a.transform(0,1,1,0,0,0);break;case 6:a.transform(0,1,-1,0,r,0);break;case 7:a.transform(0,-1,-1,0,r,n);break;case 8:a.transform(0,-1,1,0,0,n)}return a.drawImage(e,0,0,n,r),Bc(e),i}function gB(e,t,n=0){return new Promise(function(r,i){let a,o,l,c,u,d,f,h,p,x,y,b,w,_,j,E,S,T,P,O;function D(L=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;a+=L,t.onProgress(Math.min(a,100))}function R(L){if(t.signal&&t.signal.aborted)throw t.signal.reason;a=Math.min(Math.max(L,a),100),t.onProgress(a)}return a=n,o=t.maxIteration||10,l=1024*t.maxSizeMB*1024,D(),Z2(e,t).then((function(L){try{return[,c]=L,D(),u=jae(c,t),D(),new Promise(function(M,B){var U;if(!(U=t.exifOrientation))return _ae(e).then((function(H){try{return U=H,F.call(this)}catch(z){return B(z)}}).bind(this),B);function F(){return M(U)}return F.call(this)}).then((function(M){try{return d=M,D(),kg().then((function(B){try{return f=B?u:Nae(u,d),D(),h=t.initialQuality||1,p=t.fileType||e.type,eN(f,p,e.name,e.lastModified,h).then((function(U){try{{let H=function(){if(o--&&(j>l||j>w)){let K,W;return K=O?.95*P.width:P.width,W=O?.95*P.height:P.height,[S,T]=GC(K,W),T.drawImage(P,0,0,K,W),h*=p==="image/png"?.85:.95,eN(S,p,e.name,e.lastModified,h).then(function(q){try{return E=q,Bc(P),P=S,j=E.size,R(Math.min(99,Math.floor((_-j)/(_-l)*100))),H}catch(oe){return i(oe)}},i)}return[1]},z=function(){return Bc(P),Bc(S),Bc(u),Bc(f),Bc(c),R(100),r(E)};if(x=U,D(),y=x.size>l,b=x.size>e.size,!y&&!b)return R(100),r(x);var F;return w=e.size,_=x.size,j=_,P=f,O=!t.alwaysKeepResolution&&y,(F=(function(K){for(;K;){if(K.then)return void K.then(F,i);try{if(K.pop){if(K.length)return K.pop()?z.call(this):K;K=H}else K=K.call(this)}catch(W){return i(W)}}}).bind(this))(H)}}catch(H){return i(H)}}).bind(this),i)}catch(U){return i(U)}}).bind(this),i)}catch(B){return i(B)}}).bind(this),i)}catch(M){return i(M)}}).bind(this),i)})}const yLe=`
1188let scriptImported = false
1189self.addEventListener('message', async (e) => {
1190  const { file, id, imageCompressionLibUrl, options } = e.data
1191  options.onProgress = (progress) => self.postMessage({ progress, id })
1192  try {
1193    if (!scriptImported) {
1194      // console.log('[worker] importScripts', imageCompressionLibUrl)
1195      self.importScripts(imageCompressionLibUrl)
1196      scriptImported = true
1197    }
1198    // console.log('[worker] self', self)
1199    const compressedFile = await imageCompression(file, options)
1200    self.postMessage({ file: compressedFile, id })
1201  } catch (e) {
1202    // console.error('[worker] error', e)
1203    self.postMessage({ error: e.message + '\\n' + e.stack, id })
1204  }
1205})
1206`;let c4;function vLe(e,t){return new Promise((n,r)=>{c4||(c4=function(o){const l=[];return l.push(o),URL.createObjectURL(new Blob(l))}(yLe));const i=new Worker(c4);i.addEventListener("message",function(o){if(t.signal&&t.signal.aborted)i.terminate();else if(o.data.progress===void 0){if(o.data.error)return r(new Error(o.data.error)),void i.terminate();n(o.data.file),i.terminate()}else t.onProgress(o.data.progress)}),i.addEventListener("error",r),t.signal&&t.signal.addEventListener("abort",()=>{r(t.signal.reason),i.terminate()}),i.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})})}function Zi(e,t){return new Promise(function(n,r){let i,a,o,l,c,u;if(i={...t},o=0,{onProgress:l}=i,i.maxSizeMB=i.maxSizeMB||Number.POSITIVE_INFINITY,c=typeof i.useWebWorker!="boolean"||i.useWebWorker,delete i.useWebWorker,i.onProgress=p=>{o=p,typeof l=="function"&&l(o)},!(e instanceof Blob||e instanceof xLe))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return r(new Error("The file given is not an image"));if(u=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!c||typeof Worker!="function"||u)return gB(e,i).then((function(p){try{return a=p,h.call(this)}catch(x){return r(x)}}).bind(this),r);var d=(function(){try{return h.call(this)}catch(p){return r(p)}}).bind(this),f=function(p){try{return gB(e,i).then(function(x){try{return a=x,d()}catch(y){return r(y)}},r)}catch(x){return r(x)}};try{return i.libURL=i.libURL||"https://cdn.jsdelivr.net/npm/[email protected]/dist/browser-image-compression.js",vLe(e,i).then(function(p){try{return a=p,d()}catch{return f()}},f)}catch{f()}function h(){try{a.name=e.name,a.lastModified=e.lastModified}catch{}try{i.preserveExif&&e.type==="image/jpeg"&&(!i.fileType||i.fileType&&i.fileType===e.type)&&(a=mae(e,a))}catch{}return n(a)}})}Zi.getDataUrlFromFile=yae,Zi.getFilefromDataUrl=ZM,Zi.loadImage=vae,Zi.drawImageInCanvas=wae,Zi.drawFileInCanvas=Z2,Zi.canvasToFile=eN,Zi.getExifOrientation=_ae,Zi.handleMaxWidthOrHeight=jae,Zi.followExifOrientation=Nae,Zi.cleanupCanvasMemory=Bc,Zi.isAutoOrientationInBrowser=kg,Zi.approximateBelowMaximumCanvasSizeOfBrowser=bae,Zi.copyExifWithoutOrientation=mae,Zi.getBrowserName=lm,Zi.version="2.0.2";const Gh="event-photos",bLe=3600,wLe=60*60*24*7;function aw(e){const t=Ye(),{user:n}=Tt(),r=st({queryKey:["event-photos",e],enabled:!!e,queryFn:async()=>{const{data:l,error:c}=await re.from("event_photos").select(`id,event_id,uploader_user_id,storage_path,thumbnail_path,width,height,caption,status,hidden_reason,created_at,
1207           uploader:profiles!event_photos_uploader_user_id_fkey(display_name,first_name,avatar_url)`).eq("event_id",e).order("created_at",{ascending:!1});if(c)throw c;return l??[]},staleTime:3e4}),i=dt({mutationFn:async({files:l,onProgress:c})=>{if(!e)throw new Error("Event manquant");if(!(n!=null&&n.id))throw new Error("Non connecté");const u=[];let d=0;for(const f of l){const h=await Zi(f,{maxSizeMB:.7,maxWidthOrHeight:2560,useWebWorker:!0,preserveExif:!1,fileType:"image/jpeg",initialQuality:.82}),p=await Zi(f,{maxSizeMB:.08,maxWidthOrHeight:400,useWebWorker:!0,preserveExif:!1,fileType:"image/webp",initialQuality:.75}),x=await _Le(h),y=crypto.randomUUID(),b=`${e}/${n.id}`,w=`${b}/${y}.jpg`,_=`${b}/thumbs/${y}.webp`,j=await re.storage.from(Gh).upload(w,h,{contentType:"image/jpeg",upsert:!1});if(j.error)throw j.error;const E=await re.storage.from(Gh).upload(_,p,{contentType:"image/webp",upsert:!1});if(E.error)throw await re.storage.from(Gh).remove([w]),E.error;const{data:S,error:T}=await re.from("event_photos").insert({id:y,event_id:e,uploader_user_id:n.id,storage_path:w,thumbnail_path:_,width:x.width,height:x.height,size_bytes:h.size}).select().single();if(T)throw await re.storage.from(Gh).remove([w,_]),T;u.push(S),d+=1,c==null||c(d,l.length)}return u},onSuccess:()=>{t.invalidateQueries({queryKey:["event-photos",e]})}}),a=dt({mutationFn:async l=>{const c=[l.storage_path];l.thumbnail_path&&c.push(l.thumbnail_path),await re.storage.from(Gh).remove(c);const{error:u}=await re.from("event_photos").delete().eq("id",l.id);if(u)throw u},onSuccess:()=>
1207t.invalidateQueries({queryKey:["event-photos",e]})}),o=dt({mutationFn:async l=>{if(!(n!=null&&n.id))throw new Error("Non connecté");const{error:c}=await re.from("photo_reports").insert({photo_id:l.photo_id,reporter_user_id:n.id,reason:l.reason,message:l.message??null});if(c)throw c},onSuccess:()=>t.invalidateQueries({queryKey:["event-photos",e]})});return{photos:r.data??[],isLoading:r.isLoading,error:r.error,refetch:r.refetch,upload:i.mutateAsync,isUploading:i.isPending,remove:a.mutateAsync,report:o.mutateAsync}}async function kae(e,t=bLe){const{data:n,error:r}=await re.storage.from(Gh).createSignedUrl(e,t);if(r)throw r;return n.signedUrl}async function sg(e){const{data:t,error:n}=await re.storage.from(Gh).createSignedUrl(e,wLe,{download:!0});if(n)throw n;return t.signedUrl}function _Le(e){return new Promise(t=>{const n=new Image,r=URL.createObjectURL(e);n.onload=()=>{t({width:n.naturalWidth,height:n.naturalHeight}),URL.revokeObjectURL(r)},n.onerror=()=>{t({width:0,height:0}),URL.revokeObjectURL(r)},n.src=r})}const jLe=Object.freeze(Object.defineProperty({__proto__:null,getPhotoDownloadUrl:sg,getPhotoSignedUrl:kae,useEventPhotos:aw},Symbol.toStringTag,{value:"Module"})),NLe=20,u4=15;function Cae({eventId:e,compact:t}){const{upload:n,isUploading:r}=aw(e),i=N.useRef(null),[a,o]=N.useState(null),l=async c=>{if(!c||c.length===0)return;const u=Array.from(c).slice(0,NLe),d=u.filter(h=>h.size>u4*1024*1024);d.length&&je.error(`${d.length} fichier(s) dépassent ${u4} Mo et seront ignorés`);const f=u.filter(h=>h.size<=u4*1024*1024&&h.type.startsWith("image/"));if(f.length){o({done:0,total:f.length});try{await n({files:f,onProgress:(h,p)=>o({done:h,total:p})}),je.success(f.length===1?"Photo ajoutée à la galerie":`${f.length} photos ajoutées`)}catch(h){je.error((h==null?void 0:h.message)??"Erreur lors de l'envoi")}finally{o(null),i.current&&(i.current.value="")}}};return s.jsxs("div",{className:t?"":"rounded-xl border border-border/60 bg-card/50 p-4",children:[s.jsx("input",{ref:i,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:c=>l(c.target.files)}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3",children:[s.jsx(Q,{onClick:()=>{var c;return(c=i.current)==null?void 0:c.click()},disabled:r,className:"gap-2",children:r?s.jsxs(s.Fragment,{children:[s.jsx(a2,{className:"w-4 h-4 animate-pulse"}),"Envoi ",a==null?void 0:a.done,"/",a==null?void 0:a.total,"…"]}):s.jsxs(s.Fragment,{children:[s.jsx(w5,{className:"w-4 h-4"}),"Ajouter mes photos"]})}),!t&&s.jsxs("p",{className:"text-xs text-muted-foreground flex items-start gap-1.5 leading-snug",children:[s.jsx(dI,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),s.jsx("span",{children:"En publiant, vous certifiez avoir le droit sur cette photo. Elle sera visible uniquement par les participants du tournoi. Métadonnées de localisation automatiquement retirées."})]})]})]})}function kLe({photo:e,eventTitle:t,open:n,onOpenChange:r}){const[i,a]=N.useState(!1);if(!e)return null;const o=t?`Tournoi ${t} sur Chess Agenda`:"Souvenirs de tournoi sur Chess Agenda",l=async()=>{a(!0);try{const p=await sg(e.storage_path),x=document.createElement("a");x.href=p,x.download=`chessagenda-${e.id.slice(0,8)}.jpg`,x.rel="noopener",document.body.appendChild(x),x.click(),x.remove(),je.success("Photo téléchargée")}catch(p){je.error((p==null?void 0:p.message)??"Téléchargement impossible")}finally{a(!1)}},c=async()=>{var p;a(!0);try{const x=await sg(e.storage_path);try{const b=await(await fetch(x)).blob(),w=new File([b],`chessagenda-${e.id.slice(0,8)}.jpg`,{type:b.type||"image/jpeg"});if((p=navigator.canShare)!=null&&p.call(navigator,{files:[w]})){await navigator.share({files:[w],text:o});return}}catch{}navigator.share?await navigator.share({title:o,text:o,url:x}):(await navigator.clipboard.writeText(x),je.success("Lien copié"))}catch(x){(x==null?void 0:x.name)!=="AbortError"&&je.error("Partage impossible")}finally{a(!1)}},u=async()=>{try{const p=await sg(e.storage_path);await navigator.clipboard.writeText(p),je.success("Lien copié (valable 7 jours)")}catch{je.error("Copie impossible")}},d=async()=>{const p=await sg(e.storage_path);window.open(`https://wa.me/?text=${encodeURIComponent(`${o}
1208${p}`)}`,"_blank","noopener")},f=async()=>{const p=await sg(e.storage_path);window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(p)}`,"_blank","noopener")},h=async()=>{await l(),je.info("Ouvrez Instagram / TikTok et importez la photo depuis votre galerie")};return s.jsx(Ln,{open:n,onOpenChange:r,children:s.jsxs(Dn,{className:"sm:max-w-md",children:[s.jsxs(Un,{children:[s.jsx(qn,{
1208children:"Partager cette photo"}),s.jsx(qr,{className:"text-xs",children:"Vous partagez sous votre responsabilité. Assurez-vous d'avoir l'accord des personnes visibles."})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs(Q,{onClick:l,disabled:i,variant:"default",className:"gap-2",children:[s.jsx(mc,{className:"w-4 h-4"})," Télécharger"]}),s.jsxs(Q,{onClick:c,disabled:i,variant:"secondary",className:"gap-2",children:[s.jsx(Cm,{className:"w-4 h-4"})," Partager"]}),s.jsxs(Q,{onClick:d,variant:"outline",className:"gap-2",children:[s.jsx(dxe,{className:"w-4 h-4"})," WhatsApp"]}),s.jsxs(Q,{onClick:h,variant:"outline",className:"gap-2",children:[s.jsx(ixe,{className:"w-4 h-4"})," Instagram / TikTok"]}),s.jsxs(Q,{onClick:f,variant:"outline",className:"gap-2",children:[s.jsx(oxe,{className:"w-4 h-4"})," LinkedIn"]}),s.jsxs(Q,{onClick:u,variant:"outline",className:"gap-2",children:[s.jsx(Ko,{className:"w-4 h-4"})," Copier le lien"]})]})]})})}function CLe({photo:e,eventId:t,open:n,onOpenChange:r,onReported:i}){const{report:a}=aw(t),[o,l]=N.useState("droit_image"),[c,u]=N.useState(""),[d,f]=N.useState(!1),h=async()=>{if(e){f(!0);try{await a({photo_id:e.id,reason:o,message:c.trim()||void 0}),o==="droit_image"?je.success("Photo masquée immédiatement. Un modérateur va traiter votre demande."):je.success("Signalement envoyé. Merci."),u(""),r(!1),i==null||i()}catch(p){je.error((p==null?void 0:p.message)??"Signalement impossible")}finally{f(!1)}}};return s.jsx(Ln,{open:n,onOpenChange:r,children:s.jsxs(Dn,{className:"sm:max-w-md",children:[s.jsxs(Un,{children:[s.jsx(qn,{children:"Signaler cette photo"}),s.jsx(qr,{children:`Un signalement "droit à l'image" masque immédiatement la photo en attendant modération.`})]}),s.jsxs(ud,{value:o,onValueChange:p=>l(p),className:"space-y-2",children:[s.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/60 p-3",children:[s.jsx(ui,{value:"droit_image",id:"r1",className:"mt-0.5"}),s.jsxs(Fe,{htmlFor:"r1",className:"cursor-pointer font-normal",children:[s.jsx("span",{className:"block font-medium",children:"Je suis sur la photo et je souhaite être retiré"}),s.jsx("span",{className:"block text-xs text-muted-foreground",children:"Masquage immédiat"})]})]}),s.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/60 p-3",children:[s.jsx(ui,{value:"contenu_inapproprie",id:"r2",className:"mt-0.5"}),s.jsx(Fe,{htmlFor:"r2",className:"cursor-pointer font-normal",children:"Contenu inapproprié"})]}),s.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/60 p-3",children:[s.jsx(ui,{value:"autre",id:"r3",className:"mt-0.5"}),s.jsx(Fe,{htmlFor:"r3",className:"cursor-pointer font-normal",children:"Autre raison"})]})]}),s.jsx($s,{placeholder:"Message (facultatif, 500 caractères max)",value:c,onChange:p=>u(p.target.value.slice(0,500)),rows:3}),s.jsxs(Pi,{children:[s.jsx(Q,{variant:"ghost",onClick:()=>r(!1),children:"Annuler"}),s.jsx(Q,{onClick:h,disabled:d,children:d?"Envoi…":"Envoyer le signalement"})]})]})})}function e6({eventId:e,eventTitle:t,canUpload:n=!0,canViewAll:r=!1}){const{photos:i,isLoading:a,remove:o}=aw(e),{user:l,roles:c}=Tt(),[u,d]=N.useState(null),[f,h]=N.useState(!1),[p,x]=N.useState(!1),[y,b]=N.useState({}),[w,_]=N.useState({}),j=c==null?void 0:c.includes("admin"),E=j||r;N.useEffect(()=>{if(!i.length)return;const P=i.map(O=>O.thumbnail_path||O.storage_path).filter(O=>!!O&&!y[O]);P.length&&(async()=>{const{data:O}=await re.storage.from("event-photos").createSignedUrls(P,3600);if(O){const D={};O.forEach(R=>{R.path&&R.signedUrl&&(D[R.path]=R.signedUrl)}),b(R=>({...R,...D}))}})()},[i]);const S=async P=>{if(!w[P.storage_path])try{const O=await kae(P.storage_path);_(D=>({...D,[P.storage_path]:O}))}catch{je.error("Impossible de charger la photo")}};N.useEffect(()=>{u&&S(u)},[u]);const T=P=>j||P.uploader_user_id===(l==null?void 0:l.id);return a?s.jsx("div",{className:"text-sm text-muted-foreground py-8 text-center",children:"Chargement des photos…"}):s.jsxs("div",{className:"space-y-4",children:[n&&s.jsx(Cae,{eventId:e}),i.length===0?s.jsxs("div",{className:"rounded-xl border border-dashed border-border/60 py-12 text-center",children:[s.jsx(kf,{className:"w-8 h-8 mx-auto text-muted-foreground mb-2"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Aucune photo pour le moment. Soyez le premier à partager un souvenir."})]}):s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-2",children:i.map(P=>{const O=P.thumbnail_path||P.storage_path,D=y[O],R=P.status!=="visible";return s.jsxs("button",{onClick:()=>d(P),className:"group relative aspect-square overflow-hidden rounded-lg bg-muted focus:outline-none focus:ring-2 focus:ring-primary",children:[D?s.jsx("img",{src:D,alt:P.caption??"Photo du tournoi",loading:"lazy",className:`w-full h-full object-cover transition group-hover:scale-105 ${R?"opacity-40 grayscale":""}`}):s.jsx("div",{className:"w-full h-full animate-pulse bg-muted"}),R&&E&&s.jsxs("span",{className:"absolute top-1 left-1 rounded bg-amber-500/90 text-white text-[10px] px-1.5 py-0.5 flex items-center gap-0.5",children:[s.jsx(Cf,{className:"w-3 h-3"})," Masquée"]})]},P.id)})}),s.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Galerie privée réservée aux participants de ce tournoi."," ",s.jsx(Pe,{to:"/confidentialite/photos",className:"underline underline-offset-2",children:"Politique photos & droit à l'image"})]}),s.jsx(Ln,{open:!!u,onOpenChange:P=>!P&&d(null),children:s.jsx(Dn,{className:"max-w-4xl p-0 bg-black/95 border-0",children:u&&s.jsxs("div",{className:"relative",children:[s.jsx("button",{onClick:()=>d(null),className:"absolute top-2 right-2 z-10 rounded-full bg-black/60 p-2 text-white hover:bg-black/80","aria-label":"Fermer",children:s.jsx(Er,{className:"w-4 h-4"})}),s.jsx("div",{className:"flex items-center justify-center min-h-[300px] max-h-[80vh]",children:w[u.storage_path]?s.jsx("img",{src:w[u.storage_path],alt:u.caption??"Photo",className:"max-w-full max-h-[80vh] object-contain"}):s.jsx("div",{className:"text-white/60 text-sm py-20",children:"Chargement…"})}),s.jsxs("div",{className:"p-3 flex flex-wrap gap-2 justify-center bg-black/70",children:[s.jsxs(Q,{size:"sm",onClick:()=>h(!0),className:"gap-1.5",children:[s.jsx(Cm,{className:"w-4 h-4"})," Partager"]}),s.jsxs(Q,{size:"sm",variant:"secondary",onClick:async()=>{h(!1);const{getPhotoDownloadUrl:P}=await ka(async()=>{const{getPhotoDownloadUrl:R}=await Promise.resolve().then(()=>jLe);return{getPhotoDownloadUrl:R}},void 0),O=await P(u.storage_path),D=document.createElement("a");D.href=O,D.download=`chessagenda-${u.id.slice(0,8)}.jpg`,D.click()},className:"gap-1.5",children:[s.jsx(mc,{className:"w-4 h-4"})," Télécharger"]}),s.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>x(!0),className:"gap-1.5",children:[s.jsx(GY,{className:"w-4 h-4"})," Signaler"]}),T(u)&&s.jsxs(Q,{size:"sm",variant:"destructive",onClick:async()=>{confirm("Supprimer définitivement cette photo ?")&&(await o(u),je.success("Photo supprimée"),d(null))},className:"gap-1.5",children:[s.jsx(ua,{className:"w-4 h-4"})," Supprimer"]})]})]})})}),s.jsx(kLe,{photo:u,eventTitle:t,open:f,onOpenChange:h}),s.jsx(CLe,{photo:u,eventId:e,open:p,onOpenChange:x})]})}function xB(e){if(!e)return null;const t=e.trim();if(!t)return null;const n=/^https?:\/\//i.test(t)?t:`https://${t}`;
1208try{const r=new URL(n);return r.protocol!=="http:"&&r.protocol!=="https:"?null:r.toString().replace(/\/$/,"")}catch{return null}}function Eae(e){if(!e)return null;if(e.google_maps_url&&/^https?:\/\//i.test(e.google_maps_url))return e.google_maps_url;const t=typeof e.latitude=="number"&&typeof e.longitude=="number"&&Number.isFinite(e.latitude)&&Number.isFinite(e.longitude);if(t&&e.google_place_id)return`https://www.google.com/maps/search/?api=1&query=${e.latitude},${e.longitude}&query_place_id=${encodeURIComponent(e.google_place_id)}`;if(t)return`https://www.google.com/maps/search/?api=1&query=${e.latitude},${e.longitude}`;const n=[e.name,e.address,e.city].filter(Boolean).join(", ");return n?`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(n)}`:null}function Sae({venue:e,variant:t="default",className:n=""}){if(!e)return null;const r=e.website_url&&/^https?:\/\//i.test(e.website_url)?e.website_url:null,i=Eae(e);if(!r&&!i)return null;const a=t==="minimal"?"inline-flex items-center gap-1.5 text-sm hover:underline underline-offset-4":"inline-flex items-center gap-2 px-4 py-2 rounded-full border border-[#0D0D0D]/15 hover:border-[#0D0D0D]/40 hover:bg-[#0D0D0D]/5 transition-colors text-sm font-medium";return s.jsxs("div",{className:`flex flex-wrap items-center gap-2 ${n}`,children:[r&&s.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:a,"data-analytics":"venue-website-click","aria-label":`Visiter le site web${e.name?` de ${e.name}`:""}`,children:[s.jsx(txe,{className:"w-4 h-4","aria-hidden":"true"}),"Site web"]}),i&&s.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:a,"data-analytics":"venue-maps-click","aria-label":`Itinéraire${e.name?` vers ${e.name}`:""} sur Google Maps`,children:[s.jsx(bv,{className:"w-4 h-4","aria-hidden":"true"}),"Itinéraire"]})]})}const ELe=/\b(?:M|Métro|Metro|Ligne|RER|Line)\s*([0-9]{1,2}(?:[abAB])?|[A-Ea-e])\b/;function yB(e){var a;if(!e)return null;const t=e.trim();if(!t)return null;const n=t.match(ELe),r=((a=n==null?void 0:n[1])==null?void 0:a.toUpperCase())??null;let i=t.replace(/\s*\([^)]*\)\s*/g," ").replace(/^\s*(?:Métro|Metro|Station|Gare|Arrêt|RER)\s+/i,"").replace(/\s+/g," ").trim();return i?r?{line:r,station:i}:{line:"",station:i}:null}function SLe(e){var t;if(!Array.isArray(e)||e.length===0)return null;for(const n of e){const r=yB(n==null?void 0:n.name);if(r!=null&&r.line)return r}return yB((t=e[0])==null?void 0:t.name)}const ALe=7*24*60*60*1e3;function TLe(e){const{user:t}=Tt();N.useEffect(()=>{if(!(e!=null&&e.id)||!t||typeof e.latitude!="number"||typeof e.longitude!="number")return;const n=Array.isArray(e.nearest_stations)&&e.nearest_stations.length>0,r=e.enrichment_ran_at?new Date(e.enrichment_ran_at).getTime():0,i=r&&Date.now()-r<ALe;if(n&&i||e.enrichment_status==="running")return;const a=`venue-enrich-tried:${e.id}`;try{if(sessionStorage.getItem(a))return;sessionStorage.setItem(a,"1")}catch{}re.functions.invoke("venue-enrich-auto",{body:{venue_id:e.id,mode:"auto",apply:!0,download_photos:!1}}).catch(o=>{console.debug("[useEnsureVenueEnriched] skipped:",(o==null?void 0:o.message)??o)})},[e==null?void 0:e.id,t==null?void 0:t.id])}function PLe(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const OLe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,DLe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ILe={};function vB(e,t){return(ILe.jsx?DLe:OLe).test(e)}const RLe=/[ \t\n\f\r]/g;function MLe(e){return typeof e=="object"?e.type==="text"?bB(e.value):!1:bB(e)}function bB(e){return e.replace(RLe,"")===""}class ow{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}ow.prototype.normal={};ow.prototype.property={};ow.prototype.space=void 0;function Aae(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new ow(n,r,t)}function iP(e){return e.toLowerCase()}class No{constructor(t,n){this.attribute=n,this.property=t}}No.prototype.attribute="";No.prototype.booleanish=!1;No.prototype.boolean=!1;No.prototype.commaOrSpaceSeparated=!1;No.prototype.commaSeparated=!1;No.prototype.defined=!1;No.prototype.mustUseProperty=!1;No.prototype.number=!1;No.prototype.overloadedBoolean=!1;No.prototype.property="";No.prototype.spaceSeparated=!1;No.prototype.space=void 0;let LLe=0;const on=vp(),ei=vp(),aP=vp(),nt=vp(),Br=vp(),Sm=vp(),So=vp();function vp(){return 2**++LLe}const oP=Object.freeze(Object.defineProperty({__proto__:null,boolean:on,booleanish:ei,commaOrSpaceSeparated:So,commaSeparated:Sm,number:nt,overloadedBoolean:aP,spaceSeparated:Br},Symbol.toStringTag,{value:"Module"})),d4=Object.keys(oP);class t6 extends No{constructor(t,n,r,i){let a=-1;if(super(t,n),wB(this,"space",i),typeof r=="number")for(;++a<d4.length;){const o=d4[a];wB(this,d4[a],(r&oP[o])===oP[o])}}}t6.prototype.defined=!0;function wB(e,t,n){n&&(e[t]=n)}function M0(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const a=new t6(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[iP(r)]=r,n[iP(a.attribute)]=r}return new ow(t,n,e.space)}const Tae=M0({properties:{ariaActiveDescendant:null,ariaAtomic:ei,ariaAutoComplete:null,ariaBusy:ei,ariaChecked:ei,ariaColCount:nt,ariaColIndex:nt,ariaColSpan:nt,ariaControl
vendor: 4,136 bytes, line 1208
1208s:Br,ariaCurrent:null,ariaDescribedBy:Br,ariaDetails:null,ariaDisabled:ei,ariaDropEffect:Br,ariaErrorMessage:null,ariaExpanded:ei,ariaFlowTo:Br,ariaGrabbed:ei,ariaHasPopup:null,ariaHidden:ei,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Br,ariaLevel:nt,ariaLive:null,ariaModal:ei,ariaMultiLine:ei,ariaMultiSelectable:ei,ariaOrientation:null,ariaOwns:Br,ariaPlaceholder:null,ariaPosInSet:nt,ariaPressed:ei,ariaReadOnly:ei,ariaRelevant:null,ariaRequired:ei,ariaRoleDescription:Br,ariaRowCount:nt,ariaRowIndex:nt,ariaRowSpan:nt,ariaSelected:ei,ariaSetSize:nt,ariaSort:null,ariaValueMax:nt,ariaValueMin:nt,ariaValueNow:nt,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Pae(e,t){return t in e?e[t]:t}function Oae(e,t){return Pae(e,t.toLowerCase())}const FLe=M0({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Sm,acceptCharset:Br,accessKey:Br,action:null,allow:null,allowFullScreen:on,allowPaymentRequest:on,allowUserMedia:on,alpha:on,alt:null,as:null,async:on,autoCapitalize:null,autoComplete:Br,autoFocus:on,autoPlay:on,blocking:Br,capture:null,charSet:null,checked:on,cite:null,className:Br,closedBy:null,colorSpace:null,cols:nt,colSpan:nt,command:null,commandFor:null,content:null,contentEditable:ei,controls:on,controlsList:Br,coords:nt|Sm,crossOrigin:null,data:null,dateTime:null,decoding:null,default:on,defer:on,dir:null,dirName:null,disabled:on,download:aP,draggable:ei,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:on,formTarget:null,headers:Br,height:nt,hidden:aP,high:nt,href:null,hrefLang:null,htmlFor:Br,httpEquiv:Br,id:null,imageSizes:null,imageSrcSet:null,inert:on,inputMode:null,integrity:null,is:null,isMap:on,itemId:null,itemProp:Br,itemRef:Br,itemScope:on,itemType:Br,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:on,low:nt,manifest:null,max:null,maxLength:nt,media:null,method:null,min:null,minLength:nt,multiple:on,muted:on,name:null,nonce:null,noModule:on,noValidate:on,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:on,optimum:nt,pattern:null,ping:Br,placeholder:null,playsInline:on,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:on,referrerPolicy:null,rel:Br,required:on,reversed:on,rows:nt,rowSpan:nt,sandbox:Br,scope:null,scoped:on,seamless:on,selected:on,shadowRootClonable:on,shadowRootCustomElementRegistry:on,shadowRootDelegatesFocus:on,shadowRootMode:null,shadowRootSerializable:on,shape:null,size:nt,sizes:null,slot:null,span:nt,spellCheck:ei,src:null,
1208srcDoc:null,srcLang:null,srcSet:null,start:nt,step:null,style:null,tabIndex:nt,target:null,title:null,translate:null,type:null,typeMustMatch:on,useMap:null,value:ei,width:nt,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Br,axis:null,background:null,bgColor:null,border:nt,borderColor:null,bottomMargin:nt,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:on,declare:on,event:null,face:null,frame:null,frameBorder:null,hSpace:nt,leftMargin:nt,link:null,longDesc:null,lowSrc:null,marginHeight:nt,marginWidth:nt,noResize:on,noHref:on,noShade:on,noWrap:on,object:null,profile:null,prompt:null,rev:null,rightMargin:nt,rules:null,scheme:null,scrolling:ei,standby:null,summary:null,text:null,topMargin:nt,valueType:null,version:null,vAlign:null,vLink:null,vSpace:nt,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:on,disablePictureInPicture:on,disableRemotePlayback:on,exportParts:Sm,part:Br,prefix:null,property:null,results:nt,security:null,unselectable:null},space:"html",transform:Oae}),$Le=M0({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav
1208-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:So,accentHeight:nt,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:nt,amplitude:nt,arabicForm:null,ascent:nt,attributeName:null,attributeType:null,azimuth:nt,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:nt,by:null,calcMode:null,capHeight:nt,className:Br,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:nt,diffuseConstant:nt,direction:null,display:null,dur:null,divisor:nt,dominantBaseline:null,download:on,dx:null,dy:null,edgeMode:null,editable:null,elevation:nt,enableBackground:null,end:null,event:null,exponent:nt,externalResourcesRequired:null,fill:null,fillOpacity:nt,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Sm,g2:Sm,glyphName:Sm,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:nt,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:nt,horizOriginX:nt,horizOriginY:nt,id:null,ideographic:nt,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:nt,k:nt,k1:nt,k2:nt,k3:nt,k4:nt,kernelMatrix:So,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:nt,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:nt,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,on
vendor: 5,355 bytes, lines 1208-1209
1208Zoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:nt,overlineThickness:nt,paintOrder:null,panose1:null,path:null,pathLength:nt,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Br,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:nt,pointsAtY:nt,pointsAtZ:nt,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:So,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:So,rev:So,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:So,requiredFeatures:So,requiredFonts:So,requiredFormats:So,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:nt,specularExponent:nt,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:nt,strikethroughThickness:nt,string:null,stroke:null,strokeDashArray:So,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:nt,strokeOpacity:nt,strokeWidth:null,style:null,surfaceScale:nt,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:So,tabIndex:nt,tableValues:null,target:null,targetX:nt,targetY:nt,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:So,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:nt,underlineThickness:nt,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:nt,values:null,vAlphabetic:nt,vMathematical:nt,vectorEffect:null,vHanging:nt,vIdeographic:nt,version:null,vertAdvY:nt,vertOriginX:nt,vertOriginY:nt,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:nt,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Pae}),Dae=M0({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Iae=M0({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Oae}),Rae=M0({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),BLe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},zLe=/[A-Z]/g,_B=/-[a-z]/g,ULe=/^data[-\w.:]+$/i;function qLe(e,t){const n=iP(t);let r=t,i=No;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ULe.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(_B,HLe);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!_B.test(a)){let o=a.replace(zLe,VLe);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=t6}return new i(r,t)}function VLe(e){return"-"+e.toLowerCase()}function HLe(e){return e.charAt(1).toUpperCase()}const WLe=Aae([Tae,FLe,Dae,Iae,Rae],"html"),n6=Aae([Tae,$Le,Dae,Iae,Rae],"svg");function GLe(e){return e.join(" ").trim()}var r6={},jB=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,KLe=/\n/g,YLe=/^\s*/,XLe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,QLe=/^:\s*/,JLe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,ZLe=/^[;\s]*/,eFe=/^\s+|\s+$/g,tFe=`
1209`,NB="/",kB="*",Kh="",nFe="comment",rFe="declaration";function sFe(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(x){var y=x.match(KLe);y&&(n+=y.length);var b=x.lastIndexOf(tFe);r=~b?x.length-b:r+x.length}function a(){var x={line:n,column:r};return function(y){return y.position=new o(x),u(),y}}function o(x){this.start=x,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function l(x){var y=new Error(t.source+":"+n+":"+r+": "+x);if(y.reason=x,y.filename=t.source,y.line=n,y.column=r,y.source=e,!t.silent)throw y}function c(x){var y=x.exec(e);if(y){var b=y[0];return i(b),e=e.slice(b.length),y}}function u(){c(YLe)}function d(x){var y;for(x=x||[];y=f();)y!==!1&&x.push(y);return x}function f(){var x=a();if(!(NB!=e.charAt(0)||kB!=e.charAt(1))){for(var y=2;Kh!=e.charAt(y)&&(kB!=e.charAt(y)||NB!=e.charAt(y+1));)++y;if(y+=2,Kh===e.charAt(y-1))return l("End of comment missing");var b=e.slice(2,y-2);return r+=2,i(b),e=e.slice(y),r+=2,x({type:nFe,comment:b})}}function h(){var x=a(),y=c(XLe);if(y){if(f(),!c(QLe))return l("property missing ':'");var b=c(JLe),w=x({type:rFe,property:CB(y[0].replace(jB,Kh)),value:b?CB(b[0].replace(jB,Kh)):Kh});return c(ZLe),w}}function p(){var x=[];d(x);for(var y;y=h();)y!==!1&&(x.push(y),d(x));return x}return u(),p()}function CB(e){return e?e.replace(eFe,Kh):Kh}var iFe=sFe,aFe=Lo&&Lo.__importDefault||function(e){return e&&e.__esMo
vendor: 3,685 bytes, line 1209
1209dule?e:{default:e}};Object.defineProperty(r6,"__esModule",{value:!0});r6.default=lFe;const oFe=aFe(iFe);function lFe(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,oFe.default)(e),i=typeof t=="function";return r.forEach(a=>{if(a.type!=="declaration")return;const{property:o,value:l}=a;i?t(o,l,a):l&&(n=n||{},n[o]=l)}),n}var KC={};Object.defineProperty(KC,"__esModule",{value:!0});KC.camelCase=void 0;var cFe=/^--[a-zA-Z0-9_-]+$/,uFe=/-([a-z])/g,dFe=/^[^-]+$/,fFe=/^-(webkit|moz|ms|o|khtml)-/,hFe=/^-(ms)-/,mFe=function(e){return!e||dFe.test(e)||cFe.test(e)},pFe=function(e,t){return t.toUpperCase()},EB=function(e,t){return"".concat(t,"-")},gFe=function(e,t){return t===void 0&&(t={}),mFe(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(hFe,EB):e=e.replace(fFe,EB),e.replace(uFe,pFe))};KC.camelCase=gFe;var xFe=Lo&&Lo.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},yFe=xFe(r6),vFe=KC;function lP(e,t){var n={};return!e||typeof e!="string"||(0,yFe.default)(e,function(r,i){r&&i&&(n[(0,vFe.camelCase)(r,t)]=i)}),n}lP.default=lP;var bFe=lP;const wFe=dr(bFe),Mae=Lae("end"),s6=Lae("start");function Lae(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function _Fe(e){const t=s6(e),n=Mae(e);if(t&&n)return{start:t,end:n}}function Tv(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?SB(e.position):"start"in e||"end"in e?SB(e):"line"in e||"column"in e?cP(e):""}function cP(e){return AB(e&&e.line)+":"+AB(e&&e.column)}function SB(e){return cP(e&&e.start)+"-"+cP(e&&e.end)}function AB(e){return e&&typeof e=="number"?e:1}class Ea extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},o=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?i=t:!a.cause&&t&&(o=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?a.ruleId=r:(a.source=r.slice(0,c),a.ruleId=r.slice(c+1))}if(!a.place&&a.ancestors&&a.ancestors){const c=a.ancestors[a.ancestors.length-1];c&&(a.place=c.position)}const l=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=Tv(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ea.prototype.file="";Ea.prototype.name="";Ea.prototype.reason="";Ea.prototype.message="";Ea.prototype.stack="";Ea.prototype.column=void 0;Ea.prototype.line=void 0;Ea.prototype.ancestors=void 0;Ea.prototype.cause=void 0;Ea.prototype.fatal=void 0;Ea.prototype.place=void 0;Ea.prototype.ruleId=void 0;Ea.prototype.source=void 0;const i6={}.hasOwnProperty,jFe=new Map,NFe=/[A-Z]/g,kFe=new Set(["table","tbody","thead","tfoot","tr"]),CFe=new Set(["td","th"]),Fae="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function EFe(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=RFe(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");
vendor: 2,227 bytes, line 1209
1209if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=IFe(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?n6:WLe,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=$ae(i,e,void 0);return a&&typeof a!="string"?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function $ae(e,t,n){if(t.type==="element")return SFe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return AFe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return PFe(e,t,n);if(t.type==="mdxjsEsm")return TFe(e,t);if(t.type==="root")return OFe(e,t,n);if(t.type==="text")return DFe(e,t)}function SFe(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=n6,e.schema=i),e.ancestors.push(t);const a=zae(e,t.tagName,!1),o=MFe(e,t);let l=o6(e,t);return kFe.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!MLe(c):!0})),Bae(e,o,a,t),a6(o,l),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function AFe(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}T1(e,t.position)}function TFe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);T1(e,t.position)}function PFe(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=n6,e.schema=i),e.ancestors.push(t);const a=t.name===null?e.Fragment:zae(e,t.name,!0),o=LFe(e,t),l=o6(e,t);return Bae(e,o,a,t),a6(o,l),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function OFe(e,t,n){const r={};return a6(r,o6(e,t)),e.create(t,e.Fragment,r,n)}function DFe(e,t){return t.value}function Bae(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function a6(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function IFe(e,t,n){return r;function r(i,a,o,l){const u=Array.isArray(o.children)?n:t;
vendor: 4,133 bytes, line 1209
1209return l?u(a,o,l):u(a,o)}}function RFe(e,t){return n;function n(r,i,a,o){const l=Array.isArray(a.children),c=s6(r);return t(i,a,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function MFe(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&i6.call(t.properties,i)){const a=FFe(e,i,t.properties[i]);if(a){const[o,l]=a;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&CFe.has(t.tagName)?r=l:n[o]=l}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function LFe(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const o=a.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else T1(e,t.position);else{const i=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,a=e.evaluater.evaluateExpression(l.expression)}else T1(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function o6(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:jFe;for(;++r<t.children.length;){const a=t.children[r];let o;if(e.passKeys){const c=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(c){const u=i.get(c)||0;o=c+"-"+u,i.set(c,u+1)}}const l=$ae(e,a,o);l!==void 0&&n.push(l)}return n}function FFe(e,t,n){const r=qLe(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?PLe(n):GLe(n)),r.property==="style"){let i=typeof n=="object"?n:$Fe(e,String(n));return e.stylePropertyNameCase==="css"&&(i=BFe(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?BLe[r.property]||r.property:r.attribute,n]}}function $Fe(e,t){try{return wFe(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Ea("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Fae+"#cannot-parse-style-attribute",i}}function zae(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let a=-1,o;for(;++a<i.length;){const l=vB(i[a])?{type:"Identifier",name:i[a]}:{type:"Literal",value:i[a]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(a&&l.type==="Literal"),optional:!1}:l}r=o}else r=vB(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return i6.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);T1(e)}function T1(e,t){const n=new Ea("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Fae+"#cannot-handle-mdx-estrees-without-createevaluater",n}function BFe(e){const t={};let n;for(n in e)i6.call(e,n)&&(t[zFe(n)]=e[n]);return t}function zFe(e){let t=e.replace(NFe,UFe);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function UFe(e){return"-"+e.toLowerCase()}const f4={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},qFe={};function l6(e,t){const n=qFe,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Uae(e,r,i)}function Uae(e,t,n){if(VFe(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return TB(e.children,t,n)}return Array.isArray(e)?TB(e,t,n):""}function TB(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Uae(e[i],t,n);return r.join("")}function VFe(e){return!!(e&&typeof e=="object")}const PB=document.createElement("i");function c6(e){const t="&"+e+";";PB.innerHTML=t;const n=PB.textContent;
vendor: 13,053 bytes, line 1209
1209return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ho(e,t,n,r){const i=e.length;let a=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function yl(e,t){return e.length>0?(Ho(e,e.length,0,t),e):t}const OB={}.hasOwnProperty;function qae(e){const t={};let n=-1;for(;++n<e.length;)HFe(t,e[n]);return t}function HFe(e,t){let n;for(n in t){const i=(OB.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let o;if(a)for(o in a){OB.call(i,o)||(i[o]=[]);const l=a[o];WFe(i[o],Array.isArray(l)?l:l?[l]:[])}}}function WFe(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ho(e,0,0,r)}function Vae(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function pc(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ma=ch(/[A-Za-z]/),_a=ch(/[\dA-Za-z]/),GFe=ch(/[#-'*+\--9=?A-Z^-~]/);function tN(e){return e!==null&&(e<32||e===127)}const uP=ch(/\d/),KFe=ch(/[\dA-Fa-f]/),YFe=ch(/[!-/:-@[-`{-~]/);function Ht(e){return e!==null&&e<-2}function Vr(e){return e!==null&&(e<0||e===32)}function On(e){return e===-2||e===-1||e===32}const YC=ch(new RegExp("\\p{P}|\\p{S}","u")),tp=ch(/\s/);function ch(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function L0(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const a=e.charCodeAt(n);let o="";if(a===37&&_a(e.charCodeAt(n+1))&&_a(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){const l=e.charCodeAt(n+1);a<56320&&l>56319&&l<57344?(o=String.fromCharCode(a,l),i=1):o="�"}else o=String.fromCharCode(a);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Hn(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let a=0;return o;function o(c){return On(c)?(e.enter(n),l(c)):t(c)}function l(c){return On(c)&&a++<i?(e.consume(c),l):(e.exit(n),t(c))}}const XFe={tokenize:QFe};function QFe(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Hn(e,t,"linePrefix")}function i(l){return e.enter("paragraph"),a(l)}function a(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Ht(l)?(e.consume(l),e.exit("chunkText"),a):(e.consume(l),o)}}const JFe={tokenize:ZFe},DB={tokenize:e$e};function ZFe(e){const t=this,n=[];let r=0,i,a,o;return l;function l(j){if(r<n.length){const E=n[r];return t.containerState=E[1],e.attempt(E[0].continuation,c,u)(j)}return u(j)}function c(j){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&_();const E=t.events.length;let S=E,T;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){T=t.events[S][1].end;break}w(r);let P=E;for(;P<t.events.length;)t.events[P][1].end={...T},P++;return Ho(t.events,S+1,0,t.events.slice(E)),t.events.length=P,u(j)}return l(j)}function u(j){if(r===n.length){if(!i)return h(j);if(i.currentConstruct&&i.currentConstruct.concrete)return x(j);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(DB,d,f)(j)}function d(j){return i&&_(),w(r),h(j)}function f(j){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,x(j)}function h(j){return t.containerState={},e.attempt(DB,p,x)(j)}function p(j){return r++,n.push([t.currentConstruct,t.containerState]),h(j)}function x(j){if(j===null){i&&_(),w(0),e.consume(j);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:a}),y(j)}function y(j){if(j===null){b(e.exit("chunkFlow"),!0),w(0),e.consume(j);return}return Ht(j)?(e.consume(j),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(j),y)}function b(j,E){const S=t.sliceStream(j);if(E&&S.push(null),j.previous=a,a&&(a.next=j),a=j,i.defineSkip(j.start),i.write(S),t.parser.lazy[j.start.line]){let T=i.events.length;for(;T--;)if(i.events[T][1].start.offset<o&&(!i.events[T][1].end||i.events[T][1].end.offset>o))return;const P=t.events.length;let O=P,D,R;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){if(D){R=t.events[O][1].end;break}D=!0}for(w(r),T=P;T<t.events.length;)t.events[T][1].end={...R},T++;Ho(t.events,O+1,0,t.events.slice(P)),t.events.length=T}}function w(j){let E=n.length;for(;E-- >j;){const S=n[E];t.containerState=S[1],S[0].exit.call(t,e)}n.length=j}function _(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function e$e(e,t,n){return Hn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Bx(e){if(e===null||Vr(e)||tp(e))return 1;if(YC(e))return 2}function XC(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const dP={name:"attention",resolveAll:t$e,tokenize:n$e};function t$e(e,t){let n=-1,r,i,a,o,l,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};IB(f,-c),IB(h,c),o={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},a={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=yl(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=yl(u,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",a,t]]),u=yl(u,XC(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=yl(u,[["exit",a,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=yl(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ho(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function n$e(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Bx(r);let a;return o;function o(c){return a=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===a)return e.consume(c),l;const u=e.exit("attentionSequence"),d=Bx(c),f=!d||d===2&&i||n.includes(c),h=!i||i===2&&d||n.includes(r);return u._open=!!(a===42?f:f&&(i||!h)),u._close=!!(a===42?h:h&&(d||!f)),t(c)}}function IB(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const r$e={name:"autolink",tokenize:s$e};function s$e(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(p){return Ma(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||_a(p)?(r=1,l(p)):u(p)}function l(p){return p===58?(e.consume(p),r=0,c):(p===43||p===45||p===46||_a(p))&&r++<32?(e.consume(p),l):(r=0,u(p))}function c(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||tN(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):GFe(p)?(e.consume(p),u):n(p)}function d(p){return _a(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||_a(p))&&r++<63){const x=p===45?h:f;return e.consume(p),x}return n(p)}}const lw={partial:!0,tokenize:i$e};function i$e(e,t,n){return r;function r(a){return On(a)?Hn(e,i,"linePrefix")(a):i(a)}function i(a){return a===null||Ht(a)?t(a):n(a)}}const Hae={continuation:{tokenize:o$e},exit:l$e,name:"blockQuote",tokenize:a$e};function a$e(e,t,n){const r=this;return i;function i(o){if(o===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),a}return n(o)}function a(o){return On(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function o$e(e,t,n){const r=this;return i;function i(o){return On(o)?Hn(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):a(o)}function a(o){return e.attempt(Hae,t,n)(o)}}function l$e(e){e.exit("blockQuote")}const Wae={name:"characterEscape",tokenize:c$e};function c$e(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),i}function i(a){return YFe(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const Gae={name:"characterReference",tokenize:u$e};function u$e(e,t,n){const r=this;let i=0,a,o;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),c}function c(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),a=31,o=_a,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,o=KFe,d):(e.enter("characterReferenceValue"),a=7,o=uP,d(f))}function d(f){if(f===59&&i){const h=e.exit("characterReferenceValue");return o===_a&&!c6(r.sliceSerialize(h))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(f)&&i++<a?(e.consume(f),d):n(f)}}const RB={partial:!0,tokenize:f$e},MB={concrete:!0,name:"codeFenced",tokenize:d$e};function d$e(e,t,n){const r=this,i={partial:!0,tokenize:S};let a=0,o=0,l;return c;function c(T){return u(T)}function u(T){const P=r.events[r.events.length-1];return a=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,l=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(T)}function d(T){return T===l?(o++,e.consume(T),d):o<3?n(T):(e.exit("codeFencedFenceSequence"),On(T)?Hn(e,f,"whitespace")(T):f(T))}function f(T){return T===null||Ht(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(RB,y,E)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(T))}function h(T){return T===null||Ht(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(T)):On(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Hn(e,p,"whitespace")(T)):T===96&&T===l?n(T):(e.consume(T),h)}function p(T){return T===null||Ht(T)?f(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(T))}function x(T){return T===null||Ht(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(T)):T===96&&T===l?n(T):(e.consume(T),x)}function y(T){return e.attempt(i,E,b)(T)}function b(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),w}function w(T){return a>0&&On(T)?Hn(e,_,"linePrefix",a+1)(T):_(T)}function _(T){return T===null||Ht(T)?e.check(RB,y,E)(T):(e.enter("codeFlowValue"),j(T))}function j(T){return T===null||Ht(T)?(e.exit("codeFlowValue"),_(T)):(e.consume(T),j)}function E(T){return e.exit("codeFenced"),t(T)}function S(T,P,O){let D=0;return R;function R(F){return T.enter("lineEnding"),T.consume(F),T.exit("lineEnding"),L}function L(F){return T.enter("codeFencedFence"),On(F)?Hn(T,M,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):M(F)}function M(F){return F===l?(T.enter("codeFencedFenceSequence"),B(F)):O(F)}function B(F){return F===l?(D++,T.consume(F),B):D>=o?(T.exit("codeFencedFenceSequence"),On(F)?Hn(T,U,"whitespace")(F):U(F)):O(F)}function U(F){return F===null||Ht(F)?(T.exit("codeFencedFence"),P(F)):O(F)}}}function f$e(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a)}function a(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const h4={name:"codeIndented",tokenize:m$e},h$e={partial:!0,tokenize:p$e};function m$e(e,t,n){const r=this;return i;
vendor: 5,071 bytes, line 1209
1209function i(u){return e.enter("codeIndented"),Hn(e,a,"linePrefix",5)(u)}function a(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):Ht(u)?e.attempt(h$e,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||Ht(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function p$e(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Ht(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Hn(e,a,"linePrefix",5)(o)}function a(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):Ht(o)?i(o):n(o)}}const g$e={name:"codeText",previous:y$e,resolve:x$e,tokenize:v$e};function x$e(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function y$e(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function v$e(e,t,n){let r=0,i,a;return o;function o(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),r++,l):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(a=e.enter("codeTextSequence"),i=0,d(f)):Ht(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||Ht(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(a.type="codeTextData",u(f))}}class b$e{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ay(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ay(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ay(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Ay(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ay(this.left,n.reverse())}}}function Ay(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Kae(e){const t={};let n=-1,r,i,a,o,l,c,u;const d=new b$e(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type==="lineEndingBlank"&&(a+=2),a<c.length&&c[a][1].type==="content"))for(;++a<c.length&&c[a][1].type!=="content";)c[a][1].type==="chunkText"&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,w$e(d,n)),n=t[n],u=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=d.get(a),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=a);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},l=d.slice(i,n),l.unshift(r),d.splice(i,n-i+1,l))}}return Ho(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function w$e(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const a=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],u={};let d,f,h=-1,p=n,x=0,y=0;const b=[y];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),f&&o.defineSki
vendor: 18,647 bytes, line 1209
1209p(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++h<l.length;)l[h][0]==="exit"&&l[h-1][0]==="enter"&&l[h][1].type===l[h-1][1].type&&l[h][1].start.line!==l[h][1].end.line&&(y=h+1,b.push(y),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):b.pop(),h=b.length;h--;){const w=l.slice(b[h],b[h+1]),_=a.pop();c.push([_,_+w.length-1]),e.splice(_,2,w)}for(c.reverse(),h=-1;++h<c.length;)u[x+c[h][0]]=x+c[h][1],x+=c[h][1]-c[h][0]-1;return u}const _$e={resolve:N$e,tokenize:k$e},j$e={partial:!0,tokenize:C$e};function N$e(e){return Kae(e),e}function k$e(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?a(l):Ht(l)?e.check(j$e,o,a)(l):(e.consume(l),i)}function a(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function C$e(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Hn(e,a,"linePrefix")}function a(o){if(o===null||Ht(o))return n(o);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function Yae(e,t,n,r,i,a,o,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(w){return w===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(w),e.exit(a),h):w===null||w===32||w===41||tN(w)?n(w):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),y(w))}function h(w){return w===62?(e.enter(a),e.consume(w),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===62?(e.exit("chunkString"),e.exit(l),h(w)):w===null||w===60||Ht(w)?n(w):(e.consume(w),w===92?x:p)}function x(w){return w===60||w===62||w===92?(e.consume(w),p):p(w)}function y(w){return!d&&(w===null||w===41||Vr(w))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(w)):d<u&&w===40?(e.consume(w),d++,y):w===41?(e.consume(w),d--,y):w===null||w===32||w===40||tN(w)?n(w):(e.consume(w),w===92?b:y)}function b(w){return w===40||w===41||w===92?(e.consume(w),y):y(w)}}function Xae(e,t,n,r,i,a){const o=this;let l=0,c;return u;function u(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(a),d}function d(p){return l>999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(a),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):Ht(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Ht(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!On(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function Qae(e,t,n,r,i,a){let o;return l;function l(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),o=h===40?41:h,c):n(h)}function c(h){return h===o?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(a),u(h))}function u(h){return h===o?(e.exit(a),c(o)):h===null?n(h):Ht(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Hn(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===o||h===null||Ht(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===o||h===92?(e.consume(h),d):d(h)}}function Pv(e,t){let n;return r;function r(i){return Ht(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):On(i)?Hn(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const E$e={name:"definition",tokenize:A$e},S$e={partial:!0,tokenize:T$e};function A$e(e,t,n){const r=this;let i;return a;function a(p){return e.enter("definition"),o(p)}function o(p){return Xae.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=pc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Vr(p)?Pv(e,u)(p):u(p)}function u(p){return Yae(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(S$e,f,f)(p)}function f(p){return On(p)?Hn(e,h,"whitespace")(p):h(p)}function h(p){return p===null||Ht(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function T$e(e,t,n){return r;function r(l){return Vr(l)?Pv(e,i)(l):n(l)}function i(l){return Qae(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function a(l){return On(l)?Hn(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Ht(l)?t(l):n(l)}}const P$e={name:"hardBreakEscape",tokenize:O$e};function O$e(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return Ht(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const D$e={name:"headingAtx",resolve:I$e,tokenize:R$e};function I$e(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ho(e,r,n-r+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function R$e(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),a(d)}function a(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||Vr(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Ht(d)?(e.exit("atxHeading"),t(d)):On(d)?Hn(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Vr(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const M$e=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],LB=["pre","script","style","textarea"],L$e={concrete:!0,name:"htmlFlow",resolveTo:B$e,tokenize:z$e},F$e={partial:!0,tokenize:q$e},$$e={partial:!0,tokenize:U$e};function B$e(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function z$e(e,t,n){const r=this;let i,a,o,l,c;return u;function u(Y){return d(Y)}function d(Y){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(Y),f}function f(Y){return Y===33?(e.consume(Y),h):Y===47?(e.consume(Y),a=!0,y):Y===63?(e.consume(Y),i=3,r.interrupt?t:q):Ma(Y)?(e.consume(Y),o=String.fromCharCode(Y),b):n(Y)}function h(Y){return Y===45?(e.consume(Y),i=2,p):Y===91?(e.consume(Y),i=5,l=0,x):Ma(Y)?(e.consume(Y),i=4,r.interrupt?t:q):n(Y)}function p(Y){return Y===45?(e.consume(Y),r.interrupt?t:q):n(Y)}function x(Y){const Z="CDATA[";return Y===Z.charCodeAt(l++)?(e.consume(Y),l===Z.length?r.interrupt?t:M:x):n(Y)}function y(Y){return Ma(Y)?(e.consume(Y),o=String.fromCharCode(Y),b):n(Y)}function b(Y){if(Y===null||Y===47||Y===62||Vr(Y)){const Z=Y===47,G=o.toLowerCase();return!Z&&!a&&LB.includes(G)?(i=1,r.interrupt?t(Y):M(Y)):M$e.includes(o.toLowerCase())?(i=6,Z?(e.consume(Y),w):r.interrupt?t(Y):M(Y)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(Y):a?_(Y):j(Y))}return Y===45||_a(Y)?(e.consume(Y),o+=String.fromCharCode(Y),b):n(Y)}function w(Y){return Y===62?(e.consume(Y),r.interrupt?t:M):n(Y)}function _(Y){return On(Y)?(e.consume(Y),_):R(Y)}function j(Y){return Y===47?(e.consume(Y),R):Y===58||Y===95||Ma(Y)?(e.consume(Y),E):On(Y)?(e.consume(Y),j):R(Y)}function E(Y){return Y===45||Y===46||Y===58||Y===95||_a(Y)?(e.consume(Y),E):S(Y)}function S(Y){return Y===61?(e.consume(Y),T):On(Y)?(e.consume(Y),S):j(Y)}function T(Y){return Y===null||Y===60||Y===61||Y===62||Y===96?n(Y):Y===34||Y===39?(e.consume(Y),c=Y,P):On(Y)?(e.consume(Y),T):O(Y)}function P(Y){return Y===c?(e.consume(Y),c=null,D):Y===null||Ht(Y)?n(Y):(e.consume(Y),P)}function O(Y){return Y===null||Y===34||Y===39||Y===47||Y===60||Y===61||Y===62||Y===96||Vr(Y)?S(Y):(e.consume(Y),O)}function D(Y){return Y===47||Y===62||On(Y)?j(Y):n(Y)}function R(Y){return Y===62?(e.consume(Y),L):n(Y)}function L(Y){return Y===null||Ht(Y)?M(Y):On(Y)?(e.consume(Y),L):n(Y)}function M(Y){return Y===45&&i===2?(e.consume(Y),H):Y===60&&i===1?(e.consume(Y),z):Y===62&&i===4?(e.consume(Y),oe):Y===63&&i===3?(e.consume(Y),q):Y===93&&i===5?(e.consume(Y),W):Ht(Y)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(F$e,J,B)(Y)):Y===null||Ht(Y)?(e.exit("htmlFlowData"),B(Y)):(e.consume(Y),M)}function B(Y){return e.check($$e,U,J)(Y)}function U(Y){return e.enter("lineEnding"),e.consume(Y),e.exit("lineEnding"),F}function F(Y){return Y===null||Ht(Y)?B(Y):(e.enter("htmlFlowData"),M(Y))}function H(Y){return Y===45?(e.consume(Y),q):M(Y)}function z(Y){return Y===47?(e.consume(Y),o="",K):M(Y)}function K(Y){if(Y===62){const Z=o.toLowerCase();return LB.includes(Z)?(e.consume(Y),oe):M(Y)}return Ma(Y)&&o.length<8?(e.consume(Y),o+=String.fromCharCode(Y),K):M(Y)}function W(Y){return Y===93?(e.consume(Y),q):M(Y)}function q(Y){return Y===62?(e.consume(Y),oe):Y===45&&i===2?(e.consume(Y),q):M(Y)}function oe(Y){return Y===null||Ht(Y)?(e.exit("htmlFlowData"),J(Y)):(e.consume(Y),oe)}function J(Y){return e.exit("htmlFlow"),t(Y)}}function U$e(e,t,n){const r=this;return i;function i(o){return Ht(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):n(o)}function a(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function q$e(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(lw,t,n)}}const V$e={name:"htmlText",tokenize:H$e};function H$e(e,t,n){const r=this;let i,a,o;return l;function l(q){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(q),c}function c(q){return q===33?(e.consume(q),u):q===47?(e.consume(q),S):q===63?(e.consume(q),j):Ma(q)?(e.consume(q),O):n(q)}function u(q){return q===45?(e.consume(q),d):q===91?(e.consume(q),a=0,x):Ma(q)?(e.consume(q),_):n(q)}function d(q){return q===45?(e.consume(q),p):n(q)}function f(q){return q===null?n(q):q===45?(e.consume(q),h):Ht(q)?(o=f,z(q)):(e.consume(q),f)}function h(q){return q===45?(e.consume(q),p):f(q)}function p(q){return q===62?H(q):q===45?h(q):f(q)}function x(q){const oe="CDATA[";return q===oe.charCodeAt(a++)?(e.consume(q),a===oe.length?y:x):n(q)}function y(q){return q===null?n(q):q===93?(e.consume(q),b):Ht(q)?(o=y,z(q)):(e.consume(q),y)}function b(q){return q===93?(e.consume(q),w):y(q)}function w(q){return q===62?H(q):q===93?(e.consume(q),w):y(q)}function _(q){return q===null||q===62?H(q):Ht(q)?(o=_,z(q)):(e.consume(q),_)}function j(q){return q===null?n(q):q===63?(e.consume(q),E):Ht(q)?(o=j,z(q)):(e.consume(q),j)}function E(q){return q===62?H(q):j(q)}function S(q){return Ma(q)?(e.consume(q),T):n(q)}function T(q){return q===45||_a(q)?(e.consume(q),T):P(q)}function P(q){return Ht(q)?(o=P,z(q)):On(q)?(e.consume(q),P):H(q)}function O(q){return q===45||_a(q)?(e.consume(q),O):q===47||q===62||Vr(q)?D(q):n(q)}function D(q){return q===47?(e.consume(q),H):q===58||q===95||Ma(q)?(e.consume(q),R):Ht(q)?(o=D,z(q)):On(q)?(e.consume(q),D):H(q)}function R(q){return q===45||q===46||q===58||q===95||_a(q)?(e.consume(q),R):L(q)}function L(q){return q===61?(e.consume(q),M):Ht(q)?(o=L,z(q)):On(q)?(e.consume(q),L):D(q)}function M(q){return q===null||q===60||q===61||q===62||q===96?n(q):q===34||q===39?(e.consume(q),i=q,B):Ht(q)?(o=M,z(q)):On(q)?(e.consume(q),M):(e.consume(q),U)}function B(q){return q===i?(e.consume(q),i=void 0,F):q===null?n(q):Ht(q)?(o=B,z(q)):(e.consume(q),B)}function U(q){return q===null||q===34||q===39||q===60||q===61||q===96?n(q):q===47||q===62||Vr(q)?D(q):(e.consume(q),U)}function F(q){return q===47||q===62||Vr(q)?D(q):n(q)}function H(q){return q===62?(e.consume(q),e.exit("htmlTextData"),e.exit("htmlText"),t):n(q)}function z(q){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(q),e.exit("lineEnding"),K}function K(q){return On(q)?Hn(e,W,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):W(q)}function W(q){return e.enter("htmlTextData"),o(q)}}const u6={name:"labelEnd",resolveAll:Y$e,resolveTo:X$e,tokenize:Q$e},W$e={tokenize:J$e},G$e={tokenize:Z$e},K$e={tokenize:e7e};function Y$e(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Ho(e,0,e.length,n),e}function X$e(e,t){let n=e.length,r=0,i,a,o,l;for(;n--;)if(i=e[n][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const c={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[a][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=yl(l,e.slice(a+1,a+r+3)),l=yl(l,[["enter",d,t]]),l=yl(l,XC(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),l=yl(l,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),l=yl(l,e.slice(o+1)),l=yl(l,[["exit",c,t]]),Ho(e,a,e.length,l),e}function Q$e(e,t,n){const r=this;let i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){a=r.events[i][1];break}return l;function l(h){return a?a._inactive?f(h):(o=r.parser.defined.includes(pc(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),c):n(h)}function c(h){return h===40?e.attempt(W$e,d,o?d:f)(h):h===91?e.attempt(G$e,d,o?u:f)(h):o?d(h):f(h)}function u(h){return e.attempt(K$e,d,f)(h)}function d(h){return t(h)}function f(h){return a._balanced=!0,n(h)}}function J$e(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),i}function i(f){return Vr(f)?Pv(e,a)(f):a(f)}function a(f){return f===41?d(f):Yae(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return Vr(f)?Pv(e,c)(f):d(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?Qae(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return Vr(f)?Pv(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function Z$e(e,t,n){const r=this;return i;function i(l){return Xae.call(r,e,a,o,"reference","referenceMarker","referenceString")(l)}function a(l){return r.parser.defined.includes(pc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function e7e(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),i}function i(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const t7e={name:"labelStartImage",resolveAll:u6.resolveAll,tokenize:n7e};function n7e(e,t,n){const r=this;return i;function i(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),a}function a(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const r7e={name:"labelStartLink",resolveAll:u6.resolveAll,tokenize:s7e};function s7e(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),a}function a(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const m4={name:"lineEnding",tokenize:i7e};function i7e(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Hn(e,t,"linePrefix")}}const Sj={name:"thematicBreak",tokenize:a7e};function a7e(e,t,n){let r=0,i;return a;function a(u){return e.enter("thematicBreak"),o(u)}function o(u){return i=u,l(u)}function l(u){return u===i?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||Ht(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===i?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),On(u)?Hn(e,l,"whitespace")(u):l(u))}}const eo={continuation:{tokenize:u7e},exit:f7e,name:"list",tokenize:c7e},o7e={partial:!0,tokenize:h7e},l7e={partial:!0,tokenize:d7e};function c7e(e,t,n){const r=this,i=r.events[r.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return l;function l(p){const x=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:uP(p)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Sj,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return uP(p)&&++o<10?(e.consume(p),c):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(lw,r.interrupt?n:d,e.attempt(o7e,h,f))}
vendor: 6,769 bytes, line 1209
1209function d(p){return r.containerState.initialBlankLine=!0,a++,h(p)}function f(p){return On(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function u7e(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(lw,i,a);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Hn(e,t,"listItemIndent",r.containerState.size+1)(l)}function a(l){return r.containerState.furtherBlankLines||!On(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(l7e,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Hn(e,e.attempt(eo,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function d7e(e,t,n){const r=this;return Hn(e,i,"listItemIndent",r.containerState.size+1);function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(a):n(a)}}function f7e(e){e.exit(this.containerState.type)}function h7e(e,t,n){const r=this;return Hn(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){const o=r.events[r.events.length-1];return!On(a)&&o&&o[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const FB={name:"setextUnderline",resolveTo:m7e,tokenize:p7e};function m7e(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",o,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function p7e(e,t,n){const r=this;let i;return a;function a(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),i=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===i?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),On(u)?Hn(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Ht(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const g7e={tokenize:x7e};function x7e(e){const t=this,n=e.attempt(lw,r,e.attempt(this.parser.constructs.flowInitial,i,Hn(e,e.attempt(this.parser.constructs.flow,i,e.attempt(_$e,i)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const y7e={resolveAll:Zae()},v7e=Jae("string"),b7e=Jae("text");function Jae(e){return{resolveAll:Zae(e==="text"?w7e:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],a=n.attempt(i,o,l);return o;function o(d){return u(d)?a(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),a(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=i[d];let h=-1;if(f)for(;++h<f.length;){const p=f[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function Zae(e){return t;function t(n,r){let i=-1,a;for(;++i<=n.length;)a===void 0?n[i]&&n[i][1].type==="data"&&(a=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==a+2&&(n[a][1].end=n[i-1][1].end,n.splice(a+2,i-a-2),i=a+2),a=void 0);return e?e(n,r):n}}function w7e(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let a=i.length,o=-1,l=0,c;for(;a--;){const u=i[a];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(u===-2)c=!0,l++;else if(u!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const _7e={42:eo,43:eo,45:eo,48:eo,49:eo,50:eo,51:eo,52:eo,53:eo,54:eo,55:eo,56:eo,57:eo,62:Hae},j7e={91:E$e},N7e={[-2]:h4,[-1]:h4,32:h4},k7e={35:D$e,42:Sj,45:[FB,Sj],60:L$e,61:FB,95:Sj,96:MB,126:MB},C7e={38:Gae,92:Wae},E7e={[-5]:m4,[-4]:m4,[-3]:m4,33:t7e,38:Gae,42:dP,60:[r$e,V$e],91:r7e,92:[P$e,Wae],93:u6,95:dP,96:g$e},S7e={null:[dP,y7e]},A7e={null:[42,95]},T7e={null:[]},P7e=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:A7e,contentInitial:j7e,disable:T7e,document:_7e,flow:k7e,flowInitial:N7e,insideSpan:S7e,string:C7e,text:E7e},Symbol.toStringTag,{value:"Module"}));function O7e(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},a=[];let o=[],l=[];const c={attempt:P(S),check:P(T),consume:_,enter:j,exit:E,interrupt:P(T,{interrupt:!0})},u={code:null,containerState:{},defineSkip:y,events:[],now:x,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:f};let d=t.tokenize.call(u,c);return t.resolveAll&&a.push(t),u;function f(L){return o=yl(o,L),b(),o[o.length-1]!==null?[]:(O(t,0),u.events=XC(a,u.events,u),u.events)}function h(L,M){return I7e(p(L),M)}function p(L){return D7e(o,L)}function x(){const{_bufferIndex:L,_index:M,line:B,column:U,offset:F}=r;return{_bufferIndex:L,_index:M,line:B,column:U,offset:F}}function y(L){i[L.line]=L.column,R()}function b(){let L;for(;r._index<o.length;){const M=o[r._index];if(typeof M=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<M.length;)w(M.charCodeAt(r._bufferIndex));else w(M)}}function w(L){d=d(L)}function _(L){Ht(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,R()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=L}function j(L,M){const B=M||{};return B.type=L,B.start=x(),u.events.push(["enter",B,u]),l.push(B),B}function E(L){const M=l.pop();return M.end=x(),u.events.push(["exit",M,u]),M}function S(L,M){O(L,M.from)}
vendor: 13,493 bytes, lines 1209-1211
1209function T(L,M){M.restore()}function P(L,M){return B;function B(U,F,H){let z,K,W,q;return Array.isArray(U)?J(U):"tokenize"in U?J([U]):oe(U);function oe(se){return ce;function ce(le){const fe=le!==null&&se[le],be=le!==null&&se.null,_e=[...Array.isArray(fe)?fe:fe?[fe]:[],...Array.isArray(be)?be:be?[be]:[]];return J(_e)(le)}}function J(se){return z=se,K=0,se.length===0?H:Y(se[K])}function Y(se){return ce;function ce(le){return q=D(),W=se,se.partial||(u.currentConstruct=se),se.name&&u.parser.constructs.disable.null.includes(se.name)?G():se.tokenize.call(M?Object.assign(Object.create(u),M):u,c,Z,G)(le)}}function Z(se){return L(W,q),F}function G(se){return q.restore(),++K<z.length?Y(z[K]):H}}}function O(L,M){L.resolveAll&&!a.includes(L)&&a.push(L),L.resolve&&Ho(u.events,M,u.events.length-M,L.resolve(u.events.slice(M),u)),L.resolveTo&&(u.events=L.resolveTo(u.events,u))}function D(){const L=x(),M=u.previous,B=u.currentConstruct,U=u.events.length,F=Array.from(l);return{from:U,restore:H};function H(){r=L,u.previous=M,u.currentConstruct=B,u.events.length=U,l=F,R()}}function R(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function D7e(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function I7e(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const a=e[n];let o;if(typeof a=="string")o=a;else switch(a){case-5:{o="\r";break}case-4:{o=`
1210`;break}case-3:{o=`\r
1211`;break}case-2:{o=t?" ":"	";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join("")}function R7e(e){const r={constructs:qae([P7e,...(e||{}).extensions||[]]),content:i(XFe),defined:[],document:i(JFe),flow:i(g7e),lazy:{},string:i(v7e),text:i(b7e)};return r;function i(a){return o;function o(l){return O7e(r,a,l)}}}function M7e(e){for(;!Kae(e););return e}const $B=/[\0\t\n\r]/g;function L7e(){let e=1,t="",n=!0,r;return i;function i(a,o,l){const c=[];let u,d,f,h,p;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(o||void 0).decode(a)),f=0,t="",n&&(a.charCodeAt(0)===65279&&f++,n=void 0);f<a.length;){if($B.lastIndex=f,u=$B.exec(a),h=u&&u.index!==void 0?u.index:a.length,p=a.charCodeAt(h),!u){t=a.slice(f);break}if(p===10&&f===h&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<h&&(c.push(a.slice(f,h)),e+=h-f),p){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}f=h+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const F7e=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function $7e(e){return e.replace(F7e,B7e)}function B7e(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),a=i===120||i===88;return Vae(n.slice(a?2:1),a?16:10)}return c6(n)||e}const eoe={}.hasOwnProperty;function z7e(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),U7e(n)(M7e(R7e(n).document().write(L7e()(e,t,!0))))}function U7e(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(ot),autolinkProtocol:D,autolinkEmail:D,atxHeading:a(Ne),blockQuote:a(be),characterEscape:D,characterReference:D,codeFenced:a(_e),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(_e,o),codeText:a(pe,o),codeTextData:D,data:D,codeFlowValue:D,definition:a(Te),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(Ge),hardBreakEscape:a(it),hardBreakTrailing:a(it),htmlFlow:a(qe,o),htmlFlowData:D,htmlText:a(qe,o),htmlTextData:D,image:a(Qe),label:o,link:a(ot),listItem:a(me),listItemValue:h,listOrdered:a(de,f),listUnordered:a(de),paragraph:a(ke),reference:Y,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(Ne),strong:a(Be),thematicBreak:a($e)},exit:{atxHeading:c(),atxHeadingSequence:S,autolink:c(),autolinkEmail:fe,autolinkProtocol:le,blockQuote:c(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:G,characterReferenceMarkerNumeric:G,characterReferenceValue:se,characterReference:ce,codeFenced:c(b),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:x,codeFlowValue:R,codeIndented:c(w),codeText:c(F),codeTextData:R,data:R,definition:c(),definitionDestinationString:E,definitionLabelString:_,definitionTitleString:j,emphasis:c(),hardBreakEscape:c(M),hardBreakTrailing:c(M),htmlFlow:c(B),htmlFlowData:R,htmlText:c(U),htmlTextData:R,image:c(z),label:W,labelText:K,lineEnding:L,link:c(H),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Z,resourceDestinationString:q,resourceTitleString:oe,resource:J,setextHeading:c(O),setextHeadingLineSequence:P,setextHeadingText:T,strong:c(),thematicBreak:c()}};toe(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ge){let Le={type:"root",children:[]};const Ve={stack:[Le],tokenStack:[],config:t,enter:l,exit:u,buffer:o,resume:d,data:n},ct=[];let yt=-1;for(;++yt<ge.length;)if(ge[yt][1].type==="listOrdered"||ge[yt][1].type==="listUnordered")if(ge[yt][0]==="enter")ct.push(yt);else{const nn=ct.pop();yt=i(ge,nn,yt)}for(yt=-1;++yt<ge.length;){const nn=t[ge[yt][0]];eoe.call(nn,ge[yt][1].type)&&nn[ge[yt][1].type].call(Object.assign({sliceSerialize:ge[yt][2].sliceSerialize},Ve),ge[yt][1])}if(Ve.tokenStack.length>0){const nn=Ve.tokenStack[Ve.tokenStack.length-1];(nn[1]||BB).call(Ve,void 0,nn[0])}for(Le.position={start:$d(ge.length>0?ge[0][1].start:{line:1,column:1,offset:0}),end:$d(ge.length>0?ge[ge.length-2][1].end:{line:1,column:1,offset:0})},yt=-1;++yt<t.transforms.length;)Le=t.transforms[yt](Le)||Le;return Le}function i(ge,Le,Ve){let ct=Le-1,yt=-1,nn=!1,Vn,zt,He,bn;for(;++ct<=Ve;){const Rt=ge[ct];switch(Rt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Rt[0]==="enter"?yt++:yt--,bn=void 0;break}case"lineEndingBlank":{Rt[0]==="enter"&&(Vn&&!bn&&!yt&&!He&&(He=ct),bn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:bn=void 0}if(!yt&&Rt[0]==="enter"&&Rt[1].type==="listItemPrefix"||yt===-1&&Rt[0]==="exit"&&(Rt[1].type==="listUnordered"||Rt[1].type==="listOrdered")){if(Vn){let An=ct;for(zt=void 0;An--;){const gt=ge[An];if(gt[1].type==="lineEnding"||gt[1].type==="lineEndingBlank"){if(gt[0]==="exit")continue;zt&&(ge[zt][1].type="lineEndingBlank",nn=!0),gt[1].type="lineEnding",zt=An}else if(!(gt[1].type==="linePrefix"||gt[1].type==="blockQuotePrefix"||gt[1].type==="blockQuotePrefixWhitespace"||gt[1].type==="blockQuoteMarker"||gt[1].type==="listItemIndent"))break}He&&(!zt||He<zt)&&(Vn._spread=!0),Vn.end=Object.assign({},zt?ge[zt][1].start:Rt[1].end),ge.splice(zt||ct,0,["exit",Vn,Rt[2]]),ct++,Ve++}if(Rt[1].type==="listItemPrefix"){const An={type:"listItem",_spread:!1,start:Object.assign({},Rt[1].start),end:void 0};Vn=An,ge.splice(ct,0,["enter",An,Rt[2]]),ct++,Ve++,He=void 0,bn=!0}}}return ge[Le][1]._spread=nn,Ve}function a(ge,Le){return Ve;function Ve(ct){l.call(this,ge(ct),ct),Le&&Le.call(this,ct)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(ge,Le,Ve){this.stack[this.stack.length-1].children.push(ge),this.stack.push(ge),this.tokenStack.push([Le,Ve||void 0]),ge.position={start:$d(Le.start),end:void 0}}function c(ge){return Le;function Le(Ve){ge&&ge.call(this,Ve),u.call(this,Ve)}}function u(ge,Le){const Ve=this.stack.pop(),ct=this.tokenStack.pop();if(ct)ct[0].type!==ge.type&&(Le?Le.call(this,ge,ct[0]):(ct[1]||BB).call(this,ge,ct[0]));else throw new Error("Cannot close `"+ge.type+"` ("+Tv({start:ge.start,end:ge.end})+"): it’s not open");Ve.position.end=$d(ge.end)}function d(){return l6(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function h(ge){if(this.data.expectingFirstListItemValue){const Le=this.stack[this.stack.length-2];Le.start=Number.parseInt(this.sliceSerialize(ge),10),this.data.expectingFirstListItemValue=void 0}}function p(){const ge=this.resume(),Le=this.stack[this.stack.length-1];Le.lang=ge}function x(){const ge=this.resume(),Le=this.stack[this.stack.length-1];Le.meta=ge}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const ge=this.resume(),Le=this.stack[this.stack.length-1];Le.value=ge.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const ge=this.resume(),Le=this.stack[this.stack.length-1];Le.value=ge.replace(/(\r?\n|\r)$/g,"")}function _(ge){const Le=this.resume(),Ve=this.stack[this.stack.length-1];Ve.label=Le,Ve.identifier=pc(this.sliceSerialize(ge)).toLowerCase()}function j(){const ge=this.resume(),Le=this.stack[this.stack.length-1];Le.title=ge}function E(){const ge=this.resume(),Le=this.stack[this.stack.length-1];Le.url=ge}function S(ge){const Le=this.stack[this.stack.length-1];if(!Le.depth){const Ve=this.sliceSerialize(ge).length;Le.depth=Ve}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function P(ge){const Le=this.stack[this.stack.length-1];Le.depth=this.sliceSerialize(ge).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function D(ge){const Ve=this.stack[this.stack.length-1].children;let ct=Ve[Ve.length-1];(!ct||ct.type!=="text")&&(ct=Ae(),ct.position={start:$d(ge.start),end:void 0},Ve.push(ct)),this.stack.push(ct)}function R(ge){const Le=this.stack.pop();Le.value+=this.sliceSerialize(ge),Le.position.end=$d(ge.end)}function L(ge){const Le=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ve=Le.children[Le.children.length-1];Ve.position.end=$d(ge.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Le.type)&&(D.call(this,ge),R.call(this,ge))}function M(){this.data.atHardBreak=!0}function B(){const ge=this.resume(),Le=this.stack[this.stack.length-1];Le.value=ge}function U(){const ge=this.resume(),Le=this.stack[this.stack.length-1];Le.value=ge}function F(){const ge=this.resume(),Le=this.stack[this.stack.length-1];Le.value=ge}function H(){const ge=this.stack[this.stack.length-1];if(this.data.inReference){const Le=this.data.referenceType||"shortcut";ge.type+="Reference",ge.referenceType=Le,delete ge.url,delete ge.title}else delete ge.identifier,delete ge.label;this.data.referenceType=void 0}function z(){const ge=this.stack[this.stack.length-1];if(this.data.inReference){const Le=this.data.referenceType||"shortcut";ge.type+="Reference",ge.referenceType=Le,delete ge.url,delete ge.title}else delete ge.identifier,delete ge.label;this.data.referenceType=void 0}function K(ge){const Le=this.sliceSerialize(ge),Ve=this.stack[this.stack.length-2];Ve.label=$7e(Le),Ve.identifier=pc(Le).toLowerCase()}function W(){const ge=this.stack[this.stack.length-1],Le=this.resume(),Ve=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ve.type==="link"){const ct=ge.children;Ve.children=ct}else Ve.alt=Le}function q(){const ge=this.resume(),Le=this.stack[this.stack.length-1];Le.url=ge}function oe(){const ge=this.resume(),Le=this.stack[this.stack.length-1];Le.title=ge}function J(){this.data.inReference=void 0}function Y(){this.data.referenceType="collapsed"}function Z(ge){const Le=this.resume(),Ve=this.stack[this.stack.length-1];Ve.label=Le,Ve.identifier=pc(this.sliceSerialize(ge)).toLowerCase(),this.data.referenceType="full"}function G(ge){this.data.characterReferenceType=ge.type}function se(ge){const Le=this.sliceSerialize(ge),Ve=this.data.characterReferenceType;let ct;Ve?(ct=Vae(Le,Ve==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ct=c6(Le);const yt=this.stack[this.stack.length-1];yt.value+=ct}function ce(ge){const Le=this.stack.pop();Le.position.end=$d(ge.end)}function le(ge){R.call(this,ge);const Le=this.stack[this.stack.length-1];Le.url=this.sliceSerialize(ge)}function fe(ge){R.call(this,ge);const Le=this.stack[this.stack.length-1];Le.url="mailto:"+this.sliceSerialize(ge)}function be(){return{type:"blockquote",children:[]}}function _e(){return{type:"code",lang:null,meta:null,value:""}}function pe(){return{type:"inlineCode",value:""}}function Te(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ge(){return{type:"emphasis",children:[]}}function Ne(){return{type:"heading",depth:0,children:[]}}function it(){return{type:"break"}}function qe(){return{type:"html",value:""}}function Qe(){return{type:"image",title:null,url:"",alt:null}}function ot(){return{type:"link",title:null,url:"",children:[]}}function de(ge){return{type:"list",ordered:ge.type==="listOrdered",start:null,spread:ge._spread,children:[]}}function me(ge){return{type:"listItem",spread:ge._spread,checked:null,children:[]}}function ke(){return{type:"paragraph",children:[]}}function Be(){return{type:"strong",children:[]}}function Ae(){return{type:"text",value:""}}function $e(){return{type:"thematicBreak"}}}function $d(e){return{line:e.line,column:e.column,offset:e.offset}}function toe(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?toe(e,r):q7e(e,r)}}function q7e(e,t){let n;for(n in t)if(eoe.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function BB(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Tv({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Tv({start:t.start,end:t.end}
vendor: 4,537 bytes, lines 1211-1215
1211)+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Tv({start:t.start,end:t.end})+") is still open")}function V7e(e){const t=this;t.parser=n;function n(r){return z7e(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function H7e(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function W7e(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
1212`}]}function G7e(e,t){const n=t.value?t.value+`
1213`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a}function K7e(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Y7e(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function X7e(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=L0(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function Q7e(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function J7e(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function noe(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),a=i[0];a&&a.type==="text"?a.value="["+a.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function Z7e(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return noe(e,t);const i={src:L0(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function e9e(e,t){const n={src:L0(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function t9e(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function n9e(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return noe(e,t);const i={href:L0(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function r9e(e,t){const n={href:L0(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function s9e(e,t,n){const r=e.all(t),i=n?i9e(n):roe(t),a={},o=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const d=r[l];(i||l!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
1214`}),d.type==="element"&&d.tagName==="p"&&!i?o.push(...d.children):o.push(d)}const c=r[r.length-1];c&&(i||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
1215`});const u={type:"element",tagName:"li",properties:a,children:o};
vendor: 3,273 bytes, line 1215
1215return e.patch(t,u),e.applyData(t,u)}function i9e(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=roe(n[r])}return t}function roe(e){const t=e.spread;return t??e.children.length>1}function a9e(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function o9e(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function l9e(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function c9e(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function u9e(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=s6(t.children[1]),c=Mae(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),i.push(o)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function d9e(e,t,n){const r=n?n.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const f=t.children[c],h={},p=o?o[c]:void 0;p&&(h.align=p);let x={type:"element",tagName:a,properties:h,children:[]};f&&(x.children=e.all(f),e.patch(f,x),x=e.applyData(f,x)),u.push(x)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function f9e(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const zB=9,UB=32;function h9e(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const a=[];for(;r;)a.push(qB(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(qB(t.slice(i),i>0,!1)),a.join("")}function qB(e,t,n){let r=0,i=e.length;if(t){let a=e.codePointAt(r);for(;a===zB||a===UB;)r++,a=e.codePointAt(r)}if(n){let a=e.codePointAt(i-1);for(;a===zB||a===UB;)i--,a=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function m9e(e,t){const n={type:"text",value:h9e(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function p9e(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const g9e={blockquote:H7e,break:W7e,code:G7e,delete:K7e,emphasis:Y7e,footnoteReference:X7e,heading:Q7e,html:J7e,imageReference:Z7e,image:e9e,inlineCode:t9e,linkReference:n9e,link:r9e,listItem:s9e,list:a9e,paragraph:o9e,root:l9e,strong:c9e,table:u9e,tableCell:f9e,tableRow:d9e,text:m9e,thematicBreak:p9e,toml:g_,yaml:g_,definition:g_,footnoteDefinition:g_};function g_(){}const soe=-1,QC=0,Ov=1,nN=2,d6=3,f6=4,h6=5,m6=6,ioe=7,aoe=8,ooe=typeof self=="object"?self:globalThis,VB=(e,t)=>
vendor: 4,844 bytes, lines 1215-1217
1215{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new ooe[e](t)},x9e=(e,t)=>{const n=(i,a)=>(e.set(a,i),i),r=i=>{if(e.has(i))return e.get(i);const[a,o]=t[i];switch(a){case QC:case soe:return n(o,i);case Ov:{const l=n([],i);for(const c of o)l.push(r(c));return l}case nN:{const l=n({},i);for(const[c,u]of o)l[r(c)]=r(u);return l}case d6:return n(new Date(o),i);case f6:{const{source:l,flags:c}=o;return n(new RegExp(l,c),i)}case h6:{const l=n(new Map,i);for(const[c,u]of o)l.set(r(c),r(u));return l}case m6:{const l=n(new Set,i);for(const c of o)l.add(r(c));return l}case ioe:{const{name:l,message:c}=o;return n(typeof ooe[l]=="function"?VB(l,c):new Error(c),i)}case aoe:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(VB(a,o),i)};return r},HB=e=>x9e(new Map,e)(0),Bh="",{toString:y9e}={},{keys:v9e}=Object,Ty=e=>{const t=typeof e;if(t!=="object"||!e)return[QC,t];const n=y9e.call(e).slice(8,-1);switch(n){case"Array":return[Ov,Bh];case"Object":return[nN,Bh];case"Date":return[d6,Bh];case"RegExp":return[f6,Bh];case"Map":return[h6,Bh];case"Set":return[m6,Bh];case"DataView":return[Ov,n]}return n.includes("Array")?[Ov,n]:e instanceof Error?[ioe,e.name||"Error"]:[nN,n]},x_=([e,t])=>e===QC&&(t==="function"||t==="symbol"),b9e=(e,t,n,r)=>{const i=(o,l)=>{const c=r.push(o)-1;return n.set(l,c),c},a=o=>{if(n.has(o))return n.get(o);let[l,c]=Ty(o);switch(l){case QC:{let d=o;switch(c){case"bigint":l=aoe,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return i([soe],o)}return i([l,d],o)}case Ov:{if(c){let h=o;return c==="DataView"?h=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(o)),i([c,[...h]],o)}const d=[],f=i([l,d],o);for(const h of o)d.push(a(h));return f}case nN:{if(c)switch(c){case"BigInt":return i([c,o.toString()],o);case"Boolean":case"Number":case"String":return i([c,o.valueOf()],o)}if(t&&"toJSON"in o)return a(o.toJSON());const d=[],f=i([l,d],o);for(const h of v9e(o))(e||!x_(Ty(o[h])))&&d.push([a(h),a(o[h])]);return f}case d6:return i([l,isNaN(o.getTime())?Bh:o.toISOString()],o);case f6:{const{source:d,flags:f}=o;return i([l,{source:d,flags:f}],o)}case h6:{const d=[],f=i([l,d],o);for(const[h,p]of o)(e||!(x_(Ty(h))||x_(Ty(p))))&&d.push([a(h),a(p)]);return f}case m6:{const d=[],f=i([l,d],o);for(const h of o)(e||!x_(Ty(h)))&&d.push(a(h));return f}}const{message:u}=o;return i([l,{name:c,message:u}],o)};return a},WB=(e,{json:t,lossy:n}={})=>{const r=[];return b9e(!(t||n),!!t,new Map,r)(e),r},rN=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?HB(WB(e,t)):structuredClone(e):(e,t)=>HB(WB(e,t));function w9e(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function _9e(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function j9e(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||w9e,r=e.options.footnoteBackLabel||_9e,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),f=String(u.identifier).toUpperCase(),h=L0(f.toLowerCase());let p=0;const x=[],y=e.footnoteCounts.get(f);for(;y!==void 0&&++p<=y;){x.length>0&&x.push({type:"text",value:" "});let _=typeof n=="string"?n:n(c,p);typeof _=="string"&&(_={type:"text",value:_}),x.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(_)?_:[_]})}const b=d[d.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const _=b.children[b.children.length-1];_&&_.type==="text"?_.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...x)}else d.push(...x);const w={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,w),l.push(w)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...rN(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
1216`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
1217`}]}}const JC=function(e){if(e==null)return E9e;if(typeof e=="function")return ZC(e);if(typeof e=="object")return Array.isArray(e)?N9e(e):k9e(e);
vendor: 17,857 bytes, lines 1217-1221
1217if(typeof e=="string")return C9e(e);throw new Error("Expected function, string, or object as test")};function N9e(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=JC(e[n]);return ZC(r);function r(...i){let a=-1;for(;++a<t.length;)if(t[a].apply(this,i))return!0;return!1}}function k9e(e){const t=e;return ZC(n);function n(r){const i=r;let a;for(a in e)if(i[a]!==t[a])return!1;return!0}}function C9e(e){return ZC(t);function t(n){return n&&n.type===e}}function ZC(e){return t;function t(n,r,i){return!!(S9e(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function E9e(){return!0}function S9e(e){return e!==null&&typeof e=="object"&&"type"in e}const loe=[],A9e=!0,fP=!1,T9e="skip";function coe(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const a=JC(i),o=r?-1:1;l(e,void 0,[])();function l(c,u,d){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const p=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=loe,x,y,b;if((!t||a(c,u,d[d.length-1]||void 0))&&(p=P9e(n(c,d)),p[0]===fP))return p;if("children"in c&&c.children){const w=c;if(w.children&&p[0]!==T9e)for(y=(r?w.children.length:-1)+o,b=d.concat(w);y>-1&&y<w.children.length;){const _=w.children[y];if(x=l(_,y,b)(),x[0]===fP)return x;y=typeof x[1]=="number"?x[1]:y+o}}return p}}}function P9e(e){return Array.isArray(e)?e:typeof e=="number"?[A9e,e]:e==null?loe:[e]}function p6(e,t,n,r){let i,a,o;typeof t=="function"&&typeof n!="function"?(a=void 0,o=t,i=n):(a=t,o=n,i=r),coe(e,a,l,i);function l(c,u){const d=u[u.length-1],f=d?d.children.indexOf(c):void 0;return o(c,f,d)}}const hP={}.hasOwnProperty,O9e={};function D9e(e,t){const n=t||O9e,r=new Map,i=new Map,a=new Map,o={...g9e,...n.handlers},l={all:u,applyData:R9e,definitionById:r,footnoteById:i,footnoteCounts:a,footnoteOrder:[],handlers:o,one:c,options:n,patch:I9e,wrap:L9e};return p6(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?r:i,h=String(d.identifier).toUpperCase();f.has(h)||f.set(h,d)}}),l;function c(d,f){const h=d.type,p=l.handlers[h];if(hP.call(l.handlers,h)&&p)return p(l,d,f);if(l.options.passThrough&&l.options.passThrough.includes(h)){if("children"in d){const{children:y,...b}=d,w=rN(b);return w.children=l.all(d),w}return rN(d)}return(l.options.unknownHandler||M9e)(l,d,f)}function u(d){const f=[];if("children"in d){const h=d.children;let p=-1;for(;++p<h.length;){const x=l.one(h[p],d);if(x){if(p&&h[p-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=GB(x.value)),!Array.isArray(x)&&x.type==="element")){const y=x.children[0];y&&y.type==="text"&&(y.value=GB(y.value))}Array.isArray(x)?f.push(...x):f.push(x)}}}return f}}function I9e(e,t){e.position&&(t.position=_Fe(e))}function R9e(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,a=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&a&&Object.assign(n.properties,rN(a)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function M9e(e,t){const n=t.data||{},r="value"in t&&!(hP.call(n,"hProperties")||hP.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function L9e(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
1218`});++r<e.length;)r&&n.push({type:"text",value:`
1219`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
1220`}),n}function GB(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function KB(e,t){const n=D9e(e,t),r=n.one(e,void 0),i=j9e(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&a.children.push({type:"text",value:`
1221`},i),a}function F9e(e,t){return e&&"run"in e?async function(n,r){const i=KB(n,{file:r,...t});await e.run(i,r)}:function(n,r){return KB(n,{file:r,...e||t})}}function YB(e){if(e)throw e}var Aj=Object.prototype.hasOwnProperty,uoe=Object.prototype.toString,XB=Object.defineProperty,QB=Object.getOwnPropertyDescriptor,JB=function(t){return typeof Array.isArray=="function"?Array.isArray(t):uoe.call(t)==="[object Array]"},ZB=function(t){if(!t||uoe.call(t)!=="[object Object]")return!1;var n=Aj.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Aj.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Aj.call(t,i)},ez=function(t,n){XB&&n.name==="__proto__"?XB(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},tz=function(t,n){if(n==="__proto__")if(Aj.call(t,n)){if(QB)return QB(t,n).value}else return;return t[n]},$9e=function e(){var t,n,r,i,a,o,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)r=tz(l,n),i=tz(t,n),l!==i&&(d&&i&&(ZB(i)||(a=JB(i)))?(a?(a=!1,o=r&&JB(r)?r:[]):o=r&&ZB(r)?r:{},ez(l,{name:n,newValue:e(d,o,i)})):typeof i<"u"&&ez(l,{name:n,newValue:i}));return l};const p4=dr($9e);function mP(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function B9e(){const e=[],t={run:n,use:r};return t;function n(...i){let a=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...i);function l(c,...u){const d=e[++a];let f=-1;if(c){o(c);return}for(;++f<i.length;)(u[f]===null||u[f]===void 0)&&(u[f]=i[f]);i=u,d?z9e(d,l)(...u):o(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function z9e(e,t){let n;return r;function r(...o){const l=e.length>o.length;let c;l&&o.push(i);try{c=e.apply(this,o)}catch(u){const d=u;if(l&&n)throw d;return i(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(a,i):c instanceof Error?i(c):a(c))}function i(o,...l){n||(n=!0,t(o,...l))}function a(o){i(null,o)}}const Rc={basename:U9e,dirname:q9e,extname:V9e,join:H9e,sep:"/"};function U9e(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');cw(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(r=i):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function q9e(e){if(cw(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function V9e(e){cw(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function H9e(...e){let t=-1,n;for(;++t<e.length;)cw(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":W9e(n)}function W9e(e){cw(e);const t=e.codePointAt(0)===47;let n=G9e(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function G9e(e,t){let n="",r=0,i=-1,a=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),i=o,a=0;continue}}else if(n.length>0){n="",r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else l===46&&a>-1?a++:a=-1}return n}function cw(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const K9e={cwd:Y9e};function Y9e(){return"/"}function pP(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function X9e(e){if(typeof e=="string")e=new URL(e);else if(!pP(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Q9e(e)}function Q9e(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const g4=["history","path","basename","stem","extname","dirname"];class doe{constructor(t){let n;t?pP(t)?n={path:t}:typeof t=="string"||J9e(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":K9e.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<g4.length;){const a=g4[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let i;for(i in n)g4.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Rc.basename(this.path):void 0}set basename(t){y4(t,"basename"),x4(t,"basename"),this.path=Rc.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Rc.dirname(this.path):void 0}set dirname(t){nz(this.basename,"dirname"),this.path=Rc.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Rc.extname(this.path):void 0}set extname(t){if(x4(t,"extname"),nz(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Rc.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){pP(t)&&(t=X9e(t)),y4(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Rc.basename(this.path,this.extname):void 0}set stem(t){y4(t,"stem"),x4(t,"stem"),this.path=Rc.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Ea(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function x4(e,t){if(e&&e.includes(Rc.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Rc.sep+"`")}function y4(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function nz(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function J9e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Z9e=function(e){const r=this.constructor.prototype,i=r[e],a=function(){return i.apply(a,arguments)};return Object.setPrototypeOf(a,r),a},eBe={}.hasOwnProperty;class g6 extends Z9e{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=B9e()}copy(){const t=new g6;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(p4(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(w4("data",this.frozen),this.namespace[t]=n,this):eBe.call(this.namespace,t)&&this.namespace[t]||void 0:t?(w4("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=y_(t),r=this.parser||this.Parser;return v4("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),v4("process",this.parser||this.Parser),b4("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(a,o){const l=y_(t),c=r.parse(l);r.run(c,l,function(d,f,h){if(d||!f||!h)return u(d);const p=f,x=r.stringify(p,h);rBe(x)?h.value=x:h.result=x,u(d,h)});function u(d,f){d||!f?o(d):a?a(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),v4("processSync",this.parser||this.Parser),b4("processSync",this.compiler||this.Compiler),this.process(t,i),sz("processSync","process",n),r;function i(a,o){n=!0,YB(a),r=o}}run(t,n,r){rz(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(o,l){const c=y_(n);i.run(t,c,u);function u(d,f,h){const p=f||t;d?l(d):o?o(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,i;return this.run(t,n,a),sz("runSync","run",r),i;function a(o,l){YB(o),i=l,r=!0}}stringify(t,n){this.freeze();const r=y_(n),i=this.compiler||this.Compiler;return b4("stringify",i),rz(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(w4("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;c(d,f)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(i.settings=p4(!0,i.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];a(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===u){h=f;break}if(h===-1)r.push([u,...d]);else if(d.length>0){let[p,...x]=d;const y=r[h][1];mP(y)&&mP(p)&&(p=p4(!0,y,p)),r[h]=[u,p,...x]}}}}const tBe=new g6().freeze();function v4(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function b4(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function w4(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function rz(e){if(!mP(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function sz(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function y_(e){return nBe(e)?e:new doe(e)}function nBe(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function rBe(e){return typeof e=="string"||sBe(e)}function sBe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const iBe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",iz=[],az={allowDangerousHtml:!0},aBe=/^(https?|ircs?|mailto|xmpp)$/i,oBe=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function lBe(e){const t=cBe(e),n=uBe(e);return dBe(t.runSync(t.parse(n),n),e)}function cBe(e){const t=e.rehypePlugins||iz,n=e.remarkPlugins||iz,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...az}:az;return tBe().use(V7e).use(n).use(F9e,r).use(t)}function uBe(e){const t=e.children||"",n=new doe;return typeof t=="string"&&(n.value=t),n}function dBe(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||fBe;for(const d of oBe)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+iBe+d.id,void 0);return p6(e,u),EFe(e,{Fragment:s.Fragment,components:i,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return o?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;
vendor: 15,037 bytes, lines 1221-1234
1221if(d.type==="element"){let p;for(p in f4)if(Object.hasOwn(f4,p)&&Object.hasOwn(d.properties,p)){const x=d.properties[p],y=f4[p];(y===null||y.includes(d.tagName))&&(d.properties[p]=c(String(x||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):a?a.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,h)),p&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function fBe(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||aBe.test(e.slice(0,t))?e:""}function oz(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function hBe(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function mBe(e,t,n){const i=JC((n||{}).ignore||[]),a=pBe(t);let o=-1;for(;++o<a.length;)coe(e,"text",l);function l(u,d){let f=-1,h;for(;++f<d.length;){const p=d[f],x=h?h.children:void 0;if(i(p,x?x.indexOf(p):void 0,h))return;h=p}if(h)return c(u,d)}function c(u,d){const f=d[d.length-1],h=a[o][0],p=a[o][1];let x=0;const b=f.children.indexOf(u);let w=!1,_=[];h.lastIndex=0;let j=h.exec(u.value);for(;j;){const E=j.index,S={index:j.index,input:j.input,stack:[...d,u]};let T=p(...j,S);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?h.lastIndex=E+1:(x!==E&&_.push({type:"text",value:u.value.slice(x,E)}),Array.isArray(T)?_.push(...T):T&&_.push(T),x=E+j[0].length,w=!0),!h.global)break;j=h.exec(u.value)}return w?(x<u.value.length&&_.push({type:"text",value:u.value.slice(x)}),f.children.splice(b,1,..._)):_=[u],b+_.length}}function pBe(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([gBe(i[0]),xBe(i[1])])}return t}function gBe(e){return typeof e=="string"?new RegExp(hBe(e),"g"):e}function xBe(e){return typeof e=="function"?e:function(){return e}}const _4="phrasing",j4=["autolink","link","image","label"];function yBe(){return{transforms:[kBe],enter:{literalAutolink:bBe,literalAutolinkEmail:N4,literalAutolinkHttp:N4,literalAutolinkWww:N4},exit:{literalAutolink:NBe,literalAutolinkEmail:jBe,literalAutolinkHttp:wBe,literalAutolinkWww:_Be}}}function vBe(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:_4,notInConstruct:j4},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:_4,notInConstruct:j4},{character:":",before:"[ps]",after:"\\/",inConstruct:_4,notInConstruct:j4}]}}function bBe(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function N4(e){this.config.enter.autolinkProtocol.call(this,e)}function wBe(e){this.config.exit.autolinkProtocol.call(this,e)}function _Be(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function jBe(e){this.config.exit.autolinkEmail.call(this,e)}function NBe(e){this.exit(e)}function kBe(e){mBe(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,CBe],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),EBe]],{ignore:["link","linkReference"]})}function CBe(e,t,n,r,i){let a="";if(!foe(i)||(/^w/i.test(t)&&(n=t+n,t="",a="http://"),!SBe(n)))return!1;const o=ABe(n+r);if(!o[0])return!1;const l={type:"link",title:null,url:a+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function EBe(e,t,n,r){return!foe(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function SBe(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function ABe(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=oz(e,"(");let a=oz(e,")");for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),a++;return[e,n]}function foe(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||tp(n)||YC(n))&&(!t||n!==47)}hoe.peek=FBe;function TBe(){this.buffer()}function PBe(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function OBe(){this.buffer()}function DBe(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function IBe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=pc(this.sliceSerialize(e)).toLowerCase(),n.label=t}function RBe(e){this.exit(e)}function MBe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=pc(this.sliceSerialize(e)).toLowerCase(),n.label=t}function LBe(e){this.exit(e)}function FBe(){return"["}function hoe(e,t,n,r){const i=n.createTracker(r);let a=i.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return a+=i.move(n.safe(n.associationId(e),{after:"]",before:a})),l(),o(),a+=i.move("]"),a}function $Be(){return{enter:{gfmFootnoteCallString:TBe,gfmFootnoteCall:PBe,gfmFootnoteDefinitionLabelString:OBe,gfmFootnoteDefinition:DBe},exit:{gfmFootnoteCallString:IBe,gfmFootnoteCall:RBe,gfmFootnoteDefinitionLabelString:MBe,gfmFootnoteDefinition:LBe}}}function BBe(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:hoe},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,a,o){const l=a.createTracker(o);let c=l.move("[^");const u=a.enter("footnoteDefinition"),d=a.enter("label");return c+=l.move(a.safe(a.associationId(r),{before:c,after:"]"})),d(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?`
1222`:" ")+a.indentLines(a.containerFlow(r,l.current()),t?moe:zBe))),u(),c}}function zBe(e,t,n){return t===0?e:moe(e,t,n)}function moe(e,t,n){return(n?"":"    ")+e}const UBe=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];poe.peek=GBe;function qBe(){return{canContainEols:["delete"],enter:{strikethrough:HBe},exit:{strikethrough:WBe}}}function VBe(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:UBe}],handlers:{delete:poe}}}function HBe(e){this.enter({type:"delete",children:[]},e)}function WBe(e){this.exit(e)}function poe(e,t,n,r){const i=n.createTracker(r),a=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),a(),o}function GBe(){return"~"}function KBe(e){return e.length}function YBe(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||KBe,a=[],o=[],l=[],c=[];let u=0,d=-1;for(;++d<e.length;){const y=[],b=[];let w=-1;for(e[d].length>u&&(u=e[d].length);++w<e[d].length;){const _=XBe(e[d][w]);if(n.alignDelimiters!==!1){const j=i(_);b[w]=j,(c[w]===void 0||j>c[w])&&(c[w]=j)}y.push(_)}o[d]=y,l[d]=b}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)a[f]=lz(r[f]);else{const y=lz(r);for(;++f<u;)a[f]=y}f=-1;const h=[],p=[];for(;++f<u;){const y=a[f];let b="",w="";y===99?(b=":",w=":"):y===108?b=":":y===114&&(w=":");let _=n.alignDelimiters===!1?1:Math.max(1,c[f]-b.length-w.length);const j=b+"-".repeat(_)+w;n.alignDelimiters!==!1&&(_=b.length+_+w.length,_>c[f]&&(c[f]=_),p[f]=_),h[f]=j}o.splice(1,0,h),l.splice(1,0,p),d=-1;const x=[];for(;++d<o.length;){const y=o[d],b=l[d];f=-1;const w=[];for(;++f<u;){const _=y[f]||"";let j="",E="";if(n.alignDelimiters!==!1){const S=c[f]-(b[f]||0),T=a[f];T===114?j=" ".repeat(S):T===99?S%2?(j=" ".repeat(S/2+.5),E=" ".repeat(S/2-.5)):(j=" ".repeat(S/2),E=j):E=" ".repeat(S)}n.delimiterStart!==!1&&!f&&w.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&_==="")&&(n.delimiterStart!==!1||f)&&w.push(" "),n.alignDelimiters!==!1&&w.push(j),w.push(_),n.alignDelimiters!==!1&&w.push(E),n.padding!==!1&&w.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&w.push("|")}x.push(n.delimiterEnd===!1?w.join("").replace(/ +$/,""):w.join(""))}return x.join(`
1223`)}function XBe(e){return e==null?"":String(e)}function lz(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function QBe(e,t,n,r){const i=n.enter("blockquote"),a=n.createTracker(r);a.move("> "),a.shift(2);const o=n.indentLines(n.containerFlow(e,a.current()),JBe);return i(),o}function JBe(e,t,n){return">"+(n?"":" ")+e}function ZBe(e,t){return cz(e,t.inConstruct,!0)&&!cz(e,t.notInConstruct,!1)}function cz(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function uz(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
1224`&&ZBe(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
1225`}function eze(e,t){const n=String(e);let r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function tze(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function nze(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function rze(e,t,n,r){const i=nze(n),a=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(tze(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(a,sze);return f(),h}const l=n.createTracker(r),c=i.repeat(Math.max(eze(a,i)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const f=n.enter(`codeFencedLang${o}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${o}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:`
1226`,encode:["`"],...l.current()})),f()}return d+=l.move(`
1227`),a&&(d+=l.move(a+`
1228`)),d+=l.move(c),u(),d}function sze(e,t,n){return(n?"":"    ")+e}function x6(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function ize(e,t,n,r){const i=x6(n),a=i==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
1229`,...c.current()}))),l(),e.title&&(l=n.enter(`title${a}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),o(),u}function aze(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function P1(e){return"&#x"+e.toString(16).toUpperCase()+";"}function sN(e,t,n){const r=Bx(e),i=Bx(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}goe.peek=oze;function goe(e,t,n,r){const i=aze(n),a=n.enter("emphasis"),o=n.createTracker(r),l=o.move(i);let c=o.move(n.containerPhrasing(e,{after:i,before:l,...o.current()}));const u=c.charCodeAt(0),d=sN(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=P1(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=sN(r.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+P1(f));const p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function oze(e,t,n){return n.options.emphasis||"*"}function lze(e,t){let n=!1;return p6(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,fP}),!!((!e.depth||e.depth<3)&&l6(e)&&(t.options.setext||n))}function cze(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(lze(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...a.current(),before:`
1230`,after:`
1231`});return f(),d(),h+`
1232`+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
1233`))+1))}const o="#".repeat(i),l=n.enter("headingAtx"),c=n.enter("phrasing");a.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
1234`,...a.current()});return/^[\t ]/.test(u)&&(u=P1(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),l(),u}xoe.peek=uze;function xoe(e){return e.value||""}function uze(){return"<"}yoe.peek=dze;function yoe(e,t,n,r){const i=x6(n),a=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${a}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),u+=c.move(")"),o(),u}function dze(){return"!"}voe.peek=fze;function voe(e,t,n,r){const i=e.referenceType,a=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,a(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function fze(){return"!"}boe.peek=hze;function boe(e,t,n){let r=e.value||"",i="`",a=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){const o=n.unsafe[a],l=n.compilePattern(o);let c;if(o.atBreak)for(;c=l.exec(r);){let u=c.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(c.index+1)}}return i+r+i}function hze(){return"`"}function woe(e,t){const n=l6(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}_oe.peek=mze;function _oe(e,t,n,r){const i=x6(n),a=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let l,c;if(woe(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let f=o.move("<");return f+=o.move(n.containerPhrasing(e,{before:f,after:">",...o.current()})),f+=o.move(">
1234"),l(),n.stack=d,f}l=n.enter("link"),c=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(c=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),u+=o.move(" "+i),u+=o.move(n.safe(e.title,{before:u,after:i,...o.current()})),u+=o.move(i),c()),u+=o.move(")"),l(),u}function mze(e,t,n){return woe(e,n)?"<":"["}joe.peek=pze;function joe(e,t,n,r){const i=e.referenceType,a=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=d,a(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function pze(){return"["}function y6(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function gze(e){const t=y6(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function xze(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Noe(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function yze(e,t,n,r){const i=n.enter("list"),a=n.bulletCurrent;let o=e.ordered?xze(n):y6(n);const l=e.ordered?o==="."?")":".":gze(n);let c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),Noe(n)===o&&d){let f=-1;for(;++f<e.children.length;){const h=e.children[f];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=l),n.bulletCurrent=o;const u=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),u}function vze(e){const t=e.options.listItemIndent||"one";
vendor: 12,025 bytes, lines 1234-1236
1234if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function bze(e,t,n,r){const i=vze(n);let a=n.bulletCurrent||y6(n);t&&t.type==="list"&&t.ordered&&(a=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=n.createTracker(r);l.move(a+" ".repeat(o-a.length)),l.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return c(),u;function d(f,h,p){return h?(p?"":" ".repeat(o))+f:(p?a:a+" ".repeat(o-a.length))+f}}function wze(e,t,n,r){const i=n.enter("paragraph"),a=n.enter("phrasing"),o=n.containerPhrasing(e,r);return a(),i(),o}const _ze=JC(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function jze(e,t,n,r){return(e.children.some(function(o){return _ze(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Nze(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}koe.peek=kze;function koe(e,t,n,r){const i=Nze(n),a=n.enter("strong"),o=n.createTracker(r),l=o.move(i+i);let c=o.move(n.containerPhrasing(e,{after:i,before:l,...o.current()}));const u=c.charCodeAt(0),d=sN(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=P1(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=sN(r.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+P1(f));const p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function kze(e,t,n){return n.options.strong||"*"}function Cze(e,t,n,r){return n.safe(e.value,r)}function Eze(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Sze(e,t,n){const r=(Noe(n)+(n.options.ruleSpaces?" ":"")).repeat(Eze(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Coe={blockquote:QBe,break:uz,code:rze,definition:ize,emphasis:goe,hardBreak:uz,heading:cze,html:xoe,image:yoe,imageReference:voe,inlineCode:boe,link:_oe,linkReference:joe,list:yze,listItem:bze,paragraph:wze,root:jze,strong:koe,text:Cze,thematicBreak:Sze};function Aze(){return{enter:{table:Tze,tableData:dz,tableHeader:dz,tableRow:Oze},exit:{codeText:Dze,table:Pze,tableData:k4,tableHeader:k4,tableRow:k4}}}function Tze(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Pze(e){this.exit(e),this.data.inTable=void 0}function Oze(e){this.enter({type:"tableRow",children:[]},e)}function k4(e){this.exit(e)}function dz(e){this.enter({type:"tableCell",children:[]},e)}function Dze(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Ize));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Ize(e,t){return t==="|"?t:e}function Rze(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
1235`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:o,tableCell:c,tableRow:l}};function o(p,x,y,b){return u(d(p,y,b),p.align)}function l(p,x,y,b){const w=f(p,y,b),_=u([w]);return _.slice(0,_.indexOf(`
1236`))}function c(p,x,y,b){const w=y.enter("tableCell"),_=y.enter("phrasing"),j=y.containerPhrasing(p,{...b,before:a,after:a});return _(),w(),j}function u(p,x){return YBe(p,{align:x,alignDelimiters:r,padding:n,stringLength:i})}function d(p,x,y){const b=p.children;let w=-1;const _=[],j=x.enter("table");for(;++w<b.length;)_[w]=f(b[w],x,y);return j(),_}function f(p,x,y){const b=p.children;let w=-1;const _=[],j=x.enter("tableRow");for(;++w<b.length;)_[w]=c(b[w],p,x,y);return j(),_}function h(p,x,y){let b=Coe.inlineCode(p,x,y);return y.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function Mze(){return{exit:{taskListCheckValueChecked:fz,taskListCheckValueUnchecked:fz,paragraph:Fze}}}function Lze(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:$ze}}}function fz(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Fze(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let a=-1,o;for(;++a<i.length;){const l=i[a];if(l.type==="paragraph"){o=l;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function $ze(e,t,n,r){const i=e.children[0],a=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);a&&l.move(o);let c=Coe.listItem(e,t,n,{...r,...l.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+o}}function Bze(){return[yBe(),$Be(),qBe(),Aze(),Mze()]}function zze(e){return{extensions:[vBe(),BBe(e),VBe(),Rze(e),Lze()]}}const Uze={tokenize:Kze,partial:!0},Eoe={tokenize:Yze,partial:!0},Soe={tokenize:Xze,partial:!0},Aoe={tokenize:Qze,partial:!0},qze={tokenize:Jze,partial:!0},Toe={name:"wwwAutolink",tokenize:Wze,previous:Ooe},Poe={name:"protocolAutolink",tokenize:Gze,previous:Doe},Nd={name:"emailAutolink",tokenize:Hze,previous:Ioe},xu={};function Vze(){return{text:xu}}let Sh=48;for(;Sh<123;)xu[Sh]=Nd,Sh++,Sh===58?Sh=65:Sh===91&&(Sh=97);xu[43]=Nd;xu[45]=Nd;xu[46]=Nd;xu[95]=Nd;xu[72]=[Nd,Poe];xu[104]=[Nd,Poe];xu[87]=[Nd,Toe];xu[119]=[Nd,Toe];function Hze(e,t,n){const r=this;let i,a;return o;function o(f){return!gP(f)||!Ioe.call(r,r.previous)||v6(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(f))}function l(f){return gP(f)?(e.consume(f),l):f===64?(e.consume(f),c):n(f)}function c(f){return f===46?e.check(qze,d,u)(f):f===45||f===95||_a(f)?(a=!0,e.consume(f),c):d(f)}function u(f){return e.consume(f),i=!0,c}function d(f){return a&&i&&Ma(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function Wze(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!Ooe.call(r,r.previous)||v6(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Uze,e.attempt(Eoe,e.attempt(Soe,a),n),n)(o))}function a(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function Gze(e,t,n){const r=this;let i="",a=!1;return o;function o(f){return(f===72||f===104)&&Doe.call(r,r.previous)&&!v6(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(f),e.consume(f),l):n(f)}function l(f){if(Ma(f)&&i.length<5)return i+=String.fromCodePoint(f),e.consume(f),l;if(f===58){const h=i.toLowerCase();if(h==="http"||h==="https")return e.consume(f),c}return n(f)}function c(f){return f===47?(e.consume(f),a?u:(a=!0,c)):n(f)}function u(f){return f===null||tN(f)||Vr(f)||tp(f)||YC(f)?n(f):e.attempt(Eoe,e.attempt(Soe,d),n)(f)}function d(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function Kze(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),a):n(o)}function a(o){return o===null?n(o):t(o)}}function Yze(e,t,n){let r,i,a;return o;function o(u){return u===46||u===95?e.check(Aoe,c,l)(u):u===null||Vr(u)||tp(u)||u!==45&&YC(u)?c(u):(a=!0,e.consume(u),o)}function l(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),o}function c(u){return i||r||!a?n(u):t(u)}}function Xze(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Aoe,t,a)(o):o===null||Vr(o)||tp(o)?t(o):(e.consume(o),i)}function a(o){return o===41&&r++,e.consume(o),i}}function Qze(e,t,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),r):l===38?(e.consume(l),a):l===93?(e.consume(l),i):l===60||l===null||Vr(l)||tp(l)?t(l):n(l)}function i(l){return l===null||l===40||l===91||Vr(l)||tp(l)?t(l):r(l)}function a(l){return Ma(l)?o(l):n(l)}function o(l){return l===59?(e.consume(l),r):Ma(l)?(e.consume(l),o):n(l)}}function Jze(e,t,n){return r;function r(a){return e.consume(a),i}function i(a){return _a(a)?n(a):t(a)}}function Ooe(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Vr(e)}function Doe(e){return!Ma(e)}function Ioe(e){return!(e===47||gP(e))}function gP(e){return e===43||e===45||e===46||e===95||_a(e)}function v6(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Zze={tokenize:oUe,partial:!0};function eUe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:sUe,continuation:{tokenize:iUe},exit:aUe}},text:{91:{name:"gfmFootnoteCall",tokenize:rUe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:tUe,resolveTo:nUe}}}}function tUe(e,t,n){const r=this;let i=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!o||!o._balanced)return n(c);const u=pc(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!a.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function nUe(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function rUe(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,o;return l;function l(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(a>999||f===93&&!o||f===null||f===91||Vr(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(pc(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Vr(f)||(o=!0),a++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),a++,u):u(f)}
vendor: 6,565 bytes, line 1236
1236}function sUe(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,o=0,l;return c;function c(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(x)}function d(x){if(o>999||x===93&&!l||x===null||x===91||Vr(x))return n(x);if(x===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return a=pc(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Vr(x)||(l=!0),o++,e.consume(x),x===92?f:d}function f(x){return x===91||x===92||x===93?(e.consume(x),o++,d):d(x)}function h(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),i.includes(a)||i.push(a),Hn(e,p,"gfmFootnoteDefinitionWhitespace")):n(x)}function p(x){return t(x)}}function iUe(e,t,n){return e.check(lw,t,e.attempt(Zze,t,n))}function aUe(e){e.exit("gfmFootnoteDefinition")}function oUe(e,t,n){const r=this;return Hn(e,i,"gfmFootnoteDefinitionIndent",5);function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(a):n(a)}}function lUe(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,l){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let u=c;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[c][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[c][1].end)},f={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[c][1].start)},h=[["enter",d,l],["enter",o[u][1],l],["exit",o[u][1],l],["enter",f,l]],p=l.parser.constructs.insideSpan.null;p&&Ho(h,h.length,0,XC(p,o.slice(u+1,c),l)),Ho(h,h.length,0,[["exit",f,l],["enter",o[c][1],l],["exit",o[c][1],l],["exit",d,l]]),Ho(o,u-1,c-u+3,h),c=u+h.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function a(o,l,c){const u=this.previous,d=this.events;let f=0;return h;function h(x){return u===126&&d[d.length-1][1].type!=="characterEscape"?c(x):(o.enter("strikethroughSequenceTemporary"),p(x))}function p(x){const y=Bx(u);if(x===126)return f>1?c(x):(o.consume(x),f++,p);if(f<2&&!n)return c(x);const b=o.exit("strikethroughSequenceTemporary"),w=Bx(x);return b._open=!w||w===2&&!!y,b._close=!y||y===2&&!!w,l(x)}}}class cUe{constructor(){this.map=[]}add(t,n,r){uUe(this,t,n,r)}consume(t){if(this.map.sort(function(a,o){return a[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const a of i)t.push(a);i=r.pop()}this.map.length=0}}function uUe(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function dUe(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const a=r.length-1;r[a]=r[a]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function fUe(){return{flow:{null:{name:"table",tokenize:hUe,resolveAll:mUe}}}}function hUe(e,t,n){const r=this;let i=0,a=0,o;return l;function l(R){let L=r.events.length-1;for(;L>-1;){const U=r.events[L][1].type;if(U==="lineEnding"||U==="linePrefix")L--;else break}const M=L>-1?r.events[L][1].type:null,B=M==="tableHead"||M==="tableRow"?T:c;return B===T&&r.parser.lazy[r.now().line]?n(R):B(R)}function c(R){return e.enter("tableHead"),e.enter("tableRow"),u(R)}function u(R){return R===124||(o=!0,a+=1),d(R)}function d(R){return R===null?n(R):Ht(R)?a>1?(a=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),p):n(R):On(R)?Hn(e,d,"whitespace")(R):(a+=1,o&&(o=!1,i+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),f(R)))}function f(R){return R===null||R===124||Vr(R)?(e.exit("data"),d(R)):(e.consume(R),R===92?h:f)}function h(R){return R===92||R===124?(e.consume(R),f):f(R)}function p(R){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(R):(e.enter("tableDelimiterRow"),o=!1,On(R)?Hn(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):x(R))}function x(R){return R===45||R===58?b(R):R===124?(o=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),y):S(R)}function y(R){return On(R)?Hn(e,b,"whitespace")(R):b(R)}function b(R){return R===58?(a+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),w):R===45?(a+=1,w(R)):R===null||Ht(R)?E(R):S(R)}function w(R){return R===45?(e.enter("tableDelimiterFiller"),_(R)):S(R)}function _(R){return R===45?(e.consume(R),_):R===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),j):(e.exit("tableDelimiterFiller"),j(R))}function j(R){return On(R)?Hn(e,E,"whitespace")(R):E(R)}function E(R){return R===124?x(R):R===null||Ht(R)?!o||i!==a?S(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(R)):S(R)}function S(R){return n(R)}function T(R){return e.enter("tableRow"),P(R)}function P(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),P):R===null||Ht(R)?(e.exit("tableRow"),t(R)):On(R)?Hn(e,P,"whitespace")(R):(e.enter("data"),O(R))}function O(R){return R===null||R===124||Vr(R)?(e.exit("data"),P(R)):(e.consume(R),R===92?D:O)}function D(R){return R===92||R===124?(e.consume(R),O):O(R)}}function mUe(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],l=!1,
vendor: 5,140 bytes, line 1236
1236c=0,u,d,f;const h=new cUe;for(;++n<e.length;){const p=e[n],x=p[1];p[0]==="enter"?x.type==="tableHead"?(l=!1,c!==0&&(hz(h,t,c,u,d),d=void 0,c=0),u={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},h.add(n,0,[["enter",u,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,f=void 0,a=[0,0,0,0],o=[0,n+1,0,0],l&&(l=!1,d={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},h.add(n,0,[["enter",d,t]])),i=x.type==="tableDelimiterRow"?2:d?3:1):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],f=v_(h,t,a,i,void 0,f),a=[0,0,0,0]),o[2]=n)):x.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],f=v_(h,t,a,i,void 0,f)),a=o,o=[a[1],n,0,0])):x.type==="tableHead"?(l=!0,c=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(c=n,a[1]!==0?(o[0]=o[1],f=v_(h,t,a,i,n,f)):o[1]!==0&&(f=v_(h,t,o,i,n,f)),i=0):i&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&hz(h,t,c,u,d),h.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=dUe(t.events,n))}return e}function v_(e,t,n,r,i,a){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(a.end=Object.assign({},ig(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));const c=ig(t.events,n[1]);if(a={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",a,t]]),n[2]!==0){const u=ig(t.events,n[2]),d=ig(t.events,n[3]),f={type:l,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",f,t]]),r!==2){const h=t.events[n[2]],p=t.events[n[3]];if(h[1].end=Object.assign({},p[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,y=n[3]-n[2]-1;e.add(x,y,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return i!==void 0&&(a.end=Object.assign({},ig(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function hz(e,t,n,r,i){const a=[],o=ig(t.events,n);i&&(i.end=Object.assign({},o),a.push(["exit",i,t])),r.end=Object.assign({},o),a.push(["exit",r,t]),e.add(n+1,0,a)}function ig(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const pUe={name:"tasklistCheck",tokenize:xUe};function gUe(){return{text:{91:pUe}}}function xUe(e,t,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),a)}function a(c){return Vr(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return Ht(c)?t(c):On(c)?e.check({tokenize:yUe},t,n)(c):n(c)}}function yUe(e,t,n){return Hn(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function vUe(e){return qae([Vze(),eUe(),lUe(e),fUe(),gUe()])}const bUe={};function wUe(e){const t=this,n=e||bUe,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(vUe(n)),a.push(Bze()),o.push(zze(n))}const _Ue={p:({children:e})=>s.jsx("p",{className:"text-[#0D0D0D]/80 text-lg md:text-xl font-light leading-relaxed mb-4 last:mb-0",children:e}),strong:({children:e})=>s.jsx("strong",{className:"font-bold text-[#0D0D0D]",children:e}),em:({children:e})=>s.jsx("em",{className:"italic",children:e}),ul:({children:e})=>s.jsx("ul",{className:"list-disc pl-6 space-y-1 mb-4 text-[#0D0D0D]/80 text-lg md:text-xl font-light leading-relaxed",children:e}),ol:({children:e})=>s.jsx("ol",{className:"list-decimal pl-6 space-y-1 mb-4 text-[#0D0D0D]/80 text-lg md:text-xl font-light leading-relaxed",children:e}),li:({children:e})=>s.jsx("li",{children:e}),a:({href:e,children:t})=>s.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 text-[#0D0D0D] hover:no-underline",children:t}),h1:({children:e})=>s.jsx("h3",{className:"font-bold text-[#0D0D0D] text-xl md:text-2xl mt-6 mb-3",children:e}),h2:({children:e})=>s.jsx("h3",{className:"font-bold text-[#0D0D0D] text-xl md:text-2xl mt-6 mb-3",children:e}),h3:({children:e})=>s.jsx("h3",{className:"font-bold text-[#0D0D0D] text-lg md:text-xl mt-4 mb-2",children:e})};function jUe(e,t){if(e.length<=t)return e;const n=e.slice(0,t),r=n.lastIndexOf(" ");return(r>t*.6?n.slice(0,r):n).trimEnd()+"…"}function NUe({text:e,limit:t=600}){const[n,r]=N.useState(!1),i=e.length>t,a=!i||n?e:jUe(e,t);return s.jsxs("div",{children:[s.jsx("div",{className:"text-[#0D0D0D]/80",children:s.jsx(lBe,{remarkPlugins:[wUe],components:_Ue,children:a})}),i&&s.jsx("button",{type:"button",onClick:()=>r(o=>!o),className:"mt-4 text-sm font-medium text-[#0D0D0D] underline underline-offset-4 hover:no-underline",children:n?"Lire moins":"Lire plus"})]})}function mz(e){return e.split(" ").map(t=>
1236t[0]).filter(Boolean).join("").slice(0,2).toUpperCase()}function kUe(){const{id:e}=Wi(),t=Rr(),{user:n}=Tt(),{toast:r}=_r(),{data:i,isLoading:a}=nh(e),{data:o=0}=zSe(e),{data:l=0}=VSe(e),{data:c,isLoading:u}=jte(e),{data:d}=Q3e(e),[f,h]=N.useState(!1),{data:p}=QM(e),{data:x}=$R(e);Ite(e),TLe((i==null?void 0:i.venue)??null),N.useEffect(()=>{if(!(i!=null&&i.id))return;let q=!1;return ka(async()=>{const{trackMetaEvent:oe}=await Promise.resolve().then(()=>uh);return{trackMetaEvent:oe}},void 0).then(({trackMetaEvent:oe})=>{q||oe("ViewContent",{userData:n!=null&&n.email?{email:n.email,external_id:n.id}:{},customData:{content_ids:[i.id],content_type:"event",content_name:i.title,currency:"EUR",value:i.price_cents?i.price_cents/100:void 0}})}),()=>{q=!0}},[i==null?void 0:i.id,i==null?void 0:i.title,n==null?void 0:n.id,n==null?void 0:n.email]);const y=async()=>{try{await navigator.clipboard.writeText(window.location.href),r({title:"Lien copié !",description:"Partagez-le avec vos amis."})}catch{r({title:"Erreur",description:"Impossible de copier le lien.",variant:"destructive"})}},b=async()=>{const q=window.location.href,oe={title:i!=null&&i.title?`${i.title} — Chess Agenda`:"Chess Agenda",text:i?`Tournoi d'échecs${P!=null&&P.name?` @ ${P.name}`:""}${i.event_date?` — ${Ze(new Date(i.event_date),"EEEE d MMMM 'à' HH'h'mm",{locale:pt})}`:""}. Tu viens ?`:"Rejoins-moi sur ce tournoi.",url:q};if(typeof navigator<"u"&&typeof navigator.share=="function")try{await navigator.share(oe);return}catch(J){if((J==null?void 0:J.name)==="AbortError")return}await y()};if(a)return s.jsxs("div",{className:"min-h-screen bg-[#F5F3EE]",children:[s.jsx(tr,{}),s.jsxs("div",{className:"pt-20",children:[s.jsx(Ie,{className:"w-full h-[70vh]"}),s.jsxs("div",{className:"max-w-7xl mx-auto px-6 py-16 grid md:grid-cols-12 gap-16",children:[s.jsxs("div",{className:"md:col-span-8 space-y-12",children:[s.jsx(Ie,{className:"h-32"}),s.jsx(Ie,{className:"h-48"})]}),s.jsx(Ie,{className:"md:col-span-4 h-96"})]})]})]});if(!i)return s.jsxs("div",{className:"min-h-screen bg-[#F5F3EE]",children:[s.jsx(tr,{}),s.jsxs("div",{className:"pt-24 pb-12 max-w-4xl mx-auto px-4 text-center",children:[s.jsx("h1",{className:"font-display text-2xl font-bold mb-4",children:"Événement introuvable"}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Cet événement n'existe pas ou n'est plus disponible."}),s.jsx(Pe,{to:"/events",children:s.jsx(Q,{children:"Voir tous les tournois"})})]})]});const w=i.capacity-o,_=w<=0,j=w<=3&&w>0,E=(p==null?void 0:p.canRegister)??!1,S=p==null?void 0:p.reason,T=()=>t(`/events/${e}/register`),P=i.venue,O=new Date(i.event_date),D=i.cover_image_url||(P==null?void 0:P.cover_image_url)||(P==null?void 0:P.image_url),R=(P==null?void 0:P.brand_color)||"#F5D3DC",L=od(i),M=L.mode==="paper",B=P?wR(P.city||"",P.postal_code,P.country,P.address):null,U=Ze(O,"MMMM",{locale:pt}),F=Ze(O,"d",{locale:pt}),H=Ze(O,"HH'h'mm",{locale:pt}),z=_?"Complet":j?`${w} place${w>1?"s":""}`:"Ouvertes",K=`${i.rounds_count} rondes`,W=i.time_control||"5+2";return s.jsxs("div",{className:"min-h-screen bg-[#F5F3EE] text-[#0D0D0D]",children:[s.jsx(tr,{}),s.jsxs("main",{children:[s.jsxs("header",{className:"relative w-full h-[70vh] md:h-[85vh] overflow-hidden",children:[s.jsx("div",{className:"absolute inset-0 z-0",style:{backgroundColor:R},children:D?s.jsx("div",{className:"absolute inset-0 bg-cover bg-center animate-[slowZoom_16s_ease-out_infinite_alternate]",style:{backgroundImage:`url(${D})`,filter:"contrast(1.05)"}}):s.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:s.jsx("span",{className:"text-[20vw] font-black opacity-[0.08]",style:{fontFamily:"'Bricolage Grotesque', sans-serif"},children:mz((P==null?void 0:P.name)||i.title)})})}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-[#0D0D0D] via-[#0D0D0D]/30 to-[#0D0D0D]/10"}),s.jsxs("div",{className:"absolute top-24 left-0 right-0 z-20 px-6 md:px-16 flex items-center justify-between",children:[s.jsxs(Pe,{to:"/events",className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 backdrop-blur-xl border border-white/20 text-white text-sm font-medium hover:bg-white/20 transition-colors",children:[s.jsx(Fn,{className:"w-4 h-4"}),"Tournois"]}),s.jsxs("button",{onClick:b,className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 backdrop-blur-xl border border-white/20 text-white text-sm font-medium hover:bg-white/20 transition-colors",children:[s.jsx(Cm,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Partager"})]})]}),s.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 px-6 md:px-16 pb-12 md:pb-16",children:s.jsxs("div",{className:"max-w-7xl mx-auto",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-6",children:[_?s.jsx("span",{className:"uppercase tracking-widest text-[10px] bg-[#0D0D0D] text-white px-3 py-1.5 font-bold",style:{fontFamily:"'Fragment Mono', monospace"},children:"Complet"}):j?s.jsx("span",{className:"uppercase tracking-widest text-[10px] bg-[#AAFF00] text-[#0D0D0D] px-3 py-1.5 font-bold",style:{fontFamily:"'Fragment Mono', monospace"},children:"Dernières places"}):null,(()=>{const q=SLe(P==null?void 0:P.nearest_stations),oe=(P==null?void 0:P.metro_line)??(q==null?void 0:q.line)??null,J=(P==null?void 0:P.metro_station)??(q==null?void 0:q.station)??null;return s.jsx(dLe,{line:oe,station:J,theme:"dark"})})(),B&&s.jsx("span",{className:"uppercase tracking-widest text-[10px] text-white/70 px-3 py-1.5 font-bold border border-white/20 rounded-full",style:{fontFamily:"'Fragment Mono', monospace"},children:B})]}),s.jsx("h1",{className:"text-white italic leading-[0.9] tracking-tight text-5xl sm:text-7xl md:text-[7rem] lg:text-[8.25rem] mb-6 max-w-6xl",style:{fontFamily:"'Fraunces', 'Playfair Display', serif",fontWeight:600,fontVariationSettings:"'opsz' 144, 'SOFT' 30"},children:i.title}),s.jsxs("div",{className:"flex flex-wrap items-center gap-4 md:gap-6",children:[s.jsx("p",{className:"uppercase tracking-[0.2em] text-[#AAFF00] text-xs md:text-sm font-bold",style:{fontFamily:"'Fragment Mono', monospace"},children:(()=>{const q=Ze(O,"EEEE d MMMM yyyy",{locale:pt});return q.charAt(0).toUpperCase()+q.slice(1)})()}),s.jsx("span",{className:"h-px w-8 md:w-12 bg-white/30"}),s.jsx("p",{className:"uppercase tracking-[0.2em] text-white text-xs md:text-sm",style:{fontFamily:"'Fragment Mono', monospace"},children:(P==null?void 0:P.name)||"Paris"}),l>=10&&o<i.capacity&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"h-px w-8 md:w-12 bg-white/30"}),s.jsxs("span",{className:"inline-flex items-center gap-2 uppercase tracking-[0.15em] text-xs md:text-sm px-3 py-1.5 font-bold rounded-full bg-[#AAFF00] text-[#0D0D0D] shadow-[0_4px_20px_rgba(170,255,0,0.35)]",style:{fontFamily:"'Fragment Mono', monospace"},children:[s.jsxs("span",{className:"relative flex w-2 h-2",children:[s.jsx("span",{className:"absolute inset-0 rounded-full bg-[#0D0D0D] opacity-60 animate-ping"}),s.jsx("span",{className:"relative rounded-full w-2 h-2 bg-[#0D0D0D]"})]}),l," intéressés"]})]})]})]})}),s.jsx("style",{children:`
1237            @keyframes slowZoom {
1238              from { transform: scale(1); }
1239              to   { transform: scale(1.06); }
1240            }
1241          `})]}),s.jsx("div",{className:"max-w-7xl mx-auto px-6 py-16 md:py-24",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-12 md:gap-16",children:[s.jsxs("div",{className:"md:col-span-7 lg:col-span-8 space-y-16 md:space-y-20",children:[s.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-px bg-[#0D0D0D]/8 border border-[#0D0D0D]/8 rounded-3xl overflow-hidden",children:[{label:"Date",value:`${F} ${U.slice(0,4)}.`,tone:"sky"},{label:"Heure",value:H,tone:"peach"},{label:"Places",value:z,highlight:j&&!_,tone:"mint"},{label:"Format",value:`${K}`,sub:W,tone:"lilac"}].map(q=>s.jsxs("div",{className:`pastel-halo-${q.tone} p-6 md:p-8`,children:[s.jsx("p",{className:"text-[10px] uppercase tracking-widest mb-3 font-semibold",style:{fontFamily:"'Fragment Mono', monospace",color:`hsl(var(--pastel-${q.tone}-ink))`},children:q.label}),s.jsx("p",{className:"text-xl md:text-2xl tracking-tighter font-black text-[#0D0D0D]",style:{fontFamily:"'Bricolage Grotesque', sans-serif"},children:q.value}),q.sub&&s.jsx("p",{className:"text-[10px] uppercase tracking-widest mt-1 font-medium",style:{fontFamily:"'Fragment Mono', monospace",color:`hsl(var(--pastel-${q.tone}-ink) / 0.75)`},children:q.sub}),q.highlight&&s.jsx("span",{className:"inline-block mt-2 h-1.5 w-8 rounded-full bg-[#AAFF00]"})]},q.label))}),c?s.jsx(Pe,{to:`/events/${e}/ticket`,className:"block",children:s.jsxs(Q,{variant:"outline",className:"w-full gap-2 rounded-xl border-2 border-[#0D0D0D] py-3 text-sm font-bold",children:[s.jsx(vo,{className:"w-4 h-4"}),"Voir mon ticket"]})}):S==="pairings_started"||(x==null?void 0:x.status)==="notified"||_&&!x||x?null:d?s.jsxs(Q,{className:"w-full rounded-xl py-3 text-sm font-bold bg-[#0D0D0D] hover:bg-[#0D0D0D]/90 text-white shadow-lg shadow-black/10",onClick:T,disabled:!E,children:["Confirmer et payer — ",(i.price_cents/100).toFixed(0),"€"]}):s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[s.jsx(Q,{className:"w-full rounded-xl py-3 text-sm font-bold bg-[#0D0D0D] hover:bg-[#0D0D0D]/90 text-white shadow-lg shadow-black/10",onClick:T,disabled:!E||u,children:S==="closed"?"Inscriptions fermées":S==="ongoing_no_pairings"?`S'inscrire — ${(i.price_cents/100).toFixed(0)}€`:`🙋 Je viens — ${(i.price_cents/100).toFixed(0)}€`}),E&&S!=="closed"&&s.jsx(Q,{variant:"outline",className:"w-full whitespace-nowrap rounded-xl border-2 border-[#0D0D0D] py-3 text-sm font-bold hover:bg-[#0D0D0D] hover:text-white transition-colors",onClick:()=>h(!0),children:"🤔 Garder ma place"})]}),i.description&&s.jsxs("section",{children:[s.jsx("h2",{className:"text-3xl md:text-4xl mb-6 md:mb-8 up
1241percase tracking-tighter font-black",style:{fontFamily:"'Bricolage Grotesque', sans-serif"},children:"À propos"}),s.jsx(NUe,{text:i.description,limit:600})]}),i.rules&&s.jsxs("section",{children:[s.jsx("h2",{className:"text-3xl md:text-4xl mb-6 md:mb-8 uppercase tracking-tighter font-black",style:{fontFamily:"'Bricolage Grotesque', sans-serif"},children:"Règles"}),s.jsx("p",{className:"text-[#0D0D0D]/80 whitespace-pre-wrap text-lg font-light leading-relaxed",children:i.rules})]}),P&&s.jsxs("section",{children:[s.jsx("h2",{className:"text-3xl md:text-4xl mb-6 md:mb-8 uppercase tracking-tighter font-black",style:{fontFamily:"'Bricolage Grotesque', sans-serif"},children:"Le lieu"}),s.jsxs(Pe,{to:`/venues/${P.slug||P.id}`,"aria-label":`Voir la page du lieu ${P.name}`,className:"group block relative rounded-[32px] md:rounded-[40px] overflow-hidden aspect-video focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#AAFF00] focus-visible:ring-offset-2 focus-visible:ring-offset-[#F5F3EE]",style:{backgroundColor:R},children:[P.cover_image_url||P.image_url?s.jsx("div",{className:"absolute inset-0 bg-cover bg-center transition-transform duration-[1200ms] group-hover:scale-110",style:{backgroundImage:`url(${P.cover_image_url||P.image_url})`}}):s.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:s.jsx("span",{className:"text-[15vw] font-black opacity-20",style:{fontFamily:"'Bricolage Grotesque', sans-serif"},children:mz(P.name)})}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-black/10 to-transparent"}),s.jsxs("div",{className:"absolute bottom-6 md:bottom-10 left-6 md:left-10 right-6 md:right-20",children:[s.jsx("p",{className:"text-2xl md:text-3xl text-white mb-2 tracking-tighter font-black",style:{fontFamily:"'Bricolage Grotesque', sans-serif"},children:P.name}),s.jsx("p",{className:"text-white/80 text-[11px] md:text-xs uppercase tracking-widest",style:{fontFamily:"'Fragment Mono', monospace"},children:s.jsx(lLe,{venue:P,cityClassName:"font-bold text-white"})})]}),s.jsx("div",{className:"absolute top-6 md:top-10 right-6 md:right-10",children:s.jsx("div",{className:"bg-[#AAFF00] text-[#0D0D0D] w-12 h-12 md:w-14 md:h-14 rounded-full flex items-center justify-center shadow-xl transition-transform duration-500 group-hover:rotate-45",children:s.jsx($ge,{className:"w-5 h-5 md:w-6 md:h-6",strokeWidth:2.5})})})]}),s.jsx(Sae,{venue:P,className:"mt-4"}),(()=>{const q=P,oe=Array.isArray(q.nearest_stations)?q.nearest_stations:[],J=Array.isArray(q.themes)?q.themes:[],Y=Array.isArray(q.ambiance)?q.ambiance:[],Z=Array.isArray(q.photo_gallery)?q.photo_gallery:[],G=q.description??null,se=q.opening_hours_summary??null;return!oe.length&&!J.length&&!Y.length&&!Z.length&&!G&&!se?null:s.jsxs("div",{className:"mt-6 space-y-6",children:[G&&s.jsx("p",{className:"text-[15px] md:text-base leading-relaxed text-[#0D0D0D]/80",style:{fontFamily:"'Space Grotesk', sans-serif"},children:G}),(J.length>0||Y.length>0)&&s.jsxs("div",{className:"flex flex-wrap gap-2",children:[J.map(ce=>s.jsx("span",{className:"px-3 py-1 rounded-full bg-[#0D0D0D] text-[#F5F3EE] text-xs uppercase tracking-wider",style:{fontFamily:"'Fragment Mono', monospace"},children:ce},`t-${ce}`)),Y.map(ce=>s.jsx("span",{className:"px-3 py-1 rounded-full border border-[#0D0D0D]/20 text-[#0D0D0D] text-xs uppercase tracking-wider",style:{fontFamily:"'Fragment Mono', monospace"},children:ce},`a-${ce}`))]}),oe.length>0&&s.jsxs("div",{children:[s.jsx("h3",{className:"text-xs uppercase tracking-[0.2em] opacity-60 mb-3",style:{fontFamily:"'Fragment Mono', monospace"},children:"Accès en transport"}),s.jsx("ul",{className:"space-y-1.5",children:oe.slice(0,5).map((ce,le)=>s.jsxs("li",{className:"flex items-baseline justify-between text-[15px]",style:{fontFamily:"'Space Grotesk', sans-serif"},children:[s.jsx("span",{className:"font-medium",children:ce.name}),s.jsxs("span",{className:"text-[#0D0D0D]/60 text-sm",children:[ce.distance_m," m · ~",ce.walk_min," min"]})]},le))})]}),se&&s.jsxs("div",{children:[s.jsx("h3",{className:"text-xs uppercase tracking-[0.2em] opacity-60 mb-2",style:{fontFamily:"'Fragment Mono', monospace"},children:"Horaires"}),s.jsx("p",{className:"text-[15px]",style:{fontFamily:"'Space Grotesk', sans-serif"},children:se})]}),Z.length>0&&s.jsx("div",{className:"grid grid-cols-3 gap-2",children:Z.slice(0,6).map((ce,le)=>s.jsx("div",{className:"aspect-square rounded-2xl bg-cover bg-center",style:{backgroundImage:`url(${ce.url})`},"aria-label":ce.credit?`Photo © ${ce.credit}`:"Photo du lieu"},le))})]})})()]}),s.jsx("section",{children:s.jsxs("div",{className:"pastel-halo-lilac rounded-3xl p-8 md:p-10 border border-[#0D0D0D]/5",children:[s.jsx("p",{className:"text-[10px] uppercase tracking-widest mb-2 font-semibold",style:{fontFamily:"'Fragment Mono', monospace",color:"hsl(var(--pastel-lilac-ink))"},children:"Partage"}),s.jsx("h2",{className:"text-2xl md:text-3xl tracking-tighter font-black text-[#0D0D0D] mb-2",style:{fontFamily:"'Bricolage Grotesque', sans-serif"},children:"Invite un ami"}),s.jsx("p",{className:"text-sm md:text-base text-[#0D0D0D]/70 mb-6 max-w-md",children:"Les meilleurs tournois se jouent entre potes. Envoie-leur le lien, on garde deux chaises côte à côte."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[s.jsxs(Q,{onClick:b,size:"lg",className:"rounded-2xl bg-[#0D0D0D] hover:bg-[#0D0D0D]/90 text-white gap-2 font-bold",children:[s.jsx(Cm,{className:"w-4 h-4"}),"Partager le tournoi"]}),s.jsxs(Q,{onClick:y,size:"lg",variant:"outline",className:"rounded-2xl border-2 border-[#0D0D0D]/20 hover:border-[#0D0D0D] bg-transparent gap-2 font-bold",children:[s.jsx(i2,{className:"w-4 h-4"}),"Copier le lien"]})]})]})})]}),s.jsxs("aside",{className:"md:col-span-5 lg:col-span-4",children:[s.jsxs("div",{className:"sticky top-24 bg-white rounded-[32px] md:rounded-[40px] p-8 md:p-10 shadow-[0_32px_64px_-12px_rgba(0,0,0,0.08)] border border-[#0D0D0D]/5",children:[s.jsxs("div",{className:"flex justify-between items-start mb-8 md:mb-10",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] uppercase tracking-[0.2em] opacity-40 mb-2",style:{fontFamily:"'Fragment Mono', monospace"},children:"Inscription"}),s.jsx("h3",{className:"text-5xl md:text-6xl tracking-tighter font-black leading-none",style:{fontFamily:"'Bricolage Grotesque', sans-serif"},children:i.price_cents===0?"Gratuit":`${(i.price_cents/100).toFixed(0)}€`}),!M&&i.credit_amount_cents>0&&s.jsxs("p",{className:"text-xs text-[#0D0D0D]/60 mt-2",children:["dont ",(i.credit_amount_cents/100).toFixed(0),"€ crédit conso"]})]}),L.hasPerk&&s.jsx("div",{className:"px-3 py-1.5 rounded-full",style:{background:"hsl(var(--pastel-mint) / 0.55)"},children:s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"hsl(var(--pastel-mint-ink))"},children:L.shortLabel})})]}),s.jsxs("div",{className:"space-y-4 mb-10",children:[["Participation au tournoi",...L.hasPerk?[L.longDescription]:[],"Classement et statistiques","Ambiance conviviale"].map((q,oe)=>s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"mt-1 w-5 h-5 rounded-full bg-[#AAFF00] flex items-center justify-center flex-shrink-0",children:s.jsx("svg",{className:"w-3 h-3 text-[#0D0D0D]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"M5 13l4 4L19 7"})})}),s.jsx("span",{className:"text-sm leading-snug text-[#0D0D0D]/70",children:q})]},oe)),M&&L.bullets.length>0&&s.jsxs("div",{className:"pt-3 space-y-1.5",children:[s.jsx("p",{className:"text-[10px] uppercase tracking-widest text-[#0D0D0D]/40",style:{fontFamily:"'Fragment Mono', monospace"},children:L.bullets.length>1?"Au choix sur place":"Détail"}),L.bullets.map((q,oe)=>s.jsxs("div",{className:"rounded-xl border border-[#0D0D0D]/10 bg-[#F5F3EE]/50 px-3 py-2 text-sm",children:[s.jsx("p",{className:"font-medium",children:q.name}
1241),q.description&&s.jsx("p",{className:"text-xs text-[#0D0D0D]/60 mt-0.5",children:q.description})]},oe))]})]}),c?s.jsx(Pe,{to:`/events/${e}/ticket`,children:s.jsxs(Q,{size:"lg",variant:"outline",className:"w-full gap-2 rounded-2xl border-2 border-[#0D0D0D] py-6 text-base font-bold",children:[s.jsx(vo,{className:"w-4 h-4"}),"Voir mon ticket"]})}):S==="pairings_started"?s.jsx(aLe,{venueName:(P==null?void 0:P.name)||"le lieu",venueId:P==null?void 0:P.id}):(x==null?void 0:x.status)==="notified"?s.jsx(iLe,{eventId:i.id,eventTitle:i.title,priceCents:i.price_cents,creditCents:i.credit_amount_cents}):_&&!x?s.jsxs("div",{className:"space-y-3",children:[s.jsx(Q,{size:"lg",className:"w-full rounded-2xl py-6 text-base font-bold",disabled:!0,variant:"secondary",children:"Complet"}),n&&s.jsx(pB,{eventId:i.id}),!n&&s.jsxs("p",{className:"text-center text-sm text-[#0D0D0D]/60",children:[s.jsx(Pe,{to:`/auth?redirect=/events/${e}`,className:"underline underline-offset-4",children:"Créez un compte"})," ","pour rejoindre la liste d'attente"]})]}):x?s.jsx(pB,{eventId:i.id}):d?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"rounded-2xl border-2 border-[#AAFF00] bg-[#AAFF00]/10 p-4 text-center",children:[s.jsx("p",{className:"text-[10px] uppercase tracking-widest text-[#0D0D0D]/60 mb-1",style:{fontFamily:"'Fragment Mono', monospace"},children:"🤔 Place réservée"}),s.jsx("p",{className:"text-sm text-[#0D0D0D]/80",children:"On te garde une place. Confirme quand tu es sûr(e)."})]}),s.jsxs(Q,{size:"lg",className:"w-full rounded-2xl py-6 text-base font-bold bg-[#0D0D0D] hover:bg-[#0D0D0D]/90 text-white shadow-xl shadow-black/10",onClick:T,disabled:!E,children:["Confirmer et payer — ",(i.price_cents/100).toFixed(0),"€"]})]}):s.jsxs("div",{className:"space-y-3",children:[s.jsx(Q,{size:"lg",className:"w-full rounded-2xl py-6 text-base font-bold bg-[#0D0D0D] hover:bg-[#0D0D0D]/90 text-white shadow-xl shadow-black/10",onClick:T,disabled:!E||u,children:S==="closed"?"Inscriptions fermées":S==="ongoing_no_pairings"?"S'inscrire (dernière minute)":"🙋 Je viens"}),E&&S!=="closed"&&s.jsx(Q,{size:"lg",variant:"outline",className:"w-full whitespace-nowrap rounded-2xl border-2 border-[#0D0D0D] py-6 text-base font-bold hover:bg-[#0D0D0D] hover:text-white transition-colors",onClick:()=>h(!0),children:"🤔 Garder ma place"})]}),s.jsxs("div",{className:"mt-8 pt-6 border-t border-[#0D0D0D]/5 text-center space-y-4",children:[s.jsxs("p",{className:"text-[10px] text-[#0D0D0D]/40 uppercase tracking-widest leading-loose",style:{fontFamily:"'Fragment Mono', monospace"},children:["Aucun engagement · Rappel par email",s.jsx("br",{}),"avant le tournoi"]}),!c&&s.jsx(Pe,{to:`/events/${i.id}/access`,className:"inline-block text-[11px] font-bold text-[#0D0D0D]/50 hover:text-[#0D0D0D] underline underline-offset-4 uppercase tracking-widest transition-colors",children:"Déjà un billet ? Accéder avec votre code"}),s.jsxs("button",{type:"button",onClick:b,className:"mx-auto flex items-center gap-1.5 text-[11px] font-bold text-[#0D0D0D]/50 hover:text-[#0D0D0D] underline underline-offset-4 uppercase tracking-widest transition-colors",children:[s.jsx(Cm,{className:"w-3 h-3"}),"Partager ce tournoi"]})]})]}),s.jsx("div",{className:"mt-6 text-center",children:s.jsxs(Pe,{to:"/events",className:"inline-flex items-center gap-1.5 text-[11px] font-bold text-[#0D0D0D]/50 hover:text-[#0D0D0D] uppercase tracking-widest transition-colors",style:{fontFamily:"'Fragment Mono', monospace"},children:[s.jsx(Fn,{className:"w-3 h-3"}),"Voir tous les tournois"]})})]})]})})]}),s.jsx(oLe,{}),i&&n&&new Date(i.event_date).getTime()<Date.now()+12*3600*1e3&&s.jsx("section",{className:"py-10 bg-white border-t border-[#0D0D0D]/10",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-4xl",children:[s.jsxs("div",{className:"mb-4",children:[s.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-[#0D0D0D]/60 mb-1",children:"Galerie du tournoi"}),s.jsx("h2",{className:"font-bricolage font-extrabold text-2xl md:text-3xl text-[#0D0D0D]",children:"Souvenirs & partages"}),s.jsx("p",{className:"text-sm text-[#0D0D0D]/70 mt-1",children:"Réservée aux participants. Ajoutez vos photos, téléchargez celles des autres, partagez-les où vous voulez."})]}),s.jsx(e6,{eventId:i.id,eventTitle:i.title})]})}),i&&new Date(i.event_date).getTime()<Date.now()&&s.jsx("section",{className:"py-12 bg-[#F5F3EE] border-t border-[#0D0D0D]/10",children:s.jsx("div",{className:"container mx-auto px-4 max-w-2xl",children:s.jsxs("div",{className:"rounded-2xl border border-[#0D0D0D]/10 bg-white p-6 md:p-8 text-center",children:[s.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-[#0D0D0D]/60 mb-3",children:"Merci d'avoir joué"}),s.jsx("h3",{className:"font-bricolage font-extrabold text-2xl md:text-3xl text-[#0D0D0D] mb-2",children:"On se revoit au prochain tournoi ?"}),s.jsx("p",{className:"text-sm text-[#0D0D0D]/70 mb-5",children:"Prochaines dates en avant-première, offres exclusives et conseils pour progresser."}),s.jsx(kR,{source:"post-tournament",variant:"card",className:"max-w-md mx-auto"})]})})}),s.jsx(Rl,{source:"footer-event-detail"}),s.jsx(rLe,{open:f,onOpenChange:h,eventId:i.id,eventTitle:i.title})]})}const CUe=dp("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),jl=N.forwardRef(({className:e,variant:t,...n},r)=>s.jsx("div",{ref:r,role:"alert",className:ae(CUe({variant:t}),e),...n}));
1241jl.displayName="Alert";const xP=N.forwardRef(({className:e,...t},n)=>s.jsx("h5",{ref:n,className:ae("mb-1 font-medium leading-none tracking-tight",e),...t}));xP.displayName="AlertTitle";const Nl=N.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ae("text-sm [&_p]:leading-relaxed",e),...t}));Nl.displayName="AlertDescription";const iN="chessagenda:pending_checkout",EUe=60*60*1e3;function Roe(e,t){try{const n={eventId:e,sessionId:t,startedAt:Date.now()};sessionStorage.setItem(iN,JSON.stringify(n))}catch{}}function SUe(){try{const e=sessionStorage.getItem(iN);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.eventId)||typeof t.startedAt!="number"?null:Date.now()-t.startedAt>EUe?(sessionStorage.removeItem(iN),null):t}catch{return null}}function aN(){try{sessionStorage.removeItem(iN)}catch{}}async function AUe(e){try{const{data:t,error:n}=await re.functions.invoke("cancel-pending-checkout",{body:{eventId:e.eventId,sessionId:e.sessionId}});return n?{ok:!1,alreadyPaid:!1,cancelledCount:0}:{ok:!0,alreadyPaid:!!(t!=null&&t.alreadyPaid),cancelledCount:Number((t==null?void 0:t.cancelledCount)??0)}}catch{return{ok:!1,alreadyPaid:!1,cancelledCount:0}}}function Moe({value:e,onChange:t,min:n=1,max:r,className:i}){const a=()=>{e>n&&t(e-1)},o=()=>{e<r&&t(e+1)};return s.jsxs("div",{className:ae("space-y-3",i),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"font-medium",children:"Nombre de places"}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:[r," place",r>1?"s":""," disponible",r>1?"s":""]})]}),s.jsxs("div",{className:"flex items-center justify-center gap-4",children:[s.jsx(Q,{type:"button",variant:"outline",size:"icon",className:"h-12 w-12 rounded-full border-2 touch-manipulation",onClick:a,disabled:e<=n,children:s.jsx(Eb,{className:"w-5 h-5"})}),s.jsx("div",{className:"w-20 h-14 flex items-center justify-center bg-muted/50 rounded-xl border-2 border-primary/20",children:s.jsx("span",{className:"text-2xl font-bold tabular-nums",children:e})}),s.jsx(Q,{type:"button",variant:"outline",size:"icon",className:"h-12 w-12 rounded-full border-2 touch-manipulation",onClick:o,disabled:e>=r,children:s.jsx(qa,{className:"w-5 h-5"})})]}),e>1&&s.jsx("p",{className:"text-center text-sm text-muted-foreground",children:e===2?"1 place pour vous + 1 invité":`1 place pour vous + ${e-1} invités`})]})}function b6({index:e,value:t,onChange:n,error:r}){const[i,a]=N.useState(!0),o=e+2,l=t.firstName?`${t.firstName}${t.lastName?` ${t.lastName}`:""}`:`Invité ${o-1}`;return s.jsxs("div",{className:ae("rounded-xl border-2 transition-all overflow-hidden",r?"border-destructive/50 bg-destructive/5":"border-border/50 bg-muted/30"),children:[s.jsxs("button",{type:"button",onClick:()=>a(!i),className:"w-full flex items-center justify-between p-4 text-left hover:bg-muted/50 transition-colors",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center",children:s.jsx(Cs,{className:"w-4 h-4 text-primary"})}),s.jsxs("div",{children:[s.jsxs("span",{className:"font-medium text-sm",children:["Place #",o]}),s.jsxs("span",{className:"text-muted-foreground text-sm",children:[" — ",l]})]})]}),i?s.jsx(aI,{className:"w-5 h-5 text-muted-foreground"}):s.jsx(Wa,{className:"w-5 h-5 text-muted-foreground"})]}),i&&s.jsxs("div",{className:"px-4 pb-4 space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Fe,{htmlFor:`guest-${e}-firstName`,className:"text-sm",children:["Prénom de l'invité ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx(Ue,{id:`guest-${e}-firstName`,placeholder:"Ex: Thomas",value:t.firstName,onChange:c=>n({...t,firstName:c.target.value}),className:ae("h-11",r&&!t.firstName&&"border-destructive focus-visible:ring-destructive"),maxLength:100})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Fe,{htmlFor:`guest-${e}-lastName`,className:"text-sm",children:["Nom de l'invité ",s.jsx("span",{className:"text-muted-foreground text-xs",children:"(optionnel)"})]}),s.jsx(Ue,{id:`guest-${e}-lastName`,placeholder:"Ex: Dupont",value:t.lastName,onChange:c=>n({...t,lastName:c.target.value}),className:"h-11",maxLength:100})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Fe,{htmlFor:`guest-${e}-notes`,className:"text-sm",children:["Notes ",s.jsx("span",{className:"text-muted-foreground text-xs",children:"(optionnel)"})]}),s.jsx($s,{id:`guest-${e}-notes`,placeholder:"Ex: Mon enfant de 10 ans, débutant",value:t.notes,onChange:c=>n({...t,notes:c.target.value}),className:"min-h-[80px] resize-none",maxLength:500})]}),r&&s.jsx("p",{className:"text-sm text-destructive",children:r})]})]})}const TUe=()=>s.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 48 48",className:"h-5 w-5",focusable:"false",children:[s.jsx("path",{fill:"#FFC107",d:"M43.611 20.083H42V20H24v8h11.303c-1.649 4.657-6.08 8-11.303 8-6.627 0-12-5.373-12-12s5.373-12 12-12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 12.955 4 4 12.955 4 24s8.955 20 20 20 20-8.955 20-20c0-1.341-.138-2.65-.389-3.917z"}),s.jsx("path",{fill:"#FF3D00",d:"M6.306 14.691l6.571 4.819C14.655 15.108 18.961 12 24 
124112c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 16.318 4 9.656 8.337 6.306 14.691z"}),s.jsx("path",{fill:"#4CAF50",d:"M24 44c5.166 0 9.86-1.977 13.409-5.192l-6.19-5.238C29.211 35.091 26.715 36 24 36c-5.202 0-9.619-3.317-11.283-7.946l-6.522 5.025C9.505 39.556 16.227 44 24 44z"}),s.jsx("path",{fill:"#1976D2",d:"M43.611 20.083H42V20H24v8h11.303c-.792 2.237-2.231 4.166-4.094 5.571.001-.001.002-.001.003-.002l6.19 5.238C36.971 39.205 44 34 44 24c0-1.341-.138-2.65-.389-3.917z"})]}),PUe=({redirectTo:e,label:t="Continuer avec Google",disabled:n,onLoadingChange:r,className:i})=>{const[a,o]=N.useState(!1),l=async()=>{o(!0),r==null||r(!0);try{e&&e.startsWith("/")&&!e.startsWith("//")?sessionStorage.setItem(sm,e):sessionStorage.removeItem(sm);const{error:c}=await re.auth.signInWithOAuth({provider:"google",options:{redirectTo:`${window.location.origin}/auth/callback`,queryParams:{prompt:"select_account"}}});if(c)throw c}catch(c){console.error("Google sign-in error:",c),sessionStorage.removeItem(sm),je.error("Connexion Google indisponible. Veuillez réessayer."),o(!1),r==null||r(!1)}};return s.jsx(Q,{type:"button",variant:"outline",size:"lg",onClick:l,disabled:n||a,className:`w-full gap-3 ${i??""}`,children:a?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"h-4 w-4 animate-spin"}),"Redirection vers Google…"]}):s.jsxs(s.Fragment,{children:[s.jsx(TUe,{}),s.jsx("span",{children:t})]})})};var OUe="Separator",pz="horizontal",DUe=["horizontal","vertical"],Loe=N.forwardRef((e,t)=>{const{decorative:n,orientation:r=pz,...i}=e,a=IUe(r)?r:pz,l=n?{role:"none"}:{"aria-orientation":a==="vertical"?a:void 0,role:"separator"};return s.jsx(ut.div,{"data-orientation":a,...l,...i,ref:t})});Loe.displayName=OUe;function IUe(e){return DUe.includes(e)}var Foe=Loe;const Fs=N.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},i)=>s.jsx(Foe,{ref:i,decorative:n,orientation:t,className:ae("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Fs.displayName=Foe.displayName;function RUe({eventId:e,event:t}){const n=Rr(),[r,i]=N.useState(!1),[a,o]=N.useState(!1),[l,c]=N.useState(""),[u,d]=N.useState(""),[f,h]=N.useState({}),[p,x]=N.useState(1),[y,b]=N.useState([]),[w,_]=N.useState({}),{data:j=0}=_C(e),E=Math.max(t.capacity-j,0),S=Math.min(E,5),T=t.price_cents===0,P=U=>{x(U),_({});const F=U-1;if(F>y.length){const H=[...y];for(let z=y.length;z<F;z++)H.push({firstName:"",lastName:"",notes:""});b(H)}else F<y.length&&b(y.slice(0,F))},O=(U,F)=>{const H=[...y];if(H[U]=F,b(H),w[U]){const z={...w};delete z[U],_(z)}},D=()=>{const U={};l.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(l)||(U.email="Email invalide"):U.email="Email requis",u.trim()?u.trim().length<2&&(U.firstName="Minimum 2 caractères"):U.firstName="Prénom requis",h(U);const F={};return p>1&&y.forEach((H,z)=>{H.firstName.trim()||(F[z]="Le prénom est obligatoire")}),_(F),Object.keys(U).length===0&&Object.keys(F).length===0},R=async U=>{if(U.preventDefault(),!!D()){i(!0);try{const F=[{isForSelf:!0},...y.map(K=>({isForSelf:!1,guestFirstName:K.firstName.trim(),guestLastName:K.lastName.trim()||void 0,guestNotes:K.notes.trim()||void 0}))],H=await fetch("https://panllzgwiadaxweewisk.supabase.co/functions/v1/create-checkout",{method:"POST",headers:{"Content-Type":"application/json",apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBhbmxsemd3aWFkYXh3ZWV3aXNrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjY4MjE5MjYsImV4cCI6MjA4MjM5NzkyNn0.M_VA_bQ5gqQeiyHbxzjiMZhcIB1U_kCH02dKBar45Jg"},body:JSON.stringify({eventId:e,tickets:F,guestEmail:l.trim(),guestFirstName:u.trim()})}),z=await H.json();if(!H.ok||z.error)throw new Error(z.error||"Erreur lors de la création du paiement");if(z!=null&&z.capiInitiateCheckoutEventId){const{firePixelWithEventId:K}=await ka(async()=>{const{firePixelWithEventId:W}=await Promise.resolve().then(()=>uh);return{firePixelWithEventId:W}},void 0);K("InitiateCheckout",z.capiInitiateCheckoutEventId,{currency:"EUR",value:z==null?void 0:z.capiValue,content_ids:[e],content_type:"event",num_items:F.length})}z.free?(aN(),je.success("Inscription confirmée ! Vérifiez votre email pour le ticket."),window.location.href=z.url):z.url&&(Roe(e,z==null?void 0:z.sessionId),window.location.href=z.url)}catch(F){console.error("Registration error:",F),je.error(F instanceof Error?F.message:"Erreur lors de l'inscription"),i(!1)}}},L=N.useMemo(()=>t.price_cents*p/100,[t.price_cents,p]),M=T?"Gratuit":`${L.toFixed(0)}€`,B=T?p>1?`S'inscrire (${p} places)`:"S'inscrire gratuitement":`S'inscrire — Payer ${M}${p>1?` (${p} places)`:""}`;return s.jsx("form",{onSubmit:R,className:"space-y-6",children:s.jsx(Se,{className:"border-border bg-card/50 backdrop-blur-sm",children:s.jsxs(De,{className:"p-6 space-y-5",children:[s.jsxs("div",{className:"text-center space-y-2",children:[s.jsx("h3",{className:"font-display text-xl font-semibold",children:"S'inscrire à l'événement"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Votre compte est créé automatiquement. Vous recevrez votre ticket par email après paiement."}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Déjà préinscrit ? Saisissez le même email pour finaliser le paiement."}),s.jsxs("p",{className:"text-sm text-muted-foreground pt-1",children:["Déjà un compte ?"," ",s.jsx("button",{type:"button",onClick:()=>n("/auth",{state:{from:{pathname:`/events/${e}/register`},email:l.trim()||void 0}}),className:"font-medium text-primary hover:underline",children:"Se connecter"})]})]}),s.jsx(PUe,{redirectTo:`/events/${e}/register`,label:"Continuer avec Google",disabled:r,onLoadingChange:o}),s.jsxs("div",{className:"relative",children:[s.jsx(Fs,{}),s.jsx("span",{className:"absolute left-1/2 -translate-x-1/2 -top-2.5 bg-card px-2 text-xs uppercase tracking-wider text-muted-foreground",children:"ou avec votre email"})]}),S>=1&&s.jsx(Moe,{value:p,onChange:P,max:Math.max(S,1)}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Fe,{htmlFor:"guest-email",className:"flex items-center gap-2",children:[s.jsx(wr,{className:"w-4 h-4 text-muted-foreground"}),"Email ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx(Ue,{id:"guest-email",type:"email",placeholder:"[email protected]",value:l,onCh
1241ange:U=>{c(U.target.value),f.email&&h({...f,email:""})},className:f.email?"border-destructive":"",autoComplete:"email",required:!0}),f.email&&s.jsx("p",{className:"text-sm text-destructive",children:f.email})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Fe,{htmlFor:"guest-firstName",className:"flex items-center gap-2",children:[s.jsx(Cs,{className:"w-4 h-4 text-muted-foreground"}),"Prénom ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx(Ue,{id:"guest-firstName",type:"text",placeholder:"Votre prénom",value:u,onChange:U=>{d(U.target.value),f.firstName&&h({...f,firstName:""})},className:f.firstName?"border-destructive":"",autoComplete:"given-name",required:!0}),f.firstName&&s.jsx("p",{className:"text-sm text-destructive",children:f.firstName})]})]}),p>1&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-sm font-medium",children:"Informations des invités"}),y.map((U,F)=>s.jsx(b6,{index:F,value:U,onChange:H=>O(F,H),error:w[F]},F))]}),!T&&s.jsxs("div",{className:"rounded-xl bg-[#F5F3EE] border-l-4 border-[#AAFF00] p-4 space-y-2 text-sm text-[#0D0D0D]",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx(yo,{className:"w-4 h-4 shrink-0"}),s.jsxs("span",{children:[s.jsx("strong",{children:"Paiement sécurisé"})," par Stripe."]})]}),s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx(wr,{className:"w-4 h-4 shrink-0"}),s.jsx("span",{children:"Ticket QR + lien mot de passe envoyés par email."})]}),s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx(Cs,{className:"w-4 h-4 shrink-0"}),s.jsx("span",{children:"Remboursement complet jusqu'à 12h avant le début."})]})]}),s.jsx(Q,{type:"submit",variant:T?"default":"payment",size:"lg",className:"w-full h-14 text-base",disabled:r||a||S<1,children:r?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),"Traitement…"]}):s.jsxs(s.Fragment,{children:[B,!T&&" →"]})})]})})})}function MUe(){const{id:e}=Wi(),t=Rr(),{user:n}=Tt(),[r,i]=N.useState(!1),[a,o]=N.useState(1),[l,c]=N.useState([]),[u,d]=N.useState({}),[f,h]=N.useState(!1),p=Ye(),{data:x,isLoading:y}=nh(e),{data:b=0}=_C(e),{data:w,isLoading:_}=jte(e),{data:j,isLoading:E}=QM(e);N.useEffect(()=>{if(!e)return;const Y=async G=>{const se=SUe();if(!se||se.eventId!==e)return;aN(),h(!1);const ce=await AUe({eventId:se.eventId,sessionId:se.sessionId});p.invalidateQueries({queryKey:["event-tickets-count",e]}),p.invalidateQueries({queryKey:["events-ticket-counts"]}),p.invalidateQueries({queryKey:["can-register",e]}),p.invalidateQueries({queryKey:["my-event-ticket",e]}),p.invalidateQueries({queryKey:["my-tickets-for-event",e]}),p.invalidateQueries({queryKey:["my-tickets"]}),ce.alreadyPaid?(je.success("Paiement confirmé, redirection vers votre ticket…"),t(`/events/${e}/ticket`)):G==="pageshow"&&je.message("Préinscription enregistrée — vous pouvez finaliser le paiement quand vous voulez.")};Y("mount");const Z=G=>{G.persisted&&Y("pageshow")};return window.addEventListener("pageshow",Z),()=>window.removeEventListener("pageshow",Z)},[e,p,t]);const S=x?x.capacity-b:0,T=Math.min(S,5),P=Y=>{o(Y),d({});const Z=Y-1;if(Z>l.length){const G=[...l];for(let se=l.length;se<Z;se++)G.push({firstName:"",lastName:"",notes:""});c(G)}else Z<l.length&&c(l.slice(0,Z))},O=(Y,Z)=>{const G=[...l];
1241if(G[Y]=Z,c(G),u[Y]){const se={...u};delete se[Y],d(se)}},D=()=>{const Y={};return l.forEach((Z,G)=>{Z.firstName.trim()?Z.firstName.trim().length<2&&(Y[G]="Le prénom doit contenir au moins 2 caractères"):Y[G]="Le prénom est obligatoire"}),d(Y),Object.keys(Y).length===0},R=async()=>{if(!(!(n!=null&&n.id)||!e||!r)&&!(a>1&&!D())){h(!0);try{const Y=[{isForSelf:!0},...l.map(se=>({isForSelf:!1,guestFirstName:se.firstName.trim(),guestLastName:se.lastName.trim()||void 0,guestNotes:se.notes.trim()||void 0}))],{data:Z,error:G}=await re.functions.invoke("create-checkout",{body:{eventId:e,tickets:Y}});if(G||Z!=null&&Z.error){const se=(Z==null?void 0:Z.error)||(G&&typeof G=="object"&&"message"in G?G.message:null);throw new Error(se||"Erreur lors de la création du paiement")}if(Z!=null&&Z.capiInitiateCheckoutEventId){const{firePixelWithEventId:se}=await ka(async()=>{const{firePixelWithEventId:ce}=await Promise.resolve().then(()=>uh);return{firePixelWithEventId:ce}},void 0);se("InitiateCheckout",Z.capiInitiateCheckoutEventId,{currency:"EUR",value:Z==null?void 0:Z.capiValue,content_ids:[e],content_type:"event",num_items:Y.length})}if(Z!=null&&Z.free)aN(),je.success("Inscription confirmée !"),t(`/events/${e}/ticket`);else if(Z!=null&&Z.url)Roe(e,Z==null?void 0:Z.sessionId),window.location.href=Z.url;else throw new Error("Réponse invalide du serveur")}catch(Y){je.error(Y instanceof Error?Y.message:"Erreur lors de l'inscription"),h(!1)}}},L=x?x.price_cents*a/100:0,M=x?x.credit_amount_cents*a/100:0,B=(x==null?void 0:x.price_cents)===0;if(y||_||E)return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("div",{className:"pt-24 pb-12",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-2xl",children:[s.jsx(Ie,{className:"h-8 w-32 mb-6"}),s.jsx(Ie,{className:"h-64"})]})})]});if(!x)return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("div",{className:"pt-24 pb-12",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-2xl text-center py-16",children:[s.jsx("h1",{className:"font-display text-2xl font-bold mb-4",children:"Événement introuvable"}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Cet événement n'existe pas ou n'est plus disponible."}),s.jsx(Pe,{to:"/events",children:s.jsx(Q,{children:"Voir tous les tournois"})})]})})]});const U=S<=0,F=(j==null?void 0:j.canRegister)??!1,H=j==null?void 0:j.reason;if(!F){const Y={full:"Toutes les places ont été réservées.",pairings_started:"Les appariements ont déjà commencé, les inscriptions sont fermées.",closed:"Les inscriptions sont fermées pour cet événement."};return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("div",{className:"pt-24 pb-12",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-2xl text-center py-16",children:[s.jsx("h1",{className:"font-display text-2xl font-bold mb-4",children:U?"Événement complet":"Inscriptions fermées"}),s.jsx("p",{className:"text-muted-foreground mb-6",children:Y[H||"closed"]}),s.jsx(Pe,{to:`/events/${e}`,children:s.jsx(Q,{variant:"outline",children:"Retour à l'événement"})})]})})]})}if(!n){const Y=Math.max(5,Math.floor(x.capacity*.2)),Z=S>0&&S<=Y;return s.jsxs("div",{className:"min-h-screen",style:{backgroundColor:"#F5F3EE"},children:[s.jsx(tr,{}),s.jsx("main",{className:"pt-24 pb-12",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-md",children:[s.jsxs(Pe,{to:`/events/${e}`,className:"inline-flex items-center gap-2 text-[#0D0D0D]/70 hover:text-[#0D0D0D] transition-colors mb-6 font-medium",children:[s.jsx(Fn,{className:"w-4 h-4"}),"Retour"]}),s.jsxs("div",{className:"bg-white rounded-2xl border border-[#0D0D0D]/10 p-6 mb-6 shadow-[0_2px_8px_-2px_rgba(13,13,13,0.06)]",children:[s.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-[#0D0D0D]/60 mb-2",children:"Inscription tournoi"}),s.jsx("h1",{className:"text-2xl font-black text-[#0D0D0D] mb-4 leading-tight",style:{fontFamily:"'Bricolage Grotesque', system-ui, sans-serif"},children:x.title}),s.jsxs("div",{className:"space-y-2 text-sm text-[#0D0D0D]/75",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Jn,{className:"w-4 h-4 text-[#0D0D0D]"}),s.jsxs("span",{children:[Ze(new Date(x.event_date),"EEEE d MMMM",{locale:pt})," à"," ",Ze(new Date(x.event_date),"HH'h'mm",{locale:pt})]})]}),x.venue&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(gn,{className:"w-4 h-4 text-[#0D0D0D]"}),s.jsx("span",{children:x.venue.name})]})]}),s.jsxs("div",{className:"flex items-baseline justify-between mt-5 pt-4 border-t border-[#0D0D0D]/10",children:[s.jsx("span",{className:"text-sm text-[#0D0D0D]/70",children:"Prix par place"}),s.jsx("span",{className:"text-3xl font-black text-[#0D0D0D]",style:{fontFamily:"'Bricolage Grotesque', system-ui, sans-serif"},children:B?"Gratuit":`${(x.price_cents/100).toFixed(0)}€`})]}),!B&&(()=>{const G=od(x);return G.hasPerk?s.jsx("p",{className:"text-xs text-[#0D0D0D]/65 mt-1 text-right",children:G.mode==="digital"?`dont ${(x.credit_amount_cents/100).toFixed(0)}€ crédit conso inclus`:`${G.shortLabel} inclus`}):null})(),Z&&s.jsxs("div",{className:"mt-4 inline-flex items-center gap-2 px-3 py-1.5 rounded-full bg-[#AAFF00] text-[#0D0D0D] text-xs font-black uppercase tracking-wide",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#0D0D0D] animate-pulse"}),"Plus que ",S," place",S>1?"s":""]})]}),s.jsx(RUe,{eventId:e,event:x})]})}),s.jsx(Rl,{source:"footer-registration"})]})}const z=Math.max(5,Math.floor(x.capacity*.2)),K=S>0&&S<=z,W=od(x),q=["Participation au tournoi",...W.hasPerk?[W.longDescription]:[],"Classement et statistiques"],oe=!r||f||w&&a===1,J=f?B?"Inscription en cours…":"Redirection vers le paiement…":B?a>1?`Confirmer ${a} inscriptions`:"Confirmer mon inscription":`Payer ${L.toFixed(2)}€`;return s.jsxs("div",{className:"min-h-screen pb-32 md:pb-0",style:{backgroundColor:"#F5F3EE"},children:[s.jsx(tr,{}),s.jsx("main",{className:"pt-24 pb-12",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-2xl",children:[s.jsxs(Pe,{to:`/events/${e}`,className:"inline-flex items-center gap-2 text-[#0D0D0D]/70 hover:text-[#0D0D0D] transition-colors mb-6 font-medium",children:[s.jsx(Fn,{className:"w-4 h-4"}),"Retour à l'événement"]}),s.jsxs("div",{className:"bg-white rounded-2xl border border-[#0D0D0D]/10 shadow-[0_2px_12px_-4px_rgba(13,13,13,0.08)] overflow-hidden",children:[s.jsxs("div",{className:"p-6 md:p-8 border-b border-[#0D0D0D]/10",children:[s.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-[#0D0D0D]/60 mb-2",children:"Confirmation d'inscription"}),s.jsx("h1",{className:"text-2xl md:text-3xl font-black text-[#0D0D0D] leading-tight",style:{fontFamily:"'Bricolage Grotesque', system-ui, sans-serif"},children:x.title}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1.5 mt-3 text-sm text-[#0D0D0D]/75",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Jn,{className:"w-4 h-4"}
1241),s.jsx("span",{children:Ze(new Date(x.event_date),"EEEE d MMMM yyyy",{locale:pt})})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Vt,{className:"w-4 h-4"}),s.jsx("span",{children:Ze(new Date(x.event_date),"HH'h'mm",{locale:pt})})]}),x.venue&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(gn,{className:"w-4 h-4"}),s.jsxs("span",{children:[x.venue.name,", ",x.venue.city]})]})]}),K&&s.jsxs("div",{className:"mt-4 inline-flex items-center gap-2 px-3 py-1.5 rounded-full bg-[#AAFF00] text-[#0D0D0D] text-xs font-black uppercase tracking-wide",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#0D0D0D] animate-pulse"}),"Plus que ",S," place",S>1?"s":""]})]}),s.jsxs("div",{className:"p-6 md:p-8 space-y-8",children:[w&&s.jsxs(jl,{className:"border-[#0D0D0D]/20 bg-[#F5F3EE]",children:[s.jsx(wl,{className:"w-4 h-4"}),s.jsxs(Nl,{className:"text-[#0D0D0D]",children:["Vous êtes déjà inscrit(e) à cet événement."," ",s.jsx(Pe,{to:`/events/${e}/ticket`,className:"underline font-semibold",children:"Voir votre ticket"})]})]}),T>1&&!w&&s.jsx(Moe,{value:a,onChange:P,max:T,min:1}),a>1&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(cs,{className:"w-5 h-5 text-[#0D0D0D]"}),s.jsx("h4",{className:"font-bold text-[#0D0D0D]",children:"Vos places"})]}),s.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-xl border-2 border-[#0D0D0D]/15 bg-[#F5F3EE]",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#0D0D0D] flex items-center justify-center",children:s.jsx(Jr,{className:"w-4 h-4 text-[#AAFF00]"})}),s.jsxs("div",{children:[s.jsx("span",{className:"font-bold text-sm text-[#0D0D0D]",children:"Place #1"}),s.jsx("span",{className:"text-[#0D0D0D]/70 text-sm",children:" — Pour moi"})]})]}),l.map((Y,Z)=>s.jsx(b6,{index:Z,value:Y,onChange:G=>O(Z,G),error:u[Z]},Z))]}),s.jsxs("div",{className:"rounded-xl border-2 border-[#0D0D0D] bg-[#F5F3EE] p-5",children:[s.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-[#0D0D0D]/60 mb-3",children:"Récapitulatif"}),B?s.jsxs("div",{className:"text-center py-2",children:[s.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-full bg-[#AAFF00] text-[#0D0D0D] text-sm font-black",children:[s.jsx(vx,{className:"w-4 h-4"}),"Événement gratuit"]}),s.jsx("p",{className:"text-sm text-[#0D0D0D]/70 mt-2",children:"Aucun paiement requis."})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex justify-between text-sm text-[#0D0D0D]/80",children:[s.jsx("span",{children:a>1?`${a} × Participation`:"Participation"}),s.jsxs("span",{className:"font-semibold text-[#0D0D0D]",children:[L.toFixed(2),"€"]})]}),W.hasPerk&&s.jsxs("div",{className:"flex justify-between text-sm text-[#0D0D0D]/70 mt-1.5",children:[s.jsx("span",{children:W.mode==="digital"?`dont crédit conso (${a} × ${(x.credit_amount_cents/100).toFixed(0)}€)`:`dont ${W.shortLabel}`}),s.jsxs("span",{className:"font-semibold",children:["— ",M.toFixed(0),"€"]})]}),s.jsxs("div",{className:"border-t border-[#0D0D0D]/15 mt-4 pt-3 flex items-baseline justify-between",children:[s.jsx("span",{className:"text-sm font-bold uppercase tracking-wide text-[#0D0D0D]",children:"Total"}),s.jsxs("span",{className:"text-3xl font-black text-[#0D0D0D]",style:{fontFamily:"'Bricolage Grotesque', system-ui, sans-serif"},children:[L.toFixed(2),"€"]})]})]})]}),s.jsxs("div",{children:[s.jsxs("h4",{className:"font-bold text-[#0D0D0D] mb-3 flex items-center gap-2",children:[s.jsx(vx,{className:"w-4 h-4"}),"Inclus par place"]}),s.jsx("ul",{className:"space-y-2",children:q.map((Y,Z)=>s.jsxs("li",{className:"flex items-start gap-2.5 text-sm text-[#0D0D0D]/85",children:[s.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded-full bg-[#0D0D0D] shrink-0 mt-0.5",children:s.jsx(Jr,{className:"w-3 h-3 text-[#AAFF00]"})}),s.jsx("span",{children:Y})]},Z))})]}),!B&&s.jsxs("div",{className:"rounded-xl bg-[#F5F3EE] border-l-4 border-[#AAFF00] p-4 space-y-2.5",children:[s.jsxs("div",{className:"flex items-center gap-2.5 text-sm text-[#0D0D0D]",children:[s.jsx(yo,{className:"w-4 h-4 shrink-0"}),s.jsxs("span",{children:[s.jsx("strong",{children:"Paiement sécurisé"})," par Stripe (CB, Apple Pay, Google Pay)."]})]}),s.jsxs("div",{className:"flex items-center gap-2.5 text-sm text-[#0D0D0D]",children:[s.jsx(Jr,{className:"w-4 h-4 shrink-0"}),s.jsxs("span",{children:[s.jsx("strong",{children:"Remboursement complet"})," jusqu'à ",nm,"h avant le début."]})]}),s.jsxs("div",{className:"flex items-center gap-2.5 text-sm text-[#0D0D0D]",children:[s.jsx(wl,{className:"w-4 h-4 shrink-0"}),s.jsxs("span",{children:[s.jsx("strong",{children:"Ticket QR"})," envoyé par email juste après le paiement."]})]})]}),a>1&&s.jsxs(jl,{className:"bg-[#F5F3EE] border-[#0D0D0D]/15",children:[s.jsx(wl,{className:"w-4 h-4 text-[#0D0D0D]"}),s.jsxs(Nl,{className:"text-sm text-[#0D0D0D]",children:[s.jsx("strong",{children:"Inscription pour un tiers :"})," vous recevrez un QR code par place. Pensez à présenter le bon ticket au check-in."]})]}),s.jsxs("div",{className:"flex items-start gap-3 rounded-xl border border-[#0D0D0D]/15 bg-white p-4",children:[s.jsx(ya,{id:"terms",checked:r,onCheckedChange:Y=>i(Y===!0),className:"mt-0.5 border-[#0D0D0D] data-[state=checked]:bg-[#0D0D0D] data-[state=checked]:text-[#AAFF00]"}),s.jsx(Fe,{htmlFor:"terms",className:"text-sm text-[#0D0D0D] leading-relaxed cursor-pointer",children:"Je m'engage à être présent(e) le jour du tournoi et j'accepte les conditions d'inscription."})]}),s.jsxs("div",{className:"hidden md:block",children:[s.jsx(Q,{variant:B?"default":"payment",size:"lg",className:"w-full h-14 text-base",onClick:R,disabled:oe,children:f?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),J]}):B?s.jsxs(s.Fragment,{children:[s.jsx(Jr,{className:"w-4 h-4 mr-2"}),J]}):s.jsxs(s.Fragment,{children:[s.jsx(el,{className:"w-4 h-4 mr-2"}),J," →"]})}),s.jsx("p",{className:"text-center text-xs text-[#0D0D0D]/65 mt-2",children:a>1?`Vous recevrez ${a} tickets avec QR codes distincts.`:"Vous recevrez un ticket avec QR code pour l'accueil."})]})]})]})]})}),s.jsx("div",{className:"fixed bottom-0 inset-x-0 md:hidden bg-white border-t border-[#0D0D0D]/10 p-3 z-40",style:{paddingBottom:"max(0.75rem, env(safe-area-inset-bottom))"},children:s.jsxs("div",{className:"flex items-center gap-3",children:[!B&&s.jsxs("div",{className:"flex flex-col leading-none",children:[s.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-[#0D0D0D]/60",children:"Total"}),s.jsxs("span",{className:"text-xl font-black text-[#0D0D0D]",style:{fontFamily:"'Bricolage Grotesque', system-ui, sans-serif"},children:[L.toFixed(2),"€"]})]}),s.jsx(Q,{variant:B?"default":"payment",size:"lg",className:"flex-1 h-12",onClick:R,disabled:oe,children:f?s.jsx(We,{className:"w-4 h-4 animate-spin"}):B?s.jsx(s.Fragment,{children:"Confirmer"}):s.jsx(s.Fragment,{children:"Payer →"})})]})}),s.jsx(Rl,{source:"footer-registration"})]})}var LUe=Object.defineProperty,oN=Object.getOwnPropertySymbols,$oe=Object.prototype.hasOwnProperty,Boe=Object.prototype.propertyIsEnumerable,gz=(e,t,n)=>t in e?LUe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yP=(e,t)=>
1241{for(var n in t||(t={}))$oe.call(t,n)&&gz(e,n,t[n]);if(oN)for(var n of oN(t))Boe.call(t,n)&&gz(e,n,t[n]);return e},vP=(e,t)=>{var n={};for(var r in e)$oe.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&oN)for(var r of oN(e))t.indexOf(r)<0&&Boe.call(e,r)&&(n[r]=e[r]);return n};/**
1242 * @license QR Code generator library (TypeScript)
1243 * Copyright (c) Project Nayuki.
1244 * SPDX-License-Identifier: MIT
1245 */var np;(e=>{const t=class Pn{constructor(c,u,d,f){if(this.version=c,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],c<Pn.MIN_VERSION||c>Pn.MAX_VERSION)throw new RangeError("Version value out of range");if(f<-1||f>7)throw new RangeError("Mask value out of range");this.size=c*4+17;let h=[];for(let x=0;x<this.size;x++)h.push(!1);for(let x=0;x<this.size;x++)this.modules.push(h.slice()),this.isFunction.push(h.slice());this.drawFunctionPatterns();const p=this.addEccAndInterleave(d);if(this.drawCodewords(p),f==-1){let x=1e9;for(let y=0;y<8;y++){this.applyMask(y),this.drawFormatBits(y);const b=this.getPenaltyScore();b<x&&(f=y,x=b),this.applyMask(y)}}i(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(c,u){const d=e.QrSegment.makeSegments(c);return Pn.encodeSegments(d,u)}static encodeBinary(c,u){const d=e.QrSegment.makeBytes(c);return Pn.encodeSegments([d],u)}static encodeSegments(c,u,d=1,f=40,h=-1,p=!0){if(!(Pn.MIN_VERSION<=d&&d<=f&&f<=Pn.MAX_VERSION)||h<-1||h>7)throw new RangeError("Invalid value");let x,y;for(x=d;;x++){const j=Pn.getNumDataCodewords(x,u)*8,E=o.getTotalBits(c,x);if(E<=j){y=E;break}if(x>=f)throw new RangeError("Data too long")}for(const j of[Pn.Ecc.MEDIUM,Pn.Ecc.QUARTILE,Pn.Ecc.HIGH])p&&y<=Pn.getNumDataCodewords(x,j)*8&&(u=j);let b=[];for(const j of c){n(j.mode.modeBits,4,b),n(j.numChars,j.mode.numCharCountBits(x),b);for(const E of j.getData())b.push(E)}i(b.length==y);const w=Pn.getNumDataCodewords(x,u)*8;i(b.length<=w),n(0,Math.min(4,w-b.length),b),n(0,(8-b.length%8)%8,b),i(b.length%8==0);for(let j=236;b.length<w;j^=253)n(j,8,b);let _=[];for(;_.length*8<b.length;)_.push(0);return b.forEach((j,E)=>_[E>>>3]|=j<<7-(E&7)),new Pn(x,u,_,h)}getModule(c,u){return 0<=c&&c<this.size&&0<=u&&u<this.size&&this.modules[u][c]}getModules(){return this.modules}drawFunctionPatterns(){for(let d=0;d<this.size;d++)this.setFunctionModule(6,d,d%2==0),this.setFunctionModule(d,6,d%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const c=this.getAlignmentPatternPositions(),u=c.length;for(let d=0;d<u;d++)for(let f=0;f<u;f++)d==0&&f==0||d==0&&f==u-1||d==u-1&&f==0||this.drawAlignmentPattern(c[d],c[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(c){const u=this.errorCorrectionLevel.formatBits<<3|c;let d=u;for(let h=0;h<10;h++)d=d<<1^(d>>>9)*1335;const f=(u<<10|d)^21522;i(f>>>15==0);for(let h=0;h<=5;h++)this.setFunctionModule(8,h,r(f,h));this.setFunctionModule(8,7,r(f,6)),this.setFunctionModule(8,8,r(f,7)),this.setFunctionModule(7,8,r(f,8));for(let h=9;h<15;h++)this.setFunctionModule(14-h,8,r(f,h));for(let h=0;h<8;h++)this.setFunctionModule(this.size-1-h,8,r(f,h));for(let h=8;h<15;h++)this.setFunctionModule(8,this.size-15+h,r(f,h));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let c=this.version;for(let d=0;d<12;d++)c=c<<1^(c>>>11)*7973;const u=this.version<<12|c;i(u>>>18==0);for(let d=0;d<18;d++){const f=r(u,d),h=this.size-11+d%3,p=Math.floor(d/3);this.setFunctionModule(h,p,f),this.setFunctionModule(p,h,f)}}drawFinderPattern(c,u){for(let d=-4;d<=4;d++)for(let f=-4;f<=4;f++){const h=Math.max(Math.abs(f),Math.abs(d)),p=c+f,x=u+d;0<=p&&p<this.size&&0<=x&&x<this.size&&this.setFunctionModule(p,x,h!=2&&h!=4)}}drawAlignmentPattern(c,u){for(let d=-2;d<=2;d++)for(let f=-2;f<=2;f++)this.setFunctionModule(c+f,u+d,Math.max(Math.abs(f),Math.abs(d))!=1)}setFunctionModule(c,u,d){this.modules[u][c]=d,this.isFunction[u][c]=!0}addEccAndInterleave(c){const u=this.version,d=this.errorCorrectionLevel;if(c.length!=Pn.getNumDataCodewords(u,d))throw new RangeError("Invalid argument");const f=Pn.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][u],h=Pn.ECC_CODEWORDS_PER_BLOCK[d.ordinal][u],p=Math.floor(Pn.getNumRawDataModules(u)/8),x=f-p%f,y=Math.floor(p/f);let b=[];const w=Pn.reedSolomonComputeDivisor(h);for(let j=0,E=0;j<f;j++){let S=c.slice(E,E+y-h+(j<x?0:1));E+=S.length;const T=Pn.reedSolomonComputeRemainder(S,w);j<x&&S.push(0),b.push(S.concat(T))}let _=[];for(let j=0;j<b[0].length;j++)b.forEach((E,S)=>{(j!=y-h||S>=x)&&_.push(E[j])});return i(_.length==p),_}drawCodewords(c){if(c.length!=Math.floor(Pn.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let u=0;for(let d=this.size-1;d>=1;d-=2){d==6&&(d=5);for(let f=0;f<this.size;f++)for(let h=0;h<2;h++){const p=d-h,y=(d+1&2)==0?this.size-1-f:f;!this.isFunction[y][p]&&u<c.length*8&&(this.modules[y][p]=r(c[u>>>3],7-(u&7)),u++)}}i(u==c.length*8)}
1245applyMask(c){if(c<0||c>7)throw new RangeError("Mask value out of range");for(let u=0;u<this.size;u++)for(let d=0;d<this.size;d++){let f;switch(c){case 0:f=(d+u)%2==0;break;case 1:f=u%2==0;break;case 2:f=d%3==0;break;case 3:f=(d+u)%3==0;break;case 4:f=(Math.floor(d/3)+Math.floor(u/2))%2==0;break;case 5:f=d*u%2+d*u%3==0;break;case 6:f=(d*u%2+d*u%3)%2==0;break;case 7:f=((d+u)%2+d*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][d]&&f&&(this.modules[u][d]=!this.modules[u][d])}}getPenaltyScore(){let c=0;for(let h=0;h<this.size;h++){let p=!1,x=0,y=[0,0,0,0,0,0,0];for(let b=0;b<this.size;b++)this.modules[h][b]==p?(x++,x==5?c+=Pn.PENALTY_N1:x>5&&c++):(this.finderPenaltyAddHistory(x,y),p||(c+=this.finderPenaltyCountPatterns(y)*Pn.PENALTY_N3),p=this.modules[h][b],x=1);c+=this.finderPenaltyTerminateAndCount(p,x,y)*Pn.PENALTY_N3}for(let h=0;h<this.size;h++){let p=!1,x=0,y=[0,0,0,0,0,0,0];for(let b=0;b<this.size;b++)this.modules[b][h]==p?(x++,x==5?c+=Pn.PENALTY_N1:x>5&&c++):(this.finderPenaltyAddHistory(x,y),p||(c+=this.finderPenaltyCountPatterns(y)*Pn.PENALTY_N3),p=this.modules[b][h],x=1);c+=this.finderPenaltyTerminateAndCount(p,x,y)*Pn.PENALTY_N3}for(let h=0;h<this.size-1;h++)for(let p=0;p<this.size-1;p++){const x=this.modules[h][p];x==this.modules[h][p+1]&&x==this.modules[h+1][p]&&x==this.modules[h+1][p+1]&&(c+=Pn.PENALTY_N2)}let u=0;for(const h of this.modules)u=h.reduce((p,x)=>p+(x?1:0),u);const d=this.size*this.size,f=Math.ceil(Math.abs(u*20-d*10)/d)-1;return i(0<=f&&f<=9),c+=f*Pn.PENALTY_N4,i(0<=c&&c<=2568888),c}getAlignmentPatternPositions(){if(this.version==1)return[];{const c=Math.floor(this.version/7)+2,u=this.version==32?26:Math.ceil((this.version*4+4)/(c*2-2))*2;let d=[6];for(let f=this.size-7;d.length<c;f-=u)d.splice(1,0,f);return d}}static getNumRawDataModules(c){if(c<Pn.MIN_VERSION||c>Pn.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*c+128)*c+64;if(c>=2){const d=Math.floor(c/7)+2;u-=(25*d-10)*d-55,c>=7&&(u-=36)}return i(208<=u&&u<=29648),u}static getNumDataCodewords(c,u){return Math.floor(Pn.getNumRawDataModules(c)/8)-Pn.ECC_CODEWORDS_PER_BLOCK[u.ordinal][c]*Pn.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][c]}static reedSolomonComputeDivisor(c){if(c<1||c>255)throw new RangeError("Degree out of range");let u=[];for(let f=0;f<c-1;f++)u.push(0);u.push(1);let d=1;for(let f=0;f<c;f++){for(let h=0;h<u.length;h++)u[h]=Pn.reedSolomonMultiply(u[h],d),h+1<u.length&&(u[h]^=u[h+1]);d=Pn.reedSolomonMultiply(d,2)}return u}static reedSolomonComputeRemainder(c,u){let d=u.map(f=>0);for(const f of c){const h=f^d.shift();d.push(0),u.forEach((p,x)=>d[x]^=Pn.reedSolomonMultiply(p,h))}return d}static reedSolomonMultiply(c,u){if(c>>>8||u>>>8)throw new RangeError("Byte out of range");let d=0;for(let f=7;f>=0;f--)d=d<<1^(d>>>7)*285,d^=(u>>>f&1)*c;return i(d>>>8==0),d}finderPenaltyCountPatterns(c){const u=c[1];i(u<=this.size*3);const d=u>0&&c[2]==u&&c[3]==u*3&&c[4]==u&&c[5]==u;return(d&&c[0]>=u*4&&c[6]>=u?1:0)+(d&&c[6]>=u*4&&c[0]>=u?1:0)}finderPenaltyTerminateAndCount(c,u,d){return c&&(this.finderPenaltyAddHistory(u,d),u=0),u+=this.size,this.finderPenaltyAddHistory(u,d),this.finderPenaltyCountPatterns(d)}finderPenaltyAddHistory(c,u){u[0]==0&&(c+=this.size),u.pop(),u.unshift(c)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(l,c,u){if(c<0||c>31||l>>>c)throw new RangeError("Value out of range");for(let d=c-1;d>=0;d--)u.push(l>>>d&1)}function r(l,c){return(l>>>c&1)!=0}function i(l){if(!l)throw new Error("Assertion error")}
1245const a=class As{constructor(c,u,d){if(this.mode=c,this.numChars=u,this.bitData=d,u<0)throw new RangeError("Invalid argument");this.bitData=d.slice()}static makeBytes(c){let u=[];for(const d of c)n(d,8,u);return new As(As.Mode.BYTE,c.length,u)}static makeNumeric(c){if(!As.isNumeric(c))throw new RangeError("String contains non-numeric characters");let u=[];for(let d=0;d<c.length;){const f=Math.min(c.length-d,3);n(parseInt(c.substring(d,d+f),10),f*3+1,u),d+=f}return new As(As.Mode.NUMERIC,c.length,u)}static makeAlphanumeric(c){if(!As.isAlphanumeric(c))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],d;for(d=0;d+2<=c.length;d+=2){let f=As.ALPHANUMERIC_CHARSET.indexOf(c.charAt(d))*45;f+=As.ALPHANUMERIC_CHARSET.indexOf(c.charAt(d+1)),n(f,11,u)}return d<c.length&&n(As.ALPHANUMERIC_CHARSET.indexOf(c.charAt(d)),6,u),new As(As.Mode.ALPHANUMERIC,c.length,u)}static makeSegments(c){return c==""?[]:As.isNumeric(c)?[As.makeNumeric(c)]:As.isAlphanumeric(c)?[As.makeAlphanumeric(c)]:[As.makeBytes(As.toUtf8ByteArray(c))]}static makeEci(c){let u=[];if(c<0)throw new RangeError("ECI assignment value out of range");if(c<128)n(c,8,u);else if(c<16384)n(2,2,u),n(c,14,u);else if(c<1e6)n(6,3,u),n(c,21,u);else throw new RangeError("ECI assignment value out of range");return new As(As.Mode.ECI,0,u)}static isNumeric(c){return As.NUMERIC_REGEX.test(c)}static isAlphanumeric(c){return As.ALPHANUMERIC_REGEX.test(c)}getData(){return this.bitData.slice()}static getTotalBits(c,u){let d=0;for(const f of c){const h=f.mode.numCharCountBits(u);if(f.numChars>=1<<h)return 1/0;d+=4+h+f.bitData.length}return d}static toUtf8ByteArray(c){c=encodeURI(c);let u=[];for(let d=0;d<c.length;d++)c.charAt(d)!="%"?u.push(c.charCodeAt(d)):(u.push(parseInt(c.substring(d+1,d+3),16)),d+=2);return u}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let o=a;e.QrSegment=a})(np||(np={}));(e=>{(t=>{const n=class{constructor(i,a){this.ordinal=i,this.formatBits=a}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(np||(np={}));(e=>{(t=>{const n=class{constructor(i,a){this.modeBits=i,this.numBitsCharCount=a}numCharCountBits(i){return this.numBitsCharCount[Math.floor((i+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(np||(np={}));var Cg=np;/**
1246 * @license qrcode.react
1247 * Copyright (c) Paul O'Shannessy
1248 * SPDX-License-Identifier: ISC
1249 */var FUe={L:Cg.QrCode.Ecc.LOW,M:Cg.QrCode.Ecc.MEDIUM,Q:Cg.QrCode.Ecc.QUARTILE,H:Cg.QrCode.Ecc.HIGH},zoe=128,Uoe="L",qoe="#FFFFFF",Voe="#000000",Hoe=!1,Woe=1,$Ue=4,BUe=0,zUe=.1;function Goe(e,t=0){const n=[];return e.forEach(function(r,i){let a=null;r.forEach(function(o,l){if(!o&&a!==null){n.push(`M${a+t} ${i+t}h${l-a}v1H${a+t}z`),a=null;return}if(l===r.length-1){if(!o)return;a===null?n.push(`M${l+t},${i+t} h1v1H${l+t}z`):n.push(`M${a+t},${i+t} h${l+1-a}v1H${a+t}z`);return}o&&a===null&&(a=l)})}),n.join("")}function Koe(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((i,a)=>a<t.x||a>=t.x+t.w?i:!1))}function UUe(e,t,n,r){if(r==null)return null;const i=e.length+n*2,a=Math.floor(t*zUe),o=i/t,l=(r.width||a)*o,c=(r.height||a)*o,u=r.x==null?e.length/2-l/2:r.x*o,d=r.y==null?e.length/2-c/2:r.y*o,f=r.opacity==null?1:r.opacity;let h=null;if(r.excavate){let x=Math.floor(u),y=Math.floor(d),b=Math.ceil(l+u-x),w=Math.ceil(c+d-y);h={x,y,w:b,h:w}}const p=r.crossOrigin;return{x:u,y:d,h:c,w:l,excavation:h,opacity:f,crossOrigin:p}}function qUe(e,t){return t!=null?Math.max(Math.floor(t),0):e?$Ue:BUe}function Yoe({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:l}){let c=ee.useMemo(()=>{const x=(Array.isArray(e)?e:[e]).reduce((y,b)=>(y.push(...Cg.QrSegment.makeSegments(b)),y),[]);return Cg.QrCode.encodeSegments(x,FUe[t],n,void 0,void 0,l)},[e,t,n,l]);const{cells:u,margin:d,numCells:f,calculatedImageSettings:h}=ee.useMemo(()=>{let p=c.getModules();const x=qUe(r,i),y=p.length+x*2,b=UUe(p,o,x,a);return{cells:p,margin:x,numCells:y,calculatedImageSettings:b}},[c,o,a,r,i]);return{qrcode:c,margin:d,cells:u,numCells:f,calculatedImageSettings:h}}var VUe=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),HUe=ee.forwardRef(function(t,n){const r=t,{value:i,size:a=zoe,level:o=Uoe,bgColor:l=qoe,fgColor:c=Voe,includeMargin:u=Hoe,minVersion:d=Woe,boostLevel:f,marginSize:h,imageSettings:p}=r,y=vP(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:b}=y,w=vP(y,["style"]),_=p==null?void 0:p.src,j=ee.useRef(null),E=ee.useRef(null),S=ee.useCallback(U=>{j.current=U,typeof n=="function"?n(U):n&&(n.current=U)},[n]),[T,P]=ee.useState(!1),{margin:O,cells:D,numCells:R,calculatedImageSettings:L}=Yoe({value:i,level:o,minVersion:d,boostLevel:f,includeMargin:u,marginSize:h,imageSettings:p,size:a});ee.useEffect(()=>{if(j.current!=null){const U=j.current,F=U.getContext("2d");if(!F)return;let H=D;
1249const z=E.current,K=L!=null&&z!==null&&z.complete&&z.naturalHeight!==0&&z.naturalWidth!==0;K&&L.excavation!=null&&(H=Koe(D,L.excavation));const W=window.devicePixelRatio||1;U.height=U.width=a*W;const q=a/R*W;F.scale(q,q),F.fillStyle=l,F.fillRect(0,0,R,R),F.fillStyle=c,VUe?F.fill(new Path2D(Goe(H,O))):D.forEach(function(oe,J){oe.forEach(function(Y,Z){Y&&F.fillRect(Z+O,J+O,1,1)})}),L&&(F.globalAlpha=L.opacity),K&&F.drawImage(z,L.x+O,L.y+O,L.w,L.h)}}),ee.useEffect(()=>{P(!1)},[_]);const M=yP({height:a,width:a},b);let B=null;return _!=null&&(B=ee.createElement("img",{src:_,key:_,style:{display:"none"},onLoad:()=>{P(!0)},ref:E,crossOrigin:L==null?void 0:L.crossOrigin})),ee.createElement(ee.Fragment,null,ee.createElement("canvas",yP({style:M,height:a,width:a,ref:S,role:"img"},w)),B)});HUe.displayName="QRCodeCanvas";var eE=ee.forwardRef(function(t,n){const r=t,{value:i,size:a=zoe,level:o=Uoe,bgColor:l=qoe,fgColor:c=Voe,includeMargin:u=Hoe,minVersion:d=Woe,boostLevel:f,title:h,marginSize:p,imageSettings:x}=r,y=vP(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:b,cells:w,numCells:_,calculatedImageSettings:j}=Yoe({value:i,level:o,minVersion:d,boostLevel:f,includeMargin:u,marginSize:p,imageSettings:x,size:a});let E=w,S=null;x!=null&&j!=null&&(j.excavation!=null&&(E=Koe(w,j.excavation)),S=ee.createElement("image",{href:x.src,height:j.h,width:j.w,x:j.x+b,y:j.y+b,preserveAspectRatio:"none",opacity:j.opacity,crossOrigin:j.crossOrigin}));const T=Goe(E,b);return ee.createElement("svg",yP({height:a,width:a,viewBox:`0 0 ${_} ${_}`,ref:n,role:"img"},y),!!h&&ee.createElement("title",null,h),ee.createElement("path",{fill:l,d:`M0,0 h${_}v${_}H0z`,shapeRendering:"crispEdges"}),ee.createElement("path",{fill:c,d:T,shapeRendering:"crispEdges"}),S)});eE.displayName="QRCodeSVG";function WUe({ticket:e,open:t,onOpenChange:n,onConfirm:r,isLoading:i=!1}){const[a,o]=N.useState(""),l=N.useMemo(()=>{if(!(e!=null&&e.event))return{isFullRefund:!0,hoursUntilEvent:0};const h=new Date(e.event.event_date),x=C0(h,new Date);return{isFullRefund:x>=nm,hoursUntilEvent:x}},[e==null?void 0:e.event]);if(!e)return null;const c=e.is_for_self?"Vous":`${e.guest_first_name||""} ${e.guest_last_name||""}`.trim()||"Invité",u=(e.credit_total_cents/100).toFixed(0),d=e.price_paid_cents?(e.price_paid_cents/100).toFixed(0):"0",f=()=>{r(e.id,a||void 0),o("")};return s.jsx(yr,{open:t,onOpenChange:n,children:s.jsxs(sr,{className:"max-w-md",children:[s.jsxs(ir,{children:[s.jsxs(or,{className:"flex items-center gap-2 text-destructive",children:[s.jsx(ur,{className:"h-5 w-5"}),"Annuler cette inscription ?"]}),s.jsx(lr,{asChild:!0,children:s.jsxs("div",{className:"space-y-4 text-left",children:[s.jsx("div",{className:"flex items-center gap-2",children:l.isFullRefund?s.jsxs(we,{className:"bg-emerald-500/10 text-emerald-600 hover:bg-emerald-500/20 border-emerald-500/20",children:[s.jsx(Cn,{className:"w-3 h-3 mr-1"}),"Remboursement complet"]}):s.jsxs(we,{className:"bg-amber-500/10 text-amber-600 hover:bg-amber-500/20 border-amber-500/20",children:[s.jsx(el,{className:"w-3 h-3 mr-1"}),"Crédit remboursé uniquement"]})}),s.jsxs("div",{className:"rounded-lg bg-muted/50 p-3 space-y-2",children:[s.jsx("p",{className:"text-sm font-medium text-foreground mb-2",children:"Ce qui sera remboursé :"}),l.isFullRefund?s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Remboursement complet"}),s.jsxs("span",{className:"font-semibold text-emerald-600",children:["+",d,"€"]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Crédit conso remboursé"}),s.jsxs("span",{className:"font-semibold text-emerald-600",children:["+",u,"€"]})]}),s.jsxs("p",{className:"text-xs text-amber-600 pt-2 border-t border-border/50",children:["Place non remboursable — le délai de ",nm,"h est dépassé."]})]})]}),s.jsxs("div",{className:"rounded-lg border p-3 space-y-2",children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Ticket concerné :"}),e.event&&s.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.event.title," •"," ",Ze(new Date(e.event.event_date),"d MMMM yyyy",{locale:pt})]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Participant : ",c]}),s.jsxs("p",{className:"text-sm font-mono text-muted-foreground",children:["Code : ",e.reservation_code]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"cancel-reason",className:"text-sm text-foreground",children:"Raison (optionnel)"}),s.jsx($s,{id:"cancel-reason",placeholder:"Pourquoi souhaitez-vous annuler ?",value:a,onChange:h=>o(h.target.value),className:"resize-none",rows:2})]})]})})]}),s.jsxs(ar,{children:[s.jsx(cr,{disabled:i,children:"Retour"}),s.jsx(vr,{onClick:f,disabled:i,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:i?"Annulation...":"Confirmer l'annulation"})]})]})})}function GUe({ticket:e,open:t,onClose:n}){if(!e)return null;const r=(e.creditLostCents/100).toFixed(0),i=e.pricePaidCents?(e.pricePaidCents/100).toFixed(0):"0",a=e.isFullRefund??!0;return s.jsx(dC,{open:t,onOpenChange:o=>!o&&n(),children:s.jsx($b,{side:"bottom",className:"rounded-t-2xl",children:s.jsxs("div",{className:"mx-auto w-full max-w-md pb-6",children:[s.jsxs(nR,{className:"text-center mb-6",children:[s.jsx("div",{className:"mx-auto mb-4",children:s.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-500/10 flex items-center justify-center animate-pulse",children:s.jsx(Cn,{className:"w-8 h-8 text-emerald-500"})})}),s.jsx(fC,{className:"font-display text-xl",children:"Annulation confirmée"}),s.jsx(DJ,{children:"Votre inscription a été annulée avec succès."})]}),s.jsxs("div",{className:"rounded-xl border bg-muted/30 p-4 space-y-3 mb-6",children:[s.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:"Résumé"}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Jn,{className:"w-4 h-4 text-primary mt-0.5"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-sm",children:e.event.title}),s.jsx("p",{className:"text-xs text-muted-foreground",children:Ze(ne
1249w Date(e.event.event_date),"EEEE d MMMM yyyy 'à' HH'h'mm",{locale:pt})})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Cs,{className:"w-4 h-4 text-primary"}),s.jsx("span",{className:"text-sm",children:e.participantName})]})]})]}),s.jsxs("div",{className:"rounded-xl border bg-emerald-500/5 p-4 space-y-3 mb-6",children:[s.jsx("div",{className:"flex items-center gap-2",children:a?s.jsxs(we,{className:"bg-emerald-500/10 text-emerald-600 hover:bg-emerald-500/20 border-emerald-500/20",children:[s.jsx(Cn,{className:"w-3 h-3 mr-1"}),"Remboursement complet"]}):s.jsxs(we,{className:"bg-amber-500/10 text-amber-600 hover:bg-amber-500/20 border-amber-500/20",children:[s.jsx(l1,{className:"w-3 h-3 mr-1"}),"Remboursement partiel"]})}),s.jsx("div",{className:"text-sm",children:a?s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Remboursement complet"}),s.jsxs("span",{className:"font-semibold text-emerald-600",children:["+",i,"€"]})]}):s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Avantage food & drinks remboursé"}),s.jsxs("span",{className:"font-semibold text-emerald-600",children:["+",r,"€"]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"(place non remboursable)"})]})})]}),s.jsx(Fs,{className:"mb-6"}),s.jsx("p",{className:"text-sm text-muted-foreground text-center mb-6",children:a?"Le remboursement sera effectué sous 5 à 10 jours ouvrés.":"L'avantage food & drinks sera remboursé sous 5 à 10 jours ouvrés. La place a été libérée."}),s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx(Pe,{to:"/player/history",onClick:n,children:s.jsxs(Q,{variant:"outline",className:"w-full gap-2",children:["Voir mon historique",s.jsx(Sr,{className:"w-4 h-4"})]})}),s.jsx(Q,{onClick:n,className:"w-full",children:"Fermer"})]})]})})})}function KUe({tickets:e,onCancelRequest:t}){const[n,r]=N.useState(e.length===1?e[0]:null),i=N.useMemo(()=>e.filter(p=>{if(p.status==="cancelled"||p.status==="refunded"||p.status==="checked_in"||!p.event||p.event.status==="cancelled"||p.event.status==="completed"||p.event.status==="ongoing")return!1;const x=new Date(p.event.event_date);return new Date<x}),[e]);if(i.length===0)return null;const a=n&&i.find(p=>p.id===n.id)?n:i[0],o=new Date(a.event.event_date),c=C0(o,new Date),u=c>=nm,d=(a.credit_total_cents/100).toFixed(0),f=(a.price_paid_cents/100).toFixed(0),h=p=>p.is_for_self!==!1?"Pour moi":`${p.guest_first_name||""} ${p.guest_last_name||""}`.trim()||"Invité";return s.jsxs("div",{className:"mt-8 rounded-xl border border-destructive/20 bg-destructive/5 p-4 sm:p-5 space-y-4",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-destructive/10 shrink-0",children:s.jsx(ur,{className:"w-5 h-5 text-destructive"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:"Annuler ma réservation"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:i.length>1?`${i.length} tickets annulables`:"Vous pouvez annuler cette inscription"})]})]}),i.length>1&&s.jsxs(eh,{children:[s.jsx(th,{asChild:!0,children:s.jsxs(Q,{variant:"outline",className:"w-full justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx(vo,{className:"w-4 h-4 shrink-0"}),s.jsx("span",{className:"truncate",children:h(a)}),s.jsxs("span",{className:"text-muted-foreground text-xs font-mono shrink-0",children:["(",a.reservation_code,")"]})]}),s.jsx(Wa,{className:"w-4 h-4 shrink-0"})]})}),s.jsx(yd,{align:"start",className:"w-[calc(100vw-3rem)] sm:w-80",children:i.map(p=>s.jsxs(Dr,{onClick:()=>r(p),className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"truncate",children:h(p)}),s.jsx("span",{className:"text-muted-foreground text-xs font-mono shrink-0",children:p.reservation_code})]},p.id))})]}),s.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[s.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:u?s.jsxs(we,{className:"bg-emerald-500/10 text-emerald-600 hover:bg-emerald-500/20 border-emerald-500/20",children:[s.jsx(Cn,{className:"w-3 h-3 mr-1"}),"Remboursement complet"]}):s.jsxs(we,{className:"bg-amber-500/10 text-amber-600 hover:bg-amber-500/20 border-amber-500/20",children:[s.jsx(el,{className:"w-3 h-3 mr-1"}),"Crédit remboursé uniquement"]})}),s.jsx("div",{className:"text-sm",children:u?s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Remboursement complet"}),s.jsxs("span",{className:"font-semibold text-emerald-600",children:["+",f,"€"]})]}):s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Crédit conso remboursé"}),s.jsxs("span",{className:"font-semibold text-emerald-600",children:["+",d,"€"]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"(place non remboursable)"})]})}),s.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t text-xs text-muted-foreground",children:[s.jsx(Vt,{className:"w-3.5 h-3.5 shrink-0"}),s.jsx("span",{children:u?c>nm+24?s.jsx(s.Fragment,{children:"Remboursement complet garanti"}):s.jsxs(s.Fragment,{children:["Plus que ",s.jsxs("span",{className:"font-medium text-foreground tabular-nums",children:[Math.floor(c-nm),"h"]})," pour le remboursement complet"]}):s.jsx(s.Fragment,{children:"Le délai de remboursement complet est dépassé"})})]})]}),!u&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["💡 Le remboursement complet n'est possible que si l'annulation intervient plus de ",nm,"h avant l'événement."]}),s.jsxs(Q,{variant:"destructive",size:"lg",className:"w-full font-semibold",onClick:()=>t(a),children:[s.jsx(ur,{className:"w-4 h-4 mr-2"}),"Annuler ma réservation"]})]})}function YUe({eventId:e,eventPrice:t,eventCredit:n,spotsLeft:r,canRegister:i}){const[a,o]=N.useState([]),[l,c]=N.useState({}),[u,d]=N.useState(!1),[f,h]=N.useState(!1),p=a.length,x=p*t,y=p*n,b=t===0,w=p<r,_=r<=3&&r>0,j=()=>{w&&o([...a,{firstName:"",lastName:"",notes:""}])},E=(D,R)=>{const L=[...a];if(L[D]=R,o(L),l[D]){const M={...l};delete M[D],c(M)}},S=D=>{const R=a.filter((M,B)=>B!==D);o(R);const L={};Object.entries(l).forEach(([M,B])=>{const U=parseInt(M);
1249U<D?L[U]=B:U>D&&(L[U-1]=B)}),c(L)},T=async()=>{try{const D=`${window.location.origin}/events/${e}`;await navigator.clipboard.writeText(D),je.success("Lien copié !")}catch{je.error("Impossible de copier le lien")}},P=async()=>{const D=`${window.location.origin}/events/${e}`;if(navigator.share)try{await navigator.share({title:"Rejoins-moi au tournoi !",text:"Je participe à ce tournoi d'échecs, inscris-toi aussi !",url:D})}catch(R){R.name!=="AbortError"&&T()}else T()},O=async()=>{const D={};if(a.forEach((R,L)=>{R.firstName.trim()||(D[L]="Le prénom est obligatoire")}),Object.keys(D).length>0){c(D);return}d(!0);try{const{data:R,error:L}=await re.functions.invoke("create-checkout",{body:{eventId:e,tickets:a.map(M=>{var B,U;return{isForSelf:!1,guestFirstName:M.firstName.trim(),guestLastName:((B=M.lastName)==null?void 0:B.trim())||void 0,guestNotes:((U=M.notes)==null?void 0:U.trim())||void 0}})}});if(L)throw new Error(L.message||"Erreur lors de la création du paiement");if(R!=null&&R.error)throw new Error(R.error);if(!(R!=null&&R.url))throw new Error("URL de paiement non reçue");if(R!=null&&R.capiInitiateCheckoutEventId){const{firePixelWithEventId:M}=await ka(async()=>{const{firePixelWithEventId:B}=await Promise.resolve().then(()=>uh);return{firePixelWithEventId:B}},void 0);M("InitiateCheckout",R.capiInitiateCheckoutEventId,{currency:"EUR",value:R==null?void 0:R.capiValue,content_ids:[e],content_type:"event",num_items:a.length})}if(R.free){je.success(`${p} invité${p>1?"s":""} inscrit${p>1?"s":""} !`),o([]),c({}),window.location.reload();return}window.location.href=R.url}catch(R){const L=R instanceof Error?R.message:"Erreur inconnue";je.error(L),d(!1)}};return!i||r<=0?null:s.jsxs(Se,{className:"mt-6 border-primary/20 bg-primary/5 backdrop-blur-sm overflow-hidden",children:[s.jsx(kt,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center",children:s.jsx(cs,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx(Et,{className:"text-lg font-display",children:"Inviter des amis"}),s.jsxs("p",{className:"text-sm text-muted-foreground mt-0.5 flex items-center gap-1.5",children:[s.jsxs("span",{className:"relative flex h-2 w-2",children:[s.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),s.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),r===1?"1 place restante":`${r} places restantes`]})]})]})}),s.jsxs(De,{className:"space-y-4",children:[_&&p===0&&s.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[s.jsx(El,{className:"w-4 h-4 text-amber-600 mt-0.5 shrink-0"}),s.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-400",children:"Places limitées ! Réservez vite pour vos amis."})]}),a.length>0&&s.jsx("div",{className:"space-y-3",children:a.map((D,R)=>s.jsxs("div",{className:"relative",children:[s.jsx(b6,{index:R,value:D,onChange:L=>E(R,L),error:l[R]}),s.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"absolute top-3 right-3 h-8 w-8 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:()=>S(R),children:s.jsx(ua,{className:"w-4 h-4"})})]},R))}),w&&s.jsxs(Q,{type:"button",variant:"outline",className:"w-full gap-2 border-dashed border-primary/30 hover:border-primary/50 hover:bg-primary/5",onClick:j,children:[s.jsx(cs,{className:"w-4 h-4"}),"Ajouter un invité"]}),!w&&p>0&&s.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"Toutes les places dis
1249ponibles sont sélectionnées"}),p>0&&s.jsxs(s.Fragment,{children:[s.jsx(Fs,{}),s.jsxs("div",{className:"rounded-lg bg-muted/50 p-4 space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(sn,{className:"w-4 h-4 text-muted-foreground"}),p," invité",p>1?"s":""]}),s.jsxs("span",{className:"font-medium tabular-nums",children:[p," × ",(t/100).toFixed(0),"€"]})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"font-medium",children:"Total"}),s.jsxs("div",{className:"text-right",children:[s.jsx("span",{className:"text-lg font-bold text-primary tabular-nums",children:b?"Gratuit":`${(x/100).toFixed(0)}€`}),y>0&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["avantage food & drinks inclus (",(y/100).toFixed(0),"€/invité)"]})]})]})]}),s.jsx(Q,{className:"w-full gap-2 h-12 text-base",onClick:O,disabled:u||p===0,children:u?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-5 h-5 animate-spin"}),b?"Inscription en cours...":"Redirection..."]}):s.jsxs(s.Fragment,{children:[s.jsx(sn,{className:"w-5 h-5"}),b?`Inscrire ${p} invité${p>1?"s":""}`:`Payer pour ${p} invité${p>1?"s":""} — ${(x/100).toFixed(0)}€`]})})]}),p===0&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Ajoutez des invités pour jouer ensemble !"}),s.jsx(Fs,{}),s.jsxs("div",{className:"text-center space-y-2",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"💡 Ou partagez le lien pour que vos amis s'inscrivent eux-mêmes"}),s.jsxs("div",{className:"flex gap-2 justify-center",children:[s.jsxs(Q,{type:"button",variant:"outline",size:"sm",className:"gap-2",onClick:T,children:[s.jsx(YY,{className:"w-4 h-4"}),"Copier le lien"]}),s.jsxs(Q,{type:"button",variant:"outline",size:"sm",className:"gap-2",onClick:P,children:[s.jsx(Cm,{className:"w-4 h-4"}),"Partager"]})]})]})]})]})]})}function tE(e){return st({queryKey:["venue-products",e],queryFn:async()=>{if(!e)throw new Error("Venue ID is required");const{data:t,error:n}=await re.from("products").select("*").eq("venue_id",e).eq("is_active",!0).order("category",{ascending:!0}).order("name",{ascending:!0});if(n)throw n;return t},enabled:!!e})}function Xoe(){const e=Ye();return dt({mutationFn:async({ticketId:t,items:n})=>{const{data:{user:r}}=await re.auth.getUser();if(!r)throw new Error("Non authentifié");const i=c=>c.startsWith("custom-"),a=n.map(c=>({ticket_id:t,product_id:i(c.productId)?null:c.productId,product_name:c.productName,amount_cents:c.priceCents*c.quantity,quantity:c.quantity,vat_rate:c.vatRate??(i(c.productId)?.1:.2),recorded_by:r.id})),{data:o,error:l}=await re.from("consumptions").insert(a).select();if(l)throw l;return o},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["ticket"]}),e.invalidateQueries({queryKey:["ticket-by-code"]}),e.invalidateQueries({queryKey:["ticket-consumptions",n.ticketId]}),je.success("Consommation enregistrée !")},onError:t=>{je.error(t.message)}})}const xz={drink:"Boissons",food:"Nourriture",snack:"Snacks",coffee:"Café",other:"Autres"},yz={drink:"🍺",food:"🍔",snack:"🥨",coffee:"☕",other:"🎁"},Py="__none__",XUe="Autres";function w6({open:e,onOpenChange:t,venueId:n,creditRemainingCents:r,creditTotalCents:i,qrCode:a,reservationCode:o}){const[l,c]=N.useState(!1),[u,d]=N.useState(null),[f,h]=N.useState(null),p=vd(),{data:x,isLoading:y}=tE(n),b=N.useMemo(()=>{const L=new Set;for(const M of x??[])L.add(M.category||"other");return Array.from(L).sort()},[x]),w=b.length>=2,_=w?u:null,j=N.useMemo(()=>{const L=new Map;for(const M of x??[]){if(_&&(M.category||"other")!==_)continue;const B=(M.subcategory??"").trim();if(!B)continue;const U=B.toLowerCase();L.has(U)||L.set(U,B)}return Array.from(L.values()).sort((M,B)=>M.localeCompare(B,"fr",{sensitivity:"base"}))},[x,_]),E=j.length>=2,S=E&&f&&j.some(L=>L.toLowerCase()===f.toLowerCase())?f:null,T=L=>{d(L),h(null)},P=N.useMemo(()=>{const L={};for(const M of x??[]){const B=M.category||"other";if(_&&B!==_)continue;const U=(M.subcategory??"").trim();if(S&&U.toLowerCase()!==S.toLowerCase())continue;const F=U||Py;L[B]||(L[B]={}),L[B][F]||(L[B][F]=[]),L[B][F].push(M)}return L},[x,_,S]),O=r!==void 0,D=O&&i?i-r:0,R=s.jsxs("div",{className:"space-y-6",children:[O&&s.jsx("div",{className:ae("rounded-xl p-4","bg-gradient-to-br from-primary/20 via-primary/10 to-primary/5","border border-primary/30","backdrop-blur-sm"),children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/20 flex items-center justify-center",children:s.jsx(el,{className:"w-6 h-6 text-primary"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Crédit restant"}),s.jsxs("p",{className:"text-2xl font-bold text-primary",children:[(r/100).toFixed(2),"€"]}),D>0&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:[(D/100).toFixed(2),"€ utilisés sur ",(i/100).toFixed(0),"€"]})]})]})}),a&&s.jsxs(Q,{onClick:()=>c(!0),className:ae("w-full py-3 gap-2.5 font-semibold","bg-gradient-to-r from-amber-600 to-amber-500 hover:from-amber-500 hover:to-amber-400","text-white border border-amber-400/30","shadow-md shadow-amber-500/20"),children:[s.jsx(nu,{className:"w-5 h-5"}),"Mon QR Code"]}),s.jsx(Ln,{open:l,onOpenChange:c,children:s.jsxs(Dn,{className:"max-w-xs sm:max-w-sm z-[110]",children:[s.jsx(Un,{children:s.jsx(qn,{
1249className:"font-display text-center",children:"Mon QR Code"})}),s.jsxs("div",{className:"flex flex-col items-center gap-4 py-2",children:[s.jsx("div",{className:ae("p-4 rounded-2xl bg-white","border-2 border-amber-500/30","shadow-lg shadow-amber-500/10"),children:s.jsx(eE,{value:a,size:200,level:"H",includeMargin:!1})}),o&&s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Code de réservation"}),s.jsx("p",{className:"font-mono text-2xl font-black tracking-widest text-foreground",children:o})]}),s.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Présentez ce code au bar pour commander"})]})]})}),y?s.jsxs("div",{className:"space-y-4",children:[s.jsx(Ie,{className:"h-6 w-24"}),s.jsx("div",{className:"grid grid-cols-2 gap-3",children:[1,2,3,4].map(L=>s.jsx(Ie,{className:"h-24"},L))})]}):!x||x.length===0?s.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[s.jsx(eu,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),s.jsx("p",{className:"font-medium",children:"Menu non disponible"}),s.jsx("p",{className:"text-sm mt-1",children:"Le catalogue du bar n'a pas encore été configuré."})]}):s.jsxs("div",{className:"space-y-4",children:[w&&s.jsx("div",{className:"sticky top-0 z-10 -mx-4 px-4 py-2 bg-background/95 backdrop-blur",children:s.jsxs("div",{className:"flex gap-1.5 overflow-x-auto scrollbar-hide",children:[s.jsx("button",{type:"button","aria-pressed":u===null,onClick:()=>T(null),className:ae("shrink-0 rounded-full border px-3 py-1 text-xs font-medium transition-colors",u===null?"bg-primary text-primary-foreground border-primary":"bg-background text-foreground border-border hover:bg-accent"),children:"Tout"}),b.map(L=>{const M=u===L;return s.jsxs("button",{type:"button","aria-pressed":M,onClick:()=>T(M?null:L),className:ae("shrink-0 rounded-full border px-3 py-1 text-xs font-medium transition-colors inline-flex items-center gap-1",M?"bg-primary text-primary-foreground border-primary":"bg-background text-foreground border-border hover:bg-accent"),children:[s.jsx("span",{"aria-hidden":!0,children:yz[L]??"📦"}),xz[L]??L]},L)})]})}),E&&s.jsxs("div",{className:"-mx-1 flex gap-1.5 overflow-x-auto pb-1 px-1",children:[s.jsx("button",{type:"button","aria-pressed":f===null,onClick:()=>h(null),className:ae("shrink-0 rounded-full border px-2.5 py-0.5 text-[11px] font-medium transition-colors",f===null?"bg-foreground text-background border-foreground":"bg-background text-muted-foreground border-border hover:bg-accent"),children:"Toutes"}),j.map(L=>{const M=(f==null?void 0:f.toLowerCase())===L.toLowerCase();return s.jsx("button",{type:"button","aria-pressed":M,onClick:()=>h(M?null:L),className:ae("shrink-0 rounded-full border px-2.5 py-0.5 text-[11px] font-medium transition-colors",M?"bg-foreground text-background border-foreground":"bg-background text-muted-foreground border-border hover:bg-accent"),children:L},L)})]}),Object.keys(P).length===0?s.jsx("p",{className:"text-center text-sm text-muted-foreground py-6",children:"Aucun produit dans ce filtre."}):s.jsx("div",{className:"space-y-5",children:Object.entries(P).map(([L,M])=>{const B=Object.entries(M).sort(([U],[F])=>U===Py?1:F===Py?-1:U.localeCompare(F,"fr",{sensitivity:"base"}));return s.jsxs("div",{children:[s.jsxs("h4",{className:"text-sm font-medium text-muted-foreground mb-3 flex items-center gap-2",children:[s.jsx("span",{children:yz[L]||"📦"}),s.jsx("span",{children:xz[L]||L})]}),s.jsx("div",{className:"space-y-3",children:B.map(([U,F])=>s.jsxs("div",{children:[(B.length>1||U!==Py)&&s.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80 mb-1.5",children:U===Py?XUe:U}),s.jsx("div",{className:"grid grid-cols-2 gap-2",children:F.map(H=>s.jsxs("div",{className:ae("p-3 rounded-xl border bg-card/50 backdrop-blur-sm","transition-all hover:bg-card hover:border-primary/30"),children:[s.jsx("p",{className:"font-medium text-sm line-clamp-2 min-h-[2.5rem]",children:H.name}),s.jsxs("p",{className:"text-lg font-bold text-primary mt-1",children:[(H.price_cents/100).toFixed(2),"€"]}),H.description&&s.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:H.description})]},H.id))})]},U))})]},L)})})]}),s.jsxs("div",{className:ae("rounded-lg p-3","bg-muted/50 border border-border","flex items-start gap-2.5"),children:[s.jsx(wl,{className:"w-4 h-4 text-muted-foreground flex-shrink-0 mt-0.5"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Présentez votre QR code au bar pour commander. Le staff déduira le montant de votre crédit."})]})]});return p?s.jsx(bd,{open:e,onOpenChange:t,children:s.jsxs(wd,{className:"max-h-[85vh]",children:[s.jsx(sh,{className:"border-b border-border pb-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(eu,{className:"w-5 h-5 text-primary"}),s.jsx(_d,{className:"font-display",children:"Menu du bar"})]})}),s.jsx("div",{className:"p-4 overflow-y-auto",children:R})]})}):s.jsx(Ln,{open:e,onOpenChange:t,children:s.jsxs(Dn,{className:"max-w-md max-h-[80vh] overflow-y-auto",children:[s.jsx(Un,{children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(eu,{className:"w-5 h-5 text-primary"}
1249),s.jsx(qn,{className:"font-display",children:"Menu du bar"})]})}),R]})})}function QUe(){return dt({mutationFn:async({eventId:e,code:t})=>{const n=t.trim();if(!n)throw new Error("Entrez un code de réservation");const{data:r,error:i}=await re.functions.invoke("redeem-ticket-code",{body:{eventId:e,code:n}});if(i){let a="Code introuvable pour cet événement";try{const o=i.context;if(o&&typeof o.json=="function"){const l=await o.json();l!=null&&l.error&&(a=l.error)}else i.message&&(a=i.message)}catch{}throw new Error(a)}if(!(r!=null&&r.accessToken)||!(r!=null&&r.eventId))throw new Error("Réponse invalide du serveur");return r}})}function lN({eventId:e,redirectToLive:t=!1,onSuccess:n,submitLabel:r="Accéder à mon billet"}){const[i,a]=N.useState(""),o=Rr(),l=QUe(),c=u=>{u.preventDefault(),i.trim()&&l.mutate({eventId:e,code:i},{onSuccess:d=>{je.success("Billet retrouvé !"),n==null||n(d.accessToken);const f=t?`/events/${e}/live?code=${d.accessToken}`:`/events/${e}/ticket?code=${d.accessToken}`;o(f,{replace:!0})},onError:d=>{je.error(d.message||"Code introuvable")}})};return s.jsxs("form",{onSubmit:c,className:"space-y-3 text-left",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Fe,{htmlFor:"reservation-code",className:"text-sm font-medium",children:"Code de réservation"}),s.jsx(Ue,{id:"reservation-code",value:i,onChange:u=>a(u.target.value.toUpperCase()),placeholder:"EX. A7K2P9",autoComplete:"one-time-code",inputMode:"text",autoCapitalize:"characters",maxLength:32,className:"font-mono tracking-widest text-center text-lg uppercase",disabled:l.isPending}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Le code à 6 caractères figure sur votre email de confirmation ou votre billet."})]}),s.jsx(Q,{type:"submit",size:"lg",className:"w-full gap-2",disabled:l.isPending||i.trim().length<4,children:l.isPending?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 animate-spin"}),"Vérification…"]}):s.jsxs(s.Fragment,{children:[s.jsx(vo,{className:"w-4 h-4"}),r]})})]})}function JUe(){var U;const{id:e}=Wi(),[t]=wc(),n=t.get("code"),{user:r,isLoading:i}=Tt(),a=!!n,o=Nte(r?e:void 0),l=Cte(a?e:void 0,n||void 0),c=l.data?[l.data]:[],u=o.data||[],d=i||(a?l.isLoading:o.isLoading),f=a&&!l.data&&(l.isFetching||l.isLoading),h=a&&c.length>0?c:u,{data:p}=sLe(e),x=kte(),[y,b]=N.useState(null),[w,_]=N.useState(null),[j,E]=N.useState(null),S=async F=>{try{await navigator.clipboard.writeText(F),je.success("Code copié !")}catch{je.error("Impossible de copier le code")}},T=(F,H)=>{const z=y;if(!z)return;const K=z.is_for_self!==!1?"Vous":`${z.guest_first_name||""} ${z.guest_last_name||""}`.trim()||"Invité",W=z.event?new Date(z.event.event_date):new Date;C0(W,new Date),x.mutate({ticketId:F,reason:H},{onSuccess:q=>{var oe,J;b(null),_({id:q.ticketId,participantName:K,creditLostCents:q.creditTotalCents,pricePaidCents:q.pricePaidCents,isFullRefund:q.isFullRefund,event:{title:q.eventTitle||((oe=z.event)==null?void 0:oe.title)||"Événement",event_date:((J=z.event)==null?void 0:J.event_date)||new Date().toISOString()}})}})},P=()=>{_(null),o.refetch()};if(d)return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("div",{className:"pt-24 pb-12",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-md",children:[s.jsx(Ie,{className:"h-8 w-32 mb-6"}),s.jsx(Ie,{className:"h-[500px]"})]})})]});if(!h||h.length===0){if(w){const F=w.isFullRefund?((w.pricePaidCents||0)/100).toFixed(2):((w.creditLostCents||0)/100).toFixed(2);return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("div",{className:"pt-24 pb-12",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-md text-center py-12",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-4",children:s.jsx(Jr,{className:"w-8 h-8 text-primary"})}),s.jsx("h1",{className:"font-display text-2xl font-bold mb-2",children:"Annulation confirmée"}),s.jsx("p",{className:"text-muted-foreground mb-6",children:w.participantName==="Vous"?"Votre annulation a bien été prise en compte.":`L'annulation pour ${w.participantName} a bien été prise en compte.`}),s.jsx(Se,{className:"mb-6 text-left",children:s.jsxs(De,{className:"p-4 space-y-2",children:[s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Événement"}),s.jsx("span",{className:"font-medium",children:w.event.title})]}),s.jsx(Fs,{}),s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Remboursement"}),s.jsx("span",{className:"font-medium",children:w.isFullRefund?"Complet":"Partiel (crédit uniquement)"})]}),s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Montant"}),s.jsxs("span",{className:"font-bold text-primary",children:[F,"€"]})]})]})}),s.jsx("p",{className:"text-xs text-muted-foreground mb-6",children:"Le remboursement sera effectué sous 5 à 10 
1249jours ouvrés sur votre moyen de paiement."}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(Pe,{to:`/events/${e}/register`,className:"block",children:s.jsxs(Q,{className:"w-full gap-2",children:[s.jsx(Il,{className:"w-4 h-4"}),"Se réinscrire"]})}),s.jsx(Pe,{to:`/events/${e}`,className:"block",children:s.jsxs(Q,{variant:"outline",className:"w-full gap-2",children:[s.jsx(Fn,{className:"w-4 h-4"}),"Retour à l'événement"]})}),s.jsx(Pe,{to:"/player/history",className:"block",children:s.jsxs(Q,{variant:"ghost",className:"w-full gap-2",children:[s.jsx(i1,{className:"w-4 h-4"}),"Voir mon historique"]})})]})]})})]})}return f?s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("div",{className:"pt-24 pb-12",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-md text-center py-12",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-4 animate-pulse",children:s.jsx(Cn,{className:"w-8 h-8 text-primary"})}),s.jsx("h1",{className:"font-display text-2xl font-bold mb-2",children:"Synchronisation de votre billet…"}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Votre paiement vient d'être confirmé. Nous chargeons votre billet, cela ne prend que quelques secondes."}),s.jsx(Ie,{className:"h-[320px]"})]})})]}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("div",{className:"pt-24 pb-12",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-md text-center py-12",children:[s.jsx("h1",{className:"font-display text-2xl font-bold mb-3",children:"Retrouvez votre billet"}),s.jsx("p",{className:"text-muted-foreground mb-6",children:a?"On n'a pas pu ouvrir ce lien. Si vous venez de payer, entrez le code à 6 caractères reçu par email — ou contactez le staff sur place avec votre email.":"Vous n'avez pas encore de billet pour cet événement. Si vous avez payé en mode invité, retrouvez votre billet avec le code de réservation reçu par email."}),s.jsx(Se,{className:"text-left mb-6",children:s.jsx(De,{className:"p-5",children:s.jsx(lN,{eventId:e})})}),s.jsx(Pe,{to:`/events/${e}`,children:s.jsx(Q,{variant:"outline",children:"Voir l'événement"})})]})})]})}const O=h[0],D=a&&"event_title"in O,R=D?{title:O.event_title,event_date:O.event_date,status:void 0,credit_amount_cents:O.credit_total_cents,price_cents:O.price_paid_cents,coupon_mode:O.coupon_mode,paper_coupon_label:O.paper_coupon_label,paper_coupon_description:O.paper_coupon_description,paper_coupon_formulas:O.paper_coupon_formulas}:O.event,L=D?{id:void 0,name:O.venue_name,address:O.venue_address,city:O.venue_city,default_coupon_mode:O.coupon_mode}:(U=O.event)==null?void 0:U.venue,M=h.length,B=M>1;return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("main",{className:"pt-24 pb-12",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-md",children:[s.jsxs(Pe,{to:`/events/${e}`,className:"inline-flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors mb-6",children:[s.jsx(Fn,{className:"w-4 h-4"}),"Retour à l'événement"]}),s.jsxs("div",{className:"text-center mb-6",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-4",children:s.jsx(Cn,{className:"w-8 h-8 text-primary"})}),s.jsx("h1",{className:"font-display text-2xl font-bold mb-2",children:B?`${M} inscriptions confirmées !`:"Inscription confirmée !"}),s.jsx("p",{className:"text-muted-foreground",children:B?"Présentez chaque ticket au check-in":"Présentez ce ticket à l'accueil le jour J"})]}),s.jsx(nse,{className:"mb-6",nextPath:`/events/${e}/ticket`}),R&&s.jsxs("div",{className:"bg-muted/50 rounded-xl p-4 mb-6 space-y-3",children:[s.jsx("h3",{className:"font-semibold",children:R.title}),s.jsxs("div",{className:"grid gap-2 text-sm",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Jn,{className:"w-4 h-4 text-primary"}),s.jsx("span",{children:Ze(new Date(R.event_date),"EEEE d MMMM yyyy",{locale:pt})})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Vt,{className:"w-4 h-4 text-primary"}
1249),s.jsx("span",{children:Ze(new Date(R.event_date),"HH'h'mm",{locale:pt})})]}),L&&L.name&&s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(gn,{className:"w-4 h-4 text-primary mt-0.5"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:L.name}),s.jsxs("p",{className:"text-muted-foreground",children:[L.address,", ",L.city]})]})]})]})]}),s.jsx("div",{className:"space-y-4",children:h.map((F,H)=>{const z=D?F.is_checked_in:F.status==="checked_in"||(Array.isArray(F.checkin)?F.checkin.length>0:!!F.checkin),K=F.is_for_self!==!1,W=!K&&F.guest_first_name?`${F.guest_first_name}${F.guest_last_name?` ${F.guest_last_name}`:""}`:null,q=F.qr_code,oe=F.reservation_code,J=F.credit_remaining_cents,Y=F.credit_total_cents,Z=F.access_token||a&&n||void 0,G=Z?`${window.location.origin}/events/${e}/ticket?code=${Z}`:q,se=Z?`${window.location.origin}/events/${e}/ticket?code=${Z}`:null;return s.jsxs(Se,{className:ae("overflow-hidden",z&&"border-green-500/50"),children:[s.jsxs(kt,{className:"bg-primary text-primary-foreground text-center pb-4 relative",children:[s.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[K?s.jsx(Cs,{className:"w-5 h-5"}):s.jsx(sn,{className:"w-5 h-5"}),s.jsx("span",{className:"text-sm font-medium uppercase tracking-wider",children:B?`Ticket #${H+1}${K?"":" — Invité"}`:"Ticket d'entrée"})]}),s.jsx(Et,{className:"font-display text-lg",children:a?F.guest_first_name||"Invité":K?"Pour moi":W||"Invité"}),!a&&F.guest_notes&&s.jsx("p",{className:"text-sm text-primary-foreground/80 mt-1",children:F.guest_notes})]}),s.jsxs(De,{className:"p-6 space-y-4",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx("div",{className:"p-4 bg-white rounded-lg",children:s.jsx(eE,{value:G,size:160,level:"H",includeMargin:!1})})}),se&&s.jsx("p",{className:"text-center text-[11px] text-muted-foreground -mt-2",children:"Scannez ce QR avec n'importe quel téléphone pour ouvrir le billet"}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Code de réservation"}),s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx("span",{className:"font-mono text-xl font-bold tracking-widest",children:oe}),s.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>S(oe),children:s.jsx(Ko,{className:"w-4 h-4"})})]})]}),s.jsx(Fs,{}),s.jsx("div",{className:"flex justify-center",children:z?s.jsxs(we,{variant:"default",className:"bg-green-600",children:[s.jsx(Cn,{className:"w-3 h-3 mr-1"}),"Check-in validé"]}):s.jsx(we,{variant:"secondary",children:"En attente du check-in"})}),(()=>{const ce=od(R);return ce.hasPerk?ce.mode==="paper"?s.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg p-3 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{children:"🎟️"}),s.jsx("p",{className:"font-medium text-sm flex-1",children:ce.shortLabel}),s.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"remis sur place"})]}),ce.hint&&s.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-line",children:ce.hint}),ce.bullets.length>0&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:ce.bullets.length>1?"Au choix sur place":"Inclus"}),ce.bullets.map((fe,be)=>s.jsxs("div",{className:"rounded-md border bg-background/60 px-3 py-2 text-sm",children:[s.jsx("p",{className:"font-medium",children:fe.name}),fe.description&&s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:fe.description})]},be))]})]}):s.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Crédit conso"}),s.jsxs("p",{className:"text-lg font-bold text-primary",children:[(J/100).toFixed(2),"€",J<Y&&s.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:[" ","/ ",(Y/100).toFixed(2),"€"]})]}
1249),s.jsx("p",{className:"text-[11px] text-muted-foreground/80 mt-1",children:"Sur une sélection de la carte du lieu"})]}):null})(),(R==null?void 0:R.status)!=="cancelled"&&(()=>{const ce=od(R);return ce.hasPerk&&ce.mode==="digital"})()&&(!a&&(L==null?void 0:L.id)||a&&(R==null?void 0:R.venue_id))&&s.jsxs(Q,{variant:"outline",className:"w-full gap-2",onClick:()=>E({venueId:(L==null?void 0:L.id)||(R==null?void 0:R.venue_id),creditRemaining:J,creditTotal:Y}),children:[s.jsx(eu,{className:"w-4 h-4"}),"Voir le menu du bar"]}),!a&&!K&&se&&s.jsxs(Q,{variant:"ghost",size:"sm",className:"w-full gap-2 text-xs",onClick:()=>S(se),children:[s.jsx(Ko,{className:"w-3 h-3"}),"Copier le lien d'accès pour cet invité"]})]})]},F.id)})}),s.jsx("div",{className:"mt-6 space-y-3",children:a?s.jsxs(s.Fragment,{children:[s.jsx(Pe,{to:`/events/${e}/live?code=${n}`,className:"block",children:s.jsxs(Q,{className:"w-full gap-2",children:[s.jsx(Xt,{className:"w-4 h-4"}),"Accéder au tournoi live"]})}),s.jsx(Pe,{to:`/auth?mode=signup&email=${encodeURIComponent(O.guest_email||"")}`,className:"block",children:s.jsxs(Q,{variant:"outline",className:"w-full gap-2",children:[s.jsx(cs,{className:"w-4 h-4"}),"Créer mon compte Chess Agenda"]})}),s.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"Créez un compte pour gérer vos tickets, suivre vos stats et participer aux appariements automatiques."})]}):s.jsxs(s.Fragment,{children:[((R==null?void 0:R.status)==="ongoing"||(R==null?void 0:R.status)==="completed")&&s.jsx(Pe,{to:`/player/tournament/${e}`,className:"block",children:s.jsxs(Q,{className:"w-full gap-2",variant:(R==null?void 0:R.status)==="completed"?"outline":"default",children:[s.jsx(Xt,{className:"w-4 h-4"}),(R==null?void 0:R.status)==="completed"?"Voir les résultats":"Accéder au tournoi"]})}),s.jsx(Pe,{to:"/player",className:"block",children:s.jsxs(Q,{variant:"outline",className:"w-full gap-2",children:[s.jsx(pd,{className:"w-4 h-4"}),"Voir mes inscriptions"]})})]})}),s.jsx("div",{className:"mt-6 text-center text-sm text-muted-foreground",children:s.jsxs("p",{children:["💡 ",B?"Chaque ticket doit être présenté individuellement au check-in.":"Pensez à capturer ce ticket ou à noter votre code."]})}),!a&&R&&p&&s.jsx(YUe,{eventId:e,eventPrice:R.price_cents,eventCredit:R.credit_amount_cents,spotsLeft:p.spotsLeft,canRegister:p.canRegister}),!a&&o.data&&s.jsx(KUe,{tickets:o.data.map(F=>({id:F.id,reservation_code:F.reservation_code,is_for_self:F.is_for_self,guest_first_name:F.guest_first_name,guest_last_name:F.guest_last_name,credit_total_cents:F.credit_total_cents,price_paid_cents:F.price_paid_cents,status:F.status,event:F.event?{title:F.event.title,event_date:F.event.event_date,status:F.event.status,cancellation_deadline_hours:F.event.cancellation_deadline_hours}:null})),onCancelRequest:F=>{var z;const H=(z=o.data)==null?void 0:z.find(K=>K.id===F.id);H&&b(H)}})]})}),s.jsx(Rl,{source:"footer-ticket"}),!a&&s.jsx(WUe,{ticket:y?{id:y.id,reservation_code:y.reservation_code,is_for_self:y.is_for_self,guest_first_name:y.guest_first_name,guest_last_name:y.guest_last_name,credit_total_cents:y.credit_total_cents,price_paid_cents:y.price_paid_cents,event:y.event?{title:y.event.title,event_date:y.event.event_date,cancellation_deadline_hours:y.event.cancellation_deadline_hours}:null}:null,open:!!y,onOpenChange:F=>!F&&b(null),onConfirm:T,isLoading:x.isPending}),s.jsx(GUe,{ticket:w,open:!!w,onClose:P}),j&&s.jsx(w6,{venueId:j.venueId,creditRemainingCents:j.creditRemaining,creditTotalCents:j.creditTotal,open:!!j,onOpenChange:F=>!F&&E(null)})]})}function ZUe(){const{id:e}=Wi();return e?s.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[s.jsx(tr,{}),s.jsx("main",{className:"flex-1 pt-24 pb-12 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-md",children:[s.jsxs(Pe,{to:`/events/${e}`,className:"inline-flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors mb-6",children:[s.jsx(Fn,{className:"w-4 h-4"}),"Retour à l'événement"]}),s.jsxs("div",{className:"text-center mb-6",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-4",children:s.jsx(vo,{className:"w-8 h-8 text-primary"})}),s.jsx("h1",{className:"font-display text-2xl font-bold mb-2",children:"Accéder à mon billet"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Entrez votre code de réservation pour retrouver votre billet, voir les appariements et profiter de votre avantage sur place."})]}),s.jsx(Se,{children:s.jsx(De,{className:"p-5",children:s.jsx(lN,{eventId:e})})}),s.jsxs("div",{className:"mt-6 text-center text-sm text-muted-foreground",children:["Vous avez un compte ?"," ",s.jsx(Pe,{to:`/auth?redirect=/events/${e}/ticket`,className:"text-primary hover:underline",children:"Se connecter"})]})]})}),s.jsx(Rl,{source:"footer-ticket-access"})]}):null}const Qoe=N.createContext(void 0);function eqe({children:e}){const[t,n]=N.useState(!1),r=N.useCallback(i=>{n(i)},[]);return s.jsx(Qoe.Provider,{value:{isTimerActive:t,setTimerActive:r},children:e})}function _6(){const e=N.useContext(Qoe);return e||{isTimerActive:!1,setTimerActive:()=>{}}}function Joe(e){const{isTimerActive:t}=_6(),n=Ye();return N.useEffect(()=>{if(!e)return;const r=re.channel(`tournament-rounds-${e}`).on("postgres_changes",{event:"*",schema:"public",table:"rounds",filter:`event_id=eq.${e}`},()=>{setTimeout(()=>{n.invalidateQueries({queryKey:["tournament-data",e]}
1249)},0)}).subscribe();return()=>{re.removeChannel(r)}},[e,n]),st({queryKey:["tournament-data",e],queryFn:async()=>{var l;if(!e)return{event:null,rounds:[],participantCount:0};const[r,i,a]=await Promise.all([re.from("events").select(`
1250            id,
1251            title,
1252            event_date,
1253            status,
1254            rounds_count,
1255            time_control,
1256            capacity,
1257            tiebreak_criteria,
1258            venue:venues(id, name, city)
1259          `).eq("id",e).maybeSingle(),re.from("rounds").select("*").eq("event_id",e).order("round_number",{ascending:!0}),re.rpc("get_event_checkedin_count",{p_event_id:e})]);if(r.error)throw r.error;if(i.error)throw i.error;let o=null;if((l=r.data)!=null&&l.venue){const c=r.data.venue;o=Array.isArray(c)?c[0]||null:c}return{event:r.data?{...r.data,venue:o,tiebreak_criteria:r.data.tiebreak_criteria}:null,rounds:i.data||[],participantCount:a.data||0}},enabled:!!e,staleTime:t?6e4:5e3,gcTime:6e4,placeholderData:hp,refetchInterval:t?!1:1e4,refetchOnWindowFocus:!0,refetchOnReconnect:!0})}const Zoe=1e4,ele=3,tle=2e3,tqe=5e4,nqe=5,rqe=4e3;let Tj=Zoe;const C4=1e3;let b_=ele,Oo=tle,Gc=!1,Am=0,cN=null,sqe=!1;function Vs(e,t=!1){const n=e.colorHistory.filter(l=>l==="white").length,r=e.colorHistory.filter(l=>l==="black").length,i=n-r,a=e.colorHistory.slice(-2),o=a.length===2&&a[0]===a[1];if(Math.abs(i)>1||o)return o?{type:"absolute",color:a[0]==="white"?"black":"white"}:{type:"absolute",color:i>0?"black":"white"};if(i===1||i===-1){const l=i===1?"black":"white";return t?{type:"absolute",color:l}:{type:"strong",color:l}}return e.colorHistory.length>0?{type:"mild",color:e.colorHistory[e.colorHistory.length-1]==="white"?"black":"white"}:{type:"none",color:null}}function nE(e,t){return!e.opponents.includes(t.id)&&!t.opponents.includes(e.id)}function iqe(e,t){const n=e.colorHistory.slice(-2),r=t.colorHistory.slice(-2),i=n.length===2&&n[0]==="black"&&n[1]==="black",a=n.length===2&&n[0]==="white"&&n[1]==="white",o=r.length===2&&r[0]==="black"&&r[1]==="black",l=r.length===2&&r[0]==="white"&&r[1]==="white";return!!(i&&o||a&&l)}function aqe(e,t,n){if(e.length===0)return!0;const r=t.filter(i=>!n.has(i.id));for(const i of e)if(!r.some(o=>nE(i,o)&&!uN(i,o)))return!1;return!0}function uN(e,t,n=!1){const r=Vs(e,n),i=Vs(t,n);return r.type==="absolute"&&i.type==="absolute"&&r.color===i.color}function dN(e,t){const n=e.floatHistory;return n.length<2?!1:n[n.length-2]===t}function Dv(e,t){const n=e.floatHistory;return n.length<1?!1:n[n.length-1]===t}function nle(e,t,n=0){let r=0,i=0,a=0;for(const[o,l]of e){const c=Vs(o,t),u=Vs(l,t);if(c.color&&u.color&&c.color===u.color&&(c.type==="absolute"||c.type==="strong"||u.type==="absolute"||u.type==="strong"?r++:(c.type==="mild"||u.type==="mild")&&i++),Gc){const d=Vf(o,n),f=Vf(l,n);if(d||f){const[p,x]=oqe(o,l),y=p.colorHistory.filter(S=>S==="white").length+1,b=p.colorHistory.filter(S=>S==="black").length,w=x.colorHistory.filter(S=>S==="white").length,_=x.colorHistory.filter(S=>S==="black").length+1;(Math.abs(y-b)>2||Math.abs(w-_)>2)&&a++;const j=p.colorHistory.slice(-2),E=x.colorHistory.slice(-2);j.length===2&&j[0]==="white"&&j[1]==="white"&&a++,E.length===2&&E[0]==="black"&&E[1]==="black"&&a++}}}return{colorViolations:r,mildViolations:i,topScorerColorViolations:a}}function oqe(e,t){return Pj(e,t,0)}function lqe(e,t,n,r){if(!nE(e,t)||iqe(e,t))return!1;if(uN(e,t,!1)){if(n.enforceB2)return!1;const i=Gc&&Vf(e,Am),a=Gc&&Vf(t,Am);if(!i&&!a)return!1}return!(n.enforceA7d&&r&&uN(e,t,!0))}function Pj(e,t,n=0){if(n===1&&e.colorHistory.length===0&&t.colorHistory.length===0){const c=e.tpn<t.tpn?e:t;return[c,c===e?t:e]}const r=Vs(e),i=Vs(t);if(r.type==="absolute"&&i.type==="absolute"){if(r.color!==i.color)return r.color==="white"?[e,t]:[t,e];const c=Gc&&Vf(e,Am),u=Gc&&Vf(t,Am);if(c||u){const h=Math.abs(e.colorHistory.filter(x=>x==="white").length-e.colorHistory.filter(x=>x==="black").length),p=Math.abs(t.colorHistory.filter(x=>x==="white").length-t.colorHistory.filter(x=>x==="black").length);if(h!==p){const x=h>p?e:t,y=x===e?t:e;return r.color==="white"?[x,y]:[y,x]}}const d=e.tpn<t.tpn?e:t,f=d===e?t:e;return r.color==="white"?[d,f]:[f,d]}if(r.type==="absolute")return r.color==="white"?[e,t]:[t,e];if(i.type==="absolute")return i.color==="white"?[t,e]:[e,t];if(r.type==="strong"&&i.type==="strong"){if(r.color!==i.color)return r.color==="white"?[e,t]:[t,e];const c=e.tpn<t.tpn?e:t,u=c===e?t:e;return r.color==="white"?[c,u]:[u,c]}if(r.type==="strong")return r.color==="white"?[e,t]:[t,e];if(i.type==="strong")return i.color==="white"?[t,e]:[e,t];if(r.type==="mild"&&i.type==="mild"&&r.color!==i.color)return r.color==="white"?[e,t]:[t,e];if(r.type==="mild"&&i.type==="mild"&&r.color===i.color){const c=cqe(e,t);if(c)return c}const a=e.tpn<t.tpn?e:t,o=e.tpn<t.tpn?t:e,l=Vs(a);return l.color==="white"?[a,o]:l.color==="black"?[o,a]:[a,o]}function cqe(e,t){const n=e.colorHistory,r=t.colorHistory,i=Math.min(n.length,r.length);for(let a=1;a<=i;a++){const o=n[n.length-a],l=r[r.length-a];if(o!==l)return o==="white"?[t,e]:[e,t]}return null}function vz(e,t){let n=0,r=0,i=0,a=0,o=0,l=0;for(const f of e){if(f.colorHistory.length===0){o++;continue}const h=Vs(f,t);h.type==="absolute"||h.type==="strong"?h.color==="white"?n++:r++:!t&&h.type==="mild"&&(h.color==="white"?i++:h.color==="black"?a++:l++)}!t&&l>0&&(n>r?a+=l:i+=l);const c=Math.floor(e.length/2);let u;r+a>
1259n+i?u=c-n-i-o:u=c-r-a-o,u=Math.max(0,u);let d;return t?d=c:(r>n?d=c-n-a-i-o:d=c-r-a-i-o,d=Math.max(0,d)),{x1:u,z1:d}}function uqe(e){const t=e.filter(r=>!r.hadBye&&!r.hadForfeitWin),n=t.length>0?t:[...e];return n.sort((r,i)=>{if(r.score!==i.score)return r.score-i.score;const a=r.colorHistory.length,o=i.colorHistory.length;return a!==o?o-a:i.tpn-r.tpn}),n[0]||null}function dqe(e){const t=e.length;if(t<=1)return!1;let n=t-2;for(;n>=0&&e[n]>=e[n+1];)n--;if(n<0)return!1;let r=t-1;for(;e[r]<=e[n];)r--;[e[n],e[r]]=[e[r],e[n]];let i=n+1,a=t-1;for(;i<a;)[e[i],e[a]]=[e[a],e[i]],i++,a--;return!0}function*fqe(e,t){const n=[];for(let r=0;r<e;r++)for(let i=0;i<t;i++)n.push({s1Idx:r,s2Idx:i,differenz:i-r+e});n.sort((r,i)=>r.differenz!==i.differenz?r.differenz-i.differenz:r.s1Idx!==i.s1Idx?i.s1Idx-r.s1Idx:r.s2Idx-i.s2Idx);for(const r of n)yield[r.s1Idx,r.s2Idx]}function*bz(e,t,n=2){if(e<n||t<n)return;function r(l,c){const u=[],d=[];function f(h){if(d.length===c){u.push([...d]);return}for(let p=h;p<l;p++)d.push(p),f(p+1),d.pop()}return f(0),u}const i=r(e,n),a=r(t,n),o=[];for(const l of i)for(const c of a){const u=l.reduce((f,h)=>f+h,0),d=c.reduce((f,h)=>f+h,0);o.push({s1:l,s2:c,diff:d-u})}o.sort((l,c)=>{if(l.diff!==c.diff)return l.diff-c.diff;for(let u=l.s1.length-1;u>=0;u--)if(c.s1[u]!==l.s1[u])return c.s1[u]-l.s1[u];for(let u=0;u<l.s2.length;u++)if(l.s2[u]!==c.s2[u])return l.s2[u]-c.s2[u];return 0});for(const l of o)yield[l.s1,l.s2]}function wz(e,t,n,r){const i=[...e],a=[...t];for(let o=0;o<n.length;o++){const l=i[n[o]];i[n[o]]=a[r[o]],a[r[o]]=l}return i.sort((o,l)=>o.tpn-l.tpn),a.sort((o,l)=>o.tpn-l.tpn),{newS1:i,newS2:a}}function*hqe(e,t=!1){yield e;for(let n=e.length-1;n>=1;n--){if(t){yield e.slice(0,n);continue}const r=Array.from({length:n},(i,a)=>a);for(;;){yield r.map(a=>e[a]);let i=n-1;for(;i>=0&&r[i]===e.length-n+i;)i--;if(i<0)break;r[i]++;for(let a=i+1;a<n;a++)r[a]=r[a-1]+1}}}function mqe(e){const t=new Map;for(const n of e){const r=t.get(n.score)||[];r.push(n),t.set(n.score,r)}for(const[n,r]of t)r.sort((i,a)=>i.tpn-a.tpn),t.set(n,r);return t}function Oy(e,t){const n=Math.max(e.length,t.length);for(let r=0;r<n;r++){const i=r<e.length?e[r]:0,a=r<t.length?t[r]:0;if(i!==a)return i-a}return 0}function pqe(e,t,n=0){const{colorViolations:r,mildViolations:i,topScorerColorViolations:a}=nle(e.pairs,t,n);let o=0,l=0,c=0,u=0;const d=[],f=[],h=[],p=[],x=e.residentIds?new Set(e.residentIds):null;for(const _ of e.floaters)Dv(_,"down")&&(!x||x.has(_.id))&&(l++,d.push(_.score)),Dv(_,"up")&&(!x||!x.has(_.id))&&(o++,f.push(_.score)),dN(_,"down")&&(!x||x.has(_.id))&&(u++,h.push(_.score)),dN(_,"up")&&(!x||!x.has(_.id))&&(c++,p.push(_.score));d.sort((_,j)=>j-_),f.sort((_,j)=>j-_),h.sort((_,j)=>j-_),p.sort((_,j)=>j-_);const y=e.floaters.map(_=>_.score).sort((_,j)=>j-_);let b=0;for(const[_,j]of e.pairs){const E=_.score-j.score;b+=E*E}let w=0;if(cN!==null&&e.floaters.length>0)for(const _ of e.floaters){const j=_.score-cN;j>0&&(w+=j)}return{pairs:e.pairs.length,floaterScoresDesc:y,topScorerColorViolations:a,colorViolations:r,mildViolations:i,b6DownCount:l,b6UpCount:o,b5DownCount:u,b5UpCount:c,b6DownScoreDiffs:d,b6UpScoreDiffs:f,b5DownScoreDiffs:h,b5UpScoreDiffs:p,b3Factor:b,totalCrossBracketGap:w}}function gqe(e,t){if(e.pairs!==t.pairs)return e.pairs>t.pairs;const n=Oy(e.floaterScoresDesc,t.floaterScoresDesc);if(n!==0)return n<0;if(e.topScorerColorViolations!==t.topScorerColorViolations)return e.topScorerColorViolations<t.topScorerColorViolations;if(e.colorViolations!==t.colorViolations)return e.colorViolations<t.colorViolations;if(e.mildViolations!==t.mildViolations)return e.mildViolations<t.mildViolations;if(e.b6DownCount!==t.b6DownCount)return e.b6DownCount<t.b6DownCount;if(e.b6UpCount!==t.b6UpCount)return e.b6UpCount<t.b6UpCount;if(e.b5DownCount!==t.b5DownCount)return e.b5DownCount<t.b5DownCount;if(e.b5UpCount!==t.b5UpCount)return e.b5UpCount<t.b5UpCount;const r=Oy(e.b6DownScoreDiffs,t.b6DownScoreDiffs);if(r!==0)return r<0;const i=Oy(e.b6UpScoreDiffs,t.b6UpScoreDiffs);if(i!==0)return i<0;const a=Oy(e.b5DownScoreDiffs,t.b5DownScoreDiffs);if(a!==0)return a<0;const o=Oy(e.b5UpScoreDiffs,t.b5UpScoreDiffs);return o!==0?o<0:e.b3Factor!==t.b3Factor?e.b3Factor<t.b3Factor:!1}function xqe(e,t){return e.pairs===t&&e.floaterScoresDesc.length===0&&e.to
1259pScorerColorViolations===0&&e.colorViolations===0&&e.mildViolations===0&&e.b6DownCount===0&&e.b6UpCount===0&&e.b5DownCount===0&&e.b5UpCount===0&&e.b3Factor===0&&!0}function Iv(e,t,n,r,i,a=0){const o=[],l=e.length;if(l===0)return{pairs:[],floaters:[],warnings:o};if(l===1)return{pairs:[],floaters:[e[0]],warnings:o};let c,u,d;if(i)c=[...i.s1],u=[...i.s2],d=c.length;else{const w=[...e].sort((_,j)=>_.tpn-j.tpn);d=Math.floor(l/2),c=w.slice(0,d),u=w.slice(d)}let f=null,h=null;const p=w=>{if(!w||w.pairs.length===0)return!1;const _=pqe(w,r,a);return(!f||gqe(_,h))&&(f=w,h=_),!!(w.pairs.length===d&&xqe(_,d))},x=w_(c,u,t,d,n,r,a);if(p(x))return{...f,warnings:o};let y=0;const b=fqe(c.length,u.length);for(const[w,_]of b){if(Date.now()-n>Oo||++y>C4)break;const j=[...c],E=[...u],S=j[w];j[w]=E[_],E[_]=S,j.sort((P,O)=>P.tpn-O.tpn),E.sort((P,O)=>P.tpn-O.tpn);const T=w_(j,E,t,d,n,r,a);if(p(T))return{...f,warnings:o}}if((!f||f.pairs.length<d)&&c.length>=2&&u.length>=2){let w=0;const _=bz(c.length,u.length,2);for(const[j,E]of _){if(Date.now()-n>Oo||++w>C4)break;const{newS1:S,newS2:T}=wz(c,u,j,E),P=w_(S,T,t,d,n,r,a);if(p(P))return{...f,warnings:o}}}if((!f||f.pairs.length<d)&&c.length>=3&&u.length>=3){let w=0;const _=bz(c.length,u.length,3);for(const[j,E]of _){if(Date.now()-n>Oo||++w>C4)break;const{newS1:S,newS2:T}=wz(c,u,j,E),P=w_(S,T,t,d,n,r,a);if(p(P))return{...f,warnings:o}}}return f&&f.pairs.length>0?{...f,warnings:o}:{pairs:[],floaters:[...c,...u],warnings:o}}function w_(e,t,n,r,i,a,o=0){const l=t.map((d,f)=>f);let c=null,u=0;do{if(Date.now()-i>Oo||++u>Tj)break;const d=yqe(e,t,l,n,a,o);if((!c||d.pairs.length>c.pairs.length)&&(c=d),d.pairs.length===r)return d}while(dqe(l));return c}function yqe(e,t,n,r,i,a=0){const o=[],l=new Set,c=new Set,u=[];for(let f=0;f<e.length&&f<n.length;f++){const h=n[f];if(h>=t.length)continue;const p=e[f],x=t[h];lqe(p,x,r,i)&&(o.push([p,x]),l.add(f),c.add(h))}if(o.length>0){const{colorViolations:f,mildViolations:h,topScorerColorViolations:p}=nle(o,i,a);if(p>r.maxTopScorerColorViolations||f>r.maxColorViolations||h>r.maxMildViolations)return{pairs:[],floaters:[...e,...t],warnings:u}}const d=[];for(let f=0;f<e.length;f++)l.has(f)||d.push(e[f]);for(let f=0;f<t.length;f++)c.has(f)||d.push(t[f]);return{pairs:o,floaters:d,warnings:u}}function*_z(e,t,n,r){const i={maxB6UpViolations:0,maxB6DownViolations:0,maxB5UpViolations:0,maxB5DownViolations:0,maxTopScorerColorViolations:0,maxColorViolations:e,maxMildViolations:t,enforceA7d:!0,enforceB2:!0};yield{req:{...i},relaxed:"none"};for(let a=1;a<=n;a++)i.maxB6UpViolations=a,yield{req:{...i},relaxed:`B6-up≤${a}`};for(let a=1;a<=n;a++)i.maxB5UpViolations=a,yield{req:{...i},relaxed:`B5-up≤${a}`};for(let a=1;a<=n;a++)i.maxB6DownViolations=a,yield{req:{...i},relaxed:`B6-down≤${a}`};for(let a=1;a<=n;a++)i.maxB5DownViolations=a,yield{req:{...i},relaxed:`B5-down≤${a}`};for(let a=1;a<=n;a++)i.maxTopScorerColorViolations=a,yield{req:{...i},relaxed:`TopColor≤${a}`};if(r)for(let a=e+1;a<=n;a++)i.maxColorViolations=a,yield{req:{...i},relaxed:`X=${a}`};else for(let a=e;a<=n;a++){const o=a===e?t+1:t;for(let l=o;l<=a;l++)i.maxColorViolations=a,i.maxMildViolations=l,yield{req:{...i},relaxed:`X=${a},Z=${l}`};a<n&&(i.maxColorViolations=a+1,i.maxMildViolations=t,yield{req:{...i},relaxed:`X=${a+1}`})}i.maxColorViolations=n,i.maxMildViolations=n,i.enforceA7d=!1,yield{req:{...i},relaxed:"A7d"},i.enforceB2=!1,yield{req:{...i},relaxed:"B2"}}function vqe(e,t){const n=e.filter(i=>!i.isBye),r=e.filter(i=>i.isBye);n.sort((i,a)=>{const o=t.get(i.whitePlayerId),l=i.blackPlayerId?t.get(i.blackPlayerId):null,c=t.get(a.whitePlayerId),u=a.blackPlayerId?t.get(a.blackPlayerId):null,d=Math.max((o==null?void 0:o.score)||0,(l==null?void 0:l.score)||0),f=Math.max((c==null?void 0:c.score)||0,(u==null?void 0:u.score)||0);if(f!==d)return f-d;const h=((o==null?void 0:o.score)||0)+((l==null?void 0:l.score)||0),p=((c==null?void 0:c.score)||0)+((u==null?void 0:u.score)||0);if(p!==h)return p-h;const x=Math.min((o==null?void 0:o.tpn)||9999,(l==null?void 0:l.tpn)||9999),y=Math.min((c==null?void 0:c.tpn)||9999,(u==null?void 0:u.tpn)||9999);return x-y}
1259),n.forEach((i,a)=>{i.tableNumber=a+1}),e.length=0,e.push(...n,...r)}function Vf(e,t){return e.score>t*.5}function jz(e,t,n,r,i,a,o=0){const l=[];let c=null;const u=t.map(h=>h.id);let d=!1;for(const h of hqe(e,sqe)){if(Date.now()-r>Oo)break;const p=[...h,...t],x=[...h].sort((_,j)=>_.tpn-j.tpn),y=[...t].sort((_,j)=>_.tpn-j.tpn),b=Math.min(h.length,Math.floor(p.length/2)),w=Iv(p,n,r,i,{s1:x,s2:y},o);if(w.pairs.length>=b||h.length<=1){const _=new Set;for(const[D,R]of w.pairs)_.add(D.id),_.add(R.id);const j=h.filter(D=>!_.has(D.id)),E=t.filter(D=>!_.has(D.id)),T=[...e.filter(D=>!h.some(R=>R.id===D.id)&&!_.has(D.id)),...j];if(E.length>=2){d=!0;const D=Iv(E,n,r,i,void 0,o),R=w.pairs.length+D.pairs.length,L=Math.floor((h.length+t.length)/2);if(R>=L)return{pairs:[...w.pairs,...D.pairs],floaters:[...T,...D.floaters],warnings:[...l,...w.warnings,...D.warnings],remainderReached:d,residentIds:u};const M={pairs:[...w.pairs,...D.pairs],floaters:[...T,...D.floaters],warnings:[...l,...w.warnings,...D.warnings],remainderReached:d,residentIds:u};(!c||M.pairs.length>c.pairs.length)&&(c=M);continue}const P={pairs:w.pairs,floaters:[...T,...E],warnings:[...l,...w.warnings],residentIds:u},O=Math.floor((h.length+t.length)/2);if(P.pairs.length>=O)return P;if((!c||P.pairs.length>c.pairs.length)&&(c=P),h.length<=1)return c&&c.pairs.length>P.pairs.length?c:P;continue}}if(c&&c.pairs.length>0)return c;const f=[...e,...t];return{...Iv(f,n,r,i,void 0,o),remainderReached:d,residentIds:u}}const Nz=1/0;function bqe(e){const t=e.length,n=Array.from({length:t},()=>Array(t).fill(Nz));for(let r=0;r<t;r++)for(let i=r+1;i<t;i++){const a=e[r],o=e[i],l=nE(a,o)?Math.abs(a.score-o.score)*10+(uN(a,o)?1:0):Nz;n[r][i]=l,n[i][r]=l}return n}function wqe(e,t){if(e.length<2||e.length%2!==0)return null;const n=e.length,r=bqe(e),i=f=>f.map(([h,p])=>[e[h],e[p]]);if(n>18)return kz(e,r)||Cz(e,r,t);const a=new Array(n).fill(1/0);for(let f=0;f<n;f++){for(let h=0;h<n;h++)f!==h&&r[f][h]<a[f]&&(a[f]=r[f][h]);if(!Number.isFinite(a[f]))return null}const o=new Array(n).fill(!1);let l=[],c=1/0;const u=2e3;function d(f,h,p){if(Date.now()-t>u*2)return;if(f===n){h<c&&(c=h,l=[...p]);return}let x=0;for(let b=0;b<n;b++)o[b]||(x+=a[b]);if(h+x/2>=c)return;let y=-1;for(let b=0;b<n;b++)if(!o[b]){y=b;break}o[y]=!0;for(let b=y+1;b<n;b++)o[b]||Number.isFinite(r[y][b])&&(o[b]=!0,p.push([y,b]),d(f+2,h+r[y][b],p),p.pop(),o[b]=!1);o[y]=!1}return d(0,0,[]),l.length===0?kz(e,r)||Cz(e,r,t):i(l)}function kz(e,t){const n=e.length,r=[];for(let o=0;o<n;o++)for(let l=o+1;l<n;l++)Number.isFinite(t[o][l])&&r.push({i:o,j:l,c:t[o][l]});r.sort((o,l)=>o.c-l.c);const i=new Array(n).fill(!1),a=[];for(const o of r)i[o.i]||i[o.j]||(i[o.i]=i[o.j]=!0,a.push([e[o.i],e[o.j]]));return a.length*2!==n?null:a}function Cz(e,t,n,r=4e3){const i=e.length;if(i%2!==0)return null;const a=Array.from({length:i},(d,f)=>Array.from({length:i},(h,p)=>p).filter(h=>h!==f&&Number.isFinite(t[f][h])).sort((h,p)=>t[f][h]-t[f][p])),o=new Array(i).fill(!1),l=[];let c=!1;function u(d){if(d===i)return!0;if(Date.now()-n>r)return c=!0,!1;let f=-1,h=1/0;for(let p=0;p<i;p++){if(o[p])continue;let x=0;for(const y of a[p])o[y]||x++;if(x===0)return!1;x<h&&(h=x,f=p)}if(f===-1)return!1;o[f]=!0;for(const p of a[f])if(!o[p]){if(o[p]=!0,l.push([f,p]),u(d+2))return!0;if(l.pop(),o[p]=!1,c)break}return o[f]=!1,!1}return u(0)?l.map(([d,f])=>[e[d],e[f]]):null}function yn(e,t,n){const r=Date.now(),i=[],a=t%2===1;Gc=n!=null?t>=n:!1,Am=t-1,cN=null,Gc?(Tj=tqe,b_=nqe,Oo=rqe):(Tj=Zoe,b_=ele,Oo=tle),console.log(`[FIDE Swiss] Round ${t}${n?`/${n}`:""}: ${e.length} players (${a?"odd":"even"} round${Gc?", FINAL (budget="+Tj+"/"+b_+"/"+Oo+"ms)":""})`);const o=[];if(e.length===0)return{pairings:[],warnings:i,trace:o};if(e.length===1)return{pairings:[{whitePlayerId:e[0].id,blackPlayerId:null,tableNumber:0,isBye:!0}],warnings:i,trace:o};const l=[...e].sort((W,q)=>q.score!==W.score?q.score-W.score:W.tpn-q.tpn);let c=null,u=[...l];u.length%2===1&&(c=uqe(u),c&&(console.log(`[FIDE Swiss] Bye → TPN ${c.tpn} (score ${c.score})`),u=u.filter(W=>W.id!==c.id)));const d=new Map;for(const W of u)d.set(W.id,W);const f=mqe(u),h=Array.from(f.keys()).sort((W,q)=>q-W),p=t-1,x=[],y=new Set;let b=[],w=1;const _=[];let j=0;const E=new Map;let S=null,T=0;for(;T<h.length&&!(Date.now()-r>Oo);){const W=h[T],q=f.get(W)||[],oe=T===h.length-1,J={scoreIdx:T,pairings:[...x],paired:new Set(y),floaters:[...b],tableNumber:w,warnings:[...i],relaxationIndex:0},Y=[...b,...q],Z=[...b];b=[];const G=Y.filter(de=>!y.has(de.id));if(G.length===0){T++;continue}const se=Z.some(de=>G.some(me=>me.id===de.id)),ce=G.every(de=>de.score===W);cN=T+1<h.length?h[T+1]:null,console.log(`[FIDE Swiss] Bracket ${W}: ${G.length} players (${ce?"homo":"hetero"})`);const{x1:le,z1:fe}=vz(G,a),be=q.filter(de=>!y.has(de.id)).length,_e=se&&!ce?Math.min(Math.floor(G.length/2),be):Math.floor(G.length/2);let pe=null,Te=null;const Ge=E.get(T)||0;let Ne=0,it=0,qe=!1,Qe=null;for(let de=_e;de>=1&&!qe&&!(Date.now()-r>Oo);de--){Ne=0;for(const{req:me,relaxed:ke}of _z(le,fe,de,a)){if(Date.now()-r>Oo)break;if(de===_e&&Ne<Ge){Ne++;continue}const Be={...me};Gc&&G.some($e=>Vf($e,Am))&&(Be.enforceB2=!1);let Ae;if(se&&!ce){const $e=G.filter(Le=>Z.some(Ve=>Ve.id===Le.id)),ge=G.filter(Le=>!Z.some(Ve=>Ve.id===Le.id));Ae=jz($e,ge,Be,r,a,oe,p)}else Ae=Iv(G,Be,r,a,void 0,p);if(Ae.pairs.length>0&&(!Te||Ae.pairs.length>Te.pairs.length)&&(Te=Ae),Ae.pairs.length>=de){let $e=0,ge=0,Le=0,Ve=0;for(const yt of Ae.floaters)Dv(yt,"up")&&$e++,Dv(yt,"down")&&ge++,dN(yt,"up")&&Le++,dN(yt,"down")&&Ve++;if($e>
1259Be.maxB6UpViolations||ge>Be.maxB6DownViolations||Le>Be.maxB5UpViolations||Ve>Be.maxB5DownViolations){(!Qe||Ae.pairs.length>Qe.pairs.length)&&(Qe=Ae),S||(S={result:Ae,score:W,snapshot:{...J}}),Ne++;continue}if(Ae.floaters.length>0&&!oe){const yt=h[T+1],nn=f.get(yt)||[],Vn=new Set(y);for(const zt of Ae.pairs)Vn.add(zt[0].id),Vn.add(zt[1].id);if(!aqe(Ae.floaters,nn,Vn)){Ne++;continue}}pe=Ae,it=Ne,qe=!0,de<_e?i.push({code:"REQUIREMENT_LOWERED",message:`Groupe ${W} : P1 réduit à ${de}/${_e} (C.14).`,players:[],severity:"warning"}):ke!=="none"&&i.push({code:"REQUIREMENT_LOWERED",message:`Règle ${ke} relaxée dans le groupe de score ${W} pour trouver un appariement complet.`,players:[],severity:"info"});break}Ne++}}if(!qe&&Qe&&Qe.pairs.length>0&&(pe=Qe,qe=!0,i.push({code:"FLOAT_REPEATED",message:`Groupe ${W} : contrainte B5/B6 relaxée (aucun appariement sans violation trouvé).`,players:[],severity:"warning"})),!qe&&Te&&Te.pairs.length>0&&(pe=Te,i.push({code:"REQUIREMENT_LOWERED",message:`Groupe ${W} : ${Te.pairs.length}/${_e} paires trouvées (P1 réduit, C.14).`,players:[],severity:"warning"})),pe||(pe={pairs:[],floaters:G,warnings:[]}),pe.pairs.length===0&&G.length>=2&&_.length>0&&j<b_){j++;const de=_.pop();console.log(`[FIDE Swiss] Backtracking from bracket ${W} to bracket ${h[de.scoreIdx]}`),i.push({code:"BACKTRACK_FAILED",message:`Backtracking du groupe ${W} vers le groupe ${h[de.scoreIdx]}.`,players:[],severity:"info"}),x.length=0,x.push(...de.pairings),y.clear();for(const me of de.paired)y.add(me);b=de.floaters,w=de.tableNumber,i.length=0,i.push(...de.warnings),E.set(de.scoreIdx,de.relaxationIndex+1),T=de.scoreIdx;continue}const ot={bracket:W,type:ce?"homo":"hetero",s1:[],s2:[],transpositionsTried:0,exchangesTried:0,relaxationUsed:"none",pairs:[],floaters:pe.floaters.map(de=>de.tpn)};for(const[de,me]of pe.pairs){const[ke,Be]=Pj(de,me,t),Ae=Vs(ke),$e=Vs(Be);let ge="E.4";t===1&&ke.colorHistory.length===0?ge="E.5":Ae.type==="absolute"||$e.type==="absolute"?ge=Ae.type==="absolute"&&$e.type==="absolute"?"E.1":"E.2":Ae.type==="strong"||$e.type==="strong"?ge="E.2":Ae.type==="mild"&&$e.type==="mild"&&Ae.color!==$e.color&&(ge="E.3"),ot.pairs.push({white:ke.tpn,black:Be.tpn,colorRule:ge}),x.push({whitePlayerId:ke.id,blackPlayerId:Be.id,tableNumber:w,isBye:!1}),w++,y.add(de.id),y.add(me.id)}o.push(ot);for(const de of pe.floaters)!q.some(ke=>ke.id===de.id)||Dv(de,"down")&&i.push({code:"FLOAT_REPEATED",message:`Joueur TPN ${de.tpn} flotte vers le bas pour la 2e ronde consécutive.`,players:[de.id],severity:"info"});b=pe.floaters,i.push(...pe.warnings),J.relaxationIndex=it,_.push(J),T++}if((b.length>=2||b.length===1&&e.length%2===0)&&_.length>0){console.log(`[FIDE Swiss] C.13: Attempting bracket merging for ${b.length} floaters`);const W=[...x],q=new Set(y),oe=w,J=[...b],Y=[...i],Z=[..._];let G=0;const se=_.length;for(;b.length>=1&&_.length>0&&G<se&&!(Date.now()-r>Oo);){G++;const pe=_.pop(),Te=h[pe.scoreIdx],Ge=f.get(Te)||[];x.length=0,x.push(...pe.pairings),y.clear();for(const Ae of pe.paired)y.add(Ae);w=pe.tableNumber;const Ne=new Set,it=[];for(const Ae of[...b,...Ge.filter($e=>!pe.paired.has($e.id))])Ne.has(Ae.id)||(Ne.add(Ae.id),it.push(Ae));for(const Ae of pe.floaters)!Ne.has(Ae.id)&&!pe.paired.has(Ae.id)&&(Ne.add(Ae.id),it.push(Ae));console.log(`[FIDE Swiss] C.13: Merging ${b.length} floaters with bracket ${Te} (${it.length} total)`);const{x1:qe,z1:Qe}=vz(it,a),ot=Math.floor(it.length/2);let de=null,me=null;for(const{req:Ae}of _z(qe,Qe,ot,a)){if(Date.now()-r>Oo)break;const $e={...Ae};Gc&&it.some(ct=>Vf(ct,Am))&&($e.enforceB2=!1);const ge=it.filter(ct=>b.some(yt=>yt.id===ct.id)),Le=it.filter(ct=>!b.some(yt=>yt.id===ct.id)),Ve=ge.length>0&&Le.length>0?jz(ge,Le,$e,r,a,!0,p):Iv(it,$e,r,a,void 0,p);if(Ve.pairs.length>0&&(!me||Ve.pairs.length>me.pairs.length)&&(me=Ve),Ve.pairs.length===ot){de=Ve;break}}const Be=e.length%2===0?de:de||me;if(Be&&Be.pairs.length>0){for(const[Ae,$e]of Be.pairs){const[ge,Le]=Pj(Ae,$e,t);x.push({whitePlayerId:ge.id,blackPlayerId:Le.id,tableNumber:w,isBye:!1}),w++,y.add(Ae.id),y.add($e.id)}if(b=Be.floaters,i.push(...Be.warnings),de||i.push({code:"REQUIREMENT_LOWERED",message:`C.13 : Fusion de brackets avec résultat partiel (${Be.pairs.length} paires).`,players:[],severity:"warning"}),b.length===0||b.length===1&&e.length%2!==0)break}}const ce=x.filter(pe=>!pe.isBye).length,le=W.filter(pe=>!pe.isBye).length,fe=e.length%2===0,be=b.length>0&&fe;if(ce<le||be&&ce<=le){console.log(`[FIDE Swiss] C.13: Rolling back merge (${ce} games, ${b.length} floaters remaining)`),x.length=0,x.push(...W),y.clear();for(const pe of q)y.add(pe);w=oe,b=J,i.length=0,i.push(...Y),_.length=0,_.push(...Z)}}const O=e.length%2===0,D=O?e.length:e.length-1,L=y.size+(c?1:0)<D;if(b.length>0||L){const W=O?0:1;if(b.length>W||L){console.log(`[FIDE Swiss] Global re-pairing: ${b.length} floaters after C.13 merge — re-pairing all ${e.length} players (score-aware)`);const q=e.filter(Y=>!c||Y.id!==c.id);x.length=0,y.clear(),w=1;const oe=wqe(q,r);if(oe&&oe.length>0){for(const[Y,Z]of oe){const[G,se]=Pj(Y,Z,t);x.push({whitePlayerId:G.id,blackPlayerId:se.id,tableNumber:w,isBye:!1}),y.add(Y.id),y.add(Z.id),w++}b=[],i.push({code:"REQUIREMENT_LOWERED",message:`Appariement final reconstruit en mode "minimisation d'écart de score" après échec du parcours par groupes (C.04.3 — fallback global score-aware).`,players:[],severity:"warning"})}const J=q.filter(Y=>!y.has(Y.id));if(J.length>1||O&&J.length>0)i.push({code:"PAIRING_IMPOSSIBLE",message:`Appariement FIDE impossible sans violer C.1 : ${J.length} joueur(s) non apparié(s) après re-appariement global.`,players:J.map(Y=>Y.id),severity:"error"});else for(const Y of J)x.push({whitePlayerId:Y.id,blackPlayerId:null,tableNumber:0,isBye:!0})}else b.length===1&&!O?x.push({whitePlayerId:b[0].id,blackPlayerId:null,tableNumber:0,isBye:!0}):b.length===1&&O&&i.push({code:"PAIRING_IMPOSSIBLE",message:`Joueur ${b[0].id}
1259 non apparié dans un tournoi pair — backtracking complet épuisé.`,players:[b[0].id],severity:"error"})}c&&x.push({whitePlayerId:c.id,blackPlayerId:null,tableNumber:0,isBye:!0}),vqe(x,d);const M=x.filter(W=>!W.isBye).length,B=x.filter(W=>W.isBye).length,U=Math.floor(e.length/2);e.length%2,O&&(M<U||B>0)&&(i.some(W=>W.code==="PAIRING_IMPOSSIBLE")||i.push({code:"PAIRING_IMPOSSIBLE",message:`Couverture incomplète : ${M}/${U} parties, ${B} byes dans un tournoi pair.`,players:[],severity:"error"}));const F=x.filter(W=>{if(W.isBye||!W.blackPlayerId)return!1;const q=d.get(W.whitePlayerId),oe=d.get(W.blackPlayerId);return!!q&&!!oe&&!nE(q,oe)});F.length>0&&(console.error("[FIDE Swiss] C1 VIOLATION detected in generated pairings",F),i.push({code:"PAIRING_IMPOSSIBLE",message:`Violation C.1 détectée : ${F.length} revanche(s) dans les appariements générés. Aucun round n'a été créé.`,players:F.flatMap(W=>[W.whitePlayerId,W.blackPlayerId]),severity:"error"}));const H=Date.now()-r;console.log(`[FIDE Swiss] Generated ${x.length} pairings (${M} games, ${B} byes) in ${H}ms`),i.length>0&&console.log(`[FIDE Swiss] ${i.length} warning(s):`,i.map(W=>W.code).join(", "));const z=new Map;for(const W of l)z.set(W.id,W.tpn);const K=l.map(W=>{const q=Vs(W);return{tpn:W.tpn,id:W.id,score:W.score,opponents:W.opponents.map(oe=>z.get(oe)??0),colorHistory:W.colorHistory.map(oe=>oe==="white"?"B":"N"),floatHistory:W.floatHistory.map(oe=>oe==="up"?"↑":oe==="down"?"↓":"–"),colorPref:q.type==="none"?"–":`${q.type[0].toUpperCase()}:${q.color==="white"?"B":"N"}`}});return{pairings:x,warnings:i,trace:o,debugState:K}}function rle(e,t,n=["buchholz_cut1","buchholz","sonneborn_berger","wins","direct"],r=new Set,i=0,a){const o=new Map;for(const b of e)o.set(b,{points:0,gamesPlayed:0,wins:0,draws:0,losses:0});const l=new Map,c=new Map,u=new Map,d=new Map;for(const b of e)d.set(b,0);for(const b of t){const w=b.roundNumber||0;if(b.isBye){const P=o.get(b.whitePlayerId);P&&(P.points+=1,P.wins+=1,P.gamesPlayed+=1);const O=u.get(b.whitePlayerId)||new Map;O.set(w,(O.get(w)||0)+1),u.set(b.whitePlayerId,O);const D=l.get(b.whitePlayerId)||[];D.push(`__bye_${b.whitePlayerId}_${w}`),l.set(b.whitePlayerId,D);continue}if(b.result==="pending"){if(!b.isBye&&b.blackPlayerId){const P=l.get(b.whitePlayerId)||[];P.push(b.blackPlayerId),l.set(b.whitePlayerId,P);const O=l.get(b.blackPlayerId)||[];O.push(b.whitePlayerId),l.set(b.blackPlayerId,O)}continue}const _=o.get(b.whitePlayerId),j=b.blackPlayerId?o.get(b.blackPlayerId):null;let E=0,S=0;b.result==="white_wins"?(E=1,S=0,_&&(_.points+=1,_.wins+=1,_.gamesPlayed+=1),j&&(j.losses+=1,j.gamesPlayed+=1)):b.result==="black_wins"?(E=0,S=1,_&&(_.losses+=1,_.gamesPlayed+=1),j&&(j.points+=1,j.wins+=1,j.gamesPlayed+=1)):b.result==="draw"&&(E=.5,S=.5,_&&(_.points+=.5,_.draws+=1,_.gamesPlayed+=1),j&&(j.points+=.5,j.draws+=1,j.gamesPlayed+=1));const T=u.get(b.whitePlayerId)||new Map;if(T.set(w,(T.get(w)||0)+E),u.set(b.whitePlayerId,T),b.blackPlayerId){const P=u.get(b.blackPlayerId)||new Map;P.set(w,(P.get(w)||0)+S),u.set(b.blackPlayerId,P),d.set(b.blackPlayerId,(d.get(b.blackPlayerId)||0)+1);const O=l.get(b.whitePlayerId)||[];O.push(b.blackPlayerId),l.set(b.whitePlayerId,O);const D=l.get(b.blackPlayerId)||[];D.push(b.whitePlayerId),l.set(b.blackPlayerId,D);const[R,L]=[b.whitePlayerId,b.blackPlayerId].sort(),M=`${R}|${L}`,B=c.get(M)||0;b.whitePlayerId===R?c.set(M,B+E):c.set(M,B+S)}}const f=new Map;for(const b of t){if(b.isBye||b.result==="pending"||!b.blackPlayerId)continue;let w=0,_=0;b.result==="white_wins"?w=1:b.result==="black_wins"?_=1:b.result==="draw"&&(w=.5,_=.5);const j=f.get(b.whitePlayerId)||new Map;j.set(b.blackPlayerId,(j.get(b.blackPlayerId)||0)+w),f.set(b.whitePlayerId,j);const E=f.get(b.blackPlayerId)||new Map;E.set(b.whitePlayerId,(E.get(b.whitePlayerId)||0)+_),f.set(b.blackPlayerId,E)}const h=[];for(const[b,w]of o){const _=l.get(b)||[],j=[];let E=0;const S=f.get(b);for(const R of _){if(R.startsWith("__bye_")){j.push(w.points),E+=1*w.points;continue}const L=o.get(R);let M=(L==null?void 0:L.points)||0;if(L&&i>0&&r.has(R)){const U=i-L.gamesPlayed;U>0&&(M+=.5*U)}j.push(M);const B=(S==null?void 0:S.get(R))||0;E+=B*M}const T=j.reduce((R,L)=>R+L,0),P=j.length>0?T-Math.min(...j):0,O=u.get(b);let D=0;if(O&&O.size>0){const R=[...O.keys()].sort((M,B)=>M-B);let L=0;for(const M of R)L+=O.get(M)||0,D+=L}h.push({playerId:b,...w,buchholz:T,buchholzCut1:P,sonnebornBerger:E,progressive:D,blackGames:d.get(b)||0,directEncounter:0,rank:0})}const p=(b,w)=>{let _=0;const j=f.get(b);if(!j)return 0;for(const E of w)E!==b&&(_+=j.get(E)||0);return _},x=(b,w)=>{switch(w){case"buchholz_cut1":return b.buchholzCut1;case"buchholz":return b.buchholz;case"sonneborn_berger":return b.sonnebornBerger;case"progressive":return b.progressive;case"wins":return b.wins;case"black_games":return b.blackGames;default:return 0}},y=n.indexOf("direct");if(y>=0){const b=n.slice(0,y),w=[...h].sort((j,E)=>{if(E.points!==j.points)return E.points-j.points;for(const S of b){const T=x(E,S)-x(j,S);if(T!==0)return T}return 0});let _=0;for(;_<w.length;){let j=_+1;for(;j<w.length&&w[j].points===w[_].points;){let E=!0;for(const S of b)if(x(w[j],S)!==x(w[_],S)){E=!1;break}if(!E)break;j++}if(j-_>=2){const E=new Set(w.slice(_,j).map(S=>S.playerId));for(let S=_;S<j;S++)w[S].directEncounter=p(w[S].playerId,E)}_=j}}return h.sort((b,w)=>{if(w.points!==b.points)return w.points-b.points;for(const _ of n)if(_==="direct"){if(w.directEncounter!==b.directEncounter)return w.directEncounter-b.directEncounter}else{const j=x(w,_)-x(b,_);if(j!==0)return j}if(a){const _=a.get(b.playerId)||9999,j=a.get(w.playerId)||9999;if(_!==j)return _-j}return 0}),h.forEach((b,w)=>{b.rank=w+1}),h}function sle(e){const t=[...e].map(r=>({id:r.id,elo:r.elo_rating||0,name:(r.display_name||r.first_name||"").toLowerCase()})).sort((r,i)=>
1259i.elo!==r.elo?i.elo-r.elo:r.name&&i.name&&r.name!==i.name?r.name.localeCompare(i.name,void 0,{numeric:!0}):r.id.localeCompare(i.id,void 0,{numeric:!0})),n=new Map;return t.forEach((r,i)=>n.set(r.id,i+1)),n}function fn(e,t,n,r,i){var p,x;const a=e.map(y=>({id:y,elo:n.get(y)||0,name:(i==null?void 0:i.get(y))||""}));a.sort((y,b)=>b.elo!==y.elo?b.elo-y.elo:y.name&&b.name&&y.name!==b.name?y.name.localeCompare(b.name,void 0,{numeric:!0}):y.id.localeCompare(b.id,void 0,{numeric:!0}));const o=new Map;a.forEach((y,b)=>{o.set(y.id,b+1)});const l=new Map;for(const{id:y,elo:b}of a)l.set(y,{id:y,ticketId:y,score:0,opponents:[],colorHistory:[],hadBye:!1,hadForfeitWin:!1,tpn:o.get(y)||9999,elo:b,floatHistory:[]});const c=new Map,u=new Map;let d=0;for(const y of e)u.set(y,[0]);for(const y of t){const b=y.round_number||++d;c.has(b)||c.set(b,[]),c.get(b).push(y)}const f=Array.from(c.keys()).sort((y,b)=>y-b),h=new Map;for(const y of e)h.set(y,0);for(const y of f){const b=c.get(y);for(const w of e){const _=u.get(w);_[y-1]=h.get(w)||0}for(const w of b){const _=l.get(w.white_player_id),j=w.black_player_id?l.get(w.black_player_id):null;if(w.is_bye){_&&(_.hadBye=!0,_.score+=1,h.set(w.white_player_id,(h.get(w.white_player_id)||0)+1));continue}const E=_&&j;_&&(E&&_.colorHistory.push("white"),w.black_player_id&&_.opponents.push(w.black_player_id)),j&&(E&&j.colorHistory.push("black"),j.opponents.push(w.white_player_id)),w.result==="white_wins"&&!j&&_&&(_.hadForfeitWin=!0),w.result==="black_wins"&&!_&&j&&(j.hadForfeitWin=!0),w.result==="white_wins"?_&&(_.score+=1,h.set(w.white_player_id,(h.get(w.white_player_id)||0)+1)):w.result==="black_wins"?j&&(j.score+=1,h.set(w.black_player_id,(h.get(w.black_player_id)||0)+1)):w.result==="draw"&&(_&&(_.score+=.5,h.set(w.white_player_id,(h.get(w.white_player_id)||0)+.5)),j&&(j.score+=.5,h.set(w.black_player_id,(h.get(w.black_player_id)||0)+.5)))}for(const w of b){if(w.is_bye||!w.black_player_id)continue;const _=((p=u.get(w.white_player_id))==null?void 0:p[y-1])??0,j=((x=u.get(w.black_player_id))==null?void 0:x[y-1])??0,E=l.get(w.white_player_id),S=l.get(w.black_player_id);E&&(j<_?E.floatHistory.push("down"):j>_?E.floatHistory.push("up"):E.floatHistory.push(null)),S&&(_<j?S.floatHistory.push("down"):_>j?S.floatHistory.push("up"):S.floatHistory.push(null))}for(const w of b)if(w.is_bye){const _=l.get(w.white_player_id);_&&_.floatHistory.push("down")}}return Array.from(l.values())}async function j6(e){const{engine:t,eventId:n,roundNumber:r,players:i}=e;if(t==="none")throw new Error("Mode manuel : les appariements doivent être créés manuellement via le panneau dédié.");if((t==="javafo_api"?"javafo_api":"internal")==="internal")return console.log(`[PairingEngine] Using internal engine for round ${r}`),yn(i,r);console.log(`[PairingEngine] Using javafo_api for round ${r} (event ${n})`);const{data:o,error:l}=await re.functions.invoke("generate-pairings-external",{body:{eventId:n,roundNumber:r}});if(l)throw console.error("[PairingEngine] Edge function error:",l),new Error(`Moteur JaVaFo indisponible : ${l.message||"erreur inconnue"}. Aucun round n'a été créé.`);if(!o||!Array.isArray(o.pairings))throw new Error("Réponse invalide du moteur JaVaFo. Aucun round n'a été créé.");const c=new Set(i.map(d=>d.id));return{pairings:o.pairings.map((d,f)=>{const h=d.whitePlayerId,p=d.blackPlayerId||null,x=!!d.isBye||!p;if(!c.has(h))throw new Error(`Moteur JaVaFo a retourné un joueur inconnu (${h.slice(0,8)}). Aucun round n'a été créé.`);if(p&&!c.has(p))throw new Error(`Moteur JaVaFo a retourné un joueur inconnu (${p.slice(0,8)}). Aucun round n'a été créé.`);return{whitePlayerId:h,blackPlayerId:x?null:p,isBye:x,tableNumber:d.tableNumber||f+1}}),warnings:Array.isArray(o.warnings)?o.warnings:[],trace:[]}}function F0(e){return e?Array.isArray(e)?e.length===0?null:e[0]:typeof e=="object"?e:null:null}function O1(e){const t=F0(e);if(!t)return!1;const n=["confirmed","peer_resolved","staff_override"];return t.result!=="pending"&&n.includes(t.validation_status)}function _qe(e,t){return t==="disputed"?"disputed":!e||e==="pending"?"pending":["confirmed","peer_resolved","staff_override"].includes(t||"")?"completed":"in_progress"}const Ez={white_wins:"1 - 0",black_wins:"0 - 1",draw:"½ - ½",pen
1259ding:"? - ?"};function N6(e,t,n,r){const{pairings:i,warnings:a}=e,o=t%2===0,l=i.filter(h=>!h.isBye),c=i.filter(h=>h.isBye),u=Math.floor(t/2);if(a.find(h=>h.code==="PAIRING_IMPOSSIBLE"))throw new Error("Appariement FIDE impossible sans violer C.1 (rematch interdit). Aucun round n'a été créé.");if(o){if(l.length<u)throw new Error(`Appariement incomplet : ${l.length}/${u} parties pour ${t} joueurs. Aucun round n'a été créé.`);if(c.length>0)throw new Error(`Bye illégal dans un tournoi pair (${t} joueurs). Aucun round n'a été créé.`)}const f=new Map;for(const h of i)f.set(h.whitePlayerId,(f.get(h.whitePlayerId)||0)+1),h.blackPlayerId&&f.set(h.blackPlayerId,(f.get(h.blackPlayerId)||0)+1);for(const[h,p]of f)if(p>1)throw new Error(`Joueur ${h} apparaît ${p} fois dans la ronde. Aucun round n'a été créé.`);if(r){const h=new Map(r.map(x=>[x.id,new Set(x.opponents)])),p=l.filter(x=>{var y,b;return x.blackPlayerId?((y=h.get(x.whitePlayerId))==null?void 0:y.has(x.blackPlayerId))||((b=h.get(x.blackPlayerId))==null?void 0:b.has(x.whitePlayerId)):!1});if(p.length>0)throw console.error(`[${n}] C1 violation blocked:`,p),new Error(`Violation FIDE C.1 : ${p.length} revanche(s) détectée(s) dans les appariements générés. Aucun round n'a été créé — utilisez l'appariement manuel.`)}console.log(`[${n}] Validation passed: ${l.length} games, ${c.length} byes, ${t} players`)}function rE(e){return st({queryKey:["event-rounds",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await re.from("rounds").select("*").eq("event_id",e).order("round_number",{ascending:!0});if(n)throw n;return t},enabled:!!e,staleTime:1e4,placeholderData:hp})}function uw(e){const t=Ye();return N.useEffect(()=>{if(!e)return;const n=re.channel(`admin-round-pairings-${e}`).on("postgres_changes",{event:"*",schema:"public",table:"game_results"},r=>{console.log("[Realtime] game_results changed, invalidating round:",e,r.eventType),t.invalidateQueries({queryKey:["round-pairings",e]})}).subscribe(r=>{r==="SUBSCRIBED"?console.log("[Realtime] Subscription active for round:",e):r==="CHANNEL_ERROR"&&console.warn("[Realtime] Channel error for round:",e)});return()=>{re.removeChannel(n)}},[e,t]),st({queryKey:["round-pairings",e],queryFn:async()=>{if(!e)return[];const{data:n,error:r}=await re.from("pairings").select("*, game_result:game_results(*)").eq("round_id",e).order("table_number",{ascending:!0});if(r)throw r;if(!n||n.length===0)return[];const{data:i}=await re.from("rounds").select("event_id").eq("id",e).single();if(!i)return n;const{data:a}=await re.rpc("get_event_pairing_profiles",{p_event_id:i.event_id});if(!a)return n;const o=new Map,l=new Map,c=new Map;return a.forEach(u=>{const d={id:u.is_for_self&&u.user_id?u.user_id:u.ticket_id,display_name:u.display_name,first_name:u.first_name,last_name:u.last_name,elo_rating:u.elo_rating??0,avatar_url:u.avatar_url??null};o.set(u.ticket_id,d),u.is_for_self&&u.user_id&&(c.set(u.user_id,d),l.set(u.user_id,u.ticket_id))}),n.map(u=>{let d=null;if(u.white_ticket_id&&(d=o.get(u.white_ticket_id)),!d&&u.white_player_id){const h=l.get(u.white_player_id);d=h?o.get(h):c.get(u.white_player_id)}let f=null;
1259if(u.black_ticket_id&&(f=o.get(u.black_ticket_id)),!f&&u.black_player_id){const h=l.get(u.black_player_id);f=h?o.get(h):c.get(u.black_player_id)}return{...u,white_player:d,black_player:f}})},enabled:!!e,staleTime:3e3,refetchInterval:5e3,refetchOnWindowFocus:!0,refetchOnMount:!0})}function $0(e){return st({queryKey:["event-participants",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await re.rpc("get_event_participants",{p_event_id:e});if(n)throw n;return(t||[]).map(r=>({id:r.participant_id,ticketId:r.ticket_id,display_name:r.display_name,first_name:r.first_name,last_name:r.last_name,elo_rating:r.elo_rating,avatar_url:r.avatar_url,isGuest:r.is_guest}))},staleTime:1e4,enabled:!!e})}function k6(e,t){const{data:n}=$0(e);return st({queryKey:["tournament-standings",e],queryFn:async()=>{if(!n||n.length===0)return[];const{data:r,error:i}=await re.from("rounds").select(`
1260          round_number,
1261          pairings(
1262            white_player_id, black_player_id,
1263            white_ticket_id, black_ticket_id,
1264            is_bye,
1265            game_result:game_results(result, validation_status)
1266          )
1267        `).eq("event_id",e).order("round_number",{ascending:!0});if(i)throw i;const a=new Set(n.map(w=>w.id)),o=new Map;n.forEach(w=>{w.ticketId&&o.set(w.ticketId,w.id)});const l=n.map(w=>w.id),c=[];for(const w of r||[])for(const _ of w.pairings){const j=F0(_.game_result);let E="pending";_.is_bye?E="white_wins":O1(_.game_result)&&(E=(j==null?void 0:j.result)||"pending");let S=_.white_player_id;_.white_ticket_id&&o.has(_.white_ticket_id)?S=o.get(_.white_ticket_id):_.white_player_id&&a.has(_.white_player_id)?S=_.white_player_id:_.white_ticket_id&&(S=_.white_ticket_id);let T=_.black_player_id;_.black_ticket_id&&o.has(_.black_ticket_id)?T=o.get(_.black_ticket_id):_.black_player_id&&a.has(_.black_player_id)?T=_.black_player_id:_.black_ticket_id&&(T=_.black_t
1267icket_id),c.push({whitePlayerId:S,blackPlayerId:T,result:E,isBye:_.is_bye||!1,roundNumber:w.round_number})}console.log("[Standings] Direct query:",c.length,"games, confirmed:",c.filter(w=>w.result!=="pending").length);const u=t&&t.length>0?t:["buchholz_cut1","buchholz","wins","direct"],{data:d}=await re.from("tournament_withdrawals").select("ticket_id").eq("event_id",e),f=new Set((d||[]).map(w=>w.ticket_id)),h=new Set;for(const[w,_]of o)f.has(w)&&h.add(_);const{data:p}=await re.from("events").select("rounds_count").eq("id",e).single(),x=(p==null?void 0:p.rounds_count)||0,y=sle(n);return rle(l,c,u,h,x,y).map(w=>({...w,profile:n.find(_=>_.id===w.playerId)}))},staleTime:5e3,refetchInterval:1e4,refetchOnWindowFocus:!0,refetchOnReconnect:!0,enabled:!!e&&!!n&&n.length>0})}function C6(e,t){const n=Ye(),r=k6(e,t);return N.useEffect(()=>{e&&n.invalidateQueries({queryKey:["tournament-standings",e]})},[e,n]),N.useEffect(()=>{if(!e)return;const i=re.channel(`tournament-standings-realtime-${e}`).on("postgres_changes",{event:"*",schema:"public",table:"game_results"},()=>{setTimeout(()=>{n.invalidateQueries({queryKey:["tournament-standings",e]})},0)}).subscribe();return()=>{re.removeChannel(i)}},[e,n]),r}function jqe(e,t){const{data:n}=$0(e);return st({queryKey:["points-before-round",e,t],queryFn:async()=>{if(!e||!t||!n||n.length===0)return new Map;if(t<=1){const f=new Map;return n.forEach(h=>f.set(h.id,0)),f}const{data:r,error:i}=await re.from("rounds").select(`
1268          round_number,
1269          pairings(
1270            white_player_id, black_player_id,
1271            white_ticket_id, black_ticket_id,
1272            is_bye,
1273            game_result:game_results(result, validation_status)
1274          )
1275        `).eq("event_id",e).lt("round_number",t).in("status",["completed"]);if(i)throw i;const a=new Map,o=new Set(n.map(f=>f.id));n.forEach(f=>{f.ticketId&&a.set(f.ticketId,f.id)});const l=n.map(f=>f.id),c=[];for(const f of r||[])for(const h of f.pairings){const p=F0(h.game_result);let x="pending";h.is_bye?x="white_wins":O1(h.game_result)&&(x=(p==null?void 0:p.result)||"pending");let y=h.white_player_id;h.white_ticket_id&&a.has(h.white_ticket_id)?y=a.get(h.white_ticket_id):h.white_player_id&&o.has(h.white_player_id)?y=h.white_player_id:h.white_ticket_id&&(y=h.white_ticket_id);let b=h.black_player_id;h.black_ticket_id&&a.has(h.black_ticket_id)?b=a.get(h.black_ticket_id):h.black_player_id&&o.has(h.black_player_id)?b=h.black_player_id:h.black_ticket_id&&(b=h.black_ticket_id),c.push({whitePlayerId:y,blackPlayerId:b,result:x,isBye:h.is_bye||!1})}const u=rle(l,c),d=new Map;for(const f of u)d.set(f.playerId,f.points);return console.log("[PointsBeforeRound] Round",t,"- Points:",Array.from(d.entries()).map(([f,h])=>`${f.slice(0,8)}:${h}`).join(", ")),d},enabled:!!e&&!!t&&!!n&&n.length>0,staleTime:3e4})}function E6(){const e=Ye();return dt({mutationFn:async({eventId:t,roundNumber:n})=>{const{data:r,error:i}=await re.from("rounds").insert({event_id:t,round_number:n,status:"pending"}).select().single();if(i)throw i;return r},onSuccess:(t,{eventId:n})=>{e.invalidateQueries({queryKey:["event-rounds",n]}),e.invalidateQueries({queryKey:["tournament-standings",n]}),e.invalidateQueries({queryKey:["event-pairings-history",n]}),e.invalidateQueries({queryKey:["points-before-round",n]})},onError:t=>{je.error("Erreur lors de la création de la ronde"),console.error(t)}})}function S6(){const e=Ye();return dt({mutationFn:async({roundId:t,eventId:n})=>{console.log("[useGeneratePairings] Starting for event:",n,"round:",t);const{data:r,error:i}=await re.rpc("get_event_participants",{p_event_id:n});if(i)throw i;if(!r||r.length<2)throw new Error("Il faut au moins 2 joueurs enregistrés pour générer les appariements");const a=new Map;r.forEach(O=>{a.set(O.ticket_id,O.elo_rating||0)});const{data:o}=await re.from("tournament_withdrawals").select("ticket_id").eq("event_id",n),l=new Set((o||[]).map(O=>O.ticket_id)),c=r.filter(O=>!l.has(O.ticket_id)).map(O=>O.ticket_id);console.log("[useGeneratePairings] Players:",c.length,"ELO range:",Math.min(...Array.from(a.values())),"-",Math.max(...Array.from(a.values())
1275));const{data:u,error:d}=await re.from("rounds").select(`
1276          round_number,
1277          pairings(
1278            white_player_id,
1279            black_player_id,
1280            white_ticket_id,
1281            black_ticket_id,
1282            is_bye,
1283            game_result:game_results(result, validation_status)
1284          )
1285        `).eq("event_id",n).neq("id",t);if(d)throw d;const f=u.flatMap(O=>O.pairings.filter(D=>{if(D.is_bye)return!1;const R=Array.isArray(D.game_result)?D.game_result[0]:D.game_result;return R?!["confirmed","peer_resolved","staff_override"].includes(R.validation_status||""):!0}));if(f.length>0)throw new Error(`${f.length} partie(s) non confirmée(s) dans les rondes précédentes. Utilisez "Forcer la complétion" pour résoudre.`);const h=new Map;r.forEach(O=>{!O.is_guest&&O.participant_id&&h.set(O.participant_id,O.ticket_id)});const p=u.flatMap(O=>O.pairings.map(D=>{const R=Array.isArray(D.game_result)?D.game_result[0]:D.game_result,M=R&&["confirmed","peer_resolved","staff_override"].includes(R.validation_status||"");return{white_player_id:D.white_ticket_id||h.get(D.white_player_id)||D.white_player_id,black_player_id:D.black_ticket_id||(D.black_player_id?h.get(D.black_player_id)||D.black_player_id:null),is_bye:D.is_bye||!1,result:M?R.result:void 0,round_number:O.round_number}}));console.log("[useGeneratePairings] History:",p.length,"previous pairings");const{data:x}=await re.from("rounds").select("round_number").eq("id",t).single(),y=(x==null?void 0:x.round_number)||1,b=new Map;r.forEach(O=>{b.set(O.ticket_id,(O.display_name||O.first_name||"").toLowerCase())});const w=fn(c,p,a,y,b);console.log("[useGeneratePairings] Player data:",w.map(O=>({id:O.id.slice(0,8),score:O.score,tpn:O.tpn,elo:O.elo,opponents:O.opponents.length,colors:O.colorHistory.join(","),hadBye:O.hadBye})));const{data:_}=await re.from("events").select("pairing_engine").eq("id",n).single(),j=(_==null?void 0:_.pairing_engine)||"internal",E=await j6({engine:j,eventId:n,roundNumber:y,players:w}),S=E.pairings;console.log("[useGeneratePairings] Generated pairings:",S.length,"warnings:",E.warnings.length,"engine:",j),N6(E,c.length,"useGeneratePairings",w);const T=S.map(O=>{const D=r.find(L=>L.ticket_id===O.whitePlayerId),R=O.blackPlayerId?r.find(L=>L.ticket_id===O.blackPlayerId):null;return{round_id:t,white_player_id:D&&!D.is_guest?D.participant_id:null,black_player_id:R&&!R.is_guest?R.participant_id:null,white_ticket_id:O.whitePlayerId,black_ticket_id:O.blackPlayerId,table_number:O.tableNumber,is_bye:O.isBye}}),{error:P}=await re.from("pairings").insert(T);if(P)throw P;return console.log("[useGeneratePairings] Successfully inserted pairings"),{pairings:S,warnings:E.warnings}},onSuccess:(t,{roundId:n,eventId:r})=>{e.invalidateQueries({queryKey:["round-pairings",n]}),e.invalidateQueries({queryKey:["event-rounds",r]}),e.invalidateQueries({queryKey:["event-pairings-history",r]});
1285const i=t.warnings.length;je.success(i>0?`Appariements FIDE générés (${i} avertissement${i>1?"s":""})`:"Appariements FIDE générés")},onError:t=>{je.error(t.message||"Erreur lors de la génération des appariements"),console.error("[useGeneratePairings] Error:",t)}})}function dw(){const e=Ye();return dt({mutationFn:async({roundId:t,silent:n=!1})=>{const{error:r}=await re.from("rounds").update({status:"active",started_at:new Date().toISOString()}).eq("id",t);if(r)throw r;return{silent:n}},onSuccess:t=>{e.invalidateQueries({queryKey:["event-rounds"]}),t!=null&&t.silent||je.success("Ronde démarrée")},onError:(t,n)=>{n.silent||je.error("Erreur lors du démarrage de la ronde"),console.error("[useStartRound] Error:",t)}})}function ile(){const e=Ye();return dt({mutationFn:async({roundId:t,eventId:n,currentRoundNumber:r,totalRounds:i,silent:a=!1})=>{const{data:o,error:l}=await re.from("rounds").select("status").eq("id",t).maybeSingle();if(l)throw l;if(!o||o.status!=="active")return{completed:!0,nextRoundCreated:!1,pairingsGenerated:!1,isLastRound:!1,skipped:!0,silent:a};const{error:c}=await re.from("rounds").update({status:"completed",completed_at:new Date().toISOString()}).eq("id",t).eq("status","active");if(c)throw c;if(r>=i)return{completed:!0,nextRoundCreated:!1,pairingsGenerated:!1,isLastRound:!0,silent:a};const{data:u,error:d}=await re.from("rounds").insert({event_id:n,round_number:r+1,status:"pending"}).select().single();if(d)throw d;const{data:f,error:h}=await re.rpc("get_event_participants",{p_event_id:n});if(h)throw h;const p=new Map,x=new Map;(f||[]).forEach(U=>{p.set(U.ticket_id,U.elo_rating||0),x.set(U.ticket_id,(U.display_name||U.first_name||"").toLowerCase())});const{data:y}=await re.from("tournament_withdrawals").select("ticket_id").eq("event_id",n),b=new Set((y||[]).map(U=>U.ticket_id)),w=(f||[]).filter(U=>!b.has(U.ticket_id)).map(U=>U.ticket_id);if(w.length<2)return{completed:!0,nextRoundCreated:!0,nextRoundId:u.id,pairingsGenerated:!1,isLastRound:!1};const _=new Map;(f||[]).forEach(U=>{!U.is_guest&&U.participant_id&&_.set(U.participant_id,U.ticket_id)});const{data:j,error:E}=await re.from("rounds").select(`
1286          round_number,
1287          pairings(
1288            white_player_id,
1289            black_player_id,
1290            white_ticket_id,
1291            black_ticket_id,
1292            is_bye,
1293            game_result:game_results(result, validation_status)
1294          )
1295        `).eq("event_id",n).neq("id",u.id);if(E)throw E;const S=j.flatMap(U=>U.pairings.map(F=>{const H=Array.isArray(F.game_result)?F.game_result[0]:F.game_result,K=H&&["confirmed","peer_resolved","staff_override"].includes(H.validation_status||"");return{white_player_id:F.white_ticket_id||_.get(F.white_player_id)||F.white_player_id,black_player_id:F.black_ticket_id||(F.black_player_id?_.get(F.black_player_id)||F.black_player_id:null),is_bye:F.is_bye||!1,result:K?H.result:void 0,round_number:U.round_number}})),T=r+1,P=fn(w,S,p,T,x),{data:O}=await re.from("events").select("pairing_engine").eq("id",n).single(),D=(O==null?void 0:O.pairing_engine)||"internal",R=await j6({engine:D,eventId:n,roundNumber:T,players:P}),L=R.pairings;console.log("[useCompleteRoundAndPrepareNext] FIDE pairings:",L.length,"warnings:",R.warnings.length,"engine:",D),N6(R,w.length,"useCompleteRoundAndPrepareNext",P);const M=L.map(U=>{const F=(f||[]).find(z=>z.ticket_id===U.whitePlayerId),H=U.blackPlayerId?(f||[]).find(z=>z.ticket_id===U.blackPlayerId):null;return{round_id:u.id,white_player_id:F&&!F.is_guest?F.participant_id:null,black_player_id:H&&!H.is_guest?H.participant_id:null,white_ticket_id:U.whitePlayerId,black_ticket_id:U.blackPlayerId,table_number:U.tableNumber,is_bye:U.isBye}}),{error:B}=await re.from("pairings").insert(M);return B?(console.error("Failed to insert pairings:",B),{completed:!0,nextRoundCreated:!0,nextRoundId:u.id,pairingsGenerated:!1,isLastRound:!1,silent:a}):{completed:!0,nextRoundCreated:!0,nextRoundId:u.id,pairingsGenerated:!0,isLastRound:!1,silent:a}},onSuccess:(t,{eventId:n})=>{e.invalidateQueries({queryKey:["event-rounds",n]}),e.invalidateQueries({queryKey:["event-pairings-history",n]}
1295),e.invalidateQueries({queryKey:["tournament-standings",n]}),e.invalidateQueries({queryKey:["points-before-round",n]}),t.nextRoundId&&e.invalidateQueries({queryKey:["round-pairings",t.nextRoundId]}),!t.silent&&(t.isLastRound?je.success("Dernière ronde terminée ! Vous pouvez clôturer le tournoi."):t.pairingsGenerated?je.success("Ronde terminée — Ronde suivante prête !"):t.nextRoundCreated?je.success("Ronde terminée — Générez les appariements manuellement"):je.success("Ronde terminée"))},onError:(t,n)=>{n.silent||je.error("Erreur lors de la transition de ronde"),console.error("[useCompleteRoundAndPrepareNext] Error:",t)}})}function Nqe(){const e=Ye(),{user:t}=Tt();return dt({mutationFn:async({roundId:n,eventId:r,pendingGames:i,currentRoundNumber:a,totalRounds:o})=>{for(const B of i){const U=B.currentResult!=="pending"?B.currentResult:"draw",F=U==="white_wins"?1:U==="draw"?.5:0,H=U==="black_wins"?1:U==="draw"?.5:0,{data:z}=await re.from("game_results").select("id").eq("pairing_id",B.pairingId).maybeSingle();if(z){const{error:K}=await re.from("game_results").update({result:U,white_score:F,black_score:H,validation_status:"staff_override",overridden_by:t==null?void 0:t.id,overridden_at:new Date().toISOString(),override_reason:"Force completion par admin (partie incohérente ou non confirmée)"}).eq("id",z.id);if(K)throw K}else{const{error:K}=await re.from("game_results").insert([{pairing_id:B.pairingId,result:U,white_score:F,black_score:H,validation_status:"staff_override",overridden_by:t==null?void 0:t.id,overridden_at:new Date().toISOString(),override_reason:"Force completion par admin (aucun résultat soumis)",reported_by:t==null?void 0:t.id}]);if(K)throw K}}const{error:l}=await re.from("rounds").update({status:"completed",completed_at:new Date().toISOString()}).eq("id",n);if(l)throw l;if(a>=o)return{completed:!0,nextRoundCreated:!1,pairingsGenerated:!1,isLastRound:!0};const{data:c,error:u}=await re.from("rounds").insert({event_id:r,round_number:a+1,status:"pending"}).select().single();if(u)throw u;const{data:d,error:f}=await re.rpc("get_event_participants",{p_event_id:r});if(f)throw f;const h=new Map,p=new Map;(d||[]).forEach(B=>{h.set(B.ticket_id,B.elo_rating||0),p.set(B.ticket_id,(B.display_name||B.first_name||"").toLowerCase())});const{data:x}=await re.from("tournament_withdrawals").select("ticket_id").eq("event_id",r),y=new Set((x||[]).map(B=>B.ticket_id)),b=(d||[]).filter(B=>!y.has(B.ticket_id)).map(B=>B.ticket_id);if(b.length<2)return{completed:!0,nextRoundCreated:!0,nextRoundId:c.id,pairingsGenerated:!1,isLastRound:!1};const w=new Map;(d||[]).forEach(B=>{!B.is_guest&&B.participant_id&&w.set(B.participant_id,B.ticket_id)});const{data:_,error:j}=await re.from("rounds").select(`
1296          round_number,
1297          pairings(
1298            white_player_id,
1299            black_player_id,
1300            white_ticket_id,
1301            black_ticket_id,
1302            is_bye,
1303            game_result:game_results(result, validation_status)
1304          )
1305        `).eq("event_id",r).neq("id",c.id);if(j)throw j;const E=_.flatMap(B=>B.pairings.map(U=>{const F=Array.isArray(U.game_result)?U.game_result[0]:U.game_result,z=F&&["confirmed","peer_resolved","staff_override"].includes(F.validation_status||"");return{white_player_id:U.white_ticket_id||w.get(U.white_player_id)||U.white_player_id,black_player_id:U.black_ticket_id||(U.black_player_id?w.get(U.black_player_id)||U.black_player_id:null),is_bye:U.is_bye||!1,result:z?F.result:void 0,round_number:B.round_number}})),S=a+1,T=fn(b,E,h,S,p),{data:P}=await re.from("events").select("pairing_engine").eq("id",r).single(),O=(P==null?void 0:P.pairing_engine)||"internal",D=await j6({engine:O,eventId:r,roundNumber:S,players:T}),R=D.pairings;console.log("[useForceCompleteRound] FIDE pairings:",R.length,"warnings:",D.warnings.length,"engine:",O),N6(D,b.length,"useForceCompleteRound",T);const L=R.map(B=>{const U=(d||[]).find(H=>H.ticket_id===B.whitePlayerId),F=B.blackPlayerId?(d||[]).find(H=>H.ticket_id===B.blackPlayerId):null;return{round_id:c.id,white_player_id:U&&!U.is_guest?U.participant_id:null,black_player_id:F&&!F.is_guest?F.participant_id:null,white_ticket_id:B.whitePlayerId,black_ticket_id:B.blackPlayerId,table_number:B.tableNumber,is_bye:B.isBye}}),{error:M}=await re.from("pairings").insert(L);return M?(console.error("Failed to insert pairings:",M),{completed:!0,nextRoundCreated:!0,nextRoundId:c.id,pairingsGenerated:!1,isLastRound:!1}):{completed:!0,nextRoundCreated:!0,nextRoundId:c.id,pairingsGenerated:!0,isLastRound:!1}},onSuccess:(n,{eventId:r})=>
1305{e.invalidateQueries({queryKey:["event-rounds",r]}),e.invalidateQueries({queryKey:["round-pairings"]}),e.invalidateQueries({queryKey:["event-pairings-history",r]}),e.invalidateQueries({queryKey:["tournament-standings",r]}),n.isLastRound?je.success("Override appliqué — Dernière ronde terminée !"):n.pairingsGenerated?je.success("Override appliqué — Ronde suivante prête !"):je.success("Override appliqué — Ronde terminée")},onError:n=>{je.error("Erreur lors du force complete"),console.error(n)}})}function kqe(){const e=Ye(),{user:t}=Tt();return dt({mutationFn:async({pairingId:n,result:r,notes:i})=>{const{data:a}=await re.from("game_results").select("id").eq("pairing_id",n).maybeSingle();if(a){const o=r==="white_wins"?1:r==="draw"?.5:0,l=r==="black_wins"?1:r==="draw"?.5:0,{error:c}=await re.from("game_results").update({result:r,white_score:o,black_score:l,notes:i,confirmed_by:t==null?void 0:t.id,validation_status:"staff_override",overridden_by:t==null?void 0:t.id,overridden_at:new Date().toISOString(),override_reason:"Modification directe par staff"}).eq("id",a.id);if(c)throw c}else{const o=r==="white_wins"?1:r==="draw"?.5:0,l=r==="black_wins"?1:r==="draw"?.5:0,{error:c}=await re.from("game_results").insert({pairing_id:n,result:r,white_score:o,black_score:l,reported_by:t==null?void 0:t.id,notes:i,validation_status:"staff_override",overridden_by:t==null?void 0:t.id,overridden_at:new Date().toISOString(),override_reason:"Saisie directe par staff"});if(c)throw c}},onSuccess:()=>{e.invalidateQueries({queryKey:["round-pairings"]}),e.invalidateQueries({queryKey:["event-pairings-history"]}),e.invalidateQueries({queryKey:["tournament-standings"]}),je.success("Résultat enregistré")},onError:n=>{je.error("Erreur lors de l'enregistrement du résultat"),console.error(n)}})}function Cqe(e){return st({queryKey:["tournament-withdrawals",e],queryFn:async()=>{if(!e)return new Set;const{data:t,error:n}=await re.from("tournament_withdrawals").select("ticket_id").eq("event_id",e);if(n)throw n;return new Set((t||[]).map(r=>r.ticket_id))},enabled:!!e,staleTime:1e4})}function ale(){const e=Ye(),{user:t}=Tt();return dt({mutationFn:async({eventId:n,ticketId:r,reason:i})=>{const{error:a}=await re.from("tournament_withdrawals").insert({event_id:n,ticket_id:r,withdrawn_by:(t==null?void 0:t.id)||null,reason:i||null});if(a)throw a},onSuccess:(n,{eventId:r})=>{e.invalidateQueries({queryKey:["tournament-withdrawals",r]}),e.invalidateQueries({queryKey:["tournament-standings",r]}),e.invalidateQueries({queryKey:["event-participants",r]}),je.success("Joueur retiré du tournoi (forfait général)")},onError:n=>{(n==null?void 0:n.code)==="23505"?je.error("Ce joueur est déjà retiré du tournoi"):je.error((n==null?void 0:n.message)||"Erreur lors du retrait du joueur"),console.error(n)}})}function Eqe(){const e=Ye();return dt({mutationFn:async({eventId:t,ticketId:n})=>{const{error:r}=await re.from("tournament_withdrawals").delete().eq("event_id",t).eq("ticket_id",n);if(r)throw r},onSuccess:(t,{eventId:n})=>{e.invalidateQueries({queryKey:["tournament-withdrawals",n]}),e.invalidateQueries({queryKey:["tournament-standings",n]}),e.invalidateQueries({queryKey:["event-participants",n]}),je.success("Joueur réintégré dans le tournoi")},onError:t=>{je.error((t==null?void 0:t.message)||"Erreur lors de la réintégration"),console.error(t)}})}function Sqe(e,t){const{data:n=[]}=$0(e),{data:r=[]}=uw(t);if(!n.length||!t)return[];const i=new Set;for(const a of r)a.white_ticket_id&&i.add(a.white_ticket_id),a.black_ticket_id&&i.add(a.black_ticket_id);return n.filter(a=>a.ticketId&&!i.has(a.ticketId))}function Aqe(){const e=Ye();return dt({mutationFn:async({pairingId:t,roundId:n})=>{const{error:r}=await re.from("game_results").delete().eq("pairing_id",t);if(r)throw r;const{error:i}=await re.from("pairings").delete().eq("id",t);if(i)throw i;return{pairingId:t,roundId:n}},onSuccess:(t,{roundId:n,eventId:r})=>{e.invalidateQueries({queryKey:["round-pairings",n]}),e.invalidateQueries({queryKey:["event-pairings-history",r]}),e.invalidateQueries({queryKey:["tournament-standings",r]}
1305),e.invalidateQueries({queryKey:["event-participants",r]}),je.success("Appariement supprimé")},onError:t=>{je.error("Erreur lors de la suppression de l'appariement"),console.error(t)}})}function Tqe(){const e=Ye();return dt({mutationFn:async({roundId:t,roundStatus:n})=>{const{data:r,error:i}=await re.from("pairings").select("id").eq("round_id",t);if(i)throw i;const a=(r??[]).map(o=>o.id);if(a.length>0){const{error:o}=await re.from("game_results").delete().in("pairing_id",a);if(o)throw o;const{error:l}=await re.from("pairings").delete().eq("round_id",t);if(l)throw l}if(n==="active"){const{error:o}=await re.from("rounds").update({status:"pending",started_at:null}).eq("id",t);if(o)throw o}return{roundId:t,count:a.length}},onSuccess:({count:t},{roundId:n,eventId:r})=>{e.invalidateQueries({queryKey:["round-pairings",n]}),e.invalidateQueries({queryKey:["event-rounds",r]}),e.invalidateQueries({queryKey:["event-pairings-history",r]}),e.invalidateQueries({queryKey:["tournament-standings",r]}),e.invalidateQueries({queryKey:["event-participants",r]}),je.success(`${t} appariement(s) supprimé(s) — ronde réinitialisée`)},onError:t=>{je.error("Erreur lors du désappariement global"),console.error(t)}})}function Pqe(){const e=Ye();return dt({mutationFn:async({roundId:t,whiteTicketId:n,blackTicketId:r,whitePlayerId:i,blackPlayerId:a,isBye:o,tableNumber:l})=>{const{data:c,error:u}=await re.from("pairings").insert({round_id:t,white_ticket_id:n,black_ticket_id:r,white_player_id:i,black_player_id:a,is_bye:o,table_number:l}).select().single();if(u)throw u;if(!o){const{error:d}=await re.from("game_results").insert({pairing_id:c.id,result:"pending",validation_status:"pending"});if(d)throw d}return c},onSuccess:(t,{roundId:n,eventId:r})=>{e.invalidateQueries({queryKey:["round-pairings",n]}),e.invalidateQueries({queryKey:["event-pairings-history",r]}),e.invalidateQueries({queryKey:["tournament-standings",r]}),je.success("Appariement manuel créé")},onError:t=>{je.error("Erreur lors de la création de l'appariement"),console.error(t)}})}function Oqe(){const e=Ye();return dt({mutationFn:async t=>{const{data:n,error:r}=await re.from("rounds").select("id").eq("event_id",t);if(r)throw r;const i=(n||[]).map(c=>c.id);if(i.length>0){const{data:c,error:u}=await re.from("pairings").select("id").in("round_id",i);if(u)throw u;const d=(c||[]).map(p=>p.id);if(d.length>0){const{error:p}=await re.from("game_results").delete().in("pairing_id",d);if(p)throw p}const{error:f}=await re.from("pairings").delete().in("round_id",i);if(f)throw f;const{error:h}=await re.from("rounds").delete().eq("event_id",t);if(h)throw h}const{error:a}=await re.from("elo_history").delete().eq("event_id",t);if(a)throw a;const{error:o}=await re.from("tournament_withdrawals").delete().eq("event_id",t);if(o)throw o;const{error:l}=await re.from("events").update({status:"ongoing"}).eq("id",t);if(l)throw l;return{eventId:t}},onSuccess:({eventId:t})=>{e.invalidateQueries({queryKey:["event-rounds",t]}),e.invalidateQueries({queryKey:["event-pairings-history",t]}),e.invalidateQueries({queryKey:["tournament-standings",t]}),e.invalidateQueries({queryKey:["event-participants",t]}),e.invalidateQueries({queryKey:["admin-event",t]}),e.invalidateQueries({queryKey:["venue-event",t]}),je.success("Tournoi réinitialisé — prêt à rejouer !")},onError:t=>{je.error("Erreur lors de la réinitialisation du tournoi"),console.error("Reset tournament error:",t)}})}function Dqe(e){return st({queryKey:["crosstable-pairings",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await re.from("rounds").select(`
1306          round_number,
1307          pairings(
1308            white_player_id, black_player_id,
1309            white_ticket_id, black_ticket_id,
1310            is_bye,
1311            game_result:game_results(result, validation_status)
1312          )
1313        `).eq("event_id",e).order("round_number",{ascending:!0});if(n)throw n;return t||[]},staleTime:5e3,enabled:!!e})}function B0(e,t){const{data:n=[],isLoading:r}=k6(e,t),{data:i=[],isLoading:a}=Dqe(e),{data:o=[]}=rE(e),{data:l=[]}=$0(e),c=o.length;return{players:N.useMemo(()=>
1313{if(n.length===0||i.length===0||l.length===0)return[];const d=sle(l),f=new Map;n.forEach((b,w)=>{f.set(b.playerId,w+1)});const h=new Map,p=new Set;n.forEach(b=>{var w;p.add(b.playerId),(w=b.profile)!=null&&w.ticketId&&h.set(b.profile.ticketId,b.playerId)});const x=(b,w)=>w&&h.has(w)?h.get(w):b&&p.has(b)?b:w&&p.has(w)?w:b,y=new Map;n.forEach(b=>{y.set(b.playerId,new Array(c).fill(null))});for(const b of i){const w=b.round_number-1;if(!(w<0||w>=c))for(const _ of b.pairings){const j=x(_.white_player_id,_.white_ticket_id),E=x(_.black_player_id,_.black_ticket_id);let S="",T="";if(_.is_bye)S="+";else{const P=F0(_.game_result);if(P&&P.result&&P.result!=="pending"){const O=P.result;O==="white_wins"?(S="+",T="-"):O==="black_wins"?(S="-",T="+"):O==="draw"&&(S="=",T="=")}}if(j&&y.has(j)){const P=y.get(j);P[w]={opponentRank:_.is_bye?0:E&&f.get(E)||0,color:"W",result:S,isBye:_.is_bye||!1}}if(E&&y.has(E)){const P=y.get(E);P[w]={opponentRank:j&&f.get(j)||0,color:"B",result:T,isBye:!1}}}}return n.map((b,w)=>{var _,j;return{rank:w+1,tpn:d.get(b.playerId)||0,playerId:b.playerId,displayName:((_=b.profile)==null?void 0:_.display_name)||((j=b.profile)==null?void 0:j.first_name)||"Joueur",points:b.points,cells:y.get(b.playerId)||new Array(c).fill(null)}})},[n,i,c,l]),roundsCount:c,isLoading:r||a}}function ole(e,t,n={}){const{pollingEnabled:r=!0,ticketIdOverride:i}=n,a=Ye();return N.useEffect(()=>{if(!e)return;const o=re.channel(`current-pairing-rt-${e}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"pairings"},()=>{setTimeout(()=>{a.invalidateQueries({queryKey:["current-pairing",e]})},0)}).on("postgres_changes",{event:"UPDATE",schema:"public",table:"rounds",filter:`event_id=eq.${e}`},()=>{setTimeout(()=>{a.invalidateQueries({queryKey:["current-pairing",e]})},0)}).subscribe();return()=>{re.removeChannel(o)}},[e,a]),st({queryKey:["current-pairing",e,t,i],queryFn:async()=>{if(!e||!t&&!i)return{pairing:null,round:null,myTicketId:null,isWhitePlayer:!1};const{data:o,error:l}=await re.from("rounds").select("id, round_number, started_at, status").eq("event_id",e).eq("status","active").maybeSingle();if(l)throw l;if(!o)return{pairing:null,round:null,myTicketId:null,isWhitePlayer:!1};let c=i;if(!c&&t){const{data:T}=await re.from("tickets").select("id").eq("event_id",e).eq("user_id",t).eq("is_for_self",!0).maybeSingle();c=T==null?void 0:T.id}let u=re.from("pairings").select("*, game_result:game_results(id, result, white_player_claim, black_player_claim, validation_status)").eq("round_id",o.id);c?u=u.or(`white_ticket_id.eq.${c},black_ticket_id.eq.${c}`):u=u.or(`white_player_id.eq.${t},black_player_id.eq.${t}`);const{data:d,error:f}=await u.maybeSingle();if(f)throw f;if(!d)return{pairing:null,round:o,myTicketId:c||null,isWhitePlayer:!1};const{data:h}=await re.rpc("get_event_pairing_profiles",{p_event_id:e}),p=new Map,x=new Map,y=new Map;(h||[]).forEach(T=>{const O={...{display_name:T.display_name,first_name:T.first_name,last_name:T.last_name},id:T.is_for_self&&T.user_id?T.user_id:T.ticket_id,elo_rating:T.elo_rating??0,avatar_url:T.avatar_url??null};p.set(T.ticket_id,O),T.is_for_self&&T.user_id&&(y.set(T.user_id,O),x.set(T.user_id,T.ticket_id))});let b=null;d.white_ticket_id&&(b=p.get(d.white_ticket_id)||null),!b&&d.white_player_id&&(b=y.get(d.white_player_id)||null);let w=null;d.black_ticket_id&&(w=p.get(d.black_ticket_id)||null),!w&&d.black_player_id&&(w=y.get(d.black_player_id)||null);const _=d.white_player_id===t||d.white_ticket_id===c,j=d.game_result,E=Array.isArray(j)?j[0]||null:j;return{pairing:{id:d.id,table_number:d.table_number,is_bye:d.is_bye||!1,white_player_id:d.white_player_id,black_player_id:d.black_player_id,white_ticket_id:d.white_ticket_id,black_ticket_id:d.black_ticket_id,white_player:b,black_player:w,game_result:E},round:o,myTicketId:c||null,isWhitePlayer:_}},refetchInterval:r?15e3:!1,staleTime:5e3,enabled:!!e&&(!!t||!!i)})}const lle=N.createContext({mode:"auth"});function Iqe({value:e,children:t}){return s.jsx(lle.Provider,{value:e,children:t})}function A6(){return N.useContext(lle)}function fs(e){var r,i,a;if(!e)return"Inconnu";if((r=e.display_name)!=null&&r.trim())return e.display_name.trim();const t=(i=e.first_name)==null?void 0:i.trim(),n=(a=e.last_name)==null?void 0:a.trim();return t&&n?`${t} ${n[0].toUpperCase()}.`:t||(n?`${n[0].toUpperCase()}.`:"Joueur")}function cc(e){if(!e)return"??";const t=fs(e);return t.length<=2?t.replace(".","").toUpperCase():t.split(" ").map(n=>n[0]).filter(n=>n!==".").join("").toUpperCase().slice(0,2)}function ii(e,t){var i,a,o,l,c;if(!e)return"Participant inconnu";
1313const n=(i=e.guest_first_name)==null?void 0:i.trim(),r=(a=e.guest_last_name)==null?void 0:a.trim();if(n||r)return`${n||""} ${r||""}`.trim();if(e.profile){if(t!=null&&t.showFullName){const u=(o=e.profile.display_name)==null?void 0:o.trim();if(u)return u;const d=(l=e.profile.first_name)==null?void 0:l.trim(),f=(c=e.profile.last_name)==null?void 0:c.trim();if(d||f)return`${d||""} ${f||""}`.trim()}return fs(e.profile)}return"Participant"}function T6(e){var r,i;if(!e)return"??";const t=(r=e.guest_first_name)==null?void 0:r.trim(),n=(i=e.guest_last_name)==null?void 0:i.trim();if(t||n){const a=(t==null?void 0:t[0])||"",o=(n==null?void 0:n[0])||"";return`${a}${o}`.toUpperCase()||"??"}return cc(e.profile)}function Rqe({timeControl:e,onLaunch:t,disabled:n=!1}){return s.jsxs("button",{type:"button",onClick:t,disabled:n,className:ae("w-full group","timer-launcher-card","flex items-center justify-between gap-3","p-4 sm:p-5 rounded-2xl","transition-all duration-300 ease-out","touch-manipulation","min-h-[64px] sm:min-h-[72px]",n&&"opacity-50 cursor-not-allowed"),"aria-label":`Ouvrir la pendule - Cadence ${e}`,children:[s.jsxs("div",{className:"flex items-center gap-3 sm:gap-4",children:[s.jsxs("div",{className:"timer-launcher-icon relative flex items-center justify-center w-12 h-12 sm:w-14 sm:h-14 rounded-xl",children:[s.jsx(Vt,{className:"w-6 h-6 sm:w-7 sm:h-7 text-primary"}),s.jsx("div",{className:"absolute inset-0 rounded-xl animate-[timer-launcher-pulse_2s_ease-in-out_infinite] bg-primary/20"})]}),s.jsxs("div",{className:"text-left",children:[s.jsx("p",{className:"font-semibold text-sm sm:text-base text-foreground",children:"Ouvrir la pendule"}),s.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Cadence : ",s.jsx("span",{className:"font-mono font-medium",children:e})]})]})]}),s.jsx("div",{className:"flex items-center gap-2 text-muted-foreground group-hover:text-primary transition-colors",children:s.jsx(QY,{className:"w-5 h-5 sm:w-6 sm:h-6"})})]})}function cle(){const[e]=N.useState(()=>"wakeLock"in navigator),[t,n]=N.useState(!1),r=N.useRef(null),i=N.useRef(!1),a=N.useCallback(async()=>{if(!(!e||i.current))try{i.current=!0,r.current=await navigator.wakeLock.request("screen"),n(!0),r.current.addEventListener("release",()=>{n(!1)})}catch(l){console.warn("Wake Lock request failed:",l)}finally{i.current=!1}},[e]),o=N.useCallback(async()=>{if(r.current){try{await r.current.release()}catch{}r.current=null,n(!1)}},[]);return N.useEffect(()=>{if(!e)return;const l=async()=>{document.visibilityState==="visible"&&r.current===null&&t&&await a()};return document.addEventListener("visibilitychange",l),()=>{document.removeEventListener("visibilitychange",l)}},[e,t,a]),N.useEffect(()=>()=>{r.current&&(r.current.release().catch(()=>{}),r.current=null)},[]),{isSupported:e,isActive:t,request:a,release:o}}const Mqe="chess-timer-";function Lqe(e){const t=e.match(/^(\d+)\+?(\d*)/),n=t?parseInt(t[1],10):10,r=t&&t[2]?parseInt(t[2],10):0;return{baseMs:n*60*1e3,incrementMs:r*1e3}}function bP(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/60),r=t%60;return`${n.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function Fqe(e,t){const{baseMs:n,incrementMs:r}=Lqe(t),i=`${Mqe}${e}`,{isSupported:a,isActive:o,request:l,release:c}=cle(),u=N.useCallback(()=>{try{const w=localStorage.getItem(i);if(w){const _=JSON.parse(w),j=_.plyCount??_.moveCount??0,E={whiteTimeMs:_.whiteTimeMs??n,blackTimeMs:_.blackTimeMs??n,activeColor:_.activeColor??null,startedAt:_.startedAt??null,lastTickAt:_.lastTickAt??Date.now(),plyCount:j};if(E.activeColor&&E.lastTickAt){const S=Date.now()-E.lastTickAt;E.activeColor==="white"?E.whiteTimeMs=Math.max(0,E.whiteTimeMs-S):E.blackTimeMs=Math.max(0,E.blackTimeMs-S),E.lastTickAt=Date.now()}return E}}catch{}return{whiteTimeMs:n,blackTimeMs:n,activeColor:null,startedAt:null,lastTickAt:Date.now(),plyCount:0}},[i,n]),[d,f]=N.useState(u),h=N.useRef(null);N.useEffect(()=>{try{localStorage.setItem(i,JSON.stringify(d))}catch{}},[d,i]),N.useEffect(()=>{d.activeColor&&a&&!o?l():!d.activeColor&&o&&c()},[d.activeColor,a,o,l,c]),N.useEffect(()=>(d.activeColor&&(h.current=window.setInterval(()=>{f(w=>{const _=Date.now(),j=_-w.lastTickAt;return w.activeColor==="white"?{...w,whiteTimeMs:Math.max(0,w.whiteTimeMs-j),lastTickAt:_}:w.activeColor==="black"?{...w,blackTimeMs:Math.max(0,w.blackTimeMs-j),lastTickAt:_}:w})},100)),()=>{h.current&&(clearInterval(h.current),h.current=null)}),[d.activeColor]),N.useEffect(()=>{const w=()=>{document.visibilityState==="visible"&&d.activeColor&&f(_=>{const j=Date.now(),E=j-_.lastTickAt;return _.activeColor==="white"?{..._,whiteTimeMs:Math.max(0,_.whiteTimeMs-E),lastTickAt:j}:_.activeColor==="black"?{..._,blackTimeMs:Math.max(0,_.blackTimeMs-E),lastTickAt:j}:_})};return document.addEventListener("visibilitychange",w),()=>document.removeEventListener("visibilitychange",w)},[d.activeColor]),N.useEffect(()=>()=>{h.current&&clearInterval(h.current),o&&c()},[o,c]);const p=N.useCallback(w=>{f(_=>({..._,activeColor:w,startedAt:Date.now(),lastTickAt:Date.now()}))},[]),x=N.useCallback(()=>{f(w=>{if(!w.activeColor)return w;const _=Date.now(),j=_-w.lastTickAt,E=w.activeColor==="white"?"black":"white";let S=w.whiteTimeMs,T=w.blackTimeMs;return w.activeColor==="white"?S=Math.max(0,w.whiteTimeMs-j)+r:T=Math.max(0,w.blackTimeMs-j)+r,{...w,whiteTimeMs:S,blackTimeMs:T,activeColor:E,lastTickAt:_,plyCount:w.plyCount+1}})},[r]),y=N.useCallback(()=>{f(w=>{if(!w.activeColor)return w;const _=Date.now(),j=_-w.lastTickAt;let E=w.whiteTimeMs,S=w.blackTimeMs;return w.activeColor==="white"?E=Math.max(0,w.whiteTimeMs-j):S=Math.max(0,w.blackTimeMs-j),{...w,whiteTimeMs:E,blackTimeMs:S,activeColor:null,lastTickAt:_}})},[]),b=N.useCallback(()=>{f({whiteTimeMs:n,blackTimeMs:n,activeColor:null,startedAt:null,lastTickAt:Date.now(),plyCount:0});try{localStorage.removeItem(i)}catch{}},[n,i]);return{whiteTime:d.whiteTimeMs,blackTime:d.blackTimeMs,activeColor:d.activeColor,isRunning:d.activeColor!==null,plyCount:d.plyCount,fullMoveNumber:Math.ceil(d.plyCount/2),start:p,toggleTurn:x,pause:y,reset:b,formatTime:bP}}function $qe(e){const[t,n]=N.useState(!1),r=typeof document<"u"&&("fullscreenEnabled"in document||"webkitFullscreenEnabled"in document||"mozFullScreenEnabled"in document),i=N.useCallback(async()=>{const l=e.current;if(l)try{l.requestFullscreen?await l.requestFullscreen():l.webkitRequestFullscreen?await l.webkitRequestFullscreen():l.mozRequestFullScreen?await l.mozRequestFullScreen():n(!0)}catch(c){console.warn("Fullscreen API failed, using CSS fallback:",c),n(!0)}},[e]),a=N.useCallback(async()=>{try{document.exitFullscreen?await document.exitFullscreen():document.webkitExitFullscreen?await document.webkitExitFullscreen():document.mozCancelFullScreen&&await document.mozCancelFullScreen()}catch{}n(!1)},[]),o=N.useCallback(async()=>{t?await a():await i()},[t,i,a]);return N.useEffect(()=>{const l=()=>{const c=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement;n(!!c)};return document.addEventListener("fullscreenchange",l),document.addEventListener("webkitfullscreenchange",l),document.addEventListener("mozfullscreenchange",l),()=>{document.removeEventListener("fullscreenchange",l),document.removeEventListener("webkitfullscreenchange",l),document.removeEventListener("mozfullscreenchange",l)}},[]),N.useEffect(()=>{const l=c=>{c.key==="Escape"&&t&&a()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),{isFullscreen:t,isSupported:r,enter:i,exit:a,toggle:o}}function ule({pairingId:e,timeControl:t,isWhitePlayer:n=!0,whitePlayer:r=null,blackPlayer:i=null,onClose:a}){const o=N.useRef(null),{isFullscreen:l,enter:c,exit:u}=$qe(o),{whiteTime:d,blackTime:f,activeColor:h,isRunning:p,fullMoveNumber:x,start:y,toggleTurn:b,pause:w,reset:_}=Fqe(e,t);N.useEffect(()=>(c(),()=>{u()}),[c,u]),N.useEffect(()=>{const H=window.scrollY,z={overflow:document.body.style.overflow,position:document.body.style.position,width:document.body.style.width,top:document.body.style.top};return document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.top=`-${H}px`,()=>{document.body.style.overflow=z.overflow,document.body.style.position=z.position,document.body.style.width=z.width,document.body.style.top=z.top,window.scrollTo(0,H)}},[]);const j=async()=>{await u(),a()},E=()=>{y("white")},S=H=>
1313{p&&h===H&&(b(),navigator.vibrate&&navigator.vibrate(10))},T=()=>{p?w():h===null&&(d>0||f>0)&&y("white")},P=()=>{_()},O=H=>H<=6e4&&H>0,D=H=>H<=0,R=n?i:r,L=n?"black":"white",M=n?"white":"black",B=n?f:d,U=n?d:f,F=s.jsxs("div",{ref:o,className:ae("fullscreen-timer-container","bg-[hsl(20_14%_6%)]","touch-manipulation select-none",!l&&"fixed inset-0"),children:[s.jsxs("div",{className:"timer-clocks-container",children:[s.jsxs("button",{type:"button",onClick:()=>S(L),disabled:!p||h!==L,className:ae("timer-clock-block","timer-opponent-clock","flex flex-col items-center justify-center","transition-all duration-200","relative overflow-hidden","bg-[hsl(20_14%_12%)]",h===L&&p&&!D(B)&&"timer-active",h!==L&&p&&"timer-inactive",h===L&&O(B)&&["timer-low-time","!bg-[hsl(0_62%_20%)]","ring-2 ring-[hsl(0_62%_45%)]"],D(B)&&"!bg-[hsl(0_62%_15%)]"),children:[s.jsx("div",{className:ae("absolute top-3 left-3 w-4 h-4 rounded-full",L==="white"?"border-2 border-[hsl(40_20%_70%)] bg-transparent":"bg-[hsl(40_20%_70%)]")}),s.jsx("span",{className:ae("timer-time-display font-mono tabular-nums tracking-tight font-bold",!p&&"text-white",D(B)&&"!text-[hsl(0_62%_60%)]"),children:bP(B)}),s.jsxs("span",{className:"timer-player-name text-xs",children:[fs(R)||"Adversaire"," (",L==="white"?"Blancs":"Noirs",")"]})]}),s.jsxs("button",{type:"button",onClick:()=>S(M),disabled:!p||h!==M,className:ae("timer-clock-block","timer-my-clock","flex flex-col items-center justify-center","transition-all duration-200","relative overflow-hidden","bg-[hsl(32_30%_15%)]",h===M&&p&&!D(U)&&"timer-active",h!==M&&p&&"timer-inactive",h===M&&O(U)&&["timer-low-time","!bg-[hsl(0_62%_20%)]","ring-2 ring-[hsl(0_62%_45%)]"],D(U)&&"!bg-[hsl(0_62%_15%)]"),children:[s.jsx("div",{className:ae("absolute top-3 left-3 w-4 h-4 rounded-full",M==="white"?"border-2 border-[hsl(40_20%_70%)] bg-transparent":"bg-[hsl(40_20%_70%)]")}
1313),s.jsx("span",{className:ae("timer-time-display font-mono tabular-nums tracking-tight font-bold",!p&&"text-white",D(U)&&"!text-[hsl(0_62%_60%)]"),children:bP(U)}),s.jsxs("span",{className:"timer-player-name text-xs",children:["VOUS (",M==="white"?"Blancs":"Noirs",")"]})]})]}),!p&&h===null?s.jsx("div",{className:"timer-controls-center",children:s.jsxs(Q,{onClick:E,className:"px-6 py-3 text-sm font-semibold bg-[hsl(32_95%_44%)] hover:bg-[hsl(32_95%_50%)] text-[hsl(20_14%_8%)] rounded-full",children:[s.jsx(Na,{className:"w-4 h-4 mr-2"}),"Démarrer"]})}):s.jsxs("div",{className:"timer-controls-center",children:[s.jsx(Q,{variant:"ghost",size:"icon",onClick:j,className:"h-10 w-10 rounded-full bg-[hsl(20_14%_18%)] text-[hsl(40_20%_70%)] hover:text-[hsl(40_20%_95%)] hover:bg-[hsl(20_14%_25%)]","aria-label":"Fermer",children:s.jsx(Er,{className:"w-5 h-5"})}),s.jsx("div",{className:"flex items-center px-3 py-1 rounded-full bg-[hsl(20_14%_18%)]",children:s.jsxs("span",{className:"text-xs font-medium text-[hsl(40_20%_60%)]",children:["Coup: ",s.jsx("span",{className:"font-mono font-bold text-[hsl(40_20%_85%)]",children:x})]})}),p&&s.jsx(Q,{variant:"ghost",size:"icon",onClick:P,className:"h-10 w-10 rounded-full bg-[hsl(20_14%_18%)] text-[hsl(40_20%_50%)] hover:text-[hsl(40_20%_95%)] hover:bg-[hsl(20_14%_25%)]","aria-label":"Réinitialiser",children:s.jsx(Il,{className:"w-4 h-4"})}),s.jsx(Q,{variant:"ghost",size:"icon",onClick:T,className:"h-10 w-10 rounded-full bg-[hsl(20_14%_18%)] text-[hsl(40_20%_70%)] hover:text-[hsl(40_20%_95%)] hover:bg-[hsl(20_14%_25%)]","aria-label":p?"Pause":"Reprendre",children:p?s.jsx(pxe,{className:"w-5 h-5"}):s.jsx(Na,{className:"w-5 h-5"})})]})]});return Yf.createPortal(F,document.body)}function Bqe({result:e,resultLabel:t,userRank:n,totalPlayers:r,roundProgress:i,currentRound:a,totalRounds:o,isTransitioning:l=!1,venueId:c,ticketCreditRemainingCents:u,ticketCreditTotalCents:d,ticketQrCode:f,ticketReservationCode:h}){const[p,x]=N.useState(!1),y=a>=o,b=a+1,_=(()=>{switch(e){case"won":return{icon:Xt,iconClass:"text-amber-500",bgClass:"from-amber-500/20 via-amber-500/10 to-amber-500/5",borderClass:"border-amber-500/40",label:"Victoire"};case"lost":return{icon:JY,iconClass:"text-muted-foreground",bgClass:"from-muted/30 via-muted/20 to-muted/10",borderClass:"border-muted-foreground/30",label:"Défaite"};case"draw":return{icon:lu,iconClass:"text-primary",bgClass:"from-primary/15 via-primary/10 to-primary/5",borderClass:"border-primary/30",label:"Nulle"}}})(),j=_.icon;return s.jsxs("div",{className:ae("relative overflow-hidden rounded-2xl border-2 backdrop-blur-xl","bg-gradient-to-br",_.bgClass,_.borderClass,"shadow-lg"),children:[s.jsxs("div",{className:"p-4 sm:p-5 text-center border-b border-foreground
1313/10",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 sm:w-14 sm:h-14 rounded-full bg-background/50 mb-3",children:s.jsx(j,{className:ae("w-6 h-6 sm:w-7 sm:h-7",_.iconClass)})}),s.jsx("h3",{className:"font-display text-lg sm:text-xl font-bold mb-1",children:"Partie terminée"}),s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx("span",{className:ae("font-mono text-xl sm:text-2xl font-black",e==="won"&&"text-amber-500",e==="lost"&&"text-muted-foreground",e==="draw"&&"text-primary"),children:t}),s.jsxs("span",{className:"text-sm sm:text-base text-muted-foreground",children:["• ",_.label]})]}),n&&r&&s.jsxs("p",{className:"text-sm sm:text-base text-muted-foreground mt-2",children:["Classement provisoire : ",s.jsxs("span",{className:"font-semibold text-foreground",children:["#",n]})," sur ",r]})]}),s.jsxs("div",{className:"p-4 sm:p-5",children:[s.jsx("div",{className:ae("rounded-xl p-4 sm:p-5","bg-gradient-to-r from-background/80 to-background/60","backdrop-blur-sm border border-foreground
1313/10"),children:l?s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-primary/20 mb-2",children:s.jsx(We,{className:"w-5 h-5 text-primary animate-spin"})}),s.jsx("p",{className:"font-semibold text-base sm:text-lg",children:"Préparation en cours..."}),s.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["La ronde ",b," sera prête dans quelques secondes"]})]}):i.isRoundComplete?s.jsx(s.Fragment,{children:y?s.jsxs("div",{className:"text-center",children:[s.jsx(Xt,{className:"w-8 h-8 sm:w-10 sm:h-10 text-amber-500 mx-auto mb-2 animate-pulse"}),s.jsx("p",{className:"font-semibold text-base sm:text-lg",children:"Tournoi terminé !"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Découvrez le classement final"})]}):s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-green-500/20 mb-2",children:s.jsx(Jr,{className:"w-5 h-5 text-green-500"})}),s.jsx("p",{className:"font-semibold text-base sm:text-lg text-green-600 dark:text-green-400",children:"C'est parti !"}),s.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Ronde ",b," démarrée"]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:`Retrouvez votre adversaire dans l'onglet "Mes parties"`})]})}):s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-primary/20 mb-2",children:s.jsx(Vt,{className:"w-5 h-5 text-primary"})}),s.jsx("p",{className:"font-semibold text-base sm:text-lg",children:"En attente..."}),s.jsxs("p",{className:"text-sm text-muted-foreground mt-1.5",children:[s.jsx("span",{className:"font-mono font-semibold text-foreground",children:i.pendingGames})," ","partie",i.pendingGames>1?"s":""," encore en cours"]}),s.jsx("div",{className:"mt-3 w-full h-2 bg-muted/50 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-primary/70 rounded-full transition-all duration-500",style:{width:`${i.totalGames>0?i.completedGames/i.totalGames*100:0}%`}})}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1.5",children:[i.completedGames,"/",i.totalGames," terminées"]}),s.jsx("p",{className:"text-[10px] text-muted-foreground/60 mt-3",children:"Les données se mettent à jour automatiquement. Si l'information ne semble pas à jour, rafraîchissez la page."})]})}),!i.isRoundComplete&&!l&&s.jsx("div",{className:ae("mt-3 sm:mt-4 p-3 rounded-lg","bg-amber-500/10 border border-amber-500/20"),children:s.jsxs("div",{className:"flex items-start gap-2.5",children:[s.jsx(eu,{className:"w-4 h-4 sm:w-5 sm:h-5 text-amber-600 flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-xs sm:text-sm text-amber-700 dark:text-amber-400",children:"C'est le moment idéal pour profiter de votre avantage food & drinks !"}),c&&s.jsx(Q,{variant:"link",size:"sm",className:"p-0 h-auto text-xs sm:text-sm text-amber-600 hover:text-amber-700 font-medium mt-1",onClick:()=>x(!0),children:"Voir le menu →"})]})]})})]}),c&&s.jsx(w6,{open:p,onOpenChange:x,venueId:c,creditRemainingCents:u,creditTotalCents:d,qrCode:f,reservationCode:h})]})}const zqe=32,Sz=KT,wP=100,_P=3e3;function Az(e,t,n){const r=1/(1+Math.pow(10,(t-e)/400)),a=Math.round(e+zqe*((n==="win"?1:n==="draw"?.5:0)-r));return Math.max(wP,Math.min(_P,a))}function Uqe(){const e=Ye(),{toast:t}=_r();return dt({mutationFn:async({userId:n,newElo:r})=>{if(r!==null&&(r<wP||r>_P))throw new Error(`Le Elo doit être entre ${wP} et ${_P}`);const{data:i,error:a}=await re.from("player_stats").select("elo_rating").eq("user_id",n).maybeSingle();if(a)throw a;const o=i==null?void 0:i.elo_rating,{error:l}=await re.from("player_stats").update({elo_rating:r,elo_source:"manual",updated_at:new Date().toISOString()}).eq("user_id",n);if(l)throw l;if(r!==null){const{error:c}=await re.from("elo_history").insert({user_id:n,old_elo:o,new_elo:r,change_reason:"manual_entry"});if(c)throw c}return{oldElo:o,newElo:r}},onSuccess:n=>
1313{e.invalidateQueries({queryKey:["player-stats"]}),e.invalidateQueries({queryKey:["elo-history"]}),t({title:"Elo mis à jour",description:n.newElo?`Votre classement est maintenant de ${n.newElo}`:"Votre classement a été réinitialisé"})},onError:n=>{t({title:"Erreur",description:n.message||"Impossible de mettre à jour le Elo",variant:"destructive"})}})}function dle(){const e=Ye();return dt({mutationFn:async({whitePlayerId:t,blackPlayerId:n,result:r,eventId:i,pairingId:a})=>{const{data:o,error:l}=await re.from("player_stats").select("user_id, elo_rating, elo_tracking_enabled").in("user_id",[t,n]);if(l)throw l;const c=o==null?void 0:o.find(j=>j.user_id===t),u=o==null?void 0:o.find(j=>j.user_id===n),d=(c==null?void 0:c.elo_rating)??Sz,f=(u==null?void 0:u.elo_rating)??Sz,h=(c==null?void 0:c.elo_tracking_enabled)!==!1,p=(u==null?void 0:u.elo_tracking_enabled)!==!1,x=r==="white_wins"?"win":r==="black_wins"?"loss":"draw",y=r==="black_wins"?"win":r==="white_wins"?"loss":"draw",b=Az(d,f,x),w=Az(f,d,y),_=[];h&&_.push({userId:t,oldElo:d,newElo:b}),p&&_.push({userId:n,oldElo:f,newElo:w});for(const j of _)await re.from("player_stats").update({elo_rating:j.newElo,elo_source:"calculated",updated_at:new Date().toISOString()}).eq("user_id",j.userId),await re.from("elo_history").insert({user_id:j.userId,event_id:i,pairing_id:a,old_elo:j.oldElo,new_elo:j.newElo,change_reason:"game_result"});return{white:{old:d,new:h?b:d,change:h?b-d:0,trackingEnabled:h},black:{old:f,new:p?w:f,change:p?w-f:0,trackingEnabled:p}}},onSuccess:()=>{e.invalidateQueries({queryKey:["player-stats"]}),e.invalidateQueries({queryKey:["elo-history"]}),e.invalidateQueries({queryKey:["tournament-standings"]})}})}function fle(e){return st({queryKey:["elo-history",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await re.from("elo_history").select(`
1314          id,
1315          old_elo,
1316          new_elo,
1317          change_reason,
1318          created_at,
1319          event:events(id, title),
1320          pairing:pairings(id)
1321        `).eq("user_id",e).order("created_at",{ascending:!1}).limit(20);if(n)throw n;return t},enabled:!!e})}function P6(e){const t=(e==null?void 0:e.message)||"";return t.includes("invalid_token")?"Lien expiré ou invalide. Reconnectez-vous via votre billet.":t.includes("pairing_not_found_for_ticket")?"Cette partie ne vous appartient pas.":t.includes("invalid_claim")?"Résultat invalide.":"Action impossible. Réessayez."}function hle(){const e=Ye(),t=A6();return dt({mutationFn:async({pairingId:n,claim:r,isWhitePlayer:i})=>{var c;if(t.mode==="token"){if(r==="pending")throw new Error("invalid_claim");const{data:u,error:d}=await re.rpc("report_game_result_via_token",{p_access_token:t.accessToken,p_event_id:t.eventId,p_pairing_id:n,p_claim:r});if(d)throw d;return u}const{data:a}=await re.from("game_results").select("*").eq("pairing_id",n).maybeSingle(),o=i?"white_player_claim":"black_player_claim",l=i?"black_player_claim":"white_player_claim";if(a){const u=a[l];let d,f;u?u===r?(d="confirmed",f=r):(d="disputed",f="pending"):(d="confirmed",f=r);const h={[o]:r,validation_status:d,result:f,...d==="disputed"&&{dispute_opened_at:new Date().toISOString()}},{data:p,error:x}=await re.from("game_results").update(h).eq("id",a.id).select().single();if(x)throw x;return p}else{const{data:u,error:d}=await re.from("game_results").insert({pairing_id:n,[o]:r,result:r,validation_status:"confirmed",reported_by:(c=(await re.auth.getUser()).data.user)==null?void 0:c.id}).select().single();if(d)throw d;return u}},onSuccess:n=>{e.invalidateQueries({queryKey:["round-pairings"]}),e.invalidateQueries({queryKey:["round-progress"]}),e.invalidateQueries({queryKey:["event-disputes"]}),e.invalidateQueries({queryKey:["tournament-standings"]}),e.invalidateQueries({queryKey:["event-pairings-history"]}),e.invalidateQueries({queryKey:["my-tournament-games"]}),e.invalidateQueries({queryKey:["current-pairing"]}),n.validation_status==="confirmed"?dn({title:"Score enregistré ✓",description:"Votre résultat a été validé."}):n.validation_status==="disputed"&&dn({title:"Résultat contesté",description:"Les autres joueurs peuvent voter pour aider à résoudre.",variant:"destructive"})},onError:n=>{dn({title:"Erreur",description:t.mode==="token"?P6(n):"Impossible de soumettre le score.",variant:"destructive"})}})}
1321function qqe(){const e=Ye(),t=dle(),n=A6();return dt({mutationFn:async({gameResultId:r,opponentClaim:i,isWhitePlayer:a,pairingId:o,whitePlayerId:l,blackPlayerId:c,eventId:u})=>{if(n.mode==="token"){if(i==="pending")throw new Error("invalid_claim");const{data:p,error:x}=await re.rpc("confirm_game_result_via_token",{p_access_token:n.accessToken,p_event_id:n.eventId,p_game_result_id:r,p_opponent_claim:i});if(x)throw x;return p}const d=a?"white_player_claim":"black_player_claim",{data:f,error:h}=await re.from("game_results").update({[d]:i,validation_status:"confirmed",result:i}).eq("id",r).select().single();if(h)throw h;return i!=="pending"&&await t.mutateAsync({whitePlayerId:l,blackPlayerId:c,result:i,eventId:u,pairingId:o}),f},onSuccess:()=>{e.invalidateQueries({queryKey:["round-pairings"]}),e.invalidateQueries({queryKey:["player-stats"]}),e.invalidateQueries({queryKey:["my-tournament-games"]}),e.invalidateQueries({queryKey:["current-pairing"]}),dn({title:"Score confirmé",description:"La partie est validée."})},onError:r=>{dn({title:"Erreur",description:n.mode==="token"?P6(r):"Impossible de confirmer.",variant:"destructive"})}})}function Vqe(){const e=Ye(),t=A6();return dt({mutationFn:async({gameResultId:n,myClaim:r,isWhitePlayer:i})=>{if(t.mode==="token"){if(r==="pending")throw new Error("invalid_claim");const{data:c,error:u}=await re.rpc("open_dispute_via_token",{p_access_token:t.accessToken,p_event_id:t.eventId,p_game_result_id:n,p_my_claim:r});if(u)throw u;return c}const a=i?"white_player_claim":"black_player_claim",{data:o,error:l}=await re.from("game_results").update({[a]:r,validation_status:"disputed",dispute_opened_at:new Date().toISOString()}).eq("id",n).select().single();if(l)throw l;return o},onSuccess:()=>{e.invalidateQueries({queryKey:["round-pairings"]}),e.invalidateQueries({queryKey:["event-disputes"]}),e.invalidateQueries({queryKey:["my-tournament-games"]}),e.invalidateQueries({queryKey:["current-pairing"]}),dn({title:"Dispute ouverte",description:"Les autres joueurs peuvent voter.",variant:"destructive"})},onError:n=>{dn({title:"Erreur",description:t.mode==="token"?P6(n):"Impossible d'ouvrir la dispute.",variant:"destructive"})}})}function Hqe(){const e=Ye(),t=dle();return dt({mutationFn:async({gameResultId:n,result:r,reason:i,whitePlayerId:a,blackPlayerId:o,eventId:l,pairingId:c})=>{const u=(await re.auth.getUser()).data.user;if(!u)throw new Error("Non authentifié");const{data:d,error:f}=await re.from("game_results").update({result:r,validation_status:"staff_override",overridden_by:u.id,overridden_at:new Date().toISOString(),override_reason:i}).eq("id",n).select().single();if(f)throw f;return r!=="pending"&&await t.mutateAsync({whitePlayerId:a,blackPlayerId:o,result:r,eventId:l,pairingId:c}),d},onSuccess:()=>{e.invalidateQueries({queryKey:["round-pairings"]}),e.invalidateQueries({queryKey:["event-disputes"]}),e.invalidateQueries({queryKey:["player-stats"]}),e.invalidateQueries({queryKey:["elo-history"]}),dn({title:"Override appliqué",description:"Le score a été défini et les Elos mis à jour."})},onError:()=>{dn({title:"Erreur",description:"Impossible d'appliquer l'override.",variant:"destructive"})}})}function Wqe(e){return st({queryKey:["event-disputes",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await re.from("game_results").select(`
1322          *,
1323          pairing:pairings!inner(
1324            id,
1325            table_number,
1326            round:rounds!inner(
1327              id,
1328              round_number,
1329              event_id
1330            ),
1331            white_player:profiles!pairings_white_player_id_fkey(
1332              id, display_name, first_name, last_name
1333            ),
1334            black_player:profiles!pairings_black_player_id_fkey(
1335              id, display_name, first_name, last_name
1336            )
1337          )
1338        `).eq("pairing.round.event_id",e).eq("validation_status","disputed");if(n)throw n;return t||[]},enabled:!!e})}function Gqe(e,t,n={}){const{ticketIdOverride:r}=n;return st({queryKey:["my-tournament-games",e,t,r],queryFn:async()=>{if(!e)return[];if(!t&&!r)return[];let i=r;if(!i&&t){const{data:f}=await re.from("tickets").select("id").eq("event_id",e).eq("user_id",t).eq("is_for_self",!0).maybeSingle();i=f==null?void 0:f.id}const a=i?`white_ticket_id.eq.${i},black_ticket_id.eq.${i}`:`white_player_id.eq.${t},black_player_id.eq.${t}`,{data:o,error:l}=await re.from("pairings").select(`
1339          *,
1340          round:rounds!inner(
1341            id,
1342            round_number,
1343            status,
1344            event_id
1345          ),
1346          game_result:game_results(*)
1347        `).eq("round.event_id",e).or(a).order("round_number",{foreignTable:"round",ascending:!0});if(l)throw l;if(!(o!=null&&o.length))return[];const{data:c}=await re.rpc("get_event_pairing_profiles",{p_event_id:e}),u=new Map,d=new Map;
1347return(c||[]).forEach(f=>{const h={id:f.is_for_self&&f.user_id?f.user_id:f.ticket_id,display_name:f.display_name,first_name:f.first_name,last_name:f.last_name,avatar_url:f.avatar_url??null,elo_rating:f.elo_rating??0};u.set(f.ticket_id,h),f.is_for_self&&f.user_id&&d.set(f.user_id,h)}),o.map(f=>({...f,white_player:f.white_ticket_id&&u.get(f.white_ticket_id)||f.white_player_id&&d.get(f.white_player_id)||null,black_player:f.black_ticket_id&&u.get(f.black_ticket_id)||f.black_player_id&&d.get(f.black_player_id)||null}))},enabled:!!e&&(!!t||!!r)})}function mle(e,t){const{pollingEnabled:n=!0}=t||{},r=Ye(),i=st({queryKey:["round-progress",e],queryFn:async()=>{if(!e)return{totalGames:0,completedGames:0,pendingGames:0,isRoundComplete:!1};const{data:a,error:o}=await re.from("pairings").select(`
1348          id,
1349          is_bye,
1350          game_result:game_results(result, validation_status)
1351        `).eq("round_id",e);if(o)throw o;const l=(a==null?void 0:a.filter(d=>!d.is_bye))||[],c=l.length,u=l.filter(d=>{const f=Array.isArray(d.game_result)?d.game_result[0]:d.game_result;return f?f.result!=="pending"&&["confirmed","peer_resolved","staff_override"].includes(f.validation_status||""):!1}).length;return{totalGames:c,completedGames:u,pendingGames:c-u,isRoundComplete:c>0&&u===c}},enabled:!!e,staleTime:5e3,refetchInterval:n?1e4:!1,placeholderData:hp});return N.useEffect(()=>{if(!e)return;const a=re.channel(`round-progress-${e}`).on("postgres_changes",{event:"*",schema:"public",table:"game_results"},()=>{r.invalidateQueries({queryKey:["round-progress",e]})}).subscribe();return()=>{re.removeChannel(a)}},[e,r]),i}const E4={white_wins:"1 - 0",black_wins:"0 - 1",draw:"½ - ½",pending:"? - ?"};function ple({pairing:e,round:t,totalRounds:n,userId:r,timeControl:i,eventId:a,isWhitePlayer:o,userRank:l,totalPlayers:c,isTransitioning:u=!1,onTimerStart:d,onTimerStop:f,userPoints:h,opponentPoints:p,venueId:x,ticketCreditRemainingCents:y,ticketCreditTotalCents:b,ticketQrCode:w,ticketReservationCode:_}){const[j,E]=N.useState(!1),{setTimerActive:S}=_6(),T=hle(),P=mle(t.id,{pollingEnabled:!j}),O=o?e.black_player:e.white_player;fs(O);const D=e.game_result,R=o?D==null?void 0:D.white_player_claim:D==null?void 0:D.black_player_claim,L=o?D==null?void 0:D.black_player_claim:D==null?void 0:D.white_player_claim,M=(D==null?void 0:D.validation_status)||"pending",B=(D==null?void 0:D.result)||"pending",U=M==="confirmed"||M==="peer_resolved"||M==="staff_override",F=()=>{const Z=o?"white_wins":"black_wins";T.mutate({pairingId:e.id,claim:Z,isWhitePlayer:o})},H=()=>{T.mutate({pairingId:e.id,claim:"draw",isWhitePlayer:o})},z=()=>{const Z=o?"black_wins":"white_wins";T.mutate({pairingId:e.id,claim:Z,isWhitePlayer:o})},K=()=>{E(!0),S(!0),d==null||d()},W=()=>{E(!1),S(!1),f==null||f()},q=T.isPending,oe=()=>B==="draw"?"draw":B==="white_wins"&&o||B==="black_wins"&&!o?"won":"lost",J=Z=>{const G=Math.floor(Z);return Z%1!==0?`${G}½`:`${Z}`},Y=({player:Z,isMe:G,colorLabel:se,colorIndicatorClass:ce,tournamentPoints:le})=>s.jsx("div",{className:ae("flex-1 p-2.5 sm:p-3 rounded-xl transition-all",G?"bg-primary/10 border border-primary/30":"bg-muted/30"),children:s.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx("div",{className:ae("w-2.5 h-2.5 sm:w-3 sm:h-3 rounded-full absolute -top-0.5 -left-0.5 z-10",ce)}),s.jsxs(Bi,{className:"h-8 w-8 sm:h-10 sm:w-10",children:[s.jsx(Ra,{src:(Z==null?void 0:Z.avatar_url)||void 0}),s.jsx(zi,{className:"text-xs sm:text-sm",children:cc(Z)})]})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:ae("font-medium text-sm sm:text-base truncate",G&&"text-primary"),children:G?"Vous":fs(Z)||"Adversaire"}),s.jsxs("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:[se,` • ${qf(Z==null?void 0:Z.elo_rating)}`,le!=null?` • ${J(le)} pts`:""]})]})]})});return U?s.jsx(Bqe,{result:oe(),resultLabel:E4[B],userRank:l,totalPlayers:c,roundProgress:P.data||{totalGames:0,completedGames:0,pendingGames:0,isRoundComplete:!1},currentRound:t.round_number,totalRounds:n,isTransitioning:u,venueId:x,ticketCreditRemainingCents:y,ticketCreditTotalCents:b,ticketQrCode:w,ticketReservationCode:_}):s.jsxs(Se,{className:"relative overflow-hidden bg-gradient-to-br from-primary/10 via-background to-primary/5 backdrop-blur-xl border-2 border-primary/30 shadow-2xl",children:[s.jsx("div",{className:"bg-gradient-to-r from-primary/20 to-primary/10 px-3 sm:px-5 py-2.5 sm:py-3 border-b border-primary/20",children:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.table_number&&s.jsxs("span",{className:"font-display text-xl sm:text-2xl md:text-3xl font-black text-primary",children:["Table ",e.table_number]}),s.jsxs(we,{variant:"outline",className:"font-medium text-[10px] sm:text-xs",children:["R",t.round_number,"/",n]})]}),R?s.jsxs(we,{variant:"secondary",className:"gap-1 text-[10px] sm:text-xs",children:[s.jsx(Vt,{className:"w-3 h-3"}),"En attente"]}):s.jsx(we,{variant:"default",className:"bg-primary/80 text-[10px] sm:text-xs",children:"En cours"})]})}),s.jsxs(De,{className:"p-3 sm:p-5 space-y-3 sm:space-y-5",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-stretch gap-2 sm:gap-3",children:[s.jsx(Y,{player:e.white_player,isMe:o,colorLabel:"Blancs",colorIndicatorClass:"border-2 border-foreground bg-background",tournamentPoints:o?h:p}),s.jsx("span",{className:"hidden sm:flex items-center justify-center text-lg font-bold text-muted-foreground px-1",children:"vs"}),s.jsx(Y,{player:e.black_player,isMe:!o,colorLabel:"Noirs",colorIndicatorClass:"bg-foreground",tournamentPoints:o?p:h})]}),s.jsx(Rqe,{timeControl:i,onLaunch:K,disabled:q}),j&&s.jsx(ule,{pairingId:e.id,timeControl:i,isWhitePlayer:o,whitePlayer:e.white_player,blackPlayer:e.black_player,onClose:W}),s.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[!R&&!U&&s.jsxs("div",{className:"space-y-2",children:[L&&s.jsx("div",{className:"p-2 rounded-lg bg-amber-500/10 border border-amber-500/30 text-center",children:s.jsxs("p",{className:"text-xs sm:text-sm text-amber-600 dar
1351k:text-amber-400",children:["Votre adversaire a déclaré : ",s.jsx("span",{className:"font-mono font-bold",children:E4[L]})]})}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Q,{onClick:F,disabled:q,className:"w-full py-4 sm:py-5 text-sm sm:text-base font-semibold gap-1.5 sm:gap-2 bg-emerald-600 hover:bg-emerald-700",size:"lg",children:[q?s.jsx(We,{className:"w-4 h-4 sm:w-5 sm:h-5 animate-spin"}):s.jsx(Xt,{className:"w-4 h-4 sm:w-5 sm:h-5"}),"J'ai gagné"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(Q,{variant:"outline",onClick:H,disabled:q,className:"flex-1 py-3 sm:py-4 gap-1.5 sm:gap-2 text-sm sm:text-base",size:"lg",children:[s.jsx(Eb,{className:"w-4 h-4 sm:w-5 sm:h-5"}),"Nulle"]}),s.jsxs(Q,{variant:"outline",onClick:z,disabled:q,className:"flex-1 py-3 sm:py-4 gap-1.5 sm:gap-2 text-sm sm:text-base text-red-500/70 hover:bg-red-500/10 border-red-500/30 hover:text-red-500",size:"lg",children:[s.jsx(Er,{className:"w-4 h-4 sm:w-5 sm:h-5"}),"J'ai perdu"]})]})]})]}),R&&!U&&s.jsxs("div",{className:"p-2.5 sm:p-3 rounded-lg bg-muted/50 border border-muted-foreground/20 text-center",children:[s.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Votre déclaration : ",s.jsx("span",{className:"font-mono font-bold",children:E4[R]})]}),s.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-1",children:"Validation en cours..."})]}),M==="disputed"&&s.jsxs("div",{className:"p-2.5 sm:p-3 rounded-lg bg-destructive/10 border border-destructive/30 text-center",children:[s.jsx("p",{className:"text-xs sm:text-sm font-medium text-destructive",children:"Résultat contesté"}),s.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-1",children:"Les autres joueurs peuvent voter pour aider à résoudre."})]})]})]})]})}const Dy={white_wins:"1 - 0",black_wins:"0 - 1",draw:"½ - ½",pending:"? - ?"},S4={white_wins:"Blancs gagnent",black_wins:"Noirs gagnent",draw:"Nulle",pending:"En attente"};function Kqe({pairingId:e,gameResultId:t,isWhitePlayer:n,opponentName:r,myClaim:i,opponentClaim:a,validationStatus:o,whitePlayerId:l,blackPlayerId:c,eventId:u}){const[d,f]=N.useState(!1),[h,p]=N.useState(!1),[x,y]=N.useState(null),b=hle(),w=qqe(),_=Vqe(),j=async()=>{x&&(await b.mutateAsync({pairingId:e,claim:x,isWhitePlayer:n}),f(!1),y(null))},E=async()=>{const D=n?"white_wins":"black_wins";await b.mutateAsync({pairingId:e,claim:D,isWhitePlayer:n})},S=async()=>{await b.mutateAsync({pairingId:e,claim:"draw",isWhitePlayer:n})},T=async()=>{const D=n?"black_wins":"white_wins";await b.mutateAsync({pairingId:e,claim:D,isWhitePlayer:n})},P=async()=>{!t||!a||await w.mutateAsync({gameResultId:t,opponentClaim:a,isWhitePlayer:n,pairingId:e,whitePlayerId:l,blackPlayerId:c,eventId:u})},O=async()=>{!t||!x||(await _.mutateAsync({gameResultId:t,myClaim:x,isWhitePlayer:n}),p(!1),y(null))};return o==="confirmed"||o==="peer_resolved"||o==="staff_override"?null:o==="disputed"?s.jsx(Se,{className:"border-destructive/50 bg-destructive/5",children:s.jsxs(De,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[s.jsx(ur,{className:"w-4 h-4"}),s.jsx("span",{className:"font-medium",children:"Dispute en cours"})]}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Les autres joueurs votent pour résoudre ce désaccord."})]})}):i&&!a?s.jsxs(s.Fragment,{children:[s.jsx(Se,{className:"border-yellow-500/50 bg-yellow-500/5",children:s.jsx(De,{className:"p-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 text-yellow-600",children:[s.jsx(Vt,{className:"w-4 h-4"}),s.jsxs("span",{className:"font-medium",children:["En attente de ",r]})]}),s.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Vous avez déclaré : ",s.jsx(we,{variant:"outline",children:Dy[i]})]})]}),s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>{y(i),f(!0)},className:"text-muted-foreground hover:text-foreground",children:"Modifier"})]})})}),s.jsx(Ln,{open:d,onOpenChange:f,children:s.jsxs(Dn,{children:[s.jsxs(Un,{children:[s.jsx(qn,{
1351children:"Modifier votre déclaration"}),s.jsxs(qr,{children:["Vous pouvez changer votre résultat tant que ",r," n'a pas répondu."]})]}),s.jsx("div",{className:"grid grid-cols-3 gap-2 py-4",children:["white_wins","draw","black_wins"].map(D=>s.jsxs("button",{onClick:()=>y(D),className:ae("flex flex-col items-center justify-center p-4 rounded-lg border-2 transition-all",x===D?"border-primary bg-primary/10":"border-border hover:border-primary/50"),children:[s.jsx("span",{className:"text-xl font-bold font-mono",children:Dy[D]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:S4[D]})]},D))}),s.jsxs(Pi,{children:[s.jsx(Q,{variant:"outline",onClick:()=>f(!1),children:"Annuler"}),s.jsx(Q,{onClick:j,disabled:!x||b.isPending,children:"Confirmer la modification"})]})]})})]}):!i&&a?s.jsxs(s.Fragment,{children:[s.jsx(Se,{className:"border-primary/50 bg-primary/5",children:s.jsxs(De,{className:"p-4 space-y-3",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"font-medium",children:[r," a déclaré :"]}),s.jsx(we,{variant:"secondary",className:"mt-1 text-lg font-mono",children:Dy[a]}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:S4[a]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(Q,{onClick:P,disabled:w.isPending,className:"flex-1 gap-2",children:[s.jsx(is,{className:"w-4 h-4"}),"Je confirme"]}),s.jsxs(Q,{variant:"destructive",onClick:()=>p(!0),className:"flex-1 gap-2",children:[s.jsx(Er,{className:"w-4 h-4"}),"Je conteste"]})]})]})}),s.jsx(Ln,{open:h,onOpenChange:p,children:s.jsxs(Dn,{children:[s.jsxs(Un,{children:[s.jsx(qn,{children:"Contester le score"}),s.jsxs(qr,{children:[r," a déclaré ",Dy[a],". Quel est le vrai résultat selon vous ?"]})]}),s.jsx("div",{className:"grid grid-cols-3 gap-2 py-4",children:["white_wins","draw","black_wins"].map(D=>s.jsxs("button",{onClick:()=>y(D),className:ae("flex flex-col items-center justify-center p-4 rounded-lg border-2 transition-all",x===D?"border-primary bg-primary/10":"border-border hover:border-primary/50",D===a&&"opacity-50"),disabled:D===a,children:[s.jsx("span",{className:"text-xl font-bold font-mono",children:Dy[D]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:S4[D]})]},D))}),s.jsxs(Pi,{children:[s.jsx(Q,{variant:"outline",onClick:()=>p(!1),children:"Annuler"}),s.jsx(Q,{variant:"destructive",onClick:O,disabled:!x||_.isPending,children:"Ouvrir la dispute"})]})]})})]}):s.jsx(Se,{className:"border-dashed backdrop-blur-sm",children:s.jsxs(De,{className:"p-4 space-y-3",children:[s.jsxs(Q,{onClick:E,disabled:b.isPending,size:"lg",className:ae("w-full h-12 gap-2 font-medium","bg-emerald-600 hover:bg-emerald-700","text-white shadow-md","transition-all duration-200"),children:[b.isPending?s.jsx(We,{className:"w-5 h-5 animate-spin"}):s.jsx(Xt,{className:"w-5 h-5"}),b.isPending?"Envoi...":"J'ai gagné"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(Q,{variant:"outline",onClick:S,disabled:b.isPending,className:"flex-1 gap-1.5 text-sm",size:"default",children:[s.jsx(Eb,{className:"w-4 h-4"}),"Nulle"]}),s.jsxs(Q,{variant:"outline",onClick:T,disabled:b.isPending,className:"flex-1 gap-1.5 text-sm text-red-500/70 hover:bg-red-500/10 border-red-500/30 hover:text-red-500",size:"default",children:[s.jsx(Er,{className:"w-4 h-4"}),"J'ai perdu"]})]})]})})}const Yqe={white_wins:"1 - 0",black_wins:"0 - 1",draw:"½ - ½",pending:"? - ?"},A4={pending:{icon:Vt,label:"En attente",color:"text-yellow-600"},confirmed:{icon:Cn,label:"Confirmé",color:"text-green-600"},disputed:{icon:ur,label:"Dispute",color:"text-destructive"},peer_resolved:{icon:Cn,label:"Résolu par vote",color:"text-green-600"},staff_override:{icon:nd,label:"Override staff",color:"text-blue-600"}};function Xqe({roundNumber:e}){return s.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border border-dashed border-muted-foreground/30 bg-muted/10 backdrop-blur-sm",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs(we,{variant:"outline",className:"opacity-60 text-[10px] sm:text-xs",children:["Ronde ",e]}),s.jsxs("span",{className:"text-[10px] sm:text-sm text-muted-foreground flex items-center gap-1 sm:gap-1.5",children:[s.jsx(UY,{className:"w-3 h-3 sm:w-3.5 sm:h-3.5"}),"À venir"]})]}),s.jsx("p",{className:"text-[10px] sm:text-sm text-muted-foreground mt-1.5 sm:mt-2 italic",children:"L'appariement sera généré au lancement de cette ronde."})]})}function gle({eventId:e,userId:t,totalRounds:n,currentRoundNumber:r,ticketIdOverride:i}){const{data:a=[],isLoading:o}=Gqe(e,t,{ticketIdOverride:i});if(o)return s.jsxs(Se,{children:[s.jsx(kt,{className:"pb-2 sm:pb-3",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ie,{className:"h-4 w-4 sm:h-5 sm:w-5 rounded-full"}),s.jsx(Et,{className:"text-base sm:text-lg",children:"Mes parties"})]})}),s.jsx(De,{className:"space-y-2 sm:space-y-3",children:[1,2].map(p=>
1351s.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border space-y-2 sm:space-y-3",style:{animationDelay:`${p*100}ms`},children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx(Ie,{className:"h-4 sm:h-5 w-16 sm:w-20"}),s.jsx(Ie,{className:"h-4 sm:h-5 w-20 sm:w-24"})]}),s.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[s.jsx(Ie,{className:"h-8 w-8 sm:h-10 sm:w-10 rounded-full"}),s.jsxs("div",{className:"space-y-1 sm:space-y-1.5",children:[s.jsx(Ie,{className:"h-3.5 sm:h-4 w-24 sm:w-32"}),s.jsx(Ie,{className:"h-3 w-16 sm:w-24"})]})]})]},p))})]});const l=new Set(a.map(p=>p.round.round_number)),c=a.find(p=>p.round.status==="active"),u=a.filter(p=>p.round.status==="completed").sort((p,x)=>{const y=p.round;return x.round.round_number-y.round_number}),d=[];for(let p=r+1;p<=n;p++)l.has(p)||d.push(p);if(!(a.length>0||d.length>0))return s.jsx(Se,{children:s.jsxs(De,{className:"p-4 sm:p-6 text-center text-muted-foreground",children:[s.jsx(Vt,{className:"w-6 h-6 sm:w-8 sm:h-8 mx-auto mb-1.5 sm:mb-2 opacity-50"}),s.jsx("p",{className:"text-sm",children:"Aucune partie pour le moment."}),s.jsx("p",{className:"text-xs sm:text-sm",children:"Les appariements seront générés au début de chaque ronde."})]})});const h=(p,x=!1)=>{var W,q,oe;const y=p.round,b=p.white_player,w=p.black_player,_=Array.isArray(b)?b[0]:b,j=Array.isArray(w)?w[0]:w,E=p.game_result,S=Array.isArray(E)?E[0]:E,T=i?p.white_ticket_id===i:p.white_player_id===t,P=T?j:_,O=fs(P)||"Adversaire",D=(S==null?void 0:S.validation_status)||"pending",R=T?S==null?void 0:S.white_player_claim:S==null?void 0:S.black_player_claim,L=T?S==null?void 0:S.black_player_claim:S==null?void 0:S.white_player_claim,M=(S==null?void 0:S.result)||"pending",B=((W=A4[D])==null?void 0:W.icon)||Vt,U=((q=A4[D])==null?void 0:q.label)||"En attente",F=((oe=A4[D])==null?void 0:oe.color)||"text-muted-foreground",H=y.status==="active",z=H&&D==="pending"&&(!R||!R&&L),K=D==="confirmed"||D==="peer_resolved"||D==="staff_override";return s.jsxs("div",{className:ae("p-3 sm:p-4 rounded-lg border space-y-2 sm:space-y-3",x&&"border-primary/50 bg-primary/5",z&&"border-primary/50 bg-primary/5"),children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-1.5 sm:gap-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:gap-2",children:[p.table_number&&s.jsxs(we,{variant:"secondary",className:"font-mono text-[10px] sm:text-xs",children:["T",p.table_number]}),s.jsxs(we,{variant:"outline",className:"text-[10px] sm:text-xs",children:["R",y.round_number]}),z&&s.jsx(we,{variant:"default",className:"text-[10px] sm:text-xs",children:"Action"})]}),s.jsxs("div",{className:ae("flex items-center gap-1 text-[10px] sm:text-sm",F),children:[s.jsx(B,{className:"w-3 h-3 sm:w-4 sm:h-4"}),s.jsx("span",{className:"hidden xs:inline",children:U})]})]}),s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0 flex-1",children:[s.jsx("div",{className:ae("w-2.5 h-2.5 sm:w-3 sm:h-3 rounded-full flex-shrink-0",T?"border-2 border-foreground bg-background":"bg-foreground")}),s.jsxs(Bi,{className:"h-8 w-8 sm:h-10 sm:w-10 flex-shrink-0",children:[s.jsx(Ra,{src:(P==null?void 0:P.avatar_url)||void 0}),s.jsx(zi,{className:"text-xs",children:cc(P)})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"font-medium text-sm truncate",children:["vs ",O]}),s.jsxs("p",{className:"text-[10px] sm:text-xs text-muted-foreground truncate",children:["Vous : ",T?"Blancs":"Noirs",` • ${qf(P==null?void 0:P.elo_rating)}`]})]})]}),K&&s.jsx(we,{variant:"default",className:ae("font-mono text-xs sm:text-lg flex-shrink-0",M==="white_wins"&&T&&"bg-green-600",M==="black_wins"&&!T&&"bg-green-600",M==="white_wins"&&!T&&"bg-destructive",M==="black_wins"&&T&&"bg-destructive",M==="draw"&&"bg-muted text-muted-foreground"),children:Yqe[M]})]}),H&&!K&&s.jsx(Kqe,{pairingId:p.id,gameResultId:S==null?void 0:S.id,isWhitePlayer:T,opponentName:O,myClaim:R||null,opponentClaim:L||null,validationStatus:D,whitePlayerId:p.white_player_id,blackPlayerId:p.black_player_id||"",eventId:e})]}
1351,p.id)};return s.jsxs(Se,{children:[s.jsx(kt,{className:"pb-2 sm:pb-3",children:s.jsx(Et,{className:"text-base sm:text-lg",children:"Mes parties"})}),s.jsxs(De,{className:"space-y-4 sm:space-y-6",children:[d.length>0&&s.jsxs("div",{children:[s.jsxs("h3",{className:"text-xs sm:text-sm font-medium text-muted-foreground mb-2 sm:mb-3 flex items-center gap-1.5 sm:gap-2",children:[s.jsx(UY,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),"À venir (",d.length,")"]}),s.jsx("div",{className:"space-y-1.5 sm:space-y-2",children:d.map(p=>s.jsx(Xqe,{roundNumber:p},p))})]}),c&&s.jsxs("div",{children:[s.jsxs("h3",{className:"text-xs sm:text-sm font-medium text-muted-foreground mb-2 sm:mb-3 flex items-center gap-1.5 sm:gap-2",children:[s.jsx(Vt,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),"En cours"]}),h(c,!0)]}),u.length>0&&s.jsxs("div",{children:[s.jsxs("h3",{className:"text-xs sm:text-sm font-medium text-muted-foreground mb-2 sm:mb-3 flex items-center gap-1.5 sm:gap-2",children:[s.jsx(Cn,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),"Terminées (",u.length,")"]}),s.jsx("div",{className:"space-y-2 sm:space-y-3",children:u.map(p=>h(p,!1))})]})]})]})}const Qqe=da({display_name:Ct().max(50).optional(),first_name:Ct().max(50).optional(),last_name:Ct().max(50).optional(),elo_rating:RR.number().int().min(0).max(3500).optional().nullable(),club:Ct().max(100).optional()}),Jqe=da({guest_first_name:Ct().max(50).optional(),guest_last_name:Ct().max(50).optional(),guest_email:Ct().max(255).optional().refine(e=>!e||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),"Email invalide"),elo_rating:RR.number().int().min(0).max(3500).optional().nullable(),club:Ct().max(100).optional()});function Zqe({player:e,isGuest:t,ticketId:n,eventId:r,isWithdrawn:i,canWithdraw:a,canReinstate:o,onClose:l}){const c=Ye(),u=ale(),d=Eqe(),f=Zm({resolver:ep(Qqe),defaultValues:{display_name:e.display_name||"",first_name:e.first_name||"",last_name:e.last_name||"",elo_rating:e.elo_rating??null,club:e.club||""}}),h=Zm({resolver:ep(Jqe),defaultValues:{guest_first_name:e.first_name||"",guest_last_name:e.last_name||"",guest_email:e.guest_email||"",elo_rating:e.elo_rating??null,club:e.club||""}}),p=()=>{c.invalidateQueries({queryKey:["event-participants",r]}),c.invalidateQueries({queryKey:["tournament-standings",r]}),c.invalidateQueries({queryKey:["round-pairings"]})},x=dt({mutationFn:async j=>{const E={};j.display_name!==void 0&&(E.display_name=j.display_name||null),j.first_name!==void 0&&(E.first_name=j.first_name||null),j.last_name!==void 0&&(E.last_name=j.last_name||null),j.elo_rating!==void 0&&(E.elo_rating=j.elo_rating),j.club!==void 0&&(E.club=j.club||null);const{error:S}=await re.from("profiles").update(E).eq("id",e.id);if(S)throw S},onSuccess:()=>{p(),je.success("Fiche joueur mise à jour"),l()},onError:()=>je.error("Erreur lors de la mise à jour")}),y=dt({mutationFn:async j=>{if(!n)throw new Error("Ticket ID manquant");const{data:E,error:S}=await re.functions.invoke("update-ticket-info",{body:{ticketId:n,guest_first_name:j.guest_first_name||null,guest_last_name:j.guest_last_name||null,guest_email:j.guest_email||null,elo_rating:j.elo_rating??null,club:j.club||null}});if(S)throw new Error(S.message||"Erreur");if(E!=null&&E.error)throw new Error(typeof E.error=="string"?E.error:"Erreur de validation")},onSuccess:()=>{p(),je.success("Fiche invité mise à jour"),l()},onError:j=>je.error(j.message||"Erreur lors de la mise à jour")}),b=()=>{n&&u.mutate({eventId:r,ticketId:n},{onSuccess:()=>l()})},w=()=>{n&&d.mutate({eventId:r,ticketId:n},{onSuccess:()=>l()})},_=(a||o)&&n?s.jsxs(s.Fragment,{children:[s.jsx(Fs,{className:"my-2"}),i&&o?s.jsxs(yr,{children:[s.jsx(P2,{asChild:!0,children:s.jsxs(Q,{variant:"outline",className:"w-full gap-2 border-green-500/30 text-green-600 hover:bg-green-500/10",disabled:d.isPending,children:[s.jsx(Sb,{className:"w-4 h-4"}),d.isPending?"Réintégration…":"Réintégrer le joueur"]})}),s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Réintégrer ce joueur ?"}),s.jsx(lr,{children:"Le joueur sera réintégré dans le pool d'appariement pour les rondes suivantes."})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsx(vr,{onClick:w,children:"Réintégrer"})]})]})]}):!i&&a?s.jsxs(yr,{children:[s.jsx(P2,{asChild:!0,children:s.jsxs(Q,{variant:"destructive",className:"w-full gap-2",disabled:u.isPending,children:[s.jsx(Cxe,{className:"w-4 h-4"}),u.isPending?"Retrait…":"Forfait général"]})}),s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Forfait général"}),s.jsx(lr,{children:"Le joueur sera définitivement exclu des appariements futurs. Ses résultats passés sont conservés pour le calcul des départages. Cette action est réversible par un administrateur."})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsx(vr,{onClick:b,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Confirmer le forfait"})]})]})]}):null]}):null;return t?s.jsxs("form",{onSubmit:h.handleSubmit(j=>y.mutate(j)),className:"space-y-4 px-1",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Fe,{htmlFor:"guest_first_name",className:"text-xs",children:"Prénom"}),s.jsx(Ue,{id:"guest_first_name",...h.register("guest_first_name")}
1351)]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Fe,{htmlFor:"guest_last_name",className:"text-xs",children:"Nom"}),s.jsx(Ue,{id:"guest_last_name",...h.register("guest_last_name")})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Fe,{htmlFor:"guest_email",className:"text-xs",children:"Email (optionnel)"}),s.jsx(Ue,{id:"guest_email",type:"email",placeholder:"[email protected]",...h.register("guest_email")}),s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Permettra au joueur de retrouver ce ticket en créant son compte."}),h.formState.errors.guest_email&&s.jsx("p",{className:"text-destructive text-[10px]",children:h.formState.errors.guest_email.message})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Fe,{htmlFor:"guest_elo",className:"text-xs",children:"Elo (optionnel)"}),s.jsx(Ue,{id:"guest_elo",type:"number",min:0,max:3500,placeholder:"ex. 1500",...h.register("elo_rating")}),h.formState.errors.elo_rating&&s.jsx("p",{className:"text-destructive text-[10px]",children:h.formState.errors.elo_rating.message})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Fe,{htmlFor:"guest_club",className:"text-xs",children:"Club (optionnel)"}),s.jsx(Ue,{id:"guest_club",placeholder:"Nom du club",maxLength:100,...h.register("club")}),h.formState.errors.club&&s.jsx("p",{className:"text-destructive text-[10px]",children:h.formState.errors.club.message})]}),s.jsx(Q,{type:"submit",className:"w-full",disabled:y.isPending,children:y.isPending?"Enregistrement…":"Enregistrer"}),_]}):s.jsxs("form",{onSubmit:f.handleSubmit(j=>x.mutate(j)),className:"space-y-3 px-1",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Fe,{htmlFor:"first_name",className:"text-xs",children:"Prénom"}),s.jsx(Ue,{id:"first_name",...f.register("first_name")})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Fe,{htmlFor:"last_name",className:"text-xs",children:"Nom"}),s.jsx(Ue,{id:"last_name",...f.register("last_name")})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Fe,{htmlFor:"display_name",className:"text-xs",children:"Pseudo"}),s.jsx(Ue,{id:"display_name",...f.register("display_name")})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Fe,{htmlFor:"elo_rating",className:"text-xs",children:"Elo"}),s.jsx(Ue,{id:"elo_rating",type:"number",min:0,max:3500,...f.register("elo_rating")}),f.formState.errors.elo_rating&&s.jsx("p",{className:"text-destructive text-[10px]",children:f.formState.errors.elo_rating.message})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Fe,{htmlFor:"club",className:"text-xs",children:"Club"}),s.jsx(Ue,{id:"club",...f.register("club")})]})]}),s.jsx(Q,{type:"submit",className:"w-full",disabled:x.isPending,children:x.isPending?"Enregistrement…":"Enregistrer"}),_]})}function O6({open:e,onOpenChange:t,player:n,isGuest:r,ticketId:i,eventId:a,isWithdrawn:o,canWithdraw:l,canReinstate:c}){const u=vd(),d=o?"Joueur retiré (forfait)":r?"Modifier l'invité":"Modifier le joueur",f=s.jsx(Zqe,{player:n,isGuest:r,ticketId:i,eventId:a,isWithdrawn:o,canWithdraw:l,canReinstate:c,onClose:()=>t(!1)});return u?s.jsx(bd,{open:e,onOpenChange:t,children:s.jsxs(wd,{children:[s.jsx(sh,{children:s.jsxs(_d,{className:"flex items-center gap-2",children:[s.jsx(o1,{className:"w-4 h-4"}),d]})}),s.jsx("div",{className:"px-4 pb-6",children:f})]})}):s.jsx(Ln,{open:e,onOpenChange:t,children:s.jsxs(Dn,{className:"sm:max-w-md",children:[s.jsx(Un,{children:s.jsxs(qn,{className:"flex items-center gap-2",children:[s.jsx(o1,{className:"w-4 h-4"}),d]})}),f]})})}const Tz={1:s.jsx(Xt,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 text-yellow-500"}),2:s.jsx(JY,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 text-gray-400"}),3:s.jsx(x5,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 text-amber-600"})};function Pz(e){return e%1===.5?`${Math.floor(e)}½`:String(e)}function sE({eventId:e,tiebreakCriteria:t,canEditPlayers:n=!1,onPlayerClick:r,highlightPlayerId:i}){var w,_,j;const{user:a,roles:o}=Tt(),{data:l,isLoading:c,isFetching:u}=C6(e,t),{data:d}=Cqe(e),[f,h]=N.useState(null),p=o==null?void 0:o.includes("admin"),x=i??(a==null?void 0:a.id)??null,y=t&&t.length>0?t:Wh,b=y.filter(E=>E!=="direct");return c?s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"grid grid-cols-[1.5rem_1fr_3rem] sm:grid-cols-[2rem_1fr_4rem] gap-1 sm:gap-2 px-2 sm:px-3 py-2 text-[10px] sm:text-xs font-medium text-muted-foreground border-b",children:[s.jsx("span",{children:"#"}),s.jsx("span",{children:"Joueur"}),s.jsx("span",{className:"text-right",children:"Pts"})]}),[1,2,3,4,5].map(E=>s.jsxs("div",{className:"grid grid-cols-[1.5rem_1fr_3rem] sm:grid-cols-[2rem_1fr_4rem] gap-1 sm:gap-2 px-2 sm:px-3 py-2 rounded-lg items-center",style:{animationDelay:`${E*50}ms`},children:[s.jsx(Ie,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4 rounded-full"}),s.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[s.jsx(Ie,{className:"h-6 w-6 sm:h-7 sm:w-7 rounded-full flex-shrink-0"}),s.jsx(Ie,{className:"h-3.5 sm:h-4 w-16 sm:w-24"})]}),s.jsx(Ie,{className:"h-4 sm:h-5 w-8 sm:w-10 ml-auto rounded"})]},E))]}):!l||l.length===0?s.jsx("div",{className:"text-center py-6 sm:py-8 text-muted-foreground text-sm",children:"Aucun classement disponible."}):s.jsxs("div",{className:"space-y-0.5 sm:space-y-1 relative",children:[u&&!c&&s.jsxs("div",{className:"absolute -top-1 right-0 flex items-center gap-1.5 z-10",children:[s.jsx("span",{className:"text-[10px] text-green-500/80 font-medium uppercase tracking-wider",children:"Live"}),s.jsxs("span",{className:"relative flex h-2 w-2",children:[s.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),s.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]})]}),s.jsxs("div",{className:ae("grid gap-1 sm:gap-2 px-2 sm:px-3 py-1.5 sm:py-2 text-[10px] sm:text-xs font-medium text-muted-foreground border-b","grid-cols-[1.5rem_1fr_3rem]","sm:grid-cols-[2rem_1fr_repeat(var(--tb-cols),2.5rem)_3rem]"),style:{"--tb-cols":b.length},children:[s.jsx("span",{children:"#"}),s.jsx("span",{children:"Joueur"}),b.map(E=>
1351{const S=j1.find(T=>T.value===E);return s.jsx("span",{className:"hidden sm:block text-center",title:S==null?void 0:S.description,children:(S==null?void 0:S.shortLabel)||E},E)}),s.jsx("span",{className:"text-right",children:"Pts"})]}),l.map(E=>{var D,R;const S=E.rank<=3,T=E.rank===1,P=!!x&&E.playerId===x,O=d==null?void 0:d.has((D=E.profile)==null?void 0:D.ticketId);return s.jsxs("div",{className:ae("grid gap-1 sm:gap-2 px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg items-center transition-all","grid-cols-[1.5rem_1fr_3rem]","sm:grid-cols-[2rem_1fr_repeat(var(--tb-cols),2.5rem)_3rem]",O&&"opacity-50",P&&!O&&"bg-gradient-to-r from-primary/15 via-amber-500/10 to-primary/15 border border-amber-500/30 shadow-[0_0_8px_rgba(245,158,11,0.15)]",!P&&!O&&T&&"bg-primary/10",!P&&!O&&S&&!T&&"bg-muted/50"),style:{"--tb-cols":b.length},children:[s.jsx("div",{className:"flex items-center justify-center",children:!O&&Tz[E.rank]?Tz[E.rank]:s.jsx("span",{className:"text-[10px] sm:text-sm text-muted-foreground",children:E.rank})}),s.jsxs("div",{className:"flex items-start sm:items-center gap-1.5 sm:gap-2 min-w-0",children:[s.jsxs(Bi,{className:ae("h-6 w-6 sm:h-7 sm:w-7 flex-shrink-0",P&&!O&&"ring-2 ring-amber-500/50",O&&"grayscale"),children:[s.jsx(Ra,{src:((R=E.profile)==null?void 0:R.avatar_url)||void 0}),s.jsx(zi,{className:"text-[10px] sm:text-xs",children:cc(E.profile)})]}),s.jsxs("div",{className:"min-w-0 flex flex-wrap items-center gap-x-1 gap-y-0.5",children:[s.jsx("p",{title:fs(E.profile)||"Joueur",className:ae("text-xs sm:text-sm font-medium break-words leading-tight line-clamp-2 sm:line-clamp-none sm:truncate",O&&"line-through text-muted-foreground",!O&&P&&"text-amber-600 dark:text-amber-400",!O&&!P&&T&&"text-primary",(n||r)&&"cursor-pointer hover:underline"),onClick:n?()=>h(E):r?()=>r(E.playerId):void 0,children:fs(E.profile)||"Joueur"}),O&&s.jsx(we,{variant:"destructive",className:"text-[8px] sm:text-[10px] px-1 py-0 h-4 flex-shrink-0",children:"Forfait"}),P&&!O&&s.jsx("span",{className:"text-[10px] sm:text-xs text-amber-500 font-medium flex-shrink-0",children:"(Vous)"})]})]}),b.map(L=>{let M=0;switch(L){case"buchholz_cut1":M=E.buchholzCut1;break;case"buchholz":M=E.buchholz;break;case"sonneborn_berger":M=E.sonnebornBerger;break;case"progressive":M=E.progressive;break;case"wins":M=E.wins;break;case"black_games":M=E.blackGames;break}return s.jsx("span",{className:"hidden sm:block text-center text-[10px] sm:text-xs text-muted-foreground font-mono",children:Pz(M)},L)}),s.jsx("div",{className:"text-right",children:s.jsx(we,{variant:!O&&T?"default":"secondary",className:ae("font-mono text-[10px] sm:text-xs px-1 sm:px-2 py-0",O&&"opacity-70"),children:Pz(E.points)})})]},E.playerId)}),s.jsx("div",{className:"pt-3 sm:pt-4 text-[10px] sm:text-xs text-muted-foreground text-center space-y-1",children:s.jsxs("span",{className:"opacity-70",children:["Départage : ",y.map(E=>{const S=j1.find(T=>T.value===E);return(S==null?void 0:S.label)||E}).join(" → ")]})}),f&&s.jsx(O6,{open:!!f,onOpenChange:E=>!E&&h(null),player:f.profile||{id:f.playerId},isGuest:((w=f.profile)==null?void 0:w.isGuest)||!1,ticketId:(_=f.profile)==null?void 0:_.ticketId,eventId:e,isWithdrawn:d==null?void 0:d.has((j=f.profile)==null?void 0:j.ticketId),canWithdraw:n,canReinstate:n&&p})]})}function eVe({cell:e}){if(!e)return s.jsx("span",{className:"text-muted-foreground/30",children:"–"});if(e.isBye)return s.jsx("span",{className:"text-muted-foreground text-[10px] sm:text-xs",children:"bye"});const t=e.color==="W"?"B":"N";return s.jsxs("span",{className:ae("font-mono text-[11px] sm:text-xs leading-none",e.result==="+"&&"text-green-500 font-semibold",e.result==="-"&&"text-red-400",e.result==="="&&"text-amber-400",e.result===""&&"text-muted-foreground"),children:[e.opponentRank>0?e.opponentRank:"?",t,e.result||"·"]})}function Oz({players:e,roundHeaders:t,currentUserId:n,onPlayerClick:r}){return s.jsxs("div",{className:"relative min-w-0",children:[s.jsx("div",{className:"overflow-x-auto overscroll-x-contain -mx-1 px-1 pb-1",children:s.jsxs("table",{className:"w-full border-collapse text-xs sm:text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/50",children:[s.jsx("th",{className:"sticky left-0 z-10 bg-background text-left px-1 sm:px-2 py-2 font-medium text-muted-foreground w-6 sm:w-8",title:"Rang au classement",children:"#"}),s.jsx("th",{className:"hidden sm:table-cell sticky left-8 z-10 bg-background text-center px-1.5 py-2 font-medium text-muted-foreground w-10",title:"Numéro d'appariement FIDE (stable)",children:"TPN"}),s.jsx("th",{className:"sticky left-6 sm:left-[72px] z-10 bg-background text-left px-1.5 sm:px-2 py-2 font-medium text-muted-foreground min-w-[104px] max-w-[150px] sm:max-w-[180px]",children:"Joueur"}),t.map(i=>s.jsxs("th",{className:"text-center px-1 sm:px-2 py-2 font-medium text-muted-foreground whitespace-nowrap",children:["R",i]},i)),s.jsx("th",{className:"text-center px-1.5 sm:px-2 py-2 font-semibold text-foreground whitespace-nowrap",children:"Pts"})]})}),s.jsx("tbody",{children:e.map(i=>{const a=i.playerId===n;return s.jsxs("tr",{className:ae("border-b border-border/20 transition-colors",a?"bg-primary/10 hover:bg-primary/15":"hover:bg-muted/30"),children:[s.jsx("td",{className:ae("sticky left-0 z-10 px-1 sm:px-2 py-1.5 sm:py-2 align-top font-mono text-muted-foreground tabular-nums",a?"bg-primary/10":"bg-background"),children:i.rank}),s.jsx("td",{className:ae("hidden sm:table-cell sticky left-8 z-10 text-center px-1.5 py-1.5 
1351sm:py-2 align-top font-mono text-muted-foreground/70 tabular-nums text-xs",a?"bg-primary/10":"bg-background"),children:i.tpn}),s.jsx("td",{className:ae("sticky left-6 sm:left-[72px] z-10 px-1.5 sm:px-2 py-1.5 sm:py-2 align-top","min-w-[104px] max-w-[150px] sm:max-w-[180px] whitespace-normal break-words leading-tight",a?"bg-primary/10 font-semibold text-primary":"bg-background",r&&"cursor-pointer hover:underline"),title:i.displayName,onClick:r?()=>r(i.playerId):void 0,children:i.displayName}),i.cells.map((o,l)=>s.jsx("td",{className:"text-center px-1 sm:px-2 py-1.5 sm:py-2 align-top whitespace-nowrap",children:s.jsx(eVe,{cell:o})},l)),s.jsx("td",{className:ae("text-center px-1.5 sm:px-2 py-1.5 sm:py-2 align-top font-bold tabular-nums",a&&"text-primary"),children:i.points%1===0?i.points:i.points.toFixed(1)})]},i.playerId)})})]})}),s.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute right-0 top-0 bottom-1 w-8 bg-gradient-to-l from-background to-transparent"})]})}function iE({eventId:e,tiebreakCriteria:t,onPlayerClick:n}){const{user:r}=Tt(),{players:i,roundsCount:a,isLoading:o}=B0(e,t),[l,c]=N.useState(!1);if(o)return s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ie,{className:"h-6 w-48"}),s.jsx(Ie,{className:"h-40 w-full"})]});if(i.length===0)return s.jsx("div",{className:"text-center py-8 text-muted-foreground text-sm",children:"Aucune donnée de tournoi disponible."});const u=Array.from({length:a},(d,f)=>f+1);return s.jsxs("div",{className:"space-y-3 min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx(Fm,{className:"w-4 h-4 text-primary shrink-0"}),s.jsx("h3",{className:"font-display text-sm sm:text-base font-semibold truncate",children:"Grille américaine"})]}),s.jsxs(Q,{variant:"outline",size:"sm",className:"h-7 gap-1.5 text-xs shrink-0 lg:hidden",onClick:()=>c(!0),children:[s.jsx(QY,{className:"w-3.5 h-3.5"}),"Plein écran"]})]}),s.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-[10px] sm:text-xs text-muted-foreground",children:[s.jsxs("span",{children:[s.jsx("strong",{children:"B"})," = Blancs"]}),s.jsxs("span",{children:[s.jsx("strong",{children:"N"})," = Noirs"]}),s.jsx("span",{className:"text-green-500 font-semibold",children:"+"})," = Victoire",s.jsx("span",{className:"text-amber-400",children:"="})," = Nulle",s.jsx("span",{className:"text-red-400",children:"−"})," = Défaite",s.jsx("span",{className:"italic",children:"Nº adversaire = TPN (stable)"})]}),s.jsx("p",{className:"text-[10px] text-muted-foreground/70 sm:hidden",children:"← Faites défiler horizontalement pour voir toutes les rondes →"}),s.jsx(Oz,{players:i,roundHeaders:u,currentUserId:r==null?void 0:r.id,onPlayerClick:n}),s.jsx(Ln,{open:l,onOpenChange:c,children:s.jsxs(Dn,{className:"max-w-none w-screen h-[100dvh] sm:h-[95vh] sm:w-[95vw] rounded-none sm:rounded-lg p-3 sm:p-6 flex flex-col gap-3",children:[s.jsx(Un,{className:"shrink-0",children:s.jsxs(qn,{className:"text-base flex items-center gap-2",children:[s.jsx(Fm,{className:"w-4 h-4 text-primary"}),"Grille américaine"]})}),s.jsx("div",{className:"flex-1 overflow-y-auto min-w-0",children:s.jsx(Oz,{players:i,roundHeaders:u,currentUserId:r==null?void 0:r.id,onPlayerClick:n})})]})})]})}function tVe(e){const t=new Map;e.forEach(r=>{!r||r.isBye||r.opponentRank<=0||t.set(r.opponentRank,(t.get(r.opponentRank)||0)+1)});const n=new Set;return t.forEach((r,i)=>{r>1&&n.add(i)}),n}function Dz({player:e,allPlayers:t,onNavigate:n}){const r=N.useMemo(()=>tVe(e.cells),[e.cells]),i=r.size>0,a=e.cells.map(o=>(o==null?void 0:o.color)||null);return s.jsxs("div",{className:"space-y-4 px-1",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"font-display text-base sm:text-lg font-bold truncate",children:e.displayName}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Rang #",e.rank," • ",e.points%1===.5?`${Math.floor(e.points)}½`:e.points," pts"]})]}),i&&s.jsx(we,{variant:"destructive",className:"text-[10px] shrink-0",children:"Doublon détecté"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground font-medium uppercase tracking-wider",children:"Couleurs"}),s.jsx("div",{className:"flex items-center gap-1",children:a.map((o,l)=>s.jsx("div",{className:ae("w-6 h-6 sm:w-7 sm:h-7 rounded-md flex items-center justify-center text-[10px] sm:text-xs font-bold border transition-colors",o==="W"&&"bg-background border-foreground
1351/30 text-foreground",o==="B"&&"bg-foreground text-background border-foreground",!o&&"bg-muted/30 border-border text-muted-foreground/40"),title:`R${l+1}: ${o==="W"?"Blancs":o==="B"?"Noirs":"–"}`,children:o==="W"?"B":o==="B"?"N":"–"},l))})]}),s.jsx("div",{className:"rounded-lg border overflow-hidden",children:s.jsxs("table",{className:"w-full text-xs sm:text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b bg-muted/30",children:[s.jsx("th",{className:"text-left px-2.5 py-2 font-medium text-muted-foreground w-12",children:"Rde"}),s.jsx("th",{className:"text-left px-2.5 py-2 font-medium text-muted-foreground",children:"Adversaire"}),s.jsx("th",{className:"text-center px-2 py-2 font-medium text-muted-foreground w-12",children:"Coul."}),s.jsx("th",{className:"text-center px-2 py-2 font-medium text-muted-foreground w-14",children:"Rés."})]})}),s.jsx("tbody",{children:e.cells.map((o,l)=>{const c=l+1;if(!o)return s.jsxs("tr",{className:"border-b border-border/20",children:[s.jsx("td",{className:"px-2.5 py-2 font-mono text-muted-foreground",children:c}),s.jsx("td",{className:"px-2.5 py-2 text-muted-foreground/50",colSpan:3,children:"—"})]},l);const u=o.isBye?null:t.find(f=>f.rank===o.opponentRank),d=!o.isBye&&r.has(o.opponentRank);return s.jsxs("tr",{className:ae("border-b border-border/20 transition-colors",d&&"bg-destructive/5"),children:[s.jsx("td",{className:"px-2.5 py-2 font-mono text-muted-foreground",children:c}),s.jsx("td",{className:"px-2.5 py-2",children:o.isBye?s.jsx("span",{className:"text-muted-foreground italic",children:"Exempt"}):s.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsxs("span",{className:"font-mono text-muted-foreground text-[10px]",children:["#",o.opponentRank]}),u?s.jsx("button",{type:"button",onClick:()=>n(u),className:"truncate underline underline-offset-2 decoration-muted-foreground/40 hover:decoration-primary hover:text-primary transition-colors text-left",children:u.displayName}):s.jsx("span",{className:"truncate",children:"?"}),d&&s.jsx(we,{variant:"destructive",className:"text-[8px] px-1 py-0 h-3.5 shrink-0",children:"×2"})]})}),s.jsx("td",{className:"text-center px-2 py-2",children:!o.isBye&&s.jsx("span",{className:ae("inline-flex w-5 h-5 sm:w-6 sm:h-6 rounded items-center justify-center text-[10px] sm:text-xs font-bold border",o.color==="W"&&"bg-background border-foreground
1351/30 text-foreground",o.color==="B"&&"bg-foreground text-background border-foreground"),children:o.color==="W"?"B":"N"})}),s.jsx("td",{className:"text-center px-2 py-2",children:s.jsx("span",{className:ae("font-semibold",o.result==="+"&&"text-green-500",o.result==="="&&"text-amber-400",o.result==="-"&&"text-red-400",o.result===""&&"text-muted-foreground"),children:o.isBye?"+1":o.result==="+"?"1":o.result==="="?"½":o.result==="-"?"0":"·"})})]},l)})})]})})]})}function aE({player:e,allPlayers:t,open:n,onOpenChange:r}){const i=vd(),[a,o]=N.useState([]);N.useEffect(()=>{e&&n?o([e]):n||o([])},[e,n]);const l=a[a.length-1]??e,c=a.length>1,u=N.useCallback(h=>{o(p=>[...p,h])},[]),d=N.useCallback(()=>{o(h=>h.length>1?h.slice(0,-1):h)},[]);if(!e||!l)return null;const f=c?s.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:d,"aria-label":"Retour",children:s.jsx(fp,{className:"h-4 w-4"})}):null;return i?s.jsx(bd,{open:n,onOpenChange:r,children:s.jsxs(wd,{className:"max-h-[85dvh]",children:[s.jsx(sh,{className:"pb-2",children:s.jsxs("div",{className:"flex items-center gap-1",children:[f,s.jsx(_d,{className:"text-left",children:"Fiche joueur"})]})}),s.jsx("div",{className:"overflow-y-auto px-4 pb-6",children:s.jsx(Dz,{player:l,allPlayers:t,onNavigate:u})})]})}):s.jsx(Ln,{open:n,onOpenChange:r,children:s.jsxs(Dn,{className:"sm:max-w-md",children:[s.jsx(Un,{children:s.jsxs("div",{className:"flex items-center gap-1",children:[f,s.jsx(qn,{children:"Fiche joueur"})]})}),s.jsx(Dz,{player:l,allPlayers:t,onNavigate:u})]})})}function nVe(e){const t=e.match(/^(\d+)/);return t?parseInt(t[1],10):10}function T4(e){return nVe(e)*60*2}function Iz(e){const t=e<0,n=Math.abs(e),r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60,o=l=>l.toString().padStart(2,"0");return r>0?`${t?"-":""}${o(r)}:${o(i)}:${o(a)}`:`${t?"-":""}${o(i)}:${o(a)}`}function oE({startedAt:e,timeControl:t,onTimeUp:n}){const[r,i]=N.useState(0),[a,o]=N.useState(!1),{isSupported:l,isActive:c,request:u,release:d}=cle(),f=N.useCallback(()=>{if(!e)return 0;const b=T4(t),w=new Date(e).getTime(),_=Math.floor((Date.now()-w)/1e3);return b-_},[e,t]);N.useEffect(()=>(e&&l&&!c?u():!e&&c&&d(),()=>{c&&d()}),[e,l,c,u,d]),N.useEffect(()=>{if(!e){i(T4(t));return}i(f());const b=setInterval(()=>{const w=f();i(w),w<=0&&!a&&n&&(o(!0),n())},1e3);return()=>clearInterval(b)},[e,t,f,a,n]);const h=r<=60&&r>0,p=r<0,x=!e,y=e&&!x;return s.jsxs("div",{className:ae("relative flex items-center gap-2 px-4 py-2 rounded-lg font-mono text-lg font-semibold transition-colors",x&&"bg-muted text-muted-foreground",!x&&!h&&!p&&"bg-primary/10 text-primary",h&&"bg-warning/20 text-warning animate-pulse",p&&"bg-destructive/20 text-destructive"),children:[y&&c&&s.jsx("div",{className:"absolute -top-1 -right-1 w-2.5 h-2.5 rounded-full bg-emerald-500 animate-pulse shadow-sm shadow-emerald-500/50",title:"Écran maintenu actif"}),h||p?s.jsx(ur,{className:"w-5 h-5"}):s.jsx(Vt,{className:"w-5 h-5"}),s.jsx("span",{className:"tabular-nums",children:Iz(x?T4(t):r)}),p&&s.jsx("span",{className:"text-xs font-normal ml-1",children:"(temps écoulé)"})]})}function rVe(){var se,ce,le,fe,be,_e,pe,Te;const{id:e}=Wi(),[t]=wc(),n=t.get("code")||void 0,[r,i]=N.useState(!1),[a,o]=N.useState("games"),[l,c]=N.useState(null),u=Cte(e,n),d=st({queryKey:["ticket-owner-by-access-token",e,n],queryFn:async()=>{if(!e||!n)return null;const{data:Ge,error:Ne}=await re.rpc("get_ticket_owner_by_access_token",{p_access_token:n,p_event_id:e});if(Ne)throw Ne;return(Ge==null?void 0:Ge[0])||null},enabled:!!e&&!!n,staleTime:6e4,retry:!1}),f=((se=d.data)==null?void 0:se.user_id)||void 0,h=((ce=d.data)==null?void 0:ce.ticket_id)||void 0,{data:p,isLoading:x}=Joe(e),{data:y=[]}=C6(e,(le=p==null?void 0:p.event)==null?void 0:le.tiebreak_criteria),{players:b}=B0(e,(fe=p==null?void 0:p.event)==null?void 0:fe.tiebreak_criteria),w=b.find(Ge=>Ge.playerId===l)||null,_=N.useCallback(Ge=>c(Ge),[]),{data:j}=ole(e,f,{pollingEnabled:!0,ticketIdOverride:h}),E=p==null?void 0:p.event,S=(p==null?void 0:p.rounds)||[],T=E==null?void 0:E.venue_id,P=(_e=(be=p==null?void 0:p.event)==null?void 0:be.venue)==null?void 0:_e.name,O=(Te=(pe=p==null?void 0:p.event)==null?void 0:pe.venue)==null?void 0:Te.city,D=(E==null?void 0:E.status)==="ongoing",R=(E==null?void 0:E.status)==="completed",L=S.length>0,M=D&&L||R,B=N.useMemo(()=>S.find(Ge=>Ge.status==="active")||null,[S]),U=(B==null?void 0:B.round_number)||(S.length>0?Math.max(...S.map(Ge=>Ge.round_number)):0),F=N.useMemo(()=>
1351{if(f)return y.find(Ge=>Ge.playerId===f);if(h)return y.find(Ge=>Ge.playerId===h)},[y,f,h]),H=F?y.indexOf(F)+1:null;if(!e)return null;if(!n)return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("main",{className:"pt-24 pb-12 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-md text-center",children:[s.jsx("h1",{className:"font-display text-2xl font-bold mb-3",children:"Lien manquant"}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Pour accéder au tournoi en tant qu'invité, entrez votre code de réservation."}),s.jsx(Se,{children:s.jsx(De,{className:"p-5",children:s.jsx(lN,{eventId:e,redirectToLive:!0,submitLabel:"Voir le tournoi"})})})]})})]});if(u.isLoading||d.isLoading||x)return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsxs("main",{className:"pt-24 pb-12 px-4 container mx-auto max-w-3xl space-y-4",children:[s.jsx(Ie,{className:"h-8 w-32"}),s.jsx(Ie,{className:"h-40 w-full"}),s.jsx(Ie,{className:"h-64 w-full"})]})]});if(!u.data||!d.data)return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("main",{className:"pt-24 pb-12 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-md text-center",children:[s.jsx("h1",{className:"font-display text-2xl font-bold mb-3",children:"Lien invalide ou expiré"}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Entrez votre code de réservation pour rouvrir l'accès."}),s.jsx(Se,{children:s.jsx(De,{className:"p-5",children:s.jsx(lN,{eventId:e,redirectToLive:!0,submitLabel:"Voir le tournoi"})})}),s.jsxs(Pe,{to:`/events/${e}`,className:"inline-flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors mt-6",children:[s.jsx(Fn,{className:"w-4 h-4"}),"Retour à l'événement"]})]})})]});const z=u.data,K=z.guest_first_name||"Joueur",W=z.credit_remaining_cents,q=z.credit_total_cents,oe=j==null?void 0:j.pairing,J=(j==null?void 0:j.isWhitePlayer)||!1,Y=J?oe==null?void 0:oe.black_player_id:oe==null?void 0:oe.white_player_id,Z=Y?y.find(Ge=>Ge.playerId===Y):null,G=h&&n?{mode:"token",accessToken:n,eventId:e,ticketId:h}:{mode:"auth"};return s.jsx(Iqe,{value:G,children:s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("main",{className:"pt-24 pb-12 px-3 sm:px-4",children:s.jsxs("div",{className:"container mx-auto max-w-3xl space-y-4 sm:space-y-6 overflow-x-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs(Pe,{to:`/events/${e}/ticket?code=${n}`,className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(Fn,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden xs:inline",children:"Mon billet"}),s.jsx("span",{className:"xs:hidden",children:"Retour"})]}),s.jsxs(we,{variant:"secondary",className:"text-xs",children:[s.jsx(vo,{className:"w-3 h-3 mr-1"}),K]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 sm:gap-2",children:[s.jsx(we,{variant:"default",className:ae("text-xs sm:text-sm",D&&"bg-green-600 hover:bg-green-600/90",R&&"bg-muted text-muted-foreground"),children:D?"En cours":R?"Terminé":"À venir"}),U>0&&s.jsxs(we,{variant:"outline",className:"text-xs sm:text-sm",children:["Ronde ",U,"/",(E==null?void 0:E.rounds_count)||S.length||4]})]}),s.jsx("h1",{className:"font-display text-xl sm:text-2xl md:text-3xl font-bold break-words leading-tight",children:(E==null?void 0:E.title)||z.event_title}),s.jsxs("div",{className:"flex flex-col xs:flex-row xs:flex-wrap xs:items-center gap-1.5 xs:gap-3 sm:gap-4 text-xs sm:text-sm text-muted-foreground",children:[(P||z.venue_name)&&s.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(gn,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 flex-shrink-0"}),s.jsxs("span",{className:"truncate",children:[P||z.venue_name,O||z.venue_city?`, ${O||z.venue_city}`:""]})]}),(E==null?void 0:E.time_control)&&s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(Vt,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 flex-shrink-0"}),s.jsx("span",{children:E.time_control})]}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(sn,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 flex-shrink-0"}),s.jsxs("span",{children:[y.length||(p==null?void 0:p.participantCount)||0," joueurs"]})]})]})]}),!M&&s.jsx(Se,{children:s.jsxs(De,{className:"p-6 text-center space-y-2",children:[s.jsx(sn,{className:"w-10 h-10 text-primary mx-auto"}),s.jsx("h2",{className:"font-display text-lg font-semibold",children:"En attente du tournoi"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Le tournoi n'a pas encore démarré. Cette page se met à jour automatiquement dès que les appariements sont publiés."})]})}),R&&s.jsx(Se,{className:"bg-gradient-to-r from-amber-500/10 via-amber-400/5 to-primary/10 border-amber-500/30 backdrop-blur-sm",children:s.jsx(De,{className:"p-4 sm:p-5",children:s.jsxs("div",{className:"flex items-center gap-3 sm:gap-4",children:[s.jsx("div",{className:"w-12 h-12 sm:w-14 sm:h-14 roun
1351ded-xl bg-amber-500/20 flex items-center justify-center flex-shrink-0",children:s.jsx(Xt,{className:"w-6 h-6 sm:w-7 sm:h-7 text-amber-500"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h3",{className:"font-display text-base sm:text-lg font-bold text-foreground",children:"Tournoi terminé"}),s.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:H?s.jsxs(s.Fragment,{children:["Vous avez terminé"," ",s.jsxs("span",{className:"font-semibold text-amber-600",children:["#",H]})," ","sur ",y.length," joueurs"]}):s.jsx(s.Fragment,{children:"Consultez le classement final et vos parties"})})]})]})})}),!R&&B&&oe&&!oe.is_bye&&s.jsx(ple,{pairing:oe,round:B,totalRounds:(E==null?void 0:E.rounds_count)||4,userId:f||"",timeControl:(E==null?void 0:E.time_control)||"10+0",eventId:e,isWhitePlayer:J,userRank:H||void 0,totalPlayers:y.length||void 0,userPoints:F==null?void 0:F.points,opponentPoints:Z==null?void 0:Z.points,venueId:T,ticketCreditRemainingCents:W,ticketCreditTotalCents:q,ticketQrCode:z.qr_code,ticketReservationCode:z.reservation_code}),!R&&B&&(oe==null?void 0:oe.is_bye)&&s.jsx(Se,{className:"bg-muted/30 border-muted-foreground/20",children:s.jsxs(De,{className:"p-4 sm:p-6 text-center",children:[s.jsx(Xt,{className:"w-10 h-10 sm:w-12 sm:h-12 text-muted-foreground mx-auto mb-2 sm:mb-3"}),s.jsx("h3",{className:"font-display text-base sm:text-lg font-bold mb-1",children:"Exempt cette ronde"}),s.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Vous êtes automatiquement crédité de 1 point."})]})}),!R&&B&&!oe&&s.jsx(oE,{startedAt:B.started_at,timeControl:(E==null?void 0:E.time_control)||"10+0"}),!R&&H&&s.jsx(Se,{className:"bg-gradient-to-r from-primary/10 via-primary/5 to-background border-primary/30",children:s.jsx(De,{className:"p-3 sm:p-4",children:s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[s.jsx("div",{className:"w-10 h-10 sm:w-12 sm:h-12 rounded-full bg-primary/20 flex items-center justify-center flex-shrink-0",children:s.jsxs("span",{className:"font-display text-lg sm:text-xl font-bold text-primary",children:["#",H]})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"font-medium text-sm sm:text-base",children:"Votre classement"}),s.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground truncate",children:[(F==null?void 0:F.points)||0," pts •"," ",(F==null?void 0:F.gamesPlayed)||0," parties"]})]})]}),s.jsx(Xt,{className:"w-6 h-6 sm:w-8 sm:h-8 text-primary/50 flex-shrink-0"})]})})}),q>0&&T&&s.jsx(Se,{children:s.jsxs(De,{className:"p-4 flex items-center justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"Crédit conso restant"}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[(W/100).toFixed(2),"€ sur"," ",(q/100).toFixed(2),"€"]})]}),s.jsxs(Q,{size:"sm",variant:"secondary",className:"gap-2",onClick:()=>i(!0),children:[s.jsx(eu,{className:"w-4 h-4"}),"Voir la carte"]})]})}),M&&s.jsxs(Ka,{value:a,onValueChange:o,className:"w-full",children:[s.jsxs(Ca,{className:"grid w-full grid-cols-3 h-10 sm:h-11",children:[s.jsxs(vn,{value:"games",className:"gap-1 sm:gap-2 text-xs sm:text-sm",children:[s.jsx(Xt,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),s.jsx("span",{children:"Parties"})]}),s.jsxs(vn,{value:"standings",className:"gap-1 sm:gap-2 text-xs sm:text-sm",children:[s.jsx(sn,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),s.jsx("span",{children:"Classement"})]}),s.jsxs(vn,{value:"crosstable",className:"gap-1 sm:gap-2 text-xs sm:text-sm",children:[s.jsx(Fm,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),s.jsx("span",{children:"Grille"})]})]}),s.jsx(Sn,{value:"games",className:"mt-3 sm:mt-4",children:s.jsx(gle,{eventId:e,userId:f||"",ticketIdOverride:h,totalRounds:(E==null?void 0:E.rounds_count)||4,currentRoundNumber:U})}),s.jsx(Sn,{value:"standings",className:"mt-3 sm:mt-4",children:s.jsx(sE,{eventId:e,tiebreakCriteria:E==null?void 0:E.tiebreak_criteria,onPlayerClick:_,highlightPlayerId:f??h??null})}),s.jsx(Sn,{value:"crosstable",className:"mt-3 sm:mt-4",children:s.jsx(iE,{eventId:e,tiebreakCriteria:E==null?void 0:E.tiebreak_criteria,onPlayerClick:_})})]}),!f&&s.jsx(Se,{className:"border-primary/20 bg-primary/5",children:s.jsxs(De,{className:"p-4 flex items-start gap-3",children:[s.jsx(cs,{className:"w-5 h-5 text-primary mt-0.5 flex-shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium",children:"Gardez votre historique"}),s.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Créez un compte pour conserver vos parties, votre Elo et retrouver vos tournois."}),s.jsx(Pe,{to:`/auth?mode=signup&email=${encodeURIComponent(z.guest_email||"")}`,children:s.jsxs(Q,{size:"sm",variant:"outline",className:"gap-2",children:[s.jsx(cs,{className:"w-4 h-4"}),"Créer mon compte"]})})]})]})})]})}),r&&T&&s.jsx(w6,{open:r,onOpenChange:i,venueId:T,creditRemainingCents:W,creditTotalCents:q,qrCode:z.qr_code,reservationCode:z.reservation_code}),s.jsx(aE,{player:w,allPlayers:b,open:!!l,onOpenChange:Ge=>!Ge&&c(null)})]})})}function sVe(){const{id:e}=Wi(),[t]=wc(),n=t.get("t")??"",r=t.get("preview")??"",{user:i,isLoading:a}=Tt(),[o,l]=N.useState(null),[c,u]=N.useState(!!n||!!r),[d,f]=N.useState(null),[h,p]=N.useState(!1),[x,y]=N.useState(""),[b,w]=N.useState(!1),[_,j]=N.useState(!1),E=async()=>
1351{if(e){w(!0);try{const{data:O,error:D}=await re.functions.invoke("gallery-access-request",{body:{action:"create",eventId:e,token:n,message:x.trim()}});if(D){const R=D.context,L=R?await R.json().catch(()=>null):null;throw new Error((L==null?void 0:L.error)??D.message)}if(O!=null&&O.error)throw new Error(O.error);j(!0),je.success("Demande envoyée — vous recevrez un email dès qu'elle est traitée.")}catch(O){je.error(O instanceof Error?O.message:"Demande impossible")}finally{w(!1)}}};N.useEffect(()=>{if(!e||!n&&!r)return;let O=!1;return u(!0),(async()=>{const{data:D,error:R}=await re.functions.invoke("gallery-access",{body:{eventId:e,token:n,previewToken:r}});O||(l(R||!D?{access:"invalid",eventTitle:null,expiresAt:null}:D),u(!1))})(),()=>{O=!0}},[e,n,r]);const S=N.useMemo(()=>o!=null&&o.expiresAt?Ze(new Date(o.expiresAt),"d MMMM yyyy",{locale:pt}):null,[o==null?void 0:o.expiresAt]),T=async O=>{p(!0);try{const R=await(await fetch(O.url)).blob(),L=URL.createObjectURL(R),M=document.createElement("a");M.href=L,M.download=`chessagenda-${O.id.slice(0,8)}.jpg`,M.click(),URL.revokeObjectURL(L)}catch{je.error("Téléchargement impossible")}finally{p(!1)}},P=O=>s.jsxs("div",{className:"min-h-screen bg-[#F5F3EE]",children:[s.jsx("header",{className:"border-b border-[#0D0D0D]/10 bg-white",children:s.jsxs("div",{className:"container mx-auto flex items-center justify-between px-4 py-4",children:[s.jsx(Pe,{to:"/",children:s.jsx(vc,{})}),s.jsx(Pe,{to:"/events",children:s.jsxs(Q,{variant:"ghost",size:"sm",children:[s.jsx(Fn,{className:"mr-2 h-4 w-4"}),"Les tournois"]})})]})}),s.jsx("main",{className:"container mx-auto max-w-5xl px-4 py-10",children:O})]});if(n||r){if(c)return P(s.jsxs("div",{className:"flex items-center justify-center py-24 text-muted-foreground",children:[s.jsx(We,{className:"mr-2 h-5 w-5 animate-spin"}),"Ouverture de l'album…"]}));if((o==null?void 0:o.access)!=="ok"){const R={invalid:{title:"Lien invalide",body:"Ce lien ne correspond à aucun album. Vérifiez que vous utilisez bien le lien personnel reçu par email."},not_published:{title:"Album pas encore disponible",body:"Les photos sont en cours de préparation. Vous recevrez un email dès qu'elles seront en ligne."},archived:{title:"Album archivé",body:S?`L'accès public s'est terminé le ${S}. Les photos ne sont pas supprimées : demandez à les revoir, un organisateur validera votre demande.`:"Les photos ne sont pas supprimées : demandez à les revoir, un organisateur validera votre demande."}}[(o==null?void 0:o.access)??"invalid"],L=(o==null?void 0:o.access)==="archived",M=_||(o==null?void 0:o.requestPending);return P(s.jsxs("div",{className:"mx-auto max-w-md rounded-2xl border border-[#0D0D0D]/10 bg-white p-8 text-center",children:[L?s.jsx(g5,{className:"mx-auto mb-4 h-8 w-8 text-[#0D0D0D]/40"}):s.jsx(yo,{className:"mx-auto mb-4 h-8 w-8 text-[#0D0D0D]/40"}),s.jsx("h1",{className:"font-bricolage text-2xl font-extrabold text-[#0D0D0D]",children:R.title}),s.jsx("p",{className:"mt-2 text-sm text-[#0D0D0D]/70",children:R.body}),L&&!!n&&s.jsx("div",{className:"mt-6 text-left",children:M?s.jsx("div",{className:"rounded-xl bg-[#F5F3EE] p-4 text-center text-sm text-[#0D0D0D]/75",children:"⏳ Demande en cours d'examen. Vous recevrez un email dès qu'un organisateur aura répondu."}):s.jsxs(s.Fragment,{children:[s.jsx($s,{value:x,onChange:B=>y(B.target.value.slice(0,1e3)),placeholder:"Un mot pour l'organisateur (facultatif)",rows:3,className:"resize-none bg-white"}),s.jsxs(Q,{className:"mt-3 w-full",onClick:E,disabled:b,children:[b?s.jsx(We,{className:"mr-2 h-4 w-4 animate-spin"}):s.jsx(g5,{className:"mr-2 h-4 w-4"}),"Demander l'accès aux photos"]})]})})]}))}const O=o.photos??[];return P(s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-[#0D0D0D]/60",children:r?"Aperçu privé · lien temporaire":"Album privé"}),s.jsx("h1",{className:"font-bricolage text-3xl font-extrabold text-[#0D0D0D] md:text-4xl",children:o.eventTitle??"Photos du tournoi"}),s.jsxs("p",{className:"mt-2 text-sm text-[#0D0D0D]/70",children:[O.length," photo(s) · réservé aux joueurs présents",S?` · accès jusqu'au ${S}`:""]})]}),O.length===0?s.jsxs("div",{className:"rounded-xl border border-dashed border-[#0D0D0D]/20 py-16 text-center text-sm text-[#0D0D0D]/60",children:[s.jsx(kf,{className:"mx-auto mb-3 h-6 w-6"}),"Aucune photo pour le moment."]}):s.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4",children:O.map(D=>s.jsx("button",{onClick:()=>f(D),className:"group aspect-square overflow-hidden rounded-xl border border-[#0D0D0D]/10 bg-white",children:s.jsx("img",{src:D.thumbUrl??D.url,alt:D.caption??"Photo du tournoi",loading:"lazy",className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})},D.id))}),s.jsx(Ln,{open:!!d,onOpenChange:D=>!D&&f(null),children:s.jsx(Dn,{className:"max-w-3xl p-0",children:d&&s.jsxs("div",{className:"relative",children:[s.jsx("img",{src:d.url,alt:d.caption??"Photo du tournoi",className:"max-h-[75vh] w-full object-contain bg-black"}),s.jsxs("div",{className:"flex items-center justify-between gap-2 p-3",children:[s.jsxs(Q,{variant:"secondary",size:"sm",onClick:()=>T(d),disabled:h,children:[s.jsx(mc,{className:"mr-2 h-4 w-4"}),"Télécharger"]}),s.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>f(null),children:[s.jsx(Er,{className:"mr-2 h-4 w-4"}),"Fermer"]})]})]})})}),s.jsxs("p",{className:"mt-10 text-center text-xs text-[#0D0D0D]/50",children:["Une photo vous gêne ?"," ",s.jsx("a",{href:"mailto:[email protected]",className:"underline",children:"Écrivez-nous"}),", on la retire sans discuter."]})]}))}return P(a?s.jsx("div",{className:"flex items-center justify-center py-24 text-muted-foreground",children:s.jsx(We,{className:"h-5 w-5 animate-spin"})}):i?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-[#0D0D0D]/60",children:"Album privé"}),s.jsx("h1",{className:"font-bricolage text-3xl font-extrabold text-[#0D0D0D] md:text-4xl",children:"Photos du tournoi"})]}),e&&s.jsx(e6,{eventId:e,canUpload:!1})]}):s.jsxs("div",{className:"mx-auto max-w-md rounded-2xl border border-[#0D0D0D]/10 bg-white p-8 text-center",children:[s.jsx(yo,{className:"mx-auto mb-4 h-8 w-8 text-[#0D0D0D]/40"}),s.jsx("h1",{className:"font-bricolage text-2xl font-extrabold text-[#0D0D0D]",children:"Album privé"}),s.jsx("p",{className:"mt-2 text-sm text-[#0D0D0D]/70",children:"Ouvrez le lien personnel reçu par email, ou connectez-vous avec le compte utilisé pour votre inscription."}),s.jsx(Pe,{to:"/auth",className:"mt-4 inline-block",children:s.jsx(Q,{children:"Se connecter"})})]}))}function Rz(e){if(typeof document>"u")return;const t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/[.$?*|{}()[\]\\/+^]/g,"\\$&")+"=([^;]*)"));return t?decodeURIComponent(t[1]):void 0}async function iVe(e,t={}){const n=crypto.randomUUID(),r=typeof window<"u"?window.location.href:void 0,i=Rz("_fbp"),a=Rz("_fbc");try{const o=window.fbq;typeof o=="function"&&o("track",e,t.customData??{},{eventID:n})}catch(o){console.warn("[meta] pixel track failed",o)}try{re.functions.invoke("meta-capi",{body:{event_name:e,event_id:n,event_source_url:r,user_data:{...t.userData??{},fbp:i,fbc:a},custom_data:t.customData??{}}}).catch(()=>{})}catch{}}function xle(e,t,n={}){try{const r=window.fbq;typeof r=="function"&&r("track",e,n,{eventID:t})}catch(r){console.warn("[meta] pixel track failed",r)}}const uh=Object.freeze(Object.defineProperty({__proto__:null,firePixelWithEventId:xle,trackMetaEvent:iVe},Symbol.toStringTag,{value:"Module"}));function aVe(){const{id:e}=Wi(),[t]=wc(),n=Rr(),{user:r}=Tt(),i=t.get("session_id"),a=t.get("guest")==="true",o=t.get("email"),[l,c]=N.useState("loading"),[u,d]=N.useState(""),[f,h]=N.useState(0),[p,x]=N.useState(a),[y,b]=N.useState(o||""),[w,_]=N.useState(!1),[j,E]=N.useState(null),[S,T]=N.useState([]);N.useEffect(()=>{if(!i){c("error"),d("Session de paiement introuvable");return}(async()=>{try{const{data:B,error:U}=await re.functions.invoke("verify-payment",{body:{sessionId:i}});if(U)throw console.error("Verify payment error:",U),new Error("Erreur de vérification");if(B!=null&&B.error)throw new Error(B.error);h((B==null?void 0:B.ticketCount)||1),x((B==null?void 0:B.isGuest)||a),_((B==null?void 0:B.isPendingUser)||!1),B!=null&&B.guestEmail&&b(B.guestEmail),B!=null&&B.accessToken&&E(B.accessToken);const F=Array.isArray(B==null?void 0:B.tickets)?B.tickets:[];T(F),c("success"),aN(),B!=null&&B.capiPurchaseEventId&&xle("Purchase",B.capiPurchaseEventId,{currency:B.capiCurrency??"EUR",value:typeof B.capiValue=="number"?B.capiValue:void 0,content_ids:[e],content_type:"event",num_items:(B==null?void 0:B.ticketCount)??1}),F.length<=1&&(B!=null&&B.accessToken?setTimeout(()=>{n(`/events/${e}/ticket?code=${B.accessToken}`)},2500):!(B!=null&&B.isGuest)&&!a&&!(B!=null&&B.isPendingUser)&&r&&setTimeout(()=>{n(`/events/${e}/ticket`)},3e3))}catch(B){console.error("Payment verification failed:",B),c("error"),d(B instanceof Error?B.message:"Erreur de vérification")}})()},[i,e,n,a,r]);const P=M=>`${window.location.origin}/events/${e}/ticket?code=${M.accessToken}`,O=async M=>{var U;const B=P(M);try{if((U=navigator.clipboard)!=null&&U.writeText)await navigator.clipboard.writeText(B);else{const F=document.createElement("textarea");F.value=B,F.style.position="fixed",F.style.opacity="0",document.body.appendChild(F),F.select(),document.execCommand("copy"),document.body.removeChild(F)}je.success(`Lien copié — ${M.holderName}`)}
1351catch(F){console.error("Clipboard error:",F),window.prompt("Copiez le lien :",B)}},D=async M=>{const B=P(M);try{await navigator.share({title:`Billet de ${M.holderName}`,text:`Voici ton billet Chess Agenda (code ${M.reservationCode})`,url:B})}catch{O(M)}},R=typeof navigator<"u"&&typeof navigator.share=="function",L=l==="success"&&S.length>1;return s.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[s.jsx(tr,{}),s.jsx("main",{className:"flex-1 flex items-center justify-center pt-24 pb-12 px-4",children:s.jsxs("div",{className:"max-w-md w-full",children:[l==="loading"&&s.jsxs("div",{className:"text-center space-y-4",children:[s.jsx("div",{className:"w-20 h-20 mx-auto rounded-full bg-primary/10 flex items-center justify-center",children:s.jsx(We,{className:"w-10 h-10 animate-spin text-primary"})}),s.jsx("h1",{className:"font-display text-2xl font-bold",children:"Confirmation en cours..."}),s.jsx("p",{className:"text-muted-foreground",children:"Vérification de votre paiement auprès de Stripe"})]}),l==="success"&&s.jsxs("div",{className:"text-center space-y-6",children:[s.jsx("div",{className:"w-20 h-20 mx-auto rounded-full bg-green-500/10 flex items-center justify-center",children:s.jsx(Cn,{className:"w-12 h-12 text-green-500"})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h1",{className:"font-display text-2xl font-bold text-green-600",children:"Paiement confirmé !"}),s.jsx("p",{className:"text-muted-foreground",children:f>1?`Vos ${f} places ont été réservées avec succès.`:"Votre place a été réservée avec succès."})]}),L&&s.jsx(Se,{className:"border-primary/20 bg-primary/5 text-left",children:s.jsxs(De,{className:"p-4 sm:p-5 space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[s.jsx(vo,{className:"w-5 h-5"}),s.jsx("span",{className:"font-medium text-sm",children:"Un code et un lien par billet — transférez chaque lien à l'invité concerné."})]}),s.jsx("ul",{className:"space-y-3",children:S.map((M,B)=>s.jsxs("li",{className:"rounded-lg border border-border/60 bg-background/40 p-3 sm:p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:M.isForSelf?"Votre billet":`Invité ${B+1}`}),s.jsx("p",{className:"font-semibold truncate",children:M.holderName})]}),s.jsx("code",{className:"font-mono text-base font-bold text-primary tracking-widest shrink-0",children:M.reservationCode})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[s.jsxs(Q,{size:"sm",variant:"default",className:"flex-1",onClick:()=>n(`/events/${e}/ticket?code=${M.accessToken}`),children:[s.jsx(Sr,{className:"w-4 h-4 mr-1.5"}),"Voir"]}),s.jsxs(Q,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>O(M),children:[s.jsx(Ko,{className:"w-4 h-4 mr-1.5"}),"Copier"]}),R&&s.jsxs(Q,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>D(M),children:[s.jsx(Cm,{className:"w-4 h-4 mr-1.5"}),"Partager"]})]})]},M.ticketId))}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Un email récapitulatif avec tous les codes et liens",y&&s.jsxs(s.Fragment,{children:[" a été envoyé à ",s.jsx("strong",{children:y})]}),"."]})]})}),w&&!L?s.jsxs(s.Fragment,{children:[s.jsx(Se,{className:"border-primary/20 bg-primary/5",children:s.jsxs(De,{className:"p-5 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[s.jsx(Ti,{className:"w-5 h-5"}),s.jsx("span",{className:"font-medium text-sm",children:"Compte créé avec succès"})]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Un email de confirmation a été envoyé à"," ",s.jsx("strong",{className:"text-foreground",children:y}),". Confirmez votre email pour accéder à toutes les fonctionnalités (appariements, stats, classement)."]})]})}),s.jsx("div",{className:"bg-muted/50 rounded-lg p-4 text-sm text-muted-foreground",children:"Redirection automatique vers votre ticket..."}),s.jsx(Pe,{to:j?`/events/${e}/ticket?code=${j}`:`/events/${e}/ticket`,children:s.jsxs(Q,{size:"lg",className:"w-full",children:["Voir mon ticket",s.jsx(Sr,{className:"w-4 h-4 ml-2"})]})})]}):p?s.jsxs(s.Fragment,{children:[!L&&s.jsx("div",{className:"bg-muted/50 rounded-lg p-4 text-sm text-muted-foreground",children:s.jsxs("p",{children:["Un email de confirmation avec votre code de réservation a été envoyé",y&&s.jsxs("span",{children:[" à ",s.jsx("strong",{children:y})]}),"."]})}),s.jsx(Se,{className:"border-primary/20 bg-primary/5",children:s.jsxs(De,{className:"p-6 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-center gap-2 text-primary",children:[s.jsx(Ti,{className:"w-5 h-5"}),s.jsx("span",{className:"font-medium",children:"Recommandé"})]}),s.jsx("h3",{className:"font-display text-lg font-semibold text-center",children:"Créez votre compte maintenant"}),s.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx(Cn,{className:"w-4 h-4 text-primary"}),"Gérez vos tickets en ligne"]}),s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx(Cn,{className:"w-4 h-4 text-primary"}),"Suivez vos statistiques et classement"]}),s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx(Cn,{className:"w-4 h-4 text-primary"}),"Recevez les appariements automatiques"]})]}),s.jsx(Pe,{to:`/auth?mode=signup${y?`&email=${encodeURIComponent(y)}`:""}&redirect=/player`,children:s.jsxs(Q,{size:"lg",className:"w-full gap-2",children:[s.jsx(cs,{className:"w-4 h-4"}),"Créer mon compte (30 sec)"]})})]})}),s.jsx(Pe,{to:`/events/${e}`,children:s.jsx(Q,{variant:"ghost",className:"w-full",children:"Retour à l'événement"})})]}):L?null:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"bg-muted/50 rounded-lg p-4 text-sm text-muted-foreground",children:"Redirection automatique vers votre ticket..."}),s.jsx(Pe,{to:j?`/events/${e}/ticket?code=${j}`:`/events/${e}/ticket`,children:s.jsxs(Q,{size:"lg",className:"w-full",children:["Voir mon ticket",s.jsx(Sr,{className:"w-4 h-4 ml-2"})]})})]})]}),l==="error"&&s.jsxs("div",{className:"text-center space-y-6",children:[s.jsx("div",{className:"w-20 h-20 mx-auto rounded-full bg-destructive/10 flex items-center justify-center",children:s.jsx(hi,{className:"w-12 h-12 text-destructive"})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:"Erreur de vérification"}),s.jsx("p",{className:"text-muted-foreground",children:u||"Le paiement n'a pas pu être vérifié."})]}),s.jsx("div",{className:"bg-muted/50 rounded-lg p-4 text-sm text-muted-foreground",children:"Si vous avez été débité, contactez-nous avec votre numéro de transaction."}),s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx(Pe,{to:`/events/${e}`,children:s.jsx(Q,{variant:"outline",className:"w-full",children:"Retour à l'événement"})}),s.jsx(Pe,{to:"/events",children:s.jsx(Q,{variant:"ghost",className:"w-full",children:"Voir tous les tournois"})})]})]})]})}),s.jsx(Rl,{source:"footer-payment-success"})]})}function oVe(){const{id:e}=Wi(),[t]=wc(),n=Ye(),r=t.get("session_id"),[i,a]=N.useState("loading");N.useEffect(()=>{let l=!1;return(async()=>{try{const{data:u,error:d}=await re.functions.invoke("cancel-pending-checkout",{body:{eventId:e,sessionId:r??void 0}});if(l)return;if(d){a("error");return}u!=null&&u.alreadyPaid?a("already_paid"):((u==null?void 0:u.cancelledCount)??0)>0?a("released"):a("noop")}catch{l||a("error")}finally{n.invalidateQueries({queryKey:["event-tickets-count",e]}),n.invalidateQueries({queryKey:["events-ticket-counts"]}),n.invalidateQueries({queryKey:["can-register",e]}),n.invalidateQueries({queryKey:["my-event-ticket",e]}),n.invalidateQueries({queryKey:["my-tickets-for-event",e]}),n.invalidateQueries({queryKey:["my-tickets"]})}})(),()=>{l=!0}},[e,r,n]);const o=i==="already_paid";return s.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[s.jsx(tr,{}),s.jsx("main",{className:"flex-1 flex items-center justify-center pt-24 pb-12 px-4",children:s.jsxs("div",{className:"max-w-md w-full text-center space-y-6",children:[s.jsx("div",{className:`w-20 h-20 mx-auto rounded-full flex items-center justify-center ${o?"bg-green-500/10":"bg-muted"}`,children:i==="loading"?s.jsx(We,{className:"w-10 h-10 animate-spin text-muted-foreground"}):o?s.jsx(Cn,{className:"w-12 h-12 text-green-500"}):s.jsx(hi,{className:"w-12 h-12 text-muted-foreground"})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:o?"Paiement déjà c
1351onfirmé":"Paiement annulé"}),s.jsx("p",{className:"text-muted-foreground",children:o?"Votre paiement a bien été pris en compte. Votre place est confirmée.":"Aucun montant n'a été débité. Vous pouvez réessayer quand vous le souhaitez."})]}),!o&&s.jsx("div",{className:"bg-muted/50 rounded-lg p-4 text-sm text-muted-foreground",children:i==="loading"?"Libération de votre réservation en cours…":i==="released"?"Votre réservation a été libérée. Les places sont à nouveau disponibles.":i==="error"?"Si une réservation est restée en attente, elle sera libérée automatiquement sous quelques minutes.":"Aucune réservation en attente à libérer."}),s.jsxs("div",{className:"flex flex-col gap-3 pt-4",children:[o?s.jsx(Pe,{to:`/events/${e}/ticket`,children:s.jsx(Q,{size:"lg",className:"w-full",children:"Voir mon ticket"})}):s.jsx(Pe,{to:`/events/${e}/register`,children:s.jsxs(Q,{size:"lg",className:"w-full",disabled:i==="loading",children:[s.jsx(Il,{className:"w-4 h-4 mr-2"}),"Réessayer l'inscription"]})}),s.jsx(Pe,{to:`/events/${e}`,children:s.jsxs(Q,{variant:"outline",className:"w-full",children:[s.jsx(Fn,{className:"w-4 h-4 mr-2"}),"Retour à l'événement"]})})]})]})}),s.jsx(Rl,{source:"footer-payment-cancel"})]})}function lVe({venueId:e,venueName:t}){const{user:n}=Tt(),{data:r,isLoading:i}=Ete(e),a=Ste(),o=Ate(),[l,c]=N.useState(!1),[u,d]=N.useState(""),[f,h]=N.useState(!1),p=async()=>{if(!n){c(!0);return}r?(await o.mutateAsync(e),je.success("Désabonné de "+t)):(await a.mutateAsync(e),je.success("Abonné à "+t+" !"))},x=async b=>{if(b.preventDefault(),!!u.trim()){h(!0);try{const w=crypto.randomUUID(),{data:_,error:j}=await re.auth.signUp({email:u.trim(),password:w,options:{data:{first_name:"",signup_role:"player"}}});if(j){if(j.message.includes("already registered")||j.message.includes("already been registered")){je.error("Ce compte existe déjà. Connectez-vous pour vous abonner."),c(!1),h(!1);return}throw j}if(_.user){const{error:E}=await re.from("venue_subscriptions").insert({venue_id:e,user_id:_.user.id});E&&!E.message.includes("duplicate")&&console.error("Subscription error:",E),je.success("Abonné à "+t+" ! Un email vous a été envoyé."),c(!1),d("")}}catch(w){je.error(w.message||"Erreur lors de l'inscription")}finally{h(!1)}}},y=a.isPending||o.isPending;return s.jsxs(s.Fragment,{children:[s.jsxs(Q,{onClick:p,disabled:y||i,size:"lg",variant:r?"outline":"default",className:"gap-2 w-full sm:w-auto text-base font-semibold",children:[y||i?s.jsx(We,{className:"w-5 h-5 animate-spin"}):s.jsx(tu,{className:`w-5 h-5 ${r?"fill-primary text-primary":""}`}),r?"Abonné":"S'abonner"]}),s.jsx(Ln,{open:l,onOpenChange:c,children:s.jsxs(Dn,{className:"sm:max-w-md",children:[s.jsxs(Un,{children:[s.jsxs(qn,{className:"flex items-center gap-2",children:[s.jsx(tu,{className:"w-5 h-5 text-primary"}),"S'abonner à ",t]}),s.jsx(qr,{children:"Entrez votre email pour suivre ce lieu et recevoir les prochains événements. Vous pourrez compléter votre profil plus tard."})]}),s.jsxs("form",{onSubmit:x,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"sub-email",children:"Email"}),s.jsxs("div",{className:"relative",children:[s.jsx(wr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{id:"sub-email",type:"email",required:!0,placeholder:"[email protected]",value:u,onChange:b=>d(b.target.value),className:"pl-10",autoFocus:!0})]})]}),s.jsxs(Q,{type:"submit",className:"w-full gap-2",disabled:f,children:[f?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(tu,{className:"w-4 h-4"}),"S'abonner"]}),s.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"En vous abonnant, un compte sera créé automatiquement. Vous pourrez définir un mot de passe via « Mot de passe oublié »."})]})]})})]})}const cVe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function uVe(e){return st({queryKey:["public-venue",e],queryFn:async()=>{if(!e)return null;const n=cVe.test(e)?"id":"slug",{data:r,error:i}=await re.from("venues").select("id, name, address, city, description, image_url, capacity, latitude, longitude, slug, postal_code, brand_color, logo_url, cover_image_url, district_label").eq(n,e).eq("is_active",!0).maybeSingle();if(i)throw i;return r},enabled:!!e})}function dVe(e){return st({queryKey:["public-venue-events",e],queryFn:async()=>
1351{if(!e)return[];const{data:t,error:n}=await re.from("events").select(`
1352          *,
1353          venue:venues!events_venue_id_fkey (id, name, city, address)
1354        `).eq("venue_id",e).in("status",["published","ongoing"]).gte("event_date",new Date().toISOString()).order("event_date",{ascending:!0});if(n)throw n;return t},enabled:!!e})}const fVe=N.lazy(()=>ka(()=>import("./VenueMiniMap-BOfqyfgs.js"),[])),hVe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,mVe={drink:"🍺",food:"🍔",snack:"🥨",other:"📦"};function pVe(){const{id:e}=Wi(),t=Rr(),{data:n,isLoading:r}=uVe(e);N.useEffect(()=>{n!=null&&n.slug&&e&&hVe.test(e)&&t(`/venues/${n.slug}`,{replace:!0})},[n==null?void 0:n.slug,e,t]);const{data:i=[],isLoading:a}=dVe(n==null?void 0:n.id),{data:o=[]}=tE(n==null?void 0:n.id),l=i.map(f=>f.id),{data:c={}}=_R(l),u=o.length>0,d=!!(n!=null&&n.latitude&&(n!=null&&n.longitude));return N.useEffect(()=>{if(!(n!=null&&n.id))return;let f=!1;return ka(async()=>{const{trackMetaEvent:h}=await Promise.resolve().then(()=>uh);return{trackMetaEvent:h}},void 0).then(({trackMetaEvent:h})=>{f||h("ViewContent",{customData:{content_ids:[n.id],content_type:"venue",content_name:n.name}})}),()=>{f=!0}},[n==null?void 0:n.id,n==null?void 0:n.name]),r?s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("div",{className:"pt-24 pb-12",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-5xl",children:[s.jsx(Ie,{className:"h-8 w-32 mb-6"}),s.jsx(Ie,{className:"h-48 w-full rounded-xl mb-6"}),s.jsx(Ie,{className:"h-12 w-3/4 mb-4"}),s.jsx(Ie,{className:"h-6 w-1/2 mb-8"})]})})]}):n?s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("main",{className:"pt-24 pb-12",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-5xl",children:[s.jsxs(Pe,{to:"/venues",className:"inline-flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors mb-6",children:[s.jsx(Fn,{className:"w-4 h-4"}),"Retour aux lieux"]}),n.image_url&&s.jsxs("div",{className:"relative w-full h-48 md:h-64 rounded-xl overflow-hidden mb-6",children:[s.jsx("img",{src:n.image_url,alt:n.name,className:"w-full h-full object-cover",loading:"eager"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-background/60 to-transparent"})]}),s.jsxs("div",{className:"flex flex-col gap-4 mb-10",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("h1",{className:"font-display text-3xl md:text-4xl font-bold text-foreground mb-3",children:n.name}),s.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-muted-foreground",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(gn,{className:"w-5 h-5 text-primary"}),s.jsxs("span",{children:[n.address,", ",n.city]})]}),n.capacity&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(sn,{className:"w-5 h-5 text-primary"}),s.jsxs("span",{children:["Capacité : ",n.capacity," personnes"]})]})]}),s.jsx(Sae,{venue:n,className:"mt-4"}),n.description&&s.jsx("p",{className:"mt-4 text-muted-foreground max-w-2xl",children:n.description})]}),s.jsx(lVe,{venueId:n.id,venueName:n.name})]}),s.jsxs("section",{className:"mb-10",children:[s.jsxs("h2",{className:"font-display text-xl font-bold text-foreground mb-6 flex items-center gap-2",children:[s.jsx(Jn,{className:"w-5 h-5 text-primary"}),"Prochains tournois"]}),a?s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:[1,2,3].map(f=>s.jsx(Ie,{className:"h-64"},f))}):i.length===0?s.jsx(Se,{children:s.jsxs(De,{className:"py-12 text-center",children:[s.jsx(Jn,{className:"w-12 h-12 text-muted-foreground mx-auto mb-4"}),s.jsx("h3",{className:"font-medium text-lg mb-2",children:"Aucun tournoi prévu"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Ce lieu n'a pas encore de tournois programmés."}),s.jsx(Pe,{to:"/events",children:s.jsx(Q,{variant:"outline",children:"Voir tous les tournois"})})]})}):s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:i.map(f=>s.jsx(eae,{event:f,ticketCount:c[f.id]||0},f.id))})]}),d&&s.jsxs("section",{className:"mb-10",children:[s.jsxs("h2",{className:"font-display text-xl font-bold text-foreground mb-4 flex items-center gap-2",children:[s.jsx(gn,{className:"w-5 h-5 text-primary"}
1354),"Localisation"]}),s.jsx(N.Suspense,{fallback:s.jsx(Ie,{className:"h-[200px] w-full rounded-xl"}),children:s.jsx(fVe,{latitude:n.latitude,longitude:n.longitude,venueName:n.name,className:"h-[220px]"})})]}),u&&s.jsxs("section",{className:"mb-10",children:[s.jsxs("h2",{className:"font-display text-xl font-bold text-foreground mb-4 flex items-center gap-2",children:[s.jsx(eu,{className:"w-5 h-5 text-primary"}),"Menu du bar"]}),s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:o.map(f=>s.jsx(Se,{className:"border-border/50",children:s.jsxs(De,{className:"p-3 text-center",children:[s.jsx("span",{className:"text-2xl block mb-1",children:mVe[f.category||"other"]||"📦"}),s.jsx("p",{className:"font-medium text-sm truncate",children:f.name}),s.jsxs("p",{className:"text-xs text-primary font-semibold mt-1",children:[(f.price_cents/100).toFixed(2)," €"]})]})},f.id))})]})]})}),s.jsx(Rl,{source:"footer-venue"})]}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("div",{className:"pt-24 pb-12",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-5xl text-center py-16",children:[s.jsx("h1",{className:"font-display text-2xl font-bold mb-4",children:"Lieu introuvable"}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Ce lieu n'existe pas ou n'est plus disponible."}),s.jsx(Pe,{to:"/events",children:s.jsx(Q,{children:"Voir tous les tournois"})})]})})]})}function gVe({venue:e}){const t=e.upcoming_events_count>0;return s.jsxs(Se,{className:"group relative overflow-hidden hover:shadow-[0_8px_30px_-12px_rgba(170,255,0,0.45)] hover:-translate-y-0.5 transition-all duration-300 border border-[#0D0D0D]/5 hover:border-[#AAFF00] rounded-2xl bg-card",children:[s.jsx("div",{className:"absolute inset-x-0 top-0 h-0.5 bg-[#AAFF00] scale-x-0 group-hover:scale-x-100 origin-left transition-transform duration-500"}),s.jsxs(De,{className:"p-5",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2 mb-4",children:[s.jsx(we,{className:"text-[10px] uppercase tracking-[0.15em] bg-transparent text-[#0D0D0D]/70 border border-[#0D0D0D]/5 rounded-full font-mono px-2.5 py-0.5 hover:bg-transparent",children:e.city}),t&&s.jsxs(we,{className:"text-[10px] uppercase tracking-[0.15em] bg-[#AAFF00] text-[#0D0D0D] border-none rounded-full font-mono px-2.5 py-0.5 hover:bg-[#AAFF00]",children:[s.jsx(Jn,{className:"w-3 h-3 mr-1"}),e.upcoming_events_count," ",e.upcoming_events_count>1?"tournois":"tournoi"]})]}),s.jsx("h3",{className:"font-display text-2xl font-normal italic text-[#0D0D0D] mb-4 line-clamp-2 tracking-tight",children:e.name}),s.jsxs("div",{className:"space-y-2.5 text-sm text-[#0D0D0D]/70",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"inline-flex items-center justify-center w-6 h-6 rounded-full bg-[#AAFF00] flex-shrink-0",children:s.jsx(gn,{className:"w-3.5 h-3.5 text-[#0D0D0D]",strokeWidth:2.5})}),s.jsx("span",{className:"truncate",children:e.address})]}),e.capacity&&s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"inline-flex items-center justify-center w-6 h-6 rounded-full bg-[#AAFF00] flex-shrink-0",children:s.jsx(sn,{className:"w-3.5 h-3.5 text-[#0D0D0D]",strokeWidth:2.5})}),s.jsxs("span",{children:["Capacité ",e.capacity]})]})]}),e.description&&s.jsx("p",{className:"mt-4 text-sm text-[#0D0D0D]/55 line-clamp-2 leading-relaxed",children:e.description})]}),s.jsx(jee,{className:"p-5 pt-0",children:s.jsx(Pe,{to:`/venues/${e.slug||e.id}`,className:"w-full",children:s.jsx(Q,{className:"w-full font-medium text-sm h-11 rounded-full bg-[#0D0D0D] text-[#F5F3EE] hover:bg-[#AAFF00] hover:text-[#0D0D0D] transition-all duration-300 border-none",children:t?"Voir les tournois →":"Découvrir le lieu →"})})})]})}function xVe(e){return st({queryKey:["public-venues",e==null?void 0:e.city],queryFn:async()=>{let t=re.from("venues").select("id, name, slug, address, city, description, image_url, capacity, latitude, longitude").eq("is_active",!0).order("name");const{data:n,error:r}=await t;if(r)throw r;const{data:i,error:a}=await re.from("events").select("venue_id").in("status",["published","ongoing"]).gte("event_date",new Date().toISOString());if(a)throw a;const o=(i||[]).reduce((l,c)=>(l[c.venue_id]=(l[c.venue_id]||0)+1,l),{});return n.map(l=>({...l,upcoming_events_count:o[l.id]||0}))},staleTime:1e3*60*5})}function yVe(){return st({queryKey:["venue-cities"],queryFn:async()=>{const{data:e,error:t}=await re.from("venues").select("city").eq("is_active",!0);if(t)throw t;return[...new Set(e.map(r=>r.city))].sort()},staleTime:1e3*60*10})}const vVe=N.lazy(()=>ka(()=>import("./VenuesMap-Vl18YXYk.js"),[]));function bVe(){const[e,t]=N.useState(""),[n,r]=N.useState(""),[i,a]=N.useState(()=>typeof window<"u"&&localStorage.getItem("venues-view-mode")==="list"?"list":"map"),{data:o,isLoading:l}=xVe(),{data:c=[],isLoading:u}=yVe(),d=N.useMemo(()=>o?o.filter(b=>{const w=!e||b.name.toLowerCase().includes(e.toLowerCase())||b.address.toLowerCase().includes(e.toLowerCase()),_=!n||n==="all"||b.city===n;return w&&_}):[],[o,e,n]),f=N.useMemo(()=>[...d].sort((b,w)=>b.upcoming_events_count>0&&w.upcoming_events_count===0?-1:b.upcoming_events_count===0&&w.upcoming_events_count>0?1:w.upcoming_events_count-b.upcoming_events_count),[d]),h=N.useMemo(()=>(o==null?void 0:o.filter(b=>b.latitude&&b.longitude).length)||0,[o]),p=()=>{t(""),r("")},x=b=>{b!=="calendar"&&(a(b),localStorage.setItem("venues-view-mode",b))},y=l||u;return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("section",{className:"pt-20 md:pt-24 pb-2",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("div",{className:"inline-flex items-center gap-2 mb-2 text-[11px] font-mono uppercase tracking-[0.2em] text-[#0D0D0D]/60",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#AAFF00] animate-pulse"}),s.jsx("span",{children:"PARTENAIRES"})]}),s.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-end lg:justify-between gap-1 lg:gap-12",children:[s.jsxs("h1",{className:"font-bricolage text-4xl sm:text-5xl md:text-6xl font-extrabold text-foreground tracking-tight leading-[0.95]",children:["Lieux",s.jsx("span",{className:"text-[#AAFF00]",children:"."})]}),s.jsx("p",{className:"text-muted-foreground text-sm md:text-base max-w-sm lg:text-right lg:pb-2",children:"Bars, cafés et tiers-lieux qui accueillent nos tournois d'échecs."})]})]})}),s.jsx("section",{className:"pt-3 pb-12",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(_o,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Ue,{placeholder:"Où souhaitez-vous jouer ?",value:e,onCh
1354ange:b=>t(b.target.value),className:"pl-10"})]}),s.jsxs(li,{value:n,onValueChange:r,children:[s.jsxs(Gs,{className:"w-full sm:w-48",children:[s.jsx(gn,{className:"w-4 h-4 mr-2 text-muted-foreground"}),s.jsx(ci,{placeholder:"Toutes les villes"})]}),s.jsxs(Ks,{children:[s.jsx(Yn,{value:"all",children:"Toutes les villes"}),c.map(b=>s.jsx(Yn,{value:b,children:b},b))]})]})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[!y&&s.jsxs("p",{className:"text-muted-foreground",children:[f.length," lieu",f.length!==1?"x":""," partenaire",f.length!==1?"s":"",i==="map"&&h<f.length&&s.jsxs("span",{className:"text-xs ml-2",children:["(",h," sur la carte)"]})]}),s.jsx(hae,{value:i,onChange:x,modes:["map","list"]})]}),y?s.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((b,w)=>s.jsxs("div",{className:"rounded-xl border border-border p-5",children:[s.jsxs("div",{className:"flex justify-between mb-3",children:[s.jsx(Ie,{className:"h-5 w-20"}),s.jsx(Ie,{className:"h-5 w-16"})]}),s.jsx(Ie,{className:"h-6 w-3/4 mb-4"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ie,{className:"h-4 w-full"}),s.jsx(Ie,{className:"h-4 w-2/3"})]}),s.jsx(Ie,{className:"h-10 w-full mt-4"})]},w))}):f.length>0?i==="list"?s.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-6",children:f.map(b=>s.jsx(gVe,{venue:b},b.id))}):s.jsx(N.Suspense,{fallback:s.jsx("div",{className:"h-[60vh] md:h-[70vh] rounded-xl border border-border bg-muted animate-pulse flex items-center justify-center",children:s.jsx(gn,{className:"w-8 h-8 text-muted-foreground"})}),children:s.jsx(vVe,{venues:f,className:"h-[60vh] md:h-[70vh] relative"})}):s.jsxs("div",{className:"text-center py-16",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-4",children:s.jsx(km,{className:"w-8 h-8 text-muted-foreground"})}),s.jsx("h3",{className:"font-display text-xl font-semibold mb-2",children:"Aucun lieu trouvé"}),s.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:e||n?"Essayez de modifier vos filtres pour voir plus de résultats.":"Aucun lieu partenaire n'est encore référencé."}),(e||n)&&s.jsx(Q,{variant:"outline",onClick:p,children:"Effacer les filtres"})]})]})}),s.jsx("section",{className:"py-12 md:py-16 bg-card border-t border-border",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-2xl mx-auto text-center",children:[s.jsx("h2",{className:"font-display text-2xl md:text-3xl font-bold mb-4",children:"Vous êtes un bar ou un café ?"}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Rejoignez notre réseau et accueillez des tournois d'échecs dans votre établissement."}),s.jsx(Pe,{to:"/auth?tab=signup&role=venue",children:s.jsxs(Q,{size:"lg",className:"gap-2",children:[s.jsx(km,{className:"w-4 h-4"}),"Devenir lieu partenaire"]})})]})})}),s.jsx(Rl,{source:"footer-venues"})]})}const wVe={credit:s.jsx(el,{className:"inline w-3 h-3 mr-1 -mt-0.5"}),level:s.jsx(sn,{className:"inline w-3 h-3 mr-1 -mt-0.5"}),rules:s.jsx(Rk,{className:"inline w-3 h-3 mr-1 -mt-0.5"}),registration:s.jsx(vo,{className:"inline w-3 h-3 mr-1 -mt-0.5"}),day:s.jsx(Jn,{className:"inline w-3 h-3 mr-1 -mt-0.5"}),security:s.jsx(nd,{className:"inline w-3 h-3 mr-1 -mt-0.5"})},_Ve=()=>{const e=Object.entries(eAe);return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("main",{className:"pt-24 pb-16 md:pt-32 md:pb-24",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsx("div",{className:"max-w-3xl mx-auto mb-8",children:s.jsxs(Pe,{to:"/",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(Fn,{className:"w-4 h-4"}),"Retour à l'accueil"]})}),s.jsxs("div",{className:"max-w-3xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsxs("p",{className:"font-mono text-xs uppercase tracking-[0.2em] mb-2 text-foreground/60",children:[s.jsx(Lk,{className:"inline w-3 h-3 mr-1 -mt-0.5"}),"FAQ"]}),s.jsx("h1",{className:"font-sans font-semibold text-4xl md:text-5xl mb-4 text-foreground",children:"Questions fréquentes"}
1354),s.jsx("p",{className:"max-w-xl mx-auto text-foreground/70",children:"Tout ce que vous devez savoir sur nos tournois d'échecs en bars."})]}),s.jsx("div",{className:"space-y-10",children:e.map(([t,n])=>{const r=xee.filter(i=>i.category===t);return r.length===0?null:s.jsxs("section",{id:t,children:[s.jsxs("p",{className:"font-mono text-xs uppercase tracking-[0.2em] mb-3 text-foreground/60 text-center",children:[wVe[t],n.label]}),s.jsx("div",{className:"rounded-3xl p-2 md:p-4 border border-foreground/10 bg-card",children:s.jsx(wC,{type:"single",collapsible:!0,className:"space-y-1",children:r.map(i=>s.jsxs(kx,{value:i.id,className:"px-3 border-0 rounded-2xl data-[state=open]:bg-accent/10 transition-colors",children:[s.jsx(Cx,{className:"font-sans text-left hover:no-underline py-4 text-sm md:text-base font-semibold text-foreground",children:i.question}),s.jsx(Ex,{className:"text-sm leading-relaxed pb-4 whitespace-pre-line text-foreground/75",children:i.answer})]},i.id))})})]},t)})}),s.jsx("div",{className:"mt-16",children:s.jsxs("div",{className:"text-center p-8 md:p-10 rounded-3xl border border-foreground
1354/10 bg-card",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-accent flex items-center justify-center mx-auto mb-4",children:s.jsx(wr,{className:"w-5 h-5 text-accent-foreground"})}),s.jsx("h3",{className:"font-sans font-semibold text-xl text-foreground mb-2",children:"Vous n'avez pas trouvé votre réponse ?"}),s.jsx("p",{className:"text-foreground/70 mb-6",children:"Notre équipe est là pour vous aider."}),s.jsxs(Q,{className:"gap-2 rounded-full",children:[s.jsx(wr,{className:"w-4 h-4"}),"Nous contacter"]})]})})]})]})}),s.jsx(Rl,{source:"footer-faq"})]})},Mz="/auth?tab=signup&role=venue",jVe=()=>(N.useEffect(()=>{const e=document.title,t="Accueillez des tournois d'échecs IRL clé en main dans votre bar. Nouvelle clientèle qualifiée, organisation prise en charge, revenus garantis.";document.title=`Devenir lieu partenaire — ${NR}`;const n=document.querySelector('meta[name="description"]'),r=(n==null?void 0:n.getAttribute("content"))??null;return n&&n.setAttribute("content",t),()=>{document.title=e,n&&r!==null&&n.setAttribute("content",r)}},[]),s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsxs("section",{className:"relative pt-24 pb-16 md:pt-32 md:pb-24 overflow-hidden",children:[s.jsx("div",{className:"absolute inset-0 chess-pattern opacity-40"}),s.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-transparent via-background/60 to-background"}),s.jsx("div",{className:"container relative mx-auto px-4",children:s.jsxs("div",{className:"max-w-3xl mx-auto text-center",children:[s.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 bg-secondary rounded-full text-sm text-secondary-foreground mb-6 animate-fade-in",children:[s.jsx(b5,{className:"w-4 h-4 text-primary"}),s.jsx("span",{children:"Pour les bars, cafés & tiers-lieux"})]}),s.jsxs("h1",{className:"font-display text-4xl md:text-5xl lg:text-6xl font-bold text-foreground mb-6 animate-fade-in",children:["Remplissez vos soirées calmes avec"," ",s.jsx("span",{className:"text-gradient text-accent shadow-none opacity-100 rounded-none",children:"des tournois d'échecs clé en main"})]}),s.jsx("p",{className:"text-lg md:text-xl text-muted-foreground mb-8 animate-fade-in max-w-2xl mx-auto",children:"Une nouvelle clientèle qualifiée, fidèle et passionnée. Vous fournissez le lieu, on s'occupe de tout le reste : inscriptions, paiement, organisation, communication."}),s.jsx("div",{className:"flex flex-col sm:flex-row gap-3 justify-center animate-fade-in",children:s.jsx(Pe,{to:Mz,children:s.jsxs(Q,{size:"lg",className:"w-full sm:w-auto gap-2 group shadow-lg shadow-primary/20",children:["Devenir partenaire",s.jsx(Sr,{className:"w-4 h-4 transition-transform group-hover:translate-x-1"})]})})}),s.jsx("p",{className:"text-xs text-muted-foreground mt-4",children:"Sans engagement · Réponse sous 48h · Premier tournoi en moins de 2 semaines"})]})})]}),s.jsx("section",{className:"py-12 md:py-16 bg-card border-y border-border/50",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6 max-w-4xl mx-auto",children:[s.jsx(__,{icon:sn,value:"16",label:"joueurs en moyenne par tournoi"}),s.jsx(__,{icon:l1,value:"10€",label:"reversés par joueur présent"}),s.jsx(__,{icon:Vt,value:"3h",label:"d'animation, un soir de semaine"}),s.jsx(__,{icon:gd,value:"0€",label:"de frais d'installation"})]})})}),s.jsx("section",{className:"py-16 md:py-24",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("div",{className:"text-center mb-12 max-w-2xl mx-auto",children:[s.jsx("h2",{className:"font-display text-3xl md:text-4xl font-bold text-foreground mb-4",children:"Pourquoi accueillir un tournoi ?"}),s.jsx("p",{className:"text-muted-foreground",children:"Un format pensé pour booster vos soirées creuses, sans charge supplémentaire pour votre équipe."})]}),s.jsxs("div",{className:"grid md:grid-cols-3 gap-6 max-w-5xl mx-auto",children:[s.jsx(Gp,{icon:lu,title:"Du chiffre sur des soirées calmes",description:"Mardi, mercredi, jeudi : des soirées normalement creuses se transforment en moments de pic. 16 joueurs présents 3h, c'est garanti."}),s.jsx(Gp,{icon:sn,title:"Une clientèle qualifiée",description:"Joueurs urbains, 25-45 ans, curieux, sociables. Ils reviennent avec leurs amis. Ils consomment, ils ne squattent pas."}),s.jsx(Gp,{icon:uxe,title:"Visibilité gratuite",description:"Votre bar mis en avant sur notre plateforme, dans nos newsletters et nos réseaux. Une nouvelle audience découvre votre lieu."}),s.jsx(Gp,{icon:Ti,title:"Une identité différenciante",description:"Devenez LE lieu de référence pour les échecs dans votre quartier. Une animation premium, sans devenir un café-jeux."}),s.jsx(Gp,{icon:dI,title:"Zéro charge organisationnelle",description:"Inscriptions, paiements, appariements, scores, classement : tout est géré par notre plateforme et nos arbitres digitaux."}),s.jsx(Gp,{icon:b5,title:"Une vraie communauté",description:"Pas un événement one-shot. Les joueurs reviennent. Le lien se crée. Votre bar devient un point de ralliement."})]})]})}),s.jsx("section",{className:"py-16 md:py-24 bg-card",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("div",{className:"text-center mb-12 max-w-2xl mx-auto",children:[s.jsx("h2",{className:"font-display text-3xl md:text-4xl font-bold text-foreground mb-4",children:"Comment ça se passe concrètement"}),s.jsx("p",{className:"text-muted-foreground",children:"De la première discussion au premier tournoi : moins de 2 semaines."})]}
1354),s.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[s.jsx(Iy,{number:"1",title:"Vous créez votre compte",description:"Inscription en 2 minutes. Vous nous donnez vos disponibilités, votre capacité d'accueil et la manière dont vous voulez gérer l'avantage food & drinks inclus (crédit digital suivi dans l'app, ou coupon papier remis sur place)."}),s.jsx(Iy,{number:"2",title:"On planifie ensemble votre premier tournoi",description:"Un soir en semaine, idéalement creux. On fixe la date, la capacité (8 à 24 joueurs), et on lance la communication."}),s.jsx(Iy,{number:"3",title:"On remplit la salle",description:"Notre communauté s'inscrit en ligne. Paiement sécurisé sur la plateforme. Vous recevez la liste des participants en temps réel."}),s.jsx(Iy,{number:"4",title:"Le soir J : vous accueillez, on anime",description:"Vos clients scannent leur QR code à l'entrée. Le tournoi se déroule via notre app : appariements automatiques, timer, scores. Vous, vous servez."}),s.jsx(Iy,{number:"5",title:"Vous êtes payé",description:"10€ par joueur présent (check-in QR), reversement automatique. Reporting clair. Indépendant de la conso réelle."})]})]})}),s.jsx("section",{className:"py-16 md:py-24",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-4xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-10",children:[s.jsx("h2",{className:"font-display text-3xl md:text-4xl font-bold text-foreground mb-4",children:"Un modèle simple et transparent"}),s.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:"Pas de frais cachés. Pas d'abonnement. Pas de minimum d'engagement. Vous êtes payé sur la base des joueurs présents."})]}),s.jsx(Se,{className:"border-primary/20 shadow-lg shadow-primary/5",children:s.jsx(De,{className:"p-6 md:p-8",children:s.jsxs("div",{className:"grid md:grid-cols-2 gap-8",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"font-display text-xl font-semibold mb-4 flex items-center gap-2",children:[s.jsx(l1,{className:"w-5 h-5 text-primary"}),"Le ticket joueur"]}),s.jsxs("ul",{className:"space-y-3 text-sm",children:[s.jsx(Kp,{label:"Prix payé par le joueur",value:"15 €"}),s.jsx(Kp,{label:"Avantage food & drinks (vous)",value:"10 €",highlight:!0}),s.jsx(Kp,{label:"Frais plateforme & organisation",value:"5 €",subtle:!0})]})]}),s.jsxs("div",{className:"md:border-l md:border-border md:pl-8",children:[s.jsxs("h3",{className:"font-display text-xl font-semibold mb-4 flex items-center gap-2",children:[s.jsx(lu,{className:"w-5 h-5 text-primary"}),"Exemple : tournoi de 16 joueurs"]}),s.jsxs("ul",{className:"space-y-3 text-sm",children:[s.jsx(Kp,{label:"Reversement garanti minimum",value:"160 €"}),s.jsx(Kp,{label:"Conso réelle constatée*",value:"~ 220 €",subtle:!0}),s.jsx(Kp,{label:"Coût pour vous",value:"0 €",highlight:!0})]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-4",children:"* Les joueurs dépassent quasi systématiquement leur avantage inclus (deuxième verre, snack, ami qui les rejoint)."})]})]})})})]})})}),s.jsx("section",{className:"py-16 md:py-24 bg-card",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-4xl mx-auto",children:[s.jsx("div",{className:"text-center mb-10",children:s.jsx("h2",{className:"font-display text-3xl md:text-4xl font-bold text-foreground mb-4",children:"Ce qu'on fournit, ce qu'on vous demande"})}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"bg-background border border-border/50 rounded-2xl p-6",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[s.jsx(Ti,{className:"w-5 h-5 text-primary"}),s.jsx("h3",{className:"font-display text-lg font-semibold",children:"On s'occupe de"})]}),s.jsx("ul",{className:"space-y-2.5",children:["Plateforme d'inscription & paiement sécurisé","Communication & promotion de votre événement","Gestion des appariements (système suisse FIDE)","App tournoi en temps réel pour les joueurs","Arbitrage digital & gestion des scores","Reporting financier clair, reversements automatiques","Support joueur en direct"].map((e,t)=>s.jsxs("li",{className:"flex items-start gap-2 text-sm text-foreground",children:[s.jsx(Jr,{className:"w-4 h-4 text-primary flex-shrink-0 mt-0.5"}),s.jsx("span",{children:e})]},t))})]}),s.jsxs("div",{className:"bg-background border border-border/50 rounded-2xl p-6",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[s.jsx(gn,{className:"w-5 h-5 text-primary"}),s.jsx("h3",{className:"font-display text-lg font-semibold",children:"Vous fournissez"})]}),s.jsx("ul",{className:"space-y-2.5",children:["Un espace pour 8 à 24 joueurs (~4 à 12 tables)","Wifi correct (pour les téléphones des joueurs)","Quelques jeux d'échecs (sinon on peut en prêter)","Votre staff en service comme un soir normal","Le format de votre avantage food & drinks (crédit digital ou coupon papier — vous choisissez)","Une bonne ambiance ☕ 🍻"].map((e,t)=>s.jsxs("li",{className:"flex items-start gap-2 text-sm text-foreground",children:[s.jsx(Jr,{className:"w-4 h-4 text-primary flex-shrink-0 mt-0.5"}),s.jsx("span",{children:e})]},t))})]})]})]})})}),s.jsx("section",{className:"py-16 md:py-24",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-3xl mx-auto",children:[s.jsx("div",{className:"text-center mb-10",children:s.jsx("h2",{className:"font-display text-3xl md:text-4xl font-bold text-foreground mb-4",children:"Questions fréquentes"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx(Ah,{q:"Combien ça nous coûte ?",a:"Zéro. Pas d'abonnement, pas de frais d'installation, pas de minimum garanti à verser. Vous êtes payé en fonction des joueurs présents — pas l'inverse."}),s.jsx(Ah,{q:"Et si peu de joueurs s'inscrivent ?",a:"Si on n'atteint pas un seuil minimum (généralement 8 joueurs), on annule en accord avec vous, au moins 24h à l'avance. Aucun impact pour votre exploitation."}),s.jsx(Ah,{q:"Faut-il un staff dédié ?",a:"Non. Le tournoi est entièrement autonome côté gestion (appariements, scores, timer via notre app). V
1354otre staff sert comme un soir normal."}),s.jsx(Ah,{q:"On peut accueillir un tournoi à quelle fréquence ?",a:"On commence souvent par un format mensuel pour tester, puis on monte à bimensuel ou hebdo selon votre disponibilité et la demande locale."}),s.jsx(Ah,{q:"Comment se passe le paiement de la conso ?",a:"Chaque joueur paie 15€ en ligne. 10€ vous sont reversés par joueur présent (check-in QR), peu importe la conso réelle. Vous choisissez le format de cet avantage : crédit digital suivi dans l'app, ou simple coupon papier remis à l'arrivée. Tout ce que vos clients consomment au-delà des 10€ vous revient à 100%."}),s.jsx(Ah,{q:"Vous êtes présents physiquement le soir J ?",a:"Pour les premiers tournois, oui : on vient s'assurer que tout roule. Ensuite, vous êtes autonomes. Notre support reste joignable en direct toute la soirée si besoin."}),s.jsx(Ah,{q:"On est en région, vous travaillez avec nous ?",a:"Pour le moment, on se concentre sur Paris. Mais on prépare l'expansion : laissez-nous votre contact, on vous prévient dès qu'on arrive chez vous."})]})]})})}),s.jsx("section",{className:"py-16 md:py-24 bg-card",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-3xl mx-auto text-center bg-gradient-to-br from-primary/10 via-secondary to-secondary/30 rounded-2xl p-8 md:p-12 border border-primary/20",children:[s.jsx("h2",{className:"font-display text-3xl md:text-4xl font-bold text-foreground mb-4",children:"Prêt à accueillir votre premier tournoi ?"}),s.jsx("p",{className:"text-muted-foreground mb-8 max-w-xl mx-auto",children:"Inscrivez-vous en 2 minutes. On revient vers vous dans la foulée pour caler les détails et planifier votre premier événement."}),s.jsx("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:s.jsx(Pe,{to:Mz,children:s.jsxs(Q,{size:"lg",className:"w-full sm:w-auto gap-2 group shadow-lg shadow-primary/20",children:["Devenir partenaire",s.jsx(Sr,{className:"w-4 h-4 transition-transform group-hover:translate-x-1"})]})})})]})})}),s.jsx(Rl,{source:"footer-partners"})]})),__=({icon:e,value:t,label:n})=>s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center mx-auto mb-3",children:s.jsx(e,{className:"w-6 h-6 text-primary"})}),s.jsx("div",{className:"font-display text-2xl md:text-3xl font-bold text-foreground",children:t}),s.jsx("div",{className:"text-xs md:text-sm text-muted-foreground mt-1",children:n})]}),Gp=({icon:e,title:t,description:n})=>s.jsxs("div",{className:"p-6 rounded-xl bg-background border border-border/50 hover:border-primary/30 transition-colors",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center mb-4",children:s.jsx(e,{className:"w-6 h-6 text-primary"})}),s.jsx("h3",{className:"font-display text-lg font-semibold mb-2",children:t}),s.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:n})]}),Iy=({number:e,title:t,description:n})=>s.jsxs("div",{className:"flex gap-4 md:gap-6 items-start",children:[s.jsx("div",{className:"flex-shrink-0 w-10 h-10 md:w-12 md:h-12 rounded-full bg-primary text-primary-foreground font-display font-bold text-lg flex items-center justify-center shadow-lg shadow-primary/20",children:e}),s.jsxs("div",{className:"flex-1 pt-1",children:[s.jsx("h3",{className:"font-display text-lg font-semibold mb-1",children:t}),s.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:n})]})]}),Kp=({label:e,value:t,highlight:n,subtle:r})=>s.jsxs("li",{className:"flex items-baseline justify-between gap-3 pb-2 border-b border-border/50 last:border-0 last:pb-0",children:[s.jsx("span",{className:"text-muted-foreground",children:e}),s.jsx("span",{className:n?"font-display font-bold text-primary text-lg":r?"text-muted-foreground":"font-medium text-foreground",children:t})]}),Ah=({q:e,a:t})=>s.jsxs("details",{className:"group bg-card border border-border/50 rounded-xl p-5 transition-colors hover:border-primary/30",children:[s.jsxs("summary",{className:"cursor-pointer list-none flex items-center justify-between gap-4",children:[s.jsx("span",{className:"font-display font-semibold text-foreground",children:e}),s.jsx(Sr,{className:"w-4 h-4 text-muted-foreground transition-transform group-open:rotate-90 flex-shrink-0"})]}),s.jsx("p",{className:"text-sm text-muted-foreground mt-3 leading-relaxed",children:t})]}
1354),D6=({title:e,subtitle:t,version:n,updatedAt:r,metaDescription:i,children:a})=>(N.useEffect(()=>{const o=document.title;document.title=`${e} — Chess Agenda`;const l=document.querySelector('meta[name="description"]'),c=(l==null?void 0:l.getAttribute("content"))??"";return l&&l.setAttribute("content",i),()=>{document.title=o,l&&l.setAttribute("content",c)}},[e,i]),s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsxs("main",{className:"container mx-auto max-w-3xl px-4 py-10 md:py-16",children:[s.jsxs("header",{className:"mb-10",children:[s.jsx("h1",{className:"text-3xl md:text-4xl font-bold tracking-tight text-foreground",children:e}),t&&s.jsx("p",{className:"mt-3 text-base text-muted-foreground",children:t}),s.jsxs("p",{className:"mt-4 text-xs text-muted-foreground",children:["Version ",n," — En vigueur depuis le ",r,"."]})]}),s.jsx("article",{className:`
1355            text-foreground/90 leading-relaxed text-[15px]
1356            [&_h2]:text-xl [&_h2]:font-semibold [&_h2]:mt-10 [&_h2]:mb-3 [&_h2]:scroll-mt-24
1357            [&_h3]:text-base [&_h3]:font-semibold [&_h3]:mt-6 [&_h3]:mb-2
1358            [&_p]:my-3
1359            [&_ul]:my-3 [&_ul]:pl-5 [&_ul]:list-disc [&_ul]:space-y-1
1360            [&_ol]:my-3 [&_ol]:pl-5 [&_ol]:list-decimal [&_ol]:space-y-1
1361            [&_a]:text-primary [&_a]:underline [&_a]:underline-offset-2
1362            [&_strong]:text-foreground
1363          `,children:a}),s.jsxs("footer",{className:"mt-16 pt-8 border-t border-border text-sm text-muted-foreground flex flex-wrap gap-4 justify-between",children:[s.jsx(Pe,{to:"/cgu",className:"hover:text-foreground transition-colors",children:"Conditions d'utilisation"}),s.jsx(Pe,{to:"/confidentialite",className:"hover:text-foreground transition-colors",children:"Politique de confidentialité"}),s.jsx(Pe,{to:"/",className:"hover:text-foreground transition-colors",children:"Retour à l'accueil"})]})]})]})),jn={companyName:"[À COMPLÉTER : raison sociale, ex. Chess Agenda SAS]",legalForm:"[À COMPLÉTER : forme juridique, ex. SAS]",capital:"[À COMPLÉTER : capital social, ex. 1 000 €]",rcs:"[À COMPLÉTER : RCS Paris 000 000 000]",siret:"[À COMPLÉTER : 000 000 000 00000]",vatNumber:"[À COMPLÉTER : FR00 000000000]",headOffice:"[À COMPLÉTER : adresse postale du siège]",publicationDirector:"[À COMPLÉTER : nom du directeur de la publication]",contactEmail:"[email protected]",supportEmail:"[email protected]",dpoEmail:"[email protected]",hostName:"Supabase Inc.",hostAddress:"970 Toa Payoh North #07-04, Singapore 318992",hostWebsite:"https://supabase.com",subprocessors:[{name:"Supabase Inc.",purpose:"Hébergement, base de données, authentification",location:"UE (Frankfurt) / clauses contractuelles types"},{name:"Stripe Payments Europe Ltd.",purpose:"Traitement des paiements",location:"Irlande (UE)"},{name:"Google LLC",purpose:"Authentification OAuth (optionnelle)",location:"États-Unis / DPF"},{name:"Resend / SMTP transactionnel",purpose:"Envoi d'emails transactionnels",location:"UE / DPF"}],brand:"Chess Agenda",websiteUrl:"https://chessagenda.com",termsVersion:"1.0",termsUpdatedAt:"2 mai 2026",privacyVersion:"1.0",privacyUpdatedAt:"2 mai 2026"},NVe=()=>s.jsxs(D6,{title:"Conditions générales d'utilisation",subtitle:`Plateforme ${jn.brand} — Tournois d'échecs en lieux partenaires`,version:jn.termsVersion,updatedAt:jn.termsUpdatedAt,metaDescription:`Conditions générales d'utilisation de ${jn.brand} : inscription, billetterie, crédit consommation, remboursement, responsabilité.`,children:[s.jsxs("p",{children:["Les présentes Conditions Générales d'Utilisation (ci-après les « ",s.jsx("strong",{children:"CGU"})," ») régissent l'accès et l'utilisation de la plateforme ",jn.brand," (ci-après la « ",s.jsx("strong",{children:"Plateforme"})," »), accessible à l'adresse ",s.jsx("a",{href:jn.websiteUrl,children:jn.websiteUrl}),", éditée par ",jn.companyName," (",jn.legalForm," au capital de"," ",jn.capital,", immatriculée au ",jn.rcs,", SIRET ",jn.siret,", TVA ",jn.vatNumber,", dont le siège social est situé"," ",jn.headOffice," ; ci-après « ",s.jsx("strong",{children:"l'Éditeur"})," » ou « ",s.jsx("strong",{children:"nous"})," »)."]}),s.jsx("p",{children:"Toute utilisation de la Plateforme implique l'acceptation pleine et entière des présentes CGU. Si vous n'y consentez pas, vous devez renoncer à utiliser la Plateforme."}),s.jsx("h2",{id:"article-1",children:"1. Mentions légales et hébergement"}),s.jsxs("p",{children:["Directeur de la publication : ",jn.publicationDirector,"."]}),s.jsxs("p",{children:["Hébergeur : ",jn.hostName,", ",jn.hostAddress," —"," ",s.jsx("a",{href:jn.hostWebsite,target:"_blank",rel:"noopener noreferrer",children:jn.hostWebsite}),"."]}),s.jsxs("p",{children:["Contact : ",s.jsx("a",{href:`mailto:${jn.contactEmail}`,children:jn.contactEmail}),"."]}),s.jsx("h2",{id:"article-2",children:"2. Définitions"}),s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Utilisateur"})," : toute personne physique majeure utilisant la Plateforme, en qualité de Joueur ou de représentant d'un Lieu partenaire."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Joueur"})," : Utilisateur s'inscrivant à un Tournoi en tant que participant."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Lieu partenaire"})," ou « Bar » : établissement physique accueillant un Tournoi."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Tournoi"})," ou « Événement » : événement de jeu d'échecs organisé dans un Lieu partenaire et référencé sur la Plateforme."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Ticket"})," : titre nominatif d'accès à un Tournoi, incluant un Crédit consommation."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Crédit consommation"})," : montant prépayé inclus dans le Ticket, utilisable exclusivement sur les produits éligibles du Lieu, le jour de l'Événement."]})]}),s.jsx("h2",{id:"article-3",children:"3. Objet"}),s.jsx("p",{children:"La Plateforme propose un service de mise en relation entre Joueurs et Lieux partenaires pour la découverte, l'inscription, l'organisation et le suivi de Tournois d'échecs en présentiel. Elle assure la billetterie en ligne et la gestion logistique des événements (appariements, scores, classements)."}),s.jsxs("p",{children:["L'Éditeur agit en qualité d'",s.jsx("strong",{children:"intermédiaire technique"})," et, s'agissant de la billetterie, en qualité de ",s.jsx("strong",{children:"mandataire encaisseur"})," ","des Lieux partenaires. Sauf mention expresse contraire, l'Éditeur n'est pas l'organisateur juridique du Tournoi : la responsabilité opérationnelle de l'événement (sécurité, hygiène, accueil, conformité ERP) incombe au Lieu partenaire."]}),s.jsx("h2",{id:"article-4",children:"4. Acceptation et modification des CGU"}),s.jsx("p",{children:"L'Utilisateur accepte les CGU lors de la création de son compte ou, à défaut, lors de toute utilisation de la Plateforme. L'Éditeur se réserve le droit de modifier les CGU à tout moment. Les CGU applicables sont celles en vigueur à la date d'utilisation. En cas de modification substantielle, l'Utilisateur en sera informé par email ou par notification ; la poursuite de l'utilisation vaut acceptation des nouvelles CGU."}),s.jsx("h2",{id:"article-5",children:"5. Inscription, compte et identification"}),s.jsx("p",{children:"L'inscription est réservée aux personnes physiques âgées de 16 ans révolus, capables juridiquement. L'Utilisateur garantit l'exactitude et l'actualité des informations fournies. Il est seul responsable de la confidentialité de ses identifiants et de toute activité réalisée depuis son compte."}),s.jsx("p",{children:"L'Éditeur se réserve le droit de refuser, suspendre ou supprimer un compte en cas de fausse déclaration, d'usurpation d'identité, de violation des CGU ou de comportement contraire à l'ordre public."}),s.jsx("h2",{id:"article-6",children:"6. Description des services"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Découverte des Tournois (carte, recherche, filtres)."}),s.jsx("li",{children:"Inscription et paiement en ligne d'un Ticket."}),s.jsx("li",{children:"Émission d'un titre d'accès numérique (QR code)."}),s.jsx("li",{children:"Suivi en direct du Tournoi (appariements, horloges, scores)."}),s.jsx("li",{children:"Historique de performance et système de classement interne (Elo simplifié)."})]}),s.jsx("p",{children:"La Plateforme est fournie « en l'état » et est susceptible d'évoluer. L'Éditeur peut, à tout moment et sans préavis, ajouter, modifier ou retirer une fonctionnalité, sans que cela n'ouvre droit à indemnité."}),s.jsx("h2",{id:"article-7",children:"7. Tarifs, paiement et facturation"}),s.jsx("p",{children:"Les prix sont indiqués en euros, toutes taxes comprises (TTC). Le paiement est exclusivement réalisé en ligne, via le prestataire Stripe. La Plateforme ne stocke aucune donnée de carte bancaire."}),s.jsx("p",{children:"Le paiement est encaissé par l'Éditeur en qualité de mandataire encaisseur du Lieu partenaire. Une facture nominative est mise à disposition de l'Utilisateur après paiement."}),s.jsx("h2",{id:"article-8",children:"8. Crédit consommation — règles essentielles"}),s.jsx("p",{children:"Chaque Ticket inclut un Crédit consommation (par défaut 10 €) utilisable selon les règles cumulatives suivantes :"}),s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Utilisable uniquement le jour de l'Événement"})," et dans le Lieu partenaire concerné."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Limité aux produits éligibles"})," figurant au catalogue déclaré par le Lieu (boissons et/ou collations)."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Non remboursable"}
1363),", non échangeable, non convertible en espèces et ",s.jsx("strong",{children:"non reportable"})," sur un autre événement ou un autre Lieu."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Perdu s'il n'est pas consommé"})," avant la fin de l'Événement."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Le dépassement"})," du Crédit est réglé directement au Lieu partenaire selon ses moyens de paiement habituels, en dehors de la Plateforme."]})]}),s.jsx("h2",{id:"article-9",children:"9. Annulation et remboursement"}),s.jsxs("p",{children:[s.jsx("strong",{children:"Renonciation au droit de rétractation."})," Conformément à l'article L.221-28 12° du Code de la consommation, le droit de rétractation ne s'applique pas aux prestations de services de loisirs fournies à une date déterminée. L'Utilisateur reconnaît expressément renoncer à ce droit lors de l'achat."]}),s.jsx("p",{children:"À titre commercial, l'Éditeur applique néanmoins la politique d'annulation suivante :"}),s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Annulation par l'Utilisateur plus de 12 heures avant le début"})," : remboursement intégral du Ticket."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Annulation par l'Utilisateur moins de 12 heures avant le début"})," ",": pas de remboursement monétaire ; un avoir équivalent au Crédit consommation peut être généré, à la discrétion de l'Éditeur."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Annulation par l'Éditeur ou le Lieu"})," (force majeure, quorum non atteint, fermeture administrative) : remboursement intégral du Ticket. Aucune autre indemnité n'est due."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Absence injustifiée (no-show)"})," : aucun remboursement."]})]}),s.jsx("h2",{id:"article-10",children:"10. Obligations et fair-play"}),s.jsx("p",{children:"L'Utilisateur s'engage à :"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Respecter les règles du jeu, l'arbitrage, les autres Joueurs et le personnel du Lieu."}),s.jsx("li",{children:"S'abstenir de toute fraude, triche, collusion, dopage informatique (assistance par moteur d'échecs), comportement violent, discriminatoire, harcelant ou contraire à l'ordre public."}),s.jsx("li",{children:"Ne pas perturber le déroulement de l'Événement ni détériorer les biens du Lieu."}),s.jsx("li",{children:"Respecter la législation applicable (notamment alcool, fumée, mineurs)."})]}),s.jsx("p",{children:"Tout manquement peut entraîner, sans préavis ni indemnité : exclusion immédiate de l'Événement, annulation de scores, retrait de points de classement, suspension ou suppression du compte, et signalement aux autorités compétentes."}),s.jsx("h2",{id:"article-11",children:"11. Propriété intellectuelle"}),s.jsx("p",{children:"La Plateforme, sa marque, ses logos, son code, ses interfaces, ses bases de données, ses contenus éditoriaux et son système d'appariements sont la propriété exclusive de l'Éditeur et sont protégés par le droit de la propriété intellectuelle. Toute reproduction, représentation, extraction substantielle, rétro-ingénierie ou exploitation non autorisée est strictement interdite."}),s.jsx("p",{children:"En publiant un contenu sur la Plateforme (pseudo, photo, commentaire), l'Utilisateur concède à l'Éditeur une licence non exclusive, gratuite, mondiale et pour la durée légale de protection, d'utiliser, reproduire, adapter, traduire et diffuser ce contenu dans le cadre de l'exploitation et de la promotion de la Plateforme et des Tournois."}),s.jsx("h2",{id:"article-12",children:"12. Données personnelles"}),s.jsxs("p",{children:["Les conditions de traitement des données personnelles sont décrites dans la"," ",s.jsx("a",{href:"/confidentialite",children:"Politique de confidentialité"}),", qui fait partie intégrante des présentes CGU."]}),s.jsx("h2",{id:"article-13",children:"13. Disponibilité et limitation de responsabilité"}),s.jsx("p",{children:"L'Éditeur fait ses meilleurs efforts pour assurer la disponibilité de la Plateforme mais ne souscrit qu'à une obligation de moyens. La Plateforme peut être indisponible pour maintenance, mise à jour ou pour toute cause technique indépendante de la volonté de l'Éditeur, sans que cela n'ouvre droit à indemnité."}),s.jsx("p",{children:"Dans toute la mesure permise par la loi, l'Éditeur n'est pas responsable :"}),s.jsxs("ul",{children:[s.jsx("li",{children:"des dommages indirects, immatériels ou de la perte de chance ;"}),s.jsx("li",{children:"des conséquences de l'inexécution ou de la mauvaise exécution par un Lieu partenaire (qualité des produits, accueil, sécurité du local, vol ou détérioration d'effets personnels, dommage corporel survenant dans le Lieu) ;"}),s.jsx("li",{children:"des litiges entre Joueurs ou entre un Joueur et un Lieu ;"}),s.jsx("li",{children:"des cas de force majeure au sens de l'article 1218 du Code civil ;"}),s.jsx("li",{children:"de la véracité des informations déclarées par l'Utilisateur (Elo, identité, performances)."})]}),s.jsx("p",{children:"En tout état de cause, et sauf faute lourde ou dol, la responsabilité totale de l'Éditeur envers un Utilisateur, toutes causes confondues, est limitée au montant effectivement payé par cet Utilisateur sur la Plateforme au cours des douze (12) mois précédant le fait générateur."}),s.jsx("h2",{id:"article-14",children:"14. Suspension et résiliation"}),s.jsxs("p",{children:["L'Utilisateur peut clôturer son compte à tout moment depuis son espace personnel ou en écrivant à ",s.jsx("a",{href:`mailto:${jn.supportEmail}`,children:jn.supportEmail}),". L'Éditeur peut suspendre ou résilier de plein droit, sans préavis ni indemnité, l'accès d'un Utilisateur en cas de manquement aux CGU, de comportement manifestement illicite, ou de risque pour la Plateforme ou les autres Utilisateurs."]}),s.jsx("h2",{id:"article-15",children:"15. Modération et signalement"}),s.jsxs("p",{children:["Tout contenu illicite peut être signalé à"," ",s.jsx("a",{href:`mailto:${jn.contactEmail}`,children:jn.contactEmail}),". L'Éditeur s'engage à examiner les signalements dans un délai raisonnable et à retirer promptement les contenus manifestement illicites au sens de la législation française et européenne (LCEN, DSA)."]}),s.jsx("h2",{id:"article-16",children:"16. Droit applicable et juridiction compétente"}
1363),s.jsx("p",{children:"Les présentes CGU sont régies par le droit français. À défaut de résolution amiable, et conformément à l'article L.616-1 du Code de la consommation, le consommateur peut recourir gratuitement à un médiateur de la consommation. À défaut de résolution, tout litige sera soumis aux tribunaux compétents du ressort de la Cour d'appel de Paris, sous réserve des règles d'ordre public protectrices du consommateur lui permettant de saisir la juridiction du lieu de son domicile."})]}),kVe=()=>s.jsxs(D6,{title:"Politique de confidentialité",subtitle:"Traitement de vos données personnelles — RGPD",version:jn.privacyVersion,updatedAt:jn.privacyUpdatedAt,metaDescription:`Politique de confidentialité ${jn.brand} : finalités, bases légales, durées de conservation, droits RGPD.`,children:[s.jsxs("p",{children:["La présente politique décrit comment ",jn.companyName," (« ",s.jsx("strong",{children:"nous"})," ») collecte et traite les données personnelles des utilisateurs de la plateforme"," ",jn.brand,", en conformité avec le Règlement (UE) 2016/679 (« ",s.jsx("strong",{children:"RGPD"})," ») et la loi française « Informatique et Libertés »."]}),s.jsx("h2",{id:"article-1",children:"1. Responsable de traitement"}),s.jsxs("p",{children:[jn.companyName," — ",jn.headOffice," — SIRET ",jn.siret,"."]}),s.jsxs("p",{children:["Délégué à la protection des données (DPO) :"," ",s.jsx("a",{href:`mailto:${jn.dpoEmail}`,children:jn.dpoEmail}),"."]}),s.jsx("h2",{id:"article-2",children:"2. Données collectées"}),s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Données de compte"})," : email, mot de passe (haché), prénom, nom, pseudo, photo de profil (optionnelle)."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Données de profil joueur"})," : niveau auto-déclaré, identifiants fédéraux (FFE/FIDE) et Elo officiel si vous choisissez de les renseigner."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Données de jeu"})," : participation aux tournois, scores, appariements, classement interne, badges."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Données de paiement"})," : montant, date, identifiant de transaction Stripe (les données bancaires elles-mêmes ne transitent jamais par nos serveurs)."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Données techniques"})," : journaux de connexion, adresse IP, identifiant de session, appareil et navigateur."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Données de communication"})," : emails transactionnels, signalements et échanges avec le support."]})]}),s.jsx("h2",{id:"article-3",children:"3. Finalités et bases légales"}),s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Création et gestion du compte"})," — exécution du contrat (art. 6.1.b RGPD)."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Billetterie, paiement, gestion des tournois"})," — exécution du contrat."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Émission de factures et obligations comptables"})," — obligation légale (art. 6.1.c)."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Sécurité, prévention de la fraude, lutte contre la triche"})," — intérêt légitime (art. 6.1.f)."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Statistiques internes et amélioration du service"})," — intérêt légitime, données agrégées."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Communications transactionnelles"})," (confirmation, rappels d'événement) — exécution du contrat."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Newsletter ou communications promotionnelles"})," — consentement préalable, révocable à tout moment."]})]}),s.jsx("h2",{id:"article-4",children:"4. Destinataires et sous-traitants"}),s.jsx("p",{children:"Vos données sont accessibles aux personnels habilités de l'Éditeur et, dans la limite stricte de leurs missions, aux Lieux partenaires (uniquement nom, prénom et statut de check-in pour l'accueil sur place). Elles peuvent également être traitées par les s
1363ous-traitants suivants, encadrés par un contrat de sous-traitance conforme à l'article 28 RGPD :"}),s.jsx("ul",{children:jn.subprocessors.map(e=>s.jsxs("li",{children:[s.jsx("strong",{children:e.name})," — ",e.purpose," (",e.location,")."]},e.name))}),s.jsx("h2",{id:"article-5",children:"5. Transferts hors Union européenne"}),s.jsx("p",{children:"Lorsque certains traitements impliquent un transfert hors UE (notamment pour l'authentification Google), ils sont encadrés par les Clauses Contractuelles Types adoptées par la Commission européenne et, le cas échéant, par l'adéquation accordée au titre du Data Privacy Framework (DPF)."}),s.jsx("h2",{id:"article-6",children:"6. Durées de conservation"}),s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Compte actif"})," : pendant toute la durée d'utilisation du service."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Compte inactif"})," : suppression ou anonymisation au-delà de 3 ans sans connexion."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Données de facturation"})," : 10 ans (obligation légale comptable)."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Journaux techniques et de sécurité"})," : 12 mois maximum."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Données de jeu"})," : conservées sous forme anonymisée pour les classements historiques."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Données marketing"})," : 3 ans à compter du dernier contact actif."]})]}),s.jsx("h2",{id:"article-7",children:"7. Cookies et traceurs"}),s.jsxs("p",{children:["La Plateforme utilise uniquement des cookies ",s.jsx("strong",{children:"strictement nécessaires"}),"au fonctionnement du service (session d'authentification, préférences d'affichage). Ces cookies sont exemptés de consentement préalable au sens de l'article 82 de la loi Informatique et Libertés. Aucun cookie publicitaire ou de tracking tiers n'est déposé en l'état actuel du service."]}),s.jsx("h2",{id:"article-8",children:"8. Sécurité"}),s.jsx("p",{children:"Nous mettons en œuvre des mesures techniques et organisationnelles appropriées pour protéger vos données : chiffrement en transit (TLS), chiffrement au repos, contrôles d'accès stricts (Row-Level Security), journalisation des actions sensibles (audit trail), revues de sécurité régulières, et politique du moindre privilège pour les sous-traitants."}),s.jsx("h2",{id:"article-9",children:"9. Vos droits"}),s.jsx("p",{children:"Conformément aux articles 15 à 22 du RGPD, vous disposez des droits suivants :"}),s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Accès"})," à vos données et à leurs caractéristiques de traitement."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Rectification"})," des données inexactes ou incomplètes."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Effacement"})," (« droit à l'oubli »), sous réserve des obligations légales de conservation."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Opposition"})," au traitement fondé sur l'intérêt légitime."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Limitation"})," du traitement."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Portabilité"})," de vos données fournies, dans un format structuré et lisible par machine."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Retrait du consentement"})," à tout moment, pour les traitements fondés sur celui-ci."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Directives post-mortem"})," (article 85 LIL) sur le sort de vos données après votre décès."]})]}),s.jsxs("p",{children:["Pour exercer ces droits, écrivez à"," ",s.jsx("a",{href:`mailto:${jn.dpoEmail}`,children:jn.dpoEmail})," en joignant un justificatif d'identité si nécessaire. Une réponse vous sera apportée dans un délai maximum d'un mois."]}),s.jsx("h2",{id:"article-10",children:"10. Réclamation auprès de la CNIL"}),s.jsxs("p",{children:["Si vous estimez que vos droits ne sont pas respectés, vous pouvez introduire une réclamation auprès de la Commission Nationale de l'Informatique et des Libertés (CNIL) — 3 place de Fontenoy, TSA 80715, 75334 Paris Cedex 07 —"," ",s.jsx("a",{href:"https://www.cnil.fr",target:"_blank",rel:"noopener noreferrer",children:"www.cnil.fr"}),"."]}),s.jsx("h2",{id:"article-11",children:"11. Mineurs"}),s.jsxs("p",{children:["La Plateforme n'est pas destinée aux personnes de moins de 16 ans. Aucune inscription n'est sciemment acceptée en deçà de cet âge. Si vous constatez qu'un compte a été cr
1363éé par un mineur, signalez-le à"," ",s.jsx("a",{href:`mailto:${jn.dpoEmail}`,children:jn.dpoEmail})," : nous procéderons à sa suppression sans délai."]}),s.jsx("h2",{id:"article-12",children:"12. Modifications"}),s.jsx("p",{children:"La présente politique peut évoluer. La version applicable est celle en vigueur au jour de votre utilisation. Toute modification substantielle vous sera notifiée par email ou via la Plateforme."})]});function CVe(){return s.jsxs(D6,{title:"Photos & droit à l'image",subtitle:"Comment fonctionne la galerie de tournoi et vos droits.",version:"1.0",updatedAt:"13 juillet 2026",metaDescription:"Politique de gestion des photos de tournoi Chess Agenda : galerie privée réservée aux participants, retrait à la demande, RGPD.",children:[s.jsx("h2",{children:"1. Finalité"}),s.jsx("p",{children:"Chess Agenda propose à chaque participant d'un tournoi une galerie photo privée dédiée à l'événement. L'objectif est de conserver et de partager entre participants les souvenirs de la soirée."}),s.jsx("h2",{children:"2. Qui peut voir les photos ?"}),s.jsxs("p",{children:["La galerie d'un tournoi est ",s.jsx("strong",{children:"strictement réservée aux personnes ayant fait le check-in à ce tournoi"}),", ainsi qu'à l'équipe du lieu d'accueil et à l'administration de Chess Agenda. Aucune photo n'est publiée publiquement par la plateforme."]}),s.jsxs("p",{children:["Un partage externe (WhatsApp, Instagram, TikTok, LinkedIn, etc.) est possible mais reste un ",s.jsx("strong",{children:"acte volontaire de l'utilisateur"}),", qui en assume la responsabilité."]}),s.jsx("h2",{children:"3. Base légale (RGPD)"}),s.jsxs("p",{children:["Le traitement repose sur l'",s.jsx("strong",{children:"intérêt légitime"})," de la communauté de tournoi à conserver et partager des souvenirs de l'événement, dans un cercle restreint et identifié, assorti d'un mécanisme de retrait immédiat."]}),s.jsx("h2",{children:"4. Droit à l'image — retrait immédiat"}),s.jsxs("p",{children:["Si vous apparaissez sur une photo et souhaitez son retrait, utilisez le bouton",s.jsx("strong",{children:" « Signaler »"})," présent sur chaque photo. Un signalement pour « droit à l'image » ",s.jsx("strong",{children:"masque immédiatement"})," la photo en attendant sa modération par notre équipe (traitement sous 24 heures ouvrées)."]}),s.jsxs("p",{children:["Vous pouvez également nous contacter à"," ",s.jsx("a",{href:"mailto:[email protected]",children:"[email protected]"}),"."]}),s.jsx("h2",{children:"5. Métadonnées & sécurité"}),s.jsxs("ul",{children:[s.jsxs("li",{children:["Les métadonnées EXIF (dont la géolocalisation) sont ",s.jsx("strong",{children:"automatiquement supprimées"})," à l'envoi."]}),s.jsx("li",{children:"Les fichiers sont stockés dans un espace privé et accessibles uniquement via des liens signés à durée limitée."}),s.jsx("li",{children:"Aucune reconnaissance faciale ni tagging automatique n'est utilisé."})]}),s.jsx("h2",{children:"6. Durée de conservation"}),s.jsxs("p",{children:["Les photos sont conservées ",s.jsx("strong",{children:"2 ans"})," après la date de l'événement, sauf demande de retrait anticipé. Passé ce délai, elles sont supprimées automatiquement."]}),s.jsx("h2",{children:"7. Vos droits"}),s.jsxs("p",{children:["Conformément au RGPD, vous disposez d'un droit d'accès, de rectification, d'effacement, d'opposition, à la limitation du traitement et à la portabilité. Contactez"," ",s.jsx("a",{href:"mailto:[email protected]",children:"[email protected]"}),"."]}),s.jsx("h2",{children:"8. Engagement des personnes qui publient"}),s.jsx("p",{children:"En publiant une photo, chaque contributeur certifie disposer des droits nécessaires (droit d'auteur, autorisations des personnes visibles lorsque requis) et accepte qu'elle soit visible par les autres participants du tournoi."})]})}const EVe="/hero-odeon-nuit.png",SVe=da({firstName:Ct().trim().min(1,"Prénom requis").max(80),lastName:Ct().trim().min(1,"Nom requis").max(80),email:Ct().trim().email("Email invalide").max(255)}),P4="#F5F3EE",j_="#0D0D0D",Th="#AAFF00",Ry="7ae66c35-44fb-4c4e-85d2-91b57a1bd196",AVe="https://panllzgwiadaxweewisk.supabase.co/storage/v1/object/public/venue-assets/474a60ba-0f1f-4f5d-b6e5-687b907f7e22/logo.png?v=1777914558323",TVe="https://panllzgwiadaxweewisk.supabase.co/storage/v1/object/public/venue-assets/474a60ba-0f1f-4f5d-b6e5-687b907f7e22/cover.jpg?v=1777914488356";function PVe(){const[e,t]=N.useState({firstName:"",lastName:"",email:""}),[n,r]=N.useState({}),[i,a]=N.useState(!1),[o,l]=N.useState(!1),c=N.useRef(null),u=()=>{var h;
1363return(h=c.current)==null?void 0:h.scrollIntoView({behavior:"smooth",block:"center"})},d=async h=>{h.preventDefault();const p=SVe.safeParse(e);if(!p.success){const w={};p.error.issues.forEach(_=>{const j=_.path[0];w[j]=_.message}),r(w);return}r({}),a(!0);const{data:x,error:y}=await re.functions.invoke("landing-preregister",{body:{eventId:Ry,firstName:p.data.firstName,lastName:p.data.lastName,email:p.data.email,source:"landing-tournoi-odeon"}});if(a(!1),y||x!=null&&x.error){console.error("landing-preregister failed",y??x),je.error("Impossible d'enregistrer votre pré-inscription",{description:"Réessayez dans un instant."});return}l(!0),t({firstName:"",lastName:"",email:""});const b=x==null?void 0:x.alreadyRegistered;if(!b)try{const{trackMetaEvent:w}=await ka(async()=>{const{trackMetaEvent:_}=await Promise.resolve().then(()=>uh);return{trackMetaEvent:_}},void 0);w("Lead",{userData:{email:p.data.email,first_name:p.data.firstName,last_name:p.data.lastName},customData:{content_ids:[Ry],content_type:"event",content_name:"landing-tournoi-odeon"}})}catch{}je.success(b?"Tu es déjà pré-inscrit.":"Place bloquée pour le 27 mai",{description:b?"On te recontacte dès l'ouverture du paiement.":"Vérifie ta boîte mail — on t'a envoyé une confirmation."})},f=()=>{l(!1),r({}),t({firstName:"",lastName:"",email:""}),setTimeout(()=>u(),50)};return s.jsxs("div",{style:{backgroundColor:"#ffffff",color:j_},className:"min-h-screen w-full",children:[s.jsx("section",{className:"relative overflow-hidden",children:s.jsxs("div",{className:"relative min-h-[640px] sm:min-h-[calc(100svh-72px)] flex flex-col",children:[s.jsx("img",{src:EVe,alt:"Joueurs d'échecs en plein tournoi à la tombée de la nuit, Place de l'Odéon",className:"absolute inset-0 w-full h-full object-cover scale-105",width:1200,height:1500,style:{filter:"contrast(1.32) saturate(0.78) brightness(0.62) sepia(0.18) blur(2.5px)"},loading:"eager",decoding:"async",fetchPriority:"high"}),s.jsx("div",{className:"absolute inset-0 pointer-events-none mix-blend-screen",style:{background:"radial-gradient(ellipse 75% 60% at 72% 15%, rgba(255,176,68,0.75) 0%, rgba(255,140,40,0.30) 30%, rgba(0,0,0,0) 65%), radial-gradient(ellipse 50% 40% at 25% 25%, rgba(255,200,120,0.25) 0%, rgba(0,0,0,0) 60%)"}}),s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"radial-gradient(ellipse 95% 70% at 50% 50%, rgba(0,0,0,0) 30%, rgba(0,0,0,0.75) 100%), linear-gradient(180deg, rgba(13,13,13,0.55) 0%, rgba(13,13,13,0.20) 35%, rgba(13,13,13,0.25) 60%, rgba(13,13,13,0.92) 92%, #ffffff 100%)"}}),s.jsx("div",{className:"absolute inset-0 pointer-events-none mix-blend-color opacity-40",style:{background:"linear-gradient(135deg, rgba(20,40,60,0.6) 0%, rgba(0,0,0,0) 45%, rgba(0,0,0,0) 55%, rgba(120,70,20,0.55) 100%)"}}),s.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.28] mix-blend-overlay",style:{backgroundImage:`url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.85 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>")`,backgroundSize:"200px 200px"}}),s.jsx("header",{className:"relative z-20 px-5 sm:px-8 pt-5 sm:pt-8",children:s.jsx(vc,{size:"sm",variant:"inverse"})}),s.jsx("div",{className:"relative z-10 flex-1 flex items-center justify-center px-5 sm:px-8 pt-12 pb-20 sm:pt-16 sm:pb-28",children:s.jsxs("div",{className:"w-full max-w-4xl text-center",style:{color:P4},children:[s.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full px-4 py-2 mb-8 sm:mb-10 border",style:{backgroundColor:"transparent",borderColor:"rgba(245,243,238,0.25)",backdropFilter:"blur(6px)",fontFamily:"'Fragment Mono', ui-monospace, monospace",fontSize:"12px",letterSpacing:"0.08em"},children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full animate-pulse",style:{background:Th}}),"Mer 27 mai • 20h"]}),s.jsx("h1",{className:"font-black lowercase leading-[0.92] tracking-[-0.02em] text-balance",style:{fontFamily:"'Bricolage Grotesque', sans-serif",fontWeight:900,fontSize:"clamp(2.5rem, 11vw, 7rem)",textShadow:"0 2px 40px rgba(0,0,0,0.5)"},children:"tournoi odéon"}),s.jsxs("p",{className:"mt-3 italic",style:{fontFamily:"'Playfair Display', serif",fontSize:"clamp(1.25rem, 4vw, 2.25rem)",fontWeight:400,textShadow:"0 2px 30px rgba(0,0,0,0.5)"},children:["on joue aux échecs",s.jsx("span",{style:{color:Th},children:"."})]}),s.jsx("p",{className:"mt-3 text-sm sm:text-base",style:{fontFamily:"'Space Grotesk', system-ui, sans-serif",color:"rgba(245,243,238,0.8)"},children:"Boisson incluse • Tous niveaux."}),s.jsxs("div",{className:"mt-10 sm:mt-12 flex flex-col sm:flex-row items-center justify-center gap-3 sm:gap-5",children:[s.jsxs("div",{className:"relative flex items-center",children:[s.jsx("div",{className:"aspect-square h-12 w-12 sm:h-16 sm:w-16 rounded-full bg-white/30 backdrop-blur-sm flex items-center justify-center overflow-hidden ring-1 ring-black/10",style:{marginRight:"-16px"},children:s.jsx("img",{src:AVe,alt:"",className:"w-full h-full object-cover"})}),s.jsx("div",{className:"aspect-square h-14 w-14 sm:h-[72px] sm:w-[72px] rounded-full bg-white/30 backdrop-blur-sm flex items-center justify-center overflow-hidden ring-1 ring-black/10 relative z-10",children:s.jsx("img",{src:TVe,alt:"",className:"w-full h-full object-cover"})})]}),s.jsxs("div",{className:"text-center sm:text-left leading-tight",children:[s.jsx("div",{className:"text-sm sm:text-base",style:{fontFamily:"'Space Grotesk', system-ui, sans-serif",color:"rgba(245,243,238,0.7)"},children:"Ici, déjà presque"}),s.jsx("div",{className:"font-black text-xl sm:text-3xl",style:{fontFamily:"'Bricolage Grotesque', sans-serif",fontWeight:900,color:P4,lineHeight:1.05},children:"100 participations"})]})]}),s.jsxs("div",{className:"mt-10 sm:mt-12 flex flex-col sm:flex-row gap-3 sm:gap-4 justify-center items-stretch sm:items-center",children:[s.jsx("a",{href:`/events/${Ry}`,className:"w-full sm:w-auto",children:s.jsxs("button",{className:"inline-flex items-center justify-center gap-2 w-full sm:w-auto px-8 sm:px-10 py-4 sm:py-5 rounded-full font-semibold text-base transition-transform hover:-translate-y-0.5 shadow-xl",style:{backgroundColor:Th,color:j_,fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:[s.jsx("span",{children:"♟"})," Je réserve ma place"]})}),s.jsxs("button",{onClick:u,className:"inline-flex items-center justify-center gap-2 w-full sm:w-auto px-8 sm:px-10 py-4 sm:py-5 rounded-full font-semibold text-base border transition-transform hover:-translate-y-0.5 backdrop-blur-md",style:{borderColor:"rgba(245,243,238,0.35)",color:P4,backgroundColor:"rgba(13,13,13,0.35)",fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:[s.jsx("span",{children:"🤔"})," Pas sûr·e ? Je me pré-inscris"]})]}),s.jsx("p",{className:"mt-4 text-[11px] sm:text-xs",style:{fontFamily:"'Fragment Mono', ui-monospace, monospace",color:"rgba(245,243,238,0.65)",letterSpacing:"0.08em"},children:"Paiement sécurisé · 16€ boisson incluse · annulation gratuite"})]})})]})}),s.jsxs("section",{id:"infos",className:"mx-auto max-w-6xl px-5 py-14 sm:py-20 lg:py-28",children:[s.jsxs("div",{className:"text-[11px] uppercase tracking-[0.22em] text-[#0d0d0d]/60 mb-4 inline-flex items-center gap-2",style:{fontFamily:"'Fragment Mono', ui-monospace, monospace"},children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{background:Th}}),"PROCHAIN TOURNOI D'ECHECS"]}),s.jsxs("div",{className:"grid gap-8 lg:gap-10 lg:grid-cols-[1.5fr_minmax(260px,340px)]",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"font-black leading-[0.95] tracking-tight",style:{fontFamily:"'Bricolage Grotesque', sans-serif",fontSize:"clamp(40px, 9vw, 88px)",fontWeight:900},children:"Tournoi Odéon"}),s.jsx("div",{className:"mt-4 inline-flex items-center rounded-full border border-[#0d0d0d]/15 px-4 py-1.5",children:s.jsxs("span",{className:"text-sm",style:{fontFamily:"'Fragment Mono', ui-monospace, monospace"},children:["Paris 6",s.jsx("sup",{children:"e"})]})}),s.jsx("p",{className:"mt-6 sm:mt-8 max-w-md text-base sm:text-lg leading-relaxed whitespace-pre-line",children:"Le tournoi d'échecs est ouvert à tous les niveaux. Débutants bienvenus ! "}),s.jsx("p",{className:"mt-3 max-w-md text-base sm:text-lg leading-relaxed text-[#0d0d0d]/70",children:"Tu veux participer ? Préinscris-toi pour bloquer une place. Un lien te sera envoyé quelques jours avant l’événement pour finaliser ton inscription. Attends-toi à un petit mail dans la journée."}),s.jsxs("div",{className:"mt-8 flex flex-col sm:flex-row gap-3",children:[s.jsx("a",{href:`/events/${Ry}`,className:"w-full sm:w-auto",children:s.jsx(Q,{size:"lg",className:"w-full sm:w-auto rounded-full px-7 font-semibold",style:{backgroundColor:Th,color:j_},children:"♟ Je réserve ma place"})}),s.jsx(Q,{size:"lg",variant:"outline",onClick:u,className:"w-full sm:w-auto rounded-full border-[#0d0d0d]/20 hover:bg-[#0d0d0d]/5 px-7",children:"🤔 Pas sûr·e ? Pré-inscription"})]})]}),s.jsx("div",{className:"rounded-2xl border border-[#0d0d0d]/10 bg-white/60 backdrop-blur-sm shadow-sm",children:[{label:"Date",value:"Mer. 27 mai",hint:"20h – 21h30"},{label:"Format",value:"Blitz",hint:"7 parties · 5 + 2"},{label:"Tarif",value:"16 €",hint:"boisson incluse"},{label:"Métro",value:"Odéon",metroLines:[{n:"4",color:"#BB4D98"},{n:"10",color:"#C9910D"}]}].map((h,p,x)=>s.jsxs("div",{className:`p-4 sm:p-5 ${p<x.length-1?"border-b border-[#0d0d0d]/10":""}`,children:[s.jsx("div",{className:"text-[10px] sm:text-[11px] uppercase tracking-[0.2em] text-[#0d0d0d]/55",style:{fontFamily:"'Fragment Mono', ui-monospace, monospace"},children:h.label}),s.jsx("div",{className:"mt-1.5 text-xl sm:text-2xl font-black",style:{fontFamily:"'Bricolage Grotesque', sans-serif"},children:h.value}),h.metroLines?s.jsx("div",{className:"mt-2 flex items-center gap-1.5",children:h.metroLines.map(y=>s.jsx("span",{"aria-label":`Ligne ${y.n}`,className:"grid h-6 w-6 place-items-center rounded-full text-[11px] font-bold text-white",style:{background:y.color,fontFamily:"'Space Grotesk', sans-serif"},children:y.n},y.n))}):s.jsx("div",{className:"mt-1 text-xs sm:text-sm text-[#0d0d0d]/55",children:h.hint})]},h.label))})]})]}),s.jsxs("section",{ref:c,className:"mx-auto max-w-6xl px-5 pb-20 sm:pb-28 scroll-mt-24",children:[s.jsx("h3",{className:"font-black leading-none tracking-tight",style:{fontFamily:"'Bricolage Grotesque', sans-serif",fontSize:"clamp(36px, 8vw, 64px)",fontWeight:900},children:"Pas encore décidé·e ?"}),s.jsx("p",{className:"mt-3 text-sm text-[#0d0d0d]/60",children:"Bloque ta place sans payer — on te recontacte avant l'événement avec le lien de paiement."}),s.jsx("a",{href:`/events/${Ry}`,className:"mt-6 inline-flex items-center gap-2 rounded-full border border-[#0d0d0d]/15 bg-white px-5 py-2.5 text-sm font-semibold text-[#0d0d0d] hover:bg-[#0d0d0d]/5 transition",style:{fontFamily:"'Space Grotesk', system-ui, sans-serif"},children:"Déjà décidé·e ? Inscris-toi et paie directement →"}),s.jsx("div",{className:"mt-8 sm:mt-10 rounded-3xl border border-[#0d0d0d]/10 p-5 sm:p-8 lg:p-10 backdrop-blur-sm shadow-sm bg-pink-300",children:s.jsxs("div",{className:"grid gap-8 lg:gap-10 lg:grid-cols-2 items-start",children:[s.jsxs("div",{children:[s.jsx("span",{className:"inline-block rounded-md px-3 py-1.5 text-[11px] font-bold uppercase tracking-[0.18em]",style:{background:Th,color:j_,fontFamily:"'Fragment Mono', monospace"},children:"Pré-inscription gratuite"}),s.jsx("h4",{className:"mt-5 sm:mt-6 font-black leading-[0.95] tracking-tight",style:{fontFamily:"'Bricolage Grotesque', sans-serif",fontSize:"clamp(28px, 6vw, 48px)",fontWeight:900},children:"Bloque une place — rejoins la liste."}),s.jsx("p",{className:"mt-6 max-w-md text-[15px] leading-relaxed text-[#0d0d0d]/70",children:"Aucun paiement maintenant. Tu bloques une place, on t’envoie le lien d'inscription quelques jours avant l’événement."})]}),o?s.jsxs("div",{className:"grid place-items-center rounded-2xl border border-[#AAFF00]/40 bg-[#AAFF00]/10 p-10 text-center",children:[s.jsx("div",{className:"grid h-14 w-14 place-items-center rounded-full",style:{background:Th},children:s.jsx(is,{className:"h-7 w-7 text-[#0d0d0d]",strokeWidth:3})}),s.jsx("div",{className:"mt-5 text-2xl font-black",style:{fontFamily:"'Bricolage Grotesque', sans-serif"},children:"Ta place est bloquée ."}),s.jsx("p",{className:"mt-2 text-sm text-[#0d0d0d]/70",children:"On t'envoie un lien quelques jours avant le 27 mai pour confirmer ton inscription. En attendant, tu peux noter la date dans ton agenda !"}),s.jsx("button",{onClick:f,className:"mt-6 text-sm underline underline-offset-4 text-[#0d0d0d]/60 hover:text-[#0d0d0d]",children:"Pré-inscrire quelqu'un d'autre"})]}):s.jsxs("form",{onSubmit:d,className:"space-y-4",noValidate:!0,children:[s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(Fe,{htmlFor:"firstName",className:"text-[11px] uppercase tracking-[0.18em] text-[#0d0d0d]/60",style:{fontFamily:"'Fragment Mono', monospace"},children:"Prénom"}),s.jsx(Ue,{id:"firstName",autoComplete:"given-name",placeholder:"Jean",value:e.firstName,onChange:h=>t(p=>({...p,firstName:h.target.value})),className:"mt-2 h-12 rounded-xl border-[#0d0d0d]/15 bg-white"}),n.firstName&&s.jsx("p",{className:"mt-1 text-xs text-red-600",children:n.firstName})]}),s.jsxs("div",{children:[s.jsx(Fe,{htmlFor:"lastName",className:"text-[11px] uppercase tracking-[0.18em] text-[#0d0d0d]/60",style:{fontFamily:"'Fragment Mono', monospace"},children:"Nom"}),s.jsx(Ue,{id:"lastName",autoComplete:"family-name",placeholder:"Dupont",value:e.lastName,onChange:h=>t(p=>({...p,lastName:h.target.value})),className:"mt-2 h-12 rounded-xl border-[#0d0d0d]/15 bg-white"}),n.lastName&&s.jsx("p",{className:"mt-1 text-xs text-red-600",children:n.lastName})]})]}),s.jsxs("div",{children:[s.jsx(Fe,{htmlFor:"email",className:"text-[11px] uppercase tracking-[0.18em] text-[#0d0d0d]/60",style:{fontFamily:"'Fragment Mono', monospace"},children:"Email"}),s.jsx(Ue,{id:"email",type:"email",autoComplete:"email",placeholder:"[email protected]",value:e.email,onChange:h=>t(p=>({...p,email:h.target.value})),className:"mt-2 h-12 rounded-xl border-[#0d0d0d]/15 bg-white"}),n.email&&s.jsx("p",{className:"mt-1 text-xs text-red-600",children:n.email})]}),s.jsx("button",{type:"submit",disabled:i,className:"mt-2 w-full rounded-full bg-[#0d0d0d] py-4 text-base font-semibold text-white transition hover:bg-[#0d0d0d]/90 disabled:opacity-60",children:i?"Enregistrement…":"M’ajouter sur la liste →"}),s.jsx("p",{className:"text-center text-[11px] tracking-wide text-[#0d0d0d]/50",style:{fontFamily:"'Fragment Mono', monospace"},children:"Pas de spam · Seulement pour t’envoyer les infos du tournoi"})]})]})})]}),s.jsx("footer",{className:"border-t border-[#0d0d0d]/10",children:s.jsx("div",{className:"mx-auto flex max-w-6xl px-5 py-8 text-xs text-[#0d0d0d]/55 items-center justify-center",children:s.jsx("span",{style:{fontFamily:"'Fragment Mono', monospace"}
1363,children:"chess agenda · paris · 2026"})})})]})}function OVe(){const[e]=wc(),t=e.get("token")??"",n=e.get("a")==="release"?"release":"extend",[r,i]=N.useState("loading"),[a,o]=N.useState(""),[l,c]=N.useState(null);return N.useEffect(()=>{let u=!1;return(async()=>{if(!t){i("error"),o("Lien invalide.");return}const{data:d,error:f}=await re.functions.invoke("preregistration-extend",{body:{token:t,action:n}});if(u)return;if(f){try{const p=f.context,x=p!=null&&p.text?await p.text():f.message;o(x||"Lien invalide ou expiré.")}catch{o("Lien invalide ou expiré.")}i("error");return}const h=d==null?void 0:d.event;h&&c(h),d!=null&&d.alreadyDone?i("already"):i(n==="release"?"released":"extended")})(),()=>{u=!0}},[t,n]),s.jsx("div",{className:"min-h-screen bg-[#F5F3EE] text-[#0D0D0D] flex items-center justify-center px-4 py-16",children:s.jsxs("div",{className:"w-full max-w-md bg-white rounded-2xl border border-black/10 p-8 shadow-sm",children:[r==="loading"&&s.jsxs("div",{className:"flex flex-col items-center text-center gap-3",children:[s.jsx(We,{className:"w-8 h-8 animate-spin"}),s.jsx("p",{className:"text-sm text-black/60",children:"Un instant…"})]}),r==="error"&&s.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[s.jsx(ur,{className:"w-10 h-10 text-amber-500"}),s.jsx("h1",{className:"font-display text-2xl font-black",children:"Lien invalide ou expiré"}),s.jsx("p",{className:"text-sm text-black/60",children:a}),s.jsx(Q,{asChild:!0,variant:"outline",children:s.jsx(Pe,{to:"/events",children:"Voir les tournois"})})]}),(r==="extended"||r==="already"&&n==="extend")&&s.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[s.jsx(Jr,{className:"w-10 h-10 text-emerald-500"}),s.jsx("h1",{className:"font-display text-2xl font-black leading-tight",children:r==="already"?"C'est déjà noté.":"Place prolongée 48h."}),s.jsx("p",{className:"text-sm text-black/70",children:"On te laisse un peu plus de temps. Confirme dès que tu es sûr — la place peut encore partir si d'autres joueurs paient avant toi."}),l&&s.jsx(Q,{asChild:!0,variant:"payment",className:"w-full",children:s.jsxs(Pe,{to:`/events/${l.id}/register`,children:["🎟️ Confirmer et payer maintenant ",s.jsx(Sr,{className:"w-4 h-4 ml-1"})]})}),s.jsx(Pe,{to:"/events",className:"text-xs text-black/50 underline",children:"Voir tous les tournois"})]}),(r==="released"||r==="already"&&n==="release")&&s.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[s.jsx(Jr,{className:"w-10 h-10 text-black/60"}),s.jsx("h1",{className:"font-display text-2xl font-black leading-tight",children:"Place libérée."}),s.jsx("p",{className:"text-sm text-black/70",children:"Merci de nous avoir prévenus. À bientôt sur un prochain tournoi."}),s.jsx(Q,{asChild:!0,variant:"outline",className:"w-full",children:s.jsx(Pe,{to:"/events",children:"Voir les prochains tournois"})})]})]})})}
1363const Lz={invalid_token:{title:"Lien expiré",message:"Ce lien de reprise n'est plus valide. Rends-toi sur la page de l'événement pour réserver ta place."},ticket_not_found:{title:"Réservation introuvable",message:"On ne retrouve pas ce panier. Tu peux réserver directement depuis la page de l'événement."},already_paid:{title:"C'est déjà réglé 🎉",message:"Ta place est confirmée : rien de plus à faire."},ticket_unavailable:{title:"Panier indisponible",message:"Ce panier n'est plus reprenable. Tu peux réserver à nouveau depuis la page de l'événement."},event_full:{title:"Événement complet",message:"Toutes les places sont parties. Inscris-toi sur la liste d'attente depuis la page de l'événement."},event_past:{title:"Événement passé",message:"Cet événement a déjà eu lieu. Découvre les prochains tournois."},event_closed:{title:"Inscriptions fermées",message:"Les inscriptions ne sont plus ouvertes pour cet événement."}},Fz={title:"Oups, un souci technique",message:"Impossible de reprendre ton panier pour le moment. Réessaie dans un instant."};function DVe(){const[e]=wc(),t=e.get("token")??"",[n,r]=N.useState(null),i=N.useRef(!1);return N.useEffect(()=>{if(!i.current){if(i.current=!0,!t){r({...Lz.invalid_token});return}(async()=>{try{const{data:a,error:o}=await re.functions.invoke("resume-checkout",{body:{token:t}}),l=a??{};if(l.url){window.location.href=l.url;return}if(l.redirect){window.location.href=l.redirect;return}const c=l.error??"server_error";r({...Lz[c]??Fz,eventId:l.eventId})}catch{r({...Fz})}})()}},[t]),n?s.jsxs("main",{className:"min-h-[70vh] flex flex-col items-center justify-center gap-4 px-6 text-center",children:[s.jsx(ur,{className:"h-8 w-8 text-muted-foreground","aria-hidden":!0}),s.jsx("h1",{className:"text-2xl font-black tracking-tight",children:n.title}),s.jsx("p",{className:"text-sm text-muted-foreground max-w-sm",children:n.message}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 pt-2",children:[n.eventId&&s.jsx(Q,{asChild:!0,children:s.jsxs(Pe,{to:`/events/${n.eventId}`,children:["Voir l'événement ",s.jsx(Sr,{className:"ml-1 h-4 w-4"})]})}),s.jsx(Q,{asChild:!0,variant:n.eventId?"outline":"default",children:s.jsx(Pe,{to:"/events",children:"Tous les tournois"})})]})]}):s.jsxs("main",{className:"min-h-[70vh] flex flex-col items-center justify-center gap-4 px-6 text-center",children:[s.jsx(We,{className:"h-8 w-8 animate-spin text-primary","aria-hidden":!0}),s.jsx("h1",{className:"text-xl font-black tracking-tight",children:"On reprend ton panier…"}),s.jsx("p",{className:"text-sm text-muted-foreground max-w-sm",children:"Redirection vers le paiement sécurisé, ne ferme pas cette page."})]})}const IVe=[{to:"/admin",icon:_5,label:"Dashboard",end:!0},{to:"/admin/events",icon:x0,label:"Événements",end:!1},{to:"/admin/sales",icon:lI,label:"Ventes",end:!1},{to:"/admin/venue-requests",icon:Jge,label:"Demandes",end:!1},{to:"/admin/venues",icon:Vi,label:"Lieux",end:!1},{to:"/admin/users",icon:sn,label:"Utilisateurs",end:!1},{to:"/admin/emails",icon:wr,label:"Emails",end:!1},{to:"/admin/newsletter",icon:wr,label:"Newsletter",end:!1},{to:"/admin/photos",icon:kf,label:"Photos",end:!1},{to:"/admin/fide-tests",icon:v5,label:"Tests FIDE",end:!1},{to:"/admin/openpairing-diagnostics",icon:xxe,label:"API OpenPairing",end:!1}];function $z({isSheet:e=!1,onNavigate:t}){const[n,r]=N.useState(!1),i=fa(),a=()=>{e&&t&&t()};return s.jsxs("aside",{className:ae("bg-sidebar border-r border-sidebar-border flex flex-col transition-all duration-300",e?"h-full w-full":ae("h-screen",n?"w-16":"w-64")),children:[s.jsxs("div",{className:ae("h-16 flex items-center border-b border-sidebar-border px-4",e?"justify-start gap-3":n?"justify-center":"justify-between"),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary flex items-center justify-center",children:s.jsx(sa,{className:"w-4 h-4 text-primary-foreground"})}),(e||!n)&&s.jsx("span",{className:"font-display font-semibold text-sidebar-foreground",children:"Admin"})]}),!e&&s.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>r(!n),className:"h-8 w-8 text-sidebar-foreground hover:bg-sidebar-accent",children:n?s.jsx(la,{className:"w-4 h-4"}):s.jsx(fp,{className:"w-4 h-4"})})]}),s.jsx("nav",{className:"flex-1 p-2 space-y-1",children:IVe.map(o=>{const l=o.end?i.pathname===o.to:i.pathname.startsWith(o.to);return s.jsxs(g2,{to:o.to,end:o.end,onClick:a,className:ae("flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors min-h-[44px]","hover:bg-sidebar-accent",l?"bg-sidebar-primary text-sidebar-primary-foreground":"text-sidebar-foreground"),children:[s.jsx(o.icon,{className:"w-5 h-5 flex-shrink-0"}),(e||!n)&&s.jsx("span",{className:"font-medium text-sm",children:o.label})]},o.to)})}),(e||!n)&&s.jsx("div",{className:"p-4 border-t border-sidebar-border",children:s.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Console Admin v1.0"})})]})}function RVe(){const{profile:e,signOut:t}=Tt(),n=Rr(),r=vd(),[i,a]=N.useState(!1),o=async()=>{await t(),n("/")};return s.jsxs("div",{className:"flex min-h-screen w-full bg-background",children:[s.jsx("div",{className:"hidden md:block",children:s.jsx($z,{})}),s.jsxs("div",{className:"flex-1 flex flex-col min-h-screen overflow-hidden",children:[s.jsxs("header",{className:"h-16 border-b border-border bg-card/95 backdrop-blur-xl flex items-center justify-between px-4 md:px-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[r&&s.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>a(!0),className:"md:hidden",children:s.jsx(ZY,{className:"w-5 h-5"})}),s.jsx("h1",{className:"font-display text-lg font-semibold text-foreground",children:"Console Admin"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Q,{variant:"ghost",size:"icon",className:"relative",children:s.jsx(qge,{className:"w-5 h-5"})}),s.jsx("div",{className:"h-6 w-px bg-border hidden sm:block"}),s.jsxs("div",{className:"hidden sm:flex items-center gap-3",children:[s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:(e==null?void 0:e.display_name)||(e==null?void 0:e.first_name)||"Admin"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Administrateur"})]}),s.jsx(Q,{variant:"ghost",size:"icon",onClick:o,className:"text-muted-foreground hover:text-destructive",children:s.jsx(a1,{className:"w-5 h-5"})})]}),s.jsx(Q,{variant:"ghost",size:"icon",onClick:o,className:"sm:hidden text-muted-foreground hover:text-destructive",children:s.jsx(a1,{className:"w-5 h-5"})})]})]}),s.jsx("main",{className:"flex-1 overflow-x-auto overflow-y-auto p-4 md:p-6",children:s.jsx(II,{})})]}),s.jsx(dC,{open:i,onOpenChange:a,children:s.jsxs($b,{side:"left",className:"w-72 p-0 bg-sidebar/95 backdrop-blur-xl border-r border-primary/10",children:[s.jsx(fC,{className:"sr-only",children:"Navigation Admin"}),s.jsx($z,{isSheet:!0,onNavigate:()=>a(!1)})]})})]})}function MVe(){return st({queryKey:["admin-stats"],queryFn:async()=>{const[e,t,n,r]=await Promise.all([re.from("profiles").select("id",{count:"exact",head:!0}),re.from("venues").select("id",{count:"exact",head:!0}).eq("is_active",!0),re.from("venue_requests").select("id",{count:"exact",head:!0}
1363).eq("status","pending"),re.from("events").select("id",{count:"exact",head:!0}).in("status",["published","ongoing"]).gte("event_date",new Date().toISOString())]);return{totalUsers:e.count||0,activeVenues:t.count||0,pendingRequests:n.count||0,upcomingEvents:r.count||0}},staleTime:3e4})}function yle(e){return st({queryKey:["venue-requests",e],queryFn:async()=>{let t=re.from("venue_requests").select("*").order("created_at",{ascending:!1});e&&(t=t.eq("status",e));const{data:n,error:r}=await t;if(r)throw r;return n}})}function LVe(){const e=Ye(),{toast:t}=_r();return dt({mutationFn:async({requestId:n,userId:r,adminNotes:i})=>{var p;const{data:a,error:o}=await re.from("venue_requests").select("*").eq("id",n).single();if(o)throw o;const{data:{user:l}}=await re.auth.getUser();if(!l)throw new Error("Non authentifié");const{data:c,error:u}=await re.from("venues").insert({name:a.bar_name,address:a.bar_address,city:((p=a.bar_address.split(",").pop())==null?void 0:p.trim())||"Paris",created_by:l.id}).select().single();if(u)throw u;const{data:d}=await re.from("user_roles").select("id").eq("user_id",r).eq("role","venue").maybeSingle();if(!d){const{error:x}=await re.from("user_roles").insert({user_id:r,role:"venue"});if(x)throw x}const{error:f}=await re.from("venue_users").insert({user_id:r,venue_id:c.id,role:"manager"});if(f)throw f;const{error:h}=await re.from("venue_requests").update({status:"approved",reviewed_by:l.id,reviewed_at:new Date().toISOString(),admin_notes:i}).eq("id",n);if(h)throw h;return re.functions.invoke("send-venue-approved-email",{body:{userId:r,contactEmail:a.contact_email,contactName:a.contact_email.split("@")[0],barName:a.bar_name,barAddress:a.bar_address,venueId:c.id,adminNotes:i}}).catch(x=>{console.error("Failed to send venue approval email:",x)}),{venue:c,request:a}},onSuccess:()=>{e.invalidateQueries({queryKey:["venue-requests"]}),e.invalidateQueries({queryKey:["venues"]}),e.invalidateQueries({queryKey:["admin-stats"]}),t({title:"Demande approuvée",description:"Le lieu a été créé et le partenaire a été notifié."})},onError:n=>{t({title:"Erreur",description:n.message,variant:"destructive"})}})}function FVe(){const e=Ye(),{toast:t}=_r();return dt({mutationFn:async({requestId:n,adminNotes:r})=>{const{data:{user:i}}=await re.auth.getUser();if(!i)throw new Error("Non authentifié");const{error:a}=await re.from("venue_requests").update({status:"rejected",reviewed_by:i.id,reviewed_at:new Date().toISOString(),admin_notes:r}).eq("id",n);if(a)throw a},onSuccess:()=>{e.invalidateQueries({queryKey:["venue-requests"]}),e.invalidateQueries({queryKey:["admin-stats"]}),t({title:"Demande refusée",description:"Le demandeur sera informé du refus."})},onError:n=>{t({title:"Erreur",description:n.message,variant:"destructive"})}})}function N_({label:e,value:t,icon:n,trend:r,isLoading:i,className:a}){return i?s.jsx(Se,{className:ae("border-border/50",a),children:s.jsxs(De,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Ie,{className:"h-10 w-10 rounded-lg"}),s.jsx(Ie,{className:"h-4 w-16"})]}),s.jsx(Ie,{className:"h-8 w-20 mt-3"}),s.jsx(Ie,{className:"h-4 w-24 mt-1"})]})}):s.jsx(Se,{className:ae("border-border/50",a),children:s.jsxs(De,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(n,{className:"w-5 h-5 text-primary"})}),r&&s.jsxs("span",{className:ae("text-xs font-medium px-2 py-0.5 rounded-full",r.isPositive?"bg-success/10 text-success":"bg-destructive/10 text-destructive"),children:[r.isPositive?"+":"",r.value,"%"]})]}),s.jsx("p",{className:"text-2xl font-bold text-foreground mt-3",children:t}),s.jsx("p",{className:"text-sm text-muted-foreground",children:e})]})})}const $Ve=()=>{const{data:e,isLoading:t}=MVe(),{data:n,isLoading:r}=yle("pending"),i=Rr(),a=o=>new Date(o).toLocaleDateString("fr-FR",{day:"numeric",month:"short"});return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"font-display text-2xl font-bold text-foreground",children:"Dashboard"}),s.jsx("p",{className:"text-muted-foreground",children:"Vue d'ensemble de la plateforme"})]}),s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsx(N_,{label:"Utilisateurs",value:(e==null?void 0:e.totalUsers)||0,icon:sn,isLoading:t}),s.jsx(N_,{label:"Lieux actifs",value:(e==null?void 0:e.activeVenues)||0,icon:Vi,isLoading:t}),s.jsx(N_,{label:"Demandes en attente",value:(e==null?void 0:e.pendingRequests)||0,icon:Vt,isLoading:t}),s.jsx(N_,{label:"Tournois à venir",value:(e==null?void 0:e.upcomingEvents)||0,icon:Jn,isLoading:t})]}),s.jsxs(Se,{className:"border-border/50",children:[s.jsxs(kt,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(Et,{className:"font-display text-lg flex items-center gap-2",children:[s.jsx(Vt,{className:"w-5 h-5 text-warning"}),"Demandes récentes"]}),s.jsx(Qs,{children:"Bars en attente de validation"})]}),s.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>i("/admin/venue-requests"),className:"gap-1",children:["Voir tout",s.jsx(Sr,{className:"w-4 h-4"})]})]}),s.jsx(De,{children:r?s.jsx("div",{className:"space-y-3",children:[1,2,3].map(o=>s.jsx("div",{className:"h-16 bg-muted/50 rounded-lg animate-pulse"},o))}):n!=null&&n.length?s.jsx("div",{className:"space-y-3",children:n.slice(0,5).map(o=>s.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/30 rounded-lg border border-border/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(Vi,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-sm",children:o.bar_name}),s.jsx("p",{className:"text-xs text-muted-foreground",children:a(o.created_at)})]})]}),s.jsx(Q,{size:"sm",variant:"outline",onClick:()=>i("/admin/venue-requests"),children:"Traiter"})]},o.id))}):s.jsxs("div",{className:"text-center py-8",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-muted flex items-center justify-center mx-auto mb-3",children:s.jsx(Jr,{className:"w-6 h-6 text-muted-foreground"})}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Aucune demande en attente"})]})})]}),s.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[s.jsx(Se,{className:"border-border/50 hover:border-primary/30 transition-colors cursor-pointer",onClick:()=>i("/admin/users"),children:s.jsxs(De,{className:"p-6 text-center",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center mx-auto mb-4",children:s.jsx(sn,{className:"w-6 h-6 text-primary"})}),s.jsx("h3",{className:"font-semibold mb-1",children:"Utilisateurs"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Gérer les comptes"})]})}),s.jsx(Se,{className:"border-border/50 hover:border-primary/30 transition-colors cursor-pointer",onClick:()=>i("/admin/venues"),children:s.jsxs(De,{className:"p-6 text-center",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center mx-auto mb-4",children:s.jsx(Vi,{className:"w-6 h-6 text-primary"})}),s.jsx("h3",{className:"font-semibold mb-1",children:"Lieux"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Gérer les bars"})]})}),s.jsx(Se,{className:"border-border/50 hover:border-primary/30 transition-colors cursor-pointer",onClick:()=>i("/admin/venue-requests"),children:s.jsxs(De,{className:"p-6 text-center",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center mx-auto mb-4",children:s.jsx(Jn,{className:"w-6 h-6 text-primary"})}),s.jsx("h3",{className:"font-semibold mb-1",children:"Demandes"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Valider les partenaires"})]})})]})]})};function BVe(){const[e,t]=N.useState("pending"),[n,r]=N.useState(null),[i,a]=N.useState(null),[o,l]=N.useState(""),{data:c,isLoading:u}=yle(e==="all"?void 0:e),d=LVe(),f=FVe(),h=c==null?void 0:c.find(w=>w.id===n),p=async()=>{!n||!h||(i==="approve"?await d.mutateAsync({requestId:n,userId:h.user_id,adminNotes:o||void 0}):i==="reject"&&await f.mutateAsync({requestId:n,adminNotes:o||void 0}),r(null),a(null),l(""))},x=(w,_)=>{r(w),a(_),l("")},y=w=>new Date(w).toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"}),b=w=>{const _={pending:{variant:"secondary",label:"En attente"},approved:{variant:"default",label:"Approuvé"},rejected:{variant:"destructive",label:"Refusé"}},{variant:j,label:E}=_[w];return s.jsx(we,{variant:j,children:E})};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"font-display text-2xl font-bold text-foreground",children:"Demandes de partenariat"}),s.jsx("p",{className:"text-muted-foreground mt-1",children:"Gérez les demandes d'inscription des bars et lieux partenaires."})]}),s.jsxs(Ka,{value:e,onValueChange:w=>t(w),children:[s.jsxs(Ca,{children:[s.jsxs(vn,{value:"pending",className:"gap-2",children:[s.jsx(Vt,{className:"w-4 h-4"}),"En attente"]}),s.jsx(vn,{value:"approved",children:"Approuvées"}),s.jsx(vn,{value:"rejected",children:"Refusées"}),s.jsx(vn,{value:"all",children:"Toutes"})]}),s.jsx(Sn,{value:e,className:"mt-6",children:u?s.jsx("div",{className:"space-y-4",children:[1,2,3].map(w=>s.jsx(Se,{className:"border-border/50",children:s.jsx(De,{className:"p-6",children:s.jsxs("div",{className:"flex gap-4",children:[s.jsx(Ie,{className:"w-12 h-12 rounded-lg"}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx(Ie,{className:"h-5 w-48"}),s.jsx(Ie,{className:"h-4 w-64"}),s.jsx(Ie,{className:"h-4 w-32"})]})]})})},w))}):(c==null?void 0:c.length)===0?s.jsx(Se,{className:"border-border/50",children:s.jsxs(De,{className:"p-12 text-center",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-4",children:s.jsx(Vi,{className:"w-8 h-8 text-muted-foreground"})}),s.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Aucune demande"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:e==="pending"?"Toutes les demandes ont été traitées.":"Aucune demande dans cette catégorie."})]})}):s.jsx("div",{className:"space-y-4",children:c==null?void 0:c.map(w=>s.jsx(Se,{className:"border-border/50",children:s.jsx(De,{className:"p-6",children:s.jsxs("div",{className:"flex flex-col md:flex-row md:items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:s.jsx(Vi,{className:"w-6 h-6 text-primary"})}),s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:w.bar_name}),b(w.status)]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(gn,{className:"w-4 h-4"}),w.bar_address]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(wr,{className:"w-4 h-4"}),w.contact_email]}),w.contact_phone&&s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(nX,{className:"w-4 h-4"}),s.jsx("a",{href:`tel:${w.contact_phone.replace(/\s/g,"")}`,className:"hover:text-primary hover:underline transition-colors",children:w.
1363contact_phone})]}),w.message&&s.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground mt-2",children:[s.jsx(eX,{className:"w-4 h-4 mt-0.5"}),s.jsx("p",{className:"line-clamp-2",children:w.message})]}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Demande reçue le ",y(w.created_at)]})]})]}),w.status==="pending"&&s.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[s.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>x(w.id,"reject"),className:"gap-1",children:[s.jsx(hi,{className:"w-4 h-4"}),"Refuser"]}),s.jsxs(Q,{size:"sm",onClick:()=>x(w.id,"approve"),className:"gap-1",children:[s.jsx(Jr,{className:"w-4 h-4"}),"Approuver"]})]}),w.status!=="pending"&&w.admin_notes&&s.jsxs("div",{className:"text-sm text-muted-foreground bg-muted/50 p-3 rounded-lg max-w-xs",children:[s.jsx("p",{className:"font-medium mb-1",children:"Note admin :"}),s.jsx("p",{children:w.admin_notes})]})]})})},w.id))})})]}),s.jsx(Ln,{open:!!i,onOpenChange:()=>{r(null),a(null),l("")},children:s.jsxs(Dn,{children:[s.jsxs(Un,{children:[s.jsx(qn,{children:i==="approve"?"Approuver la demande":"Refuser la demande"}),s.jsx(qr,{children:i==="approve"?"Cette action créera un nouveau lieu et donnera accès au demandeur.":"Le demandeur sera informé du refus."})]}),h&&s.jsxs("div",{className:"py-4",children:[s.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg mb-4",children:[s.jsx(Vi,{className:"w-5 h-5 text-primary"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:h.bar_name}),s.jsx("p",{className:"text-sm text-muted-foreground",children:h.bar_address})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"notes",children:"Note (optionnelle)"}),s.jsx($s,{id:"notes",placeholder:i==="approve"?"Message de bienvenue, instructions...":"Raison du refus...",value:o,onChange:w=>l(w.target.value),rows:3})]})]}),s.jsxs(Pi,{children:[s.jsx(Q,{variant:"outline",onClick:()=>{r(null),a(null),l("")},children:"Annuler"}),s.jsxs(Q,{variant:i==="reject"?"destructive":"default",onClick:p,disabled:d.isPending||f.isPending,children:[(d.isPending||f.isPending)&&s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),i==="approve"?"Approuver":"Refuser"]})]})]})})]})}function zVe(){return dt({mutationFn:async({url:e,source:t})=>{const{data:n,error:r}=await re.functions.invoke("venue-enrich-url",{body:{url:e,source:t}});if(r){let i=r.message;if(r instanceof _x)try{const a=await r.context.json();i=(a==null?void 0:a.error)||i}catch{}throw/:402:/.test(i)?new Error("Crédits IA/Firecrawl épuisés. Bascule en mode manuel."):/:429:/.test(i)?new Error("Trop de requêtes. Réessaie dans quelques secondes."):new Error(i)}return n}})}const Bz={name:"",address:"",city:"",postal_code:"",country:"",latitude:null,longitude:null,description:"",capacity:20,brand_color:"",logo_url:"",image_url:"",cover_image_url:"",image_source_url:""};function UVe({open:e,onOpenChange:t}){var M,B,U;const[n,r]=N.useState("url"),[i,a]=N.useState(""),[o,l]=N.useState(Bz),[c,u]=N.useState({}),[d,f]=N.useState([]),[h,p]=N.useState(!1),[x,y]=N.useState(""),[b,w]=N.useState(!1),_=R6e(),j=zVe(),E=()=>{l(Bz),u({}),f([]),a(""),y(""),r("url")},S=(F,H,z)=>{const K=H==="google_maps"?"google":"ia";l(W=>({...W,name:F.name??W.name,address:F.address_raw??W.address,city:F.city??W.city,postal_code:F.postal_code??W.postal_code,country:F.country??W.country??"France",description:F.description??W.description,brand_color:F.brand_color??W.brand_color,logo_url:F.logo_url??W.logo_url,cover_image_url:F.image_candidates[0]??W.cover_image_url,image_url:F.image_candidates[0]??W.image_url,image_source_url:z})),u(W=>{const q={...W};return["name","address","city","postal_code","country","description","brand_color","logo_url","cover_image_url","image_url"].forEach(oe=>{(F[oe]||oe==="cover_image_url"&&F.image_candidates.length)&&(q[oe]=K)}),q}),f(F.image_candidates),F.address_raw&&T(F.address_raw)},T=async F=>{var H;try{const z=new URLSearchParams({q:F,limit:"1",lang:"fr"}),K=await fetch(`https://photon.komoot.io/api/?${z}`);if(!K.ok)return;const W=await K.json(),q=(H=W==null?void 0:W.features)==null?void 0:H[0];if(!q)return;const[oe,J]=q.geometry.coordinates,Y=q.properties??{};l(Z=>({...Z,latitude:J,longitude:oe,city:Z.city||Y.city||"",postal_code:Z.postal_code||Y.postcode||"",country:Z.country||Y.country||"France",address:Z.address||[Y.housenumber,Y.street].filter(
1363Boolean).join(" ")||Z.address}))}catch{}},P=async F=>{if(i.trim())try{const H=await j.mutateAsync({url:i.trim(),source:F});S(H.draft,F,H.source_url),je.success("Fiche pré-remplie par l'IA — vérifie et ajuste.")}catch(H){je.error(H instanceof Error?H.message:"Erreur d'enrichissement")}},O=async()=>{if(!o.name.trim()){je.error("Renseigne d'abord le nom du lieu.");return}p(!0);try{const{data:F,error:H}=await re.functions.invoke("venue-enrich-url",{body:{action:"describe",name:o.name,city:o.city,hints:o.address}});if(H){let K=H.message;if(H instanceof _x)try{const W=await H.context.json();K=(W==null?void 0:W.error)||K}catch{}throw new Error(K)}const z=(F==null?void 0:F.description)??"";z&&(l(K=>({...K,description:z})),u(K=>({...K,description:"ia"})))}catch(F){je.error(F instanceof Error?F.message:"Erreur IA")}finally{p(!1)}},D=async()=>{try{const F=await _.mutateAsync({name:o.name,address:o.address,city:o.city,postal_code:o.postal_code||null,country:o.country||null,latitude:o.latitude,longitude:o.longitude,description:o.description||null,capacity:o.capacity,brand_color:o.brand_color||null,logo_url:o.logo_url||null,image_url:o.image_url||null,cover_image_url:o.cover_image_url||null,image_source_url:o.image_source_url||null}),H=x.trim().toLowerCase();if(F!=null&&F.id&&H){w(!0);try{const{data:z,error:K}=await re.functions.invoke("venue-staff-manage",{body:{action:"add_by_email",venueId:F.id,email:H,role:"manager"}});let W=null;if(K){if(W=K.message,K instanceof _x){const q=await K.context.json().catch(()=>null);q!=null&&q.error&&(W=q.error)}}else z!=null&&z.error&&(W=z.error);W?je.error(`Lieu créé, mais manager non rattaché : ${W}`):je.success(z!=null&&z.accountCreated?`Manager invité : ${H} (email d'accès envoyé)`:`Manager rattaché : ${H}`)}finally{w(!1)}}E(),t(!1)}catch{}},R=!x.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(x.trim()),L=!!o.name&&!!o.address&&!!o.city&&R;return s.jsx(Ln,{open:e,onOpenChange:F=>{F||E(),t(F)},children:s.jsxs(Dn,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(Un,{children:[s.jsx(qn,{children:"Créer un nouveau lieu"}),s.jsx(qr,{children:"Colle un lien pour pré-remplir automatiquement, ou saisis à la main."})]}),s.jsxs(Ka,{value:n,onValueChange:F=>r(F),className:"mt-2",children:[s.jsxs(Ca,{className:"grid w-full grid-cols-3",children:[s.jsxs(vn,{value:"url",className:"gap-2",children:[s.jsx(YY,{className:"w-4 h-4"})," Site web"]}),s.jsxs(vn,{value:"maps",className:"gap-2",children:[s.jsx(gn,{className:"w-4 h-4"})," Google Maps"]}),s.jsxs(vn,{value:"manual",className:"gap-2",children:[s.jsx(tX,{className:"w-4 h-4"})," Manuel"]})]}),s.jsx(Sn,{value:"url",className:"mt-4",children:s.jsx(zz,{placeholder:"https://lefouduroi.paris",value:i,onChange:a,onRun:()=>P("website"),loading:j.isPending&&((M=j.variables)==null?void 0:M.source)==="website",cta:"Analyser le site"})}),s.jsx(Sn,{value:"maps",className:"mt-4",children:s.jsx(zz,{placeholder:"https://maps.app.goo.gl/... ou https://www.google.com/maps/place/...",value:i,onChange:a,onRun:()=>P("google_maps"),loading:j.isPending&&((B=j.variables)==null?void 0:B.source)==="google_maps",cta:"Importer la fiche Google"})}),s.jsx(Sn,{value:"manual",className:"mt-4",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Remplis les champs ci-dessous. Tu pourras toujours enrichir plus tard."})})]}),j.isError&&s.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/5 p-3 text-sm text-destructive mt-3",children:[s.jsx(El,{className:"w-4 h-4 mt-0.5 shrink-0"}),s.jsx("span",{children:(U=j.error)==null?void 0:U.message})]}),s.jsxs("div",{className:"space-y-4 py-4 border-t mt-4",children:[s.jsx(Bd,{label:"Nom du lieu *",origin:c.name,children:s.jsx(Ue,{value:o.name,onChange:F=>{l(H=>({...H,name:F.target.value})),u(H=>({...H,name:"manual"}))},placeholder:"Le Fou du Roi"})}),s.jsx(Bd,{label:"Adresse *",origin:c.address,children:s.jsx(PR,{value:o.address,onChange:F=>{l(H=>({...H,address:F})),u(H=>({...H,address:"manual"}))},onSelect:F=>{l(H=>{var z,K;return{...H,address:F.address,city:F.city||H.city,postal_code:F.postalCode||H.postal_code,country:F.country||H.country,latitude:((z=F.coordinates)==null?void 0:z[0])??H.latitude,longitude:((K=F.coordinates)==null?void 0:K[1])??H.longitude}}),u(H=>({...H,address:"manual",city:"manual",postal_code:"manual"}))},placeholder:"Rechercher l'adresse..."})}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Bd,{label:"Ville *",origin:c.city,children:s.jsx(Ue,{value:o.city,onChange:F=>
1363{l(H=>({...H,city:F.target.value})),u(H=>({...H,city:"manual"}))}})}),s.jsx(Bd,{label:"Code postal",origin:c.postal_code,children:s.jsx(Ue,{value:o.postal_code,onChange:F=>{l(H=>({...H,postal_code:F.target.value})),u(H=>({...H,postal_code:"manual"}))}})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Bd,{label:"Capacité",children:s.jsx(Ue,{type:"number",min:1,value:o.capacity,onChange:F=>l(H=>({...H,capacity:parseInt(F.target.value)||20}))})}),s.jsx(Bd,{label:"Couleur de marque",origin:c.brand_color,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"color",className:"h-10 w-14 rounded-md border border-input bg-transparent cursor-pointer",value:o.brand_color||"#000000",onChange:F=>{l(H=>({...H,brand_color:F.target.value.toUpperCase()})),u(H=>({...H,brand_color:"manual"}))}}),s.jsx(Ue,{value:o.brand_color,onChange:F=>l(H=>({...H,brand_color:F.target.value})),placeholder:"#RRGGBB"})]})})]}),s.jsx(Bd,{label:"Description",origin:c.description,action:s.jsxs(Q,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1 text-xs",onClick:O,disabled:h,children:[h?s.jsx(We,{className:"w-3 h-3 animate-spin"}):s.jsx(Ti,{className:"w-3 h-3"}),"Générer avec l'IA"]}),children:s.jsx($s,{rows:3,value:o.description,onChange:F=>{l(H=>({...H,description:F.target.value})),u(H=>({...H,description:"manual"}))},placeholder:"Un bar convivial pour les amateurs d'échecs..."})}),d.length>0&&s.jsxs("div",{children:[s.jsx(Fe,{className:"mb-2 block",children:"Image de couverture"}),s.jsx("div",{className:"grid grid-cols-3 gap-2",children:d.map(F=>{const H=o.cover_image_url===F;return s.jsx("button",{type:"button",onClick:()=>{l(z=>({...z,cover_image_url:F,image_url:F})),u(z=>({...z,cover_image_url:"ia",image_url:"ia"}))},className:ae("relative aspect-video rounded-md overflow-hidden border-2 transition-all",H?"border-primary ring-2 ring-primary/40":"border-transparent hover:border-muted-foreground/40"),children:s.jsx("img",{src:F,alt:"",className:"w-full h-full object-cover",loading:"lazy"})},F)})})]}),s.jsx(Bd,{label:"Logo (URL)",origin:c.logo_url,children:s.jsxs("div",{className:"flex items-center gap-2",children:[o.logo_url&&s.jsx("img",{src:o.logo_url,alt:"Logo",className:"h-10 w-10 rounded object-contain bg-muted"}),s.jsx(Ue,{value:o.logo_url,onChange:F=>{l(H=>({...H,logo_url:F.target.value})),u(H=>({...H,logo_url:"manual"}))},placeholder:"https://..."}),o.logo_url&&s.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>l(F=>({...F,logo_url:""})),children:s.jsx(Er,{className:"w-4 h-4"})})]})})]}),s.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[s.jsx(Fe,{htmlFor:"venue-manager-email",children:"Manager du lieu (recommandé)"}),s.jsx(Ue,{id:"venue-manager-email",type:"email",value:x,onChange:F=>y(F.target.value),placeholder:"[email protected]"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Rattache un manager dès la création : il pourra ensuite gérer son équipe seul. Si le compte n'existe pas, il est créé et un email d'accès est envoyé."}),!R&&s.jsx("p",{className:"text-xs text-destructive",children:"Adresse email invalide."})]}),s.jsxs(Pi,{children:[s.jsx(Q,{variant:"outline",onClick:()=>t(!1),children:"Annuler"}),s.jsxs(Q,{onClick:D,disabled:!L||_.isPending||b,children:[(_.isPending||b)&&s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),"Créer le lieu"]})]})]})})}function zz({placeholder:e,value:t,onChange:n,onRun:r,loading:i,cta:a}){return s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Ue,{value:t,onChange:o=>n(o.target.value),placeholder:e,onKeyDown:o=>{o.key==="Enter"&&!i&&t.trim()&&(o.preventDefault(),r())}}),s.jsxs(Q,{onClick:r,disabled:i||!t.trim(),className:"gap-2 shrink-0",children:[i?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(Ti,{className:"w-4 h-4"}),a]})]})}function Bd({label:e,origin:t,action:n,children:r}){return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Fe,{children:e}),t==="ia"&&s.jsxs(we,{variant:"secondary",className:"h-5 text-[10px] gap-1",children:[s.jsx(Ti,{className:"w-2.5 h-2.5"})," IA"]}),t==="google"&&s.jsx(we,{variant:"secondary",className:"h-5 text-[10px]",children:"Google"})]}),n]}),r]})}function qVe(){var w;const[e,t]=N.useState(""),[n,r]=N.useState(!0),[i,a]=N.useState(!1),{data:o,isLoading:l}=qM(),{data:c={}}=I6e(),{data:u=0}=F6e(),[d,f]=N.useState(null),h=M6e(),p=L6e(),x=$6e(),y=Rr(),b=(w=o==null?void 0:o.filter(_=>!n||_.is_active))==null?void 0:w.filter(_=>
1363_.name.toLowerCase().includes(e.toLowerCase())||_.address.toLowerCase().includes(e.toLowerCase())||_.city.toLowerCase().includes(e.toLowerCase()));return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"font-display text-2xl font-bold text-foreground",children:"Gestion des lieux"}),s.jsxs("p",{className:"text-muted-foreground mt-1",children:[(o==null?void 0:o.length)||0," lieu(x) enregistré(s)"]})]}),s.jsxs("div",{className:"flex gap-2",children:[u>0&&s.jsxs(Q,{variant:"outline",onClick:()=>x.mutate(),disabled:x.isPending,className:"gap-2",children:[x.isPending?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(bv,{className:"w-4 h-4"}),"Géocoder (",u,")"]}),s.jsxs(Q,{className:"gap-2",onClick:()=>a(!0),children:[s.jsx(qa,{className:"w-4 h-4"}),"Nouveau lieu"]}),s.jsx(UVe,{open:i,onOpenChange:a})]})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:items-center",children:[s.jsxs("div",{className:"relative flex-1 max-w-md",children:[s.jsx(_o,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{placeholder:"Rechercher un lieu...",value:e,onChange:_=>t(_.target.value),className:"pl-10"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(R0,{id:"active-filter",checked:n,onCheckedChange:r}),s.jsx(Fe,{htmlFor:"active-filter",className:"text-sm text-muted-foreground cursor-pointer whitespace-nowrap",children:"Actifs uniquement"})]})]}),l?s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-4",children:[1,2,3,4,5,6].map(_=>s.jsx(Se,{className:"border-border/50",children:s.jsxs(De,{className:"p-5",children:[s.jsx(Ie,{className:"w-10 h-10 rounded-lg mb-3"}),s.jsx(Ie,{className:"h-5 w-32 mb-2"}),s.jsx(Ie,{className:"h-4 w-full mb-1"}),s.jsx(Ie,{className:"h-4 w-24"})]})},_))}):(b==null?void 0:b.length)===0?s.jsx(Se,{className:"border-border/50",children:s.jsxs(De,{className:"p-12 text-center",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-4",children:s.jsx(Vi,{className:"w-8 h-8 text-muted-foreground"})}),s.jsx("h3",{className:"font-semibold text-foreground mb-1",children:e?"Aucun résultat":"Aucun lieu"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:e?"Essayez avec d'autres termes de recherche.":"Commencez par créer un nouveau lieu."})]})}):s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-4",children:b==null?void 0:b.map(_=>s.jsx(Se,{className:"border-border/50 hover:border-primary/30 transition-colors",children:s.jsxs(De,{className:"p-5",children:[s.jsxs("div",{className:"flex items-start justify-between mb-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(Vi,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[s.jsx(we,{variant:_.is_active?"default":"secondary",children:_.is_active?"Actif":"Inactif"}),(!_.latitude||!_.longitude)&&s.jsxs(we,{variant:"outline",className:"text-xs gap-1 text-warning border-warning/30",children:[s.jsx(gn,{className:"w-3 h-3"}),"GPS"]}),!c[_.id]&&s.jsxs(we,{variant:"outline",className:"text-xs gap-1 text-warning border-warning/30",children:[s.jsx(ur,{className:"w-3 h-3"}),"Sans manager"]})]})]}),s.jsx("h3",{className:"font-semibold text-foreground mb-1",children:_.name}),s.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground mb-1",children:[s.jsx(gn,{className:"w-3.5 h-3.5"}),s.jsx("span",{className:"truncate",children:_.address})]}),s.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground mb-4",children:[s.jsx(sn,{className:"w-3.5 h-3.5"}),s.jsxs("span",{children:["Capacité : ",_.capacity||"N/A"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(Q,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>y(`/admin/venues/${_.id}`),children:[s.jsx(go,{className:"w-4 h-4 mr-1"}),"Détails"]}
1363),s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>h.mutate({id:_.id,isActive:!_.is_active}),disabled:h.isPending,children:_.is_active?s.jsx(oX,{className:"w-5 h-5 text-success"}):s.jsx(aX,{className:"w-5 h-5 text-muted-foreground"})}),s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>f({id:_.id,name:_.name}),children:s.jsx(ua,{className:"w-4 h-4 text-destructive"})})]})]})},_.id))}),s.jsx(yr,{open:!!d,onOpenChange:_=>!_&&f(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsxs(or,{className:"flex items-center gap-2",children:[s.jsx(ur,{className:"w-5 h-5 text-destructive"}),"Supprimer « ",d==null?void 0:d.name," » ?"]}),s.jsx(lr,{children:"Cette action est irréversible. Tous les événements, tickets, résultats de tournois et données associées à ce lieu seront définitivement supprimés."})]}),s.jsxs(ar,{children:[s.jsx(cr,{disabled:p.isPending,children:"Annuler"}),s.jsxs(vr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:p.isPending,onClick:()=>{d&&p.mutate(d.id,{onSuccess:()=>f(null)})},children:[p.isPending&&s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),"Supprimer définitivement"]})]})]})})]})}function VVe(){const[e,t]=N.useState(!1);return{geocodeAddress:async(r,i)=>{var a;t(!0);try{const o=`${r}, ${i}`.trim(),l=new URLSearchParams({q:o,limit:"1",lang:"fr"}),c=await fetch(`https://photon.komoot.io/api/?${l.toString()}`);if(!c.ok)throw new Error("Network error");const u=await c.json();if(((a=u.features)==null?void 0:a.length)>0){const d=u.features[0].geometry.coordinates;return{latitude:d[1],longitude:d[0]}}return null}catch(o){return console.error("Geocoding error:",o),null}finally{t(!1)}},isGeocoding:e}}const HVe=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function WVe({onSelect:e,excludeUserIds:t=[],placeholder:n="Rechercher par email ou nom..."}){const[r,i]=N.useState(""),[a,o]=N.useState(""),[l,c]=N.useState(!1),[u,d]=N.useState(""),[f,h]=N.useState(""),p=j8e();N.useEffect(()=>{const S=setTimeout(()=>o(r),300);return()=>clearTimeout(S)},[r]),N.useEffect(()=>{c(!1),d(""),h("")},[r]);const{data:x=[],isLoading:y}=w8e(a),b=x.filter(S=>!t.includes(S.id)),w=HVe.test(r.trim()),_=!y&&b.length===0&&r.length>=2,j=S=>S.display_name?S.display_name:`${S.first_name||""} ${S.last_name||""}`.trim()||S.email.split("@")[0],E=async()=>{const S=await p.mutateAsync({email:r.trim(),firstName:u.trim()||void 0,lastName:f.trim()||void 0});e(S),i(""),c(!1)};return s.jsxs(Lu,{className:"border border-border rounded-lg",shouldFilter:!1,children:[s.jsx(Gb,{placeholder:n,value:r,onValueChange:i,className:"h-11"}),s.jsx(Fu,{children:r.length<2?s.jsxs("div",{className:"py-6 text-center text-sm text-muted-foreground",children:[s.jsx(_o,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),"Tapez au moins 2 caractères"]}):y?s.jsxs("div",{className:"py-6 text-center text-sm text-muted-foreground",children:[s.jsx(We,{className:"w-6 h-6 mx-auto mb-2 animate-spin"}),"Recherche..."]}):_?s.jsxs("div",{className:"p-3 space-y-3",children:[s.jsx("p",{className:"text-sm text-center text-muted-foreground",children:"Aucun utilisateur trouvé"}),w&&!l&&s.jsxs(Q,{variant:"outline",size:"sm",className:"w-full gap-2 border-dashed border-primary/40 text-primary hover:bg-primary/5",onClick:()=>c(!0),children:[s.jsx(cs,{className:"w-4 h-4"}),"Créer un compte pour ",r.trim()]}),w&&l&&s.jsxs("div",{className:"space-y-2 rounded-lg border border-border/60 bg-muted/30 p-3",children:[s.jsxs("p",{className:"text-xs font-medium text-foreground",children:["Nouveau compte : ",r.trim()]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx(Ue,{placeholder:"Prénom (optionnel)",value:u,onChange:S=>d(S.target.value),className:"h-9 text-sm",autoFocus:!0}),s.jsx(Ue,{placeholder:"Nom (optionnel)",value:f,onChange:S=>h(S.target.value),className:"h-9 text-sm"})]}),s.jsx(Q,{size:"sm",className:"w-full gap-2",onClick:E,disabled:p.isPending,children:p.isPending?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 animate-spin"}),"Création..."]}):s.jsxs(s.Fragment,{children:[s.jsx(cs,{className:"w-4 h-4"}),"Créer et sélectionner"]})})]})]}):s.jsx(ml,{children:b.map(S=>s.jsx(Oa,{value:S.id,onSelect:()=>{e(S),i("")},className:"cursor-pointer",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"font-medium",children:j(S)}),s.jsx("span",{className:"text-xs text-muted-foreground",children:S.email})]})},S.id))})})]})}function GVe({venueId:e,venueName:t,currentStaffIds:n,open:r,onOpenChange:i}){const[a,o]=N.useState(null),[l,c]=N.useState("staff"),u=_8e(),d=async()=>{a&&(await u.mutateAsync({venueId:e,userId:a.id,role:l}),o(null),c("staff"),i(!1))},f=()=>{o(null),c("staff"),i(!1)},h=p=>p.display_name?p.display_name:`${p.first_name||""} ${p.last_name||""}`.trim()||p.email.split("@")[0];return s.jsx(Ln,{open:r,onOpenChange:f,children:s.jsxs(Dn,{className:"sm:max-w-md",children:[s.jsxs(Un,{children:[s.jsxs(qn,{className:"flex items-center gap-2",children:[s.jsx(cs,{className:"w-5 h-5 text-primary"}),"Ajouter un membre"]}),s.jsxs(qr,{children:["Ajouter un membre à l'équipe de ",t]})]}),s.jsxs("div",{className:"space-y-6 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{children:"Rechercher un utilisateur"}),a?s.jsxs("div",{className:"flex items-center justify-between p-3 bg-secondary/50 rounded-lg border border-border",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center",children:s.jsx(Cs,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-sm",children:h(a)}),s.jsx("p",{className:"text-xs text-muted-foreground",children:a.email})]})]}),s.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>o(null),children:s.jsx(Er,{className:"w-4 h-4"})})]}):s.jsx(WVe,{onSelect:o,excludeUserIds:n})]}),a&&s.jsxs("div",{className:"space-y-3",children:[s.jsx(Fe,{children:"Rôle"}),s.jsxs(ud,{value:l,onValueChange:p=>c(p),className:"space-y-3",children:[s.jsxs("label",{htmlFor:"role-manager",className:"flex items-start gap-3 p-3 rounded-lg border border-border 
1363cursor-pointer hover:bg-muted/50 transition-colors has-[:checked]:border-primary has-[:checked]:bg-primary/5",children:[s.jsx(ui,{value:"manager",id:"role-manager"}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(sa,{className:"w-4 h-4 text-primary"}),s.jsx("span",{className:"font-medium text-sm",children:"Manager"})]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Gestion complète du lieu et des événements"})]})]}),s.jsxs("label",{htmlFor:"role-staff",className:"flex items-start gap-3 p-3 rounded-lg border border-border cursor-pointer hover:bg-muted/50 transition-colors has-[:checked]:border-primary has-[:checked]:bg-primary/5",children:[s.jsx(ui,{value:"staff",id:"role-staff"}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Cs,{className:"w-4 h-4 text-muted-foreground"}),s.jsx("span",{className:"font-medium text-sm",children:"Staff"})]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Check-in et consommations uniquement"})]})]})]})]})]}),s.jsxs(Pi,{children:[s.jsx(Q,{variant:"outline",onClick:f,children:"Annuler"}),s.jsx(Q,{onClick:d,disabled:!a||u.isPending,children:u.isPending?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),"Ajout..."]}):"Ajouter à l'équipe"})]})]})})}const k_="#C4B5FD",KVe=/^#([0-9a-fA-F]{6})$/;function YVe({venue:e}){const{toast:t}=_r(),n=Lie(),[r,i]=N.useState(e.district_label||""),[a,o]=N.useState(e.brand_color||k_),[l,c]=N.useState(!1),[u,d]=N.useState(!1),[f,h]=N.useState(!1),p=N.useRef(null),x=N.useRef(null),y=(r||e.name||"").toUpperCase(),b=e.logo_url,w=e.cover_image_url,_=(e.name||"??").split(" ").map(O=>O[0]).join("").slice(0,2).toUpperCase(),j=KVe.test(a),E=async()=>{if(!j){t({title:"Couleur invalide",description:"Le format attendu est #RRGGBB (ex. #C4B5FD).",variant:"destructive"});return}c(!0);try{await n.mutateAsync({id:e.id,district_label:r.trim()||null,brand_color:a})}finally{c(!1)}},S=()=>o(k_),T=async(O,D)=>{if(!O.type.startsWith("image/")){t({title:"Format invalide",description:"Veuillez sélectionner une image.",variant:"destructive"});return}const R=D==="logo"?d:h;R(!0);try{const L=O.name.split(".").pop()||"png",M=`${e.id}/${D}.${L}`,{error:B}=await re.storage.from("venue-images").upload(M,O,{upsert:!0});if(B)throw B;const{data:{publicUrl:U}}=re.storage.from("venue-images").getPublicUrl(M),F=`${U}?t=${Date.now()}`,H=D==="logo"?{logo_url:F}:{cover_image_url:F};await n.mutateAsync({id:e.id,...H})}catch(L){t({title:"Erreur",description:L.message,variant:"destructive"})}finally{R(!1),D==="logo"&&p.current&&(p.current.value=""),D==="cover"&&x.current&&(x.current.value="")}},P=async O=>{const D=O==="logo"?{logo_url:null}:{cover_image_url:null};await n.mutateAsync({id:e.id,...D})};return s.jsxs(Se,{className:"border-border/50",children:[s.jsx(kt,{children:s.jsxs(Et,{className:"font-display text-lg flex items-center gap-2",children:[s.jsx(Ti,{className:"w-5 h-5 text-primary"}),"Identité visuelle (carte d'accueil)"]})}),s.jsxs(De,{className:"space-y-6",children:[s.jsxs("div",{className:"grid md:grid-cols-[280px_1fr] gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{className:"text-xs text-muted-foreground",children:"Aperçu"}),s.jsxs("div",{className:"relative aspect-square w-full max-w-[280px] rounded-2xl overflow-hidden shadow-lg",style:{backgroundColor:j?a:k_},children:[s.jsx("div",{className:"absolute top-2 right-3 text-right",style:{color:"#0D0D0D"},children:s.jsx("div",{className:"font-mono text-[11px] tracking-[0.2em] font-bold uppercase opacity-80",children:"15 MARS"})}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center px-4",children:s.jsxs("div",{className:"relative flex items-center w-full justify-center",children:[s.jsx("div",{className:"aspect-square rounded-full bg-black flex items-center justify-center overflow-hidden ring-1 ring-black/5",style:{width:"44%",marginRight:"-14%"},children:b?s.jsx("img",{src:b,alt:"",className:"w-full h-full object-cover"}):s.jsx("span",{className:"text-xl font-black text-white opacity-70",children:_})}),s.jsx("div",{className:"aspect-square rounded-full bg-white/60 flex items-center justify-center overflow-hidden shadow-2xl ring-2 ring-black/10 z-10",style:{width:"54%"},children:w?s.jsx("img",{src:w,alt:"",className:"w-full h-full object-cover"}):s.jsx("span",{className:"text-2xl font-black",style:{color:"#0D0D0D"},children:_})})]})}),s.jsx("div",{className:"absolute bottom-3 left-4 right-4",children:s.jsx("div",{className:"font-display text-xl sm:text-2xl font-black leading-none truncate",style:{color:"#0D0D0D"},title:y,children:y})})]})]}),s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"district_label",children:"Label d'arrondissement / quartier"}),s.jsx(Ue,{id:"district_label",value:r,onChange:O=>i(O.target.value),placeholder:"ex. MONTMARTRE"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Affiché en gros en bas-gauche de la card. Vide = nom du lieu en majuscules."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"brand_color",children:"Couleur de fond"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"color",value:j?a:k_,onChange:O=>o(O.target.value.toUpperCase()),className:"h-10 w-12 rounded-md border border-input cursor-pointer bg-transparent","aria-label":"Sélecteur de couleur"}),s.jsx(Ue,{id:"brand_color",value:a,onChange:O=>o(O.target.value),placeholder:"#C4B5FD",className:"font-mono uppercase max-w-[160px]"}),s.jsxs(Q,{type:"button",variant:"ghost",size:"sm",onClick:S,className:"gap-1.5",children:[s.jsx(Il,{className:"w-3.5 h-3.5"}),"Réinitialiser"]}
1363)]}),!j&&s.jsx("p",{className:"text-xs text-destructive",children:"Format attendu : #RRGGBB"})]}),s.jsxs(Q,{onClick:E,disabled:l||!j,className:"gap-2",children:[l&&s.jsx(We,{className:"w-4 h-4 animate-spin"}),"Enregistrer label & couleur"]})]})]}),s.jsx(Fs,{}),s.jsxs("div",{className:"grid sm:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(Fe,{children:"Logo (rond arrière)"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-20 h-20 rounded-full bg-black flex items-center justify-center overflow-hidden ring-1 ring-border flex-shrink-0",children:b?s.jsx("img",{src:b,alt:"",className:"w-full h-full object-cover"}):s.jsx("span",{className:"text-sm font-black text-white opacity-60",children:_})}),s.jsx("input",{ref:p,type:"file",accept:"image/*",className:"hidden",onChange:O=>{var R;const D=(R=O.target.files)==null?void 0:R[0];D&&T(D,"logo")}}),s.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:()=>{var O;return(O=p.current)==null?void 0:O.click()},disabled:u,className:"gap-2",children:[u?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(a2,{className:"w-4 h-4"}),"Remplacer"]}),b&&s.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>P("logo"),"aria-label":"Supprimer le logo",children:s.jsx(ua,{className:"w-4 h-4 text-destructive"})})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(Fe,{children:"Photo (rond avant)"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-20 h-20 rounded-full bg-muted flex items-center justify-center overflow-hidden ring-1 ring-border flex-shrink-0",children:w?s.jsx("img",{src:w,alt:"",className:"w-full h-full object-cover"}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"Photo"})}),s.jsx("input",{ref:x,type:"file",accept:"image/*",className:"hidden",onChange:O=>{var R;const D=(R=O.target.files)==null?void 0:R[0];D&&T(D,"cover")}}),s.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:()=>{var O;return(O=x.current)==null?void 0:O.click()},disabled:f,className:"gap-2",children:[f?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(a2,{className:"w-4 h-4"}),"Importer"]}),w&&s.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>P("cover"),"aria-label":"Supprimer la photo",children:s.jsx(ua,{className:"w-4 h-4 text-destructive"})})]})]})]})]})]})}const O4=[{key:"description",label:"Description"},{key:"phone",label:"Téléphone"},{key:"website_url",label:"Site web"},{key:"google_maps_url",label:"URL Google Maps"},{key:"instagram_url",label:"Instagram"},{key:"brand_color",label:"Couleur de marque"},{key:"logo_url",label:"Logo"},{key:"price_range",label:"Gamme de prix"},{key:"rating_google",label:"Note Google"},{key:"rating_count",label:"Nombre d'avis"},{key:"opening_hours_summary",label:"Horaires (résumé)"},{key:"address",label:"Adresse"},{key:"city",label:"Ville"},{key:"postal_code",label:"Code postal"},{key:"country",label:"Pays"},{key:"latitude",label:"Latitude"},{key:"longitude",label:"Longitude"}];function My(e){return e==null||typeof e=="string"&&e.trim()===""}function Uz(e){return e==null?"—":typeof e=="string"?e.length>120?e.slice(0,117)+"…":e:Array.isArray(e)?e.join(", "):String(e)}function XVe({venue:e}){var U,F,H,z,K,W;const{toast:t}=_r(),n=Ye(),[r,i]=N.useState(!1),[a,o]=N.useState(!1),[l,c]=N.useState(null),[u,d]=N.useState(!1),[f,h]=N.useState(!0),[p,x]=N.useState({}),[y,b]=N.useState({}),[w,_]=N.useState(!0),[j,E]=N.useState(!0),[S,T]=N.useState(!0),[P,O]=N.useState(!0),[D,R]=N.useState(!0),L=async()=>{i(!0),c(null);try{const{data:q,error:oe}=await re.functions.invoke("venue-enrich-auto",{body:{venue_id:e.id,download_photos:f}});if(oe)throw oe;const J=q==null?void 0:q.draft;if(!J)throw new Error("Réponse invalide");c(J);const Y={};for(const G of O4){const se=e[G.key],ce=J[G.key];My(ce)||(Y[G.key]=u||My(se))}x(Y);const Z={};for(const G of J.photo_gallery_additions??[])Z[G.url]=!0;b(Z),t({title:"Enrichissement terminé",description:"Sélectionnez les champs à appliquer."})}catch(q){const oe=(q==null?void 0:q.message)??String(q),J=q!=null&&q.context?await q.context.text().catch(()=>""):"";t({title:"Enrichissement échoué",description:`${oe}${J?` — ${J.slice(0,200)}`:""}`,variant:"destructive"})}finally{i(!1)}},M=async()=>{var q,oe,J;if(l){o(!0);try{const Y={};for(const ce of O4)p[ce.key]&&(Y[ce.key]=l[ce.key]);l.google_place_id&&(Y.google_place_id=l.google_place_id),w&&((q=l.nearest_stations)!=null&&q.length)&&(Y.nearest_stations=l.nearest_stations),j&&((oe=l.themes)!=null&&oe.length)&&(Y.themes=l.themes),S&&((J=l.ambiance)!=null&&J.length)&&(Y.ambiance=l.ambiance),P&&l.o
1363pening_hours&&(Y.opening_hours=l.opening_hours),D&&l.accessibility&&(Y.accessibility=l.accessibility);const Z=Array.isArray(e.photo_gallery)?e.photo_gallery:[],G=(l.photo_gallery_additions??[]).filter(ce=>y[ce.url]);if(G.length&&(Y.photo_gallery=[...Z,...G]),My(e.cover_image_url)&&G[0]&&(Y.cover_image_url=G[0].url),My(e.image_url)&&G[0]&&(Y.image_url=G[0].url),Object.keys(Y).length===0){t({title:"Rien à appliquer",description:"Aucun champ sélectionné."}),o(!1);return}const{error:se}=await re.from("venues").update(Y).eq("id",e.id);if(se)throw se;t({title:"Lieu enrichi",description:`${Object.keys(Y).length} champ(s) mis à jour.`}),await n.invalidateQueries({queryKey:["venue",e.id]}),await n.invalidateQueries({queryKey:["venues"]}),c(null)}catch(Y){t({title:"Erreur",description:Y.message,variant:"destructive"})}finally{o(!1)}}},B=e.enrichment_status;return s.jsxs(Se,{className:"border-primary/30 bg-primary/5",children:[s.jsx(kt,{children:s.jsxs(Et,{className:"flex items-center gap-2",children:[s.jsx(Ti,{className:"w-5 h-5 text-primary"}),"Enrichissement automatique",B&&B!=="idle"&&s.jsx(we,{variant:"outline",className:"ml-2 uppercase text-[10px]",children:B})]})}),s.jsxs(De,{className:"space-y-4",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Récupère automatiquement description, photos, métros à proximité, horaires, note Google, coordonnées, logo, couleur et thématique depuis Google Places et le site web du lieu, puis fusionne le tout avec l'IA."}),s.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ya,{id:"download_photos",checked:f,onCheckedChange:q=>h(q===!0)}),s.jsx(Fe,{htmlFor:"download_photos",className:"text-sm",children:"Télécharger les photos Google"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ya,{id:"overwrite",checked:u,onCheckedChange:q=>d(q===!0)}),s.jsx(Fe,{htmlFor:"overwrite",className:"text-sm",children:"Pré-cocher aussi les champs déjà remplis"})]}),s.jsxs(Q,{onClick:L,disabled:r,className:"gap-2 ml-auto",children:[r?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(Ti,{className:"w-4 h-4"}),l?"Relancer":"Enrichir maintenant"]})]}),l&&s.jsxs("div",{className:"space-y-5",children:[s.jsx(Fs,{}),s.jsxs("div",{className:"text-xs text-muted-foreground flex items-start gap-2",children:[s.jsx(wl,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),s.jsx("span",{children:"Cochez les champs à appliquer. Les valeurs déjà présentes restent inchangées sauf si vous cochez leur suggestion."})]}),s.jsx("div",{className:"space-y-2",children:O4.map(q=>{const oe=e[q.key],J=l[q.key];if(My(J))return null;const Y=JSON.stringify(oe??null)!==JSON.stringify(J??null);return s.jsxs("div",{className:`flex items-start gap-3 p-2 rounded border ${Y?"border-primary/40 bg-background":"border-transparent"}`,children:[s.jsx(ya,{id:`f-${q.key}`,checked:!!p[q.key],onCheckedChange:Z=>x(G=>({...G,[q.key]:Z===!0})),className:"mt-0.5"}),s.jsxs("div",{className:"flex-1 grid grid-cols-1 md:grid-cols-[140px_1fr_1fr] gap-2 text-sm",children:[s.jsx(Fe,{htmlFor:`f-${q.key}`,className:"font-medium",children:q.label}),s.jsxs("div",{className:"text-muted-foreground",children:[s.jsx("span",{className:"text-[10px] uppercase mr-1",children:"actuel"}),Uz(oe)]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-[10px] uppercase mr-1 text-primary",children:"suggéré"}),q.key==="brand_color"&&typeof J=="string"?s.jsxs("span",{className:"inline-flex items-center gap-2",children:[s.jsx("span",{className:"inline-block w-4 h-4 rounded border",style:{background:J}}),J]}):Uz(J)]})]})]},q.key)})}),((U=l.themes)==null?void 0:U.length)>0&&s.jsxs("div",{className:"flex items-start gap-3 p-2 rounded border border-primary/40",children:[s.jsx(ya,{id:"themes",checked:j,onCheckedChange:q=>E(q===!0),className:"mt-0.5"}),s.jsxs("div",{className:"flex-1",children:[s.jsxs(Fe,{htmlFor:"themes",className:"font-medium flex items-center gap-2",children:[s.jsx(_xe,{className:"w-4 h-4"})," Thématiques"]}),s.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:l.themes.map(q=>s.jsx(we,{variant:"secondary",children:q},q))})]})]}),((F=l.ambiance)==null?void 0:F.length)>0&&s.jsxs("div",{className:"flex items-start gap-3 p-2 rounded border border-primary/40",children:[s.jsx(ya,{id:"ambiance",checked:S,onCheckedChange:q=>T(q===!0),className:"mt-0.5"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(Fe,{htmlFor:"ambiance",className:"font-medium",children:"Ambiance"}),s.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:l.ambiance.map(q=>s.jsx(we,{variant:"outline",children:q},q))})]})]}),((H=l.nearest_stations)==null?void 0:H.length)>0&&s.jsxs("div",{className:"flex items-start gap-3 p-2 rounded border border-primary/40",children:[s.jsx(ya,{id:"stations",checked:w,onCheckedChange:q=>_(q===!0),className:"mt-0.5"}),s.jsxs("div",{className:"flex-1",children:[s.jsxs(Fe,{htmlFor:"stations",className:"font-medium flex items-center gap-2",children:[s.jsx(Nxe,{className:"w-4 h-4"})," Stations proches"]}
1363),s.jsx("ul",{className:"text-sm mt-1 space-y-0.5",children:l.nearest_stations.map((q,oe)=>s.jsxs("li",{className:"text-muted-foreground",children:[s.jsx("span",{className:"text-foreground font-medium",children:q.name})," — ",q.distance_m," m · ~",q.walk_min," min à pied"]},oe))})]})]}),((K=(z=l.opening_hours)==null?void 0:z.weekday_descriptions)==null?void 0:K.length)>0&&s.jsxs("div",{className:"flex items-start gap-3 p-2 rounded border border-primary/40",children:[s.jsx(ya,{id:"opening",checked:P,onCheckedChange:q=>O(q===!0),className:"mt-0.5"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(Fe,{htmlFor:"opening",className:"font-medium",children:"Horaires détaillés"}),s.jsx("ul",{className:"text-xs mt-1 text-muted-foreground space-y-0.5",children:l.opening_hours.weekday_descriptions.map((q,oe)=>s.jsx("li",{children:q},oe))})]})]}),l.accessibility&&Object.keys(l.accessibility).length>0&&s.jsxs("div",{className:"flex items-start gap-3 p-2 rounded border border-primary/40",children:[s.jsx(ya,{id:"access",checked:D,onCheckedChange:q=>R(q===!0),className:"mt-0.5"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(Fe,{htmlFor:"access",className:"font-medium",children:"Accessibilité"}),s.jsx("div",{className:"text-xs mt-1 text-muted-foreground",children:Object.entries(l.accessibility).filter(([,q])=>q===!0).map(([q])=>q).join(", ")||"aucune info explicite"})]})]}),((W=l.photo_gallery_additions)==null?void 0:W.length)>0&&s.jsxs("div",{className:"p-2 rounded border border-primary/40",children:[s.jsxs(Fe,{className:"font-medium flex items-center gap-2",children:[s.jsx(rxe,{className:"w-4 h-4"})," Photos (Google Places)"]}),s.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-2 mt-2",children:l.photo_gallery_additions.map(q=>s.jsxs("label",{className:`relative block rounded overflow-hidden border cursor-pointer ${y[q.url]?"ring-2 ring-primary":""}`,children:[s.jsx("img",{src:q.url,alt:"",className:"w-full h-24 object-cover",loading:"lazy"}),s.jsx("input",{type:"checkbox",className:"absolute top-1 left-1 w-4 h-4",checked:!!y[q.url],onChange:oe=>b(J=>({...J,[q.url]:oe.target.checked}))}),q.credit&&s.jsxs("span",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-white text-[10px] px-1 py-0.5 truncate",children:["© ",q.credit]})]},q.url))})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(Q,{variant:"ghost",onClick:()=>c(null),disabled:a,children:"Annuler"}),s.jsxs(Q,{onClick:M,disabled:a,className:"gap-2",children:[a?s.jsx(We,{className:"w-4 h-4 animate-spin"}):null,"Appliquer la sélection"]})]})]})]})]})}const QVe=N.lazy(()=>ka(()=>import("./VenueMiniMap-BOfqyfgs.js"),[])),C_={draft:{label:"Brouillon",variant:"secondary"},published:{label:"Publié",variant:"default"},ongoing:{label:"En cours",variant:"default"},completed:{label:"Terminé",variant:"outline"},cancelled:{label:"Annulé",variant:"destructive"}};function JVe(){const{id:e}=Wi(),t=Rr(),[n,r]=N.useState(!1),[i,a]=N.useState(!1),[o,l]=N.useState(null),[c,u]=N.useState(null),[d,f]=N.useState(!1),[h,p]=N.useState(!1),x=N.useRef(null),{data:y,isLoading:b}=D6e(e),{data:w,isLoading:_}=Mie(e);Uie(e);const{data:j=[],isLoading:E}=Vse(e,10),{data:S=[]}=uRe(e),T=Lie(),P=Jie(),O=Zie(),{geocodeAddress:D,isGeocoding:R}=VVe(),{toast:L}=_r(),[M,B]=N.useState({name:"",address:"",city:"",postal_code:"",country:"",latitude:null,longitude:null,description:"",capacity:20,website_url:"",default_coupon_mode:"digital",default_paper_coupon_label:"",default_paper_coupon_description:"",default_paper_coupon_formulas:[]}),U=()=>{y&&(B({name:y.name,address:y.address,city:y.city,postal_code:y.postal_code||"",country:y.country||"",latitude:y.latitude||null,longitude:y.longitude||null,description:y.description||"",capacity:y.capacity||20,website_url:y.website_url||"",default_coupon_mode:y.default_coupon_mode==="paper"?"paper":"digital",default_paper_coupon_label:y.default_paper_coupon_label||"",default_paper_coupon_description:y.default_paper_coupon_description||"",default_paper_coupon_formulas:(()=>{const le=y.default_paper_coupon_formulas;return Array.isArray(le)?le.filter(fe=>fe&&typeof fe.name=="string"&&fe.name.trim()).map(fe=>({name:String(fe.name).trim(),description:typeof fe.description=="str
1363ing"?fe.description:""})):[]})()}),r(!0))},F=async()=>{if(!y)return;const le=M.default_paper_coupon_formulas.map(be=>({name:be.name.trim(),description:(be.description||"").trim()})).filter(be=>be.name),fe=xB(M.website_url);await T.mutateAsync({id:y.id,...M,website_url:fe,default_paper_coupon_label:M.default_paper_coupon_label.trim()||null,default_paper_coupon_description:M.default_paper_coupon_description.trim()||null,default_paper_coupon_formulas:le.length?le:null}),r(!1)},H=async()=>{!o||!e||(await P.mutateAsync({venueUserId:o.id,venueId:e}),l(null))},z=async()=>{if(!c||!e)return;const le=c.currentRole==="manager"?"staff":"manager";await O.mutateAsync({venueUserId:c.id,venueId:e,role:le}),u(null)},K=async()=>{if(!y)return;const le=await D(y.address,y.city);le?(await T.mutateAsync({id:y.id,latitude:le.latitude,longitude:le.longitude}),L({title:"Coordonnées mises à jour",description:"Le lieu apparaîtra maintenant sur la carte."})):L({title:"Adresse non trouvée",description:"Essayez de modifier l'adresse ou utilisez l'autocomplétion.",variant:"destructive"})},W=async le=>{if(y){if(!le.type.startsWith("image/")){L({title:"Format invalide",description:"Veuillez sélectionner une image.",variant:"destructive"});return}p(!0);try{const fe=le.name.split(".").pop(),be=`${y.id}/cover.${fe}`,{error:_e}=await re.storage.from("venue-images").upload(be,le,{upsert:!0});if(_e)throw _e;const{data:{publicUrl:pe}}=re.storage.from("venue-images").getPublicUrl(be);await T.mutateAsync({id:y.id,image_url:pe}),L({title:"Image mise à jour",description:"La photo du lieu a été enregistrée."})}catch(fe){L({title:"Erreur",description:fe.message,variant:"destructive"})}finally{p(!1),x.current&&(x.current.value="")}}},q=le=>{var be;const fe=(be=le.target.files)==null?void 0:be[0];fe&&W(fe)},[oe,J]=N.useState(!1),Y=le=>{le.preventDefault(),le.stopPropagation(),J(!0)},Z=le=>{le.preventDefault(),le.stopPropagation(),J(!1)},G=le=>{var be;le.preventDefault(),le.stopPropagation(),J(!1);const fe=(be=le.dataTransfer.files)==null?void 0:be[0];fe&&W(fe)},se=S.filter(le=>le.status==="completed"||le.status==="cancelled"),ce=(w==null?void 0:w.map(le=>le.user_id))||[];return b?s.jsxs("div",{className:"space-y-6",children:[s.jsx(Ie,{className:"h-8 w-48"}),s.jsx(Se,{className:"border-border/50",children:s.jsxs(De,{className:"p-6",children:[s.jsx(Ie,{className:"h-6 w-64 mb-4"}),s.jsx(Ie,{className:"h-4 w-full mb-2"}),s.jsx(Ie,{className:"h-4 w-3/4"})]})})]}):y?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[s.jsx(Q,{variant:"ghost",size:"icon",className:"shrink-0",onClick:()=>t("/admin/venues"),children:s.jsx(Fn,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h1",{className:"font-display text-xl sm:text-2xl font-bold text-foreground break-words",children:y.name}),s.jsx(we,{variant:y.is_active?"default":"secondary",children:y.is_active?"Actif":"Inactif"})]}),s.jsx("p",{className:"text-muted-foreground truncate",children:y.city})]}),s.jsxs("div",{className:"flex w-full sm:w-auto items-center gap-2",children:[s.jsx(Pe,{to:`/venues/${y.slug||y.id}`,target:"_blank",className:"flex-1 sm:flex-none",children:s.jsxs(Q,{variant:"outline",size:"sm",className:"gap-2 w-full",children:[s.jsx(pd,{className:"w-4 h-4"}),"Page publique"]})}),!n&&s.jsxs(Q,{variant:"outline",size:"sm",onClick:U,className:"gap-2 flex-1 sm:flex-none",children:[s.jsx(oI,{className:"w-4 h-4"}),"Modifier"]})]})]}),s.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"lg:col-span-2 min-w-0 space-y-6",children:[s.jsxs(Se,{className:`border-border/50 overflow-hidden relative transition-all ${oe?"ring-2 ring-primary border-primary":""}`,onDragOver:Y,onDragEnter:Y,onDragLeave:Z,onDrop:G,children:[s.jsx("input",{ref:x,type:"file",accept:"image/*",className:"hidden",onChange:q}),oe&&s.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 bg-background/80 backdrop-blur-sm border-2 border-dashed border-primary rounded-lg",children:[s.jsx(w5,{className:"w-8 h-8 text-primary"}),s.jsx("span",{className:"text-sm font-semibold text-primary",children:"Déposez l'image ici"})]}),y.image_url?s.jsxs("div",{className:"relative group",children:[s.jsx("img",{src:y.image_url,alt:y.name,className:"w-full h-48 object-cover"}),s.jsxs("button",{onClick:()=>{var le;return(le=x.current)==null?void 0:le.click()},disabled:h,className:"absolute inset-x-0 bottom-0 sm:inset-0 bg-black/60 sm:bg-black/40 sm:opacity-0 sm:group-hover:opacity-100 focus-visible:opacity-100 transition-opacity flex items-center justify-center gap-2 py-2 sm:py-0 text-sm sm:text-base text-white font-medium",children:[h?s.jsx(We,{className:"w-5 h-5 animate-spin"}):s.jsx(kf,{className:"w-5 h-5"}),"Changer la photo"]})]}):s.jsxs("button",{onClick:()=>{var le;return(le=x.current)==null?void 0:le.click()},disabled:h,className:"w-full h-36 flex flex-col items-center justify-center gap-2 text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",children:[h?s.jsx(We,{className:"w-6 h-6 animate-spin"}):s.jsx(w5,{className:"w-6 h-6"}),s.jsx("span",{className:"text-sm font-medium",children:"Glissez-déposez ou cliquez pour ajouter une photo"})]})]}),s.jsx(YVe,{venue:y}),s.jsx(XVe,{venue:y}),s.jsxs(Se,{className:"border-border/50",children:[s.jsx(kt,{children:s.jsxs(Et,{className:"flex items-center gap-2",children:[s.jsx(Vi,{className:"w-5 h-5 text-primary"}),"Informations"]})}),s.jsx(De,{className:"space-y-4",children:n?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{children:"Nom du lieu"}),s.jsx(Ue,{value:M.name,onChange:le=>B(fe=>({...fe,name:le.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{children:"Adresse"}),s.jsx(PR,{value:M.address,onChange:le=>B(fe=>({...fe,address:le})),onSelect:le=>B(fe=>{var be,_e;return{...fe,address:le.address,city:le.city||fe.city,postal_code:le.postalCode||"",country:le.country||"",latitude:((be=le.coordinates)==null?void 0:be[0])||null,longitude:((_e=le.coordinates)==null?void 0:_e[1])||null}}),placeholder:"Rechercher l'adresse..."}),s.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[s.jsx(bv,{className:"w-3 h-3"}),"Sélectionnez une suggestion pour capturer les coordonnées GPS automatiquement"]}),M.latitude&&M.longitude&&s.jsxs("p",{className:"text-xs text-success",children:["GPS : ",M.latitude.toFixed(4),", ",M.longitude.toFixed(4)]})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{children:"Ville"}),s.jsx(Ue,{value:M.city,onChange:le=>B(fe=>({...fe,city:le.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{children:"Capacité"}),s.jsx(Ue,{type:"number",min:1,value:M.capacity,onChange:le=>B(fe=>({...fe,capacity:parseInt(le.target.value)||20}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{children:"Description"}),s.jsx($s,{value:M.description,onChange:le=>B(fe=>({...fe,description:le.target.value})),rows:3})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{children:"Site web du lieu"}),s.jsx(Ue,{type:"url",inputMode:"url",placeholder:"https://exemple.com",value:M.website_url,onChange:le=>B(fe=>
1363({...fe,website_url:le.target.value})),onBlur:le=>{const fe=xB(le.target.value);fe&&fe!==le.target.value&&B(be=>({...be,website_url:fe}))}}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Affiché publiquement sur la fiche du lieu et les pages tournoi (lien sortant)."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{children:"Mode coupon par défaut"}),s.jsxs("select",{className:"w-full h-10 rounded-md border border-input bg-background px-3 text-sm",value:M.default_coupon_mode,onChange:le=>B(fe=>({...fe,default_coupon_mode:le.target.value})),children:[s.jsx("option",{value:"digital",children:"Crédit digital (suivi in-app)"}),s.jsx("option",{value:"paper",children:"Coupon papier (remis au check-in)"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Mode appliqué par défaut aux nouveaux tournois. Chaque tournoi peut surcharger ce réglage."})]}),M.default_coupon_mode==="paper"&&s.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4 space-y-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-semibold",children:"🎟️ Valeurs par défaut du coupon papier"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Servent de point de départ aux nouveaux tournois. Chaque tournoi reste éditable indépendamment."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{className:"text-sm",children:"Intitulé par défaut"}),s.jsx(Ue,{placeholder:'Ex: "Formule Apéro" ou "Coupon 10€"',value:M.default_paper_coupon_label,onChange:le=>B(fe=>({...fe,default_paper_coupon_label:le.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{className:"text-sm",children:"Description libre par défaut"}),s.jsx($s,{rows:2,placeholder:"Ex: 1 bière 25cl + 1 planche apéro",value:M.default_paper_coupon_description,onChange:le=>B(fe=>({...fe,default_paper_coupon_description:le.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Fe,{className:"text-sm",children:"Formules au choix par défaut"}),M.default_paper_coupon_formulas.length<6&&s.jsx(Q,{type:"button",variant:"outline",size:"sm",onClick:()=>B(le=>({...le,default_paper_coupon_formulas:[...le.default_paper_coupon_formulas,{name:"",description:""}]})),children:"+ Ajouter"})]}),M.default_paper_coupon_formulas.length===0?s.jsx("p",{className:"text-xs text-muted-foreground",children:'Ex: "2 boissons" / "1 boisson + 1 plat".'}):M.default_paper_coupon_formulas.map((le,fe)=>s.jsxs("div",{className:"rounded-md border bg-card p-3 space-y-2",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[s.jsx(Ue,{placeholder:"Nom de la formule",value:le.name,onChange:be=>{const _e=[...M.default_paper_coupon_formulas];_e[fe]={..._e[fe],name:be.target.value},B(pe=>({...pe,default_paper_coupon_formulas:_e}))}}),s.jsx(Q,{type:"button",variant:"ghost",size:"sm",className:"self-end sm:self-auto shrink-0",onClick:()=>B(be=>({...be,default_paper_coupon_formulas:be.default_paper_coupon_formulas.filter((_e,pe)=>pe!==fe)})),children:"Supprimer"})]}),s.jsx(Ue,{placeholder:"Description (ex: 1 bière 25cl + 1 planche)",value:le.description,onChange:be=>{const _e=[...M.default_paper_coupon_formulas];_e[fe]={..._e[fe],description:be.target.value},B(pe=>({...pe,default_paper_coupon_formulas:_e}))}})]},fe))]})]}),s.jsxs("div",{className:"flex flex-col-reverse sm:flex-row gap-2 pt-2",children:[s.jsxs(Q,{variant:"outline",onClick:()=>r(!1),className:"gap-2 w-full sm:w-auto",children:[s.jsx(Er,{className:"w-4 h-4"}),"Annuler"]}),s.jsxs(Q,{onClick:F,disabled:T.isPending,className:"gap-2 w-full sm:w-auto",children:[T.isPending?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(cI,{className:"w-4 h-4"}),"Enregistrer"]})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(gn,{className:"w-5 h-5 text-muted-foreground mt-0.5 shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"font-medium break-words",children:y.address}),s.jsxs("p",{className:"text-sm text-muted-foreground break-words",children:[y.city,", ",y.country]})]})]}),s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(bv,{className:"w-5 h-5 text-muted-foreground mt-0.5 shrink-0"}),y.latitude&&y.longitude?s.jsxs("div",{className:"flex-1 min-w-0 space-y-3",children:[s.jsxs("p",{className:"text-sm text-success",children:["GPS : ",y.latitude.toFixed(4),", ",y.longitude.toFixed(4)]}),s.jsx(N.Suspense,{fallback:s.jsx(Ie,{className:"h-[200px] w-full rounded-xl"}),children:s.jsx(QVe,{latitude:y.latitude,longitude:y.longitude,venueName:y.name})})]}):s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("p",{className:"text-sm text-warning",children:"Coordonnées GPS manquantes"}),s.jsxs(Q,{variant:"outline",size:"sm",onClick:K,disabled:R,className:"gap-1 h-7",children:[R?s.jsx(We,{className:"w-3 h-3 animate-spin"}):s.jsx(bv,{className:"w-3 h-3"}),"Géocoder"]})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(sn,{className:"w-5 h-5 text-muted-foreground"}),s.jsxs("p",{children:["Capacité : ",s.jsx("span",{className:"font-medium",children:y.capacity})," personnes"]})]}),y.description&&s.jsx("div",{className:"pt-2 border-t border-border",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:y.description})}),(()=>{const le=y.website_url,fe=Eae(y);return!le&&!fe?null:s.jsxs("div",{className:"pt-2 border-t border-border flex flex-wrap gap-3 text-sm",children:[le&&s.jsxs("a",{href:le,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline underline-offset-4 break-all",children:["🌐 ",le.replace(/^https?:\/\//,"")]}),fe&&s.jsx("a",{href:fe,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline underline-offset-4",children:"🗺️ Voir sur Google Maps"})]})})()]})})]}),s.jsxs(Se,{className:"border-border/50",children:[s.jsxs(kt,{className:"flex flex-row flex-wrap items-center justify-between gap-2 space-y-0",children:[s.jsxs(Et,{className:"flex items-center gap-2 min-w-0",children:[s.jsx(Jn,{className:"w-5 h-5 text-primary shrink-0"}),s.jsx("span",{className:"truncate",children:"Événements à venir"})]}),s.jsxs(Q,{size:"sm",onClick:()=>f(!0),className:"gap-1.5 shrink-0",children:[s.jsx(qa,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Créer"})]})]}),s.jsx(De,{children:E?s.jsx("div",{className:"space-y-3",children:[1,2,3].map(le=>s.jsx(Ie,{className:"h-16 w-full"},le))}):j.length===0?s.jsxs("div",{className:"text-center py-8",children:[s.jsx(Jn,{className:"w-10 h-10 text-muted-foreground mx-auto mb-3"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Aucun événement à venir"}),s.jsxs(Q,{variant:"outline",onClick:()=>f(!0),className:"gap-2",children:[s.jsx(qa,{className:"w-4 h-4"}),"Créer un événement"]})]}):s.jsx("div",{className:"space-y-2",children:j.map(le=>{const fe=C_[le.status]||C_.draft;
1363return s.jsxs(Pe,{to:`/admin/events/${le.id}`,className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 p-3 rounded-lg hover:bg-muted/50 transition-colors group",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-medium truncate group-hover:text-primary transition-colors",children:le.title}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.jsx("span",{className:"sm:hidden",children:Ze(new Date(le.event_date),"d MMM 'à' HH'h'mm",{locale:pt})}),s.jsx("span",{className:"hidden sm:inline",children:Ze(new Date(le.event_date),"EEEE d MMMM 'à' HH'h'mm",{locale:pt})})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx(we,{variant:fe.variant,children:fe.label}),s.jsx(la,{className:"w-4 h-4 text-muted-foreground"})]})]},le.id)})})})]}),se.length>0&&s.jsxs(Se,{className:"border-border/50",children:[s.jsx(kt,{children:s.jsxs(Et,{className:"flex items-center gap-2 text-muted-foreground",children:[s.jsx(Jn,{className:"w-5 h-5"}),"Événements passés (",se.length,")"]})}),s.jsx(De,{children:s.jsx("div",{className:"space-y-2",children:se.slice(0,5).map(le=>{const fe=C_[le.status]||C_.draft;return s.jsxs(Pe,{to:`/admin/events/${le.id}`,className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 p-3 rounded-lg hover:bg-muted/50 transition-colors group opacity-70 hover:opacity-100",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-medium truncate group-hover:text-primary transition-colors",children:le.title}),s.jsx("p",{className:"text-sm text-muted-foreground",children:Ze(new Date(le.event_date),"d MMMM yyyy",{locale:pt})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx(we,{variant:fe.variant,children:fe.label}),s.jsx(la,{className:"w-4 h-4 text-muted-foreground"})]})]},le.id)})})})]})]}),s.jsxs("div",{className:"min-w-0 space-y-6",children:[s.jsxs(Se,{className:"border-border/50",children:[s.jsxs(kt,{className:"flex flex-row flex-wrap items-center justify-between gap-2 space-y-0 pb-4",children:[s.jsxs(Et,{className:"flex items-center gap-2 min-w-0",children:[s.jsx(sn,{className:"w-5 h-5 text-primary shrink-0"}),s.jsx("span",{className:"truncate",children:"Équipe"})]}),s.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>a(!0),className:"gap-2 shrink-0",children:[s.jsx(cs,{className:"w-4 h-4"}),"Ajouter"]})]}),s.jsxs(De,{children:[!_&&(w??[]).every(le=>le.role!=="manager")&&s.jsxs("div",{className:"mb-4 rounded-lg border border-warning/40 bg-warning/10 p-3",children:[s.jsxs("p",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[s.jsx(sa,{className:"w-4 h-4 text-warning shrink-0"}),"Aucun manager sur ce lieu"]}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Sans manager, le lieu ne peut pas gérer son équipe en autonomie.",(w??[]).length>0?" Promeus un membre existant via son menu d'actions.":" Ajoute un premier membre en tant que manager."]}),(w??[]).length===0&&s.jsxs(Q,{size:"sm",className:"mt-3 gap-2",onClick:()=>a(!0),children:[s.jsx(cs,{className:"w-4 h-4"}),"Inviter un manager"]})]}),_?s.jsx("div",{className:"space-y-3",children:[1,2].map(le=>s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ie,{className:"w-10 h-10 rounded-full"}),s.jsxs("div",{children:[s.jsx(Ie,{className:"h-4 w-24 mb-1"}),s.jsx(Ie,{className:"h-3 w-16"})]})]},le))}):(w==null?void 0:w.length)===0?s.jsxs("div",{className:"text-center py-6",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-muted flex items-center justify-center mx-auto mb-3",children:s.jsx(sn,{className:"w-6 h-6 text-muted-foreground"})}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Aucun membre dans l'équipe"})]}):s.jsx("div",{className:"space-y-2",children:w==null?void 0:w.map(le=>{var be,_e,pe;const fe=((be=le.profile)==null?void 0:be.display_name)||`${((_e=le.profile)==null?void 0:_e.first_name)||""} ${((pe=le.profile)==null?void 0:pe.last_name)||""}`.trim()||"Utilisateur";return s.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 group",children:[s.jsx("div",{className:"w-10 h-10 shrink-0 rounded-full bg-secondary flex items-center justify-center",children:le.role==="manager"?s.jsx(sa,{className:"w-5 h-5 text-primary"}):s.jsx(Cs,{className:"w-5 h-5 text-muted-foreground"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-medium text-sm truncate",children:fe}),s.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:le.role})]}),s.jsxs(eh,{children:[s.jsx(th,{asChild:!0,children:s.jsx(Q,{variant:"ghost",size:"icon","aria-label":"Actions membre",className:"shrink-0 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100 transition-opacity h-8 w-8",children:s.jsx(Cb,{className:"w-4 h-4"})})}),s.jsxs(yd,{align:"end",children:[s.jsxs(Dr,{onClick:()=>u({id:le.id,name:fe,currentRole:le.role}),children:[s.jsx(xo,{className:"w-4 h-4 mr-2"}),"Passer en ",le.role==="manager"?"Staff":"Manager"]}),s.jsx(Vu,{}),s.jsxs(Dr,{className:"text-destructive focus:text-destructive",onClick:()=>l({id:le.id,name:fe}),children:[s.jsx(ua,{className:"w-4 h-4 mr-2"}),"Retirer de l'équipe"]})]})]})]},le.id)})})]})]}),s.jsx(Qie,{venueId:y.id})]})]}),s.jsx(GVe,{venueId:e,venueName:y.name,currentStaffIds:ce,open:i,onOpenChange:a}),s.jsx(yr,{open:!!o,onOpenChange:le=>!le&&l(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Retirer ce membre ?"}),s.jsxs(lr,{children:["Êtes-vous sûr de vouloir retirer ",s.jsx("strong",{children:o==null?void 0:o.name}
1363)," de l'équipe de ",y.name," ?"]})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsxs(vr,{onClick:H,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[P.isPending?s.jsx(We,{className:"w-4 h-4 animate-spin mr-2"}):null,"Retirer"]})]})]})}),s.jsx(yr,{open:!!c,onOpenChange:le=>!le&&u(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Changer le rôle ?"}),s.jsxs(lr,{children:["Passer ",s.jsx("strong",{children:c==null?void 0:c.name})," de ",(c==null?void 0:c.currentRole)==="manager"?"Manager":"Staff"," à ",(c==null?void 0:c.currentRole)==="manager"?"Staff":"Manager"," ?"]})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsxs(vr,{onClick:z,children:[O.isPending?s.jsx(We,{className:"w-4 h-4 animate-spin mr-2"}):null,"Confirmer"]})]})]})}),y&&s.jsx(sw,{open:d,onOpenChange:f,preselectedVenueId:e,venueName:y.name})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx("p",{className:"text-muted-foreground",children:"Lieu non trouvé"}),s.jsx(Q,{variant:"link",onClick:()=>t("/admin/venues"),children:"Retour à la liste"})]})}const ZVe=50;function eHe(e){var i,a,o;const t=l1e({queryKey:["users",e],initialPageParam:0,queryFn:async({pageParam:l})=>{const{data:c,error:u}=await re.rpc("admin_list_users_with_auth",{p_search:e?hI(e):void 0,p_limit:ZVe,p_offset:l});if(u)throw u;if(!c||c.length===0)return{users:[],total:0};const d=c.map(x=>x.id),{data:f,error:h}=await re.from("user_roles").select("user_id, role").in("user_id",d);if(h)throw h;const p=c.map(x=>({...x,account_origin:x.account_origin??"self_signup",is_activated:!!x.last_sign_in_at,roles:(f||[]).filter(y=>y.user_id===x.id).map(y=>y.role)}));return{users:p,total:Number(c[0].total_count??p.length)}},getNextPageParam:(l,c)=>{const u=c.reduce((d,f)=>d+f.users.length,0);return u<l.total?u:void 0}}),n=((i=t.data)==null?void 0:i.pages.flatMap(l=>l.users))??[],r=((o=(a=t.data)==null?void 0:a.pages[0])==null?void 0:o.total)??0;return{...t,users:n,total:r}}function tHe(){return st({queryKey:["user-origin-stats"],queryFn:async()=>{const{data:e,error:t}=await re.rpc("admin_user_origin_stats");if(t)throw t;const n=e==null?void 0:e[0];return{total:(n==null?void 0:n.total)??0,activated:(n==null?void 0:n.activated)??0,autoCreated:((n==null?void 0:n.auto_checkout)??0)+((n==null?void 0:n.auto_walkin)??0)}}})}function nHe(){const e=Ye(),{toast:t}=_r();return dt({mutationFn:async({userId:n,role:r})=>{const{data:i}=await re.from("user_roles").select("id").eq("user_id",n).eq("role",r).maybeSingle();if(i)throw new Error("L'utilisateur a déjà ce rôle");const{data:a,error:o}=await re.from("user_roles").insert({user_id:n,role:r}).select().single();if(o)throw o;return a},onSuccess:()=>{e.invalidateQueries({queryKey:["users"]}),t({title:"Rôle ajouté",description:"Le rôle a été attribué à l'utilisateur."})},onError:n=>{t({title:"Erreur",description:n.message,variant:"destructive"})}})}function rHe(){const e=Ye(),{toast:t}=_r();return dt({mutationFn:async n=>{const{data:r,error:i}=await re.functions.invoke("admin-delete-user",{body:{target_user_id:n}});if(i)throw i;if(r!=null&&r.error)throw new Error(r.error);return r},onSuccess:()=>{e.invalidateQueries({queryKey:["users"]}),t({title:"Utilisateur supprimé",description:"Le compte et ses données associées ont été supprimés."})},onError:n=>{t({title:"Erreur",description:n.message||"Impossible de supprimer l'utilisateur.",variant:"destructive"})}})}function sHe(){const e=Ye(),{toast:t}=_r();return dt({mutationFn:async({userId:n,role:r})=>{const{error:i}=await re.from("user_roles").delete().eq("user_id",n).eq("role",r);if(i)throw i},onSuccess:()=>{e.invalidateQueries({queryKey:["users"]}),t({title:"Rôle retiré",description:"Le rôle a été retiré de l'utilisateur."})},onError:n=>{t({title:"Erreur",description:n.message,variant:"destructive"})}})}const dh=N.forwardRef(({className:e,...t},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:ae("w-full caption-bottom text-sm",e),...t})}));dh.displayName="Table";const fh=N.forwardRef(({className:e,...t},n)=>s.jsx("thead",{ref:n,className:ae("[&_tr]:border-b",e),...t}));fh.displayName="TableHeader";
1363const hh=N.forwardRef(({className:e,...t},n)=>s.jsx("tbody",{ref:n,className:ae("[&_tr:last-child]:border-0",e),...t}));hh.displayName="TableBody";const iHe=N.forwardRef(({className:e,...t},n)=>s.jsx("tfoot",{ref:n,className:ae("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));iHe.displayName="TableFooter";const Ls=N.forwardRef(({className:e,...t},n)=>s.jsx("tr",{ref:n,className:ae("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",e),...t}));Ls.displayName="TableRow";const ln=N.forwardRef(({className:e,...t},n)=>s.jsx("th",{ref:n,className:ae("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));ln.displayName="TableHead";const Lt=N.forwardRef(({className:e,...t},n)=>s.jsx("td",{ref:n,className:ae("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Lt.displayName="TableCell";const aHe=N.forwardRef(({className:e,...t},n)=>s.jsx("caption",{ref:n,className:ae("mt-4 text-sm text-muted-foreground",e),...t}));aHe.displayName="TableCaption";function oHe(){const e=Ye();return dt({mutationFn:async t=>{var i;const{data:n,error:r}=await re.functions.invoke("admin-create-user",{body:t});if(r){const a=r.context;let o=r.message;try{const l=await((i=a==null?void 0:a.json)==null?void 0:i.call(a));l!=null&&l.error&&(o=l.error)}catch{}throw new Error(o)}if(n!=null&&n.error)throw new Error(n.error);return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["users"]}),t.created?dn({title:"Utilisateur créé",description:`Compte créé pour ${n.email}. Email d'invitation envoyé.`}):t.rolesAdded.length>0?dn({title:"Rôles ajoutés",description:`Le compte ${n.email} existait déjà. Rôles ajoutés : ${t.rolesAdded.join(", ")}.`}):dn({title:"Aucun changement",description:`Le compte ${n.email} existait déjà avec ces rôles.`})},onError:t=>{dn({title:"Erreur",description:t.message,variant:"destructive"})}})}const lHe=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,cHe=[{value:"player",label:"Joueur",description:"Accès standard à la plateforme",Icon:KY},{value:"venue",label:"Lieu",description:"Peut être ajouté à l'équipe d'un lieu",Icon:Vi},{value:"admin",label:"Admin",description:"Accès total à la plateforme",Icon:sa}];function uHe({open:e,onOpenChange:t}){const[n,r]=N.useState(""),[i,a]=N.useState(""),[o,l]=N.useState(""),[c,u]=N.useState(new Set(["player"])),d=oHe(),f=()=>{r(""),a(""),l(""),u(new Set(["player"]))},h=()=>{f(),t(!1)},p=w=>{const _=new Set(c);_.has(w)?_.delete(w):_.add(w),u(_)},y=lHe.test(n.trim())&&c.size>0&&!d.isPending,b=async()=>{if(y)try{await d.mutateAsync({email:n.trim().toLowerCase(),firstName:i.trim()||void 0,lastName:o.trim()||void 0,roles:Array.from(c)}),h()}catch{}};return s.jsx(Ln,{open:e,onOpenChange:w=>w?t(!0):h(),children:s.jsxs(Dn,{className:"sm:max-w-md",children:[s.jsxs(Un,{children:[s.jsxs(qn,{className:"flex items-center gap-2",children:[s.jsx(cs,{className:"w-5 h-5 text-primary"}),"Créer un utilisateur"]}),s.jsx(qr,{children:"Un compte sera créé et un email d'invitation sera envoyé pour définir le mot de passe."})]}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"cu-email",children:"Email *"}),s.jsx(Ue,{id:"cu-email",type:"email",value:n,onChange:w=>r(w.target.value),placeholder:"[email protected]",autoFocus:!0})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"cu-first",children:"Prénom"}),s.jsx(Ue,{id:"cu-first",value:i,onChange:w=>a(w.target.value),placeholder:"Optionnel",maxLength:60})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"cu-last",children:"Nom"}),s.jsx(Ue,{id:"cu-last",value:o,onChange:w=>l(w.target.value),placeholder:"Optionnel",maxLength:60})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{children:"Rôles"}),s.jsx("div",{className:"space-y-2",children:cHe.map(({value:w,label:_,description:j,Icon:E})=>s.jsxs("label",{htmlFor:`cu-role-${w}`,className:"flex items-start gap-3 p-3 rounded-lg border border-border 
1363cursor-pointer hover:bg-muted/50 transition-colors has-[:checked]:border-primary has-[:checked]:bg-primary/5",children:[s.jsx(ya,{id:`cu-role-${w}`,checked:c.has(w),onCheckedChange:()=>p(w)}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(E,{className:"w-4 h-4 text-primary"}),s.jsx("span",{className:"font-medium text-sm",children:_})]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:j})]})]},w))})]})]}),s.jsxs(Pi,{children:[s.jsx(Q,{variant:"outline",onClick:h,children:"Annuler"}),s.jsx(Q,{onClick:b,disabled:!y,children:d.isPending?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),"Création..."]}):"Créer l'utilisateur"})]})]})})}const qz={self_signup:{label:"Inscription directe",className:"bg-emerald-500/15 text-emerald-500 border-emerald-500/30"},auto_checkout:{label:"Auto (checkout)",className:"bg-amber-500/15 text-amber-500 border-amber-500/30"},auto_walkin:{label:"Auto (sur place)",className:"bg-sky-500/15 text-sky-500 border-sky-500/30"},admin:{label:"Créé par admin",className:"bg-violet-500/15 text-violet-400 border-violet-500/30"}},Ly={admin:{label:"Admin",icon:sa,color:"bg-primary text-primary-foreground"},venue:{label:"Lieu",icon:Vi,color:"bg-accent text-accent-foreground"},player:{label:"Joueur",icon:KY,color:"bg-secondary text-secondary-foreground"}};function dHe(){var F,H;const{user:e}=Tt(),t=Rr(),[n,r]=N.useState(""),[i,a]=N.useState(""),[o,l]=N.useState(null),[c,u]=N.useState(null),[d,f]=N.useState(!1),[h,p]=N.useState(""),{users:x,total:y,isLoading:b,hasNextPage:w,fetchNextPage:_,isFetchingNextPage:j}=eHe(i||void 0),{data:E}=tHe(),S=nHe(),T=sHe(),P=rHe(),O=z=>{r(z),setTimeout(()=>a(z),300)},D=async()=>{o&&(o.type==="add"?await S.mutateAsync({userId:o.userId,role:o.role}):await T.mutateAsync({userId:o.userId,role:o.role}),l(null))},R=z=>new Date(z).toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"}),L=z=>z.display_name||`${z.first_name||""} ${z.last_name||""}`.trim()||z.email.split("@")[0],M=(E==null?void 0:E.activated)??0,B=(E==null?void 0:E.autoCreated)??0,U=z=>["player","venue","admin"].filter(K=>!z.includes(K));return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"font-display text-2xl font-bold text-foreground",children:"Gestion des utilisateurs"}),s.jsx("p",{className:"text-muted-foreground mt-1",children:i?`${y} résultat(s) sur ${(E==null?void 0:E.total)??y} utilisateur(s)`:`${y} utilisateur(s) enregistré(s)`}),s.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[s.jsxs(we,{variant:"outline",className:"bg-emerald-500/15 text-emerald-500 border-emerald-500/30",children:[M," activé(s) — déjà connecté(s)"]}),s.jsxs(we,{variant:"outline",className:"bg-amber-500/15 text-amber-500 border-amber-500/30",children:[B," auto-créé(s) — jamais connecté(s)"]})]})]}),s.jsxs(Q,{onClick:()=>f(!0),className:"gap-2",children:[s.jsx(qa,{className:"w-4 h-4"}),"Créer un utilisateur"]})]}),s.jsxs("div",{className:"relative max-w-md",children:[s.jsx(_o,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{placeholder:"Rechercher par nom, email...",value:n,onChange:z=>O(z.target.value),className:"pl-10"})]}),s.jsx(Se,{className:"border-border/50",children:s.jsx(De,{className:"p-0",children:b?s.jsx("div",{className:"p-6 space-y-4",children:[1,2,3,4,5].map(z=>s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(Ie,{className:"w-10 h-10 rounded-full"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(Ie,{className:"h-4 w-32 mb-2"}),s.jsx(Ie,{className:"h-3 w-48"})]}),s.jsx(Ie,{className:"h-6 w-20"})]},z))}):(x==null?void 0:x.length)===0?s.jsxs("div",{className:"p-12 text-center",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-4",children:s.jsx(Cs,{className:"w-8 h-8 text-muted-foreground"})}),s.jsx("h3",{className:"font-semibold text-foreground mb-1",children:n?"Aucun résultat":"Aucun utilisateur"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:n?"Essayez avec d'autres termes de recherche.":"Les utilisateurs apparaîtront ici."})]}):s.jsxs("div",{className:"overflow-x-auto",children:[s.jsx("div",{className:"min-w-[600px]",children:s.jsxs(dh,{children:[s.jsx(fh,{children:s.jsxs(Ls,{children:[s.jsx(ln,{children:"Utilisateur"}),s.jsx(ln,{children:"Email"}),s.jsx(ln,{className:"hidden xl:table-cell",children:"Club / FFE"}),s.jsx(ln,{children:"Rôles"}),s.jsx(ln,{children:"Inscrit le"}),s.jsx(ln,{className:"w-12"})]})}),s.jsx(hh,{children:x==null?void 0:x.map(z=>{var K,W;return s.jsxs(Ls,{className:"cursor-pointer",onClick:()=>t(`/admin/users/${z.id}`),children:[s.jsx(Lt,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-secondary flex items-center justify-center",children:s.jsx(Cs,{className:"w-5 h-5 text-muted-foreground"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"font-medium break-words hover:underline",children:L(z)}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[s.jsx(we,{variant:"outline",className:`text-[10px] ${((K=qz[z.account_origin])==null?void 0:K.className)??""}`,children:((W=qz[z.account_origin])==null?void 0:W.label)??z.account_origin}),!z.is_activated&&s.jsx(we,{variant:"outline",className:"text-[10px] text-muted-foreground",children:"Jamais connecté"})]})]})]})}),s.jsx(Lt,{className:"text-muted-foreground",children:z.email}),s.jsx(Lt,{className:"hidden xl:table-cell text-muted-foreground text-sm",children:s.jsxs("div",{className:"space-y-0.5",children:[z.club&&s.jsx("div",{children:z.club}),(z.code_ffe||z.code_fide)&&s.jsxs("div",{className:"text-xs",children:[z.code_ffe&&s.jsxs("span",{children:["FFE: ",z.code_ffe]}),z.code_ffe&&z.code_fide&&s.jsx("span",{children:" · "}),z.code_fide&&s.jsxs("span",{children:["FIDE: ",z.code_fide]})]}),!z.club&&!z.code_ffe&&!z.code_fide&&s.jsx("span",{children:"—"})]})}),s.jsx(Lt,{children:s.jsxs("div",{className:"flex flex-wrap gap-1",children:[z.roles.map(q=>{const oe=Ly[q],J=oe.icon;return s.jsxs(we,{variant:"outline",className:"gap-1",children:[s.jsx(J,{className:"w-3 h-3"}),oe.label]},q)}),z.roles.length===0&&s.jsx("span",{className:"text-muted-foreground text-sm",children:"Aucun"})]})}),s.jsx(Lt,{className:"text-muted-foreground text-sm",children:R(z.created_at)}),s.jsx(Lt,{onClick:q=>q.stopPropagation(),children:s.jsxs(eh,{children:[s.jsx(th,{asChild:!0,children:s.jsx(Q,{variant:"ghost",size:"icon",children:s.jsx(Cb,{className:"w-4 h-4"})})}),s.jsxs(yd,{align:"end",children:[s.jsx(gj,{children:"Actions"}),s.jsx(Vu,{}),U(z.roles).length>0&&s.jsxs(s.Fragment,{children:[s.jsx(gj,{className:"text-xs text-muted-foreground font-normal",children:"Ajouter un rôle"}),U(z.roles).map(q=>{const oe=Ly[q],J=oe.icon;return s.jsxs(Dr,{onClick:()=>l({type:"add",userId:z.id,role:q,userName:L(z)}),children:[s.jsx(qa,{className:"w-4 h-4 mr-2"}),s.jsx(J,{className:"w-4 h-4 mr-2"}),oe.label]},`add-${q}`)}),s.jsx(Vu,{})]}),z.roles.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(gj,{className:"text-xs text-muted-foreground font-normal",children:"Retirer un rôle"}),z.roles.map(q=>{const oe=Ly[q],J=oe.icon;return s.jsxs(Dr,{className:"text-destructive focus:text-destructive",onClick:()=>l({type:"remove",userId:z.id,role:q,userName:L(z)}),children:[s.jsx(ua,{className:"w-4 h-4 mr-2"}),s.jsx(J,{className:"w-4 h-4 mr-2"}),oe.label]},`remove-${q}`)})]}),s.jsx(Vu,{}),s.jsxs(Dr,{className:"text-destructive focus:text-destructive",disabled:z.id===(e==null?void 0:e.id),onClick:()=>{z.id!==(e==null?void 0:e.id)&&(p(""),u({userId:z.id,userName:L(z)}))},children:[s.jsx(ua,{className:"w-4 h-4 mr-2"}),"Supprimer l'utilisateur"]})]})]})})]},z.id)})})]})}),w&&s.jsxs("div",{className:"flex items-center justify-center gap-3 p-4 border-t border-border/50",children:[s.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.length," / ",y," affiché(s)"]}),s.jsx(Q,{variant:"outline",size:"sm",onClick:()=>_(),disabled:j,children:j?"Chargement…":"Charger plus"})]})]})})}),s.jsx(yr,{open:!!o,onOpenChange:()=>l(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:(o==null?void 0:o.type)==="add"?"Ajouter un rôle":"Retirer un rôle"}),s.jsx(lr,{children:(o==null?void 0:o.type)==="add"?`Voulez-vous attribuer le rôle "${(F=Ly[o.role])==null?void 0:F.label}" à ${o.userName} ?`:`Voulez-vous retirer le rôle "${(H=Ly[(o==null?void 0:o.role)||"player"])==null?void 0:H.label}" de ${o==null?void 0:o.userName} ?`})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsxs(vr,{onClick:D,className:(o==null?void 0:o.type)==="remove"?"bg-destructive hover:bg-destructive/90":"",disabled:S.isPending||T.isPending,children:[(S.isPending||T.isPending)&&s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),"Confirmer"]})]})]})}),s.jsx(yr,{open:!!c,onOpenChange:z=>{z||(u(null),p(""))},children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Supprimer définitivement l'utilisateur"}),s.jsxs(lr,{children:["Cette action est ",s.jsx("strong",{children:"irréversible"}),". Le compte de"," ",s.jsx("strong",{children:c==null?void 0:c.userName}),", son profil, ses rôles, ses statistiques et son historique seront supprimés. Les billets payés conservent leur traçabilité mais seront détachés de l'utilisateur.",s.jsx("br",{}),s.jsx("br",{}),"Pour confirmer, tapez ",s.jsx("strong",{children:"SUPPRIMER"})," ci-dessous."]})]}),s.jsx(Ue,{value:h,onChange:z=>
vendor: 6,405 bytes, line 1363
1363p(z.target.value),placeholder:"SUPPRIMER",autoFocus:!0}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsxs(vr,{className:"bg-destructive hover:bg-destructive/90",disabled:h!=="SUPPRIMER"||P.isPending,onClick:async z=>{if(z.preventDefault(),!!c)try{await P.mutateAsync(c.userId),u(null),p("")}catch{}},children:[P.isPending&&s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),"Supprimer définitivement"]})]})]})}),s.jsx(uHe,{open:d,onOpenChange:f})]})}var fHe=Array.isArray,ko=fHe,hHe=typeof Lo=="object"&&Lo&&Lo.Object===Object&&Lo,vle=hHe,mHe=vle,pHe=typeof self=="object"&&self&&self.Object===Object&&self,gHe=mHe||pHe||Function("return this")(),yu=gHe,xHe=yu,yHe=xHe.Symbol,fw=yHe,Vz=fw,ble=Object.prototype,vHe=ble.hasOwnProperty,bHe=ble.toString,Fy=Vz?Vz.toStringTag:void 0;function wHe(e){var t=vHe.call(e,Fy),n=e[Fy];try{e[Fy]=void 0;var r=!0}catch{}var i=bHe.call(e);return r&&(t?e[Fy]=n:delete e[Fy]),i}var _He=wHe,jHe=Object.prototype,NHe=jHe.toString;function kHe(e){return NHe.call(e)}var CHe=kHe,Hz=fw,EHe=_He,SHe=CHe,AHe="[object Null]",THe="[object Undefined]",Wz=Hz?Hz.toStringTag:void 0;function PHe(e){return e==null?e===void 0?THe:AHe:Wz&&Wz in Object(e)?EHe(e):SHe(e)}var kd=PHe;function OHe(e){return e!=null&&typeof e=="object"}var Cd=OHe,DHe=kd,IHe=Cd,RHe="[object Symbol]";function MHe(e){return typeof e=="symbol"||IHe(e)&&DHe(e)==RHe}var z0=MHe,LHe=ko,FHe=z0,$He=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,BHe=/^\w*$/;function zHe(e,t){if(LHe(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||FHe(e)?!0:BHe.test(e)||!$He.test(e)||t!=null&&e in Object(t)}var I6=zHe;function UHe(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var mh=UHe;const U0=dr(mh);var qHe=kd,VHe=mh,HHe="[object AsyncFunction]",WHe="[object Function]",GHe="[object GeneratorFunction]",KHe="[object Proxy]";function YHe(e){if(!VHe(e))return!1;var t=qHe(e);return t==WHe||t==GHe||t==HHe||t==KHe}var R6=YHe;const an=dr(R6);var XHe=yu,QHe=XHe["__core-js_shared__"],JHe=QHe,D4=JHe,Gz=function(){var e=/[^.]+$/.exec(D4&&D4.keys&&D4.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function ZHe(e){return!!Gz&&Gz in e}var eWe=ZHe,tWe=Function.prototype,nWe=tWe.toString;function rWe(e){if(e!=null){try{return nWe.call(e)}catch{}try{return e+""}catch{}}return""}var wle=rWe,sWe=R6,iWe=eWe,aWe=mh,oWe=wle,lWe=/[\\^$.*+?()[\]{}|]/g,cWe=/^\[object .+?Constructor\]$/,uWe=Function.prototype,dWe=Object.prototype,fWe=uWe.toString,hWe=dWe.hasOwnProperty,mWe=RegExp("^"+fWe.call(hWe).replace(lWe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function pWe(e){if(!aWe(e)||iWe(e))return!1;var t=sWe(e)?mWe:cWe;return t.test(oWe(e))}var gWe=pWe;function xWe(e,t){return e==null?void 0:e[t]}var yWe=xWe,vWe=gWe,bWe=yWe;function wWe(e,t){var n=bWe(e,t);return vWe(n)?n:void 0}var bp=wWe,_We=bp,jWe=_We(Object,"create"),lE=jWe,Kz=lE;function NWe(){this.__data__=Kz?Kz(null):{},this.size=0}var kWe=NWe;function CWe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var EWe=CWe,SWe=lE,AWe="__lodash_hash_undefined__",TWe=Object.prototype,PWe=TWe.hasOwnProperty;function OWe(e){var t=this.__data__;if(SWe){var n=t[e];return n===AWe?void 0:n}return PWe.call(t,e)?t[e]:void 0}var DWe=OWe,IWe=lE,RWe=Object.prototype,MWe=RWe.hasOwnProperty;function LWe(e){var t=this.__data__;return IWe?t[e]!==void 0:MWe.call(t,e)}var FWe=LWe,$We=lE,BWe="__lodash_hash_undefined__";function zWe(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=$We&&t===void 0?BWe:t,this}var UWe=zWe,qWe=kWe,VWe=EWe,HWe=DWe,WWe=FWe,GWe=UWe;function q0(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}q0.prototype.clear=qWe;q0.prototype.delete=VWe;q0.prototype.get=HWe;q0.prototype.has=WWe;q0.prototype.set=GWe;var KWe=q0;function YWe(){this.__data__=[],this.size=0}var XWe=YWe;function QWe(e,t){return e===t||e!==e&&t!==t}var M6=QWe,JWe=M6;function ZWe(e,t){for(var n=e.length;n--;)if(JWe(e[n][0],t))return n;return-1}var cE=ZWe,eGe=cE,tGe=Array.prototype,nGe=tGe.splice;function rGe(e){var t=this.__data__,n=eGe(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():nGe.call(t,n,1),--this.size,!0}var sGe=rGe,iGe=cE;function aGe(e){var t=this.__data__,n=iGe(t,e);return n<0?void 0:t[n][1]}var oGe=aGe,lGe=cE;function cGe(e){return lGe(this.__data__,e)>-1}var uGe=cGe,dGe=cE;function fGe(e,t){var n=this.__data__,r=dGe(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var hGe=fGe,mGe=XWe,pGe=sGe,gGe=oGe,xGe=uGe,yGe=hGe;function V0(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}V0.prototype.clear=mGe;V0.prototype.delete=pGe;V0.prototype.get=gGe;V0.prototype.has=xGe;V0.prototype.set=yGe;var uE=V0,vGe=bp,bGe=yu,wGe=vGe(bGe,"Map"),L6=wGe,Yz=KWe,_Ge=uE,jGe=L6;function NGe(){this.size=0,this.__data__={hash:new Yz,map:new(jGe||_Ge),string:new Yz}}var kGe=NGe;function CGe(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var EGe=CGe,SGe=EGe;function AGe(e,t){var n=e.__data__;return SGe(t)?n[typeof t=="string"?"string":"hash"]:n.map}var dE=AGe,TGe=dE;function PGe(e){var t=TGe(this,e).delete(e);return this.size-=t?1:0,t}var OGe=PGe,DGe=dE;function IGe(e){return DGe(this,e).get(e)}var RGe=IGe,MGe=dE;function LGe(e){return MGe(this,e).has(e)}var FGe=LGe,$Ge=dE;function BGe(e,t){var n=$Ge(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var zGe=BGe,UGe=kGe,qGe=OGe,VGe=RGe,HGe=FGe,WGe=zGe;function H0(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}H0.prototype.clear=UGe;H0.prototype.delete=qGe;H0.prototype.get=VGe;H0.prototype.has=HGe;H0.prototype.set=WGe;var F6=H0,_le=F6,GGe="Expected a function";function $6(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(GGe);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new($6.Cache||_le),n}$6.Cache=_le;var jle=$6;const KGe=dr(jle);var YGe=jle,XGe=500;function QGe(e){var t=YGe(e,function(r){return n.size===XGe&&n.clear(),r}),n=t.cache;return t}var JGe=QGe,ZGe=JGe,eKe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tKe=/\\(\\)?/g,nKe=ZGe(function(e){var t=[];
1363return e.charCodeAt(0)===46&&t.push(""),e.replace(eKe,function(n,r,i,a){t.push(i?a.replace(tKe,"$1"):r||n)}),t}),rKe=nKe;function sKe(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var B6=sKe,Xz=fw,iKe=B6,aKe=ko,oKe=z0,Qz=Xz?Xz.prototype:void 0,Jz=Qz?Qz.toString:void 0;function Nle(e){if(typeof e=="string")return e;if(aKe(e))return iKe(e,Nle)+"";if(oKe(e))return Jz?Jz.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var lKe=Nle,cKe=lKe;function uKe(e){return e==null?"":cKe(e)}var kle=uKe,dKe=ko,fKe=I6,hKe=rKe,mKe=kle;function pKe(e,t){return dKe(e)?e:fKe(e,t)?[e]:hKe(mKe(e))}var Cle=pKe,gKe=z0;function xKe(e){if(typeof e=="string"||gKe(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var fE=xKe,yKe=Cle,vKe=fE;function bKe(e,t){t=yKe(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[vKe(t[n++])];return n&&n==r?e:void 0}var z6=bKe,wKe=z6;function _Ke(e,t,n){var r=e==null?void 0:wKe(e,t);return r===void 0?n:r}var Ele=_Ke;const Wo=dr(Ele);function jKe(e){return e==null}var NKe=jKe;const mn=dr(NKe);var kKe=kd,CKe=ko,EKe=Cd,SKe="[object String]";function AKe(e){return typeof e=="string"||!CKe(e)&&EKe(e)&&kKe(e)==SKe}var TKe=AKe;const rp=dr(TKe);var Sle={exports:{}},Tr={};/**
1364 * @license React
1365 * react-is.production.min.js
1366 *
1367 * Copyright (c) Facebook, Inc. and its affiliates.
1368 *
1369 * This source code is licensed under the MIT license found in the
1370 * LICENSE file in the root directory of this source tree.
1371 */var U6=Symbol.for("react.element"),q6=Symbol.for("react.portal"),hE=Symbol.for("react.fragment"),mE=Symbol.for("react.strict_mode"),pE=Symbol.for("react.profiler"),gE=Symbol.for("react.provider"),xE=Symbol.for("react.context"),PKe=Symbol.for("react.server_context"),yE=Symbol.for("react.forward_ref"),vE=Symbol.for("react.suspense"),bE=Symbol.for("react.suspense_list"),wE=Symbol.for("react.memo"),_E=Symbol.for("react.lazy"),OKe=Symbol.for("react.offscreen"),Ale;Ale=Symbol.for("react.module.reference");function Bl(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case U6:switch(e=e.type,e){case hE:case pE:case mE:case vE:case bE:return e;default:switch(e=e&&e.$$typeof,e){case PKe:case xE:case yE:case _E:case wE:case gE:return e;default:return t}}case q6:return t}}}Tr.ContextConsumer=xE;Tr.ContextProvider=gE;Tr.Element=U6;Tr.ForwardRef=yE;Tr.Fragment=hE;Tr.Lazy=_E;Tr.Memo=wE;Tr.Portal=q6;Tr.Profiler=pE;Tr.StrictMode=mE;Tr.Suspense=vE;Tr.SuspenseList=bE;Tr.isAsyncMode=function(){return!1};Tr.isConcurrentMode=function(){return!1};Tr.isContextConsumer=function(e){return Bl(e)===xE};Tr.isContextProvider=function(e){return Bl(e)===gE};Tr.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===U6};Tr.isForwardRef=function(e){return Bl(e)===yE};Tr.isFragment=function(e){return Bl(e)===hE};Tr.isLazy=function(e){return Bl(e)===_E};Tr.isMemo=function(e){return Bl(e)===wE};Tr.isPortal=function(e){return Bl(e)===q6};Tr.isProfiler=function(e){return Bl(e)===pE};Tr.isStrictMode=function(e){return Bl(e)===mE};Tr.isSuspense=function(e){return Bl(e)===vE};Tr.isSuspenseList=function(e){return Bl(e)===bE};Tr.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===hE||e===pE||e===mE||e===vE||e===bE||e===OKe||typeof e=="object"&&e!==null&&(e.$$typeof===_E||e.$$typeof===wE||e.$$typeof===gE||e.$$typeof===xE||e.$$typeof===yE||e.$$typeof===Ale||e.getModuleId!==void 0)};Tr.typeOf=Bl;Sle.exports=Tr;var DKe=Sle.exports,IKe=kd,RKe=Cd,MKe="[object Number]";function LKe(e){return typeof e=="number"||RKe(e)&&IKe(e)==MKe}var Tle=LKe;const FKe=dr(Tle);var $Ke=Tle;function BKe(e){return $Ke(e)&&e!=+e}var zKe=BKe;const W0=dr(zKe);var $a=function(t){return t===0?0:t>0?1:-1},cm=function(t){return rp(t)&&t.indexOf("%")===t.length-1},lt=function(t){return FKe(t)&&!W0(t)},UKe=function(t){return mn(t)},Ai=function(t){return lt(t)||rp(t)},qKe=0,G0=function(t){var n=++qKe;return"".concat(t||"").concat(n)},Ba=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!lt(t)&&!rp(t))return r;var a;if(cm(t)){var o=t.indexOf("%");a=n*parseFloat(t.slice(0,o))/100}else a=+t;return W0(a)&&(a=r),i&&a>n&&(a=n),a},ag=function(t){if(!t)return null;var n=Object.keys(t);
vendor: 5,203 bytes, line 1371
1371return n&&n.length?t[n[0]]:null},VKe=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},i=0;i<n;i++)if(!r[t[i]])r[t[i]]=!0;else return!0;return!1},co=function(t,n){return lt(t)&&lt(n)?function(r){return t+r*(n-t)}:function(){return n}};function fN(e,t,n){return!e||!e.length?null:e.find(function(r){return r&&(typeof t=="function"?t(r):Wo(r,t))===n})}var HKe=function(t,n){return lt(t)&&lt(n)?t-n:rp(t)&&rp(n)?t.localeCompare(n):t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():String(t).localeCompare(String(n))};function Yg(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}function jP(e){"@babel/helpers - typeof";return jP=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jP(e)}var WKe=["viewBox","children"],GKe=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],Zz=["points","pathLength"],I4={svg:WKe,polygon:Zz,polyline:Zz},V6=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onF
1371ocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],hN=function(t,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var r=t;if(N.isValidElement(t)&&(r=t.props),!U0(r))return null;var i={};return Object.keys(r).forEach(function(a){V6.includes(a)&&(i[a]=n||function(o){return r[a](r,o)})}),i},KKe=function(t,n,r){return function(i){return t(n,r,i),null}},sp=function(t,n,r){if(!U0(t)||jP(t)!=="object")return null;var i=null;return Object.keys(t).forEach(function(a){var o=t[a];V6.includes(a)&&typeof o=="function"&&(i||(i={}),i[a]=KKe(o,n,r))}),i},YKe=["children"],XKe=["children"];function eU(e,t){if(e==null)return{};var n=QKe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function QKe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function NP(e){"@babel/helpers - typeof";return NP=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},NP(e)}var tU={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"}
vendor: 2,020 bytes, line 1371
1371,Wu=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},nU=null,R4=null,H6=function e(t){if(t===nU&&Array.isArray(R4))return R4;var n=[];return N.Children.forEach(t,function(r){mn(r)||(DKe.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),R4=n,nU=t,n};function Pl(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(i){return Wu(i)}):r=[Wu(t)],H6(e).forEach(function(i){var a=Wo(i,"type.displayName")||Wo(i,"type.name");r.indexOf(a)!==-1&&n.push(i)}),n}function Do(e,t){var n=Pl(e,t);return n&&n[0]}var rU=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,i=n.height;return!(!lt(r)||r<=0||!lt(i)||i<=0)},JKe=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],ZKe=function(t){return t&&t.type&&rp(t.type)&&JKe.indexOf(t.type)>=0},eYe=function(t){return t&&NP(t)==="object"&&"clipDot"in t},tYe=function(t,n,r,i){var a,o=(a=I4==null?void 0:I4[i])!==null&&a!==void 0?a:[];return n.startsWith("data-")||!an(t)&&(i&&o.includes(n)||GKe.includes(n))||r&&V6.includes(n)},qt=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(N.isValidElement(t)&&(i=t.props),!U0(i))return null;var a={};
1371return Object.keys(i).forEach(function(o){var l;tYe((l=i)===null||l===void 0?void 0:l[o],o,n,r)&&(a[o]=i[o])}),a},kP=function e(t,n){if(t===n)return!0;var r=N.Children.count(t);if(r!==N.Children.count(n))return!1;if(r===0)return!0;if(r===1)return sU(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i<r;i++){var a=t[i],o=n[i];if(Array.isArray(a)||Array.isArray(o)){if(!e(a,o))return!1}else if(!sU(a,o))return!1}return!0},sU=function(t,n){if(mn(t)&&mn(n))return!0;if(!mn(t)&&!mn(n)){var r=t.props||{},i=r.children,a=eU(r,YKe),o=n.props||{},l=o.children,c=eU(o,XKe);return i&&l?Yg(a,c)&&kP(i,l):!i&&!l?Yg(a,c):!1}return!1},iU=function(t,n){var r=[],i={};return H6(t).forEach(function(a,o){if(ZKe(a))r.push(a);else if(a){var l=Wu(a.type),c=n[l]||{},u=c.handler,d=c.once;if(u&&(!d||!i[l])){var f=u(a,l,o);r.push(f),i[l]=!0}}}),r},nYe=function(t){var n=t&&t.type;return n&&tU[n]?tU[n]:null},rYe=function(t,n){return H6(n).indexOf(t)},sYe=["children","width","height","viewBox","className","style","title","desc"];function CP(){return CP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},CP.apply(this,arguments)}function iYe(e,t){if(e==null)return{};var n=aYe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function aYe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function EP(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,o=e.style,l=e.title,c=e.desc,u=iYe(e,sYe),d=i||{width:n,height:r,x:0,y:0},f=hn("recharts-surface",a);return ee.createElement("svg",CP({},qt(u,!0,"svg"),{className:f,width:n,height:r,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),ee.createElement("title",null,l),ee.createElement("desc",null,c),t)}var oYe=["children","className"];function SP(){return SP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},SP.apply(this,arguments)}function lYe(e,t){if(e==null)return{};var n=cYe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function cYe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Wn=ee.forwardRef(function(e,t){var n=e.children,r=e.className,i=lYe(e,oYe),a=hn("recharts-layer",r);return ee.createElement("g",SP({className:a},qt(i,!0),{ref:t}),n)}),Gu=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a]};function uYe(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}var dYe=uYe,fYe=dYe;function hYe(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:fYe(e,t,n)}var mYe=hYe,pYe="\\ud800-\\udfff",gYe="\\u0300-\\u036f",xYe="\\ufe20-\\ufe2f",yYe="\\u20d0-\\u20ff",vYe=gYe+xYe+yYe,bYe="\\ufe0e\\ufe0f",wYe="\\u200d",_Ye=RegExp("["+wYe+pYe+vYe+bYe+"]");function jYe(e){return _Ye.test(e)}var Ple=jYe;function NYe(e){return e.split("")}var kYe=NYe,Ole="\\ud800-\\udfff",CYe="\\u0300-\\u036f",EYe="\\ufe20-\\ufe2f",SYe="\\u20d0-\\u20ff",AYe=CYe+EYe+SYe,TYe="\\ufe0e\\ufe0f",PYe="["+Ole+"]",AP="["+AYe+"]",TP="\\ud83c[\\udffb-\\udfff]",OYe="(?:"+AP+"|"+TP+")",Dle="[^"+Ole+"]",Ile="(?:\\ud83c[\\udde6-\\uddff]){2}",Rle="[\\ud800-\\udbff][\\udc00-\\udfff]",DYe="\\u200d",Mle=OYe+"?",Lle="["+TYe+"]?",IYe="(?:"+DYe+"(?:"+[Dle,Ile,Rle].join("|")+")"+Lle+Mle+")*",RYe=Lle+Mle+IYe,MYe="(?:"+[Dle+AP+"?",AP,Ile,Rle,PYe].join("|")+")",LYe=RegExp(TP+"(?="+TP+")|"+MYe+RYe,"g");function FYe(e){return e.match(LYe)||[]}var $Ye=FYe,BYe=kYe,zYe=Ple,UYe=$Ye;function qYe(e){return zYe(e)?UYe(e):BYe(e)}var VYe=qYe,HYe=mYe,WYe=Ple,GYe=VYe,KYe=kle;function YYe(e){return function(t){t=KYe(t);var n=WYe(t)?GYe(t):void 0,r=n?n[0]:t.charAt(0),i=n?HYe(n,1).join(""):t.slice(1);return r[e]()+i}}var XYe=YYe,QYe=XYe,JYe=QYe("toUpperCase"),ZYe=JYe;const jE=dr(ZYe);function Xr(e){return function(){return e}}const Fle=Math.cos,mN=Math.sin,Nc=Math.sqrt,pN=Math.PI,NE=2*pN,PP=Math.PI,OP=2*PP,zh=1e-6,eXe=OP-zh;function $le(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function tXe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return $le;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;i<a;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}class nXe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?$le:tXe(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,a,o){this._append`C${+t},${+n},${+r},${+i},${this._x1=+a},${this._y1=+o}`}arcTo(t,n,r,i,a){if(t=+t,n=+n,r=+r,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let o=this._x1,l=this._y1,c=r-t,u=i-n,d=o-t,f=l-n,h=d*d+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(h>zh)if(!(Math.abs(f*c-u*d)>
vendor: 4,337 bytes, line 1371
1371zh)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let p=r-o,x=i-l,y=c*c+u*u,b=p*p+x*x,w=Math.sqrt(y),_=Math.sqrt(h),j=a*Math.tan((PP-Math.acos((y+h-b)/(2*w*_)))/2),E=j/_,S=j/w;Math.abs(E-1)>zh&&this._append`L${t+E*d},${n+E*f}`,this._append`A${a},${a},0,0,${+(f*p>d*x)},${this._x1=t+S*c},${this._y1=n+S*u}`}}arc(t,n,r,i,a,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),u=t+l,d=n+c,f=1^o,h=o?i-a:a-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>zh||Math.abs(this._y1-d)>zh)&&this._append`L${u},${d}`,r&&(h<0&&(h=h%OP+OP),h>eXe?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:h>zh&&this._append`A${r},${r},0,${+(h>=PP)},${f},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function W6(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new nXe(t)}function G6(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ble(e){this._context=e}Ble.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function kE(e){return new Ble(e)}function zle(e){return e[0]}function Ule(e){return e[1]}function qle(e,t){var n=Xr(!0),r=null,i=kE,a=null,o=W6(l);e=typeof e=="function"?e:e===void 0?zle:Xr(e),t=typeof t=="function"?t:t===void 0?Ule:Xr(t);function l(c){var u,d=(c=G6(c)).length,f,h=!1,p;for(r==null&&(a=i(p=o())),u=0;u<=d;++u)!(u<d&&n(f=c[u],u,c))===h&&((h=!h)?a.lineStart():a.lineEnd()),h&&a.point(+e(f,u,c),+t(f,u,c));if(p)return a=null,p+""||null}return l.x=function(c){return arguments.length?(e=typeof c=="function"?c:Xr(+c),l):e},l.y=function(c){return arguments.length?(t=typeof c=="function"?c:Xr(+c),l):t},l.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Xr(!!c),l):n},l.curve=function(c){return arguments.length?(i=c,r!=null&&(a=i(r)),l):i},l.context=function(c){return arguments.length?(c==null?r=a=null:a=i(r=c),l):r},l}function E_(e,t,n){var r=null,i=Xr(!0),a=null,o=kE,l=null,c=W6(u);e=typeof e=="function"?e:e===void 0?zle:Xr(+e),t=typeof t=="function"?t:Xr(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?Ule:Xr(+n);function u(f){var h,p,x,y=(f=G6(f)).length,b,w=!1,_,j=new Array(y),E=new Array(y);for(a==null&&(l=o(_=c())),h=0;h<=y;++h){if(!(h<y&&i(b=f[h],h,f))===w)if(w=!w)p=h,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),x=h-1;x>=p;--x)l.point(j[x],E[x]);l.lineEnd(),l.areaEnd()}w&&(j[h]=+e(b,h,f),E[h]=+t(b,h,f),l.point(r?+r(b,h,f):j[h],n?+n(b,h,f):E[h]))}if(_)return l=null,_+""||null}function d(){return qle().defined(i).curve(o).context(a)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:Xr(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Xr(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Xr(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:Xr(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Xr(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Xr(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Xr(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,a!=null&&(l=o(a)),u):o},u.context=function(f){return arguments.length?(f==null?a=l=null:l=o(a=f),u):a},u}class Vle{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}
vendor: 8,474 bytes, line 1371
1371point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function rXe(e){return new Vle(e,!0)}function sXe(e){return new Vle(e,!1)}const K6={draw(e,t){const n=Nc(t/pN);e.moveTo(n,0),e.arc(0,0,n,0,NE)}},iXe={draw(e,t){const n=Nc(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},Hle=Nc(1/3),aXe=Hle*2,oXe={draw(e,t){const n=Nc(t/aXe),r=n*Hle;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},lXe={draw(e,t){const n=Nc(t),r=-n/2;e.rect(r,r,n,n)}},cXe=.8908130915292852,Wle=mN(pN/10)/mN(7*pN/10),uXe=mN(NE/10)*Wle,dXe=-Fle(NE/10)*Wle,fXe={draw(e,t){const n=Nc(t*cXe),r=uXe*n,i=dXe*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const o=NE*a/5,l=Fle(o),c=mN(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*i,c*r+l*i)}e.closePath()}},M4=Nc(3),hXe={draw(e,t){const n=-Nc(t/(M4*3));e.moveTo(0,n*2),e.lineTo(-M4*n,-n),e.lineTo(M4*n,-n),e.closePath()}},ll=-.5,cl=Nc(3)/2,DP=1/Nc(12),mXe=(DP/2+1)*3,pXe={draw(e,t){const n=Nc(t/mXe),r=n/2,i=n*DP,a=r,o=n*DP+n,l=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(l,c),e.lineTo(ll*r-cl*i,cl*r+ll*i),e.lineTo(ll*a-cl*o,cl*a+ll*o),e.lineTo(ll*l-cl*c,cl*l+ll*c),e.lineTo(ll*r+cl*i,ll*i-cl*r),e.lineTo(ll*a+cl*o,ll*o-cl*a),e.lineTo(ll*l+cl*c,ll*c-cl*l),e.closePath()}};function gXe(e,t){let n=null,r=W6(i);e=typeof e=="function"?e:Xr(e||K6),t=typeof t=="function"?t:Xr(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:Xr(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:Xr(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function gN(){}function xN(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Gle(e){this._context=e}Gle.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:xN(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:xN(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function xXe(e){return new Gle(e)}function Kle(e){this._context=e}Kle.prototype={areaStart:gN,areaEnd:gN,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:xN(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function yXe(e){return new Kle(e)}function Yle(e){this._context=e}Yle.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:xN(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function vXe(e){return new Yle(e)}function Xle(e){this._context=e}Xle.prototype={areaStart:gN,areaEnd:gN,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function bXe(e){return new Xle(e)}function aU(e){return e<0?-1:1}function oU(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),l=(a*i+o*r)/(r+i);return(aU(a)+aU(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(l))||0}function lU(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function L4(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,l=(a-r)/3;e._context.bezierCurveTo(r+l,i+l*t,a-l,o-l*n,a,o)}function yN(e){this._context=e}yN.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:L4(this,this._t0,lU(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,L4(this,lU(this,n=oU(this,e,t)),n);break;default:L4(this,this._t0,n=oU(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Qle(e){this._context=new Jle(e)}(Qle.prototype=Object.create(yN.prototype)).point=function(e,t){yN.prototype.point.call(this,t,e)};function Jle(e){this._context=e}Jle.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function wXe(e){return new yN(e)}function _Xe(e){return new Qle(e)}function Zle(e){this._context=e}Zle.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=cU(e),i=cU(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function cU(e){var t,n=e.length-1,r,i=new Array(n),a=new Array(n),o=new Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function jXe(e){return new Zle(e)}function CE(e,t){this._context=e,this._t=t}CE.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;
vendor: 9,160 bytes, lines 1371-1374
1371default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function NXe(e){return new CE(e,.5)}function kXe(e){return new CE(e,0)}function CXe(e){return new CE(e,1)}function zx(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,l=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<l;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function IP(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function EXe(e,t){return e[t]}function SXe(e){const t=[];return t.key=e,t}function AXe(){var e=Xr([]),t=IP,n=zx,r=EXe;function i(a){var o=Array.from(e.apply(this,arguments),SXe),l,c=o.length,u=-1,d;for(const f of a)for(l=0,++u;l<c;++l)(o[l][u]=[0,+r(f,o[l].key,u,a)]).data=f;for(l=0,d=G6(t(o));l<c;++l)o[d[l]].index=l;return n(o,d),o}return i.keys=function(a){return arguments.length?(e=typeof a=="function"?a:Xr(Array.from(a)),i):e},i.value=function(a){return arguments.length?(r=typeof a=="function"?a:Xr(+a),i):r},i.order=function(a){return arguments.length?(t=a==null?IP:typeof a=="function"?a:Xr(Array.from(a)),i):t},i.offset=function(a){return arguments.length?(n=a??zx,i):n},i}function TXe(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}zx(e,t)}}function PXe(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,l=0;o<i;++o)l+=e[o][n][1]||0;r[n][1]+=r[n][0]=-l/2}zx(e,t)}}function OXe(e,t){if(!(!((o=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r<a;++r){for(var l=0,c=0,u=0;l<o;++l){for(var d=e[t[l]],f=d[r][1]||0,h=d[r-1][1]||0,p=(f-h)/2,x=0;x<l;++x){var y=e[t[x]],b=y[r][1]||0,w=y[r-1][1]||0;p+=b-w}c+=f,u+=p*f}i[r-1][1]+=i[r-1][0]=n,c&&(n-=u/c)}i[r-1][1]+=i[r-1][0]=n,zx(e,t)}}function D1(e){"@babel/helpers - typeof";return D1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D1(e)}var DXe=["type","size","sizeType"];function RP(){return RP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},RP.apply(this,arguments)}function uU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function dU(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?uU(Object(n),!0).forEach(function(r){IXe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uU(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function IXe(e,t,n){return t=RXe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function RXe(e){var t=MXe(e,"string");return D1(t)=="symbol"?t:t+""}function MXe(e,t){if(D1(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(D1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function LXe(e,t){if(e==null)return{};var n=FXe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function FXe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var ece={symbolCircle:K6,symbolCross:iXe,symbolDiamond:oXe,symbolSquare:lXe,symbolStar:fXe,symbolTriangle:hXe,symbolWye:pXe},$Xe=Math.PI/180,BXe=function(t){var n="symbol".concat(jE(t));return ece[n]||K6},zXe=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*$Xe;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},UXe=function(t,n){ece["symbol".concat(jE(t))]=n},Y6=function(t){var n=t.type,r=n===void 0?"circle":n,i=t.size,a=i===void 0?64:i,o=t.sizeType,l=o===void 0?"area":o,c=LXe(t,DXe),u=dU(dU({},c),{},{type:r,size:a,sizeType:l}),d=function(){var b=BXe(r),w=gXe().type(b).size(zXe(a,l,r));return w()},f=u.className,h=u.cx,p=u.cy,x=qt(u,!0);return h===+h&&p===+p&&a===+a?ee.createElement("path",RP({},x,{className:hn("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};Y6.registerSymbol=UXe;function Ux(e){"@babel/helpers - typeof";return Ux=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ux(e)}function MP(){return MP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},MP.apply(this,arguments)}function fU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function qXe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fU(Object(n),!0).forEach(function(r){I1(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fU(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function VXe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function HXe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,nce(r.key),r)}}function WXe(e,t,n){return t&&HXe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function GXe(e,t,n){return t=vN(t),KXe(e,tce()?Reflect.construct(t,n||[],vN(e).constructor):t.apply(e,n))}function KXe(e,t){if(t&&(Ux(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return YXe(e)}function YXe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tce(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tce=function(){return!!e})()}function vN(e){return vN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},vN(e)}function XXe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&LP(e,t)}function LP(e,t){return LP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},LP(e,t)}function I1(e,t,n){return t=nce(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nce(e){var t=QXe(e,"string");return Ux(t)=="symbol"?t:t+""}function QXe(e,t){if(Ux(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ux(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ul=32,X6=function(e){function t(){return VXe(this,t),GXe(this,t,arguments)}return XXe(t,e),WXe(t,[{key:"renderIcon",value:function(r){var i=this.props.inactiveColor,a=ul/2,o=ul/6,l=ul/3,c=r.inactive?i:r.color;if(r.type==="plainline")return ee.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:a,x2:ul,y2:a,className:"recharts-legend-icon"});if(r.type==="line")return ee.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(a,"h").concat(l,`
1372            A`).concat(o,",").concat(o,",0,1,1,").concat(2*l,",").concat(a,`
1373            H`).concat(ul,"M").concat(2*l,",").concat(a,`
1374            A`).concat(o,",").concat(o,",0,1,1,").concat(l,",").concat(a),className:"recharts-legend-icon"});if(r.type==="rect")return ee.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(ul/8,"h").concat(ul,"v").concat(ul*3/4,"h").concat(-ul,"z"),className:"recharts-legend-icon"});if(ee.isValidElement(r.legendIcon)){var u=qXe({},r);return delete u.legendIcon,ee.cloneElement(r.legendIcon,u)}return ee.createElement(Y6,{fill:c,cx:a,cy:a,size:ul,sizeType:"diameter",type:r.type})}},{key:"renderItems",value:function(){var r=this,i=this.props,a=i.payload,o=i.iconSize,l=i.layout,c=i.formatter,u=i.inactiveColor,d={x:0,y:0,width:ul,height:ul}
1374,f={display:l==="horizontal"?"inline-block":"block",marginRight:10},h={display:"inline-block",verticalAlign:"middle",marginRight:4};return a.map(function(p,x){var y=p.formatter||c,b=hn(I1(I1({"recharts-legend-item":!0},"legend-item-".concat(x),!0),"inactive",p.inactive));if(p.type==="none")return null;var w=an(p.value)?null:p.value;Gu(!an(p.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var _=p.inactive?u:p.color;return ee.createElement("li",MP({className:b,style:f,key:"legend-item-".concat(x)},sp(r.props,p,x)),ee.createElement(EP,{width:o,height:o,viewBox:d,style:h},r.renderIcon(p)),ee.createElement("span",{className:"recharts-legend-item-text",style:{color:_}},y?y(w,p,x):w))})}},{key:"render",value:function(){var r=this.props,i=r.payload,a=r.layout,o=r.align;if(!i||!i.length)return null;var l={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return ee.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(N.PureComponent);I1(X6,"displayName","Legend");I1(X6,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var JXe=uE;function ZXe(){this.__data__=new JXe,this.size=0}var eQe=ZXe;function tQe(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var nQe=tQe;function rQe(e){return this.__data__.get(e)}var sQe=rQe;function iQe(e){return this.__data__.has(e)}var aQe=iQe,oQe=uE,lQe=L6,cQe=F6,uQe=200;function dQe(e,t){var n=this.__data__;if(n instanceof oQe){var r=n.__data__;if(!lQe||r.length<uQe-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new cQe(r)}return n.set(e,t),this.size=n.size,this}
vendor: 4,282 bytes, line 1374
1374var fQe=dQe,hQe=uE,mQe=eQe,pQe=nQe,gQe=sQe,xQe=aQe,yQe=fQe;function K0(e){var t=this.__data__=new hQe(e);this.size=t.size}K0.prototype.clear=mQe;K0.prototype.delete=pQe;K0.prototype.get=gQe;K0.prototype.has=xQe;K0.prototype.set=yQe;var rce=K0,vQe="__lodash_hash_undefined__";function bQe(e){return this.__data__.set(e,vQe),this}var wQe=bQe;function _Qe(e){return this.__data__.has(e)}var jQe=_Qe,NQe=F6,kQe=wQe,CQe=jQe;function bN(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new NQe;++t<n;)this.add(e[t])}bN.prototype.add=bN.prototype.push=kQe;bN.prototype.has=CQe;var sce=bN;function EQe(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var ice=EQe;function SQe(e,t){return e.has(t)}var ace=SQe,AQe=sce,TQe=ice,PQe=ace,OQe=1,DQe=2;function IQe(e,t,n,r,i,a){var o=n&OQe,l=e.length,c=t.length;if(l!=c&&!(o&&c>l))return!1;var u=a.get(e),d=a.get(t);if(u&&d)return u==t&&d==e;var f=-1,h=!0,p=n&DQe?new AQe:void 0;for(a.set(e,t),a.set(t,e);++f<l;){var x=e[f],y=t[f];if(r)var b=o?r(y,x,f,t,e,a):r(x,y,f,e,t,a);if(b!==void 0){if(b)continue;h=!1;break}if(p){if(!TQe(t,function(w,_){if(!PQe(p,_)&&(x===w||i(x,w,n,r,a)))return p.push(_)})){h=!1;break}}else if(!(x===y||i(x,y,n,r,a))){h=!1;break}}return a.delete(e),a.delete(t),h}var oce=IQe,RQe=yu,MQe=RQe.Uint8Array,LQe=MQe;function FQe(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}var $Qe=FQe;function BQe(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var Q6=BQe,hU=fw,mU=LQe,zQe=M6,UQe=oce,qQe=$Qe,VQe=Q6,HQe=1,WQe=2,GQe="[object Boolean]",KQe="[object Date]",YQe="[object Error]",XQe="[object Map]",QQe="[object Number]",JQe="[object RegExp]",ZQe="[object Set]",eJe="[object String]",tJe="[object Symbol]",nJe="[object ArrayBuffer]",rJe="[object DataView]",pU=hU?hU.prototype:void 0,F4=pU?pU.valueOf:void 0;function sJe(e,t,n,r,i,a,o){switch(n){case rJe:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case nJe:return!(e.byteLength!=t.byteLength||!a(new mU(e),new mU(t)));case GQe:case KQe:case QQe:return zQe(+e,+t);case YQe:return e.name==t.name&&e.message==t.message;case JQe:case eJe:return e==t+"";case XQe:var l=qQe;case ZQe:var c=r&HQe;if(l||(l=VQe),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;r|=WQe,o.set(e,t);var d=UQe(l(e),l(t),r,i,a,o);return o.delete(e),d;case tJe:if(F4)return F4.call(e)==F4.call(t)}return!1}var iJe=sJe;function aJe(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var lce=aJe,oJe=lce,lJe=ko;function cJe(e,t,n){var r=t(e);return lJe(e)?r:oJe(r,n(e))}var uJe=cJe;function dJe(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}var fJe=dJe;function hJe(){return[]}var mJe=hJe,pJe=fJe,gJe=mJe,xJe=Object.prototype,yJe=xJe.propertyIsEnumerable,gU=Object.getOwnPropertySymbols,vJe=gU?function(e){return e==null?[]:(e=Object(e),pJe(gU(e),function(t){return yJe.call(e,t)}))}:gJe,bJe=vJe;function wJe(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var _Je=wJe,jJe=kd,NJe=Cd,kJe="[object Arguments]";function CJe(e){return NJe(e)&&jJe(e)==kJe}var EJe=CJe,xU=EJe,SJe=Cd,cce=Object.prototype,AJe=cce.hasOwnProperty,TJe=cce.propertyIsEnumerable,PJe=xU(function(){return arguments}())?xU:function(e){return SJe(e)&&AJe.call(e,"callee")&&!TJe.call(e,"callee")},J6=PJe,wN={exports:{}};function OJe(){return!1}var DJe=OJe;wN.exports;(function(e,t){var n=yu,r=DJe,i=t&&!t.nodeType&&t,a=i&&!0&&e&&!e.nodeType&&e,o=a&&a.exports===i,l=o?n.Buffer:void 0,c=l?l.isBuffer:void 0,u=c||r;e.exports=u})(wN,wN.exports);var uce=wN.exports,IJe=9007199254740991,RJe=/^(?:0|[1-9]\d*)$/;function MJe(e,t){var n=typeof e;return t=t??IJe,!!t&&(n=="number"||n!="symbol"&&RJe.test(e))&&e>-1&&e%1==0&&e<t}var Z6=MJe,LJe=9007199254740991;function FJe(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=LJe}var e8=FJe,$Je=kd,BJe=e8,zJe=Cd,UJe="[object Arguments]",qJe="[object Array]",VJe="[object Boolean]",HJe="[object Date]",WJe="[object Error]",GJe="[object Function]",KJe="[object Map]",YJe="[object Number]",XJe="[object Object]",QJe="[object RegExp]",JJe="[object Set]",ZJe="[object String]",eZe="[object WeakMap]",tZe="[object ArrayBuffer]",nZe="[object DataView]",rZe="[object Float32Array]",sZe="[object Float64Array
1374]",iZe="[object Int8Array]",aZe="[object Int16Array]",oZe="[object Int32Array]",lZe="[object Uint8Array]",cZe="[object Uint8ClampedArray]",uZe="[object Uint16Array]",dZe="[object Uint32Array]",ss={};ss[rZe]=ss[sZe]=ss[iZe]=ss[aZe]=ss[oZe]=ss[lZe]=ss[cZe]=ss[uZe]=ss[dZe]=!0;ss[UJe]=ss[qJe]=ss[tZe]=ss[VJe]=ss[nZe]=ss[HJe]=ss[WJe]=ss[GJe]=ss[KJe]=ss[YJe]=ss[XJe]=ss[QJe]=ss[JJe]=ss[ZJe]=ss[eZe]=!1;function fZe(e){return zJe(e)&&BJe(e.length)&&!!ss[$Je(e)]}var hZe=fZe;function mZe(e){return function(t){return e(t)}}var dce=mZe,_N={exports:{}};_N.exports;(function(e,t){var n=vle,r=t&&!t.nodeType&&t,i=r&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===r,o=a&&n.process,l=function(){try{var c=i&&i.require&&i.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();e.exports=l})(_N,_N.exports);var pZe=_N.exports,gZe=hZe,xZe=dce,yU=pZe,vU=yU&&yU.isTypedArray,yZe=vU?xZe(vU):gZe,fce=yZe,vZe=_Je,bZe=J6,wZe=ko,_Ze=uce,jZe=Z6,NZe=fce,kZe=Object.prototype,CZe=kZe.hasOwnProperty;function EZe(e,t){var n=wZe(e),r=!n&&bZe(e),i=!n&&!r&&_Ze(e),a=!n&&!r&&!i&&NZe(e),o=n||r||i||a,l=o?vZe(e.length,String):[],c=l.length;for(var u in e)(t||CZe.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||jZe(u,c)))&&l.push(u);return l}var SZe=EZe,AZe=Object.prototype;function TZe(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||AZe;return e===n}var PZe=TZe;function OZe(e,t){return function(n){return e(t(n))}}var hce=OZe,DZe=hce,IZe=DZe(Object.keys,Object),RZe=IZe,MZe=PZe,LZe=RZe,FZe=Object.prototype,$Ze=FZe.hasOwnProperty;function BZe(e){if(!MZe(e))return LZe(e);var t=[];for(var n in Object(e))$Ze.call(e,n)&&n!="constructor"&&t.push(n);return t}var zZe=BZe,UZe=R6,qZe=e8;function VZe(e){return e!=null&&qZe(e.length)&&!UZe(e)}var EE=VZe,HZe=SZe,WZe=zZe,GZe=EE;function KZe(e){return GZe(e)?HZe(e):WZe(e)}var t8=KZe,YZe=uJe,XZe=bJe,QZe=t8;function JZe(e){return YZe(e,QZe,XZe)}var ZZe=JZe,bU=ZZe,eet=1,tet=Object.prototype,net=tet.hasOwnProperty;function ret(e,t,n,r,i,a){var o=n&eet,l=bU(e),c=l.length,u=bU(t),d=u.length;if(c!=d&&!o)return!1;for(var f=c;f--;){var h=l[f];if(!(o?h in t:net.call(t,h)))return!1}var p=a.get(e),x=a.get(t);if(p&&x)return p==t&&x==e;var y=!0;a.set(e,t),a.set(t,e);for(var b=o;++f<c;){h=l[f];var w=e[h],_=t[h];if(r)var j=o?r(_,w,h,t,e,a):r(w,_,h,e,t,a);if(!(j===void 0?w===_||i(w,_,n,r,a):j)){y=!1;break}b||(b=h=="constructor")}if(y&&!b){var E=e.constructor,S=t.constructor;E!=S&&"constructor"in e&&"constructor"in t&&!(typeof E=="function"&&E instanceof E&&typeof S=="function"&&S instanceof S)&&(y=!1)}return a.delete(e),a.delete(t),y}var set=ret,iet=bp,aet=yu,oet=iet(aet,"DataView"),cet=oet,uet=bp,det=yu,fet=uet(det,"Promise"),het=fet,met=bp,pet=yu,get=met(pet,"Set"),mce=get,xet=bp,yet=yu,vet=xet(yet,"WeakMap"),bet=vet,FP=cet,$P=L6,BP=het,zP=mce,UP=bet,pce=kd,Y0=wle,wU="[object Map]",wet="[object Object]",_U="[object Promise]",jU="[object Set]",NU="[object WeakMap]",kU="[object DataView]",_et=Y0(FP),jet=Y0($P),Net=Y0(BP),ket=Y0(zP),Cet=Y0(UP),Uh=pce;(FP&&Uh(new FP(new ArrayBuffer(1)))!=kU||$P&&Uh(new $P)!=wU||BP&&Uh(BP.resolve())!=_U||zP&&Uh(new zP)!=jU||UP&&Uh(new UP)!=NU)&&(Uh=function(e){var t=pce(e),n=t==wet?e.constructor:void 0,r=n?Y0(n):"";if(r)switch(r){case _et:return kU;case jet:return wU;case Net:return _U;case ket:return jU;case Cet:return NU}return t});var Eet=Uh,$4=rce,Aet=oce,Tet=iJe,Pet=set,CU=Eet,EU=ko,SU=uce,Oet=fce,Det=1,AU="[object Arguments]",TU="[object Array]",S_="[object Object]",Iet=Object.prototype,PU=Iet.hasOwnProperty;function Ret(e,t,n,r,i,a){var o=EU(e),l=EU(t),c=o?TU:CU(e),u=l?TU:CU(t);c=c==AU?S_:c,u=u==AU?S_:u;var d=c==S_,f=u==S_,h=c==u;if(h&&SU(e)){if(!SU(t))return!1;o=!0,d=!1}if(h&&!d)return a||(a=new $4),o||Oet(e)?Aet(e,t,n,r,i,a):Tet(e,t,c,n,r,i,a);if(!(n&Det)){var p=d&&PU.call(e,"__wrapped__"),x=f&&PU.call(t,"__wrapped__");
vendor: 4,130 bytes, line 1374
1374if(p||x){var y=p?e.value():e,b=x?t.value():t;return a||(a=new $4),i(y,b,n,r,a)}}return h?(a||(a=new $4),Pet(e,t,n,r,i,a)):!1}var Met=Ret,Let=Met,OU=Cd;function gce(e,t,n,r,i){return e===t?!0:e==null||t==null||!OU(e)&&!OU(t)?e!==e&&t!==t:Let(e,t,n,r,gce,i)}var n8=gce,Fet=rce,$et=n8,Bet=1,zet=2;function Uet(e,t,n,r){var i=n.length,a=i,o=!r;if(e==null)return!a;for(e=Object(e);i--;){var l=n[i];if(o&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++i<a;){l=n[i];var c=l[0],u=e[c],d=l[1];if(o&&l[2]){if(u===void 0&&!(c in e))return!1}else{var f=new Fet;if(r)var h=r(u,d,c,e,t,f);if(!(h===void 0?$et(d,u,Bet|zet,r,f):h))return!1}}return!0}var qet=Uet,Vet=mh;function Het(e){return e===e&&!Vet(e)}var xce=Het,Wet=xce,Get=t8;function Ket(e){for(var t=Get(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Wet(i)]}return t}var Yet=Ket;function Xet(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var yce=Xet,Qet=qet,Jet=Yet,Zet=yce;function ett(e){var t=Jet(e);return t.length==1&&t[0][2]?Zet(t[0][0],t[0][1]):function(n){return n===e||Qet(n,e,t)}}var ttt=ett;function ntt(e,t){return e!=null&&t in Object(e)}var rtt=ntt,stt=Cle,itt=J6,att=ko,ott=Z6,ltt=e8,ctt=fE;function utt(e,t,n){t=stt(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var o=ctt(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&ltt(i)&&ott(o,i)&&(att(e)||itt(e)))}var dtt=utt,ftt=rtt,htt=dtt;function mtt(e,t){return e!=null&&htt(e,t,ftt)}var ptt=mtt,gtt=n8,xtt=Ele,ytt=ptt,vtt=I6,btt=xce,wtt=yce,_tt=fE,jtt=1,Ntt=2;function ktt(e,t){return vtt(e)&&btt(t)?wtt(_tt(e),t):function(n){var r=xtt(n,e);return r===void 0&&r===t?ytt(n,e):gtt(t,r,jtt|Ntt)}}var Ctt=ktt;function Ett(e){return e}var X0=Ett;function Stt(e){return function(t){return t==null?void 0:t[e]}}var Att=Stt,Ttt=z6;function Ptt(e){return function(t){return Ttt(t,e)}}var Ott=Ptt,Dtt=Att,Itt=Ott,Rtt=I6,Mtt=fE;function Ltt(e){return Rtt(e)?Dtt(Mtt(e)):Itt(e)}var Ftt=Ltt,$tt=ttt,Btt=Ctt,ztt=X0,Utt=ko,qtt=Ftt;function Vtt(e){return typeof e=="function"?e:e==null?ztt:typeof e=="object"?Utt(e)?Btt(e[0],e[1]):$tt(e):qtt(e)}var ph=Vtt;function Htt(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}var Wtt=Htt;function Gtt(e){return e!==e}var Ktt=Gtt;function Ytt(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}var Xtt=Ytt,Qtt=Wtt,Jtt=Ktt,Ztt=Xtt;function ent(e,t,n){return t===t?Ztt(e,t,n):Qtt(e,Jtt,n)}var tnt=ent,nnt=tnt;function rnt(e,t){var n=e==null?0:e.length;return!!n&&nnt(e,t,0)>-1}var snt=rnt;function int(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}var ant=int;function ont(){}var lnt=ont,B4=mce,cnt=lnt,unt=Q6,dnt=1/0,fnt=B4&&1/unt(new B4([,-0]))[1]==dnt?function(e){return new B4(e)}:cnt,hnt=fnt,mnt=sce,pnt=snt,gnt=ant,xnt=ace,ynt=hnt,vnt=Q6,bnt=200;function wnt(e,t,n){var r=-1,i=pnt,a=e.length,o=!0,l=[],c=l;if(n)o=!1,i=gnt;else if(a>=bnt){var u=t?null:ynt(e);if(u)return vnt(u);o=!1,i=xnt,c=new mnt}else c=t?[]:l;e:for(;++r<a;){var d=e[r],f=t?t(d):d;if(d=n||d!==0?d:0,o&&f===f){for(var h=c.length;h--;)if(c[h]===f)continue e;t&&c.push(f),l.push(d)}else i(c,f,n)||(c!==l&&c.push(f),l.push(d))}return l}var _nt=wnt,jnt=ph,Nnt=_nt;function knt(e,t){return e&&e.length?Nnt(e,jnt(t)):[]}var Cnt=knt;const DU=dr(Cnt);function vce(e,t,n){return t===!0?DU(e,n):an(t)?DU(e,t):e}function qx(e){"@babel/helpers - typeof";return qx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qx(e)}var Ent=["ref"];function IU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function _u(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?IU(Object(n),!0).forEach(function(r){SE(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):IU(Object(n)).forEac
vendor: 4,260 bytes, line 1374
1374h(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Snt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function RU(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,wce(r.key),r)}}function Ant(e,t,n){return t&&RU(e.prototype,t),n&&RU(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Tnt(e,t,n){return t=jN(t),Pnt(e,bce()?Reflect.construct(t,n||[],jN(e).constructor):t.apply(e,n))}function Pnt(e,t){if(t&&(qx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ont(e)}function Ont(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bce(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bce=function(){return!!e})()}function jN(e){return jN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},jN(e)}function Dnt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&qP(e,t)}function qP(e,t){return qP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},qP(e,t)}function SE(e,t,n){return t=wce(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wce(e){var t=Int(e,"string");return qx(t)=="symbol"?t:t+""}function Int(e,t){if(qx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(qx(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Rnt(e,t){if(e==null)return{};var n=Mnt(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Mnt(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Lnt(e){return e.value}function Fnt(e,t){if(ee.isValidElement(e))return ee.cloneElement(e,t);if(typeof e=="function")return ee.createElement(e,t);t.ref;var n=Rnt(t,Ent);return ee.createElement(X6,n)}var MU=1,Xg=function(e){function t(){var n;Snt(this,t);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return n=Tnt(this,t,[].concat(i)),SE(n,"lastBoundingBox",{width:-1,height:-1}),n}return Dnt(t,e),Ant(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();return r.height=this.wrapperNode.offsetHeight,r.width=this.wrapperNode.offsetWidth,r}return null}},{key:"updateBBox",value:function(){var r=this.props.onBBoxUpdate,i=this.getBBox();i?(Math.abs(i.width-this.lastBoundingBox.width)>MU||Math.abs(i.height-this.lastBoundingBox.height)>MU)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,r&&r(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?_u({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var i=this.props,a=i.layout,o=i.align,l=i.verticalAlign,c=i.margin,u=i.chartWidth,d=i.chartHeight,f,h;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(o==="center"&&a==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(l==="middle"){var x=this.getBBoxSnapsh
1374ot();h={top:((d||0)-x.height)/2}}else h=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return _u(_u({},f),h)}},{key:"render",value:function(){var r=this,i=this.props,a=i.content,o=i.width,l=i.height,c=i.wrapperStyle,u=i.payloadUniqBy,d=i.payload,f=_u(_u({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return ee.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){r.wrapperNode=p}},Fnt(a,_u(_u({},this.props),{},{payload:vce(d,u,Lnt)})))}}],[{key:"getWithHeight",value:function(r,i){var a=_u(_u({},this.defaultProps),r.props),o=a.layout;return o==="vertical"&&lt(r.props.height)?{height:r.props.height}:o==="horizontal"?{width:r.props.width||i}:null}}])}(N.PureComponent);SE(Xg,"displayName","Legend");SE(Xg,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var LU=fw,$nt=J6,Bnt=ko,FU=LU?LU.isConcatSpreadable:void 0;function znt(e){return Bnt(e)||$nt(e)||!!(FU&&e&&e[FU])}var Unt=znt,qnt=lce,Vnt=Unt;function _ce(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=Vnt),i||(i=[]);++a<o;){var l=e[a];t>0&&n(l)?t>1?_ce(l,t-1,n,r,i):qnt(i,l):r||(i[i.length]=l)}return i}var jce=_ce;function Hnt(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),l=o.length;l--;){var c=o[e?l:++i];if(n(a[c],c,a)===!1)break}return t}}var Wnt=Hnt,Gnt=Wnt,Knt=Gnt(),Ynt=Knt,Xnt=Ynt,Qnt=t8;function Jnt(e,t){return e&&Xnt(e,t,Qnt)}var Nce=Jnt,Znt=EE;function ert(e,t){return function(n,r){if(n==null)return n;if(!Znt(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}var trt=ert,nrt=Nce,rrt=trt,srt=rrt(nrt),r8=srt,irt=r8,art=EE;function ort(e,t){var n=-1,r=art(e)?Array(e.length):[];return irt(e,function(i,a,o){r[++n]=t(i,a,o)}),r}var kce=ort;function lrt(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}var crt=lrt,$U=z0;function urt(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=$U(e),o=t!==void 0,l=t===null,c=t===t,u=$U(t);if(!l&&!u&&!a&&e>t||a&&o&&c&&!l&&!u||r&&o&&c||!n&&c||!i)return 1;if(!r&&!a&&!u&&e<t||u&&n&&i&&!r&&!a||l&&n&&i||!o&&i||!c)return-1}return 0}var drt=urt,frt=drt;function hrt(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,l=n.length;++r<o;){var c=frt(i[r],a[r]);if(c){if(r>=l)return c;var u=n[r];return c*(u=="desc"?-1:1)}}return e.index-t.index}var mrt=hrt,z4=B6,prt=z6,grt=ph,xrt=kce,yrt=crt,vrt=dce,brt=mrt,wrt=X0,_rt=ko;function jrt(e,t,n){t.length?t=z4(t,function(a){return _rt(a)?function(o){return prt(o,a.length===1?a[0]:a)}:a}):t=[wrt];var r=-1;t=z4(t,vrt(grt));var i=xrt(e,function(a,o,l){var c=z4(t,function(u){return u(a)});return{criteria:c,index:++r,value:a}});return yrt(i,function(a,o){return brt(a,o,n)})}var Nrt=jrt;function krt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var Crt=krt,Ert=Crt,BU=Math.max;function Srt(e,t,n){return t=BU(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=BU(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=r[i];return l[t]=n(o),Ert(e,this,l)}}var Art=Srt;function Trt(e){return function(){return e}}var Prt=Trt,Ort=bp,Drt=function(){try{var e=Ort(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Cce=Drt,Irt=Prt,zU=Cce,Rrt=X0,Mrt=zU?function(e,t){return zU(e,"toString",{configurable:!0,enumerable:!1,value:Irt(t),writable:!0})}:Rrt,Lrt=Mrt,Frt=800,$rt=16,Brt=Date.now;function zrt(e){var t=0,n=0;return function(){var r=Brt(),i=$rt-(r-n);if(n=r,i>0){if(++t>=Frt)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Urt=zrt,qrt=Lrt,Vrt=Urt,Hrt=Vrt(qrt),Wrt=Hrt,Grt=X0,Krt=Art,Yrt=Wrt;function Xrt(e,t){return Yrt(Krt(e,t,Grt),e+"")}var Qrt=Xrt,Jrt=M6,Zrt=EE,est=Z6,tst=mh;function nst(e,t,n){if(!tst(n))return!1;var r=typeof t;return(r=="number"?Zrt(n)&&est(t,n.length):r=="string"&&t in n)?Jrt(n[t],e):!1}var AE=nst,rst=jce,sst=Nrt,ist=Qrt,UU=AE,ast=ist(function(e,t){if(e==null)return[];var n=t.length;return n>1&&UU(e,t[0],t[1])?t=[]:n>2&&UU(t[0],t[1],t[2])&&(t=[t[0]]),sst(e,rst(t,1),[])}),ost=ast;const s8=dr(ost);function R1(e){"@babel/helpers - typeof";return R1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R1(e)}function VP(){return VP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},VP.apply(this,arguments)}function lst(e,t){return fst(e)||dst(e,t)||ust(e,t)||cst()}
vendor: 29,340 bytes, lines 1374-1381
1374function cst(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1375In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ust(e,t){if(e){if(typeof e=="string")return qU(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qU(e,t)}}function qU(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function dst(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return l}}function fst(e){if(Array.isArray(e))return e}function VU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function U4(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?VU(Object(n),!0).forEach(function(r){hst(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VU(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hst(e,t,n){return t=mst(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mst(e){var t=pst(e,"string");return R1(t)=="symbol"?t:t+""}function pst(e,t){if(R1(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(R1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gst(e){return Array.isArray(e)&&Ai(e[0])&&Ai(e[1])?e.join(" ~ "):e}var xst=function(t){var n=t.separator,r=n===void 0?" : ":n,i=t.contentStyle,a=i===void 0?{}:i,o=t.itemStyle,l=o===void 0?{}:o,c=t.labelStyle,u=c===void 0?{}:c,d=t.payload,f=t.formatter,h=t.itemSorter,p=t.wrapperClassName,x=t.labelClassName,y=t.label,b=t.labelFormatter,w=t.accessibilityLayer,_=w===void 0?!1:w,j=function(){if(d&&d.length){var M={padding:0,margin:0},B=(h?s8(d,h):d).map(function(U,F){if(U.type==="none")return null;var H=U4({display:"block",paddingTop:4,paddingBottom:4,color:U.color||"#000"},l),z=U.formatter||f||gst,K=U.value,W=U.name,q=K,oe=W;if(z&&q!=null&&oe!=null){var J=z(K,W,U,F,d);if(Array.isArray(J)){var Y=lst(J,2);q=Y[0],oe=Y[1]}else q=J}return ee.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(F),style:H},Ai(oe)?ee.createElement("span",{className:"recharts-tooltip-item-name"},oe):null,Ai(oe)?ee.createElement("span",{className:"recharts-tooltip-item-separator"},r):null,ee.createElement("span",{className:"recharts-tooltip-item-value"},q),ee.createElement("span",{className:"recharts-tooltip-item-unit"},U.unit||""))});return ee.createElement("ul",{className:"recharts-tooltip-item-list",style:M},B)}return null},E=U4({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},a),S=U4({margin:0},u),T=!mn(y),P=T?y:"",O=hn("recharts-default-tooltip",p),D=hn("recharts-tooltip-label",x);T&&b&&d!==void 0&&d!==null&&(P=b(y,d));var R=_?{role:"status","aria-live":"assertive"}:{};return ee.createElement("div",VP({className:O,style:E},R),ee.createElement("p",{className:D,style:S},ee.isValidElement(P)?P:"".concat(P)),j())};function M1(e){"@babel/helpers - typeof";return M1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M1(e)}function A_(e,t,n){return t=yst(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yst(e){var t=vst(e,"string");return M1(t)=="symbol"?t:t+""}function vst(e,t){if(M1(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(M1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var $y="recharts-tooltip-wrapper",bst={visibility:"hidden"};function wst(e){var t=e.coordinate,n=e.translateX,r=e.translateY;return hn($y,A_(A_(A_(A_({},"".concat($y,"-right"),lt(n)&&t&&lt(t.x)&&n>=t.x),"".concat($y,"-left"),lt(n)&&t&&lt(t.x)&&n<t.x),"".concat($y,"-bottom"),lt(r)&&t&&lt(t.y)&&r>=t.y),"".concat($y,"-top"),lt(r)&&t&&lt(t.y)&&r<t.y))}function HU(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.key,i=e.offsetTopLeft,a=e.position,o=e.reverseDirection,l=e.tooltipDimension,c=e.viewBox,u=e.viewBoxDimension;if(a&&lt(a[r]))return a[r];var d=n[r]-l-i,f=n[r]+i;if(t[r])return o[r]?d:f;if(o[r]){var h=d,p=c[r];return h<p?Math.max(f,c[r]):Math.max(d,c[r])}var x=f+l,y=c[r]+u;return x>y?Math.max(d,c[r]):Math.max(f,c[r])}function _st(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function jst(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,i=e.position,a=e.reverseDirection,o=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,u,d,f;return o.height>0&&o.width>0&&n?(d=HU({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),f=HU({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),u=_st({translateX:d,translateY:f,useTranslate3d:l})):u=bst,{cssProperties:u,cssClasses:wst({translateX:d,translateY:f,coordinate:n})}}function Vx(e){"@babel/helpers - typeof";return Vx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vx(e)}function WU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function GU(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?WU(Object(n),!0).forEach(function(r){WP(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WU(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Nst(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kst(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Sce(r.key),r)}}function Cst(e,t,n){return t&&kst(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Est(e,t,n){return t=NN(t),Sst(e,Ece()?Reflect.construct(t,n||[],NN(e).constructor):t.apply(e,n))}function Sst(e,t){if(t&&(Vx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ast(e)}function Ast(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ece(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ece=function(){return!!e})()}function NN(e){return NN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},NN(e)}function Tst(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&HP(e,t)}function HP(e,t){return HP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},HP(e,t)}function WP(e,t,n){return t=Sce(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sce(e){var t=Pst(e,"string");return Vx(t)=="symbol"?t:t+""}function Pst(e,t){if(Vx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Vx(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var KU=1,Ost=function(e){function t(){var n;Nst(this,t);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return n=Est(this,t,[].concat(i)),WP(n,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),WP(n,"handleKeyDown",function(o){if(o.key==="Escape"){var l,c,u,d;n.setState({dismissed:!0,dismissedAtCoordinate:{x:(l=(c=n.props.coordinate)===null||c===void 0?void 0:c.x)!==null&&l!==void 0?l:0,y:(u=(d=n.props.coordinate)===null||d===void 0?void 0:d.y)!==null&&u!==void 0?u:0}})}}),n}return Tst(t,e),Cst(t,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();(Math.abs(r.width-this.state.lastBoundingBox.width)>KU||Math.abs(r.height-this.state.lastBoundingBox.height)>KU)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,i=this.props,a=i.active,o=i.allowEscapeViewBox,l=i.animationDuration,c=i.animationEasing,u=i.children,d=i.coordinate,f=i.hasPayload,h=i.isAnimationActive,p=i.offset,x=i.position,y=i.reverseDirection,b=i.useTranslate3d,w=i.viewBox,_=i.wrapperStyle,j=jst({allowEscapeViewBox:o,coordinate:d,offsetTopLeft:p,position:x,reverseDirection:y,tooltipBox:this.state.lastBoundingBox,useTranslate3d:b,viewBox:w}),E=j.cssClasses,S=j.cssProperties,T=GU(GU({transition:h&&a?"transform ".concat(l,"ms ").concat(c):void 0},S),{},{pointerEvents:"none",visibility:!this.state.dismissed&&a&&f?"visible":"hidden",position:"absolute",top:0,left:0},_);return ee.createElement("div",{tabIndex:-1,className:E,style:T,ref:function(O){r.wrapperNode=O}},u)}}])}(N.PureComponent),Dst=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},wp={isSsr:Dst()};function Hx(e){"@babel/helpers - typeof";return Hx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hx(e)}function YU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function XU(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?YU(Object(n),!0).forEach(function(r){i8(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):YU(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ist(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rst(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Tce(r.key),r)}}function Mst(e,t,n){return t&&Rst(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lst(e,t,n){return t=kN(t),Fst(e,Ace()?Reflect.construct(t,n||[],kN(e).constructor):t.apply(e,n))}function Fst(e,t){if(t&&(Hx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $st(e)}function $st(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ace(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ace=function(){return!!e})()}function kN(e){return kN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},kN(e)}function Bst(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&GP(e,t)}function GP(e,t){return GP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},GP(e,t)}function i8(e,t,n){return t=Tce(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tce(e){var t=zst(e,"string");return Hx(t)=="symbol"?t:t+""}function zst(e,t){if(Hx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Hx(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Ust(e){return e.dataKey}function qst(e,t){return ee.isValidElement(e)?ee.cloneElement(e,t):typeof e=="function"?ee.createElement(e,t):ee.createElement(xst,t)}var sc=function(e){function t(){return Ist(this,t),Lst(this,t,arguments)}return Bst(t,e),Mst(t,[{key:"render",value:function(){var r=this,i=this.props,a=i.active,o=i.allowEscapeViewBox,l=i.animationDuration,c=i.animationEasing,u=i.content,d=i.coordinate,f=i.filterNull,h=i.isAnimationActive,p=i.offset,x=i.payload,y=i.payloadUniqBy,b=i.position,w=i.reverseDirection,_=i.useTranslate3d,j=i.viewBox,E=i.wrapperStyle,S=x??[];f&&S.length&&(S=vce(x.filter(function(P){return P.value!=null&&(P.hide!==!0||r.props.includeHidden)}),y,Ust));var T=S.length>0;return ee.createElement(Ost,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:h,active:a,coordinate:d,hasPayload:T,offset:p,position:b,reverseDirection:w,useTranslate3d:_,viewBox:j,wrapperStyle:E},qst(u,XU(XU({},this.props),{},{payload:S})))}}])}(N.PureComponent);i8(sc,"displayName","Tooltip");i8(sc,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!wp.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var Vst=yu,Hst=function(){return Vst.Date.now()},Wst=Hst,Gst=/\s/;function Kst(e){for(var t=e.length;t--&&Gst.test(e.charAt(t)););return t}var Yst=Kst,Xst=Yst,Qst=/^\s+/;function Jst(e){return e&&e.slice(0,Xst(e)+1).replace(Qst,"")}var Zst=Jst,eit=Zst,QU=mh,tit=z0,JU=NaN,nit=/^[-+]0x[0-9a-f]+$/i,rit=/^0b[01]+$/i,sit=/^0o[0-7]+$/i,iit=parseInt;function ait(e){if(typeof e=="number")return e;if(tit(e))return JU;if(QU(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=QU(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=eit(e);var n=rit.test(e);return n||sit.test(e)?iit(e.slice(2),n?2:8):nit.test(e)?JU:+e}var Pce=ait,oit=mh,q4=Wst,ZU=Pce,lit="Expected a function",cit=Math.max,uit=Math.min;function dit(e,t,n){var r,i,a,o,l,c,u=0,d=!1,f=!1,h=!0;if(typeof e!="function")throw new TypeError(lit);t=ZU(t)||0,oit(n)&&(d=!!n.leading,f="maxWait"in n,a=f?cit(ZU(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h);function p(T){var P=r,O=i;return r=i=void 0,u=T,o=e.apply(O,P),o}function x(T){return u=T,l=setTimeout(w,t),d?p(T):o}function y(T){var P=T-c,O=T-u,D=t-P;return f?uit(D,a-O):D}function b(T){var P=T-c,O=T-u;return c===void 0||P>=t||P<0||f&&O>=a}function w(){var T=q4();if(b(T))return _(T);l=setTimeout(w,y(T))}function _(T){return l=void 0,h&&r?p(T):(r=i=void 0,o)}function j(){l!==void 0&&clearTimeout(l),u=0,r=c=i=l=void 0}function E(){return l===void 0?o:_(q4())}function S(){var T=q4(),P=b(T);if(r=arguments,i=this,c=T,P){if(l===void 0)return x(c);if(f)return clearTimeout(l),l=setTimeout(w,t),p(c)}return l===void 0&&(l=setTimeout(w,t)),o}return S.cancel=j,S.flush=E,S}var fit=dit,hit=fit,mit=mh,pit="Expected a function";function git(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(pit);return mit(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),hit(e,t,{leading:r,maxWait:t,trailing:i})}var xit=git;const Oce=dr(xit);function L1(e){"@babel/helpers - typeof";return L1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},L1(e)}function eq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function T_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?eq(Object(n),!0).forEach(function(r){yit(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eq(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yit(e,t,n){return t=vit(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vit(e){var t=bit(e,"string");return L1(t)=="symbol"?t:t+""}function bit(e,t){if(L1(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(L1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function wit(e,t){return kit(e)||Nit(e,t)||jit(e,t)||_it()}function _it(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1376In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jit(e,t){if(e){if(typeof e=="string")return tq(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tq(e,t)}}function tq(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Nit(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return l}}function kit(e){if(Array.isArray(e))return e}var KP=N.forwardRef(function(e,t){var n=e.aspect,r=e.initialDimension,i=r===void 0?{width:-1,height:-1}:r,a=e.width,o=a===void 0?"100%":a,l=e.height,c=l===void 0?"100%":l,u=e.minWidth,d=u===void 0?0:u,f=e.minHeight,h=e.maxHeight,p=e.children,x=e.debounce,y=x===void 0?0:x,b=e.id,w=e.className,_=e.onResize,j=e.style,E=j===void 0?{}:j,S=N.useRef(null),T=N.useRef();T.current=_,N.useImperativeHandle(t,function(){return Object.defineProperty(S.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),S.current},configurable:!0})});var P=N.useState({containerWidth:i.width,containerHeight:i.height}),O=wit(P,2),D=O[0],R=O[1],L=N.useCallback(function(B,U){R(function(F){var H=Math.round(B),z=Math.round(U);return F.containerWidth===H&&F.containerHeight===z?F:{containerWidth:H,containerHeight:z}})},[]);N.useEffect(function(){var B=function(W){var q,oe=W[0].contentRect,J=oe.width,Y=oe.height;L(J,Y),(q=T.current)===null||q===void 0||q.call(T,J,Y)};y>0&&(B=Oce(B,y,{trailing:!0,leading:!1}));var U=new ResizeObserver(B),F=S.current.getBoundingClientRect(),H=F.width,z=F.height;return L(H,z),U.observe(S.current),function(){U.disconnect()}},[L,y]);var M=N.useMemo(function(){var B=D.containerWidth,U=D.containerHeight;if(B<0||U<0)return null;Gu(cm(o)||cm(c),`The width(%s) and height(%s) are both fixed numbers,
1377       maybe you don't need to use a ResponsiveContainer.`,o,c),Gu(!n||n>0,"The aspect(%s) must be greater than zero.",n);var F=cm(o)?B:o,H=cm(c)?U:c;n&&n>0&&(F?H=F/n:H&&(F=H*n),h&&H>h&&(H=h)),Gu(F>0||H>0,`The width(%s) and height(%s) of chart should be greater than 0,
1378       please check the style of container, or the props width(%s) and height(%s),
1379       or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
1380       height and width.`,F,H,o,c,d,f,n);var z=!Array.isArray(p)&&Wu(p.type).endsWith("Chart");return ee.Children.map(p,function(K){return ee.isValidElement(K)?N.cloneElement(K,T_({width:F,height:H},z?{style:T_({height:"100%",width:"100%",maxHeight:H,maxWidth:F},K.props.style)}:{})):K})},[n,p,c,h,f,d,D,o]);return ee.createElement("div",{id:b?"".concat(b):void 0,className:hn("recharts-responsive-container",w),style:T_(T_({},E),{},{width:o,height:c,minWidth:d,minHeight:f,maxHeight:h}),ref:S},M)}),TE=function(t){return null};TE.displayName="Cell";function F1(e){"@babel/helpers - typeof";return F1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},F1(e)}function nq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function YP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nq(Object(n),!0).forEach(function(r){Cit(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nq(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Cit(e,t,n){return t=Eit(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Eit(e){var t=Sit(e,"string");return F1(t)=="symbol"?t:t+""}function Sit(e,t){if(F1(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(F1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Yp={widthCache:{},cacheCount:0},Ait=2e3,Tit={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},rq="recharts_measurement_span";function Pit(e){var t=YP({},e);return Object.keys(t).forEach(function(n){t[n]||delete t[n]}),t}var Rv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||wp.isSsr)return{width:0,height:0};var r=Pit(n),i=JSON.stringify({text:t,copyStyle:r});if(Yp.widthCache[i])return Yp.widthCache[i];try{var a=document.getElementById(rq);a||(a=document.createElement("span"),a.setAttribute("id",rq),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var o=YP(YP({},Tit),r);Object.assign(a.style,o),a.textContent="".concat(t);var l=a.getBoundingClientRect(),c={width:l.width,height:l.height};return Yp.widthCache[i]=c,++Yp.cacheCount>Ait&&(Yp.cacheCount=0,Yp.widthCache={}),c}catch{return{width:0,height:0}}},Oit=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function $1(e){"@babel/helpers - typeof";return $1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$1(e)}function CN(e,t){return Mit(e)||Rit(e,t)||Iit(e,t)||Dit()}function Dit(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1381In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Iit(e,t){if(e){if(typeof e=="string")return sq(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sq(e,t)}}function sq(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Rit(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return l}}function Mit(e){if(Array.isArray(e))return e}function Lit(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iq(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,$it(r.key),r)}}function Fit(e,t,n){return t&&iq(e.prototype,t),n&&iq(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function $it(e){var t=Bit(e,"string");return $1(t)=="symbol"?t:t+""}function Bit(e,t){if($1(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if($1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var aq=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,oq=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,zit=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Uit=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Dce={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},qit=Object.keys(Dce),Eg="NaN";function Vit(e,t){return e*Dce[t]}var P_=function(){function e(t,n){Lit(this,e),this.num=t,this.unit=n,this.num=t,this.unit=n,Number.isNaN(t)&&(this.unit=""),n!==""&&!zit.test(n)&&(this.num=NaN,this.unit=""),qit.includes(n)&&(this.num=Vit(t,n),this.unit="px")}return Fit(e,[{key:"add",value:function(n){return this.unit!==n.unit?new e(NaN,""):new e(this.num+n.num,this.unit)}},{key:"subtract",value:function(n){return this.unit!==n.unit?new e(NaN,""):new e(this.num-n.num,this.unit)}},{key:"multiply",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new e(NaN,""):new e(this.num*n.num,this.unit||n.unit)}},{key:"divide",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new e(NaN,""):new e(this.num/n.num,this.unit||n.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(n){var r,i=(r=Uit.exec(n))!==null&&r!==void 0?r:[],a=CN(i,3),o=a[1],l=a[2];return new e(parseFloat(o),l??"")}}])}();function Ice(e){if(e.includes(Eg))return Eg;for(var t=e;t.includes("*")||t.includes("/");){var n,r=(n=aq.exec(t))!==null&&n!==void 0?n:[],i=CN(r,4),a=i[1],o=i[2],l=i[3],c=P_.parse(a??""),u=P_.parse(l??""),d=o==="*"?c.multiply(u):c.divide(u);if(d.isNaN())return Eg;t=t.replace(aq,d.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var f,h=(f=oq.exec(t))!==null&&f!==void 0?f:[],p=CN(h,4),x=p[1],y=p[2],b=p[3],w=P_.parse(x??""),_=P_.parse(b??""),j=y==="+"?w.add(_):w.subtract(_);if(j.isNaN())return Eg;t=t.replace(oq,j.toString())}return t}var lq=/\(([^()]*)\)/;function Hit(e){for(var t=e;t.includes("(");){var n=lq.exec(t),r=CN(n,2),i=r[1];t=t.replace(lq,Ice(i))}return t}function Wit(e){var t=e.replace(/\s+/g,"");return t=Hit(t),t=Ice(t),t}function Git(e){try{return Wit(e)}catch{return Eg}}function V4(e){var t=Git(e.slice(5,-1));return t===Eg?"":t}var Kit=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],Yit=["dx","dy","angle","className","breakAll"];function XP(){return XP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},XP.apply(this,arguments)}function cq(e,t){if(e==null)return{};var n=Xit(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Xit(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function uq(e,t){return eat(e)||Zit(e,t)||Jit(e,t)||Qit()}
1381function Qit(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1382In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jit(e,t){if(e){if(typeof e=="string")return dq(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dq(e,t)}}function dq(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Zit(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return l}}function eat(e){if(Array.isArray(e))return e}var Rce=/[ \f\n\r\t\v\u2028\u2029]+/,Mce=function(t){var n=t.children,r=t.breakAll,i=t.style;try{var a=[];mn(n)||(r?a=n.toString().split(""):a=n.toString().split(Rce));var o=a.map(function(c){return{word:c,width:Rv(c,i).width}}),l=r?0:Rv(" ",i).width;return{wordsWithComputedWidth:o,spaceWidth:l}}catch{return null}},tat=function(t,n,r,i,a){var o=t.maxLines,l=t.children,c=t.style,u=t.breakAll,d=lt(o),f=l,h=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return F.reduce(function(H,z){var K=z.word,W=z.width,q=H[H.length-1];if(q&&(i==null||a||q.width+W+r<Number(i)))q.words.push(K),q.width+=W+r;else{var oe={words:[K],width:W};H.push(oe)}return H},[])},p=h(n),x=function(F){return F.reduce(function(H,z){return H.width>z.width?H:z})};if(!d)return p;for(var y="…",b=function(F){var H=f.slice(0,F),z=Mce({breakAll:u,style:c,children:H+y}).wordsWithComputedWidth,K=h(z),W=K.length>o||x(K).width>Number(i);return[W,K]},w=0,_=f.length-1,j=0,E;w<=_&&j<=f.length-1;){var S=Math.floor((w+_)/2),T=S-1,P=b(T),O=uq(P,2),D=O[0],R=O[1],L=b(S),M=uq(L,1),B=M[0];if(!D&&!B&&(w=S+1),D&&B&&(_=S-1),!D&&B){E=R;break}j++}return E||p},fq=function(t){var n=mn(t)?[]:t.toString().split(Rce);return[{words:n}]},nat=function(t){var n=t.width,r=t.scaleToFit,i=t.children,a=t.style,o=t.breakAll,l=t.maxLines;if((n||r)&&!wp.isSsr){var c,u,d=Mce({breakAll:o,children:i,style:a});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;c=f,u=h}else return fq(i);return tat({breakAll:o,children:i,maxLines:l,style:a},c,u,n,r)}return fq(i)},hq="#808080",ip=function(t){var n=t.x,r=n===void 0?0:n,i=t.y,a=i===void 0?0:i,o=t.lineHeight,l=o===void 0?"1em":o,c=t.capHeight,u=c===void 0?"0.71em":c,d=t.scaleToFit,f=d===void 0?!1:d,h=t.textAnchor,p=h===void 0?"start":h,x=t.verticalAnchor,y=x===void 0?"end":x,b=t.fill,w=b===void 0?hq:b,_=cq(t,Kit),j=N.useMemo(function(){return nat({breakAll:_.breakAll,children:_.children,maxLines:_.maxLines,scaleToFit:f,style:_.style,width:_.width})},[_.breakAll,_.children,_.maxLines,f,_.style,_.width]),E=_.dx,S=_.dy,T=_.angle,P=_.className,O=_.breakAll,D=cq(_,Yit);if(!Ai(r)||!Ai(a))return null;var R=r+(lt(E)?E:0),L=a+(lt(S)?S:0),M;switch(y){case"start":M=V4("calc(".concat(u,")"));break;case"middle":M=V4("calc(".concat((j.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:M=V4("calc(".concat(j.length-1," * -").concat(l,")"));break}var B=[];if(f){var U=j[0].width,F=_.width;B.push("scale(".concat((lt(F)?F/U:1)/U,")"))}return T&&B.push("rotate(".concat(T,", ").concat(R,", ").concat(L,")")),B.length&&(D.transform=B.join(" ")),ee.createElement("text",XP({},qt(D,!0),{x:R,y:L,className:hn("recharts-text",P),textAnchor:p,fill:w.includes("url")?hq:w}),j.map(function(H,z){var K=H.words.join(O?"":" ");return ee.createElement("tspan",{x:R,dy:z===0?M:l,key:"".concat(K,"-").concat(z)},K)}))};function Tf(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function rat(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function a8(e){let t,n,r;e.length!==2?(t=Tf,n=(l,c)=>Tf(e(l),c),r=(l,c)=>e(l)-c):(t=e===Tf||e===rat?e:sat,n=e,r=e);function i(l,c,u=0,d=l.length){if(u<d){if(t(c,c)!==0)return d;do{const f=u+d>>>1;n(l[f],c)<0?u=f+1:d=f}while(u<d)}return u}function a(l,c,u=0,d=l.length){if(u<d){if(t(c,c)!==0)return d;do{const f=u+d>>>1;n(l[f],c)<=0?u=f+1:d=f}while(u<d)}return u}function o(l,c,u=0,d=l.length){const f=i(l,c,u,d-1);return f>u&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:i,center:o,right:a}}function sat(){return 0}function Lce(e){return e===null?NaN:+e}function*iat(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const aat=a8(Tf),hw=aat.right;a8(Lce).center;class mq extends Map{constructor(t,n=cat){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(pq(this,t))}has(t){return super.has(pq(this,t))}set(t,n){return super.set(oat(this,t),n)}delete(t){return super.delete(lat(this,t))}}function pq({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function oat({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function lat({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function cat(e){return e!==null&&typeof e=="object"?e.valueOf():e}function uat(e=Tf){if(e===Tf)return Fce;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Fce(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const dat=Math.sqrt(50),fat=Math.sqrt(10),hat=Math.sqrt(2);function EN(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),o=a>=dat?10:a>=fat?5:a>=hat?2:1;let l,c,u;return i<0?(u=Math.pow(10,-i)/o,l=Math.round(e*u),c=Math.round(t*u),l/u<e&&++l,c/u>t&&--c,u=-u):(u=Math.pow(10,i)*o,l=Math.round(e/u),c=Math.round(t/u),l*u<e&&++l,c*u>t&&--c),c<l&&.5<=n&&n<2?EN(e,t,n*2):[l,c,u]}function QP(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const r=t<e,[i,a,o]=r?EN(t,e,n):EN(e,t,n);if(!(a>=i))return[];const l=a-i+1,c=new Array(l);if(r)if(o<0)for(let u=0;u<l;++u)c[u]=(a-u)/-o;else for(let u=0;u<l;++u)c[u]=(a-u)*o;else if(o<0)for(let u=0;u<l;++u)c[u]=(i+u)/-o;else for(let u=0;u<l;++u)c[u]=(i+u)*o;return c}function JP(e,t,n){return t=+t,e=+e,n=+n,EN(e,t,n)[2]}function ZP(e,t,n){t=+t,e=+e,n=+n;const r=t<e,i=r?JP(t,e,n):JP(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function gq(e,t){let n;for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function xq(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}
1382function $ce(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?Fce:uat(i);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),p=Math.max(n,Math.floor(t-u*f/c+h)),x=Math.min(r,Math.floor(t+(c-u)*f/c+h));$ce(e,t,p,x,i)}const a=e[t];let o=n,l=r;for(By(e,n,t),i(e[r],a)>0&&By(e,n,r);o<l;){for(By(e,o,l),++o,--l;i(e[o],a)<0;)++o;for(;i(e[l],a)>0;)--l}i(e[n],a)===0?By(e,n,l):(++l,By(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function By(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function mat(e,t,n){if(e=Float64Array.from(iat(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return xq(e);if(t>=1)return gq(e);var r,i=(r-1)*t,a=Math.floor(i),o=gq($ce(e,a).subarray(0,a+1)),l=xq(e.subarray(a+1));return o+(l-o)*(i-a)}}function pat(e,t,n=Lce){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e),l=+n(e[a+1],a+1,e);return o+(l-o)*(i-a)}}function gat(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=new Array(i);++r<i;)a[r]=e+r*n;return a}function zl(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Ed(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const eO=Symbol("implicit");function o8(){var e=new mq,t=[],n=[],r=eO;function i(a){let o=e.get(a);if(o===void 0){if(r!==eO)return r;e.set(a,o=t.push(a)-1)}return n[o%n.length]}return i.domain=function(a){if(!arguments.length)return t.slice();t=[],e=new mq;for(const o of a)e.has(o)||e.set(o,t.push(o)-1);return i},i.range=function(a){return arguments.length?(n=Array.from(a),i):n.slice()},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return o8(t,n).unknown(r)},zl.apply(i,arguments),i}function B1(){var e=o8().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,o,l=!1,c=0,u=0,d=.5;delete e.unknown;function f(){var h=t().length,p=i<r,x=p?i:r,y=p?r:i;a=(y-x)/Math.max(1,h-c+u*2),l&&(a=Math.floor(a)),x+=(y-x-a*(h-c))*d,o=a*(1-c),l&&(x=Math.round(x),o=Math.round(o));var b=gat(h).map(function(w){return x+a*w});return n(p?b.reverse():b)}return e.domain=function(h){return arguments.length?(t(h),f()):t()},e.range=function(h){return arguments.length?([r,i]=h,r=+r,i=+i,f()):[r,i]},e.rangeRound=function(h){return[r,i]=h,r=+r,i=+i,l=!0,f()},e.bandwidth=function(){return o},e.step=function(){return a},e.round=function(h){return arguments.length?(l=!!h,f()):l},e.padding=function(h){return arguments.length?(c=Math.min(1,u=+h),f()):c},e.paddingInner=function(h){return arguments.length?(c=Math.min(1,h),f()):c},e.paddingOuter=function(h){return arguments.length?(u=+h,f()):u},e.align=function(h){return arguments.length?(d=Math.max(0,Math.min(1,h)),f()):d},e.copy=function(){return B1(t(),[r,i]).round(l).paddingInner(c).paddingOuter(u).align(d)},zl.apply(f(),arguments)}function Bce(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return Bce(t())},e}function Mv(){return Bce(B1.apply(null,arguments).paddingInner(1))}function l8(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function zce(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function mw(){}var z1=.7,SN=1/z1,Qg="\\s*([+-]?\\d+)\\s*",U1="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",au="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xat=/^#([0-9a-f]{3,8})$/,yat=new RegExp(`^rgb\\(${Qg},${Qg},${Qg}\\)$`),vat=new RegExp(`^rgb\\(${au},${au},${au}\\)$`),bat=new RegExp(`^rgba\\(${Qg},${Qg},${Qg},${U1}\\)$`),wat=new RegExp(`^rgba\\(${au},${au},${au},${U1}\\)$`),_at=new RegExp(`^hsl\\(${U1},${au},${au}\\)$`),jat=new RegExp(`^hsla\\(${U1},${au},${au},${U1}\\)$`),yq={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};l8(mw,q1,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:vq,formatHex:vq,formatHex8:Nat,formatHsl:kat,formatRgb:bq,toString:bq});function vq(){return this.rgb().formatHex()}function Nat(){return this.rgb().formatHex8()}function kat(){return Uce(this).formatHsl()}function bq(){return this.rgb().formatRgb()}function q1(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=xat.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?wq(t):n===3?new fo(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?O_(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?O_(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=yat.exec(e))?new fo(t[1],t[2],t[3],1):(t=vat.exec(e))?new fo(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=bat.exec(e))?O_(t[1],t[2],t[3],t[4]):(t=wat.exec(e))?O_(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=_at.exec(e))?Nq(t[1],t[2]/100,t[3]/100,1):(t=jat.exec(e))?Nq(t[1],t[2]/100,t[3]/100,t[4]):yq.hasOwnProperty(e)?wq(yq[e]):e==="transparent"?new fo(NaN,NaN,NaN,0):null}function wq(e){return new fo(e>>16&255,e>>8&255,e&255,1)}function O_(e,t,n,r){return r<=0&&(e=t=n=NaN),new fo(e,t,n,r)}function Cat(e){return e instanceof mw||(e=q1(e)),e?(e=e.rgb(),new fo(e.r,e.g,e.b,e.opacity)):new fo}function tO(e,t,n,r){return arguments.length===1?Cat(e):new fo(e,t,n,r??1)}function fo(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}l8(fo,tO,zce(mw,{brighter(e){return e=e==null?SN:Math.pow(SN,e),new fo(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?z1:Math.pow(z1,e),new fo(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new fo(Tm(this.r),Tm(this.g),Tm(this.b),AN(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:_q,formatHex:_q,formatHex8:Eat,formatRgb:jq,toString:jq}));function _q(){return`#${um(this.r)}${um(this.g)}${um(this.b)}`}function Eat(){return`#${um(this.r)}${um(this.g)}${um(this.b)}${um((isNaN(this.opacity)?1:this.opacity)*255)}`}function jq(){const e=AN(this.opacity);return`${e===1?"rgb(":"rgba("}${Tm(this.r)}, ${Tm(this.g)}, ${Tm(this.b)}${e===1?")":`, ${e})`}`}function AN(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Tm(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function um(e){return e=Tm(e),(e<16?"0":"")+e.toString(16)}function Nq(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new uc(e,t,n,r)}function Uce(e){if(e instanceof uc)return new uc(e.h,e.s,e.l,e.opacity);if(e instanceof mw||(e=q1(e)),!e)return new uc;if(e instanceof uc)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,l=a-i,c=(a+i)/2;return l?(t===a?o=(n-r)/l+(n<r)*6:n===a?o=(r-t)/l+2:o=(t-n)/l+4,l/=c<.5?a+i:2-a-i,o*=60):l=c>0&&c<1?0:o,new uc(o,l,c,e.opacity)}function Sat(e,t,n,r){return arguments.length===1?Uce(e):new uc(e,t,n,r??1)}function uc(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}l8(uc,Sat,zce(mw,{brighter(e){return e=e==null?SN:Math.pow(SN,e),new uc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?z1:Math.pow(z1,e),new uc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new fo(H4(e>=240?e-240:e+120,i,r),H4(e,i,r),H4(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new uc(kq(this.h),D_(this.s),D_(this.l),AN(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=AN(this.opacity);return`${e===1?"hsl(":"hsla("}${kq(this.h)}, ${D_(this.s)*100}%, ${D_(this.l)*100}%${e===1?")":`, ${e})`}`}}));function kq(e){return e=(e||0)%360,e<0?e+360:e}function D_(e){return Math.max(0,Math.min(1,e||0))}function H4(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const c8=e=>()=>e;function Aat(e,t){return function(n){return e+n*t}}function Tat(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Pat(e){return(e=+e)==1?qce:function(t,n){return n-t?Tat(t,n,e):c8(isNaN(t)?n:t)}}function qce(e,t){var n=t-e;return n?Aat(e,n):c8(isNaN(e)?t:e)}const Cq=function e(t){var n=Pat(t);function r(i,a){var o=n((i=tO(i)).r,(a=tO(a)).r),l=n(i.g,a.g),c=n(i.b,a.b),u=qce(i.opacity,a.opacity);return function(d){return i.r=o(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function Oat(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function Dat(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Iat(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),a=new Array(n),o;for(o=0;o<r;
vendor: 5,548 bytes, line 1382
1382++o)i[o]=Q0(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(l){for(o=0;o<r;++o)a[o]=i[o](l);return a}}function Rat(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function TN(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Mat(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=Q0(e[i],t[i]):r[i]=t[i];return function(a){for(i in n)r[i]=n[i](a);return r}}var nO=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,W4=new RegExp(nO.source,"g");function Lat(e){return function(){return e}}function Fat(e){return function(t){return e(t)+""}}function $at(e,t){var n=nO.lastIndex=W4.lastIndex=0,r,i,a,o=-1,l=[],c=[];for(e=e+"",t=t+"";(r=nO.exec(e))&&(i=W4.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,c.push({i:o,x:TN(r,i)})),n=W4.lastIndex;return n<t.length&&(a=t.slice(n),l[o]?l[o]+=a:l[++o]=a),l.length<2?c[0]?Fat(c[0].x):Lat(t):(t=c.length,function(u){for(var d=0,f;d<t;++d)l[(f=c[d]).i]=f.x(u);return l.join("")})}function Q0(e,t){var n=typeof t,r;return t==null||n==="boolean"?c8(t):(n==="number"?TN:n==="string"?(r=q1(t))?(t=r,Cq):$at:t instanceof q1?Cq:t instanceof Date?Rat:Dat(t)?Oat:Array.isArray(t)?Iat:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Mat:TN)(e,t)}function u8(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function Bat(e,t){t===void 0&&(t=e,e=Q0);for(var n=0,r=t.length-1,i=t[0],a=new Array(r<0?0:r);n<r;)a[n]=e(i,i=t[++n]);return function(o){var l=Math.max(0,Math.min(r-1,Math.floor(o*=r)));return a[l](o-l)}}function zat(e){return function(){return e}}function PN(e){return+e}var Eq=[0,1];function za(e){return e}function rO(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:zat(isNaN(t)?NaN:.5)}function Uat(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function qat(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=rO(i,r),a=n(o,a)):(r=rO(r,i),a=n(a,o)),function(l){return a(r(l))}}function Vat(e,t,n){var r=Math.min(e.length,t.length)-1,i=new Array(r),a=new Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=rO(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(l){var c=hw(e,l,1,r)-1;return a[c](i[c](l))}}function pw(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function PE(){var e=Eq,t=Eq,n=Q0,r,i,a,o=za,l,c,u;function d(){var h=Math.min(e.length,t.length);return o!==za&&(o=Uat(e[0],e[h-1])),l=h>2?Vat:qat,c=u=null,f}function f(h){return h==null||isNaN(h=+h)?a:(c||(c=l(e.map(r),t,n)))(r(o(h)))}return f.invert=function(h){return o(i((u||(u=l(t,e.map(r),TN)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,PN),d()):e.slice()},f.range=function(h){return arguments.length?(t=Array.from(h),d()):t.slice()},f.rangeRound=function(h){return t=Array.from(h),n=u8,d()},f.clamp=function(h){return arguments.length?(o=h?!0:za,d()):o!==za},f.interpolate=function(h){return arguments.length?(n=h,d()):n},f.unknown=function(h){return arguments.length?(a=h,f):a},function(h,p){return r=h,i=p,d()}}function d8(){return PE()(za,za)}function Hat(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function ON(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Wx(e){return e=ON(Math.abs(e)),e?e[1]:NaN}function Wat(e,t){return function(n,r){for(var i=n.length,a=[],o=0,l=e[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),a.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Gat(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var Kat=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function V1(e){if(!(t=Kat.exec(e)))throw new Error("invalid format: "+e);var t;return new f8({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}V1.prototype=f8.prototype;function f8(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}f8.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Yat(e){e:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+e[n])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Vce;function Xat(e,t){var n=ON(e,t);if(!n)return e+"";var r=n[0],i=n[1],a=i-(Vce=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+ON(e,Math.max(0,t+a-1))[0]}function Sq(e,t){var n=ON(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const Aq={"%":(e,t)=>
vendor: 4,879 bytes, line 1382
1382(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Hat,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Sq(e*100,t),r:Sq,s:Xat,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Tq(e){return e}var Pq=Array.prototype.map,Oq=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Qat(e){var t=e.grouping===void 0||e.thousands===void 0?Tq:Wat(Pq.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?Tq:Gat(Pq.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f){f=V1(f);var h=f.fill,p=f.align,x=f.sign,y=f.symbol,b=f.zero,w=f.width,_=f.comma,j=f.precision,E=f.trim,S=f.type;S==="n"?(_=!0,S="g"):Aq[S]||(j===void 0&&(j=12),E=!0,S="g"),(b||h==="0"&&p==="=")&&(b=!0,h="0",p="=");var T=y==="$"?n:y==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",P=y==="$"?r:/[%p]/.test(S)?o:"",O=Aq[S],D=/[defgprs%]/.test(S);j=j===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function R(L){var M=T,B=P,U,F,H;if(S==="c")B=O(L)+B,L="";else{L=+L;var z=L<0||1/L<0;if(L=isNaN(L)?c:O(Math.abs(L),j),E&&(L=Yat(L)),z&&+L==0&&x!=="+"&&(z=!1),M=(z?x==="("?x:l:x==="-"||x==="("?"":x)+M,B=(S==="s"?Oq[8+Vce/3]:"")+B+(z&&x==="("?")":""),D){for(U=-1,F=L.length;++U<F;)if(H=L.charCodeAt(U),48>H||H>57){B=(H===46?i+L.slice(U+1):L.slice(U))+B,L=L.slice(0,U);break}}}_&&!b&&(L=t(L,1/0));var K=M.length+L.length+B.length,W=K<w?new Array(w-K+1).join(h):"";switch(_&&b&&(L=t(W+L,W.length?w-B.length:1/0),W=""),p){case"<":L=M+L+B+W;break;case"=":L=M+W+L+B;break;case"^":L=W.slice(0,K=W.length>>1)+M+L+B+W.slice(K);break;default:L=W+M+L+B;break}return a(L)}return R.toString=function(){return f+""},R}function d(f,h){var p=u((f=V1(f),f.type="f",f)),x=Math.max(-8,Math.min(8,Math.floor(Wx(h)/3)))*3,y=Math.pow(10,-x),b=Oq[8+x/3];return function(w){return p(y*w)+b}}return{format:u,formatPrefix:d}}var I_,h8,Hce;Jat({thousands:",",grouping:[3],currency:["$",""]});function Jat(e){return I_=Qat(e),h8=I_.format,Hce=I_.formatPrefix,I_}function Zat(e){return Math.max(0,-Wx(Math.abs(e)))}function eot(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Wx(t)/3)))*3-Wx(Math.abs(e)))}function tot(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Wx(t)-Wx(e))+1}function Wce(e,t,n,r){var i=ZP(e,t,n),a;switch(r=V1(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=eot(i,o))&&(r.precision=a),Hce(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=tot(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=Zat(i))&&(r.precision=a-(r.type==="%")*2);break}}return h8(r)}function gh(e){var t=e.domain;return e.ticks=function(n){var r=t();return QP(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return Wce(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,a=r.length-1,o=r[i],l=r[a],c,u,d=10;for(l<o&&(u=o,o=l,l=u,u=i,i=a,a=u);d-- >0;){if(u=JP(o,l,n),u===c)return r[i]=o,r[a]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function DN(){var e=d8();return e.copy=function(){return pw(e,DN())},zl.apply(e,arguments),gh(e)}function Gce(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,PN),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return Gce(e).unknown(t)},e=arguments.length?Array.from(e,PN):[0,1],gh(n)}function Kce(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return a<i&&(o=n,n=r,r=o,o=i,i=a,a=o),e[n]=t.floor(i),e[r]=t.ceil(a),e}function Dq(e){return Math.log(e)}function Iq(e){return Math.exp(e)}function not(e){return-Math.log(-e)}function rot(e){return-Math.exp(-e)}function sot(e){return isFinite(e)?+("1e"+e):e<0?0:e}function iot(e){return e===10?sot:e===Math.E?Math.exp:t=>Math.pow(e,t)}function aot(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function Rq(e){return(t,n)=>-e(-t,n)}function m8(e){const t=e(Dq,Iq),n=t.domain;let r=10,i,a;function o(){return i=aot(r),a=iot(r),n()[0]<0?(i=Rq(i),a=Rq(a),e(not,rot)):e(Dq,Iq),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d<u;f&&([u,d]=[d,u]);let h=i(u),p=i(d),x,y;const b=l==null?10:+l;let w=[];if(!(r%1)&&p-h<b){if(h=Math.floor(h),p=Math.ceil(p),u>0){for(;h<=p;
vendor: 4,472 bytes, line 1382
1382++h)for(x=1;x<r;++x)if(y=h<0?x/a(-h):x*a(h),!(y<u)){if(y>d)break;w.push(y)}}else for(;h<=p;++h)for(x=r-1;x>=1;--x)if(y=h>0?x/a(-h):x*a(h),!(y<u)){if(y>d)break;w.push(y)}w.length*2<b&&(w=QP(u,d,b))}else w=QP(h,p,Math.min(p-h,b)).map(a);return f?w.reverse():w},t.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=V1(c)).precision==null&&(c.trim=!0),c=h8(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/a(Math.round(i(d)));return f*r<r-.5&&(f*=r),f<=u?c(d):""}},t.nice=()=>n(Kce(n(),{floor:l=>a(Math.floor(i(l))),ceil:l=>a(Math.ceil(i(l)))})),t}function Yce(){const e=m8(PE()).domain([1,10]);return e.copy=()=>pw(e,Yce()).base(e.base()),zl.apply(e,arguments),e}function Mq(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Lq(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function p8(e){var t=1,n=e(Mq(t),Lq(t));return n.constant=function(r){return arguments.length?e(Mq(t=+r),Lq(t)):t},gh(n)}function Xce(){var e=p8(PE());return e.copy=function(){return pw(e,Xce()).constant(e.constant())},zl.apply(e,arguments)}function Fq(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function oot(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function lot(e){return e<0?-e*e:e*e}function g8(e){var t=e(za,za),n=1;function r(){return n===1?e(za,za):n===.5?e(oot,lot):e(Fq(n),Fq(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},gh(t)}function x8(){var e=g8(PE());return e.copy=function(){return pw(e,x8()).exponent(e.exponent())},zl.apply(e,arguments),e}function cot(){return x8.apply(null,arguments).exponent(.5)}function $q(e){return Math.sign(e)*e*e}function uot(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function Qce(){var e=d8(),t=[0,1],n=!1,r;function i(a){var o=uot(e(a));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(a){return e.invert($q(a))},i.domain=function(a){return arguments.length?(e.domain(a),i):e.domain()},i.range=function(a){return arguments.length?(e.range((t=Array.from(a,PN)).map($q)),i):t.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(n=!!a,i):n},i.clamp=function(a){return arguments.length?(e.clamp(a),i):e.clamp()},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return Qce(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},zl.apply(i,arguments),gh(i)}function Jce(){var e=[],t=[],n=[],r;function i(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o<l;)n[o-1]=pat(e,o/l);return a}function a(o){return o==null||isNaN(o=+o)?r:t[hw(n,o)]}return a.invertExtent=function(o){var l=t.indexOf(o);return l<0?[NaN,NaN]:[l>0?n[l-1]:e[0],l<n.length?n[l]:e[e.length-1]]},a.domain=function(o){if(!arguments.length)return e.slice();e=[];for(let l of o)l!=null&&!isNaN(l=+l)&&e.push(l);return e.sort(Tf),i()},a.range=function(o){return arguments.length?(t=Array.from(o),i()):t.slice()},a.unknown=function(o){return arguments.length?(r=o,a):r},a.quantiles=function(){return n.slice()},a.copy=function(){return Jce().domain(e).range(t).unknown(r)},zl.apply(a,arguments)}function Zce(){var e=0,t=1,n=1,r=[.5],i=[0,1],a;function o(c){return c!=null&&c<=c?i[hw(r,c,0,n)]:a}function l(){var c=-1;for(r=new Array(n);++c<n;)r[c]=((c+1)*t-(c-n)*e)/(n+1);return o}return o.domain=function(c){return arguments.length?([e,t]=c,e=+e,t=+t,l()):[e,t]},o.range=function(c){return arguments.length?(n=(i=Array.from(c)).length-1,l()):i.slice()},o.invertExtent=function(c){var u=i.indexOf(c);return u<0?[NaN,NaN]:u<1?[e,r[0]]:u>=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(a=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Zce().domain([e,t]).range(i).unknown(a)},zl.apply(gh(o),arguments)}function eue(){var e=[.5],t=[0,1],n,r=1;function i(a){return a!=null&&a<=a?t[hw(e,a,0,r)]:n}return i.domain=function(a){return arguments.length?(e=Array.from(a),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var o=t.indexOf(a);return[e[o-1],e[o]]},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return eue().domain(e).range(t).unknown(n)},zl.apply(i,arguments)}const G4=new Date,K4=new Date;function Oi(e,t,n,r){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>
vendor: 5,803 bytes, line 1382
1382(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const o=i(a),l=i.ceil(a);return a-o<l-a?o:l},i.offset=(a,o)=>(t(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,l)=>{const c=[];if(a=i.ceil(a),l=l==null?1:Math.floor(l),!(a<o)||!(l>0))return c;let u;do c.push(u=new Date(+a)),t(a,l),e(a);while(u<a&&a<o);return c},i.filter=a=>Oi(o=>{if(o>=o)for(;e(o),!a(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!a(o););else for(;--l>=0;)for(;t(o,1),!a(o););}),n&&(i.count=(a,o)=>(G4.setTime(+a),K4.setTime(+o),e(G4),e(K4),Math.floor(n(G4,K4))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(r?o=>r(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const IN=Oi(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);IN.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Oi(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):IN);IN.range;const Bu=1e3,kl=Bu*60,zu=kl*60,dd=zu*24,y8=dd*7,Bq=dd*30,Y4=dd*365,dm=Oi(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Bu)},(e,t)=>(t-e)/Bu,e=>e.getUTCSeconds());dm.range;const v8=Oi(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Bu)},(e,t)=>{e.setTime(+e+t*kl)},(e,t)=>(t-e)/kl,e=>e.getMinutes());v8.range;const b8=Oi(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*kl)},(e,t)=>(t-e)/kl,e=>e.getUTCMinutes());b8.range;const w8=Oi(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Bu-e.getMinutes()*kl)},(e,t)=>{e.setTime(+e+t*zu)},(e,t)=>(t-e)/zu,e=>e.getHours());w8.range;const _8=Oi(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*zu)},(e,t)=>(t-e)/zu,e=>e.getUTCHours());_8.range;const gw=Oi(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*kl)/dd,e=>e.getDate()-1);gw.range;const OE=Oi(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/dd,e=>e.getUTCDate()-1);OE.range;const tue=Oi(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/dd,e=>Math.floor(e/dd));tue.range;function _p(e){return Oi(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*kl)/y8)}const DE=_p(0),RN=_p(1),dot=_p(2),fot=_p(3),Gx=_p(4),hot=_p(5),mot=_p(6);DE.range;RN.range;dot.range;fot.range;Gx.range;hot.range;mot.range;function jp(e){return Oi(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/y8)}const IE=jp(0),MN=jp(1),pot=jp(2),got=jp(3),Kx=jp(4),xot=jp(5),yot=jp(6);IE.range;MN.range;pot.range;got.range;Kx.range;xot.range;yot.range;const j8=Oi(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());j8.range;const N8=Oi(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());N8.range;const fd=Oi(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());fd.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Oi(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});fd.range;const hd=Oi(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());hd.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Oi(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});hd.range;function nue(e,t,n,r,i,a){const o=[[dm,1,Bu],[dm,5,5*Bu],[dm,15,15*Bu],[dm,30,30*Bu],[a,1,kl],[a,5,5*kl],[a,15,15*kl],[a,30,30*kl],[i,1,zu],[i,3,3*zu],[i,6,6*zu],[i,12,12*zu],[r,1,dd],[r,2,2*dd],[n,1,y8],[t,1,Bq],[t,3,3*Bq],[e,1,Y4]];function l(u,d,f){const h=d<u;h&&([u,d]=[d,u]);const p=f&&typeof f.range=="function"?f:c(u,d,f),x=p?p.range(u,+d+1):[];return h?x.reverse():x}function c(u,d,f){const h=Math.abs(d-u)/f,p=a8(([,,b])=>b).right(o,h);if(p===o.length)return e.every(ZP(u/Y4,d/Y4,f));if(p===0)return IN.every(Math.max(ZP(u,d,f),1));const[x,y]=o[h/o[p-1][2]<o[p][2]/h?p-1:p];return x.every(y)}return[l,c]}const[vot,bot]=nue(hd,N8,IE,tue,_8,b8),[wot,_ot]=nue(fd,j8,DE,gw,w8,v8);function X4(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Q4(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function zy(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function jot(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,l=e.months,c=e.shortMonths,u=Uy(i),d=qy(i),f=Uy(a),h=qy(a),p=Uy(o),x=qy(o),y=Uy(l),b=qy(l),w=Uy(c),_=qy(c),j={a:z,A:K,b:W,B:q,c:null,d:Wq,e:Wq,f:Wot,g:nlt,G:slt,H:qot,I:Vot,j:Hot,L:rue,m:Got,M:Kot,p:oe,q:J,Q:Yq,s:Xq,S:Yot,u:Xot,U:Qot,V:Jot,w:Zot,W:elt,x:null,X:null,y:tlt,Y:rlt,Z:ilt,"%":Kq},E={a:Y,A:Z,b:G,B:se,c:null,d:Gq,e:Gq,f:clt,g:vlt,G:wlt,H:alt,I:olt,j:llt,L:iue,m:ult,M:dlt,p:ce,q:le,Q:Yq,s:Xq,S:flt,u:hlt,U:mlt,V:plt,w:glt,W:xlt,x:null,X:null,y:ylt,Y:blt,Z:_lt,"%":Kq},S={a:R,A:L,b:M,B,c:U,d:Vq,e:Vq,f:$ot,g:qq,G:Uq,H:Hq,I:Hq,j:Rot,L:Fot,m:Iot,M:Mot,p:D,q:Dot,Q:zot,s:Uot,S:Lot,u:Sot,U:Aot,V:Tot,w:Eot,W:Pot,x:F,X:H,y:qq,Y:Uq,Z:Oot,"%":Bot};j.x=T(n,j),j.X=T(r,j),j.c=T(t,j),E.x=T(n,E),E.X=T(r,E),E.c=T(t,E);function T(fe,be){return function(_e){var pe=[],Te=-1,Ge=0,Ne=fe.length,it,qe,Qe;for(_e instanceof Date||(_e=new Date(+_e));++Te<Ne;
vendor: 7,741 bytes, line 1382
1382)fe.charCodeAt(Te)===37&&(pe.push(fe.slice(Ge,Te)),(qe=zq[it=fe.charAt(++Te)])!=null?it=fe.charAt(++Te):qe=it==="e"?" ":"0",(Qe=be[it])&&(it=Qe(_e,qe)),pe.push(it),Ge=Te+1);return pe.push(fe.slice(Ge,Te)),pe.join("")}}function P(fe,be){return function(_e){var pe=zy(1900,void 0,1),Te=O(pe,fe,_e+="",0),Ge,Ne;if(Te!=_e.length)return null;if("Q"in pe)return new Date(pe.Q);if("s"in pe)return new Date(pe.s*1e3+("L"in pe?pe.L:0));if(be&&!("Z"in pe)&&(pe.Z=0),"p"in pe&&(pe.H=pe.H%12+pe.p*12),pe.m===void 0&&(pe.m="q"in pe?pe.q:0),"V"in pe){if(pe.V<1||pe.V>53)return null;"w"in pe||(pe.w=1),"Z"in pe?(Ge=Q4(zy(pe.y,0,1)),Ne=Ge.getUTCDay(),Ge=Ne>4||Ne===0?MN.ceil(Ge):MN(Ge),Ge=OE.offset(Ge,(pe.V-1)*7),pe.y=Ge.getUTCFullYear(),pe.m=Ge.getUTCMonth(),pe.d=Ge.getUTCDate()+(pe.w+6)%7):(Ge=X4(zy(pe.y,0,1)),Ne=Ge.getDay(),Ge=Ne>4||Ne===0?RN.ceil(Ge):RN(Ge),Ge=gw.offset(Ge,(pe.V-1)*7),pe.y=Ge.getFullYear(),pe.m=Ge.getMonth(),pe.d=Ge.getDate()+(pe.w+6)%7)}else("W"in pe||"U"in pe)&&("w"in pe||(pe.w="u"in pe?pe.u%7:"W"in pe?1:0),Ne="Z"in pe?Q4(zy(pe.y,0,1)).getUTCDay():X4(zy(pe.y,0,1)).getDay(),pe.m=0,pe.d="W"in pe?(pe.w+6)%7+pe.W*7-(Ne+5)%7:pe.w+pe.U*7-(Ne+6)%7);return"Z"in pe?(pe.H+=pe.Z/100|0,pe.M+=pe.Z%100,Q4(pe)):X4(pe)}}function O(fe,be,_e,pe){for(var Te=0,Ge=be.length,Ne=_e.length,it,qe;Te<Ge;){if(pe>=Ne)return-1;if(it=be.charCodeAt(Te++),it===37){if(it=be.charAt(Te++),qe=S[it in zq?be.charAt(Te++):it],!qe||(pe=qe(fe,_e,pe))<0)return-1}else if(it!=_e.charCodeAt(pe++))return-1}return pe}function D(fe,be,_e){var pe=u.exec(be.slice(_e));return pe?(fe.p=d.get(pe[0].toLowerCase()),_e+pe[0].length):-1}function R(fe,be,_e){var pe=p.exec(be.slice(_e));return pe?(fe.w=x.get(pe[0].toLowerCase()),_e+pe[0].length):-1}function L(fe,be,_e){var pe=f.exec(be.slice(_e));return pe?(fe.w=h.get(pe[0].toLowerCase()),_e+pe[0].length):-1}function M(fe,be,_e){var pe=w.exec(be.slice(_e));return pe?(fe.m=_.get(pe[0].toLowerCase()),_e+pe[0].length):-1}function B(fe,be,_e){var pe=y.exec(be.slice(_e));return pe?(fe.m=b.get(pe[0].toLowerCase()),_e+pe[0].length):-1}function U(fe,be,_e){return O(fe,t,be,_e)}function F(fe,be,_e){return O(fe,n,be,_e)}function H(fe,be,_e){return O(fe,r,be,_e)}function z(fe){return o[fe.getDay()]}function K(fe){return a[fe.getDay()]}function W(fe){return c[fe.getMonth()]}function q(fe){return l[fe.getMonth()]}function oe(fe){return i[+(fe.getHours()>=12)]}function J(fe){return 1+~~(fe.getMonth()/3)}function Y(fe){return o[fe.getUTCDay()]}function Z(fe){return a[fe.getUTCDay()]}function G(fe){return c[fe.getUTCMonth()]}function se(fe){return l[fe.getUTCMonth()]}function ce(fe){return i[+(fe.getUTCHours()>=12)]}function le(fe){return 1+~~(fe.getUTCMonth()/3)}return{format:function(fe){var be=T(fe+="",j);return be.toString=function(){return fe},be},parse:function(fe){var be=P(fe+="",!1);return be.toString=function(){return fe},be},utcFormat:function(fe){var be=T(fe+="",E);return be.toString=function(){return fe},be},utcParse:function(fe){var be=P(fe+="",!0);return be.toString=function(){return fe},be}}}var zq={"-":"",_:" ",0:"0"},Gi=/^\s*\d+/,Not=/^%/,kot=/[\\^$*+?|[\]().{}]/g;function nr(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a<n?new Array(n-a+1).join(t)+i:i)}function Cot(e){return e.replace(kot,"\\$&")}function Uy(e){return new RegExp("^(?:"+e.map(Cot).join("|")+")","i")}function qy(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function Eot(e,t,n){var r=Gi.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Sot(e,t,n){var r=Gi.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Aot(e,t,n){var r=Gi.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Tot(e,t,n){var r=Gi.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Pot(e,t,n){var r=Gi.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Uq(e,t,n){var r=Gi.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function qq(e,t,n){var r=Gi.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Oot(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Dot(e,t,n){var r=Gi.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function Iot(e,t,n){var r=Gi.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Vq(e,t,n){var r=Gi.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Rot(e,t,n){var r=Gi.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Hq(e,t,n){var r=Gi.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Mot(e,t,n){var r=Gi.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Lot(e,t,n){var r=Gi.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Fot(e,t,n){var r=Gi.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function $ot(e,t,n){var r=Gi.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Bot(e,t,n){var r=Not.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function zot(e,t,n){var r=Gi.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Uot(e,t,n){var r=Gi.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Wq(e,t){return nr(e.getDate(),t,2)}function qot(e,t){return nr(e.getHours(),t,2)}function Vot(e,t){return nr(e.getHours()%12||12,t,2)}function Hot(e,t){return nr(1+gw.count(fd(e),e),t,3)}function rue(e,t){return nr(e.getMilliseconds(),t,3)}function Wot(e,t){return rue(e,t)+"000"}function Got(e,t){return nr(e.getMonth()+1,t,2)}function Kot(e,t){return nr(e.getMinutes(),t,2)}function Yot(e,t){return nr(e.getSeconds(),t,2)}function Xot(e){var t=e.getDay();return t===0?7:t}function Qot(e,t){return nr(DE.count(fd(e)-1,e),t,2)}function sue(e){var t=e.getDay();return t>=4||t===0?Gx(e):Gx.ceil(e)}function Jot(e,t){return e=sue(e),nr(Gx.count(fd(e),e)+(fd(e).getDay()===4),t,2)}function Zot(e){return e.getDay()}function elt(e,t){return nr(RN.count(fd(e)-1,e),t,2)}function tlt(e,t){return nr(e.getFullYear()%100,t,2)}function nlt(e,t){return e=sue(e),nr(e.getFullYear()%100,t,2)}function rlt(e,t){return nr(e.getFullYear()%1e4,t,4)}function slt(e,t){var n=e.getDay();return e=n>=4||n===0?Gx(e):Gx.ceil(e),nr(e.getFullYear()%1e4,t,4)}function ilt(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+nr(t/60|0,"0",2)+nr(t%60,"0",2)}function Gq(e,t){return nr(e.getUTCDate(),t,2)}function alt(e,t){return nr(e.getUTCHours(),t,2)}function olt(e,t){return nr(e.getUTCHours()%12||12,t,2)}function llt(e,t){return nr(1+OE.count(hd(e),e),t,3)}function iue(e,t){return nr(e.getUTCMilliseconds(),t,3)}function clt(e,t){return iue(e,t)+"000"}function ult(e,t){return nr(e.getUTCMonth()+1,t,2)}function dlt(e,t){return nr(e.getUTCMinutes(),t,2)}function flt(e,t){return nr(e.getUTCSeconds(),t,2)}function hlt(e){var t=e.getUTCDay();return t===0?7:t}function mlt(e,t){return nr(IE.count(hd(e)-1,e),t,2)}function aue(e){var t=e.getUTCDay();return t>=4||t===0?Kx(e):Kx.ceil(e)}function plt(e,t){return e=aue(e),nr(Kx.count(hd(e),e)+(hd(e).getUTCDay()===4),t,2)}function glt(e){return e.getUTCDay()}function xlt(e,t){return nr(MN.count(hd(e)-1,e),t,2)}function ylt(e,t){return nr(e.getUTCFullYear()%100,t,2)}function vlt(e,t){return e=aue(e),nr(e.getUTCFullYear()%100,t,2)}function blt(e,t){return nr(e.getUTCFullYear()%1e4,t,4)}function wlt(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Kx(e):Kx.ceil(e),nr(e.getUTCFullYear()%1e4,t,4)}function _lt(){return"+0000"}function Kq(){return"%"}function Yq(e){return+e}function Xq(e){return Math.floor(+e/1e3)}var Xp,oue,lue;jlt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
1382ay","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function jlt(e){return Xp=jot(e),oue=Xp.format,Xp.parse,lue=Xp.utcFormat,Xp.utcParse,Xp}function Nlt(e){return new Date(e)}function klt(e){return e instanceof Date?+e:+new Date(+e)}function k8(e,t,n,r,i,a,o,l,c,u){var d=d8(),f=d.invert,h=d.domain,p=u(".%L"),x=u(":%S"),y=u("%I:%M"),b=u("%I %p"),w=u("%a %d"),_=u("%b %d"),j=u("%B"),E=u("%Y");function S(T){return(c(T)<T?p:l(T)<T?x:o(T)<T?y:a(T)<T?b:r(T)<T?i(T)<T?w:_:n(T)<T?j:E)(T)}return d.invert=function(T){return new Date(f(T))},d.domain=function(T){return arguments.length?h(Array.from(T,klt)):h().map(Nlt)},d.ticks=function(T){var P=h();return e(P[0],P[P.length-1],T??10)},d.tickFormat=function(T,P){return P==null?S:u(P)},d.nice=function(T){var P=h();return(!T||typeof T.range!="function")&&(T=t(P[0],P[P.length-1],T??10)),T?h(Kce(P,T)):d},d.copy=function(){return pw(d,k8(e,t,n,r,i,a,o,l,c,u))},d}function Clt(){return zl.apply(k8(wot,_ot,fd,j8,DE,gw,w8,v8,dm,oue).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Elt(){return zl.apply(k8(vot,bot,hd,N8,IE,OE,_8,b8,dm,lue).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function RE(){var e=0,t=1,n,r,i,a,o=za,l=!1,c;function u(f){return f==null||isNaN(f=+f)?c:o(i===0?.5:(f=(a(f)-n)*i,l?Math.max(0,Math.min(1,f)):f))}u.domain=function(f){return arguments.length?([e,t]=f,n=a(e=+e),r=a(t=+t),i=n===r?0:1/(r-n),u):[e,t]},u.clamp=function(f){return arguments.length?(l=!!f,u):l},u.interpolator=function(f){return arguments.length?(o=f,u):o};function d(f){return function(h){var p,x;return arguments.length?([p,x]=h,o=f(p,x),u):[o(0),o(1)]}}return u.range=d(Q0),u.rangeRound=d(u8),u.unknown=function(f){return arguments.length?(c=f,u):c},function(f){return a=f,n=f(e),r=f(t),i=n===r?0:1/(r-n),u}}function xh(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function cue(){var e=gh(RE()(za));return e.copy=function(){return xh(e,cue())},Ed.apply(e,arguments)}function uue(){var e=m8(RE()).domain([1,10]);return e.copy=function(){return xh(e,uue()).base(e.base())},Ed.apply(e,arguments)}function due(){var e=p8(RE());return e.copy=function(){return xh(e,due()).constant(e.constant())},Ed.apply(e,arguments)}function C8(){var e=g8(RE());return e.copy=function(){return xh(e,C8()).exponent(e.exponent())},Ed.apply(e,arguments)}function Slt(){return C8.apply(null,arguments).exponent(.5)}function fue(){var e=[],t=za;function n(r){if(r!=null&&!isNaN(r=+r))return t((hw(e,r,1)-1)/(e.length-1))}return n.domain=function(r){if(!arguments.length)return e.slice();e=[];for(let i of r)i!=null&&!isNaN(i=+i)&&e.push(i);return e.sort(Tf),n},n.interpolator=function(r){return arguments.length?(t=r,n):t},n.range=function(){return e.map((r,i)=>t(i/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,a)=>mat(e,a/r))},n.copy=function(){return fue(t).domain(e)},Ed.apply(n,arguments)}function ME(){var e=0,t=.5,n=1,r=1,i,a,o,l,c,u=za,d,f=!1,h;function p(y){return isNaN(y=+y)?h:(y=.5+((y=+d(y))-a)*(r*y<r*a?l:c),u(f?Math.max(0,Math.min(1,y)):y))}p.domain=function(y){return arguments.length?([e,t,n]=y,i=d(e=+e),a=d(t=+t),o=d(n=+n),l=i===a?0:.5/(a-i),c=a===o?0:.5/(o-a),r=a<i?-1:1,p):[e,t,n]},p.clamp=function(y){return arguments.length?(f=!!y,p):f},p.interpolator=function(y){return arguments.length?(u=y,p):u};function x(y){return function(b){var w,_,j;return arguments.length?([w,_,j]=b,u=Bat(y,[w,_,j]),p):[u(0),u(.5),u(1)]}}return p.range=x(Q0),p.rangeRound=x(u8),p.unknown=function(y){return arguments.length?(h=y,p):h},function(y){return d=y,i=y(e),a=y(t),o=y(n),l=i===a?0:.5/(a-i),c=a===o?0:.5/(o-a),r=a<i?-1:1,p}}function hue(){var e=gh(ME()(za));return e.copy=function(){return xh(e,hue())},Ed.apply(e,arguments)}function mue(){var e=m8(ME()).domain([.1,1,10]);return e.copy=function(){return xh(e,mue()).base(e.base())},Ed.apply(e,arguments)}function pue(){var e=p8(ME());return e.copy=function(){return xh(e,pue()).constant(e.constant())},Ed.apply(e,arguments)}function E8(){var e=g8(ME());return e.copy=function(){return xh(e,E8()).exponent(e.exponent())},Ed.apply(e,arguments)}function Alt(){return E8.apply(null,arguments).exponent(.5)}const Qq=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:B1,scaleDiverging:hue,scaleDivergingLog:mue,scaleDivergingPow:E8,scaleDivergingSqrt:Alt,scaleDivergingSymlog:pue,scaleIdentity:Gce,scaleImplicit:eO,scaleLinear:DN,scaleLog:Yce,scaleOrdinal:o8,scalePoint:Mv,scalePow:x8,scaleQuantile:Jce,scaleQuantize:Zce,scaleRadial:Qce,scaleSequential:cue,scaleSequentialLog:uue,scaleSequentialPow:C8,scaleSequentialQuantile:fue,scaleSequentialSqrt:Slt,scaleSequentialSymlog:due,scaleSqrt:cot,scaleSymlog:Xce,scaleThreshold:eue,scaleTime:Clt,scaleUtc:Elt,tickFormat:Wce},Symbol.toStringTag,{value:"Module"}));var Tlt=z0;function Plt(e,t,n){for(var r=-1,i=e.length;++r<i;){var a=e[r],o=t(a);if(o!=null&&(l===void 0?o===o&&!Tlt(o):n(o,l)))var l=o,c=a}return c}var LE=Plt;function Olt(e,t){return e>t}var gue=Olt,Dlt=LE,Ilt=gue,Rlt=X0;function Mlt(e){return e&&e.length?Dlt(e,Rlt,Ilt):void 0}var Llt=Mlt;const pf=dr(Llt);function Flt(e,t){return e<t}var xue=Flt,$lt=LE,Blt=xue,zlt=X0;function Ult(e){return e&&e.length?$lt(e,zlt,Blt):void 0}var qlt=Ult;const FE=dr(qlt);var Vlt=B6,Hlt=ph,Wlt=kce,Glt=ko;function Klt(e,t){var n=Glt(e)?Vlt:Wlt;return n(e,Hlt(t))}var Ylt=Klt,Xlt=jce,Qlt=Ylt;function Jlt(e,t){return Xlt(Qlt(e,t),1)}var Zlt=Jlt;const ect=dr(Zlt);var tct=n8;function nct(e,t){return tct(e,t)}var rct=nct;const Yx=dr(rct);
vendor: 62,653 bytes, lines 1382-1409
1382var J0=1e9,sct={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},A8,ms=!0,Ml="[DecimalError] ",Pm=Ml+"Invalid argument: ",S8=Ml+"Exponent out of range: ",Z0=Math.floor,qh=Math.pow,ict=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Bo,Li=1e7,as=7,yue=9007199254740991,LN=Z0(yue/as),Nt={};Nt.absoluteValue=Nt.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};Nt.comparedTo=Nt.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=r<i?r:i;t<n;++t)if(a.d[t]!==e.d[t])return a.d[t]>e.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1};Nt.decimalPlaces=Nt.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*as;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};Nt.dividedBy=Nt.div=function(e){return Ku(this,new this.constructor(e))};Nt.dividedToIntegerBy=Nt.idiv=function(e){var t=this,n=t.constructor;return Ur(Ku(t,new n(e),0,1),n.precision)};Nt.equals=Nt.eq=function(e){return!this.cmp(e)};Nt.exponent=function(){return fi(this)};Nt.greaterThan=Nt.gt=function(e){return this.cmp(e)>0};Nt.greaterThanOrEqualTo=Nt.gte=function(e){return this.cmp(e)>=0};Nt.isInteger=Nt.isint=function(){return this.e>this.d.length-2};Nt.isNegative=Nt.isneg=function(){return this.s<0};Nt.isPositive=Nt.ispos=function(){return this.s>0};Nt.isZero=function(){return this.s===0};Nt.lessThan=Nt.lt=function(e){return this.cmp(e)<0};Nt.lessThanOrEqualTo=Nt.lte=function(e){return this.cmp(e)<1};Nt.logarithm=Nt.log=function(e){var t,n=this,r=n.constructor,i=r.precision,a=i+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(Bo))throw Error(Ml+"NaN");if(n.s<1)throw Error(Ml+(n.s?"NaN":"-Infinity"));return n.eq(Bo)?new r(0):(ms=!1,t=Ku(H1(n,a),H1(e,a),a),ms=!0,Ur(t,i))};Nt.minus=Nt.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?wue(t,e):vue(t,(e.s=-e.s,e))};Nt.modulo=Nt.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(e=new r(e),!e.s)throw Error(Ml+"NaN");return n.s?(ms=!1,t=Ku(n,e,0,1).times(e),ms=!0,n.minus(t)):Ur(new r(n),i)};Nt.naturalExponential=Nt.exp=function(){return bue(this)};Nt.naturalLogarithm=Nt.ln=function(){return H1(this)};Nt.negated=Nt.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Nt.plus=Nt.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?vue(t,e):wue(t,(e.s=-e.s,e))};Nt.precision=Nt.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Pm+e);if(t=fi(i)+1,r=i.d.length-1,n=r*as+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};Nt.squareRoot=Nt.sqrt=function(){var e,t,n,r,i,a,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Ml+"NaN")}for(e=fi(l),ms=!1,i=Math.sqrt(+l),i==0||i==1/0?(t=Xc(l.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=Z0((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(i.toString()),n=c.precision,i=o=n+3;;)if(a=r,r=a.plus(Ku(l,a,o+2)).times(.5),Xc(a.d).slice(0,o)===(t=Xc(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(Ur(a,n+1,0),a.times(a).eq(l)){r=a;break}}else if(t!="9999")break;o+=4}return ms=!0,Ur(r,n)};Nt.times=Nt.mul=function(e){var t,n,r,i,a,o,l,c,u,d=this,f=d.constructor,h=d.d,p=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=h.length,u=p.length,c<u&&(a=h,h=p,p=a,o=c,c=u,u=o),a=[],o=c+u,r=o;r--;)a.push(0);for(r=u;--r>=0;){for(t=0,i=c+r;i>r;)l=a[i]+p[r]*h[i-r-1]+t,a[i--]=l%Li|0,t=l/Li|0;a[i]=(a[i]+t)%Li|0}for(;!a[--o];)a.pop();return t?++n:a.shift(),e.d=a,e.e=n,ms?Ur(e,f.precision):e};Nt.toDecimalPlaces=Nt.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(fu(e,0,J0),t===void 0?t=r.rounding:fu(t,0,8),Ur(n,e+fi(n)+1,t))};Nt.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=ap(r,!0):(fu(e,0,J0),t===void 0?t=i.rounding:fu(t,0,8),r=Ur(new i(r),e+1,t),n=ap(r,!0,e+1)),n};Nt.toFixed=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?ap(i):(fu(e,0,J0),t===void 0?t=a.rounding:fu(t,0,8),r=Ur(new a(i),e+fi(i)+1,t),n=ap(r.abs(),!1,e+fi(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Nt.toInteger=Nt.toint=function(){var e=this,t=e.constructor;return Ur(new t(e),fi(e)+1,t.rounding)};Nt.toNumber=function(){return+this};Nt.toPower=Nt.pow=function(e){var t,n,r,i,a,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(Bo);if(l=new c(l),!l.s){if(e.s<1)throw Error(Ml+"Infinity");return l}if(l.eq(Bo))return l;if(r=c.precision,e.eq(Bo))return Ur(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,a=l.s,o){if((n=d<0?-d:d)<=yue){for(i=new c(Bo),t=Math.ceil(r/as+4),ms=!1;n%2&&(i=i.times(l),Zq(i.d,t)),n=Z0(n/2),n!==0;)l=l.times(l),Zq(l.d,t);return ms=!0,e.s<0?new c(Bo).div(i):Ur(i,r)}}else if(a<0)throw Error(Ml+"NaN");return a=a<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,ms=!1,i=e.times(H1(l,r+u)),ms=!0,i=bue(i),i.s=a,i};Nt.toPrecision=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?(n=fi(i),r=ap(i,n<=a.toExpNeg||n>=a.toExpPos)):(fu(e,1,J0),t===void 0?t=a.rounding:fu(t,0,8),i=Ur(new a(i),e,t),n=fi(i),r=ap(i,e<=n||n<=a.toExpNeg,e)),r};Nt.toSignificantDigits=Nt.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(fu(e,1,J0),t===void 0?t=r.rounding:fu(t,0,8)),Ur(new r(n),e,t)};Nt.toString=Nt.valueOf=Nt.val=Nt.toJSON=Nt[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=fi(e),n=e.constructor;return ap(e,t<=n.toExpNeg||t>=n.toExpPos)};function vue(e,t){var n,r,i,a,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),ms?Ur(t,f):t;if(c=e.d,u=t.d,o=e.e,i=t.e,c=c.slice(),a=o-i,a){for(a<0?(r=c,a=-a,l=u.length):(r=u,i=o,l=c.length),o=Math.ceil(f/as),l=o>l?o+1:l+1,a>l&&(a=l,r.length=1),r.reverse();a--;)r.push(0);r.reverse()}for(l=c.length,a=u.length,l-a<0&&(a=l,r=u,u=c,c=r),n=0;a;)n=(c[--a]=c[a]+u[a]+n)/Li|0,c[a]%=Li;for(n&&(c.unshift(n),++i),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=i,ms?Ur(t,f):t}function fu(e,t,n){if(e!==~~e||e<t||e>n)throw Error(Pm+e)}function Xc(e){var t,n,r,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;t<i;t++)r=e[t]+"",n=as-r.length,n&&(a+=Qd(n)),a+=r;o=e[t],r=o+"",n=as-r.length,n&&(a+=Qd(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}var Ku=function(){function e(r,i){var a,o=0,l=r.length;for(r=r.slice();l--;)a=r[l]*i+o,r[l]=a%Li|0,o=a/Li|0;return o&&r.unshift(o),r}function t(r,i,a,o){var l,c;if(a!=o)c=a>o?1:-1;else for(l=c=0;l<a;l++)if(r[l]!=i[l]){c=r[l]>i[l]?1:-1;break}return c}function n(r,i,a){for(var o=0;a--;)r[a]-=o,o=r[a]<i[a]?1:0,r[a]=o*Li+r[a]-i[a];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,a,o){var l,c,u,d,f,h,p,x,y,b,w,_,j,E,S,T,P,O,D=r.constructor,R=r.s==i.s?1:-1,L=r.d,M=i.d;if(!r.s)return new D(r);if(!i.s)throw Error(Ml+"Division by zero");for(c=r.e-i.e,P=M.length,S=L.length,p=new D(R),x=p.d=[],u=0;M[u]==(L[u]||0);)++u;if(M[u]>(L[u]||0)&&--c,a==null?_=a=D.precision:o?_=a+(fi(r)-fi(i))+1:_=a,_<0)return new D(0);if(_=_/as+2|0,u=0,P==1)for(d=0,M=M[0],_++;(u<S||d)&&_--;u++)j=d*Li+(L[u]||0),x[u]=j/M|0,d=j%M|0;else{for(d=Li/(M[0]+1)|0,d>1&&(M=e(M,d),L=e(L,d),P=M.length,S=L.length),E=P,y=L.slice(0,P),b=y.length;b<P;)y[b++]=0;O=M.slice(),O.unshift(0),T=M[0],M[1]>=Li/2&&++T;do d=0,l=t(M,y,P,b),l<0?(w=y[0],P!=b&&(w=w*Li+(y[1]||0)),d=w/T|0,d>1?(d>=Li&&(d=Li-1),f=e(M,d),h=f.length,b=y.length,l=t(f,y,h,b),l==1&&(d--,n(f,P<h?O:M,h))):(d==0&&(l=d=1),f=M.slice()),h=f.length,h<b&&f.unshift(0),n(y,f,b),l==-1&&(b=y.length,l=t(M,y,P,b),l<1&&(d++,n(y,P<b?O:M,b))),b=y.length):l===0&&(d++,y=[0]),x[u++]=d,l&&y[0]?y[b++]=L[E]||0:(y=[L[E]],b=1);while((E++<S||y[0]!==void 0)&&_--)}return x[0]||x.shift(),p.e=c,Ur(p,o?a+fi(p)+1:a)}}();function bue(e,t){var n,r,i,a,o,l,c=0,u=0,d=e.constructor,f=d.precision;if(fi(e)>16)throw Error(S8+fi(e));if(!e.s)return new d(Bo);for(ms=!1,l=f,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(qh(2,u))/Math.LN10*2+5|0,l+=r,n=i=a=new d(Bo),d.precision=l;;){if(i=Ur(i.times(e),l),n=n.times(++c),o=a.plus(Ku(i,n,l)),Xc(o.d).slice(0,l)===Xc(a.d).slice(0,l)){for(;u--;)a=Ur(a.times(a),l);return d.precision=f,t==null?(ms=!0,Ur(a,f)):a}a=o}}function fi(e){for(var t=e.e*as,n=e.d[0];n>=10;n/=10)t++;return t}function J4(e,t,n){if(t>e.LN10.sd())throw ms=!0,n&&(e.precision=n),Error(Ml+"LN10 precision limit exceeded");return Ur(new e(e.LN10),t)}function Qd(e){for(var t="";e--;)t+="0";return t}function H1(e,t){var n,r,i,a,o,l,c,u,d,f=1,h=10,p=e,x=p.d,y=p.constructor,b=y.precision;if(p.s<1)throw Error(Ml+(p.s?"NaN":"-Infinity"));if(p.eq(Bo))return new y(0);if(t==null?(ms=!1,u=b):u=t,p.eq(10))return t==null&&(ms=!0),J4(y,u);if(u+=h,y.precision=u,n=Xc(x),r=n.charAt(0),a=fi(p),Math.abs(a)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(e),n=Xc(p.d),r=n.charAt(0),f++;a=fi(p),r>1?(p=new y("0."+n),a++):p=new y(r+"."+n.slice(1))}else return c=J4(y,u+2,b).times(a+""),p=H1(new y(r+"."+n.slice(1)),u-h).plus(c),y.precision=b,t==null?(ms=!0,Ur(p,b)):p;for(l=o=p=Ku(p.minus(Bo),p.plus(Bo),u),d=Ur(p.times(p),u),i=3;;){if(o=Ur(o.times(d),u),c=l.plus(Ku(o,new y(i),u)),Xc(c.d).slice(0,u)===Xc(l.d).slice(0,u))return l=l.times(2),a!==0&&(l=l.plus(J4(y,u+2,b).times(a+""))),l=Ku(l,new y(f),u),y.precision=b,t==null?(ms=!0,Ur(l,b)):l;l=c,i+=2}}function Jq(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(r,i),t){if(i-=r,n=n-r-1,e.e=Z0(n/as),e.d=[],r=(n+1)%as,n<0&&(r+=as),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=as;r<i;)e.d.push(+t.slice(r,r+=as));t=t.slice(r),r=as-t.length}else r-=i;for(;r--;)t+="0";if(e.d.push(+t),ms&&(e.e>LN||e.e<-LN))throw Error(S8+n)}else e.s=0,e.e=0,e.d=[0];return e}function Ur(e,t,n){var r,i,a,o,l,c,u,d,f=e.d;for(o=1,a=f[0];a>=10;a/=10)o++;if(r=t-o,r<0)r+=as,i=t,u=f[d=0];else{if(d=Math.ceil((r+1)/as),a=f.length,d>=a)return e;for(u=a=f[d],o=1;a>=10;a/=10)o++;r%=as,i=r-as+o}if(n!==void 0&&(a=qh(10,o-i-1),l=u/a%10|0,c=t<0||f[d+1]!==void 0||u%a,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?i>0?u/qh(10,o-i):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(a=fi(e),f.length=1,t=t-a-1,f[0]=qh(10,(as-t%as)%as),e.e=Z0(-t/as)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,a=1,d--):(f.length=d+1,a=qh(10,as-r),f[d]=i>0?(u/qh(10,o-i)%qh(10,i)|0)*a:0),c)for(;;)if(d==0){(f[0]+=a)==Li&&(f[0]=1,++e.e);break}else{if(f[d]+=a,f[d]!=Li)break;f[d--]=0,a=1}for(r=f.length;f[--r]===0;)f.pop();if(ms&&(e.e>LN||e.e<-LN))throw Error(S8+fi(e));return e}function wue(e,t){var n,r,i,a,o,l,c,u,d,f,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),ms?Ur(t,p):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),i=Math.max(Math.ceil(p/as),l)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=c.length,l=f.length,d=i<l,d&&(l=i),i=0;i<l;i++)if(c[i]!=f[i]){d=c[i]<f[i];break}o=0}for(d&&(n=c,c=f,f=n,t.s=-t.s),l=c.length,i=f.length-l;i>0;--i)c[l++]=0;for(i=f.length;i>o;){if(c[--i]<f[i]){for(a=i;a&&c[--a]===0;)c[a]=Li-1;--c[a],c[i]+=Li}c[i]-=f[i]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--r;return c[0]?(t.d=c,t.e=r,ms?Ur(t,p):t):new h(0)}function ap(e,t,n){var r,i=fi(e),a=Xc(e.d),o=a.length;return t?(n&&(r=n-o)>0?a=a.charAt(0)+"."+a.slice(1)+Qd(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+Qd(-i-1)+a,n&&(r=n-o)>0&&(a+=Qd(r))):i>=o?(a+=Qd(i+1-o),n&&(r=n-i-1)>0&&(a=a+"."+Qd(r))):((r=i+1)<o&&(a=a.slice(0,r)+"."+a.slice(r)),n&&(r=n-o)>0&&(i+1===o&&(a+="."),a+=Qd(r))),e.s<0?"-"+a:a}function Zq(e,t){if(e.length>t)return e.length=t,!0}function _ue(e){var t,n,r;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(Pm+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return Jq(o,a.toString())}else if(typeof a!="string")throw Error(Pm+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,ict.test(a))Jq(o,a);else throw Error(Pm+a)}if(i.prototype=Nt,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=_ue,i.config=i.set=act,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<r.length;)e.hasOwnProperty(n=r[t++])||(e[n]=this[n]);return i.config(e),i}function act(e){if(!e||typeof e!="object")throw Error(Ml+"Object expected");var t,n,r,i=["precision",1,J0,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<i.length;t+=3)if((r=e[n=i[t]])!==void 0)if(Z0(r)===r&&r>=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(Pm+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Pm+n+": "+r);return this}var A8=_ue(sct);Bo=new A8(1);const Or=A8;function oct(e){return dct(e)||uct(e)||cct(e)||lct()}function lct(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1383In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cct(e,t){if(e){if(typeof e=="string")return sO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sO(e,t)}}function uct(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function dct(e){if(Array.isArray(e))return sO(e)}function sO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var fct=function(t){return t},jue={},Nue=function(t){return t===jue},eV=function(t){return function n(){return arguments.length===0||arguments.length===1&&Nue(arguments.length<=0?void 0:arguments[0])?n:t.apply(void 0,arguments)}},hct=function e(t,n){return t===1?n:eV(function(){for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];var o=i.filter(function(l){return l!==jue}).length;return o>=t?n.apply(void 0,i):e(t-o,eV(function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];var d=i.map(function(f){return Nue(f)?c.shift():f});return n.apply(void 0,oct(d).concat(c))}))})},$E=function(t){return hct(t.length,t)},iO=function(t,n){for(var r=[],i=t;i<n;++i)r[i-t]=i;return r},mct=$E(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(n){return t[n]}).map(e)}),pct=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(!n.length)return fct;var i=n.reverse(),a=i[0],o=i.slice(1);return function(){return o.reduce(function(l,c){return c(l)},a.apply(void 0,arguments))}},aO=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},kue=function(t){var n=null,r=null;return function(){for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return n&&a.every(function(l,c){return l===n[c]})||(n=a,r=t.apply(void 0,a)),r}};function gct(e){var t;return e===0?t=1:t=Math.floor(new Or(e).abs().log(10).toNumber())+1,t}function xct(e,t,n){for(var r=new Or(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var yct=$E(function(e,t,n){var r=+e,i=+t;return r+n*(i-r)}),vct=$E(function(e,t,n){var r=t-+e;return r=r||1/0,(n-e)/r}),bct=$E(function(e,t,n){var r=t-+e;return r=r||1/0,Math.max(0,Math.min(1,(n-e)/r))});const BE={rangeStep:xct,getDigitCount:gct,interpolateNumber:yct,uninterpolateNumber:vct,uninterpolateTruncation:bct};function oO(e){return jct(e)||_ct(e)||Cue(e)||wct()}function wct(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1384In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _ct(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function jct(e){if(Array.isArray(e))return lO(e)}function W1(e,t){return Cct(e)||kct(e,t)||Cue(e,t)||Nct()}function Nct(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1385In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cue(e,t){if(e){if(typeof e=="string")return lO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lO(e,t)}}function lO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function kct(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),l;!(r=(l=o.next()).done)&&(n.push(l.value),!(t&&n.length===t));r=!0);}catch(c){i=!0,a=c}finally{try{!r&&o.return!=null&&o.return()}finally{if(i)throw a}}return n}}function Cct(e){if(Array.isArray(e))return e}function Eue(e){var t=W1(e,2),n=t[0],r=t[1],i=n,a=r;return n>r&&(i=r,a=n),[i,a]}function Sue(e,t,n){if(e.lte(0))return new Or(0);var r=BE.getDigitCount(e.toNumber()),i=new Or(10).pow(r),a=e.div(i),o=r!==1?.05:.1,l=new Or(Math.ceil(a.div(o).toNumber())).add(n).mul(o),c=l.mul(i);return t?c:new Or(Math.ceil(c))}function Ect(e,t,n){var r=1,i=new Or(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new Or(10).pow(BE.getDigitCount(e)-1),i=new Or(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new Or(Math.floor(e)))}else e===0?i=new Or(Math.floor((t-1)/2)):n||(i=new Or(Math.floor(e)));var o=Math.floor((t-1)/2),l=pct(mct(function(c){return i.add(new Or(c-o).mul(r)).toNumber()}),iO);return l(0,t)}function Aue(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Or(0),tickMin:new Or(0),tickMax:new Or(0)};var a=Sue(new Or(t).sub(e).div(n-1),r,i),o;e<=0&&t>=0?o=new Or(0):(o=new Or(e).add(t).div(2),o=o.sub(new Or(o).mod(a)));var l=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new Or(t).sub(o).div(a).toNumber()),u=l+c+1;return u>n?Aue(e,t,n,r,i+1):(u<n&&(c=t>0?c+(n-u):c,l=t>0?l:l+(n-u)),{step:a,tickMin:o.sub(new Or(l).mul(a)),tickMax:o.add(new Or(c).mul(a))})}function Sct(e){var t=W1(e,2),n=t[0],r=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),l=Eue([n,r]),c=W1(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(oO(iO(0,i-1).map(function(){return 1/0}))):[].concat(oO(iO(0,i-1).map(function(){return-1/0})),[d]);return n>r?aO(f):f}if(u===d)return Ect(u,i,a);var h=Aue(u,d,o,a),p=h.step,x=h.tickMin,y=h.tickMax,b=BE.rangeStep(x,y.add(new Or(.1).mul(p)),p);return n>r?aO(b):b}function Act(e,t){var n=W1(e,2),r=n[0],i=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Eue([r,i]),l=W1(o,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[r,i];if(c===u)return[c];var d=Math.max(t,2),f=Sue(new Or(u).sub(c).div(d-1),a,0),h=[].concat(oO(BE.rangeStep(new Or(c),new Or(u).sub(new Or(.99).mul(f)),f)),[u]);return r>i?aO(h):h}var Tct=kue(Sct),Pct=kue(Act),Oct="Invariant failed";function op(e,t){throw new Error(Oct)}var Dct=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Xx(e){"@babel/helpers - typeof";return Xx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xx(e)}function FN(){return FN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},FN.apply(this,arguments)}function Ict(e,t){return Fct(e)||Lct(e,t)||Mct(e,t)||Rct()}function Rct(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1386In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mct(e,t){if(e){if(typeof e=="string")return tV(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tV(e,t)}}function tV(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Lct(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return l}}function Fct(e){if(Array.isArray(e))return e}function $ct(e,t){if(e==null)return{};var n=Bct(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Bct(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function zct(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Uct(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Oue(r.key),r)}}function qct(e,t,n){return t&&Uct(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vct(e,t,n){return t=$N(t),Hct(e,Tue()?Reflect.construct(t,n||[],$N(e).constructor):t.apply(e,n))}function Hct(e,t){if(t&&(Xx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wct(e)}function Wct(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Tue(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Tue=function(){return!!e})()}function $N(e){return $N=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},$N(e)}function Gct(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&cO(e,t)}function cO(e,t){return cO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},cO(e,t)}function Pue(e,t,n){return t=Oue(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Oue(e){var t=Kct(e,"string");return Xx(t)=="symbol"?t:t+""}function Kct(e,t){if(Xx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Xx(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var zE=function(e){function t(){return zct(this,t),Vct(this,t,arguments)}return Gct(t,e),qct(t,[{key:"render",value:function(){var r=this.props,i=r.offset,a=r.layout,o=r.width,l=r.dataKey,c=r.data,u=r.dataPointFormatter,d=r.xAxis,f=r.yAxis,h=$ct(r,Dct),p=qt(h,!1);this.props.direction==="x"&&d.type!=="number"&&op();var x=c.map(function(y){var b=u(y,l),w=b.x,_=b.y,j=b.value,E=b.errorVal;if(!E)return null;var S=[],T,P;if(Array.isArray(E)){var O=Ict(E,2);T=O[0],P=O[1]}else T=P=E;if(a==="vertical"){var D=d.scale,R=_+i,L=R+o,M=R-o,B=D(j-T),U=D(j+P);S.push({x1:U,y1:L,x2:U,y2:M}),S.push({x1:B,y1:R,x2:U,y2:R}),S.push({x1:B,y1:L,x2:B,y2:M})}else if(a==="horizontal"){var F=f.scale,H=w+i,z=H-o,K=H+o,W=F(j-T),q=F(j+P);S.push({x1:z,y1:q,x2:K,y2:q}),S.push({x1:H,y1:W,x2:H,y2:q}),S.push({x1:z,y1:W,x2:K,y2:W})}return ee.createElement(Wn,FN({className:"recharts-errorBar",key:"bar-".concat(S.map(function(oe){return"".concat(oe.x1,"-").concat(oe.x2,"-").concat(oe.y1,"-").concat(oe.y2)}))},p),S.map(function(oe){return ee.createElement("line",FN({},oe,{key:"line-".concat(oe.x1,"-").concat(oe.x2,"-").concat(oe.y1,"-").concat(oe.y2)}))}))});return ee.createElement(Wn,{className:"recharts-errorBars"},x)}}])}(ee.Component);Pue(zE,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});Pue(zE,"displayName","ErrorBar");function G1(e){"@babel/helpers - typeof";return G1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},G1(e)}function nV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ph(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nV(Object(n),!0).forEach(function(r){Yct(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Yct(e,t,n){return t=Xct(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xct(e){var t=Qct(e,"string");return G1(t)=="symbol"?t:t+""}function Qct(e,t){if(G1(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(G1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Due=function(t){var n=t.children,r=t.formattedGraphicalItems,i=t.legendWidth,a=t.legendContent,o=Do(n,Xg);if(!o)return null;var l=Xg.defaultProps,c=l!==void 0?Ph(Ph({},l),o.props):{},u;return o.props&&o.props.payload?u=o.props&&o.props.payload:a==="children"?u=(r||[]).reduce(function(d,f){var h=f.item,p=f.props,x=p.sectors||p.data||[];return d.concat(x.map(function(y){return{type:o.props.iconType||h.props.legendType,value:y.name,color:y.fill,payload:y}}))},[]):u=(r||[]).map(function(d){var f=d.item,h=f.type.defaultProps,p=h!==void 0?Ph(Ph({},h),f.props):{},x=p.dataKey,y=p.name,b=p.legendType,w=p.hide;return{inactive:w,dataKey:x,type:c.iconType||b||"square",color:T8(f),value:y||x,payload:p}}),Ph(Ph(Ph({},c),Xg.getWithHeight(o,i)),{},{payload:u,item:o})};function K1(e){"@babel/helpers - typeof";return K1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},K1(e)}function rV(e){return tut(e)||eut(e)||Zct(e)||Jct()}function Jct(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1387In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zct(e,t){if(e){if(typeof e=="string")return uO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return uO(e,t)}}function eut(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function tut(e){if(Array.isArray(e))return uO(e)}function uO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function sV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Rs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sV(Object(n),!0).forEach(function(r){Jg(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Jg(e,t,n){return t=nut(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nut(e){var t=rut(e,"string");return K1(t)=="symbol"?t:t+""}function rut(e,t){if(K1(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(K1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ei(e,t,n){return mn(e)||mn(t)?n:Ai(t)?Wo(e,t,n):an(t)?t(e):n}function Lv(e,t,n,r){var i=ect(e,function(l){return Ei(l,t)});if(n==="number"){var a=i.filter(function(l){return lt(l)||parseFloat(l)});return a.length?[FE(a),pf(a)]:[1/0,-1/0]}var o=r?i.filter(function(l){return!mn(l)}):i;return o.map(function(l){return Ai(l)||l instanceof Date?l:""})}var sut=function(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=-1,l=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(l<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var c=a.range,u=0;u<l;u++){var d=u>0?i[u-1].coordinate:i[l-1].coordinate,f=i[u].coordinate,h=u>=l-1?i[0].coordinate:i[u+1].coordinate,p=void 0;if($a(f-d)!==$a(h-f)){var x=[];if($a(h-f)===$a(c[1]-c[0])){p=h;var y=f+c[1]-c[0];x[0]=Math.min(y,(y+d)/2),x[1]=Math.max(y,(y+d)/2)}else{p=d;var b=h+c[1]-c[0];x[0]=Math.min(f,(b+f)/2),x[1]=Math.max(f,(b+f)/2)}var w=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(t>w[0]&&t<=w[1]||t>=x[0]&&t<=x[1]){o=i[u].index;break}}else{var _=Math.min(d,h),j=Math.max(d,h);if(t>(_+f)/2&&t<=(j+f)/2){o=i[u].index;break}}}else for(var E=0;E<l;E++)if(E===0&&t<=(r[E].coordinate+r[E+1].coordinate)/2||E>0&&E<l-1&&t>(r[E].coordinate+r[E-1].coordinate)/2&&t<=(r[E].coordinate+r[E+1].coordinate)/2||E===l-1&&t>(r[E].coordinate+r[E-1].coordinate)/2){o=r[E].index;break}return o},T8=function(t){var n,r=t,i=r.type.displayName,a=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Rs(Rs({},t.type.defaultProps),t.props):t.props,o=a.stroke,l=a.fill,c;switch(i){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},iut=function(t){var n=t.barSize,r=t.totalSize,i=t.stackGroups,a=i===void 0?{}:i;if(!a)return{};for(var o={},l=Object.keys(a),c=0,u=l.length;c<u;c++)for(var d=a[l[c]].stackGroups,f=Object.keys(d),h=0,p=f.length;h<p;h++){var x=d[f[h]],y=x.items,b=x.cateAxisId,w=y.filter(function(P){return Wu(P.type).indexOf("Bar")>=0});if(w&&w.length){var _=w[0].type.defaultProps,j=_!==void 0?Rs(Rs({},_),w[0].props):w[0].props,E=j.barSize,S=j[b];o[S]||(o[S]=[]);var T=mn(E)?n:E;o[S].push({item:w[0],stackList:w.slice(1),barSize:mn(T)?void 0:Ba(T,r,0)})}}return o},aut=function(t){var n=t.barGap,r=t.barCategoryGap,i=t.bandSize,a=t.sizeList,o=a===void 0?[]:a,l=t.maxBarSize,c=o.length;if(c<1)return null;var u=Ba(n,i,0,!0),d,f=[];if(o[0].barSize===+o[0].barSize){var h=!1,p=i/c,x=o.reduce(function(E,S){return E+S.barSize||0},0);x+=(c-1)*u,x>=i&&(x-=(c-1)*u,u=0),x>=i&&p>0&&(h=!0,p*=.9,x=c*p);var y=(i-x)/2>>0,b={offset:y-u,size:0};d=o.reduce(function(E,S){var T={item:S.item,position:{offset:b.offset+b.size+u,size:h?p:S.barSize}},P=[].concat(rV(E),[T]);return b=P[P.length-1].position,S.stackList&&S.stackList.length&&S.stackList.forEach(function(O){P.push({item:O,position:b})}),P},f)}else{var w=Ba(r,i,0,!0);i-2*w-(c-1)*u<=0&&(u=0);var _=(i-2*w-(c-1)*u)/c;_>1&&(_>>=0);var j=l===+l?Math.min(_,l):_;d=o.reduce(function(E,S,T){var P=[].concat(rV(E),[{item:S.item,position:{offset:w+(_+u)*T+(_-j)/2,size:j}}]);return S.stackList&&S.stackList.length&&S.stackList.forEach(function(O){P.push({item:O,position:P[P.length-1].position})}),P},f)}return d},out=function(t,n,r,i){var a=r.children,o=r.width,l=r.margin,c=o-(l.left||0)-(l.right||0),u=Due({children:a,legendWidth:c});if(u){var d=i||{},f=d.width,h=d.height,p=u.align,x=u.verticalAlign,y=u.layout;if((y==="vertical"||y==="horizontal"&&x==="middle")&&p!=="center"&&lt(t[p]))return Rs(Rs({},t),{},Jg({},p,t[p]+(f||0)));if((y==="horizontal"||y==="vertical"&&p==="center")&&x!=="middle"&&lt(t[x]))return Rs(Rs({},t),{},Jg({},x,t[x]+(h||0)))}return t},lut=function(t,n,r){return mn(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},Iue=function(t,n,r,i,a){var o=n.props.children,l=Pl(o,zE).filter(function(u){return lut(i,a,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return t.reduce(function(u,d){var f=Ei(d,r);if(mn(f))return u;var h=Array.isArray(f)?[FE(f),pf(f)]:[f,f],p=c.reduce(function(x,y){var b=Ei(d,y,0),w=h[0]-Math.abs(Array.isArray(b)?b[0]:b),_=h[1]+Math.abs(Array.isArray(b)?b[1]:b);return[Math.min(w,x[0]),Math.max(_,x[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},cut=function(t,n,r,i,a){var o=n.map(function(l){return Iue(t,l,r,a,i)}).filter(function(l){return!mn(l)});return o&&o.length?o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},Rue=function(t,n,r,i,a){var o=n.map(function(c){var u=c.props.dataKey;return r==="number"&&u&&Iue(t,c,u,i)||Lv(t,u,r,a)});if(r==="number")return o.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,u){for(var d=0,f=u.length;d<f;d++)l[u[d]]||(l[u[d]]=!0,c.push(u[d]));return c},[])},Mue=function(t,n){return t==="horizontal"&&n==="xAxis"||t==="vertical"&&n==="yAxis"||t==="centric"&&n==="angleAxis"||t==="radial"&&n==="radiusAxis"},fm=function(t,n,r){if(!t)return null;var i=t.scale,a=t.duplicateDomain,o=t.type,l=t.range,c=t.realScaleType==="scaleBand"?i.bandwidth()/2:2,u=(n||r)&&o==="category"&&i.bandwidth?i.bandwidth()/c:0;if(u=t.axisType==="angleAxis"&&(l==null?void 0:l.length)>=2?$a(l[0]-l[1])*2*u:u,n&&(t.ticks||t.niceTicks)){var d=(t.ticks||t.niceTicks).map(function(f){var h=a?a.indexOf(f):f;return{coordinate:i(h)+u,value:f,offset:u}});return d.filter(function(f){return!W0(f.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(f,h){return{coordinate:i(f)+u,value:f,index:h,offset:u}}):i.ticks&&!r?i.ticks(t.tickCount).map(function(f){return{coordinate:i(f)+u,value:f,offset:u}}):i.domain().map(function(f,h){return{coordinate:i(f)+u,value:a?a[f]:f,index:h,offset:u}})},Z4=new WeakMap,R_=function(t,n){if(typeof n!="function")return t;Z4.has(t)||Z4.set(t,new WeakMap);var r=Z4.get(t);if(r.has(n))return r.get(n);var i=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,i),i},Lue=function(t,n,r){var i=t.scale,a=t.type,o=t.layout,l=t.axisType;if(i==="auto")return o==="radial"&&l==="radiusAxis"?{scale:B1(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:DN(),realScaleType:"linear"}:a==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:Mv(),realScaleType:"point"}:a==="category"?{scale:B1(),realScaleType:"band"}:{scale:DN(),realScaleType:"linear"};if(rp(i)){var c="scale".concat(jE(i));return{scale:(Qq[c]||Mv)(),realScaleType:Qq[c]?c:"point"}}return an(i)?{scale:i}:{scale:Mv(),realScaleType:"point"}},iV=1e-4,Fue=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,i=t.range(),a=Math.min(i[0],i[1])-iV,o=Math.max(i[0],i[1])+iV,l=t(n[0]),c=t(n[r-1]);(l<a||l>o||c<a||c>o)&&t.domain([n[0],n[r-1]])}},uut=function(t,n){if(!t)return null;for(var r=0,i=t.length;r<i;r++)if(t[r].item===n)return t[r].position;return null},dut=function(t,n){if(!n||n.length!==2||!lt(n[0])||!lt(n[1]))return t;var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]),a=[t[0],t[1]];return(!lt(t[0])||t[0]<r)&&(a[0]=r),(!lt(t[1])||t[1]>i)&&(a[1]=i),a[0]>i&&(a[0]=i),a[1]<r&&(a[1]=r),a},fut=function(t){var n=t.length;if(!(n<=0))for(var r=0,i=t[0].length;r<i;++r)for(var a=0,o=0,l=0;l<n;++l){var c=W0(t[l][r][1])?t[l][r][0]:t[l][r][1];c>=0?(t[l][r][0]=a,t[l][r][1]=a+c,a=t[l][r][1]):(t[l][r][0]=o,t[l][r][1]=o+c,o=t[l][r][1])}},hut=function(t){var n=t.length;if(!(n<=0))for(var r=0,i=t[0].length;r<i;++r)for(var a=0,o=0;o<n;++o){var l=W0(t[o][r][1])?t[o][r][0]:t[o][r][1];l>=0?(t[o][r][0]=a,t[o][r][1]=a+l,a=t[o][r][1]):(t[o][r][0]=0,t[o][r][1]=0)}},mut={sign:fut,expand:TXe,none:zx,silhouette:PXe,wiggle:OXe,positive:hut},put=function(t,n,r){var i=n.map(function(l){return l.props.dataKey}),a=mut[r],o=AXe().keys(i).value(function(l,c){return+Ei(l,c,0)}).order(IP).offset(a);return o(t)},gut=function(t,n,r,i,a,o){if(!t)return null;var l=o?n.reverse():n,c={},u=l.reduce(function(f,h){var p,x=(p=h.type)!==null&&p!==void 0&&p.defaultProps?Rs(Rs({},h.type.defaultProps),h.props):h.props,y=x.stackId,b=x.hide;if(b)return f;var w=x[r],_=f[w]||{hasStack:!1,stackGroups:{}};if(Ai(y)){var j=_.stackGroups[y]||{numericAxisId:r,cateAxisId:i,items:[]};j.items.push(h),_.hasStack=!0,_.stackGroups[y]=j}else _.stackGroups[G0("_stackId_")]={numericAxisId:r,cateAxisId:i,items:[h]};return Rs(Rs({},f),{},Jg({},w,_))},c),d={};return Object.keys(u).reduce(function(f,h){var p=u[h];if(p.hasStack){var x={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(y,b){var w=p.stackGroups[b];return Rs(Rs({},y),{},Jg({},b,{numericAxisId:r,cateAxisId:i,items:w.items,stackedData:put(t,w.items,a)}))},x)}return Rs(Rs({},f),{},Jg({},h,p))},d)},$ue=function(t,n){var r=n.realScaleType,i=n.type,a=n.tickCount,o=n.originalDomain,l=n.allowDecimals,c=r||n.scale;if(c!=="auto"&&c!=="linear")return null;if(a&&i==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var u=t.domain();if(!u.length)return null;var d=Tct(u,a,l);return t.domain([FE(d),pf(d)]),{niceTicks:d}}if(a&&i==="number"){var f=t.domain(),h=Pct(f,a,l);return{niceTicks:h}}return null};function aV(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!mn(i[t.dataKey])){var l=fN(n,"value",i[t.dataKey]);if(l)return l.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var c=Ei(i,mn(o)?t.dataKey:o);return mn(c)?null:t.scale(c)}var oV=function(t){var n=t.axis,r=t.ticks,i=t.offset,a=t.bandSize,o=t.entry,l=t.index;if(n.type==="category")return r[l]?r[l].coordinate+i:null;var c=Ei(o,n.dataKey,n.domain[l]);return mn(c)?null:n.scale(c)-a/2+i},xut=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var i=Math.min(r[0],r[1]),a=Math.max(r[0],r[1]);return i<=0&&a>=0?0:a<0?a:i}return r[0]},yut=function(t,n){var r,i=(r=t.type)!==null&&r!==void 0&&r.defaultProps?Rs(Rs({},t.type.defaultProps),t.props):t.props,a=i.stackId;if(Ai(a)){var o=n[a];if(o){var l=o.items.indexOf(t);return l>=0?o.stackedData[l]:null}}return null},vut=function(t){return t.reduce(function(n,r){return[FE(r.concat([n[0]]).filter(lt)),pf(r.concat([n[1]]).filter(lt))]},[1/0,-1/0])},Bue=function(t,n,r){return Object.keys(t).reduce(function(i,a){var o=t[a],l=o.stackedData,c=l.reduce(function(u,d){var f=vut(d.slice(n,r+1));return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]);return[Math.min(c[0],i[0]),Math.max(c[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},lV=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,cV=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,dO=function(t,n,r){if(an(t))return t(n,r);if(!Array.isArray(t))return n;var i=[];if(lt(t[0]))i[0]=r?t[0]:Math.min(t[0],n[0]);else if(lV.test(t[0])){var a=+lV.exec(t[0])[1];i[0]=n[0]-a}else an(t[0])?i[0]=t[0](n[0]):i[0]=n[0];if(lt(t[1]))i[1]=r?t[1]:Math.max(t[1],n[1]);else if(cV.test(t[1])){var o=+cV.exec(t[1])[1];i[1]=n[1]+o}else an(t[1])?i[1]=t[1](n[1]):i[1]=n[1];return i},BN=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var i=t.scale.bandwidth();if(!r||i>0)return i}if(t&&n&&n.length>=2){for(var a=s8(n,function(f){return f.coordinate}),o=1/0,l=1,c=a.length;l<c;l++){var u=a[l],d=a[l-1];o=Math.min((u.coordinate||0)-(d.coordinate||0),o)}return o===1/0?0:o}return r?void 0:0},uV=function(t,n,r){return!t||!t.length||Yx(t,Wo(r,"type.defaultProps.domain"))?n:t},zue=function(t,n){var r=t.type.defaultProps?Rs(Rs({},t.type.defaultProps),t.props):t.props,i=r.dataKey,a=r.name,o=r.unit,l=r.formatter,c=r.tooltipType,u=r.chartType,d=r.hide;return Rs(Rs({},qt(t,!1)),{},{dataKey:i,unit:o,formatter:l,name:a||i,color:T8(t),value:Ei(n,i),type:c,payload:n,chartType:u,hide:d})};function Y1(e){"@babel/helpers - typeof";return Y1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Y1(e)}function dV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Eu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?dV(Object(n),!0).forEach(function(r){Uue(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Uue(e,t,n){return t=but(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function but(e){var t=wut(e,"string");return Y1(t)=="symbol"?t:t+""}function wut(e,t){if(Y1(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Y1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _ut(e,t){return Cut(e)||kut(e,t)||Nut(e,t)||jut()}function jut(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1388In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nut(e,t){if(e){if(typeof e=="string")return fV(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fV(e,t)}}function fV(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function kut(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return l}}function Cut(e){if(Array.isArray(e))return e}var zN=Math.PI/180,Eut=function(t){return t*180/Math.PI},Zr=function(t,n,r,i){return{x:t+Math.cos(-zN*i)*r,y:n+Math.sin(-zN*i)*r}},que=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},Sut=function(t,n,r,i,a){var o=t.width,l=t.height,c=t.startAngle,u=t.endAngle,d=Ba(t.cx,o,o/2),f=Ba(t.cy,l,l/2),h=que(o,l,r),p=Ba(t.innerRadius,h,0),x=Ba(t.outerRadius,h,h*.8),y=Object.keys(n);return y.reduce(function(b,w){var _=n[w],j=_.domain,E=_.reversed,S;if(mn(_.range))i==="angleAxis"?S=[c,u]:i==="radiusAxis"&&(S=[p,x]),E&&(S=[S[1],S[0]]);else{S=_.range;var T=S,P=_ut(T,2);c=P[0],u=P[1]}var O=Lue(_,a),D=O.realScaleType,R=O.scale;R.domain(j).range(S),Fue(R);var L=$ue(R,Eu(Eu({},_),{},{realScaleType:D})),M=Eu(Eu(Eu({},_),L),{},{range:S,radius:x,realScaleType:D,scale:R,cx:d,cy:f,innerRadius:p,outerRadius:x,startAngle:c,endAngle:u});return Eu(Eu({},b),{},Uue({},w,M))},{})},Aut=function(t,n){var r=t.x,i=t.y,a=n.x,o=n.y;return Math.sqrt(Math.pow(r-a,2)+Math.pow(i-o,2))},Tut=function(t,n){var r=t.x,i=t.y,a=n.cx,o=n.cy,l=Aut({x:r,y:i},{x:a,y:o});if(l<=0)return{radius:l};var c=(r-a)/l,u=Math.acos(c);return i>o&&(u=2*Math.PI-u),{radius:l,angle:Eut(u),angleInRadian:u}},Put=function(t){var n=t.startAngle,r=t.endAngle,i=Math.floor(n/360),a=Math.floor(r/360),o=Math.min(i,a);return{startAngle:n-o*360,endAngle:r-o*360}},Out=function(t,n){var r=n.startAngle,i=n.endAngle,a=Math.floor(r/360),o=Math.floor(i/360),l=Math.min(a,o);return t+l*360},hV=function(t,n){var r=t.x,i=t.y,a=Tut({x:r,y:i},n),o=a.radius,l=a.angle,c=n.innerRadius,u=n.outerRadius;if(o<c||o>u)return!1;if(o===0)return!0;var d=Put(n),f=d.startAngle,h=d.endAngle,p=l,x;if(f<=h){for(;p>h;)p-=360;for(;p<f;)p+=360;x=p>=f&&p<=h}else{for(;p>f;)p-=360;for(;p<h;)p+=360;x=p>=h&&p<=f}return x?Eu(Eu({},n),{},{radius:o,angle:Out(p,n)}):null},Vue=function(t){return!N.isValidElement(t)&&!an(t)&&typeof t!="boolean"?t.className:""};function X1(e){"@babel/helpers - typeof";return X1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},X1(e)}var Dut=["offset"];function Iut(e){return Fut(e)||Lut(e)||Mut(e)||Rut()}function Rut(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1389In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mut(e,t){if(e){if(typeof e=="string")return fO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fO(e,t)}}function Lut(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Fut(e){if(Array.isArray(e))return fO(e)}function fO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function $ut(e,t){if(e==null)return{};var n=But(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function But(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function mV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function vi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?mV(Object(n),!0).forEach(function(r){zut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function zut(e,t,n){return t=Uut(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Uut(e){var t=qut(e,"string");return X1(t)=="symbol"?t:t+""}function qut(e,t){if(X1(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(X1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Q1(){return Q1=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Q1.apply(this,arguments)}var Vut=function(t){var n=t.value,r=t.formatter,i=mn(t.children)?n:t.children;return an(r)?r(i):i},Hut=function(t,n){var r=$a(n-t),i=Math.min(Math.abs(n-t),360);return r*i},Wut=function(t,n,r){var i=t.position,a=t.viewBox,o=t.offset,l=t.className,c=a,u=c.cx,d=c.cy,f=c.innerRadius,h=c.outerRadius,p=c.startAngle,x=c.endAngle,y=c.clockWise,b=(f+h)/2,w=Hut(p,x),_=w>=0?1:-1,j,E;i==="insideStart"?(j=p+_*o,E=y):i==="insideEnd"?(j=x-_*o,E=!y):i==="end"&&(j=x+_*o,E=y),E=w<=0?E:!E;var S=Zr(u,d,b,j),T=Zr(u,d,b,j+(E?1:-1)*359),P="M".concat(S.x,",").concat(S.y,`
1390    A`).concat(b,",").concat(b,",0,1,").concat(E?0:1,`,
1391    `).concat(T.x,",").concat(T.y),O=mn(t.id)?G0("recharts-radial-line-"):t.id;return ee.createElement("text",Q1({},r,{dominantBaseline:"central",className:hn("recharts-radial-bar-label",l)}),ee.createElement("defs",null,ee.createElement("path",{id:O,d:P})),ee.createElement("textPath",{xlinkHref:"#".concat(O)},n))},Gut=function(t){var n=t.viewBox,r=t.offset,i=t.position,a=n,o=a.cx,l=a.cy,c=a.innerRadius,u=a.outerRadius,d=a.startAngle,f=a.endAngle,h=(d+f)/2;if(i==="outside"){var p=Zr(o,l,u+r,h),x=p.x,y=p.y;return{x,y,textAnchor:x>=o?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var b=(c+u)/2,w=Zr(o,l,b,h),_=w.x,j=w.y;return{x:_,y:j,textAnchor:"middle",verticalAnchor:"middle"}},Kut=function(t){var n=t.viewBox,r=t.parentViewBox,i=t.offset,a=t.position,o=n,l=o.x,c=o.y,u=o.width,d=o.height,f=d>=0?1:-1,h=f*i,p=f>0?"end":"start",x=f>0?"start":"end",y=u>=0?1:-1,b=y*i,w=y>0?"end":"start",_=y>0?"start":"end";if(a==="top"){var j={x:l+u/2,y:c-f*i,textAnchor:"middle",verticalAnchor:p};return vi(vi({},j),r?{height:Math.max(c-r.y,0),width:u}:{})}if(a==="bottom"){var E={x:l+u/2,y:c+d+h,textAnchor:"middle",verticalAnchor:x};return vi(vi({},E),r?{height:Math.max(r.y+r.height-(c+d),0),width:u}:{})}if(a==="left"){var S={x:l-b,y:c+d/2,textAnchor:w,verticalAnchor:"middle"};return vi(vi({},S),r?{width:Math.max(S.x-r.x,0),height:d}:{})}if(a==="right"){var T={x:l+u+b,y:c+d/2,textAnchor:_,verticalAnchor:"middle"};return vi(vi({},T),r?{width:Math.max(r.x+r.width-T.x,0),height:d}:{})}var P=r?{width:u,height:d}:{};return a==="insideLeft"?vi({x:l+b,y:c+d/2,textAnchor:_,verticalAnchor:"middle"},P):a==="insideRight"?vi({x:l+u-b,y:c+d/2,textAnchor:w,verticalAnchor:"middle"},P):a==="insideTop"?vi({x:l+u/2,y:c+h,textAnchor:"middle",verticalAnchor:x},P):a==="insideBottom"?vi({x:l+u/2,y:c+d-h,textAnchor:"middle",verticalAnchor:p},P):a==="insideTopLeft"?vi({x:l+b,y:c+h,textAnchor:_,verticalAnchor:x},P):a==="insideTopRight"?vi({x:l+u-b,y:c+h,textAnchor:w,verticalAnchor:x},P):a==="insideBottomLeft"?vi({x:l+b,y:c+d-h,textAnchor:_,verticalAnchor:p},P):a==="insideBottomRight"?vi({x:l+u-b,y:c+d-h,textAnchor:w,verticalAnchor:p},P):U0(a)&&(lt(a.x)||cm(a.x))&&(lt(a.y)||cm(a.y))?vi({x:l+Ba(a.x,u),y:c+Ba(a.y,d),textAnchor:"end",verticalAnchor:"end"},P):vi({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},P)},Yut=function(t){return"cx"in t&&lt(t.cx)};function $i(e){var t=e.offset,n=t===void 0?5:t,r=$ut(e,Dut),i=vi({offset:n},r),a=i.viewBox,o=i.position,l=i.value,c=i.children,u=i.content,d=i.className,f=d===void 0?"":d,h=i.textBreakAll;if(!a||mn(l)&&mn(c)&&!N.isValidElement(u)&&!an(u))return null;if(N.isValidElement(u))return N.cloneElement(u,i);var p;if(an(u)){if(p=N.createElement(u,i),N.isValidElement(p))return p}else p=Vut(i);var x=Yut(a),y=qt(i,!0);if(x&&(o==="insideStart"||o==="insideEnd"||o==="end"))return Wut(i,p,y);var b=x?Gut(i):Kut(i);return ee.createElement(ip,Q1({className:hn("recharts-label",f)},y,b,{breakAll:h}),p)}$i.displayName="Label";var Hue=function(t){var n=t.cx,r=t.cy,i=t.angle,a=t.startAngle,o=t.endAngle,l=t.r,c=t.radius,u=t.innerRadius,d=t.outerRadius,f=t.x,h=t.y,p=t.top,x=t.left,y=t.width,b=t.height,w=t.clockWise,_=t.labelViewBox;if(_)return _;if(lt(y)&&lt(b)){if(lt(f)&&lt(h))return{x:f,y:h,width:y,height:b};if(lt(p)&&lt(x))return{x:p,y:x,width:y,height:b}}return lt(f)&&lt(h)?{x:f,y:h,width:0,height:0}:lt(n)&&lt(r)?{cx:n,cy:r,startAngle:a||i||0,endAngle:o||i||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:w}:t.viewBox?t.viewBox:{}},Xut=function(t,n){return t?t===!0?ee.createElement($i,{key:"label-implicit",viewBox:n}):Ai(t)?ee.createElement($i,{key:"label-implicit",viewBox:n,value:t}):N.isValidElement(t)?t.type===$i?N.cloneElement(t,{key:"label-implicit",viewBox:n}):ee.createElement($i,{key:"label-implicit",content:t,viewBox:n}):an(t)?ee.createElement($i,{key:"label-implicit",content:t,viewBox:n}):U0(t)?ee.createElement($i,Q1({viewBox:n},t,{key:"label-implicit"})):null:null},Qut=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var i=t.children,a=Hue(t),o=Pl(i,$i).map(function(c,u){return N.cloneElement(c,{viewBox:n||a,key:"label-".concat(u)})});if(!r)return o;var l=Xut(t.label,n||a);return[l].concat(Iut(o))};$i.parseViewBox=Hue;$i.renderCallByParent=Qut;function Jut(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var Zut=Jut;const edt=dr(Zut);function J1(e){"@babel/helpers - typeof";return J1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},J1(e)}var tdt=["valueAccessor"],ndt=["data","dataKey","clockWise","id","textBreakAll"];function rdt(e){return odt(e)||adt(e)||idt(e)||sdt()}function sdt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1392In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function idt(e,t){if(e){if(typeof e=="string")return hO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hO(e,t)}}function adt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function odt(e){if(Array.isArray(e))return hO(e)}function hO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function UN(){return UN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},UN.apply(this,arguments)}function pV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function gV(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pV(Object(n),!0).forEach(function(r){ldt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ldt(e,t,n){return t=cdt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cdt(e){var t=udt(e,"string");return J1(t)=="symbol"?t:t+""}function udt(e,t){if(J1(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(J1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xV(e,t){if(e==null)return{};var n=ddt(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ddt(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var fdt=function(t){return Array.isArray(t.value)?edt(t.value):t.value};function Yu(e){var t=e.valueAccessor,n=t===void 0?fdt:t,r=xV(e,tdt),i=r.data,a=r.dataKey,o=r.clockWise,l=r.id,c=r.textBreakAll,u=xV(r,ndt);return!i||!i.length?null:ee.createElement(Wn,{className:"recharts-label-list"},i.map(function(d,f){var h=mn(a)?n(d,f):Ei(d&&d.payload,a),p=mn(l)?{}:{id:"".concat(l,"-").concat(f)};return ee.createElement($i,UN({},qt(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:c,viewBox:$i.parseViewBox(mn(o)?d:gV(gV({},d),{},{clockWise:o})),key:"label-".concat(f),index:f}))}))}Yu.displayName="LabelList";function hdt(e,t){return e?e===!0?ee.createElement(Yu,{key:"labelList-implicit",data:t}):ee.isValidElement(e)||an(e)?ee.createElement(Yu,{key:"labelList-implicit",data:t,content:e}):U0(e)?ee.createElement(Yu,UN({data:t},e,{key:"labelList-implicit"})):null:null}function mdt(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=Pl(r,Yu).map(function(o,l){return N.cloneElement(o,{data:t,key:"labelList-".concat(l)})});if(!n)return i;var a=hdt(e.label,t);return[a].concat(rdt(i))}Yu.renderCallByParent=mdt;function Z1(e){"@babel/helpers - typeof";return Z1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Z1(e)}function mO(){return mO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mO.apply(this,arguments)}function yV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function vV(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yV(Object(n),!0).forEach(function(r){pdt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function pdt(e,t,n){return t=gdt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gdt(e){var t=xdt(e,"string");return Z1(t)=="symbol"?t:t+""}function xdt(e,t){if(Z1(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Z1(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ydt=function(t,n){var r=$a(n-t),i=Math.min(Math.abs(n-t),359.999);return r*i},M_=function(t){var n=t.cx,r=t.cy,i=t.radius,a=t.angle,o=t.sign,l=t.isExternal,c=t.cornerRadius,u=t.cornerIsExternal,d=c*(l?1:-1)+i,f=Math.asin(c/d)/zN,h=u?a:a+o*f,p=Zr(n,r,d,h),x=Zr(n,r,i,h),y=u?a-o*f:a,b=Zr(n,r,d*Math.cos(f*zN),y);return{center:p,circleTangency:x,lineTangency:b,theta:f}},Wue=function(t){var n=t.cx,r=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.startAngle,l=t.endAngle,c=ydt(o,l),u=o+c,d=Zr(n,r,a,o),f=Zr(n,r,a,u),h="M ".concat(d.x,",").concat(d.y,`
1393    A `).concat(a,",").concat(a,`,0,
1394    `).concat(+(Math.abs(c)>180),",").concat(+(o>u),`,
1395    `).concat(f.x,",").concat(f.y,`
1396  `);if(i>0){var p=Zr(n,r,i,o),x=Zr(n,r,i,u);h+="L ".concat(x.x,",").concat(x.y,`
1397            A `).concat(i,",").concat(i,`,0,
1398            `).concat(+(Math.abs(c)>180),",").concat(+(o<=u),`,
1399            `).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(n,",").concat(r," Z");return h},vdt=function(t){var n=t.cx,r=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,f=$a(d-u),h=M_({cx:n,cy:r,radius:a,angle:u,sign:f,cornerRadius:o,cornerIsExternal:c}),p=h.circleTangency,x=h.lineTangency,y=h.theta,b=M_({cx:n,cy:r,radius:a,angle:d,sign:-f,cornerRadius:o,cornerIsExternal:c}),w=b.circleTangency,_=b.lineTangency,j=b.theta,E=c?Math.abs(u-d):Math.abs(u-d)-y-j;if(E<0)return l?"M ".concat(x.x,",").concat(x.y,`
1400        a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0
1401        a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0
1402      `):Wue({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:u,endAngle:d});var S="M ".concat(x.x,",").concat(x.y,`
1403    A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(p.x,",").concat(p.y,`
1404    A`).concat(a,",").concat(a,",0,").concat(+(E>180),",").concat(+(f<0),",").concat(w.x,",").concat(w.y,`
1405    A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(_.x,",").concat(_.y,`
1406  `);if(i>0){var T=M_({cx:n,cy:r,radius:i,angle:u,sign:f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),P=T.circleTangency,O=T.lineTangency,D=T.theta,R=M_({cx:n,cy:r,radius:i,angle:d,sign:-f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),L=R.circleTangency,M=R.lineTangency,B=R.theta,U=c?Math.abs(u-d):Math.abs(u-d)-D-B;if(U<0&&o===0)return"".concat(S,"L").concat(n,",").concat(r,"Z");S+="L".concat(M.x,",").concat(M.y,`
1407      A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(L.x,",").concat(L.y,`
1408      A`).concat(i,",").concat(i,",0,").concat(+(U>180),",").concat(+(f>0),",").concat(P.x,",").concat(P.y,`
1409      A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(O.x,",").concat(O.y,"Z")}else S+="L".concat(n,",").concat(r,"Z");return S},bdt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Gue=function(t){var n=vV(vV({},bdt),t),r=n.cx,i=n.cy,a=n.innerRadius,o=n.outerRadius,l=n.cornerRadius,c=n.forceCornerRadius,u=n.cornerIsExternal,d=n.startAngle,f=n.endAngle,h=n.className;if(o<a||d===f)return null;var p=hn("recharts-sector",h),x=o-a,y=Ba(l,x,0,!0),b;return y>0&&Math.abs(d-f)<360?b=vdt({cx:r,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(y,x/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):b=Wue({cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:d,endAngle:f}),ee.createElement("path",mO({},qt(n,!0),{className:p,d:b,role:"img"}))};function eb(e){"@babel/helpers - typeof";return eb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},eb(e)}function pO(){return pO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pO.apply(this,arguments)}function bV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function wV(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bV(Object(n),!0).forEach(function(r){wdt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bV(Object(n)).forEac
1409h(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function wdt(e,t,n){return t=_dt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _dt(e){var t=jdt(e,"string");return eb(t)=="symbol"?t:t+""}function jdt(e,t){if(eb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(eb(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var _V={curveBasisClosed:yXe,curveBasisOpen:vXe,curveBasis:xXe,curveBumpX:rXe,curveBumpY:sXe,curveLinearClosed:bXe,curveLinear:kE,curveMonotoneX:wXe,curveMonotoneY:_Xe,curveNatural:jXe,curveStep:NXe,curveStepAfter:CXe,curveStepBefore:kXe},L_=function(t){return t.x===+t.x&&t.y===+t.y},Vy=function(t){return t.x},Hy=function(t){return t.y},Ndt=function(t,n){if(an(t))return t;var r="curve".concat(jE(t));return(r==="curveMonotone"||r==="curveBump")&&n?_V["".concat(r).concat(n==="vertical"?"Y":"X")]:_V[r]||kE},kdt=function(t){var n=t.type,r=n===void 0?"linear":n,i=t.points,a=i===void 0?[]:i,o=t.baseLine,l=t.layout,c=t.connectNulls,u=c===void 0?!1:c,d=Ndt(r,l),f=u?a.filter(function(y){return L_(y)}):a,h;if(Array.isArray(o)){var p=u?o.filter(function(y){return L_(y)}):o,x=f.map(function(y,b){return wV(wV({},y),{},{base:p[b]})});return l==="vertical"?h=E_().y(Hy).x1(Vy).x0(function(y){return y.base.x}):h=E_().x(Vy).y1(Hy).y0(function(y){return y.base.y}),h.defined(L_).curve(d),h(x)}return l==="vertical"&&lt(o)?h=E_().y(Hy).x1(Vy).x0(o):lt(o)?h=E_().x(Vy).y1(Hy).y0(o):h=qle().x(Vy).y(Hy),h.defined(L_).curve(d),h(f)},Zg=function(t){var n=t.className,r=t.points,i=t.path,a=t.pathRef;if((!r||!r.length)&&!i)return null;var o=r&&r.length?kdt(t):i;return N.createElement("path",pO({},qt(t,!1),hN(t),{className:hn("recharts-curve",n),d:o,ref:a}))},Kue={exports:{}},Cdt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Edt=Cdt,Sdt=Edt;function Yue(){}function Xue(){}Xue.resetWarningCache=Yue;var Adt=function(){function e(r,i,a,o,l,c){if(c!==Sdt){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Xue,resetWarningCache:Yue};return n.PropTypes=n,n};Kue.exports=Adt();var Tdt=Kue.exports;const mr=dr(Tdt);var Pdt=Object.getOwnPropertyNames,Odt=Object.getOwnPropertySymbols,Ddt=Object.prototype.hasOwnProperty;function jV(e,t){return function(r,i,a){return e(r,i,a)&&t(r,i,a)}}function F_(e){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return e(n,r,i);var a=i.cache,o=a.get(n),l=a.get(r);if(o&&l)return o===r&&l===n;a.set(n,r),a.set(r,n);var c=e(n,r,i);return a.delete(n),a.delete(r),c}}function NV(e){return Pdt(e).concat(Odt(e))}var Idt=Object.hasOwn||function(e,t){return Ddt.call(e,t)};function Np(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var Rdt="__v",Mdt="__o",Ldt="_owner",kV=Object.getOwnPropertyDescriptor,CV=Object.keys;function Fdt(e,t,n){var r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function $dt(e,t){return Np(e.getTime(),t.getTime())}function Bdt(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function zdt(e,t){return e===t}function EV(e,t,n){var r=e.size;if(r!==t.size)return!1;if(!r)return!0;for(var i=new Array(r),a=e.entries(),o,l,c=0;(o=a.next())&&!o.done;){for(var u=t.entries(),d=!1,f=0;(l=u.next())&&!l.done;){if(i[f]){f++;continue}var h=o.value,p=l.value;if(n.equals(h[0],p[0],c,f,e,t,n)&&n.equals(h[1],p[1],h[0],p[0],e,t,n)){d=i[f]=!0;break}f++}if(!d)return!1;c++}return!0}var Udt=Np;function qdt(e,t,n){var r=CV(e),i=r.length;if(CV(t).length!==i)return!1;for(;i-- >0;)if(!Que(e,t,n,r[i]))return!1;return!0}function Wy(e,t,n){var r=NV(e),i=r.length;if(NV(t).length!==i)return!1;for(var a,o,l;i-- >0;)if(a=r[i],!Que(e,t,n,a)||(o=kV(e,a),l=kV(t,a),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function Vdt(e,t){return Np(e.valueOf(),t.valueOf())}function Hdt(e,t){return e.source===t.source&&e.flags===t.flags}function SV(e,t,n){var r=e.size;if(r!==t.size)return!1;if(!r)return!0;for(var i=new Array(r),a=e.values(),o,l;(o=a.next())&&!o.done;){for(var c=t.values(),u=!1,d=0;(l=c.next())&&!l.done;){if(!i[d]&&n.equals(o.value,l.value,o.value,l.value,e,t,n)){u=i[d]=!0;break}d++}if(!u)return!1}return!0}function Wdt(e,t){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Gdt(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Que(e,t,n,r){return(r===Ldt||r===Mdt||r===Rdt)&&(e.$$typeof||t.$$typeof)?!0:Idt(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var Kdt="[object Arguments]",Ydt="[object Boolean]",Xdt="[object Date]",Qdt="[object Error]",Jdt="[object Map]",Zdt="[object Number]",eft="[object Object]",tft="[object RegExp]",nft="[object Set]",rft="[object String]",sft="[object URL]",ift=Array.isArray,AV=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,TV=Object.assign,aft=Object.prototype.toString.call.bind(Object.prototype.toString);function oft(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areErrorsEqual,i=e.areFunctionsEqual,a=e.areMapsEqual,o=e.areNumbersEqual,l=e.areObjectsEqual,c=e.arePrimitiveWrappersEqual,u=e.areRegExpsEqual,d=e.areSetsEqual,f=e.areTypedArraysEqual,h=e.areUrlsEqual;return function(x,y,b){if(x===y)return!0;
1409if(x==null||y==null)return!1;var w=typeof x;if(w!==typeof y)return!1;if(w!=="object")return w==="number"?o(x,y,b):w==="function"?i(x,y,b):!1;var _=x.constructor;if(_!==y.constructor)return!1;if(_===Object)return l(x,y,b);if(ift(x))return t(x,y,b);if(AV!=null&&AV(x))return f(x,y,b);if(_===Date)return n(x,y,b);if(_===RegExp)return u(x,y,b);if(_===Map)return a(x,y,b);if(_===Set)return d(x,y,b);var j=aft(x);return j===Xdt?n(x,y,b):j===tft?u(x,y,b):j===Jdt?a(x,y,b):j===nft?d(x,y,b):j===eft?typeof x.then!="function"&&typeof y.then!="function"&&l(x,y,b):j===sft?h(x,y,b):j===Qdt?r(x,y,b):j===Kdt?l(x,y,b):j===Ydt||j===Zdt||j===rft?c(x,y,b):!1}}function lft(e){var t=e.circular,n=e.createCustomConfig,r=e.strict,i={areArraysEqual:r?Wy:Fdt,areDatesEqual:$dt,areErrorsEqual:Bdt,areFunctionsEqual:zdt,areMapsEqual:r?jV(EV,Wy):EV,areNumbersEqual:Udt,areObjectsEqual:r?Wy:qdt,arePrimitiveWrappersEqual:Vdt,areRegExpsEqual:Hdt,areSetsEqual:r?jV(SV,Wy):SV,areTypedArraysEqual:r?Wy:Wdt,areUrlsEqual:Gdt};if(n&&(i=TV({},i,n(i))),t){var a=F_(i.areArraysEqual),o=F_(i.areMapsEqual),l=F_(i.areObjectsEqual),c=F_(i.areSetsEqual);i=TV({},i,{areArraysEqual:a,areMapsEqual:o,areObjectsEqual:l,areSetsEqual:c})}return i}function cft(e){return function(t,n,r,i,a,o,l){return e(t,n,l)}}function uft(e){var t=e.circular,n=e.comparator,r=e.createState,i=e.equals,a=e.strict;if(r)return function(c,u){var d=r(),f=d.cache,h=f===void 0?t?new WeakMap:void 0:f,p=d.meta;return n(c,u,{cache:h,equals:i,meta:p,strict:a})};if(t)return function(c,u){return n(c,u,{cache:new WeakMap,equals:i,meta:void 0,strict:a})};var o={cache:void 0,equals:i,meta:void 0,strict:a};return function(c,u){return n(c,u,o)}}var dft=yh();yh({strict:!0});yh({circular:!0});yh({circular:!0,strict:!0});yh({createInternalComparator:function(){return Np}});yh({strict:!0,createInternalComparator:function(){return Np}});yh({circular:!0,createInternalComparator:function(){return Np}});yh({circular:!0,createInternalComparator:function(){return Np},strict:!0});function yh(e){e===void 0&&(e={});var t=e.circular,n=t===void 0?!1:t,r=e.createInternalComparator,i=e.createState,a=e.strict,o=a===void 0?!1:a,l=lft(e),c=oft(l),u=r?r(c):cft(c);return uft({circular:n,comparator:c,createState:i,equals:u,strict:o})}function fft(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function PV(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function i(a){n<0&&(n=a),a-n>t?(e(a),n=-1):fft(i)};requestAnimationFrame(r)}function gO(e){"@babel/helpers - typeof";return gO=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gO(e)}function hft(e){return xft(e)||gft(e)||pft(e)||mft()}function mft(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1410In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pft(e,t){if(e){if(typeof e=="string")return OV(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return OV(e,t)}}function OV(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function gft(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function xft(e){if(Array.isArray(e))return e}function yft(){var e={},t=function(){return null},n=!1,r=function i(a){if(!n){if(Array.isArray(a)){if(!a.length)return;var o=a,l=hft(o),c=l[0],u=l.slice(1);if(typeof c=="number"){PV(i.bind(null,u),c);return}i(c),PV(i.bind(null,u));return}gO(a)==="object"&&(e=a,t(e)),typeof a=="function"&&a()}};return{stop:function(){n=!0},start:function(a){n=!1,r(a)},subscribe:function(a){return t=a,function(){t=function(){return null}}}}}function tb(e){"@babel/helpers - typeof";return tb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tb(e)}function DV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function IV(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
vendor: 58,672 bytes, lines 1410-1428
1410t%2?DV(Object(n),!0).forEach(function(r){Jue(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):DV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Jue(e,t,n){return t=vft(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vft(e){var t=bft(e,"string");return tb(t)==="symbol"?t:String(t)}function bft(e,t){if(tb(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(tb(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var wft=function(t,n){return[Object.keys(t),Object.keys(n)].reduce(function(r,i){return r.filter(function(a){return i.includes(a)})})},_ft=function(t){return t},jft=function(t){return t.replace(/([A-Z])/g,function(n){return"-".concat(n.toLowerCase())})},Fv=function(t,n){return Object.keys(n).reduce(function(r,i){return IV(IV({},r),{},Jue({},i,t(i,n[i])))},{})},RV=function(t,n,r){return t.map(function(i){return"".concat(jft(i)," ").concat(n,"ms ").concat(r)}).join(",")};function Nft(e,t){return Eft(e)||Cft(e,t)||Zue(e,t)||kft()}function kft(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1411In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cft(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return l}}function Eft(e){if(Array.isArray(e))return e}function Sft(e){return Pft(e)||Tft(e)||Zue(e)||Aft()}function Aft(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1412In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zue(e,t){if(e){if(typeof e=="string")return xO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xO(e,t)}}function Tft(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Pft(e){if(Array.isArray(e))return xO(e)}function xO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var qN=1e-4,ede=function(t,n){return[0,3*t,3*n-6*t,3*t-3*n+1]},tde=function(t,n){return t.map(function(r,i){return r*Math.pow(n,i)}).reduce(function(r,i){return r+i})},MV=function(t,n){return function(r){var i=ede(t,n);return tde(i,r)}},Oft=function(t,n){return function(r){var i=ede(t,n),a=[].concat(Sft(i.map(function(o,l){return o*l}).slice(1)),[0]);return tde(a,r)}},LV=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=n[0],a=n[1],o=n[2],l=n[3];if(n.length===1)switch(n[0]){case"linear":i=0,a=0,o=1,l=1;break;case"ease":i=.25,a=.1,o=.25,l=1;break;case"ease-in":i=.42,a=0,o=1,l=1;break;case"ease-out":i=.42,a=0,o=.58,l=1;break;case"ease-in-out":i=0,a=0,o=.58,l=1;break;default:{var c=n[0].split("(");if(c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4){var u=c[1].split(")")[0].split(",").map(function(b){return parseFloat(b)}),d=Nft(u,4);i=d[0],a=d[1],o=d[2],l=d[3]}}}var f=MV(i,o),h=MV(a,l),p=Oft(i,o),x=function(w){return w>1?1:w<0?0:w},y=function(w){for(var _=w>1?1:w,j=_,E=0;E<8;++E){var S=f(j)-_,T=p(j);if(Math.abs(S-_)<qN||T<qN)return h(j);j=x(j-S/T)}return h(j)};return y.isStepper=!1,y},Dft=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,i=t.damping,a=i===void 0?8:i,o=t.dt,l=o===void 0?17:o,c=function(d,f,h){var p=-(d-f)*r,x=h*a,y=h+(p-x)*l/1e3,b=h*l/1e3+d;return Math.abs(b-f)<qN&&Math.abs(y)<qN?[f,0]:[b,y]};return c.isStepper=!0,c.dt=l,c},Ift=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=n[0];if(typeof i=="string")switch(i){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return LV(i);case"spring":return Dft();default:if(i.split("(")[0]==="cubic-bezier")return LV(i)}return typeof i=="function"?i:null};function nb(e){"@babel/helpers - typeof";return nb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nb(e)}function FV(e){return Lft(e)||Mft(e)||nde(e)||Rft()}function Rft(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1413In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mft(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Lft(e){if(Array.isArray(e))return vO(e)}function $V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ea(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$V(Object(n),!0).forEach(function(r){yO(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$V(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yO(e,t,n){return t=Fft(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fft(e){var t=$ft(e,"string");return nb(t)==="symbol"?t:String(t)}function $ft(e,t){if(nb(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(nb(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Bft(e,t){return qft(e)||Uft(e,t)||nde(e,t)||zft()}function zft(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1414In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nde(e,t){if(e){if(typeof e=="string")return vO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vO(e,t)}}function vO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Uft(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return l}}function qft(e){if(Array.isArray(e))return e}var VN=function(t,n,r){return t+(n-t)*r},bO=function(t){var n=t.from,r=t.to;return n!==r},Vft=function e(t,n,r){var i=Fv(function(a,o){if(bO(o)){var l=t(o.from,o.to,o.velocity),c=Bft(l,2),u=c[0],d=c[1];return ea(ea({},o),{},{from:u,velocity:d})}return o},n);return r<1?Fv(function(a,o){return bO(o)?ea(ea({},o),{},{velocity:VN(o.velocity,i[a].velocity,r),from:VN(o.from,i[a].from,r)}):o},n):e(t,i,r-1)};const Hft=function(e,t,n,r,i){var a=wft(e,t),o=a.reduce(function(b,w){return ea(ea({},b),{},yO({},w,[e[w],t[w]]))},{}),l=a.reduce(function(b,w){return ea(ea({},b),{},yO({},w,{from:e[w],velocity:0,to:t[w]}))},{}),c=-1,u,d,f=function(){return null},h=function(){return Fv(function(w,_){return _.from},l)},p=function(){return!Object.values(l).filter(bO).length},x=function(w){u||(u=w);var _=w-u,j=_/n.dt;l=Vft(n,l,j),i(ea(ea(ea({},e),t),h())),u=w,p()||(c=requestAnimationFrame(f))},y=function(w){d||(d=w);var _=(w-d)/r,j=Fv(function(S,T){return VN.apply(void 0,FV(T).concat([n(_)]))},o);if(i(ea(ea(ea({},e),t),j)),_<1)c=requestAnimationFrame(f);else{var E=Fv(function(S,T){return VN.apply(void 0,FV(T).concat([n(1)]))},o);i(ea(ea(ea({},e),t),E))}};return f=n.isStepper?x:y,function(){return requestAnimationFrame(f),function(){cancelAnimationFrame(c)}}};function Qx(e){"@babel/helpers - typeof";return Qx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qx(e)}var Wft=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function Gft(e,t){if(e==null)return{};var n=Kft(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Kft(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function e3(e){return Jft(e)||Qft(e)||Xft(e)||Yft()}function Yft(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1415In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xft(e,t){if(e){if(typeof e=="string")return wO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return wO(e,t)}}function Qft(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Jft(e){if(Array.isArray(e))return wO(e)}function wO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function BV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Gl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?BV(Object(n),!0).forEach(function(r){lv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):BV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function lv(e,t,n){return t=rde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zft(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function eht(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,rde(r.key),r)}}function tht(e,t,n){return t&&eht(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function rde(e){var t=nht(e,"string");return Qx(t)==="symbol"?t:String(t)}function nht(e,t){if(Qx(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Qx(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rht(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_O(e,t)}function _O(e,t){return _O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},_O(e,t)}function sht(e){var t=iht();return function(){var r=HN(e),i;if(t){var a=HN(this).constructor;i=Reflect.construct(r,arguments,a)}else i=r.apply(this,arguments);return jO(this,i)}}function jO(e,t){if(t&&(Qx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return NO(e)}function NO(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function iht(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function HN(e){return HN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},HN(e)}var hu=function(e){rht(n,e);var t=sht(n);function n(r,i){var a;Zft(this,n),a=t.call(this,r,i);var o=a.props,l=o.isActive,c=o.attributeName,u=o.from,d=o.to,f=o.steps,h=o.children,p=o.duration;if(a.handleStyleChange=a.handleStyleChange.bind(NO(a)),a.changeStyle=a.changeStyle.bind(NO(a)),!l||p<=0)return a.state={style:{}},typeof h=="function"&&(a.state={style:d}),jO(a);if(f&&f.length)a.state={style:f[0].style};else if(u){if(typeof h=="function")return a.state={style:u},jO(a);a.state={style:c?lv({},c,u):u}}else a.state={style:{}};return a}return tht(n,[{key:"componentDidMount",value:function(){var i=this.props,a=i.isActive,o=i.canBegin;this.mounted=!0,!(!a||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var a=this.props,o=a.isActive,l=a.canBegin,c=a.attributeName,u=a.shouldReAnimate,d=a.to,f=a.from,h=this.state.style;if(l){if(!o){var p={style:c?lv({},c,d):d};this.state&&h&&(c&&h[c]!==d||!c&&h!==d)&&this.setState(p);return}if(!(dft(i.to,d)&&i.canBegin&&i.isActive)){var x=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var y=x||u?f:i.to;if(this.state&&h){var b={style:c?lv({},c,y):y};(c&&h[c]!==y||!c&&h!==y)&&this.setState(b)}this.runAnimation(Gl(Gl({},this.props),{},{from:y,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var a=this,o=i.from,l=i.to,c=i.duration,u=i.easing,d=i.begin,f=i.onAnimationEnd,h=i.onAnimationStart,p=Hft(o,l,Ift(u),c,this.changeStyle),x=function(){a.stopJSAnimation=p()};this.manager.start([h,d,x,c,f])}},{key:"runStepAnimation",value:function(i){var a=this,o=i.steps,l=i.begin,c=i.onAnimationStart,u=o[0],d=u.style,f=u.duration,h=f===void 0?0:f,p=function(y,b,w){if(w===0)return y;var _=b.duration,j=b.easing,E=j===void 0?"ease":j,S=b.style,T=b.properties,P=b.onAnimationEnd,O=w>0?o[w-1]:b,D=T||Object.keys(S);if(typeof E=="function"||E==="spring")return[].concat(e3(y),[a.runJSAnimation.bind(a,{from:O.style,to:S,duration:_,easing:E}),_]);var R=RV(D,_,E),L=Gl(Gl(Gl({},O.style),S),{},{transition:R});return[].concat(e3(y),[L,_,P]).filter(_ft)};return this.manager.start([c].concat(e3(o.reduce(p,[d,Math.max(h,l)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=yft());var a=i.begin,o=i.duration,l=i.attributeName,c=i.to,u=i.easing,d=i.onAnimationStart,f=i.onAnimationEnd,h=i.steps,p=i.children,x=this.manager;if(this.unSubscribe=x.subscribe(this.handleStyleChange),typeof u=="function"||typeof p=="function"||u==="spring"){this.runJSAnimation(i);return}if(h.length>1){this.runStepAnimation(i);return}var y=l?lv({},l,c):c,b=RV(Object.keys(y),o,u);x.start([d,a,Gl(Gl({},y),{},{transition:b}),o,f])}},{key:"render",value:function(){var i=this.props,a=i.children;i.begin;var o=i.duration;i.attributeName,i.easing;var l=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var c=Gft(i,Wft),u=N.Children.count(a),d=this.state.style;if(typeof a=="function")return a(d);if(!l||u===0||o<=0)return a;var f=function(p){var x=p.props,y=x.style,b=y===void 0?{}:y,w=x.className,_=N.cloneElement(p,Gl(Gl({},c),{},{style:Gl(Gl({},b),d),className:w}));return _};return u===1?f(N.Children.only(a)):ee.createElement("div",null,N.Children.map(a,function(h){return f(h)}))}}]),n}(N.PureComponent);hu.displayName="Animate";hu.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};hu.propTypes={from:mr.oneOfType([mr.object,mr.string]),to:mr.oneOfType([mr.object,mr.string]),attributeName:mr.string,duration:mr.number,begin:mr.number,easing:mr.oneOfType([mr.string,mr.func]),steps:mr.arrayOf(mr.shape({duration:mr.number.isRequired,style:mr.object.isRequired,easing:mr.oneOfType([mr.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),mr.func]),properties:mr.arrayOf("string"),onAnimationEnd:mr.func})),children:mr.oneOfType([mr.node,mr.func]),isActive:mr.bool,canBegin:mr.bool,onAnimationEnd:mr.func,shouldReAnimate:mr.bool,onAnimationStart:mr.func,onAnimationReStart:mr.func};function rb(e){"@babel/helpers - typeof";return rb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rb(e)}function WN(){return WN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},WN.apply(this,arguments)}function aht(e,t){return uht(e)||cht(e,t)||lht(e,t)||oht()}function oht(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1416In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lht(e,t){if(e){if(typeof e=="string")return zV(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zV(e,t)}}function zV(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function cht(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return l}}function uht(e){if(Array.isArray(e))return e}function UV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function qV(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?UV(Object(n),!0).forEach(function(r){dht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function dht(e,t,n){return t=fht(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fht(e){var t=hht(e,"string");return rb(t)=="symbol"?t:t+""}function hht(e,t){if(rb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(rb(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var VV=function(t,n,r,i,a){var o=Math.min(Math.abs(r)/2,Math.abs(i)/2),l=i>=0?1:-1,c=r>=0?1:-1,u=i>=0&&r>=0||i<0&&r<0?1:0,d;if(o>0&&a instanceof Array){for(var f=[0,0,0,0],h=0,p=4;h<p;h++)f[h]=a[h]>o?o:a[h];d="M".concat(t,",").concat(n+l*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(t+c*f[0],",").concat(n)),d+="L ".concat(t+r-c*f[1],",").concat(n),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`,
1417        `).concat(t+r,",").concat(n+l*f[1])),d+="L ".concat(t+r,",").concat(n+i-l*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`,
1418        `).concat(t+r-c*f[2],",").concat(n+i)),d+="L ".concat(t+c*f[3],",").concat(n+i),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`,
1419        `).concat(t,",").concat(n+i-l*f[3])),d+="Z"}else if(o>0&&a===+a&&a>0){var x=Math.min(o,a);d="M ".concat(t,",").concat(n+l*x,`
1420            A `).concat(x,",").concat(x,",0,0,").concat(u,",").concat(t+c*x,",").concat(n,`
1421            L `).concat(t+r-c*x,",").concat(n,`
1422            A `).concat(x,",").concat(x,",0,0,").concat(u,",").concat(t+r,",").concat(n+l*x,`
1423            L `).concat(t+r,",").concat(n+i-l*x,`
1424            A `).concat(x,",").concat(x,",0,0,").concat(u,",").concat(t+r-c*x,",").concat(n+i,`
1425            L `).concat(t+c*x,",").concat(n+i,`
1426            A `).concat(x,",").concat(x,",0,0,").concat(u,",").concat(t,",").concat(n+i-l*x," Z")}else d="M ".concat(t,",").concat(n," h ").concat(r," v ").concat(i," h ").concat(-r," Z");return d},mht=function(t,n){if(!t||!n)return!1;var r=t.x,i=t.y,a=n.x,o=n.y,l=n.width,c=n.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(a,a+l),d=Math.max(a,a+l),f=Math.min(o,o+c),h=Math.max(o,o+c);return r>=u&&r<=d&&i>=f&&i<=h}return!1},pht={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},P8=function(t){var n=qV(qV({},pht),t),r=N.useRef(),i=N.useState(-1),a=aht(i,2),o=a[0],l=a[1];N.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var E=r.current.getTotalLength();E&&l(E)}catch{}},[]);var c=n.x,u=n.y,d=n.width,f=n.height,h=n.radius,p=n.className,x=n.animationEasing,y=n.animationDuration,b=n.animationBegin,w=n.isAnimationActive,_=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var j=hn("recharts-rectangle",p);return _?ee.createElement(hu,{canBegin:o>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:y,animationEasing:x,isActive:_},function(E){var S=E.width,T=E.height,P=E.x,O=E.y;return ee.createElement(hu,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:b,duration:y,isActive:w,easing:x},ee.createElement("path",WN({},qt(n,!0),{className:j,d:VV(P,O,S,T,h),ref:r})))}):ee.createElement("path",WN({},qt(n,!0),{className:j,d:VV(c,u,d,f,h)}))},ght=["points","className","baseLinePoints","connectNulls"];function Sg(){return Sg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sg.apply(this,arguments)}function xht(e,t){if(e==null)return{};var n=yht(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function yht(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function HV(e){return _ht(e)||wht(e)||bht(e)||vht()}function vht(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1427In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bht(e,t){if(e){if(typeof e=="string")return kO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return kO(e,t)}}function wht(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function _ht(e){if(Array.isArray(e))return kO(e)}function kO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var WV=function(t){return t&&t.x===+t.x&&t.y===+t.y},jht=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(r){WV(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),WV(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},$v=function(t,n){var r=jht(t);n&&(r=[r.reduce(function(a,o){return[].concat(HV(a),HV(o))},[])]);var i=r.map(function(a){return a.reduce(function(o,l,c){return"".concat(o).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return r.length===1?"".concat(i,"Z"):i},Nht=function(t,n,r){var i=$v(t,r);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat($v(n.reverse(),r).slice(1))},kht=function(t){var n=t.points,r=t.className,i=t.baseLinePoints,a=t.connectNulls,o=xht(t,ght);if(!n||!n.length)return null;var l=hn("recharts-polygon",r);if(i&&i.length){var c=o.stroke&&o.stroke!=="none",u=Nht(n,i,a);return ee.createElement("g",{className:l},ee.createElement("path",Sg({},qt(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:u})),c?ee.createElement("path",Sg({},qt(o,!0),{fill:"none",d:$v(n,a)})):null,c?ee.createElement("path",Sg({},qt(o,!0),{fill:"none",d:$v(i,a)})):null)}var d=$v(n,a);return ee.createElement("path",Sg({},qt(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",className:l,d}))};function CO(){return CO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},CO.apply(this,arguments)}var UE=function(t){var n=t.cx,r=t.cy,i=t.r,a=t.className,o=hn("recharts-dot",a);return n===+n&&r===+r&&i===+i?N.createElement("circle",CO({},qt(t,!1),hN(t),{className:o,cx:n,cy:r,r:i})):null};function sb(e){"@babel/helpers - typeof";return sb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sb(e)}var Cht=["x","y","top","left","width","height","className"];function EO(){return EO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},EO.apply(this,arguments)}function GV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Eht(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?GV(Object(n),!0).forEach(function(r){Sht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Sht(e,t,n){return t=Aht(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Aht(e){var t=Tht(e,"string");return sb(t)=="symbol"?t:t+""}function Tht(e,t){if(sb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(sb(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pht(e,t){if(e==null)return{};var n=Oht(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Oht(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Dht=function(t,n,r,i,a,o){return"M".concat(t,",").concat(a,"v").concat(i,"M").concat(o,",").concat(n,"h").concat(r)},Iht=function(t){var n=t.x,r=n===void 0?0:n,i=t.y,a=i===void 0?0:i,o=t.top,l=o===void 0?0:o,c=t.left,u=c===void 0?0:c,d=t.width,f=d===void 0?0:d,h=t.height,p=h===void 0?0:h,x=t.className,y=Pht(t,Cht),b=Eht({x:r,y:a,top:l,left:u,width:f,height:p},y);return!lt(r)||!lt(a)||!lt(f)||!lt(p)||!lt(l)||!lt(u)?null:ee.createElement("path",EO({},qt(b,!0),{className:hn("recharts-cross",x),d:Dht(r,a,f,p,l,u)}))},Rht=LE,Mht=gue,Lht=ph;function Fht(e,t){return e&&e.length?Rht(e,Lht(t),Mht):void 0}var $ht=Fht;const Bht=dr($ht);var zht=LE,Uht=ph,qht=xue;function Vht(e,t){return e&&e.length?zht(e,Uht(t),qht):void 0}var Hht=Vht;const Wht=dr(Hht);var Ght=["cx","cy","angle","ticks","axisLine"],Kht=["ticks","tick","angle","tickFormatter","stroke"];function Jx(e){"@babel/helpers - typeof";return Jx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jx(e)}function Bv(){return Bv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Bv.apply(this,arguments)}function KV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Oh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?KV(Object(n),!0).forEach(function(r){qE(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):KV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function YV(e,t){if(e==null)return{};var n=Yht(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Yht(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Xht(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function XV(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ide(r.key),r)}}function Qht(e,t,n){return t&&XV(e.prototype,t),n&&XV(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Jht(e,t,n){return t=GN(t),Zht(e,sde()?Reflect.construct(t,n||[],GN(e).constructor):t.apply(e,n))}function Zht(e,t){if(t&&(Jx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return emt(e)}function emt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sde(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(sde=function(){return!!e})()}function GN(e){return GN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},GN(e)}function tmt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&SO(e,t)}function SO(e,t){return SO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},SO(e,t)}function qE(e,t,n){return t=ide(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ide(e){var t=nmt(e,"string");return Jx(t)=="symbol"?t:t+""}function nmt(e,t){if(Jx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Jx(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var VE=function(e){function t(){return Xht(this,t),Jht(this,t,arguments)}return tmt(t,e),Qht(t,[{key:"getTickValueCoord",value:function(r){var i=r.coordinate,a=this.props,o=a.angle,l=a.cx,c=a.cy;return Zr(l,c,i,o)}},{key:"getTickTextAnchor",value:function(){var r=this.props.orientation,i;switch(r){case"left":i="end";break;case"right":i="start";break;default:i="middle";break}return i}},{key:"getViewBox",value:function(){var r=this.props,i=r.cx,a=r.cy,o=r.angle,l=r.ticks,c=Bht(l,function(d){return d.coordinate||0}),u=Wht(l,function(d){return d.coordinate||0});return{cx:i,cy:a,startAngle:o,endAngle:o,innerRadius:u.coordinate||0,outerRadius:c.coordinate||0}}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.cx,a=r.cy,o=r.angle,l=r.ticks,c=r.axisLine,u=YV(r,Ght),d=l.reduce(function(x,y){return[Math.min(x[0],y.coordinate),Math.max(x[1],y.coordinate)]},[1/0,-1/0]),f=Zr(i,a,d[0],o),h=Zr(i,a,d[1],o),p=Oh(Oh(Oh({},qt(u,!1)),{},{fill:"none"},qt(c,!1)),{},{x1:f.x,y1:f.y,x2:h.x,y2:h.y});return ee.createElement("line",Bv({className:"recharts-polar-radius-axis-line"},p))}},{key:"renderTicks",value:function(){var r=this,i=this.props,a=i.ticks,o=i.tick,l=i.angle,c=i.tickFormatter,u=i.stroke,d=YV(i,Kht),f=this.getTickTextAnchor(),h=qt(d,!1),p=qt(o,!1),x=a.map(function(y,b){var w=r.getTickValueCoord(y),_=Oh(Oh(Oh(Oh({textAnchor:f,transform:"rotate(".concat(90-l,", ").concat(w.x,", ").concat(w.y,")")},h),{},{stroke:"none",fill:u},p),{},{index:b},w),{},{payload:y});return ee.createElement(Wn,Bv({className:hn("recharts-polar-radius-axis-tick",Vue(o)),key:"tick-".concat(y.coordinate)},sp(r.props,y,b)),t.renderTickItem(o,_,c?c(y.value,b):y.value))});return ee.createElement(Wn,{className:"recharts-polar-radius-axis-ticks"},x)}},{key:"render",value:function(){var r=this.props,i=r.ticks,a=r.axisLine,o=r.tick;return!i||!i.length?null:ee.createElement(Wn,{className:hn("recharts-polar-radius-axis",this.props.className)},a&&this.renderAxisLine(),o&&this.renderTicks(),$i.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(r,i,a){var o;return ee.isValidElement(r)?o=ee.cloneElement(r,i):an(r)?o=r(i):o=ee.createElement(ip,Bv({},i,{className:"recharts-polar-radius-axis-tick-value"}),a),o}}])}(N.PureComponent);qE(VE,"displayName","PolarRadiusAxis");qE(VE,"axisType","radiusAxis");qE(VE,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function Zx(e){"@babel/helpers - typeof";return Zx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zx(e)}function Yh(){return Yh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yh.apply(this,arguments)}function QV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Dh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?QV(Object(n),!0).forEach(function(r){HE(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rmt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function JV(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ode(r.key),r)}}function smt(e,t,n){return t&&JV(e.prototype,t),n&&JV(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function imt(e,t,n){return t=KN(t),amt(e,ade()?Reflect.construct(t,n||[],KN(e).constructor):t.apply(e,n))}function amt(e,t){if(t&&(Zx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return omt(e)}function omt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ade(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ade=function(){return!!e})()}function KN(e){return KN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},KN(e)}function lmt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&AO(e,t)}function AO(e,t){return AO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},AO(e,t)}function HE(e,t,n){return t=ode(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ode(e){var t=cmt(e,"string");return Zx(t)=="symbol"?t:t+""}function cmt(e,t){if(Zx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Zx(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var umt=Math.PI/180,ZV=1e-5,WE=function(e){function t(){return rmt(this,t),imt(this,t,arguments)}return lmt(t,e),smt(t,[{key:"getTickLineCoord",value:function(r){var i=this.props,a=i.cx,o=i.cy,l=i.radius,c=i.orientation,u=i.tickSize,d=u||8,f=Zr(a,o,l,r.coordinate),h=Zr(a,o,l+(c==="inner"?-1:1)*d,r.coordinate);return{x1:f.x,y1:f.y,x2:h.x,y2:h.y}}},{key:"getTickTextAnchor",value:function(r){var i=this.props.orientation,a=Math.cos(-r.coordinate*umt),o;return a>ZV?o=i==="outer"?"start":"end":a<-ZV?o=i==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.cx,a=r.cy,o=r.radius,l=r.axisLine,c=r.axisLineType,u=Dh(Dh({},qt(this.props,!1)),{},{fill:"none"},qt(l,!1));if(c==="circle")return ee.createElement(UE,Yh({className:"recharts-polar-angle-axis-line"},u,{cx:i,cy:a,r:o}));var d=this.props.ticks,f=d.map(function(h){return Zr(i,a,o,h.coordinate)});return ee.createElement(kht,Yh({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var r=this,i=this.props,a=i.ticks,o=i.tick,l=i.tickLine,c=i.tickFormatter,u=i.stroke,d=qt(this.props,!1),f=qt(o,!1),h=Dh(Dh({},d),{},{fill:"none"},qt(l,!1)),p=a.map(function(x,y){var b=r.getTickLineCoord(x),w=r.getTickTextAnchor(x),_=Dh(Dh(Dh({textAnchor:w},d),{},{stroke:"none",fill:u},f),{},{index:y,payload:x,x:b.x2,y:b.y2});return ee.createElement(Wn,Yh({className:hn("recharts-polar-angle-axis-tick",Vue(o)),key:"tick-".concat(x.coordinate)},sp(r.props,x,y)),l&&ee.createElement("line",Yh({className:"recharts-polar-angle-axis-tick-line"},h,b)),o&&t.renderTickItem(o,_,c?c(x.value,y):x.value))});return ee.createElement(Wn,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var r=this.props,i=r.ticks,a=r.radius,o=r.axisLine;return a<=0||!i||!i.length?null:ee.createElement(Wn,{className:hn("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,i,a){var o;return ee.isValidElement(r)?o=ee.cloneElement(r,i):an(r)?o=r(i):o=ee.createElement(ip,Yh({},i,{className:"recharts-polar-angle-axis-tick-value"}),a),o}}])}(N.PureComponent);HE(WE,"displayName","PolarAngleAxis");HE(WE,"axisType","angleAxis");HE(WE,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var dmt=hce,fmt=dmt(Object.getPrototypeOf,Object),hmt=fmt,mmt=kd,pmt=hmt,gmt=Cd,xmt="[object Object]",ymt=Function.prototype,vmt=Object.prototype,lde=ymt.toString,bmt=vmt.hasOwnProperty,wmt=lde.call(Object);function _mt(e){if(!gmt(e)||mmt(e)!=xmt)return!1;var t=pmt(e);if(t===null)return!0;var n=bmt.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&lde.call(n)==wmt}var jmt=_mt;const Nmt=dr(jmt);var kmt=kd,Cmt=Cd,Emt="[object Boolean]";function Smt(e){return e===!0||e===!1||Cmt(e)&&kmt(e)==Emt}var Amt=Smt;const Tmt=dr(Amt);function ib(e){"@babel/helpers - typeof";return ib=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ib(e)}function YN(){return YN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},YN.apply(this,arguments)}function Pmt(e,t){return Rmt(e)||Imt(e,t)||Dmt(e,t)||Omt()}function Omt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1428In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dmt(e,t){if(e){if(typeof e=="string")return eH(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return eH(e,t)}}function eH(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Imt(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return l}}function Rmt(e){if(Array.isArray(e))return e}function tH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function nH(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tH(Object(n),!0).forEach(function(r){Mmt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Mmt(e,t,n){return t=Lmt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Lmt(e){var t=Fmt(e,"string");return ib(t)=="symbol"?t:t+""}function Fmt(e,t){if(ib(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ib(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var rH=function(t,n,r,i,a){var o=r-i,l;return l="M ".concat(t,",").concat(n),l+="L ".concat(t+r,",").concat(n),l+="L ".concat(t+r-o/2,",").concat(n+a),l+="L ".concat(t+r-o/2-i,",").concat(n+a),l+="L ".concat(t,",").concat(n," Z"),l},$mt={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Bmt=function(t){var n=nH(nH({},$mt),t),r=N.useRef(),i=N.useState(-1),a=Pmt(i,2),o=a[0],l=a[1];N.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var j=r.current.getTotalLength();j&&l(j)}catch{}},[]);var c=n.x,u=n.y,d=n.upperWidth,f=n.lowerWidth,h=n.height,p=n.className,x=n.animationEasing,y=n.animationDuration,b=n.animationBegin,w=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||h!==+h||d===0&&f===0||h===0)return null;var _=hn("recharts-trapezoid",p);return w?ee.createElement(hu,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:h,x:c,y:u},to:{upperWidth:d,lowerWidth:f,height:h,x:c,y:u},duration:y,animationEasing:x,isActive:w},function(j){var E=j.upperWidth,S=j.lowerWidth,T=j.height,P=j.x,O=j.y;return ee.createElement(hu,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:b,duration:y,easing:x},ee.createElement("path",YN({},qt(n,!0),{className:_,d:rH(P,O,E,S,T),ref:r})))}):ee.createElement("g",null,ee.createElement("path",YN({},qt(n,!0),{className:_,d:rH(c,u,d,f,h)})))},zmt=["option","shapeType","propTransformer","activeClassName","isActive"];function ab(e){"@babel/helpers - typeof";return ab=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ab(e)}function Umt(e,t){if(e==null)return{};var n=qmt(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function qmt(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function sH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function XN(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sH(Object(n),!0).forEach(function(r){Vmt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Vmt(e,t,n){return t=Hmt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hmt(e){var t=Wmt(e,"string");return ab(t)=="symbol"?t:t+""}function Wmt(e,t){if(ab(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ab(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Gmt(e,t){return XN(XN({},t),e)}function Kmt(e,t){return e==="symbols"}function iH(e){var t=e.shapeType,n=e.elementProps;switch(t){case"rectangle":return ee.createElement(P8,n);case"trapezoid":return ee.createElement(Bmt,n);case"sector":return ee.createElement(Gue,n);case"symbols":if(Kmt(t))return ee.createElement(Y6,n);break;default:return null}}function Ymt(e){return N.isValidElement(e)?e.props:e}function cde(e){var t=e.option,n=e.shapeType,r=e.propTransformer,i=r===void 0?Gmt:r,a=e.activeClassName,o=a===void 0?"recharts-active-shape":a,l=e.isActive,c=Umt(e,zmt),u;if(N.isValidElement(t))u=N.cloneElement(t,XN(XN({},c),Ymt(t)));else if(an(t))u=t(c);else if(Nmt(t)&&!Tmt(t)){var d=i(t,c);u=ee.createElement(iH,{shapeType:n,elementProps:d})}else{var f=c;u=ee.createElement(iH,{shapeType:n,elementProps:f})}return l?ee.createElement(Wn,{className:o},u):u}function GE(e,t){return t!=null&&"trapezoids"in e.props}function KE(e,t){return t!=null&&"sectors"in e.props}function ob(e,t){return t!=null&&"points"in e.props}function Xmt(e,t){var n,r,i=e.x===(t==null||(n=t.labelViewBox)===null||n===void 0?void 0:n.x)||e.x===t.x,a=e.y===(t==null||(r=t.labelViewBox)===null||r===void 0?void 0:r.y)||e.y===t.y;return i&&a}function Qmt(e,t){var n=e.endAngle===t.endAngle,r=e.startAngle===t.startAngle;return n&&r}function Jmt(e,t){var n=e.x===t.x,r=e.y===t.y,i=e.z===t.z;return n&&r&&i}function Zmt(e,t){var n;return GE(e,t)?n=Xmt:KE(e,t)?n=Qmt:ob(e,t)&&(n=Jmt),n}function ept(e,t){var n;return GE(e,t)?n="trapezoids":KE(e,t)?n="sectors":ob(e,t)&&(n="points"),n}function tpt(e,t){if(GE(e,t)){var n;return(n=t.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}if(KE(e,t)){var r;return(r=t.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}return ob(e,t)?t.payload:{}}function npt(e){var t=e.activeTooltipItem,n=e.graphicalItem,r=e.itemData,i=ept(n,t),a=tpt(n,t),o=r.filter(function(c,u){var d=Yx(a,c),f=n.props[i].filter(function(x){var y=Zmt(n,t);return y(x,t)}),h=n.props[i].indexOf(f[f.length-1]),p=u===h;return d&&p}),l=r.indexOf(o[o.length-1]);return l}var Oj;function e0(e){"@babel/helpers - typeof";return e0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e0(e)}function Ag(){return Ag=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ag.apply(this,arguments)}function aH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Gr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?aH(Object(n),!0).forEach(function(r){vl(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rpt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oH(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,dde(r.key),r)}}function spt(e,t,n){return t&&oH(e.prototype,t),n&&oH(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ipt(e,t,n){return t=QN(t),apt(e,ude()?Reflect.construct(t,n||[],QN(e).constructor):t.apply(e,n))}function apt(e,t){if(t&&(e0(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return opt(e)}function opt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ude(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ude=function(){return!!e})()}function QN(e){return QN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},QN(e)}function lpt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&TO(e,t)}function TO(e,t){return TO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},TO(e,t)}function vl(e,t,n){return t=dde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dde(e){var t=cpt(e,"string");return e0(t)=="symbol"?t:t+""}function cpt(e,t){if(e0(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(e0(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Sd=function(e){function t(n){var r;return rpt(this,t),r=ipt(this,t,[n]),vl(r,"pieRef",null),vl(r,"sectorRefs",[]),vl(r,"id",G0("recharts-pie-")),vl(r,"handleAnimationEnd",function(){var i=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),an(i)&&i()}),vl(r,"handleAnimationStart",function(){var i=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),an(i)&&i()}),r.state={isAnimationFinished:!n.isAnimationActive,prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,sectorToFocus:0},r}return lpt(t,e),spt(t,[{key:"isActiveIndex",value:function(r){var i=this.props.activeIndex;return Array.isArray(i)?i.indexOf(r)!==-1:r===i}},{key:"hasActiveIndex",value:function(){var r=this.props.activeIndex;return Array.isArray(r)?r.length!==0:r||r===0}},{key:"renderLabels",value:function(r){var i=this.props.isAnimationActive;if(i&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.label,l=a.labelLine,c=a.dataKey,u=a.valueKey,d=qt(this.props,!1),f=qt(o,!1),h=qt(l,!1),p=o&&o.offsetRadius||20,x=r.map(function(y,b){var w=(y.startAngle+y.endAngle)/2,_=Zr(y.cx,y.cy,y.outerRadius+p,w),j=Gr(Gr(Gr(Gr({},d),y),{},{stroke:"none"},f),{},{index:b,textAnchor:t.getTextAnchor(_.x,y.cx)},_),E=Gr(Gr(Gr(Gr({},d),y),{},{fill:"none",stroke:y.fill},h),{},{index:b,points:[Zr(y.cx,y.cy,y.outerRadius,w),_]}),S=c;return mn(c)&&mn(u)?S="value":mn(c)&&(S=u),ee.createElement(Wn,{key:"label-".concat(y.startAngle,"-").concat(y.endAngle,"-").concat(y.midAngle,"-").concat(b)},l&&t.renderLabelLineItem(l,E,"line"),t.renderLabelItem(o,j,Ei(y,S)))});return ee.createElement(Wn,{className:"recharts-pie-labels"},x)}},{key:"renderSectorsStatically",value:function(r){var i=this,a=this.props,o=a.activeShape,l=a.blendStroke,c=a.inactiveShape;return r.map(function(u,d){if((u==null?void 0:u.startAngle)===0&&(u==null?void 0:u.endAngle)===0&&r.length!==1)return null;var f=i.isActiveIndex(d),h=c&&i.hasActiveIndex()?c:null,p=f?o:h,x=Gr(Gr({},u),{},{stroke:l?u.fill:u.stroke,tabIndex:-1});return ee.createElement(Wn,Ag({ref:function(b){b&&!i.sectorRefs.includes(b)&&i.sectorRefs.push(b)},tabIndex:-1,className:"recharts-pie-sector"},sp(i.props,u,d),{key:"sector-".concat(u==null?void 0:u.startAngle,"-").concat(u==null?void 0:u.endAngle,"-").concat(u.midAngle,"-").concat(d)}),ee.createElement(cde,Ag({option:p,isActive:f,shapeType:"sector"},x)))})}},{key:"renderSectorsWithAnimation",value:function(){var r=this,i=this.props,a=i.sectors,o=i.isAnimationActive,l=i.animationBegin,c=i.animationDuration,u=i.animationEasing,d=i.animationId,f=this.state,h=f.prevSectors,p=f.prevIsAnimationActive;return ee.createElement(hu,{begin:l,duration:c,isActive:o,easing:u,from:{t:0},to:{t:1},key:"pie-".concat(d,"-").concat(p),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(x){var y=x.t,b=[],w=a&&a[0],_=w.startAngle;return a.forEach(function(j,E){var S=h&&h[E],T=E>0?Wo(j,"paddingAngle",0):0;if(S){var P=co(S.endAngle-S.startAngle,j.endAngle-j.startAngle),O=Gr(Gr({},j),{},{startAngle:_+T,endAngle:_+P(y)+T});b.push(O),_=O.endAngle}else{var D=j.endAngle,R=j.startAngle,L=co(0,D-R),M=L(y),B=Gr(Gr({},j),{},{startAngle:_+T,endAngle:_+M+T});b.push(B),_=B.endAngle}}),ee.createElement(Wn,null,r.renderSectorsStatically(b))})}},{key:"attachKeyboardHandlers",value:function(r){var i=this;r.onkeydown=function(a){if(!a.altKey)switch(a.key){case"ArrowLeft":{var o=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[o].focus(),i.setState({sectorToFocus:o});break}case"ArrowRight":{var l=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[l].focus(),i.setState({sectorToFocus:l});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,i=r.sectors,a=r.isAnimationActive,o=this.state.prevSectors;return a&&i&&i.length&&(!o||!Yx(o,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,i=this.props,a=i.hide,o=i.sectors,l=i.className,c=i.label,u=i.cx,d=i.cy,f=i.innerRadius,h=i.outerRadius,p=i.isAnimationActive,x=this.state.isAnimationFinished;if(a||!o||!o.length||!lt(u)||!lt(d)||!lt(f)||!lt(h))return null;var y=hn("recharts-pie",l);return ee.createElement(Wn,{tabIndex:this.props.rootTabIndex,className:y,ref:function(w){r.pieRef=w}},this.renderSectors(),c&&this.renderLabels(o),$i.renderCallByParent(this.props,null,!1),(!p||x)&&Yu.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return i.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:r.sectors!==i.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,i){return r>i?"start":r<i?"end":"middle"}},{key:"renderLabelLineItem",value:function(r,i,a){if(ee.isValidElement(r))return ee.cloneElement(r,i);if(an(r))return r(i);var o=hn("recharts-pie-label-line",typeof r!="boolean"?r.className:"");return ee.createElement(Zg,Ag({},i,{key:a,type:"linear",className:o}))}},{key:"renderLabelItem",value:function(r,i,a){if(ee.isValidElement(r))return ee.cloneElement(r,i);var o=a;if(an(r)&&(o=r(i),ee.isValidElement(o)))return o;var l=hn("recharts-pie-label-text",typeof r!="boolean"&&!an(r)?r.className:"");return ee.createElement(ip,Ag({},i,{alignmentBaseline:"middle",className:l}),o)}}])}(N.PureComponent);Oj=Sd;vl(Sd,"displayName","Pie");vl(Sd,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!wp.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});vl(Sd,"parseDeltaAngle",function(e,t){var n=$a(t-e),r=Math.min(Math.abs(t-e),360);return n*r});vl(Sd,"getRealPieData",function(e){var t=e.data,n=e.children,r=qt(e,!1),i=Pl(n,TE);return t&&t.length?t.map(function(a,o){return Gr(Gr(Gr({payload:a},r),a),i&&i[o]&&i[o].props)}):i&&i.length?i.map(function(a){return Gr(Gr({},r),a.props)}):[]});vl(Sd,"parseCoordinateOfPie",function(e,t){var n=t.top,r=t.left,i=t.width,a=t.height,o=que(i,a),l=r+Ba(e.cx,i,i/2),c=n+Ba(e.cy,a,a/2),u=Ba(e.innerRadius,o,0),d=Ba(e.outerRadius,o,o*.8),f=e.maxRadius||Math.sqrt(i*i+a*a)/2;return{cx:l,cy:c,innerRadius:u,outerRadius:d,maxRadius:f}});vl(Sd,"getComposedData",function(e){var t=e.item,n=e.offset,r=t.type.defaultProps!==void 0?Gr(Gr({},t.type.defaultProps),t.props):t.props,i=Oj.getRealPieData(r);if(!i||!i.length)return null;var a=r.cornerRadius,o=r.startAngle,l=r.endAngle,c=r.paddingAngle,u=r.dataKey,d=r.nameKey,f=r.valueKey,h=r.tooltipType,p=Math.abs(r.minAngle),x=Oj.parseCoordinateOfPie(r,n),y=Oj.parseDeltaAngle(o,l),b=Math.abs(y),w=u;mn(u)&&mn(f)?(Gu(!1,`Use "dataKey" to specify the value of pie,
1429      the props "valueKey" will be deprecated in 1.1.0`),w="value"):mn(u)&&(Gu(!1,`Use "dataKey" to specify the value of pie,
1430      the props "valueKey" will be deprecated in 1.1.0`),w=f);var _=i.filter(function(O){return Ei(O,w,0)!==0}).length,j=(b>=360?_:_-1)*c,E=b-_*p-j,S=i.reduce(function(O,D){var R=Ei(D,w,0);return O+(lt(R)?R:0)},0),T;if(S>0){var P;T=i.map(function(O,D){var R=Ei(O,w,0),L=Ei(O,d,D),M=(lt(R)?R:0)/S,B;D?B=P.endAngle+$a(y)*c*(R!==0?1:0):B=o;var U=B+$a(y)*((R!==0?p:0)+M*E),F=(B+U)/2,H=(x.innerRadius+x.outerRadius)/2,z=[{name:L,value:R,payload:O,dataKey:w,type:h}],K=Zr(x.cx,x.cy,H,F);return P=Gr(Gr(Gr({percent:M,cornerRadius:a,name:L,tooltipPayload:z,midAngle:F,middleRadius:H,tooltipPosition:K},O),x),{},{value:Ei(O,w),startAngle:B,endAngle:U,payload:O,paddingAngle:$a(y)*c}),P})}return Gr(Gr({},x),{},{sectors:T,data:i})});var upt=Math.ceil,dpt=Math.max;function fpt(e,t,n,r){for(var i=-1,a=dpt(upt((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}var hpt=fpt,mpt=Pce,lH=1/0,ppt=17976931348623157e292;function gpt(e){if(!e)return e===0?e:0;if(e=mpt(e),e===lH||e===-lH){var t=e<0?-1:1;return t*ppt}return e===e?e:0}var xpt=gpt,ypt=hpt,vpt=AE,t3=xpt;function bpt(e){return function(t,n,r){return r&&typeof r!="number"&&vpt(t,n,r)&&(n=r=void 0),t=t3(t),n===void 0?(n=t,t=0):n=t3(n),r=r===void 0?t<n?1:-1:t3(r),ypt(t,n,r,e)}}var wpt=bpt,_pt=wpt,jpt=_pt(),Npt=jpt;const JN=dr(Npt);function lb(e){"@babel/helpers - typeof";return lb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lb(e)}function cH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function uH(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cH(Object(n),!0).forEach(function(r){fde(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function fde(e,t,n){return t=kpt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kpt(e){var t=Cpt(e,"string");return lb(t)=="symbol"?t:t+""}function Cpt(e,t){if(lb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(lb(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ept=["Webkit","Moz","O","ms"],Spt=function(t,n){var r=t.replace(/(\w)/,function(a){return a.toUpperCase()}),i=Ept.reduce(function(a,o){return uH(uH({},a),{},fde({},o+r,n))},{});return i[t]=n,i};function t0(e){"@babel/helpers - typeof";return t0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t0(e)}function ZN(){return ZN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ZN.apply(this,arguments)}function dH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function n3(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?dH(Object(n),!0).forEach(function(r){To(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Apt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fH(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,mde(r.key),r)}}function Tpt(e,t,n){return t&&fH(e.prototype,t),n&&fH(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ppt(e,t,n){return t=ek(t),Opt(e,hde()?Reflect.construct(t,n||[],ek(e).constructor):t.apply(e,n))}function Opt(e,t){if(t&&(t0(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Dpt(e)}function Dpt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hde(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(hde=function(){return!!e})()}
vendor: 113,283 bytes, lines 1430-1434
1430function ek(e){return ek=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ek(e)}function Ipt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&PO(e,t)}function PO(e,t){return PO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},PO(e,t)}function To(e,t,n){return t=mde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mde(e){var t=Rpt(e,"string");return t0(t)=="symbol"?t:t+""}function Rpt(e,t){if(t0(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(t0(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Mpt=function(t){var n=t.data,r=t.startIndex,i=t.endIndex,a=t.x,o=t.width,l=t.travellerWidth;if(!n||!n.length)return{};var c=n.length,u=Mv().domain(JN(0,c)).range([a,a+o-l]),d=u.domain().map(function(f){return u(f)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:u(r),endX:u(i),scale:u,scaleValues:d}},hH=function(t){return t.changedTouches&&!!t.changedTouches.length},n0=function(e){function t(n){var r;return Apt(this,t),r=Ppt(this,t,[n]),To(r,"handleDrag",function(i){r.leaveTimer&&(clearTimeout(r.leaveTimer),r.leaveTimer=null),r.state.isTravellerMoving?r.handleTravellerMove(i):r.state.isSlideMoving&&r.handleSlideDrag(i)}),To(r,"handleTouchMove",function(i){i.changedTouches!=null&&i.changedTouches.length>0&&r.handleDrag(i.changedTouches[0])}),To(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=r.props,a=i.endIndex,o=i.onDragEnd,l=i.startIndex;o==null||o({endIndex:a,startIndex:l})}),r.detachDragEndListener()}),To(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),To(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),To(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),To(r,"handleSlideDragStart",function(i){var a=hH(i)?i.changedTouches[0]:i;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:a.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return Ipt(t,e),Tpt(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var i=r.startX,a=r.endX,o=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,f=Math.min(i,a),h=Math.max(i,a),p=t.getIndexInRange(o,f),x=t.getIndexInRange(o,h);return{startIndex:p-p%c,endIndex:x===d?d:x-x%c}}},{key:"getTextOfTick",value:function(r){var i=this.props,a=i.data,o=i.tickFormatter,l=i.dataKey,c=Ei(a[r],l,r);return an(o)?o(c,r):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var i=this.state,a=i.slideMoveStartX,o=i.startX,l=i.endX,c=this.props,u=c.x,d=c.width,f=c.travellerWidth,h=c.startIndex,p=c.endIndex,x=c.onChange,y=r.pageX-a;y>0?y=Math.min(y,u+d-f-l,u+d-f-o):y<0&&(y=Math.max(y,u-o,u-l));var b=this.getIndex({startX:o+y,endX:l+y});(b.startIndex!==h||b.endIndex!==p)&&x&&x(b),this.setState({startX:o+y,endX:l+y,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,i){var a=hH(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var i=this.state,a=i.brushMoveStartX,o=i.movingTravellerId,l=i.endX,c=i.startX,u=this.state[o],d=this.props,f=d.x,h=d.width,p=d.travellerWidth,x=d.onChange,y=d.gap,b=d.data,w={startX:this.state.startX,endX:this.state.endX},_=r.pageX-a;_>0?_=Math.min(_,f+h-p-u):_<0&&(_=Math.max(_,f-u)),w[o]=u+_;var j=this.getIndex(w),E=j.startIndex,S=j.endIndex,T=function(){var O=b.length-1;return o==="startX"&&(l>c?E%y===0:S%y===0)||l<c&&S===O||o==="endX"&&(l>c?S%y===0:E%y===0)||l>c&&S===O};this.setState(To(To({},o,u+_),"brushMoveStartX",r.pageX),function(){x&&T()&&x(j)})}},{key:"handleTravellerMoveKeyboard",value:function(r,i){var a=this,o=this.state,l=o.scaleValues,c=o.startX,u=o.endX,d=this.state[i],f=l.indexOf(d);if(f!==-1){var h=f+r;if(!(h===-1||h>=l.length)){var p=l[h];i==="startX"&&p>=u||i==="endX"&&p<=c||this.setState(To({},i,p),function(){a.props.onChange(a.getIndex({startX:a.state.startX,endX:a.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,i=r.x,a=r.y,o=r.width,l=r.height,c=r.fill,u=r.stroke;return ee.createElement("rect",{stroke:u,fill:c,x:i,y:a,width:o,height:l})}},{key:"renderPanorama",value:function(){var r=this.props,i=r.x,a=r.y,o=r.width,l=r.height,c=r.data,u=r.children,d=r.padding,f=N.Children.only(u);return f?ee.cloneElement(f,{x:i,y:a,width:o,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(r,i){var a,o,l=this,c=this.props,u=c.y,d=c.travellerWidth,f=c.height,h=c.traveller,p=c.ariaLabel,x=c.data,y=c.startIndex,b=c.endIndex,w=Math.max(r,this.props.x),_=n3(n3({},qt(this.props,!1)),{},{x:w,y:u,width:d,height:f}),j=p||"Min value: ".concat((a=x[y])===null||a===void 0?void 0:a.name,", Max value: ").concat((o=x[b])===null||o===void 0?void 0:o.name);return ee.createElement(Wn,{tabIndex:0,role:"slider","aria-label":j,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(S){["ArrowLeft","ArrowRight"].includes(S.key)&&(S.preventDefault(),S.stopPropagation(),l.handleTravellerMoveKeyboard(S.key==="ArrowRight"?1:-1,i))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(h,_))}},{key:"renderSlide",value:function(r,i){var a=this.props,o=a.y,l=a.height,c=a.stroke,u=a.travellerWidth,d=Math.min(r,i)+u,f=Math.max(Math.abs(i-r)-u,0);return ee.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:d,y:o,width:f,height:l})}},{key:"renderText",value:function(){var r=this.props,i=r.startIndex,a=r.endIndex,o=r.y,l=r.height,c=r.travellerWidth,u=r.stroke,d=this.state,f=d.startX,h=d.endX,p=5,x={pointerEvents:"none",fill:u};return ee.createElement(Wn,{className:"recharts-brush-texts"},ee.createElement(ip,ZN({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:o+l/2},x),this.getTextOfTick(i)),ee.createElement(ip,ZN({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+c+p,y:o+l/2},x),this.getTextOfTick(a)))}},{key:"render",value:function(){var r=this.props,i=r.data,a=r.className,o=r.children,l=r.x,c=r.y,u=r.width,d=r.height,f=r.alwaysShowText,h=this.state,p=h.startX,x=h.endX,y=h.isTextActive,b=h.isSlideMoving,w=h.isTravellerMoving,_=h.isTravellerFocused;if(!i||!i.length||!lt(l)||!lt(c)||!lt(u)||!lt(d)||u<=0||d<=0)return null;var j=hn("recharts-brush",a),E=ee.Children.count(o)===1,S=Spt("userSelect","none");return ee.createElement(Wn,{className:j,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:S},this.renderBackground(),E&&this.renderPanorama(),this.renderSlide(p,x),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(x,"endX"),(y||b||w||_||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var i=r.x,a=r.y,o=r.width,l=r.height,c=r.stroke,u=Math.floor(a+l/2)-1;return ee.createElement(ee.Fragment,null,ee.createElement("rect",{x:i,y:a,width:o,height:l,fill:c,stroke:"none"}),ee.createElement("line",{x1:i+1,y1:u,x2:i+o-1,y2:u,fill:"none",stroke:"#fff"}),ee.createElement("line",{x1:i+1,y1:u+2,x2:i+o-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,i){var a;return ee.isValidElement(r)?a=ee.cloneElement(r,i):an(r)?a=r(i):a=t.renderDefaultTraveller(i),a}},{key:"getDerivedStateFromProps",value:function(r,i){var a=r.data,o=r.width,l=r.x,c=r.travellerWidth,u=r.updateId,d=r.startIndex,f=r.endIndex;if(a!==i.prevData||u!==i.prevUpdateId)return n3({prevData:a,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o},a&&a.length?Mpt({data:a,width:o,x:l,travellerWidth:c,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(i.scale&&(o!==i.prevWidth||l!==i.prevX||c!==i.prevTravellerWidth)){i.scale.range([l,l+o-c]);var h=i.scale.domain().map(function(p){return i.scale(p)});return{prevData:a,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o,startX:i.scale(r.startIndex),endX:i.scale(r.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(r,i){for(var a=r.length,o=0,l=a-1;l-o>1;){var c=Math.floor((o+l)/2);r[c]>i?l=c:o=c}return i>=r[l]?l:o}}])}(N.PureComponent);To(n0,"displayName","Brush");To(n0,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var Lpt=r8;function Fpt(e,t){var n;return Lpt(e,function(r,i,a){return n=t(r,i,a),!n}),!!n}var $pt=Fpt,Bpt=ice,zpt=ph,Upt=$pt,qpt=ko,Vpt=AE;function Hpt(e,t,n){var r=qpt(e)?Bpt:Upt;return n&&Vpt(e,t,n)&&(t=void 0),r(e,zpt(t))}var Wpt=Hpt;const Gpt=dr(Wpt);var ou=function(t,n){var r=t.alwaysShow,i=t.ifOverflow;return r&&(i="extendDomain"),i===n},mH=Cce;function Kpt(e,t,n){t=="__proto__"&&mH?mH(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var Ypt=Kpt,Xpt=Ypt,Qpt=Nce,Jpt=ph;function Zpt(e,t){var n={};return t=Jpt(t),Qpt(e,function(r,i,a){Xpt(n,i,t(r,i,a))}),n}var egt=Zpt;const tgt=dr(egt);function ngt(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}var rgt=ngt,sgt=r8;function igt(e,t){var n=!0;return sgt(e,function(r,i,a){return n=!!t(r,i,a),n}),n}var agt=igt,ogt=rgt,lgt=agt,cgt=ph,ugt=ko,dgt=AE;function fgt(e,t,n){var r=ugt(e)?ogt:lgt;return n&&dgt(e,t,n)&&(t=void 0),r(e,cgt(t))}var hgt=fgt;const mgt=dr(hgt);var pgt=["x","y"];function cb(e){"@babel/helpers - typeof";return cb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cb(e)}function OO(){return OO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},OO.apply(this,arguments)}function pH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Gy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pH(Object(n),!0).forEach(function(r){ggt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ggt(e,t,n){return t=xgt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xgt(e){var t=ygt(e,"string");return cb(t)=="symbol"?t:t+""}function ygt(e,t){if(cb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(cb(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vgt(e,t){if(e==null)return{};var n=bgt(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function bgt(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function wgt(e,t){var n=e.x,r=e.y,i=vgt(e,pgt),a="".concat(n),o=parseInt(a,10),l="".concat(r),c=parseInt(l,10),u="".concat(t.height||i.height),d=parseInt(u,10),f="".concat(t.width||i.width),h=parseInt(f,10);return Gy(Gy(Gy(Gy(Gy({},t),i),o?{x:o}:{}),c?{y:c}:{}),{},{height:d,width:h,name:t.name,radius:t.radius})}function gH(e){return ee.createElement(cde,OO({shapeType:"rectangle",propTransformer:wgt,activeClassName:"recharts-active-bar"},e))}var _gt=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,i){if(typeof t=="number")return t;var a=lt(r)||UKe(r);return a?t(r,i):(a||op(),n)}},jgt=["value","background"],pde;function r0(e){"@babel/helpers - typeof";return r0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r0(e)}function Ngt(e,t){if(e==null)return{};var n=kgt(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function kgt(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function tk(){return tk=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tk.apply(this,arguments)}function xH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ti(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xH(Object(n),!0).forEach(function(r){gf(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Cgt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yH(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,xde(r.key),r)}}function Egt(e,t,n){return t&&yH(e.prototype,t),n&&yH(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Sgt(e,t,n){return t=nk(t),Agt(e,gde()?Reflect.construct(t,n||[],nk(e).constructor):t.apply(e,n))}function Agt(e,t){if(t&&(r0(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Tgt(e)}function Tgt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gde(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gde=function(){return!!e})()}function nk(e){return nk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},nk(e)}function Pgt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&DO(e,t)}function DO(e,t){return DO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},DO(e,t)}function gf(e,t,n){return t=xde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xde(e){var t=Ogt(e,"string");return r0(t)=="symbol"?t:t+""}function Ogt(e,t){if(r0(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(r0(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Hf=function(e){function t(){var n;Cgt(this,t);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return n=Sgt(this,t,[].concat(i)),gf(n,"state",{isAnimationFinished:!1}),gf(n,"id",G0("recharts-bar-")),gf(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),o&&o()}),gf(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),o&&o()}),n}return Pgt(t,e),Egt(t,[{key:"renderRectanglesStatically",value:function(r){var i=this,a=this.props,o=a.shape,l=a.dataKey,c=a.activeIndex,u=a.activeBar,d=qt(this.props,!1);return r&&r.map(function(f,h){var p=h===c,x=p?u:o,y=ti(ti(ti({},d),f),{},{isActive:p,option:x,index:h,dataKey:l,onAnimationStart:i.handleAnimationStart,onAnimationEnd:i.handleAnimationEnd});return ee.createElement(Wn,tk({className:"recharts-bar-rectangle"},sp(i.props,f,h),{key:"rectangle-".concat(f==null?void 0:f.x,"-").concat(f==null?void 0:f.y,"-").concat(f==null?void 0:f.value,"-").concat(h)}),ee.createElement(gH,y))})}},{key:"renderRectanglesWithAnimation",value:function(){var r=this,i=this.props,a=i.data,o=i.layout,l=i.isAnimationActive,c=i.animationBegin,u=i.animationDuration,d=i.animationEasing,f=i.animationId,h=this.state.prevData;return ee.createElement(hu,{begin:c,duration:u,isActive:l,easing:d,from:{t:0},to:{t:1},key:"bar-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(p){var x=p.t,y=a.map(function(b,w){var _=h&&h[w];if(_){var j=co(_.x,b.x),E=co(_.y,b.y),S=co(_.width,b.width),T=co(_.height,b.height);return ti(ti({},b),{},{x:j(x),y:E(x),width:S(x),height:T(x)})}if(o==="horizontal"){var P=co(0,b.height),O=P(x);return ti(ti({},b),{},{y:b.y+b.height-O,height:O})}var D=co(0,b.width),R=D(x);return ti(ti({},b),{},{width:R})});return ee.createElement(Wn,null,r.renderRectanglesStatically(y))})}},{key:"renderRectangles",value:function(){var r=this.props,i=r.data,a=r.isAnimationActive,o=this.state.prevData;return a&&i&&i.length&&(!o||!Yx(o,i))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(i)}},{key:"renderBackground",value:function(){var r=this,i=this.props,a=i.data,o=i.dataKey,l=i.activeIndex,c=qt(this.props.background,!1);return a.map(function(u,d){u.value;var f=u.background,h=Ngt(u,jgt);if(!f)return null;var p=ti(ti(ti(ti(ti({},h),{},{fill:"#eee"},f),c),sp(r.props,u,d)),{},{onAnimationStart:r.handleAnimationStart,onAnimationEnd:r.handleAnimationEnd,dataKey:o,index:d,className:"recharts-bar-background-rectangle"});return ee.createElement(gH,tk({key:"background-bar-".concat(d),option:r.props.background,isActive:d===l},p))})}},{key:"renderErrorBar",value:function(r,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.data,l=a.xAxis,c=a.yAxis,u=a.layout,d=a.children,f=Pl(d,zE);if(!f)return null;var h=u==="vertical"?o[0].height/2:o[0].width/2,p=function(b,w){var _=Array.isArray(b.value)?b.value[1]:b.value;return{x:b.x,y:b.y,value:_,errorVal:Ei(b,w)}},x={clipPath:r?"url(#clipPath-".concat(i,")"):null};return ee.createElement(Wn,x,f.map(function(y){return ee.cloneElement(y,{key:"error-bar-".concat(i,"-").concat(y.props.dataKey),data:o,xAxis:l,yAxis:c,layout:u,offset:h,dataPointFormatter:p})}))}},{key:"render",value:function(){var r=this.props,i=r.hide,a=r.data,o=r.className,l=r.xAxis,c=r.yAxis,u=r.left,d=r.top,f=r.width,h=r.height,p=r.isAnimationActive,x=r.background,y=r.id;if(i||!a||!a.length)return null;var b=this.state.isAnimationFinished,w=hn("recharts-bar",o),_=l&&l.allowDataOverflow,j=c&&c.allowDataOverflow,E=_||j,S=mn(y)?this.id:y;return ee.createElement(Wn,{className:w},_||j?ee.createElement("defs",null,ee.createElement("clipPath",{id:"clipPath-".concat(S)},ee.createElement("rect",{x:_?u:u-f/2,y:j?d:d-h/2,width:_?f:f*2,height:j?h:h*2}))):null,ee.createElement(Wn,{className:"recharts-bar-rectangles",clipPath:E?"url(#clipPath-".concat(S,")"):null},x?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(E,S),(!p||b)&&Yu.renderCallByParent(this.props,a))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curData:r.data,prevData:i.curData}:r.data!==i.curData?{curData:r.data}:null}}])}(N.PureComponent);pde=Hf;gf(Hf,"displayName","Bar");gf(Hf,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!wp.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});gf(Hf,"getComposedData",function(e){var t=e.props,n=e.item,r=e.barPosition,i=e.bandSize,a=e.xAxis,o=e.yAxis,l=e.xAxisTicks,c=e.yAxisTicks,u=e.stackedData,d=e.dataStartIndex,f=e.displayedData,h=e.offset,p=uut(r,n);if(!p)return null;var x=t.layout,y=n.type.defaultProps,b=y!==void 0?ti(ti({},y),n.props):n.props,w=b.dataKey,_=b.children,j=b.minPointSize,E=x==="horizontal"?o:a,S=u?E.scale.domain():null,T=xut({numericAxis:E}),P=Pl(_,TE),O=f.map(function(D,R){var L,M,B,U,F,H;u?L=dut(u[d+R],S):(L=Ei(D,w),Array.isArray(L)||(L=[T,L]));var z=_gt(j,pde.defaultProps.minPointSize)(L[1],R);if(x==="horizontal"){var K,W=[o.scale(L[0]),o.scale(L[1])],q=W[0],oe=W[1];M=oV({axis:a,ticks:l,bandSize:i,offset:p.offset,entry:D,index:R}),B=(K=oe??q)!==null&&K!==void 0?K:void 0,U=p.size;var J=q-oe;if(F=Number.isNaN(J)?0:J,H={x:M,y:o.y,width:U,height:o.height},Math.abs(z)>0&&Math.abs(F)<Math.abs(z)){var Y=$a(F||z)*(Math.abs(z)-Math.abs(F));B-=Y,F+=Y}}else{var Z=[a.scale(L[0]),a.scale(L[1])],G=Z[0],se=Z[1];if(M=G,B=oV({axis:o,ticks:c,bandSize:i,offset:p.offset,entry:D,index:R}),U=se-G,F=p.size,H={x:a.x,y:B,width:a.width,height:F},Math.abs(z)>0&&Math.abs(U)<Math.abs(z)){var ce=$a(U||z)*(Math.abs(z)-Math.abs(U));U+=ce}}return ti(ti(ti({},D),{},{x:M,y:B,width:U,height:F,value:u?L:L[1],payload:D,background:H},P&&P[R]&&P[R].props),{},{tooltipPayload:[zue(n,D)],tooltipPosition:{x:M+U/2,y:B+F/2}})});return ti({data:O,layout:x},h)});function ub(e){"@babel/helpers - typeof";return ub=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ub(e)}function Dgt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vH(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,yde(r.key),r)}}function Igt(e,t,n){return t&&vH(e.prototype,t),n&&vH(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function bH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ic(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bH(Object(n),!0).forEach(function(r){YE(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function YE(e,t,n){return t=yde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yde(e){var t=Rgt(e,"string");return ub(t)=="symbol"?t:t+""}function Rgt(e,t){if(ub(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ub(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var vde=function(t,n,r,i,a){var o=t.width,l=t.height,c=t.layout,u=t.children,d=Object.keys(n),f={left:r.left,leftMirror:r.left,right:o-r.right,rightMirror:o-r.right,top:r.top,topMirror:r.top,bottom:l-r.bottom,bottomMirror:l-r.bottom},h=!!Do(u,Hf);return d.reduce(function(p,x){var y=n[x],b=y.orientation,w=y.domain,_=y.padding,j=_===void 0?{}:_,E=y.mirror,S=y.reversed,T="".concat(b).concat(E?"Mirror":""),P,O,D,R,L;if(y.type==="number"&&(y.padding==="gap"||y.padding==="no-gap")){var M=w[1]-w[0],B=1/0,U=y.categoricalDomain.sort(HKe);if(U.forEach(function(Z,G){G>0&&(B=Math.min((Z||0)-(U[G-1]||0),B))}),Number.isFinite(B)){var F=B/M,H=y.layout==="vertical"?r.height:r.width;if(y.padding==="gap"&&(P=F*H/2),y.padding==="no-gap"){var z=Ba(t.barCategoryGap,F*H),K=F*H/2;P=K-z-(K-z)/H*z}}}i==="xAxis"?O=[r.left+(j.left||0)+(P||0),r.left+r.width-(j.right||0)-(P||0)]:i==="yAxis"?O=c==="horizontal"?[r.top+r.height-(j.bottom||0),r.top+(j.top||0)]:[r.top+(j.top||0)+(P||0),r.top+r.height-(j.bottom||0)-(P||0)]:O=y.range,S&&(O=[O[1],O[0]]);var W=Lue(y,a,h),q=W.scale,oe=W.realScaleType;q.domain(w).range(O),Fue(q);var J=$ue(q,ic(ic({},y),{},{realScaleType:oe}));i==="xAxis"?(L=b==="top"&&!E||b==="bottom"&&E,D=r.left,R=f[T]-L*y.height):i==="yAxis"&&(L=b==="left"&&!E||b==="right"&&E,D=f[T]-L*y.width,R=r.top);var Y=ic(ic(ic({},y),J),{},{realScaleType:oe,x:D,y:R,scale:q,width:i==="xAxis"?r.width:y.width,height:i==="yAxis"?r.height:y.height});return Y.bandSize=BN(Y,J),!y.hide&&i==="xAxis"?f[T]+=(L?-1:1)*Y.height:y.hide||(f[T]+=(L?-1:1)*Y.width),ic(ic({},p),{},YE({},x,Y))},{})},bde=function(t,n){var r=t.x,i=t.y,a=n.x,o=n.y;return{x:Math.min(r,a),y:Math.min(i,o),width:Math.abs(a-r),height:Math.abs(o-i)}},Mgt=function(t){var n=t.x1,r=t.y1,i=t.x2,a=t.y2;return bde({x:n,y:r},{x:i,y:a})},wde=function(){function e(t){Dgt(this,e),this.scale=t}return Igt(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.bandAware,a=r.position;if(n!==void 0){if(a)switch(a){case"start":return this.scale(n);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(n)+l}default:return this.scale(n)}if(i){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),i=r[0],a=r[r.length-1];return i<=a?n>=i&&n<=a:n>=a&&n<=i}}],[{key:"create",value:function(n){return new e(n)}}])}();YE(wde,"EPS",1e-4);var O8=function(t){var n=Object.keys(t).reduce(function(r,i){return ic(ic({},r),{},YE({},i,wde.create(t[i])))},{});return ic(ic({},n),{},{apply:function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=a.bandAware,l=a.position;return tgt(i,function(c,u){return n[u].apply(c,{bandAware:o,position:l})})},isInRange:function(i){return mgt(i,function(a,o){return n[o].isInRange(a)})}})};function Lgt(e){return(e%180+180)%180}var Fgt=function(t){var n=t.width,r=t.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=Lgt(i),o=a*Math.PI/180,l=Math.atan(r/n),c=o>l&&o<Math.PI-l?r/Math.sin(o):n/Math.cos(o);return Math.abs(c)},$gt=KGe(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),_de=N.createContext(void 0),jde=N.createContext(void 0),Nde=N.createContext(void 0),Bgt=N.createContext({}),kde=N.createContext(void 0),Cde=N.createContext(0),Ede=N.createContext(0),wH=function(t){var n=t.state,r=n.xAxisMap,i=n.yAxisMap,a=n.offset,o=t.clipPathId,l=t.children,c=t.width,u=t.height,d=$gt(a);return ee.createElement(_de.Provider,{value:r},ee.createElement(jde.Provider,{value:i},ee.createElement(Bgt.Provider,{value:a},ee.createElement(Nde.Provider,{value:d},ee.createElement(kde.Provider,{value:o},ee.createElement(Cde.Provider,{value:u},ee.createElement(Ede.Provider,{value:c},l)))))))},zgt=function(){return N.useContext(kde)},Sde=function(t){var n=N.useContext(_de);n==null&&op();var r=n[t];return r==null&&op(),r},Ade=function(t){var n=N.useContext(jde);n==null&&op();var r=n[t];return r==null&&op(),r},Ugt=function(){var t=N.useContext(Nde);return t},Tde=function(){return N.useContext(Ede)},Pde=function(){return N.useContext(Cde)};function s0(e){"@babel/helpers - typeof";return s0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s0(e)}function qgt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vgt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Dde(r.key),r)}}function Hgt(e,t,n){return t&&Vgt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Wgt(e,t,n){return t=rk(t),Ggt(e,Ode()?Reflect.construct(t,n||[],rk(e).constructor):t.apply(e,n))}function Ggt(e,t){if(t&&(s0(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Kgt(e)}function Kgt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ode(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ode=function(){return!!e})()}function rk(e){return rk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},rk(e)}function Ygt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&IO(e,t)}function IO(e,t){return IO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},IO(e,t)}function _H(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function jH(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_H(Object(n),!0).forEach(function(r){D8(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_H(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function D8(e,t,n){return t=Dde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dde(e){var t=Xgt(e,"string");return s0(t)=="symbol"?t:t+""}function Xgt(e,t){if(s0(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(s0(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Qgt(e,t){return txt(e)||ext(e,t)||Zgt(e,t)||Jgt()}function Jgt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1431In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zgt(e,t){if(e){if(typeof e=="string")return NH(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return NH(e,t)}}function NH(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ext(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return l}}function txt(e){if(Array.isArray(e))return e}function RO(){return RO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},RO.apply(this,arguments)}var nxt=function(t,n){var r;return ee.isValidElement(t)?r=ee.cloneElement(t,n):an(t)?r=t(n):r=ee.createElement("line",RO({},n,{className:"recharts-reference-line-line"})),r},rxt=function(t,n,r,i,a,o,l,c,u){var d=a.x,f=a.y,h=a.width,p=a.height;if(r){var x=u.y,y=t.y.apply(x,{position:o});if(ou(u,"discard")&&!t.y.isInRange(y))return null;var b=[{x:d+h,y},{x:d,y}];return c==="left"?b.reverse():b}if(n){var w=u.x,_=t.x.apply(w,{position:o});if(ou(u,"discard")&&!t.x.isInRange(_))return null;var j=[{x:_,y:f+p},{x:_,y:f}];return l==="top"?j.reverse():j}if(i){var E=u.segment,S=E.map(function(T){return t.apply(T,{position:o})});return ou(u,"discard")&&Gpt(S,function(T){return!t.isInRange(T)})?null:S}return null};function sxt(e){var t=e.x,n=e.y,r=e.segment,i=e.xAxisId,a=e.yAxisId,o=e.shape,l=e.className,c=e.alwaysShow,u=zgt(),d=Sde(i),f=Ade(a),h=Ugt();if(!u||!h)return null;Gu(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var p=O8({x:d.scale,y:f.scale}),x=Ai(t),y=Ai(n),b=r&&r.length===2,w=rxt(p,x,y,b,h,e.position,d.orientation,f.orientation,e);if(!w)return null;var _=Qgt(w,2),j=_[0],E=j.x,S=j.y,T=_[1],P=T.x,O=T.y,D=ou(e,"hidden")?"url(#".concat(u,")"):void 0,R=jH(jH({clipPath:D},qt(e,!0)),{},{x1:E,y1:S,x2:P,y2:O});return ee.createElement(Wn,{className:hn("recharts-reference-line",l)},nxt(o,R),$i.renderCallByParent(e,Mgt({x1:E,y1:S,x2:P,y2:O})))}var XE=function(e){function t(){return qgt(this,t),Wgt(this,t,arguments)}return Ygt(t,e),Hgt(t,[{key:"render",value:function(){return ee.createElement(sxt,this.props)}}])}(ee.Component);D8(XE,"displayName","ReferenceLine");D8(XE,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function MO(){return MO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},MO.apply(this,arguments)}function i0(e){"@babel/helpers - typeof";return i0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i0(e)}function kH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function CH(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kH(Object(n),!0).forEach(function(r){QE(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ixt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function axt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Rde(r.key),r)}}function oxt(e,t,n){return t&&axt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function lxt(e,t,n){return t=sk(t),cxt(e,Ide()?Reflect.construct(t,n||[],sk(e).constructor):t.apply(e,n))}function cxt(e,t){if(t&&(i0(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return uxt(e)}function uxt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ide(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ide=function(){return!!e})()}function sk(e){return sk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},sk(e)}function dxt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&LO(e,t)}function LO(e,t){return LO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},LO(e,t)}function QE(e,t,n){return t=Rde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rde(e){var t=fxt(e,"string");return i0(t)=="symbol"?t:t+""}function fxt(e,t){if(i0(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(i0(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var hxt=function(t){var n=t.x,r=t.y,i=t.xAxis,a=t.yAxis,o=O8({x:i.scale,y:a.scale}),l=o.apply({x:n,y:r},{bandAware:!0});return ou(t,"discard")&&!o.isInRange(l)?null:l},JE=function(e){function t(){return ixt(this,t),lxt(this,t,arguments)}return dxt(t,e),oxt(t,[{key:"render",value:function(){var r=this.props,i=r.x,a=r.y,o=r.r,l=r.alwaysShow,c=r.clipPathId,u=Ai(i),d=Ai(a);if(Gu(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!u||!d)return null;var f=hxt(this.props);if(!f)return null;var h=f.x,p=f.y,x=this.props,y=x.shape,b=x.className,w=ou(this.props,"hidden")?"url(#".concat(c,")"):void 0,_=CH(CH({clipPath:w},qt(this.props,!0)),{},{cx:h,cy:p});return ee.createElement(Wn,{className:hn("recharts-reference-dot",b)},t.renderDot(y,_),$i.renderCallByParent(this.props,{x:h-o,y:p-o,width:2*o,height:2*o}))}}])}(ee.Component);QE(JE,"displayName","ReferenceDot");QE(JE,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});QE(JE,"renderDot",function(e,t){var n;return ee.isValidElement(e)?n=ee.cloneElement(e,t):an(e)?n=e(t):n=ee.createElement(UE,MO({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),n});function FO(){return FO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},FO.apply(this,arguments)}function a0(e){"@babel/helpers - typeof";return a0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a0(e)}function EH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function SH(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?EH(Object(n),!0).forEach(function(r){ZE(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function mxt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pxt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Lde(r.key),r)}}function gxt(e,t,n){return t&&pxt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function xxt(e,t,n){return t=ik(t),yxt(e,Mde()?Reflect.construct(t,n||[],ik(e).constructor):t.apply(e,n))}function yxt(e,t){if(t&&(a0(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vxt(e)}function vxt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mde(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Mde=function(){return!!e})()}function ik(e){return ik=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ik(e)}function bxt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$O(e,t)}function $O(e,t){return $O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},$O(e,t)}function ZE(e,t,n){return t=Lde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Lde(e){var t=wxt(e,"string");return a0(t)=="symbol"?t:t+""}function wxt(e,t){if(a0(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(a0(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var _xt=function(t,n,r,i,a){var o=a.x1,l=a.x2,c=a.y1,u=a.y2,d=a.xAxis,f=a.yAxis;if(!d||!f)return null;var h=O8({x:d.scale,y:f.scale}),p={x:t?h.x.apply(o,{position:"start"}):h.x.rangeMin,y:r?h.y.apply(c,{position:"start"}):h.y.rangeMin},x={x:n?h.x.apply(l,{position:"end"}):h.x.rangeMax,y:i?h.y.apply(u,{position:"end"}):h.y.rangeMax};return ou(a,"discard")&&(!h.isInRange(p)||!h.isInRange(x))?null:bde(p,x)},eS=function(e){function t(){return mxt(this,t),xxt(this,t,arguments)}return bxt(t,e),gxt(t,[{key:"render",value:function(){var r=this.props,i=r.x1,a=r.x2,o=r.y1,l=r.y2,c=r.className,u=r.alwaysShow,d=r.clipPathId;Gu(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var f=Ai(i),h=Ai(a),p=Ai(o),x=Ai(l),y=this.props.shape;if(!f&&!h&&!p&&!x&&!y)return null;var b=_xt(f,h,p,x,this.props);if(!b&&!y)return null;var w=ou(this.props,"hidden")?"url(#".concat(d,")"):void 0;return ee.createElement(Wn,{className:hn("recharts-reference-area",c)},t.renderRect(y,SH(SH({clipPath:w},qt(this.props,!0)),b)),$i.renderCallByParent(this.props,b))}}])}(ee.Component);ZE(eS,"displayName","ReferenceArea");ZE(eS,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});ZE(eS,"renderRect",function(e,t){var n;return ee.isValidElement(e)?n=ee.cloneElement(e,t):an(e)?n=e(t):n=ee.createElement(P8,FO({},t,{className:"recharts-reference-area-rect"})),n});function Fde(e,t,n){if(t<1)return[];if(t===1&&n===void 0)return e;for(var r=[],i=0;i<e.length;i+=t)r.push(e[i]);return r}function jxt(e,t,n){var r={width:e.width+t.width,height:e.height+t.height};return Fgt(r,n)}function Nxt(e,t,n){var r=n==="width",i=e.x,a=e.y,o=e.width,l=e.height;return t===1?{start:r?i:a,end:r?i+o:a+l}:{start:r?i+o:a+l,end:r?i:a}}function ak(e,t,n,r,i){if(e*t<e*r||e*t>e*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function kxt(e,t){return Fde(e,t+1)}function Cxt(e,t,n,r,i){for(var a=(r||[]).slice(),o=t.start,l=t.end,c=0,u=1,d=o,f=function(){var x=r==null?void 0:r[c];if(x===void 0)return{v:Fde(r,u)};var y=c,b,w=function(){return b===void 0&&(b=n(x,y)),b},_=x.coordinate,j=c===0||ak(e,_,w,d,l);j||(c=0,d=o,u+=1),j&&(d=_+e*(w()/2+i),c+=u)},h;u<=a.length;)if(h=f(),h)return h.v;return[]}function db(e){"@babel/helpers - typeof";return db=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},db(e)}function AH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function xa(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?AH(Object(n),!0).forEach(function(r){Ext(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ext(e,t,n){return t=Sxt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sxt(e){var t=Axt(e,"string");return db(t)=="symbol"?t:t+""}function Axt(e,t){if(db(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(db(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Txt(e,t,n,r,i){for(var a=(r||[]).slice(),o=a.length,l=t.start,c=t.end,u=function(h){var p=a[h],x,y=function(){return x===void 0&&(x=n(p,h)),x};if(h===o-1){var b=e*(p.coordinate+e*y()/2-c);a[h]=p=xa(xa({},p),{},{tickCoord:b>0?p.coordinate-b*e:p.coordinate})}else a[h]=p=xa(xa({},p),{},{tickCoord:p.coordinate});var w=ak(e,p.tickCoord,y,l,c);w&&(c=p.tickCoord-e*(y()/2+i),a[h]=xa(xa({},p),{},{isShow:!0}))},d=o-1;d>=0;d--)u(d);return a}function Pxt(e,t,n,r,i,a){var o=(r||[]).slice(),l=o.length,c=t.start,u=t.end;if(a){var d=r[l-1],f=n(d,l-1),h=e*(d.coordinate+e*f/2-u);o[l-1]=d=xa(xa({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate});var p=ak(e,d.tickCoord,function(){return f},c,u);p&&(u=d.tickCoord-e*(f/2+i),o[l-1]=xa(xa({},d),{},{isShow:!0}))}for(var x=a?l-1:l,y=function(_){var j=o[_],E,S=function(){return E===void 0&&(E=n(j,_)),E};if(_===0){var T=e*(j.coordinate-e*S()/2-c);o[_]=j=xa(xa({},j),{},{tickCoord:T<0?j.coordinate-T*e:j.coordinate})}else o[_]=j=xa(xa({},j),{},{tickCoord:j.coordinate});var P=ak(e,j.tickCoord,S,c,u);P&&(c=j.tickCoord+e*(S()/2+i),o[_]=xa(xa({},j),{},{isShow:!0}))},b=0;b<x;b++)y(b);return o}function Oxt(e,t,n){var r=e.tick,i=e.ticks,a=e.viewBox,o=e.minTickGap,l=e.orientation,c=e.interval,u=e.tickFormatter,d=e.unit,f=e.angle;if(!i||!i.length||!r)return[];if(lt(c)||wp.isSsr)return kxt(i,typeof c=="number"&&lt(c)?c:0);var h=[],p=l==="top"||l==="bottom"?"width":"height",x=d&&p==="width"?Rv(d,{fontSize:t,letterSpacing:n}):{width:0,height:0},y=function(j,E){var S=an(u)?u(j.value,E):j.value;return p==="width"?jxt(Rv(S,{fontSize:t,letterSpacing:n}),x,f):Rv(S,{fontSize:t,letterSpacing:n})[p]},b=i.length>=2?$a(i[1].coordinate-i[0].coordinate):1,w=Nxt(a,b,p);return c==="equidistantPreserveStart"?Cxt(b,w,y,i,o):(c==="preserveStart"||c==="preserveStartEnd"?h=Pxt(b,w,y,i,o,c==="preserveStartEnd"):h=Txt(b,w,y,i,o),h.filter(function(_){return _.isShow}))}var Dxt=["viewBox"],Ixt=["viewBox"],Rxt=["ticks"];function o0(e){"@babel/helpers - typeof";return o0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o0(e)}function Tg(){return Tg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Tg.apply(this,arguments)}function TH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function yi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?TH(Object(n),!0).forEach(function(r){I8(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):TH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function r3(e,t){if(e==null)return{};var n=Mxt(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Mxt(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Lxt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function PH(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Bde(r.key),r)}}function Fxt(e,t,n){return t&&PH(e.prototype,t),n&&PH(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function $xt(e,t,n){return t=ok(t),Bxt(e,$de()?Reflect.construct(t,n||[],ok(e).constructor):t.apply(e,n))}function Bxt(e,t){if(t&&(o0(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zxt(e)}function zxt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $de(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($de=function(){return!!e})()}function ok(e){return ok=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ok(e)}function Uxt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&BO(e,t)}function BO(e,t){return BO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},BO(e,t)}function I8(e,t,n){return t=Bde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bde(e){var t=qxt(e,"string");return o0(t)=="symbol"?t:t+""}function qxt(e,t){if(o0(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(o0(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var tS=function(e){function t(n){var r;return Lxt(this,t),r=$xt(this,t,[n]),r.state={fontSize:"",letterSpacing:""},r}return Uxt(t,e),Fxt(t,[{key:"shouldComponentUpdate",value:function(r,i){var a=r.viewBox,o=r3(r,Dxt),l=this.props,c=l.viewBox,u=r3(l,Ixt);return!Yg(a,c)||!Yg(o,u)||!Yg(i,this.state)}},{key:"componentDidMount",value:function(){var r=this.layerReference;if(r){var i=r.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];i&&this.setState({fontSize:window.getComputedStyle(i).fontSize,letterSpacing:window.getComputedStyle(i).letterSpacing})}}},{key:"getTickLineCoord",value:function(r){var i=this.props,a=i.x,o=i.y,l=i.width,c=i.height,u=i.orientation,d=i.tickSize,f=i.mirror,h=i.tickMargin,p,x,y,b,w,_,j=f?-1:1,E=r.tickSize||d,S=lt(r.tickCoord)?r.tickCoord:r.coordinate;switch(u){case"top":p=x=r.coordinate,b=o+ +!f*c,y=b-j*E,_=y-j*h,w=S;break;case"left":y=b=r.coordinate,x=a+ +!f*l,p=x-j*E,w=p-j*h,_=S;break;case"right":y=b=r.coordinate,x=a+ +f*l,p=x+j*E,w=p+j*h,_=S;break;default:p=x=r.coordinate,b=o+ +f*c,y=b+j*E,_=y+j*h,w=S;break}return{line:{x1:p,y1:y,x2:x,y2:b},tick:{x:w,y:_}}}},{key:"getTickTextAnchor",value:function(){var r=this.props,i=r.orientation,a=r.mirror,o;switch(i){case"left":o=a?"start":"end";break;case"right":o=a?"end":"start";break;default:o="middle";break}return o}},{key:"getTickVerticalAnchor",value:function(){var r=this.props,i=r.orientation,a=r.mirror,o="end";switch(i){case"left":case"right":o="middle";break;case"top":o=a?"start":"end";break;default:o=a?"end":"start";break}return o}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.x,a=r.y,o=r.width,l=r.height,c=r.orientation,u=r.mirror,d=r.axisLine,f=yi(yi(yi({},qt(this.props,!1)),qt(d,!1)),{},{fill:"none"});if(c==="top"||c==="bottom"){var h=+(c==="top"&&!u||c==="bottom"&&u);f=yi(yi({},f),{},{x1:i,y1:a+h*l,x2:i+o,y2:a+h*l})}else{var p=+(c==="left"&&!u||c==="right"&&u);f=yi(yi({},f),{},{x1:i+p*o,y1:a,x2:i+p*o,y2:a+l})}return ee.createElement("line",Tg({},f,{className:hn("recharts-cartesian-axis-line",Wo(d,"className"))}))}},{key:"renderTicks",value:function(r,i,a){var o=this,l=this.props,c=l.tickLine,u=l.stroke,d=l.tick,f=l.tickFormatter,h=l.unit,p=Oxt(yi(yi({},this.props),{},{ticks:r}),i,a),x=this.getTickTextAnchor(),y=this.getTickVerticalAnchor(),b=qt(this.props,!1),w=qt(d,!1),_=yi(yi({},b),{},{fill:"none"},qt(c,!1)),j=p.map(function(E,S){var T=o.getTickLineCoord(E),P=T.line,O=T.tick,D=yi(yi(yi(yi({textAnchor:x,verticalAnchor:y},b),{},{stroke:"none",fill:u},w),O),{},{index:S,payload:E,visibleTicksCount:p.length,tickFormatter:f});return ee.createElement(Wn,Tg({className:"recharts-cartesian-axis-tick",key:"tick-".concat(E.value,"-").concat(E.coordinate,"-").concat(E.tickCoord)},sp(o.props,E,S)),c&&ee.createElement("line",Tg({},_,P,{className:hn("recharts-cartesian-axis-tick-line",Wo(c,"className"))})),d&&t.renderTickItem(d,D,"".concat(an(f)?f(E.value,S):E.value).concat(h||"")))});return ee.createElement("g",{className:"recharts-cartesian-axis-ticks"},j)}},{key:"render",value:function(){var r=this,i=this.props,a=i.axisLine,o=i.width,l=i.height,c=i.ticksGenerator,u=i.className,d=i.hide;if(d)return null;var f=this.props,h=f.ticks,p=r3(f,Rxt),x=h;return an(c)&&(x=h&&h.length>0?c(this.props):c(p)),o<=0||l<=0||!x||!x.length?null:ee.createElement(Wn,{className:hn("recharts-cartesian-axis",u),ref:function(b){r.layerReference=b}},a&&this.renderAxisLine(),this.renderTicks(x,this.state.fontSize,this.state.letterSpacing),$i.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,i,a){var o,l=hn(i.className,"recharts-cartesian-axis-tick-value");return ee.isValidElement(r)?o=ee.cloneElement(r,yi(yi({},i),{},{className:l})):an(r)?o=r(yi(yi({},i),{},{className:l})):o=ee.createElement(ip,Tg({},i,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])}(N.Component);I8(tS,"displayName","CartesianAxis");I8(tS,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var Vxt=["layout","type","stroke","connectNulls","isRange","ref"],Hxt=["key"],zde;function l0(e){"@babel/helpers - typeof";return l0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l0(e)}function Ude(e,t){if(e==null)return{};var n=Wxt(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Wxt(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function hm(){return hm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},hm.apply(this,arguments)}function OH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Hd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?OH(Object(n),!0).forEach(function(r){Qc(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Gxt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function DH(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Vde(r.key),r)}}function Kxt(e,t,n){return t&&DH(e.prototype,t),n&&DH(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Yxt(e,t,n){return t=lk(t),Xxt(e,qde()?Reflect.construct(t,n||[],lk(e).constructor):t.apply(e,n))}function Xxt(e,t){if(t&&(l0(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Qxt(e)}function Qxt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function qde(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(qde=function(){return!!e})()}function lk(e){return lk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},lk(e)}function Jxt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&zO(e,t)}function zO(e,t){return zO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},zO(e,t)}function Qc(e,t,n){return t=Vde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vde(e){var t=Zxt(e,"string");return l0(t)=="symbol"?t:t+""}function Zxt(e,t){if(l0(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(l0(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var vh=function(e){function t(){var n;Gxt(this,t);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return n=Yxt(this,t,[].concat(i)),Qc(n,"state",{isAnimationFinished:!0}),Qc(n,"id",G0("recharts-area-")),Qc(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),an(o)&&o()}),Qc(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),an(o)&&o()}),n}return Jxt(t,e),Kxt(t,[{key:"renderDots",value:function(r,i,a){var o=this.props.isAnimationActive,l=this.state.isAnimationFinished;if(o&&!l)return null;var c=this.props,u=c.dot,d=c.points,f=c.dataKey,h=qt(this.props,!1),p=qt(u,!0),x=d.map(function(b,w){var _=Hd(Hd(Hd({key:"dot-".concat(w),r:3},h),p),{},{index:w,cx:b.x,cy:b.y,dataKey:f,value:b.value,payload:b.payload,points:d});return t.renderDotItem(u,_)}),y={clipPath:r?"url(#clipPath-".concat(i?"":"dots-").concat(a,")"):null};return ee.createElement(Wn,hm({className:"recharts-area-dots"},y),x)}},{key:"renderHorizontalRect",value:function(r){var i=this.props,a=i.baseLine,o=i.points,l=i.strokeWidth,c=o[0].x,u=o[o.length-1].x,d=r*Math.abs(c-u),f=pf(o.map(function(h){return h.y||0}));return lt(a)&&typeof a=="number"?f=Math.max(a,f):a&&Array.isArray(a)&&a.length&&(f=Math.max(pf(a.map(function(h){return h.y||0})),f)),lt(f)?ee.createElement("rect",{x:c<u?c:c-d,y:0,width:d,height:Math.floor(f+(l?parseInt("".concat(l),10):1))}):null}},{key:"renderVerticalRect",value:function(r){var i=this.props,a=i.baseLine,o=i.points,l=i.strokeWidth,c=o[0].y,u=o[o.length-1].y,d=r*Math.abs(c-u),f=pf(o.map(function(h){return h.x||0}));return lt(a)&&typeof a=="number"?f=Math.max(a,f):a&&Array.isArray(a)&&a.length&&(f=Math.max(pf(a.map(function(h){return h.x||0})),f)),lt(f)?ee.createElement("rect",{x:0,y:c<u?c:c-d,width:f+(l?parseInt("".concat(l),10):1),height:Math.floor(d)}):null}},{key:"renderClipRect",value:function(r){var i=this.props.layout;return i==="vertical"?this.renderVerticalRect(r):this.renderHorizontalRect(r)}},{key:"renderAreaStatically",value:function(r,i,a,o){var l=this.props,c=l.layout,u=l.type,d=l.stroke,f=l.connectNulls,h=l.isRange;l.ref;var p=Ude(l,Vxt);return ee.createElement(Wn,{clipPath:a?"url(#clipPath-".concat(o,")"):null},ee.createElement(Zg,hm({},qt(p,!0),{points:r,connectNulls:f,type:u,baseLine:i,layout:c,stroke:"none",className:"recharts-area-area"})),d!=="none"&&ee.createElement(Zg,hm({},qt(this.props,!1),{className:"recharts-area-curve",layout:c,type:u,connectNulls:f,fill:"none",points:r})),d!=="none"&&h&&ee.createElement(Zg,hm({},qt(this.props,!1),{className:"recharts-area-curve",layout:c,type:u,connectNulls:f,fill:"none",points:i})))}},{key:"renderAreaWithAnimation",value:function(r,i){var a=this,o=this.props,l=o.points,c=o.baseLine,u=o.isAnimationActive,d=o.animationBegin,f=o.animationDuration,h=o.animationEasing,p=o.animationId,x=this.state,y=x.prevPoints,b=x.prevBaseLine;return ee.createElement(hu,{begin:d,duration:f,isActive:u,easing:h,from:{t:0},to:{t:1},key:"area-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(w){var _=w.t;if(y){var j=y.length/l.length,E=l.map(function(O,D){var R=Math.floor(D*j);if(y[R]){var L=y[R],M=co(L.x,O.x),B=co(L.y,O.y);return Hd(Hd({},O),{},{x:M(_),y:B(_)})}return O}),S;if(lt(c)&&typeof c=="number"){var T=co(b,c);S=T(_)}else if(mn(c)||W0(c)){var P=co(b,0);S=P(_)}else S=c.map(function(O,D){var R=Math.floor(D*j);if(b[R]){var L=b[R],M=co(L.x,O.x),B=co(L.y,O.y);return Hd(Hd({},O),{},{x:M(_),y:B(_)})}return O});return a.renderAreaStatically(E,S,r,i)}return ee.createElement(Wn,null,ee.createElement("defs",null,ee.createElement("clipPath",{id:"animationClipPath-".concat(i)},a.renderClipRect(_))),ee.createElement(Wn,{clipPath:"url(#animationClipPath-".concat(i,")")},a.renderAreaStatically(l,c,r,i)))})}},{key:"renderArea",value:function(r,i){var a=this.props,o=a.points,l=a.baseLine,c=a.isAnimationActive,u=this.state,d=u.prevPoints,f=u.prevBaseLine,h=u.totalLength;return c&&o&&o.length&&(!d&&h>0||!Yx(d,o)||!Yx(f,l))?this.renderAreaWithAnimation(r,i):this.renderAreaStatically(o,l,r,i)}},{key:"render",value:function(){var r,i=this.props,a=i.hide,o=i.dot,l=i.points,c=i.className,u=i.top,d=i.left,f=i.xAxis,h=i.yAxis,p=i.width,x=i.height,y=i.isAnimationActive,b=i.id;if(a||!l||!l.length)return null;var w=this.state.isAnimationFinished,_=l.length===1,j=hn("recharts-area",c),E=f&&f.allowDataOverflow,S=h&&h.allowDataOverflow,T=E||S,P=mn(b)?this.id:b,O=(r=qt(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},D=O.r,R=D===void 0?3:D,L=O.strokeWidth,M=L===void 0?2:L,B=eYe(o)?o:{},U=B.clipDot,F=U===void 0?!0:U,H=R*2+M;return ee.createElement(Wn,{className:j},E||S?ee.createElement("defs",null,ee.createElement("clipPath",{id:"clipPath-".concat(P)},ee.createElement("rect",{x:E?d:d-p/2,y:S?u:u-x/2,width:E?p:p*2,height:S?x:x*2})),!F&&ee.createElement("clipPath",{id:"clipPath-dots-".concat(P)},ee.createElement("rect",{x:d-H/2,y:u-H/2,width:p+H,height:x+H}))):null,_?null:this.renderArea(T,P),(o||_)&&this.renderDots(T,F,P),(!y||w)&&Yu.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:i.curPoints,prevBaseLine:i.curBaseLine}:r.points!==i.curPoints||r.baseLine!==i.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])}(N.PureComponent);zde=vh;Qc(vh,"displayName","Area");Qc(vh,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!wp.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});Qc(vh,"getBaseValue",function(e,t,n,r){var i=e.layout,a=e.baseValue,o=t.props.baseValue,l=o??a;if(lt(l)&&typeof l=="number")return l;var c=i==="horizontal"?r:n,u=c.scale.domain();if(c.type==="number"){var d=Math.max(u[0],u[1]),f=Math.min(u[0],u[1]);return l==="dataMin"?f:l==="dataMax"||d<0?d:Math.max(Math.min(u[0],u[1]),0)}return l==="dataMin"?u[0]:l==="dataMax"?u[1]:u[0]});Qc(vh,"getComposedData",function(e){var t=e.props,n=e.item,r=e.xAxis,i=e.yAxis,a=e.xAxisTicks,o=e.yAxisTicks,l=e.bandSize,c=e.dataKey,u=e.stackedData,d=e.dataStartIndex,f=e.displayedData,h=e.offset,p=t.layout,x=u&&u.length,y=zde.getBaseValue(t,n,r,i),b=p==="horizontal",w=!1,_=f.map(function(E,S){var T;x?T=u[d+S]:(T=Ei(E,c),Array.isArray(T)?w=!0:T=[y,T]);var P=T[1]==null||x&&Ei(E,c)==null;return b?{x:aV({axis:r,ticks:a,bandSize:l,entry:E,index:S}),y:P?null:i.scale(T[1]),value:T,payload:E}:{x:P?null:r.scale(T[1]),y:aV({axis:i,ticks:o,bandSize:l,entry:E,index:S}),value:T,payload:E}}),j;return x||w?j=_.map(function(E){var S=Array.isArray(E.value)?E.value[0]:null;return b?{x:E.x,y:S!=null&&E.y!=null?i.scale(S):null}:{x:S!=null?r.scale(S):null,y:E.y}}):j=b?i.scale(y):r.scale(y),Hd({points:_,baseLine:j,layout:p,isRange:w},h)});Qc(vh,"renderDotItem",function(e,t){var n;if(ee.isValidElement(e))n=ee.cloneElement(e,t);else if(an(e))n=e(t);else{var r=hn("recharts-area-dot",typeof e!="boolean"?e.className:""),i=t.key,a=Ude(t,Hxt);n=ee.createElement(UE,hm({},a,{key:i,className:r}))}return n});function c0(e){"@babel/helpers - typeof";return c0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c0(e)}function e0t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t0t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Gde(r.key),r)}}function n0t(e,t,n){return t&&t0t(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function r0t(e,t,n){return t=ck(t),s0t(e,Hde()?Reflect.construct(t,n||[],ck(e).constructor):t.apply(e,n))}function s0t(e,t){if(t&&(c0(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return i0t(e)}function i0t(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Hde(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Hde=function(){return!!e})()}function ck(e){return ck=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ck(e)}function a0t(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&UO(e,t)}function UO(e,t){return UO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},UO(e,t)}function Wde(e,t,n){return t=Gde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gde(e){var t=o0t(e,"string");return c0(t)=="symbol"?t:t+""}function o0t(e,t){if(c0(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(c0(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function qO(){return qO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qO.apply(this,arguments)}function l0t(e){var t=e.xAxisId,n=Tde(),r=Pde(),i=Sde(t);return i==null?null:N.createElement(tS,qO({},i,{className:hn("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(o){return fm(o,!0)}}))}var ey=function(e){function t(){return e0t(this,t),r0t(this,t,arguments)}return a0t(t,e),n0t(t,[{key:"render",value:function(){return N.createElement(l0t,this.props)}}])}(N.Component);Wde(ey,"displayName","XAxis");Wde(ey,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function u0(e){"@babel/helpers - typeof";return u0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u0(e)}function c0t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u0t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Xde(r.key),r)}}function d0t(e,t,n){return t&&u0t(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function f0t(e,t,n){return t=uk(t),h0t(e,Kde()?Reflect.construct(t,n||[],uk(e).constructor):t.apply(e,n))}function h0t(e,t){if(t&&(u0(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return m0t(e)}function m0t(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Kde(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Kde=function(){return!!e})()}function uk(e){return uk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},uk(e)}function p0t(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&VO(e,t)}function VO(e,t){return VO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},VO(e,t)}function Yde(e,t,n){return t=Xde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xde(e){var t=g0t(e,"string");return u0(t)=="symbol"?t:t+""}function g0t(e,t){if(u0(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(u0(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function HO(){return HO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},HO.apply(this,arguments)}var x0t=function(t){var n=t.yAxisId,r=Tde(),i=Pde(),a=Ade(n);return a==null?null:N.createElement(tS,HO({},a,{className:hn("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:r,height:i},ticksGenerator:function(l){return fm(l,!0)}}))},ty=function(e){function t(){return c0t(this,t),f0t(this,t,arguments)}return p0t(t,e),d0t(t,[{key:"render",value:function(){return N.createElement(x0t,this.props)}}])}(N.Component);Yde(ty,"displayName","YAxis");Yde(ty,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function IH(e){return w0t(e)||b0t(e)||v0t(e)||y0t()}function y0t(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1432In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v0t(e,t){if(e){if(typeof e=="string")return WO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return WO(e,t)}}function b0t(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function w0t(e){if(Array.isArray(e))return WO(e)}function WO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var GO=function(t,n,r,i,a){var o=Pl(t,XE),l=Pl(t,JE),c=[].concat(IH(o),IH(l)),u=Pl(t,eS),d="".concat(i,"Id"),f=i[0],h=n;if(c.length&&(h=c.reduce(function(y,b){if(b.props[d]===r&&ou(b.props,"extendDomain")&&lt(b.props[f])){var w=b.props[f];return[Math.min(y[0],w),Math.max(y[1],w)]}return y},h)),u.length){var p="".concat(f,"1"),x="".concat(f,"2");h=u.reduce(function(y,b){if(b.props[d]===r&&ou(b.props,"extendDomain")&&lt(b.props[p])&&lt(b.props[x])){var w=b.props[p],_=b.props[x];return[Math.min(y[0],w,_),Math.max(y[1],w,_)]}return y},h)}return a&&a.length&&(h=a.reduce(function(y,b){return lt(b)?[Math.min(y[0],b),Math.max(y[1],b)]:y},h)),h},Qde={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function a(c,u,d,f,h){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new i(d,f||c,h),x=n?n+u:u;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],p]:c._events[x].push(p):(c._events[x]=p,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var h=0,p=f.length,x=new Array(p);h<p;h++)x[h]=f[h].fn;return x},l.prototype.listenerCount=function(u){var d=n?n+u:u,f=this._events[d];return f?f.fn?1:f.length:0},l.prototype.emit=function(u,d,f,h,p,x){var y=n?n+u:u;if(!this._events[y])return!1;var b=this._events[y],w=arguments.length,_,j;if(b.fn){switch(b.once&&this.removeListener(u,b.fn,void 0,!0),w){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,d),!0;case 3:return b.fn.call(b.context,d,f),!0;case 4:return b.fn.call(b.context,d,f,h),!0;case 5:return b.fn.call(b.context,d,f,h,p),!0;case 6:return b.fn.call(b.context,d,f,h,p,x),!0}for(j=1,_=new Array(w-1);j<w;j++)_[j-1]=arguments[j];b.fn.apply(b.context,_)}else{var E=b.length,S;for(j=0;j<E;j++)switch(b[j].once&&this.removeListener(u,b[j].fn,void 0,!0),w){case 1:b[j].fn.call(b[j].context);break;case 2:b[j].fn.call(b[j].context,d);break;case 3:b[j].fn.call(b[j].context,d,f);break;case 4:b[j].fn.call(b[j].context,d,f,h);break;default:if(!_)for(S=1,_=new Array(w-1);S<w;S++)_[S-1]=arguments[S];b[j].fn.apply(b[j].context,_)}}return!0},l.prototype.on=function(u,d,f){return a(this,u,d,f,!1)},l.prototype.once=function(u,d,f){return a(this,u,d,f,!0)},l.prototype.removeListener=function(u,d,f,h){var p=n?n+u:u;if(!this._events[p])return this;if(!d)return o(this,p),this;var x=this._events[p];if(x.fn)x.fn===d&&(!h||x.once)&&(!f||x.context===f)&&o(this,p);else{for(var y=0,b=[],w=x.length;y<w;y++)(x[y].fn!==d||h&&!x[y].once||f&&x[y].context!==f)&&b.push(x[y]);b.length?this._events[p]=b.length===1?b[0]:b:o(this,p)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&o(this,d)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l})(Qde);var _0t=Qde.exports;const j0t=dr(_0t);var s3=new j0t,i3="recharts.syncMouseEvents";function fb(e){"@babel/helpers - typeof";return fb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fb(e)}function N0t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k0t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Jde(r.key),r)}}function C0t(e,t,n){return t&&k0t(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function a3(e,t,n){return t=Jde(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jde(e){var t=E0t(e,"string");return fb(t)=="symbol"?t:t+""}function E0t(e,t){if(fb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(fb(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var S0t=function(){function e(){N0t(this,e),a3(this,"activeIndex",0),a3(this,"coordinateList",[]),a3(this,"layout","horizontal")}return C0t(e,[{key:"setDetails",value:function(n){var r,i=n.coordinateList,a=i===void 0?null:i,o=n.container,l=o===void 0?null:o,c=n.layout,u=c===void 0?null:c,d=n.offset,f=d===void 0?null:d,h=n.mouseHandlerCallback,p=h===void 0?null:h;this.coordinateList=(r=a??this.coordinateList)!==null&&r!==void 0?r:[],this.container=l??this.container,this.layout=u??this.layout,this.offset=f??this.offset,this.mouseHandlerCallback=p??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(n){if(this.coordinateList.length!==0)switch(n.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(n){this.activeIndex=n}},{key:"spoofMouse",value:function(){var n,r;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var i=this.container.getBoundingClientRect(),a=i.x,o=i.y,l=i.height,c=this.coordinateList[this.activeIndex].coordinate,u=((n=window)===null||n===void 0?void 0:n.scrollX)||0,d=((r=window)===null||r===void 0?void 0:r.scrollY)||0,f=a+c+u,h=o+this.offset.top+l/2+d;this.mouseHandlerCallback({pageX:f,pageY:h})}}}])}();function A0t(e,t,n){if(n==="number"&&t===!0&&Array.isArray(e)){var r=e==null?void 0:e[0],i=e==null?void 0:e[1];if(r&&i&&lt(r)&&lt(i))return!0}return!1}function T0t(e,t,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-i,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function Zde(e){var t=e.cx,n=e.cy,r=e.radius,i=e.startAngle,a=e.endAngle,o=Zr(t,n,r,i),l=Zr(t,n,r,a);return{points:[o,l],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}function P0t(e,t,n){var r,i,a,o;if(e==="horizontal")r=t.x,a=r,i=n.top,o=n.top+n.height;else if(e==="vertical")i=t.y,o=i,r=n.left,a=n.left+n.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var l=t.cx,c=t.cy,u=t.innerRadius,d=t.outerRadius,f=t.angle,h=Zr(l,c,u,f),p=Zr(l,c,d,f);r=h.x,i=h.y,a=p.x,o=p.y}else return Zde(t);return[{x:r,y:i},{x:a,y:o}]}function hb(e){"@babel/helpers - typeof";return hb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hb(e)}function RH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function $_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?RH(Object(n),!0).forEach(function(r){O0t(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):RH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function O0t(e,t,n){return t=D0t(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D0t(e){var t=I0t(e,"string");return hb(t)=="symbol"?t:t+""}function I0t(e,t){if(hb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(hb(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function R0t(e){var t,n,r=e.element,i=e.tooltipEventType,a=e.isActive,o=e.activeCoordinate,l=e.activePayload,c=e.offset,u=e.activeTooltipIndex,d=e.tooltipAxisBandSize,f=e.layout,h=e.chartName,p=(t=r.props.cursor)!==null&&t!==void 0?t:(n=r.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!r||!p||!a||!o||h!=="ScatterChart"&&i!=="axis")return null;var x,y=Zg;if(h==="ScatterChart")x=o,y=Iht;else if(h==="BarChart")x=T0t(f,o,c,d),y=P8;else if(f==="radial"){var b=Zde(o),w=b.cx,_=b.cy,j=b.radius,E=b.startAngle,S=b.endAngle;x={cx:w,cy:_,startAngle:E,endAngle:S,innerRadius:j,outerRadius:j},y=Gue}else x={points:P0t(f,o,c)},y=Zg;var T=$_($_($_($_({stroke:"#ccc",pointerEvents:"none"},c),x),qt(p,!1)),{},{payload:l,payloadIndex:u,className:hn("recharts-tooltip-cursor",p.className)});return N.isValidElement(p)?N.cloneElement(p,T):N.createElement(y,T)}var M0t=["item"],L0t=["children","className","width","height","style","compact","title","desc"];function d0(e){"@babel/helpers - typeof";return d0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d0(e)}function Pg(){return Pg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Pg.apply(this,arguments)}function MH(e,t){return B0t(e)||$0t(e,t)||tfe(e,t)||F0t()}function F0t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1433In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $0t(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return l}}function B0t(e){if(Array.isArray(e))return e}function LH(e,t){if(e==null)return{};var n=z0t(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function z0t(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function U0t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function q0t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,nfe(r.key),r)}}function V0t(e,t,n){return t&&q0t(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function H0t(e,t,n){return t=dk(t),W0t(e,efe()?Reflect.construct(t,n||[],dk(e).constructor):t.apply(e,n))}function W0t(e,t){if(t&&(d0(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return G0t(e)}function G0t(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function efe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(efe=function(){return!!e})()}function dk(e){return dk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},dk(e)}function K0t(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&KO(e,t)}function KO(e,t){return KO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},KO(e,t)}function f0(e){return Q0t(e)||X0t(e)||tfe(e)||Y0t()}function Y0t(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1434In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tfe(e,t){if(e){if(typeof e=="string")return YO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return YO(e,t)}}function X0t(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Q0t(e){if(Array.isArray(e))return YO(e)}function YO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function FH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ze(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?FH(Object(n),!0).forEach(function(r){Gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Gt(e,t,n){return t=nfe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nfe(e){var t=J0t(e,"string");return d0(t)=="symbol"?t:t+""}function J0t(e,t){if(d0(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(d0(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Z0t={xAxis:["bottom","top"],yAxis:["left","right"]},eyt={width:"100%",height:"100%"},rfe={x:0,y:0};function B_(e){return e}var tyt=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},nyt=function(t,n,r,i){var a=n.find(function(d){return d&&d.index===r});if(a){if(t==="horizontal")return{x:a.coordinate,y:i.y};if(t==="vertical")return{x:i.x,y:a.coordinate};if(t==="centric"){var o=a.coordinate,l=i.radius;return ze(ze(ze({},i),Zr(i.cx,i.cy,l,o)),{},{angle:o,radius:l})}var c=a.coordinate,u=i.angle;return ze(ze(ze({},i),Zr(i.cx,i.cy,c,u)),{},{angle:u,radius:c})}return rfe},nS=function(t,n){var r=n.graphicalItems,i=n.dataStartIndex,a=n.dataEndIndex,o=(r??[]).reduce(function(l,c){var u=c.props.data;return u&&u.length?[].concat(f0(l),f0(u)):l},[]);return o.length>0?o:t&&t.length&&lt(i)&&lt(a)?t.slice(i,a+1):[]};function sfe(e){return e==="number"?[0,"auto"]:void 0}var XO=function(t,n,r,i){var a=t.graphicalItems,o=t.tooltipAxis,l=nS(n,t);return r<0||!a||!a.length||r>=l.length?null:a.reduce(function(c,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:n;f&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(f=f.slice(t.dataStartIndex,t.dataEndIndex+1));var h;if(o.dataKey&&!o.allowDuplicatedCategory){var p=f===void 0?l:f;h=fN(p,o.dataKey,i)}else h=f&&f[r]||l[r];return h?[].concat(f0(c),[zue(u,h)]):c},[])},$H=function(t,n,r,i){var a=i||{x:t.chartX,y:t.chartY},o=tyt(a,r),l=t.orderedTooltipTicks,c=t.tooltipAxis,u=t.tooltipTicks,d=sut(o,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,h=XO(t,n,d,f),p=nyt(r,l,d,a);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},ryt=function(t,n){var r=n.axes,i=n.graphicalItems,a=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.layout,f=t.children,h=t.stackOffset,p=Mue(d,a);return r.reduce(function(x,y){var b,w=y.type.defaultProps!==void 0?ze(ze({},y.type.defaultProps),y.props):y.props,_=w.type,j=w.dataKey,E=w.allowDataOverflow,S=w.allowDuplicatedCategory,T=w.scale,P=w.ticks,O=w.includeHidden,D=w[o];if(x[D])return x;var R=nS(t.data,{graphicalItems:i.filter(function(J){var Y,Z=o in J.props?J.props[o]:(Y=J.type.defaultProps)===null||Y===void 0?void 0:Y[o];return Z===D}),dataStartIndex:c,dataEndIndex:u}),L=R.length,M,B,U;A0t(w.domain,E,_)&&(M=dO(w.domain,null,E),p&&(_==="number"||T!=="auto")&&(U=Lv(R,j,"category")));var F=sfe(_);if(!M||M.length===0){var H,z=(H=w.domain)!==null&&H!==void 0?H:F;if(j){if(M=Lv(R,j,_),_==="category"&&p){var K=VKe(M);S&&K?(B=M,M=JN(0,L)):S||(M=uV(z,M,y).reduce(function(J,Y){return J.indexOf(Y)>=0?J:[].concat(f0(J),[Y])},[]))}else if(_==="category")S?M=M.filter(function(J){return J!==""&&!mn(J)}):M=uV(z,M,y).reduce(function(J,Y){return J.indexOf(Y)>=0||Y===""||mn(Y)?J:[].concat(f0(J),[Y])},[]);else if(_==="number"){var W=cut(R,i.filter(function(J){var Y,Z,G=o in J.props?J.props[o]:(Y=J.type.defaultProps)===null||Y===void 0?void 0:Y[o],se="hide"in J.props?J.props.hide:(Z=J.type.defaultProps)===null||Z===void 0?void 0:Z.hide;return G===D&&(O||!se)}),j,a,d);W&&(M=W)}p&&(_==="number"||T!=="auto")&&(U=Lv(R,j,"category"))}else p?M=JN(0,L):l&&l[D]&&l[D].hasStack&&_==="number"?M=h==="expand"?[0,1]:Bue(l[D].stackGroups,c,u):M=Rue(R,i.filter(function(J){var Y=o in J.props?J.props[o]:J.type.defaultProps[o],Z="hide"in J.props?J.props.hide:J.type.defaultProps.hide;return Y===D&&(O||!Z)}),_,d,!0);if(_==="number")M=GO(f,M,D,a,P),z&&(M=dO(z,M,E));else if(_==="category"&&z){var q=z,oe=M.every(function(J){return q.indexOf(J)>=0});oe&&(M=q)}}return ze(ze({},x),{},Gt({},D,ze(ze({},w),{},{axisType:a,domain:M,categoricalDomain:U,duplicateDomain:B,originalDomain:(b=w.domain)!==null&&b!==void 0?b:F,isCategorical:p,layout:d})))},{})},syt=function(t,n){var r=n.graphicalItems,i=n.Axis,a=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.layout,f=t.children,h=nS(t.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:u}),p=h.length,x=Mue(d,a),y=-1;return r.reduce(function(b,w){var _=w.type.defaultProps!==void 0?ze(ze({},w.type.defaultProps),w.props):w.props,j=_[o],E=sfe("number");if(!b[j]){y++;var S;return x?S=JN(0,p):l&&l[j]&&l[j].hasStack?(S=Bue(l[j].stackGroups,c,u),S=GO(f,S,j,a)):(S=dO(E,Rue(h,r.filter(function(T){var P,O,D=o in T.props?T.props[o]:(P=T.type.defaultProps)===null||P===void 0?void 0:P[o],R="hide"in T.props?T.props.hide:(O=T.type.defaultProps)===null||O===void 0?void 0:O.hide;return D===j&&!R}),"number",d),i.defaultProps.allowDataOverflow),S=GO(f,S,j,a)),ze(ze({},b),{},Gt({},j,ze(ze({axisType:a},i.defaultProps),{},{hide:!0,orientation:Wo(Z0t,"".concat(a,".").concat(y%2),null),domain:S,originalDomain:E,isCategorical:x,layout:d})))}return b},{})},iyt=function(t,n){var r=n.axisType,i=r===void 0?"xAxis":r,a=n.AxisComp,o=n.graphicalItems,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.children,f="".concat(i,"Id"),h=Pl(d,a),p={};return h&&h.length?p=ryt(t,{axes:h,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):o&&o.length&&(p=syt(t,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),p},ayt=function(t){var n=ag(t),r=fm(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:s8(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:BN(n,r)}},BH=function(t){var n=t.children,r=t.defaultShowTooltip,i=Do(n,n0),a=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!r}},oyt=function(t){return!t||!t.length?!1:t.some(function(n){var r=Wu(n&&n.type);return r&&r.indexOf("Bar")>=0})},zH=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},lyt=function(t,n){var r=t.props,i=t.graphicalItems,a=t.xAxisMap,o=a===void 0?{}:a,l=t.yAxisMap,c=l===void 0?{}:l,u=r.width,d=r.height,f=r.children,h=r.margin||{},p=Do(f,n0),x=Do(f,Xg),y=Object.keys(c).reduce(function(S,T){var P=c[T],O=P.orientation;return!P.mirror&&!P.hide?ze(ze({},S),{},Gt({},O,S[O]+P.width)):S},{left:h.left||0,right:h.right||0}),b=Object.keys(o).reduce(function(S,T){var P=o[T],O=P.orientation;return!P.mirror&&!P.hide?ze(ze({},S),{},Gt({},O,Wo(S,"".concat(O))+P.height)):S},{top:h.top||0,bottom:h.bottom||0}),w=ze(ze({},b),y),_=w.bottom;p&&(w.bottom+=p.props.height||n0.defaultProps.height),x&&n&&(w=out(w,i,r,n));var j=u-w.left-w.right,E=d-w.top-w.bottom;return ze(ze({brushBottom:_},w),{},{width:Math.max(j,0),height:Math.max(E,0)})},cyt=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},R8=function(t){var n=t.chartName,r=t.GraphicalChild,i=t.defaultTooltipEventType,a=i===void 0?"axis":i,o=t.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=t.axisComponents,u=t.legendContent,d=t.formatAxisMap,f=t.defaultProps,h=function(w,_){var j=_.graphicalItems,E=_.stackGroups,S=_.offset,T=_.updateId,P=_.dataStartIndex,O=_.dataEndIndex,D=w.barSize,R=w.layout,L=w.barGap,M=w.barCategoryGap,B=w.maxBarSize,U=zH(R),F=U.numericAxisName,H=U.cateAxisName,z=oyt(j),K=[];return j.forEach(function(W,q){var oe=nS(w.data,{graphicalItems:[W],dataStartIndex:P,dataEndIndex:O}),J=W.type.defaultProps!==void 0?ze(ze({},W.type.defaultProps),W.props):W.props,Y=J.dataKey,Z=J.maxBarSize,G=J["".concat(F,"Id")],se=J["".concat(H,"Id")],ce={},le=c.reduce(function(me,ke){var Be=_["".concat(ke.axisType,"Map")],Ae=J["".concat(ke.axisType,"Id")];Be&&Be[Ae]||ke.axisType==="zAxis"||op();var $e=Be[Ae];return ze(ze({},me),{},Gt(Gt({},ke.axisType,$e),"".concat(ke.axisType,"Ticks"),fm($e)))},ce),fe=le[H],be=le["".concat(H,"Ticks")],_e=E&&E[G]&&E[G].hasStack&&yut(W,E[G].stackGroups),pe=Wu(W.type).indexOf("Bar")>=0,Te=BN(fe,be),Ge=[],Ne=z&&iut({barSize:D,stackGroups:E,totalSize:cyt(le,H)});if(pe){var it,qe,Qe=mn(Z)?B:Z,ot=(it=(qe=BN(fe,be,!0))!==null&&qe!==void 0?qe:Qe)!==null&&it!==void 0?it:0;Ge=aut({barGap:L,barCategoryGap:M,bandSize:ot!==Te?ot:Te,sizeList:Ne[se],maxBarSize:Qe}),ot!==Te&&(Ge=Ge.map(function(me){return ze(ze({},me),{},{position:ze(ze({},me.position),{},{offset:me.position.offset-ot/2})})}))}var de=W&&W.type&&W.type.getComposedData;de&&K.push({props:ze(ze({},de(ze(ze({},le),{},{displayedData:oe,props:w,dataKey:Y,item:W,bandSize:Te,barPosition:Ge,offset:S,stackedData:_e,layout:R,dataStartIndex:P,dataEndIndex:O}))),{},Gt(Gt(Gt({key:W.key||"item-".concat(q)},F,le[F]),H,le[H]),"animationId",T)),childIndex:rYe(W,w.children),item:W})}),K},p=function(w,_){var j=w.props,E=w.dataStartIndex,S=w.dataEndIndex,T=w.updateId;if(!rU({props:j}))return null;var P=j.children,O=j.layout,D=j.stackOffset,R=j.data,L=j.reverseStackOrder,M=zH(O),B=M.numericAxisName,U=M.cateAxisName,F=Pl(P,r),H=gut(R,F,"".concat(B,"Id"),"".concat(U,"Id"),D,L),z=c.reduce(function(J,Y){var Z="".concat(Y.axisType,"Map");return ze(ze({},J),{},Gt({},Z,iyt(j,ze(ze({},Y),{},{graphicalItems:F,stackGroups:Y.axisType===B&&H,dataStartIndex:E,dataEndIndex:S}))))},{}),K=lyt(ze(ze({},z),{},{props:j,graphicalItems:F}),_==null?void 0:_.legendBBox);Object.keys(z).forEach(function(J){z[J]=d(j,z[J],K,J.replace("Map",""),n)});var W=z["".concat(U,"Map")],q=ayt(W),oe=h(j,ze(ze({},z),{},{dataStartIndex:E,dataEndIndex:S,updateId:T,graphicalItems:F,stackGroups:H,offset:K}));return ze(ze({formattedGraphicalItems:oe,graphicalItems:F,offset:K,stackGroups:H},q),z)},x=function(b){function w(_){var j,E,S;return U0t(this,w),S=H0t(this,w,[_]),Gt(S,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Gt(S,"accessibilityManager",new S0t),Gt(S,"handleLegendBBoxUpdate",function(T){if(T){var P=S.state,O=P.dataStartIndex,D=P.dataEndIndex,R=P.updateId;S.setState(ze({legendBBox:T},p({props:S.props,dataStartIndex:O,dataEndIndex:D,updateId:R},ze(ze({},S.state),{},{legendBBox:T}))))}}),Gt(S,"handleReceiveSyncEvent",function(T,P,O){if(S.props.syncId===T){if(O===S.eventEmitterSymbol&&typeof S.props.syncMethod!="function")return;S.applySyncEvent(P)}}),Gt(S,"handleBrushChange",function(T){var P=T.startIndex,O=T.endIndex;if(P!==S.state.dataStartIndex||O!==S.state.dataEndIndex){var D=S.state.updateId;S.setState(function(){return ze({dataStartIndex:P,dataEndIndex:O},p({props:S.props,dataStartIndex:P,dataEndIndex:O,updateId:D},S.state))}),S.triggerSyncEvent({dataStartIndex:P,dataEndIndex:O})}}),Gt(S,"handleMouseEnter",function(T){var P=S.getMouseInfo(T);if(P){var O=ze(ze({},P),{},{isTooltipActive:!0});S.setState(O),S.triggerSyncEvent(O);var D=S.props.onMouseEnter;an(D)&&D(O,T)}}),Gt(S,"triggeredAfterMouseMove",function(T){var P=S.getMouseInfo(T),O=P?ze(ze({},P),{},{isTooltipActive:!0}):{isTooltipActive:!1};S.setState(O),S.triggerSyncEvent(O);var D=S.props.onMouseMove;an(D)&&D(O,T)}),Gt(S,"handleItemMouseEnter",function(T){S.setState(function(){return{isTooltipActive:!0,activeItem:T,activePayload:T.tooltipPayload,activeCoordinate:T.tooltipPosition||{x:T.cx,y:T.cy}}})}),Gt(S,"handleItemMouseLeave",function(){S.setState(function(){return{isTooltipActive:!1}})}),Gt(S,"handleMouseMove",function(T){T.persist(),S.throttleTriggeredAfterMouseMove(T)}),Gt(S,"handleMouseLeave",function(T){S.throttleTriggeredAfterMouseMove.cancel();var P={isTooltipActive:!1};S.setState(P),S.triggerSyncEvent(P);var O=S.props.onMouseLeave;an(O)&&O(P,T)}),Gt(S,"handleOuterEvent",function(T){var P=nYe(T),O=Wo(S.props,"".concat(P));if(P&&an(O)){var D,R;/.*touch.*/i.test(P)?R=S.getMouseInfo(T.changedTouches[0]):R=S.getMouseInfo(T),O((D=R)!==null&&D!==void 0?D:{},T)}}),Gt(S,"handleClick",function(T){var P=S.getMouseInfo(T);if(P){var O=ze(ze({},P),{},{isTooltipActive:!0});S.setState(O),S.triggerSyncEvent(O);var D=S.props.onClick;an(D)&&D(O,T)}}),Gt(S,"handleMouseDown",function(T){var P=S.props.onMouseDown;if(an(P)){var O=S.getMouseInfo(T);P(O,T)}}),Gt(S,"handleMouseUp",function(T){var P=S.props.onMouseUp;if(an(P)){var O=S.getMouseInfo(T);P(O,T)}}),Gt(S,"handleTouchMove",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&S.throttleTriggeredAfterMouseMove(T.changedTouches[0])}),Gt(S,"handleTouchStart",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&S.handleMouseDown(T.changedTouches[0])}),Gt(S,"handleTouchEnd",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&S.handleMouseUp(T.changedTouches[0])}),Gt(S,"handleDoubleClick",function(T){var P=S.props.onDoubleClick;if(an(P)){var O=S.getMouseInfo(T);P(O,T)}}),Gt(S,"handleContextMenu",function(T){var P=S.props.onContextMenu;if(an(P)){var O=S.getMouseInfo(T);P(O,T)}}),Gt(S,"triggerSyncEvent",function(T){S.props.syncId!==void 0&&s3.emit(i3,S.props.syncId,T,S.eventEmitterSymbol)}),Gt(S,"applySyncEvent",function(T){var P=S.props,O=P.layout,D=P.syncMethod,R=S.state.updateId,L=T.dataStartIndex,M=T.dataEndIndex;if(T.dataStartIndex!==void 0||T.dataEndIndex!==void 0)S.setState(ze({dataStartIndex:L,dataEndIndex:M},p({props:S.props,dataStartIndex:L,dataEndIndex:M,updateId:R},S.state)));else if(T.activeTooltipIndex!==void 0){var B=T.chartX,U=T.chartY,F=T.activeTooltipIndex,H=S.state,z=H.offset,K=H.tooltipTicks;if(!z)return;if(typeof D=="function")F=D(K,T);else if(D==="value"){F=-1;for(var W=0;W<K.length;W++)if(K[W].value===T.activeLabel){F=W;break}}var q=ze(ze({},z),{},{x:z.left,y:z.top}),oe=Math.min(B,q.x+q.width),J=Math.min(U,q.y+q.height),Y=K[F]&&K[F].value,Z=XO(S.state,S.props.data,F),G=K[F]?{x:O==="horizontal"?K[F].coordinate:oe,y:O==="horizontal"?J:K[F].coordinate}:rfe;S.setState(ze(ze({},T),{},{activeLabel:Y,activeCoordinate:G,activePayload:Z,activeTooltipIndex:F}))}else S.setState(T)}),Gt(S,"renderCursor",function(T){var P,O=S.state,D=O.isTooltipActive,R=O.activeCoordinate,L=O.activePayload,M=O.offset,B=O.activeTooltipIndex,U=O.tooltipAxisBandSize,F=S.getTooltipEventType(),H=(P=T.props.active)!==null&&P!==void 0?P:D,z=S.props.layout,K=T.key||"_recharts-cursor";return ee.createElement(R0t,{key:K,activeCoordinate:R,activePayload:L,activeTooltipIndex:B,chartName:n,element:T,isActive:H,layout:z,offset:M,tooltipAxisBandSize:U,tooltipEventType:F})}),Gt(S,"renderPolarAxis",function(T,P,O){var D=Wo(T,"type.axisType"),R=Wo(S.state,"".concat(D,"Map")),L=T.type.defaultProps,M=L!==void 0?ze(ze({},L),T.props):T.props,B=R&&R[M["".concat(D,"Id")]];return N.cloneElement(T,ze(ze({},B),{},{className:hn(D,B.className),key:T.key||"".concat(P,"-").concat(O),ticks:fm(B,!0)}))}),Gt(S,"renderPolarGrid",function(T){var P=T.props,O=P.radialLines,D=P.polarAngles,R=P.polarRadius,L=S.state,M=L.radiusAxisMap,B=L.angleAxisMap,U=ag(M),F=ag(B),H=F.cx,z=F.cy,K=F.innerRadius,W=F.outerRadius;return N.cloneElement(T,{polarAngles:Array.isArray(D)?D:fm(F,!0).map(function(q){return q.coordinate}),polarRadius:Array.isArray(R)?R:fm(U,!0).map(function(q){return q.coordinate}),cx:H,cy:z,innerRadius:K,outerRadius:W,key:T.key||"polar-grid",radialLines:O})}),Gt(S,"renderLegend",function(){var T=S.state.formattedGraphicalItems,P=S.props,O=P.children,D=P.width,R=P.height,L=S.props.margin||{},M=D-(L.left||0)-(L.right||0),B=Due({children:O,formattedGraphicalItems:T,legendWidth:M,legendContent:u});if(!B)return null;var U=B.item,F=LH(B,M0t);return N.cloneElement(U,ze(ze({},F),{},{chartWidth:D,chartHeight:R,margin:L,onBBoxUpdate:S.handleLegendBBoxUpdate}))}),Gt(S,"renderTooltip",function(){var T,P=S.props,O=P.children,D=P.accessibilityLayer,R=Do(O,sc);if(!R)return null;var L=S.state,M=L.isTooltipActive,B=L.activeCoordinate,U=L.activePayload,F=L.activeLabel,H=L.offset,z=(T=R.props.active)!==null&&T!==void 0?T:M;return N.cloneElement(R,{viewBox:ze(ze({},H),{},{x:H.left,y:H.top}),active:z,label:F,payload:z?U:[],coordinate:B,accessibilityLayer:D})}),Gt(S,"renderBrush",function(T){var P=S.props,O=P.margin,D=P.data,R=S.state,L=R.offset,M=R.dataStartIndex,B=R.dataEndIndex,U=R.updateId;return N.cloneElement(T,{key:T.key||"_recharts-brush",onChange:R_(S.handleBrushChange,T.props.onChange),data:D,x:lt(T.props.x)?T.props.x:L.left,y:lt(T.props.y)?T.props.y:L.top+L.height+L.brushBottom-(O.bottom||0),width:lt(T.props.width)?T.props.width:L.width,startIndex:M,endIndex:B,updateId:"brush-".concat(U)})}),Gt(S,"renderReferenceElement",function(T,P,O){if(!T)return null;var D=S,R=D.clipPathId,L=S.state,M=L.xAxisMap,B=L.yAxisMap,U=L.offset,F=T.type.defaultProps||{},H=T.props,z=H.xAxisId,K=z===void 0?F.xAxisId:z,W=H.yAxisId,q=W===void 0?F.yAxisId:W;return N.cloneElement(T,{key:T.key||"".concat(P,"-").concat(O),xAxis:M[K],yAxis:B[q],viewBox:{x:U.left,y:U.top,width:U.width,height:U.height},clipPathId:R})}),Gt(S,"renderActivePoints",function(T){var P=T.item,O=T.activePoint,D=T.basePoint,R=T.childIndex,L=T.isRange,M=[],B=P.props.key,U=P.item.type.defaultProps!==void 0?ze(ze({},P.item.type.defaultProps),P.item.props):P.item.props,F=U.activeDot,H=U.dataKey,z=ze(ze({index:R,dataKey:H,cx:O.x,cy:O.y,r:4,fill:T8(P.item),strokeWidth:2,stroke:"#fff",payload:O.payload,value:O.value},qt(F,!1)),hN(F));return M.push(w.renderActiveDot(F,z,"".concat(B,"-activePoint-").concat(R))),D?M.push(w.renderActiveDot(F,ze(ze({},z),{},{cx:D.x,cy:D.y}),"".concat(B,"-basePoint-").concat(R))):L&&M.push(null),M}),Gt(S,"renderGraphicChild",function(T,P,O){var D=S.filterFormatItem(T,P,O);if(!D)return null;var R=S.getTooltipEventType(),L=S.state,M=L.isTooltipActive,B=L.tooltipAxis,U=L.activeTooltipIndex,F=L.activeLabel,H=S.props.children,z=Do(H,sc),K=D.props,W=K.points,q=K.isRange,oe=K.baseLine,J=D.item.type.defaultProps!==void 0?ze(ze({},D.item.type.defaultProps),D.item.props):D.item.props,Y=J.activeDot,Z=J.hide,G=J.activeBar,se=J.activeShape,ce=!!(!Z&&M&&z&&(Y||G||se)),le={};R!=="axis"&&z&&z.props.trigger==="click"?le={onClick:R_(S.handleItemMouseEnter,T.props.onClick)}:R!=="axis"&&(le={onMouseLeave:R_(S.handleItemMouseLeave,T.props.onMouseLeave),onMouseEnter:R_(S.handleItemMouseEnter,T.props.onMouseEnter)});var fe=N.cloneElement(T,ze(ze({},D.props),le));function be(ke){return typeof B.dataKey=="function"?B.dataKey(ke.payload):null}if(ce)if(U>=0){var _e,pe;if(B.dataKey&&!B.allowDuplicatedCategory){var Te=typeof B.dataKey=="function"?be:"payload.".concat(B.dataKey.toString());_e=fN(W,Te,F),pe=q&&oe&&fN(oe,Te,F)}else _e=W==null?void 0:W[U],pe=q&&oe&&oe[U];if(se||G){var Ge=T.props.activeIndex!==void 0?T.props.activeIndex:U;return[N.cloneElement(T,ze(ze(ze({},D.props),le),{},{activeIndex:Ge})),null,null]}if(!mn(_e))return[fe].concat(f0(S.renderActivePoints({item:D,activePoint:_e,basePoint:pe,childIndex:U,isRange:q})))}else{var Ne,it=(Ne=S.getItemByXY(S.state.activeCoordinate))!==null&&Ne!==void 0?Ne:{graphicalItem:fe},qe=it.graphicalItem,Qe=qe.item,ot=Qe===void 0?T:Qe,de=qe.childIndex,me=ze(ze(ze({},D.props),le),{},{activeIndex:de});return[N.cloneElement(ot,me),null,null]}return q?[fe,null,null]:[fe,null]}),Gt(S,"renderCustomized",function(T,P,O){return N.cloneElement(T,ze(ze({key:"recharts-customized-".concat(O)},S.props),S.state))}),Gt(S,"renderMap",{CartesianGrid:{handler:B_,once:!0},ReferenceArea:{handler:S.renderReferenceElement},ReferenceLine:{handler:B_},ReferenceDot:{handler:S.renderReferenceElement},XAxis:{handler:B_},YAxis:{handler:B_},Brush:{handler:S.renderBrush,once:!0},Bar:{handler:S.renderGraphicChild},Line:{handler:S.renderGraphicChild},Area:{handler:S.renderGraphicChild},Radar:{handler:S.renderGraphicChild},RadialBar:{handler:S.renderGraphicChild},Scatter:{handler:S.renderGraphicChild},Pie:{handler:S.renderGraphicChild},Funnel:{handler:S.renderGraphicChild},Tooltip:{handler:S.renderCursor,once:!0},PolarGrid:{handler:S.renderPolarGrid,once:!0},PolarAngleAxis:{handler:S.renderPolarAxis},PolarRadiusAxis:{handler:S.renderPolarAxis},Customized:{handler:S.renderCustomized}}),S.clipPathId="".concat((j=_.id)!==null&&j!==void 0?j:G0("recharts"),"-clip"),S.throttleTriggeredAfterMouseMove=Oce(S.triggeredAfterMouseMove,(E=_.throttleDelay)!==null&&E!==void 0?E:1e3/60),S.state={},S}return K0t(w,b),V0t(w,[{key:"componentDidMount",value:function(){var j,E;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(j=this.props.margin.left)!==null&&j!==void 0?j:0,top:(E=this.props.margin.top)!==null&&E!==void 0?E:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var j=this.props,E=j.children,S=j.data,T=j.height,P=j.layout,O=Do(E,sc);if(O){var D=O.props.defaultIndex;if(!(typeof D!="number"||D<0||D>this.state.tooltipTicks.length-1)){var R=this.state.tooltipTicks[D]&&this.state.tooltipTicks[D].value,L=XO(this.state,S,D,R),M=this.state.tooltipTicks[D].coordinate,B=(this.state.offset.top+T)/2,U=P==="horizontal",F=U?{x:M,y:B}:{y:M,x:B},H=this.state.formattedGraphicalItems.find(function(K){var W=K.item;return W.type.name==="Scatter"});H&&(F=ze(ze({},F),H.props.points[D].tooltipPosition),L=H.props.points[D].tooltipPayload);var z={activeTooltipIndex:D,isTooltipActive:!0,activeLabel:R,activePayload:L,activeCoordinate:F};this.setState(z),this.renderCursor(O),this.accessibilityManager.setIndex(D)}}}},{key:"getSnapshotBeforeUpdate",value:function(j,E){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==E.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==j.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==j.margin){var S,T;this.accessibilityManager.setDetails({offset:{left:(S=this.props.margin.left)!==null&&S!==void 0?S:0,top:(T=this.props.margin.top)!==null&&T!==void 0?T:0}})}return null}},{key:"componentDidUpdate",value:function(j){kP([Do(j.children,sc)],[Do(this.props.children,sc)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var j=Do(this.props.children,sc);if(j&&typeof j.props.shared=="boolean"){var E=j.props.shared?"axis":"item";return l.indexOf(E)>=0?E:a}return a}},{key:"getMouseInfo",value:function(j){if(!this.container)return null;var E=this.container,S=E.getBoundingClientRect(),T=Oit(S),P={chartX:Math.round(j.pageX-T.left),chartY:Math.round(j.pageY-T.top)},O=S.width/E.offsetWidth||1,D=this.inRange(P.chartX,P.chartY,O);if(!D)return null;var R=this.state,L=R.xAxisMap,M=R.yAxisMap,B=this.getTooltipEventType(),U=$H(this.state,this.props.data,this.props.layout,D);if(B!=="axis"&&L&&M){var F=ag(L).scale,H=ag(M).scale,z=F&&F.invert?F.invert(P.chartX):null,K=H&&H.invert?H.invert(P.chartY):null;return ze(ze({},P),{},{xValue:z,yValue:K},U)}return U?ze(ze({},P),U):null}},{key:"inRange",value:function(j,E){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,T=this.props.layout,P=j/S,O=E/S;if(T==="horizontal"||T==="vertical"){var D=this.state.offset,R=P>=D.left&&P<=D.left+D.width&&O>=D.top&&O<=D.top+D.height;return R?{x:P,y:O}:null}var L=this.state,M=L.angleAxisMap,B=L.radiusAxisMap;if(M&&B){var U=ag(M);return hV({x:P,y:O},U)}return null}},{key:"parseEventsOfWrapper",value:function(){var j=this.props.children,E=this.getTooltipEventType(),S=Do(j,sc),T={};S&&E==="axis"&&(S.props.trigger==="click"?T={onClick:this.handleClick}:T={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var P=hN(this.props,this.handleOuterEvent);return ze(ze({},P),T)}},{key:"addListener",value:function(){s3.on(i3,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){s3.removeListener(i3,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(j,E,S){for(var T=this.state.formattedGraphicalItems,P=0,O=T.length;P<O;P++){var D=T[P];if(D.item===j||D.props.key===j.key||E===Wu(D.item.type)&&S===D.childIndex)return D}return null}},{key:"renderClipPath",value:function(){var j=this.clipPathId,E=this.state.offset,S=E.left,T=E.top,P=E.height,O=E.width;return ee.createElement("defs",null,ee.createElement("clipPath",{id:j},ee.createElement("rect",{x:S,y:T,height:P,width:O})))}},{key:"getXScales",value:function(){var j=this.state.xAxisMap;return j?Object.entries(j).reduce(function(E,S){var T=MH(S,2),P=T[0],O=T[1];return ze(ze({},E),{},Gt({},P,O.scale))},{}):null}},{key:"getYScales",value:function(){var j=this.state.yAxisMap;return j?Object.entries(j).reduce(function(E,S){var T=MH(S,2),P=T[0],O=T[1];return ze(ze({},E),{},Gt({},P,O.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(j){var E;return(E=this.state.xAxisMap)===null||E===void 0||(E=E[j])===null||E===void 0?void 0:E.scale}},{key:"getYScaleByAxisId",value:function(j){var E;return(E=this.state.yAxisMap)===null||E===void 0||(E=E[j])===null||E===void 0?void 0:E.scale}},{key:"getItemByXY",value:function(j){var E=this.state,S=E.formattedGraphicalItems,T=E.activeItem;if(S&&S.length)for(var P=0,O=S.length;P<O;P++){var D=S[P],R=D.props,L=D.item,M=L.type.defaultProps!==void 0?ze(ze({},L.type.defaultProps),L.props):L.props,B=Wu(L.type);if(B==="Bar"){var U=(R.data||[]).find(function(K){return mht(j,K)});if(U)return{graphicalItem:D,payload:U}}else if(B==="RadialBar"){var F=(R.data||[]).find(function(K){return hV(j,K)});if(F)return{graphicalItem:D,payload:F}}else if(GE(D,T)||KE(D,T)||ob(D,T)){var H=npt({graphicalItem:D,activeTooltipItem:T,itemData:M.data}),z=M.activeIndex===void 0?H:M.activeIndex;return{graphicalItem:ze(ze({},D),{},{childIndex:z}),payload:ob(D,T)?M.data[H]:D.props.data[H]}}}return null}},{key:"render",value:function(){var j=this;if(!rU(this))return null;var E=this.props,S=E.children,T=E.className,P=E.width,O=E.height,D=E.style,R=E.compact,L=E.title,M=E.desc,B=LH(E,L0t),U=qt(B,!1);if(R)return ee.createElement(wH,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},ee.createElement(EP,Pg({},U,{width:P,height:O,title:L,desc:M}),this.renderClipPath(),iU(S,this.renderMap)));if(this.props.accessibilityLayer){var F,H;U.tabIndex=(F=this.props.tabIndex)!==null&&F!==void 0?F:0,U.role=(H=this.props.role)!==null&&H!==void 0?H:"application",U.onKeyDown=function(K){j.accessibilityManager.keyboardEvent(K)},U.onFocus=function(){j.accessibilityManager.focus()}}var z=this.parseEventsOfWrapper();return ee.createElement(wH,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},ee.createElement("div",Pg({className:hn("recharts-wrapper",T),style:ze({position:"relative",curs
1434or:"default",width:P,height:O},D)},z,{ref:function(W){j.container=W}}),ee.createElement(EP,Pg({},U,{width:P,height:O,title:L,desc:M,style:eyt}),this.renderClipPath(),iU(S,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(N.Component);Gt(x,"displayName",n),Gt(x,"defaultProps",ze({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),Gt(x,"getDerivedStateFromProps",function(b,w){var _=b.dataKey,j=b.data,E=b.children,S=b.width,T=b.height,P=b.layout,O=b.stackOffset,D=b.margin,R=w.dataStartIndex,L=w.dataEndIndex;if(w.updateId===void 0){var M=BH(b);return ze(ze(ze({},M),{},{updateId:0},p(ze(ze({props:b},M),{},{updateId:0}),w)),{},{prevDataKey:_,prevData:j,prevWidth:S,prevHeight:T,prevLayout:P,prevStackOffset:O,prevMargin:D,prevChildren:E})}if(_!==w.prevDataKey||j!==w.prevData||S!==w.prevWidth||T!==w.prevHeight||P!==w.prevLayout||O!==w.prevStackOffset||!Yg(D,w.prevMargin)){var B=BH(b),U={chartX:w.chartX,chartY:w.chartY,isTooltipActive:w.isTooltipActive},F=ze(ze({},$H(w,j,P)),{},{updateId:w.updateId+1}),H=ze(ze(ze({},B),U),F);return ze(ze(ze({},H),p(ze({props:b},H),w)),{},{prevDataKey:_,prevData:j,prevWidth:S,prevHeight:T,prevLayout:P,prevStackOffset:O,prevMargin:D,prevChildren:E})}if(!kP(E,w.prevChildren)){var z,K,W,q,oe=Do(E,n0),J=oe&&(z=(K=oe.props)===null||K===void 0?void 0:K.startIndex)!==null&&z!==void 0?z:R,Y=oe&&(W=(q=oe.props)===null||q===void 0?void 0:q.endIndex)!==null&&W!==void 0?W:L,Z=J!==R||Y!==L,G=!mn(j),se=G&&!Z?w.updateId:w.updateId+1;return ze(ze({updateId:se},p(ze(ze({props:b},w),{},{updateId:se,dataStartIndex:J,dataEndIndex:Y}),w)),{},{prevChildren:E,dataStartIndex:J,dataEndIndex:Y})}return null}),Gt(x,"renderActiveDot",function(b,w,_){var j;return N.isValidElement(b)?j=N.cloneElement(b,w):an(b)?j=b(w):j=ee.createElement(UE,w),ee.createElement(Wn,{className:"recharts-active-dot",key:_},j)});var y=N.forwardRef(function(w,_){return ee.createElement(x,Pg({},w,{ref:_}))});return y.displayName=x.displayName,y},uyt=R8({chartName:"BarChart",GraphicalChild:Hf,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:ey},{axisType:"yAxis",AxisComp:ty}],formatAxisMap:vde}),dyt=R8({chartName:"PieChart",GraphicalChild:Sd,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:WE},{axisType:"radiusAxis",AxisComp:VE}],formatAxisMap:Sut,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),fyt=R8({chartName:"AreaChart",GraphicalChild:vh,axisComponents:[{axisType:"xAxis",AxisComp:ey},{axisType:"yAxis",AxisComp:ty}],formatAxisMap:vde});const hyt={manual_entry:"Entrée manuelle",game_result:"Résultat de partie",season_reset:"Reset saisonnier",admin_correction:"Correction admin"};function myt({active:e,payload:t}){if(!e||!t||!t.length)return null;const n=t[0].payload,r=n.change>0?"text-green-500":n.change<0?"text-red-500":"text-muted-foreground",i=n.change>0?lu:n.change<0?kxe:Eb;return s.jsxs("div",{className:"bg-popover border border-border rounded-lg p-3 shadow-lg",children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:Ze(new Date(n.fullDate),"d MMMM yyyy",{locale:pt})}),s.jsx("p",{className:"text-lg font-bold text-foreground",children:n.elo}),n.change!==0&&s.jsxs("p",{className:`text-sm flex items-center gap-1 ${r}`,children:[s.jsx(i,{className:"w-3 h-3"}),n.change>0?"+":"",n.change]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:hyt[n.reason]||n.reason})]})}function ife({userId:e}){const{data:t,isLoading:n}=fle(e),r=N.useMemo(()=>!t||t.length===0?[]:t.slice().reverse().map(o=>({date:Ze(new Date(o.created_at),"d MMM",{locale:pt}),elo:o.new_elo,change:o.new_elo-(o.old_elo||o.new_elo),reason:o.change_reason,fullDate:o.created_at})),[t]),{minElo:i,maxElo:a}=N.useMemo(()=>{if(r.length===0)return{minElo:KT,maxElo:KT+400};const o=r.map(l=>l.elo);return{minElo:Math.floor((Math.min(...o)-50)/50)*50,maxElo:Math.ceil((Math.max(...o)+50)/50)*50}},[r]);return n?s.jsx(Ie,{className:"h-[180px] sm:h-[200px] w-full"}):r.length?s.jsx("div",{className:"h-[180px] sm:h-[200px] w-full",children:s.jsx(KP,{width:"100%",height:"100%",children:s.jsxs(fyt,{data:r,margin:{top:10,right:5,left:-25,bottom:0},children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:"eloGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"5%",
1434stopColor:"hsl(var(--primary))",stopOpacity:.3}),s.jsx("stop",{offset:"95%",stopColor:"hsl(var(--primary))",stopOpacity:0})]})}),s.jsx(ey,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:"hsl(var(--muted-foreground))"},dy:10,interval:"preserveStartEnd"}),s.jsx(ty,{domain:[i,a],axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:"hsl(var(--muted-foreground))"},dx:-5,width:35}),s.jsx(sc,{content:s.jsx(myt,{})}),s.jsx(XE,{y:1200,stroke:"hsl(var(--muted-foreground))",strokeDasharray:"3 3",strokeOpacity:.5}),s.jsx(vh,{type:"monotone",dataKey:"elo",stroke:"hsl(var(--primary))",strokeWidth:2,fill:"url(#eloGradient)",dot:{r:2,fill:"hsl(var(--primary))",strokeWidth:0},activeDot:{r:4,fill:"hsl(var(--primary))",stroke:"hsl(var(--background))",strokeWidth:2}})]})})}):s.jsxs("div",{className:"flex flex-col items-center justify-center h-[180px] sm:h-[200px] text-center px-4",children:[s.jsx(iI,{className:"w-10 h-10 sm:w-12 sm:h-12 text-muted-foreground/50 mb-3"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Pas encore de données"}),s.jsx("p",{className:"text-muted-foreground/70 text-xs mt-1",children:"Jouez des parties pour voir votre progression"})]})}const UH={manual_entry:{label:"Saisie manuelle",icon:tX,color:"text-blue-500"},game_result:{label:"Résultat",icon:Xt,color:"text-primary"},season_reset:{label:"Reset saison",icon:Il,color:"text-orange-500"},admin_correction:{label:"Correction",icon:nd,color:"text-purple-500"}};function afe({userId:e}){const{data:t,isLoading:n}=fle(e);return n?s.jsx("div",{className:"space-y-3",children:[...Array(3)].map((r,i)=>s.jsx(Ie,{className:"h-20 w-full rounded-lg"},i))}):!t||t.length===0?s.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"Aucun historique de classement"}):s.jsx("div",{className:"space-y-3",children:t.map(r=>{const i=UH[r.change_reason]||UH.manual_entry,a=i.icon,o=r.new_elo-(r.old_elo||0),l=o>0,c=o===0,u=r.event?r.event.title:null;return s.jsxs("div",{className:"flex flex-col gap-2 p-3 rounded-lg border border-border/50 bg-card",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0 flex-1",children:[s.jsx("div",{className:`p-1.5 rounded-md bg-muted shrink-0 ${i.color}`,children:s.jsx(a,{className:"h-4 w-4"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"text-sm font-medium",children:i.label}),s.jsx("p",{className:"text-xs text-muted-foreground",children:Ze(new Date(r.created_at),"d MMM yyyy",{locale:pt})})]})]}),!c&&s.jsxs("div",{className:`flex items-center gap-0.5 px-2 py-1 rounded-full text-xs font-semibold shrink-0 ${l?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[l?s.jsx(zY,{className:"h-3 w-3"}):s.jsx(BY,{className:"h-3 w-3"}),Math.abs(o)]})]}),s.jsxs("div",{className:"flex items-center justify-between text-sm pl-9 gap-2",children:[s.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:[r.old_elo||"—"," → ",s.jsx("span",{className:"font-medium text-foreground",children:r.new_elo})]}),u&&s.jsx("span",{className:"text-xs text-muted-foreground truncate max-w-[140px] sm:max-w-[200px]",children:u})]})]},r.id)})})}function o3(e){return e?new Date(e).toLocaleDateString("fr-FR",{day:"2-digit",month:"short",year:"numeric"}):"—"}function pyt(){var p;const{userId:e}=Wi(),t=Ye(),[n,r]=N.useState(null),{data:i,isLoading:a}=st({queryKey:["admin-user-profile",e],queryFn:async()=>{const{data:x,error:y}=await re.from("profiles").select("*").eq("id",e).maybeSingle();if(y)throw y;return x},enabled:!!e}),{data:o}=EC(e),{data:l}=st({queryKey:["admin-user-tickets",e],queryFn:async()=>{const{data:x,error:y}=await re.from("tickets").select("id, status, created_at, paid_at, price_paid_cents, reservation_code, events(id, title, event_date, status, venues(name, city))").eq("user_id",e).order("created_at",{ascending:!1});if(y)throw y;return x??[]},enabled:!!e}),c=dt({mutationFn:async x=>{const{data:y,error:b}=await re.functions.invoke("admin-recompute-stats",{body:{userId:e,dryRun:x}});if(b)throw b;if(y!=null&&y.error)throw new Error(y.error);return y},onSuccess:x=>{r(x),x.dryRun?je.success(`Simulation : ${x.eventsProcessed} tournoi(s), ${x.playersAffected} joueur(s) impacté(s)`):(je.success("Statistiques et Elo recalculés"),t.invalidateQueries({queryKey:["player-stats",e]}),t.invalidateQueries({queryKey:["elo-history",e]}),t.invalidateQueries({queryKey:["admin-user-profile",e]}))},onError:x=>je.error(x.message||"Échec du recalcul")}),u=c.isPending,d=((p=n==null?void 0:n.diff)==null?void 0:p.find(x=>x.userId===e))??null;if(a)return s.jsxs("div",{className:"space-y-4",children:[s.jsx(Ie,{className:"h-10 w-48"}),s.jsx(Ie,{className:"h-40 w-full"})]});if(!i)return s.jsxs("div",{className:"space-y-4",children:[s.jsx(Q,{variant:"ghost",size:"sm",asChild:!0,children:s.jsxs(Pe,{to:"/admin/users",children:[s.jsx(Fn,{className:"w-4 h-4 mr-2"}),"Retour"]}
1434)}),s.jsx("p",{className:"text-muted-foreground",children:"Utilisateur introuvable."})]});const f=i.display_name||[i.first_name,i.last_name].filter(Boolean).join(" ")||i.email,h=o&&o.games_played>0?Math.round(o.wins/o.games_played*100):0;return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsx(Q,{variant:"ghost",size:"sm",asChild:!0,children:s.jsxs(Pe,{to:"/admin/users",children:[s.jsx(Fn,{className:"w-4 h-4 mr-2"}),"Utilisateurs"]})}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>c.mutate(!0),disabled:u,children:[u?s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(xo,{className:"w-4 h-4 mr-2"}),"Simuler le recalcul"]}),s.jsx(Q,{size:"sm",onClick:()=>c.mutate(!1),disabled:u,children:"Recalculer stats & Elo"})]})]}),s.jsx(Se,{children:s.jsxs(De,{className:"p-5 space-y-3",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h1",{className:"text-2xl font-bold break-words",children:f}),s.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-2 mt-1 break-all",children:[s.jsx(wr,{className:"w-3.5 h-3.5 shrink-0"}),i.email]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.club&&s.jsx(we,{variant:"outline",children:i.club}),i.code_ffe&&s.jsxs(we,{variant:"outline",children:["FFE ",i.code_ffe]}),i.code_fide&&s.jsxs(we,{variant:"outline",children:["FIDE ",i.code_fide]})]})]}),s.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-2",children:[s.jsx(x0,{className:"w-3.5 h-3.5"}),"Inscrit le ",o3(i.created_at)]})]})}),d&&s.jsxs(Se,{className:"border-primary/40",children:[s.jsx(kt,{className:"pb-2",children:s.jsx(Et,{className:"text-base",children:n!=null&&n.dryRun?"Simulation du recalcul":"Résultat du recalcul"})}),s.jsxs(De,{className:"text-sm space-y-2",children:[s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[["Parties","games"],["Victoires","wins"],["Nulles","draws"],["Défaites","losses"],["Tournois","tournaments"],["Tournois gagnés","tournamentsWon"],["Elo","elo"]].map(([x,y])=>{var j;const b=((j=d.before)==null?void 0:j[y])??0,w=d.after[y],_=b!==w;return s.jsxs("div",{className:"rounded-lg border p-2",children:[s.jsx("div",{className:"text-[11px] uppercase text-muted-foreground",children:x}),s.jsxs("div",{className:_?"font-semibold text-primary":"",children:[b," → ",w]})]},y)})}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[n==null?void 0:n.eventsProcessed," tournoi(s) rejoué(s) · ",n==null?void 0:n.playersAffected," joueur(s) impacté(s) au total",n!=null&&n.dryRun?" · aucune donnée modifiée":""]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[s.jsx(Se,{children:s.jsxs(De,{className:"p-4",children:[s.jsxs("div",{className:"text-xs uppercase text-muted-foreground flex items-center gap-1",children:[s.jsx(lu,{className:"w-3.5 h-3.5"})," Elo"]}),s.jsx("div",{className:"text-2xl font-bold",children:qf((o==null?void 0:o.elo_rating)??i.elo_rating)})]})}),s.jsx(Se,{children:s.jsxs(De,{className:"p-4",children:[s.jsxs("div",{className:"text-xs uppercase text-muted-foreground flex items-center gap-1",children:[s.jsx(sX,{className:"w-3.5 h-3.5"})," Parties"]}),s.jsx("div",{className:"text-2xl font-bold",children:(o==null?void 0:o.games_played)??0}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:[(o==null?void 0:o.wins)??0,"V · ",(o==null?void 0:o.draws)??0,"N · ",(o==null?void 0:o.losses)??0,"D"]})]})}),s.jsx(Se,{children:s.jsxs(De,{className:"p-4",children:[s.jsx("div",{className:"text-xs uppercase text-muted-foreground",children:"% victoires"}),s.jsxs("div",{className:"text-2xl font-bold",children:[h,"%"]})]})}),s.jsx(Se,{children:s.jsxs(De,{className:"p-4",children:[s.jsxs("div",{className:"text-xs uppercase text-muted-foreground flex items-center gap-1",children:[s.jsx(Xt,{className:"w-3.5 h-3.5"})," Tournois"]}),s.jsx("div",{className:"text-2xl font-bold",children:(o==null?void 0:o.tournaments_played)??0}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:[(o==null?void 0:o.tournaments_won)??0," gagné(s)"]})]})})]}),s.jsxs(Ka,{defaultValue:"elo",children:[s.jsxs(Ca,{children:[s.jsx(vn,{value:"elo",children:"Elo"}),s.jsx(vn,{value:"tournaments",children:"Tournois"})]}
1434),s.jsxs(Sn,{value:"elo",className:"space-y-4 mt-4",children:[e&&s.jsx(ife,{userId:e}),e&&s.jsx(afe,{userId:e})]}),s.jsx(Sn,{value:"tournaments",className:"mt-4",children:s.jsxs(Se,{children:[s.jsx(kt,{className:"pb-2",children:s.jsxs(Et,{className:"text-base",children:["Inscriptions (",(l==null?void 0:l.length)??0,")"]})}),s.jsxs(De,{className:"space-y-2",children:[(l??[]).length===0&&s.jsx("p",{className:"text-sm text-muted-foreground",children:"Aucune inscription."}),(l??[]).map(x=>{var y,b,w,_,j;return s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-lg border p-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx(Pe,{to:`/admin/events/${(y=x.events)==null?void 0:y.id}`,className:"font-medium hover:underline break-words",children:((b=x.events)==null?void 0:b.title)??"Événement supprimé"}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:[o3((w=x.events)==null?void 0:w.event_date),(j=(_=x.events)==null?void 0:_.venues)!=null&&j.name?` · ${x.events.venues.name}`:""]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(we,{variant:"outline",className:"text-[11px]",children:x.status}),s.jsx("span",{className:"text-xs text-muted-foreground",children:x.paid_at?`Payé le ${o3(x.paid_at)}`:"Non payé"})]})]},x.id)})]})]})})]})]})}const l3={draft:{label:"Brouillon",badgeVariant:"secondary",dot:"bg-muted-foreground"},published:{label:"Publié",badgeVariant:"default",dot:"bg-primary"},ongoing:{label:"En cours",badgeVariant:"outline",dot:"bg-accent-foreground"},completed:{label:"Terminé",badgeVariant:"secondary",dot:"bg-secondary-foreground/60"},cancelled:{label:"Annulé",badgeVariant:"destructive",dot:"bg-destructive"}},gyt=["Lun","Mar","Mer","Jeu","Ven","Sam","Dim"];function xyt({events:e,isLoading:t,onEdit:n,onDuplicate:r,onStatusChange:i,onConfirmAction:a}){const[o,l]=N.useState(()=>aa(new Date)),[c,u]=N.useState(()=>Sl(new Date)),d=N.useMemo(()=>{const x=new Map;if(!e)return x;for(const y of e){const b=Ze(new Date(y.event_date),"yyyy-MM-dd"),w=x.get(b);w?w.push(y):x.set(b,[y])}for(const y of x.values())y.sort((b,w)=>new Date(b.event_date).getTime()-new Date(w.event_date).getTime());return x},[e]),f=N.useMemo(()=>{const x=wo(aa(o),{weekStartsOn:1}),y=E0(mp(o),{weekStartsOn:1});return Vje({start:x,end:y})},[o]),h=Ze(c,"yyyy-MM-dd"),p=d.get(h)??[];return s.jsxs("div",{className:"grid gap-6 lg:grid-cols-[minmax(0,1fr)_360px]",children:[s.jsxs("div",{className:"bg-card rounded-lg border border-border overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[s.jsx("h2",{className:"font-semibold capitalize",children:Ze(o,"MMMM yyyy",{locale:pt})}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>{const x=Sl(new Date);l(aa(x)),u(x)},children:"Aujourd'hui"}),s.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>l(x=>tke(x)),"aria-label":"Mois précédent",children:s.jsx(fp,{className:"h-4 w-4"})}),s.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>l(x=>bo(x,1)),"aria-label":"Mois suivant",children:s.jsx(la,{className:"h-4 w-4"})})]})]}),s.jsx("div",{className:"grid grid-cols-7 border-b border-border bg-muted/30",children:gyt.map(x=>s.jsx("div",{className:"py-2 text-center text-xs font-medium text-muted-foreground",children:x},x))}),s.jsx("div",{className:"grid grid-cols-7",children:f.map(x=>{const y=Ze(x,"yyyy-MM-dd"),b=d.get(y)??[],w=aC(x,o),_=Ui(x,c),j=QI(x),E=b.slice(0,2),S=b.length-E.length;return s.jsxs("button",{type:"button",onClick:()=>u(Sl(x)),className:ae("min-h-[88px] sm:min-h-[104px] p-1.5 text-left border-t border-l border-border first:border-l-0","[&:nth-child(7n+1)]:border-l-0","transition-colors hover:bg-accent/40 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",!w&&"bg-muted/20 text-muted-foreground",_&&"bg-accent/60 ring-1 ring-inset ring-primary/40"),children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("span",{className:ae("inline-flex h-6 w-6 items-center justify-center rounded-full text-xs font-medium",j&&"bg-primary text-primary-foreground"),children:Ze(x,"d")}),b.length>0&&s.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:b.length})]}),s.jsxs("div",{className:"space-y-1",children:[E.map(T=>s.jsxs("div",{className:"flex items-center gap-1 rounded-sm bg-background/80 px-1.5 py-0.5 text-[11px] leading-tight border border-border/60",title:T.title,children:[s.jsx("span",{className:ae("h-1.5 w-1.5 rounded-full shrink-0",l3[T.status].dot)}),s.jsxs("span",{className:"truncate text-foreground",children:[Ze(new Date(T.event_date),"HH:mm")," ",s.jsx("span",{className:"text-muted-foreground",children:T.title})]})]},T.id)),S>0&&s.jsxs("div",{className:"text-[10px] text-muted-foreground px-1.5",children:["+",S," autre",S>1?"s":""]})]})]},y)})})]}),s.jsxs("aside",{className:"bg-card rounded-lg border border-border overflow-hidden flex flex-col min-h-[300px]",children:[s.jsxs("div",{className:"px-4 py-3 border-b border-border",children:[s.jsxs("div",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:[p.length," événement",p.length>
14341?"s":""]}),s.jsx("div",{className:"font-semibold capitalize",children:Ze(c,"EEEE d MMMM yyyy",{locale:pt})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:t?s.jsxs(s.Fragment,{children:[s.jsx(Ie,{className:"h-20 w-full"}),s.jsx(Ie,{className:"h-20 w-full"})]}):p.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center text-center py-10 px-4 text-muted-foreground",children:[s.jsx(Jn,{className:"h-8 w-8 mb-2 opacity-40"}),s.jsx("p",{className:"text-sm",children:"Aucun événement ce jour-là."})]}):p.map(x=>s.jsxs("div",{className:"rounded-md border border-border p-3 space-y-2 hover:border-primary/40 transition-colors",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"font-medium truncate",children:x.title}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:[Ze(new Date(x.event_date),"HH:mm")," •"," ",x.format," • ",x.time_control||"10+0"]})]}),s.jsxs(eh,{children:[s.jsx(th,{asChild:!0,children:s.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7 -mr-1",children:s.jsx(Cb,{className:"w-4 h-4"})})}),s.jsxs(yd,{align:"end",children:[s.jsx(Dr,{asChild:!0,children:s.jsxs(Pe,{to:`/admin/events/${x.id}`,children:[s.jsx(go,{className:"w-4 h-4 mr-2"}),"Voir les détails"]})}),s.jsxs(Dr,{onClick:()=>n(x),children:[s.jsx($k,{className:"w-4 h-4 mr-2"}),"Modifier"]}),s.jsxs(Dr,{onClick:()=>r(x.id),children:[s.jsx(Ko,{className:"w-4 h-4 mr-2"}),"Dupliquer"]}),s.jsx(Vu,{}),x.status==="draft"&&s.jsxs(Dr,{onClick:()=>a({type:"publish",event:x}),children:[s.jsx(ca,{className:"w-4 h-4 mr-2"}),"Publier"]}),x.status==="published"&&s.jsxs(s.Fragment,{children:[s.jsxs(Dr,{onClick:()=>i(x.id,"ongoing"),children:[s.jsx(Na,{className:"w-4 h-4 mr-2"}),"Démarrer"]}),s.jsxs(Dr,{onClick:()=>a({type:"cancel",event:x}),className:"text-destructive",children:[s.jsx(hi,{className:"w-4 h-4 mr-2"}),"Annuler"]})]}),x.status==="ongoing"&&s.jsxs(Dr,{onClick:()=>i(x.id,"completed"),children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),"Terminer"]})]})]})]}),s.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[x.venue?s.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground min-w-0",children:[s.jsx(gn,{className:"w-3 h-3 shrink-0"}),s.jsx("span",{className:"truncate",children:x.venue.name})]}):s.jsx("span",{className:"text-muted-foreground",children:"—"}),s.jsx(we,{variant:l3[x.status].badgeVariant,children:l3[x.status].label})]})]},x.id))})]})]})}const yyt=[{key:"upcoming",label:"À venir"},{key:"ongoing",label:"En cours"},{key:"draft",label:"Brouillons"},{key:"completed",label:"Terminés"},{key:"cancelled",label:"Annulés"},{key:"all",label:"Tous"}];function vyt({value:e,onChange:t,counts:n}){return s.jsx("div",{className:"flex flex-wrap gap-2",children:yyt.map(({key:r,label:i})=>{const a=n[r],o=e===r;return s.jsxs("button",{type:"button",onClick:()=>t(r),className:ae("inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full","text-xs font-medium transition-all duration-200 border",o?"bg-[#AAFF00] border-[#AAFF00] text-[#0D0D0D] shadow-[0_4px_14px_-4px_rgba(170,255,0,0.6)]":"bg-card border-border text-muted-foreground hover:border-[#AAFF00] hover:text-foreground"),children:[s.jsx("span",{children:i}),s.jsx("span",{className:ae("inline-flex items-center justify-center min-w-[20px] h-5 px-1.5 rounded-full text-[10px] font-semibold tabular-nums",o?"bg-[#0D0D0D] text-[#AAFF00]":"bg-muted text-muted-foreground"),children:a})]},r)})})}const byt={today:"Aujourd'hui",thisWeek:"Cette semaine",thisMonth:"Ce mois",later:"Plus tard",past:"Passés"};function wyt(e){const t=new Date,n=Sl(t),r=GQ(t),i=E0(t,{weekStartsOn:1}),a=mp(t),o={today:[],thisWeek:[],thisMonth:[],later:[],past:[]};for(const c of e){const u=new Date(c.event_date);u<n?o.past.push(c):u<=r?o.today.push(c):u<=i?o.thisWeek.push(c):u<=a?o.thisMonth.push(c):o.later.push(c)}return["today","thisWeek","thisMonth","later","past"].filter(c=>o[c].length>0).map(c=>({key:c,label:byt[c],events:o[c]}))}const qH={draft:{label:"Brouillon",variant:"secondary"},published:{label:"Publié",variant:"default"},ongoing:{label:"En cours",variant:"outline"},completed:{label:"Terminé",variant:"secondary"},cancelled:{label:"Annulé",variant:"destructive"}},VH="admin-events-preset";function HH(e,t,n){const r=new Date(e.event_date);switch(t){case"upcoming":return(e.status==="published"||e.status==="draft")&&r>=n;case"draft":return e.status==="draft";case"ongoing":return e.status==="ongoing";case"completed":return e.status==="completed";case"cancelled":return e.status==="cancelled";case"all":return!0}}function _yt(){const[e,t]=N.useState(""),[n,r]=N.useState(()=>typeof window>"u"?"upcoming":localStorage.getItem(VH)||"upcoming"),[i,a]=N.useState(!1),[o,l]=N.useState(()=>typeof window>"u"?"list":localStorage.getItem("admin-events-view")||"list"),[c,u]=N.useState(!1),[d,f]=N.useState(null),[h,p]=N.useState(null);N.useEffect(()=>{localStorage.setItem("admin-events-view",o)},[o]),N.useEffect(()=>{localStorage.setItem(VH,n),a(n!=="upcoming"&&n!=="ongoing")},[n]);const{data:x,isLoading:y}=lee({search:e||void 0}),b=qb(),w=cee(),_=N.useMemo(()=>{const B=new Date,U=x||[];return{upcoming:U.filter(F=>HH(F,"upcoming",B)).length,draft:U.filter(F=>F.status==="draft").length,ongoing:U.filter(F=>F.status==="ongoing").length,completed:U.filter(F=>F.status==="completed").length,cancelled:U.filter(F=>F.status==="cancelled").length,all:U.length}},[x]),j=N.useMemo(()=>{const B=new Date;return[...(x||[]).filter(F=>HH(F,n,B))].sort((F,H)=>{const z=new Date(F.event_date).getTime(),K=new Date(H.event_date).getTime();return i?K-z:z-K})},[x,n,i]),E=n==="upcoming"||n==="all",S=N.useMemo(()=>E?wyt(j):[],[j,E]),T=Rr(),P=B=>{f(B),u(!0)},O=()=>{u(!1),f(null)},D=async(B,U)=>{await b.mutateAsync({id:B,status:U}),p(null)},R=async B=>{await w.mutateAsync(B)},L=(B,U)=>s.jsxs(Ls,{role:"link",tabIndex:0,onClick:()=>T(`/admin/events/${B.id}`),onKeyDown:F=>{(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),T(`/admin/events/${B.id}`))},className:ae("cursor-pointer",(U==null?void 0:U.dimmed)&&"opacity-60",(U==null?void 0:U.accent)&&"border-l-2 border-l-[#AAFF00]"),children:[s.jsxs(Lt,{children:[s.jsx("div",{className:"font-medium",children:B.title}),s.jsxs("div",{className:"text-sm text-muted-foreground",children:[B.format," • ",B.time_control||"10+0"]})]}),s.jsx(Lt,{children:B.venue?s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(gn,{className:"w-3.5 h-3.5 text-muted-foreground"}),s.jsx("span",{className:"truncate max-w-[150px]",children:B.venue.name})]}):s.jsx("span",{className:"text-muted-foreground",children:"—"})}),s.jsxs(Lt,{children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Jn,{className:"w-3.5 h-3.5 text-muted-foreground"}
1434),s.jsx("span",{children:Ze(new Date(B.event_date),"d MMM yyyy",{locale:pt})})]}),s.jsx("div",{className:"text-sm text-muted-foreground",children:Ze(new Date(B.event_date),"HH:mm")})]}),s.jsx(Lt,{children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(sn,{className:"w-3.5 h-3.5 text-muted-foreground"}),s.jsx("span",{children:B.capacity})]})}),s.jsx(Lt,{children:s.jsxs("span",{className:"font-medium",children:[(B.price_cents/100).toFixed(0),"€"]})}),s.jsx(Lt,{children:s.jsx(we,{variant:qH[B.status].variant,children:qH[B.status].label})}),s.jsx(Lt,{onClick:F=>F.stopPropagation(),children:s.jsxs(eh,{children:[s.jsx(th,{asChild:!0,children:s.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",children:s.jsx(Cb,{className:"w-4 h-4"})})}),s.jsxs(yd,{align:"end",children:[s.jsx(Dr,{asChild:!0,children:s.jsxs(Pe,{to:`/admin/events/${B.id}`,children:[s.jsx(go,{className:"w-4 h-4 mr-2"}),"Voir les détails"]})}),s.jsxs(Dr,{onClick:()=>P(B),children:[s.jsx($k,{className:"w-4 h-4 mr-2"}),"Modifier"]}),s.jsxs(Dr,{onClick:()=>R(B.id),children:[s.jsx(Ko,{className:"w-4 h-4 mr-2"}),"Dupliquer"]}),s.jsx(Vu,{}),B.status==="draft"&&s.jsxs(Dr,{onClick:()=>p({type:"publish",event:B}),children:[s.jsx(ca,{className:"w-4 h-4 mr-2"}),"Publier"]}),B.status==="published"&&s.jsxs(s.Fragment,{children:[s.jsxs(Dr,{onClick:()=>D(B.id,"ongoing"),children:[s.jsx(Na,{className:"w-4 h-4 mr-2"}),"Démarrer"]}),s.jsxs(Dr,{onClick:()=>p({type:"cancel",event:B}),className:"text-destructive",children:[s.jsx(hi,{className:"w-4 h-4 mr-2"}),"Annuler"]})]}),B.status==="ongoing"&&s.jsxs(Dr,{onClick:()=>D(B.id,"completed"),children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),"Terminer"]})]})]})})]},B.id),M=N.useMemo(()=>{if(n!=="upcoming")return null;const B=Date.now(),U=j.find(F=>new Date(F.event_date).getTime()>=B);return(U==null?void 0:U.id)??null},[j,n]);return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:"Événements"}),s.jsx("p",{className:"text-muted-foreground",children:"Gérez les tournois et événements de la plateforme"})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(_o,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{placeholder:"Rechercher un événement...",value:e,onChange:B=>t(B.target.value),className:"pl-10"})]}),s.jsxs(XM,{type:"single",value:o,onValueChange:B=>B&&l(B),variant:"outline",size:"sm",className:"self-start sm:self-auto",children:[s.jsxs(X2,{value:"list","aria-label":"Vue liste",className:"gap-2",children:[s.jsx(XY,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden md:inline",children:"Liste"})]}),s.jsxs(X2,{value:"calendar","aria-label":"Vue calendrier",className:"gap-2",children:[s.jsx(x0,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden md:inline",children:"Calendrier"})]})]}),s.jsxs(Q,{onClick:()=>u(!0),className:"gap-2",children:[s.jsx(qa,{className:"w-4 h-4"}),"Nouvel événement"]})]}),o==="list"&&s.jsx(vyt,{value:n,onChange:r,counts:_}),o==="calendar"?s.jsx(xyt,{events:x,isLoading:y,onEdit:P,onDuplicate:R,onStatusChange:D,onConfirmAction:p}):s.jsx("div",{className:"bg-card rounded-lg border border-border overflow-hidden",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsx("div",{className:"min-w-[700px]",children:s.jsxs(dh,{children:[s.jsx(fh,{children:s.jsxs(Ls,{children:[s.jsx(ln,{children:"Événement"}),s.jsx(ln,{children:"Lieu"}),s.jsx(ln,{children:s.jsxs("button",{type:"button",onClick:()=>a(B=>!B),className:"inline-flex items-center gap-1 hover:text-foreground transition-colors","aria-label":"Trier par date",children:["Date",s.jsx(Fge,{className:"w-3 h-3"})]})}),s.jsx(ln,{children:"Capacité"}),s.jsx(ln,{children:"Prix"}),s.jsx(ln,{children:"Statut"}),s.jsx(ln,{className:"w-[70px]"})]})}),s.jsx(hh,{children:y?[...Array(5)].map((B,U)=>s.jsxs(Ls,{children:[s.jsx(Lt,{children:s.jsx(Ie,{className:"h-5 w-40"})}),s.jsx(Lt,{children:s.jsx(Ie,{className:"h-5 w-32"})}),s.jsx(Lt,{children:s.jsx(Ie,{className:"h-5 w-24"})}),s.jsx(Lt,{children:s.jsx(Ie,{className:"h-5 w-16"})}),s.jsx(Lt,{children:s.jsx(Ie,{className:"h-5 w-16"})}),s.jsx(Lt,{children:s.jsx(Ie,{className:"h-5 w-20"})}),s.jsx(Lt,{children:s.jsx(Ie,{className:"h-8 w-8"})})]},U)):j.length===0?s.jsx(Ls,{children:s.jsxs(Lt,{colSpan:7,className:"text-center py-12",children:[s.jsx("div",{className:"text-muted-foreground",children:e?"Aucun événement ne correspond à votre recherche.":"Aucun événement dans cette catégorie."}),!e&&n==="upcoming"&&s.jsx(Q,{variant:"outline",className:"mt-4",onClick:()=>u(!0),children:"Créer un événement"})]})}):E?S.map(B=>s.jsxs(N.Fragment,{children:[s.jsx(Ls,{className:"hover:bg-transparent bg-muted/40",children:s.jsxs(Lt,{colSpan:7,className:"py-2 text-[11px] font-mono uppercase tracking-[0.15em] text-muted-foreground",children:[B.label," · ",B.events.length]})}),B.events.map(U=>L(U,{dimmed:B.key==="past"||U.status==="completed"||U.status==="cancelled",accent:U.status==="ongoing"||U.id===M}))]},`group-${B.key}`)):j.map(B=>L(B,{dimmed:B.status==="completed"||B.status==="cancelled",accent:B.status==="ongoing"}))})]})})})}),s.jsx(sw,{open:c,onOpenChange:O,event:d}),s.jsx(yr,{open:!!h,onOpenChange:()=>p(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:(h==null?void 0:h.type)==="publish"?"Publier l'événement ?":"Annuler l'événement ?"}),s.jsx(lr,{children:(h==null?void 0:h.type)==="publish"?"L'événement sera visible publiquement et les inscriptions seront ouvertes.":"Cette action est irréversible. Les joueurs inscrits seront notifiés."})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsx(vr,{onClick:()=>h&&D(h.event.id,h.type==="publish"?"published":"cancelled"),className:(h==null?void 0:h.type)==="cancel"?"bg-destructive hover:bg-destructive/90":"",children:(h==null?void 0:h.type)==="publish"?"Publier":"Confirmer l'annulation"})]})]})})]})}function jyt({totalRegistered:e,checkedIn:t,capacity:n,paidCount:r=0,leadCount:i=0,abandonedCount:a=0}){const o=e>0?Math.round(t/e*100):0,l=Math.max(1,n),c=Math.min(100,r/l*100),u=Math.max(0,i-a),d=Math.min(100-c,u/l*100),f=Math.min(100-c-d,a/l*100),h=Math.max(0,n-r-i);return s.jsxs("div",{className:"mb-6 space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-2 sm:gap-4",children:[s.jsxs("div",{className:"flex flex-col items-start gap-1 sm:flex-row sm:items-center sm:gap-3 p-2 sm:p-3 rounded-lg bg-muted/50 min-w-0",children:[s.jsx("div",{className:"w-8 h-8 sm:w-10 sm:h-10 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:s.jsx(sn,{className:"w-4 h-4 sm:w-5 sm:h-5 text-primary"})}
1434),s.jsxs("div",{className:"min-w-0 w-full",children:[s.jsx("p",{className:"text-xl sm:text-2xl font-bold tabular-nums leading-none",children:e}),s.jsx("p",{className:"text-[11px] sm:text-xs text-muted-foreground truncate mt-1",children:"Inscrits"})]})]}),s.jsxs("div",{className:"flex flex-col items-start gap-1 sm:flex-row sm:items-center sm:gap-3 p-2 sm:p-3 rounded-lg bg-muted/50 min-w-0",children:[s.jsx("div",{className:"w-8 h-8 sm:w-10 sm:h-10 rounded-lg bg-green-500/10 flex items-center justify-center shrink-0",children:s.jsx(Sb,{className:"w-4 h-4 sm:w-5 sm:h-5 text-green-600"})}),s.jsxs("div",{className:"min-w-0 w-full",children:[s.jsx("p",{className:"text-xl sm:text-2xl font-bold tabular-nums leading-none",children:t}),s.jsx("p",{className:"text-[11px] sm:text-xs text-muted-foreground truncate mt-1",children:"Présents"})]})]}),s.jsxs("div",{className:"flex flex-col items-start gap-1 sm:flex-row sm:items-center sm:gap-3 p-2 sm:p-3 rounded-lg bg-muted/50 min-w-0",children:[s.jsx("div",{className:"w-8 h-8 sm:w-10 sm:h-10 rounded-lg bg-blue-500/10 flex items-center justify-center shrink-0",children:s.jsx(lu,{className:"w-4 h-4 sm:w-5 sm:h-5 text-blue-600"})}),s.jsxs("div",{className:"min-w-0 w-full",children:[s.jsxs("p",{className:"text-xl sm:text-2xl font-bold tabular-nums leading-none",children:[o,"%"]}),s.jsx("p",{className:"text-[11px] sm:text-xs text-muted-foreground truncate mt-1",children:"Présence"})]})]})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between text-[11px] sm:text-xs text-muted-foreground mb-1.5",children:[s.jsx("span",{children:"Remplissage"}),s.jsxs("span",{className:"tabular-nums",children:[r+i,"/",n]})]}),s.jsxs("div",{className:"relative h-2.5 w-full rounded-full bg-muted overflow-hidden",role:"progressbar","aria-valuenow":r+i,"aria-valuemin":0,"aria-valuemax":n,children:[s.jsx("div",{className:"absolute left-0 top-0 h-full bg-green-500 transition-all",style:{width:`${c}%`}}),s.jsx("div",{className:"absolute top-0 h-full bg-purple-500 transition-all",style:{left:`${c}%`,width:`${d}%`}}),s.jsx("div",{className:"absolute top-0 h-full bg-amber-500 transition-all",style:{left:`${c+d}%`,width:`${f}%`}})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] sm:text-xs text-muted-foreground mt-1.5",children:[s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500"}),"Payés ",s.jsx("span",{className:"tabular-nums font-medium text-foreground",children:r})]}),s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-purple-500"}),"Préinscrits ",s.jsx("span",{className:"tabular-nums font-medium text-foreground",children:u})]}),a>0&&s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500"}),"Paniers abandonnés ",s.jsx("span",{className:"tabular-nums font-medium text-foreground",children:a})]}),s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-muted-foreground/40"}),"Libres ",s.jsx("span",{className:"tabular-nums font-medium text-foreground",children:h})]})]})]})]})}function ofe({ticketId:e,eventId:t,participantLabel:n,variant:r="icon",className:i}){const a=wte();return s.jsxs(yr,{children:[s.jsx(P2,{asChild:!0,children:s.jsxs(Q,{size:r==="icon"?"icon":"sm",variant:"ghost",className:r==="icon"?`h-7 w-7 text-muted-foreground hover:text-destructive ${i??""}`:`h-7 text-xs px-2 text-muted-foreground hover:text-destructive ${i??""}`,disabled:a.isPending,title:"Annuler le check-in","aria-label":"Annuler le check-in",children:[s.jsx(Il,{className:r==="icon"?"w-3.5 h-3.5":"w-3.5 h-3.5 mr-1"}),r==="full"&&"Annuler"]})}),s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Annuler le check-in ?"}),s.jsx(lr,{children:n?s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:n})," repassera au statut « Inscrit » et sortira du tournoi en cours. À utiliser en cas d'erreur de pointage ou pour retirer un joueur de test."]}):s.jsx(s.Fragment,{children:"Ce participant repassera au statut « Inscrit » et sortira du tournoi en cours."})})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Garder le check-in"}),s.jsx(vr,{onClick:()=>a.mutate({ticketId:e,eventId:t}),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Annuler le check-in"})]})]})]})}function Nyt({ticket:e,eventId:t,allowManualCheckin:n=!1,onCheckin:r,onCollect:i,checkinPending:a=!1}){var f;const o=!!e.checkin,l=e.status==="lead",c=e.status==="reserved"&&e.is_walk_in===!0,u=l||c,d=e.credit_total_cents-e.credit_remaining_cents;return s.jsxs("div",{className:"flex items-start sm:items-center gap-2.5 sm:gap-3 p-2.5 sm:p-3 bg-card/50 backdrop-blur-sm rounded-xl border border-border/50 hover:border-primary/20 transition-colors",children:[s.jsxs(Bi,{className:"h-9 w-9 sm:h-11 sm:w-11 shrink-0 ring-2 ring-background shadow-md",children:[s.jsx(Ra,{src:((f=e==null?void 0:e.profile)==null?void 0:f.avatar_url)||void 0}),s.jsx(zi,{className:"text-sm bg-primary/10 text-primary font-medium",children:T6(e)})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-medium text-sm break-words leading-tight line-clamp-2",title:ii(e,{showFullName:!0}),children:ii(e,{showFullName:!0})}),s.jsxs("p",{className:"text-xs text-muted-foreground break-words",children:["Inscrit le ",Ze(new Date(e.created_at),"d MMM",{locale:pt})," • ",(()=>{var p;const h=e.elo_rating??((p=e.profile)==null?void 0:p.elo_rating)??null;
1434return h!=null?s.jsx("span",{className:"text-foreground/80 font-medium tabular-nums",children:Xm(h)}):s.jsx("span",{className:"italic",children:"Elo —"})})()]}),e.paid_at?s.jsxs("p",{className:"text-xs text-emerald-600 dark:text-emerald-400 break-words",children:["Payé le ",Ze(new Date(e.paid_at),"d MMM · HH'h'mm",{locale:pt})]}):s.jsx("p",{className:"text-xs text-muted-foreground/70 italic",children:"Non payé"})]}),s.jsxs("div",{className:"flex flex-col items-end gap-1.5 shrink-0",children:[o?s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxs(we,{className:"bg-green-500/10 text-green-600 hover:bg-green-500/20 border-0 text-xs",children:[s.jsx(Cn,{className:"w-3 h-3 mr-1"}),"Présent"]}),(t||e.event_id)&&s.jsx(ofe,{ticketId:e.id,eventId:t??e.event_id,participantLabel:ii(e,{showFullName:!0})})]}):l?s.jsxs(we,{className:"bg-purple-500/10 text-purple-700 dark:text-purple-300 hover:bg-purple-500/20 border-0 text-xs",children:[s.jsx(Vt,{className:"w-3 h-3 mr-1"}),"Pré-inscrit"]}):c?s.jsxs(we,{className:"bg-amber-500/10 text-amber-600 dark:text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:[s.jsx(Vt,{className:"w-3 h-3 mr-1"}),"À régler"]}):s.jsxs(we,{variant:"secondary",className:"text-xs",children:[s.jsx(Vt,{className:"w-3 h-3 mr-1"}),"Inscrit"]}),u&&i?s.jsxs(Q,{size:"sm",onClick:i,className:"h-7 text-xs px-2",children:[s.jsx(Fk,{className:"w-3.5 h-3.5 mr-1"}),"Encaisser"]}):n&&!o?s.jsx(Q,{size:"sm",onClick:r,disabled:a,className:"h-8 text-xs px-3 bg-emerald-600 hover:bg-emerald-700 text-white",children:a?s.jsx(We,{className:"w-3.5 h-3.5 animate-spin"}):s.jsxs(s.Fragment,{children:[s.jsx(Sb,{className:"w-3.5 h-3.5 mr-1"}),"Pointer"]})}):s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx(el,{className:"w-3 h-3 text-muted-foreground"}),s.jsxs("span",{className:d>0?"text-orange-600 font-medium":"font-medium",children:[(e.credit_remaining_cents/100).toFixed(0),"€"]}),s.jsxs("span",{className:"text-muted-foreground",children:["/",(e.credit_total_cents/100).toFixed(0),"€"]})]})]})]})}function kyt({open:e,onOpenChange:t,ticket:n}){var f,h;const[r,i]=N.useState("cash"),[a,o]=N.useState(!1),{toast:l}=_r(),c=Ye(),u=((f=n==null?void 0:n.profile)==null?void 0:f.first_name)||((h=n==null?void 0:n.profile)==null?void 0:h.display_name)||(n==null?void 0:n.guest_first_name)||"ce joueur",d=async()=>{if(n){o(!0);try{if(r==="payment_link"){const{data:y,error:b}=await re.functions.invoke("create-payment-link",{body:{ticketId:n.id}});if(b)throw b;if(!(y!=null&&y.ok))throw new Error((y==null?void 0:y.error)??"Erreur");l({title:y.emailSent?"Lien de paiement envoyé":"Lien généré",description:y.emailSent?`${y.email} peut payer depuis son téléphone${o2(y.expiresAt)?` (lien valable jusqu'à ${o2(y.expiresAt)})`:""}.`:"L'email n'a pas pu partir, réessayez."}),c.invalidateQueries({queryKey:["event-tickets",n.event_id]}),t(!1);return}const{data:p,error:x}=await re.functions.invoke("collect-lead-payment",{body:{ticketId:n.id,paymentMethod:r==="free"?void 0:r,isFree:r==="free",grantCredit:r==="free"}});if(x)throw x;if(!(p!=null&&p.ok))throw new Error((p==null?void 0:p.error)??"Erreur");l({title:"Paiement enregistré",description:p.convertedFromLead?`Ticket envoyé à ${p.recipientEmail}.`:`Ticket déjà actif pour ${u}.`}),c.invalidateQueries({queryKey:["event-tickets",n.event_id]}),t(!1)}catch(p){l({title:"Erreur",description:(p==null?void 0:p.message)??"Encaissement impossible",variant:"destructive"})}finally{o(!1)}}};return s.jsx(Ln,{open:e,onOpenChange:t,children:s.jsxs(Dn,{className:"sm:max-w-md",children:[s.jsxs(Un,{children:[s.jsxs(qn,{children:["Encaisser ",u]}),s.jsxs(qr,{children:["Code ",n==null?void 0:n.reservation_code,". Le ticket et le lien d'accès seront envoyés par email automatiquement."]})]}),s.jsxs(ud,{value:r,onValueChange:p=>i(p),className:"grid grid-cols-1 gap-2 py-2",children:[s.jsxs("label",{htmlFor:"lp-cash",className:"flex items-center gap-3 rounded-md border border-border/60 px-3 py-3 cursor-pointer hover:bg-muted/50",children:[s.jsx(ui,{value:"cash",id:"lp-cash"}),s.jsx(zge,{className:"w-4 h-4 text-muted-foreground"}),s.jsx("span",{className:"font-medium",children:"Espèces"})]}),s.jsxs("label",{htmlFor:"lp-cb",className:"flex items-center gap-3 rounded-md border border-border/60 px-3 py-3 cursor-pointer hover:bg-muted/50",children:[s.jsx(ui,{value:"card_on_site",id:"lp-cb"}),s.jsx(el,{className:"w-4 h-4 text-muted-foreground"}),s.jsx("span",{className:"font-medium",children:"CB sur place"})]}),s.jsxs("label",{htmlFor:"lp-free",className:"flex items-center gap-3 rounded-md border border-border/60 px-3 py-3 cursor-pointer hover:bg-muted/50",children:[s.jsx(ui,{value:"free",id:"lp-free"}),s.jsx(vx,{className:"w-4 h-4 text-muted-foreground"}),s.jsx("span",{className:"font-medium",children:"Offert (gratuit + crédit)"})]}),s.jsxs("label",{htmlFor:"lp-link",className:"flex items-center gap-3 rounded-md border border-emerald-500/40 bg-emerald-500/5 px-3 py-3 cursor-pointer hover:bg-emerald-500/10",children:[s.jsx(ui,{value:"payment_link",id:"lp-link"}),s.jsx(i2,{className:"w-4 h-4 text-emerald-600"}),s.jsxs("span",{className:"font-medium",children:["Envoyer un lien de paiement",s.jsx("span",{className:"block text-xs font-normal text-muted-foreground",children:"Paiement par carte depuis son téléphone"})]})]})]}),s.jsxs(Pi,{className:"gap-2",children:[s.jsx(Q,{variant:"outline",onClick:()=>t(!1),disabled:a,children:"Annuler"}),s.jsxs(Q,{onClick:d,disabled:a,children:[a&&s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),r==="payment_link"?"Envoyer le lien":"Confirmer l'encaissement"]})]})]})})}const WH={all:"Tous",paid:"Payés",lead:"Pré-inscrits",abandoned:"Paniers abandonné
1434s",unpaid_walkin:"À régler"};function GH(e,t){switch(t){case"paid":return e.status==="paid"||e.status==="checked_in";case"lead":return e.status==="lead"&&e.lead_source!=="abandoned_checkout";case"abandoned":return e.status==="lead"&&e.lead_source==="abandoned_checkout";case"unpaid_walkin":return e.status==="reserved"&&e.is_walk_in===!0;default:return!0}}function KH(e){return e?Ze(new Date(e),"d MMM · HH'h'mm",{locale:pt}):null}function Cyt(e){return`"${(e==null?"":String(e)).replace(/"/g,'""')}"`}function M8({eventId:e,capacity:t,allowManualCheckin:n=!1}){var E;const{data:r,isLoading:i}=FR(e),a=SC(),[o,l]=N.useState(null),[c,u]=N.useState("all"),d=(E=a.variables)==null?void 0:E.ticketId,f=S=>{a.isPending||a.mutate({ticketId:S,method:"name_search",identityVerified:!0})},h=()=>{const T=[["Joueur","Statut","Origine","Elo","Inscrit le","Payé le","Code"],...[...r||[]].map(D=>{var R;return[ii(D,{showFullName:!0}),D.status??"",D.lead_source??"",D.elo_rating??((R=D.profile)==null?void 0:R.elo_rating)??"",D.created_at?Ze(new Date(D.created_at),"yyyy-MM-dd HH:mm"):"",D.paid_at?Ze(new Date(D.paid_at),"yyyy-MM-dd HH:mm"):"",D.reservation_code??""]})].map(D=>D.map(Cyt).join(";")).join(`
1435`),P=URL.createObjectURL(new Blob(["\uFEFF"+T],{type:"text/csv;charset=utf-8;"})),O=document.createElement("a");O.href=P,O.download=`participants-${e}.csv`,O.click(),URL.revokeObjectURL(P)};if(i)return s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"space-y-2 lg:hidden",children:[...Array(4)].map((S,T)=>s.jsx(Ie,{className:"h-16 rounded-xl"},T))}),s.jsxs("div",{className:"hidden lg:block space-y-4",children:[s.jsx("div",{className:"grid grid-cols-3 gap-4",children:[...Array(3)].map((S,T)=>s.jsx(Ie,{className:"h-20"},T))}),s.jsx("div",{className:"space-y-2",children:[...Array(4)].map((S,T)=>s.jsx(Ie,{className:"h-14"},T))})]})]});const p=[...r||[]].sort((S,T)=>{if(n){const P=!!S.checkin,O=!!T.checkin;if(!P&&O)return-1;if(P&&!O)return 1}else{const P=!!S.checkin,O=!!T.checkin;if(P&&!O)return-1;if(!P&&O)return 1}return new Date(S.created_at).getTime()-new Date(T.created_at).getTime()}),x=p.filter(S=>!!S.checkin).length,y=p.filter(S=>S.status==="paid"||S.status==="checked_in").length,b=p.filter(S=>S.status==="lead").length,w=p.filter(S=>S.status==="lead"&&S.lead_source==="abandoned_checkout").length,_={all:p.length,paid:y,lead:b-w,abandoned:w,unpaid_walkin:p.filter(S=>GH(S,"unpaid_walkin")).length},j=p.filter(S=>GH(S,c));return s.jsxs(s.Fragment,{children:[s.jsx(jyt,{totalRegistered:p.length,checkedIn:x,capacity:t,paidCount:y,leadCount:b,abandonedCount:w}),p.length===0?s.jsx("div",{className:"text-center py-12 text-muted-foreground",children:s.jsx("p",{children:"Aucun participant inscrit pour le moment."})}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 my-3",children:[Object.keys(WH).filter(S=>S==="all"||_[S]>0).map(S=>s.jsxs(Q,{size:"sm",variant:c===S?"default":"outline",className:"h-7 rounded-full px-3 text-xs",onClick:()=>u(S),children:[WH[S],s.jsx("span",{className:"ml-1.5 opacity-70 tabular-nums",children:_[S]})]},S)),s.jsxs(Q,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs ml-auto",onClick:h,children:[s.jsx(mc,{className:"w-3.5 h-3.5 mr-1"}),"Export CSV"]})]}),j.length===0?s.jsx("div",{className:"text-center py-10 text-sm text-muted-foreground",children:"Aucun participant dans ce filtre."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"space-y-2 lg:hidden",children:j.map(S=>s.jsx(Nyt,{ticket:S,eventId:e,allowManualCheckin:n,onCheckin:()=>f(S.id),checkinPending:a.isPending&&d===S.id,onCollect:()=>l(S)},S.id))}),s.jsx("div",{className:"hidden lg:block border rounded-lg overflow-x-auto",children:s.jsxs(dh,{children:[s.jsx(fh,{children:s.jsxs(Ls,{children:[s.jsx(ln,{className:"min-w-[160px]",children:"Joueur"}),s.jsx(ln,{className:"text-right w-20",children:"Elo"}),s.jsx(ln,{className:"hidden xl:table-cell whitespace-nowrap",children:"Inscrit le"}),s.jsx(ln,{className:"hidden xl:table-cell whitespace-nowrap",children:"Payé le"}),s.jsx(ln,{className:"whitespace-nowrap",children:"Statut"}),n?s.jsx(ln,{className:"text-right whitespace-nowrap",children:"Action"}):s.jsx(ln,{className:"text-right whitespace-nowrap",children:"Crédit"})]})}),s.jsx(hh,{children:j.map(S=>{var B,U;const T=!!S.checkin,P=S.status==="lead",O=S.status==="reserved"&&S.is_walk_in===!0,D=P||O,R=S.credit_total_cents-S.credit_remaining_cents,L=S.elo_rating??((B=S.profile)==null?void 0:B.elo_rating)??null,M=S.paid_at??null;return s.jsxs(Ls,{children:[s.jsx(Lt,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs(Bi,{className:"h-8 w-8",children:[s.jsx(Ra,{src:((U=S==null?void 0:S.profile)==null?void 0:U.avatar_url)||void 0}),s.jsx(zi,{className:"text-xs",children:T6(S)})]}),s.jsx("div",{className:"min-w-0",children:s.jsx("p",{className:"font-medium break-words leading-tight",title:ii(S,{showFullName:!0}),children:ii(S,{showFullName:!0})})})]})}),s.jsx(Lt,{className:"text-right tabular-nums",children:L!=null?s.jsx("span",{className:"font-medium",children:qf(L)}):s.jsx("span",{className:"text-muted-foreground italic",children:"—"})}),s.jsx(Lt,{className:"text-muted-foreground hidden xl:table-cell whitespace-nowrap",children:KH(S.created_at)}),s.jsx(Lt,{className:"hidden xl:table-cell whitespace-nowrap",children:M?s.jsx("span",{className:"text-foreground
1435/80",children:KH(M)}):s.jsx("span",{className:"text-muted-foreground italic",children:"—"})}),s.jsx(Lt,{className:"whitespace-nowrap",children:T?s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxs(we,{className:"bg-green-500/10 text-green-600 hover:bg-green-500/20 border-0",children:[s.jsx(Cn,{className:"w-3 h-3 mr-1"}),"Présent"]}),s.jsx(ofe,{ticketId:S.id,eventId:e,participantLabel:ii(S,{showFullName:!0})})]}):P?s.jsxs(we,{className:"bg-purple-500/10 text-purple-700 dark:text-purple-300 hover:bg-purple-500/20 border-0",children:[s.jsx(Vt,{className:"w-3 h-3 mr-1"}),"Pré-inscrit"]}):O?s.jsxs(we,{className:"bg-amber-500/10 text-amber-600 dark:text-amber-400 hover:bg-amber-500/20 border-0",children:[s.jsx(Vt,{className:"w-3 h-3 mr-1"}),"À régler"]}):s.jsxs(we,{variant:"secondary",children:[s.jsx(Vt,{className:"w-3 h-3 mr-1"}),"Inscrit"]})}),s.jsx(Lt,{className:"text-right whitespace-nowrap",children:D?s.jsxs(Q,{size:"sm",onClick:()=>l(S),className:"h-8",children:[s.jsx(Fk,{className:"w-4 h-4 mr-1"}),"Encaisser"]}):n&&!T?s.jsx(Q,{size:"sm",onClick:()=>f(S.id),disabled:a.isPending,className:"h-8 bg-emerald-600 hover:bg-emerald-700 text-white",children:a.isPending&&d===S.id?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsxs(s.Fragment,{children:[s.jsx(Sb,{className:"w-4 h-4 mr-1"}),"Pointer"]})}):s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(el,{className:"w-3 h-3 text-muted-foreground"}),s.jsxs("span",{className:R>0?"text-orange-600":"",children:[(S.credit_remaining_cents/100).toFixed(0),"€"]}),s.jsxs("span",{className:"text-muted-foreground",children:["/",(S.credit_total_cents/100).toFixed(0),"€"]})]})})]},S.id)})})]})})]})]}),s.jsx(kyt,{open:!!o,onOpenChange:S=>!S&&l(null),ticket:o})]})}function lfe({count:e,showRecommendation:t=!1,compact:n=!1,className:r}){const i=e%2===0;return n?s.jsx("span",{className:ae("inline-flex items-center gap-1.5 text-xs font-medium px-2 py-1 rounded-md",i?"bg-green-500/10 text-green-700 dark:text-green-400":"bg-amber-500/10 text-amber-700 dark:text-amber-400",r),children:i?s.jsxs(s.Fragment,{children:[s.jsx(Cn,{className:"w-3 h-3"}),"Pair"]}):s.jsxs(s.Fragment,{children:[s.jsx(ur,{className:"w-3 h-3"}),"Impair"]})}):s.jsx("div",{className:ae("flex items-center gap-2 p-3 rounded-lg text-sm",i?"parity-even bg-green-500/10 border border-green-500/20":"parity-odd bg-amber-500/10 border border-amber-500/20",r),children:i?s.jsxs(s.Fragment,{children:[s.jsx(Cn,{className:"w-4 h-4 text-green-600 dark:text-green-400 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("span",{className:"font-medium text-green-700 dark:text-green-400",children:["Nombre pair (",e,")"]}),s.jsx("p",{className:"text-xs text-green-600/80 dark:text-green-400/80",children:"Pas de bye nécessaire"})]})]}):s.jsxs(s.Fragment,{children:[s.jsx(ur,{className:"w-4 h-4 text-amber-600 dark:text-amber-400 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("span",{className:"font-medium text-amber-700 dark:text-amber-400",children:["Nombre impair (",e,")"]}),s.jsx("p",{className:"text-xs text-amber-600/80 dark:text-amber-400/80",children:"1 bye sera attribué"})]}),t&&s.jsxs("div",{className:"flex items-center gap-1 text-xs text-amber-600 dark:text-amber-400",children:[s.jsx(cs,{className:"w-3 h-3"}),s.jsx("span",{children:"+1 joueur"})]})]})})}function cfe(e,t=300){const[n,r]=N.useState(e);return N.useEffect(()=>{const i=setTimeout(()=>r(e),t);return()=>clearTimeout(i)},[e,t]),n}function ufe(e,t){const n=t.trim();return st({queryKey:["search-players",e,n],queryFn:async()=>{const{data:r,error:i}=await re.rpc("search_players_for_event",{p_event_id:e,p_query:n});if(i)throw i;return r??[]},enabled:!!e&&(n.length===0||n.length>=2),staleTime:3e4})}function Og(e){return`${e.first_name??""} ${e.last_name??""}`.trim()||e.display_name||e.email_display||"Joueur"}function YH(e){const t=(e.first_name??e.display_name??"?").charAt(0),n=(e.last_name??"").charAt(0);return`${t}${n}`.toUpperCase()}function Eyt({eventId:e,selected:t,onSelect:n,onCreateNew:r,onAlreadyRegistered:i}){const[a,o]=N.useState(""),[l,c]=N.useState(0),u=N.useRef(null),d=cfe(a,300),{data:f=[],isLoading:h,isError:p}=ufe(e,d),x=d.trim().length<2;N.useEffect(()=>{c(0)},[d]),N.useEffect(()=>{var j;
1435const _=(j=u.current)==null?void 0:j.querySelector(`[data-idx="${l}"]`);_==null||_.scrollIntoView({block:"nearest"})},[l]);const y=_=>{if(_.already_registered){i==null||i(_);return}n(_)};if(t)return s.jsx("div",{className:"rounded-xl border border-primary/40 bg-primary/5 p-3",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"h-10 w-10 shrink-0 rounded-full bg-primary/15 flex items-center justify-center text-sm font-bold text-primary",children:YH(t)}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-semibold truncate",children:Og(t)}),s.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[Xm(t.elo_rating),t.club?` · ${t.club}`:"",t.email_display?` · ${t.email_display}`:""]})]}),s.jsxs(Q,{type:"button",variant:"ghost",size:"sm",className:"shrink-0 min-h-[44px]",onClick:()=>n(null),children:[s.jsx(Er,{className:"w-4 h-4 mr-1"}),"Changer"]})]})});const b=!h&&f.length===0,w=_=>{if(f.length){if(_.key==="ArrowDown")_.preventDefault(),c(j=>(j+1)%f.length);else if(_.key==="ArrowUp")_.preventDefault(),c(j=>(j-1+f.length)%f.length);else if(_.key==="Enter"){_.preventDefault();const j=f[l];j&&y(j)}}};return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"relative",children:[s.jsx(_o,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Ue,{value:a,onChange:_=>o(_.target.value),onKeyDown:w,placeholder:"Nom, prénom, pseudo ou email...",className:"pl-10 h-12 text-base",autoFocus:!0}),h&&s.jsx(We,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 animate-spin text-muted-foreground"})]}),p&&s.jsx("p",{className:"text-sm text-destructive",children:"Recherche indisponible — utilisez « Nouveau joueur »."}),!p&&x&&f.length>0&&s.jsxs("p",{className:"flex items-center gap-1.5 px-1 text-xs font-medium text-muted-foreground",children:[s.jsx(Ti,{className:"w-3.5 h-3.5"}),"Les habitués de ce lieu"]}),!p&&b&&s.jsxs("div",{className:"rounded-lg border border-dashed border-border p-4 text-center space-y-2",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:x?"Tapez un nom, un pseudo ou un email pour chercher dans la base.":"Aucun joueur trouvé"}),!x&&r&&s.jsx(Q,{type:"button",variant:"outline",size:"sm",onClick:r,children:"Créer un nouveau joueur"})]}),f.length>0&&s.jsx("div",{ref:u,className:"max-h-64 overflow-y-auto rounded-lg border border-border divide-y divide-border",children:f.map((_,j)=>s.jsxs("button",{type:"button","data-idx":j,onClick:()=>y(_),onMouseEnter:()=>c(j),className:ae("w-full flex items-center gap-3 p-3 text-left min-h-[56px] transition-colors",_.already_registered&&"opacity-70",j===l?"bg-accent/60":"hover:bg-accent/50 active:bg-accent"),children:[s.jsx("div",{className:"h-9 w-9 shrink-0 rounded-full bg-muted flex items-center justify-center text-xs font-bold",children:YH(_)}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-medium truncate",children:Og(_)}),s.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[Xm(_.elo_rating),_.club?` · ${_.club}`:"",_.tournaments_played>0?` · ${_.tournaments_played} tournoi${_.tournaments_played>1?"s":""}`:""]}),s.jsx("p",{className:"text-[11px] text-muted-foreground/80 truncate",children:_.email_display})]}),_.already_registered?s.jsxs(we,{variant:"secondary",className:"shrink-0 gap-1",children:[s.jsx(is,{className:"w-3 h-3"}),"Déjà inscrit"]}):s.jsx(Xt,{className:"w-4 h-4 shrink-0 text-muted-foreground/50"})]},_.id))})]})}const Syt=da({firstName:Ct().min(1,"Le prénom est requis").max(100,"Le prénom ne doit pas dépasser 100 caractères").trim(),lastName:Ct().max(100,"Le nom ne doit pas dépasser 100 caractères").trim().optional().transform(e=>e||void 0),email:Ct().trim().toLowerCase().max(255).optional().default(""),hasSelectedUser:bj().default(!1),elo:RR.number({invalid_type_error:"Elo invalide"}).int().min(0,"Elo min 0").max(3500,"Elo max 3500").optional().nullable(),club:Ct().max(100,"Maximum 100 caractères").trim().optional().transform(e=>e||void 0),notes:Ct().max(500,"Les notes ne doivent pas dépasser 500 caractères").trim().optional().transform(e=>e||void 0),isFree:bj().default(!1),paymentMethod:tf(["cash","card_on_site","unpaid","payment_link"]).optional(),grantCredit:bj().default(!1),freeReason:Ct().max(200,"La raison ne doit pas dépasser 200 caractères").trim().optional().transform(e=>e||void 0),amountDueEuros:Io({invalid_type_error:"Montant invalide"}).min(0,"Montant minimum 0€").max(999,"Montant trop élevé").optional()}).refine(e=>e.isFree||e.paymentMethod!==void 0,{message:"Méthode de paiement requise",path:["paymentMethod"]}).refine(e=>e.hasSelectedUser||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.email??""),{message:"Email invalide",path:["email"]});function rS({open:e,onOpenChange:t,event:n,currentTicketCount:r,onSuccess:i}){const a=vd(),[o,l]=N.useState(!1),[c,u]=N.useState(null),[d,f]=N.useState(!1),[h,p]=N.useState(!1),[x,y]=N.useState("existing"),[b,w]=N.useState(null),{toast:_}=_r(),j=Y3e(),E=Zm({resolver:ep(Syt),defaultValues:{firstName:"",lastName:"",email:"",hasSelectedUser:!1,elo:null,club:"",notes:"",isFree:!1,paymentMethod:"cash",grantCredit:!1,freeReason:"",amountDueEuros:n.price_cents/100}}),S=Ne=>{w(Ne),E.setValue("hasSelectedUser",!!Ne,{shouldValidate:!0}),Ne?(E.setValue("firstName",Ne.first_name??Ne.display_name??"Joueur"),E.setValue("lastName",Ne.last_name??""),E.setValue("email",""),E.setValue("elo",Ne.elo_rating??null),E.setValue("club",Ne.club??""),E.clearErrors(["email","firstName"])):(E.setValue("firstName",""),E.setValue("lastName",""),E.setValue("elo",null),E.setValue("club",""))},T=Ne=>{y(Ne),Ne==="new"&&S(null)},P=E.watch("email"),O=E.watch("firstName"),D=E.watch("lastName"),R=(P??"").trim().toLowerCase(),L=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(R),M=L?R:`${O??""} ${D??""}`.trim(),B=cfe(M,400),{data:U=[]}=ufe(x==="new"&&B.length>=3?n.id:"",B),F=L&&B===R&&U.length>0,H=Ne=>{y("existing"),S(Ne)},z=E.watch("isFree"),K=E.watch("grantCredit"),W=E.watch("paymentMethod"),q=E.watch("amountDueEuros"),oe=!z&&W==="unpaid",J=!z&&W==="payment_link",Z=n.capacity-r<=0,G=n.status==="ongoing",se=od(n,n.venue??null),ce=Vb(n,n.venue??null)==="paper",le=z?0:(oe||J)&&Number.isFinite(q)?q:n.price_cents/100,fe=z?K?n.credit_amount_cents/100:0:n.credit_amount_cents/100,be=async Ne=>{if(!Ne.isFree&&Ne.paymentMethod==="payment_link"){const it=Math.round((Ne.amountDueEuros??n.price_cents/100)
1435*100);p(!0);try{const{data:qe,error:Qe}=await re.functions.invoke("create-payment-link",{body:{eventId:n.id,firstName:Ne.firstName,lastName:Ne.lastName,email:Ne.email,userId:b==null?void 0:b.id,elo:Ne.elo??null,club:Ne.club,notes:Ne.notes,amountCents:it}});if(Qe||!(qe!=null&&qe.ok))throw new Error((qe==null?void 0:qe.error)||(Qe==null?void 0:Qe.message)||"Erreur inconnue");u({name:b?Og(b):`${Ne.firstName}${Ne.lastName?` ${Ne.lastName}`:""}`,reservationCode:qe.reservationCode,creditCents:n.credit_amount_cents,pricePaid:0,isUnpaid:!1,amountDue:qe.amountCents??it,alreadyRegistered:!1,accountCreated:!!qe.accountCreated,paymentLink:{url:qe.checkoutUrl,email:qe.email,emailDisplay:(b==null?void 0:b.email_display)??void 0,emailSent:!!qe.emailSent,expiresAt:qe.expiresAt}}),f(!1),l(!0),_e(),i==null||i()}catch(qe){_({title:"Lien de paiement non envoyé",description:qe instanceof Error?qe.message:"Erreur serveur",variant:"destructive"})}finally{p(!1)}return}try{const it=!Ne.isFree&&Ne.paymentMethod==="unpaid",qe=it?Math.round((Ne.amountDueEuros??n.price_cents/100)*100):0,Qe=await j.mutateAsync({eventId:n.id,firstName:Ne.firstName,lastName:Ne.lastName,email:Ne.email,userId:b==null?void 0:b.id,elo:Ne.elo??null,club:Ne.club,notes:Ne.notes,paymentMethod:Ne.isFree?void 0:Ne.paymentMethod,isFree:Ne.isFree,grantCredit:Ne.grantCredit,freeReason:Ne.freeReason,amountDueCents:it?qe:void 0});u({name:b?Og(b):`${Ne.firstName}${Ne.lastName?` ${Ne.lastName}`:""}`,reservationCode:Qe.reservation_code,creditCents:Qe.credit_remaining_cents,pricePaid:Qe.price_paid_cents,isUnpaid:Qe.status==="lead",amountDue:Qe.amount_due_cents??qe,alreadyRegistered:Qe.alreadyRegistered,accountCreated:Qe.accountCreated}),l(!0),_e(),i==null||i()}catch{}},_e=()=>{E.reset(),w(null),y("existing")},pe=()=>{l(!1),u(null),_e(),t(!1)},Te=()=>{l(!1),u(null),_e()},Ge=o?s.jsxs("div",{className:"flex flex-col items-center text-center py-6",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:s.jsx(Cn,{className:"w-8 h-8 text-primary"})}),s.jsx("h3",{className:"text-xl font-bold mb-2",children:c!=null&&c.paymentLink?"Place bloquée — lien envoyé":c!=null&&c.alreadyRegistered?"Déjà inscrit·e":c!=null&&c.isUnpaid?"Pré-inscription confirmée !":"Inscription confirmée !"}),s.jsxs("p",{className:"text-muted-foreground mb-2",children:[c==null?void 0:c.name,c!=null&&c.paymentLink?" — la place est réservée jusqu'au paiement.":c!=null&&c.alreadyRegistered?" a déjà un ticket actif — réutilisé.":c!=null&&c.isUnpaid?" est pré-inscrit·e. Check-in à son arrivée.":" est inscrit·e au tournoi"]}),(c==null?void 0:c.accountCreated)&&s.jsx("p",{className:"text-xs text-primary mb-4",children:"Compte créé — email de bienvenue envoyé."}),(c==null?void 0:c.paymentLink)&&s.jsxs("div",{className:"w-full max-w-xs mb-6 space-y-3",children:[s.jsxs("div",{className:"rounded-lg border border-emerald-500/30 bg-emerald-500/5 p-3 text-sm flex items-start gap-2 text-left",children:[s.jsx(wr,{className:"w-4 h-4 text-emerald-600 mt-0.5 shrink-0"}),s.jsxs("span",{children:[c.paymentLink.emailSent?s.jsxs(s.Fragment,{children:["Lien de paiement envoyé à ",s.jsx("strong",{children:c.paymentLink.emailDisplay??c.paymentLink.email}),"."]}):s.jsx(s.Fragment,{children:"L'email n'a pas pu partir — partagez le lien ci-dessous."}),s.jsx("br",{}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Montant : ",(c.amountDue/100).toFixed(2).replace(/\.00$/,""),"€",o2(c.paymentLink.expiresAt)?` · valable jusqu'à ${o2(c.paymentLink.expiresAt)}`:""]})]})]}),s.jsx("div",{className:"flex justify-center rounded-lg bg-white p-3",children:s.jsx(eE,{value:c.paymentLink.url,size:148})}),s.jsxs(Q,{type:"button",variant:"outline",className:"w-full",onClick:async()=>{try{await navigator.clipboard.writeText(c.paymentLink.url),f(!0),setTimeout(()=>f(!1),2e3)}catch{_({title:"Copie impossible",description:c.paymentLink.url})}},children:[d?s.jsx(is,{className:"w-4 h-4 mr-2"}):s.jsx(Ko,{className:"w-4 h-4 mr-2"}),d?"Lien copié":"Copier le lien de paiement"]})]}),s.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 w-full max-w-xs mb-6",children:[s.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Code de réservation"}),s.jsx("p",{className:"font-mono text-2xl font-bold tracking-wider",children:c==null?void 0:c.reservationCode}),s.jsx(Fs,{className:"my-3"}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Paiement"}),s.jsx("p",{className:"font-medium",children:c!=null&&c.isUnpaid?s.jsxs("span",{className:"text-amber-600 dar
1435k:text-amber-400 flex items-center justify-center gap-1",children:[s.jsx(Vt,{className:"w-4 h-4"}),"À régler — ",(c.amountDue/100).toFixed(0),"€ dus"]}):(c==null?void 0:c.pricePaid)===0?s.jsxs("span",{className:"text-primary flex items-center justify-center gap-1",children:[s.jsx(vx,{className:"w-4 h-4"}),"Inscription gratuite"]}):`${((c==null?void 0:c.pricePaid)||0)/100}€`})]}),s.jsx(Fs,{className:"my-3"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:ce?"Avantage remis sur place":"Crédit conso"}),s.jsx("p",{className:"font-bold text-lg text-primary",children:(c==null?void 0:c.creditCents)===0?"Aucun":ce?se.shortLabel:`${((c==null?void 0:c.creditCents)||0)/100}€`})]}),s.jsxs("div",{className:"flex gap-3 w-full",children:[s.jsx(Q,{variant:"outline",onClick:pe,className:"flex-1",children:"Fermer"}),s.jsx(Q,{onClick:Te,className:"flex-1",children:"Nouvelle inscription"})]})]}):s.jsxs("form",{onSubmit:E.handleSubmit(be),className:"space-y-4",children:[Z&&G&&s.jsxs(jl,{className:"bg-amber-500/10 border-amber-500/30",children:[s.jsx(ur,{className:"w-4 h-4 text-amber-500"}),s.jsxs(Nl,{className:"text-sm",children:[s.jsx("span",{className:"font-medium",children:"Capacité dépassée"})," – Ce participant sera ajouté au-delà de la limite initiale."]})]}),G&&s.jsxs(jl,{className:"bg-primary/10 border-primary/30",children:[s.jsx(gd,{className:"w-4 h-4 text-primary"}),s.jsxs(Nl,{className:"text-sm",children:[s.jsx("span",{className:"font-medium",children:"Tournoi en cours"})," – Ce joueur devra être ajouté manuellement aux appariements."]})]}),s.jsx("div",{className:"relative rounded-xl border border-primary/20 bg-gradient-to-br from-primary/5 to-transparent p-4 backdrop-blur-sm",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center",children:s.jsx(vx,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{children:[s.jsx(Fe,{htmlFor:"isFree",className:"font-medium cursor-pointer",children:"Inscription gratuite"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Invité VIP, staff, remplacement..."})]})]}),s.jsx(R0,{id:"isFree",checked:z,onCheckedChange:Ne=>{E.setValue("isFree",Ne),Ne?E.setValue("paymentMethod",void 0):(E.setValue("paymentMethod","cash"),E.setValue("grantCredit",!1),E.setValue("freeReason",""))}})]})}),s.jsx(lfe,{count:r,showRecommendation:r%2!==0}),s.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-sm",children:[s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Prix :"})," ",le===0?s.jsx("span",{className:"text-primary font-medium",children:"Gratuit"}):`${le}€`]}),s.jsx("p",{className:"text-muted-foreground",children:fe>0?z?s.jsxs("span",{className:"text-primary",children:["avantage food & drinks offert (",fe,"€ — ",ce?"coupon papier":"crédit digital",")"]}):`avantage food & drinks inclus (${fe}€ — ${ce?"coupon papier":"crédit digital"})`:"Pas d'avantage inclus"})]}),s.jsx("div",{className:"grid grid-cols-2 gap-2 rounded-xl bg-muted/60 p-1",children:["existing","new"].map(Ne=>s.jsx("button",{type:"button",onClick:()=>T(Ne),className:ae("min-h-[44px] rounded-lg text-sm font-medium transition-colors",x===Ne?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:Ne==="existing"?"Joueur existant":"Nouveau joueur"},Ne))}),s.jsxs("div",{className:"space-y-4",children:[x==="existing"?s.jsx(Eyt,{eventId:n.id,selected:b,onSelect:S,onCreateNew:()=>T("new"),onAlreadyRegistered:Ne=>_({title:"Déjà inscrit",description:`${Og(Ne)} figure déjà dans la liste des participants de cet événement.`})}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"firstName",children:"Prénom *"}),s.jsx(Ue,{id:"firstName",...E.register("firstName"),placeholder:"Prénom du participant",autoFocus:!0,className:"h-12"}),E.formState.errors.firstName&&s.jsx("p",{className:"text-sm text-destructive",children:E.formState.errors.firstName.message})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"lastName",children:"Nom (optionnel)"}),s.jsx(Ue,{id:"lastName",...E.register("lastName"),placeholder:"Nom de famille",className:"h-12"}),E.formState.errors.lastName&&s.jsx("p",{className:"text-sm text-destructive",children:E.formState.errors.lastName.message})]}),U.length>0&&s.jsxs("div",{className:"rounded-xl border border-amber-500/40 bg-amber-500/5 p-3 space-y-2",children:[s.jsxs("p",{className:"flex items-center gap-1.5 text-sm font-medium text-amber-700 dark:text-amber-400",children:[s.jsx(ur,{className:"w-4 h-4 shrink-0"}),F?"Ce compte existe déjà — il sera réutilisé":`${U.length} joueur${U.length>
14351?"s":""} proche${U.length>1?"s":""} déjà dans la base`]}),s.jsx("div",{className:"space-y-1",children:U.slice(0,3).map(Ne=>s.jsxs("button",{type:"button",onClick:()=>H(Ne),className:"w-full flex items-center gap-2 rounded-lg bg-background/80 p-2 text-left min-h-[44px] hover:bg-background transition-colors",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:Og(Ne)}),s.jsxs("p",{className:"text-[11px] text-muted-foreground truncate",children:[Xm(Ne.elo_rating),Ne.tournaments_played>0?` · ${Ne.tournaments_played} tournoi${Ne.tournaments_played>1?"s":""}`:"",Ne.email_display?` · ${Ne.email_display}`:""]})]}),s.jsx("span",{className:"shrink-0 text-xs font-medium text-primary",children:"Utiliser"})]},Ne.id))})]})]}),s.jsxs("div",{className:ae("grid gap-3",x==="new"?"grid-cols-2":"grid-cols-1"),children:[x==="new"&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"email",children:"Email *"}),s.jsx(Ue,{id:"email",type:"email",...E.register("email"),placeholder:"[email protected]",className:"h-12"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:F?"Un compte existe déjà avec cet email : il sera réutilisé, aucun doublon créé.":"Un compte est créé automatiquement et l'email de bienvenue est envoyé."}),E.formState.errors.email&&s.jsx("p",{className:"text-sm text-destructive",children:E.formState.errors.email.message})]}),b&&b.elo_rating?s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{children:"Elo"}),s.jsx("div",{className:"h-12 flex items-center rounded-md border border-input bg-muted/40 px-3 text-sm font-medium",children:Xm(b.elo_rating)}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Classement du profil — modifiable depuis la fiche du joueur."})]}):s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"elo",children:"Elo (optionnel)"}),s.jsx(Ue,{id:"elo",type:"number",min:0,max:3500,...E.register("elo"),placeholder:"ex. 1500",className:"h-12"}),b&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Joueur non classé : ce Elo deviendra son classement."}),E.formState.errors.elo&&s.jsx("p",{className:"text-sm text-destructive",children:E.formState.errors.elo.message})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"club",children:"Club (optionnel)"}),s.jsx(Ue,{id:"club",...E.register("club"),placeholder:"Nom du club",maxLength:100,className:"h-12"}),E.formState.errors.club&&s.jsx("p",{className:"text-sm text-destructive",children:E.formState.errors.club.message})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"notes",children:"Notes (optionnel)"}),s.jsx($s,{id:"notes",...E.register("notes"),placeholder:"Informations complémentaires...",rows:2}),E.formState.errors.notes&&s.jsx("p",{className:"text-sm text-destructive",children:E.formState.errors.notes.message})]}),!z&&s.jsxs("div",{className:"space-y-3",children:[s.jsx(Fe,{children:"Paiement"}),s.jsxs(ud,{value:E.watch("paymentMethod"),onValueChange:Ne=>E.setValue("paymentMethod",Ne),className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[s.jsxs("div",{className:"flex items-center space-x-2 rounded-md border border-border/60 px-3 py-2",children:[s.jsx(ui,{value:"cash",id:"cash"}),s.jsx(Fe,{htmlFor:"cash",className:"cursor-pointer font-normal",children:"Espèces"})]}),s.jsxs("div",{className:"flex items-center space-x-2 rounded-md border border-border/60 px-3 py-2",children:[s.jsx(ui,{value:"card_on_site",id:"card_on_site"}),s.jsx(Fe,{htmlFor:"card_on_site",className:"cursor-pointer font-normal",children:"CB sur place"})]}),s.jsxs("div",{className:"flex items-center space-x-2 rounded-md border border-amber-500/40 bg-amber-500/5 px-3 py-2",children:[s.jsx(ui,{value:"unpaid",id:"unpaid"}),s.jsx(Fe,{htmlFor:"unpaid",className:"cursor-pointer font-normal",children:"À régler sur place"})]}),s.jsxs("div",{className:"flex items-center space-x-2 rounded-md border border-emerald-500/40 bg-emerald-500/5 px-3 py-2",children:[s.jsx(ui,{value:"payment_link",id:"payment_link"}),s.jsx(Fe,{htmlFor:"payment_link",className:"cursor-pointer font-normal",children:"Lien de paiement par email"})]})]}),J&&s.jsxs("div",{className:"space-y-3",children:[s.jsxs(jl,{className:"bg-emerald-500/10 border-emerald-500/30",children:[s.jsx(i2,{className:"w-4 h-4 text-emerald-600"}),s.jsx(Nl,{className:"text-sm",children:"La place est bloquée immédiatement. Le joueur reçoit un email avec un lien Stripe et paie depuis son téléphone (lien valable jusqu'au début du tournoi + 45 min, 24h max)."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"amountLinkEuros",children:"Montant à payer (€)"}),s.jsxs("div",{className:"relative",children:[s.jsx(Ue,{id:"amountLinkEuros",type:"number",inputMode:"decimal",min:.5,max:999,step:"0.5",className:"h-11 pr-8",...E.register("amountDueEuros",{valueAsNumber:!0})}),s.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"€"})]}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Par défaut le prix de l'événement (",n.price_cents/100,"€)."]})]})]}),oe&&s.jsxs("div",{className:"space-y-3",children:[s.jsxs(jl,{className:"bg-amber-500/10 border-amber-500/30",children:[s.jsx(Vt,{className:"w-4 h-4 text-amber-600"}),s.jsx(Nl,{className:"text-sm",children:"Le participant est pré-inscrit. Le check-in et l'encaissement se feront à son arrivée."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"amountDueEuros",children:"Montant à régler (€)"}),s.jsxs("div",{className:"relative",children:[s.jsx(Ue,{id:"amountDueEuros",type:"number",inputMode:"decimal",min:0,max:999,step:"0.5",className:"h-11 pr-8",...E.register("amountDueEuros",{valueAsNumber:!0})}),s.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"€"})]}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Par défaut le prix de l'événement (",n.price_cents/100,"€). Ajustez pour appliquer une remise."]}),E.formState.errors.amountDueEuros&&s.jsx("p",{className:"text-sm text-destructive",children:E.formState.errors.amountDueEuros.message})]})]}),E.formState.errors.paymentMethod&&s.jsx("p",{className:"text-sm text-destructive",children:E.formState.errors.paymentMethod.message})]}),z&&s.jsxs("div",{className:"space-y-4 p-4 rounded-lg bg-primary/5 border border-primary/20",children:[s.jsxs("div",{className:"flex items-start space-x-3",children:[s.jsx(ya,{id:"grantCredit",checked:K,onCheckedChange:Ne=>E.setValue("grantCredit",Ne)}),s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Fe,{htmlFor:"grantCredit",className:"cursor-pointer",children:["Accorder l'avantage food & drinks (",n.credit_amount_cents/100,"€",ce?" — coupon papier":" — crédit digital",")"]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:ce?"Un coupon papier sera à remettre sur place à ce participant":"Le bar offre aussi la boisson à ce participant"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"freeReason",children:"Raison (optionnel)"}),s.jsx(Ue,{id:"freeReason",...E.register("freeReason"),placeholder:"VIP, staff, remplacement last-minute...",className:"h-10"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Pour traçabilité et audit"})]})]})]}),s.jsx(Q,{type:"submit",className:"w-full h-12",disabled:j.isPending||h||x==="existing"&&!b,children:j.isPending||h?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),J?"Envoi du lien...":oe?"Pré-inscription...":"Inscription en cours..."]}):s.jsxs(s.Fragment,{children:[J?s.jsx(i2,{className:"w-4 h-4 mr-2"}):s.jsx(cs,{className:"w-4 h-4 mr-2"}),J?"Bloquer la place + envoyer le lien":oe?"Pré-inscrire":"Inscrire + Check-in automatique"]})})]});return a?s.jsx(bd,{open:e,onOpenChange:t,children:s.jsxs(wd,{className:"bg-card/95 backdrop-blur-xl border-t border-primary/10",children:[s.jsxs(sh,{className:"pb-2",children:[s.jsxs(_d,{className:"flex items-center justify-center gap-2",children:[s.jsx(cs,{className:"w-5 h-5 text-primary"}),"Inscription exceptionnelle"]}),s.jsx(Yb,{className:"text-center",children:n.title})]}),s.jsx("div",{className:"px-4 pb-4 max-h-[85vh] overflow-y-auto",children:Ge}),!o&&s.jsx(DR,{className:"pt-0",children:s.jsx(pte,{asChild:!0,children:s.jsx(Q,{variant:"outline",children:"Annuler"})})})]})}):s.jsx(Ln,{open:e,onOpenChange:t,children:s.jsxs(Dn,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto",children:[s.jsxs(Un,{children:[s.jsxs(qn,{className:"flex items-center gap-2",children:[s.jsx(cs,{className:"w-5 h-5"}),"Inscription exceptionnelle"]}),s.jsx(qr,{children:n.title})]}),Ge,!o&&s.jsx(Pi,{children:s.jsx(Q,{variant:"outline",onClick:()=>t(!1),children:"Annuler"})})]})})}function Ayt({eventId:e,className:t}){const{data:n,isLoading:r}=J3e(e);return r?s.jsxs(Se,{className:ae("waitlist-card",t),children:[s.jsx(kt,{children:s.jsx(Ie,{className:"h-6 w-40"})}),s.jsxs(De,{className:"space-y-2",children:[s.jsx(Ie,{className:"h-12 w-full"}),s.jsx(Ie,{className:"h-12 w-full"})]})]}):!n||n.length===0?s.jsxs(Se,{className:ae("waitlist-card",t),children:[s.jsx(kt,{className:"pb-3",children:s.jsxs(Et,{className:"flex items-center gap-2 text-base",children:[s.jsx(sn,{className:"h-4 w-4 text-muted-foreground"}),"Liste d'attente"]})}),s.jsx(De,{children:s.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Aucune personne en liste d'attente"})})]}):s.jsxs(Se,{className:ae("waitlist-card",t),children:[s.jsx(kt,{className:"pb-3",children:s.jsxs(Et,{className:"flex items-center justify-between text-base",children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(sn,{className:"h-4 w-4 text-primary"}),"Liste d'attente"]}),s.jsx(we,{variant:"secondary",children:n.length})]})}),s.jsx(De,{className:"space-y-2",children:n.map(i=>{var o;const a=i.status==="notified";return s.jsxs("div",{className:ae("flex items-center gap-3 p-3 rounded-lg transition-colors",a?"bg-primary/10 border border-primary/20":"bg-muted/30"),children:[s.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/20 flex items-center justify-center text-sm font-semibold text-primary",children:i.position}),s.jsxs(Bi,{className:"h-9 w-9",children:[s.jsx(Ra,{src:((o=i.profile)==null?void 0:o.avatar_url)||void 0}),s.jsx(zi,{className:"text-xs",children:cc(i.profile)})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-medium text-sm truncate",children:fs(i.profile)}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Inscrit ",Ze(new Date(i.created_at),"d MMM à HH:mm",{locale:pt})]})]}),a?s.jsxs(we,{className:"bg-primary text-primary-foreground flex-shrink-0",children:[s.jsx(Vt,{className:"h-3 w-3 mr-1"}),"Notifié"]}):s.jsx(we,{variant:"outline",className:"flex-shrink-0",children:"En attente"})]},i.id)})})]})}function Tyt(e){return st({queryKey:["event-gallery",e],enabled:!!e,queryFn:async()=>{const{data:t,error:n}=await re.from("event_galleries").select("id,event_id,status,published_at,expires_at,notified_count,last_notified_at").eq("event_id",e).maybeSingle();if(n)throw n;return t??null},staleTime:15e3})}function Pyt(e){const t=Ye();return dt({mutationFn:async n=>{if(!e)throw new Error("Événement manquant");const{data:r,error:i}=await re.functions.invoke("publish-event-gallery",{body:{eventId:e,...n}});if(i){const a=i.context;if(a){const o=await a.json().catch(()=>null);if(o!=null&&o.error)throw new Error(o.error)}throw i}if(r!=null&&r.error)throw new Error(r.error);return r},onSuccess:()=>{t.invalidateQueries({queryKey:["event-gallery",e]}),t.invalidateQueries({queryKey:["event-photos",e]})}})}function Oyt(e){return st({queryKey:["gallery-access-requests",e],enabled:!!e,queryFn:async()=>{const{data:t,error:n}=await re.from("gallery_access_requests").select("id,event_id,ticket_id,requester_user_id,requester_email,requester_name,message,status,granted_until,decided_at,created_at").eq("event_id",e).order("created_at",{ascending:!1});if(n)throw n;return t??[]},staleTime:15e3})}function Dyt(e){const t=Ye();return dt({mutationFn:async n=>{const{data:r,error:i}=await re.functions.invoke("gallery-access-request",{body:{action:"decide",...n}});if(i){const a=i.context;if(a){const o=await a.json().catch(()=>null);if(o!=null&&o.error)throw new Error(o.error)}throw i}if(r!=null&&r.error)throw new Error(r.error);return r},onSuccess:()=>{t.invalidateQueries({queryKey:["gallery-access-requests",e]})}})}const L8={email_confirmation:{subject:{label:"Sujet",type:"text",default:"✉️ Confirmez votre email - Chess Agenda"},headline:{label:"Titre",type:"text",default:"Bienvenue !"},subheadline:{label:"Sous-titre",type:"text",default:"Plus qu'une étape pour activer votre compte"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"Merci de vous être inscrit sur Chess Agenda ! Pour activer votre compte et commencer à participer aux tournois d'échecs dans des lieux vivants, cliquez sur le bouton ci-dessous :"},cta_label:{label:"Texte du bouton",type:"text",default:"✓ Confirmer mon email"}},ticket_confirmation:{subject:{label:"Sujet",type:"text",default:"🎉 Inscription confirmée - {eventTitle}"},headline:{label:"Titre",type:"text",default:"Votre place est réservée"},subheadline:{label:"Sous-titre",type:"text",default:"Tournoi confirmé ♟️"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"Bonjour {playerName}, c'est confirmé ! Votre inscription au tournoi est validée."},cta_label:{label:"Texte du bouton",type:"text",default:"Voir mon billet"}},venue_welcome:{subject:{label:"Sujet",type:"text",default:"🎉 Bienvenue sur Chess Agenda - {barName}"},headline:{label:"Titre",type:"text",default:"Bienvenue dans la communauté !"},subheadline:{label:"Sous-titre",type:"text",default:"Votre demande a bien été reçue"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"Bonjour {contactName}, merci d'avoir choisi Chess Agenda pour votre établissement {barName}. Notre équipe va examiner votre demande sous 48 h."},cta_label:{label:"Texte du bouton",type:"text",default:"Découvrir l'espace partenaire"}},venue_approved:{subject:{label:"Sujet",type:"text",default:"✅ Votre établissement {barName} est approuvé !"},headline:{label:"Titre",type:"text",default:"Votre lieu est en ligne !"},subheadline:{label:"Sous-titre",type:"text",default:"Bienvenue parmi les partenaires Chess Agenda"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"Bonjour {contactName}, excellente nouvelle : {barName} fait désormais partie du réseau Chess Agenda. Vous pouvez créer votre premier tournoi dès maintenant."}
1435,cta_label:{label:"Texte du bouton",type:"text",default:"Accéder à mon espace"}},welcome:{subject:{label:"Sujet",type:"text",default:"👋 Bienvenue sur Chess Agenda"},headline:{label:"Titre",type:"text",default:"Bienvenue {userName} !"},subheadline:{label:"Sous-titre",type:"text",default:"Prêt·e à jouer dans les meilleurs lieux ?"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"Votre compte est actif. Découvrez les prochains tournois près de chez vous et inscrivez-vous en quelques clics."},cta_label:{label:"Texte du bouton",type:"text",default:"Voir les tournois"}},event_reminder:{subject:{label:"Sujet",type:"text",default:"⏰ Rappel : {eventTitle} demain"},headline:{label:"Titre",type:"text",default:"C'est bientôt !"},subheadline:{label:"Sous-titre",type:"text",default:"Votre tournoi a lieu prochainement"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"Bonjour {playerName}, petit rappel : votre tournoi {eventTitle} a lieu le {eventDate} à {eventTime}, au {venueName}."},cta_label:{label:"Texte du bouton",type:"text",default:"Voir mon billet"}},password_reset:{subject:{label:"Sujet",type:"text",default:"🔐 Réinitialisation de votre mot de passe"},headline:{label:"Titre",type:"text",default:"Réinitialiser votre mot de passe"},subheadline:{label:"Sous-titre",type:"text",default:"Une demande a été reçue pour votre compte"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"Bonjour {userName}, vous avez demandé la réinitialisation de votre mot de passe. Cliquez sur le bouton ci-dessous pour choisir un nouveau mot de passe."},cta_label:{label:"Texte du bouton",type:"text",default:"🔓 Réinitialiser mon mot de passe"}},email_change:{subject:{label:"Sujet",type:"text",default:"✉️ Confirmez votre nouvelle adresse email"},headline:{label:"Titre",type:"text",default:"Confirmer votre nouvelle adresse"},subheadline:{label:"Sous-titre",type:"text",default:"Sécurisons votre changement d'email"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"Bonjour {userName}, vous avez demandé à changer votre adresse email pour {newEmail}. Confirmez ce changement en cliquant sur le bouton ci-dessous."},cta_label:{label:"Texte du bouton",type:"text",default:"✓ Confirmer le changement"}},magic_link:{subject:{label:"Sujet",type:"text",default:"🔗 Votre lien de connexion Chess Agenda"},headline:{label:"Titre",type:"text",default:"Connectez-vous en un clic"},subheadline:{label:"Sous-titre",type:"text",default:"Votre lien magique est prêt"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"Bonjour {userName}, voici votre lien de connexion sécurisé. Cliquez sur le bouton ci-dessous pour accéder à votre compte sans mot de passe."},cta_label:{label:"Texte du bouton",type:"text",default:"🔗 Me connecter"}},account_created:{subject:{label:"Sujet",type:"text",default:"🎉 Votre compte Chess Agenda est prêt"},headline:{label:"Titre",type:"text",default:"Votre compte est prêt !"},subheadline:{label:"Sous-titre",type:"text",default:"Définissez votre mot de passe pour finaliser"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"Bonjour {userName}, votre compte a été créé automatiquement lors de votre inscription. Définissez votre mot de passe pour pouvoir vous reconnecter."},cta_label:{label:"Texte du bouton",type:"text",default:"Définir mon mot de passe"}},preregistration_confirmation:{subject:{label:"Sujet",type:"text",default:"On t'a réservé une place — {eventTitle}"},eyebrow:{label:"Petit label (en-tête)",type:"text",default:"Pré-inscription confirmée"},headline:{label:"Titre principal",type:"text",default:"On t'a noté."},greeting:{label:"Salutation",type:"text",default:"Salut {firstName},"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"On a bien reçu ta pré-inscription pour {eventTitle} — {eventDateLabel}, {venueName}."},info_box:{label:"Encart info",type:"multiline",default:"Ta place est notée. On t'envoie un email dès que le paiement est ouvert pour finaliser ton inscription. Pas d'action de ta part pour l'instant."},cta_label:{label:"Texte du bouton magic link",type:"text",default:"Accéder à mon espace"},cta_hint:{label:"Texte sous le bouton",type:"text",default:"Connexion sans mot de passe — lien valable 1h."},signature:{label:"Signature",type:"multiline",default:`À très vite,
1436L'équipe Chess Agenda`}},payment_link:{subject:{label:"Sujet",type:"text",default:"Ta place pour {eventTitle} — paiement en 1 clic"},eyebrow:{label:"Petit label (en-tête)",type:"text",default:"Inscription sur place"},headline:{label:"Titre principal",type:"text",default:"Plus qu'un paiement."},greeting:{label:"Salutation",type:"text",default:"Salut {firstName},"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"On vient de t'inscrire à {eventTitle} — {eventDateLabel}, {venueName}. Ta place est bloquée à ton nom : il ne reste plus qu'à régler pour la valider."},info_box:{label:"Encart info",type:"multiline",default:"Montant : {priceLabel}. {perkLabel}"},cta_label:{label:"Texte du bouton principal",type:"text",default:"💳 Payer ma place ({priceLabel})"},cta_hint:{label:"Texte sous le bouton",type:"text",default:"Paiement 100% sécurisé — moins de 60 secondes."},expiry_note:{label:"Note d'expiration",type:"text",default:"Lien valable jusqu'au {expiryLabel}."},signature:{label:"Signature",type:"multiline",default:`À tout de suite sur l'échiquier,
1437L'équipe Chess Agenda`}},abandoned_checkout:{subject:{label:"Sujet",type:"text",default:"🛒 Ta place pour {eventTitle} t'attend encore"},eyebrow:{label:"Petit label (en-tête)",type:"text",default:"Réservation non finalisée"},headline:{label:"Titre principal",type:"text",default:"Tu étais à un clic de jouer."},greeting:{label:"Salutation",type:"text",default:"Salut {firstName},"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"Tu as commencé ta réservation pour {eventTitle} le {eventDateLabel} au {venueName}, mais le paiement n'a pas été finalisé. Pas de souci : on a gardé ton panier au chaud."},reassurance_line:{label:"Ligne de réassurance",type:"text",default:"Un clic et tu reprends là où tu t'étais arrêté — rien à ressaisir."},cta_label:{label:"Texte du bouton principal",type:"text",default:"🎟️ Finaliser ma réservation"},cta_hint:{label:"Texte sous le bouton",type:"text",default:"Paiement 100% sécurisé — moins de 60 secondes."},release_label:{label:"Lien libérer (soft)",type:"text",default:"Finalement je ne viendrai pas"},signature:{label:"Signature",type:"multiline",default:`À très vite sur l'échiquier,
1438L'équipe Chess Agenda`}},abandoned_checkout_72h:{subject:{label:"Sujet",type:"text",default:"Toujours partant pour {eventTitle} ?"},eyebrow:{label:"Petit label (en-tête)",type:"text",default:"Panier toujours ouvert"},headline:{label:"Titre principal",type:"text",default:"Ton panier t'attend encore."},greeting:{label:"Salutation",type:"text",default:"Salut {firstName},"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"Il y a quelques jours tu as commencé ta réservation pour {eventTitle} ({eventDateLabel}, {venueName}) sans finaliser le paiement. Ton panier est toujours là, intact."},reassurance_line:{label:"Ligne de réassurance",type:"text",default:"Un clic suffit pour reprendre où tu t'étais arrêté — rien à ressaisir."},cta_label:{label:"Texte du bouton principal",type:"text",default:"🎟️ Finaliser ma réservation"},cta_hint:{label:"Texte sous le bouton",type:"text",default:"Paiement 100% sécurisé — moins de 60 secondes."},release_label:{label:"Lien libérer (soft)",type:"text",default:"Finalement je ne viendrai pas"},signature:{label:"Signature",type:"multiline",default:`À très vite sur l'échiquier,
1439L'équipe Chess Agenda`}},abandoned_checkout_48h_before:{subject:{label:"Sujet",type:"text",default:"🔥 J-2 : ta réservation pour {eventTitle} n'est pas finalisée"},eyebrow:{label:"Petit label (en-tête)",type:"text",default:"Plus que 2 jours"},headline:{label:"Titre principal",type:"text",default:"C'est dans 48h, et ton panier est encore ouvert."},greeting:{label:"Salutation",type:"text",default:"Salut {firstName},"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"{eventTitle} c'est {eventDateLabel} au {venueName}. Ta réservation n'a jamais été payée — donc ta place n'est pas encore à toi."},reassurance_line:{label:"Ligne de réassurance",type:"text",default:"Termine ton paiement maintenant, ça prend moins d'une minute et rien n'est à ressaisir."},cta_label:{label:"Texte du bouton principal",type:"text",default:"🎟️ Je valide ma place"},cta_hint:{label:"Texte sous le bouton",type:"text",default:"Paiement 100% sécurisé — moins de 60 secondes."},release_label:{label:"Lien libérer (soft)",type:"text",default:"Finalement je ne viendrai pas"},signature:{label:"Signature",type:"multiline",default:`À très vite sur l'échiquier,
1440L'équipe Chess Agenda`}},preregistration_reminder_72h:{subject:{label:"Sujet",type:"text",default:"⏳ Confirme ta place pour {eventTitle}"},eyebrow:{label:"Petit label (en-tête)",type:"text",default:"Ta place t'attend"},headline:{label:"Titre principal",type:"text",default:"On t'a gardé une place."},greeting:{label:"Salutation",type:"text",default:"Salut {firstName},"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"Tu t'es pré-inscrit pour {eventTitle} le {eventDateLabel} au {venueName}. Ta place est encore à ton nom, mais on ne peut plus la garantir — d'autres joueurs attendent."},urgency_line:{label:"Ligne d'urgence",type:"text",default:"Confirme-la maintenant pour ne pas la perdre."},cta_label:{label:"Texte du bouton principal",type:"text",default:"🎟️ Confirmer et payer ma place"},cta_hint:{label:"Texte sous le bouton",type:"text",default:"Paiement 100% sécurisé — moins de 60 secondes."},extend_label:{label:"Lien prolonger (soft)",type:"text",default:"Je réfléchis encore — me laisser 48h de plus"},release_label:{label:"Lien libérer (soft)",type:"text",default:"Je ne pourrai pas venir — libérer ma place"},signature:{label:"Signature",type:"multiline",default:`À très vite sur l'échiquier,
1441L'équipe Chess Agenda`}},preregistration_reminder_48h_before:{subject:{label:"Sujet",type:"text",default:"🔥 J-2 : {eventTitle}, il reste de la place"},eyebrow:{label:"Petit label (en-tête)",type:"text",default:"Plus que 2 jours"},headline:{label:"Titre principal",type:"text",default:"Ton tournoi, c'est dans 48h."},greeting:{label:"Salutation",type:"text",default:"Salut {firstName},"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"{eventTitle} c'est {eventDateLabel} au {venueName}. Tu t'étais pré-inscrit mais tu n'as pas encore validé ta place."},countdown_line:{label:"Ligne compte à rebours",type:"text",default:"Il reste encore de la place — on serait ravis de te compter parmi nous."},urgency_line:{label:"Ligne d'urgence",type:"text",default:"Réserve ta place maintenant, avant qu'un autre joueur ne la prenne."},cta_label:{label:"Texte du bouton principal",type:"text",default:"🎟️ Je réserve ma place"},cta_hint:{label:"Texte sous le bouton",type:"text",default:"Paiement 100% sécurisé — moins de 60 secondes."},release_label:{label:"Lien libérer (soft)",type:"text",default:"Finalement je ne pourrai pas venir"},signature:{label:"Signature",type:"multiline",default:`À très vite sur l'échiquier,
1442L'équipe Chess Agenda`}},event_gallery_ready:{subject:{label:"Sujet",type:"text",default:"📸 Les photos de {eventTitle} sont en ligne"},eyebrow:{label:"Petit label (en-tête)",type:"text",default:"Album privé"},headline:{label:"Titre principal",type:"text",default:"Vos photos du tournoi sont là."},greeting:{label:"Salutation",type:"text",default:"Salut {firstName},"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"Merci d'avoir joué {eventTitle} le {eventDateLabel} au {venueName} ! On a rassemblé {photoCount} photos de la soirée rien que pour les joueurs présents."},cta_label:{label:"Texte du bouton",type:"text",default:"📸 Voir l'album du tournoi"},cta_hint:{label:"Texte sous le bouton",type:"text",default:"Sélectionnez vos préférées, téléchargez-les, partagez-les."},privacy_note:{label:"Note confidentialité",type:"multiline",default:"Album privé : il n'est pas référencé ni accessible publiquement. Seuls les j
1442oueurs présents ce soir-là, via leur lien personnel, peuvent l'ouvrir."},expiry_note:{label:"Note expiration",type:"multiline",default:"L'album reste ouvert jusqu'au {expiryLabel}, puis il sera fermé. Pensez à télécharger celles que vous aimez."},disclaimer:{label:"Avertissement photos",type:"multiline",default:"Tout le monde n'apparaît pas forcément sur les photos — désolé si on vous a raté, on fera mieux la prochaine fois !"},report_label:{label:"Lien signalement",type:"text",default:"Une photo vous gêne ? Signalez-la depuis l'album, on la retire."},signature:{label:"Signature",type:"multiline",default:`À très vite sur l'échiquier,
1443L'équipe Chess Agenda`}},badge_unlocked:{subject:{label:"Sujet",type:"text",default:"U0001F3C5 Nouveau badge débloqué !"},eyebrow:{label:"Petit label (en-tête)",type:"text",default:"Collection mise à jour"},headline:{label:"Titre principal",type:"text",default:"Bien joué, ça se voit."},greeting:{label:"Salutation",type:"text",default:"Salut {firstName},"},intro:{label:"Paragraphe d'intro",type:"multiline",default:"Ta soirée au {venueName} vient de te rapporter un badge : {badgeName}. {badgeDescription}"},others_line:{label:"Ligne badges supplémentaires",type:"multiline",default:"Et ce n'est pas tout : tu as aussi décroché {otherBadges}. Grosse soirée."},collection_line:{label:"Ligne collection",type:"multiline",default:"Ça te fait {totalBadges} badges au compteur. Le prochain n'est jamais très loin — il suffit d'un tournoi de plus."},cta_label:{label:"Texte du bouton",type:"text",default:"U0001F3C5 Voir ma collection de badges"},cta_hint:{label:"Texte sous le bouton",type:"text",default:"Tous tes badges, débloqués et à venir, dans ton profil joueur."},explore_title:{label:"Titre bloc découverte",type:"text",default:"Et pendant que tu y es"},explore_1:{label:"Découverte 1",type:"multiline",default:"Suis ta courbe Elo et l'historique de toutes tes parties."},explore_2:{label:"Découverte 2",type:"multiline",default:"Débloque les badges d'explorateur en jouant dans de nouveaux lieux et quartiers."},explore_3:{label:"Découverte 3",type:"multiline",default:"Personnalise ton pseudo et ton profil : c'est lui qu'on affiche dans les classements."},signature:{label:"Signature",type:"multiline",default:`À très vite sur l'échiquier,
1444L'équipe Chess Agenda`}}};function kp(e,t){const n=L8[e]??{},r={};for(const[i,a]of Object.entries(n)){const o=t==null?void 0:t[i];r[i]=typeof o=="string"&&o.trim().length>0?o:a.default}return r}function XH(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>{const i=t[r];return i==null?n:String(i)})}function Iyt(e,t,n,r){if(!n||Object.keys(n).length===0)return e;const i=L8[t];if(!i)return e;let{subject:a,html:o,text:l}=e;for(const[c,u]of Object.entries(i)){const d=n[c];if(typeof d!="string"||d.trim().length===0)continue;const f=XH(d,r);if(c==="subject"){a=f;continue}const h=XH(u.default,r);!h||h===f||(o=o.split(h).join(f),l&&(l=l.split(h).join(f)))}return{subject:a,html:o,text:l}}const dfe=`
1445  body { font-family: 'Helvetica Neue', Arial, sans-serif; margin: 0; padding: 0; background-color: #0a0a0a; }
1446  .container { max-width: 600px; margin: 0 auto; padding: 24px; }
1447  .card { background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%); 
1448          border: 1px solid rgba(255,255,255,0.1); border-radius: 16px; padding: 32px; }
1449  .header { text-align: center; margin-bottom: 24px; }
1450  .logo { font-size: 24px; font-weight: bold; color: #e5b84c; letter-spacing: 2px; }
1451  .title { color: #ffffff; font-size: 22px; margin: 16px 0 8px; }
1452  .subtitle { color: #a0a0a0; font-size: 14px; }
1453  .content { color: #e0e0e0; font-size: 15px; line-height: 1.6; }
1454  .highlight { background: rgba(229, 184, 76, 0.15); border-left: 3px solid #e5b84c; 
1455               padding: 16px; border-radius: 8px; margin: 20px 0; }
1456  .code { font-family: monospace; font-size: 24px; font-weight: bold; color: #e5b84c; 
1457          letter-spacing: 4px; text-align: center; padding: 16px; }
1458  .button { display: inline-block; background: #e5b84c; color: #0a0a0a; 
1459            padding: 14px 28px; border-radius: 8px; text-decoration: none; 
1460            font-weight: 600; margin: 20px 0; }
1461  .footer { text-align: center; color: #666; font-size: 12px; margin-top: 32px; 
1462            padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.1); }
1463`;function Ryt(e){const t="✉️ Confirmez votre email - Chess Agenda",n=`
1464<!DOCTYPE html>
1465<html lang="fr">
1466<head>
1467  <meta charset="utf-8">
1468  <meta name="viewport" content="width=device-width, initial-scale=1">
1469  <meta name="color-scheme" content="dark">
1470  <title>Confirmez votre email</title>
1471  <style>
1472    * { margin: 0; padding: 0; box-sizing: border-box; }
1473    body {
1474      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
1475      background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
1476      color: #e0e0e0;
1477      line-height: 1.6;
1478      -webkit-font-smoothing: antialiased;
1479      padding: 20px;
1480    }
1481    .container { max-width: 520px; margin: 0 auto; }
1482    .card {
1483      background: linear-gradient(145deg, rgba(26, 26, 46, 0.95) 0%, rgba(15, 15, 30, 0.98) 100%);
1484      border: 1px solid rgba(229, 184, 76, 0.2);
1485      border-radius: 16px;
1486      overflow: hidden;
1487      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(229, 184, 76, 0.05);
1488    }
1489    .header {
1490      background: linear-gradient(135deg, rgba(229, 184, 76, 0.15) 0%, rgba(229, 184, 76, 0.05) 100%);
1491      border-bottom: 1px solid rgba(229, 184, 76, 0.2);
1492      padding: 32px 24px;
1493      text-align: center;
1494    }
1495    .logo { font-size: 28px; font-weight: 700; color: #e5b84c; letter-spacing: 2px; margin-bottom: 16px; }
1496    .title { font-size: 24px; font-weight: 600; color: #ffffff; margin-bottom: 8px; }
1497    .subtitle { font-size: 14px; color: #a0a0a0; }
1498    .content { padding: 32px 24px; }
1499    .content p { color: #d0d0d0; margin-bottom: 16px; font-size: 15px; }
1500    .content strong { color: #ffffff; }
1501    .cta-container { text-align: center; margin: 32px 0; }
1502    .button {
1503      display: inline-block;
1504      background: linear-gradient(135deg, #e5b84c 0%, #d4a73a 100%);
1505      color: #0a0a0a !important;
1506      text-decoration: none;
1507      padding: 16px 40px;
1508      border-radius: 10px;
1509      font-weight: 700;
1510      font-size: 16px;
1511      letter-spacing: 0.5px;
1512      box-shadow: 0 4px 20px rgba(229, 184, 76, 0.3);
1513    }
1514    .highlight-box {
1515      background: rgba(229, 184, 76, 0.1);
1516      border: 1px solid rgba(229, 184, 76, 0.2);
1517      border-radius: 10px;
1518      padding: 16px;
1519      text-align: center;
1520      margin: 24px 0;
1521    }
1522    .highlight-box p { margin: 0 !important; font-size: 13px; color: #a0a0a0; }
1523    .highlight-box strong { color: #e5b84c; }
1524    .disclaimer {
1525      font-size: 13px;
1526      color: #888;
1527      margin-top: 24px;
1528      padding-top: 16px;
1529      border-top: 1px solid rgba(255, 255, 255, 0.1);
1530    }
1531    .footer {
1532      background: rgba(0, 0, 0, 0.3);
1533      border-top: 1px solid rgba(255, 255, 255, 0.05);
1534      padding: 20px 24px;
1535      text-align: center;
1536    }
1537    .footer p { font-size: 12px; color: #666; margin: 4px 0; }
1538    .link-fallback {
1539      margin-top: 24px;
1540      padding: 16px;
1541      background: rgba(0, 0, 0, 0.2);
1542      border-radius: 8px;
1543      font-size: 12px;
1544      color: #888;
1545      word-break: break-all;
1546    }
1547    .link-fallback a { color: #e5b84c; text-decoration: none; }
1548  </style>
1549</head>
1550<body>
1551  <div class="container">
1552    <div class="card">
1553      <div class="header">
1554        <div style="margin-bottom: 12px;"><img src="https://chessagenda.com/logo.png" alt="Chess Agenda" width="64" height="64" style="display:inline-block;width:64px;height:64px;background:#fff;border-radius:14px;padding:6px;box-shadow:0 4px 16px rgba(229,184,76,0.25);" /></div><div class="logo" style="font-size:22px;">CHESS AGENDA</div>
1555        <h1 class="title">Bienvenue !</h1>
1556        <p class="subtitle">Plus qu'une étape pour activer votre compte</p>
1557      </div>
1558      
1559      <div class="content">
1560        <p>Bonjour <strong>${e.userName}</strong>,</p>
1561        
1562        <p>Merci de vous être inscrit sur Chess Agenda ! Pour activer votre compte et commencer à participer aux tournois d'échecs dans des lieux vivants, cliquez sur le bouton ci-dessous :</p>
1563        
1564        <div class="cta-container">
1565          <a href="${e.confirmationUrl}" class="button">✓ Confirmer mon email</a>
1566        </div>
1567        
1568        <div class="highlight-box">
1569          <p>⏳ Ce lien expire dans <strong>${e.expiresIn}</strong></p>
1570        </div>
1571        
1572        <p class="disclaimer">
1573          Si vous n'avez pas créé de compte sur Chess Agenda, vous pouvez ignorer cet email en toute sécurité.
1574        </p>
1575        
1576        <div class="link-fallback">
1577          <p>Si le bouton ne fonctionne pas, copiez ce lien dans votre navigateur :</p>
1578          <a href="${e.confirmationUrl}">${e.confirmationUrl}</a>
1579        </div>
1580      </div>
1581      
1582      <div class="footer">
1583        <p><strong>Chess Agenda</strong></p>
1584        <p>Tournois d'échecs en lieux vivants</p>
1585        <p style="margin-top: 8px;">Cet email a été envoyé automatiquement, merci de ne pas y répondre.</p>
1586      </div>
1587    </div>
1588  </div>
1589</body>
1590</html>
1591  `;return{subject:t,html:n}}function Myt(e){const t=`🎯 Confirmation inscription - ${e.eventTitle}`,n=`
1592<!DOCTYPE html>
1593<html>
1594<head>
1595  <meta charset="utf-8">
1596  <meta name="viewport" content="width=device-width, initial-scale=1">
1597  <style>${dfe}</style>
1598</head>
1599<body>
1600  <div class="container">
1601    <div class="card">
1602      <div class="header">
1603        <div style="margin-bottom: 12px;"><img src="https://chessagenda.com/logo.png" alt="Chess Agenda" width="64" height="64" style="display:inline-block;width:64px;
1603height:64px;background:#fff;border-radius:14px;padding:6px;box-shadow:0 4px 16px rgba(229,184,76,0.25);" /></div><div class="logo" style="font-size:22px;">CHESS AGENDA</div>
1604        <h1 class="title">Inscription confirmée !</h1>
1605        <p class="subtitle">${e.ticketCount>1?`${e.ticketCount} places réservées`:"1 place réservée"}</p>
1606      </div>
1607      
1608      <div class="content">
1609        <p>Bonjour <strong>${e.playerName}</strong>,</p>
1610        <p>Votre inscription au tournoi a bien été enregistrée. Voici les détails :</p>
1611        
1612        <div class="highlight">
1613          <p style="margin: 0 0 8px; font-weight: 600; color: #ffffff;">${e.eventTitle}</p>
1614          <p style="margin: 0; color: #a0a0a0;">
1615            📅 ${e.eventDate} à ${e.eventTime}<br>
1616            📍 ${e.venueName}<br>
1617            <span style="font-size: 13px;">${e.venueAddress}</span>
1618          </p>
1619        </div>
1620        
1621        <p style="text-align: center; margin: 24px 0 8px;">Votre code de réservation :</p>
1622        <div class="code">${e.reservationCode}</div>
1623        
1624        ${e.creditAmount>0?`
1625        <p style="text-align: center; color: #a0a0a0; font-size: 14px;">
1626          🎁 <strong style="color: #e5b84c;">${e.creditAmount}€</strong> d'avantage food &amp; drinks inclus
1627        </p>
1628        `:""}
1629        
1630        <div style="text-align: center;">
1631          <a href="${e.ticketUrl}" class="button">Voir mon ticket</a>
1632        </div>
1633        
1634        <p style="font-size: 13px; color: #888;">
1635          💡 Présentez votre QR code ou ce code de réservation à l'accueil le jour J.
1636        </p>
1637      </div>
1638      
1639      <div class="footer">
1640        <p>Chess Agenda - Tournois d'échecs en lieux vivants</p>
1641        <p>Cet email a été envoyé automatiquement, merci de ne pas y répondre.</p>
1642      </div>
1643    </div>
1644  </div>
1645</body>
1646</html>
1647  `;return{subject:t,html:n}}function Lyt(e){const t=`🏆 Bienvenue ${e.barName} - Votre demande a été reçue !`,n=`
1648<!DOCTYPE html>
1649<html>
1650<head>
1651  <meta charset="utf-8">
1652  <meta name="viewport" content="width=device-width, initial-scale=1">
1653  <style>${dfe}</style>
1654</head>
1655<body>
1656  <div class="container">
1657    <div class="card">
1658      <div class="header">
1659        <div style="margin-bottom: 12px;"><img src="https://chessagenda.com/logo.png" alt="Chess Agenda" width="64" height="64" style="display:inline-block;width:64px;height:64px;background:#fff;border-radius:14px;padding:6px;box-shadow:0 4px 16px rgba(229,184,76,0.25);" /></div><div class="logo" style="font-size:22px;">CHESS AGENDA</div>
1660        <h1 class="title">Bienvenue parmi nous !</h1>
1661        <p class="subtitle">Votre demande de partenariat a été reçue</p>
1662      </div>
1663      
1664      <div class="content">
1665        <p>Bonjour <strong>${e.contactName}</strong>,</p>
1666        
1667        <p>Merci d'avoir créé un compte pour <strong>${e.barName}</strong> sur Chess Agenda ! 
1668        Nous sommes ravis de vous compter parmi nos futurs partenaires.</p>
1669        
1670        <div class="highlight">
1671          <p style="margin: 0 0 8px; font-weight: 600; color: #ffffff;">📋 Récapitulatif de votre demande</p>
1672          <p style="margin: 0; color: #a0a0a0;">
1673            🏪 ${e.barName}<br>
1674            📍 ${e.barAddress}<br>
1675            📅 Soumise le ${e.requestDate}
1676          </p>
1677        </div>
1678        
1679        <p style="font-weight: 600; color: #ffffff;">Prochaines étapes :</p>
1680        
1681        <ol style="color: #e0e0e0; padding-left: 20px; line-height: 1.8;">
1682          <li><strong>Validation</strong> - Notre équipe examine votre demande (24-48h)</li>
1683          <li><strong>Activation</strong> - Une fois approuvé, vous recevrez un email de confirmation</li>
1684          <li><strong>Configuration</strong> - Accédez à votre espace pour créer votre premier tournoi</li>
1685          <li><strong>Lancement</strong> - Publiez et accueillez vos premiers joueurs !</li>
1686        </ol>
1687        
1688        <p style="font-size: 14px; color: #a0a0a0;">
1689          💡 <strong>Astuce :</strong> En attendant, vous pouvez découvrir les tournois existants 
1690          sur notre plateforme pour vous familiariser avec le concept.
1691        </p>
1692        
1693        <div style="text-align: center; margin-top: 24px;">
1694          <a href="https://chessagenda.com/events" class="button">
1695            Découvrir les événements
1696          </a>
1697        </div>
1698      </div>
1699      
1700      <div class="footer">
1701        <p>Chess Agenda - Tournois d'échecs en lieux vivants</p>
1702        <p>Des questions ? Répondez simplement à cet email.</p>
1703      </div>
1704    </div>
1705  </div>
1706</body>
1707</html>
1708  `;return{subject:t,html:n}}function Fyt(e){const t="🎉 Félicitations ! Votre partenariat Chess Agenda est activé",n=e.adminNotes?`
1709        <div style="background: rgba(229, 184, 76, 0.1); border: 1px solid rgba(229, 184, 76, 0.2); border-radius: 10px; padding: 16px; margin: 24px 0;">
1710          <p style="margin: 0 0 8px; font-size: 13px; color: #a0a0a0;">📝 Note de l'équipe :</p>
1711          <p style="margin: 0;
1711 color: #e0e0e0; font-style: italic;">"${e.adminNotes}"</p>
1712        </div>
1713      `:"",r=`
1714<!DOCTYPE html>
1715<html lang="fr">
1716<head>
1717  <meta charset="utf-8">
1718  <meta name="viewport" content="width=device-width, initial-scale=1">
1719  <meta name="color-scheme" content="dark">
1720  <title>Partenariat activé</title>
1721  <style>
1722    * { margin: 0; padding: 0; box-sizing: border-box; }
1723    body {
1724      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
1725      background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
1726      color: #e0e0e0;
1727      line-height: 1.6;
1728      -webkit-font-smoothing: antialiased;
1729      padding: 20px;
1730    }
1731    .container { max-width: 520px; margin: 0 auto; }
1732    .card {
1733      background: linear-gradient(145deg, rgba(26, 26, 46, 0.95) 0%, rgba(15, 15, 30, 0.98) 100%);
1734      border: 1px solid rgba(229, 184, 76, 0.2);
1735      border-radius: 16px;
1736      overflow: hidden;
1737      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(229, 184, 76, 0.05);
1738    }
1739    .header {
1740      background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0.05) 100%);
1741      border-bottom: 1px solid rgba(34, 197, 94, 0.3);
1742      padding: 32px 24px;
1743      text-align: center;
1744    }
1745    .logo { font-size: 28px; font-weight: 700; color: #e5b84c; letter-spacing: 2px; margin-bottom: 16px; }
1746    .title { font-size: 26px; font-weight: 600; color: #22c55e; margin-bottom: 8px; }
1747    .subtitle { font-size: 16px; color: #ffffff; font-weight: 500; }
1748    .content { padding: 32px 24px; }
1749    .content p { color: #d0d0d0; margin-bottom: 16px; font-size: 15px; }
1750    .content strong { color: #ffffff; }
1751    .success-box {
1752      background: rgba(34, 197, 94, 0.15);
1753      border: 1px solid rgba(34, 197, 94, 0.3);
1754      border-radius: 12px;
1755      padding: 20px;
1756      margin: 24px 0;
1757    }
1758    .success-box .check { color: #22c55e; font-size: 18px; margin-right: 8px; }
1759    .success-box .venue-name { color: #ffffff; font-weight: 600; font-size: 18px; margin: 8px 0 4px; }
1760    .success-box .venue-address { color: #a0a0a0; font-size: 14px; margin: 4px 0; }
1761    .success-box .approval-date { color: #888; font-size: 13px; margin-top: 12px; }
1762    .steps { margin: 28px 0; }
1763    .steps-title { color: #ffffff; font-weight: 600; font-size: 16px; margin-bottom: 16px; }
1764    .step { display: flex; align-items: flex-start; margin-bottom: 14px; }
1765    .step-number {
1766      background: linear-gradient(135deg, #e5b84c 0%, #d4a73a 100%);
1767      color: #0a0a0a;
1768      width: 24px;
1769      height: 24px;
1770      border-radius: 50%;
1771      display: flex;
1772      align-items: center;
1773      justify-content: center;
1774      font-size: 13px;
1775      font-weight: 700;
1776      margin-right: 12px;
1777      flex-shrink: 0;
1778    }
1779    .step-text { color: #d0d0d0; font-size: 14px; }
1780    .cta-container { text-align: center; margin: 32px 0; }
1781    .button {
1782      display: inline-block;
1783      background: linear-gradient(135deg, #e5b84c 0%, #d4a73a 100%);
1784      color: #0a0a0a !important;
1785      text-decoration: none;
1786      padding: 16px 40px;
1787      border-radius: 10px;
1788      font-weight: 700;
1789      font-size: 16px;
1790      letter-spacing: 0.5px;
1791      box-shadow: 0 4px 20px rgba(229, 184, 76, 0.3);
1792    }
1793    .help-text {
1794      font-size: 13px;
1795      color: #888;
1796      text-align: center;
1797      margin-top: 24px;
1798      padding-top: 16px;
1799      border-top: 1px solid rgba(255, 255, 255, 0.1);
1800    }
1801    .footer {
1802      background: rgba(0, 0, 0, 0.3);
1803      border-top: 1px solid rgba(255, 255, 255, 0.05);
1804      padding: 20px 24px;
1805      text-align: center;
1806    }
1807    .footer p { font-size: 12px; color: #666; margin: 4px 0; }
1808  </style>
1809</head>
1810<body>
1811  <div class="container">
1812    <div class="card">
1813      <div class="header">
1814        <div style="margin-bottom: 12px;"><img src="https://chessagenda.com/logo.png" alt="Chess Agenda" width="64" height="64" style="display:inline-block;width:64px;height:64px;background:#fff;border-radius:14px;padding:6px;box-shadow:0 4px 16px rgba(229,184,76,0.25);" /></div><div class="logo" style="font-size:22px;">CHESS AGENDA</div>
1815        <h1 class="title">🎉 Félicitations !</h1>
1816        <p class="subtitle">Votre partenariat est activé</p>
1817      </div>
1818      
1819      <div class="content">
1820        <p>
1820Bonjour <strong>${e.contactName}</strong>,</p>
1821        
1822        <p>Excellente nouvelle ! Votre demande de partenariat a été approuvée. Votre établissement fait désormais partie du réseau Chess Agenda !</p>
1823        
1824        <div class="success-box">
1825          <span class="check">✅</span><strong style="color: #22c55e;">Partenariat activé</strong>
1826          <p class="venue-name">🏪 ${e.barName}</p>
1827          <p class="venue-address">📍 ${e.barAddress}</p>
1828          <p class="approval-date">📅 Approuvé le ${e.approvalDate}</p>
1829        </div>
1830        
1831        ${n}
1832        
1833        <div class="steps">
1834          <p class="steps-title">🚀 Prochaines étapes :</p>
1835          
1836          <div class="step">
1837            <span class="step-number">1</span>
1838            <span class="step-text"><strong>Accédez</strong> à votre espace partenaire</span>
1839          </div>
1840          
1841          <div class="step">
1842            <span class="step-number">2</span>
1843            <span class="step-text"><strong>Configurez</strong> votre catalogue de produits (boissons, snacks...)</span>
1844          </div>
1845          
1846          <div class="step">
1847            <span class="step-number">3</span>
1848            <span class="step-text"><strong>Créez</strong> votre premier tournoi et publiez-le !</span>
1849          </div>
1850        </div>
1851        
1852        <div class="cta-container">
1853          <a href="${e.venueDashboardUrl}" class="button">Accéder à mon espace</a>
1854        </div>
1855        
1856        <p class="help-text">
1857          💡 Besoin d'aide pour démarrer ? Répondez simplement à cet email, notre équipe vous accompagne.
1858        </p>
1859      </div>
1860      
1861      <div class="footer">
1862        <p><strong>Chess Agenda</strong></p>
1863        <p>Tournois d'échecs en lieux vivants</p>
1864      </div>
1865    </div>
1866  </div>
1867</body>
1868</html>
1869  `;return{subject:t,html:r}}function $yt(e,t,n){if(e==="preregistration_confirmation")return zyt(t,n);if(e==="preregistration_reminder_72h")return Uyt(t,n);if(e==="preregistration_reminder_48h_before")return qyt(t,n);if(e==="payment_link")return Hyt(t,n);if(e==="abandoned_checkout"||e==="abandoned_checkout_72h"||e==="abandoned_checkout_48h_before")return Vyt(t,n,e);if(e==="badge_unlocked")return Qyt(t,n);if(e==="event_gallery_ready")return Jyt(t,n);const r=Byt(e,t),i=Iyt(r,e,n,t);return{subject:i.subject,html:i.html}}function Byt(e,t){switch(e){case"email_confirmation":return Ryt(t);case"ticket_confirmation":return Myt(t);case"venue_welcome":return Lyt(t);case"venue_approved":return Fyt(t);case"event_reminder":return Wyt(t);case"password_reset":return Gyt(t);case"email_change":return Kyt(t);case"magic_link":return Yyt(t);case"account_created":return Xyt(t);default:return{subject:"Template inconnu",html:`
1870          <html>
1871          <body style="background: #1a1a2e; color: #e0e0e0; font-family: sans-serif; padding: 40px; text-align: center;">
1872            <h1 style="color: #e5b84c;">⚠️ Template non trouvé</h1>
1873            <p>Le template "${e}" n'existe pas dans le registre.</p>
1874          </body>
1875          </html>
1876        `}}}function At(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function en(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>{const i=t[r];return i==null||i===""?n:String(i)})}function Ir(e,t){return e.split(/(\{\w+\})/g).map(n=>{const r=/^\{(\w+)\}$/.exec(n);if(!r)return At(n);const i=t[r[1]];return i==null||i===""?At(n):`<strong>${At(String(i))}</strong>`}).join("")}function zyt(e,t){const n={firstName:String(e.firstName??""),eventTitle:String(e.eventTitle??""),eventDateLabel:String(e.eventDateLabel??""),venueName:String(e.venueName??"")},r=typeof e.magicLinkUrl=="string"?e.magicLinkUrl:"https://chessagenda.com/auth/callback?token=demo",i=kp("preregistration_confirmation",t??null),a=en(i.subject,n),o=At(en(i.eyebrow,n)),l=At(en(i.headline,n)),c=Ir(i.greeting,n),u=Ir(i.intro,n),d=Ir(i.info_box,n),f=At(en(i.cta_label,n)),h=At(en(i.cta_hint,n)),p=en(i.signature,n).split(`
1877`).map(At).join("<br/>"),x=`<div style="margin:24px 0 0 0;text-align:center;">
1878    <a href="${r}" style="display:inline-block;background:#0D0D0D;color:#AAFF00;text-decoration:none;padding:14px 28px;border-radius:999px;font-weight:700;font-size:15px;letter-spacing:0.02em;">${f}</a>
1879    <p style="margin:12px 0 0 0;font-size:12px;color:rgba(13,13,13,0.55);">${h}</p>
1880  </div>`,y=`<!DOCTYPE html>
1881<html lang="fr"><head><meta charset="utf-8"><title>${At(a)}</title></head>
1882<body style="margin:0;padding:24px;background:#F5F3EE;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;color:#0D0D0D;">
1883  <div style="max-width:520px;margin:0 auto;background:#ffffff;border-radius:16px;padding:32px;border:1px solid rgba(13,13,13,0.08);">
1884    <div style="font-size:11px;letter-spacing:0.22em;color:rgba(13,13,13,0.55);text-transform:uppercase;font-family:'Fragment Mono',ui-monospace,monospace;">${o}</div>
1885    <h1 style="font-size:28px;font-weight:900;line-height:1.05;margin:12px 0 8px 0;letter-spacing:-0.02em;">${l}</h1>
1886    <p style="font-size:16px;line-height:1.5;margin:16px 0;">${c}</p>
1887    <p style="font-size:16px;line-height:1.5;margin:16px 0;">${u}</p>
1888    <div style="background:#F5F3EE;border-radius:12px;padding:16px;margin:24px 0;">
1889      <p style="margin:0;font-size:14px;line-height:1.5;">${d}</p>
1890    </div>
1891    ${x}
1892    <p style="font-size:14px;color:rgba(13,13,13,0.6);margin:24px 0 0 0;">${p}</p>
1893  </div>
1894</body></html>`;return{subject:a,html:y}}function Uyt(e,t){const n={firstName:String(e.firstName??""),eventTitle:String(e.eventTitle??""),eventDateLabel:String(e.eventDateLabel??""),venueName:String(e.venueName??""),priceLabel:String(e.priceLabel??""),spotsLeft:String(e.spotsLeft??"")},r=typeof e.payUrl=="string"?e.payUrl:"https://chessagenda.com/events/demo/register",i=typeof e.extendUrl=="string"?e.extendUrl:"https://chessagenda.com/prereg/extend?token=demo",a=typeof e.releaseUrl=="string"?e.releaseUrl:"https://chessagenda.com/prereg/release?token=demo",o=kp("preregistration_reminder_72h",t??null),l=en(o.subject,n),c=At(en(o.eyebrow,n)),u=At(en(o.headline,n)),d=Ir(o.greeting,n),f=Ir(o.intro,n),h=Ir(o.urgency_line,n),p=At(en(o.cta_label,n)),x=At(en(o.cta_hint,n)),y=At(en(o.extend_label,n)),b=At(en(o.release_label,n)),w=en(o.signature,n).split(`
1895`).map(At).join("<br/>"),_=n.spotsLeft?`<div style="display:inline-block;background:#FFF3CD;color:#7A4A00;border:1px solid #F0C36D;padding:6px 12px;border-radius:999px;font-size:12px;font-weight:600;margin-bottom:16px;">Plus que ${At(n.spotsLeft)} place${Number(n.spotsLeft)>1?"s":""}</div>`:"",j=`<!DOCTYPE html>
1896<html lang="fr"><head><meta charset="utf-8"><title>${At(l)}</title></head>
1897<body style="margin:0;padding:24px;background:#F5F3EE;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;color:#0D0D0D;">
1898  <div style="max-width:520px;margin:0 auto;background:#ffffff;border-radius:16px;padding:32px;border:1px solid rgba(13,13,13,0.08);">
1899    <div style="font-size:11px;letter-spacing:0.22em;color:rgba(13,13,13,0.55);text-transform:uppercase;font-family:'Fragment Mono',ui-monospace,monospace;">${c}</div>
1900    <h1 style="font-size:28px;font-weight:900;line-height:1.05;margin:12px 0 8px 0;letter-spacing:-0.02em;">${u}</h1>
1901    <p style="font-size:16px;line-height:1.5;margin:16px 0 8px 0;">${d}</p>
1902    <p style="font-size:16px;line-height:1.5;margin:8px 0 16px 0;">${f}</p>
1903    ${_}
1904    <p style="font-size:15px;line-height:1.5;margin:8px 0 24px 0;color:#0D0D0D;font-weight:600;">${h}</p>
1905    <div style="text-align:center;margin:28px 0 8px 0;">
1906      <a href="${r}" style="display:inline-block;background:#AAFF00;color:#0D0D0D;text-decoration:none;padding:18px 32px;border-radius:999px;font-weight:800;font-size:17px;letter-spacing:0.01em;box-shadow:0 4px 0 #0D0D0D,0 8px 24px rgba(0,0,0,0.12);">${p}</a>
1907      <p style="margin:14px 0 0 0;font-size:12px;color:rgba(13,13,13,0.55);">${x}${n.priceLabel?` — <strong>${At(n.priceLabel)}</strong>`:""}</p>
1908    </div>
1909    <div style="border-top:1px solid rgba(13,13,13,0.08);margin:32px 0 0 0;padding-top:20px;text-align:center;">
1910      <p style="margin:0 0 10px 0;font-size:13px;"><a href="${i}" style="color:rgba(13,13,13,0.6);text-decoration:underline;">${y}</a></p>
1911      <p style="margin:0;font-size:13px;"><a href="${a}" style="color:rgba(13,13,13,0.5);text-decoration:underline;">${b}</a></p>
1912    </div>
1913    <p style="font-size:14px;color:rgba(13,13,13,0.6);margin:28px 0 0 0;">${w}</p>
1914  </div>
1915</body></html>`;return{subject:l,html:j}}function qyt(e,t){const n={firstName:String(e.firstName??""),eventTitle:String(e.eventTitle??""),eventDateLabel:String(e.eventDateLabel??""),venueName:String(e.venueName??""),priceLabel:String(e.priceLabel??""),spotsLeft:String(e.spotsLeft??"")},r=typeof e.payUrl=="string"?e.payUrl:"https://chessagenda.com/events/demo/register",i=typeof e.releaseUrl=="string"?e.releaseUrl:"https://chessagenda.com/prereg/release?token=demo",a=kp("preregistration_reminder_48h_before",t??null),o=en(a.subject,n),l=At(en(a.eyebrow,n)),c=At(en(a.headline,n)),u=Ir(a.greeting,n),d=Ir(a.intro,n),f=Ir(a.countdown_line,n),h=Ir(a.urgency_line,n),p=At(en(a.cta_label,n)),x=At(en(a.cta_hint,n)),y=At(en(a.release_label,n)),b=en(a.signature,n).split(`
1916`).map(At).join("<br/>"),w=n.spotsLeft?`<div style="display:inline-block;background:#FEE2E2;
1916color:#7F1D1D;border:1px solid #FCA5A5;padding:6px 12px;border-radius:999px;font-size:12px;font-weight:700;margin-bottom:16px;">🔥 Plus que ${At(n.spotsLeft)} place${Number(n.spotsLeft)>1?"s":""}</div>`:'<div style="display:inline-block;background:#FFF3CD;color:#7A4A00;border:1px solid #F0C36D;padding:6px 12px;border-radius:999px;font-size:12px;font-weight:600;margin-bottom:16px;">Il reste des places</div>',_=`<div style="background:#F5F3EE;border-left:3px solid #AAFF00;padding:14px 16px;border-radius:8px;margin:20px 0;">
1917    <div style="font-size:11px;letter-spacing:0.18em;text-transform:uppercase;color:rgba(13,13,13,0.55);font-family:'Fragment Mono',ui-monospace,monospace;margin-bottom:4px;">Rendez-vous</div>
1918    <div style="font-size:16px;font-weight:800;color:#0D0D0D;">${At(n.eventDateLabel)}</div>
1919    <div style="font-size:14px;color:rgba(13,13,13,0.7);margin-top:2px;">${At(n.venueName)}</div>
1920  </div>`,j=`<!DOCTYPE html>
1921<html lang="fr"><head><meta charset="utf-8"><title>${At(o)}</title></head>
1922<body style="margin:0;padding:24px;background:#F5F3EE;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;color:#0D0D0D;">
1923  <div style="max-width:520px;margin:0 auto;background:#ffffff;border-radius:16px;padding:32px;border:1px solid rgba(13,13,13,0.08);">
1924    <div style="font-size:11px;letter-spacing:0.22em;color:rgba(13,13,13,0.55);text-transform:uppercase;font-family:'Fragment Mono',ui-monospace,monospace;">${l}</div>
1925    <h1 style="font-size:28px;font-weight:900;line-height:1.05;margin:12px 0 8px 0;letter-spacing:-0.02em;">${c}</h1>
1926    <p style="font-size:16px;line-height:1.5;margin:16px 0 8px 0;">${u}</p>
1927    <p style="font-size:16px;line-height:1.5;margin:8px 0 12px 0;">${d}</p>
1928    ${_}
1929    ${w}
1930    <p style="font-size:15px;line-height:1.5;margin:6px 0 6px 0;color:#0D0D0D;">${f}</p>
1931    <p style="font-size:15px;line-height:1.5;margin:6px 0 24px 0;color:#0D0D0D;font-weight:600;">${h}</p>
1932    <div style="text-align:center;margin:28px 0 8px 0;">
1933      <a href="${r}" style="display:inline-block;background:#AAFF00;color:#0D0D0D;text-decoration:none;padding:18px 32px;border-radius:999px;font-weight:800;font-size:17px;letter-spacing:0.01em;box-shadow:0 4px 0 #0D0D0D,0 8px 24px rgba(0,0,0,0.12);">${p}</a>
1934      <p style="margin:14px 0 0 0;font-size:12px;color:rgba(13,13,13,0.55);">${x}${n.priceLabel?` — <strong>${At(n.priceLabel)}</strong>`:""}</p>
1935    </div>
1936    <div style="border-top:1px solid rgba(13,13,13,0.08);margin:32px 0 0 0;padding-top:20px;text-align:center;">
1937      <p style="margin:0;font-size:13px;"><a href="${i}" style="color:rgba(13,13,13,0.5);text-decoration:underline;">${y}</a></p>
1938    </div>
1939    <p style="font-size:14px;color:rgba(13,13,13,0.6);margin:28px 0 0 0;">${b}</p>
1940  </div>
1941</body></html>`;return{subject:o,html:j}}function Vyt(e,t,n="abandoned_checkout"){const r={firstName:String(e.firstName??""),eventTitle:String(e.eventTitle??""),eventDateLabel:String(e.eventDateLabel??""),venueName:String(e.venueName??""),priceLabel:String(e.priceLabel??""),spotsLeft:String(e.spotsLeft??"")},i=typeof e.resumeUrl=="string"?e.resumeUrl:"https://chessagenda.com/events/demo/register",a=typeof e.releaseUrl=="string"?e.releaseUrl:"https://chessagenda.com/prereg/release?token=demo",o=kp(n,t??null),l=en(o.subject,r),c=At(en(o.eyebrow,r)),u=At(en(o.headline,r)),d=Ir(o.greeting,r),f=Ir(o.intro,r),h=Ir(o.reassurance_line,r),p=At(en(o.cta_label,r)),x=At(en(o.cta_hint,r)),y=At(en(o.release_label,r)),b=en(o.signature,r).split(`
1942`).map(At).join("<br/>"),w=r.spotsLeft?`<div style="display:inline-block;background:#FFF3CD;color:#7A4A00;border:1px solid #F0C36D;padding:6px 12px;border-radius:999px;font-size:12px;font-weight:600;margin-bottom:16px;">Plus que ${At(r.spotsLeft)} place${Number(r.spotsLeft)>1?"s":""}</div>`:"",_=`<!DOCTYPE html>
1943<html lang="fr"><head><meta charset="utf-8"><title>${At(l)}</title></head>
1944<body style="margin:0;padding:24px;background:#F5F3EE;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;color:#0D0D0D;">
1945  <div style="max-width:520px;margin:0 auto;background:#ffffff;border-radius:16px;padding:32px;border:1px solid rgba(13,13,13,0.08);">
1946    <div style="font-size:11px;letter-spacing:0.22em;color:rgba(13,13,13,0.55);text-transform:uppercase;font-family:'Fragment Mono',ui-monospace,monospace;">${c}</div>
1947    <h1 style="font-size:28px;font-weight:900;line-height:1.05;margin:12px 0 8px 0;letter-spacing:-0.02em;">${u}</h1>
1948    <p style="font-size:16px;line-height:1.5;margin:16px 0 8px 0;">${d}</p>
1949    <p style="font-size:16px;line-height:1.5;margin:8px 0 16px 0;">${f}</p>
1950    ${w}
1951    <p style="font-size:15px;line-height:1.5;margin:8px 0 24px 0;color:rgba(13,13,13,0.75);">${h}</p>
1952    <div style="text-align:center;margin:28px 0 8px 0;">
1953      <a href="${i}" style="display:inline-block;background:#AAFF00;color:#0D0D0D;text-decoration:none;padding:18px 32px;border-radius:999px;font-weight:800;font-size:17px;letter-spacing:0.01em;box-shadow:0 4px 0 #0D0D0D,0 8px 24px rgba(0,0,0,0.12);">${p}</a>
1954      <p style="margin:14px 0 0 0;font-size:12px;color:rgba(13,13,13,0.55);">${x}${r.priceLabel?` — <strong>${At(r.priceLabel)}</strong>`:""}</p>
1955    </div>
1956    <div style="border-top:1px solid rgba(13,13,13,0.08);margin:32px 0 0 0;padding-top:20px;text-align:center;">
1957      <p style="margin:0;font-size:13px;"><a href="${a}" style="color:rgba(13,13,13,0.5);text-decoration:underline;">${y}</a></p>
1958    </div>
1959    <p style="font-size:14px;color:rgba(13,13,13,0.6);margin:28px 0 0 0;">${b}</p>
1960  </div>
1961</body></html>`;return{subject:l,html:_}}function Hyt(e,t){const n={firstName:String(e.firstName??""),eventTitle:String(e.eventTitle??""),eventDateLabel:String(e.eventDateLabel??""),venueName:String(e.venueName??""),priceLabel:String(e.priceLabel??""),perkLabel:String(e.perkLabel??""),expiryLabel:String(e.expiryLabel??"")},r=typeof e.payUrl=="string"?e.payUrl:"https://checkout.stripe.com/demo",i=kp("payment_link",t??null),a=en(i.subject,n),o=At(en(i.eyebrow,n)),l=At(en(i.headline,n)),c=Ir(i.greeting,n),u=Ir(i.intro,n),d=Ir(i.info_box,n),f=At(en(i.cta_label,n)),h=At(en(i.cta_hint,n)),p=At(en(i.expiry_note,n)),x=en(i.signature,n).split(`
1962`).map(At).join("<br/>"),y=`<!DOCTYPE html>
1963<html lang="fr"><head><meta charset="utf-8"><title>${At(a)}</title></head>
1964<body style="margin:0;padding:24px;background:#F5F3EE;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;color:#0D0D0D;">
1965  <div style="max-width:520px;margin:0 auto;background:#ffffff;border-radius:16px;padding:32px;border:1px solid rgba(13,13,13,0.08);">
1966    <div style="font-size:11px;letter-spacing:0.22em;color:rgba(13,13,13,0.55);text-transform:uppercase;font-family:'Fragment Mono',ui-monospace,monospace;">${o}</div>
1967    <h1 style="font-size:28px;font-weight:900;line-height:1.05;margin:12px 0 8px 0;letter-spacing:-0.02em;">${l}</h1>
1968    <p style="font-size:16px;line-height:1.5;margin:16px 0 8px 0;">${c}</p>
1969    <p style="font-size:16px;line-height:1.5;margin:8px 0 16px 0;">${u}</p>
1970    <div style="background:#F5F3EE;border-radius:12px;padding:16px;margin:20px 0;">
1971      <p style="margin:0;font-size:14px;line-height:1.6;">${d}</p>
1972    </div>
1973    <div style="text-align:center;margin:28px 0 8px 0;">
1974      <a href="${r}" style="display:inline-block;background:#AAFF00;color:#0D0D0D;text-decoration:none;padding:18px 32px;border-radius:999px;font-weight:800;font-size:17px;letter-spacing:0.01em;box-shadow:0 4px 0 #0D0D0D,0 8px 24px rgba(0,0,0,0.12);">${f}</a>
1975      <p style="margin:14px 0 0 0;font-size:12px;color:rgba(13,13,13,0.55);">${h}</p>
1976      <p style="margin:6px 0 0 0;font-size:12px;color:rgba(13,13,13,0.45);">${p}</p>
1977    </div>
1978    <p style="font-size:14px;color:rgba(13,13,13,0.6);margin:28px 0 0 0;">${x}</p>
1979  </div>
1980</body></html>`;return{subject:a,html:y}}function Wyt(e){const t=`⏰ Rappel : ${e.eventTitle} demain à ${e.eventTime}`,n=`
1981<!DOCTYPE html>
1982<html lang="fr">
1983<head>
1984  <meta charset="utf-8">
1985  <meta name="viewport" content="width=device-width, initial-scale=1">
1986  <meta name="color-scheme" content="dark">
1987  <title>Rappel Tournoi</title>
1988  <style>
1989    * { margin: 0; padding: 0; box-sizing: border-box; }
1990    body {
1991      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
1992      background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
1993      color: #e0e0e0;
1994      line-height: 1.6;
1995      -webkit-font-smoothing: antialiased;
1996      padding: 20px;
1997    }
1998    .container { max-width: 520px; margin: 0 auto; }
1999    .card {
2000      background: linear-gradient(145deg, rgba(26, 26, 46, 0.95) 0%, rgba(15, 15, 30, 0.98) 100%);
2001      border: 1px solid rgba(229, 184, 76, 0.2);
2002      border-radius: 16px;
2003      overflow: hidden;
2004      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(229, 184, 76, 0.05);
2005    }
2006    .header {
2007      background: linear-gradient(135deg, rgba(251, 146, 60, 0.2) 0%, rgba(251, 146, 60, 0.05) 100%);
2008      border-bottom: 1px solid rgba(251, 146, 60, 0.3);
2009      padding: 32px 24px;
2010      text-align: center;
2011    }
2012    .logo { font-size: 28px; font-weight: 700; color: #e5b84c; letter-spacing: 2px; margin-bottom: 16px; }
2013    .title { font-size: 24px; font-weight: 600; color: #fb923c; margin-bottom: 8px; }
2014    .subtitle { font-size: 16px; color: #ffffff; font-weight: 500; }
2015    .content { padding: 32px 24px; }
2016    .content p { color: #d0d0d0; margin-bottom: 16px; font-size: 15px; }
2017    .content strong { color: #ffffff; }
2018    .event-box {
2019      background: rgba(229, 184, 76, 0.1);
2020      border: 1px solid rgba(229, 184, 76, 0.25);
2021      border-radius: 12px;
2022      padding: 24px;
2023      margin: 24px 0;
2024    }
2025    .event-title { color: #ffffff; font-weight: 700; font-size: 20px; margin-bottom: 16px; text-align: center; }
2026    .event-detail { display: flex; align-items: flex-start; margin-bottom: 12px; }
2027    .event-detail .icon { font-size: 18px; margin-right: 12px; flex-shrink: 0; }
2028    .event-detail .text { color: #d0d0d0; font-size: 15px; }
2029    .event-detail .text strong { color: #ffffff; }
2030    .code-box {
2031      background: rgba(0, 0, 0, 0.3);
2032      border: 2px dashed rgba(229, 184, 76, 0.4);
2033      border-radius: 10px;
2034      padding: 20px;
2035      text-align: center;
2036      margin: 24px 0;
2037    }
2038    .code-label { color: #a0a0a0; font-size: 13px; margin-bottom: 8px; }
2039    .code-value { font-family: 'SF Mono', Monaco, monospace; font-size: 28px; font-weight: 700; color: #e5b84c; letter-spacing: 4px; }
2040    .checklist {
2041      background: rgba(34, 197, 94, 0.1);
2042      border: 1px solid rgba(34, 197, 94, 0.2);
2043      border-radius: 10px;
2044      padding: 20px;
2045      margin: 24px 0;
2046    }
2047    .checklist-title { color: #22c55e; font-weight: 600; font-size: 15px; margin-bottom: 12px; }
2048    .checklist-item { color: #d0d0d0; font-size: 14px; margin-bottom: 8px; padding-left: 24px; position: relative; }
2049    .checklist-item::before { content: "✓"; position: absolute; left: 0; color: #22c55e; font-weight: 700; }
2050    .cta-container { text-align: center; margin: 32px 0; }
2051    .button {
2052      display: inline-block;
2053      background: linear-gradient(135deg, #e5b84c 0%, #d4a73a 100%);
2054      color: #0a0a0a !important;
2055      text-decoration: none;
2056      padding: 16px 40px;
2057      border-radius: 10px;
2058      font-weight: 700;
2059      font-size: 16px;
2060      letter-spacing: 0.5px;
2061      box-shadow: 0 4px 20px rgba(229, 184, 76, 0.3);
2062    }
2063    .credit-badge {
2064      display: inline-block;
2065      background: rgba(229, 184, 76, 0.2);
2066      border: 1px solid rgba(229, 184, 76, 0.3);
2067      border-radius: 20px;
2068      padding: 8px 16px;
2069      color: #e5b84c;
2070      font-weight: 600;
2071      font-size: 14px;
2072      margin-top: 12px;
2073    }
2074    .footer {
2075      background: rgba(0, 0, 0, 0.3);
2076      border-top: 1px solid rgba(255, 255, 255, 0.05);
2077      padding: 20px 24px;
2078      text-align: center;
2079    }
2080    .footer p { font-size: 12px; color: #666; margin: 4px 0; }
2081  </style>
2082</head>
2083<body>
2084  <div class="container">
2085    <div class="card">
2086      <div class="header">
2087        <div style="margin-bottom: 12px;"><img src="https://chessagenda.com/logo.png" alt="Chess Agenda" width="64" height="64" style="display:inline-block;width:64px;height:64px;background:#fff;border-radius:14px;padding:6px;box-shadow:0 4px 16px rgba(229,184,76,0.25);" /></div><div class="logo" style="font-size:22px;">CHESS AGENDA</div>
2088        <h1 class="title">⏰ C'est demain !</h1>
2089        <p class="subtitle">N'oubliez pas votre tournoi</p>
2090      </div>
2091      
2092      <div class="content">
2093        <p>
2093Bonjour <strong>${e.playerName}</strong>,</p>
2094        
2095        <p>Votre tournoi d'échecs a lieu <strong>demain</strong> ! Voici un rappel des informations essentielles :</p>
2096        
2097        <div class="event-box">
2098          <p class="event-title">♟ ${e.eventTitle}</p>
2099          
2100          <div class="event-detail">
2101            <span class="icon">📅</span>
2102            <span class="text"><strong>${e.eventDate}</strong></span>
2103          </div>
2104          
2105          <div class="event-detail">
2106            <span class="icon">🕐</span>
2107            <span class="text">Début à <strong>${e.eventTime}</strong></span>
2108          </div>
2109          
2110          <div class="event-detail">
2111            <span class="icon">📍</span>
2112            <span class="text"><strong>${e.venueName}</strong><br>${e.venueAddress}</span>
2113          </div>
2114          
2115          ${e.creditAmount>0?`
2116          <div style="text-align: center; margin-top: 16px;">
2117            <span class="credit-badge">🎁 ${e.creditAmount}€ d'avantage food &amp; drinks inclus</span>
2118          </div>
2119          `:""}
2120        </div>
2121        
2122        <div class="code-box">
2123          <p class="code-label">Votre code de réservation</p>
2124          <p class="code-value">${e.reservationCode}</p>
2125        </div>
2126        
2127        <div class="checklist">
2128          <p class="checklist-title">📋 Check-list avant de partir :</p>
2129          <p class="checklist-item">Téléphone chargé (pour le QR code)</p>
2130          <p class="checklist-item">Arrivez 10-15 min avant le début</p>
2131          <p class="checklist-item">Présentez votre QR code à l'accueil</p>
2132        </div>
2133        
2134        <div class="cta-container">
2135          <a href="${e.ticketUrl}" class="button">Voir mon ticket</a>
2136        </div>
2137        
2138        <p style="font-size: 13px; color: #888; text-align: center; margin-top: 24px;">
2139          💡 Empêché ? Pensez à annuler votre inscription pour libérer votre place.
2140        </p>
2141      </div>
2142      
2143      <div class="footer">
2144        <p><strong>Chess Agenda</strong></p>
2145        <p>Tournois d'échecs en lieux vivants</p>
2146        <p style="margin-top: 8px;">À demain ! ♟</p>
2147      </div>
2148    </div>
2149  </div>
2150</body>
2151</html>
2152  `;return{subject:t,html:n}}function Gyt(e){const t="🔐 Réinitialisation de mot de passe - Chess Agenda",n=`
2153<!DOCTYPE html>
2154<html lang="fr">
2155<head>
2156  <meta charset="utf-8">
2157  <meta name="viewport" content="width=device-width, initial-scale=1">
2158  <meta name="color-scheme" content="dark">
2159  <title>Réinitialisation de mot de passe</title>
2160  <style>
2161    * { margin: 0; padding: 0; box-sizing: border-box; }
2162    body {
2163      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
2164      background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
2165      color: #e0e0e0;
2166      line-height: 1.6;
2167      -webkit-font-smoothing: antialiased;
2168      padding: 20px;
2169    }
2170    .container { max-width: 520px; margin: 0 auto; }
2171    .card {
2172      background: linear-gradient(145deg, rgba(26, 26, 46, 0.95) 0%, rgba(15, 15, 30, 0.98) 100%);
2173      border: 1px solid rgba(229, 184, 76, 0.2);
2174      border-radius: 16px;
2175      overflow: hidden;
2176      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(229, 184, 76, 0.05);
2177    }
2178    .header {
2179      background: linear-gradient(135deg, rgba(229, 184, 76, 0.15) 0%, rgba(229, 184, 76, 0.05) 100%);
2180      border-bottom: 1px solid rgba(229, 184, 76, 0.2);
2181      padding: 32px 24px;
2182      text-align: center;
2183    }
2184    .logo { font-size: 28px; font-weight: 700; color: #e5b84c; letter-spacing: 2px; margin-bottom: 16px; }
2185    .title { font-size: 24px; font-weight: 600; color: #ffffff; margin-bottom: 8px; }
2186    .subtitle { font-size: 14px; color: #a0a0a0; }
2187    .content { padding: 32px 24px; }
2188    .content p { color: #d0d0d0; margin-bottom: 16px; font-size: 15px; }
2189    .content strong { color: #ffffff; }
2190    .cta-container { text-align: center; margin: 32px 0; }
2191    .button {
2192      display: inline-block;
2193      background: linear-gradient(135deg, #e5b84c 0%, #d4a73a 100%);
2194      color: #0a0a0a !important;
2195      text-decoration: none;
2196      padding: 16px 40px;
2197      border-radius: 10px;
2198      font-weight: 700;
2199      font-size: 16px;
2200      letter-spacing: 0.5px;
2201      box-shadow: 0 4px 20px rgba(229, 184, 76, 0.3);
2202    }
2203    .highlight-box {
2204      background: rgba(229, 184, 76, 0.1);
2205      border: 1px solid rgba(229, 184, 76, 0.2);
2206      border-radius: 10px;
2207      padding: 16px;
2208      text-align: center;
2209      margin: 24px 0;
2210    }
2211    .highlight-box p { margin: 0 !important; font-size: 13px; color: #a0a0a0; }
2212    .highlight-box strong { color: #e5b84c; }
2213    .security-note {
2214      background: rgba(34, 197, 94, 0.1);
2215      border: 1px solid rgba(34, 197, 94, 0.2);
2216      border-radius: 10px;
2217      padding: 16px;
2218      margin: 24px 0;
2219    }
2220    .security-note p { margin: 0 !important; font-size: 14px; color: #d0d0d0; }
2221    .security-note .icon { color: #22c55e; margin-right: 8px; }
2222    .link-fallback {
2223      margin-top: 24px;
2224      padding: 16px;
2225      background: rgba(0, 0, 0, 0.2);
2226      border-radius: 8px;
2227      font-size: 12px;
2228      color: #888;
2229      word-break: break-all;
2230    }
2231    .link-fallback a { color: #e5b84c; text-decoration: none; }
2232    .footer {
2233      background: rgba(0, 0, 0, 0.3);
2234      border-top: 1px solid rgba(255, 255, 255, 0.05);
2235      padding: 20px 24px;
2236      text-align: center;
2237    }
2238    .footer p { font-size: 12px; color: #666; margin: 4px 0; }
2239  </style>
2240</head>
2241<body>
2242  <div class="container">
2243    <div class="card">
2244      <div class="header">
2245        <div style="margin-bottom: 12px;"><img src="https://chessagenda.com/logo.png" alt="Chess Agenda" width="64" height="64" style="display:inline-block;width:64px;
2245height:64px;background:#fff;border-radius:14px;padding:6px;box-shadow:0 4px 16px rgba(229,184,76,0.25);" /></div><div class="logo" style="font-size:22px;">CHESS AGENDA</div>
2246        <h1 class="title">🔐 Réinitialisation</h1>
2247        <p class="subtitle">Créez un nouveau mot de passe</p>
2248      </div>
2249      
2250      <div class="content">
2251        <p>Bonjour <strong>${e.userName}</strong>,</p>
2252        
2253        <p>Vous avez demandé à réinitialiser votre mot de passe. Cliquez sur le bouton ci-dessous pour créer un nouveau mot de passe :</p>
2254        
2255        <div class="cta-container">
2256          <a href="${e.resetUrl}" class="button">Créer un nouveau mot de passe</a>
2257        </div>
2258        
2259        <div class="highlight-box">
2260          <p>⏳ Ce lien expire dans <strong>${e.expiresIn}</strong></p>
2261        </div>
2262        
2263        <div class="security-note">
2264          <p><span class="icon">🔒</span>Si vous n'avez pas fait cette demande, vous pouvez ignorer cet email en toute sécurité. Votre compte reste protégé.</p>
2265        </div>
2266        
2267        <div class="link-fallback">
2268          <p>Si le bouton ne fonctionne pas, copiez ce lien dans votre navigateur :</p>
2269          <a href="${e.resetUrl}">${e.resetUrl}</a>
2270        </div>
2271      </div>
2272      
2273      <div class="footer">
2274        <p><strong>Chess Agenda</strong></p>
2275        <p>Tournois d'échecs en lieux vivants</p>
2276        <p style="margin-top: 8px;">Cet email a été envoyé automatiquement, merci de ne pas y répondre.</p>
2277      </div>
2278    </div>
2279  </div>
2280</body>
2281</html>
2282  `;return{subject:t,html:n}}function Kyt(e){const t="📧 Confirmez votre nouvelle adresse email - Chess Agenda",n=`
2283<!DOCTYPE html>
2284<html lang="fr">
2285<head>
2286  <meta charset="utf-8">
2287  <meta name="viewport" content="width=device-width, initial-scale=1">
2288  <meta name="color-scheme" content="dark">
2289  <title>Confirmation changement email</title>
2290  <style>
2291    * { margin: 0; padding: 0; box-sizing: border-box; }
2292    body {
2293      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
2294      background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
2295      color: #e0e0e0;
2296      line-height: 1.6;
2297      -webkit-font-smoothing: antialiased;
2298      padding: 20px;
2299    }
2300    .container { max-width: 520px; margin: 0 auto; }
2301    .card {
2302      background: linear-gradient(145deg, rgba(26, 26, 46, 0.95) 0%, rgba(15, 15, 30, 0.98) 100%);
2303      border: 1px solid rgba(229, 184, 76, 0.2);
2304      border-radius: 16px;
2305      overflow: hidden;
2306      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(229, 184, 76, 0.05);
2307    }
2308    .header {
2309      background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.05) 100%);
2310      border-bottom: 1px solid rgba(59, 130, 246, 0.3);
2311      padding: 32px 24px;
2312      text-align: center;
2313    }
2314    .logo { font-size: 28px; font-weight: 700; color: #e5b84c; letter-spacing: 2px; margin-bottom: 16px; }
2315    .title { font-size: 24px; font-weight: 600; color: #3b82f6; margin-bottom: 8px; }
2316    .subtitle { font-size: 14px; color: #a0a0a0; }
2317    .content { padding: 32px 24px; }
2318    .content p { color: #d0d0d0; margin-bottom: 16px; font-size: 15px; }
2319    .content strong { color: #ffffff; }
2320    .cta-container { text-align: center; margin: 32px 0; }
2321    .button {
2322      display: inline-block;
2323      background: linear-gradient(135deg, #e5b84c 0%, #d4a73a 100%);
2324      color: #0a0a0a !important;
2325      text-decoration: none;
2326      padding: 16px 40px;
2327      border-radius: 10px;
2328      font-weight: 700;
2329      font-size: 16px;
2330      letter-spacing: 0.5px;
2331      box-shadow: 0 4px 20px rgba(229, 184, 76, 0.3);
2332    }
2333    .highlight-box {
2334      background: rgba(229, 184, 76, 0.1);
2335      border: 1px solid rgba(229, 184, 76, 0.2);
2336      border-radius: 10px;
2337      padding: 16px;
2338      text-align: center;
2339      margin: 24px 0;
2340    }
2341    .highlight-box p { margin: 0 !important; font-size: 13px; color: #a0a0a0; }
2342    .highlight-box strong { color: #e5b84c; }
2343    .security-note {
2344      font-size: 13px;
2345      color: #888;
2346      margin-top: 24px;
2347      padding-top: 16px;
2348      border-top: 1px solid rgba(255, 255, 255, 0.1);
2349    }
2350    .link-fallback {
2351      margin-top: 24px;
2352      padding: 16px;
2353      background: rgba(0, 0, 0, 0.2);
2354      border-radius: 8px;
2355      font-size: 12px;
2356      color: #888;
2357      word-break: break-all;
2358    }
2359    .link-fallback a { color: #e5b84c; text-decoration: none; }
2360    .footer {
2361      background: rgba(0, 0, 0, 0.3);
2362      border-top: 1px solid rgba(255, 255, 255, 0.05);
2363      padding: 20px 24px;
2364      text-align: center;
2365    }
2366    .footer p { font-size: 12px; color: #666; margin: 4px 0; }
2367  </style>
2368</head>
2369<body>
2370  <div class="container">
2371    <div class="card">
2372      <div class="header">
2373        <div style="margin-bottom: 12px;"><img src="https://chessagenda.com/logo.png" alt="Chess Agenda" width="64" height="64" style="display:inline-block;width:64px;
2373height:64px;background:#fff;border-radius:14px;padding:6px;box-shadow:0 4px 16px rgba(229,184,76,0.25);" /></div><div class="logo" style="font-size:22px;">CHESS AGENDA</div>
2374        <h1 class="title">📧 Nouvelle adresse email</h1>
2375        <p class="subtitle">Confirmez votre changement</p>
2376      </div>
2377      
2378      <div class="content">
2379        <p>Bonjour <strong>${e.userName}</strong>,</p>
2380        
2381        <p>Vous avez demandé à changer votre adresse email. Cliquez sur le bouton ci-dessous pour confirmer cette nouvelle adresse :</p>
2382        
2383        <div class="cta-container">
2384          <a href="${e.confirmationUrl}" class="button">Confirmer ma nouvelle adresse</a>
2385        </div>
2386        
2387        <div class="highlight-box">
2388          <p>⏳ Ce lien expire dans <strong>${e.expiresIn}</strong></p>
2389        </div>
2390        
2391        <p class="security-note">
2392          🔒 Si vous n'avez pas demandé ce changement, ignorez cet email. Votre adresse actuelle restera inchangée.
2393        </p>
2394        
2395        <div class="link-fallback">
2396          <p>Si le bouton ne fonctionne pas, copiez ce lien dans votre navigateur :</p>
2397          <a href="${e.confirmationUrl}">${e.confirmationUrl}</a>
2398        </div>
2399      </div>
2400      
2401      <div class="footer">
2402        <p><strong>Chess Agenda</strong></p>
2403        <p>Tournois d'échecs en lieux vivants</p>
2404        <p style="margin-top: 8px;">Cet email a été envoyé automatiquement, merci de ne pas y répondre.</p>
2405      </div>
2406    </div>
2407  </div>
2408</body>
2409</html>
2410  `;return{subject:t,html:n}}function Yyt(e){const t="🔑 Votre lien de connexion - Chess Agenda",n=`
2411<!DOCTYPE html>
2412<html lang="fr">
2413<head>
2414  <meta charset="utf-8">
2415  <meta name="viewport" content="width=device-width, initial-scale=1">
2416  <meta name="color-scheme" content="dark">
2417  <title>Lien de connexion</title>
2418  <style>
2419    * { margin: 0; padding: 0; box-sizing: border-box; }
2420    body {
2421      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
2422      background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
2423      color: #e0e0e0;
2424      line-height: 1.6;
2425      -webkit-font-smoothing: antialiased;
2426      padding: 20px;
2427    }
2428    .container { max-width: 520px; margin: 0 auto; }
2429    .card {
2430      background: linear-gradient(145deg, rgba(26, 26, 46, 0.95) 0%, rgba(15, 15, 30, 0.98) 100%);
2431      border: 1px solid rgba(229, 184, 76, 0.2);
2432      border-radius: 16px;
2433      overflow: hidden;
2434      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(229, 184, 76, 0.05);
2435    }
2436    .header {
2437      background: linear-gradient(135deg, rgba(168, 85, 247, 0.2) 0%, rgba(168, 85, 247, 0.05) 100%);
2438      border-bottom: 1px solid rgba(168, 85, 247, 0.3);
2439      padding: 32px 24px;
2440      text-align: center;
2441    }
2442    .logo { font-size: 28px; font-weight: 700; color: #e5b84c; letter-spacing: 2px; margin-bottom: 16px; }
2443    .title { font-size: 24px; font-weight: 600; color: #a855f7; margin-bottom: 8px; }
2444    .subtitle { font-size: 14px; color: #a0a0a0; }
2445    .content { padding: 32px 24px; }
2446    .content p { color: #d0d0d0; margin-bottom: 16px; font-size: 15px; }
2447    .content strong { color: #ffffff; }
2448    .cta-container { text-align: center; margin: 32px 0; }
2449    .button {
2450      display: inline-block;
2451      background: linear-gradient(135deg, #e5b84c 0%, #d4a73a 100%);
2452      color: #0a0a0a !important;
2453      text-decoration: none;
2454      padding: 16px 40px;
2455      border-radius: 10px;
2456      font-weight: 700;
2457      font-size: 16px;
2458      letter-spacing: 0.5px;
2459      box-shadow: 0 4px 20px rgba(229, 184, 76, 0.3);
2460    }
2461    .highlight-box {
2462      background: rgba(168, 85, 247, 0.1);
2463      border: 1px solid rgba(168, 85, 247, 0.2);
2464      border-radius: 10px;
2465      padding: 16px;
2466      text-align: center;
2467      margin: 24px 0;
2468    }
2469    .highlight-box p { margin: 0 !important; font-size: 13px; color: #a0a0a0; }
2470    .highlight-box strong { color: #a855f7; }
2471    .security-note {
2472      font-size: 13px;
2473      color: #888;
2474      margin-top: 24px;
2475      padding-top: 16px;
2476      border-top: 1px solid rgba(255, 255, 255, 0.1);
2477    }
2478    .link-fallback {
2479      margin-top: 24px;
2480      padding: 16px;
2481      background: rgba(0, 0, 0, 0.2);
2482      border-radius: 8px;
2483      font-size: 12px;
2484      color: #888;
2485      word-break: break-all;
2486    }
2487    .link-fallback a { color: #e5b84c; text-decoration: none; }
2488    .footer {
2489      background: rgba(0, 0, 0, 0.3);
2490      border-top: 1px solid rgba(255, 255, 255, 0.05);
2491      padding: 20px 24px;
2492      text-align: center;
2493    }
2494    .footer p { font-size: 12px; color: #666; margin: 4px 0; }
2495  </style>
2496</head>
2497<body>
2498  <div class="container">
2499    <div class="card">
2500      <div class="header">
2501        <div style="margin-bottom: 12px;"><img src="https://chessagenda.com/logo.png" alt="Chess Agenda" width="64" height="64" style="display:inline-block;width:64px;
2501height:64px;background:#fff;border-radius:14px;padding:6px;box-shadow:0 4px 16px rgba(229,184,76,0.25);" /></div><div class="logo" style="font-size:22px;">CHESS AGENDA</div>
2502        <h1 class="title">🔑 Connexion rapide</h1>
2503        <p class="subtitle">Un clic et vous êtes connecté</p>
2504      </div>
2505      
2506      <div class="content">
2507        <p>Bonjour <strong>${e.userName}</strong>,</p>
2508        
2509        <p>Vous avez demandé un lien de connexion magique. Cliquez sur le bouton ci-dessous pour vous connecter instantanément :</p>
2510        
2511        <div class="cta-container">
2512          <a href="${e.magicLinkUrl}" class="button">Se connecter maintenant</a>
2513        </div>
2514        
2515        <div class="highlight-box">
2516          <p>⏳ Ce lien expire dans <strong>${e.expiresIn}</strong></p>
2517        </div>
2518        
2519        <p class="security-note">
2520          🔒 Ce lien ne fonctionne qu'une seule fois. Si vous n'avez pas demandé cette connexion, vous pouvez ignorer cet email en toute sécurité.
2521        </p>
2522        
2523        <div class="link-fallback">
2524          <p>Si le bouton ne fonctionne pas, copiez ce lien dans votre navigateur :</p>
2525          <a href="${e.magicLinkUrl}">${e.magicLinkUrl}</a>
2526        </div>
2527      </div>
2528      
2529      <div class="footer">
2530        <p><strong>Chess Agenda</strong></p>
2531        <p>Tournois d'échecs en lieux vivants</p>
2532        <p style="margin-top: 8px;">Cet email a été envoyé automatiquement, merci de ne pas y répondre.</p>
2533      </div>
2534    </div>
2535  </div>
2536</body>
2537</html>
2538  `;return{subject:t,html:n}}function Xyt(e){const t="Votre compte Chess Agenda est prêt",n=`
2539<!DOCTYPE html>
2540<html lang="fr">
2541<head>
2542  <meta charset="utf-8">
2543  <meta name="viewport" content="width=device-width, initial-scale=1">
2544  <meta name="color-scheme" content="dark">
2545  <title>Bienvenue sur Chess Agenda</title>
2546</head>
2547<body style="margin: 0; padding: 20px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%); color: #e0e0e0; line-height: 1.6;">
2548  <div style="max-width: 520px; margin: 0 auto;">
2549    <div style="background: linear-gradient(145deg, rgba(26, 26, 46, 0.95) 0%, rgba(15, 15, 30, 0.98) 100%); border: 1px solid rgba(229, 184, 76, 0.2); border-radius: 16px; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);">
2550
2551      <div style="background: linear-gradient(135deg, rgba(229, 184, 76, 0.15) 0%, rgba(229, 184, 76, 0.05) 100%); border-bottom: 1px solid rgba(229, 184, 76, 0.2); padding: 32px 24px; text-align: center;">
2552        <div style="margin-bottom: 16px;"><img src="https://chessagenda.com/logo.png" alt="Chess Agenda" width="64" height="64" style="display: inline-block; width: 64px; height: 64px; background: #ffffff; border-radius: 14px; padding: 6px;" /></div>
2553        <div style="font-size: 22px; font-weight: 700; color: #e5b84c; letter-spacing: 2px; margin-bottom: 16px;">CHESS AGENDA</div>
2554        <h1 style="font-size: 24px; font-weight: 600; color: #ffffff; margin: 0 0 8px;">Votre compte est prêt</h1>
2555        <p style="font-size: 14px; color: #a0a0a0; margin: 0;">Plus qu'une étape : définir votre mot de passe</p>
2556      </div>
2557
2558      <div style="padding: 32px 24px;">
2559        <p style="color: #d0d0d0; margin: 0 0 16px; font-size: 15px;">Salut <strong style="color: #ffffff;">${e.userName}</strong>,</p>
2560
2561        <p style="color: #d0d0d0; margin: 0 0 20px; font-size: 15px;">
2562          Suite à votre réservation, nous avons créé un compte Chess Agenda à votre nom.
2563          Définissez votre mot de passe pour accéder à vos tickets, votre historique et votre classement.
2564        </p>
2565
2566        <div style="text-align: center; margin: 32px 0;">
2567          <a href="${e.setupUrl}" style="display: inline-block; background: linear-gradient(135deg, #e5b84c 0%, #d4a73a 100%); color: #0a0a0a; text-decoration: none; padding: 16px 40px; border-radius: 10px; font-weight: 700; font-size: 16px; letter-spacing: 0.5px;">🔐 Définir mon mot de passe</a>
2568        </div>
2569
2570        <div style="background: rgba(229, 184, 76, 0.1); border: 1px solid rgba(229, 184, 76, 0.2); border-radius: 10px; padding: 16px; text-align: center; margin: 24px 0;">
2571          <p style="margin: 0; font-size: 13px; color: #a0a0a0;">⏳ Ce lien expire dans <strong style="color: #e5b84c;">
2571${e.expiresIn}</strong></p>
2572        </div>
2573
2574        <div style="background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 10px; padding: 16px; margin: 24px 0;">
2575          <p style="margin: 0 0 8px; font-size: 13px; color: #d0d0d0; font-weight: 600;">Ce que votre compte vous apporte :</p>
2576          <ul style="margin: 0; padding-left: 18px; color: #a0a0a0; font-size: 13px;">
2577            <li style="margin: 4px 0;">Retrouver tous vos tickets en un clic</li>
2578            <li style="margin: 4px 0;">Suivre votre Elo et votre historique</li>
2579            <li style="margin: 4px 0;">Vous inscrire plus vite la prochaine fois</li>
2580          </ul>
2581        </div>
2582
2583        <div style="margin-top: 24px; padding: 16px; background: rgba(0, 0, 0, 0.2); border-radius: 8px; font-size: 12px; color: #888; word-break: break-all;">
2584          <p style="margin: 0 0 8px;">Si le bouton ne fonctionne pas, copiez ce lien dans votre navigateur :</p>
2585          <a href="${e.setupUrl}" style="color: #e5b84c; text-decoration: none;">${e.setupUrl}</a>
2586        </div>
2587      </div>
2588
2589      <div style="background: rgba(0, 0, 0, 0.3); border-top: 1px solid rgba(255, 255, 255, 0.05); padding: 20px 24px; text-align: center;">
2590        <p style="font-size: 12px; color: #666; margin: 0 0 4px;"><strong>Chess Agenda</strong></p>
2591        <p style="font-size: 12px; color: #666; margin: 0 0 4px;">Tournois d'échecs en lieux vivants</p>
2592        <p style="font-size: 12px; color: #666; margin: 8px 0 0;">Si vous n'êtes pas à l'origine de cette réservation, ignorez cet email.</p>
2593      </div>
2594    </div>
2595  </div>
2596</body>
2597</html>
2598  `;return{subject:t,html:n}}function Qyt(e,t){const n={firstName:String(e.firstName??""),badgeName:String(e.badgeName??""),badgeIcon:String(e.badgeIcon??"🏅"),badgeDescription:String(e.badgeDescription??""),otherBadges:String(e.otherBadges??""),badgeCount:String(e.badgeCount??"1"),eventTitle:String(e.eventTitle??""),venueName:String(e.venueName??""),totalBadges:String(e.totalBadges??"1")},r=typeof e.badgesUrl=="string"?e.badgesUrl:"https://chessagenda.com/player/profile#badges",i=kp("badge_unlocked",t??null),a=en(i.subject,n),o=At(en(i.eyebrow,n)),l=At(en(i.headline,n)),c=Ir(i.greeting,n),u=Ir(i.intro,n),d=Ir(i.others_line,n),f=Ir(i.collection_line,n),h=At(en(i.explore_title,n)),p=Ir(i.explore_1,n),x=Ir(i.explore_2,n),y=Ir(i.explore_3,n),b=At(en(i.cta_label,n)),w=At(en(i.cta_hint,n)),_=en(i.signature,n).split(`
2599`).map(At).join("<br/>"),E=n.otherBadges.trim().length>0?`<div style="background:#F5F3EE;border-radius:12px;padding:16px;margin:20px 0 0 0;">
2600        <p style="margin:0;font-size:14px;line-height:1.5;">✨ ${d}</p>
2601      </div>`:"",S=`<!DOCTYPE html>
2602<html lang="fr"><head><meta charset="utf-8"><title>${At(a)}</title></head>
2603<body style="margin:0;padding:24px;background:#F5F3EE;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;color:#0D0D0D;">
2604  <div style="max-width:520px;margin:0 auto;background:#ffffff;border-radius:16px;padding:32px;border:1px solid rgba(13,13,13,0.08);">
2605    <div style="font-size:11px;letter-spacing:0.22em;color:rgba(13,13,13,0.55);text-transform:uppercase;font-family:'Fragment Mono',ui-monospace,monospace;">${o}</div>
2606    <h1 style="font-size:28px;font-weight:900;line-height:1.05;margin:12px 0 8px 0;letter-spacing:-0.02em;">${l}</h1>
2607    <div style="text-align:center;margin:24px 0 8px 0;">
2608      <div style="display:inline-block;background:#AAFF00;border-radius:24px;padding:20px 28px;box-shadow:0 4px 0 #0D0D0D;">
2609        <div style="font-size:44px;line-height:1;">${At(n.badgeIcon)}</div>
2610        <div style="margin-top:8px;font-size:16px;font-weight:900;letter-spacing:-0.01em;">${At(n.badgeName)}</div>
2611      </div>
2612    </div>
2613    <p style="font-size:16px;line-height:1.5;margin:20px 0 8px 0;">${c}</p>
2614    <p style="font-size:16px;line-height:1.5;margin:8px 0 0 0;">${u}</p>
2615    ${E}
2616    <p style="font-size:15px;line-height:1.5;margin:20px 0 0 0;color:rgba(13,13,13,0.75);">${f}</p>
2617    <div style="text-align:center;margin:28px 0 8px 0;">
2618      <a href="${r}" style="display:inline-block;background:#0D0D0D;color:#AAFF00;text-decoration:none;padding:18px 32px;border-radius:999px;font-weight:800;font-size:17px;letter-spacing:0.01em;box-shadow:0 8px 24px rgba(0,0,0,0.14);">${b}</a>
2619      <p style="margin:14px 0 0 0;font-size:12px;color:rgba(13,13,13,0.55);">${w}</p>
2620    </div>
2621    <div style="border-top:1px solid rgba(13,13,13,0.08);margin-top:28px;padding-top:20px;">
2622      <div style="font-size:11px;letter-spacing:0.22em;color:rgba(13,13,13,0.55);text-transform:uppercase;font-family:'Fragment Mono',ui-monospace,monospace;">${h}</div>
2623      <p style="margin:12px 0 8px 0;font-size:14px;line-height:1.5;">📈 ${p}</p>
2624      <p style="margin:0 0 8px 0;font-size:14px;line-height:1.5;">🗺️ ${x}</p>
2625      <p style="margin:0;font-size:14px;line-height:1.5;">✍️ ${y}</p>
2626    </div>
2627    <p style="font-size:14px;color:rgba(13,13,13,0.6);margin:28px 0 0 0;">${_}</p>
2628  </div>
2629</body></html>`;return{subject:a,html:S}}function Jyt(e,t){const n={firstName:String(e.firstName??"Joueur"),eventTitle:String(e.eventTitle??"Tournoi Chess Agenda"),eventDateLabel:String(e.eventDateLabel??"sam. 29 août à 19h30"),venueName:String(e.venueName??"Chess Agenda"),photoCount:String(e.photoCount??"24"),expiryLabel:String(e.expiryLabel??"13 septembre 2026")},r=String(e.galleryUrl??"https://chessagenda.com/events/demo/photos?t=apercu"),i=kp("event_gallery_ready",t??null),a=en(i.subject,n),o=en(i.signature,n).split(`
2630`).map(At).join("<br/>"),l=`<!DOCTYPE html>
2631<html lang="fr"><head><meta charset="utf-8"><title>${At(a)}</title></head>
2632<body style="margin:0;padding:24px;background:#F5F3EE;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;color:#0D0D0D;">
2633  <div style="max-width:520px;margin:0 auto;background:#ffffff;border-radius:16px;padding:32px;border:1px solid rgba(13,13,13,0.08);">
2634    <div style="font-size:11px;letter-spacing:0.22em;color:rgba(13,13,13,0.55);text-transform:uppercase;font-family:ui-monospace,monospace;">${At(en(i.eyebrow,n))}</div>
2635    <h1 style="font-size:28px;font-weight:900;line-height:1.05;margin:12px 0 8px 0;">${At(en(i.headline,n))}</h1>
2636    <p style="font-size:16px;line-height:1.5;margin:16px 0 8px 0;">${Ir(i.greeting,n)}</p>
2637    <p style="font-size:16px;line-height:1.5;margin:8px 0 16px 0;">${Ir(i.intro,n)}</p>
2638    <div style="text-align:center;margin:28px 0 8px 0;">
2639      <a href="${r}" style="display:inline-block;background:#AAFF00;color:#0D0D0D;text-decoration:none;padding:18px 32px;border-radius:999px;font-weight:800;font-size:17px;box-shadow:0 4px 0 #0D0D0D,0 8px 24px rgba(0,0,0,0.12);">${At(en(i.cta_label,n))}</a>
2640      <p style="margin:14px 0 0;font-size:12px;color:rgba(13,13,13,0.55);">${At(en(i.cta_hint,n))}</p>
2641    </div>
2642    <div style="background:#F5F3EE;border-radius:12px;padding:16px;margin:28px 0 0;">
2643      <p style="margin:0 0 10px;font-size:14px;line-height:1.5;">🔒 ${Ir(i.privacy_note,n)}</p>
2644      <p style="margin:0 0 10px;font-size:14px;line-height:1.5;">⏳ ${Ir(i.expiry_note,n)}</p>
2645      <p style="margin:0;font-size:14px;line-height:1.5;color:rgba(13,13,13,0.7);">📸 ${Ir(i.disclaimer,n)}</p>
2646    </div>
2647    <p style="margin:20px 0 0;font-size:12px;text-align:center;"><a href="${r}" style="color:rgba(13,13,13,0.55);text-decoration:underline;">${At(en(i.report_label,n))}</a></p>
2648    <p style="font-size:14px;color:rgba(13,13,13,0.6);margin:28px 0 0;">${o}</p>
2649  </div>
2650</body></html>`;return{subject:a,html:l}}const F8=e=>["email_template_copy",e];function Zyt(e){return st({queryKey:F8(e??"_none"),enabled:!!e,staleTime:5*60*1e3,queryFn:async()=>
2650{if(!e)return{};const{data:t,error:n}=await re.from("email_template_copies").select("copy").eq("template_id",e).maybeSingle();if(n&&n.code!=="PGRST116")throw n;const r=(t==null?void 0:t.copy)??{},i={};for(const[a,o]of Object.entries(r))typeof o=="string"&&(i[a]=o);return i}})}function evt(e){const t=Ye();return dt({mutationFn:async n=>{var o;const r={};for(const[l,c]of Object.entries(n))typeof c=="string"&&c.trim().length>0&&(r[l]=c.trim());const{data:i}=await re.auth.getUser(),{error:a}=await re.from("email_template_copies").upsert({template_id:e,copy:r,updated_by:((o=i.user)==null?void 0:o.id)??null,updated_at:new Date().toISOString()},{onConflict:"template_id"});if(a)throw a;return r},onSuccess:()=>{t.invalidateQueries({queryKey:F8(e)})}})}function tvt(e){const t=Ye();return dt({mutationFn:async()=>{const{error:n}=await re.from("email_template_copies").delete().eq("template_id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:F8(e)})}})}function ffe({template:e,open:t,onOpenChange:n,previewData:r}){const[i,a]=N.useState("mobile"),[o,l]=N.useState(!1),[c,u]=N.useState({}),d=(e==null?void 0:e.id)??null,{data:f={},isLoading:h}=Zyt(d),p=evt(d??""),x=tvt(d??""),y=N.useMemo(()=>d?L8[d]??{}:{},[d]),b=Object.keys(f).length>0,w=N.useMemo(()=>Object.keys(y).some(O=>(c[O]??"")!==(f[O]??"")),[c,f,y]);N.useEffect(()=>{if(!d)return;const O={};for(const D of Object.keys(y))O[D]=f[D]??"";u(O)},[d,f,y]),N.useEffect(()=>{t&&(a("mobile"),l(!1))},[t]);const{subject:_,html:j}=N.useMemo(()=>{if(!e)return{subject:"",html:""};const O=r??e.getPreviewData(),D=o?c:f;return $yt(e.id,O,D)},[e,c,f,o,r]);if(!e)return null;const E=async()=>{try{await p.mutateAsync(c),je.success("Wording enregistré")}catch(O){je.error("Erreur à l'enregistrement",{description:O instanceof Error?O.message:void 0})}},S=async()=>{if(confirm("Réinitialiser ce template aux valeurs par défaut ?"))try{await x.mutateAsync(),je.success("Réinitialisé aux valeurs par défaut")}catch{je.error("Erreur à la réinitialisation")}},T=Object.keys(y),P=T.length>0;return s.jsx(Ln,{open:t,onOpenChange:n,children:s.jsxs(Dn,{className:"max-w-5xl max-h-[92vh] p-0 overflow-hidden flex flex-col",children:[s.jsx(Un,{className:"p-4 sm:p-6 pb-4 border-b border-border/50 flex-shrink-0",children:s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:s.jsx(wr,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs(qn,{className:"text-base sm:text-lg font-semibold truncate flex items-center gap-2",children:[e.name,b&&s.jsx(we,{variant:"secondary",className:"text-[10px]",children:"Personnalisé"})]}),s.jsxs(qr,{className:"text-xs sm:text-sm truncate mt-0.5",children:["Sujet : ",_]})]})]}),P&&s.jsxs(Q,{variant:o?"default":"outline",size:"sm",onClick:()=>l(O=>!O),className:"gap-1.5 flex-shrink-0",children:[o?s.jsx(go,{className:"w-4 h-4"}):s.jsx(o1,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:o?"Aperçu":"Éditer"})]})]})}),s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col lg:flex-row",children:[o&&P&&s.jsx("div",{className:"lg:w-[380px] lg:border-r border-border/50 flex-shrink-0 overflow-y-auto bg-muted/10",children:s.jsxs("div",{className:"p-4 space-y-4",children:[h?s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(We,{className:"w-4 h-4 animate-spin"})," Chargement…"]}):T.map(O=>{const D=y[O],R=c[O]??"",L=D.default;return s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(Fe,{htmlFor:`copy-${O}`,className:"text-xs font-medium flex items-center justify-between",children:[s.jsx("span",{children:D.label}),R&&R!==f[O]&&s.jsx("span",{className:"text-[10px] text-amber-500",children:"Modifié"})]}),D.type==="multiline"?s.jsx($s,{id:`copy-${O}`,value:R,onChange:M=>u({...c,[O]:M.target.value}),placeholder:L,rows:3,className:"text-sm"}):s.jsx(Ue,{id:`copy-${O}`,value:R,onChange:M=>u({...c,[O]:M.target.value}),placeholder:L,className:"text-sm"}),D.help&&s.jsx("p",{className:"text-[10px] text-muted-foreground",children:D.help})]},O)}),s.jsxs("div",{className:"text-[10px] text-muted-foreground pt-2 border-t border-border/30",children:["Variables dynamiques disponibles : ",e.variables.map(O=>`{${O.name}}
2650`).join(", ")]}),s.jsxs("div",{className:"flex flex-col gap-2 pt-2 sticky bottom-0 bg-muted/30 -mx-4 px-4 pb-2 backdrop-blur",children:[s.jsxs(Q,{size:"sm",onClick:E,disabled:!w||p.isPending,className:"w-full gap-1.5",children:[p.isPending?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(cI,{className:"w-4 h-4"}),"Enregistrer"]}),b&&s.jsxs(Q,{size:"sm",variant:"ghost",onClick:S,disabled:x.isPending,className:"w-full gap-1.5 text-muted-foreground",children:[s.jsx(Il,{className:"w-4 h-4"})," Réinitialiser aux défauts"]})]})]})}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[s.jsxs("div",{className:"flex justify-center gap-2 p-3 bg-muted/30 border-b border-border/30 flex-shrink-0",children:[s.jsxs(Q,{variant:i==="mobile"?"default":"outline",size:"sm",onClick:()=>a("mobile"),className:"gap-1.5",children:[s.jsx(wxe,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Mobile"})]}),s.jsxs(Q,{variant:i==="desktop"?"default":"outline",size:"sm",onClick:()=>a("desktop"),className:"gap-1.5",children:[s.jsx(mxe,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Desktop"})]})]}),s.jsx("div",{className:"flex-1 overflow-auto bg-muted/20 p-4",children:s.jsx("div",{className:"flex justify-center",children:s.jsx("div",{className:ae("bg-white rounded-lg shadow-lg overflow-hidden transition-all duration-300",i==="mobile"?"w-[375px] max-w-full":"w-full max-w-[600px]"),children:s.jsx("iframe",{srcDoc:j,className:"w-full h-[450px] sm:h-[520px] border-0",title:"Email Preview",sandbox:"allow-same-origin"})})})}),s.jsxs("div",{className:"p-4 border-t border-border/50 bg-muted/10 flex-shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(VY,{className:"w-4 h-4 text-muted-foreground"}),s.jsxs("p",{className:"text-xs text-muted-foreground font-medium",children:["Variables (",e.variables.length,")"]})]}),s.jsx(cd,{className:"w-full",children:s.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.variables.map(O=>s.jsx(we,{variant:"outline",className:"text-[10px] shrink-0",title:O.description,children:O.name},O.name))})})]})]})]})]})})}const og=[{id:"email_confirmation",name:"Confirmation Email",description:"Email de vérification envoyé lors de la création d'un compte joueur ou venue",trigger:"Après inscription (signUp)",edgeFunction:"send-confirmation-email",category:"auth",variables:[{name:"userName",description:"Prénom de l'utilisateur"},{name:"confirmationUrl",description:"Lien de confirmation généré par Supabase"},{name:"expiresIn",description:"Durée de validité du lien (ex: 24 heures)"}],getPreviewData:()=>({userName:"Jean Dupont",confirmationUrl:"https://chessagenda.com/auth/confirm?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",expiresIn:"24 heures"})},{id:"ticket_confirmation",name:"Confirmation Ticket",description:"Confirmation d'inscription à un tournoi après paiement validé",trigger:"Après paiement Stripe validé ou inscription gratuite",edgeFunction:"verify-payment",category:"transaction",variables:[{name:"playerName",description:"Nom du joueur inscrit"},{name:"eventTitle",description:"Titre de l'événement"},{name:"eventDate",description:"Date du tournoi (format lisible)"},{name:"eventTime",description:"Heure du tournoi"},{name:"venueName",description:"Nom du lieu/bar"},{name:"venueAddress",description:"Adresse complète du lieu"},{name:"reservationCode",description:"Code de réservation unique"},{name:"ticketCount",description:"Nombre de places réservées"},{name:"creditAmount",description:"Montant du crédit consommation inclus"},{name:"ticketUrl",description:"URL vers la page du ticket"}],getPreviewData:()=>({playerName:"Jean Dupont",eventTitle:"Tournoi Blitz du Vendredi",eventDate:"Vendredi 14 Février 2025",eventTime:"19h30",venueName:"Le Roi des Échecs",venueAddress:"42 rue de la Stratégie, 75011 Paris",reservationCode:"TKT-2025-ABCD",ticketCount:1,creditAmount:10,ticketUrl:"https://chessagenda.com/player/tickets/abc123"})},{id:"venue_welcome",name:"Bienvenue Venue",description:"Email de bienvenue pour les nouveaux lieux partenaires après création de compte",trigger:"Après création d'un compte venue (avant approbation admin)",edgeFunction:"send-venue-welcome-email",category:"venue",variables:[{name:"contactName",description:"Nom du contact principal"},{name:"barName",description:"Nom de l'établissement"},{name:"barAddress",description:"Adresse de l'établissement"},{name:"requestDate",description:"Date de soumission de la demande"}],getPreviewData:()=>({contactName:"Marie Martin",barName:"Le Café des Cavaliers",barAddress:"15 avenue des Tours, 69003 Lyon",requestDate:"12 janvier 2025"})},{id:"venue_approved",name:"Venue Approuvé",description:"Email de confirmation envoyé au partenaire lorsque sa demande est approuvée par l'admin",trigger:"Après approbation de la demande de partenariat",edgeFunction:"send-venue-approved-email",category:"venue",variables:[{name:"contactName",description:"Nom du contact principal"},{name:"barName",description:"Nom de l'établissement"},{name:"barAddress",description:"Adresse de l'établissement"},{name:"venueDashboardUrl",description:"Lien vers le dashboard venue"},{name:"approvalDate",description:"Date d'approbation"},{name:"adminNotes",description:"Notes de l'admin (optionnel)"}],getPreviewData:()=>({contactName:"Marie Martin",barName:"Le Café des Cavaliers",barAddress:"15 avenue des Tours, 69003 Lyon",venueDashboardUrl:"https://chessagenda.com/venue",approvalDate:"28 janvier 2026",adminNotes:"Bienvenue dans la communauté Chess Agenda !"})}
2650,{id:"event_reminder",name:"Rappel Événement",description:"Email de rappel envoyé aux joueurs inscrits 24h avant le tournoi",trigger:"Automatique (cron) 24h avant l'événement",edgeFunction:"send-event-reminder",category:"reminder",variables:[{name:"playerName",description:"Nom du joueur"},{name:"eventTitle",description:"Titre du tournoi"},{name:"eventDate",description:"Date du tournoi (format lisible)"},{name:"eventTime",description:"Heure de début"},{name:"venueName",description:"Nom du lieu/bar"},{name:"venueAddress",description:"Adresse complète"},{name:"reservationCode",description:"Code de réservation unique"},{name:"creditAmount",description:"Montant du crédit consommation"},{name:"ticketUrl",description:"URL vers la page du ticket"}],getPreviewData:()=>({playerName:"Jean Dupont",eventTitle:"Tournoi Blitz du Vendredi",eventDate:"Vendredi 14 Février 2025",eventTime:"19h30",venueName:"Le Roi des Échecs",venueAddress:"42 rue de la Stratégie, 75011 Paris",reservationCode:"TKT-2025-ABCD",creditAmount:10,ticketUrl:"https://chessagenda.com/player"})}
2650,{id:"password_reset",name:"Réinitialisation Mot de Passe",description:"Email de lien de réinitialisation de mot de passe",trigger:'Demande "Mot de passe oublié" via Auth Hook',edgeFunction:"auth-send-email",category:"auth",variables:[{name:"userName",description:"Prénom ou pseudo de l'utilisateur"},{name:"resetUrl",description:"Lien de réinitialisation"},{name:"expiresIn",description:"Durée de validité du lien"}],getPreviewData:()=>({userName:"Jean",resetUrl:"https://chessagenda.com/reset-password#access_token=...",expiresIn:"1 heure"})},{id:"email_change",name:"Changement Email",description:"Confirmation de changement d'adresse email",trigger:"Modification de l'email du compte via Auth Hook",edgeFunction:"auth-send-email",category:"auth",variables:[{name:"userName",description:"Prénom ou pseudo de l'utilisateur"},{name:"confirmationUrl",description:"Lien de confirmation"},{name:"expiresIn",description:"Durée de validité du lien"}],getPreviewData:()=>({userName:"Jean",confirmationUrl:"https://chessagenda.com/auth/confirm?token=...",expiresIn:"24 heures"})},{id:"magic_link",name:"Lien Magique",description:"Email de connexion sans mot de passe",trigger:"Demande de connexion par magic link via Auth Hook",edgeFunction:"auth-send-email",category:"auth",variables:[{name:"userName",description:"Prénom ou pseudo de l'utilisateur"},{name:"magicLinkUrl",description:"Lien de connexion"},{name:"expiresIn",description:"Durée de validité du lien"}],getPreviewData:()=>({userName:"Jean",magicLinkUrl:"https://chessagenda.com/auth/confirm?token=...",expiresIn:"10 minutes"})},{id:"account_created",name:"Compte créé (Express)",description:"Email d'activation envoyé UNIQUEMENT après un paiement confirmé (réservation payée ou gratuite). Les paniers abandonnés ne le reçoivent pas — ils reçoivent l'email « Panier abandonné ».",trigger:"Après paiement confirmé (verify-payment) ou réservation gratuite, si le compte a été auto-créé au checkout",edgeFunction:"verify-payment",category:"auth",variables:[{name:"userName",description:"Prénom de l'utilisateur"},{name:"setupUrl",description:"Lien pour définir le mot de passe"},{name:"expiresIn",description:"Durée de validité du lien"},{name:"paid",description:"Condition d'envoi : la réservation est payée (sinon aucun envoi)"}],getPreviewData:()=>({userName:"Jean",setupUrl:"https://chessagenda.com/auth/reset-password?token=demo-setup-token",expiresIn:"24 heures"})},{id:"preregistration_confirmation",name:"Pré-inscription confirmée",description:"Email envoyé au joueur après une pré-inscription (formulaire landing ou pré-inscription manuelle par un admin). Inclut un magic link de connexion sans mot de passe.",trigger:"Après pré-inscription via landing-preregister ou admin-walkin-register",edgeFunction:"landing-preregister",category:"transaction",variables:[{name:"firstName",description:"Prénom du joueur pré-inscrit"},{name:"eventTitle",description:"Titre de l'événement"},{name:"eventDateLabel",description:"Date courte (ex: lun. 8 juin)"},{name:"venueName",description:"Nom du lieu"}],getPreviewData:()=>({firstName:"Soso",eventTitle:"On va au théâtre ?",eventDateLabel:"lun. 8 juin",venueName:"kawaa du Lucernaire",magicLinkUrl:"https://chessagenda.com/auth/callback?token=demo-magic-link"})},{id:"preregistration_reminder_72h",name:"Relance pré-inscription 72h",description:"Email de relance envoyé 72h après une pré-inscription si le joueur n'a pas confirmé/payé. CTA principal vers le paiement, options soft pour prolonger ou libérer.",trigger:"Automatique (cron horaire) 72h+ après la pré-inscription si événement encore futur",edgeFunction:"trigger-preregistration-reminders",category:"reminder",variables:[{name:"firstName",description:"Prénom du joueur pré-inscrit"},{name:"eventTitle",description:"Titre de l'événement"},{name:"eventDateLabel",description:"Date + heure (ex: lun. 27 juil. à 18h)"},{name:"venueName",description:"Nom du lieu"},{name:"priceLabel",description:"Prix ticket formaté (ex: 15€)"},{name:"spotsLeft",description:"Places restantes (peut être vide)"}],getPreviewData:()=>({firstName:"Soso",eventTitle:"Tournoi à l'Odéon",eventDateLabel:"lun. 27 juil. à 18h",venueName:"Le Lucernaire",priceLabel:"15€",spotsLeft:"4"})},{id:"preregistration_reminder_48h_before",name:"Relance J-2 pré-inscription",description:"Email envoyé 48h avant l'événement aux joueurs pré-inscrits qui n'ont pas encore payé, si l'événement a encore de la place. Ton countdown + rareté.",trigger:"Automatique (cron horaire) 42-54h avant l'événement, si ticket=lead et capacité restante",edgeFunction:"trigger-preregistration-reminders",category:"reminder",variables:[{name:"firstName",description:"Prénom du joueur pré-inscrit"},{name:"eventTitle",description:"Titre de l'événement"},{name:"eventDateLabel",description:"Date + heure de l'événement"},{name:"venueName",description:"Nom du lieu"},{name:"priceLabel",description:"Prix ticket formaté (ex: 15€)"},{name:"spotsLeft",description:"Places restantes (optionnel)"}],getPreviewData:()=>({firstName:"Soso",eventTitle:"Tournoi à l'Odéon",eventDateLabel:"lun. 27 juil. à 18h",venueName:"Le Lucernaire",priceLabel:"15€",spotsLeft:"3"})},{id:"abandoned_checkout",name:"Panier abandonné",description:"Email envoyé aux joueurs qui ont renseigné leur email au checkout mais n'ont pas finalisé le paiement. Aucun discours 'création de compte' : un seul bouton pour reprendre la réservation.",trigger:"Automatique (cron horaire) 1h après l'abandon du paiement, une seule fois par ticket",edgeFunction:"trigger-preregistration-reminders",category:"reminder",variables:[{name:"firstName",description:"Prénom de l'acheteur"},{name:"eventTitle",description:"Titre de l'événement"},{name:"eventDateLabel",description:"Date + heure de l'événement"},{name:"venueName",description:"Nom du lieu"},{name:"priceLabel",description:"Prix ticket formaté (ex: 15€)"},{name:"spotsLeft",description:"Places restantes (optionnel)"}],getPreviewData:()=>({firstName:"Soso",eventTitle:"Tournoi à l'Odéon",eventDateLabel:"lun. 27 juil. à 18h",venueName:"Le Lucernaire",priceLabel:"15€",spotsLeft:"4"})},{id:"abandoned_checkout_72h",name:"Panier abandonné — relance 72h",description:"Relance des paniers abandonné
2650s 72h après l'abandon. Discours 'paiement non finalisé', jamais 'préinscription'.",trigger:"Automatique (cron horaire) 72h après l'abandon, une seule fois par ticket",edgeFunction:"trigger-preregistration-reminders",category:"reminder",variables:[{name:"firstName",description:"Prénom de l'acheteur"},{name:"eventTitle",description:"Titre de l'événement"},{name:"eventDateLabel",description:"Date + heure de l'événement"},{name:"venueName",description:"Nom du lieu"},{name:"priceLabel",description:"Prix ticket formaté (ex: 15€)"},{name:"spotsLeft",description:"Places restantes (optionnel)"}],getPreviewData:()=>({firstName:"Soso",eventTitle:"Tournoi à l'Odéon",eventDateLabel:"lun. 27 juil. à 18h",venueName:"Le Lucernaire",priceLabel:"15€",spotsLeft:"4"})},{id:"abandoned_checkout_48h_before",name:"Panier abandonné — relance J-2",description:"Dernière relance des paniers abandonnés, 48h avant l'événement. Ton urgent, un seul bouton pour finaliser le paiement.",trigger:"Automatique (cron horaire) entre 54h et 42h avant l'événement, une seule fois par ticket",edgeFunction:"trigger-preregistration-reminders",category:"reminder",variables:[{name:"firstName",description:"Prénom de l'acheteur"},{name:"eventTitle",description:"Titre de l'événement"},{name:"eventDateLabel",description:"Date + heure de l'événement"},{name:"venueName",description:"Nom du lieu"},{name:"priceLabel",description:"Prix ticket formaté (ex: 15€)"},{name:"spotsLeft",description:"Places restantes (optionnel)"}],getPreviewData:()=>({firstName:"Soso",eventTitle:"Tournoi à l'Odéon",eventDateLabel:"lun. 27 juil. à 18h",venueName:"Le Lucernaire",priceLabel:"15€",spotsLeft:"2"})},{id:"payment_link",name:"Lien de paiement (staff)",description:"Email envoyé par le staff lors d'une inscription exceptionnelle : le joueur règle sa place depuis son téléphone via un lien Stripe.",trigger:"Manuel — Inscription exceptionnelle ou relance d'un pré-inscrit (bouton 'Envoyer un lien de paiement')",edgeFunction:"create-payment-link",category:"transaction",variables:[{name:"firstName",description:"Prénom du joueur"},{name:"eventTitle",description:"Titre de l'événement"},{name:"eventDateLabel",description:"Date + heure de l'événement"},{name:"venueName",description:"Nom du lieu"},{name:"priceLabel",description:"Montant à régler (ex: 15€)"},{name:"perkLabel",description:"Avantage inclus (crédit bar / formule)"},{name:"expiryLabel",description:"Date limite de validité du lien"}],getPreviewData:()=>({firstName:"Soso",eventTitle:"Tournoi à l'Odéon",eventDateLabel:"lun. 27 juil. à 18h",venueName:"Le Lucernaire",priceLabel:"15€",perkLabel:"Inclut 10€ de crédit bar.",expiryLabel:"mar. 28 juil. à 18h",payUrl:"https://checkout.stripe.com/demo"})},{id:"event_gallery_ready",name:"Galerie photo disponible",description:"Email envoyé aux participants pointés lorsque l'album privé d'un tournoi est publié manuellement.",trigger:"Manuel — publication de la galer
2650ie depuis la page de l'événement",edgeFunction:"publish-event-gallery",category:"notification",variables:[{name:"firstName",description:"Prénom du participant"},{name:"eventTitle",description:"Titre de l'événement"},{name:"eventDateLabel",description:"Date et heure de l'événement"},{name:"venueName",description:"Nom du lieu"},{name:"photoCount",description:"Nombre de photos visibles"},{name:"expiryLabel",description:"Date de fermeture de l'album"},{name:"galleryUrl",description:"Lien personnel vers l'album privé"}],getPreviewData:()=>({firstName:"Soso",eventTitle:"Tournoi à l'Odéon",eventDateLabel:"sam. 29 août à 19h30",venueName:"Le Lucernaire",photoCount:"24",expiryLabel:"13 septembre 2026",galleryUrl:"https://chessagenda.com/events/demo/photos?t=aperçu"})},{id:"badge_unlocked",name:"Badge débloqué",description:"Félicitations envoyées au joueur dès qu'il débloque un ou plusieurs badges, avec lien direct vers sa collection.",trigger:"Automatique — après attribution des badges en fin de tournoi",edgeFunction:"notify-badges",category:"notification",variables:[{name:"firstName",description:"Prénom du joueur"},{name:"badgeName",description:"Nom du badge principal"},{name:"badgeIcon",description:"Emoji du badge principal"},{name:"badgeDescription",description:"Description du badge principal"},{name:"otherBadges",description:"Liste des autres badges débloqués en même temps"},{name:"badgeCount",description:"Nombre de badges débloqués ce soir-là"},{name:"eventTitle",description:"Titre du tournoi"},{name:"venueName",description:"Nom du lieu"},{name:"totalBadges",description:"Nombre total de badges du joueur"}],getPreviewData:()=>({firstName:"Soso",badgeName:"Première victoire",badgeIcon:"🥇",badgeDescription:"Ta toute première partie gagnée en tournoi.",otherBadges:"♟️ Première partie, 🎯 Premier tournoi",badgeCount:"3",eventTitle:"Tournoi à l'Odéon",venueName:"Le Lucernaire",totalBadges:"4",badgesUrl:"https://chessagenda.com/player/profile#badges"})}],nvt={auth:{label:"Authentification",className:"bg-purple-500/20 text-purple-400 border-purple-500/30"},transaction:{label:"Transaction",className:"bg-green-500/20 text-green-400 border-green-500/30"},venue:{label:"Venue",className:"bg-blue-500/20 text-blue-400 border-blue-500/30"},notification:{label:"Notification",className:"bg-amber-500/20 text-amber-400 border-amber-500/30"},reminder:{label:"Rappel",className:"bg-orange-500/20 text-orange-400 border-orange-500/30"}},Dj={email_confirmation:{label:"Confirmation Email",className:"bg-purple-500/20 text-purple-400 border-purple-500/30"},venue_welcome:{label:"Bienvenue Venue",className:"bg-blue-500/20 text-blue-400 border-blue-500/30"},ticket_confirmation:{label:"Confirmation Ticket",className:"bg-green-500/20 text-green-400 border-green-500/30"},ticket_confirmation_guest:{label:"Confirmation Ticket (Invité)",className:"bg-green-500/20 text-green-400 border-green-500/30"},venue_approved:{label:"Venue Approuvé",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30"},event_reminder:{label:"Rappel Événement",className:"bg-orange-500/20 text-orange-400 border-orange-500/30"},password_reset:{label:"Reset Mot de Passe",className:"bg-amber-500/20 text-amber-400 border-amber-500/30"},email_change:{label:"Changement Email",className:"bg-blue-500/20 text-blue-400 border-blue-500/30"},magic_link:{label:"Lien Magique",className:"bg-purple-500/20 text-purple-400 border-purple-500/30"},account_created:{label:"Compte créé (Express)",className:"bg-purple-500/20 text-purple-400 border-purple-500/30"},preregistration_confirmation:{label:"Pré-inscription",className:"bg-green-500/20 text-green-400 border-green-500/30"},preregistration_reminder_72h:{label:"Relance 72h",className:"bg-orange-500/20 text-orange-400 border-orange-500/30"},preregistration_reminder_48h_before:{label:"Relance J-2",className:"bg-red-500/20 text-red-400 border-red-500/30"},abandoned_checkout:{label:"Panier abandonné",className:"bg-amber-500/20 text-amber-400 border-amber-500/30"},abandoned_checkout_72h:{label:"Panier abandonné 72h",className:"bg-amber-500/20 text-amber-400 border-amber-500/30"},abandoned_checkout_48h_before:{label:"Panier abandonné J-2",className:"bg-amber-600/20 text-amber-300 border-amber-600/30"},payment_link:{label:"Lien de paiement",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30"},badge_unlocked:{label:"Badge débloqué",className:"bg-lime-500/20 text-lime-400 border-lime-500/30"},event_gallery_ready:{label:"Galerie photo",className:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30"},test_event_gallery_ready:{label:"Test galerie photo",className:"bg-cyan-500/10 text-cyan-300 border-cyan-500/20"},event_gallery_access_granted:{label:"Accès galerie accordé",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30"},event_gallery_access_rejected:{label:"Accès galerie refusé",className:"bg-orange-500/20 text-orange-400 border-orange-500/30"},invite:{label:"Invitation",className:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30"},generic:{label:"Autre",className:"bg-muted text-muted-foreground border-border"}},rvt=15;function hfe({eventId:e,eventTitle:t,eventDate:n,venueName:r}){const{photos:i,isLoading:a}=aw(e),{isAdmin:o}=Tt(),{data:l}=Tyt(e),c=Pyt(e),{data:u=[]}=Oyt(e),d=Dyt(e),[f,h]=N.useState(rvt),[p,x]=N.useState(null),[y,b]=N.useState(!1),[w,_]=N.useState(!1),[j,E]=N.useState(""),[S,T]=N.useState(null),P=i.filter(q=>q.status==="visible").length,O=(l==null?void 0:l.status)??"draft",D=O==="published",R=O==="archived"||D&&!!(l!=null&&l.expires_at)&&new Date(l.expires_at)<=new Date,L=u.filter(q=>q.status==="pending"),M=og.find(q=>q.id==="event_gallery_ready")??null,B=(l==null?void 0:l.expires_at)??new Date(Date.now()+f*864e5).toISOString(),U=N.useMemo(()=>({firstName:"Soso",eventTitle:t??"Tournoi Chess Agenda",eventDateLabel:n?Ze(new Date(n),"EEE d MMM 'à' HH'h'mm",{locale:pt}):"date du tournoi",venueName:r??"Lieu du tournoi",photoCount:String(P),expiryLabel:Ze(new Date(B),"d MMMM yyyy",{locale:pt}),galleryUrl:`${window.location.origin}/events/${e}/photos`}),[n,e,t,B,r,P]),F=async q=>{try{const oe=await c.mutateAsync({action:"preflight",expiryDays:f});T(oe),x(q)}catch(oe){je.error(oe instanceof Error?oe.message:"Impossible de préparer l'envoi")}},H=async()=>{try{await c.mutateAsync({action:"test",recipientEmail:j,expiryDays:f}),je.success(`Email de test envoyé à ${j.trim()}`),_(!1)}catch(q){je.error(q instanceof Error?q.message:"Envoi de test impossible")}},z=async(q,oe)=>{try{await d.mutateAsync({requestId:q,decision:oe}),je.success(oe==="approved"?"Accès accordé — le joueur reçoit son lien par email.":"Demande refusée — le joueur est prévenu.")}catch(J){je.error(J instanceof Error?J.message:"Action impossible")}},K=async q=>{x(null);try{const oe=await c.mutateAsync({action:q,expiryDays:q==="publish"?f:void 0});if(q==="archive"){je.success("Album archivé — les photos sont conservées, l'accès public est coupé.");return}je.success(`Album ${q==="publish"?"publié":"renotifié"} · ${oe.sent??0} email(s) envoyé(s)`+(oe.failed?` · ${oe.failed} échec(s)`:""))}catch(oe){je.error(oe instanceof Error?oe.message:"Action impossible")}},W=R?s.jsx(we,{variant:"secondary",children:"Archivé"}):O==="published"?s.jsx(we,{className:"bg-emerald-600 hover:bg-emerald-600",children:"Publié"}):s.jsx(we,{variant:"outline",children:"Brouillon"});return s.jsxs(Se,{children:[s.jsx(kt,{children:s.jsxs(Et,{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(kf,{className:"h-4 w-4"}),"Galerie photo"]}),W]})}),s.jsxs(De,{className:"space-y-5",children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Ajoutez les photos, vérifiez-les, puis publiez. L'email n'est envoyé qu'à la publication — jamais à chaque upload — et uniquement aux joueurs pointés (check-in) de cet événement. Passée la période d'accès, l'album est",s.jsx("strong",{children:" archivé"})," : aucune photo n'est supprimée, elles restent visibles ici et un joueur peut redemander l'accès."]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:[s.jsxs("span",{className:"font-medium",children:[P," photo(s) visible(s)"]}),(l==null?void 0:l.published_at)&&s.jsxs("span",{className:"text-muted-foreground",children:["· Publié le ",Ze(new Date(l.published_at),"d MMM yyyy 'à' HH:mm",{locale:pt})]}),(l==null?void 0:l.expires_at)&&s.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[s.jsx(Vt,{className:"h-3.5 w-3.5"}),"Accès public jusqu'au ",Ze(new Date(l.expires_at),"d MMM yyyy",{locale:pt})," puis archivage"]}),!!(l!=null&&l.notified_count)&&s.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[s.jsx(lxe,{className:"h-3.5 w-3.5"}),l.notified_count," email(s) envoyé(s)"]})]}),u.length>0&&s.jsxs("div",{className:"rounded-xl border border-[#0D0D0D]/10 bg-muted/40 p-4",children:[s.jsxs("div",{className:"mb-3 flex items-center gap-2 text-sm font-semibold",children:[s.jsx(sxe,{className:"h-4 w-4"}),"Demandes d'accès",L.length>0&&s.jsxs(we,{variant:"secondary",children:[L.length," en attente"]})]}),s.jsx("ul",{className:"space-y-3",children:u.slice(0,10).map(q=>s.jsxs("li",{className:"flex flex-col gap-2 rounded-lg bg-background p-3 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{className:"min-w-0 text-sm",children:[s.jsx("p",{className:"truncate font-medium",children:q.requester_name||q.requester_email||"Joueur"}),s.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[q.requester_email," ·"," ",Ze(new Date(q.created_at),"d MMM yyyy",{locale:pt})]}),q.message&&s.jsxs("p",{className:"mt-1 text-xs italic text-muted-foreground",children:["« ",q.message," »"]})]}),q.status==="pending"?s.jsxs("div",{className:"flex shrink-0 gap-2",children:[s.jsxs(Q,{size:"sm",onClick:()=>z(q.id,"approved"),disabled:d.isPending,children:[s.jsx(is,{className:"mr-1 h-4 w-4"}),"Accorder"]}),s.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>z(q.id,"rejected"),disabled:d.isPending,children:[s.jsx(Er,{className:"mr-1 h-4 w-4"}),"Refuser"]})]}):s.jsx(we,{variant:q.status==="approved"?"default":"secondary",className:"shrink-0",children:q.status==="approved"?q.granted_until?`Accordé jusqu'au ${Ze(new Date(q.granted_until),"d MMM yyyy",{locale:pt})}`:"Accordé":"Refusé"})]},q.id))})]}),s.jsx(Cae,{eventId:e}),!D&&s.jsx("div",{className:"flex flex-wrap items-end gap-3",children:s.jsxs("div",{className:"space-y-1",children:[s.jsx(Fe,{htmlFor:"gallery-expiry",className:"text-xs",children:"Durée d'accès (jours)"}),s.jsx(Ue,{id:"gallery-expiry",type:"number",min:1,max:365,value:f,onChange:q=>h(Number(q.target.value)),className:"w-28"})]})}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(Q,{onClick:()=>F(D?"notify":"publish"),disabled:c.isPending||P===0||R,children:[c.isPending?s.jsx(We,{className:"mr-2 h-4 w-4 animate-spin"}):s.jsx(ca,{className:"mr-2 h-4 w-4"}),D?"Renvoyer l'email aux joueurs":"Publier et notifier les joueurs"]}),s.jsxs(Q,{variant:"outline",onClick:()=>b(!0),disabled:!M,children:[s.jsx(go,{className:"mr-2 h-4 w-4"}),"Aperçu de l'email"]}),s.jsxs(Q,{variant:"outline",onClick:()=>_(!0),disabled:P===0,children:[s.jsx(ca,{className:"mr-2 h-4 w-4"}),"Envoyer un test"]}),o&&s.jsx(Q,{variant:"ghost",asChild:!0,children:s.jsxs(Pe,{to:"/admin/emails?template=event_gallery_ready",children:[s.jsx(o1,{className:"mr-2 h-4 w-4"}),"Modifier le texte"]})}),D&&!R&&s.jsxs(Q,{variant:"outline",onClick:()=>x("archive"),disabled:c.isPending,children:[s.jsx(g5,{className:"mr-2 h-4 w-4"}),"Archiver l'album"]})]}
2650),!a&&P===0&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"Ajoutez au moins une photo pour pouvoir publier."}),s.jsx(e6,{eventId:e,eventTitle:t,canUpload:!1,canViewAll:!0})]}),s.jsx(yr,{open:p!==null,onOpenChange:q=>!q&&x(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:p==="archive"?"Archiver l'album ?":p==="notify"?"Renvoyer l'email ?":"Publier l'album ?"}),s.jsx(lr,{children:p==="archive"?"L'accès public est immédiatement coupé, y compris via les liens personnels. Les photos et les fichiers sont conservés : vous continuez à les voir ici, et les joueurs pourront demander un accès que vous accepterez ou refuserez.":`${P} photo(s) · ${(S==null?void 0:S.recipients)??0} destinataire(s). Un email sera envoyé aux joueurs pointés avec un lien personnel valable ${D&&(l!=null&&l.expires_at)?`jusqu'au ${Ze(new Date(l.expires_at),"d MMMM yyyy",{locale:pt})}`:`${f} jours`}. ${P} photo(s) seront visibles.`})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsx(vr,{onClick:()=>p&&K(p),children:"Confirmer"})]})]})}),s.jsx(Ln,{open:w,onOpenChange:_,children:s.jsxs(Dn,{className:"sm:max-w-md",children:[s.jsxs(Un,{children:[s.jsx(qn,{children:"Envoyer un email de test"}),s.jsx(qr,{children:"Le test utilise les vraies informations de cet événement. Aucun participant ne sera notifié et la galerie restera en brouillon."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:`gallery-test-${e}`,children:"Adresse email de test"}),s.jsx(Ue,{id:`gallery-test-${e}`,type:"email",value:j,onChange:q=>E(q.target.value),placeholder:"[email protected]"})]}),s.jsxs(Pi,{children:[s.jsx(Q,{variant:"outline",onClick:()=>_(!1),children:"Annuler"}),s.jsxs(Q,{onClick:H,disabled:c.isPending||!j.trim(),children:[c.isPending&&s.jsx(We,{className:"mr-2 h-4 w-4 animate-spin"}),"Envoyer le test"]})]})]})}),s.jsx(ffe,{template:M,open:y,onOpenChange:b,previewData:U})]})}function svt(e,t){const n=new Date(t),r=new Date,i=Bje(n,r),a=C0(n,r);switch(e){case"start":return{title:"Démarrer le tournoi ?",description:"Démarrer le tournoi permet de commencer à enregistrer les participants qui arrivent et de lancer les appariements.",warning:ivt(i,a,MNe(n),QI(n)),confirmLabel:"Oui, démarrer",cancelLabel:"Annuler",variant:i>1?"warning":"default"};case"complete":return{title:"Terminer le tournoi ?",description:"Le tournoi sera marqué comme terminé. Les classements finaux seront figés.",warning:"Vous pourrez réactiver le tournoi si vous avez cliqué par erreur.",confirmLabel:"Oui, terminer",cancelLabel:"Annuler",variant:"default"};case"reactivate":return{title:"Réactiver le tournoi ?",description:"Le tournoi repassera en statut 'En cours'. Vous pourrez continuer à gérer les rondes et les scores.",confirmLabel:"Réactiver",cancelLabel:"Annuler",variant:"default"}}}function ivt(e,t,n,r){if(n&&!r)return"⚠️ La date prévue du tournoi est déjà passée.";if(e>=7)return`⚠️ Êtes-vous sûr ? Votre tournoi est prévu dans ${e} jours.`;if(e>=2)return`⚠️ Votre tournoi est prévu dans ${e} jours. Confirmez-vous le démarrage maintenant ?`;if(e===1)return"ℹ️ Le tournoi est prévu demain.";if(!r&&t>2)return`ℹ️ Le tournoi commence dans ${t} heures.`}const avt={start:s.jsx(Na,{className:"w-5 h-5"}),complete:s.jsx(Cn,{className:"w-5 h-5"}),reactivate:s.jsx(xo,{className:"w-5 h-5"})};function mfe({open:e,onOpenChange:t,action:n,eventDate:r,onConfirm:i,isLoading:a=!1}){var u,d;if(!e||!n)return null;const o=svt(n,r),l=(u=o.warning)==null?void 0:u.startsWith("⚠️"),c=(d=o.warning)==null?void 0:d.startsWith("ℹ️");return s.jsx(yr,{open:e,onOpenChange:t,children:s.jsxs(sr,{className:"sm:max-w-md",children:[s.jsx(ir,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:ae("w-10 h-10 rounded-xl flex items-center justify-center",n==="start"&&"bg-primary/10 text-primary",n==="complete"&&"bg-green-500/10 text-green-600",n==="reactivate"&&"bg-amber-500/10 text-amber-600"),children:avt[n]}),s.jsx(or,{className:"text-left",children:o.title})]})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx(lr,{className:"text-base",children:o.description}),o.warning&&s.jsxs("div",{className:ae("status-warning-box flex items-start gap-3 p-3 rounded-xl",l&&"status-warning-box-warning",c&&"status-warning-box-info"),children:[l?s.jsx(ur,{className:"w-5 h-5 text-amber-600 shrink-0 mt-0.5"}):s.jsx(wl,{className:"w-5 h-5 text-blue-600 shrink-0 mt-0.5"}
2650),s.jsx("p",{className:"text-sm text-foreground/80",children:o.warning.replace(/^[⚠️ℹ️]\s*/,"")})]})]}),s.jsxs(ar,{className:"mt-4 gap-2 sm:gap-0",children:[s.jsx(cr,{disabled:a,children:o.cancelLabel}),s.jsxs(vr,{onClick:i,disabled:a,className:ae(n==="start"&&"bg-primary hover:bg-primary/90",n==="complete"&&"bg-green-600 hover:bg-green-700",n==="reactivate"&&"bg-amber-600 hover:bg-amber-700"),children:[a?s.jsx(xo,{className:"w-4 h-4 animate-spin mr-2"}):null,o.confirmLabel]})]})]})})}function pfe(e){return st({queryKey:["tournament-threshold",e],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await re.from("events").select("event_date, time_control, status, rounds_count, min_players").eq("id",e).maybeSingle();if(n||!t||!["published","ongoing"].includes(t.status))return null;const{count:r,error:i}=await re.from("tickets").select("*",{count:"exact",head:!0}).eq("event_id",e).in("status",["paid","reserved"]);if(i)return null;const a=r||0;let o;if(t.min_players)o=Math.max(rm,t.min_players);else if(t.rounds_count)o=mee(t.rounds_count);else{const p=gee(t.time_control);o=Math.max(rm,JSe(p))}const l=$Ne(t.event_date),u=C0(l,new Date),d=Math.max(0,u-V$),f=u<=V$&&u>0,h=Math.min(100,Math.round(a/o*100));return{isAtRisk:a<o,currentCount:a,minRequired:o,hoursUntilEvent:u,hoursUntilCheck:d,isWithinCheckWindow:f,progressPercent:h}},enabled:!!e,refetchInterval:6e4,staleTime:1e4})}function gfe({status:e,currentCountOverride:t,isSyncing:n,className:r}){const{minRequired:i,hoursUntilCheck:a,isWithinCheckWindow:o}=e,l=t??e.currentCount,c=l<i,u=Math.min(100,Math.round(l/i*100));if(!c)return s.jsx("div",{className:ae("relative overflow-hidden rounded-xl p-4","bg-gradient-to-br from-emerald-500/10 via-emerald-500/5 to-transparent","border border-emerald-500/20","backdrop-blur-sm",r),children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-emerald-500/20 flex items-center justify-center",children:n?s.jsx("div",{className:"w-5 h-5 rounded-full bg-emerald-500 animate-pulse"}):s.jsx(Jr,{className:"w-5 h-5 text-emerald-600"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("p",{className:"font-medium text-emerald-700 dark:text-emerald-400",children:"Tournoi confirmé"}),n&&s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-emerald-600/70",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"}),"LIVE"]})]}),s.jsxs("p",{className:"text-sm text-emerald-600/80 dark:text-emerald-400/80",children:[l," inscrits (seuil minimum : ",i,")"]})]})]})});const d=o,f=d?"text-destructive":"text-amber-600",h=d?"from-destructive/15 via-destructive/5 to-transparent":"from-amber-500/15 via-amber-500/5 to-transparent",p=d?"border-destructive/30":"border-amber-500/30",x=d?"text-destructive dark:text-red-400":"text-amber-700 dark:text-amber-400",y=d?"text-destructive/80 dark:text-red-400/80":"text-amber-600/80 dark:text-amber-400/80";return s.jsxs("div",{className:ae("relative overflow-hidden rounded-xl p-4",`bg-gradient-to-br ${h}`,`border ${p}`,"backdrop-blur-sm",d&&"animate-pulse",r),children:[s.jsx("div",{className:ae("absolute -top-12 -right-12 w-32 h-32 rounded-full blur-3xl op
2650acity-20",d?"bg-destructive":"bg-amber-500")}),s.jsxs("div",{className:"relative z-10 space-y-3",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:ae("flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center",d?"bg-destructive/20":"bg-amber-500/20"),children:s.jsx(ur,{className:ae("w-5 h-5",f)})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:ae("font-semibold",x),children:d?"Action requise":"Seuil non atteint"}),s.jsxs("p",{className:ae("text-sm",y),children:[l," inscrits sur ",i," requis — encore ",i-l," pour confirmer"]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(du,{value:u,className:ae("h-2",d?"[&>div]:bg-destructive":"[&>div]:bg-amber-500")}),s.jsxs("div",{className:"flex justify-between text-xs",children:[s.jsxs("span",{className:y,children:[s.jsx(sn,{className:"w-3 h-3 inline mr-1"}),u,"% du seuil"]}),!o&&a>0&&s.jsxs("span",{className:y,children:[s.jsx(Vt,{className:"w-3 h-3 inline mr-1"}),"Vérification dans ",a,"h"]}),o&&s.jsxs("span",{className:"text-destructive font-medium",children:[s.jsx(Vt,{className:"w-3 h-3 inline mr-1"}),"Fenêtre critique active"]})]})]}),d&&s.jsx("p",{className:"text-xs text-destructive/90 dark:text-red-400/90 mt-2 p-2 rounded-lg bg-destructive/10",children:"Le seuil doit être atteint 4h avant le début du tournoi. Décidez si vous maintenez ou annulez l'événement."})]})]})}const QH=e=>e==="start"||e==="complete"||e==="reactivate"?e:null,JH={draft:{label:"Brouillon",variant:"secondary"},published:{label:"Publié",variant:"default"},ongoing:{label:"En cours",variant:"outline"},completed:{label:"Terminé",variant:"secondary"},cancelled:{label:"Annulé",variant:"destructive"}},ovt={swiss:"Système Suisse"};function lvt(){var w;const{id:e}=Wi(),[t,n]=N.useState(!1),[r,i]=N.useState(!1),[a,o]=N.useState(null),{data:l,isLoading:c}=nh(e),{data:u=0}=_C(e),{data:d=0}=Pte(e),{data:f}=pfe(e),h=qb(),p=cee();if(c)return s.jsxs("div",{className:"space-y-6",children:[s.jsx(Ie,{className:"h-8 w-32"}),s.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"md:col-span-2 space-y-6",children:[s.jsx(Ie,{className:"h-48"}),s.jsx(Ie,{className:"h-32"})]}),s.jsx(Ie,{className:"h-64"})]})]});if(!l)return s.jsxs("div",{className:"text-center py-12",children:[s.jsx("p",{className:"text-muted-foreground mb-4",children:"Cet événement n'existe pas."}),s.jsx(Pe,{to:"/admin/events",children:s.jsx(Q,{children:"Retour à la liste"})})]});const x=async _=>{await h.mutateAsync({id:l.id,status:_}),o(null)},y=async()=>{a==="start"?await x("ongoing"):a==="complete"?await x("completed"):a==="reactivate"&&await x("ongoing")},b=async()=>{await p.mutateAsync(l.id)};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Pe,{to:"/admin/events",className:"inline-flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors mb-6",children:[s.jsx(Fn,{className:"w-4 h-4"}),"Retour aux événements"]}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(we,{variant:JH[l.status].variant,children:JH[l.status].label}),s.jsx(we,{variant:"outline",children:ovt[l.format||"swiss"]})]}),s.jsx("h1",{className:"font-display text-2xl font-bold",children:l.title})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>n(!0),children:[s.jsx($k,{className:"w-4 h-4 mr-2"}),"Modifier"]}),s.jsxs(Q,{variant:"outline",size:"sm",onClick:b,children:[s.jsx(Ko,{className:"w-4 h-4 mr-2"}),"Dupliquer"]}),l.status==="draft"&&s.jsxs(Q,{size:"sm",onClick:()=>o("publish"),children:[s.jsx(ca,{className:"w-4 h-4 mr-2"}),"Publier"]}),l.status==="published"&&s.jsxs(s.Fragment,{children:[s.jsxs(Q,{size:"sm",onClick:()=>o("start"),children:[s.jsx(Na,{className:"w-4 h-4 mr-2"}),"Démarrer"]}),s.jsxs(Q,{size:"sm",variant:"destructive",onClick:()=>o("cancel"),children:[s.jsx(hi,{className:"w-4 h-4 mr-2"}),"Annuler"]})]}),l.status==="ongoing"&&s.jsxs(s.Fragment,{children:[s.jsx(Pe,{to:`/admin/events/${l.id}/tournament`,children:s.jsxs(Q,{size:"sm",className:"gap-2",children:[s.jsx(Xt,{className:"w-4 h-4"}),"Gérer le tournoi"]})}),s.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>o("complete"),children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),"Terminer"]})]}),l.status==="completed"&&s.jsxs(s.Fragment,{children:[s.jsx(Pe,{to:`/admin/events/${l.id}/tournament`,children:s.jsxs(Q,{size:"sm",variant:"default",className:"gap-2",children:[s.jsx(Xt,{className:"w-4 h-4"}),"Voir les résultats"]})}),s.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>o("reactivate"),children:[s.jsx(xo,{className:"w-4 h-4 mr-2"}),"Réactiver"]})]})]})]}),s.jsx(Se,{className:"bg-card/80 backdrop-blur-sm border-primary/10",children:s.jsx(De,{className:"py-4",children:s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[s.jsx(Pe,{to:`/admin/events/${l.id}/checkin`,className:"flex-1",children:s.jsxs(Q,{className:"w-full justify-start sm:justify-center gap-2",children:[s.jsx(nu,{className:"w-4 h-4"}),s.jsx("span",{children:"Check-in & Conso"})]})}),s.jsxs(Q,{variant:"outline",className:"flex-1 justify-start sm:justify-center gap-2 border-dashed border-primary/30",onClick:()=>i(!0),disabled:!["published","ongoing"].includes(l.status),children:[s.jsx(cs,{className:"w-4 h-4"}),s.jsx("span",{children:"Inscription excep."}),u>=l.capacity&&s.jsx(we,{variant:"secondary",className:"ml-1",children:"Complet"})]}),s.jsx(Pe,{to:`/events/${l.id}`,target:"_blank",className:"flex-1",children:s.jsxs(Q,{variant:"outline",className:"w-full justify-start sm:justify-center gap-2",children:[s.jsx(pd,{className:"w-4 h-4"}),"Page publique"]})})]})})}),f&&["published","ongoing"].includes(l.status)&&s.jsx(gfe,{status:f}),s.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"md:col-span-2 space-y-6",children:[s.jsxs(Se,{children:[s.jsx(kt,{children:s.jsx(Et,{children:"Informations"})}),s.jsxs(De,{className:"space-y-4",children:[s.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(Jn,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Date"}
2650),s.jsx("p",{className:"font-medium",children:Ze(new Date(l.event_date),"EEEE d MMMM yyyy",{locale:pt})})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(Vt,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Heure"}),s.jsx("p",{className:"font-medium",children:Ze(new Date(l.event_date),"HH'h'mm")})]})]}),l.venue&&s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(gn,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Lieu"}),s.jsx("p",{className:"font-medium",children:l.venue.name}),s.jsx("p",{className:"text-sm text-muted-foreground",children:l.venue.city})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(Xt,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Format"}),s.jsxs("p",{className:"font-medium",children:[l.rounds_count," rondes, ",l.time_control||"10+0"]})]})]})]}),l.description&&s.jsxs(s.Fragment,{children:[s.jsx(Fs,{}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Description"}),s.jsx("p",{className:"whitespace-pre-wrap",children:l.description})]})]}),l.rules&&s.jsxs(s.Fragment,{children:[s.jsx(Fs,{}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Règles"}),s.jsx("p",{className:"whitespace-pre-wrap",children:l.rules})]})]})]})]}),s.jsxs(Se,{children:[s.jsx(kt,{children:s.jsxs(Et,{className:"flex items-center justify-between",children:[s.jsx("span",{children:"Participants"}),s.jsxs(we,{variant:"outline",children:[u,"/",l.capacity]})]})}),s.jsx(De,{children:s.jsx(M8,{eventId:l.id,capacity:l.capacity,allowManualCheckin:!0})})]}),s.jsx(Ayt,{eventId:l.id}),s.jsx(hfe,{eventId:l.id,eventTitle:l.title,eventDate:l.event_date,venueName:(w=l.venue)==null?void 0:w.name})]}),s.jsx("div",{className:"space-y-6",children:s.jsxs(Se,{children:[s.jsx(kt,{children:s.jsx(Et,{children:"Statistiques"})}),s.jsxs(De,{className:"space-y-4",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-muted-foreground",children:"Inscrits"}),s.jsxs("span",{className:"font-medium",children:[u,"/",l.capacity]})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-muted-foreground",children:"Places restantes"}),s.jsx("span",{className:"font-medium",children:l.capacity-u})]}),f&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-muted-foreground",children:"Seuil de maintien"}),s.jsxs(we,{variant:u>=f.minRequired?"default":"destructive",children:[u,"/",f.minRequired]})]}),d>0&&s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-muted-foreground",children:"Liste d'attente"}),s.jsxs(we,{variant:"secondary",children:[d," en attente"]})]}),s.jsx(Fs,{}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-muted-foreground",children:"Prix ticket"}),s.jsxs("span",{className:"font-medium",children:[(l.price_cents/100).toFixed(2),"€"]})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-muted-foreground",children:"Crédit conso"}),s.jsxs("span",{className:"font-medium",children:[(l.credit_amount_cents/100).toFixed(2),"€"]})]}),s.jsx(Fs,{}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-muted-foreground",children:"Revenus potentiels"}),s.jsxs("span",{className:"font-bold text-lg",children:[(l.price_cents*u/100).toFixed(2),"€"]})]})]})]})})]}),s.jsx(sw,{open:t,onOpenChange:n,event:l}),s.jsx(rS,{open:r,onOpenChange:i,event:{id:l.id,title:l.title,price_cents:l.price_cents,credit_amount_cents:l.credit_amount_cents,capacity:l.capacity,coupon_mode:l.coupon_mode??null,paper_coupon_label:l.paper_coupon_label??null,paper_coupon_description:l.paper_coupon_description??null,paper_coupon_formulas:l.paper_coupon_formulas??null,venue:l.venue??null},currentTicketCount:u}),s.jsx(mfe,{open:!!QH(a),onOpenChange:()=>o(null),action:QH(a),eventDate:l.event_date,onConfirm:y,isLoading:h.isPending}
2650),s.jsx(yr,{open:a==="publish"||a==="cancel",onOpenChange:()=>o(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:a==="publish"?"Publier l'événement ?":"Annuler l'événement ?"}),s.jsx(lr,{children:a==="publish"?"L'événement sera visible publiquement et les inscriptions seront ouvertes.":"Cette action est irréversible. Les joueurs inscrits seront notifiés."})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsx(vr,{onClick:()=>x(a==="publish"?"published":"cancelled"),className:a==="cancel"?"bg-destructive hover:bg-destructive/90":"",children:a==="publish"?"Publier":"Confirmer l'annulation"})]})]})})]})}const cvt="https://panllzgwiadaxweewisk.supabase.co";function xfe(){const e=Ye();return dt({mutationFn:async t=>{var i;const{data:n}=await re.auth.getSession();if(!((i=n==null?void 0:n.session)!=null&&i.access_token))throw new Error("Not authenticated");const r=await fetch(`${cvt}/functions/v1/update-player-stats`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.session.access_token}`},body:JSON.stringify({eventId:t})});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error||"Failed to update player stats")}return r.json()},onSuccess:t=>{e.invalidateQueries({queryKey:["player-stats"]}),e.invalidateQueries({queryKey:["player-history"]}),e.invalidateQueries({queryKey:["player-achievements"]}),console.log(`Player stats updated: ${t.playersUpdated} players`)},onError:t=>{console.error("Error updating player stats:",t),je.error("Erreur lors de la mise à jour des statistiques")}})}const uvt=2e3,dvt=3e3,fvt=1500;function hvt({eventId:e,currentRound:t,totalRounds:n,enabled:r=!0}){const i=Ye(),{data:a}=mle(t==null?void 0:t.id),o=ile();dw();const l=qb(),c=xfe(),[u,d]=N.useState(!1),[f,h]=N.useState(!1),[p,x]=N.useState(null),[y,b]=N.useState(!1),[w,_]=N.useState("idle"),[j,E]=N.useState(null),S=N.useRef(null),T=N.useRef(null),P=N.useRef(null);return N.useEffect(()=>()=>{S.current&&clearTimeout(S.current),T.current&&clearTimeout(T.current),P.current&&clearTimeout(P.current)},[]),N.useEffect(()=>{if(r&&!(!t||t.status!=="active")&&a!=null&&a.isRoundComplete&&!(t.round_number>=n)&&!u&&p!==t.id)return S.current&&clearTimeout(S.current),S.current=setTimeout(async()=>{d(!0);try{const{data:O,error:D}=await re.from("rounds").select("status").eq("id",t.id).maybeSingle();if(D||!O||O.status!=="active"){console.log("[AutoProgression] Round already completed, skipping"),x(t.id),d(!1);return}const R=await o.mutateAsync({roundId:t.id,eventId:e,currentRoundNumber:t.round_number,totalRounds:n,silent:!0});x(t.id),R.pairingsGenerated&&je.success(`Ronde ${t.round_number+1} prête !`,{description:"Les appariements ont été générés automatiquement"}),i.invalidateQueries({queryKey:["event-rounds",e]}),i.invalidateQueries({queryKey:["tournament-data",e]}),i.invalidateQueries({queryKey:["round-progress"]})}catch(O){console.log("[AutoProgression] Error during progression:",O)}finally{d(!1)}},uvt),()=>{S.current&&clearTimeout(S.current)}},[r,t==null?void 0:t.id,t==null?void 0:t.status,t==null?void 0:t.round_number,a==null?void 0:a.isRoundComplete,n,u,p,e,o,i]),N.useEffect(()=>{if(r&&!(!t||t.status!=="active")&&a!=null&&a.isRoundComplete&&!(t.round_number<n)&&!y&&j!==e)return P.current&&clearTimeout(P.current),console.log("[AutoClose] Last round complete detected, starting closure sequence..."),P.current=setTimeout(async()=>{b(!0);try{_("completing-round");const{data:O}=await re.from("rounds").select("status").eq("id",t.id).maybeSingle();(O==null?void 0:O.status)==="active"&&await re.from("rounds").update({status:"completed",completed_at:new Date().toISOString()}).eq("id",t.id).eq("status","active"),_("updating-status"),await l.mutateAsync({id:e,status:"completed"}),_("updating-stats"),await c.mutateAsync(e),_("complete"),E(e),je.success("🏆 Tournoi terminé !",{description:"Le classement final et les statistiques ont été enregistrés."}),i.invalidateQueries({queryKey:["event-rounds",e]}),i.invalidateQueries({queryKey:["event",e]}),i.invalidateQueries({queryKey:["tournament-data",e]}
2650),i.invalidateQueries({queryKey:["player-stats"]}),i.invalidateQueries({queryKey:["player-achievements"]})}catch(O){console.error("[AutoClose] Error during closure:",O),_("error"),je.error("Erreur lors de la clôture automatique",{description:"Vous pouvez clôturer manuellement le tournoi."})}},dvt),()=>{P.current&&clearTimeout(P.current)}},[r,t==null?void 0:t.id,t==null?void 0:t.status,t==null?void 0:t.round_number,a==null?void 0:a.isRoundComplete,n,y,j,e,l,c,i]),{isProgressing:u,isAutoStarting:f,lastProgressedRoundId:p,isClosing:y,closeProgress:w}}function mvt({eventId:e,pendingRound:t,pairingsCount:n,enabled:r=!0}){const i=Ye(),a=dw(),[o,l]=N.useState(!1),[c,u]=N.useState(null),d=N.useRef(null);return N.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]),N.useEffect(()=>{if(r&&!(!t||t.status!=="pending")&&n!==0&&!o&&c!==t.id)return d.current&&clearTimeout(d.current),d.current=setTimeout(async()=>{l(!0);try{const{data:f}=await re.from("rounds").select("status").eq("id",t.id).maybeSingle();if(!f||f.status!=="pending"){u(t.id),l(!1);return}await a.mutateAsync({roundId:t.id,silent:!0}),u(t.id),i.invalidateQueries({queryKey:["event-rounds",e]}),i.invalidateQueries({queryKey:["tournament-data",e]})}catch(f){console.log("[AutoStart] Error starting round:",f)}finally{l(!1)}},fvt),()=>{d.current&&clearTimeout(d.current)}},[r,t==null?void 0:t.id,t==null?void 0:t.status,n,o,c,e,a,i]),{isAutoStarting:o}}const pvt=1500;function yfe({eventId:e,eventStatus:t,roundsCount:n,enabled:r=!0,onRoundSelect:i}){const a=Ye(),o=E6(),l=S6(),c=dw(),[u,d]=N.useState(!1),f=N.useRef(!1),h=N.useRef(null);return N.useEffect(()=>{f.current=!1},[e]),N.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]),N.useEffect(()=>{if(r&&e&&t==="ongoing"&&!(n>0)&&!u&&!f.current)return h.current&&clearTimeout(h.current),h.current=setTimeout(async()=>{const{data:p}=await re.from("rounds").select("id").eq("event_id",e).limit(1);if(p&&p.length>0){console.log("[AutoFirstRound] Rounds already exist, skipping"),f.current=!0;return}f.current=!0,d(!0);try{console.log("[AutoFirstRound] Creating Round 1...");const x=await o.mutateAsync({eventId:e,roundNumber:1});console.log("[AutoFirstRound] Round created:",x.id),await l.mutateAsync({roundId:x.id,eventId:e}),console.log("[AutoFirstRound] Pairings generated"),await c.mutateAsync({roundId:x.id,silent:!0}),console.log("[AutoFirstRound] Round started"),a.invalidateQueries({queryKey:["event-rounds",e]}),a.invalidateQueries({queryKey:["tournament-data",e]}),i==null||i(x.id),je.success("Ronde 1 prête !",{description:"Les appariements ont été générés automatiquement."})}catch(x){console.error("[AutoFirstRound] Error:",x),f.current=!1,je.error("Erreur lors de la préparation automatique",{description:"Utilisez les boutons manuels pour créer la ronde."})}finally{d(!1)}},pvt),()=>{h.current&&clearTimeout(h.current)}},[r,e,t,n,u,o,l,c,a,i]),{isPreparing:u}}function $8({eventId:e,rounds:t,totalRounds:n,enabled:r=!0}){const i=t.find(p=>p.status==="active"),a=t.find(p=>p.status==="pending"),[o,l]=N.useState(0);N.useEffect(()=>{if(!a){l(0);return}const p=async()=>{const{count:y}=await re.from("pairings").select("id",{count:"exact",head:!0}).eq("round_id",a.id);l(y||0)};p();const x=re.channel(`pairings-count-${a.id}`).on("postgres_changes",{event:"*",schema:"public",table:"pairings"},()=>p()).subscribe();return()=>{re.removeChannel(x)}},[a==null?void 0:a.id]);const{isProgressing:c,lastProgressedRoundId:u,isClosing:d,closeProgress:f}=hvt({eventId:e,currentRound:i,totalRounds:n,enabled:r}),{isAutoStarting:h}=mvt({eventId:e,pendingRound:a,pairingsCount:o,enabled:r});return{isProgressing:c,isAutoStarting:h,isTransitioning:c||h,isClosing:d,closeProgress:f,activeRound:i,pendingRound:a,lastProgressedRoundId:u}}const gvt=[{value:"white_wins",label:"1 - 0",description:"Blancs gagnent"},{value:"draw",label:"½ - ½",description:"Nulle"},{value:"black_wins",label:"0 - 1",description:"Noirs gagnent"}];function xvt({open:e,onOpenChange:t,pairingId:n,whitePlayerName:r,blackPlayerName:i,currentResult:a}){const[o,l]=N.useState(a&&a!=="pending"?a:null),[c,u]=N.useState(""),d=kqe(),f=async()=>{o&&(await d.mutateAsync({pairingId:n,result:o,notes:c||void 0}),t(!1),l(null),u(""))};return s.jsx(Ln,{open:e,onOpenChange:t,children:s.jsxs(Dn,{className:"sm:max-w-md",children:[s.jsxs(Un,{children:[s.jsx(qn,{
2650children:"Saisir le résultat"}),s.jsxs(qr,{children:[r," (Blancs) vs ",i," (Noirs)"]})]}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx("div",{className:"grid grid-cols-3 gap-2",children:gvt.map(h=>s.jsxs("button",{onClick:()=>l(h.value),className:ae("flex flex-col items-center justify-center p-4 rounded-lg border-2 transition-all",o===h.value?"border-primary bg-primary/10":"border-border hover:border-primary/50 hover:bg-muted"),children:[s.jsx("span",{className:"text-2xl font-bold font-mono mb-1",children:h.label}),s.jsx("span",{className:"text-xs text-muted-foreground",children:h.description}),o===h.value&&s.jsx(Cn,{className:"w-4 h-4 text-primary mt-2"})]},h.value))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"notes",children:"Notes (optionnel)"}),s.jsx($s,{id:"notes",placeholder:"Ex: Victoire par mat, partie en 15 coups...",value:c,onChange:h=>u(h.target.value),rows:2})]})]}),s.jsxs(Pi,{children:[s.jsx(Q,{variant:"outline",onClick:()=>t(!1),children:"Annuler"}),s.jsx(Q,{onClick:f,disabled:!o||d.isPending,children:d.isPending?"Enregistrement...":"Confirmer"})]})]})})}function zd(e){return e===void 0?null:e%1===.5?`${Math.floor(e)}½`:`${e}`}const ZH={white_wins:"Victoire Blancs",black_wins:"Victoire Noirs",draw:"Nulle"},yvt={pending:{icon:Vt,label:"En attente",badgeVariant:"outline",cardClass:"",badgeClass:"bg-muted/50 text-muted-foreground",iconClass:"text-muted-foreground"},in_progress:{icon:nxe,label:"En cours",badgeVariant:"secondary",cardClass:"bg-amber-500/5 border-amber-500/20",badgeClass:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/30",iconClass:"text-amber-500"},completed:{icon:Cn,label:"Terminée",badgeVariant:"default",cardClass:"bg-primary/5 backdrop-blur-sm border-primary/20 ring-1 ring-primary/10",badgeClass:"bg-primary text-primary-foreground",iconClass:"text-primary"},disputed:{icon:ur,label:"Litige",badgeVariant:"destructive",cardClass:"bg-destructive/5 border-destructive/20",badgeClass:"bg-destructive/10 text-destructive border-destructive/30",iconClass:"text-destructive"}};function vvt({pairingId:e,tableNumber:t,whitePlayer:n,blackPlayer:r,result:i="pending",validationStatus:a="pending",whitePlayerClaim:o,blackPlayerClaim:l,isBye:c,canEdit:u=!1,canEditPlayers:d=!1,eventId:f,whitePlayerPoints:h,blackPlayerPoints:p,whiteIsGuest:x=!1,blackIsGuest:y=!1,whiteTicketId:b,blackTicketId:w,onUnpair:_,onPlayerClick:j}){const[E,S]=N.useState(!1),[T,P]=N.useState(null),O=_qe(i,a),D=yvt[O],R=D.icon,L=i!=="pending"&&a==="pending"&&(o||l);if(c)return s.jsx(Se,{className:"border-dashed opacity-75",children:s.jsx(De,{className:"p-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(we,{variant:"outline",className:"text-muted-foreground",children:"Bye"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(Bi,{className:"h-8 w-8",children:[s.jsx(Ra,{src:(n==null?void 0:n.avatar_url)||void 0}),s.jsx(zi,{className:"bg-muted text-muted-foreground text-xs",children:cc(n)})]}),s.jsx("span",{className:"font-medium",children:fs(n)})]})]}),s.jsx(we,{variant:"secondary",children:"+1 pt"})]})})});const M=O==="completed";return s.jsxs(s.Fragment,{children:[s.jsx(Se,{className:ae("transition-all duration-300",D.cardClass,L&&"ring-2 ring-amber-500/50"),children:s.jsxs(De,{className:"p-3 sm:p-4",children:[s.jsxs("div",{className:"flex items-start sm:items-center gap-2 sm:gap-4",children:[s.jsx("div",{className:ae("shrink-0 w-8 h-8 sm:w-10 sm:h-10 rounded-lg flex items-center justify-center transition-colors",M?"bg-primary/20":"bg-primary/10"),children:s.jsx("span",{className:ae("font-bold text-sm sm:text-base",M?"text-primary":"text-primary/80"),children:t})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex flex-col gap-2 sm:hidden",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-full border-2 border-foreground bg-background shrink-0"}),s.jsxs(Bi,{className:"h-6 w-6 shrink-0",children:[s.jsx(Ra,{src:(n==null?void 0:n.avatar_url)||void 0}),s.jsx(zi,{className:"bg-muted text-[10px]",children:cc(n)})]}),s.jsxs("p",{title:fs(n),className:ae("font-medium text-sm break-words leading-tight line-clamp-2 min-w-0 flex-1",i==="white_wins"&&M&&"text-primary",(d||j)&&"cursor-pointer hover:underline"),onClick:d&&n?()=>P({player:n,isGuest:x,ticketId:b}):j&&n?()=>j(n.id):void 0,children:[fs(n),i==="white_wins"&&M&&s.jsx(sa,{className:"inline w-3 h-3 ml-1 text-primary"})]}),zd(h)&&s.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono shrink-0",children:[zd(h)," pts"]})]}),s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx(we,{variant:D.badgeVariant,className:ae("font-mono text-xs min-w-[48px] justify-center",D.badgeClass),children:Ez[i||"pending"]}),s.jsx("div",{className:ae("flex items-center gap-1 text-xs",D.iconClass),children:s.jsx(R,{className:"w-3 h-3"})})]}),s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-foreground shrink-0"}),s.jsxs(Bi,{className:"h-6 w-6 shrink-0",children:[s.jsx(Ra,{src:(r==null?void 0:r.avatar_url)||void 0}),s.jsx(zi,{className:"bg-foreground text-background text-[10px]",children:cc(r)})]}),s.jsxs("p",{title:fs(r),className:ae("font-medium text-sm break-words leading-tight line-clamp-2 min-w-0 flex-1",i==="black_wins"&&M&&"text-primary",(d||j)&&"cursor-pointer hover:underline"),onClick:d&&r?()=>P({player:r,isGuest:y,ticketId:w}):j&&r?()=>j(r.id):void 0,children:[i==="black_wins"&&M&&s.jsx(sa,{className:"inline w-3 h-3 mr-1 text-primary"}),fs(r)]}),zd(p)&&s.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono shrink-0",children:[zd(p)," pts"]})]})]}),s.jsxs("div",{className:"hidden sm:grid grid-cols-[1fr_auto_1fr] gap-2 items-center",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:"w-3 h-3 rounded-full border-2 border-foreground bg-background shrink-0"}),s.jsxs(Bi,{className:"h-8 w-8 shrink-0",children:[s.jsx(Ra,{src:(n==null?void 0:n.avatar_url)||void 0}),s.jsx(zi,{className:"bg-muted text-xs",children:cc(n)})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("p",{className:ae("font-medium truncate",i==="white_wins"&&M&&"text-primary",(d||j)&&"cursor-pointer hover:underline"),onClick:d&&n?()=>P({player:n,isGuest:x,ticketId:b}):j&&n?()=>j(n.id):void 0,children:[fs(n),i==="white_wins"&&M&&s.jsx(sa,{className:"inline w-3 h-3 ml-1 text-primary"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:[qf(n==null?void 0:n.elo_rating),zd(h)?`${zd(h)}
2650 pts`:null].filter(Boolean).join(" • ")})]})]}),s.jsxs("div",{className:"shrink-0 flex flex-col items-center gap-1.5",children:[s.jsx(we,{variant:D.badgeVariant,className:ae("font-mono text-sm min-w-[56px] justify-center",D.badgeClass),children:Ez[i||"pending"]}),s.jsxs("div",{className:ae("flex items-center gap-1 text-xs",D.iconClass),children:[s.jsx(R,{className:"w-3 h-3"}),s.jsx("span",{children:D.label})]})]}),s.jsxs("div",{className:"flex items-center gap-2 justify-end min-w-0",children:[s.jsxs("div",{className:"min-w-0 text-right",children:[s.jsxs("p",{className:ae("font-medium truncate",i==="black_wins"&&M&&"text-primary",(d||j)&&"cursor-pointer hover:underline"),onClick:d&&r?()=>P({player:r,isGuest:y,ticketId:w}):j&&r?()=>j(r.id):void 0,children:[i==="black_wins"&&M&&s.jsx(sa,{className:"inline w-3 h-3 mr-1 text-primary"}),fs(r)]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:[qf(r==null?void 0:r.elo_rating),zd(p)?`${zd(p)} pts`:null].filter(Boolean).join(" • ")})]}),s.jsxs(Bi,{className:"h-8 w-8 shrink-0",children:[s.jsx(Ra,{src:(r==null?void 0:r.avatar_url)||void 0}),s.jsx(zi,{className:"bg-foreground text-background text-xs",children:cc(r)})]}),s.jsx("div",{className:"w-3 h-3 rounded-full bg-foreground shrink-0"})]})]})]}),s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[u&&_&&!M&&s.jsxs(yr,{children:[s.jsx(P2,{asChild:!0,children:s.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",title:"Désapparier",children:s.jsx(vxe,{className:"w-4 h-4"})})}),s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Désapparier cette table ?"}),s.jsxs(lr,{children:["Les deux joueurs retourneront dans le pool des joueurs non appariés.",i!=="pending"&&" Le résultat enregistré sera supprimé."]})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsx(vr,{onClick:()=>_(e),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Désapparier"})]})]})]}),u&&s.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>S(!0),className:"shrink-0 text-xs sm:text-sm h-8 sm:h-9 px-2 sm:px-3",children:[s.jsx("span",{className:"hidden xs:inline",children:M?"Modifier":"Saisir"}),s.jsx("span",{className:"xs:hidden",children:"✎"})]})]})]}),L&&u&&s.jsx("div",{className:"mt-3 p-2 rounded-lg bg-amber-500/10 border border-amber-500/30",children:s.jsxs("p",{className:"text-xs text-amber-600 dark:text-amber-400 flex items-center gap-1.5 flex-wrap",children:[s.jsx(ur,{className:"w-3.5 h-3.5 shrink-0"}),s.jsxs("span",{className:"break-words",children:["État incohérent — Claims:",o&&` B: ${ZH[o]}`,l&&` N: ${ZH[l]}`]})]})})]})}),s.jsx(xvt,{open:E,onOpenChange:S,pairingId:e,whitePlayerName:fs(n),blackPlayerName:fs(r),currentResult:i||void 0}),T&&f&&s.jsx(O6,{open:!!T,onOpenChange:B=>!B&&P(null),player:T.player,isGuest:T.isGuest,ticketId:T.ticketId,eventId:f})]})}function bvt({eventId:e,roundId:t}){const n=Sqe(e,t),{data:r=[]}=uw(t),i=Pqe(),[a,o]=N.useState([]),[l,c]=N.useState(null),[u,d]=N.useState(!0),f=N.useMemo(()=>r.reduce((w,_)=>Math.max(w,_.table_number||0),0)+1,[r]);if(!n.length)return null;const h=b=>{o(w=>{if(w.includes(b)){const j=w.filter(E=>E!==b);return l===b&&c(j[0]||null),j}if(w.length>=2)return w;const _=[...w,b];return _.length===1&&c(b),_.length===2&&!l&&c(_[0]),_})},p=()=>{if(a.length!==2||!l)return;const b=a.find(j=>j!==l),w=n.find(j=>j.ticketId===l),_=n.find(j=>j.ticketId===b);i.mutate({roundId:t,eventId:e,whiteTicketId:l,blackTicketId:b,whitePlayerId:w!=null&&w.isGuest?null:(w==null?void 0:w.id)||null,blackPlayerId:_!=null&&_.isGuest?null:(_==null?void 0:_.id)||null,isBye:!1,tableNumber:f},{onSuccess:()=>o([])})},x=()=>{if(a.length!==1)return;const b=n.find(w=>w.ticketId===a[0]);i.mutate({roundId:t,eventId:e,whiteTicketId:a[0],blackTicketId:null,whitePlayerId:b!=null&&b.isGuest?null:(b==null?void 0:b.id)||null,blackPlayerId:null,isBye:!0,tableNumber:f},{onSuccess:()=>o([])})},y=()=>{a.length===2&&l&&c(a.find(b=>b!==l))};return s.jsxs(Ix,{open:u,onOpenChange:d,children:[s.jsx(Rx,{asChild:!0,children:s.jsxs(Q,{variant:"outline",className:"w-full justify-between gap-2 border-dashed border-amber-500/40 bg-amber-500/5 hover:bg-amber-500/10",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(sn,{className:"w-4 h-4 text-amber-500"}),s.jsxs("span",{className:"text-sm font-medium",children:["Joueurs non appariés (",n.length,")"]})]}),s.jsx(we,{variant:"outline",className:"text-xs bg-amber-500/10 text-amber-600 border-amber-500/30",children:"Manuel"})]})}),s.jsxs(Mx,{className:"mt-3 space-y-3",children:[s.jsx("div",{className:"grid gap-2",children:n.map(b=>{const w=a.includes(b.ticketId),_=l===b.ticketId,j=w&&!_&&a.length===2;return s.jsxs("button",{onClick:()=>h(b.ticketId),className:ae("flex items-center gap-3 p-3 rounded-xl border transition-all text-left w-full",w?"border-primary/50 bg-primary/5 ring-1 ring-primary/20":"border-border/50 bg-card hover:bg-accent/50"),children:[s.jsxs(Bi,{className:"h-8 w-8 shrink-0",children:[s.jsx(Ra,{src:b.avatar_url||void 0}),s.jsx(zi,{className:"bg-muted text-xs",children:cc(b)})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:fs(b)}),s.jsx("p",{className:"text-xs text-muted-foreground",children:Xm(b.elo_rating)})]}),_&&s.jsxs(we,{variant:"outline",className:"text-xs shrink-0 gap-1 bg-background",children:[s.jsx("div",{className:"w-2 h-2 rounded-full border border-foreground bg-background"}),"Blancs"]}),j&&s.jsxs(we,{variant:"outline",className:"text-xs shrink-0 gap-1 bg-foreground text-background",children:[s.jsx("div",{className:"w-2 h-2 rounded-full bg-foreground"}),"Noirs"]})]},b.ticketId)})}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.length===2&&s.jsxs(s.Fragment,{children:[s.jsxs(Q,{size:"sm",onClick:p,disabled:i.isPending,className:"gap-1.5",children:[s.jsx(sa,{className:"w-3.5 h-3.5"}),"Apparier"]}),s.jsx(Q,{size:"sm",variant:"outline",onClick:y,className:"gap-1.5",children:"⇄ Inverser couleurs"})]}),a.length===1&&s.jsx(Q,{size:"sm",variant:"secondary",onClick:x,disabled:i.isPending,className:"gap-1.5",children:"Bye (+1 pt)"}),a.length>0&&s.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>o([]),children:"Annuler"})]})]})]})}function vfe({roundId:e,eventId:t,roundNumber:n,canEdit:r=!1,canEditPlayers:i=!1,isRetroactive:a=!1,onPlayerClick:o,pairingWarnings:l}){const[c,u]=N.useState(new Set),d=Ye(),{data:f,isLoading:h,isFetching:p,refetch:x}=uw(e),y=Aqe(),{data:b=new Map}=jqe(t,n),w=()=>{d.invalidateQueries({queryKey:["round-pairings",e]}),x()};if(h)return s.jsx("div",{className:"space-y-3",children:[1,2,3,4].map(P=>s.jsx(Ie,{className:"h-20"},P))});if(!f||f.length===0)return s.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Aucun appariement généré pour cette ronde."});const _=f,j=[..._].sort((P,O)=>P.is_bye&&!O.is_bye?1:!P.is_bye&&O.is_bye?-1:(P.table_number||0)-(O.table_number||0)),E=_.filter(P=>P.is_bye?!1:O1(P.game_result)).length,S=_.filter(P=>!P.is_bye).length,T=E===S&&S>0;return s.jsxs("div",{className:"space-y-4",children:[a&&r&&s.jsxs(jl,{className:"border-amber-500/40 bg-amber-500/10",children:[s.jsx(ur,{className:"h-4 w-4 text-amber-500"}),s.jsxs(Nl,{className:"text-sm text-amber-200",children:[s.jsxs("span",{className:"font-medium",children:["Correction rétroactive — Ronde ",n," (terminée)."]})," ","Les modifications seront prises en compte dans le classement."]})]}),l&&l.length>0&&s.jsx("div",{className:"space-y-2",children:l.map((P,O)=>{if(c.has(O))return null;const D=P.severity==="warning";return s.jsxs(jl,{className:ae("relative",D?"border-amber-500/40 bg-amber-500/10":"border-blue-500/40 bg-blue-500/10"),children:[D?s.jsx(ur,{className:"h-4 w-4 text-amber-500"}):s.jsx(wl,{className:"h-4 w-4 text-blue-400"}),s.jsxs(Nl,{className:"text-sm pr-8",children:[s.jsxs("span",{className:"font-mono text-xs opacity-60 mr-1.5",children:["[",P.code,"]"]}),P.message]}),s.jsx(Q,{variant:"ghost",size:"sm",className:"absolute top-1 right-1 h-6 w-6 p-0",onClick:()=>u(R=>new Set(R).add(O)),children:s.jsx(Er,{className:"h-3 w-3"})})]},O)})}),s.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsxs("span",{className:"font-medium",children:[E,"/",S," parties terminées"]}),p&&!h&&s.jsx(xo,{className:"w-3 h-3 animate-spin text-muted-foreground
2650/70"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[T&&s.jsxs(we,{variant:"default",className:"gap-1 bg-primary/90",children:[s.jsx(Cn,{className:"w-3 h-3"}),"Ronde complète"]}),s.jsxs(Q,{variant:"outline",size:"sm",onClick:w,disabled:p,className:"gap-2",children:[s.jsx(xo,{className:ae("w-3 h-3",p&&"animate-spin")}),s.jsx("span",{className:"hidden sm:inline",children:"Actualiser"})]})]})]}),r&&!a&&t&&e&&s.jsx(bvt,{eventId:t,roundId:e}),s.jsx("div",{className:"space-y-3",children:j.map(P=>{const O=F0(P.game_result);return s.jsx(vvt,{pairingId:P.id,tableNumber:P.table_number||0,whitePlayer:P.white_player,blackPlayer:P.black_player,result:(O==null?void 0:O.result)||"pending",validationStatus:(O==null?void 0:O.validation_status)||"pending",whitePlayerClaim:O==null?void 0:O.white_player_claim,blackPlayerClaim:O==null?void 0:O.black_player_claim,isBye:P.is_bye||!1,canEdit:r,canEditPlayers:!a&&i,onPlayerClick:o,eventId:t,whitePlayerPoints:P.white_player?b.get(P.white_player.id):void 0,blackPlayerPoints:P.black_player?b.get(P.black_player.id):void 0,onUnpair:r&&!a?D=>{e&&t&&y.mutate({pairingId:D,roundId:e,eventId:t})}:void 0},P.id)})})]})}
2650const wvt=`
2651  @page { margin: 10mm; }
2652  * { box-sizing: border-box; margin: 0; padding: 0; }
2653  body {
2654    font-family: 'Courier New', monospace;
2655    font-size: 11px;
2656    line-height: 1.4;
2657    color: #000;
2658    background: #fff;
2659  }
2660  .doc-header {
2661    text-align: center;
2662    margin-bottom: 12px;
2663    padding-bottom: 8px;
2664    border-bottom: 2px solid #000;
2665  }
2666  .doc-header h1 { font-size: 14px; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; }
2667  .doc-header p { font-size: 10px; color: #555; margin-top: 2px; }
2668  table { width: 100%; border-collapse: collapse; font-size: 10px; }
2669  th, td { padding: 3px 6px; text-align: left; border-bottom: 1px solid #ccc; }
2670  th { font-weight: bold; border-bottom: 2px solid #000; text-transform: uppercase; font-size: 9px; letter-spacing: 0.5px; }
2671  td.num { text-align: right; font-variant-numeric: tabular-nums; }
2672  td.center, th.center { text-align: center; }
2673  .bye-row { color: #888; font-style: italic; }
2674  .footer { margin-top: 12px; font-size: 9px; color: #888; text-align: center; border-top: 1px solid #ccc; padding-top: 6px; }
2675`;function _vt(){const e=N.useRef(null);return{print:N.useCallback(n=>{var a,o;e.current&&(document.body.removeChild(e.current),e.current=null);const r=document.createElement("iframe");r.style.cssText="position:fixed;top:-9999px;left:-9999px;width:0;height:0;border:none;",document.body.appendChild(r),e.current=r;const i=r.contentDocument||((a=r.contentWindow)==null?void 0:a.document);i&&(i.open(),i.write(`<!DOCTYPE html><html><head><style>${wvt}</style></head><body>${n}</body></html>`),i.close(),(o=r.contentWindow)==null||o.addEventListener("afterprint",()=>{e.current&&(document.body.removeChild(e.current),e.current=null)}),setTimeout(()=>{var l;(l=r.contentWindow)==null||l.print()},150))},[])}}function Qp(e){return e%1===.5?`${Math.floor(e)}½`:String(e)}function jvt(e){return e==="white_wins"?"1-0":e==="black_wins"?"0-1":e==="draw"?"½-½":""}function Nvt(e){return e==="+"?"1":e==="="?"½":e==="-"?"0":""}function Ri(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bfe({eventId:e,eventTitle:t,eventDate:n,tiebreakCriteria:r,isCompleted:i,selectedRoundId:a,totalRounds:o}){const{print:l}=_vt(),{data:c=[]}=k6(e,r),{data:u=[]}=rE(e),{data:d=[]}=uw(a),{players:f,roundsCount:h}=B0(e,r),p=N.useMemo(()=>r&&r.length>0?r:Wh,[r]),x=N.useMemo(()=>p.filter(S=>S!=="direct"),[p]),y=n?Ze(new Date(n),"d MMMM yyyy",{locale:pt}):"",b=u.find(S=>S.id===a),w=N.useCallback(()=>{const S=i?"CLASSEMENT FINAL":"CLASSEMENT INTERMÉDIAIRE",T=b?`Ronde ${b.round_number}/${o}`:`${u.length} ronde(s)`,P=x.map(L=>{const M=j1.find(B=>B.value===L);return`<th class="center">${Ri((M==null?void 0:M.shortLabel)||L)}</th>`}).join(""),O=c.map(L=>{const M=Ri(fs(L.profile)||"Joueur"),B=x.map(U=>{let F=0;return U==="buchholz_cut1"?F=L.buchholzCut1:U==="buchholz"?F=L.buchholz:U==="wins"&&(F=L.wins),`<td class="center">${Qp(F)}</td>`}).join("");return`<tr><td class="num">${L.rank}</td><td>${M}</td>${B}<td class="num"><strong>${Qp(L.points)}</strong></td></tr>`}).join(""),D=p.map(L=>{var M;return((M=j1.find(B=>B.value===L))==null?void 0:M.label)||L}).join(" → "),R=`
2676      <div class="doc-header">
2677        <h1>${Ri(S)} — ${Ri(t)}</h1>
2678        <p>${T} | ${Ri(y)}</p>
2679      </div>
2680      <table>
2681        <thead><tr><th class="num">#</th><th>Joueur</th>${P}<th class="num">Pts</th></tr></thead>
2682        <tbody>${O}</tbody>
2683      </table>
2684      <div class="footer">Départage : ${Ri(D)}</div>
2685    `;l(R)},[c,i,t,y,x,p,b,o,u.length,l]),_=N.useCallback(()=>{const S=b?`Ronde ${b.round_number}`:"Appariements",T=new Map;c.forEach(R=>{T.set(R.playerId,R.points)});const P=[],O=[];d.forEach(R=>{const L=R.white_profile,M=R.black_profile,B=L?fs(L):"—",U=M?fs(M):"—",F=R.white_player_id||R.white_ticket_id,H=R.black_player_id||R.black_ticket_id,z=F?T.get(F)??0:0,K=H?T.get(H)??0:0,W=Array.isArray(R.game_result)?R.game_result[0]:R.game_result,q=W!=null&&W.result?jvt(W.result):"";R.is_bye?O.push(`<tr class="bye-row"><td colspan="4">Bye : ${Ri(B||"—")} (${Qp(z)})</td></tr>`):P.push(`<tr><td class="num">${R.table_number||""}</td><td>${Ri(B)} (${Qp(z)})</td><td>${Ri(U)} (${Qp(K)})</td><td class="center">${q}</td></tr>`)});const D=`
2686      <div class="doc-header">
2687        <h1>APPARIEMENTS — ${Ri(S)} — ${Ri(t)}</h1>
2688        <p>${Ri(y)}</p>
2689      </div>
2690      <table>
2691        <thead><tr><th class="num">Tab</th><th>Blancs (pts)</th><th>Noirs (pts)</th><th class="center">Rés.</th></tr></thead>
2692        <tbody>${P.join("")}${O.join("")}</tbody>
2693      </table>
2694      <div class="footer">Chess Agenda — ${Ri(y)}</div>
2695    `;l(D)},[d,c,b,t,y,l]),j=N.useCallback(()=>{const S=i?"GRILLE AMÉRICAINE FINALE":"GRILLE AMÉRICAINE",T=Array.from({length:h},(D,R)=>`<th class="center">R${R+1}</th>`).join(""),P=f.map(D=>{const R=D.cells.map(L=>{if(!L)return'<td class="center">—</td>';if(L.isBye)return'<td class="center">+bye</td>';const M=L.color==="W"?"B":"N";return`<td class="center">${L.opponentRank}${M}${Nvt(L.result)}</td>`}).join("");return`<tr><td class="num">${D.rank}</td><td>${Ri(D.displayName)}</td>${R}<td class="num"><strong>${Qp(D.points)}</strong></td></tr>`}).join(""),O=`
2696      <div class="doc-header">
2697        <h1>${Ri(S)} — ${Ri(t)}</h1>
2698        <p>${Ri(y)}</p>
2699      </div>
2700      <table>
2701        <thead><tr><th class="num">#</th><th>Joueur</th>${T}<th class="num">Pts</th></tr></thead>
2702        <tbody>${P}</tbody>
2703      </table>
2704      <div class="footer">Chess Agenda — ${Ri(y)}</div>
2705    `;l(O)},[f,h,i,t,y,l]),E=c.length>0;return s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"Générez des documents compacts pour affichage (projecteur, impression) ou archivage."}),s.jsxs("div",{className:"grid gap-2",children:[s.jsxs(Q,{variant:"outline",className:"justify-start gap-3 h-auto py-3 px-4",disabled:!E,onClick:w,children:[s.jsx(Xt,{className:"w-4 h-4 text-amber-500 shrink-0"}),s.jsxs("div",{className:"text-left",children:[s.jsx("p",{className:"text-sm font-medium",children:i?"Classement final":"Classement intermédiaire"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Rang, joueur, départages, points"})]}),s.jsx(ZS,{className:"w-3.5 h-3.5 ml-auto text-muted-foreground shrink-0"})]}),s.jsxs(Q,{variant:"outline",className:"justify-start gap-3 h-auto py-3 px-4",disabled:!a||d.length===0,onClick:_,children:[s.jsx(WY,{className:"w-4 h-4 text-blue-500 shrink-0"}),s.jsxs("div",{className:"text-left",children:[s.jsxs("p",{className:"text-sm font-medium",children:["Appariements",b?` — Ronde ${b.round_number}`:""]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Table, blancs/noirs (pts), résultat"})]}),s.jsx(ZS,{className:"w-3.5 h-3.5 ml-auto text-muted-foreground shrink-0"})]}),s.jsxs(Q,{variant:"outline",className:"justify-start gap-3 h-auto py-3 px-4",disabled:f.length===0,onClick:j,children:[s.jsx(Fm,{className:"w-4 h-4 text-emerald-500 shrink-0"}),s.jsxs("div",{className:"text-left",children:[s.jsx("p",{className:"text-sm font-medium",children:i?"Grille américaine finale":"Grille américaine"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Adversaire, couleur, résultat par ronde"})]}),s.jsx(ZS,{className:"w-3.5 h-3.5 ml-auto text-muted-foreground shrink-0"})]})]}),!E&&s.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:"Les exp
2705orts seront disponibles dès la première ronde."})]})}const kvt={white_wins:"1 - 0",black_wins:"0 - 1",draw:"½ - ½",pending:"? - ?"},Cvt=[{value:"white_wins",label:"1 - 0"},{value:"black_wins",label:"0 - 1"},{value:"draw",label:"½ - ½"}];function Evt(e){let t=e.currentResult,n="Résultat actuel conservé";return e.currentResult==="pending"?e.whitePlayerClaim&&!e.blackPlayerClaim?(t=e.whitePlayerClaim,n="Claim Blancs appliqué"):e.blackPlayerClaim&&!e.whitePlayerClaim?(t=e.blackPlayerClaim,n="Claim Noirs appliqué"):e.whitePlayerClaim&&e.blackPlayerClaim?(t="draw",n="Conflit → Nulle par défaut"):(t="draw",n="Aucun claim → Nulle par défaut"):e.validationStatus==="pending"&&(e.whitePlayerClaim&&!e.blackPlayerClaim?(t=e.whitePlayerClaim,n="Corrigé selon claim Blancs"):e.blackPlayerClaim&&!e.whitePlayerClaim?(t=e.blackPlayerClaim,n="Corrigé selon claim Noirs"):n="Override staff"),{finalResult:t,resolutionMethod:n}}function Svt({open:e,onOpenChange:t,pendingGames:n,onConfirm:r,isPending:i}){const[a,o]=N.useState({});N.useEffect(()=>{e&&o({})},[e,n]);const l=N.useMemo(()=>n.map(h=>{const{finalResult:p,resolutionMethod:x}=Evt(h),y=a[h.pairingId]!==void 0,b=a[h.pairingId]??p;return{...h,finalResult:b,resolutionMethod:y?"Modifié par admin":x,isEdited:y}}),[n,a]),c=(h,p)=>{o(x=>({...x,[h]:p}))},u=()=>{const h={};l.forEach(p=>{h[p.pairingId]=p.finalResult}),r(h)},d=l.some(h=>!h.isEdited&&(h.resolutionMethod.includes("Nulle par défaut")||h.resolutionMethod.includes("Conflit"))),f=l.some(h=>h.isEdited);return s.jsx(yr,{open:e,onOpenChange:t,children:s.jsxs(sr,{className:"max-w-md max-h-[90vh] overflow-hidden flex flex-col",children:[s.jsx(ir,{className:"flex-shrink-0",children:s.jsxs(or,{className:"flex items-center gap-2",children:[s.jsx(nd,{className:"w-5 h-5 text-destructive"}),"Forcer la clôture"]})}),s.jsx(lr,{asChild:!0,children:s.jsxs("div",{className:"flex-1 min-h-0 flex flex-col gap-3 relative z-0",children:[s.jsxs("p",{className:"flex-shrink-0",children:[n.length," partie",n.length>1?"s":""," non confirmée",n.length>1?"s":"",". L'override staff sera appliqué automatiquement."]}),s.jsxs("div",{className:"flex-shrink-0 flex items-start gap-2 p-2 rounded-lg bg-primary/5 border border-primary/20",children:[s.jsx(oI,{className:"w-4 h-4 text-primary flex-shrink-0 mt-0.5"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Ajustez les scores si nécessaire avant de confirmer."})]}),d&&s.jsxs("div",{className:"flex-shrink-0 flex items-start gap-2 p-2 rounded-lg bg-destructive/10 border border-destructive/30",children:[s.jsx(ur,{className:"w-4 h-4 text-destructive flex-shrink-0 mt-0.5"}),s.jsx("p",{className:"text-xs text-destructive",children:`Certaines parties n'ont pas de claim : "Nulle" sera appliqué sauf modification.`})]}),s.jsxs("div",{className:"relative flex-shrink min-h-0 mb-1",children:[s.jsx("div",{className:"overflow-y-auto overscroll-contain pr-2 -mr-2",style:{maxHeight:"clamp(120px, 40vh, 320px)"},children:s.jsx("div",{className:"space-y-3 pb-8",children:l.map(h=>s.jsxs("div",{className:ae("p-3 rounded-lg border text-xs space-y-2 transition-colors",h.isEdited?"bg-accent/50 border-accent":"bg-muted/50"),children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("span",{className:"font-semibold text-sm",children:["Table ",h.tableNumber]}),s.jsxs(we,{variant:"outline",className:"font-mono text-[10px] px-1.5",children:[kvt[h.currentResult],h.validationStatus==="pending"&&h.currentResult!=="pending"&&s.jsx("span",{className:"ml-1 text-destructive",children:"⚠"})]})]}),s.jsxs("p",{className:"text-muted-foreground truncate",children:[h.whitePlayerName," vs ",h.blackPlayerName]}),s.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[s.jsx("span",{className:"text-muted-foreground text-[11px]",children:"Résultat final :"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(li,{value:h.finalResult,onValueChange:p=>c(h.pairingId,p),children:[s.jsx(Gs,{className:ae("w-20 h-8 text-xs font-mono",h.isEdited&&"ring-2 ring-primary/50 border-primary"),children:s.jsx(ci,{})}),s.jsx(Ks,{children:Cvt.map(p=>s.jsx(Yn,{value:p.value,className:"font-mono text-xs",children:p.label},p.value))})]}),h.isEdited&&s.jsx(we,{variant:"secondary",className:"text-[9px] px-1.5 bg-muted text-muted-foreground",children:"Modifié"})]})]}),s.jsx("p",{className:"text-muted-foreground italic text-[10px]",children:h.resolutionMethod})]},h.pairingId))})}),l.length>2&&s.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-4 bg-gradient-to-t from-background to-transparent pointer-events-none","aria-hidden":"true"})]})]})}),s.jsxs(ar,{className:"flex-shrink-0 pt-2 border-t border-border/50 bg-background z-10 shadow-[0_-2px_8px_rgba(0,0,0,0.08)]",children:[s.jsx(cr,{disabled:i,children:"Annuler"}),s.jsx(vr,{onClick:u,disabled:i,className:"gap-2 bg-destructive text-destructive-foreground hover:bg-destructive/90",children:i?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 animate-spin"}),"Traitement..."]}):s.jsxs(s.Fragment,{children:[s.jsx(nd,{className:"w-4 h-4"}),f?"Appliquer modifications":"Confirmer"]})})]})]})})}function wfe({eventId:e,eventStatus:t,rounds:n,totalRounds:r,onRoundSelect:i,selectedRoundId:a,readOnly:o=!1,pairingEngine:l="internal"}){var Z;const[c,u]=N.useState(null),d=E6(),f=S6(),h=dw(),p=ile(),x=Nqe(),y=Tqe(),b=qb(),w=xfe(),_=Oqe(),j=n.find(G=>G.status==="active")||n.find(G=>G.status==="pending")||n[n.length-1],{data:E}=uw(j==null?void 0:j.id),S=n.length>=r&&n.every(G=>G.status==="completed"),T=n.length===0||n.length<r&&((Z=n[n.length-1])==null?void 0:Z.status)==="completed"&&!n.some(G=>G.status==="pending"),P=!o&&((j==null?void 0:j.status)==="pending"||(j==null?void 0:j.status)==="active")&&E&&E.length>0,O=l==="none",D=!O&&(j==null?void 0:j.status)==="pending"&&(!E||E.length===0),R=(j==null?void 0:j.status)==="pending"&&E&&E.length>0,L=(j==null?void 0:j.status)==="active"&&(E==null?void 0:E.every(G=>G.is_bye?!0:O1(G.game_result))),M=(j==null?void 0:j.status)==="active"?(E==null?void 0:E.filter(G=>G.is_bye?!1:!O1(G.game_result)).map(G=>{const se=F0(G.game_result);return{pairingId:G.id,tableNumber:G.table_number||0,currentResult:(se==null?void 0:se.result)||"pending",validationStatus:(se==null?void 0:se.validation_status)||"pending",whitePlayerName:fs(G.white_player||{first_name:"Joueur",last_name:"Blanc"}),blackPlayerName:fs(G.black_player||{first_name:"Joueur",last_name:"Noir"}),whitePlayerId:G.white_player_id,blackPlayerId:G.black_player_id,whitePlayerClaim:(se==null?void 0:se.white_player_claim)||null,blackPlayerClaim:(se==null?void 0:se.black_player_claim)||null}}))||[]:[],B=M.length>0,U=async()=>{const G=await d.mutateAsync({eventId:e,roundNumber:n.length+1});i(G.id)},F=async()=>{j&&await f.mutateAsync({roundId:j.id,eventId:e})},H=async()=>{j&&await h.mutateAsync({roundId:j.id})},z=async()=>
2705{if(!j)return;const G=await p.mutateAsync({roundId:j.id,eventId:e,currentRoundNumber:j.round_number,totalRounds:r});G.nextRoundId&&i(G.nextRoundId),u(null)},K=async()=>{await b.mutateAsync({id:e,status:"completed"});try{await w.mutateAsync(e)}catch(G){console.error("Failed to update player stats:",G)}u(null)},W=async G=>{if(!j)return;const se=M.map(le=>({...le,currentResult:G[le.pairingId]??le.currentResult})),ce=await x.mutateAsync({roundId:j.id,eventId:e,pendingGames:se,currentRoundNumber:j.round_number,totalRounds:r});ce.nextRoundId&&i(ce.nextRoundId),u(null)},q=async()=>{j&&(await y.mutateAsync({roundId:j.id,eventId:e,roundStatus:j.status}),u(null))},oe=async()=>{await _.mutateAsync(e),u(null)},J=d.isPending||f.isPending||h.isPending||p.isPending||x.isPending||y.isPending||b.isPending||w.isPending||_.isPending,Y=j&&j.round_number<r;return s.jsxs("div",{className:"space-y-4 min-w-0",children:[s.jsx("div",{className:"flex gap-2 overflow-x-auto scrollbar-hide scroll-fade-x sm:[mask-image:none] pb-2 -mx-1 px-1",children:n.map(G=>s.jsxs(Q,{variant:a===G.id?"default":"outline",size:"sm",onClick:()=>i(G.id),className:"gap-1.5 shrink-0 text-xs sm:text-sm",children:[s.jsx("span",{className:"hidden xs:inline",children:"Ronde"}),s.jsx("span",{className:"xs:hidden",children:"R"}),G.round_number,s.jsx(we,{variant:G.status==="completed"?"secondary":G.status==="active"?"default":"outline",className:"text-[10px] sm:text-xs",children:G.status==="completed"?"✓":G.status==="active"?"⚡":"○"})]},G.id))}),o&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Mode consultation — naviguez entre les rondes pour voir les appariements et résultats."}),s.jsx(Q,{variant:"outline",size:"sm",onClick:async()=>{try{const G=await w.mutateAsync(e),{toast:se}=await ka(async()=>{const{toast:ce}=await Promise.resolve().then(()=>SF);return{toast:ce}},void 0);se.success(`Statistiques mises à jour pour ${G.playersUpdated} joueurs`)}catch(G){console.error("Failed to recalculate stats:",G);const{toast:se}=await ka(async()=>{const{toast:ce}=await Promise.resolve().then(()=>SF);return{toast:ce}},void 0);se.error("Erreur lors du recalcul des statistiques")}},disabled:w.isPending,className:"w-full",children:w.isPending?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),"Recalcul en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(xo,{className:"w-4 h-4 mr-2"}),"Recalculer les statistiques"]})}),s.jsx(Q,{variant:"outline",size:"sm",onClick:()=>u("reset-tournament"),disabled:_.isPending,className:"w-full border-amber-500/50 text-amber-700 hover:bg-amber-500/10 dark:text-amber-400",children:_.isPending?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),"Réinitialisation..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Il,{className:"w-4 h-4 mr-2"}),"Rejouer le tournoi"]})})]}),!o&&s.jsxs("div",{className:"flex flex-wrap gap-2",children:[T&&s.jsxs(Q,{onClick:U,disabled:J,className:"gap-2 h-10 sm:h-12 text-xs sm:text-sm flex-1 sm:flex-none min-w-[120px]",children:[d.isPending?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(qa,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden xs:inline",children:O?`Créer ronde manuelle ${n.length+1}`:`Créer Ronde ${n.length+1}`}),s.jsxs("span",{className:"xs:hidden",children:[O?"+ R":"Créer R",n.length+1]})]}),D&&s.jsxs(Q,{onClick:F,disabled:J,className:"gap-2 h-10 sm:h-12 text-xs sm:text-sm flex-1 sm:flex-none min-w-[120px]",children:[f.isPending?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(Na,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Générer appariements"}),s.jsx("span",{className:"sm:hidden",children:"Appariements"})]}),R&&s.jsxs(Q,{onClick:H,disabled:J,className:"gap-2 h-10 sm:h-12 text-xs sm:text-sm flex-1 sm:flex-none min-w-[100px]",children:[h.isPending?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(Na,{className:"w-4 h-4"}),"Démarrer"]}),(j==null?void 0:j.status)==="active"&&s.jsxs(Q,{variant:"outline",onClick:()=>u("complete"),disabled:!L||J,className:"gap-2 h-10 sm:h-12 text-xs sm:text-sm flex-1 sm:flex-none min-w-[100px]",children:[s.jsx(Cn,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden xs:inline",children:"Terminer"}),s.jsx("span",{className:"xs:hidden",children:"✓"})]}),(j==null?void 0:j.status)==="active"&&B&&s.jsxs(Q,{variant:"destructive",onClick:()=>u("force-complete"),disabled:J,className:"gap-2 h-10 sm:h-12 text-xs sm:text-sm flex-1 sm:flex-none min-w-[100px]",children:[s.jsx(nd,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden xs:inline",children:"Forcer"})," (",M.length,")"]}),P&&s.jsxs(Q,{variant:"outline",onClick:()=>u("unpair-all"),disabled:J,className:"gap-2 h-10 sm:h-12 text-xs sm:text-sm flex-1 sm:flex-none min-w-[100px] border-destructive/50 text-destructive hover:bg-destructive/10",children:[y.isPending?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(_F,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Désapparier tout"}),s.jsx("span",{className:"sm:hidden",children:"Défaire"})]}),S&&t!=="completed"&&s.jsxs(Q,{variant:"default",onClick:()=>u("finish"),disabled:J,className:"gap-2 h-10 sm:h-12 text-xs sm:text-sm flex-1 sm:flex-none min-w-[120px]",children:[s.jsx(Xt,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden xs:inline",children:"Clôturer"}),s.jsx("span",{className:"xs:hidden",children:"Fin"})]}),t==="completed"&&s.jsxs(we,{variant:"secondary",className:"gap-2 h-10 sm:h-12 px-3 sm:px-4 text-xs sm:text-base",children:[s.jsx(Xt,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden xs:inline",children:"Tournoi terminé"}),s.jsx("span",{className:"xs:hidden",children:"Terminé"})]})]}),s.jsx(yr,{open:c==="complete",onOpenChange:()=>u(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Terminer la ronde ?"}),s.jsx(lr,{asChild:!0,children:s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{children:"Tous les résultats ont été saisis."}),Y?s.jsxs("p",{className:"text-muted-foreground text-sm flex items-center gap-2",children:[s.jsx(gd,{className:"w-4 h-4 text-amber-500 flex-shrink-0"}),s.jsx("span",{children:"La ronde suivante et ses appariements seront générés automatiquement."})]}):s.jsx("p",{className:"text-muted-foreground text-sm",children:"C'est la dernière ronde. Vous pourrez ensuite clôturer le tournoi."})]})})]}),s.jsxs(ar,{children:[s.jsx(cr,{disabled:p.isPending,children:"Annuler"}),s.jsx(vr,{onClick:z,disabled:p.isPending,className:"gap-2",children:p.isPending?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 animate-spin"}),"Préparation..."]}):"Terminer et continuer"})]})]})}),s.jsx(yr,{open:c==="finish",onOpenChange:()=>u(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Clôturer le tournoi ?"}),s.jsx(lr,{children:"Toutes les rondes sont terminées. Le classement final sera enregistré et le tournoi sera marqué comme terminé."})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsx(vr,{onClick:K,children:"Clôturer"})]})]})}),s.jsx(Svt,{open:c==="force-complete",onOpenChange:()=>u(null),pendingGames:M,onConfirm:W,isPending:x.isPending}),s.jsx(yr,{open:c==="unpair-all",onOpenChange:()=>u(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsxs(or,{className:"flex items-center gap-2",children:[s.jsx(_F,{className:"w-5 h-5 text-destructive"}),"Désapparier tous les joueurs ?"]}),s.jsx(lr,{asChild:!0,children:s.jsxs("div",{className:"space-y-2",children:[s.jsxs("p",{children:["Tous les appariements de la ronde en cours (",(E==null?void 0:E.length)||0," table",((E==null?void 0:E.length)||0)>1?"s":"",") seront supprimés."]}),(j==null?void 0:j.status)==="active"&&s.jsx("p",{className:"text-sm font-medium text-destructive",children:"La ronde sera réinitialisée à l'état « en attente »."}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Vous pourrez ensuite corriger des résultats précédents et relancer la génération automatique des appariements."})]})})]}),s.jsxs(ar,{children:[s.jsx(cr,{disabled:y.isPending,children:"Annuler"}),s.jsx(vr,{onClick:q,disabled:y.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 gap-2",children:y.isPending?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 animate-spin"}),"Suppression..."]}):"Désapparier tout"})]})]})}),s.jsx(yr,{open:c==="reset-tournament",onOpenChange:()=>u(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsxs(or,{className:"flex items-center gap-2",children:[s.jsx(Il,{className:"w-5 h-5 text-amber-500"}),"Rejouer le tournoi ?"]}),s.jsx(lr,{asChild:!0,children:s.jsxs("div",{className:"space-y-2",children:[s.jsxs("p",{children:["Toutes les rondes, appariements, résultats et l'historique Elo de ce tournoi seront ",s.jsx("strong",{className:"text-foreground",children:"définitivement supprimés"}),"."]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Les participants (tickets & check-ins) seront conservés. Le tournoi redémarrera automatiquement avec les mêmes joueurs."})]})})]}),s.jsxs(ar,{children:[s.jsx(cr,{disabled:_.isPending,children:"Annuler"}),s.jsx(vr,{onClick:oe,disabled:_.isPending,className:"bg-amber-600 text-white hover:bg-amber-700 gap-2",children:_.isPending?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 animate-spin"}),"Réinitialisation..."]}):"Confirmer et rejouer"})]})]})})]})}const z_={white_wins:"1 - 0",black_wins:"0 - 1",draw:"½ - ½",pen
2705ding:"? - ?"};function eW(e){return e?e.display_name?e.display_name:e.first_name||e.last_name?`${e.first_name||""} ${e.last_name||""}`.trim():"Joueur":"Inconnu"}function Avt(e){const t={white_wins:0,black_wins:0,draw:0,pending:0};return Object.values(e).forEach(n=>{n!=="pending"&&t[n]++}),t}function _fe({eventId:e}){const{data:t=[],isLoading:n}=Wqe(e),r=Hqe(),[i,a]=N.useState(null),[o,l]=N.useState(null),[c,u]=N.useState(""),d=async()=>{!i||!o||!c.trim()||(await r.mutateAsync({gameResultId:i.gameResultId,result:o,reason:c.trim(),whitePlayerId:i.whitePlayerId,blackPlayerId:i.blackPlayerId,eventId:e,pairingId:i.pairingId}),a(null),l(null),u(""))};return n?s.jsx(Se,{children:s.jsx(De,{className:"p-6 text-center text-muted-foreground",children:"Chargement..."})}):t.length===0?null:s.jsxs(s.Fragment,{children:[s.jsxs(Se,{className:"border-destructive/30 min-w-0",children:[s.jsx(kt,{className:"pb-3",children:s.jsxs(Et,{className:"flex items-center gap-2 text-base sm:text-lg",children:[s.jsx(ur,{className:"w-5 h-5 text-destructive shrink-0"}),s.jsxs("span",{className:"truncate",children:["Disputes (",t.length,")"]})]})}),s.jsx(De,{className:"space-y-3 min-w-0",children:t.map(f=>{const h=f.pairing,p=Array.isArray(h.white_player)?h.white_player[0]:h.white_player,x=Array.isArray(h.black_player)?h.black_player[0]:h.black_player,y=eW(p),b=eW(x),w=f.dispute_votes||{},_=Avt(w),j=Object.values(_).reduce((E,S)=>E+S,0);return s.jsxs("div",{className:"p-3 rounded-lg border bg-card space-y-2 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsxs(we,{variant:"outline",className:"shrink-0 text-xs",children:["T",h.table_number]}),s.jsxs("span",{className:"text-xs sm:text-sm truncate min-w-0",children:[y," vs ",b]})]}),s.jsxs(we,{variant:"outline",className:"text-xs shrink-0",children:["R",h.round.round_number]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs sm:text-sm",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-muted-foreground",children:"B:"}),s.jsx(we,{variant:"secondary",className:"font-mono text-xs",children:f.white_player_claim?z_[f.white_player_claim]:"—"})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-muted-foreground",children:"N:"}),s.jsx(we,{variant:"secondary",className:"font-mono text-xs",children:f.black_player_claim?z_[f.black_player_claim]:"—"})]})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2",children:[s.jsxs("div",{className:"text-xs text-muted-foreground overflow-x-auto scrollbar-hide whitespace-nowrap pb-1 sm:pb-0",children:[["white_wins","draw","black_wins"].map(E=>s.jsxs("span",{className:"mr-2",children:[z_[E],"(",_[E],")"]},E)),s.jsxs("span",{className:"text-[10px]",children:["(",j,")"]})]}),s.jsxs(Q,{variant:"destructive",size:"sm",onClick:()=>a({gameResultId:f.id,pairingId:h.id,whitePlayerId:(p==null?void 0:p.id)||"",blackPlayerId:(x==null?void 0:x.id)||"",whiteName:y,blackName:b}),className:"gap-1 w-full sm:w-auto h-8 text-xs",children:[s.jsx(exe,{className:"w-3 h-3"}),"Override"]})]})]},f.id)})})]}),s.jsx(Ln,{open:!!i,onOpenChange:()=>a(null),children:s.jsxs(Dn,{children:[s.jsxs(Un,{children:[s.jsx(qn,{children:"Override du score"}),s.jsxs(qr,{children:[i==null?void 0:i.whiteName," vs ",i==null?void 0:i.blackName]})]}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx("div",{className:"grid grid-cols-3 gap-2",children:["white_wins","draw","black_wins"].map(f=>s.jsx("button",{onClick:()=>l(f),className:ae("flex flex-col items-center justify-center p-4 rounded-lg border-2 transition-all",o===f?"border-primary bg-primary/10":"border-border hover:border-primary/50"),children:s.jsx("span",{className:"text-xl font-bold font-mono",children:z_[f]})},f))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"reason",children:"Raison de l'override (obligatoire)"}),s.jsx($s,{id:"reason",value:c,onChange:f=>u(f.target.value),placeholder:"Expliquez la décision...",rows:3})]})]}),s.jsxs(Pi,{children:[s.jsx(Q,{variant:"outline",onClick:()=>a(null),children:"Annuler"}),s.jsx(Q,{variant:"destructive",onClick:d,disabled:!o||!c.trim()||r.isPending,children:"Appliquer l'override"})]})]})})]})}function Tvt({eventId:e,currentRoundNumber:t}){const[n,r]=N.useState(null),[i,a]=N.useState(""),[o,l]=N.useState(!1),[c,u]=N.useState(!1),d=N.useCallback(async()=>{var h,p,x;l(!0);try{const{data:y}=await re.from("rounds").select("id, round_number, status").eq("event_id",e).order("round_number");if(!(y!=null&&y.length)){je.error("Aucune ronde trouvée"),l(!1);return}const{data:b}=await re.from("pairings").select("*, game_results(*), round:rounds!inner(round_number, event_id)").eq("round.event_id",e).order("table_number"),{data:w}=await re.rpc("get_event_participants",{p_event_id:e});if(!(w!=null&&w.length)||!(b!=null&&b.length)){je.error("Données insuffisantes"),l(!1);return}const _=w.map(M=>
2705M.participant_id).filter(Boolean),j=new Map,E=new Map;for(const M of w)M.participant_id&&(j.set(M.participant_id,M.elo_rating||1200),E.set(M.participant_id,M.display_name||`${M.first_name||""} ${M.last_name||""}`.trim()||"?"));const S=[];for(const M of b){const B=(h=M.round)==null?void 0:h.round_number;if(!B)continue;const U=((x=(p=M.game_results)==null?void 0:p[0])==null?void 0:x.result)||"pending";S.push({white_player_id:M.white_player_id||"",black_player_id:M.black_player_id,is_bye:M.is_bye||!1,result:U,round_number:B})}const T=t||y[y.length-1].round_number+1,P=S.filter(M=>M.round_number<T),O=fn(_,P,j,T,E),D=yn(O,T);r(D.debugState||null);const R=D.pairings.filter(M=>!M.isBye).map(M=>{const B=O.find(F=>F.id===M.whitePlayerId),U=O.find(F=>F.id===M.blackPlayerId);return`T${M.tableNumber}: ${E.get(M.whitePlayerId)||"?"} (TPN${B==null?void 0:B.tpn})(B) vs ${E.get(M.blackPlayerId)||"?"} (TPN${U==null?void 0:U.tpn})(N)`}),L=D.pairings.find(M=>M.isBye);L&&R.push(`BYE: ${E.get(L.whitePlayerId)||"?"}`),a(R.join(`
2706`))}catch(y){console.error(y),je.error("Erreur lors de l'export")}l(!1)},[e,t]),f=N.useCallback(()=>{if(!n)return;const h="TPN	Score	Adversaires	Couleurs	Flotteurs	Préf.",p=n.map(x=>`${x.tpn}	${x.score}	${x.opponents.join(",")}	${x.colorHistory.join("")}	${x.floatHistory.join("")}	${x.colorPref}`);navigator.clipboard.writeText([h,...p,"",i].join(`
2707`)),u(!0),je.success("Copié !"),setTimeout(()=>u(!1),2e3)},[n,i]);return s.jsxs(Ln,{children:[s.jsx(nte,{asChild:!0,children:s.jsxs(Q,{variant:"outline",size:"sm",className:"gap-1.5",children:[s.jsx(y5,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Diagnostic FIDE"})]})}),s.jsxs(Dn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsx(Un,{children:s.jsxs(qn,{className:"flex items-center gap-2",children:[s.jsx(y5,{className:"w-5 h-5 text-primary"}),"Export état FIDE — R",t||"?"]})}),!n&&s.jsxs("div",{className:"text-center py-8 space-y-3",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Reconstruit l'état complet du moteur pour la ronde en cours."}),s.jsx(Q,{onClick:d,disabled:o,className:"gap-2",children:o?"Analyse...":"Analyser l'état"})]}),n&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["État des joueurs avant R",t]}),s.jsxs(Q,{variant:"outline",size:"sm",onClick:f,className:"gap-1.5",children:[c?s.jsx(is,{className:"w-3.5 h-3.5"}):s.jsx(Ko,{className:"w-3.5 h-3.5"}),c?"Copié":"Copier"]})]}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(dh,{children:[s.jsx(fh,{children:s.jsxs(Ls,{children:[s.jsx(ln,{className:"text-xs w-10",children:"TPN"}),s.jsx(ln,{className:"text-xs",children:"Score"}),s.jsx(ln,{className:"text-xs",children:"Adv."}),s.jsx(ln,{className:"text-xs",children:"Couleurs"}),s.jsx(ln,{className:"text-xs",children:"Float"}),s.jsx(ln,{className:"text-xs",children:"Préf."})]})}),s.jsx(hh,{children:n.map(h=>s.jsxs(Ls,{children:[s.jsx(Lt,{className:"font-mono font-bold text-xs",children:h.tpn}),s.jsx(Lt,{className:"font-mono text-xs",children:h.score}),s.jsx(Lt,{className:"font-mono text-xs",children:h.opponents.join(",")||"–"}),s.jsx(Lt,{className:"font-mono text-xs",children:h.colorHistory.join("")||"–"}),s.jsx(Lt,{className:"font-mono text-xs",children:h.floatHistory.join("")||"–"}),s.jsx(Lt,{className:"font-mono text-xs",children:h.colorPref})]},h.tpn))})]})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Appariements produits"}),s.jsx("pre",{className:"text-xs font-mono bg-muted/50 rounded-lg p-3 whitespace-pre-wrap",children:i})]})]})]})]})}function Pvt(){const{id:e}=Wi(),[t,n]=N.useState(),[r,i]=N.useState(!1),[a,o]=N.useState(null),{data:l,isLoading:c}=nh(e),{data:u=[],isLoading:d}=rE(e),{data:f=[]}=$0(e),h=(l==null?void 0:l.pairing_engine)||"internal",p=h!=="none",{isPreparing:x}=yfe({eventId:e||"",eventStatus:l==null?void 0:l.status,roundsCount:u.length,enabled:!!l&&l.status==="ongoing"&&p,onRoundSelect:n}),{isTransitioning:y}=$8({eventId:e||"",rounds:u,totalRounds:(l==null?void 0:l.rounds_count)||4,enabled:(l==null?void 0:l.status)==="ongoing"&&p});N.useEffect(()=>{var S;if(u.length>0&&!t){const T=u.find(O=>O.status==="active"),P=u.find(O=>O.status==="pending");n((T==null?void 0:T.id)||(P==null?void 0:P.id)||((S=u[u.length-1])==null?void 0:S.id))}},[u,t]);const b=u.find(S=>S.id===t),{players:w}=B0(e,l==null?void 0:l.tiebreak_criteria),_=w.find(S=>S.playerId===a)||null,j=N.useCallback(S=>o(S),[]);if(c||d)return s.jsxs("div",{className:"space-y-6",children:[s.jsx(Ie,{className:"h-8 w-48"}),s.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[s.jsx(Ie,{className:"h-16"}),s.jsx(Ie,{className:"h-64"})]}),s.jsx(Ie,{className:"h-96"})]})]});if(!l)return s.jsxs("div",{className:"text-center py-12",children:[s.jsx("p",{className:"text-muted-foreground mb-4",children:"Événement introuvable."}),s.jsx(Pe,{to:"/admin/events",children:"Retour aux événements"})]});const E=l.status==="completed";return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[s.jsxs("div",{children:[s.jsxs(Pe,{to:`/admin/events/${e}`,className:"inline-flex items-center gap-2 text-muted-foreground hover:text-foreground mb-2",children:[s.jsx(Fn,{className:"w-4 h-4"}),"Retour à l'événement"]}),s.jsx("h1",{className:"font-display text-2xl font-bold",children:l.title}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-1",children:[s.jsxs(we,{variant:"outline",children:[s.jsx(sn,{className:"w-3 h-3 mr-1"}),f.length," joueurs"]}),s.jsxs(we,{variant:"secondary",children:["Ronde ",(b==null?void 0:b.round_number)||0,"/",l.rounds_count||4]}),E&&s.jsxs(we,{variant:"secondary",className:"bg-amber-500/10 text-amber-600 border-amber-500/30 gap-1",children:[s.jsx(Xt,{className:"w-3 h-3"}),"Terminé"]}),l.status==="ongoing"&&s.jsxs(we,{variant:"outline",className:"bg-green-500/10 text-green-600 border-green-500/30",children:[s.jsx(gd,{className:"w-3 h-3 mr-1"}),"Auto"]}),s.jsx(we,{variant:"outline",className:h==="javafo_api"?"bg-purple-500/10 text-purple-600 border-purple-500/30":h==="none"?"bg-slate-500/10 text-slate-600 border-slate-500/30":"bg-blue-500/10 text-blue-600 border-blue-500/30",title:"Moteur d'appariement utilisé",children:h==="javafo_api"?"JaVaFo (API)":h==="none"?"Manuel":"FIDE Dutch (interne)"}),x&&s.jsx(we,{variant:"outline",className:"bg-amber-500/10 text-amber-600 border-amber-500/30 animate-pulse",children:"Préparation..."}),y&&!x&&s.jsx(we,{variant:"outline",className:"bg-amber-500/10 text-amber-600 border-amber-500/30 animate-pulse",children:"Transition..."})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[l.status==="ongoing"&&s.jsx(Tvt,{eventId:l.id,currentRoundNumber:b==null?void 0:b.round_number}),l.status==="ongoing"&&s.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>i(!0),className:"gap-1.5",children:[s.jsx(cs,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Retardataire"})]}),!E&&(b==null?void 0:b.status)==="active"&&s.jsx(oE,{startedAt:b.started_at,timeControl:l.time_control||"10+0"})]})]}),s.jsx(rS,{open:r,onOpenChange:i,event:{id:l.id,title:l.title,price_cents:l.price_cents,credit_amount_cents:l.credit_amount_cents,capacity:l.capacity,status:l.status,coupon_mode:l.coupon_mode??null,paper_coupon_label:l.paper_coupon_label??null,paper_coupon_description:l.paper_coupon_description??null,paper_coupon_formulas:l.paper_coupon_formulas??null,venue:l.venue??null},currentTicketCount:f.length}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-6",children:[!E&&s.jsx(_fe,{eventId:l.id}),s.jsxs(Se,{children:[s.jsx(kt,{className:"pb-3",children:s.jsx(Et,{className:"text-lg",children:E?"Historique des rondes":"Gestion du tournoi"})}),s.jsx(De,{children:s.jsx(wfe,{eventId:l.id,eventStatus:l.status,rounds:u,totalRounds:l.rounds_count||4,selectedRoundId:t,onRoundSelect:n,readOnly:E,pairingEngine:h})})]}),s.jsxs(Se,{children:[s.jsx(kt,{children:s.jsx(Et,{className:"flex items-center justify-between",children:s.jsxs("span",{children:["Appariements",b&&` - Ronde ${b.round_number}`]})})}),s.jsx(De,{children:s.jsx(vfe,{roundId:t,eventId:e,roundNumber:b==null?void 0:b.round_number,canEdit:(b==null?void 0:b.status)==="active"||(b==null?void 0:b.status)==="completed",canEditPlayers:!E,isRetroactive:(b==null?void 0:b.status)==="completed",onPlayerClick:j})})]})]}),s.jsx(Se,{children:s.jsx(De,{className:"pt-6",children:s.jsxs(Ka,{defaultValue:"standings",children:[s.jsxs(Ca,{className:"grid w-full grid-cols-3 mb-4",children:[s.jsxs(vn,{value:"standings",className:"gap-1.5 text-xs sm:text-sm",children:[s.jsx(Xt,{className:"w-3.5 h-3.5"}),s.jsx("span",{className:"hidden sm:inline",children:E?"Classement final":"Classement"}),s.jsx("span",{className:"sm:hidden",children:"Class."})]}),s.jsxs(vn,{value:"crosstable",className:"gap-1.5 text-xs sm:text-sm",children:[s.jsx(Fm,{className:"w-3.5 h-3.5"}),"Grille"]}),s.jsxs(vn,{value:"export",className:"gap-1.5 text-xs sm:text-sm",children:[s.jsx(HY,{className:"w-3.5 h-3.5"}),"Export"]})]}),s.jsx(Sn,{value:"standings",children:s.jsx(sE,{eventId:l.id,tiebreakCriteria:l.tiebreak_criteria,canEditPlayers:!E,onPlayerClick:j})}),s.jsx(Sn,{value:"crosstable",children:s.jsx(iE,{eventId:l.id,tiebreakCriteria:l.tiebreak_criteria,onPlayerClick:j})}),s.jsx(Sn,{value:"export",children:s.jsx(bfe,{eventId:l.id,eventTitle:l.title,eventDate:l.event_date,tiebreakCriteria:l.tiebreak_criteria,isCompleted:E,selectedRoundId:t,totalRounds:l.rounds_count||4})})]})})})]}),s.jsx(aE,{player:_,allPlayers:w,open:!!a,onOpenChange:S=>!S&&o(null)})]})}var bt;
2707(function(e){e[e.QR_CODE=0]="QR_CODE",e[e.AZTEC=1]="AZTEC",e[e.CODABAR=2]="CODABAR",e[e.CODE_39=3]="CODE_39",e[e.CODE_93=4]="CODE_93",e[e.CODE_128=5]="CODE_128",e[e.DATA_MATRIX=6]="DATA_MATRIX",e[e.MAXICODE=7]="MAXICODE",e[e.ITF=8]="ITF",e[e.EAN_13=9]="EAN_13",e[e.EAN_8=10]="EAN_8",e[e.PDF_417=11]="PDF_417",e[e.RSS_14=12]="RSS_14",e[e.RSS_EXPANDED=13]="RSS_EXPANDED",e[e.UPC_A=14]="UPC_A",e[e.UPC_E=15]="UPC_E",e[e.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(bt||(bt={}));var tW=new Map([[bt.QR_CODE,"QR_CODE"],[bt.AZTEC,"AZTEC"],[bt.CODABAR,"CODABAR"],[bt.CODE_39,"CODE_39"],[bt.CODE_93,"CODE_93"],[bt.CODE_128,"CODE_128"],[bt.DATA_MATRIX,"DATA_MATRIX"],[bt.MAXICODE,"MAXICODE"],[bt.ITF,"ITF"],[bt.EAN_13,"EAN_13"],[bt.EAN_8,"EAN_8"],[bt.PDF_417,"PDF_417"],[bt.RSS_14,"RSS_14"],[bt.RSS_EXPANDED,"RSS_EXPANDED"],[bt.UPC_A,"UPC_A"],[bt.UPC_E,"UPC_E"],[bt.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),nW;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.URL=1]="URL"})(nW||(nW={}));function Ovt(e){return Object.values(bt).includes(e)}var fk;(function(e){e[e.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",e[e.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(fk||(fk={}));var Dvt=function(){function e(){}return e.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",e.SCAN_DEFAULT_FPS=2,e.DEFAULT_DISABLE_FLIP=!1,e.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,e.DEFAULT_SUPPORTED_SCAN_TYPE=[fk.SCAN_TYPE_CAMERA,fk.SCAN_TYPE_FILE],e}(),jfe=function(){function e(t,n){this.format=t,this.formatName=n}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!tW.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,tW.get(t))},e}(),rW=function(){function e(){}return e.createFromText=function(t){var n={text:t};return{decodedText:t,result:n}},e.createFromQrcodeResult=function(t){return{decodedText:t.text,result:t}},e}(),QO;(function(e){e[e.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",e[e.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",e[e.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(QO||(QO={}));var Ivt=function(){function e(){}return e.createFrom=function(t){return{errorMessage:t,type:QO.UNKWOWN_ERROR}},e}(),Rvt=function(){function e(t){this.verbose=t}return e.prototype.log=function(t){this.verbose&&console.log(t)},e.prototype.warn=function(t){this.verbose&&console.warn(t)},e.prototype.logError=function(t,n){(this.verbose||n===!0)&&console.error(t)},e.prototype.logErrors=function(t){if(t.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(t)},e}();function Nu(e){return typeof e>"u"||e===null}var Dg=function(){function e(){}return e.codeParseError=function(t){return"QR code parse error, error = ".concat(t)},e.errorGettingUserMedia=function(t){return"Error getting userMedia, error = ".concat(t)},e.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},e.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},e.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},e.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},e.scannerPaused=function(){return"Scanner paused"},e}(),Nfe=function(){function e(){}return e.isMediaStreamConstraintsValid=function(t,n){if(typeof t!="object"){var r=typeof t;return n.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(r,"."),!0),!1}for(var i=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],a=new Set(i),o=Object.keys(t),l=0,c=o;l<c.length;l++){var u=c[l];if(a.has(u))return n.logError("".concat(u," is not supported videoConstaints."),!0),!1}return!0},e}(),JO={exports:{}};(function(e,t){(function(n,r){r(t)})(Lo,function(n){function r(te){return te==null}var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(te,m){te.__proto__=m}||function(te,m){for(var g in m)m.hasOwnProperty(g)&&(te[g]=m[g])};function a(te,m){i(te,m);function g(){this.constructor=te}
2707te.prototype=m===null?Object.create(m):(g.prototype=m.prototype,new g)}function o(te,m){var g=Object.setPrototypeOf;g?g(te,m):te.__proto__=m}function l(te,m){m===void 0&&(m=te.constructor);var g=Error.captureStackTrace;g&&g(te,m)}var c=function(te){a(m,te);function m(g){var v=this.constructor,k=te.call(this,g)||this;return Object.defineProperty(k,"name",{value:v.name,enumerable:!1}),o(k,v.prototype),l(k),k}return m}(Error);class u extends c{constructor(m=void 0){super(m),this.message=m}getKind(){return this.constructor.kind}}u.kind="Exception";class d extends u{}d.kind="ArgumentException";class f extends u{}f.kind="IllegalArgumentException";class h{constructor(m){if(this.binarizer=m,m===null)throw new f("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(m,g){return this.binarizer.getBlackRow(m,g)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(m,g,v,k){const C=this.binarizer.getLuminanceSource().crop(m,g,v,k);return new h(this.binarizer.createBinarizer(C))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const m=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new h(this.binarizer.createBinarizer(m))}rotateCounterClockwise45(){const m=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new h(this.binarizer.createBinarizer(m))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class p extends u{static getChecksumInstance(){return new p}}p.kind="ChecksumException";class x{constructor(m){this.source=m}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class y{static arraycopy(m,g,v,k,C){for(;C--;)v[k++]=m[g++]}static currentTimeMillis(){return Date.now()}}class b extends u{}b.kind="IndexOutOfBoundsException";class w extends b{constructor(m=void 0,g=void 0){super(g),this.index=m,this.message=g}}w.kind="ArrayIndexOutOfBoundsException";class _{static fill(m,g){for(let v=0,k=m.length;v<k;v++)m[v]=g}static fillWithin(m,g,v,k){_.rangeCheck(m.length,g,v);for(let C=g;C<v;C++)m[C]=k}static rangeCheck(m,g,v){if(g>v)throw new f("fromIndex("+g+") > toIndex("+v+")");if(g<0)throw new w(g);if(v>m)throw new w(v)}static asList(...m){return m}static create(m,g,v){return Array.from({length:m}).map(C=>Array.from({length:g}).fill(v))}static createInt32Array(m,g,v){return Array.from({length:m}).map(C=>Int32Array.from({length:g}).fill(v))}static equals(m,g){if(!m||!g||!m.length||!g.length||m.length!==g.length)return!1;for(let v=0,k=m.length;v<k;v++)if(m[v]!==g[v])return!1;return!0}static hashCode(m){if(m===null)return 0;let g=1;for(const v of m)g=31*g+v;return g}static fillUint8Array(m,g){for(let v=0;v!==m.length;v++)m[v]=g}static copyOf(m,g){return m.slice(0,g)}static copyOfUint8Array(m,g){if(m.length<=g){const v=new Uint8Array(g);return v.set(m),v}return m.slice(0,g)}static copyOfRange(m,g,v){const k=v-g,C=new Int32Array(k);return y.arraycopy(m,g,C,0,k),C}static binarySearch(m,g,v){v===void 0&&(v=_.numberComparator);let k=0,C=m.length-1;for(;k<=C;){const A=C+k>>1,I=v(g,m[A]);if(I>0)k=A+1;else if(I<0)C=A-1;else return A}return-k-1}static numberComparator(m,g){return m-g}}class j{static numberOfTrailingZeros(m){let g;if(m===0)return 32;let v=31;return g=m<<16,g!==0&&(v-=16,m=g),g=m<<8,g!==0&&(v-=8,m=g),g=m<<4,g!==0&&(v-=4,m=g),g=m<<2,g!==0&&(v-=2,m=g),v-(m<<1>>>31)}static numberOfLeadingZeros(m){if(m===0)return 32;let g=1;return m>>>16||(g+=16,m<<=16),m>>>24||(g+=8,m<<=8),m>>>28||(g+=4,m<<=4),m>>>30||(g+=2,m<<=2),g-=m>>>31,g}static toHexString(m){return m.toString(16)}static toBinaryString(m){return String(parseInt(String(m),2))}static bitCount(m){return m=m-(m>>>1&1431655765),m=(m&858993459)+(m>>>2&858993459),m=m+(m>>>4)&252645135,m=m+(m>>>8),m=m+(m>>>16),m&63}static truncDivision(m,g){return Math.trunc(m/g)}static parseInt(m,g=void 0){return parseInt(m,g)}}
2707j.MIN_VALUE_32_BITS=-2147483648,j.MAX_VALUE=Number.MAX_SAFE_INTEGER;class E{constructor(m,g){m===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=m,g==null?this.bits=E.makeArray(m):this.bits=g)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(m){if(m>this.bits.length*32){const g=E.makeArray(m);y.arraycopy(this.bits,0,g,0,this.bits.length),this.bits=g}}get(m){return(this.bits[Math.floor(m/32)]&1<<(m&31))!==0}set(m){this.bits[Math.floor(m/32)]|=1<<(m&31)}flip(m){this.bits[Math.floor(m/32)]^=1<<(m&31)}getNextSet(m){const g=this.size;if(m>=g)return g;const v=this.bits;let k=Math.floor(m/32),C=v[k];C&=~((1<<(m&31))-1);const A=v.length;for(;C===0;){if(++k===A)return g;C=v[k]}const I=k*32+j.numberOfTrailingZeros(C);return I>g?g:I}getNextUnset(m){const g=this.size;if(m>=g)return g;const v=this.bits;let k=Math.floor(m/32),C=~v[k];C&=~((1<<(m&31))-1);const A=v.length;for(;C===0;){if(++k===A)return g;C=~v[k]}const I=k*32+j.numberOfTrailingZeros(C);return I>g?g:I}setBulk(m,g){this.bits[Math.floor(m/32)]=g}setRange(m,g){if(g<m||m<0||g>this.size)throw new f;if(g===m)return;g--;const v=Math.floor(m/32),k=Math.floor(g/32),C=this.bits;for(let A=v;A<=k;A++){const I=A>v?0:m&31,V=(2<<(A<k?31:g&31))-(1<<I);C[A]|=V}}clear(){const m=this.bits.length,g=this.bits;for(let v=0;v<m;v++)g[v]=0}isRange(m,g,v){if(g<m||m<0||g>this.size)throw new f;if(g===m)return!0;g--;const k=Math.floor(m/32),C=Math.floor(g/32),A=this.bits;for(let I=k;I<=C;I++){const $=I>k?0:m&31,X=(2<<(I<C?31:g&31))-(1<<$)&4294967295;if((A[I]&X)!==(v?X:0))return!1}return!0}appendBit(m){this.ensureCapacity(this.size+1),m&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++}appendBits(m,g){if(g<0||g>32)throw new f("Num bits must be between 0 and 32");this.ensureCapacity(this.size+g);for(let v=g;v>0;v--)this.appendBit((m>>v-1&1)===1)}appendBitArray(m){const g=m.size;this.ensureCapacity(this.size+g);for(let v=0;v<g;v++)this.appendBit(m.get(v))}xor(m){if(this.size!==m.size)throw new f("Sizes don't match");const g=this.bits;for(let v=0,k=g.length;v<k;v++)g[v]^=m.bits[v]}toBytes(m,g,v,k){for(let C=0;C<k;C++){let A=0;for(let I=0;I<8;I++)this.get(m)&&(A|=1<<7-I),m++;g[v+C]=A}}getBitArray(){return this.bits}reverse(){const m=new Int32Array(this.bits.length),g=Math.floor((this.size-1)/32),v=g+1,k=this.bits;for(let C=0;C<v;C++){let A=k[C];A=A>>1&1431655765|(A&1431655765)<<1,A=A>>2&858993459|(A&858993459)<<2,A=A>>4&252645135|(A&252645135)<<4,A=A>>8&16711935|(A&16711935)<<8,A=A>>16&65535|(A&65535)<<16,m[g-C]=A}if(this.size!==v*32){const C=v*32-this.size;let A=m[0]>>>C;for(let I=1;I<v;I++){const $=m[I];A|=$<<32-C,m[I-1]=A,A=$>>>C}m[v-1]=A}this.bits=m}static makeArray(m){return new Int32Array(Math.floor((m+31)/32))}equals(m){if(!(m instanceof E))return!1;const g=m;return this.size===g.size&&_.equals(this.bits,g.bits)}hashCode(){return 31*this.size+_.hashCode(this.bits)}toString(){let m="";for(let g=0,v=this.size;g<v;g++)g&7||(m+=" "),m+=this.get(g)?"X":".";return m}clone(){return new E(this.size,this.bits.slice())}}var S;(function(te){te[te.OTHER=0]="OTHER",te[te.PURE_BARCODE=1]="PURE_BARCODE",te[te.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",te[te.TRY_HARDER=3]="TRY_HARDER",te[te.CHARACTER_SET=4]="CHARACTER_SET",te[te.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",te[te.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",te[te.ASSUME_GS1=7]="ASSUME_GS1",te[te.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",te[te.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",te[te.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(S||(S={}));var T=S;class P extends u{static getFormatInstance(){return new P}}P.kind="FormatException";var O;(function(te){te[te.Cp437=0]="Cp437",te[te.ISO8859_1=1]="ISO8859_1",te[te.ISO8859_2=2]="ISO8859_2",te[te.ISO8859_3=3]="ISO8859_3",te[te.ISO8859_4=4]="ISO8859_4",te[te.ISO8859_5=5]="ISO8859_5",te[te.ISO8859_6=6]="ISO8859_6",te[te.ISO8859_7=7]="ISO8859_7",te[te.ISO8859_8=8]="ISO8859_8",te[te.ISO8859_9=9]="ISO8859_9",te[te.ISO8859_10=10]="ISO8859_10",te[te.ISO8859_11=11]="ISO8859_11",te[te.ISO8859_13=12]="ISO8859_13",te[te.ISO8859_14=13]="ISO8859_14",te[te.ISO8859_15=14]="ISO8859_15",te[te.ISO8859_16=15]="ISO8859_16",te[te.SJIS=16]="SJIS",te[te.Cp1250=17]="Cp1250",te[te.Cp1251=18]="Cp1251",te[te.Cp1252=19]="Cp1252",te[te.Cp1256=20]="Cp1256",te[te.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",te[te.UTF8=22]="UTF8",te[te.ASCII=23]="ASCII",te[te.Big5=24]="Big5",te[te.GB18030=25]="GB18030",te[te.EUC_KR=26]="EUC_KR"})(O||(O={}));class D{constructor(m,g,v,...k){this.valueIdentifier=m,this.name=v,typeof g=="number"?this.values=Int32Array.from([g]):this.values=g,this.otherEncodingNames=k,D.VALUE_IDENTIFIER_TO_ECI.set(m,this),D.NAME_TO_ECI.set(v,this);const C=this.values;for(let A=0,I=C.length;A!==I;A++){const $=C[A];D.VALUES_TO_ECI.set($,this)}for(const A of k)D.NAME_TO_ECI.set(A,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(m){if(m<0||m>=900)throw new P("incorect value");const g=D.VALUES_TO_ECI.get(m);
2707if(g===void 0)throw new P("incorect value");return g}static getCharacterSetECIByName(m){const g=D.NAME_TO_ECI.get(m);if(g===void 0)throw new P("incorect value");return g}equals(m){if(!(m instanceof D))return!1;const g=m;return this.getName()===g.getName()}}D.VALUE_IDENTIFIER_TO_ECI=new Map,D.VALUES_TO_ECI=new Map,D.NAME_TO_ECI=new Map,D.Cp437=new D(O.Cp437,Int32Array.from([0,2]),"Cp437"),D.ISO8859_1=new D(O.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),D.ISO8859_2=new D(O.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),D.ISO8859_3=new D(O.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),D.ISO8859_4=new D(O.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),D.ISO8859_5=new D(O.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),D.ISO8859_6=new D(O.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),D.ISO8859_7=new D(O.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),D.ISO8859_8=new D(O.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),D.ISO8859_9=new D(O.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),D.ISO8859_10=new D(O.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),D.ISO8859_11=new D(O.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),D.ISO8859_13=new D(O.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),D.ISO8859_14=new D(O.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),D.ISO8859_15=new D(O.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),D.ISO8859_16=new D(O.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),D.SJIS=new D(O.SJIS,20,"SJIS","Shift_JIS"),D.Cp1250=new D(O.Cp1250,21,"Cp1250","windows-1250"),D.Cp1251=new D(O.Cp1251,22,"Cp1251","windows-1251"),D.Cp1252=new D(O.Cp1252,23,"Cp1252","windows-1252"),D.Cp1256=new D(O.Cp1256,24,"Cp1256","windows-1256"),D.UnicodeBigUnmarked=new D(O.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),D.UTF8=new D(O.UTF8,26,"UTF8","UTF-8"),D.ASCII=new D(O.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),D.Big5=new D(O.Big5,28,"Big5"),D.GB18030=new D(O.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),D.EUC_KR=new D(O.EUC_KR,30,"EUC_KR","EUC-KR");class R extends u{}R.kind="UnsupportedOperationException";class L{static decode(m,g){const v=this.encodingName(g);return this.customDecoder?this.customDecoder(m,v):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(v)?this.decodeFallback(m,v):new TextDecoder(v).decode(m)}static shouldDecodeOnFallback(m){return!L.isBrowser()&&m==="ISO-8859-1"}static encode(m,g){const v=this.encodingName(g);return this.customEncoder?this.customEncoder(m,v):typeof TextEncoder>"u"?this.encodeFallback(m):new TextEncoder().encode(m)}static isBrowser(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"}static encodingName(m){return typeof m=="string"?m:m.getName()}static encodingCharacterSet(m){return m instanceof D?m:D.getCharacterSetECIByName(m)}static decodeFallback(m,g){const v=this.encodingCharacterSet(g);if(L.isDecodeFallbackSupported(v)){let k="";for(let C=0,A=m.length;C<A;C++){let I=m[C].toString(16);I.length<2&&(I="0"+I),k+="%"+I}return decodeURIComponent(k)}if(v.equals(D.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(m.buffer));throw new R(`Encoding ${this.encodingName(g)} not supported by fallback.`)}static isDecodeFallbackSupported(m){return m.equals(D.UTF8)||m.equals(D.ISO8859_1)||m.equals(D.ASCII)}static encodeFallback(m){const v=btoa(unescape(encodeURIComponent(m))).split(""),k=[];for(let C=0;C<v.length;C++)k.push(v[C].charCodeAt(0));return new Uint8Array(k)}}class M{static castAsNonUtf8Char(m,g=null){const v=g?g.getName():this.ISO88591;return L.decode(new Uint8Array([m]),v)}static guessEncoding(m,g){if(g!=null&&g.get(T.CHARACTER_SET)!==void 0)return g.get(T.CHARACTER_SET).toString();const v=m.length;let k=!0,C=!0,A=!0,I=0,$=0,V=0,X=0,ne=0,ie=0,he=0,ye=0,ve=0,Ce=0,Me=0;const tt=m.length>3&&m[0]===239&&m[1]===187&&m[2]===191;for(let rt=0;rt<v&&(k||C||A);rt++){const Xe=m[rt]&255;A&&(I>0?Xe&128?I--:A=!1:Xe&128&&(Xe&64?(I++,Xe&32?(I++,Xe&16?(I++,Xe&8?A=!1:X++):V++):$++):A=!1)),k&&(Xe>127&&Xe<160?k=!1:Xe>159&&(Xe<192||Xe===215||Xe===247)&&Me++),C&&(ne>0?Xe<64||Xe===127||Xe>252?C=!1:ne--:Xe===128||Xe===160||Xe>239?C=!1:Xe>160&&Xe<224?(ie++,ye=0,he++,he>ve&&(ve=he)):Xe>127?(ne++,he=0,ye++,ye>Ce&&(Ce=ye)):(he=0,ye=0))}return A&&I>0&&(A=!1),C&&ne>0&&(C=!1),A&&(tt||$+V+X>0)?M.UTF8:C&&(M.ASSUME_SHIFT_JIS||ve>=3||Ce>=3)?M.SHIFT_JIS:k&&C?ve===2&&ie===2||Me*10>
2707=v?M.SHIFT_JIS:M.ISO88591:k?M.ISO88591:C?M.SHIFT_JIS:A?M.UTF8:M.PLATFORM_DEFAULT_ENCODING}static format(m,...g){let v=-1;function k(A,I,$,V,X,ne){if(A==="%%")return"%";if(g[++v]===void 0)return;A=V?parseInt(V.substr(1)):void 0;let ie=X?parseInt(X.substr(1)):void 0,he;switch(ne){case"s":he=g[v];break;case"c":he=g[v][0];break;case"f":he=parseFloat(g[v]).toFixed(A);break;case"p":he=parseFloat(g[v]).toPrecision(A);break;case"e":he=parseFloat(g[v]).toExponential(A);break;case"x":he=parseInt(g[v]).toString(ie||16);break;case"d":he=parseFloat(parseInt(g[v],ie||10).toPrecision(A)).toFixed(0);break}he=typeof he=="object"?JSON.stringify(he):(+he).toString(ie);let ye=parseInt($),ve=$&&$[0]+""=="0"?"0":" ";for(;he.length<ye;)he=I!==void 0?he+ve:ve+he;return he}let C=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return m.replace(C,k)}static getBytes(m,g){return L.encode(m,g)}static getCharCode(m,g=0){return m.charCodeAt(g)}static getCharAt(m){return String.fromCharCode(m)}}M.SHIFT_JIS=D.SJIS.getName(),M.GB2312="GB2312",M.ISO88591=D.ISO8859_1.getName(),M.EUC_JP="EUC_JP",M.UTF8=D.UTF8.getName(),M.PLATFORM_DEFAULT_ENCODING=M.UTF8,M.ASSUME_SHIFT_JIS=!1;class B{constructor(m=""){this.value=m}enableDecoding(m){return this.encoding=m,this}append(m){return typeof m=="string"?this.value+=m.toString():this.encoding?this.value+=M.castAsNonUtf8Char(m,this.encoding):this.value+=String.fromCharCode(m),this}appendChars(m,g,v){for(let k=g;g<g+v;k++)this.append(m[k]);return this}length(){return this.value.length}charAt(m){return this.value.charAt(m)}deleteCharAt(m){this.value=this.value.substr(0,m)+this.value.substring(m+1)}setCharAt(m,g){this.value=this.value.substr(0,m)+g+this.value.substr(m+1)}substring(m,g){return this.value.substring(m,g)}setLengthToZero(){this.value=""}toString(){return this.value}insert(m,g){this.value=this.value.substr(0,m)+g+this.value.substr(m+g.length)}}
2707class U{constructor(m,g,v,k){if(this.width=m,this.height=g,this.rowSize=v,this.bits=k,g==null&&(g=m),this.height=g,m<1||g<1)throw new f("Both dimensions must be greater than 0");v==null&&(v=Math.floor((m+31)/32)),this.rowSize=v,k==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(m){const g=m.length,v=m[0].length,k=new U(v,g);for(let C=0;C<g;C++){const A=m[C];for(let I=0;I<v;I++)A[I]&&k.set(I,C)}return k}static parseFromString(m,g,v){if(m===null)throw new f("stringRepresentation cannot be null");const k=new Array(m.length);let C=0,A=0,I=-1,$=0,V=0;for(;V<m.length;)if(m.charAt(V)===`
2708`||m.charAt(V)==="\r"){if(C>A){if(I===-1)I=C-A;else if(C-A!==I)throw new f("row lengths do not match");A=C,$++}V++}else if(m.substring(V,V+g.length)===g)V+=g.length,k[C]=!0,C++;else if(m.substring(V,V+v.length)===v)V+=v.length,k[C]=!1,C++;else throw new f("illegal character encountered: "+m.substring(V));if(C>A){if(I===-1)I=C-A;else if(C-A!==I)throw new f("row lengths do not match");$++}const X=new U(I,$);for(let ne=0;ne<C;ne++)k[ne]&&X.set(Math.floor(ne%I),Math.floor(ne/I));return X}get(m,g){const v=g*this.rowSize+Math.floor(m/32);return(this.bits[v]>>>(m&31)&1)!==0}set(m,g){const v=g*this.rowSize+Math.floor(m/32);this.bits[v]|=1<<(m&31)&4294967295}unset(m,g){const v=g*this.rowSize+Math.floor(m/32);this.bits[v]&=~(1<<(m&31)&4294967295)}flip(m,g){const v=g*this.rowSize+Math.floor(m/32);this.bits[v]^=1<<(m&31)&4294967295}xor(m){if(this.width!==m.getWidth()||this.height!==m.getHeight()||this.rowSize!==m.getRowSize())throw new f("input matrix dimensions do not match");const g=new E(Math.floor(this.width/32)+1),v=this.rowSize,k=this.bits;for(let C=0,A=this.height;C<A;C++){const I=C*v,$=m.getRow(C,g).getBitArray();for(let V=0;V<v;V++)k[I+V]^=$[V]}}clear(){const m=this.bits,g=m.length;for(let v=0;v<g;v++)m[v]=0}setRegion(m,g,v,k){if(g<0||m<0)throw new f("Left and top must be nonnegative");if(k<1||v<1)throw new f("Height and width must be at least 1");const C=m+v,A=g+k;if(A>this.height||C>this.width)throw new f("The region must fit inside the matrix");const I=this.rowSize,$=this.bits;for(let V=g;V<A;V++){const X=V*I;for(let ne=m;ne<C;ne++)$[X+Math.floor(ne/32)]|=1<<(ne&31)&4294967295}}getRow(m,g){g==null||g.getSize()<this.width?g=new E(this.width):g.clear();const v=this.rowSize,k=this.bits,C=m*v;for(let A=0;A<v;A++)g.setBulk(A*32,k[C+A]);return g}setRow(m,g){y.arraycopy(g.getBitArray(),0,this.bits,m*this.rowSize,this.rowSize)}rotate180(){const m=this.getWidth(),g=this.getHeight();let v=new E(m),k=new E(m);for(let C=0,A=Math.floor((g+1)/2);C<A;C++)v=this.getRow(C,v),k=this.getRow(g-1-C,k),v.reverse(),k.reverse(),this.setRow(C,k),this.setRow(g-1-C,v)}getEnclosingRectangle(){const m=this.width,g=this.height,v=this.rowSize,k=this.bits;let C=m,A=g,I=-1,$=-1;for(let V=0;V<g;V++)for(let X=0;X<v;X++){const ne=k[V*v+X];if(ne!==0){if(V<A&&(A=V),V>$&&($=V),X*32<C){let ie=0;for(;!(ne<<31-ie&4294967295);)ie++;X*32+ie<C&&(C=X*32+ie)}if(X*32+31>I){let ie=31;for(;!(ne>>>ie);)ie--;X*32+ie>I&&(I=X*32+ie)}}}return I<C||$<A?null:Int32Array.from([C,A,I-C+1,$-A+1])}getTopLeftOnBit(){const m=this.rowSize,g=this.bits;let v=0;for(;v<g.length&&g[v]===0;)v++;if(v===g.length)return null;const k=v/m;let C=v%m*32;const A=g[v];let I=0;for(;!(A<<31-I&4294967295);)I++;return C+=I,Int32Array.from([C,k])}getBottomRightOnBit(){const m=this.rowSize,g=this.bits;let v=g.length-1;for(;v>=0&&g[v]===0;)v--;if(v<0)return null;const k=Math.floor(v/m);let C=Math.floor(v%m)*32;const A=g[v];let I=31;for(;!(A>>>I);)I--;return C+=I,Int32Array.from([C,k])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(m){if(!(m instanceof U))return!1;const g=m;return this.width===g.width&&this.height===g.height&&this.rowSize===g.rowSize&&_.equals(this.bits,g.bits)}hashCode(){let m=this.width;return m=31*m+this.width,m=31*m+this.height,m=31*m+this.rowSize,m=31*m+_.hashCode(this.bits),m}toString(m="X ",g="  ",v=`
2709`){return this.buildToString(m,g,v)}buildToString(m,g,v){let k=new B;for(let C=0,A=this.height;C<A;C++){for(let I=0,$=this.width;I<$;I++)k.append(this.get(I,C)?m:g);k.append(v)}return k.toString()}clone(){return new U(this.width,this.height,this.rowSize,this.bits.slice())}}class F extends u{static getNotFoundInstance(){return new F}}F.kind="NotFoundException";class H extends x{constructor(m){super(m),this.luminances=H.EMPTY,this.buckets=new Int32Array(H.LUMINANCE_BUCKETS)}getBlackRow(m,g){const v=this.getLuminanceSource(),k=v.getWidth();g==null||g.getSize()<k?g=new E(k):g.clear(),this.initArrays(k);const C=v.getRow(m,this.luminances),A=this.buckets;for(let $=0;$<k;$++)A[(C[$]&255)>>H.LUMINANCE_SHIFT]++;const I=H.estimateBlackPoint(A);if(k<3)for(let $=0;$<k;$++)(C[$]&255)<I&&g.set($);else{let $=C[0]&255,V=C[1]&255;for(let X=1;X<k-1;X++){const ne=C[X+1]&255;(V*4-$-ne)/2<I&&g.set(X),$=V,V=ne}}return g}getBlackMatrix(){const m=this.getLuminanceSource(),g=m.getWidth(),v=m.getHeight(),k=new U(g,v);this.initArrays(g);const C=this.buckets;for(let $=1;$<5;$++){const V=Math.floor(v*$/5),X=m.getRow(V,this.luminances),ne=Math.floor(g*4/5);for(let ie=Math.floor(g/5);ie<ne;ie++){const he=X[ie]&255;C[he>>H.LUMINANCE_SHIFT]++}}const A=H.estimateBlackPoint(C),I=m.getMatrix();for(let $=0;$<v;$++){const V=$*g;for(let X=0;X<g;
vendor: 4,819 bytes, lines 2709-2710
2709X++)(I[V+X]&255)<A&&k.set(X,$)}return k}createBinarizer(m){return new H(m)}initArrays(m){this.luminances.length<m&&(this.luminances=new Uint8ClampedArray(m));const g=this.buckets;for(let v=0;v<H.LUMINANCE_BUCKETS;v++)g[v]=0}static estimateBlackPoint(m){const g=m.length;let v=0,k=0,C=0;for(let X=0;X<g;X++)m[X]>C&&(k=X,C=m[X]),m[X]>v&&(v=m[X]);let A=0,I=0;for(let X=0;X<g;X++){const ne=X-k,ie=m[X]*ne*ne;ie>I&&(A=X,I=ie)}if(k>A){const X=k;k=A,A=X}if(A-k<=g/16)throw new F;let $=A-1,V=-1;for(let X=A-1;X>k;X--){const ne=X-k,ie=ne*ne*(A-X)*(v-m[X]);ie>V&&($=X,V=ie)}return $<<H.LUMINANCE_SHIFT}}H.LUMINANCE_BITS=5,H.LUMINANCE_SHIFT=8-H.LUMINANCE_BITS,H.LUMINANCE_BUCKETS=1<<H.LUMINANCE_BITS,H.EMPTY=Uint8ClampedArray.from([0]);class z extends H{constructor(m){super(m),this.matrix=null}getBlackMatrix(){if(this.matrix!==null)return this.matrix;const m=this.getLuminanceSource(),g=m.getWidth(),v=m.getHeight();if(g>=z.MINIMUM_DIMENSION&&v>=z.MINIMUM_DIMENSION){const k=m.getMatrix();let C=g>>z.BLOCK_SIZE_POWER;g&z.BLOCK_SIZE_MASK&&C++;let A=v>>z.BLOCK_SIZE_POWER;v&z.BLOCK_SIZE_MASK&&A++;const I=z.calculateBlackPoints(k,C,A,g,v),$=new U(g,v);z.calculateThresholdForBlock(k,C,A,g,v,I,$),this.matrix=$}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(m){return new z(m)}static calculateThresholdForBlock(m,g,v,k,C,A,I){const $=C-z.BLOCK_SIZE,V=k-z.BLOCK_SIZE;for(let X=0;X<v;X++){let ne=X<<z.BLOCK_SIZE_POWER;ne>$&&(ne=$);const ie=z.cap(X,2,v-3);for(let he=0;he<g;he++){let ye=he<<z.BLOCK_SIZE_POWER;ye>V&&(ye=V);const ve=z.cap(he,2,g-3);let Ce=0;for(let tt=-2;tt<=2;tt++){const rt=A[ie+tt];Ce+=rt[ve-2]+rt[ve-1]+rt[ve]+rt[ve+1]+rt[ve+2]}const Me=Ce/25;z.thresholdBlock(m,ye,ne,Me,k,I)}}}static cap(m,g,v){return m<g?g:m>v?v:m}static thresholdBlock(m,g,v,k,C,A){for(let I=0,$=v*C+g;I<z.BLOCK_SIZE;I++,$+=C)for(let V=0;V<z.BLOCK_SIZE;V++)(m[$+V]&255)<=k&&A.set(g+V,v+I)}static calculateBlackPoints(m,g,v,k,C){const A=C-z.BLOCK_SIZE,I=k-z.BLOCK_SIZE,$=new Array(v);for(let V=0;V<v;V++){$[V]=new Int32Array(g);let X=V<<z.BLOCK_SIZE_POWER;X>A&&(X=A);for(let ne=0;ne<g;ne++){let ie=ne<<z.BLOCK_SIZE_POWER;ie>I&&(ie=I);let he=0,ye=255,ve=0;for(let Me=0,tt=X*k+ie;Me<z.BLOCK_SIZE;Me++,tt+=k){for(let rt=0;rt<z.BLOCK_SIZE;rt++){const Xe=m[tt+rt]&255;he+=Xe,Xe<ye&&(ye=Xe),Xe>ve&&(ve=Xe)}if(ve-ye>z.MIN_DYNAMIC_RANGE)for(Me++,tt+=k;Me<z.BLOCK_SIZE;Me++,tt+=k)for(let rt=0;rt<z.BLOCK_SIZE;rt++)he+=m[tt+rt]&255}let Ce=he>>z.BLOCK_SIZE_POWER*2;if(ve-ye<=z.MIN_DYNAMIC_RANGE&&(Ce=ye/2,V>0&&ne>0)){const Me=($[V-1][ne]+2*$[V][ne-1]+$[V-1][ne-1])/4;ye<Me&&(Ce=Me)}$[V][ne]=Ce}}return $}}z.BLOCK_SIZE_POWER=3,z.BLOCK_SIZE=1<<z.BLOCK_SIZE_POWER,z.BLOCK_SIZE_MASK=z.BLOCK_SIZE-1,z.MINIMUM_DIMENSION=z.BLOCK_SIZE*5,z.MIN_DYNAMIC_RANGE=24;class K{constructor(m,g){this.width=m,this.height=g}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(m,g,v,k){throw new R("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new R("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new R("This luminance source does not support rotation by 45 degrees.")}toString(){const m=new Uint8ClampedArray(this.width);let g=new B;for(let v=0;v<this.height;v++){const k=this.getRow(v,m);for(let C=0;C<this.width;C++){const A=k[C]&255;let I;A<64?I="#":A<128?I="+":A<192?I=".":I=" ",g.append(I)}g.append(`
2710`)}return g.toString()}}class W extends K{constructor(m){super(m.getWidth(),m.getHeight()),this.delegate=m}getRow(m,g){const v=this.delegate.getRow(m,g),k=this.getWidth();for(let C=0;C<k;C++)v[C]=255-(v[C]&255);return v}getMatrix(){const m=this.delegate.getMatrix(),g=this.getWidth()*this.getHeight(),v=new Uint8ClampedArray(g);for(let k=0;k<g;k++)v[k]=255-(m[k]&255);return v}isCropSupported(){return this.delegate.isCropSupported()}crop(m,g,v,k){return new W(this.delegate.crop(m,g,v,k))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new W(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new W(this.delegate.rotateCounterClockwise45())}}class q extends K{constructor(m){super(m.width,m.height),this.canvas=m,this.tempCanvasElement=null,this.buffer=q.makeBufferFromCanvasImageData(m)}static makeBufferFromCanvasImageData(m){const g=m.getContext("2d").getImageData(0,0,m.width,m.height);return q.toGrayscaleBuffer(g.data,m.width,m.height)}static toGrayscaleBuffer(m,g,v){const k=new Uint8ClampedArray(g*v);for(let C=0,A=0,I=m.length;C<I;C+=4,A++){let $;if(m[C+3]===0)$=255;else{const X=m[C],ne=m[C+1],ie=m[C+2];$=306*X+601*ne+117*ie+512>>10}k[A]=$}return k}getRow(m,g){if(m<0||m>=this.getHeight())throw new f("Requested row is outside the image: "+m);const v=this.getWidth(),k=m*v;
2710return g===null?g=this.buffer.slice(k,k+v):(g.length<v&&(g=new Uint8ClampedArray(v)),g.set(this.buffer.slice(k,k+v))),g}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(m,g,v,k){return super.crop(m,g,v,k),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(this.tempCanvasElement===null){const m=this.canvas.ownerDocument.createElement("canvas");m.width=this.canvas.width,m.height=this.canvas.height,this.tempCanvasElement=m}return this.tempCanvasElement}rotate(m){const g=this.getTempCanvasElement(),v=g.getContext("2d"),k=m*q.DEGREE_TO_RADIANS,C=this.canvas.width,A=this.canvas.height,I=Math.ceil(Math.abs(Math.cos(k))*C+Math.abs(Math.sin(k))*A),$=Math.ceil(Math.abs(Math.sin(k))*C+Math.abs(Math.cos(k))*A);return g.width=I,g.height=$,v.translate(I/2,$/2),v.rotate(k),v.drawImage(this.canvas,C/-2,A/-2),this.buffer=q.makeBufferFromCanvasImageData(g),this}invert(){return new W(this)}}q.DEGREE_TO_RADIANS=Math.PI/180;class oe{constructor(m,g,v){this.deviceId=m,this.label=g,this.kind="videoinput",this.groupId=v||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var J=(globalThis||Lo||self||window||void 0)&&(globalThis||Lo||self||window||void 0).__awaiter||function(te,m,g,v){function k(C){return C instanceof g?C:new g(function(A){A(C)})}return new(g||(g=Promise))(function(C,A){function I(X){try{V(v.next(X))}catch(ne){A(ne)}}function $(X){try{V(v.throw(X))}catch(ne){A(ne)}}function V(X){X.done?C(X.value):k(X.value).then(I,$)}V((v=v.apply(te,m||[])).next())})};class Y{constructor(m,g=500,v){this.reader=m,this.timeBetweenScansMillis=g,this._hints=v,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return typeof navigator<"u"}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(m){this._timeBetweenDecodingAttempts=m<0?0:m}set hints(m){this._hints=m||null}get hints(){return this._hints}listVideoInputDevices(){return J(this,void 0,void 0,function*(){if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");const m=yield navigator.mediaDevices.enumerateDevices(),g=[];for(const v of m){const k=v.kind==="video"?"videoinput":v.kind;if(k!=="videoinput")continue;const C=v.deviceId||v.id,A=v.label||`Video device ${g.length+1}`,I=v.groupId,$={deviceId:C,label:A,kind:k,groupId:I};g.push($)}return g})}getVideoInputDevices(){return J(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(g=>new oe(g.deviceId,g.label))})}findDeviceById(m){return J(this,void 0,void 0,function*(){const g=yield this.listVideoInputDevices();return g?g.find(v=>v.deviceId===m):null})}decodeFromInputVideoDevice(m,g){return J(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(m,g)})}decodeOnceFromVideoDevice(m,g){return J(this,void 0,void 0,function*(){this.reset();let v;m?v={deviceId:{exact:m}}:v={facingMode:"environment"};const k={video:v};return yield this.decodeOnceFromConstraints(k,g)})}decodeOnceFromConstraints(m,g){return J(this,void 0,void 0,function*(){const v=yield navigator.mediaDevices.getUserMedia(m);return yield this.decodeOnceFromStream(v,g)})}decodeOnceFromStream(m,g){return J(this,void 0,void 0,function*(){this.reset();const v=yield this.attachStreamToVideo(m,g);return yield this.decodeOnce(v)})}decodeFromInputVideoDeviceContinuously(m,g,v){return J(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(m,g,v)})}decodeFromVideoDevice(m,g,v){return J(this,void 0,void 0,function*(){let k;m?k={deviceId:{exact:m}}:k={facingMode:"environment"};const C={video:k};return yield this.decodeFromConstraints(C,g,v)})}decodeFromConstraints(m,g,v){return J(this,void 0,void 0,function*(){const k=yield navigator.mediaDevices.getUserMedia(m);return yield this.decodeFromStream(k,g,v)})}decodeFromStream(m,g,v){return J(this,void 0,void 0,function*(){this.reset();const k=yield this.attachStreamToVideo(m,g);return yield this.decodeContinuously(k,v)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(m,g){return J(this,void 0,void 0,function*(){const v=this.prepareVideoElement(g);return this.addVideoSource(v,m),this.videoElement=v,this.stream=m,yield this.playVideoOnLoadAsync(v),v})}playVideoOnLoadAsync(m){return new Promise((g,v)=>this.playVideoOnLoad(m,()=>g()))}playVideoOnLoad(m,g){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(m),m.addEventListener("ended",this.videoEndedListener),m.addEventListener("canplay",this.videoCanPlayListener),m.addEventListener("playing",g),this.tryPlayVideo(m)}isVideoPlaying(m){return m.currentTime>0&&!m.paused&&!m.ended&&m.readyState>2}tryPlayVideo(m){return J(this,void 0,void 0,function*(){if(this.isVideoPlaying(m)){console.warn("Trying to play video that is already playing.");return}try{yield m.play()}catch{console.warn("It was not possible to play the video.")}})}getMediaElement(m,g){const v=document.getElementById(m);if(!v)throw new d(`element with id '${m}' not found`);if(v.nodeName.toLowerCase()!==g.toLowerCase())throw new d(`element with id '${m}' must be an ${g} element`);return v}decodeFromImage(m,g){if(!m&&!g)throw new d("either imageElement with a src set or an url must be provided");return g&&!m?this.decodeFromImageUrl(g):this.decodeFromImageElement(m)}decodeFromVideo(m,g){if(!m&&!g)throw new d("Either an element with a src set or an URL must be provided");return g&&!m?this.decodeFromVideoUrl(g):this.decodeFromVideoElement(m)}decodeFromVideoContinuously(m,g,v){if(m===void 0&&g===void 0)throw new d("Either an element with a src set or an URL must be provided");return g&&!m?this.decodeFromVideoUrlContinuously(g,v):this.decodeFromVideoElementContinuously(m,v)}decodeFromImageElement(m){if(!m)throw new d("An image element must be provided.");this.reset();const g=this.prepareImageElement(m);this.imageElement=g;let v;return this.isImageLoaded(g)?v=this.decodeOnce(g,!1,!0):v=this._decodeOnLoadImage(g),v}decodeFromVideoElement(m){const g=this._decodeFromVideoElementSetup(m);return this._decodeOnLoadVideo(g)}decodeFromVideoElementContinuously(m,g){const v=this._decodeFromVideoElementSetup(m);return this._decodeOnLoadVideoContinuously(v,g)}_decodeFromVideoElementSetup(m){if(!m)throw new d("A video element must be provided.");this.reset();const g=this.prepareVideoElement(m);return this.videoElement=g,g}decodeFromImageUrl(m){if(!m)throw new d("An URL must be provided.");this.reset();const g=this.prepareImageElement();this.imageElement=g;const v=this._decodeOnLoadImage(g);return g.src=m,v}decodeFromVideoUrl(m){if(!m)throw new d("An URL must be provided.");this.reset();const g=this.prepareVideoElement(),v=this.decodeFromVideoElement(g);return g.src=m,v}decodeFromVideoUrlContinuously(m,g){if(!m)throw new d("An URL must be provided.");this.reset();const v=this.prepareVideoElement(),k=this.decodeFromVideoElementContinuously(v,g);return v.src=m,k}_decodeOnLoadImage(m){return new Promise((g,v)=>{this.imageLoadedListener=()=>this.decodeOnce(m,!1,!0).then(g,v),m.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(m){return J(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(m),yield this.decodeOnce(m)})}_decodeOnLoadVideoContinuously(m,g){return J(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(m),this.decodeContinuously(m,g)})}
2710isImageLoaded(m){return!(!m.complete||m.naturalWidth===0)}prepareImageElement(m){let g;return typeof m>"u"&&(g=document.createElement("img"),g.width=200,g.height=200),typeof m=="string"&&(g=this.getMediaElement(m,"img")),m instanceof HTMLImageElement&&(g=m),g}prepareVideoElement(m){let g;return!m&&typeof document<"u"&&(g=document.createElement("video"),g.width=200,g.height=200),typeof m=="string"&&(g=this.getMediaElement(m,"video")),m instanceof HTMLVideoElement&&(g=m),g.setAttribute("autoplay","true"),g.setAttribute("muted","true"),g.setAttribute("playsinline","true"),g}decodeOnce(m,g=!0,v=!0){this._stopAsyncDecode=!1;const k=(C,A)=>{if(this._stopAsyncDecode){A(new F("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const I=this.decode(m);C(I)}catch(I){const $=g&&I instanceof F,X=(I instanceof p||I instanceof P)&&v;if($||X)return setTimeout(k,this._timeBetweenDecodingAttempts,C,A);A(I)}};return new Promise((C,A)=>k(C,A))}decodeContinuously(m,g){this._stopContinuousDecode=!1;const v=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const k=this.decode(m);g(k,null),setTimeout(v,this.timeBetweenScansMillis)}catch(k){g(null,k);const C=k instanceof p||k instanceof P,A=k instanceof F;(C||A)&&setTimeout(v,this._timeBetweenDecodingAttempts)}};v()}decode(m){const g=this.createBinaryBitmap(m);return this.decodeBitmap(g)}_isHTMLVideoElement(m){return m.videoWidth!==0}drawFrameOnCanvas(m,g,v){g||(g={sx:0,sy:0,sWidth:m.videoWidth,sHeight:m.videoHeight,dx:0,dy:0,dWidth:m.videoWidth,dHeight:m.videoHeight}),v||(v=this.captureCanvasContext),v.drawImage(m,g.sx,g.sy,g.sWidth,g.sHeight,g.dx,g.dy,g.dWidth,g.dHeight)}drawImageOnCanvas(m,g,v=this.captureCanvasContext){g||(g={sx:0,sy:0,sWidth:m.naturalWidth,sHeight:m.naturalHeight,dx:0,dy:0,dWidth:m.naturalWidth,dHeight:m.naturalHeight}),v||(v=this.captureCanvasContext),v.drawImage(m,g.sx,g.sy,g.sWidth,g.sHeight,g.dx,g.dy,g.dWidth,g.dHeight)}createBinaryBitmap(m){this.getCaptureCanvasContext(m),this._isHTMLVideoElement(m)?this.drawFrameOnCanvas(m):this.drawImageOnCanvas(m);const g=this.getCaptureCanvas(m),v=new q(g),k=new z(v);return new h(k)}getCaptureCanvasContext(m){if(!this.captureCanvasContext){const v=this.getCaptureCanvas(m).getContext("2d");this.captureCanvasContext=v}return this.captureCanvasContext}getCaptureCanvas(m){if(!this.captureCanvas){const g=this.createCaptureCanvas(m);this.captureCanvas=g}return this.captureCanvas}decodeBitmap(m){return this.reader.decode(m,this._hints)}createCaptureCanvas(m){if(typeof document>"u")return this._destroyCaptureCanvas(),null;const g=document.createElement("canvas");let v,k;return typeof m<"u"&&(m instanceof HTMLVideoElement?(v=m.videoWidth,k=m.videoHeight):m instanceof HTMLImageElement&&(v=m.naturalWidth||m.width,k=m.naturalHeight||m.height)),g.style.width=v+"px",g.style.height=k+"px",g.width=v,g.height=k,g}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(m=>m.stop()),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(m,g){try{m.srcObject=g}catch{m.src=URL.createObjectURL(g)}}cleanVideoSource(m){try{m.srcObject=null}catch{m.src=""}this.videoElement.removeAttribute("src")}}class Z{constructor(m,g,v=g==null?0:8*g.length,k,C,A=y.currentTimeMillis()){this.text=m,this.rawBytes=g,this.numBits=v,this.resultPoints=k,this.format=C,this.timestamp=A,this.text=m,this.rawBytes=g,v==null?this.numBits=g==null?0:8*g.length:this.numBits=v,this.resultPoints=k,this.format=C,this.resultMetadata=null,A==null?this.timestamp=y.currentTimeMillis():this.timestamp=A}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(m,g){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(m,g)}putAllMetadata(m){m!==null&&(this.resultMetadata===null?this.resultMetadata=m:this.resultMetadata=new Map(m))}addResultPoints(m){const g=this.resultPoints;if(g===null)this.resultPoints=m;else if(m!==null&&m.length>0){const v=new Array(g.length+m.length);y.arraycopy(g,0,v,0,g.length),y.arraycopy(m,0,v,g.length,m.length),this.resultPoints=v}}getTimestamp(){return this.timestamp}toString(){return this.text}}var G;
2710(function(te){te[te.AZTEC=0]="AZTEC",te[te.CODABAR=1]="CODABAR",te[te.CODE_39=2]="CODE_39",te[te.CODE_93=3]="CODE_93",te[te.CODE_128=4]="CODE_128",te[te.DATA_MATRIX=5]="DATA_MATRIX",te[te.EAN_8=6]="EAN_8",te[te.EAN_13=7]="EAN_13",te[te.ITF=8]="ITF",te[te.MAXICODE=9]="MAXICODE",te[te.PDF_417=10]="PDF_417",te[te.QR_CODE=11]="QR_CODE",te[te.RSS_14=12]="RSS_14",te[te.RSS_EXPANDED=13]="RSS_EXPANDED",te[te.UPC_A=14]="UPC_A",te[te.UPC_E=15]="UPC_E",te[te.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(G||(G={}));var se=G,ce;(function(te){te[te.OTHER=0]="OTHER",te[te.ORIENTATION=1]="ORIENTATION",te[te.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",te[te.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",te[te.ISSUE_NUMBER=4]="ISSUE_NUMBER",te[te.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",te[te.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",te[te.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",te[te.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",te[te.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",te[te.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(ce||(ce={}));var le=ce;class fe{constructor(m,g,v,k,C=-1,A=-1){this.rawBytes=m,this.text=g,this.byteSegments=v,this.ecLevel=k,this.structuredAppendSequenceNumber=C,this.structuredAppendParity=A,this.numBits=m==null?0:8*m.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(m){this.numBits=m}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(m){this.errorsCorrected=m}getErasures(){return this.erasures}setErasures(m){this.erasures=m}getOther(){return this.other}setOther(m){this.other=m}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class be{exp(m){return this.expTable[m]}log(m){if(m===0)throw new f;return this.logTable[m]}static addOrSubtract(m,g){return m^g}}class _e{constructor(m,g){if(g.length===0)throw new f;this.field=m;const v=g.length;if(v>1&&g[0]===0){let k=1;for(;k<v&&g[k]===0;)k++;k===v?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(v-k),y.arraycopy(g,k,this.coefficients,0,this.coefficients.length))}else this.coefficients=g}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(m){return this.coefficients[this.coefficients.length-1-m]}evaluateAt(m){if(m===0)return this.getCoefficient(0);const g=this.coefficients;let v;if(m===1){v=0;for(let A=0,I=g.length;A!==I;A++){const $=g[A];v=be.addOrSubtract(v,$)}return v}v=g[0];const k=g.length,C=this.field;for(let A=1;A<k;A++)v=be.addOrSubtract(C.multiply(m,v),g[A]);return v}addOrSubtract(m){if(!this.field.equals(m.field))throw new f("GenericGFPolys do not have same GenericGF field");if(this.isZero())return m;if(m.isZero())return this;let g=this.coefficients,v=m.coefficients;if(g.length>v.length){const A=g;g=v,v=A}let k=new Int32Array(v.length);const C=v.length-g.length;y.arraycopy(v,0,k,0,C);for(let A=C;A<v.length;A++)k[A]=be.addOrSubtract(g[A-C],v[A]);return new _e(this.field,k)}multiply(m){if(!this.field.equals(m.field))throw new f("GenericGFPolys do not have same GenericGF field");if(this.isZero()||m.isZero())return this.field.getZero();const g=this.coefficients,v=g.length,k=m.coefficients,C=k.length,A=new Int32Array(v+C-1),I=this.field;for(let $=0;$<v;$++){const V=g[$];for(let X=0;X<C;X++)A[$+X]=be.addOrSubtract(A[$+X],I.multiply(V,k[X]))}return new _e(I,A)}multiplyScalar(m){if(m===0)return this.field.getZero();if(m===1)return this;const g=this.coefficients.length,v=this.field,k=new Int32Array(g),C=this.coefficients;for(let A=0;A<g;A++)k[A]=v.multiply(C[A],m);return new _e(v,k)}multiplyByMonomial(m,g){if(m<0)throw new f;if(g===0)return this.field.getZero();const v=this.coefficients,k=v.length,C=new Int32Array(k+m),A=this.field;for(let I=0;I<k;I++)C[I]=A.multiply(v[I],g);return new _e(A,C)}divide(m){if(!this.field.equals(m.field))throw new f("GenericGFPolys do n
2710ot have same GenericGF field");if(m.isZero())throw new f("Divide by 0");const g=this.field;let v=g.getZero(),k=this;const C=m.getCoefficient(m.getDegree()),A=g.inverse(C);for(;k.getDegree()>=m.getDegree()&&!k.isZero();){const I=k.getDegree()-m.getDegree(),$=g.multiply(k.getCoefficient(k.getDegree()),A),V=m.multiplyByMonomial(I,$),X=g.buildMonomial(I,$);v=v.addOrSubtract(X),k=k.addOrSubtract(V)}return[v,k]}toString(){let m="";for(let g=this.getDegree();g>=0;g--){let v=this.getCoefficient(g);if(v!==0){if(v<0?(m+=" - ",v=-v):m.length>0&&(m+=" + "),g===0||v!==1){const k=this.field.log(v);k===0?m+="1":k===1?m+="a":(m+="a^",m+=k)}g!==0&&(g===1?m+="x":(m+="x^",m+=g))}}return m}}class pe extends u{}pe.kind="ArithmeticException";class Te extends be{constructor(m,g,v){super(),this.primitive=m,this.size=g,this.generatorBase=v;const k=new Int32Array(g);let C=1;for(let I=0;I<g;I++)k[I]=C,C*=2,C>=g&&(C^=m,C&=g-1);this.expTable=k;const A=new Int32Array(g);for(let I=0;I<g-1;I++)A[k[I]]=I;this.logTable=A,this.zero=new _e(this,Int32Array.from([0])),this.one=new _e(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(m,g){if(m<0)throw new f;if(g===0)return this.zero;const v=new Int32Array(m+1);return v[0]=g,new _e(this,v)}inverse(m){if(m===0)throw new pe;return this.expTable[this.size-this.logTable[m]-1]}multiply(m,g){return m===0||g===0?0:this.expTable[(this.logTable[m]+this.logTable[g])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+j.toHexString(this.primitive)+","+this.size+")"}equals(m){return m===this}}Te.AZTEC_DATA_12=new Te(4201,4096,1),Te.AZTEC_DATA_10=new Te(1033,1024,1),Te.AZTEC_DATA_6=new Te(67,64,1),Te.AZTEC_PARAM=new Te(19,16,1),Te.QR_CODE_FIELD_256=new Te(285,256,0),Te.DATA_MATRIX_FIELD_256=new Te(301,256,1),Te.AZTEC_DATA_8=Te.DATA_MATRIX_FIELD_256,Te.MAXICODE_FIELD_64=Te.AZTEC_DATA_6;class Ge extends u{}Ge.kind="ReedSolomonException";class Ne extends u{}Ne.kind="IllegalStateException";class it{constructor(m){this.field=m}decode(m,g){const v=this.field,k=new _e(v,m),C=new Int32Array(g);let A=!0;for(let he=0;he<g;he++){const ye=k.evaluateAt(v.exp(he+v.getGeneratorBase()));C[C.length-1-he]=ye,ye!==0&&(A=!1)}if(A)return;const I=new _e(v,C),$=this.runEuclideanAlgorithm(v.buildMonomial(g,1),I,g),V=$[0],X=$[1],ne=this.findErrorLocations(V),ie=this.findErrorMagnitudes(X,ne);for(let he=0;he<ne.length;he++){const ye=m.length-1-v.log(ne[he]);if(ye<0)throw new Ge("Bad error location");m[ye]=Te.addOrSubtract(m[ye],ie[he])}}runEuclideanAlgorithm(m,g,v){if(m.getDegree()<g.getDegree()){const he=m;m=g,g=he}const k=this.field;let C=m,A=g,I=k.getZero(),$=k.getOne();for(;A.getDegree()>=(v/2|0);){let he=C,ye=I;if(C=A,I=$,C.isZero())throw new Ge("r_{i-1} was zero");A=he;let ve=k.getZero();const Ce=C.getCoefficient(C.getDegree()),Me=k.inverse(Ce);for(;A.getDegree()>=C.getDegree()&&!A.isZero();){const tt=A.getDegree()-C.getDegree(),rt=k.multiply(A.getCoefficient(A.getDegree()),Me);ve=ve.addOrSubtract(k.buildMonomial(tt,rt)),A=A.addOrSubtract(C.multiplyByMonomial(tt,rt))}if($=ve.multiply(I).addOrSubtract(ye),A.getDegree()>=C.getDegree())throw new Ne("Division algorithm failed to reduce polynomial?")}const V=$.getCoefficient(0);if(V===0)throw new Ge("sigmaTilde(0) was zero");const X=k.inverse(V),ne=$.multiplyScalar(X),ie=A.multiplyScalar(X);return[ne,ie]}findErrorLocations(m){const g=m.getDegree();if(g===1)return Int32Array.from([m.getCoefficient(1)]);const v=new Int32Array(g);let k=0;const C=this.field;for(let A=1;A<C.getSize()&&k<g;A++)m.evaluateAt(A)===0&&(v[k]=C.inverse(A),k++);if(k!==g)throw new Ge("Error locator degree does not match number of roots");return v}findErrorMagnitudes(m,g){const v=g.length,k=new Int32Array(v),C=this.field;for(let A=0;A<v;A++){const I=C.inverse(g[A]);let $=1;for(let V=0;V<v;V++)if(A!==V){const X=C.multiply(g[V],I),ne=X&1?X&-2:X|1;$=C.multiply($,ne)}k[A]=C.multiply(m.evaluateAt(I),C.inverse($)),C.getGeneratorBase()!==0&&(k[A]=C.multiply(k[A],I))}return k}}var qe;(function(te){te[te.UPPER=0]="UPPER",te[te.LOWER=1]="LOWER",te[te.MIXED=2]="MIXED",te[te.DIGIT=3]="DIGIT",te[te.PUNCT=4]="PUNCT",te[te.BINARY=5]="BINARY"})(qe||(qe={}));class Qe{decode(m){this.ddata=m;let g=m.getBits(),v=this.extractBits(g),k=this.correctBits(v),C=Qe.convertBoolArrayToByteArray(k),A=Qe.getEncodedData(k),I=new fe(C,A,null,null);return I.setNumBits(k.length),I}static highLevelDecode(m){return this.getEncodedData(m)}static getEncodedData(m){let g=m.length,v=qe.UPPER,k=qe.UPPER,C="",A=0;for(;A<g;)if(k===qe.BINARY){if(g-A<5)break;let I=Qe.readCode(m,A,5);if(A+=5,I===0){if(g-A<11)break;I=Qe.readCode(m,A,11)+31,A+=11}for(let $=0;$<I;$++){if(g-A<8){A=g;break}const V=Qe.readCode(m,A,8);C+=M.castAsNonUtf8Char(V),A+=8}k=v}else{let I=k===qe.DIGIT?4:5;if(g-A<I)break;let $=Qe.readCode(m,A,I);A+=I;let V=Qe.getCharacter(k,$);
vendor: 13,688 bytes, lines 2710-2712
2710V.startsWith("CTRL_")?(v=k,k=Qe.getTable(V.charAt(5)),V.charAt(6)==="L"&&(v=k)):(C+=V,k=v)}return C}static getTable(m){switch(m){case"L":return qe.LOWER;case"P":return qe.PUNCT;case"M":return qe.MIXED;case"D":return qe.DIGIT;case"B":return qe.BINARY;case"U":default:return qe.UPPER}}static getCharacter(m,g){switch(m){case qe.UPPER:return Qe.UPPER_TABLE[g];case qe.LOWER:return Qe.LOWER_TABLE[g];case qe.MIXED:return Qe.MIXED_TABLE[g];case qe.PUNCT:return Qe.PUNCT_TABLE[g];case qe.DIGIT:return Qe.DIGIT_TABLE[g];default:throw new Ne("Bad table")}}correctBits(m){let g,v;this.ddata.getNbLayers()<=2?(v=6,g=Te.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(v=8,g=Te.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(v=10,g=Te.AZTEC_DATA_10):(v=12,g=Te.AZTEC_DATA_12);let k=this.ddata.getNbDatablocks(),C=m.length/v;if(C<k)throw new P;let A=m.length%v,I=new Int32Array(C);for(let ie=0;ie<C;ie++,A+=v)I[ie]=Qe.readCode(m,A,v);try{new it(g).decode(I,C-k)}catch(ie){throw new P(ie)}let $=(1<<v)-1,V=0;for(let ie=0;ie<k;ie++){let he=I[ie];if(he===0||he===$)throw new P;(he===1||he===$-1)&&V++}let X=new Array(k*v-V),ne=0;for(let ie=0;ie<k;ie++){let he=I[ie];if(he===1||he===$-1)X.fill(he>1,ne,ne+v-1),ne+=v-1;else for(let ye=v-1;ye>=0;--ye)X[ne++]=(he&1<<ye)!==0}return X}extractBits(m){let g=this.ddata.isCompact(),v=this.ddata.getNbLayers(),k=(g?11:14)+v*4,C=new Int32Array(k),A=new Array(this.totalBitsInLayer(v,g));if(g)for(let I=0;I<C.length;I++)C[I]=I;else{let I=k+1+2*j.truncDivision(j.truncDivision(k,2)-1,15),$=k/2,V=j.truncDivision(I,2);for(let X=0;X<$;X++){let ne=X+j.truncDivision(X,15);C[$-X-1]=V-ne-1,C[$+X]=V+ne+1}}for(let I=0,$=0;I<v;I++){let V=(v-I)*4+(g?9:12),X=I*2,ne=k-1-X;for(let ie=0;ie<V;ie++){let he=ie*2;for(let ye=0;ye<2;ye++)A[$+he+ye]=m.get(C[X+ye],C[X+ie]),A[$+2*V+he+ye]=m.get(C[X+ie],C[ne-ye]),A[$+4*V+he+ye]=m.get(C[ne-ye],C[ne-ie]),A[$+6*V+he+ye]=m.get(C[ne-ie],C[X+ye])}$+=V*8}return A}static readCode(m,g,v){let k=0;for(let C=g;C<g+v;C++)k<<=1,m[C]&&(k|=1);return k}static readByte(m,g){let v=m.length-g;return v>=8?Qe.readCode(m,g,8):Qe.readCode(m,g,v)<<8-v}static convertBoolArrayToByteArray(m){let g=new Uint8Array((m.length+7)/8);for(let v=0;v<g.length;v++)g[v]=Qe.readByte(m,8*v);return g}totalBitsInLayer(m,g){return((g?88:112)+16*m)*m}}Qe.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],Qe.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],Qe.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b","	",`
2711`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],Qe.PUNCT_TABLE=["","\r",`\r
2712`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],Qe.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class ot{constructor(){}static round(m){return m===NaN?0:m<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:m>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:m+(m<0?-.5:.5)|0}static distance(m,g,v,k){const C=m-v,A=g-k;return Math.sqrt(C*C+A*A)}static sum(m){let g=0;for(let v=0,k=m.length;v!==k;v++){const C=m[v];g+=C}return g}}class de{static floatToIntBits(m){return m}}de.MAX_VALUE=Number.MAX_SAFE_INTEGER;class me{constructor(m,g){this.x=m,this.y=g}getX(){return this.x}getY(){return this.y}equals(m){if(m instanceof me){const g=m;return this.x===g.x&&this.y===g.y}return!1}hashCode(){return 31*de.floatToIntBits(this.x)+de.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(m){const g=this.distance(m[0],m[1]),v=this.distance(m[1],m[2]),k=this.distance(m[0],m[2]);let C,A,I;if(v>=g&&v>=k?(A=m[0],C=m[1],I=m[2]):k>=v&&k>=g?(A=m[1],C=m[0],I=m[2]):(A=m[2],C=m[0],I=m[1]),this.crossProductZ(C,A,I)<0){const $=C;C=I,I=$}m[0]=C,m[1]=A,m[2]=I}static distance(m,g){return ot.distance(m.x,m.y,g.x,g.y)}static crossProductZ(m,g,v){const k=g.x,C=g.y;return(v.x-k)*(m.y-C)-(v.y-C)*(m.x-k)}}class ke{constructor(m,g){this.bits=m,this.points=g}getBits(){return this.bits}getPoints(){return this.points}}class Be extends ke{constructor(m,g,v,k,C){super(m,g),this.compact=v,this.nbDatablocks=k,this.nbLayers=C}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class Ae{constructor(m,g,v,k){this.image=m,this.height=m.getHeight(),this.width=m.getWidth(),g==null&&(g=Ae.INIT_SIZE),v==null&&(v=m.getWidth()/2|0),k==null&&(k=m.getHeight()/2|0);const C=g/2|0;if(this.leftInit=v-C,this.rightInit=v+C,this.upInit=k-C,this.downInit=k+C,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new F}detect(){let m=this.leftInit,g=this.rightInit,v=this.upInit,k=this.downInit,C=!1,A=!0,I=!1,$=!1,V=!1,X=!1,ne=!1;const ie=this.width,he=this.height;for(;A;){A=!1;let ye=!0;for(;(ye||!$)&&g<ie;)ye=this.containsBlackPoint(v,k,g,!1),ye?(g++,A=!0,$=!0):$||g++;if(g>=ie){C=!0;break}let ve=!0;for(;(ve||!V)&&k<he;)ve=this.containsBlackPoint(m,g,k,!0),ve?(k++,A=!0,V=!0):V||k++;if(k>=he){C=!0;break}let Ce=!0;for(;(Ce||!X)&&m>=0;)Ce=this.containsBlackPoint(v,k,m,!1),Ce?(m--,A=!0,X=!0):X||m--;if(m<0){C=!0;break}let Me=!0;for(;(Me||!ne)&&v>=0;)Me=this.containsBlackPoint(m,g,v,!0),Me?(v--,A=!0,ne=!0):ne||v--;if(v<0){C=!0;break}A&&(I=!0)}if(!C&&I){const ye=g-m;let ve=null;for(let rt=1;ve===null&&rt<ye;rt++)ve=this.getBlackPointOnSegment(m,k-rt,m+rt,k);if(ve==null)throw new F;let Ce=null;for(let rt=1;Ce===null&&rt<ye;rt++)Ce=this.getBlackPointOnSegment(m,v+rt,m+rt,v);if(Ce==null)throw new F;let Me=null;for(let rt=1;Me===null&&rt<ye;rt++)Me=this.getBlackPointOnSegment(g,v+rt,g-rt,v);if(Me==null)throw new F;let tt=null;for(let rt=1;tt===null&&rt<ye;rt++)tt=this.getBlackPointOnSegment(g,k-rt,g-rt,k);if(tt==null)throw new F;return this.centerEdges(tt,ve,Me,Ce)}else throw new F}getBlackPointOnSegment(m,g,v,k){const C=ot.round(ot.distance(m,g,v,k)),A=(v-m)/C,I=(k-g)/C,$=this.image;for(let V=0;V<C;V++){const X=ot.round(m+V*A),ne=ot.round(g+V*I);if($.get(X,ne))return new me(X,ne)}return null}centerEdges(m,g,v,k){const C=m.getX(),A=m.getY(),I=g.getX(),$=g.getY(),V=v.getX(),X=v.getY(),ne=k.getX(),ie=k.getY(),he=Ae.CORR;return C<this.width/2?[new me(ne-he,ie+he),new me(I+he,$+he),new me(V-he,X-he),new me(C+he,A-he)]:[new me(ne+he,ie+he),new me(I+he,$-he),new me(V-he,X+he),new me(C-he,A-he)]}containsBlackPoint(m,g,v,k){const C=this.image;if(k){for(let A=m;A<=g;A++)if(C.get(A,v))return!0}else for(let A=m;A<=g;A++)if(C.get(v,A))return!0;return!1}}Ae.INIT_SIZE=10,Ae.CORR=1;class $e{static checkAndNudgePoints(m,g){const v=m.getWidth(),k=m.getHeight();let C=!0;for(let A=0;A<g.length&&C;A+=2){const I=Math.floor(g[A]),$=Math.floor(g[A+1]);if(I<-1||I>v||$<-1||$>k)throw new F;C=!1,I===-1?(g[A]=0,C=!0):I===v&&(g[A]=v-1,C=!0),$===-1?(g[A+1]=0,C=!0):$===k&&(g[A+1]=k-1,C=!0)}C=!0;for(let A=g.length-2;A>=0&&C;A-=2){const I=Math.floor(g[A]),$=Math.floor(g[A+1]);if(I<-1||I>v||$<-1||$>k)throw new F;C=!1,I===-1?(g[A]=0,C=!0):I===v&&(g[A]=v-1,C=!0),$===-1?(g[A+1]=0,C=!0):$===k&&(g[A+1]=k-1,C=!0)}}}class ge{constructor(m,g,v,k,C,A,I,$,V){this.a11=m,this.a21=g,this.a31=v,this.a12=k,this.a22=C,this.a32=A,this.a13=I,this.a23=$,this.a33=V}static quadrilateralToQuadrilateral(m,g,v,k,C,A,I,$,V,X,ne,ie,he,ye,ve,Ce){const Me=ge.quadrilateralToSquare(m,g,v,k,C,A,I,$);return ge.squareToQuadrilateral(V,X,ne,ie,he,ye,ve,Ce).times(Me)}transformPoints(m){const g=m.length,v=this.a11,k=this.a12,C=this.a13,A=this.a21,I=this.a22,$=this.a23,V=this.a31,X=this.a32,ne=this.a33;for(let ie=0;ie<g;ie+=2){const he=m[ie],ye=m[ie+1],ve=C*he+$*ye+ne;m[ie]=(v*he+A*ye+V)/ve,m[ie+1]=(k*he+I*ye+X)/ve}}transformPointsWithValues(m,g){const v=this.a11,k=this.a12,C=this.a13,A=this.a21,I=this.a22,$=this.a23,V=this.a31,X=this.a32,ne=this.a33,ie=m.length;for(let he=0;he<ie;he++){const ye=m[he],ve=g[he],Ce=C*ye+$*ve+ne;m[he]=(v*ye+A*ve+V)/Ce,g[he]=(k*ye+I*ve+X)/Ce}}static squareToQuadrilateral(m,g,v,k,C,A,I,$){const V=m-v+C-I,X=g-k+A-$;if(V===0&&X===0)return new ge(v-m,C-v,m,k-g,A-k,g,0,0,1);{const ne=v-C,ie=I-C,he=k-A,ye=$-A,ve=ne*ye-ie*he,Ce=(V*ye-ie*X)/ve,Me=(ne*X-V*he)/ve;return new ge(v-m+Ce*v,I-m+Me*I,m,k-g+Ce*k,$-g+Me*$,g,Ce,Me,1)}}static quadrilateralToSquare(m,g,v,k,C,A,I,$){return ge.squareToQuadrilateral(m,g,v,k,C,A,I,$).buildAdjoint()}buildAdjoint(){return new ge(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)}times(m){return new ge(this.a11*m.a11+this.a21*m.a12+this.a31*m.a13,this.a11*m.a21+this.a21*m.a22+this.a31*m.a23,this.a11*m.a31+this.a21*m.a32+this.a31*m.a33,this.a12*m.a11+this.a22*m.a12+this.a32*m.a13,this.a12*m.a21+this.a22*m.a22+this.a32*m.a23,this.a12*m.a31+this.a22*m.a32+this.a32*m.a33,this.a13*m.a11+this.a23*m.a12+this.a33*m.a13,this.a13*m.a21+this.a23*m.a22+this.a33*m.a23,this.a13*m.a31+this.a23*m.a32+this.a33*m.a33)}}class Le extends $e{sampleGrid(m,g,v,k,C,A,I,$,V,X,ne,ie,he,ye,ve,Ce,Me,tt,rt){const Xe=ge.quadrilateralToQuadrilateral(k,C,A,I,$,V,X,ne,ie,he,ye,ve,Ce,Me,tt,rt);return this.sampleGridWithTransform(m,g,v,Xe)}sampleGridWithTransform(m,g,v,k){if(g<=0||v<=0)throw new F;const C=new U(g,v),A=new Float32Array(2*g);for(let I=0;I<v;I++){const $=A.length,V=I+.5;for(let X=0;X<$;X+=2)A[X]=X/2+.5,A[X+1]=V;k.transformPoints(A),$e.checkAndNudgePoints(m,A);try{for(let X=0;X<$;X+=2)m.get(Math.floor(A[X]),Math.floor(A[X+1]))&&C.set(X/2,I)}catch{throw new F}}return C}}class Ve{static setGridSampler(m){Ve.gridSampler=m}static getInstance(){return Ve.gridSampler}}Ve.gridSampler=new Le;class ct{constructor(m,g){this.x=m,this.y=g}toResultPoint(){return new me(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class yt{constructor(m){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=m}detect(){return this.detectMirror(!1)}detectMirror(m){let g=this.getMatrixCenter(),v=this.getBullsEyeCorners(g);if(m){let A=v[0];v[0]=v[2],v[2]=A}this.extractParameters(v);let k=this.sampleGrid(this.image,v[this.shift%4],v[(this.shift+1)%4],v[(this.shift+2)%4],v[(this.shift+3)%4]),C=this.getMatrixCornerPoints(v);return new Be(k,C,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(m){if(!this.isValidPoint(m[0])||!this.isValidPoint(m[1])||!this.isValidPoint(m[2])||!this.isValidPoint(m[3]))throw new F;let g=2*this.nbCenterLayers,v=new Int32Array([this.sampleLine(m[0],m[1],g),this.sampleLine(m[1],m[2],g),this.sampleLine(m[2],m[3],g),this.sampleLine(m[3],m[0],g)]);this.shift=this.getRotation(v,g);let k=0;for(let A=0;A<4;A++){let I=v[(this.shift+A)%4];this.compact?(k<<=7,k+=I>>1&127):(k<<=10,k+=(I>>2&992)+(I>>1&31))}let C=this.getCorrectedParameterData(k,this.compact);this.compact?(this.nbLayers=(C>>6)+1,this.nbDataBlocks=(C&63)+1):(this.nbLayers=(C>>11)+1,this.nbDataBlocks=(C&2047)+1)}getRotation(m,g){let v=0;m.forEach((k,C,A)=>{let I=(k>>g-2<<1)+(k&1);v=(v<<3)+I}),v=((v&1)<<11)+(v>>1);for(let k=0;k<4;k++)if(j.bitCount(v^this.EXPECTED_CORNER_BITS[k])<=2)return k;throw new F}getCorrectedParameterData(m,g){let v,k;g?(v=7,k=2):(v=10,k=4);let C=v-k,A=new Int32Array(v);for(let $=v-1;$>=0;--$)A[$]=m&15,m>>=4;try{new it(Te.AZTEC_PARAM).decode(A,C)}catch{throw new F}let I=0;for(let $=0;$<k;$++)I=(I<<4)+A[$];return I}getBullsEyeCorners(m){let g=m,v=m,k=m,C=m,A=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let ne=this.getFirstDifferent(g,A,1,-1),ie=this.getFirstDifferent(v,A,1,1),he=this.getFirstDifferent(k,A,-1,1),ye=this.getFirstDifferent(C,A,-1,-1);if(this.nbCenterLayers>2){let ve=this.distancePoint(ye,ne)*this.nbCenterLayers/(this.distancePoint(C,g)*(this.nbCenterLayers+2));if(ve<.75||ve>1.25||!this.isWhiteOrBlackRectangle(ne,ie,he,ye))break}g=ne,v=ie,k=he,C=ye,A=!A}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new F;this.compact=this.nbCenterLayers===5;let I=new me(g.getX()+.5,g.getY()-.5),$=new me(v.getX()+.5,v.getY()+.5),V=new me(k.getX()-.5,k.getY()+.5),X=new me(C.getX()-.5,C.getY()-.5);return this.expandSquare([I,$,V,X],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let m,g,v,k;try{let I=new Ae(this.image).detect();m=I[0],g=I[1],v=I[2],k=I[3]}catch{let $=this.image.getWidth()/2,V=this.image.getHeight()/2;m=this.getFirstDifferent(new ct($+7,V-7),!1,1,-1).toResultPoint(),g=this.getFirstDifferent(new ct($+7,V+7),!1,1,1).toResultPoint(),v=this.getFirstDifferent(new ct($-7,V+7),!1,-1,1).toResultPoint(),k=this.getFirstDifferent(new ct($-7,V-7),!1,-1,-1).toResultPoint()}let C=ot.round((m.getX()+k.getX()+g.getX()+v.getX())/4),A=ot.round((m.getY()+k.getY()+g.getY()+v.getY())/4);try{let I=new Ae(this.image,15,C,A).detect();m=I[0],g=I[1],v=I[2],k=I[3]}catch{m=this.getFirstDifferent(new ct(C+7,A-7),!1,1,-1).toResultPoint(),g=this.getFirstDifferent(new ct(C+7,A+7),!1,1,1).toResultPoint(),v=this.getFirstDifferent(new ct(C-7,A+7),!1,-1,1).toResultPoint(),k=this.getFirstDifferent(new ct(C-7,A-7),!1,-1,-1).toResultPoint()}return C=ot.round((m.getX()+k.getX()+g.getX()+v.getX())/4),A=ot.round((m.getY()+k.getY()+g.getY()+v.getY())/4),new ct(C,A)}getMatrixCornerPoints(m){return this.expandSquare(m,2*this.nbCenterLayers,this.getDimension())}sampleGrid(m,g,v,k,C){let A=Ve.getInstance(),I=this.getDimension(),$=I/2-this.nbCenterLayers,V=I/2+this.nbCenterLayers;
2712return A.sampleGrid(m,I,I,$,$,V,$,V,V,$,V,g.getX(),g.getY(),v.getX(),v.getY(),k.getX(),k.getY(),C.getX(),C.getY())}sampleLine(m,g,v){let k=0,C=this.distanceResultPoint(m,g),A=C/v,I=m.getX(),$=m.getY(),V=A*(g.getX()-m.getX())/C,X=A*(g.getY()-m.getY())/C;for(let ne=0;ne<v;ne++)this.image.get(ot.round(I+ne*V),ot.round($+ne*X))&&(k|=1<<v-ne-1);return k}isWhiteOrBlackRectangle(m,g,v,k){let C=3;m=new ct(m.getX()-C,m.getY()+C),g=new ct(g.getX()-C,g.getY()-C),v=new ct(v.getX()+C,v.getY()-C),k=new ct(k.getX()+C,k.getY()+C);let A=this.getColor(k,m);if(A===0)return!1;let I=this.getColor(m,g);return I!==A||(I=this.getColor(g,v),I!==A)?!1:(I=this.getColor(v,k),I===A)}getColor(m,g){let v=this.distancePoint(m,g),k=(g.getX()-m.getX())/v,C=(g.getY()-m.getY())/v,A=0,I=m.getX(),$=m.getY(),V=this.image.get(m.getX(),m.getY()),X=Math.ceil(v);for(let ie=0;ie<X;ie++)I+=k,$+=C,this.image.get(ot.round(I),ot.round($))!==V&&A++;let ne=A/v;return ne>.1&&ne<.9?0:ne<=.1===V?1:-1}getFirstDifferent(m,g,v,k){let C=m.getX()+v,A=m.getY()+k;for(;this.isValid(C,A)&&this.image.get(C,A)===g;)C+=v,A+=k;for(C-=v,A-=k;this.isValid(C,A)&&this.image.get(C,A)===g;)C+=v;for(C-=v;this.isValid(C,A)&&this.image.get(C,A)===g;)A+=k;return A-=k,new ct(C,A)}expandSquare(m,g,v){let k=v/(2*g),C=m[0].getX()-m[2].getX(),A=m[0].getY()-m[2].getY(),I=(m[0].getX()+m[2].getX())/2,$=(m[0].getY()+m[2].getY())/2,V=new me(I+k*C,$+k*A),X=new me(I-k*C,$-k*A);C=m[1].getX()-m[3].getX(),A=m[1].getY()-m[3].getY(),I=(m[1].getX()+m[3].getX())/2,$=(m[1].getY()+m[3].getY())/2;let ne=new me(I+k*C,$+k*A),ie=new me(I-k*C,$-k*A);return[V,ne,X,ie]}isValid(m,g){return m>=0&&m<this.image.getWidth()&&g>0&&g<this.image.getHeight()}isValidPoint(m){let g=ot.round(m.getX()),v=ot.round(m.getY());return this.isValid(g,v)}distancePoint(m,g){return ot.distance(m.getX(),m.getY(),g.getX(),g.getY())}distanceResultPoint(m,g){return ot.distance(m.getX(),m.getY(),g.getX(),g.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(j.truncDivision(this.nbLayers-4,8)+1)+15}}class nn{decode(m,g=null){let v=null,k=new yt(m.getBlackMatrix()),C=null,A=null;try{let X=k.detectMirror(!1);C=X.getPoints(),this.reportFoundResultPoints(g,C),A=new Qe().decode(X)}catch(X){v=X}if(A==null)try{let X=k.detectMirror(!0);C=X.getPoints(),this.reportFoundResultPoints(g,C),A=new Qe().decode(X)}catch(X){throw v??X}let I=new Z(A.getText(),A.getRawBytes(),A.getNumBits(),C,se.AZTEC,y.currentTimeMillis()),$=A.getByteSegments();$!=null&&I.putMetadata(le.BYTE_SEGMENTS,$);let V=A.getECLevel();return V!=null&&I.putMetadata(le.ERROR_CORRECTION_LEVEL,V),I}reportFoundResultPoints(m,g){if(m!=null){let v=m.get(T.NEED_RESULT_POINT_CALLBACK);v!=null&&g.forEach((k,C,A)=>{v.foundPossibleResultPoint(k)})}}reset(){}}class Vn extends Y{constructor(m=500){super(new nn,m)}}class zt{decode(m,g){try{return this.doDecode(m,g)}catch{if(g&&g.get(T.TRY_HARDER)===!0&&m.isRotateSupported()){const C=m.rotateCounterClockwise(),A=this.doDecode(C,g),I=A.getResultMetadata();let $=270;I!==null&&I.get(le.ORIENTATION)===!0&&($=$+I.get(le.ORIENTATION)%360),A.putMetadata(le.ORIENTATION,$);const V=A.getResultPoints();if(V!==null){const X=C.getHeight();for(let ne=0;ne<V.length;ne++)V[ne]=new me(X-V[ne].getY()-1,V[ne].getX())}return A}else throw new F}}reset(){}doDecode(m,g){const v=m.getWidth(),k=m.getHeight();let C=new E(v);const A=g&&g.get(T.TRY_HARDER)===!0,I=Math.max(1,k>>(A?8:5));let $;A?$=k:$=15;const V=Math.trunc(k/2);for(let X=0;X<$;X++){const ne=Math.trunc((X+1)/2),ie=(X&1)===0,he=V+I*(ie?ne:-ne);if(he<0||he>=k)break;try{C=m.getBlackRow(he,C)}catch{continue}for(let ye=0;ye<2;ye++){if(ye===1&&(C.reverse(),g&&g.get(T.NEED_RESULT_POINT_CALLBACK)===!0)){const ve=new Map;g.forEach((Ce,Me)=>ve.set(Me,Ce)),ve.delete(T.NEED_RESULT_POINT_CALLBACK),g=ve}try{const ve=this.decodeRow(he,C,g);if(ye===1){ve.putMetadata(le.ORIENTATION,180);const Ce=ve.getResultPoints();Ce!==null&&(Ce[0]=new me(v-Ce[0].getX()-1,Ce[0].getY()),Ce[1]=new me(v-Ce[1].getX()-1,Ce[1].getY()))}return ve}catch{}}}throw new F}static recordPattern(m,g,v){const k=v.length;for(let V=0;V<k;V++)v[V]=0;const C=m.getSize();if(g>=C)throw new F;let A=!m.get(g),I=0,$=g;for(;$<C;){if(m.get($)!==A)v[I]++;else{if(++I===k)break;v[I]=1,A=!A}$++}if(!(I===k||I===k-1&&$===C))throw new F}static recordPatternInReverse(m,g,v){let k=v.length,C=m.get(g);for(;g>0&&k>=0;)m.get(--g)!==C&&(k--,C=!C);if(k>=0)throw new F;zt.recordPattern(m,g+1,v)}static patternMatchVariance(m,g,v){const k=m.length;let C=0,A=0;for(let V=0;V<k;V++)C+=m[V],A+=g[V];if(C<A)return Number.POSITIVE_INFINITY;const I=C/A;v*=I;let $=0;for(let V=0;V<k;V++){const X=m[V],ne=g[V]*I,ie=X>ne?X-ne:ne-X;if(ie>v)return Number.POSITIVE_INFINITY;$+=ie}return $/C}}class He extends zt{static findStartPattern(m){const g=m.getSize(),v=m.getNextSet(0);let k=0,C=Int32Array.from([0,0,0,0,0,0]),A=v,I=!1;const $=6;for(let V=v;V<g;V++)if(m.get(V)!==I)C[k]++;else{if(k===$-1){let X=He.MAX_AVG_VARIANCE,ne=-1;for(let ie=He.CODE_START_A;ie<=He.CODE_START_C;ie++){const he=zt.patternMatchVariance(C,He.CODE_PATTERNS[ie],He.MAX_INDIVIDUAL_VARIA
2712NCE);he<X&&(X=he,ne=ie)}if(ne>=0&&m.isRange(Math.max(0,A-(V-A)/2),A,!1))return Int32Array.from([A,V,ne]);A+=C[0]+C[1],C=C.slice(2,C.length-1),C[k-1]=0,C[k]=0,k--}else k++;C[k]=1,I=!I}throw new F}static decodeCode(m,g,v){zt.recordPattern(m,v,g);let k=He.MAX_AVG_VARIANCE,C=-1;for(let A=0;A<He.CODE_PATTERNS.length;A++){const I=He.CODE_PATTERNS[A],$=this.patternMatchVariance(g,I,He.MAX_INDIVIDUAL_VARIANCE);$<k&&(k=$,C=A)}if(C>=0)return C;throw new F}decodeRow(m,g,v){const k=v&&v.get(T.ASSUME_GS1)===!0,C=He.findStartPattern(g),A=C[2];let I=0;const $=new Uint8Array(20);$[I++]=A;let V;switch(A){case He.CODE_START_A:V=He.CODE_CODE_A;break;case He.CODE_START_B:V=He.CODE_CODE_B;break;case He.CODE_START_C:V=He.CODE_CODE_C;break;default:throw new P}let X=!1,ne=!1,ie="",he=C[0],ye=C[1];const ve=Int32Array.from([0,0,0,0,0,0]);let Ce=0,Me=0,tt=A,rt=0,Xe=!0,Rn=!1,pn=!1;for(;!X;){const Dp=ne;switch(ne=!1,Ce=Me,Me=He.decodeCode(g,ve,ye),$[I++]=Me,Me!==He.CODE_STOP&&(Xe=!0),Me!==He.CODE_STOP&&(rt++,tt+=rt*Me),he=ye,ye+=ve.reduce((fhe,hhe)=>fhe+hhe,0),Me){case He.CODE_START_A:case He.CODE_START_B:case He.CODE_START_C:throw new P}switch(V){case He.CODE_CODE_A:if(Me<64)pn===Rn?ie+=String.fromCharCode(32+Me):ie+=String.fromCharCode(32+Me+128),pn=!1;else if(Me<96)pn===Rn?ie+=String.fromCharCode(Me-64):ie+=String.fromCharCode(Me+64),pn=!1;else switch(Me!==He.CODE_STOP&&(Xe=!1),Me){case He.CODE_FNC_1:k&&(ie.length===0?ie+="]C1":ie+="�");break;case He.CODE_FNC_2:case He.CODE_FNC_3:break;case He.CODE_FNC_4_A:!Rn&&pn?(Rn=!0,pn=!1):Rn&&pn?(Rn=!1,pn=!1):pn=!0;break;case He.CODE_SHIFT:ne=!0,V=He.CODE_CODE_B;break;case He.CODE_CODE_B:V=He.CODE_CODE_B;break;case He.CODE_CODE_C:V=He.CODE_CODE_C;break;case He.CODE_STOP:X=!0;break}break;case He.CODE_CODE_B:if(Me<96)pn===Rn?ie+=String.fromCharCode(32+Me):ie+=String.fromCharCode(32+Me+128),pn=!1;else switch(Me!==He.CODE_STOP&&(Xe=!1),Me){case He.CODE_FNC_1:k&&(ie.length===0?ie+="]C1":ie+="�");break;case He.CODE_FNC_2:case He.CODE_FNC_3:break;case He.CODE_FNC_4_B:!Rn&&pn?(Rn=!0,pn=!1):Rn&&pn?(Rn=!1,pn=!1):pn=!0;break;case He.CODE_SHIFT:ne=!0,V=He.CODE_CODE_A;break;case He.CODE_CODE_A:V=He.CODE_CODE_A;break;case He.CODE_CODE_C:V=He.CODE_CODE_C;break;case He.CODE_STOP:X=!0;break}break;case He.CODE_CODE_C:if(Me<100)Me<10&&(ie+="0"),ie+=Me;else switch(Me!==He.CODE_STOP&&(Xe=!1),Me){case He.CODE_FNC_1:k&&(ie.length===0?ie+="]C1":ie+="�");break;case He.CODE_CODE_A:V=He.CODE_CODE_A;break;case He.CODE_CODE_B:V=He.CODE_CODE_B;break;case He.CODE_STOP:X=!0;break}break}Dp&&(V=V===He.CODE_CODE_A?He.CODE_CODE_B:He.CODE_CODE_A)}const Ja=ye-he;if(ye=g.getNextUnset(ye),!g.isRange(ye,Math.min(g.getSize(),ye+(ye-he)/2),!1))throw new F;if(tt-=rt*Ce,tt%103!==Ce)throw new p;const ql=ie.length;if(ql===0)throw new F;ql>0&&Xe&&(V===He.CODE_CODE_C?ie=ie.substring(0,ql-2):ie=ie.substring(0,ql-1));const Za=(C[1]+C[0])/2,$r=he+Ja/2,Xi=$.length,Co=new Uint8Array(Xi);for(let Dp=0;Dp<Xi;Dp++)Co[Dp]=$[Dp];const Op=[new me(Za,m),new me($r,m)];return new Z(ie,Co,0,Op,se.CODE_128,new Date().getTime())}}He.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],He.MAX_A
2712VG_VARIANCE=.25,He.MAX_INDIVIDUAL_VARIANCE=.7,He.CODE_SHIFT=98,He.CODE_CODE_C=99,He.CODE_CODE_B=100,He.CODE_CODE_A=101,He.CODE_FNC_1=102,He.CODE_FNC_2=97,He.CODE_FNC_3=96,He.CODE_FNC_4_A=101,He.CODE_FNC_4_B=100,He.CODE_START_A=103,He.CODE_START_B=104,He.CODE_START_C=105,He.CODE_STOP=106;class bn extends zt{constructor(m=!1,g=!1){super(),this.usingCheckDigit=m,this.extendedMode=g,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(m,g,v){let k=this.counters;k.fill(0),this.decodeRowResult="";let C=bn.findAsteriskPattern(g,k),A=g.getNextSet(C[1]),I=g.getSize(),$,V;do{bn.recordPattern(g,A,k);let ve=bn.toNarrowWidePattern(k);if(ve<0)throw new F;$=bn.patternToChar(ve),this.decodeRowResult+=$,V=A;for(let Ce of k)A+=Ce;A=g.getNextSet(A)}while($!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let X=0;for(let ve of k)X+=ve;let ne=A-V-X;if(A!==I&&ne*2<X)throw new F;if(this.usingCheckDigit){let ve=this.decodeRowResult.length-1,Ce=0;for(let Me=0;Me<ve;Me++)Ce+=bn.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(Me));if(this.decodeRowResult.charAt(ve)!==bn.ALPHABET_STRING.charAt(Ce%43))throw new p;this.decodeRowResult=this.decodeRowResult.substring(0,ve)}if(this.decodeRowResult.length===0)throw new F;let ie;this.extendedMode?ie=bn.decodeExtended(this.decodeRowResult):ie=this.decodeRowResult;let he=(C[1]+C[0])/2,ye=V+X/2;return new Z(ie,null,0,[new me(he,m),new me(ye,m)],se.CODE_39,new Date().getTime())}static findAsteriskPattern(m,g){let v=m.getSize(),k=m.getNextSet(0),C=0,A=k,I=!1,$=g.length;for(let V=k;V<v;V++)if(m.get(V)!==I)g[C]++;else{if(C===$-1){if(this.toNarrowWidePattern(g)===bn.ASTERISK_ENCODING&&m.isRange(Math.max(0,A-Math.floor((V-A)/2)),A,!1))return[A,V];A+=g[0]+g[1],g.copyWithin(0,2,2+C-1),g[C-1]=0,g[C]=0,C--}else C++;g[C]=1,I=!I}throw new F}static toNarrowWidePattern(m){let g=m.length,v=0,k;do{let C=2147483647;for(let $ of m)$<C&&$>v&&(C=$);v=C,k=0;let A=0,I=0;for(let $=0;$<g;$++){let V=m[$];V>v&&(I|=1<<g-1-$,k++,A+=V)}if(k===3){for(let $=0;$<g&&k>0;$++){let V=m[$];if(V>v&&(k--,V*2>=A))return-1}return I}}while(k>3);return-1}static patternToChar(m){for(let g=0;g<bn.CHARACTER_ENCODINGS.length;g++)if(bn.CHARACTER_ENCODINGS[g]===m)return bn.ALPHABET_STRING.charAt(g);if(m===bn.ASTERISK_ENCODING)return"*";throw new F}static decodeExtended(m){let g=m.length,v="";for(let k=0;k<g;k++){let C=m.charAt(k);if(C==="+"||C==="$"||C==="%"||C==="/"){let A=m.charAt(k+1),I="\0";switch(C){case"+":if(A>="A"&&A<="Z")I=String.fromCharCode(A.charCodeAt(0)+32);else throw new P;break;case"$":if(A>="A"&&A<="Z")I=String.fromCharCode(A.charCodeAt(0)-64);else throw new P;break;case"%":if(A>="A"&&A<="E")I=String.fromCharCode(A.charCodeAt(0)-38);else if(A>="F"&&A<="J")I=String.fromCharCode(A.charCodeAt(0)-11);else if(A>="K"&&A<="O")I=String.fromCharCode(A.charCodeAt(0)+16);else if(A>="P"&&A<="T")I=String.fromCharCode(A.charCodeAt(0)+43);else if(A==="U")I="\0";else if(A==="V")I="@";else if(A==="W")I="`";else if(A==="X"||A==="Y"||A==="Z")I="�";else throw new P;break;case"/":if(A>="A"&&A<="O")I=String.fromCharCode(A.charCodeAt(0)-32);else if(A==="Z")I=":";else throw new P;break}v+=I,k++}else v+=C}return v}}bn.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",bn.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],bn.ASTERISK_ENCODING=148;class Rt extends zt{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(m,g,v){let k=this.decodeStart(g),C=this.decodeEnd(g),A=new B;Rt.decodeMiddle(g,k[1],C[0],A);let I=A.toString(),$=null;v!=null&&($=v.get(T.ALLOWED_LENGTHS)),$==null&&($=Rt.DEFAULT_ALLOWED_LENGTHS);let V=I.length,X=!1,ne=0;for(let ye of $){if(V===ye){X=!0;break}ye>ne&&(ne=ye)}if(!X&&V>ne&&(X=!0),!X)throw new P;const ie=[new me(k[1],m),new me(C[0],m)];return new Z(I,null,0,ie,se.ITF,new Date().getTime())}static decodeMiddle(m,g,v,k){let C=new Int32Array(10),A=new Int32Array(5),I=new Int32Array(5);for(C.fill(0),A.fill(0),I.fill(0);g<v;){zt.recordPattern(m,g,C);for(let V=0;V<5;V++){let X=2*V;A[V]=C[X],I[V]=C[X+1]}let $=Rt.decodeDigit(A);k.append($.toString()),$=this.decodeDigit(I),k.append($.toString()),C.forEac
vendor: 5,200 bytes, line 2712
2712h(function(V){g+=V})}}decodeStart(m){let g=Rt.skipWhiteSpace(m),v=Rt.findGuardPattern(m,g,Rt.START_PATTERN);return this.narrowLineWidth=(v[1]-v[0])/4,this.validateQuietZone(m,v[0]),v}validateQuietZone(m,g){let v=this.narrowLineWidth*10;v=v<g?v:g;for(let k=g-1;v>0&&k>=0&&!m.get(k);k--)v--;if(v!==0)throw new F}static skipWhiteSpace(m){const g=m.getSize(),v=m.getNextSet(0);if(v===g)throw new F;return v}decodeEnd(m){m.reverse();try{let g=Rt.skipWhiteSpace(m),v;try{v=Rt.findGuardPattern(m,g,Rt.END_PATTERN_REVERSED[0])}catch(C){C instanceof F&&(v=Rt.findGuardPattern(m,g,Rt.END_PATTERN_REVERSED[1]))}this.validateQuietZone(m,v[0]);let k=v[0];return v[0]=m.getSize()-v[1],v[1]=m.getSize()-k,v}finally{m.reverse()}}static findGuardPattern(m,g,v){let k=v.length,C=new Int32Array(k),A=m.getSize(),I=!1,$=0,V=g;C.fill(0);for(let X=g;X<A;X++)if(m.get(X)!==I)C[$]++;else{if($===k-1){if(zt.patternMatchVariance(C,v,Rt.MAX_INDIVIDUAL_VARIANCE)<Rt.MAX_AVG_VARIANCE)return[V,X];V+=C[0]+C[1],y.arraycopy(C,2,C,0,$-1),C[$-1]=0,C[$]=0,$--}else $++;C[$]=1,I=!I}throw new F}static decodeDigit(m){let g=Rt.MAX_AVG_VARIANCE,v=-1,k=Rt.PATTERNS.length;for(let C=0;C<k;C++){let A=Rt.PATTERNS[C],I=zt.patternMatchVariance(m,A,Rt.MAX_INDIVIDUAL_VARIANCE);I<g?(g=I,v=C):I===g&&(v=-1)}if(v>=0)return v%10;throw new F}}Rt.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],Rt.MAX_AVG_VARIANCE=.38,Rt.MAX_INDIVIDUAL_VARIANCE=.5,Rt.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],Rt.START_PATTERN=Int32Array.from([1,1,1,1]),Rt.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class An extends zt{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(m){let g=!1,v,k=0,C=Int32Array.from([0,0,0]);for(;!g;){C=Int32Array.from([0,0,0]),v=An.findGuardPattern(m,k,!1,this.START_END_PATTERN,C);let A=v[0];k=v[1];let I=A-(k-A);I>=0&&(g=m.isRange(I,A,!1))}return v}static checkChecksum(m){return An.checkStandardUPCEANChecksum(m)}static checkStandardUPCEANChecksum(m){let g=m.length;if(g===0)return!1;let v=parseInt(m.charAt(g-1),10);return An.getStandardUPCEANChecksum(m.substring(0,g-1))===v}static getStandardUPCEANChecksum(m){let g=m.length,v=0;for(let k=g-1;k>=0;k-=2){let C=m.charAt(k).charCodeAt(0)-48;if(C<0||C>9)throw new P;v+=C}v*=3;for(let k=g-2;k>=0;k-=2){let C=m.charAt(k).charCodeAt(0)-48;if(C<0||C>9)throw new P;v+=C}return(1e3-v)%10}static decodeEnd(m,g){return An.findGuardPattern(m,g,!1,An.START_END_PATTERN,new Int32Array(An.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(m,g,v,k){return this.findGuardPattern(m,g,v,k,new Int32Array(k.length))}static findGuardPattern(m,g,v,k,C){let A=m.getSize();g=v?m.getNextUnset(g):m.getNextSet(g);let I=0,$=g,V=k.length,X=v;for(let ne=g;ne<A;ne++)if(m.get(ne)!==X)C[I]++;else{if(I===V-1){if(zt.patternMatchVariance(C,k,An.MAX_INDIVIDUAL_VARIANCE)<An.MAX_AVG_VARIANCE)return Int32Array.from([$,ne]);$+=C[0]+C[1];let ie=C.slice(2,C.length-1);for(let he=0;he<I-1;he++)C[he]=ie[he];C[I-1]=0,C[I]=0,I--}else I++;C[I]=1,X=!X}throw new F}static decodeDigit(m,g,v,k){this.recordPattern(m,v,g);let C=this.MAX_AVG_VARIANCE,A=-1,I=k.length;for(let $=0;$<I;$++){let V=k[$],X=zt.patternMatchVariance(g,V,An.MAX_INDIVIDUAL_VARIANCE);X<C&&(C=X,A=$)}if(A>=0)return A;throw new F}}An.MAX_AVG_VARIANCE=.48,An.MAX_INDIVIDUAL_VARIANCE=.7,An.START_END_PATTERN=Int32Array.from([1,1,1]),An.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),An.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),An.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class gt{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(m,g,v){let k=this.decodeRowStringBuffer,C=this.decodeMiddle(g,v,k),A=k.toString(),I=gt.parseExtensionString(A),$=[new me((v[0]+v[1])/2,m),new me(C,m)],V=new Z(A,null,0,$,se.UPC_EAN_EXTENSION,new Date().getTime());return I!=null&&V.putAllMetadata(I),V}decodeMiddle(m,g,v){let k=this.decodeMiddleCounters;k[0]=0,k[1]=0,k[2]=0,k[3]=0;let C=m.getSize(),A=g[1],I=0;for(let V=0;V<5&&A<C;V++){let X=An.decodeDigit(m,k,A,An.L_AND_G_PATTERNS);v+=String.fromCharCode(48+X%10);for(let ne of k)A+=ne;X>=10&&(I|=1<<4-V),V!==4&&(A=m.getNextSet(A),A=m.getNextUnset(A))}if(v.length!==5)throw new F;let $=this.determineCheckDigit(I);if(gt.extensionChecksum(v.toString())!==$)throw new F;return A}static extensionChecksum(m){let g=m.length,v=0;for(let k=g-2;k>=0;
2712k-=2)v+=m.charAt(k).charCodeAt(0)-48;v*=3;for(let k=g-1;k>=0;k-=2)v+=m.charAt(k).charCodeAt(0)-48;return v*=3,v%10}determineCheckDigit(m){for(let g=0;g<10;g++)if(m===this.CHECK_DIGIT_ENCODINGS[g])return g;throw new F}static parseExtensionString(m){if(m.length!==5)return null;let g=gt.parseExtension5String(m);return g==null?null:new Map([[le.SUGGESTED_PRICE,g]])}static parseExtension5String(m){let g;switch(m.charAt(0)){case"0":g="£";break;case"5":g="$";break;case"9":switch(m){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}g="";break;default:g="";break}let v=parseInt(m.substring(1)),k=(v/100).toString(),C=v%100,A=C<10?"0"+C:C.toString();return g+k+"."+A}}class kn{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(m,g,v){let k=this.decodeRowStringBuffer,C=this.decodeMiddle(g,v,k),A=k.toString(),I=kn.parseExtensionString(A),$=[new me((v[0]+v[1])/2,m),new me(C,m)],V=new Z(A,null,0,$,se.UPC_EAN_EXTENSION,new Date().getTime());return I!=null&&V.putAllMetadata(I),V}decodeMiddle(m,g,v){let k=this.decodeMiddleCounters;k[0]=0,k[1]=0,k[2]=0,k[3]=0;let C=m.getSize(),A=g[1],I=0;for(let $=0;$<2&&A<C;$++){let V=An.decodeDigit(m,k,A,An.L_AND_G_PATTERNS);v+=String.fromCharCode(48+V%10);for(let X of k)A+=X;V>=10&&(I|=1<<1-$),$!==1&&(A=m.getNextSet(A),A=m.getNextUnset(A))}if(v.length!==2)throw new F;if(parseInt(v.toString())%4!==I)throw new F;return A}static parseExtensionString(m){return m.length!==2?null:new Map([[le.ISSUE_NUMBER,parseInt(m)]])}}class Tn{static decodeRow(m,g,v){let k=An.findGuardPattern(g,v,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new gt().decodeRow(m,g,k)}catch{return new kn().decodeRow(m,g,k)}}}Tn.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class Pt extends An{constructor(){super(),this.decodeRowStringBuffer="",Pt.L_AND_G_PATTERNS=Pt.L_PATTERNS.map(m=>Int32Array.from(m));for(let m=10;m<20;m++){let g=Pt.L_PATTERNS[m-10],v=new Int32Array(g.length);for(let k=0;k<g.length;k++)v[k]=g[g.length-k-1];Pt.L_AND_G_PATTERNS[m]=v}}decodeRow(m,g,v){let k=Pt.findStartGuardPattern(g),C=v==null?null:v.get(T.NEED_RESULT_POINT_CALLBACK);if(C!=null){const Xe=new me((k[0]+k[1])/2,m);C.foundPossibleResultPoint(Xe)}let A=this.decodeMiddle(g,k,this.decodeRowStringBuffer),I=A.rowOffset,$=A.resultString;if(C!=null){const Xe=new me(I,m);C.foundPossibleResultPoint(Xe)}let V=this.decodeEnd(g,I);if(C!=null){const Xe=new me((V[0]+V[1])/2,m);C.foundPossibleResultPoint(Xe)}let X=V[1],ne=X+(X-V[0]);if(ne>=g.getSize()||!g.isRange(X,ne,!1))throw new F;let ie=$.toString();if(ie.length<8)throw new P;if(!Pt.checkChecksum(ie))throw new p;let he=(k[1]+k[0])/2,ye=(V[1]+V[0])/2,ve=this.getBarcodeFormat(),Ce=[new me(he,m),new me(ye,m)],Me=new Z(ie,null,0,Ce,ve,new Date().getTime()),tt=0;try{let Xe=Tn.decodeRow(m,g,V[1]);Me.putMetadata(le.UPC_EAN_EXTENSION,Xe.getText()),Me.putAllMetadata(Xe.getResultMetadata()),Me.addResultPoints(Xe.getResultPoints()),tt=Xe.getText().length}catch{}let rt=v==null?null:v.get(T.ALLOWED_EAN_EXTENSIONS);if(rt!=null){let Xe=!1;for(let Rn in rt)if(tt.toString()===Rn){Xe=!0;break}if(!Xe)throw new F}return Me}decodeEnd(m,g){return Pt.findGuardPattern(m,g,!1,Pt.START_END_PATTERN,new Int32Array(Pt.START_END_PATTERN.length).fill(0))}static checkChecksum(m){return Pt.checkStandardUPCEANChecksum(m)}static checkStandardUPCEANChecksum(m){let g=m.length;if(g===0)return!1;let v=parseInt(m.charAt(g-1),10);return Pt.getStandardUPCEANChecksum(m.substring(0,g-1))===v}static getStandardUPCEANChecksum(m){let g=m.length,v=0;for(let k=g-1;k>=0;k-=2){let C=m.charAt(k).charCodeAt(0)-48;if(C<0||C>9)throw new P;v+=C}v*=3;for(let k=g-2;k>=0;k-=2){let C=m.charAt(k).charCodeAt(0)-48;if(C<0||C>9)throw new P;v+=C}return(1e3-v)%10}}class Jt extends Pt{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(m,g,v){let k=this.decodeMiddleCounters;k[0]=0,k[1]=0,k[2]=0,k[3]=0;let C=m.getSize(),A=g[1],I=0;for(let V=0;V<6&&A<C;V++){let X=Pt.decodeDigit(m,k,A,Pt.L_AND_G_PATTERNS);v+=String.fromCharCode(48+X%10);for(let ne of k)A+=ne;X>=10&&(I|=1<<5-V)}v=Jt.determineFirstDigit(v,I),A=Pt.findGuardPattern(m,A,!0,Pt.MIDDLE_PATTERN,new Int32Array(Pt.MIDDLE_PATTERN.length).fill(0))[1];for(let V=0;V<6&&A<C;V++){let X=Pt.decodeDigit(m,k,A,Pt.L_PATTERNS);v+=String.fromCharCode(48+X);for(let ne of k)A+=ne}return{rowOffset:A,resultString:v}}getBarcodeFormat(){return se.EAN_13}static determineFirstDigit(m,g){for(let v=0;v<10;v++)if(g===this.FIRST_DIGIT_ENCODINGS[v])return m=String.fromCharCode(48+v)+m,m;throw new F}}Jt.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Gn extends Pt{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(m,g,v){const k=this.decodeMiddleCounters;k[0]=0,k[1]=0,k[2]=0,k[3]=0;let C=m.getSize(),A=g[1];for(let $=0;$<4&&A<C;$++){let V=Pt.decodeDigit(m,k,A,Pt.L_PATTERNS);v+=String.fromCharCode(48+V);for(let X of k)A+=X}A=Pt.findGuardPattern(m,A,!0,Pt.MIDDLE_PATTERN,new Int32Array(Pt.MIDDLE_PATTERN.length).fill(0))[1];for(let $=0;$<4&&A<C;$++){let V=Pt.decodeDigit(m,k,A,Pt.L_PATTERNS);v+=String.fromCharCode(48+V);for(let X of k)A+=X}return{rowOffset:A,resultString:v}}getBarcodeFormat(){return se.EAN_8}}class Mr extends Pt{constructor(){super(...arguments),this.ean13Reader=new Jt}getBarcodeFormat(){return se.UPC_A}decode(m,g){return this.maybeReturnResult(this.ean13Reader.decode(m))}decodeRow(m,g,v){return this.maybeReturnResult(this.ean13Reader.decodeRow(m,g,v))}decodeMiddle(m,g,v){return this.ean13Reader.decodeMiddle(m,g,v)}maybeReturnResult(m){let g=m.getText();if(g.charAt(0)==="0"){let v=new Z(g.substring(1),null,null,m.getResultPoints(),se.UPC_A);return m.getResultMetadata()!=null&&v.putAllMetadata(m.getResultMetadata()),v}else throw new F}reset(){this.ean13Reader.reset()}}class ht extends Pt{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(m,g,v){const k=this.decodeMiddleCounters.map(V=>V);k[0]=0,k[1]=0,k[2]=0,k[3]=0;const C=m.getSize();let A=g[1],I=0;for(let V=0;V<6&&A<C;V++){const X=ht.decodeDigit(m,k,A,ht.L_AND_G_PATTERNS);v+=String.fromCharCode(48+X%10);for(let ne of k)A+=ne;X>=10&&(I|=1<<5-V)}let $=ht.determineNumSysAndCheckDigit(v,I);return{rowOffset:A,resultString:$}}decodeEnd(m,g){return ht.findGuardPatternWithoutCounters(m,g,!0,ht.MIDDLE_END_PATTERN)}checkChecksum(m){return Pt.checkChecksum(ht.convertUPCEtoUPCA(m))}static determineNumSysAndCheckDigit(m,g){for(let v=0;v<=1;v++)for(let k=0;k<10;k++)if(g===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[v][k]){let C=String.fromCharCode(48+v),A=String.fromCharCode(48+k);return C+m+A}throw F.getNotFoundInstance()}getBarcodeFormat(){return se.UPC_E}static convertUPCEtoUPCA(m){const g=m.slice(1,7).split("").map(C=>C.charCodeAt(0)),v=new B;v.append(m.charAt(0));let k=g[5];switch(k){case 0:case 1:case 2:v.appendChars(g,0,2),v.append(k),v.append("0000"),v.a
vendor: 5,791 bytes, line 2712
2712ppendChars(g,2,3);break;case 3:v.appendChars(g,0,3),v.append("00000"),v.appendChars(g,3,2);break;case 4:v.appendChars(g,0,4),v.append("00000"),v.append(g[4]);break;default:v.appendChars(g,0,5),v.append("0000"),v.append(k);break}return m.length>=8&&v.append(m.charAt(7)),v.toString()}}ht.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),ht.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class rn extends zt{constructor(m){super();let g=m==null?null:m.get(T.POSSIBLE_FORMATS),v=[];r(g)?(v.push(new Jt),v.push(new Mr),v.push(new Gn),v.push(new ht)):(g.indexOf(se.EAN_13)>-1&&v.push(new Jt),g.indexOf(se.UPC_A)>-1&&v.push(new Mr),g.indexOf(se.EAN_8)>-1&&v.push(new Gn),g.indexOf(se.UPC_E)>-1&&v.push(new ht)),this.readers=v}decodeRow(m,g,v){for(let k of this.readers)try{const C=k.decodeRow(m,g,v),A=C.getBarcodeFormat()===se.EAN_13&&C.getText().charAt(0)==="0",I=v==null?null:v.get(T.POSSIBLE_FORMATS),$=I==null||I.includes(se.UPC_A);if(A&&$){const V=C.getRawBytes(),X=new Z(C.getText().substring(1),V,V?V.length:null,C.getResultPoints(),se.UPC_A);return X.putAllMetadata(C.getResultMetadata()),X}return C}catch{}throw new F}reset(){for(let m of this.readers)m.reset()}}class Mt extends zt{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=new Array(4),this.evenRoundingErrors=new Array(4),this.oddCounts=new Array(this.dataCharacterCounters.length/2),this.evenCounts=new Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(m,g){for(let v=0;v<g.length;v++)if(zt.patternMatchVariance(m,g[v],Mt.MAX_INDIVIDUAL_VARIANCE)<Mt.MAX_AVG_VARIANCE)return v;throw new F}static count(m){return ot.sum(new Int32Array(m))}static increment(m,g){let v=0,k=g[0];for(let C=1;C<m.length;C++)g[C]>k&&(k=g[C],v=C);m[v]++}static decrement(m,g){let v=0,k=g[0];for(let C=1;C<m.length;C++)g[C]<k&&(k=g[C],v=C);m[v]--}static isFinderPattern(m){let g=m[0]+m[1],v=g+m[2]+m[3],k=g/v;if(k>=Mt.MIN_FINDER_PATTERN_RATIO&&k<=Mt.MAX_FINDER_PATTERN_RATIO){let C=Number.MAX_SAFE_INTEGER,A=Number.MIN_SAFE_INTEGER;for(let I of m)I>A&&(A=I),I<C&&(C=I);return A<10*C}return!1}}Mt.MAX_AVG_VARIANCE=.2,Mt.MAX_INDIVIDUAL_VARIANCE=.45,Mt.MIN_FINDER_PATTERN_RATIO=9.5/12,Mt.MAX_FINDER_PATTERN_RATIO=12.5/14;class $n{constructor(m,g){this.value=m,this.checksumPortion=g}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(m){if(!(m instanceof $n))return!1;const g=m;return this.value===g.value&&this.checksumPortion===g.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Lr{constructor(m,g,v,k,C){this.value=m,this.startEnd=g,this.value=m,this.startEnd=g,this.resultPoints=new Array,this.resultPoints.push(new me(v,C)),this.resultPoints.push(new me(k,C))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(m){if(!(m instanceof Lr))return!1;const g=m;return this.value===g.value}hashCode(){return this.value}}class us{constructor(){}static getRSSvalue(m,g,v){let k=0;for(let $ of m)k+=$;let C=0,A=0,I=m.length;for(let $=0;$<I-1;$++){let V;for(V=1,A|=1<<$;V<m[$];V++,A&=~(1<<$)){let X=us.combins(k-V-1,I-$-2);if(v&&A===0&&k-V-(I-$-1)>=I-$-1&&(X-=us.combins(k-V-(I-$),I-$-2)),I-$-1>1){let ne=0;for(let ie=k-V-(I-$-2);ie>g;ie--)ne+=us.combins(k-V-ie-1,I-$-3);X-=ne*(I-1-$)}else k-V>g&&X--;C+=X}k-=V}return C}static combins(m,g){let v,k;m-g>g?(k=g,v=m-g):(k=m-g,v=g);let C=1,A=1;for(let I=m;I>v;I--)C*=I,A<=k&&(C/=A,A++);for(;A<=k;)C/=A,A++;return C}}class nl{static buildBitArray(m){let g=m.length*2-1;m[m.length-1].getRightChar()==null&&(g-=1);let v=12*g,k=new E(v),C=0,I=m[0].getRightChar().getValue();for(let $=11;$>=0;--$)I&1<<$&&k.set(C),C++;for(let $=1;$<m.length;++$){let V=m[$],X=V.getLeftChar().getValue();for(let ne=11;ne>=0;--ne)X&1<<ne&&k.set(C),C++;if(V.getRightChar()!=null){let ne=V.getRightChar().getValue();for(let ie=11;ie>=0;--ie)ne&1<<ie&&k.set(C),C++}}return k}}class pi{constructor(m,g){g?this.decodedInformation=null:(this.finished=m,this.decodedInformation=g)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class rl{constructor(m){this.newPosition=m}getNewPosition(){return this.newPosition}}class Ya extends rl{constructor(m,g){super(m),this.value=g}getValue(){return this.value}isFNC1(){return this.value===Ya.FNC1}}Ya.FNC1="$";class bh extends rl{constructor(m,g,v){super(m),v?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=g}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class sl extends rl{constructor(m,g,v){if(super(m),g<0||g>10||v<0||v>10)throw new P;this.firstDigit=g,this.secondDigit=v}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===sl.FNC1}isSecondDigitFNC1(){return this.secondDigit===sl.FNC1}isAnyFNC1(){return this.firstDigit===sl.FNC1||this.secondDigit===sl.FNC1}}sl.FNC1=10;class wt{constructor(){}static parseFieldsInGeneralPurpose(m){if(!m)return null;if(m.length<2)throw new F;let g=m.substring(0,2);for(let C of wt.TWO_DIGIT_DATA_LENGTH)if(C[0]===g)return C[1]===wt.VARIABLE_LENGTH?wt.processVariableAI(2,C[2],m):wt.process
2712FixedAI(2,C[1],m);if(m.length<3)throw new F;let v=m.substring(0,3);for(let C of wt.THREE_DIGIT_DATA_LENGTH)if(C[0]===v)return C[1]===wt.VARIABLE_LENGTH?wt.processVariableAI(3,C[2],m):wt.processFixedAI(3,C[1],m);for(let C of wt.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(C[0]===v)return C[1]===wt.VARIABLE_LENGTH?wt.processVariableAI(4,C[2],m):wt.processFixedAI(4,C[1],m);if(m.length<4)throw new F;let k=m.substring(0,4);for(let C of wt.FOUR_DIGIT_DATA_LENGTH)if(C[0]===k)return C[1]===wt.VARIABLE_LENGTH?wt.processVariableAI(4,C[2],m):wt.processFixedAI(4,C[1],m);throw new F}static processFixedAI(m,g,v){if(v.length<m)throw new F;let k=v.substring(0,m);if(v.length<m+g)throw new F;let C=v.substring(m,m+g),A=v.substring(m+g),I="("+k+")"+C,$=wt.parseFieldsInGeneralPurpose(A);return $==null?I:I+$}static processVariableAI(m,g,v){let k=v.substring(0,m),C;v.length<m+g?C=v.length:C=m+g;let A=v.substring(m,C),I=v.substring(C),$="("+k+")"+A,V=wt.parseFieldsInGeneralPurpose(I);return V==null?$:$+V}}wt.VARIABLE_LENGTH=[],wt.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",wt.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",wt.VARIABLE_LENGTH,20],["22",wt.VARIABLE_LENGTH,29],["30",wt.VARIABLE_LENGTH,8],["37",wt.VARIABLE_LENGTH,8],["90",wt.VARIABLE_LENGTH,30],["91",wt.VARIABLE_LENGTH,30],["92",wt.VARIABLE_LENGTH,30],["93",wt.VARIABLE_LENGTH,30],["94",wt.VARIABLE_LENGTH,30],["95",wt.VARIABLE_LENGTH,30],["96",wt.VARIABLE_LENGTH,30],["97",wt.VARIABLE_LENGTH,3],["98",wt.VARIABLE_LENGTH,30],["99",wt.VARIABLE_LENGTH,30]],wt.THREE_DIGIT_DATA_LENGTH=[["240",wt.VARIABLE_LENGTH,30],["241",wt.VARIABLE_LENGTH,30],["242",wt.VARIABLE_LENGTH,6],["250",wt.VARIABLE_LENGTH,30],["251",wt.VARIABLE_LENGTH,30],["253",wt.VARIABLE_LENGTH,17],["254",wt.VARIABLE_LENGTH,20],["400",wt.VARIABLE_LENGTH,30],["401",wt.VARIABLE_LENGTH,30],["402",17],["403",wt.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",wt.VARIABLE_LENGTH,20],["421",wt.VARIABLE_LENGTH,15],["422",3],["423",wt.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],wt.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",wt.VARIABLE_LENGTH,15],["391",wt.VARIABLE_LENGTH,18],["392",wt.VARIABLE_LENGTH,15],["393",wt.VARIABLE_LENGTH,18],["703",wt.VARIABLE_LENGTH,30]],wt.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",wt.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",wt.VARIABLE_LENGTH,20],["8003",wt.VARIABLE_LENGTH,30],["8004",wt.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",wt.VARIABLE_LENGTH,30],["8008",wt.VARIABLE_LENGTH,12],["8018",18],["8020",wt.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",wt.VARIABLE_LENGTH,70],["8200",wt.VARIABLE_LENGTH,70]];class Cp{constructor(m){this.buffer=new B,this.information=m}decodeAllCodes(m,g){let v=g,k=null;do{let C=this.decodeGeneralPurposeField(v,k),A=wt.parseFieldsInGeneralPurpose(C.getNewString());if(A!=null&&m.append(A),C.isRemaining()?k=""+C.getRemainingValue():k=null,v===C.getNewPosition())break;v=C.getNewPosition()}while(!0);return m.toString()}isStillNumeric(m){if(m+7>this.information.getSize())return m+4<=this.information.getSize();for(let g=m;g<m+3;++g)if(this.information.get(g))return!0;return this.information.get(m+3)}decodeNumeric(m){if(m+7>this.information.getSize()){let C=this.extractNumericValueFromBitArray(m,4);return C===0?new sl(this.information.getSize(),sl.FNC1,sl.FNC1):new sl(this.information.getSize(),C-1,sl.FNC1)}let g=this.extractNumericValueFromBitArray(m,7),v=(g-8)/11,k=(g-8)%11;return new sl(m+7,v,k)}extractNumericValueFromBitArray(m,g){return Cp.extractNumericValueFromBitArray(this.information,m,g)}static extractNumericValueFromBitArray(m,g,v){let k=0;for(let C=0;C<v;++C)m.get(g+C)&&(k|=1<<v-C-1);return k}decodeGeneralPurposeField(m,g){this.buffer.setLengthToZero(),g!=null&&this.buffer.append(g),this.current.setPosition(m);let v=this.parseBlocks();return v!=null&&v.isRemaining()?new bh(this.current.getPosition(),this.buffer.toString(),v.getRemainingValue()):new bh(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let m,g;do{let v=this.current.getPosition();if(this.current.isAlpha()?(g=this.parseAlphaBlock(),m=g.isFinished()):this.current.isIsoIec646()?(g=this.parseIsoIec646Block(),m=g.isFinished()):(g=this.parseNumericBlock(),m=g.isFinished()),!(v!==this.current.getPosition())&&!m)break}while(!m);return g.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let m=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(m.getNewPosition()),m.isFirstDigitFNC1()){let g;return m.isSecondDigitFNC1()?g=new bh(this.current.getPosition(),this.buffer.toString()):g=new bh(this.current.getPosition(),this.buffer.toString(),m.getSecondDigit()),new pi(!0,g)}if(this.buffer.append(m.getFirstDigit()),m.isSecondDigitFNC1()){let g=new bh(this.current.getPosition(),this.buffer.toString());return new pi(!0,g)}this.buffer.append(m.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new pi(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let m=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(m.getNewPosition()),m.isFNC1()){let g=new bh(this.current.getPosition(),this.buffer.toString());return new pi(!0,g)}this.buffer.append(m.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new pi(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let m=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(m.getNewPosition()),m.isFNC1()){let g=new bh(this.current.getPosition(),this.buffer.toString());return new pi(!0,g)}this.buffer.append(m.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new pi(!1)}isStillIsoIec646(m){if(m+5>this.information.getSize())return!1;let g=this.extractNumericValueFromBitArray(m,5);if(g>=5&&g<16)return!0;
vendor: 5,670 bytes, line 2712
2712if(m+7>this.information.getSize())return!1;let v=this.extractNumericValueFromBitArray(m,7);if(v>=64&&v<116)return!0;if(m+8>this.information.getSize())return!1;let k=this.extractNumericValueFromBitArray(m,8);return k>=232&&k<253}decodeIsoIec646(m){let g=this.extractNumericValueFromBitArray(m,5);if(g===15)return new Ya(m+5,Ya.FNC1);if(g>=5&&g<15)return new Ya(m+5,"0"+(g-5));let v=this.extractNumericValueFromBitArray(m,7);if(v>=64&&v<90)return new Ya(m+7,""+(v+1));if(v>=90&&v<116)return new Ya(m+7,""+(v+7));let k=this.extractNumericValueFromBitArray(m,8),C;switch(k){case 232:C="!";break;case 233:C='"';break;case 234:C="%";break;case 235:C="&";break;case 236:C="'";break;case 237:C="(";break;case 238:C=")";break;case 239:C="*";break;case 240:C="+";break;case 241:C=",";break;case 242:C="-";break;case 243:C=".";break;case 244:C="/";break;case 245:C=":";break;case 246:C=";";break;case 247:C="<";break;case 248:C="=";break;case 249:C=">";break;case 250:C="?";break;case 251:C="_";break;case 252:C=" ";break;default:throw new P}return new Ya(m+8,C)}isStillAlpha(m){if(m+5>this.information.getSize())return!1;let g=this.extractNumericValueFromBitArray(m,5);if(g>=5&&g<16)return!0;if(m+6>this.information.getSize())return!1;let v=this.extractNumericValueFromBitArray(m,6);return v>=16&&v<63}decodeAlphanumeric(m){let g=this.extractNumericValueFromBitArray(m,5);if(g===15)return new Ya(m+5,Ya.FNC1);if(g>=5&&g<15)return new Ya(m+5,"0"+(g-5));let v=this.extractNumericValueFromBitArray(m,6);if(v>=32&&v<58)return new Ya(m+6,""+(v+33));let k;switch(v){case 58:k="*";break;case 59:k=",";break;case 60:k="-";break;case 61:k=".";break;case 62:k="/";break;default:throw new Ne("Decoding invalid alphanumeric value: "+v)}return new Ya(m+6,k)}isAlphaTo646ToAlphaLatch(m){if(m+1>this.information.getSize())return!1;for(let g=0;g<5&&g+m<this.information.getSize();++g)if(g===2){if(!this.information.get(m+2))return!1}else if(this.information.get(m+g))return!1;return!0}isAlphaOr646ToNumericLatch(m){if(m+3>this.information.getSize())return!1;for(let g=m;g<m+3;++g)if(this.information.get(g))return!1;return!0}isNumericToAlphaNumericLatch(m){if(m+1>this.information.getSize())return!1;for(let g=0;g<4&&g+m<this.information.getSize();++g)if(this.information.get(m+g))return!1;return!0}}class aS{constructor(m){this.information=m,this.generalDecoder=new Cp(m)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class Xa extends aS{constructor(m){super(m)}encodeCompressedGtin(m,g){m.append("(01)");let v=m.length();m.append("9"),this.encodeCompressedGtinWithoutAI(m,g,v)}encodeCompressedGtinWithoutAI(m,g,v){for(let k=0;k<4;++k){let C=this.getGeneralDecoder().extractNumericValueFromBitArray(g+10*k,10);C/100===0&&m.append("0"),C/10===0&&m.append("0"),m.append(C)}Xa.appendCheckDigit(m,v)}static appendCheckDigit(m,g){let v=0;for(let k=0;k<13;k++){let C=m.charAt(k+g).charCodeAt(0)-48;v+=k&1?C:3*C}v=10-v%10,v===10&&(v=0),m.append(v)}}Xa.GTIN_SIZE=40;class Ep extends Xa{constructor(m){super(m)}parseInformation(){let m=new B;m.append("(01)");let g=m.length(),v=this.getGeneralDecoder().extractNumericValueFromBitArray(Ep.HEADER_SIZE,4);return m.append(v),this.encodeCompressedGtinWithoutAI(m,Ep.HEADER_SIZE+4,g),this.getGeneralDecoder().decodeAllCodes(m,Ep.HEADER_SIZE+44)}}Ep.HEADER_SIZE=4;class xw extends aS{constructor(m){super(m)}parseInformation(){let m=new B;return this.getGeneralDecoder().decodeAllCodes(m,xw.HEADER_SIZE)}}xw.HEADER_SIZE=5;class yw extends Xa{constructor(m){super(m)}encodeCompressedWeight(m,g,v){let k=this.getGeneralDecoder().extractNumericValueFromBitArray(g,v);this.addWeightCode(m,k);let C=this.checkWeight(k),A=1e5;for(let I=0;I<5;++I)C/A===0&&m.append("0"),A/=10;m.append(C)}}class kc extends yw{constructor(m){super(m)}parseInformation(){if(this.getInformation().getSize()!=kc.HEADER_SIZE+yw.GTIN_SIZE+kc.WEIGHT_SIZE)throw new F;let m=new B;return this.encodeCompressedGtin(m,kc.HEADER_SIZE),this.encodeCompressedWeight(m,kc.HEADER_SIZE+yw.GTIN_SIZE,kc.WEIGHT_SIZE),m.toString()}}kc.HEADER_SIZE=5,kc.WEIGHT_SIZE=15;class $fe extends kc{constructor(m){super(m)}addWeightCode(m,g){m.append("(3103)")}checkWeight(m){return m}}class Bfe extends kc{constructor(m){super(m)}addWeightCode(m,g){g<1e4?m.append("(3202)"):m.append("(3203)")}checkWeight(m){return m<1e4?m:m-1e4}}class Cc extends Xa{constructor(m){super(m)}parseInformation(){if(this.getInformation().getSize()<Cc.HEADER_SIZE+Xa.GTIN_SIZE)throw new F;let m=new B;this.encodeCompressedGtin(m,Cc.HEADER_SIZE);let g=this.getGeneralDecoder().extractNumericValueFromBitArray(Cc.HEADER_SIZE+Xa.GTIN_SIZE,Cc.LAST_DIGIT_SIZE);m.append("(392"),m.append(g),m.append(")");let v=this.getGeneralDecoder().decodeGeneralPurposeField(Cc.HEADER_SIZE+Xa.GTIN_SIZE+Cc.LAST_DIGIT_SIZE,null);return m.append(v.getNewString()),m.toString()}}Cc.HEADER_SIZE=8,Cc.LAST_DIGIT_SIZE=2;class Sa extends Xa{constructor(m){super(m)}parseInformation(){if(this.getInformation().getSize()<Sa.HEADER_SIZE+Xa.GTIN_SIZE)throw new F;let m=new B;this.encodeCompressedGtin(m,Sa.HEADER_SIZE);let g=this.getGeneralDecoder().extractNumericValueFromBitArray(Sa.HEADER_SIZE+Xa.GTIN_SIZE,Sa.LAST_DIGIT_SIZE);m.append("(393"),m.append(g),m.append(")");let v=this.getGeneralDecoder().extractNumericValueFromBitArray(Sa.HEADER_SIZE+Xa.GTIN_SIZE+Sa.LAST_DIGIT_SIZE,Sa.FIRST_THREE_DIGITS_SIZE);v/100==0&&m.append("0"),v/10==0&&m.append("0"),m.append(v);let k=this.getGeneralDecoder().decodeGeneralPurposeField(Sa.HEADER_SIZE+Xa.GTIN_SIZE+Sa.LAST_DIGIT_SIZE+Sa.FIRST_THREE_DIGITS_SIZE,null);return m.append(k.getNewString()),m.toString()}}Sa.HEADER_SIZE=8,Sa.LAST_DIGIT_SIZE=2,Sa.FIRST_THREE_DIGITS_SIZE=10;
2712class ds extends yw{constructor(m,g,v){super(m),this.dateCode=v,this.firstAIdigits=g}parseInformation(){if(this.getInformation().getSize()!=ds.HEADER_SIZE+ds.GTIN_SIZE+ds.WEIGHT_SIZE+ds.DATE_SIZE)throw new F;let m=new B;return this.encodeCompressedGtin(m,ds.HEADER_SIZE),this.encodeCompressedWeight(m,ds.HEADER_SIZE+ds.GTIN_SIZE,ds.WEIGHT_SIZE),this.encodeCompressedDate(m,ds.HEADER_SIZE+ds.GTIN_SIZE+ds.WEIGHT_SIZE),m.toString()}encodeCompressedDate(m,g){let v=this.getGeneralDecoder().extractNumericValueFromBitArray(g,ds.DATE_SIZE);if(v==38400)return;m.append("("),m.append(this.dateCode),m.append(")");let k=v%32;v/=32;let C=v%12+1;v/=12;let A=v;A/10==0&&m.append("0"),m.append(A),C/10==0&&m.append("0"),m.append(C),k/10==0&&m.append("0"),m.append(k)}addWeightCode(m,g){m.append("("),m.append(this.firstAIdigits),m.append(g/1e5),m.append(")")}checkWeight(m){return m%1e5}}ds.HEADER_SIZE=8,ds.WEIGHT_SIZE=20,ds.DATE_SIZE=16;function q8(te){try{if(te.get(1))return new Ep(te);if(!te.get(2))return new xw(te);switch(Cp.extractNumericValueFromBitArray(te,1,4)){case 4:return new $fe(te);case 5:return new Bfe(te)}switch(Cp.extractNumericValueFromBitArray(te,1,5)){case 12:return new Cc(te);case 13:return new Sa(te)}switch(Cp.extractNumericValueFromBitArray(te,1,7)){case 56:return new ds(te,"310","11");case 57:return new ds(te,"320","11");case 58:return new ds(te,"310","13");case 59:return new ds(te,"320","13");case 60:return new ds(te,"310","15");case 61:return new ds(te,"320","15");case 62:return new ds(te,"310","17");case 63:return new ds(te,"320","17")}}catch(m){throw console.log(m),new Ne("unknown decoder: "+te)}}class Ad{constructor(m,g,v,k){this.leftchar=m,this.rightchar=g,this.finderpattern=v,this.maybeLast=k}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return this.rightchar==null}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(this.finderpattern==null?"null":this.finderpattern.getValue())+" ]"}static equals(m,g){return m instanceof Ad?Ad.equalsOrNull(m.leftchar,g.leftchar)&&Ad.equalsOrNull(m.rightchar,g.rightchar)&&Ad.equalsOrNull(m.finderpattern,g.finderpattern):!1}static equalsOrNull(m,g){return m===null?g===null:Ad.equals(m,g)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class oS{constructor(m,g,v){this.pairs=m,this.rowNumber=g,this.wasReversed=v}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(m){return this.checkEqualitity(this,m)}toString(){return"{ "+this.pairs+" }"}equals(m,g){return m instanceof oS?this.checkEqualitity(m,g)&&m.wasReversed===g.wasReversed:!1}checkEqualitity(m,g){if(!m||!g)return;let v;return m.forEach((k,C)=>{g.forEach(A=>{k.getLeftChar().getValue()===A.getLeftChar().getValue()&&k.getRightChar().getValue()===A.getRightChar().getValue()&&k.getFinderPatter().getValue()===A.getFinderPatter().getValue()&&(v=!0)})}),v}}class Ke extends Mt{constructor(m){super(...arguments),this.pairs=new Array(Ke.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=m===!0}decodeRow(m,g,v){this.pairs.length=0,this.startFromEven=!1;try{return Ke.constructResult(this.decodeRow2pairs(m,g))}catch(k){this.verbose&&console.log(k)}return this.pairs.length=0,this.startFromEven=!0,Ke.constructResult(this.decodeRow2pairs(m,g))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(m,g){let v=!1;for(;!v;)try{this.pairs.push(this.retrieveNextPair(g,this.pairs,m))}catch(C){if(C instanceof F){if(!this.pairs.length)throw new F;v=!0}}if(this.checkChecksum())return this.pairs;let k;if(this.rows.length?k=!0:k=!1,this.storeRow(m,!1),k){let C=this.checkRowsBoolean(!1);if(C!=null||(C=this.checkRowsBoolean(!0),C!=null))return C}throw new F}checkRowsBoolean(m){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,m&&(this.rows=this.rows.reverse());let g=null;try{g=this.checkRows(new Array,0)}catch(v){this.verbose&&console.log(v)}return m&&(this.rows=this.rows.reverse()),g}checkRows(m,g){for(let v=g;v<this.rows.length;v++){let k=this.rows[v];this.pairs.length=0;for(let A of m)this.pairs.push(A.getPairs());if(this.pairs.push(k.getPairs()),!Ke.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let C=new Array(m);C.push(k);try{return this.checkRows(C,v+1)}catch(A){this.verbose&&console.log(A)}}throw new F}static isValidSequence(m){for(let g of Ke.FINDER_PATTERN_SEQUENCES){if(m.length>g.length)continue;let v=!0;for(let k=0;k<m.length;k++)if(m[k].getFinderPattern().getValue()!=g[k]){v=!1;break}if(v)return!0}return!1}storeRow(m,g){let v=0,k=!1,C=!1;for(;v<this.rows.length;){let A=this.rows[v];if(A.getRowNumber()>m){C=A.isEquivalent(this.pairs);break}k=A.isEquivalent(this.pairs),v++}C||k||Ke.isPartialRow(this.pairs,this.rows)||(this.rows.push(v,new oS(this.pairs,m,g)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(m,g){for(let v of g)if(v.getPairs().length!==m.length){for(let k of v.getPairs())for(let C of m)if(Ad.equals(k,C))break}}static isPartialRow(m,g){for(let v of g){let k=!0;for(let C of m){let A=!1;for(let I of v.getPairs())if(C.equals(I)){A=!0;break}if(!A){k=!1;break}}if(k)return!0}return!1}getRows(){return this.rows}
2712static constructResult(m){let g=nl.buildBitArray(m),k=q8(g).parseInformation(),C=m[0].getFinderPattern().getResultPoints(),A=m[m.length-1].getFinderPattern().getResultPoints(),I=[C[0],C[1],A[0],A[1]];return new Z(k,null,null,I,se.RSS_EXPANDED,null)}checkChecksum(){let m=this.pairs.get(0),g=m.getLeftChar(),v=m.getRightChar();if(v==null)return!1;let k=v.getChecksumPortion(),C=2;for(let I=1;I<this.pairs.size();++I){let $=this.pairs.get(I);k+=$.getLeftChar().getChecksumPortion(),C++;let V=$.getRightChar();V!=null&&(k+=V.getChecksumPortion(),C++)}return k%=211,211*(C-4)+k==g.getValue()}static getNextSecondBar(m,g){let v;return m.get(g)?(v=m.getNextUnset(g),v=m.getNextSet(v)):(v=m.getNextSet(g),v=m.getNextUnset(v)),v}retrieveNextPair(m,g,v){let k=g.length%2==0;this.startFromEven&&(k=!k);let C,A=!0,I=-1;do this.findNextPair(m,g,I),C=this.parseFoundFinderPattern(m,v,k),C==null?I=Ke.getNextSecondBar(m,this.startEnd[0]):A=!1;while(A);let $=this.decodeDataCharacter(m,C,k,!0);if(!this.isEmptyPair(g)&&g[g.length-1].mustBeLast())throw new F;let V;try{V=this.decodeDataCharacter(m,C,k,!1)}catch(X){V=null,this.verbose&&console.log(X)}return new Ad($,V,C,!0)}isEmptyPair(m){return m.length===0}findNextPair(m,g,v){let k=this.getDecodeFinderCounters();k[0]=0,k[1]=0,k[2]=0,k[3]=0;let C=m.getSize(),A;v>=0?A=v:this.isEmptyPair(g)?A=0:A=g[g.length-1].getFinderPattern().getStartEnd()[1];let I=g.length%2!=0;this.startFromEven&&(I=!I);let $=!1;for(;A<C&&($=!m.get(A),!!$);)A++;let V=0,X=A;for(let ne=A;ne<C;ne++)if(m.get(ne)!=$)k[V]++;else{if(V==3){if(I&&Ke.reverseCounters(k),Ke.isFinderPattern(k)){this.startEnd[0]=X,this.startEnd[1]=ne;return}I&&Ke.reverseCounters(k),X+=k[0]+k[1],k[0]=k[2],k[1]=k[3],k[2]=0,k[3]=0,V--}else V++;k[V]=1,$=!$}throw new F}static reverseCounters(m){let g=m.length;for(let v=0;v<g/2;++v){let k=m[v];m[v]=m[g-v-1],m[g-v-1]=k}}parseFoundFinderPattern(m,g,v){let k,C,A;if(v){let V=this.startEnd[0]-1;for(;V>=0&&!m.get(V);)V--;V++,k=this.startEnd[0]-V,C=V,A=this.startEnd[1]}else C=this.startEnd[0],A=m.getNextUnset(this.startEnd[1]+1),k=A-this.startEnd[1];let I=this.getDecodeFinderCounters();y.arraycopy(I,0,I,1,I.length-1),I[0]=k;let $;try{$=this.parseFinderValue(I,Ke.FINDER_PATTERNS)}catch{return null}return new Lr($,[C,A],C,A,g)}decodeDataCharacter(m,g,v,k){let C=this.getDataCharacterCounters();for(let $r=0;$r<C.length;$r++)C[$r]=0;if(k)Ke.recordPatternInReverse(m,g.getStartEnd()[0],C);else{Ke.recordPattern(m,g.getStartEnd()[1],C);for(let $r=0,Xi=C.length-1;$r<Xi;$r++,Xi--){let Co=C[$r];C[$r]=C[Xi],C[Xi]=Co}}let A=17,I=ot.sum(new Int32Array(C))/A,$=(g.getStartEnd()[1]-g.getStartEnd()[0])/15;if(Math.abs(I-$)/$>.3)throw new F;let V=this.getOddCounts(),X=this.getEvenCounts(),ne=this.getOddRoundingErrors(),ie=this.getEvenRoundingErrors();for(let $r=0;$r<C.length;$r++){let Xi=1*C[$r]/I,Co=Xi+.5;if(Co<1){if(Xi<.3)throw new F;Co=1}else if(Co>8){if(Xi>8.7)throw new F;Co=8}let Op=$r/2;$r&1?(X[Op]=Co,ie[Op]=Xi-Co):(V[Op]=Co,ne[Op]=Xi-Co)}this.adjustOddEvenCounts(A);let he=4*g.getValue()+(v?0:2)+(k?0:1)-1,ye=0,ve=0;for(let $r=V.length-1;$r>=0;$r--){if(Ke.isNotA1left(g,v,k)){let Xi=Ke.WEIGHTS[he][2*$r];ve+=V[$r]*Xi}ye+=V[$r]}let Ce=0;for(let $r=X.length-1;$r>=0;$r--)if(Ke.isNotA1left(g,v,k)){let Xi=Ke.WEIGHTS[he][2*$r+1];Ce+=X[$r]*Xi}let Me=ve+Ce;if(ye&1||ye>13||ye<4)throw new F;let tt=(13-ye)/2,rt=Ke.SYMBOL_WIDEST[tt],Xe=9-rt,Rn=us.getRSSvalue(V,rt,!0),pn=us.getRSSvalue(X,Xe,!1),Ja=Ke.EVEN_TOTAL_SUBSET[tt],ql=Ke.GSUM[tt],Za=Rn*Ja+pn+ql;return new $n(Za,Me)}static isNotA1left(m,g,v){return!(m.getValue()==0&&g&&v)}adjustOddEvenCounts(m){let g=ot.sum(new Int32Array(this.getOddCounts())),v=ot.sum(new Int32Array(this.getEvenCounts())),k=!1,C=!1;g>13?C=!0:g<4&&(k=!0);let A=!1,I=!1;v>13?I=!0:v<4&&(A=!0);let $=g+v-m,V=(g&1)==1,X=(v&1)==0;if($==1)if(V){if(X)throw new F;C=!0}else{if(!X)throw new F;I=!0}else if($==-1)if(V){if(X)throw new F;k=!0}else{if(!X)throw new F;A=!0}else if($==0){if(V){if(!X)throw new F;g<v?(k=!0,I=!0):(C=!0,A=!0)}else if(X)throw new F}else throw new F;if(k){if(C)throw new F;Ke.increment(this.getOddCounts(),this.getOddRoundingErrors())}
vendor: 6,402 bytes, line 2712
2712if(C&&Ke.decrement(this.getOddCounts(),this.getOddRoundingErrors()),A){if(I)throw new F;Ke.increment(this.getEvenCounts(),this.getOddRoundingErrors())}I&&Ke.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}Ke.SYMBOL_WIDEST=[7,5,4,3,1],Ke.EVEN_TOTAL_SUBSET=[4,20,52,104,204],Ke.GSUM=[0,348,1388,2948,3988],Ke.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],Ke.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],Ke.FINDER_PAT_A=0,Ke.FINDER_PAT_B=1,Ke.FINDER_PAT_C=2,Ke.FINDER_PAT_D=3,Ke.FINDER_PAT_E=4,Ke.FINDER_PAT_F=5,Ke.FINDER_PATTERN_SEQUENCES=[[Ke.FINDER_PAT_A,Ke.FINDER_PAT_A],[Ke.FINDER_PAT_A,Ke.FINDER_PAT_B,Ke.FINDER_PAT_B],[Ke.FINDER_PAT_A,Ke.FINDER_PAT_C,Ke.FINDER_PAT_B,Ke.FINDER_PAT_D],[Ke.FINDER_PAT_A,Ke.FINDER_PAT_E,Ke.FINDER_PAT_B,Ke.FINDER_PAT_D,Ke.FINDER_PAT_C],[Ke.FINDER_PAT_A,Ke.FINDER_PAT_E,Ke.FINDER_PAT_B,Ke.FINDER_PAT_D,Ke.FINDER_PAT_D,Ke.FINDER_PAT_F],[Ke.FINDER_PAT_A,Ke.FINDER_PAT_E,Ke.FINDER_PAT_B,Ke.FINDER_PAT_D,Ke.FINDER_PAT_E,Ke.FINDER_PAT_F,Ke.FINDER_PAT_F],[Ke.FINDER_PAT_A,Ke.FINDER_PAT_A,Ke.FINDER_PAT_B,Ke.FINDER_PAT_B,Ke.FINDER_PAT_C,Ke.FINDER_PAT_C,Ke.FINDER_PAT_D,Ke.FINDER_PAT_D],[Ke.FINDER_PAT_A,Ke.FINDER_PAT_A,Ke.FINDER_PAT_B,Ke.FINDER_PAT_B,Ke.FINDER_PAT_C,Ke.FINDER_PAT_C,Ke.FINDER_PAT_D,Ke.FINDER_PAT_E,Ke.FINDER_PAT_E],[Ke.FINDER_PAT_A,Ke.FINDER_PAT_A,Ke.FINDER_PAT_B,Ke.FINDER_PAT_B,Ke.FINDER_PAT_C,Ke.FINDER_PAT_C,Ke.FINDER_PAT_D,Ke.FINDER_PAT_E,Ke.FINDER_PAT_F,Ke.FINDER_PAT_F],[Ke.FINDER_PAT_A,Ke.FINDER_PAT_A,Ke.FINDER_PAT_B,Ke.FINDER_PAT_B,Ke.FINDER_PAT_C,Ke.FINDER_PAT_D,Ke.FINDER_PAT_D,Ke.FINDER_PAT_E,Ke.FINDER_PAT_E,Ke.FINDER_PAT_F,Ke.FINDER_PAT_F]],Ke.MAX_PAIRS=11;class zfe extends $n{constructor(m,g,v){super(m,g),this.count=0,this.finderPattern=v}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class Es extends Mt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(m,g,v){const k=this.decodePair(g,!1,m,v);Es.addOrTally(this.possibleLeftPairs,k),g.reverse();let C=this.decodePair(g,!0,m,v);Es.addOrTally(this.possibleRightPairs,C),g.reverse();for(let A of this.possibleLeftPairs)if(A.getCount()>1){for(let I of this.possibleRightPairs)if(I.getCount()>1&&Es.checkChecksum(A,I))return Es.constructResult(A,I)}throw new F}static addOrTally(m,g){if(g==null)return;let v=!1;for(let k of m)if(k.getValue()===g.getValue()){k.incrementCount(),v=!0;break}v||m.push(g)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(m,g){let v=4537077*m.getValue()+g.getValue(),k=new String(v).toString(),C=new B;for(let V=13-k.length;V>0;V--)C.append("0");C.append(k);let A=0;for(let V=0;V<13;V++){let X=C.charAt(V).charCodeAt(0)-48;A+=V&1?X:3*X}A=10-A%10,A===10&&(A=0),C.append(A.toString());let I=m.getFinderPattern().getResultPoints(),$=g.getFinderPattern().getResultPoints();return new Z(C.toString(),null,0,[I[0],I[1],$[0],$[1]],se.RSS_14,new Date().getTime())}static checkChecksum(m,g){let v=(m.getChecksumPortion()+16*g.getChecksumPortion())%79,k=9*m.getFinderPattern().getValue()+g.getFinderPattern().getValue();return k>72&&k--,k>8&&k--,v===k}decodePair(m,g,v,k){try{let C=this.findFinderPattern(m,g),A=this.parseFoundFinderPattern(m,v,g,C),I=k==null?null:k.get(T.NEED_RESULT_POINT_CALLBACK);if(I!=null){let X=(C[0]+C[1])/2;g&&(X=m.getSize()-1-X),I.foundPossibleResultPoint(new me(X,v))}let $=this.decodeDataCharacter(m,A,!0),V=this.decodeDataCharacter(m,A,!1);return new zfe(1597*$.getValue()+V.getValue(),$.getChecksumPortion()+4*V.getChecksumPortion(),A)}catch{return null}}decodeDataCharacter(m,g,v){let k=this.getDataCharacterCounters();for(let Ce=0;Ce<k.length;Ce++)k[Ce]=0;if(v)zt.recordPatternInReverse(m,g.getStartEnd()[0],k);else{zt.recordPattern(m,g.getStartEnd()[1]+1,k);for(let Ce=0,Me=k.length-1;Ce<Me;Ce++,Me--){let tt=k[Ce];k[Ce]=k[Me],k[Me]=tt}}let C=v?16:15,A=ot.sum(new Int32Array(k))/C,I=this.getOddCounts(),$=this.getEvenCounts(),V=this.getOddRoundingErrors(),X=this.getEvenRoundingErrors();for(let Ce=0;Ce<k.length;Ce++){let Me=k[Ce]/A,tt=Math.floor(Me+.5);tt<1?tt=1:tt>8&&(tt=8);let rt=Math.floor(Ce/2);Ce&1?($[rt]=tt,X[rt]=Me-tt):(I[rt]=tt,V[rt]=Me-tt)}this.adjustOddEvenCounts(v,C);let ne=0,ie=0;for(let Ce=I.length-1;Ce>=0;Ce--)ie*=9,ie+=I[Ce],ne+=I[Ce];let he=0,ye=0;for(let Ce=$.length-1;Ce>=0;Ce--)he*=9,he+=$[Ce],ye+=$[Ce];let ve=ie+3*he;if(v){if(ne&1||ne>12||ne<4)throw new F;let Ce=(12-ne)/2,Me=Es.OUTSIDE_ODD_WIDEST[Ce],tt=9-Me,rt=us.getRSSvalue(I,Me,!1),Xe=us.getRSSvalue($,tt,!0),Rn=Es.OUTSIDE_EVEN_TOTAL_SUBSET[Ce],pn=Es.OUTSIDE_GSUM[Ce];return new $n(rt*Rn+Xe+pn,ve)}else{if(ye&1||ye>10||ye<4)throw new F;let Ce=(10-ye)/2,Me=Es.INSIDE_ODD_WIDEST[Ce],tt=9-Me,rt=us.getRSSvalue(I,Me,!0),Xe=us.getRSSvalue($,tt,!1),Rn=Es.INSIDE_ODD_TOTAL_SUBSET[Ce],pn=Es.INSIDE_GSUM[Ce];return new $n(Xe*Rn+rt+pn,ve)}}findFinderPattern(m,g){let v=this.getDecodeFinderCounters();v[0]=0,v[1]=0,v[2]=0,v[3]=0;let k=m.getSize(),C=!1,A=0;for(;A<k&&(C=!m.get(A),g!==C);)A++;let I=0,$=A;for(let V=A;V<k;V++)if(m.get(V)!==C)v[I]++;else{if(I===3){if(Mt.isFinderPattern(v))return[$,V];$+=v[0]+v[1],v[0]=v[2],v[1]=v[3],v[2]=0,v[3]=0,I--}else I++;v[I]=1,C=!C}throw new F}parseFoundFinderPattern(m,g,v,k){let C=m.get(k[0]),A=k[0]-1;for(;A>=0&&C!==m.get(A);)A--;A++;const I=k[0]-A,$=this.getDecodeFinderCounters(),V=new Int32Array($.length);y.arraycopy($,0,V,1,$.length-1),V[0]=I;const X=this.parseFinderValue(V,Es.FINDER_PATTERNS);let ne=A,ie=k[1];return v&&(ne=m.getSize()-1-ne,ie=m.getSize()-1-ie),new Lr(X,[A,k[1]],ne,ie,g)}adjustOddEvenCounts(m,g){let v=ot.sum(new Int32Array(this.getOddCounts())),k=ot.
2712sum(new Int32Array(this.getEvenCounts())),C=!1,A=!1,I=!1,$=!1;m?(v>12?A=!0:v<4&&(C=!0),k>12?$=!0:k<4&&(I=!0)):(v>11?A=!0:v<5&&(C=!0),k>10?$=!0:k<4&&(I=!0));let V=v+k-g,X=(v&1)===(m?1:0),ne=(k&1)===1;if(V===1)if(X){if(ne)throw new F;A=!0}else{if(!ne)throw new F;$=!0}else if(V===-1)if(X){if(ne)throw new F;C=!0}else{if(!ne)throw new F;I=!0}else if(V===0){if(X){if(!ne)throw new F;v<k?(C=!0,$=!0):(A=!0,I=!0)}else if(ne)throw new F}else throw new F;if(C){if(A)throw new F;Mt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(A&&Mt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),I){if($)throw new F;Mt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}$&&Mt.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}Es.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],Es.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],Es.OUTSIDE_GSUM=[0,161,961,2015,2715],Es.INSIDE_GSUM=[0,336,1036,1516],Es.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],Es.INSIDE_ODD_WIDEST=[2,4,6,8],Es.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])];class Sp extends zt{constructor(m,g){super(),this.readers=[],this.verbose=g===!0;const v=m?m.get(T.POSSIBLE_FORMATS):null,k=m&&m.get(T.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;v?((v.includes(se.EAN_13)||v.includes(se.UPC_A)||v.includes(se.EAN_8)||v.includes(se.UPC_E))&&this.readers.push(new rn(m)),v.includes(se.CODE_39)&&this.readers.push(new bn(k)),v.includes(se.CODE_128)&&this.readers.push(new He),v.includes(se.ITF)&&this.readers.push(new Rt),v.includes(se.RSS_14)&&this.readers.push(new Es),v.includes(se.RSS_EXPANDED)&&this.readers.push(new Ke(this.verbose))):(this.readers.push(new rn(m)),this.readers.push(new bn),this.readers.push(new rn(m)),this.readers.push(new He),this.readers.push(new Rt),this.readers.push(new Es),this.readers.push(new Ke(this.verbose)))}decodeRow(m,g,v){for(let k=0;k<this.readers.length;k++)try{return this.readers[k].decodeRow(m,g,v)}catch{}throw new F}reset(){this.readers.forEach(m=>m.reset())}}class Ufe extends Y{constructor(m=500,g){super(new Sp(g),m,g)}}class hr{constructor(m,g,v){this.ecCodewords=m,this.ecBlocks=[g],v&&this.ecBlocks.push(v)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class rr{constructor(m,g){this.count=m,this.dataCodewords=g}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Bn{constructor(m,g,v,k,C,A){this.versionNumber=m,this.symbolSizeRows=g,this.symbolSizeColumns=v,this.dataRegionSizeRows=k,this.dataRegionSizeColumns=C,this.ecBlocks=A;let I=0;const $=A.getECCodewords(),V=A.getECBlocks();for(let X of V)I+=X.getCount()*(X.getDataCodewords()+$);this.totalCodewords=I}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(m,g){if(m&1||g&1)throw new P;for(let v of Bn.VERSIONS)if(v.symbolSizeRows===m&&v.symbolSizeColumns===g)return v;throw new P}toString(){return""+this.versionNumber}static buildVersions(){return[new Bn(1,10,10,8,8,new hr(5,new rr(1,3))),new Bn(2,12,12,10,10,new hr(7,new rr(1,5))),new Bn(3,14,14,12,12,new hr(10,new rr(1,8))),new Bn(4,16,16,14,14,new hr(12,new rr(1,12))),new Bn(5,18,18,16,16,new hr(14,new rr(1,18))),new Bn(6,20,20,18,18,new hr(18,new rr(1,22))),new Bn(7,22,22,20,20,new hr(20,new rr(1,30))),new Bn(8,24,24,22,22,new hr(24,new rr(1,36))),new Bn(9,26,26,24,24,new hr(28,new rr(1,44))),new Bn(10,32,32,14,14,new hr(36,new rr(1,62))),new Bn(11,36,36,16,16,new hr(42,new rr(1,86))),new Bn(12,40,40,18,18,new hr(48,new rr(1,114))),new Bn(13,44,44,20,20,new hr(56,new rr(1,144))),new Bn(14,48,48,22,22,new hr(68,new rr(1,174))),new Bn(15,52,52,24,24,new hr(42,new rr(2,102))),new Bn(16,64,64,14,14,new hr(56,new rr(2,140))),new Bn(17,72,72,16,16,new hr(36,new rr(4,92))),new Bn(18,80,80,18,18,new hr(48,new rr(4,114))),new Bn(19,88,88,20,20,new hr(56,new rr(4,144))),new Bn(20,96,96,22,22,new hr(68,new rr(4,174))),new Bn(21,104,104,24,24,new hr(56,new rr(6,136))),new Bn(22,120,120,18,18,new hr(68,new rr(6,175))),new Bn(23,132,132,20,20,new hr(62,new rr(8,163))),new Bn(24,144,144,22,22,new hr(62,new rr(8,156),new rr(2,155))),new Bn(25,8,18,6,16,new hr(7,new rr(1,5))),new Bn(26,8,32,6,14,new hr(11,new rr(1,10))),new Bn(27,12,26,10,24,new hr(14,new rr(1,16))),new Bn(28,12,36,10,16,new hr(18,new rr(1,22))),new Bn(29,16,36,14,16,new hr(24,new rr(1,32))),new Bn(30,16,48,14,22,new hr(28,new rr(1,49)))]}}Bn.VERSIONS=Bn.buildVersions();class lS{constructor(m){const g=m.getHeight();if(g<8||g>144||g&1)throw new P;this.version=lS.readVersion(m),this.mappingBitMatrix=this.extractDataRegion(m),this.readMappingMatrix=new U(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(m){const g=m.getHeight(),v=m.getWidth();return Bn.getVersionForDimensions(g,v)}readCodewords(){const m=new Int8Array(this.version.getTotalCodewords());let g=0,v=4,k=0;const C=this.mappingBitMatrix.getHeight(),A=this.mappingBitMatrix.getWidth();let I=!1,$=!1,V=!1,X=!1;do if(v===C&&k===0&&!I)m[g++]=this.readCorner1(C,A)&255,v-=2,k+=2,I=!0;else if(v===C-2&&k===0&&A&3&&!$)m[g++]=this.readCorner2(C,A)&255,v-=2,k+=2,$=!0;else if(v===C+4&&k===2&&!(A&7)&&!V)m[g++]=this.readCorner3(C,A)&255,v-=2,k+=2,V=!0;else if(v===C-2&&k===0&&(A&7)===4&&!X)m[g++]=this.readCorner4(C,A)&255,v-=2,k+=2,X=!0;else{do v<C&&k>=0&&!this.readMappingMatrix.get(k,v)&&(m[g++]=this.readUtah(v,k,C,A)&255),v-=2,k+=2;while(v>=0&&k<A);v+=1,k+=3;do v>=0&&k<A&&!this.readMappingMatrix.get(k,v)&&(m[g++]=this.readUtah(v,k,C,A)&255),v+=2,k-=2;while(v<C&&k>=0);v+=3,k+=1}while(v<C||k<A);if(g!==this.version.getTotalCodewords())throw new P;return m}readModule(m,g,v,k){return m<0&&(m+=v,g+=4-(v+4&7)),g<0&&(g+=k,m+=4-(k+4&7)),this.readMappingMatrix.set(g,m),this.mappingBitMatrix.get(g,m)}readUtah(m,g,v,k){let C=0;return this.readModule(m-2,g-2,v,k)&&(C|=1),C<<=1,this.readModule(m-2,g-1,v,k)&&(C|=1),C<<=1,this.readModule(m-1,g-2,v,k)&&(C|=1),C<<=1,this.readModule(m-1,g-1,v,k)&&(C|=1),C<<=1,this.readModule(m-1,g,v,k)&&(C|=1),C<<=1,this.readModule(m,g-2,v,k)&&(C|=1),C<<=1,this.readModule(m,g-1,v,k)&&(C|=1),C<<=1,this.readModule(m,g,v,k)&&(C|=1),C}readCorner1(m,g){let v=0;return this.readModule(m-1,0,m,g)&&(v|=1),v<<=1,this.readModule(m-1,1,m,g)&&(v|=1),v<<=1,this.readModule(m-1,2,m,g)&&(v|=1),v<<=1,this.readModule(0,g-2,m,g)&&(v|=1),v<<=1,this.readModule(0,g-1,m,g)&&(v|=1),v<<=1,this.readModule(1,g-1,m,g)&&(v|=1),v<<=1,this.readModule(2,g-1,m,g)&&(v|=1),v<<=1,this.readModule(3,g-1,m,g)&&(v|=1),v}readCorner2(m,g){let v=0;return this.readModule(m-3,0,m,g)&&(v|=1),v<<=1,this.readModule(m-2,0,m,g)&&(v|=1),v<<=1,this.readModule(m-1,0,m,g)&&(v|=1),v<<=1,this.readModule(0,g-4,m,g)&&(v|=1),v<<=1,this.readModule(0,g-3,m,g)&&(v|=1),v<<=1,this.readModule(0,g-2,m,g)&&(v|=1),v<<=1,this.readModule(0,g-1,m,g)&&(v|=1),v<<=1,this.readModule(1,g-1,m,g)&&(v|=1),v}readCorner3(m,g){let v=0;return this.readModule(m-1,0,m,g)&&(v|=1),v<<=1,this.readModule(m-1,g-1,m,g)&&(v|=1),v<<=1,this.readModule(0,g-3,m,g)&&(v|=1),v<<=1,this.readModule(0,g-2,m,g)&&(v|=1),v<<=1,this.readModule(0,g-1,m,g)&&(v|=1),v<<=1,this.readModule(1,g-3,m,g)&&(v|=1),v<<=1,this.readModule(1,g-2,m,g)&&(v|=1),v<<=1,this.readModule(1,g-1,m,g)&&(v|=1),v}readCorner4(m,g){let v=0;return this.readModule(m-3,0,m,g)&&(v|=1),v<<=1,this.readModule(m-2,0,m,g)&&(v|=1),v<<=1,this.readModule(m-1,0,m,g)&&(v|=1),v<<=1,this.readModule(0,g-2,m,g)&&(v|=1),v<<=1,this.readModule(0,g-1,m,g)&&(v|=1),v<<=1,this.readModule(1,g-1,m,g)&&(v|=1),v<<=1,this.readModule(2,g-1,m,g)&&(v|=1),v<<=1,this.readModule(3,g-1,m,g)&&(v|=1),v}extractDataRegion(m){const g=this.version.getSymbolSizeRows(),v=this.version.getSymbolSizeColumns();if(m.getHeight()!==g)throw new f("Dimension of bitMatrix must match the version size");const k=this.version.getDataRegionSizeRows(),C=this.version.getDataRegionSizeColumns(),A=g/k|0,I=v/C|0,$=A*k,V=I*C,X=new U(V,$);for(let ne=0;ne<A;++ne){const ie=ne*k;for(let he=0;he<I;++he){const ye=he*C;for(let ve=0;ve<k;++ve){const Ce=ne*(k+2)+1+ve,Me=ie+ve;for(let tt=0;tt<C;++tt){const rt=he*(C+2)+1+tt;if(m.get(rt,Ce)){const Xe=ye+tt;X.set(Xe,Me)}}}}}return X}}
2712class cS{constructor(m,g){this.numDataCodewords=m,this.codewords=g}static getDataBlocks(m,g){const v=g.getECBlocks();let k=0;const C=v.getECBlocks();for(let ve of C)k+=ve.getCount();const A=new Array(k);let I=0;for(let ve of C)for(let Ce=0;Ce<ve.getCount();Ce++){const Me=ve.getDataCodewords(),tt=v.getECCodewords()+Me;A[I++]=new cS(Me,new Uint8Array(tt))}const V=A[0].codewords.length-v.getECCodewords(),X=V-1;let ne=0;for(let ve=0;ve<X;ve++)for(let Ce=0;Ce<I;Ce++)A[Ce].codewords[ve]=m[ne++];const ie=g.getVersionNumber()===24,he=ie?8:I;for(let ve=0;ve<he;ve++)A[ve].codewords[V-1]=m[ne++];const ye=A[0].codewords.length;for(let ve=V;ve<ye;ve++)for(let Ce=0;Ce<I;Ce++){const Me=ie?(Ce+8)%I:Ce,tt=ie&&Me>7?ve-1:ve;A[Me].codewords[tt]=m[ne++]}if(ne!==m.length)throw new f;return A}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class uS{constructor(m){this.bytes=m,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(m){if(m<1||m>32||m>this.available())throw new f(""+m);let g=0,v=this.bitOffset,k=this.byteOffset;const C=this.bytes;if(v>0){const A=8-v,I=m<A?m:A,$=A-I,V=255>>8-I<<$;g=(C[k]&V)>>$,m-=I,v+=I,v===8&&(v=0,k++)}if(m>0){for(;m>=8;)g=g<<8|C[k]&255,k++,m-=8;if(m>0){const A=8-m,I=255>>A<<A;g=g<<m|(C[k]&I)>>A,v+=m}}return this.bitOffset=v,this.byteOffset=k,g}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var gi;(function(te){te[te.PAD_ENCODE=0]="PAD_ENCODE",te[te.ASCII_ENCODE=1]="ASCII_ENCODE",te[te.C40_ENCODE=2]="C40_ENCODE",te[te.TEXT_ENCODE=3]="TEXT_ENCODE",te[te.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",te[te.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",te[te.BASE256_ENCODE=6]="BASE256_ENCODE"})(gi||(gi={}));class Td{static decode(m){const g=new uS(m),v=new B,k=new B,C=new Array;let A=gi.ASCII_ENCODE;do if(A===gi.ASCII_ENCODE)A=this.decodeAsciiSegment(g,v,k);else{switch(A){case gi.C40_ENCODE:this.decodeC40Segment(g,v);break;case gi.TEXT_ENCODE:this.decodeTextSegment(g,v);break;case gi.ANSIX12_ENCODE:this.decodeAnsiX12Segment(g,v);break;case gi.EDIFACT_ENCODE:this.decodeEdifactSegment(g,v);break;case gi.BASE256_ENCODE:this.decodeBase256Segment(g,v,C);break;default:throw new P}A=gi.ASCII_ENCODE}while(A!==gi.PAD_ENCODE&&g.available()>0);return k.length()>0&&v.append(k.toString()),new fe(m,v.toString(),C.length===0?null:C,null)}static decodeAsciiSegment(m,g,v){let k=!1;do{let C=m.readBits(8);if(C===0)throw new P;if(C<=128)return k&&(C+=128),g.append(String.fromCharCode(C-1)),gi.ASCII_ENCODE;if(C===129)return gi.PAD_ENCODE;if(C<=229){const A=C-130;A<10&&g.append("0"),g.append(""+A)}else switch(C){case 230:return gi.C40_ENCODE;case 231:return gi.BASE256_ENCODE;case 232:g.append("�");break;case 233:case 234:break;case 235:k=!0;break;case 236:g.append("[)>�05�"),v.insert(0,"��");break;case 237:g.append("[)>�06�"),v.insert(0,"��");break;case 238:return gi.ANSIX12_ENCODE;case 239:return gi.TEXT_ENCODE;case 240:return gi.EDIFACT_ENCODE;case 241:break;default:if(C!==254||m.available()!==0)throw new P;break}}while(m.available()>0);return gi.ASCII_ENCODE}static decodeC40Segment(m,g){let v=!1;const k=[];let C=0;do{if(m.available()===8)return;const A=m.readBits(8);if(A===254)return;this.parseTwoBytes(A,m.readBits(8),k);for(let I=0;I<3;I++){const $=k[I];switch(C){case 0:if($<3)C=$+1;else if($<this.C40_BASIC_SET_CHARS.length){const V=this.C40_BASIC_SET_CHARS[$];v?(g.append(String.fromCharCode(V.charCodeAt(0)+128)),v=!1):g.append(V)}else throw new P;break;case 1:v?(g.append(String.fromCharCode($+128)),v=!1):g.append(String.fromCharCode($)),C=0;break;case 2:if($<this.C40_SHIFT2_SET_CHARS.length){const V=this.C40_SHIFT2_SET_CHARS[$];v?(g.append(String.fromCharCode(V.charCodeAt(0)+128)),v=!1):g.append(V)}else switch($){case 27:g.append("�");break;case 30:v=!0;break;default:throw new P}C=0;break;case 3:v?(g.append(String.fromCharCode($+224)),v=!1):g.append(String.fromCharCode($+96)),C=0;break;default:throw new P}}}while(m.available()>0)}static decodeTextSegment(m,g){let v=!1,k=[],C=0;do{if(m.available()===8)return;const A=m.readBits(8);if(A===254)return;this.parseTwoBytes(A,m.readBits(8),k);for(let I=0;I<3;I++){const $=k[I];switch(C){case 0:if($<3)C=$+1;else if($<this.TEXT_BASIC_SET_CHARS.length){const V=this.TEXT_BASIC_SET_CHARS[$];v?(g.append(String.fromCharCode(V.charCodeAt(0)+128)),v=!1):g.append(V)}else throw new P;break;case 1:v?(g.append(String.fromCharCode($+128)),v=!1):g.append(String.fromCharCode($)),C=0;break;case 2:if($<this.TEXT_SHIFT2_SET_CHARS.length){const V=this.TEXT_SHIFT2_SET_CHARS[$];v?(g.append(String.fromCharCode(V.charCodeAt(0)+128)),v=!1):g.append(V)}else switch($){case 27:g.append("�");break;case 30:v=!0;break;default:throw new P}C=0;break;case 3:if($<this.TEXT_SHIFT3_SET_CHARS.length){const V=this.TEXT_SHIFT3_SET_CHARS[$];v?(g.append(String.fromCharCode(V.charCodeAt(0)+128)),v=!1):g.append(V),C=0}else throw new P;break;default:throw new P}}}while(m.available()>0)}static decodeAnsiX12Segment(m,g){const v=[];do{if(m.available()===8)return;const k=m.readBits(8);if(k===254)return;this.parseTwoBytes(k,m.readBits(8),v);for(let C=0;C<3;C++){const A=v[C];switch(A){case 0:g.append("\r");break;case 1:g.append("*");break;case 2:g.append(">");break;case 3:g.append(" ");break;default:if(A<14)g.append(String.fromCharCode(A+44));else if(A<40)g.append(String.fromCharCode(A+51));else throw new P;break}}}while(m.available()>0)}static parseTwoBytes(m,g,v){let k=(m<<8)+g-1,C=Math.floor(k/1600);v[0]=C,k-=C*1600,C=Math.floor(k/40),v[1]=C,v[2]=k-C*40}static decodeEdifactSegment(m,g){do{if(m.available()<=16)return;for(let v=0;v<4;v++){let k=m.readBits(6);if(k===31){const C=8-m.getBitOffset();C!==8&&m.readBits(C);return}k&32||(k|=64),g.append(String.fromCharCode(k))}}while(m.available()>0)}static decodeBase256Segment(m,g,v){let k=1+m.getByteOffset();const C=this.unrandomize255State(m.readBits(8),k++);let A;if(C===0?A=m.available()/8|0:C<250?A=C:A=250*(C-249)+this.unrandomize255State(m.readBits(8),k++),A<0)throw new P;const I=new Uint8Array(A);for(let $=0;$<A;$++){if(m.available()<8)throw new P;I[$]=this.unrandomize255State(m.readBits(8),k++)}v.push(I);try{g.append(L.decode(I,M.ISO88591))}catch($){throw new Ne("Platform does not support required encoding: "+$.message)}}static unrandomize255State(m,g){const v=149*g%255+1,k=m-v;return k>=0?k:k+256}}Td.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Td.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Td.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],Td.TEXT_SHIFT2_SET_CHARS=Td.C40_SHIFT2_SET_CHARS,Td.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~","�"];class qfe{constructor(){this.rsDecoder=new it(Te.DATA_MATRIX_FIELD_256)}decode(m){const g=new lS(m),v=g.getVersion(),k=g.readCodewords(),C=cS.getDataBlocks(k,v);let A=0;for(let V of C)A+=V.getNumDataCodewords();const I=new Uint8Array(A),$=C.length;for(let V=0;V<$;V++){const X=C[V],ne=X.getCodewords(),ie=X.getNumDataCodewords();this.correctErrors(ne,ie);for(let he=0;he<ie;he++)I[he*$+V]=ne[he]}return Td.decode(I)}correctErrors(m,g){const v=new Int32Array(m);try{this.rsDecoder.decode(v,m.length-g)}catch{throw new p}for(let k=0;k<g;k++)m[k]=v[k]}}class qs{constructor(m){this.image=m,this.rectangleDetector=new Ae(this.image)}detect(){const m=this.rectangleDetector.detect();let g=this.detectSolid1(m);if(g=this.detectSolid2(g),g[3]=this.correctTopRight(g),!g[3])throw new F;g=this.shiftToModuleCenter(g);const v=g[0],k=g[1],C=g[2],A=g[3];let I=this.transitionsBetween(v,A)+1,$=this.transitionsBetween(C,A)+1;(I&1)===1&&(I+=1),($&1)===1&&($+=1),4*I<7*$&&4*$<7*I&&(I=$=Math.max(I,$));let V=qs.sampleGrid(this.image,v,k,C,A,I,$);return new ke(V,[v,k,C,A])}static shiftPoint(m,g,v){let k=(g.getX()-m.getX())/(v+1),C=(g.getY()-m.getY())/(v+1);return new me(m.getX()+k,m.getY()+C)}static moveAway(m,g,v){let k=m.getX(),C=m.getY();return k<g?k-=1:k+=1,C<v?C-=1:C+=1,new me(k,C)}detectSolid1(m){let g=m[0],v=m[1],k=m[3],C=m[2],A=this.transitionsBetween(g,v),I=this.transitionsBetween(v,k),$=this.transitionsBetween(k,C),V=this.transitionsBetween(C,g),X=A,ne=[C,g,v,k];return X>I&&(X=I,ne[0]=g,ne[1]=v,ne[2]=k,ne[3]=C),X>$&&(X=$,ne[0]=v,ne[1]=k,ne[2]=C,ne[3]=g),X>V&&(ne[0]=k,ne[1]=C,ne[2]=g,ne[3]=v),ne}detectSolid2(m){let g=m[0],v=m[1],k=m[2],C=m[3],A=this.transitionsBetween(g,C),I=qs.shiftPoint(v,k,(A+1)*4),$=qs.shiftPoint(k,v,(A+1)*4),V=this.transitionsBetween(I,g),X=this.transitionsBetween($,C);return V<X?(m[0]=g,m[1]=v,m[2]=k,m[3]=C):(m[0]=v,m[1]=k,m[2]=C,m[3]=g),m}correctTopRight(m){let g=m[0],v=m[1],k=m[2],C=m[3],A=this.transitionsBetween(g,C),I=this.transitionsBetween(v,C),$=qs.shiftPoint(g,v,(I+1)*4),V=qs.shiftPoint(k,v,(A+1)*4);
2712A=this.transitionsBetween($,C),I=this.transitionsBetween(V,C);let X=new me(C.getX()+(k.getX()-v.getX())/(A+1),C.getY()+(k.getY()-v.getY())/(A+1)),ne=new me(C.getX()+(g.getX()-v.getX())/(I+1),C.getY()+(g.getY()-v.getY())/(I+1));if(!this.isValid(X))return this.isValid(ne)?ne:null;if(!this.isValid(ne))return X;let ie=this.transitionsBetween($,X)+this.transitionsBetween(V,X),he=this.transitionsBetween($,ne)+this.transitionsBetween(V,ne);return ie>he?X:ne}shiftToModuleCenter(m){let g=m[0],v=m[1],k=m[2],C=m[3],A=this.transitionsBetween(g,C)+1,I=this.transitionsBetween(k,C)+1,$=qs.shiftPoint(g,v,I*4),V=qs.shiftPoint(k,v,A*4);A=this.transitionsBetween($,C)+1,I=this.transitionsBetween(V,C)+1,(A&1)===1&&(A+=1),(I&1)===1&&(I+=1);let X=(g.getX()+v.getX()+k.getX()+C.getX())/4,ne=(g.getY()+v.getY()+k.getY()+C.getY())/4;g=qs.moveAway(g,X,ne),v=qs.moveAway(v,X,ne),k=qs.moveAway(k,X,ne),C=qs.moveAway(C,X,ne);let ie,he;return $=qs.shiftPoint(g,v,I*4),$=qs.shiftPoint($,C,A*4),ie=qs.shiftPoint(v,g,I*4),ie=qs.shiftPoint(ie,k,A*4),V=qs.shiftPoint(k,C,I*4),V=qs.shiftPoint(V,v,A*4),he=qs.shiftPoint(C,k,I*4),he=qs.shiftPoint(he,g,A*4),[$,ie,V,he]}isValid(m){return m.getX()>=0&&m.getX()<this.image.getWidth()&&m.getY()>0&&m.getY()<this.image.getHeight()}static sampleGrid(m,g,v,k,C,A,I){return Ve.getInstance().sampleGrid(m,A,I,.5,.5,A-.5,.5,A-.5,I-.5,.5,I-.5,g.getX(),g.getY(),C.getX(),C.getY(),k.getX(),k.getY(),v.getX(),v.getY())}transitionsBetween(m,g){let v=Math.trunc(m.getX()),k=Math.trunc(m.getY()),C=Math.trunc(g.getX()),A=Math.trunc(g.getY()),I=Math.abs(A-k)>Math.abs(C-v);if(I){let ve=v;v=k,k=ve,ve=C,C=A,A=ve}let $=Math.abs(C-v),V=Math.abs(A-k),X=-$/2,ne=k<A?1:-1,ie=v<C?1:-1,he=0,ye=this.image.get(I?k:v,I?v:k);for(let ve=v,Ce=k;ve!==C;ve+=ie){let Me=this.image.get(I?Ce:ve,I?ve:Ce);if(Me!==ye&&(he++,ye=Me),X+=V,X>0){if(Ce===A)break;Ce+=ne,X-=$}}return he}}class Pd{constructor(){this.decoder=new qfe}decode(m,g=null){let v,k;if(g!=null&&g.has(T.PURE_BARCODE)){const V=Pd.extractPureBits(m.getBlackMatrix());v=this.decoder.decode(V),k=Pd.NO_POINTS}else{const V=new qs(m.getBlackMatrix()).detect();v=this.decoder.decode(V.getBits()),k=V.getPoints()}const C=v.getRawBytes(),A=new Z(v.getText(),C,8*C.length,k,se.DATA_MATRIX,y.currentTimeMillis()),I=v.getByteSegments();I!=null&&A.putMetadata(le.BYTE_SEGMENTS,I);const $=v.getECLevel();return $!=null&&A.putMetadata(le.ERROR_CORRECTION_LEVEL,$),A}reset(){}static extractPureBits(m){const g=m.getTopLeftOnBit(),v=m.getBottomRightOnBit();if(g==null||v==null)throw new F;const k=this.moduleSize(g,m);let C=g[1];const A=v[1];let I=g[0];const V=(v[0]-I+1)/k,X=(A-C+1)/k;
2712if(V<=0||X<=0)throw new F;const ne=k/2;C+=ne,I+=ne;const ie=new U(V,X);for(let he=0;he<X;he++){const ye=C+he*k;for(let ve=0;ve<V;ve++)m.get(I+ve*k,ye)&&ie.set(ve,he)}return ie}static moduleSize(m,g){const v=g.getWidth();let k=m[0];const C=m[1];for(;k<v&&g.get(k,C);)k++;if(k===v)throw new F;const A=k-m[0];if(A===0)throw new F;return A}}Pd.NO_POINTS=[];class Vfe extends Y{constructor(m=500){super(new Pd,m)}}var Ap;(function(te){te[te.L=0]="L",te[te.M=1]="M",te[te.Q=2]="Q",te[te.H=3]="H"})(Ap||(Ap={}));class Hr{constructor(m,g,v){this.value=m,this.stringValue=g,this.bits=v,Hr.FOR_BITS.set(v,this),Hr.FOR_VALUE.set(m,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(m){switch(m){case"L":return Hr.L;case"M":return Hr.M;case"Q":return Hr.Q;case"H":return Hr.H;default:throw new d(m+"not available")}}toString(){return this.stringValue}equals(m){if(!(m instanceof Hr))return!1;const g=m;return this.value===g.value}static forBits(m){if(m<0||m>=Hr.FOR_BITS.size)throw new f;return Hr.FOR_BITS.get(m)}}Hr.FOR_BITS=new Map,Hr.FOR_VALUE=new Map,Hr.L=new Hr(Ap.L,"L",1),Hr.M=new Hr(Ap.M,"M",0),Hr.Q=new Hr(Ap.Q,"Q",3),Hr.H=new Hr(Ap.H,"H",2);class ha{constructor(m){this.errorCorrectionLevel=Hr.forBits(m>>3&3),this.dataMask=m&7}static numBitsDiffering(m,g){return j.bitCount(m^g)}static decodeFormatInformation(m,g){const v=ha.doDecodeFormatInformation(m,g);return v!==null?v:ha.doDecodeFormatInformation(m^ha.FORMAT_INFO_MASK_QR,g^ha.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(m,g){let v=Number.MAX_SAFE_INTEGER,k=0;for(const C of ha.FORMAT_INFO_DECODE_LOOKUP){const A=C[0];if(A===m||A===g)return new ha(C[1]);let I=ha.numBitsDiffering(m,A);
vendor: 5,106 bytes, line 2712
2712I<v&&(k=C[1],v=I),m!==g&&(I=ha.numBitsDiffering(g,A),I<v&&(k=C[1],v=I))}return v<=3?new ha(k):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(m){if(!(m instanceof ha))return!1;const g=m;return this.errorCorrectionLevel===g.errorCorrectionLevel&&this.dataMask===g.dataMask}}ha.FORMAT_INFO_MASK_QR=21522,ha.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class Ee{constructor(m,...g){this.ecCodewordsPerBlock=m,this.ecBlocks=g}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let m=0;const g=this.ecBlocks;for(const v of g)m+=v.getCount();return m}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class ue{constructor(m,g){this.count=m,this.dataCodewords=g}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Ft{constructor(m,g,...v){this.versionNumber=m,this.alignmentPatternCenters=g,this.ecBlocks=v;let k=0;const C=v[0].getECCodewordsPerBlock(),A=v[0].getECBlocks();for(const I of A)k+=I.getCount()*(I.getDataCodewords()+C);this.totalCodewords=k}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(m){return this.ecBlocks[m.getValue()]}static getProvisionalVersionForDimension(m){if(m%4!==1)throw new P;try{return this.getVersionForNumber((m-17)/4)}catch{throw new P}}static getVersionForNumber(m){if(m<1||m>40)throw new f;return Ft.VERSIONS[m-1]}static decodeVersionInformation(m){let g=Number.MAX_SAFE_INTEGER,v=0;for(let k=0;k<Ft.VERSION_DECODE_INFO.length;k++){const C=Ft.VERSION_DECODE_INFO[k];if(C===m)return Ft.getVersionForNumber(k+7);const A=ha.numBitsDiffering(m,C);A<g&&(v=k+7,g=A)}return g<=3?Ft.getVersionForNumber(v):null}buildFunctionPattern(){const m=this.getDimensionForVersion(),g=new U(m);g.setRegion(0,0,9,9),g.setRegion(m-8,0,8,9),g.setRegion(0,m-8,9,8);const v=this.alignmentPatternCenters.length;for(let k=0;k<v;k++){const C=this.alignmentPatternCenters[k]-2;for(let A=0;A<v;A++)k===0&&(A===0||A===v-1)||k===v-1&&A===0||g.setRegion(this.alignmentPatternCenters[A]-2,C,5,5)}return g.setRegion(6,9,1,m-17),g.setRegion(9,6,m-17,1),this.versionNumber>6&&(g.setRegion(m-11,0,3,6),g.setRegion(0,m-11,6,3)),g}toString(){return""+this.versionNumber}}Ft.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),Ft.VERSIONS=[new Ft(1,new Int32Array(0),new Ee(7,new ue(1,19)),new Ee(10,new ue(1,16)),new Ee(13,new ue(1,13)),new Ee(17,new ue(1,9))),new Ft(2,Int32Array.from([6,18]),new Ee(10,new ue(1,34)),new Ee(16,new ue(1,28)),new Ee(22,new ue(1,22)),new Ee(28,new ue(1,16))),new Ft(3,Int32Array.from([6,22]),new Ee(15,new ue(1,55)),new Ee(26,new ue(1,44)),new Ee(18,new ue(2,17)),new Ee(22,new ue(2,13))),new Ft(4,Int32Array.from([6,26]),new Ee(20,new ue(1,80)),new Ee(18,new ue(2,32)),new Ee(26,new ue(2,24)),new Ee(16,new ue(4,9))),new Ft(5,Int32Array.from([6,30]),new Ee(26,new ue(1,108)),new Ee(24,new ue(2,43)),new Ee(18,new ue(2,15),new ue(2,16)),new Ee(22,new ue(2,11),new ue(2,12))),new Ft(6,Int32Array.from([6,34]),new Ee(18,new ue(2,68)),new Ee(16,new ue(4,27)),new Ee(24,new ue(4,19)),new Ee(28,new ue(4,15))),new Ft(7,Int32Array.from([6,22,38]),new Ee(20,new ue(2,78)),new Ee(18,new ue(4,31)),new Ee(18,new ue(2,14),new ue(4,15)),new Ee(26,new ue(4,13),new ue(1,14))),new Ft(8,Int32Array.from([6,24,42]),new Ee(24,new ue(2,97)),new Ee(22,new ue(2,38),new ue(2,39)),new Ee(22,new ue(4,18),new ue(2,19)),new Ee(26,new ue(4,14),new ue(2,15))),new Ft(9,Int32Array.from([6,26,46]),new Ee(30,new ue(2,116)),new Ee(22,new ue(3,36),new ue(2,37)),new Ee(20,new ue(4,16),new ue(4,17)),new Ee(24,new ue(4,12),new ue(4,13))),new Ft(10,Int32Array.from([6,28,50]),new Ee(18,new ue(2,68),new ue(2,69)),new Ee(26,new ue(4,43),new ue(1,44)),new Ee(24,new ue(6,19),new ue(2,20)),new Ee(28,new ue(6,15),new ue(2,16))
2712),new Ft(11,Int32Array.from([6,30,54]),new Ee(20,new ue(4,81)),new Ee(30,new ue(1,50),new ue(4,51)),new Ee(28,new ue(4,22),new ue(4,23)),new Ee(24,new ue(3,12),new ue(8,13))),new Ft(12,Int32Array.from([6,32,58]),new Ee(24,new ue(2,92),new ue(2,93)),new Ee(22,new ue(6,36),new ue(2,37)),new Ee(26,new ue(4,20),new ue(6,21)),new Ee(28,new ue(7,14),new ue(4,15))),new Ft(13,Int32Array.from([6,34,62]),new Ee(26,new ue(4,107)),new Ee(22,new ue(8,37),new ue(1,38)),new Ee(24,new ue(8,20),new ue(4,21)),new Ee(22,new ue(12,11),new ue(4,12))),new Ft(14,Int32Array.from([6,26,46,66]),new Ee(30,new ue(3,115),new ue(1,116)),new Ee(24,new ue(4,40),new ue(5,41)),new Ee(20,new ue(11,16),new ue(5,17)),new Ee(24,new ue(11,12),new ue(5,13))),new Ft(15,Int32Array.from([6,26,48,70]),new Ee(22,new ue(5,87),new ue(1,88)),new Ee(24,new ue(5,41),new ue(5,42)),new Ee(30,new ue(5,24),new ue(7,25)),new Ee(24,new ue(11,12),new ue(7,13))),new Ft(16,Int32Array.from([6,26,50,74]),new Ee(24,new ue(5,98),new ue(1,99)),new Ee(28,new ue(7,45),new ue(3,46)),new Ee(24,new ue(15,19),new ue(2,20)),new Ee(30,new ue(3,15),new ue(13,16))),new Ft(17,Int32Array.from([6,30,54,78]),new Ee(28,new ue(1,107),new ue(5,108)),new Ee(28,new ue(10,46),new ue(1,47)),new Ee(28,new ue(1,22),new ue(15,23)),new Ee(28,new ue(2,14),new ue(17,15))),new Ft(18,Int32Array.from([6,30,56,82]),new Ee(30,new ue(5,120),new ue(1,121)),new Ee(26,new ue(9,43),new ue(4,44)),new Ee(28,new ue(17,22),new ue(1,23)),new Ee(28,new ue(2,14),new ue(19,15))),new Ft(19,Int32Array.from([6,30,58,86]),new Ee(28,new ue(3,113),new ue(4,114)),new Ee(26,new ue(3,44),new ue(11,45)),new Ee(26,new ue(17,21),new ue(4,22)),new Ee(26,new ue(9,13),new ue(16,14))),new Ft(20,Int32Array.from([6,34,62,90]),new Ee(28,new ue(3,107),new ue(5,108)),new Ee(26,new ue(3,41),new ue(13,42)),new Ee(30,new ue(15,24),new ue(5,25)),new Ee(28,new ue(15,15),new ue(10,16))),new Ft(21,Int32Array.from([6,28,50,72,94]),new Ee(28,new ue(4,116),new ue(4,117)),new Ee(26,new ue(17,42)),new Ee(28,new ue(17,22),new ue(6,23)),new Ee(30,new ue(19,16),new ue(6,17))),new Ft(22,Int32Array.from([6,26,50,74,98]),new Ee(28,new ue(2,111),new ue(7,112)),new Ee(28,new ue(17,46)),new Ee(30,new ue(7,24),new ue(16,25)),new Ee(24,new ue(34,13))),new Ft(23,Int32Array.from([6,30,54,78,102]),new Ee(30,new ue(4,121),new ue(5,122)),new Ee(28,new ue(4,47),new ue(14,48)),new Ee(30,new ue(11,24),new ue(14,25)),new Ee(30,new ue(16,15),new ue(14,16))),new Ft(24,Int32Array.from([6,28,54,80,106]),new Ee(30,new ue(6,117),new ue(4,118)),new Ee(28,new ue(6,45),new ue(14,46)),new Ee(30,new ue(11,24),new ue(16,25)),new Ee(30,new ue(30,16),new ue(2,17))),new Ft(25,Int32Array.from([6,32,58,84,110]),new Ee(26,new ue(8,106),new ue(4,107)),new Ee(28,new ue(8,47),new ue(13,48)),new Ee(30,new ue(7,24),new ue(22,25)),new Ee(30,new ue(22,15),new ue(13,16))),new Ft(26,Int32Array.from([6,30,58,86,114]),new Ee(28,new ue(10,114),new ue(2,115)),new Ee(28,new ue(19,46),new ue(4,47)),new Ee(28,new ue(28,22),new ue(6,23)),new Ee(30,new ue(33,16),new ue(4,17))),new Ft(27,Int32Array.from([6,34,62,90,118]),new Ee(30,new ue(8,122),new ue(4,123)),new Ee(28,new ue(22,45),new ue(3,46)),new Ee(30,new ue(8,23),new ue(26,24)),new Ee(30,new ue(12,15),new ue(28,16))),new Ft(28,Int32Array.from([6,26,50,74,98,122]),new Ee(30,new ue(3,117),new ue(10,118)),new Ee(28,new ue(3,45),new ue(23,46)),new Ee(30,new ue(4,24),new ue(31,25)),new Ee(30,new ue(11,15),new ue(31,16))),new Ft(29,Int32Array.from([6,30,54,78,102,126]),new Ee(30,new ue(7,116),new ue(7,117)),new Ee(28,new ue(21,45),new ue(7,46)),new Ee(30,new ue(1,23),new ue(37,24)),new Ee(30,new ue(19,15),new ue(26,16))),new Ft(30,Int32Array.from([6,26,52,78,104,130]),new Ee(30,new ue(5,115),new ue(10,116)),new Ee(28,new ue(19,47),new ue(10,48)),new Ee(30,new ue(15,24),new ue(25,25)),new Ee(30,new ue(23,15),new ue(25,16))),new Ft(31,Int32Array.from([6,30,56,82,108,134]),new Ee(30,new ue(13,115),new ue(3,116)),new Ee(28,new ue(2,46),new ue(29,47)),new Ee(30,new ue(42,24),new ue(1,25)),new Ee(30,new ue(23,15),new ue(28,16))),new Ft(32,Int32Array.from([6,34,60,86,112,138]),new Ee(30,new ue(17,115)),new Ee(28,new ue(10,46),new ue(23,47)),new Ee(30,new ue(10,24),new ue(35,25)),new Ee(30,new ue(19,15),new ue(35,16))),new Ft(33,Int32Array.from([6,30,58,86,114,142]),new Ee(30,new ue(17,115),new ue(1,116)),new Ee(28,new ue(14,46),new ue(21,47)),new Ee(30,new ue(29,24),new ue(19,25)),new Ee(30,new ue(11,15),new ue(46,16))),new Ft(34,Int32Array.from([6,34,62,90,118,146]),new Ee(30,new ue(13,115),new ue(6,116)),new Ee(28,new ue(14,46),new ue(23,47)),new Ee(30,new ue(44,24),new ue(7,25)),new Ee(30,new ue(59,16),new ue(1,17))),new Ft(35,Int32Array.from([6,30,54,78,102,126,150]),new Ee(30,new ue(12,121),new ue(7,122)),new Ee(28,new ue(12,47),new ue(26,48)),new Ee(30,new ue(39,24),new ue(14,25)),new Ee(30,new ue(22,15),new ue(41,16))),new Ft(36,Int32Array.from([6,24,50,76,102,128,154]),new Ee(30,new ue(6,121),new ue(14,122)),new Ee(28,new ue(6,47),new ue(34,48)),new Ee(30,new ue(46,24),new ue(10,25)),new Ee(30,new ue(2,15),new ue(64,16))
2712),new Ft(37,Int32Array.from([6,28,54,80,106,132,158]),new Ee(30,new ue(17,122),new ue(4,123)),new Ee(28,new ue(29,46),new ue(14,47)),new Ee(30,new ue(49,24),new ue(10,25)),new Ee(30,new ue(24,15),new ue(46,16))),new Ft(38,Int32Array.from([6,32,58,84,110,136,162]),new Ee(30,new ue(4,122),new ue(18,123)),new Ee(28,new ue(13,46),new ue(32,47)),new Ee(30,new ue(48,24),new ue(14,25)),new Ee(30,new ue(42,15),new ue(32,16))),new Ft(39,Int32Array.from([6,26,54,82,110,138,166]),new Ee(30,new ue(20,117),new ue(4,118)),new Ee(28,new ue(40,47),new ue(7,48)),new Ee(30,new ue(43,24),new ue(22,25)),new Ee(30,new ue(10,15),new ue(67,16))),new Ft(40,Int32Array.from([6,30,58,86,114,142,170]),new Ee(30,new ue(19,118),new ue(6,119)),new Ee(28,new ue(18,47),new ue(31,48)),new Ee(30,new ue(34,24),new ue(34,25)),new Ee(30,new ue(20,15),new ue(61,16)))];var Di;(function(te){te[te.DATA_MASK_000=0]="DATA_MASK_000",te[te.DATA_MASK_001=1]="DATA_MASK_001",te[te.DATA_MASK_010=2]="DATA_MASK_010",te[te.DATA_MASK_011=3]="DATA_MASK_011",te[te.DATA_MASK_100=4]="DATA_MASK_100",te[te.DATA_MASK_101=5]="DATA_MASK_101",te[te.DATA_MASK_110=6]="DATA_MASK_110",te[te.DATA_MASK_111=7]="DATA_MASK_111"})(Di||(Di={}));class il{constructor(m,g){this.value=m,this.isMasked=g}unmaskBitMatrix(m,g){for(let v=0;v<g;v++)for(let k=0;k<g;k++)this.isMasked(v,k)&&m.flip(k,v)}}il.values=new Map([[Di.DATA_MASK_000,new il(Di.DATA_MASK_000,(te,m)=>(te+m&1)===0)],[Di.DATA_MASK_001,new il(Di.DATA_MASK_001,(te,m)=>(te&1)===0)],[Di.DATA_MASK_010,new il(Di.DATA_MASK_010,(te,m)=>m%3===0)],[Di.DATA_MASK_011,new il(Di.DATA_MASK_011,(te,m)=>(te+m)%3===0)],[Di.DATA_MASK_100,new il(Di.DATA_MASK_100,(te,m)=>(Math.floor(te/2)+Math.floor(m/3)&1)===0)],[Di.DATA_MASK_101,new il(Di.DATA_MASK_101,(te,m)=>te*m%6===0)],[Di.DATA_MASK_110,new il(Di.DATA_MASK_110,(te,m)=>te*m%6<3)],[Di.DATA_MASK_111,new il(Di.DATA_MASK_111,(te,m)=>(te+m+te*m%3&1)===0)]]);class Hfe{constructor(m){const g=m.getHeight();if(g<21||(g&3)!==1)throw new P;this.bitMatrix=m}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let m=0;for(let C=0;C<6;C++)m=this.copyBit(C,8,m);m=this.copyBit(7,8,m),m=this.copyBit(8,8,m),m=this.copyBit(8,7,m);for(let C=5;C>=0;C--)m=this.copyBit(8,C,m);const g=this.bitMatrix.getHeight();let v=0;const k=g-7;for(let C=g-1;C>=k;C--)v=this.copyBit(8,C,v);for(let C=g-8;C<g;C++)v=this.copyBit(C,8,v);if(this.parsedFormatInfo=ha.decodeFormatInformation(m,v),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new P}readVersion(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;const m=this.bitMatrix.getHeight(),g=Math.floor((m-17)/4);if(g<=6)return Ft.getVersionForNumber(g);let v=0;const k=m-11;for(let A=5;A>=0;A--)for(let I=m-9;I>=k;I--)v=this.copyBit(I,A,v);let C=Ft.decodeVersionInformation(v);if(C!==null&&C.getDimensionForVersion()===m)return this.parsedVersion=C,C;v=0;for(let A=5;A>=0;A--)for(let I=m-9;I>=k;I--)v=this.copyBit(A,I,v);if(C=Ft.decodeVersionInformation(v),C!==null&&C.getDimensionForVersion()===m)return this.parsedVersion=C,C;throw new P}copyBit(m,g,v){return(this.isMirror?this.bitMatrix.get(g,m):this.bitMatrix.get(m,g))?v<<1|1:v<<1}readCodewords(){const m=this.readFormatInformation(),g=this.readVersion(),v=il.values.get(m.getDataMask()),k=this.bitMatrix.getHeight();v.unmaskBitMatrix(this.bitMatrix,k);const C=g.buildFunctionPattern();let A=!0;const I=new Uint8Array(g.getTotalCodewords());let $=0,V=0,X=0;for(let ne=k-1;ne>0;ne-=2){ne===6&&ne--;for(let ie=0;ie<k;ie++){const he=A?k-1-ie:ie;for(let ye=0;ye<2;ye++)C.get(ne-ye,he)||(X++,V<<=1,this.bitMatrix.get(ne-ye,he)&&(V|=1),X===8&&(I[$++]=V,X=0,V=0))}A=!A}if($!==g.getTotalCodewords())throw new P;return I}remask(){if(this.parsedFormatInfo===null)return;const m=il.values[this.parsedFormatInfo.getDataMask()],g=this.bitMatrix.getHeight();m.unmaskBitMatrix(this.bitMatrix,g)}setMirror(m){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=m}mirror(){const m=this.bitMatrix;for(let g=0,v=m.getWidth();g<v;g++)for(let k=g+1,C=m.getHeight();k<C;k++)m.get(g,k)!==m.get(k,g)&&(m.flip(k,g),m.flip(g,k))}}
2712class dS{constructor(m,g){this.numDataCodewords=m,this.codewords=g}static getDataBlocks(m,g,v){if(m.length!==g.getTotalCodewords())throw new f;const k=g.getECBlocksForLevel(v);let C=0;const A=k.getECBlocks();for(const ye of A)C+=ye.getCount();const I=new Array(C);let $=0;for(const ye of A)for(let ve=0;ve<ye.getCount();ve++){const Ce=ye.getDataCodewords(),Me=k.getECCodewordsPerBlock()+Ce;I[$++]=new dS(Ce,new Uint8Array(Me))}const V=I[0].codewords.length;let X=I.length-1;for(;X>=0&&I[X].codewords.length!==V;)X--;X++;const ne=V-k.getECCodewordsPerBlock();let ie=0;for(let ye=0;ye<ne;ye++)for(let ve=0;ve<$;ve++)I[ve].codewords[ye]=m[ie++];for(let ye=X;ye<$;ye++)I[ye].codewords[ne]=m[ie++];const he=I[0].codewords.length;for(let ye=ne;ye<he;ye++)for(let ve=0;ve<$;ve++){const Ce=ve<X?ye:ye+1;I[ve].codewords[Ce]=m[ie++]}return I}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var al;(function(te){te[te.TERMINATOR=0]="TERMINATOR",te[te.NUMERIC=1]="NUMERIC",te[te.ALPHANUMERIC=2]="ALPHANUMERIC",te[te.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",te[te.BYTE=4]="BYTE",te[te.ECI=5]="ECI",te[te.KANJI=6]="KANJI",te[te.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",te[te.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",te[te.HANZI=9]="HANZI"})(al||(al={}));class Ut{constructor(m,g,v,k){this.value=m,this.stringValue=g,this.characterCountBitsForVersions=v,this.bits=k,Ut.FOR_BITS.set(k,this),Ut.FOR_VALUE.set(m,this)}static forBits(m){const g=Ut.FOR_BITS.get(m);if(g===void 0)throw new f;return g}getCharacterCountBits(m){const g=m.getVersionNumber();let v;return g<=9?v=0:g<=26?v=1:v=2,this.characterCountBitsForVersions[v]}getValue(){return this.value}getBits(){return this.bits}equals(m){if(!(m instanceof Ut))return!1;const g=m;return this.value===g.value}toString(){return this.stringValue}}Ut.FOR_BITS=new Map,Ut.FOR_VALUE=new Map,Ut.TERMINATOR=new Ut(al.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Ut.NUMERIC=new Ut(al.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Ut.ALPHANUMERIC=new Ut(al.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Ut.STRUCTURED_APPEND=new Ut(al.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Ut.BYTE=new Ut(al.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Ut.ECI=new Ut(al.ECI,"ECI",Int32Array.from([0,0,0]),7),Ut.KANJI=new Ut(al.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Ut.FNC1_FIRST_POSITION=new Ut(al.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Ut.FNC1_SECOND_POSITION=new Ut(al.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Ut.HANZI=new Ut(al.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class gs{static decode(m,g,v,k){const C=new uS(m);let A=new B;const I=new Array;let $=-1,V=-1;try{let X=null,ne=!1,ie;do{if(C.available()<4)ie=Ut.TERMINATOR;else{const he=C.readBits(4);ie=Ut.forBits(he)}switch(ie){case Ut.TERMINATOR:break;case Ut.FNC1_FIRST_POSITION:case Ut.FNC1_SECOND_POSITION:ne=!0;break;case Ut.STRUCTURED_APPEND:if(C.available()<16)throw new P;$=C.readBits(8),V=C.readBits(8);break;case Ut.ECI:const he=gs.parseECIValue(C);if(X=D.getCharacterSetECIByValue(he),X===null)throw new P;break;case Ut.HANZI:const ye=C.readBits(4),ve=C.readBits(ie.getCharacterCountBits(g));ye===gs.GB2312_SUBSET&&gs.decodeHanziSegment(C,A,ve);break;default:const Ce=C.readBits(ie.getCharacterCountBits(g));switch(ie){case Ut.NUMERIC:gs.decodeNumericSegment(C,A,Ce);break;case Ut.ALPHANUMERIC:gs.decodeAlphanumericSegment(C,A,Ce,ne);break;case Ut.BYTE:gs.decodeByteSegment(C,A,Ce,X,I,k);break;case Ut.KANJI:gs.decodeKanjiSegment(C,A,Ce);break;default:throw new P}break}}while(ie!==Ut.TERMINATOR)}catch{throw new P}return new fe(m,A.toString(),I.length===0?null:I,v===null?null:v.toString(),$,V)}static decodeHanziSegment(m,g,v){if(v*13>m.available())throw new P;const k=new Uint8Array(2*v);let C=0;for(;v>0;){const A=m.readBits(13);let I=A/96<<8&4294967295|A%96;I<959?I+=41377:I+=42657,k[C]=I>>8&255,k[C+1]=I&255,C+=2,v--}try{g.append(L.decode(k,M.GB2312))}catch(A){throw new P(A)}}static decodeKanjiSegment(m,g,v){if(v*13>m.available())throw new P;const k=new Uint8Array(2*v);let C=0;for(;v>0;){const A=m.readBits(13);let I=A/192<<8&4294967295|A%192;I<7936?I+=33088:I+=49472,k[C]=I>>8,k[C+1]=I,C+=2,v--}try{g.append(L.decode(k,M.SHIFT_JIS))}catch(A){throw new P(A)}}static decodeByteSegment(m,g,v,k,C,A){if(8*v>m.available())throw new P;const I=new Uint8Array(v);for(let V=0;V<v;V++)I[V]=m.readBits(8);let $;k===null?$=M.guessEncoding(I,A):$=k.getName();try{g.append(L.decode(I,$))}catch(V){throw new P(V)}C.push(I)}static toAlphaNumericChar(m){if(m>=gs.ALPHANUMERIC_CHARS.length)throw new P;return gs.ALPHANUMERIC_CHARS[m]}static decodeAlphanumericSegment(m,g,v,k){const C=g.length();for(;v>1;){if(m.available()<11)throw new P;const A=m.readBits(11);g.append(gs.toAlphaNumericChar(Math.floor(A/45))),g.append(gs.toAlphaNumericChar(A%45)),v-=2}if(v===1){if(m.available()<6)throw new P;g.append(gs.toAlphaNumericChar(m.readBits(6)))}if(k)for(let A=C;A<g.length();A++)g.charAt(A)==="%"&&(A<g.length()-1&&g.charAt(A+1)==="%"?g.deleteCharAt(A+1):g.setCharAt(A,"�"))}static decodeNumericSegment(m,g,v){for(;v>=3;){if(m.available()<10)throw new P;const k=m.readBits(10);if(k>=1e3)throw new P;g.append(gs.toAlphaNumericChar(Math.floor(k/100))),g.append(gs.toAlphaNumericChar(Math.floor(k/10)%10)),g.append(gs.toAlphaNumericChar(k%10)),v-=3}if(v===2){if(m.available()<7)throw new P;const k=m.readBits(7);if(k>=100)throw new P;g.append(gs.toAlphaNumericChar(Math.floor(k/10))),g.append(gs.toAlphaNumericChar(k%10))}else if(v===1){if(m.available()<4)throw new P;const k=m.readBits(4);if(k>=10)throw new P;g.append(gs.toAlphaNumericChar(k))}}static parseECIValue(m){const g=m.readBits(8);if(!(g&128))return g&127;
2712if((g&192)===128){const v=m.readBits(8);return(g&63)<<8&4294967295|v}if((g&224)===192){const v=m.readBits(16);return(g&31)<<16&4294967295|v}throw new P}}gs.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",gs.GB2312_SUBSET=1;class V8{constructor(m){this.mirrored=m}isMirrored(){return this.mirrored}applyMirroredCorrection(m){if(!this.mirrored||m===null||m.length<3)return;const g=m[0];m[0]=m[2],m[2]=g}}class Wfe{constructor(){this.rsDecoder=new it(Te.QR_CODE_FIELD_256)}decodeBooleanArray(m,g){return this.decodeBitMatrix(U.parseFromBooleanArray(m),g)}decodeBitMatrix(m,g){const v=new Hfe(m);let k=null;try{return this.decodeBitMatrixParser(v,g)}catch(C){k=C}try{v.remask(),v.setMirror(!0),v.readVersion(),v.readFormatInformation(),v.mirror();const C=this.decodeBitMatrixParser(v,g);return C.setOther(new V8(!0)),C}catch(C){throw k!==null?k:C}}decodeBitMatrixParser(m,g){const v=m.readVersion(),k=m.readFormatInformation().getErrorCorrectionLevel(),C=m.readCodewords(),A=dS.getDataBlocks(C,v,k);let I=0;for(const X of A)I+=X.getNumDataCodewords();const $=new Uint8Array(I);let V=0;for(const X of A){const ne=X.getCodewords(),ie=X.getNumDataCodewords();this.correctErrors(ne,ie);for(let he=0;he<ie;he++)$[V++]=ne[he]}return gs.decode($,v,k,g)}correctErrors(m,g){const v=new Int32Array(m);try{this.rsDecoder.decode(v,m.length-g)}catch{throw new p}for(let k=0;k<g;k++)m[k]=v[k]}}class fS extends me{constructor(m,g,v){super(m,g),this.estimatedModuleSize=v}aboutEquals(m,g,v){if(Math.abs(g-this.getY())<=m&&Math.abs(v-this.getX())<=m){const k=Math.abs(m-this.estimatedModuleSize);return k<=1||k<=this.estimatedModuleSize}return!1}combineEstimate(m,g,v){const k=(this.getX()+g)/2,C=(this.getY()+m)/2,A=(this.estimatedModuleSize+v)/2;return new fS(k,C,A)}}class vw{constructor(m,g,v,k,C,A,I){this.image=m,this.startX=g,this.startY=v,this.width=k,this.height=C,this.moduleSize=A,this.resultPointCallback=I,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const m=this.startX,g=this.height,v=this.width,k=m+v,C=this.startY+g/2,A=new Int32Array(3),I=this.image;for(let $=0;$<g;$++){const V=C+($&1?-Math.floor(($+1)/2):Math.floor(($+1)/2));A[0]=0,A[1]=0,A[2]=0;let X=m;for(;X<k&&!I.get(X,V);)X++;let ne=0;for(;X<k;){if(I.get(X,V))if(ne===1)A[1]++;else if(ne===2){if(this.foundPatternCross(A)){const ie=this.handlePossibleCenter(A,V,X);if(ie!==null)return ie}A[0]=A[2],A[1]=1,A[2]=0,ne=1}else A[++ne]++;else ne===1&&ne++,A[ne]++;X++}if(this.foundPatternCross(A)){const ie=this.handlePossibleCenter(A,V,k);if(ie!==null)return ie}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new F}static centerFromEnd(m,g){return g-m[2]-m[1]/2}foundPatternCross(m){const g=this.moduleSize,v=g/2;for(let k=0;k<3;k++)if(Math.abs(g-m[k])>=v)return!1;return!0}crossCheckVertical(m,g,v,k){const C=this.image,A=C.getHeight(),I=this.crossCheckStateCount;I[0]=0,I[1]=0,I[2]=0;let $=m;for(;$>=0&&C.get(g,$)&&I[1]<=v;)I[1]++,$--;if($<0||I[1]>v)return NaN;for(;$>=0&&!C.get(g,$)&&I[0]<=v;)I[0]++,$--;if(I[0]>v)return NaN;for($=m+1;$<A&&C.get(g,$)&&I[1]<=v;)I[1]++,$++;if($===A||I[1]>v)return NaN;for(;$<A&&!C.get(g,$)&&I[2]<=v;)I[2]++,$++;if(I[2]>v)return NaN;const V=I[0]+I[1]+I[2];return 5*Math.abs(V-k)>=2*k?NaN:this.foundPatternCross(I)?vw.centerFromEnd(I,$):NaN}handlePossibleCenter(m,g,v){const k=m[0]+m[1]+m[2],C=vw.centerFromEnd(m,v),A=this.crossCheckVertical(g,C,2*m[1],k);if(!isNaN(A)){const I=(m[0]+m[1]+m[2])/3;for(const V of this.possibleCenters)if(V.aboutEquals(I,A,C))return V.combineEstimate(A,C,I);const $=new fS(C,A,I);this.possibleCenters.push($),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint($)}return null}}class hS extends me{constructor(m,g,v,k){super(m,g),this.estimatedModuleSize=v,this.count=k,k===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(m,g,v){if(Math.abs(g-this.getY())<=m&&Math.abs(v-this.getX())<=m){const k=Math.abs(m-this.estimatedModuleSize);return k<=1||k<=this.estimatedModuleSize}return!1}combineEstimate(m,g,v){const k=this.count+1,C=(this.count*this.getX()+g)/k,A=(this.count*this.getY()+m)/k,I=(this.count*this.estimatedModuleSize+v)/k;return new hS(C,A,I,k)}}class Gfe{constructor(m){this.bottomLeft=m[0],this.topLeft=m[1],this.topRight=m[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class Ii{constructor(m,g){this.image=m,this.resultPointCallback=g,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=g}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(m){const g=m!=null&&m.get(T.TRY_HARDER)!==void 0,v=m!=null&&m.get(T.PURE_BARCODE)!==void 0,k=this.image,C=k.getHeight(),A=k.getWidth();let I=Math.floor(3*C/(4*Ii.MAX_MODULES));(I<Ii.MIN_SKIP||g)&&(I=Ii.MIN_SKIP);let $=!1;const V=new Int32Array(5);for(let ne=I-1;ne<C&&!$;ne+=I){V[0]=0,V[1]=0,V[2]=0,V[3]=0,V[4]=0;let ie=0;for(let he=0;he<A;he++)if(k.get(he,ne))(ie&1)===1&&ie++,V[ie]++;else if(ie&1)V[ie]++;
vendor: 9,165 bytes, line 2712
2712else if(ie===4)if(Ii.foundPatternCross(V)){if(this.handlePossibleCenter(V,ne,he,v)===!0)if(I=2,this.hasSkipped===!0)$=this.haveMultiplyConfirmedCenters();else{const ve=this.findRowSkip();ve>V[2]&&(ne+=ve-V[2]-I,he=A-1)}else{V[0]=V[2],V[1]=V[3],V[2]=V[4],V[3]=1,V[4]=0,ie=3;continue}ie=0,V[0]=0,V[1]=0,V[2]=0,V[3]=0,V[4]=0}else V[0]=V[2],V[1]=V[3],V[2]=V[4],V[3]=1,V[4]=0,ie=3;else V[++ie]++;Ii.foundPatternCross(V)&&this.handlePossibleCenter(V,ne,A,v)===!0&&(I=V[0],this.hasSkipped&&($=this.haveMultiplyConfirmedCenters()))}const X=this.selectBestPatterns();return me.orderBestPatterns(X),new Gfe(X)}static centerFromEnd(m,g){return g-m[4]-m[3]-m[2]/2}static foundPatternCross(m){let g=0;for(let C=0;C<5;C++){const A=m[C];if(A===0)return!1;g+=A}if(g<7)return!1;const v=g/7,k=v/2;return Math.abs(v-m[0])<k&&Math.abs(v-m[1])<k&&Math.abs(3*v-m[2])<3*k&&Math.abs(v-m[3])<k&&Math.abs(v-m[4])<k}getCrossCheckStateCount(){const m=this.crossCheckStateCount;return m[0]=0,m[1]=0,m[2]=0,m[3]=0,m[4]=0,m}crossCheckDiagonal(m,g,v,k){const C=this.getCrossCheckStateCount();let A=0;const I=this.image;for(;m>=A&&g>=A&&I.get(g-A,m-A);)C[2]++,A++;if(m<A||g<A)return!1;for(;m>=A&&g>=A&&!I.get(g-A,m-A)&&C[1]<=v;)C[1]++,A++;if(m<A||g<A||C[1]>v)return!1;for(;m>=A&&g>=A&&I.get(g-A,m-A)&&C[0]<=v;)C[0]++,A++;if(C[0]>v)return!1;const $=I.getHeight(),V=I.getWidth();for(A=1;m+A<$&&g+A<V&&I.get(g+A,m+A);)C[2]++,A++;if(m+A>=$||g+A>=V)return!1;for(;m+A<$&&g+A<V&&!I.get(g+A,m+A)&&C[3]<v;)C[3]++,A++;if(m+A>=$||g+A>=V||C[3]>=v)return!1;for(;m+A<$&&g+A<V&&I.get(g+A,m+A)&&C[4]<v;)C[4]++,A++;if(C[4]>=v)return!1;const X=C[0]+C[1]+C[2]+C[3]+C[4];return Math.abs(X-k)<2*k&&Ii.foundPatternCross(C)}crossCheckVertical(m,g,v,k){const C=this.image,A=C.getHeight(),I=this.getCrossCheckStateCount();let $=m;for(;$>=0&&C.get(g,$);)I[2]++,$--;if($<0)return NaN;for(;$>=0&&!C.get(g,$)&&I[1]<=v;)I[1]++,$--;if($<0||I[1]>v)return NaN;for(;$>=0&&C.get(g,$)&&I[0]<=v;)I[0]++,$--;if(I[0]>v)return NaN;for($=m+1;$<A&&C.get(g,$);)I[2]++,$++;if($===A)return NaN;for(;$<A&&!C.get(g,$)&&I[3]<v;)I[3]++,$++;if($===A||I[3]>=v)return NaN;for(;$<A&&C.get(g,$)&&I[4]<v;)I[4]++,$++;if(I[4]>=v)return NaN;const V=I[0]+I[1]+I[2]+I[3]+I[4];return 5*Math.abs(V-k)>=2*k?NaN:Ii.foundPatternCross(I)?Ii.centerFromEnd(I,$):NaN}crossCheckHorizontal(m,g,v,k){const C=this.image,A=C.getWidth(),I=this.getCrossCheckStateCount();let $=m;for(;$>=0&&C.get($,g);)I[2]++,$--;if($<0)return NaN;for(;$>=0&&!C.get($,g)&&I[1]<=v;)I[1]++,$--;if($<0||I[1]>v)return NaN;for(;$>=0&&C.get($,g)&&I[0]<=v;)I[0]++,$--;if(I[0]>v)return NaN;for($=m+1;$<A&&C.get($,g);)I[2]++,$++;if($===A)return NaN;for(;$<A&&!C.get($,g)&&I[3]<v;)I[3]++,$++;if($===A||I[3]>=v)return NaN;for(;$<A&&C.get($,g)&&I[4]<v;)I[4]++,$++;if(I[4]>=v)return NaN;const V=I[0]+I[1]+I[2]+I[3]+I[4];return 5*Math.abs(V-k)>=k?NaN:Ii.foundPatternCross(I)?Ii.centerFromEnd(I,$):NaN}handlePossibleCenter(m,g,v,k){const C=m[0]+m[1]+m[2]+m[3]+m[4];let A=Ii.centerFromEnd(m,v),I=this.crossCheckVertical(g,Math.floor(A),m[2],C);if(!isNaN(I)&&(A=this.crossCheckHorizontal(Math.floor(A),Math.floor(I),m[2],C),!isNaN(A)&&(!k||this.crossCheckDiagonal(Math.floor(I),Math.floor(A),m[2],C)))){const $=C/7;let V=!1;const X=this.possibleCenters;for(let ne=0,ie=X.length;ne<ie;ne++){const he=X[ne];if(he.aboutEquals($,I,A)){X[ne]=he.combineEstimate(I,A,$),V=!0;break}}if(!V){const ne=new hS(A,I,$);X.push(ne),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(ne)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let g=null;for(const v of this.possibleCenters)if(v.getCount()>=Ii.CENTER_QUORUM)if(g==null)g=v;else return this.hasSkipped=!0,Math.floor((Math.abs(g.getX()-v.getX())-Math.abs(g.getY()-v.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let m=0,g=0;const v=this.possibleCenters.length;for(const A of this.possibleCenters)A.getCount()>=Ii.CENTER_QUORUM&&(m++,g+=A.getEstimatedModuleSize());if(m<3)return!1;const k=g/v;let C=0;for(const A of this.possibleCenters)C+=Math.abs(A.getEstimatedModuleSize()-k);return C<=.05*g}selectBestPatterns(){const m=this.possibleCenters.length;if(m<3)throw new F;const g=this.possibleCenters;let v;if(m>3){let k=0,C=0;for(const $ of this.possibleCenters){const V=$.getEstimatedModuleSize();k+=V,C+=V*V}v=k/m;let A=Math.sqrt(C/m-v*v);g.sort(($,V)=>{const X=Math.abs(V.getEstimatedModuleSize()-v),ne=Math.abs($.getEstimatedModuleSize()-v);return X<ne?-1:X>ne?1:0});const I=Math.max(.2*v,A);for(let $=0;$<g.length&&g.length>3;$++){const V=g[$];Math.abs(V.getEstimatedModuleSize()-v)>I&&(g.splice($,1),$--)}}if(g.length>3){let k=0;for(const C of g)k+=C.getEstimatedModuleSize();v=k/g.length,g.sort((C,A)=>{if(A.getCount()===C.getCount()){const I=Math.abs(A.getEstimatedModuleSize()-v),$=Math.abs(C.getEstimatedModuleSize()-v);return I<$?1:I>$?-1:0}else return A.getCount()-C.getCount()}),g.splice(3)}return[g[0],g[1],g[2]]}}Ii.CENTER_QUORUM=2,Ii.MIN_SKIP=3,Ii.MAX_MODULES=57;class ny{constructor(m){this.image=m}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(m){this.resultPointCallback=m==null?null:m.get(T.NEED_RESULT_POINT_CALLBACK);const v=new Ii(this.image,this.resultPointCallback).find(m);return this.processFinderPatternInfo(v)}processFinderPatternInfo(m){const g=m.getTopLeft(),v=m.getTopRight(),k=m.getBottomLeft(),C=this.calculateModuleSize(g,v,k);if(C<1)throw new F("No pattern found in proccess finder.");const A=ny.computeDimension(g,v,k,C),I=Ft.getProvisionalVersionForDimension(A),$=I.getDimensionForVersion()-7;let V=null;if(I.getAlignmentPatternCenters().length>0){const he=v.getX()-g.getX()+k.getX(),ye=v.getY()-g.getY()+k.getY(),ve=1-3/$,Ce=Math.floor(g.getX()+ve*(he-g.getX())),Me=Math.floor(g.getY()+ve*(ye-g.getY()));for(let tt=4;tt<=16;tt<<=1)try{V=this.findAlignmentInRegion(C,Ce,Me,tt);break}catch(rt){if(!(rt instanceof F))throw rt}}const X=ny.createTransform(g,v,k,V,A),ne=ny.sampleGrid(this.image,X,A);let ie;return V===null?ie=[k,g,v]:ie=[k,g,v,V],new ke(ne,ie)}static createTransform(m,g,v,k,C){const A=C-3.5;let I,$,V,X;return k!==null?(I=k.getX(),$=k.getY(),V=A-3,X=V):(I=g.getX()-m.getX()+v.getX(),$=g.getY()-m.getY()+v.getY(),V=A,X=A),ge.quadrilateralToQuadrilateral(3.5,3.5,A,3.5,V,X,3.5,A,m.getX(),m.getY(),g.getX(),g.getY(),I,$,v.getX(),v.getY())}static sampleGrid(m,g,v){return Ve.getInstance().sampleGridWithTransform(m,v,v,g)}static computeDimension(m,g,v,k){const C=ot.round(me.distance(m,g)/k),A=ot.round(me.distance(m,v)/k);let I=Math.floor((C+A)/2)+7;switch(I&3){case 0:I++;break;case 2:I--;break;case 3:throw new F("Dimensions could be not found.")}return I}calculateModuleSize(m,g,v){return(this.calculateModuleSizeOneWay(m,g)+this.calculateModuleSizeOneWay(m,v))/2}calculateModuleSizeOneWay(m,g){const v=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(m.getX()),Math.floor(m.getY()),Math.floor(g.getX()),Math.floor(g.getY())),k=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(g.getX()),Math.floor(g.getY()),Math.floor(m.getX()),Math.floor(m.getY()));return isNaN(v)?k/7:isNaN(k)?v/7:(v+k)/14}sizeOfBlackWhiteBlackRunBothWays(m,g,v,k){let C=this.sizeOfBlackWhiteBlackRun(m,g,v,k),A=1,I=m-(v-m);I<0?(A=m/(m-I),I=0):I>=this.image.getWidth()&&(A=(this.image.getWidth()-1-m)/(I-m),I=this.image.getWidth()-1);let $=Math.floor(g-(k-g)*A);return A=1,$<0?(A=g/(g-$),$=0):$>=this.image.getHeight()&&(A=(this.image.getHeight()-1-g)/($-g),$=this.image.getHeight()-1),I=Math.floor(m+(I-m)*A),C+=this.sizeOfBlackWhiteBlackRun(m,g,I,$),C-1}sizeOfBlackWhiteBlackRun(m,g,v,k){const C=Math.abs(k-g)>Math.abs(v-m);if(C){let he=m;m=g,g=he,he=v,v=k,k=he}const A=Math.abs(v-m),I=Math.abs(k-g);let $=-A/2;const V=m<v?1:-1,X=g<k?1:-1;let ne=0;const ie=v+V;for(let he=m,ye=g;he!==ie;he+=V){const ve=C?ye:he,Ce=C?he:ye;if(ne===1===this.image.get(ve,Ce)){if(ne===2)return ot.distance(he,ye,m,g);ne++}if($+=I,$>0){if(ye===k)break;ye+=X,$-=A}}return ne===2?ot.distance(v+V,k,m,g):NaN}findAlignmentInRegion(m,g,v,k){const C=Math.floor(k*m),A=Math.max(0,g-C),I=Math.min(this.image.getWidth()-1,g+C);if(I-A<m*3)throw new F("Alignment top exceeds estimated module size.");const $=Math.max(0,v-C),V=Math.min(this.image.getHeight()-1,v+C);if(V-$<m*3)throw new F("Alignment bottom exceeds estimated module size.");return new vw(this.image,A,$,I-A,V-$,m,this.resultPointCallback).find()}}class Od{constructor(){this.decoder=new Wfe}getDecoder(){return this.decoder}decode(m,g){let v,k;if(g!=null&&g.get(T.PURE_BARCODE)!==void 0){const $=Od.extractPureBits(m.getBlackMatrix());v=this.decoder.decodeBitMatrix($,g),k=Od.NO_POINTS}else{const $=new ny(m.getBlackMatrix()).detect(g);v=this.decoder.decodeBitMatrix($.getBits(),g),k=$.getPoints()}v.getOther()instanceof V8&&v.getOther().applyMirroredCorrection(k);const C=new Z(v.getText(),v.getRawBytes(),void 0,k,se.QR_CODE,void 0),A=v.getByteSegments();A!==null&&C.putMetadata(le.BYTE_SEGMENTS,A);const I=v.getECLevel();return I!==null&&C.putMetadata(le.ERROR_CORRECTION_LEVEL,I),v.hasStructuredAppend()&&(C.putMetadata(le.STRUCTURED_APPEND_SEQUENCE,v.getStructuredAppendSequenceNumber()),C.putMetadata(le.STRUCTURED_APPEND_PARITY,v.getStructuredAppendParity())
vendor: 1,506 bytes, line 2712
2712),C}reset(){}static extractPureBits(m){const g=m.getTopLeftOnBit(),v=m.getBottomRightOnBit();if(g===null||v===null)throw new F;const k=this.moduleSize(g,m);let C=g[1],A=v[1],I=g[0],$=v[0];if(I>=$||C>=A)throw new F;if(A-C!==$-I&&($=I+(A-C),$>=m.getWidth()))throw new F;const V=Math.round(($-I+1)/k),X=Math.round((A-C+1)/k);if(V<=0||X<=0)throw new F;if(X!==V)throw new F;const ne=Math.floor(k/2);C+=ne,I+=ne;const ie=I+Math.floor((V-1)*k)-$;if(ie>0){if(ie>ne)throw new F;I-=ie}const he=C+Math.floor((X-1)*k)-A;if(he>0){if(he>ne)throw new F;C-=he}const ye=new U(V,X);for(let ve=0;ve<X;ve++){const Ce=C+Math.floor(ve*k);for(let Me=0;Me<V;Me++)m.get(I+Math.floor(Me*k),Ce)&&ye.set(Me,ve)}return ye}static moduleSize(m,g){const v=g.getHeight(),k=g.getWidth();let C=m[0],A=m[1],I=!0,$=0;for(;C<k&&A<v;){if(I!==g.get(C,A)){if(++$===5)break;I=!I}C++,A++}if(C===k||A===v)throw new F;return(C-m[0])/7}}Od.NO_POINTS=new Array;class Zt{PDF417Common(){}static getBitCountSum(m){return ot.sum(m)}static toIntArray(m){if(m==null||!m.length)return Zt.EMPTY_INT_ARRAY;const g=new Int32Array(m.length);let v=0;for(const k of m)g[v++]=k;return g}static getCodeword(m){const g=_.binarySearch(Zt.SYMBOL_TABLE,m&262143);return g<0?-1:(Zt.CODEWORD_TABLE[g]-1)%Zt.NUMBER_OF_CODEWORDS}}Zt.NUMBER_OF_CODEWORDS=929,Zt.MAX_CODEWORDS_IN_BARCODE=Zt.NUMBER_OF_CODEWORDS-1,Zt.MIN_ROWS_IN_BARCODE=3,Zt.MAX_ROWS_IN_BARCODE=90,Zt.MODULES_IN_CODEWORD=17,Zt.MODULES_IN_STOP_PATTERN=18,Zt.BARS_IN_MODULE=8,Zt.EMPTY_INT_ARRAY=new Int32Array([]),Z
vendor: 18,273 bytes, line 2712
2712t.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),
2712Z
vendor: 12,861 bytes, line 2712
2712t.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700])
2712;class Kfe{constructor(m,g){this.bits=m,this.points=g}getBits(){return this.bits}getPoints(){return this.points}}class wn{static detectMultiple(m,g,v){let k=m.getBlackMatrix(),C=wn.detect(v,k);return C.length||(k=k.clone(),k.rotate180(),C=wn.detect(v,k)),new Kfe(k,C)}static detect(m,g){const v=new Array;let k=0,C=0,A=!1;for(;k<g.getHeight();){const I=wn.findVertices(g,k,C);if(I[0]==null&&I[3]==null){if(!A)break;A=!1,C=0;for(const $ of v)$[1]!=null&&(k=Math.trunc(Math.max(k,$[1].getY()))),$[3]!=null&&(k=Math.max(k,Math.trunc($[3].getY())));k+=wn.ROW_STEP;continue}if(A=!0,v.push(I),!m)break;I[2]!=null?(C=Math.trunc(I[2].getX()),k=Math.trunc(I[2].getY())):(C=Math.trunc(I[4].getX()),k=Math.trunc(I[4].getY()))}return v}static findVertices(m,g,v){const k=m.getHeight(),C=m.getWidth(),A=new Array(8);return wn.copyToResult(A,wn.findRowsWithPattern(m,k,C,g,v,wn.START_PATTERN),wn.INDEXES_START_PATTERN),A[4]!=null&&(v=Math.trunc(A[4].getX()),g=Math.trunc(A[4].getY())),wn.copyToResult(A,wn.findRowsWithPattern(m,k,C,g,v,wn.STOP_PATTERN),wn.INDEXES_STOP_PATTERN),A}static copyToResult(m,g,v){for(let k=0;k<v.length;k++)m[v[k]]=g[k]}static findRowsWithPattern(m,g,v,k,C,A){const I=new Array(4);let $=!1;const V=new Int32Array(A.length);for(;k<g;k+=wn.ROW_STEP){let ne=wn.findGuardPattern(m,C,k,v,!1,A,V);if(ne!=null){for(;k>0;){const ie=wn.findGuardPattern(m,C,--k,v,!1,A,V);if(ie!=null)ne=ie;else{k++;break}}I[0]=new me(ne[0],k),I[1]=new me(ne[1],k),$=!0;break}}let X=k+1;if($){let ne=0,ie=Int32Array.from([Math.trunc(I[0].getX()),Math.trunc(I[1].getX())]);for(;X<g;X++){const he=wn.findGuardPattern(m,ie[0],X,v,!1,A,V);if(he!=null&&Math.abs(ie[0]-he[0])<wn.MAX_PATTERN_DRIFT&&Math.abs(ie[1]-he[1])<wn.MAX_PATTERN_DRIFT)ie
vendor: 6,402 bytes, line 2712
2712=he,ne=0;else{if(ne>wn.SKIPPED_ROW_COUNT_MAX)break;ne++}}X-=ne+1,I[2]=new me(ie[0],X),I[3]=new me(ie[1],X)}return X-k<wn.BARCODE_MIN_HEIGHT&&_.fill(I,null),I}static findGuardPattern(m,g,v,k,C,A,I){_.fillWithin(I,0,I.length,0);let $=g,V=0;for(;m.get($,v)&&$>0&&V++<wn.MAX_PIXEL_DRIFT;)$--;let X=$,ne=0,ie=A.length;for(let he=C;X<k;X++)if(m.get(X,v)!==he)I[ne]++;else{if(ne===ie-1){if(wn.patternMatchVariance(I,A,wn.MAX_INDIVIDUAL_VARIANCE)<wn.MAX_AVG_VARIANCE)return new Int32Array([$,X]);$+=I[0]+I[1],y.arraycopy(I,2,I,0,ne-1),I[ne-1]=0,I[ne]=0,ne--}else ne++;I[ne]=1,he=!he}return ne===ie-1&&wn.patternMatchVariance(I,A,wn.MAX_INDIVIDUAL_VARIANCE)<wn.MAX_AVG_VARIANCE?new Int32Array([$,X-1]):null}static patternMatchVariance(m,g,v){let k=m.length,C=0,A=0;for(let V=0;V<k;V++)C+=m[V],A+=g[V];if(C<A)return 1/0;let I=C/A;v*=I;let $=0;for(let V=0;V<k;V++){let X=m[V],ne=g[V]*I,ie=X>ne?X-ne:ne-X;if(ie>v)return 1/0;$+=ie}return $/C}}wn.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),wn.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),wn.MAX_AVG_VARIANCE=.42,wn.MAX_INDIVIDUAL_VARIANCE=.8,wn.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),wn.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),wn.MAX_PIXEL_DRIFT=3,wn.MAX_PATTERN_DRIFT=5,wn.SKIPPED_ROW_COUNT_MAX=25,wn.ROW_STEP=5,wn.BARCODE_MIN_HEIGHT=10;class Ki{constructor(m,g){if(g.length===0)throw new f;this.field=m;let v=g.length;if(v>1&&g[0]===0){let k=1;for(;k<v&&g[k]===0;)k++;k===v?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(v-k),y.arraycopy(g,k,this.coefficients,0,this.coefficients.length))}else this.coefficients=g}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(m){return this.coefficients[this.coefficients.length-1-m]}evaluateAt(m){if(m===0)return this.getCoefficient(0);if(m===1){let k=0;for(let C of this.coefficients)k=this.field.add(k,C);return k}let g=this.coefficients[0],v=this.coefficients.length;for(let k=1;k<v;k++)g=this.field.add(this.field.multiply(m,g),this.coefficients[k]);return g}add(m){if(!this.field.equals(m.field))throw new f("ModulusPolys do not have same ModulusGF field");if(this.isZero())return m;if(m.isZero())return this;let g=this.coefficients,v=m.coefficients;if(g.length>v.length){let A=g;g=v,v=A}let k=new Int32Array(v.length),C=v.length-g.length;y.arraycopy(v,0,k,0,C);for(let A=C;A<v.length;A++)k[A]=this.field.add(g[A-C],v[A]);return new Ki(this.field,k)}subtract(m){if(!this.field.equals(m.field))throw new f("ModulusPolys do not have same ModulusGF field");return m.isZero()?this:this.add(m.negative())}multiply(m){return m instanceof Ki?this.multiplyOther(m):this.multiplyScalar(m)}multiplyOther(m){if(!this.field.equals(m.field))throw new f("ModulusPolys do not have same ModulusGF field");if(this.isZero()||m.isZero())return new Ki(this.field,new Int32Array([0]));let g=this.coefficients,v=g.length,k=m.coefficients,C=k.length,A=new Int32Array(v+C-1);for(let I=0;I<v;I++){let $=g[I];for(let V=0;V<C;V++)A[I+V]=this.field.add(A[I+V],this.field.multiply($,k[V]))}return new Ki(this.field,A)}negative(){let m=this.coefficients.length,g=new Int32Array(m);for(let v=0;v<m;v++)g[v]=this.field.subtract(0,this.coefficients[v]);return new Ki(this.field,g)}multiplyScalar(m){if(m===0)return new Ki(this.field,new Int32Array([0]));if(m===1)return this;let g=this.coefficients.length,v=new Int32Array(g);for(let k=0;k<g;k++)v[k]=this.field.multiply(this.coefficients[k],m);return new Ki(this.field,v)}multiplyByMonomial(m,g){if(m<0)throw new f;if(g===0)return new Ki(this.field,new Int32Array([0]));let v=this.coefficients.length,k=new Int32Array(v+m);for(let C=0;C<v;C++)k[C]=this.field.multiply(this.coefficients[C],g);return new Ki(this.field,k)}toString(){let m=new B;for(let g=this.getDegree();g>=0;g--){let v=this.getCoefficient(g);v!==0&&(v<0?(m.append(" - "),v=-v):m.length()>0&&m.append(" + "),(g===0||v!==1)&&m.append(v),g!==0&&(g===1?m.append("x"):(m.append("x^"),m.append(g))))}return m.toString()}}class Yfe{add(m,g){return(m+g)%this.modulus}subtract(m,g){return(this.modulus+m-g)%this.modulus}exp(m){return this.expTable[m]}log(m){if(m===0)throw new f;return this.logTable[m]}inverse(m){if(m===0)throw new pe;return this.expTable[this.modulus-this.logTable[m]-1]}multiply(m,g){return m===0||g===0?0:this.expTable[(this.logTable[m]+this.logTable[g])%(this.modulus-1)]}getSize(){return this.modulus}equals(m){return m===this}}class mS extends Yfe{constructor(m,g){super(),this.modulus=m,this.expTable=new Int32Array(m),this.logTable=new Int32Array(m);let v=1;for(let k=0;k<m;k++)this.expTable[k]=v,v=v*g%m;for(let k=0;k<m-1;k++)this.logTable[this.expTable[k]]=k;this.zero=new Ki(this,new Int32Array([0])),this.one=new Ki(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(m,g){if(m<0)throw new f;if(g===0)return this.zero;let v=new Int32Array(m+1);return v[0]=g,new Ki(this,v)}}mS.PDF417_GF=new mS(Zt.NUMBER_OF_CODEWORDS,3);class H8{constructor(){this.field=mS.PDF417_GF}decode(m,g,v){let k=new Ki(this.field,m),C=new Int32Array(g),A=!1;for(let ye=g;ye>0;ye--){let ve=k.evaluateAt(this.field.exp(ye));C[g-ye]=ve,ve!==0&&(A=!0)}if(!A)return 0;let I=this.field.getOne();if(v!=null)for(const ye of v){let ve=this.field.exp(m.length-1-ye),Ce=new Ki(this.field,new Int32Array([this.field.subtract(0,ve),1]));I=I.multiply(Ce)}let $=new Ki(this.field,C),V=this.runEuclideanAlgorithm(this.field.buildMonomial(g,1),$,g),X=V[0],ne=V[1],ie=this.findErrorLocations(X),he=this.findErrorMagnitudes(ne,X,ie);for(let ye=0;ye<ie.length;ye++){let ve=m.length-1-this.field.log(ie[ye]);if(ve<0)throw p.getChecksumInstance();m[ve]=this.field.subtract(m[ve],he[ye])}return ie.length}runEuclideanAlgorithm(m,g,v){if(m.getDegree()<g.getDegree()){let ie=m;m=g,g=ie}let k=m,C=g,A=this.field.getZero(),I=this.field.getOne();for(;C.getDegree()>=Math.round(v/2);){let ie=k,he=A;if(k=C,A=I,k.isZero())throw p.getChecksumInstance();C=ie;let ye=this.field.getZero(),ve=k.getCoefficient(k.getDegree()),Ce=this.field.inverse(ve);for(;C.getDegree()>=k.getDegree()&&!C.isZero();){let Me=C.getDegree()-k.getDegree(),tt=this.field.multiply(C.getCoefficient(C.getDegree()),Ce);ye=ye.add(this.field.buildMonomial(Me,tt)),C=C.subtract(k.multiplyByMonomial(Me,tt))}I=ye.multiply(A).subtract(he).negative()}let $=I.getCoefficient(0);if($===0)throw p.getChecksumInstance();
2712let V=this.field.inverse($),X=I.multiply(V),ne=C.multiply(V);return[X,ne]}findErrorLocations(m){let g=m.getDegree(),v=new Int32Array(g),k=0;for(let C=1;C<this.field.getSize()&&k<g;C++)m.evaluateAt(C)===0&&(v[k]=this.field.inverse(C),k++);if(k!==g)throw p.getChecksumInstance();return v}findErrorMagnitudes(m,g,v){let k=g.getDegree(),C=new Int32Array(k);for(let V=1;V<=k;V++)C[k-V]=this.field.multiply(V,g.getCoefficient(V));let A=new Ki(this.field,C),I=v.length,$=new Int32Array(I);for(let V=0;V<I;V++){let X=this.field.inverse(v[V]),ne=this.field.subtract(0,m.evaluateAt(X)),ie=this.field.inverse(A.evaluateAt(X));$[V]=this.field.multiply(ne,ie)}return $}}class wh{constructor(m,g,v,k,C){m instanceof wh?this.constructor_2(m):this.constructor_1(m,g,v,k,C)}constructor_1(m,g,v,k,C){const A=g==null||v==null,I=k==null||C==null;if(A&&I)throw new F;A?(g=new me(0,k.getY()),v=new me(0,C.getY())):I&&(k=new me(m.getWidth()-1,g.getY()),C=new me(m.getWidth()-1,v.getY())),this.image=m,this.topLeft=g,this.bottomLeft=v,this.topRight=k,this.bottomRight=C,this.minX=Math.trunc(Math.min(g.getX(),v.getX())),this.maxX=Math.trunc(Math.max(k.getX(),C.getX())),this.minY=Math.trunc(Math.min(g.getY(),k.getY())),this.maxY=Math.trunc(Math.max(v.getY(),C.getY()))}constructor_2(m){this.image=m.image,this.topLeft=m.getTopLeft(),this.bottomLeft=m.getBottomLeft(),this.topRight=m.getTopRight(),this.bottomRight=m.getBottomRight(),this.minX=m.getMinX(),this.maxX=m.getMaxX(),this.minY=m.getMinY(),this.maxY=m.getMaxY()}static merge(m,g){return m==null?g:g==null?m:new wh(m.image,m.topLeft,m.bottomLeft,g.topRight,g.bottomRight)}addMissingRows(m,g,v){let k=this.topLeft,C=this.bottomLeft,A=this.topRight,I=this.bottomRight;if(m>0){let $=v?this.topLeft:this.topRight,V=Math.trunc($.getY()-m);V<0&&(V=0);let X=new me($.getX(),V);v?k=X:A=X}if(g>0){let $=v?this.bottomLeft:this.bottomRight,V=Math.trunc($.getY()+g);V>=this.image.getHeight()&&(V=this.image.getHeight()-1);let X=new me($.getX(),V);v?C=X:I=X}return new wh(this.image,k,C,A,I)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class Xfe{constructor(m,g,v,k){this.columnCount=m,this.errorCorrectionLevel=k,this.rowCountUpperPart=g,this.rowCountLowerPart=v,this.rowCount=g+v}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class ry{constructor(){this.buffer=""}static form(m,g){let v=-1;function k(A,I,$,V,X,ne){if(A==="%%")return"%";if(g[++v]===void 0)return;A=V?parseInt(V.substr(1)):void 0;let ie=X?parseInt(X.substr(1)):void 0,he;switch(ne){case"s":he=g[v];break;case"c":he=g[v][0];break;case"f":he=parseFloat(g[v]).toFixed(A);break;case"p":he=parseFloat(g[v]).toPrecision(A);break;case"e":he=parseFloat(g[v]).toExponential(A);break;case"x":he=parseInt(g[v]).toString(ie||16);break;case"d":he=parseFloat(parseInt(g[v],ie||10).toPrecision(A)).toFixed(0);break}he=typeof he=="object"?JSON.stringify(he):(+he).toString(ie);let ye=parseInt($),ve=$&&$[0]+""=="0"?"0":" ";for(;he.length<ye;)he=I!==void 0?he+ve:ve+he;return he}let C=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return m.replace(C,k)}format(m,...g){this.buffer+=ry.form(m,g)}toString(){return this.buffer}}class sy{constructor(m){this.boundingBox=new wh(m),this.codewords=new Array(m.getMaxY()-m.getMinY()+1)}getCodewordNearby(m){let g=this.getCodeword(m);if(g!=null)return g;for(let v=1;v<sy.MAX_NEARBY_DISTANCE;v++){let k=this.imageRowToCodewordIndex(m)-v;if(k>=0&&(g=this.codewords[k],g!=null)||(k=this.imageRowToCodewordIndex(m)+v,k<this.codewords.length&&(g=this.codewords[k],g!=null)))return g}return null}imageRowToCodewordIndex(m){return m-this.boundingBox.getMinY()}setCodeword(m,g){this.codewords[this.imageRowToCodewordIndex(m)]=g}getCodeword(m){return this.codewords[this.imageRowToCodewordIndex(m)]}getBoundingBox(){return this.boundingBox}
2712getCodewords(){return this.codewords}toString(){const m=new ry;let g=0;for(const v of this.codewords){if(v==null){m.format("%3d:    |   %n",g++);continue}m.format("%3d: %3d|%3d%n",g++,v.getRowNumber(),v.getValue())}return m.toString()}}sy.MAX_NEARBY_DISTANCE=5;class iy{constructor(){this.values=new Map}setValue(m){m=Math.trunc(m);let g=this.values.get(m);g==null&&(g=0),g++,this.values.set(m,g)}getValue(){let m=-1,g=new Array;for(const[v,k]of this.values.entries()){const C={getKey:()=>v,getValue:()=>k};C.getValue()>m?(m=C.getValue(),g=[],g.push(C.getKey())):C.getValue()===m&&g.push(C.getKey())}return Zt.toIntArray(g)}getConfidence(m){return this.values.get(m)}}class W8 extends sy{constructor(m,g){super(m),this._isLeft=g}setRowNumbers(){for(let m of this.getCodewords())m!=null&&m.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(m){let g=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(g,m);let v=this.getBoundingBox(),k=this._isLeft?v.getTopLeft():v.getTopRight(),C=this._isLeft?v.getBottomLeft():v.getBottomRight(),A=this.imageRowToCodewordIndex(Math.trunc(k.getY())),I=this.imageRowToCodewordIndex(Math.trunc(C.getY())),$=-1,V=1,X=0;for(let ne=A;ne<I;ne++){if(g[ne]==null)continue;let ie=g[ne],he=ie.getRowNumber()-$;if(he===0)X++;else if(he===1)V=Math.max(V,X),X=1,$=ie.getRowNumber();else if(he<0||ie.getRowNumber()>=m.getRowCount()||he>ne)g[ne]=null;else{let ye;V>2?ye=(V-2)*he:ye=he;let ve=ye>=ne;for(let Ce=1;Ce<=ye&&!ve;Ce++)ve=g[ne-Ce]!=null;ve?g[ne]=null:($=ie.getRowNumber(),X=1)}}}getRowHeights(){let m=this.getBarcodeMetadata();if(m==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(m);let g=new Int32Array(m.getRowCount());for(let v of this.getCodewords())if(v!=null){let k=v.getRowNumber();if(k>=g.length)continue;g[k]++}return g}adjustIncompleteIndicatorColumnRowNumbers(m){let g=this.getBoundingBox(),v=this._isLeft?g.getTopLeft():g.getTopRight(),k=this._isLeft?g.getBottomLeft():g.getBottomRight(),C=this.imageRowToCodewordIndex(Math.trunc(v.getY())),A=this.imageRowToCodewordIndex(Math.trunc(k.getY())),I=this.getCodewords(),$=-1;for(let V=C;V<A;V++){if(I[V]==null)continue;let X=I[V];X.setRowNumberAsRowIndicatorColumn();let ne=X.getRowNumber()-$;ne===0||(ne===1?$=X.getRowNumber():X.getRowNumber()>=m.getRowCount()?I[V]=null:$=X.getRowNumber())}}getBarcodeMetadata(){let m=this.getCodewords(),g=new iy,v=new iy,k=new iy,C=new iy;for(let I of m){if(I==null)continue;I.setRowNumberAsRowIndicatorColumn();let $=I.getValue()%30,V=I.getRowNumber();switch(this._isLeft||(V+=2),V%3){case 0:v.setValue($*3+1);break;case 1:C.setValue($/3),k.setValue($%3);break;case 2:g.setValue($+1);break}}if(g.getValue().length===0||v.getValue().length===0||k.getValue().length===0||C.getValue().length===0||g.getValue()[0]<1||v.getValue()[0]+k.getValue()[0]<Zt.MIN_ROWS_IN_BARCODE||v.getValue()[0]+k.getValue()[0]>Zt.MAX_ROWS_IN_BARCODE)return null;let A=new Xfe(g.getValue()[0],v.getValue()[0],k.getValue()[0],C.getValue()[0]);return this.removeIncorrectCodewords(m,A),A}removeIncorrectCodewords(m,g){for(let v=0;v<m.length;v++){let k=m[v];
2712if(m[v]==null)continue;let C=k.getValue()%30,A=k.getRowNumber();if(A>g.getRowCount()){m[v]=null;continue}switch(this._isLeft||(A+=2),A%3){case 0:C*3+1!==g.getRowCountUpperPart()&&(m[v]=null);break;case 1:(Math.trunc(C/3)!==g.getErrorCorrectionLevel()||C%3!==g.getRowCountLowerPart())&&(m[v]=null);break;case 2:C+1!==g.getColumnCount()&&(m[v]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
2713`+super.toString()}}class ay{constructor(m,g){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=m,this.barcodeColumnCount=m.getColumnCount(),this.boundingBox=g,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let m=Zt.MAX_CODEWORDS_IN_BARCODE,g;do g=m,m=this.adjustRowNumbersAndGetCount();while(m>0&&m<g);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(m){m!=null&&m.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let m=this.adjustRowNumbersByRow();if(m===0)return 0;for(let g=1;g<this.barcodeColumnCount+1;g++){let v=this.detectionResultColumns[g].getCodewords();for(let k=0;k<v.length;k++)v[k]!=null&&(v[k].hasValidRowNumber()||this.adjustRowNumbers(g,k,v))}return m}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)return;let m=this.detectionResultColumns[0].getCodewords(),g=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let v=0;v<m.length;v++)if(m[v]!=null&&g[v]!=null&&m[v].getRowNumber()===g[v].getRowNumber())for(let k=1;k<=this.barcodeColumnCount;k++){let C=this.detectionResultColumns[k].getCodewords()[v];C!=null&&(C.setRowNumber(m[v].getRowNumber()),C.hasValidRowNumber()||(this.detectionResultColumns[k].getCodewords()[v]=null))}}adjustRowNumbersFromRRI(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;let m=0,g=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let v=0;v<g.length;v++){if(g[v]==null)continue;let k=g[v].getRowNumber(),C=0;for(let A=this.barcodeColumnCount+1;A>0&&C<this.ADJUST_ROW_NUMBER_SKIP;A--){let I=this.detectionResultColumns[A].getCodewords()[v];I!=null&&(C=ay.adjustRowNumberIfValid(k,C,I),I.hasValidRowNumber()||m++)}}return m}adjustRowNumbersFromLRI(){if(this.detectionResultColumns[0]==null)return 0;let m=0,g=this.detectionResultColumns[0].getCodewords();for(let v=0;v<g.length;v++){if(g[v]==null)continue;let k=g[v].getRowNumber(),C=0;for(let A=1;A<this.barcodeColumnCount+1&&C<this.ADJUST_ROW_NUMBER_SKIP;A++){let I=this.detectionResultColumns[A].getCodewords()[v];I!=null&&(C=ay.adjustRowNumberIfValid(k,C,I),I.hasValidRowNumber()||m++)}}return m}static adjustRowNumberIfValid(m,g,v){return v==null||v.hasValidRowNumber()||(v.isValidRowNumber(m)?(v.setRowNumber(m),g=0):++g),g}adjustRowNumbers(m,g,v){if(!this.detectionResultColumns[m-1])return;let k=v[g],C=this.detectionResultColumns[m-1].getCodewords(),A=C;this.detectionResultColumns[m+1]!=null&&(A=this.detectionResultColumns[m+1].getCodewords());let I=new Array(14);I[2]=C[g],I[3]=A[g],g>0&&(I[0]=v[g-1],I[4]=C[g-1],I[5]=A[g-1]),g>1&&(I[8]=v[g-2],I[10]=C[g-2],I[11]=A[g-2]),g<v.length-1&&(I[1]=v[g+1],I[6]=C[g+1],I[7]=A[g+1]),g<v.length-2&&(I[9]=v[g+2],I[12]=C[g+2],I[13]=A[g+2]);for(let $ of I)if(ay.adjustRowNumber(k,$))return}static adjustRowNumber(m,g){return g==null?!1:g.hasValidRowNumber()&&g.getBucket()===m.getBucket()?(m.setRowNumber(g.getRowNumber()),!0):!1}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(m){this.boundingBox=m}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(m,g){this.detectionResultColumns[m]=g}getDetectionResultColumn(m){return this.detectionResultColumns[m]}toString(){let m=this.detectionResultColumns[0];m==null&&(m=this.detectionResultColumns[this.barcodeColumnCount+1]);let g=new ry;for(let v=0;v<m.getCodewords().length;v++){g.format("CW %3d:",v);for(let k=0;k<this.barcodeColumnCount+2;k++){if(this.detectionResultColumns[k]==null){g.format("    |   ");continue}let C=this.detectionResultColumns[k].getCodewords()[v];if(C==null){g.format("    |   ");continue}g.format(" %3d|%3d",C.getRowNumber(),C.getValue())}g.format("%n")}return g.toString()}}class oy{constructor(m,g,v,k){this.rowNumber=oy.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(m),this.endX=Math.trunc(g),this.bucket=Math.trunc(v),this.value=Math.trunc(k)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(m){return m!==oy.BARCODE_ROW_UNKNOWN&&this.bucket===m%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(Math.trunc(this.value/30)*3+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(m){this.rowNumber=m}toString(){return this.rowNumber+"|"+this.value}}oy.BARCODE_ROW_UNKNOWN=-1;class Qa{static initialize(){for(let m=0;m<Zt.SYMBOL_TABLE.length;m++){let g=Zt.SYMBOL_TABLE[m],v=g&1;for(let k=0;k<Zt.BARS_IN_MODULE;k++){let C=0;for(;(g&1)===v;)C+=1,g>>=1;v=g&1,Qa.RATIOS_TABLE[m]||(Qa.RATIOS_TABLE[m]=new Array(Zt.BARS_IN_MODULE)),Qa.RATIOS_TABLE[m][Zt.BARS_IN_MODULE-k-1]=Math.fround(C/Zt.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(m){let g=Qa.getDecodedCodewordValue(Qa.sampleBitCounts(m));return g!==-1?g:Qa.getClosestDecodedValue(m)}static sampleBitCounts(m){let g=ot.sum(m),v=new Int32Array(Zt.BARS_IN_MODULE),k=0,C=0;for(let A=0;A<Zt.MODULES_IN_CODEWORD;A++){let I=g/(2*Zt.MODULES_IN_CODEWORD)+A*g/Zt.MODULES_IN_CODEWORD;C+m[k]<=I&&(C+=m[k],k++),v[k]++}return v}static getDecodedCodewordValue(m){let g=Qa.getBitValue(m);return Zt.getCodeword(g)===-1?-1:g}static getBitValue(m){let g=0;for(let v=0;v<m.length;v++)for(let k=0;k<m[v];k++)g=g<<1|(v%2===0?1:0);return Math.trunc(g)}static getClosestDecodedValue(m){let g=ot.sum(m),v=new Array(Zt.BARS_IN_MODULE);if(g>1)for(let A=0;A<v.length;A++)v[A]=Math.fround(m[A]/g);let k=de.MAX_VALUE,C=-1;this.bSymbolTableReady||Qa.initialize();for(let A=0;A<Qa.RATIOS_TABLE.length;A++){let I=0,$=Qa.RATIOS_TABLE[A];for(let V=0;V<Zt.BARS_IN_MODULE;V++){let X=Math.fround($[V]-v[V]);if(I+=Math.fround(X*X),I>=k)break}I<k&&(k=I,C=Zt.SYMBOL_TABLE[A])}return C}}Qa.bSymbolTableReady=!1,Qa.RATIOS_TABLE=new Array(Zt.SYMBOL_TABLE.length).map(te=>new Array(Zt.BARS_IN_MODULE));class G8{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(m){this.segmentIndex=m}getFileId(){return this.fileId}setFileId(m){this.fileId=m}getOptionalData(){return this.optionalData}setOptionalData(m){this.optionalData=m}isLastSegment(){return this.lastSegment}setLastSegment(m){this.lastSegment=m}getSegmentCount(){return this.segmentCount}setSegmentCount(m){this.segmentCount=m}getSender(){return this.sender||null}setSender(m){this.sender=m}getAddressee(){return this.addressee||null}setAddressee(m){this.addressee=m}getFileName(){return this.fileName}setFileName(m){this.fileName=m}getFileSize(){return this.fileSize}setFileSize(m){this.fileSize=m}getChecksum(){return this.checksum}setChecksum(m){this.checksum=m}getTimestamp(){return this.timestamp}setTimestamp(m){this.timestamp=m}}class K8{static parseLong(m,g=void 0){return parseInt(m,g)}}class Y8 extends u{}Y8.kind="NullPointerException";class Qfe{writeBytes(m){this.writeBytesOffset(m,0,m.length)}writeBytesOffset(m,g,v){if(m==null)throw new Y8;if(g<0||g>m.length||v<0||g+v>m.length||g+v<0)throw new b;if(v===0)return;for(let k=0;k<v;k++)this.write(m[g+k])}flush(){}close(){}}class Jfe extends u{}class Zfe extends Qfe{constructor(m=32){if(super(),this.count=0,m<0)throw new f("Negative initial size: "+m);this.buf=new Uint8Array(m)}
2713ensureCapacity(m){m-this.buf.length>0&&this.grow(m)}grow(m){let v=this.buf.length<<1;if(v-m<0&&(v=m),v<0){if(m<0)throw new Jfe;v=j.MAX_VALUE}this.buf=_.copyOfUint8Array(this.buf,v)}write(m){this.ensureCapacity(this.count+1),this.buf[this.count]=m,this.count+=1}writeBytesOffset(m,g,v){if(g<0||g>m.length||v<0||g+v-m.length>0)throw new b;this.ensureCapacity(this.count+v),y.arraycopy(m,g,this.buf,this.count,v),this.count+=v}writeTo(m){m.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return _.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(m){return m?typeof m=="string"?this.toString_string(m):this.toString_number(m):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(m){return new String(this.buf).toString()}toString_number(m){return new String(this.buf).toString()}close(){}}var Pr;(function(te){te[te.ALPHA=0]="ALPHA",te[te.LOWER=1]="LOWER",te[te.MIXED=2]="MIXED",te[te.PUNCT=3]="PUNCT",te[te.ALPHA_SHIFT=4]="ALPHA_SHIFT",te[te.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(Pr||(Pr={}));function X8(){if(typeof window<"u")return window.BigInt||null;if(typeof Lo<"u")return Lo.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let bw;function Dd(te){if(typeof bw>"u"&&(bw=X8()),bw===null)throw new Error("BigInt is not supported!");return bw(te)}function ehe(){let te=[];te[0]=Dd(1);let m=Dd(900);te[1]=m;for(let g=2;g<16;g++)te[g]=te[g-1]*m;return te}class Re{static decode(m,g){let v=new B(""),k=D.ISO8859_1;v.enableDecoding(k);let C=1,A=m[C++],I=new G8;for(;C<m[0];){switch(A){case Re.TEXT_COMPACTION_MODE_LATCH:C=Re.textCompaction(m,C,v);break;case Re.BYTE_COMPACTION_MODE_LATCH:case Re.BYTE_COMPACTION_MODE_LATCH_6:C=Re.byteCompaction(A,m,k,C,v);break;case Re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:v.append(m[C++]);break;case Re.NUMERIC_COMPACTION_MODE_LATCH:C=Re.numericCompaction(m,C,v);break;case Re.ECI_CHARSET:D.getCharacterSetECIByValue(m[C++]);break;case Re.ECI_GENERAL_PURPOSE:C+=2;break;case Re.ECI_USER_DEFINED:C++;break;case Re.BEGIN_MACRO_PDF417_CONTROL_BLOCK:C=Re.decodeMacroBlock(m,C,I);break;case Re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case Re.MACRO_PDF417_TERMINATOR:throw new P;default:C--,C=Re.textCompaction(m,C,v);break}if(C<m.length)A=m[C++];else throw P.getFormatInstance()}if(v.length()===0)throw P.getFormatInstance();let $=new fe(null,v.toString(),null,g);return $.setOther(I),$}static decodeMacroBlock(m,g,v){if(g+Re.NUMBER_OF_SEQUENCE_CODEWORDS>m[0])throw P.getFormatInstance();let k=new Int32Array(Re.NUMBER_OF_SEQUENCE_CODEWORDS);for(let I=0;I<Re.NUMBER_OF_SEQUENCE_CODEWORDS;I++,g++)k[I]=m[g];v.setSegmentIndex(j.parseInt(Re.decodeBase900toBase10(k,Re.NUMBER_OF_SEQUENCE_CODEWORDS)));let C=new B;g=Re.textCompaction(m,g,C),v.setFileId(C.toString());let A=-1;for(m[g]===Re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(A=g+1);g<m[0];)switch(m[g]){case Re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(g++,m[g]){case Re.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let I=new B;g=Re.textCompaction(m,g+1,I),v.setFileName(I.toString());break;case Re.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let $=new B;g=Re.textCompaction(m,g+1,$),v.setSender($.toString());break;case Re.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let V=new B;g=Re.textCompaction(m,g+1,V),v.setAddressee(V.toString());break;case Re.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let X=new B;g=Re.numericCompaction(m,g+1,X),v.setSegmentCount(j.parseInt(X.toString()));break;case Re.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let ne=new B;g=Re.numericCompaction(m,g+1,ne),v.setTimestamp(K8.parseLong(ne.toString()));break;case Re.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let ie=new B;g=Re.numericCompaction(m,g+1,ie),v.setChecksum(j.parseInt(ie.toString()));break;case Re.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let he=new B;g=Re.numericCompaction(m,g+1,he),v.setFileSize(K8.parseLong(he.toString()));break;default:throw P.getFormatInstance()}break;case Re.MACRO_PDF417_TERMINATOR:g++,v.setLastSegment(!0);break;default:throw P.getFormatInstance()}if(A!==-1){let I=g-A;v.isLastSegment()&&I--,v.setOptionalData(_.copyOfRange(m,A,A+I))}return g}static textCompaction(m,g,v){let k=new Int32Array((m[0]-g)*2),C=new Int32Array((m[0]-g)*2),A=0,I=!1;for(;g<m[0]&&!I;){let $=m[g++];if($<Re.TEXT_COMPACTION_MODE_LATCH)k[A]=$/30,k[A+1]=$%30,A+=2;else switch($){case Re.TEXT_COMPACTION_MODE_LATCH:k[A++]=Re.TEXT_COMPACTION_MODE_LATCH;break;case Re.BYTE_COMPACTION_MODE_LATCH:case Re.BYTE_COMPACTION_MODE_LATCH_6:case Re.NUMERIC_COMPACTION_MODE_LATCH:case Re.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case Re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case Re.MACRO_PDF417_TERMINATOR:g--,I=!0;break;case Re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:k[A]=Re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,$=m[g++],C[A]=$,A++;break}}return Re.decodeTextCompaction(k,C,A,v),g}static decodeTextCompaction(m,g,v,k){let C=Pr.ALPHA,A=Pr.ALPHA,I=0;for(;I<v;){let $=m[I],V="";switch(C){case Pr.ALPHA:if($<26)V=String.fromCharCode(65+$);else switch($){case 26:V=" ";break;case Re.LL:C=Pr.LOWER;break;case Re.ML:C=Pr.MIXED;break;case Re.PS:A=C,C=Pr.PUNCT_SHIFT;break;case Re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:k.append(g[I]);break;case Re.TEXT_COMPACTION_MODE_LATCH:C=Pr.ALPHA;break}break;case Pr.LOWER:if($<26)V=String.fromCharCode(97+$);else switch($){case 26:V=" ";break;case Re.AS:A=C,C=Pr.ALPHA_SHIFT;break;case Re.ML:C=Pr.MIXED;break;case Re.PS:A=C,C=Pr.PUNCT_SHIFT;break;case Re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:k.append(g[I]);break;case Re.TEXT_COMPACTION_MODE_LATCH:C=Pr.ALPHA;break}break;case Pr.MIXED:if($<Re.PL)V=Re.MIXED_CHARS[$];else switch($){case Re.PL:C=Pr.PUNCT;break;case 26:V=" ";break;case Re.LL:C=Pr.LOWER;break;case Re.AL:C=Pr.ALPHA;break;case Re.PS:A=C,C=Pr.PUNCT_SHIFT;break;case Re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:k.append(g[I]);break;case Re.TEXT_COMPACTION_MODE_LATCH:C=Pr.ALPHA;break}break;case Pr.PUNCT:if($<Re.PAL)V=Re.PUNCT_CHARS[$];else switch($){case Re.PAL:C=Pr.ALPHA;break;case Re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:k.append(g[I]);break;case Re.TEXT_COMPACTION_MODE_LATCH:C=Pr.ALPHA;break}break;case Pr.ALPHA_SHIFT:if(C=A,$<26)V=String.fromCharCode(65+$);else switch($){case 26:V=" ";break;case Re.TEXT_COMPACTION_MODE_LATCH:C=Pr.ALPHA;break}break;case Pr.PUNCT_SHIFT:if(C=A,$<Re.PAL)V=Re.PUNCT_CHARS[$];else switch($){case Re.PAL:C=Pr.ALPHA;break;case Re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:k.append(g[I]);break;case Re.TEXT_COMPACTION_MODE_LATCH:C=Pr.ALPHA;break}break}V!==""&&k.append(V),I++}}static byteCompaction(m,g,v,k,C){let A=new Zfe,I=0,$=0,V=!1;switch(m){case Re.BYTE_COMPACTION_MODE_LATCH:let X=new Int32Array(6),ne=g[k++];for(;k<g[0]&&!V;)switch(X[I++]=ne,$=900*$+ne,ne=g[k++],ne){case Re.TEXT_COMPACTION_MODE_LATCH:case Re.BYTE_COMPACTION_MODE_LATCH:case Re.NUMERIC_COMPACTION_MODE_LATCH:case Re.BYTE_COMPACTION_MODE_LATCH_6:case Re.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case Re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case Re.MACRO_PDF417_TERMINATOR:k--,V=!0;break;default:if(I%5===0&&I>0){for(let ie=0;ie<6;++ie)A.write(Number(Dd($)>>Dd(8*(5-ie))));$=0,I=0}break}k===g[0]&&ne<Re.TEXT_COMPACTION_MODE_LATCH&&(X[I++]=ne);for(let ie=0;ie<I;ie++)A.write(X[ie]);break;case Re.BYTE_COMPACTION_MODE_LATCH_6:for(;k<g[0]&&!V;){let ie=g[k++];if(ie<Re.TEXT_COMPACTION_MODE_LATCH)I++,$=900*$+ie;else switch(ie){case Re.TEXT_COMPACTION_MODE_LATCH:case Re.BYTE_COMPACTION_MODE_LATCH:case Re.NUMERIC_COMPACTION_MODE_LATCH:case Re.BYTE_COMPACTION_MODE_LATCH_6:case Re.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case Re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case Re.MACRO_PDF417_TERMINATOR:k--,V=!0;break}if(I%5===0&&I>0){for(let he=0;he<6;++he)A.write(Number(Dd($)>>Dd(8*(5-he))));$=0,I=0}}break}return C.append(L.decode(A.toByteArray(),v)),k}static numericCompaction(m,g,v){let k=0,C=!1,A=new Int32Array(Re.MAX_NUMERIC_CODEWORDS);for(;g<m[0]&&!C;){let I=m[g++];if(g===m[0]&&(C=!0),I<Re.TEXT_COMPACTION_MODE_LATCH)A[k]=I,k++;else switch(I){case Re.TEXT_COMPACTION_MODE_LATCH:case Re.BYTE_COMPACTION_MODE_LATCH:case Re.BYTE_COMPACTION_MODE_LATCH_6:case Re.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case Re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case Re.MACRO_PDF417_TERMINATOR:g--,C=!0;break}(k%Re.MAX_NUMERIC_CODEWORDS===0||I===Re.NUMERIC_COMPACTION_MODE_LATCH||C)&&k>0&&(v.append(Re.decodeBase900toBase10(A,k)),k=0)}return g}static decodeBase900toBase10(m,g){let v=Dd(0);for(let C=0;C<g;C++)v+=Re.EXP900[g-C-1]*Dd(m[C]);let k=v.toString();if(k.charAt(0)!=="1")throw new P;return k.substring(1)}}Re.TEXT_COMPACTION_MODE_LATCH=900,Re.BYTE_COMPACTION_MODE_LATCH=901,Re.NUMERIC_COMPACTION_MODE_LATCH=902,Re.BYTE_COMPACTION_MODE_LATCH_6=924,Re.ECI_USER_DEFINED=925,Re.ECI_GENERAL_PURPOSE=926,Re.ECI_CHARSET=927,Re.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,Re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,Re.MACRO_PDF417_TERMINATOR=922,Re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,Re.MAX_NUMERIC_CODEWORDS=15,Re.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,Re.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,Re.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,Re.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,Re.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,Re.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,Re.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,Re.PL=25,Re.LL=27,Re.AS=27,Re.ML=28,Re.AL=28,Re.PS=29,Re.PAL=29,Re.PUNCT_CHARS=`;<>@[\\]_\`~!\r	,:
2714-.$/"|*()?{}'`,Re.MIXED_CHARS="0123456789&\r	,:#-.$/+%*=^",Re.EXP900=X8()?ehe():[],Re.NUMBER_OF_SEQUENCE_CODEWORDS=2;class Nn{constructor(){}static decode(m,g,v,k,C,A,I){let $=new wh(m,g,v,k,C),V=null,X=null,ne;for(let ye=!0;;ye=!1){if(g!=null&&(V=Nn.getRowIndicatorColumn(m,$,g,!0,A,I)),k!=null&&(X=Nn.getRowIndicatorColumn(m,$,k,!1,A,I)),ne=Nn.merge
2714(V,X),ne==null)throw F.getNotFoundInstance();let ve=ne.getBoundingBox();if(ye&&ve!=null&&(ve.getMinY()<$.getMinY()||ve.getMaxY()>$.getMaxY()))$=ve;else break}ne.setBoundingBox($);let ie=ne.getBarcodeColumnCount()+1;ne.setDetectionResultColumn(0,V),ne.setDetectionResultColumn(ie,X);let he=V!=null;for(let ye=1;ye<=ie;ye++){let ve=he?ye:ie-ye;if(ne.getDetectionResultColumn(ve)!==void 0)continue;let Ce;ve===0||ve===ie?Ce=new W8($,ve===0):Ce=new sy($),ne.setDetectionResultColumn(ve,Ce);let Me=-1,tt=Me;for(let rt=$.getMinY();rt<=$.getMaxY();rt++){if(Me=Nn.getStartColumn(ne,ve,rt,he),Me<0||Me>$.getMaxX()){if(tt===-1)continue;Me=tt}let Xe=Nn.detectCodeword(m,$.getMinX(),$.getMaxX(),he,Me,rt,A,I);Xe!=null&&(Ce.setCodeword(rt,Xe),tt=Me,A=Math.min(A,Xe.getWidth()),I=Math.max(I,Xe.getWidth()))}}return Nn.createDecoderResult(ne)}static merge(m,g){if(m==null&&g==null)return null;let v=Nn.getBarcodeMetadata(m,g);if(v==null)return null;let k=wh.merge(Nn.adjustBoundingBox(m),Nn.adjustBoundingBox(g));return new ay(v,k)}static adjustBoundingBox(m){if(m==null)return null;let g=m.getRowHeights();if(g==null)return null;let v=Nn.getMax(g),k=0;for(let I of g)if(k+=v-I,I>0)break;let C=m.getCodewords();for(let I=0;k>0&&C[I]==null;I++)k--;let A=0;for(let I=g.length-1;I>=0&&(A+=v-g[I],!(g[I]>0));I--);for(let I=C.length-1;A>0&&C[I]==null;I--)A--;return m.getBoundingBox().addMissingRows(k,A,m.isLeft())}static getMax(m){let g=-1;for(let v of m)g=Math.max(g,v);return g}static getBarcodeMetadata(m,g){let v;if(m==null||(v=m.getBarcodeMetadata())==null)return g==null?null:g.getBarcodeMetadata();let k;return g==null||(k=g.getBarcodeMetadata())==null?v:v.getColumnCount()!==k.getColumnCount()&&v.getErrorCorrectionLevel()!==k.getErrorCorrectionLevel()&&v.getRowCount()!==k.getRowCount()?null:v}static getRowIndicatorColumn(m,g,v,k,C,A){let I=new W8(g,k);for(let $=0;$<2;$++){let V=$===0?1:-1,X=Math.trunc(Math.trunc(v.getX()));for(let ne=Math.trunc(Math.trunc(v.getY()));ne<=g.getMaxY()&&ne>=g.getMinY();ne+=V){let ie=Nn.detectCodeword(m,0,m.getWidth(),k,X,ne,C,A);ie!=null&&(I.setCodeword(ne,ie),k?X=ie.getStartX():X=ie.getEndX())}}return I}static adjustCodewordCount(m,g){let v=g[0][1],k=v.getValue(),C=m.getBarcodeColumnCount()*m.getBarcodeRowCount()-Nn.getNumberOfECCodeWords(m.getBarcodeECLevel());if(k.length===0){if(C<1||C>Zt.MAX_CODEWORDS_IN_BARCODE)throw F.getNotFoundInstance();v.setValue(C)}else k[0]!==C&&v.setValue(C)}static createDecoderResult(m){let g=Nn.createBarcodeMatrix(m);Nn.adjustCodewordCount(m,g);let v=new Array,k=new Int32Array(m.getBarcodeRowCount()*m.getBarcodeColumnCount()),C=[],A=new Array;for(let $=0;$<m.getBarcodeRowCount();$++)for(let V=0;V<m.getBarcodeColumnCount();V++){let X=g[$][V+1].getValue(),ne=$*m.getBarcodeColumnCount()+V;X.length===0?v.push(ne):X.length===1?k[ne]=X[0]:(A.push(ne),C.push(X))}let I=new Array(C.length);for(let $=0;$<I.length;$++)I[$]=C[$];return Nn.createDecoderResultFromAmbiguousValues(m.getBarcodeECLevel(),k,Zt.toIntArray(v),Zt.toIntArray(A),I)}static createDecoderResultFromAmbiguousValues(m,g,v,k,C){let A=new Int32Array(k.length),I=100;for(;I-- >0;){for(let $=0;$<A.length;$++)g[k[$]]=C[$][A[$]];try{return Nn.decodeCodewords(g,m,v)}catch($){if(!($ instanceof p))throw $}if(A.length===0)throw p.getChecksumInstance();for(let $=0;$<A.length;$++)if(A[$]<C[$].length-1){A[$]++;break}else if(A[$]=0,$===A.length-1)throw p.getChecksumInstance()}throw p.getChecksumInstance()}static createBarcodeMatrix(m){let g=Array.from({length:m.getBarcodeRowCount()},()=>new Array(m.getBarcodeColumnCount()+2));for(let k=0;k<g.length;k++)for(let C=0;C<g[k].length;C++)g[k][C]=new iy;let v=0;for(let k of m.getDetectionResultColumns()){if(k!=null){for(let C of k.getCodewords())if(C!=null){let A=C.getRowNumber();if(A>=0){if(A>=g.length)continue;g[A][v].setValue(C.getValue())}}}v++}return g}static isValidBarcodeColumn(m,g){return g>=0&&g<=m.getBarcodeColumnCount()+1}static getStartColumn(m,g,v,k){let C=k?1:-1,A=null;if(Nn.isValidBarcodeColumn(m,g-C)&&(A=m.getDetectionResultColumn(g-C).getCodeword(v)),A!=null)return k?A.getEndX():A.getStartX();if(A=m.getDetectionResultColumn(g).getCodewordNearby(v),A!=null)return k?A.getStartX():A.getEndX();if(Nn.isValidBarcodeColumn(m,g-C)&&(A=m.getDetectionResultColumn(g-C).getCodewordNearby(v)),A!=null)return k?A.getEndX():A.getStartX();let I=0;for(;Nn.isValidBarcodeColumn(m,g-C);){g-=C;for(let $ of m.getDetectionResultColumn(g).getCodewords())if($!=null)return(k?$.getEndX():$.getStartX())+C*I*($.getEndX()-$.getStartX());I++}return k?m.getBoundingBox().getMinX():m.getBoundingBox().getMaxX()}static detectCodeword(m,g,v,k,C,A,I,$){C=Nn.adjustCodewordStartColumn(m,g,v,k,C,A);let V=Nn.getModuleBitCount(m,g,v,k,C,A);if(V==null)return null;let X,ne=ot.sum(V);if(k)X=C+ne;else{for(let ye=0;ye<V.length/2;ye++){let ve=V[ye];V[ye]=V[V.length-1-ye],V[V.length-1-ye]=ve}X=C,C=X-ne}if(!Nn.checkCodewordSkew(ne,I,$))return null;let ie=Qa.getDecodedValue(V),he=Zt.getCodeword(ie);return he===-1?null:new oy(C,X,Nn.getCodewordBucketNumber(ie),he)}static getModuleBitCount(m,g,v,k,C,A){let I=C,$=new Int32Array(8),V=0,X=k?1:-1,ne=k;for(;(k?I<v:I>=g)&&V<$.length;)m.get(I,A)===ne?($[V]++,I+=X):(V++,ne=!ne);return V===$.length||I===(k?v:g)&&V===$.length-1?$:null}static getNumberOfECCodeWords(m){return 2<<m}static adjustCodewordStartColumn(m,g,v,k,C,A){let I=C,$=k?-1:1;for(let V=0;V<2;V++){for(;(k?I>=g:I<v)&&k===m.get(I,A);
2714){if(Math.abs(C-I)>Nn.CODEWORD_SKEW_SIZE)return C;I+=$}$=-$,k=!k}return I}static checkCodewordSkew(m,g,v){return g-Nn.CODEWORD_SKEW_SIZE<=m&&m<=v+Nn.CODEWORD_SKEW_SIZE}static decodeCodewords(m,g,v){if(m.length===0)throw P.getFormatInstance();let k=1<<g+1,C=Nn.correctErrors(m,v,k);Nn.verifyCodewordCount(m,k);let A=Re.decode(m,""+g);return A.setErrorsCorrected(C),A.setErasures(v.length),A}static correctErrors(m,g,v){if(g!=null&&g.length>v/2+Nn.MAX_ERRORS||v<0||v>Nn.MAX_EC_CODEWORDS)throw p.getChecksumInstance();return Nn.errorCorrection.decode(m,v,g)}static verifyCodewordCount(m,g){if(m.length<4)throw P.getFormatInstance();let v=m[0];if(v>m.length)throw P.getFormatInstance();if(v===0)if(g<m.length)m[0]=m.length-g;else throw P.getFormatInstance()}static getBitCountForCodeword(m){let g=new Int32Array(8),v=0,k=g.length-1;for(;!((m&1)!==v&&(v=m&1,k--,k<0));)g[k]++,m>>=1;return g}static getCodewordBucketNumber(m){return m instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(m):this.getCodewordBucketNumber_number(m)}static getCodewordBucketNumber_number(m){return Nn.getCodewordBucketNumber(Nn.getBitCountForCodeword(m))}static getCodewordBucketNumber_Int32Array(m){return(m[0]-m[2]+m[4]-m[6]+9)%9}static toString(m){let g=new ry;for(let v=0;v<m.length;v++){g.format("Row %2d: ",v);for(let k=0;k<m[v].length;k++){let C=m[v][k];C.getValue().length===0?g.format("        ",null):g.format("%4d(%2d)",C.getValue()[0],C.getConfidence(C.getValue()[0]))}g.format("%n")}return g.toString()}}Nn.CODEWORD_SKEW_SIZE=2,Nn.MAX_ERRORS=3,Nn.MAX_EC_CODEWORDS=512,Nn.errorCorrection=new H8;class Yi{decode(m,g=null){let v=Yi.decode(m,g,!1);if(v==null||v.length===0||v[0]==null)throw F.getNotFoundInstance();return v[0]}decodeMultiple(m,g=null){try{return Yi.decode(m,g,!0)}catch(v){throw v instanceof P||v instanceof p?F.getNotFoundInstance():v}}static decode(m,g,v){const k=new Array,C=wn.detectMultiple(m,g,v);for(const A of C.getPoints()){const I=Nn.decode(C.getBits(),A[4],A[5],A[6],A[7],Yi.getMinCodewordWidth(A),Yi.getMaxCodewordWidth(A)),$=new Z(I.getText(),I.getRawBytes(),void 0,A,se.PDF_417);$.putMetadata(le.ERROR_CORRECTION_LEVEL,I.getECLevel());const V=I.getOther();V!=null&&$.putMetadata(le.PDF417_EXTRA_METADATA,V),k.push($)}return k.map(A=>A)}static getMaxWidth(m,g){return m==null||g==null?0:Math.trunc(Math.abs(m.getX()-g.getX()))}static getMinWidth(m,g){return m==null||g==null?j.MAX_VALUE:Math.trunc(Math.abs(m.getX()-g.getX()))}static getMaxCodewordWidth(m){return Math.floor(Math.max(Math.max(Yi.getMaxWidth(m[0],m[4]),Yi.getMaxWidth(m[6],m[2])*Zt.MODULES_IN_CODEWORD/Zt.MODULES_IN_STOP_PATTERN),Math.max(Yi.getMaxWidth(m[1],m[5]),Yi.getMaxWidth(m[7],m[3])*Zt.MODULES_IN_CODEWORD/Zt.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(m){return Math.floor(Math.min(Math.min(Yi.getMinWidth(m[0],m[4]),Yi.getMinWidth(m[6],m[2])*Zt.MODULES_IN_CODEWORD/Zt.MODULES_IN_STOP_PATTERN),Math.min(Yi.getMinWidth(m[1],m[5]),Yi.getMinWidth(m[7],m[3])*Zt.MODULES_IN_CODEWORD/Zt.MODULES_IN_STOP_PATTERN)))}reset(){}}class ww extends u{}ww.kind="ReaderException";class Q8{constructor(m,g){this.verbose=m===!0,g&&this.setHints(g)}decode(m,g){return g&&this.setHints(g),this.decodeInternal(m)}decodeWithState(m){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(m)}setHints(m){this.hints=m;const g=!r(m)&&m.get(T.TRY_HARDER)===!0,v=r(m)?null:m.get(T.POSSIBLE_FORMATS),k=new Array;if(!r(v)){const C=v.some(A=>A===se.UPC_A||A===se.UPC_E||A===se.EAN_13||A===se.EAN_8||A===se.CODABAR||A===se.CODE_39||A===se.CODE_93||A===se.CODE_128||A===se.ITF||A===se.RSS_14||A===se.RSS_EXPANDED);C&&!g&&k.push(new Sp(m,this.verbose)),v.includes(se.QR_CODE)&&k.push(new Od),v.includes(se.DATA_MATRIX)&&k.push(new Pd),v.includes(se.AZTEC)&&k.push(new nn),v.includes(se.PDF_417)&&k.push(new Yi),C&&g&&k.push(new Sp(m,this.verbose))}k.length===0&&(g||k.push(new Sp(m,this.verbose)),k.push(new Od),k.push(new Pd),k.push(new nn),k.push(new Yi),g&&k.push(new Sp(m,this.verbose))),this.readers=k}reset(){if(this.readers!==null)for(const m of this.readers)m.reset()}decodeInternal(m){if(this.readers===null)throw new ww("No readers where selected, nothing can be read.");for(const g of this.readers)try{return g.decode(m,this.hints)}catch(v){if(v instanceof ww)continue}throw new F("No MultiFormat Readers were able to detect the code.")}}class the extends Y{constructor(m=null,g=500){const v=new Q8;v.setHints(m),super(v,g)}decodeBitmap(m){return this.reader.decodeWithState(m)}}class nhe extends Y{constructor(m=500){super(new Yi,m)}}class rhe extends Y{constructor(m=500){super(new Od,m)}}var pS;(function(te){te[te.ERROR_CORRECTION=0]="ERROR_CORRECTION",te[te.CHARACTER_SET=1]="CHARACTER_SET",te[te.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",te[te.MIN_SIZE=3]="MIN_SIZE",te[te.MAX_SIZE=4]="MAX_SIZE",te[te.MARGIN=5]="MARGIN",te[te.PDF417_COMPACT=6]="PDF417_COMPACT",te[te.PDF417_COMPACTION=7]="PDF417_COMPACTION",te[te.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",te[te.AZTEC_LAYERS=9]="AZTEC_LAYERS",te[te.QR_VERSION=10]="QR_VERSION"})(pS||(pS={}));var xi=pS;class gS{constructor(m){this.field=m,this.cachedGenerators=[],this.cachedGenerators.push(new _e(m,Int32Array.from([1])))}buildGenerator(m){const g=this.cachedGenerators;if(m>=g.length){let v=g[g.length-1];const k=this.field;for(let C=g.length;C<=m;C++){const A=v.multiply(new _e(k,Int32Array.from([1,k.exp(C-1+k.getGeneratorBase())])));g.push(A),v=A}}return g[m]}encode(m,g){if(g===0)throw new f("No error correction bytes");const v=m.length-g;if(v<=0)throw new f("No data bytes provided");const k=this.buildGenerator(g),C=new Int32Array(v);y.arraycopy(m,0,C,0,v);let A=new _e(this.field,C);A=A.multiplyByMonomial(g,1);const $=A.divide(k)[1].getCoefficients(),V=g-$.length;for(let X=0;X<V;X++)m[v+X]=0;y.arraycopy($,0,m,v+V,$.length)}}class Ss{constructor(){}static applyMaskPenaltyRule1(m){return Ss.applyMaskPenaltyRule1Internal(m,!0)+Ss.applyMaskPenaltyRule1Internal(m,!1)}static applyMaskPenaltyRule2(m){let g=0;const v=m.getArray(),k=m.getWidth(),C=m.getHeight();for(let A=0;A<C-1;A++){const I=v[A];for(let $=0;$<k-1;$++){const V=I[$];V===I[$+1]&&V===v[A+1][$]&&V===v[A+1][$+1]&&g++}}return Ss.N2*g}static applyMaskPenaltyRule3(m){let g=0;const v=m.getArray(),k=m.getWidth(),C=m.getHeight();for(let A=0;A<C;A++)for(let I=0;I<k;I++){const $=v[A];I+6<k&&$[I]===1&&$[I+1]===0&&$[I+2]===1&&$[I+3]===1&&$[I+4]===1&&$[I+5]===0&&$[I+6]===1&&(Ss.isWhiteHorizontal($,I-4,I)||Ss.isWhiteHorizontal($,I+7,I+11))&&g++,A+6<C&&v[A][I]===1&&v[A+1][I]===0&&v[A+2][I]===1&&v[A+3][I]===1&&v[A+4][I]===1&&v[A+5][I]===0&&v[A+6][I]===1&&(Ss.isWhiteVertical(v,I,A-4,A)||Ss.isWhiteVertical(v,I,A+7,A+11))&&g++}return g*Ss.N3}static isWhiteHorizontal(m,g,v){g=Math.max(g,0),v=Math.min(v,m.length);for(let k=g;k<v;k++)if(m[k]===1)return!1;return!0}static isWhiteVertical(m,g,v,k){v=Math.max(v,0),k=Math.min(k,m.length);for(let C=v;C<k;C++)if(m[C][g]===1)return!1;return!0}static applyMaskPenaltyRule4(m){let g=0;const v=m.getArray(),k=m.getWidth(),C=m.getHeight();for(let $=0;$<C;$++){const V=v[$];for(let X=0;X<k;X++)V[X]===1&&g++}const A=m.getHeight()*m.getWidth();return Math.floor(Math.abs(g*2-A)*10/A)*Ss.N4}static getDataMaskBit(m,g,v){let k,C;switch(m){case 0:k=v+g&1;break;case 1:k=v&1;break;case 2:k=g%3;break;case 3:k=(v+g)%3;break;case 4:k=Math.floor(v/2)+Math.floor(g/3)&1;break;case 5:C=v*g,k=(C&1)+C%3;break;case 6:C=v*g,k=(C&1)+C%3&1;break;case 7:C=v*g,k=C%3+(v+g&1)&1;break;default:throw new f("Invalid mask pattern: "+m)}return k===0}static applyMaskPenaltyRule1Internal(m,g){let v=0;const k=g?m.getHeight():m.getWidth(),C=g?m.getWidth():m.getHeight(),A=m.getArray();for(let I=0;I<k;I++){let $=0,V=-1;for(let X=0;X<C;X++){const ne=g?A[I][X]:A[X][I];ne===V?$++:($>=5&&(v+=Ss.N1+($-5)),$=1,V=ne)}$>=5&&(v+=Ss.N1+($-5))}return v}}Ss.N1=3,Ss.N2=3,Ss.N3=40,Ss.N4=10;class _w{constructor(m,g){this.width=m,this.height=g;const v=new Array(g);for(let k=0;k!==g;k++)v[k]=new Uint8Array(m);this.bytes=v}getHeight(){return this.height}getWidth(){return this.width}get(m,g){return this.bytes[g][m]}getArray(){return this.bytes}setNumber(m,g,v){this.bytes[g][m]=v}setBoolean(m,g,v){this.bytes[g][m]=v?1:0}clear(m){for(const g of this.bytes)_.fill(g,m)}equals(m){if(!(m instanceof _w))return!1;const g=m;if(this.width!==g.width||this.height!==g.height)return!1;for(let v=0,k=this.height;v<k;++v){const C=this.bytes[v],A=g.bytes[v];for(let I=0,$=this.width;I<$;++I)if(C[I]!==A[I])return!1}return!0}toString(){const m=new B;for(let g=0,v=this.height;g<v;++g){const k=this.bytes[g];for(let C=0,A=this.width;C<A;++C)switch(k[C]){case 0:m.append(" 0");break;case 1:m.append(" 1");break;default:m.append("  ");break}m.append(`
2715`)}return m.toString()}}class _h{constructor(){this.maskPattern=-1}getMode(){return this.mode}getECLevel(){return this.ecLevel}getVersion(){return this.version}getMaskPattern(){return this.maskPattern}getMatrix(){return this.matrix}toString(){const m=new B;return m.append(`<<
2716`),m.append(" mode: "),m.append(this.mode?this.mode.toString():"null"),m.append(`
2717 ecLevel: `),m.append(this.ecLevel?this.ecLevel.toString():"null"),m.append(`
2718 version: `),m.append(this.version?this.version.toString():"null"),m.append(`
2719 maskPattern: `),m.append(this.maskPattern.toString()),this.matrix?(m.append(`
2720 matrix:
2721`),m.append(this.matrix.toString())):m.append(`
2722 matrix: null
2723`),m.append(`>>
2724`),m.toString()}setMode(m){this.mode=m}setECLevel(m){this.ecLevel=m}setVersion(m){this.version=m}setMaskPattern(m){this.maskPattern=m}setMatrix(m){this.matrix=m}static isValidMaskPattern(m){return m>=0&&m<_h.NUM_MASK_PATTERNS}}_h.NUM_MASK_PATTERNS=8;class Fr extends u{}Fr.kind="WriterException";class Wt{constructor(){}static clearMatrix(m){m.clear(255)}static buildMatrix(m,g,v,k,C){Wt.clearMatrix(C),Wt.embedBasicPatterns(v,C),Wt.embedTypeInfo(g,k,C),Wt.maybeEmbedVersionInfo(v,C),Wt.embedDataBits(m,k,C)}static embedBasicPatterns(m,g){Wt.embedPositionDetectionPatternsAndSeparators(g),Wt.embedDarkD
vendor: 7,832 bytes, line 2724
2724otAtLeftBottomCorner(g),Wt.maybeEmbedPositionAdjustmentPatterns(m,g),Wt.embedTimingPatterns(g)}static embedTypeInfo(m,g,v){const k=new E;Wt.makeTypeInfoBits(m,g,k);for(let C=0,A=k.getSize();C<A;++C){const I=k.get(k.getSize()-1-C),$=Wt.TYPE_INFO_COORDINATES[C],V=$[0],X=$[1];if(v.setBoolean(V,X,I),C<8){const ne=v.getWidth()-C-1;v.setBoolean(ne,8,I)}else{const ie=v.getHeight()-7+(C-8);v.setBoolean(8,ie,I)}}}static maybeEmbedVersionInfo(m,g){if(m.getVersionNumber()<7)return;const v=new E;Wt.makeVersionInfoBits(m,v);let k=6*3-1;for(let C=0;C<6;++C)for(let A=0;A<3;++A){const I=v.get(k);k--,g.setBoolean(C,g.getHeight()-11+A,I),g.setBoolean(g.getHeight()-11+A,C,I)}}static embedDataBits(m,g,v){let k=0,C=-1,A=v.getWidth()-1,I=v.getHeight()-1;for(;A>0;){for(A===6&&(A-=1);I>=0&&I<v.getHeight();){for(let $=0;$<2;++$){const V=A-$;if(!Wt.isEmpty(v.get(V,I)))continue;let X;k<m.getSize()?(X=m.get(k),++k):X=!1,g!==255&&Ss.getDataMaskBit(g,V,I)&&(X=!X),v.setBoolean(V,I,X)}I+=C}C=-C,I+=C,A-=2}if(k!==m.getSize())throw new Fr("Not all bits consumed: "+k+"/"+m.getSize())}static findMSBSet(m){return 32-j.numberOfLeadingZeros(m)}static calculateBCHCode(m,g){if(g===0)throw new f("0 polynomial");const v=Wt.findMSBSet(g);for(m<<=v-1;Wt.findMSBSet(m)>=v;)m^=g<<Wt.findMSBSet(m)-v;return m}static makeTypeInfoBits(m,g,v){if(!_h.isValidMaskPattern(g))throw new Fr("Invalid mask pattern");const k=m.getBits()<<3|g;v.appendBits(k,5);const C=Wt.calculateBCHCode(k,Wt.TYPE_INFO_POLY);v.appendBits(C,10);const A=new E;if(A.appendBits(Wt.TYPE_INFO_MASK_PATTERN,15),v.xor(A),v.getSize()!==15)throw new Fr("should not happen but we got: "+v.getSize())}static makeVersionInfoBits(m,g){g.appendBits(m.getVersionNumber(),6);const v=Wt.calculateBCHCode(m.getVersionNumber(),Wt.VERSION_INFO_POLY);if(g.appendBits(v,12),g.getSize()!==18)throw new Fr("should not happen but we got: "+g.getSize())}static isEmpty(m){return m===255}static embedTimingPatterns(m){for(let g=8;g<m.getWidth()-8;++g){const v=(g+1)%2;Wt.isEmpty(m.get(g,6))&&m.setNumber(g,6,v),Wt.isEmpty(m.get(6,g))&&m.setNumber(6,g,v)}}static embedDarkDotAtLeftBottomCorner(m){if(m.get(8,m.getHeight()-8)===0)throw new Fr;m.setNumber(8,m.getHeight()-8,1)}static embedHorizontalSeparationPattern(m,g,v){for(let k=0;k<8;++k){if(!Wt.isEmpty(v.get(m+k,g)))throw new Fr;v.setNumber(m+k,g,0)}}static embedVerticalSeparationPattern(m,g,v){for(let k=0;k<7;++k){if(!Wt.isEmpty(v.get(m,g+k)))throw new Fr;v.setNumber(m,g+k,0)}}static embedPositionAdjustmentPattern(m,g,v){for(let k=0;k<5;++k){const C=Wt.POSITION_ADJUSTMENT_PATTERN[k];for(let A=0;A<5;++A)v.setNumber(m+A,g+k,C[A])}}static embedPositionDetectionPattern(m,g,v){for(let k=0;k<7;++k){const C=Wt.POSITION_DETECTION_PATTERN[k];for(let A=0;A<7;++A)v.setNumber(m+A,g+k,C[A])}}static embedPositionDetectionPatternsAndSeparators(m){const g=Wt.POSITION_DETECTION_PATTERN[0].length;Wt.embedPositionDetectionPattern(0,0,m),Wt.embedPositionDetectionPattern(m.getWidth()-g,0,m),Wt.embedPositionDetectionPattern(0,m.getWidth()-g,m);const v=8;Wt.embedHorizontalSeparationPattern(0,v-1,m),Wt.embedHorizontalSeparationPattern(m.getWidth()-v,v-1,m),Wt.embedHorizontalSeparationPattern(0,m.getWidth()-v,m);const k=7;Wt.embedVerticalSeparationPattern(k,0,m),Wt.embedVerticalSeparationPattern(m.getHeight()-k-1,0,m),Wt.embedVerticalSeparationPattern(k,m.getHeight()-k,m)}static maybeEmbedPositionAdjustmentPatterns(m,g){if(m.getVersionNumber()<2)return;const v=m.getVersionNumber()-1,k=Wt.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[v];for(let C=0,A=k.length;C!==A;C++){const I=k[C];if(I>=0)for(let $=0;$!==A;$++){const V=k[$];V>=0&&Wt.isEmpty(g.get(V,I))&&Wt.embedPositionAdjustmentPattern(V-2,I-2,g)}}}}Wt.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),Wt.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),Wt.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),Wt.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),Wt.VERSION_INFO_POLY=7973,Wt.TYPE_INFO_POLY=1335,Wt.TYPE_INFO_MASK_PATTERN=21522;class she{constructor(m,g){this.dataBytes=m,this.errorCorrectionBytes=g}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class ts{constructor(){}static calculateMaskPenalty(m){return Ss.applyMaskPenaltyRule1(m)+Ss.applyMaskPenaltyRule2(m)+Ss.applyMaskPenaltyRule3(m)+Ss.applyMaskPenaltyRule4(m)}static encode(m,g,v=null){let k=ts.DEFAULT_BYTE_MODE_ENCODING;const C=v!==null&&v.get(xi.CHARACTER_SET)!==void 0;C&&(k=v.get(xi.CHARACTER_SET).toString());const A=this.chooseMode(m,k),I=new E;if(A===Ut.BYTE&&(C||ts.DEFAULT_BYTE_MODE_ENCODING!==k)){const rt=D.getCharacterSetECIByName(k);rt!==void 0&&this.appendECI(rt,I)}this.appendModeInfo(A,I);const $=new E;this.appendBytes(m,A,$,k);let V;if(v!==null&&v.get(xi.QR_VERSION)!==void 0){const rt=Number.parseInt(v.get(xi.QR_VERSION).toString(),10);V=Ft.getVersionForNumber(rt);const Xe=this.calculateBitsNeeded(A,I,$,V);if(!this.willFit(Xe,V,g))throw new Fr("Data too big for requested version")}else V=this.recommendVersion(g,A,I,$);const X=new E;X.appendBitArray(I);const ne=A===Ut.BYTE?$.getSizeInBytes():m.length;this.appendLengthInfo(ne,V,A,X),X.appendBitArray($);const ie=V.getECBlocksForLevel(g),he=V.getTotalCodewords()-ie.getTotalECCodewords();this.terminateBits(he,X);const ye=this.interleaveWithECBytes(X,V.getTotalCodewords(),he,ie.getNumBlocks()),ve=new _h;ve.setECLevel(g),ve.setMode(A),ve.setVersion(V);const Ce=V.getDimensionForVersion(),Me=new _w(Ce,Ce),tt=this.chooseMaskPattern(ye,g,V,Me);return ve.setMaskPattern(tt),Wt.buildMatrix(ye,g,V,tt,Me),ve.setMatr
2724ix(Me),ve}static recommendVersion(m,g,v,k){const C=this.calculateBitsNeeded(g,v,k,Ft.getVersionForNumber(1)),A=this.chooseVersion(C,m),I=this.calculateBitsNeeded(g,v,k,A);return this.chooseVersion(I,m)}static calculateBitsNeeded(m,g,v,k){return g.getSize()+m.getCharacterCountBits(k)+v.getSize()}static getAlphanumericCode(m){return m<ts.ALPHANUMERIC_TABLE.length?ts.ALPHANUMERIC_TABLE[m]:-1}static chooseMode(m,g=null){if(D.SJIS.getName()===g&&this.isOnlyDoubleByteKanji(m))return Ut.KANJI;let v=!1,k=!1;for(let C=0,A=m.length;C<A;++C){const I=m.charAt(C);if(ts.isDigit(I))v=!0;else if(this.getAlphanumericCode(I.charCodeAt(0))!==-1)k=!0;else return Ut.BYTE}return k?Ut.ALPHANUMERIC:v?Ut.NUMERIC:Ut.BYTE}static isOnlyDoubleByteKanji(m){let g;try{g=L.encode(m,D.SJIS)}catch{return!1}const v=g.length;if(v%2!==0)return!1;for(let k=0;k<v;k+=2){const C=g[k]&255;if((C<129||C>159)&&(C<224||C>235))return!1}return!0}static chooseMaskPattern(m,g,v,k){let C=Number.MAX_SAFE_INTEGER,A=-1;for(let I=0;I<_h.NUM_MASK_PATTERNS;I++){Wt.buildMatrix(m,g,v,I,k);let $=this.calculateMaskPenalty(k);$<C&&(C=$,A=I)}return A}static chooseVersion(m,g){for(let v=1;v<=40;v++){const k=Ft.getVersionForNumber(v);if(ts.willFit(m,k,g))return k}throw new Fr("Data too big")}static willFit(m,g,v){const k=g.getTotalCodewords(),A=g.getECBlocksForLevel(v).getTotalECCodewords(),I=k-A,$=(m+7)/8;return I>=$}static terminateBits(m,g){const v=m*8;if(g.getSize()>v)throw new Fr("data bits cannot fit in the QR Code"+g.getSize()+" > "+v);for(let A=0;A<4&&g.getSize()<v;++A)g.appendBit(!1);const k=g.getSize()&7;if(k>0)for(let A=k;A<8;A++)g.appendBit(!1);const C=m-g.getSizeInBytes();for(let A=0;A<C;++A)g.appendBits(A&1?17:236,8);if(g.getSize()!==v)throw new Fr("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(m,g,v,k,C,A){if(k>=v)throw new Fr("Block ID too large");const I=m%v,$=v-I,V=Math.floor(m/v),X=V+1,ne=Math.floor(g/v),ie=ne+1,he=V-ne,ye=X-ie;if(he!==ye)throw new Fr("EC bytes mismatch");if(v!==$+I)throw new Fr("RS blocks mismatch");if(m!==(ne+he)*$+(ie+ye)*I)throw new Fr("Total bytes mismatch");k<$?(C[0]=ne,A[0]=he):(C[0]=ie,A[0]=ye)}static interleaveWithECBytes(m,g,v,k){if(m.getSizeInBytes()!==v)throw new Fr("Number of bits and data bytes does not match");let C=0,A=0,I=0;const $=new Array;for(let X=0;X<k;++X){const ne=new Int32Array(1),ie=new Int32Array(1);ts.getNumDataBytesAndNumECBytesForBlockID(g,v,k,X,ne,ie);const he=ne[0],ye=new Uint8Array(he);m.toBytes(8*C,ye,0,he);const ve=ts.generateECBytes(ye,ie[0]);$.push(new she(ye,ve)),A=Math.max(A,he),I=Math.max(I,ve.length),C+=ne[0]}if(v!==C)throw new Fr("Data bytes does not match offset");const V=new E;for(let X=0;X<A;++X)for(const ne of $){const ie=ne.getDataBytes();X<ie.length&&V.appendBits(ie[X],8)}for(let X=0;X<I;++X)for(const ne of $){const ie=ne.getErrorCorrectionBytes();X<ie.length&&V.appendBits(ie[X],8)}if(g!==V.getSizeInBytes())throw new Fr("Interleaving error: "+g+" and "+V.getSizeInBytes()+" differ.");return V}static generateECBytes(m,g){const v=m.length,k=new Int32Array(v+g);for(let A=0;A<v;A++)k[A]=m[A]&255;new gS(Te.QR_CODE_FIELD_256).encode(k,g);const C=new Uint8Array(g);for(let A=0;A<g;A++)C[A]=k[v+A];return C}static appendModeInfo(m,g){g.appendBits(m.getBits(),4)}static appendLengthInfo(m,g,v,k){const C=v.getCharacterCountBits(g);if(m>=1<<C)throw new Fr(m+" is bigger than "+((1<<C)-1));k.appendBits(m,C)}static appendBytes(m,g,v,k){switch(g){case Ut.NUMERIC:ts.appendNumericBytes(m,v);break;case Ut.ALPHANUMERIC:ts.appendAlphanumericBytes(m,v);break;case Ut.BYTE:ts.append8BitBytes(m,v,k);break;case Ut.KANJI:ts.appendKanjiBytes(m,v);break;default:throw new Fr("Invalid mode: "+g)}}static getDigit(m){return m.charCodeAt(0)-48}static isDigit(m){const g=ts.getDigit(m);return g>=0&&g<=9}static appendNumericBytes(m,g){const v=m.length;let k=0;for(;k<v;){const C=ts.getDigit(m.charAt(k));if(k+2<v){const A=ts.getDigit(m.charAt(k+1)),I=ts.getDigit(m.charAt(k+2));g.appendBits(C*100+A*10+I,10),k+=3}else if(k+1<v){const A=ts.getDigit(m.charAt(k+1));g.appendBits(C*10+A,7),k+=2}else g.appendBits(C,4),k++}}static appendAlphanumericBytes(m,g){const v=m.length;let k=0;for(;k<v;){const C=ts.getAlphanumericCode(m.charCodeAt(k));if(C===-1)throw new Fr;if(k+1<v){const A=ts.getAlphanumericCode(m.charCodeAt(k+1));if(A===-1)throw new Fr;g.appendBits(C*45+A,11),k+=2}else g.appendBits(C,6),k++}}static append8BitBytes(m,g,v){let k;try{k=L.encode(m,v)}catch(C){throw new Fr(C)}for(let C=0,A=k.length;C!==A;C++){const I=k[C];g.appendBits(I,8)}}static appendKanjiBytes(m,g){let v;try{v=L.encode(m,D.SJIS)}catch(C){throw new Fr(C)}const k=v.length;for(let C=0;C<k;C+=2){const A=v[C]&255,I=v[C+1]&255,$=A<<8&4294967295|I;let V=-1;if($>=33088&&$<=40956?V=$-33088:$>=57408&&$<=60351&&(V=$-49472),V===-1)throw new Fr("Invalid byte sequence");const X=(V>>8)*192+(V&255);g.appendBits(X,13)}}static appendECI(m,g){g.appendBits(Ut.ECI.getBits(),4),g.appendBits(m.getValue(),8)}}ts.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),ts.DEFAULT_BYTE_MODE_ENCODING=D.UTF8.getName();
2724class jh{write(m,g,v,k=null){if(m.length===0)throw new f("Found empty contents");if(g<0||v<0)throw new f("Requested dimensions are too small: "+g+"x"+v);let C=Hr.L,A=jh.QUIET_ZONE_SIZE;k!==null&&(k.get(xi.ERROR_CORRECTION)!==void 0&&(C=Hr.fromString(k.get(xi.ERROR_CORRECTION).toString())),k.get(xi.MARGIN)!==void 0&&(A=Number.parseInt(k.get(xi.MARGIN).toString(),10)));const I=ts.encode(m,C,k);return this.renderResult(I,g,v,A)}writeToDom(m,g,v,k,C=null){typeof m=="string"&&(m=document.querySelector(m));const A=this.write(g,v,k,C);m&&m.appendChild(A)}renderResult(m,g,v,k){const C=m.getMatrix();if(C===null)throw new Ne;const A=C.getWidth(),I=C.getHeight(),$=A+k*2,V=I+k*2,X=Math.max(g,$),ne=Math.max(v,V),ie=Math.min(Math.floor(X/$),Math.floor(ne/V)),he=Math.floor((X-A*ie)/2),ye=Math.floor((ne-I*ie)/2),ve=this.createSVGElement(X,ne);for(let Ce=0,Me=ye;Ce<I;Ce++,Me+=ie)for(let tt=0,rt=he;tt<A;tt++,rt+=ie)if(C.get(tt,Ce)===1){const Xe=this.createSvgRectElement(rt,Me,ie,ie);ve.appendChild(Xe)}return ve}createSVGElement(m,g){const v=document.createElementNS(jh.SVG_NS,"svg");return v.setAttributeNS(null,"height",m.toString()),v.setAttributeNS(null,"width",g.toString()),v}createSvgRectElement(m,g,v,k){const C=document.createElementNS(jh.SVG_NS,"rect");return C.setAttributeNS(null,"x",m.toString()),C.setAttributeNS(null,"y",g.toString()),C.setAttributeNS(null,"height",v.toString()),C.setAttributeNS(null,"width",k.toString()),C.setAttributeNS(null,"fill","#000000"),C}}jh.QUIET_ZONE_SIZE=4,jh.SVG_NS="http://www.w3.org/2000/svg";class Tp{encode(m,g,v,k,C){if(m.length===0)throw new f("Found empty contents");if(g!==se.QR_CODE)throw new f("Can only encode QR_CODE, but got "+g);if(v<0||k<0)throw new f(`Requested dimensions are too small: ${v}x${k}`);let A=Hr.L,I=Tp.QUIET_ZONE_SIZE;C!==null&&(C.get(xi.ERROR_CORRECTION)!==void 0&&(A=Hr.fromString(C.get(xi.ERROR_CORRECTION).toString())),C.get(xi.MARGIN)!==void 0&&(I=Number.parseInt(C.get(xi.MARGIN).toString(),10)));const $=ts.encode(m,A,C);return Tp.renderResult($,v,k,I)}static renderResult(m,g,v,k){const C=m.getMatrix();if(C===null)throw new Ne;const A=C.getWidth(),I=C.getHeight(),$=A+k*2,V=I+k*2,X=Math.max(g,$),ne=Math.max(v,V),ie=Math.min(Math.floor(X/$),Math.floor(ne/V)),he=Math.floor((X-A*ie)/2),ye=Math.floor((ne-I*ie)/2),ve=new U(X,ne);for(let Ce=0,Me=ye;Ce<I;Ce++,Me+=ie)for(let tt=0,rt=he;tt<A;tt++,rt+=ie)C.get(tt,Ce)===1&&ve.setRegion(rt,Me,ie,ie);return ve}}Tp.QUIET_ZONE_SIZE=4;class ihe{encode(m,g,v,k,C){let A;switch(g){case se.QR_CODE:A=new Tp;break;default:throw new f("No encoder available for format "+g)}return A.encode(m,g,v,k,C)}}class Ec extends K{constructor(m,g,v,k,C,A,I,$){if(super(A,I),this.yuvData=m,this.dataWidth=g,this.dataHeight=v,this.left=k,this.top=C,k+A>g||C+I>v)throw new f("Crop rectangle does not fit within image data.");$&&this.reverseHorizontal(A,I)}getRow(m,g){if(m<0||m>=this.getHeight())throw new f("Requested row is outside the image: "+m);const v=this.getWidth();(g==null||g.length<v)&&(g=new Uint8ClampedArray(v));const k=(m+this.top)*this.dataWidth+this.left;return y.arraycopy(this.yuvData,k,g,0,v),g}getMatrix(){const m=this.getWidth(),g=this.getHeight();if(m===this.dataWidth&&g===this.dataHeight)return this.yuvData;const v=m*g,k=new Uint8ClampedArray(v);let C=this.top*this.dataWidth+this.left;if(m===this.dataWidth)return y.arraycopy(this.yuvData,C,k,0,v),k;for(let A=0;A<g;A++){const I=A*m;y.arraycopy(this.yuvData,C,k,I,m),C+=this.dataWidth}return k}isCropSupported(){return!0}crop(m,g,v,k){return new Ec(this.yuvData,this.dataWidth,this.dataHeight,this.left+m,this.top+g,v,k,!1)}renderThumbnail(){const m=this.getWidth()/Ec.THUMBNAIL_SCALE_FACTOR,g=this.getHeight()/Ec.THUMBNAIL_SCALE_FACTOR,v=new Int32Array(m*g),k=this.yuvData;let C=this.top*this.dataWidth+this.left;for(let A=0;A<g;A++){const I=A*m;for(let $=0;$<m;$++){const V=k[C+$*Ec.THUMBNAIL_SCALE_FACTOR]&255;v[I+$]=4278190080|V*65793}C+=this.dataWidth*Ec.THUMBNAIL_SCALE_FACTOR}return v}getThumbnailWidth(){return this.getWidth()/Ec.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Ec.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(m,g){const v=this.yuvData;for(let k=0,C=this.top*this.dataWidth+this.left;k<g;k++,C+=this.dataWidth){const A=C+m/2;for(let I=C,$=C+m-1;I<A;
2724I++,$--){const V=v[I];v[I]=v[$],v[$]=V}}}invert(){return new W(this)}}Ec.THUMBNAIL_SCALE_FACTOR=2;class xS extends K{constructor(m,g,v,k,C,A,I){if(super(g,v),this.dataWidth=k,this.dataHeight=C,this.left=A,this.top=I,m.BYTES_PER_ELEMENT===4){const $=g*v,V=new Uint8ClampedArray($);for(let X=0;X<$;X++){const ne=m[X],ie=ne>>16&255,he=ne>>7&510,ye=ne&255;V[X]=(ie+he+ye)/4&255}this.luminances=V}else this.luminances=m;if(k===void 0&&(this.dataWidth=g),C===void 0&&(this.dataHeight=v),A===void 0&&(this.left=0),I===void 0&&(this.top=0),this.left+g>this.dataWidth||this.top+v>this.dataHeight)throw new f("Crop rectangle does not fit within image data.")}getRow(m,g){if(m<0||m>=this.getHeight())throw new f("Requested row is outside the image: "+m);const v=this.getWidth();(g==null||g.length<v)&&(g=new Uint8ClampedArray(v));const k=(m+this.top)*this.dataWidth+this.left;return y.arraycopy(this.luminances,k,g,0,v),g}getMatrix(){const m=this.getWidth(),g=this.getHeight();if(m===this.dataWidth&&g===this.dataHeight)return this.luminances;const v=m*g,k=new Uint8ClampedArray(v);let C=this.top*this.dataWidth+this.left;if(m===this.dataWidth)return y.arraycopy(this.luminances,C,k,0,v),k;for(let A=0;A<g;A++){const I=A*m;y.arraycopy(this.luminances,C,k,I,m),C+=this.dataWidth}return k}isCropSupported(){return!0}crop(m,g,v,k){return new xS(this.luminances,v,k,this.dataWidth,this.dataHeight,this.left+m,this.top+g)}invert(){return new W(this)}}class J8 extends D{static forName(m){return this.getCharacterSetECIByName(m)}}class yS{}yS.ISO_8859_1=D.ISO8859_1;class Z8{isCompact(){return this.compact}setCompact(m){this.compact=m}getSize(){return this.size}setSize(m){this.size=m}getLayers(){return this.layers}setLayers(m){this.layers=m}getCodeWords(){return this.codeWords}setCodeWords(m){this.codeWords=m}getMatrix(){return this.matrix}setMatrix(m){this.matrix=m}}class eL{static singletonList(m){return[m]}static min(m,g){return m.sort(g)[0]}}class ahe{constructor(m){this.previous=m}getPrevious(){return this.previous}}class Pp extends ahe{constructor(m,g,v){super(m),this.value=g,this.bitCount=v}appendTo(m,g){m.appendBits(this.value,this.bitCount)}add(m,g){return new Pp(this,m,g)}addBinaryShift(m,g){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Pp(this,m,g)}toString(){let m=this.value&(1<<this.bitCount)-1;return m|=1<<this.bitCount,"<"+j.toBinaryString(m|1<<this.bitCount).substring(1)+">"}}class vS extends Pp{constructor(m,g,v){super(m,0,0),this.binaryShiftStart=g,this.binaryShiftByteCount=v}appendTo(m,g){for(let v=0;v<this.binaryShiftByteCount;v++)(v===0||v===31&&this.binaryShiftByteCount<=62)&&(m.appendBits(31,5),this.binaryShiftByteCount>62?m.appendBits(this.binaryShiftByteCount-31,16):v===0?m.appendBits(Math.min(this.binaryShiftByteCount,31),5):m.appendBits(this.binaryShiftByteCount-31,5)),m.appendBits(g[this.binaryShiftStart+v],8)}addBinaryShift(m,g){return new vS(this,m,g)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function ohe(te,m,g){return new vS(te,m,g)}function ly(te,m,g){return new Pp(te,m,g)}const lhe=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Id=0,jw=1,ol=2,tL=3,Sc=4,che=new Pp(null,0,0),bS=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])];function uhe(te){for(let m of te)_.fill(m,-1);return te[Id][Sc]=0,te[jw][Sc]=0,te[jw][Id]=28,te[tL][Sc]=0,te[ol][Sc]=0,te[ol][Id]=15,te}const nL=uhe(_.createInt32Array(6,6));class Ac{constructor(m,g,v,k){this.token=m,this.mode=g,this.binaryShiftByteCount=v,this.bitCount=k}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(m,g){let v=this.bitCount,k=this.token;if(m!==this.mode){let A=bS[this.mode][m];k=ly(k,A&65535,A>>16),v+=A>>16}let C=m===ol?4:5;return k=ly(k,g,C),new Ac(k,m,0,v+C)}shiftAndAppend(m,g){let v=this.token,k=this.mode===ol?4:5;return v=ly(v,nL[this.mode][m],k),v=ly(v,g,5),new Ac(v,this.mode,0,this.bitCount+k+5)}addBinaryShiftChar(m){let g=this.token,v=this.mode,k=this.bitCount;if(this.mode===Sc||this.mode===ol){let I=bS[v][Id];g=ly(g,I&65535,I>>16),k+=I>>16,v=Id}let C=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,A=new Ac(g,v,this.binaryShiftByteCount+1,k+C);return A.binaryShiftByteCount===2078&&(A=A.endBinaryShift(m+1)),A}endBinaryShift(m){if(this.binaryShiftByteCount===0)return this;let g=this.token;return g=ohe(g,m-this.binaryShiftByteCount,this.binaryShiftByteCount),new Ac(g,this.mode,0,this.bitCount)}
2724isBetterThanOrEqualTo(m){let g=this.bitCount+(bS[this.mode][m.mode]>>16);return this.binaryShiftByteCount<m.binaryShiftByteCount?g+=Ac.calculateBinaryShiftCost(m)-Ac.calculateBinaryShiftCost(this):this.binaryShiftByteCount>m.binaryShiftByteCount&&m.binaryShiftByteCount>0&&(g+=10),g<=m.bitCount}toBitArray(m){let g=[];for(let k=this.endBinaryShift(m.length).token;k!==null;k=k.getPrevious())g.unshift(k);let v=new E;for(const k of g)k.appendTo(v,m);return v}toString(){return M.format("%s bits=%d bytes=%d",lhe[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(m){return m.binaryShiftByteCount>62?21:m.binaryShiftByteCount>31?20:m.binaryShiftByteCount>0?10:0}}Ac.INITIAL_STATE=new Ac(che,Id,0,0);function dhe(te){const m=M.getCharCode(" "),g=M.getCharCode("."),v=M.getCharCode(",");te[Id][m]=1;const k=M.getCharCode("Z"),C=M.getCharCode("A");for(let ie=C;ie<=k;ie++)te[Id][ie]=ie-C+2;te[jw][m]=1;const A=M.getCharCode("z"),I=M.getCharCode("a");for(let ie=I;ie<=A;ie++)te[jw][ie]=ie-I+2;te[ol][m]=1;const $=M.getCharCode("9"),V=M.getCharCode("0");for(let ie=V;ie<=$;ie++)te[ol][ie]=ie-V+2;te[ol][v]=12,te[ol][g]=13;const X=["\0"," ","�","�","�","�","�","�","\x07","\b","	",`
2725`,"\v","\f","\r","\x1B","�","�","�","�","@","\\","^","_","`","|","~","�"];for(let ie=0;ie<X.length;ie++)te[tL][M.getCharCode(X[ie])]=ie;const ne=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let ie=0;ie<ne.length;ie++)M.getCharCode(ne[ie])>0&&(te[Sc][M.getCharCode(ne[ie])]=ie);return te}const wS=dhe(_.createInt32Array(5,256));class cy{constructor(m){this.text=m}encode(){const m=M.getCharCode(" "),g=M.getCharCode(`
2726`);let v=eL.singletonList(Ac.INITIAL_STATE);for(let C=0;C<this.text.length;C++){let A,I=C+1<this.text.length?this.text[C+1]:0;switch(this.text[C]){case M.getCharCode("\r"):A=I===g?2:0;break;case M.getCharCode("."):A=I===m?3:0;break;case M.getCharCode(","):A=I===m?4:0;break;case M.getCharCode(":"):A=I===m?5:0;break;default:A=0}A>0?(v=cy.updateStateListForPair(v,C,A),C++):v=this.updateStateListForChar(v,C)}return eL.min(v,(C,A)=>C.getBitCount()-A.getBitCount()).toBitArray(this.text)}updateStateListForChar(m,g){const v=[];for(let k of m)this.updateStateForChar(k,g,v);return cy.simplifyStates(v)}updateStateForChar(m,g,v){let k=this.text[g]&255,C=wS[m.getMode()][k]>0,A=null;for(let I=0;I<=Sc;I++){let $=wS[I][k];if($>0){if(A==null&&(A=m.endBinaryShift(g)),!C||I===m.getMode()||I===ol){const V=A.latchAndAppend(I,$);v.push(V)}if(!C&&nL[m.getMode()][I]>=0){const V=A.shiftAndAppend(I,$);v.push(V)}}}if(m.getBinaryShiftByteCount()>0||wS[m.getMode()][k]===0){let I=m.addBinaryShiftChar(g);v.push(I)}}static updateStateListForPair(m,g,v){const k=[];for(let C of m)this.updateStateForPair(C,g,v,k);return this.simplifyStates(k)}static updateStateForPair(m,g,v,k){let C=m.endBinaryShift(g);if(k.push(C.latchAndAppend(Sc,v)),m.getMode()!==Sc&&k.push(C.shiftAndAppend(Sc,v)),v===3||v===4){let A=C.latchAndAppend(ol,16-v).latchAndAppend(ol,1);k.push(A)}if(m.getBinaryShiftByteCount()>0){let A=m.addBinaryShiftChar(g).addBinaryShiftChar(g+1);k.push(A)}}static simplifyStates(m){let g=[];for(const v of m){let k=!0;for(const C of g){if(C.isBetterThanOrEqualTo(v)){k=!1;break}v.isBetterThanOrEqualTo(C)&&(g=g.filter(A=>A!==C))}k&&g.push(v)}return g}}class Kn{constructor(){}static encodeBytes(m){return Kn.encode(m,Kn.DEFAULT_EC_PERCENT,Kn.DEFAULT_AZTEC_LAYERS)}static encode(m,g,v){let k=new cy(m).encode(),C=j.truncDivision(k.getSize()*g,100)+11,A=k.getSize()+C,I,$,V,X,ne;if(v!==Kn.DEFAULT_AZTEC_LAYERS){if(I=v<0,$=Math.abs(v),$>(I?Kn.MAX_NB_BITS_COMPACT:Kn.MAX_NB_BITS))throw new f(M.format("Illegal value %s for layers",v));V=Kn.totalBitsInLayer($,I),X=Kn.WORD_SIZE[$];let Xe=V-V%X;if(ne=Kn.stuffBits(k,X),ne.getSize()+C>Xe)throw new f("Data to large for user specified layer");if(I&&ne.getSize()>X*64)throw new f("Data to large for user specified layer")}else{X=0,ne=null;for(let Xe=0;;Xe++){if(Xe>Kn.MAX_NB_BITS)throw new f("Data too large for an Aztec code");if(I=Xe<=3,$=I?Xe+1:Xe,V=Kn.totalBitsInLayer($,I),A>V)continue;(ne==null||X!==Kn.WORD_SIZE[$])&&(X=Kn.WORD_SIZE[$],ne=Kn.stuffBits(k,X));let Rn=V-V%X;if(!(I&&ne.getSize()>X*64)&&ne.getSize()+C<=Rn)break}}let ie=Kn.generateCheckWords(ne,V,X),he=ne.getSize()/X,ye=Kn.generateModeMessage(I,$,he),ve=(I?11:14)+$*4,Ce=new Int32Array(ve),Me;if(I){Me=ve;for(let Xe=0;Xe<Ce.length;Xe++)Ce[Xe]=Xe}else{Me=ve+1+2*j.truncDivision(j.truncDivision(ve,2)-1,15);let Xe=j.truncDivision(ve,2),Rn=j.truncDivision(Me,2);for(let pn=0;pn<Xe;pn++){let Ja=pn+j.truncDivision(pn,15);Ce[Xe-pn-1]=Rn-Ja-1,Ce[Xe+pn]=Rn+Ja+1}}
2726let tt=new U(Me);for(let Xe=0,Rn=0;Xe<$;Xe++){let pn=($-Xe)*4+(I?9:12);for(let Ja=0;Ja<pn;Ja++){let ql=Ja*2;for(let Za=0;Za<2;Za++)ie.get(Rn+ql+Za)&&tt.set(Ce[Xe*2+Za],Ce[Xe*2+Ja]),ie.get(Rn+pn*2+ql+Za)&&tt.set(Ce[Xe*2+Ja],Ce[ve-1-Xe*2-Za]),ie.get(Rn+pn*4+ql+Za)&&tt.set(Ce[ve-1-Xe*2-Za],Ce[ve-1-Xe*2-Ja]),ie.get(Rn+pn*6+ql+Za)&&tt.set(Ce[ve-1-Xe*2-Ja],Ce[Xe*2+Za])}Rn+=pn*8}if(Kn.drawModeMessage(tt,I,Me,ye),I)Kn.drawBullsEye(tt,j.truncDivision(Me,2),5);else{Kn.drawBullsEye(tt,j.truncDivision(Me,2),7);for(let Xe=0,Rn=0;Xe<j.truncDivision(ve,2)-1;Xe+=15,Rn+=16)for(let pn=j.truncDivision(Me,2)&1;pn<Me;pn+=2)tt.set(j.truncDivision(Me,2)-Rn,pn),tt.set(j.truncDivision(Me,2)+Rn,pn),tt.set(pn,j.truncDivision(Me,2)-Rn),tt.set(pn,j.truncDivision(Me,2)+Rn)}let rt=new Z8;return rt.setCompact(I),rt.setSize(Me),rt.setLayers($),rt.setCodeWords(he),rt.setMatrix(tt),rt}static drawBullsEye(m,g,v){for(let k=0;k<v;k+=2)for(let C=g-k;C<=g+k;C++)m.set(C,g-k),m.set(C,g+k),m.set(g-k,C),m.set(g+k,C);m.set(g-v,g-v),m.set(g-v+1,g-v),m.set(g-v,g-v+1),m.set(g+v,g-v),m.set(g+v,g-v+1),m.set(g+v,g+v-1)}static generateModeMessage(m,g,v){let k=new E;return m?(k.appendBits(g-1,2),k.appendBits(v-1,6),k=Kn.generateCheckWords(k,28,4)):(k.appendBits(g-1,5),k.appendBits(v-1,11),k=Kn.generateCheckWords(k,40,4)),k}static drawModeMessage(m,g,v,k){let C=j.truncDivision(v,2);if(g)for(let A=0;A<7;A++){let I=C-3+A;k.get(A)&&m.set(I,C-5),k.get(A+7)&&m.set(C+5,I),k.get(20-A)&&m.set(I,C+5),k.get(27-A)&&m.set(C-5,I)}else for(let A=0;A<10;A++){let I=C-5+A+j.truncDivision(A,5);k.get(A)&&m.set(I,C-7),k.get(A+10)&&m.set(C+7,I),k.get(29-A)&&m.set(I,C+7),k.get(39-A)&&m.set(C-7,I)}}static generateCheckWords(m,g,v){let k=m.getSize()/v,C=new gS(Kn.getGF(v)),A=j.truncDivision(g,v),I=Kn.bitsToWords(m,v,A);C.encode(I,A-k);let $=g%v,V=new E;V.appendBits(0,$);for(const X of Array.from(I))V.appendBits(X,v);return V}static bitsToWords(m,g,v){let k=new Int32Array(v),C,A;for(C=0,A=m.getSize()/g;C<A;C++){let I=0;for(let $=0;$<g;$++)I|=m.get(C*g+$)?1<<g-$-1:0;k[C]=I}return k}static getGF(m){switch(m){case 4:return Te.AZTEC_PARAM;case 6:return Te.AZTEC_DATA_6;case 8:return Te.AZTEC_DATA_8;case 10:return Te.AZTEC_DATA_10;case 12:return Te.AZTEC_DATA_12;default:throw new f("Unsupported word size "+m)}}static stuffBits(m,g){let v=new E,k=m.getSize(),C=(1<<g)-2;for(let A=0;A<k;A+=g){let I=0;for(let $=0;$<g;$++)(A+$>=k||m.get(A+$))&&(I|=1<<g-1-$);(I&C)===C?(v.appendBits(I&C,g),A--):I&C?v.appendBits(I,g):(v.appendBits(I|1,g),A--)}return v}static totalBitsInLayer(m,g){return((g?88:112)+16*m)*m}}Kn.DEFAULT_EC_PERCENT=33,Kn.DEFAULT_AZTEC_LAYERS=0,Kn.MAX_NB_BITS=32,Kn.MAX_NB_BITS_COMPACT=4,Kn.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class Nw{encode(m,g,v,k){return this.encodeWithHints(m,g,v,k,null)}encodeWithHints(m,g,v,k,C){let A=yS.ISO_8859_1,I=Kn.DEFAULT_EC_PERCENT,$=Kn.DEFAULT_AZTEC_LAYERS;return C!=null&&(C.has(xi.CHARACTER_SET)&&(A=J8.forName(C.get(xi.CHARACTER_SET).toString())),C.has(xi.ERROR_CORRECTION)&&(I=j.parseInt(C.get(xi.ERROR_CORRECTION).toString())),C.has(xi.AZTEC_LAYERS)&&($=j.parseInt(C.get(xi.AZTEC_LAYERS).toString()))),Nw.encodeLayers(m,g,v,k,A,I,$)}static encodeLayers(m,g,v,k,C,A,I){if(g!==se.AZTEC)throw new f("Can only encode AZTEC, but got "+g);let $=Kn.encode(M.getBytes(m,C),A,I);return Nw.renderResult($,v,k)}static renderResult(m,g,v){let k=m.getMatrix();if(k==null)throw new Ne;let C=k.getWidth(),A=k.getHeight(),I=Math.max(g,C),$=Math.max(v,A),V=Math.min(I/C,$/A),X=(I-C*V)/2,ne=($-A*V)/2,ie=new U(I,$);for(let he=0,ye=ne;he<A;he++,ye+=V)for(let ve=0,Ce=X;ve<C;ve++,Ce+=V)k.get(ve,he)&&ie.setRegion(Ce,ye,V,V);return ie}}n.AbstractExpandedDecoder=aS,n.ArgumentException=d,n.ArithmeticException=pe,n.AztecCode=Z8,n.AztecCodeReader=nn,n.AztecCodeWriter=Nw,n.AztecDecoder=Qe,n.AztecDetector=yt,n.AztecDetectorResult=Be,n.AztecEncoder=Kn,n.AztecHighLevelEncoder=cy,n.AztecPoint=ct,n.BarcodeFormat=se,n.Binarizer=x,n.BinaryBitmap=h,n.BitArray=E,n.BitMatrix=U,n.BitSource=uS,n.BrowserAztecCodeReader=Vn,n.BrowserBarcodeReader=Ufe,n.BrowserCodeReader=Y,n.BrowserDatamatrixCodeReader=Vfe,n.BrowserMultiFormatReader=the,n.BrowserPDF417Reader=nhe,n.BrowserQRCodeReader=rhe,n.BrowserQRCodeSvgWriter=jh,n.CharacterSetECI=D,n.ChecksumException=p,n.Code128Reader=He,n.Code39Reader=bn,n.DataMatrixDecodedBitStreamParser=Td,n.DataMatrixReader=Pd,n.DecodeHintType=T,n.DecoderResult=fe,n.DefaultGridSampler=Le,n.DetectorResult=ke,n.EAN13Reader=Jt,n.EncodeHintType=xi,n.Exception=u,n.FormatException=P,n.GenericGF=Te,n.GenericGFPoly=_e,n.GlobalHistogramBinarizer=H,n.GridSampler=$e,n.GridSamplerInstance=Ve,n.HTMLCanvasElementLuminanceSource=q,n.HybridBinarizer=z,n.ITFReader=Rt,n.IllegalArgumentException=f,n.IllegalStateException=Ne,n.InvertedLuminanceSource=W,n.LuminanceSource=K,n.MathUtils=ot,n.MultiFormatOneDReader=Sp,n.MultiFormatReader=Q8,n.MultiFormatWriter=ihe,n.NotFoundException=F,n.OneDReader=zt,n.PDF417DecodedBitStreamParser=Re,n.PDF417DecoderErrorCorrection=H8,n.PDF417Reader=Yi,n.PDF417ResultMetadata=G8,n.PerspectiveTransform=ge,n.PlanarYUVLuminanceSource=Ec,n.QRCodeByteMatrix=_w,n.QRCodeDataMask=il,n.QRCodeDecodedBitStreamParser=gs,n.QRCodeDecoderErrorCorrectionLevel=Hr,n.QRCodeDecoderFormatInformation=ha,n.QRCodeEncoder=ts,n.QRCodeEncoderQRCode=_h,n.QRCodeMaskUtil=Ss,n.QRCodeMatrixUtil=Wt,n.QRCodeMode=Ut,n.QRCodeReader=Od,n.QRCodeVersion=Ft,n.QRCodeWriter=Tp,n.RGBLuminanceSource=xS,n.RSS14Reader=Es,n.RSSExpandedReader=Ke,n.ReaderException=ww,n.ReedSolomonDecoder=it,n.ReedSolomonEncoder=gS,n.ReedSolomonException=Ge,n.Result=Z,n.ResultMetadataType=le,n.ResultPoint=me,n.StringUtils=M,n.UnsupportedOperationException=R,n.VideoInputDevice=oe,n.WhiteRectangleDetector=Ae,n.WriterException=Fr,n.ZXingArrays=_,n.ZXingCharset=J8,n.ZXingInteger=j,n.ZXingStandardCharsets=yS,n.ZXingStringBuilder=B,n.ZXingStringEncoding=L,n.ZXingSystem=y,n.createAbstractExpandedDecoder=q8,Object.defineProperty(n,"__esModule",{value:!0})})})(JO,JO.exports);var xs=JO.exports;const Mvt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var sW=function(){function e(t,n,r){if(this.formatMap=new Map([[bt.QR_CODE,xs.BarcodeFormat.QR_CODE],[bt.AZTEC,xs.BarcodeFormat.AZTEC],[bt.CODABAR,xs.BarcodeFormat.CODABAR],[bt.CODE_39,xs.BarcodeFormat.CODE_39],[bt.CODE_93,xs.BarcodeFormat.CODE_93],[bt.CODE_128,xs.BarcodeFormat.CODE_128],[bt.DATA_MATRIX,xs.BarcodeFormat.DATA_MATRIX],[bt.MAXICODE,xs.BarcodeFormat.MAXICODE],[bt.ITF,xs.BarcodeFormat.ITF],[bt.EAN_13,xs.BarcodeFormat.EAN_13],[bt.EAN_8,xs.BarcodeFormat.EAN_8],[bt.PDF_417,xs.BarcodeFormat.PDF_417],[bt.RSS_14,xs.BarcodeFormat.RSS_14],[bt.RSS_EXPANDED,xs.BarcodeFormat.RSS_EXPANDED],[bt.UPC_A,xs.BarcodeFormat.UPC_A],[bt.UPC_E,xs.BarcodeFormat.UPC_E],[bt.UPC_EAN_EXTENSION,xs.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!Mvt)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=n,this.logger=r;var i=this.createZXingFormats(t),a=new Map;a.set(xs.DecodeHintType.POSSIBLE_FORMATS,i),a.set(xs.DecodeHintType.TRY_HARDER,!1),this.hints=a}return e.prototype.decodeAsync=function(t){var n=this;return new Promise(function(r,i){try{r(n.decode(t))}catch(a){i(a)}})},e.prototype.decode=function(t){var n=new xs.MultiFormatReader(this.verbose,this.hints),r=new xs.HTMLCanvasElementLuminanceSource(t),i=new xs.BinaryBitmap(new xs.HybridBinarizer(r)),a=n.decode(i);return{text:a.text,format:jfe.create(this.toHtml5QrcodeSupportedFormats(a.format)),debugData:this.createDebugData()}},e.prototype.createReverseFormatMap=function(){var t=new Map;
2726return this.formatMap.forEach(function(n,r,i){t.set(n,r)}),t},e.prototype.toHtml5QrcodeSupportedFormats=function(t){if(!this.reverseFormatMap.has(t))throw"reverseFormatMap doesn't have ".concat(t);return this.reverseFormatMap.get(t)},e.prototype.createZXingFormats=function(t){for(var n=[],r=0,i=t;r<i.length;r++){var a=i[r];this.formatMap.has(a)?n.push(this.formatMap.get(a)):this.logger.logError("".concat(a," is not supported by")+"ZXingHtml5QrcodeShim")}return n},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e}(),Lvt=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):i(d.value).then(l,c)}u((r=r.apply(e,t||[])).next())})},Fvt=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(u){return function(d){return c([u,d])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){n.label=u[1];break}if(u[0]===6&&n.label<a[1]){n.label=a[1],a=u;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(u);break}a[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(d){u=[6,d],i=0}finally{r=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},iW=function(){function e(t,n,r){if(this.formatMap=new Map([[bt.QR_CODE,"qr_code"],[bt.AZTEC,"aztec"],[bt.CODABAR,"codabar"],[bt.CODE_39,"code_39"],[bt.CODE_93,"code_93"],[bt.CODE_128,"code_128"],[bt.DATA_MATRIX,"data_matrix"],[bt.ITF,"itf"],[bt.EAN_13,"ean_13"],[bt.EAN_8,"ean_8"],[bt.PDF_417,"pdf417"],[bt.UPC_A,"upc_a"],[bt.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!e.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=n,this.logger=r;var i=this.createBarcodeDetectorFormats(t);if(this.detector=new BarcodeDetector(i),!this.detector)throw"BarcodeDetector detector not supported"}return e.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var t=new BarcodeDetector({formats:["qr_code"]});return typeof t<"u"},e.prototype.decodeAsync=function(t){return Lvt(this,void 0,void 0,function(){var n,r;return Fvt(this,function(i){switch(i.label){case 0:return[4,this.detector.detect(t)];case 1:if(n=i.sent(),!n||n.length===0)throw"No barcode or QR code detected.";return r=this.selectLargestBarcode(n),[2,{text:r.rawValue,format:jfe.create(this.toHtml5QrcodeSupportedFormats(r.format)),debugData:this.createDebugData()}]}})})},e.prototype.selectLargestBarcode=function(t){for(var n=null,r=0,i=0,a=t;i<a.length;i++){var o=a[i],l=o.boundingBox.width*o.boundingBox.height;l>r&&(r=l,n=o)}if(!n)throw"No largest barcode found";return n},e.prototype.createBarcodeDetectorFormats=function(t){for(var n=[],r=0,i=t;r<i.length;r++){var a=i[r];this.formatMap.has(a)?n.push(this.formatMap.get(a)):this.logger.warn("".concat(a," is not supported by")+"BarcodeDetectorDelegate")}return{formats:n}},e.prototype.toHtml5QrcodeSupportedFormats=function(t){if(!this.reverseFormatMap.has(t))throw"reverseFormatMap doesn't have ".concat(t);return this.reverseFormatMap.get(t)},e.prototype.createReverseFormatMap=function(){var t=new Map;return this.formatMap.forEach(function(n,r,i){t.set(n,r)}),t},e.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},e}(),aW=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}
2726return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):i(d.value).then(l,c)}u((r=r.apply(e,t||[])).next())})},oW=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(u){return function(d){return c([u,d])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){n.label=u[1];break}if(u[0]===6&&n.label<a[1]){n.label=a[1],a=u;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(u);break}a[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(d){u=[6,d],i=0}finally{r=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},$vt=function(){function e(t,n,r,i){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=r,n&&iW.isSupported()?(this.primaryDecoder=new iW(t,r,i),this.secondaryDecoder=new sW(t,r,i)):this.primaryDecoder=new sW(t,r,i)}return e.prototype.decodeAsync=function(t){return aW(this,void 0,void 0,function(){var n;return oW(this,function(r){switch(r.label){case 0:n=performance.now(),r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(t)];case 2:return[2,r.sent()];case 3:return this.possiblyLogPerformance(n),[7];case 4:return[2]}})})},e.prototype.decodeRobustlyAsync=function(t){return aW(this,void 0,void 0,function(){var n,r;return oW(this,function(i){switch(i.label){case 0:n=performance.now(),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(t)];case 2:return[2,i.sent()];case 3:if(r=i.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(t)];throw r;case 4:return this.possiblyLogPerformance(n),[7];case 5:return[2]}})})},e.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},e.prototype.possiblyLogPerformance=function(t){if(this.verbose){var n=performance.now()-t;this.executionResults.push(n),this.executions++,this.possiblyFlushPerformanceReport()}},e.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var t=0,n=0,r=this.executionResults;n<r.length;n++){var i=r[n];t+=i}var a=t/this.executionResults.length;console.log("".concat(a," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},e}(),B8=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),hk=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):i(d.value).then(l,c)}u((r=r.apply(e,t||[])).next())})},mk=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(u){return function(d){return c([u,d])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){n.label=u[1];break}if(u[0]===6&&n.label<a[1]){n.label=a[1],a=u;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(u);break}a[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(d){u=[6,d],i=0}finally{r=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},kfe=function(){function e(t,n){this.name=t,this.track=n}return e.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},e.prototype.apply=function(t){var n={};n[this.name]=t;var r={advanced:[n]};return this.track.applyConstraints(r)},e.prototype.value=function(){var t=this.track.getSettings();if(this.name in t){var n=t[this.name];return n}return null},e}(),Bvt=function(e){B8(t,e);function t(n,r){return e.call(this,n,r)||this}return t.prototype.min=function(){return this.getCapabilities().min},t.prototype.max=function(){return this.getCapabilities().max},t.prototype.step=function(){return this.getCapabilities().step},t.prototype.apply=function(n){var r={};r[this.name]=n;var i={advanced:[r]};return this.track.applyConstraints(i)},t.prototype.getCapabilities=function(){this.failIfNotSupported();var n=this.track.getCapabilities(),r=n[this.name];return{min:r.min,max:r.max,step:r.step}},t.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},t}(kfe),zvt=function(e){B8(t,e);function t(n){return e.call(this,"zoom",n)||this}return t}(Bvt),Uvt=function(e){B8(t,e);function t(n){return e.call(this,"torch",n)||this}return t}(kfe),qvt=function(){function e(t){this.track=t}return e.prototype.zoomFeature=function(){return new zvt(this.track)},e.prototype.torchFeature=function(){return new Uvt(this.track)},e}(),Vvt=function(){function e(t,n,r){this.isClosed=!1,this.parentElement=t,this.mediaStream=n,this.callbacks=r,this.surface=this.createVideoElement(this.parentElement.clientWidth),t.append(this.surface)}return e.prototype.createVideoElement=function(t){var n=document.createElement("video");return n.style.width="".concat(t,"px"),n.style.display="block",n.muted=!0,n.setAttribute("muted","true"),n.playsInl
2726ine=!0,n},e.prototype.setupSurface=function(){var t=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var n=function(){var r=t.surface.clientWidth,i=t.surface.clientHeight;t.callbacks.onRenderSurfaceReady(r,i),t.surface.removeEventListener("playing",n)};this.surface.addEventListener("playing",n),this.surface.srcObject=this.mediaStream,this.surface.play()},e.create=function(t,n,r,i){return hk(this,void 0,void 0,function(){var a,o;return mk(this,function(l){switch(l.label){case 0:return a=new e(t,n,i),r.aspectRatio?(o={aspectRatio:r.aspectRatio},[4,a.getFirstTrackOrFail().applyConstraints(o)]):[3,2];case 1:l.sent(),l.label=2;case 2:return a.setupSurface(),[2,a]}})})},e.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},e.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},e.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},e.prototype.resume=function(t){this.failIfClosed();var n=this,r=function(){setTimeout(t,200),n.surface.removeEventListener("playing",r)};this.surface.addEventListener("playing",r),this.surface.play()},e.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},e.prototype.getSurface=function(){return this.failIfClosed(),this.surface},e.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},e.prototype.applyVideoConstraints=function(t){return hk(this,void 0,void 0,function(){return mk(this,function(n){if("aspectRatio"in t)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(t)]})})},e.prototype.close=function(){if(this.isClosed)return Promise.resolve();var t=this;return new Promise(function(n,r){var i=t.mediaStream.getVideoTracks(),a=i.length,o=0;t.mediaStream.getVideoTracks().forEach(function(l){t.mediaStream.removeTrack(l),l.stop(),++o,o>=a&&(t.isClosed=!0,t.parentElement.removeChild(t.surface),n())})})},e.prototype.getCapabilities=function(){return new qvt(this.getFirstTrackOrFail())},e}(),Hvt=function(){function e(t){this.mediaStream=t}return e.prototype.render=function(t,n,r){return hk(this,void 0,void 0,function(){return mk(this,function(i){return[2,Vvt.create(t,this.mediaStream,n,r)]})})},e.create=function(t){return hk(this,void 0,void 0,function(){var n,r;return mk(this,function(i){switch(i.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return n={audio:!1,video:t},[4,navigator.mediaDevices.getUserMedia(n)];case 1:return r=i.sent(),[2,new e(r)]}})})},e}(),lW=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):i(d.value).then(l,c)}u((r=r.apply(e,t||[])).next())})},cW=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(u){return function(d){return c([u,d])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){n.label=u[1];break}if(u[0]===6&&n.label<a[1]){n.label=a[1],a=u;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(u);break}a[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(d){u=[6,d],i=0}finally{r=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},Wvt=function(){function e(){}return e.failIfNotSupported=function(){return lW(this,void 0,void 0,function(){return cW(this,function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(t){return lW(this,void 0,void 0,function(){return cW(this,function(n){return[2,Hvt.create(t)]})})},e}(),Gvt=function(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}
2726return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):i(d.value).then(l,c)}u((r=r.apply(e,t||[])).next())})},Kvt=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(u){return function(d){return c([u,d])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){n.label=u[1];break}if(u[0]===6&&n.label<a[1]){n.label=a[1],a=u;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(u);break}a[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(d){u=[6,d],i=0}finally{r=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},Yvt=function(){function e(){}return e.retrieve=function(){if(navigator.mediaDevices)return e.getCamerasFromMediaDevices();var t=MediaStreamTrack;return MediaStreamTrack&&t.getSources?e.getCamerasFromMediaStreamTrack():e.rejectWithError()},e.rejectWithError=function(){var t=Dg.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=Dg.insecureContextCameraQueryError()),Promise.reject(t)},e.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var t=location.host.split(":")[0];return t==="127.0.0.1"||t==="localhost"},e.getCamerasFromMediaDevices=function(){return Gvt(this,void 0,void 0,function(){var t,n,r,i,a,o,l;return Kvt(this,function(c){switch(c.label){case 0:return t=function(u){for(var d=u.getVideoTracks(),f=0,h=d;f<h.length;f++){var p=h[f];p.enabled=!1,p.stop(),u.removeTrack(p)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return n=c.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(r=c.sent(),i=[],a=0,o=r;a<o.length;a++)l=o[a],l.kind==="videoinput"&&i.push({id:l.deviceId,label:l.label});return t(n),[2,i]}})})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(t,n){var r=function(a){for(var o=[],l=0,c=a;l<c.length;l++){var u=c[l];u.kind==="video"&&o.push({id:u.id,label:u.label})}t(o)},i=MediaStreamTrack;i.getSources(r)})},e}(),Ps;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.NOT_STARTED=1]="NOT_STARTED",e[e.SCANNING=2]="SCANNING",e[e.PAUSED=3]="PAUSED"})(Ps||(Ps={}));var Xvt=function(){function e(){this.state=Ps.NOT_STARTED,this.onGoingTransactionNewState=Ps.UNKNOWN}return e.prototype.directTransition=function(t){this.failIfTransitionOngoing(),this.validateTransition(t),this.state=t},e.prototype.startTransition=function(t){return this.failIfTransitionOngoing(),this.validateTransition(t),this.onGoingTransactionNewState=t,this},e.prototype.execute=function(){if(this.onGoingTransactionNewState===Ps.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var t=this.onGoingTransactionNewState;this.onGoingTransactionNewState=Ps.UNKNOWN,this.directTransition(t)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===Ps.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=Ps.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==Ps.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(t){switch(this.state){case Ps.UNKNOWN:throw"Transition from unknown is not allowed";case Ps.NOT_STARTED:this.failIfNewStateIs(t,[Ps.PAUSED]);break;case Ps.SCANNING:break;case Ps.PAUSED:break}},e.prototype.failIfNewStateIs=function(t,n){for(var r=0,i=n;r<i.length;r++){var a=i[r];if(t===a)throw"Cannot transition from ".concat(this.state," to ").concat(t)}},e}(),Qvt=function(){function e(t){this.stateManager=t}return e.prototype.startTransition=function(t){return this.stateManager.startTransition(t)},e.prototype.directTransition=function(t){this.stateManager.directTransition(t)},e.prototype.getState=function(){return this.stateManager.getState()},e.prototype.canScanFile=function(){return this.stateManager.getState()===Ps.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==Ps.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===Ps.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===Ps.PAUSED},e}(),Jvt=function(){function e(){}return e.create=function(){return new Qvt(new Xvt)},e}(),Zvt=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}
2726t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ao=function(e){Zvt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.DEFAULT_WIDTH=300,t.DEFAULT_WIDTH_OFFSET=2,t.FILE_SCAN_MIN_HEIGHT=300,t.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,t.MIN_QR_BOX_SIZE=50,t.SHADED_LEFT=1,t.SHADED_RIGHT=2,t.SHADED_TOP=3,t.SHADED_BOTTOM=4,t.SHADED_REGION_ELEMENT_ID="qr-shaded-region",t.VERBOSE=!1,t.BORDER_SHADER_DEFAULT_COLOR="#ffffff",t.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",t}(Dvt),e1t=function(){function e(t,n){this.logger=n,this.fps=Ao.SCAN_DEFAULT_FPS,t?(t.fps&&(this.fps=t.fps),this.disableFlip=t.disableFlip===!0,this.qrbox=t.qrbox,this.aspectRatio=t.aspectRatio,this.videoConstraints=t.videoConstraints):this.disableFlip=Ao.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?Nfe.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!Nu(this.qrbox)},e.create=function(t,n){return new e(t,n)},e}(),uW=function(){function e(t,n){if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(t))throw"HTML Element with id=".concat(t," not found");this.elementId=t,this.verbose=!1;var r;typeof n=="boolean"?this.verbose=n===!0:n&&(r=n,this.verbose=r.verbose===!0,r.experimentalFeatures),this.logger=new Rvt(this.verbose),this.qrcode=new $vt(this.getSupportedFormats(n),this.getUseBarCodeDetectorIfSupported(r),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=Jvt.create()}return e.prototype.start=function(t,n,r,i){var a=this;if(!t)throw"cameraIdOrConfig is required";if(!r||typeof r!="function")throw"qrCodeSuccessCallback is required and should be a function.";var o;i?o=i:o=this.verbose?this.logger.log:function(){};var l=e1t.create(n,this.logger);this.clearElement();var c=!1;l.videoConstraints&&(l.isMediaStreamConstraintsValid()?c=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var u=c,d=document.getElementById(this.elementId);d.clientWidth?d.clientWidth:Ao.DEFAULT_WIDTH,d.style.position="relative",this.shouldScan=!0,this.element=d;var f=this,h=this.stateManagerProxy.startTransition(Ps.SCANNING);return new Promise(function(p,x){var y=u?l.videoConstraints:f.createVideoConstraints(t);if(!y){h.cancel(),x("videoConstraints should be defined");return}var b={};(!u||l.aspectRatio)&&(b.aspectRatio=l.aspectRatio);var w={onRenderSurfaceReady:function(_,j){f.setupUi(_,j,l),f.isScanning=!0,f.foreverScan(l,r,o)}};Wvt.failIfNotSupported().then(function(_){_.create(y).then(function(j){return j.render(a.element,b,w).then(function(E){f.renderedCamera=E,h.execute(),p(null)}).catch(function(E){h.cancel(),x(E)})}).catch(function(j){h.cancel(),x(Dg.errorGettingUserMedia(j))})}).catch(function(_){h.cancel(),x(Dg.cameraStreamingNotSupported())})})},e.prototype.pause=function(t){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(Ps.PAUSED),this.showPausedState(),(Nu(t)||t!==!0)&&(t=!1),t&&this.renderedCamera&&this.renderedCamera.pause()},e.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var t=this,n=function(){t.stateManagerProxy.directTransition(Ps.SCANNING),t.hidePausedState()};if(!this.renderedCamera.isPaused()){n();return}this.renderedCamera.resume(function(){n()})},e.prototype.getState=function(){return this.stateManagerProxy.getState()},e.prototype.stop=function(){var t=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var n=this.stateManagerProxy.startTransition(Ps.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var r=function(){if(t.element){var a=document.getElementById(Ao.SHADED_REGION_ELEMENT_ID);a&&t.element.removeChild(a)}},i=this;return this.renderedCamera.close().then(function(){return i.renderedCamera=null,i.element&&(i.element.removeChild(i.canvasElement),i.canvasElement=null),r(),i.qrRegion&&(i.qrRegion=null),i.context&&(i.context=null),n.execute(),i.hidePausedState(),i.isScanning=!1,Promise.resolve()})},e.prototype.scanFile=function(t,n){return this.scanFileV2(t,n).then(function(r){return r.decodedText})},e.prototype.scanFileV2=function(t,n){var r=this;if(!t||!(t instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(Nu(n)&&(n=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(i,a){r.possiblyCloseLastScanImageFile(),r.clearElement(),r.lastScanImageFile=URL.createObjectURL(t);var o=new Image;o.onload=function(){var l=o.width,c=o.height,u=document.getElementById(r.elementId),d=u.clientWidth?u.clientWidth:Ao.DEFAULT_WIDTH,f=Math.max(u.clientHeight?u.clientHeight:c,Ao.FILE_SCAN_MIN_HEIGHT),h=r.computeCanvasDrawConfig(l,c,d,f);if(n){var p=r.createCanvasElement(d,f,"qr-canvas-visible");p.style.display="inline-block",u.appendChild(p);var x=p.getContext("2d");if(!x)throw"Unable to get 2d context from canvas";x.canvas.width=d,x.canvas.height=f,x.drawImage(o,0,0,l,c,h.x,h.y,h.width,h.height)}var y=Ao.FILE_SCAN_HIDDEN_CANVAS_PADDING,b=Math.max(o.width,h.width),w=Math.max(o.height,h.height),_=b+2*y,j=w+2*y,E=r.createCanvasElement(_,j);u.appendChild(E);var S=E.getContext("2d");if(!S)throw"Unable to get 2d context from canvas";S.canvas.width=_,S.canvas.height=j,S.drawImage(o,0,0,l,c,y,y,b,w);try{r.qrcode.decodeRobustlyAsync(E).then(function(T){i(rW.createFromQrcodeResult(T))}).catch(a)}catch(T){a("QR code parse error, error = ".concat(T))}},o.onerror=a,o.onabort=a,o.onstalled=a,o.onsuspend=a,o.src=URL.createObjectURL(t)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return Yvt.retrieve()},e.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},e.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},e.prototype.applyVideoConstraints=function(t){if(t){if(!Nfe.isMediaStreamConstraintsValid(t,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(t)},e.prototype.getRenderedCameraOrFail=function(){if(this.renderedCamera==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera}
2726,e.prototype.getSupportedFormats=function(t){var n=[bt.QR_CODE,bt.AZTEC,bt.CODABAR,bt.CODE_39,bt.CODE_93,bt.CODE_128,bt.DATA_MATRIX,bt.MAXICODE,bt.ITF,bt.EAN_13,bt.EAN_8,bt.PDF_417,bt.RSS_14,bt.RSS_EXPANDED,bt.UPC_A,bt.UPC_E,bt.UPC_EAN_EXTENSION];if(!t||typeof t=="boolean"||!t.formatsToSupport)return n;if(!Array.isArray(t.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(t.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var r=[],i=0,a=t.formatsToSupport;i<a.length;i++){var o=a[i];Ovt(o)?r.push(o):this.logger.warn("Invalid format: ".concat(o," passed in config, ignoring."))}if(r.length===0)throw"None of formatsToSupport match supported values.";return r},e.prototype.getUseBarCodeDetectorIfSupported=function(t){if(Nu(t))return!0;if(!Nu(t.useBarCodeDetectorIfSupported))return t.useBarCodeDetectorIfSupported!==!1;if(Nu(t.experimentalFeatures))return!0;var n=t.experimentalFeatures;return Nu(n.useBarCodeDetectorIfSupported)?!0:n.useBarCodeDetectorIfSupported!==!1},e.prototype.validateQrboxSize=function(t,n,r){var i=this,a=r.qrbox;this.validateQrboxConfig(a);var o=this.toQrdimensions(t,n,a),l=function(u){if(u<Ao.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(Ao.MIN_QR_BOX_SIZE,"px.")},c=function(u){return u>t&&(i.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),u=t),u};l(o.width),l(o.height),o.width=c(o.width)},e.prototype.validateQrboxConfig=function(t){if(typeof t!="number"&&typeof t!="function"&&(t.width===void 0||t.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(t,n,r){if(typeof r=="number")return{width:r,height:r};if(typeof r=="function")try{return r(t,n)}catch(i){throw new Error("qrbox config was passed as a function but it failed with unknown error"+i)}return r},e.prototype.setupUi=function(t,n,r){r.isShadedBoxEnabled()&&this.validateQrboxSize(t,n,r);var i=Nu(r.qrbox)?{width:t,height:n}:r.qrbox;this.validateQrboxConfig(i);var a=this.toQrdimensions(t,n,i);a.height>n&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var o=r.isShadedBoxEnabled()&&a.height<=n,l={x:0,y:0,width:t,height:n},c=o?this.getShadedRegionBounds(t,n,a):l,u=this.createCanvasElement(c.width,c.height),d={willReadFrequently:!0},f=u.getContext("2d",d);f.canvas.width=c.width,f.canvas.height=c.height,this.element.append(u),o&&this.possiblyInsertShadingElement(this.element,t,n,a),this.createScannerPausedUiElement(this.element),this.qrRegion=c,this.context=f,this.canvasElement=u},e.prototype.createScannerPausedUiElement=function(t){var n=document.createElement("div");n.innerText=Dg.scannerPaused(),n.style.display="none",n.style.position="absolute",n.style.top="0px",n.style.zIndex="1",n.style.background="rgba(9, 9, 9, 0.46)",n.style.color="#FFECEC",n.style.textAlign="center",n.style.width="100%",t.appendChild(n),this.scannerPausedUiElement=n},e.prototype.scanContext=function(t,n){var r=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(i){return t(i.text,rW.createFromQrcodeResult(i)),r.possiblyUpdateShaders(!0),!0}).catch(function(i){r.possiblyUpdateShaders(!1);var a=Dg.codeParseError(i);return n(a,Ivt.createFrom(a)),!1})},e.prototype.foreverScan=function(t,n,r){var i=this;if(this.shouldScan&&this.renderedCamera){var a=this.renderedCamera.getSurface(),o=a.videoWidth/a.clientWidth,l=a.videoHeight/a.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var c=this.qrRegion.width*o,u=this.qrRegion.height*l,d=this.qrRegion.x*o,f=this.qrRegion.y*l;this.context.drawImage(a,d,f,c,u,0,0,this.qrRegion.width,this.qrRegion.height);var h=function(){i.foreverScanTimeout=setTimeout(function(){i.foreverScan(t,n,r)},i.getTimeoutFps(t.fps))};this.scanContext(n,r).then(function(p){!p&&t.disableFlip!==!0?(i.context.translate(i.context.canvas.width,0),i.context.scale(-1,1),i.scanContext(n,r).finally(function(){h()})):h()}).catch(function(p){i.logger.logError("Error happend while scanning context",p),h()})}},e.prototype.createVideoConstraints=function(t){if(typeof t=="string")return{deviceId:{exact:t}};if(typeof t=="object"){var n="facingMode",r="deviceId",i={user:!0,environment:!0},a="exact",o=function(x){if(x in i)return!0;
2726throw"config has invalid 'facingMode' value = "+"'".concat(x,"'")},l=Object.keys(t);if(l.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(l.length," keys");var c=Object.keys(t)[0];if(c!==n&&c!==r)throw"Only '".concat(n,"' and '").concat(r,"' ")+" are supported for 'cameraIdOrConfig'";if(c===n){var u=t.facingMode;if(typeof u=="string"){if(o(u))return{facingMode:u}}else if(typeof u=="object")if(a in u){if(o(u["".concat(a)]))return{facingMode:{exact:u["".concat(a)]}}}else throw"'facingMode' should be string or object with"+" ".concat(a," as key.");else{var d=typeof u;throw"Invalid type of 'facingMode' = ".concat(d)}}else{var f=t.deviceId;if(typeof f=="string")return{deviceId:f};if(typeof f=="object"){if(a in f)return{deviceId:{exact:f["".concat(a)]}};throw"'deviceId' should be string or object with"+" ".concat(a," as key.")}else{var h=typeof f;throw"Invalid type of 'deviceId' = ".concat(h)}}}var p=typeof t;throw"Invalid type of 'cameraIdOrConfig' = ".concat(p)},e.prototype.computeCanvasDrawConfig=function(t,n,r,i){if(t<=r&&n<=i){var a=(r-t)/2,o=(i-n)/2;return{x:a,y:o,width:t,height:n}}else{var l=t,c=n;return t>r&&(n=r/t*n,t=r),n>i&&(t=i/n*t,n=i),this.logger.log("Image downsampled from "+"".concat(l,"X").concat(c)+" to ".concat(t,"X").concat(n,".")),this.computeCanvasDrawConfig(t,n,r,i)}},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var t=document.getElementById(this.elementId);t&&(t.innerHTML="")},e.prototype.possiblyUpdateShaders=function(t){this.qrMatch!==t&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(n){n.style.backgroundColor=t?Ao.BORDER_SHADER_MATCH_COLOR:Ao.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=t)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(t,n,r){var i=t,a=n,o=document.createElement("canvas");return o.style.width="".concat(i,"px"),o.style.height="".concat(a,"px"),o.style.display="none",o.id=Nu(r)?"qr-canvas":r,o},e.prototype.getShadedRegionBounds=function(t,n,r){if(r.width>t||r.height>n)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(t-r.width)/2,y:(n-r.height)/2,width:r.width,height:r.height}},e.prototype.possiblyInsertShadingElement=function(t,n,r,i){if(!(n-i.width<1||r-i.height<1)){var a=document.createElement("div");a.style.position="absolute";var o=(n-i.width)/2,l=(r-i.height)/2;if(a.style.borderLeft="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),a.style.borderRight="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),a.style.borderTop="".concat(l,"px solid rgba(0, 0, 0, 0.48)"),a.style.borderBottom="".concat(l,"px solid rgba(0, 0, 0, 0.48)"),a.style.boxSizing="border-box",a.style.top="0px",a.style.bottom="0px",a.style.left="0px",a.style.right="0px",a.id="".concat(Ao.SHADED_REGION_ELEMENT_ID),n-i.width<11||r-i.height<11)this.hasBorderShaders=!1;else{var c=5,u=40;this.insertShaderBorders(a,u,c,-c,null,0,!0),this.insertShaderBorders(a,u,c,-c,null,0,!1),this.insertShaderBorders(a,u,c,null,-c,0,!0),this.insertShaderBorders(a,u,c,null,-c,0,!1),this.insertShaderBorders(a,c,u+c,-c,null,-c,!0),this.insertShaderBorders(a,c,u+c,null,-c,-c,!0),this.insertShaderBorders(a,c,u+c,-c,null,-c,!1),this.insertShaderBorders(a,c,u+c,null,-c,-c,!1),this.hasBorderShaders=!0}t.append(a)}},e.prototype.insertShaderBorders=function(t,n,r,i,a,o,l){var c=document.createElement("div");c.style.position="absolute",c.style.backgroundColor=Ao.BORDER_SHADER_DEFAULT_COLOR,c.style.width="".concat(n,"px"),c.style.height="".concat(r,"px"),i!==null&&(c.style.top="".concat(i,"px")),a!==null&&(c.style.bottom="".concat(a,"px")),l?c.style.left="".concat(o,"px"):c.style.right="".concat(o,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(c),t.appendChild(c)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(t){return 1e3/t},e}(),dW;(function(e){e[e.STATUS_DEFAULT=0]="STATUS_DEFAULT",e[e.STATUS_SUCCESS=1]="STATUS_SUCCESS",e[e.STATUS_WARNING=2]="STATUS_WARNING",e[e.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(dW||(dW={}));function fW(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim()}function t1t(e){return(e/100).toFixed(2).replace(/[.,]00$/,"").replace(".",",")}function c3(e){return e.status==="reserved"&&e.is_walk_in===!0&&!$c(e)}function n1t({eventId:e,eventPriceCents:t=0,onSelect:n,autoFocus:r=!0}){var K,W,q,oe,J,Y;const[i,a]=N.useState(""),[o,l]=N.useState(null),[c,u]=N.useState(null),d=kte(),f=ale(),h=wte(),p=SC(),x=Ye(),y=N.useRef(null),{data:b,isLoading:w}
2726=FR(e),_=(K=p.variables)==null?void 0:K.ticketId,{data:j=0}=st({queryKey:["event-rounds-count",e],queryFn:async()=>{const{count:Z,error:G}=await re.from("rounds").select("id",{count:"exact",head:!0}).eq("event_id",e);if(G)throw G;return Z??0},staleTime:15e3}),E=j>0;N.useEffect(()=>{if(r){const Z=setTimeout(()=>{var G;(G=y.current)==null||G.focus()},100);return()=>clearTimeout(Z)}},[r]);const S=b??[],T=fW(i),P=T.length>0,O=Z=>{var ce,le,fe;if(!P||[Z.reservation_code,Z.guest_first_name,Z.guest_last_name,(ce=Z.profile)==null?void 0:ce.first_name,(le=Z.profile)==null?void 0:le.last_name,(fe=Z.profile)==null?void 0:fe.display_name].filter(Boolean).some(be=>fW(be).includes(T)))return!0;const se=NT(i);return!!(se&&Z.reservation_code&&NT(Z.reservation_code).includes(se))},{todo:D,done:R}=N.useMemo(()=>{const Z=S.filter(O),G=Z.filter(ce=>!$c(ce)).sort((ce,le)=>{const fe=c3(ce)?0:1,be=c3(le)?0:1;return fe!==be?fe-be:ii(ce,{showFullName:!0}).localeCompare(ii(le,{showFullName:!0}),"fr")}),se=Z.filter(ce=>$c(ce)).sort((ce,le)=>ii(ce,{showFullName:!0}).localeCompare(ii(le,{showFullName:!0}),"fr"));return{todo:G,done:se}},[b,i]),L=S.filter(Z=>$c(Z)).length,M=S.length-L,[B,U]=N.useState(!0);N.useEffect(()=>{L<=5&&U(!1)},[L]);const F=()=>{var Z;a(""),(Z=y.current)==null||Z.focus()},H=Z=>{var be;const G=$c(Z),se=c3(Z),ce=se?_te(Z.guest_notes,t):0,le=p.isPending&&_===Z.id,fe=()=>{G||p.isPending||p.mutate({ticketId:Z.id,method:"name_search",identityVerified:!0})};return s.jsxs("div",{className:ae("group w-full flex items-center gap-1 sm:gap-2 rounded-xl min-w-0 p-2 sm:p-3","bg-card/50","border border-transparent","transition-all duration-150",se&&"border-amber-300/60 bg-amber-50/40 dark:bg-amber-950/10"),children:[s.jsx("div",{className:"flex-shrink-0 h-9 w-9 sm:h-10 sm:w-10 rounded-full bg-primary/10 flex items-center justify-center overflow-hidden",children:(be=Z.profile)!=null&&be.avatar_url?s.jsx("img",{src:Z.profile.avatar_url,alt:"",className:"h-full w-full rounded-full object-cover"}):s.jsx("span",{className:"text-xs sm:text-sm font-medium text-primary",children:T6(Z)})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-medium truncate text-sm",children:ii(Z,{showFullName:!0})}),s.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[Z.reservation_code," • ",(()=>{var pe;const _e=Z.elo_rating??((pe=Z.profile)==null?void 0:pe.elo_rating)??null;return _e!=null?s.jsx("span",{className:"text-foreground/80 font-medium tabular-nums",children:Xm(_e)}):s.jsx("span",{className:"italic",children:"Elo —"})})()," • ",Ze(new Date(Z.created_at),"d MMM",{locale:pt})]})]}),G?s.jsxs(we,{className:"bg-emerald-500/15 text-emerald-700 dark:text-emerald-400 border-0 flex-shrink-0 text-xs px-2 font-medium",children:[s.jsx(is,{className:"h-3 w-3 mr-1",strokeWidth:3}),"Présent"]}):se?s.jsxs(Q,{size:"sm",onClick:()=>n(Z),className:"h-9 sm:h-10 px-3 flex-shrink-0 bg-amber-500 hover:bg-amber-600 text-white",children:[s.jsx(El,{className:"h-4 w-4 mr-1.5"}),s.jsxs("span",{className:"text-xs font-semibold",children:["Encaisser",ce>0?` ${t1t(ce)}€`:""]})]}):s.jsx(Q,{size:"sm",onClick:fe,disabled:le||p.isPending,className:"h-9 sm:h-10 px-3 flex-shrink-0 bg-emerald-600 hover:bg-emerald-700 text-white","aria-label":`Pointer ${ii(Z,{showFullName:!0})}`,children:le?s.jsx(We,{className:"h-4 w-4 animate-spin"}):s.jsxs(s.Fragment,{children:[s.jsx(Sb,{className:"h-4 w-4 mr-1.5"}),s.jsx("span",{className:"text-xs font-semibold",children:"Pointer"})]})}),s.jsxs(eh,{children:[s.jsx(th,{asChild:!0,children:s.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 flex-shrink-0 text-muted-foreground hover:text-foreground",onClick:_e=>_e.stopPropagation(),"aria-label":"Actions participant",children:s.jsx(Qge,{className:"h-4 w-4"})})}),s.jsxs(yd,{align:"end",onClick:_e=>_e.stopPropagation(),children:[s.jsxs(Dr,{onSelect:()=>l(Z),children:[s.jsx(o1,{className:"h-4 w-4 mr-2"}),"Modifier les infos"]}),G&&!E&&s.jsxs(Dr,{onSelect:()=>{window.confirm(`Annuler le check-in de ${ii(Z,{showFullName:!0})} ?`)&&h.mutate({ticketId:Z.id,eventId:e})},disabled:h.isPending,children:[s.jsx(Il,{className:"h-4 w-4 mr-2"}),"Annuler le check-in"]}),s.jsxs(Dr,{onSelect:()=>u(Z),className:"text-destructive focus:text-destructive",children:[s.jsx(ua,{className:"h-4 w-4 mr-2"}),E?"Retirer du tournoi (forfait)":"Supprimer le participant"]})]})]})]}
2726,Z.id)},z=({label:Z,count:G,collapsible:se,collapsed:ce,onToggle:le})=>{const fe=s.jsxs("div",{className:"flex items-center justify-between w-full px-2 py-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[11px] uppercase tracking-wider font-semibold text-muted-foreground",children:Z}),s.jsxs("span",{className:"text-xs font-semibold text-foreground tabular-nums",children:["· ",G]})]}),se&&s.jsx(Wa,{className:ae("h-4 w-4 text-muted-foreground transition-transform",!ce&&"rotate-180")})]});return s.jsx("div",{className:"sticky top-0 z-10 bg-background/95 backdrop-blur-md border-b border-border/40",children:se?s.jsx("button",{onClick:le,className:"w-full text-left",children:fe}):fe})};return s.jsxs("div",{className:"space-y-3 min-w-0 w-full",children:[s.jsxs("div",{className:"relative",children:[s.jsx(_o,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),s.jsx(Ue,{ref:y,placeholder:"Rechercher un participant...",value:i,onChange:Z=>a(Z.target.value),className:ae("pl-10 pr-10 h-12 text-base","bg-background/80 backdrop-blur-sm","border-border/50 focus:border-primary/50","transition-all duration-200")}),i&&s.jsx(Q,{variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 rounded-full",onClick:F,children:s.jsx(Er,{className:"h-4 w-4"})})]}),s.jsx("div",{className:"rounded-xl border border-border/50 bg-background/50 backdrop-blur-xl overflow-y-auto overscroll-contain",style:{maxHeight:"min(60vh, 480px)",WebkitOverflowScrolling:"touch"},children:w?s.jsx("div",{className:"p-2 space-y-1.5",children:Array.from({length:4}).map((Z,G)=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg",children:[s.jsx(Ie,{className:"h-10 w-10 rounded-full"}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx(Ie,{className:"h-4 w-32"}),s.jsx(Ie,{className:"h-3 w-24"})]}),s.jsx(Ie,{className:"h-5 w-16 rounded-full"})]},G))}):S.length===0?s.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Aucun participant inscrit"}):P?s.jsx("div",{className:"p-1.5 sm:p-2 space-y-1 sm:space-y-1.5",children:D.length+R.length===0?s.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Aucun participant trouvé"}):[...D,...R].map(H)}):s.jsxs(s.Fragment,{children:[s.jsxs("section",{children:[s.jsx(z,{label:"À pointer",count:M}),D.length===0?s.jsx("div",{className:"text-center py-6 text-sm text-muted-foreground",children:"Tout le monde est pointé 🎉"}):s.jsxs("div",{className:"p-1.5 sm:p-2 space-y-1 sm:space-y-1.5",children:[M>0&&s.jsx("p",{className:"px-2 pb-1 text-[11px] text-muted-foreground",children:"Seuls les pointés seront appariés à la ronde 1."}),D.map(H)]})]}),L>0&&s.jsxs("section",{children:[s.jsx(z,{label:"Pointés",count:L,collapsible:!0,collapsed:B,onToggle:()=>U(Z=>!Z)}),!B&&s.jsx("div",{className:"p-1.5 sm:p-2 space-y-1 sm:space-y-1.5",children:R.map(H)})]})]})}),o&&s.jsx(O6,{open:!!o,onOpenChange:Z=>!Z&&l(null),player:{id:o.user_id||o.id,display_name:((W=o.profile)==null?void 0:W.display_name)??null,first_name:((q=o.profile)==null?void 0:q.first_name)??o.guest_first_name??null,last_name:((oe=o.profile)==null?void 0:oe.last_name)??o.guest_last_name??null,elo_rating:((J=o.profile)==null?void 0:J.elo_rating)??o.elo_rating??null,avatar_url:((Y=o.profile)==null?void 0:Y.avatar_url)??null,guest_email:o.guest_email??null},isGuest:!o.user_id,ticketId:o.id,eventId:e,canWithdraw:!1,canReinstate:!1}),s.jsx(yr,{open:!!c,onOpenChange:Z=>!Z&&u(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:E?"Retirer ce joueur du tournoi ?":"Supprimer ce participant ?"}),s.jsx(lr,{children:c&&(E?s.jsxs(s.Fragment,{children:[ii(c,{showFullName:!0})," sera marqué en forfait général. Ses résultats et appariements passés restent intacts, il sera exclu des prochains rounds."]}):s.jsxs(s.Fragment,{children:[ii(c,{showFullName:!0})," sera retiré de l'événement.",$c(c)&&" Son pointage sera également supprimé.",(c.price_paid_cents??0)>0&&" Un remboursement sera traité selon la politique en vigueur."]}))})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsx(vr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:d.isPending||f.isPending,onClick:async Z=>{if(Z.preventDefault(),!!c)try{if(E)await f.mutateAsync({eventId:e,ticketId:c.id});else{if($c(c)){const{error:G}=await re.from("checkins").delete().eq("ticket_id",c.id);if(G){je.error("Impossible de retirer le pointage");return}await re.from("tickets").update({status:"paid"}).eq("id",c.id),x.invalidateQueries({queryKey:["event-tickets",e]})}await d.mutateAsync({ticketId:c.id})}u(null)}catch{}},children:d.isPending||f.isPending?E?"Retrait…":"Suppression…":E?"Retirer":"Supprimer"})]})]})})]})}function Cfe({onScan:e,onSearchClick:t,isSearching:n,showSearchMode:r=!0,eventId:i,eventPriceCents:a,onParticipantSelect:o}){const[l,c]=N.useState("camera"),[u,d]=N.useState("idle"),[f,h]=N.useState(""),[p,x]=N.useState(null),y=N.useRef(null),b=N.useMemo(()=>`qr-reader-${Date.now()}`,[]),w=N.useRef(e);N.useEffect(()=>{w.current=e},[e]),N.useEffect(()=>{var R;if(l!=="camera"){(R=y.current)!=null&&R.isScanning&&y.current.stop().catch(console.error),d("idle");return}let O=!1;return(async()=>{var L,M,B;try{d("checking"),x(null);const U=await uW.getCameras();if(O)return;if(U.length===0){d("unavailable");return}if(await new Promise(W=>setTimeout(W,300)),O)return;const F=document.getElementById(b);if(!F||F.offsetHeight===0){console.error("Scanner container not visible or not measurable"),d("error"),x("Erreur d'initialisation. Rechargez la page.");return}const H=U.find(W=>{const q=W.label.toLowerCase();return q.includes("back")||q.includes("rear")||q.includes("environment")||q.includes("arrière")})||U[U.length-1];d("starting");
2726const z=new uW(b,{verbose:!1,formatsToSupport:[bt.QR_CODE],experimentalFeatures:{useBarCodeDetectorIfSupported:!0}}),K={fps:20,qrbox:(W,q)=>{const oe=Math.min(W,q),J=Math.floor(oe*.75);return{width:J,height:J}},aspectRatio:1,disableFlip:!0,videoConstraints:{facingMode:{ideal:"environment"},width:{ideal:720,max:1080},height:{ideal:720,max:1080}}};await z.start(H.id,K,W=>{navigator.vibrate&&navigator.vibrate(100),z.stop().catch(console.error),d("idle");let q=W;if(/^https?:\/\//i.test(q))try{const oe=new URL(q),J=oe.searchParams.get("code")||oe.searchParams.get("access_token");J&&J.trim().length>0&&(q=J.trim())}catch{}w.current(q)},()=>{}),O?z.stop().catch(console.error):(y.current=z,d("active"),setTimeout(async()=>{if(y.current)try{const oe=y.current.getRunningTrackCapabilities().focusMode;oe!=null&&oe.includes("continuous")&&(await y.current.applyVideoConstraints({focusMode:"continuous"}),console.log("Continuous focus enabled"))}catch(q){console.warn("Could not apply continuous focus:",q)}const W=document.querySelector(`#${b} video`);W&&(W.style.objectFit="cover",W.style.width="100%",W.style.height="100%",W.setAttribute("playsinline","true"))},100))}catch(U){if(O)return;console.error("Scanner init error:",U);const F=U;F.name==="NotAllowedError"||(L=F.message)!=null&&L.includes("permission")?(d("denied"),x("Accès caméra refusé. Autorisez l'accès dans les paramètres du navigateur.")):F.name==="NotFoundError"||(M=F.message)!=null&&M.includes("Requested device not found")?(d("unavailable"),x("Aucune caméra détectée.")):(B=F.message)!=null&&B.includes("already in use")?(d("error"),x("La caméra est utilisée par une autre application.")):(d("error"),x("Erreur technique. Utilisez le mode manuel."))}})(),()=>{O=!0,y.current&&(y.current.isScanning&&y.current.stop().catch(console.error),y.current=null)}},[l,b]);const _=N.useCallback(O=>{O.preventDefault(),f.trim().length>=4&&(e(f.trim().toUpperCase()),h(""))},[f,e]),j=N.useCallback(()=>{c("search"),(!i||!o)&&(t==null||t())},[t,i,o]),E=N.useCallback(()=>{c("manual")},[]),S=N.useCallback(O=>{o==null||o(O)},[o]),T=N.useCallback(async()=>{if(!(!y.current||u!=="active"))try{const D=y.current.getRunningTrackCapabilities().focusMode;D!=null&&D.includes("single-shot")?(await y.current.applyVideoConstraints({focusMode:"single-shot"}),navigator.vibrate&&navigator.vibrate(50),setTimeout(async()=>{if(y.current&&(D!=null&&D.includes("continuous")))try{await y.current.applyVideoConstraints({focusMode:"continuous"})}catch{}},500)):navigator.vibrate&&navigator.vibrate(25)}catch(O){console.warn("Tap to focus failed:",O)}},[u]),P=l==="camera"&&(u==="idle"||u==="checking"||u==="starting"||u==="active");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-1 xs:gap-1.5 sm:gap-2",children:[s.jsxs(Q,{variant:l==="camera"?"default":"outline",size:"sm",onClick:()=>c("camera"),className:"flex-1 h-10 px-2 xs:px-3 sm:px-4 text-xs sm:text-sm min-w-0",children:[s.jsx(kf,{className:"w-4 h-4 shrink-0"}),s.jsx("span",{className:"hidden xs:inline ml-1 sm:ml-2 truncate",children:"Caméra"})]}),s.jsxs(Q,{variant:l==="manual"?"default":"outline",size:"sm",onClick:()=>c("manual"),className:"flex-1 h-10 px-2 xs:px-3 sm:px-4 text-xs sm:text-sm min-w-0",children:[s.jsx(Hw,{className:"w-4 h-4 shrink-0"}),s.jsx("span",{className:"hidden xs:inline ml-1 sm:ml-2 truncate",children:"Code"})]}),r&&s.jsxs(Q,{variant:l==="search"?"default":"outline",size:"sm",onClick:j,className:"flex-1 h-10 px-2 xs:px-3 sm:px-4 text-xs sm:text-sm min-w-0",children:[s.jsx(sn,{className:"w-4 h-4 shrink-0"}),s.jsx("span",{className:"hidden xs:inline ml-1 sm:ml-2 truncate",children:"Nom"})]})]}),l==="camera"&&s.jsxs("div",{className:"space-y-4",children:[P&&s.jsxs("div",{className:`relative aspect-square max-w-sm mx-auto rounded-xl overflow-hidden 
2727                        border-2 border-primary/30 shadow-2xl bg-black`,onClick:u==="active"?T:void 0,style:{cursor:u==="active"?"pointer":"default"},children:[s.jsx("div",{id:b,className:"absolute inset-0",style:{minHeight:"300px"}}),(u==="checking"||u==="starting"||u==="idle")&&s.jsxs("div",{className:`absolute inset-0 z-10 bg-gradient-to-br from-primary/10 via-background to-primary/5
2728                              backdrop-blur-sm flex flex-col items-center justify-center gap-3`,children:[u==="checking"&&s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-12 h-12 text-primary/60 animate-spin"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Vérification de la caméra..."})]}),u==="starting"&&s.jsxs(s.Fragment,{children:[s.jsx(kf,{className:"w-12 h-12 text-primary/60 animate-pulse"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Démarrage de la caméra..."})]}),u==="idle"&&s.jsxs(s.Fragment,{children:[s.jsx(kf,{className:"w-12 h-12 text-primary/40"}),s.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"Caméra prête"})]})]}),u==="active"&&s.jsx("div",{className:"absolute inset-0 pointer-events-none z-20 flex items-center justify-center",children:s.jsx("div",{className:`absolute left-[20%] right-[20%] h-0.5 
2729                              bg-gradient-to-r from-transparent via-primary to-transparent 
2730                              animate-qr-scan rounded-full opacity-80`,style:{to
2730p:"50%"}})}),u==="active"&&s.jsx("div",{className:`absolute bottom-4 left-1/2 -translate-x-1/2 z-30
2731                              px-4 py-2 rounded-full bg-black/60 backdrop-blur-md
2732                              text-white text-xs font-medium whitespace-nowrap
2733                              border border-white/10`,children:"Touchez l'écran pour faire le focus"})]}),u==="denied"&&s.jsxs(jl,{variant:"destructive",className:"animate-in fade-in-50",children:[s.jsx(El,{className:"h-4 w-4"}),s.jsx(xP,{children:"Accès caméra refusé"}),s.jsxs(Nl,{className:"space-y-3",children:[s.jsx("p",{children:"Pour scanner un QR code, autorisez l'accès à la caméra :"}),s.jsxs("ol",{className:"list-decimal list-inside text-sm space-y-1 pl-2",children:[s.jsx("li",{children:"Ouvrez les paramètres du navigateur"}),s.jsx("li",{children:'Cherchez "Paramètres du site"'}),s.jsx("li",{children:"Activez l'accès à la caméra"}),s.jsx("li",{children:"Rechargez la page"})]}),s.jsxs(Q,{variant:"outline",size:"sm",onClick:E,className:"w-full mt-2",children:[s.jsx(Hw,{className:"w-4 h-4 mr-2"}),"Saisir le code manuellement"]})]})]}),u==="unavailable"&&s.jsxs(jl,{className:"animate-in fade-in-50",children:[s.jsx(El,{className:"h-4 w-4"}),s.jsx(xP,{children:"Aucune caméra détectée"}),s.jsxs(Nl,{className:"space-y-3",children:[s.jsx("p",{children:"Cet appareil ne semble pas avoir de caméra disponible."}),s.jsxs(Q,{variant:"default",size:"sm",onClick:E,className:"w-full",children:[s.jsx(Hw,{className:"w-4 h-4 mr-2"}),"Saisir le code manuellement"]})]})]}),u==="error"&&p&&s.jsxs(jl,{variant:"destructive",className:"animate-in fade-in-50",children:[s.jsx(El,{className:"h-4 w-4"}),s.jsxs(Nl,{className:"space-y-3",children:[s.jsx("p",{children:p}),s.jsxs(Q,{variant:"outline",size:"sm",onClick:E,className:"w-full",children:[s.jsx(Hw,{className:"w-4 h-4 mr-2"}),"Utiliser le code manuel"]})]})]})]}),l==="manual"&&s.jsxs("form",{onSubmit:_,className:"space-y-3",children:[s.jsx(Ue,{placeholder:"Code de réservation (ex: ABC123)",value:f,onChange:O=>h(O.target.value.toUpperCase()),className:"text-center text-base sm:text-lg font-mono tracking-wider h-11 sm:h-12",autoFocus:!0}),s.jsx(Q,{type:"submit",className:"w-full h-11 sm:h-12",disabled:f.trim().length<4||n,children:n?"Recherche...":"Rechercher le ticket"})]}),l==="search"&&(i&&o?s.jsx(n1t,{eventId:i,eventPriceCents:a,onSelect:S,autoFocus:!0}):s.jsxs("div",{className:"text-center py-6 sm:py-8 text-muted-foreground",children:[s.jsx(sn,{className:"h-10 w-10 sm:h-12 sm:w-12 mx-auto mb-2 sm:mb-3 opacity-50"}),s.jsx("p",{className:"text-sm sm:text-base",children:"Mode recherche par nom activé"}),s.jsx("p",{className:"text-xs sm:text-sm",children:"Utilisez la liste des participants"})]}))]})}const hW={reserved:{label:"Réservé",icon:s.jsx(Vt,{className:"w-4 h-4"}),className:"text-muted-foreground"},paid:{label:"Payé",icon:s.jsx(vo,{className:"w-4 h-4"}),className:"text-primary"},checked_in:{label:"Présent",icon:s.jsx(Cn,{className:"w-4 h-4"}),className:"text-green-600"},cancelled:{label:"Annulé",icon:s.jsx(hi,{className:"w-4 h-4"}),className:"text-destructive"},refunded:{label:"Remboursé",icon:s.jsx(el,{className:"w-4 h-4"}),className:"text-muted-foreground"}};function Efe({ticket:e,compact:t=!1,couponMode:n="digital",paperCoupon:r=null}){var w,_;const i=n==="paper",a=e.profile,o=e.checkin,l=Array.isArray(o)?o.length>0:!!o,c=Array.isArray(o)?o[0]:o,u=l?"checked_in":e.status,d=hW[u]||hW.reserved,f=e.is_for_self===!1,h=f&&e.guest_first_name?`${e.guest_first_name}${e.guest_last_name?` ${e.guest_last_name}`:""}`:null,p=f&&h?h:(a==null?void 0:a.display_name)||[a==null?void 0:a.first_name,a==null?void 0:a.last_name].filter(Boolean).join(" ")||((w=a==null?void 0:a.email)==null?void 0:w.split("@")[0])||"Joueur",x=f?(a==null?void 0:a.display_name)||[a==null?void 0:a.first_name,a==null?void 0:a.last_name].filter(Boolean).join(" ")||((_=a==null?void 0:a.email)==null?void 0:_.split("@")[0])||"Acheteur":null,y=p.split(" ").map(j=>j[0]).join("").toUpperCase().slice(0,2),b=e.credit_total_cents>0?e.credit_remaining_cents/e.credit_total_cents*100:0;return t?s.jsxs("div",{className:"flex items-center justify-between gap-2 p-3 rounded-lg border bg-card",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[s.jsxs(Bi,{className:"w-8 h-8 shrink-0",children:[!f&&s.jsx(Ra,{src:(a==null?void 0:a.avatar_url)||void 0}),s.jsx(zi,{className:"text-xs",children:f?s.jsx(sn,{className:"w-4 h-4"}):y})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("p",{className:"font-medium text-sm truncate",children:p}),f&&s.jsx(we,{variant:"outline",className:"text-xs px-1.5 py-0 shrink-0",children:"Invité"})]}),s.jsx("p",{className:"text-xs text-muted-foreground font-mono truncate",children:e.reservation_code})]})]}),s.jsxs(we,{variant:l?"default":"secondary",className:ae("text-xs shrink-0",d.className),children:[d.icon,s.jsx("span",{className:"ml-1",children:d.label})]})]}):s.jsx(Se,{className:ae("transition-all",l&&"border-green-500/50 bg-green-500/5"),children:s.jsxs(De,{className:"p-4 space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap sm:flex-nowrap items-start gap-3",children:[s.jsxs(Bi,{className:"w-12 h-12 shrink-0",children:[!f&&s.jsx(Ra,{src:(a==null?void 0:a.avatar_url)||void 0}),s.jsx(zi,{children:f?s.jsx(sn,{className:"w-5 h-5"}):y})]}),s.jsxs("div",{className:"flex-1 min-w-0 order-3 sm:order-none basis-full sm:basis-auto",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-wrap",children:[s.jsx("p",{className:"font-semibold truncate",children:p}),f&&s.jsx(we,{variant:"outline",className:"text-xs shrink-0",children:"Invité"})]}),f&&x?s.jsxs("p",{className:"text-sm text-muted-foreground truncate",children:["Inscrit par ",x]}):s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:a==null?void 0:a.email}),e.guest_notes&&s.jsx("p",{className:"text-xs text-muted-foreground mt-1 italic break-words",children:e.guest_notes})]}),s.jsxs(we,{variant:l?"default":"secondary",className:ae("shrink-0 self-start ml-auto sm:ml-0",d.className),children:[d.icon,s.jsx("span",{className:"ml-1",children:d.label})]})]}),s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Code"}),s.jsx("span",{className:"font-mono font-medium",children:e.reservation_code})]}),i?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm flex items-center gap-2",children:[s.jsx("span",{children:"🎟️"}),s.jsx("span",{className:"font-medium text-foreground truncate",children:(r==null?void 0:r.label)||`Coupon papier ${(e.credit_total_cents/100).toFixed(0)}€`}),s.jsx("span",{className:"text-xs text-muted-foreground ml-auto shrink-0",children:"à remettre sur place"})]}),(r==null?void 0:r.description)&&s.jsx("p",{className:"text-xs text-muted-foreground px-1 whitespace-pre-line",children:r.description}),(r==null?void 0:r.formulas)&&r.formulas.length>0&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground px-1",children:r.formulas.length>1?"Au choix sur place :":"Inclus :"}),s.jsx("div",{className:"space-y-1",children:r.formulas.map((j,E)=>s.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2 text-sm",children:[s.jsx("p",{className:"font-medium",children:j.name}),j.description&&s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:j.description})]},E))})]})]}):s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Crédit restant"}),s.jsxs("span",{className:"font-semibold",children:[(e.credit_remaining_cents/100).toFixed(2),"€",s.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","/ ",(e.credit_total_cents/100).toFixed(2),"€"]})]})]}),s.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:s.jsx("div",{className:ae("h-full rounded-full transition-all",b>50?"bg-primary":b>20?"bg-yellow-500":"bg-destructive"),style:{width:`${b}%`}})})]}),l&&c&&s.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:["Check-in à ",Ze(new Date(c.checked_at),"HH'h'mm",{locale:pt})]})]})})}function mW(e){return(e/100).toFixed(2).replace(/[.,]00$/,"").replace(".",",")}function Sfe({open:e,onOpenChange:t,ticket:n,participantName:r,reservationCode:i,requiresPayment:a=!1,amountDueCents:o=0,standardPriceCents:l,onConfirm:c,isLoading:u=!1}){const d=r||ii(n,{showFullName:!0}),f=i||(n==null?void 0:n.reservation_code)||"—",[h,p]=N.useState(!1),[x,y]=N.useState(""),b=()=>{p(!1),y(""),t(!1)},w=()=>{c(x),b()},_=`${mW(o)} €`,j=a&&typeof l=="number"&&l>0&&o!==l;return s.jsx(bd,{open:e,onOpenChange:b,children:s.jsxs(wd,{className:"max-h-[90vh]",children:[s.jsxs(sh,{className:"text-left",children:[s.jsx(_d,{className:"flex items-center gap-2",children:a?s.jsxs(s.Fragment,{children:[s.jsx(l1,{className:"h-5 w-5 text-amber-600"}),"Encaisser et valider la présence"]}):s.jsxs(s.Fragment,{children:[s.jsx(ur,{className:"h-5 w-5 text-amber-500"}),"Vérification d'identité"]})}),s.jsx(Yb,{children:a?"Pré-inscription à régler sur place":"Check-in manuel sans QR code"})]}),s.jsxs("div",{className:"px-4 space-y-5",children:[s.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-xl bg-muted/50 border",children:[s.jsx("div",{className:"flex-shrink-0 h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:s.jsx(Cs,{className:"h-6 w-6 text-primary"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-semibold text-lg truncate",children:d}),s.jsxs("p",{className:"text-sm text-muted-foreground font-mono",children:["Code : ",f]})]})]}),a&&s.jsxs("div",{className:"p-4 rounded-xl border-2 border-amber-300 bg-amber-50/60 dark:bg-amber-950/20",children:[s.jsx("p",{className:"text-xs uppercase tracking-wide text-amber-700 dark:text-amber-400 font-medium",children:"À encaisser sur place"}),s.jsx("p",{className:"mt-1 text-4xl font-black text-foreground",style:{fontFamily:"'Bricolage Grotesque', system-ui, sans-serif"},children:_}),j&&s.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Tarif ajusté par l'organisateur (standard : ",mW(l)," €)"]})]}),s.jsxs("div",{className:ae("flex items-start gap-3 p-4 rounded-xl border-2 border-dashed","border-amber-300 bg-amber-50/50 dark:bg-amber-950/20"),children:[s.jsx(ya,{id:"identity-verified",checked:h,onCheckedChange:E=>p(E===!0),className:"mt-0.5 h-5 w-5"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(Fe,{htmlFor:"identity-verified",className:"text-base font-medium cursor-pointer",children:a?`J'ai vérifié l'identité et encaissé ${_}`:"J'ai vérifié la pièce d'identité du participant"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:a?"Espèces, CB ou tout moyen accepté par le lieu":"Carte d'identité, passeport ou permis de conduire"})]}),s.jsx(nd,{className:"h-5 w-5 text-amber-600 flex-shrink-0"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"checkin-notes",className:"text-sm text-muted-foreground",children:"Notes (optionnel)"}),s.jsx($s,{id:"checkin-notes",placeholder:"Ex: CNI vérifiée, paiement CB",value:x,onChange:E=>y(E.target.value),className:"resize-none",rows:2})]})]}),s.jsxs(DR,{className:"pt-4",children:[s.jsx(Q,{onClick:w,disabled:!h||u,className:ae("w-full h-12 text-base font-semibold",a&&"bg-foreground text-background hover:bg-foreground
2733/90"),children:u?"Validation...":a?`Encaisser ${_} et valider`:"✓ Valider la présence"}),s.jsx(Q,{variant:"outline",onClick:b,disabled:u,className:"w-full",children:"Annuler"})]})]})})}const ba=e=>(e/100).toLocaleString("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2})+" €",r1t=[250,490,700,1e3],s1t={drink:"Boissons",food:"Nourriture",snack:"Snacks",coffee:"Café",other:"Autres"},pW={drink:"🍺",food:"🍔",snack:"🥨",coffee:"☕",other:"🎁"},gW=e=>s1t[e]??e;function Afe({ticket:e,products:t,isSubmitting:n,onSubmit:r,onScanNext:i}){return e.creditRemaining===0?s.jsx(d1t,{ticket:e,onScanNext:i}):s.jsx(i1t,{ticket:e,products:t,isSubmitting:n,onSubmit:r,onScanNext:i})}function i1t({ticket:e,products:t,isSubmitting:n,onSubmit:r,onScanNext:i}){const[a,o]=N.useState("input"),[l,c]=N.useState("amount"),[u,d]=N.useState(0),[f,h]=N.useState([]),[p,x]=N.useState(0),[y,b]=N.useState(0),w=N.useMemo(()=>f.reduce((P,O)=>P+O.priceCents*O.quantity,0),[f]),_=l==="amount"?u:w,j=Math.min(_,e.creditRemaining),E=Math.max(0,_-e.creditRemaining),S=async()=>{if(_===0)return;let P;if(l==="amount")P=[{productId:`custom-${Date.now()}`,productName:"Conso (montant libre)",priceCents:j,quantity:1,vatRate:.1}];else if(E===0)P=f;else{const O=new Map;for(const L of f){const M=L.vatRate??.2;O.set(M,(O.get(M)??0)+L.priceCents*L.quantity)}let D=.1,R=-1;for(const[L,M]of O)M>R&&(R=M,D=L);P=[{productId:`custom-${Date.now()}`,productName:`Conso (panier ${ba(_)}, débit crédit)`,priceCents:j,quantity:1,vatRate:D}]}try{await r({items:P,debited:j,toCollect:E}),x(j),b(E),o("success")}catch{}},T=()=>{d(0),h([]),c("amount"),o("input"),i()};return a==="success"?s.jsx(u1t,{ticket:e,debited:p,toCollect:y,onScanNext:T}):a==="review"?s.jsx(c1t,{ticket:e,mode:l,cart:f,products:t,total:_,debited:j,toCollect:E,isSubmitting:n,onCorrect:()=>o("input"),onConfirm:S}):s.jsx(a1t,{ticket:e,products:t,mode:l,setMode:c,amountCents:u,setAmountCents:d,cart:f,setCart:h,total:_,onContinue:()=>o("review")})}function z8({ticket:e,compact:t=!1}){const n=e.creditRemaining===0;return s.jsx("div",{className:"rounded-2xl border border-border bg-card p-4 mb-4",children:s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-xs font-mono text-muted-foreground uppercase tracking-wider",children:e.reservationCode}),s.jsx("h2",{className:"font-display text-xl font-bold truncate",children:e.displayName})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wider text-muted-foreground",children:"Solde"}),t?s.jsx("p",{className:"font-mono font-bold text-2xl leading-none",children:ba(e.creditRemaining)}):s.jsx("p",{className:ae("font-mono font-bold leading-none text-4xl",n?"text-muted-foreground":"text-accent-foreground bg-accent px-2 py-1 rounded"),children:ba(e.creditRemaining)})]})]})})}function sS({children:e}){return s.jsx("div",{className:"sticky bottom-0 left-0 right-0 -mx-4 mt-4 border-t border-border bg-background/95 backdrop-blur z-20",children:s.jsx("div",{className:"px-4 py-3 pb-safe",children:e})})}function a1t({ticket:e,products:t,mode:n,setMode:r,amountCents:i,setAmountCents:a,cart:o,setCart:l,total:c,onContinue:u}){const d=h=>{if(h==="del"){a(Math.floor(i/10));return}const p=h==="00"?i*100:i*10+parseInt(h,10);p>999999||a(p)},f=(h,p)=>{const x=o.find(b=>b.productId===h.id);if(!x&&p>0){l([...o,{productId:h.id,productName:h.name,priceCents:h.price_cents,quantity:1,vatRate:h.vat_rate!=null?Number(h.vat_rate):.2}]);return}if(!x)return;const y=x.quantity+p;y<=0?l(o.filter(b=>b.productId!==h.id)):l(o.map(b=>b.productId===h.id?{...b,quantity:y}:b))};return s.jsxs(s.Fragment,{children:[s.jsx(z8,{ticket:e}),s.jsx("div",{className:"flex p-1 bg-secondary rounded-full mb-4",children:["amount","catalog"].map(h=>s.jsx("button",{type:"button",onClick:()=>r(h),className:ae("flex-1 h-9 rounded-full text-sm font-medium transition-colors",n===h?"bg-background shadow-sm":"text-muted-foreground"),children:h==="amount"?"Montant":"Catalogue"},h))}),n==="amount"?s.jsx(o1t,{amountCents:i,setAmountCents:a,press:d}):s.jsx(l1t,{products:t,cart:o,updateQty:f}),s.jsxs(sS,{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Total"}),s.jsx("span",{className:"font-mono font-bold text-lg",children:ba(c)})]}),s.jsx(Q,{size:"lg",className:"w-full",disabled:c===0,onClick:u,children:"Continuer →"})]})]})}function o1t({amountCents:e,setAmountCents:t,press:n}){return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"rounded-2xl bg-secondary/60 border border-border py-6 px-4 text-center mb-3",children:[s.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wider text-muted-foreground mb-1",children:"Montant"}),s.jsx("p",{className:"font-mono text-5xl font-bold tabular-nums",children:ba(e)})]}),s.jsx("div",{className:"flex gap-2 flex-wrap mb-4",children:r1t.map(r=>s.jsx("button",{type:"button",onClick:()=>t(r),className:"rounded-full border border-border h-9 px-3 text-sm font-medium hover:bg-secondary transition-colors",children:ba(r)},r))}),s.jsx("div",{className:"grid grid-cols-3 gap-2",children:["1","2","3","4","5","6","7","8","9","0","00","del"].map(r=>s.jsx("button",{type:"button",onClick:()=>
2733n(r),className:"h-14 rounded-xl bg-secondary hover:bg-secondary/70 text-xl font-medium font-mono active:scale-95 transition-all flex items-center justify-center",children:r==="del"?s.jsx(Xge,{className:"w-5 h-5"}):r},r))})]})}function l1t({products:e,cart:t,updateQty:n}){const[r,i]=N.useState("all"),a=N.useMemo(()=>{const c=new Set;for(const u of e)c.add(u.category||"other");return Array.from(c).sort()},[e]),o=N.useMemo(()=>r==="all"?e:e.filter(c=>(c.category||"other")===r),[e,r]),l=N.useMemo(()=>{const c={};for(const u of o){const d=u.category||"other";(c[d]=c[d]||[]).push(u)}return c},[o]);return e.length===0?s.jsxs("div",{className:"text-center py-10 text-muted-foreground text-sm",children:[s.jsx("p",{children:"Aucun produit dans le catalogue."}),s.jsxs("p",{className:"text-xs mt-1",children:["Utilisez le mode ",s.jsx("strong",{children:"Montant"})," en attendant."]})]}):s.jsxs(s.Fragment,{children:[a.length>1&&s.jsx("div",{className:"sticky top-0 z-10 -mx-4 px-4 py-2 bg-background/95 backdrop-blur mb-3",children:s.jsxs("div",{className:"flex gap-2 overflow-x-auto scrollbar-hide",children:[s.jsx(xW,{active:r==="all",onClick:()=>i("all"),children:"Tous"}),a.map(c=>s.jsxs(xW,{active:r===c,onClick:()=>i(c),children:[s.jsx("span",{"aria-hidden":!0,children:pW[c]??"•"}),gW(c)]},c))]})}),s.jsx("div",{className:"space-y-4",children:Object.entries(l).map(([c,u])=>s.jsxs("div",{children:[r==="all"&&a.length>1&&s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("span",{"aria-hidden":!0,children:pW[c]??"•"}),s.jsx("span",{className:"text-xs font-mono uppercase tracking-wider text-muted-foreground",children:gW(c)})]}),s.jsx("div",{className:"space-y-1",children:u.map(d=>{var h;const f=((h=t.find(p=>p.productId===d.id))==null?void 0:h.quantity)??0;return s.jsxs("div",{className:ae("flex items-center justify-between rounded-xl border px-3 py-2",f>0?"border-foreground bg-secondary/40":"border-border"),children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-medium truncate",children:d.name}),s.jsxs("p",{className:"text-xs font-mono text-muted-foreground",children:[d.subcategory?`${d.subcategory} · `:"",ba(d.price_cents)]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{type:"button",onClick:()=>n(d,-1),disabled:f===0,className:"w-8 h-8 rounded-full border border-border flex items-center justify-center disabled:opacity-30","aria-label":`Retirer ${d.name}`,children:s.jsx(Eb,{className:"w-3 h-3"})}),s.jsx("span",{className:"w-6 text-center font-mono font-semibold",children:f}),s.jsx("button",{type:"button",onClick:()=>n(d,1),className:"w-8 h-8 rounded-full bg-foreground text-background flex items-center justify-center","aria-label":`Ajouter ${d.name}`,children:s.jsx(qa,{className:"w-3 h-3"})})]})]},d.id)})})]},c))})]})}function xW({active:e,onClick:t,children:n}){return s.jsx("button",{type:"button",onClick:t,className:ae("shrink-0 inline-flex items-center gap-1.5 h-8 px-3 rounded-full text-sm font-medium border transition-colors whitespace-nowrap",e?"bg-foreground text-background border-foreground":"bg-transparent text-foreground border-border hover:bg-secondary"),children:n})}function c1t({ticket:e,mode:t,cart:n,products:r,total:i,debited:a,toCollect:o,isSubmitting:l,onCorrect:c,onConfirm:u}){const d=t==="catalog"?n:[];return s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",onClick:c,className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground mb-2",children:[s.jsx(Fn,{className:"w-4 h-4"})," Retour"]}),s.jsx("h1",{className:"font-display text-2xl font-bold mb-4",children:"Récapitulatif"}),s.jsx(z8,{ticket:e,compact:!0}),d.length>0&&s.jsxs("div",{className:"rounded-2xl border border-border bg-card divide-y divide-border mb-3",children:[s.jsx("div",{className:"px-4 py-2",children:s.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wider text-muted-foreground",children:"Détail commande"})}),d.map(f=>{const h=r.find(x=>x.id===f.productId),p=(h==null?void 0:h.name)??f.productName;return s.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",children:[s.jsxs("div",{className:"min-w-0 flex-1 flex items-baseline gap-2",children:[s.jsxs("span",{className:"font-mono text-sm text-muted-foreground tabular-nums",children:[f.quantity,"×"]}),s.jsx("span",{className:"text-sm truncate",children:p})]}),s.jsx("span",{className:"font-mono text-sm tabular-nums",children:ba(f.priceCents*f.quantity)})]},f.productId)})]}),s.jsxs("div",{className:"rounded-2xl border border-border bg-card divide-y divide-border mb-4",children:[s.jsx(u3,{label:"Montant commandé",value:ba(i)}),s.jsx(u3,{label:"Débit crédit",value:ba(a)}),o>0&&s.jsx(u3,{label:"À encaisser au bar",value:ba(o),valueClass:"text-destructive"})]}),o>0&&s.jsxs("div",{className:"rounded-xl bg-secondary border border-border p-3 mb-4 flex gap-2",children:[s.jsx(ur,{className:"w-4 h-4 text-destructive shrink-0 mt-0.5"}),s.jsxs("p",{className:"text-sm",children:["Le crédit ne couvre pas la totalité. Encaissez"," ",s.jsx("strong",{children:ba(o)})," en espèces ou CB au bar."]})]}),s.jsx(sS,{children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Q,{variant:"outline",size:"lg",className:"flex-1",onClick:c,disabled:l,children:"← Corriger"}),s.jsx(Q,{size:"lg",className:"flex-1",onClick:u,disabled:l,children:l?"...":"Confirmer"})]})})]})}function u3({label:e,value:t,valueClass:n}){return s.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:e}),s.jsx("span",{className:ae("font-mono font-semibold tabular-nums",n),children:t})]})}function u1t({ticket:e,debited:t,toCollect:n,onScanNext:r}){const i=Math.max(0,e.creditRemaining-t),a=e.creditTotal||e.creditRemaining||1,o=Math.max(0,Math.min(100,i/a*100));return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-col items-center text-center px-4 py-8",children:[s.jsx("div",{className:"w-20 h-20 rounded-full bg-accent/30 flex items-center justify-center mb-5 animate-fade-in",children:s.jsx(Jr,{className:"w-12 h-12 text-foreground",strokeWidth:2.25})}),s.jsx("h1",{className:"font-display text-2xl font-bold mb-1",children:"Conso enregistrée"}),s.jsxs("p",{className:"text-muted-foreground mb-8",children:[e.displayName," · ",s.jsxs("span",{className:"font-mono",children:["−",ba(t)]})]}),s.jsxs("div",{className:"w-full max-w-xs",children:[s.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[s.jsx("span",{className:"text-xs font-mono uppercase tracking-wider text-muted-foreground",children:"Crédit restant"}),s.jsxs("span",{className:"font-mono text-xs text-muted-foreground tabular-nums",children:["sur ",ba(a)]})]}),s.jsx("p",{className:"font-mono text-3xl font-bold tabular-nums mb-3",children:ba(i)}),s.jsx(du,{value:o,className:"h-2"})]}),n>0&&s.jsxs("div",{className:"mt-6 w-full max-w-xs rounded-xl border-2 border-destructive/40 bg-destructive/5 p-4",children:[s.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wider text-destructive mb-1",children:"À encaisser au bar"}),s.jsx("p",{className:"font-mono text-2xl font-bold text-destructive tabular-nums",children:ba(n)}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Espèces ou CB — hors application."})]})]}),s.jsx(sS,{children:s.jsx(Q,{size:"lg",className:"w-full",onClick:r,children:"Scanner le ticket suivant"})})]})}function d1t({ticket:e,onScanNext:t}){return s.jsxs(s.Fragment,{children:[s.jsx("h1",{className:"font-display text-2xl font-bold mb-4",children:"Crédit épuisé"}),s.jsx(z8,{ticket:e}),s.jsxs("div",{className:"rounded-2xl bg-secondary border border-border p-6 text-center",children:[s.jsx("p",{className:"font-display text-lg font-bold mb-2",children:"Paiement direct au bar"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Le crédit de ce ticket est entièrement consommé. Toute commande supplémentaire est à encaisser directement par le bar (espèces ou CB)."})]}),s.jsx(sS,{children:s.jsx(Q,{size:"lg",className:"w-full",onClick:t,children:"Scanner le ticket suivant"})})]})}function f1t(){const{id:e}=Wi(),[t,n]=N.useState("scan"),[r,i]=N.useState(""),[a,o]=N.useState(!1),[l,c]=N.useState(null),{data:u,isLoading:d}=nh(e),{data:f,isLoading:h,refetch:p}=bte(r,e),{data:x=[]}=tE(u==null?void 0:u.venue_id),y=SC(),b=K3e(),w=Xoe(),_=$c(f),j=!!u&&Vb(u)==="paper";N.useEffect(()=>{f&&_&&t!=="consume"&&!j&&n("consume")},[f,_,j]);const E=N.useCallback(R=>{i(R)},[]),S=N.useCallback(R=>
2733{if(R.checkin){je.info("Ce participant est déjà présent");return}const L=R.status==="reserved"&&R.is_walk_in===!0,M=L?_te(R.guest_notes,(u==null?void 0:u.price_cents)??0):0;c({id:R.id,name:ii(R,{showFullName:!0}),requiresPayment:L,amountDueCents:M,currentNotes:R.guest_notes??null}),o(!0)},[u==null?void 0:u.price_cents]),T=async R=>{if(!(!l||!e))try{l.requiresPayment?await b.mutateAsync({ticketId:l.id,eventId:e,amountDueCents:l.amountDueCents,currentNotes:l.currentNotes}):(await y.mutateAsync({ticketId:l.id,method:"name_search",identityVerified:!0,notes:R}),je.success("Check-in validé avec vérification d'identité")),o(!1),c(null)}catch{}},P=async()=>{f&&(await y.mutateAsync({ticketId:f.id}),await p(),j||n("consume"))},O=()=>{i(""),n("scan")};if(d)return s.jsxs("div",{className:"w-full max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-8 space-y-4 sm:space-y-6",children:[s.jsx(Ie,{className:"h-8 w-48"}),s.jsx(Ie,{className:"h-96"})]});if(!u)return s.jsxs("div",{className:"w-full max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-8 text-center",children:[s.jsx("p",{className:"text-muted-foreground mb-4",children:"Événement non trouvé"}),s.jsx(Pe,{to:"/admin/events",children:s.jsx(Q,{children:"Retour aux événements"})})]});const D=y.isPending||b.isPending;return s.jsxs("div",{className:"w-full max-w-2xl mx-auto px-4 sm:px-6 py-4 sm:py-6 space-y-4 sm:space-y-6 pb-safe",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Pe,{to:`/admin/events/${e}`,className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(Fn,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden xs:inline",children:"Retour à l'événement"}),s.jsx("span",{className:"xs:hidden",children:"Retour"})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h1",{className:"font-display text-lg sm:text-xl font-bold truncate",children:"Check-in & Conso"}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:u.title})]}),s.jsx(we,{variant:"outline",className:"self-start sm:self-auto shrink-0 text-xs",children:Ze(new Date(u.event_date),"d MMM HH'h'mm",{locale:pt})})]})]}),s.jsxs("div",{className:"flex items-center justify-center gap-1 xs:gap-2 sm:gap-3 overflow-x-auto scrollbar-hide py-1",children:[s.jsxs("div",{className:ae("flex items-center gap-1 sm:gap-1.5 px-2 xs:px-2.5 sm:px-3 py-1.5 rounded-full text-xs sm:text-sm whitespace-nowrap shrink-0 transition-colors",t==="scan"?"bg-primary/90 text-primary-foreground backdrop-blur-sm shadow-[inset_0_1px_0_rgba(255,255,255,0.1)]":"bg-muted/60 text-muted-foreground backdrop-blur-sm border border-border/50"),children:[s.jsx(nu,{className:"w-4 h-4 shrink-0"}),s.jsx("span",{className:"hidden sm:inline",children:"Scanner"})]}),s.jsx("div",{className:"w-2 xs:w-4 sm:w-8 h-px bg-gradient-to-r from-transparent via-border to-transparent shrink-0"}),s.jsxs("div",{className:ae("flex items-center gap-1 sm:gap-1.5 px-2 xs:px-2.5 sm:px-3 py-1.5 rounded-full text-xs sm:text-sm whitespace-nowrap shrink-0 transition-colors",t==="checkin"||f&&!_?"bg-primary/90 text-primary-foreground backdrop-blur-sm shadow-[inset_0_1px_0_rgba(255,255,255,0.1)]":"bg-muted/60 text-muted-foreground backdrop-blur-sm border border-border/50"),children:[s.jsx(Cn,{className:"w-4 h-4 shrink-0"}),s.jsx("span",{className:"hidden sm:inline",children:"Check-in"})]}),s.jsx("div",{className:"w-2 xs:w-4 sm:w-8 h-px bg-gradient-to-r from-transparent via-border to-transparent shrink-0"}),s.jsxs("div",{className:ae("flex items-center gap-1 sm:gap-1.5 px-2 xs:px-2.5 sm:px-3 py-1.5 rounded-full text-xs sm:text-sm whitespace-nowrap shrink-0 transition-colors",t==="consume"||_?"bg-primary/90 text-primary-foreground backdrop-blur-sm shadow-[inset_0_1px_0_rgba(255,255,255,0.1)]":"bg-muted/60 text-muted-foreground backdrop-blur-sm border border-border/50"),children:[s.jsx(el,{className:"w-4 h-4 shrink-0"}),s.jsx("span",{className:"hidden sm:inline",children:"Conso"})]})]}),!f&&s.jsxs(Se,{children:[s.jsx(kt,{className:"p-3 sm:p-6 pb-2 sm:pb-4",children:s.jsx(Et,{className:"text-sm sm:text-base",children:"Scanner un ticket"})}),s.jsxs(De,{className:"p-3 sm:p-6 pt-0",children:[s.jsx(Cfe,{onScan:E,isSearching:h,showSearchMode:!0,eventId:e,eventPriceCents:u.price_cents,onParticipantSelect:S}
2733),r&&!h&&s.jsxs("div",{className:"mt-4 p-3 sm:p-4 rounded-lg bg-destructive/10 text-destructive text-center",children:[s.jsx("p",{className:"font-medium text-sm sm:text-base",children:"Ticket non trouvé"}),s.jsxs("p",{className:"text-xs sm:text-sm",children:["Vérifiez le code : ",r]})]})]})]}),s.jsx(Sfe,{open:a,onOpenChange:o,participantName:(l==null?void 0:l.name)||"",requiresPayment:(l==null?void 0:l.requiresPayment)??!1,amountDueCents:(l==null?void 0:l.amountDueCents)??0,standardPriceCents:u.price_cents,onConfirm:T,isLoading:D}),f&&(()=>{const R=u,L=R==null?void 0:R.venue,M=(R==null?void 0:R.coupon_mode)==="paper"||(R==null?void 0:R.coupon_mode)==null&&(L==null?void 0:L.default_coupon_mode)==="paper",B=(R==null?void 0:R.paper_coupon_label)&&String(R.paper_coupon_label).trim()||(L==null?void 0:L.default_paper_coupon_label)&&String(L.default_paper_coupon_label).trim()||null,U=(R==null?void 0:R.paper_coupon_description)&&String(R.paper_coupon_description).trim()||(L==null?void 0:L.default_paper_coupon_description)&&String(L.default_paper_coupon_description).trim()||null,H=(Array.isArray(R==null?void 0:R.paper_coupon_formulas)&&R.paper_coupon_formulas.length?R.paper_coupon_formulas:Array.isArray(L==null?void 0:L.default_paper_coupon_formulas)?L.default_paper_coupon_formulas:[]).filter(K=>K&&typeof K.name=="string"&&K.name.trim()).map(K=>({name:String(K.name).trim(),description:typeof K.description=="string"?K.description:void 0})),z=M?{label:B,description:U,formulas:H}:null;return s.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[s.jsx(Efe,{ticket:f,couponMode:M?"paper":"digital",paperCoupon:z}),!_&&s.jsx(Q,{size:"lg",className:"w-full h-12 sm:h-14 text-base",onClick:P,disabled:y.isPending||f.status==="cancelled",children:y.isPending?"Validation...":"✓ Valider la présence"}),_&&s.jsxs(Q,{size:"lg",className:"w-full h-12 sm:h-14 text-base",onClick:O,children:[s.jsx(nu,{className:"w-5 h-5 mr-2"}),"Scanner le ticket suivant"]}),_&&(M?s.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{children:"🎟️"}),s.jsx("span",{className:"font-medium",children:B?`Remettre : ${B}`:`Remettre le coupon papier ${(f.credit_total_cents/100).toFixed(0)}€ au joueur.`})]}),U&&s.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-line",children:U}),H.length>0&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:[H.length>1?"Au choix : ":"Inclus : ",H.map(K=>K.name).join(" • ")]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-3 text-xs uppercase tracking-wide text-muted-foreground",children:[s.jsx("div",{className:"h-px flex-1 bg-border"}),"ou enregistrer une conso",s.jsx("div",{className:"h-px flex-1 bg-border"})]}),s.jsx(Afe,{ticket:{id:f.id,displayName:ii(f,{showFullName:!0}),reservationCode:f.reservation_code,creditRemaining:f.credit_remaining_cents??f.credit_total_cents??0,creditTotal:f.credit_total_cents??0},products:x,isSubmitting:w.isPending,onSubmit:async({items:K})=>{await w.mutateAsync({ticketId:f.id,items:K}),await p()},onScanNext:O})]})),!_&&s.jsx(Q,{variant:"outline",className:"w-full h-11 sm:h-12",onClick:O,children:"Scanner un autre ticket"})]})})()]})}function h1t({template:e,onPreview:t,onTest:n}){const r=nvt[e.category];return s.jsx(Se,{className:"border-border/50 bg-card/50 backdrop-blur-sm hover:border-primary/30 transition-all group",children:s.jsx(De,{className:"p-4",children:s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx("div",{className:"flex items-start justify-between gap-3",children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:s.jsx(wr,{className:"w-4 h-4 text-primary"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("h3",{className:"font-medium text-sm truncate",children:e.name}),s.jsx(we,{variant:"outline",className:`text-[10px] mt-1 ${r.className}`,children:r.label})]})]})}),s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:e.description}),s.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[s.jsx(gd,{className:"w-3 h-3 text-amber-500/70"}),s.jsx("span",{className:"truncate",children:e.trigger})]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[s.jsx(VY,{className:"w-3 h-3"}),s.jsxs("span",{children:[e.variables.length," variable",e.variables.length>
27331?"s":""]})]}),s.jsxs("div",{className:"flex gap-2 pt-2 border-t border-border/50",children:[s.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>t(e),className:"flex-1 h-8 text-xs",children:[s.jsx(go,{className:"w-3.5 h-3.5 mr-1.5"}),"Preview"]}),s.jsxs(Q,{size:"sm",onClick:()=>n(e),className:"flex-1 h-8 text-xs bg-primary/90 hover:bg-primary",children:[s.jsx(ca,{className:"w-3.5 h-3.5 mr-1.5"}),"Tester"]})]})]})})})}function m1t(e){const t=e.code||"",n=e.hint||e.error;switch(t){case"INVALID_FROM_EMAIL":return{title:"Adresse expéditeur invalide",description:n,showSecretsLink:!0};case"AUTH_FAILED":return{title:"Authentification échouée",description:"Vérifiez SMTP_USERNAME et SMTP_PASSWORD",showSecretsLink:!0};case"CONNECTION_TIMEOUT":case"CONNECTION_REFUSED":return{title:"Serveur inaccessible",description:"Vérifiez SMTP_HOST et SMTP_PORT",showSecretsLink:!0};case"MISSING_CONFIG":return{title:"Configuration incomplète",description:n,showSecretsLink:!0};default:return{title:e.error||"Erreur d'envoi",description:n,showSecretsLink:!1}}}function p1t({template:e,open:t,onOpenChange:n}){const{user:r}=Tt(),i=Ye(),[a,o]=N.useState((r==null?void 0:r.email)||""),[l,c]=N.useState(null),u=dt({mutationFn:async({templateId:f,recipientEmail:h})=>{var w;const{data:p}=await re.auth.getSession(),x=(w=p==null?void 0:p.session)==null?void 0:w.access_token;if(!x)throw new Error("Session expirée, veuillez vous reconnecter");const y=await fetch("https://panllzgwiadaxweewisk.supabase.co/functions/v1/test-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${x}`},body:JSON.stringify({templateId:f,recipientEmail:h})}),b=await y.json();if(!y.ok)throw{error:b.error||"Erreur d'envoi",hint:b.hint,code:b.code};return b},onSuccess:()=>{c(null),dn({title:"Email envoyé ! ✅",description:`Email de test envoyé à ${a}`}),i.invalidateQueries({queryKey:["email-logs"]}),n(!1)},onError:f=>{if(f&&typeof f=="object"&&"error"in f){const p=m1t(f);c(p),dn({title:p.title,description:p.description,variant:"destructive"})}else{const h=f instanceof Error?f.message:"Erreur inconnue";c({title:"Erreur d'envoi",description:h,showSecretsLink:!1}),dn({title:"Erreur d'envoi",description:h,variant:"destructive"})}}}),d=f=>{f.preventDefault(),c(null),!(!e||!a)&&u.mutate({templateId:e.id,recipientEmail:a.trim()})};return e?s.jsx(Ln,{open:t,onOpenChange:n,children:s.jsxs(Dn,{className:"sm:max-w-md",children:[s.jsxs(Un,{children:[s.jsxs(qn,{className:"flex items-center gap-2",children:[s.jsx(ca,{className:"w-5 h-5 text-primary"}),"Tester l'envoi"]}),s.jsx(qr,{children:"Envoyer un email de test pour vérifier la configuration SMTP"})]}),s.jsxs("form",{onSubmit:d,className:"space-y-4 pt-2",children:[s.jsxs("div",{className:"p-3 rounded-lg bg-primary/5 border border-primary/20",children:[s.jsx("p",{className:"text-sm font-medium",children:e.name}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.description})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Fe,{htmlFor:"test-email",children:"Adresse email de test"}),s.jsx(Ue,{id:"test-email",type:"email",placeholder:"[email protected]",value:a,onChange:f=>o(f.target.value),required:!0,className:"h-11"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Un email de test sera envoyé à cette adresse"})]}),u.isSuccess&&s.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-green-500/10 border border-green-500/20",children:[s.jsx(Jr,{className:"w-4 h-4 text-green-500 shrink-0"}),s.jsx("span",{className:"text-sm text-green-400",children:"Configuration SMTP validée !"})]}),u.isError&&l&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-red-500/10 border border-red-500/20",children:[s.jsx(El,{className:"w-4 h-4 text-red-500 mt-0.5 shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-sm text-red-400 block font-medium",children:l.title}),s.jsx("span",{className:"text-xs text-red-400/80 break-words",children:l.description})]})]}),l.showSecretsLink&&s.jsxs("a",{href:"https://supabase.com/dashboard/project/panllzgwiadaxweewisk/settings/functions",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-xs text-primary hover:underline",children:[s.jsx(pd,{className:"w-3 h-3"}),"Ouvrir les secrets Supabase"]})]}),s.jsxs("div",{className:"flex gap-3 pt-2",children:[s.jsx(Q,{type:"button",variant:"outline",className:"flex-1",onClick:()=>n(!1),children:"Annuler"}),s.jsx(Q,{type:"submit",className:"flex-1",disabled:u.isPending||!a.trim(),children:u.isPending?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),"Envoi..."]}):s.jsxs(s.Fragment,{children:[s.jsx(ca,{className:"w-4 h-4 mr-2"}),"Envoyer"]})})]})]})]})}):null}function g1t({logs:e,isLoading:t}){const n=N.useMemo(()=>
2733{if(!e||e.length===0)return{total:0,sent:0,failed:0,successRate:0,dailyData:[],typeData:[]};const i=e.length,a=e.filter(h=>h.status==="sent").length,o=e.filter(h=>h.status==="failed").length,l=i>0?Math.round(a/i*100):0,u=Array.from({length:7},(h,p)=>hj(new Date,6-p)).map(h=>{const p=Sl(h),x=e.filter(y=>Ui(new Date(y.created_at),p));return{name:Ze(h,"EEE",{locale:pt}),date:Ze(h,"dd/MM"),envoyés:x.filter(y=>y.status==="sent").length,échoués:x.filter(y=>y.status==="failed").length}}),d={};e.forEach(h=>{const p=h.email_type||"generic";d[p]=(d[p]||0)+1});const f=Object.entries(d).map(([h,p])=>{var x;return{name:((x=Dj[h])==null?void 0:x.label)||h,value:p,type:h}});return{total:i,sent:a,failed:o,successRate:l,dailyData:u,typeData:f}},[e]),r=["#a855f7","#22c55e","#3b82f6","#f59e0b","#6b7280"];return t?s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[1,2,3,4].map(i=>s.jsx("div",{className:"h-24 bg-muted/50 rounded-lg animate-pulse"},i))}),s.jsx("div",{className:"h-64 bg-muted/50 rounded-lg animate-pulse"})]}):s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[s.jsx(Se,{className:"border-border/50 bg-card/50 backdrop-blur-sm",children:s.jsx(De,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(ca,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold",children:n.total}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Total envoyés"})]})]})})}),s.jsx(Se,{className:"border-border/50 bg-card/50 backdrop-blur-sm",children:s.jsx(De,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-green-500/10 flex items-center justify-center",children:s.jsx(Jr,{className:"w-5 h-5 text-green-500"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold",children:n.sent}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Réussis"})]})]})})}),s.jsx(Se,{className:"border-border/50 bg-card/50 backdrop-blur-sm",children:s.jsx(De,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-red-500/10 flex items-center justify-center",children:s.jsx(hi,{className:"w-5 h-5 text-red-500"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold",children:n.failed}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Échoués"})]})]})})}),s.jsx(Se,{className:"border-border/50 bg-card/50 backdrop-blur-sm",children:s.jsx(De,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-amber-500/10 flex items-center justify-center",children:s.jsx(lu,{className:"w-5 h-5 text-amber-500"})}),s.jsxs("div",{children:[s.jsxs("p",{className:"text-2xl font-bold",children:[n.successRate,"%"]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Taux réussite"})]})]})})})]}),s.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[s.jsxs(Se,{className:"border-border/50 bg-card/50 backdrop-blur-sm",children:[s.jsx(kt,{className:"pb-2",children:s.jsxs(Et,{className:"text-sm font-medium flex items-center gap-2",children:[s.jsx(lu,{className:"w-4 h-4"}),"Envois des 7 derniers jours"]})}),s.jsx(De,{children:n.dailyData.length>0&&n.total>0?s.jsx(KP,{width:"100%",height:200,children:s.jsxs(uyt,{data:n.dailyData,children:[s.jsx(ey,{dataKey:"name",tick:{fontSize:11},axisLine:!1,tickLine:!1,className:"fill-muted-foreground"}),s.jsx(ty,{tick:{fontSize:11},axisLine:!1,tickLine:!1,allowDecimals:!1,className:"fill-muted-foreground"}),s.jsx(sc,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"8px",fontSize:"12px"},labelFormatter:(i,a)=>{var l;const o=(l=a==null?void 0:a[0])==null?void 0:l.payload;return(o==null?void 0:o.date)||i}}),s.jsx(Hf,{dataKey:"envoyés",className:"fill-green-500",radius:[4,4,0,0]}),s.jsx(Hf,{dataKey:"échoués",className:"fill-red-500",radius:[4,4,0,0]})]})}):s.jsx("div",{className:"h-[200px] flex items-center justify-center text-muted-foreground text-sm",children:"Aucune donnée disponible"})})]}),s.jsxs(Se,{className:"border-border/50 bg-card/50 backdrop-blur-sm",children:[s.jsx(kt,{className:"pb-2",children:s.jsxs(Et,{className:"text-sm font-medium flex items-center gap-2",children:[s.jsx(Wge,{className:"w-4 h-4"}),"Répartition par type"]})}),s.jsx(De,{children:n.typeData.length>0?s.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[s.jsx(KP,{width:160,height:160,children:s.jsx(dyt,{children:s.jsx(Sd,{data:n.typeData,cx:"50%",cy:"50%",innerRadius:40,outerRadius:70,paddingAngle:2,dataKey:"value",children:n.typeData.map((i,a)=>s.jsx(TE,{fill:r[a%r.length]},`cell-${a}`))})})}),s.jsx("div",{className:"flex flex-wrap justify-center sm:flex-col gap-2",children:n.typeData.map((i,a)=>s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[s.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:r[a%r.length]}}),s.jsx("span",{className:"text-muted-foreground",children:i.name}),s.jsx("span",{className:"font-medium",children:i.value})]},i.name))})]}):s.jsx("div",{className:"h-[160px] flex items-center justify-center text-muted-foreground text-sm",children:"Aucune donnée disponible"})})]})]})]})}const yW=e=>e==="before_event_48h"?"48h avant":e==="first"?"72h (1er)":e==="after_extend"?"72h (relance étendue)":e??"—";function x1t({open:e,onOpenChange:t,result:n,onConfirmSend:r,isSending:i}){const a=N.useMemo(()=>
2733{if(!n)return[];const l=c=>c.error?0:c.skipReason?2:1;return[...n.details].sort((c,u)=>l(c)-l(u))},[n]),o=()=>{if(!n)return;const l="status,email,event,variant,reason",c=a.map(u=>{const d=u.error?"failed":u.skipReason?"skipped":n.dryRun?"would_send":"sent",f=u.error??u.skipReason??"";return[d,u.email,u.eventTitle,yW(u.variant),f].map(h=>`"${String(h).replace(/"/g,'""')}"`).join(",")});navigator.clipboard.writeText([l,...c].join(`
2734`)),dn({title:"Copié",description:`${a.length} ligne(s) au presse-papier.`})};return n?s.jsx(Ln,{open:e,onOpenChange:t,children:s.jsxs(Dn,{className:"max-w-3xl",children:[s.jsxs(Un,{children:[s.jsxs(qn,{className:"flex items-center gap-2",children:[n.dryRun?"Simulation — Relances pré-inscription":"Envoi — Relances pré-inscription",s.jsx(we,{variant:n.dryRun?"outline":"default",children:n.dryRun?"Dry-run":"Live"})]}),s.jsxs(qr,{children:[n.candidates," lead(s) scanné(s) · ",s.jsx("span",{className:"text-green-500 font-medium",children:n.sent})," ",n.dryRun?"à envoyer":"envoyé(s)"," · ",s.jsx("span",{className:"text-muted-foreground",children:n.skipped})," ignoré(s) ·"," ",s.jsx("span",{className:n.failed>0?"text-red-500 font-medium":"",children:n.failed})," échec(s)"]})]}),s.jsx(cd,{className:"max-h-[50vh] pr-2",children:s.jsxs("div",{className:"space-y-1.5",children:[a.length===0&&s.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"Aucun détail retourné."}),a.map((l,c)=>{const u=l.error?s.jsx(hi,{className:"w-4 h-4 text-red-500 flex-shrink-0"}):l.skipReason?s.jsx(Kge,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):s.jsx(Jr,{className:"w-4 h-4 text-green-500 flex-shrink-0"});return s.jsxs("div",{className:"flex items-start gap-2 p-2 rounded border border-border/40 bg-muted/20 text-xs",children:[u,s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsx("span",{className:"font-medium truncate",children:l.email||"(pas d'email)"}),s.jsx(we,{variant:"outline",className:"text-[10px]",children:yW(l.variant)})]}),s.jsx("p",{className:"text-muted-foreground truncate",children:l.eventTitle}),(l.skipReason||l.error)&&s.jsx("p",{className:`mt-0.5 ${l.error?"text-red-400":"text-muted-foreground/80"}`,children:l.error?`Erreur: ${l.error}`:`Ignoré: ${l.skipReason}`})]})]},`${l.ticketId}-${c}`)})]})}),s.jsxs(Pi,{className:"gap-2 sm:justify-between",children:[s.jsxs(Q,{variant:"ghost",size:"sm",onClick:o,disabled:a.length===0,children:[s.jsx(Ko,{className:"w-4 h-4 mr-2"})," Copier CSV"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Q,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Fermer"}),n.dryRun&&n.sent>0&&r&&s.jsxs(Q,{size:"sm",onClick:r,disabled:i,children:[s.jsx(ca,{className:`w-4 h-4 mr-2 ${i?"animate-pulse":""}`}),"Envoyer pour de vrai (",n.sent,")"]})]})]})]})}):null}const y1t=9e4;function v1t(){const[e]=wc(),[t,n]=N.useState("templates"),[r,i]=N.useState("all"),[a,o]=N.useState(null),[l,c]=N.useState(!1),[u,d]=N.useState(!1),[f,h]=N.useState(null),[p,x]=N.useState(!1),[y,b]=N.useState(null),[w,_]=N.useState(!1);N.useEffect(()=>{const B=e.get("template");if(!B)return;const U=og.find(F=>F.id===B);U&&(o(U),c(!0))},[e]);const j=async B=>{x(!0),dn({title:B?"Simulation en cours…":"Envoi en cours…",description:"Scan des leads, ça peut prendre jusqu'à 1 min."});const U=setTimeout(()=>{x(!1),dn({title:"Timeout",description:"Pas de réponse en 90s. Vérifie l'historique pour l'état réel.",variant:"destructive"})},y1t);try{const{data:F,error:H}=await re.functions.invoke("trigger-preregistration-reminders",{body:{mode:"backfill",dryRun:B}});if(H)throw H;const z=F,K={dryRun:B,candidates:(z==null?void 0:z.candidates)??0,sent:(z==null?void 0:z.sent)??0,skipped:(z==null?void 0:z.skipped)??0,failed:(z==null?void 0:z.failed)??0,details:(z==null?void 0:z.details)??[],ranAt:Date.now()};b(K),_(!0),dn({title:B?"Simulation terminée":"Relances traitées",description:`${K.sent} ${B?"à envoyer":"envoyé(s)"} · ${K.skipped} ignoré(s) · ${K.failed} échec(s) — sur ${K.candidates} lead(s).`}),B||T()}catch(F){dn({title:"Erreur",description:F instanceof Error?F.message:"Impossible de lancer la relance.",variant:"destructive"})}finally{clearTimeout(U),x(!1)}},{data:E,isLoading:S,refetch:T,isRefetching:P}=st({queryKey:["email-logs"],queryFn:async()=>{const{data:B,error:U}=await re.from("email_logs").select("*").order("created_at",{ascending:!1}).limit(200);if(U)throw U;return B}}
2734),O=(E==null?void 0:E.filter(B=>r==="all"||B.email_type===r))||[],D=B=>{switch(B){case"sent":return s.jsx(Jr,{className:"w-4 h-4 text-green-500 flex-shrink-0"});case"failed":return s.jsx(hi,{className:"w-4 h-4 text-red-500 flex-shrink-0"});default:return s.jsx(Vt,{className:"w-4 h-4 text-yellow-500 flex-shrink-0"})}},R=B=>{const U=Dj[B]||Dj.generic;return s.jsx(we,{variant:"outline",className:`text-xs ${U.className}`,children:U.label})},L=B=>{o(B),c(!0)},M=B=>{h(B),d(!0)};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:"Emails automatiques"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Templates, monitoring et historique"})]}),s.jsxs("div",{className:"flex flex-col items-start sm:items-end gap-1 self-start sm:self-auto",children:[s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(Q,{variant:"outline",size:"sm",onClick:()=>j(!0),disabled:p,title:"Simuler la relance sans envoyer",children:p?s.jsxs(s.Fragment,{children:[s.jsx(xo,{className:"w-4 h-4 mr-2 animate-spin"}),"Simulation…"]}):"Simuler relance 72h"}),s.jsx(Q,{variant:"default",size:"sm",onClick:()=>j(!1),disabled:p,children:p?s.jsxs(s.Fragment,{children:[s.jsx(xo,{className:"w-4 h-4 mr-2 animate-spin"}),"Envoi en cours…"]}):s.jsxs(s.Fragment,{children:[s.jsx(ca,{className:"w-4 h-4 mr-2"}),"Relancer les pré-inscriptions"]})}),s.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>T(),disabled:P,children:[s.jsx(xo,{className:`w-4 h-4 mr-2 ${P?"animate-spin":""}`}),"Actualiser"]})]}),y&&s.jsxs("button",{type:"button",onClick:()=>_(!0),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Dernier scan ",eJ(new Date(y.ranAt),{locale:pt,addSuffix:!0})," ·"," ",s.jsx("span",{className:"text-green-500",children:y.sent})," ",y.dryRun?"à envoyer":"envoyé(s)"," ·"," ",y.skipped," ignoré(s) ·"," ",s.jsx("span",{className:y.failed>0?"text-red-500":"",children:y.failed})," échec(s) — voir détail"]})]})]}),s.jsxs(Ka,{value:t,onValueChange:n,children:[s.jsxs(Ca,{className:"grid w-full grid-cols-3",children:[s.jsxs(vn,{value:"templates",className:"gap-1.5 text-xs sm:text-sm",children:[s.jsx(WY,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Templates"})]}),s.jsxs(vn,{value:"logs",className:"gap-1.5 text-xs sm:text-sm",children:[s.jsx(i1,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Historique"})]}),s.jsxs(vn,{value:"stats",className:"gap-1.5 text-xs sm:text-sm",children:[s.jsx(iI,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Statistiques"})]})]}),s.jsx(Sn,{value:"templates",className:"mt-6",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:[og.length," template",og.length>1?"s":""," configuré",og.length>1?"s":""]}),s.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:og.map(B=>s.jsx(h1t,{template:B,onPreview:L,onTest:M},B.id))})]})}),s.jsxs(Sn,{value:"logs",className:"mt-6 space-y-4",children:[s.jsx(cd,{className:"w-full",children:s.jsx("div",{className:"flex gap-2 pb-2",children:["all","email_confirmation","venue_welcome","ticket_confirmation","ticket_confirmation_guest","preregistration_confirmation","preregistration_reminder_72h","preregistration_reminder_48h_before","event_gallery_ready","test_event_gallery_ready","event_gallery_access_granted","event_gallery_access_rejected"].map(B=>{var U;return s.jsx(Q,{variant:r===B?"default":"outline",size:"sm",onClick:()=>i(B),className:"text-xs whitespace-nowrap",children:B==="all"?"Tous":((U=Dj[B])==null?void 0:U.label)||B},B)})})}),s.jsxs(Se,{className:"border-border/50 bg-card/50 backdrop-blur-sm",children:[s.jsx(kt,{className:"pb-3",children:s.jsxs(Et,{className:"text-base sm:text-lg flex items-center gap-2",children:[s.jsx(wr,{className:"w-4 h-4 sm:w-5 sm:h-5"}),"Historique des envois",O.length>0&&s.jsx(we,{variant:"secondary",className:"ml-2",children:O.length})]})}),s.jsx(De,{children:S?s.jsx("div",{className:"space-y-3",children:[1,2,3].map(B=>s.jsx("div",{className:"h-16 bg-muted/50 rounded-lg animate-pulse"},B))}):O.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(wr,{className:"w-12 h-12 text-muted-foreground mx-auto mb-4 opacity-50"}),s.jsx("p",{className:"text-muted-foreground",children:"Aucun email envoyé"})]}):s.jsx("div",{className:"space-y-2 max-h-[500px] overflow-y-auto pr-2",children:O.map(B=>s.jsx("div",{className:"p-3 sm:p-4 bg-muted/30 rounded-lg border border-border/50 hover:border-border/80 transition-colors",children:s.jsxs("div",{className:"flex items-start gap-3",children:[D(B.status),s.jsxs("div",{className:"flex-1 min-w-0 space-y-1.5",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("p",{className:"font-medium text-sm truncate max-w-[200px] sm:max-w-none",children:B.subject}),R(B.email_type)]}),s.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:["→ ",B.recipient_email]}),B.error_message&&s.jsxs("div",{className:"flex items-start gap-1.5 mt-2 p-2 bg-red-500/10 rounded border border-red-500/20",children:[s.jsx(El,{className:"w-3.5 h-3.5 text-red-400 flex-shrink-0 mt-0.5"}),s.jsx("p",{className:"text-xs text-red-400 break-all",children:B.error_message})]})]}),s.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground whitespace-nowrap flex-shrink-0",children:Ze(ne
2734w Date(B.created_at),"dd MMM HH:mm",{locale:pt})})]})},B.id))})})]})]}),s.jsx(Sn,{value:"stats",className:"mt-6",children:s.jsx(g1t,{logs:E||[],isLoading:S})})]}),s.jsx(ffe,{template:a,open:l,onOpenChange:c}),s.jsx(p1t,{template:f,open:u,onOpenChange:d}),s.jsx(x1t,{open:w,onOpenChange:_,result:y,isSending:p,onConfirmSend:()=>{_(!1),j(!1)}})]})}function b1t(e){const t=e.replace(/\r/g,"").split(`
2735`).filter(a=>a.trim().length);if(!t.length)return[];const n=t[0].includes(";")&&!t[0].includes(",")?";":",",r=a=>{const o=[];let l="",c=!1;for(let u=0;u<a.length;u++){const d=a[u];d==='"'?c&&a[u+1]==='"'?(l+='"',u++):c=!c:d===n&&!c?(o.push(l),l=""):l+=d}return o.push(l),o.map(u=>u.trim())},i=r(t[0]).map(a=>a.toLowerCase().replace(/^"|"$/g,""));return t.slice(1).map(a=>{const o=r(a),l={};return i.forEach((c,u)=>l[c]=(o[u]??"").replace(/^"|"$/g,"")),l})}function w1t(e){if(!e.length)return"";const t=Object.keys(e[0]),n=r=>{const i=r==null?"":String(r);return/[",\n;]/.test(i)?`"${i.replace(/"/g,'""')}"`:i};return[t.join(","),...e.map(r=>t.map(i=>n(r[i])).join(","))].join(`
2736`)}function _1t(){const{data:e=[],isLoading:t}=rAe(),n=sAe(),r=iAe(),{toast:i}=_r(),[a,o]=N.useState(""),[l,c]=N.useState("all"),[u,d]=N.useState("all"),[f,h]=N.useState(!1),[p,x]=N.useState([]),[y,b]=N.useState(0),[w,_]=N.useState(!1),j=N.useRef(null),E=N.useMemo(()=>{const R=new Set(e.map(L=>L.source));return Array.from(R).sort()},[e]),S=N.useMemo(()=>e.filter(R=>{if(l!=="all"&&R.status!==l||u!=="all"&&R.source!==u)return!1;if(!a.trim())return!0;const L=a.toLowerCase();return R.email.toLowerCase().includes(L)||(R.first_name??"").toLowerCase().includes(L)||(R.last_name??"").toLowerCase().includes(L)}),[e,a,l,u]),T=N.useMemo(()=>{const R=Date.now(),L=R-7*864e5,M=R-30*864e5,B=e.filter(U=>U.status==="subscribed");return{total:B.length,last7:B.filter(U=>new Date(U.created_at).getTime()>=L).length,last30:B.filter(U=>new Date(U.created_at).getTime()>=M).length,withAccount:B.filter(U=>!!U.user_id).length,unsubscribed:e.filter(U=>U.status==="unsubscribed").length}},[e]),P=R=>{const L=R==="active"?e.filter(H=>H.status==="subscribed"):e,M=R==="brevo"?L.filter(H=>H.status==="subscribed").map(H=>({EMAIL:H.email,FIRSTNAME:H.first_name??"",LASTNAME:H.last_name??"",SOURCE:H.source})):L.map(H=>({email:H.email,first_name:H.first_name??"",last_name:H.last_name??"",status:H.status,source:H.source,has_account:H.user_id?"yes":"no",subscribed_at:H.subscribed_at,unsubscribed_at:H.unsubscribed_at??""})),B=new Blob([w1t(M)],{type:"text/csv;charset=utf-8"}),U=URL.createObjectURL(B),F=document.createElement("a");F.href=U,F.download=`newsletter-${R}-${new Date().toISOString().slice(0,10)}.csv`,F.click(),URL.revokeObjectURL(U)},O=async R=>{var z;const L=(z=R.target.files)==null?void 0:z[0];if(!L)return;const M=await L.text(),B=b1t(M),U=/^[^@\s]+@[^@\s]+\.[^@\s]+$/,F=[];let H=0;for(const K of B){const W=(K.email||K.mail||K["e-mail"]||"").trim().toLowerCase();if(!U.test(W)){H++;continue}F.push({email:W,first_name:K.first_name||K.firstname||K.prenom||K.prénom||void 0,last_name:K.last_name||K.lastname||K.nom||void 0})}x(F),b(H)},D=async()=>{if(p.length){_(!0);try{const{data:R,error:L}=await re.functions.invoke("admin-newsletter-import",{body:{rows:p}});if(L)throw L;i({title:"Import terminé",description:`${(R==null?void 0:R.inserted)??0} créés, ${(R==null?void 0:R.updated)??0} mis à jour, ${(R==null?void 0:R.skipped)??0} ignorés.`}),h(!1),x([]),b(0),j.current&&(j.current.value=""),window.setTimeout(()=>window.location.reload(),300)}catch(R){i({title:"Erreur d'import",description:R instanceof Error?R.message:"Inconnue",variant:"destructive"})}finally{_(!1)}}};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-end gap-2 flex-wrap",children:[s.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>P("active"),children:[s.jsx(mc,{className:"w-4 h-4 mr-2"})," Export actifs"]}),s.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>P("all"),children:[s.jsx(mc,{className:"w-4 h-4 mr-2"})," Export complet"]}),s.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>P("brevo"),children:[s.jsx(mc,{className:"w-4 h-4 mr-2"})," Export Brevo"]}),s.jsxs(Q,{size:"sm",onClick:()=>h(!0),children:[s.jsx(a2,{className:"w-4 h-4 mr-2"})," Importer CSV"]})]}
2736),s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-3",children:[{label:"Inscrits actifs",value:T.total},{label:"Avec compte",value:T.withAccount},{label:"+ 7j",value:T.last7},{label:"+ 30j",value:T.last30},{label:"Désinscrits",value:T.unsubscribed}].map(R=>s.jsx(Se,{children:s.jsxs(De,{className:"p-4",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:R.label}),s.jsx("p",{className:"text-2xl font-bold tabular-nums",children:R.value})]})},R.label))}),s.jsxs(Se,{children:[s.jsx(kt,{className:"pb-3",children:s.jsxs(Et,{className:"text-base",children:["Inscrits (",S.length,")"]})}),s.jsxs(De,{children:[s.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(_o,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),s.jsx(Ue,{value:a,onChange:R=>o(R.target.value),placeholder:"Rechercher email, prénom, nom...",className:"pl-9"})]}),s.jsxs("select",{value:l,onChange:R=>c(R.target.value),className:"h-10 rounded-md border border-input bg-background px-3 text-sm",children:[s.jsx("option",{value:"all",children:"Tous statuts"}),s.jsx("option",{value:"subscribed",children:"Actifs"}),s.jsx("option",{value:"unsubscribed",children:"Désinscrits"})]}),s.jsxs("select",{value:u,onChange:R=>d(R.target.value),className:"h-10 rounded-md border border-input bg-background px-3 text-sm",children:[s.jsx("option",{value:"all",children:"Toutes sources"}),E.map(R=>s.jsx("option",{value:R,children:R},R))]})]}),s.jsx("div",{className:"border rounded-md overflow-hidden",children:s.jsxs(dh,{children:[s.jsx(fh,{children:s.jsxs(Ls,{children:[s.jsx(ln,{children:"Email"}),s.jsx(ln,{children:"Nom"}),s.jsx(ln,{children:"Compte"}),s.jsx(ln,{children:"Source"}),s.jsx(ln,{children:"Date"}),s.jsx(ln,{children:"Statut"}),s.jsx(ln,{className:"text-right",children:"Actions"})]})}),s.jsx(hh,{children:t?s.jsx(Ls,{children:s.jsx(Lt,{colSpan:7,className:"text-center text-muted-foreground py-8",children:"Chargement..."})}):S.length===0?s.jsx(Ls,{children:s.jsx(Lt,{colSpan:7,className:"text-center text-muted-foreground py-8",children:"Aucun inscrit."})}):S.map(R=>s.jsxs(Ls,{children:[s.jsx(Lt,{className:"font-medium",children:R.email}),s.jsx(Lt,{children:[R.first_name,R.last_name].filter(Boolean).join(" ")||"—"}),s.jsx(Lt,{children:R.user_id?s.jsx(we,{variant:"default",className:"bg-[#AAFF00] text-[#0D0D0D]",children:"oui"}):s.jsx(we,{variant:"outline",children:"prospect"})}),s.jsx(Lt,{children:s.jsx(we,{variant:"outline",children:R.source})}),s.jsx(Lt,{className:"text-sm text-muted-foreground",children:new Date(R.created_at).toLocaleDateString("fr-FR")}),s.jsx(Lt,{children:s.jsx(we,{variant:R.status==="subscribed"?"default":"secondary",children:R.status==="subscribed"?"Actif":"Désinscrit"})}),s.jsxs(Lt,{className:"text-right",children:[s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>r.mutate({id:R.id,status:R.status==="subscribed"?"unsubscribed":"subscribed"}),children:R.status==="subscribed"?"Désinscrire":"Réactiver"}),s.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{confirm(`Supprimer ${R.email} ?`)&&n.mutate(R.id)},children:s.jsx(ua,{className:"w-4 h-4 text-destructive"})})]})]},R.id))})]})})]})]}),s.jsx(Ln,{open:f,onOpenChange:h,children:s.jsxs(Dn,{children:[s.jsxs(Un,{children:[s.jsx(qn,{children:"Importer des inscrits"}),s.jsxs(qr,{children:["Fichier CSV avec colonnes : ",s.jsx("code",{children:"email"})," (obligatoire),"," ",s.jsx("code",{children:"first_name"}),", ",s.jsx("code",{children:"last_name"}),"."]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("input",{ref:j,type:"file",accept:".csv,text/csv",onChange:O,className:"block w-full text-sm"}),(p.length>0||y>0)&&s.jsxs("div",{className:"rounded-md border p-3 text-sm bg-muted/30",children:[s.jsxs("p",{children:[s.jsx("strong",{children:p.length})," emails valides",y>0&&s.jsxs(s.Fragment,{children:[", ",s.jsx("span",{className:"text-destructive",children:y})," invalides ignorés"]})]}),p.length>0&&s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Aperçu : ",p.slice(0,3).map(R=>R.email).join(", "),p.length>3&&"..."]})]})]}),s.jsxs(Pi,{children:[s.jsx(Q,{variant:"outline",onClick:()=>h(!1),children:"Annuler"}),s.jsx(Q,{onClick:D,disabled:!p.length||w,children:w?"Import...":`Importer ${p.length} contacts`})]})]})})]})}const j1t=`<div style="font-family:system-ui,sans-serif;max-width:560px;margin:0 auto;color:#0D0D0D">
2737  <h1 style="font-family:'Playfair Display',serif;font-style:italic;font-size:32px;margin:0 0 12px">
2738    Bonjour {{first_name}},
2739  </h1>
2740  <p style="line-height:1.6;font-size:15px">
2741    Voici les prochains tournois Chess Agenda…
2742  </p>
2743  <p style="margin-top:24px">
2744    <a href="https://chessagenda.com/events"
2745       style="display:inline-block;background:#AAFF00;color:#0D0D0D;padding:12px 24px;
2746              border-radius:999px;text-decoration:none;font-weight:700">
2747      Voir les tournois
2748    </a>
2749  </p>
2750</div>`,vW={subject:"",preheader:"",html_content:j1t,source_filter:"",since:""};function N1t(){const{data:e=[],isLoading:t}=aAe(),n=oAe(),r=cAe(),i=lAe(),[a,o]=N.useState(!1),[l,c]=N.useState(vW),[u,d]=N.useState(null),[f,h]=N.useState(null),[p,x]=N.useState(""),[y,b]=N.useState(null),w=uAe({source:l.source_filter||void 0,since:l.since||void 0}),_=()=>{c(vW),o(!0)},j=T=>{const P=T.audience_filter??{};c({id:T.id,subject:T.subject,preheader:T.preheader??"",html_content:T.html_content,source_filter:P.source??"",since:P.since??""}),o(!0)},E=async()=>{if(!l.subject.trim()||!l.html_content.trim())return;const T={};l.source_filter&&(T.source=l.source_filter),l.since&&(T.since=l.since);const P=await n.mutateAsync({id:l.id,subject:l.subject.trim(),preheader:l.preheader.trim()||void 0,html_content:l.html_content,audience_filter:T});c(O=>({...O,id:P.id}))},S=async()=>{await E(),o(!1)};return s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"flex items-center justify-end",children:s.jsxs(Q,{onClick:_,children:[s.jsx(qa,{className:"w-4 h-4 mr-2"})," Nouvelle campagne"]})}),s.jsxs(Se,{children:[s.jsx(kt,{className:"pb-3",children:s.jsxs(Et,{className:"text-base",children:["Campagnes (",e.length,")"]})}),s.jsx(De,{children:s.jsx("div",{className:"border rounded-md overflow-hidden",children:s.jsxs(dh,{children:[s.jsx(fh,{children:s.jsxs(Ls,{children:[s.jsx(ln,{children:"Sujet"}),s.jsx(ln,{children:"Statut"}),s.jsx(ln,{children:"Destinataires"}),s.jsx(ln,{children:"Envoyée"}),s.jsx(ln,{className:"text-right",children:"Actions"})]})}),s.jsx(hh,{children:t?s.jsx(Ls,{children:s.jsx(Lt,{colSpan:5,className:"text-center text-muted-foreground py-8",children:"Chargement..."})}):e.length===0?s.jsx(Ls,{children:s.jsx(Lt,{colSpan:5,className:"text-center text-muted-foreground py-8",children:"Aucune campagne. Créez-en une !"})}):e.map(T=>s.jsxs(Ls,{children:[s.jsx(Lt,{className:"font-medium max-w-md truncate",children:T.subject}),s.jsx(Lt,{children:s.jsx(we,{variant:T.status==="sent"?"default":T.status==="failed"?"destructive":T.status==="sending"?"secondary":"outline",children:T.status})}),s.jsx(Lt,{className:"tabular-nums text-sm",children:T.recipient_count||"—"}),s.jsx(Lt,{className:"text-sm text-muted-foreground",children:T.sent_at?new Date(T.sent_at).toLocaleString("fr-FR"):"—"}),s.jsxs(Lt,{className:"text-right space-x-1",children:[s.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>b(T),title:"Prévisualiser",children:s.jsx(go,{className:"w-4 h-4"})}),T.status!=="sent"&&s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>j(T),title:"Éditer",children:s.jsx(Zge,{className:"w-4 h-4"})}),s.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{x(""),h(T.id)},title:"Envoyer un test",children:s.jsx(jxe,{className:"w-4 h-4"})}),s.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>d(T.id),title:"Envoyer",children:s.jsx(ca,{className:"w-4 h-4 text-[#0D0D0D]"})})]}),s.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{confirm(`Supprimer la campagne "${T.subject}" ?`)&&i.mutate(T.id)},title:"Supprimer",children:s.jsx(ua,{className:"w-4 h-4 text-destructive"})})]})]},T.id))})]})})})]}),s.jsx(Ln,{open:a,onOpenChange:o,children:s.jsxs(Dn,{className:"max-w-5xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(Un,{children:[s.jsx(qn,{children:l.id?"Éditer la campagne":"Nouvelle campagne"}),s.jsxs(qr,{children:["Variables disponibles :"," ",s.jsx("code",{children:"{{first_name}}"}),","," ",s.jsx("code",{children:"{{email}}"}),","," ",s.jsx("code",{children:"{{unsubscribe_url}}"}),". Un lien de désabonnement sera ajouté automatiquement s'il manque."]})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx(Fe,{children:"Sujet"}),s.jsx(Ue,{value:l.subject,onChange:T=>c({...l,subject:T.target.value}),placeholder:"Les tournois de novembre à Paris",maxLength:140})]}),s.jsxs("div",{children:[s.jsx(Fe,{children:"Préheader (aperçu)"}
2750),s.jsx(Ue,{value:l.preheader,onChange:T=>c({...l,preheader:T.target.value}),placeholder:"4 nouveaux lieux, 12 dates…",maxLength:200})]}),s.jsxs("div",{children:[s.jsx(Fe,{children:"Contenu HTML"}),s.jsx($s,{value:l.html_content,onChange:T=>c({...l,html_content:T.target.value}),rows:16,className:"font-mono text-xs"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx(Fe,{children:"Source (facultatif)"}),s.jsx(Ue,{value:l.source_filter,onChange:T=>c({...l,source_filter:T.target.value}),placeholder:"ex: footer-events"})]}),s.jsxs("div",{children:[s.jsx(Fe,{children:"Inscrits depuis (facultatif)"}),s.jsx(Ue,{type:"date",value:l.since,onChange:T=>c({...l,since:T.target.value})})]})]}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Audience estimée :"," ",s.jsxs("strong",{className:"text-foreground",children:[w.data??"…"," inscrit·e·s"]})]})]}),s.jsxs("div",{children:[s.jsx(Fe,{children:"Prévisualisation"}),s.jsx("div",{className:"border rounded-md p-4 bg-white min-h-[300px] max-h-[500px] overflow-auto",children:s.jsx("iframe",{title:"preview",srcDoc:l.html_content,className:"w-full min-h-[480px] border-0"})})]})]}),s.jsxs(Pi,{children:[s.jsx(Q,{variant:"outline",onClick:()=>o(!1),children:"Fermer"}),s.jsx(Q,{variant:"outline",onClick:E,disabled:n.isPending,children:"Enregistrer"}),s.jsx(Q,{onClick:S,disabled:n.isPending,children:"Enregistrer et fermer"})]})]})}),s.jsx(Ln,{open:!!f,onOpenChange:T=>!T&&h(null),children:s.jsxs(Dn,{children:[s.jsxs(Un,{children:[s.jsx(qn,{children:"Envoyer un email de test"}),s.jsx(qr,{children:"L'email sera envoyé avec le sujet préfixé par [TEST]."})]}),s.jsxs("div",{children:[s.jsx(Fe,{children:"Adresse de test"}),s.jsx(Ue,{type:"email",value:p,onChange:T=>x(T.target.value),placeholder:"[email protected]"})]}),s.jsxs(Pi,{children:[s.jsx(Q,{variant:"outline",onClick:()=>h(null),children:"Annuler"}),s.jsx(Q,{onClick:async()=>{f&&(await r.mutateAsync({campaign_id:f,test_only:!0,test_email:p||void 0}),h(null))},disabled:r.isPending,children:r.isPending?"Envoi…":"Envoyer le test"})]})]})}),s.jsx(yr,{open:!!u,onOpenChange:T=>!T&&d(null),children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Envoyer cette campagne ?"}),s.jsx(lr,{children:"L'envoi démarre immédiatement à tous les inscrits ciblés. Cette action est irréversible."})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsx(vr,{onClick:async()=>{u&&(await r.mutateAsync({campaign_id:u}),d(null))},children:"Envoyer maintenant"})]})]})}),s.jsx(Ln,{open:!!y,onOpenChange:T=>!T&&b(null),children:s.jsxs(Dn,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(Un,{children:[s.jsx(qn,{children:y==null?void 0:y.subject}),(y==null?void 0:y.preheader)&&s.jsx(qr,{children:y.preheader})]}),s.jsx("div",{className:"border rounded-md bg-white p-4",children:s.jsx("iframe",{title:"campaign-preview",srcDoc:(y==null?void 0:y.html_content)??"",className:"w-full min-h-[480px] border-0"})})]})})]})}function k1t(){return s.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"font-display text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[s.jsx(wr,{className:"w-6 h-6"})," Newsletter"]}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Gérer les inscrits et envoyer des campagnes."})]}),s.jsxs(Ka,{defaultValue:"subscribers",className:"w-full",children:[s.jsxs(Ca,{children:[s.jsx(vn,{value:"subscribers",children:"Inscrits"}),s.jsx(vn,{value:"campaigns",children:"Campagnes"})]}),s.jsx(Sn,{value:"subscribers",className:"mt-6",children:s.jsx(_1t,{})}),s.jsx(Sn,{value:"campaigns",className:"mt-6",children:s.jsx(N1t,{})})]})]})}const Ij={"80f3e7e6-49bf-4bb8-a9f6-9ab4a3bd6f15":"natale","088153e5-6d2c-4645-93dc-746c79f1629e":"Kevin","ad2a9613-5c84-4462-8cdf-d01f5c27f196":"Augustin","530cb4db-0c86-4f58-9a18-a33e7b9c3fed":"Marc","cdfd136a-08f0-4688-a10b-9c639263b716":"Dany","2814fa52-dd47-4ddd-9bf8-e111d79318c2":"Maxime","195e2cfe-b4f0-4f30-8469-4082dc855c16":"Edouard","75fb4760-e7c4-4fe7-b962-997991345402":"Pierre-alexis","c875f867-d2ce-40ea-a20c-ad6cde24bb14":"Jacques","ca65f41e-b79a-4541-b34d-2cb77f05ebb4":"Tancrède","f8baae4b-781d-4d37-943a-48157b1c95e5":"Judith","69e570e2-fc36-496a-a48c-67a428f95d7b":"Vinz","d92104db-21b3-42f3-86f0-66df
2750ccf762c6":"Grégoire","6aabb557-7ff5-430e-bb25-77bc7a9427a3":"César"},Tfe=Object.keys(Ij),C1t=Object.fromEntries(Tfe.map(e=>[e,e==="80f3e7e6-49bf-4bb8-a9f6-9ab4a3bd6f15"?2e3:1200])),E1t=[{white_player_id:"80f3e7e6-49bf-4bb8-a9f6-9ab4a3bd6f15",black_player_id:"088153e5-6d2c-4645-93dc-746c79f1629e",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"ad2a9613-5c84-4462-8cdf-d01f5c27f196",black_player_id:"530cb4db-0c86-4f58-9a18-a33e7b9c3fed",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"cdfd136a-08f0-4688-a10b-9c639263b716",black_player_id:"2814fa52-dd47-4ddd-9bf8-e111d79318c2",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"195e2cfe-b4f0-4f30-8469-4082dc855c16",black_player_id:"75fb4760-e7c4-4fe7-b962-997991345402",is_bye:!1,result:"draw",round_number:1},{white_player_id:"c875f867-d2ce-40ea-a20c-ad6cde24bb14",black_player_id:"ca65f41e-b79a-4541-b34d-2cb77f05ebb4",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"f8baae4b-781d-4d37-943a-48157b1c95e5",black_player_id:"69e570e2-fc36-496a-a48c-67a428f95d7b",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"d92104db-21b3-42f3-86f0-66dfccf762c6",black_player_id:"6aabb557-7ff5-430e-bb25-77bc7a9427a3",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"088153e5-6d2c-4645-93dc-746c79f1629e",black_player_id:"cdfd136a-08f0-4688-a10b-9c639263b716",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"530cb4db-0c86-4f58-9a18-a33e7b9c3fed",black_player_id:"d92104db-21b3-42f3-86f0-66dfccf762c6",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"69e570e2-fc36-496a-a48c-67a428f95d7b",black_player_id:"c875f867-d2ce-40ea-a20c-ad6cde24bb14",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"75fb4760-e7c4-4fe7-b962-997991345402",black_player_id:"80f3e7e6-49bf-4bb8-a9f6-9ab4a3bd6f15",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"6aabb557-7ff5-430e-bb25-77bc7a9427a3",black_player_id:"195e2cfe-b4f0-4f30-8469-4082dc855c16",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"2814fa52-dd47-4ddd-9bf8-e111d79318c2",black_player_id:"ad2a9613-5c84-4462-8cdf-d01f5c27f196",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"ca65f41e-b79a-4541-b34d-2cb77f05ebb4",black_player_id:"f8baae4b-781d-4d37-943a-48157b1c95e5",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"c875f867-d2ce-40ea-a20c-ad6cde24bb14",black_player_id:"088153e5-6d2c-4645-93dc-746c79f1629e",is_bye:!1,result:"black_wins",round_number:3},{white_player_id:"195e2cfe-b4f0-4f30-8469-4082dc855c16",black_player_id:"530cb4db-0c86-4f58-9a18-a33e7b9c3fed",is_bye:!1,result:"black_wins",round_number:3},{white_player_id:"80f3e7e6-49bf-4bb8-a9f6-9ab4a3bd6f15",black_player_id:"2814fa52-dd47-4ddd-9bf8-e111d79318c2",is_bye:!1,result:"black_wins",round_number:3},{white_player_id:"cdfd136a-08f0-4688-a10b-9c639263b716",black_player_id:"ca65f41e-b79a-4541-b34d-2cb77f05ebb4",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"d92104db-21b3-42f3-86f0-66dfccf762c6",black_player_id:"69e570e2-fc36-496a-a48c-67a428f95d7b",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"ad2a9613-5c84-4462-8cdf-d01f5c27f196",black_player_id:"75fb4760-e7c4-4fe7-b962-997991345402",is_bye:!1,result:"black_wins",round_number:3},{white_player_id:"f8baae4b-781d-4d37-943a-48157b1c95e5",black_player_id:"6aabb557-7ff5-430e-bb25-77bc7a9427a3",is_bye:!1,result:"black_wins",round_number:3},{white_player_id:"088153e5-6d2c-4645-93dc-746c79f1629e",black_player_id:"530cb4db-0c86-4f58-9a18-a33e7b9c3fed",is_bye:!1,result:"black_wins",round_number:4},{white_player_id:"c875f867-d2ce-40ea-a20c-ad6cde24bb14",black_player_id:"cdfd136a-08f0-4688-a10b-9c639263b716",is_bye:!1,result:"white_wins",round_number:4},{white_player_id:"2814fa52-dd47-4ddd-9bf8-e111d79318c2",black_player_id:"d92104db-21b3-42f3-86f0-66dfccf762c6",is_bye:!1,result:"draw",round_number:4},{white_player_id:"6aabb557-7ff5-430e-bb25-77bc7a9427a3",black_player_id:"75fb4760-e7c4-4fe7-b962-997991345402",is_bye:!1,result:"black_wins",round_number:4},{white_player_id:"ca65f41e-b79a-4541-b34d-2cb77f05ebb4",black_player_id:"195e2cfe-b4f0-4f30-8469-4082dc855c16",is_bye:!1,result:"black_wins",round_number:4},{white_player_id:"69e570e2-fc36-496a-a48c-67a428f95d7b",black_player_id:"80f3e7e6-49bf-4bb8-a9f6-9ab4a3bd6f15",is_bye:!1,result:"black_wins",round_number:4},{white_player_id:"f8baae4b-781d-4d37-943a-48157b1c95e5",black_player_id:"ad2a9613-5c84-4462-8cdf-d01f5c27f196",is_bye:!1,result:"black_wins",round_number:4}];function Pc(){return Array.from({length:8},(e,t)=>`player-${t+1}`)}function Oc(e){const t=new Map;return e.forEach(n=>t.set(n,1200)),t}function Dc(e){const t=new Map;return e.forEach((n,r)=>t.set(n,`Joueur ${r+1}`)),t}function Ih(e){return parseInt(e.split("-")[1],10)}function ys(e){return Array.from({length:e},(t,n)=>`p${n+1}`)}function Kr(e,t){const n=new Map;return e.forEach((r,i)=>n.set(r,t[i]??1200)),n}function Yr(e){const t=new Map;return e.forEach((n,r)=>t.set(n,`Player ${r+1}`)),t}function d3(e,t,n){return e.find(r=>{const i=[r.whitePlayerId,r.blackPlayerId].sort(),a=[t,n].sort();return i[0]===a[0]&&i[1]===a[1]})}function bW(e){return e.map(t=>`${t.whitePlayerId}(B) vs ${t.blackPlayerId}(N)`).join(", ")}const Ig=[{white_player_id:"player-1",black_player_id:"player-5",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"player-6",black_player_id:"player-2",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"player-3",black_player_id:"player-7",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"player-8",black_player_id:"player-4",is_bye:!1,result:"black_wins",round_number:1}],zv=[{white_player_id:"player-4",black_player_id:"player-1",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"player-2",black_player_id:"player-3",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"player-5",black_player_id:"player-8",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"player-7",black_player_id:"player-6",is_bye:!1,result:"white_wins",round_number:2}],pk=[{white_player_id:"player-1",black_player_id:"player-3",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"player-5",black_player_id:"player-2",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"player-7",black_player_id:"player-4",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"player-8",black_player_id:"player-6",is_bye:!1,result:"white_wins",round_number:3}],ZO=[{white_player_id:"player-2",black_player_id:"player-1",is_bye:!1,result:"draw",round_number:4},{white_player_id:"player-3",black_player_id:"player-5",is_bye:!1,result:"white_wins",round_number:4},{white_player_id:"player-4",black_player_id:"player-6",is_bye:!1,result:"draw",round_number:4},{white_player_id:"player-8",black_player_id:"player-7",is_bye:!1,result:"white_wins",round_number:4}];function Mn(e,t,n){return{passed:e,expected:t,actual:n}}const U8=[{name:"R1 : appariements et couleurs E.5",category:"8 joueurs même Elo",rule:"E.5",de
2750scription:"8 joueurs avec Elo identique (1200), première ronde. Le moteur doit diviser en S1 (J1-J4) et S2 (J5-J8), apparier S1[i] vs S2[i], et attribuer les blancs à S1 (règle E.5).",setup:"8 joueurs : J1-J8, tous à 1200 Elo, aucun historique",expectedDetail:"J1(B) vs J5(N), J2(B) vs J6(N), J3(B) vs J7(N), J4(B) vs J8(N) — S1 joue blancs",fideReference:"FIDE C.04.3 §E.5 — En R1, le joueur de S1 reçoit les blancs",coveredRules:["A.2","C.4","C.6","E.5"],run:()=>{const e=Pc(),t=fn(e,[],Oc(e),1,Dc(e)),r=yn(t,1).pairings.filter(a=>!a.isBye);if(r.length!==4)return Mn(!1,"4 parties",`${r.length} parties`);const i=r.find(a=>Ih(a.whitePlayerId)===1&&Ih(a.blackPlayerId)===5||Ih(a.whitePlayerId)===5&&Ih(a.blackPlayerId)===1);return i?Mn(Ih(i.whitePlayerId)===1,"J1 blancs",`J${Ih(i.whitePlayerId)} blancs`):Mn(!1,"J1 vs J5","non trouvé")}},{name:"R2 : 8 joueurs appariés",category:"8 joueurs même Elo",rule:"C.6",description:"Après R1, les 4 gagnants (J1,J2,J3,J4 à 1pt) forment le bracket haut, les 4 perdants (J5,J6,J7,J8 à 0pt) le bracket bas. Chaque bracket doit produire 2 parties sans rematch.",setup:"R1: J1>J5, J2>J6, J3>J7, J4>J8 — Scores: J1-J4=1pt, J5-J8=0pt",expectedDetail:"4 parties, 8 joueurs appariés, aucun rematch avec R1",fideReference:"FIDE C.04.3 §C.6 — Chaque bracket est apparié par S1/S2 split avec respect C.1 (pas de rematch)",coveredRules:["A.1","B.1","C.1","C.6"],run:()=>{const e=Pc(),t=fn(e,Ig,Oc(e),2,Dc(e)),r=yn(t,2).pairings.filter(a=>!a.isBye),i=new Set;return r.forEach(a=>{i.add(a.whitePlayerId),i.add(a.blackPlayerId)}),Mn(r.length===4&&i.size===8,"4 parties, 8 joueurs",`${r.length} parties, ${i.size} joueurs`)}},{name:"R3 : J1 vs J3 dans bracket 2 pts",category:"8 joueurs même Elo",rule:"C.6",description:"Après R2, J1 et J3 sont à 2pts dans le bracket supérieur. Ils doivent être appariés ensemble car ils ne se sont jamais rencontrés.",setup:"R1+R2 joués — Scores: J1=2, J3=2, J5=1, J7=1, J2=1, J4=1, J6=0, J8=0",expectedDetail:"J1 vs J3 dans le bracket 2pts — S1/S2 naturel",fideReference:"FIDE C.04.3 §C.6 — Appariement naturel dans bracket homogène",coveredRules:["A.1","C.4","C.6"],run:()=>{const e=Pc(),t=fn(e,[...Ig,...zv],Oc(e),3,Dc(e)),i=yn(t,3).pairings.filter(a=>!a.isBye).find(a=>{const o=[a.whitePlayerId,a.blackPlayerId].sort();return o[0]==="player-1"&&o[1]==="player-3"});return Mn(!!i,"J1 vs J3",i?"J1 vs J3":"non trouvé")}},{name:"R4 : cascade de flotteurs (appariements + couleurs)",category:"8 joueurs même Elo",rule:"B.5/B.6",description:"R4 avec scores hétérogènes (3/2/2/2/1/1/1/0). J1 seul à 3pts doit descendre au bracket 2pts. Cascade complexe de flotteurs avec contraintes B.5/B.6.",setup:"Après R3: J1=3, J3=2, J5=2, J7=2, J2=1, J4=1, J8=1, J6=0",expectedDetail:"J1(B) vs J7(N), J3(B) vs J5(N), J2(B) vs J8(N), J6(B) vs J4(N)",fideReference:"FIDE C.04.3 §B.5/B.6 — Contraintes de flottement : pas de float dans la même direction que les 2 rondes précédentes (B.5) ou la ronde précédente (B.6)",coveredRules:["A.3","B.5","B.6","C.6","D.3"],run:()=>{const e=Pc(),t=fn(e,[...Ig,...zv,...pk],Oc(e),4,Dc(e)),r=yn(t,4).pairings.filter(l=>!l.isBye);if(r.length!==4)return Mn(!1,"4 parties",`${r.length}`);const i=[{white:"player-1",black:"player-7"},{white:"player-3",black:"player-5"},{white:"player-2",black:"player-8"},{white:"player-6",black:"player-4"}],a=i.filter(l=>!r.find(c=>c.whitePlayerId===l.white&&c.blackPlayerId===l.black)),o=bW(r);
2750return Mn(a.length===0,i.map(l=>`${l.white}(B) vs ${l.black}(N)`).join(", "),a.length>0?`Manquant: ${a.map(l=>`${l.white} vs ${l.black}`).join(", ")} | Obtenu: ${o}`:"OK")}},{name:"R5 : règle E.4 couleurs",category:"8 joueurs même Elo",rule:"E.4",description:"R5 avec scores très hétérogènes. Les règles E.4 (alternance couleur) et E.1-E.3 (hiérarchie de préférence) doivent produire les bonnes attributions blanc/noir.",setup:"Après R4: J1=3.5, J3=3, J5=2, J7=2, J8=2, J2=1.5, J4=1.5, J6=0.5",expectedDetail:"J1(B) vs J7(N), J3(B) vs J8(N), J6(B) vs J5(N), J4(B) vs J2(N) — PSD min lex",fideReference:"FIDE C.04.3 §E.1-E.4 + §C.7-C.9 (PSD lex)",coveredRules:["E.1","E.2","E.3","E.4"],run:()=>{const e=Pc(),t=fn(e,[...Ig,...zv,...pk,...ZO],Oc(e),5,Dc(e)),r=yn(t,5).pairings.filter(l=>!l.isBye);if(r.length!==4)return Mn(!1,"4 parties",`${r.length}`);const i=[{white:"player-1",black:"player-7"},{white:"player-3",black:"player-8"},{white:"player-6",black:"player-5"},{white:"player-4",black:"player-2"}],a=i.filter(l=>!r.find(c=>c.whitePlayerId===l.white&&c.blackPlayerId===l.black)),o=bW(r);
2750return Mn(a.length===0,i.map(l=>`${l.white}(B) vs ${l.black}(N)`).join(", "),a.length>0?`Manquant: ${a.map(l=>`${l.white} vs ${l.black}`).join(", ")} | Obtenu: ${o}`:"OK")}},{name:"Tables contiguës",category:"8 joueurs même Elo",rule:"D.9",description:"Vérifie que les numéros de table sont assignés de manière contiguë (1, 2, 3, 4) conformément à la règle D.9.",setup:"8 joueurs R1 — vérification des numéros de table uniquement",expectedDetail:"Tables [1, 2, 3, 4] assignées séquentiellement",fideReference:"FIDE C.04.3 §D.9 — Les numéros de table sont continus à partir de 1",coveredRules:["D.9"],run:()=>{const e=Pc(),t=fn(e,[],Oc(e),1,Dc(e)),r=yn(t,1).pairings.filter(i=>!i.isBye).map(i=>i.tableNumber).sort((i,a)=>i-a);return Mn(JSON.stringify(r)===JSON.stringify([1,2,3,4]),"[1,2,3,4]",JSON.stringify(r))}},{name:"A1 : 7 joueurs R1 — bye au plus bas",category:"Bye & Joueurs impairs",rule:"C.2",description:"Avec un nombre impair de joueurs (7), le joueur avec le TPN le plus bas (classement le plus faible) reçoit le bye. Cela garantit l'équité.",setup:"7 joueurs : p1(1800) à p7(1200), Elo décroissant, R1",expectedDetail:"3 parties + 1 bye attribué à p7 (Elo le plus bas)",fideReference:"FIDE C.04.3 §C.2 — Le bye est attribué au joueur ayant le TPN le plus bas dans le bracket le plus bas",coveredRules:["C.2"],run:()=>{const e=ys(7),n=fn(e,[],Kr(e,[1800,1700,1600,1500,1400,1300,1200]),1,Yr(e)),r=yn(n,1),i=r.pairings.filter(o=>!o.isBye),a=r.pairings.filter(o=>o.isBye);return i.length!==3||a.length!==1?Mn(!1,"3 parties + 1 bye",`${i.length} parties + ${a.length} byes`):Mn(a[0].whitePlayerId==="p7","bye → p7",`bye → ${a[0].whitePlayerId}`)}},{name:"A2 : 9 joueurs R2 — pas de double bye",category:"Bye & Joueurs impairs",rule:"C.2",description:"Un joueur ne peut pas recevoir le bye deux fois. p9 a eu le bye en R1, donc en R2 le bye doit aller à un autre joueur.",setup:"9 joueurs, R2 — p9 a reçu le bye en R1. Scores: p1-p4=1pt, p5-p8=0pt, p9=1pt(bye)",expectedDetail:"4 parties + 1 bye ≠ p9",fideReference:"FIDE C.04.3 §C.2 — Un joueur ne peut recevoir qu'un seul bye dans le tournoi",coveredRules:["C.2"],run:()=>{var o;const e=ys(9),r=fn(e,[{white_player_id:"p1",black_player_id:"p5",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p6",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p3",black_player_id:"p7",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p8",black_player_id:"p4",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p9",black_player_id:null,is_bye:!0,result:"white_wins",round_number:1}],Kr(e,[1800,1750,1700,1650,1600,1550,1500,1450,1400]),2,Yr(e)),a=yn(r,2).pairings.filter(l=>l.isBye);return Mn(a.length===1&&a[0].whitePlayerId!=="p9","bye ≠ p9",`bye → ${((o=a[0])==null?void 0:o.whitePlayerId)??"aucun"}`)}},{name:"B1 : 10 joueurs Elo distincts — split S1/S2 correct",category:"TPN par classement",rule:"A.2",description:"Avec 10 joueurs ayant des Elo distincts, le split S1/S2 doit séparer les 5 meilleurs (S1) des 5 moins bien classés (S2). p1(2200) doit être apparié avec p6(1700).",setup:"10 joueurs : p1(2200), p2(2100), ..., p10(1300), R1",expectedDetail:"5 parties — p1 vs p6, p2 vs p7, p3 vs p8, p4 vs p9, p5 vs p10",fideReference:"FIDE C.04.3 §A.2 — Le TPN est déterminé par le classement Elo, puis nom alphabétique, puis ID",coveredRules:["A.2","C.4","C.6"],run:()=>{const e=ys(10),n=fn(e,[],Kr(e,[2200,2100,2e3,1900,1800,1700,1600,1500,1400,1300]),1,Yr(e)),i=yn(n,1).pairings.filter(o=>!o.isBye),a=d3(i,"p1","p6");return Mn(i.length===5&&!!a,"5 parties, p1 vs p6",`${i.length} parties, p1vp6: ${!!a}`)}},{name:"C1 : pas de 3e couleur consécutive identique",category:"Contraintes couleur",rule:"B.2/C.4",description:"p1 a joué Blancs en R1 et R2. En R3, il a une préférence absolue pour les Noirs (règle B.2 : pas 3 fois la même couleur). Le moteur DOIT lui attribuer les Noirs.",setup:"6 joueurs, R3 — p1 a joué B,B en R1-R2 → préférence absolue Noirs",expectedDetail:"p1 joue Noirs en R3 (préférence absolue respectée)",fideReference:"FIDE C.04.3 §B.2 — Un joueur ne peut jouer la même couleur 3 fois consécutives",coveredRules:["A.7a","B.2","C.4","E.1"],run:()=>{const e=ys(6),t=[1800,1700,1600,1500,1400,1300],n=[{white_player_id:"p1",black_player_id:"p4",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p5",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p3",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:1}],r=[{white_player_id:"p1",black_player_id:"p2",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"p5",black_player_id:"p3",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p6",black_player_id:"p4",is_bye:!1,result:"black_wins",round_number:2}],i=fn(e,[...n,...r],Kr(e,t),3,Yr(e)),a=i.find(f=>f.id==="p1"),o=Vs(a),u=yn(i,3).pairings.filter(f=>!f.isBye).find(f=>f.whitePlayerId==="p1"||f.blackPlayerId==="p1"),d=(u==null?void 0:u.blackPlayerId)==="p1";return Mn(o.type==="absolute"&&o.color==="black"&&d,"p1 absolue noirs → joue noirs",`pref=${o.type}/${o.color}, noirs=${d}`)}},{name:"D1 : pas de triple downfloat (10 joueurs R3)",category:"Contraintes flotteurs",rule:"B.5",description:"Avec 10 joueurs en R3, aucun joueur ne doit flotter dans la même direction que 2 rondes auparavant (B.5). Tous les 10 joueurs doivent être appariés.",setup:"10 joueurs avec Elo distincts, R3 — Historique de flottement varié après R1-R2",expectedDetail:"≥8 joueurs appariés (10 idéal, tolérance pour conflits absolus de couleur)",fideReference:"FIDE C.04.3 §B.5 — Un joueur ne doit pas flotter dans la même direction que 2 rondes auparavant",coveredRules:["B.5","B.6"],run:()=>{const e=ys(10),t=[2e3,1900,1800,1700,1600,1500,1400,1300,1200,1100],n=[{white_player_id:"p1",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p7",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p3",black_player_id:"p8",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p9",black_player_id:"p4",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p5",black_player_id:"p10",is_bye:!1,result:"white_wins",round_number:1}],r=[{white_player_id:"p4",black_player_id:"p1",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p2",black_player_id:"p3",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p5",black_player_id:"p6",is_bye:!1,result:"draw",round_number:2},{white_player_id:"p7",black_player_id:"p9",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"p10",black_player_id:"p8",is_bye:!1,result:"black_wins",round_number:2}],i=fn(e,[...n,...r],Kr(e,t),3,Yr(e)),a=yn(i,3),o=new Set;
2750return a.pairings.forEach(l=>{o.add(l.whitePlayerId),l.blackPlayerId&&o.add(l.blackPlayerId)}),Mn(o.size>=8,"≥8 joueurs appariés",`${o.size} joueurs`)}},{name:"E1 : échange requis quand transpositions échouent",category:"Backtracking & fusion",rule:"C.12",description:"Scénario où les transpositions simples ne suffisent pas — le moteur doit effectuer un échange (C.12) pour trouver un appariement valide sans rematch.",setup:"6 joueurs avec Elo distincts, R3 — p1 a déjà joué p4 et p2, p3 a joué p6 et p3",expectedDetail:"≥2 parties sans rematch (backtracking nécessaire)",fideReference:"FIDE C.04.3 §C.12 — Si les transpositions échouent, essayer les échanges entre S1 et S2",coveredRules:["C.7","C.8","C.12"],run:()=>{const e=ys(6),t=[1800,1700,1600,1500,1400,1300],n=[{white_player_id:"p1",black_player_id:"p4",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p5",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p3",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:1}],r=[{white_player_id:"p2",black_player_id:"p1",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p4",black_player_id:"p3",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p5",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:2}],i=fn(e,[...n,...r],Kr(e,t),3,Yr(e)),o=yn(i,3).pairings.filter(d=>!d.isBye),l=new Set;o.forEach(d=>{l.add(d.whitePlayerId),l.add(d.blackPlayerId)});const c=[...n,...r],u=o.filter(d=>c.some(f=>f.white_player_id===d.whitePlayerId&&f.black_player_id===d.blackPlayerId||f.white_player_id===d.blackPlayerId&&f.black_player_id===d.whitePlayerId));return Mn(o.length>=2&&u.length===0,"≥2 parties, 0 rematch",`${o.length} parties, ${u.length} rematches`)}},{name:"F1 : forfait exclu de l'historique couleur",category:"Forfeits & cas limites",rule:"D.2/D.3",description:"Après un forfait en R1, les 8 joueurs doivent être correctement appariés en R2 sans que le forfait n'affecte les préférences de couleur.",setup:"8 joueurs avec Elo distincts, R2 — R1 joué normalement (pas de forfait réel dans ce test, vérifie la robustesse)",expectedDetail:"4 parties, 8 joueurs appariés",fideReference:"FIDE C.04.3 §D.2/D.3 — Les parties non jouées (forfeits) n'affectent pas l'historique de couleur",coveredRules:["D.2","D.3"],run:()=>{const e=ys(8),r=fn(e,[{white_player_id:"p1",black_player_id:"p5",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p6",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p3",black_player_id:"p7",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p8",black_player_id:"p4",is_bye:!1,result:"black_wins",round_number:1}],Kr(e,[1800,1750,1700,1650,1600,1550,1500,1450]),2,Yr(e)),a=yn(r,2).pairings.filter(l=>!l.isBye),o=new Set;return a.forEach(l=>{o.add(l.whitePlayerId),o.add(l.blackPlayerId)}),Mn(a.length===4&&o.size===8,"4 parties, 8 joueurs",`${a.length} parties, ${o.size} joueurs`)}},{name:"F2 : 4 joueurs R1 — 2 parties",category:"Forfeits & cas limites",rule:"C.6",description:"Cas minimal : 4 joueurs avec Elo distincts en R1. Le split S1/S2 donne p1 vs p3, p2 vs p4.",setup:"4 joueurs : p1(1800), p2(1600), p3(1400), p4(1200), R1",expectedDetail:"p1 vs p3, p2 vs p4 (S1=[p1,p2] vs S2=[p3,p4])",fideReference:"FIDE C.04.3 §C.6 — Split S1/S2 naturel dans un bracket homogène",coveredRules:["C.4","C.6"],run:()=>{const e=ys(4),n=fn(e,[],Kr(e,[1800,1600,1400,1200]),1,Yr(e)),i=yn(n,1).pairings.filter(l=>!l.isBye),a=d3(i,"p1","p3"),o=d3(i,"p2","p4");return Mn(i.length===2&&!!a&&!!o,"p1vp3, p2vp4",`${i.length} parties`)}},{name:"F3 : 3 joueurs R1 — 1 partie + 1 bye",category:"Forfeits & cas limites",rule:"C.2",description:"Cas ultra-minimal : 3 joueurs. Le bye va au joueur le plus faible (p3). Les 2 restants jouent ensemble.",setup:"3 joueurs : p1(1800), p2(1500), p3(1200), R1",expectedDetail:"1 partie (p1 vs p2) + bye à p3",fideReference:"FIDE C.04.3 §C.2 — Bye au joueur avec le TPN le plus bas",coveredRules:["C.2"],run:()=>{var o;const e=ys(3),n=fn(e,[],Kr(e,[1800,1500,1200]),1,Yr(e)),r=yn(n,1),i=r.pairings.filter(l=>!l.isBye),a=r.pairings.filter(l=>l.isBye);return Mn(i.length===1&&a.length===1&&a[0].whitePlayerId==="p3","1 partie + bye p3",`${i.length} parties, bye=${(o=a[0])==null?void 0:o.whitePlayerId}`)}},{name:"G1 : absolue vs aucune — absolue gagne (E.1)",category:"Hiérarchie couleur",rule:"E.1",description:"Un joueur ayant joué Blancs 2 fois consécutives a une préférence ABSOLUE pour les Noirs. La fonction getColorPreference doit retourner absolute/black.",setup:"Joueur avec colorHistory=[B, B] — 2 blancs consécutifs",expectedDetail:'getColorPreference → { type: "absolute", color: "black" }',fideReference:"FIDE C.04.3 §E.1 — Préférence absolue : joueur ayant joué 2x la même couleur",coveredRules:["A.7a","E.1"],run:()=>{const t=Vs({colorHistory:["white","white"]});return Mn(t.type==="absolute"&&t.color==="black","absolute/black",`${t.type}/${t.color}`)}},{name:"G2 : forte après couleurs alternées (E.2)",category:"Hiérarchie couleur",rule:"E.2",description:"Un joueur ayant joué Noirs au dernier tour (1 seule partie) a une préférence FORTE pour les Blancs. Pas absolue car pas 2 consécutives.",setup:"Joueur avec colorHistory=[N] — 1 noir",expectedDetail:'getColorPreference → { type: "strong", color: "white" }',fideReference:"FIDE C.04.3 §E.2 — Préférence forte : différence de couleur ≠ 0",coveredRules:["A.7b","E.2"],run:()=>{const t=Vs({colorHistory:["black"]});return Mn(t.type==="strong"&&t.color==="white","strong/white",`${t.type}/${t.color}`)}},{name:"G3 : douce avec historique équilibré (E.3)",category:"Hiérarchie couleur",rule:"E.3",description:"Un joueur avec colorHistory=[B, N] a une différence de 0 mais sa dernière couleur était Noirs, donc préférence DOUCE pour les Blancs.",setup:"Joueur avec colorHistory=[B, N] — équilibré",expectedDetail:'getColorPreference → { type: "mild", color: "white" }',fideReference:"FIDE C.04.3 §E.3 — Préférence douce : différence = 0, dernière couleur détermine",coveredRules:["A.7c","E.3"],run:()=>{const t=Vs({colorHistory:["white","black"]});return Mn(t.type==="mild"&&t.color==="white","mild/white",`${t.type}/${t.color}`)}},{name:"G4 : pas de parties — pas de préférence",category:"Hiérarchie couleur",rule:"E.5",de
2750scription:"Un joueur sans historique de parties n'a aucune préférence de couleur. La couleur sera déterminée par la règle E.5 (R1: S1 joue blancs).",setup:"Joueur avec colorHistory=[] — aucune partie jouée",expectedDetail:'getColorPreference → { type: "none", color: null }',fideReference:"FIDE C.04.3 §E.5 — Sans historique, pas de préférence",coveredRules:["E.5"],run:()=>{const t=Vs({colorHistory:[]});return Mn(t.type==="none"&&t.color===null,"none/null",`${t.type}/${t.color}`)}},{name:"Trace de débogage populée",category:"8 joueurs même Elo",rule:"Debug",description:"Vérifie que le moteur produit une trace de débogage non vide, permettant l'audit des décisions d'appariement.",setup:"8 joueurs R1 — vérification de la trace uniquement",expectedDetail:"result.trace.length > 0",fideReference:"Interne — Traçabilité des décisions du moteur pour audit",coveredRules:[],run:()=>{var r;const e=Pc(),t=fn(e,[],Oc(e),1,Dc(e)),n=yn(t,1);return Mn(n.trace&&n.trace.length>0,"trace non vide",`${((r=n.trace)==null?void 0:r.length)??0} entrées`)}},{name:"H1 : calcul colorDiff détermine la préférence (A.6)",category:"Règles avancées FIDE",rule:"A.6",description:"Vérifie que la différence de couleur (A.6) est correctement calculée. Un joueur avec 3B, 1N a colorDiff=+2, donc préférence absolue pour les Noirs.",setup:"Joueur avec colorHistory=[B, N, B, B] → 3 blancs, 1 noir → colorDiff = +2",expectedDetail:'getColorPreference → { type: "absolute", color: "black" } car |colorDiff| > 1',fideReference:"FIDE C.04.3 §A.6 — La différence de couleur = #blancs − #noirs. Si |diff| > 1, préférence absolue.",coveredRules:["A.6"],run:()=>{const t=Vs({colorHistory:["white","black","white","white"]});return Mn(t.type==="absolute"&&t.color==="black","absolute/black (colorDiff=+2)",`${t.type}/${t.color}`)}},{name:"H1b : colorDiff=0 + WW consécutifs → absolute black (A.7 symétrie)",category:"Règles avancées FIDE",rule:"A.7a",description:"Quand colorDiff=0 mais les deux dernières couleurs sont identiques (WW), la préférence absolue doit forcer l'alternance (noir), pas suivre colorDiff.",setup:"Joueur avec colorHistory=[B,B,W,W] → colorDiff=0, lastTwo=WW → absolute black",expectedDetail:'getColorPreference → { type: "absolute", color: "black" }',fideReference:"FIDE C.04.3 §A.7a — Deux couleurs consécutives identiques → préférence absolue pour la couleur opposée",coveredRules:["A.7a"],run:()=>{const e={id:"symWW",ticketId:"t",score:2,opponents:["a","b","c","d"],colorHistory:["black","black","white","white"],hadBye:!1,hadForfeitWin:!1,tpn:5,elo:1200,floatHistory:[null,null,null,null]},t=Vs(e),n={...e,colorHistory:["white","white","black","black"]},r=Vs(n),i=t.type==="absolute"&&t.color==="black",a=r.type==="absolute"&&r.color==="white";return Mn(i&&a,"WW→abs black, BB→abs white",`WW=${t.type}/${t.color}, BB=${r.type}/${r.color}`)}},{name:"H2 : ronde impaire — forte → absolue (A.7d)",category:"Règles avancées FIDE",rule:"A.7d",description:"En ronde impaire, une préférence forte est traitée comme absolue (A.7d). Un joueur avec colorDiff=+1 a normalement une préférence forte pour les noirs, mais en ronde impaire elle devient absolue.",setup:"Joueur avec colorHistory=[B] → colorDiff=+1 → forte noirs. treatStrongAsAbsolute=true (ronde impaire)",expectedDetail:'getColorPreference(p, true) → { type: "absolute", color: "black" }',fideReference:"FIDE C.04.3 §A.7d — En rondes impaires, la préférence forte est traitée comme absolue",coveredRules:["A.7d"],run:()=>{const e={colorHistory:["white"]},t=Vs(e,!1),n=Vs(e,!0),r=t.type==="strong"&&t.color==="black",i=n.type==="absolute"&&n.color==="black";return Mn(r&&i,"strong/black → absolute/black en ronde impaire",`normal=${t.type}/${t.color}, odd=${n.type}/${n.color}`)}},{name:"H3 : ronde paire — douce comptée pour Z1 (A.7e)",category:"Règles avancées FIDE",rule:"A.7e",description:"En ronde paire, les préférences douces sont comptabilisées dans le calcul Z1 des violations tolérées. Vérifie qu'un joueur avec historique équilibré a bien une préférence douce.",setup:"6 joueurs R4 (ronde paire). Joueurs avec historiques variés — les préférences douces sont comptées.",expectedDetail:"Le moteur produit un appariement valide en R4 (ronde paire) avec gestion Z1",fideReference:"FIDE C.04.3 §A.7e — En rondes paires, les préférences douces sont comptées pour le calcul de Z1",coveredRules:["A.7e"],run:()=>{const e=ys(6),t=[1800,1700,1600,1500,1400,1300],n=[{white_player_id:"p1",black_player_id:"p4",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p5",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p3",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:1}],r=[{white_player_id:"p2",black_player_id:"p1",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p3",black_player_id:"p5",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"p6",black_player_id:"p4",is_bye:!1,result:"black_wins",round_number:2}],i=[{white_player_id:"p1",black_player_id:"p3",is_bye:!1,result:"draw",round_number:3},{white_player_id:"p4",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:3},{white_player_id:"p5",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:3}],a=fn(e,[...n,...r,...i],Kr(e,t),4,Yr(e)),l=yn(a,4).pairings.filter(u=>!u.isBye),c=new Set;return l.forEach(u=>{c.add(u.whitePlayerId),u.blackPlayerId&&c.add(u.blackPlayerId)}),Mn(l.length>=3&&c.size>=6,"≥3 parties, ≥6 joueurs en R4 paire",`${l.length} parties, ${c.size} joueurs`)}},{name:"H4 : calcul X1/Z1 — violations tolérées (A.8)",category:"Règles avancées FIDE",rule:"A.8",description:"Vérifie que le moteur calcule correctement X1 (violations fortes tolérées) et Z1 (violations douces tolérées) selon A.8. Le calcul est basé sur floor(N/2) pour un bracket de N joueurs.",setup:"10 joueurs R3 — le bracket principal a ~5 joueurs → X1 devrait permettre des relaxations progressives",expectedDetail:"Le moteur produit un appariement complet (5 parties, 10 joueurs) en utilisant les tolérances X1/Z1",fideReference:"FIDE C.04.3 §A.8 — X1 et Z1 sont les limites entières de violations de couleur tolérées dans un bracket",coveredRules:["A.8"],run:()=>{const e=ys(10),t=[2e3,1950,1900,1850,1800,1750,1700,1650,1600,1550],n=[{white_player_id:"p1",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p7",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p3",black_player_id:"p8",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p9",black_player_id:"p4",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p5",black_player_id:"p10",is_bye:!1,result:"white_wins",round_number:1}],r=[{white_player_id:"p2",black_player_id:"p1",is_bye:!1,result:"draw",round_number:2},{white_player_id:"p3",black_player_id:"p5",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"p4",black_player_id:"p7",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"p8",black_player_id:"p6",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p10",black_player_id:"p9",is_bye:!1,result:"black_wins",round_number:2}],i=fn(e,[...n,...r],Kr(e,t),3,Yr(e)),a=yn(i,3),o=new Set;
2750return a.pairings.forEach(l=>{o.add(l.whitePlayerId),l.blackPlayerId&&o.add(l.blackPlayerId)}),Mn(o.size===10,"10 joueurs appariés (X1/Z1 appliqué)",`${o.size} joueurs`)}},{name:"H5 : exception top scorer B2 (A.10)",category:"Règles avancées FIDE",rule:"A.10",description:`Quand un joueur est "top scorer" (score > 50% du max possible), la contrainte B2 (pas de 3e couleur consécutive) peut être relaxée pour permettre l'appariement.`,setup:"4 joueurs R3. p1=2pts (top scorer, >50% de 2), historique couleur intense → A.10 permet la relaxation B2",expectedDetail:"2 parties, 4 joueurs appariés même si B2 devrait être violée pour le top scorer",fideReference:"FIDE C.04.3 §A.10 — Pour les top scorers (score > 50% du max), B2 peut être relaxée",coveredRules:["A.10"],run:()=>{const e=ys(4),t=[1800,1700,1600,1500],n=[{white_player_id:"p1",black_player_id:"p3",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p2",black_player_id:"p4",is_bye:!1,result:"white_wins",round_number:1}],r=[{white_player_id:"p1",black_player_id:"p2",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"p4",black_player_id:"p3",is_bye:!1,result:"black_wins",round_number:2}],i=fn(e,[...n,...r],Kr(e,t),3,Yr(e)),o=yn(i,3).pairings.filter(c=>!c.isBye),l=new Set;return o.forEach(c=>{l.add(c.whitePlayerId),c.blackPlayerId&&l.add(c.blackPlayerId)}),Mn(o.length===2&&l.size===4,"2 parties, 4 joueurs (A.10 appliqué)",`${o.length} parties, ${l.size} joueurs`)}},{name:"H6 : fusion de brackets quand bracket bas échoue (C.13)",category:"Règles avancées FIDE",rule:"C.13",description:"Quand le bracket le plus bas ne peut pas être apparié seul (tous les joueurs se sont déjà rencontrés), le moteur fusionne avec le bracket précédent (C.13) pour trouver un appariement.",setup:"6 joueurs R3. Bracket bas (0pts): p5,p6 se sont déjà rencontrés en R1 et R2 → rematch impossible → fusion avec bracket 1pt",expectedDetail:"3 parties, 6 joueurs appariés grâce à la fusion C.13",fideReference:"FIDE C.04.3 §C.13 — Si le bracket le plus bas échoue, fusionner avec le bracket précédent",coveredRules:["C.13"],run:()=>{const e=ys(6),t=[1800,1700,1600,1500,1400,1300],n=[{white_player_id:"p1",black_player_id:"p4",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p2",black_player_id:"p5",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p6",black_player_id:"p3",is_bye:!1,result:"black_wins",round_number:1}],r=[{white_player_id:"p1",black_player_id:"p3",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"p4",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p5",black_player_id:"p6",is_bye:!1,result:"draw",round_number:2}],i=fn(e,[...n,...r],Kr(e,t),3,Yr(e)),o=yn(i,3).pairings.filter(c=>!c.isBye),l=new Set;return o.forEach(c=>{l.add(c.whitePlayerId),c.blackPlayerId&&l.add(c.blackPlayerId)}),Mn(o.length===3&&l.size===6,"3 parties, 6 joueurs (C.13 fusion)",`${o.length} parties, ${l.size} joueurs`)}},{name:"H7 : décrémentation P1 quand appariement complet impossible (C.14)",category:"Règles avancées FIDE",rule:"C.14",description:"Quand le nombre cible de paires P1 est impossible à atteindre (contraintes de couleur/rematch trop fortes), le moteur décrémente P1 et réessaie avec un objectif réduit.",setup:"8 joueurs R4 avec historiques créant de nombreux conflits. P1 initial impossible → le moteur accepte P1-1.",expectedDetail:"≥3 parties (P1 réduit depuis 4 si nécessaire), tous les joueurs appariés si possible",fideReference:"FIDE C.04.3 §C.14 — Si P1 paires est impossible, décrémenter P1 et réessayer",coveredRules:["C.14"],run:()=>{const e=ys(8),t=[1800,1750,1700,1650,1600,1550,1500,1450],n=[{white_player_id:"p1",black_player_id:"p5",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p2",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p7",black_player_id:"p3",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p8",black_player_id:"p4",is_bye:!1,result:"black_wins",round_number:1}],r=[{white_player_id:"p3",black_player_id:"p1",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p4",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p5",black_player_id:"p7",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"p6",black_player_id:"p8",is_bye:!1,result:"white_wins",round_number:2}],i=[{white_player_id:"p1",black_player_id:"p2",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"p3",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"p7",black_player_id:"p4",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"p8",black_player_id:"p5",is_bye:!1,result:"black_wins",round_number:3}],a=fn(e,[...n,...r,...i],Kr(e,t),4,Yr(e)),l=yn(a,4).pairings.filter(u=>!u.isBye),c=new Set;return l.forEach(u=>{c.add(u.whitePlayerId),u.blackPlayerId&&c.add(u.blackPlayerId)}),Mn(l.length>=3&&c.size>=6,"≥3 parties, ≥6 joueurs (C.14 si nécessaire)",`${l.length} parties, ${c.size} joueurs`)}},{name:"B.3 — Floater descent minimale (R5, 8J)",category:"Qualité & proximité des scores",rule:"B.3",description:"Un joueur à 3.5pts (J1) flotte. Il doit s'arrêter au bracket 2pts (J7) et non descendre au bracket 0.5pts (J6).",setup:"8J même Elo, R1-R4 joués. J1=3.5pts, J7=2pts (seul adversaire valide dans ce bracket). J6=0.5pts.",expectedDetail:"J1 affronte J7 (bracket 2pts). Pas J6 (bracket 0.5pts). 4 paires, 0 bye.",fideReference:`B.3 : "Minimize score differences in pairings." — Un floater doit s'arrêter au premier bracket contenant un adversaire C.1-valide.`,coveredRules:["B.3","B.5","B.6","C.10"],run:()=>{const e=Pc(),n=fn(e,[{white_player_id:"player-1",black_player_id:"player-5",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"player-6",black_player_id:"player-2",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"player-3",black_player_id:"player-7",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"player-8",black_player_id:"player-4",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"player-4",black_player_id:"player-1",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"player-2",black_player_id:"player-3",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"player-5",black_player_id:"player-8",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"player-7",black_player_id:"player-6",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"player-1",black_player_id:"player-3",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"player-5",black_player_id:"player-2",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"player-7",black_player_id:"player-4",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"player-8",black_player_id:"player-6",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"player-2",black_player_id:"player-1",is_bye:!1,result:"draw",round_number:4},{white_player_id:"player-3",black_player_id:"player-5",is_bye:!1,result:"white_wins",round_number:4},{white_player_id:"player-4",black_player_id:"player-6",is_bye:!1,result:"draw",round_number:4},{white_player_id:"player-8",black_player_id:"player-7",is_bye:!1,result:"white_wins",round_number:4}],Oc(e),5,Dc(e)),i=yn(n,5).pairings.filter(c=>!c.isBye),a=i.find(c=>c.whitePlayerId==="player-1"||c.blackPlayerId==="player-1"),o=a?a.whitePlayerId==="player-1"?a.blackPlayerId:a.whitePlayerId:"none",l=o!=="player-6";return Mn(i.length===4&&l,"J1 vs J7 (bracket 2pts), 4 paires",`J1 vs J${o==="none"?"?":Ih(o)}, ${i.length} paires`)}},{name:"C.10 — Relaxation B5/B6 Up vs Down (R5, 8J)",category:"Relaxation & backtracking",rule:"C.10",description:"Vérifie que la relaxation B5/B6 suit l'ordre FI
2750DE C.10.a→d : B6-up, B5-up, B6-down, B5-down. Les upfloaters sont relaxés avant les downfloaters.",setup:"8J même Elo, R1-R4 joués. Scénario identique au test B.3 (J1=3.5pts floater).",expectedDetail:"4 paires, 0 bye. L'appariement réussit avec la relaxation up/down séparée.",fideReference:'C.10.a-d : "First drop B6 for upfloaters, then B5 for upfloaters, then B6 for downfloaters, then B5 for downfloaters."',coveredRules:["C.10","B.5","B.6"],run:()=>{const e=Pc(),n=fn(e,[{white_player_id:"player-1",black_player_id:"player-5",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"player-6",black_player_id:"player-2",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"player-3",black_player_id:"player-7",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"player-8",black_player_id:"player-4",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"player-4",black_player_id:"player-1",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"player-2",black_player_id:"player-3",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"player-5",black_player_id:"player-8",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"player-7",black_player_id:"player-6",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"player-1",black_player_id:"player-3",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"player-5",black_player_id:"player-2",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"player-7",black_player_id:"player-4",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"player-8",black_player_id:"player-6",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"player-2",black_player_id:"player-1",is_bye:!1,result:"draw",round_number:4},{white_player_id:"player-3",black_player_id:"player-5",is_bye:!1,result:"white_wins",round_number:4},{white_player_id:"player-4",black_player_id:"player-6",is_bye:!1,result:"draw",round_number:4},{white_player_id:"player-8",black_player_id:"player-7",is_bye:!1,result:"white_wins",round_number:4}],Oc(e),5,Dc(e)),r=yn(n,5),i=r.pairings.filter(a=>!a.isBye);return Mn(i.length===4&&r.pairings.filter(a=>a.isBye).length===0,"4 paires, 0 bye (relaxation C.10.a-d up/down)",`${i.length} paires, ${r.pairings.filter(a=>a.isBye).length} bye`)}},{name:"R5 Blitz Didot — qualité d'appariement ronde finale",category:"Régression terrain",rule:"C.04.3 / fallback global",description:"14 joueurs (Elo plat 1200 + 1 outlier 2000), historique R1-R4 réel du tournoi du 1er juin 2026 importé depuis la prod. La R5 doit produire au plus 1 paire avec Δscore > 1 (parité avec PAPI). Régression de cause-racine : le fallback global ignorait précédemment les écarts de score et produisait 5 paires hors-norme.",setup:"14 joueurs, scores après R4 : Marc(4), Jacques/Kevin(3), Edouard/Maxime/Pierre-alexis/Grégoire(2.5), Dany/natale(2), Augustin/César/Tancrède/Vinz(1), Judith(0). natale=2000 Elo.",expectedDetail:"R5 : au plus 1 paire avec Δscore > 1 (Judith isolée à 0 force un downfloat inévitable), Σ écarts ≤ 4",fideReference:"FIDE C.04.3 — minimisation des score-diffs sur les floaters ; fallback global score-aware (findMinScoreGapMatching, swissPairing.ts)",coveredRules:["A.1","B.3","C.1","C.6","C.18"],run:()=>{const e=new Map(Object.entries(C1t)),t=new Map(Object.entries(Ij)),n=fn(Tfe,E1t,e,5,t),r=yn(n,5,5),i=new Map(n.map(d=>[d.id,d.score])),a=r.pairings.filter(d=>!d.isBye),o=a.map(d=>Math.abs(i.get(d.whitePlayerId)-i.get(d.blackPlayerId))),l=o.filter(d=>d>1).length,c=o.reduce((d,f)=>d+f,0),u=a.map(d=>{const f=Ij[d.whitePlayerId],h=Ij[d.blackPlayerId],p=i.get(d.whitePlayerId),x=i.get(d.blackPlayerId);return`${f}(${p}) vs ${h}(${x})`}).join(", ");return Mn(l<=1&&c<=4,"≤1 paire Δ>1 et Σ écarts ≤4",`${l} paires Δ>1, Σ=${c} — ${u}`)}}],S1t={"A.1":"Groupes de score (brackets)","A.2":"Ordre TPN (Elo → nom → ID)","A.3":"Brackets hétérogènes (flotteurs)","A.6":"Différence de couleur","A.7a":"Préférence absolue de couleur","A.7b":"Préférence forte de couleur","A.7c":"Préférence douce de couleur","A.7d":"Rondes impaires : forte → absolue","A.7e":"Rondes paires : douce comptée pour Z1","A.8":"Calcul X1/Z1","A.10":"Exception to
2750p scorer B2","B.1":"Pas de rematch (C1 absolu)","B.2":"Pas 3× même couleur consécutive","B.5":"Pas de float même direction R−2","B.6":"Pas de float même direction R−1","C.1":"Contrainte absolue : pas de rematch","C.2":"Bye au joueur le plus bas non encore exempté","C.4":"Respect des préférences absolues couleur","C.6":"Transpositions dans un bracket","C.7":"Échanges entre S1 et S2","C.8":"Limite de paires (P0/P1)","C.12":"Backtracking : échange après échec transpositions","C.13":"Fusion de brackets (lowest bracket merge)","C.14":"Décrémentation de P1","D.2":"Renumérotation après appariement bracket","D.3":"Sélection de flotteurs sortants","D.9":"Numérotation contiguë des tables","E.1":"Attribution couleur : équilibre","E.2":"Attribution couleur : alternance","E.3":"Attribution couleur : TPN plus élevé = blanc","E.4":"Attribution couleur : couleur lot","E.5":"Attribution couleur : Ronde 1 S1=blanc"},A1t={A:["A.1","A.2","A.3","A.6","A.7a","A.7b","A.7c","A.7d","A.7e","A.8","A.10"],B:["B.1","B.2","B.5","B.6"],C:["C.1","C.2","C.4","C.6","C.7","C.8","C.12","C.13","C.14"],D:["D.2","D.3","D.9"],E:["E.1","E.2","E.3","E.4","E.5"]};function T1t(){const e=new Map;return U8.forEach(t=>t.coveredRules.forEach(n=>{e.has(n)||e.set(n,[]),e.get(n).push(t.name)})),Object.entries(A1t).map(([t,n])=>({section:t,total:n.length,covered:n.filter(r=>e.has(r)).length,rules:n.map(r=>({code:r,covered:e.has(r),description:S1t[r]??r,provingScenarios:e.get(r)??[]}))}))}function P1t(){return U8.map(e=>{const t=performance.now();try{const n=e.run(),r=performance.now()-t;return{name:e.name,category:e.category,rule:e.rule,...n,description:e.description,setup:e.setup,expectedDetail:e.expectedDetail,actualDetail:n.passed?n.expected:n.actual,fideReference:e.fideReference,executionTimeMs:Math.round(r*100)/100,coveredRules:e.coveredRules}}catch(n){const r=performance.now()-t;return{name:e.name,category:e.category,rule:e.rule,passed:!1,expected:"pas d'erreur",actual:"crash",error:(n==null?void 0:n.message)??String(n),description:e.description,setup:e.setup,expectedDetail:e.expectedDetail,actualDetail:`Erreur: ${(n==null?void 0:n.message)??String(n)}`,fideReference:e.fideReference,executionTimeMs:Math.round(r*100)/100,coveredRules:e.coveredRules}}})}function O1t(){return[...new Set(U8.map(e=>e.category))]}function D1t(){const e=Pc(),t=Oc(e),n=Dc(e),r=[...Ig,...zv,...pk,...ZO],i=fn(e,r,t,5,n),a=yn(i,5),o=to(a.pairings,5);return no(e,[Ig,zv,pk,ZO,o],t,n)}function to(e,t){return e.map(n=>({white_player_id:n.whitePlayerId,black_player_id:n.blackPlayerId??n.whitePlayerId,is_bye:n.isBye??!1,result:n.isBye?"white_wins":"draw",round_number:t}))}function no(e,t,n,r){const i=a=>parseInt(a.replace(/\D/g,""),10)||0;return e.map(a=>{const o=i(a);let l=0;const c=t.map(u=>{const d=u.find(y=>y.white_player_id===a||y.black_player_id===a);if(!d)return null;if(d.is_bye)return l+=1,{opponent:0,color:"B",result:"+"};const f=d.white_player_id===a,h=f?d.black_player_id:d.white_player_id,p=f?"B":"N";let x;return d.result==="draw"?(x="=",l+=.5):d.result==="white_wins"&&f||d.result==="black_wins"&&!f?(x="+",l+=1):x="−",{opponent:i(h),color:p,result:x}}).filter(u=>u!==null);return{tpn:o,name:r.get(a)??a,elo:n.get(a)??0,rounds:c,totalPoints:l}}).sort((a,o)=>o.totalPoints-a.totalPoints||a.tpn-o.tpn)}function Pfe(){return[{id:"golden",label:"Golden 8J — 5 rondes",category:"8 joueurs même Elo",playerCount:8,roundCount:5,build:D1t},{id:"a1-bye-7",label:"A1 — 7 joueurs R1 (bye)",category:"Bye & Joueurs impairs",playerCount:7,roundCount:1,build:()=>{const e=ys(7),n=Kr(e,[1800,1700,1600,1500,1400,1300,1200]),r=Yr(e),i=fn(e,[],n,1,r),a=yn(i,1);return no(e,[to(a.pairings,1)],n,r)}},{id:"a2-9p-r2",label:"A2 — 9 joueurs R2 (double bye)",category:"Bye & Joueurs impairs",playerCount:9,roundCount:2,build:()=>{const e=ys(9),n=Kr(e,[1800,1750,1700,1650,1600,1550,1500,1450,1400]),r=Yr(e),i=[{white_player_id:"p1",black_player_id:"p5",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p6",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p3",black_player_id:"p7",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p8",black_player_id:"p4",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p9",black_player_id:"p9",is_bye:!0,result:"white_wins",round_number:1}],a=fn(e,i,n,2,r),o=yn(a,2);return no(e,[i,to(o.pairings,2)],n,r)}},{id:"b1-10p-r1",label:"B1 — 10 joueurs Elo distincts R1",category:"TPN par classement",playerCount:10,roundCount:1,build:()=>{const e=ys(10),n=Kr(e,[2200,2100,2e3,1900,1800,1700,1600,1500,1400,1300]),r=Yr(e),i=fn(e,[],n,1,r),a=yn(i,1);return no(e,[to(a.pairings,1)],n,r)}},{id:"d1-10p-r3",label:"D1 — 10 joueurs R3 (flotteurs)",category:"Contraintes flotteurs",playerCount:10,roundCount:3,build:()=>{const e=ys(10),n=Kr(e,[2e3,1900,1800,1700,1600,1500,1400,1300,1200,1100]),r=Yr(e),i=[{white_player_id:"p1",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p7",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p3",black_player_id:"p8",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p9",black_player_id:"p4",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p5",black_player_id:"p10",is_bye:!1,result:"white_wins",round_number:1}],a=[{white_player_id:"p4",black_player_id:"p1",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p2",black_player_id:"p3",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p5",black_player_id:"p6",is_bye:!1,result:"draw",round_number:2},{white_player_id:"p7",black_player_id:"p9",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"p10",black_player_id:"p8",is_bye:!1,result:"black_wins",round_number:2}],o=fn(e,[...i,...a],n,3,r),l=yn(o,3);return no(e,[i,a,to(l.pairings,3)],n,r)}},{id:"h6-c13",label:"H6 — Fusion brackets C.13",category:"Règles avancées FIDE",playerCount:6,roundCount:3,build:()=>{const e=ys(6),n=Kr(e,[1800,1700,1600,1500,1400,1300]),r=Yr(e),i=[{white_player_id:"p1",black_player_id:"p4",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p2",black_player_id:"p5",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p6",black_player_id:"p3",is_bye:!1,result:"black_wins",round_number:1}],a=[{white_player_id:"p1",black_player_id:"p3",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"p4",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p5",black_player_id:"p6",is_bye:!1,result:"draw",round_number:2}],o=fn(e,[...i,...a],n,3,r),l=yn(o,3);return no(e,[i,a,to(l.pairings,3)],n,r)}},{id:"h7-c14",label:"H7 — Décrémentation P1 C.14",category:"Règles avancées FIDE",playerCount:8,roundCount:4,build:()=>{const e=ys(8),n=Kr(e,[1800,1750,1700,1650,1600,1550,1500,1450]),r=Yr(e),i=[{white_player_id:"p1",black_player_id:"p5",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p2",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p7",black_player_id:"p3",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p8",black_player_id:"p4",is_bye:!1,result:"black_wins",round_number:1}],a=[{white_player_id:"p3",black_player_id:"p1",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p4",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p5",black_player_id:"p7",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"p6",black_player_id:"p8",is_bye:!1,result:"white_wins",round_number:2}],o=[{white_player_id:"p1",black_player_id:"p2",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"p3",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"p7",black_player_id:"p4",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"p8",black_player_id:"p5",is_bye:!1,result:"black_wins",round_number:3}],l=fn(e,[...i,...a,...o],n,4,r),c=yn(l,4);return no(e,[i,a,o,to(c.pairings,4)],n,r)}},{id:"f2-4p-r1",label:"F2 — 4 joueurs R1 (minimal)",category:"Forfeits & cas limites",playerCount:4,roundCount:1,build:()=>{const e=ys(4),n=Kr(e,[1800,1600,1400,1200]),r=Yr(e),i=fn(e,[],n,1,r),a=yn(i,1);return no(e,[to(a.pairings,1)],n,r)}},{id:"e3-lookback",label:"E3 — Alternation look-back 2J R3",category:"Color assignment",playerCount:2,roundCount:3,build:()=>{const e=["pa","pb"],t=new Map([["pa",1500],["pb",1500]]),n=new Map([["pa","Alice"],["pb","Bob"]]),r=[{white_player_id:"pa",black_player_id:"pb",is_bye:!1,result:"white_wins",round_number:1}],i=[{white_player_id:"pb",black_player_id:"pa",is_bye:!1,result:"white_wins",round_number:2}],a=fn(e,[...r,...i],t,3,n),o=yn(a,3);return no(e,[r,i,to(o.pairings,3)],t,n)}},{id:"e1-backtrack",label:"E1 — Backtracking 6J R3",category:"Backtracking & fusion",playerCount:6,roundCount:3,build:()=>{const e=ys(6),n=Kr(e,[1800,1700,1600,1500,1400,1300]),r=Yr(e),i=[{white_player_id:"p1",black_player_id:"p4",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p5",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:1},{white_player_id:"p3",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:1}],a=[{white_player_id:"p2",black_player_id:"p1",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p4",black_player_id:"p3",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p5",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:2}],o=fn(e,[...i,...a],n,3,r),l=yn(o,3);return no(e,[i,a,to(l.pairings,3)],n,r)}},{id:"c14b-remainder",label:"C.14.b — Remainder hetero 6J R3",category:"Relaxation & fallback",playerCount:6,roundCount:3,build:()=>{const e=ys(6),n=Kr(e,[1800,1700,1500,1400,1300,1200]),r=Yr(e),i=[{white_player_id:"p1",black_player_id:"p3",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p2",black_player_id:"p4",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p5",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:1}],a=[{white_player_id:"p4",black_player_id:"p1",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p3",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p6",black_player_id:"p5",is_bye:!1,result:"black_wins",round_number:2}],o=fn(e,[...i,...a],n,3,r),l=yn(o,3);return no(e,[i,a,to(l.pairings,3)],n,r)}},{id:"edge-withdrawal",label:"Retrait mid-tournoi 8→7 joueurs R3",category:"Edge cases",playerCount:7,roundCount:3,build:()=>{const e=Array.from({length:8},(c,u)=>`p${u+1}`),t=Kr(e,e.map(()=>1200)),n=Yr(e),r=[{white_player_id:"p1",black_player_id:"p5",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p2",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p3",black_player_id:"p7",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p4",black_player_id:"p8",is_bye:!1,result:"white_wins",round_number:1}],i=[{white_player_id:"p1",black_player_id:"p3",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"p4",black_player_id:"p2",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"p5",black_player_id:"p8",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"p7",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:2}],a=e.filter(c=>c!=="p8"),o=fn(a,[...r,...i],t,3,n),l=yn(o,3);return no(a,[r.filter(c=>c.white_player_id!=="p8"&&c.black_player_id!=="p8"||!0),i,to(l.pairings,3)],t,n)}},{id:"edge-12p-backtrack",label:"12 joueurs R5 — stress backtracking",category:"Edge cases",playerCount:12,roundCount:5,build:()=>{const e=Array.from({length:12},(d,f)=>`p${f+1}`),t=Kr(e,e.map((d,f)=>1800-f*50)),n=Yr(e),r=[{white_player_id:"p1",black_player_id:"p7",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p2",black_player_id:"p8",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p3",black_player_id:"p9",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p4",black_player_id:"p10",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p5",black_player_id:"p11",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"p6",black_player_id:"p12",is_bye:!1,result:"white_wins",round_number:1}],i=[{white_player_id:"p7",black_player_id:"p1",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p8",black_player_id:"p2",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p9",black_player_id:"p3",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p4",black_player_id:"p10",is_bye:!1,result:"draw",round_number:2},{white_player_id:"p11",black_player_id:"p5",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"p12",black_player_id:"p6",is_bye:!1,result:"black_wins",round_number:2}],a=[{white_player_id:"p1",black_player_id:"p4",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"p5",black_player_id:"p2",is_bye:!1,result:"draw",round_number:3},{white_player_id:"p3",black_player_id:"p6",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"p10",black_player_id:"p7",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"p8",black_player_id:"p11",is_bye:!1,result:"draw",round_number:3},{white_player_id:"p9",black_player_id:"p12",is_bye:!1,result:"white_wins",round_number:3}],o=[{white_player_id:"p2",black_player_id:"p1",is_bye:!1,result:"black_wins",round_number:4},{white_player_id:"p3",black_player_id:"p5",is_bye:!1,result:"white_wins",round_number:4},{white_player_id:"p10",black_player_id:"p9",is_bye:!1,result:"draw",round_number:4},{white_player_id:"p6",black_player_id:"p4",is_bye:!1,result:"draw",round_number:4},{white_player_id:"p7",black_player_id:"p8",is_bye:!1,result:"white_wins",round_number:4},{white_player_id:"p11",black_player_id:"p12",is_bye:!1,result:"white_wins",round_number:4}],l=[...r,...i,...a,...o],c=fn(e,l,t,5,n),u=yn(c,5);return no(e,[r,i,a,o,to(u.pairings,5)],t,n)}}
2750,{id:"edge-16p-perf",label:"16 joueurs R2 — test performance",category:"Edge cases",playerCount:16,roundCount:2,build:()=>{const e=Array.from({length:16},(o,l)=>`p${l+1}`),t=Kr(e,e.map((o,l)=>2e3-l*40)),n=Yr(e),r=[];for(let o=0;o<8;o++)r.push({white_player_id:`p${o+1}`,black_player_id:`p${o+9}`,is_bye:!1,result:o%3===0?"draw":"white_wins",round_number:1});const i=fn(e,r,t,2,n),a=yn(i,2);return no(e,[r,to(a.pairings,2)],t,n)}}]}function I1t({coverage:e}){return s.jsx(Xk,{delayDuration:100,children:s.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Rk,{className:"w-4 h-4 text-primary"}),s.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Couverture FIDE C.04.3"})]}),s.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-muted-foreground",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-primary inline-block"})," Testé"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-muted border border-border inline-block"})," Non testé"]})]})]}),s.jsx("div",{className:"space-y-3",children:e.map(t=>s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-xs font-medium text-foreground",children:["Section ",t.section]}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.covered,"/",t.total]})]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.rules.map(n=>s.jsxs(Qk,{children:[s.jsx(Jk,{asChild:!0,children:s.jsx("button",{className:ae("px-2 py-1 rounded-md text-[11px] font-mono font-medium min-h-[32px] min-w-[40px] text-center transition-colors border",n.covered?"bg-primary/15 text-primary border-primary/30":"bg-muted text-muted-foreground border-border"),children:n.code})}),s.jsxs(Pb,{side:"top",className:"max-w-[260px] text-left",children:[s.jsxs("p",{className:"font-semibold text-xs",children:[n.code," — ",n.description]}),n.provingScenarios.length>0?s.jsxs("div",{className:"mt-1 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground font-medium",children:"Prouvé par :"}),n.provingScenarios.map((r,i)=>s.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["• ",r]},i))]}):s.jsx("p",{className:"text-[10px] text-amber-600 dark:text-amber-400 mt-1",children:"Aucun scénario dédié"})]})]},n.code))})]},t.section))})]})})}function R1t({result:e}){const[t,n]=N.useState(!1);return s.jsxs("div",{className:ae("rounded-lg border px-4 py-3 transition-colors",e.passed?"border-green-200 bg-green-50/50 dark:border-green-900 dark:bg-green-950/20":"border-destructive/30 bg-destructive/5"),children:[s.jsxs("button",{onClick:()=>n(!t),className:"w-full flex items-start justify-between gap-2 text-left min-h-[44px]",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.passed?s.jsx(Jr,{className:"w-4 h-4 text-green-600 shrink-0 mt-0.5"}):s.jsx(hi,{className:"w-4 h-4 text-destructive shrink-0 mt-0.5"}),s.jsx("span",{className:"text-sm font-medium text-foreground",children:e.name})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e.executionTimeMs,"ms"]}),s.jsx(we,{variant:"outline",className:"text-[10px]",children:e.rule}),t?s.jsx(Wa,{className:"w-3.5 h-3.5 text-muted-foreground"}):s.jsx(la,{className:"w-3.5 h-3.5 text-muted-foreground"})]})]}),t&&s.jsxs("div",{className:"mt-3 ml-6 space-y-2.5 text-xs border-t border-border/50 pt-3",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsxs("span",{className:"font-semibold text-foreground flex items-center gap-1",children:[s.jsx(wl,{className:"w-3 h-3"})," Scénario"]}),s.jsx("p",{className:"text-muted-foreground leading-relaxed",children:e.description})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("span",{className:"font-semibold text-foreground",children:"Conditions initiales"}),s.jsx("p",{className:"text-muted-foreground font-mono text-[11px] bg-muted/50 rounded px-2 py-1",children:e.setup}
2750)]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("span",{className:"font-semibold text-green-700 dark:text-green-400",children:"Résultat attendu"}),s.jsx("p",{className:"text-muted-foreground font-mono text-[11px] bg-green-50/50 dark:bg-green-950/20 rounded px-2 py-1",children:e.expectedDetail})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("span",{className:ae("font-semibold",e.passed?"text-green-700 dark:text-green-400":"text-destructive"),children:"Résultat obtenu"}),s.jsx("p",{className:ae("font-mono text-[11px] rounded px-2 py-1",e.passed?"text-muted-foreground bg-green-50/50 dark:bg-green-950/20":"text-destructive bg-destructive/5"),children:e.actualDetail})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsxs("span",{className:"font-semibold text-primary flex items-center gap-1",children:[s.jsx(Rk,{className:"w-3 h-3"})," Référence FIDE"]}),s.jsx("p",{className:"text-muted-foreground italic text-[11px]",children:e.fideReference})]}),e.coveredRules.length>0&&s.jsx("div",{className:"flex flex-wrap gap-1 pt-1",children:e.coveredRules.map(r=>s.jsx(we,{variant:"secondary",className:"text-[9px] px-1.5 py-0",children:r},r))}),e.error&&s.jsx("p",{className:"text-destructive/80 font-mono text-[11px] break-all bg-destructive/5 rounded px-2 py-1",children:e.error})]})]})}function M1t(){var l,c;const e=N.useMemo(()=>Pfe(),[]),[t,n]=N.useState(((l=e[0])==null?void 0:l.id)??""),[r,i]=N.useState(null),a=e.find(u=>u.id===t),o=N.useCallback(()=>{a&&i(a.build())},[a]);return N.useState(t)[0],s.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx(Rk,{className:"w-4 h-4 text-primary shrink-0"}),s.jsx("span",{className:"text-sm font-semibold text-foreground shrink-0",children:"Grille Américaine"}),s.jsxs(li,{value:t,onValueChange:u=>{n(u),i(null)},children:[s.jsx(Gs,{className:"h-8 text-xs flex-1 min-w-[180px]",children:s.jsx(ci,{})}),s.jsx(Ks,{children:e.map(u=>s.jsxs(Yn,{value:u.id,className:"text-xs",children:[u.label," (",u.playerCount,"J, ",u.roundCount,"R)"]},u.id))})]})]}),!r&&s.jsx("div",{className:"text-center py-6",children:s.jsxs(Q,{size:"sm",variant:"outline",onClick:o,className:"gap-2 min-h-[44px]",children:[s.jsx(Na,{className:"w-3.5 h-3.5"}),"Générer la grille"]})}),r&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto -mx-4 px-4",children:s.jsxs("table",{className:"w-full text-xs border-collapse min-w-[400px]",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border",children:[s.jsx("th",{className:"text-left py-2 pr-2 font-semibold text-foreground sticky left-0 bg-card z-10 w-8",children:"#"}),s.jsx("th",{className:"text-left py-2 pr-3 font-semibold text-foreground sticky left-8 bg-card z-10 min-w-[80px]",children:"Joueur"}),s.jsx("th",{className:"text-center py-2 px-2 font-semibold text-muted-foreground",children:"Elo"}),Array.from({length:((c=r[0])==null?void 0:c.rounds.length)??0},(u,d)=>s.jsxs("th",{className:"text-center py-2 px-2 font-semibold text-muted-foreground",children:["R",d+1]},d)),s.jsx("th",{className:"text-center py-2 pl-2 font-semibold text-foreground",children:"Pts"})]})}),s.jsx("tbody",{children:r.map(u=>s.jsxs("tr",{className:"border-b border-border/50 hover:bg-accent/5",children:[s.jsx("td",{className:"py-2 pr-2 font-mono font-bold text-foreground sticky left-0 bg-card z-10",children:u.tpn}),s.jsx("td",{className:"py-2 pr-3 font-medium text-foreground sticky left-8 bg-card z-10 truncate max-w-[100px]",children:u.name}),s.jsx("td",{className:"py-2 px-2 text-center text-muted-foreground font-mono",children:u.elo}),u.rounds.map((d,f)=>s.jsx("td",{className:"py-2 px-2 text-center font-mono",children:s.jsxs("span",{className:"inline-flex items-center gap-0.5",children:[d.opponent===0?s.jsx("span",{className:"text-muted-foreground text-[10px]",children:"BYE"}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-muted-foreground",children:d.opponent}),s.jsx("span",{className:ae("w-2.5 h-2.5 rounded-full border inline-block",d.color==="B"?"bg-background border-foreground
2750/30":"bg-foreground border-foreground/30")})]}),s.jsx("span",{className:ae("font-bold",d.result==="+"&&"text-green-600 dark:text-green-400",d.result==="="&&"text-amber-600 dark:text-amber-400",d.result==="−"&&"text-destructive"),children:d.result})]})},f)),s.jsx("td",{className:"py-2 pl-2 text-center font-mono font-bold text-foreground",children:u.totalPoints})]},u.tpn))})]})}),s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Notation : n°adversaire · ○ Blancs / ● Noirs · + victoire / = nulle / − défaite · BYE = exempt"})]})]})}function L1t(){var d;const[e,t]=N.useState(null),[n,r]=N.useState(""),[i,a]=N.useState(5),o=Pfe(),[l,c]=N.useState(((d=o[0])==null?void 0:d.id)||""),u=N.useCallback(()=>{var T;const f=Array.from({length:8},(P,O)=>`player-${O+1}`),h=new Map(f.map(P=>[P,1200])),p=new Map(f.map((P,O)=>[P,`J${O+1}`])),y=[{white_player_id:"player-1",black_player_id:"player-5",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"player-2",black_player_id:"player-6",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"player-3",black_player_id:"player-7",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"player-4",black_player_id:"player-8",is_bye:!1,result:"white_wins",round_number:1},{white_player_id:"player-5",black_player_id:"player-1",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"player-6",black_player_id:"player-2",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"player-7",black_player_id:"player-3",is_bye:!1,result:"white_wins",round_number:2},{white_player_id:"player-8",black_player_id:"player-4",is_bye:!1,result:"black_wins",round_number:2},{white_player_id:"player-1",black_player_id:"player-3",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"player-7",black_player_id:"player-2",is_bye:!1,result:"black_wins",round_number:3},{white_player_id:"player-4",black_player_id:"player-5",is_bye:!1,result:"white_wins",round_number:3},{white_player_id:"player-6",black_player_id:"player-8",is_bye:!1,result:"draw",round_number:3},{white_player_id:"player-2",black_player_id:"player-1",is_bye:!1,result:"black_wins",round_number:4},{white_player_id:"player-7",black_player_id:"player-4",is_bye:!1,result:"white_wins",round_number:4},{white_player_id:"player-3",black_player_id:"player-6",is_bye:!1,result:"white_wins",round_number:4},{white_player_id:"player-5",black_player_id:"player-8",is_bye:!1,result:"white_wins",round_number:4}].filter(P=>P.round_number<i),b=fn(f,y,h,i,p),w=yn(b,i);t(w.debugState||null);const _=w.pairings.filter(P=>!P.isBye).map(P=>{var R,L;const O=((R=b.find(M=>M.id===P.whitePlayerId))==null?void 0:R.tpn)??"?",D=((L=b.find(M=>M.id===P.blackPlayerId))==null?void 0:L.tpn)??"?";return`Table ${P.tableNumber}: J${O}(B) vs J${D}(N)`}).join(`
2751`),j=w.pairings.find(P=>P.isBye),E=j?`
2752BYE: J${(T=b.find(P=>P.id===j.whitePlayerId))==null?void 0:T.tpn}`:"",S=w.warnings.length>0?`
2753
2754Warnings:
2755${w.warnings.map(P=>`[${P.code}] ${P.message}`).join(`
2756`)}`:"";r(_+E+S)},[i]);return s.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(y5,{className:"w-4 h-4 text-primary"}),s.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Diagnostic moteur"})]}),s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[s.jsxs(li,{value:String(i),onValueChange:f=>a(Number(f)),children:[s.jsx(Gs,{className:"h-8 text-xs w-32",children:s.jsx(ci,{})}),s.jsx(Ks,{children:[2,3,4,5].map(f=>s.jsxs(Yn,{value:String(f),className:"text-xs",children:["Ronde ",f]},f))})]}),s.jsxs(Q,{size:"sm",variant:"outline",onClick:u,className:"gap-1.5 min-h-[36px]",children:[s.jsx(Na,{className:"w-3.5 h-3.5"}),"Analyser"]})]}),e&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-xs font-medium text-muted-foreground mb-2",children:["État des joueurs avant R",i]}),s.jsx("div",{className:"overflow-x-auto -mx-4 px-4",children:s.jsxs(dh,{children:[s.jsx(fh,{children:s.jsxs(Ls,{children:[s.jsx(ln,{className:"text-xs w-10",children:"TPN"}),s.jsx(ln,{className:"text-xs",children:"Score"}),s.jsx(ln,{className:"text-xs",children:"Adversaires"}),s.jsx(ln,{className:"text-xs",children:"Couleurs"}),s.jsx(ln,{className:"text-xs",children:"Flotteurs"}),s.jsx(ln,{className:"text-xs",children:"Préf."})]})}),s.jsx(hh,{children:e.map(f=>s.jsxs(Ls,{children:[s.jsx(Lt,{className:"font-mono font-bold text-xs",children:f.tpn}),s.jsx(Lt,{className:"font-mono text-xs",children:f.score}),s.jsx(Lt,{className:"font-mono text-xs",children:f.opponents.join(", ")||"–"}),s.jsx(Lt,{className:"font-mono text-xs",children:f.colorHistory.join("")||"–"}),s.jsx(Lt,{className:"font-mono text-xs",children:f.floatHistory.join("")||"–"}),s.jsx(Lt,{className:"font-mono text-xs",children:f.colorPref})]},f.tpn))})]})})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Appariements produits"}),s.jsx("pre",{className:"text-xs font-mono bg-muted/50 rounded-lg p-3 whitespace-pre-wrap",children:n})]})]})]})}function F1t(){const[e,t]=N.useState(null),[n,r]=N.useState(!1),[i,a]=N.useState(null),o=N.useCallback(()=>{r(!0),t(null),requestAnimationFrame(()=>{const x=P1t();t(x),a(new Date().toLocaleTimeString("fr-FR")),r(!1)})},[]),l=(e==null?void 0:e.filter(x=>x.passed).length)??0,c=(e==null?void 0:e.filter(x=>!x.passed).length)??0,u=(e==null?void 0:e.length)??0,d=u>0?Math.round(l/u*100):0,f=N.useMemo(()=>e?Math.round(e.reduce((x,y)=>x+y.executionTimeMs,0)*100)/100:0,[e]),h=O1t(),p=T1t();return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx("div",{className:"sticky top-0 z-10 backdrop-blur-xl bg-background/80 border-b border-border",children:s.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-4 flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center shrink-0",children:s.jsx(v5,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("h1",{className:"font-display text-lg font-bold text-foreground truncate",children:"Certification FIDE C.04.3"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Batterie de tests Swiss Dutch"})]})]}),s.jsxs(Q,{onClick:o,disabled:n,size:"sm",className:"shrink-0 min-h-[44px] px-4 gap-2",children:[n?s.jsx(Il,{className:"w-4 h-4 animate-spin"}):s.jsx(Na,{className:"w-4 h-4"}),e?"Relancer":"Lancer"]}
2756)]})}),s.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-6 space-y-4",children:[e&&s.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("span",{className:"text-2xl font-display font-bold text-foreground",children:[d,"%"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(we,{variant:"default",className:"bg-green-600 hover:bg-green-600 text-white",children:[l," passés"]}),c>0&&s.jsxs(we,{variant:"destructive",children:[c," échoués"]})]})]}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:[u," tests"]})]}),s.jsx(du,{value:d,className:"h-2"}),s.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted-foreground",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(gd,{className:"w-3 h-3"}),s.jsxs("span",{children:[u," tests en ",f,"ms"]})]}),i&&s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Vt,{className:"w-3 h-3"}),s.jsxs("span",{children:["Dernière exécution : ",i]})]})]})]}),s.jsx(I1t,{coverage:p}),!e&&!n&&s.jsxs("div",{className:"text-center py-12 space-y-4",children:[s.jsx("div",{className:"w-16 h-16 rounded-2xl bg-primary/10 flex items-center justify-center mx-auto",children:s.jsx(v5,{className:"w-8 h-8 text-primary"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-foreground font-medium",children:"Vérification de conformité FIDE"}),s.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Exécute ",h.length," catégories de tests contre le moteur d'appariement"]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Cliquez sur chaque test pour voir le scénario, les conditions et la référence FIDE"})]})]}),n&&s.jsxs("div",{className:"text-center py-12 space-y-3",children:[s.jsx(Il,{className:"w-8 h-8 text-primary animate-spin mx-auto"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Exécution des tests…"})]}),e&&s.jsx("div",{className:"space-y-3",children:h.map(x=>{const y=e.filter(_=>_.category===x),b=y.filter(_=>_.passed).length,w=b===y.length;return s.jsxs(Ix,{defaultOpen:!w,children:[s.jsx(Rx,{className:"w-full",children:s.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border bg-card px-4 py-3 hover:bg-accent/5 transition-colors min-h-[44px]",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[w?s.jsx(Jr,{className:"w-5 h-5 text-green-600 shrink-0"}):s.jsx(hi,{className:"w-5 h-5 text-destructive shrink-0"}),s.jsx("span",{className:"font-medium text-sm text-foreground text-left",children:x})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-xs text-muted-foreground",children:[b,"/",y.length]}),s.jsx(Wa,{className:"w-4 h-4 text-muted-foreground transition-transform duration-200"})]})]})}),s.jsx(Mx,{children:s.jsx("div",{className:"mt-1 space-y-1 pl-2",children:y.map((_,j)=>s.jsx(R1t,{result:_},j))})})]},x)})}),e&&s.jsx(M1t,{}),s.jsx(L1t,{})]})]})}function $1t(e,t){return e===0?"bg-destructive text-destructive-foreground":t?"bg-emerald-600 text-white":e>=400&&e<500?"bg-amber-500 text-white":"bg-destructive text-destructive-foreground"}function gk({response:e,loading:t,defaultOpen:n=!1,label:r}){const[i,a]=N.useState(n),[o,l]=N.useState(!1),[c,u]=N.useState(!1);if(t)return s.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3 text-sm text-muted-foreground flex items-center gap-2",children:[s.jsx(Vt,{className:"w-4 h-4 animate-pulse"}),"En cours…"]});if(!e)return null;const d=e.bodyJson!==null?JSON.stringify(e.bodyJson,null,2):e.bodyText||"(empty body)",f=async()=>{await navigator.clipboard.writeText(d),je.success("Réponse copiée")};return s.jsxs("div",{className:"rounded-md border border-border bg-card overflow-hidden",children:[s.jsxs("button",{type:"button",onClick:()=>a(h=>!h),className:"w-full flex items-center gap-2 px-3 py-2 hover:bg-muted/40 transition-colors text-left",children:[i?s.jsx(Wa,{className:"w-4 h-4 text-muted-foreground shrink-0"}):s.jsx(la,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.ok?s.jsx(Jr,{className:"w-4 h-4 text-emerald-600 shrink-0"}):s.jsx(hi,{className:"w-4 h-4 text-destructive shrink-0"}),s.jsx(we,{className:ae("font-mono text-xs",$1t(e.status,e.ok)),children:e.status||"ERR"}),r&&s.jsx("span",{className:"text-sm font-medium truncate",children:r}),s.jsxs("span",{className:"text-xs text-muted-foreground ml-auto shrink-0",children:[e.durationMs,"ms"]})]}),i&&s.jsxs("div",{className:"border-t border-border p-3 space-y-3 bg-muted/20",children:[s.jsx("div",{className:"text-xs text-muted-foreground font-mono break-all",children:e.url}),e.error&&s.jsxs("div",{className:"rounded border border-destructive/40 bg-destructive/10 p-2 text-sm text-destructive",children:[s.jsx("strong",{children:"Erreur :"})," ",e.error]}),e.jsonParseError&&s.jsxs("div",{className:"rounded border border-amber-500/40 bg-amber-500/10 p-2 text-xs text-amber-700 dark:text-amber-300",children:["Body non-JSON (",e.jsonParseError,")"]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs(Q,{size:"sm",variant:"outline",onClick:f,className:"h-7 text-xs",children:[s.jsx(Ko,{className:"w-3 h-3 mr-1"})," Copier"]}),s.jsxs(Q,{size:"sm",variant:"ghost",onClick:()=>l(h=>!h),className:"h-7 text-xs",children:[o?"Masquer":"Voir"," headers (",Object.keys(e.headers).length,")"]}),e.bodyJson!==null&&s.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>u(h=>!h),className:"h-7 text-xs",children:c?"JSON formaté":"Texte brut"})]}),o&&s.jsx("pre",{className:"text-xs bg-background border border-border rounded p-2 overflow-x-auto max-h-40",children:Object.entries(e.headers).map(([h,p])=>`${h}: ${p}`).join(`
2757`)}),s.jsx("pre",{className:"text-xs bg-background border border-border rounded p-2 overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:c?e.bodyText:d})]})]})}const B1t=`wit-diag-${Date.now()}`,z1t=[{id:"login",label:"POST /api/v1/auth/login (rejet credentials invalides — comportement attendu)",method:"POST",build:()=>({path:"/api/v1/auth/login",body:{email:"[email protected]
2757d",password:"__placeholder_invalid__"},skipAuth:!0}),evaluate:e=>{if(e.status===401)return{successOverride:!0,successNote:"✅ L'API rejette bien les credentials invalides"};if(e.status===200)return{successOverride:!1,successNote:"⚠️ Anomalie : credentials placeholder acceptés ?!"}}},{id:"list-tournaments",label:"GET /api/v1/tournaments?limit=20",method:"GET",build:()=>({path:"/api/v1/tournaments?limit=20"}),extract:(e,t)=>{const n=e.bodyJson,r=(n==null?void 0:n.tournaments)||(n==null?void 0:n.data)||(Array.isArray(n)?n:[]);t.tournamentsList=r;const i=r.find(a=>(a.participantCount??0)>=4);i&&(t.sourceTournamentId=String(i.id))}},{id:"fetch-source-players",label:"Sélection d'un tournoi source ≥4 joueurs (depuis cache list-tournaments)",method:"GET",requires:["list-tournaments"],build:e=>e.sourceTournamentId?{path:`/api/v1/tournaments/${e.sourceTournamentId}`}:{skip:!0,reason:"Aucun tournoi seedé ≥4 joueurs trouvé dans la liste"}},{id:"fetch-source-participants",label:"GET /tournaments/{seeded}/participants?limit=4",method:"GET",requires:["fetch-source-players"],build:e=>e.sourceTournamentId?{path:`/api/v1/tournaments/${e.sourceTournamentId}/participants?limit=4`}:{skip:!0,reason:"Aucun tournoi seedé ≥4 joueurs trouvé"},extract:(e,t)=>{const n=e.bodyJson,r=(n==null?void 0:n.participants)||(n==null?void 0:n.data)||(Array.isArray(n)?n:[]);t.sourcePlayerIds=r.map(i=>{var a;return String(i.playerId||i.player_id||((a=i.player)==null?void 0:a.id)||"")}).filter(Boolean).slice(0,4)}},{id:"create-tournament",label:"POST /api/v1/tournaments (création tournoi de test)",method:"POST",build:()=>{const e=new Date,t=new Date(e.getTime()+3*60*60*1e3);return{path:"/api/v1/tournaments",body:{name:`WIT Diagnostic ${e.toISOString().slice(0,16)} [${B1t}]`,type:"swiss",mode:"otb",timeControl:"5+2",timeControlType:"blitz",pairingEngine:"javafo",pairingSystem:"dutch",startDate:e.toISOString(),endDate:t.toISOString(),rounds:5,maxPlayers:16,minPlayers:4,entryFeeCents:0,currency:"EUR"}}},extract:(e,t)=>{var i,a;const n=e.bodyJson,r=((i=n==null?void 0:n.tournament)==null?void 0:i.id)||(n==null?void 0:n.id)||((a=n==null?void 0:n.data)==null?void 0:a.id);r&&(t.tournamentId=String(r))}},{id:"publish",label:"POST /tournaments/:id/publish (draft → published)",method:"POST",build:e=>({path:`/api/v1/tournaments/${e.tournamentId}/publish`})},{id:"start-registration",label:"POST /tournaments/:id/start-registration (published → registration)",method:"POST",build:e=>({path:`/api/v1/tournaments/${e.tournamentId}/start-registration`})},{id:"add-participants",label:"POST /tournaments/:id/participants × 4 (via playerIds existants)",method:"POST",build:e=>e.sourcePlayerIds.length<4?{skip:!0,reason:`Seulement ${e.sourcePlayerIds.length} playerIds source disponibles`}:{path:"__loop__"},loop:e=>e.sourcePlayerIds.slice(0,4).map(t=>({path:`/api/v1/tournaments/${e.tournamentId}/participants`,body:{playerId:t}})),extract:(e,t)=>{var i,a;const n=e.bodyJson,r=((i=n==null?void 0:n.participant)==null?void 0:i.id)||(n==null?void 0:n.id)||((a=n==null?void 0:n.data)==null?void 0:a.id);r&&t.participantIds.push(String(r))}},{id:"start-tournament",label:"POST /tournaments/:id/start (registration → ongoing)",method:"POST",build:e=>({path:`/api/v1/tournaments/${e.tournamentId}/start`}),requires:["add-participants"]},{id:"pair-r1",label:"POST /tournaments/:id/rounds/1/pair (génération R1)",method:"POST",build:e=>({path:`/api/v1/tournaments/${e.tournamentId}/rounds/1/pair`}),requires:["start-tournament"]},{id:"start-round-1",label:"POST /tournaments/:id/rounds/1/start (round scheduled → ongoing)",method:"POST",build:e=>({path:`/api/v1/tournaments/${e.tournamentId}/rounds/1/start`}),requires:["pair-r1"]},{id:"fetch-r1-pairings",label:"GET /tournaments/:id/rounds/1/pairings (récupère gameIds)",method:"GET",build:e=>({path:`/api/v1/tournaments/${e.tournamentId}/rounds/1/pairings`}),requires:["start-round-1"],extract:(e,t)=>{const n=e.bodyJson,r=(n==null?void 0:n.pairings)||(n==null?void 0:n.games)||(n==null?void 0:n.data)||(Array.isArray(n)?n:[]);t.gameIds=r.map(i=>
2757String(i.gameId||i.game_id||i.id||"")).filter(Boolean)}},{id:"results-r1",label:"PUT /tournaments/:id/games/:gid/result × N (saisie scores R1)",method:"PUT",requires:["fetch-r1-pairings"],build:e=>e.gameIds.length===0?{skip:!0,reason:"Aucun gameId récupéré (pairings vides ?)"}:{path:"__loop__"},loop:e=>{const t=["1-0","0-1","1/2-1/2","1-0"];return e.gameIds.map((n,r)=>({path:`/api/v1/tournaments/${e.tournamentId}/games/${n}/result`,body:{result:t[r%t.length]}}))}},{id:"complete-r1",label:"POST /tournaments/:id/rounds/1/complete (clôture R1)",method:"POST",requires:["results-r1"],build:e=>({path:`/api/v1/tournaments/${e.tournamentId}/rounds/1/complete`}),evaluate:e=>{if(e.status===400&&/already|completed|closed/i.test(e.bodyText))return{successOverride:!0,successNote:"ℹ️ Auto-clôturée après dernier résultat"}}},{id:"pair-r2",label:"POST /tournaments/:id/rounds/2/pair (continuité R2)",method:"POST",build:e=>({path:`/api/v1/tournaments/${e.tournamentId}/rounds/2/pair`}),requires:["complete-r1"]},{id:"start-round-2",label:"POST /tournaments/:id/rounds/2/start",method:"POST",requires:["pair-r2"],build:e=>({path:`/api/v1/tournaments/${e.tournamentId}/rounds/2/start`})},{id:"fetch-r2-pairings",label:"GET /tournaments/:id/rounds/2/pairings (récupère gameIds R2)",method:"GET",requires:["start-round-2"],build:e=>({path:`/api/v1/tournaments/${e.tournamentId}/rounds/2/pairings`}),extract:(e,t)=>{const n=e.bodyJson,r=(n==null?void 0:n.pairings)||(n==null?void 0:n.games)||(n==null?void 0:n.data)||(Array.isArray(n)?n:[]);t.gameIdsR2=r.map(i=>String(i.gameId||i.game_id||i.id||"")).filter(Boolean)}},{id:"results-r2",label:"PUT /tournaments/:id/games/:gid/result × N (saisie scores R2)",method:"PUT",requires:["fetch-r2-pairings"],build:e=>!e.gameIdsR2||e.gameIdsR2.length===0?{skip:!0,reason:"Aucun gameId R2 récupéré"}:{path:"__loop__"},loop:e=>{const t=["0-1","1-0","1/2-1/2","0-1"];return(e.gameIdsR2||[]).map((n,r)=>({path:`/api/v1/tournaments/${e.tournamentId}/games/${n}/result`,body:{result:t[r%t.length]}}))}},{id:"standings",label:"GET /tournaments/:id/standings",method:"GET",build:e=>({path:`/api/v1/tournaments/${e.tournamentId}/standings`})}];async function f3(e){const{data:t,error:n}=await re.functions.invoke("openpairing-proxy",{body:e});return n?{ok:!1,status:0,statusText:"Edge function error",durationMs:0,url:e.path,headers:{},bodyText:"",bodyJson:null,jsonParseError:null,error:n.message}:t}const U1t=new Set(["login","list-tournaments","fetch-source-players","fetch-source-participants","create-tournament"]);function q1t(){const[e,t]=N.useState([]),[n,r]=N.useState(!1),[i,a]=N.useState(null),[o,l]=N.useState(!1),c=async()=>{var y;r(!0),t([]);const d={sourcePlayerIds:[],participantIds:[],gameIds:[],tournamentsList:void 0,sourceTournamentId:void 0},f=[],h=new Set,p=b=>{var w;if(b.skipped)return!1;if(b.successOverride!==void 0)return b.successOverride;if(b.loopSummary){const _=b.loopSummary.match(/^(\d+)\/(\d+)/);return!!_&&_[1]===_[2]&&Number(_[2])>0}return!!((w=b.response)!=null&&w.ok)},x=b=>{f.push(b),p(b)&&h.add(b.stepId),t([...f])};for(const b of z1t){if(!U1t.has(b.id)&&!d.tournamentId){x({stepId:b.id,label:b.label,response:null,skipped:!0,skippedReason:"Aucun tournamentId (création échouée)"});continue}if(b.requires&&b.requires.length>0){const E=b.requires.filter(S=>!h.has(S));if(E.length>0){x({stepId:b.id,label:b.label,response:null,skipped:!0,skippedReason:`Prérequis non rempli : ${E.join(", ")} (échec en amont)`});continue}}const w=b.build(d);if("skip"in w){x({stepId:b.id,label:b.label,response:null,skipped:!0,skippedReason:w.reason});continue}if(b.loop&&w.path==="__loop__"){const E=b.loop(d);let S=null,T=0;for(const P of E){const O=await f3({method:b.method,path:P.path,body:P.body});S=O,O.ok&&(T++,b.extract&&b.extract(O,d))}x({stepId:b.id,label:b.label,response:S,loopSummary:`${T}/${E.length} requêtes OK (dernière réponse affichée)`});continue}const _=await f3({method:b.method,path:w.path,body:w.body,skipAuth:w.skipAuth});b.extract&&_.ok&&b.extract(_,d);const j=(y=b.evaluate)==null?void 0:y.call(b,_);x({stepId:b.id,label:b.label,response:_,successOverride:j==null?void 0:j.successOverride,successNote:j==null?void 0:j.successNote})}d.tournamentId&&a(d.tournamentId),r(!1),je.success("Tests terminés")},u=async()=>
2757{if(!i)return;l(!0);const d=await f3({method:"DELETE",path:`/api/v1/tournaments/${i}`});l(!1),t(f=>[...f,{stepId:"cleanup",label:`DELETE /tournaments/${i}`,response:d}]),d.ok?(je.success("Tournoi de test supprimé"),a(null)):je.error(`Échec suppression (${d.status})`)};return s.jsxs(Se,{children:[s.jsxs(kt,{children:[s.jsx(Et,{children:"Tests prédéfinis"}),s.jsx(Qs,{children:"Exécute séquentiellement tous les endpoints critiques (création → publication → inscription → participants → démarrage → R1 pair/start → R2) pour valider l'intégration OpenPairing. Un tournoi de test est créé puis supprimable manuellement via le bouton dédié."})]}),s.jsxs(De,{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(Q,{onClick:c,disabled:n,children:[n?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(Na,{className:"w-4 h-4"}),n?"Exécution…":"Lancer tous les tests"]}),i&&s.jsxs(Q,{variant:"destructive",onClick:u,disabled:o,children:[o?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(ua,{className:"w-4 h-4"}),"Supprimer tournoi de test (",i.slice(0,8),"…)"]})]}),e.length===0&&!n&&s.jsx("p",{className:"text-sm text-muted-foreground",children:'Aucun test exécuté. Cliquez sur "Lancer tous les tests".'}),s.jsx("div",{className:"space-y-2",children:e.map(d=>{var f;return s.jsx("div",{className:"space-y-1",children:d.skipped?s.jsxs("div",{className:"rounded-md border border-dashed border-border p-3 text-sm text-muted-foreground",children:[s.jsx("span",{className:"font-medium",children:d.label})," — ignoré : ",d.skippedReason]}):s.jsxs(s.Fragment,{children:[d.loopSummary&&s.jsx("p",{className:"text-xs text-muted-foreground font-medium",children:d.loopSummary}),d.successNote&&s.jsx("p",{className:d.successOverride===!0?"text-xs text-emerald-600 font-medium":d.successOverride===!1?"text-xs text-amber-600 font-medium":"text-xs text-sky-600 font-medium",children:d.successNote}),s.jsx(gk,{response:d.response,label:d.label,defaultOpen:d.successOverride===void 0?!((f=d.response)!=null&&f.ok):!d.successOverride})]})},d.stepId)})})]})]})}const wW=[{label:"GET /api/v1/tournaments",method:"GET",path:"/api/v1/tournaments"},{label:"POST /api/v1/tournaments",method:"POST",path:"/api/v1/tournaments",body:JSON.stringify({name:"Test",format:"swiss",rounds:5},null,2)},{label:"GET /api/docs",method:"GET",path:"/api/docs"},{label:"GET /swagger.json",method:"GET",path:"/swagger.json"},{label:"GET /health",method:"GET",path:"/health"}];function V1t(){const[e,t]=N.useState("GET"),[n,r]=N.useState("/api/v1/tournaments"),[i,a]=N.useState(""),[o,l]=N.useState(!1),[c,u]=N.useState(!1),[d,f]=N.useState(null),[h,p]=N.useState(null),[x,y]=N.useState(!1),[b,w]=N.useState("[email protected]"),[_,j]=N.useState("admin123"),[E,S]=N.useState(!1),[T,P]=N.useState(null),O=async()=>{p(null);let L;if(i.trim().length>0)try{L=JSON.parse(i)}catch(F){p(F instanceof Error?F.message:"JSON invalide");return}u(!0),f(null);const M={method:e,path:n,body:L,skipAuth:o};x&&!o&&(M.overrideAuth={email:b,password:_});const{data:B,error:U}=await re.functions.invoke("openpairing-proxy",{body:M});if(u(!1),U){f({ok:!1,status:0,statusText:"Edge function error",durationMs:0,url:n,headers:{},bodyText:"",bodyJson:null,jsonParseError:null,error:U.message});return}f(B)},D=async()=>{S(!0),P(null);const{data:L,error:M}=await re.functions.invoke("openpairing-proxy",{body:{method:"POST",path:"/api/v1/auth/login",body:{email:b,password:_},skipAuth:!0}});if(S(!1),M){P({ok:!1,status:0,statusText:"Edge function error",durationMs:0,url:"/api/v1/auth/login",headers:{},bodyText:"",bodyJson:null,jsonParseError:null,error:M.message});return}P(L)},R=L=>{const M=wW[L];t(M.method),r(M.path),a(M.body||""),p(null)};return s.jsxs(Se,{children:[s.jsxs(kt,{children:[s.jsx(Et,{children:"Explorateur libre"}),s.jsx(Qs,{children:"Envoie n'importe quelle requête vers l'API OpenPairing via le proxy admin."})]}),s.jsxs(De,{className:"space-y-4",children:[s.jsx("div",{className:"flex flex-wrap gap-2",children:wW.map((L,M)=>s.jsx(Q,{size:"sm",variant:"outline",onClick:()=>R(M),className:"text-xs",children:L.label},L.label))}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[120px_1fr] gap-2",children:[s.jsxs(li,{value:e,onValueChange:t,children:[s.jsx(Gs,{children:s.jsx(ci,{})}),s.jsx(Ks,{children:["GET","POST","PUT","DELETE","PATCH"].map(L=>s.jsx(Yn,{value:L,children:L},L))})]}),s.jsx(Ue,{value:n,onChange:L=>r(L.target.value),placeholder:"/api/v1/...",className:"font-mono"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Fe,{className:"text-xs",children:"Body (JSON, optionnel)"}),s.jsx($s,{value:i,onChange:L=>a(L.target.value),placeholder:'{"key": "value"}',className:"font-mono text-xs min-h-[120px]"}),h&&s.jsxs("p",{className:"text-xs text-destructive",children:["JSON invalide : ",h]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ya,{id:"skipAuth",checked:o,onCheckedChange:L=>l(!!L)}),s.jsx(Fe,{htmlFor:"skipAuth",className:"text-xs cursor-pointer",children:"Skip auto-login (pour endpoints publics ex. /health, /api/docs)"})]}),s.jsxs("details",{className:"rounded-md border border-border bg-muted/30 p-3",children:[s.jsx("summary",{className:"cursor-pointer text-xs font-medium select-none",children:"🔑 Override credentials (test only — non persisté)"}),s.jsxs("div",{className:"mt-3 space-y-3",children:[s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Utilise ces credentials pour le call ",s.jsx("code",{children:"/auth/login"})," à la place des secrets serveur. Pratique pour tester ",s.jsx("code",{children:"[email protected] / admin123"})," sans modifier la config."]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ya,{id:"useOverride",checked:x,onCheckedChange:L=>y(!!L)}),s.jsx(Fe,{htmlFor:"useOverride",className:"text-xs cursor-pointer",children:`Activer l'override pour les requêtes "Envoyer" ci-dessous`})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[s.jsx(Ue,{value:b,onChange:L=>w(L.target.value),placeholder:"email",className:"font-mono text-xs",autoComplete:"off"}
2757),s.jsx(Ue,{value:_,onChange:L=>j(L.target.value),placeholder:"password",type:"password",className:"font-mono text-xs",autoComplete:"off"})]}),s.jsxs(Q,{size:"sm",variant:"outline",onClick:D,disabled:E||!b||!_,children:[E?s.jsx(We,{className:"w-3 h-3 animate-spin"}):s.jsx(ca,{className:"w-3 h-3"}),"Tester ce login"]}),(E||T)&&s.jsx(gk,{response:T,loading:E,defaultOpen:!0,label:"POST /api/v1/auth/login (override)"})]})]}),s.jsxs(Q,{onClick:O,disabled:c||!n.startsWith("/"),children:[c?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(ca,{className:"w-4 h-4"}),"Envoyer"]}),(c||d)&&s.jsx(gk,{response:d,loading:c,defaultOpen:!0,label:`${e} ${n}`})]})]})}const H1t=[{method:"POST",path:"/api/v1/auth/login",description:"Authentification — retourne un JWT à passer en header Authorization Bearer.",status:"verified",body:{email:"[email protected]",password:"admin123"},response:{token:"eyJhbGciOiJIUzI1NiIs..."}},{method:"GET",path:"/api/v1/tournaments",description:"Liste tous les tournois accessibles. Paginé.",status:"verified",response:{tournaments:[{id:"uuid",name:"Open de Test",type:"swiss",rounds:5,status:"draft"}],total:42,limit:50,offset:0},notes:"⚠️ La réponse est un OBJET paginé, pas un array brut."},{method:"POST",path:"/api/v1/tournaments",description:"Crée un tournoi en statut `draft`. Tous les champs ci-dessous sont requis.",status:"verified",body:{name:"WIT Probe",type:"swiss",mode:"individual",timeControl:"5+2",timeControlType:"blitz",startDate:"2025-04-18T18:00:00.000Z",endDate:"2025-04-18T22:00:00.000Z",rounds:5,maxPlayers:64,minPlayers:4,pairingEngine:"javafo",pairingSystem:"dutch",tiebreaks:["buchholz","buchholz_cut1","sonneborn_berger"]},response:{id:"uuid",name:"WIT Probe",status:"draft"},notes:"⚠️ Champ `type` (pas `format`). Sans timeControlType/startDate/endDate/pairingEngine/pairingSystem → 400 'Field validation failed'."},{method:"GET",path:"/api/v1/tournaments/:id",description:"Détails d'un tournoi (statut, joueurs, rondes).",status:"verified"},{method:"DELETE",path:"/api/v1/tournaments/:id",description:"Supprime définitivement un tournoi. Retourne 204 No Content.",status:"verified"},{method:"POST",path:"/api/v1/tournaments/:id/publish",description:"Transition `draft` → `published`. Étape obligatoire avant d'ouvrir les inscriptions.",status:"verified",response:{id:"uuid",status:"published"}},{method:"POST",path:"/api/v1/tournaments/:id/start-registration",description:"Transition `published` → `registration`. Ouvre l'ajout de participants.",status:"verified",response:{id:"uuid",status:"registration"}},{method:"POST",path:"/api/v1/tournaments/:id/participants",description:"Inscrit UN joueur existant au tournoi (1 appel par joueur).",status:"verified",body:{playerId:"uuid-of-existing-player"},notes:"⚠️ `manualEntry: true` est BUGGÉ côté serveur (500). Utiliser uniquement des `playerId` de joueurs déjà créés via `GET /api/v1/players`."},{method:"GET",path:"/api/v1/tournaments/:id/participants",description:"Liste les joueurs inscrits au tournoi.",status:"verified"},{method:"POST",path:"/api/v1/tournaments/:id/start",description:"Transition `registration` → `ongoing`. Verrouille les inscriptions, prépare la R1.",status:"verified",response:{id:"uuid",status:"ongoing"}},{method:"POST",path:"/api/v1/tournaments/:id/rounds/:round/pair",description:"Génère les appariements de la ronde via JaVaFo. La ronde est créée en statut `scheduled`.",status:"verified",response:{pairings:[{board:1,white:{id:"p1",name:"..."},black:{id:"p2",name:"..."}}]},notes:"Après /pair, la ronde n'est PAS encore active. Il faut appeler /start pour la passer en `ongoing`."},{method:"POST",path:"/api/v1/tournaments/:id/rounds/:round/start",description:"Démarre une ronde déjà appariée (`scheduled` → `ongoing`).",status:"verified",response:{round:1,status:"ongoing"}},{method:"GET",path:"/api/v1/tournaments/:id/rounds/:round/pairings",description:"Récupère les appariements d'une ronde déjà générée.",status:"verified"},{method:"POST",path:"/api/v1/tournaments/:id/rounds/:round/results",description:"Enregistrement des résultats d'une ronde.",status:"broken",body:{results:[{board:1,result:"1-0"},{board:2,result:"1/2-1/2"}]}
2757,notes:"⛔ 404 systématique en sondage live. Endpoint pas (encore ?) exposé. Voir endpoints alternatifs `/games/:id` ou `/matches/:id` (à découvrir)."},{method:"GET",path:"/api/v1/tournaments/:id/standings",description:"Classement actuel avec tie-breaks (Buchholz, Sonneborn-Berger).",status:"verified",response:{currentRound:1,standings:[{rank:1,name:"Player 1",points:3,buchholz:5.5}]}}],W1t=({status:e})=>e==="verified"?s.jsxs(we,{className:"bg-emerald-600/90 text-white gap-1 text-[10px]",children:[s.jsx(Jr,{className:"w-3 h-3"})," vérifié"]}):e==="broken"?s.jsxs(we,{variant:"destructive",className:"gap-1 text-[10px]",children:[s.jsx(ur,{className:"w-3 h-3"})," cassé serveur"]}):s.jsxs(we,{variant:"secondary",className:"gap-1 text-[10px]",children:[s.jsx(Lk,{className:"w-3 h-3"})," à confirmer"]});function G1t(){const[e,t]=N.useState(!1),[n,r]=N.useState(null),[i,a]=N.useState(null),o=async l=>{t(!0),a(l);const{data:c,error:u}=await re.functions.invoke("openpairing-proxy",{body:{method:"GET",path:l,skipAuth:!0}});if(t(!1),u){r({ok:!1,status:0,statusText:"Edge error",durationMs:0,url:l,headers:{},bodyText:"",bodyJson:null,jsonParseError:null,error:u.message});return}r(c)};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"rounded-lg border border-amber-500/40 bg-amber-500/10 backdrop-blur-sm p-4 flex gap-3",children:[s.jsx(ur,{className:"w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"space-y-1 text-sm",children:[s.jsx("p",{className:"font-semibold text-amber-200",children:"Documentation tirée du sondage live de l'API"}),s.jsxs("p",{className:"text-muted-foreground",children:["Les bodies/réponses ci-dessous correspondent exactement à ce que"," ",s.jsx("code",{className:"text-xs px-1 py-0.5 bg-muted rounded",children:"ApiTestRunner"})," exécute en production. En cas de doute, lance les ",s.jsx("strong",{children:"Tests prédéfinis"})," — c'est la source de vérité exécutable. La doc statique de l'API officielle OpenPairing est partiellement fausse (champ ",s.jsx("code",{children:"type"})," vs ",s.jsx("code",{children:"format"}),", format paginé, cycle de vie obligatoire…)."]})]})]}),s.jsxs(Se,{children:[s.jsxs(kt,{children:[s.jsx(Et,{children:"Cycle de vie d'un tournoi"}),s.jsx(Qs,{children:'Transitions obligatoires. Sauter une étape = 400 "invalid status transition".'})]}),s.jsx(De,{children:s.jsx("pre",{className:"text-xs sm:text-sm font-mono bg-muted p-3 rounded overflow-x-auto leading-6",children:`Tournoi:
2758  draft ──POST /publish──▶ published
2759        ──POST /start-registration──▶ registration
2760        ──POST /participants × N (1 par joueur)──▶ registration
2761        ──POST /start──▶ ongoing
2762
2763Ronde N:
2764  (inexistante) ──POST /rounds/N/pair──▶ scheduled
2765                ──POST /rounds/N/start──▶ ongoing
2766                ──(saisie résultats — endpoint à confirmer)──▶ completed`})})]}),s.jsxs(Se,{children:[s.jsxs(kt,{children:[s.jsx(Et,{children:"Spec OpenAPI distante"}),s.jsx(Qs,{children:"Tente de récupérer la documentation hostée par l'instance OpenPairing."})]}),s.jsxs(De,{className:"space-y-3",children:[s.jsx("div",{className:"flex flex-wrap gap-2",children:["/api/docs","/swagger.json","/openapi.json"].map(l=>s.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>o(l),disabled:e,children:[e&&i===l?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(mc,{className:"w-4 h-4"}),"Tenter ",l]},l))}),n&&s.jsx(gk,{response:n,defaultOpen:!0,label:`Spec depuis ${i}`})]})]}),s.jsxs(Se,{children:[s.jsxs(kt,{children:[s.jsx(Et,{children:"Endpoints — référence intégration Chess Agenda"}),s.jsxs(Qs,{children:["Liste complète des endpoints utilisés par ",s.jsx("code",{children:"ApiTestRunner"}),", dans l'ordre d'appel."]})]}),s.jsx(De,{className:"space-y-3",children:H1t.map(l=>s.jsxs("div",{className:"rounded-md border border-border p-3 space-y-2 bg-card",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold "+(l.method==="GET"?"bg-blue-600 text-white":l.method==="POST"?"bg-emerald-600 text-white":l.method==="DELETE"?"bg-destructive text-destructive-foreground":"bg-
2766amber-500 text-white"),children:l.method}),s.jsx("code",{className:"text-sm font-mono break-all",children:l.path}),s.jsx(W1t,{status:l.status})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:l.description}),l.notes&&s.jsx("p",{className:"text-xs text-amber-300/90 bg-amber-500/5 border border-amber-500/20 rounded px-2 py-1.5",children:l.notes}),l.body&&s.jsxs("details",{className:"text-xs",children:[s.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"Body exemple"}),s.jsx("pre",{className:"mt-1 p-2 bg-muted rounded overflow-x-auto",children:JSON.stringify(l.body,null,2)})]}),l.response&&s.jsxs("details",{className:"text-xs",children:[s.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"Réponse exemple"}),s.jsx("pre",{className:"mt-1 p-2 bg-muted rounded overflow-x-auto",children:JSON.stringify(l.response,null,2)})]})]},`${l.method} ${l.path}`))})]})]})}function K1t(){const[e,t]=N.useState("idle"),[n,r]=N.useState(null),[i,a]=N.useState(""),o=async()=>{t("checking"),a("");const{data:l,error:c}=await re.functions.invoke("openpairing-proxy",{body:{method:"GET",path:"/api/v1/tournaments"}});if(c){t("error"),a(`Edge function: ${c.message}`),r(null);return}const u=l;r(u.durationMs),u.ok?(t("ok"),a(`HTTP ${u.status} — login + endpoint OK`)):u.status===0?(t("error"),a(`Réseau / login: ${u.error||"API injoignable"}`)):u.status===401||u.status===403?(t("error"),a(`HTTP ${u.status} — credentials invalides ou token rejeté`)):(t("error"),a(`HTTP ${u.status} ${u.statusText}`))};return N.useEffect(()=>{o()},[]),s.jsxs("div",{className:"container mx-auto p-4 sm:p-6 space-y-6 max-w-6xl",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("h1",{className:"text-2xl sm:text-3xl font-display font-semibold",children:"Diagnostic OpenPairing"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Validez la connexion à l'API JaVaFo et testez chaque endpoint avant intégration en production."})]}),s.jsxs(Se,{children:[s.jsx(kt,{children:s.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[s.jsxs("div",{children:[s.jsxs(Et,{className:"flex items-center gap-2",children:[s.jsx(bxe,{className:"w-5 h-5"})," Statut connexion"]}),s.jsx(Qs,{children:"Test automatique : login + GET /tournaments"})]}),s.jsxs(Q,{size:"sm",variant:"outline",onClick:o,disabled:e==="checking",children:[e==="checking"?s.jsx(We,{className:"w-4 h-4 animate-spin"}):s.jsx(xo,{className:"w-4 h-4"}),"Re-tester"]})]})}),s.jsx(De,{children:s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e==="checking"&&s.jsxs(we,{variant:"secondary",className:"gap-1",children:[s.jsx(We,{className:"w-3 h-3 animate-spin"})," Vérification…"]}),e==="ok"&&s.jsxs(we,{className:"bg-emerald-600 text-white gap-1",children:[s.jsx(Jr,{className:"w-3 h-3"})," Connecté"]}),e==="error"&&s.jsxs(we,{variant:"destructive",className:"gap-1",children:[s.jsx(hi,{className:"w-3 h-3"})," Indisponible"]}),n!==null&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:[n,"ms"]}),i&&s.jsx("span",{className:"text-sm text-muted-foreground",children:i})]})})]}),s.jsxs(Ka,{defaultValue:"tests",children:[s.jsxs(Ca,{children:[s.jsx(vn,{value:"tests",children:"Tests prédéfinis"}),s.jsx(vn,{value:"explorer",children:"Explorateur libre"}),s.jsx(vn,{value:"docs",children:"Documentation API"})]}),s.jsx(Sn,{value:"tests",className:"mt-4",children:s.jsx(q1t,{})}),s.jsx(Sn,{value:"explorer",className:"mt-4",children:s.jsx(V1t,{})}),s.jsx(Sn,{value:"docs",className:"mt-4",children:s.jsx(G1t,{})})]})]})}const Ky=e=>new Intl.NumberFormat("fr-FR",{style:"currency",currency:"EUR"}).format(e/100);function Y1t({data:e,isLoading:t}){const n=[{label:"Tickets payés",value:e?e.paid_count.toString():"-",icon:sn,sub:e?`${e.tickets_count} au total`:""},{label:"CA brut",value:e?Ky(e.gross_revenue_cents):"-",icon:lI,sub:"tous statuts"},{label:"CA net (payés)",value:e?Ky(e.net_revenue_cents):"-",icon:lu,sub:"hors annulés"},{label:"Marge plateforme",value:e?Ky(e.platform_net_cents):"-",icon:Bge,sub:"prix - crédit bar"},{label:"Crédit bar",value:e?Ky(e.bar_credit_cents):"-",icon:l1,sub:"à reverser"},{label:"TVA collectée (20%)",value:e?Ky(e.vat_platform_cents):"-",icon:gxe,sub:"sur marge plateforme"}];return s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:n.map(r=>s.jsxs(Se,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("span",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wide",children:r.label}),s.jsx(r.icon,{className:"w-4 h-4 text-muted-foreground"})]}),t?s.jsx(Ie,{className:"h-7 w-24"}):s.jsx("div",{className:"font-bold text-xl",children:r.value}),r.sub&&s.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:r.sub})]},r.label))})}function X1t(){return st({queryKey:["admin-events-lite"],queryFn:async()=>{const{data:e,error:t}=await re.from("events").select("id, title, venue_id, event_date").order("event_date",{ascending:!1}).limit(500);if(t)throw t;return e??[]}})}const Q1t=[{value:"lead",label:"Pré-inscrit"},{value:"reserved",label:"Réservé"},{value:"paid",label:"Payé"},{value:"checked_in",label:"Présent"},{value:"cancelled",label:"Annulé"},{value:"refunded",label:"Remboursé"}];
2766function J1t({value:e,onChange:t}){var u,d;const[n,r]=N.useState(e.search??""),{data:i}=qM(),{data:a}=X1t();N.useEffect(()=>{const f=setTimeout(()=>t({...e,search:n||void 0}),300);return()=>clearTimeout(f)},[n]);const o=e.search||e.venueId||e.eventId||((u=e.status)==null?void 0:u.length)||e.from||e.to||e.minCents||e.maxCents,l=e.from?new Date(e.from):void 0,c=e.to?new Date(e.to):void 0;return s.jsxs("div",{className:"bg-card border rounded-lg p-3 flex flex-wrap gap-2 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(_o,{className:"absolute left-2.5 top-2.5 w-4 h-4 text-muted-foreground"}),s.jsx(Ue,{value:n,onChange:f=>r(f.target.value),placeholder:"Email, nom, code...",className:"pl-8"})]}),s.jsxs(li,{value:e.venueId??"all",onValueChange:f=>t({...e,venueId:f==="all"?void 0:f,eventId:void 0}),children:[s.jsx(Gs,{className:"w-[180px]",children:s.jsx(ci,{placeholder:"Tous les lieux"})}),s.jsxs(Ks,{children:[s.jsx(Yn,{value:"all",children:"Tous les lieux"}),i==null?void 0:i.map(f=>s.jsx(Yn,{value:f.id,children:f.name},f.id))]})]}),s.jsxs(li,{value:e.eventId??"all",onValueChange:f=>t({...e,eventId:f==="all"?void 0:f}),children:[s.jsx(Gs,{className:"w-[200px]",children:s.jsx(ci,{placeholder:"Tous les événements"})}),s.jsxs(Ks,{children:[s.jsx(Yn,{value:"all",children:"Tous les événements"}),a==null?void 0:a.filter(f=>!e.venueId||f.venue_id===e.venueId).slice(0,100).map(f=>s.jsx(Yn,{value:f.id,children:f.title},f.id))]})]}),s.jsxs(li,{value:((d=e.status)==null?void 0:d[0])??"all",onValueChange:f=>t({...e,status:f==="all"?void 0:[f]}),children:[s.jsx(Gs,{className:"w-[140px]",children:s.jsx(ci,{placeholder:"Statut"})}),s.jsxs(Ks,{children:[s.jsx(Yn,{value:"all",children:"Tous les statuts"}),Q1t.map(f=>s.jsx(Yn,{value:f.value,children:f.label},f.value))]})]}),s.jsxs(Vm,{children:[s.jsx(Hm,{asChild:!0,children:s.jsxs(Q,{variant:"outline",className:ae("w-[150px] justify-start text-left font-normal",!l&&"text-muted-foreground"),children:[s.jsx(Jn,{className:"mr-2 h-4 w-4"}),l?Ze(l,"dd MMM",{locale:pt}):"Du"]})}),s.jsx(Lf,{className:"w-auto p-0",align:"start",children:s.jsx(K2,{mode:"single",selected:l,onSelect:f=>t({...e,from:f==null?void 0:f.toISOString()}),className:"p-3 pointer-events-auto"})})]}),s.jsxs(Vm,{children:[s.jsx(Hm,{asChild:!0,children:s.jsxs(Q,{variant:"outline",className:ae("w-[150px] justify-start text-left font-normal",!c&&"text-muted-foreground"),children:[s.jsx(Jn,{className:"mr-2 h-4 w-4"}),c?Ze(c,"dd MMM",{locale:pt}):"Au"]})}),s.jsx(Lf,{className:"w-auto p-0",align:"start",children:s.jsx(K2,{mode:"single",selected:c,onSelect:f=>t({...e,to:f?new Date(f.setHours(23,59,59,999)).toISOString():void 0}),className:"p-3 pointer-events-auto"})})]}),s.jsx(Ue,{type:"number",placeholder:"Min €",className:"w-[90px]",value:e.minCents?e.minCents/100:"",onChange:f=>t({...e,minCents:f.target.value?Math.round(Number(f.target.value)*100):void 0})}),s.jsx(Ue,{type:"number",placeholder:"Max €",className:"w-[90px]",value:e.maxCents?e.maxCents/100:"",onChange:f=>t({...e,maxCents:f.target.value?Math.round(Number(f.target.value)*100):void 0})}),o&&s.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>{r(""),t({})},children:[s.jsx(Er,{className:"w-4 h-4 mr-1"})," Réinitialiser"]}),o&&s.jsx(we,{variant:"secondary",children:"Filtres actifs"})]})}const h3=e=>new Intl.NumberFormat("fr-FR",{style:"currency",currency:"EUR"}).format(e/100),_W={lead:{label:"Pré-inscrit",className:"bg-purple-500/15 text-purple-700 dark:text-purple-400"},reserved:{label:"Réservé",className:"bg-yellow-500/15 text-yellow-700 dark:text-yellow-400"},paid:{label:"Payé",className:"bg-green-500/15 text-green-700 dark:text-green-400"},checked_in:{label:"Présent",className:"bg-blue-500/15 text-blue-700 dark:text-blue-400"},cancelled:{label:"Annulé",className:"bg-muted text-muted-foreground"},refunded:{label:"Remboursé",className:"bg-red-500/15 text-red-700 dark:text-red-400"}};function jW(e){return e.is_for_self&&e.user?(e.user.display_name??`${e.user.first_name??""} ${e.user.last_name??""}`.trim())||e.user.email||"Joueur":`${e.guest_first_name??""} ${e.guest_last_name??""}`.trim()||e.guest_email||"Invité"}function Z1t(e){var t;return e.is_for_self?((t=e.user)==null?void 0:t.email)??null:e.guest_email??null}function ebt({rows:e,isLoading:t,onSelect:n}){return t?s.jsx("div",{className:"space-y-2",children:Array.from({length:8}).map((r,i)=>s.jsx(Ie,{className:"h-14 w-full"},i))}):e!=null&&e.length?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"hidden md:block border rounded-lg overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[960px] text-sm",children:[s.jsx("thead",{className:"bg-muted/50",children:s.jsxs("tr",{className:"text-left",children:[s.jsx("th",{className:"p-3 font-medium",children:"Date"}),s.jsx("th",{className:"p-3 font-medium",children:"Client"}),s.jsx("th",{className:"p-3 font-medium",children:"Événement"}),s.jsx("th",{className:"p-3 font-medium",children:"Lieu"}),s.jsx("th",{className:"p-3 font-medium",children:"Statut"}),s.jsx("th",{className:"p-3 font-medium text-right",children:"Prix"}),s.jsx("th",{className:"p-3 font-medium text-right",children:"Marge"}),s.jsx("th",{className:"p-3 sticky right-0 bg-muted/50 shadow-[-8px_0_8px_-8px_hsl(var(--border))] w-[80px]"})]})}),s.jsx("tbody",{children:e.map(r=>{var o,l,c;const i=_W[r.status],a=Z1t(r);return s.jsxs("tr",{className:"group border-t hover:bg-muted/30 cursor-pointer",onClick:()=>n(r),children:[s.jsx("td",{className:"p-3 whitespace-nowrap text-muted-foreground",children:Ze(ne
2766w Date(r.created_at),"dd/MM/yy HH:mm",{locale:pt})}),s.jsxs("td",{className:"p-3",children:[s.jsx("div",{className:"font-medium",children:jW(r)}),s.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-2",children:[a&&s.jsx("span",{className:"truncate max-w-[180px]",children:a}),!r.is_for_self&&s.jsx(we,{variant:"outline",className:"text-[10px]",children:"Invité"}),r.is_walk_in&&s.jsx(we,{variant:"outline",className:"text-[10px]",children:"Walk-in"})]})]}),s.jsx("td",{className:"p-3 max-w-[200px] truncate",children:((o=r.event)==null?void 0:o.title)??"—"}),s.jsx("td",{className:"p-3 text-muted-foreground",children:((c=(l=r.event)==null?void 0:l.venue)==null?void 0:c.name)??"—"}),s.jsx("td",{className:"p-3",children:s.jsx(we,{className:i.className,variant:"secondary",children:i.label})}),s.jsx("td",{className:"p-3 text-right font-medium",children:h3(r.price_paid_cents)}),s.jsx("td",{className:"p-3 text-right text-muted-foreground",children:h3(r.price_paid_cents-r.credit_total_cents)}),s.jsx("td",{className:"p-3 sticky right-0 bg-card group-hover:bg-muted/30 shadow-[-8px_0_8px_-8px_hsl(var(--border))]",children:s.jsxs("div",{className:"flex items-center gap-1 justify-end",children:[a&&s.jsx(Q,{asChild:!0,variant:"ghost",size:"icon",onClick:u=>u.stopPropagation(),children:s.jsx("a",{href:`mailto:${a}`,"aria-label":"Envoyer un email",children:s.jsx(wr,{className:"w-4 h-4"})})}),s.jsx(la,{className:"w-4 h-4 text-muted-foreground"})]})})]},r.id)})})]})}),s.jsx("div",{className:"md:hidden space-y-2",children:e.map(r=>{var a,o,l;const i=_W[r.status];return s.jsxs("button",{onClick:()=>n(r),className:"w-full text-left border rounded-lg p-3 bg-card hover:bg-muted/30",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1",children:[s.jsx("div",{className:"font-medium truncate",children:jW(r)}),s.jsx(we,{className:i.className,variant:"secondary",children:i.label})]}),s.jsxs("div",{className:"text-sm text-muted-foreground truncate",children:[((a=r.event)==null?void 0:a.title)??"—"," · ",((l=(o=r.event)==null?void 0:o.venue)==null?void 0:l.name)??"—"]}),s.jsxs("div",{className:"flex items-center justify-between mt-2 text-sm",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:Ze(new Date(r.created_at),"dd/MM HH:mm",{locale:pt})}),s.jsx("span",{className:"font-semibold",children:h3(r.price_paid_cents)})]})]},r.id)})})]}):s.jsxs("div",{className:"border rounded-lg p-12 text-center",children:[s.jsx(lI,{className:"w-12 h-12 mx-auto text-muted-foreground mb-3"}),s.jsx("p",{className:"text-muted-foreground",children:"Aucune vente ne correspond à ces filtres."})]})}const Ofe={lead:["paid","cancelled"],reserved:["paid","cancelled"],paid:["checked_in","cancelled","refunded"],checked_in:["paid","refunded"],cancelled:["paid"],refunded:[]};function tbt(e,t){var n;return((n=Ofe[e])==null?void 0:n.includes(t))??!1}function nbt(e){return Ofe[e]??[]}function rbt(){const e=Ye();return dt({mutationFn:async({ticketId:t,newStatus:n,currentStatus:r})=>{var l;if(!tbt(r,n))throw new Error(`Transition non autorisée: ${r} → ${n}`);const{data:i,error:a}=await re.from("tickets").update({status:n,updated_at:new Date().toISOString()}).eq("id",t).select().single();if(a)throw a;const{data:o}=await re.auth.getUser();return await re.from("audit_logs").insert({action:"ticket.status_change",table_name:"tickets",record_id:t,user_id:((l=o.user)==null?void 0:l.id)??null,old_data:{status:r},new_data:{status:n}}),i},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-sales"]}),e.invalidateQueries({queryKey:["admin-sales-kpis"]}),je.success("Statut mis à jour")},onError:t=>je.error(t.message??"Erreur lors de la mise à jour")})}const Yy=e=>new Intl.NumberFormat("fr-FR",{style:"currency",currency:"EUR"}).format(e/100),NW={lead:"Pré-inscrit",reserved:"Réservé",paid:"Payé",checked_in:"Présent",cancelled:"Annulé",refunded:"Remboursé"};function sbt({sale:e,onClose:t}){var d,f,h,p,x,y;const[n,r]=N.useState(""),i=rbt();if(!e)return null;const a=e.is_for_self?((d=e.user)==null?void 0:d.display_name)??`${((f=e.user)==null?void 0:f.first_name)??""} ${((h=e.user)==null?void 0:h.last_name)??""}`.trim():`${e.guest_first_name??""} ${e.guest_last_name??""}`.trim(),o=e.is_for_self?(p=e.user)==null?void 0:p.email:e.guest_email,l=nbt(e.status),c=e.price_paid_cents-e.credit_total_cents,u=b=>{navigator.clipboard.writeText(b),je.success("Copié")};return s.jsx(dC,{open:!!e,onOpenChange:b=>!b&&t(),children:s.jsxs($b,{className:"w-full sm:max-w-lg overflow-y-auto",children:[s.jsx(nR,{children:s.jsxs(fC,{className:"flex items-center gap-2",children:["Vente ",s.jsx(we,{variant:"outline",className:"font-mono",children:e.reservation_code})]})}),s.jsxs("div",{className:"space-y-5 mt-5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(we,{variant:"secondary",children:NW[e.status]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:Ze(ne
2766w Date(e.created_at),"PPP HH:mm",{locale:pt})})]}),s.jsxs("section",{className:"border rounded-lg p-3",children:[s.jsxs("div",{className:"text-xs uppercase text-muted-foreground font-medium mb-2 flex items-center gap-1",children:[s.jsx(Cs,{className:"w-3 h-3"})," Client"]}),s.jsxs("div",{className:"font-medium",children:[a||"—"," ",!e.is_for_self&&s.jsx(we,{variant:"outline",className:"ml-2 text-[10px]",children:"Invité"})]}),o&&s.jsxs("div",{className:"flex items-center gap-2 text-sm mt-1",children:[s.jsx("a",{href:`mailto:${o}`,className:"text-primary hover:underline truncate",children:o}),s.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>u(o),children:s.jsx(Ko,{className:"w-3 h-3"})})]}),s.jsxs("div",{className:"flex gap-2 mt-3",children:[o&&s.jsx(Q,{asChild:!0,variant:"outline",size:"sm",children:s.jsxs("a",{href:`mailto:${o}`,children:[s.jsx(wr,{className:"w-3 h-3 mr-1"})," Contacter"]})}),e.user_id&&s.jsx(Q,{asChild:!0,variant:"outline",size:"sm",children:s.jsxs(Pe,{to:"/admin/users",state:{focusUserId:e.user_id},children:[s.jsx(Cs,{className:"w-3 h-3 mr-1"})," Profil"]})})]})]}),!e.is_for_self&&e.purchaser&&s.jsxs("section",{className:"border rounded-lg p-3",children:[s.jsx("div",{className:"text-xs uppercase text-muted-foreground font-medium mb-2",children:"Acheteur"}),s.jsx("div",{className:"font-medium",children:e.purchaser.display_name??`${e.purchaser.first_name??""} ${e.purchaser.last_name??""}`.trim()}),e.purchaser.email&&s.jsx("a",{href:`mailto:${e.purchaser.email}`,className:"text-primary text-sm hover:underline",children:e.purchaser.email})]}),s.jsxs("section",{className:"border rounded-lg p-3",children:[s.jsxs("div",{className:"text-xs uppercase text-muted-foreground font-medium mb-2 flex items-center gap-1",children:[s.jsx(x0,{className:"w-3 h-3"})," Événement"]}),s.jsx("div",{className:"font-medium",children:((x=e.event)==null?void 0:x.title)??"—"}),e.event&&s.jsx("div",{className:"text-sm text-muted-foreground",children:Ze(new Date(e.event.event_date),"PPP HH:mm",{locale:pt})}),((y=e.event)==null?void 0:y.venue)&&s.jsxs("div",{className:"text-sm text-muted-foreground flex items-center gap-1 mt-1",children:[s.jsx(gn,{className:"w-3 h-3"})," ",e.event.venue.name]}),e.event&&s.jsx(Q,{asChild:!0,variant:"outline",size:"sm",className:"mt-3",children:s.jsx(Pe,{to:`/admin/events/${e.event.id}`,children:"Ouvrir l'événement"})})]}),s.jsxs("section",{className:"border rounded-lg p-3 space-y-1.5 text-sm",children:[s.jsxs("div",{className:"text-xs uppercase text-muted-foreground font-medium mb-2 flex items-center gap-1",children:[s.jsx(el,{className:"w-3 h-3"})," Montants"]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Prix payé"}),s.jsx("span",{className:"font-semibold",children:Yy(e.price_paid_cents)})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Crédit bar inclus"}),s.jsx("span",{children:Yy(e.credit_total_cents)})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Crédit restant"}),s.jsx("span",{children:Yy(e.credit_remaining_cents)})]}),s.jsx(Fs,{className:"my-2"}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Marge plateforme"}),s.jsx("span",{className:"font-semibold",children:Yy(c)})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"TVA 20% (sur marge)"}),s.jsx("span",{children:Yy(Math.round(c/1.2*.2))})]}),e.payment_intent_id&&s.jsx("div",{className:"pt-2",children:s.jsxs("a",{href:`https://dashboard.stripe.com/payments/${e.payment_intent_id}`,target:"_blank",rel:"noreferrer",className:"text-primary text-xs hover:underline flex items-center gap-1",children:["Voir sur Stripe ",s.jsx(pd,{className:"w-3 h-3"})]})})]}),l.length>0&&s.jsxs("section",{className:"border rounded-lg p-3",children:[s.jsx("div",{className:"text-xs uppercase text-muted-foreground font-medium mb-2",children:"Changer le statut"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(li,{value:n,onValueChange:b=>r(b),children:[s.jsx(Gs,{className:"flex-1",children:s.jsx(ci,{placeholder:"Nouveau statut..."})}),s.jsx(Ks,{children:l.map(b=>s.jsx(Yn,{value:b,children:NW[b]},b))})]}),s.jsx(Q,{disabled:!n||i.isPending,onClick:()=>{n&&i.mutate({ticketId:e.id,newStatus:n,currentStatus:e.status},{onSuccess:()=>{r(""),t()}})},children:"Appliquer"})]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Le changement est tracé dans le journal d'audit. Pour un remboursement Stripe, utilise le tableau de bord Stripe."})]})]})]})})}const eD=50;function Dfe(e){var n;let t=re.from("tickets").select(`id, created_at, status, price_paid_cents, credit_total_cents, credit_remaining_cents,
2767       payment_intent_id, is_for_self, is_walk_in, user_id, purchaser_id,
2768       guest_first_name, guest_last_name, guest_email, reservation_code,
2769       event:events!inner(id, title, event_date, venue_id, venue:venues(id, name, slug))`,{count:"exact"});if(e.eventId&&(t=t.eq("event_id",e.eventId)),e.venueId&&(t=t.eq("event.venue_id",e.venueId)),(n=e.status)!=null&&n.length&&(t=t.in("status",e.status)),e.from&&(t=t.gte("created_at",e.from)),e.to&&(t=t.lte("created_at",e.to)),typeof e.minCents=="number"&&(t=t.gte("price_paid_cents",e.minCents)),typeof e.maxCents=="number"&&(t=t.lte("price_paid_cents",e.maxCe
2769nts)),e.search){const r=e.search.trim().replace(/[%,]/g,"");r&&(t=t.or(`guest_email.ilike.%${r}%,guest_first_name.ilike.%${r}%,guest_last_name.ilike.%${r}%,reservation_code.ilike.%${r}%`))}return t.order("created_at",{ascending:!1})}async function Ife(e){const t=new Set;e.forEach(r=>{r.user_id&&t.add(r.user_id),r.purchaser_id&&t.add(r.purchaser_id)});let n=new Map;if(t.size){const{data:r,error:i}=await re.from("profiles").select("id, display_name, first_name, last_name, email").in("id",Array.from(t));if(i)throw i;(r??[]).forEach(a=>n.set(a.id,a))}return e.map(r=>({...r,user:r.user_id?n.get(r.user_id)??null:null,purchaser:r.purchaser_id?n.get(r.purchaser_id)??null:null}))}function ibt(e,t){return st({queryKey:["admin-sales",e,t],queryFn:async()=>{const n=t*eD,r=n+eD-1,{data:i,error:a,count:o}=await Dfe(e).range(n,r);if(a)throw a;return{rows:await Ife(i??[]),count:o??0}}})}async function abt(e,t=1e4){const{data:n,error:r}=await Dfe(e).range(0,t-1);if(r)throw r;return Ife(n??[])}const U_=eD;function obt(e){return st({queryKey:["admin-sales-kpis",e],queryFn:async()=>{var i;const{data:t,error:n}=await re.rpc("admin_sales_kpis",{p_from:e.from??null,p_to:e.to??null,p_venue_id:e.venueId??null,p_event_id:e.eventId??null,p_status:(i=e.status)!=null&&i.length?e.status:null});if(n)throw n;const r=Array.isArray(t)?t[0]:t;return{tickets_count:Number((r==null?void 0:r.tickets_count)??0),paid_count:Number((r==null?void 0:r.paid_count)??0),cancelled_count:Number((r==null?void 0:r.cancelled_count)??0),refunded_count:Number((r==null?void 0:r.refunded_count)??0),gross_revenue_cents:Number((r==null?void 0:r.gross_revenue_cents)??0),net_revenue_cents:Number((r==null?void 0:r.net_revenue_cents)??0),bar_credit_cents:Number((r==null?void 0:r.bar_credit_cents)??0),platform_net_cents:Number((r==null?void 0:r.platform_net_cents)??0),vat_platform_cents:Number((r==null?void 0:r.vat_platform_cents)??0),avg_basket_cents:Number((r==null?void 0:r.avg_basket_cents)??0)}}})}const q_=e=>(e/100).toFixed(2).replace(".",",");function lbt(e){if(e==null)return"";const t=String(e).replace(/"/g,'""');return/[";\n\r]/.test(t)?`"${t}"`:t}function cbt(e){const t=["Date","Code","Statut","Événement","Date événement","Lieu","Client","Email","Acheteur","Email acheteur","Invité","Walk-in","Prix payé €","Crédit total €","Crédit restant €","Marge plateforme €","Payment intent"],n=e.map(r=>{var c,u,d,f,h;const i=r.is_for_self&&r.user?r.user.display_name??`${r.user.first_name??""} ${r.user.last_name??""}`.trim():`${r.guest_first_name??""} ${r.guest_last_name??""}`.trim(),a=r.is_for_self?((c=r.user)==null?void 0:c.email)??"":r.guest_email??"",o=r.purchaser?r.purchaser.display_name??`${r.purchaser.first_name??""} ${r.purchaser.last_name??""}`.trim():"",l=r.price_paid_cents-r.credit_total_cents;return[new Date(r.created_at).toLocaleString("fr-FR"),r.reservation_code,r.status,((u=r.event)==null?void 0:u.title)??"",r.event?new Date(r.event.event_date).toLocaleString("fr-FR"):"",((f=(d=r.event)==null?void 0:d.venue)==null?void 0:f.name)??"",i,a,o,((h=r.purchaser)==null?void 0:h.email)??"",r.is_for_self?"Non":"Oui",r.is_walk_in?"Oui":"Non",q_(r.price_paid_cents),q_(r.credit_total_cents),q_(r.credit_remaining_cents),q_(l),r.payment_intent_id??""].map(lbt).join(";")});return[t.join(";"),...n].join(`\r
2770`)}function ubt(e,t){const n=new Blob(["\uFEFF"+t],{type:"text/csv;charset=utf-8"}),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}function dbt(){var h,p,x,y,b,w,_,j;const[e,t]=N.useState({}),[n,r]=N.useState(0),[i,a]=N.useState(null),[o,l]=N.useState(!1),c=ibt(e,n),u=obt(e),d=Math.max(1,Math.ceil((((h=c.data)==null?void 0:h.count)??0)/U_)),f=async()=>{try{l(!0);const E=await abt(e);if(!E.length){je.info("Aucune vente à exporter");return}const S=cbt(E);ubt(`ventes-${new Date().toISOString().slice(0,10)}.csv`,S),je.success(`${E.length} ventes exportées`)}catch(E){je.error(E.message??"Erreur d'export")}finally{l(!1)}};return N.useEffect(()=>{document.title="Ventes · Admin · Chess Agenda"},[]),s.jsx(s.Fragment,{children:s.jsxs("div",{className:"p-4 md:p-6 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl md:text-3xl font-display font-bold",children:"Ventes"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Suivi de toutes les transactions tickets"})]}),s.jsxs(Q,{onClick:f,disabled:o,children:[s.jsx(mc,{className:"w-4 h-4 mr-2"})," ",o?"Export...":"Exporter CSV"]})]}),s.jsx(Y1t,{data:u.data,isLoading:u.isLoading}
2770),s.jsx(J1t,{value:e,onChange:E=>{t(E),r(0)}}),c.error&&s.jsxs("div",{className:"border border-destructive/40 bg-destructive/10 rounded-lg p-4 text-sm text-destructive",children:["Erreur de chargement. ",s.jsx(Q,{variant:"link",className:"px-1",onClick:()=>c.refetch(),children:"Réessayer"})]}),s.jsx(ebt,{rows:(p=c.data)==null?void 0:p.rows,isLoading:c.isLoading,onSelect:a}),((((x=c.data)==null?void 0:x.count)??0)>U_||(((b=(y=c.data)==null?void 0:y.rows)==null?void 0:b.length)??0)===U_||n>0)&&s.jsxs("div",{className:"flex items-center justify-between pt-2 flex-wrap gap-2",children:[s.jsxs("span",{className:"text-sm text-muted-foreground",children:[((w=c.data)==null?void 0:w.count)??0," résultats · page ",n+1," / ",d]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(Q,{variant:"outline",size:"sm",disabled:n===0,onClick:()=>{r(E=>Math.max(0,E-1)),window.scrollTo({top:0,behavior:"smooth"})},children:[s.jsx(fp,{className:"w-4 h-4"})," Préc."]}),s.jsxs(Q,{variant:"outline",size:"sm",disabled:n+1>=d||(((j=(_=c.data)==null?void 0:_.rows)==null?void 0:j.length)??0)<U_,onClick:()=>{r(E=>E+1),window.scrollTo({top:0,behavior:"smooth"})},children:["Suiv. ",s.jsx(la,{className:"w-4 h-4"})]})]})]}),s.jsx(sbt,{sale:i,onClose:()=>a(null)})]})})}const fbt={droit_image:"Droit à l'image",contenu_inapproprie:"Contenu inapproprié",autre:"Autre"};function hbt(){const{user:e}=Tt(),[t,n]=N.useState([]),[r,i]=N.useState({}),[a,o]=N.useState(!0),[l,c]=N.useState("pending"),u=async()=>{o(!0);let h=re.from("photo_reports").select(`id,photo_id,reason,message,status,created_at,
2771         photo:event_photos!photo_reports_photo_id_fkey(id,event_id,storage_path,thumbnail_path,status,caption,event:events(title))`).order("created_at",{ascending:!1}).limit(200);l==="pending"&&(h=h.eq("status","pending"));const{data:p,error:x}=await h;if(x)je.error(x.message);else{const y=p??[];n(y);const b=y.map(w=>{var _,j;return((_=w.photo)==null?void 0:_.thumbnail_path)||((j=w.photo)==null?void 0:j.storage_path)}).filter(w=>!!w);if(b.length){const{data:w}=await re.storage.from("event-photos").createSignedUrls(b,3600),_={};w==null||w.forEach(j=>{j.path&&j.signedUrl&&(_[j.path]=j.signedUrl)}),i(_)}}o(!1)};N.useEffect(()=>{u()},[l]);const d=async h=>{var y;if(!h.photo)return;const{error:p}=await re.from("event_photos").update({status:"visible",hidden_reason:null}).eq("id",h.photo.id),{error:x}=await re.from("photo_reports").update({status:"resolved_kept",resolved_at:new Date().toISOString(),resolved_by:(e==null?void 0:e.id)??null}).eq("id",h.id);p||x?je.error(((y=p||x)==null?void 0:y.message)??"Erreur"):(je.success("Photo conservée et re-publiée"),u())},f=async h=>{if(!h.photo||!confirm("Supprimer définitivement cette photo ?"))return;const p=[h.photo.storage_path,h.photo.thumbnail_path].filter(Boolean);await re.storage.from("event-photos").remove(p),await re.from("event_photos").delete().eq("id",h.photo.id),await re.from("photo_reports").update({status:"resolved_removed",resolved_at:new Date().toISOString(),resolved_by:(e==null?void 0:e.id)??null}).eq("id",h.id),je.success("Photo supprimée"),u()};return s.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold",children:"Modération photos"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Signalements et arbitrages sur les galeries de tournoi."})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Q,{variant:l==="pending"?"default":"outline",size:"sm",onClick:()=>c("pending"),children:"En attente"}),s.jsx(Q,{variant:l==="all"?"default":"outline",size:"sm",onClick:()=>c("all"),children:"Tous"})]})]}),a?s.jsx("div",{className:"text-muted-foreground",children:"Chargement…"}):t.length===0?s.jsx("div",{className:"text-muted-foreground py-12 text-center border border-dashed rounded-xl",children:"Aucun signalement."}):s.jsx("div",{className:"space-y-3",children:t.map(h=>{var y,b,w,_;const p=((y=h.photo)==null?void 0:y.thumbnail_path)||((b=h.photo)==null?void 0:b.storage_path),x=p?r[p]:void 0;return s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 roun
2771ded-xl border border-border/60 bg-card p-3",children:[s.jsx("div",{className:"w-full sm:w-40 aspect-square rounded-md overflow-hidden bg-muted shrink-0",children:x?s.jsx("img",{src:x,alt:"",className:"w-full h-full object-cover"}):s.jsx("div",{className:"w-full h-full animate-pulse"})}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(we,{variant:h.reason==="droit_image"?"destructive":"secondary",children:fbt[h.reason]}),s.jsx(we,{variant:"outline",children:h.status==="pending"?"En attente":h.status==="resolved_removed"?"Supprimée":"Conservée"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:eJ(new Date(h.created_at),{addSuffix:!0,locale:pt})}),((_=(w=h.photo)==null?void 0:w.event)==null?void 0:_.title)&&s.jsx(Pe,{to:`/admin/events/${h.photo.event_id}`,className:"text-xs underline text-primary",children:h.photo.event.title})]}),h.message&&s.jsx("p",{className:"text-sm text-foreground/80",children:h.message}),h.status==="pending"&&h.photo&&s.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[s.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>d(h),className:"gap-1",children:[s.jsx(is,{className:"w-3.5 h-3.5"})," Conserver & re-publier"]}),s.jsxs(Q,{size:"sm",variant:"destructive",onClick:()=>f(h),className:"gap-1",children:[s.jsx(ua,{className:"w-3.5 h-3.5"})," Supprimer la photo"]})]})]})]},h.id)})})]})}function mbt(){return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("main",{className:"pt-24 pb-16 px-4 overflow-x-hidden",children:s.jsx("div",{className:"container mx-auto max-w-4xl min-w-0",children:s.jsx(II,{})})})]})}function pbt(e){return st({queryKey:["event-checkedin-count",e],queryFn:async()=>{if(!e)return 0;const{data:t,error:n}=await re.rpc("get_event_checkedin_count",{p_event_id:e});return n?(console.error("Error fetching checked-in count:",n),0):t??0},enabled:!!e,staleTime:2e3,refetchInterval:3e4})}function Rfe(e){const t=Ye(),n=pbt(e);return N.useEffect(()=>{if(!e)return;const r=re.channel(`event-checkins-realtime-${e}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"checkins"},()=>{t.invalidateQueries({queryKey:["event-checkedin-count",e]}),t.refetchQueries({queryKey:["event-checkedin-count",e]})}).subscribe();return()=>{re.removeChannel(r)}},[e,t]),n}function gbt({eventId:e,eventStatus:t,registeredCount:n,checkedInCount:r,totalRounds:i,enabled:a=!0}){const o=Rr(),l=Ye(),[c,u]=N.useState(!1),[d,f]=N.useState("idle"),[h,p]=N.useState(null),x=N.useRef(!1),y=N.useRef(null),b=E6(),w=S6(),_=dw(),j=a&&t==="published"&&n>=2&&r===n&&!x.current,E=N.useCallback(async()=>{if(!x.current){x.current=!0,u(!0),p(null);try{f("starting"),console.log("[AutoStart] Step 1: Updating event status to ongoing");const{error:S}=await re.from("events").update({status:"ongoing"}).eq("id",e).eq("status","published");if(S)throw new Error(`Erreur changement statut: ${S.message}`);f("creating-round"),console.log("[AutoStart] Step 2: Creating Round 1");const{data:T}=await re.from("rounds").select("id").eq("event_id",e).eq("round_number",1);let P;T&&T.length>0?(console.log("[AutoStart] Round 1 already exists, skipping creation"),P=T[0].id):P=(await b.mutateAsync({eventId:e,roundNumber:1})).id,f("generating-pairings"),console.log("[AutoStart] Step 3: Generating Swiss pairings");const{data:O}=await re.from("pairings").select("id").eq("round_id",P).limit(1);!O||O.length===0?await w.mutateAsync({roundId:P,eventId:e}):console.log("[AutoStart] Pairings already exist, skipping generation"),f("starting-round"),console.log("[AutoStart] Step 4: Starting Round 1");const{data:D}=await re.from("rounds").select("status").eq("id",P).single();(D==null?void 0:D.status)==="pending"?await _.mutateAsync({roundId:P}):console.log("[AutoStart] Round already started, skipping"),f("complete"),console.log("[AutoStart] Complete! Redirecting to tournament page"),dn({title:"🎉 Tournoi démarré !",description:"Tous les joueurs sont arrivés. La Ronde 1 a commencé."}),l.invalidateQueries({queryKey:["event",e]}
2771),l.invalidateQueries({queryKey:["event-rounds",e]}),l.invalidateQueries({queryKey:["events"]}),l.invalidateQueries({queryKey:["venue-events"]}),setTimeout(()=>{o(`/venue/events/${e}/tournament`)},1500)}catch(S){console.error("[AutoStart] Error:",S),f("error"),p(S instanceof Error?S.message:"Erreur inconnue"),x.current=!1,dn({title:"Erreur de démarrage automatique",description:S instanceof Error?S.message:"Une erreur est survenue",variant:"destructive"})}}},[e,b,w,_,l,o]);return N.useEffect(()=>{if(y.current&&(clearTimeout(y.current),y.current=null),!!j)return console.log("[AutoStart] Trigger condition met, starting 3s debounce"),y.current=setTimeout(()=>{j&&!x.current&&(console.log("[AutoStart] Debounce complete, executing auto-start"),E())},3e3),()=>{y.current&&clearTimeout(y.current)}},[j,E]),N.useEffect(()=>()=>{y.current&&clearTimeout(y.current)},[]),{isAutoStarting:c,autoStartProgress:d,autoStartError:h,canAutoStart:j}}const xbt={idle:{message:"",icon:null,progressValue:0,color:"green"},starting:{message:"Tous les joueurs sont arrivés ! Démarrage du tournoi...",icon:s.jsx(sn,{className:"w-5 h-5"}),progressValue:20,color:"green"},"creating-round":{message:"Création de la Ronde 1...",icon:s.jsx(We,{className:"w-5 h-5 animate-spin"}),progressValue:40,color:"green"},"generating-pairings":{message:"Génération des appariements Swiss...",icon:s.jsx(sX,{className:"w-5 h-5"}),progressValue:65,color:"green"},"starting-round":{message:"Lancement de la première ronde...",icon:s.jsx(Na,{className:"w-5 h-5"}),progressValue:85,color:"green"},complete:{message:"Le tournoi a commencé ! Redirection...",icon:s.jsx(Cn,{className:"w-5 h-5"}),progressValue:100,color:"green"},error:{message:"Erreur lors du démarrage automatique",icon:s.jsx(El,{className:"w-5 h-5"}),progressValue:0,color:"red"}};function ybt({progress:e,error:t}){if(e==="idle")return null;const n=xbt[e],i={green:{bg:"from-emerald-500/20 via-emerald-400/10 to-emerald-500/5",border:"border-emerald-500/30",text:"text-emerald-400",progressBg:"bg-emerald-500/20",progressIndicator:"bg-emerald-500"},amber:{bg:"from-amber-500/20 via-amber-400/10 to-amber-500/5",border:"border-amber-500/30",text:"text-amber-400",progressBg:"bg-amber-500/20",progressIndicator:"bg-amber-500"},red:{bg:"from-red-500/20 via-red-400/10 to-red-500/5",border:"border-red-500/30",text:"text-red-400",progressBg:"bg-red-500/20",progressIndicator:"bg-red-500"}}[n.color];return s.jsxs(Xn.div,{initial:{opacity:0,y:-20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-20,scale:.95},transition:{duration:.4,ease:"easeOut"},className:`
2772        relative overflow-hidden rounded-2xl border backdrop-blur-md
2773        ${i.border} ${i.bg} bg-gradient-to-r
2774        p-4 md:p-5
2775      `,children:[s.jsx(Xn.div,{className:"absolute inset-0 opacity-30",animate:{background:["radial-gradient(circle at 20% 50%, rgba(16, 185, 129, 0.4), transparent 50%)","radial-gradient(circle at 80% 50%, rgba(16, 185, 129, 0.4), transparent 50%)","radial-gradient(circle at 20% 50%, rgba(16, 185, 129, 0.4), transparent 50%)"]},transition:{duration:3,repeat:1/0,ease:"easeInOut"}}),s.jsxs("div",{className:"relative z-10 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Xn.div,{className:`${i.text}`,animate:e!=="complete"&&e!=="error"?{scale:[1,1.1,1]}:{},transition:{duration:1.5,repeat:1/0},children:n.icon}),s.jsx("div",{className:"flex-1",children:s.jsx("p",{className:`font-medium ${i.text}`,children:e==="error"&&t?t:n.message})}),e!=="complete"&&e!=="error"&&s.jsxs(Xn.div,{className:"flex items-center gap-1.5 px-2 py-1 rounded-full bg-emerald-500/20 border border-emerald-500/30",animate:{opacity:[.7,1,.7]},transition:{duration:1.5,repeat:1/0},children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),s.jsx("span",{className:"text-xs font-medium text-emerald-400",children:"LIVE"})]})]}),e!=="error"&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(du,{value:n.progressValue,className:`h-2 ${i.progressBg}`}),s.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[s.jsx("span",{children:"Démarrage automatique"}),s.jsxs("span",{className:i.text,children:[n.progressValue,"%"]})]})]})]})]})}const kW=e=>e==="start"||e==="complete"||e==="reactivate"?e:null,CW={draft:{label:"Brouillon",variant:"secondary"},published:{label:"Publié",variant:"default"},ongoing:{label:"En cours",variant:"outline"},completed:{label:"Terminé",variant:"secondary"},cancelled:{label:"Annulé",variant:"destructive"}},vbt={swiss:"Système Suisse"};function bbt(){var M,B;const{id:e}=Wi(),[t,n]=N.useState(!1),[r,i]=N.useState(!1),[a,o]=N.useState(null),[l,c]=N.useState(!1),{data:u,isLoading:d,isFetching:f}=nh(e),{data:h,isFetching:p}=FR(e),{data:x,isFetching:y}=pfe(e),{data:b=0}=Rfe(e),w=qb(),{hasAccess:_,isLoading:j,isFetching:E}=WC(u==null?void 0:u.venue_id),S=N.useMemo(()=>h?h.filter(U=>["reserved","paid","checked_in"].includes(U.status)).length:0,[h]),T=N.useMemo(()=>u?Math.max(0,u.capacity-S):0,[u,S]),{isAutoStarting:P,autoStartProgress:O,autoStartError:D}=gbt({eventId:e||"",eventStatus:(u==null?void 0:u.status)||"",registeredCount:S,checkedInCount:b,totalRounds:(u==null?void 0:u.rounds_count)||4,enabled:_&&(u==null?void 0:u.status)==="published"&&S>=2});if(d||j)return s.jsxs("div",{className:"space-y-4 md:space-y-6",children:[s.jsx(Ie,{className:"h-6 w-32"}),s.jsx(Ie,{className:"h-10 w-full md:w-64"}),s.jsxs("div",{className:"space-y-3 md:hidden",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(Ie,{className:"h-20 rounded-xl"}),s.jsx(Ie,{className:"h-20 rounded-xl"})]}),s.jsx(Ie,{className:"h-12 rounded-xl"}),s.jsx(Ie,{className:"h-12 rounded-xl"}),s.jsx(Ie,{className:"h-40 rounded-xl"})]}),s.jsxs("div",{className:"hidden md:grid md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"md:col-span-2 space-y-6",children:[s.jsx(Ie,{className:"h-48"}),s.jsx(Ie,{className:"h-32"})]}),s.jsx(Ie,{className:"h-64"})]})]});if(!u)return s.jsxs("div",{className:"text-center py-12",children:[s.jsx("p",{className:"text-muted-foreground mb-4",children:"Cet événement n'existe pas."}),s.jsx(Pe,{to:"/venue",children:s.jsx(Q,{children:"Retour au dashboard"})})]});if(!_&&!d&&!j&&!f&&!E&&!l)return s.jsx(em,{to:"/venue",replace:!0});const R=async U=>{c(!0);try{await w.mutateAsync({id:u.id,status:U}),await new Promise(F=>setTimeout(F,300))}catch(F){dn({title:"Erreur",description:F instanceof Error?F.message:"Impossible de mettre à jour le statut. Veuillez réessayer.",variant:"destructive"})}finally{o(null),c(!1)}},L=async()=>{a==="start"?await R("ongoing"):a==="complete"?await R("completed"):a==="reactivate"&&await R("ongoing")};return s.jsxs("div",{className:"space-y-4 md:space-y-6 relative",children:[s.jsx(R2,{children:l&&s.jsx(Xn.div,{initial:{opacity:0}
2775,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:s.jsxs(Xn.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.9,opacity:0},className:"flex flex-col items-center gap-4 p-8 rounded-2xl bg-card/90 backdrop-blur-md border border-primary/20 shadow-2xl",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-primary/20"}),s.jsx(We,{className:"w-10 h-10 text-primary animate-spin relative z-10"})]}),s.jsx("p",{className:"text-lg font-medium text-foreground",children:"Mise à jour en cours..."}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Veuillez patienter"})]})})}),s.jsxs(Pe,{to:"/venue",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(Fn,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Retour aux événements"}),s.jsx("span",{className:"sm:hidden",children:"Retour"})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx(we,{variant:CW[u.status].variant,children:CW[u.status].label}),s.jsx(we,{variant:"outline",className:"text-xs",children:vbt[u.format||"swiss"]})]}),s.jsx("h1",{className:"font-display text-lg sm:text-xl md:text-2xl font-bold break-words",children:u.title}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>n(!0),className:"text-xs sm:text-sm gap-1.5 sm:gap-0 flex-1 min-w-[calc(50%-0.25rem)] sm:flex-none sm:min-w-0",children:[s.jsx($k,{className:"w-4 h-4 sm:mr-2"}),s.jsx("span",{className:"hidden sm:inline",children:"Modifier"}),s.jsx("span",{className:"sm:hidden",children:"Éditer"})]}),u.status==="draft"&&s.jsxs(Q,{size:"sm",onClick:()=>o("publish"),disabled:l,className:"text-xs sm:text-sm gap-1.5 sm:gap-0 flex-1 min-w-[calc(50%-0.25rem)] sm:flex-none sm:min-w-0",children:[s.jsx(ca,{className:"w-4 h-4 sm:mr-2"}),s.jsx("span",{className:"hidden sm:inline",children:"Publier"}),s.jsx("span",{className:"sm:hidden",children:"Publier"})]}),u.status==="published"&&s.jsxs(s.Fragment,{children:[s.jsxs(Q,{size:"sm",onClick:()=>o("start"),disabled:l,className:"text-xs sm:text-sm gap-1.5 sm:gap-0 flex-1 min-w-[calc(50%-0.25rem)] sm:flex-none sm:min-w-0",children:[s.jsx(Na,{className:"w-4 h-4 sm:mr-2"}),s.jsx("span",{className:"hidden sm:inline",children:"Démarrer"}),s.jsx("span",{className:"sm:hidden",children:"Lancer"})]}),s.jsxs(Q,{size:"sm",variant:"destructive",onClick:()=>o("cancel"),disabled:l,className:"text-xs sm:text-sm gap-1.5 sm:gap-0 flex-1 min-w-[calc(50%-0.25rem)] sm:flex-none sm:min-w-0",children:[s.jsx(hi,{className:"w-4 h-4 sm:mr-2"}),s.jsx("span",{className:"hidden sm:inline",children:"Annuler"}),s.jsx("span",{className:"sm:hidden",children:"Annuler"})]})]}),u.status==="ongoing"&&s.jsxs(s.Fragment,{children:[s.jsx(Pe,{to:`/venue/events/${u.id}/tournament`,className:"flex-1 min-w-[calc(50%-0.25rem)] sm:flex-none sm:min-w-0",children:s.jsxs(Q,{size:"sm",className:"w-full text-xs sm:text-sm gap-1 sm:gap-2",children:[s.jsx(Xt,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Gérer le tournoi"}),s.jsx("span",{className:"sm:hidden",children:"Tournoi"})]})}),s.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>o("complete"),disabled:l,className:"text-xs sm:text-sm gap-1.5 sm:gap-0 flex-1 min-w-[calc(50%-0.25rem)] sm:flex-none sm:min-w-0",children:[s.jsx(Cn,{className:"w-4 h-4 sm:mr-2"}),s.jsx("span",{className:"hidden sm:inline",children:"Terminer"}),s.jsx("span",{className:"sm:hidden",children:"Finir"})]})]}),u.status==="completed"&&s.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>o("reactivate"),disabled:l,className:"text-xs sm:text-sm gap-1.5 sm:gap-0 flex-1 min-w-[calc(50%-0.25rem)] sm:flex-none sm:min-w-0",children:[s.jsx(xo,{className:"w-4 h-4 sm:mr-2"}),s.jsx("span",{className:"hidden sm:inline",children:"Réactiver"}),s.jsx("span",{className:"sm:hidden",children:"Rouvrir"})]})]})]}),s.jsx(R2,{children:P&&s.jsx(ybt,{progress:O,error:D})}),x&&["published","ongoing"].includes(u.status)&&!P&&s.jsx(gfe,{status:x,currentCountOverride:S,isSyncing:p||y}),s.jsxs("div",{className:"grid lg:grid-cols-3 gap-4 lg:gap-6",children:[s.jsxs("div",{className:"space-y-4 min-w-0 order-1 lg:order-2",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:hidden",children:[s.jsxs("div",{className:"relative overflow-hidden rounded-xl border border-border/50 bg-gradient-to-br from-primary/5 via-background to-primary/10 p-4 text-center",children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-primary/5 to-transparent"}),s.jsxs("div",{className:"relative",children:[s.jsxs("p",{className:"text-xl sm:text-2xl font-bold tabular-nums",children:[S,"/",u.capacity]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Inscrits"})]})]}),s.jsx("div",{className:"relative overflow-hidden rounded-xl border border-border/50 bg-gradient-to-br from-muted/30 via-background to-muted/10 p-4 text-center",children:s.jsxs("div",{className:"relative",children:[s.jsx("p",{className:"text-xl sm:text-2xl font-bold tabular-nums",children:T}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Places restantes"})]})})]}),s.jsxs(Se,{className:"border-primary/20 lg:border-border",children:[s.jsx(kt,{className:"pb-2 md:pb-4 px-3 sm:px-6",children:s.jsxs(Et,{className:"text-base flex flex-wrap items-center justify-between gap-2",children:[s.jsx("span",{className:"truncate",children:"Actions rapides"}),u.status==="ongoing"&&s.jsxs(we,{variant:"outline",className:"gap-1 border-primary/50 text-primary text-xs shrink-0",children:[s.jsx(gd,{className:"w-3 h-3"}),"En cours"]})]})}),s.jsxs(De,{className:"space-y-2 md:space-y-3 px-3 sm:px-6",children:[s.jsx(lfe,{count:S,showRecommendation:S%2!==0}),s.jsx(Pe,{to:`/venue/events/${u.id}/checkin`,className:"block",children:s.jsxs(Q,{className:"w-full h-12 text-sm md:text-base justify-start gap-3 min-w-0",children:[s.jsx(nu,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"truncate",children:"Check-in & Consommation"})]})}),s.jsxs(Q,{variant:"outline",className:"w-full h-12 justify-start border-dashed border-2 border-primary/30 hover:bg-primary/5 text-sm min-w-0",onClick:()=>i(!0),disabled:!["published","ongoing"].includes(u.status),children:[s.jsx(cs,{className:"w-5 h-5 mr-3 shrink-0"}),s.jsx("span",{className:"flex-1 text-left truncate",children:"Walk-in"}),S>=u.capacity?s.jsx(we,{variant:"secondary",className:"text-xs shrink-0",children:"Complet"}):s.jsxs(we,{variant:"outline",className:"text-xs shrink-0",children:[T," place",T>1?"s":""]})]}),s.jsx(Pe,{to:`/events/${u.id}`,target:"_blank",className:"block",children:s.jsxs(Q,{variant:"outline",className:"w-full h-10 justify-start text-sm min-w-0",children:[s.jsx(pd,{className:"w-4 h-4 mr-2 shrink-0"}),s.jsx("span",{className:"truncate",children:"Voir la page publique"})]})})]})]}),s.jsxs(Se,{className:"hidden lg:block",children:[s.jsx(kt,{children:s.jsx(Et,{children:"Statistiques"})}),s.jsxs(De,{className:"space-y-4",children:[s.jsxs("div",{className:"flex justify-between items-center gap-3",children:[s.jsxs("span",{className:"text-muted-foreground flex items-center gap-2 min-w-0 truncate",children:[s.jsx(sn,{className:"w-4 h-4 shrink-0"}),"Inscrits"]}),s.jsxs(we,{variant:"secondary",className:"text-sm font-medium shrink-0",children:[S," / ",u.capacity]})]}),x&&s.jsxs("div",{className:"flex justify-between items-center gap-3",children:[s.jsxs("span",{className:"text-muted-foreground flex items-center gap-2 min-w-0 truncate",children:[s.jsx(iX,{className:"w-4 h-4 shrink-0"}
2775),"Seuil minimum"]}),s.jsxs(we,{variant:x.isAtRisk?"destructive":"outline",className:"text-sm shrink-0",children:[S," / ",x.minRequired]})]}),s.jsxs("div",{className:"flex justify-between items-center gap-3",children:[s.jsx("span",{className:"text-muted-foreground min-w-0 truncate",children:"Places restantes"}),s.jsx("span",{className:"font-medium shrink-0",children:T})]}),s.jsx(Fs,{}),s.jsxs("div",{className:"flex justify-between items-center gap-3",children:[s.jsxs("span",{className:"text-muted-foreground flex items-center gap-2 min-w-0 truncate",children:[s.jsx(Fk,{className:"w-4 h-4 shrink-0"}),"Prix ticket"]}),s.jsxs("span",{className:"font-medium shrink-0",children:[(u.price_cents/100).toFixed(2),"€"]})]}),s.jsxs("div",{className:"flex justify-between items-center gap-3",children:[s.jsxs("span",{className:"text-muted-foreground flex items-center gap-2 min-w-0 truncate",children:[s.jsx(el,{className:"w-4 h-4 shrink-0"}),"Crédit conso"]}),s.jsxs("span",{className:"font-medium shrink-0",children:[(u.credit_amount_cents/100).toFixed(2),"€"]})]}),s.jsx(Fs,{}),s.jsxs("div",{className:"flex justify-between items-center gap-3",children:[s.jsx("span",{className:"text-muted-foreground min-w-0 truncate",children:"Revenus estimés"}),s.jsxs("span",{className:"font-bold text-lg text-primary shrink-0",children:[(u.credit_amount_cents*S/100).toFixed(2),"€"]})]})]})]})]}),s.jsxs("div",{className:"lg:col-span-2 min-w-0 space-y-4 md:space-y-6 order-2 lg:order-1",children:[s.jsxs(Se,{children:[s.jsx(kt,{className:"pb-3 md:pb-6 px-3 sm:px-6",children:s.jsx(Et,{className:"text-base md:text-lg",children:"Informations"})}),s.jsxs(De,{className:"space-y-4 px-3 sm:px-6",children:[s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"w-10 h-10 shrink-0 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(Jn,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Date"}),s.jsx("p",{className:"font-medium text-sm sm:text-base break-words",children:Ze(new Date(u.event_date),"EEEE d MMMM yyyy",{locale:pt})})]})]}),s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"w-10 h-10 shrink-0 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(Vt,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Heure"}),s.jsx("p",{className:"font-medium text-sm sm:text-base",children:Ze(new Date(u.event_date),"HH'h'mm")})]})]}),s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"w-10 h-10 shrink-0 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(sn,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Capacité"}),s.jsxs("p",{className:"font-medium text-sm sm:text-base",children:[u.capacity," places"]})]})]}),s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"w-10 h-10 shrink-0 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(Xt,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Format"}),s.jsxs("p",{className:"font-medium text-sm sm:text-base",children:[u.rounds_count," rondes, ",u.time_control||"10+0"]})]})]})]}),(u.description||u.rules)&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"md:hidden",children:s.jsxs(wC,{type:"single",collapsible:!0,className:"w-full",children:[u.description&&s.jsxs(kx,{value:"description",className:"border-b-0",children:[s.jsx(Cx,{className:"text-sm py-3 hover:no-underline",children:"Description"}),s.jsx(Ex,{className:"text-sm text-muted-foreground whitespace-pre-wrap break-words pb-4",children:u.description})]}),u.rules&&s.jsxs(kx,{value:"rules",className:"border-b-0",children:[s.jsx(Cx,{className:"text-sm py-3 hover:no-underline",children:"Règles"}),s.jsx(Ex,{className:"text-sm text-muted-foreground whitespace-pre-wrap break-words pb-4",children:u.rules})]})]})}),s.jsxs("div",{className:"hidden md:block space-y-4",children:[u.description&&s.jsxs(s.Fragment,{children:[s.jsx(Fs,{}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Description"}),s.jsx("p",{className:"whitespace-pre-wrap break-words",children:u.description})]})]}),u.rules&&s.jsxs(s.Fragment,{children:[s.jsx(Fs,{}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Règles"}),s.jsx("p",{className:"whitespace-pre-wrap break-words",children:u.rules})]})]})]})]})]})]}),s.jsxs(Se,{children:[s.jsx(kt,{className:"pb-3 md:pb-6 px-3 sm:px-6",children:s.jsxs(Et,{className:"text-base md:text-lg flex flex-wrap items-center justify-between gap-2",children:[s.jsx("span",{className:"truncate",children:"Participants"}),s.jsxs(we,{variant:"outline",className:"text-xs md:text-sm shrink-0",children:[S,"/",u.capacity]})]})}),s.jsx(De,{className:"px-3 sm:px-6",children:s.jsx(M8,{eventId:u.id,capacity:u.capacity,allowManualCheckin:!0})})]}),s.jsx(hfe,{eventId:u.id,eventTitle:u.title,eventDate:u.event_date,venueName:(M=u.venue)==null?void 0:M.name})]})]}),s.jsx(sw,{open:t,onOpenChange:n,event:u,preselectedVenueId:u.venue_id,venueName:(B=u==null?void 0:u.venue)==null?void 0:B.name}),s.jsx(rS,{open:r,onOpenChange:i,event:{id:u.id,title:u.title,price_cents:u.price_cents,credit_amount_cents:u.credit_amount_cents,capacity:u.capacity,status:u.status,coupon_mode:u.coupon_mode??null,paper_coupon_label:u.paper_coupon_label??null,paper_coupon_description:u.paper_coupon_description??null,paper_coupon_formulas:u.paper_coupon_formulas??null,venue:u.venue??null},currentTicketCount:S}),s.jsx(mfe,{open:!!kW(a),onOpenChange:()=>o(null),action:kW(a),eventDate:u.event_date,onConfirm:L,isLoading:w.isPending}
2775),s.jsx(yr,{open:a==="publish"||a==="cancel",onOpenChange:()=>o(null),children:s.jsxs(sr,{className:"max-w-[90vw] sm:max-w-lg",children:[s.jsxs(ir,{children:[s.jsx(or,{children:a==="publish"?"Publier l'événement ?":"Annuler l'événement ?"}),s.jsx(lr,{children:a==="publish"?"L'événement sera visible publiquement et les inscriptions seront ouvertes.":"Cette action est irréversible. Les joueurs inscrits seront notifiés."})]}),s.jsxs(ar,{className:"flex-col gap-2 sm:flex-row",children:[s.jsx(cr,{className:"w-full sm:w-auto",children:"Annuler"}),s.jsx(vr,{onClick:()=>R(a==="publish"?"published":"cancelled"),className:`w-full sm:w-auto ${a==="cancel"?"bg-destructive hover:bg-destructive/90":""}`,children:a==="publish"?"Publier":"Confirmer l'annulation"})]})]})})]})}function Mfe(){const[e,t]=N.useState(()=>({isOnline:typeof navigator<"u"?navigator.onLine:!0,connectionQuality:"good",lastOnlineAt:Date.now(),effectiveType:null})),n=N.useCallback(()=>{if(!navigator.onLine)return"offline";const o=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(o){const l=o.effectiveType;if(t(c=>({...c,effectiveType:l})),l==="2g"||l==="slow-2g"||o.downlink&&o.downlink<1)return"slow"}return"good"},[]),r=N.useCallback(()=>{const o=n();t({isOnline:!0,connectionQuality:o,lastOnlineAt:Date.now(),effectiveType:e.effectiveType})},[n,e.effectiveType]),i=N.useCallback(()=>{t(o=>({...o,isOnline:!1,connectionQuality:"offline"}))},[]),a=N.useCallback(()=>{if(navigator.onLine){const o=n();t(l=>({...l,connectionQuality:o}))}},[n]);return N.useEffect(()=>{const o=n();t(c=>({...c,connectionQuality:o})),window.addEventListener("online",r),window.addEventListener("offline",i);const l=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return l&&l.addEventListener("change",a),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",i),l&&l.removeEventListener("change",a)}},[r,i,a,n]),e}const tD=(e,t)=>t.some(n=>e instanceof n);let EW,SW;function wbt(){return EW||(EW=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function _bt(){return SW||(SW=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const nD=new WeakMap,m3=new WeakMap,iS=new WeakMap;function jbt(e){const t=new Promise((n,r)=>{const i=()=>{e.removeEventListener("success",a),e.removeEventListener("error",o)},a=()=>{n(Om(e.result)),i()},o=()=>{r(e.error),i()};e.addEventListener("success",a),e.addEventListener("error",o)});return iS.set(t,e),t}function Nbt(e){if(nD.has(e))return;const t=new Promise((n,r)=>{const i=()=>{e.removeEventListener("complete",a),e.removeEventListener("error",o),e.removeEventListener("abort",o)},a=()=>{n(),i()},o=()=>{r(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",a),e.addEventListener("error",o),e.addEventListener("abort",o)});nD.set(e,t)}let rD={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return nD.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Om(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function Lfe(e){rD=e(rD)}function kbt(e){return _bt().includes(e)?function(...t){return e.apply(sD(this),t),Om(this.request)}:function(...t){return Om(e.apply(sD(this),t))}}function Cbt(e){return typeof e=="function"?kbt(e):(e instanceof IDBTransaction&&Nbt(e),tD(e,wbt())?new Proxy(e,rD):e)}function Om(e){if(e instanceof IDBRequest)return jbt(e);if(m3.has(e))return m3.get(e);const t=Cbt(e);return t!==e&&(m3.set(e,t),iS.set(t,e)),t}const sD=e=>iS.get(e);function Ebt(e,t,{blocked:n,upgrade:r,blocking:i,terminated:a}={}){const o=indexedDB.open(e,t),l=Om(o);return r&&o.addEventListener("upgradeneeded",c=>{r(Om(o.result),c.oldVersion,c.newVersion,Om(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),l.then(c=>{a&&c.addEventListener("close",()=>a()),i&&c.addEventListener("versionchange",u=>i(u.oldVersion,u.newVersion,u))}).catch(()=>{}),l}const Sbt=["get","getKey","getAll","getAllKeys","count"],Abt=["put","add","delete","clear"],p3=new Map;function AW(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(p3.get(t))return p3.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=Abt.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||Sbt.includes(n)))return;const a=async function(o,...l){const c=this.transaction(o,i?"readwrite":"readonly");let u=c.store;
2775return r&&(u=u.index(l.shift())),(await Promise.all([u[n](...l),i&&c.done]))[0]};return p3.set(t,a),a}Lfe(e=>({...e,get:(t,n,r)=>AW(t,n)||e.get(t,n,r),has:(t,n)=>!!AW(t,n)||e.has(t,n)}));const Tbt=["continue","continuePrimaryKey","advance"],TW={},iD=new WeakMap,Ffe=new WeakMap,Pbt={get(e,t){if(!Tbt.includes(t))return e[t];let n=TW[t];return n||(n=TW[t]=function(...r){iD.set(this,Ffe.get(this)[t](...r))}),n}};async function*Obt(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;t=t;const n=new Proxy(t,Pbt);for(Ffe.set(n,t),iS.set(n,sD(t));t;)yield n,t=await(iD.get(n)||t.continue()),iD.delete(n)}function PW(e,t){return t===Symbol.asyncIterator&&tD(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&tD(e,[IDBIndex,IDBObjectStore])}Lfe(e=>({...e,get(t,n,r){return PW(t,n)?Obt:e.get(t,n,r)},has(t,n){return PW(t,n)||e.has(t,n)}}));const Dbt="wit-chess-offline",Ibt=1;let V_=null;async function Ul(){return V_||(V_=await Ebt(Dbt,Ibt,{upgrade(e){if(e.objectStoreNames.contains("events")||e.createObjectStore("events",{keyPath:"id"}).createIndex("by-venue","venue_id"),!e.objectStoreNames.contains("tickets")){const t=e.createObjectStore("tickets",{keyPath:"id"});t.createIndex("by-event","event_id"),t.createIndex("by-code","qr_code")}if(e.objectStoreNames.contains("products")||e.createObjectStore("products",{keyPath:"id"}).createIndex("by-venue","venue_id"),!e.objectStoreNames.contains("pending_actions")){const t=e.createObjectStore("pending_actions",{keyPath:"id"});t.createIndex("by-type","type"),t.createIndex("by-created","createdAt")}e.objectStoreNames.contains("sync_metadata")||e.createObjectStore("sync_metadata",{keyPath:"key"})}}),V_)}async function Rbt(e){await(await Ul()).put("events",{...e,cached_at:Date.now()})}async function Mbt(e){const n=(await Ul()).transaction("tickets","readwrite");for(const r of e)await n.store.put({...r,cached_at:Date.now()});await n.done}async function Lbt(e){return(await Ul()).getFromIndex("tickets","by-code",e)}async function OW(e,t){const n=await Ul(),r=await n.get("tickets",e);r&&await n.put("tickets",{...r,...t,cached_at:Date.now()})}async function Fbt(e){const n=(await Ul()).transaction("products","readwrite");for(const r of e)await n.store.put({...r,cached_at:Date.now()});await n.done}async function DW(e){const t=await Ul(),n=`${e.type}-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return await t.add("pending_actions",{...e,id:n,createdAt:Date.now(),retryCount:0}),n}async function $bt(){return(await Ul()).getAllFromIndex("pending_actions","by-created")}async function Bbt(){return(await Ul()).count("pending_actions")}async function IW(e){await(await Ul()).delete("pending_actions",e)}async function zbt(e){const t=await Ul(),n=await t.get("pending_actions",e);n&&await t.put("pending_actions",{...n,retryCount:n.retryCount+1})}async function Ubt(e){const n=await(await Ul()).get("events",e);if(!n)return!1;const r=Date.now()-n.cached_at,i=24*60*60*1e3;return r<i}async function qbt(){const e=await Ul();return{events:await e.count("events"),tickets:await e.count("tickets"),products:await e.count("products"),pendingActions:await e.count("pending_actions")}}const Vbt=3;function Hbt(){const e=Ye(),{isOnline:t}=Mfe(),[n,r]=N.useState({pendingCount:0,isSyncing:!1,lastSyncAt:null,failedActions:[]}),i=N.useRef(!1),a=N.useCallback(async()=>{try{const u=await Bbt();r(d=>({...d,pendingCount:u}))}catch(u){console.error("Failed to get pending count:",u)}},[]),o=async u=>{try{switch(u.type){case"checkin":{const{ticketId:d,checkedAt:f}=u.payload,{error:h}=await re.from("checkins").insert({ticket_id:d,checked_at:f});if(h){if(h.code==="23505")return console.log("Ticket already checked in, removing from queue"),!0;throw h}return!0}case"consumption":{const{ticketId:d,items:f,totalCents:h}=u.payload,p=f.map(y=>{const b=y.productId.startsWith("custom-");return{ticket_id:d,product_id:b?null:y.productId,product_name:y.productName,amount_cents:y.priceCents*y.quantity,quantity:y.quantity,vat_rate:y.vatRate??(b?.1:.2)}}),{error:x}=await re.from("consumptions").insert(p);if(x)throw x;return!0}case"score":{const{pairingId:d,result:f,claim:h,playerId:p}=u.payload,{data:x}=await re.from("game_results").select("id").eq("pairing_id",d).maybeSingle();if(x){const{error:y}=await re.from("game_results").update({[h]:f}).eq("pairing_id",d);if(y)throw y}else{const{error:y}=await re.from("game_results").insert({pairing_id:d,result:"pending",[h]:f,reported_by:p});if(y)throw y}return!0}default:return console.warn("Unknown action type:",u.type),!0}}catch(d){return console.error(`Failed to process action ${u.id}:`,d),!1}},l=N.useCallback(async()=>
2775{if(!(i.current||!t)){i.current=!0,r(u=>({...u,isSyncing:!0}));try{const u=await $bt();if(u.length===0){r(h=>({...h,isSyncing:!1,lastSyncAt:Date.now()})),i.current=!1;return}const d=[];let f=0;for(const h of u)await o(h)?(await IW(h.id),f++):h.retryCount>=Vbt?(d.push(h.id),await IW(h.id)):await zbt(h.id);await a(),e.invalidateQueries({queryKey:["tickets"]}),e.invalidateQueries({queryKey:["event-tickets"]}),e.invalidateQueries({queryKey:["consumptions"]}),e.invalidateQueries({queryKey:["pairings"]}),f>0&&je.success(`${f} action${f>1?"s":""} synchronisée${f>1?"s":""}`,{description:"Vos données hors-ligne ont été envoyées au serveur."}),d.length>0&&je.error(`${d.length} action${d.length>1?"s":""} échouée${d.length>1?"s":""}`,{description:"Certaines actions n'ont pas pu être synchronisées."}),r(h=>({...h,isSyncing:!1,lastSyncAt:Date.now(),failedActions:d}))}catch(u){console.error("Sync error:",u),r(d=>({...d,isSyncing:!1}))}finally{i.current=!1}}},[t,e,a]),c=N.useCallback(async()=>{if(!t){je.error("Pas de connexion",{description:"Impossible de synchroniser sans connexion internet."});return}await l()},[t,l]);return N.useEffect(()=>{t&&l()},[t,l]),N.useEffect(()=>{a()},[a]),N.useEffect(()=>{const u=setInterval(a,5e3);return()=>clearInterval(u)},[a]),{...n,forceSync:c,refreshPendingCount:a}}function Wbt({eventId:e,venueId:t,eventData:n,className:r,variant:i="button"}){const[a,o]=N.useState(!1),[l,c]=N.useState(!1),[u,d]=N.useState(0);N.useEffect(()=>{(async()=>{const p=await Ubt(e);if(o(p),p){const x=await qbt();d(x.tickets)}})()},[e]);const f=async()=>{if(!l){c(!0);try{const h={id:e,venue_id:t,title:n.title,event_date:n.event_date,status:n.status,credit_amount_cents:n.credit_amount_cents,cached_at:Date.now()};await Rbt(h);const{data:p,error:x}=await re.from("tickets").select(`
2776          id,
2777          event_id,
2778          user_id,
2779          qr_code,
2780          reservation_code,
2781          status,
2782          credit_total_cents,
2783          credit_remaining_cents,
2784          guest_first_name,
2785          guest_last_name,
2786          checkin:checkins(id)
2787        `).eq("event_id",e).in("status",["paid","checked_in"]);if(x)throw x;const y=[...new Set((p||[]).map(D=>D.user_id))],{data:b}=await re.from("profiles").select("id, first_name, last_name, display_name").in("id",y),w=new Map((b==null?void 0:b.map(D=>[D.id,D]))||[]),_={coupon_mode:n.coupon_mode??null,paper_coupon_label:n.paper_coupon_label??null,paper_coupon_description:n.paper_coupon_description??null,paper_coupon_formulas:n.paper_coupon_formulas??null,venue:n.venue??null,credit_amount_cents:n.credit_amount_cents},j=Vb(_,n.venue??null),E=od(_,n.venue??null).shortLabel,S=(p||[]).map(D=>{const R=w.get(D.user_id);return{id:D.id,event_id:D.event_id,user_id:D.user_id,qr_code:D.qr_code,reservation_code:D.reservation_code,status:D.status,credit_total_cents:D.credit_total_cents,credit_remaining_cents:D.credit_remaining_cents,guest_first_name:D.guest_first_name,guest_last_name:D.guest_last_name,is_checked_in:Array.isArray(D.checkin)&&D.checkin.length>0,profile:R?{first_name:R.first_name,last_name:R.last_name,display_name:R.display_name}:void 0,coupon_mode:j,perk_short_label:E,cached_at:Date.now()}});await Mbt(S),d(S.length);const{data:T,error:P}=await re.from("products").select("id, venue_id, name, price_cents, category").eq("venue_id",t).eq("is_active",!0);if(P)throw P;const O=(T||[]).map(D=>({id:D.id,venue_id:D.venue_id,name:D.name,price_cents:D.price_cents,category:D.category,cached_at:Date.now()}));await Fbt(O),o(!0),je.success("Mode hors-ligne prêt",{description:`${S.length} ticket${S.length>1?"s":""} et ${O.length} produit${O.length>1?"s":""} en cache`})}catch(h){console.error("Failed to prepare offline mode:",h),je.error("Erreur de préparation",{description:"Impossible de mettre les données en cache"})}finally{c(!1)}}};return i==="badge"?s.jsxs(we,{variant:a?"outline":"secondary",className:ae("cursor-pointer transition-all",a?"border-emerald-500/50 text-emerald-400 hover:bg-emerald-500/10":"hover:bg-muted",r),onClick:f,children:[l?s.jsx(We,{className:"w-3 h-3 mr-1 animate-spin"}):a?s.jsx(j5,{className:"w-3 h-3 mr-1"}):s.jsx(mc,{className:"w-3 h-3 mr-1"}),a?`${u} tickets en cache`:"Préparer hors-ligne"]}):s.jsx(Q,{variant:a?"outline":"secondary",size:"sm",onClick:f,disabled:l,className:ae("transition-all",a&&"border-emerald-500/50 text-emerald-400 hover:bg-emerald-500/10",r),children:l?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),"Préparation..."]}):a?s.jsxs(s.Fragment,{children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),"Prêt pour hors-ligne (",u," tickets)"]}):s.jsxs(s.Fragment,{children:[s.jsx(mc,{className:"w-4 h-4 mr-2"}),"Préparer le mode hors-ligne"]})})}function Gbt(){const{id:e}=Wi(),[t,n]=N.useState("scan"),[r,i]=N.useState("scanner"),[a,o]=N.useState(""),[l,c]=N.useState(null),[u,d]=N.useState(!1),[f,h]=N.useState(null),[p,x]=N.useState("qr_scan"),{isOnline:y}=Mfe(),{pendingCount:b}=Hbt(),{data:w,isLoading:_}=nh(e),{hasAccess:j,isLoading:E,isFetching:S}=WC(w==null?void 0:w.venue_id),{data:T,isLoading:P,refetch:O}=bte(a,e),{data:D=[]}=tE(w==null?void 0:w.venue_id),R=SC(),L=Xoe(),M=l||T,B=$c(M),U=!!w&&Vb(w)==="paper",F=!!l&&l.coupon_mode==="paper",H=U||F;N.useEffect(()=>{M&&B&&t!=="consume"&&!H&&n("consume")},[M,B,H]),N.useEffect(()=>{(async()=>
2787{if(!a||y){c(null);return}try{const G=await Lbt(a);c(G?{...G,isOffline:!0}:null)}catch(G){console.error("Offline ticket lookup failed:",G),c(null)}})()},[a,y]);const z=N.useCallback(Z=>{o(Z),c(null),x("qr_scan")},[]),K=N.useCallback(Z=>{if($c(Z)){je.info("Ce participant est déjà présent");return}h({id:Z.id,reservation_code:Z.reservation_code,guest_first_name:Z.guest_first_name,guest_last_name:Z.guest_last_name,profile:Z.profile,checkin:null}),x("name_search"),d(!0)},[]),W=async Z=>{if(f)try{await R.mutateAsync({ticketId:f.id,method:"name_search",identityVerified:!0,notes:Z}),d(!1),h(null),je.success("Check-in validé avec vérification d'identité")}catch{}},q=async()=>{if(M)if(!y&&l)try{await OW(M.id,{is_checked_in:!0}),await DW({type:"checkin",payload:{ticketId:M.id,checkedAt:new Date().toISOString(),method:p},userId:M.user_id,eventId:e}),c(Z=>Z?{...Z,is_checked_in:!0}:null),H||n("consume"),je.success("Check-in enregistré (hors-ligne)",{description:"Sera synchronisé au retour de la connexion"})}catch(Z){console.error("Offline check-in failed:",Z),je.error("Erreur lors du check-in hors-ligne")}else await R.mutateAsync({ticketId:M.id,method:p}),await O(),H||n("consume")},oe=async(Z,G)=>{if(M)if(y)await L.mutateAsync({ticketId:M.id,items:Z}),await O();else{const se=M.credit_remaining_cents-G;await OW(M.id,{credit_remaining_cents:Math.max(0,se)}),await DW({type:"consumption",payload:{ticketId:M.id,items:Z,totalCents:G},userId:M.user_id,eventId:e}),c(ce=>ce?{...ce,credit_remaining_cents:Math.max(0,se)}:null),je.success("Consommation enregistrée (hors-ligne)",{description:"Sera synchronisée au retour de la connexion"})}},J=()=>{o(""),c(null),n("scan")};if(_||E)return s.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[s.jsx(Ie,{className:"h-8 w-48"}),s.jsx(Ie,{className:"h-96"})]});if(!w)return s.jsxs("div",{className:"max-w-2xl mx-auto text-center py-12",children:[s.jsx("p",{className:"text-muted-foreground mb-4",children:"Événement non trouvé"}),s.jsx(Pe,{to:"/venue",children:s.jsx(Q,{children:"Retour au dashboard"})})]});if(!j&&!_&&!E&&!S)return s.jsx(em,{to:"/venue",replace:!0});const Y=(l==null?void 0:l.credit_remaining_cents)??(M==null?void 0:M.credit_remaining_cents)??(M==null?void 0:M.credit_total_cents)??0;return s.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Pe,{to:`/venue/events/${e}`,className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(Fn,{className:"w-4 h-4"}),"Retour à l'événement"]}),s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"font-display text-xl font-bold",children:"Check-in & Conso"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:w.title})]}),s.jsxs("div",{className:"flex flex-col items-end gap-2",children:[s.jsx(we,{variant:"outline",children:Ze(new Date(w.event_date),"d MMM HH'h'mm",{locale:pt})}),!y&&s.jsxs(we,{variant:"secondary",className:"bg-amber-500/20 text-amber-400 border-amber-500/30",children:[s.jsx(j5,{className:"w-3 h-3 mr-1"}),"Hors-ligne"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Wbt,{eventId:e,venueId:w.venue_id,eventData:{title:w.title,event_date:w.event_date,status:w.status,credit_amount_cents:w.credit_amount_cents,coupon_mode:w.coupon_mode??null,paper_coupon_label:w.paper_coupon_label??null,paper_coupon_description:w.paper_coupon_description??null,paper_coupon_formulas:w.paper_coupon_formulas??null,venue:w.venue??null},variant:"badge"}),b>0&&s.jsxs(we,{variant:"outline",className:"text-orange-400 border-orange-500/30",children:[b," en attente"]})]})]}),s.jsxs(Ka,{value:r,onValueChange:Z=>i(Z),children:[s.jsxs(Ca,{className:"grid w-full grid-cols-2",children:[s.jsxs(vn,{value:"scanner",className:"gap-2",children:[s.jsx(nu,{className:"w-4 h-4"}),"Scanner QR"]}),s.jsxs(vn,{value:"list",className:"gap-2",children:[s.jsx(sn,{className:"w-4 h-4"}),"Liste participants"]})]}),s.jsxs(Sn,{value:"scanner",className:"space-y-6 mt-6",children:[s.jsxs("div",{className:"flex items-center justify-center gap-1 xs:gap-2 sm:gap-3 overflow-x-auto scrollbar-hide py-1",children:[s.jsxs("div",{className:ae("flex items-center gap-1 sm:gap-1.5 px-2 xs:px-2.5 sm:px-3 py-1.5 rounded-full text-xs sm:text-sm whitespace-nowrap shrink-0 transition-colors",t==="scan"?"bg-primary/90 text-primary-foreground backdrop-blur-sm shadow-[inset_0_1px_0_rgba(255,255,255,0.1)]":"bg-muted/60 text-muted-foreground backdrop-blur-sm border border-border/50"),children:[s.jsx(nu,{className:"w-4 h-4 shrink-0"}),s.jsx("span",{className:"hidden sm:inline",children:"Scanner"})]}),s.jsx("div",{className:"w-2 xs:w-4 sm:w-8 h-px bg-gradient-to-r from-transparent via-border to-transparent shrink-0"}),s.jsxs("div",{className:ae("flex items-center gap-1 sm:gap-1.5 px-2 xs:px-2.5 sm:px-3 py-1.5 rounded-full text-xs sm:text-sm whitespace-nowrap shrink-0 transition-colors",t==="checkin"||M&&!B?"bg-primary/90 text-primary-foreground backdrop-blur-sm shadow-[inset_0_1px_0_rgba(255,255,255,0.1)]":"bg-muted/60 text-muted-foreground backdrop-blur-sm border border-border/50"),children:[s.jsx(Cn,{className:"w-4 h-4 shrink-0"}),s.jsx("span",{className:"hidden sm:inline",children:"Check-in"})]}),s.jsx("div",{className:"w-2 xs:w-4 sm:w-8 h-px bg-gradient-to-r from-transparent via-border to-transparent shrink-0"}),s.jsxs("div",{className:ae("flex items-center gap-1 sm:gap-1.5 px-2 xs:px-2.5 sm:px-3 py-1.5 rounded-full text-xs sm:text-sm whitespace-nowrap shrink-0 transition-colors",t==="consume"||B?"bg-primary/90 text-primary-foreground backdrop-blur-sm shadow-[inset_0_1px_0_rgba(255,255,255,0.1)]":"bg-muted/60 text-muted-foreground backdrop-blur-sm border border-border/50"),children:[s.jsx(el,{className:"w-4 h-4 shrink-0"}),s.jsx("span",{className:"hidden sm:inline",children:"Conso"})]})]}),!M&&s.jsxs(Se,{children:[s.jsx(kt,{className:"p-3 sm:p-6 pb-2 sm:pb-4",children:s.jsxs(Et,{className:"text-base flex items-center justify-between",children:["Scanner un ticket",!y&&s.jsx("span",{className:"text-xs font-normal text-amber-400",children:"Mode hors-ligne actif"})]})}),s.jsxs(De,{className:"p-3 sm:p-6 pt-0",children:[s.jsx(Cfe,{onScan:z,isSearching:P&&y,showSearchMode:!0,eventId:e,onParticipantSelect:K}),a&&!P&&!M&&s.jsxs("div",{className:"mt-4 p-4 rounded-lg bg-destructive/10 text-destructive text-center",children:[s.jsx("p",{className:"font-medium",children:"Ticket non trouvé"}),s.jsxs("p",{className:"text-sm",children:["Vérifiez le code : ",a]}),!y&&s.jsx("p",{className:"text-xs mt-2 text-muted-foreground",children:"Ce ticket n'est pas dans le cache hors-ligne"})]})]})]}),M&&s.jsxs("div",{className:"space-y-6",children:[(l==null?void 0:l.isOffline)&&s.jsxs("div",{className:"p-3 rounded-lg bg-amber-500/10 border border-amber-500/30 flex items-center gap-2",children:[s.jsx(j5,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{className:"text-sm text-amber-400",children:"Ticket chargé depuis le cache hors-ligne"})]}),T?(()=>{const Z=w,G=Z==null?void 0:Z.venue,se=(Z==null?void 0:Z.coupon_mode)==="paper"||(Z==null?void 0:Z.coupon_mode)==null&&(G==null?void 0:G.default_coupon_mode)==="paper",ce=(Z==null?void 0:Z.paper_coupon_label)&&String(Z.paper_coupon_label).trim()||(G==null?void 0:G.default_paper_coupon_label)&&String(G.default_paper_coupon_label).trim()||null,le=(Z==null?void 0:Z.paper_coupon_description)&&String(Z.paper_coupon_description).trim()||(G==null?void 0:G.default_paper_coupon_description)&&String(G.default_paper_coupon_description).trim()||null,be=(Array.isArray(Z==null?void 0:Z.paper_coupon_formulas)&&Z.paper_coupon_formulas.length?Z.paper_coupon_formulas:Array.isArray(G==null?void 0:G.default_paper_coupon_formulas)?G.default_paper_coupon_formulas:[]).filter(pe=>pe&&typeof pe.name=="string"&&pe.name.trim()).map(pe=>
2787({name:String(pe.name).trim(),description:typeof pe.description=="string"?pe.description:void 0})),_e=se?{label:ce,description:le,formulas:be}:null;return s.jsx(Efe,{ticket:T,couponMode:se?"paper":"digital",paperCoupon:_e})})():l&&s.jsx(Se,{className:"border-2 border-amber-500/30",children:s.jsx(De,{className:"p-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:ii(l,{showFullName:!0})}),s.jsx("p",{className:"text-sm text-muted-foreground",children:l.reservation_code})]}),s.jsxs("div",{className:"text-right",children:[s.jsx(we,{variant:l.is_checked_in?"default":"secondary",children:l.is_checked_in?"Présent":"En attente"}),s.jsx("p",{className:"text-sm mt-1",children:l.coupon_mode==="paper"?l.perk_short_label||"Coupon à remettre":`Crédit : ${(l.credit_remaining_cents/100).toFixed(2)}€`})]})]})})}),!B&&s.jsxs(Q,{size:"lg",className:"w-full",onClick:q,disabled:R.isPending||M.status==="cancelled",children:[R.isPending?"Validation...":"✓ Valider la présence",!y&&" (hors-ligne)"]}),B&&s.jsxs(Q,{size:"lg",className:"w-full",onClick:J,children:[s.jsx(nu,{className:"w-5 h-5 mr-2"}),"Scanner le ticket suivant"]}),B&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-3 text-xs uppercase tracking-wide text-muted-foreground",children:[s.jsx("div",{className:"h-px flex-1 bg-border"}),"ou enregistrer une conso",s.jsx("div",{className:"h-px flex-1 bg-border"})]}),s.jsx(Afe,{ticket:{id:M.id,displayName:(()=>{const Z=[M.guest_first_name,M.guest_last_name].filter(Boolean).join(" ").trim();if(Z)return Z;const G=M.profile;return(G==null?void 0:G.display_name)||[G==null?void 0:G.first_name,G==null?void 0:G.last_name].filter(Boolean).join(" ").trim()||"Participant"})(),reservationCode:M.reservation_code,creditRemaining:Y,creditTotal:M.credit_total_cents??0},products:D,isSubmitting:L.isPending,onSubmit:async({items:Z,debited:G})=>{await oe(Z,G)},onScanNext:J})]}),!B&&s.jsx(Q,{variant:"outline",className:"w-full",onClick:J,children:"Scanner un autre ticket"})]})]}),s.jsx(Sn,{value:"list",className:"space-y-6 mt-6",children:s.jsxs(Se,{children:[s.jsx(kt,{children:s.jsx(Et,{className:"text-base",children:"Participants inscrits"})}),s.jsx(De,{children:s.jsx(M8,{eventId:e,capacity:w.capacity,allowManualCheckin:!0})})]})})]}),s.jsx(Sfe,{open:u,onOpenChange:d,ticket:f,onConfirm:W,isLoading:R.isPending})]})}const Kbt={idle:{message:"",icon:null,progressValue:0,color:"gold"},"completing-round":{message:"Dernière ronde terminée ! Finalisation...",icon:s.jsx(GY,{className:"w-5 h-5"}),progressValue:25,color:"gold"},"updating-status":{message:"Clôture du tournoi...",icon:s.jsx(We,{className:"w-5 h-5 animate-spin"}),progressValue:55,color:"gold"},"updating-stats":{message:"Mise à jour des statistiques et classements...",icon:s.jsx(iI,{className:"w-5 h-5"}),progressValue:80,color:"gold"},complete:{message:"Tournoi terminé ! Félicitations aux joueurs 🏆",icon:s.jsx(Xt,{className:"w-5 h-5"}),progressValue:100,color:"gold"},error:{message:"Erreur lors de la clôture automatique",icon:s.jsx(El,{className:"w-5 h-5"}),progressValue:0,color:"red"}};function Ybt({progress:e,error:t}){if(e==="idle")return null;const n=Kbt[e],i={gold:{bg:"from-amber-500/20 via-yellow-400/15 to-amber-500/5",border:"border-amber-500/40",text:"text-amber-300",progressBg:"bg-amber-500/20",progressIndicator:"bg-gradient-to-r from-amber-400 to-yellow-500",glow:"rgba(251, 191, 36, 0.4)"},amber:{bg:"from-amber-500/20 via-amber-400/10 to-amber-500/5",border:"border-amber-500/30",text:"text-amber-400",progressBg:"bg-amber-500/20",progressIndicator:"bg-amber-500",glow:"rgba(245, 158, 11, 0.4)"},red:{bg:"from-red-500/20 via-red-400/10 to-red-500/5",border:"border-red-500/30",text:"text-red-400",progressBg:"bg-red-500/20",progressIndicator:"bg-red-500",glow:"rgba(239, 68, 68, 0.4)"}}[n.color];return s.jsxs(Xn.div,{initial:{opacity:0,y:-20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-20,scale:.95},transition:{duration:.4,ease:"easeOut"},className:`
2788        relative overflow-hidden rounded-2xl border backdrop-blur-md
2789        ${i.border} ${i.bg} bg-gradient-to-r
2790        p-4 md:p-5
2791      `,children:[s.jsx(Xn.div,{className:"absolute inset-0 opacity-40",animate:{background:[`radial-gradient(circle at 20% 50%, ${i.glow}, transparent 50%)`,`radial-gradient(circle at 80% 50%, ${i.glow}, transparent 50%)`,`radial-gradient(circle at 20% 50%, ${i.glow}, transparent 50%)`]},transition:{duration:2.5,repeat:1/0,ease:"easeInOut"}}),e==="complete"&&s.jsx(s.Fragment,{children:[...Array(8)].map((a,o)=>s.jsx(Xn.div,{className:"absolute w-2 h-2 rounded-full",style:{background:o%2===0?"#fbbf24":"#f59e0b",left:`${10+o*12}%`,top:"10%"},initial:{y:0,opacity:1,scale:0},animate:{y:[0,-20,60],opacity:[0,1,0],scale:[0,1,.5],rotate:[0,180,360]},transition:{duration:1.5,delay:o*.1,repeat:1/0,repeatDelay:2}},o))}),s.jsxs("div",{className:"relative z-10 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Xn.div,{className:`${i.text}`,animate:e==="complete"?{scale:[1,1.2,1],rotate:[0,5,-5,0]}:e!=="error"?{scale:[1,1.1,1]}:{},transition:{duration:e==="complete"?.6:1.5,repeat:e==="complete"?3:1/0},children:n.icon}),s.jsx("div",{className:"flex-1",children:s.jsx("p",{className:`font-medium ${i.text}`,children:e==="error"&&t?t:n.message})}),e==="complete"&&s.jsxs(Xn.div,{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-gradient-to-r from-amber-500/30 to-yellow-500/20 border border-amber-400/40",initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:300,damping:15},children:[s.jsx(Xt,{className:"w-4 h-4 text-amber-300"}),s.jsx("span",{className:"text-xs font-bold text-amber-300",children:"TERMINÉ"})]}),e!=="complete"&&e!=="error"&&s.jsxs(Xn.div,{className:"flex items-center gap-1.5 px-2 py-1 rounded-full bg-amber-500/20 border border-amber-500/30",animate:{o
2791pacity:[.7,1,.7]},transition:{duration:1.5,repeat:1/0},children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400 animate-pulse"}),s.jsx("span",{className:"text-xs font-medium text-amber-300",children:"LIVE"})]})]}),e!=="error"&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(du,{value:n.progressValue,className:`h-2 ${i.progressBg}`}),s.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[s.jsx("span",{children:"Clôture automatique"}),s.jsxs("span",{className:i.text,children:[n.progressValue,"%"]})]})]})]})]})}function Xbt(){const{id:e}=Wi(),[t,n]=N.useState(),[r,i]=N.useState(!1),[a,o]=N.useState(null),{data:l,isLoading:c}=nh(e),{data:u=[],isLoading:d}=rE(e),{data:f=[]}=$0(e),{hasAccess:h,isLoading:p,isFetching:x}=WC(l==null?void 0:l.venue_id),y=(l==null?void 0:l.pairing_engine)||"internal",b=y!=="none",{isPreparing:w}=yfe({eventId:e||"",eventStatus:l==null?void 0:l.status,roundsCount:u.length,enabled:!!l&&l.status==="ongoing"&&h&&b,onRoundSelect:n}),{isTransitioning:_,isClosing:j,closeProgress:E}=$8({eventId:e||"",rounds:u,totalRounds:(l==null?void 0:l.rounds_count)||4,enabled:(l==null?void 0:l.status)==="ongoing"&&h&&b});N.useEffect(()=>{var L;if(u.length>0&&!t){const M=u.find(U=>U.status==="active"),B=u.find(U=>U.status==="pending");n((M==null?void 0:M.id)||(B==null?void 0:B.id)||((L=u[u.length-1])==null?void 0:L.id))}},[u,t]);const S=u.find(L=>L.id===t),T=(l==null?void 0:l.status)==="completed",{players:P}=B0(l==null?void 0:l.id,l==null?void 0:l.tiebreak_criteria),O=P.find(L=>L.playerId===a)||null,D=N.useCallback(L=>o(L),[]);return!(!!l&&u!==void 0)&&(c||d||p)?s.jsxs("div",{className:"space-y-4 md:space-y-6",children:[s.jsx(Ie,{className:"h-6 w-32"}),s.jsx(Ie,{className:"h-8 w-48"}),s.jsxs("div",{className:"grid lg:grid-cols-3 gap-4 md:gap-6",children:[s.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[s.jsx(Ie,{className:"h-16"}),s.jsx(Ie,{className:"h-64"})]}),s.jsx(Ie,{className:"h-96"})]})]}):l?!h&&!c&&!d&&!p&&!x?s.jsx(em,{to:"/venue",replace:!0}):s.jsxs("div",{className:"space-y-4 md:space-y-6 min-w-0",children:[j&&s.jsx(Ybt,{progress:E}),T&&!j&&s.jsx("div",{className:"relative overflow-hidden rounded-2xl border border-amber-500/40 bg-gradient-to-r from-amber-500/20 via-yellow-400/15 to-amber-500/5 backdrop-blur-md p-4 md:p-5",children:s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(Xt,{className:"w-6 h-6 text-amber-300 shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"font-medium text-amber-300",children:"Tournoi terminé"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Le classement final est affiché ci-dessous"})]})]})}),s.jsxs("div",{className:"flex flex-col gap-3 min-w-0",children:[s.jsxs(Pe,{to:`/venue/events/${e}`,className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors shrink-0",children:[s.jsx(Fn,{className:"w-4 h-4 shrink-0"}),s.jsx("span",{className:"hidden sm:inline",children:"Retour à l'événement"}),s.jsx("span",{className:"sm:hidden",children:"Retour"})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 min-w-0",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h1",{className:"font-display text-xl sm:text-2xl font-bold truncate",children:l.title}),s.jsxs("div",{className:"flex items-center gap-2 mt-1 overflow-x-auto scrollbar-hide pb-1 -mx-1 px-1",children:[s.jsxs(we,{variant:"outline",className:"text-xs shrink-0",children:[s.jsx(sn,{className:"w-3 h-3 mr-1"}),f.length," joueurs"]}),s.jsxs(we,{variant:"secondary",className:"text-xs shrink-0",children:["R",(S==null?void 0:S.round_number)||0,"/",l.rounds_count||4]}),s.jsx(we,{variant:"outline",className:"text-xs shrink-0",children:y==="javafo_api"?"JaVaFo (API)":y==="none"?"Manuel":"FIDE Dutch (interne)"}),l.status==="ongoing"&&s.jsxs(we,{variant:"outline",className:"text-xs bg-green-500/10 text-green-600 border-green-500/30 shrink-0",children:[s.jsx(gd,{className:"w-3 h-3 mr-1"}),"Auto"]}),w&&s.jsx(we,{variant:"outline",className:"text-xs bg-amber-500/10 text-amber-600 border-amber-500/30 animate-pulse shrink-0",children:"Préparation..."}),_&&!w&&s.jsx(we,{variant:"outline",className:"text-xs bg-amber-500/10 text-amber-600 border-amber-500/30 animate-pulse shrink-0",children:"Transition..."}),T&&s.jsxs(we,{variant:"outline",className:"text-xs bg-amber-500/20 text-amber-300 border-amber-500/40 shrink-0",children:[s.jsx(Xt,{className:"w-3 h-3 mr-1"}),"Terminé"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l.status==="ongoing"&&s.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>i(!0),className:"gap-1.5",children:[s.jsx(cs,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Retardataire"})]}),(S==null?void 0:S.status)==="active"&&!T&&s.jsx(oE,{startedAt:S.started_at,timeControl:l.time_control||"10+0"})]})]})]}),s.jsx(rS,{open:r,onOpenChange:i,event:{id:l.id,title:l.title,price_cents:l.price_cents,credit_amount_cents:l.credit_amount_cents,capacity:l.capacity,status:l.status,coupon_mode:l.coupon_mode??null,paper_coupon_label:l.paper_coupon_label??null,paper_coupon_description:l.paper_coupon_description??null,paper_coupon_formulas:l.paper_coupon_formulas??null,venue:l.venue??null},currentTicketCount:f.length}),s.jsxs("div",{className:"grid lg:grid-cols-3 gap-4 md:gap-6 min-w-0",children:[s.jsxs("div",{className:"lg:col-span-2 space-y-4 md:space-y-6 min-w-0",children:[!T&&s.jsx(_fe,{eventId:l.id}),s.jsxs(Se,{className:"min-w-0",children:[s.jsx(kt,{className:"pb-3 px-3 sm:px-6",children:s.jsx(Et,{className:"text-base md:text-lg",children:T?"Ré
2791sumé du tournoi":"Gestion du tournoi"})}),s.jsx(De,{className:"min-w-0 px-3 sm:px-6",children:s.jsx(wfe,{eventId:l.id,eventStatus:l.status,rounds:u,totalRounds:l.rounds_count||4,selectedRoundId:t,onRoundSelect:n,pairingEngine:y})})]}),s.jsxs(Se,{className:"min-w-0",children:[s.jsx(kt,{className:"pb-3 px-3 sm:px-6",children:s.jsx(Et,{className:"text-base md:text-lg flex items-center justify-between min-w-0",children:s.jsxs("span",{className:"truncate",children:["Appariements",S&&` - R${S.round_number}`]})})}),s.jsx(De,{className:"min-w-0 px-3 sm:px-6",children:s.jsx(vfe,{roundId:t,eventId:e,roundNumber:S==null?void 0:S.round_number,canEdit:(S==null?void 0:S.status)==="active"||(S==null?void 0:S.status)==="completed",canEditPlayers:!T,isRetroactive:(S==null?void 0:S.status)==="completed",onPlayerClick:D})})]})]}),s.jsx(Se,{className:"h-fit min-w-0",children:s.jsx(De,{className:"min-w-0 p-3 pt-4 sm:p-6",children:s.jsxs(Ka,{defaultValue:"standings",children:[s.jsxs(Ca,{className:"grid w-full grid-cols-3 mb-4",children:[s.jsxs(vn,{value:"standings",className:"gap-1.5 text-xs sm:text-sm",children:[s.jsx(Xt,{className:"w-3.5 h-3.5"}),s.jsx("span",{className:"hidden sm:inline",children:T?"Final":"Classement"}),s.jsx("span",{className:"sm:hidden",children:"Class."})]}),s.jsxs(vn,{value:"crosstable",className:"gap-1.5 text-xs sm:text-sm",children:[s.jsx(Fm,{className:"w-3.5 h-3.5"}),"Grille"]}),s.jsxs(vn,{value:"export",className:"gap-1.5 text-xs sm:text-sm",children:[s.jsx(HY,{className:"w-3.5 h-3.5"}),"Export"]})]}),s.jsx(Sn,{value:"standings",children:s.jsx(sE,{eventId:l.id,tiebreakCriteria:l.tiebreak_criteria,canEditPlayers:!T,onPlayerClick:D})}),s.jsx(Sn,{value:"crosstable",children:s.jsx(iE,{eventId:l.id,tiebreakCriteria:l.tiebreak_criteria,onPlayerClick:D})}),s.jsx(Sn,{value:"export",children:s.jsx(bfe,{eventId:l.id,eventTitle:l.title,eventDate:l.event_date,tiebreakCriteria:l.tiebreak_criteria,isCompleted:T,selectedRoundId:t,totalRounds:l.rounds_count||4})})]})})})]}),s.jsx(aE,{player:O,allPlayers:P,open:!!a,onOpenChange:L=>!L&&o(null)})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx("p",{className:"text-muted-foreground mb-4",children:"Événement introuvable."}),s.jsx(Pe,{to:"/venue",className:"text-primary hover:underline",children:"Retour au dashboard"})]})}function Qbt(){return s.jsx(eqe,{children:s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(tr,{}),s.jsx("main",{className:"pt-24 pb-16 px-4",children:s.jsx("div",{className:"container mx-auto max-w-4xl",children:s.jsx(II,{})})})]})})}function Jbt(){const{user:e,refreshProfile:t}=Tt(),n=Ye(),{toast:r}=_r();return dt({mutationFn:async i=>{if(!(e!=null&&e.id))throw new Error("Non authentifié");const{error:a}=await re.from("profiles").update(i).eq("id",e.id);if(a)throw a},onSuccess:()=>{t(),n.invalidateQueries({queryKey:["profile"]}),r({title:"Profil mis à jour",description:"Vos informations ont été sauvegardées."})},onError:i=>{r({title:"Erreur",description:"Impossible de mettre à jour le profil.",variant:"destructive"}),console.error("Profile update error:",i)}})}const cv=[{min:0,max:1e3,label:"Débutant",color:"bg-green-500",emoji:"🌱"},{min:1e3,max:1400,label:"Intermédiaire",color:"bg-blue-500",emoji:"📘"},{min:1400,max:1800,label:"Avancé",color:"bg-yellow-500",emoji:"⭐"},{min:1800,max:2200,label:"Expert",color:"bg-orange-500",emoji:"🔥"},{min:2200,max:3e3,label:"Maître",color:"bg-red-500",emoji:"👑"}],Zbt=[{name:"Lichess",url:"https://lichess.org/",description:"Gratuit, jouez et obtenez votre classement"},{name:"Chess.com",url:"https://www.chess.com/",description:"La plus grande plateforme d'échecs"},{name:"FFE",url:"https://echecs.asso.fr/",description:"Fédération Française des Échecs (Elo officiel)"}];function ewt({trigger:e}){const t=vd(),[n,r]=N.useState(!1),i=e||s.jsx(Q,{variant:"ghost",size:"icon",className:"h-5 w-5",children:s.jsx(Lk,{className:"h-4 w-4 text-muted-foreground"})}),a=s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Le classement ",s.jsx("strong",{children:"Elo"})," est un système de notation qui mesure votre niveau relatif aux échecs. Plus votre Elo est élevé, plus vous êtes fort. Il évolue après chaque partie en fonction du résultat et du niveau de votre adversaire."]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"text-sm font-medium",children:"Niveaux indicatifs"}),s.jsx("div",{className:"space-y-1.5",children:cv.map(o=>s.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[s.jsx("div",{className:`h-3 w-3 rounded-full ${o.color}`}),s.jsx("span",{className:"w-6",children:o.emoji}),s.jsx("span",{className:"font-medium w-24",children:o.label}),s.jsxs("span",{className:"text-muted-foreground",children:[o.min," - ",o.max===3e3?"+":o.max]})]},o.label))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"text-sm font-medium",children:"Comment connaître mon Elo ?"}),s.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Jouez quelques parties sur ces plateformes pour obtenir un classement :"}),s.jsx("div",{className:"space-y-2",children:Zbt.map(o=>s.jsxs("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-2 rounded-lg border border-border/50 hover:bg-muted/50 transition-colors group",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium group-hover:text-primary transition-colors",children:o.name}),s.jsx("p",{className:"text-xs text-muted-foreground",children:o.description})]}),s.jsx(pd,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors flex-shrink-0"})]},o.name))})]}),s.jsxs("div",{className:"p-3 rounded-lg bg-muted/50 text-xs text-muted-foreground",children:[s.jsx("strong",{children:"💡 Astuce :"})," Vous pouvez laisser le champ vide si vous ne connaissez pas votre Elo : vous resterez « non classé » (NC) jusqu'à votre première partie notée."]})]});return t?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",onClick:()=>r(!0),className:"inline-flex",children:i}),s.jsx(bd,{open:n,onOpenChange:r,children:s.jsxs(wd,{className:"max-h-[85vh] bg-card/95 backdrop-blur-xl border-t border-primary/20",children:[s.jsxs(sh,{className:"relative pb-2",children:[s.jsx(pte,{asChild:!0,children:s.jsxs(Q,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 h-8 w-8",children:[s.jsx(Er,{className:"w-5 h-5"}),s.jsx("span",{className:"sr-only",children:"Fermer"})]})}),s.jsxs(_d,{className:"flex items-center gap-2 font-display pr-10",children:[s.jsx(Xt,{className:"h-5 w-5 text-primary"}),"Qu'est-ce que le classement Elo ?"]}),s.jsx(Yb,{children:"Comprendre votre niveau aux échecs"})]}),s.jsx(cd,{className:"flex-1 max-h-[calc(85vh-100px)]",children:s.jsx("div",{className:"px-4 pb-8",children:a})})]})})]}):s.jsxs(Ln,{open:n,onOpenChange:r,children:[s.jsx(nte,{asChild:!0,children:s.jsx("button",{type:"button",className:"inline-flex",children:i})}),s.jsxs(Dn,{className:"sm:max-w-md max-h-[80vh] overflow-y-auto",children:[s.jsxs(Un,{children:[s.jsxs(qn,{className:"flex items-center gap-2 font-display",children:[s.jsx(Xt,{className:"h-5 w-5 text-primary"}),"Qu'est-ce que le classement Elo ?"]}),s.jsx(qr,{children:"Comprendre votre niveau aux échecs"})]}),a]})]})}function twt(e){return e?cv.find(t=>e>=t.min&&e<t.max)||cv[cv.length-1]:cv[0]}const nwt=e=>{let t=0;return e.length>=8&&t++,e.length>=12&&t++,/[A-Z]/.test(e)&&t++,/[a-z]/.test(e)&&t++,/\d/.test(e)&&t++,/[^a-zA-Z0-9]/.test(e)&&t++,t<=2?"weak":t<=4?"medium":"strong"},H_={weak:{label:"Faible",color:"bg-destructive",textColor:"text-destructive",width:"w-1/3"},medium:{label:"Moyen",color:"bg-yellow-500",textColor:"text-yellow-600",width:"w-2/3"},strong:{label:"Fort",color:"bg-emerald-500",textColor:"text-emerald-600",width:"w-full"}};function rwt({onSuccess:e}){const{profile:t}=Tt(),[n,r]=N.useState(!1),[i,a]=N.useState(!1),[o,l]=N.useState(!1),[c,u]=N.useState(!1),[d,f]=N.useState(!1),h=Zm({resolver:ep(D3e),defaultValues:{currentPassword:"",newPassword:"",confirmPassword:""}}),p=h.watch("newPassword"),x=p?nwt(p):null,y=async b=>{if(!(t!=null&&t.email)){je.error("Email introuvable. Veuillez vous reconnecter.");return}u(!0);try{const{error:w}=await re.auth.signInWithPassword({email:t.email,password:b.currentPassword});if(w){w.message.includes("Invalid login credentials")?h.setError("currentPassword",{type:"manual",message:"Mot de passe actuel incorrect"}):je.error("Erreur de vérification. Veuillez réessayer."),u(!1);return}const{error:_}=await re.auth.updateUser({password:b.newPassword});if(_){_.message.includes("should be different")?h.setError("newPassword",{type:"manual",message:"Le nouveau mot de passe doit être différent de l'actuel"}):je.error("Erreur lors de la mise à jour. Veuillez réessayer."),u(!1);return}f(!0),je.success("Mot de passe modifié avec succès !"),setTimeout(()=>{h.reset(),f(!1),e==null||e()},2e3)}catch{je.error("Une erreur inattendue s'est produite.")}finally{u(!1)}};return d?s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-4",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center animate-pulse",children:s.jsx(Cn,{className:"w-8 h-8 text-primary"})}),s.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"Votre mot de passe a été modifié avec succès !"})]}):s.jsx(IM,{...h,children:s.jsxs("form",{onSubmit:h.handleSubmit(y),className:"space-y-4",children:[s.jsx(Nr,{control:h.control,name:"currentPassword",render:({field:b})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Mot de passe actuel"}),s.jsx(kr,{children:s.jsxs("div",{className:"relative",children:[s.jsx(Ue,{type:n?"text":"password",placeholder:"Votre mot de passe actuel",className:"pr-10",...b}),s.jsx(Q,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>r(!n),"aria-label":n?"Masquer le mot de passe":"Afficher le mot de passe",children:n?s.jsx(Cf,{className:"w-4 h-4 text-muted-foreground"}):s.jsx(go,{className:"w-4 h-4 text-muted-foreground"})})]})}),s.jsx(xr,{})]})}),s.jsx(Nr,{control:h.control,name:"newPassword",render:({field:b})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Nouveau mot de passe"}),s.jsx(kr,{children:s.jsxs("div",{className:"relative",children:[s.jsx(Ue,{type:i?"text":"password",placeholder:"Votre nouveau mot de passe",className:"pr-10",...b}),s.jsx(Q,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>a(!i),"aria-label":i?"Masquer le mot de passe":"Afficher le mot de passe",children:i?s.jsx(Cf,{className:"w-4 h-4 text-muted-foreground"}):s.jsx(go,{className:"w-4 h-4 text-muted-foreground"})})]})}),p&&x&&s.jsxs("div",{className:"space-y-1.5 pt-1",children:[s.jsx("div",{className:"h-1.5 w-full bg-muted rounded-full overflow-hidden",children:s.jsx("div",{className:`h-full rounded-full transition-all duration-300 ${H_[x].color} ${H_[x].width}`})}),s.jsxs("p",{className:`text-xs ${H_[x].textColor}`,children:["Force : ",H_[x].label]})]}),s.jsx(xr,{})]})}),s.jsx(Nr,{control:h.control,name:"confirmPassword",render:({field:b})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Confirmer le nouveau mot de passe"}),s.jsx(kr,{children:s.jsxs("div",{className:"relative",children:[s.jsx(Ue,{type:o?"text":"password",placeholder:"Confirmez le nouveau mot de passe",className:"pr-10",...b}),s.jsx(Q,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>l(!o),"aria-label":o?"Masquer le mot de passe":"Afficher le mot de passe",children:o?s.jsx(Cf,{className:"w-4 h-4 text-muted-foreground"}):s.jsx(go,{className:"w-4 h-4 text-muted-foreground"})})]})}),s.jsx(xr,{})]})}
2791),s.jsxs(Q,{type:"submit",className:"w-full",disabled:c,children:[s.jsx(yo,{className:"w-4 h-4 mr-2"}),c?"Modification...":"Modifier le mot de passe"]})]})})}function RW(){const{profile:e}=Tt(),[t,n]=N.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsxs(Se,{className:"border-border/50 bg-card/95 backdrop-blur-sm",children:[s.jsxs(kt,{className:"pb-4",children:[s.jsxs(Et,{className:"font-display flex items-center gap-2 text-base sm:text-lg",children:[s.jsx(nd,{className:"w-5 h-5 text-primary"}),"Sécurité et compte"]}),s.jsx(Qs,{className:"text-xs sm:text-sm",children:"Gérez vos paramètres de sécurité"})]}),s.jsxs(De,{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/30",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(wr,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-medium",children:"Adresse email"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:(e==null?void 0:e.email)||"Non renseigné"})]})]}),s.jsx(yo,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/30",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(bF,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"Mot de passe"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Modifier votre mot de passe"})]})]}),s.jsx(Q,{variant:"outline",size:"sm",onClick:()=>n(!0),children:"Modifier"})]})]})]}),s.jsx(Ln,{open:t,onOpenChange:n,children:s.jsxs(Dn,{className:"max-w-md",children:[s.jsx(Un,{children:s.jsxs(qn,{className:"flex items-center gap-2",children:[s.jsx(bF,{className:"w-5 h-5 text-primary"}),"Modifier le mot de passe"]})}),s.jsx(rwt,{onSuccess:()=>n(!1)})]})})]})}function swt({open:e,onOpenChange:t}){const[n,r]=N.useState(""),[i,a]=N.useState(!1),{signOut:o}=Tt(),l=Rr(),c=async()=>{if(n==="SUPPRIMER"){a(!0);try{const{data:d,error:f}=await re.functions.invoke("delete-account");if(f){console.error("Delete account error:",f),je.error("Erreur lors de la suppression du compte");return}if(!(d!=null&&d.success)){je.error((d==null?void 0:d.error)||"Erreur lors de la suppression");return}await o(),je.success("Votre compte a été supprimé avec succès"),l("/")}catch(d){console.error("Unexpected error:",d),je.error("Une erreur inattendue s'est produite")}finally{a(!1),r(""),t(!1)}}},u=d=>{i||(r(""),t(d))};return s.jsx(yr,{open:e,onOpenChange:u,children:s.jsxs(sr,{className:"max-w-md",children:[s.jsxs(ir,{children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-destructive/10 flex items-center justify-center flex-shrink-0",children:s.jsx(ur,{className:"w-5 h-5 text-destructive"})}),s.jsx(or,{className:"text-destructive",children:"Supprimer votre compte"})]}),s.jsxs(lr,{className:"pt-2",children:["Cette action est ",s.jsx("strong",{children:"irréversible"}),". Toutes vos données seront définitivement supprimées, y compris :"]})]}),s.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1 pl-4 list-disc",children:[s.jsx("li",{children:"Votre profil et vos statistiques"}),s.jsx("li",{children:"Votre historique de tournois"}),s.jsx("li",{children:"Vos badges et récompenses"}),s.jsx("li",{children:"Vos inscriptions en cours"})]}),s.jsxs("div",{className:"space-y-3 pt-2",children:[s.jsxs(Fe,{htmlFor:"confirm-delete",className:"text-sm",children:["Pour confirmer, tapez ",s.jsx("strong",{className:"text-destructive",children:"SUPPRIMER"})," ci-dessous :"]}),s.jsx(Ue,{id:"confirm-delete",placeholder:"SUPPRIMER",value:n,onChange:d=>r(d.target.value.toUpperCase()),disabled:i,className:"font-mono"})]}),s.jsxs(ar,{className:"gap-2 sm:gap-0",children:[s.jsx(cr,{disabled:i,children:"Annuler"}),s.jsx(Q,{variant:"destructive",onClick:c,disabled:n!=="SUPPRIMER"||i,children:i?s.jsxs(s.Fragment,{children:[s.jsx(We,{className:"w-4 h-4 mr-2 animate-spin"}),"Suppression..."]}):"Supprimer définitivement"})]})]})})}function iwt(){const[e,t]=N.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx(Se,{className:"border-destructive/30 bg-destructive/5",children:s.jsx(De,{className:"p-4 sm:p-6",children:s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[s.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-destructive/10 flex items-center justify-center flex-shrink-0",children:s.jsx(ur,{className:"w-5 h-5 text-destructive"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-medium text-destructive",children:"Zone de danger"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"La suppression du compte est irréversible"})]})]}),s.jsxs(Q,{variant:"destructive",size:"sm",className:"w-full sm:w-auto flex-shrink-0",onClick:()=>t(!0),children:[s.jsx(ua,{className:"w-4 h-4 mr-2 flex-shrink-0"}),s.jsx("span",{className:"truncate",children:"Supprimer le compte"})]})]})})}),s.jsx(swt,{open:e,onOpenChange:t})]})}function awt({enabled:e,userId:t}){const[n,r]=N.useState(!1),i=Ye(),{toast:a}=_r(),o=dt({mutationFn:async u=>{const{error:d}=await re.from("player_stats").update({elo_tracking_enabled:u,updated_at:new Date().toISOString()}).eq("user_id",t);if(d)throw d;return u},onSuccess:u=>{i.invalidateQueries({queryKey:["player-stats"]}),a({title:u?"Suivi Elo activé":"Suivi Elo désactivé",description:u?"Votre classement sera mis à jour après vos parties":"Votre classement ne sera plus mis à jour automatiquement"})},onError:()=>{a({title:"Erreur",description:"Impossible de modifier le paramètre",variant:"destructive"})}}),l=u=>{u?o.mutate(!0):r(!0)},c=()=>{o.mutate(!1),r(!1)};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-col gap-3 xs:flex-row xs:items-center xs:justify-between",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(Fe,{htmlFor:"elo-tracking",className:"text-sm font-medium",children:"Suivi Elo automatique"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Mise à jour après chaque partie"})]}
2791),s.jsxs("div",{className:"flex items-center gap-2 self-end xs:self-auto",children:[o.isPending&&s.jsx(We,{className:"w-4 h-4 animate-spin text-muted-foreground"}),s.jsx(R0,{id:"elo-tracking",checked:e,onCheckedChange:l,disabled:o.isPending})]})]}),s.jsx(yr,{open:n,onOpenChange:r,children:s.jsxs(sr,{children:[s.jsxs(ir,{children:[s.jsx(or,{children:"Désactiver le suivi Elo ?"}),s.jsxs(lr,{className:"space-y-2",children:[s.jsx("p",{children:"En désactivant le suivi automatique :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-1 text-sm",children:[s.jsx("li",{children:"Votre classement ne sera plus mis à jour après vos parties"}),s.jsx("li",{children:"Vous ne serez pas inclus dans les appariements basés sur le niveau"}),s.jsx("li",{children:"Vous pourrez toujours modifier votre Elo manuellement"})]})]})]}),s.jsxs(ar,{children:[s.jsx(cr,{children:"Annuler"}),s.jsx(vr,{onClick:c,children:"Désactiver"})]})]})})]})}const Xy=ee.memo(function({icon:t,label:n,sublabel:r,value:i,valueClassName:a,className:o}){return s.jsxs("div",{className:ae("flex items-center justify-between p-3 rounded-lg bg-muted/50 gap-3",o),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[s.jsx("div",{className:"shrink-0",children:t}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"text-sm font-medium block truncate",children:n}),r&&s.jsx("div",{className:"text-xs text-muted-foreground truncate",children:r})]})]}),s.jsx("span",{className:ae("text-base sm:text-lg font-bold tabular-nums shrink-0",a),children:i})]})});function MW(){const{user:e}=Tt(),{data:t,isLoading:n}=tAe(),r=vee(),i=nAe(),a=(t==null?void 0:t.status)==="subscribed";return s.jsxs(Se,{className:"border-border/50",children:[s.jsxs(kt,{className:"pb-3",children:[s.jsxs(Et,{className:"font-display flex items-center gap-2 text-base sm:text-lg",children:[s.jsx(wr,{className:"w-5 h-5 text-primary"}),"Newsletter"]}),s.jsx(Qs,{className:"text-xs sm:text-sm",children:"Recevez les prochains tournois et nouveautés directement dans votre boîte mail."})]}),s.jsx(De,{children:n?s.jsx("div",{className:"h-10 bg-muted/40 animate-pulse rounded-md"}):a?s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(is,{className:"w-4 h-4 text-primary"}),"Inscrit·e le"," ",t!=null&&t.subscribed_at?new Date(t.subscribed_at).toLocaleDateString("fr-FR"):"—"]}),s.jsx(Q,{variant:"outline",size:"sm",disabled:i.isPending,onClick:()=>t&&i.mutate(t.id),children:"Se désinscrire"})]}):s.jsxs(Q,{className:"w-full",disabled:r.isPending||!(e!=null&&e.email),onClick:()=>(e==null?void 0:e.email)&&r.mutate({email:e.email,source:"profile"}),children:[s.jsx(wr,{className:"w-4 h-4 mr-2"}),"Recevoir la newsletter"]})})]})}function owt(){return s.jsx(Pe,{to:"/player/timer",className:"block group","aria-label":"Ouvrir la pendule rapide",children:s.jsx(Se,{className:"p-4 border-primary/30 bg-gradient-to-br from-primary/5 via-card to-card hover:border-primary hover:shadow-md transition-all",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"relative flex items-center justify-center w-12 h-12 rounded-xl bg-primary/10 shrink-0",children:[s.jsx(Vt,{className:"w-6 h-6 text-primary"}),s.jsx("span",{className:"absolute inset-0 rounded-xl bg-primary/15 animate-ping opacity-75"})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-display font-bold text-sm sm:text-base",children:"Pendule rapide"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Une partie IRL avec un ami ? Lancez votre pendule en 2 clics"})]}),s.jsx(la,{className:"w-5 h-5 text-muted-foreground group-hover:text-primary group-hover:translate-x-0.5 transition-all shrink-0"})]})})})}const lwt=da({display_name:E3e,first_name:T2("Le prénom").optional(),last_name:T2("Le nom").optional(),elo_rating:N3e([Ct().transform(e=>e===""?null:parseInt(e,10)),j3e()]).refine(e=>e===null||e>=100&&e<=3e3,{message:"Le Elo doit être entre 100 et 3000"}).optional(),club:Ct().max(100,"Maximum 100 caractères").optional(),birth_date:Ct().optional()});function cwt(){const{user:e,profile:t}=Tt(),{data:n}=EC(),r=Jbt(),i=Uqe(),[a,o]=N.useState(!1),l=Zm({resolver:ep(lwt),defaultValues:{display_name:(t==null?void 0:t.display_name)||"",first_name:(t==null?void 0:t.first_name)||"",last_name:(t==null?void 0:t.last_name)||"",elo_rating:null,club:(t==null?void 0:t.club)||"",birth_date:(t==null?void 0:t.birth_date)||""}});N.useEffect(()=>{(n==null?void 0:n.elo_rating)!==void 0&&l.setValue("elo_rating",n.elo_rating)},[n==null?void 0:n.elo_rating,l]),N.useEffect(()=>{if(window.location.hash!=="#badges")return;const f=window.setTimeout(()=>{var h;(h=document.getElementById("badges"))==null||h.scrollIntoView({behavior:"smooth",block:"start"})},400);return()=>window.clearTimeout(f)},[]);const c=async f=>{const{elo_rating:h,club:p,birth_date:x,display_name:y,first_name:b,last_name:w}=f;r.mutate({display_name:Vo(y),first_name:b&&Vo(b),last_name:w&&Vo(w),club:p||null,birth_date:x||null}),e!=null&&e.id&&h!==(n==null?void 0:n.elo_rating)&&i.mutate({userId:e.id,newElo:h??null})},u=()=>
2791t!=null&&t.display_name?t.display_name.slice(0,2).toUpperCase():"JO",d=twt((n==null?void 0:n.elo_rating)??null);return s.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[s.jsxs(Pe,{to:"/player",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(Fn,{className:"w-4 h-4"}),"Retour au tableau de bord"]}),s.jsxs("div",{children:[s.jsx("h1",{className:"font-display text-xl sm:text-2xl md:text-3xl font-bold text-foreground",children:"Mon profil"}),s.jsx("p",{className:"text-muted-foreground text-sm sm:text-base mt-1",children:"Gérez vos informations personnelles"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:hidden",children:[s.jsxs(Se,{className:"p-4 text-center bg-gradient-to-br from-primary/5 to-primary/10 border-border/50",children:[s.jsx("p",{className:"text-2xl font-bold tabular-nums",children:(n==null?void 0:n.elo_rating)||"—"}),s.jsxs("p",{className:"text-xs text-muted-foreground flex items-center justify-center gap-1",children:[(n==null?void 0:n.elo_rating)&&s.jsx("span",{children:d.emoji}),"Elo"]})]}),s.jsxs(Se,{className:"p-4 text-center border-border/50",children:[s.jsx("p",{className:"text-2xl font-bold tabular-nums",children:(n==null?void 0:n.tournaments_played)||0}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Tournois"})]})]}),s.jsx(owt,{}),s.jsxs("div",{className:"space-y-4 sm:space-y-6 lg:grid lg:grid-cols-2 lg:gap-6 xl:gap-8 lg:space-y-0",children:[s.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[s.jsxs(Se,{className:"border-border/50",children:[s.jsx(kt,{className:"pb-4",children:s.jsxs("div",{className:"flex items-center gap-3 sm:gap-4",children:[s.jsx(Bi,{className:"h-12 w-12 sm:h-16 sm:w-16",children:s.jsx(zi,{className:"bg-primary/10 text-primary text-lg sm:text-xl font-medium",children:u()})}),s.jsxs("div",{children:[s.jsx(Et,{className:"font-display text-base sm:text-lg",children:"Informations"}),s.jsx(Qs,{className:"text-xs sm:text-sm",children:"Modifiez votre profil public"})]})]})}),s.jsx(De,{children:s.jsx(IM,{...l,children:s.jsxs("form",{onSubmit:l.handleSubmit(c),className:"space-y-4",children:[s.jsx(Nr,{control:l.control,name:"display_name",render:({field:f})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Pseudo"}),s.jsx(kr,{children:s.jsx(Ue,{placeholder:"Votre pseudo public",...f})}),s.jsx(Iu,{className:"text-xs",children:'Visible par les autres joueurs. Sans pseudo, seul "Prénom + Initiale" sera affiché.'}),s.jsx(xr,{})]})}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(Nr,{control:l.control,name:"first_name",render:({field:f})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Prénom"}),s.jsx(kr,{children:s.jsx(Ue,{placeholder:"Prénom",...f})}),s.jsx(xr,{})]})}),s.jsx(Nr,{control:l.control,name:"last_name",render:({field:f})=>s.jsxs(pr,{children:[s.jsx(gr,{children:"Nom"}),s.jsx(kr,{children:s.jsx(Ue,{placeholder:"Nom",...f})}),s.jsx(xr,{})]})})]}),s.jsx(Nr,{control:l.control,name:"elo_rating",render:({field:f})=>s.jsxs(pr,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(gr,{children:"Classement Elo"}),s.jsx(ewt,{})]}),s.jsx(kr,{children:s.jsx(Ue,{type:"number",placeholder:"Laisser vide si tu n'es pas classé",min:100,max:3e3,...f,value:f.value??"",onChange:h=>f.onChange(h.target.value)})}),s.jsx(Iu,{className:"text-xs",children:"Classement officiel ou estimé (100-3000)"}),s.jsx(xr,{})]})}),s.jsxs(Ix,{children:[s.jsxs(Rx,{className:"flex items-center gap-2 w-full p-3 rounded-lg bg-muted/40 hover:bg-muted/60 transition-colors text-sm font-medium text-foreground",children:[s.jsx(nd,{className:"w-4 h-4 text-primary"}),"Club & infos complémentaires",s.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"Optionnel"})]}),s.jsxs(Mx,{className:"pt-3 space-y-4",children:[s.jsx(Nr,{control:l.control,name:"club",render:({field:f})=>s.jsxs(pr,{children:[s.jsxs(gr,{className:"flex items-center gap-1.5",children:[s.jsx(km,{className:"w-3.5 h-3.5"}),"Club"]}),s.jsx(kr,{children:s.jsx(Ue,{placeholder:"Nom de votre club",maxLength:100,...f})}),s.jsx(xr,{})]})}),s.jsx(Nr,{control:l.control,name:"birth_date",render:({field:f})=>s.jsxs(pr,{children:[s.jsxs(gr,{className:"flex items-center gap-1.5",children:[s.jsx(Jn,{className:"w-3.5 h-3.5"}),"Date de naissance"]}),s.jsx(kr,{children:s.jsx(Ue,{type:"date",...f})}),s.jsx(Iu,{className:"text-xs",children:"Privée — non visible par les autres joueurs"}),s.jsx(xr,{})]})})]})]}),s.jsxs(Q,{type:"submit",className:"w-full",disabled:r.isPending||i.isPending,children:[s.jsx(cI,{className:"w-4 h-4 mr-2"}),r.isPending||i.isPending?"Sauvegarde...":"Sauvegarder"]})]})})})]}),s.jsxs("div",{className:"lg:hidden space-y-4",children:[s.jsx(MW,{}),s.jsx(RW,{})]})]}
2791),s.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[s.jsxs(Se,{className:"border-border/50",children:[s.jsxs(kt,{className:"pb-3",children:[s.jsxs(Et,{className:"font-display flex items-center gap-2 text-base sm:text-lg",children:[s.jsx(Xt,{className:"w-5 h-5 text-primary"}),"Mes statistiques"]}),s.jsx(Qs,{className:"text-xs sm:text-sm",children:"Votre progression sur la plateforme"})]}),s.jsxs(De,{className:"space-y-3",children:[s.jsx(Xy,{icon:s.jsx(rX,{className:"w-5 h-5 text-primary"}),label:"Classement Elo",sublabel:n!=null&&n.elo_rating?s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{children:d.emoji}),s.jsx("span",{children:d.label})]}):void 0,value:qf(n==null?void 0:n.elo_rating)}),(e==null?void 0:e.id)&&s.jsx("div",{className:"p-3 rounded-lg bg-muted/50",children:s.jsx(awt,{enabled:(n==null?void 0:n.elo_tracking_enabled)??!0,userId:e.id})}),s.jsx(Xy,{icon:s.jsx(Xt,{className:"w-5 h-5 text-primary"}),label:"Tournois joués",value:(n==null?void 0:n.tournaments_played)||0}),s.jsx(Xy,{icon:s.jsx(sa,{className:"w-5 h-5 text-yellow-500"}),label:"Tournois gagnés",value:(n==null?void 0:n.tournaments_won)||0}),s.jsx(Xy,{icon:s.jsx(Xt,{className:"w-5 h-5 text-green-500"}),label:"Parties gagnées",value:(n==null?void 0:n.wins)||0}),s.jsx(Xy,{icon:s.jsx(Cs,{className:"w-5 h-5 text-muted-foreground"}),label:"Parties jouées",value:(n==null?void 0:n.games_played)||0})]})]}),s.jsxs("div",{className:"hidden lg:block space-y-4",children:[s.jsx(MW,{}),s.jsx(RW,{})]}),s.jsxs(Se,{className:"border-border/50",children:[s.jsxs(kt,{className:"pb-3",children:[s.jsxs(Et,{className:"font-display flex items-center gap-2 text-base",children:[s.jsx(lu,{className:"w-5 h-5 text-primary"}),"Évolution du classement"]}),s.jsx(Qs,{className:"text-xs sm:text-sm",children:"Votre progression Elo au fil du temps"})]}),s.jsx(De,{children:s.jsx(ife,{userId:e==null?void 0:e.id})})]}),s.jsx(Ix,{open:a,onOpenChange:o,children:s.jsxs(Se,{className:"border-border/50",children:[s.jsx(Rx,{asChild:!0,children:s.jsx(kt,{className:"cursor-pointer hover:bg-muted/30 transition-colors py-4",children:s.jsxs(Et,{className:"font-display flex items-center justify-between text-base",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(i1,{className:"w-5 h-5 text-primary"}),"Historique Elo"]}),s.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:a?"Masquer":"Afficher"})]})})}),s.jsx(Mx,{children:s.jsx(De,{className:"pt-0",children:s.jsx(afe,{userId:e==null?void 0:e.id})})})]})}),s.jsx("div",{id:"badges",className:"scroll-mt-24",children:s.jsx(ese,{userId:e==null?void 0:e.id,variant:"full"})})]})]}),s.jsx("div",{className:"mt-8 pt-6 border-t border-border/30",children:s.jsx(iwt,{})})]})}function uwt(){const{user:e}=Tt();return st({queryKey:["player-history",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return[];const{data:t,error:n}=await re.from("tickets").select(`
2792          id,
2793          status,
2794          created_at,
2795          updated_at,
2796          is_for_self,
2797          guest_first_name,
2798          guest_last_name,
2799          credit_total_cents,
2800          reservation_code,
2801          events (
2802            id,
2803            title,
2804            event_date,
2805            status,
2806            venues (
2807              id,
2808              name,
2809              city
2810            )
2811          )
2812        `).or(`user_id.eq.${e.id},purchaser_id.eq.${e.id}`).order("created_at",{ascending:!1});if(n)throw n;return t||[]},enabled:!!(e!=null&&e.id)})}function g3({entry:e,variant:t}){var f,h,p,x;const n=e.is_for_self!==!1,r=!n&&e.guest_first_name?`${e.guest_first_name}${e.guest_last_name?` ${e.guest_last_name}`:""}`:null,i=Ze(new Date(e.created_at),"d MMM yyyy",{locale:pt}),a=(t==="upcoming"||t==="completed")&&((f=e.events)==null?void 0:f.id),o=()=>{var y;return(y=e.events)!=null&&y.id?t==="upcoming"?`/events/${e.events.id}/ticket`:`/player/tournament/${e.events.id}`:"#"},c={upcoming:{icon:Mk,iconClass:"text-primary",dotClass:"bg-primary",bgClass:"bg-primary/10",borderClass:"border-primary/20 hover:border-primary/50 hover:bg-primary/5 curs
2812or-pointer",badgeClass:"bg-primary/10 text-primary border-primary/20",badgeText:e.status==="paid"?"Payé":e.status==="checked_in"?"Présent":"Réservé"},completed:{icon:Xt,iconClass:"text-emerald-600",dotClass:"bg-emerald-600",bgClass:"bg-emerald-500/10",borderClass:"border-emerald-500/20 hover:border-emerald-500/50 hover:bg-emerald-500/5 cursor-pointer",badgeClass:"bg-emerald-500/10 text-emerald-600 border-emerald-500/20",badgeText:"Terminé"},cancelled:{icon:hi,iconClass:"text-destructive",dotClass:"bg-destructive",bgClass:"bg-destructive/10",borderClass:"border-destructive/20 hover:border-destructive/30",badgeClass:"bg-destructive/10 text-destructive border-destructive/20",badgeText:"Annulé"}}[t],u=c.icon,d=s.jsxs("div",{className:ae("flex items-start gap-3 sm:gap-4 p-3 sm:p-4 rounded-xl border backdrop-blur-sm bg-card/50 transition-all duration-200",c.borderClass),children:[s.jsx("div",{className:ae("hidden sm:flex w-10 h-10 sm:w-12 sm:h-12 rounded-xl items-center justify-center shrink-0",c.bgClass),children:s.jsx(u,{className:ae("w-5 h-5 sm:w-6 sm:h-6",c.iconClass)})}),s.jsx("div",{className:ae("sm:hidden w-2 h-2 rounded-full shrink-0 mt-2",c.dotClass)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h3",{className:"font-semibold text-foreground truncate text-sm sm:text-base",children:((h=e.events)==null?void 0:h.title)||"Événement supprimé"}),!n&&s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground mt-0.5",children:[s.jsx(sn,{className:"w-3 h-3 shrink-0"}),"Pour ",r||"un invité"]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsx(we,{variant:"outline",className:ae("text-xs",c.badgeClass),children:c.badgeText}),a&&s.jsx(la,{className:"w-4 h-4 text-muted-foreground"})]})]}),e.events&&s.jsxs("div",{className:"flex flex-col sm:flex-row sm:flex-wrap gap-1 sm:gap-x-3 text-sm text-muted-foreground mt-2",children:[s.jsxs("span",{className:"flex items-center gap-1.5 truncate",children:[s.jsx(gn,{className:"w-3.5 h-3.5 shrink-0"}),s.jsxs("span",{className:"truncate",children:[(p=e.events.venues)==null?void 0:p.name,((x=e.events.venues)==null?void 0:x.city)&&`, ${e.events.venues.city}`]})]}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(Jn,{className:"w-3.5 h-3.5 shrink-0"}),Ze(new Date(e.events.event_date),"d MMM · HH'h'mm",{locale:pt})]})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:flex-wrap sm:items-center gap-1 sm:gap-x-3 text-xs text-muted-foreground mt-2 pt-2 border-t border-border/50",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Vt,{className:"w-3 h-3 shrink-0"}),"Inscrit le ",i]}),t==="cancelled"&&e.updated_at&&s.jsxs("span",{className:"text-destructive/80",children:["Annulé le ",Ze(new Date(e.updated_at),"d MMM yyyy",{locale:pt})]})]})]})]});return a?s.jsx(Pe,{to:o(),className:"block",children:d}):d}function x3({variant:e}){const t={upcoming:{icon:Mk,title:"Aucune inscription à venir",description:"Vous n'avez pas d'inscription pour des tournois à venir. Explorez les événements disponibles !",linkText:"Découvrir les tournois",linkTo:"/events"},completed:{icon:Xt,title:"Aucun tournoi terminé",description:"Vous n'avez pas encore participé à des tournois. Inscrivez-vous pour commencer !",linkText:"Voir les tournois",linkTo:"/events"},cancelled:{icon:Hge,title:"Aucune annulation",description:"Vous n'avez aucune inscription annulée. Bonne nouvelle !",linkText:null,linkTo:null}},{icon:n,title:r,description:i,linkText:a,linkTo:o}=t[e];return s.jsxs("div",{className:"text-center py-12 px-4",children:[s.jsx("div",{className:"w-16 h-16 rounded-2xl bg-muted/50 backdrop-blur-sm flex items-center justify-center mx-auto mb-4",children:s.jsx(n,{className:"w-8 h-8 text-muted-foreground"})}),s.jsx("h3",{className:"font-display text-lg font-semibold mb-2",children:r}),s.jsx("p",{className:"text-muted-foreground text-sm max-w-md mx-auto mb-4",children:i}),a&&o&&s.jsxs(Pe,{to:o,className:"inline-flex items-center gap-2 text-sm font-medium text-primary hover:text-primary/80 transition-colors",children:[a,s.jsx(Fn,{className:"w-4 h-4 rotate-180"})]})]})}function dwt(){const{data:e,isLoading:t}=uwt(),{upcoming:n,completed:r,cancelled:i}=N.useMemo(()=>
2812{if(!e)return{upcoming:[],completed:[],cancelled:[]};const o=new Date,l=e.filter(d=>d.status==="cancelled"||!d.events?!1:new Date(d.events.event_date)>o&&d.events.status!=="completed").sort((d,f)=>new Date(d.events.event_date).getTime()-new Date(f.events.event_date).getTime()),c=e.filter(d=>d.status==="cancelled"||!d.events?!1:d.events.status==="completed").sort((d,f)=>new Date(f.events.event_date).getTime()-new Date(d.events.event_date).getTime()),u=e.filter(d=>d.status==="cancelled").sort((d,f)=>new Date(f.updated_at).getTime()-new Date(d.updated_at).getTime());return{upcoming:l,completed:c,cancelled:u}},[e]),a=n.length>0?"upcoming":r.length>0?"completed":"upcoming";return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Pe,{to:"/player",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(Fn,{className:"w-4 h-4"}),"Retour au tableau de bord"]}),s.jsxs("div",{children:[s.jsx("h1",{className:"font-display text-2xl md:text-3xl font-bold text-foreground",children:"Mes inscriptions"}),s.jsx("p",{className:"text-muted-foreground mt-1",children:"Retrouvez toutes vos inscriptions passées, présentes et à venir"})]}),t?s.jsxs("div",{className:"space-y-4",children:[s.jsx(Ie,{className:"h-10 w-full"}),[1,2,3].map(o=>s.jsx(Ie,{className:"h-32 w-full"},o))]}):s.jsxs(Ka,{defaultValue:a,className:"w-full",children:[s.jsxs(Ca,{className:"grid w-full grid-cols-3 mb-6 bg-muted/30 backdrop-blur-sm p-1 h-auto",children:[s.jsxs(vn,{value:"upcoming",className:"flex items-center gap-1.5 py-2.5 text-xs sm:text-sm data-[state=active]:bg-primary/10 data-[state=active]:text-primary data-[state=active]:shadow-sm",children:[s.jsx(Mk,{className:"w-4 h-4 hidden sm:block"}),s.jsx("span",{children:"À venir"}),n.length>0&&s.jsx(we,{variant:"secondary",className:"ml-1 h-5 min-w-5 px-1.5 text-xs bg-primary/20 text-primary",children:n.length})]}),s.jsxs(vn,{value:"completed",className:"flex items-center gap-1.5 py-2.5 text-xs sm:text-sm data-[state=active]:bg-emerald-500/10 data-[state=active]:text-emerald-600 data-[state=active]:shadow-sm",children:[s.jsx(Xt,{className:"w-4 h-4 hidden sm:block"}),s.jsx("span",{children:"Terminés"}),r.length>0&&s.jsx(we,{variant:"secondary",className:"ml-1 h-5 min-w-5 px-1.5 text-xs",children:r.length})]}),s.jsxs(vn,{value:"cancelled",className:"flex items-center gap-1.5 py-2.5 text-xs sm:text-sm data-[state=active]:bg-destructive/10 data-[state=active]:text-destructive data-[state=active]:shadow-sm",children:[s.jsx(hi,{className:"w-4 h-4 hidden sm:block"}),s.jsx("span",{children:"Annulés"}),i.length>0&&s.jsx(we,{variant:"secondary",className:"ml-1 h-5 min-w-5 px-1.5 text-xs",children:i.length})]})]}),s.jsx(Sn,{value:"upcoming",className:"mt-0",children:n.length>0?s.jsx("div",{className:"space-y-3",children:n.map(o=>s.jsx(g3,{entry:o,variant:"upcoming"},o.id))}):s.jsx(x3,{variant:"upcoming"})}),s.jsx(Sn,{value:"completed",className:"mt-0",children:r.length>0?s.jsx("div",{className:"space-y-3",children:r.map(o=>s.jsx(g3,{entry:o,variant:"completed"},o.id))}):s.jsx(x3,{variant:"completed"})}),s.jsx(Sn,{value:"cancelled",className:"mt-0",children:i.length>0?s.jsx("div",{className:"space-y-3",children:i.map(o=>s.jsx(g3,{entry:o,variant:"cancelled"},o.id))}):s.jsx(x3,{variant:"cancelled"})})]})]})}function fwt(){const{data:e=[],isLoading:t,isError:n}=Tte();return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Pe,{to:"/player",children:s.jsx(Q,{variant:"ghost",size:"icon","aria-label":"Retour au tableau de bord",children:s.jsx(Fn,{className:"w-5 h-5"})})}),s.jsxs("div",{children:[s.jsxs("h1",{className:"font-display text-2xl md:text-3xl font-bold flex items-center gap-2",children:[s.jsx(tu,{className:"w-6 h-6 fill-primary text-primary"}),"Mes lieux favoris"]}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:e.length>0?`${e.length} lieu${e.length>1?"x":""} suivi${e.length>1?"s":""}`:"Retrouvez ici les lieux que vous suivez"})]})]}),t&&s.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:3}).map((r,i)=>s.jsx(Ie,{className:"h-48 rounded-lg"},i))}),n&&s.jsx(Se,{children:s.jsx(De,{className:"p-6 text-center text-sm text-muted-foreground",children:"Impossible de charger vos favoris pour le moment."})}),!t&&!n&&e.length===0&&s.jsx(Se,{className:"border-dashed",children:s.jsxs(De,{className:"p-10 text-center space-y-4",children:[s.jsx("div",{className:"w-14 h-14 mx-auto rounded-full bg-primary/10 flex items-center justify-center",children:s.jsx(tu,{className:"w-7 h-7 text-primary"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"font-display text-lg font-semibold",children:"Aucun favori pour l'instant"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Ajoutez vos lieux préférés en cliquant sur le cœur depuis la liste des lieux."})]}),s.jsx(Pe,{to:"/venues",children:s.jsxs(Q,{className:"gap-2",children:[s.jsx(Yge,{className:"w-4 h-4"}),"Découvrir les lieux"]})})]})}),!t&&e.length>0&&s.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:e.map(r=>{const i=r.venue;if(!i)return null;const a=`/venues/${i.slug||i.id}`;return s.jsxs(Se,{className:"group relative overflow-hidden hover:shadow-lg transition-all duration-300 hover:border-primary/30 backdrop-blur-sm bg-card/80",children:[s.jsx(tse,{venueId:i.id,venueName:i.name,variant:"floating"}),s.jsxs(Pe,{to:a,className:"block",children:[i.image_url?s.jsx("img",{src:i.image_url,alt:i.name,className:"w-full h-32 object-cover",loading:"lazy"}):s.jsx("div",{className:"w-full h-32 bg-primary/5 flex items-center justify-center",children:s.jsx(gn,{className:"w-8 h-8 text-primary/40"})}),s.jsxs(De,{className:"p-4",children:[s.jsx("h3",{className:"font-display text-base font-semibold group-hover:text-primary transition-colors line-clamp-1",children:i.name}),s.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1 mt-1",children:[s.jsx(gn,{className:"w-3.5 h-3.5 flex-shrink-0"}),s.jsxs("span",{className:"truncate",children:[i.address,", ",i.city]})]})]})]})]},r.id)})})]})}function hwt(){const{user:e,isLoading:t}=Tt();return st({queryKey:["active-tournament",e==null?void 0:e.id],queryFn:async()=>
2812{if(!(e!=null&&e.id))return null;const{data:n,error:r}=await re.from("checkins").select(`
2813          ticket:tickets!inner(
2814            user_id,
2815            event:events!inner(
2816              id,
2817              title,
2818              event_date,
2819              status,
2820              rounds_count,
2821              venue:venues!inner(name)
2822            )
2823          )
2824        `).eq("ticket.user_id",e.id).eq("ticket.event.status","ongoing").limit(1);if(r)throw r;if(!n||n.length===0)return null;const i=n[0].ticket,a=Array.isArray(i)?i[0]:i;if(!a)return null;const o=a.event,l=Array.isArray(o)?o[0]:o;if(!l)return null;const c=l.venue,u=Array.isArray(c)?c[0]:c,{data:d,error:f}=await re.from("rounds").select("id, round_number, status").eq("event_id",l.id).order("round_number",{ascending:!1}).limit(1);if(f)throw f;const h=d==null?void 0:d[0];if(!h)return{eventId:l.id,eventTitle:l.title,eventDate:l.event_date,venueName:(u==null?void 0:u.name)||"",currentRound:0,totalRounds:l.rounds_count||4,tableNumber:null,opponent:null,isWhitePlayer:!1,pairingId:null,needsAction:!1,roundStatus:"pending"};const{data:p}=await re.from("tickets").select("id").eq("event_id",l.id).eq("user_id",e.id).eq("is_for_self",!0).maybeSingle();let x=re.from("pairings").select(`
2825          id,
2826          table_number,
2827          white_player_id,
2828          black_player_id,
2829          white_ticket_id,
2830          black_ticket_id,
2831          white_player:profiles!pairings_white_player_id_fkey(id, display_name, first_name, last_name, avatar_url),
2832          black_player:profiles!pairings_black_player_id_fkey(id, display_name, first_name, last_name, avatar_url),
2833          game_result:game_results(id, validation_status, white_player_claim, black_player_claim)
2834        `).eq("round_id",h.id);p!=null&&p.id?x=x.or(`white_ticket_id.eq.${p.id},black_ticket_id.eq.${p.id}`):x=x.or(`white_player_id.eq.${e.id},black_player_id.eq.${e.id}`);const{data:y,error:b}=await x.limit(1);if(b)throw b;const w=y==null?void 0:y[0];if(!w)return{eventId:l.id,eventTitle:l.title,eventDate:l.event_date,venueName:(u==null?void 0:u.name)||"",currentRound:h.round_number,totalRounds:l.rounds_count||4,tableNumber:null,opponent:null,isWhitePlayer:!1,pairingId:null,needsAction:!1,roundStatus:h.status};const _=w.white_player_id===e.id,j=_?w.black_player:w.white_player,E=Array.isArray(j)?j[0]:j,S=w.game_result,T=Array.isArray(S)?S[0]:S,P=(T==null?void 0:T.validation_status)||"pending";_?T==null||T.white_player_claim:T==null||T.black_player_claim;const O=h.status==="active"&&P!=="confirmed"&&P!=="peer_resolved"&&P!=="staff_override";return{eventId:l.id,eventTitle:l.title,eventDate:l.event_date,venueName:(u==null?void 0:u.name)||"",currentRound:h.round_number,totalRounds:l.rounds_count||4,tableNumber:w.table_number,opponent:E?{id:E.id||"",displayName:E.display_name||"",firstName:E.first_name,lastName:E.last_name,avatarUrl:E.avatar_url}:null,isWhitePlayer:_,pairingId:w.id,needsAction:O,roundStatus:h.status}},enabled:!!(e!=null&&e.id)&&!t,staleTime:60*1e3,gcTime:5*60*1e3,placeholderData:hp,refetchInterval:3e4,refetchOnWindowFocus:!0})}function mwt(e,t){return st({queryKey:["player-ticket-credit",e,t],queryFn:async()=>{if(!e||!t)return null;const{data:n,error:r}=await re.from("tickets").select("credit_remaining_cents, credit_total_cents, qr_code, reservation_code").eq("event_id",e).eq("user_id",t).eq("is_for_self",!0).in("status",["paid","checked_in"]).maybeSingle();return r?(console.error("Error fetching ticket credit:",r),null):n},enabled:!!e&&!!t,staleTime:6e4,gcTime:3e5})}function pwt({isCheckedIn:e,eventId:t,className:n}){return e?s.jsxs("div",{className:ae("relative overflow-hidden rounded-xl border p-4","bg-success/10 border-success/30","backdrop-blur-sm",n),children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-success/5 via-transparent to-success/10 pointer-events-none"}),s.jsxs("div",{className:"relative flex items-start gap-3",children:[s.jsx("div",{className:"shrink-0 mt-0.5",children:s.jsx(Jr,{className:"h-5 w-5 text-success"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"font-semibold text-success text-sm",children:"Vous êtes bien enregistré"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Le tournoi démarrera automatiquement quand tous les joueurs seront arrivés"})]})]})]}):s.jsxs("div",{className:ae("relative overflow-hidden rounded-xl border p-4","bg-warning/10 border-warning/30","backdrop-blur-sm",n),children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-warning/5 via-trans
2834parent to-warning/10 pointer-events-none"}),s.jsxs("div",{className:"relative flex items-start gap-3",children:[s.jsx("div",{className:"shrink-0 mt-0.5",children:s.jsx(El,{className:"h-5 w-5 text-warning animate-pulse"})}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold text-warning text-sm",children:"Vous n'êtes pas encore enregistré"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Présentez votre QR code au bar pour valider votre présence et permettre le démarrage"})]}),s.jsx(Q,{asChild:!0,size:"sm",variant:"outline",className:"h-9 gap-2 border-warning/30 text-warning hover:bg-warning/10 hover:text-warning",children:s.jsxs(Pe,{to:`/tickets/${t}`,children:[s.jsx(nu,{className:"h-4 w-4"}),s.jsx("span",{children:"Voir mon QR code"})]})})]})]})]})}function gwt(e){const[t,n]=N.useState(()=>Math.max(0,e.getTime()-Date.now()));return N.useEffect(()=>{const r=setInterval(()=>{const i=e.getTime()-Date.now();n(Math.max(0,i))},1e3);return()=>clearInterval(r)},[e]),N.useMemo(()=>({days:Math.floor(t/(1e3*60*60*24)),hours:Math.floor(t/(1e3*60*60)%24),minutes:Math.floor(t/(1e3*60)%60),seconds:Math.floor(t/1e3%60),isExpired:t<=0,totalMs:t}),[t])}function W_({value:e,label:t}){return s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"w-14 sm:w-16 h-14 sm:h-16 rounded-lg bg-primary/10 border border-primary/20 flex items-center justify-center backdrop-blur-sm",children:s.jsx("span",{className:"font-mono text-2xl sm:text-3xl font-bold tabular-nums text-primary",children:e.toString().padStart(2,"0")})}),s.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:t})]})}function y3({icon:e,label:t,value:n}){return s.jsxs("div",{className:"flex flex-col items-center gap-1 p-3 rounded-lg bg-muted/30",children:[s.jsx(e,{className:"w-5 h-5 text-primary"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:t}),s.jsx("span",{className:"text-sm font-medium text-center",children:n})]})}function xwt({event:e,venue:t}){const n=N.useMemo(()=>new Date(e.event_date),[e.event_date]),r=gwt(n),{data:i=0}=Rfe(e.id),{data:a=[]}=Nte(e.id),o=a.find(p=>p.is_for_self!==!1),l=o?o.status==="checked_in"||(Array.isArray(o.checkin)?o.checkin.length>0:!!o.checkin):null,c=Ze(n,"EEEE d MMMM yyyy 'à' HH'h'mm",{locale:pt}),u=c.charAt(0).toUpperCase()+c.slice(1),d=e.capacity>0?Math.min(100,i/e.capacity*100):0,f=i>=e.capacity,h=N.useMemo(()=>r.isExpired?"Le tournoi devrait commencer bientôt":r.days>0?`Début dans ${r.days} jour${r.days>1?"s":""} et ${r.hours} heure${r.hours>1?"s":""}`:r.hours>0?`Début dans ${r.hours}h${r.minutes.toString().padStart(2,"0")}`:r.minutes>0?`Début dans ${r.minutes} minute${r.minutes>1?"s":""}`:"Début imminent !",[r]);return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Pe,{to:"/player",className:"inline-flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(Fn,{className:"w-4 h-4"}),"Retour au dashboard"]}),l!==null&&s.jsx(pwt,{isCheckedIn:l,eventId:e.id}),s.jsxs("div",{children:[s.jsx("div",{className:"flex items-center gap-2 mb-2",children:s.jsx(we,{variant:"secondary",className:"bg-blue-500/20 text-blue-600 dark:bg-blue-500/30 dark:text-blue-400 border-blue-500/30",children:"À venir"})}),s.jsx("h1",{className:"font-display text-2xl md:text-3xl font-bold",children:e.title})]}),s.jsxs(Se,{className:"relative overflow-hidden bg-gradient-to-br from-primary/5 via-background to-primary/10 backdrop-blur-sm border-primary/20",children:[s.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-primary/5 rounded-full blur-3xl -translate-y-1/2 translate-x-1/2"}),s.jsxs(De,{className:"p-6 text-center relative",children:[s.jsx(Xn.div,{animate:{scale:r.isExpired?[1,1.1,1]:1},transition:{duration:1.5,repeat:r.isExpired?1/0:0,ease:"easeInOut"},className:"mb-4",children:s.jsx("div",{className:ae("w-16 h-16 mx-auto rounded-full flex items-center justify-center border transition-colors",r.isExpired?"bg-amber-500/20 border-amber-500/30":"bg-primary/10 border-primary/20"),children:s.jsx(Vt,{className:ae("w-8 h-8",r.isExpired?"text-amber-500":"text-primary")})})}),!r.isExpired&&s.jsxs("div",{className:"flex justify-center gap-2 sm:gap-4 mb-4","aria-live":"polite",children:[r.days>0&&s.jsx(W_,{value:r.days,label:"jours"}),s.jsx(W_,{value:r.hours,label:"heures"}),s.jsx(W_,{value:r.minutes,label:"min"}),s.jsx(R2,{mode:"popLayout",children:s.jsx(Xn.div,{initial:{scale:.8,opacity:0}
2834,animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},transition:{duration:.15},children:s.jsx(W_,{value:r.seconds,label:"sec"})},r.seconds)})]}),s.jsx("p",{className:ae("text-sm font-medium mb-2",r.isExpired?"text-amber-600 dark:text-amber-400":"text-muted-foreground"),children:h})]})]}),s.jsx(Se,{className:ae("border transition-colors",f?"bg-green-500/10 border-green-500/30":"bg-muted/30 border-border"),children:s.jsxs(De,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[s.jsx(Xn.div,{initial:{scale:1.2},animate:{scale:1},className:ae("w-10 h-10 rounded-full flex items-center justify-center",f?"bg-green-500/20":"bg-primary/10"),children:s.jsx(sn,{className:ae("w-5 h-5",f?"text-green-600":"text-primary")})},i),s.jsxs("div",{className:"flex-1",children:[s.jsxs("p",{className:"font-medium","aria-live":"polite",children:[i," / ",e.capacity," joueurs arrivés"]}),f&&s.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:"Tous les joueurs sont présents !"})]}),f&&s.jsx(we,{className:"bg-green-600 hover:bg-green-600",children:"Complet"})]}),s.jsx(du,{value:d,className:ae("h-2",f&&"[&>div]:bg-green-500")})]})}),s.jsx(Se,{className:"bg-muted/30",children:s.jsxs(De,{className:"p-6",children:[s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 mb-6",children:[s.jsx(y3,{icon:Jn,label:"Date",value:u}),s.jsx(y3,{icon:gn,label:"Lieu",value:t?`${t.name}, ${t.city}`:"—"}),s.jsx(y3,{icon:Xt,label:"Format",value:`${e.rounds_count||5} rondes${e.time_control?` • ${e.time_control}`:""}`})]}),s.jsx(Fs,{className:"my-6"}),s.jsxs("div",{className:"text-left bg-background/50 rounded-lg p-4",children:[s.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[s.jsx(Jr,{className:"w-4 h-4 text-primary"}),"Conseils"]}),s.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"text-primary mt-0.5",children:"•"}),"Arrivez 15 min en avance pour le check-in"]}),s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"text-primary mt-0.5",children:"•"}),"Présentez votre QR code à l'entrée"]}),s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"text-primary mt-0.5",children:"•"}),"Le tournoi durera environ 2h"]})]})]})]})}),s.jsx(Pe,{to:"/player",className:"block",children:s.jsxs(Q,{variant:"outline",className:"w-full",children:[s.jsx(Fn,{className:"w-4 h-4 mr-2"}),"Retour au dashboard"]})})]})}const v3=[{key:"initializing",label:"Connexion..."},{key:"loading-event",label:"Chargement..."},{key:"loading-rounds",label:"Préparation..."},{key:"ready",label:"Prêt !"}];function ywt({stage:e,eventTitle:t}){const n=v3.findIndex(i=>i.key===e),r=(n+1)/v3.length*100;return s.jsx("div",{className:"min-h-[60vh] flex items-center justify-center px-4",children:s.jsx(Xn.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.3,ease:"easeOut"},className:"w-full max-w-sm",children:s.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-background/80 via-background/60 to-primary/5 backdrop-blur-xl border border-primary/20 shadow-xl p-8",children:[s.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-primary/10 rounded-full blur-3xl -translate-y-1/2 translate-x-1/2"}),s.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-primary/5 rounded-full blur-2xl translate-y-1/2 -translate-x-1/2"}),s.jsxs("div",{className:"relative z-10 text-center space-y-6",children:[s.jsx(Xn.div,{animate:{scale:[1,1.05,1]},transition:{duration:1.5,repeat:1/0,ease:"easeInOut"},className:"mx-auto",children:s.jsx("div",{className:"w-20 h-20 mx-auto rounded-full bg-primary/10 border border-primary/20 flex items-center justify-center shadow-lg",children:s.jsx(sa,{className:"w-10 h-10 text-primary drop-shadow-md"})})}),t?s.jsx(Xn.h2,{initial:{opacity:0}
2834,animate:{opacity:1},className:"font-display text-xl font-bold text-foreground truncate",children:t}):s.jsx("div",{className:"h-7 w-48 mx-auto rounded bg-muted/30 animate-pulse"}),s.jsxs("div",{className:"relative h-2 rounded-full bg-muted/30 overflow-hidden",children:[s.jsx(Xn.div,{className:"absolute inset-y-0 left-0 bg-gradient-to-r from-primary/70 via-primary to-primary/70 rounded-full",initial:{width:0},animate:{width:`${r}%`},transition:{duration:.4,ease:"easeOut"}}),s.jsx(Xn.div,{className:"absolute inset-y-0 w-20 bg-gradient-to-r from-transparent via-white/20 to-transparent",animate:{x:[-80,320]},transition:{duration:1.5,repeat:1/0,ease:"linear"}})]}),s.jsx("div",{className:"flex justify-center gap-2 flex-wrap",children:v3.map((i,a)=>{const o=a<n,l=a===n;return s.jsxs(Xn.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:a*.1},className:ae("flex items-center gap-1 px-3 py-1.5 rounded-full text-xs font-medium transition-all",o&&"bg-primary/20 text-primary",l&&"bg-primary text-primary-foreground",!o&&!l&&"bg-muted/30 text-muted-foreground"),children:[o?s.jsx(is,{className:"w-3 h-3"}):l?s.jsx(We,{className:"w-3 h-3 animate-spin"}):null,s.jsx("span",{children:i.label})]},i.key)})})]})]})})})}function LW(){var Z,G;const{id:e}=Wi(),t=Rr(),n=Ye(),{user:r}=Tt(),{isTimerActive:i}=_6(),{data:a,isLoading:o}=hwt(),[l,c]=N.useState("games"),[u,d]=N.useState(null),f=e||(a==null?void 0:a.eventId),{data:h,isLoading:p,error:x}=Joe(f),{data:y=[]}=C6(f,(Z=h==null?void 0:h.event)==null?void 0:Z.tiebreak_criteria),{players:b}=B0(f,(G=h==null?void 0:h.event)==null?void 0:G.tiebreak_criteria),w=b.find(se=>se.playerId===u)||null,_=N.useCallback(se=>d(se),[]),{data:j}=ole(f,r==null?void 0:r.id,{pollingEnabled:!i}),{data:E}=mwt(f,r==null?void 0:r.id),S=h==null?void 0:h.event,T=(h==null?void 0:h.rounds)||[],P=(S==null?void 0:S.venue)||null,O=T.length>0,D=(S==null?void 0:S.status)==="ongoing",R=(S==null?void 0:S.status)==="completed",L=D&&O||R,{isTransitioning:M,isClosing:B}=$8({eventId:f||"",rounds:T,totalRounds:(S==null?void 0:S.rounds_count)||4,enabled:D&&L&&!i});N.useEffect(()=>{!o&&!e&&!a&&t("/player")},[a,o,e,t]),N.useEffect(()=>{R&&(r!=null&&r.id)&&(n.invalidateQueries({queryKey:["player-stats",r.id]}),n.invalidateQueries({queryKey:["player-achievements",r.id]}),n.invalidateQueries({queryKey:["player-history"]}))},[R,r==null?void 0:r.id,n]);const U=N.useMemo(()=>f?p&&!S?"loading-event":p?"loading-rounds":"ready":"initializing",[f,p,S]);if(!(!!S&&T!==void 0)&&(o||p))return s.jsx(ywt,{stage:U,eventTitle:S==null?void 0:S.title});if(x)return s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Xt,{className:"w-16 h-16 text-destructive/50 mx-auto mb-4"}),s.jsx("h2",{className:"font-display text-xl font-bold mb-2",children:"Erreur de chargement"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Impossible de charger les informations du tournoi."}),s.jsx(Pe,{to:"/player",children:s.jsx(Q,{variant:"outline",children:"Retour au dashboard"})})]});if(!S||!f)return e?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Xt,{className:"w-16 h-16 text-muted-foreground mx-auto mb-4"}),s.jsx("h2",{className:"font-display text-xl font-bold mb-2",children:"Tournoi introuvable"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Ce tournoi n'existe pas ou a été supprimé."}),s.jsx(Pe,{to:"/player",children:s.jsx(Q,{children:"Retour au dashboard"})})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Xt,{className:"w-16 h-16 text-muted-foreground mx-auto mb-4"}),s.jsx("h2",{className:"font-display text-xl font-bold mb-2",children:"Aucun tournoi en cours"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Vous n'êtes inscrit à aucun tournoi actif pour le moment."}),s.jsx(Pe,{to:"/events",children:s.jsx(Q,{children:"Voir les tournois"})})]});if(!L&&!R)return s.jsx(xwt,{event:S,venue:P});const H=T.find(se=>se.status==="active"),z=(H==null?void 0:H.round_number)||(T.length>0?Math.max(...T.map(se=>se.round_number)):0),K=j==null?void 0:j.pairing,W=(j==null?void 0:j.isWhitePlayer)||!1,q=y.find(se=>se.playerId===(r==null?void 0:r.id)),oe=q?y.indexOf(q)+1:null,J=W?K==null?void 0:K.black_player_id:K==null?void 0:K.white_player_id,Y=J?y.find(se=>se.playerId===J):null;
2834return s.jsxs("div",{className:"space-y-4 sm:space-y-6 overflow-x-hidden",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs(Pe,{to:"/player",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(Fn,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden xs:inline",children:"Retour au dashboard"}),s.jsx("span",{className:"xs:hidden",children:"Retour"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 sm:gap-2",children:[s.jsx(we,{variant:"default",className:ae("text-xs sm:text-sm",D&&"bg-green-600 hover:bg-green-600/90",R&&"bg-muted text-muted-foreground"),children:D?"En cours":"Terminé"}),s.jsxs(we,{variant:"outline",className:"text-xs sm:text-sm",children:["Ronde ",z,"/",S.rounds_count||4]})]}),s.jsx("h1",{className:"font-display text-xl sm:text-2xl md:text-3xl font-bold break-words leading-tight",children:S.title}),s.jsxs("div",{className:"flex flex-col xs:flex-row xs:flex-wrap xs:items-center gap-1.5 xs:gap-3 sm:gap-4 text-xs sm:text-sm text-muted-foreground",children:[P&&s.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(gn,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 flex-shrink-0"}),s.jsxs("span",{className:"truncate",children:[P.name,", ",P.city]})]}),S.time_control&&s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(Vt,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 flex-shrink-0"}),s.jsx("span",{children:S.time_control})]}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(sn,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 flex-shrink-0"}),s.jsxs("span",{children:[y.length||(h==null?void 0:h.participantCount)||0," joueurs"]})]})]})]}),R&&s.jsx(Se,{className:"bg-gradient-to-r from-amber-500/10 via-amber-400/5 to-primary/10 border-amber-500/30 backdrop-blur-sm",children:s.jsx(De,{className:"p-4 sm:p-5",children:s.jsxs("div",{className:"flex items-center gap-3 sm:gap-4",children:[s.jsx("div",{className:"w-12 h-12 sm:w-14 sm:h-14 rounded-xl bg-amber-500/20 flex items-center justify-center flex-shrink-0",children:s.jsx(Xt,{className:"w-6 h-6 sm:w-7 sm:h-7 text-amber-500"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h3",{className:"font-display text-base sm:text-lg font-bold text-foreground",children:"Tournoi terminé"}),s.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:oe?s.jsxs(s.Fragment,{children:["Vous avez terminé ",s.jsxs("span",{className:"font-semibold text-amber-600",children:["#",oe]})," sur ",y.length," joueurs"]}):s.jsx(s.Fragment,{children:"Consultez le classement final et vos parties"})})]})]})})}),!R&&!B&&H&&K&&!K.is_bye&&s.jsx(ple,{pairing:K,round:H,totalRounds:S.rounds_count||4,userId:(r==null?void 0:r.id)||"",timeControl:S.time_control||"10+0",eventId:f,isWhitePlayer:W,userRank:oe||void 0,totalPlayers:y.length||void 0,isTransitioning:M,userPoints:q==null?void 0:q.points,opponentPoints:Y==null?void 0:Y.points,venueId:P==null?void 0:P.id,ticketCreditRemainingCents:E==null?void 0:E.credit_remaining_cents,ticketCreditTotalCents:E==null?void 0:E.credit_total_cents,ticketQrCode:E==null?void 0:E.qr_code,ticketReservationCode:E==null?void 0:E.reservation_code}),!R&&!B&&H&&(K==null?void 0:K.is_bye)&&s.jsx(Se,{className:"bg-muted/30 border-muted-foreground/20",children:s.jsxs(De,{className:"p-4 sm:p-6 text-center",children:[s.jsx(Xt,{className:"w-10 h-10 sm:w-12 sm:h-12 text-muted-foreground mx-auto mb-2 sm:mb-3"}),s.jsx("h3",{className:"font-display text-base sm:text-lg font-bold mb-1",children:"Exempt cette ronde"}),s.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Vous êtes automatiquement crédité de 1 point."})]})}),!R&&!B&&H&&s.jsx(oE,{startedAt:H.started_at,timeControl:S.time_control||"10+0"}),!R&&oe&&s.jsx(Se,{className:"bg-gradient-to-r from-primary/10 via-primary/5 to-background border-primary/30",children:s.jsx(De,{className:"p-3 sm:p-4",children:s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[s.jsx("div",{className:"w-10 h-10 sm:w-12 sm:h-12 rounded-full bg-primary/20 flex items-center justify-center flex-shrink-0",children:s.jsxs("span",{className:"font-display text-lg sm:text-xl font-bold text-primary",children:["#",oe]})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"font-medium text-sm sm:text-base",children:"Votre classement"}),s.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground truncate",children:[(q==null?void 0:q.points)||0," pts • ",(q==null?void 0:q.gamesPlayed)||0," parties"]})]})]}),s.jsx(Xt,{className:"w-6 h-6 sm:w-8 sm:h-8 text-primary/50 flex-shrink-0"})]})})}),s.jsxs(Ka,{value:l,onValueChange:c,className:"w-full",children:[s.jsxs(Ca,{className:"grid w-full grid-cols-3 h-10 sm:h-11",children:[s.jsxs(vn,{value:"games",className:"gap-1 sm:gap-2 text-xs sm:text-sm",children:[s.jsx(Xt,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),s.jsx("span",{children:"Parties"})]}),s.jsxs(vn,{value:"standings",className:"gap-1 sm:gap-2 text-xs sm:text-sm",children:[s.jsx(sn,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),s.jsx("span",{children:"Classement"})]}),s.jsxs(vn,{value:"crosstable",className:"gap-1 sm:gap-2 text-xs sm:text-sm",children:[s.jsx(Fm,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),s.jsx("span",{children:"Grille"})]})]}),s.jsx(Sn,{value:"games",className:"mt-3 sm:mt-4",children:r!=null&&r.id?s.jsx(gle,{eventId:f,userId:r.id,totalRounds:S.rounds_count||4,currentRoundNumber:z}):s.jsx(Se,{children:s.jsx(De,{className:"p-4 sm:p-6 text-center text-muted-foreground text-sm",children:"Connectez-vous pour voir vos parties."})})}),s.jsx(Sn,{value:"standings",className:"mt-3 sm:mt-4",children:s.jsx(sE,{eventId:f,tiebreakCriteria:S==null?void 0:S.tiebreak_criteria,onPlayerClick:_})}),s.jsx(Sn,{value:"crosstable",className:"mt-3 sm:mt-4",children:s.jsx(iE,{eventId:f,tiebreakCriteria:S==null?void 0:S.tiebreak_criteria,onPlayerClick:_})})]}),s.jsx(aE,{player:w,allPlayers:b,open:!!u,onOpenChange:se=>!se&&d(null)})]})}const vwt=[{value:"1+0",label:"Bullet",sublabel:"1 min",icon:s.jsx(gd,{className:"w-4 h-4"}),category:"bullet"},{value:"3+2",label:"Blitz",sublabel:"3 + 2",icon:s.jsx(oj,{className:"w-4 h-4"}),category:"blitz"},{value:"5+2",label:"Blitz",sublabel:"5 + 2",icon:s.jsx(oj,{className:"w-4 h-4"}),category:"blitz"},{value:"7+2",label:"Blitz rapide",sublabel:"7 + 2",icon:s.jsx(oj,{className:"w-4 h-4"}),category:"blitz"},{value:"10+0",label:"Rapide",sublabel:"10 min",icon:s.jsx(wF,{className:"w-4 h-4"}),category:"rapid"},{value:"15+10",label:"Rapide",sublabel:"15 + 10",icon:s.jsx(wF,{className:"w-4 h-4"}),category:"rapid"}],FW="casual-timer:last-control";function bwt({onLaunch:e}){const t=typeof window<"u"?localStorage.getItem(FW):null,[n,r]=N.useState("10"),[i,a]=N.useState("0"),[o,l]=N.useState(null),c=d=>{try{localStorage.setItem(FW,d)}catch{}e(d)},u=()=>{const d=parseInt(n,10),f=parseInt(i||"0",10);if(isNaN(d)||d<1||d>180){l("Minutes : entre 1 et 180");return}if(isNaN(f)||f<0||f>60){l("Incrément : entre 0 et 60 secondes");return}l(null),c(`${d}+${f}`)};return s.jsxs("div",{className:"space-y-6",children:[t&&s.jsx(Se,{className:"p-4 bg-primary/5 border-primary/30",children:s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(Vt,{className:"w-5 h-5 text-primary shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"Dernière cadence"}),s.jsx("p",{className:"font-mono font-semibold truncate",children:t})]})]}),s.jsxs(Q,{size:"sm",onClick:()=>c(t),className:"gap-1.5 shrink-0",children:[s.jsx(Na,{className:"w-4 h-4"}),"Reprendre"]})]})}),s.jsxs("div",{children:[s.jsx("h2",{className:"font-display text-lg font-bold mb-3",children:"Cadences rapides"}),s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:vwt.map(d=>s.jsxs("button",{type:"button",onClick:()=>
2834c(d.value),className:ae("group flex flex-col items-start gap-2 p-4 rounded-xl border border-border bg-card","hover:border-primary hover:bg-primary/5 transition-all","min-h-[88px] touch-manipulation text-left"),children:[s.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[d.icon,s.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:d.label})]}),s.jsx("span",{className:"font-mono text-lg font-bold tabular-nums",children:d.sublabel})]},d.value))})]}),s.jsxs("div",{children:[s.jsx("h2",{className:"font-display text-lg font-bold mb-3",children:"Cadence personnalisée"}),s.jsxs(Se,{className:"p-4 space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:"Minutes (1-180)"}),s.jsx(Ue,{type:"number",inputMode:"numeric",min:1,max:180,value:n,onChange:d=>r(d.target.value),className:"font-mono text-lg"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:"Incrément (sec)"}),s.jsx(Ue,{type:"number",inputMode:"numeric",min:0,max:60,value:i,onChange:d=>a(d.target.value),className:"font-mono text-lg"})]})]}),o&&s.jsx("p",{className:"text-xs text-destructive",children:o}),s.jsxs(Q,{onClick:u,className:"w-full gap-2",size:"lg",children:[s.jsx(Na,{className:"w-5 h-5"}),"Démarrer"]})]})]})]})}function wwt(){Rr();const[e,t]=N.useState(null);return e?s.jsx(ule,{pairingId:"casual-local",timeControl:e,onClose:()=>t(null)}):s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Pe,{to:"/player/profile",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(Fn,{className:"w-4 h-4"}),"Retour au profil"]}),s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"p-2.5 rounded-xl bg-primary/10",children:s.jsx(Vt,{className:"w-6 h-6 text-primary"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"font-display text-xl sm:text-2xl md:text-3xl font-bold text-foreground",children:"Pendule rapide"}),s.jsx("p",{className:"text-muted-foreground text-sm sm:text-base mt-1",children:"Lancez une partie avec un ami en quelques secondes"})]})]}),s.jsx(bwt,{onLaunch:t})]})}const _wt=new Xve;function jwt(){return s.jsxs(Obe,{children:[s.jsx(Nje,{}),s.jsxs(jje,{children:[s.jsx(Tje,{}),s.jsx(Eje,{}),s.jsxs(obe,{children:[s.jsx(Bt,{path:"/",element:s.jsx(jAe,{})}),s.jsx(Bt,{path:"/auth",element:s.jsx(L3e,{})}),s.jsx(Bt,{path:"/auth/callback",element:s.jsx(F3e,{})}),s.jsx(Bt,{path:"/reset-password",element:s.jsx(U3e,{})}),s.jsx(Bt,{path:"/preregistration/extend",element:s.jsx(OVe,{})}),s.jsx(Bt,{path:"/checkout/resume",element:s.jsx(DVe,{})}),s.jsx(Bt,{path:"/events",element:s.jsx(nLe,{})}),s.jsx(Bt,{path:"/events/:id",element:s.jsx(kUe,{})}),s.jsx(Bt,{path:"/venues",element:s.jsx(bVe,{})}),s.jsx(Bt,{path:"/venues/:id",element:s.jsx(pVe,{})}),s.jsx(Bt,{path:"/faq",element:s.jsx(_Ve,{})}),s.jsx(Bt,{path:"/partenaires",element:s.jsx(jVe,{})}),s.jsx(Bt,{path:"/cgu",element:s.jsx(NVe,{})}),s.jsx(Bt,{path:"/confidentialite",element:s.jsx(kVe,{})}),s.jsx(Bt,{path:"/confidentialite/photos",element:s.jsx(CVe,{})}),s.jsx(Bt,{path:"/tournoi-odeon",element:s.jsx(PVe,{})}),s.jsx(Bt,{path:"/events/:id/register",element:s.jsx(MUe,{})}),s.jsx(Bt,{path:"/events/:id/ticket",element:s.jsx(JUe,{})}),s.jsx(Bt,{path:"/events/:id/access",element:s.jsx(ZUe,{})}),s.jsx(Bt,{path:"/events/:id/live",element:s.jsx(rVe,{})}),s.jsx(Bt,{path:"/events/:id/photos",element:s.jsx(sVe,{})}),s.jsx(Bt,{path:"/events/:id/payment-success",element:s.jsx(aVe,{})}),s.jsx(Bt,{path:"/events/:id/payment-cancel",element:s.jsx(oVe,{})}),s.jsx(Bt,{path:"/onboarding/elo",element:s.jsx(e_,{allowedRoles:["player","admin"],children:s.jsx(sRe,{})})}),s.jsxs(Bt,{path:"/player",element:s.jsx(e_,{allowedRoles:["player","admin"],children:s.jsx(Qbt,{})}),children:[s.jsx(Bt,{index:!0,element:s.jsx(kIe,{})}),s.jsx(Bt,{path:"profile",element:s.jsx(cwt,{})}),s.jsx(Bt,{path:"history",element:s.jsx(dwt,{})}),s.jsx(Bt,{path:"favorites",element:s.jsx(fwt,{})}),s.jsx(Bt,{path:"tournament",element:s.jsx(LW,{})}),s.jsx(Bt,{path:"tournament/:id",element:s.jsx(LW,{})}),s.jsx(Bt,{path:"timer",element:s.jsx(wwt,{})})]}),s.jsxs(Bt,{path:"/venue",element:s.jsx(e_,{allowedRoles:["venue","admin"],children:s.jsx(mbt,{})}),children:[s.jsx(Bt,{index:!0,element:s.jsx(P8e,{})}),s.jsx(Bt,{path:"events/:id",element:s.jsx(bbt,{})}),s.jsx(Bt,{path:"events/:id/checkin",element:s.jsx(Gbt,{})}),s.jsx(Bt,{path:"events/:id/tournament",element:s.jsx(Xbt,{})})]}),s.jsxs(Bt,{path:"/admin",element:s.jsx(e_,{allowedRoles:["admin"],children:s.jsx(RVe,{})}),children:[s.jsx(Bt,{index:!0,element:s.jsx($Ve,{})}),s.jsx(Bt,{path:"events",element:s.jsx(_yt,{})}),s.jsx(Bt,{path:"sales",element:s.jsx(dbt,{})}),s.jsx(Bt,{path:"events/:id",element:s.jsx(lvt,{})}),s.jsx(Bt,{path:"events/:id/tournament",element:s.jsx(Pvt,{})}),s.jsx(Bt,{path:"events/:id/checkin",element:s.jsx(f1t,{})}),s.jsx(Bt,{path:"venue-requests",element:s.jsx(BVe,{})}),s.jsx(Bt,{path:"venues",element:s.jsx(qVe,{})}),s.jsx(Bt,{path:"venues/:id",element:s.jsx(JVe,{})}),s.jsx(Bt,{path:"users",element:s.jsx(dHe,{})}),s.jsx(Bt,{path:"users/:userId",element:s.jsx(pyt,{})}),s.jsx(Bt,{path:"emails",element:s.jsx(v1t,{})}),s.jsx(Bt,{path:"newsletter",element:s.jsx(k1t,{})}),s.jsx(Bt,{path:"photos",element:s.jsx(hbt,{})}),s.jsx(Bt,{path:"fide-tests",element:s.jsx(F1t,{})}),s.jsx(Bt,{path:"openpairing-diagnostics",element:s.jsx(K1t,{})})]}),s.jsx(Bt,{path:"*",element:s.jsx(O8e,{})})]})]})]})}const Nwt=()=>s.jsx(Qve,{client:_wt,children:s.jsxs(Xk,{children:[s.jsx(c0e,{}),s.jsx(B0e,{}),s.jsx(jwt,{})]})});let $W=!1;function kwt(){if($W||typeof window>"u")return;const e="1500771015183308";$W=!0,function(t,n,r,i){var c;if(t.fbq)return;const a=t.fbq=function(){a.callMethod?a.callMethod.apply(a,arguments):a.queue.push(arguments)};t._fbq||(t._fbq=a),a.push=a,a.loaded=!0,a.version="2.0",a.queue=[];const o=n.createElement(r);o.async=!0,o.src=i;const l=n.getElementsByTagName(r)[0];(c=l.parentNode)==null||c.insertBefore(o,l)}(window,document,"script","https://connect.facebook.net/en_US/fbevents.js"),window.fbq("init",e),window.fbq("track","PageView")}kwt();
2834"serviceWorker"in navigator&&(navigator.serviceWorker.getRegistrations().then(e=>{for(const t of e)t.unregister().then(n=>{n&&console.log("[PWA Cleanup] Service Worker désinstallé avec succès")})}).catch(e=>{console.error("[PWA Cleanup] Erreur lors du nettoyage:",e)}),"caches"in window&&caches.keys().then(e=>{e.forEach(t=>{caches.delete(t).then(()=>{console.log("[PWA Cleanup] Cache supprimé:",t)})})}));dY(document.getElementById("root")).render(s.jsx(ee.StrictMode,{children:s.jsx(Nwt,{})}));export{Q as B,fp as C,Fk as E,Pe as L,gn as M,Vm as P,xo as R,Ie as S,sn as U,ka as _,wo as a,E0 as b,ae as c,Vje as d,mp as e,Ze as f,la as g,QI as h,aC as i,s as j,Hm as k,Lf as l,pt as m,bo as n,od as o,Vt as p,Jn as q,N as r,aa as s,km as t,ee as u,Yf as v,dr as w,Lo as x};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.