PageSourceSearch

https://reverie-art-evaluation.lovable.app/assets/index-BjDmxzTD.js

js reverie-art-evaluation.lovable.app collected 2026-10-03 03:42:46 UTC 1,650,236 bytes, 809 lines download raw bytes

vendor: 6,403 bytes, lines 1-9
1var BL=Object.defineProperty;var $5=e=>{throw TypeError(e)};var UL=(e,t,n)=>t in e?BL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Zt=(e,t,n)=>UL(e,typeof t!="symbol"?t+"":t,n),Gx=(e,t,n)=>t.has(e)||$5("Cannot "+n);var Pe=(e,t,n)=>(Gx(e,t,"read from private field"),n?n.call(e):t.get(e)),Yt=(e,t,n)=>t.has(e)?$5("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),At=(e,t,n,r)=>(Gx(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Or=(e,t,n)=>(Gx(e,t,"access private method"),n);var Vp=(e,t,n,r)=>({set _(i){At(e,t,i,n)},get _(){return Pe(e,t,r)}});function zL(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 s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{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 s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var HQ=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Y1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var b3={exports:{}},b0={},y3={exports:{}},Ot={};/**
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 Wf=Symbol.for("react.element"),qL=Symbol.for("react.portal"),WL=Symbol.for("react.fragment"),HL=Symbol.for("react.strict_mode"),VL=Symbol.for("react.profiler"),GL=Symbol.for("react.provider"),YL=Symbol.for("react.context"),KL=Symbol.for("react.forward_ref"),JL=Symbol.for("react.suspense"),XL=Symbol.for("react.memo"),ZL=Symbol.for("react.lazy"),B5=Symbol.iterator;function QL(e){return e===null||typeof e!="object"?null:(e=B5&&e[B5]||e["@@iterator"],typeof e=="function"?e:null)}var w3={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_3=Object.assign,k3={};function ku(e,t,n){this.props=e,this.context=t,this.refs=k3,this.updater=n||w3}ku.prototype.isReactComponent={};ku.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")};ku.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function N3(){}N3.prototype=ku.prototype;function K1(e,t,n){this.props=e,this.context=t,this.refs=k3,this.updater=n||w3}var J1=K1.prototype=new N3;J1.constructor=K1;_3(J1,ku.prototype);J1.isPureReactComponent=!0;var U5=Array.isArray,S3=Object.prototype.hasOwnProperty,X1={current:null},j3={key:!0,ref:!0,__self:!0,__source:!0};function E3(e,t,n){var r,i={},s=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(s=""+t.key),t)S3.call(t,r)&&!j3.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),d=0;d<l;d++)c[d]=arguments[d+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:Wf,type:e,key:s,ref:a,props:i,_owner:X1.current}}function eR(e,t){return{$$typeof:Wf,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Z1(e){return typeof e=="object"&&e!==null&&e.$$typeof===Wf}function tR(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var z5=/\/+/g;function Yx(e,t){return typeof e=="object"&&e!==null&&e.key!=null?tR(""+e.key):t.toString(36)}function Gm(e,t,n,r,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(s){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Wf:case qL:a=!0}}if(a)return a=e,i=i(a),e=r===""?"."+Yx(a,0):r,U5(i)?(n="",e!=null&&(n=e.replace(z5,"$&/")+"/"),Gm(i,t,n,"",function(d){return d})):i!=null&&(Z1(i)&&(i=eR(i,n+(!i.key||a&&a.key===i.key?"":(""+i.key).replace(z5,"$&/")+"/")+e)),t.push(i)),1;if(a=0,r=r===""?".":r+":",U5(e))for(var l=0;l<e.length;l++){s=e[l];var c=r+Yx(s,l);a+=Gm(s,t,n,c,i)}else if(c=QL(e),typeof c=="function")for(e=c.call(e),l=0;!(s=e.next()).done;)s=s.value,c=r+Yx(s,l++),a+=Gm(s,t,n,c,i);else if(s==="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 a}function Gp(e,t,n){if(e==null)return e;var r=[],i=0;return Gm(e,r,"","",function(s){return t.call(n,s,i++)}),r}function nR(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 ri={current:null},Ym={transition:null},rR={ReactCurrentDispatcher:ri,ReactCurrentBatchConfig:Ym,ReactCurrentOwner:X1};function C3(){throw Error("act(...) is not supported in production builds of React.")}Ot.Children={map:Gp,forEach:function(e,t,n){Gp(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Gp(e,function(){t++}),t},toArray:function(e){return Gp(e,function(t){return t})||[]},only:function(e){if(!Z1(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ot.Component=ku;Ot.Fragment=WL;Ot.Profiler=VL;Ot.PureComponent=K1;Ot.StrictMode=HL;Ot.Suspense=JL;
vendor: 9,043 bytes, lines 9-33
9Ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=rR;Ot.act=C3;Ot.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=_3({},e.props),i=e.key,s=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,a=X1.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)S3.call(t,c)&&!j3.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 d=0;d<c;d++)l[d]=arguments[d+2];r.children=l}return{$$typeof:Wf,type:e.type,key:i,ref:s,props:r,_owner:a}};Ot.createContext=function(e){return e={$$typeof:YL,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:GL,_context:e},e.Consumer=e};Ot.createElement=E3;Ot.createFactory=function(e){var t=E3.bind(null,e);return t.type=e,t};Ot.createRef=function(){return{current:null}};Ot.forwardRef=function(e){return{$$typeof:KL,render:e}};Ot.isValidElement=Z1;Ot.lazy=function(e){return{$$typeof:ZL,_payload:{_status:-1,_result:e},_init:nR}};Ot.memo=function(e,t){return{$$typeof:XL,type:e,compare:t===void 0?null:t}};Ot.startTransition=function(e){var t=Ym.transition;Ym.transition={};try{e()}finally{Ym.transition=t}};Ot.unstable_act=C3;Ot.useCallback=function(e,t){return ri.current.useCallback(e,t)};Ot.useContext=function(e){return ri.current.useContext(e)};Ot.useDebugValue=function(){};Ot.useDeferredValue=function(e){return ri.current.useDeferredValue(e)};Ot.useEffect=function(e,t){return ri.current.useEffect(e,t)};Ot.useId=function(){return ri.current.useId()};Ot.useImperativeHandle=function(e,t,n){return ri.current.useImperativeHandle(e,t,n)};Ot.useInsertionEffect=function(e,t){return ri.current.useInsertionEffect(e,t)};Ot.useLayoutEffect=function(e,t){return ri.current.useLayoutEffect(e,t)};Ot.useMemo=function(e,t){return ri.current.useMemo(e,t)};Ot.useReducer=function(e,t,n){return ri.current.useReducer(e,t,n)};Ot.useRef=function(e){return ri.current.useRef(e)};Ot.useState=function(e){return ri.current.useState(e)};Ot.useSyncExternalStore=function(e,t,n){return ri.current.useSyncExternalStore(e,t,n)};Ot.useTransition=function(){return ri.current.useTransition()};Ot.version="18.3.1";y3.exports=Ot;var k=y3.exports;const Ue=Y1(k),Q1=zL({__proto__:null,default:Ue},[k]);/**
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 iR=k,sR=Symbol.for("react.element"),oR=Symbol.for("react.fragment"),aR=Object.prototype.hasOwnProperty,lR=iR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,cR={key:!0,ref:!0,__self:!0,__source:!0};function A3(e,t,n){var r,i={},s=null,a=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)aR.call(t,r)&&!cR.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:sR,type:e,key:s,ref:a,props:i,_owner:lR.current}}b0.Fragment=oR;b0.jsx=A3;b0.jsxs=A3;b3.exports=b0;var o=b3.exports,P3={exports:{}},Bi={},L3={exports:{}},R3={};/**
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($,D){var ie=$.length;$.push(D);e:for(;0<ie;){var X=ie-1>>>1,E=$[X];if(0<i(E,D))$[X]=D,$[ie]=E,ie=X;else break e}}function n($){return $.length===0?null:$[0]}function r($){if($.length===0)return null;var D=$[0],ie=$.pop();if(ie!==D){$[0]=ie;e:for(var X=0,E=$.length,q=E>>>1;X<q;){var F=2*(X+1)-1,Z=$[F],Y=F+1,ee=$[Y];if(0>i(Z,ie))Y<E&&0>i(ee,Z)?($[X]=ee,$[Y]=ie,X=Y):($[X]=Z,$[F]=ie,X=F);else if(Y<E&&0>i(ee,ie))$[X]=ee,$[Y]=ie,X=Y;else break e}}return D}function i($,D){var ie=$.sortIndex-D.sortIndex;return ie!==0?ie:$.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],d=[],u=1,f=null,p=3,h=!1,x=!1,g=!1,b=typeof setTimeout=="function"?setTimeout:null,y=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 w($){for(var D=n(d);D!==null;){if(D.callback===null)r(d);else if(D.startTime<=$)r(d),D.sortIndex=D.expirationTime,t(c,D);else break;D=n(d)}}function S($){if(g=!1,w($),!x)if(n(c)!==null)x=!0,re(C);else{var D=n(d);D!==null&&V(S,D.startTime-$)}}function C($,D){x=!1,g&&(g=!1,y(M),M=-1),h=!0;var ie=p;try{for(w(D),f=n(c);f!==null&&(!(f.expirationTime>D)||$&&!A());){var X=f.callback;if(typeof X=="function"){f.callback=null,p=f.priorityLevel;var E=X(f.expirationTime<=D);D=e.unstable_now(),typeof E=="function"?f.callback=E:f===n(c)&&r(c),w(D)}else r(c);f=n(c)}if(f!==null)var q=!0;else{var F=n(d);F!==null&&V(S,F.startTime-D),q=!1}return q}finally{f=null,p=ie,h=!1}}var P=!1,R=null,M=-1,T=5,H=-1;function A(){return!(e.unstable_now()-H<T)}function O(){if(R!==null){var $=e.unstable_now();H=$;var D=!0;try{D=R(!0,$)}finally{D?K():(P=!1,R=null)}}else P=!1}var K;if(typeof _=="function")K=function(){_(O)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,I=U.port2;U.port1.onmessage=O,K=function(){I.postMessage(null)}}else K=function(){b(O,0)};function re($){R=$,P||(P=!0,K())}function V($,D){M=b(function(){$(e.unstable_now())},D)}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($){$.callback=null},e.unstable_continueExecution=function(){x||h||(x=!0,re(C))},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function($){switch(p){case 1:case 2:case 3:var D=3;break;default:D=p}var ie=p;p=D;try{return $()}finally{p=ie}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,D){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var ie=p;p=$;try{return D()}finally{p=ie}},e.unstable_scheduleCallback=function($,D,ie){var X=e.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0<ie?X+ie:X):ie=X,$){case 1:var E=-1;break;case 2:E=250;break;case 5:E=1073741823;break;case 4:E=1e4;break;default:E=5e3}return E=ie+E,$={id:u++,callback:D,priorityLevel:$,startTime:ie,expirationTime:E,sortIndex:-1},ie>X?($.sortIndex=ie,t(d,$),n(c)===null&&$===n(d)&&(g?(y(M),M=-1):g=!0,V(S,ie-X))):($.sortIndex=E,t(c,$),x||h||(x=!0,re(C))),$},e.unstable_shouldYield=A,e.unstable_wrapCallback=function($){var D=p;return function(){var ie=p;p=D;try{return $.apply(this,arguments)}finally{p=ie}}}})(R3);L3.exports=R3;var dR=L3.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 uR=k,Mi=dR;function $e(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 T3=new Set,Zh={};function yc(e,t){su(e,t),su(e+"Capture",t)}function su(e,t){for(Zh[e]=t,e=0;e<t.length;e++)T3.add(t[e])}var Vo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ib=Object.prototype.hasOwnProperty,hR=/^[: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]*$/,q5={},W5={};function fR(e){return Ib.call(W5,e)?!0:Ib.call(q5,e)?!1:hR.test(e)?W5[e]=!0:(q5[e]=!0,!1)}function pR(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 mR(e,t,n,r){if(t===null||typeof t>"u"||pR(e,t,n,r))return!0;
vendor: 5,200 bytes, lines 33-34
33if(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 ii(e,t,n,r,i,s,a){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=s,this.removeEmptyString=a}var Ar={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ar[e]=new ii(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ar[t]=new ii(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ar[e]=new ii(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ar[e]=new ii(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){Ar[e]=new ii(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ar[e]=new ii(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ar[e]=new ii(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ar[e]=new ii(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ar[e]=new ii(e,5,!1,e.toLowerCase(),null,!1,!1)});var ew=/[\-:]([a-z])/g;function tw(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-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(ew,tw);Ar[t]=new ii(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(ew,tw);Ar[t]=new ii(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(ew,tw);Ar[t]=new ii(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ar[e]=new ii(e,1,!1,e.toLowerCase(),null,!1,!1)});Ar.xlinkHref=new ii("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ar[e]=new ii(e,1,!1,e.toLowerCase(),null,!0,!0)});function nw(e,t,n,r){var i=Ar.hasOwnProperty(t)?Ar[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(mR(t,n,i,r)&&(n=null),r||i===null?fR(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 Qo=uR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Yp=Symbol.for("react.element"),wd=Symbol.for("react.portal"),_d=Symbol.for("react.fragment"),rw=Symbol.for("react.strict_mode"),Db=Symbol.for("react.profiler"),O3=Symbol.for("react.provider"),I3=Symbol.for("react.context"),iw=Symbol.for("react.forward_ref"),Fb=Symbol.for("react.suspense"),Mb=Symbol.for("react.suspense_list"),sw=Symbol.for("react.memo"),Ea=Symbol.for("react.lazy"),D3=Symbol.for("react.offscreen"),H5=Symbol.iterator;function sh(e){return e===null||typeof e!="object"?null:(e=H5&&e[H5]||e["@@iterator"],typeof e=="function"?e:null)}var Pn=Object.assign,Kx;function Eh(e){if(Kx===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Kx=t&&t[1]||""}return`
34`+Kx+e}var Jx=!1;function Xx(e,t){if(!e||Jx)return"";Jx=!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(d){var r=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){r=d}e.call(t.prototype)}else{try{throw Error()}catch(d){r=d}e()}}
vendor: 16,488 bytes, lines 34-37
34catch(d){if(d&&r&&typeof d.stack=="string"){for(var i=d.stack.split(`
35`),s=r.stack.split(`
36`),a=i.length-1,l=s.length-1;1<=a&&0<=l&&i[a]!==s[l];)l--;for(;1<=a&&0<=l;a--,l--)if(i[a]!==s[l]){if(a!==1||l!==1)do if(a--,l--,0>l||i[a]!==s[l]){var c=`
37`+i[a].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=a&&0<=l);break}}}finally{Jx=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Eh(e):""}function gR(e){switch(e.tag){case 5:return Eh(e.type);case 16:return Eh("Lazy");case 13:return Eh("Suspense");case 19:return Eh("SuspenseList");case 0:case 2:case 15:return e=Xx(e.type,!1),e;case 11:return e=Xx(e.type.render,!1),e;case 1:return e=Xx(e.type,!0),e;default:return""}}function $b(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 _d:return"Fragment";case wd:return"Portal";case Db:return"Profiler";case rw:return"StrictMode";case Fb:return"Suspense";case Mb:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case I3:return(e.displayName||"Context")+".Consumer";case O3:return(e._context.displayName||"Context")+".Provider";case iw:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case sw:return t=e.displayName||null,t!==null?t:$b(e.type)||"Memo";case Ea:t=e._payload,e=e._init;try{return $b(e(t))}catch{}}return null}function xR(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 $b(t);case 8:return t===rw?"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 rl(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function F3(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function vR(e){var t=F3(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,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,s.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Kp(e){e._valueTracker||(e._valueTracker=vR(e))}function M3(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=F3(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function jg(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 Bb(e,t){var n=t.checked;return Pn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function V5(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=rl(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 $3(e,t){t=t.checked,t!=null&&nw(e,"checked",t,!1)}function Ub(e,t){$3(e,t);var n=rl(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")?zb(e,t.type,n):t.hasOwnProperty("defaultValue")&&zb(e,t.type,rl(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function G5(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 zb(e,t,n){(t!=="number"||jg(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ch=Array.isArray;function Id(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=""+rl(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 qb(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error($e(91));return Pn({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Y5(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error($e(92));if(Ch(n)){if(1<n.length)throw Error($e(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:rl(n)}}function B3(e,t){var n=rl(t.value),r=rl(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 K5(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function U3(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 Wb(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?U3(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Jp,z3=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(Jp=Jp||document.createElement("div"),Jp.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Jp.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Qh(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ih={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},bR=["Webkit","ms","Moz","O"];Object.keys(Ih).forEach(function(e){bR.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ih[t]=Ih[e]})});function q3(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ih.hasOwnProperty(e)&&Ih[e]?(""+t).trim():t+"px"}function W3(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=q3(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var yR=Pn({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 Hb(e,t){if(t){if(yR[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error($e(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error($e(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error($e(61))}if(t.style!=null&&typeof t.style!="object")throw Error($e(62))}}function Vb(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 Gb=null;function ow(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Yb=null,Dd=null,Fd=null;function J5(e){if(e=Gf(e)){if(typeof Yb!="function")throw Error($e(280));var t=e.stateNode;t&&(t=N0(t),Yb(e.stateNode,e.type,t))}}function H3(e){Dd?Fd?Fd.push(e):Fd=[e]:Dd=e}function V3(){if(Dd){var e=Dd,t=Fd;if(Fd=Dd=null,J5(e),t)for(e=0;e<t.length;e++)J5(t[e])}}function G3(e,t){return e(t)}function Y3(){}var Zx=!1;function K3(e,t,n){if(Zx)return e(t,n);Zx=!0;try{return G3(e,t,n)}finally{Zx=!1,(Dd!==null||Fd!==null)&&(Y3(),V3())}}function ef(e,t){var n=e.stateNode;if(n===null)return null;var r=N0(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($e(231,t,typeof n));return n}var Kb=!1;if(Vo)try{var oh={};Object.defineProperty(oh,"passive",{get:function(){Kb=!0}}),window.addEventListener("test",oh,oh),window.removeEventListener("test",oh,oh)}catch{Kb=!1}function wR(e,t,n,r,i,s,a,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(u){this.onError(u)}}var Dh=!1,Eg=null,Cg=!1,Jb=null,_R={onError:function(e){Dh=!0,Eg=e}};function kR(e,t,n,r,i,s,a,l,c){Dh=!1,Eg=null,wR.apply(_R,arguments)}function NR(e,t,n,r,i,s,a,l,c){if(kR.apply(this,arguments),Dh){if(Dh){var d=Eg;Dh=!1,Eg=null}else throw Error($e(198));Cg||(Cg=!0,Jb=d)}}function wc(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 J3(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 X5(e){if(wc(e)!==e)throw Error($e(188))}function SR(e){var t=e.alternate;if(!t){if(t=wc(e),t===null)throw Error($e(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return X5(i),e;if(s===r)return X5(i),t;s=s.sibling}throw Error($e(188))}if(n.return!==r.return)n=i,r=s;else{for(var a=!1,l=i.child;l;){if(l===n){a=!0,n=i,r=s;break}if(l===r){a=!0,r=i,n=s;break}l=l.sibling}if(!a){for(l=s.child;l;){if(l===n){a=!0,n=s,r=i;break}if(l===r){a=!0,r=s,n=i;break}l=l.sibling}if(!a)throw Error($e(189))}}if(n.alternate!==r)throw Error($e(190))}if(n.tag!==3)throw Error($e(188));return n.stateNode.current===n?e:t}function X3(e){return e=SR(e),e!==null?Z3(e):null}function Z3(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Z3(e);if(t!==null)return t;e=e.sibling}return null}var Q3=Mi.unstable_scheduleCallback,Z5=Mi.unstable_cancelCallback,jR=Mi.unstable_shouldYield,ER=Mi.unstable_requestPaint,Hn=Mi.unstable_now,CR=Mi.unstable_getCurrentPriorityLevel,aw=Mi.unstable_ImmediatePriority,e4=Mi.unstable_UserBlockingPriority,Ag=Mi.unstable_NormalPriority,AR=Mi.unstable_LowPriority,t4=Mi.unstable_IdlePriority,y0=null,io=null;function PR(e){if(io&&typeof io.onCommitFiberRoot=="function")try{io.onCommitFiberRoot(y0,e,void 0,(e.current.flags&128)===128)}catch{}}var ys=Math.clz32?Math.clz32:TR,LR=Math.log,RR=Math.LN2;function TR(e){return e>>>=0,e===0?32:31-(LR(e)/RR|0)|0}var Xp=64,Zp=4194304;function Ah(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 Pg(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,a=n&268435455;if(a!==0){var l=a&~i;l!==0?r=Ah(l):(s&=a,s!==0&&(r=Ah(s)))}else a=n&~i,a!==0?r=Ah(a):s!==0&&(r=Ah(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&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-ys(t),i=1<<n,r|=e[n],t&=~i;return r}function OR(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 IR(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var a=31-ys(s),l=1<<a,c=i[a];c===-1?(!(l&n)||l&r)&&(i[a]=OR(l,t)):c<=t&&(e.expiredLanes|=l),s&=~l}}function Xb(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function n4(){var e=Xp;return Xp<<=1,!(Xp&4194240)&&(Xp=64),e}function Qx(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Hf(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ys(t),e[t]=n}function DR(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-ys(n),s=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~s}}function lw(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ys(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var tn=0;function r4(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var i4,cw,s4,o4,a4,Zb=!1,Qp=[],Ha=null,Va=null,Ga=null,tf=new Map,nf=new Map,Aa=[],FR="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Q5(e,t){switch(e){case"focusin":case"focusout":Ha=null;break;case"dragenter":case"dragleave":Va=null;break;case"mouseover":case"mouseout":Ga=null;break;case"pointerover":case"pointerout":tf.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":nf.delete(t.pointerId)}}function ah(e,t,n,r,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},t!==null&&(t=Gf(t),t!==null&&cw(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function MR(e,t,n,r,i){switch(t){case"focusin":return Ha=ah(Ha,e,t,n,r,i),!0;case"dragenter":return Va=ah(Va,e,t,n,r,i),!0;case"mouseover":return Ga=ah(Ga,e,t,n,r,i),!0;case"pointerover":var s=i.pointerId;return tf.set(s,ah(tf.get(s)||null,e,t,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,nf.set(s,ah(nf.get(s)||null,e,t,n,r,i)),!0}return!1}function l4(e){var t=Vl(e.target);if(t!==null){var n=wc(t);if(n!==null){if(t=n.tag,t===13){if(t=J3(n),t!==null){e.blockedOn=t,a4(e.priority,function(){s4(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 Km(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Qb(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);
vendor: 12,106 bytes, line 37
37Gb=r,n.target.dispatchEvent(r),Gb=null}else return t=Gf(n),t!==null&&cw(t),e.blockedOn=n,!1;t.shift()}return!0}function e_(e,t,n){Km(e)&&n.delete(t)}function $R(){Zb=!1,Ha!==null&&Km(Ha)&&(Ha=null),Va!==null&&Km(Va)&&(Va=null),Ga!==null&&Km(Ga)&&(Ga=null),tf.forEach(e_),nf.forEach(e_)}function lh(e,t){e.blockedOn===t&&(e.blockedOn=null,Zb||(Zb=!0,Mi.unstable_scheduleCallback(Mi.unstable_NormalPriority,$R)))}function rf(e){function t(i){return lh(i,e)}if(0<Qp.length){lh(Qp[0],e);for(var n=1;n<Qp.length;n++){var r=Qp[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Ha!==null&&lh(Ha,e),Va!==null&&lh(Va,e),Ga!==null&&lh(Ga,e),tf.forEach(t),nf.forEach(t),n=0;n<Aa.length;n++)r=Aa[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Aa.length&&(n=Aa[0],n.blockedOn===null);)l4(n),n.blockedOn===null&&Aa.shift()}var Md=Qo.ReactCurrentBatchConfig,Lg=!0;function BR(e,t,n,r){var i=tn,s=Md.transition;Md.transition=null;try{tn=1,dw(e,t,n,r)}finally{tn=i,Md.transition=s}}function UR(e,t,n,r){var i=tn,s=Md.transition;Md.transition=null;try{tn=4,dw(e,t,n,r)}finally{tn=i,Md.transition=s}}function dw(e,t,n,r){if(Lg){var i=Qb(e,t,n,r);if(i===null)cv(e,t,r,Rg,n),Q5(e,r);else if(MR(i,e,t,n,r))r.stopPropagation();else if(Q5(e,r),t&4&&-1<FR.indexOf(e)){for(;i!==null;){var s=Gf(i);if(s!==null&&i4(s),s=Qb(e,t,n,r),s===null&&cv(e,t,r,Rg,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else cv(e,t,r,null,n)}}var Rg=null;function Qb(e,t,n,r){if(Rg=null,e=ow(r),e=Vl(e),e!==null)if(t=wc(e),t===null)e=null;else if(n=t.tag,n===13){if(e=J3(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 Rg=e,null}function c4(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(CR()){case aw:return 1;case e4:return 4;case Ag:case AR:return 16;case t4:return 536870912;default:return 16}default:return 16}}var Ba=null,uw=null,Jm=null;function d4(){if(Jm)return Jm;var e,t=uw,n=t.length,r,i="value"in Ba?Ba.value:Ba.textContent,s=i.length;for(e=0;e<n&&t[e]===i[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===i[s-r];r++);return Jm=i.slice(e,1<r?1-r:void 0)}function Xm(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 em(){return!0}function t_(){return!1}function Ui(e){function t(n,r,i,s,a){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=a,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?em:t_,this.isPropagationStopped=t_,this}return Pn(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=em)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=em)},persist:function(){},isPersistent:em}),t}var Nu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hw=Ui(Nu),Vf=Pn({},Nu,{view:0,detail:0}),zR=Ui(Vf),ev,tv,ch,w0=Pn({},Vf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fw,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!==ch&&(ch&&e.type==="mousemove"?(ev=e.screenX-ch.screenX,tv=e.screenY-ch.screenY):tv=ev=0,ch=e),ev)},movementY:function(e){return"movementY"in e?e.movementY:tv}}),n_=Ui(w0),qR=Pn({},w0,{dataTransfer:0}),WR=Ui(qR),HR=Pn({},Vf,{relatedTarget:0}),nv=Ui(HR),VR=Pn({},Nu,{animationName:0,elapsedTime:0,pseudoElement:0}),GR=Ui(VR),YR=Pn({},Nu,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),KR=Ui(YR),JR=Pn({},Nu,{data:0}),r_=Ui(JR),XR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ZR={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"},QR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function eT(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=QR[e])?!!t[e]:!1}function fw(){return eT}var tT=Pn({},Vf,{key:function(e){if(e.key){var t=XR[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Xm(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ZR[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fw,charCode:function(e){return e.type==="keypress"?Xm(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Xm(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),nT=Ui(tT),rT=Pn({},w0,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),i_=Ui(rT),iT=Pn({},Vf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fw}),sT=Ui(iT),oT=Pn({},Nu,{propertyName:0,elapsedTime:0,pseudoElement:0}),aT=Ui(oT),lT=Pn({},w0,{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}),cT=Ui(lT),dT=[9,13,27,32],pw=Vo&&"CompositionEvent"in window,Fh=null;Vo&&"documentMode"in document&&(Fh=document.documentMode);var uT=Vo&&"TextEvent"in window&&!Fh,u4=Vo&&(!pw||Fh&&8<Fh&&11>=Fh),s_=" ",o_=!1;function h4(e,t){switch(e){case"keyup":return dT.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function f4(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var kd=!1;function hT(e,t){switch(e){case"compositionend":return f4(t);case"keypress":return t.which!==32?null:(o_=!0,s_);case"textInput":return e=t.data,e===s_&&o_?null:e;default:return null}}function fT(e,t){if(kd)return e==="compositionend"||!pw&&h4(e,t)?(e=d4(),Jm=uw=Ba=null,kd=!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 u4&&t.locale!=="ko"?null:t.data;default:return null}}var pT={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 a_(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!pT[e.type]:t==="textarea"}function p4(e,t,n,r){H3(r),t=Tg(t,"onChange"),0<t.length&&(n=new hw("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Mh=null,sf=null;function mT(e){S4(e,0)}function _0(e){var t=jd(e);if(M3(t))return e}function gT(e,t){if(e==="change")return t}var m4=!1;if(Vo){var rv;if(Vo){var iv="oninput"in document;if(!iv){var l_=document.createElement("div");l_.setAttribute("oninput","return;"),iv=typeof l_.oninput=="function"}rv=iv}else rv=!1;m4=rv&&(!document.documentMode||9<document.documentMode)}function c_(){Mh&&(Mh.detachEvent("onpropertychange",g4),sf=Mh=null)}function g4(e){if(e.propertyName==="value"&&_0(sf)){var t=[];p4(t,sf,e,ow(e)),K3(mT,t)}}function xT(e,t,n){e==="focusin"?(c_(),Mh=t,sf=n,Mh.attachEvent("onpropertychange",g4)):e==="focusout"&&c_()}function vT(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return _0(sf)}function bT(e,t){if(e==="click")return _0(t)}function yT(e,t){if(e==="input"||e==="change")return _0(t)}function wT(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var _s=typeof Object.is=="function"?Object.is:wT;function of(e,t){if(_s(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(!Ib.call(t,i)||!_s(e[i],t[i]))return!1}return!0}function d_(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function u_(e,t){var n=d_(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=d_(n)}}function x4(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?x4(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function v4(){for(var e=window,t=jg();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=jg(e.document)}return t}function mw(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 _T(e){var t=v4(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&x4(n.ownerDocument.documentElement,n)){if(r!==null&&mw(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,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=u_(n,s);var a=u_(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.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 kT=Vo&&"documentMode"in document&&11>=document.documentMode,Nd=null,ey=null,$h=null,ty=!1;function h_(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ty||Nd==null||Nd!==jg(r)||(r=Nd,"selectionStart"in r&&mw(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focu
vendor: 4,501 bytes, line 37
37sNode:r.focusNode,focusOffset:r.focusOffset}),$h&&of($h,r)||($h=r,r=Tg(ey,"onSelect"),0<r.length&&(t=new hw("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Nd)))}function tm(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Sd={animationend:tm("Animation","AnimationEnd"),animationiteration:tm("Animation","AnimationIteration"),animationstart:tm("Animation","AnimationStart"),transitionend:tm("Transition","TransitionEnd")},sv={},b4={};Vo&&(b4=document.createElement("div").style,"AnimationEvent"in window||(delete Sd.animationend.animation,delete Sd.animationiteration.animation,delete Sd.animationstart.animation),"TransitionEvent"in window||delete Sd.transitionend.transition);function k0(e){if(sv[e])return sv[e];if(!Sd[e])return e;var t=Sd[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in b4)return sv[e]=t[n];return e}var y4=k0("animationend"),w4=k0("animationiteration"),_4=k0("animationstart"),k4=k0("transitionend"),N4=new Map,f_="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 ll(e,t){N4.set(e,t),yc(t,[e])}for(var ov=0;ov<f_.length;ov++){var av=f_[ov],NT=av.toLowerCase(),ST=av[0].toUpperCase()+av.slice(1);ll(NT,"on"+ST)}ll(y4,"onAnimationEnd");ll(w4,"onAnimationIteration");ll(_4,"onAnimationStart");ll("dblclick","onDoubleClick");ll("focusin","onFocus");ll("focusout","onBlur");ll(k4,"onTransitionEnd");su("onMouseEnter",["mouseout","mouseover"]);su("onMouseLeave",["mouseout","mouseover"]);su("onPointerEnter",["pointerout","pointerover"]);su("onPointerLeave",["pointerout","pointerover"]);yc("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));yc("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));yc("onBeforeInput",["compositionend","keypress","textInput","paste"]);yc("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));yc("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));yc("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ph="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(" "),jT=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ph));function p_(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,NR(r,t,void 0,e),e.currentTarget=null}function S4(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 s=void 0;if(t)for(var a=r.length-1;0<=a;a--){var l=r[a],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==s&&i.isPropagationStopped())break e;p_(i,l,d),s=c}else for(a=0;a<r.length;a++){if(l=r[a],c=l.instance,d=l.currentTarget,l=l.listener,c!==s&&i.isPropagationStopped())break e;p_(i,l,d),s=c}}}if(Cg)throw e=Jb,Cg=!1,Jb=null,e}function bn(e,t){var n=t[oy];n===void 0&&(n=t[oy]=new Set);var r=e+"__bubble";n.has(r)||(j4(t,e,2,!1),n.add(r))}function lv(e,t,n){var r=0;t&&(r|=4),j4(n,e,r,t)}var nm="_reactListening"+Math.random().toString(36).slice(2);function af(e){if(!e[nm]){e[nm]=!0,T3.forEach(function(n){n!=="selectionchange"&&(jT.has(n)||lv(n,!1,e),lv(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[nm]||(t[nm]=!0,lv("selectionchange",!1,t))}}function j4(e,t,n,r){switch(c4(t)){case 1:var i=BR;break;case 4:i=UR;break;default:i=dw}n=i.bind(null,t,n,e),i=void 0,!Kb||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 cv(e,t,n,r,i){var s=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var l=r.stateNode.containerInfo;
vendor: 2,527 bytes, line 37
37if(l===i||l.nodeType===8&&l.parentNode===i)break;if(a===4)for(a=r.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;a=a.return}for(;l!==null;){if(a=Vl(l),a===null)return;if(c=a.tag,c===5||c===6){r=s=a;continue e}l=l.parentNode}}r=r.return}K3(function(){var d=s,u=ow(n),f=[];e:{var p=N4.get(e);if(p!==void 0){var h=hw,x=e;switch(e){case"keypress":if(Xm(n)===0)break e;case"keydown":case"keyup":h=nT;break;case"focusin":x="focus",h=nv;break;case"focusout":x="blur",h=nv;break;case"beforeblur":case"afterblur":h=nv;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":h=n_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=WR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=sT;break;case y4:case w4:case _4:h=GR;break;case k4:h=aT;break;case"scroll":h=zR;break;case"wheel":h=cT;break;case"copy":case"cut":case"paste":h=KR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=i_}var g=(t&4)!==0,b=!g&&e==="scroll",y=g?p!==null?p+"Capture":null:p;g=[];for(var _=d,w;_!==null;){w=_;var S=w.stateNode;if(w.tag===5&&S!==null&&(w=S,y!==null&&(S=ef(_,y),S!=null&&g.push(lf(_,S,w)))),b)break;_=_.return}0<g.length&&(p=new h(p,x,null,n,u),f.push({event:p,listeners:g}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",p&&n!==Gb&&(x=n.relatedTarget||n.fromElement)&&(Vl(x)||x[Go]))break e;if((h||p)&&(p=u.window===u?u:(p=u.ownerDocument)?p.defaultView||p.parentWindow:window,h?(x=n.relatedTarget||n.toElement,h=d,x=x?Vl(x):null,x!==null&&(b=wc(x),x!==b||x.tag!==5&&x.tag!==6)&&(x=null)):(h=null,x=d),h!==x)){if(g=n_,S="onMouseLeave",y="onMouseEnter",_="mouse",(e==="pointerout"||e==="pointerover")&&(g=i_,S="onPointerLeave",y="onPointerEnter",_="pointer"),b=h==null?p:jd(h),w=x==null?p:jd(x),p=new g(S,_+"leave",h,n,u),p.target=b,p.relatedTarget=w,S=null,Vl(u)===d&&(g=new g(y,_+"enter",x,n,u),g.target=w,g.relatedTarget=b,S=g),b=S,h&&x)t:{for(g=h,y=x,_=0,w=g;w;w=Kc(w))_++;for(w=0,S=y;S;S=Kc(S))w++;for(;0<_-w;)g=Kc(g),_--;for(;0<w-_;)y=Kc(y),w--;for(;_--;){if(g===y||y!==null&&g===y.alternate)break t;g=Kc(g),y=Kc(y)}g=null}else g=null;h!==null&&m_(f,p,h,g,!1),x!==null&&b!==null&&m_(f,b,x,g,!0)}}
vendor: 5,488 bytes, lines 37-38
37e:{if(p=d?jd(d):window,h=p.nodeName&&p.nodeName.toLowerCase(),h==="select"||h==="input"&&p.type==="file")var C=gT;else if(a_(p))if(m4)C=yT;else{C=vT;var P=xT}else(h=p.nodeName)&&h.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(C=bT);if(C&&(C=C(e,d))){p4(f,C,n,u);break e}P&&P(e,p,d),e==="focusout"&&(P=p._wrapperState)&&P.controlled&&p.type==="number"&&zb(p,"number",p.value)}switch(P=d?jd(d):window,e){case"focusin":(a_(P)||P.contentEditable==="true")&&(Nd=P,ey=d,$h=null);break;case"focusout":$h=ey=Nd=null;break;case"mousedown":ty=!0;break;case"contextmenu":case"mouseup":case"dragend":ty=!1,h_(f,n,u);break;case"selectionchange":if(kT)break;case"keydown":case"keyup":h_(f,n,u)}var R;if(pw)e:{switch(e){case"compositionstart":var M="onCompositionStart";break e;case"compositionend":M="onCompositionEnd";break e;case"compositionupdate":M="onCompositionUpdate";break e}M=void 0}else kd?h4(e,n)&&(M="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(M="onCompositionStart");M&&(u4&&n.locale!=="ko"&&(kd||M!=="onCompositionStart"?M==="onCompositionEnd"&&kd&&(R=d4()):(Ba=u,uw="value"in Ba?Ba.value:Ba.textContent,kd=!0)),P=Tg(d,M),0<P.length&&(M=new r_(M,e,null,n,u),f.push({event:M,listeners:P}),R?M.data=R:(R=f4(n),R!==null&&(M.data=R)))),(R=uT?hT(e,n):fT(e,n))&&(d=Tg(d,"onBeforeInput"),0<d.length&&(u=new r_("onBeforeInput","beforeinput",null,n,u),f.push({event:u,listeners:d}),u.data=R))}S4(f,t)})}function lf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Tg(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=ef(e,n),s!=null&&r.unshift(lf(e,s,i)),s=ef(e,t),s!=null&&r.push(lf(e,s,i))),e=e.return}return r}function Kc(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function m_(e,t,n,r,i){for(var s=t._reactName,a=[];n!==null&&n!==r;){var l=n,c=l.alternate,d=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&d!==null&&(l=d,i?(c=ef(n,s),c!=null&&a.unshift(lf(n,c,l))):i||(c=ef(n,s),c!=null&&a.push(lf(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var ET=/\r\n?/g,CT=/\u0000|\uFFFD/g;function g_(e){return(typeof e=="string"?e:""+e).replace(ET,`
38`).replace(CT,"")}function rm(e,t,n){if(t=g_(t),g_(e)!==t&&n)throw Error($e(425))}function Og(){}var ny=null,ry=null;function iy(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 sy=typeof setTimeout=="function"?setTimeout:void 0,AT=typeof clearTimeout=="function"?clearTimeout:void 0,x_=typeof Promise=="function"?Promise:void 0,PT=typeof queueMicrotask=="function"?queueMicrotask:typeof x_<"u"?function(e){return x_.resolve(null).then(e).catch(LT)}:sy;function LT(e){setTimeout(function(){throw e})}function dv(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),rf(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);rf(t)}function Ya(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 v_(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 Su=Math.random().toString(36).slice(2),Qs="__reactFiber$"+Su,cf="__reactProps$"+Su,Go="__reactContainer$"+Su,oy="__reactEvents$"+Su,RT="__reactListeners$"+Su,TT="__reactHandles$"+Su;function Vl(e){var t=e[Qs];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Go]||n[Qs]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=v_(e);e!==null;){if(n=e[Qs])return n;e=v_(e)}return t}e=n,n=e.parentNode}return null}function Gf(e){return e=e[Qs]||e[Go],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function jd(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error($e(33))}function N0(e){return e[cf]||null}var ay=[],Ed=-1;function cl(e){return{current:e}}function _n(e){0>Ed||(e.current=ay[Ed],ay[Ed]=null,Ed--)}function fn(e,t){Ed++,ay[Ed]=e.current,e.current=t}var il={},Wr=cl(il),mi=cl(!1),lc=il;function ou(e,t){var n=e.type.contextTypes;if(!n)return il;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function gi(e){return e=e.childContextTypes,e!=null}function Ig(){_n(mi),_n(Wr)}function b_(e,t,n){if(Wr.current!==il)throw Error($e(168));fn(Wr,t),fn(mi,n)}function E4(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($e(108,xR(e)||"Unknown",i));return Pn({},n,r)}function Dg(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||il,lc=Wr.current,fn(Wr,e),fn(mi,mi.current),!0}function y_(e,t,n){var r=e.stateNode;if(!r)throw Error($e(169));n?(e=E4(e,t,lc),r.__reactInternalMemoizedMergedChildContext=e,_n(mi),_n(Wr),fn(Wr,e)):_n(mi),fn(mi,n)}var Fo=null,S0=!1,uv=!1;function C4(e){Fo===null?Fo=[e]:Fo.push(e)}function OT(e){S0=!0,C4(e)}function dl(){if(!uv&&Fo!==null){uv=!0;var e=0,t=tn;try{var n=Fo;for(tn=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Fo=null,S0=!1}
vendor: 16,086 bytes, line 38
38catch(i){throw Fo!==null&&(Fo=Fo.slice(e+1)),Q3(aw,dl),i}finally{tn=t,uv=!1}}return null}var Cd=[],Ad=0,Fg=null,Mg=0,Yi=[],Ki=0,cc=null,Uo=1,zo="";function Ml(e,t){Cd[Ad++]=Mg,Cd[Ad++]=Fg,Fg=e,Mg=t}function A4(e,t,n){Yi[Ki++]=Uo,Yi[Ki++]=zo,Yi[Ki++]=cc,cc=e;var r=Uo;e=zo;var i=32-ys(r)-1;r&=~(1<<i),n+=1;var s=32-ys(t)+i;if(30<s){var a=i-i%5;s=(r&(1<<a)-1).toString(32),r>>=a,i-=a,Uo=1<<32-ys(t)+i|n<<i|r,zo=s+e}else Uo=1<<s|n<<i|r,zo=e}function gw(e){e.return!==null&&(Ml(e,1),A4(e,1,0))}function xw(e){for(;e===Fg;)Fg=Cd[--Ad],Cd[Ad]=null,Mg=Cd[--Ad],Cd[Ad]=null;for(;e===cc;)cc=Yi[--Ki],Yi[Ki]=null,zo=Yi[--Ki],Yi[Ki]=null,Uo=Yi[--Ki],Yi[Ki]=null}var Di=null,Ti=null,Sn=!1,bs=null;function P4(e,t){var n=Xi(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 w_(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,Di=e,Ti=Ya(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Di=e,Ti=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=cc!==null?{id:Uo,overflow:zo}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Xi(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Di=e,Ti=null,!0):!1;default:return!1}}function ly(e){return(e.mode&1)!==0&&(e.flags&128)===0}function cy(e){if(Sn){var t=Ti;if(t){var n=t;if(!w_(e,t)){if(ly(e))throw Error($e(418));t=Ya(n.nextSibling);var r=Di;t&&w_(e,t)?P4(r,n):(e.flags=e.flags&-4097|2,Sn=!1,Di=e)}}else{if(ly(e))throw Error($e(418));e.flags=e.flags&-4097|2,Sn=!1,Di=e}}}function __(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Di=e}function im(e){if(e!==Di)return!1;if(!Sn)return __(e),Sn=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!iy(e.type,e.memoizedProps)),t&&(t=Ti)){if(ly(e))throw L4(),Error($e(418));for(;t;)P4(e,t),t=Ya(t.nextSibling)}if(__(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error($e(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Ti=Ya(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Ti=null}}else Ti=Di?Ya(e.stateNode.nextSibling):null;return!0}function L4(){for(var e=Ti;e;)e=Ya(e.nextSibling)}function au(){Ti=Di=null,Sn=!1}function vw(e){bs===null?bs=[e]:bs.push(e)}var IT=Qo.ReactCurrentBatchConfig;function dh(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($e(309));var r=n.stateNode}if(!r)throw Error($e(147,e));var i=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(a){var l=i.refs;a===null?delete l[s]:l[s]=a},t._stringRef=s,t)}if(typeof e!="string")throw Error($e(284));if(!n._owner)throw Error($e(290,e))}return e}function sm(e,t){throw e=Object.prototype.toString.call(t),Error($e(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function k_(e){var t=e._init;return t(e._payload)}function R4(e){function t(y,_){if(e){var w=y.deletions;w===null?(y.deletions=[_],y.flags|=16):w.push(_)}}function n(y,_){if(!e)return null;for(;_!==null;)t(y,_),_=_.sibling;return null}function r(y,_){for(y=new Map;_!==null;)_.key!==null?y.set(_.key,_):y.set(_.index,_),_=_.sibling;return y}function i(y,_){return y=Za(y,_),y.index=0,y.sibling=null,y}function s(y,_,w){return y.index=w,e?(w=y.alternate,w!==null?(w=w.index,w<_?(y.flags|=2,_):w):(y.flags|=2,_)):(y.flags|=1048576,_)}function a(y){return e&&y.alternate===null&&(y.flags|=2),y}function l(y,_,w,S){return _===null||_.tag!==6?(_=vv(w,y.mode,S),_.return=y,_):(_=i(_,w),_.return=y,_)}function c(y,_,w,S){var C=w.type;return C===_d?u(y,_,w.props.children,S,w.key):_!==null&&(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Ea&&k_(C)===_.type)?(S=i(_,w.props),S.ref=dh(y,_,w),S.return=y,S):(S=ig(w.type,w.key,w.props,null,y.mode,S),S.ref=dh(y,_,w),S.return=y,S)}function d(y,_,w,S){return _===null||_.tag!==4||_.stateNode.containerInfo!==w.containerInfo||_.stateNode.implementation!==w.implementation?(_=bv(w,y.mode,S),_.return=y,_):(_=i(_,w.children||[]),_.return=y,_)}function u(y,_,w,S,C){return _===null||_.tag!==7?(_=oc(w,y.mode,S,C),_.return=y,_):(_=i(_,w),_.return=y,_)}function f(y,_,w){if(typeof _=="string"&&_!==""||typeof _=="number")return _=vv(""+_,y.mode,w),_.return=y,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Yp:return w=ig(_.type,_.key,_.props,null,y.mode,w),w.ref=dh(y,null,_),w.return=y,w;case wd:return _=bv(_,y.mode,w),_.return=y,_;case Ea:var S=_._init;return f(y,S(_._payload),w)}if(Ch(_)||sh(_))return _=oc(_,y.mode,w,null),_.return=y,_;sm(y,_)}return null}function p(y,_,w,S){var C=_!==null?_.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return C!==null?null:l(y,_,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Yp:return w.key===C?c(y,_,w,S):null;case wd:return w.key===C?d(y,_,w,S):null;case Ea:return C=w._init,p(y,_,C(w._payload),S)}if(Ch(w)||sh(w))return C!==null?null:u(y,_,w,S,null);sm(y,w)}return null}function h(y,_,w,S,C){if(typeof S=="string"&&S!==""||typeof S=="number")return y=y.get(w)||null,l(_,y,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Yp:return y=y.get(S.key===null?w:S.key)||null,c(_,y,S,C);case wd:return y=y.get(S.key===null?w:S.key)||null,d(_,y,S,C);case Ea:var P=S._init;return h(y,_,w,P(S._payload),C)}if(Ch(S)||sh(S))return y=y.get(w)||null,u(_,y,S,C,null);sm(_,S)}return null}function x(y,_,w,S){for(var C=null,P=null,R=_,M=_=0,T=null;R!==null&&M<w.length;M++){R.index>M?(T=R,R=null):T=R.sibling;var H=p(y,R,w[M],S);if(H===null){R===null&&(R=T);break}e&&R&&H.alternate===null&&t(y,R),_=s(H,_,M),P===null?C=H:P.sibling=H,P=H,R=T}if(M===w.length)return n(y,R),Sn&&Ml(y,M),C;if(R===null){for(;M<w.length;M++)R=f(y,w[M],S),R!==null&&(_=s(R,_,M),P===null?C=R:P.sibling=R,P=R);return Sn&&Ml(y,M),C}for(R=r(y,R);M<w.length;M++)T=h(R,y,M,w[M],S),T!==null&&(e&&T.alternate!==null&&R.delete(T.key===null?M:T.key),_=s(T,_,M),P===null?C=T:P.sibling=T,P=T);return e&&R.forEach(function(A){return t(y,A)}),Sn&&Ml(y,M),C}function g(y,_,w,S){var C=sh(w);if(typeof C!="function")throw Error($e(150));if(w=C.call(w),w==null)throw Error($e(151));for(var P=C=null,R=_,M=_=0,T=null,H=w.next();R!==null&&!H.done;M++,H=w.next()){R.index>M?(T=R,R=null):T=R.sibling;var A=p(y,R,H.value,S);if(A===null){R===null&&(R=T);break}e&&R&&A.alternate===null&&t(y,R),_=s(A,_,M),P===null?C=A:P.sibling=A,P=A,R=T}if(H.done)return n(y,R),Sn&&Ml(y,M),C;if(R===null){for(;!H.done;M++,H=w.next())H=f(y,H.value,S),H!==null&&(_=s(H,_,M),P===null?C=H:P.sibling=H,P=H);return Sn&&Ml(y,M),C}for(R=r(y,R);!H.done;M++,H=w.next())H=h(R,y,M,H.value,S),H!==null&&(e&&H.alternate!==null&&R.delete(H.key===null?M:H.key),_=s(H,_,M),P===null?C=H:P.sibling=H,P=H);return e&&R.forEach(function(O){return t(y,O)}),Sn&&Ml(y,M),C}function b(y,_,w,S){if(typeof w=="object"&&w!==null&&w.type===_d&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Yp:e:{for(var C=w.key,P=_;P!==null;){if(P.key===C){if(C=w.type,C===_d){if(P.tag===7){n(y,P.sibling),_=i(P,w.props.children),_.return=y,y=_;break e}}else if(P.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Ea&&k_(C)===P.type){n(y,P.sibling),_=i(P,w.props),_.ref=dh(y,P,w),_.return=y,y=_;break e}n(y,P);break}else t(y,P);P=P.sibling}w.type===_d?(_=oc(w.props.children,y.mode,S,w.key),_.return=y,y=_):(S=ig(w.type,w.key,w.props,null,y.mode,S),S.ref=dh(y,_,w),S.return=y,y=S)}return a(y);case wd:e:{for(P=w.key;_!==null;){if(_.key===P)if(_.tag===4&&_.stateNode.containerInfo===w.containerInfo&&_.stateNode.implementation===w.implementation){n(y,_.sibling),_=i(_,w.children||[]),_.return=y,y=_;break e}else{n(y,_);break}else t(y,_);_=_.sibling}_=bv(w,y.mode,S),_.return=y,y=_}return a(y);case Ea:return P=w._init,b(y,_,P(w._payload),S)}if(Ch(w))return x(y,_,w,S);if(sh(w))return g(y,_,w,S);sm(y,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,_!==null&&_.tag===6?(n(y,_.sibling),_=i(_,w),_.return=y,y=_):(n(y,_),_=vv(w,y.mode,S),_.return=y,y=_),a(y)):n(y,_)}return b}var lu=R4(!0),T4=R4(!1),$g=cl(null),Bg=null,Pd=null,bw=null;function yw(){bw=Pd=Bg=null}function ww(e){var t=$g.current;_n($g),e._currentValue=t}function dy(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 $d(e,t){Bg=e,bw=Pd=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(hi=!0),e.firstContext=null)}function Qi(e){var t=e._currentValue;if(bw!==e)if(e={context:e,memoizedValue:t,next:null},Pd===null){if(Bg===null)throw Error($e(308));Pd=e,Bg.dependencies={lanes:0,firstContext:e}}else Pd=Pd.next=e;return t}var Gl=null;function _w(e){Gl===null?Gl=[e]:Gl.push(e)}function O4(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,_w(t)):(n.next=i.next,i.next=n),t.interleaved=n,Yo(e,r)}function Yo(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 Ca=!1;function kw(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function I4(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 qo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ka(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ht&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Yo(e,n)}return i=r.interleaved,i===null?(t.next=t,_w(r)):(t.next=i.next,i.next=t),r.interleaved=t,Yo(e,n)}function Zm(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,lw(e,n)}}function N_(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,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 Ug(e,t,n,r){var i=e.updateQueue;Ca=!1;var s=i.firstBaseUpdate,a=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,d=c.next;c.next=null,a===null?s=d:a.next=d,a=c;var u=e.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==a&&(l===null?u.firstBaseUpdate=d:l.next=d,u.lastBaseUpdate=c))}if(s!==null){var f=i.baseState;a=0,u=d=c=null,l=s;do{var p=l.lane,h=l.eventTime;if((r&p)===p){u!==null&&(u=u.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,g=l;switch(p=t,h=n,g.tag){case 1:if(x=g.payload,typeof x=="function"){f=x.call(h,f,p);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,p=typeof x=="function"?x.call(h,f,p):x,p==null)break e;f=Pn({},f,p);break e;case 2:Ca=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=i.effects,p===null?i.effects=[l]:p.push(l))}else h={eventTime:h,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(d=u=h,c=f):u=u.next=h,a|=p;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(u===null&&(c=f),i.baseState=c,i.firstBaseUpdate=d,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do a|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);uc|=a,e.lanes=a,e.memoizedState=f}}function S_(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($e(191,i));i.call(r)}}}var Yf={},so=cl(Yf),df=cl(Yf),uf=cl(Yf);function Yl(e){if(e===Yf)throw Error($e(174));return e}function Nw(e,t){switch(fn(uf,t),fn(df,e),fn(so,Yf),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Wb(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Wb(t,e)}_n(so),fn(so,t)}function cu(){_n(so),_n(df),_n(uf)}function D4(e){Yl(uf.current);var t=Yl(so.current),n=Wb(t,e.type);t!==n&&(fn(df,e),fn(so,n))}function Sw(e){df.current===e&&(_n(so),_n(df))}var Cn=cl(0);function zg(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 hv=[];function jw(){for(var e=0;e<hv.length;e++)hv[e]._workInProgressVersionPrimary=null;hv.length=0}var Qm=Qo.ReactCurrentDispatcher,fv=Qo.ReactCurrentBatchConfig,dc=0,An=null,ar=null,pr=null,qg=!1,Bh=!1,hf=0,DT=0;function Ir(){throw Error($e(321))}function Ew(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!_s(e[n],t[n]))return!1;return!0}function Cw(e,t,n,r,i,s){if(dc=s,An=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Qm.current=e===null||e.memoizedState===null?BT:UT,e=n(r,i),Bh){s=0;do{if(Bh=!1,hf=0,25<=s)throw Error($e(301));s+=1,pr=ar=null,t.updateQueue=null,Qm.current=zT,e=n(r,i)}while(Bh)}if(Qm.current=Wg,t=ar!==null&&ar.next!==null,dc=0,pr=ar=An=null,qg=!1,t)throw Error($e(300));return e}function Aw(){var e=hf!==0;return hf=0,e}function Gs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return pr===null?An.memoizedState=pr=e:pr=pr.next=e,pr}function es(){if(ar===null){var e=An.alternate;e=e!==null?e.memoizedState:null}else e=ar.next;var t=pr===null?An.memoizedState:pr.next;if(t!==null)pr=t,ar=e;else{if(e===null)throw Error($e(310));ar=e,e={memoizedState:ar.memoizedState,baseState:ar.baseState,baseQueue:ar.baseQueue,queue:ar.queue,next:null},pr===null?An.memoizedState=pr=e:pr=pr.next=e}return pr}function ff(e,t){return typeof t=="function"?t(e):t}function pv(e){var t=es(),n=t.queue;if(n===null)throw Error($e(311));n.lastRenderedReducer=e;var r=ar,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var a=i.next;i.next=s.next,s.next=a}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var l=a=null,c=null,d=s;do{var u=d.lane;if((dc&u)===u)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),r=d.hasEagerState?d.eagerState:e(r,d.action);else{var f={lane:u,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=f,a=r):c=c.next=f,An.lanes|=u,uc|=u}d=d.next}while(d!==null&&d!==s);c===null?a=r:c.next=l,_s(r,t.memoizedState)||(hi=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do s=i.lane,An.lanes|=s,uc|=s,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function mv(e){var t=es(),n=t.queue;if(n===null)throw Error($e(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,s=t.memoizedState;if(i!==null){n.pending=null;var a=i=i.next;do s=e(s,a.action),a=a.next;while(a!==i);_s(s,t.memoizedState)||(hi=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function F4(){}function M4(e,t){var n=An,r=es(),i=t(),s=!_s(r.memoizedState,i);if(s&&(r.memoizedState=i,hi=!0),r=r.queue,Pw(U4.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||pr!==null&&pr.memoizedState.tag&1){if(n.flags|=2048,pf(9,B4.bind(null,n,r,i,t),void 0,null),gr===null)throw Error($e(349));
vendor: 4,230 bytes, line 38
38dc&30||$4(n,t,i)}return i}function $4(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=An.updateQueue,t===null?(t={lastEffect:null,stores:null},An.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function B4(e,t,n,r){t.value=n,t.getSnapshot=r,z4(t)&&q4(e)}function U4(e,t,n){return n(function(){z4(t)&&q4(e)})}function z4(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!_s(e,n)}catch{return!0}}function q4(e){var t=Yo(e,1);t!==null&&ws(t,e,1,-1)}function j_(e){var t=Gs();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ff,lastRenderedState:e},t.queue=e,e=e.dispatch=$T.bind(null,An,e),[t.memoizedState,e]}function pf(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=An.updateQueue,t===null?(t={lastEffect:null,stores:null},An.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 W4(){return es().memoizedState}function eg(e,t,n,r){var i=Gs();An.flags|=e,i.memoizedState=pf(1|t,n,void 0,r===void 0?null:r)}function j0(e,t,n,r){var i=es();r=r===void 0?null:r;var s=void 0;if(ar!==null){var a=ar.memoizedState;if(s=a.destroy,r!==null&&Ew(r,a.deps)){i.memoizedState=pf(t,n,s,r);return}}An.flags|=e,i.memoizedState=pf(1|t,n,s,r)}function E_(e,t){return eg(8390656,8,e,t)}function Pw(e,t){return j0(2048,8,e,t)}function H4(e,t){return j0(4,2,e,t)}function V4(e,t){return j0(4,4,e,t)}function G4(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 Y4(e,t,n){return n=n!=null?n.concat([e]):null,j0(4,4,G4.bind(null,t,e),n)}function Lw(){}function K4(e,t){var n=es();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ew(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function J4(e,t){var n=es();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ew(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function X4(e,t,n){return dc&21?(_s(n,t)||(n=n4(),An.lanes|=n,uc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,hi=!0),e.memoizedState=n)}function FT(e,t){var n=tn;tn=n!==0&&4>n?n:4,e(!0);var r=fv.transition;fv.transition={};try{e(!1),t()}finally{tn=n,fv.transition=r}}function Z4(){return es().memoizedState}function MT(e,t,n){var r=Xa(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Q4(e))eE(t,n);else if(n=O4(e,t,n,r),n!==null){var i=ni();ws(n,e,r,i),tE(n,t,r)}}function $T(e,t,n){var r=Xa(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Q4(e))eE(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var a=t.lastRenderedState,l=s(a,n);if(i.hasEagerState=!0,i.eagerState=l,_s(l,a)){var c=t.interleaved;c===null?(i.next=i,_w(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=O4(e,t,i,r),n!==null&&(i=ni(),ws(n,e,r,i),tE(n,t,r))}}function Q4(e){var t=e.alternate;return e===An||t!==null&&t===An}function eE(e,t){Bh=qg=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function tE(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,lw(e,n)}}var Wg={readContext:Qi,useCallback:Ir,useContext:Ir,useEffect:Ir,useImperativeHandle:Ir,useInsertionEffect:Ir,useLayoutEffect:Ir,useMemo:Ir,useReducer:Ir,useRef:Ir,useState:Ir,useDebugValue:Ir,useDeferredValue:Ir,useTransition:Ir,useMutableSource:Ir,useSyncExternalStore:Ir,useId:Ir,unstable_isNewReconciler:!1},BT={readContext:Qi,useCallback:function(e,t){return Gs().memoizedState=[e,t===void 0?null:t],e},useContext:Qi,useEffect:E_,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,eg(4194308,4,G4.bind(null,t,e),n)},useLayoutEffect:function(e,t){return eg(4194308,4,e,t)},useInsertionEffect:function(e,t){return eg(4,2,e,t)},useMemo:function(e,t){var n=Gs();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Gs();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=MT.bind(null,An,e),[r.memoizedState,e]}
vendor: 4,426 bytes, lines 38-40
38,useRef:function(e){var t=Gs();return e={current:e},t.memoizedState=e},useState:j_,useDebugValue:Lw,useDeferredValue:function(e){return Gs().memoizedState=e},useTransition:function(){var e=j_(!1),t=e[0];return e=FT.bind(null,e[1]),Gs().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=An,i=Gs();if(Sn){if(n===void 0)throw Error($e(407));n=n()}else{if(n=t(),gr===null)throw Error($e(349));dc&30||$4(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,E_(U4.bind(null,r,s,e),[e]),r.flags|=2048,pf(9,B4.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Gs(),t=gr.identifierPrefix;if(Sn){var n=zo,r=Uo;n=(r&~(1<<32-ys(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=hf++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=DT++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},UT={readContext:Qi,useCallback:K4,useContext:Qi,useEffect:Pw,useImperativeHandle:Y4,useInsertionEffect:H4,useLayoutEffect:V4,useMemo:J4,useReducer:pv,useRef:W4,useState:function(){return pv(ff)},useDebugValue:Lw,useDeferredValue:function(e){var t=es();return X4(t,ar.memoizedState,e)},useTransition:function(){var e=pv(ff)[0],t=es().memoizedState;return[e,t]},useMutableSource:F4,useSyncExternalStore:M4,useId:Z4,unstable_isNewReconciler:!1},zT={readContext:Qi,useCallback:K4,useContext:Qi,useEffect:Pw,useImperativeHandle:Y4,useInsertionEffect:H4,useLayoutEffect:V4,useMemo:J4,useReducer:mv,useRef:W4,useState:function(){return mv(ff)},useDebugValue:Lw,useDeferredValue:function(e){var t=es();return ar===null?t.memoizedState=e:X4(t,ar.memoizedState,e)},useTransition:function(){var e=mv(ff)[0],t=es().memoizedState;return[e,t]},useMutableSource:F4,useSyncExternalStore:M4,useId:Z4,unstable_isNewReconciler:!1};function fs(e,t){if(e&&e.defaultProps){t=Pn({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function uy(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Pn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var E0={isMounted:function(e){return(e=e._reactInternals)?wc(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ni(),i=Xa(e),s=qo(r,i);s.payload=t,n!=null&&(s.callback=n),t=Ka(e,s,i),t!==null&&(ws(t,e,i,r),Zm(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ni(),i=Xa(e),s=qo(r,i);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=Ka(e,s,i),t!==null&&(ws(t,e,i,r),Zm(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ni(),r=Xa(e),i=qo(n,r);i.tag=2,t!=null&&(i.callback=t),t=Ka(e,i,r),t!==null&&(ws(t,e,r,n),Zm(t,e,r))}};function C_(e,t,n,r,i,s,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,a):t.prototype&&t.prototype.isPureReactComponent?!of(n,r)||!of(i,s):!0}function nE(e,t,n){var r=!1,i=il,s=t.contextType;return typeof s=="object"&&s!==null?s=Qi(s):(i=gi(t)?lc:Wr.current,r=t.contextTypes,s=(r=r!=null)?ou(e,i):il),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=E0,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function A_(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&&E0.enqueueReplaceState(t,t.state,null)}function hy(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},kw(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=Qi(s):(s=gi(t)?lc:Wr.current,i.context=ou(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(uy(e,t,s,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&&E0.enqueueReplaceState(i,i.state,null),Ug(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function du(e,t){try{var n="",r=t;do n+=gR(r),r=r.return;while(r);var i=n}catch(s){i=`
39Error generating stack: `+s.message+`
40`+s.stack}return{value:e,source:t,stack:i,digest:null}}
vendor: 11,790 bytes, line 40
40function gv(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function fy(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var qT=typeof WeakMap=="function"?WeakMap:Map;function rE(e,t,n){n=qo(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Vg||(Vg=!0,ky=r),fy(e,t)},n}function iE(e,t,n){n=qo(-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(){fy(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){fy(e,t),typeof r!="function"&&(Ja===null?Ja=new Set([this]):Ja.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function P_(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new qT;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=rO.bind(null,e,t,n),t.then(e,e))}function L_(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 R_(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=qo(-1,1),t.tag=2,Ka(n,t,1))),n.lanes|=1),e)}var WT=Qo.ReactCurrentOwner,hi=!1;function Zr(e,t,n,r){t.child=e===null?T4(t,null,n,r):lu(t,e.child,n,r)}function T_(e,t,n,r,i){n=n.render;var s=t.ref;return $d(t,i),r=Cw(e,t,n,r,s,i),n=Aw(),e!==null&&!hi?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Ko(e,t,i)):(Sn&&n&&gw(t),t.flags|=1,Zr(e,t,r,i),t.child)}function O_(e,t,n,r,i){if(e===null){var s=n.type;return typeof s=="function"&&!$w(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,sE(e,t,s,r,i)):(e=ig(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var a=s.memoizedProps;if(n=n.compare,n=n!==null?n:of,n(a,r)&&e.ref===t.ref)return Ko(e,t,i)}return t.flags|=1,e=Za(s,r),e.ref=t.ref,e.return=t,t.child=e}function sE(e,t,n,r,i){if(e!==null){var s=e.memoizedProps;if(of(s,r)&&e.ref===t.ref)if(hi=!1,t.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&(hi=!0);else return t.lanes=e.lanes,Ko(e,t,i)}return py(e,t,n,r,i)}function oE(e,t,n){var r=t.pendingProps,i=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},fn(Rd,Pi),Pi|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,fn(Rd,Pi),Pi|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,fn(Rd,Pi),Pi|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,fn(Rd,Pi),Pi|=r;return Zr(e,t,i,n),t.child}function aE(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function py(e,t,n,r,i){var s=gi(n)?lc:Wr.current;return s=ou(t,s),$d(t,i),n=Cw(e,t,n,r,s,i),r=Aw(),e!==null&&!hi?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Ko(e,t,i)):(Sn&&r&&gw(t),t.flags|=1,Zr(e,t,n,i),t.child)}function I_(e,t,n,r,i){if(gi(n)){var s=!0;Dg(t)}else s=!1;if($d(t,i),t.stateNode===null)tg(e,t),nE(t,n,r),hy(t,n,r,i),r=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var c=a.context,d=n.contextType;typeof d=="object"&&d!==null?d=Qi(d):(d=gi(n)?lc:Wr.current,d=ou(t,d));var u=n.getDerivedStateFromProps,f=typeof u=="function"||typeof a.getSnapshotBeforeUpdate=="function";f||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||c!==d)&&A_(t,a,r,d),Ca=!1;var p=t.memoizedState;a.state=p,Ug(t,r,a,i),c=t.memoizedState,l!==r||p!==c||mi.current||Ca?(typeof u=="function"&&(uy(t,n,u,r),c=t.memoizedState),(l=Ca||C_(t,n,l,r,p,c,d))?(f||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),a.props=r,a.state=c,a.context=d,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,I4(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:fs(t.type,l),a.props=d,f=t.pendingProps,p=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=Qi(c):(c=gi(n)?lc:Wr.current,c=ou(t,c));var h=n.getDerivedStateFromProps;(u=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==f||p!==c)&&A_(t,a,r,c),Ca=!1,p=t.memoizedState,a.state=p,Ug(t,r,a,i);var x=t.memoizedState;l!==f||p!==x||mi.current||Ca?(typeof h=="function"&&(uy(t,n,h,r),x=t.memoizedState),(d=Ca||C_(t,n,d,r,p,x,c)||!1)?(u||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,x,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,x,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=x),a.props=r,a.state=x,a.context=c,r=d):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return my(e,t,n,r,s,i)}function my(e,t,n,r,i,s){aE(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return i&&y_(t,n,!1),Ko(e,t,s);r=t.stateNode,WT.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=lu(t,e.child,null,s),t.child=lu(t,null,l,s)):Zr(e,t,l,s),t.memoizedState=r.state,i&&y_(t,n,!0),t.child}function lE(e){var t=e.stateNode;t.pendingContext?b_(e,t.pendingContext,t.pendingContext!==t.context):t.context&&b_(e,t.context,!1),Nw(e,t.containerInfo)}function D_(e,t,n,r,i){return au(),vw(i),t.flags|=256,Zr(e,t,n,r),t.child}var gy={dehydrated:null,treeContext:null,retryLane:0};function xy(e){return{baseLanes:e,cachePool:null,transitions:null}}function cE(e,t,n){var r=t.pendingProps,i=Cn.current,s=!1,a=(t.flags&128)!==0,l;if((l=a)||(l=e!==null&&e.memoizedState===null?!1:(i&2)!==0),l?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),fn(Cn,i&1),e===null)return cy(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):(a=r.children,e=r.fallback,s?(r=t.mode,s=t.child,a={mode:"hidden",children:a},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=a):s=P0(a,r,0,null),e=oc(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=xy(n),t.memoizedState=gy,e):Rw(t,a));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return HT(e,t,a,r,l,i,n);if(s){s=r.fallback,a=t.mode,i=e.child,l=i.sibling;var c={mode:"hidden",children:r.children};return!(a&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Za(i,c),r.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=Za(l,s):(s=oc(s,a,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,a=e.child.memoizedState,a=a===null?xy(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},s.memoizedState=a,s.childLanes=e.childLanes&~n,t.memoizedState=gy,r}return s=e.child,e=s.sibling,r=Za(s,{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 Rw(e,t){return t=P0({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function om(e,t,n,r){return r!==null&&vw(r),lu(t,e.child,null,n),e=Rw(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function HT(e,t,n,r,i,s,a){if(n)return t.flags&256?(t.flags&=-257,r=gv(Error($e(422))),om(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,i=t.mode,r=P0({mode:"visible",children:r.children},i,0,null),s=oc(s,i,a,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&lu(t,e.child,null,a),t.child.memoizedState=xy(a),t.memoizedState=gy,s);if(!(t.mode&1))return om(e,t,a,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var l=r.dgst;return r=l,s=Error($e(419)),r=gv(s,r,void 0),om(e,t,a,r)}if(l=(a&e.childLanes)!==0,hi||l){if(r=gr,r!==null){switch(a&-a){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|a)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Yo(e,i),ws(r,e,i,-1))}return Mw(),r=gv(Error($e(421))),om(e,t,a,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=iO.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,Ti=Ya(i.nextSibling),Di=t,Sn=!0,bs=null,e!==null&&(Yi[Ki++]=Uo,Yi[Ki++]=zo,Yi[Ki++]=cc,Uo=e.id,zo=e.overflow,cc=t),t=Rw(t,r.children),t.flags|=4096,t)}function F_(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),dy(e.return,t,n)}function xv(e,t,n,r,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function dE(e,t,n){var r=t.pendingProps,i=r.revealOrder,s=r.tail;if(Zr(e,t,r.children,n),r=Cn.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&&F_(e,n,t);else if(e.tag===19)F_(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(fn(Cn,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&&zg(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),xv(t,!1,i,n,s);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&zg(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}xv(t,!0,n,null,s);break;case"together":xv(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function tg(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ko(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),uc|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error($e(153));if(t.child!==null){for(e=t.child,n=Za(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Za(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function VT(e,t,n){switch(t.tag){case 3:lE(t),au();break;case 5:D4(t);break;case 1:gi(t.type)&&Dg(t);break;case 4:Nw(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;fn($g,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(fn(Cn,Cn.current&1),t.flags|=128,null):n&t.child.childLanes?cE(e,t,n):(fn(Cn,Cn.current&1),e=Ko(e,t,n
vendor: 4,851 bytes, line 40
40),e!==null?e.sibling:null);fn(Cn,Cn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return dE(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),fn(Cn,Cn.current),r)break;return null;case 22:case 23:return t.lanes=0,oE(e,t,n)}return Ko(e,t,n)}var uE,vy,hE,fE;uE=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}};vy=function(){};hE=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,Yl(so.current);var s=null;switch(n){case"input":i=Bb(e,i),r=Bb(e,r),s=[];break;case"select":i=Pn({},i,{value:void 0}),r=Pn({},r,{value:void 0}),s=[];break;case"textarea":i=qb(e,i),r=qb(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Og)}Hb(n,r);var a;n=null;for(d in i)if(!r.hasOwnProperty(d)&&i.hasOwnProperty(d)&&i[d]!=null)if(d==="style"){var l=i[d];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(Zh.hasOwnProperty(d)?s||(s=[]):(s=s||[]).push(d,null));for(d in r){var c=r[d];if(l=i!=null?i[d]:void 0,r.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="style")if(l){for(a in l)!l.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&l[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(s||(s=[]),s.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(s=s||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(s=s||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(Zh.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&bn("scroll",e),s||l===c||(s=[])):(s=s||[]).push(d,c))}n&&(s=s||[]).push("style",n);var d=s;(t.updateQueue=d)&&(t.flags|=4)}};fE=function(e,t,n,r){n!==r&&(t.flags|=4)};function uh(e,t){if(!Sn)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 Dr(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 GT(e,t,n){var r=t.pendingProps;switch(xw(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dr(t),null;case 1:return gi(t.type)&&Ig(),Dr(t),null;case 3:return r=t.stateNode,cu(),_n(mi),_n(Wr),jw(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(im(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,bs!==null&&(jy(bs),bs=null))),vy(e,t),Dr(t),null;case 5:Sw(t);var i=Yl(uf.current);if(n=t.type,e!==null&&t.stateNode!=null)hE(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error($e(166));return Dr(t),null}if(e=Yl(so.current),im(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[Qs]=t,r[cf]=s,e=(t.mode&1)!==0,n){case"dialog":bn("cancel",r),bn("close",r);break;case"iframe":case"object":case"embed":bn("load",r);break;case"video":case"audio":for(i=0;i<Ph.length;i++)bn(Ph[i],r);break;case"source":bn("error",r);break;case"img":case"image":case"link":bn("error",r),bn("load",r);break;case"details":bn("toggle",r);break;case"input":V5(r,s),bn("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},bn("invalid",r);break;case"textarea":Y5(r,s),bn("invalid",r)}Hb(n,s),i=null;for(var a in s)if(s.hasOwnProperty(a)){var l=s[a];a==="children"?typeof l=="string"?r.textContent!==l&&(s.suppressHydrationWarning!==!0&&rm(r.textContent,l,e),i=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&rm(r.textContent,l,e),i=["children",""+l]):Zh.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&bn("scroll",r)}switch(n){case"input":Kp(r),G5(r,s,!0);break;case"textarea":Kp(r),K5(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Og)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{a=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=U3(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>
40",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Qs]=t,e[cf]=r,uE(e,t,!1,!1),t.stateNode=e;e:{switch(a=Vb(n,r),n){case"dialog":bn("cancel",e),bn("close",e),i=r;break;case"iframe":case"object":case"embed":bn("load",e),i=r;break;case"video":case"audio":for(i=0;i<Ph.length;i++)bn(Ph[i],e);i=r;break;case"source":bn("error",e),i=r;break;case"img":case"image":case"link":bn("error",e),bn("load",e),i=r;break;case"details":bn("toggle",e),i=r;break;case"input":V5(e,r),i=Bb(e,r),bn("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=Pn({},r,{value:void 0}),bn("invalid",e);break;case"textarea":Y5(e,r),i=qb(e,r),bn("invalid",e);break;default:i=r}Hb(n,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var c=l[s];s==="style"?W3(e,c):s==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&z3(e,c)):s==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Qh(e,c):typeof c=="number"&&Qh(e,""+c):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Zh.hasOwnProperty(s)?c!=null&&s==="onScroll"&&bn("scroll",e):c!=null&&nw(e,s,c,a))}switch(n){case"input":Kp(e),G5(e,r,!1);break;case"textarea":Kp(e),K5(e);break;case"option":r.value!=null&&e.setAttribute("value",""+rl(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?Id(e,!!r.multiple,s,!1):r.defaultValue!=null&&Id(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Og)}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 Dr(t),null;case 6:if(e&&t.stateNode!=null)fE(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error($e(166));if(n=Yl(uf.current),Yl(so.current),im(t)){if(r=t.stateNode,n=t.memoizedProps,r[Qs]=t,(s=r.nodeValue!==n)&&(e=Di,e!==null))switch(e.tag){case 3:rm(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&rm(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Qs]=t,t.stateNode=r}return Dr(t),null;case 13:if(_n(Cn),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Sn&&Ti!==null&&t.mode&1&&!(t.flags&128))L4(),au(),t.flags|=98560,s=!1;else if(s=im(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error($e(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error($e(317));s[Qs]=t}else au(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Dr(t),s=!1}else bs!==null&&(jy(bs),bs=null),s=!0;if(!s)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||Cn.current&1?lr===0&&(lr=3):Mw())),t.updateQueue!==null&&(t.flags|=4),Dr(t),null);case 4:return cu(),vy(e,t),e===null&&af(t.stateNode.containerInfo),Dr(t),null;case 10:return ww(t.type._context),Dr(t),null;case 17:return gi(t.type)&&Ig(),Dr(t),null;case 19:if(_n(Cn),s=t.memoizedState,s===null)return Dr(t),null;if(r=(t.flags&128)!==0,a=s.rendering,a===null)if(r)uh(s,!1);else{if(lr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=zg(e),a!==null){for(t.flags|=128,uh(s,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,a=s.alternate,a===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=a.childLanes,s.lanes=a.lanes,s.child=a.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=a.memoizedProps,s.memoizedState=a.memoizedState,s.updateQueue=a.updateQueue,s.type=a.type,e=a.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return fn(Cn,Cn.current&1|2),t.child}e=e.sibling}s.tail!==null&&Hn()>uu&&(t.flags|=128,r=!0,uh(s,!1),t.lanes=4194304)}else{if(!r)if(e=zg(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),uh(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!Sn)return Dr(t),null}else 2*Hn()-s.renderingStartTime>uu&&n!==1073741824&&(t.flags|=128,r=!0,uh(s,!1),t.lanes=4194304);s.isBackwards?(a.sibling=t.child,t.child=a):(n=s.last,n!==null?n.sibling=a:t.child=a,s.last=a)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Hn(),t.sibling=null,n=Cn.current,fn(Cn,r?n&1|2:n&1),t):(Dr(t),null);case 22:case 23:return Fw(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Pi&1073741824&&(Dr(t),t.subtreeFlags&6&&(t.flags|=8192)):Dr(t),null;case 24:return null;case 25:return null}throw Error($e(156,t.tag))}function YT(e,t){switch(xw(t),t.tag){case 1:return gi(t.type)&&Ig(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;
vendor: 23,232 bytes, line 40
40case 3:return cu(),_n(mi),_n(Wr),jw(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Sw(t),null;case 13:if(_n(Cn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error($e(340));au()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _n(Cn),null;case 4:return cu(),null;case 10:return ww(t.type._context),null;case 22:case 23:return Fw(),null;case 24:return null;default:return null}}var am=!1,qr=!1,KT=typeof WeakSet=="function"?WeakSet:Set,Ge=null;function Ld(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){$n(e,t,r)}else n.current=null}function by(e,t,n){try{n()}catch(r){$n(e,t,r)}}var M_=!1;function JT(e,t){if(ny=Lg,e=v4(),mw(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,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,d=0,u=0,f=e,p=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(l=a+i),f!==s||r!==0&&f.nodeType!==3||(c=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(h=f.firstChild)!==null;)p=f,f=h;for(;;){if(f===e)break t;if(p===n&&++d===i&&(l=a),p===s&&++u===r&&(c=a),(h=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(ry={focusedElem:e,selectionRange:n},Lg=!1,Ge=t;Ge!==null;)if(t=Ge,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ge=e;else for(;Ge!==null;){t=Ge;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 g=x.memoizedProps,b=x.memoizedState,y=t.stateNode,_=y.getSnapshotBeforeUpdate(t.elementType===t.type?g:fs(t.type,g),b);y.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error($e(163))}}catch(S){$n(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,Ge=e;break}Ge=t.return}return x=M_,M_=!1,x}function Uh(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 s=i.destroy;i.destroy=void 0,s!==void 0&&by(t,n,s)}i=i.next}while(i!==r)}}function C0(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 yy(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 pE(e){var t=e.alternate;t!==null&&(e.alternate=null,pE(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Qs],delete t[cf],delete t[oy],delete t[RT],delete t[TT])),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 mE(e){return e.tag===5||e.tag===3||e.tag===4}function $_(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mE(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 wy(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=Og));else if(r!==4&&(e=e.child,e!==null))for(wy(e,t,n),e=e.sibling;e!==null;)wy(e,t,n),e=e.sibling}function _y(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(_y(e,t,n),e=e.sibling;e!==null;)_y(e,t,n),e=e.sibling}var jr=null,vs=!1;function va(e,t,n){for(n=n.child;n!==null;)gE(e,t,n),n=n.sibling}function gE(e,t,n){if(io&&typeof io.onCommitFiberUnmount=="function")try{io.onCommitFiberUnmount(y0,n)}catch{}switch(n.tag){case 5:qr||Ld(n,t);case 6:var r=jr,i=vs;jr=null,va(e,t,n),jr=r,vs=i,jr!==null&&(vs?(e=jr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):jr.removeChild(n.stateNode));break;case 18:jr!==null&&(vs?(e=jr,n=n.stateNode,e.nodeType===8?dv(e.parentNode,n):e.nodeType===1&&dv(e,n),rf(e)):dv(jr,n.stateNode));break;case 4:r=jr,i=vs,jr=n.stateNode.containerInfo,vs=!0,va(e,t,n),jr=r,vs=i;break;case 0:case 11:case 14:case 15:if(!qr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&by(n,t,a),i=i.next}while(i!==r)}va(e,t,n);break;case 1:if(!qr&&(Ld(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){$n(n,t,l)}va(e,t,n);break;case 21:va(e,t,n);break;case 22:n.mode&1?(qr=(r=qr)||n.memoizedState!==null,va(e,t,n),qr=r):va(e,t,n);break;default:va(e,t,n)}}function B_(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new KT),t.forEach(function(r){var i=sO.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function cs(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=e,a=t,l=a;e:for(;l!==null;){switch(l.tag){case 5:jr=l.stateNode,vs=!1;break e;case 3:jr=l.stateNode.containerInfo,vs=!0;break e;case 4:jr=l.stateNode.containerInfo,vs=!0;break e}l=l.return}if(jr===null)throw Error($e(160));gE(s,a,i),jr=null,vs=!1;var c=i.alternate;c!==null&&(c.return=null),i.return=null}catch(d){$n(i,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)xE(t,e),t=t.sibling}function xE(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(cs(t,e),Us(e),r&4){try{Uh(3,e,e.return),C0(3,e)}catch(g){$n(e,e.return,g)}try{Uh(5,e,e.return)}catch(g){$n(e,e.return,g)}}break;case 1:cs(t,e),Us(e),r&512&&n!==null&&Ld(n,n.return);break;case 5:if(cs(t,e),Us(e),r&512&&n!==null&&Ld(n,n.return),e.flags&32){var i=e.stateNode;try{Qh(i,"")}catch(g){$n(e,e.return,g)}}if(r&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,a=n!==null?n.memoizedProps:s,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&$3(i,s),Vb(l,a);var d=Vb(l,s);for(a=0;a<c.length;a+=2){var u=c[a],f=c[a+1];u==="style"?W3(i,f):u==="dangerouslySetInnerHTML"?z3(i,f):u==="children"?Qh(i,f):nw(i,u,f,d)}switch(l){case"input":Ub(i,s);break;case"textarea":B3(i,s);break;case"select":var p=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var h=s.value;h!=null?Id(i,!!s.multiple,h,!1):p!==!!s.multiple&&(s.defaultValue!=null?Id(i,!!s.multiple,s.defaultValue,!0):Id(i,!!s.multiple,s.multiple?[]:"",!1))}i[cf]=s}catch(g){$n(e,e.return,g)}}break;case 6:if(cs(t,e),Us(e),r&4){if(e.stateNode===null)throw Error($e(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(g){$n(e,e.return,g)}}break;case 3:if(cs(t,e),Us(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{rf(t.containerInfo)}catch(g){$n(e,e.return,g)}break;case 4:cs(t,e),Us(e);break;case 13:cs(t,e),Us(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Iw=Hn())),r&4&&B_(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(qr=(d=qr)||u,cs(t,e),qr=d):cs(t,e),Us(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!u&&e.mode&1)for(Ge=e,u=e.child;u!==null;){for(f=Ge=u;Ge!==null;){switch(p=Ge,h=p.child,p.tag){case 0:case 11:case 14:case 15:Uh(4,p,p.return);break;case 1:Ld(p,p.return);var x=p.stateNode;if(typeof x.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,x.props=t.memoizedProps,x.state=t.memoizedState,x.componentWillUnmount()}catch(g){$n(r,n,g)}}break;case 5:Ld(p,p.return);break;case 22:if(p.memoizedState!==null){z_(f);continue}}h!==null?(h.return=p,Ge=h):z_(f)}u=u.sibling}e:for(u=null,f=e;;){if(f.tag===5){if(u===null){u=f;try{i=f.stateNode,d?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=f.stateNode,c=f.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=q3("display",a))}catch(g){$n(e,e.return,g)}}}else if(f.tag===6){if(u===null)try{f.stateNode.nodeValue=d?"":f.memoizedProps}catch(g){$n(e,e.return,g)}}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;u===f&&(u=null),f=f.return}u===f&&(u=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:cs(t,e),Us(e),r&4&&B_(e);break;case 21:break;default:cs(t,e),Us(e)}}function Us(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(mE(n)){var r=n;break e}n=n.return}throw Error($e(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Qh(i,""),r.flags&=-33);var s=$_(e);_y(e,s,i);break;case 3:case 4:var a=r.stateNode.containerInfo,l=$_(e);wy(e,l,a);break;default:throw Error($e(161))}}catch(c){$n(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function XT(e,t,n){Ge=e,vE(e)}function vE(e,t,n){for(var r=(e.mode&1)!==0;Ge!==null;){var i=Ge,s=i.child;if(i.tag===22&&r){var a=i.memoizedState!==null||am;if(!a){var l=i.alternate,c=l!==null&&l.memoizedState!==null||qr;l=am;var d=qr;if(am=a,(qr=c)&&!d)for(Ge=i;Ge!==null;)a=Ge,c=a.child,a.tag===22&&a.memoizedState!==null?q_(i):c!==null?(c.return=a,Ge=c):q_(i);for(;s!==null;)Ge=s,vE(s),s=s.sibling;Ge=i,am=l,qr=d}U_(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,Ge=s):U_(e)}}function U_(e){for(;Ge!==null;){var t=Ge;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:qr||C0(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!qr)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:fs(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&S_(t,s,r);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}S_(t,a,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 d=t.alternate;if(d!==null){var u=d.memoizedState;if(u!==null){var f=u.dehydrated;f!==null&&rf(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error($e(163))}qr||t.flags&512&&yy(t)}catch(p){$n(t,t.return,p)}}if(t===e){Ge=null;break}if(n=t.sibling,n!==null){n.return=t.return,Ge=n;break}Ge=t.return}}function z_(e){for(;Ge!==null;){var t=Ge;if(t===e){Ge=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Ge=n;break}Ge=t.return}}function q_(e){for(;Ge!==null;){var t=Ge;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{C0(4,t)}catch(c){$n(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(c){$n(t,i,c)}}var s=t.return;try{yy(t)}catch(c){$n(t,s,c)}break;case 5:var a=t.return;try{yy(t)}catch(c){$n(t,a,c)}}}catch(c){$n(t,t.return,c)}if(t===e){Ge=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Ge=l;break}Ge=t.return}}var ZT=Math.ceil,Hg=Qo.ReactCurrentDispatcher,Tw=Qo.ReactCurrentOwner,Zi=Qo.ReactCurrentBatchConfig,Ht=0,gr=null,er=null,Cr=0,Pi=0,Rd=cl(0),lr=0,mf=null,uc=0,A0=0,Ow=0,zh=null,ui=null,Iw=0,uu=1/0,Oo=null,Vg=!1,ky=null,Ja=null,lm=!1,Ua=null,Gg=0,qh=0,Ny=null,ng=-1,rg=0;function ni(){return Ht&6?Hn():ng!==-1?ng:ng=Hn()}function Xa(e){return e.mode&1?Ht&2&&Cr!==0?Cr&-Cr:IT.transition!==null?(rg===0&&(rg=n4()),rg):(e=tn,e!==0||(e=window.event,e=e===void 0?16:c4(e.type)),e):1}function ws(e,t,n,r){if(50<qh)throw qh=0,Ny=null,Error($e(185));Hf(e,n,r),(!(Ht&2)||e!==gr)&&(e===gr&&(!(Ht&2)&&(A0|=n),lr===4&&Pa(e,Cr)),xi(e,r),n===1&&Ht===0&&!(t.mode&1)&&(uu=Hn()+500,S0&&dl()))}function xi(e,t){var n=e.callbackNode;IR(e,t);var r=Pg(e,e===gr?Cr:0);if(r===0)n!==null&&Z5(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Z5(n),t===1)e.tag===0?OT(W_.bind(null,e)):C4(W_.bind(null,e)),PT(function(){!(Ht&6)&&dl()}),n=null;else{switch(r4(r)){case 1:n=aw;break;case 4:n=e4;break;case 16:n=Ag;break;case 536870912:n=t4;break;default:n=Ag}n=jE(n,bE.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function bE(e,t){if(ng=-1,rg=0,Ht&6)throw Error($e(327));var n=e.callbackNode;if(Bd()&&e.callbackNode!==n)return null;var r=Pg(e,e===gr?Cr:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Yg(e,r);else{t=r;var i=Ht;Ht|=2;var s=wE();(gr!==e||Cr!==t)&&(Oo=null,uu=Hn()+500,sc(e,t));do try{tO();break}catch(l){yE(e,l)}while(!0);yw(),Hg.current=s,Ht=i,er!==null?t=0:(gr=null,Cr=0,t=lr)}if(t!==0){if(t===2&&(i=Xb(e),i!==0&&(r=i,t=Sy(e,i))),t===1)throw n=mf,sc(e,0),Pa(e,r),xi(e,Hn()),n;if(t===6)Pa(e,r);else{if(i=e.current.alternate,!(r&30)&&!QT(i)&&(t=Yg(e,r),t===2&&(s=Xb(e),s!==0&&(r=s,t=Sy(e,s))),t===1))throw n=mf,sc(e,0),Pa(e,r),xi(e,Hn()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error($e(345));case 2:$l(e,ui,Oo);break;case 3:if(Pa(e,r),(r&130023424)===r&&(t=Iw+500-Hn(),10<t)){if(Pg(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){ni(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=sy($l.bind(null,e,ui,Oo),t);break}$l(e,ui,Oo);break;case 4:if(Pa(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var a=31-ys(r);s=1<<a,a=t[a],a>i&&(i=a),r&=~s}if(r=i,r=Hn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ZT(r/1960))-r,10<r){e.timeoutHandle=sy($l.bind(null,e,ui,Oo),r);break}$l(e,ui,Oo);break;case 5:$l(e,ui,Oo);break;default:throw Error($e(329))}}}return xi(e,Hn()),e.callbackNode===n?bE.bind(null,e):null}function Sy(e,t){var n=zh;return e.current.memoizedState.isDehydrated&&(sc(e,t).flags|=256),e=Yg(e,t),e!==2&&(t=ui,ui=n,t!==null&&jy(t)),e}function jy(e){ui===null?ui=e:ui.push.apply(ui,e)}function QT(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],s=i.getSnapshot;i=i.value;try{if(!_s(s(),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 Pa(e,t){for(t&=~Ow,t&=~A0,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-ys(t),r=1<<n;e[n]=-1,t&=~r}}function W_(e){if(Ht&6)throw Error($e(327));Bd();var t=Pg(e,0);if(!(t&1))return xi(e,Hn()),null;var n=Yg(e,t);if(e.tag!==0&&n===2){var r=Xb(e);r!==0&&(t=r,n=Sy(e,r))}if(n===1)throw n=mf,sc(e,0),Pa(e,t),xi(e,Hn()),n;if(n===6)throw Error($e(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,$l(e,ui,Oo),xi(e,Hn()),null}function Dw(e,t){var n=Ht;Ht|=1;try{return e(t)}finally{Ht=n,Ht===0&&(uu=Hn()+500,S0&&dl())}}function hc(e){Ua!==null&&Ua.tag===0&&!(Ht&6)&&Bd();var t=Ht;Ht|=1;var n=Zi.transition,r=tn;try{if(Zi.transition=null,tn=1,e)return e()}finally{tn=r,Zi.transition=n,Ht=t,!(Ht&6)&&dl()}}function Fw(){Pi=Rd.current,_n(Rd)}function sc(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,AT(n)),er!==null)for(n=er.return;n!==null;){var r=n;switch(xw(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ig();break;case 3:cu(),_n(mi),_n(Wr),jw();break;case 5:Sw(r);break;case 4:cu();break;case 13:_n(Cn);break;case 19:_n(Cn);break;case 10:ww(r.type._context);break;case 22:case 23:Fw()}n=n.return}if(gr=e,er=e=Za(e.current,null),Cr=Pi=t,lr=0,mf=null,Ow=A0=uc=0,ui=zh=null,Gl!==null){for(t=0;t<Gl.length;t++)if(n=Gl[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var a=s.next;s.next=i,r.next=a}n.pending=r}Gl=null}return e}function yE(e,t){do{var n=er;try{if(yw(),Qm.current=Wg,qg){for(var r=An.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}qg=!1}if(dc=0,pr=ar=An=null,Bh=!1,hf=0,Tw.current=null,n===null||n.return===null){lr=1,mf=t,er=null;break}e:{var s=e,a=n.return,l=n,c=t;if(t=Cr,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,u=l,f=u.tag;if(!(u.mode&1)&&(f===0||f===11||f===15)){var p=u.alternate;p?(u.updateQueue=p.updateQueue,u.memoizedState=p.memoizedState,u.lanes=p.lanes):(u.updateQueue=null,u.memoizedState=null)}var h=L_(a);if(h!==null){h.flags&=-257,R_(h,a,l,s,t),h.mode&1&&P_(s,d,t),t=h,c=d;var x=t.updateQueue;if(x===null){var g=new Set;g.add(c),t.updateQueue=g}else x.add(c);break e}else{if(!(t&1)){P_(s,d,t),Mw();break e}c=Error($e(426))}}else if(Sn&&l.mode&1){var b=L_(a);if(b!==null){!(b.flags&65536)&&(b.flags|=256),R_(b,a,l,s,t),vw(du(c,l));break e}}s=c=du(c,l),lr!==4&&(lr=2),zh===null?zh=[s]:zh.push(s),s=a;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var y=rE(s,c,t);N_(s,y);break e;case 1:l=c;var _=s.type,w=s.stateNode;if(!(s.flags&128)&&(typeof _.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Ja===null||!Ja.has(w)))){s.flags|=65536,t&=-t,s.lanes|=t;var S=iE(s,l,t);N_(s,S);break e}}s=s.return}while(s!==null)}kE(n)}catch(C){t=C,er===n&&n!==null&&(er=n=n.return);continue}break}while(!0)}function wE(){var e=Hg.current;return Hg.current=Wg,e===null?Wg:e}function Mw(){(lr===0||lr===3||lr===2)&&(lr=4),gr===null||!(uc&268435455)&&!(A0&268435455)||Pa(gr,Cr)}function Yg(e,t){var n=Ht;Ht|=2;var r=wE();(gr!==e||Cr!==t)&&(Oo=null,sc(e,t));do try{eO();break}catch(i){yE(e,i)}while(!0);if(yw(),Ht=n,Hg.current=r,er!==null)throw Error($e(261));return gr=null,Cr=0,lr}function eO(){for(;er!==null;)_E(er)}function tO(){for(;er!==null&&!jR();)_E(er)}function _E(e){var t=SE(e.alternate,e,Pi);e.memoizedProps=e.pendingProps,t===null?kE(e):er=t,Tw.current=null}function kE(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=YT(n,t),n!==null){n.flags&=32767,er=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{lr=6,er=null;return}}else if(n=GT(n,t,Pi),n!==null){er=n;return}if(t=t.sibling,t!==null){er=t;return}er=t=e}while(t!==null);lr===0&&(lr=5)}function $l(e,t,n){var r=tn,i=Zi.transition;try{Zi.transition=null,tn=1,nO(e,t,n,r)}finally{Zi.transition=i,tn=r}return null}function nO(e,t,n,r){do Bd();while(Ua!==null);if(Ht&6)throw Error($e(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($e(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(DR(e,s),e===gr&&(er=gr=null,Cr=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||lm||(lm=!0,jE(Ag,function(){return Bd(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=Zi.transition,Zi.transition=null;var a=tn;tn=1;var l=Ht;Ht|=4,Tw.current=null,JT(e,n),xE(n,e),_T(ry),Lg=!!ny,ry=ny=null,e.current=n,XT(n),ER(),Ht=l,tn=a,Zi.transition=s}else e.current=n;if(lm&&(lm=!1,Ua=e,Gg=i),s=e.pendingLanes,s===0&&(Ja=null),PR(n.stateNode),xi(e,Hn()),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(Vg)throw Vg=!1,e=ky,ky=null,e;return Gg&1&&e.tag!==0&&Bd(),s=e.pendingLanes,s&1?e===Ny?qh++:(qh=0,Ny=e):qh=0,dl(),null}function Bd(){if(Ua!==null){var e=r4(Gg),t=Zi.transition,n=tn;try{if(Zi.transition=null,tn=16>e?16:e,Ua===null)var r=!1;else{if(e=Ua,Ua=null,Gg=0,Ht&6)throw Error($e(331));var i=Ht;for(Ht|=4,Ge=e.current;Ge!==null;){var s=Ge,a=s.child;if(Ge.flags&16){var l=s.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(Ge=d;Ge!==null;){var u=Ge;switch(u.tag){case 0:case 11:case 15:Uh(8,u,s)}var f=u.child;if(f!==null)f.return=u,Ge=f;else for(;Ge!==null;){u=Ge;var p=u.sibling,h=u.return;if(pE(u),u===d){Ge=null;break}if(p!==null){p.return=h,Ge=p;break}Ge=h}}}var x=s.alternate;if(x!==null){var g=x.child;if(g!==null){x.child=null;do{var b=g.sibling;g.sibling=null,g=b}while(g!==null)}}Ge=s}}if(s.subtreeFlags&2064&&a!==null)a.return=s,Ge=a;else e:for(;Ge!==null;){if(s=Ge,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Uh(9,s,s.return)}var y=s.sibling;if(y!==null){y.return=s.return,Ge=y;break e}Ge=s.return}}var _=e.current;for(Ge=_;Ge!==null;){a=Ge;var w=a.child;if(a.subtreeFlags&2064&&w!==null)w.return=a,Ge=w;else e:for(a=_;Ge!==null;){if(l=Ge,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:C0(9,l)}}catch(C){$n(l,l.return,C)}if(l===a){Ge=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,Ge=S;break e}Ge=l.return}}if(Ht=i,dl(),io&&typeof io.onPostCommitFiberRoot=="function")try{io.onPostCommitFiberRoot(y0,e)}catch{}r=!0}return r}finally{tn=n,Zi.transition=t}}return!1}function H_(e,t,n){t=du(n,t),t=rE(e,t,1),e=Ka(e,t,1),t=ni(),e!==null&&(Hf(e,1,t),xi(e,t))}function $n(e,t,n){if(e.tag===3)H_(e,e,n);else for(;t!==null;){if(t.tag===3){H_(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ja===null||!Ja.has(r))){e=du(n,e),e=iE(t,e,1),t=Ka(t,e,1),e=ni(),t!==null&&(Hf(t,1,e),xi(t,e));break}}t=t.return}}function rO(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=ni(),e.pingedLanes|=e.suspendedLanes&n,gr===e&&(Cr&n)===n&&(lr===4||lr===3&&(Cr&130023424)===Cr&&500>Hn()-Iw?sc(e,0):Ow|=n),xi(e,t)}function NE(e,t){t===0&&(e.mode&1?(t=Zp,Zp<<=1,!(Zp&130023424)&&(Zp=4194304)):t=1);var n=ni();e=Yo(e,t),e!==null&&(Hf(e,t,n),xi(e,n))}function iO(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),NE(e,n)}function sO(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($e(314))}r!==null&&r.delete(t),NE(e,n)}var SE;SE=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||mi.current)hi=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return hi=!1,VT(e,t,n);hi=!!(e.flags&131072)}else hi=!1,Sn&&t.flags&1048576&&A4(t,Mg,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;tg(e,t),e=t.pendingProps;var i=ou(t,Wr.current);$d(t,n),i=Cw(null,t,r,e,i,n);var s=Aw();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,gi(r)?(s=!0,Dg(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,kw(t),i.updater=E0,t.stateNode=i,i._reactInternals=t,hy(t,r,e,n),t=my(null,t,r,!0,s,n)):(t.tag=0,Sn&&s&&gw(t),Zr(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(tg(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=aO(r),e=fs(r,e),i){case 0:t=py(null,t,r,e,n);break e;case 1:t=I_(null,t,r,e,n);break e;case 11:t=T_(null,t,r,e,n);break e;case 14:t=O_(null,t,r,fs(r.type,e),n);break e}throw Error($e(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:fs(r,i),py(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:fs(r,i),I_(e,t,r,i,n);case 3:e:{if(lE(t),e===null)throw Error($e(387));
vendor: 8,445 bytes, line 40
40r=t.pendingProps,s=t.memoizedState,i=s.element,I4(e,t),Ug(t,r,null,n);var a=t.memoizedState;if(r=a.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=du(Error($e(423)),t),t=D_(e,t,r,n,i);break e}else if(r!==i){i=du(Error($e(424)),t),t=D_(e,t,r,n,i);break e}else for(Ti=Ya(t.stateNode.containerInfo.firstChild),Di=t,Sn=!0,bs=null,n=T4(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(au(),r===i){t=Ko(e,t,n);break e}Zr(e,t,r,n)}t=t.child}return t;case 5:return D4(t),e===null&&cy(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,a=i.children,iy(r,i)?a=null:s!==null&&iy(r,s)&&(t.flags|=32),aE(e,t),Zr(e,t,a,n),t.child;case 6:return e===null&&cy(t),null;case 13:return cE(e,t,n);case 4:return Nw(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=lu(t,null,r,n):Zr(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:fs(r,i),T_(e,t,r,i,n);case 7:return Zr(e,t,t.pendingProps,n),t.child;case 8:return Zr(e,t,t.pendingProps.children,n),t.child;case 12:return Zr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,a=i.value,fn($g,r._currentValue),r._currentValue=a,s!==null)if(_s(s.value,a)){if(s.children===i.children&&!mi.current){t=Ko(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){a=s.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=qo(-1,n&-n),c.tag=2;var d=s.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),dy(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(s.tag===10)a=s.type===t.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error($e(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),dy(a,n,t),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===t){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}Zr(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,$d(t,n),i=Qi(i),r=r(i),t.flags|=1,Zr(e,t,r,n),t.child;case 14:return r=t.type,i=fs(r,t.pendingProps),i=fs(r.type,i),O_(e,t,r,i,n);case 15:return sE(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:fs(r,i),tg(e,t),t.tag=1,gi(r)?(e=!0,Dg(t)):e=!1,$d(t,n),nE(t,r,i),hy(t,r,i,n),my(null,t,r,!0,e,n);case 19:return dE(e,t,n);case 22:return oE(e,t,n)}throw Error($e(156,t.tag))};function jE(e,t){return Q3(e,t)}function oO(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 Xi(e,t,n,r){return new oO(e,t,n,r)}function $w(e){return e=e.prototype,!(!e||!e.isReactComponent)}function aO(e){if(typeof e=="function")return $w(e)?1:0;if(e!=null){if(e=e.$$typeof,e===iw)return 11;if(e===sw)return 14}return 2}function Za(e,t){var n=e.alternate;return n===null?(n=Xi(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 ig(e,t,n,r,i,s){var a=2;if(r=e,typeof e=="function")$w(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case _d:return oc(n.children,i,s,t);case rw:a=8,i|=8;break;case Db:return e=Xi(12,n,t,i|2),e.elementType=Db,e.lanes=s,e;case Fb:return e=Xi(13,n,t,i),e.elementType=Fb,e.lanes=s,e;case Mb:return e=Xi(19,n,t,i),e.elementType=Mb,e.lanes=s,e;case D3:return P0(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case O3:a=10;break e;case I3:a=9;break e;case iw:a=11;break e;case sw:a=14;break e;case Ea:a=16,r=null;break e}throw Error($e(130,e==null?e:typeof e,""))}return t=Xi(a,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function oc(e,t,n,r){return e=Xi(7,e,r,t),e.lanes=n,e}function P0(e,t,n,r){return e=Xi(22,e,r,t),e.elementType=D3,e.lanes=n,e.stateNode={isHidden:!1},e}function vv(e,t,n){return e=Xi(6,e,null,t),e.lanes=n,e}function bv(e,t,n){return t=Xi(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function lO(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=Qx(0),this.expirationTimes=Qx(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qx(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Bw(e,t,n,r,i,s,a,l,c){return e=new lO(e,t,n,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Xi(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},kw(s),e}function cO(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:wd,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function EE(e){if(!e)return il;e=e._reactInternals;e:{if(wc(e)!==e||e.tag!==1)throw Error($e(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(gi(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error($e(171))}if(e.tag===1){var n=e.type;if(gi(n))return E4(e,n,t)}return t}function CE(e,t,n,r,i,s,a,l,c){return e=Bw(n,r,!0,e,i,s,a,l,c),e.context=EE(null),n=e.current,r=ni(),i=Xa(n),s=qo(r,i),s.callback=t??null,Ka(n,s,i),e.current.lanes=i,Hf(e,i,r),xi(e,r),e}function L0(e,t,n,r){var i=t.current,s=ni(),a=Xa(i);return n=EE(n),t.context===null?t.context=n:t.pendingContext=n,t=qo(s,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Ka(i,t,a),e!==null&&(ws(e,i,a,s),Zm(e,i,a)),a}function Kg(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 V_(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Uw(e,t){V_(e,t),(e=e.alternate)&&V_(e,t)}function dO(){return null}var AE=typeof reportError=="function"?reportError:function(e){console.error(e)};function zw(e){this._internalRoot=e}R0.prototype.render=zw.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error($e(409));L0(e,t,null,null)};R0.prototype.unmount=zw.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;hc(function(){L0(null,e,null,null)}),t[Go]=null}};function R0(e){this._internalRoot=e}R0.prototype.unstable_scheduleHydration=function(e){if(e){var t=o4();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Aa.length&&t!==0&&t<Aa[n].priority;n++);Aa.splice(n,0,e),n===0&&l4(e)}};function qw(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function T0(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function G_(){}function uO(e,t,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var d=Kg(a);s.call(d)}}var a=CE(t,r,e,0,null,!1,!1,"",G_);return e._reactRootContainer=a,e[Go]=a.current,af(e.nodeType===8?e.parentNode:e),hc(),a}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var l=r;r=function(){var d=Kg(c);l.call(d)}}var c=Bw(e,0,!1,null,null,!1,!1,"",G_);return e._reactRootContainer=c,e[Go]=c.current,af(e.nodeType===8?e.parentNode:e),hc(function(){L0(t,c,n,r)}),c}function O0(e,t,n,r,i){var s=n._reactRootContainer;if(s){var a=s;if(typeof i=="function"){var l=i;
40i=function(){var c=Kg(a);l.call(c)}}L0(t,a,e,i)}else a=uO(n,t,e,i,r);return Kg(a)}i4=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ah(t.pendingLanes);n!==0&&(lw(t,n|1),xi(t,Hn()),!(Ht&6)&&(uu=Hn()+500,dl()))}break;case 13:hc(function(){var r=Yo(e,1);if(r!==null){var i=ni();ws(r,e,1,i)}}),Uw(e,1)}};cw=function(e){if(e.tag===13){var t=Yo(e,134217728);if(t!==null){var n=ni();ws(t,e,134217728,n)}Uw(e,134217728)}};s4=function(e){if(e.tag===13){var t=Xa(e),n=Yo(e,t);if(n!==null){var r=ni();ws(n,e,t,r)}Uw(e,t)}};o4=function(){return tn};a4=function(e,t){var n=tn;try{return tn=e,t()}finally{tn=n}};Yb=function(e,t,n){switch(t){case"input":if(Ub(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=N0(r);if(!i)throw Error($e(90));M3(r),Ub(r,i)}}}break;case"textarea":B3(e,n);break;case"select":t=n.value,t!=null&&Id(e,!!n.multiple,t,!1)}};G3=Dw;Y3=hc;var hO={usingClientEntryPoint:!1,Events:[Gf,jd,N0,H3,V3,Dw]},hh={findFiberByHostInstance:Vl,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},fO={bundleType:hh.bundleType,version:hh.version,rendererPackageName:hh.rendererPackageName,rendererConfig:hh.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Qo.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=X3(e),e===null?null:e.stateNode},findFiberByHostInstance:hh.findFiberByHostInstance||dO,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 cm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cm.isDisabled&&cm.supportsFiber)try{y0=cm.inject(fO),io=cm}catch{}}Bi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=hO;Bi.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!qw(t))throw Error($e(200));return cO(e,t,null,n)};Bi.createRoot=function(e,t){if(!qw(e))throw Error($e(299));var n=!1,r="",i=AE;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Bw(e,1,!1,null,null,n,!1,r,i),e[Go]=t.current,af(e.nodeType===8?e.parentNode:e),new zw(t)};Bi.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($e(188)):(e=Object.keys(e).join(","),Error($e(268,e)));return e=X3(t),e=e===null?null:e.stateNode,e};Bi.flushSync=function(e){return hc(e)};Bi.hydrate=function(e,t,n){if(!T0(t))throw Error($e(200));return O0(null,e,t,!0,n)};Bi.hydrateRoot=function(e,t,n){if(!qw(e))throw Error($e(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",a=AE;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=CE(t,null,e,1,n??null,i,!1,s,a),e[Go]=t.current,af(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 R0(t)};Bi.render=function(e,t,n){if(!T0(t))throw Error($e(200));return O0(null,e,t,!1,n)};Bi.unmountComponentAtNode=function(e){if(!T0(e))throw Error($e(40));return e._reactRootContainer?(hc(function(){O0(null,null,e,!1,function(){e._reactRootContainer=null,e[Go]=null})}),!0):!1};Bi.unstable_batchedUpdates=Dw;Bi.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!T0(n))throw Error($e(200));if(e==null||e._reactInternals===void 0)throw Error($e(38));return O0(e,t,n,!1,r)};Bi.version="18.3.1-next-f1338f8080-20240426";function PE(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(PE)}catch(e){console.error(e)}}PE(),P3.exports=Bi;var Kf=P3.exports;const LE=Y1(Kf);var RE,Y_=Kf;RE=Y_.createRoot,Y_.hydrateRoot;var I0=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(){}},D0=typeof window>"u"||"Deno"in globalThis;function ps(){}function pO(e,t){return typeof e=="function"?e(t):e}function mO(e){return typeof e=="number"&&e>=0&&e!==1/0}function gO(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ey(e,t){return typeof e=="function"?e(t):e}function xO(e,t){return typeof e=="function"?e(t):e}function K_(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:a,stale:l}=e;if(a){if(r){if(t.queryHash!==Ww(a,t.options))return!1}else if(!xf(t.queryKey,a))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||s&&!s(t))}function J_(e,t){const{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(gf(t.options.mutationKey)!==gf(s))return!1}else if(!xf(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Ww(e,t){return((t==null?void 0:t.queryKeyHashFn)||gf)(e)}function gf(e){return JSON.stringify(e,(t,n)=>Cy(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function xf(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>xf(e[n],t[n])):!1}function TE(e,t){if(e===t)return e;
vendor: 6,914 bytes, line 40
40const n=X_(e)&&X_(t);if(n||Cy(e)&&Cy(t)){const r=n?e:Object.keys(e),i=r.length,s=n?t:Object.keys(t),a=s.length,l=n?[]:{},c=new Set(r);let d=0;for(let u=0;u<a;u++){const f=n?u:s[u];(!n&&c.has(f)||n)&&e[f]===void 0&&t[f]===void 0?(l[f]=void 0,d++):(l[f]=TE(e[f],t[f]),l[f]===e[f]&&e[f]!==void 0&&d++)}return i===a&&d===i?e:l}return t}function X_(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Cy(e){if(!Z_(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Z_(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Z_(e){return Object.prototype.toString.call(e)==="[object Object]"}function vO(e){return new Promise(t=>{setTimeout(t,e)})}function bO(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?TE(e,t):t}function yO(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function wO(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Hw=Symbol();function OE(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Hw?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Ql,Ia,Xd,u3,_O=(u3=class extends I0{constructor(){super();Yt(this,Ql);Yt(this,Ia);Yt(this,Xd);At(this,Xd,t=>{if(!D0&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){Pe(this,Ia)||this.setEventListener(Pe(this,Xd))}onUnsubscribe(){var t;this.hasListeners()||((t=Pe(this,Ia))==null||t.call(this),At(this,Ia,void 0))}setEventListener(t){var n;At(this,Xd,t),(n=Pe(this,Ia))==null||n.call(this),At(this,Ia,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){Pe(this,Ql)!==t&&(At(this,Ql,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof Pe(this,Ql)=="boolean"?Pe(this,Ql):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ql=new WeakMap,Ia=new WeakMap,Xd=new WeakMap,u3),IE=new _O,Zd,Da,Qd,h3,kO=(h3=class extends I0{constructor(){super();Yt(this,Zd,!0);Yt(this,Da);Yt(this,Qd);At(this,Qd,t=>{if(!D0&&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(){Pe(this,Da)||this.setEventListener(Pe(this,Qd))}onUnsubscribe(){var t;this.hasListeners()||((t=Pe(this,Da))==null||t.call(this),At(this,Da,void 0))}setEventListener(t){var n;At(this,Qd,t),(n=Pe(this,Da))==null||n.call(this),At(this,Da,t(this.setOnline.bind(this)))}setOnline(t){Pe(this,Zd)!==t&&(At(this,Zd,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return Pe(this,Zd)}},Zd=new WeakMap,Da=new WeakMap,Qd=new WeakMap,h3),Jg=new kO;function NO(){let e,t;const n=new Promise((i,s)=>{e=i,t=s});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}function SO(e){return Math.min(1e3*2**e,3e4)}function DE(e){return(e??"online")==="online"?Jg.isOnline():!0}var FE=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function yv(e){return e instanceof FE}function ME(e){let t=!1,n=0,r=!1,i;const s=NO(),a=g=>{var b;r||(p(new FE(g)),(b=e.abort)==null||b.call(e))},l=()=>{t=!0},c=()=>{t=!1},d=()=>IE.isFocused()&&(e.networkMode==="always"||Jg.isOnline())&&e.canRun(),u=()=>DE(e.networkMode)&&e.canRun(),f=g=>{var b;r||(r=!0,(b=e.onSuccess)==null||b.call(e,g),i==null||i(),s.resolve(g))},p=g=>{var b;r||(r=!0,(b=e.onError)==null||b.call(e,g),i==null||i(),s.reject(g))},h=()=>new Promise(g=>{var b;i=y=>{(r||d())&&g(y)},(b=e.onPause)==null||b.call(e)}).then(()=>{var g;i=void 0,r||(g=e.onContinue)==null||g.call(e)}),x=()=>{if(r)return;let g;const b=n===0?e.initialPromise:void 0;try{g=b??e.fn()}catch(y){g=Promise.reject(y)}Promise.resolve(g).then(f).catch(y=>{var P;if(r)return;const _=e.retry??(D0?0:3),w=e.retryDelay??SO,S=typeof w=="function"?w(n,y):w,C=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,y);if(t||!C){p(y);return}n++,(P=e.onFail)==null||P.call(e,n,y),vO(S).then(()=>d()?void 0:h()).then(()=>{t?p(y):x()})})};return{promise:s,cancel:a,continue:()=>(i==null||i(),s),cancelRetry:l,continueRetry:c,canStart:u,start:()=>(u()?x():h().then(x),s)}}var jO=e=>setTimeout(e,0);function EO(){let e=[],t=0,n=l=>{l()},r=l=>{l()},i=jO;const s=l=>{t?e.push(l):i(()=>{n(l)})},a=()=>{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||a()}return c},batchCalls:l=>(...c)=>{s(()=>{l(...c)})},schedule:s,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{i=l}}}var ei=EO(),ec,f3,$E=(f3=class{constructor(){Yt(this,ec)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),mO(this.gcTime)&&At(this,ec,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(D0?1/0:5*60*1e3))}clearGcTimeout(){Pe(this,ec)&&(clearTimeout(Pe(this,ec)),At(this,ec,void 0))}},ec=new WeakMap,f3),eu,tc,Gi,nc,Ur,zf,rc,gs,To,p3,CO=(p3=class extends $E{constructor(t){super();Yt(this,gs);Yt(this,eu);Yt(this,tc);Yt(this,Gi);Yt(this,nc);Yt(this,Ur);Yt(this,zf);Yt(this,rc);At(this,rc,!1),At(this,zf,t.defaultOptions),this.setOptions(t.options),this.observers=[],At(this,nc,t.client),At(this,Gi,Pe(this,nc).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,At(this,eu,PO(this.options)),this.state=t.state??Pe(this,eu),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=Pe(this,Ur))==null?void 0:t.promise}setOptions(t){this.options={...Pe(this,zf),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Pe(this,Gi).remove(this)}setData(t,n){const r=bO(this.state.data,t,this.options);return Or(this,gs,To).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Or(this,gs,To).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=Pe(this,Ur))==null?void 0:r.promise;return(i=Pe(this,Ur))==null||i.cancel(t),n?n.then(ps).catch(ps):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Pe(this,eu))}isActive(){return this.observers.some(t=>xO(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Hw||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>
vendor: 1,204 bytes, line 40
40Ey(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:!gO(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=Pe(this,Ur))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=Pe(this,Ur))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),Pe(this,Gi).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(Pe(this,Ur)&&(Pe(this,rc)?Pe(this,Ur).cancel({revert:!0}):Pe(this,Ur).cancelRetry()),this.scheduleGc()),Pe(this,Gi).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Or(this,gs,To).call(this,{type:"invalidate"})}
vendor: 13,804 bytes, line 40
40fetch(t,n){var d,u,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(Pe(this,Ur))return Pe(this,Ur).continueRetry(),Pe(this,Ur).promise}if(t&&this.setOptions(t),!this.options.queryFn){const p=this.observers.find(h=>h.options.queryFn);p&&this.setOptions(p.options)}const r=new AbortController,i=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(At(this,rc,!0),r.signal)})},s=()=>{const p=OE(this.options,n),x=(()=>{const g={client:Pe(this,nc),queryKey:this.queryKey,meta:this.meta};return i(g),g})();return At(this,rc,!1),this.options.persister?this.options.persister(p,x,this):p(x)},l=(()=>{const p={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:Pe(this,nc),state:this.state,fetchFn:s};return i(p),p})();(d=this.options.behavior)==null||d.onFetch(l,this),At(this,tc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=l.fetchOptions)==null?void 0:u.meta))&&Or(this,gs,To).call(this,{type:"fetch",meta:(f=l.fetchOptions)==null?void 0:f.meta});const c=p=>{var h,x,g,b;yv(p)&&p.silent||Or(this,gs,To).call(this,{type:"error",error:p}),yv(p)||((x=(h=Pe(this,Gi).config).onError)==null||x.call(h,p,this),(b=(g=Pe(this,Gi).config).onSettled)==null||b.call(g,this.state.data,p,this)),this.scheduleGc()};return At(this,Ur,ME({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,abort:r.abort.bind(r),onSuccess:p=>{var h,x,g,b;if(p===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(p)}catch(y){c(y);return}(x=(h=Pe(this,Gi).config).onSuccess)==null||x.call(h,p,this),(b=(g=Pe(this,Gi).config).onSettled)==null||b.call(g,p,this.state.error,this),this.scheduleGc()},onError:c,onFail:(p,h)=>{Or(this,gs,To).call(this,{type:"failed",failureCount:p,error:h})},onPause:()=>{Or(this,gs,To).call(this,{type:"pause"})},onContinue:()=>{Or(this,gs,To).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),Pe(this,Ur).start()}},eu=new WeakMap,tc=new WeakMap,Gi=new WeakMap,nc=new WeakMap,Ur=new WeakMap,zf=new WeakMap,rc=new WeakMap,gs=new WeakSet,To=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,...AO(r.data,this.options),fetchMeta:t.meta??null};case"success":return At(this,tc,void 0),{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=t.error;return yv(i)&&i.revert&&Pe(this,tc)?{...Pe(this,tc),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ei.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),Pe(this,Gi).notify({query:this,type:"updated",action:t})})},p3);function AO(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:DE(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function PO(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 Ks,m3,LO=(m3=class extends I0{constructor(t={}){super();Yt(this,Ks);this.config=t,At(this,Ks,new Map)}build(t,n,r){const i=n.queryKey,s=n.queryHash??Ww(i,n);let a=this.get(s);return a||(a=new CO({client:t,queryKey:i,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(a)),a}add(t){Pe(this,Ks).has(t.queryHash)||(Pe(this,Ks).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=Pe(this,Ks).get(t.queryHash);n&&(t.destroy(),n===t&&Pe(this,Ks).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ei.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return Pe(this,Ks).get(t)}getAll(){return[...Pe(this,Ks).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>K_(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>K_(t,r)):n}notify(t){ei.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ei.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ei.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ks=new WeakMap,m3),Js,Xr,ic,Xs,Sa,g3,RO=(g3=class extends $E{constructor(t){super();Yt(this,Xs);Yt(this,Js);Yt(this,Xr);Yt(this,ic);this.mutationId=t.mutationId,At(this,Xr,t.mutationCache),At(this,Js,[]),this.state=t.state||TO(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){Pe(this,Js).includes(t)||(Pe(this,Js).push(t),this.clearGcTimeout(),Pe(this,Xr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){At(this,Js,Pe(this,Js).filter(n=>n!==t)),this.scheduleGc(),Pe(this,Xr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){Pe(this,Js).length||(this.state.status==="pending"?this.scheduleGc():Pe(this,Xr).remove(this))}continue(){var t;return((t=Pe(this,ic))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var s,a,l,c,d,u,f,p,h,x,g,b,y,_,w,S,C,P,R,M;const n=()=>{Or(this,Xs,Sa).call(this,{type:"continue"})};At(this,ic,ME({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(T,H)=>{Or(this,Xs,Sa).call(this,{type:"failed",failureCount:T,error:H})},onPause:()=>{Or(this,Xs,Sa).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Pe(this,Xr).canRun(this)}));const r=this.state.status==="pending",i=!Pe(this,ic).canStart();try{if(r)n();else{Or(this,Xs,Sa).call(this,{type:"pending",variables:t,isPaused:i}),await((a=(s=Pe(this,Xr).config).onMutate)==null?void 0:a.call(s,t,this));const H=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,t));H!==this.state.context&&Or(this,Xs,Sa).call(this,{type:"pending",context:H,variables:t,isPaused:i})}const T=await Pe(this,ic).start();return await((u=(d=Pe(this,Xr).config).onSuccess)==null?void 0:u.call(d,T,t,this.state.context,this)),await((p=(f=this.options).onSuccess)==null?void 0:p.call(f,T,t,this.state.context)),await((x=(h=Pe(this,Xr).config).onSettled)==null?void 0:x.call(h,T,null,this.state.variables,this.state.context,this)),await((b=(g=this.options).onSettled)==null?void 0:b.call(g,T,null,t,this.state.context)),Or(this,Xs,Sa).call(this,{type:"success",data:T}),T}catch(T){try{throw await((_=(y=Pe(this,Xr).config).onError)==null?void 0:_.call(y,T,t,this.state.context,this)),await((S=(w=this.options).onError)==null?void 0:S.call(w,T,t,this.state.context)),await((P=(C=Pe(this,Xr).config).onSettled)==null?void 0:P.call(C,void 0,T,this.state.variables,this.state.context,this)),await((M=(R=this.options).onSettled)==null?void 0:M.call(R,void 0,T,t,this.state.context)),T}finally{Or(this,Xs,Sa).call(this,{type:"error",error:T})}}finally{Pe(this,Xr).runNext(this)}}},Js=new WeakMap,Xr=new WeakMap,ic=new WeakMap,Xs=new WeakSet,Sa=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),ei.batch(()=>{Pe(this,Js).forEach(r=>{r.onMutationUpdate(t)}),Pe(this,Xr).notify({mutation:this,type:"updated",action:t})})},g3);function TO(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Bo,xs,qf,x3,OO=(x3=class extends I0{constructor(t={}){super();Yt(this,Bo);Yt(this,xs);Yt(this,qf);this.config=t,At(this,Bo,new Set),At(this,xs,new Map),At(this,qf,0)}build(t,n,r){const i=new RO({mutationCache:this,mutationId:++Vp(this,qf)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){Pe(this,Bo).add(t);const n=dm(t);if(typeof n=="string"){const r=Pe(this,xs).get(n);r?r.push(t):Pe(this,xs).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(Pe(this,Bo).delete(t)){const n=dm(t);if(typeof n=="string"){const r=Pe(this,xs).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&Pe(this,xs).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=dm(t);if(typeof n=="string"){const r=Pe(this,xs).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=dm(t);if(typeof n=="string"){const i=(r=Pe(this,xs).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ei.batch(()=>{Pe(this,Bo).forEach(t=>{this.notify({type:"removed",mutation:t})}),Pe(this,Bo).clear(),Pe(this,xs).clear()})}getAll(){return Array.from(Pe(this,Bo))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>J_(n,r))}findAll(t={}){return this.getAll().filter(n=>J_(t,n))}notify(t){ei.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ei.batch(()=>Promise.all(t.map(n=>n.continue().catch(ps))))}},Bo=new WeakMap,xs=new WeakMap,qf=new WeakMap,x3);function dm(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Q_(e){return{onFetch:(t,n)=>{var u,f,p,h,x;const r=t.options,i=(p=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:p.direction,s=((h=t.state.data)==null?void 0:h.pages)||[],a=((x=t.state.data)==null?void 0:x.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let g=!1;const b=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},y=OE(t.options,t.fetchOptions),_=async(w,S,C)=>{if(g)return Promise.reject();if(S==null&&w.pages.length)return Promise.resolve(w);const R=(()=>{const A={client:t.client,queryKey:t.queryKey,pageParam:S,direction:C?"backward":"forward",meta:t.options.meta};return b(A),A})(),M=await y(R),{maxPages:T}=t.options,H=C?wO:yO;return{pages:H(w.pages,M,T),pageParams:H(w.pageParams,S,T)}};if(i&&s.length){const w=i==="backward",S=w?IO:ek,C={pages:s,pageParams:a},P=S(r,C);l=await _(C,P,w)}else{const w=e??s.length;do{const S=c===0?a[0]??r.initialPageParam:ek(r,l);if(c>0&&S==null)break;l=await _(l,S),c++}while(c<w)}return l};t.options.persister?t.fetchFn=()=>{var g,b;return(b=(g=t.options).persister)==null?void 0:b.call(g,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function ek(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 IO(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}var Dn,Fa,Ma,tu,nu,$a,ru,iu,v3,DO=(v3=class{constructor(e={}){Yt(this,Dn);Yt(this,Fa);Yt(this,Ma);Yt(this,tu);Yt(this,nu);Yt(this,$a);Yt(this,ru);Yt(this,iu);At(this,Dn,e.queryCache||new LO),At(this,Fa,e.mutationCache||new OO),At(this,Ma,e.defaultOptions||{}),At(this,tu,new Map),At(this,nu,new Map),At(this,$a,0)}mount(){Vp(this,$a)._++,Pe(this,$a)===1&&(At(this,ru,IE.subscribe(async e=>{e&&(await this.resumePausedMutations(),Pe(this,Dn).onFocus())})),At(this,iu,Jg.subscribe(async e=>{e&&(await this.resumePausedMutations(),Pe(this,Dn).onOnline())})))}unmount(){var e,t;Vp(this,$a)._--,Pe(this,$a)===0&&((e=Pe(this,ru))==null||e.call(this),At(this,ru,void 0),(t=Pe(this,iu))==null||t.call(this),At(this,iu,void 0))}isFetching(e){return Pe(this,Dn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return Pe(this,Fa).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=Pe(this,Dn).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=Pe(this,Dn).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ey(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return Pe(this,Dn).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=Pe(this,Dn).get(r.queryHash),s=i==null?void 0:i.state.data,a=pO(t,s);if(a!==void 0)return Pe(this,Dn).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ei.batch(()=>Pe(this,Dn).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=Pe(this,Dn).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=Pe(this,Dn);ei.batch(()=>
40{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=Pe(this,Dn);return ei.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ei.batch(()=>Pe(this,Dn).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(ps).catch(ps)}invalidateQueries(e,t={}){return ei.batch(()=>(Pe(this,Dn).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=ei.batch(()=>Pe(this,Dn).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(ps)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(ps)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=Pe(this,Dn).build(this,t);return n.isStaleByTime(Ey(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ps).catch(ps)}fetchInfiniteQuery(e){return e.behavior=Q_(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ps).catch(ps)}ensureInfiniteQueryData(e){return e.behavior=Q_(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Jg.isOnline()?Pe(this,Fa).resumePausedMutations():Promise.resolve()}getQueryCache(){return Pe(this,Dn)}getMutationCache(){return Pe(this,Fa)}getDefaultOptions(){return Pe(this,Ma)}setDefaultOptions(e){At(this,Ma,e)}setQueryDefaults(e,t){Pe(this,tu).set(gf(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...Pe(this,tu).values()],n={};return t.forEach(r=>{xf(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){Pe(this,nu).set(gf(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...Pe(this,nu).values()],n={};return t.forEach(r=>{xf(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...Pe(this,Ma).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ww(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===Hw&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...Pe(this,Ma).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){Pe(this,Dn).clear(),Pe(this,Fa).clear()}},Dn=new WeakMap,Fa=new WeakMap,Ma=new WeakMap,tu=new WeakMap,nu=new WeakMap,$a=new WeakMap,ru=new WeakMap,iu=new WeakMap,v3),FO=k.createContext(void 0),MO=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),o.jsx(FO.Provider,{value:e,children:t}));/**
41 * @remix-run/router v1.23.0
42 *
43 * Copyright (c) Remix Software Inc.
44 *
45 * This source code is licensed under the MIT license found in the
46 * LICENSE.md file in the root directory of this source tree.
47 *
48 * @license MIT
49 */function vf(){return vf=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},vf.apply(this,arguments)}var za;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(za||(za={}));const tk="popstate";function $O(e){e===void 0&&(e={});function t(r,i){let{pathname:s,search:a,hash:l}=r.location;return Ay("",{pathname:s,search:a,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:Xg(i)}return UO(t,n,null,e)}function tr(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function BE(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function BO(){return Math.random().toString(36).substr(2,8)}function nk(e,t){return{usr:e.state,key:e.key,idx:t}}function Ay(e,t,n,r){return n===void 0&&(n=null),vf({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?ju(t):t,{state:n,key:t&&t.key||r||BO()})}function Xg(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function ju(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function UO(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,a=i.history,l=za.Pop,c=null,d=u();d==null&&(d=0,a.replaceState(vf({},a.state,{idx:d}),""));function u(){return(a.state||{idx:null}).idx}function f(){l=za.Pop;let b=u(),y=b==null?null:b-d;d=b,c&&c({action:l,location:g.location,delta:y})}function p(b,y){l=za.Push;let _=Ay(g.location,b,y);d=u()+1;let w=nk(_,d),S=g.createHref(_);try{a.pushState(w,"",S)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;i.location.assign(S)}s&&c&&c({action:l,location:g.location,delta:1})}function h(b,y){l=za.Replace;let _=Ay(g.location,b,y);d=u();let w=nk(_,d),S=g.createHref(_);a.replaceState(w,"",S),s&&c&&c({action:l,location:g.location,delta:0})}function x(b){let y=i.location.origin!=="null"?i.location.origin:i.location.href,_=typeof b=="string"?b:Xg(b);return _=_.replace(/ $/,"%20"),tr(y,"No window.location.(origin|href) available to create URL for href: "+_),new URL(_,y)}let g={get action(){return l},get location(){return e(i,a)},listen(b){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(tk,f),c=b,()=>{i.removeEventListener(tk,f),c=null}},createHref(b){return t(i,b)},createURL:x,encodeLocation(b){let y=x(b);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:p,replace:h,go(b){return a.go(b)}};return g}var rk;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(rk||(rk={}));function zO(e,t,n){return n===void 0&&(n="/"),qO(e,t,n,!1)}function qO(e,t,n,r){let i=typeof t=="string"?ju(t):t,s=Vw(i.pathname||"/",n);if(s==null)return null;let a=UE(e);WO(a);let l=null;for(let c=0;l==null&&c<a.length;++c){let d=tI(s);l=QO(a[c],d,r)}return l}function UE(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let i=(s,a,l)=>{let c={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:a,route:s};c.relativePath.startsWith("/")&&(tr(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not val
49id. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let d=Qa([r,c.relativePath]),u=n.concat(c);s.children&&s.children.length>0&&(tr(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),UE(s.children,t,u,d)),!(s.path==null&&!s.index)&&t.push({path:d,score:XO(d,s.index),routesMeta:u})};return e.forEach((s,a)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,a);else for(let c of zE(s.path))i(s,a,c)}),t}function zE(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let a=zE(r.join("/")),l=[];return l.push(...a.map(c=>c===""?s:[s,c].join("/"))),i&&l.push(...a),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function WO(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:ZO(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const HO=/^:[\w-]+$/,VO=3,GO=2,YO=1,KO=10,JO=-2,ik=e=>e==="*";function XO(e,t){let n=e.split("/"),r=n.length;return n.some(ik)&&(r+=JO),t&&(r+=GO),n.filter(i=>!ik(i)).reduce((i,s)=>i+(HO.test(s)?VO:s===""?YO:KO),r)}function ZO(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 QO(e,t,n){let{routesMeta:r}=e,i={},s="/",a=[];for(let l=0;l<r.length;++l){let c=r[l],d=l===r.length-1,u=s==="/"?t:t.slice(s.length)||"/",f=sk({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},u),p=c.route;if(!f&&d&&n&&!r[r.length-1].route.index&&(f=sk({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},u)),!f)return null;
vendor: 6,917 bytes, lines 49-58
49Object.assign(i,f.params),a.push({params:i,pathname:Qa([s,f.pathname]),pathnameBase:sI(Qa([s,f.pathnameBase])),route:p}),f.pathnameBase!=="/"&&(s=Qa([s,f.pathnameBase]))}return a}function sk(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=eI(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let s=i[0],a=s.replace(/(.)\/+$/,"$1"),l=i.slice(1);return{params:r.reduce((d,u,f)=>{let{paramName:p,isOptional:h}=u;if(p==="*"){let g=l[f]||"";a=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const x=l[f];return h&&!x?d[p]=void 0:d[p]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:s,pathnameBase:a,pattern:e}}function eI(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),BE(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,(a,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function tI(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return BE(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Vw(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function nI(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?ju(e):e;return{pathname:n?n.startsWith("/")?n:rI(n,t):t,search:oI(r),hash:aI(i)}}function rI(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 wv(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 iI(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function qE(e,t){let n=iI(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function WE(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=ju(e):(i=vf({},e),tr(!i.pathname||!i.pathname.includes("?"),wv("?","pathname","search",i)),tr(!i.pathname||!i.pathname.includes("#"),wv("#","pathname","hash",i)),tr(!i.search||!i.search.includes("#"),wv("#","search","hash",i)));let s=e===""||i.pathname==="",a=s?"/":i.pathname,l;if(a==null)l=n;else{let f=t.length-1;if(!r&&a.startsWith("..")){let p=a.split("/");for(;p[0]==="..";)p.shift(),f-=1;i.pathname=p.join("/")}l=f>=0?t[f]:"/"}let c=nI(i,l),d=a&&a!=="/"&&a.endsWith("/"),u=(s||a===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}const Qa=e=>e.join("/").replace(/\/\/+/g,"/"),sI=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),oI=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,aI=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function lI(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const HE=["post","put","patch","delete"];new Set(HE);const cI=["get",...HE];new Set(cI);/**
50 * React Router v6.30.1
51 *
52 * Copyright (c) Remix Software Inc.
53 *
54 * This source code is licensed under the MIT license found in the
55 * LICENSE.md file in the root directory of this source tree.
56 *
57 * @license MIT
58 */function bf(){return bf=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},bf.apply(this,arguments)}const Gw=k.createContext(null),dI=k.createContext(null),_c=k.createContext(null),F0=k.createContext(null),ul=k.createContext({outlet:null,matches:[],isDataRoute:!1}),VE=k.createContext(null);function uI(e,t){let{relative:n}=t===void 0?{}:t;Jf()||tr(!1);let{basename:r,navigator:i}=k.useContext(_c),{hash:s,pathname:a,search:l}=YE(e,{relative:n}),c=a;return r!=="/"&&(c=a==="/"?r:Qa([r,a])),i.createHref({pathname:c,search:l,hash:s})}function Jf(){return k.useContext(F0)!=null}function ea(){return Jf()||tr(!1),k.useContext(F0).location}function GE(e){k.useContext(_c).static||k.useLayoutEffect(e)}function Yw(){let{isDataRoute:e}=k.useContext(ul);return e?NI():hI()}function hI(){Jf()||tr(!1);let e=k.useContext(Gw),{basename:t,future:n,navigator:r}=k.useContext(_c),{matches:i}=k.useContext(ul),{pathname:s}=ea(),a=JSON.stringify(qE(i,n.v7_relativeSplatPath)),l=k.useRef(!1);return GE(()=>{l.current=!0}),k.useCallback(function(d,u){if(u===void 0&&(u={}),!l.current)return;if(typeof d=="number"){r.go(d);return}let f=WE(d,JSON.parse(a),s,u.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Qa([t,f.pathname])),(u.replace?r.replace:r.push)(f,u.state,u)},[t,r,a,s,e])}function Eu(){let{matches:e}=k.useContext(ul),t=e[e.length-1];return t?t.params:{}}function YE(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=k.useContext(_c),{matches:i}=k.useContext(ul),{pathname:s}=ea(),a=JSON.stringify(qE(i,r.v7_relativeSplatPath));return k.useMemo(()=>WE(e,JSON.parse(a),s,n==="path"),[e,a,s,n])}function fI(e,t){return pI(e,t)}function pI(e,t,n,r){Jf()||tr(!1);let{navigator:i}=k.useContext(_c),{matches:s}=k.useContext(ul),a=s[s.length-1],l=a?a.params:{};a&&a.pathname;let c=a?a.pathnameBase:"/";a&&a.route;let d=ea(),u;if(t){var f;let b=typeof t=="string"?ju(t):t;c==="/"||(f=b.pathname)!=null&&f.startsWith(c)||tr(!1),u=b}else u=d;let p=u.pathname||"/",h=p;if(c!=="/"){let b=c.replace(/^\//,"").split("/");h="/"+p.replace(/^\//,"").split("/").slice(b.length).join("/")}let x=zO(e,{pathname:h}),g=bI(x&&x.map(b=>Object.assign({},b,{params:Object.assign({},l,b.params),pathname:Qa([c,i.encodeLocation?i.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?c:Qa([c,i.encodeLocation?i.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),s,n,r);return t&&g?k.createElement(F0.Provider,{value:{location:bf({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:za.Pop}},g):g}function mI(){let e=kI(),t=lI(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return k.createElement(k.Fragment,null,k.createElement("h2",null,"Unexpected Application 
58Error!"),k.createElement("h3",{style:{fontStyle:"italic"}},t),n?k.createElement("pre",{style:i},n):null,null)}const gI=k.createElement(mI,null);class xI extends k.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?k.createElement(ul.Provider,{value:this.props.routeContext},k.createElement(VE.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function vI(e){let{routeContext:t,match:n,children:r}=e,i=k.useContext(Gw);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),k.createElement(ul.Provider,{value:t},r)}function bI(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,l=(i=n)==null?void 0:i.errors;if(l!=null){let u=a.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);u>=0||tr(!1),a=a.slice(0,Math.min(a.length,u+1))}let c=!1,d=-1;if(n&&r&&r.v7_partialHydration)for(let u=0;u<a.length;u++){let f=a[u];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(d=u),f.route.id){let{loaderData:p,errors:h}=n,x=f.route.loader&&p[f.route.id]===void 0&&(!h||h[f.route.id]===void 0);if(f.route.lazy||x){c=!0,d>=0?a=a.slice(0,d+1):a=[a[0]];break}}}return a.reduceRight((u,f,p)=>{let h,x=!1,g=null,b=null;n&&(h=l&&f.route.id?l[f.route.id]:void 0,g=f.route.errorElement||gI,c&&(d<0&&p===0?(x=!0,b=null):d===p&&(x=!0,b=f.route.hydrateFallbackElement||null)));let y=t.concat(a.slice(0,p+1)),_=()=>{let w;return h?w=g:x?w=b:f.route.Component?w=k.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=u,k.createElement(vI,{match:f,routeContext:{outlet:u,matches:y,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?k.createElement(xI,{location:n.location,revalidation:n.revalidation,component:g,error:h,children:_(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):_()},null)}var KE=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(KE||{}),Zg=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Zg||{});function yI(e){let t=k.useContext(Gw);return t||tr(!1),t}function wI(e){let t=k.useContext(dI);return t||tr(!1),t}function _I(e){let t=k.useContext(ul);return t||tr(!1),t}function JE(e){let t=_I(),n=t.matches[t.matches.length-1];return n.route.id||tr(!1),n.route.id}function kI(){var e;let t=k.useContext(VE),n=wI(Zg.UseRouteError),r=JE(Zg.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function NI(){let{router:e}=yI(KE.UseNavigateStable),t=JE(Zg.UseNavigateStable),n=k.useRef(!1);return GE(()=>{n.current=!0}),k.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,bf({fromRouteId:t},s)))},[e,t])}function SI(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function yn(e){tr(!1)}function jI(e){let{basename:t="/",children:n=null,location:r,navigationType:i=za.Pop,navigator:s,static:a=!1,future:l}=e;Jf()&&tr(!1);let c=t.replace(/^\/*/,"/"),d=k.useMemo(()=>({basename:c,navigator:s,static:a,future:bf({v7_relativeSplatPath:!1},l)}),[c,l,s,a]);typeof r=="string"&&(r=ju(r));
58let{pathname:u="/",search:f="",hash:p="",state:h=null,key:x="default"}=r,g=k.useMemo(()=>{let b=Vw(u,c);return b==null?null:{location:{pathname:b,search:f,hash:p,state:h,key:x},navigationType:i}},[c,u,f,p,h,x,i]);return g==null?null:k.createElement(_c.Provider,{value:d},k.createElement(F0.Provider,{children:n,value:g}))}function EI(e){let{children:t,location:n}=e;return fI(Py(t),n)}new Promise(()=>{});function Py(e,t){t===void 0&&(t=[]);let n=[];return k.Children.forEach(e,(r,i)=>{if(!k.isValidElement(r))return;let s=[...t,i];if(r.type===k.Fragment){n.push.apply(n,Py(r.props.children,s));return}r.type!==yn&&tr(!1),!r.props.index||!r.props.children||tr(!1);let a={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=Py(r.props.children,s)),n.push(a)}),n}/**
59 * React Router DOM v6.30.1
60 *
61 * Copyright (c) Remix Software Inc.
62 *
63 * This source code is licensed under the MIT license found in the
64 * LICENSE.md file in the root directory of this source tree.
65 *
66 * @license MIT
67 */function Ly(){return Ly=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},Ly.apply(this,arguments)}function CI(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,s;for(s=0;s<r.length;s++)i=r[s],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function AI(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function PI(e,t){return e.button===0&&(!t||t==="_self")&&!AI(e)}function Ry(e){return e===void 0&&(e=""),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 LI(e,t){let n=Ry(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(s=>{n.append(i,s)})}),n}const RI=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],TI="6";try{window.__reactRouterVersion=TI}catch{}const OI="startTransition",ok=Q1[OI];function II(e){let{basename:t,children:n,future:r,window:i}=e,s=k.useRef();s.current==null&&(s.current=$O({window:i,v5Compat:!0}));let a=s.current,[l,c]=k.useState({action:a.action,location:a.location}),{v7_startTransition:d}=r||{},u=k.useCallback(f=>{d&&ok?ok(()=>c(f)):c(f)},[c,d]);return k.useLayoutEffect(()=>a.listen(u),[a,u]),k.useEffect(()=>SI(r),[r]),k.createElement(jI,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:a,future:r})}const DI=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",FI=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,St=k.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:s,replace:a,state:l,target:c,to:d,preventScrollReset:u,viewTransition:f}=t,p=CI(t,RI),{basename:h}=k.useContext(_c),x,g=!1;if(typeof d=="string"&&FI.test(d)&&(x=d,DI))try{let w=new URL(window.location.href),S=d.startsWith("//")?new URL(w.protocol+d):new URL(d),C=Vw(S.pathname,h);S.origin===w.origin&&C!=null?d=C+S.search+S.hash:g=!0}catch{}let b=uI(d,{relative:i}),y=MI(d,{replace:a,state:l,target:c,preventScrollReset:u,relative:i,viewTransition:f});function _(w){r&&r(w),w.defaultPrevented||y(w)}return k.createElement("a",Ly({},p,{href:x||b,onClick:g||s?r:_,ref:n,target:c}))});var ak;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(ak||(ak={}));var lk;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(lk||(lk={}));function MI(e,t){let{target:n,replace:r,state:i,preventScrollReset:s,relative:a,viewTransition:l}=t===void 0?{}:t,c=Yw(),d=ea(),u=YE(e,{relative:a});return k.useCallback(f=>{if(PI(f,n)){f.preventDefault();let p=r!==void 0?r:Xg(d)===Xg(u);c(e,{replace:p,state:i,preventScrollReset:s,relative:a,viewTransition:l})}},[d,c,u,r,i,n,e,s,a,l])}function XE(e){let t=k.useRef(Ry(e)),n=k.useRef(!1),r=ea(),i=k.useMemo(()=>LI(r.search,n.current?null:t.current),[r.search]),s=Yw(),a=k.useCallback((l,c)=>{const d=Ry(typeof l=="function"?l(i):l);n.current=!0,s("?"+d,c)},[s,i]);return[i,a]}var ck=["light","dark"],$I="(prefers-color-scheme: dark)",BI=k.createContext(void 0),UI={setTheme:e=>{},themes:[]},zI=()=>{var e;return(e=k.useContext(BI))!=null?e:UI};k.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:s,value:a,attrs:l,nonce:c})=>{let d=s==="system",u=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?ck.includes(s)&&s?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",p=(x,g=!1,b=!0)=>{let y=a?a[x]:x,_=g?x+"|| ''":`'${y}'`,w="";return i&&b&&!g&&ck.includes(x)&&(w+=`d.style.colorScheme = '${x}';`),n==="class"?g||y?w+=`c.add(${_})`:w+="null":y&&(w+=`d[s](n,${_})`),w},h=e?`!function(){${u}${p(e)}}()`:r?`!function(){try{${u}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${d})){var t='${$I}',m=window.matchMedia(t);if(m.media!==t||m.matches){${p("dark")}}else{${p("light")}}}else if(e){${a?`var x=${JSON.stringify(a)};`:""}${p(a?"x[e]":"e",!0)}}${d?"":"else{"+p(s,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${t}');if(e){${a?`var x=${JSON.stringify(a)};`:""}${p(a?"x[e]":"e",!0)}}else{${p(s,!1,!1)};}${f}}catch(t){}}();`;return k.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:h}})});var qI=e=>{switch(e){case"success":return VI;case"info":return YI;case"warning":return GI;case"error":return KI;default:return null}},WI=Array(12).fill(0),HI=({visible:e,className:t})=>Ue.createElement("div",{className:["sonner-loading-wrapper",t].filter(
67Boolean).join(" "),"data-visible":e},Ue.createElement("div",{className:"sonner-spinner"},WI.map((n,r)=>Ue.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),VI=Ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ue.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"})),GI=Ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Ue.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"})),YI=Ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ue.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"})),KI=Ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ue.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"})),JI=Ue.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"},Ue.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ue.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),XI=()=>{let[e,t]=Ue.useState(document.hidden);return Ue.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},Ty=1,ZI=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;let{message:r,...i}=t,s=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:Ty++,a=this.toasts.find(c=>c.id===s),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),a?this.toasts=this.toasts.map(c=>c.id===s?(this.publish({...c,...t,id:s,title:r}),{...c,...t,id:s,dismissible:l,title:r}):c):this.addToast({title:r,...i,dismissible:l,id:s}),s},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),this.subscribers.forEach(n=>n({id:t,dismiss:!0})),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let i=t instanceof Promise?t:t(),s=r!==void 0,a,l=i.then(async d=>{if(a=["resolve",d],Ue.isValidElement(d))s=!1,this.create({id:r,type:"default",message:d});else if(eD(d)&&!d.ok){s=!1;let u=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,f=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description;this.create({id:r,type:"error",message:u,description:f})}else if(n.success!==void 0){s=!1;let u=typeof n.success=="function"?await n.success(d):n.success,f=typeof n.description=="function"?await n.description(d):n.description;this.create({id:r,type:"success",message:u,description:f})}}).catch(async d=>{if(a=["reject",d],n.error!==void 0){s=!1;let u=typeof n.error=="function"?await n.error(d):n.error,f=typeof n.description=="function"?await n.description(d):n.description;this.create({id:r,type:"error",message:u,description:f})}}).finally(()=>{var d;s&&(this.dismiss(r),r=void 0),(d=n.finally)==null||d.call(n)}),c=()=>new Promise((d,u)=>l.then(()=>a[0]==="reject"?u(a[1]):d(a[1])).catch(u));return typeof r!="string"&&typeof r!="number"?{unwrap:c}:Object.assign(r,{unwrap:c})},this.custom=(t,n)=>{let r=(n==null?void 0:n.id)||Ty++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},di=new ZI,QI=(e,t)=>{let n=(t==null?void 0:t.id)||Ty++;return di.addToast({title:e,...t,id:n}),n},eD=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",tD=QI,nD=()=>di.toasts,rD=()=>di.getActiveToasts(),me=Object.assign(tD,{success:di.success,info:di.info,warning:di.warning,error:di.error,custom:di.custom,message:di.message,promise:di.promise,dismiss:di.dismiss,loading:di.loading},{getHistory:nD,getToasts:rD});function iD(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))}iD(`: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;
67left: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}
67: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%);
67--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%)}
68`);function um(e){return e.label!==void 0}var sD=3,oD="32px",aD="16px",dk=4e3,lD=356,cD=14,dD=20,uD=200;function ds(...e){return e.filter(Boolean).join(" ")}function hD(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var fD=e=>{var t,n,r,i,s,a,l,c,d,u,f;let{invert:p,toast:h,unstyled:x,interacting:g,setHeights:b,visibleToasts:y,heights:_,index:w,toasts:S,expanded:C,removeToast:P,defaultRichColors:R,closeButton:M,style:T,cancelButtonStyle:H,actionButtonStyle:A,className:O="",descriptionClassName:K="",duration:U,position:I,gap:re,loadingIcon:V,expandByDefault:$,classNames:D,icons:ie,closeButtonAriaLabel:X="Close toast",pauseWhenPageIsHidden:E}=e,[q,F]=Ue.useState(null),[Z,Y]=Ue.useState(null),[ee,ce]=Ue.useState(!1),[ue,ye]=Ue.useState(!1),[Se,De]=Ue.useState(!1),[Re,qe]=Ue.useState(!1),[te,Oe]=Ue.useState(!1),[be,se]=Ue.useState(0),[Q,he]=Ue.useState(0),ve=Ue.useRef(h.duration||U||dk),we=Ue.useRef(null),Le=Ue.useRef(null),Fe=w===0,Ve=w+1<=y,He=h.type,Ze=h.dismissible!==!1,at=h.className||"",Be=h.descriptionClassName||"",it=Ue.useMemo(()=>_.findIndex(ft=>ft.toastId===h.id)||0,[_,h.id]),ze=Ue.useMemo(()=>{var ft;return(ft=h.closeButton)!=null?ft:M},[h.closeButton,M]),zt=Ue.useMemo(()=>h.duration||U||dk,[h.duration,U]),yt=Ue.useRef(0),mt=Ue.useRef(0),wt=Ue.useRef(0),Mt=Ue.useRef(null),[dt,qt]=I.split("-"),ht=Ue.useMemo(()=>_.reduce((ft,_t,$t)=>$t>=it?ft:ft+_t.height,0),[_,it]),bt=XI(),ln=h.invert||p,Pt=He==="loading";mt.current=Ue.useMemo(()=>it*re+ht,[it,ht]),Ue.useEffect(()=>{ve.current=zt},[zt]),Ue.useEffect(()=>{ce(!0)},[]),Ue.useEffect(()=>{let ft=Le.current;if(ft){let _t=ft.getBoundingClientRect().height;return he(_t),b($t=>[{toastId:h.id,height:_t,position:h.position},...$t]),()=>b($t=>$t.filter(Rn=>Rn.toastId!==h.id))}},[b,h.id]),Ue.useLayoutEffect(()=>{if(!ee)return;let ft=Le.current,_t=ft.style.height;ft.style.height="auto";let $t=ft.getBoundingClientRect().height;ft.style.height=_t,he($t),b(Rn=>Rn.find(et=>et.toastId===h.id)?Rn.map(et=>et.toastId===h.id?{...et,height:$t}:et):[{toastId:h.id,height:$t,position:h.position},...Rn])},[ee,h.title,h.description,b,h.id]);let st=Ue.useCallback(()=>{ye(!0),se(mt.current),b(ft=>ft.filter(_t=>_t.toastId!==h.id)),setTimeout(()=>{P(h)},uD)},[h,P,b,mt]);Ue.useEffect(()=>{if(h.promise&&He==="loading"||h.duration===1/0||h.type==="loading")return;let ft;return C||g||E&&bt?(()=>{if(wt.current<yt.current){let _t=new Date().getTime()-yt.current;ve.current=ve.current-_t}
68wt.current=new Date().getTime()})():ve.current!==1/0&&(yt.current=new Date().getTime(),ft=setTimeout(()=>{var _t;(_t=h.onAutoClose)==null||_t.call(h,h),st()},ve.current)),()=>clearTimeout(ft)},[C,g,h,He,E,bt,st]),Ue.useEffect(()=>{h.delete&&st()},[st,h.delete]);function Gt(){var ft,_t,$t;return ie!=null&&ie.loading?Ue.createElement("div",{className:ds(D==null?void 0:D.loader,(ft=h==null?void 0:h.classNames)==null?void 0:ft.loader,"sonner-loader"),"data-visible":He==="loading"},ie.loading):V?Ue.createElement("div",{className:ds(D==null?void 0:D.loader,(_t=h==null?void 0:h.classNames)==null?void 0:_t.loader,"sonner-loader"),"data-visible":He==="loading"},V):Ue.createElement(HI,{className:ds(D==null?void 0:D.loader,($t=h==null?void 0:h.classNames)==null?void 0:$t.loader),visible:He==="loading"})}return Ue.createElement("li",{tabIndex:0,ref:Le,className:ds(O,at,D==null?void 0:D.toast,(t=h==null?void 0:h.classNames)==null?void 0:t.toast,D==null?void 0:D.default,D==null?void 0:D[He],(n=h==null?void 0:h.classNames)==null?void 0:n[He]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:R,"data-styled":!(h.jsx||h.unstyled||x),"data-mounted":ee,"data-promise":!!h.promise,"data-swiped":te,"data-removed":ue,"data-visible":Ve,"data-y-position":dt,"data-x-position":qt,"data-index":w,"data-front":Fe,"data-swiping":Se,"data-dismissible":Ze,"data-type":He,"data-invert":ln,"data-swipe-out":Re,"data-swipe-direction":Z,"data-expanded":!!(C||$&&ee),style:{"--index":w,"--toasts-before":w,"--z-index":S.length-w,"--offset":`${ue?be:mt.current}px`,"--initial-height":$?"auto":`${Q}px`,...T,...h.style},onDragEnd:()=>{De(!1),F(null),Mt.current=null},onPointerDown:ft=>{Pt||!Ze||(we.current=new Date,se(mt.current),ft.target.setPointerCapture(ft.pointerId),ft.target.tagName!=="BUTTON"&&(De(!0),Mt.current={x:ft.clientX,y:ft.clientY}))},onPointerUp:()=>{var ft,_t,$t,Rn;if(Re||!Ze)return;Mt.current=null;let et=Number(((ft=Le.current)==null?void 0:ft.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),cr=Number(((_t=Le.current)==null?void 0:_t.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),xr=new Date().getTime()-(($t=we.current)==null?void 0:$t.getTime()),kn=q==="x"?et:cr,Un=Math.abs(kn)/xr;if(Math.abs(kn)>=dD||Un>.11){se(mt.current),(Rn=h.onDismiss)==null||Rn.call(h,h),Y(q==="x"?et>0?"right":"left":cr>0?"down":"up"),st(),qe(!0),Oe(!1);return}De(!1),F(null)},onPointerMove:ft=>{var _t,$t,Rn,et;if(!Mt.current||!Ze||((_t=window.getSelection())==null?void 0:_t.toString().length)>0)return;let cr=ft.clientY-Mt.current.y,xr=ft.clientX-Mt.current.x,kn=($t=e.swipeDirections)!=null?$t:hD(I);!q&&(Math.abs(xr)>1||Math.abs(cr)>1)&&F(Math.abs(xr)>Math.abs(cr)?"x":"y");let Un={x:0,y:0};q==="y"?(kn.includes("top")||kn.includes("bottom"))&&(kn.includes("top")&&cr<0||kn.includes("bottom")&&cr>0)&&(Un.y=cr):q==="x"&&(kn.includes("left")||kn.includes("right"))&&(kn.includes("left")&&xr<0||kn.includes("right")&&xr>0)&&(Un.x=xr),(Math.abs(Un.x)>0||Math.abs(Un.y)>0)&&Oe(!0),(Rn=Le.current)==null||Rn.style.setProperty("--swipe-amount-x",`${Un.x}px`),(et=Le.current)==null||et.style.setProperty("--swipe-amount-y",`${Un.y}px`)}},ze&&!h.jsx?Ue.createElement("button",{"aria-label":X,"data-disabled":Pt,"data-close-button":!0,onClick:Pt||!Ze?()=>{}:()=>{var ft;st(),(ft=h.onDismiss)==null||ft.call(h,h)},className:ds(D==null?void 0:D.closeButton,(i=h==null?void 0:h.classNames)==null?void 0:i.closeButton)},(s=ie==null?void 0:ie.close)!=null?s:JI):null,h.jsx||k.isValidElement(h.title)?h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title:Ue.createElement(Ue.Fragment,null,He||h.icon||h.promise?Ue.createElement("div",{"data-icon":"",className:ds(D==null?void 0:D.icon,(a=h==null?void 0:h.classNames)==null?void 0:a.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Gt():null,h.type!=="loading"?h.icon||(ie==null?void 0:ie[He])||qI(He):null):null,Ue.createElement("div",{"data-content":"",className:ds(D==null?void 0:D.content,(l=h==null?void 0:h.classNames)==null?void 0:l.content)},Ue.createElement("div",{"data-title":"",className:ds(D==null?void 0:D.title,(c=h==null?void 0:h.classNames)==null?void 0:c.title)},typeof h.title=="function"?h.title():h.title),h.description?Ue.createElement("div",{"data-description":"",className:ds(K,Be,D==null?void 0:D.description,(d=h==null?void 0:h.classNames)==null?void 0:d.description)},typeof h.description=="function"?h.description():h.description):null),k.isValidElement(h.cancel)?h.cancel:h.cancel&&um(h.cancel)?Ue.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||H,onClick:ft=>{var _t,$t;um(h.cancel)&&Ze&&(($t=(_t=h.cancel).onClick)==null||$t.call(_t,ft),st())},className:ds(D==null?void 0:D.cancelButton,(u=h==null?void 0:h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,k.isValidElement(h.action)?h.action:h.action&&um(h.action)?Ue.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||A,onClick:ft=>{var _t,$t;um(h.action)&&(($t=(_t=h.action).onClick)==null||$t.call(_t,ft),!ft.defaultPrevented&&st())},className:ds(D==null?void 0:D.actionButton,(f=h==null?void 0:h.classNames)==null?void 0:f.actionButton)},h.action.label):null))};function uk(){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 pD(e,t){let n={};return[e,t].forEach((r,i)=>{let s=i===1,a=s?"--mobile-offset":"--offset",l=s?aD:oD;function c(d){["top","right","bottom","left"].forEach(u=>{n[`${a}-${u}`]=typeof d=="number"?`${d}px`:d})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(d=>{r[d]===void 0?n[`${a}-${d}`]=l:n[`${a}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):c(l)}),n}var mD=k.forwardRef(function(e,t){let{invert:n,position:r="bottom-right",hotkey:i=["altKey","KeyT"],expand:s,closeButton:a,className:l,offset:c,mobileOffset:d,theme:u="light",richColors:f,duration:p,style:h,visibleToasts:x=sD,toastOptions:g,dir:b=uk(),gap:y=cD,loadingIcon:_,icons:w,containerAriaLabel:S="Notifications",pauseWhenPageIsHidden:C}=e,[P,R]=Ue.useState([]),M=Ue.useMemo(()=>Array.from(new Set([r].concat(P.filter(E=>E.position).map(E=>E.position)))),[P,r]),[T,H]=Ue.useState([]),[A,O]=Ue.useState(!1),[K,U]=Ue.useState(!1),[I,re]=Ue.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dar
68k":"light"),V=Ue.useRef(null),$=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),D=Ue.useRef(null),ie=Ue.useRef(!1),X=Ue.useCallback(E=>{R(q=>{var F;return(F=q.find(Z=>Z.id===E.id))!=null&&F.delete||di.dismiss(E.id),q.filter(({id:Z})=>Z!==E.id)})},[]);return Ue.useEffect(()=>di.subscribe(E=>{if(E.dismiss){R(q=>q.map(F=>F.id===E.id?{...F,delete:!0}:F));return}setTimeout(()=>{LE.flushSync(()=>{R(q=>{let F=q.findIndex(Z=>Z.id===E.id);return F!==-1?[...q.slice(0,F),{...q[F],...E},...q.slice(F+1)]:[E,...q]})})})}),[]),Ue.useEffect(()=>{if(u!=="system"){re(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?re("dark"):re("light")),typeof window>"u")return;let E=window.matchMedia("(prefers-color-scheme: dark)");try{E.addEventListener("change",({matches:q})=>{re(q?"dark":"light")})}catch{E.addListener(({matches:F})=>{try{re(F?"dark":"light")}catch(Z){console.error(Z)}})}},[u]),Ue.useEffect(()=>{P.length<=1&&O(!1)},[P]),Ue.useEffect(()=>{let E=q=>{var F,Z;i.every(Y=>q[Y]||q.code===Y)&&(O(!0),(F=V.current)==null||F.focus()),q.code==="Escape"&&(document.activeElement===V.current||(Z=V.current)!=null&&Z.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[i]),Ue.useEffect(()=>{if(V.current)return()=>{D.current&&(D.current.focus({preventScroll:!0}),D.current=null,ie.current=!1)}},[V.current]),Ue.createElement("section",{ref:t,"aria-label":`${S} ${$}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((E,q)=>{var F;let[Z,Y]=E.split("-");return P.length?Ue.createElement("ol",{key:E,dir:b==="auto"?uk():b,tabIndex:-1,ref:V,className:l,"data-sonner-toaster":!0,"data-theme":I,"data-y-position":Z,"data-lifted":A&&P.length>1&&!s,"data-x-position":Y,style:{"--front-toast-height":`${((F=T[0])==null?void 0:F.height)||0}px`,"--width":`${lD}px`,"--gap":`${y}px`,...h,...pD(c,d)},onBlur:ee=>{ie.current&&!ee.currentTarget.contains(ee.relatedTarget)&&(ie.current=!1,D.current&&(D.current.focus({preventScroll:!0}),D.current=null))},onFocus:ee=>{ee.target instanceof HTMLElement&&ee.target.dataset.dismissible==="false"||ie.current||(ie.current=!0,D.current=ee.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{K||O(!1)},onDragEnd:()=>O(!1),onPointerDown:ee=>{ee.target instanceof HTMLElement&&ee.target.dataset.dismissible==="false"||U(!0)},onPointerUp:()=>U(!1)},P.filter(ee=>!ee.position&&q===0||ee.position===E).map((ee,ce)=>{var ue,ye;return Ue.createElement(fD,{key:ee.id,icons:w,index:ce,toast:ee,defaultRichColors:f,duration:(ue=g==null?void 0:g.duration)!=null?ue:p,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:n,visibleToasts:x,closeButton:(ye
68=g==null?void 0:g.closeButton)!=null?ye:a,interacting:K,position:E,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:X,toasts:P.filter(Se=>Se.position==ee.position),heights:T.filter(Se=>Se.position==ee.position),setHeights:H,expandByDefault:s,gap:y,loadingIcon:_,expanded:A,pauseWhenPageIsHidden:C,swipeDirections:e.swipeDirections})})):null}))});const gD=({...e})=>{const{theme:t="system"}=zI();return o.jsx(mD,{theme:t,position:"top-right",closeButton:!0,className:"toaster reverie-toast-viewport 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})},xD=1,vD=1e6;let _v=0;function bD(){return _v=(_v+1)%Number.MAX_SAFE_INTEGER,_v.toString()}const kv=new Map,hk=e=>{if(kv.has(e))return;const t=setTimeout(()=>{kv.delete(e),Wh({type:"REMOVE_TOAST",toastId:e})},vD);kv.set(e,t)},yD=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,xD)};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;return n?hk(n):e.toasts.forEach(r=>{hk(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)}}},sg=[];let og={toasts:[]};function Wh(e){og=yD(og,e),sg.forEach(t=>{t(og)})}function wD({...e}){const t=bD(),n=i=>Wh({type:"UPDATE_TOAST",toast:{...i,id:t}}),r=()=>Wh({type:"DISMISS_TOAST",toastId:t});return Wh({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:i=>{i||r()}}}),{id:t,dismiss:r,update:n}}function _D(){const[e,t]=k.useState(og);return k.useEffect(()=>(sg.push(t),()=>{const n=sg.indexOf(t);n>-1&&sg.splice(n,1)}),[e]),{...e,toast:wD,dismiss:n=>Wh({type:"DISMISS_TOAST",toastId:n})}}function Ft(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 fk(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ZE(...e){return t=>{let n=!1;const r=e.map(i=>{const s=fk(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():fk(e[i],null)}}}}function Ln(...e){return k.useCallback(ZE(...e),e)}function kD(e,t){const n=k.createContext(t),r=s=>{const{children:a,...l}=s,c=k.useMemo(()=>l,Object.values(l));return o.jsx(n.Provider,{value:c,children:a})};r.displayName=e+"Provider";function i(s){const a=k.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,i]}function kc(e,t=[]){let n=[];function r(s,a){const l=k.createContext(a),c=n.length;n=[...n,a];const d=f=>{var y;const{scope:p,children:h,...x}=f,g=((y=p==null?void 0:p[e])==null?void 0:y[c])||l,b=k.useMemo(()=>x,Object.values(x));return o.jsx(g.Provider,{value:b,children:h})};d.displayName=s+"Provider";function u(f,p){var g;const h=((g=p==null?void 0:p[e])==null?void 0:g[c])||l,x=k.useContext(h);if(x)return x;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[d,u]}const i=()=>{const s=n.map(a=>k.createContext(a));return function(l){const c=(l==null?void 0:l[e])||s;return k.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return i.scopeName=e,[r,ND(i,...t)]}function ND(...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(s){const a=r.reduce((l,{useScope:c,scopeName:d})=>{const f=c(s)[`__scope${d}`];return{...l,...f}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function hu(e){const t=jD(e),n=k.forwardRef((r,i)=>{const{children:s,...a}=r,l=k.Children.toArray(s),c=l.find(CD);if(c){const d=c.props.children,u=l.map(f=>f===c?k.Children.count(d)>1?k.Children.only(null):k.isValidElement(d)?d.props.children:null:f);return o.jsx(t,{...a,ref:i,children:k.isValidElement(d)?k.cloneElement(d,void 0,u):null})}return o.jsx(t,{...a,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}var SD=hu("Slot");function jD(e){const t=k.forwardRef((n,r)=>{const{children:i,...s}=n;
vendor: 9,989 bytes, line 68
68if(k.isValidElement(i)){const a=PD(i),l=AD(s,i.props);return i.type!==k.Fragment&&(l.ref=r?ZE(r,a):a),k.cloneElement(i,l)}return k.Children.count(i)>1?k.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var QE=Symbol("radix.slottable");function ED(e){const t=({children:n})=>o.jsx(o.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=QE,t}function CD(e){return k.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===QE}function AD(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function PD(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 eC(e){const t=e+"CollectionProvider",[n,r]=kc(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=g=>{const{scope:b,children:y}=g,_=Ue.useRef(null),w=Ue.useRef(new Map).current;return o.jsx(i,{scope:b,itemMap:w,collectionRef:_,children:y})};a.displayName=t;const l=e+"CollectionSlot",c=hu(l),d=Ue.forwardRef((g,b)=>{const{scope:y,children:_}=g,w=s(l,y),S=Ln(b,w.collectionRef);return o.jsx(c,{ref:S,children:_})});d.displayName=l;const u=e+"CollectionItemSlot",f="data-radix-collection-item",p=hu(u),h=Ue.forwardRef((g,b)=>{const{scope:y,children:_,...w}=g,S=Ue.useRef(null),C=Ln(b,S),P=s(u,y);return Ue.useEffect(()=>(P.itemMap.set(S,{ref:S,...w}),()=>void P.itemMap.delete(S))),o.jsx(p,{[f]:"",ref:C,children:_})});h.displayName=u;function x(g){const b=s(e+"CollectionConsumer",g);return Ue.useCallback(()=>{const _=b.collectionRef.current;if(!_)return[];const w=Array.from(_.querySelectorAll(`[${f}]`));return Array.from(b.itemMap.values()).sort((P,R)=>w.indexOf(P.ref.current)-w.indexOf(R.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:a,Slot:d,ItemSlot:h},x,r]}var LD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],rn=LD.reduce((e,t)=>{const n=hu(`Primitive.${t}`),r=k.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function tC(e,t){e&&Kf.flushSync(()=>e.dispatchEvent(t))}function co(e){const t=k.useRef(e);return k.useEffect(()=>{t.current=e}),k.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function RD(e,t=globalThis==null?void 0:globalThis.document){const n=co(e);k.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 TD="DismissableLayer",Oy="dismissableLayer.update",OD="dismissableLayer.pointerDownOutside",ID="dismissableLayer.focusOutside",pk,nC=k.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Xf=k.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=e,d=k.useContext(nC),[u,f]=k.useState(null),p=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=k.useState({}),x=Ln(t,R=>f(R)),g=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(b),_=u?g.indexOf(u):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,S=_>=y,C=FD(R=>{const M=R.target,T=[...d.branches].some(H=>H.contains(M));!S||T||(i==null||i(R),a==null||a(R),R.defaultPrevented||l==null||l())},p),P=MD(R=>{const M=R.target;[...d.branches].some(H=>H.contains(M))||(s==null||s(R),a==null||a(R),R.defaultPrevented||l==null||l())},p);return RD(R=>{_===d.layers.size-1&&(r==null||r(R),!R.defaultPrevented&&l&&(R.preventDefault(),l()))},p),k.useEffect(()=>{if(u)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(pk=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),mk(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=pk)}},[u,p,n,d]),k.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),mk())},[u,d]),k.useEffect(()=>{const R=()=>h({});return document.addEventListener(Oy,R),()=>document.removeEventListener(Oy,R)},[]),o.jsx(rn.div,{...c,ref:x,style:{pointerEvents:w?S?"auto":"none":void 0,...e.style},onFocusCapture:Ft(e.onFocusCapture,P.onFocusCapture),onBlurCapture:Ft(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Ft(e.onPointerDownCapture,C.onPointerDownCapture)})});Xf.displayName=TD;var DD="DismissableLayerBranch",rC=k.forwardRef((e,t)=>{const n=k.useContext(nC),r=k.useRef(null),i=Ln(t,r);return k.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),o.jsx(rn.div,{...e,ref:i})});rC.displayName=DD;function FD(e,t=globalThis==null?void 0:globalThis.document){const n=co(e),r=k.useRef(!1),i=k.useRef(()=>{});return k.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){iC(OD,n,d,{discrete:!0})};const d={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},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function MD(e,t=globalThis==null?void 0:globalThis.document){const n=co(e),r=k.useRef(!1);return k.useEffect(()=>{const i=s=>{s.target&&!r.current&&iC(ID,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function mk(){const e=new CustomEvent(Oy);document.dispatchEvent(e)}function iC(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?tC(i,s):i.dispatchEvent(s)}var $D=Xf,BD=rC,Jo=globalThis!=null&&globalThis.document?k.useLayoutEffect:()=>{},UD="Portal",M0=k.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[i,s]=k.useState(!1);Jo(()=>s(!0),[]);const a=n||i&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?LE.createPortal(o.jsx(rn.div,{...r,ref:t}),a):null});M0.displayName=UD;function zD(e,t){return k.useReducer((n,r)=>t[n][r]??n,e)}var hl=e=>{const{present:t,children:n}=e,r=qD(t),i=typeof n=="function"?n({present:r.isPresent}):k.Children.only(n),s=Ln(r.ref,WD(i));return typeof n=="function"||r.isPresent?k.cloneElement(i,{ref:s}):null};hl.displayName="Presence";function qD(e){const[t,n]=k.useState(),r=k.useRef(null),i=k.useRef(e),s=k.useRef("none"),a=e?"mounted":"unmounted",[l,c]=zD(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{const d=hm(r.current);s.current=l==="mounted"?d:"none"},[l]),Jo(()=>{const d=r.current,u=i.current;if(u!==e){const p=s.current,h=hm(d);e?c("MOUNT"):h==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&p!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),Jo(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,f=h=>{const g=hm(r.current).includes(h.animationName);if(h.target===t&&g&&(c("ANIMATION_END"),!i.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},p=h=>{h.target===t&&(s.current=hm(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:k.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function hm(e){return(e==null?void 0:e.animationName)||"none"}function WD(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 HD=Q1[" useInsertionEffect ".trim().toString()]||Jo;function $0({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,s,a]=VD({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:i;{const u=k.useRef(e!==void 0);k.useEffect(()=>{const f=u.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.`),u.current=l},[l,r])}const d=k.useCallback(u=>{var f;if(l){const p=GD(u)?u(e):u;p!==e&&((f=a.current)==null||f.call(a,p))}else s(u)},[l,e,s,a]);return[c,d]}function VD({defaultProp:e,onChange:t}){const[n,r]=k.useState(e),i=k.useRef(n),s=k.useRef(t);return HD(()=>{s.current=t},[t]),k.useEffect(()=>{var a;i.current!==n&&((a=s.current)==null||a.call(s,n),i.current=n)},[n,i]),[n,r,s]}function GD(e){return typeof e=="function"}var YD=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"}),KD="VisuallyHidden",B0=k.forwardRef((e,t)=>
68o.jsx(rn.span,{...e,ref:t,style:{...YD,...e.style}}));B0.displayName=KD;var JD=B0,Kw="ToastProvider",[Jw,XD,ZD]=eC("Toast"),[sC,GQ]=kc("Toast",[ZD]),[QD,U0]=sC(Kw),oC=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:i="right",swipeThreshold:s=50,children:a}=e,[l,c]=k.useState(null),[d,u]=k.useState(0),f=k.useRef(!1),p=k.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Kw}\`. Expected non-empty \`string\`.`),o.jsx(Jw.Provider,{scope:t,children:o.jsx(QD,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:s,toastCount:d,viewport:l,onViewportChange:c,onToastAdd:k.useCallback(()=>u(h=>h+1),[]),onToastRemove:k.useCallback(()=>u(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:p,children:a})})};oC.displayName=Kw;var aC="ToastViewport",e7=["F8"],Iy="toast.viewportPause",Dy="toast.viewportResume",lC=k.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=e7,label:i="Notifications ({hotkey})",...s}=e,a=U0(aC,n),l=XD(n),c=k.useRef(null),d=k.useRef(null),u=k.useRef(null),f=k.useRef(null),p=Ln(t,f,a.onViewportChange),h=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=a.toastCount>0;k.useEffect(()=>{const b=y=>{var w;r.length!==0&&r.every(S=>y[S]||y.code===S)&&((w=f.current)==null||w.focus())};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[r]),k.useEffect(()=>{const b=c.current,y=f.current;if(x&&b&&y){const _=()=>{if(!a.isClosePausedRef.current){const P=new CustomEvent(Iy);y.dispatchEvent(P),a.isClosePausedRef.current=!0}},w=()=>{if(a.isClosePausedRef.current){const P=new CustomEvent(Dy);y.dispatchEvent(P),a.isClosePausedRef.current=!1}},S=P=>{!b.contains(P.relatedTarget)&&w()},C=()=>{b.contains(document.activeElement)||w()};return b.addEventListener("focusin",_),b.addEventListener("focusout",S),b.addEventListener("pointermove",_),b.addEventListener("pointerleave",C),window.addEventListener("blur",_),window.addEventListener("focus",w),()=>{b.removeEventListener("focusin",_),b.removeEventListener("focusout",S),b.removeEventListener("pointermove",_),b.removeEventListener("pointerleave",C),window.removeEventListener("blur",_),window.removeEventListener("focus",w)}}},[x,a.isClosePausedRef]);const g=k.useCallback(({tabbingDirection:b})=>{const _=l().map(w=>{const S=w.ref.current,C=[S,...f7(S)];return b==="forwards"?C:C.reverse()});return(b==="forwards"?_.reverse():_).flat()},[l]);return k.useEffect(()=>{const b=f.current;if(b){const y=_=>{var C,P,R;const w=_.altKey||_.ctrlKey||_.metaKey;if(_.key==="Tab"&&!w){const M=document.activeElement,T=_.shiftKey;if(_.target===b&&T){(C=d.current)==null||C.focus();return}const O=g({tabbingDirection:T?"backwards":"forwards"}),K=O.findIndex(U=>U===M);Nv(O.slice(K+1))?_.preventDefault():T?(P=d.current)==null||P.focus():(R=u.current)==null||R.focus()}};return b.addEventListener("keydown",y),()=>b.removeEventListener("keydown",y)}},[l,g]),o.jsxs(BD,{ref:c,role:"region","aria-label":i.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&o.jsx(Fy,{ref:d,onFocusFromOutsideViewport:()=>{const b=g({tabbingDirection:"forwards"});Nv(b)}}),o.jsx(Jw.Slot,{scope:n,children:o.jsx(rn.ol,{tabIndex:-1,...s,ref:p})}),x&&o.jsx(Fy,{ref:u,onFocusFromOutsideViewport:()=>{const b=g({tabbingDirection:"backwards"});Nv(b)}})]})});lC.displayName=aC;var cC="ToastFocusProxy",Fy=k.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,s=U0(cC,n);return o.jsx(B0,{"aria-hidden":!0,tabIndex:0,...i,ref:t,style:{position:"fixed"},onFocus:a=>{var d;const l=a.relatedTarget;!((d=s.viewport)!=null&&d.contains(l))&&r()}})});Fy.displayName=cC;var Zf="Toast",t7="toast.swipeStart",n7="toast.swipeMove",r7="toast.swipeCancel",i7="toast.swipeEnd",dC=k.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:i,onOpenChange:s,...a}=e,[l,c]=$0({prop:r,defaultProp:i??!0,onChange:s,caller:Zf});return o.jsx(hl,{present:n||l,children:o.jsx(a7,{open:l,...a,ref:t,onClose:()=>c(!1),onPause:co(e.onPause),onResume:co(e.onResume),onSwipeStart:Ft(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ft(e.onSwipeMove,d=>{const{x:u,y:f}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:Ft(e.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ft(e.onSwipeEnd,d=>{const{x:u,y:f}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});dC.displayName=Zf;var[s7,o7]=sC(Zf,{onClose(){}}),a7=k.forwardRef((e,t)=>
68{const{__scopeToast:n,type:r="foreground",duration:i,open:s,onClose:a,onEscapeKeyDown:l,onPause:c,onResume:d,onSwipeStart:u,onSwipeMove:f,onSwipeCancel:p,onSwipeEnd:h,...x}=e,g=U0(Zf,n),[b,y]=k.useState(null),_=Ln(t,U=>y(U)),w=k.useRef(null),S=k.useRef(null),C=i||g.duration,P=k.useRef(0),R=k.useRef(C),M=k.useRef(0),{onToastAdd:T,onToastRemove:H}=g,A=co(()=>{var I;(b==null?void 0:b.contains(document.activeElement))&&((I=g.viewport)==null||I.focus()),a()}),O=k.useCallback(U=>{!U||U===1/0||(window.clearTimeout(M.current),P.current=new Date().getTime(),M.current=window.setTimeout(A,U))},[A]);k.useEffect(()=>{const U=g.viewport;if(U){const I=()=>{O(R.current),d==null||d()},re=()=>{const V=new Date().getTime()-P.current;R.current=R.current-V,window.clearTimeout(M.current),c==null||c()};return U.addEventListener(Iy,re),U.addEventListener(Dy,I),()=>{U.removeEventListener(Iy,re),U.removeEventListener(Dy,I)}}},[g.viewport,C,c,d,O]),k.useEffect(()=>{s&&!g.isClosePausedRef.current&&O(C)},[s,C,g.isClosePausedRef,O]),k.useEffect(()=>(T(),()=>H()),[T,H]);const K=k.useMemo(()=>b?xC(b):null,[b]);return g.viewport?o.jsxs(o.Fragment,{children:[K&&o.jsx(l7,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:K}),o.jsx(s7,{scope:n,onClose:A,children:Kf.createPortal(o.jsx(Jw.ItemSlot,{scope:n,children:o.jsx($D,{asChild:!0,onEscapeKeyDown:Ft(l,()=>{g.isFocusedToastEscapeKeyDownRef.current||A(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:o.jsx(rn.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":g.swipeDirection,...x,ref:_,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Ft(e.onKeyDown,U=>{U.key==="Escape"&&(l==null||l(U.nativeEvent),U.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,A()))}),onPointerDown:Ft(e.onPointerDown,U=>{U.button===0&&(w.current={x:U.clientX,y:U.clientY})}),onPointerMove:Ft(e.onPointerMove,U=>{if(!w.current)return;const I=U.clientX-w.current.x,re=U.clientY-w.current.y,V=!!S.current,$=["left","right"].includes(g.swipeDirection),D=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,ie=$?D(0,I):0,X=$?0:D(0,re),E=U.pointerType==="touch"?10:2,q={x:ie,y:X},F={originalEvent:U,delta:q};V?(S.current=q,fm(n7,f,F,{discrete:!1})):gk(q,g.swipeDirection,E)?(S.current=q,fm(t7,u,F,{discrete:!1}),U.target.setPointerCapture(U.pointerId)):(Math.abs(I)>E||Math.abs(re)>E)&&(w.current=null)}),onPointerUp:Ft(e.onPointerUp,U=>{const I=S.current,re=U.target;if(re.hasPointerCapture(U.pointerId)&&re.releasePointerCapture(U.pointerId),S.current=null,w.current=null,I){const V=U.currentTarget,$={originalEvent:U,delta:I};gk(I,g.swipeDirection,g.swipeThreshold)?fm(i7,h,$,{discrete:!0}):fm(r7,p,$,{discrete:!0}),V.addEventListener("click",D=>D.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),l7=e=>{const{__scopeToast:t,children:n,...r}=e,i=U0(Zf,t),[s,a]=k.useState(!1),[l,c]=k.useState(!1);return u7(()=>a(!0)),k.useEffect(()=>{const d=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(d)},[]),l?null:o.jsx(M0,{asChild:!0,children:o.jsx(B0,{...r,children:s&&o.jsxs(o.Fragment,{children:[i.label," ",n]})})})},c7="ToastTitle",uC=k.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return o.jsx(rn.div,{...r,ref:t})});uC.displayName=c7;var d7="ToastDescription",hC=k.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return o.jsx(rn.div,{...r,ref:t})});hC.displayName=d7;var fC="ToastAction",pC=k.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?o.jsx(gC,{altText:n,asChild:!0,children:o.jsx(Xw,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${fC}\`. Expected non-empty \`string\`.`),null)});pC.displayName=fC;var mC="ToastClose",Xw=k.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,i=o7(mC,n);return o.jsx(gC,{asChild:!0,children:o.jsx(rn.button,{type:"button",...r,ref:t,onClick:Ft(e.onClick,i.onClose)})})});Xw.displayName=mC;var gC=k.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...i}=e;return o.jsx(rn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function xC(e){const t=[];
vendor: 4,279 bytes, lines 68-93
68return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),h7(r)){const i=r.ariaHidden||r.hidden||r.style.display==="none",s=r.dataset.radixToastAnnounceExclude==="";if(!i)if(s){const a=r.dataset.radixToastAnnounceAlt;a&&t.push(a)}else t.push(...xC(r))}}),t}function fm(e,t,n,{discrete:r}){const i=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?tC(i,s):i.dispatchEvent(s)}var gk=(e,t,n=0)=>{const r=Math.abs(e.x),i=Math.abs(e.y),s=r>i;return t==="left"||t==="right"?s&&r>n:!s&&i>n};function u7(e=()=>{}){const t=co(e);Jo(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function h7(e){return e.nodeType===e.ELEMENT_NODE}function f7(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 Nv(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var p7=oC,vC=lC,bC=dC,yC=uC,wC=hC,_C=pC,kC=Xw;function NC(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=NC(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function SC(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=NC(e))&&(r&&(r+=" "),r+=t);return r}const xk=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,vk=SC,Zw=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return vk(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=t,a=Object.keys(i).map(d=>{const u=n==null?void 0:n[d],f=s==null?void 0:s[d];if(u===null)return null;const p=xk(u)||xk(f);return i[d][p]}),l=n&&Object.entries(n).reduce((d,u)=>{let[f,p]=u;return p===void 0||(d[f]=p),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,u)=>{let{class:f,className:p,...h}=u;return Object.entries(h).every(x=>{let[g,b]=x;return Array.isArray(b)?b.includes({...s,...l}[g]):{...s,...l}[g]===b})?[...d,f,p]:d},[]);return vk(e,a,c,n==null?void 0:n.class,n==null?void 0:n.className)};/**
69 * @license lucide-react v0.462.0 - ISC
70 *
71 * This source code is licensed under the ISC license.
72 * See the LICENSE file in the root directory of this source tree.
73 */const m7=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),jC=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
74 * @license lucide-react v0.462.0 - ISC
75 *
76 * This source code is licensed under the ISC license.
77 * See the LICENSE file in the root directory of this source tree.
78 */var g7={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"};/**
79 * @license lucide-react v0.462.0 - ISC
80 *
81 * This source code is licensed under the ISC license.
82 * See the LICENSE file in the root directory of this source tree.
83 */const x7=k.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:a,...l},c)=>k.createElement("svg",{ref:c,...g7,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:jC("lucide",i),...l},[...a.map(([d,u])=>k.createElement(d,u)),...Array.isArray(s)?s:[s]]));/**
84 * @license lucide-react v0.462.0 - ISC
85 *
86 * This source code is licensed under the ISC license.
87 * See the LICENSE file in the root directory of this source tree.
88 */const ot=(e,t)=>{const n=k.forwardRef(({className:r,...i},s)=>k.createElement(x7,{ref:s,iconNode:t,className:jC(`lucide-${m7(e)}`,r),...i}));return n.displayName=`${e}`,n};/**
89 * @license lucide-react v0.462.0 - ISC
90 *
91 * This source code is licensed under the ISC license.
92 * See the LICENSE file in the root directory of this source tree.
93 */const v7=ot("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l
93-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
94 * @license lucide-react v0.462.0 - ISC
95 *
96 * This source code is licensed under the ISC license.
97 * See the LICENSE file in the root directory of this source tree.
98 */const b7=ot("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
99 * @license lucide-react v0.462.0 - ISC
100 *
101 * This source code is licensed under the ISC license.
102 * See the LICENSE file in the root directory of this source tree.
103 */const EC=ot("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
104 * @license lucide-react v0.462.0 - ISC
105 *
106 * This source code is licensed under the ISC license.
107 * See the LICENSE file in the root directory of this source tree.
108 */const ag=ot("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"}]]);/**
109 * @license lucide-react v0.462.0 - ISC
110 *
111 * This source code is licensed under the ISC license.
112 * See the LICENSE file in the root directory of this source tree.
113 */const y7=ot("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"}]]);/**
114 * @license lucide-react v0.462.0 - ISC
115 *
116 * This source code is licensed under the ISC license.
117 * See the LICENSE file in the root directory of this source tree.
118 */const w7=ot("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);/**
119 * @license lucide-react v0.462.0 - ISC
120 *
121 * This source code is licensed under the ISC license.
122 * See the LICENSE file in the root directory of this source tree.
123 */const _7=ot("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"}]]);/**
124 * @license lucide-react v0.462.0 - ISC
125 *
126 * This source code is licensed under the ISC license.
127 * See the LICENSE file in the root directory of this source tree.
128 */const k7=ot("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"}]]);/**
129 * @license lucide-react v0.462.0 - ISC
130 *
131 * This source code is licensed under the ISC license.
132 * See the LICENSE file in the root directory of this source tree.
133 */const N7=ot("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"}]]);/**
134 * @license lucide-react v0.462.0 - ISC
135 *
136 * This source code is licensed under the ISC license.
137 * See the LICENSE file in the root directory of this source tree.
138 */const S7=ot("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);/**
139 * @license lucide-react v0.462.0 - ISC
140 *
141 * This source code is licensed under the ISC license.
142 * See the LICENSE file in the root directory of this source tree.
143 */const uo=ot("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
144 * @license lucide-react v0.462.0 - ISC
145 *
146 * This source code is licensed under the ISC license.
147 * See the LICENSE file in the root directory of this source tree.
148 */const j7=ot("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
149 * @license lucide-react v0.462.0 - ISC
150 *
151 * This source code is licensed under the ISC license.
152 * See the LICENSE file in the root directory of this source tree.
153 */const E7=ot("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
154 * @license lucide-react v0.462.0 - ISC
155 *
156 * This source code is licensed under the ISC license.
157 * See the LICENSE file in the root directory of this source tree.
158 */const C7=ot("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"}]]);/**
159 * @license lucide-react v0.462.0 - ISC
160 *
161 * This source code is licensed under the ISC license.
162 * See the LICENSE file in the root directory of this source tree.
163 */const z0=ot("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
164 * @license lucide-react v0.462.0 - ISC
165 *
166 * This source code is licensed under the ISC license.
167 * See the LICENSE file in the root directory of this source tree.
168 */const CC=ot("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"}]]);/**
169 * @license lucide-react v0.462.0 - ISC
170 *
171 * This source code is licensed under the ISC license.
172 * See the LICENSE file in the root directory of this source tree.
173 */const fu=ot("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
174 * @license lucide-react v0.462.0 - ISC
175 *
176 * This source code is licensed under the ISC license.
177 * See the LICENSE file in the root directory of this source tree.
178 */const A7=ot("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",ke
178y:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
179 * @license lucide-react v0.462.0 - ISC
180 *
181 * This source code is licensed under the ISC license.
182 * See the LICENSE file in the root directory of this source tree.
183 */const yf=ot("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"}]]);/**
184 * @license lucide-react v0.462.0 - ISC
185 *
186 * This source code is licensed under the ISC license.
187 * See the LICENSE file in the root directory of this source tree.
188 */const P7=ot("Crop",[["path",{d:"M6 2v14a2 2 0 0 0 2 2h14",key:"ron5a4"}],["path",{d:"M18 22V8a2 2 0 0 0-2-2H2",key:"7s9ehn"}]]);/**
189 * @license lucide-react v0.462.0 - ISC
190 *
191 * This source code is licensed under the ISC license.
192 * See the LICENSE file in the root directory of this source tree.
193 */const Wo=ot("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
194 * @license lucide-react v0.462.0 - ISC
195 *
196 * This source code is licensed under the ISC license.
197 * See the LICENSE file in the root directory of this source tree.
198 */const Ho=ot("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"}]]);/**
199 * @license lucide-react v0.462.0 - ISC
200 *
201 * This source code is licensed under the ISC license.
202 * See the LICENSE file in the root directory of this source tree.
203 */const wf=ot("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"}]]);/**
204 * @license lucide-react v0.462.0 - ISC
205 *
206 * This source code is licensed under the ISC license.
207 * See the LICENSE file in the root directory of this source tree.
208 */const L7=ot("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"}]]);/**
209 * @license lucide-react v0.462.0 - ISC
210 *
211 * This source code is licensed under the ISC license.
212 * See the LICENSE file in the root directory of this source tree.
213 */const Qg=ot("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"}]]);/**
214 * @license lucide-react v0.462.0 - ISC
215 *
216 * This source code is licensed under the ISC license.
217 * See the LICENSE file in the root directory of this source tree.
218 */const R7=ot("FileSpreadsheet",[["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:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/**
219 * @license lucide-react v0.462.0 - ISC
220 *
221 * This source code is licensed under the ISC license.
222 * See the LICENSE file in the root directory of this source tree.
223 */const q0=ot("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"}]]);/**
224 * @license lucide-react v0.462.0 - ISC
225 *
226 * This source code is licensed under the ISC license.
227 * See the LICENSE file in the root directory of this source tree.
228 */const AC=ot("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"}]]);/**
229 * @license lucide-react v0.462.0 - ISC
230 *
231 * This source code is licensed under the ISC license.
232 * See the LICENSE file in the root directory of this source tree.
233 */const T7=ot("Handshake",[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]]);/**
234 * @license lucide-react v0.462.0 - ISC
235 *
236 * This source code is licensed under the ISC license.
237 * See the LICENSE file in the root directory of this source tree.
238 */const O7=ot("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"}]]);/**
239 * @license lucide-react v0.462.0 - ISC
240 *
241 * This source code is licensed under the ISC license.
242 * See the LICENSE file in the root directory of this source tree.
243 */const _f=ot("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"}]]);/**
244 * @license lucide-react v0.462.0 - ISC
245 *
246 * This source code is licensed under the ISC license.
247 * See the LICENSE file in the root directory of this source tree.
248 */const I7=ot("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
249 * @license lucide-react v0.462.0 - ISC
250 *
251 * This source code is licensed under the ISC license.
252 * See the LICENSE file in the root directory of this source tree.
253 */const PC=ot("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"}]]);/**
254 * @license lucide-react v0.462.0 - ISC
255 *
256 * This source code is licensed under the ISC license.
257 * See the LICENSE file in the root directory of this source tree.
258 */const D7=ot("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"}]]);/**
259 * @license lucide-react v0.462.0 - ISC
260 *
261 * This source code is licensed under the ISC license.
262 * See the LICENSE file in the root directory of this source tree.
263 */const Qw=ot("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
264 * @license lucide-react v0.462.0 - ISC
265 *
266 * This source code is licensed under the ISC license.
267 * See the LICENSE file in the root directory of this source tree.
268 */const Qf=ot("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"}]]);/**
269 * @license lucide-react v0.462.0 - ISC
270 *
271 * This source code is licensed under the ISC license.
272 * See the LICENSE file in the root directory of this source tree.
273 */const F7=ot("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
274 * @license lucide-react v0.462.0 - ISC
275 *
276 * This source code is licensed under the ISC license.
277 * See the LICENSE file in the root directory of this source tree.
278 */const pu=ot("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"}]]);/**
279 * @license lucide-react v0.462.0 - ISC
280 *
281 * This source code is licensed under the ISC license.
282 * See the LICENSE file in the root directory of this source tree.
283 */const M7=ot("MonitorSmartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]);/**
284 * @license lucide-react v0.462.0 - ISC
285 *
286 * This source code is licensed under the ISC license.
287 * See the LICENSE file in the root directory of this source tree.
288 */const $7=ot("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
289 * @license lucide-react v0.462.0 - ISC
290 *
291 * This source code is licensed under the ISC license.
292 * See the LICENSE file in the root directory of this source tree.
293 */const e2=ot("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"}]]);/**
294 * @license lucide-react v0.462.0 - ISC
295 *
296 * This source code is licensed under the ISC license.
297 * See the LICENSE file in the root directory of this source tree.
298 */const LC=ot("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
299 * @license lucide-react v0.462.0 - ISC
300 *
301 * This source code is licensed under the ISC license.
302 * See the LICENSE file in the root directory of this source tree.
303 */const B7=ot("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
304 * @license lucide-react v0.462.0 - ISC
305 *
306 * This source code is licensed under the ISC license.
307 * See the LICENSE file in the root directory of this source tree.
308 */const Nc=ot("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"}]]);/**
309 * @license lucide-react v0.462.0 - ISC
310 *
311 * This source code is licensed under the ISC license.
312 * See the LICENSE file in the root directory of this source tree.
313 */const bk=ot("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"}]]);/**
314 * @license lucide-react v0.462.0 - ISC
315 *
316 * This source code is licensed under the ISC license.
317 * See the LICENSE file in the root directory of this source tree.
318 */const U7=ot("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
319 * @license lucide-react v0.462.0 - ISC
320 *
321 * This source code is licensed under the ISC license.
322 * See the LICENSE file in the root directory of this source tree.
323 */const z7=ot("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"}]]);/**
324 * @license lucide-react v0.462.0 - ISC
325 *
326 * This source code is licensed under the ISC license.
327 * See the LICENSE file in the root directory of this source tree.
328 */const W0=ot("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",ke
328y:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
329 * @license lucide-react v0.462.0 - ISC
330 *
331 * This source code is licensed under the ISC license.
332 * See the LICENSE file in the root directory of this source tree.
333 */const Ud=ot("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"}]]);/**
334 * @license lucide-react v0.462.0 - ISC
335 *
336 * This source code is licensed under the ISC license.
337 * See the LICENSE file in the root directory of this source tree.
338 */const yk=ot("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
339 * @license lucide-react v0.462.0 - ISC
340 *
341 * This source code is licensed under the ISC license.
342 * See the LICENSE file in the root directory of this source tree.
343 */const wk=ot("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
344 * @license lucide-react v0.462.0 - ISC
345 *
346 * This source code is licensed under the ISC license.
347 * See the LICENSE file in the root directory of this source tree.
348 */const Sv=ot("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"}]]);/**
349 * @license lucide-react v0.462.0 - ISC
350 *
351 * This source code is licensed under the ISC license.
352 * See the LICENSE file in the root directory of this source tree.
353 */const _k=ot("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"}]]);/**
354 * @license lucide-react v0.462.0 - ISC
355 *
356 * This source code is licensed under the ISC license.
357 * See the LICENSE file in the root directory of this source tree.
358 */const RC=ot("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"}]]);/**
359 * @license lucide-react v0.462.0 - ISC
360 *
361 * This source code is licensed under the ISC license.
362 * See the LICENSE file in the root directory of this source tree.
363 */const t2=ot("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"}]]);/**
364 * @license lucide-react v0.462.0 - ISC
365 *
366 * This source code is licensed under the ISC license.
367 * See the LICENSE file in the root directory of this source tree.
368 */const My=ot("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"}]]);/**
369 * @license lucide-react v0.462.0 - ISC
370 *
371 * This source code is licensed under the ISC license.
372 * See the LICENSE file in the root directory of this source tree.
373 */const TC=ot("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"}]]);/**
374 * @license lucide-react v0.462.0 - ISC
375 *
376 * This source code is licensed under the ISC license.
377 * See the LICENSE file in the root directory of this source tree.
378 */const n2=ot("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"}]]);/**
379 * @license lucide-react v0.462.0 - ISC
380 *
381 * This source code is licensed under the ISC license.
382 * See the LICENSE file in the root directory of this source tree.
383 */const Hr=ot("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}
vendor: 5,915 bytes, line 383
383],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),r2="-",q7=e=>{const t=H7(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{const l=a.split(r2);return l[0]===""&&l.length!==1&&l.shift(),OC(l,t)||W7(a)},getConflictingClassGroupIds:(a,l)=>{const c=n[a]||[];return l&&r[a]?[...c,...r[a]]:c}}},OC=(e,t)=>{var a;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?OC(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const s=e.join(r2);return(a=t.validators.find(({validator:l})=>l(s)))==null?void 0:a.classGroupId},kk=/^\[(.+)\]$/,W7=e=>{if(kk.test(e)){const t=kk.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},H7=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return G7(Object.entries(e.classGroups),n).forEach(([s,a])=>{$y(a,r,s,t)}),r},$y=(e,t,n,r)=>{e.forEach(i=>{if(typeof i=="string"){const s=i===""?t:Nk(t,i);s.classGroupId=n;return}if(typeof i=="function"){if(V7(i)){$y(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,a])=>{$y(a,Nk(t,s),n,r)})})},Nk=(e,t)=>{let n=e;return t.split(r2).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},V7=e=>e.isThemeGetter,G7=(e,t)=>t?e.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([a,l])=>[t+a,l])):s);return[n,i]}):e,Y7=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const i=(s,a)=>{n.set(s,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let a=n.get(s);if(a!==void 0)return a;if((a=r.get(s))!==void 0)return i(s,a),a},set(s,a){n.has(s)?n.set(s,a):i(s,a)}}},IC="!",K7=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],s=t.length,a=l=>{const c=[];let d=0,u=0,f;for(let b=0;b<l.length;b++){let y=l[b];if(d===0){if(y===i&&(r||l.slice(b,b+s)===t)){c.push(l.slice(u,b)),u=b+s;continue}if(y==="/"){f=b;continue}}y==="["?d++:y==="]"&&d--}const p=c.length===0?l:l.substring(u),h=p.startsWith(IC),x=h?p.substring(1):p,g=f&&f>u?f-u:void 0;return{modifiers:c,hasImportantModifier:h,baseClassName:x,maybePostfixModifierPosition:g}};return n?l=>n({className:l,parseClassName:a}):a},J7=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},X7=e=>({cache:Y7(e.cacheSize),parseClassName:K7(e),...q7(e)}),Z7=/\s+/,Q7=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,s=[],a=e.trim().split(Z7);let l="";for(let c=a.length-1;c>=0;c-=1){const d=a[c],{modifiers:u,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:h}=n(d);let x=!!h,g=r(x?p.substring(0,h):p);if(!g){if(!x){l=d+(l.length>0?" "+l:l);continue}if(g=r(p),!g){l=d+(l.length>0?" "+l:l);continue}x=!1}const b=J7(u).join(":"),y=f?b+IC:b,_=y+g;if(s.includes(_))continue;s.push(_);const w=i(g,x);for(let S=0;S<w.length;++S){const C=w[S];s.push(y+C)}l=d+(l.length>0?" "+l:l)}return l};function eF(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=DC(t))&&(r&&(r+=" "),r+=n);return r}const DC=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=DC(e[r]))&&(n&&(n+=" "),n+=t);return n};function tF(e,...t){let n,r,i,s=a;function a(c){const d=t.reduce((u,f)=>f(u),e());return n=X7(d),r=n.cache.get,i=n.cache.set,s=l,l(c)}function l(c){const d=r(c);if(d)return d;const u=Q7(c,n);return i(c,u),u}return function(){return s(eF.apply(null,arguments))}}const vn=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},FC=/^\[(?:([a-z-]+):)?(.+)\]$/i,nF=/^\d+\/\d+$/,rF=new Set(["px","full","screen"]),iF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sF=/\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$/,oF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,aF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,lF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Eo=e=>zd(e)||rF.has(e)||nF.test(e),ba=e=>Cu(e,"length",gF),zd=e=>!!e&&!Number.isNaN(Number(e)),jv=e=>Cu(e,"number",zd),fh=e=>!!e&&Number.isInteger(Number(e)),cF=e=>e.endsWith("%")&&zd(e.slice(0,-1)),Tt=e=>FC.test(e),ya=e=>iF.test(e),dF=new Set(["length","size","percentage"]),uF=e=>Cu(e,dF,MC),hF=e=>Cu(e,"position",MC),fF=new Set(["image","url"]),pF=e=>Cu(e,fF,vF),mF=e=>Cu(e,"",xF),ph=()=>!0,Cu=(e,t,n)=>{const r=FC.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},gF=e=>sF.test(e)&&!oF.test(e),MC=()=>!1,xF=e=>aF.test(e),vF=e=>lF.test(e),bF=()=>{const e=vn("colors"),t=vn("spacing"),n=vn("blur"),r=vn("brightness"),i=vn("borderColor"),s=vn("borderRadius"),a=vn("borderSpacing"),l=vn("borderWidth"),c=vn("contrast"),d=vn("grayscale"),u=vn("hueRotate"),f=vn("invert"),p=vn("gap"),h=vn("gradientColorStops"),x=vn("gradientColorStopPositions"),g=vn("inset"),b=vn("margin"),y=vn("opacity"),_=vn("padding"),w=vn("saturate"),S=vn("scale"),C=vn("sepia"),P=vn("skew"),R=vn("space"),M=vn("translate"),T=()=>["auto","contain","none"],H=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",Tt,t],O=()=>[Tt,t],K=()=>["",Eo,ba],U=()=>["auto",zd,Tt],I=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],re=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],$=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",Tt],ie=()=>["auto","avoid","all","avoid-page","page","left","right","column"],X=()=>[zd,Tt];return{cacheSize:500,separator:":",theme:{colors:[ph],spacing:[Eo,ba],blur:["none","",ya,Tt],brightness:X(),borderColor:[e],borderRadius:["n
vendor: 5,148 bytes, line 383
383one","","full",ya,Tt],borderSpacing:O(),borderWidth:K(),contrast:X(),grayscale:D(),hueRotate:X(),invert:D(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[cF,ba],inset:A(),margin:A(),opacity:X(),padding:O(),saturate:X(),scale:X(),sepia:D(),skew:X(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",Tt]}],container:["container"],columns:[{columns:[ya]}],"break-after":[{"break-after":ie()}],"break-before":[{"break-before":ie()}],"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:[...I(),Tt]}],overflow:[{overflow:H()}],"overflow-x":[{"overflow-x":H()}],"overflow-y":[{"overflow-y":H()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",fh,Tt]}],basis:[{basis:A()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Tt]}],grow:[{grow:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",fh,Tt]}],"grid-cols":[{"grid-cols":[ph]}],"col-start-end":[{col:["auto",{span:["full",fh,Tt]},Tt]}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":[ph]}],"row-start-end":[{row:["auto",{span:[fh,Tt]},Tt]}],"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",Tt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Tt]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...$()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...$(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...$(),"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":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Tt,t]}],"min-w":[{"min-w":[Tt,t,"min","max","fit"]}],"max-w":[{"max-w":[Tt,t,"none","full","min","max","fit","prose",{screen:[ya]},ya]}],h:[{h:[Tt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Tt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Tt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Tt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ya,ba]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",jv]}],"font-family":[{font:[ph]}],"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",Tt]}],"line-clamp":[{"line-clamp":["none",zd,jv]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Eo,Tt]}],"list-image":[{"list-image":["none",Tt]}],"list-style-type":[{list:["none","disc","decimal",Tt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"w
383avy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Eo,ba]}],"underline-offset":[{"underline-offset":["auto",Eo,Tt]}],"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:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Tt]}],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",Tt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...I(),hF]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",uF]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},pF]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"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":[y]}],"border-style":[{border:[...re(),"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":[y]}
vendor: 4,469 bytes, line 383
383],"divide-style":[{divide:re()}],"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:["",...re()]}],"outline-offset":[{"outline-offset":[Eo,Tt]}],"outline-w":[{outline:[Eo,ba]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[Eo,ba]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ya,mF]}],"shadow-color":[{shadow:[ph]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",ya,Tt]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Tt]}],duration:[{duration:X()}],ease:[{ease:["linear","in","out","in-out",Tt]}],delay:[{delay:X()}],animate:[{animate:["none","spin","ping","pulse","bounce",Tt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[fh,Tt]}],"translate-x":[{"translate-x":[M]}],"translate-y":[{"translate-y":[M]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Tt]}],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",Tt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Tt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Eo,ba,jv]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","
383none"]}]},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"]}}},yF=tF(bF);function Bn(...e){return yF(SC(e))}const wF=p7,$C=k.forwardRef(({className:e,...t},n)=>o.jsx(vC,{ref:n,className:Bn("reverie-toast-viewport fixed flex w-full flex-col p-4 md:max-w-[420px]",e),...t}));$C.displayName=vC.displayName;const _F=Zw("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"}}),BC=k.forwardRef(({className:e,variant:t,...n},r)=>o.jsx(bC,{ref:r,className:Bn(_F({variant:t}),e),...n}));BC.displayName=bC.displayName;const kF=k.forwardRef(({className:e,...t},n)=>o.jsx(_C,{ref:n,className:Bn("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}));kF.displayName=_C.displayName;const UC=k.forwardRef(({className:e,...t},n)=>o.jsx(kC,{ref:n,className:Bn("absolute right-2 top-2 rounded-md p-1 text-foreground
vendor: 10,759 bytes, line 383
383/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:o.jsx(Hr,{className:"h-4 w-4"})}));UC.displayName=kC.displayName;const zC=k.forwardRef(({className:e,...t},n)=>o.jsx(yC,{ref:n,className:Bn("text-sm font-semibold",e),...t}));zC.displayName=yC.displayName;const qC=k.forwardRef(({className:e,...t},n)=>o.jsx(wC,{ref:n,className:Bn("text-sm opacity-90",e),...t}));qC.displayName=wC.displayName;function NF(){const{toasts:e}=_D();return o.jsxs(wF,{children:[e.map(function({id:t,title:n,description:r,action:i,...s}){return o.jsxs(BC,{...s,children:[o.jsxs("div",{className:"grid gap-1",children:[n&&o.jsx(zC,{children:n}),r&&o.jsx(qC,{children:r})]}),i,o.jsx(UC,{})]},t)}),o.jsx($C,{})]})}var SF=Q1[" useId ".trim().toString()]||(()=>{}),jF=0;function lg(e){const[t,n]=k.useState(SF());return Jo(()=>{e||n(r=>r??String(jF++))},[e]),e||(t?`radix-${t}`:"")}const EF=["top","right","bottom","left"],sl=Math.min,Li=Math.max,e0=Math.round,pm=Math.floor,oo=e=>({x:e,y:e}),CF={left:"right",right:"left",bottom:"top",top:"bottom"},AF={start:"end",end:"start"};function By(e,t,n){return Li(e,sl(t,n))}function Xo(e,t){return typeof e=="function"?e(t):e}function Zo(e){return e.split("-")[0]}function Au(e){return e.split("-")[1]}function i2(e){return e==="x"?"y":"x"}function s2(e){return e==="y"?"height":"width"}const PF=new Set(["top","bottom"]);function to(e){return PF.has(Zo(e))?"y":"x"}function o2(e){return i2(to(e))}function LF(e,t,n){n===void 0&&(n=!1);const r=Au(e),i=o2(e),s=s2(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=t0(a)),[a,t0(a)]}function RF(e){const t=t0(e);return[Uy(e),t,Uy(t)]}function Uy(e){return e.replace(/start|end/g,t=>AF[t])}const Sk=["left","right"],jk=["right","left"],TF=["top","bottom"],OF=["bottom","top"];function IF(e,t,n){switch(e){case"top":case"bottom":return n?t?jk:Sk:t?Sk:jk;case"left":case"right":return t?TF:OF;default:return[]}}function DF(e,t,n,r){const i=Au(e);let s=IF(Zo(e),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),t&&(s=s.concat(s.map(Uy)))),s}function t0(e){return e.replace(/left|right|bottom|top/g,t=>CF[t])}function FF(e){return{top:0,right:0,bottom:0,left:0,...e}}function WC(e){return typeof e!="number"?FF(e):{top:e,right:e,bottom:e,left:e}}function n0(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 Ek(e,t,n){let{reference:r,floating:i}=e;const s=to(t),a=o2(t),l=s2(a),c=Zo(t),d=s==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,p=r[l]/2-i[l]/2;let h;switch(c){case"top":h={x:u,y:r.y-i.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-i.width,y:f};break;default:h={x:r.x,y:r.y}}switch(Au(t)){case"start":h[a]-=p*(n&&d?-1:1);break;case"end":h[a]+=p*(n&&d?-1:1);break}return h}const MF=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:a}=n,l=s.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:f}=Ek(d,r,c),p=r,h={},x=0;for(let g=0;g<l.length;g++){const{name:b,fn:y}=l[g],{x:_,y:w,data:S,reset:C}=await y({x:u,y:f,initialPlacement:r,placement:p,strategy:i,middlewareData:h,rects:d,platform:a,elements:{reference:e,floating:t}});u=_??u,f=w??f,h={...h,[b]:{...h[b],...S}},C&&x<=50&&(x++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(d=C.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:i}):C.rects),{x:u,y:f}=Ek(d,p,c)),g=-1)}return{x:u,y:f,placement:p,strategy:i,middlewareData:h}};async function kf(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:a,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=Xo(t,e),x=WC(h),b=l[p?f==="floating"?"reference":"floating":f],y=n0(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(b)))==null||n?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),_=f==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),S=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},C=n0(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:_,offsetParent:w,strategy:c}):_);return{top:(y.top-C.top+x.top)/S.y,bottom:(C.bottom-y.bottom+x.bottom)/S.y,left:(y.left-C.left+x.left)/S.x,right:(C.right-y.right+x.right)/S.x}}const $F=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:a,elements:l,middlewareData:c}=t,{element:d,padding:u=0}=Xo(e,t)||{};if(d==null)return{};const f=WC(u),p={x:n,y:r},h=o2(i),x=s2(h),g=await a.getDimensions(d),b=h==="y",y=b?"top":"left",_=b?"bottom":"right",w=b?"clientHeight":"clientWidth",S=s.reference[x]+s.reference[h]-p[h]-s.floating[x],C=p[h]-s.reference[h],P=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let R=P?P[w]:0;(!R||!await(a.isElement==null?void 0:a.isElement(P)))&&(R=l.floating[w]||s.floating[x]);const M=S/2-C/2,T=R/2-g[x]/2-1,H=sl(f[y],T),A=sl(f[_],T),O=H,K=R-g[x]-A,U=R/2-g[x]/2+M,I=By(O,U,K),re=!c.arrow&&Au(i)!=null&&U!==I&&s.reference[x]/2-(U<O?H:A)-g[x]/2<0,V=re?U<O?U-O:U-K:0;return{[h]:p[h]+V,data:{[h]:I,centerOffset:U-I-V,...re&&{alignmentOffset:V}},reset:re}}}),BF=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:a,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:g=!0,...b}=Xo(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=Zo(i),_=to(l),w=Zo(l)===l,S=await(c.isRTL==null?void 0:c.isRTL(d.floating)),C=p||(w||!g?[t0(l)]:RF(l)),P=x!=="none";!p&&P&&C.push(...DF(l,g,x,S));const R=[l,...C],M=await kf(t,b),T=[];let H=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&T.push(M[y]),f){const U=LF(i,a,S);T.push(M[U[0]],M[U[1]])}if(H=[...H,{placement:i,overflows:T}],!T.every(U=>U<=0)){var A,O;const U=(((A=s.flip)==null?void 0:A.index)||0)+1,I=R[U];if(I&&(!(f==="alignment"?_!==to(I):!1)||H.every($=>$.overflows[0]>0&&to($.placement)===_)))return{data:{index:U,overflows:H},reset:{placement:I}};let re=(O=H.filter(V=>V.overflows[0]<=0).sort((V,$)=>V.overflows[1]-$.overflows[1])[0])==null?void 0:O.placement;if(!re)switch(h){case"bestFit":{var K;const V=(K=H.filter($=>{if(P){const D=to($.placement);return D===_||D==="y"}return!0}).map($=>[$.placement,$.overflows.filter(D=>D>0).reduce((D,ie)=>D+ie,0)]).sort(($,D)=>$[1]-D[1])[0])==null?void 0:K[0];V&&(re=V);break}case"initialPlacement":re=l;break}if(i!==re)return{reset:{placement:re}}}return{}}}};function Ck(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ak(e){return EF.some(t=>e[t]>=0)}const UF=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=Xo(e,t);switch(r){case"referenceHidden":{const s=await kf(t,{...i,elementContext:"reference"}),a=Ck(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Ak(a)}}}case"escaped":{const s=await kf(t,{...i,altBoundary:!0}),a=Ck(s,n.floating);return{data:{escapedOffsets:a,escaped:Ak(a)}}}default:return{}}}}},HC=new Set(["left","top"]);async function zF(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=Zo(n),l=Au(n),c=to(n)==="y",d=HC.has(a)?-1:1,u=s&&c?-1:1,f=Xo(t,e);let{mainAxis:p,crossAxis:h,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"&&(h=l==="end"?x*-1:x),c?{x:h*u,y:p*d}:{x:p*d,y:h*u}}const qF=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:a,middlewareData:l}=t,c=await zF(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:a}}}}},WF=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x:y,y:_}=b;return{x:y,y:_}}},...c}=Xo(e,t),d={x:n,y:r},u=await kf(t,c),f=to(Zo(i)),p=i2(f);let h=d[p],x=d[f];if(s){const b=p==="y"?"top":"left",y=p==="y"?"bottom":"right",_=h+u[b],w=h-u[y];h=By(_,h,w)}if(a){const b=f==="y"?"top":"left",y=f==="y"?"bottom":"right",_=x+u[b],w=x-u[y];x=By(_,x,w)}const g=l.fn({...t,[p]:h,[f]:x});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:s,[f]:a}}}}}},HF=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:a}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=Xo(e,t),u={x:n,y:r},f=to(i),p=i2(f);let h=u[p],x=u[f];const g=Xo(l,t),b=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const w=p==="y"?"height":"width",S=s.reference[p]-s.floating[w]+b.mainAxis,C=s.reference[p]+s.reference[w]-b.mainAxis;h<S?h=S:h>C&&(h=C)}if(d){var y,_;const w=p==="y"?"width":"height",S=HC.has(Zo(i)),C=s.reference[f]-s.floating[w]+(S&&((y=a.offset)==null?void 0:y[f])||0)+(S?0:b.crossAxis),P=s.reference[f]+s.reference[w]+(S?0:((_=a.offset)==null?void 0:_[f])||0)-(S?b.crossAxis:0);x<C?x=C:x>P&&(x=P)}return{[p]:h,[f]:x}}}},VF=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:a,elements:l}=t,{apply:c=()=>{},...d}=Xo(e,t),u=await kf(t,d),f=Zo(i),p=Au(i),h=to(i)==="y",{width:x,height:g}=s.floating;let b,y;f==="top"||f==="bottom"?(b=f,y=p===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(y=f,b=p==="end"?"top":"bottom");const _=g-u.top-u.bottom,w=x-u.left-u.right,S=sl(g-u[b],_),C=sl(x-u[y],w),P=!t.middlewareData.shift;let R=S,M=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(M=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=_),P&&!p){const H=Li(u.left,0),A=Li(u.right,0),O=Li(u.top,0),K=Li(u.bottom,0);h?M=x-2*(H!==0||A!==0?H+A:Li(u.left,u.right)):R=g-2*(O!==0||K!==0?O+K:Li(u.top,u.bottom))}await c({...t,availableWidth:M,availableHeight:R});const T=await a.getDimensions(l.floating);
vendor: 4,956 bytes, line 383
383return x!==T.width||g!==T.height?{reset:{rects:!0}}:{}}}};function H0(){return typeof window<"u"}function Pu(e){return VC(e)?(e.nodeName||"").toLowerCase():"#document"}function Fi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function po(e){var t;return(t=(VC(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function VC(e){return H0()?e instanceof Node||e instanceof Fi(e).Node:!1}function ks(e){return H0()?e instanceof Element||e instanceof Fi(e).Element:!1}function ho(e){return H0()?e instanceof HTMLElement||e instanceof Fi(e).HTMLElement:!1}function Pk(e){return!H0()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Fi(e).ShadowRoot}const GF=new Set(["inline","contents"]);function ep(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Ns(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!GF.has(i)}const YF=new Set(["table","td","th"]);function KF(e){return YF.has(Pu(e))}const JF=[":popover-open",":modal"];function V0(e){return JF.some(t=>{try{return e.matches(t)}catch{return!1}})}const XF=["transform","translate","scale","rotate","perspective"],ZF=["transform","translate","scale","rotate","perspective","filter"],QF=["paint","layout","strict","content"];function a2(e){const t=l2(),n=ks(e)?Ns(e):e;return XF.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)||ZF.some(r=>(n.willChange||"").includes(r))||QF.some(r=>(n.contain||"").includes(r))}function eM(e){let t=ol(e);for(;ho(t)&&!mu(t);){if(a2(t))return t;if(V0(t))return null;t=ol(t)}return null}function l2(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const tM=new Set(["html","body","#document"]);function mu(e){return tM.has(Pu(e))}function Ns(e){return Fi(e).getComputedStyle(e)}function G0(e){return ks(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ol(e){if(Pu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Pk(e)&&e.host||po(e);return Pk(t)?t.host:t}function GC(e){const t=ol(e);return mu(t)?e.ownerDocument?e.ownerDocument.body:e.body:ho(t)&&ep(t)?t:GC(t)}function Nf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=GC(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),a=Fi(i);if(s){const l=zy(a);return t.concat(a,a.visualViewport||[],ep(i)?i:[],l&&n?Nf(l):[])}return t.concat(i,Nf(i,[],n))}function zy(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function YC(e){const t=Ns(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ho(e),s=i?e.offsetWidth:n,a=i?e.offsetHeight:r,l=e0(n)!==s||e0(r)!==a;return l&&(n=s,r=a),{width:n,height:r,$:l}}function c2(e){return ks(e)?e:e.contextElement}function qd(e){const t=c2(e);if(!ho(t))return oo(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=YC(t);let a=(s?e0(n.width):n.width)/r,l=(s?e0(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const nM=oo(0);function KC(e){const t=Fi(e);return!l2()||!t.visualViewport?nM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function rM(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Fi(e)?!1:t}function fc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=c2(e);let a=oo(1);t&&(r?ks(r)&&(a=qd(r)):a=qd(e));const l=rM(s,n,r)?KC(s):oo(0);let c=(i.left+l.x)/a.x,d=(i.top+l.y)/a.y,u=i.width/a.x,f=i.height/a.y;if(s){const p=Fi(s),h=r&&ks(r)?Fi(r):r;let x=p,g=zy(x);for(;g&&r&&h!==x;){const b=qd(g),y=g.getBoundingClientRect(),_=Ns(g),w=y.left+(g.clientLeft+parseFloat(_.paddingLeft))*b.x,S=y.top+(g.clientTop+parseFloat(_.paddingTop))*b.y;c*=b.x,d*=b.y,u*=b.x,f*=b.y,c+=w,d+=S,x=Fi(g),g=zy(x)}}return n0({width:u,height:f,x:c,y:d})}function d2(e,t){const n=G0(e).scrollLeft;return t?t.left+n:fc(po(e)).left+n}function JC(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-(n?0:d2(e,r)),s=r.top+t.scrollTop;return{x:i,y:s}}function iM(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",a=po(r),l=t?V0(t.floating):!1;if(r===a||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=oo(1);const u=oo(0),f=ho(r);if((f||!f&&!s)&&((Pu(r)!=="body"||ep(a))&&(c=G0(r)),ho(r))){const h=fc(r);d=qd(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const p=a&&!f&&!s?JC(a,c,!0):oo(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+p.x,y:n.y*d.y-c.scrollTop*d.y+u.y+p.y}}function sM(e){return Array.from(e.getClientRects())}function oM(e){const t=po(e),n=G0(e),r=e.ownerDocument.body,i=Li(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Li(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+d2(e);const l=-n.scrollTop;return Ns(r).direction==="rtl"&&(a+=Li(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:a,y:l}}
vendor: 11,377 bytes, line 383
383function aM(e,t){const n=Fi(e),r=po(e),i=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,l=0,c=0;if(i){s=i.width,a=i.height;const d=l2();(!d||d&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}return{width:s,height:a,x:l,y:c}}const lM=new Set(["absolute","fixed"]);function cM(e,t){const n=fc(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ho(e)?qd(e):oo(1),a=e.clientWidth*s.x,l=e.clientHeight*s.y,c=i*s.x,d=r*s.y;return{width:a,height:l,x:c,y:d}}function Lk(e,t,n){let r;if(t==="viewport")r=aM(e,n);else if(t==="document")r=oM(po(e));else if(ks(t))r=cM(t,n);else{const i=KC(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return n0(r)}function XC(e,t){const n=ol(e);return n===t||!ks(n)||mu(n)?!1:Ns(n).position==="fixed"||XC(n,t)}function dM(e,t){const n=t.get(e);if(n)return n;let r=Nf(e,[],!1).filter(l=>ks(l)&&Pu(l)!=="body"),i=null;const s=Ns(e).position==="fixed";let a=s?ol(e):e;for(;ks(a)&&!mu(a);){const l=Ns(a),c=a2(a);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&lM.has(i.position)||ep(a)&&!c&&XC(e,a))?r=r.filter(u=>u!==a):i=l,a=ol(a)}return t.set(e,r),r}function uM(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const a=[...n==="clippingAncestors"?V0(t)?[]:dM(t,this._c):[].concat(n),r],l=a[0],c=a.reduce((d,u)=>{const f=Lk(t,u,i);return d.top=Li(f.top,d.top),d.right=sl(f.right,d.right),d.bottom=sl(f.bottom,d.bottom),d.left=Li(f.left,d.left),d},Lk(t,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function hM(e){const{width:t,height:n}=YC(e);return{width:t,height:n}}function fM(e,t,n){const r=ho(t),i=po(t),s=n==="fixed",a=fc(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=oo(0);function d(){c.x=d2(i)}if(r||!r&&!s)if((Pu(t)!=="body"||ep(i))&&(l=G0(t)),r){const h=fc(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else i&&d();s&&!r&&i&&d();const u=i&&!r&&!s?JC(i,l):oo(0),f=a.left+l.scrollLeft-c.x-u.x,p=a.top+l.scrollTop-c.y-u.y;return{x:f,y:p,width:a.width,height:a.height}}function Ev(e){return Ns(e).position==="static"}function Rk(e,t){if(!ho(e)||Ns(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return po(e)===n&&(n=n.ownerDocument.body),n}function ZC(e,t){const n=Fi(e);if(V0(e))return n;if(!ho(e)){let i=ol(e);for(;i&&!mu(i);){if(ks(i)&&!Ev(i))return i;i=ol(i)}return n}let r=Rk(e,t);for(;r&&KF(r)&&Ev(r);)r=Rk(r,t);return r&&mu(r)&&Ev(r)&&!a2(r)?n:r||eM(e)||n}const pM=async function(e){const t=this.getOffsetParent||ZC,n=this.getDimensions,r=await n(e.floating);return{reference:fM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function mM(e){return Ns(e).direction==="rtl"}const gM={convertOffsetParentRelativeRectToViewportRelativeRect:iM,getDocumentElement:po,getClippingRect:uM,getOffsetParent:ZC,getElementRects:pM,getClientRects:sM,getDimensions:hM,getScale:qd,isElement:ks,isRTL:mM};function QC(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function xM(e,t){let n=null,r;const i=po(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:u,top:f,width:p,height:h}=d;if(l||t(),!p||!h)return;const x=pm(f),g=pm(i.clientWidth-(u+p)),b=pm(i.clientHeight-(f+h)),y=pm(u),w={rootMargin:-x+"px "+-g+"px "+-b+"px "+-y+"px",threshold:Li(0,sl(1,c))||1};let S=!0;function C(P){const R=P[0].intersectionRatio;if(R!==c){if(!S)return a();R?a(!1,R):r=setTimeout(()=>{a(!1,1e-7)},1e3)}R===1&&!QC(d,e.getBoundingClientRect())&&a(),S=!1}try{n=new IntersectionObserver(C,{...w,root:i.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return a(!0),s}function vM(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=c2(e),u=i||s?[...d?Nf(d):[],...Nf(t)]:[];u.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const f=d&&l?xM(d,n):null;let p=-1,h=null;a&&(h=new ResizeObserver(y=>{let[_]=y;_&&_.target===d&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)})),n()}),d&&!c&&h.observe(d),h.observe(t));let x,g=c?fc(e):null;c&&b();function b(){const y=fc(e);g&&!QC(g,y)&&n(),g=y,x=requestAnimationFrame(b)}return n(),()=>{var y;u.forEach(_=>{i&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),f==null||f(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(x)}}const bM=qF,yM=WF,wM=BF,_M=VF,kM=UF,Tk=$F,NM=HF,SM=(e,t,n)=>{const r=new Map,i={platform:gM,...n},s={...i.platform,_c:r};return MF(e,t,{...i,platform:s})};var jM=typeof document<"u",EM=function(){},cg=jM?k.useLayoutEffect:EM;function r0(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(!r0(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 s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!r0(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function eA(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ok(e,t){const n=eA(e);return Math.round(t*n)/n}function Cv(e){const t=k.useRef(e);return cg(()=>{t.current=e}),t}function CM(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,f]=k.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=k.useState(r);r0(p,r)||h(r);const[x,g]=k.useState(null),[b,y]=k.useState(null),_=k.useCallback($=>{$!==P.current&&(P.current=$,g($))},[]),w=k.useCallback($=>{$!==R.current&&(R.current=$,y($))},[]),S=s||x,C=a||b,P=k.useRef(null),R=k.useRef(null),M=k.useRef(u),T=c!=null,H=Cv(c),A=Cv(i),O=Cv(d),K=k.useCallback(()=>{if(!P.current||!R.current)return;const $={placement:t,strategy:n,middleware:p};A.current&&($.platform=A.current),SM(P.current,R.current,$).then(D=>{const ie={...D,isPositioned:O.current!==!1};U.current&&!r0(M.current,ie)&&(M.current=ie,Kf.flushSync(()=>{f(ie)}))})},[p,t,n,A,O]);cg(()=>{d===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,f($=>({...$,isPositioned:!1})))},[d]);const U=k.useRef(!1);cg(()=>(U.current=!0,()=>{U.current=!1}),[]),cg(()=>{if(S&&(P.current=S),C&&(R.current=C),S&&C){if(H.current)return H.current(S,C,K);K()}},[S,C,K,H,T]);const I=k.useMemo(()=>({reference:P,floating:R,setReference:_,setFloating:w}),[_,w]),re=k.useMemo(()=>({reference:S,floating:C}),[S,C]),V=k.useMemo(()=>{const $={position:n,left:0,top:0};if(!re.floating)return $;const D=Ok(re.floating,u.x),ie=Ok(re.floating,u.y);return l?{...$,transform:"translate("+D+"px, "+ie+"px)",...eA(re.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:D,top:ie}},[n,l,re.floating,u.x,u.y]);return k.useMemo(()=>({...u,update:K,refs:I,elements:re,floatingStyles:V}),[u,K,I,re,V])}const AM=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?Tk({element:r.current,padding:i}).fn(n):{}:r?Tk({element:r,padding:i}).fn(n):{}}}},PM=(e,t)=>({...bM(e),options:[e,t]}),LM=(e,t)=>({...yM(e),options:[e,t]}),RM=(e,t)=>({...NM(e),options:[e,t]}),TM=(e,t)=>({...wM(e),options:[e,t]}),OM=(e,t)=>({..._M(e),options:[e,t]}),IM=(e,t)=>({...kM(e),options:[e,t]}),DM=(e,t)=>({...AM(e),options:[e,t]});var FM="Arrow",tA=k.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return o.jsx(rn.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});tA.displayName=FM;var MM=tA;function nA(e){const[t,n]=k.useState(void 0);return Jo(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let a,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;a=d.inlineSize,l=d.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var u2="Popper",[rA,Y0]=kc(u2),[$M,iA]=rA(u2),sA=e=>{const{__scopePopper:t,children:n}=e,[r,i]=k.useState(null);return o.jsx($M,{scope:t,anchor:r,onAnchorChange:i,children:n})};sA.displayName=u2;var oA="PopperAnchor",aA=k.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=iA(oA,n),a=k.useRef(null),l=Ln(t,a);return k.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||a.current)}),r?null:o.jsx(rn.div,{...i,ref:l})});aA.displayName=oA;var h2="PopperContent",[BM,UM]=rA(h2),lA=k.forwardRef((e,t)=>{var ee,ce,ue,ye,Se,De;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:h="optimized",onPlaced:x,...g}=e,b=iA(h2,n),[y,_]=k.useState(null),w=Ln(t,Re=>_(Re)),[S,C]=k.useState(null),P=nA(S),R=(P==null?void 0:P.width)??0,M=(P==null?void 0:P.height)??0,T=r+(s!=="center"?"-"+s:""),H=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},A=Array.isArray(d)?d:[d],O=A.length>0,K={padding:H,boundary:A.filter(qM),altBoundary:O},{refs:U,floatingStyles:I,placement:re,isPositioned:V,middlewareData:$}=CM({strategy:"fixed",placement:T,whileElementsMounted:(...Re)=>vM(...Re,{animationFrame:h==="always"}),elements:{reference:b.anchor},middleware:[PM({mainAxis:i+M,alignmentAxis:a}),c&&LM({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?RM():void 0,...K}),c&&TM({...K}),OM({...K,apply:({elements:Re,rects:qe,availableWidth:te,availableHeight:Oe})=>{const{width:be,height:se}=qe.reference,Q=Re.floating.style;Q.setProperty("--radix-popper-available-width",`${te}px`),Q.setProperty("--radix-popper-available-height",`${Oe}px`),Q.setProperty("--radix-popper-anchor-width",`${be}px`),Q.setProperty("--radix-popper-anchor-height",`${se}px`)}}),S&&DM({element:S,padding:l}),WM({arrowWidth:R,arrowHeight:M}),p&&IM({strategy:"referenceHidden",...K})]}),[D,ie]=uA(re),X=co(x);Jo(()=>{V&&(X==null||X())},[V,X]);const E=(ee=$.arrow)==null?void 0:ee.x,q=(ce=$.arrow)==null?void 0:ce.y,F=((ue=$.arrow)==null?void 0:ue.centerOffset)!==0,[Z,Y]=k.useState();return Jo(()=>{y&&Y(window.getComputedStyle(y).zIndex)},[y]),o.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:V?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Z,"--radix-popper-transform-origin":[(ye=$.transformOrigin)==null?void 0:ye.x,(Se=$.transformOrigin)==null?void 0:Se.y].join(" "),...((De=$.hide)==null?void 0:De.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(BM,{scope:n,placedSide:D,onArrowChange:C,arrowX:E,arrowY:q,shouldHideArrow:F,children:o.jsx(rn.div,{"data-side":D,"data-align":ie,...g,ref:w,style:{...g.style,animation:V?void 0:"none"}})})})});lA.displayName=h2;var cA="PopperArrow",zM={top:"bottom",right:"left",bottom:"top",left:"r
383ight"},dA=k.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=UM(cA,r),a=zM[s.placedSide];return o.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:o.jsx(MM,{...i,ref:n,style:{...i.style,display:"block"}})})});dA.displayName=cA;function qM(e){return e!==null}var WM=e=>({name:"transformOrigin",options:e,fn(t){var b,y,_;const{placement:n,rects:r,middlewareData:i}=t,a=((b=i.arrow)==null?void 0:b.centerOffset)!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[d,u]=uA(n),f={start:"0%",center:"50%",end:"100%"}[u],p=(((y=i.arrow)==null?void 0:y.x)??0)+l/2,h=(((_=i.arrow)==null?void 0:_.y)??0)+c/2;let x="",g="";return d==="bottom"?(x=a?f:`${p}px`,g=`${-c}px`):d==="top"?(x=a?f:`${p}px`,g=`${r.floating.height+c}px`):d==="right"?(x=`${-c}px`,g=a?f:`${h}px`):d==="left"&&(x=`${r.floating.width+c}px`,g=a?f:`${h}px`),{data:{x,y:g}}}});function uA(e){const[t,n="center"]=e.split("-");return[t,n]}var HM=sA,f2=aA,hA=lA,fA=dA,[K0,YQ]=kc("Tooltip",[Y0]),p2=Y0(),pA="TooltipProvider",VM=700,Ik="tooltip.open",[GM,mA]=K0(pA),gA=e=>{const{__scopeTooltip:t,delayDuration:n=VM,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,a=k.useRef(!0),l=k.useRef(!1),c=k.useRef(0);return k.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),o.jsx(GM,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:k.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:k.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:k.useCallback(d=>{l.current=d},[]),disableHoverableContent:i,children:s})};gA.displayName=pA;var xA="Tooltip",[KQ,J0]=K0(xA),qy="TooltipTrigger",YM=k.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=J0(qy,n),s=mA(qy,n),a=p2(n),l=k.useRef(null),c=Ln(t,l,i.onTriggerChange),d=k.useRef(!1),u=k.useRef(!1),f=k.useCallback(()=>d.current=!1,[]);return k.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),o.jsx(f2,{asChild:!0,...a,children:o.jsx(rn.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:Ft(e.onPointerMove,p=>{p.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:Ft(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:Ft(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Ft(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:Ft(e.onBlur,i.onClose),onClick:Ft(e.onClick,i.onClose)})})});YM.displayName=qy;var KM="TooltipPortal",[JQ,JM]=K0(KM,{forceMount:void 0}),gu="TooltipContent",vA=k.forwardRef((e,t)=>{const n=JM(gu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,a=J0(gu,e.__scopeTooltip);return o.jsx(hl,{present:r||a.open,children:a.disableHoverableContent?o.jsx(bA,{side:i,...s,ref:t}):o.jsx(XM,{side:i,...s,ref:t})})}),XM=k.forwardRef((e,t)=>{const n=J0(gu,e.__scopeTooltip),r=mA(gu,e.__scopeTooltip),i=k.useRef(null),s=Ln(t,i),[a,l]=k.useState(null),{trigger:c,onClose:d}=n,u=i.current,{onPointerInTransitChange:f}=r,p=k.useCallback(()=>{l(null),f(!1)},[f]),h=k.useCallback((x,g)=>{const b=x.currentTarget,y={x:x.clientX,y:x.clientY},_=n$(y,b.getBoundingClientRect()),w=r$(y,_),S=i$(g.getBoundingClientRect()),C=o$([...w,...S]);l(C),f(!0)},[f]);return k.useEffect(()=>()=>p(),[p]),k.useEffect(()=>{if(c&&u){const x=b=>h(b,u),g=b=>h(b,c);return c.addEventListener("pointerleave",x),u.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",x),u.removeEventListener("pointerleave",g)}}},[c,u,h,p]),k.useEffect(()=>{if(a){const x=g=>{const b=g.target,y={x:g.clientX,y:g.clientY},_=(c==null?void 0:c.contains(b))||(u==null?void 0:u.contains(b)),w=!s$(y,a);_?p():w&&(p(),d())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,u,a,d,p]),o.jsx(bA,{...e,ref:s})}),[ZM,QM]=K0(xA,{isInside:!1}),e$=ED("TooltipContent"),bA=k.forwardRef((e,t)=>
vendor: 4,489 bytes, line 383
383{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:a,...l}=e,c=J0(gu,n),d=p2(n),{onClose:u}=c;return k.useEffect(()=>(document.addEventListener(Ik,u),()=>document.removeEventListener(Ik,u)),[u]),k.useEffect(()=>{if(c.trigger){const f=p=>{const h=p.target;h!=null&&h.contains(c.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,u]),o.jsx(Xf,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:o.jsxs(hA,{"data-state":c.stateAttribute,...d,...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:[o.jsx(e$,{children:r}),o.jsx(ZM,{scope:n,isInside:!0,children:o.jsx(JD,{id:c.contentId,role:"tooltip",children:i||r})})]})})});vA.displayName=gu;var yA="TooltipArrow",t$=k.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=p2(n);return QM(yA,n).isInside?null:o.jsx(fA,{...i,...r,ref:t})});t$.displayName=yA;function n$(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function r$(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 i$(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 s$(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const l=t[s],c=t[a],d=l.x,u=l.y,f=c.x,p=c.y;u>r!=p>r&&n<(f-d)*(r-u)/(p-u)+d&&(i=!i)}return i}function o$(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),a$(t)}function a$(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 s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.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 s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.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 l$=gA,wA=vA;const c$=l$,d$=k.forwardRef(({className:e,sideOffset:t=4,...n},r)=>o.jsx(wA,{ref:r,sideOffset:t,className:Bn("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}));d$.displayName=wA.displayName;var Wy=function(e,t){return Wy=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},Wy(e,t)};function u$(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Wy(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var ur=function(){return ur=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},ur.apply(this,arguments)};function X0(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 h$(e,t,n,r){function i(s){return s instanceof n?s:new n(function(a){a(s)})}
383return new(n||(n=Promise))(function(s,a){function l(u){try{d(r.next(u))}catch(f){a(f)}}function c(u){try{d(r.throw(u))}catch(f){a(f)}}function d(u){u.done?s(u.value):i(u.value).then(l,c)}d((r=r.apply(e,t||[])).next())})}const f$=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class m2 extends Error{constructor(t,n="FunctionsError",r){super(t),this.name=n,this.context=r}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class p$ extends m2{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Dk extends m2{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Fk extends m2{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Hy;(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"})(Hy||(Hy={}));class m${constructor(t,{headers:n={},customFetch:r,region:i=Hy.Any}={}){this.url=t,this.headers=n,this.region=i,this.fetch=f$(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return h$(this,arguments,void 0,function*(n,r={}){var i;let s,a;try{const{headers:l,method:c,body:d,signal:u,timeout:f}=r;let p={},{region:h}=r;h||(h=this.region);const x=new URL(`${this.url}/${n}`);h&&h!=="any"&&(p["x-region"]=h,x.searchParams.set("forceFunctionRegion",h));let g;d&&(l&&!Object.prototype.hasOwnProperty.call(l,"Content-Type")||!l)?typeof Blob<"u"&&d instanceof Blob||d instanceof ArrayBuffer?(p["Content-Type"]="application/octet-stream",g=d):typeof d=="string"?(p["Content-Type"]="text/plain",g=d):typeof FormData<"u"&&d instanceof FormData?g=d:(p["Content-Type"]="application/json",g=JSON.stringify(d)):d&&typeof d!="string"&&!(typeof Blob<"u"&&d instanceof Blob)&&!(d instanceof ArrayBuffer)&&!(typeof FormData<"u"&&d instanceof FormData)?g=JSON.stringify(d):g=d;let b=u;f&&(a=new AbortController,s=setTimeout(()=>a.abort(),f),u?(b=a.signal,u.addEventListener("abort",()=>a.abort())):b=a.signal);const y=yield this.fetch(x.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},p),this.headers),l),body:g,signal:b}).catch(C=>{throw new p$(C)}),_=y.headers.get("x-relay-error");if(_&&_==="true")throw new Dk(y);if(!y.ok)throw new Fk(y);let w=((i=y.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),S;return w==="application/json"?S=yield y.json():w==="application/octet-stream"||w==="application/pdf"?S=yield y.blob():w==="text/event-stream"?S=y:w==="multipart/form-data"?S=yield y.formData():S=yield y.text(),{data:S,error:null,response:y}}catch(l){return{data:null,error:l,response:l instanceof Fk||l instanceof Dk?l.context:void 0}}finally{s&&clearTimeout(s)}})}}const _A=3,Mk=e=>Math.min(1e3*2**e,3e4),g$=[520,503],kA=["GET","HEAD","OPTIONS"];var x$=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.co
383de=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function $k(e,t){return new Promise(n=>{if(t!=null&&t.aborted){n();return}const r=setTimeout(()=>{t==null||t.removeEventListener("abort",i),n()},e);function i(){clearTimeout(r),n()}t==null||t.addEventListener("abort",i)})}function v$(e,t,n,r){return!(!r||n>=_A||!kA.includes(e)||!g$.includes(t))}var b$=class{constructor(e){var t,n,r,i,s;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,this.shouldStripNulls=(r=e.shouldStripNulls)!==null&&r!==void 0?r:!1,this.urlLengthLimit=(i=e.urlLengthLimit)!==null&&i!==void 0?i:8e3,this.retryEnabled=(s=e.retry)!==null&&s!==void 0?s:!0,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var n=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const a=this.headers.get("Accept");a==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!a||a==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const r=this.fetch;let s=(async()=>{let a=0;for(;;){const d=new Headers(n.headers);a>0&&d.set("X-Retry-Count",String(a));let u;try{u=await r(n.url.toString(),{method:n.method,headers:d,body:JSON.stringify(n.body,(f,p)=>typeof p=="bigint"?p.toString():p),signal:n.signal})}catch(f){if((f==null?void 0:f.name)==="AbortError"||(f==null?void 0:f.code)==="ABORT_ERR"||!kA.includes(n.method))throw f;if(n.retryEnabled&&a<_A){const p=Mk(a);a++,await $k(p,n.signal);continue}throw f}if(v$(n.method,u.status,a,n.retryEnabled)){var l,c;const f=(l=(c=u.headers)===null||c===void 0?void 0:c.get("Retry-After"))!==null&&l!==void 0?l:null,p=f!==null?Math.max(0,parseInt(f,10)||0)*1e3:Mk(a);await u.text(),a++,await $k(p,n.signal);continue}return await n.processResponse(u)}})();return this.shouldThrowOnError||(s=s.catch(a=>{var l;let c="",d="",u="";const f=a==null?void 0:a.cause;if(f){var p,h,x,g;const _=(p=f==null?void 0:f.message)!==null&&p!==void 0?p:"",w=(h=f==null?void 0:f.code)!==null&&h!==void 0?h:"";c=`${(x=a==null?void 0:a.name)!==null&&x!==void 0?x:"FetchError"}: ${a==null?void 0:a.message}`,c+=`
384
385Caused by: ${(g=f==null?void 0:f.name)!==null&&g!==void 0?g:"Error"}: ${_}`,w&&(c+=` (${w})`),f!=null&&f.stack&&(c+=`
386${f.stack}`)}else{var b;c=(b=a==null?void 0:a.stack)!==null&&b!==void 0?b:""}const y=this.url.toString().length;return(a==null?void 0:a.name)==="AbortError"||(a==null?void 0:a.code)==="ABORT_ERR"?(u="",d="Request was aborted (timeout or manual cancellation)",y>this.urlLengthLimit&&(d+=`. Note: Your request URL is ${y} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((f==null?void 0:f.name)==="HeadersOverflowError"||(f==null?void 0:f.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",d="HTTP headers exceeded server limits (typically 16KB)",y>this.urlLengthLimit&&(d+=`. Your request URL is ${y} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(l=a==null?void 0:a.name)!==null&&l!==void 0?l:"FetchError"}: ${a==null?void 0:a.message}`,details:c,hint:d,code:u},data:null,count:null,status:0,statusText:""}}
386)),s.then(e,t)}async processResponse(e){var t=this;let n=null,r=null,i=null,s=e.status,a=e.statusText;if(e.ok){var l,c;if(t.method!=="HEAD"){var d;const p=await e.text();p===""||(t.headers.get("Accept")==="text/csv"||t.headers.get("Accept")&&(!((d=t.headers.get("Accept"))===null||d===void 0)&&d.includes("application/vnd.pgrst.plan+text"))?r=p:r=JSON.parse(p))}const u=(l=t.headers.get("Prefer"))===null||l===void 0?void 0:l.match(/count=(exact|planned|estimated)/),f=(c=e.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");u&&f&&f.length>1&&(i=parseInt(f[1])),t.isMaybeSingle&&Array.isArray(r)&&(r.length>1?(n={code:"PGRST116",details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},r=null,i=null,s=406,a="Not Acceptable"):r.length===1?r=r[0]:r=null)}else{const u=await e.text();try{n=JSON.parse(u),Array.isArray(n)&&e.status===404&&(r=[],n=null,s=200,a="OK")}catch{e.status===404&&u===""?(s=204,a="No Content"):n={message:u}}if(n&&t.shouldThrowOnError)throw new x$(n)}return{success:n===null,error:n,data:r,count:i,status:s,statusText:a}}returns(){return this}overrideTypes(){return this}},y$=class extends b${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 s=i?`${i}.order`:"order",a=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${a?`${a},`:""}${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`,s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(s,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:i=!1,format:s="text"}={}){var a;const l=[e?"analyze":null,t?"verbose":null,n?"settings":null,r?"buffers":null,i?"wal":null].filter(Boolean).join("|"),c=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${s}; for="${c}"; options=${l};`),s==="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 Bk=new RegExp("[,()]");var md=class extends y${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"&&Bk.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"&&Bk.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 s=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${i}fts${s}.${t}`),this}match(e){return Object.entries(e).filter(([t,n])=>
386n!==void 0).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}},w$=class{constructor(e,{headers:t={},schema:n,fetch:r,urlLengthLimit:i=8e3,retry:s}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r,this.urlLengthLimit=i,this.retry=s}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:n=!1,count:r}=t??{},i=n?"HEAD":"GET";let s=!1;const a=(e??"*").split("").map(d=>/\s/.test(d)&&!s?"":(d==='"'&&(s=!s),d)).join(""),{url:l,headers:c}=this.cloneRequestState();return l.searchParams.set("select",a),r&&c.append("Prefer",`count=${r}`),new md({method:i,url:l,headers:c,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;const i="POST",{url:s,headers:a}=this.cloneRequestState();if(t&&a.append("Prefer",`count=${t}`),n||a.append("Prefer","missing=default"),Array.isArray(e)){const l=e.reduce((c,d)=>c.concat(Object.keys(d)),[]);if(l.length>0){const c=[...new Set(l)].map(d=>`"${d}"`);s.searchParams.set("columns",c.join(","))}}return new md({method:i,url:s,headers:a,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:i=!0}={}){var s;const a="POST",{url:l,headers:c}=this.cloneRequestState();if(c.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&l.searchParams.set("on_conflict",t),r&&c.append("Prefer",`count=${r}`),i||c.append("Prefer","missing=default"),Array.isArray(e)){const d=e.reduce((u,f)=>u.concat(Object.keys(f)),[]);if(d.length>0){const u=[...new Set(d)].map(f=>`"${f}"`);l.searchParams.set("columns",u.join(","))}}return new md({method:a,url:l,headers:c,schema:this.schema,body:e,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var n;const r="PATCH",{url:i,headers:s}=this.cloneRequestState();return t&&s.append("Prefer",`count=${t}`),new md({method:r,url:i,headers:s,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const n="DELETE",{url:r,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new md({method:n,url:r,headers:i,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Sf(e){"@babel/helpers - typeof";return Sf=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},Sf(e)}function _$(e,t){if(Sf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Sf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function k$(e){var t=_$(e,"string");return Sf(t)=="symbol"?t:t+""}function N$(e,t,n){return(t=k$(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Uk(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 mm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Uk(Object(n),!0).forEach(function(r){N$(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Uk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var S$=class NA{constructor(t,{headers:n={},schema:r,fetch:i,timeout:s,urlLengthLimit:a=8e3,retry:l}={}){this.url=t,this.headers=new Headers(n),this.schemaName=r,this.urlLengthLimit=a;const c=i??globalThis.fetch;s!==void 0&&s>0?this.fetch=(d,u)=>{const f=new AbortController,p=setTimeout(()=>f.abort(),s),h=u==null?void 0:u.signal;if(h){if(h.aborted)return clearTimeout(p),c(d,u);const x=()=>{clearTimeout(p),f.abort()};return h.addEventListener("abort",x,{once:!0}),c(d,mm(mm({},u),{}
386,{signal:f.signal})).finally(()=>{clearTimeout(p),h.removeEventListener("abort",x)})}return c(d,mm(mm({},u),{},{signal:f.signal})).finally(()=>clearTimeout(p))}:this.fetch=c,this.retry=l}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new w$(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new NA(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,n={},{head:r=!1,get:i=!1,count:s}={}){var a;let l;const c=new URL(`${this.url}/rpc/${t}`);let d;const u=h=>h!==null&&typeof h=="object"&&(!Array.isArray(h)||h.some(u)),f=r&&Object.values(n).some(u);f?(l="POST",d=n):r||i?(l=r?"HEAD":"GET",Object.entries(n).filter(([h,x])=>x!==void 0).map(([h,x])=>[h,Array.isArray(x)?`{${x.join(",")}}`:`${x}`]).forEach(([h,x])=>{c.searchParams.append(h,x)})):(l="POST",d=n);const p=new Headers(this.headers);return f?p.set("Prefer",s?`count=${s},return=minimal`:"return=minimal"):s&&p.set("Prefer",`count=${s}`),new md({method:l,url:c,headers:p,schema:this.schemaName,body:d,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class j${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."};const n=globalThis.process;if(n){const r=n.versions;if(r&&r.node){const i=r.node,s=parseInt(i.replace(/^v/,"").split(".")[0]);return s>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${s} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${s} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
387import ws from "ws"
388new 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+=`
389
390Suggested solution: ${t.workaround}`),new Error(n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const E$="2.104.0",C$=`realtime-js/${E$}`,A$="1.0.0",SA="2.0.0",P$=SA,L$=1e4,R$=100,La={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},jA={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave",access_token:"access_token"},Vy={connecting:"connecting",open:"open",closing:"closing",closed:"closed"};class T${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:{},a=new TextEncoder().encode(JSON.stringify(i)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(t,n,r){var i,s;const a=t.topic,l=(i=t.ref)!==null&&i!==void 0?i:"",c=(s=t.join_ref)!==null&&s!==void 0?s:"",d=t.payload.event,u=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},f=Object.keys(u).length===0?"":JSON.stringify(u);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(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`userEvent length ${d.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`metadata length ${f.length} exceeds maximum of 255`);const p=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+l.length+a.length+d.length+f.length,h=new ArrayBuffer(this.HEADER_LENGTH+p);
390let x=new DataView(h),g=0;x.setUint8(g++,this.KINDS.userBroadcastPush),x.setUint8(g++,c.length),x.setUint8(g++,l.length),x.setUint8(g++,a.length),x.setUint8(g++,d.length),x.setUint8(g++,f.length),x.setUint8(g++,n),Array.from(c,y=>x.setUint8(g++,y.charCodeAt(0))),Array.from(l,y=>x.setUint8(g++,y.charCodeAt(0))),Array.from(a,y=>x.setUint8(g++,y.charCodeAt(0))),Array.from(d,y=>x.setUint8(g++,y.charCodeAt(0))),Array.from(f,y=>x.setUint8(g++,y.charCodeAt(0)));var b=new Uint8Array(h.byteLength+r.byteLength);return b.set(new Uint8Array(h),0),b.set(new Uint8Array(r),h.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,s,a,l,c]=r;return n({join_ref:i,ref:s,topic:a,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),s=n.getUint8(2),a=n.getUint8(3),l=n.getUint8(4);let c=this.HEADER_LENGTH+4;const d=r.decode(t.slice(c,c+i));c=c+i;const u=r.decode(t.slice(c,c+s));c=c+s;const f=r.decode(t.slice(c,c+a));c=c+a;const p=t.slice(c,t.byteLength),h=l===this.JSON_ENCODING?JSON.parse(r.decode(p)):p,x={type:this.BROADCAST_EVENT,event:u,payload:h};return a>0&&(x.meta=JSON.parse(f)),{join_ref:null,ref:null,topic:d,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)))}}var hn;(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"})(hn||(hn={}));const zk=(e,t,n={})=>{var r;const i=(r=n.skipTypes)!==null&&r!==void 0?r:[];return t?Object.keys(t).reduce((s,a)=>(s[a]=O$(a,e,t,i),s),{}):{}},O$=(e,t,n,r)=>{const i=t.find(l=>
vendor: 5,523 bytes, line 390
390l.name===e),s=i==null?void 0:i.type,a=n[e];return s&&!r.includes(s)?EA(s,a):Gy(a)},EA=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return M$(t,n)}switch(e){case hn.bool:return I$(t);case hn.float4:case hn.float8:case hn.int2:case hn.int4:case hn.int8:case hn.numeric:case hn.oid:return D$(t);case hn.json:case hn.jsonb:return F$(t);case hn.timestamp:return $$(t);case hn.abstime:case hn.date:case hn.daterange:case hn.int4range:case hn.int8range:case hn.money:case hn.reltime:case hn.text:case hn.time:case hn.timestamptz:case hn.timetz:case hn.tsrange:case hn.tstzrange:return Gy(t);default:return Gy(t)}},Gy=e=>e,I$=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},D$=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},F$=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},M$=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,r=e[n];if(e[0]==="{"&&r==="}"){let s;const a=e.slice(1,n);try{s=JSON.parse("["+a+"]")}catch{s=a?a.split(","):[]}return s.map(l=>EA(t,l))}return e},$$=e=>typeof e=="string"?e.replace(" ","T"):e,CA=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};var Hh=e=>typeof e=="function"?e:function(){return e},B$=typeof self<"u"?self:null,gd=typeof window<"u"?window:null,Ys=B$||gd||globalThis,U$="2.0.0",z$=1e4,q$=1e3,Zs={connecting:0,open:1,closing:2,closed:3},li={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Io={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Yy={longpoll:"longpoll",websocket:"websocket"},W$={complete:4},Ky="base64url.bearer.phx.",gm=class{constructor(e,t,n,r){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},AA=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},H$=class{constructor(e,t,n){this.state=li.closed,this.topic=e,this.params=Hh(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new gm(this,Io.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new AA(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=li.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this.joinPush.receive("error",r=>{this.state=li.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=li.closed,this.socket.remove(this)}),this.onError(r=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.isJoining()&&this.joinPush.reset(),this.state=li.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new gm(this,Io.leave,Hh({}),this.timeout).send(),this.state=li.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Io.reply,(r,i)=>{this.trigger(this.replyEventName(i),r)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}
vendor: 5,263 bytes, line 390
390teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=li.closed,this.bindings=[]}onClose(e){this.on(Io.close,e)}onError(e){return this.on(Io.error,t=>e(t))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter(n=>!(n.event===e&&(typeof t>"u"||t===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new gm(this,e,function(){return t},n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=li.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Io.close,"leave")},n=new gm(this,Io.leave,Hh({}),e);return n.receive("ok",()=>t()).receive("timeout",()=>t()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}filterBindings(e,t,n){return!0}isMember(e,t,n,r){return this.topic!==e?!1:r&&r!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:r}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=li.joining,this.joinPush.resend(e))}trigger(e,t,n,r){let i=this.onMessage(e,t,n,r);if(t&&!i)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let s=this.bindings.filter(a=>a.event===e&&this.filterBindings(a,t,n));for(let a=0;a<s.length;a++)s[a].callback(i,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===li.closed}isErrored(){return this.state===li.errored}isJoined(){return this.state===li.joined}isJoining(){return this.state===li.joining}isLeaving(){return this.state===li.leaving}},i0=class{static request(e,t,n,r,i,s,a){if(Ys.XDomainRequest){let l=new Ys.XDomainRequest;return this.xdomainRequest(l,e,t,r,i,s,a)}else if(Ys.XMLHttpRequest){let l=new Ys.XMLHttpRequest;return this.xhrRequest(l,e,t,n,r,i,s,a)}else{if(Ys.fetch&&Ys.AbortController)return this.fetchRequest(e,t,n,r,i,s,a);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,n,r,i,s,a){let l={method:e,headers:n,body:r},c=null;return i&&(c=new AbortController,setTimeout(()=>c.abort(),i),l.signal=c.signal),Ys.fetch(t,l).then(d=>d.text()).then(d=>this.parseJSON(d)).then(d=>a&&a(d)).catch(d=>{d.name==="AbortError"&&s?s():a&&a(null)}),c}static xdomainRequest(e,t,n,r,i,s,a){return e.timeout=i,e.open(t,n),e.onload=()=>{let l=this.parseJSON(e.responseText);a&&a(l)},s&&(e.ontimeout=s),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,i,s,a,l){e.open(t,n,!0),e.timeout=s;for(let[c,d]of Object.entries(r))e.setRequestHeader(c,d);return e.onerror=()=>l&&l(null),e.onreadystatechange=()=>{if(e.readyState===W$.complete&&l){let c=this.parseJSON(e.responseText);l(c)}},a&&(e.ontimeout=a),e.send(i),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let i=t?`${t}[${r}]`:r,s=e[r];typeof s=="object"?n.push(this.serialize(s,i)):n.push(encodeURIComponent(i)+"="+encodeURIComponent(s))}return n.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},V$=e=>{let t="",n=new Uint8Array(e),r=n.byteLength;for(let i=0;i<r;i++)t+=String.fromCharCode(n[i]);return btoa(t)},Jc=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(Ky)&&(this.authToken=atob(t[1].slice(Ky.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=Zs.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Yy.websocket),"$1/"+Yy.longpoll)}endpointURL(){return i0.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=Zs.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Zs.open||this.readyState===Zs.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:n,token:r,messages:i}=t;if(n===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=r}else n=0;switch(n){case 200:i.forEach(s=>{setTimeout(()=>this.onmessage({data:s}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Zs.open,this.onopen({}),this.poll();break;
390case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${n}`)}})}send(e){typeof e!="string"&&(e=V$(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(`
391`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,n){for(let i of this.reqs)i.abort();this.readyState=Zs.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(e,t,n,r,i){let s,a=()=>{this.reqs.delete(s),r()};s=i0.request(e,this.endpointURL(),t,n,this.timeout,a,l=>{this.reqs.delete(s),this.isActive()&&i(l)}),this.reqs.add(s)}},G$=class Lh{constructor(t,n={}){let r=n.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,i=>{let{onJoin:s,onLeave:a,onSync:l}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Lh.syncState(this.state,i,s,a),this.pendingDiffs.forEach(c=>{this.state=Lh.syncDiff(this.state,c,s,a)}),this.pendingDiffs=[],l()}),this.channel.on(r.diff,i=>{let{onJoin:s,onLeave:a,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=Lh.syncDiff(this.state,i,s,a),l())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return Lh.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,n,r,i){let s=this.clone(t),a={},l={};return this.map(s,(c,d)=>{n[c]||(l[c]=d)}),this.map(n,(c,d)=>{let u=s[c];if(u){let f=d.metas.map(g=>g.phx_ref),p=u.metas.map(g=>g.phx_ref),h=d.metas.filter(g=>p.indexOf(g.phx_ref)<0),x=u.metas.filter(g=>f.indexOf(g.phx_ref)<0);h.length>0&&(a[c]=d,a[c].metas=h),x.length>0&&(l[c]=this.clone(u),l[c].metas=x)}else a[c]=d}),this.syncDiff(s,{joins:a,leaves:l},r,i)}static syncDiff(t,n,r,i){let{joins:s,leaves:a}=this.clone(n);return r||(r=function(){}),i||(i=function(){}),this.map(s,(l,c)=>{let d=t[l];if(t[l]=this.clone(c),d){let u=t[l].metas.map(p=>p.phx_ref),f=d.metas.filter(p=>u.indexOf(p.phx_ref)<0);t[l].metas.unshift(...f)}r(l,d,c)}),this.map(a,(l,c)=>{let d=t[l];if(!d)return;let u=c.metas.map(f=>f.phx_ref);d.metas=d.metas.filter(f=>u.indexOf(f.phx_ref)<0),i(l,d,c),d.metas.length===0&&delete t[l]}),t}static list(t,n){return n||(n=function(r,i){return i}),this.map(t,(r,i)=>n(r,i))}static map(t,n){return Object.getOwnPropertyNames(t).map(r=>n(r,t[r]))}static clone(t){return JSON.parse(JSON.stringify(t))}},xm={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,i,s,a]=JSON.parse(e);return t({join_ref:n,ref:r,topic:i,event:s,payload:a})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:i,payload:s}=e,a=this.META_LENGTH+t.length+n.length+i.length+r.length,l=new ArrayBuffer(this.HEADER_LENGTH+a),c=new DataView(l),d=0;c.setUint8(d++,this.KINDS.push),c.setUint8(d++,t.length),c.setUint8(d++,n.length),c.setUint8(d++,i.length),c.setUint8(d++,r.length),Array.from(t,f=>c.setUint8(d++,f.charCodeAt(0))),Array.from(n,f=>c.setUint8(d++,f.charCodeAt(0))),Array.from(i,f=>c.setUint8(d++,f.charCodeAt(0))),Array.from(r,f=>c.setUint8(d++,f.charCodeAt(0)));var u=new Uint8Array(l.byteLength+s.byteLength);return u.set(new Uint8Array(l),0),u.set(new Uint8Array(s),l.byteLength),u.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}}
vendor: 8,419 bytes, line 391
391,decodePush(e,t,n){let r=t.getUint8(1),i=t.getUint8(2),s=t.getUint8(3),a=this.HEADER_LENGTH+this.META_LENGTH-1,l=n.decode(e.slice(a,a+r));a=a+r;let c=n.decode(e.slice(a,a+i));a=a+i;let d=n.decode(e.slice(a,a+s));a=a+s;let u=e.slice(a,e.byteLength);return{join_ref:l,ref:null,topic:c,event:d,payload:u}},decodeReply(e,t,n){let r=t.getUint8(1),i=t.getUint8(2),s=t.getUint8(3),a=t.getUint8(4),l=this.HEADER_LENGTH+this.META_LENGTH,c=n.decode(e.slice(l,l+r));l=l+r;let d=n.decode(e.slice(l,l+i));l=l+i;let u=n.decode(e.slice(l,l+s));l=l+s;let f=n.decode(e.slice(l,l+a));l=l+a;let p=e.slice(l,e.byteLength),h={status:f,response:p};return{join_ref:c,ref:d,topic:u,event:Io.reply,payload:h}},decodeBroadcast(e,t,n){let r=t.getUint8(1),i=t.getUint8(2),s=this.HEADER_LENGTH+2,a=n.decode(e.slice(s,s+r));s=s+r;let l=n.decode(e.slice(s,s+i));s=s+i;let c=e.slice(s,e.byteLength);return{join_ref:null,ref:null,topic:a,event:l,payload:c}}},Y$=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||z$,this.transport=t.transport||Ys.WebSocket||Jc,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||Ys&&Ys.sessionStorage,this.establishedConnections=0,this.defaultEncoder=xm.encode.bind(xm),this.defaultDecoder=xm.decode.bind(xm),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==Jc?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;gd&&gd.addEventListener&&(gd.addEventListener("pagehide",r=>{this.conn&&(this.disconnect(),n=this.connectClock)}),gd.addEventListener("pageshow",r=>{n===this.connectClock&&(n=null,this.connect())}),gd.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=r=>t.rejoinAfterMs?t.rejoinAfterMs(r):[1e3,2e3,5e3][r-1]||1e4,this.reconnectAfterMs=r=>t.reconnectAfterMs?t.reconnectAfterMs(r):[10,50,100,150,200,250,500,1e3,2e3][r-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(r,i,s)=>{console.log(`${r}: ${i}`,s)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=Hh(t.params||{}),this.endPoint=`${e}/${Yy.websocket}`,this.vsn=t.vsn||U$,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new AA(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return Jc}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=i0.appendParams(i0.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Hh(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Jc?this.connectWithFallback(Jc,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let r=this.onMessage(i=>{i.ref===t&&(this.off([r]),e(Date.now()-n))});return!0}transportName(e){switch(e){case Jc:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${Ky}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n=!1,r=!0,i,s,a=this.transportName(e),l=c=>{this.log("transport",`falling back to ${a}...`,c),this.off([i,s]),r=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${a}`))return l("memorized");this.fallbackTimer=setTimeout(l,t),s=this.onError(c=>{this.log("transport","error",c),r&&!n&&(clearTimeout(this.fallbackTimer),l(c))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(n=!0,!r){let c=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${c}`,"true"),this.log("transport",`established ${c} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(l,t),this.ping(c=>{this.log("transport","connected to primary after",c),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),q$,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();const r=this.conn;this.waitForBufferDone(r,()=>{t?r.close(t,n||""):r.close(),this.waitForSocketClosed(r,()=>{this.conn===r&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,n=1){if(n===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,n+1)},150*n)}waitForSocketClosed(e,t,n=1){if(n===5||e.readyState===Zs.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,n+1)},150*n)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,n=this.establishedConnections;this.triggerStateCallbacks("error",e,t,n),(t===this.transport||n>0)&&this.triggerChanError()}
391triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Io.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case Zs.connecting:return"connecting";case Zs.open:return"open";case Zs.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([n])=>e.indexOf(n)===-1)}channel(e,t={}){let n=new H$(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:i,join_ref:s}=e;this.log("push",`${t} ${n} (${s}, ${i})`,r)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:n,event:r,payload:i,ref:s,join_ref:a}=t;if(s&&s===this.pendingHeartbeatRef){const l=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(i.status==="ok"?"ok":"error",l)}catch(c){this.log("error","error in heartbeat callback",c)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${i.status||""} ${n} ${r} ${s&&"("+s+")"||""}`.trim(),i);for(let l=0;l<this.channels.length;l++){const c=this.channels[l];c.isMember(n,r,i,a)&&c.trigger(r,i,s,a)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([n,r])=>{try{r(...t)}catch(i){this.log("error",`error in ${e} callback`,i)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}leaveOpenTopic(e){let t=this.channels.find(n=>n.topic===e&&(n.isJoined()||n.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class Vh{constructor(t,n){const r=J$(n);this.presence=new G$(t.getChannel(),r),this.presence.onJoin((i,s,a)=>{const l=Vh.onJoinPayload(i,s,a);t.getChannel().trigger("presence",l)}),this.presence.onLeave((i,s,a)=>{const l=Vh.onLeavePayload(i,s,a);t.getChannel().trigger("presence",l)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return Vh.transformState(this.presence.state)}static transformState(t){return t=K$(t),Object.getOwnPropertyNames(t).reduce((n,r)=>{const i=t[r];return n[r]=dg(i),n},{})}static onJoinPayload(t,n,r){const i=qk(n),s=dg(r);return{event:"join",key:t,currentPresences:i,newPresences:s}}static onLeavePayload(t,n,r){const i=qk(n),s=dg(r);return{event:"leave",key:t,currentPresences:i,leftPresences:s}}}function dg(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function K$(e){return JSON.parse(JSON.stringify(e))}function J$(e){return(e==null?void 0:e.events)&&{events:e.events}}function qk(e){return e!=null&&e.metas?dg(e):[]}var Wk;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(Wk||(Wk={}));class X${get state(){return this.presenceAdapter.state}constructor(t,n){this.channel=t,this.presenceAdapter=new Vh(this.channel.channelAdapter,n)}}class Z${constructor(t,n,r){const i=Q$(r);this.channel=t.getSocket().channel(n,i),this.socket=t}get state(){return this.channel.state}set state(t){this.channel.state=t}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(t,n){return this.channel.on(t,n)}off(t,n){this.channel.off(t,n)}subscribe(t){return this.channel.join(t)}unsubscribe(t){return this.channel.leave(t)}teardown(){this.channel.teardown()}onClose(t){this.channel.onClose(t)}onError(t){return this.channel.onError(t)}push(t,n,r){let i;try{i=this.channel.push(t,n,r)}catch{throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>R$){const s=this.channel.pushBuffer.shift();s.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${s.event}`,s.payload())}return i}updateJoinPayload(t){const n=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},n),t)}canPush(){return this.socket.isConnected()&&this.state===La.joined}isJoined(){return this.state===La.joined}isJoining(){return this.state===La.joining}isClosed(){return this.state===La.closed}isLeaving(){return this.state===La.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function Q$(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var Hk;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(Hk||(Hk={}));var Td;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Td||(Td={}));var Do;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"}
391)(Do||(Do={}));class Gh{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(t,n={config:{}},r){var i,s;if(this.topic=t,this.params=n,this.socket=r,this.bindings={},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.channelAdapter=new Z$(this.socket.socketAdapter,t,this.params),this.presence=new X$(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=CA(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((s=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||s===void 0)&&s.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(t,n=this.timeout){var r,i,s;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:a,presence:l,private:c}}=this.params,d=(i=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(h=>h.filter))!==null&&i!==void 0?i:[],u=!!this.bindings[Td.PRESENCE]&&this.bindings[Td.PRESENCE].length>0||((s=this.params.config.presence)===null||s===void 0?void 0:s.enabled)===!0,f={},p={broadcast:a,presence:Object.assign(Object.assign({},l),{enabled:u}),postgres_changes:d,private:c};this.socket.accessTokenValue&&(f.access_token=this.socket.accessTokenValue),this._onError(h=>{t==null||t(Do.CHANNEL_ERROR,h)}),this._onClose(()=>t==null?void 0:t(Do.CLOSED)),this.updateJoinPayload(Object.assign({config:p},f)),this._updateFilterMessage(),this.channelAdapter.subscribe(n).receive("ok",async({postgres_changes:h})=>{if(this.socket._isManualToken()||this.socket.setAuth(),h===void 0){t==null||t(Do.SUBSCRIBED);return}this._updatePostgresBindings(h,t)}).receive("error",h=>{this.state=La.errored,t==null||t(Do.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(h).join(", ")||"error")))}).receive("timeout",()=>{t==null||t(Do.TIMED_OUT)})}return this}_updatePostgresBindings(t,n){var r;const i=this.bindings.postgres_changes,s=(r=i==null?void 0:i.length)!==null&&r!==void 0?r:0,a=[];for(let l=0;l<s;l++){const c=i[l],{filter:{event:d,schema:u,table:f,filter:p}}=c,h=t&&t[l];if(h&&h.event===d&&Gh.isFilterValueEqual(h.schema,u)&&Gh.isFilterValueEqual(h.table,f)&&Gh.isFilterValueEqual(h.filter,p))a.push(Object.assign(Object.assign({},c),{id:h.id}));else{this.unsubscribe(),this.state=La.errored,n==null||n(Do.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=a,this.state!=La.errored&&n&&n(Do.SUBSCRIBED)}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){const i=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),s=t===Td.PRESENCE||t===Td.POSTGRES_CHANGES;if(i&&s)throw this.socket.log("channel",`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(t,n,r)}async httpSend(t,n,r={}){var i;if(n==null)return Promise.reject(new Error("Payload is required for httpSend()"));const s={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(s.Authorization=`Bearer ${this.socket.accessTokenValue}`);const a={method:"POST",headers:s,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:n,private:this.private}]})},l=await this._fetchWithTimeout(this.broadcastEndpointURL,a,(i=r.timeout)!==null&&i!==void 0?i:this.timeout);if(l.status===202)return{success:!0};let c=l.statusText;try{const d=await l.json();c=d.error||d.message||c}catch{}return Promise.reject(new Error(c))}async send(t,n={}){var r,i;if(!this.channelAdapter.canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated 
391in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:a}=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:s,payload:a,private:this.private}]})};try{const d=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((i=d.body)===null||i===void 0?void 0:i.cancel()),d.ok?"ok":"error"}catch(d){return d.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var a,l,c;const d=this.channelAdapter.push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((c=(l=(a=this.params)===null||a===void 0?void 0:a.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&s("ok"),d.receive("ok",()=>s("ok")),d.receive("error",()=>s("error")),d.receive("timeout",()=>s("timed out"))})}updateJoinPayload(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(n=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>n("ok")).receive("timeout",()=>n("timed out")).receive("error",()=>n("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,n,r){const i=new AbortController,s=setTimeout(()=>i.abort(),r),a=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:i.signal}));return clearTimeout(s),a}_on(t,n,r){const i=t.toLocaleLowerCase(),s=this.channelAdapter.on(t,r),a={type:i,filter:n,callback:r,ref:s};return this.bindings[i]?this.bindings[i].push(a):this.bindings[i]=[a],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,n,r)=>{var i,s,a,l,c,d,u;const f=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(f,r))return!1;const p=(i=this.bindings[f])===null||i===void 0?void 0:i.find(h=>h.ref===t.ref);if(!p)return!0;if(["broadcast","presence","postgres_changes"].includes(f))if("id"in p){const h=p.id,x=(s=p.filter)===null||s===void 0?void 0:s.event;return h&&((a=n.ids)===null||a===void 0?void 0:a.includes(h))&&(x==="*"||(x==null?void 0:x.toLocaleLowerCase())===((l=n.data)===null||l===void 0?void 0:l.type.toLocaleLowerCase()))}else{const h=(d=(c=p==null?void 0:p.filter)===null||c===void 0?void 0:c.event)===null||d===void 0?void 0:d.toLocaleLowerCase();return h==="*"||h===((u=n==null?void 0:n.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return p.type.toLocaleLowerCase()===f})}_notThisChannelEvent(t,n){const{close:r,error:i,leave:s,join:a}=jA;return n&&[r,i,s,a].includes(t)&&n!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,n,r)=>{if(typeof n=="object"&&"ids"in n){const i=n.data,{schema:s,table:a,commit_timestamp:l,type:c,errors:d}=i;return Object.assign(Object.assign({},{schema:s,table:a,commit_timestamp:l,eventType:c,new:{},old:{},errors:d}),this._getPayloadRecords(i))}return n})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const n in t.bindings)for(const r of t.bindings[n])this._on(r.type,r.filter,r.callback)}static isFilterValueEqual(t,n){return(t??void 0)===(n??void 0)}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=zk(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=zk(t.columns,t.old_record)),n}}class e9{constructor(t,n){this.socket=new Y$(t,n)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,n,r,i=1e4){return new Promise(s=>{setTimeout(()=>s("timeout"),i),this.socket.disconnect(()=>{t(),s("ok")},n,r)})}push(t){this.socket.push(t)}log(t,n,r){this.socket.log(t,n,r)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==Vy.connecting}isDisconnecting(){return this.socket.connectionState()==Vy.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const t9={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},n9=[1e3,2e3,5e3,1e4],r9=1e4,i9=`
392  addEventListener("message", (e) => {
393    if (e.data.event === "start") {
394      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
395    }
396  });`;class s9{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(t,n){var r;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={}
396,this.ref=0,this.serializer=new T$,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._resolveFetch=s=>s?(...a)=>s(...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;const i=this._initializeOptions(n);this.socketAdapter=new e9(t,i),this.httpEndpoint=CA(t),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(t){const n=t.message;throw n.includes("Node.js")?new Error(`${n}
397
398To use Realtime in Node.js, you need to provide a WebSocket implementation:
399
400Option 1: Use Node.js 22+ which has native WebSocket support
401Option 2: Install and provide the "ws" package:
402
403  npm install ws
404
405  import ws from "ws"
406  const client = new RealtimeClient(url, {
407    ...options,
408    transport: ws
409  })`):new Error(`WebSocket not available: ${n}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,n){return this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,n)}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return n==="ok"&&t.teardown(),this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const t=this.channels.map(async r=>{const i=await r.unsubscribe();return r.teardown(),i}),n=await Promise.all(t);return this.disconnect(),n}log(t,n,r){this.socketAdapter.log(t,n,r)}connectionState(){return this.socketAdapter.connectionState()||Vy.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,n={config:{}}){const r=`realtime:${t}`,i=this.getChannels().find(s=>s.topic===r);if(i)return i;{const s=new Gh(`realtime:${t}`,n,this);return this.channels.push(s),s}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic)}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 s={access_token:n,version:C$};n&&i.updateJoinPayload(s),i.joinedOnce&&i.channelAdapter.isJoined()&&i.channelAdapter.push(jA.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)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(n=>{this.log("error","error waiting for auth on connect",n)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(t=>{t.ref&&t.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(t){return(n,r)=>{n=="sent"&&this._setAuthSafely(),t&&t(n,r)}}_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.disconnect()},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)}_workerObjectUrl(t){let n;if(t)n=t;else{const r=new Blob([i9],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_initializeOptions(t){var n,r,i,s,a,l,c,d,u;this.worker=(n=t==null?void 0:t.worker)!==null&&n!==void 0?n:!1,this.accessToken=(r=t==null?void 0:t.accessToken)!==null&&r!==void 0?r:null;const f={};
409f.timeout=(i=t==null?void 0:t.timeout)!==null&&i!==void 0?i:L$,f.heartbeatIntervalMs=(s=t==null?void 0:t.heartbeatIntervalMs)!==null&&s!==void 0?s:t9.HEARTBEAT_INTERVAL,f.transport=(a=t==null?void 0:t.transport)!==null&&a!==void 0?a:j$.getWebSocketConstructor(),f.params=t==null?void 0:t.params,f.logger=t==null?void 0:t.logger,f.heartbeatCallback=this._wrapHeartbeatCallback(t==null?void 0:t.heartbeatCallback),f.reconnectAfterMs=(l=t==null?void 0:t.reconnectAfterMs)!==null&&l!==void 0?l:g=>n9[g-1]||r9;let p,h;const x=(c=t==null?void 0:t.vsn)!==null&&c!==void 0?c:P$;switch(x){case A$:p=(g,b)=>b(JSON.stringify(g)),h=(g,b)=>b(JSON.parse(g));break;case SA:p=this.serializer.encode.bind(this.serializer),h=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${f.vsn}`)}if(f.vsn=x,f.encode=(d=t==null?void 0:t.encode)!==null&&d!==void 0?d:p,f.decode=(u=t==null?void 0:t.decode)!==null&&u!==void 0?u:h,f.beforeReconnect=this._reconnectAuth.bind(this),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,f.params=Object.assign(Object.assign({},f.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl,f.autoSendHeartbeat=!this.worker}return f}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var jf=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 o9(e,t,n){const r=new URL(t,e);if(n)for(const[i,s]of Object.entries(n))s!==void 0&&r.searchParams.set(i,s);return r.toString()}async function a9(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 l9(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:i,body:s,headers:a}){const l=o9(e.baseUrl,r,i),c=await a9(e.auth),d=await t(l,{method:n,headers:{...s?{"Content-Type":"application/json"}:{},...c,...a},body:s?JSON.stringify(s):void 0}),u=await d.text(),f=(d.headers.get("content-type")||"").includes("application/json"),p=f&&u?JSON.parse(u):u;if(!d.ok){const h=f?p:void 0,x=h==null?void 0:h.error;throw new jf((x==null?void 0:x.message)??`Request failed with status ${d.status}`,{status:d.status,icebergType:x==null?void 0:x.type,icebergCode:x==null?void 0:x.code,details:h})}return{status:d.status,headers:d.headers,data:p}}}}function vm(e){return e.join("�")}var c9=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:vm(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/${vm(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${vm(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${vm(e.namespace)}`}),!0}catch(t){if(t instanceof jf&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof jf&&n.status===409)return;throw n}}};function Xc(e){return e.join("�")}var d9=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/${Xc(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/${Xc(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/${Xc(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/${Xc(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/${Xc(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/${Xc(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof jf&&n.status===404)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof jf&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},u9=class{constructor(e){var r;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=l9({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(r=e.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new c9(this.client,t),this.tableOps=new d9(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)}
409async 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)}};function Ef(e){"@babel/helpers - typeof";return Ef=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},Ef(e)}function h9(e,t){if(Ef(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Ef(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function f9(e){var t=h9(e,"string");return Ef(t)=="symbol"?t:t+""}function p9(e,t,n){return(t=f9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vk(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 pt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Vk(Object(n),!0).forEach(function(r){p9(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Z0=class extends Error{constructor(e,t="storage",n,r){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=n,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function Q0(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var Jy=class extends Z0{constructor(e,t,n,r="storage"){super(e,r,t,n),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=n}toJSON(){return pt({},super.toJSON())}},PA=class extends Z0{constructor(e,t,n="storage"){super(e,n),this.name=n==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function g2(e,t,n){const r=pt({},e),i=t.toLowerCase();for(const s of Object.keys(r))s.toLowerCase()===i&&delete r[s];return r[i]=n,r}function m9(e){const t={};for(const[n,r]of Object.entries(e))t[n.toLowerCase()]=r;return t}const g9=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),x9=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)},Xy=e=>{if(Array.isArray(e))return e.map(n=>Xy(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,s=>s.toUpperCase().replace(/[-_]/g,""));t[i]=Xy(r)}),t},v9=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),Gk=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)},b9=async(e,t,n,r)=>{if(e!==null&&typeof e=="object"&&typeof e.json=="function"){const i=e;let s=parseInt(i.status,10);Number.isFinite(s)||(s=500),i.json().then(a=>{const l=(a==null?void 0:a.statusCode)||(a==null?void 0:a.code)||s+"";t(new Jy(Gk(a),s,l,r))}).catch(()=>{const a=s+"";t(new Jy(i.statusText||`HTTP ${s} error`,s,a,r))})}else t(new PA(Gk(e),e,r))},y9=(e,t,n,r)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!r)return pt(pt({},i),n);if(x9(r)){var s;const a=(t==null?void 0:t.headers)||{};let l;for(const[c,d]of Object.entries(a))c.toLowerCase()==="content-type"&&(l=d);i.headers=g2(a,"Content-Type",(s=l)!==null&&s!==void 0?s:"application/json"),i.body=JSON.stringify(r)}else i.body=r;return t!=null&&t.duplex&&(i.duplex=t.duplex),pt(pt({},i),n)};async function mh(e,t,n,r,i,s,a){return new Promise((l,c)=>{e(n,y9(t,r,i,s)).then(d=>{if(!d.ok)throw d;if(r!=null&&r.noResolveJson)return d;if(a==="vectors"){const u=d.headers.get("content-type");if(d.headers.get("content-length")==="0"||d.status===204)return{};if(!u||!u.includes("application/json"))return{}}return d.json()}).then(d=>l(d)).catch(d=>b9(d,c,r,a))})}function LA(e="storage"){return{get:async(t,n,r,i)=>mh(t,"GET",n,r,i,void 0,e),post:async(t,n,r,i,s)=>mh(t,"POST",n,i,s,r,e),put:async(t,n,r,i,s)=>mh(t,"PUT",n,i,s,r,e),head:async(t,n,r,i)=>mh(t,"HEAD",n,pt(pt({},r),{},{noResolveJson:!0}),i,void 0,e),remove:async(t,n,r,i,s)=>mh(t,"DELETE",n,i,s,r,e)}}const w9=LA("storage"),{get:Cf,post:ms,put:Zy,head:_9,remove:x2}=w9,Ri=LA("vectors");var Lu=class{constructor(e,t={},n,r="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=m9(t),this.fetch=g9(n),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=g2(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Q0(n))return{data:null,error:n};throw n}}},k9=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(Q0(t))return{data:null,error:t};throw t}}};let RA;RA=Symbol.toStringTag;var N9=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[RA]="BlobDownloadBuilder",this.promise=null}asStream(){return new k9(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(Q0(t))return{data:null,error:t};throw t}}};const S9={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Yk={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var j9=class extends Lu{constructor(e,t={},n,r){super(e,t,r,"storage"),this.bucketId=n}async uploadOrUpdate(e,t,n,r){var i=this;return i.handleOperation(async()=>{let s;const a=pt(pt({},Yk),r);let l=pt(pt({},i.headers),e==="POST"&&{"x-upsert":String(a.upsert)});const c=a.metadata;if(typeof Blob<"u"&&n instanceof Blob?(s=new FormData,s.append("cacheControl",a.cacheControl),c&&s.append("metadata",i.encodeMetadata(c)),s.append("",n)):typeof FormData<"u"&&n instanceof FormData?(s=n,s.has("cacheControl")||s.append("cacheControl",a.cacheControl),c&&!s.has("metadata")&&s.append("metadata",i.encodeMetadata(c))):(s=n,l["cache-control"]=`max-age=${a.cacheControl}`,l["content-type"]=a.contentType,c&&(l["x-metadata"]=i.toBase64(i.encodeMetadata(c))),(typeof ReadableStream<"u"&&s instanceof ReadableStream||s&&typeof s=="object"&&"pipe"in s&&typeof s.pipe=="function")&&!a.duplex&&(a.duplex="half")),r!=null&&r.headers)for(const[p,h]of Object.entries(r.headers))l=g2(l,p,h);const d=i._removeEmptyFolders(t),u=i._getFinalPath(d),f=await(e=="PUT"?Zy:ms)(i.fetch,`${i.url}/object/${u}`,s,pt({headers:l},a!=null&&a.duplex?{duplex:a.duplex}:{}));return{path:d,id:f.Id,fullPath:f.Key}})}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,r){var i=this;const s=i._removeEmptyFolders(e),a=i._getFinalPath(s),l=new URL(i.url+`/object/upload/sign/${a}`);return l.searchParams.set("token",t),i.handleOperation(async()=>{let c;const d=pt(pt({},Yk),r),u=pt(pt({},i.headers),{"x-upsert":String(d.upsert)});return typeof Blob<"u"&&n instanceof Blob?(c=new FormData,c.append("cacheControl",d.cacheControl),c.append("",n)):typeof FormData<"u"&&n instanceof FormData?(c=n,c.append("cacheControl",d.cacheControl)):(c=n,u["cache-control"]=`max-age=${d.cacheControl}`,u["content-type"]=d.contentType),{path:s,fullPath:(await Zy(i.fetch,l.toString(),c,{headers:u})).Key}})}async createSignedUploadUrl(e,t){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(e);const i=pt({},n.headers);t!=null&&t.upsert&&(i["x-upsert"]="true");const s=await ms(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:i}),a=new URL(n.url+s.url),l=a.searchParams.get("token");if(!l)throw new Z0("No token returned by API");return{signedUrl:a.toString(),path:e,token:l}})}async update(e,t,n){return this.uploadOrUpdate("PUT",e,t,n)}async move(e,t,n){var r=this;return r.handleOperation(async()=>await ms(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,de
409stinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers}))}async copy(e,t,n){var r=this;return r.handleOperation(async()=>({path:(await ms(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(e,t,n){var r=this;return r.handleOperation(async()=>{let i=r._getFinalPath(e);const s=typeof(n==null?void 0:n.transform)=="object"&&n.transform!==null&&Object.keys(n.transform).length>0;let a=await ms(r.fetch,`${r.url}/object/sign/${i}`,pt({expiresIn:t},s?{transform:n.transform}:{}),{headers:r.headers});const l=new URLSearchParams;n!=null&&n.download&&l.set("download",n.download===!0?"":n.download),(n==null?void 0:n.cacheNonce)!=null&&l.set("cacheNonce",String(n.cacheNonce));const c=l.toString();return{signedUrl:encodeURI(`${r.url}${a.signedURL}${c?`&${c}`:""}`)}})}async createSignedUrls(e,t,n){var r=this;return r.handleOperation(async()=>{const i=await ms(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:e},{headers:r.headers}),s=new URLSearchParams;n!=null&&n.download&&s.set("download",n.download===!0?"":n.download),(n==null?void 0:n.cacheNonce)!=null&&s.set("cacheNonce",String(n.cacheNonce));const a=s.toString();return i.map(l=>pt(pt({},l),{},{signedUrl:l.signedURL?encodeURI(`${r.url}${l.signedURL}${a?`&${a}`:""}`):null}))})}download(e,t,n){const r=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",i=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(i,t.transform),(t==null?void 0:t.cacheNonce)!=null&&i.set("cacheNonce",String(t.cacheNonce));const s=i.toString(),a=this._getFinalPath(e),l=()=>Cf(this.fetch,`${this.url}/${r}/${a}${s?`?${s}`:""}`,{headers:this.headers,noResolveJson:!0},n);return new N9(l,this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);return t.handleOperation(async()=>Xy(await Cf(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})))}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await _9(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(i){if(t.shouldThrowOnError)throw i;if(Q0(i)){var r;const s=i instanceof Jy?i.status:i instanceof PA?(r=i.originalError)===null||r===void 0?void 0:r.status:void 0;if(s!==void 0&&[400,404].includes(s))return{data:!1,error:i}}throw i}}getPublicUrl(e,t){const n=this._getFinalPath(e),r=new URLSearchParams;t!=null&&t.download&&r.set("download",t.download===!0?"":t.download),t!=null&&t.transform&&this.applyTransformOptsToQuery(r,t.transform),(t==null?void 0:t.cacheNonce)!=null&&r.set("cacheNonce",String(t.cacheNonce));const i=r.toString(),s=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${n}`)+(i?`?${i}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await x2(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,n){var r=this;return r.handleOperation(async()=>{const i=pt(pt(pt({},S9),t),{},{prefix:e||""});return await ms(r.fetch,`${r.url}/object/list/${r.bucketId}`,i,{headers:r.headers},n)})}async listV2(e,t){var n=this;return n.handleOperation(async()=>{const r=pt({},e);return await ms(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},t)})}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,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const E9="2.104.0",tp={"X-Client-Info":`storage-js/${E9}`};var C9=class extends Lu{constructor(e,t={},n,r){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."));const s=i.href.replace(/\/$/,""),a=pt(pt({},tp),t);super(s,a,n,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=t.listBucketOptionsToQueryString(e);return await Cf(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Cf(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var n=this;return n.handleOperation(async()=>await ms(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}))}async updateBucket(e,t){var n=this;return n.handleOperation(async()=>await Zy(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}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await ms(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await x2(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}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():""}},A9=class extends Lu{constructor(e,t={},n){const r=e.replace(/\/$/,""),i=pt(pt({},tp),t);super(r,i,n,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await ms(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{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 await Cf(t.fetch,i,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await x2(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!v9(e))throw new Z0("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 u9({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}
409),r=this.shouldThrowOnError;return new Proxy(n,{get(i,s){const a=i[s];return typeof a!="function"?a:async(...l)=>{try{return{data:await a.apply(i,l),error:null}}catch(c){if(r)throw c;return{data:null,error:c}}}}})}},P9=class extends Lu{constructor(e,t={},n){const r=e.replace(/\/$/,""),i=pt(pt({},tp),{},{"Content-Type":"application/json"},t);super(r,i,n,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await Ri.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var n=this;return n.handleOperation(async()=>await Ri.post(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await Ri.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var n=this;return n.handleOperation(async()=>await Ri.post(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{})}},L9=class extends Lu{constructor(e,t={},n){const r=e.replace(/\/$/,""),i=pt(pt({},tp),{},{"Content-Type":"application/json"},t);super(r,i,n,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await Ri.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await Ri.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return t.handleOperation(async()=>await Ri.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await Ri.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await Ri.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},R9=class extends Lu{constructor(e,t={},n){const r=e.replace(/\/$/,""),i=pt(pt({},tp),{},{"Content-Type":"application/json"},t);super(r,i,n,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Ri.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Ri.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await Ri.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Ri.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},T9=class extends R9{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new O9(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)}},O9=class extends P9{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,pt(pt({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,pt(pt({},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 I9(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},I9=class extends L9{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,pt(pt({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,pt(pt({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,pt(pt({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,pt(pt({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,pt(pt({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},D9=class extends C9{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new j9(this.url,this.headers,e,this.fetch)}get vectors(){return new T9(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new A9(this.url+"/iceberg",this.headers,this.fetch)}};const TA="2.104.0",xd=30*1e3,Qy=3,Av=Qy*xd,F9="http://localhost:9999",M9="supabase.auth.token",$9={"X-Client-Info":`gotrue-js/${TA}`},e1="X-Supabase-Api-Version",OA={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},B9=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,U9=10*60*1e3;
409class Af extends Error{constructor(t,n,r){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function Je(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class z9 extends Af{constructor(t,n,r){super(t,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function q9(e){return Je(e)&&e.name==="AuthApiError"}class ql extends Af{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class ta extends Af{constructor(t,n,r,i){super(t,r,i),this.name=n,this.status=r}}class Ci extends ta{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function bm(e){return Je(e)&&e.name==="AuthSessionMissingError"}class Zc extends ta{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class ym extends ta{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class wm extends ta{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function W9(e){return Je(e)&&e.name==="AuthImplicitGrantRedirectError"}class Kk extends ta{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class H9 extends ta{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 t1 extends ta{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function Pv(e){return Je(e)&&e.name==="AuthRetryableFetchError"}class Jk extends ta{constructor(t,n,r){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class n1 extends ta{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const s0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Xk=` 	
410\r=`.split(""),V9=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<Xk.length;t+=1)e[Xk[t].charCodeAt(0)]=-2;for(let t=0;t<s0.length;t+=1)e[s0[t].charCodeAt(0)]=t;return e})();function Zk(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(s0[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(s0[r]),t.queuedBits-=6}}function IA(e,t,n){const r=V9[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 Qk(e){const t=[],n=a=>{t.push(String.fromCodePoint(a))},r={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},s=a=>{K9(a,r,n)};for(let a=0;a<e.length;a+=1)IA(e.charCodeAt(a),i,s);return t.join("")}function G9(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 Y9(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}G9(r,t)}}function K9(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 Wd(e){const t=[],n={queue:0,queuedBits:0},r=i=>{t.push(i)};for(let i=0;i<e.length;i+=1)IA(e.charCodeAt(i),n,r);return new Uint8Array(t)}function J9(e){const t=[];return Y9(e,n=>t.push(n)),new Uint8Array(t)}function Kl(e){const t=[],n={queue:0,queuedBits:0},r=i=>{t.push(i)};return e.forEach(i=>
410Zk(i,n,r)),Zk(null,n,r),t.join("")}function X9(e){return Math.round(Date.now()/1e3)+e}function Z9(){return Symbol("auth-callback")}const Sr=()=>typeof window<"u"&&typeof document<"u",Ol={tested:!1,writable:!1},DA=()=>{if(!Sr())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Ol.tested)return Ol.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Ol.tested=!0,Ol.writable=!0}catch{Ol.tested=!0,Ol.writable=!1}return Ol.writable};function Q9(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((i,s)=>{t[s]=i})}catch{}return n.searchParams.forEach((r,i)=>{t[i]=r}),t}const FA=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),eB=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",vd=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},Il=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},kr=async(e,t)=>{await e.removeItem(t)};class ex{constructor(){this.promise=new ex.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}ex.promiseConstructor=Promise;function _m(e){const t=e.split(".");if(t.length!==3)throw new n1("Invalid JWT structure");for(let r=0;r<t.length;r++)if(!B9.test(t[r]))throw new n1("JWT not in base64url format");return{header:JSON.parse(Qk(t[0])),payload:JSON.parse(Qk(t[1])),signature:Wd(t[2]),raw:{header:t[0],payload:t[1]}}}async function tB(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function nB(e,t){return new Promise((r,i)=>{(async()=>{for(let s=0;s<1/0;s++)try{const a=await e(s);if(!t(s,null,a)){r(a);return}}catch(a){if(!t(s,a)){i(a);return}}})()})}function rB(e){return("0"+e.toString(16)).substr(-2)}function iB(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let i="";for(let s=0;s<56;s++)i+=n.charAt(Math.floor(Math.random()*r));return i}return crypto.getRandomValues(t),Array.from(t,rB).join("")}async function sB(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),i=new Uint8Array(r);return Array.from(i).map(s=>String.fromCharCode(s)).join("")}async function oB(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 sB(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Qc(e,t,n=!1){const r=iB();let i=r;n&&(i+="/PASSWORD_RECOVERY"),await vd(e,`${t}-code-verifier`,i);const s=await oB(r);return[s,r===s?"plain":"s256"]}const aB=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function lB(e){const t=e.headers.get(e1);if(!t||!t.match(aB))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function cB(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 dB(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 uB=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ed(e){if(!uB.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Lv(){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 hB(e,t){return new Proxy(e,{get:(n,r,i)=>{if(r==="__isInsecureUserWarningProxy")return!0;
410if(typeof r=="symbol"){const s=r.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)"||s==="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 eN(e){return JSON.parse(JSON.stringify(e))}const Bl=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),fB=[502,503,504,520,521,522,523,524,530];async function tN(e){var t;if(!eB(e))throw new t1(Bl(e),0);if(fB.includes(e.status))throw new t1(Bl(e),e.status);let n;try{n=await e.json()}catch(s){throw new ql(Bl(s),s)}let r;const i=lB(e);if(i&&i.getTime()>=OA["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 Jk(Bl(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(r==="session_not_found")throw new Ci}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((s,a)=>s&&typeof a=="string",!0))throw new Jk(Bl(n),e.status,n.weak_password.reasons);throw new z9(Bl(n),e.status||500,r)}const pB=(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 ut(e,t,n,r){var i;const s=Object.assign({},r==null?void 0:r.headers);s[e1]||(s[e1]=OA["2024-01-01"].name),r!=null&&r.jwt&&(s.Authorization=`Bearer ${r.jwt}`);const a=(i=r==null?void 0:r.query)!==null&&i!==void 0?i:{};r!=null&&r.redirectTo&&(a.redirect_to=r.redirectTo);const l=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",c=await mB(e,t,n+l,{headers:s,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 mB(e,t,n,r,i,s){const a=pB(t,r,i,s);let l;try{l=await e(n,Object.assign({},a))}catch(c){throw console.error(c),new t1(Bl(c),0)}if(l.ok||await tN(l),r!=null&&r.noResolveJson)return l;try{return await l.json()}catch(c){await tN(c)}}function hs(e){var t;let n=null;vB(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=X9(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:r},error:null}}function nN(e){const t=hs(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 Ra(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function gB(e){return{data:e,error:null}}function xB(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:i,verification_type:s}=e,a=X0(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:s},c=Object.assign({},a);return{data:{properties:l,user:c},error:null}}function rN(e){return e}function vB(e){return e.access_token&&e.refresh_token&&e.expires_in}const Rv=["global","local","others"];class bB{constructor({url:t="",headers:n={},fetch:r}){this.url=t,this.headers=n,this.fetch=FA(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)}}async signOut(t,n=Rv[0]){if(Rv.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Rv.join(", ")}`);try{return await ut(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(r){if(Je(r))return{data:null,error:r};throw r}}async inviteUserByEmail(t,n={}){try{return await ut(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Ra})}catch(r){if(Je(r))return{data:{user:null},error:r};throw r}}async generateLink(t){try{const{options:n}=t,r=X0(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 ut(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:xB,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(Je(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await ut(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Ra})}catch(n){if(Je(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,r,i,s,a,l,c;try{const d={nextPage:null,lastPage:0,total:0},u=await ut(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:(s=(i=t==null?void 0:t.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:rN});if(u.error)throw u.error;const f=await u.json(),p=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,h=(c=(l=u.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return h.length>
4100&&(h.forEach(x=>{const g=parseInt(x.split(";")[0].split("=")[1].substring(0,1)),b=JSON.parse(x.split(";")[1].split("=")[1]);d[`${b}Page`]=g}),d.total=parseInt(p)),{data:Object.assign(Object.assign({},f),d),error:null}}catch(d){if(Je(d))return{data:{users:[]},error:d};throw d}}async getUserById(t){ed(t);try{return await ut(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Ra})}catch(n){if(Je(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){ed(t);try{return await ut(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:Ra})}catch(r){if(Je(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,n=!1){ed(t);try{return await ut(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:Ra})}catch(r){if(Je(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){ed(t.userId);try{const{data:n,error:r}=await ut(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(Je(n))return{data:null,error:n};throw n}}async _deleteFactor(t){ed(t.userId),ed(t.id);try{return{data:await ut(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(Je(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,r,i,s,a,l,c;try{const d={nextPage:null,lastPage:0,total:0},u=await ut(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:(s=(i=t==null?void 0:t.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:rN});if(u.error)throw u.error;const f=await u.json(),p=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,h=(c=(l=u.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return h.length>0&&(h.forEach(x=>{const g=parseInt(x.split(";")[0].split("=")[1].substring(0,1)),b=JSON.parse(x.split(";")[1].split("=")[1]);d[`${b}Page`]=g}),d.total=parseInt(p)),{data:Object.assign(Object.assign({},f),d),error:null}}catch(d){if(Je(d))return{data:{clients:[]},error:d};throw d}}async _createOAuthClient(t){try{return await ut(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Je(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await ut(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Je(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await ut(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Je(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(t){try{return await ut(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Je(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await ut(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Je(n))return{data:null,error:n};throw n}}async _listCustomProviders(t){try{const n={};return t!=null&&t.type&&(n.type=t.type),await ut(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:r=>{var i;return{data:{providers:(i=r==null?void 0:r.providers)!==null&&i!==void 0?i:[]},error:null}}})}catch(n){if(Je(n))return{data:{providers:[]},error:n};throw n}}async _createCustomProvider(t){try{return await ut(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Je(n))return{data:null,error:n};throw n}}async _getCustomProvider(t){try{return await ut(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Je(n))return{data:null,error:n};throw n}}async _updateCustomProvider(t,n){try{return await ut(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Je(r))return{data:null,error:r};throw r}}async _deleteCustomProvider(t){try{return await ut(this.fetch,"DELET
410E",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Je(n))return{data:null,error:n};throw n}}}function iN(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const zs={debug:!!(globalThis&&DA()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class MA extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class sN extends MA{}async function yB(e,t,n){zs.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;let i;t>0&&(i=setTimeout(()=>{r.abort(),zs.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t)),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async s=>{if(s){clearTimeout(i),zs.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,s.name);try{return await n()}finally{zs.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,s.name)}}else{if(t===0)throw zs.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new sN(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(zs.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"),clearTimeout(i),await n()}})}catch(s){if(t>0&&clearTimeout(i),(s==null?void 0:s.name)==="AbortError"&&t>0){if(r.signal.aborted)return zs.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:"exclusive",steal:!0},async a=>{if(a){zs.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,a.name);try{return await n()}finally{zs.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,a.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await n()}));throw zs.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new sN(`Lock "${e}" was released because another request stole it`)}throw s}}function wB(){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 $A(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function _B(e){return parseInt(e,16)}function kB(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function NB(e){var t;const{chainId:n,domain:r,expirationTime:i,issuedAt:s=new Date,nonce:a,notBefore:l,requestId:c,resources:d,scheme:u,uri:f,version:p}=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(a&&a.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!f)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(p!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${p}`);
410if(!((t=e.statement)===null||t===void 0)&&t.includes(`
411`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const h=$A(e.address),x=u?`${u}://${r}`:r,g=e.statement?`${e.statement}
412`:"",b=`${x} wants you to sign in with your Ethereum account:
413${h}
414
415${g}`;let y=`URI: ${f}
416Version: ${p}
417Chain ID: ${n}${a?`
418Nonce: ${a}`:""}
419Issued At: ${s.toISOString()}`;if(i&&(y+=`
420Expiration Time: ${i.toISOString()}`),l&&(y+=`
421Not Before: ${l.toISOString()}`),c&&(y+=`
422Request ID: ${c}`),d){let _=`
423Resources:`;for(const w of d){if(!w||typeof w!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${w}`);_+=`
424- ${w}`}y+=_}return`${b}
425${y}`}class Zn extends Error{constructor({message:t,code:n,cause:r,name:i}){var s;super(t,{cause:r}),this.__isWebAuthnError=!0,this.name=(s=i??(r instanceof Error?r.name:void 0))!==null&&s!==void 0?s:"Unknown Error",this.code=n}}class o0 extends Zn{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function SB({error:e,options:t}){var n,r,i;const{publicKey:s}=t;if(!s)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Zn({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=s.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Zn({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=s.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new Zn({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=s.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new Zn({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 Zn({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Zn({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return s.pubKeyCredParams.filter(l=>l.type==="public-key").length===0?new Zn({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Zn({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 a=window.location.hostname;if(BA(a)){if(s.rp.id!==a)return new Zn({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Zn({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new Zn({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 Zn({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 Zn({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function jB({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 Zn({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Zn({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const r=window.location.hostname;if(BA(r)){if(n.rpId!==r)return new Zn({message:`The RP ID "${n.rpId}
425" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Zn({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Zn({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 Zn({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class EB{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 CB=new EB;function AB(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=X0(e,["challenge","user","excludeCredentials"]),s=Wd(t).buffer,a=Object.assign(Object.assign({},n),{id:Wd(n.id).buffer}),l=Object.assign(Object.assign({},i),{challenge:s,user:a});if(r&&r.length>0){l.excludeCredentials=new Array(r.length);for(let c=0;c<r.length;c++){const d=r[c];l.excludeCredentials[c]=Object.assign(Object.assign({},d),{id:Wd(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return l}function PB(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=X0(e,["challenge","allowCredentials"]),i=Wd(t).buffer,s=Object.assign(Object.assign({},r),{challenge:i});if(n&&n.length>0){s.allowCredentials=new Array(n.length);for(let a=0;a<n.length;a++){const l=n[a];s.allowCredentials[a]=Object.assign(Object.assign({},l),{id:Wd(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return s}function LB(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:Kl(new Uint8Array(e.response.attestationObject)),clientDataJSON:Kl(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function RB(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:Kl(new Uint8Array(i.authenticatorData)),clientDataJSON:Kl(new Uint8Array(i.clientDataJSON)),signature:Kl(new Uint8Array(i.signature)),userHandle:i.userHandle?Kl(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function BA(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function oN(){var e,t;return!!(Sr()&&"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 TB(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new o0("Browser returned unexpected credential type",t)}:{data:null,error:new o0("Empty credential response",t)}}catch(t){return{data:null,error:SB({error:t,options:e})}}}async function OB(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new o0("Browser returned unexpected credential type",t)}:{data:null,error:new o0("Empty credential response",t)}}
425catch(t){return{data:null,error:jB({error:t,options:e})}}}const IB={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},DB={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function a0(...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 s in i){const a=i[s];if(a!==void 0)if(Array.isArray(a))r[s]=a;else if(n(a))r[s]=a;else if(t(a)){const l=r[s];t(l)?r[s]=a0(l,a):r[s]=a0(a)}else r[s]=a}return r}function FB(e,t){return a0(IB,e,t||{})}function MB(e,t){return a0(DB,e,t||{})}class $B{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},s){var a;try{const{data:l,error:c}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!l)return{data:null,error:c};const d=i??CB.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:u}=l.webauthn.credential_options.publicKey;if(!u.name){const f=r;if(f)u.name=`${u.id}:${f}`;else{const h=(await this.client.getUser()).data.user,x=((a=h==null?void 0:h.user_metadata)===null||a===void 0?void 0:a.name)||(h==null?void 0:h.email)||(h==null?void 0:h.id)||"User";u.name=`${u.id}:${x}`}}u.displayName||(u.displayName=u.name)}switch(l.webauthn.type){case"create":{const u=FB(l.webauthn.credential_options.publicKey,s==null?void 0:s.create),{data:f,error:p}=await TB({publicKey:u,signal:d});return f?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:f}},error:null}:{data:null,error:p}}case"request":{const u=MB(l.webauthn.credential_options.publicKey,s==null?void 0:s.request),{data:f,error:p}=await OB(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:u,signal:d}));return f?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:f}},error:null}:{data:null,error:p}}}}catch(l){return Je(l)?{data:null,error:l}:{data:null,error:new ql("Unexpected error in challenge",l)}}}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}={}},s){if(!n)return{data:null,error:new Af("rpId is required for WebAuthn authentication")};try{if(!oN())return{data:null,error:new ql("Browser does not support WebAuthn",null)};const{data:a,error:l}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:r},signal:i},{request:s});if(!a)return{data:null,error:l};const{webauthn:c}=a;return this._verify({factorId:t,challengeId:a.challengeId,webauthn:{type:c.type,rpId:n,rpOrigins:r,credential_response:c.credential_response}})}catch(a){return Je(a)?{data:null,error:a}:{data:null,error:new ql("Unexpected error in authenticate",a)}}}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}={}},s){if(!n)return{data:null,error:new Af("rpId is required for WebAuthn registration")};try{if(!oN())return{data:null,error:new ql("Browser does not support WebAuthn",null)};const{data:a,error:l}=await this._enroll({friendlyName:t});if(!a)return await this.client.mfa.listFactors().then(u=>{var f;return(f=u.data)===null||f===void 0?void 0:f.all.find(p=>p.factor_type==="webauthn"&&p.friendly_name===t&&p.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:l};const{data:c,error:d}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:i},{create:s});return c?this._verify({factorId:a.id,challengeId:c.challengeId,webauthn:{rpId:n,rpOrigins:r,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:d}}catch(a){return Je(a)?{data:null,error:a}:{data:null,error:new ql("Unexpected error in register",a)}}}}wB();const BB={url:F9,storageKey:M9,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:$9,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1};async function aN(e,t,n){return await n()}const td={};class Pf{get jwks(){var t,n;return(n=(t=td[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){td[this.storageKey]=Object.assign(Object.assign({},td[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=td[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){td[this.storageKey]=Object.assign(Object.assign({},td[this.storageKey]),{cachedAt:t})}constructor(t){var n,r,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const s=Object.assign(Object.assign({},BB),t);if(this.storageKey=s.storageKey,this.instanceID=(n=Pf.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,Pf.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.instanceID>0&&Sr()){const a=`${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(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=s.persistSession,this.autoRefreshToken=s.autoRefreshToken,this.admin=new bB({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=FA(s.fetch),this.lock=s.lock||aN,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,this.throwOnError=s.throwOnError,this.lockAcquireTimeout=s.lockAcquireTimeout,s.lock?this.lock=s.lock:this.persistSession&&Sr()&&(!((r=globalThis==null?void 0:globalThis.navigator)===null||r===void 0)&&r.locks)?this.lock=yB:this.lock=aN,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 $B(this)}
425,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?(s.storage?this.storage=s.storage:DA()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=iN(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=iN(this.memoryStorage)),Sr()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a);try{await this._notifyAllSubscribers(a.data.event,a.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}s.skipAutoInitialize||this.initialize().catch(a=>{this._debug("#initialize()","error",a)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${TA}) ${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(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{let n={},r="none";if(Sr()&&(n=Q9(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),Sr()&&this.detectSessionInUrl&&r!=="none"){const{data:i,error:s}=await this._getSessionFromURL(n,r);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),W9(s)){const c=(t=s.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:s}}return{error:s}}const{session:a,redirectType:l}=i;return this._debug("#_initialize()","detected session in URL",a,"redirect type",l),await this._saveSession(a),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return Je(n)?this._returnResult({error:n}):this._returnResult({error:new ql("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,r,i;try{const s=await ut(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:hs}),{data:a,error:l}=s;if(l||!a)return this._returnResult({data:{user:null,session:null},error:l});const c=a.session,d=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:d,session:c},error:null})}catch(s){if(Je(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(t){var n,r,i;try{let s;if("email"in t){const{email:u,password:f,options:p}=t;let h=null,x=null;this.flowType==="pkce"&&([h,x]=await Qc(this.storage,this.storageKey)),s=await ut(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:p==null?void 0:p.emailRedirectTo,body:{email:u,password:f,data:(n=p==null?void 0:p.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:p==null?void 0:p.captchaToken},code_challenge:h,code_challenge_method:x},xform:hs})}else if("phone"in t){const{phone:u,password:f,options:p}=t;s=await ut(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:f,data:(r=p==null?void 0:p.data)!==null&&r!==void 0?r:{},channel:(i=p==null?void 0:p.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:p==null?void 0:p.captchaToken}},xform:hs})}else throw new ym("You must provide either an email or phone number and a password");const{data:a,error:l}=s;if(l||!a)return await kr(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:l});const c=a.session,d=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:d,session:c},error:null})}catch(s){if(await kr(this.storage,`${this.storageKey}-code-verifier`),Je(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(t){try{let n;if("email"in t){const{email:s,password:a,options:l}=t;n=await ut(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:a,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:nN})}else if("phone"in t){const{phone:s,password:a,options:l}=t;n=await ut(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:a,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:nN})}else throw new ym("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 s=new Zc;return this._returnResult({data:{user:null,session:null},error:s})}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(Je(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(t){var n,r,i,s;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:(s=t.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,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,s,a,l,c,d,u,f,p;let h,x;if("message"in t)h=t.message,x=t.signature;else{const{chain:g,wallet:b,statement:y,options:_}=t;let w;if(Sr())if(typeof b=="object")w=b;else{const T=window;if("ethereum"in T&&typeof T.ethereum=="object"&&"request"in T.ethereum&&typeof T.ethereum.request=="function")w=T.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.");w=b}const S=new URL((n=_==null?void 0:_.url)!==null&&n!==void 0?n:window.location.href),C=await w.request({method:"eth_requestAccounts"}).then(T=>T).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!C||C.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const P=$A(C[0]);let R=(r=_==null?void 0:_.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!R){const T=await w.request({method:"eth_chainId"});R=_B(T)}const M={domain:S.host,address:P,statement:y,uri:S.href,version:"1",chainId:R,nonce:(i=_==null?void 0:_.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(a=(s=_==null?void 0:_.signInWithEthereum)===null||s===void 0?void 0:s.issuedAt)!==null&&a!==void 0?a: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:(d=_==null?void 0:_.signInWithEthereum)===null||d===void 0?void 0:d.requestId,resources:(u=_==null?void 0:_.signInWithEthereum)===null||u===void 0?void 0:u.resources};h=NB(M),x=await w.request({method:"personal_sign",params:[kB(h),P]})}try{const{data:g,error:b}=await ut(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:h,signature:x},!((f=t.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(p=t.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:hs});if(b)throw b;if(!g||!g.session||!g.user){const y=new Zc;return this._returnResult({data:{user:null,session:null},error:y})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:Object.assign({},g),error:b})}catch(g){if(Je(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}}async signInWithSolana(t){var n,r,i,s,a,l,c,d,u,f,p,h;let x,g;if("message"in t)x=t.message,g=t.signature;else{const{chain:b,wallet:y,statement:_,options:w}=t;let S;if(Sr())if(typeof y=="object")S=y;else{const P=window;if("solana"in P&&typeof P.solana=="object"&&("signIn"in P.solana&&typeof P.solana.signIn=="function"||"signMessage"in P.solana&&typeof P.solana.signMessage=="function"))S=P.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 y!="object"||!(w!=null&&w.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");S=y}const C=new URL((n=w==null?void 0:w.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in S&&S.signIn){const P=await S.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},w==null?void 0:w.signInWithSolana),{version:"1",domain:C.host,uri:C.href}),_?{statement:_}:null));let R;if(Array.isArray(P)&&P[0]&&typeof P[0]=="object")R=P[0];else if(P&&typeof P=="object"&&"signedMessage"in P&&"signature"in P)R=P;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in R&&"signature"in R&&(typeof R.signedMessage=="string"||R.signedMessage instanceof Uint8Array)&&R.signature instanceof Uint8Array)x=typeof R.signedMessage=="string"?R.signedMessage:new TextDecoder().decode(R.signedMessage),g=R.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in S)||typeof S.signMessage!="function"||!("publicKey"in S)||typeof S!="object"||!S.publicKey||!("toBase58"in S.publicKey)||typeof S.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");x=[`${C.host} wants you to sign in with your Solana account:`,S.publicKey.toBase58(),..._?["",_,""]:[""],"Version: 1",`URI: ${C.href}`,`Issued At: ${(i=(r=w==null?void 0:w.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((s=w==null?void 0:w.signInWithSolana)===null||s===void 0)&&s.notBefore?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...!((a=w==null?void 0:w.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...!((l=w==null?void 0:w.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...!((c=w==null?void 0:w.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...!((d=w==null?void 0:w.signInWithSolana)===null||d===void 0)&&d.requestId?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...!((f=(u=w==null?void 0:w.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||f===void 0)&&f.length?["Resources",...w.sign
425InWithSolana.resources.map(R=>`- ${R}`)]:[]].join(`
426`);const P=await S.signMessage(new TextEncoder().encode(x),"utf8");if(!P||!(P instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=P}}try{const{data:b,error:y}=await ut(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:x,signature:Kl(g)},!((p=t.options)===null||p===void 0)&&p.captchaToken?{gotrue_meta_security:{captcha_token:(h=t.options)===null||h===void 0?void 0:h.captchaToken}}:null),xform:hs});if(y)throw y;if(!b||!b.session||!b.user){const _=new Zc;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:y})}catch(b){if(Je(b))return this._returnResult({data:{user:null,session:null},error:b});throw b}}async _exchangeCodeForSession(t){const n=await Il(this.storage,`${this.storageKey}-code-verifier`),[r,i]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new H9;const{data:s,error:a}=await ut(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:r},xform:hs});if(await kr(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!s||!s.session||!s.user){const l=new Zc;return this._returnResult({data:{user:null,session:null,redirectType:null},error:l})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign(Object.assign({},s),{redirectType:i??null}),error:a})}catch(s){if(await kr(this.storage,`${this.storageKey}-code-verifier`),Je(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(t){try{const{options:n,provider:r,token:i,access_token:s,nonce:a}=t,l=await ut(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:i,access_token:s,nonce:a,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:hs}),{data:c,error:d}=l;if(d)return this._returnResult({data:{user:null,session:null},error:d});if(!c||!c.session||!c.user){const u=new Zc;return this._returnResult({data:{user:null,session:null},error:u})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:c,error:d})}catch(n){if(Je(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(t){var n,r,i,s,a;try{if("email"in t){const{email:l,options:c}=t;let d=null,u=null;this.flowType==="pkce"&&([d,u]=await Qc(this.storage,this.storageKey));const{error:f}=await ut(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:d,code_challenge_method:u},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:d,error:u}=await ut(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:(s=c==null?void 0:c.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(a=c==null?void 0:c.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:d==null?void 0:d.message_id},error:u})}throw new ym("You must provide either an email or phone number.")}catch(l){if(await kr(this.storage,`${this.storageKey}-code-verifier`),Je(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async verifyOtp(t){var n,r;try{let i,s;"options"in t&&(i=(n=t.options)===null||n===void 0?void 0:n.redirectTo,s=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:a,error:l}=await ut(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:s}}),redirectTo:i,xform:hs});if(l)throw l;if(!a)throw new Error("An error occurred on token verification.");const c=a.session,d=a.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:d,session:c},error:null})}catch(i){if(Je(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(t){var n,r,i,s,a;try{let l=null,c=null;this.flowType==="pkce"&&([l,c]=await Qc(this.storage,this.storageKey));const d=await ut(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:gB});return!((s=d.data)===null||s===void 0)&&s.url&&Sr()&&!(!((a=t.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(d.data.url),this._returnResult(d)}catch(l){if(await kr(this.storage,`${this.storageKey}-code-verifier`),Je(l))return this._returnResult({data:null,error:l});throw l}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,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 Ci;const{error:i}=await ut(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(Je(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:s}=t,{error:a}=await ut(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:i,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},redirectTo:s==null?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:a})}else if("phone"in t){const{phone:r,type:i,options:s}=t,{data:a,error:l}=await ut(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:i,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a==null?void 0:a.message_id},error:l})}throw new ym("You must provide either an email or phone number and a type")}catch(n){if(Je(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,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 Il(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
426id"),await this._removeSession())),!t)return{data:{session:null},error:null};const r=t.expires_at?t.expires_at*1e3-Date.now()<Av:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r){if(this.userStorage){const a=await Il(this.userStorage,this.storageKey+"-user");a!=null&&a.user?t.user=a.user:t.user=Lv()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};t.user=hB(t.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:i,error:s}=await this._callRefreshToken(t.refresh_token);return s?this._returnResult({data:{session:null},error:s}):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(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(t){try{return t?await ut(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:Ra}):await this._useSession(async n=>{var r,i,s;const{data:a,error:l}=n;if(l)throw l;return!(!((r=a.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Ci}:await ut(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(i=a.session)===null||i===void 0?void 0:i.access_token)!==null&&s!==void 0?s:void 0,xform:Ra})})}catch(n){if(Je(n))return bm(n)&&(await this._removeSession(),await kr(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(this.lockAcquireTimeout,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async r=>{const{data:i,error:s}=r;if(s)throw s;if(!i.session)throw new Ci;const a=i.session;let l=null,c=null;this.flowType==="pkce"&&t.email!=null&&([l,c]=await Qc(this.storage,this.storageKey));const{data:d,error:u}=await ut(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:a.access_token,xform:Ra});if(u)throw u;return a.user=d.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(r){if(await kr(this.storage,`${this.storageKey}-code-verifier`),Je(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new Ci;const n=Date.now()/1e3;let r=n,i=!0,s=null;const{payload:a}=_m(t.access_token);if(a.exp&&(r=a.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};s=l}else{const{data:l,error:c}=await this._getUser(t.access_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});s={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(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(n){if(Je(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var r;if(!t){const{data:a,error:l}=n;if(l)throw l;t=(r=a.session)!==null&&r!==void 0?r:void 0}if(!(t!=null&&t.refresh_token))throw new Ci;const{data:i,error:s}=await this._callRefreshToken(t.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(Je(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(t,n){try{if(!Sr())throw new wm("No browser detected.");
426if(t.error||t.error_description||t.error_code)throw new wm(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 Kk("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new wm("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 Kk("No code detected.");const{data:_,error:w}=await this._exchangeCodeForSession(t.code);if(w)throw w;const S=new URL(window.location.href);return S.searchParams.delete("code"),window.history.replaceState(window.history.state,"",S.toString()),{data:{session:_.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:s,refresh_token:a,expires_in:l,expires_at:c,token_type:d}=t;if(!s||!l||!a||!d)throw new wm("No session defined in URL");const u=Math.round(Date.now()/1e3),f=parseInt(l);let p=u+f;c&&(p=parseInt(c));const h=p-u;h*1e3<=xd&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${h}s, should have been closer to ${f}s`);const x=p-f;u-x>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",x,p,u):u-x<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",x,p,u);const{data:g,error:b}=await this._getUser(s);if(b)throw b;const y={provider_token:r,provider_refresh_token:i,access_token:s,expires_in:f,expires_at:p,refresh_token:a,token_type:d,user:g.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:y,redirectType:t.type},error:null})}catch(r){if(Je(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 Il(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:i,error:s}=n;if(s&&!bm(s))return this._returnResult({error:s});const a=(r=i.session)===null||r===void 0?void 0:r.access_token;if(a){const{error:l}=await this.admin.signOut(a,t);if(l&&!(q9(l)&&(l.status===404||l.status===401||l.status===403)||bm(l)))return this._returnResult({error:l})}return t!=="others"&&(await this._removeSession(),await kr(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const n=Z9(),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(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async n=>{var r,i;try{const{data:{session:s},error:a}=n;if(a)throw a;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",t,"session",s)}catch(s){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",s),bm(s)?console.warn(s):console.error(s)}})}async resetPasswordForEmail(t,n={}){let r=null,i=null;this.flowType==="pkce"&&([r,i]=await Qc(this.storage,this.storageKey,!0));try{return await ut(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(s){if(await kr(this.storage,`${this.storageKey}-code-verifier`),Je(s))return this._returnResult({data:null,error:s});throw s}}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(Je(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 s=>{var a,l,c,d,u;const{data:f,error:p}=s;if(p)throw p;const h=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(a=t.options)===null||a===void 0?void 0:a.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 ut(this.fetch,"GET",h,{headers:this.headers,jwt:(u=(d=f.session)===null||d===void 0?void 0:d.access_token)!==null&&u!==void 0?u:void 0})});if(i)throw i;return Sr()&&!(!((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(Je(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:s}}=n;
426if(i)throw i;const{options:a,provider:l,token:c,access_token:d,nonce:u}=t,f=await ut(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=s==null?void 0:s.access_token)!==null&&r!==void 0?r:void 0,body:{provider:l,id_token:c,access_token:d,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:hs}),{data:p,error:h}=f;return h?this._returnResult({data:{user:null,session:null},error:h}):!p||!p.session||!p.user?this._returnResult({data:{user:null,session:null},error:new Zc}):(p.session&&(await this._saveSession(p.session),await this._notifyAllSubscribers("USER_UPDATED",p.session)),this._returnResult({data:p,error:h}))}catch(i){if(await kr(this.storage,`${this.storageKey}-code-verifier`),Je(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:s,error:a}=n;if(a)throw a;return await ut(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(i=(r=s.session)===null||r===void 0?void 0:r.access_token)!==null&&i!==void 0?i:void 0})})}catch(n){if(Je(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 nB(async i=>(i>0&&await tB(200*Math.pow(2,i-1)),this._debug(n,"refreshing attempt",i),await ut(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:hs})),(i,s)=>{const a=200*Math.pow(2,i);return s&&Pv(s)&&Date.now()+a-r<xd})}catch(r){if(this._debug(n,"error",r),Je(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),Sr()&&!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 Il(this.storage,this.storageKey);if(i&&this.userStorage){let a=await Il(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:i.user},await vd(this.userStorage,this.storageKey+"-user",a)),i.user=(t=a==null?void 0:a.user)!==null&&t!==void 0?t:Lv()}else if(i&&!i.user&&!i.user){const a=await Il(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(i.user=a.user,await kr(this.storage,this.storageKey+"-user"),await vd(this.storage,this.storageKey,i)):i.user=Lv()}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 s=((n=i.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<Av;if(this._debug(r,`session has${s?"":" not"} expired with margin of ${Av}s`),s){if(this.autoRefreshToken&&i.refresh_token){const{error:a}=await this._callRefreshToken(i.refresh_token);a&&(console.error(a),Pv(a)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{const{data:a,error:l}=await this._getUser(i.access_token);!l&&(a!=null&&a.user)?(i.user=a.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(r,"error getting user data, skipping SIGNED_IN notification",a)}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 Ci;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const i=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new ex;const{data:s,error:a}=await this._refreshAccessToken(t);if(a)throw a;if(!s.session)throw new Ci;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);const l={data:s.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(s){if(this._debug(i,"error",s),Je(s)){const a={data:null,error:s};return Pv(s)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(a),a}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(s),s}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 s=[],a=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(t,n)}catch(c){s.push(c)}});if(await Promise.all(a),s.length>0){for(let l=0;l<s.length;l+=1)console.error(s[l]);throw s[0]}}finally{this._debug(i,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await kr(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 vd(this.userStorage,this.storageKey+"-user",{user:n.user});const i=Object.assign({},n);delete i.user;const s=eN(i);await vd(this.storage,this.storageKey,s)}else{const i=eN(n);await vd(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await kr(this.storage,this.storageKey),await kr(this.storage,this.storageKey+"-code-verifier"),await kr(this.storage,this.storageKey+"-user"),this.userStorage&&await kr(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Sr()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}
426catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),xd);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}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}
426const i=Math.floor((r.expires_at*1e3-t)/xd);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${xd}ms, refresh threshold is ${Qy} ticks`),i<=Qy&&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 MA)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Sr()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},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(this.lockAcquireTimeout,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[s,a]=await Qc(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(a)}`});i.push(l.toString())}if(r!=null&&r.queryParams){const s=new URLSearchParams(r.queryParams);i.push(s.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:s}=n;return s?this._returnResult({data:null,error:s}):await ut(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(Je(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:s,error:a}=n;if(a)return this._returnResult({data:null,error:a});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:d}=await ut(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});return d?this._returnResult({data:null,error:d}):(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(Je(n))return this._returnResult({data:null,error:n});throw n}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:s}=n;if(s)return this._returnResult({data:null,error:s});const a=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?LB(t.webauthn.credential_response):RB(t.webauthn.credential_response)})}:{code:t.code}),{data:l,error:c}=await ut(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:a,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(Je(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:s}=n;if(s)return this._returnResult({data:null,error:s});const a=await ut(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(a.error)return a;const{data:l}=a;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:AB(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:PB(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(Je(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 s of(t=n==null?void 0:n.factors)!==null&&t!==void 0?t:[])i.all.push(s),s.status==="verified"&&i[s.factor_type].push(s);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(t){var n,r,i,s;if(t)try{const{payload:h}=_m(t);let x=null;h.aal&&(x=h.aal);let g=x;const{data:{user:b},error:y}=await this.getUser(t);if(y)return this._returnResult({data:null,error:y});((r=(n=b==null?void 0:b.factors)===null||n===void 0?void 0:n.filter(S=>S.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(g="aal2");const w=h.amr||[];return{data:{currentLevel:x,nextLevel:g,currentAuthenticationMethods:w},error:null}}catch(h){if(Je(h))return this._returnResult({data:null,error:h});throw h}const{data:{session:a},error:l}
426=await this.getSession();if(l)return this._returnResult({data:null,error:l});if(!a)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:c}=_m(a.access_token);let d=null;c.aal&&(d=c.aal);let u=d;((s=(i=a.user.factors)===null||i===void 0?void 0:i.filter(h=>h.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(u="aal2");const p=c.amr||[];return{data:{currentLevel:d,nextLevel:u,currentAuthenticationMethods:p},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 ut(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Ci})})}catch(n){if(Je(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:s}=r;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new Ci});const a=await ut(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 a.data&&a.data.redirect_url&&Sr()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(r){if(Je(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:s}=r;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new Ci});const a=await ut(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 a.data&&a.data.redirect_url&&Sr()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(r){if(Je(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 ut(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 Ci})})}catch(t){if(Je(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 ut(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 Ci})})}catch(n){if(Je(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+U9>i)return r;const{data:s,error:a}=await ut(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!s.keys||s.keys.length===0||(this.jwks=s,this.jwks_cached_at=i,r=s.keys.find(l=>l.kid===t),!r)?null:r}async getClaims(t,n={}){try{let r=t;if(!r){const{data:h,error:x}
426=await this.getSession();if(x||!h.session)return this._returnResult({data:null,error:x});r=h.session.access_token}const{header:i,payload:s,signature:a,raw:{header:l,payload:c}}=_m(r);n!=null&&n.allowExpired||cB(s.exp);const d=!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(!d){const{error:h}=await this.getUser(r);if(h)throw h;return{data:{claims:s,header:i,signature:a},error:null}}const u=dB(i.alg),f=await crypto.subtle.importKey("jwk",d,u,!0,["verify"]);if(!await crypto.subtle.verify(u,f,a,J9(`${l}.${c}`)))throw new n1("Invalid JWT signature");return{data:{claims:s,header:i,signature:a},error:null}}catch(r){if(Je(r))return this._returnResult({data:null,error:r});throw r}}}Pf.nextInstanceID={};const UB=Pf,zB="2.104.0";let Rh="";typeof Deno<"u"?Rh="deno":typeof document<"u"?Rh="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Rh="react-native":Rh="node";const qB={"X-Client-Info":`supabase-js-${Rh}/${zB}`},WB={headers:qB},HB={schema:"public"},VB={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},GB={};function Lf(e){"@babel/helpers - typeof";return Lf=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},Lf(e)}function YB(e,t){if(Lf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Lf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function KB(e){var t=YB(e,"string");return Lf(t)=="symbol"?t:t+""}function JB(e,t,n){return(t=KB(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lN(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 Mn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lN(Object(n),!0).forEach(function(r){JB(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lN(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const XB=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),ZB=()=>Headers,QB=(e,t,n)=>{const r=XB(n),i=ZB();return async(s,a)=>{var l;const c=(l=await t())!==null&&l!==void 0?l:e;let d=new i(a==null?void 0:a.headers);return d.has("apikey")||d.set("apikey",e),d.has("Authorization")||d.set("Authorization",`Bearer ${c}`),r(s,Mn(Mn({},a),{},{headers:d}))}};function eU(e){return e.endsWith("/")?e:e+"/"}function tU(e,t){var n,r;const{db:i,auth:s,realtime:a,global:l}=e,{db:c,auth:d,realtime:u,global:f}=t,p={db:Mn(Mn({},c),i),auth:Mn(Mn({},d),s),realtime:Mn(Mn({},u),a),storage:{},global:Mn(Mn(Mn({},f),l),{},{headers:Mn(Mn({},(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?p.accessToken=e.accessToken:delete p.accessToken,p}function nU(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(eU(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var rU=class extends UB{constructor(e){super(e)}},iU=class{constructor(e,t,n){var r,i;this.supabaseUrl=e,this.supabaseKey=t;const s=nU(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",s),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",s),this.storageUrl=new URL("storage/v1",s),this.functionsUrl=new URL("functions/v1",s);const a=`sb-${s.hostname.split(".")[0]}-auth-token`,l={db:HB,realtime:GB,auth:Mn(Mn({},VB),{},{storageKey:a}),global:WB},c=tU(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:(u,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 d;this.auth=this._initSupabaseAuthClient((d=c.auth)!==null&&d!==void 0?d:{},this.headers,c.global.fetch)}this.fetch=QB(t,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(Mn({headers:this.headers,accessToken:this._getAccessToken.bind(this)},c.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new S$(new URL("rest/v1",s).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch,timeout:c.db.timeout,urlLengthLimit:c.db.urlLengthLimit}),this.storage=new D9(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),c.accessToken||this._listenForAuthEvents()}get functions(){return new m$(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)}
426channel(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:s,flowType:a,lock:l,debug:c,throwOnError:d},u,f){const p={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new rU({url:this.authUrl.href,headers:Mn(Mn({},p),u),storageKey:s,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:i,flowType:a,lock:l,debug:c,throwOnError:d,fetch:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(h=>h.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new s9(this.realtimeUrl.href,Mn(Mn({},e),{},{params:Mn(Mn({},{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 sU=(e,t,n)=>new iU(e,t,n);function oU(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}oU()&&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 aU(){var b,y;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])??((y=e.match(new RegExp("^("+r+")(?=[.-])","i")))==null?void 0:y[1]):void 0,s=window.parent&&window.parent!==window;if(!i||!s)return localStorage;const a=e.endsWith(".lovableproject-dev.com")||e.endsWith(".gpt-eng.com"),l=a?/^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:""),d=c&&l.test(c)?[c]:a?["https://lovable.dev","http://localhost:3000"]:["https://lovable.dev"],u="lovable-preview-auth:result",f=2e3,p=()=>Math.random().toString(36).slice(2)+Date.now().toString(36),h=(_,w,S)=>new Promise(C=>{const P=p();let R=!1,M;const T=O=>{R||(R=!0,clearTimeout(M),window.removeEventListener("message",H),C(O))},H=O=>{if(d.indexOf(O.origin)<0)return;const K=O.data;K&&K.type===u&&K.requestId===P&&T(K)};window.addEventListener("message",H);const A={type:_,requestId:P,projectId:i,key:w};S!==void 0&&(A.value=S);for(const O of d)window.parent.postMessage(A,O);M=setTimeout(()=>T(null),f)});let x=!0;const g=250;return{getItem:async _=>{let w=await h("lovable-preview-auth:get",_);return!w&&x&&(await new Promise(S=>setTimeout(S,g)),w=await h("lovable-preview-auth:get",_)),x=!1,w&&w.ok&&typeof w.value=="string"?w.value===""?(localStorage.removeItem(_),null):w.value:localStorage.getItem(_)},setItem:(_,w)=>(localStorage.setItem(_,w),h("lovable-preview-auth:set",_,w).then(S=>{S&&S.ok&&typeof S.value=="string"&&localStorage.getItem(_)===w&&(S.value===""?localStorage.removeItem(_):localStorage.setItem(_,S.value))})),removeItem:_=>(localStorage.removeItem(_),h("lovable-preview-auth:remove",_).then(()=>{}))}}const lU="https://uufdcsnvkixltkqaptzx.supabase.co",cU="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InV1ZmRjc252a2l4bHRrcWFwdHp4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzMwODczOTUsImV4cCI6MjA4ODY2MzM5NX0.eSZOtAJ0Pe_7Lm42n5ChbIZoli9lRQQWrqRxnXNKJco",Ne=sU(lU,cU,{auth:{storage:aU(),persistSession:!0,autoRefreshToken:!0}}),UA=k.createContext({session:null,user:null,loading:!0,signOut:async()=>{}}),pn=()=>k.useContext(UA),dU=({children:e})=>{const[t,n]=k.useState(null),[r,i]=k.useState(!0);k.useEffect(()=>{const{data:{subscription:a}}=Ne.auth.onAuthStateChange((l,c)=>{n(c),i(!1)});return Ne.auth.getSession().then(({data:{session:l}})=>{n(l),i(!1)}),()=>a.unsubscribe()},[]);const s=async()=>{await Ne.auth.signOut()};return o.jsx(UA.Provider,{value:{session:t,user:(t==null?void 0:t.user)??null,loading:r,signOut:s},children:e})},zA=k.createContext({isAdmin:!1,checking:!0}),uU=({children:e})=>{const{user:t,loading:n}=pn(),[r,i]=k.useState(!1),[s,a]=k.useState(!0);k.useEffect(()=>{let c=!1;
426if(!n){if(!t){i(!1),a(!1);return}return a(!0),Ne.rpc("has_role",{_user_id:t.id,_role:"admin"}).then(({data:d,error:u})=>{c||(i(!u&&d===!0),a(!1))}),()=>{c=!0}}},[t,n]);const l=k.useMemo(()=>({isAdmin:r,checking:s}),[r,s]);return o.jsx(zA.Provider,{value:l,children:e})},v2=()=>k.useContext(zA),hr={embedded:!1,top:0,height:0,parentWidth:0},r1=new Set,i1=()=>({...hr}),cN=e=>{let t=!1;if(e.embedded!==void 0&&e.embedded!==hr.embedded&&(hr.embedded=e.embedded,t=!0),e.top!==void 0&&e.top!==hr.top&&(hr.top=e.top,t=!0),e.height!==void 0&&e.height!==hr.height&&(hr.height=e.height,t=!0),e.parentWidth!==void 0&&e.parentWidth!==hr.parentWidth&&(hr.parentWidth=e.parentWidth,t=!0),!t)return;const n=document.documentElement;hr.embedded&&hr.height>0?(n.style.setProperty("--embed-visible-top",`${Math.round(hr.top)}px`),n.style.setProperty("--embed-center",`${Math.round(hr.top+hr.height/2)}px`),n.style.setProperty("--embed-visible-height",`${Math.round(hr.height)}px`)):(n.style.removeProperty("--embed-visible-top"),n.style.removeProperty("--embed-center"),n.style.removeProperty("--embed-visible-height")),r1.forEach(r=>r())};function hU(){const[e,t]=k.useState(i1);return k.useEffect(()=>{const n=()=>t(i1());return r1.add(n),n(),()=>{r1.delete(n)}},[]),e}const fU=()=>hr.embedded&&hr.parentWidth>0?hr.parentWidth:0;function Cs(){const{embedded:e,top:t,height:n}=hU();return!e||n<=0?{}:{top:t,height:n,bottom:"auto"}}const dN="reverie:session-key",uN="reverie:entry-ref",hN=new Set,pU=()=>{var e;try{let t=sessionStorage.getItem(dN);return t||(t=(((e=crypto.randomUUID)==null?void 0:e.call(crypto))||String(Math.random())).slice(0,36),sessionStorage.setItem(dN,t)),t}catch{return"no-storage"}},mU=()=>{try{const e=window.innerWidth||0;return e>0&&e<768?"mobile":e>=768&&e<1100?"tablet":"desktop"}catch{return"unknown"}},gU=()=>{try{let e=sessionStorage.getItem(uN);if(!e){const t=document.referrer||"";e=t?new URL(t).host+new URL(t).pathname:window.location.pathname,sessionStorage.setItem(uN,e)}return e}catch{return null}};async function Qn(e,t,n){var r,i;try{if(n!=null&&n.once){if(hN.has(e))return;hN.add(e)}const{data:s}=await Ne.auth.getSession();await Ne.from("embed_events").insert({event:e,path:window.location.pathname,embedded:i1().embedded,session_key:pU(),user_id:((i=(r=s.session)==null?void 0:r.user)==null?void 0:i.id)??null,meta:{...t||{},device:mU(),ref:gU()}})}catch{}}const xU=["a[href]","button:not([disabled])","input:not([disabled]):not([type='hidden'])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function na(e){const t=k.useRef(null);return k.useEffect(()=>{const n=t.current;if(!n)return;const r=document.activeElement instanceof HTMLElement?document.activeElement:null,i=document.body.style.overflow;document.body.style.overflow="hidden";const s=()=>Array.from(n.querySelectorAll(xU)).filter(l=>!l.hasAttribute("disabled")&&l.offsetParent!==null);(s()[0]??n).focus();const a=l=>{if(l.key==="Escape"&&e){l.preventDefault(),e();return}if(l.key!=="Tab")return;const c=s();if(c.length===0){l.preventDefault(),n.focus();return}const d=c[0],u=c[c.length-1];l.shiftKey&&document.activeElement===d?(l.preventDefault(),u.focus()):!l.shiftKey&&document.activeElement===u&&(l.preventDefault(),d.focus())};return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a),document.body.style.overflow=i,r==null||r.focus()}},[e]),t}const Rf=({onClose:e,message:t,standalone:n})=>{const{session:r}=pn(),i=Cs(),[s,a]=k.useState(!1),[l,c]=k.useState(""),[d,u]=k.useState(""),[f,p]=k.useState(!1),[h,x]=k.useState(!1),[g,b]=k.useState(!1),y=na(e),_=typeof window<"u"&&window.parent!==window&&!n;k.useEffect(()=>{if(!_)return;const C=async P=>{if(P.origin!==window.location.origin)return;const R=P.data;if((R==null?void 0:R.source)!=="reverie-auth"||R.type!=="reverie-session"||!R.access_token||!R.refresh_token)return;const{error:M}=await Ne.auth.setSession({access_token:R.access_token,refresh_token:R.refresh_token});M?me.error("Could not complete sign-in — please try again"):(b(!1),me.success("Signed in successfully"))};return window.addEventListener("message",C),()=>window.removeEventListener("message",C)},[_]);const w=()=>{const R=window.screenX+Math.max(0,(window.outerWidth-460)/2),M=window.screenY+Math.max(0,(window.outerHeight-660)/2),T=window.open(`${window.location.origin}/auth-popup`,"reverie-signin",`width=460,height=660,left=${Math.round(R)},top=${Math.round(M)}`);if(!T){x(!0),me.error("Your browser blocked the sign-in window — use the link below");return}x(!1);const H=window.setInterval(async()=>
426{if(!T.closed)return;window.clearInterval(H);const{data:A}=await Ne.auth.getSession();A.session||me.message("Sign-in window closed before finishing.")},800)};if(r)return null;const S=async C=>{C.preventDefault(),p(!0);try{if(s){const{error:P}=await Ne.auth.signUp({email:l,password:d,options:{emailRedirectTo:window.location.origin}});if(P)throw P;Qn("account_created"),Ne.functions.invoke("send-transactional-email",{body:{templateName:"welcome-account",recipientEmail:l,idempotencyKey:`welcome-${l.toLowerCase()}`,templateData:{}}}),me.success("Check your email to confirm your account")}else{const{error:P}=await Ne.auth.signInWithPassword({email:l,password:d});if(P)throw P;const{data:R}=await Ne.auth.getSession();if(_&&!R.session){b(!0),me.error("Your browser blocked sign-in inside this frame — use the secure window");return}me.success("Signed in successfully")}}catch(P){me.error(P.message||"Authentication failed")}finally{p(!1)}};return o.jsx("div",{className:"fixed inset-0 z-[1000] flex items-start justify-center overflow-y-auto overscroll-contain bg-foreground
426/25 p-4 pt-[max(1rem,env(safe-area-inset-top))] backdrop-blur-sm embed-scrollable sm:items-center",style:i,children:o.jsxs("div",{ref:y,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":"Reverie account access",className:"my-auto w-full max-w-sm space-y-8 rounded-md border border-border bg-card p-6 shadow-[var(--shadow-lg)] animate-fade-up sm:p-8",children:[o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("h1",{className:"font-display text-3xl font-bold tracking-wide",children:"Reverie"}),o.jsx("p",{className:"font-body text-[10px] tracking-[0.35em] uppercase text-muted-foreground/60",children:"Fine Art Collective"}),o.jsx("p",{className:"font-body text-xs text-muted-foreground mt-4",children:t||"Sign in to save your valuations"})]}),_&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("button",{type:"button",onClick:w,className:"w-full inline-flex items-center justify-center gap-2 px-4 py-3 text-sm font-semibold font-body bg-primary text-primary-foreground rounded-md shadow-[var(--shadow-md)] hover:brightness-105 active:scale-[0.99] transition-all",children:[o.jsx(wf,{size:14})," Sign in securely"]}),o.jsx("p",{className:"text-[10px] text-center text-muted-foreground/70 font-body",children:"Opens a secure Reverie window — recommended in Safari and on mobile"}),(h||g)&&o.jsx("a",{href:`${typeof window<"u"?window.location.origin:""}/auth-popup`,target:"_blank",rel:"noopener noreferrer",className:"block w-full text-center px-4 py-2.5 text-xs font-body font-semibold border border-input rounded-md hover:bg-muted/60 transition-colors",children:"Open sign-in in a new tab →"}),o.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[o.jsx("span",{className:"h-px flex-1 bg-border"}),o.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground/60 font-body",children:"or"}),o.jsx("span",{className:"h-px flex-1 bg-border"})]})]}),o.jsxs("form",{onSubmit:S,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{className:"block text-xs font-semibold font-body uppercase tracking-wider text-muted-foreground",children:"Email"}),o.jsx("input",{type:"email",required:!0,value:l,onChange:C=>c(C.target.value),placeholder:"[email protected]",className:"w-full px-3.5 py-2.5 text-sm font-medium font-body bg-background border border-input rounded-md shadow-[var(--shadow-sm)] focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20 transition-all placeholder:text-muted-foreground/50"})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{className:"block text-xs font-semibold font-body uppercase tracking-wider text-muted-foreground",children:"Password"}),o.jsx("input",{type:"password",required:!0,minLength:6,value:d,onChange:C=>u(C.target.value),placeholder:"••••••••",className:"w-full px-3.5 py-2.5 text-sm font-medium font-body bg-background border border-input rounded-md shadow-[var(--shadow-sm)] focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20 transition-all placeholder:text-muted-foreground/50"})]}),o.jsx("button",{type:"submit",disabled:f,className:"w-full px-4 py-3 text-sm font-semibold font-body bg-primary text-primary-foreground rounded-md shadow-[var(--shadow-md)] hover:shadow-[var(--shadow-lg)] hover:brightness-105 active:scale-[0.99] transition-all disabled:opacity-50 disabled:shadow-none",children:f?"Please wait…":s?"Create Account":"Sign In"})]}),o.jsxs("p",{className:"text-center text-xs font-body text-muted-foreground",children:[s?"Already have an account?":"Don't have an account?"," ",o.jsx("button",{onClick:()=>a(!s),className:"text-foreground font-semibold hover:text-primary transition-colors",children:s?"Sign In":"Sign Up"})]}),o.jsxs("div",{className:"text-center pt-2 border-t border-border space-y-3",children:[e&&o.jsx("button",{onClick:e,className:"w-full px-4 py-3 text-sm font-semibold font-body border border-input text-foreground rounded-md hover:bg-muted/60 active:scale-[0.99] transition-all",children:"Try for Free"}
426),e&&o.jsx("p",{className:"text-[10px] text-muted-foreground/60 font-body",children:"Explore the tool — create an account to save reports & submit for consignment"}),!e&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{onClick:()=>{window.open("https://uufdcsnvkixltkqaptzx.supabase.co/storage/v1/object/public/artwork-images/videos/reverie-walkthrough.mp4","_blank")},className:"inline-flex items-center gap-2 px-4 py-2 text-xs font-body font-semibold uppercase tracking-wider text-primary-foreground bg-primary/80 rounded-md hover:bg-primary transition-colors",children:[o.jsx(LC,{size:14})," Watch Demo"]}),o.jsx("p",{className:"text-[10px] text-muted-foreground/60 font-body",children:"See how the valuation tool works"})]})]})]})})},vU=()=>{const[e,t]=k.useState([]),[n,r]=k.useState(!0),[i,s]=k.useState(""),[a,l]=k.useState(!1),c=k.useCallback(async()=>{r(!0);const{data:f,error:p}=await Ne.rpc("list_staff");p&&me.error("Could not load the staff list"),t(f??[]),r(!1)},[]);k.useEffect(()=>{c()},[c]);const d=async()=>{const f=i.trim();if(!f)return;l(!0);const{data:p,error:h}=await Ne.rpc("set_staff_role",{_email:f,_role:"admin",_grant:!0});if(l(!1),h){me.error(h.message);return}if(p==="no_such_user"){me.error("That person needs to create an account first, then try again.");return}me.success("Staff access granted"),s(""),c()},u=async f=>{if(!f)return;l(!0);const{error:p}=await Ne.rpc("set_staff_role",{_email:f,_role:"admin",_grant:!1});if(l(!1),p){me.error(p.message);return}me.success("Staff access removed"),c()};return o.jsxs("section",{"aria-label":"Staff access",className:"rounded-md border border-border p-5",children:[o.jsx("h2",{className:"font-display text-xl font-semibold tracking-tight",children:"Staff access"}),o.jsx("p",{className:"mt-1.5 font-body text-xs leading-relaxed text-muted-foreground",children:"Anyone listed here can open this workspace with their own Reverie account. They must sign up first, then be added by email."}),o.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[o.jsx("label",{htmlFor:"staff-email",className:"sr-only",children:"Staff email address"}),o.jsx("input",{id:"staff-email",type:"email",value:i,onChange:f=>s(f.target.value),placeholder:"[email protected]",className:"min-h-[44px] flex-1 rounded-md border border-input bg-background px-3 font-body text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"}),o.jsx("button",{type:"button",onClick:d,disabled:a||!i.trim(),className:"min-h-[44px] rounded-md bg-primary px-5 font-body text-sm font-semibold text-primary-foreground transition-all hover:brightness-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50",children:"Add staff"})]}),o.jsxs("ul",{className:"mt-4 divide-y divide-border font-body text-sm",children:[n&&o.jsx("li",{className:"py-2 text-muted-foreground",children:"Loading…"}),!n&&e.length===0&&o.jsx("li",{className:"py-2 text-muted-foreground",children:"No staff accounts yet."}),e.map(f=>o.jsxs("li",{className:"flex items-center justify-between gap-3 py-2.5",children:[o.jsxs("span",{className:"min-w-0 truncate",children:[f.email||f.user_id,o.jsx("span",{className:"ml-2 text-xs uppercase tracking-[0.14em] text-muted-foreground",children:f.role})]}),o.jsx("button",{type:"button",onClick:()=>u(f.email),disabled:a,className:"inline-flex min-h-[44px] shrink-0 items-center px-2 font-body text-xs font-semibold text-muted-foreground underline underline-offset-2 disabled:opacity-50",children:"Remove"})]},`${f.user_id}-${f.role}`))]})]})},fN={warning:"bg-amber-50 text-amber-900 border-amber-200",error:"bg-red-50 text-red-900 border-red-200",critical:"bg-red-100 text-red-950 border-red-300"},bU=({isAdmin:e})=>{const[t,n]=k.useState([]),[r,i]=k.useState(!1),[s,a]=k.useState(!1),[l,c]=k.useState(!0),d=async()=>{i(!0);try{const{data:p,error:h}=await Ne.functions.invoke("admin-list-alerts",{body:{includeResolved:s}});if(h)throw h;p!=null&&p.success&&n(p.data||[])}catch(p){me.error(p.message||"Could not load alerts")}finally{i(!1)}};k.useEffect(()=>{e&&l&&d()},[e,l,s]);const u=async p=>{try{const{error:h}=await Ne.functions.invoke("admin-list-alerts",{body:{resolveId:p}});if(h)throw h;me.success("Alert resolved"),d()}catch(h){me.error(h.message||"Could not resolve alert")}};if(!e)return null;const f=t.filter(p=>!p.resolved_at);return o.jsxs("div",{className:"border border-border rounded-md bg-card mb-6",children:[o.jsxs("button",{onClick:()=>c(!l),className:"w-full flex items-center justify-between px-4 py-3 text-left",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(My,{size:16,className:f.length>0?"text-red-600":"text-muted-foreground"}),o.jsx("span",{className:"font-display text-sm font-semibold",children:"System Alerts"}),f.length>0&&o.jsxs("span",{className:"px-2 py-0.5 text-[10px] font-bold bg-red-100 text-red-800 rounded-full",children:[f.length," unresolved"]})]}),o.jsx("span",{className:"text-xs text-muted-foreground",children:l?"Hide":"Show"})]}),l&&o.jsxs("div",{className:"border-t border-border p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("label",{className:"flex items-center gap-2 text-xs font-body",children:[o.jsx("input",{type:"checkbox",checked:s,onChange:p=>a(p.target.checked),className:"rounded border-input"}),"Include resolved"]}),o.jsxs("button",{onClick:d,disabled:r,className:"flex items-center gap-1 text-xs font-body text-muted-foreground hover:text-foreground",children:[o.jsx(Nc,{size:12,className:r?"animate-spin":""}),"Refresh"]})]}),r&&t.length===0&&o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"Loading…"}),!r&&t.length===0&&o.jsx("p",{className:"text-xs font-body text-muted-foreground italic",children:"No alerts. All edge functions running cleanly."}),t.map(p=>{const h=fN[p.severity]||fN.error;return o.jsx("div",{className:`p-3 border rounded-sm ${p.resolved_at?"opacity-60 bg-muted/40 border-border":h}`,children:o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:p.source}),o.jsx("span",{className:"text-[10px] font-body text-muted-foreground",children:new Date(p.created_at).toLocaleStr
426ing()}),p.resolved_at&&o.jsxs("span",{className:"text-[10px] font-body text-emerald-700 inline-flex items-center gap-1",children:[o.jsx(z0,{size:10})," Resolved"]})]}),o.jsx("p",{className:"text-xs font-body break-words",children:p.message}),p.context&&o.jsxs("details",{className:"mt-2",children:[o.jsx("summary",{className:"text-[10px] font-body cursor-pointer text-muted-foreground",children:"Context"}),o.jsx("pre",{className:"mt-1 text-[10px] font-mono whitespace-pre-wrap break-all bg-background/60 p-2 rounded-sm",children:JSON.stringify(p.context,null,2)})]})]}),!p.resolved_at&&o.jsx("button",{onClick:()=>u(p.id),className:"text-[10px] font-body underline whitespace-nowrap",children:"Mark resolved"})]})},p.id)})]})]})},nd=[{event:"tool_view",label:"Saw the tool"},{event:"entry_started",label:"Started an entry"},{event:"image_uploaded",label:"Uploaded an image"},{event:"formula_estimate",label:"Ran formula estimate"},{event:"ai_estimate",label:"Ran AI consensus"},{event:"report_viewed",label:"Viewed the report"},{event:"premium_cta_viewed",label:"Saw the premium offer"},{event:"premium_sample_previewed",label:"Previewed the sample report"},{event:"premium_checkout_started",label:"Opened premium checkout"},{event:"premium_report_generated",label:"Generated premium report"},{event:"consignment_submitted",label:"Submitted for consignment"}],yU=[7,30,90],wU=["all","mobile","tablet","desktop"],qA=({isAdmin:e})=>{const[t,n]=k.useState(null),[r,i]=k.useState([]),[s,a]=k.useState([]),[l,c]=k.useState(30),[d,u]=k.useState("all"),[f,p]=k.useState(null);if(k.useEffect(()=>{if(!e)return;let _=!0;return n(null),p(null),Ne.functions.invoke("admin-embed-funnel",{body:{days:l}}).then(({data:w,error:S})=>{if(_){if(S)throw S;n((w==null?void 0:w.rows)||[]),i((w==null?void 0:w.devices)||[]),a((w==null?void 0:w.entries)||[])}}).catch(w=>_&&p(w.message||"Failed to load funnel")),()=>{_=!1}},[e,l]),!e)return null;const h=new Map((t||[]).map(_=>[_.event,_])),x=_=>r.filter(w=>w.event===_&&(d==="all"||w.device===d)).reduce((w,S)=>w+Number(S.sessions||0),0),g=_=>{var w;return d==="all"?((w=h.get(_))==null?void 0:w.sessions)||0:x(_)},b=g("tool_view");let y=null;for(let _=1;_<nd.length;_++){const w=g(nd[_-1].event),S=g(nd[_].event),C=w-S;w>0&&C>0&&(!y||C>y.lost)&&(y={label:`${nd[_-1].label} → ${nd[_].label}`,lost:C})}return o.jsxs("div",{className:"border border-border rounded-md bg-card p-5 space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[o.jsxs("h3",{className:"flex items-center gap-2 font-display text-base font-bold tracking-wide",children:[o.jsx(v7,{size:15,className:"text-primary"})," Storefront Funnel"]}),o.jsx("div",{className:"flex gap-1",children:yU.map(_=>o.jsxs("button",{onClick:()=>c(_),className:`px-3 py-1.5 text-xs font-body font-semibold rounded-md transition-colors ${l===_?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"}`,children:[_,"d"]},_))})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[o.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-body uppercase tracking-wider text-muted-foreground",children:[o.jsx(M7,{size:12})," Device"]}),wU.map(_=>o.jsx("button",{onClick:()=>u(_),className:`px-2.5 py-1 text-[11px] font-body font-semibold rounded-md capitalize transition-colors ${d===_?"bg-foreground text-background":"bg-muted text-muted-foreground hover:bg-muted/80"}`,children:_},_))]}),f&&o.jsx("p",{className:"text-xs font-body text-destructive",children:f}),!t&&!f&&o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"Loading…"}),t&&o.jsxs("div",{className:"space-y-2",children:[nd.map(_=>{const w=h.get(_.event),S=g(_.event),C=b>0?Math.round(S/b*100):0;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs font-body",children:[o.jsx("span",{className:"text-foreground",children:_.label}),o.jsxs("span",{className:"text-muted-foreground",children:[S," ",b>0&&o.jsxs("span",{className:"text-muted-foreground/60",children:["· ",C,"%"]}),d==="all"&&(w!=null&&w.embedded_sessions)?o.jsxs("span",{className:"text-muted-foreground
426/60",children:[" · ",w.embedded_sessions," embedded"]}):null]})]}),o.jsx("div",{className:"h-1.5 rounded bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary/70",style:{width:`${C}%`}})})]},_.event)}),b===0&&o.jsxs("p",{className:"text-xs font-body text-muted-foreground pt-1",children:["No activity recorded yet in this window",d==="all"?"":` for ${d}`,"."]}),y&&o.jsxs("p",{className:"text-xs font-body text-muted-foreground pt-2 border-t border-border mt-3",children:["Biggest drop-off: ",o.jsx("span",{className:"text-foreground font-semibold",children:y.label})," — ",y.lost," ","session",y.lost===1?"":"s"," lost."]})]}),s.length>0&&o.jsxs("div",{className:"pt-3 border-t border-border space-y-2",children:[o.jsxs("h4",{className:"flex items-center gap-1.5 text-[11px] font-body uppercase tracking-wider text-muted-foreground",children:[o.jsx(A7,{size:12})," Entry pages"]}),o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full text-xs font-body",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"text-muted-foreground text-left",children:[o.jsx("th",{className:"py-1 pr-3 font-normal",children:"Page"}),o.jsx("th",{className:"py-1 pr-3 font-normal text-right",children:"Sessions"}),o.jsx("th",{className:"py-1 pr-3 font-normal text-right",children:"Started"}),o.jsx("th",{className:"py-1 pr-3 font-normal text-right",children:"Valued"}),o.jsx("th",{className:"py-1 font-normal text-right",children:"Premium"})]})}),o.jsx("tbody",{children:s.slice(0,8).map(_=>o.jsxs("tr",{className:"border-t border-border/60",children:[o.jsx("td",{className:"py-1.5 pr-3 truncate max-w-[240px] text-foreground",children:_.entry}),o.jsx("td",{className:"py-1.5 pr-3 text-right text-muted-foreground",children:_.sessions}),o.jsx("td",{className:"py-1.5 pr-3 text-right text-muted-foreground",children:_.started}),o.jsx("td",{className:"py-1.5 pr-3 text-right text-muted-foreground",children:_.valued}),o.jsx("td",{className:"py-1.5 text-right text-muted-foreground",children:_.premium})]},_.entry))})]})})]})]})},pN={pending:{label:"Pending",color:"bg-amber-500"},processing:{label:"Processing",color:"bg-sky-500"},paid:{label:"Paid",color:"bg-emerald-500"},on_hold:{label:"On Hold",color:"bg-red-400"}},gh=e=>{const t=e.base_value||0,n=e.scarcity_multiplier||0,r=e.provenance_uplift||0;return t+t*(n/100)+t*(r/100)},_U=[{key:"7",label:"7d"},{key:"30",label:"30d"},{key:"90",label:"90d"},{key:"all",label:"All"}],kU=({isAdmin:e})=>{const[t,n]=k.useState([]),[r,i]=k.useState(!1),[s,a]=k.useState(e),[l,c]=k.useState("30");k.useEffect(()=>{if(!s||!e)return;(async()=>{i(!0);try{const{data:g,error:b}=await Ne.functions.invoke("admin-submissions",{body:{}});if(b)throw b;if(g!=null&&g.success)n(g.data||[]);else throw new Error((g==null?void 0:g.error)||"Failed to load")}catch(g){me.error(g.message||"Failed to load analytics")}finally{i(!1)}})()},[s,e]);const d=k.useMemo(()=>{if(l==="all")return t;const x=parseInt(l,10),g=Date.now()-x*24*60*60*1e3;return t.filter(b=>new Date(b.created_at).getTime()>=g)},[t,l]),u=k.useMemo(()=>{if(l==="all")return[];const x=parseInt(l,10),b=Date.now()-x*24*60*60*1e3,y=b-x*24*60*60*1e3;return t.filter(_=>{const w=new Date(_.created_at).getTime();return w>=y&&w<b})},[t,l]),f=x=>{const g=x.filter(S=>S.submission_type==="consignment"),b=x.filter(S=>S.status==="sold"),y=b.reduce((S,C)=>S+(C.sale_price||gh(C)),0),_=g.length?Math.round(b.length/g.length*100):0,w=b.reduce((S,C)=>C.payout_status==="paid"?S:S+(C.payout_amount||0),0);return{total:x.length,gmv:y,conversionRate:_,outstanding:w}},p=k.useMemo(()=>f(u),[u]),h=k.useMemo(()=>{const x=d.length,g=d.filter(ee=>ee.submission_type==="consignment"),b=d.filter(ee=>ee.status==="sold"),y=d.filter(ee=>ee.status==="listed"),_=d.filter(ee=>ee.status==="pending_review"),w=d.filter(ee=>ee.status==="declined"),S=b.reduce((ee,ce)=>ee+(ce.sale_price||gh(ce)),0),C=y.reduce((ee,ce)=>ee+gh(ce),0),P=g.length?Math.round(b.length/g.length*100):0,R=b.length?Math.round(S/b.length):0,M=b.filter(ee=>(ee.payout_amount||0)>0),T=b.filter(ee=>ee.payout_status==="paid"),H=b.reduce((ee,ce)=>ce.payout_status==="paid"?ee:ee+(ce.payout_amount||0),0),A=T.reduce((ee,ce)=>ee+(ce.payout_amount||0),0),O=M.length?Math.round(T.length/M.length*100):0,K=T.filter(ee=>ee.payout_paid_at).map(ee=>{const ce=new Date(ee.created_at).getTime(),ue=new Date(ee.payout_paid_at).getTime();return Math.max(0,(ue-ce)/(1e3*60*60*24))}),U=K.length?K.reduce((ee,ce)=>ee+ce,0)/K.length:0,I={};b.forEach(ee=>{const ce=ee.payout_status||"pending",ue=I[ce]||{count:0,value:0};ue.count+=1,ue.value+=ee.payout_amount||0,I[ce]=ue});const re=Date.now(),V={current:{count:0,value:0},d30:{count:0,value:0},d60:{count:0,value:0},d90:{count:0,value:0}};let $=0;b.filter(ee=>ee.payout_status!=="paid"&&(ee.payout_amount||0)>
4260).forEach(ee=>{const ce=ee.sold_at||ee.created_at,ue=Math.max(0,(re-new Date(ce).getTime())/(1e3*60*60*24));ue>$&&($=ue);const ye=ee.payout_amount||0;let Se;ue<=30?Se="current":ue<=60?Se="d30":ue<=90?Se="d60":Se="d90",V[Se].count+=1,V[Se].value+=ye});const D=new Map;d.forEach(ee=>{const ce=new Date(ee.created_at).toISOString().slice(0,10);D.set(ce,(D.get(ce)||0)+1)});const ie=Array.from(D.entries()).sort(([ee],[ce])=>ee<ce?-1:1),X=Math.max(1,...ie.map(([,ee])=>ee)),E=new Map;d.forEach(ee=>{const ce=(ee.artist_name||"").trim();if(!ce)return;const ue=E.get(ce)||{submissions:0,sold:0,gmv:0,pipelineValue:0};ue.submissions+=1,ue.pipelineValue+=gh(ee),ee.status==="sold"&&(ue.sold+=1,ue.gmv+=ee.sale_price||gh(ee)),E.set(ce,ue)});const q=Array.from(E.entries()).map(([ee,ce])=>({name:ee,submissions:ce.submissions,sold:ce.sold,gmv:ce.gmv,avgSale:ce.sold>0?ce.gmv/ce.sold:0,sellThrough:ce.submissions>0?Math.round(ce.sold/ce.submissions*100):0,pipelineValue:ce.pipelineValue})).sort((ee,ce)=>ce.gmv-ee.gmv||ce.submissions-ee.submissions).slice(0,10),F=q.slice(0,5).map(ee=>[ee.name,{count:ee.submissions,value:ee.pipelineValue}]),Z=Math.max(1,...q.map(ee=>ee.gmv)),Y={};return d.forEach(ee=>{Y[ee.status]=(Y[ee.status]||0)+1}),{total:x,consignmentCount:g.length,sold:b.length,listed:y.length,pending:_.length,declined:w.length,gmv:S,estimatedPipeline:C,conversionRate:P,avgSalePrice:R,outstandingPayouts:H,paidTotal:A,paidPayoutCount:T.length,soldWithPayoutCount:M.length,payoutConversionRate:O,avgTimeToPaid:U,payoutBreakdown:I,aging:V,oldestOutstandingDays:$,timeSeries:ie,maxDay:X,topArtists:F,artistLeaderboard:q,maxArtistGmv:Z,statusBreakdown:Y}},[d]);return e?o.jsxs("div",{className:"border border-border rounded-sm p-5 bg-muted/30 space-y-4",children:[o.jsxs("button",{onClick:()=>a(!s),className:"flex items-center justify-between w-full",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(t2,{size:16,className:"text-primary"}),o.jsx("h3",{className:"font-display text-lg font-bold tracking-wide",children:"Admin Analytics"})]}),o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`transition-transform ${s?"rotate-180":""}`,children:o.jsx("path",{d:"m6 9 6 6 6-6"})})]}),s&&o.jsxs("div",{className:"space-y-4",children:[o.jsx(qA,{isAdmin:e}),o.jsx("div",{className:"flex gap-1",children:_U.map(x=>o.jsx("button",{onClick:()=>c(x.key),className:`px-3 py-1.5 text-xs font-body font-semibold rounded-md transition-colors ${l===x.key?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"}`,children:x.label},x.key))}),r&&o.jsx("p",{className:"text-sm font-body text-muted-foreground",children:"Loading analytics…"}),!r&&d.length===0&&o.jsx("p",{className:"text-sm font-body text-muted-foreground",children:"No data for this range."}),!r&&d.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[o.jsx(Dl,{icon:o.jsx($7,{size:14}),label:"Submissions",value:h.total.toLocaleString(),sub:`${h.consignmentCount} consignment`,delta:l==="all"?null:km(h.total,p.total)}),o.jsx(Dl,{icon:o.jsx(Wo,{size:14}),label:"GMV (Sold)",value:`$${Math.round(h.gmv).toLocaleString()}`,sub:`${h.sold} sold · avg $${h.avgSalePrice.toLocaleString()}`,accent:"violet",delta:l==="all"?null:km(h.gmv,p.gmv)}),o.jsx(Dl,{icon:o.jsx(_k,{size:14}),label:"Conversion",value:`${h.conversionRate}%`,sub:"consignment → sold",accent:"emerald",delta:l==="all"?null:km(h.conversionRate,p.conversionRate,"pp")}),o.jsx(Dl,{icon:o.jsx(fu,{size:14}),label:"Outstanding Payouts",value:`$${Math.round(h.outstandingPayouts).toLocaleString()}`,sub:`paid $${Math.round(h.paidTotal).toLocaleString()} · pipeline $${Math.round(h.estimatedPipeline).toLocaleString()}`,accent:"amber",delta:l==="all"?null:km(h.outstandingPayouts,p.outstanding,"currency",!0)})]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:[o.jsx(Dl,{icon:o.jsx(Wo,{size:14}),label:"Payouts Paid",value:`$${Math.round(h.paidTotal).toLocaleStr
426ing()}`,sub:`${h.paidPayoutCount} of ${h.soldWithPayoutCount} payouts`,accent:"emerald"}),o.jsx(Dl,{icon:o.jsx(_k,{size:14}),label:"Payout Conversion",value:`${h.payoutConversionRate}%`,sub:"paid / sold w/ payout",accent:"violet"}),o.jsx(Dl,{icon:o.jsx(fu,{size:14}),label:"Avg Time to Paid",value:h.avgTimeToPaid>0?`${h.avgTimeToPaid.toFixed(1)}d`:"—",sub:"submission → payout",accent:"amber"})]}),o.jsxs("div",{className:"bg-card border border-border rounded-md p-3",children:[o.jsx("p",{className:"text-[10px] font-body font-bold uppercase tracking-wider text-muted-foreground mb-2",children:"Payout status (sold items)"}),h.sold===0?o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"No sold items in range."}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex h-3 w-full overflow-hidden rounded-sm border border-border mb-2",children:Object.entries(h.payoutBreakdown).map(([x,g])=>{const b=pN[x]||{label:x,color:"bg-muted-foreground"},y=g.count/h.sold*100;return o.jsx("div",{className:`${b.color} h-full`,style:{width:`${y}%`},title:`${b.label}: ${g.count} ($${Math.round(g.value).toLocaleString()})`},x)})}),o.jsx("div",{className:"space-y-1",children:Object.entries(h.payoutBreakdown).sort(([,x],[,g])=>g.count-x.count).map(([x,g])=>{const b=pN[x]||{label:x,color:"bg-muted-foreground"},y=Math.round(g.count/h.sold*100);return o.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-body",children:[o.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-sm ${b.color}`}),o.jsx("span",{className:"w-20 flex-shrink-0",children:b.label}),o.jsxs("span",{className:"flex-1 text-muted-foreground",children:[g.count," · $",Math.round(g.value).toLocaleString()]}),o.jsxs("span",{className:"font-semibold w-10 text-right",children:[y,"%"]})]},x)})})]})]}),o.jsxs("div",{className:"bg-card border border-border rounded-md p-3",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("p",{className:"text-[10px] font-body font-bold uppercase tracking-wider text-muted-foreground",children:"Payout aging (outstanding)"}),h.oldestOutstandingDays>0&&o.jsxs("p",{className:"text-[10px] font-body text-muted-foreground",children:["oldest:"," ",o.jsxs("span",{className:h.oldestOutstandingDays>60?"font-semibold text-red-600":h.oldestOutstandingDays>30?"font-semibold text-amber-600":"font-semibold text-foreground",children:[Math.round(h.oldestOutstandingDays),"d"]})]})]}),h.outstandingPayouts===0?o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"No outstanding payouts. 🎉"}):o.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[{key:"current",label:"0–30d",color:"bg-emerald-500",text:"text-emerald-700"},{key:"d30",label:"31–60d",color:"bg-amber-500",text:"text-amber-700"},{key:"d60",label:"61–90d",color:"bg-orange-500",text:"text-orange-700"},{key:"d90",label:"90d+",color:"bg-red-500",text:"text-red-700"}].map(x=>{const g=h.aging[x.key];return o.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-2",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:`inline-block w-2 h-2 rounded-sm ${x.color}`}),o.jsx("span",{className:"text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground",children:x.label})]}),o.jsxs("p",{className:`text-base font-bold font-display mt-0.5 ${x.text}`,children:["$",Math.round(g.value).toLocaleString()]}),o.jsxs("p",{className:"text-[10px] font-body text-muted-foreground",children:[g.count," payout",g.count===1?"":"s"]})]},x.key)})})]}),o.jsxs("div",{className:"bg-card border border-border rounded-md p-3",children:[o.jsx("p",{className:"text-[10px] font-body font-bold uppercase tracking-wider text-muted-foreground mb-2",children:"Pipeline funnel"}),o.jsx("div",{className:"space-y-1.5",children:[{key:"pending_review",label:"Pending",count:h.pending,color:"bg-amber-500"},{key:"approved",label:"Approved",count:h.statusBreakdown.approved||0,color:"bg-emerald-500"},{key:"listed",label:"Listed",count:h.listed,color:"bg-sky-500"},{key:"sold",label:"Sold",count:h.sold,color:"bg-violet-500"},{key:"declined",label:"Declined",count:h.declined,color:"bg-red-400"}].map(x=>
426{const g=Math.max(1,h.consignmentCount),b=x.count/g*100;return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-[11px] font-body text-muted-foreground w-16 flex-shrink-0",children:x.label}),o.jsx("div",{className:"flex-1 h-4 bg-muted rounded-sm overflow-hidden",children:o.jsx("div",{className:`h-full ${x.color} transition-all`,style:{width:`${Math.max(2,b)}%`}})}),o.jsx("span",{className:"text-[11px] font-body font-semibold w-10 text-right",children:x.count})]},x.key)})})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[o.jsxs("div",{className:"bg-card border border-border rounded-md p-3",children:[o.jsx("p",{className:"text-[10px] font-body font-bold uppercase tracking-wider text-muted-foreground mb-2",children:"Submissions over time"}),h.timeSeries.length===0?o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"No data"}):o.jsx("div",{className:"flex items-end gap-0.5 h-24",children:h.timeSeries.slice(-30).map(([x,g])=>o.jsx("div",{className:"flex-1 bg-primary/70 hover:bg-primary transition-colors rounded-t-sm relative group",style:{height:`${g/h.maxDay*100}%`,minHeight:"2px"},title:`${x}: ${g}`,children:o.jsx("span",{className:"absolute -top-5 left-1/2 -translate-x-1/2 text-[9px] font-body text-foreground opacity-0 group-hover:opacity-100 whitespace-nowrap pointer-events-none",children:g})},x))}),h.timeSeries.length>0&&o.jsxs("div",{className:"flex justify-between mt-1.5 text-[9px] font-body text-muted-foreground",children:[o.jsx("span",{children:h.timeSeries[0][0]}),o.jsx("span",{children:h.timeSeries[h.timeSeries.length-1][0]})]})]}),o.jsxs("div",{className:"bg-card border border-border rounded-md p-3",children:[o.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[o.jsx(n2,{size:12,className:"text-muted-foreground"}),o.jsx("p",{className:"text-[10px] font-body font-bold uppercase tracking-wider text-muted-foreground",children:"Top artists (recent)"})]}),h.topArtists.length===0?o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"No artist data"}):o.jsx("ul",{className:"space-y-1",children:h.topArtists.map(([x,g])=>o.jsxs("li",{className:"flex items-center justify-between gap-2 text-xs font-body",children:[o.jsx("span",{className:"truncate font-medium",children:x}),o.jsxs("span",{className:"text-muted-foreground flex-shrink-0",children:[g.count," · $",Math.round(g.value).toLocaleString()]})]},x))})]})]}),o.jsxs("div",{className:"bg-card border border-border rounded-md p-3",children:[o.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[o.jsx(Wo,{size:12,className:"text-violet-700"}),o.jsx("p",{className:"text-[10px] font-body font-bold uppercase tracking-wider text-muted-foreground",children:"Artist revenue leaderboard (by GMV)"})]}),h.artistLeaderboard.filter(x=>x.sold>0).length===0?o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"No artists with sold work in this range yet."}):o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full text-xs font-body",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"border-b border-border text-left",children:[o.jsx("th",{className:"pb-1.5 pr-2 font-semibold text-muted-foreground text-[10px] uppercase tracking-wider",children:"#"}),o.jsx("th",{className:"pb-1.5 pr-2 font-semibold text-muted-foreground text-[10px] uppercase tracking-wider",children:"Artist"}),o.jsx("th",{className:"pb-1.5 pr-2 font-semibold text-muted-foreground text-[10px] uppercase tracking-wider text-right",children:"GMV"}),o.jsx("th",{className:"pb-1.5 pr-2 font-semibold text-muted-foreground text-[10px] uppercase tracking-wider text-right",children:"Avg Sale"}),o.jsx("th",{className:"pb-1.5 pr-2 font-semibold text-muted-foreground text-[10px] uppercase tracking-wider text-right",children:"Sold / Subs"}),o.jsx("th",{className:"pb-1.5 font-semibold text-muted-foreground text-[10px] uppercase tracking-wider text-right",children:"Sell-thru"})]})}),o.jsx("tbody",{children:h.artistLeaderboard.filter(x=>x.sold>0).map((x,g)=>{const b=x.gmv/h.maxArtistGmv*100;return o.jsxs("tr",{className:"border-b border-border/40 last:border-b-0",children:[o.jsx("td",{className:"py-1.5 pr-2 text-muted-foreground font-semibold",children:g+1}),o.jsx("td",{className:"py-1.5 pr-2 font-medium max-w-[180px] truncate",title:x.name,children:x.name}),o.jsx("td",{className:"py-1.5 pr-2 text-right",children:o.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[o.jsx("div",{className:"w-12 h-1.5 bg-muted rounded-sm overflow-hidden hidden md:block",children:o.jsx("div",{className:"h-full bg-violet-500",style:{width:`${Math.max(2,b)}%`}})}),o.jsxs("span",{className:"font-semibold text-violet-700",children:["$",Math.round(x.gmv).toLocaleStr
426ing()]})]})}),o.jsxs("td",{className:"py-1.5 pr-2 text-right text-muted-foreground",children:["$",Math.round(x.avgSale).toLocaleString()]}),o.jsxs("td",{className:"py-1.5 pr-2 text-right text-muted-foreground",children:[x.sold," / ",x.submissions]}),o.jsx("td",{className:"py-1.5 text-right",children:o.jsxs("span",{className:`font-semibold ${x.sellThrough>=50?"text-emerald-700":x.sellThrough>=25?"text-amber-700":"text-muted-foreground"}`,children:[x.sellThrough,"%"]})})]},x.name)})})]})})]})]})]})]}):null},km=(e,t,n="count",r=!1)=>{const i=e-t;let s=null;return t===0&&e===0?s=null:t===0?s=e>0?100:-100:s=Math.round((e-t)/Math.abs(t)*100),{pct:s,abs:i,unit:n,inverse:r}},NU=({delta:e})=>{if(!e||e.pct===null)return o.jsx("span",{className:"text-[9px] font-body text-muted-foreground",children:"— vs prior"});const t=e.inverse?e.pct<0:e.pct>0,n=e.pct===0,r=n?"text-muted-foreground bg-muted":t?"text-emerald-700 bg-emerald-50":"text-red-700 bg-red-50",s=`${n?"→":e.pct>0?"↑":"↓"}${Math.abs(e.pct)}%`;return o.jsx("span",{className:`inline-flex items-center px-1.5 py-0.5 rounded-sm text-[9px] font-body font-bold ${r}`,title:`vs prior period (${e.abs>0?"+":""}${e.unit==="currency"?`$${Math.round(e.abs).toLocaleString()}`:e.unit==="pp"?`${e.abs}pp`:e.abs.toLocaleString()})`,children:s})},Dl=({icon:e,label:t,value:n,sub:r,accent:i,delta:s})=>{const a=i==="violet"?"text-violet-700":i==="emerald"?"text-emerald-700":i==="amber"?"text-amber-700":"text-foreground";return o.jsxs("div",{className:"bg-card border border-border rounded-md p-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground min-w-0",children:[e,o.jsx("p",{className:"text-[10px] font-body font-semibold uppercase tracking-wider truncate",children:t})]}),s!==void 0&&o.jsx(NU,{delta:s??null})]}),o.jsx("p",{className:`text-lg font-bold font-display mt-0.5 ${a}`,children:n}),r&&o.jsx("p",{className:"text-[10px] font-body text-muted-foreground mt-0.5 truncate",title:r,children:r})]})},SU=({isAdmin:e})=>{const[t,n]=k.useState([]),[r,i]=k.useState(!1),[s,a]=k.useState(e),l=async()=>{i(!0);try{const{data:d,error:u}=await Ne.functions.invoke("admin-submissions",{body:{}});if(u)throw u;if(d!=null&&d.success)n(d.data||[]);else throw new Error((d==null?void 0:d.error)||"Failed to fetch")}catch(d){me.error(d.message||"Failed to load submissions")}finally{i(!1)}};if(k.useEffect(()=>{s&&e&&l()},[s,e]),!e)return null;const c=d=>d.base_value+d.base_value*(d.scarcity_multiplier/100)+d.base_value*(d.provenance_uplift/100);return o.jsxs("div",{className:"border border-border rounded-sm p-5 bg-muted/30 space-y-4",children:[o.jsxs("button",{onClick:()=>a(!s),className:"flex items-center justify-between w-full",children:[o.jsx("h3",{className:"font-display text-lg font-bold tracking-wide",children:"All Submissions"}),o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`transition-transform ${s?"rotate-180":""}`,children:o.jsx("path",{d:"m6 9 6 6 6-6"})})]}),s&&o.jsxs("div",{className:"space-y-1",children:[r&&o.jsx("p",{className:"text-sm font-body text-muted-foreground",children:"Loading…"}),!r&&t.length===0&&o.jsx("p",{className:"text-sm font-body text-muted-foreground",children:"No submissions yet"}),!r&&t.length>0&&o.jsx("div",{className:"overflow-x-auto",children:o.jsxs("table",{className:"w-full text-sm font-body",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"border-b border-border text-left",children:[o.jsx("th",{className:"pb-2 pr-4 font-semibold text-muted-foreground",children:"User"}),o.jsx("th",{className:"pb-2 pr-4 font-semibold text-muted-foreground",children:"Artist"}),o.jsx("th",{className:"pb-2 pr-4 font-semibold text-muted-foreground",children:"Title"}),o.jsx("th",{className:"pb-2 pr-4 font-semibold text-muted-foreground text-right",children:"Value"}),o.jsx("th",{className:"pb-2 font-semibold text-muted-foreground",children:"Date"})]})}),o.jsx("tbody",{children:t.map(d=>{var u,f;return o.jsxs("tr",{className:"border-b border-border/50",children:[o.jsx("td",{className:"py-2 pr-4 text-muted-foreground",children:((u=d.profiles)==null?void 0:u.display_name)||((f=d.profiles)==null?void 0:f.email)||"—"}),o.jsx("td",{className:"py-2 pr-4 font-medium",children:d.artist_name||"—"}),o.jsx("td",{className:"py-2 pr-4 italic text-muted-foreground",children:d.artwork_title||"—"}),o.jsx("td",{className:"py-2 pr-4 text-right font-semibold",children:c(d)>
4260?`$${c(d).toLocaleString()}`:"—"}),o.jsx("td",{className:"py-2 text-muted-foreground",children:new Date(d.created_at).toLocaleDateString()})]},d.id)})})]})})]})]})};function Vt(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 $i(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Qr(e,t){const n=Vt(e);return isNaN(t)?$i(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function Ss(e,t){const n=Vt(e);if(isNaN(t))return $i(e,NaN);if(!t)return n;const r=n.getDate(),i=$i(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);const s=i.getDate();return r>=s?i:(n.setFullYear(i.getFullYear(),i.getMonth(),r),n)}const b2=6048e5,jU=864e5;let EU={};function np(){return EU}function fo(e,t){var l,c,d,u;const n=np(),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??((u=(d=n.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,i=Vt(e),s=i.getDay(),a=(s<r?7:0)+s-r;return i.setDate(i.getDate()-a),i.setHours(0,0,0,0),i}function pc(e){return fo(e,{weekStartsOn:1})}function WA(e){const t=Vt(e),n=t.getFullYear(),r=$i(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const i=pc(r),s=$i(e,0);s.setFullYear(n,0,4),s.setHours(0,0,0,0);const a=pc(s);return t.getTime()>=i.getTime()?n+1:t.getTime()>=a.getTime()?n:n-1}function xu(e){const t=Vt(e);return t.setHours(0,0,0,0),t}function l0(e){const t=Vt(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 no(e,t){const n=xu(e),r=xu(t),i=+n-l0(n),s=+r-l0(r);return Math.round((i-s)/jU)}function CU(e){const t=WA(e),n=$i(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),pc(n)}function s1(e,t){const n=t*7;return Qr(e,n)}function AU(e,t){return Ss(e,t*12)}function PU(e){let t;return e.forEach(function(n){const r=Vt(n);(t===void 0||t<r||isNaN(Number(r)))&&(t=r)}),t||new Date(NaN)}function LU(e){let t;return e.forEach(n=>{const r=Vt(n);(!t||t>r||isNaN(+r))&&(t=r)}),t||new Date(NaN)}function fi(e,t){const n=xu(e),r=xu(t);return+n==+r}function y2(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function RU(e){if(!y2(e)&&typeof e!="number")return!1;const t=Vt(e);return!isNaN(Number(t))}function Tf(e,t){const n=Vt(e),r=Vt(t),i=n.getFullYear()-r.getFullYear(),s=n.getMonth()-r.getMonth();return i*12+s}function TU(e,t,n){const r=fo(e,n),i=fo(t,n),s=+r-l0(r),a=+i-l0(i);return Math.round((s-a)/b2)}function w2(e){const t=Vt(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function vi(e){const t=Vt(e);return t.setDate(1),t.setHours(0,0,0,0),t}function HA(e){const t=Vt(e),n=$i(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function _2(e,t){var l,c,d,u;const n=np(),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??((u=(d=n.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,i=Vt(e),s=i.getDay(),a=(s<r?-7:0)+6-(s-r);return i.setDate(i.getDate()+a),i.setHours(23,59,59,999),i}function VA(e){return _2(e,{weekStartsOn:1})}const OU={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"}},IU=(e,t,n)=>{let r;const i=OU[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 Tv(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const DU={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},FU={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},MU={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$U={date:Tv({formats:DU,defaultWidth:"full"}),time:Tv({formats:FU,defaultWidth:"full"}),dateTime:Tv({formats:MU,defaultWidth:"full"})},BU={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},UU=(e,t,n,r)=>BU[e];function xh(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let i;if(r==="formatting"&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,l=n!=null&&n.width?String(n.width):a;i=e.formattingValues[l]||e.formattingValues[a]}else{const a=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[l]||e.values[a]}const s=e.argumentCallback?e.argumentCallback(t):t;return i[s]}}const zU={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},qU={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},WU={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"]},HU={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","Frid
426ay","Saturday"]},VU={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"}},GU={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"}},YU=(e,t)=>{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"},KU={ordinalNumber:YU,era:xh({values:zU,defaultWidth:"wide"}),quarter:xh({values:qU,defaultWidth:"wide",argumentCallback:e=>e-1}),month:xh({values:WU,defaultWidth:"wide"}),day:xh({values:HU,defaultWidth:"wide"}),dayPeriod:xh({values:VU,defaultWidth:"wide",formattingValues:GU,defaultFormattingWidth:"wide"})};function vh(e){return(t,n={})=>{const r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(i);if(!s)return null;const a=s[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?XU(l,f=>f.test(a)):JU(l,f=>f.test(a));let d;d=e.valueCallback?e.valueCallback(c):c,d=n.valueCallback?n.valueCallback(d):d;const u=t.slice(a.length);return{value:d,rest:u}}}function JU(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function XU(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function ZU(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const i=r[0],s=t.match(e.parsePattern);if(!s)return null;let a=e.valueCallback?e.valueCallback(s[0]):s[0];a=n.valueCallback?n.valueCallback(a):a;const l=t.slice(i.length);return{value:a,rest:l}}}const QU=/^(\d+)(th|st|nd|rd)?/i,ez=/\d+/i,tz={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},nz={any:[/^b/i,/^(a|c)/i]},rz={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},iz={any:[/1/i,/2/i,/3/i,/4/i]},sz={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},oz={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]},az={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},lz={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]},cz={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},dz={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}},uz={ordinalNumber:ZU({matchPattern:QU,parsePattern:ez,valueCallback:e=>parseInt(e,10)}),era:vh({matchPatterns:tz,defaultMatchWidth:"wide",parsePatterns:nz,defaultParseWidth:"any"}),quarter:vh({matchPatterns:rz,defaultMatchWidth:"wide",parsePatterns:iz,defaultParseWidth:"any",valueCallback:e=>e+1}),month:vh({matchPatterns:sz,defaultMatchWidth:"wide",parsePatterns:oz,defaultParseWidth:"any"}),day:vh({matchPatterns:az,defaultMatchWidth:"wide",parsePatterns:lz,defaultParseWidth:"any"}),dayPeriod:vh({matchPatterns:cz,defaultMatchWidth:"any",parsePatterns:dz,defaultParseWidth:"any"})},GA={code:"en-US",formatDistance:IU,formatLong:$U,formatRelative:UU,localize:KU,match:uz,options:{weekStartsOn:0,firstWeekContainsDate:1}};function hz(e){const t=Vt(e);return no(t,HA(t))+1}function YA(e){const t=Vt(e),n=+pc(t)-+CU(t);return Math.round(n/b2)+1}function KA(e,t){var u,f,p,h;const n=Vt(e),r=n.getFullYear(),i=np(),s=(t==null?void 0:t.firstWeekContainsDate)??((f=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)??i.firstWeekContainsDate??((h=(p=i.locale)==null?void 0:p.options)==null?void 0:h.firstWeekContainsDate)??1,a=$i(e,0);a.setFullYear(r+1,0,s),a.setHours(0,0,0,0);const l=fo(a,t),c=$i(e,0);c.setFullYear(r,0,s),c.setHours(0,0,0,0);const d=fo(c,t);return n.getTime()>=l.getTime()?r+1:n.getTime()>=d.getTime()?r:r-1}function fz(e,t){var l,c,d,u;const n=np(),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??((u=(d=n.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??1,i=KA(e,t),s=$i(e,0);return s.setFullYear(i,0,r),s.setHours(0,0,0,0),fo(s,t)}function JA(e,t){const n=Vt(e),r=+fo(n,t)-+fz(n,t);return Math.round(r/b2)+1}function Qt(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const wa={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return Qt(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Qt(n+1,2)},d(e,t){return Qt(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 Qt(e.getHours()%12||12,t.length)},H(e,t){return Qt(e.getHours(),t.length)},m(e,t){return Qt(e.getMinutes(),t.length)},s(e,t){return Qt(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return Qt(i,t.length)}},rd={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},mN={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 wa.y(e,t)},Y:function(e,t,n,r){const i=KA(e,r),s=i>0?i:1-i;if(t==="YY"){const a=s%100;return Qt(a,2)}return t==="Yo"?n.ordinalNumber(s,{unit:"year"}):Qt(s,t.length)},R:function(e,t){const n=WA(e);return Qt(n,t.length)},u:function(e,t){const n=e.getFullYear();return Qt(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 Qt(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 Qt(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 wa.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 Qt(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=JA(e,r);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):Qt(i,t.length)},I:function(e,t,n){const r=YA(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):Qt(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):wa.d(e,t)},D:function(e,t,n){const r=hz(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Qt(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(),s=(i-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return Qt(s,2);case"eo":return n.ordinalNumber(s,{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(),s=(i-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return Qt(s,t.length);case"co":return n.ordinalNumber(s,{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 Qt(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=rd.noon:r===0?i=rd.midnight:i=r/12>
vendor: 4,693 bytes, line 426
426=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=rd.evening:r>=12?i=rd.afternoon:r>=4?i=rd.morning:i=rd.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 wa.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):wa.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Qt(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):Qt(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):wa.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):wa.s(e,t)},S:function(e,t){return wa.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return xN(r);case"XXXX":case"XX":return Ul(r);case"XXXXX":case"XXX":default:return Ul(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return xN(r);case"xxxx":case"xx":return Ul(r);case"xxxxx":case"xxx":default:return Ul(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+gN(r,":");case"OOOO":default:return"GMT"+Ul(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+gN(r,":");case"zzzz":default:return"GMT"+Ul(r,":")}},t:function(e,t,n){const r=Math.trunc(e.getTime()/1e3);return Qt(r,t.length)},T:function(e,t,n){const r=e.getTime();return Qt(r,t.length)}};function gN(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Math.trunc(r/60),s=r%60;return s===0?n+String(i):n+String(i)+t+Qt(s,2)}function xN(e,t){return e%60===0?(e>0?"-":"+")+Qt(Math.abs(e)/60,2):Ul(e,t)}function Ul(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Qt(Math.trunc(r/60),2),s=Qt(r%60,2);return n+i+t+s}const vN=(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"})}},XA=(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"})}},pz=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return vN(e,t);let s;switch(r){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;case"PPPP":default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",vN(r,t)).replace("{{time}}",XA(i,t))},mz={p:XA,P:pz},gz=/^D+$/,xz=/^Y+$/,vz=["D","DD","YY","YYYY"];function bz(e){return gz.test(e)}function yz(e){return xz.test(e)}function wz(e,t,n){const r=_z(e,t,n);if(console.warn(r),vz.includes(e))throw new RangeError(r)}function _z(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 kz=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Nz=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Sz=/^'([^]*?)'?$/,jz=/''/g,Ez=/[a-zA-Z]/;function fl(e,t,n){var u,f,p,h,x,g,b,y;const r=np(),i=(n==null?void 0:n.locale)??r.locale??GA,s=(n==null?void 0:n.firstWeekContainsDate)??((f=(u=n==null?void 0:n.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)??r.firstWeekContainsDate??((h=(p=r.locale)==null?void 0:p.options)==null?void 0:h.firstWeekContainsDate)??1,a=(n==null?void 0:n.weekStartsOn)??((g=(x=n==null?void 0:n.locale)==null?void 0:x.options)==null?void 0:g.weekStartsOn)??r.weekStartsOn??((y=(b=r.locale)==null?void 0:b.options)==null?void 0:y.weekStartsOn)??0,l=Vt(e);if(!RU(l))throw new RangeError("Invalid time value");let c=t.match(Nz).map(_=>{const w=_[0];if(w==="p"||w==="P"){const S=mz[w];return S(_,i.formatLong)}return _}).join("").match(kz).map(_=>{if(_==="''")return{isToken:!1,value:"'"};const w=_[0];if(w==="'")return{isToken:!1,value:Cz(_)};if(mN[w])return{isToken:!0,value:_};
426if(w.match(Ez))throw new RangeError("Format string contains an unescaped latin alphabet character `"+w+"`");return{isToken:!1,value:_}});i.localize.preprocessor&&(c=i.localize.preprocessor(l,c));const d={firstWeekContainsDate:s,weekStartsOn:a,locale:i};return c.map(_=>{if(!_.isToken)return _.value;const w=_.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&yz(w)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&bz(w))&&wz(w,t,String(e));const S=mN[w[0]];return S(l,w,i.localize,d)}).join("")}function Cz(e){const t=e.match(Sz);return t?t[1].replace(jz,"'"):e}function Az(e){const t=Vt(e),n=t.getFullYear(),r=t.getMonth(),i=$i(e,0);return i.setFullYear(n,r+1,0),i.setHours(0,0,0,0),i.getDate()}function Pz(e){return Math.trunc(+Vt(e)/1e3)}function Lz(e){const t=Vt(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}function Rz(e,t){return TU(Lz(e),vi(e),t)+1}function o1(e,t){const n=Vt(e),r=Vt(t);return n.getTime()>r.getTime()}function ZA(e,t){const n=Vt(e),r=Vt(t);return+n<+r}function k2(e,t){const n=Vt(e),r=Vt(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function Tz(e,t){const n=Vt(e),r=Vt(t);return n.getFullYear()===r.getFullYear()}function Ov(e,t){return Qr(e,-t)}function Iv(e,t){const n=Vt(e),r=n.getFullYear(),i=n.getDate(),s=$i(e,0);s.setFullYear(r,t,15),s.setHours(0,0,0,0);const a=Az(s);return n.setMonth(t,Math.min(i,a)),n}function bN(e,t){const n=Vt(e);return isNaN(+n)?$i(e,NaN):(n.setFullYear(t),n)}const Oz="modulepreload",Iz=function(e){return"/"+e},yN={},Dv=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=Iz(c),c in yN)return;yN[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":Oz,d||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),d)return new Promise((p,h)=>{f.addEventListener("load",p),f.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return i.then(a=>{for(const l of a||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})};function en(e){"@babel/helpers - typeof";return en=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},en(e)}var js=Uint8Array,Oi=Uint16Array,N2=Int32Array,S2=new js([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]),j2=new js([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]),wN=new js([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),QA=function(e,t){for(var n=new Oi(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new N2(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return{b:n,r:i}},e6=QA(S2,2),Dz=e6.b,a1=e6.r;Dz[28]=258,a1[258]=28;var Fz=QA(j2,0),_N=Fz.r,l1=new Oi(32768);for(var wn=0;wn<32768;++wn){var _a=(wn&43690)>>1|(wn&21845)<<1;_a=(_a&52428)>>2|(_a&13107)<<2,_a=(_a&61680)>>4|(_a&3855)<<4,l1[wn]=((_a&65280)>>8|(_a&255)<<8)>>1}var Yh=function(e,t,n){for(var r=e.length,i=0,s=new Oi(t);i<r;++i)e[i]&&++s[e[i]-1];var a=new Oi(t);for(i=1;i<t;++i)a[i]=a[i-1]+s[i-1]<<1;var l;if(n){l=new Oi(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var d=i<<4|e[i],u=t-e[i],f=a[e[i]-1]++<<u,p=f|(1<<u)-1;f<=p;++f)l[l1[f]>>c]=d}else for(l=new Oi(r),i=0;i<r;++i)e[i]&&(l[i]=l1[a[e[i]-1]++]>>15-e[i]);return l},mc=new js(288);for(var wn=0;wn<144;++wn)mc[wn]=8;for(var wn=144;wn<256;++wn)mc[wn]=9;for(var wn=256;wn<280;++wn)mc[wn]=7;for(var wn=280;wn<288;++wn)mc[wn]=8;var c0=new js(32);for(var wn=0;wn<32;++wn)c0[wn]=5;var Mz=Yh(mc,9,0),$z=Yh(c0,5,0),t6=function(e){return(e+7)/8|0},Bz=function(e,t,n){return(n==null||n>e.length)&&(n=e.length),new js(e.subarray(t,n))},Co=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},bh=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},Fv=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,s=n.slice();if(!i)return{t:r6,l:0};if(i==1){var a=new js(n[0].s+1);return a[n[0].s]=1,{t:a,l:1}}n.sort(function(C,P){return C.f-P.f}),n.push({s:-1,f:25001});var l=n[0],c=n[1],d=0,u=1,f=2;for(n[0]={s:-1,f:l.f+c.f,l,r:c};u!=i-1;)l=n[n[d].f<n[f].f?d++:f++],c=n[d!=u&&n[d].f<n[f].f?d++:f++],n[u++]={s:-1,f:l.f+c.f,l,r:c};for(var p=s[0].s,r=1;r<i;++r)s[r].s>p&&(p=s[r].s);var h=new Oi(p+1),x=c1(n[u-1],h,0);if(x>t){var r=0,g=0,b=x-t,y=1<<b;for(s.sort(function(P,R){return h[R.s]-h[P.s]||P.f-R.f});r<i;++r){var _=s[r].s;if(h[_]>
vendor: 1,670 bytes, line 426
426t)g+=y-(1<<x-h[_]),h[_]=t;else break}for(g>>=b;g>0;){var w=s[r].s;h[w]<t?g-=1<<t-h[w]++-1:++r}for(;r>=0&&g;--r){var S=s[r].s;h[S]==t&&(--h[S],++g)}x=t}return{t:new js(h),l:x}},c1=function(e,t,n){return e.s==-1?Math.max(c1(e.l,t,n+1),c1(e.r,t,n+1)):t[e.s]=n},kN=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Oi(++t),r=0,i=e[0],s=1,a=function(c){n[r++]=c},l=1;l<=t;++l)if(e[l]==i&&l!=t)++s;else{if(!i&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(i),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(i);s=1,i=e[l]}return{c:n.subarray(0,r),n:t}},yh=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},n6=function(e,t,n){var r=n.length,i=t6(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var s=0;s<r;++s)e[i+s+4]=n[s];return(i+4+r)*8},NN=function(e,t,n,r,i,s,a,l,c,d,u){Co(t,u++,n),++i[256];for(var f=Fv(i,15),p=f.t,h=f.l,x=Fv(s,15),g=x.t,b=x.l,y=kN(p),_=y.c,w=y.n,S=kN(g),C=S.c,P=S.n,R=new Oi(19),M=0;M<_.length;++M)++R[_[M]&31];for(var M=0;M<C.length;++M)++R[C[M]&31];for(var T=Fv(R,7),H=T.t,A=T.l,O=19;O>4&&!H[wN[O-1]];--O);var K=d+5<<3,U=yh(i,mc)+yh(s,c0)+a,I=yh(i,p)+yh(s,g)+a+14+3*O+yh(R,H)+2*R[16]+3*R[17]+7*R[18];if(c>=0&&K<=U&&K<=I)return n6(t,u,e.subarray(c,c+d));var re,V,$,D;if(Co(t,u,1+(I<U)),u+=2,I<U){re=Yh(p,h,0),V=p,$=Yh(g,b,0),D=g;var ie=Yh(H,A,0);Co(t,u,w-257),Co(t,u+5,P-1),Co(t,u+10,O-4),u+=14;for(var M=0;M<O;++M)Co(t,u+3*M,H[wN[M]]);u+=3*O;for(var X=[_,C],E=0;E<2;++E)for(var q=X[E],M=0;M<q.length;++M){var F=q[M]&31;Co(t,u,ie[F]),u+=H[F],F>15&&(Co(t,u,q[M]>>5&127),u+=q[M]>>12)}}else re=Mz,V=mc,$=$z,D=c0;for(var M=0;M<l;++M){var Z=r[M];if(Z>
vendor: 10,469 bytes, lines 426-427
426255){var F=Z>>18&31;bh(t,u,re[F+257]),u+=V[F+257],F>7&&(Co(t,u,Z>>23&31),u+=S2[F]);var Y=Z&31;bh(t,u,$[Y]),u+=D[Y],Y>3&&(bh(t,u,Z>>5&8191),u+=j2[Y])}else bh(t,u,re[Z]),u+=V[Z]}return bh(t,u,re[256]),u+V[256]},Uz=new N2([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),r6=new js(0),zz=function(e,t,n,r,i,s){var a=s.z||e.length,l=new js(r+a+5*(1+Math.ceil(a/7e3))+i),c=l.subarray(r,l.length-i),d=s.l,u=(s.r||0)&7;if(t){u&&(c[0]=s.r>>3);for(var f=Uz[t-1],p=f>>13,h=f&8191,x=(1<<n)-1,g=s.p||new Oi(32768),b=s.h||new Oi(x+1),y=Math.ceil(n/3),_=2*y,w=function(qe){return(e[qe]^e[qe+1]<<y^e[qe+2]<<_)&x},S=new N2(25e3),C=new Oi(288),P=new Oi(32),R=0,M=0,T=s.i||0,H=0,A=s.w||0,O=0;T+2<a;++T){var K=w(T),U=T&32767,I=b[K];if(g[U]=I,b[K]=U,A<=T){var re=a-T;if((R>7e3||H>24576)&&(re>423||!d)){u=NN(e,c,0,S,C,P,M,H,O,T-O,u),H=R=M=0,O=T;for(var V=0;V<286;++V)C[V]=0;for(var V=0;V<30;++V)P[V]=0}var $=2,D=0,ie=h,X=U-I&32767;if(re>2&&K==w(T-X))for(var E=Math.min(p,re)-1,q=Math.min(32767,T),F=Math.min(258,re);X<=q&&--ie&&U!=I;){if(e[T+$]==e[T+$-X]){for(var Z=0;Z<F&&e[T+Z]==e[T+Z-X];++Z);if(Z>$){if($=Z,D=X,Z>E)break;for(var Y=Math.min(X,Z-2),ee=0,V=0;V<Y;++V){var ce=T-X+V&32767,ue=g[ce],ye=ce-ue&32767;ye>ee&&(ee=ye,I=ce)}}}U=I,I=g[U],X+=U-I&32767}if(D){S[H++]=268435456|a1[$]<<18|_N[D];var Se=a1[$]&31,De=_N[D]&31;M+=S2[Se]+j2[De],++C[257+Se],++P[De],A=T+$,++R}else S[H++]=e[T],++C[e[T]]}}for(T=Math.max(T,A);T<a;++T)S[H++]=e[T],++C[e[T]];u=NN(e,c,d,S,C,P,M,H,O,T-O,u),d||(s.r=u&7|c[u/8|0]<<3,u-=7,s.h=b,s.p=g,s.i=T,s.w=A)}else{for(var T=s.w||0;T<a+d;T+=65535){var Re=T+65535;Re>=a&&(c[u/8|0]=d,Re=a),u=n6(c,u+1,e.subarray(T,Re))}s.i=a}return Bz(l,0,r+t6(u)+i)},i6=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,s=n.length|0,a=0;a!=s;){for(var l=Math.min(a+2655,s);a<l;++a)i+=r+=n[a];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},qz=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),a=new js(s.length+e.length);a.set(s),a.set(e,s.length),e=a,i.w=s.length}return zz(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},s6=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},Wz=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=i6();i.p(t.dictionary),s6(e,2,i.d())}};function d1(e,t){t||(t={});var n=i6();n.p(e);var r=qz(e,t,t.dictionary?6:2,4);return Wz(r,t),s6(r,r.length-4,n.d()),r}var Hz=typeof TextDecoder<"u"&&new TextDecoder,Vz=0;try{Hz.decode(r6,{stream:!0}),Vz=1}catch{}function Gz(e){if(Array.isArray(e))return e}function Yz(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,s,a,l=[],c=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(c=(r=s.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(u){d=!0,i=u}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(d)throw i}}return l}}function SN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Kz(e,t){if(e){if(typeof e=="string")return SN(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?SN(e,t):void 0}}function Jz(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
427In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jN(e,t){return Gz(e)||Yz(e,t)||Kz(e,t)||Jz()}function EN(e,t="utf8"){return new TextDecoder(t).decode(e)}const Xz=new TextEncoder;function Zz(e){return Xz.encode(e)}const Qz=1024*8,eq=(()=>{const e=new Uint8Array(4),t=new Uint32Array(e.buffer);return!((t[0]=1)&e[0])})(),Mv={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class E2{constructor(t=Qz,n={}){Zt(this,"buffer");Zt(this,"byteLength");Zt(this,"byteOffset");Zt(this,"length");Zt(this,"offset");Zt(this,"lastWrittenByte");Zt(this,"littleEndian");Zt(this,"_data");Zt(this,"_mark");Zt(this,"_marks");let r=!1;typeof t=="number"?t=new ArrayBuffer(t):(r=!0,this.lastWrittenByte=t.byteLength);const i=n.offset?n.offset>>>0:0,s=t.byteLength-i;let a=i;(ArrayBuffer.isView(t)||t instanceof E2)&&(t.byteLength!==t.buffer.byteLength&&(a=t.byteOffset+i),t=t.buffer),r?this.lastWrittenByte=s:this.lastWrittenByte=0,this.buffer=t,this.length=s,this.byteLength=s,this.byteOffset=a,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,a,s),this._mark=0,this._marks=[]}available(t=1){return this.offset+t<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(t=1){return this.offset+=t,this}back(t=1){return this.offset-=t,this}seek(t){return this.offset=t,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const t=this._marks.pop();if(t===void 0)throw new Error("Mark stack empty");return this.seek(t),this}rewind(){return this.offset=0,this}ensureAvailable(t=1){if(!this.available(t)){const r=(this.offset+t)*2,i=new Uint8Array(r);i.set(new Uint8Array(this.buffer)),this.buffer=i.buffer,this.length=r,this.byteLength=r,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(t=1){return this.readArray(t,"uint8")}readArray(t,n){const r=Mv[n].BYTES_PER_ELEMENT*t,i=this.byteOffset+this.offset,s=this.buffer.slice(i,i+r);if(this.littleEndian===eq&&n!=="uint8"&&n!=="int8"){const l=new Uint8Array(this.buffer.slice(i,i+r));l.reverse();const c=new Mv[n](l.buffer);return this.offset+=r,c.reverse(),c}const a=new Mv[n](s);return this.offset+=r,a}readInt16(){const t=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}readUint16(){const t=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,t}readInt32(){const t=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}readUint32(){const t=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat32(){const t=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat64(){const t=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}readBigInt64(){const t=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,t}readBigUint64(){const t=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,t}readChar(){return String.fromCharCode(this.readInt8())}readChars(t=1){let n="";for(let r=0;r<t;r++)n+=this.readChar();return n}readUtf8(t=1){return EN(this.readBytes(t))}decodeText(t=1,n="utf8"){return EN(this.readBytes(t),n)}writeBoolean(t){return this.writeUint8(t?255:0),this}writeInt8(t){return this.ensureAvailable(1),this._data.setInt8(this.offset++,t),this._updateLastWrittenByte(),this}writeUint8(t){return this.ensureAvailable(1),this._data.setUint8(this.offset++,t),this._updateLastWrittenByte(),this}writeByte(t){return this.writeUint8(t)}writeBytes(t){this.ensureAvailable(t.length);for(let n=0;n<t.length;n++)this._data.setUint8(this.offset++,t[n]);return this._updateLastWrittenByte(),this}writeInt16(t){return this.ensureAvailable(2),this._data.setInt16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(t){return this.ensureAvailable(2),this._data.setUint16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(t){return this.ensureAvailable(4),this._data.setInt32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(t){return this.ensureAvailable(4),this._data.setUint32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(t){return this.ensureAvailable(4),this._data.setFloat32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(t){return this.ensureAvailable(8),this._data.setFloat64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(t){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(t){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(t){return this.writeUint8(t.charCodeAt(0))}writeChars(t){for(let n=0;n<t.length;n++)this.writeUint8(t.charCodeAt(n));return this}writeUtf8(t){return this.writeBytes(Zz(t))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const tq=4,CN=0,AN=1,nq=2;function Ru(e){let t=e.length;for(;--t>=0;)e[t]=0}const rq=0,o6=1,iq=2,sq=3,oq=258,C2=29,rp=256,Of=rp+1+C2,Hd=30,A2=19,a6=2*Of+1,Jl=15,$v=16,aq=7,P2=256,l6=16,c6=17,d6=18,u1=new Uint8Array([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]),ug=new Uint8Array([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]),lq=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),u6=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),cq=512,Mo=new Array((Of+2)*2);Ru(Mo);const Kh=new Array(Hd*2);Ru(Kh);const If=new Array(cq);Ru(If);const Df=new Array(oq-sq+1);Ru(Df);const L2=new Array(C2);Ru(L2);const d0=new Array(Hd);Ru(d0);function Bv(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let h6,f6,p6;function Uv(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const m6=e=>e<256?If[e]:If[256+(e>>>7)],Ff=(e,t)=>
vendor: 44,991 bytes, line 427
427{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},pi=(e,t,n)=>{e.bi_valid>$v-n?(e.bi_buf|=t<<e.bi_valid&65535,Ff(e,e.bi_buf),e.bi_buf=t>>$v-e.bi_valid,e.bi_valid+=n-$v):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},eo=(e,t,n)=>{pi(e,n[t*2],n[t*2+1])},g6=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},dq=e=>{e.bi_valid===16?(Ff(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},uq=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,s=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,l=t.stat_desc.extra_base,c=t.stat_desc.max_length;let d,u,f,p,h,x,g=0;for(p=0;p<=Jl;p++)e.bl_count[p]=0;for(n[e.heap[e.heap_max]*2+1]=0,d=e.heap_max+1;d<a6;d++)u=e.heap[d],p=n[n[u*2+1]*2+1]+1,p>c&&(p=c,g++),n[u*2+1]=p,!(u>r)&&(e.bl_count[p]++,h=0,u>=l&&(h=a[u-l]),x=n[u*2],e.opt_len+=x*(p+h),s&&(e.static_len+=x*(i[u*2+1]+h)));if(g!==0){do{for(p=c-1;e.bl_count[p]===0;)p--;e.bl_count[p]--,e.bl_count[p+1]+=2,e.bl_count[c]--,g-=2}while(g>0);for(p=c;p!==0;p--)for(u=e.bl_count[p];u!==0;)f=e.heap[--d],!(f>r)&&(n[f*2+1]!==p&&(e.opt_len+=(p-n[f*2+1])*n[f*2],n[f*2+1]=p),u--)}},x6=(e,t,n)=>{const r=new Array(Jl+1);let i=0,s,a;for(s=1;s<=Jl;s++)i=i+n[s-1]<<1,r[s]=i;for(a=0;a<=t;a++){let l=e[a*2+1];l!==0&&(e[a*2]=g6(r[l]++,l))}},hq=()=>{let e,t,n,r,i;const s=new Array(Jl+1);for(n=0,r=0;r<C2-1;r++)for(L2[r]=n,e=0;e<1<<u1[r];e++)Df[n++]=r;for(Df[n-1]=r,i=0,r=0;r<16;r++)for(d0[r]=i,e=0;e<1<<ug[r];e++)If[i++]=r;for(i>>=7;r<Hd;r++)for(d0[r]=i<<7,e=0;e<1<<ug[r]-7;e++)If[256+i++]=r;for(t=0;t<=Jl;t++)s[t]=0;for(e=0;e<=143;)Mo[e*2+1]=8,e++,s[8]++;for(;e<=255;)Mo[e*2+1]=9,e++,s[9]++;for(;e<=279;)Mo[e*2+1]=7,e++,s[7]++;for(;e<=287;)Mo[e*2+1]=8,e++,s[8]++;for(x6(Mo,Of+1,s),e=0;e<Hd;e++)Kh[e*2+1]=5,Kh[e*2]=g6(e,5);h6=new Bv(Mo,u1,rp+1,Of,Jl),f6=new Bv(Kh,ug,0,Hd,Jl),p6=new Bv(new Array(0),lq,0,A2,aq)},v6=e=>{let t;for(t=0;t<Of;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Hd;t++)e.dyn_dtree[t*2]=0;for(t=0;t<A2;t++)e.bl_tree[t*2]=0;e.dyn_ltree[P2*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},b6=e=>{e.bi_valid>8?Ff(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},PN=(e,t,n,r)=>{const i=t*2,s=n*2;return e[i]<e[s]||e[i]===e[s]&&r[t]<=r[n]},zv=(e,t,n)=>{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&PN(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!PN(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r},LN=(e,t,n)=>{let r,i,s=0,a,l;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+s++]&255,r+=(e.pending_buf[e.sym_buf+s++]&255)<<8,i=e.pending_buf[e.sym_buf+s++],r===0?eo(e,i,t):(a=Df[i],eo(e,a+rp+1,t),l=u1[a],l!==0&&(i-=L2[a],pi(e,i,l)),r--,a=m6(r),eo(e,a,n),l=ug[a],l!==0&&(r-=d0[a],pi(e,r,l)));while(s<e.sym_next);eo(e,P2,t)},h1=(e,t)=>{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,s=t.stat_desc.elems;let a,l,c=-1,d;for(e.heap_len=0,e.heap_max=a6,a=0;a<s;a++)n[a*2]!==0?(e.heap[++e.heap_len]=c=a,e.depth[a]=0):n[a*2+1]=0;for(;e.heap_len<2;)d=e.heap[++e.heap_len]=c<2?++c:0,n[d*2]=1,e.depth[d]=0,e.opt_len--,i&&(e.static_len-=r[d*2+1]);for(t.max_code=c,a=e.heap_len>>1;a>=1;a--)zv(e,n,a);d=s;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],zv(e,n,1),l=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=l,n[d*2]=n[a*2]+n[l*2],e.depth[d]=(e.depth[a]>=e.depth[l]?e.depth[a]:e.depth[l])+1,n[a*2+1]=n[l*2+1]=d,e.heap[1]=d++,zv(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],uq(e,t),x6(n,c,e.bl_count)},RN=(e,t,n)=>{let r,i=-1,s,a=t[0*2+1],l=0,c=7,d=4;for(a===0&&(c=138,d=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)s=a,a=t[(r+1)*2+1],!(++l<c&&s===a)&&(l<d?e.bl_tree[s*2]+=l:s!==0?(s!==i&&e.bl_tree[s*2]++,e.bl_tree[l6*2]++):l<=10?e.bl_tree[c6*2]++:e.bl_tree[d6*2]++,l=0,i=s,a===0?(c=138,d=3):s===a?(c=6,d=3):(c=7,d=4))},TN=(e,t,n)=>{let r,i=-1,s,a=t[0*2+1],l=0,c=7,d=4;for(a===0&&(c=138,d=3),r=0;r<=n;r++)if(s=a,a=t[(r+1)*2+1],!(++l<c&&s===a)){if(l<d)do eo(e,s,e.bl_tree);while(--l!==0);else s!==0?(s!==i&&(eo(e,s,e.bl_tree),l--),eo(e,l6,e.bl_tree),pi(e,l-3,2)):l<=10?(eo(e,c6,e.bl_tree),pi(e,l-3,3)):(eo(e,d6,e.bl_tree),pi(e,l-11,7));l=0,i=s,a===0?(c=138,d=3):s===a?(c=6,d=3):(c=7,d=4)}},fq=e=>{let t;for(RN(e,e.dyn_ltree,e.l_desc.max_code),RN(e,e.dyn_dtree,e.d_desc.max_code),h1(e,e.bl_desc),t=A2-1;t>=3&&e.bl_tree[u6[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},pq=(e,t,n,r)=>{let i;for(pi(e,t-257,5),pi(e,n-1,5),pi(e,r-4,4),i=0;i<r;i++)pi(e,e.bl_tree[u6[i]*2+1],3);TN(e,e.dyn_ltree,t-1),TN(e,e.dyn_dtree,n-1)},mq=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return CN;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return AN;for(n=32;n<rp;n++)if(e.dyn_ltree[n*2]!==0)return AN;return CN};let ON=!1;const gq=e=>{ON||(hq(),ON=!0),e.l_desc=new Uv(e.dyn_ltree,h6),e.d_desc=new Uv(e.dyn_dtree,f6),e.bl_desc=new Uv(e.bl_tree,p6),e.bi_buf=0,e.bi_valid=0,v6(e)},y6=(e,t,n,r)=>{pi(e,(rq<<1)+(r?1:0),3),b6(e),Ff(e,n),Ff(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},xq=e=>{pi(e,o6<<1,3),eo(e,P2,Mo),dq(e)},vq=(e,t,n,r)=>{let i,s,a=0;e.level>0?(e.strm.data_type===nq&&(e.strm.data_type=mq(e)),h1(e,e.l_desc),h1(e,e.d_desc),a=fq(e),i=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=i&&(i=s)):i=s=n+5,n+4<=i&&t!==-1?y6(e,t,n,r):e.strategy===tq||s===i?(pi(e,(o6<<1)+(r?1:0),3),LN(e,Mo,Kh)):(pi(e,(iq<<1)+(r?1:0),3),pq(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),LN(e,e.dyn_ltree,e.dyn_dtree)),v6(e),r&&b6(e)},bq=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(Df[n]+rp+1)*2]++,e.dyn_dtree[m6(t)*2]++),e.sym_next===e.sym_end);var yq=gq,wq=y6,_q=vq,kq=bq,Nq=xq,Sq={_tr_init:yq,_tr_stored_block:wq,_tr_flush_block:_q,_tr_tally:kq,_tr_align:Nq};const jq=(e,t,n,r)=>{let i=e&65535|0,s=e>>>16&65535|0,a=0;for(;n!==0;){a=n>2e3?2e3:n,n-=a;do i=i+t[r++]|0,s=s+i|0;while(--a);i%=65521,s%=65521}return i|s<<16|0};var Mf=jq;const Eq=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},Cq=new Uint32Array(Eq()),Aq=(e,t,n,r)=>{const i=Cq,s=r+n;e^=-1;for(let a=r;a<s;a++)e=e>>>8^i[(e^t[a])&255];return e^-1};var fr=Aq,vu={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ip={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Pq,_tr_stored_block:f1,_tr_flush_block:Lq,_tr_tally:el,_tr_align:Rq}=Sq,{Z_NO_FLUSH:tl,Z_PARTIAL_FLUSH:Tq,Z_FULL_FLUSH:Oq,Z_FINISH:Ji,Z_BLOCK:IN,Z_OK:Er,Z_STREAM_END:DN,Z_STREAM_ERROR:ao,Z_DATA_ERROR:Iq,Z_BUF_ERROR:qv,Z_DEFAULT_COMPRESSION:Dq,Z_FILTERED:Fq,Z_HUFFMAN_ONLY:Nm,Z_RLE:Mq,Z_FIXED:$q,Z_DEFAULT_STRATEGY:Bq,Z_UNKNOWN:Uq,Z_DEFLATED:tx}=ip,zq=9,qq=15,Wq=8,Hq=29,Vq=256,p1=Vq+1+Hq,Gq=30,Yq=19,Kq=2*p1+1,Jq=15,Dt=3,qa=258,lo=qa+Dt+1,Xq=32,bu=42,R2=57,m1=69,g1=73,x1=91,v1=103,Xl=113,Th=666,ti=1,Tu=2,gc=3,Ou=4,Zq=3,Zl=(e,t)=>(e.msg=vu[t],t),FN=e=>e*2-(e>4?9:0),Ta=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Qq=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)};let eW=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask,nl=eW;const Ai=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},Ii=(e,t)=>{Lq(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Ai(e.strm)},Kt=(e,t)=>{e.pending_buf[e.pending++]=t},wh=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},b1=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=Mf(e.adler,t,i,n):e.state.wrap===2&&(e.adler=fr(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},w6=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,s,a=e.prev_length,l=e.nice_match;const c=e.strstart>e.w_size-lo?e.strstart-(e.w_size-lo):0,d=e.window,u=e.w_mask,f=e.prev,p=e.strstart+qa;let h=d[r+a-1],x=d[r+a];e.prev_length>=e.good_match&&(n>>=2),l>e.lookahead&&(l=e.lookahead);do if(i=t,!(d[i+a]!==x||d[i+a-1]!==h||d[i]!==d[r]||d[++i]!==d[r+1])){r+=2,i++;do;while(d[++r]===d[++i]&&d[++r]===d[++i]&&d[++r]===d[++i]&&d[++r]===d[++i]&&d[++r]===d[++i]&&d[++r]===d[++i]&&d[++r]===d[++i]&&d[++r]===d[++i]&&r<p);if(s=qa-(p-r),r=p-qa,s>a){if(e.match_start=t,a=s,s>=l)break;h=d[r+a-1],x=d[r+a]}}while((t=f[t&u])>c&&--n!==0);return a<=e.lookahead?a:e.lookahead},yu=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-lo)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Qq(e),r+=t),e.strm.avail_in===0)break;if(n=b1(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=Dt)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=nl(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=nl(e,e.ins_h,e.window[i+Dt-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<Dt)););}while(e.lookahead<lo&&e.strm.avail_in!==0)},_6=(e,t)=>{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,s,a=0,l=e.strm.avail_in;do{if(r=65535,s=e.bi_valid+42>>3,e.strm.avail_out<s||(s=e.strm.avail_out-s,i=e.strstart-e.block_start,r>i+e.strm.avail_in&&(r=i+e.strm.avail_in),r>s&&(r=s),r<n&&(r===0&&t!==Ji||t===tl||r!==i+e.strm.avail_in)))break;a=t===Ji&&r===i+e.strm.avail_in?1:0,f1(e,0,0,a),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Ai(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(b1(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(a===0);return l-=e.strm.avail_in,l&&(l>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=l&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-l,e.strm.next_in),e.strstart),e.strstart+=l,e.insert+=l>e.w_size-e.insert?e.w_size-e.insert:l),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?Ou:t!==tl&&t!==Ji&&e.strm.avail_in===0&&e.strstart===e.block_start?Tu:(s=e.window_size-e.strstart,e.strm.avail_in>s&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,s+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),s>e.strm.avail_in&&(s=e.strm.avail_in),s&&(b1(e.strm,e.window,e.strstart,s),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.high_water<e.strstart&&(e.high_water=e.strstart),s=e.bi_valid+42>>3,s=e.pending_buf_size-s>65535?65535:e.pending_buf_size-s,n=s>e.w_size?e.w_size:s,i=e.strstart-e.block_start,(i>=n||(i||t===Ji)&&t!==tl&&e.strm.avail_in===0&&i<=s)&&(r=i>s?s:i,a=t===Ji&&e.strm.avail_in===0&&r===i?1:0,f1(e,e.block_start,r,a),e.block_start+=r,Ai(e.strm)),a?gc:ti)},Wv=(e,t)=>{let n,r;for(;;){if(e.lookahead<lo){if(yu(e),e.lookahead<lo&&t===tl)return ti;if(e.lookahead===0)break}if(n=0,e.lookahead>=Dt&&(e.ins_h=nl(e,e.ins_h,e.window[e.strstart+Dt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-lo&&(e.match_length=w6(e,n)),e.match_length>=Dt)if(r=el(e,e.strstart-e.match_start,e.match_length-Dt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Dt){e.match_length--;do e.strstart++,e.ins_h=nl(e,e.ins_h,e.window[e.strstart+Dt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=nl(e,e.ins_h,e.window[e.strstart+1]);else r=el(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Ii(e,!1),e.strm.avail_out===0))return ti}return e.insert=e.strstart<Dt-1?e.strstart:Dt-1,t===Ji?(Ii(e,!0),e.strm.avail_out===0?gc:Ou):e.sym_next&&(Ii(e,!1),e.strm.avail_out===0)?ti:Tu},id=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<lo){if(yu(e),e.lookahead<lo&&t===tl)return ti;if(e.lookahead===0)break}if(n=0,e.lookahead>=Dt&&(e.ins_h=nl(e,e.ins_h,e.window[e.strstart+Dt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=Dt-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-lo&&(e.match_length=w6(e,n),e.match_length<=5&&(e.strategy===Fq||e.match_length===Dt&&e.strstart-e.match_start>4096)&&(e.match_length=Dt-1)),e.prev_length>=Dt&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-Dt,r=el(e,e.strstart-1-e.prev_match,e.prev_length-Dt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=nl(e,e.ins_h,e.window[e.strstart+Dt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=Dt-1,e.strstart++,r&&(Ii(e,!1),e.strm.avail_out===0))return ti}else if(e.match_available){if(r=el(e,0,e.window[e.strstart-1]),r&&Ii(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return ti}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=el(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<Dt-1?e.strstart:Dt-1,t===Ji?(Ii(e,!0),e.strm.avail_out===0?gc:Ou):e.sym_next&&(Ii(e,!1),e.strm.avail_out===0)?ti:Tu},tW=(e,t)=>{let n,r,i,s;const a=e.window;for(;;){if(e.lookahead<=qa){if(yu(e),e.lookahead<=qa&&t===tl)return ti;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=Dt&&e.strstart>0&&(i=e.strstart-1,r=a[i],r===a[++i]&&r===a[++i]&&r===a[++i])){s=e.strstart+qa;do;while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&i<s);e.match_length=qa-(s-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Dt?(n=el(e,1,e.match_length-Dt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=el(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Ii(e,!1),e.strm.avail_out===0))return ti}return e.insert=0,t===Ji?(Ii(e,!0),e.strm.avail_out===0?gc:Ou):e.sym_next&&(Ii(e,!1),e.strm.avail_out===0)?ti:Tu},nW=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(yu(e),e.lookahead===0)){if(t===tl)return ti;break}if(e.match_length=0,n=el(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Ii(e,!1),e.strm.avail_out===0))return ti}return e.insert=0,t===Ji?(Ii(e,!0),e.strm.avail_out===0?gc:Ou):e.sym_next&&(Ii(e,!1),e.strm.avail_out===0)?ti:Tu};function qs(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const Oh=[new qs(0,0,0,0,_6),new qs(4,4,8,4,Wv),new qs(4,5,16,8,Wv),new qs(4,6,32,32,Wv),new qs(4,4,16,16,id),new qs(8,16,32,32,id),new qs(8,16,128,128,id),new qs(8,32,128,256,id),new qs(32,128,258,1024,id),new qs(32,258,258,4096,id)],rW=e=>{e.window_size=2*e.w_size,Ta(e.head),e.max_lazy_match=Oh[e.level].max_lazy,e.good_match=Oh[e.level].good_length,e.nice_match=Oh[e.level].nice_length,e.max_chain_length=Oh[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Dt-1,e.match_available=0,e.ins_h=0};function iW(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=tx,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Kq*2),this.dyn_dtree=new Uint16Array((2*Gq+1)*2),this.bl_tree=new Uint16Array((2*Yq+1)*2),Ta(this.dyn_ltree),Ta(this.dyn_dtree),Ta(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Jq+1),this.heap=new Uint16Array(2*p1+1),Ta(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*p1+1),Ta(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const sp=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==bu&&t.status!==R2&&t.status!==m1&&t.status!==g1&&t.status!==x1&&t.status!==v1&&t.status!==Xl&&t.status!==Th?1:0},k6=e=>{if(sp(e))return Zl(e,ao);e.total_in=e.total_out=0,e.data_type=Uq;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?R2:t.wrap?bu:Xl,e.adler=t.wrap===2?0:1,t.last_flush=-2,Pq(t),Er},N6=e=>{const t=k6(e);return t===Er&&rW(e.state),t},sW=(e,t)=>sp(e)||e.state.wrap!==2?ao:(e.state.gzhead=t,Er),S6=(e,t,n,r,i,s)=>{if(!e)return ao;let a=1;if(t===Dq&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>zq||n!==tx||r<8||r>15||t<0||t>9||s<0||s>$q||r===8&&a!==1)return Zl(e,ao);r===8&&(r=9);const l=new iW;return e.state=l,l.strm=e,l.status=bu,l.wrap=a,l.gzhead=null,l.w_bits=r,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=i+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+Dt-1)/Dt),l.window=new Uint8Array(l.w_size*2),l.head=new Uint16Array(l.hash_size),l.prev=new Uint16Array(l.w_size),l.lit_bufsize=1<<i+6,l.pending_buf_size=l.lit_bufsize*4,l.pending_buf=new Uint8Array(l.pending_buf_size),l.sym_buf=l.lit_bufsize,l.sym_end=(l.lit_bufsize-1)*3,l.level=t,l.strategy=s,l.method=n,N6(e)},oW=(e,t)=>S6(e,t,tx,qq,Wq,Bq),aW=(e,t)=>{if(sp(e)||t>IN||t<0)return e?Zl(e,ao):ao;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===Th&&t!==Ji)return Zl(e,e.avail_out===0?qv:ao);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Ai(e),e.avail_out===0)return n.last_flush=-1,Er}else if(e.avail_in===0&&FN(t)<=FN(r)&&t!==Ji)return Zl(e,qv);if(n.status===Th&&e.avail_in!==0)return Zl(e,qv);if(n.status===bu&&n.wrap===0&&(n.status=Xl),n.status===bu){let i=tx+(n.w_bits-8<<4)<<8,s=-1;if(n.strategy>=Nm||n.level<2?s=0:n.level<6?s=1:n.level===6?s=2:s=3,i|=s<<6,n.strstart!==0&&(i|=Xq),i+=31-i%31,wh(n,i),n.strstart!==0&&(wh(n,e.adler>>>16),wh(n,e.adler&65535)),e.adler=1,n.status=Xl,Ai(e),n.pending!==0)return n.last_flush=-1,Er}if(n.status===R2){if(e.adler=0,Kt(n,31),Kt(n,139),Kt(n,8),n.gzhead)Kt(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Kt(n,n.gzhead.time&255),Kt(n,n.gzhead.time>>8&255),Kt(n,n.gzhead.time>>16&255),Kt(n,n.gzhead.time>>24&255),Kt(n,n.level===9?2:n.strategy>=Nm||n.level<2?4:0),Kt(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Kt(n,n.gzhead.extra.length&255),Kt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=fr(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=m1;else if(Kt(n,0),Kt(n,0),Kt(n,0),Kt(n,0),Kt(n,0),Kt(n,n.level===9?2:n.strategy>=Nm||n.level<2?4:0),Kt(n,Zq),n.status=Xl,Ai(e),n.pending!==0)return n.last_flush=-1,Er}if(n.status===m1){if(n.gzhead.extra){let i=n.pending,s=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+s>n.pending_buf_size;){let l=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+l),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=fr(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=l,Ai(e),n.pending!==0)return n.last_flush=-1,Er;i=0,s-=l}let a=new Uint8Array(n.gzhead.extra);n.pending_buf.set(a.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending+=s,n.gzhead.hcrc&&n.pending>i&&(e.adler=fr(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=g1}if(n.status===g1){if(n.gzhead.name){let i=n.pending,s;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=fr(e.adler,n.pending_buf,n.pending-i,i)),Ai(e),n.pending!==0)return n.last_flush=-1,Er;i=0}n.gzindex<n.gzhead.name.length?s=n.gzhead.name.charCodeAt(n.gzindex++)&255:s=0,Kt(n,s)}while(s!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=fr(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=x1}if(n.status===x1){if(n.gzhead.comment){let i=n.pending,s;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=fr(e.adler,n.pending_buf,n.pending-i,i)),Ai(e),n.pending!==0)return n.last_flush=-1,Er;i=0}n.gzindex<n.gzhead.comment.length?s=n.gzhead.comment.charCodeAt(n.gzindex++)&255:s=0,Kt(n,s)}while(s!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=fr(e.adler,n.pending_buf,n.pending-i,i))}n.status=v1}if(n.status===v1){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Ai(e),n.pending!==0))return n.last_flush=-1,Er;Kt(n,e.adler&255),Kt(n,e.adler>>8&255),e.adler=0}if(n.status=Xl,Ai(e),n.pending!==0)return n.last_flush=-1,Er}if(e.avail_in!==0||n.lookahead!==0||t!==tl&&n.status!==Th){let i=n.level===0?_6(n,t):n.strategy===Nm?nW(n,t):n.strategy===Mq?tW(n,t):Oh[n.level].func(n,t);if((i===gc||i===Ou)&&(n.status=Th),i===ti||i===gc)return e.avail_out===0&&(n.last_flush=-1),Er;if(i===Tu&&(t===Tq?Rq(n):t!==IN&&(f1(n,0,0,!1),t===Oq&&(Ta(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Ai(e),e.avail_out===0))return n.last_flush=-1,Er}return t!==Ji?Er:n.wrap<=0?DN:(n.wrap===2?(Kt(n,e.adler&255),Kt(n,e.adler>>8&255),Kt(n,e.adler>>16&255),Kt(n,e.adler>>24&255),Kt(n,e.total_in&255),Kt(n,e.total_in>>8&255),Kt(n,e.total_in>>16&255),Kt(n,e.total_in>>24&255)):(wh(n,e.adler>>>16),wh(n,e.adler&65535)),Ai(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Er:DN)},lW=e=>{if(sp(e))return ao;const t=e.state.status;return e.state=null,t===Xl?Zl(e,Iq):Er},cW=(e,t)=>{let n=t.length;if(sp(e))return ao;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==bu||r.lookahead)return ao;if(i===1&&(e.adler=Mf(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(Ta(r.head),r.strstart=0,r.block_start=0,r.insert=0);let c=new Uint8Array(r.w_size);c.set(t.subarray(n-r.w_size,n),0),t=c,n=r.w_size}const s=e.avail_in,a=e.next_in,l=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,yu(r);r.lookahead>=Dt;){let c=r.strstart,d=r.lookahead-(Dt-1);do r.ins_h=nl(r,r.ins_h,r.window[c+Dt-1]),r.prev[c&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=c,c++;while(--d);r.strstart=c,r.lookahead=Dt-1,yu(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Dt-1,r.match_available=0,e.next_in=a,e.input=l,e.avail_in=s,r.wrap=i,Er};var dW=oW,uW=S6,hW=N6,fW=k6,pW=sW,mW=aW,gW=lW,xW=cW,vW="pako deflate (from Nodeca project)",Jh={deflateInit:dW,deflateInit2:uW,deflateReset:hW,deflateResetKeep:fW,deflateSetHeader:pW,deflate:mW,deflateEnd:gW,deflateSetDictionary:xW,deflateInfo:vW};const bW=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var yW=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)bW(n,r)&&(e[r]=n[r])}}return e},wW=e=>{let t=0;for(let r=0,i=e.length;r<i;r++)t+=e[r].length;const n=new Uint8Array(t);for(let r=0,i=0,s=e.length;r<s;r++){let a=e[r];n.set(a,i),i+=a.length}return n},nx={assign:yW,flattenChunks:wW};let j6=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{j6=!1}const $f=new Uint8Array(256);for(let e=0;e<256;e++)$f[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;$f[254]=$f[254]=1;var _W=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,s,a=e.length,l=0;for(i=0;i<a;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<a&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(l),s=0,i=0;s<l;i++)n=e.charCodeAt(i),(n&64512)===55296&&i+1<a&&(r=e.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[s++]=n:n<2048?(t[s++]=192|n>>>6,t[s++]=128|n&63):n<65536?(t[s++]=224|n>>>12,t[s++]=128|n>>>6&63,t[s++]=128|n&63):(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63,t[s++]=128|n>>>6&63,t[s++]=128|n&63);return t};const kW=(e,t)=>{if(t<65534&&e.subarray&&j6)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n};var NW=(e,t)=>{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const s=new Array(n*2);for(i=0,r=0;r<n;){let a=e[r++];if(a<128){s[i++]=a;continue}let l=$f[a];if(l>4){s[i++]=65533,r+=l-1;continue}for(a&=l===2?31:l===3?15:7;l>1&&r<n;)a=a<<6|e[r++]&63,l--;if(l>1){s[i++]=65533;continue}a<65536?s[i++]=a:(a-=65536,s[i++]=55296|a>>10&1023,s[i++]=56320|a&1023)}return kW(s,i)},SW=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+$f[e[n]]>t?n:t},Bf={string2buf:_W,buf2string:NW,utf8border:SW};function jW(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var E6=jW;const C6=Object.prototype.toString,{Z_NO_FLUSH:EW,Z_SYNC_FLUSH:CW,Z_FULL_FLUSH:AW,Z_FINISH:PW,Z_OK:u0,Z_STREAM_END:LW,Z_DEFAULT_COMPRESSION:RW,Z_DEFAULT_STRATEGY:TW,Z_DEFLATED:OW}=ip;function T2(e){this.options=nx.assign({level:RW,method:OW,chunkSize:16384,windowBits:15,memLevel:8,strategy:TW},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new E6,this.strm.avail_out=0;let n=Jh.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==u0)throw new Error(vu[n]);if(t.header&&Jh.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=Bf.string2buf(t.dictionary):C6.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=Jh.deflateSetDictionary(this.strm,r),n!==u0)throw new Error(vu[n]);this._dict_set=!0}}T2.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,s;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?PW:EW,typeof e=="string"?n.input=Bf.string2buf(e):C6.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(s===CW||s===AW)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=Jh.deflate(n,s),i===LW)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=Jh.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===u0;if(n.avail_out===0){this.onData(n.output);continue}if(s>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};T2.prototype.onData=function(e){this.chunks.push(e)};T2.prototype.onEnd=function(e){e===u0&&(this.result=nx.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const Sm=16209,IW=16191;var DW=function(t,n){let r,i,s,a,l,c,d,u,f,p,h,x,g,b,y,_,w,S,C,P,R,M,T,H;const A=t.state;r=t.next_in,T=t.input,i=r+(t.avail_in-5),s=t.next_out,H=t.output,a=s-(n-t.avail_out),l=s+(t.avail_out-257),c=A.dmax,d=A.wsize,u=A.whave,f=A.wnext,p=A.window,h=A.hold,x=A.bits,g=A.lencode,b=A.distcode,y=(1<<A.lenbits)-1,_=(1<<A.distbits)-1;e:do{x<15&&(h+=T[r++]<<x,x+=8,h+=T[r++]<<x,x+=8),w=g[h&y];t:for(;;){if(S=w>>>24,h>>>=S,x-=S,S=w>>>16&255,S===0)H[s++]=w&65535;else if(S&16){C=w&65535,S&=15,S&&(x<S&&(h+=T[r++]<<x,x+=8),C+=h&(1<<S)-1,h>>>=S,x-=S),x<15&&(h+=T[r++]<<x,x+=8,h+=T[r++]<<x,x+=8),w=b[h&_];n:for(;;){if(S=w>>>24,h>>>=S,x-=S,S=w>>>16&255,S&16){if(P=w&65535,S&=15,x<S&&(h+=T[r++]<<x,x+=8,x<S&&(h+=T[r++]<<x,x+=8)),P+=h&(1<<S)-1,P>c){t.msg="invalid distance too far back",A.mode=Sm;break e}if(h>>>=S,x-=S,S=s-a,P>S){if(S=P-S,S>u&&A.sane){t.msg="invalid distance too far back",A.mode=Sm;break e}if(R=0,M=p,f===0){if(R+=d-S,S<C){C-=S;do H[s++]=p[R++];while(--S);R=s-P,M=H}}else if(f<S){if(R+=d+f-S,S-=f,S<C){C-=S;do H[s++]=p[R++];while(--S);if(R=0,f<C){S=f,C-=S;do H[s++]=p[R++];while(--S);R=s-P,M=H}}}else if(R+=f-S,S<C){C-=S;do H[s++]=p[R++];while(--S);R=s-P,M=H}for(;C>2;)H[s++]=M[R++],H[s++]=M[R++],H[s++]=M[R++],C-=3;C&&(H[s++]=M[R++],C>1&&(H[s++]=M[R++]))}else{R=s-P;do H[s++]=H[R++],H[s++]=H[R++],H[s++]=H[R++],C-=3;while(C>2);C&&(H[s++]=H[R++],C>1&&(H[s++]=H[R++]))}}else if(S&64){t.msg="invalid distance code",A.mode=Sm;break e}else{w=b[(w&65535)+(h&(1<<S)-1)];continue n}break}}else if(S&64)if(S&32){A.mode=IW;break e}else{t.msg="invalid literal/length code",A.mode=Sm;break e}else{w=g[(w&65535)+(h&(1<<S)-1)];continue t}break}}while(r<i&&s<l);C=x>>3,r-=C,x-=C<<3,h&=(1<<x)-1,t.next_in=r,t.next_out=s,t.avail_in=r<i?5+(i-r):5-(r-i),t.avail_out=s<l?257+(l-s):257-(s-l),A.hold=h,A.bits=x};const sd=15,MN=852,$N=592,BN=0,Hv=1,UN=2,FW=new Uint16Array([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,0,0]),MW=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),$W=new Uint16Array([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,0,0]),BW=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),UW=(e,t,n,r,i,s,a,l)=>{const c=l.bits;let d=0,u=0,f=0,p=0,h=0,x=0,g=0,b=0,y=0,_=0,w,S,C,P,R,M=null,T;const H=new Uint16Array(sd+1),A=new Uint16Array(sd+1);let O=null,K,U,I;for(d=0;d<=sd;d++)H[d]=0;for(u=0;u<r;u++)H[t[n+u]]++;for(h=c,p=sd;p>=1&&H[p]===0;p--);if(h>p&&(h=p),p===0)return i[s++]=1<<24|64<<16|0,i[s++]=1<<24|64<<16|0,l.bits=1,0;for(f=1;f<p&&H[f]===0;f++);for(h<f&&(h=f),b=1,d=1;d<=sd;d++)if(b<<=1,b-=H[d],b<0)return-1;if(b>0&&(e===BN||p!==1))return-1;for(A[1]=0,d=1;d<sd;d++)A[d+1]=A[d]+H[d];for(u=0;u<r;u++)t[n+u]!==0&&(a[A[t[n+u]]++]=u);if(e===BN?(M=O=a,T=20):e===Hv?(M=FW,O=MW,T=257):(M=$W,O=BW,T=0),_=0,u=0,d=f,R=s,x=h,g=0,C=-1,y=1<<h,P=y-1,e===Hv&&y>MN||e===UN&&y>$N)return 1;for(;;){K=d-g,a[u]+1<T?(U=0,I=a[u]):a[u]>=T?(U=O[a[u]-T],I=M[a[u]-T]):(U=96,I=0),w=1<<d-g,S=1<<x,f=S;do S-=w,i[R+(_>>g)+S]=K<<24|U<<16|I|0;while(S!==0);for(w=1<<d-1;_&w;)w>>=1;if(w!==0?(_&=w-1,_+=w):_=0,u++,--H[d]===0){if(d===p)break;d=t[n+a[u]]}if(d>h&&(_&P)!==C){for(g===0&&(g=h),R+=f,x=d-g,b=1<<x;x+g<p&&(b-=H[x+g],!(b<=0));)x++,b<<=1;if(y+=1<<x,e===Hv&&y>MN||e===UN&&y>$N)return 1;C=_&P,i[C]=h<<24|x<<16|R-s|0}}return _!==0&&(i[R+_]=d-g<<24|64<<16|0),l.bits=h,0};var Xh=UW;const zW=0,A6=1,P6=2,{Z_FINISH:zN,Z_BLOCK:qW,Z_TREES:jm,Z_OK:xc,Z_STREAM_END:WW,Z_NEED_DICT:HW,Z_STREAM_ERROR:ts,Z_DATA_ERROR:L6,Z_MEM_ERROR:R6,Z_BUF_ERROR:VW,Z_DEFLATED:qN}=ip,rx=16180,WN=16181,HN=16182,VN=16183,GN=16184,YN=16185,KN=16186,JN=16187,XN=16188,ZN=16189,h0=16190,Ao=16191,Vv=16192,QN=16193,Gv=16194,eS=16195,tS=16196,nS=16197,rS=16198,Em=16199,Cm=16200,iS=16201,sS=16202,oS=16203,aS=16204,lS=16205,Yv=16206,cS=16207,dS=16208,Nn=16209,T6=16210,O6=16211,GW=852,YW=592,KW=15,JW=KW,uS=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function XW(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Sc=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<rx||t.mode>O6?1:0},I6=e=>{if(Sc(e))return ts;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=rx,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(GW),t.distcode=t.distdyn=new Int32Array(YW),t.sane=1,t.back=-1,xc},D6=e=>{if(Sc(e))return ts;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,I6(e)},F6=(e,t)=>{let n;if(Sc(e))return ts;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?ts:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,D6(e))},M6=(e,t)=>{if(!e)return ts;const n=new XW;e.state=n,n.strm=e,n.window=null,n.mode=rx;const r=F6(e,t);return r!==xc&&(e.state=null),r},ZW=e=>M6(e,JW);let hS=!0,Kv,Jv;const QW=e=>{if(hS){Kv=new Int32Array(512),Jv=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Xh(A6,e.lens,0,288,Kv,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Xh(P6,e.lens,0,32,Jv,0,e.work,{bits:5}),hS=!1}e.lencode=Kv,e.lenbits=9,e.distcode=Jv,e.distbits=5},$6=(e,t,n,r)=>{let i;const s=e.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),r>=s.wsize?(s.window.set(t.subarray(n-s.wsize,n),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>r&&(i=r),s.window.set(t.subarray(n-r,n-r+i),s.wnext),r-=i,r?(s.window.set(t.subarray(n-r,n),0),s.wnext=r,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0},eH=(e,t)=>{let n,r,i,s,a,l,c,d,u,f,p,h,x,g,b=0,y,_,w,S,C,P,R,M;const T=new Uint8Array(4);let H,A;const O=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Sc(e)||!e.output||!e.input&&e.avail_in!==0)return ts;n=e.state,n.mode===Ao&&(n.mode=Vv),a=e.next_out,i=e.output,c=e.avail_out,s=e.next_in,r=e.input,l=e.avail_in,d=n.hold,u=n.bits,f=l,p=c,M=xc;e:for(;;)switch(n.mode){case rx:if(n.wrap===0){n.mode=Vv;break}for(;u<16;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}if(n.wrap&2&&d===35615){n.wbits===0&&(n.wbits=15),n.check=0,T[0]=d&255,T[1]=d>>>8&255,n.check=fr(n.check,T,2,0),d=0,u=0,n.mode=WN;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((d&255)<<8)+(d>>8))%31){e.msg="incorrect header check",n.mode=Nn;break}if((d&15)!==qN){e.msg="unknown compression method",n.mode=Nn;break}if(d>>>=4,u-=4,R=(d&15)+8,n.wbits===0&&(n.wbits=R),R>15||R>n.wbits){e.msg="invalid window size",n.mode=Nn;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=d&512?ZN:Ao,d=0,u=0;break;case WN:for(;u<16;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}if(n.flags=d,(n.flags&255)!==qN){e.msg="unknown compression method",n.mode=Nn;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=Nn;break}n.head&&(n.head.text=d>>8&1),n.flags&512&&n.wrap&4&&(T[0]=d&255,T[1]=d>>>8&255,n.check=fr(n.check,T,2,0)),d=0,u=0,n.mode=HN;case HN:for(;u<32;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}n.head&&(n.head.time=d),n.flags&512&&n.wrap&4&&(T[0]=d&255,T[1]=d>>>8&255,T[2]=d>>>16&255,T[3]=d>>>24&255,n.check=fr(n.check,T,4,0)),d=0,u=0,n.mode=VN;case VN:for(;u<16;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}n.head&&(n.head.xflags=d&255,n.head.os=d>>8),n.flags&512&&n.wrap&4&&(T[0]=d&255,T[1]=d>>>8&255,n.check=fr(n.check,T,2,0)),d=0,u=0,n.mode=GN;case GN:if(n.flags&1024){for(;u<16;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}n.length=d,n.head&&(n.head.extra_len=d),n.flags&512&&n.wrap&4&&(T[0]=d&255,T[1]=d>>>8&255,n.check=fr(n.check,T,2,0)),d=0,u=0}else n.head&&(n.head.extra=null);n.mode=YN;case YN:if(n.flags&1024&&(h=n.length,h>l&&(h=l),h&&(n.head&&(R=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(s,s+h),R)),n.flags&512&&n.wrap&4&&(n.check=fr(n.check,r,h,s)),l-=h,s+=h,n.length-=h),n.length))break e;n.length=0,n.mode=KN;case KN:if(n.flags&2048){if(l===0)break e;h=0;do R=r[s+h++],n.head&&R&&n.length<65536&&(n.head.name+=String.fromCharCode(R));while(R&&h<l);if(n.flags&512&&n.wrap&4&&(n.check=fr(n.check,r,h,s)),l-=h,s+=h,R)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=JN;case JN:if(n.flags&4096){if(l===0)break e;h=0;do R=r[s+h++],n.head&&R&&n.length<65536&&(n.head.comment+=String.fromCharCode(R));while(R&&h<l);if(n.flags&512&&n.wrap&4&&(n.check=fr(n.check,r,h,s)),l-=h,s+=h,R)break e}else n.head&&(n.head.comment=null);n.mode=XN;case XN:if(n.flags&512){for(;u<16;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}if(n.wrap&4&&d!==(n.check&65535)){e.msg="header crc mismatch",n.mode=Nn;break}d=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Ao;break;case ZN:for(;u<32;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}e.adler=n.check=uS(d),d=0,u=0,n.mode=h0;case h0:if(n.havedict===0)return e.next_out=a,e.avail_out=c,e.next_in=s,e.avail_in=l,n.hold=d,n.bits=u,HW;e.adler=n.check=1,n.mode=Ao;case Ao:if(t===qW||t===jm)break e;case Vv:if(n.last){d>>>=u&7,u-=u&7,n.mode=Yv;break}for(;u<3;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}switch(n.last=d&1,d>>>=1,u-=1,d&3){case 0:n.mode=QN;break;case 1:if(QW(n),n.mode=Em,t===jm){d>>>=2,u-=2;break e}break;case 2:n.mode=tS;break;case 3:e.msg="invalid block type",n.mode=Nn}d>>>=2,u-=2;break;case QN:for(d>>>=u&7,u-=u&7;u<32;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}if((d&65535)!==(d>>>16^65535)){e.msg="invalid stored block lengths",n.mode=Nn;break}if(n.length=d&65535,d=0,u=0,n.mode=Gv,t===jm)break e;case Gv:n.mode=eS;case eS:if(h=n.length,h){if(h>l&&(h=l),h>c&&(h=c),h===0)break e;i.set(r.subarray(s,s+h),a),l-=h,s+=h,c-=h,a+=h,n.length-=h;break}n.mode=Ao;break;case tS:for(;u<14;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}if(n.nlen=(d&31)+257,d>>>=5,u-=5,n.ndist=(d&31)+1,d>>>=5,u-=5,n.ncode=(d&15)+4,d>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Nn;break}n.have=0,n.mode=nS;case nS:for(;n.have<n.ncode;){for(;u<3;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}n.lens[O[n.have++]]=d&7,d>>>=3,u-=3}for(;n.have<19;)n.lens[O[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,H={bits:n.lenbits},M=Xh(zW,n.lens,0,19,n.lencode,0,n.work,H),n.lenbits=H.bits,M){e.msg="invalid code lengths set",n.mode=Nn;break}n.have=0,n.mode=rS;case rS:for(;n.have<n.nlen+n.ndist;){for(;b=n.lencode[d&(1<<n.lenbits)-1],y=b>>>24,_=b>>>16&255,w=b&65535,!(y<=u);){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}if(w<16)d>>>=y,u-=y,n.lens[n.have++]=w;else{if(w===16){for(A=y+2;u<A;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}if(d>>>=y,u-=y,n.have===0){e.msg="invalid bit length repeat",n.mode=Nn;break}R=n.lens[n.have-1],h=3+(d&3),d>>>=2,u-=2}else if(w===17){for(A=y+3;u<A;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}d>>>=y,u-=y,R=0,h=3+(d&7),d>>>=3,u-=3}else{for(A=y+7;u<A;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}d>>>=y,u-=y,R=0,h=11+(d&127),d>>>=7,u-=7}if(n.have+h>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Nn;break}for(;h--;)n.lens[n.have++]=R}}if(n.mode===Nn)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Nn;break}if(n.lenbits=9,H={bits:n.lenbits},M=Xh(A6,n.lens,0,n.nlen,n.lencode,0,n.work,H),n.lenbits=H.bits,M){e.msg="invalid literal/lengths set",n.mode=Nn;break}if(n.distbits=6,n.distcode=n.distdyn,H={bits:n.distbits},M=Xh(P6,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,H),n.distbits=H.bits,M){e.msg="invalid distances set",n.mode=Nn;break}if(n.mode=Em,t===jm)break e;case Em:n.mode=Cm;case Cm:if(l>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=s,e.avail_in=l,n.hold=d,n.bits=u,DW(e,p),a=e.next_out,i=e.output,c=e.avail_out,s=e.next_in,r=e.input,l=e.avail_in,d=n.hold,u=n.bits,n.mode===Ao&&(n.back=-1);break}for(n.back=0;b=n.lencode[d&(1<<n.lenbits)-1],y=b>>>24,_=b>>>16&255,w=b&65535,!(y<=u);){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}if(_&&!(_&240)){for(S=y,C=_,P=w;b=n.lencode[P+((d&(1<<S+C)-1)>>S)],y=b>>>24,_=b>>>16&255,w=b&65535,!(S+y<=u);){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}d>>>=S,u-=S,n.back+=S}if(d>>>=y,u-=y,n.back+=y,n.length=w,_===0){n.mode=lS;break}if(_&32){n.back=-1,n.mode=Ao;break}if(_&64){e.msg="invalid literal/length code",n.mode=Nn;break}n.extra=_&15,n.mode=iS;case iS:if(n.extra){for(A=n.extra;u<A;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}n.length+=d&(1<<n.extra)-1,d>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=sS;case sS:for(;b=n.distcode[d&(1<<n.distbits)-1],y=b>>>24,_=b>>>16&255,w=b&65535,!(y<=u);){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}if(!(_&240)){for(S=y,C=_,P=w;b=n.distcode[P+((d&(1<<S+C)-1)>>S)],y=b>>>24,_=b>>>16&255,w=b&65535,!(S+y<=u);){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}d>>>=S,u-=S,n.back+=S}if(d>>>=y,u-=y,n.back+=y,_&64){e.msg="invalid distance code",n.mode=Nn;break}n.offset=w,n.extra=_&15,n.mode=oS;case oS:if(n.extra){for(A=n.extra;u<A;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}n.offset+=d&(1<<n.extra)-1,d>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Nn;break}n.mode=aS;case aS:if(c===0)break e;if(h=p-c,n.offset>h){if(h=n.offset-h,h>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Nn;break}h>n.wnext?(h-=n.wnext,x=n.wsize-h):x=n.wnext-h,h>n.length&&(h=n.length),g=n.window}else g=i,x=a-n.offset,h=n.length;h>c&&(h=c),c-=h,n.length-=h;do i[a++]=g[x++];while(--h);n.length===0&&(n.mode=Cm);break;case lS:if(c===0)break e;i[a++]=n.length,c--,n.mode=Cm;break;case Yv:if(n.wrap){for(;u<32;){if(l===0)break e;l--,d|=r[s++]<<u,u+=8}if(p-=c,e.total_out+=p,n.total+=p,n.wrap&4&&p&&(e.adler=n.check=n.flags?fr(n.check,i,p,a-p):Mf(n.check,i,p,a-p)),p=c,n.wrap&4&&(n.flags?d:uS(d))!==n.check){e.msg="incorrect data check",n.mode=Nn;break}d=0,u=0}n.mode=cS;case cS:if(n.wrap&&n.flags){for(;u<32;){if(l===0)break e;l--,d+=r[s++]<<u,u+=8}if(n.wrap&4&&d!==(n.total&4294967295)){e.msg="incorrect length check",n.mode=Nn;break}d=0,u=0}n.mode=dS;case dS:M=WW;break e;case Nn:M=L6;break e;case T6:return R6;case O6:default:return ts}return e.next_out=a,e.avail_out=c,e.next_in=s,e.avail_in=l,n.hold=d,n.bits=u,(n.wsize||p!==e.avail_out&&n.mode<Nn&&(n.mode<Yv||t!==zN))&&$6(e,e.output,e.next_out,p-e.avail_out),f-=e.avail_in,p-=e.avail_out,e.total_in+=f,e.total_out+=p,n.total+=p,n.wrap&4&&p&&(e.adler=n.check=n.flags?fr(n.check,i,p,e.next_out-p):Mf(n.check,i,p,e.next_out-p)),e.data_type=n.bits+(n.last?64:0)+(n.mode===Ao?128:0)+(n.mode===Em||n.mode===Gv?256:0),(f===0&&p===0||t===zN)&&M===xc&&(M=VW),M},tH=e=>{if(Sc(e))return ts;let t=e.state;return t.window&&(t.window=null),e.state=null,xc},nH=(e,t)=>{if(Sc(e))return ts;const n=e.state;return n.wrap&2?(n.head=t,t.done=!1,xc):ts},rH=(e,t)=>{const n=t.length;let r,i,s;return Sc(e)||(r=e.state,r.wrap!==0&&r.mode!==h0)?ts:r.mode===h0&&(i=1,i=Mf(i,t,n,0),i!==r.check)?L6:(s=$6(e,t,n,n),s?(r.mode=T6,R6):(r.havedict=1,xc))};var iH=D6,sH=F6,oH=I6,aH=ZW,lH=M6,cH=eH,dH=tH,uH=nH,hH=rH,fH="pako inflate (from Nodeca project)",$o={inflateReset:iH,inflateReset2:sH,inflateResetKeep:oH,inflateInit:aH,inflateInit2:lH,inflate:cH,inflateEnd:dH,inflateGetHeader:uH,inflateSetDictionary:hH,inflateInfo:fH};function pH(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var mH=pH;const B6=Object.prototype.toString,{Z_NO_FLUSH:gH,Z_FINISH:xH,Z_OK:Uf,Z_STREAM_END:Xv,Z_NEED_DICT:Zv,Z_STREAM_ERROR:vH,Z_DATA_ERROR:fS,Z_MEM_ERROR:bH}=ip;function op(e){this.options=nx.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new E6,this.strm.avail_out=0;let n=$o.inflateInit2(this.strm,t.windowBits);if(n!==Uf)throw new Error(vu[n]);if(this.header=new mH,$o.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Bf.string2buf(t.dictionary):B6.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=$o.inflateSetDictionary(this.strm,t.dictionary),n!==Uf)))throw new Error(vu[n])}op.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let s,a,l;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?xH:gH,B6.call(e)==="[object ArrayBuffer]"?n.input=new 
vendor: 9,765 bytes, line 427
427Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),s=$o.inflate(n,a),s===Zv&&i&&(s=$o.inflateSetDictionary(n,i),s===Uf?s=$o.inflate(n,a):s===fS&&(s=Zv));n.avail_in>0&&s===Xv&&n.state.wrap>0&&e[n.next_in]!==0;)$o.inflateReset(n),s=$o.inflate(n,a);switch(s){case vH:case fS:case Zv:case bH:return this.onEnd(s),this.ended=!0,!1}if(l=n.avail_out,n.next_out&&(n.avail_out===0||s===Xv))if(this.options.to==="string"){let c=Bf.utf8border(n.output,n.next_out),d=n.next_out-c,u=Bf.buf2string(n.output,c);n.next_out=d,n.avail_out=r-d,d&&n.output.set(n.output.subarray(c,c+d),0),this.onData(u)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(s===Uf&&l===0)){if(s===Xv)return s=$o.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};op.prototype.onData=function(e){this.chunks.push(e)};op.prototype.onEnd=function(e){e===Uf&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=nx.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function O2(e,t){const n=new op(t);if(n.push(e),n.err)throw n.msg||vu[n.err];return n.result}function yH(e,t){return t=t||{},t.raw=!0,O2(e,t)}var wH=op,_H=O2,kH=yH,NH=O2,SH=ip,jH={Inflate:wH,inflate:_H,inflateRaw:kH,ungzip:NH,constants:SH};const{Inflate:EH,inflate:CH,inflateRaw:XQ,ungzip:ZQ}=jH;var pS=EH,AH=CH;const U6=[];for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t&1?t=3988292384^t>>>1:t=t>>>1;U6[e]=t}const mS=4294967295;function PH(e,t,n){let r=e;for(let i=0;i<n;i++)r=U6[(r^t[i])&255]^r>>>8;return r}function LH(e,t){return(PH(mS,e,t)^mS)>>>0}function gS(e,t,n){const r=e.readUint32(),i=LH(new Uint8Array(e.buffer,e.byteOffset+e.offset-t-4,t),t);if(i!==r)throw new Error(`CRC mismatch for chunk ${n}. Expected ${r}, found ${i}`)}function z6(e,t,n){for(let r=0;r<n;r++)t[r]=e[r]}function q6(e,t,n,r){let i=0;for(;i<r;i++)t[i]=e[i];for(;i<n;i++)t[i]=e[i]+t[i-r]&255}function W6(e,t,n,r){let i=0;if(n.length===0)for(;i<r;i++)t[i]=e[i];else for(;i<r;i++)t[i]=e[i]+n[i]&255}function H6(e,t,n,r,i){let s=0;if(n.length===0){for(;s<i;s++)t[s]=e[s];for(;s<r;s++)t[s]=e[s]+(t[s-i]>>1)&255}else{for(;s<i;s++)t[s]=e[s]+(n[s]>>1)&255;for(;s<r;s++)t[s]=e[s]+(t[s-i]+n[s]>>1)&255}}function V6(e,t,n,r,i){let s=0;if(n.length===0){for(;s<i;s++)t[s]=e[s];for(;s<r;s++)t[s]=e[s]+t[s-i]&255}else{for(;s<i;s++)t[s]=e[s]+n[s]&255;for(;s<r;s++)t[s]=e[s]+RH(t[s-i],n[s],n[s-i])&255}}function RH(e,t,n){const r=e+t-n,i=Math.abs(r-e),s=Math.abs(r-t),a=Math.abs(r-n);return i<=s&&i<=a?e:s<=a?t:n}function TH(e,t,n,r,i,s){switch(e){case 0:z6(t,n,i);break;case 1:q6(t,n,i,s);break;case 2:W6(t,n,r,i);break;case 3:H6(t,n,r,i,s);break;case 4:V6(t,n,r,i,s);break;default:throw new Error(`Unsupported filter: ${e}`)}}const OH=new Uint16Array([255]),IH=new Uint8Array(OH.buffer),DH=IH[0]===255;function FH(e){const{data:t,width:n,height:r,channels:i,depth:s}=e,a=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],l=Math.ceil(s/8)*i,c=new Uint8Array(r*n*l);let d=0;for(let u=0;u<7;u++){const f=a[u],p=Math.ceil((n-f.x)/f.xStep),h=Math.ceil((r-f.y)/f.yStep);if(p<=0||h<=0)continue;const x=p*l,g=new Uint8Array(x);for(let b=0;b<h;b++){const y=t[d++],_=t.subarray(d,d+x);d+=x;const w=new Uint8Array(x);TH(y,_,w,g,x,l),g.set(w);for(let S=0;S<p;S++){const C=f.x+S*f.xStep,P=f.y+b*f.yStep;if(!(C>=n||P>=r))for(let R=0;R<l;R++)c[(P*n+C)*l+R]=w[S*l+R]}}}if(s===16){const u=new Uint16Array(c.buffer);if(DH)for(let f=0;f<u.length;f++)u[f]=MH(u[f]);return u}else return c}function MH(e){return(e&255)<<8|e>>8&255}const $H=new Uint16Array([255]),BH=new Uint8Array($H.buffer),UH=BH[0]===255,zH=new Uint8Array(0);function xS(e){const{data:t,width:n,height:r,channels:i,depth:s}=e,a=Math.ceil(s/8)*i,l=Math.ceil(s/8*i*n),c=new Uint8Array(r*l);let d=zH,u=0,f,p;for(let h=0;h<r;h++){switch(f=t.subarray(u+1,u+1+l),p=c.subarray(h*l,(h+1)*l),t[u]){case 0:z6(f,p,l);break;case 1:q6(f,p,l,a);break;case 2:W6(f,p,d,l);break;case 3:H6(f,p,d,l,a);break;case 4:V6(f,p,d,l,a);break;default:throw new Error(`Unsupported filter: ${t[u]}`)}d=p,u+=l+1}if(s===16){const h=new Uint16Array(c.buffer);if(UH)for(let x=0;x<h.length;x++)h[x]=qH(h[x]);return h}else return c}function qH(e){return(e&255)<<8|e>>8&255}const hg=Uint8Array.of(137,80,78,71,13,10,26,10);function vS(e){if(!WH(e.readBytes(hg.length)))throw new Error("wrong PNG signature")}function WH(e){if(e.length<hg.length)return!1;for(let t=0;t<hg.length;t++)if(e[t]!==hg[t])return!1;return!0}const HH="tEXt",VH=0,G6=new TextDecoder("latin1");function GH(e){if(KH(e),e.length===0||e.length>79)throw new Error("keyword length must be between 1 and 79")}const YH=/^[\u0000-\u00FF]*$/;function KH(e){if(!YH.test(e))throw new Error("invalid latin1 text")}function JH(e,t,n){const r=Y6(t);e[r]=XH(t,n-r.length-1)}function Y6(e){for(e.mark();e.readByte()!==VH;);const t=e.offset;e.reset();const n=G6.decode(e.readBytes(t-e.offset-1));return e.skip(1),GH(n),n}function XH(e,t){return G6.decode(e.readBytes(t))}const Ei={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},Qv={UNKNOWN:-1,DEFLATE:0},bS={UNKNOWN:-1,ADAPTIVE:0},eb={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},Am={NONE:0,BACKGROUND:1,PREVIOUS:2},tb={SOURCE:0,OVER:1};class ZH extends E2{constructor(n,r={}){super(n);Zt(this,"_checkCrc");Zt(this,"_inflator");Zt(this,"_png");Zt(this,"_apng");Zt(this,"_end");Zt(this,"_hasPalette");Zt(this,"_palette");Zt(this,"_hasTransparency");Zt(this,"_transparency");Zt(this,"_compressionMethod");Zt(this,"_filterMethod");Zt(this,"_interlaceMethod");Zt(this,"_colorType");Zt(this,"_isAnimated");Zt(this,"_numberOfFrames");Zt(this,"_numberOfPlays");Zt(this,"_frames");Zt(this,"_writingDataChunks");const{checkCrc:i=!1}=r;this._checkCrc=i,this._inflator=new pS,this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=Qv.UNKNOWN,this._filterMethod=bS.UNKNOWN,this._interlaceMethod=eb.UNKNOWN,this._colorType=Ei.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(vS(this);!this._end;){const n=this.readUint32(),r=this.readChars(4);this.decodeChunk(n,r)}return this.decodeImage(),this._png}decodeApng(){for(vS(this);!this._end;){const n=this.readUint32(),r=this.readChars(4);this.decodeApngChunk(n,r)}return this.decodeApngImage(),this._apng}decodeChunk(n,r){const i=this.offset;switch(r){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(n);break;case"IDAT":this.decodeIDAT(n);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(n);break;case"iCCP":this.decodeiCCP(n);break;case HH:JH(this._png.text,this,n);break;case"pHYs":this.decodepHYs();break;default:this.skip(n);break}if(this.offset-i!==n)throw new Error(`Length mismatch while decoding chunk ${r}`);this._checkCrc?gS(this,n+4,r):this.skip(4)}decodeApngChunk(n,r){const i=this.offset;switch(r!=="fdAT"&&r!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),r){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(n);break;default:this.decodeChunk(n,r),this.offset=i+n;break}if(this.offset-i!==n)throw new Error(`Length mismatch while decoding chunk ${r}`);this._checkCrc?gS(this,n+4,r):this.skip(4)}decodeIHDR(){const n=this._png;n.width=this.readUint32(),n.height=this.readUint32(),n.depth=QH(this.readUint8());const r=this.readUint8();this._colorType=r;let i;switch(r){case Ei.GREYSCALE:i=1;break;case Ei.TRUECOLOUR:i=3;break;case Ei.INDEXED_COLOUR:i=1;break;case Ei.GREYSCALE_ALPHA:i=2;break;case Ei.TRUECOLOUR_ALPHA:i=4;break;case Ei.UNKNOWN:default:throw new Error(`Unknown color type: ${r}`)}if(this._png.channels=i,this._compressionMethod=this.readUint8(),this._compressionMethod!==Qv.DEFLATE)throw new Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){const n={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(n)}decodePLTE(n){if(n%3!==0)throw new RangeError(`PLTE field length must be a multiple of 3. Got ${n}`);const r=n/3;this._hasPalette=!0;const i=[];this._palette=i;for(let s=0;s<r;s++)i.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(n){this._writingDataChunks=!0;const r=n,i=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,i,r)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(n)}decodeFDAT(n){this._writingDataChunks=!0;let r=n,i=this.offset+this.byteOffset;if(i+=4,r-=4,this._inflator.push(new Uint8Array(this.buffer,i,r)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(n)}decodetRNS(n){switch(this._colorType){case Ei.GREYSCALE:case Ei.TRUECOLOUR:{if(n%2!==0)throw new RangeError(`tRNS chunk length must be a multiple of 2. Got ${n}`);if(n/2>this._png.width*this._png.height)throw new Error(`tRNS chunk contains more alph
vendor: 5,229 bytes, line 427
427a values than there are pixels (${n/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(n/2);for(let r=0;r<n/2;r++)this._transparency[r]=this.readUint16();break}case Ei.INDEXED_COLOUR:{if(n>this._palette.length)throw new Error(`tRNS chunk contains more alpha values than there are palette colors (${n} vs ${this._palette.length})`);let r=0;for(;r<n;r++){const i=this.readByte();this._palette[r].push(i)}for(;r<this._palette.length;r++)this._palette[r].push(255);break}case Ei.UNKNOWN:case Ei.GREYSCALE_ALPHA:case Ei.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(n){const r=Y6(this),i=this.readUint8();if(i!==Qv.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${i}`);const s=this.readBytes(n-r.length-2);this._png.iccEmbeddedProfile={name:r,profile:AH(s)}}decodepHYs(){const n=this.readUint32(),r=this.readUint32(),i=this.readByte();this._png.resolution={x:n,y:r,unit:i}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let n=0;n<this._numberOfFrames;n++){const r={sequenceNumber:this._frames[n].sequenceNumber,delayNumber:this._frames[n].delayNumber,delayDenominator:this._frames[n].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},i=this._frames.at(n);if(i){if(i.data=xS({data:i.data,width:i.width,height:i.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),n===0||i.xOffset===0&&i.yOffset===0&&i.width===this._png.width&&i.height===this._png.height)r.data=i.data;else{const s=this._apng.frames.at(n-1);this.disposeFrame(i,s,r),this.addFrameDataToCanvas(r,i)}this._apng.frames.push(r)}}return this._apng}disposeFrame(n,r,i){switch(n.disposeOp){case Am.NONE:break;case Am.BACKGROUND:for(let s=0;s<this._png.height;s++)for(let a=0;a<this._png.width;a++){const l=(s*n.width+a)*this._png.channels;for(let c=0;c<this._png.channels;c++)i.data[l+c]=0}break;case Am.PREVIOUS:i.data.set(r.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(n,r){const i=1<<this._png.depth,s=(a,l)=>{const c=((a+r.yOffset)*this._png.width+r.xOffset+l)*this._png.channels,d=(a*r.width+l)*this._png.channels;return{index:c,frameIndex:d}};switch(r.blendOp){case tb.SOURCE:for(let a=0;a<r.height;a++)for(let l=0;l<r.width;l++){const{index:c,frameIndex:d}=s(a,l);for(let u=0;u<this._png.channels;u++)n.data[c+u]=r.data[d+u]}break;case tb.OVER:for(let a=0;a<r.height;a++)for(let l=0;l<r.width;l++){const{index:c,frameIndex:d}=s(a,l);for(let u=0;u<this._png.channels;u++){const f=r.data[d+this._png.channels-1]/i,p=u%(this._png.channels-1)===0?1:r.data[d+u],h=Math.floor(f*p+(1-f)*n.data[c+u]);n.data[c+u]+=h}}break;default:throw new Error("Unknown blendOp")}}decodeImage(){var r;if(this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);const n=this._isAnimated?((r=this._frames)==null?void 0:r.at(0)).data:this._inflator.result;if(this._filterMethod!==bS.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===eb.NO_INTERLACE)this._png.data=xS({data:n,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===eb.ADAM7)this._png.data=FH({data:n,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw new Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){const n=this._inflator.result,r=this._frames.at(-1);r?r.data=n:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:Am.NONE,blendOp:tb.SOURCE,data:n}),this._inflator=new pS,this._writingDataChunks=!1}}function QH(e){if(e!==1&&e!==2&&e!==4&&e!==8&&e!==16)throw new Error(`invalid bit depth: ${e}`);return e}var yS;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.METRE=1]="METRE"})(yS||(yS={}));function eV(e,t){return new ZH(e,t).decode()}var vt=function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this}();function nb(){vt.console&&typeof vt.console.log=="function"&&vt.console.log.apply(vt.console,arguments)}var an={log:nb,warn:function(e){vt.console&&(typeof vt.console.warn=="function"?vt.console.warn.apply(vt.console,arguments):nb.call(null,arguments))},error:function(e){vt.console&&(typeof vt.console.error=="function"?vt.console.error.apply(vt.console,arguments):nb(e))}};function rb(e,t,n){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){zl(r.response,t,n
vendor: 3,701 bytes, lines 427-432
427)},r.onerror=function(){an.error("could not download file")},r.send()}function wS(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Pm(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var zl=vt.saveAs||((typeof window>"u"?"undefined":en(window))!=="object"||window!==vt?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(e,t,n){var r=vt.URL||vt.webkitURL,i=document.createElement("a");t=t||e.name||"download",i.download=t,i.rel="noopener",typeof e=="string"?(i.href=e,i.origin!==location.origin?wS(i.href)?rb(e,t,n):Pm(i,i.target="_blank"):Pm(i)):(i.href=r.createObjectURL(e),setTimeout(function(){r.revokeObjectURL(i.href)},4e4),setTimeout(function(){Pm(i)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,n){if(t=t||e.name||"download",typeof e=="string")if(wS(e))rb(e,t,n);else{var r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){Pm(r)})}else navigator.msSaveOrOpenBlob(function(i,s){return s===void 0?s={autoBom:!1}:en(s)!=="object"&&(an.warn("Deprecated: Expected third argument to be a object"),s={autoBom:!s}),s.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(i.type)?new Blob(["\uFEFF",i],{type:i.type}):i}(e,n),t)}:function(e,t,n,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return rb(e,t,n);var i=e.type==="application/octet-stream",s=/constructor/i.test(vt.HTMLElement)||vt.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent);if((a||i&&s)&&(typeof FileReader>"u"?"undefined":en(FileReader))==="object"){var l=new FileReader;l.onloadend=function(){var u=l.result;u=a?u:u.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=u:location=u,r=null},l.readAsDataURL(e)}else{var c=vt.URL||vt.webkitURL,d=c.createObjectURL(e);r?r.location=d:location.href=d,r=null,setTimeout(function(){c.revokeObjectURL(d)},4e4)}});/**
428 * A class to parse color values
429 * @author Stoyan Stefanov <[email protected]>
430 * {@link   http://www.phpied.com/rgb-color-parser-in-javascript/}
431 * @license Use it if you like it
432 */function K6(e){var t;e=e||"",this.ok=!1,e.charAt(0)=="#"&&(e=e.substr(1,6)),e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee9
4320",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"}[e=(e=e.replace(/ /g,"")).toLowerCase()]||e;for(var n=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(l){return[parseInt(l[1]),parseInt(l[2]),parseInt(l[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(l){return[parseInt(l[1],16),parseInt(l[2],16),parseInt(l[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(l){return[parseInt(l[1]+l[1],16),parseInt(l[2]+l[2],16),parseInt(l[3]+l[3],16)]}}],r=0;r<n.length;r++){var i=n[r].re,s=n[r].process,a=i.exec(e);a&&(t=s(a),this.r=t[0],this.g=t[1],this.b=t[2],this.ok=!0)}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var l=this.r.toString(16),c=this.g.toString(16),d=this.b.toString(16);return l.length==1&&(l="0"+l),c.length==1&&(c="0"+c),d.length==1&&(d="0"+d),"#"+l+c+d}}var fg=vt.atob.bind(vt),_S=vt.btoa.bind(vt);/**
433 * @license
434 * Joseph Myers does not specify a particular license for his work.
435 *
436 * Author: Joseph Myers
437 * Accessed from: http://www.myersdaily.org/joseph/javascript/md5.js
438 *
439 * Modified by: Owen Leong
440 */function ib(e,t){var n=e[0],r=e[1],i=e[2],s=e[3];n=Fr(n,r,i,s,t[0],7,-680876936),s=Fr(s,n,r,i,t[1],12,-389564586),i=Fr(i,s,n,r,t[2],17,606105819),r=Fr(r,i,s,n,t[3],22,-1044525330),n=Fr(n,r,i,s,t[4],7,-176418897),s=Fr(s,n,r,i,t[5],12,1200080426),i=Fr(i,s,n,r,t[6],17,-1473231341),r=Fr(r,i,s,n,t[7],22,-45705983),n=Fr(n,r,i,s,t[8],7,1770035416),s=Fr(s,n,r,i,t[9],12,-1958414417),i=Fr(i,s,n,r,t[10],17,-42063),r=Fr(r,i,s,n,t[11],22,-1990404162),n=Fr(n,r,i,s,t[12],7,1804603682),s=Fr(s,n,r,i,t[13],12,-40341101),i=Fr(i,s,n,r,t[14],17,-1502002290),n=Mr(n,r=Fr(r,i,s,n,t[15],22,1236535329),i,s,t[1],5,-165796510),s=Mr(s,n,r,i,t[6],9,-1069501632),i=Mr(i,s,n,r,t[11],14,643717713),r=Mr(r,i,s,n,t[0],20,-373897302),n=Mr(n,r,i,s,t[5],5,-701558691),s=Mr(s,n,r,i,t[10],9,38016083),i=Mr(i,s,n,r,t[15],14,-660478335),r=Mr(r,i,s,n,t[4],20,-405537848),n=Mr(n,r,i,s,t[9],5,568446438),s=Mr(s,n,r,i,t[14],9,-1019803690),i=Mr(i,s,n,r,t[3],14,-187363961),r=Mr(r,i,s,n,t[8],20,1163531501),n=Mr(n,r,i,s,t[13],5,-1444681467),s=Mr(s,n,r,i,t[2],9,-51403784),i=Mr(i,s,n,r,t[7],14,1735328473),n=$r(n,r=Mr(r,i,s,n,t[12],20,-1926607734),i,s,t[5],4,-378558),s=$r(s,n,r,i,t[8],11,-2022574463),i=$r(i,s,n,r,t[11],16,1839030562),r=$r(r,i,s,n,t[14],23,-35309556),n=$r(n,r,i,s,t[1],4,-1530992060),s=$r(s,n,r,i,t[4],11,1272893353),i=$r(i,s,n,r,t[7],16,-155497632),r=$r(r,i,s,n,t[10],23,-1094730640),n=$r(n,r,i,s,t[13],4,681279174),s=$r(s,n,r,i,t[0],11,-358537222),i=$r(i,s,n,r,t[3],16,-722521979),r=$r(r,i,s,n,t[6],23,76029189),n=$r(n,r,i,s,t[9],4,-640364487),s=$r(s,n,r,i,t[12],11,-421815835),i=$r(i,s,n,r,t[15],16,530742520),n=Br(n,r=$r(r,i,s,n,t[2],23,-995338651),i,s,t[0],6,-198630844),s=Br(s,n,r,i,t[7],10,1126891415),i=Br(i,s,n,r,t[14],15,-1416354905),r=Br(r,i,s,n,t[5],21,-57434055),n=Br(n,r,i,s,t[12],6,1700485571),s=Br(s,n,r,i,t[3],10,-1894986606),i=Br(i,s,n,r,t[10],15,-1051523),r=Br(r,i,s,n,t[1],21,-2054922799),n=Br(n,r,i,s,t[8],6,1873313359),s=Br(s,n,r,i,t[15],10,-30611744),i=Br(i,s,n,r,t[6],15,-1560198380),r=Br(r,i,s,n,t[13],21,1309151649),n=Br(n,r,i,s,t[4],6,-145523070),s=Br(s,n,r,i,t[11],10,-1120210379),i=Br(i,s,n,r,t[2],15,718787259),r=Br(r,i,s,n,t[9],21,-343485551),e[0]=Wa(n,e[0]),e[1]=Wa(r,e[1]),e[2]=Wa(i,e[2]),e[3]=Wa(s,e[3])}function ix(e,t,n,r,i,s){return t=Wa(Wa(t,e),Wa(r,s)),Wa(t<<i|t>>>32-i,n)}function Fr(e,t,n,r,i,s,a){return ix(t&n|~t&r,e,t,i,s,a)}function Mr(e,t,n,r,i,s,a){return ix(t&r|n&~r,e,t,i,s,a)}function $r(e,t,n,r,i,s,a){return ix(t^n^r,e,t,i,s,a)}function Br(e,t,n,r,i,s,a){return ix(n^(t|~r),e,t,i,s,a)}function J6(e){var t,n=e.length,r=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=e.length;t+=64)ib(r,tV(e.substring(t-64,t)));e=e.substring(t-64);var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<e.length;t++)i[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(ib(r,i),t=0;t<16;t++)i[t]=0;return i[14]=8*n,ib(r,i),r}function tV(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}var kS="0123456789abcdef".split("");function nV(e){for(var t="",n=0;n<4;n++)t+=kS[e>>8*n+4&15]+kS[e>>
vendor: 8,960 bytes, lines 440-457
4408*n&15];return t}function rV(e){return String.fromCharCode(255&e,(65280&e)>>8,(16711680&e)>>16,(4278190080&e)>>24)}function y1(e){return J6(e).map(rV).join("")}var iV=function(e){for(var t=0;t<e.length;t++)e[t]=nV(e[t]);return e.join("")}(J6("hello"))!="5d41402abc4b2a76b9719d911017c592";function Wa(e,t){if(iV){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}return e+t&4294967295}/**
441 * @license
442 * FPDF is released under a permissive license: there is no usage restriction.
443 * You may embed it freely in your application (commercial or not), with or
444 * without modifications.
445 *
446 * Reference: http://www.fpdf.org/en/script/script37.php
447 */function w1(e,t){var n,r,i,s;if(e!==n){for(var a=(i=e,s=1+(256/e.length|0),new Array(s+1).join(i)),l=[],c=0;c<256;c++)l[c]=c;var d=0;for(c=0;c<256;c++){var u=l[c];d=(d+u+a.charCodeAt(c))%256,l[c]=l[d],l[d]=u}n=e,r=l}else l=r;var f=t.length,p=0,h=0,x="";for(c=0;c<f;c++)h=(h+(u=l[p=(p+1)%256]))%256,l[p]=l[h],l[h]=u,a=l[(l[p]+l[h])%256],x+=String.fromCharCode(t.charCodeAt(c)^a);return x}/**
448 * @license
449 * Licensed under the MIT License.
450 * http://opensource.org/licenses/mit-license
451 * Author: Owen Leong (@owenl131)
452 * Date: 15 Oct 2020
453 * References:
454 * https://www.cs.cmu.edu/~dst/Adobe/Gallery/anon21jul01-pdf-encryption.txt
455 * https://github.com/foliojs/pdfkit/blob/master/lib/security.js
456 * http://www.fpdf.org/en/script/script37.php
457 */var NS={print:4,modify:8,copy:16,"annot-forms":32};function bd(e,t,n,r){this.v=1,this.r=2;var i=192;e.forEach(function(l){if(NS.perm!==void 0)throw new Error("Invalid permission: "+l);i+=NS[l]}),this.padding="(¿N^NuŠAd\0NVÿú�\b..\0¶Ðh>€/\f©þdSiz";var s=(t+this.padding).substr(0,32),a=(n+this.padding).substr(0,32);this.O=this.processOwnerPassword(s,a),this.P=-(1+(255^i)),this.encryptionKey=y1(s+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(r)).substr(0,5),this.U=w1(this.encryptionKey,this.padding)}function yd(e){if(/[^\u0000-\u00ff]/.test(e))throw new Error("Invalid PDF Name Object: "+e+", Only accept ASCII characters.");for(var t="",n=e.length,r=0;r<n;r++){var i=e.charCodeAt(r);t+=i<33||i===35||i===37||i===40||i===41||i===47||i===60||i===62||i===91||i===93||i===123||i===125||i>126?"#"+("0"+i.toString(16)).slice(-2):e[r]}return t}function SS(e){if(en(e)!=="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var t={};this.subscribe=function(n,r,i){if(i=i||!1,typeof n!="string"||typeof r!="function"||typeof i!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");t.hasOwnProperty(n)||(t[n]={});var s=Math.random().toString(35);return t[n][s]=[r,!!i],s},this.unsubscribe=function(n){for(var r in t)if(t[r][n])return delete t[r][n],Object.keys(t[r]).length===0&&delete t[r],!0;return!1},this.publish=function(n){if(t.hasOwnProperty(n)){var r=Array.prototype.slice.call(arguments,1),i=[];for(var s in t[n]){var a=t[n][s];try{a[0].apply(e,r)}catch(l){vt.console&&an.error("jsPDF PubSub Error",l.message,l)}a[1]&&i.push(s)}i.length&&i.forEach(this.unsubscribe)}},this.getTopics=function(){return t}}function f0(e){if(!(this instanceof f0))return new f0(e);var t="opacity,stroke-opacity".split(",");for(var n in e)e.hasOwnProperty(n)&&t.indexOf(n)>=0&&(this[n]=e[n]);this.id="",this.objectNumber=-1}function X6(e,t){this.gState=e,this.matrix=t,this.id="",this.objectNumber=-1}function Wl(e,t,n,r,i){if(!(this instanceof Wl))return new Wl(e,t,n,r,i);this.type=e==="axial"?2:3,this.coords=t,this.colors=n,X6.call(this,r,i)}function Od(e,t,n,r,i){if(!(this instanceof Od))return new Od(e,t,n,r,i);this.boundingBox=e,this.xStep=t,this.yStep=n,this.stream="",this.cloneIndex=0,X6.call(this,r,i)}function Xe(e){var t,n=typeof arguments[0]=="string"?arguments[0]:"p",r=arguments[1],i=arguments[2],s=arguments[3],a=[],l=1,c=16,d="S",u=null;en(e=e||{})==="object"&&(n=e.orientation,r=e.unit||r,i=e.format||i,s=e.compress||e.compressPdf||s,(u=e.encryption||null)!==null&&(u.userPassword=u.userPassword||"",u.ownerPassword=u.ownerPassword||"",u.userPermissions=u.userPermissions||[]),l=typeof e.userUnit=="number"?Math.abs(e.userUnit):1,e.precision!==void 0&&(t=e.precision),e.floatPrecision!==void 0&&(c=e.floatPrecision),d=e.defaultPathOperation||"S"),a=e.filters||(s===!0?["FlateEncode"]:a),r=r||"mm",n=(""+(n||"P")).toLowerCase();var f=e.putOnlyUsedFonts||!1,p={},h={internal:{},__private__:{}};h.__private__.PubSub=SS;var x="1.3",g=h.__private__.getPdfVersion=function(){return x};h.__private__.setPdfVersion=function(N){x=N};var b={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};h.__private__.getPageFormats=function(){return b};var y=h.__private__.getPageFormat=function(N){return b[N]};i=i||"a4";var _="compat",w="advanced",S=_;function C(){this.saveGraphicsState(),te(new et(it,0,0,-it,0,wl()*it).toString()+" cm"),this.setFontSize(this.getFontSize()/it),d="n",S=w}function P(){this.restoreGraphicsState(),d="S",S=_}var R=h.__private__.combineFontStyleAndFontWeight=function(N,B){if(N=="bold"&&B=="normal"||N=="bold"&&B==400||N=="normal"&&B=="italic"||N=="bold"&&B=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return B&&(N=B==400||B==="normal"?N==="italic"?"italic":"normal":B!=700&&B!=="bold"||N!=="normal"?(B==700?"bold":B)+""+N:"bold"),N};h.advancedAPI=function(N){var B=S===_;return B&&C.call(this),typeof N!="function"||(N(this),B&&P.call(this)),this},h.compatAPI=function(N){var B=S===w;return B&&P.call(this),typeof N!="function"||(N(this),B&&C.call(this)),this},h.isAdvancedAPI=function(){return S===w};var M,T=function(N){if(S!==w)throw new Error(N+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},H=h.roundToPrecision=h.__private__.roundToPrecision=function(N,B){var oe=t||B;if(isNaN(N)||isNaN(oe))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return N.toFixed(oe).replace(/0+$/,"")};M=h.hpf=h.__private__.hpf=typeof c=="number"?function(N){if(isNaN(N))throw new Error("Invalid argument passed to jsPDF.hpf");return H(N,c)}:c==="smart"?function(N){if(isNaN(N))throw new Error("Invalid argument passed to jsPDF.hpf");return H(N,N>-1&&N<1?16:5)}:function(N){if(isNaN(N))throw new Error("Invalid argument passed to jsPDF.hpf");return H(N,16)};var A=h.f2=h.__private__.f2=function(N){if(isNaN(N))throw new Error("Invalid argument passed to jsPDF.f2");return H(N,2)},O=h.__private__.f3=function(N){if(isNaN(N))throw new Error("Invalid argument passed to jsPDF.f3");return H(N,3)},K=h.scale=h.__private__.scale=function(N){if(isNaN(N))throw new Error("Invalid argument passed to jsPDF.scale");return S===_?N*it:S===w?N:void 0},U=function(N){return K(function(B){return S===_?wl()-B:S===w?B:void 0}(N))};h.__private__.setPrecision=h.setPrecision=function(N){typeof parseInt(N,10)=="number"&&(t=parseInt(N,10))};var I,re="00000000000000000000000000000000",V=h.__private__.getFileId=function(){return re},$=h.__private__.setFileId=function(N){return re=N!==void 0&&/^[a-fA-F0-9]{32}$/.test(N)?N.toUpperCase():re.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),u!==null&&(br=new bd(u.userPermissions,u.userPassword,u.ownerPassword,re)),re};h.setFileId=function(N){return $(N),this},h.getFileId=function(){return V()};var D=h.__private__.convertDateToPDFDate=function(N){var B=N.getTimezoneOffset(),oe=B<0?"+":"-",de=Math.floor(Math.abs(B/60)),ge=Math.abs(B%60),je=[oe,F(de),"'",F(ge),"'"].join("");return["D:",N.getFullYear(),F(N.getMonth()+1),F(N.getDate()),F(N.getHours()),F(N.getMinutes()),F(N.getSeconds()),je].join("")},ie=h.__private__.convertPDFDateToDate=function(N){var B=parseInt(N.substr(2,4),10),oe=parseInt(N.substr(6,2),10)-1,de=parseInt(N.substr(8,2),10),ge=parseInt(N.substr(10,2),10),je=parseInt(N.substr(12,2),10),Te=parseInt(N.substr(14,2),10);return new Date(B,oe,de,ge,je,Te,0)},X=h.__private__.setCreationDate=function(N){var B;if(N===void 0&&(N=new Date),N instanceof Date)B=D(N);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(N))throw new Error("Invalid argument passed to 
457jsPDF.setCreationDate");B=N}return I=B},E=h.__private__.getCreationDate=function(N){var B=I;return N==="jsDate"&&(B=ie(I)),B};h.setCreationDate=function(N){return X(N),this},h.getCreationDate=function(N){return E(N)};var q,F=h.__private__.padd2=function(N){return("0"+parseInt(N)).slice(-2)},Z=h.__private__.padd2Hex=function(N){return("00"+(N=N.toString())).substr(N.length)},Y=0,ee=[],ce=[],ue=0,ye=[],Se=[],De=!1,Re=ce;h.__private__.setCustomOutputDestination=function(N){De=!0,Re=N};var qe=function(N){De||(Re=N)};h.__private__.resetCustomOutputDestination=function(){De=!1,Re=ce};var te=h.__private__.out=function(N){return N=N.toString(),ue+=N.length+1,Re.push(N),Re},Oe=h.__private__.write=function(N){return te(arguments.length===1?N.toString():Array.prototype.join.call(arguments," "))},be=h.__private__.getArrayBuffer=function(N){for(var B=N.length,oe=new ArrayBuffer(B),de=new Uint8Array(oe);B--;)de[B]=N.charCodeAt(B);return oe},se=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];h.__private__.getStandardFonts=function(){return se};var Q=e.fontSize||16;h.__private__.setFontSize=h.setFontSize=function(N){return Q=S===w?N/it:N,this};var he,ve=h.__private__.getFontSize=h.getFontSize=function(){return S===_?Q:Q*it},we=e.R2L||!1;h.__private__.setR2L=h.setR2L=function(N){return we=N,this},h.__private__.getR2L=h.getR2L=function(){return we};var Le,Fe=h.__private__.setZoomMode=function(N){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(N))he=N;else if(isNaN(N)){if([void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(N)===-1)throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+N+'" is not recognized.');he=N}else he=parseInt(N,10)};h.__private__.getZoomMode=function(){return he};var Ve,He=h.__private__.setPageMode=function(N){if([void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(N)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+N+'" is not recognized.');Le=N};h.__private__.getPageMode=function(){return Le};var Ze=h.__private__.setLayoutMode=function(N){if([void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(N)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+N+'" is not recognized.');Ve=N};h.__private__.getLayoutMode=function(){return Ve},h.__private__.setDisplayMode=h.setDisplayMode=function(N,B,oe){return Fe(N),Ze(B),He(oe),this};var at={title:"",subject:"",author:"",keywords:"",creator:""};h.__private__.getDocumentProperty=function(N){if(Object.keys(at).indexOf(N)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return at[N]},h.__private__.getDocumentProperties=function(){return at},h.__private__.setDocumentProperties=h.setProperties=h.setDocumentProperties=function(N){for(var B in at)at.hasOwnProperty(B)&&N[B]&&(at[B]=N[B]);return this},h.__private__.setDocumentProperty=function(N,B){if(Object.keys(at).indexOf(N)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return at[N]=B};var Be,it,ze,zt,yt,mt={},wt={},Mt=[],dt={},qt={},ht={},bt={},ln=null,Pt=0,st=[],Gt=new SS(h),ft=e.hotfixes||[],_t={},$t={},Rn=[],et=function N(B,oe,de,ge,je,Te){if(!(this instanceof N))return new N(B,oe,de,ge,je,Te);isNaN(B)&&(B=1),isNaN(oe)&&(oe=0),isNaN(de)&&(de=0),isNaN(ge)&&(ge=1),isNaN(je)&&(je=0),isNaN(Te)&&(Te=0),this._matrix=[B,oe,de,ge,je,Te]};Object.defineProperty(et.prototype,"sx",{get:function(){return this._matrix[0]},set:function(N){this._matrix[0]=N}}),Object.defineProperty(et.prototype,"shy",{get:function(){return this._matrix[
vendor: 22,386 bytes, lines 457-463
4571]},set:function(N){this._matrix[1]=N}}),Object.defineProperty(et.prototype,"shx",{get:function(){return this._matrix[2]},set:function(N){this._matrix[2]=N}}),Object.defineProperty(et.prototype,"sy",{get:function(){return this._matrix[3]},set:function(N){this._matrix[3]=N}}),Object.defineProperty(et.prototype,"tx",{get:function(){return this._matrix[4]},set:function(N){this._matrix[4]=N}}),Object.defineProperty(et.prototype,"ty",{get:function(){return this._matrix[5]},set:function(N){this._matrix[5]=N}}),Object.defineProperty(et.prototype,"a",{get:function(){return this._matrix[0]},set:function(N){this._matrix[0]=N}}),Object.defineProperty(et.prototype,"b",{get:function(){return this._matrix[1]},set:function(N){this._matrix[1]=N}}),Object.defineProperty(et.prototype,"c",{get:function(){return this._matrix[2]},set:function(N){this._matrix[2]=N}}),Object.defineProperty(et.prototype,"d",{get:function(){return this._matrix[3]},set:function(N){this._matrix[3]=N}}),Object.defineProperty(et.prototype,"e",{get:function(){return this._matrix[4]},set:function(N){this._matrix[4]=N}}),Object.defineProperty(et.prototype,"f",{get:function(){return this._matrix[5]},set:function(N){this._matrix[5]=N}}),Object.defineProperty(et.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(et.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(et.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(et.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),et.prototype.join=function(N){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(M).join(N)},et.prototype.multiply=function(N){var B=N.sx*this.sx+N.shy*this.shx,oe=N.sx*this.shy+N.shy*this.sy,de=N.shx*this.sx+N.sy*this.shx,ge=N.shx*this.shy+N.sy*this.sy,je=N.tx*this.sx+N.ty*this.shx+this.tx,Te=N.tx*this.shy+N.ty*this.sy+this.ty;return new et(B,oe,de,ge,je,Te)},et.prototype.decompose=function(){var N=this.sx,B=this.shy,oe=this.shx,de=this.sy,ge=this.tx,je=this.ty,Te=Math.sqrt(N*N+B*B),tt=(N/=Te)*oe+(B/=Te)*de;oe-=N*tt,de-=B*tt;var Qe=Math.sqrt(oe*oe+de*de);return tt/=Qe,N*(de/=Qe)<B*(oe/=Qe)&&(N=-N,B=-B,tt=-tt,Te=-Te),{scale:new et(Te,0,0,Qe,0,0),translate:new et(1,0,0,1,ge,je),rotate:new et(N,B,-B,N,0,0),skew:new et(1,0,tt,1,0,0)}},et.prototype.toString=function(N){return this.join(" ")},et.prototype.inversed=function(){var N=this.sx,B=this.shy,oe=this.shx,de=this.sy,ge=this.tx,je=this.ty,Te=1/(N*de-B*oe),tt=de*Te,Qe=-B*Te,kt=-oe*Te,Et=N*Te;return new et(tt,Qe,kt,Et,-tt*ge-kt*je,-Qe*ge-Et*je)},et.prototype.applyToPoint=function(N){var B=N.x*this.sx+N.y*this.shx+this.tx,oe=N.x*this.shy+N.y*this.sy+this.ty;return new yl(B,oe)},et.prototype.applyToRectangle=function(N){var B=this.applyToPoint(N),oe=this.applyToPoint(new yl(N.x+N.w,N.y+N.h));return new Wu(B.x,B.y,oe.x-B.x,oe.y-B.y)},et.prototype.clone=function(){var N=this.sx,B=this.shy,oe=this.shx,de=this.sy,ge=this.tx,je=this.ty;return new et(N,B,oe,de,ge,je)},h.Matrix=et;var cr=h.matrixMult=function(N,B){return B.multiply(N)},xr=new et(1,0,0,1,0,0);h.unitMatrix=h.identityMatrix=xr;var kn=function(N,B){if(!qt[N]){var oe=(B instanceof Wl?"Sh":"P")+(Object.keys(dt).length+1).toString(10);B.id=oe,qt[N]=oe,dt[oe]=B,Gt.publish("addPattern",B)}};h.ShadingPattern=Wl,h.TilingPattern=Od,h.addShadingPattern=function(N,B){return T("addShadingPattern()"),kn(N,B),this},h.beginTilingPattern=function(N){T("beginTilingPattern()"),Hu(N.boundingBox[0],N.boundingBox[1],N.boundingBox[2]-N.boundingBox[0],N.boundingBox[3]-N.boundingBox[1],N.matrix)},h.endTilingPattern=function(N,B){T("endTilingPattern()"),B.stream=Se[q].join(`
458`),kn(N,B),Gt.publish("endTilingPattern",B),Rn.pop().restore()};var Un,Tn=h.__private__.newObject=function(){var N=dr();return vr(N,!0),N},dr=h.__private__.newObjectDeferred=function(){return Y++,ee[Y]=function(){return ue},Y},vr=function(N,B){return B=typeof B=="boolean"&&B,ee[N]=ue,B&&te(N+" 0 obj"),N},gl=h.__private__.newAdditionalObject=function(){var N={objId:dr(),content:""};return ye.push(N),N},ra=dr(),ns=dr(),Rs=h.__private__.decodeColorString=function(N){var B=N.split(" ");if(B.length!==2||B[1]!=="g"&&B[1]!=="G")B.length!==5||B[4]!=="k"&&B[4]!=="K"||(B=[(1-B[0])*(1-B[3]),(1-B[1])*(1-B[3]),(1-B[2])*(1-B[3]),"r"]);else{var oe=parseFloat(B[0]);B=[oe,oe,oe,"r"]}for(var de="#",ge=0;ge<3;ge++)de+=("0"+Math.floor(255*parseFloat(B[ge])).toString(16)).slice(-2);return de},rs=h.__private__.encodeColorString=function(N){var B;typeof N=="string"&&(N={ch1:N});var oe=N.ch1,de=N.ch2,ge=N.ch3,je=N.ch4,Te=N.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof oe=="string"&&oe.charAt(0)!=="#"){var tt=new K6(oe);if(tt.ok)oe=tt.toHex();else if(!/^\d*\.?\d*$/.test(oe))throw new Error('Invalid color "'+oe+'" passed to jsPDF.encodeColorString.')}if(typeof oe=="string"&&/^#[0-9A-Fa-f]{3}$/.test(oe)&&(oe="#"+oe[1]+oe[1]+oe[2]+oe[2]+oe[3]+oe[3]),typeof oe=="string"&&/^#[0-9A-Fa-f]{6}$/.test(oe)){var Qe=parseInt(oe.substr(1),16);oe=Qe>>16&255,de=Qe>>8&255,ge=255&Qe}if(de===void 0||je===void 0&&oe===de&&de===ge)B=typeof oe=="string"?oe+" "+Te[0]:N.precision===2?A(oe/255)+" "+Te[0]:O(oe/255)+" "+Te[0];else if(je===void 0||en(je)==="object"){if(je&&!isNaN(je.a)&&je.a===0)return["1.","1.","1.",Te[1]].join(" ");B=typeof oe=="string"?[oe,de,ge,Te[1]].join(" "):N.precision===2?[A(oe/255),A(de/255),A(ge/255),Te[1]].join(" "):[O(oe/255),O(de/255),O(ge/255),Te[1]].join(" ")}else B=typeof oe=="string"?[oe,de,ge,je,Te[2]].join(" "):N.precision===2?[A(oe),A(de),A(ge),A(je),Te[2]].join(" "):[O(oe),O(de),O(ge),O(je),Te[2]].join(" ");return B},is=h.__private__.getFilters=function(){return a},zi=h.__private__.putStream=function(N){var B=(N=N||{}).data||"",oe=N.filters||is(),de=N.alreadyAppliedFilters||[],ge=N.addLength1||!1,je=B.length,Te=N.objectId,tt=function(gn){return gn};if(u!==null&&Te===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");u!==null&&(tt=br.encryptor(Te,0));var Qe={};oe===!0&&(oe=["FlateEncode"]);var kt=N.additionalKeyValues||[],Et=(Qe=Xe.API.processDataByFilters!==void 0?Xe.API.processDataByFilters(B,oe):{data:B,reverseChain:[]}).reverseChain+(Array.isArray(de)?de.join(" "):de.toString());if(Qe.data.length!==0&&(kt.push({key:"Length",value:Qe.data.length}),ge===!0&&kt.push({key:"Length1",value:je})),Et.length!=0)if(Et.split("/").length-1==1)kt.push({key:"Filter",value:Et});else{kt.push({key:"Filter",value:"["+Et+"]"});for(var Bt=0;Bt<kt.length;Bt+=1)if(kt[Bt].key==="DecodeParms"){for(var Jn=[],sn=0;sn<Qe.reverseChain.split("/").length-1;sn+=1)Jn.push("null");Jn.push(kt[Bt].value),kt[Bt].value="["+Jn.join(" ")+"]"}}te("<<");for(var nn=0;nn<kt.length;nn++)te("/"+kt[nn].key+" "+kt[nn].value);te(">>"),Qe.data.length!==0&&(te("stream"),te(tt(Qe.data)),te("endstream"))},xl=h.__private__.putPage=function(N){var B=N.number,oe=N.data,de=N.objId,ge=N.contentsObjId;vr(de,!0),te("<</Type /Page"),te("/Parent "+N.rootDictionaryObjId+" 0 R"),te("/Resources "+N.resourceDictionaryObjId+" 0 R"),te("/MediaBox ["+parseFloat(M(N.mediaBox.bottomLeftX))+" "+parseFloat(M(N.mediaBox.bottomLeftY))+" "+M(N.mediaBox.topRightX)+" "+M(N.mediaBox.topRightY)+"]"),N.cropBox!==null&&te("/CropBox ["+M(N.cropBox.bottomLeftX)+" "+M(N.cropBox.bottomLeftY)+" "+M(N.cropBox.topRightX)+" "+M(N.cropBox.topRightY)+"]"),N.bleedBox!==null&&te("/BleedBox ["+M(N.bleedBox.bottomLeftX)+" "+M(N.bleedBox.bottomLeftY)+" "+M(N.bleedBox.topRightX)+" "+M(N.bleedBox.topRightY)+"]"),N.trimBox!==null&&te("/TrimBox ["+M(N.trimBox.bottomLeftX)+" "+M(N.trimBox.bottomLeftY)+" "+M(N.trimBox.topRightX)+" "+M(N.trimBox.topRightY)+"]"),N.artBox!==null&&te("/ArtBox ["+M(N.artBox.bottomLeftX)+" "+M(N.artBox.bottomLeftY)+" "+M(N.artBox.topRightX)+" "+M(N.artBox.topRightY)+"]"),typeof N.userUnit=="number"&&N.userUnit!==1&&te("/UserUnit "+N.userUnit),Gt.publish("putPage",{objId:de,pageContext:st[B],pageNumber:B,page:oe}),te("/Contents "+ge+" 0 R"),te(">>"),te("endobj");var je=oe.join(`
459`);return S===w&&(je+=`
460Q`),vr(ge,!0),zi({data:je,filters:is(),objectId:ge}),te("endobj"),de},Ts=h.__private__.putPages=function(){var N,B,oe=[];for(N=1;N<=Pt;N++)st[N].objId=dr(),st[N].contentsObjId=dr();for(N=1;N<=Pt;N++)oe.push(xl({number:N,data:Se[N],objId:st[N].objId,contentsObjId:st[N].contentsObjId,mediaBox:st[N].mediaBox,cropBox:st[N].cropBox,bleedBox:st[N].bleedBox,trimBox:st[N].trimBox,artBox:st[N].artBox,userUnit:st[N].userUnit,rootDictionaryObjId:ra,resourceDictionaryObjId:ns}));vr(ra,!0),te("<</Type /Pages");var de="/Kids [";for(B=0;B<Pt;B++)de+=oe[B]+" 0 R ";te(de+"]"),te("/Count "+Pt),te(">>"),te("endobj"),Gt.publish("postPutPages")},vl=function(N){Gt.publish("putFont",{font:N,out:te,newObject:Tn,putStream:zi}),N.isAlreadyPutted!==!0&&(N.objectNumber=Tn(),te("<<"),te("/Type /Font"),te("/BaseFont /"+yd(N.postScriptName)),te("/Subtype /Type1"),typeof N.encoding=="string"&&te("/Encoding /"+N.encoding),te("/FirstChar 32"),te("/LastChar 255"),te(">>"),te("endobj"))},Ec=function(N){N.objectNumber=Tn();var B=[];B.push({key:"Type",value:"/XObject"}),B.push({key:"Subtype",value:"/Form"}),B.push({key:"BBox",value:"["+[M(N.x),M(N.y),M(N.x+N.width),M(N.y+N.height)].join(" ")+"]"}),B.push({key:"Matrix",value:"["+N.matrix.toString()+"]"});var oe=N.pages[1].join(`
461`);zi({data:oe,additionalKeyValues:B,objectId:N.objectNumber}),te("endobj")},Cc=function(N,B){B||(B=21);var oe=Tn(),de=function(Te,tt){var Qe,kt=[],Et=1/(tt-1);for(Qe=0;Qe<1;Qe+=Et)kt.push(Qe);if(kt.push(1),Te[0].offset!=0){var Bt={offset:0,color:Te[0].color};Te.unshift(Bt)}if(Te[Te.length-1].offset!=1){var Jn={offset:1,color:Te[Te.length-1].color};Te.push(Jn)}for(var sn="",nn=0,gn=0;gn<kt.length;gn++){for(Qe=kt[gn];Qe>Te[nn+1].offset;)nn++;var jn=Te[nn].offset,En=(Qe-jn)/(Te[nn+1].offset-jn),Pr=Te[nn].color,wo=Te[nn+1].color;sn+=Z(Math.round((1-En)*Pr[0]+En*wo[0]).toString(16))+Z(Math.round((1-En)*Pr[1]+En*wo[1]).toString(16))+Z(Math.round((1-En)*Pr[2]+En*wo[2]).toString(16))}return sn.trim()}(N.colors,B),ge=[];ge.push({key:"FunctionType",value:"0"}),ge.push({key:"Domain",value:"[0.0 1.0]"}),ge.push({key:"Size",value:"["+B+"]"}),ge.push({key:"BitsPerSample",value:"8"}),ge.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),ge.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),zi({data:de,additionalKeyValues:ge,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:oe}),te("endobj"),N.objectNumber=Tn(),te("<< /ShadingType "+N.type),te("/ColorSpace /DeviceRGB");var je="/Coords ["+M(parseFloat(N.coords[0]))+" "+M(parseFloat(N.coords[1]))+" ";N.type===2?je+=M(parseFloat(N.coords[2]))+" "+M(parseFloat(N.coords[3])):je+=M(parseFloat(N.coords[2]))+" "+M(parseFloat(N.coords[3]))+" "+M(parseFloat(N.coords[4]))+" "+M(parseFloat(N.coords[5])),te(je+="]"),N.matrix&&te("/Matrix ["+N.matrix.toString()+"]"),te("/Function "+oe+" 0 R"),te("/Extend [true true]"),te(">>"),te("endobj")},Ac=function(N,B){var oe=dr(),de=Tn();B.push({resourcesOid:oe,objectOid:de}),N.objectNumber=de;var ge=[];ge.push({key:"Type",value:"/Pattern"}),ge.push({key:"PatternType",value:"1"}),ge.push({key:"PaintType",value:"1"}),ge.push({key:"TilingType",value:"1"}),ge.push({key:"BBox",value:"["+N.boundingBox.map(M).join(" ")+"]"}),ge.push({key:"XStep",value:M(N.xStep)}),ge.push({key:"YStep",value:M(N.yStep)}),ge.push({key:"Resources",value:oe+" 0 R"}),N.matrix&&ge.push({key:"Matrix",value:"["+N.matrix.toString()+"]"}),zi({data:N.stream,additionalKeyValues:ge,objectId:N.objectNumber}),te("endobj")},hx=function(N){for(var B in N.objectNumber=Tn(),te("<<"),N)switch(B){case"opacity":te("/ca "+A(N[B]));break;case"stroke-opacity":te("/CA "+A(N[B]))}te(">>"),te("endobj")},Du=function(N){vr(N.resourcesOid,!0),te("<<"),te("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),function(){for(var B in te("/Font <<"),mt)mt.hasOwnProperty(B)&&(f===!1||f===!0&&p.hasOwnProperty(B))&&te("/"+B+" "+mt[B].objectNumber+" 0 R");te(">>")}(),function(){if(Object.keys(dt).length>0){for(var B in te("/Shading <<"),dt)dt.hasOwnProperty(B)&&dt[B]instanceof Wl&&dt[B].objectNumber>=0&&te("/"+B+" "+dt[B].objectNumber+" 0 R");Gt.publish("putShadingPatternDict"),te(">>")}}(),function(B){if(Object.keys(dt).length>0){for(var oe in te("/Pattern <<"),dt)dt.hasOwnProperty(oe)&&dt[oe]instanceof h.TilingPattern&&dt[oe].objectNumber>=0&&dt[oe].objectNumber<B&&te("/"+oe+" "+dt[oe].objectNumber+" 0 R");Gt.publish("putTilingPatternDict"),te(">>")}}(N.objectOid),function(){if(Object.keys(ht).length>0){var B;for(B in te("/ExtGState <<"),ht)ht.hasOwnProperty(B)&&ht[B].objectNumber>=0&&te("/"+B+" "+ht[B].objectNumber+" 0 R");Gt.publish("putGStateDict"),te(">>")}}(),function(){for(var B in te("/XObject <<"),_t)_t.hasOwnProperty(B)&&_t[B].objectNumber>=0&&te("/"+B+" "+_t[B].objectNumber+" 0 R");Gt.publish("putXobjectDict"),te(">>")}(),te(">>"),te("endobj")},hp=function(N){wt[N.fontName]=wt[N.fontName]||{},wt[N.fontName][N.fontStyle]=N.id},fp=function(N,B,oe,de,ge){var je={id:"F"+(Object.keys(mt).length+1).toString(10),postScriptName:N,fontName:B,fontStyle:oe,encoding:de,isStandardFont:ge||!1,metadata:{}};return Gt.publish("addFont",{font:je,instance:this}),mt[je.id]=je,hp(je),je.id},qi=h.__private__.pdfEscape=h.pdfEscape=function(N,B){return function(oe,de){var ge,je,Te,tt,Qe,kt,Et,Bt,Jn;if(Te=(de=de||{}).sourceEncoding||"Unicode",Qe=de.outputEncoding,(de.autoencode||Qe)&&mt[Be].metadata&&mt[Be].metadata[Te]&&mt[Be].metadata[Te].encoding&&(tt=mt[Be].metadata[Te].encoding,!Qe&&mt[Be].encoding&&(Qe=mt[Be].encoding),!Qe&&tt.codePages&&(Qe=tt.codePages[0]),typeof Qe=="string"&&(Qe=tt[Qe]),Qe)){for(Et=!1,kt=[],ge=0,je=oe.length;ge<je;ge++)(Bt=Qe[oe.charCodeAt(ge)])?kt.push(String.fromCharCode(Bt)):kt.push(oe[ge]),kt[ge].charCodeAt(0)>>8&&(Et=!0);oe=kt.join("")}for(ge=oe.length;Et===void 0&&ge!==0;)oe.charCodeAt(ge-1)>>8&&(Et=!0),ge--;if(!Et)return oe;for(kt=de.noBOM?[]:[254,255],ge=0,je=oe.length;ge<je;ge++){if((Jn=(Bt=oe.charCodeAt(ge))>>8)>>8)throw new Error("Character at position "+ge+" of string '"+oe+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");kt.push(Jn),kt.push(Bt-(Jn<<8))}return String.fromCharCode.apply(void 0,kt)}(N,B).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Fu=h.__private__.beginPage=function(N){Se[++Pt]=[],st[Pt]={objId:0,contentsObjId:0,userUnit:Number(l),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(N[0]),topRightY:Number(N[1])}},mp(Pt),qe(Se[q])},pp=function(N,B){var oe,de,ge;switch(n=B||n,typeof N=="string"&&(oe=y(N.toLowerCase()),Array.isArray(oe)&&(de=oe[0],ge=oe[1])),Array.isArray(N)&&(de=N[0]*it,ge=N[1]*it),isNaN(de)&&(de=i[0],ge=i[1]),(de>14400||ge>14400)&&(an.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),de=Math.min(14400,de),ge=Math.min(14400,ge)),i=[de,ge],n.substr(0,1)){case"l":ge>de&&(i=[ge,de]);break;case"p":de>ge&&(i=[ge,de])}Fu(i),_x(xt),te(Ic),zu!==0&&te(zu+" J"),oa!==0&&te(oa+" j"),Gt.publish("addPage",{pageNumber:Pt})},Mu=function(N){N>0&&N<=Pt&&(Se.splice(N,1),st.splice(N,1),Pt--,q>Pt&&(q=Pt),this.setPage(q))},mp=function(N){N>0&&N<=Pt&&(q=N)},gp=h.__private__.getNumberOfPages=h.getNumberOfPages=function(){return Se.length-1},xp=function(N,B,oe){var de,ge=void 0;return oe=oe||{},N=N!==void 0?N:mt[Be].fontName,B=B!==void 0?B:mt[Be].fontStyle,de=N.toLowerCase(),wt[de]!==void 0&&wt[de][B]!==void 0?ge=wt[de][B]:wt[N]!==void 0&&wt[N][B]!==void 0?ge=wt[N][B]:oe.disableWarning===!1&&an.warn("Unable to look up font label for font '"+N+"', '"+B+"'. Refer to getFontList() for available fonts."),ge||oe.noFallback||(ge=wt.times[B])==null&&(ge=wt.times.normal),ge},Os=h.__private__.putInfo=function(){var N=Tn(),B=function(de){return de};for(var oe in u!==null&&(B=br.encryptor(N,0)),te("<<"),te("/Producer ("+qi(B("jsPDF "+Xe.version))+")"),at)at.hasOwnProperty(oe)&&at[oe]&&te("/"+oe.substr(0,1).toUpperCase()+oe.substr(1)+" ("+qi(B(at[oe]))+")");te("/CreationDate ("+qi(B(I))+")"),te(">>"),te("endobj")},Pc=h.__private__.putCatalog=function(N){var B=(N=N||{}).rootDictionaryObjId||ra;switch(Tn(),te("<<"),te("/Type /Catalog"),te("/Pages "+B+" 0 R"),he||(he="fullwidth"),he){case"fullwidth":te("/OpenAction [3 0 R /FitH null]");break;case"fullheight":te("/OpenAction [3 0 R /FitV null]");break;case"fullpage":te("/OpenAction [3 0 R /Fit]");break;case"original":te("/OpenAction [3 0 R /XYZ null null 1]");break;default:var oe=""+he;oe.substr(oe.length-1)==="%"&&(he=parseInt(he)/100),typeof he=="number"&&te("/OpenAction [3 0 R /XYZ null null "+A(he)+"]")}switch(Ve||(Ve="continuous"),Ve){case"continuous":te("/PageLayout /OneColumn");break;case"single":te("/PageLayout /SinglePage");break;case"two":case"twoleft":te("/PageLayout /TwoColumnLeft");break;case"tworight":te("/PageLayout /TwoColumnRight")}Le&&te("/PageMode /"+Le),Gt.publish("putCatalog"),te(">>"),te("endobj")},fx=h.__private__.putTrailer=function(){te("trailer"),te("<<"),te("/Size "+(Y+1)),te("/Root "+Y+" 0 R"),te("/Info "+(Y-1)+" 0 R"),u!==null&&te("/Encrypt "+br.oid+" 0 R"),te("/ID [ <"+re+"> <"+re+"> ]"),te(">>")},Kn=h.__private__.putHeader=function(){te("%PDF-"+x),te("%ºß¬à")},vp=h.__private__.putXRef=function(){var N="0000000000";te("xref"),te("0 "+(Y+1)),te("0000000000 65535 f ");for(var B=1;B<=Y;B++)typeof ee[B]=="function"?te((N+ee[B]()).slice(-10)+" 00000 n "):ee[B]!==void 0?te((N+ee[B]).slice(-10)+" 00000 n "):te("0000000000 00000 n ")},Is=h.__private__.buildDocument=function(){var N;Y=0,ue=0,ce=[],ee=[],ye=[],ra=dr(),ns=dr(),qe(ce),Gt.publish("buildDocument"),Kn(),Ts(),function(){Gt.publish("putAdditionalObjects");for(var oe=0;oe<ye.length;oe++){var de=ye[oe];vr(de.objId,!0),te(de.content),te("endobj")}Gt.publish("postPutAdditionalObjects")}(),N=[],function(){for(var oe in mt)mt.hasOwnProperty(oe)&&(f===!1||f===!0&&p.hasOwnProperty(oe))&&vl(mt[oe])}(),function(){var oe;for(oe in ht)ht.hasOwnProperty(oe)&&hx(ht[oe])}(),function(){for(var oe in _t)_t.hasOwnProperty(oe)&&Ec(_t[oe])}(),function(oe){var de;for(de in dt)dt.hasOwnProperty(de)&&(dt[de]instanceof Wl?Cc(dt[de]):dt[de]instanceof Od&&Ac(dt[de],oe))}(N),Gt.publish("putResources"),N.forEach(Du),Du({resourcesOid:ns,objectOid:Number.MAX_SAFE_INTEGER}),Gt.publish("postPutResources"),u!==null&&(br.oid=Tn(),te("<<"),te("/Filter /Standard"),te("/V "+br.v),te("/R "+br.r),te("/U <"+br.toHexString(br.U)+">"),te("/O <"+br.toHexString(br.O)+">"),te("/P "+br.P),te(">>"),te("endobj")),Os(),Pc();var B=ue;return vp(),fx(),te("startxref"),te(""+B),te("%%EOF"),qe(Se[q]),ce.join(`
462`)},Lc=h.__private__.getBlob=function(N){return new Blob([be(N)],{type:"application/pdf"})},$u=function(N){for(;N.firstChild;)N.removeChild(N.firstChild)},yi=function(N){var B,oe=N.document,de=oe.documentElement,ge=oe.head,je=oe.body;return ge||(ge=oe.createElement("head"),de.appendChild(ge)),je||(je=oe.createElement("body"),de.appendChild(je)),$u(ge),$u(je),(B=oe.createElement("style")).appendChild(oe.createTextNode("html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;}")),ge.appendChild(B),{document:oe,body:je}},Rc=h.output=h.__private__.output=(Un=function(N,B){switch(typeof(B=B||{})=="string"?B={filename:B}:B.filename=B.filename||"generated.pdf",N){case void 0:return Is();case"save":h.save(B.filename);break;case"arraybuffer":return be(Is());case"blob":return Lc(Is());case"bloburi":case"bloburl":if(vt.URL!==void 0&&typeof vt.URL.createObjectURL=="function")return vt.URL&&vt.URL.createObjectURL(Lc(Is()))||void 0;an.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var oe="",de=Is();try{oe=_S(de)}catch{oe=_S(unescape(encodeURIComponent(de)))}return"data:application/pdf;filename="+encodeURIComponent(B.filename)+";base64,"+oe;case"pdfobjectnewwindow":if(Object.prototype.toString.call(vt)==="[object Window]"){var ge="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",je=!B.pdfObjectUrl;je||(ge=B.pdfObjectUrl);var Te=vt.open();if(Te!==null){var tt=yi(Te),Qe=tt.document.createElement("script"),kt=this;Qe.src=ge,je&&(Qe.integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==",Qe.crossOrigin="anonymous"),Qe.onload=function(){Te.PDFObject.embed(kt.output("dataurlstring"),B)},tt.body.appendChild(Qe)}return Te}throw new Error("The option pdfobjectnewwindow just works in a browser-environment.");case"pdfjsnewwindow":if(Object.prototype.toString.call(vt)==="[object Window]"){var Et=B.pdfJsUrl||"examples/PDF.js/web/viewer.html",Bt=vt.open();if(Bt!==null){var Jn=yi(Bt),sn=Jn.document.createElement("iframe"),nn=Et.indexOf("?")===-1?"?":"&";kt=this,sn.id="pdfViewer",sn.width="500px",sn.height="400px",sn.src=Et+nn+"file=&downloadName="+encodeURIComponent(B.filename),sn.onload=function(){Bt.document.title=B.filename,sn.contentWindow.PDFViewerApplication.open(kt.output("bloburl"))},Jn.body.appendChild(sn)}return Bt}throw new Error("The option pdfjsnewwindow just works in a browser-environment.");case"dataurlnewwindow":if(Object.prototype.toString.call(vt)!=="[object Window]")throw new Error("The option dataurlnewwindow just works in a browser-environment.");var gn=vt.open();if(gn!==null){var jn=yi(gn),En=jn.document.createElement("iframe");En.src=this.output("datauristring",B),jn.body.appendChild(En),gn.document.title=B.filename}if(gn||typeof safari>"u")return gn;break;case"datauri":case"dataurl":return vt.document.location.href=this.output("datauristring",B);default:return null}},Un.foo=function(){try{return Un.apply(this,arguments)}catch(oe){var N=oe.stack||"";~N.indexOf(" at ")&&(N=N.split(" at ")[1]);var B="Error in function "+N.split(`
463`)[0].split("<")[0]+": "+oe.message;if(!vt.console)throw new Error(B);vt.console.error(B,oe),vt.alert&&alert(B)}},Un.foo.bar=Un,Un.foo),go=function(N){return Array.isArray(ft)===!0&&ft.indexOf(N)>-1};switch(r){case"pt":it=1;break;case"mm":it=72/25.4;break;case"cm":it=72/2.54;break;case"in":it=72;break;case"px":it=go("px_scaling")==1?.75:96/72;break;case"pc":case"em":it=12;break;case"ex":it=6;break;default:if(typeof r!="number")throw new Error("Invalid unit: "+r);it=r}var br=null;X(),$();var bp=h.__private__.getPageInfo=h.getPageInfo=function(N){if(isNaN(N)||N%1!=0)throw new Error("Invalid argument passed to 
463jsPDF.getPageInfo");return{objId:st[N].objId,pageNumber:N,pageContext:st[N]}},px=h.__private__.getPageInfoByObjId=function(N){if(isNaN(N)||N%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");for(var B in st)if(st[B].objId===N)break;return bp(B)},mx=h.__private__.getCurrentPageInfo=h.getCurrentPageInfo=function(){return{objId:st[q].objId,pageNumber:q,pageContext:st[q]}};h.addPage=function(){return pp.apply(this,arguments),this},h.setPage=function(){return mp.apply(this,arguments),qe.call(this,Se[q]),this},h.insertPage=function(N){return this.addPage(),this.movePage(q,N),this},h.movePage=function(N,B){var oe,de;if(N>B){oe=Se[N],de=st[N];for(var ge=N;ge>B;ge--)Se[ge]=Se[ge-1],st[ge]=st[ge-1];Se[B]=oe,st[B]=de,this.setPage(B)}else if(N<B){oe=Se[N],de=st[N];for(var je=N;je<B;je++)Se[je]=Se[je+1],st[je]=st[je+1];Se[B]=oe,st[B]=de,this.setPage(B)}return this},h.deletePage=function(){return Mu.apply(this,arguments),this},h.__private__.text=h.text=function(N,B,oe,de,ge){var je,Te,tt,Qe,kt,Et,Bt,Jn,sn,nn=(de=de||{}).scope||this;if(typeof N=="number"&&typeof B=="number"&&(typeof oe=="string"||Array.isArray(oe))){var gn=oe;oe=B,B=N,N=gn}if(arguments[3]instanceof et==0?(tt=arguments[4],Qe=arguments[5],en(Bt=arguments[3])==="object"&&Bt!==null||(typeof tt=="string"&&(Qe=tt,tt=null),typeof Bt=="string"&&(Qe=Bt,Bt=null),typeof Bt=="number"&&(tt=Bt,Bt=null),de={flags:Bt,angle:tt,align:Qe})):(T("The transform parameter of text() with a Matrix value"),sn=ge),isNaN(B)||isNaN(oe)||N==null)throw new Error("Invalid arguments passed to jsPDF.text");if(N.length===0)return nn;var jn,En="",Pr=typeof de.lineHeightFactor=="number"?de.lineHeightFactor:bl,wo=nn.internal.scaleFactor;function Vu(cn){return cn=cn.split("	").join(Array(de.TabLen||9).join(" ")),qi(cn,Bt)}function _l(cn){for(var dn,zn=cn.concat(),nr=[],ko=zn.length;ko--;)typeof(dn=zn.shift())=="string"?nr.push(dn):Array.isArray(cn)&&(dn.length===1||dn[1]===void 0&&dn[2]===void 0)?nr.push(dn[0]):nr.push([dn[0],dn[1],dn[2]]);return nr}function kl(cn,dn){var zn;if(typeof cn=="string")zn=dn(cn)[0];else if(Array.isArray(cn)){for(var nr,ko,Zu=cn.concat(),Gc=[],Ap=Zu.length;Ap--;)typeof(nr=Zu.shift())=="string"?Gc.push(dn(nr)[0]):Array.isArray(nr)&&typeof nr[0]=="string"&&(ko=dn(nr[0],nr[1],nr[2]),Gc.push([ko[0],ko[1],ko[2]]));zn=Gc}return zn}var aa=!1,Nl=!0;if(typeof N=="string")aa=!0;else if(Array.isArray(N)){var $c=N.concat();Te=[];for(var Bc,Lr=$c.length;Lr--;)(typeof(Bc=$c.shift())!="string"||Array.isArray(Bc)&&typeof Bc[0]!="str
463ing")&&(Nl=!1);aa=Nl}if(aa===!1)throw new Error('Type of text must be string or Array. "'+N+'" is not recognized.');typeof N=="string"&&(N=N.match(/[\r?\n]/)?N.split(/\r\n|\r|\n/g):[N]);var Sl=Q/nn.internal.scaleFactor,jl=Sl*(Pr-1);switch(de.baseline){case"bottom":oe-=jl;break;case"top":oe+=Sl-jl;break;case"hanging":oe+=Sl-2*jl;break;case"middle":oe+=Sl/2-jl}if((Et=de.maxWidth||0)>0&&(typeof N=="string"?N=nn.splitTextToSize(N,Et):Object.prototype.toString.call(N)==="[object Array]"&&(N=N.reduce(function(cn,dn){return cn.concat(nn.splitTextToSize(dn,Et))},[]))),je={text:N,x:B,y:oe,options:de,mutex:{pdfEscape:qi,activeFontKey:Be,fonts:mt,activeFontSize:Q}},Gt.publish("preProcessText",je),N=je.text,tt=(de=je.options).angle,sn instanceof et==0&&tt&&typeof tt=="number"){tt*=Math.PI/180,de.rotationDirection===0&&(tt=-tt),S===w&&(tt=-tt);var Gu=Math.cos(tt),Ms=Math.sin(tt);sn=new et(Gu,Ms,-Ms,Gu,0,0)}else tt&&tt instanceof et&&(sn=tt);S!==w||sn||(sn=xr),(kt=de.charSpace||Dc)!==void 0&&(En+=M(K(kt))+` Tc
464`,this.setCharSpace(this.getCharSpace()||0)),(Jn=de.horizontalScale)!==void 0&&(En+=M(100*Jn)+` Tz
465`),de.lang;var Vr=-1,Ep=de.renderingMode!==void 0?de.renderingMode:de.stroke,Uc=nn.internal.getCurrentPageInfo().pageContext;switch(Ep){case 0:case!1:case"fill":Vr=0;break;case 1:case!0:case"stroke":Vr=1;break;case 2:case"fillThenStroke":Vr=2;break;case 3:case"invisible":Vr=3;break;case 4:case"fillAndAddForClipping":Vr=4;break;case 5:case"strokeAndAddPathForClipping":Vr=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":Vr=6;break;case 7:case"addToPathForClipping":Vr=7}var Cp=Uc.usedRenderingMode!==void 0?Uc.usedRenderingMode:-1;Vr!==-1?En+=Vr+` Tr
466`:Cp!==-1&&(En+=`0 Tr
467`),Vr!==-1&&(Uc.usedRenderingMode=Vr),Qe=de.align||"left";var Wi,El=Q*Pr,Yu=nn.internal.pageSize.getWidth(),zc=mt[Be];kt=de.charSpace||Dc,Et=de.maxWidth||0,Bt=Object.assign({autoencode:!0,noBOM:!0},de.flags);var Cl=[],Ku=function(cn){return nn.getStringUnitWidth(cn,{font:zc,charSpace:kt,fontSize:Q,doKerning:!1})*Q/wo};if(Object.prototype.toString.call(N)==="[object Array]"){var Gr;Te=_l(N),Qe!=="left"&&(Wi=Te.map(Ku));var si,qc=0;if(Qe==="right"){B-=Wi[0],N=[],Lr=Te.length;for(var la=0;la<Lr;la++)la===0?(si=xo(B),Gr=vo(oe)):(si=K(qc-Wi[la]),Gr=-El),N.push([Te[la],si,Gr]),qc=Wi[la]}else if(Qe==="center"){B-=Wi[0]/2,N=[],Lr=Te.length;for(var ca=0;ca<Lr;ca++)ca===0?(si=xo(B),Gr=vo(oe)):(si=K((qc-Wi[ca])/2),Gr=-El),N.push([Te[ca],si,Gr]),qc=Wi[ca]}else if(Qe==="left"){N=[],Lr=Te.length;for(var Wc=0;Wc<Lr;Wc++)N.push(Te[Wc])}else if(Qe==="justify"&&zc.encoding==="Identity-H"){N=[],Lr=Te.length,Et=Et!==0?Et:Yu;for(var Al=0,Xn=0;Xn<Lr;Xn++)if(Gr=Xn===0?vo(oe):-El,si=Xn===0?xo(B):Al,Xn<Lr-1){var Px=K((Et-Wi[Xn])/(Te[Xn].split(" ").length-1)),$s=Te[Xn].split(" ");N.push([$s[0]+" ",si,Gr]),Al=0;for(var ss=1;ss<$s.length;ss++){var Pl=(Ku($s[ss-1]+" "+$s[ss])-Ku($s[ss]))*wo+Px;ss==$s.length-1?N.push([$s[ss],Pl,0]):N.push([$s[ss]+" ",Pl,0]),Al-=Pl}}else N.push([Te[Xn],si,Gr]);N.push(["",Al,0])}else{if(Qe!=="justify")throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');for(N=[],Lr=Te.length,Et=Et!==0?Et:Yu,Xn=0;Xn<Lr;Xn++){Gr=Xn===0?vo(oe):-El,si=Xn===0?xo(B):0;var Ju=Te[Xn].split(" ").length-1,Xu=Ju>0?(Et-Wi[Xn])/Ju:0;Xn<Lr-1?Cl.push(M(K(Xu))):Cl.push(0),N.push([Te[Xn],si,Gr])}}}(typeof de.R2L=="boolean"?de.R2L:we)===!0&&(N=kl(N,function(cn,dn,zn){return[cn.split("").reverse().join(""),dn,zn]})),je={text:N,x:B,y:oe,options:de,mutex:{pdfEscape:qi,activeFontKey:Be,fonts:mt,activeFontSize:Q}},Gt.publish("postProcessText",je),N=je.text,jn=je.mutex.isHex||!1;var Hc=mt[Be].encoding;Hc!=="WinAnsiEncoding"&&Hc!=="StandardEncoding"||(N=kl(N,function(cn,dn,zn){return[Vu(cn),dn,zn]})),Te=_l(N),N=[];for(var Ll,Rl,da,_o=Array.isArray(Te[0])?1:0,ua="",Vc=function(cn,dn,zn){var nr="";return zn instanceof et?(zn=typeof de.angle=="number"?cr(zn,new et(1,0,0,1,cn,dn)):cr(new et(1,0,0,1,cn,dn),zn),S===w&&(zn=cr(new et(1,0,0,-1,0,0),zn)),nr=zn.join(" ")+` Tm
468`):nr=M(cn)+" "+M(dn)+` Td
469`,nr},Rr=0;Rr<Te.length;Rr++){switch(ua="",_o){case 1:da=(jn?"<":"(")+Te[Rr][0]+(jn?">":")"),Ll=parseFloat(Te[Rr][1]),Rl=parseFloat(Te[Rr][2]);break;case 0:da=(jn?"<":"(")+Te[Rr]+(jn?">":")"),Ll=xo(B),Rl=vo(oe)}Cl!==void 0&&Cl[Rr]!==void 0&&(ua=Cl[Rr]+` Tw
470`),Rr===0?N.push(ua+Vc(Ll,Rl,sn)+da):_o===0?N.push(ua+da):_o===1&&N.push(ua+Vc(Ll,Rl,sn)+da)}N=_o===0?N.join(` Tj
471T* `):N.join(` Tj
472`),N+=` Tj
473`;var Bs=`BT
474/`;return Bs+=Be+" "+Q+` Tf
475`,Bs+=M(Q*Pr)+` TL
476`,Bs+=Fs+`
477`,Bs+=En,Bs+=N,te(Bs+="ET"),p[Be]=!0,nn};var gx=h.__private__.clip=h.clip=function(N){return te(N==="evenodd"?"W*":"W"),this};h.clipEvenOdd=function(){return gx("evenodd")},h.__private__.discardPath=h.discardPath=function(){return te("n"),this};var Ds=h.__private__.isValidStyle=function(N){var B=!1;return[void 0,null,"S","D","F","DF","FD","f","f*","B","B*","n"].indexOf(N)!==-1&&(B=!0),B};h.__private__.setDefaultPathOperation=h.setDefaultPathOperation=function(N){return Ds(N)&&(d=N),this};var yp=h.__private__.getStyle=h.getStyle=function(N){var B=d;switch(N){case"D":case"S":B="S";break;case"F":B="f";break;case"FD":case"DF":B="B";break;case"f":case"f*":case"B":case"B*":B=N}return B},Tc=h.close=function(){return te("h"),this};h.stroke=function(){return te("S"),this},h.fill=function(N){return Oc("f",N),this},h.fillEvenOdd=function(N){return Oc("f*",N),this},h.fillStroke=function(N){return Oc("B",N),this},h.fillStrokeEvenOdd=function(N){return Oc("B*",N),this};var Oc=function(N,B){en(B)==="object"?vx(B,N):te(N)},Bu=function(N){N===null||S===w&&N===void 0||(N=yp(N),te(N))};function xx(N,B,oe,de,ge){var je=new Od(B||this.boundingBox,oe||this.xStep,de||this.yStep,this.gState,ge||this.matrix
vendor: 4,524 bytes, line 477
477);je.stream=this.stream;var Te=N+"$$"+this.cloneIndex+++"$$";return kn(Te,je),je}var vx=function(N,B){var oe=qt[N.key],de=dt[oe];if(de instanceof Wl)te("q"),te(bx(B)),de.gState&&h.setGState(de.gState),te(N.matrix.toString()+" cm"),te("/"+oe+" sh"),te("Q");else if(de instanceof Od){var ge=new et(1,0,0,-1,0,wl());N.matrix&&(ge=ge.multiply(N.matrix||xr),oe=xx.call(de,N.key,N.boundingBox,N.xStep,N.yStep,ge).id),te("q"),te("/Pattern cs"),te("/"+oe+" scn"),de.gState&&h.setGState(de.gState),te(B),te("Q")}},bx=function(N){switch(N){case"f":case"F":case"n":return"W n";case"f*":return"W* n";case"B":case"S":return"W S";case"B*":return"W* S"}},ia=h.moveTo=function(N,B){return te(M(K(N))+" "+M(U(B))+" m"),this},wp=h.lineTo=function(N,B){return te(M(K(N))+" "+M(U(B))+" l"),this},sa=h.curveTo=function(N,B,oe,de,ge,je){return te([M(K(N)),M(U(B)),M(K(oe)),M(U(de)),M(K(ge)),M(U(je)),"c"].join(" ")),this};h.__private__.line=h.line=function(N,B,oe,de,ge){if(isNaN(N)||isNaN(B)||isNaN(oe)||isNaN(de)||!Ds(ge))throw new Error("Invalid arguments passed to jsPDF.line");return S===_?this.lines([[oe-N,de-B]],N,B,[1,1],ge||"S"):this.lines([[oe-N,de-B]],N,B,[1,1]).stroke()},h.__private__.lines=h.lines=function(N,B,oe,de,ge,je){var Te,tt,Qe,kt,Et,Bt,Jn,sn,nn,gn,jn,En;if(typeof N=="number"&&(En=oe,oe=B,B=N,N=En),de=de||[1,1],je=je||!1,isNaN(B)||isNaN(oe)||!Array.isArray(N)||!Array.isArray(de)||!Ds(ge)||typeof je!="boolean")throw new Error("Invalid arguments passed to jsPDF.lines");for(ia(B,oe),Te=de[0],tt=de[1],kt=N.length,gn=B,jn=oe,Qe=0;Qe<kt;Qe++)(Et=N[Qe]).length===2?(gn=Et[0]*Te+gn,jn=Et[1]*tt+jn,wp(gn,jn)):(Bt=Et[0]*Te+gn,Jn=Et[1]*tt+jn,sn=Et[2]*Te+gn,nn=Et[3]*tt+jn,gn=Et[4]*Te+gn,jn=Et[5]*tt+jn,sa(Bt,Jn,sn,nn,gn,jn));return je&&Tc(),Bu(ge),this},h.path=function(N){for(var B=0;B<N.length;B++){var oe=N[B],de=oe.c;switch(oe.op){case"m":ia(de[0],de[1]);break;case"l":wp(de[0],de[1]);break;case"c":sa.apply(this,de);break;case"h":Tc()}}return this},h.__private__.rect=h.rect=function(N,B,oe,de,ge){if(isNaN(N)||isNaN(B)||isNaN(oe)||isNaN(de)||!Ds(ge))throw new Error("Invalid arguments passed to jsPDF.rect");return S===_&&(de=-de),te([M(K(N)),M(U(B)),M(K(oe)),M(K(de)),"re"].join(" ")),Bu(ge),this},h.__private__.triangle=h.triangle=function(N,B,oe,de,ge,je,Te){if(isNaN(N)||isNaN(B)||isNaN(oe)||isNaN(de)||isNaN(ge)||isNaN(je)||!Ds(Te))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[oe-N,de-B],[ge-oe,je-de],[N-ge,B-je]],N,B,[1,1],Te,!0),this},h.__private__.roundedRect=h.roundedRect=function(N,B,oe,de,ge,je,Te){if(isNaN(N)||isNaN(B)||isNaN(oe)||isNaN(de)||isNaN(ge)||isNaN(je)||!Ds(Te))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var tt=4/3*(Math.SQRT2-1);return ge=Math.min(ge,.5*oe),je=Math.min(je,.5*de),this.lines([[oe-2*ge,0],[ge*tt,0,ge,je-je*tt,ge,je],[0,de-2*je],[0,je*tt,-ge*tt,je,-ge,je],[2*ge-oe,0],[-ge*tt,0,-ge,-je*tt,-ge,-je],[0,2*je-de],[0,-je*tt,ge*tt,-je,ge,-je]],N+ge,B,[1,1],Te,!0),this},h.__private__.ellipse=h.ellipse=function(N,B,oe,de,ge){if(isNaN(N)||isNaN(B)||isNaN(oe)||isNaN(de)||!Ds(ge))throw new Error("Invalid arguments passed to jsPDF.ellipse");var je=4/3*(Math.SQRT2-1)*oe,Te=4/3*(Math.SQRT2-1)*de;return ia(N+oe,B),sa(N+oe,B-Te,N+je,B-de,N,B-de),sa(N-je,B-de,N-oe,B-Te,N-oe,B),sa(N-oe,B+Te,N-je,B+de,N,B+de),sa(N+je,B+de,N+oe,B+Te,N+oe,B),Bu(ge),this},h.__private__.circle=h.circle=function(N,B,oe,de){if(isNaN(N)||isNaN(B)||isNaN(oe)||!Ds(de))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(N,B,oe,oe,de)},h.setFont=function(N,B,oe){return oe&&(B=R(B,oe)),Be=xp(N,B,{disableWarning:!1}),this};var yx=h.__private__.getFont=h.getFont=function(){return mt[xp.apply(h,arguments)]};h.__private__.getFontList=h.getFontList=function(){var N,B,oe={};for(N in wt)if(wt.hasOwnProperty(N))for(B in oe[N]=[],wt[N])wt[N].hasOwnProperty(B)&&oe[N].push(B);return oe},h.addFont=function(N,B,oe,de,ge){var je=["StandardEncoding","MacRomanEncoding","Identity-H","WinAnsiEncoding"];return arguments[3]&&je.indexOf(arguments[3])!==-1?ge=arguments[3]:arguments[3]&&je.indexOf(arguments[3])==-1&&(oe=R(oe,de)),fp.call(this,N,B,oe,ge=ge||"Identity-H")};var bl,xt=e.lineWidth||.200025,wx=h.__private__.getLineWidth=h.getLineWidth=function(){return xt},_x=h.__private__.setLineWidth=h.setLineWidth=function(N){return xt=N,te(M(K(N))+" w"),this};h.__private__.setLineDash=Xe.API.setLineDash=Xe.API.setLineDashPattern=function(N,B){if(N=N||[],B=B||0,isNaN(B)||!Array.isArray(N))throw new Error("Invalid arguments passed to 
477jsPDF.setLineDash");return N=N.map(function(oe){return M(K(oe))}).join(" "),B=M(K(B)),te("["+N+"] "+B+" d"),this};var kx=h.__private__.getLineHeight=h.getLineHeight=function(){return Q*bl};h.__private__.getLineHeight=h.getLineHeight=function(){return Q*bl};var Nx=h.__private__.setLineHeightFactor=h.setLineHeightFactor=function(N){return typeof(N=N||1.15)=="number"&&(bl=N),this},Sx=h.__private__.getLineHeightFactor=h.getLineHeightFactor=function(){return bl};Nx(e.lineHeight);var xo=h.__private__.getHorizontalCoordinate=function(N){return K(N)},vo=h.__private__.getVerticalCoordinate=function(N){return S===w?N:st[q].mediaBox.topRightY-st[q].mediaBox.bottomLeftY-K(N)},jx=h.__private__.getHorizontalCoordinateString=h.getHorizontalCoordinateString=function(N){return M(xo(N))},Ex=h.__private__.getVerticalCoordinateString=h.getVerticalCoordinateString=function(N){return M(vo(N))},Ic=e.strokeColor||"0 G";h.__private__.getStrokeColor=h.getDrawColor=function(){return Rs(Ic)},h.__private__.setStrokeColor=h.setDrawColor=function(N,B,oe,de){return Ic=rs({ch1:N,ch2:B,ch3:oe,ch4:de,pdfColorType:"draw",precision:2}),te(Ic),this};var Uu=e.fillColor||"0 g";h.__private__.getFillColor=h.getFillColor=function(){return Rs(Uu)},h.__private__.setFillColor=h.setFillColor=function(N,B,oe,de){return Uu=rs({ch1:N,ch2:B,ch3:oe,ch4:de,pdfColorType:"fill",precision:2}),te(Uu),this};var Fs=e.textColor||"0 g",Cx=h.__private__.getTextColor=h.getTextColor=function(){return Rs(Fs)};h.__private__.setTextColor=h.setTextColor=function(N,B,oe,de){return Fs=rs({ch1:N,ch2:B,ch3:oe,ch4:de,pdfColorType:"text",precision:3}),this};var Dc=e.charSpace,Ax=h.__private__.getCharSpace=h.getCharSpace=function(){return parseFloat(Dc||0)};h.__private__.setCharSpace=h.setCharSpace=function(N){if(isNaN(N))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return Dc=N,this};var zu=0;h.CapJoinStyles={0:0,butt:0,but:0,miter:0,1:1,round:1,rounded:1,circle:1,2:2,projecting:2,project:2,square:2,bevel:2},h.__private__.setLineCap=h.setLineCap=function(N){var B=h.CapJoinStyles[N];if(B===void 0)throw new Error("Line cap style of '"+N+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return zu=B,te(B+" J"),this};var oa=0;h.__private__.setLineJoin=h.setLineJoin=function(N){var B=h.CapJoinStyles[N];if(B===void 0)throw new Error("Line join style of '"+N+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return oa=B,te(B+" j"),this},h.__private__.setLineMiterLimit=h.__private__.setMiterLimit=h.setLineMiterLimit=h.setMiterLimit=function(N){if(N=N||0,isNaN(N))throw new Error("Invalid argument passed to jsPDF.setLineMiterLimit");return te(M(K(N))+" M"),this},h.GState=f0,h.setGState=function(N){(N=typeof N=="string"?ht[bt[N]]:qu(null,N)).equals(ln)||(te("/"+N.id+" gs"),ln=N)};var qu=function(N,B){if(!N||!bt[N]){var oe=!1;for(var de in ht)if(ht.hasOwnProperty(de)&&ht[de].equals(B)){oe=!0;break}if(oe)B=ht[de];else{var ge="GS"+(Object.keys(ht).length+1).toString(10);ht[ge]=B,B.id=ge}return N&&(bt[N]=B.id),Gt.publish("addGState",B),B}};h.addGState=function(N,B){return qu(N,B),this},h.saveGraphicsState=function(){return te("q"),Mt.push({key:Be,size:Q,color:Fs}),this},h.restoreGraphicsState=function(){te("Q");var N=Mt.pop();return Be=N.key,Q=N.size,Fs=N.color,ln=null,this},h.setCurrentTransformationMatrix=function(N){return te(N.toString()+" cm"),this},h.comment=function(N){return te("#"+N),this};var yl=function(N,B){var oe=N||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return oe},set:function(je){isNaN(je)||(oe=parseFloat(je))}});var de=B||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return de},set:function(je){isNaN(je)||(de=parseFloat(je))}});var ge="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return ge},set:function(je){ge=je.toString()}}),this},Wu=function(N,B,oe,de){yl.call(this,N,B),this.type="rect";var ge=oe||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return ge},set:function(Te){isNaN(Te)||(ge=parseFloat(Te))}});var je=de||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return je},set:function(Te){isNaN(Te)||(je=parseFloat(Te))}}),this},Fc=function(){this.page=Pt,this.currentPage=q,this.pages=Se.slice(0),this.pagesContext=st.slice(0),this.x=ze,this.y=zt,this.matrix=yt,this.width=_p(q),this.height=yo(q),this.outputDestination=Re,this.id="",this.objectNumber=-1};Fc.prototype.restore=function(){Pt=this.page,q=this.currentPage,st=this.pagesContext,Se=this.pages,ze=this.x,zt=this.y,yt=this.matrix,bo(q,this.width),kp(q,this.height),Re=this.outputDestination};var Hu=function(N,B,oe,de,ge){Rn.push(new Fc),Pt=q=0,Se=[],ze=N,zt=B,yt=ge,Fu([oe,de])};for(var Mc in h.beginFormObject=function(N,B,oe,de,ge){return Hu(N,B,oe,de,ge),this},h.endFormObject=function(N){return function(B){if($t[B])Rn.pop().restore(
vendor: 4,758 bytes, line 477
477);else{var oe=new Fc,de="Xo"+(Object.keys(_t).length+1).toString(10);oe.id=de,$t[B]=de,_t[de]=oe,Gt.publish("addFormObject",oe),Rn.pop().restore()}}(N),this},h.doFormObject=function(N,B){var oe=_t[$t[N]];return te("q"),te(B.toString()+" cm"),te("/"+oe.id+" Do"),te("Q"),this},h.getFormObject=function(N){var B=_t[$t[N]];return{x:B.x,y:B.y,width:B.width,height:B.height,matrix:B.matrix}},h.save=function(N,B){return N=N||"generated.pdf",(B=B||{}).returnPromise=B.returnPromise||!1,B.returnPromise===!1?(zl(Lc(Is()),N),typeof zl.unload=="function"&&vt.setTimeout&&setTimeout(zl.unload,911),this):new Promise(function(oe,de){try{var ge=zl(Lc(Is()),N);typeof zl.unload=="function"&&vt.setTimeout&&setTimeout(zl.unload,911),oe(ge)}catch(je){de(je.message)}})},Xe.API)Xe.API.hasOwnProperty(Mc)&&(Mc==="events"&&Xe.API.events.length?function(N,B){var oe,de,ge;for(ge=B.length-1;ge!==-1;ge--)oe=B[ge][0],de=B[ge][1],N.subscribe.apply(N,[oe].concat(typeof de=="function"?[de]:de))}(Gt,Xe.API.events):h[Mc]=Xe.API[Mc]);function _p(N){return st[N].mediaBox.topRightX-st[N].mediaBox.bottomLeftX}function bo(N,B){st[N].mediaBox.topRightX=B+st[N].mediaBox.bottomLeftX}function yo(N){return st[N].mediaBox.topRightY-st[N].mediaBox.bottomLeftY}function kp(N,B){st[N].mediaBox.topRightY=B+st[N].mediaBox.bottomLeftY}var Np=h.getPageWidth=function(N){return _p(N=N||q)/it},Sp=h.setPageWidth=function(N,B){bo(N,B*it)},wl=h.getPageHeight=function(N){return yo(N=N||q)/it},jp=h.setPageHeight=function(N,B){kp(N,B*it)};return h.internal={pdfEscape:qi,getStyle:yp,getFont:yx,getFontSize:ve,getCharSpace:Ax,getTextColor:Cx,getLineHeight:kx,getLineHeightFactor:Sx,getLineWidth:wx,write:Oe,getHorizontalCoordinate:xo,getVerticalCoordinate:vo,getCoordinateString:jx,getVerticalCoordinateString:Ex,collections:{},newObject:Tn,newAdditionalObject:gl,newObjectDeferred:dr,newObjectDeferredBegin:vr,getFilters:is,putStream:zi,events:Gt,scaleFactor:it,pageSize:{getWidth:function(){return Np(q)},setWidth:function(N){Sp(q,N)},getHeight:function(){return wl(q)},setHeight:function(N){jp(q,N)}},encryptionOptions:u,encryption:br,getEncryptor:function(N){return u!==null?br.encryptor(N,0):function(B){return B}},output:Rc,getNumberOfPages:gp,get pages(){return Se},out:te,f2:A,f3:O,getPageInfo:bp,getPageInfoByObjId:px,getCurrentPageInfo:mx,getPDFVersion:g,Point:yl,Rectangle:Wu,Matrix:et,hasHotfix:go},Object.defineProperty(h.internal.pageSize,"width",{get:function(){return Np(q)},set:function(N){Sp(q,N)},enumerable:!0,configurable:!0}),Object.defineProperty(h.internal.pageSize,"height",{get:function(){return wl(q)},set:function(N){jp(q,N)},enumerable:!0,configurable:!0}),(function(N){for(var B=0,oe=se.length;B<oe;B++){var de=fp.call(this,N[B][0],N[B][1],N[B][2],se[B][3],!0);f===!1&&(p[de]=!0);var ge=N[B][0].split("-");hp({id:de,fontName:ge[0],fontStyle:ge[1]||""})}Gt.publish("addFonts",{fonts:mt,dictionary:wt})}).call(h,se),Be="F1",pp(i,n),Gt.publish("initialized"),h}bd.prototype.lsbFirstWord=function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)},bd.prototype.toHexString=function(e){return e.split("").map(function(t){return("0"+(255&t.charCodeAt(0)).toString(16)).slice(-2)}).join("")},bd.prototype.hexToBytes=function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(String.fromCharCode(parseInt(e.substr(n,2),16)));return t.join("")},bd.prototype.processOwnerPassword=function(e,t){return w1(y1(t).substr(0,5),e)},bd.prototype.encryptor=function(e,t){var n=y1(this.encryptionKey+String.fromCharCode(255&e,e>>8&255,e>>16&255,255&t,t>>8&255)).substr(0,10);return function(r){return w1(n,r)}},f0.prototype.equals=function(e){var t,n="id,objectNumber,equals";if(!e||en(e)!==en(this))return!1;var r=0;for(t in this)if(!(n.indexOf(t)>=0)){if(this.hasOwnProperty(t)&&!e.hasOwnProperty(t)||this[t]!==e[t])return!1;r++}for(t in e)e.hasOwnProperty(t)&&n.indexOf(t)<0&&r--;return r===0},Xe.API={events:[]},Xe.version="4.2.1";var Fn=Xe.API,I2=1,jc=function(e){return e.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},od=function(e){return e.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},vc=function(e){return e.toString().replace(/#/g,"#23").replace(/[\s\n\r()<>[\]{}\/%]/g,function(t){var n=t.charCodeAt(0).toString(16).toUpperCase();return"#"+(n.length===1?"0"+n:n)})},jt=function(e){return e.toFixed(2)},ka=function(e){return e.toFixed(5)};Fn.__acroform__={};var bi=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e},jS=function(e){return e*I2},Vs=function(e){var t=new Q6,n=Ke.internal.getHeight(e)||0,r=Ke.internal.getWidth(e)||0;return t.BBox=[0,0,Number(jt(r)),Number(jt(n))],t},sV=Fn.__acroform__.setBit=function(e,t){if(e=e||0,t=t||0,isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to 
477jsPDF.API.__acroform__.setBit");return e|1<<t},oV=Fn.__acroform__.clearBit=function(e,t){if(e=e||0,t=t||0,isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBit");return e&~(1<<t)},aV=Fn.__acroform__.getBit=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBit");return e&1<<t?1:0},Vn=Fn.__acroform__.getBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return aV(e,t-1)},Gn=Fn.__acroform__.setBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return sV(e,t-1)},Yn=Fn.__acroform__.clearBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return oV(e,t-1)},lV=Fn.__acroform__.calculateCoordinates=function(e,t){var n=t.internal.getHorizontalCoordinate,r=t.internal.getVerticalCoordinate,i=e[0],s=e[1],a=e[2],l=e[3],c={};return c.lowerLeft_X=n(i)||0,c.lowerLeft_Y=r(s+l)||0,c.upperRight_X=n(i+a)||0,c.upperRight_Y=r(s)||0,[Number(jt(c.lowerLeft_X)),Number(jt(c.lowerLeft_Y)),Number(jt(c.upperRight_X)),Number(jt(c.upperRight_Y))]},cV=function(e){if(e.appearanceStreamContent)return e.appearanceStreamContent;if(e.V||e.DV){var t=[],n=e._V||e.DV,r=_1(e,n),i=e.scope.internal.getFont(e.fontName,e.fontStyle).id;t.push("/Tx BMC"),t.push("q"),t.push("BT"),t.push(e.scope.__private__.encodeColorString(e.color)),t.push("/"+i+" "+jt(r.fontSize)+" Tf"),t.push("1 0 0 1 0 0 Tm"),t.push(r.text),t.push("ET"),t.push("Q"),t.push("EMC");var s=Vs(e);return s.scope=e.scope,s.stream=t.join(`
478`),s}},_1=function(e,t){var n=e.fontSize===0?e.maxFontSize:e.fontSize,r={text:"",fontSize:""},i=(t=(t=t.substr(0,1)=="("?t.substr(1):t).substr(t.length-1)==")"?t.substr(0,t.length-1):t).split(" ");i=e.multiline?i.map(function(A){return A.split(`
479`)}):i.map(function(A){return[A]});var s=n,a=Ke.internal.getHeight(e)||0;a=a<0?-a:a;var l=Ke.internal.getWidth(e)||0;l=l<0?-l:l;var c=function(A,O,K){if(A+1<i.length){var U=O+" "+i[A+1][0];return Lm(U,e,K).width<=l-4}return!1};s++;e:for(;s>0;){t="",s--;var d,u,f=Lm("3",e,s).height,p=e.multiline?a-s:(a-f)/2,h=p+=2,x=0,g=0,b=0;if(s<=0){t=`(...) Tj
480`,t+="% Width of Text: "+Lm(t,e,s=12).width+", FieldWidth:"+l+`
481`;break}for(var y="",_=0,w=0;w<i.length;w++)if(i.hasOwnProperty(w)){var S=!1;
vendor: 35,935 bytes, lines 481-496
481if(i[w].length!==1&&b!==i[w].length-1){if((f+2)*(_+2)+2>a)continue e;y+=i[w][b],S=!0,g=w,w--}else{y=(y+=i[w][b]+" ").substr(y.length-1)==" "?y.substr(0,y.length-1):y;var C=parseInt(w),P=c(C,y,s),R=w>=i.length-1;if(P&&!R){y+=" ",b=0;continue}if(P||R){if(R)g=C;else if(e.multiline&&(f+2)*(_+2)+2>a)continue e}else{if(!e.multiline||(f+2)*(_+2)+2>a)continue e;g=C}}for(var M="",T=x;T<=g;T++){var H=i[T];if(e.multiline){if(T===g){M+=H[b]+" ",b=(b+1)%H.length;continue}if(T===x){M+=H[H.length-1]+" ";continue}}M+=H[0]+" "}switch(M=M.substr(M.length-1)==" "?M.substr(0,M.length-1):M,u=Lm(M,e,s).width,e.textAlign){case"right":d=l-u-2;break;case"center":d=(l-u)/2;break;default:d=2}t+=jt(d)+" "+jt(h)+` Td
482`,t+="("+jc(M)+`) Tj
483`,t+=-jt(d)+` 0 Td
484`,h=-(s+2),u=0,x=S?g:g+1,_++,y=""}break}return r.text=t,r.fontSize=s,r},Lm=function(e,t,n){var r=t.scope.internal.getFont(t.fontName,t.fontStyle),i=t.scope.getStringUnitWidth(e,{font:r,fontSize:parseFloat(n),charSpace:0})*parseFloat(n);return{height:t.scope.getStringUnitWidth("3",{font:r,fontSize:parseFloat(n),charSpace:0})*parseFloat(n)*1.5,width:i}},dV={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},uV=function(e,t){var n={type:"reference",object:e};t.internal.getPageInfo(e.page).pageContext.annotations.find(function(r){return r.type===n.type&&r.object===n.object})===void 0&&t.internal.getPageInfo(e.page).pageContext.annotations.push(n)},hV=function(e,t){if(t.scope=e,e.internal!==void 0&&(e.internal.acroformPlugin===void 0||e.internal.acroformPlugin.isInitialized===!1)){if(As.FieldNum=0,e.internal.acroformPlugin=JSON.parse(JSON.stringify(dV)),e.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");I2=e.internal.scaleFactor,e.internal.acroformPlugin.acroFormDictionaryRoot=new eP,e.internal.acroformPlugin.acroFormDictionaryRoot.scope=e,e.internal.acroformPlugin.acroFormDictionaryRoot._eventID=e.internal.events.subscribe("postPutResources",function(){(function(n){n.internal.events.unsubscribe(n.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete n.internal.acroformPlugin.acroFormDictionaryRoot._eventID,n.internal.acroformPlugin.printedOut=!0})(e)}),e.internal.events.subscribe("buildDocument",function(){(function(n){n.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var r=n.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var i in r)if(r.hasOwnProperty(i)){var s=r[i];s.objId=void 0,s.hasAnnotation&&uV(s,n)}})(e)}),e.internal.events.subscribe("putCatalog",function(){(function(n){if(n.internal.acroformPlugin.acroFormDictionaryRoot===void 0)throw new Error("putCatalogCallback: Root missing.");n.internal.write("/AcroForm "+n.internal.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R")})(e)}),e.internal.events.subscribe("postPutPages",function(n){(function(r,i){var s=!r;for(var a in r||(i.internal.newObjectDeferredBegin(i.internal.acroformPlugin.acroFormDictionaryRoot.objId,!0),i.internal.acroformPlugin.acroFormDictionaryRoot.putStream()),r=r||i.internal.acroformPlugin.acroFormDictionaryRoot.Kids)if(r.hasOwnProperty(a)){var l=r[a],c=[],d=l.Rect;if(l.Rect&&(l.Rect=lV(l.Rect,i)),i.internal.newObjectDeferredBegin(l.objId,!0),l.DA=Ke.createDefaultAppearanceStream(l),en(l)==="object"&&typeof l.getKeyValueListForStream=="function"&&(c=l.getKeyValueListForStream()),l.Rect=d,l.hasAppearanceStream&&!l.appearanceStreamContent){var u=cV(l);c.push({key:"AP",value:"<</N "+u+">>"}),i.internal.acroformPlugin.xForms.push(u)}if(l.appearanceStreamContent){var f="";for(var p in l.appearanceStreamContent)if(l.appearanceStreamContent.hasOwnProperty(p)){var h=l.appearanceStreamContent[p];if(f+="/"+p+" ",f+="<<",Object.keys(h).length>=1||Array.isArray(h)){for(var a in h)if(h.hasOwnProperty(a)){var x=h[a];typeof x=="function"&&(x=x.call(i,l)),f+="/"+a+" "+x+" ",i.internal.acroformPlugin.xForms.indexOf(x)>=0||i.internal.acroformPlugin.xForms.push(x)}}else typeof(x=h)=="function"&&(x=x.call(i,l)),f+="/"+a+" "+x,i.internal.acroformPlugin.xForms.indexOf(x)>=0||i.internal.acroformPlugin.xForms.push(x);f+=">>"}c.push({key:"AP",value:`<<
485`+f+">>"})}i.internal.putStream({additionalKeyValues:c,objectId:l.objId}),i.internal.out("endobj")}s&&function(g,b){for(var y in g)if(g.hasOwnProperty(y)){var _=y,w=g[y];b.internal.newObjectDeferredBegin(w.objId,!0),en(w)==="object"&&typeof w.putStream=="function"&&w.putStream(),delete g[_]}}(i.internal.acroformPlugin.xForms,i)})(n,e)}),e.internal.acroformPlugin.isInitialized=!0}},Z6=Fn.__acroform__.arrayToPdfArray=function(e,t,n){var r=function(a){return a};if(Array.isArray(e)){for(var i="[",s=0;s<e.length;s++)switch(s!==0&&(i+=" "),en(e[s])){case"boolean":case"number":case"object":i+=e[s].toString();break;case"string":e[s].substr(0,1)==="/"?i+="/"+vc(e[s].substr(1)):(t!==void 0&&n&&(r=n.internal.getEncryptor(t)),i+="("+jc(r(e[s].toString()))+")")}return i+"]"}throw new Error("Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray")},sb=function(e,t,n){var r=function(i){return i};return t!==void 0&&n&&(r=n.internal.getEncryptor(t)),(e=e||"").toString(),"("+jc(r(e))+")"},ro=function(){this._objId=void 0,this._scope=void 0,Object.defineProperty(this,"objId",{get:function(){if(this._objId===void 0){if(this.scope===void 0)return;this._objId=this.scope.internal.newObjectDeferred()}return this._objId},set:function(e){this._objId=e}}),Object.defineProperty(this,"scope",{value:this._scope,writable:!0})};ro.prototype.toString=function(){return this.objId+" 0 R"},ro.prototype.putStream=function(){var e=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:e,objectId:this.objId}),this.scope.internal.out("endobj")},ro.prototype.getKeyValueListForStream=function(){var e=[],t=Object.getOwnPropertyNames(this).filter(function(s){return s!="content"&&s!="appearanceStreamContent"&&s!="scope"&&s!="objId"&&s.substring(0,1)!="_"});for(var n in t)if(Object.getOwnPropertyDescriptor(this,t[n]).configurable===!1){var r=t[n],i=this[r];i&&(Array.isArray(i)?e.push({key:r,value:Z6(i,this.objId,this.scope)}):i instanceof ro?(i.scope=this.scope,e.push({key:r,value:i.objId+" 0 R"})):typeof i!="function"&&e.push({key:r,value:i}))}return e};var Q6=function(){ro.call(this),Object.defineProperty(this,"Type",{value:"/XObject",configurable:!1,writable:!0}),Object.defineProperty(this,"Subtype",{value:"/Form",configurable:!1,writable:!0}),Object.defineProperty(this,"FormType",{value:1,configurable:!1,writable:!0});var e,t=[];Object.defineProperty(this,"BBox",{configurable:!1,get:function(){return t},set:function(n){t=n}}),Object.defineProperty(this,"Resources",{value:"2 0 R",configurable:!1,writable:!0}),Object.defineProperty(this,"stream",{enumerable:!1,configurable:!0,set:function(n){e=n.trim()},get:function(){return e||null}})};bi(Q6,ro);var eP=function(){ro.call(this);var e,t=[];Object.defineProperty(this,"Kids",{enumerable:!1,configurable:!0,get:function(){return t.length>0?t:void 0}}),Object.defineProperty(this,"Fields",{enumerable:!1,configurable:!1,get:function(){return t}}),Object.defineProperty(this,"DA",{enumerable:!1,configurable:!1,get:function(){if(e){var n=function(r){return r};return this.scope&&(n=this.scope.internal.getEncryptor(this.objId)),"("+jc(n(e))+")"}},set:function(n){e=n}})};bi(eP,ro);var As=function e(){ro.call(this);var t=4;Object.defineProperty(this,"F",{enumerable:!1,configurable:!1,get:function(){return t},set:function(y){if(isNaN(y))throw new Error('Invalid value "'+y+'" for attribute F supplied.');t=y}}),Object.defineProperty(this,"showWhenPrinted",{enumerable:!0,configurable:!0,get:function(){return!!Vn(t,3)},set:function(y){y?this.F=Gn(t,3):this.F=Yn(t,3)}});var n=0;Object.defineProperty(this,"Ff",{enumerable:!1,configurable:!1,get:function(){return n},set:function(y){if(isNaN(y))throw new Error('Invalid value "'+y+'" for attribute Ff supplied.');n=y}});var r=[];Object.defineProperty(this,"Rect",{enumerable:!1,configurable:!1,get:function(){if(r.length!==0)return r},set:function(y){r=y!==void 0?y:[]}}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[0])?0:r[0]},set:function(y){r[0]=y}}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[1])?0:r[1]},set:function(y){r[1]=y}}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[2])?0:r[2]},set:function(y){r[2]=y}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[3])?0:r[3]},set:function(y){r[3]=y}});var i="";Object.defineProperty(this,"FT",{enumerable:!0,configurable:!1,get:function(){return i},set:function(y){switch(y){case"/Btn":case"/Tx":case"/Ch":case"/Sig":i=y;break;default:throw new Error('Invalid value "'+y+'" for attribute FT supplied.')}}});var s=null;Object.defineProperty(this,"T",{enumerable:!0,configurable:!1,get:function(){if(!s||s.length<1){if(this instanceof p0)return;s="FieldObject"+e.FieldNum++}var y=function(_){return _};return this.scope&&(y=this.scope.internal.getEncryptor(this.objId)),"("+jc(y(s))+")"},set:function(y){s=y.toString()}}),Object.defineProperty(this,"fieldName",{configurable:!0,enumerable:!0,get:function(){return s},set:function(y){s=y}});var a="helvetica";Object.defineProperty(this,"fontName",{enumerable:!0,configurable:!0,get:function(){return a},set:function(y){a=y}});var l="normal";Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,get:function(){return l},set:function(y){l=y}});var c=0;Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,get:function(){return c},set:function(y){c=y}});var d=void 0;Object.defineProperty(this,"maxFontSize",{enumerable:!0,configurable:!0,get:function(){return d===void 0?50/I2:d},set:function(y){d=y}});var u="black";Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,get:function(){return u},set:function(y){u=y}});var f="/F1 0 Tf 0 g";Object.defineProperty(this,"DA",{enumerable:!0,configurable:!1,get:function(){if(!(!f||this instanceof p0||this instanceof ac))return sb(f,this.objId,this.scope)},set:function(y){y=y.toString(),f=y}});var p=null;Object.defineProperty(this,"DV",{enumerable:!1,configurable:!1,get:function(){if(p)return this instanceof mr==0?sb(p,this.objId,this.scope):p},set:function(y){y=y.toString(),p=this instanceof mr==0?y.substr(0,1)==="("?od(y.substr(1,y.length-2)):od(y):y}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof mr==1?od(p.substr(1,p.length-1)):p},set:function(y){y=y.toString(),p=this instanceof mr==1?"/"+vc(y):y}});var h=null;Object.defineProperty(this,"_V",{enumerable:!1,configurable:!1,get:function(){if(h)return h},set:function(y){this.V=y}}),Object.defineProperty(this,"V",{enumerable:!1,configurable:!1,get:function(){if(h)return this instanceof mr==0?sb(h,this.objId,this.scope):h},set:function(y){y=y.toString(),h=this instanceof mr==0?y.substr(0,1)==="("?od(y.substr(1,y.length-2)):od(y):y}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof mr==1?od(h.substr(1,h.length-1)):h},set:function(y){y=y.toString(),h=this instanceof mr==1?"/"+vc(y):y}}),Object.defineProperty(this,"hasAnnotation",{enumerable:!0,configurable:!0,get:function(){return this.Rect}}),Object.defineProperty(this,"Type",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Annot":null}}),Object.defineProperty(this,"Subtype",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Widget":null}});var x,g=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return g},set:function(y){y=!!y,g=y}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(x)return x},set:function(y){x=y}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,1)},set:function(y){y?this.Ff=Gn(this.Ff,1):this.Ff=Yn(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,2)},set:function(y){y?this.Ff=Gn(this.Ff,2):this.Ff=Yn(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,3)},set:function(y){y?this.Ff=Gn(this.Ff,3):this.Ff=Yn(this.Ff,3)}});var b=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(b!==null)return b},set:function(y){if([0,1,2].indexOf(y)===-1)throw new Error('Invalid value "'+y+'" for attribute Q supplied.');b=y}}),Object.defineProperty(this,"textAlign",{get:function(){var y;switch(b){case 0:default:y="left";break;case 1:y="center";break;case 2:y="right"}return y},configurable:!0,enumerable:!0,set:function(y){switch(y){case"right":case 2:b=2;break;case"center":case 1:b=1;break;default:b=0}}})};bi(As,ro);var Vd=function(){As.call(this),this.FT="/Ch",this.V="()",this.fontName="zapfdingbats";var e=0;Object.defineProperty(this,"TI",{enumerable:!0,configurable:!1,get:function(){return e},set:function(n){e=n}}),Object.defineProperty(this,"topIndex",{enumerable:!0,configurable:!0,get:function(){return e},set:function(n){e=n}});var t=[];Object.defineProperty(this,"Opt",{enumerable:!0,configurable:!1,get:function(){return Z6(t,this.objId,this.scope)},set:function(n){var r,i;i=[],typeof(r=n)=="string"&&(i=function(s,a,l){l||(l=1);for(var c,d=[];c=a.exec(s);)d.push(c[l]);return d}(r,/\((.*?)\)/g)),t=i}}),this.getOptions=function(){return t},this.setOptions=function(n){t=n,this.sort&&t.sort()},this.addOption=function(n){n=(n=n||"").toString(),t.push(n),this.sort&&t.sort()},this.removeOption=function(n,r){for(r=r||!1,n=(n=n||"").toString();t.indexOf(n)!==-1&&(t.splice(t.indexOf(n),1),r!==!1););},Object.defineProperty(this,"combo",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,18)},set:function(n){n?this.Ff=Gn(this.Ff,18):this.Ff=Yn(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,19)},set:function(n){this.combo===!0&&(n?this.Ff=Gn(this.Ff,19):this.Ff=Yn(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,20)},set:function(n){n?(this.Ff=Gn(this.Ff,20),t.sort()):this.Ff=Yn(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,22)},set:function(n){n?this.Ff=Gn(this.Ff,22):this.Ff=Yn(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,23)},set:function(n){n?this.Ff=Gn(this.Ff,23):this.Ff=Yn(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,27)},set:function(n){n?this.Ff=Gn(this.Ff,27):this.Ff=Yn(this.Ff,27)}}),this.hasAppearanceStream=!1};bi(Vd,As);var Gd=function(){Vd.call(this),this.fontName="helvetica",this.combo=!1};bi(Gd,Vd);var Yd=function(){Gd.call(this),this.combo=!0};bi(Yd,Gd);var pg=function(){Yd.call(this),this.edit=!0};bi(pg,Yd);var mr=function(){As.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,15)},set:function(n){n?this.Ff=Gn(this.Ff,15):this.Ff=Yn(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,16)},set:function(n){n?this.Ff=Gn(this.Ff,16):this.Ff=Yn(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,17)},set:function(n){n?this.Ff=Gn(this.Ff,17):this.Ff=Yn(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,26)},set:function(n){n?this.Ff=Gn(this.Ff,26):this.Ff=Yn(this.Ff,26)}});var e,t={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var n=function(s){return s};if(this.scope&&(n=this.scope.internal.getEncryptor(this.objId)),Object.keys(t).length!==0){var r,i=[];for(r in i.push("<<"),t)i.push("/"+r+" ("+jc(n(t[r]))+")");return i.push(">>"),i.join(`
486`)}},set:function(n){en(n)==="object"&&(t=n)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return t.CA||""},set:function(n){typeof n=="string"&&(t.CA=n)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return e},set:function(n){var r=n==null?"":n.toString();r.substr(0,1)==="/"&&(r=r.substr(1)),e="/"+vc(r)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return e.substr(1,e.length-1)},set:function(n){e="/"+vc(n)}})};bi(mr,As);var mg=function(){mr.call(this),this.pushButton=!0};bi(mg,mr);var Kd=function(){mr.call(this),this.radio=!0,this.pushButton=!1;var e=[];Object.defineProperty(this,"Kids",{enumerable:!0,configurable:!1,get:function(){return e},set:function(t){e=t!==void 0?t:[]}})};bi(Kd,mr);var p0=function(){var e,t;As.call(this),Object.defineProperty(this,"Parent",{enumerable:!1,configurable:!1,get:function(){return e},set:function(i){e=i}}),Object.defineProperty(this,"optionName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(i){t=i}});var n,r={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var i=function(l){return l};this.scope&&(i=this.scope.internal.getEncryptor(this.objId));var s,a=[];for(s in a.push("<<"),r)a.push("/"+s+" ("+jc(i(r[s]))+")");return a.push(">>"),a.join(`
487`)},set:function(i){en(i)==="object"&&(r=i)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return r.CA||""},set:function(i){typeof i=="string"&&(r.CA=i)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return n},set:function(i){var s=i==null?"":i.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),n="/"+vc(s)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return n.substr(1,n.length-1)},set:function(i){var s=i==null?"":i.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),n="/"+vc(s)}}),this.caption="l",this.appearanceState="Off",this._AppearanceType=Ke.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};bi(p0,As),Kd.prototype.setAppearance=function(e){if(!("createAppearanceStream"in e)||!("getCA"in e))throw new Error("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");for(var t in this.Kids)if(this.Kids.hasOwnProperty(t)){var n=this.Kids[t];n.appearanceStreamContent=e.createAppearanceStream(n.optionName),n.caption=e.getCA()}},Kd.prototype.createOption=function(e){var t=new p0;return t.Parent=this,t.optionName=e,this.Kids.push(t),fV.call(this.scope,t),t};var gg=function(){mr.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=Ke.CheckBox.createAppearanceStream()};bi(gg,mr);var ac=function(){As.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,13)},set:function(t){t?this.Ff=Gn(this.Ff,13):this.Ff=Yn(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,21)},set:function(t){t?this.Ff=Gn(this.Ff,21):this.Ff=Yn(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,23)},set:function(t){t?this.Ff=Gn(this.Ff,23):this.Ff=Yn(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,24)},set:function(t){t?this.Ff=Gn(this.Ff,24):this.Ff=Yn(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,25)},set:function(t){t?this.Ff=Gn(this.Ff,25):this.Ff=Yn(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,26)},set:function(t){t?this.Ff=Gn(this.Ff,26):this.Ff=Yn(this.Ff,26)}});var e=null;Object.defineProperty(this,"MaxLen",{enumerable:!0,configurable:!1,get:function(){return e},set:function(t){e=t}}),Object.defineProperty(this,"maxLength",{enumerable:!0,configurable:!0,get:function(){return e},set:function(t){Number.isInteger(t)&&(e=t)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return this.V||this.DV}})};bi(ac,As);var xg=function(){ac.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!Vn(this.Ff,14)},set:function(e){e?this.Ff=Gn(this.Ff,14):this.Ff=Yn(this.Ff,14)}}),this.password=!0};bi(xg,ac);var Ke={CheckBox:{createAppearanceStream:function(){return{N:{On:Ke.CheckBox.YesNormal},D:{On:Ke.CheckBox.YesPushDown,Off:Ke.CheckBox.OffPushDown}}},YesPushDown:function(e){var t=Vs(e);t.scope=e.scope;var n=[],r=e.scope.internal.getFont(e.fontName,e.fontStyle).id,i=e.scope.__private__.encodeColorString(e.color),s=_1(e,e.caption);return n.push("0.749023 g"),n.push("0 0 "+jt(Ke.internal.getWidth(e))+" "+jt(Ke.internal.getHeight(e))+" re"),n.push("f"),n.push("BMC"),n.push("q"),n.push("0 0 1 rg"),n.push("/"+r+" "+jt(s.fontSize)+" Tf "+i),n.push("BT"),n.push(s.text),n.push("ET"),n.push("Q"),n.push("EMC"),t.stream=n.join(`
488`),t},YesNormal:function(e){var t=Vs(e);t.scope=e.scope;var n=e.scope.internal.getFont(e.fontName,e.fontStyle).id,r=e.scope.__private__.encodeColorString(e.color),i=[],s=Ke.internal.getHeight(e),a=Ke.internal.getWidth(e),l=_1(e,e.caption);return i.push("1 g"),i.push("0 0 "+jt(a)+" "+jt(s)+" re"),i.push("f"),i.push("q"),i.push("0 0 1 rg"),i.push("0 0 "+jt(a-1)+" "+jt(s-1)+" re"),i.push("W"),i.push("n"),i.push("0 g"),i.push("BT"),i.push("/"+n+" "+jt(l.fontSize)+" Tf "+r),i.push(l.text),i.push("ET"),i.push("Q"),t.stream=i.join(`
489`),t},OffPushDown:function(e){var t=Vs(e);t.scope=e.scope;var n=[];return n.push("0.749023 g"),n.push("0 0 "+jt(Ke.internal.getWidth(e))+" "+jt(Ke.internal.getHeight(e))+" re"),n.push("f"),t.stream=n.join(`
490`),t}},RadioButton:{Circle:{createAppearanceStream:function(e){var t={D:{Off:Ke.RadioButton.Circle.OffPushDown},N:{}};return t.N[e]=Ke.RadioButton.Circle.YesNormal,t.D[e]=Ke.RadioButton.Circle.YesPushDown,t},getCA:function(){return"l"},YesNormal:function(e){var t=Vs(e);t.scope=e.scope;var n=[],r=Ke.internal.getWidth(e)<=Ke.internal.getHeight(e)?Ke.internal.getWidth(e)/4:Ke.internal.getHeight(e)/4;r=Number((.9*r).toFixed(5));var i=Ke.internal.Bezier_C,s=Number((r*i).toFixed(5));return n.push("q"),n.push("1 0 0 1 "+ka(Ke.internal.getWidth(e)/2)+" "+ka(Ke.internal.getHeight(e)/2)+" cm"),n.push(r+" 0 m"),n.push(r+" "+s+" "+s+" "+r+" 0 "+r+" c"),n.push("-"+s+" "+r+" -"+r+" "+s+" -"+r+" 0 c"),n.push("-"+r+" -"+s+" -"+s+" -"+r+" 0 -"+r+" c"),n.push(s+" -"+r+" "+r+" -"+s+" "+r+" 0 c"),n.push("f"),n.push("Q"),t.stream=n.join(`
491`),t},YesPushDown:function(e){var t=Vs(e);t.scope=e.scope;var n=[],r=Ke.internal.getWidth(e)<=Ke.internal.getHeight(e)?Ke.internal.getWidth(e)/4:Ke.internal.getHeight(e)/4;r=Number((.9*r).toFixed(5));var i=Number((2*r).toFixed(5)),s=Number((i*Ke.internal.Bezier_C).toFixed(5)),a=Number((r*Ke.internal.Bezier_C).toFixed(5));return n.push("0.749023 g"),n.push("q"),n.push("1 0 0 1 "+ka(Ke.internal.getWidth(e)/2)+" "+ka(Ke.internal.getHeight(e)/2)+" cm"),n.push(i+" 0 m"),n.push(i+" "+s+" "+s+" "+i+" 0 "+i+" c"),n.push("-"+s+" "+i+" -"+i+" "+s+" -"+i+" 0 c"),n.push("-"+i+" -"+s+" -"+s+" -"+i+" 0 -"+i+" c"),n.push(s+" -"+i+" "+i+" -"+s+" "+i+" 0 c"),n.push("f"),n.push("Q"),n.push("0 g"),n.push("q"),n.push("1 0 0 1 "+ka(Ke.internal.getWidth(e)/2)+" "+ka(Ke.internal.getHeight(e)/2)+" cm"),n.push(r+" 0 m"),n.push(r+" "+a+" "+a+" "+r+" 0 "+r+" c"),n.push("-"+a+" "+r+" -"+r+" "+a+" -"+r+" 0 c"),n.push("-"+r+" -"+a+" -"+a+" -"+r+" 0 -"+r+" c"),n.push(a+" -"+r+" "+r+" -"+a+" "+r+" 0 c"),n.push("f"),n.push("Q"),t.stream=n.join(`
492`),t},OffPushDown:function(e){var t=Vs(e);t.scope=e.scope;var n=[],r=Ke.internal.getWidth(e)<=Ke.internal.getHeight(e)?Ke.internal.getWidth(e)/4:Ke.internal.getHeight(e)/4;r=Number((.9*r).toFixed(5));var i=Number((2*r).toFixed(5)),s=Number((i*Ke.internal.Bezier_C).toFixed(5));return n.push("0.749023 g"),n.push("q"),n.push("1 0 0 1 "+ka(Ke.internal.getWidth(e)/2)+" "+ka(Ke.internal.getHeight(e)/2)+" cm"),n.push(i+" 0 m"),n.push(i+" "+s+" "+s+" "+i+" 0 "+i+" c"),n.push("-"+s+" "+i+" -"+i+" "+s+" -"+i+" 0 c"),n.push("-"+i+" -"+s+" -"+s+" -"+i+" 0 -"+i+" c"),n.push(s+" -"+i+" "+i+" -"+s+" "+i+" 0 c"),n.push("f"),n.push("Q"),t.stream=n.join(`
493`),t}},Cross:{createAppearanceStream:function(e){var t={D:{Off:Ke.RadioButton.Cross.OffPushDown},N:{}};return t.N[e]=Ke.RadioButton.Cross.YesNormal,t.D[e]=Ke.RadioButton.Cross.YesPushDown,t},getCA:function(){return"8"},YesNormal:function(e){var t=Vs(e);t.scope=e.scope;var n=[],r=Ke.internal.calculateCross(e);return n.push("q"),n.push("1 1 "+jt(Ke.internal.getWidth(e)-2)+" "+jt(Ke.internal.getHeight(e)-2)+" re"),n.push("W"),n.push("n"),n.push(jt(r.x1.x)+" "+jt(r.x1.y)+" m"),n.push(jt(r.x2.x)+" "+jt(r.x2.y)+" l"),n.push(jt(r.x4.x)+" "+jt(r.x4.y)+" m"),n.push(jt(r.x3.x)+" "+jt(r.x3.y)+" l"),n.push("s"),n.push("Q"),t.stream=n.join(`
494`),t},YesPushDown:function(e){var t=Vs(e);t.scope=e.scope;var n=Ke.internal.calculateCross(e),r=[];return r.push("0.749023 g"),r.push("0 0 "+jt(Ke.internal.getWidth(e))+" "+jt(Ke.internal.getHeight(e))+" re"),r.push("f"),r.push("q"),r.push("1 1 "+jt(Ke.internal.getWidth(e)-2)+" "+jt(Ke.internal.getHeight(e)-2)+" re"),r.push("W"),r.push("n"),r.push(jt(n.x1.x)+" "+jt(n.x1.y)+" m"),r.push(jt(n.x2.x)+" "+jt(n.x2.y)+" l"),r.push(jt(n.x4.x)+" "+jt(n.x4.y)+" m"),r.push(jt(n.x3.x)+" "+jt(n.x3.y)+" l"),r.push("s"),r.push("Q"),t.stream=r.join(`
495`),t},OffPushDown:function(e){var t=Vs(e);t.scope=e.scope;var n=[];return n.push("0.749023 g"),n.push("0 0 "+jt(Ke.internal.getWidth(e))+" "+jt(Ke.internal.getHeight(e))+" re"),n.push("f"),t.stream=n.join(`
496`),t}}},createDefaultAppearanceStream:function(e){var t=e.scope.internal.getFont(e.fontName,e.fontStyle).id,n=e.scope.__private__.encodeColorString(e.color);return"/"+t+" "+e.fontSize+" Tf "+n}};Ke.internal={Bezier_C:.551915024494,calculateCross:function(e){var t=Ke.internal.getWidth(e),n=Ke.internal.getHeight(e),r=Math.min(t,n);return{x1:{x:(t-r)/2,y:(n-r)/2+r},x2:{x:(t-r)/2+r,y:(n-r)/2},x3:{x:(t-r)/2,y:(n-r)/2},x4:{x:(t-r)/2+r,y:(n-r)/2+r}}}},Ke.internal.getWidth=function(e){var t=0;return en(e)==="object"&&(t=jS(e.Rect[2])),t},Ke.internal.getHeight=function(e){var t=0;return en(e)==="object"&&(t=jS(e.Rect[3])),t};var fV=Fn.addField=function(e){if(hV(this,e),!(e instanceof As))throw new Error("Invalid argument passed to jsPDF.addField.");var t;return(t=e).scope.internal.acroformPlugin.printedOut&&(t.scope.internal.acroformPlugin.printedOut=!1,t.scope.internal.acroformPlugin.acroFormDictionaryRoot=null),t.scope.internal.acroformPlugin.acroFormDictionaryRoot.Fields.push(t),e.page=e.scope.internal.getCurrentPageInfo().pageNumber,this};Fn.AcroFormChoiceField=Vd,Fn.AcroFormListBox=Gd,Fn.AcroFormComboBox=Yd,Fn.AcroFormEditBox=pg,Fn.AcroFormButton=mr,Fn.AcroFormPushButton=mg,Fn.AcroFormRadioButton=Kd,Fn.AcroFormCheckBox=gg,Fn.AcroFormTextField=ac,Fn.AcroFormPasswordField=xg,Fn.AcroFormAppearance=Ke,Fn.AcroForm={ChoiceField:Vd,ListBox:Gd,ComboBox:Yd,EditBox:pg,Button:mr,PushButton:mg,RadioButton:Kd,CheckBox:gg,TextField:ac,PasswordField:xg,Appearance:Ke},Xe.AcroForm={ChoiceField:Vd,ListBox:Gd,ComboBox:Yd,EditBox:pg,Button:mr,PushButton:mg,RadioButton:Kd,CheckBox:gg,TextField:ac,PasswordField:xg,Appearance:Ke};function tP(e){return e.reduce(function(t,n,r){return t[n]=r,t},{})}(function(e){var t="addImage_";e.__addimage__={};var n="UNKNOWN",r={PNG:[[137,80,78,71]],TIFF:[[77,77,0,42],[73,73,42,0]],JPEG:[[255,216,255,224,void 0,void 0,74,70,73,70,0],[255,216,255,225,void 0,void 0,69,120,105,102,0,0],[255,216,255,219],[255,216,255,238]],JPEG2000:[[0,0,0,12,106,80,32,32]],GIF87a:[[71,73,70,56,55,97]],GIF89a:[[71,73,70,56,57,97]],WEBP:[[82,73,70,70,void 0,void 0,void 0,void 0,87,69,66,80]],BMP:[[66,77],[66,65],[67,73],[67,80],[73,67],[80,84]]},i=e.__addimage__.getImageFileTypeByImageData=function(A,O){var K,U,I,re,V,$=n;if((O=O||n)==="RGBA"||A.data!==void 0&&A.data instanceof Uint8ClampedArray&&"height"in A&&"width"in A)return"RGBA";if(P(A))for(V in r)for(I=r[V],K=0;K<I.length;K+=1){for(re=!0,U=0;U<I[K].length;U+=1)if(I[K][U]!==void 0&&I[K][U]!==A[U]){re=!1;break}if(re===!0){$=V;break}}else for(V in r)for(I=r[V],K=0;K<I.length;K+=1){for(re=!0,U=0;U<I[K].length;U+=1)if(I[K][U]!==void 0&&I[K][U]!==A.charCodeAt(U)){re=!1;break}if(re===!0){$=V;break}}return $===n&&O!==n&&($=O),$},s=function A(O){for(var K=this.internal.write,U=this.internal.putStream,I=(0,this.internal.getFilters)();I.indexOf("FlateEncode")!==-1;)I.splice(I.indexOf("FlateEncode"),1);O.objectId=this.internal.newObject();var re=[];if(re.push({key:"Type",value:"/XObject"}),re.push({key:"Subtype",value:"/Image"}),re.push({key:"Width",value:O.width}),re.push({key:"Height",value:O.height}),O.colorSpace===y.INDEXED?re.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(O.palette.length/3-1)+" "+("sMask"in O&&O.sMask!==void 0?O.objectId+2:O.objectId+1)+" 0 R]"}):(re.push({key:"ColorSpace",value:"/"+O.colorSpace}),O.colorSpace===y.DEVICE_CMYK&&re.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),re.push({key:"BitsPerComponent",value:O.bitsPerComponent}),"decodeParameters"in O&&O.decodeParameters!==void 0&&re.push({key:"DecodeParms",value:"<<"+O.decodeParameters+">>"}),"transparency"in O&&Array.isArray(O.transparency)&&O.transparency.length>0){for(var V="",$=0,D=O.transparency.length;$<D;$++)V+=O.transparency[$]+" "+O.transparency[$]+" ";re.push({key:"Mask",value:"["+V+"]"})}O.sMask!==void 0&&re.push({key:"SMask",value:O.objectId+1+" 0 R"});var ie=O.filter!==void 0?["/"+O.filter]:void 0;if(U({data:O.data,additionalKeyValues:re,alreadyAppliedFilters:ie,objectId:O.objectId}),K("endobj"),"sMask"in O&&O.sMask!==void 0){var X,E=(X=O.sMaskBitsPerComponent)!==null&&X!==void 0?X:O.bitsPerComponent,q={width:O.width,height:O.height,colorSpace:"DeviceGray",bitsPerComponent:E,data:O.sMask};"filter"in O&&(q.decodeParameters="/Predictor ".concat(O.predictor," /Colors 1 /BitsPerComponent ").concat(E," /Columns ").concat(O.width),q.filter=O.filter),A.call(this,q)}if(O.colorSpace===y.INDEXED){var F=this.internal.newObject();U({data:M(new Uint8Array(O.palette)),objectId:F}),K("endobj")}},a=function(){var A=this.internal.collections[t+"images"];for(var O in A)s.call(this,A[O])},l=function(){var A,O=this.internal.collections[t+"images"],K=this.internal.write;for(var U in O)K("/I"+(A=O[U]).index,A.objectId,"0","R")},c=function(){this.internal.collections[t+"images"]||(this.internal.collections[t+"images"]={},this.internal.events.subscribe("putResources",a),this.internal.events.subscribe("putXobjectDict",l))},d=function(){var A=this.internal.collections[t+"images"];return c.call(this),A},u=function(){return Object.keys(this.internal.collections[t+"images"]).length},f=function(A){return typeof e["process"+A.toUpperCase()]=="function"},p=function(A){return en(A)==="object"&&A.nodeType===1},h=function(A,O){if(A.nodeName==="IMG"&&A.hasAttribute("src")){var K=""+A.getAttribute("src");if(K.indexOf("data:image/")===0)return fg(unescape(K).split("base64,").pop());var U=e.loadFile(K,!0);if(U!==void 0)return U}if(A.nodeName==="CANVAS"){if(A.width===0||A.height===0)throw new Error("Given canvas must have data. Canvas width: "+A.width+", height: "+A.height);var I;switch(O){case"PNG":I="image/png";break;case"WEBP":I="image/webp";break;default:I="image/jpeg"}return fg(A.toDataURL(I,1).split("base64,").pop())}},x=function(A){var O=this.internal.collections[t+"images"];if(O){for(var K in O)if(A===O[K].alias)return O[K]}},g=function(A,O,K){return A||O||(A=-96,O=-96),A<0&&(A=-1*K.width*72/A/this.internal.scaleFactor),O<0&&(O=-1*K.height*72/O/this.internal.scaleFactor),A===0&&(A=O*K.width/K.height),O===0&&(O=A*K.height/K.width),[A,O]},b=function(A,O,K,U,I,re){var V=g.call(this,K,U,I),$=this.internal.getCoordinateString,D=this.internal.getVerticalCoordinateString,ie=d.call(this);if(K=V[0],U=V[1],ie[I.index]=I,re){re*=Math.PI/180;var X=Math.cos(re),E=Math.sin(re),q=function(Z){return Z.toFixed(4)},F=[q(X),q(E),q(-1*E),q(X),0,0,"cm"]}this.internal.write("q"),re?(this.internal.write([1,"0","0",1,$(A),D(O+U),"cm"].join(" ")),this.internal.write(F.join(" ")),this.internal.write([$(K),"0","0",$(U),"0","0","cm"].join(" "))):this.internal.write([$(K),"0","0",$(U),$(A),D(O+U),"cm"].join(" ")),this.isAdvancedAPI()&&this.internal.write([1,0,0,-1,0,0,"cm"].join(" ")),this.internal.write("/I"+I.index+" Do"),this.internal.write("Q")},y=e.color_spaces={DEVICE_RGB:"DeviceRGB",DEVICE_GRAY:"DeviceGray",DEVICE_CMYK:"DeviceCMYK",CAL_GREY:"CalGray",CAL_RGB:"CalRGB",LAB:"Lab",ICC_BASED:"ICCBased",INDEXED:"Indexed",PATTERN:"Pattern",SEPARATION:"Separation",DEVICE_N:"DeviceN"};e.decode={DCT_DECODE:"DCTDecode",FLATE_DECODE:"FlateDecode",LZW_DECODE:"LZWDecode",JPX_DECODE:"JPXDecode",JBIG2_DECODE:"JBIG2Decode",ASCII85_DECODE:"ASCII85Decode",ASCII_HEX_DECODE:"ASCIIHexDecode",RUN_LENGTH_DECODE:"RunLengthDecode",CCITT_FAX_DECODE:"CCITTFaxDecode"};var _=e.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},w=e.__addimage__.sHashCode=function(A){var O,K,U=0;if(typeof A=="string")for(K=A.length,O=0;O<K;O++)U=(U<<5)-U+A.charCodeAt(O),U|=0;else if(P(A))for(K=A.byteLength/2,O=0;O<K;O++)U=(U<<5)-U+A[O],U|=0;return U},S=e.__addimage__.validateStringAsBase64=function(A){(A=A||"").toString().trim();var O=!0;return A.length===0&&(O=!1),A.length%4!=0&&(O=!1),/^[A-Za-z0-9+/]+$/.test(A.substr(0,A.length-2))===!1&&(O=!1),/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(A.substr(-2))===!1&&(O=!1),O},C=e.__addimage__.extractImageFromDataUrl=function(A){if(A==null||!(A=A.trim()).startsWith("data:"))return null;var O=A.indexOf(",");return O<0?null:A.substring(0,O).trim().endsWith("base64")?A.substring(O+1):null};e.__addimage__.isArrayBuffer=function(A){return A instanceof ArrayBuffer};var P=e.__addimage__.isArrayBufferView=function(A){return A instanceof Int8Array||A instanceof Uint8Array||A instanceof Uint8ClampedArray||A instanceof Int16Array||A instanceof Uint16Array||A instanceof Int32Array||A instanceof Uint32Array||A instanceof Float32Array||A instanceof Float64Array},R=e.__addimage__.binaryStringToUint8Array=function(A){for(var O=A.length,K=new Uint8Array(O),U=0;U<O;U++)K[U]=A.charCodeAt(U);return K},M=e.__addimage__.arrayBufferToBinaryString=function(A){for(var O="",K=P(A)?A:new Uint8Array(A),U=0;U<K.length;U+=8192)O+=String.fromCharCode.apply(null,K.subarray(U,U+8192));return O};e.addImage=function(){var A,O,K,U,I,re,V,$,D;if(typeof arguments[1]=="number"?(O=n,K=arguments[1],U=arguments[2],I=arguments[3],re=arguments[4],V=arguments[5],$=arguments[6],D=arguments[7]):(O=arguments[1],K=arguments[2],U=arguments[3],I=arguments[4],re=arguments[5],V=arguments[6],$=arguments[7],D=arguments[8]),en(A=arguments[0])==="object"&&!p(A)&&"imageData"in A){var ie=A;A=ie.imageData,O=ie.format||O||n,K=ie.x||K||0,U=ie.y||U||0,I=ie.w||ie.width||I,re=ie.h||ie.height||re,V=ie.alias||V,$=ie.compression||$,D=ie.rotation||ie.angle||D}var X=this.internal.getFilters();if($===void 0&&X.indexOf("FlateEncode")!==-1&&($="SLOW"),isNaN(K)||isNaN(U))throw new Error("Invalid coordinates passed to jsPDF.addImage");c.call(this);var E=T.call(this,A,O,V,$);return b.call(this,K,U,I,re,E,D),this};var T=function(A,O,K,U){var I,re,V;if(typeof A=="string"&&i(A)===n){A=unescape(A);var $=H(A,!1);($!==""||($=e.loadFile(A,!0))!==void 0)&&(A=$)}if(p(A)&&(A=h(A,O)),O=i(A,O),!f(O))throw new Error("addImage does not support files of type '"+O+"', please ensure that a plugin for '"+O+"' support is added.");if(((V=K)==null||V.length===0)&&(K=function(D){return typeof D=="str
496ing"||P(D)?w(D):P(D.data)?w(D.data):null}(A)),(I=x.call(this,K))||(A instanceof Uint8Array||O==="RGBA"||(re=A,A=R(A)),I=this["process"+O.toUpperCase()](A,u.call(this),K,function(D){return D&&typeof D=="string"&&(D=D.toUpperCase()),D in e.image_compression?D:_.NONE}(U),re)),!I)throw new Error("An unknown error occurred whilst processing the image.");return I},H=e.__addimage__.convertBase64ToBinaryString=function(A,O){O=typeof O!="boolean"||O;var K,U="";if(typeof A=="string"){var I;K=(I=C(A))!==null&&I!==void 0?I:A;try{U=fg(K)}catch(re){if(O)throw S(K)?new Error("atob-Error in jsPDF.convertBase64ToBinaryString "+re.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ")}}return U};e.getImageProperties=function(A){var O,K,U="";if(p(A)&&(A=h(A)),typeof A=="string"&&i(A)===n&&((U=H(A,!1))===""&&(U=e.loadFile(A)||""),A=U),K=i(A),!f(K))throw new Error("addImage does not support files of type '"+K+"', please ensure that a plugin for '"+K+"' support is added.");if(A instanceof Uint8Array||(A=R(A)),!(O=this["process"+K.toUpperCase()](A)))throw new Error("An unknown error occurred whilst processing the image");return O.fileType=K,O}})(Xe.API),function(e){var t=function(n){if(n!==void 0&&n!="")return!0};Xe.API.events.push(["addPage",function(n){this.internal.getPageInfo(n.pageNumber).pageContext.annotations=[]}]),e.events.push(["putPage",function(n){for(var r,i,s,a=this.internal.getCoordinateString,l=this.internal.getVerticalCoordinateString,c=this.internal.getPageInfoByObjId(n.objId),d=n.pageContext.annotations,u=!1,f=0;f<d.length&&!u;f++)switch((r=d[f]).type){case"link":(t(r.options.url)||t(r.options.pageNumber))&&(u=!0);break;case"reference":case"text":case"freetext":u=!0}if(u!=0){this.internal.write("/Annots [");for(var p=0;p<d.length;p++){r=d[p];var h=this.internal.pdfEscape,x=this.internal.getEncryptor(n.objId);switch(r.type){case"reference":this.internal.write(" "+r.object.objId+" 0 R ");break;case"text":var g=this.internal.newAdditionalObject(),b=this.internal.newAdditionalObject(),y=this.internal.getEncryptor(g.objId),_=r.title||"Note";s="<</Type /Annot /Subtype /Text "+(i="/Rect ["+a(r.bounds.x)+" "+l(r.bounds.y+r.bounds.h)+" "+a(r.bounds.x+r.bounds.w)+" "+l(r.bounds.y)+"] ")+"/Contents ("+h(y(r.contents))+")",s+=" /Popup "+b.objId+" 0 R",s+=" /P "+c.objId+" 0 R",s+=" /T ("+h(y(_))+") >>",g.content=s;var w=g.objId+" 0 R";s="<</Type /Annot /Subtype /Popup "+(i="/Rect ["+a(r.bounds.x+30)+" "+l(r.bounds.y+r.bounds.h)+" "+a(r.bounds.x+r.bounds.w+30)+" "+l(r.bounds.y)+"] ")+" /Parent "+w,r.open&&(s+=" /Open true"),s+=" >>",b.content=s,this.internal.write(g.objId,"0 R",b.objId,"0 R");break;case"freetext":i="/Rect ["+a(r.bounds.x)+" "+l(r.bounds.y)+" "+a(r.bounds.x+r.bounds.w)+" "+l(r.bounds.y+r.bounds.h)+"] ";var S="font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+(r.color||"#000000");s="<</Type /Annot /Subtype /FreeText "+i+"/Contents ("+h(x(r.contents))+")",s+=" /DS("+h(x(S))+")",s+=" /Border [0 0 0]",s+=" >>",this.internal.write(s);break;case"link":if(r.options.name){var C=this.annotations._nameMap[r.options.name];r.options.pageNumber=C.page,r.options.top=C.y}else r.options.top||(r.options.top=0);if(i="/Rect ["+r.finalBounds.x+" "+r.finalBounds.y+" "+r.finalBounds.w+" "+r.finalBounds.h+"] ",s="",r.options.url)s="<</Type /Annot /Subtype /Link "+i+"/Border [0 0 0] /A <</S /URI /URI ("+h(x(r.options.url))+") >>";else if(r.options.pageNumber)switch(s="<</Type /Annot /Subtype /Link "+i+"/Border [0 0 0] /Dest ["+this.internal.getPageInfo(r.options.pageNumber).objId+" 0 R",r.options.magFactor=r.options.magFactor||"XYZ",r.options.magFactor){case"Fit":s+=" /Fit]";break;case"FitH":s+=" /FitH "+r.options.top+"]";break;case"FitV":r.options.left=r.options.left||0,s+=" /FitV "+r.options.left+"]";break;default:var P=l(r.options.top);r.options.left=r.options.left||0,r.options.zoom===void 0&&(r.options.zoom=0),s+=" /XYZ "+r.options.left+" "+P+" "+r.options.zoom+"]"}s!=""&&(s+=" >>",this.internal.write(s))}}this.internal.write("]")}}]),e.createAnnotation=function(n){var r=this.internal.getCurrentPageInfo();switch(n.type){case"link":this.link(n.bounds.x,n.bounds.y,n.bounds.w,n.bounds.h,n);break;case"text":case"freetext":r.pageContext.annotations.push(n)}},e.link=function(n,r,i,s,a){var l=this.internal.getCurrentPageInfo(),c=this.internal.getCoordinateString,d=this.internal.getVerticalCoordinateString;
vendor: 22,137 bytes, lines 496-520
496l.pageContext.annotations.push({finalBounds:{x:c(n),y:d(r),w:c(n+i),h:d(r+s)},options:a,type:"link"})},e.textWithLink=function(n,r,i,s){var a,l,c=this.getTextWidth(n),d=this.internal.getLineHeight()/this.internal.scaleFactor;if(s.maxWidth!==void 0){l=s.maxWidth;var u=this.splitTextToSize(n,l).length;a=Math.ceil(d*u)}else l=c,a=d;return this.text(n,r,i,s),i+=.2*d,s.align==="center"&&(r-=c/2),s.align==="right"&&(r-=c),this.link(r,i-d,l,a,s),c},e.getTextWidth=function(n){var r=this.internal.getFontSize();return this.getStringUnitWidth(n)*r/this.internal.scaleFactor}}(Xe.API),function(e){var t={1569:[65152],1570:[65153,65154],1571:[65155,65156],1572:[65157,65158],1573:[65159,65160],1574:[65161,65162,65163,65164],1575:[65165,65166],1576:[65167,65168,65169,65170],1577:[65171,65172],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194],1584:[65195,65196],1585:[65197,65198],1586:[65199,65200],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1649:[64336,64337],1655:[64477],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393],1676:[64388,64389],1677:[64386,64387],1678:[64390,64391],1681:[64396,64397],1688:[64394,64395],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421],1729:[64422,64423,64424,64425],1733:[64480,64481],1734:[64473,64474],1735:[64471,64472],1736:[64475,64476],1737:[64482,64483],1739:[64478,64479],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431],1747:[64432,64433]},n={65247:{65154:65269,65156:65271,65160:65273,65166:65275},65248:{65154:65270,65156:65272,65160:65274,65166:65276},65165:{65247:{65248:{65258:65010}}},1617:{1612:64606,1613:64607,1614:64608,1615:64609,1616:64610}},r={1612:64606,1613:64607,1614:64608,1615:64609,1616:64610},i=[1570,1571,1573,1575];e.__arabicParser__={};var s=e.__arabicParser__.isInArabicSubstitutionA=function(g){return t[g.charCodeAt(0)]!==void 0},a=e.__arabicParser__.isArabicLetter=function(g){return typeof g=="string"&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(g)},l=e.__arabicParser__.isArabicEndLetter=function(g){return a(g)&&s(g)&&t[g.charCodeAt(0)].length<=2},c=e.__arabicParser__.isArabicAlfLetter=function(g){return a(g)&&i.indexOf(g.charCodeAt(0))>=0};e.__arabicParser__.arabicLetterHasIsolatedForm=function(g){return a(g)&&s(g)&&t[g.charCodeAt(0)].length>=1};var d=e.__arabicParser__.arabicLetterHasFinalForm=function(g){return a(g)&&s(g)&&t[g.charCodeAt(0)].length>=2};e.__arabicParser__.arabicLetterHasInitialForm=function(g){return a(g)&&s(g)&&t[g.charCodeAt(0)].length>=3};var u=e.__arabicParser__.arabicLetterHasMedialForm=function(g){return a(g)&&s(g)&&t[g.charCodeAt(0)].length==4},f=e.__arabicParser__.resolveLigatures=function(g){var b=0,y=n,_="",w=0;for(b=0;b<g.length;b+=1)y[g.charCodeAt(b)]!==void 0?(w++,typeof(y=y[g.charCodeAt(b)])=="number"&&(_+=String.fromCharCode(y),y=n,w=0),b===g.length-1&&(y=n,_+=g.charAt(b-(w-1)),b-=w-1,w=0)):(y=n,_+=g.charAt(b-w),b-=w,w=0);return _};e.__arabicParser__.isArabicDiacritic=function(g){return g!==void 0&&r[g.charCodeAt(0)]!==void 0};var p=e.__arabicParser__.getCorrectForm=function(g,b,y){return a(g)?s(g)===!1?-1:!d(g)||!a(b)&&!a(y)||!a(y)&&l(b)||l(g)&&!a(b)||l(g)&&c(b)||l(g)&&l(b)?0:u(g)&&a(b)&&!l(b)&&a(y)&&d(y)?3:l(g)||!a(y)?1:2:-1},h=function(g){var b=0,y=0,_=0,w="",S="",C="",P=(g=g||"").split("\\s+"),R=[];for(b=0;b<P.length;b+=1){for(R.push(""),y=0;y<P[b].length;y+=1)w=P[b][y],S=P[b][y-1],C=P[b][y+1],a(w)?(_=p(w,S,C),R[b]+=_!==-1?String.fromCharCode(t[w.charCodeAt(0)][_]):w):R[b]+=w;R[b]=f(R[b])}return R.join(" ")},x=e.__arabicParser__.processArabic=e.processArabic=function(){var g,b=typeof arguments[0]=="string"?arguments[0]:arguments[0].text,y=[];if(Array.isArray(b)){var _=0;for(y=[],_=0;_<b.length;_+=1)Array.isArray(b[_])?y.push([h(b[_][0]),b[_][1],b[_][2]]):y.push([h(b[_])]);g=y}else g=h(b);return typeof arguments[0]=="string"?g:(arguments[0].text=g,arguments[0])};e.events.push(["preProcessText",x])}(Xe.API),Xe.API.autoPrint=function(e){var t;return(e=e||{}).variant=e.variant||"non-conform",e.variant==="javascript"?this.addJS("print({});"):(this.internal.events.subscribe("postPutResources",function(){t=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /Named"),this.internal.out("/Type /Action"),this.internal.out("/N /Print"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){this.internal.out("/OpenAction "+t+" 0 R")})),this},function(e){var t=function(){var n=void 0;Object.defineProperty(this,"pdf",{get:function(){return n},set:function(l){n=l}});var r=150;Object.defineProperty(this,"width",{get:function(){return r},set:function(l){r=isNaN(l)||Number.isInteger(l)===!1||l<0?150:l,this.getContext("2d").pageWrapXEnabled&&(this.getContext("2d").pageWrapX=r+1)}});var i=300;Object.defineProperty(this,"height",{get:function(){return i},set:function(l){i=isNaN(l)||Number.isInteger(l)===!1||l<0?300:l,this.getContext("2d").pageWrapYEnabled&&(this.getContext("2d").pageWrapY=i+1)}});var s=[];Object.defineProperty(this,"childNodes",{get:function(){return s},set:function(l){s=l}});var a={};Object.defineProperty(this,"style",{get:function(){return a},set:function(l){a=l}}),Object.defineProperty(this,"parentNode",{})};t.prototype.getContext=function(n,r){var i;if((n=n||"2d")!=="2d")return null;for(i in r)this.pdf.context2d.hasOwnProperty(i)&&(this.pdf.context2d[i]=r[i]);return this.pdf.context2d._canvas=this,this.pdf.context2d},t.prototype.toDataURL=function(){throw new Error("toDataURL is not implemented.")},e.events.push(["initialized",function(){this.canvas=new t,this.canvas.pdf=this}])}(Xe.API),function(e){var t={left:0,top:0,bottom:0,right:0},n=!1,r=function(){this.internal.__cell__===void 0&&(this.internal.__cell__={},this.internal.__cell__.padding=3,this.internal.__cell__.headerFunction=void 0,this.internal.__cell__.margins=Object.assign({},t),this.internal.__cell__.margins.width=this.getPageWidth(),i.call(this))},i=function(){this.internal.__cell__.lastCell=new s,this.internal.__cell__.pages=1},s=function(){var c=arguments[0];Object.defineProperty(this,"x",{enumerable:!0,get:function(){return c},set:function(g){c=g}});var d=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return d},set:function(g){d=g}});var u=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return u},set:function(g){u=g}});var f=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return f},set:function(g){f=g}});var p=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return p},set:function(g){p=g}});var h=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return h},set:function(g){h=g}});var x=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return x},set:function(g){x=g}}),this};s.prototype.clone=function(){return new s(this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align)},s.prototype.toArray=function(){return[this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align]},e.setHeaderFunction=function(c){return r.call(this),this.internal.__cell__.headerFunction=typeof c=="function"?c:void 0,this},e.getTextDimensions=function(c,d){r.call(this);var u=(d=d||{}).fontSize||this.getFontSize(),f=d.font||this.getFont(),p=d.scaleFactor||this.internal.scaleFactor,h=0,x=0,g=0,b=this;if(!Array.isArray(c)&&typeof c!="string"){if(typeof c!="number")throw new Error("getTextDimensions expects text-parameter to be of type String or type Number or an Array of Strings.");c=String(c)}var y=d.maxWidth;y>0?typeof c=="string"?c=this.splitTextToSize(c,y):Object.prototype.toString.call(c)==="[object Array]"&&(c=c.reduce(function(w,S){return w.concat(b.splitTextToSize(S,y))},[])):c=Array.isArray(c)?c:[c];for(var _=0;_<c.length;_++)h<(g=this.getStringUnitWidth(c[_],{font:f})*u)&&(h=g);return h!==0&&(x=c.length),{w:h/=p,h:Math.max((x*u*this.getLineHeightFactor()-u*(this.getLineHeightFactor()-1))/p,0)}},e.cellAddPage=function(){r.call(this),this.addPage();var c=this.internal.__cell__.margins||t;return this.internal.__cell__.lastCell=new s(c.left,c.top,void 0,void 0),this.internal.__cell__.pages+=1,this};var a=e.cell=function(){var c;c=arguments[0]instanceof s?arguments[0]:new s(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6]),r.call(this);var d=this.internal.__cell__.lastCell,u=this.internal.__cell__.padding,f=this.internal.__cell__.margins||t,p=this.internal.__cell__.tableHeaderRow,h=this.internal.__cell__.printHeaders;return d.lineNumber!==void 0&&(d.lineNumber===c.lineNumber?(c.x=(d.x||0)+(d.width||0),c.y=d.y||0):d.y+d.height+c.height+f.bottom>this.getPageHeight()?(this.cellAddPage(),c.y=f.top,h&&p&&(this.printHeaderRow(c.lineNumber,!0),c.y+=p[0].height)):c.y=d.y+d.height||c.y),c.text[0]!==void 0&&(this.rect(c.x,c.y,c.width,c.height,n===!0?"FD":void 0),c.align==="right"?this.text(c.text,c.x+c.width-u,c.y+u,{align:"right",baseline:"top"}):c.align==="center"?this.text(c.text,c.x+c.width/2,c.y+u,{align:"center",baseline:"top",maxWidth:c.width-u-u}):this.text(c.text,c.x+u,c.y+u,{align:"left",baseline:"top",maxWidth:c.width-u-u})),this.internal.__cell__.lastCell=c,this};e.table=function(c,d,u,f,p){if(r.call(this),!u)throw new Error("No data for PDF table.");var h,x,g,b,y=[],_=[],w=[],S={},C={},P=[],R=[],M=(p=p||{}).autoSize||!1,T=p.printHeaders!==!1,H=p.css&&p.css["font-size"]!==void 0?16*p.css["font-size"]:p.fontSize||12,A=p.margins||Object.assign({width:this.getPageWidth()},t),O=typeof p.padding=="number"?p.padding:3,K=p.headerBackgroundColor||"#c8c8c8",U=p.headerTextColor||"#000";if(i.call(this),this.internal.__cell__.printHeaders=T,this.internal.__cell__.margins=A,this.internal.__cell__.table_font_size=H,this.internal.__cell__.padding=O,this.internal.__cell__.headerBackgroundColor=K,this.internal.__cell__.headerTextColor=U,this.setFontSize(H),f==null)_=y=Object.keys(u[0]),w=y.map(function(){return"left"});else if(Array.isArray(f)&&en(f[0])==="object")for(y=f.map(function(ie){return ie.name}),_=f.map(function(ie){return ie.prompt||ie.name||""}),w=f.map(function(ie){return ie.align||"left"}),h=0;h<f.length;h+=1)C[f[h].name]=.7499990551181103*f[h].width;else Array.isArray(f)&&typeof f[0]=="string"&&(_=y=f,w=y.map(function(){return"left"}));if(M||Array.isArray(f)&&typeof f[0]=="string")for(h=0;h<y.length;h+=1){for(S[b=y[h]]=u.map(function(ie){return ie[b]}),this.setFont(void 0,"bold"),P.push(this.getTextDimensions(_[h],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),x=S[b],this.setFont(void 0,"normal"),g=0;g<x.length;g+=1)P.push(this.getTextDimensions(x[g],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);C[b]=Math.max.apply(null,P)+O+O,P=[]}if(T){var I={};for(h=0;h<y.length;h+=1)I[y[h]]={},I[y[h]].text=_[h],I[y[h]].align=w[h];var re=l.call(this,I,C);R=y.map(function(ie){return new s(c,d,C[ie],re,I[ie].text,void 0,I[ie].align)}),this.setTableHeaderRow(R),this.printHeaderRow(1,!1)}var V=f.reduce(function(ie,X){return ie[X.name]=X.align,ie},{});for(h=0;h<u.length;h+=1){"rowStart"in p&&p.rowStart instanceof Function&&p.rowStart({row:h,data:u[h]},this);var $=l.call(this,u[h],C);for(g=0;g<y.length;g+=1){var D=u[h][y[g]];"cellStart"in p&&p.cellStart instanceof Function&&p.cellStart({row:h,col:g,data:D},this),a.call(this,new s(c,d,C[y[g]],$,D,h+2,V[y[g]]))}}return this.internal.__cell__.table_x=c,this.internal.__cell__.table_y=d,this};var l=function(c,d){var u=this.internal.__cell__.padding,f=this.internal.__cell__.table_font_size,p=this.internal.scaleFactor;return Object.keys(c).map(function(h){var x=c[h];return this.splitTextToSize(x.hasOwnProperty("text")?x.text:x,d[h]-u-u)},this).map(function(h){return this.getLineHeightFactor()*h.length*f/p+u+u},this).reduce(function(h,x){return Math.max(h,x)},0)};e.setTableHeaderRow=function(c){r.call(this),this.internal.__cell__.tableHeaderRow=c},e.printHeaderRow=function(c,d){if(r.call(this),!this.internal.__cell__.tableHeaderRow)throw new Error("Property tableHeaderRow does not exist.");var u;if(n=!0,typeof this.internal.__cell__.headerFunction=="function"){var f=this.internal.__cell__.headerFunction(this,this.internal.__cell__.pages);this.internal.__cell__.lastCell=new s(f[0],f[1],f[2],f[3],void 0,-1)}this.setFont(void 0,"bold");for(var p=[],h=0;h<this.internal.__cell__.tableHeaderRow.length;h+=1){u=this.internal.__cell__.tableHeaderRow[h].clone(),d&&(u.y=this.internal.__cell__.margins.top||0,p.push(u)),u.lineNumber=c;var x=this.getTextColor();this.setTextColor(this.internal.__cell__.headerTextColor),this.setFillColor(this.internal.__cell__.headerBackgroundColor),a.call(this,u),this.setTextColor(x)}p.length>0&&this.setTableHeaderRow(p),this.setFont(void 0,"normal"),n=!1}}(Xe.API);var nP={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},rP=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],k1=tP(rP),iP=[100,200,300,400,500,600,700,800,900],pV=tP(iP);function ob(e){var t=e.family.replace(/"|'/g,"").toLowerCase(),n=function(s){return nP[s=s||"normal"]?s:"normal"}(e.style),r=function(s){return s?typeof s=="number"?s>=100&&s<=900&&s%100==0?s:400:/^\d00$/.test(s)?parseInt(s):s==="bold"?700:400:400}(e.weight),i=function(s){return typeof k1[s=s||"normal"]=="number"?s:"normal"}(e.stretch);return{family:t,style:n,weight:r,stretch:i,src:e.src||[],ref:e.ref||{name:t,style:[i,n,r].join(" ")}}}function ES(e,t,n,r){var i;for(i=n;i>=0&&i<t.length;i+=r)if(e[t[i]])return e[t[i]];for(i=n;i>=0&&i<t.length;i-=r)if(e[t[i]])return e[t[i]]}var mV={"sans-serif":"helvetica",fixed:"courier",monospace:"courier",terminal:"courier",cursive:"times",fantasy:"times",serif:"times"},CS={caption:"times",icon:"times",menu:"times","message-box":"times","small-caption":"times","status-bar":"times"};function AS(e){return[e.stretch,e.style,e.weight,e.family].join(" ")}function PS(e){return e.trimLeft()}function gV(e,t){for(var n=0;n<e.length;){if(e.charAt(n)===t)return[e.substring(0,n),e.substring(n+1)];n+=1}return null}function xV(e){var t=e.match(/^(-[a-z_]|[a-z_])[a-z0-9_-]*/i);return t===null?null:[t[0],e.substring(t[0].length)]}var ad,Rm,LS,RS,TS,ab=["times"];function OS(e,t,n,r,i){var s=4,a=DS;switch(i){case Xe.API.image_compression.FAST:s=1,a=IS;break;case Xe.API.image_compression.MEDIUM:s=6,a=FS;break;case Xe.API.image_compression.SLOW:s=9,a=MS}e=function(c,d,u,f){for(var p,h=c.length/d,x=new Uint8Array(c.length+h),g=[vV,IS,DS,FS,MS],b=0;b<h;b+=1){var y=b*d,_=c.subarray(y,y+d);if(f)x.set(f(_,u,p),y+b);else{for(var w=g.length,S=[],C=0;C<w;C+=1)S[C]=g[C](_,u,p);var P=yV(S.concat());x.set(S[P],y+b)}p=_}return x}(e,t,Math.ceil(n*r/8),a);var l=d1(e,{level:s});return Xe.API.__addimage__.arrayBufferToBinaryString(l)}function vV(e){var t=Array.apply([],e);return t.unshift(0),t}function IS(e,t){var n=e.length,r=[];r[0]=1;for(var i=0;i<n;i+=1){var s=e[i-t]||0;r[i+1]=e[i]-s+256&255}return r}function DS(e,t,n){var r=e.length,i=[];i[0]=2;for(var s=0;s<r;s+=1){var a=n&&n[s]||0;i[s+1]=e[s]-a+256&255}return i}function FS(e,t,n){var r=e.length,i=[];i[0]=3;for(var s=0;s<r;s+=1){var a=e[s-t]||0,l=n&&n[s]||0;i[s+1]=e[s]+256-(a+l>>>1)&255}return i}function MS(e,t,n){var r=e.length,i=[];i[0]=4;for(var s=0;s<r;s+=1){var a=bV(e[s-t]||0,n&&n[s]||0,n&&n[s-t]||0);i[s+1]=e[s]-a+256&255}return i}function bV(e,t,n){if(e===t&&t===n)return e;var r=Math.abs(t-n),i=Math.abs(e-n),s=Math.abs(e+t-n-n);return r<=i&&r<=s?e:i<=s?t:n}function yV(e){var t=e.map(function(n){return n.reduce(function(r,i){return r+Math.abs(i)},0)});return t.indexOf(Math.min.apply(null,t))}function lb(e,t,n){var r=t*n,i=Math.floor(r/8),s=16-(r-8*i+n),a=(1<<n)-1;return sP(e,i)>>s&a}function $S(e,t,n,r){var i=n*r,s=Math.floor(i/8),a=16-(i-8*s+r),l=(1<<r)-1,c=(t&l)<<a;(function(d,u,f){if(u+1<d.byteLength)d.setUint16(u,f,!1);else{var p=f>>8&255;d.setUint8(u,p)}})(e,s,sP(e,s)&~(l<<a)&65535|c)}function sP(e,t){return t+1<e.byteLength?e.getUint16(t,!1):e.getUint8(t)<<8}function wV(e){var t=0;if(e[t++]!==71||e[t++]!==73||e[t++]!==70||e[t++]!==56||(e[t++]+1&253)!=56||e[t++]!==97)throw new Error("Invalid GIF 87a/89a header.");var n=e[t++]|e[t++]<<8,r=e[t++]|e[t++]<<8,i=e[t++],s=i>>7,a=1<<1+(7&i);e[t++],e[t++];var l=null,c=null;s&&(l=t,c=a,t+=3*a);var d=!0,u=[],f=0,p=null,h=0,x=null;for(this.width=n,this.height=r;d&&t<e.length;)switch(e[t++]){case 33:switch(e[t++]){case 255:if(e[t]!==11||e[t+1]==78&&e[t+2]==69&&e[t+3]==84&&e[t+4]==83&&e[t+5]==67&&e[t+6]==65&&e[t+7]==80&&e[t+8]==69&&e[t+9]==50&&e[t+10]==46&&e[t+11]==48&&e[t+12]==3&&e[t+13]==1&&e[t+16]==0)t+=14,x=e[t++]|e[t++]<<8,t++;else for(t+=12;;){if(!((A=e[t++])>=0))throw Error("Invalid block size");if(A===0)break;t+=A}break;case 249:if(e[t++]!==4||e[t+4]!==0)throw new Error("Invalid graphics extension block.");var g=e[t++];f=e[t++]|e[t++]<<8,p=e[t++],1&g||(p=null),h=g>>2&7,t++;break;case 254:for(;;){if(!((A=e[t++])>=0))throw Error("Invalid block size");if(A===0)break;t+=A}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var b=e[t++]|e[t++]<<8,y=e[t++]|e[t++]<<8,_=e[t++]|e[t++]<<8,w=e[t++]|e[t++]<<8,S=e[t++],C=S>>6&1,P=1<<1+(7&S),R=l,M=c,T=!1;S>>7&&(T=!0,R=t,M=P,t+=3*P);var H=t;for(t++;;){var A;if(!((A=e[t++])>=0))throw Error("Invalid block size");if(A===0)break;t+=A}u.push({x:b,y,width:_,height:w,has_local_palette:T,palette_offset:R,palette_size:M,data_offset:H,data_length:t-H,transparent_index:p,interlaced:!!C,delay:f,disposal:h});break;case 59:d=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return u.length},this.loopCount=function(){return x},this.frameInfo=function(O){if(O<0||O>=u.length)throw new Error("Frame index out of range.");return u[O]},this.decodeAndBlitFrameBGRA=function(O,K){var U=this.frameInfo(O),I=U.width*U.height;if(I>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var re=new Uint8Array(I);BS(e,U.data_offset,re,I);var V=U.palette_offset,$=U.transparent_index;$===null&&($=256);var D=U.width,ie=n-D,X=D,E=4*(U.y*n+U.x),q=4*((U.y+U.height)*n+U.x),F=E,Z=4*ie;U.interlaced===!0&&(Z+=4*n*7);for(var Y=8,ee=0,ce=re.length;ee<ce;++ee){var ue=re[ee];if(X===0&&(X=D,(F+=Z)>=q&&(Z=4*ie+4*n*(Y-1),F=E+(D+ie)*(Y<<1),Y>>=1)),ue===$)F+=4;else{var ye=e[V+3*ue],Se=e[V+3*ue+1],De=e[V+3*ue+2];K[F++]=De,K[F++]=Se,K[F++]=ye,K[F++]=255}--X}},this.decodeAndBlitFrameRGBA=function(O,K){var U=this.frameInfo(O),I=U.width*U.height;if(I>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var re=new Uint8Array(I);BS(e,U.data_offset,re,I);var V=U.palette_offset,$=U.transparent_index;$===null&&($=256);var D=U.width,ie=n-D,X=D,E=4*(U.y*n+U.x),q=4*((U.y+U.height)*n+U.x),F=E,Z=4*ie;U.interlaced===!0&&(Z+=4*n*7);for(var Y=8,ee=0,ce=re.length;ee<ce;++ee){var ue=re[ee];if(X===0&&(X=D,(F+=Z)>=q&&(Z=4*ie+4*n*(Y-1),F=E+(D+ie)*(Y<<1),Y>>=1)),ue===$)F+=4;else{var ye=e[V+3*ue],Se=e[V+3*ue+1],De=e[V+3*ue+2];K[F++]=ye,K[F++]=Se,K[F++]=De,K[F++]=255}--X}}}function BS(e,t,n,r){for(var i=e[t++],s=1<<i,a=s+1,l=a+1,c=i+1,d=(1<<c)-1,u=0,f=0,p=0,h=e[t++],x=new Int32Array(4096),g=null;;){for(;u<16&&h!==0;)f|=e[t++]<<u,u+=8,h===1?h=e[t++]:--h;if(u<c)break;var b=f&d;if(f>>=c,u-=c,b!==s){if(b===a)break;for(var y=b<l?b:g,_=0,w=y;w>s;)w=x[w]>>8,++_;var S=w;if(p+_+(y!==b?1:0)>r)return void an.log("Warning, gif stream longer than expected.");n[p++]=S;var C=p+=_;for(y!==b&&(n[p++]=S),w=y;_--;)w=x[w],n[--C]=255&w,w>>=8;g!==null&&l<4096&&(x[l++]=g<<8|S,l>=d+1&&c<12&&(++c,d=d<<1|1)),g=b}else l=a+1,d=(1<<(c=i+1))-1,g=null}return p!==r&&an.log("Warning, gif stream shorter than expected."),n}/**
497 * @license
498  Copyright (c) 2008, Adobe Systems Incorporated
499  All rights reserved.
500
501  Redistribution and use in source and binary forms, with or without 
502  modification, are permitted provided that the following conditions are
503  met:
504
505  * Redistributions of source code must retain the above copyright notice, 
506    this list of conditions and the following disclaimer.
507  
508  * Redistributions in binary form must reproduce the above copyright
509    notice, this list of conditions and the following disclaimer in the 
510    documentation and/or other materials provided with the distribution.
511  
512  * Neither the name of Adobe Systems Incorporated nor the names of its 
513    contributors may be used to endorse or promote products derived from 
514    this software without specific prior written permission.
515
516  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
517  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
518  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
519  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
520  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
vendor: 6,933 bytes, lines 521-527
521  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
522  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
523  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
524  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
525  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
526  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
527*/function cb(e){var t,n,r,i,s,a=Math.floor,l=new Array(64),c=new Array(64),d=new Array(64),u=new Array(64),f=new Array(65535),p=new Array(65535),h=new Array(64),x=new Array(64),g=[],b=0,y=7,_=new Array(64),w=new Array(64),S=new Array(64),C=new Array(256),P=new Array(2048),R=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],M=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],T=[0,1,2,3,4,5,6,7,8,9,10,11],H=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],A=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],O=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],K=[0,1,2,3,4,5,6,7,8,9,10,11],U=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],I=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function re(E,q){for(var F=0,Z=0,Y=new Array,ee=1;ee<=16;ee++){for(var ce=1;ce<=E[ee];ce++)Y[q[Z]]=[],Y[q[Z]][0]=F,Y[q[Z]][1]=ee,Z++,F++;F*=2}return Y}function V(E){for(var q=E[0],F=E[1]-1;F>=0;)q&1<<F&&(b|=1<<y),F--,--y<0&&(b==255?($(255),$(0)):$(b),y=7,b=0)}function $(E){g.push(E)}function D(E){$(E>>8&255),$(255&E)}function ie(E,q,F,Z,Y){for(var ee,ce=Y[0],ue=Y[240],ye=function(Q,he){var ve,we,Le,Fe,Ve,He,Ze,at,Be,it,ze=0;for(Be=0;Be<8;++Be){ve=Q[ze],we=Q[ze+1],Le=Q[ze+2],Fe=Q[ze+3],Ve=Q[ze+4],He=Q[ze+5],Ze=Q[ze+6];var zt=ve+(at=Q[ze+7]),yt=ve-at,mt=we+Ze,wt=we-Ze,Mt=Le+He,dt=Le-He,qt=Fe+Ve,ht=Fe-Ve,bt=zt+qt,ln=zt-qt,Pt=mt+Mt,st=mt-Mt;Q[ze]=bt+Pt,Q[ze+4]=bt-Pt;var Gt=.707106781*(st+ln);Q[ze+2]=ln+Gt,Q[ze+6]=ln-Gt;var ft=.382683433*((bt=ht+dt)-(st=wt+yt)),_t=.5411961*bt+ft,$t=1.306562965*st+ft,Rn=.707106781*(Pt=dt+wt),et=yt+Rn,cr=yt-Rn;Q[ze+5]=cr+_t,Q[ze+3]=cr-_t,Q[ze+1]=et+$t,Q[ze+7]=et-$t,ze+=8}for(ze=0,Be=0;Be<8;++Be){ve=Q[ze],we=Q[ze+8],Le=Q[ze+16],Fe=Q[ze+24],Ve=Q[ze+32],He=Q[ze+40],Ze=Q[ze+48];var xr=ve+(at=Q[ze+56]),kn=ve-at,Un=we+Ze,Tn=we-Ze,dr=Le+He,vr=Le-He,gl=Fe+Ve,ra=Fe-Ve,ns=xr+gl,Rs=xr-gl,rs=Un+dr,is=Un-dr;Q[ze]=ns+rs,Q[ze+32]=ns-rs;var zi=.707106781*(is+Rs);Q[ze+16]=Rs+zi,Q[ze+48]=Rs-zi;var xl=.382683433*((ns=ra+vr)-(is=Tn+kn)),Ts=.5411961*ns+xl,vl=1.306562965*is+xl,Ec=.707106781*(rs=vr+Tn),Cc=kn+Ec,Ac=kn-Ec;Q[ze+40]=Ac+Ts,Q[ze+24]=Ac-Ts,Q[ze+8]=Cc+vl,Q[ze+56]=Cc-vl,ze++}for(Be=0;Be<64;++Be)it=Q[Be]*he[Be],h[Be]=it>0?it+.5|0:it-.5|0;return h}(E,q),Se=0;Se<64;++Se)x[R[Se]]=ye[Se];var De=x[0]-F;F=x[0],De==0?V(Z[0]):(V(Z[p[ee=32767+De]]),V(f[ee]));for(var Re=63;Re>0&&x[Re]==0;)Re--;if(Re==0)return V(ce),F;for(var qe,te=1;te<=Re;){for(var Oe=te;x[te]==0&&te<=Re;)++te;var be=te-Oe;if(be>=16){qe=be>>4;for(var se=1;se<=qe;++se)V(ue);be&=15}ee=32767+x[te],V(Y[(be<<4)+p[ee]]),V(f[ee]),te++}return Re!=63&&V(ce),F}function X(E){E=Math.min(Math.max(E,1),100),s!=E&&(function(q){for(var F=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],Z=0;Z<64;Z++){var Y=a((F[Z]*q+50)/100);Y=Math.min(Math.max(Y,1),255),l[R[Z]]=Y}for(var ee=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],ce=0;ce<64;ce++){var ue=a((ee[ce]*q+50)/100);ue=Math.min(Math.max(ue,1),255),c[R[ce]]=ue}for(var ye=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],Se=0,De=0;De<8;De++)for(var Re=0;Re<8;Re++)d[Se]=1/(l[R[Se]]*ye[De]*ye[Re]*8),u[Se]=1/(c[R[Se]]*ye[De]*ye[Re]*8),Se++}(E<50?Math.floor(5e3/E):Math.floor(200-2*E)),s=E)}this.encode=function(E,q){q&&X(q),g=new Array,b=0,y=7,D(65496),D(65504),D(16),$(74),$(70),$(73),$(70),$(0),$(1),$(1),$(0),D(1),D(1),$(0),$(0),function(){D(65499),D(132),$(0);for(var we=0;we<64;we++)$(l[we]);$(1);for(var Le=0;Le<64;Le++)$(c[Le])}(),function(we,Le){D(65472),D(17),$(8),D(Le),D(we),$(3),$(1),$(17),$(0),$(2),$(17),$(1),$(3),$(17),$(1)}(E.width,E.height),function(){D(65476),D(418),$(0);for(var we=0;we<16;we++)$(M[we+1]);for(var Le=0;Le<=11;Le++)$(T[Le]);$(16);for(var Fe=0;Fe<16;Fe++)$(H[Fe+1]);for(var Ve=0;Ve<=161;Ve++)$(A[Ve]);$(1);for(var He=0;He<16;He++)$(O[He+1]);for(var Ze=0;Ze<=11;Ze++)$(K[Ze]);$(17);for(var at=0;at<16;at++)$(U[at+1]);for(var Be=0;Be<=161;Be++)$(I[Be])}(),D(65498),D(12),$(3),$(1),$(0),$(2),$(17),$(3),$(17),$(0),$(63),$(0);var F=0,Z=0,Y=0;b=0,y=7,this.encode.displayName="_encode_";for(var ee,ce,ue,ye,Se,De,Re,qe,te,Oe=E.data,be=E.width,se=E.height,Q=4*be,he=0;he<se;){for(ee=0;ee<Q;){for(Se=Q*he+ee,Re=-1,qe=0,te=0;te<64;te++)De=Se+(qe=te>>3)*Q+(Re=4*(7&te)),he+qe>=se&&(De-=Q*(he+1+qe-se)),ee+Re>=Q&&(De-=ee+Re-Q+4),ce=Oe[De++],ue=Oe[De++],ye=Oe[De++],_[te]=(P[ce]+P[ue+256|0]+P[ye+512|0]>>16)-128,w[te]=(P[ce+768|0]+P[ue+1024|0]+P[ye+1280|0]>>16)-128,S[te]=(P[ce+1280|0]+P[ue+1536|0]+P[ye+1792|0]>>16)-128;F=ie(_,d,F,t,r),Z=ie(w,u,Z,n,i),Y=ie(S,u,Y,n,i),ee+=32}he+=8}if(y>=0){var ve=[];ve[1]=y+1,ve[0]=(1<<y+1)-1,V(ve)}return D(65497),new Uint8Array(g)},e=e||50,function(){for(var E=String.fromCharCode,q=0;q<256;q++)C[q]=E(q)}(),t=re(M,T),n=re(O,K),r=re(H,A),i=re(U,I),function(){for(var E=1,q=2,F=1;F<=15;F++){for(var Z=E;Z<q;Z++)p[32767+Z]=F,f[32767+Z]=[],f[32767+Z][1]=F,f[32767+Z][0]=Z;for(var Y=-(q-1);Y<=-E;Y++)p[32767+Y]=F,f[32767+Y]=[],f[32767+Y][1]=F,f[32767+Y][0]=q-1+Y;E<<=1,q<<=1}}(),function(){for(var E=0;E<256;E++)P[E]=19595*E,P[E+256|0]=38470*E,P[E+512|0]=7471*E+32768,P[E+768|0]=-11059*E,P[E+1024|0]=-21709*E,P[E+1280|0]=32768*E+8421375,P[E+1536|0]=-27439*E,P[E+1792|
vendor: 24,217 bytes, lines 527-533
5270]=-5329*E}(),X(e)}/**
528 * @license
529 * Copyright (c) 2017 Aras Abbasi
530 *
531 * Licensed under the MIT License.
532 * http://opensource.org/licenses/mit-license
533 */function us(e,t){if(this.pos=0,this.buffer=e,this.datav=new DataView(e.buffer),this.is_with_alpha=!!t,this.bottom_up=!0,this.flag=String.fromCharCode(this.buffer[0])+String.fromCharCode(this.buffer[1]),this.pos+=2,["BM","BA","CI","CP","IC","PT"].indexOf(this.flag)===-1)throw new Error("Invalid BMP File");this.parseHeader(),this.parseBGR()}function US(e){function t(T){if(!T)throw Error("assert :P")}function n(T,H,A){for(var O=0;4>O;O++)if(T[H+O]!=A.charCodeAt(O))return!0;return!1}function r(T,H,A,O,K){for(var U=0;U<K;U++)T[H+U]=A[O+U]}function i(T,H,A,O){for(var K=0;K<O;K++)T[H+K]=A}function s(T){return new Int32Array(T)}function a(T,H){for(var A=[],O=0;O<T;O++)A.push(new H);return A}function l(T,H){var A=[];return function O(K,U,I){for(var re=I[U],V=0;V<re&&(K.push(I.length>U+1?[]:new H),!(I.length<U+1));V++)O(K[V],U+1,I)}(A,0,T),A}var c=function(){var T=this;function H(m,v){for(var j=1<<v-1>>>0;m&j;)j>>>=1;return j?(m&j-1)+j:m}function A(m,v,j,L,z){t(!(L%j));do m[v+(L-=j)]=z;while(0<L)}function O(m,v,j,L,z){if(t(2328>=z),512>=z)var W=s(512);else if((W=s(z))==null)return 0;return function(G,J,ne,ae,fe,ke){var le,pe,xe=J,Ee=1<<ne,_e=s(16),Ce=s(16);for(t(fe!=0),t(ae!=null),t(G!=null),t(0<ne),pe=0;pe<fe;++pe){if(15<ae[pe])return 0;++_e[ae[pe]]}if(_e[0]==fe)return 0;for(Ce[1]=0,le=1;15>le;++le){if(_e[le]>1<<le)return 0;Ce[le+1]=Ce[le]+_e[le]}for(pe=0;pe<fe;++pe)le=ae[pe],0<ae[pe]&&(ke[Ce[le]++]=pe);if(Ce[15]==1)return(ae=new K).g=0,ae.value=ke[0],A(G,xe,1,Ee,ae),Ee;var Ae,Me=-1,Ie=Ee-1,lt=0,Ye=1,Lt=1,nt=1<<ne;for(pe=0,le=1,fe=2;le<=ne;++le,fe<<=1){if(Ye+=Lt<<=1,0>(Lt-=_e[le]))return 0;for(;0<_e[le];--_e[le])(ae=new K).g=le,ae.value=ke[pe++],A(G,xe+lt,fe,nt,ae),lt=H(lt,le)}for(le=ne+1,fe=2;15>=le;++le,fe<<=1){if(Ye+=Lt<<=1,0>(Lt-=_e[le]))return 0;for(;0<_e[le];--_e[le]){if(ae=new K,(lt&Ie)!=Me){for(xe+=nt,Ae=1<<(Me=le)-ne;15>Me&&!(0>=(Ae-=_e[Me]));)++Me,Ae<<=1;Ee+=nt=1<<(Ae=Me-ne),G[J+(Me=lt&Ie)].g=Ae+ne,G[J+Me].value=xe-J-Me}ae.g=le-ne,ae.value=ke[pe++],A(G,xe+(lt>>ne),fe,nt,ae),lt=H(lt,le)}}return Ye!=2*Ce[15]-1?0:Ee}(m,v,j,L,z,W)}function K(){this.value=this.g=0}function U(){this.value=this.g=0}function I(){this.G=a(5,K),this.H=s(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=a(zc,U)}function re(m,v,j,L){t(m!=null),t(v!=null),t(2147483648>L),m.Ca=254,m.I=0,m.b=-8,m.Ka=0,m.oa=v,m.pa=j,m.Jd=v,m.Yc=j+L,m.Zc=4<=L?j+L-4+1:j,ce(m)}function V(m,v){for(var j=0;0<v--;)j|=ye(m,128)<<v;return j}function $(m,v){var j=V(m,v);return ue(m)?-j:j}function D(m,v,j,L){var z,W=0;for(t(m!=null),t(v!=null),t(4294967288>L),m.Sb=L,m.Ra=0,m.u=0,m.h=0,4<L&&(L=4),z=0;z<L;++z)W+=v[j+z]<<8*z;m.Ra=W,m.bb=L,m.oa=v,m.pa=j}function ie(m){for(;8<=m.u&&m.bb<m.Sb;)m.Ra>>>=8,m.Ra+=m.oa[m.pa+m.bb]<<Gr-8>>>0,++m.bb,m.u-=8;Z(m)&&(m.h=1,m.u=0)}function X(m,v){if(t(0<=v),!m.h&&v<=Ku){var j=F(m)&Cl[v];return m.u+=v,ie(m),j}return m.h=1,m.u=0}function E(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function q(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function F(m){return m.Ra>>>(m.u&Gr-1)>>>0}function Z(m){return t(m.bb<=m.Sb),m.h||m.bb==m.Sb&&m.u>Gr}function Y(m,v){m.u=v,m.h=Z(m)}function ee(m){m.u>=si&&(t(m.u>=si),ie(m))}function ce(m){t(m!=null&&m.oa!=null),m.pa<m.Zc?(m.I=(m.oa[m.pa++]|m.I<<8)>>>0,m.b+=8):(t(m!=null&&m.oa!=null),m.pa<m.Yc?(m.b+=8,m.I=m.oa[m.pa++]|m.I<<8):m.Ka?m.b=0:(m.I<<=8,m.b+=8,m.Ka=1))}function ue(m){return V(m,1)}function ye(m,v){var j=m.Ca;0>m.b&&ce(m);var L=m.b,z=j*v>>>8,W=(m.I>>>L>z)+0;for(W?(j-=z,m.I-=z+1<<L>>>0):j=z+1,L=j,z=0;256<=L;)z+=8,L>>=8;return L=7^z+qc[L],m.b-=L,m.Ca=(j<<L)-1,W}function Se(m,v,j){m[v+0]=j>>24&255,m[v+1]=j>>16&255,m[v+2]=j>>8&255,m[v+3]=255&j}function De(m,v){return m[v+0]|m[v+1]<<8}function Re(m,v){return De(m,v)|m[v+2]<<16}function qe(m,v){return De(m,v)|De(m,v+2)<<16}function te(m,v){var j=1<<v;return t(m!=null),t(0<v),m.X=s(j),m.X==null?0:(m.Mb=32-v,m.Xa=v,1)}function Oe(m,v){t(m!=null),t(v!=null),t(m.Xa==v.Xa),r(v.X,0,m.X,0,1<<v.Xa)}function be(){this.X=[],this.Xa=this.Mb=0}function se(m,v,j,L){t(j!=null),t(L!=null);var z=j[0],W=L[0];return z==0&&(z=(m*W+v/2)/v),W==0&&(W=(v*z+m/2)/m),0>=z||0>=W?0:(j[0]=z,L[0]=W,1)}function Q(m,v){return m+(1<<v)-1>>>v}function he(m,v){return((4278255360&m)+(4278255360&v)>>>0&4278255360)+((16711935&m)+(16711935&v)>>>0&16711935)>>>0}function ve(m,v){T[v]=function(j,L,z,W,G,J,ne){var ae;for(ae=0;ae<G;++ae){var fe=T[m](J[ne+ae-1],z,W+ae);J[ne+ae]=he(j[L+ae],fe)}}}function we(){this.ud=this.hd=this.jd=0}function Le(m,v){return((4278124286&(m^v))>>>1)+(m&v)>>>0}function Fe(m){return 0<=m&&256>m?m:0>m?0:255<m?255:void 0}function Ve(m,v){return Fe(m+(m-v+.5>>1))}function He(m,v,j){return Math.abs(v-j)-Math.abs(m-j)}function Ze(m,v,j,L,z,W,G){for(L=W[G-1],j=0;j<z;++j)W[G+j]=L=he(m[v+j],L)}function at(m,v,j,L,z){var W;for(W=0;W<j;++W){var G=m[v+W],J=G>>8&255,ne=16711935&(ne=(ne=16711935&G)+((J<<16)+J));L[z+W]=(4278255360&G)+ne>>>0}}function Be(m,v){v.jd=255&m,v.hd=m>>8&255,v.ud=m>>16&255}function it(m,v,j,L,z,W){var G;for(G=0;G<L;++G){var J=v[j+G],ne=J>>>8,ae=J,fe=255&(fe=(fe=J>>>16)+((m.jd<<24>>24)*(ne<<24>>24)>>>5));ae=255&(ae=(ae+=(m.hd<<24>>24)*(ne<<24>>24)>>>5)+((m.ud<<24>>24)*(fe<<24>>24)>>>5)),z[W+G]=(4278255360&J)+(fe<<16)+ae}}function ze(m,v,j,L,z){T[v]=function(W,G,J,ne,ae,fe,ke,le,pe){for(ne=ke;ne<le;++ne)for(ke=0;ke<pe;++ke)ae[fe++]=z(J[L(W[G++])])},T[m]=function(W,G,J,ne,ae,fe,ke){var le=8>>W.b,pe=W.Ea,xe=W.K[0],Ee=W.w;if(8>le)for(W=(1<<W.b)-1,Ee=(1<<le)-1;G<J;++G){var _e,Ce=0;for(_e=0;_e<pe;++_e)_e&W||(Ce=L(ne[ae++])),fe[ke++]=z(xe[Ce&Ee]),Ce>>=le}else T["VP8LMapColor"+j](ne,ae,xe,Ee,fe,ke,G,J,pe)}}function zt(m,v,j,L,z){for(j=v+j;v<j;){var W=m[v++];L[z++]=W>>16&255,L[z++]=W>>8&255,L[z++]=255&W}}function yt(m,v,j,L,z){for(j=v+j;v<j;){var W=m[v++];L[z++]=W>>16&255,L[z++]=W>>8&255,L[z++]=255&W,L[z++]=W>>24&255}}function mt(m,v,j,L,z){for(j=v+j;v<j;){var W=(G=m[v++])>>16&240|G>>12&15,G=240&G|G>>28&15;L[z++]=W,L[z++]=G}}function wt(m,v,j,L,z){for(j=v+j;v<j;){var W=(G=m[v++])>>16&248|G>>13&7,G=G>>5&224|G>>3&31;L[z++]=W,L[z++]=G}}function Mt(m,v,j,L,z){for(j=v+j;v<j;){var W=m[v++];L[z++]=255&W,L[z++]=W>>8&255,L[z++]=W>>16&255}}function dt(m,v,j,L,z,W){if(W==0)for(j=v+j;v<j;)Se(L,((W=m[v++])[0]>>24|W[1]>>8&65280|W[2]<<8&16711680|W[3]<<24)>>>0),z+=32;else r(L,z,m,v,j)}function qt(m,v){T[v][0]=T[m+"0"],T[v][1]=T[m+"1"],T[v][2]=T[m+"2"],T[v][3]=T[m+"3"],T[v][4]=T[m+"4"],T[v][5]=T[m+"5"],T[v][6]=T[m+"6"],T[v][7]=T[m+"7"],T[v][8]=T[m+"8"],T[v][9]=T[m+"9"],T[v][10]=T[m+"10"],T[v][11]=T[m+"11"],T[v][12]=T[m+"12"],T[v][13]=T[m+"13"],T[v][14]=T[m+"0"],T[v][15]=T[m+"0"]}function ht(m){return m==Tx||m==Ox||m==Ip||m==Ix}function bt(){this.eb=[],this.size=this.A=this.fb=0}function ln(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function Pt(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new bt,this.f.kb=new ln,this.sd=null}function st(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function Gt(){this.Id=this.fd=this.Md=this.hb=this.ib=this.da=this.bd=this.cd=this.j=this.v=this.Da=this.Sd=this.ob=0}function ft(m){return alert("todo:WebPSamplerProcessPlane"),m.T}function _t(m,v){var j=m.T,L=v.ba.f.RGBA,z=L.eb,W=L.fb+m.ka*L.A,G=Vi[v.ba.S],J=m.y,ne=m.O,ae=m.f,fe=m.N,ke=m.ea,le=m.W,pe=v.cc,xe=v.dc,Ee=v.Mc,_e=v.Nc,Ce=m.ka,Ae=m.ka+m.T,Me=m.U,Ie=Me+1>>1;for(Ce==0?G(J,ne,null,null,ae,fe,ke,le,ae,fe,ke,le,z,W,null,null,Me):(G(v.ec,v.fc,J,ne,pe,xe,Ee,_e,ae,fe,ke,le,z,W-L.A,z,W,Me),++j);Ce+2<Ae;Ce+=2)pe=ae,xe=fe,Ee=ke,_e=le,fe+=m.Rc,le+=m.Rc,W+=2*L.A,G(J,(ne+=2*m.fa)-m.fa,J,ne,pe,xe,Ee,_e,ae,fe,ke,le,z,W-L.A,z,W,Me);return ne+=m.fa,m.j+Ae<m.o?(r(v.ec,v.fc,J,ne,Me),r(v.cc,v.dc,ae,fe,Ie),r(v.Mc,v.Nc,ke,le,Ie),j--):1&Ae||G(J,ne,null,null,ae,fe,ke,le,ae,fe,ke,le,z,W+L.A,null,null,Me),j}function $t(m,v,j){var L=m.F,z=[m.J];if(L!=null){var W=m.U,G=v.ba.S,J=G==Op||G==Ip;v=v.ba.f.RGBA;var ne=[0],ae=m.ka;ne[0]=m.T,m.Kb&&(ae==0?--ne[0]:(--ae,z[0]-=m.width),m.j+m.ka+m.T==m.o&&(ne[0]=m.o-m.j-ae));var fe=v.eb;ae=v.fb+ae*v.A,m=l5(L,z[0],m.width,W,ne,fe,ae+(J?0:3),v.A),t(j==ne),m&&ht(G)&&Qu(fe,ae,J,W,ne,v.A)}return 0}function Rn(m){var v=m.ma,j=v.ba.S,L=11>j,z=j==Rp||j==Tp||j==Op||j==Rx||j==12||ht(j);if(v.memory=null,v.Ib=null,v.Jb=null,v.Nd=null,!Wi(v.Oa,m,z?11:12))return 0;if(z&&ht(j)&&wo(),m.da)alert("todo:use_scaling");else{if(L){if(v.Ib=ft,m.Kb){if(j=m.U+1>>1,v.memory=s(m.U+2*j),v.memory==null)return 0;v.ec=v.memory,v.fc=0,v.cc=v.ec,v.dc=v.fc+m.U,v.Mc=v.cc,v.Nc=v.dc+j,v.Ib=_t,wo()}}else alert("todo:EmitYUV");z&&(v.Jb=$t,L&&En())}if(L&&!S5){for(m=0;256>m;++m)wL[m]=89858*(m-128)+Fp>>Dp,NL[m]=-22014*(m-128)+Fp,kL[m]=-45773*(m-128),_L[m]=113618*(m-128)+Fp>>Dp;for(m=th;m<Mx;++m)v=76283*(m-16)+Fp>>Dp,SL[m-th]=Os(v,255),jL[m-th]=Os(v+8>>4,15);S5=1}return 1}function et(m){var v=m.ma,j=m.U,L=m.T;return t(!(1&m.ka)),0>=j||0>=L?0:(j=v.Ib(m,v),v.Jb!=null&&v.Jb(m,v,j),v.Dc+=j,1)}function cr(m){m.ma.memory=null}function xr(m,v,j,L){return X(m,8)!=47?0:(v[0]=X(m,14)+1,j[0]=X(m,14)+1,L[0]=X(m,1),X(m,3)!=0?0:!m.h)}function kn(m,v){if(4>m)return m+1;var j=m-2>>1;return(2+(1&m)<<j)+X(v,j)+1}function Un(m,v){return 120<v?v-120:1<=(j=((j=aL[v-1])>>4)*m+(8-(15&j)))?j:1;var j}function Tn(m,v,j){var L=F(j),z=m[v+=255&L].g-8;return 0<z&&(Y(j,j.u+8),L=F(j),v+=m[v].value,v+=L&(1<<z)-1),Y(j,j.u+m[v].g),m[v].value}function dr(m,v,j){return j.g+=m.g,j.value+=m.value<<v>>>0,t(8>=j.g),m.g}function vr(m,v,j){var L=m.xc;return t((v=L==0?0:m.vc[m.md*(j>>L)+(v>>L)])<m.Wb),m.Ya[v]}function gl(m,v,j,L){var z=m.ab,W=m.c*v,G=m.C;v=G+v;var J=j,ne=L;for(L=m.Ta,j=m.Ua;0<z--;){var ae=m.gc[z],fe=G,ke=v,le=J,pe=ne,xe=(ne=L,J=j,ae.Ea);switch(t(fe<ke),t(ke<=ae.nc),ae.hc){case 2:Wc(le,pe,(ke-fe)*xe,ne,J);break;case 0:var Ee=fe,_e=ke,Ce=ne,Ae=J,Me=(nt=ae).Ea;Ee==0&&(la(le,pe,null,null,1,Ce,Ae),Ze(le,pe+1,0,0,Me-1,Ce,Ae+1),pe+=Me,Ae+=Me,++Ee);for(var Ie=1<<nt.b,lt=Ie-1,Ye=Q(Me,nt.b),Lt=nt.K,nt=nt.w+(Ee>>nt.b)*Ye;Ee<_e;){var It=Lt,rr=nt,Rt=1;for(ca(le,pe,Ce,Ae-Me,1,Ce,Ae);Rt<Me;){var rt=(Rt&~lt)+Ie;rt>Me&&(rt=Me),(0,ss[It[rr++]>>8&15])(le,pe+ +Rt,Ce,Ae+Rt-Me,rt-Rt,Ce,Ae+Rt),Rt=rt}pe+=Me,Ae+=Me,++Ee&lt||(nt+=Ye)}ke!=ae.nc&&r(ne,J-xe,ne,J+(ke-fe-1)*xe,xe);break;case 1:for(xe=le,_e=pe,Me=(le=ae.Ea)-(Ae=le&~(Ce=(pe=1<<ae.b)-1)),Ee=Q(le,ae.b),Ie=ae.K,ae=ae.w+(fe>>ae.b)*Ee;fe<ke;){for(lt=Ie,Ye=ae,Lt=new we,nt=_e+Ae,It=_e+le;_e<nt;)Be(lt[Ye++],Lt),Pl(Lt,xe,_e,pe,ne,J),_e+=pe,J+=pe;_e<It&&(Be(lt[Ye++],Lt),Pl(Lt,xe,_e,Me,ne,J),_e+=Me,J+=Me),++fe&Ce||(ae+=Ee)}break;case 3:if(le==ne&&pe==J&&0<ae.b){for(_e=ne,le=xe=J+(ke-fe)*xe-(Ae=(ke-fe)*Q(ae.Ea,ae.b)),pe=ne,Ce=J,Ee=[],Ae=(Me=Ae)-1;0<=Ae;--Ae)Ee[Ae]=pe[Ce+Ae];for(Ae=Me-1;0<=Ae;--Ae)_e[le+Ae]=Ee[Ae];Al(ae,fe,ke,ne,xe,ne,J)}else Al(ae,fe,ke,le,pe,ne,J)}J=L,ne=j}ne!=j&&r(L,j,J,ne,W)}function ra(m,v){var j=m.V,L=m.Ba+m.c*m.C,z=v-m.C;if(t(v<=m.l.o),t(16>=z),0<z){var W=m.l,G=m.Ta,J=m.Ua,ne=W.width;if(gl(m,z,j,L),z=J=[J],t((j=m.C)<(L=v)),t(W.v<W.va),L>W.o&&(L=W.o),j<W.j){var ae=W.j-j;j=W.j,z[0]+=ae*ne}if(j>=L?j=0:(z[0]+=4*W.v,W.ka=j-W.j,W.U=W.va-W.v,W.T=L-j,j=1),j){if(J=J[0],11>(j=m.ca).S){var fe=j.f.RGBA,ke=(L=j.S,z=W.U,W=W.T,ae=fe.eb,fe.A),le=W;for(fe=fe.fb+m.Ma*fe.A;0<le--;){var pe=G,xe=J,Ee=z,_e=ae,Ce=fe;switch(L){case Lp:Ju(pe,xe,Ee,_e,Ce);break;case Rp:Xu(pe,xe,Ee,_e,Ce);break;case Tx:Xu(pe,xe,Ee,_e,Ce),Qu(_e,Ce,0,Ee,1,0);break;case m5:Rl(pe,xe,Ee,_e,Ce);break;case Tp:dt(pe,xe,Ee,_e,Ce,1);break;case Ox:dt(pe,xe,Ee,_e,Ce,1),Qu(_e,Ce,0,Ee,1,0);break;case Op:dt(pe,xe,Ee,_e,Ce,0);break;case Ip:dt(pe,xe,Ee,_e,Ce,0),Qu(_e,Ce,1,Ee,1,0);break;case Rx:Hc(pe,xe,Ee,_e,Ce);break;case Ix:Hc(pe,xe,Ee,_e,Ce),a5(_e,Ce,Ee,1,0);break;case g5:Ll(pe,xe,Ee,_e,Ce);break;default:t(0)}J+=ne,fe+=ke}m.Ma+=W}else alert("todo:EmitRescaledRowsYUVA");t(m.Ma<=j.height)}}m.C=v,t(m.C<=m.i)}function ns(m){var v;if(0<m.ua)return 0;for(v=0;v<m.Wb;++v){var j=m.Ya[v].G,L=m.Ya[v].H;if(0<j[1][L[1]+0].g||0<j[2][L[2]+0].g||0<j[3][L[3]+0].g)return 0}return 1}function Rs(m,v,j,L,z,W){if(m.Z!=0){var G=m.qd,J=m.rd;for(t(fa[m.Z]!=null);v<j;++v)fa[m.Z](G,J,L,z,L,z,W),G=L,J=z,z+=W;m.qd=G,m.rd=J}}function rs(m,v){var j=m.l.ma,L=j.Z==0||j.Z==1?m.l.j:m.C;if(L=m.C<L?L:m.C,t(v<=m.l.o),v>L){var z=m.l.width,W=j.ca,G=j.tb+z*L,J=m.V,ne=m.Ba+m.c*L,ae=m.gc;t(m.ab==1),t(ae[0].hc==3),Px(ae[0],L,v,J,ne,W,G),Rs(j,L,v,W,G,z)}m.C=m.Ma=v}function is(m,v,j,L,z,W,G){var J=m.$/L,ne=m.$%L,ae=m.m,fe=m.s,ke=j+m.$,le=ke;z=j+L*z;var pe=j+L*W,xe=280+fe.ua,Ee=m.Pb?J:16777216,_e=0<fe.ua?fe.Wa:null,Ce=fe.wc,Ae=ke<pe?vr(fe,ne,J):null;t(m.C<W),t(pe<=z);var Me=!1;e:for(;;){for(;Me||ke<pe;){var Ie=0;if(J>=Ee){var lt=ke-j;t((Ee=m).Pb),Ee.wd=Ee.m,Ee.xd=lt,0<Ee.s.ua&&Oe(Ee.s.Wa,Ee.s.vb),Ee=J+cL}if(ne&Ce||(Ae=vr(fe,ne,J)),t(Ae!=null),Ae.Qb&&(v[ke]=Ae.qb,Me=!0),!Me)if(ee(ae),Ae.jc){Ie=ae,lt=v;var Ye=ke,Lt=Ae.pd[F(Ie)&zc-1];t(Ae.jc),256>Lt.g?(Y(Ie,Ie.u+Lt.g),lt[Ye]=Lt.value,Ie=0):(Y(Ie,Ie.u+Lt.g-256),t(256<=Lt.value),Ie=Lt.value),Ie==0&&(Me=!0)}else Ie=Tn(Ae.G[0],Ae.H[0],ae);if(ae.h)break;if(Me||256>Ie){if(!Me)if(Ae.nd)v[ke]=(Ae.qb|Ie<<8)>>>0;else{if(ee(ae),Me=Tn(Ae.G[1],Ae.H[1],ae),ee(ae),lt=Tn(Ae.G[2],Ae.H[2],ae),Ye=Tn(Ae.G[3],Ae.H[3],ae),ae.h)break;v[ke]=(Ye<<24|Me<<16|Ie<<8|lt)>>>0}if(Me=!1,++ke,++ne>=L&&(ne=0,++J,G!=null&&J<=W&&!(J%16)&&G(m,J),_e!=null))for(;le<ke;)Ie=v[le++],_e.X[(506832829*Ie&4294967295)>>>_e.Mb]=Ie}else if(280>Ie){if(Ie=kn(Ie-256,ae),lt=Tn(Ae.G[4],Ae.H[4],ae),ee(ae),lt=Un(L,lt=kn(lt,ae)),ae.h)break;if(ke-j<lt||z-ke<Ie)break e;for(Ye=0;Ye<Ie;++Ye)v[ke+Ye]=v[ke+Ye-lt];for(ke+=Ie,ne+=Ie;ne>=L;)ne-=L,++J,G!=null&&J<=W&&!(J%16)&&G(m,J);if(t(ke<=z),ne&Ce&&(Ae=vr(fe,ne,J)),_e!=null)for(;le<ke;)Ie=v[le++],_e.X[(506832829*Ie&4294967295)>>>_e.Mb]=Ie}else{if(!(Ie<xe))break e;for(Me=Ie-280,t(_e!=null);le<ke;)Ie=v[le++],_e.X[(506832829*Ie&4294967295)>>>_e.Mb]=Ie;Ie=ke,t(!(Me>>>(lt=_e).Xa)),v[Ie]=lt.X[Me],Me=!0}Me||t(ae.h==Z(ae))}if(m.Pb&&ae.h&&ke<z)t(m.m.h),m.a=5,m.m=m.wd,m.$=m.xd,0<m.s.ua&&Oe(m.s.vb,m.s.Wa);else{if(ae.h)break e;G!=null&&G(m,J>W?W:J),m.a=0,m.$=ke-j}return 1}return m.a=3,0}function zi(m){t(m!=null),m.vc=null,m.yc=null,m.Ya=null;var v=m.Wa;v!=null&&(v.X=null),m.vb=null,t(m!=null)}function xl(){var m=new tt;return m==null?null:(m.a=0,m.xb=b5,qt("Predictor","VP8LPredictors"),qt("Predictor","VP8LPredictors_C"),qt("PredictorAdd","VP8LPredictorsAdd"),qt("PredictorAdd","VP8LPredictorsAdd_C"),Wc=at,Pl=it,Ju=zt,Xu=yt,Hc=mt,Ll=wt,Rl=Mt,T.VP8LMapColor32b=Xn,T.VP8LMapColor8b=$s,m)}function Ts(m,v,j,L,z){var W=1,G=[m],J=[v],ne=L.m,ae=L.s,fe=null,ke=0;e:for(;;){if(j)for(;W&&X(ne,1);){var le=G,pe=J,xe=L,Ee=1,_e=xe.m,Ce=xe.gc[xe.ab],Ae=X(_e,2);if(xe.Oc&1<<Ae)W=0;else{switch(xe.Oc|=1<<Ae,Ce.hc=Ae,Ce.Ea=le[0],Ce.nc=pe[0],Ce.K=[null],++xe.ab,t(4>=xe.ab),Ae){case 0:case 1:Ce.b=X(_e,3)+2,Ee=Ts(Q(Ce.Ea,Ce.b),Q(Ce.nc,Ce.b),0,xe,Ce.K),Ce.K=Ce.K[0];break;case 3:var Me,Ie=X(_e,8)+1,lt=16<Ie?0:4<Ie?1:2<Ie?2:3;if(le[0]=Q(Ce.Ea,lt),Ce.b=lt,Me=Ee=Ts(Ie,1,0,xe,Ce.K)){var Ye,Lt=Ie,nt=Ce,It=1<<(8>>nt.b),rr=s(It);if(rr==null)Me=0;else{var Rt=nt.K[0],rt=nt.w;for(rr[0]=nt.K[0][0],Ye=1;Ye<1*Lt;++Ye)rr[Ye]=he(Rt[rt+Ye],rr[Ye-1]);for(;Ye<4*It;++Ye)rr[Ye]=0;nt.K[0]=null,nt.K[0]=rr,Me=1}}Ee=Me;break;case 2:break;default:t(0)}W=Ee}}if(G=G[0],J=J[0],W&&X(ne,1)&&!(W=1<=(ke=X(ne,4))&&11>=ke)){L.a=3;break e}var We;if(We=W)t:{var qn,Ct,Ut,xn=L,yr=G,Yr=J,On=ke,Tr=j,Kr=xn.m,ir=xn.s,Wt=[null],Jt=1,In=0,Xt=lL[On];n:for(;;){if(Tr&&X(Kr,1)){var wr=X(Kr,3)+2,as=Q(yr,wr),Wn=Q(Yr,wr),oi=as*Wn;if(!Ts(as,Wn,0,xn,Wt))break n;for(Wt=Wt[0],ir.xc=wr,qn=0;qn<oi;++qn){var on=Wt[qn]>>8&65535;Wt[qn]=on,on>=Jt&&(Jt=on+1)}}if(Kr.h)break n;for(Ct=0;5>Ct;++Ct){var sr=x5[Ct];!Ct&&0<On&&(sr+=1<<On),In<sr&&(In=sr)}var _i=a(Jt*Xt,K),Jr=Jt,ki=a(Jr,I);if(ki==null)var Ni=null;else t(65536>=Jr),Ni=ki;var ai=s(In);if(Ni==null||ai==null||_i==null){xn.a=1;break n}var Si=_i;for(qn=Ut=0;qn<Jt;++qn){var un=Ni[qn],ji=un.G,ls=un.H,Tl=0,So=1,_r=0;for(Ct=0;5>Ct;++Ct){sr=x5[Ct],ji[Ct]=Si,ls[Ct]=Ut,!Ct&&0<On&&(sr+=1<<On);i:{var $p,$x=sr,Bp=xn,nh=ai,AL=Si,PL=Ut,Bx=0,pa=Bp.m,LL=X(pa,1);if(i(nh,0,0,$x),LL){var RL=X(pa,1)+1,TL=X(pa,1),C5=X(pa,TL==0?1:8);nh[C5]=1,RL==2&&(nh[C5=X(pa,8)]=1);var Up=1}else{var A5=s(19),P5=X(pa,4)+4;if(19<P5){Bp.a=3;var zp=0;break i}for($p=0;$p<P5;++$p)A5[oL[$p]]=X(pa,3);var Ux=void 0,rh=void 0,L5=Bp,OL=A5,qp=$x,R5=nh,zx=0,ma=L5.m,T5=8,O5=a(128,K);r:for(;O(O5,0,7,OL,19);){if(X(ma,1)){var IL=2+2*X(ma,3);if((Ux=2+X(ma,IL))>qp)break r}else Ux=qp;for(rh=0;rh<qp&&Ux--;){ee(ma);var I5=O5[0+(127&F(ma))];Y(ma,ma.u+I5.g);var Yc=I5.value;if(16>Yc)R5[rh++]=Yc,Yc!=0&&(T5=Yc);else{var DL=Yc==16,D5=Yc-16,FL=iL[D5],F5=X(ma,rL[D5])+FL;if(rh+F5>qp)break r;for(var ML=DL?T5:0;0<F5--;)R5[rh++]=ML}}zx=1;break r}zx||(L5.a=3),Up=zx}(Up=Up&&!pa.h)&&(Bx=O(AL,PL,8,nh,$x)),Up&&Bx!=0?zp=Bx:(Bp.a=3,zp=0)}if(zp==0)break n;if(So&&sL[Ct]==1&&(So=Si[Ut].g==0),Tl+=Si[Ut].g,Ut+=zp,3>=Ct){var ih,qx=ai[0];for(ih=1;ih<sr;++ih)ai[ih]>qx&&(qx=ai[ih]);_r+=qx}}if(un.nd=So,un.Qb=0,So&&(un.qb=(ji[3][ls[3]+0].value<<24|ji[1][ls[1]+0].value<<16|ji[2][ls[2]+0].value)>>>0,Tl==0&&256>ji[0][ls[0]+0].value&&(un.Qb=1,un.qb+=ji[0][ls[0]+0].value<<8)),un.jc=!un.Qb&&6>_r,un.jc){var Wp,jo=un;for(Wp=0;Wp<zc;++Wp){var ga=Wp,xa=jo.pd[ga],Hp=jo.G[0][jo.H[0]+ga];256<=Hp.value?(xa.g=Hp.g+256,xa.value=Hp.value):(xa.g=0,xa.value=0,ga>>=dr(Hp,8,xa),ga>>=dr(jo.G[1][jo.H[1]+ga],16,xa),ga>>=dr(jo.G[2][jo.H[2]+ga],0,xa),dr(jo.G[3][jo.H[3]+ga],24,xa))}}}ir.vc=Wt,ir.Wb=Jt,ir.Ya=Ni,ir.yc=_i,We=1;break t}We=0}if(!(W=We)){L.a=3;break e}if(0<ke){if(ae.ua=1<<ke,!te(ae.Wa,ke)){L.a=1,W=0;break e}}else ae.ua=0;var Wx=L,M5=G,$L=J,Hx=Wx.s,Vx=Hx.xc;if(Wx.c=M5,Wx.i=$L,Hx.md=Q(M5,Vx),Hx.wc=Vx==0?-1:(1<<Vx)-1,j){L.xb=gL;break e}if((fe=s(G*J))==null){L.a=1,W=0;break e}W=(W=is(L,fe,0,G,J,J,null))&&!ne.h;break e}return W?(z!=null?z[0]=fe:(t(fe==null),t(j)),L.$=0,j||zi(ae)):zi(ae),W}function vl(m,v){var j=m.c*m.i,L=j+v+16*v;return t(m.c<=v),m.V=s(L),m.V==null?(m.Ta=null,m.Ua=0,m.a=1,0):(m.Ta=m.V,m.Ua=m.Ba+j+v,1)}function Ec(m,v){var j=m.C,L=v-j,z=m.V,W=m.Ba+m.c*j;for(t(v<=m.l.o);0<L;){var G=16<L?16:L,J=m.l.ma,ne=m.l.width,ae=ne*G,fe=J.ca,ke=J.tb+ne*j,le=m.Ta,pe=m.Ua;gl(m,G,z,W),c5(le,pe,fe,ke,ae),Rs(J,j,j+G,fe,ke,ne),L-=G,z+=G*m.c,j+=G}t(j==v),m.C=m.Ma=v}function Cc(){this.ub=this.yd=this.td=this.Rb=0}function Ac(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function hx(){this.Fb=this.Bb=this.Cb=0,this.Zb=s(4),this.Lb=s(4)}function Du(){this.Yb=function(){var m=[];return function v(j,L,z){for(var W=z[L],G=0;G<W&&(j.push(z.length>L+1?[]:0),!(z.length<L+1));G++)v(j[G],L+1,z)}(m,0,[3,11]),m}()}function hp(){this.jb=s(3),this.Wc=l([4,8],Du),this.Xc=l([4,17],Du)}function fp(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new s(4),this.od=new s(4)}function qi(){this.ld=this.La=this.dd=this.tc=0}function Fu(){this.Na=this.la=0}function pp(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function Mu(){this.ad=s(384),this.Za=0,this.Ob=s(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function mp(){this.uc=this.M=this.Nb=0,this.wa=Array(new qi),this.Y=0,this.ya=Array(new Mu),this.aa=0,this.l=new Pc}function gp(){this.y=s(16),this.f=s(8),this.ea=s(8)}function xp(){this.cb=this.a=0,this.sc="",this.m=new E,this.Od=new Cc,this.Kc=new Ac,this.ed=new fp,this.Qa=new hx,this.Ic=this.$c=this.Aa=0,this.D=new mp,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=a(8,E),this.ia=0,this.pb=a(4,pp),this.Pa=new hp,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new gp),this.Hd=0,this.rb=Array(new Fu),this.sb=0,this.wa=Array(new qi),this.Y=0,this.oc=[],this.pc=0,this.sa=[],this.ta=0,this.qa=[],this.ra=0,this.Ha=[],this.B=this.R=this.Ia=0,this.Ec=[],this.M=this.ja=this.Vb=this.Fc=0,this.ya=Array(new Mu),this.L=this.aa=0,this.gd=l([4,2],qi),this.ga=null,this.Fa=[],this.Cc=this.qc=this.P=0,this.Gb=[],this.Uc=0,this.mb=[],this.nb=0,this.rc=[],this.Ga=this.Vc=0}function Os(m,v){return 0>m?0:m>v?v:m}function Pc(){this.T=this.U=this.ka=this.height=this.width=0,this.y=[],this.f=[],this.ea=[],this.Rc=this.fa=this.W=this.N=this.O=0,this.ma="void",this.put="VP8IoPutHook",this.ac="VP8IoSetupHook",this.bc="VP8IoTeardownHook",this.ha=this.Kb=0,this.data=[],this.hb=this.ib=this.da=this.o=this.j=this.va=this.v=this.Da=this.ob=this.w=0,this.F=[],this.J=0}function fx(){var m=new xp;return m!=null&&(m.a=0,m.sc="OK",m.cb=0,m.Xb=0,eh||(eh=Lc)),m}function Kn(m,v,j){return m.a==0&&(m.a=v,m.sc=j,m.cb=0),0}function vp(m,v,j){return 3<=j&&m[v+0]==157&&m[v+1]==1&&m[v+2]==42}function Is(m,v){if(m==null)return 0;if(m.a=0,m.sc="OK",v==null)return Kn(m,2,"null VP8Io passed to VP8GetHeaders()");var j=v.data,L=v.w,z=v.ha;if(4>z)return Kn(m,7,"Truncated header.");var W=j[L+0]|j[L+1]<<8|j[L+2]<<16,G=m.Od;if(G.Rb=!(1&W),G.td=W>>1&7,G.yd=W>>4&1,G.ub=W>>5,3<G.td)return Kn(m,3,"Incorrect keyframe parameters.");if(!G.yd)return Kn(m,4,"Frame not displayable.");L+=3,z-=3;var J=m.Kc;if(G.Rb){if(7>z)return Kn(m,7,"cannot parse picture header");if(!vp(j,L,z))return Kn(m,3,"Bad code word");J.c=16383&(j[L+4]<<8|j[L+3]),J.Td=j[L+4]>>6,J.i=16383&(j[L+6]<<8|j[L+5]),J.Ud=j[L+6]>>6,L+=7,z-=7,m.za=J.c+15>>4,m.Ub=J.i+15>>4,v.width=J.c,v.height=J.i,v.Da=0,v.j=0,v.v=0,v.va=v.width,v.o=v.height,v.da=0,v.ib=v.width,v.hb=v.height,v.U=v.width,v.T=v.height,i((W=m.Pa).jb,0,255,W.jb.length),t((W=m.Qa)!=null),W.Cb=0,W.Bb=0,W.Fb=1,i(W.Zb,0,0,W.Zb.length),i(W.Lb,0,0,W.Lb)}if(G.ub>z)return Kn(m,7,"bad partition length");re(W=m.m,j,L,G.ub),L+=G.ub,z-=G.ub,G.Rb&&(J.Ld=ue(W),J.Kd=ue(W)),J=m.Qa;var ne,ae=m.Pa;if(t(W!=null),t(J!=null),J.Cb=ue(W),J.Cb){if(J.Bb=ue(W),ue(W)){for(J.Fb=ue(W),ne=0;4>ne;++ne)J.Zb[ne]=ue(W)?$(W,7):0;for(ne=0;4>ne;++ne)J.Lb[ne]=ue(W)?$(W,6):0}if(J.Bb)for(ne=0;3>ne;++ne)ae.jb[ne]=ue(W)?V(W,8):255}else J.Bb=0;if(W.Ka)return Kn(m,3,"cannot parse segment header");if((J=m.ed).zd=ue(W),J.Tb=V(W,6),J.wb=V(W,3),J.Pc=ue(W),J.Pc&&ue(W)){for(ae=0;4>ae;++ae)ue(W)&&(J.vd[ae]=$(W,6));for(ae=0;4>ae;++ae)ue(W)&&(J.od[ae]=$(W,6))}if(m.L=J.Tb==0?0:J.zd?1:2,W.Ka)return Kn(m,3,"cannot parse filter header");var fe=z;if(z=ne=L,L=ne+fe,J=fe,m.Xb=(1<<V(m.m,2))-1,fe<3*(ae=m.Xb))j=7;else{for(ne+=3*ae,J-=3*ae,fe=0;fe<ae;++fe){var ke=j[z+0]|j[z+1]<<8|j[z+2]<<16;ke>J&&(ke=J),re(m.Jc[+fe],j,ne,ke),ne+=ke,J-=ke,z+=3}re(m.Jc[+ae],j,ne,J),j=ne<L?0:5}if(j!=0)return Kn(m,j,"cannot parse partitions");for(j=V(ne=m.m,7),z=ue(ne)?$(ne,4):0,L=ue(ne)?$(ne,4):0,J=ue(ne)?$(ne,4):0,ae=ue(ne)?$(ne,4):0,ne=ue(ne)?$(ne,4):0,fe=m.Qa,ke=0;4>ke;++ke){if(fe.Cb){var le=fe.Zb[ke];fe.Fb||(le+=j)}else{if(0<ke){m.pb[ke]=m.pb[0];continue}le=j}var pe=m.pb[ke];pe.Sc[0]=Dx[Os(le+z,127)],pe.Sc[1]=Fx[Os(le+0,127)],pe.Eb[0]=2*Dx[Os(le+L,127)],pe.Eb[1]=101581*Fx[Os(le+J,127)]>>16,8>pe.Eb[1]&&(pe.Eb[1]=8),pe.Qc[0]=Dx[Os(le+ae,117)],pe.Qc[1]=Fx[Os(le+ne,127)],pe.lc=le+ne}if(!G.Rb)return Kn(m,4,"Not a key frame.");for(ue(W),G=m.Pa,j=0;4>j;++j){for(z=0;8>z;++z)for(L=0;3>L;++L)for(J=0;11>J;++J)ae=ye(W,pL[j][z][L][J])?V(W,8):hL[j][z][L][J],G.Wc[j][z].Yb[L][J]=ae;for(z=0;17>z;++z)G.Xc[j][z]=G.Wc[j][mL[z]]}return m.kc=ue(W),m.kc&&(m.Bd=V(W,8)),m.cb=1}function Lc(m,v,j,L,z,W,G){var J=v[z].Yb[j];for(j=0;16>z;++z){if(!ye(m,J[j+0]))return z;for(;!ye(m,J[j+1]);)if(J=v[++z].Yb[0],j=0,z==16)return 16;var ne=v[z+1].Yb;if(ye(m,J[j+2])){var ae=m,fe=0;if(ye(ae,(le=J)[(ke=j)+3]))if(ye(ae,le[ke+6])){for(J=0,ke=2*(fe=ye(ae,le[ke+8]))+(le=ye(ae,le[ke+9+fe])),fe=0,le=dL[ke];le[J];++J)fe+=fe+ye(ae,le[J]);fe+=3+(8<<ke)}else ye(ae,le[ke+7])?(fe=7+2*ye(ae,165),fe+=ye(ae,145)):fe=5+ye(ae,159);else fe=ye(ae,le[ke+4])?3+ye(ae,le[ke+5]):2;J=ne[2]}else fe=1,J=ne[1];ne=G+uL[z],0>(ae=m).b&&ce(ae);var ke,le=ae.b,pe=(ke=ae.Ca>>1)-(ae.I>>le)>>31;--ae.b,ae.Ca+=pe,ae.Ca|=1,ae.I-=(ke+1&pe)<<le,W[ne]=((fe^pe)-pe)*L[(0<z)+0]}return 16}function $u(m){var v=m.rb[m.sb-1];v.la=0,v.Na=0,i(m.zc,0,0,m.zc.length),m.ja=0}function yi(m,v,j,L,z){z=m[v+j+32*L]+(z>>3),m[v+j+32*L]=-256&z?0>z?0:255:z}function Rc(m,v,j,L,z,W){yi(m,v,0,j,L+z),yi(m,v,1,j,L+W),yi(m,v,2,j,L-W),yi(m,v,3,j,L-z)}function go(m){return(20091*m>>16)+m}function br(m,v,j,L){var z,W=0,G=s(16);for(z=0;4>z;++z){var J=m[v+0]+m[v+8],ne=m[v+0]-m[v+8],ae=(35468*m[v+4]>>16)-go(m[v+12]),fe=go(m[v+4])+(35468*m[v+12]>>16);G[W+0]=J+fe,G[W+1]=ne+ae,G[W+2]=ne-ae,G[W+3]=J-fe,W+=4,v++}for(z=W=0;4>z;
vendor: 4,815 bytes, line 533
533++z)J=(m=G[W+0]+4)+G[W+8],ne=m-G[W+8],ae=(35468*G[W+4]>>16)-go(G[W+12]),yi(j,L,0,0,J+(fe=go(G[W+4])+(35468*G[W+12]>>16))),yi(j,L,1,0,ne+ae),yi(j,L,2,0,ne-ae),yi(j,L,3,0,J-fe),W++,L+=32}function bp(m,v,j,L){var z=m[v+0]+4,W=35468*m[v+4]>>16,G=go(m[v+4]),J=35468*m[v+1]>>16;Rc(j,L,0,z+G,m=go(m[v+1]),J),Rc(j,L,1,z+W,m,J),Rc(j,L,2,z-W,m,J),Rc(j,L,3,z-G,m,J)}function px(m,v,j,L,z){br(m,v,j,L),z&&br(m,v+16,j,L+4)}function mx(m,v,j,L){_o(m,v+0,j,L,1),_o(m,v+32,j,L+128,1)}function gx(m,v,j,L){var z;for(m=m[v+0]+4,z=0;4>z;++z)for(v=0;4>v;++v)yi(j,L,v,z,m)}function Ds(m,v,j,L){m[v+0]&&Rr(m,v+0,j,L),m[v+16]&&Rr(m,v+16,j,L+4),m[v+32]&&Rr(m,v+32,j,L+128),m[v+48]&&Rr(m,v+48,j,L+128+4)}function yp(m,v,j,L){var z,W=s(16);for(z=0;4>z;++z){var G=m[v+0+z]+m[v+12+z],J=m[v+4+z]+m[v+8+z],ne=m[v+4+z]-m[v+8+z],ae=m[v+0+z]-m[v+12+z];W[0+z]=G+J,W[8+z]=G-J,W[4+z]=ae+ne,W[12+z]=ae-ne}for(z=0;4>z;++z)G=(m=W[0+4*z]+3)+W[3+4*z],J=W[1+4*z]+W[2+4*z],ne=W[1+4*z]-W[2+4*z],ae=m-W[3+4*z],j[L+0]=G+J>>3,j[L+16]=ae+ne>>3,j[L+32]=G-J>>3,j[L+48]=ae-ne>>3,L+=64}function Tc(m,v,j){var L,z=v-32,W=wi,G=255-m[z-1];for(L=0;L<j;++L){var J,ne=W,ae=G+m[v-1];for(J=0;J<j;++J)m[v+J]=ne[ae+m[z+J]];v+=32}}function Oc(m,v){Tc(m,v,4)}function Bu(m,v){Tc(m,v,8)}function xx(m,v){Tc(m,v,16)}function vx(m,v){var j;for(j=0;16>j;++j)r(m,v+32*j,m,v-32,16)}function bx(m,v){var j;for(j=16;0<j;--j)i(m,v,m[v-1],16),v+=32}function ia(m,v,j){var L;for(L=0;16>L;++L)i(v,j+32*L,m,16)}function wp(m,v){var j,L=16;for(j=0;16>j;++j)L+=m[v-1+32*j]+m[v+j-32];ia(L>>5,m,v)}function sa(m,v){var j,L=8;for(j=0;16>j;++j)L+=m[v-1+32*j];ia(L>>4,m,v)}function yx(m,v){var j,L=8;for(j=0;16>j;++j)L+=m[v+j-32];ia(L>>4,m,v)}function bl(m,v){ia(128,m,v)}function xt(m,v,j){return m+2*v+j+2>>2}function wx(m,v){var j,L=v-32;for(L=new Uint8Array([xt(m[L-1],m[L+0],m[L+1]),xt(m[L+0],m[L+1],m[L+2]),xt(m[L+1],m[L+2],m[L+3]),xt(m[L+2],m[L+3],m[L+4])]),j=0;4>j;++j)r(m,v+32*j,L,0,L.length)}function _x(m,v){var j=m[v-1],L=m[v-1+32],z=m[v-1+64],W=m[v-1+96];Se(m,v+0,16843009*xt(m[v-1-32],j,L)),Se(m,v+32,16843009*xt(j,L,z)),Se(m,v+64,16843009*xt(L,z,W)),Se(m,v+96,16843009*xt(z,W,W))}function kx(m,v){var j,L=4;for(j=0;4>j;++j)L+=m[v+j-32]+m[v-1+32*j];for(L>>=3,j=0;4>j;++j)i(m,v+32*j,L,4)}function Nx(m,v){var j=m[v-1+0],L=m[v-1+32],z=m[v-1+64],W=m[v-1-32],G=m[v+0-32],J=m[v+1-32],ne=m[v+2-32],ae=m[v+3-32];m[v+0+96]=xt(L,z,m[v-1+96]),m[v+1+96]=m[v+0+64]=xt(j,L,z),m[v+2+96]=m[v+1+64]=m[v+0+32]=xt(W,j,L),m[v+3+96]=m[v+2+64]=m[v+1+32]=m[v+0+0]=xt(G,W,j),m[v+3+64]=m[v+2+32]=m[v+1+0]=xt(J,G,W),m[v+3+32]=m[v+2+0]=xt(ne,J,G),m[v+3+0]=xt(ae,ne,J)}function Sx(m,v){var j=m[v+1-32],L=m[v+2-32],z=m[v+3-32],W=m[v+4-32],G=m[v+5-32],J=m[v+6-32],ne=m[v+7-32];m[v+0+0]=xt(m[v+0-32],j,L),m[v+1+0]=m[v+0+32]=xt(j,L,z),m[v+2+0]=m[v+1+32]=m[v+0+64]=xt(L,z,W),m[v+3+0]=m[v+2+32]=m[v+1+64]=m[v+0+96]=xt(z,W,G),m[v+3+32]=m[v+2+64]=m[v+1+96]=xt(W,G,J),m[v+3+64]=m[v+2+96]=xt(G,J,ne),m[v+3+96]=xt(J,ne,ne)}function xo(m,v){var j=m[v-1+0],L=m[v-1+32],z=m[v-1+64],W=m[v-1-32],G=m[v+0-32],J=m[v+1-32],ne=m[v+2-32],ae=m[v+3-32];m[v+0+0]=m[v+1+64]=W+G+1>>1,m[v+1+0]=m[v+2+64]=G+J+1>>1,m[v+2+0]=m[v+3+64]=J+ne+1>>1,m[v+3+0]=ne+ae+1>>1,m[v+0+96]=xt(z,L,j),m[v+0+64]=xt(L,j,W),m[v+0+32]=m[v+1+96]=xt(j,W,G),m[v+1+32]=m[v+2+96]=xt(W,G,J),m[v+2+32]=m[v+3+96]=xt(G,J,ne),m[v+3+32]=xt(J,ne,ae)}function vo(m,v){var j=m[v+0-32],L=m[v+1-32],z=m[v+2-32],W=m[v+3-32],G=m[v+4-32],J=m[v+5-32],ne=m[v+6-32],ae=m[v+7-32];m[v+0+0]=j+L+1>>1,m[v+1+0]=m[v+0+64]=L+z+1>>1,m[v+2+0]=m[v+1+64]=z+W+1>>1,m[v+3+0]=m[v+2+64]=W+G+1>>1,m[v+0+32]=xt(j,L,z),m[v+1+32]=m[v+0+96]=xt(L,z,W),m[v+2+32]=m[v+1+96]=xt(z,W,G),m[v+3+32]=m[v+2+96]=xt(W,G,J),m[v+3+64]=xt(G,J,ne),m[v+3+96]=xt(J,ne,ae)}function jx(m,v){var j=m[v-1+0],L=m[v-1+32],z=m[v-1+64],W=m[v-1+96];m[v+0+0]=j+L+1>>1,m[v+2+0]=m[v+0+32]=L+z+1>>1,m[v+2+32]=m[v+0+64]=z+W+1>>1,m[v+1+0]=xt(j,L,z),m[v+3+0]=m[v+1+32]=xt(L,z,W),m[v+3+32]=m[v+1+64]=xt(z,W,W),m[v+3+64]=m[v+2+64]=m[v+0+96]=m[v+1+96]=m[v+2+96]=m[v+3+96]=W}function Ex(m,v){var j=m[v-1+0],L=m[v-1+32],z=m[v-1+64],W=m[v-1+96],G=m[v-1-32],J=m[v+0-32],ne=m[v+1-32],ae=m[v+2-32];m[v+0+0]=m[v+2+32]=j+G+1>>1,m[v+0+32]=m[v+2+64]=L+j+1>>1,m[v+0+64]=m[v+2+96]=z+L+1>>1,m[v+0+96]=W+z+1>>1,m[v+3+0]=xt(J,ne,ae),m[v+2+0]=xt(G,J,ne),m[v+1+0]=m[v+3+32]=xt(j,G,J),m[v+1+32]=m[v+3+64]=xt(L,j,G),m[v+1+64]=m[v+3+96]=xt(z,L,j),m[v+1+96]=xt(W,z,L)}function Ic(m,v){var j;for(j=0;8>j;++j)r(m,v+32*j,m,v-32,8)}function Uu(m,v){var j;for(j=0;8>j;++j)i(m,v,m[v-1],8),v+=32}function Fs(m,v,j){var L;for(L=0;8>L;++L)i(v,j+32*L,m,8)}function Cx(m,v){var j,L=8;for(j=0;8>j;++j)L+=m[v+j-32]+m[v-1+32*j];Fs(L>>4,m,v)}function Dc(m,v){var j,L=4;for(j=0;8>j;++j)L+=m[v+j-32];Fs(L>>3,m,v)}function Ax(m,v){var j,L=4;for(j=0;8>j;++j)L+=m[v-1+32*j];Fs(L>>3,m,v)}function zu(m,v){Fs(128,m,v)}function oa(m,v,j){var L=m[v-j],z=m[v+0],W=3*(z-L)+Lx[1020+m[v-2*j
vendor: 17,528 bytes, line 533
533]-m[v+j]],G=Pp[112+(W+4>>3)];m[v-j]=wi[255+L+Pp[112+(W+3>>3)]],m[v+0]=wi[255+z-G]}function qu(m,v,j,L){var z=m[v+0],W=m[v+j];return Hi[255+m[v-2*j]-m[v-j]]>L||Hi[255+W-z]>L}function yl(m,v,j,L){return 4*Hi[255+m[v-j]-m[v+0]]+Hi[255+m[v-2*j]-m[v+j]]<=L}function Wu(m,v,j,L,z){var W=m[v-3*j],G=m[v-2*j],J=m[v-j],ne=m[v+0],ae=m[v+j],fe=m[v+2*j],ke=m[v+3*j];return 4*Hi[255+J-ne]+Hi[255+G-ae]>L?0:Hi[255+m[v-4*j]-W]<=z&&Hi[255+W-G]<=z&&Hi[255+G-J]<=z&&Hi[255+ke-fe]<=z&&Hi[255+fe-ae]<=z&&Hi[255+ae-ne]<=z}function Fc(m,v,j,L){var z=2*L+1;for(L=0;16>L;++L)yl(m,v+L,j,z)&&oa(m,v+L,j)}function Hu(m,v,j,L){var z=2*L+1;for(L=0;16>L;++L)yl(m,v+L*j,1,z)&&oa(m,v+L*j,1)}function Mc(m,v,j,L){var z;for(z=3;0<z;--z)Fc(m,v+=4*j,j,L)}function _p(m,v,j,L){var z;for(z=3;0<z;--z)Hu(m,v+=4,j,L)}function bo(m,v,j,L,z,W,G,J){for(W=2*W+1;0<z--;){if(Wu(m,v,j,W,G))if(qu(m,v,j,J))oa(m,v,j);else{var ne=m,ae=v,fe=j,ke=ne[ae-2*fe],le=ne[ae-fe],pe=ne[ae+0],xe=ne[ae+fe],Ee=ne[ae+2*fe],_e=27*(Ae=Lx[1020+3*(pe-le)+Lx[1020+ke-xe]])+63>>7,Ce=18*Ae+63>>7,Ae=9*Ae+63>>7;ne[ae-3*fe]=wi[255+ne[ae-3*fe]+Ae],ne[ae-2*fe]=wi[255+ke+Ce],ne[ae-fe]=wi[255+le+_e],ne[ae+0]=wi[255+pe-_e],ne[ae+fe]=wi[255+xe-Ce],ne[ae+2*fe]=wi[255+Ee-Ae]}v+=L}}function yo(m,v,j,L,z,W,G,J){for(W=2*W+1;0<z--;){if(Wu(m,v,j,W,G))if(qu(m,v,j,J))oa(m,v,j);else{var ne=m,ae=v,fe=j,ke=ne[ae-fe],le=ne[ae+0],pe=ne[ae+fe],xe=Pp[112+(4+(Ee=3*(le-ke))>>3)],Ee=Pp[112+(Ee+3>>3)],_e=xe+1>>1;ne[ae-2*fe]=wi[255+ne[ae-2*fe]+_e],ne[ae-fe]=wi[255+ke+Ee],ne[ae+0]=wi[255+le-xe],ne[ae+fe]=wi[255+pe-_e]}v+=L}}function kp(m,v,j,L,z,W){bo(m,v,j,1,16,L,z,W)}function Np(m,v,j,L,z,W){bo(m,v,1,j,16,L,z,W)}function Sp(m,v,j,L,z,W){var G;for(G=3;0<G;--G)yo(m,v+=4*j,j,1,16,L,z,W)}function wl(m,v,j,L,z,W){var G;for(G=3;0<G;--G)yo(m,v+=4,1,j,16,L,z,W)}function jp(m,v,j,L,z,W,G,J){bo(m,v,z,1,8,W,G,J),bo(j,L,z,1,8,W,G,J)}function N(m,v,j,L,z,W,G,J){bo(m,v,1,z,8,W,G,J),bo(j,L,1,z,8,W,G,J)}function B(m,v,j,L,z,W,G,J){yo(m,v+4*z,z,1,8,W,G,J),yo(j,L+4*z,z,1,8,W,G,J)}function oe(m,v,j,L,z,W,G,J){yo(m,v+4,1,z,8,W,G,J),yo(j,L+4,1,z,8,W,G,J)}function de(){this.ba=new Pt,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new Gt,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function ge(){this.data=[],this.offset=this.kd=this.ha=this.w=0,this.na=[],this.xa=this.gb=this.Ja=this.Sa=this.P=0}function je(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function Te(){this.ua=0,this.Wa=new be,this.vb=new be,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new I,this.yc=new K}function tt(){this.xb=this.a=0,this.l=new Pc,this.ca=new Pt,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new q,this.Pb=0,this.wd=new q,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new Te,this.ab=0,this.gc=a(4,je),this.Oc=0}function Qe(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new Pc,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function kt(m,v,j,L,z,W,G){for(m=m==null?0:m[v+0],v=0;v<G;++v)z[W+v]=m+j[L+v]&255,m=z[W+v]}function Et(m,v,j,L,z,W,G){var J;if(m==null)kt(null,null,j,L,z,W,G);else for(J=0;J<G;++J)z[W+J]=m[v+J]+j[L+J]&255}function Bt(m,v,j,L,z,W,G){if(m==null)kt(null,null,j,L,z,W,G);else{var J,ne=m[v+0],ae=ne,fe=ne;for(J=0;J<G;++J)ae=fe+(ne=m[v+J])-ae,fe=j[L+J]+(-256&ae?0>ae?0:255:ae)&255,ae=ne,z[W+J]=fe}}function Jn(m,v,j,L){var z=v.width,W=v.o;if(t(m!=null&&v!=null),0>j||0>=L||j+L>W)return null;if(!m.Cc){if(m.ga==null){var G;if(m.ga=new Qe,(G=m.ga==null)||(G=v.width*v.o,t(m.Gb.length==0),m.Gb=s(G),m.Uc=0,m.Gb==null?G=0:(m.mb=m.Gb,m.nb=m.Uc,m.rc=null,G=1),G=!G),!G){G=m.ga;var J=m.Fa,ne=m.P,ae=m.qc,fe=m.mb,ke=m.nb,le=ne+1,pe=ae-1,xe=G.l;if(t(J!=null&&fe!=null&&v!=null),fa[0]=null,fa[1]=kt,fa[2]=Et,fa[3]=Bt,G.ca=fe,G.tb=ke,G.c=v.width,G.i=v.height,t(0<G.c&&0<G.i),1>=ae)v=0;else if(G.$a=3&J[ne+0],G.Z=J[ne+0]>>2&3,G.Lc=J[ne+0]>>4&3,ne=J[ne+0]>>6&3,0>G.$a||1<G.$a||4<=G.Z||1<G.Lc||ne)v=0;else if(xe.put=et,xe.ac=Rn,xe.bc=cr,xe.ma=G,xe.width=v.width,xe.height=v.height,xe.Da=v.Da,xe.v=v.v,xe.va=v.va,xe.j=v.j,xe.o=v.o,G.$a)e:{t(G.$a==1),v=xl();t:for(;;){if(v==null){v=0;break e}if(t(G!=null),G.mc=v,v.c=G.c,v.i=G.i,v.l=G.l,v.l.ma=G,v.l.width=G.c,v.l.height=G.i,v.a=0,D(v.m,J,le,pe),!Ts(G.c,G.i,1,v,null)||(v.ab==1&&v.gc[0].hc==3&&ns(v.s)?(G.ic=1,J=v.c*v.i,v.Ta=null,v.Ua=0,v.V=s(J),v.Ba=0,v.V==null?(v.a=1,v=0):v=1):(G.ic=0,v=vl(v,G.c)),!v))break t;v=1;break e}G.mc=null,v=0}else v=pe>=G.c*G.i;G=!v}if(G)return null;m.ga.Lc!=1?m.Ga=0:L=W-j}t(m.ga!=null),t(j+L<=W);e:{if(v=(J=m.ga).c,W=J.l.o,J.$a==0){if(le=m.rc,pe=m.Vc,xe=m.Fa,ne=m.P+1+j*v,ae=m.mb,fe=m.nb+j*v,t(ne<=m.P+m.qc),J.Z!=0)for(t(fa[J.Z]!=null),G=0;G<L;++G)fa[J.Z](le,pe,xe,ne,ae,fe,v),le=ae,pe=fe,fe+=v,ne+=v;else for(G=0;G<L;++G)r(ae,fe,xe,ne,v),le=ae,pe=fe,fe+=v,ne+=v;m.rc=le,m.Vc=pe}else{if(t(J.mc!=null),v=j+L,t((G=J.mc)!=null),t(v<=G.i),G.C>=v)v=1;else if(J.ic||En(),J.ic){J=G.V,le=G.Ba,pe=G.c;var Ee=G.i,_e=(xe=1,ne=G.$/pe,ae=G.$%pe,fe=G.m,ke=G.s,G.$),Ce=pe*Ee,Ae=pe*v,Me=ke.wc,Ie=_e<Ae?vr(ke,ae,ne):null;t(_e<=Ce),t(v<=Ee),t(ns(ke));t:for(;;){for(;!fe.h&&_e<Ae;){if(ae&Me||(Ie=vr(ke,ae,ne)),t(Ie!=null),ee(fe),256>(Ee=Tn(Ie.G[0],Ie.H[0],fe)))J[le+_e]=Ee,++_e,++ae>=pe&&(ae=0,++ne<=v&&!(ne%16)&&rs(G,ne));else{if(!(280>Ee)){xe=0;break t}Ee=kn(Ee-256,fe);var lt,Ye=Tn(Ie.G[4],Ie.H[4],fe);if(ee(fe),!(_e>=(Ye=Un(pe,Ye=kn(Ye,fe)))&&Ce-_e>=Ee)){xe=0;break t}for(lt=0;lt<Ee;++lt)J[le+_e+lt]=J[le+_e+lt-Ye];for(_e+=Ee,ae+=Ee;ae>=pe;)ae-=pe,++ne<=v&&!(ne%16)&&rs(G,ne);_e<Ae&&ae&Me&&(Ie=vr(ke,ae,ne))}t(fe.h==Z(fe))}rs(G,ne>v?v:ne);break t}!xe||fe.h&&_e<Ce?(xe=0,G.a=fe.h?5:3):G.$=_e,v=xe}else v=is(G,G.V,G.Ba,G.c,G.i,v,Ec);if(!v){L=0;break e}}j+L>=W&&(m.Cc=1),L=1}if(!L)return null;if(m.Cc&&((L=m.ga)!=null&&(L.mc=null),m.ga=null,0<m.Ga))return alert("todo:WebPDequantizeLevels"),null}return m.nb+j*z}function sn(m,v,j,L,z,W){for(;0<z--;){var G,J=m,ne=v+(j?1:0),ae=m,fe=v+(j?0:3);for(G=0;G<L;++G){var ke=ae[fe+4*G];ke!=255&&(ke*=32897,J[ne+4*G+0]=J[ne+4*G+0]*ke>>23,J[ne+4*G+1]=J[ne+4*G+1]*ke>>23,J[ne+4*G+2]=J[ne+4*G+2]*ke>>23)}v+=W}}function nn(m,v,j,L,z){for(;0<L--;){var W;for(W=0;W<j;++W){var G=m[v+2*W+0],J=15&(ae=m[v+2*W+1]),ne=4369*J,ae=(240&ae|ae>>4)*ne>>16;m[v+2*W+0]=(240&G|G>>4)*ne>>16&240|(15&G|G<<4)*ne>>16>>4&15,m[v+2*W+1]=240&ae|J}v+=z}}function gn(m,v,j,L,z,W,G,J){var ne,ae,fe=255;for(ae=0;ae<z;++ae){for(ne=0;ne<L;++ne){var ke=m[v+ne];W[G+4*ne]=ke,fe&=ke}v+=j,G+=J}return fe!=255}function jn(m,v,j,L,z){var W;for(W=0;W<z;++W)j[L+W]=m[v+W]>>8}function En(){Qu=sn,a5=nn,l5=gn,c5=jn}function Pr(m,v,j){T[m]=function(L,z,W,G,J,ne,ae,fe,ke,le,pe,xe,Ee,_e,Ce,Ae,Me){var Ie,lt=Me-1>>1,Ye=J[ne+0]|ae[fe+0]<<16,Lt=ke[le+0]|pe[xe+0]<<16;t(L!=null);var nt=3*Ye+Lt+131074>>2;for(v(L[z+0],255&nt,nt>>16,Ee,_e),W!=null&&(nt=3*Lt+Ye+131074>>2,v(W[G+0],255&nt,nt>>16,Ce,Ae)),Ie=1;Ie<=lt;++Ie){var It=J[ne+Ie]|ae[fe+Ie]<<16,rr=ke[le+Ie]|pe[xe+Ie]<<16,Rt=Ye+It+Lt+rr+524296,rt=Rt+2*(It+Lt)>>3;nt=rt+Ye>>1,Ye=(Rt=Rt+2*(Ye+rr)>>3)+It>>1,v(L[z+2*Ie-1],255&nt,nt>>16,Ee,_e+(2*Ie-1)*j),v(L[z+2*Ie-0],255&Ye,Ye>>16,Ee,_e+(2*Ie-0)*j),W!=null&&(nt=Rt+Lt>>1,Ye=rt+rr>>1,v(W[G+2*Ie-1],255&nt,nt>>16,Ce,Ae+(2*Ie-1)*j),v(W[G+2*Ie+0],255&Ye,Ye>>16,Ce,Ae+(2*Ie+0)*j)),Ye=It,Lt=rr}1&Me||(nt=3*Ye+Lt+131074>>2,v(L[z+Me-1],255&nt,nt>>16,Ee,_e+(Me-1)*j),W!=null&&(nt=3*Lt+Ye+131074>>2,v(W[G+Me-1],255&nt,nt>>16,Ce,Ae+(Me-1)*j)))}}function wo(){Vi[Lp]=xL,Vi[Rp]=y5,Vi[m5]=vL,Vi[Tp]=w5,Vi[Op]=_5,Vi[Rx]=k5,Vi[g5]=bL,Vi[Tx]=y5,Vi[Ox]=w5,Vi[Ip]=_5,Vi[Ix]=k5}function Vu(m){return m&~yL?0>m?0:255:m>>N5}function _l(m,v){return Vu((19077*m>>8)+(26149*v>>8)-14234)}function kl(m,v,j){return Vu((19077*m>>8)-(6419*v>>8)-(13320*j>>8)+8708)}function aa(m,v){return Vu((19077*m>>8)+(33050*v>>8)-17685)}function Nl(m,v,j,L,z){L[z+0]=_l(m,j),L[z+1]=kl(m,v,j),L[z+2]=aa(m,v)}function $c(m,v,j,L,z){L[z+0]=aa(m,v),L[z+1]=kl(m,v,j),L[z+2]=_l(m,j)}function Bc(m,v,j,L,z){var W=kl(m,v,j);v=W<<3&224|aa(m,v)>>3,L[z+0]=248&_l(m,j)|W>>5,L[z+1]=v}function Lr(m,v,j,L,z){var W=240&aa(m,v)|15;L[z+0]=240&_l(m,j)|kl(m,v,j)>>4,L[z+1]=W}function Sl(m,v,j,L,z){L[z+0]=255,Nl(m,v,j,L,z+1)}function jl(m,v,j,L,z){$c(m,v,j,L,z),L[z+3]=255}function Gu(m,v,j,L,z){Nl(m,v,j,L,z),L[z+3]=255}function Ms(m,v,j){T[m]=function(L,z,W,G,J,ne,ae,fe,ke){for(var le=fe+(-2&ke)*j;fe!=le;)v(L[z+0],W[G+0],J[ne+0],ae,fe),v(L[z+1],W[G+0],J[ne+0],ae,fe+j),z+=2,++G,++ne,fe+=2*j;1&ke&&v(L[z+0],W[G+0],J[ne+0],ae,fe)}}function Vr(m,v,j){return j==0?m==0?v==0?6:5:v==0?4:0:j}function Ep(m,v,j,L,z){switch(m>>>30){case 3:_o(v,j,L,z,0);break;case 2:ua(v,j,L,z);break;case 1:Rr(v,j,L,z)}}function Uc(m,v){var j,L,z=v.M,W=v.Nb,G=m.oc,J=m.pc+40,ne=m.oc,ae=m.pc+584,fe=m.oc,ke=m.pc+600;for(j=0;16>j;++j)G[J+32*j-1]=129;for(j=0;8>j;++j)ne[ae+32*j-1]=129,fe[ke+32*j-1]=129;for(0<z?G[J-1-32]=ne[ae-1-32]=fe[ke-1-32]=129:(i(G,J-32-1,127,21),i(ne,ae-32-1,127,9),i(fe,ke-32-1,127,9)),L=0;L<m.za;++L){var le=v.ya[v.aa+L];if(0<L){for(j=-1;16>j;++j)r(G,J+32*j-4,G,J+32*j+12,4);for(j=-1;8>j;++j)r(ne,ae+32*j-4,ne,ae+32*j+4,4),r(fe,ke+32*j-4,fe,ke+32*j+4,4)}var pe=m.Gd,xe=m.Hd+L,Ee=le.ad,_e=le.Hc;if(0<z&&(r(G,J-32,pe[xe].y,0,16),r(ne,ae-32,pe[xe].f,0,8),r(fe,ke-32,pe[xe].ea,0,8)),le.Za){var Ce=G,Ae=J-32+16;for(0<z&&(L>=m.za-1?i(Ce,Ae,pe[xe].y[15],4):r(Ce,Ae,pe[xe+1].y,0,4)),j=0;4>j;j++)Ce[Ae+128+j]=Ce[Ae+256+j]=Ce[Ae+384+j]=Ce[Ae+0+j];for(j=0;16>j;++j,_e<<=2)Ce=G,Ae=J+j5[j],os[le.Ob[j]](Ce,Ae),Ep(_e,Ee,16*+j,Ce,Ae)}else if(Ce=Vr(L,z,le.Ob[0]),ha[Ce](G,J),_e!=0)for(j=0;16>j;++j,_e<<=2)Ep(_e,Ee,16*+j,G,J+j5[j]);for(j=le.Gc,Ce=Vr(L,z,le.Dd),No[Ce](ne,ae),No[Ce](fe,ke),_e=Ee,Ce=ne,Ae=ae,255&(le=0|j)&&(170&le?Vc(_e,256,Ce,Ae):Bs(_e,256,Ce,Ae)),le=fe,_e=ke,255&(j>>=8)&&(170&j?Vc(Ee,320,le,_e):Bs(Ee,320,le,_e)),z<m.Ub-1&&(r(pe[xe].y,0,G,J+480,16),r(pe[xe].f,0,ne,ae+224,8),r(pe[xe].ea,0,fe,ke+224,8)),j=8*W*m.B,pe=m.sa,xe=m.ta+16*L+16*W*m.R,Ee=m.qa,le=m.ra+8*L+j,_e=m.Ha,Ce=m.Ia+8*L+j,j=0;16>j;++j)r(pe,xe+j*m.R,G,J+32*j,16);for(j=0;8>j;++j)r(Ee,le+j*m.B,ne,ae+32*j,8),r(_e,Ce+j*m.B,fe,ke+32*j,8)}}function Cp(m,v,j,L,z,W,G,J,ne){var ae=[0],fe=[0],ke=0,le=ne!=null?ne.kd:0,pe=ne??new ge;if(m==null||12>j)return 7;pe.data=m,pe.w=v,pe.ha=j,v=[v],j=[j],pe.gb=[pe.gb];e:{var xe=v,Ee=j,_e=pe.gb;if(t(m!=null),t(Ee!=null),t(_e!=null),_e[0]=0,12<=Ee[0]&&!n(m,xe[0],"RIFF")){if(n(m,xe[0]+8,"WEBP")){_e=3;break e}var Ce=qe(m,xe[0]+4);if(12>Ce||4294967286<Ce){_e=3;break e}if(le&&Ce>Ee[0]-8){_e=7;break e}_e[0]=Ce,xe[0]+=12,Ee[0]-=12}_e=0}if(_e!=0)return _e;for(Ce=0<pe.gb[0],j=j[0];;){e:{var Ae=m;Ee=v,_e=j;var Me=ae,Ie=fe,lt=xe=[0];if((nt=ke=[ke])[0]=0,8>_e[0])_e=7;else{if(!n(Ae,Ee[0],"VP8X")){if(qe(Ae,Ee[0]+4)!=10){_e=3;break e}if(18>_e[0]){_e=7;break e}var Ye=qe(Ae,Ee[0]+8),Lt=1+Re(Ae,Ee[0]+12);if(2147483648<=Lt*(Ae=1+Re(Ae,Ee[0]+15))){_e=3;break e}lt!=null&&(lt[0]=Ye),Me!=null&&(Me[0]=Lt),Ie!=null&&(Ie[0]=Ae),Ee[0]+=18,_e[0]-=18,nt[0]=1}_e=0}}if(ke=ke[0],xe=xe[0],_e!=0)return _e;if(Ee=!!(2&xe),!Ce&&ke)return 3;if(W!=null&&(W[0]=!!(16&xe)),G!=null&&(G[0]=Ee),J!=null&&(J[0]=0),G=ae[0],xe=fe[0],ke&&Ee&&ne==null){_e=0;break}if(4>j){_e=7;break}if(Ce&&ke||!Ce&&!ke&&!n(m,v[0],"ALPH")){j=[j],pe.na=[pe.na],pe.P=[pe.P],pe.Sa=[pe.Sa];e:{Ye=m,_e=v,Ce=j;var nt=pe.gb;Me=pe.na,Ie=pe.P,lt=pe.Sa,Lt=22,t(Ye!=null),t(Ce!=null),Ae=_e[0];var It=Ce[0];for(t(Me!=null),t(lt!=null),Me[0]=null,Ie[0]=null,lt[0]=0;;){if(_e[0]=Ae,Ce[0]=It,8>It){_e=7;break e}var rr=qe(Ye,Ae+4);if(4294967286<rr){_e=3;break e}var Rt=8+rr+1&-2;if(Lt+=Rt,0<nt&&Lt>nt){_e=3;break e}if(!n(Ye,Ae,"VP8 ")||!n(Ye,Ae,"VP8L")){_e=0;break e}if(It[0]<Rt){_e=7;break e}n(Ye,Ae,"ALPH")||(Me[0]=Ye,Ie[0]=Ae+8,lt[0]=rr),Ae+=Rt,It-=Rt}}if(j=j[0],pe.na=pe.na[0],pe.P=pe.P[0],pe.Sa=pe.Sa[0],_e!=0)break}j=[j],pe.Ja=[pe.Ja],pe.xa=[pe.xa];e:if(nt=m,_e=v,Ce=j,Me=pe.gb[0],Ie=pe.Ja,lt=pe.xa,Ye=_e[0],Ae=!n(nt,Ye,"VP8 "),Lt=!n(nt,Ye,"VP8L"),t(nt!=null),t(Ce!=null),t(Ie!=null),t(lt!=null),8>Ce[0])_e=7;else{if(Ae||Lt){if(nt=qe(nt,Ye+4),12<=Me&&nt>Me-12){_e=3;break e}if(le&&nt>Ce[0]-8){_e=7;break e}Ie[0]=nt,_e[0]+=8,Ce[0]-=8,lt[0]=Lt}else lt[0]=5<=Ce[0]&&nt[Ye+0]==47&&!(nt[Ye+4]>>5),Ie[0]=Ce[0];_e=0}if(j=j[0],pe.Ja=pe.Ja[0],pe.xa=pe.xa[0],v=v[0],_e!=0)break;if(4294967286<pe.Ja)return 3;if(J==null||Ee||(J[0]=pe.xa?2:1),G=[G],xe=[xe],pe.xa){if(5>j){_e=7;break}J=G,le=xe,Ee=W,m==null||5>j?m=0:5<=j&&m[v+0]==47&&!(m[v+4]>>5)?(Ce=[0],nt=[0],Me=[0],D(Ie=new q,m,v,j),xr(Ie,Ce,nt,Me)?(J!=null&&(J[0]=Ce[0]),le!=null&&(le[0]=nt[0]),Ee!=null&&(Ee[0]=Me[0]),m=1):m=0):m=0}else{if(10>j){_e=7;break}J=xe,m==null||10>j||!vp(m,v+3,j-3)?m=0:(le=m[v+0]|m[v+1]<<8|m[v+2]<<16,Ee=16383&(m[v+7]<<8|m[v+6]),m=16383&(m[v+9]<<8|m[v+8]),1&le||3<(le>>1&7)||!(le>>4&1)||le>>5>=pe.Ja||!Ee||!m?m=0:(G&&(G[0]=Ee),J&&(J[0]=m),m=1))}if(!m||(G=G[0],xe=xe[0],ke&&(ae[0]!=G||fe[0]!=xe)))return 3;ne!=null&&(ne[0]=pe,ne.offset=v-ne.w,t(4294967286>v-ne.w),t(ne.offset==ne.ha-j));break}return _e==0||_e==7&&ke&&ne==null?(W!=null&&(W[0]|=pe.na!=null&&0<pe.na.length),L!=null&&(L[0]=G),z!=null&&(z[0]=xe),0):_e}function Wi(m,v,j){var L=v.width,z=v.height,W=0,G=0,J=L,ne=z;if(v.Da=m!=null&&0<m.Da,v.Da&&(J=m.cd,ne=m.bd,W=m.v,G=m.j,11>j||(W&=-2,G&=-2),0>W||0>G||0>=J||0>=ne||W+J>L||G+ne>z))return 0;if(v.v=W,v.j=G,v.va=W+J,v.o=G+ne,v.U=J,v.T=ne,v.da=m!=null&&0<m.da,v.da){if(!se(J,ne,j=[m.ib],W=[m.hb]))return 0;v.ib=j[0],v.hb=W[0]}return v.ob=m!=null&&m.ob,v.Kb=m==null||!m.Sd,v.da&&(v.ob=v.ib<3*L/4&&v.hb<3*z/4,v.Kb=0),1}function El(m){if(m==null)return 2;if(11>m.S){var v=m.f.RGBA;v.fb+=(m.height-1)*v.A,v.A=-v.A}else v=m.f.kb,m=m.height,v.O+=(m-1)*v.fa,v.fa=-v.fa,v.N+=(m-1>>1)*v.Ab,v.Ab=-v.Ab,v.W+=(m-1>>1)*v.Db,v.Db=-v.Db,v.F!=null&&(v.J+=(m-1)*v.lb,v.lb=-v.lb);return 0}function Yu(m,v,j,L){if(L==null||0>=m||0>=v)return 2;if(j!=null){if(j.Da){var z=j.cd,W=j.bd,G=-2&j.v,J=-2&j.j;if(0>G||0>J||0>=z||0>=W||G+z>m||J+W>v)return 2;m=z,v=W}if(j.da){if(!se(m,v,z=[j.ib],W=[j.hb]))return 2;m=z[0],v=W[0]}}L.width=m,L.height=v;e:{var ne=L.width,ae=L.height;if(m=L.S,0>=ne||0>=ae||!(m>=Lp&&13>m))m=2;else{if(0>=L.Rd&&L.sd==null){G=W=z=v=0;var fe=(J=ne*E5[m])*ae;if(11>m||(W=(ae+1)/2*(v=(ne+1)/2),m==12&&(G=(z=ne)*ae)),(ae=s(fe+2*W+G))==null){m=1;break e}L.sd=ae,11>m?((ne=L.f.RGBA).eb=ae,ne.fb=0,ne.A=J,ne.size=fe):((ne=L.f.kb).y=ae,ne.O=0,ne.fa=J,ne.Fd=fe,ne.f=ae,ne.N=0+fe,ne.Ab=v,ne.Cd=W,ne.ea=ae,ne.W=0+fe+W,ne.Db=v,ne.Ed=W,m==12&&(ne.F=ae,ne.J=0+fe+2*W),ne.Tc=G,ne.lb=z)}if(v=1,z=L.S,W=L.width,G=L.height,z>=Lp&&13>z)if(11>z)m=L.f.RGBA,v&=(J=Math.abs(m.A))*(G-1)+W<=m.size,v&=J>=W*E5[z],v&=m.eb!=null;else{m=L.f.kb,J=(W+1)/2,fe=(G+1)/2,ne=Math.abs(m.fa),ae=Math.abs(m.Ab);var ke=Math.abs(m.Db),le=Math.abs(m.lb),pe=le*(G-1)+W;v&=ne*(G-1)+W<=m.Fd,v&=ae*(fe-1)+J<=m.Cd,v=(v&=ke*(fe-1)+J<=m.Ed)&ne>=W&ae>=J&ke>=J,v&=m.y!=null,v&=m.f!=null,v&=m.ea!=null,z==12&&(v&=le>=W,v&=pe<=m.Tc,v&=m.F!=null)}else v=0;m=v?0:2}}return m!=0||j!=null&&j.fd&&(m=El(L)),m}var zc=64,Cl=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215],Ku=24,Gr=32,si=8,qc=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];ve("Predictor0","PredictorAdd0"),T.Predictor0=function(){return 4278190080},T.Predictor1=function(m){return m},T.Predictor2=function(m,v,j){return v[j+0]},T.Predictor3=function(m,v,j){return v[j+1]},T.Predictor4=function(m,v,j){return v[j-1]},T.Predictor5=function(m,v,j){return Le(Le(m,v[j+1]),v[j+0])},T.Predictor6=function(m,v,j){return Le(m,v[j-1])},T.Predictor7=function(m,v,j){return Le(m,v[j+0])},T.Predictor8=function(m,v,j){return Le(v[j-1],v[j+0])},T.Predictor9=function(m,v,j){return Le(v[j+0],v[j+1])},T.Predictor10=function(m,v,j){return Le(Le(m,v[j-1]),Le(v[j+0],v[j+1]))},T.Predictor11=function(m,v,j){var L=v[j+0];return 0>=He(L>>24&255,m>>24&255,(v=v[j-1])>>24&255)+He(L>>16&255,m>>16&255,v>>16&255)+He(L>>8&255,m>>8&255,v>>8&255)+He(255&L,255&m,255&v)?L:m},T.Predictor12=function(m,v,j){var L=v[j+0];return(Fe((m>>24&255)+(L>>24&255)-((v=v[j-1])>>24&255))<<24|Fe((m>>16&255)+(L>>16&255)-(v>>16&255))<<16|Fe((m>>8&255)+(L>>8&255)-(v>>8&255))<<8|Fe((255&m)+(255&L)-(255&v)))>>>0},T.Predictor13=function(m,v,j){var L=v[j-1];return(Ve((m=Le(m,v[j+0]))>>24&255,L>>24&255)<<24|Ve(m>>16&255,L>>16&255)<<16|Ve(m>>8&255,L>>8&255)<<8|Ve(255&m,255&L))>>>0};var la=T.PredictorAdd0;T.PredictorAdd1=Ze,ve("Predictor2","PredictorAdd2"),ve("Predictor3","PredictorAdd3"),ve("Predictor4","PredictorAdd4"),ve("Predictor5","PredictorAdd5"),ve("Predictor6","PredictorAdd6"),ve("Predictor7","PredictorAdd7"),ve("Predictor8","PredictorAdd8"),ve("Predictor9","PredictorAdd9"),ve("Predictor10","PredictorAdd10"),ve("Predictor11","PredictorAdd11"),ve("Predictor12","PredictorAdd12"),ve("Predictor13","PredictorAdd13");var ca=T.PredictorAdd2;ze("ColorIndexInverseTransform","MapARGB","32b",function(m){return m>>8&255},function(m){return m}),ze("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",function(m){return m},function(m){return m>>8&255});var Wc,Al=T.ColorIndexInverseTransform,Xn=T.MapARGB,Px=T.VP8LColorIndexInverseTransformAlpha,$s=T.MapAlpha,ss=T.VP8LPredictorsAdd=[];ss.length=16,(T.VP8LPredictors=[]).length=16,(T.VP8LPredictorsAdd_C=[]).length=16,(T.VP8LPredictors_C=[]).length=16;var Pl,Ju,Xu,Hc,Ll,Rl,da,_o,ua,Vc,Rr,Bs,cn,dn,zn,nr,ko,Zu,Gc,Ap,r5,i5,s5,o5,Qu,a5,l5,c5,d5=s(511),u5=s(2041
vendor: 4,704 bytes, line 533
533),h5=s(225),f5=s(767),p5=0,Lx=u5,Pp=h5,wi=f5,Hi=d5,Lp=0,Rp=1,m5=2,Tp=3,Op=4,Rx=5,g5=6,Tx=7,Ox=8,Ip=9,Ix=10,rL=[2,3,7],iL=[3,3,11],x5=[280,256,256,256,40],sL=[0,1,1,1,0],oL=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],aL=[24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112],lL=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],cL=8,Dx=[4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157],Fx=[4,5,6,7,8,9,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,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284],eh=null,dL=[[173,148,140,0],[176,155,140,135,0],[180,157,141,134,130,0],[254,254,243,230,196,177,153,140,133,130,129,0]],uL=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],v5=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],hL=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,25
5335,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],fL=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,
5331,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],pL=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,25
vendor: 26,976 bytes, lines 533-557
5335,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],mL=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],ha=[],os=[],No=[],gL=1,b5=2,fa=[],Vi=[];Pr("UpsampleRgbLinePair",Nl,3),Pr("UpsampleBgrLinePair",$c,3),Pr("UpsampleRgbaLinePair",Gu,4),Pr("UpsampleBgraLinePair",jl,4),Pr("UpsampleArgbLinePair",Sl,4),Pr("UpsampleRgba4444LinePair",Lr,2),Pr("UpsampleRgb565LinePair",Bc,2);var xL=T.UpsampleRgbLinePair,vL=T.UpsampleBgrLinePair,y5=T.UpsampleRgbaLinePair,w5=T.UpsampleBgraLinePair,_5=T.UpsampleArgbLinePair,k5=T.UpsampleRgba4444LinePair,bL=T.UpsampleRgb565LinePair,Dp=16,Fp=1<<Dp-1,th=-227,Mx=482,N5=6,yL=(256<<N5)-1,S5=0,wL=s(256),_L=s(256),kL=s(256),NL=s(256),SL=s(Mx-th),jL=s(Mx-th);Ms("YuvToRgbRow",Nl,3),Ms("YuvToBgrRow",$c,3),Ms("YuvToRgbaRow",Gu,4),Ms("YuvToBgraRow",jl,4),Ms("YuvToArgbRow",Sl,4),Ms("YuvToRgba4444Row",Lr,2),Ms("YuvToRgb565Row",Bc,2);var j5=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Mp=[0,2,8],EL=[8,7,6,4,4,2,2,2,1,1,1,1],CL=1;this.WebPDecodeRGBA=function(m,v,j,L,z){var W=Rp,G=new de,J=new Pt;G.ba=J,J.S=W,J.width=[J.width],J.height=[J.height];var ne=J.width,ae=J.height,fe=new st;if(fe==null||m==null)var ke=2;else t(fe!=null),ke=Cp(m,v,j,fe.width,fe.height,fe.Pd,fe.Qd,fe.format,null);if(ke!=0?ne=0:(ne!=null&&(ne[0]=fe.width[0]),ae!=null&&(ae[0]=fe.height[0]),ne=1),ne){J.width=J.width[0],J.height=J.height[0],L!=null&&(L[0]=J.width),z!=null&&(z[0]=J.height);e:{if(L=new Pc,(z=new ge).data=m,z.w=v,z.ha=j,z.kd=1,v=[0],t(z!=null),((m=Cp(z.data,z.w,z.ha,null,null,null,v,null,z))==0||m==7)&&v[0]&&(m=4),(v=m)==0){if(t(G!=null),L.data=z.data,L.w=z.w+z.offset,L.ha=z.ha-z.offset,L.put=et,L.ac=Rn,L.bc=cr,L.ma=G,z.xa){if((m=xl())==null){G=1;break e}if(function(le,pe){var xe=[0],Ee=[0],_e=[0];t:for(;;){if(le==null)return 0;if(pe==null)return le.a=2,0;if(le.l=pe,le.a=0,D(le.m,pe.data,pe.w,pe.ha),!xr(le.m,xe,Ee,_e)){le.a=3;break t}if(le.xb=b5,pe.width=xe[0],pe.height=Ee[0],!Ts(xe[0],Ee[0],1,le,null))break t;return 1}return t(le.a!=0),0}(m,L)){if(L=(v=Yu(L.width,L.height,G.Oa,G.ba))==0){t:{L=m;n:for(;;){if(L==null){L=0;break t}if(t(L.s.yc!=null),t(L.s.Ya!=null),t(0<L.s.Wb),t((j=L.l)!=null),t((z=j.ma)!=null),L.xb!=0){if(L.ca=z.ba,L.tb=z.tb,t(L.ca!=null),!Wi(z.Oa,j,Tp)){L.a=2;break n}if(!vl(L,j.width)||j.da)break n;if((j.da||ht(L.ca.S))&&En(),11>L.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),L.ca.f.kb.F!=null&&En()),L.Pb&&0<L.s.ua&&L.s.vb.X==null&&!te(L.s.vb,L.s.Wa.Xa)){L.a=1;break n}L.xb=0}if(!is(L,L.V,L.Ba,L.c,L.i,j.o,ra))break n;z.Dc=L.Ma,L=1;break t}t(L.a!=0),L=0}L=!L}L&&(v=m.a)}else v=m.a}else{if((m=new fx)==null){G=1;break e}if(m.Fa=z.na,m.P=z.P,m.qc=z.Sa,Is(m,L)){if((v=Yu(L.width,L.height,G.Oa,G.ba))==0){if(m.Aa=0,j=G.Oa,t((z=m)!=null),j!=null){if(0<(ne=0>(ne=j.Md)?0:100<ne?255:255*ne/100)){for(ae=fe=0;4>ae;++ae)12>(ke=z.pb[ae]).lc&&(ke.ia=ne*EL[0>ke.lc?0:ke.lc]>>3),fe|=ke.ia;fe&&(alert("todo:VP8InitRandom"),z.ia=1)}z.Ga=j.Id,100<z.Ga?z.Ga=100:0>z.Ga&&(z.Ga=0)}(function(le,pe){if(le==null)return 0;if(pe==null)return Kn(le,2,"NULL VP8Io parameter in VP8Decode().");if(!le.cb&&!Is(le,pe))return 0;if(t(le.cb),pe.ac==null||pe.ac(pe)){pe.ob&&(le.L=0);var xe=Mp[le.L];if(le.L==2?(le.yb=0,le.zb=0):(le.yb=pe.v-xe>>4,le.zb=pe.j-xe>>4,0>le.yb&&(le.yb=0),0>le.zb&&(le.zb=0)),le.Va=pe.o+15+xe>>4,le.Hb=pe.va+15+xe>>4,le.Hb>le.za&&(le.Hb=le.za),le.Va>le.Ub&&(le.Va=le.Ub),0<le.L){var Ee=le.ed;for(xe=0;4>xe;++xe){var _e;if(le.Qa.Cb){var Ce=le.Qa.Lb[xe];le.Qa.Fb||(Ce+=Ee.Tb)}else Ce=Ee.Tb;for(_e=0;1>=_e;++_e){var Ae=le.gd[xe][_e],Me=Ce;if(Ee.Pc&&(Me+=Ee.vd[0],_e&&(Me+=Ee.od[0])),0<(Me=0>Me?0:63<Me?63:Me)){var Ie=Me;0<Ee.wb&&(Ie=4<Ee.wb?Ie>>2:Ie>>1)>9-Ee.wb&&(Ie=9-Ee.wb),1>Ie&&(Ie=1),Ae.dd=Ie,Ae.tc=2*Me+Ie,Ae.ld=40<=Me?2:15<=Me?1:0}else Ae.tc=0;Ae.La=_e}}}xe=0}else Kn(le,6,"Frame setup failed"),xe=le.a;if(xe=xe==0){if(xe){le.$c=0,0<le.Aa||(le.Ic=CL);t:{xe=le.Ic,Ee=4*(Ie=le.za);var lt=32*Ie,Ye=Ie+1,Lt=0<le.L?Ie*(0<le.Aa?2:1):0,nt=(le.Aa==2?2:1)*Ie;if((Ae=Ee+832+(_e=3*(16*xe+Mp[le.L])/2*lt)+(Ce=le.Fa!=null&&0<le.Fa.length?le.Kc.c*le.Kc.i:0))!=Ae)xe=0;else{if(Ae>le.Vb){if(le.Vb=0,le.Ec=s(Ae),le.Fc=0,le.Ec==null){xe=Kn(le,1,"no memory during frame initialization.");break t}le.Vb=Ae}Ae=le.Ec,Me=le.Fc,le.Ac=Ae,le.Bc=Me,Me+=Ee,le.Gd=a(lt,gp),le.Hd=0,le.rb=a(Ye+1,Fu),le.sb=1,le.wa=Lt?a(Lt,qi):null,le.Y=0,le.D.Nb=0,le.D.wa=le.wa,le.D.Y=le.Y,0<le.Aa&&(le.D.Y+=Ie),t(!0),le.oc=Ae,le.pc=Me,Me+=832,le.ya=a(nt,Mu),le.aa=0,le.D.ya=le.ya,le.D.aa=le.aa,le.Aa==2&&(le.D.aa+=Ie),le.R=16*Ie,le.B=8*Ie,Ie=(lt=Mp[le.L])*le.R,lt=lt/2*le.B,le.sa=Ae,le.ta=Me+Ie,le.qa=le.sa,le.ra=le.ta+16*xe*le.R+lt,le.Ha=le.qa,le.Ia=le.ra+8*xe*le.B+lt,le.$c=0,Me+=_e,le.mb=Ce?Ae:null,le.nb=Ce?Me:null,t(Me+Ce<=le.Fc+le.Vb),$u(le),i(le.Ac,le.Bc,0,Ee),xe=1}}if(xe){if(pe.ka=0,pe.y=le.sa,pe.O=le.ta,pe.f=le.qa,pe.N=le.ra,pe.ea=le.Ha,pe.Vd=le.Ia,pe.fa=le.R,pe.Rc=le.B,pe.F=null,pe.J=0,!p5){for(xe=-255;255>=xe;++xe)d5[255+xe]=0>xe?-xe:xe;for(xe=-1020;1020>=xe;++xe)u5[1020+xe]=-128>xe?-128:127<xe?127:xe;for(xe=-112;112>=xe;++xe)h5[112+xe]=-16>xe?-16:15<xe?15:xe;for(xe=-255;510>=xe;++xe)f5[255+xe]=0>xe?0:255<xe?255:xe;p5=1}da=yp,_o=px,Vc=mx,Rr=gx,Bs=Ds,ua=bp,cn=kp,dn=Np,zn=jp,nr=N,ko=Sp,Zu=wl,Gc=B,Ap=oe,r5=Fc,i5=Hu,s5=Mc,o5=_p,os[0]=kx,os[1]=Oc,os[2]=wx,os[3]=_x,os[4]=Nx,os[5]=xo,os[6]=Sx,os[7]=vo,os[8]=Ex,os[9]=jx,ha[0]=wp,ha[1]=xx,ha[2]=vx,ha[3]=bx,ha[4]=sa,ha[5]=yx,ha[6]=bl,No[0]=Cx,No[1]=Bu,No[2]=Ic,No[3]=Uu,No[4]=Ax,No[5]=Dc,No[6]=zu,xe=1}else xe=0}xe&&(xe=function(It,rr){for(It.M=0;It.M<It.Va;++It.M){var Rt,rt=It.Jc[It.M&It.Xb],We=It.m,qn=It;for(Rt=0;Rt<qn.za;++Rt){var Ct=We,Ut=qn,xn=Ut.Ac,yr=Ut.Bc+4*Rt,Yr=Ut.zc,On=Ut.ya[Ut.aa+Rt];if(Ut.Qa.Bb?On.$b=ye(Ct,Ut.Pa.jb[0])?2+ye(Ct,Ut.Pa.jb[2]):ye(Ct,Ut.Pa.jb[1]):On.$b=0,Ut.kc&&(On.Ad=ye(Ct,Ut.Bd)),On.Za=!ye(Ct,145)+0,On.Za){var Tr=On.Ob,Kr=0;for(Ut=0;4>Ut;++Ut){var ir,Wt=Yr[0+Ut];for(ir=0;4>ir;++ir){Wt=fL[xn[yr+ir]][Wt];for(var Jt=v5[ye(Ct,Wt[0])];0<Jt;)Jt=v5[2*Jt+ye(Ct,Wt[Jt])];Wt=-Jt,xn[yr+ir]=Wt}r(Tr,Kr,xn,yr,4),Kr+=4,Yr[0+Ut]=Wt}}else Wt=ye(Ct,156)?ye(Ct,128)?1:3:ye(Ct,163)?2:0,On.Ob[0]=Wt,i(xn,yr,Wt,4),i(Yr,0,Wt,4);On.Dd=ye(Ct,142)?ye(Ct,114)?ye(Ct,183)?1:3:2:0}if(qn.m.Ka)return Kn(It,7,"Premature end-of-partition0 encountered.");for(;It.ja<It.za;++It.ja){if(qn=rt,Ct=(We=It).rb[We.sb-1],xn=We.rb[We.sb+We.ja],Rt=We.ya[We.aa+We.ja],yr=We.kc?Rt.Ad:0)Ct.la=xn.la=0,Rt.Za||(Ct.Na=xn.Na=0),Rt.Hc=0,Rt.Gc=0,Rt.ia=0;else{var In,Xt;if(Ct=xn,xn=qn,yr=We.Pa.Xc,Yr=We.ya[We.aa+We.ja],On=We.pb[Yr.$b],Ut=Yr.ad,Tr=0,Kr=We.rb[We.sb-1],Wt=ir=0,i(Ut,Tr,0,384),Yr.Za)var wr=0,as=yr[3];else{Jt=s(16);var Wn=Ct.Na+Kr.Na;if(Wn=eh(xn,yr[1],Wn,On.Eb,0,Jt,0),Ct.Na=Kr.Na=(0<Wn)+0,1<Wn)da(Jt,0,Ut,Tr);else{var oi=Jt[0]+3>>3;for(Jt=0;256>Jt;Jt+=16)Ut[Tr+Jt]=oi}wr=1,as=yr[0]}var on=15&Ct.la,sr=15&Kr.la;for(Jt=0;4>Jt;++Jt){var _i=1&sr;for(oi=Xt=0;4>oi;++oi)on=on>>1|(_i=(Wn=eh(xn,as,Wn=_i+(1&on),On.Sc,wr,Ut,Tr))>wr)<<7,Xt=Xt<<2|(3<Wn?3:1<Wn?2:Ut[Tr+0]!=0),Tr+=16;on>>=4,sr=sr>>1|_i<<7,ir=(ir<<8|Xt)>>>0}for(as=on,wr=sr>>4,In=0;4>In;In+=2){for(Xt=0,on=Ct.la>>4+In,sr=Kr.la>>4+In,Jt=0;2>Jt;++Jt){for(_i=1&sr,oi=0;2>oi;++oi)Wn=_i+(1&on),on=on>>1|(_i=0<(Wn=eh(xn,yr[2],Wn,On.Qc,0,Ut,Tr)))<<3,Xt=Xt<<2|(3<Wn?3:1<Wn?2:Ut[Tr+0]!=0),Tr+=16;on>>=2,sr=sr>>1|_i<<5}Wt|=Xt<<4*In,as|=on<<4<<In,wr|=(240&sr)<<In}Ct.la=as,Kr.la=wr,Yr.Hc=ir,Yr.Gc=Wt,Yr.ia=43690&Wt?0:On.ia,yr=!(ir|Wt)}if(0<We.L&&(We.wa[We.Y+We.ja]=We.gd[Rt.$b][Rt.Za],We.wa[We.Y+We.ja].La|=!yr),qn.Ka)return Kn(It,7,"Premature end-of-file encountered.")}if($u(It),We=rr,qn=1,Rt=(rt=It).D,Ct=0<rt.L&&rt.M>=rt.zb&&rt.M<=rt.Va,rt.Aa==0)t:{if(Rt.M=rt.M,Rt.uc=Ct,Uc(rt,Rt),qn=1,Rt=(Xt=rt.D).Nb,Ct=(Wt=Mp[rt.L])*rt.R,xn=Wt/2*rt.B,Jt=16*Rt*rt.R,oi=8*Rt*rt.B,yr=rt.sa,Yr=rt.ta-Ct+Jt,On=rt.qa,Ut=rt.ra-xn+oi,Tr=rt.Ha,Kr=rt.Ia-xn+oi,sr=(on=Xt.M)==0,ir=on>=rt.Va-1,rt.Aa==2&&Uc(rt,Xt),Xt.uc)for(_i=(Wn=rt).D.M,t(Wn.D.uc),Xt=Wn.yb;Xt<Wn.Hb;++Xt){wr=Xt,as=_i;var Jr=(ki=(_r=Wn).D).Nb;In=_r.R;var ki=ki.wa[ki.Y+wr],Ni=_r.sa,ai=_r.ta+16*Jr*In+16*wr,Si=ki.dd,un=ki.tc;if(un!=0)if(t(3<=un),_r.L==1)0<wr&&i5(Ni,ai,In,un+4),ki.La&&o5(Ni,ai,In,un),0<as&&r5(Ni,ai,In,un+4),ki.La&&s5(Ni,ai,In,un);else{var ji=_r.B,ls=_r.qa,Tl=_r.ra+8*Jr*ji+8*wr,So=_r.Ha,_r=_r.Ia+8*Jr*ji+8*wr;Jr=ki.ld,0<wr&&(dn(Ni,ai,In,un+4,Si,Jr),nr(ls,Tl,So,_r,ji,un+4,Si,Jr)),ki.La&&(Zu(Ni,ai,In,un,Si,Jr),Ap(ls,Tl,So,_r,ji,un,Si,Jr)),0<as&&(cn(Ni,ai,In,un+4,Si,Jr),zn(ls,Tl,So,_r,ji,un+4,Si,Jr)),ki.La&&(ko(Ni,ai,In,un,Si,Jr),Gc(ls,Tl,So,_r,ji,un,Si,Jr))}}if(rt.ia&&alert("todo:DitherRow"),We.put!=null){if(Xt=16*on,on=16*(on+1),sr?(We.y=rt.sa,We.O=rt.ta+Jt,We.f=rt.qa,We.N=rt.ra+oi,We.ea=rt.Ha,We.W=rt.Ia+oi):(Xt-=Wt,We.y=yr,We.O=Yr,We.f=On,We.N=Ut,We.ea=Tr,We.W=Kr),ir||(on-=Wt),on>We.o&&(on=We.o),We.F=null,We.J=null,rt.Fa!=null&&0<rt.Fa.length&&Xt<on&&(We.J=Jn(rt,We,Xt,on-Xt),We.F=rt.mb,We.F==null&&We.F.length==0)){qn=Kn(rt,3,"Could not decode alpha data.");break t}Xt<We.j&&(Wt=We.j-Xt,Xt=We.j,t(!(1&Wt)),We.O+=rt.R*Wt,We.N+=rt.B*(Wt>>1),We.W+=rt.B*(Wt>>1),We.F!=null&&(We.J+=We.width*Wt)),Xt<on&&(We.O+=We.v,We.N+=We.v>>1,We.W+=We.v>>1,We.F!=null&&(We.J+=We.v),We.ka=Xt-We.j,We.U=We.va-We.v,We.T=on-Xt,qn=We.put(We))}Rt+1!=rt.Ic||ir||(r(rt.sa,rt.ta-Ct,yr,Yr+16*rt.R,Ct),r(rt.qa,rt.ra-xn,On,Ut+8*rt.B,xn),r(rt.Ha,rt.Ia-xn,Tr,Kr+8*rt.B,xn))}if(!qn)return Kn(It,6,"Output aborted.")}return 1}(le,pe)),pe.bc!=null&&pe.bc(pe),xe&=1}return xe?(le.cb=0,xe):0})(m,L)||(v=m.a)}}else v=m.a}v==0&&G.Oa!=null&&G.Oa.fd&&(v=El(G.ba))}G=v}W=G!=0?null:11>W?J.f.RGBA.eb:J.f.kb.y}else W=null;return W};var E5=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function d(T,H){for(var A="",O=0;O<4;O++)A+=String.fromCharCode(T[H++]);return A}function u(T,H){return T[H+0]|T[H+1]<<8}function f(T,H){return(T[H+0]|T[H+1]<<8|T[H+2]<<16)>>>0}function p(T,H){return(T[H+0]|T[H+1]<<8|T[H+2]<<16|T[H+3]<<24)>>>0}new c;var h=[0],x=[0],g=[],b=new c,y=e,_=function(T,H){var A={},O=0,K=!1,U=0,I=0;if(A.frames=[],!function(E,q){for(var F=0;F<4;F++)if(E[q+F]!="RIFF".charCodeAt(F))return!0;return!1}(T,H)){for(p(T,H+=4),H+=8;H<T.length;){var re=d(T,H),V=p(T,H+=4);H+=4;var $=V+(1&V);switch(re){case"VP8 ":case"VP8L":A.frames[O]===void 0&&(A.frames[O]={}),(X=A.frames[O]).src_off=K?I:H-8,X.src_size=U+V+8,O++,K&&(K=!1,U=0,I=0);break;case"VP8X":(X=A.header={}).feature_flags=T[H];var D=H+4;X.canvas_width=1+f(T,D),D+=3,X.canvas_height=1+f(T,D),D+=3;break;case"ALPH":K=!0,U=$+8,I=H-8;break;case"ANIM":(X=A.header).bgcolor=p(T,H),D=H+4,X.loop_count=u(T,D),D+=2;break;case"ANMF":var ie,X;(X=A.frames[O]={}).offset_x=2*f(T,H),H+=3,X.offset_y=2*f(T,H),H+=3,X.width=1+f(T,H),H+=3,X.height=1+f(T,H),H+=3,X.duration=f(T,H),H+=3,ie=T[H++],X.dispose=1&ie,X.blend=ie>>1&1}re!="ANMF"&&(H+=$)}return A}}(y,0);_.response=y,_.rgbaoutput=!0,_.dataurl=!1;var w=_.header?_.header:null,S=_.frames?_.frames:null;if(w){w.loop_counter=w.loop_count,h=[w.canvas_height],x=[w.canvas_width];for(var C=0;C<S.length&&S[C].blend!=0;C++);}var P=S[0],R=b.WebPDecodeRGBA(y,P.src_off,P.src_size,x,h);P.rgba=R,P.imgwidth=x[0],P.imgheight=h[0];for(var M=0;M<x[0]*h[0]*4;M++)g[M]=R[M];return this.width=x,this.height=h,this.data=g,this}/** ====================================================================
534 * @license
535 * jsPDF XMP metadata plugin
536 * Copyright (c) 2016 Jussi Utunen, [email protected]
537 *
538 * Permission is hereby granted, free of charge, to any person obtaining
539 * a copy of this software and associated documentation files (the
540 * "Software"), to deal in the Software without restriction, including
541 * without limitation the rights to use, copy, modify, merge, publish,
542 * distribute, sublicense, and/or sell copies of the Software, and to
543 * permit persons to whom the Software is furnished to do so, subject to
544 * the following conditions:
545 *
546 * The above copyright notice and this permission notice shall be
547 * included in all copies or substantial portions of the Software.
548 *
549 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
550 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
551 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
552 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
553 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
554 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
555 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
556 * ====================================================================
557 */function _V(){var e,t=this.internal.__metadata__.metadata,n=unescape(encodeURIComponent(t));e=this.internal.__metadata__.rawXml?n:'<x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:jspdf="'+this.internal.__metadata__.namespaceUri+'"><jspdf:metadata>'+n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")+"</jspdf:metadata></rdf:Description></rdf:RDF></x:xmpmeta>",this.internal.__metadata__.metadataObjectNumber=this.internal.newObject(),this.internal.write("<< /Type /Metadata /Subtype /XML /Length "+e.length+" >>"),this.internal.write("stream"),this.internal.write(e),this.internal.write("endstream"),this.internal.write("endobj")}function kV(){this.internal.__metadata__.metadataObjectNumber&&this.internal.write("/Metadata "+this.internal.__metadata__.metadataObjectNumber+" 0 R")}(function(e){var t,n,r,i,s,a,l,c,d,u=function(E){return E=E||{},this.isStrokeTransparent=E.isStrokeTransparent||!1,this.strokeOpacity=E.strokeOpacity||1,this.strokeStyle=E.strokeStyle||"#000000",this.fillStyle=E.fillStyle||"#000000",this.isFillTransparent=E.isFillTransparent||!1,this.fillOpacity=E.fillOpacity||1,this.font=E.font||"10px sans-serif",this.textBaseline=E.textBaseline||"alphabetic",this.textAlign=E.textAlign||"left",this.lineWidth=E.lineWidth||1,this.lineJoin=E.lineJoin||"miter",this.lineCap=E.lineCap||"butt",this.path=E.path||[],this.transform=E.transform!==void 0?E.transform.clone():new c,this.globalCompositeOperation=E.globalCompositeOperation||"normal",this.globalAlpha=E.globalAlpha||1,this.clip_path=E.clip_path||[],this.currentPoint=E.currentPoint||new a,this.miterLimit=E.miterLimit||10,this.lastPoint=E.lastPoint||new a,this.lineDashOffset=E.lineDashOffset||0,this.lineDash=E.lineDash||[],this.margin=E.margin||[0,0,0,0],this.prevPageLastElemOffset=E.prevPageLastElemOffset||0,this.ignoreClearRect=typeof E.ignoreClearRect!="boolean"||E.ignoreClearRect,this};e.events.push(["initialized",function(){this.context2d=new f(this),t=this.internal.f2,n=this.internal.getCoordinateString,r=this.internal.getVerticalCoordinateString,i=this.internal.getHorizontalCoordinate,s=this.internal.getVerticalCoordinate,a=this.internal.Point,l=this.internal.Rectangle,c=this.internal.Matrix,d=new u}]);var f=function(E){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var q=E;Object.defineProperty(this,"pdf",{get:function(){return q}});var F=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return F},set:function(te){F=!!te}});var Z=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return Z},set:function(te){Z=!!te}});var Y=0;Object.defineProperty(this,"posX",{get:function(){return Y},set:function(te){isNaN(te)||(Y=te)}});var ee=0;Object.defineProperty(this,"posY",{get:function(){return ee},set:function(te){isNaN(te)||(ee=te)}}),Object.defineProperty(this,"margin",{get:function(){return d.margin},set:function(te){var Oe;typeof te=="number"?Oe=[te,te,te,te]:((Oe=new Array(4))[0]=te[0],Oe[1]=te.length>=2?te[1]:Oe[0],Oe[2]=te.length>=3?te[2]:Oe[0],Oe[3]=te.length>=4?te[3]:Oe[1]),d.margin=Oe}});var ce=!1;Object.defineProperty(this,"autoPaging",{get:function(){return ce},set:function(te){ce=te}});var ue=0;Object.defineProperty(this,"lastBreak",{get:function(){return ue},set:function(te){ue=te}});var ye=[];Object.defineProperty(this,"pageBreaks",{get:function(){return ye},set:function(te){ye=te}}),Object.defineProperty(this,"ctx",{get:function(){return d},set:function(te){te instanceof u&&(d=te)}}),Object.defineProperty(this,"path",{get:function(){return d.path},set:function(te){d.path=te}});var Se=[];Object.defineProperty(this,"ctxStack",{get:function(){return Se},set:function(te){Se=te}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(te){var Oe;Oe=p(te),this.ctx.fillStyle=Oe.style,this.ctx.isFillTransparent=Oe.a===0,this.ctx.fillOpacity=Oe.a,this.pdf.setFillColor(Oe.r,Oe.g,Oe.b,{a:Oe.a}),this.pdf.setTextColor(Oe.r,Oe.g,Oe.b,{a:Oe.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(te){var Oe=p(te);this.ctx.strokeStyle=Oe.style,this.ctx.isStrokeTransparent=Oe.a===0,this.ctx.strokeOpacity=Oe.a,Oe.a===0?this.pdf.setDrawColor(255,255,255):(Oe.a,this.pdf.setDrawColor(Oe.r,Oe.g,Oe.b))}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(te){["butt","round","square"].indexOf(te)!==-1&&(this.ctx.lineCap=te,this.pdf.setLineCap(te))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(te){isNaN(te)||(this.ctx.lineWidth=te,this.pdf.setLineWidth(te))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(te){["bevel","round","miter"].indexOf(te)!==-1&&(this.ctx.lineJoin=te,this.pdf.setLineJoin(te))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(te){isNaN(te)||(this.ctx.miterLimit=te,this.pdf.setMiterLimit(te))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(te){this.ctx.textBaseline=te}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(te){["right","end","center","left","start"].indexOf(te)!==-1&&(this.ctx.textAlign=te)}});var De=null,Re=null,qe=null;Object.defineProperty(this,"fontFaces",{get:function(){return qe},set:function(te){De=null,Re=null,qe=te}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(te){var Oe;if(this.ctx.font=te,(Oe=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-_,\"\'\sa-z0-9]+?)\s*$/i.exec(te))!==null){var be=Oe[1];Oe[2];var se=Oe[3],Q=Oe[4];Oe[5];var he=Oe[6],ve=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(Q)[2];Q=Math.floor(ve==="px"?parseFloat(Q)*this.pdf.internal.scaleFactor:ve==="em"?parseFloat(Q)*this.pdf.getFontSize():parseFloat(Q)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(Q);var we=function(ze){var zt,yt,mt=[],wt=ze.trim();if(wt==="")return ab;if(wt in CS)return[CS[wt]];for(;wt!=="";){switch(yt=null,zt=(wt=PS(wt)).charAt(0)){case'"':case"'":yt=gV(wt.substring(1),zt);break;default:yt=xV(wt)}if(yt===null||(mt.push(yt[0]),(wt=PS(yt[1]))!==""&&wt.charAt(0)!==","))return ab;wt=wt.replace(/^,/,"")}return mt}(he);if(this.fontFaces){var Le=function(ze,zt){var yt=ze.getFontList(),mt=JSON.stringify(yt);if(De===null||Re!==mt){var wt=function(Mt){var dt=[];return Object.keys(Mt).forEach(function(qt){Mt[qt].forEach(function(ht){var bt=null;switch(ht){case"bold":bt={family:qt,weight:"bold"};break;case"italic":bt={family:qt,style:"italic"};break;case"bolditalic":bt={family:qt,weight:"bold",style:"italic"};break;case"":case"normal":bt={family:qt}}bt!==null&&(bt.ref={name:qt,style:ht},dt.push(bt))})}),dt}(yt);De=function(Mt){for(var dt={},qt=0;qt<Mt.length;++qt){var ht=ob(Mt[qt]),bt=ht.family,ln=ht.stretch,Pt=ht.style,st=ht.weight;dt[bt]=dt[bt]||{},dt[bt][ln]=dt[bt][ln]||{},dt[bt][ln][Pt]=dt[bt][ln][Pt]||{},dt[bt][ln][Pt][st]=ht}return dt}(wt.concat(zt)),Re=mt}return De}(this.pdf,this.fontFaces),Fe=we.map(function(ze){return{family:ze,stretch:"normal",weight:se,style:be}}),Ve=function(ze,zt,yt){for(var mt=(yt=yt||{}).defaultFontFamily||"times",wt=Object.assign({},mV,yt.genericFontFamilies||{}),Mt=null,dt=null,qt=0;qt<zt.length;++qt)if(wt[(Mt=ob(zt[qt])).family]&&(Mt.family=wt[Mt.family]),ze.hasOwnProperty(Mt.family)){dt=ze[Mt.family];break}if(!(dt=dt||ze[mt]))throw new Error("Could not find a font-family for the rule '"+AS(Mt)+"' and default family '"+mt+"'.");if(dt=function(ht,bt){if(bt[ht])return bt[ht];var ln=k1[ht],Pt=ln<=k1.normal?-1:1,st=ES(bt,rP,ln,Pt);if(!st)throw new Error("Could not find a matching font-stretch value for "+ht);return st}(Mt.stretch,dt),dt=function(ht,bt){if(bt[ht])return bt[ht];for(var ln=nP[ht],Pt=0;Pt<ln.length;++Pt)if(bt[ln[Pt]])return bt[ln[Pt]];throw new Error("Could not find a matching font-style for "+ht)}(Mt.style,dt),!(dt=function(ht,bt){if(bt[ht])return bt[ht];if(ht===400&&bt[500])return bt[500];if(ht===500&&bt[400])return bt[400];var ln=pV[ht],Pt=ES(bt,iP,ln,ht<400?-1:1);if(!Pt)throw new Error("Could not find a matching font-weight for value "+ht);return Pt}(Mt.weight,dt)))throw new Error("Failed to resolve a font for the rule '"+AS(Mt)+"'.");return dt}(Le,Fe);this.pdf.setFont(Ve.ref.name,Ve.ref.style)}else{var He="";(se==="bold"||parseInt(se,10)>=700||be==="bold")&&(He="bold"),be==="italic"&&(He+="italic"),He.length===0&&(He="normal");for(var Ze="",at={arial:"Helvetica",Arial:"Helvetica",verdana:"Helvetica",Verdana:"Helvetica",helvetica:"Helvetica",Helvetica:"Helvetica","sans-serif":"Helvetica",fixed:"Courier",monospace:"Courier",terminal:"Courier",cursive:"Times",fantasy:"Times",serif:"Times"},Be=0;Be<we.length;Be++){if(this.pdf.internal.getFont(we[Be],He,{noFallback:!0,disableWarning:!0})!==void 0){Ze=we[Be];break}if(He==="bolditalic"&&this.pdf.internal.getFont(we[Be],"bold",{noFallback:!0,disableWarning:!0})!==void 0)Ze=we[Be],He="bold";else if(this.pdf.internal.getFont(we[Be],"normal",{noFallback:!0,disableWarning:!0})!==void 0){Ze=we[Be],He="normal";break}}if(Ze===""){for(var it=0;it<we.length;it++)if(at[we[it]]){Ze=at[we[it]];break}}Ze=Ze===""?"Times":Ze,this.pdf.setFont(Ze,He)}}}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(te){this.ctx.globalCompositeOperation=te}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(te){this.ctx.globalAlpha=te}}),Object.defineProperty(this,"lineDashOffset",{get:function(){return this.ctx.lineDashOffset},set:function(te){this.ctx.lineDashOffset=te,X.call(this)}}),Object.defineProperty(this,"lineDash",{get:function(){return this.ctx.lineDash},set:function(te){this.ctx.lineDash=te,X.call(this)}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(te){this.ctx.ignoreClearRect=!!te}})};f.prototype.setLineDash=function(E){this.lineDash=E},f.prototype.getLineDash=function(){return this.lineDash.length%2?this.lineDash.concat(this.lineDash):this.lineDash.slice()},f.prototype.fill=function(){S.call(this,"fill",!1)},f.prototype.stroke=function(){S.call(this,"stroke",!1)},f.prototype.beginPath=function(){this.path=[{type:"begin"}]},f.prototype.moveTo=function(E,q){if(isNaN(E)||isNaN(q))throw an.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.moveTo");var F=this.ctx.transform.applyToPoint(new a(E,q));this.path.push({type:"mt",x:F.x,y:F.y}),this.ctx.lastPoint=new a(E,q)},f.prototype.closePath=function(){var E=new a(0,0),q=0;for(q=this.path.length-1;q!==-1;q--)if(this.path[q].type==="begin"&&en(this.path[q+1])==="object"&&typeof this.path[q+1].x=="number"){E=new a(this.path[q+1].x,this.path[q+1].y);break}this.path.push({type:"close"}),this.ctx.lastPoint=new a(E.x,E.y)},f.prototype.lineTo=function(E,q){if(isNaN(E)||isNaN(q))throw an.error("jsPDF.context2d.lineTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.lineTo");var F=this.ctx.transform.applyToPoint(new a(E,q));this.path.push({type:"lt",x:F.x,y:F.y}),this.ctx.lastPoint=new a(F.x,F.y)},f.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),S.call(this,null,!0)},f.prototype.quadraticCurveTo=function(E,q,F,Z){if(isNaN(F)||isNaN(Z)||isNaN(E)||isNaN(q))throw an.error("jsPDF.context2d.quadraticCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");var Y=this.ctx.transform.applyToPoint(new a(F,Z)),ee=this.ctx.transform.applyToPoint(new a(E,q));this.path.push({type:"qct",x1:ee.x,y1:ee.y,x:Y.x,y:Y.y}),this.ctx.lastPoint=new a(Y.x,Y.y)},f.prototype.bezierCurveTo=function(E,q,F,Z,Y,ee){if(isNaN(Y)||isNaN(ee)||isNaN(E)||isNaN(q)||isNaN(F)||isNaN(Z))throw an.error("jsPDF.context2d.bezierCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");var ce=this.ctx.transform.applyToPoint(new a(Y,ee)),ue=this.ctx.transform.applyToPoint(new a(E,q)),ye=this.ctx.transform.applyToPoint(new a(F,Z));this.path.push({type:"bct",x1:ue.x,y1:ue.y,x2:ye.x,y2:ye.y,x:ce.x,y:ce.y}),this.ctx.lastPoint=new a(ce.x,ce.y)},f.prototype.arc=function(E,q,F,Z,Y,ee){if(isNaN(E)||isNaN(q)||isNaN(F)||isNaN(Z)||isNaN(Y))throw an.error("jsPDF.context2d.arc: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.arc");if(ee=!!ee,!this.ctx.transform.isIdentity){var ce=this.ctx.transform.applyToPoint(new a(E,q));E=ce.x,q=ce.y;var ue=this.ctx.transform.applyToPoint(new a(0,F)),ye=this.ctx.transform.applyToPoint(new a(0,0));F=Math.sqrt(Math.pow(ue.x-ye.x,2)+Math.pow(ue.y-ye.y,2))}Math.abs(Y-Z)>=2*Math.PI&&(Z=0,Y=2*Math.PI),this.path.push({type:"arc",x:E,y:q,radius:F,startAngle:Z,endAngle:Y,counterclockwise:ee})},f.prototype.arcTo=function(E,q,F,Z,Y){throw new Error("arcTo not implemented.")},f.prototype.rect=function(E,q,F,Z){if(isNaN(E)||isNaN(q)||isNaN(F)||isNaN(Z))throw an.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(E,q),this.lineTo(E+F,q),this.lineTo(E+F,q+Z),this.lineTo(E,q+Z),this.lineTo(E,q),this.lineTo(E+F,q),this.lineTo(E,q)},f.prototype.fillRect=function(E,q,F,Z){if(isNaN(E)||isNaN(q)||isNaN(F)||isNaN(Z))throw an.error("jsPDF.context2d.fillRect: Invalid arguments",arguments),new Error("Invalid arguments passed to 
557jsPDF.context2d.fillRect");if(!h.call(this)){var Y={};this.lineCap!=="butt"&&(Y.lineCap=this.lineCap,this.lineCap="butt"),this.lineJoin!=="miter"&&(Y.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(E,q,F,Z),this.fill(),Y.hasOwnProperty("lineCap")&&(this.lineCap=Y.lineCap),Y.hasOwnProperty("lineJoin")&&(this.lineJoin=Y.lineJoin)}},f.prototype.strokeRect=function(E,q,F,Z){if(isNaN(E)||isNaN(q)||isNaN(F)||isNaN(Z))throw an.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");x.call(this)||(this.beginPath(),this.rect(E,q,F,Z),this.stroke())},f.prototype.clearRect=function(E,q,F,Z){if(isNaN(E)||isNaN(q)||isNaN(F)||isNaN(Z))throw an.error("jsPDF.context2d.clearRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(E,q,F,Z))},f.prototype.save=function(E){E=typeof E!="boolean"||E;for(var q=this.pdf.internal.getCurrentPageInfo().pageNumber,F=0;F<this.pdf.internal.getNumberOfPages();F++)this.pdf.setPage(F+1),this.pdf.internal.out("q");if(this.pdf.setPage(q),E){this.ctx.fontSize=this.pdf.internal.getFontSize();var Z=new u(this.ctx);this.ctxStack.push(this.ctx),this.ctx=Z}},f.prototype.restore=function(E){E=typeof E!="boolean"||E;for(var q=this.pdf.internal.getCurrentPageInfo().pageNumber,F=0;F<this.pdf.internal.getNumberOfPages();F++)this.pdf.setPage(F+1),this.pdf.internal.out("Q");this.pdf.setPage(q),E&&this.ctxStack.length!==0&&(this.ctx=this.ctxStack.pop(),this.fillStyle=this.ctx.fillStyle,this.strokeStyle=this.ctx.strokeStyle,this.font=this.ctx.font,this.lineCap=this.ctx.lineCap,this.lineWidth=this.ctx.lineWidth,this.lineJoin=this.ctx.lineJoin,this.lineDash=this.ctx.lineDash,this.lineDashOffset=this.ctx.lineDashOffset)},f.prototype.toDataURL=function(){throw new Error("toDataUrl not implemented.")};var p=function(E){var q,F,Z,Y;if(E.isCanvasGradient===!0&&(E=E.getColor()),!E)return{r:0,g:0,b:0,a:0,style:E};if(/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/.test(E))q=0,F=0,Z=0,Y=0;else{var ee=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(E);if(ee!==null)q=parseInt(ee[1]),F=parseInt(ee[2]),Z=parseInt(ee[3]),Y=1;else if((ee=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(E))!==null)q=parseInt(ee[1]),F=parseInt(ee[2]),Z=parseInt(ee[3]),Y=parseFloat(ee[4]);else{if(Y=1,typeof E=="string"&&E.charAt(0)!=="#"){var ce=new K6(E);E=ce.ok?ce.toHex():"#000000"}E.length===4?(q=E.substring(1,2),q+=q,F=E.substring(2,3),F+=F,Z=E.substring(3,4),Z+=Z):(q=E.substring(1,3),F=E.substring(3,5),Z=E.substring(5,7)),q=parseInt(q,16),F=parseInt(F,16),Z=parseInt(Z,16)}}return{r:q,g:F,b:Z,a:Y,style:E}},h=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},x=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};f.prototype.fillText=function(E,q,F,Z){if(isNaN(q)||isNaN(F)||typeof E!="string")throw an.error("jsPDF.context2d.fillText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillText");if(Z=isNaN(Z)?void 0:Z,!h.call(this)){var Y=$(this.ctx.transform.rotation),ee=this.ctx.transform.scaleX;O.call(this,{text:E,x:q,y:F,scale:ee,angle:Y,align:this.textAlign,maxWidth:Z})}},f.prototype.strokeText=function(E,q,F,Z){if(isNaN(q)||isNaN(F)||typeof E!="string")throw an.error("jsPDF.context2d.strokeText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeText");if(!x.call(this)){Z=isNaN(Z)?void 0:Z;var Y=$(this.ctx.transform.rotation),ee=this.ctx.transform.scaleX;O.call(this,{text:E,x:q,y:F,scale:ee,renderingMode:"stroke",angle:Y,align:this.textAlign,maxWidth:Z})}},f.prototype.measureText=function(E){if(typeof E!="string")throw an.error("jsPDF.context2d.measureText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.measureText");var q=this.pdf,F=this.pdf.internal.scaleFactor,Z=q.internal.getFontSize(),Y=q.getStringUnitWidth(E)*Z/q.internal.scaleFactor;return new function(ee){var ce=(ee=ee||{}).width||0;return Object.defineProperty(this,"width",{get:function(){return ce}}),this}({width:Y*=Math.round(96*F/72*1e4)/1e4})},f.prototype.scale=function(E,q){if(isNaN(E)||isNaN(q))throw an.error("jsPDF.context2d.scale: Invalid arguments",arguments),new Error("Invalid arguments passed to 
557jsPDF.context2d.scale");var F=new c(E,0,0,q,0,0);this.ctx.transform=this.ctx.transform.multiply(F)},f.prototype.rotate=function(E){if(isNaN(E))throw an.error("jsPDF.context2d.rotate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rotate");var q=new c(Math.cos(E),Math.sin(E),-Math.sin(E),Math.cos(E),0,0);this.ctx.transform=this.ctx.transform.multiply(q)},f.prototype.translate=function(E,q){if(isNaN(E)||isNaN(q))throw an.error("jsPDF.context2d.translate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.translate");var F=new c(1,0,0,1,E,q);this.ctx.transform=this.ctx.transform.multiply(F)},f.prototype.transform=function(E,q,F,Z,Y,ee){if(isNaN(E)||isNaN(q)||isNaN(F)||isNaN(Z)||isNaN(Y)||isNaN(ee))throw an.error("jsPDF.context2d.transform: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.transform");var ce=new c(E,q,F,Z,Y,ee);this.ctx.transform=this.ctx.transform.multiply(ce)},f.prototype.setTransform=function(E,q,F,Z,Y,ee){E=isNaN(E)?1:E,q=isNaN(q)?0:q,F=isNaN(F)?0:F,Z=isNaN(Z)?1:Z,Y=isNaN(Y)?0:Y,ee=isNaN(ee)?0:ee,this.ctx.transform=new c(E,q,F,Z,Y,ee)};var g=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};f.prototype.drawImage=function(E,q,F,Z,Y,ee,ce,ue,ye){var Se=this.pdf.getImageProperties(E),De=1,Re=1,qe=1,te=1;Z!==void 0&&ue!==void 0&&(qe=ue/Z,te=ye/Y,De=Se.width/Z*ue/Z,Re=Se.height/Y*ye/Y),ee===void 0&&(ee=q,ce=F,q=0,F=0),Z!==void 0&&ue===void 0&&(ue=Z,ye=Y),Z===void 0&&ue===void 0&&(ue=Se.width,ye=Se.height);var Oe=this.ctx.transform.decompose(),be=$(Oe.rotate.shx),se=new c,Q=(se=(se=(se=se.multiply(Oe.translate)).multiply(Oe.skew)).multiply(Oe.scale)).applyToRectangle(new l(ee-q*qe,ce-F*te,Z*De,Y*Re));if(this.autoPaging){for(var he,ve=b.call(this,Q),we=[],Le=0;Le<ve.length;Le+=1)we.indexOf(ve[Le])===-1&&we.push(ve[Le]);w(we);for(var Fe=we[0],Ve=we[we.length-1],He=Fe;He<Ve+1;He++){this.pdf.setPage(He);var Ze=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],at=He===1?this.posY+this.margin[0]:this.margin[0],Be=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],it=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],ze=He===1?0:Be+(He-2)*it;if(this.ctx.clip_path.length!==0){var zt=this.path;he=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=_(he,this.posX+this.margin[3],-ze+at+this.ctx.prevPageLastElemOffset),C.call(this,"fill",!0),this.path=zt}var yt=JSON.parse(JSON.stringify(Q));yt=_([yt],this.posX+this.margin[3],-ze+at+this.ctx.prevPageLastElemOffset)[0];var mt=(He>Fe||He<Ve)&&g.call(this);mt&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Ze,it,null).clip().discardPath()),this.pdf.addImage(E,"JPEG",yt.x,yt.y,yt.w,yt.h,null,null,be),mt&&this.pdf.restoreGraphicsState()}}else this.pdf.addImage(E,"JPEG",Q.x,Q.y,Q.w,Q.h,null,null,be)};var b=function(E,q,F){var Z=[];q=q||this.pdf.internal.pageSize.width,F=F||this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var Y=this.posY+this.ctx.prevPageLastElemOffset;switch(E.type){default:case"mt":case"lt":Z.push(Math.floor((E.y+Y)/F)+1);break;case"arc":Z.push(Math.floor((E.y+Y-E.radius)/F)+1),Z.push(Math.floor((E.y+Y+E.radius)/F)+1);break;case"qct":var ee=D(this.ctx.lastPoint.x,this.ctx.lastPoint.y,E.x1,E.y1,E.x,E.y);Z.push(Math.floor((ee.y+Y)/F)+1),Z.push(Math.floor((ee.y+ee.h+Y)/F)+1);break;case"bct":var ce=ie(this.ctx.lastPoint.x,this.ctx.lastPoint.y,E.x1,E.y1,E.x2,E.y2,E.x,E.y);Z.push(Math.floor((ce.y+Y)/F)+1),Z.push(Math.floor((ce.y+ce.h+Y)/F)+1);break;case"rect":Z.push(Math.floor((E.y+Y)/F)+1),Z.push(Math.floor((E.y+E.h+Y)/F)+1)}for(var ue=0;ue<Z.length;ue+=1)for(;this.pdf.internal.getNumberOfPages()<Z[ue];)y.call(this);return Z},y=function(){var E=this.fillStyle,q=this.strokeStyle,F=this.font,Z=this.lineCap,Y=this.lineWidth,ee=this.lineJoin;this.pdf.addPage(),this.fillStyle=E,this.strokeStyle=q,this.font=F,this.lineCap=Z,this.lineWidth=Y,this.lineJoin=ee},_=function(E,q,F){for(var Z=0;Z<E.length;
vendor: 11,298 bytes, line 557
557Z++)switch(E[Z].type){case"bct":E[Z].x2+=q,E[Z].y2+=F;case"qct":E[Z].x1+=q,E[Z].y1+=F;default:E[Z].x+=q,E[Z].y+=F}return E},w=function(E){return E.sort(function(q,F){return q-F})},S=function(E,q){var F=this.fillStyle,Z=this.strokeStyle,Y=this.lineCap,ee=this.lineWidth,ce=Math.abs(ee*this.ctx.transform.scaleX),ue=this.lineJoin;if(this.autoPaging){for(var ye,Se,De=JSON.parse(JSON.stringify(this.path)),Re=JSON.parse(JSON.stringify(this.path)),qe=[],te=0;te<Re.length;te++)if(Re[te].x!==void 0)for(var Oe=b.call(this,Re[te]),be=0;be<Oe.length;be+=1)qe.indexOf(Oe[be])===-1&&qe.push(Oe[be]);for(var se=0;se<qe.length;se++)for(;this.pdf.internal.getNumberOfPages()<qe[se];)y.call(this);w(qe);for(var Q=qe[0],he=qe[qe.length-1],ve=Q;ve<he+1;ve++){this.pdf.setPage(ve),this.fillStyle=F,this.strokeStyle=Z,this.lineCap=Y,this.lineWidth=ce,this.lineJoin=ue;var we=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Le=ve===1?this.posY+this.margin[0]:this.margin[0],Fe=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Ve=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],He=ve===1?0:Fe+(ve-2)*Ve;if(this.ctx.clip_path.length!==0){var Ze=this.path;ye=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=_(ye,this.posX+this.margin[3],-He+Le+this.ctx.prevPageLastElemOffset),C.call(this,E,!0),this.path=Ze}if(Se=JSON.parse(JSON.stringify(De)),this.path=_(Se,this.posX+this.margin[3],-He+Le+this.ctx.prevPageLastElemOffset),q===!1||ve===0){var at=(ve>Q||ve<he)&&g.call(this);at&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],we,Ve,null).clip().discardPath()),C.call(this,E,q),at&&this.pdf.restoreGraphicsState()}this.lineWidth=ee}this.path=De}else this.lineWidth=ce,C.call(this,E,q),this.lineWidth=ee},C=function(E,q){if((E!=="stroke"||q||!x.call(this))&&(E==="stroke"||q||!h.call(this))){for(var F,Z,Y=[],ee=this.path,ce=0;ce<ee.length;ce++){var ue=ee[ce];switch(ue.type){case"begin":Y.push({begin:!0});break;case"close":Y.push({close:!0});break;case"mt":Y.push({start:ue,deltas:[],abs:[]});break;case"lt":var ye=Y.length;if(ee[ce-1]&&!isNaN(ee[ce-1].x)&&(F=[ue.x-ee[ce-1].x,ue.y-ee[ce-1].y],ye>0)){for(;ye>=0;ye--)if(Y[ye-1].close!==!0&&Y[ye-1].begin!==!0){Y[ye-1].deltas.push(F),Y[ye-1].abs.push(ue);break}}break;case"bct":F=[ue.x1-ee[ce-1].x,ue.y1-ee[ce-1].y,ue.x2-ee[ce-1].x,ue.y2-ee[ce-1].y,ue.x-ee[ce-1].x,ue.y-ee[ce-1].y],Y[Y.length-1].deltas.push(F);break;case"qct":var Se=ee[ce-1].x+2/3*(ue.x1-ee[ce-1].x),De=ee[ce-1].y+2/3*(ue.y1-ee[ce-1].y),Re=ue.x+2/3*(ue.x1-ue.x),qe=ue.y+2/3*(ue.y1-ue.y),te=ue.x,Oe=ue.y;F=[Se-ee[ce-1].x,De-ee[ce-1].y,Re-ee[ce-1].x,qe-ee[ce-1].y,te-ee[ce-1].x,Oe-ee[ce-1].y],Y[Y.length-1].deltas.push(F);break;case"arc":Y.push({deltas:[],abs:[],arc:!0}),Array.isArray(Y[Y.length-1].abs)&&Y[Y.length-1].abs.push(ue)}}Z=q?null:E==="stroke"?"stroke":"fill";for(var be=!1,se=0;se<Y.length;se++)if(Y[se].arc)for(var Q=Y[se].abs,he=0;he<Q.length;he++){var ve=Q[he];ve.type==="arc"?M.call(this,ve.x,ve.y,ve.radius,ve.startAngle,ve.endAngle,ve.counterclockwise,void 0,q,!be):K.call(this,ve.x,ve.y),be=!0}else if(Y[se].close===!0)this.pdf.internal.out("h"),be=!1;else if(Y[se].begin!==!0){var we=Y[se].start.x,Le=Y[se].start.y;U.call(this,Y[se].deltas,we,Le),be=!0}Z&&T.call(this,Z),q&&H.call(this)}},P=function(E){var q=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,F=q*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case"bottom":return E-F;case"top":return E+q-F;case"hanging":return E+q-2*F;case"middle":return E+q/2-F;default:return E}},R=function(E){return E+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};f.prototype.createLinearGradient=function(){var E=function(){};return E.colorStops=[],E.addColorStop=function(q,F){this.colorStops.push([q,F])},E.getColor=function(){return this.colorStops.length===0?"#000000":this.colorStops[0][1]},E.isCanvasGradient=!0,E},f.prototype.createPattern=function(){return this.createLinearGradient()},f.prototype.createRadialGradient=function(){return this.createLinearGradient()};var M=function(E,q,F,Z,Y,ee,ce,ue,ye){for(var Se=re.call(this,F,Z,Y,ee),De=0;De<Se.length;De++){var Re=Se[De];De===0&&(ye?A.call(this,Re.x1+E,Re.y1+q):K.call(this,Re.x1+E,Re.y1+q)),I.call(this,E,q,Re.x2,Re.y2,Re.x3,Re.y3,Re.x4,Re.y4)}ue?H.call(this):T.call(this,ce)},T=function(E){switch(E){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f")}},H=function(){this.pdf.clip(),this.pdf.discardPath()},A=function(E,q){this.pdf.internal.out(n(E)+" "+r(q)+" m")},O=function(E){var q;switch(E.align){case"right":case"end":q="right";break;case"center":q="center";break;default:q="left"}var F,Z,Y,ee=this.pdf.getTextDimensions(E.text),ce=P.call(this,E.y),ue=R.call(this,ce)-ee.h,ye=this.ctx.transform.applyToPoint(new a(E.x,ce));if(this.autoPaging){var Se=this.ctx.transform.decompose(),De=new c;De=(De=(De=De.multiply(Se.translate)).multiply(Se.skew)).multiply(Se.scale);for(var Re=this.ctx.transform.applyToRectangle(new l(E.x,ce,ee.w,ee.h)),qe=De.applyToRectangle(new l(E.x,ue,ee.w,ee.h)),te=b.call(this,qe),Oe=[],be=0;be<te.length;be+=1)Oe.indexOf(te[be])===-1&&Oe.push(te[be]);w(Oe);for(var se=Oe[0],Q=Oe[Oe.length-1],he=se;he<Q+1;he++){this.pdf.setPage(he);var ve=he===1?this.posY+this.margin[0]:this.margin[0],we=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Le=this.pdf.internal.pageSize.height-this.margin[2],Fe=Le-this.margin[0],Ve=this.pdf.internal.pageSize.width-this.margin[1],He=Ve-this.margin[3],Ze=he===1?0:we+(he-2)*Fe;if(this.ctx.clip_path.length!==0){var at=this.path;F=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=_(F,this.posX+this.margin[3],-1*Ze+ve),C.call(this,"fill",!0),this.path=at}var Be=_([JSON.parse(JSON.stringify(qe))],this.posX+this.margin[3],-Ze+ve+this.ctx.prevPageLastElemOffset)[0];E.scale>=.01&&(Z=this.pdf.internal.getFontSize(),this.pdf.setFontSize(Z*E.scale),Y=this.lineWidth,this.lineWidth=Y*E.scale);var it=this.autoPaging!=="text";if(it||Be.y+Be.h<=Le){if(it||Be.y>=ve&&Be.x<=Ve){var ze=it?E.text:this.pdf.splitTextToSize(E.text,E.maxWidth||Ve-Be.x)[0],zt=_([JSON.parse(JSON.stringify(Re))],this.posX+this.margin[3],-Ze+ve+this.ctx.prevPageLastElemOffset)[0],yt=it&&(he>se||he<Q)&&g.call(this);yt&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],He,Fe,null).clip().discardPath()),this.pdf.text(ze,zt.x,zt.y,{angle:E.angle,align:q,renderingMode:E.renderingMode}),yt&&this.pdf.restoreGraphicsState()}}else Be.y<Le&&(this.ctx.prevPageLastElemOffset+=Le-Be.y);E.scale>=.01&&(this.pdf.setFontSize(Z),this.lineWidth=Y)}}else E.scale>=.01&&(Z=this.pdf.internal.getFontSize(),this.pdf.setFontSize(Z*E.scale),Y=this.lineWidth,this.lineWidth=Y*E.scale),this.pdf.text(E.text,ye.x+this.posX,ye.y+this.posY,{angle:E.angle,align:q,renderingMode:E.renderingMode,maxWidth:E.maxWidth}),E.scale>=.01&&(this.pdf.setFontSize(Z),this.lineWidth=Y)},K=function(E,q,F,Z){F=F||0,Z=Z||0,this.pdf.internal.out(n(E+F)+" "+r(q+Z)+" l")},U=function(E,q,F){return this.pdf.lines(E,q,F,null,null)},I=function(E,q,F,Z,Y,ee,ce,ue){this.pdf.internal.out([t(i(F+E)),t(s(Z+q)),t(i(Y+E)),t(s(ee+q)),t(i(ce+E)),t(s(ue+q)),"c"].join(" "))},re=function(E,q,F,Z){for(var Y=2*Math.PI,ee=Math.PI/2;q>F;)q-=Y;var ce=Math.abs(F-q);ce<Y&&Z&&(ce=Y-ce);for(var ue=[],ye=Z?-1:1,Se=q;ce>1e-5;){var De=Se+ye*Math.min(ce,ee);ue.push(V.call(this,E,Se,De)),ce-=Math.abs(De-Se),Se=De}return ue},V=function(E,q,F){var Z=(F-q)/2,Y=E*Math.cos(Z),ee=E*Math.sin(Z),ce=Y,ue=-ee,ye=ce*ce+ue*ue,Se=ye+ce*Y+ue*ee,De=4/3*(Math.sqrt(2*ye*Se)-Se)/(ce*ee-ue*Y),Re=ce-De*ue,qe=ue+De*ce,te=Re,Oe=-qe,be=Z+q,se=Math.cos(be),Q=Math.sin(be);return{x1:E*Math.cos(q),y1:E*Math.sin(q),x2:Re*se-qe*Q,y2:Re*Q+qe*se,x3:te*se-Oe*Q,y3:te*Q+Oe*se,x4:E*Math.cos(F),y4:E*Math.sin(F)}},$=function(E){return 180*E/Math.PI},D=function(E,q,F,Z,Y,ee){var ce=E+.5*(F-E),ue=q+.5*(Z-q),ye=Y+.5*(F-Y),Se=ee+.5*(Z-ee),De=Math.min(E,Y,ce,ye),Re=Math.max(E,Y,ce,ye),qe=Math.min(q,ee,ue,Se),te=Math.max(q,ee,ue,Se);return new l(De,qe,Re-De,te-qe)},ie=function(E,q,F,Z,Y,ee,ce,ue){var ye,Se,De,Re,qe,te,Oe,be,se,Q,he,ve,we,Le,Fe=F-E,Ve=Z-q,He=Y-F,Ze=ee-Z,at=ce-Y,Be=ue-ee;for(Se=0;Se<41;Se++)se=(Oe=(De=E+(ye=Se/40)*Fe)+ye*((qe=F+ye*He)-De))+ye*(qe+ye*(Y+ye*at-qe)-Oe),Q=(be=(Re=q+ye*Ve)+ye*((te=Z+ye*Ze)-Re))+ye*(te+ye*(ee+ye*Be-te)-be),Se==0?(he=se,ve=Q,we=se,Le=Q):(he=Math.min(he,se),ve=Math.min(ve,Q),we=Math.max(we,se),Le=Math.max(Le,Q));return new l(Math.round(he),Math.round(ve),Math.round(we-he),Math.round(Le-ve))},X=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var E,q,F=(E=this.ctx.lineDash,q=this.ctx.lineDashOffset,JSON.stringify({lineDash:E,lineDashOffset:q}));this.prevLineDash!==F&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=F)}}})(Xe.API),function(e){var t=function(a){var l,c,d,u,f,p,h,x,g,b;for(c=[],d=0,u=(a+=l="\0\0\0\0".slice(a.length%4||4)).length;u>d;d+=4)(f=(a.charCodeAt(d)<<24)+(a.charCodeAt(d+1)<<16)+(a.charCodeAt(d+2)<<8)+a.charCodeAt(d+3))!==0?(p=(f=((f=((f=((f=(f-(b=f%85))/85)-(g=f%85))/85)-(x=f%85))/85)-(h=f%85))/85)%85,c.push(p+33,h+33,x+33,g+33,b+33)):c.push(122);return function(y,_){for(var w=_;w>0;w--)y.pop()}(c,l.length),String.fromCharCode.apply(String,c)+"~>"},n=function(a){var l,c,d,u,f,p=String,h="length",x=255,g="charCodeAt",b="slice",y="replace";for(a[b](-2),a=a[b](0,-2)[y](/\s/g,"")[y]("z","!!!!!"),d=[],u=0,f=(a+=l="uuuuu"[b](a[h]%5||5))[h];f>u;u+=5)c=52200625*(a[g](u)-33)+614125*(a[g](u+1)-33)+7225*(a[g](u+2)-33)+85*(a[g](u+3)-33)+(a[g](u+4)-33),d.push(x&c>>24,x&c>>16,x&c>>8,x&c);return function(_,w){for(var S=w;S>0;S--)_.pop()}(d,l[h]),p.fromCharCode.apply(p,d)},r=function(a){return a.split("").map(function(l){return("0"+l.charCodeAt().toString(16)).slice(-2)}).join("")+">"},i=function(a){var l=new RegExp(/^([0-9A-Fa-f]{2})+$/);if((a=a.replace(/\s/g,"")).indexOf(">")!==-1&&(a=a.substr(0,a.indexOf(">"))),a.length%2&&(a+="0"),l.test(a)===!1)return"";for(var c="",d=0;d<a.length;d+=2)c+=String.fromCharCode("0x"+(a[d]+a[d+1]));return c},s=function(a){for(var l=new Uint8Array(a.length),c=a.length;c--;)l[c]=a.charCodeAt(c);return(l=d1(l)).reduce(function(d,u){return d+String.fromCharCode(u)},"")};e.processDataByFilters=function(a,l){var c=0,d=a||"",u=[];for(typeof(l=l||[])=="string"&&(l=[l]),c=0;c<l.length;c+=1)switch(l[c]){case"ASCII85Decode":case"/ASCII85Decode":d=n(d),u.push("/ASCII85Encode");break;case"ASCII85Encode":case"/ASCII85Encode":d=t(d),u.push("/ASCII85Decode");break;case"ASCIIHexDecode":case"/ASCIIHexDecode":d=i(d),u.push("/ASCIIHexEncode");break;case"ASCIIHexEncode":case"/ASCIIHexEncode":d=r(d),u.push("/ASCIIHexDecode");break;case"FlateEncode":case"/FlateEncode":d=s(d),u.push("/FlateDecode");break;default:throw new Error('The filter: "'+l[c]+'" is not implemented')}return{data:d,reverseChain:u.reverse().join(" ")}}}(Xe.API),function(e){e.loadFile=function(t,n,r){return function(i,s,a){s=s!==!1,a=typeof a=="function"?a:function(){};var l=void 0;try{l=function(c,d,u){var f=new XMLHttpRequest,p=0,h=function(x){var g=x.length,b=[],y=String.fromCharCode;for(p=0;p<g;p+=1)b.push(y(255&x.charCodeAt(p)));return b.join("")};if(f.open("GET",c,!d),f.overrideMimeType("text/plain;
557 charset=x-user-defined"),d===!1&&(f.onload=function(){f.status===200?u(h(this.responseText)):u(void 0)}),f.send(null),d&&f.status===200)return h(f.responseText)}(i,s,a)}catch{}return l}(t,n,r)},e.allowFsRead=void 0,e.loadImageFile=e.loadFile}(Xe.API),function(e){function t(){return(vt.html2canvas?Promise.resolve(vt.html2canvas):Dv(()=>import("./html2canvas.esm-CBrSDip1.js"),[])).catch(function(l){return Promise.reject(new Error("Could not load html2canvas: "+l))}).then(function(l){return l.default?l.default:l})}function n(){return(vt.DOMPurify?Promise.resolve(vt.DOMPurify):Dv(()=>import("./purify.es-dhnUglUx.js"),[])).catch(function(l){return Promise.reject(new Error("Could not load dompurify: "+l))}).then(function(l){return l.default?l.default:l})}var r=function(l){var c=en(l);return c==="undefined"?"undefined":c==="string"||l instanceof String?"string":c==="number"||l instanceof Number?"number":c==="function"||l instanceof Function?"function":l&&l.constructor===Array?"array":l&&l.nodeType===1?"element":c==="object"?"object":"unknown"},i=function(l,c){var d=document.createElement(l);for(var u in c.className&&(d.className=c.className),c.innerHTML&&c.dompurify&&(d.innerHTML=c.dompurify.sanitize(c.innerHTML)),c.style)d.style[u]=c.style[u];return d},s=function l(c,d){for(var u=c.nodeType===3?document.createTextNode(c.nodeValue):c.cloneNode(!1),f=c.firstChild;f;f=f.nextSibling)d!==!0&&f.nodeType===1&&f.nodeName==="SCRIPT"||u.appendChild(l(f,d));return c.nodeType===1&&(c.nodeName==="CANVAS"?(u.width=c.width,u.height=c.height,u.getContext("2d").drawImage(c,0,0)):c.nodeName!=="TEXTAREA"&&c.nodeName!=="SELECT"||(u.value=c.value),u.addEventListener("load",function(){u.scrollTop=c.scrollTop,u.scrollLeft=c.scrollLeft},!0)),u},a=function l(c){var d=Object.assign(l.convert(Promise.resolve()),JSON.parse(JSON.stringify(l.template))),u=l.convert(Promise.resolve(),d);return(u=u.setProgress(1,l,1,[l])).set(c)};(a.prototype=Object.create(Promise.prototype)).constructor=a,a.convert=function(l,c){return l.__proto__=c||a.prototype,l},a.template={prop:{src:null,container:null,overlay:null,canvas:null,img:null,pdf:null,pageSize:null,callback:function(){}},progress:{val:0,state:null,n:0,stack:[]},opt:{filename:"file.pdf",margin:[0,0,0,0],enableLinks:!0,x:0,y:0,html2canvas:{},jsPDF:{},backgroundColor:"transparent"}},a.prototype.from=function(l,c){return this.then(function(){switch(c=c||function(d){switch(r(d)){case"string":return"string";case"element":return d.nodeName.toLowerCase()==="canvas"?"canvas":"element";default:return"unknown"}}(l),c){case"string":return this.then(n).then(function(d){return this.set({src:i("div",{innerHTML:l,dompurify:d})})});case"element":return this.set({src:l});case"canvas":return this.set({canvas:l});case"img":return this.set({img:l});default:return this.error("Unknown source type.")}})},a.prototype.to=function(l){switch(l){case"container":return this.toContainer();case"canvas":return this.toCanvas();case"img":return this.toImg();case"pdf":return this.toPdf();default:return this.error("Invalid target.")}},a.prototype.toContainer=function(){return this.thenList([function(){return this.prop.src||this.error("Cannot duplicate - no source HTML.")},function(){return this.prop.pageSize||this.setPageSize()}]).then(function(){var l={position:"relative",display:"inline-block",width:(typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?Math.max(this.prop.src.clientWidth,this.prop.src.scrollWidth,this.prop.src.offsetWidth):this.opt.windowWidth)+"px",left:0,right:0,top:0,margin:"auto",backgroundColor:this.opt.backgroundColor},c=s(this.prop.src,this.opt.html2canvas.javascriptEnabled);c.tagName==="BODY"&&(l.height=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)+"px"),this.prop.overlay=i("div",{className:"html2pdf__overlay",style:{position:"fixed",overflow:"hidden",zIndex:1e3,left:"-100000px",right:0,bottom:0,top:0}}),this.prop.container=i("div",{className:"html2pdf__container",style:l}),this.prop.container.appendChild(c),this.prop.container.firstChild.appendChild(i("div",{style:{clear:"both",border:"0 none transparent",margin:0,padding:0,height:0}})),this.prop.container.style.float="none",this.prop.overlay.appendChild(this.prop.container),document.body.appendChild(this.prop.overlay),this.prop.container.firstChild.style.position="relative",this.prop.container.height=Math.max(this.prop.container.firstChild.clientHeight,this.prop.container.firstChild.scrollHeight,this.prop.container.firstChild.offsetHeight)+"px"})},a.prototype.toCanvas=function(){var l=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(l).then(t).then(function(c){var d=Object.assign({},this.opt.html2canvas);return delete d.onrendered,c(this.prop.container,d)}).then(function(c){(this.opt.html2canvas.onrendered||function(){})(c),this.prop.canvas=c,document.body.removeChild(this.prop.overlay)})},a.prototype.toContext2d=function(){var l=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(l).then(t).then(function(c){var d=this.opt.jsPDF,u=this.opt.fontFaces,f=typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?1:this.opt.width/this.opt.windowWidth,p=Object.assign({async:!0,allowTaint:!0,scale:f,scrollX:this.opt.scrollX||0,scrollY:this.opt.scrollY||0,backgroundColor:"#ffffff",imageTimeout:15e3,logging:!0,proxy:null,removeContainer:!0,foreignObjectRendering:!1,useCORS:!1},this.opt.html2canvas);if(delete p.onrendered,d.context2d.autoPaging=this.opt.autoPaging===void 0||this.opt.autoPaging,d.context2d.posX=this.opt.x,d.context2d.posY=this.opt.y,d.context2d.margin=this.opt.margin,d.context2d.fontFaces=u,u)for(var h=0;h<u.length;++h){var x=u[h],g=x.src.find(function(b){return b.format==="truetype"});g&&d.addFont(g.url,x.ref.name,x.ref.style)}
vendor: 23,322 bytes, lines 557-563
557return p.windowHeight=p.windowHeight||0,p.windowHeight=p.windowHeight==0?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):p.windowHeight,d.context2d.save(!0),c(this.prop.container,p)}).then(function(c){this.opt.jsPDF.context2d.restore(!0),(this.opt.html2canvas.onrendered||function(){})(c),this.prop.canvas=c,document.body.removeChild(this.prop.overlay)})},a.prototype.toImg=function(){return this.thenList([function(){return this.prop.canvas||this.toCanvas()}]).then(function(){var l=this.prop.canvas.toDataURL("image/"+this.opt.image.type,this.opt.image.quality);this.prop.img=document.createElement("img"),this.prop.img.src=l})},a.prototype.toPdf=function(){return this.thenList([function(){return this.toContext2d()}]).then(function(){this.prop.pdf=this.prop.pdf||this.opt.jsPDF})},a.prototype.output=function(l,c,d){return(d=d||"pdf").toLowerCase()==="img"||d.toLowerCase()==="image"?this.outputImg(l,c):this.outputPdf(l,c)},a.prototype.outputPdf=function(l,c){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){return this.prop.pdf.output(l,c)})},a.prototype.outputImg=function(l){return this.thenList([function(){return this.prop.img||this.toImg()}]).then(function(){switch(l){case void 0:case"img":return this.prop.img;case"datauristring":case"dataurlstring":return this.prop.img.src;case"datauri":case"dataurl":return document.location.href=this.prop.img.src;default:throw'Image output type "'+l+'" is not supported.'}})},a.prototype.save=function(l){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).set(l?{filename:l}:null).then(function(){this.prop.pdf.save(this.opt.filename)})},a.prototype.doCallback=function(){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){this.prop.callback(this.prop.pdf)})},a.prototype.set=function(l){if(r(l)!=="object")return this;var c=Object.keys(l||{}).map(function(d){if(d in a.template.prop)return function(){this.prop[d]=l[d]};switch(d){case"margin":return this.setMargin.bind(this,l.margin);case"jsPDF":return function(){return this.opt.jsPDF=l.jsPDF,this.setPageSize()};case"pageSize":return this.setPageSize.bind(this,l.pageSize);default:return function(){this.opt[d]=l[d]}}},this);return this.then(function(){return this.thenList(c)})},a.prototype.get=function(l,c){return this.then(function(){var d=l in a.template.prop?this.prop[l]:this.opt[l];return c?c(d):d})},a.prototype.setMargin=function(l){return this.then(function(){switch(r(l)){case"number":l=[l,l,l,l];case"array":if(l.length===2&&(l=[l[0],l[1],l[0],l[1]]),l.length===4)break;default:return this.error("Invalid margin array.")}this.opt.margin=l}).then(this.setPageSize)},a.prototype.setPageSize=function(l){function c(d,u){return Math.floor(d*u/72*96)}return this.then(function(){(l=l||Xe.getPageSize(this.opt.jsPDF)).hasOwnProperty("inner")||(l.inner={width:l.width-this.opt.margin[1]-this.opt.margin[3],height:l.height-this.opt.margin[0]-this.opt.margin[2]},l.inner.px={width:c(l.inner.width,l.k),height:c(l.inner.height,l.k)},l.inner.ratio=l.inner.height/l.inner.width),this.prop.pageSize=l})},a.prototype.setProgress=function(l,c,d,u){return l!=null&&(this.progress.val=l),c!=null&&(this.progress.state=c),d!=null&&(this.progress.n=d),u!=null&&(this.progress.stack=u),this.progress.ratio=this.progress.val/this.progress.state,this},a.prototype.updateProgress=function(l,c,d,u){return this.setProgress(l?this.progress.val+l:null,c||null,d?this.progress.n+d:null,u?this.progress.stack.concat(u):null)},a.prototype.then=function(l,c){var d=this;return this.thenCore(l,c,function(u,f){return d.updateProgress(null,null,1,[u]),Promise.prototype.then.call(this,function(p){return d.updateProgress(null,u),p}).then(u,f).then(function(p){return d.updateProgress(1),p})})},a.prototype.thenCore=function(l,c,d){d=d||Promise.prototype.then;var u=this;l&&(l=l.bind(u)),c&&(c=c.bind(u));var f=Promise.toString().indexOf("[native code]")!==-1&&Promise.name==="Promise"?u:a.convert(Object.assign({},u),Promise.prototype),p=d.call(f,l,c);return a.convert(p,u.__proto__)},a.prototype.thenExternal=function(l,c){return Promise.prototype.then.call(this,l,c)},a.prototype.thenList=function(l){var c=this;return l.forEach(function(d){c=c.thenCore(d)}),c},a.prototype.catch=function(l){l&&(l=l.bind(this));var c=Promise.prototype.catch.call(this,l);return a.convert(c,this)},a.prototype.catchExternal=function(l){return Promise.prototype.catch.call(this,l)},a.prototype.error=function(l){return this.then(function(){throw new Error(l)})},a.prototype.using=a.prototype.set,a.prototype.saveAs=a.prototype.save,a.prototype.export=a.prototype.output,a.prototype.run=a.prototype.then,Xe.getPageSize=function(l,c,d){if(en(l)==="object"){var u=l;l=u.orientation,c=u.unit||c,d=u.format||d}c=c||"mm",d=d||"a4",l=(""+(l||"P")).toLowerCase();var f,p=(""+d).toLowerCase(),h={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};switch(c){case"pt":f=1;break;case"mm":f=72/25.4;break;case"cm":f=72/2.54;break;case"in":f=72;break;case"px":f=.75;break;case"pc":case"em":f=12;break;case"ex":f=6;break;default:throw"Invalid unit: "+c}var x,g=0,b=0;if(h.hasOwnProperty(p))g=h[p][1]/f,b=h[p][0]/f;else try{g=d[1],b=d[0]}catch{throw new Error("Invalid format: "+d)}if(l==="p"||l==="portrait")l="p",b>g&&(x=b,b=g,g=x);else{if(l!=="l"&&l!=="landscape")throw"Invalid orientation: "+l;l="l",g>b&&(x=b,b=g,g=x)}return{width:b,height:g,unit:c,k:f,orientation:l}},e.html=function(l,c){(c=c||{}).callback=c.callback||function(){},c.html2canvas=c.html2canvas||{},c.html2canvas.canvas=c.html2canvas.canvas||this.canvas,c.jsPDF=c.jsPDF||this,c.fontFaces=c.fontFaces?c.fontFaces.map(ob):null;var d=new a(c);return c.worker?d:d.from(l).doCallback()}}(Xe.API),Xe.API.addJS=function(e){var t,n,r=function(i){for(var s="",a=0;a<i.length;a++){var l=i[a];if(l==="("||l===")"){for(var c=0,d=a-1;d>=0&&i[d]==="\\";d--)c++;s+=c%2==0?"\\"+l:l}else s+=l}return s}(e);return this.internal.events.subscribe("postPutResources",function(){t=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(t+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),n=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+r+")"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){t!==void 0&&n!==void 0&&this.internal.out("/Names <</JavaScript "+t+" 0 R>>")}),this},function(e){var t;e.events.push(["postPutResources",function(){var n=this,r=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var i=n.outline.render().split(/\r\n/),s=0;s<i.length;s++){var a=i[s],l=r.exec(a);if(l!=null){var c=l[1];n.internal.newObjectDeferredBegin(c,!1)}n.internal.write(a)}if(this.outline.createNamedDestinations){var d=this.internal.pages.length,u=[];for(s=0;s<d;s++){var f=n.internal.newObject();u.push(f);var p=n.internal.getPageInfo(s+1);n.internal.write("<< /D["+p.objId+" 0 R /XYZ null null null]>> endobj")}var h=n.internal.newObject();for(n.internal.write("<< /Names [ "),s=0;s<u.length;s++)n.internal.write("(page_"+(s+1)+")"+u[s]+" 0 R");n.internal.write(" ] >>","endobj"),t=n.internal.newObject(),n.internal.write("<< /Dests "+h+" 0 R"),n.internal.write(">>","endobj")}}]),e.events.push(["putCatalog",function(){var n=this;n.outline.root.children.length>0&&(n.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&n.internal.write("/Names "+t+" 0 R"))}]),e.events.push(["initialized",function(){var n=this;n.outline={createNamedDestinations:!1,root:{children:[]}},n.outline.add=function(r,i,s){var a={title:i,options:s,children:[]};return r==null&&(r=this.root),r.children.push(a),a},n.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=n,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},n.outline.genIds_r=function(r){r.id=n.internal.newObjectDeferred();for(var i=0;i<r.children.length;i++)this.genIds_r(r.children[i])},n.outline.renderRoot=function(r){this.objStart(r),this.line("/Type /Outlines"),r.children.length>0&&(this.line("/First "+this.makeRef(r.children[0])),this.line("/Last "+this.makeRef(r.children[r.children.length-1]))),this.line("/Count "+this.count_r({count:0},r)),this.objEnd()},n.outline.renderItems=function(r){for(var i=this.ctx.pdf.internal.getVerticalCoordinateString,s=0;s<r.children.length;s++){var a=r.children[s];this.objStart(a),this.line("/Title "+this.makeString(a.title)),this.line("/Parent "+this.makeRef(r)),s>0&&this.line("/Prev "+this.makeRef(r.children[s-1])),s<r.children.length-1&&this.line("/Next "+this.makeRef(r.children[s+1])),a.children.length>0&&(this.line("/First "+this.makeRef(a.children[0])),this.line("/Last "+this.makeRef(a.children[a.children.length-1])));var l=this.count=this.count_r({count:0},a);if(l>0&&this.line("/Count "+l),a.options&&a.options.pageNumber){var c=n.internal.getPageInfo(a.options.pageNumber);this.line("/Dest ["+c.objId+" 0 R /XYZ 0 "+i(0)+" 0]")}this.objEnd()}for(var d=0;d<r.children.length;d++)this.renderItems(r.children[d])},n.outline.line=function(r){this.ctx.val+=r+`\r
558`},n.outline.makeRef=function(r){return r.id+" 0 R"},n.outline.makeString=function(r){return"("+n.internal.pdfEscape(r)+")"},n.outline.objStart=function(r){this.ctx.val+=`\r
559`+r.id+` 0 obj\r
560<<\r
561`},n.outline.objEnd=function(){this.ctx.val+=`>> \r
562endobj\r
563`},n.outline.count_r=function(r,i){for(var s=0;s<i.children.length;s++)r.count++,this.count_r(r,i.children[s]);return r.count}}])}(Xe.API),function(e){var t=[192,193,194,195,196,197,198,199];e.processJPEG=function(n,r,i,s,a,l){var c,d=this.decode.DCT_DECODE,u=null;if(typeof n=="string"||this.__addimage__.isArrayBuffer(n)||this.__addimage__.isArrayBufferView(n)){switch(n=a||n,n=this.__addimage__.isArrayBuffer(n)?new Uint8Array(n):n,c=function(f){for(var p,h=256*f.charCodeAt(4)+f.charCodeAt(5),x=f.length,g={width:0,height:0,numcomponents:1},b=4;b<x;b+=2){if(b+=h,t.indexOf(f.charCodeAt(b+1))!==-1){p=256*f.charCodeAt(b+5)+f.charCodeAt(b+6),g={width:256*f.charCodeAt(b+7)+f.charCodeAt(b+8),height:p,numcomponents:f.charCodeAt(b+9)};break}h=256*f.charCodeAt(b+2)+f.charCodeAt(b+3)}return g}(n=this.__addimage__.isArrayBufferView(n)?this.__addimage__.arrayBufferToBinaryString(n):n),c.numcomponents){case 1:l=this.color_spaces.DEVICE_GRAY;break;case 4:l=this.color_spaces.DEVICE_CMYK;break;case 3:l=this.color_spaces.DEVICE_RGB}u={data:n,width:c.width,height:c.height,colorSpace:l,bitsPerComponent:8,filter:d,index:r,alias:i}}return u}}(Xe.API),Xe.API.processPNG=function(e,t,n,r){if(this.__addimage__.isArrayBuffer(e)&&(e=new Uint8Array(e)),this.__addimage__.isArrayBufferView(e)){var i,s=eV(e,{checkCrc:!0}),a=s.width,l=s.height,c=s.channels,d=s.palette,u=s.depth;i=d&&c===1?function(M){for(var T=M.width,H=M.height,A=M.data,O=M.palette,K=M.depth,U=!1,I=[],re=[],V=void 0,$=!1,D=0,ie=0;ie<O.length;ie++){var X=jN(O[ie],4),E=X[0],q=X[1],F=X[2],Z=X[3];I.push(E,q,F),Z!=null&&(Z===0?(D++,re.length<1&&re.push(ie)):Z<255&&($=!0))}if($||D>1){U=!0,re=void 0;var Y=T*H;V=new Uint8Array(Y);for(var ee=new DataView(A.buffer),ce=0;ce<Y;ce++){var ue=lb(ee,ce,K),ye=jN(O[ue],4)[3];V[ce]=ye}}else D===0&&(re=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:U?8:void 0,colorBytes:A,alphaBytes:V,needSMask:U,palette:I,mask:re}}(s):c===2||c===4?function(M){for(var T=M.data,H=M.width,A=M.height,O=M.channels,K=M.depth,U=O===2?"DeviceGray":"DeviceRGB",I=O-1,re=H*A,V=I,$=re*V,D=1*re,ie=Math.ceil($*K/8),X=Math.ceil(D*K/8),E=new Uint8Array(ie),q=new Uint8Array(X),F=new DataView(T.buffer),Z=new DataView(E.buffer),Y=new DataView(q.buffer),ee=!1,ce=0;ce<re;ce++){for(var ue=ce*O,ye=0;ye<V;ye++)$S(Z,lb(F,ue+ye,K),ce*V+ye,K);var Se=lb(F,ue+V,K);Se<(1<<K)-1&&(ee=!0),$S(Y,Se,1*ce,K)}return{colorSpace:U,colorsPerPixel:I,sMaskBitsPerComponent:ee?K:void 0,colorBytes:E,alphaBytes:q,needSMask:ee}}(s):function(M){var T=M.data,H=M.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:H,colorsPerPixel:H==="DeviceGray"?1:3,colorBytes:T instanceof Uint16Array?function(A){for(var O=A.length,K=new Uint8Array(2*O),U=new DataView(K.buffer,K.byteOffset,K.byteLength),I=0;I<O;I++)U.setUint16(2*I,A[I],!1);return K}(T):T,needSMask:!1}}(s);var f,p,h,x=i,g=x.colorSpace,b=x.colorsPerPixel,y=x.sMaskBitsPerComponent,_=x.colorBytes,w=x.alphaBytes,S=x.needSMask,C=x.palette,P=x.mask,R=null;return r!==Xe.API.image_compression.NONE&&typeof d1=="function"?(R=function(M){var T;switch(M){case Xe.API.image_compression.FAST:T=11;break;case Xe.API.image_compression.MEDIUM:T=13;break;case Xe.API.image_compression.SLOW:T=14;break;default:T=12}return T}(r),f=this.decode.FLATE_DECODE,p="/Predictor ".concat(R," /Colors ").concat(b," /BitsPerComponent ").concat(u," /Columns ").concat(a),e=OS(_,Math.ceil(a*b*u/8),b,u,r),S&&(h=OS(w,Math.ceil(a*y/8),1,y,r))):(f=void 0,p=void 0,e=_,S&&(h=w)),(this.__addimage__.isArrayBuffer(e)||this.__addimage__.isArrayBufferView(e))&&(e=this.__addimage__.arrayBufferToBinaryString(e)),(h&&this.__addimage__.isArrayBuffer(h)||this.__addimage__.isArrayBufferView(h))&&(h=this.__addimage__.arrayBufferToBinaryString(h)),{alias:n,data:e,index:t,filter:f,decodeParameters:p,transparency:P,palette:C,sMask:h,predictor:R,width:a,height:l,bitsPerComponent:u,sMaskBitsPerComponent:y,colorSpace:g}}},function(e){e.processGIF89A=function(t,n,r,i){var s=new wV(t),a=s.width,l=s.height,c=[];s.decodeAndBlitFrameRGBA(0,c);var d={data:c,width:a,height:l},u=new cb(100).encode(d,100);return e.processJPEG.call(this,u,n,r,i)},e.processGIF87A=e.processGIF89A}(Xe.API),us.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.bitPP===16&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var e=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(e);for(var t=0;t<e;t++){var n=this.datav.getUint8(this.pos++,!0),r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0);this.palette[t]={red:i,green:r,blue:n,quad:s}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},us.prototype.parseBGR=function(){this.pos=this.offset;var e="bit"+this.bitPP,t=this.width*this.height*4;if(t>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");this.data=new Uint8Array(t);try{this[e]()}catch(n){an.log("bit decode error:"+n)}},us.prototype.bit1=function(){var e,t=Math.ceil(this.width/8),n=t%4;for(e=this.height-1;e>=0;e--){for(var r=this.bottom_up?e:this.height-1-e,i=0;i<t;i++)for(var s=this.datav.getUint8(this.pos++,!0),a=r*this.width*4+8*i*4,l=0;l<8&&8*i+l<this.width;l++){var c=this.palette[s>>7-l&1];this.data[a+4*l]=c.blue,this.data[a+4*l+1]=c.green,this.data[a+4*l+2]=c.red,this.data[a+4*l+3]=255}n!==0&&(this.pos+=4-n)}},us.prototype.bit4=function(){for(var e=Math.ceil(this.width/2),t=e%4,n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,i=0;i<e;i++){var s=this.datav.getUint8(this.pos++,!0),a=r*this.width*4+2*i*4,l=s>>4,c=15&s,d=this.palette[l];if(this.data[a]=d.blue,this.data[a+1]=d.green,this.data[a+2]=d.red,this.data[a+3]=255,2*i+1>=this.width)break;d=this.palette[c],this.data[a+4]=d.blue,this.data[a+4+1]=d.green,this.data[a+4+2]=d.red,this.data[a+4+3]=255}t!==0&&(this.pos+=4-t)}},us.prototype.bit8=function(){for(var e=this.width%4,t=this.height-1;t>=0;t--){for(var n=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){var i=this.datav.getUint8(this.pos++,!0),s=n*this.width*4+4*r;if(i<this.palette.length){var a=this.palette[i];this.data[s]=a.red,this.data[s+1]=a.green,this.data[s+2]=a.blue,this.data[s+3]=255}else this.data[s]=255,this.data[s+1]=255,this.data[s+2]=255,this.data[s+3]=255}e!==0&&(this.pos+=4-e)}},us.prototype.bit15=function(){for(var e=this.width%3,t=parseInt("11111",2),n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,i=0;i<this.width;i++){var s=this.datav.getUint16(this.pos,!0);this.pos+=2;var a=(s&t)/t*255|0,l=(s>>5&t)/t*255|0,c=(s>>10&t)/t*255|0,d=s>>15?255:0,u=r*this.width*4+4*i;this.data[u]=c,this.data[u+1]=l,this.data[u+2]=a,this.data[u+3]=d}this.pos+=e}},us.prototype.bit16=function(){for(var e=this.width%3,t=parseInt("11111",2),n=parseInt("111111",2),r=this.height-1;r>=0;r--){for(var i=this.bottom_up?r:this.height-1-r,s=0;s<this.width;s++){var a=this.datav.getUint16(this.pos,!0);this.pos+=2;var l=(a&t)/t*255|0,c=(a>>5&n)/n*255|0,d=(a>>11)/t*255|0,u=i*this.width*4+4*s;this.data[u]=d,this.data[u+1]=c,this.data[u+2]=l,this.data[u+3]=255}this.pos+=e}},us.prototype.bit24=function(){for(var e=this.height-1;e>=0;e--){for(var t=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){var r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),a=t*this.width*4+4*n;this.data[a]=s,this.data[a+1]=i,this.data[a+2]=r,this.data[a+3]=255}this.pos+=this.width%4}},us.prototype.bit32=function(){for(var e=this.height-1;e>=0;e--)for(var t=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){var r=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),l=t*this.width*4+4*n;this.data[l]=s,this.data[l+1]=i,this.data[l+2]=r,this.data[l+3]=a}},us.prototype.getData=function(){return this.data},function(e){e.processBMP=function(t,n,r,i){var s=new us(t,!1),a=s.width,l=s.height,c={data:s.getData(),width:a,height:l},d=new cb(100).encode(c,100);return e.processJPEG.call(this,d,n,r,i)}}(Xe.API),US.prototype.getData=function(){return this.data},function(e){e.processWEBP=function(t,n,r,i){var s=new US(t),a=s.width,l=s.height,c={data:s.getData(),width:a,height:l},d=new cb(100).encode(c,100);return e.processJPEG.call(this,d,n,r,i)}}(Xe.API),Xe.API.processRGBA=function(e,t,n){for(var r=e.data,i=r.length,s=new Uint8Array(i/4*3),a=new Uint8Array(i/4),l=0,c=0,d=0;d<i;d+=4){var u=r[d],f=r[d+1],p=r[d+2],h=r[d+3];s[l++]=u,s[l++]=f,s[l++]=p,a[c++]=h}var x=this.__addimage__.arrayBufferToBinaryString(s);return{alpha:this.__addimage__.arrayBufferToBinaryString(a),data:x,index:t,alias:n,colorSpace:"DeviceRGB",bitsPerComponent:8,width:e.width,height:e.height}},Xe.API.setLanguage=function(e){return this.internal.languageSettings===void 0&&(this.internal.languageSettings={},this.internal.languageSettings.isSubscribed=!1),{af:"Afrikaans",sq:"Albanian",ar:"Arabic (Standard)","ar-DZ":"Arabic (Algeria)","ar-BH":"Arabic (Bahrain)","ar-EG":"Arabic (Egypt)","ar-IQ":"Arabic (Iraq)","ar-JO":"Arabic (Jordan)","ar-KW":"Arabic (Kuwait)","ar-LB":"Arabic (Lebanon)","ar-LY":"Arabic (Libya)","ar-MA":"Arabic (Morocco)","ar-OM":"Arabic (Oman)","ar-QA":"Arabic (Qatar)","ar-SA":"Arabic (Saudi Arabia)","ar-SY":"Arabic (Syria)","ar-TN":"Arabic (Tunisia)","ar-AE":"Arabic (U.A.E.)","ar-YE":"Arabic (Yemen)",an:"Aragonese",hy:"Armenian",as:"Assamese",ast:"Asturian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",zh:"Chinese","zh-HK":"Chinese (Hong Kong)","zh-CN":"Chinese (PRC)","zh-SG":"Chinese (Singapore)","zh-TW":"Chinese (Taiwan)",cv:"Chuvash",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch (Standard)","nl-BE":"Dutch (Belgian)",en:"English","en-AU":"English (Australia)","en-BZ":"English (Belize)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-JM":"English (Jamaica)","en-NZ":"English (New Zealand)","en-PH":"English (Philippines)","en-ZA":"English (South Africa)","en-TT":"English (Trinidad & Tobago)","en-GB":"English (United Kingdom)","en-US":"English (United States)","en-ZW":"English (Zimbabwe)",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fj:"Fijian",fi:"Finnish",fr:"French (Standard)","fr-BE":"French (Belgium)","fr-CA":"French (Canada)","fr-FR":"French (France)","fr-LU":"French (Luxembourg)","fr-MC":"French (Monaco)","fr-CH":"French (Switzerland)",fy:"Frisian",fur:"Friulian",gd:"Gaelic (Scots)","gd-IE":"Gaelic (Irish)",gl:"Galacian",ka:"Georgian",de:"German (Standard)","de-AT":"German (Austria)","de-DE":"German (Germany)","de-LI":"German (Liechtenstein)","de-LU":"German (Luxembourg)","de-CH":"German (Switzerland)",el:"Greek",gu:"Gujurati",ht:"Haitian",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",iu:"Inuktitut",ga:"Irish",it:"Italian (Standard)","it-CH":"Italian (Switzerland)",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ky:"Kirghiz",tlh:"Klingon",ko:"Korean","ko-KP":"Korean (North Korea)","ko-KR":"Korean (South Korea)",la:"Latin",lv:"Latvian",lt:"Lithuanian",lb:"Luxembourgish",mk:"North Macedonia",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",nv:"Navajo",ng:"Ndonga",ne:"Nepali",no:"Norwegian",nb:"Norwegian (Bokmal)",nn:"Norwegian (Nynorsk)",oc:"Occitan",or:"Oriya",om:"Oromo",fa:"Persian","fa-IR":"Persian/Iran",pl:"Polish",pt:"Portuguese","pt-BR":"Portuguese (Brazil)",pa:"Punjabi","pa-IN":"Punjabi (India)","pa-PK":"Punjabi (Pakistan)",qu:"Quechua",rm:"Rhaeto-Romanic",ro:"Romanian","ro-MO":"Romanian (Moldavia)",ru:"Russian","ru-MO":"Russian (Moldavia)",sz:"Sami (Lappish)",sg:"Sango",sa:"Sanskrit",sc:"Sardinian",sd:"Sindhi",si:"Singhalese",sr:"Serbian",sk:"Slovak",sl:"Slovenian",so:"Somani",sb:"Sorbian",es:"Spanish","es-AR":"Spanish (Argentina)","es-BO":"Spanish (Bolivia)","es-CL":"Spanish (Chile)","es-CO":"Spanish (Colombia)","es-CR":"Spanish (Costa Rica)","es-DO":"Spanish (Dominican Republic)","es-EC":"Spanish (Ecuador)","es-SV":"Spanish (El Salvador)","es-GT":"Spanish (Guatemala)","es-HN":"Spanish (Honduras)","es-MX":"Spanish (Mexico)","es-NI":"Spanish (Nicaragua)","es-PA":"Spanish (Panama)","es-PY":"Spanish (Paraguay)","es-PE":"Spanish (Peru)","es-PR":"Spanish (Puerto Rico)","es-ES":"Spanish (Sp
563ain)","es-UY":"Spanish (Uruguay)","es-VE":"Spanish (Venezuela)",sx:"Sutu",sw:"Swahili",sv:"Swedish","sv-FI":"Swedish (Finland)","sv-SV":"Swedish (Sweden)",ta:"Tamil",tt:"Tatar",te:"Teluga",th:"Thai",tig:"Tigre",ts:"Tsonga",tn:"Tswana",tr:"Turkish",tk:"Turkmen",uk:"Ukrainian",hsb:"Upper Sorbian",ur:"Urdu",ve:"Venda",vi:"Vietnamese",vo:"Volapuk",wa:"Walloon",cy:"Welsh",xh:"Xhosa",ji:"Yiddish",zu:"Zulu"}[e]!==void 0&&(this.internal.languageSettings.languageCode=e,this.internal.languageSettings.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){this.internal.write("/Lang ("+this.internal.languageSettings.languageCode+")")}),this.internal.languageSettings.isSubscribed=!0)),this},ad=Xe.API,Rm=ad.getCharWidthsArray=function(e,t){var n,r,i=(t=t||{}).font||this.internal.getFont(),s=t.fontSize||this.internal.getFontSize(),a=t.charSpace||this.internal.getCharSpace(),l=t.widths?t.widths:i.metadata.Unicode.widths,c=l.fof?l.fof:1,d=t.kerning?t.kerning:i.metadata.Unicode.kerning,u=d.fof?d.fof:1,f=t.doKerning!==!1,p=0,h=e.length,x=0,g=l[0]||c,b=[];for(n=0;n<h;n++)r=e.charCodeAt(n),typeof i.metadata.widthOfString=="function"?b.push((i.metadata.widthOfGlyph(i.metadata.characterToGlyph(r))+a*(1e3/s)||0)/1e3):(p=f&&en(d[r])==="object"&&!isNaN(parseInt(d[r][x],10))?d[r][x]/u:0,b.push((l[r]||g)/c+p)),x=r;return b},LS=ad.getStringUnitWidth=function(e,t){var n=(t=t||{}).fontSize||this.internal.getFontSize(),r=t.font||this.internal.getFont(),i=t.charSpace||this.internal.getCharSpace();return ad.processArabic&&(e=ad.processArabic(e)),typeof r.metadata.widthOfString=="function"?r.metadata.widthOfString(e,n,i)/n:Rm.apply(this,arguments).reduce(function(s,a){return s+a},0)},RS=function(e,t,n,r){for(var i=[],s=0,a=e.length,l=0;s!==a&&l+t[s]<n;)l+=t[s],s++;i.push(e.slice(0,s));var c=s;for(l=0;s!==a;)l+t[s]>r&&(i.push(e.slice(c,s)),l=0,c=s),l+=t[s],s++;return c!==s&&i.push(e.slice(c,s)),i},TS=function(e,t,n){n||(n={});var r,i,s,a,l,c,d,u=[],f=[u],p=n.textIndent||0,h=0,x=0,g=e.split(" "),b=Rm.apply(this,[" ",n])[0];if(c=n.lineIndent===-1?g[0].length+2:n.lineIndent||0){var y=Array(c).join(" "),_=[];g.map(function(S){(S=S.split(/\s*\n/)).length>1?_=_.concat(S.map(function(C,P){return(P&&C.length?`
564`:"")+C})):_.push(S[0])}),g=_,c=LS.apply(this,[y,n])}for(s=0,a=g.length;s<a;s++){var w=0;if(r=g[s],c&&r[0]==`
565`&&(r=r.substr(1),w=1),p+h+(x=(i=Rm.apply(this,[r,n])).reduce(function(S,C){return S+C},0))>t||w){if(x>t){for(l=RS.apply(this,[r,i,t-(p+h),t]),u.push(l.shift()),u=[l.pop()];l.length;)f.push([l.shift()]);x=i.slice(r.length-(u[0]?u[0].length:0)).reduce(function(S,C){return S+C},0)}else u=[r];f.push(u),p=x+c,h=b}else u.push(r),p+=h+x,h=b}return d=c?function(S,C){return(C?y:"")+S.join(" ")}:function(S){return S.join(" ")},f.map(d)},ad.splitTextToSize=function(e,t,n){var r,i=(n=n||{}).fontSize||this.internal.getFontSize(),s=(function(u){if(u.widths&&u.kerning)return{widths:u.widths,kerning:u.kerning};var f=this.internal.getFont(u.fontName,u.fontStyle),p="Unicode";return f.metadata[p]?{widths:f.metadata[p].widths||{0:1},kerning:f.metadata[p].kerning||{}}:{font:f.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,n);r=Array.isArray(e)?e:String(e).split(/\r?\n/);var a=1*this.internal.scaleFactor*t/i;s.textIndent=n.textIndent?1*n.textIndent*this.internal.scaleFactor/i:0,s.lineIndent=n.lineIndent;var l,c,d=[];for(l=0,c=r.length;l<c;l++)d=d.concat(TS.apply(this,[r[l],a,s]));return d},function(e){e.__fontmetrics__=e.__fontmetrics__||{};for(var t="0123456789abcdef",n="klmnopqrstuvwxyz",r={},i={},s=0;s<16;s++)r[n[s]]=t[s],i[t[s]]=n[s];var a=function(p){return"0x"+parseInt(p,10).toString(16)},l=e.__fontmetrics__.compress=function(p){var h,x,g,b,y=["{"];for(var _ in p){if(h=p[_],isNaN(parseInt(_,10))?x="'"+_+"'":(_=parseInt(_,10),x=(x=a(_).slice(2)).slice(0,-1)+i[x.slice(-1)]),typeof h=="number")h<0?(g=a(h).slice(3),b="-"):(g=a(h).slice(2),b=""),g=b+g.slice(0,-1)+i[g.slice(-1)];else{if(en(h)!=="object")throw new Error("Don't know what to do with value type "+en(h)+".");g=l(h)}y.push(x+g)}return y.push("}"),y.join("")},c=e.__fontmetrics__.uncompress=function(p){if(typeof p!="string")throw new Error("Invalid argument passed to uncompress.");for(var h,x,g,b,y={},_=1,w=y,S=[],C="",P="",R=p.length-1,M=1;M<R;M+=1)(b=p[M])=="'"?h?(g=h.join(""),h=void 0):h=[]:h?h.push(b):b=="{"?(S.push([w,g]),w={},g=void 0):b=="}"?((x=S.pop())[0][x[1]]=w,g=void 0,w=x[0]):b=="-"?_=-1:g===void 0?r.hasOwnProperty(b)?(C+=r[b],g=parseInt(C,16)*_,_=1,C=""):C+=b:r.hasOwnProperty(b)?(P+=r[b],w[g]=parseInt(P,16)*_,_=1,g=void 0,P=""):P+=b;return y},d={codePages:["WinAnsiEncoding"],WinAnsiEncoding:c("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},u={Unicode:{Courier:d,"Courier-Bold":d,"Courier-BoldOblique":d,"Courier-Oblique":d,Helvetica:d,"Helvetica-Bold":d,"Helvetica-BoldOblique":d,"Helvetica-Oblique":d,"Times-Roman":d,"Times-Bold":d,"Times-BoldItalic":d,"Times-Italic":d}},f
vendor: 14,727 bytes, line 565
565={Unicode:{"Courier-Oblique":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":c("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":c("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":c("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:c("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:c("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":c("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:c("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":c("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":c("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":c("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};e.events.push(["addFont",function(
vendor: 48,448 bytes, lines 565-594
565p){var h=p.font,x=f.Unicode[h.postScriptName];x&&(h.metadata.Unicode={},h.metadata.Unicode.widths=x.widths,h.metadata.Unicode.kerning=x.kerning);var g=u.Unicode[h.postScriptName];g&&(h.metadata.Unicode.encoding=g,h.encoding=g.codePages[0])}])}(Xe.API),function(e){var t=function(n){for(var r=n.length,i=new Uint8Array(r),s=0;s<r;s++)i[s]=n.charCodeAt(s);return i};e.API.events.push(["addFont",function(n){var r=void 0,i=n.font,s=n.instance;if(!i.isStandardFont){if(s===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");if(typeof(r=s.existsFileInVFS(i.postScriptName)===!1?s.loadFile(i.postScriptName):s.getFileFromVFS(i.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");(function(a,l){l=/^\x00\x01\x00\x00/.test(l)?t(l):t(fg(l)),a.metadata=e.API.TTFFont.open(l),a.metadata.Unicode=a.metadata.Unicode||{encoding:{},kerning:{},widths:[]},a.metadata.glyIdsUsed=[0]})(i,r)}}])}(Xe),Xe.API.addSvgAsImage=function(e,t,n,r,i,s,a,l){if(isNaN(t)||isNaN(n))throw an.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(r)||isNaN(i))throw an.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var c=document.createElement("canvas");c.width=r,c.height=i;var d=c.getContext("2d");d.fillStyle="#fff",d.fillRect(0,0,c.width,c.height);var u={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},f=this;return(vt.canvg?Promise.resolve(vt.canvg):Dv(()=>import("./index.es-CdF3-Ojg.js"),[])).catch(function(p){return Promise.reject(new Error("Could not load canvg: "+p))}).then(function(p){return p.default?p.default:p}).then(function(p){return p.fromString(d,e,u)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(p){return p.render(u)}).then(function(){f.addImage(c.toDataURL("image/jpeg",1),t,n,r,i,a,l)})},Xe.API.putTotalPages=function(e){var t,n=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(e,"g"),n=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(e,this.internal.getFont()),"g"),n=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var r=1;r<=this.internal.getNumberOfPages();r++)for(var i=0;i<this.internal.pages[r].length;i++)this.internal.pages[r][i]=this.internal.pages[r][i].replace(t,n);return this},Xe.API.viewerPreferences=function(e,t){var n;e=e||{},t=t||!1;var r,i,s,a={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},l=Object.keys(a),c=[],d=0,u=0,f=0;function p(x,g){var b,y=!1;for(b=0;b<x.length;b+=1)x[b]===g&&(y=!0);return y}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(a)),this.internal.viewerpreferences.isSubscribed=!1),n=this.internal.viewerpreferences.configuration,e==="reset"||t===!0){var h=l.length;for(f=0;f<h;f+=1)n[l[f]].value=n[l[f]].defaultValue,n[l[f]].explicitSet=!1}if(en(e)==="object"){for(i in e)if(s=e[i],p(l,i)&&s!==void 0){if(n[i].type==="boolean"&&typeof s=="boolean")n[i].value=s;else if(n[i].type==="name"&&p(n[i].valueSet,s))n[i].value=s;else if(n[i].type==="integer"&&Number.isInteger(s))n[i].value=s;else if(n[i].type==="array"){for(d=0;d<s.length;d+=1)if(r=!0,s[d].length===1&&typeof s[d][0]=="number")c.push(String(s[d]-1));else if(s[d].length>1){for(u=0;u<s[d].length;u+=1)typeof s[d][u]!="number"&&(r=!1);r===!0&&c.push([s[d][0]-1,s[d][1]-1].join(" "))}n[i].value="["+c.join(" ")+"]"}else n[i].value=n[i].defaultValue;n[i].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var x,g=[];for(x in n)n[x].explicitSet===!0&&(n[x].type==="name"?g.push("/"+x+" /"+n[x].value):g.push("/"+x+" "+n[x].value));g.length!==0&&this.internal.write(`/ViewerPreferences
566<<
567`+g.join(`
568`)+`
569>>`)}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=n,this},Xe.API.addMetadata=function(e,t){return this.internal.__metadata__===void 0&&(this.internal.__metadata__={metadata:e,namespaceUri:t??"http://jspdf.default.namespaceuri/",rawXml:typeof t=="boolean"&&t},this.internal.events.subscribe("putCatalog",kV),this.internal.events.subscribe("postPutResources",_V)),this},function(e){var t=e.API,n=t.pdfEscape16=function(s,a){for(var l,c=a.metadata.Unicode.widths,d=["","0","00","000","0000"],u=[""],f=0,p=s.length;f<p;++f){if(l=a.metadata.characterToGlyph(s.charCodeAt(f)),a.metadata.glyIdsUsed.push(l),a.metadata.toUnicode[l]=s.charCodeAt(f),c.indexOf(l)==-1&&(c.push(l),c.push([parseInt(a.metadata.widthOfGlyph(l),10)])),l=="0")return u.join("");l=l.toString(16),u.push(d[4-l.length],l)}return u.join("")},r=function(s){var a,l,c,d,u,f,p;for(u=`/CIDInit /ProcSet findresource begin
57012 dict begin
571begincmap
572/CIDSystemInfo <<
573  /Registry (Adobe)
574  /Ordering (UCS)
575  /Supplement 0
576>> def
577/CMapName /Adobe-Identity-UCS def
578/CMapType 2 def
5791 begincodespacerange
580<0000><ffff>
581endcodespacerange`,c=[],f=0,p=(l=Object.keys(s).sort(function(h,x){return h-x})).length;f<p;f++)a=l[f],c.length>=100&&(u+=`
582`+c.length+` beginbfchar
583`+c.join(`
584`)+`
585endbfchar`,c=[]),s[a]!==void 0&&s[a]!==null&&typeof s[a].toString=="function"&&(d=("0000"+s[a].toString(16)).slice(-4),a=("0000"+(+a).toString(16)).slice(-4),c.push("<"+a+"><"+d+">"));return c.length&&(u+=`
586`+c.length+` beginbfchar
587`+c.join(`
588`)+`
589endbfchar
590`),u+`endcmap
591CMapName currentdict /CMap defineresource pop
592end
593end`};t.events.push(["putFont",function(s){(function(a){var l=a.font,c=a.out,d=a.newObject,u=a.putStream;if(l.metadata instanceof e.API.TTFFont&&l.encoding==="Identity-H"){for(var f=l.metadata.Unicode.widths,p=l.metadata.subset.encode(l.metadata.glyIdsUsed,1),h="",x=0;x<p.length;x++)h+=String.fromCharCode(p[x]);var g=d();u({data:h,addLength1:!0,objectId:g}),c("endobj");var b=d();u({data:r(l.metadata.toUnicode),addLength1:!0,objectId:b}),c("endobj");var y=d();c("<<"),c("/Type /FontDescriptor"),c("/FontName /"+yd(l.fontName)),c("/FontFile2 "+g+" 0 R"),c("/FontBBox "+e.API.PDFObject.convert(l.metadata.bbox)),c("/Flags "+l.metadata.flags),c("/StemV "+l.metadata.stemV),c("/ItalicAngle "+l.metadata.italicAngle),c("/Ascent "+l.metadata.ascender),c("/Descent "+l.metadata.decender),c("/CapHeight "+l.metadata.capHeight),c(">>"),c("endobj");var _=d();c("<<"),c("/Type /Font"),c("/BaseFont /"+yd(l.fontName)),c("/FontDescriptor "+y+" 0 R"),c("/W "+e.API.PDFObject.convert(f)),c("/CIDToGIDMap /Identity"),c("/DW 1000"),c("/Subtype /CIDFontType2"),c("/CIDSystemInfo"),c("<<"),c("/Supplement 0"),c("/Registry (Adobe)"),c("/Ordering ("+l.encoding+")"),c(">>"),c(">>"),c("endobj"),l.objectNumber=d(),c("<<"),c("/Type /Font"),c("/Subtype /Type0"),c("/ToUnicode "+b+" 0 R"),c("/BaseFont /"+yd(l.fontName)),c("/Encoding /"+l.encoding),c("/DescendantFonts ["+_+" 0 R]"),c(">>"),c("endobj"),l.isAlreadyPutted=!0}})(s)}]),t.events.push(["putFont",function(s){(function(a){var l=a.font,c=a.out,d=a.newObject,u=a.putStream;if(l.metadata instanceof e.API.TTFFont&&l.encoding==="WinAnsiEncoding"){for(var f=l.metadata.rawData,p="",h=0;h<f.length;h++)p+=String.fromCharCode(f[h]);var x=d();u({data:p,addLength1:!0,objectId:x}),c("endobj");var g=d();u({data:r(l.metadata.toUnicode),addLength1:!0,objectId:g}),c("endobj");var b=d();c("<<"),c("/Descent "+l.metadata.decender),c("/CapHeight "+l.metadata.capHeight),c("/StemV "+l.metadata.stemV),c("/Type /FontDescriptor"),c("/FontFile2 "+x+" 0 R"),c("/Flags 96"),c("/FontBBox "+e.API.PDFObject.convert(l.metadata.bbox)),c("/FontName /"+yd(l.fontName)),c("/ItalicAngle "+l.metadata.italicAngle),c("/Ascent "+l.metadata.ascender),c(">>"),c("endobj"),l.objectNumber=d();for(var y=0;y<l.metadata.hmtx.widths.length;y++)l.metadata.hmtx.widths[y]=parseInt(l.metadata.hmtx.widths[y]*(1e3/l.metadata.head.unitsPerEm));c("<</Subtype/TrueType/Type/Font/ToUnicode "+g+" 0 R/BaseFont/"+yd(l.fontName)+"/FontDescriptor "+b+" 0 R/Encoding/"+l.encoding+" /FirstChar 29 /LastChar 255 /Widths "+e.API.PDFObject.convert(l.metadata.hmtx.widths)+">>"),c("endobj"),l.isAlreadyPutted=!0}})(s)}]);var i=function(s){var a,l=s.text||"",c=s.x,d=s.y,u=s.options||{},f=s.mutex||{},p=f.pdfEscape,h=f.activeFontKey,x=f.fonts,g=h,b="",y=0,_="",w=x[g].encoding;if(x[g].encoding!=="Identity-H")return{text:l,x:c,y:d,options:u,mutex:f};for(_=l,g=h,Array.isArray(l)&&(_=l[0]),y=0;y<_.length;y+=1)x[g].metadata.hasOwnProperty("cmap")&&(a=x[g].metadata.cmap.unicode.codeMap[_[y].charCodeAt(0)]),a||_[y].charCodeAt(0)<256&&x[g].metadata.hasOwnProperty("Unicode")?b+=_[y]:b+="";var S="";return parseInt(g.slice(1))<14||w==="WinAnsiEncoding"?S=p(b,g).split("").map(function(C){return C.charCodeAt(0).toString(16)}).join(""):w==="Identity-H"&&(S=n(b,x[g])),f.isHex=!0,{text:S,x:c,y:d,options:u,mutex:f}};t.events.push(["postProcessText",function(s){var a=s.text||"",l=[],c={text:a,x:s.x,y:s.y,options:s.options,mutex:s.mutex};if(Array.isArray(a)){var d=0;for(d=0;d<a.length;d+=1)Array.isArray(a[d])&&a[d].length===3?l.push([i(Object.assign({},c,{text:a[d][0]})).text,a[d][1],a[d][2]]):l.push(i(Object.assign({},c,{text:a[d]})).text);s.text=l}else s.text=i(Object.assign({},c,{text:a})).text}])}(Xe),function(e){var t=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};e.existsFileInVFS=function(n){return t.call(this),this.internal.vFS[n]!==void 0},e.addFileToVFS=function(n,r){return t.call(this),this.internal.vFS[n]=r,this},e.getFileFromVFS=function(n){return t.call(this),this.internal.vFS[n]!==void 0?this.internal.vFS[n]:null}}(Xe.API),function(e){e.__bidiEngine__=e.prototype.__bidiEngine__=function(r){var i,s,a,l,c,d,u,f=t,p=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],h=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],x={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},g={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},b=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],y=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),_=!1,w=0;this.__bidiEngine__={};var S=function(A){var O=A.charCodeAt(),K=O>>8,U=g[K];return U!==void 0?f[256*U+(255&O)]:K===252||K===253?"AL":y.test(K)?"L":K===8?"R":"N"},C=function(A){for(var O,K=0;K<A.length;K++){if((O=S(A.charAt(K)))==="L")return!1;if(O==="R")return!0}return!1},P=function(A,O,K,U){var I,re,V,$,D=O[U];switch(D){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":_=!1;break;case"N":case"AN":break;case"EN":_&&(D="AN");break;case"AL":_=!0,D="R";break;case"WS":case"BN":D="N";break;case"CS":U<1||U+1>=O.length||(I=K[U-1])!=="EN"&&I!=="AN"||(re=O[U+1])!=="EN"&&re!=="AN"?D="N":_&&(re="AN"),D=re===I?re:"N";break;case"ES":D=(I=U>0?K[U-1]:"B")==="EN"&&U+1<O.length&&O[U+1]==="EN"?"EN":"N";break;case"ET":if(U>0&&K[U-1]==="EN"){D="EN";break}if(_){D="N";break}for(V=U+1,$=O.length;V<$&&O[V]==="ET";)V++;D=V<$&&O[V]==="EN"?"EN":"N";break;case"NSM":if(a&&!l){for($=O.length,V=U+1;V<$&&O[V]==="NSM";)V++;if(V<$){var ie=A[U],X=ie>=1425&&ie<=2303||ie===64286;if(I=O[V],X&&(I==="R"||I==="AL")){D="R";break}}}D=U<1||(I=O[U-1])==="B"?"N":K[U-1];break;case"B":_=!1,i=!0,D=w;break;case"S":s=!0,D="N"}return D},R=function(A,O,K){var U=A.split("");return K&&M(U,K,{hiLevel:w}),U.reverse(),O&&O.reverse(),U.join("")},M=function(A,O,K){var U,I,re,V,$,D=-1,ie=A.length,X=0,E=[],q=w?h:p,F=[];for(_=!1,i=!1,s=!1,I=0;I<ie;I++)F[I]=S(A[I]);for(re=0;re<ie;re++){if($=X,E[re]=P(A,F,E,re),U=240&(X=q[$][x[E[re]]]),X&=15,O[re]=V=q[X][5],U>0)if(U===16){for(I=D;I<re;I++)O[I]=1;D=-1}else D=-1;if(q[X][6])D===-1&&(D=re);else if(D>-1){for(I=D;I<re;I++)O[I]=V;D=-1}F[re]==="B"&&(O[re]=0),K.hiLevel|=V}s&&function(Z,Y,ee){for(var ce=0;ce<ee;ce++)if(Z[ce]==="S"){Y[ce]=w;for(var ue=ce-1;ue>=0&&Z[ue]==="WS";ue--)Y[ue]=w}}(F,O,ie)},T=function(A,O,K,U,I){if(!(I.hiLevel<A)){if(A===1&&w===1&&!i)return O.reverse(),void(K&&K.reverse());for(var re,V,$,D,ie=O.length,X=0;X<ie;){if(U[X]>=A){for($=X+1;$<ie&&U[$]>=A;)$++;for(D=X,V=$-1;D<V;D++,V--)re=O[D],O[D]=O[V],O[V]=re,K&&(re=K[D],K[D]=K[V],K[V]=re);X=$}X++}}},H=function(A,O,K){var U=A.split(""),I={hiLevel:w};return K||(K=[]),M(U,K,I),function(re,V,$){if($.hiLevel!==0&&u)for(var D,ie=0;ie<re.length;ie++)V[ie]===1&&(D=b.indexOf(re[ie]))>=0&&(re[ie]=b[D+1])}(U,K,I),T(2,U,O,K,I),T(1,U,O,K,I),U.join("")};return this.__bidiEngine__.doBidiReorder=function(A,O,K){if(function(I,re){if(re)for(var V=0;V<I.length;V++)re[V]=V;l===void 0&&(l=C(I)),d===void 0&&(d=C(I))}(A,O),a||!c||d)if(a&&c&&l^d)w=l?1:0,A=R(A,O,K);else if(!a&&c&&d)w=l?1:0,A=H(A,O,K),A=R(A,O);else if(!a||l||c||d){if(a&&!c&&l^d)A=R(A,O),l?(w=0,A=H(A,O,K)):(w=1,A=H(A,O,K),A=R(A,O));else if(a&&l&&!c&&d)w=1,A=H(A,O,K),A=R(A,O);else if(!a&&!c&&l^d){var U=u;l?(w=1,A=H(A,O,K),w=0,u=!1,A=H(A,O,K),u=U):(w=0,A=H(A,O,K),A=R(A,O),w=1,u=!1,A=H(A,O,K),u=U,A=R(A,O))}}else w=0,A=H(A,O,K);else w=l?1:0,A=H(A,O,K);return A},this.__bidiEngine__.setOptions=function(A){A&&(a=A.isInputVisual,c=A.isOutputVisual,l=A.isInputRtl,d=A.isOutputRtl,u=A.isSymmetricSwapping)},this.__bidiEngine__.setOptions(r),this.__bidiEngine__};var t=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],n=new e.__bidiEngine__({isInputVisual:!0});e.API.events.push(["postProcessText",function(r){var i=r.text;r.x,r.y;var s=r.options||{};r.mutex,s.lang;var a=[];if(s.isInputVisual=typeof s.isInputVisual!="boolean"||s.isInputVisual,n.setOptions(s),Object.prototype.toString.call(i)==="[object Array]"){var l=0;for(a=[],l=0;l<i.length;l+=1)Object.prototype.toString.call(i[l])==="[object Array]"?a.push([n.doBidiReorder(i[l][0]),i[l][1],i[l][2]]):a.push([n.doBidiReorder(i[l])]);r.text=a}else r.text=n.doBidiReorder(i);n.setOptions({isInputVisual:!0})}])}(Xe),Xe.API.TTFFont=function(){function e(t){var n;if(this.rawData=t,n=this.contents=new al(t),this.contents.pos=4,n.readString(4)==="ttcf")throw new Error("TTCF not supported.");n.pos=0,this.parse(),this.subset=new MV(this),this.registerTTF()}return e.open=function(t){return new e(t)},e.prototype.parse=function(){return this.directory=new NV(this.contents),this.head=new jV(this),this.name=new LV(this),this.cmap=new oP(this),this.toUnicode={},this.hhea=new EV(this),this.maxp=new RV(this),this.hmtx=new TV(this),this.post=new AV(this),this.os2=new CV(this),this.loca=new FV(this),this.glyf=new OV(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},e.prototype.registerTTF=function(){var t,n,r,i,s;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=(function(){var a,l,c,d;for(d=[],a=0,l=(c=this.bbox).length;a<l;a++)t=c[a],d.push(Math.round(t*this.scaleFactor));return d}).call(this),this.stemV=0,this.post.exists?(r=255&(i=this.post.italic_angle),32768&(n=i>>16)&&(n=-(1+(65535^n))),this.italicAngle=+(n+"."+r)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(s=this.familyClass)===1||s===2||s===3||s===4||s===5||s===7,this.isScript=this.familyClass===10,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),this.italicAngle!==0&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},e.prototype.characterToGlyph=function(t){var n;return((n=this.cmap.unicode)!=null?n.codeMap[t]:void 0)||0},e.prototype.widthOfGlyph=function(t){var n;return n=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(t).advance*n},e.prototype.widthOfString=function(t,n,r){var i,s,a,l;for(a=0,s=0,l=(t=""+t).length;0<=l?s<l:s>l;s=0<=l?++s:--s)i=t.charCodeAt(s),a+=this.widthOfGlyph(this.characterToGlyph(i))+r*(1e3/n)||0;return a*(n/1e3)},e.prototype.lineHeight=function(t,n){var r;return n==null&&(n=!1),r=n?this.lineGap:0,(this.ascender+r-this.decender)/1e3*t},e}();var Ps,al=function(){function e(t){this.data=t??[],this.pos=0,this.length=this.data.length}return e.prototype.readByte=function(){return this.data[this.pos++]},e.prototype.writeByte=function(t){return this.data[this.pos++]=t},e.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},e.prototype.writeUInt32=function(t){return this.writeByte(t>>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(255&t)},e.prototype.readInt32=function(){var t;return(t=this.readUInt32())>=2147483648?t-4294967296:t},e.prototype.writeInt32=function(t){return t<0&&(t+=4294967296),this.writeUInt32(t)},e.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},e.prototype.writeUInt16=function(t){return this.writeByte(t>>8&255),this.writeByte(255&t)},e.prototype.readInt16=function(){var t;return(t=this.readUInt16())>=32768?t-65536:t},e.prototype.writeInt16=function(t){return t<0&&(t+=65536),this.writeUInt16(t)},e.prototype.readString=function(t){var n,r;for(r=[],n=0;0<=t?n<t:n>t;n=0<=t?++n:--n)r[n]=String.fromCharCode(this.readByte());return r.join("")},e.prototype.writeString=function(t){var n,r,i;for(i=[],n=0,r=t.length;0<=r?n<r:n>r;n=0<=r?++n:--n)i.push(this.writeByte(t.charCodeAt(n)));return i},e.prototype.readShort=function(){return this.readInt16()},e.prototype.writeShort=function(t){return this.writeInt16(t)},e.prototype.readLongLong=function(){var t,n,r,i,s,a,l,c;return t=this.readByte(),n=this.readByte(),r=this.readByte(),i=this.readByte(),s=this.readByte(),a=this.readByte(),l=this.readByte(),c=this.readByte(),128&t?-1*(72057594037927940*(255^t)+281474976710656*(255^n)+1099511627776*(255^r)+4294967296*(255^i)+16777216*(255^s)+65536*(255^a)+256*(255^l)+(255^c)+1):72057594037927940*t+281474976710656*n+1099511627776*r+4294967296*i+16777216*s+65536*a+256*l+c},e.prototype.writeLongLong=function(t){var n,r;return n=Math.floor(t/4294967296),r=4294967295&t,this.writeByte(n>>24&255),this.writeByte(n>>16&255),this.writeByte(n>>8&255),this.writeByte(255&n),this.writeByte(r>>24&255),this.writeByte(r>>16&255),this.writeByte(r>>8&255),this.writeByte(255&r)},e.prototype.readInt=function(){return this.readInt32()},e.prototype.writeInt=function(t){return this.writeInt32(t)},e.prototype.read=function(t){var n,r;for(n=[],r=0;0<=t?r<t:r>t;r=0<=t?++r:--r)n.push(this.readByte());return n},e.prototype.write=function(t){var n,r,i,s;for(s=[],r=0,i=t.length;r<i;r++)n=t[r],s.push(this.writeByte(n));return s},e}(),NV=function(){var e;function t(n){var r,i,s;for(this.scalarType=n.readInt(),this.tableCount=n.readShort(),this.searchRange=n.readShort(),this.entrySelector=n.readShort(),this.rangeShift=n.readShort(),this.tables={},i=0,s=this.tableCount;0<=s?i<s:i>s;i=0<=s?++i:--i)r={tag:n.readString(4),checksum:n.readInt(),offset:n.readInt(),length:n.readInt()},this.tables[r.tag]=r}return t.prototype.encode=function(n){var r,i,s,a,l,c,d,u,f,p,h,x,g;for(g in h=Object.keys(n).length,c=Math.log(2),f=16*Math.floor(Math.log(h)/c),a=Math.floor(f/c),u=16*h-f,(i=new al).writeInt(this.scalarType),i.writeShort(h),i.writeShort(f),i.writeShort(a),i.writeShort(u),s=16*h,d=i.pos+s,l=null,x=[],n)for(p=n[g],i.writeString(g),i.writeInt(e(p)),i.writeInt(d),i.writeInt(p.length),x=x.concat(p),g==="head"&&(l=d),d+=p.length;d%4;)x.push(0),d++;return i.write(x),r=2981146554-e(i.data),i.pos=l+8,i.writeUInt32(r),i.data},e=function(n){var r,i,s,a;for(n=aP.call(n);n.length%4;)n.push(0);for(s=new al(n),i=0,r=0,a=n.length;r<a;r=r+=4)i+=s.readUInt32();return 4294967295&i},t}(),SV={}.hasOwnProperty,mo=function(e,t){for(var n in t)SV.call(t,n)&&(e[n]=t[n]);function r(){this.constructor=e}return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};Ps=function(){function e(t){var n;this.file=t,n=this.file.directory.tables[this.tag],this.exists=!!n,n&&(this.offset=n.offset,this.length=n.length,this.parse(this.file.contents))}return e.prototype.parse=function(){},e.prototype.encode=function(){},e.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},e}();var jV=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return mo(e,Ps),e.prototype.tag="head",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.revision=t.readInt(),this.checkSumAdjustment=t.readInt(),this.magicNumber=t.readInt(),this.flags=t.readShort(),this.unitsPerEm=t.readShort(),this.created=t.readLongLong(),this.modified=t.readLongLong(),this.xMin=t.readShort(),this.yMin=t.readShort(),this.xMax=t.readShort(),this.yMax=t.readShort(),this.macStyle=t.readShort(),this.lowestRecPPEM=t.readShort(),this.fontDirectionHint=t.readShort(),this.indexToLocFormat=t.readShort(),this.glyphDataFormat=t.readShort()},e.prototype.encode=function(t){var n;return(n=new al).writeInt(this.version),n.writeInt(this.revision),n.writeInt(this.checkSumAdjustment),n.writeInt(this.magicNumber),n.writeShort(this.flags),n.writeShort(this.unitsPerEm),n.writeLongLong(this.created),n.writeLongLong(this.modified),n.writeShort(this.xMin),n.writeShort(this.yMin),n.writeShort(this.xMax),n.writeShort(this.yMax),n.writeShort(this.macStyle),n.writeShort(this.lowestRecPPEM),n.writeShort(this.fontDirectionHint),n.writeShort(t),n.writeShort(this.glyphDataFormat),n.data},e}(),zS=function(){function e(t,n){var r,i,s,a,l,c,d,u,f,p,h,x,g,b,y,_,w;switch(this.platformID=t.readUInt16(),this.encodingID=t.readShort(),this.offset=n+t.readInt(),f=t.pos,t.pos=this.offset,this.format=t.readUInt16(),this.length=t.readUInt16(),this.language=t.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(c=0;c<256;++c)this.codeMap[c]=t.readByte();break;case 4:for(h=t.readUInt16(),p=h/2,t.pos+=6,s=function(){var S,C;for(C=[],c=S=0;0<=p?S<p:S>p;c=0<=p?++S:--S)C.push(t.readUInt16());return C}(),t.pos+=2,g=function(){var S,C;for(C=[],c=S=0;0<=p?S<p:S>p;c=0<=p?++S:--S)C.push(t.readUInt16());return C}(),d=function(){var S,C;for(C=[],c=S=0;0<=p?S<p:S>p;c=0<=p?++S:--S)C.push(t.readUInt16());return C}(),u=function(){var S,C;for(C=[],c=S=0;0<=p?S<p:S>p;c=0<=p?++S:--S)C.push(t.readUInt16());return C}(),i=(this.length-t.pos+this.offset)/2,l=function(){var S,C;for(C=[],c=S=0;0<=i?S<i:S>i;c=0<=i?++S:--S)C.push(t.readUInt16());return C}(),c=y=0,w=s.length;y<w;c=++y)for(b=s[c],r=_=x=g[c];x<=b?_<=b:_>=b;r=x<=b?++_:--_)u[c]===0?a=r+d[c]:(a=l[u[c]/2+(r-x)-(p-c)]||0)!==0&&(a+=d[c]),this.codeMap[r]=65535&a}t.pos=f}return e.encode=function(t,n){var r,i,s,a,l,c,d,u,f,p,h,x,g,b,y,_,w,S,C,P,R,M,T,H,A,O,K,U,I,re,V,$,D,ie,X,E,q,F,Z,Y,ee,ce,ue,ye,Se,De;switch(U=new al,a=Object.keys(t).sort(function(Re,qe){return Re-qe}),n){case"macroman":for(g=0,b=function(){var Re=[];for(x=0;x<256;++x)Re.push(0);return Re}(),_={0:0},s={},I=0,D=a.length;I<D;I++)_[ue=t[i=a[I]]]==null&&(_[ue]=++g),s[i]={old:t[i],new:_[t[i]]},b[i]=_[t[i]];return U.writeUInt16(1),U.writeUInt16(0),U.writeUInt32(12),U.writeUInt16(0),U.writeUInt16(262),U.writeUInt16(0),U.write(b),{charMap:s,subtable:U.data,maxGlyphID:g+1};case"unicode":for(O=[],f=[],w=0,_={},r={},y=d=null,re=0,ie=a.length;re<ie;re++)_[C=t[i=a[re]]]==null&&(_[C]=++w),r[i]={old:C,new:_[C]},l=_[C]-i,y!=null&&l===d||(y&&f.push(y),O.push(i),d=l),y=i;for(y&&f.push(y),f.push(65535),O.push(65535),H=2*(T=O.length),M=2*Math.pow(Math.log(T)/Math.LN2,2),p=Math.log(M/2)/Math.LN2,R=2*T-M,c=[],P=[],h=[],x=V=0,X=O.length;V<X;x=++V){if(A=O[x],u=f[x],A===65535){c.push(0),P.push(0);break}if(A-(K=r[A].new)>=32768)for(c.push(0),P.push(2*(h.length+T-x)),i=$=A;A<=u?$<=u:$>=u;i=A<=u?++$:--$)h.push(r[i].new);else c.push(K-A),P.push(0)}for(U.writeUInt16(3),U.writeUInt16(1),U.writeUInt32(12),U.writeUInt16(4),U.writeUInt16(16+8*T+2*h.length),U.writeUInt16(0),U.writeUInt16(H),U.writeUInt16(M),U.writeUInt16(p),U.writeUInt16(R),ee=0,E=f.length;ee<E;ee++)i=f[ee],U.writeUInt16(i);for(U.writeUInt16(0),ce=0,q=O.length;ce<q;ce++)i=O[ce],U.writeUInt16(i);for(ye=0,F=c.length;ye<F;ye++)l=c[ye],U.writeUInt16(l);for(Se=0,Z=P.length;Se<Z;Se++)S=P[Se],U.writeUInt16(S);for(De=0,Y=h.length;De<Y;De++)g=h[De],U.writeUInt16(g);return{charMap:r,subtable:U.data,maxGlyphID:w+1}}},e}(),oP=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return mo(e,Ps),e.prototype.tag="cmap",e.prototype.parse=function(t){var n,r,i;for(t.pos=this.offset,this.version=t.readUInt16(),i=t.readUInt16(),this.tables=[],this.unicode=null,r=0;0<=i?r<i:r>i;r=0<=i?++r:--r)n=new zS(t,this.offset),this.tables.push(n),n.isUnicode&&this.unicode==null&&(this.unicode=n);return!0},e.encode=function(t,n){var r,i;return n==null&&(n="macroman"),r=zS.encode(t,n),(i=new al).writeUInt16(0),i.writeUInt16(1),r.table=i.data.concat(r.subtable),r},e}(),EV=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return mo(e,Ps),e.prototype.tag="hhea",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.ascender=t.readShort(),this.decender=t.readShort(),this.lineGap=t.readShort(),this.advanceWidthMax=t.readShort(),this.minLeftSideBearing=t.readShort(),this.minRightSideBearing=t.readShort(),this.xMaxExtent=t.readShort(),this.caretSlopeRise=t.readShort(),this.caretSlopeRun=t.readShort(),this.caretOffset=t.readShort(),t.pos+=8,this.metricDataFormat=t.readShort(),this.numberOfMetrics=t.readUInt16()},e}(),CV=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return mo(e,Ps),e.prototype.tag="OS/2",e.prototype.parse=function(t){if(t.pos=this.offset,this.version=t.readUInt16(),this.averageCharWidth=t.readShort(),this.weightClass=t.readUInt16(),this.widthClass=t.readUInt16(),this.type=t.readShort(),this.ySubscriptXSize=t.readShort(),this.ySubscriptYSize=t.readShort(),this.ySubscriptXOffset=t.readShort(),this.ySubscriptYOffset=t.readShort(),this.ySuperscriptXSize=t.readShort(),this.ySuperscriptYSize=t.readShort(),this.ySuperscriptXOffset=t.readShort(),this.ySuperscriptYOffset=t.readShort(),this.yStrikeoutSize=t.readShort(),this.yStrikeoutPosition=t.readShort(),this.familyClass=t.readShort(),this.panose=function(){var n,r;for(r=[],n=0;n<10;++n)r.push(t.readByte());return r}(),this.charRange=function(){var n,r;for(r=[],n=0;n<4;++n)r.push(t.readInt());return r}(),this.vendorID=t.readString(4),this.selection=t.readShort(),this.firstCharIndex=t.readShort(),this.lastCharIndex=t.readShort(),this.version>0&&(this.ascent=t.readShort(),this.descent=t.readShort(),this.lineGap=t.readShort(),this.winAscent=t.readShort(),this.winDescent=t.readShort(),this.codePageRange=function(){var n,r;for(r=[],n=0;n<2;n=++n)r.push(t.readInt());return r}(),this.version>1))return this.xHeight=t.readShort(),this.capHeight=t.readShort(),this.defaultChar=t.readShort(),this.breakChar=t.readShort(),this.maxContext=t.readShort()},e}(),AV=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return mo(e,Ps),e.prototype.tag="post",e.prototype.parse=function(t){var n,r,i;switch(t.pos=this.offset,this.format=t.readInt(),this.italicAngle=t.readInt(),this.underlinePosition=t.readShort(),this.underlineThickness=t.readShort(),this.isFixedPitch=t.readInt(),this.minMemType42=t.readInt(),this.maxMemType42=t.readInt(),this.minMemType1=t.readInt(),this.maxMemType1=t.readInt(),this.format){case 65536:case 196608:break;case 131072:var s;for(r=t.readUInt16(),this.glyphNameIndex=[],s=0;0<=r?s<r:s>r;s=0<=r?++s:--s)this.glyphNameIndex.push(t.readUInt16());for(this.names=[],i=[];t.pos<this.offset+this.length;)n=t.readByte(),i.push(this.names.push(t.readString(n)));return i;case 151552:return r=t.readUInt16(),this.offsets=t.read(r);case 262144:return this.map=(function(){var a,l,c;for(c=[],s=a=0,l=this.file.maxp.numGlyphs;0<=l?a<l:a>l;s=0<=l?++a:--a)c.push(t.readUInt32());return c}).call(this)}},e}(),PV=function(e,t){this.raw=e,this.length=e.length,this.platformID=t.platformID,this.encodingID=t.encodingID,this.languageID=t.languageID},LV=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return mo(e,Ps),e.prototype.tag="name",e.prototype.parse=function(t){var n,r,i,s,a,l,c,d,u,f,p;for(t.pos=this.offset,t.readShort(),n=t.readShort(),l=t.readShort(),r=[],s=0;0<=n?s<n:s>n;s=0<=n?++s:--s)r.push({platformID:t.readShort(),encodingID:t.readShort(),languageID:t.readShort(),nameID:t.readShort(),length:t.readShort(),offset:this.offset+l+t.readShort()});for(c={},s=u=0,f=r.length;u<f;s=++u)i=r[s],t.pos=i.offset,d=t.readString(i.length),a=new PV(d,i),c[p=i.nameID]==null&&(c[p]=[]),c[i.nameID].push(a);this.strings=c,this.copyright=c[0],this.fontFamily=c[1],this.fontSubfamily=c[2],this.uniqueSubfamily=c[3],this.fontName=c[4],this.version=c[5];try{this.postscriptName=c[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch{this.postscriptName=c[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=c[7],this.manufacturer=c[8],this.designer=c[9],this.description=c[10],this.vendorUrl=c[11],this.designerUrl=c[12],this.license=c[13],this.licenseUrl=c[14],this.preferredFamily=c[15],this.preferredSubfamily=c[17],this.compatibleFull=c[18],this.sampleText=c[19]},e}(),RV=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return mo(e,Ps),e.prototype.tag="maxp",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.numGlyphs=t.readUInt16(),this.maxPoints=t.readUInt16(),this.maxContours=t.readUInt16(),this.maxCompositePoints=t.readUInt16(),this.maxComponentContours=t.readUInt16(),this.maxZones=t.readUInt16(),this.maxTwilightPoints=t.readUInt16(),this.maxStorage=t.readUInt16(),this.maxFunctionDefs=t.readUInt16(),this.maxInstructionDefs=t.readUInt16(),this.maxStackElements=t.readUInt16(),this.maxSizeOfInstructions=t.readUInt16(),this.maxComponentElements=t.readUInt16(),this.maxComponentDepth=t.readUInt16()},e}(),TV=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return mo(e,Ps),e.prototype.tag="hmtx",e.prototype.parse=function(t){var n,r,i,s,a,l,c;for(t.pos=this.offset,this.metrics=[],n=0,l=this.file.hhea.numberOfMetrics;0<=l?n<l:n>l;n=0<=l?++n:--n)this.metrics.push({advance:t.readUInt16(),lsb:t.readInt16()});for(i=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=function(){var d,u;for(u=[],n=d=0;0<=i?d<i:d>i;n=0<=i?++d:--d)u.push(t.readInt16());return u}(),this.widths=(function(){var d,u,f,p;for(p=[],d=0,u=(f=this.metrics).length;d<u;d++)s=f[d],p.push(s.advance);return p}).call(this),r=this.widths[this.widths.length-1],c=[],n=a=0;0<=i?a<i:a>i;n=0<=i?++a:--a)c.push(this.widths.push(r));return c},e.prototype.forGlyph=function(t){return t in this.metrics?this.metrics[t]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[t-this.metrics.length]}},e}(),aP=[].slice,OV=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return mo(e,Ps),e.prototype.tag="glyf",e.prototype.parse=function(){return this.cache={}},e.prototype.glyphFor=function(t){var n,r,i,s,a,l,c,d,u,f;return t in this.cache?this.cache[t]:(s=this.file.loca,n=this.file.contents,r=s.indexOf(t),(i=s.lengthOf(t))===0?this.cache[t]=null:(n.pos=this.offset+r,a=(l=new al(n.read(i))).readShort(),d=l.readShort(),f=l.readShort(),c=l.readShort(),u=l.readShort(),this.cache[t]=a===-1?new DV(l,d,f,c,u):new IV(l,a,d,f,c,u),this.cache[t]))},e.prototype.encode=function(t,n,r){var i,s,a,l,c;for(a=[],s=[],l=0,c=n.length;l<c;l++)i=t[n[l]],s.push(a.length),i&&(a=a.concat(i.encode(r)));return s.push(a.length),{table:a,offsets:s}},e}(),IV=function(){function e(t,n,r,i,s,a){this.raw=t,this.numberOfContours=n,this.xMin=r,this.yMin=i,this.xMax=s,this.yMax=a,this.compound=!1}return e.prototype.encode=function(){return this.raw.data},e}(),DV=function(){function e(t,n,r,i,s){var a,l;for(this.raw=t,this.xMin=n,this.yMin=r,this.xMax=i,this.yMax=s,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],a=this.raw;l=a.readShort(),this.glyphOffsets.push(a.pos),this.glyphIDs.push(a.readUInt16()),32&l;)a.pos+=1&l?4:2,128&l?a.pos+=8:64&l?a.pos+=4:8&l&&(a.pos+=2)}return e.prototype.encode=function(){var t,n,r;for(n=new al(aP.call(this.raw.data)),t=0,r=this.glyphIDs.length;t<r;++t)n.pos=this.glyphOffsets[t];return n.data},e}(),FV=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return mo(e,Ps),e.prototype.tag="loca",e.prototype.parse=function(t){var n,r;return t.pos=this.offset,n=this.file.head.indexToLocFormat,this.offsets=n===0?(function(){var i,s;for(s=[],r=0,i=this.length;r<i;r+=2)s.push(2*t.readUInt16());return s}).call(this):(function(){var i,s;for(s=[],r=0,i=this.length;r<i;r+=4)s.push(t.readUInt32());return s}).call(this)},e.prototype.indexOf=function(t){return this.offsets[t]},e.prototype.lengthOf=function(t){return this.offsets[t+1]-this.offsets[t]},e.prototype.encode=function(t,n){for(var r=new Uint32Array(this.offsets.length),i=0,s=0,a=0;a<r.length;++a)if(r[a]=i,s<n.length&&n[s]==a){++s,r[a]=i;var l=this.offsets[a],c=this.offsets[a+1]-l;c>0&&(i+=c)}for(var d=new Array(4*r.length),u=0;u<r.length;++u)d[4*u+3]=255&r[u],d[4*u+2]=(65280&r[u])>>8,d[4*u+1]=(16711680&r[u])>>16,d[4*u]=(4278190080&r[u])>>24;return d},e}(),MV=function(){function e(t){this.font=t,this.subset={},this.unicodes={},this.next=33}return e.prototype.generateCmap=function(){var t,n,r,i,s;for(n in i=this.font.cmap.tables[0].codeMap,t={},s=this.subset)r=s[n],t[n]=i[r];return t},e.prototype.glyphsFor=function(t){var n,r,i,s,a,l,c;for(i={},a=0,l=t.length;a<l;a++)i[s=t[a]]=this.font.glyf.glyphFor(s);for(s in n=[],i)(r=i[s])!=null&&r.compound&&n.push.apply(n,r.glyphIDs);if(n.length>0)for(s in c=this.glyphsFor(n))r=c[s],i[s]=r;return i},e.prototype.encode=function(t,n){var r,i,s,a,l,c,d,u,f,p,h,x,g,b,y;for(i in r=oP.encode(this.generateCmap(),"unicode"),a=this.glyphsFor(t),h={0:0},y=r.charMap)h[(c=y[i]).old]=c.new;for(x in p=r.maxGlyphID,a)x in h||(h[x]=p++);return u=function(_){var w,S;for(w in S={},_)S[_[w]]=w;return S}(h),f=Object.keys(u).sort(function(_,w){return _-w}),g=function(){var _,w,S;for(S=[],_=0,w=f.length;_<w;_++)l=f[_],S.push(u[l]);return S}(),s=this.font.glyf.encode(a,g,h),d=this.font.loca.encode(s.offsets,g),b={cmap:this.font.cmap.raw(),glyf:s.table,loca:d,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(n)},this.font.os2.exists&&(b["OS/2"]=this.font.os2.raw()),this.font.directory.encode(b)},e}();Xe.API.PDFObject=function(){var e;function t(){}return e=function(n,r){return(Array(r+1).join("0")+n).slice(-r)},t.convert=function(n){var r,i,s,a;if(Array.isArray(n))return"["+function(){var l,c,d;for(d=[],l=0,c=n.length;l<c;l++)r=n[l],d.push(t.convert(r));return d}().join(" ")+"]";if(typeof n=="string")return"/"+n;if(n!=null&&n.isString)return"("+n+")";if(n instanceof Date)return"(D:"+e(n.getUTCFullYear(),4)+e(n.getUTCMonth(),2)+e(n.getUTCDate(),2)+e(n.getUTCHours(),2)+e(n.getUTCMinutes(),2)+e(n.getUTCSeconds(),2)+"Z)";if({}.toString.call(n)==="[object Object]"){for(i in s=["<<"],n)a=n[i],s.push("/"+i+" "+t.convert(a));return s.push(">>"),s.join(`
594`)}return""+n},t}();const N1={pending_review:"Pending",approved:"Approved",listed:"Listed",sold:"Sold",declined:"Declined"},S1=e=>{const t=e.base_value||0,n=e.scarcity_multiplier||0,r=e.provenance_uplift||0;return t+t*(n/100)+t*(r/100)},j1=e=>{let t=0;return e.artist_name&&(t+=20),e.artwork_title&&(t+=10),e.year&&(t+=10),e.medium&&(t+=10),e.dimensions&&(t+=10),e.condition&&(t+=10),(e.hand_signed||e.has_stamp)&&(t+=10),e.edition&&(t+=5),e.image_url&&(t+=5),(e.base_value||0)>0&&(t+=10),Math.min(100,t)},qS=e=>{if(e==null)return"";const t=String(e);return/[",\n\r]/.test(t)?`"${t.replace(/"/g,'""')}"`:t},$V=(e,t)=>{const r=[["Submitted","Status","Confidence (%)","Artist","Title","Year","Medium","Dimensions","Condition","Edition","Signed","Stamp","Framed","Base Value (USD)","Scarcity (%)","Provenance Uplift (%)","Total Value (USD)","Submitter","Phone","Admin Notes"].map(qS).join(",")];for(const l of e)r.push([new Date(l.created_at).toISOString().slice(0,10),N1[l.status]||l.status,j1(l),l.artist_name,l.artwork_title,l.year,l.medium,l.dimensions,l.condition,l.edition,l.hand_signed?"Yes":"No",l.has_stamp?"Yes":"No",l.framed?"Yes":"No",l.base_value??0,l.scarcity_multiplier??0,l.provenance_uplift??0,Math.round(S1(l)),l.submitter_name,l.submitter_phone,l.admin_notes].map(q
594S).join(","));const i=new Blob(["\uFEFF"+r.join(`
595`)],{type:"text/csv;charset=utf-8;"}),s=URL.createObjectURL(i),a=document.createElement("a");a.href=s,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(s)},BV=(e,t,n)=>{const r=new Xe({orientation:"landscape",unit:"pt",format:"letter"}),i=r.internal.pageSize.getWidth(),s=r.internal.pageSize.getHeight(),a=36;let l=48;r.setFont("times","bold"),r.setFontSize(18),r.text("Reverie Fine Art Collective",a,l),r.setFont("times","italic"),r.setFontSize(11),r.text("Consignment Submissions Report",a,l+16),r.setFont("helvetica","normal"),r.setFontSize(9),r.setTextColor(110);const c=`Filter: ${n} · ${e.length} record${e.length===1?"":"s"} · Generated ${new Date().toLocaleString()}`;r.text(c,a,l+32),r.setTextColor(0),l+=56;const d=e.reduce((b,y)=>(b.value+=S1(y),b.confidence+=j1(y),b.byStatus[y.status]=(b.byStatus[y.status]||0)+1,b),{value:0,confidence:0,byStatus:{}}),u=e.length?Math.round(d.confidence/e.length):0,f=Object.entries(d.byStatus).map(([b,y])=>`${N1[b]||b}: ${y}`).join("  ·  ");r.setFontSize(10),r.setFont("helvetica","bold"),r.text(`Total estimated value: $${Math.round(d.value).toLocaleString()}`,a,l),r.text(`Avg confidence: ${u}%`,a+280,l),l+=14,r.setFont("helvetica","normal"),r.setFontSize(9),r.setTextColor(90),f&&r.text(f,a,l),r.setTextColor(0),l+=18;const p=[{key:"submitted",label:"Date",width:56},{key:"status",label:"Status",width:56},{key:"confidence",label:"Conf.",width:40,align:"right"},{key:"artist_name",label:"Artist",width:110},{key:"artwork_title",label:"Title",width:130},{key:"medium",label:"Medium",width:80},{key:"dimensions",label:"Dimensions",width:80},{key:"value",label:"Value",width:70,align:"right"},{key:"submitter_name",label:"Submitter",width:90},{key:"admin_notes",label:"Notes",width:0}],h=p.reduce((b,y)=>b+y.width,0);p[p.length-1].width=i-a*2-h;const x=()=>{r.setFillColor(245,243,238),r.rect(a,l-11,i-a*2,16,"F"),r.setFont("helvetica","bold"),r.setFontSize(8),r.setTextColor(60);let b=a+4;for(const y of p){const _=y.align==="right"?b+y.width-4:b;r.text(y.label.toUpperCase(),_,l,{align:y.align==="right"?"right":"left"}),b+=y.width}r.setTextColor(0),l+=10,r.setDrawColor(220),r.line(a,l-2,i-a,l-2),l+=6};x(),r.setFont("helvetica","normal"),r.setFontSize(8);for(const b of e){const _=p.map(C=>{let P="";if(C.key==="submitted")P=new Date(b.created_at).toLocaleDateString();else if(C.key==="status")P=N1[b.status]||b.status;else if(C.key==="confidence")P=`${j1(b)}%`;else if(C.key==="value"){const R=S1(b);P=R>0?`$${Math.round(R).toLocaleString()}`:"—"}else C.key==="artwork_title"?P=b.artwork_title||"Untitled":C.key==="admin_notes"?P=b.admin_notes||"":P=b[C.key]||"";return{text:P,width:C.width,align:C.align}}).map(C=>{const P=r.splitTextToSize(C.text,C.width-8);return{...C,lines:P.length?P:[""]}}),w=Math.max(14,_.reduce((C,P)=>Math.max(C,P.lines.length*10),0)+4);l+w>s-40&&(r.addPage(),l=48,x(),r.setFont("helvetica","normal"),r.setFontSize(8));let S=a+4;for(const C of _){const P=C.align==="right"?S+C.width-4:S;r.text(C.lines,P,l,{align:C.align==="right"?"right":"left"}),S+=C.width}l+=w,r.setDrawColor(238),r.line(a,l-2,i-a,l-2)}const g=r.getNumberOfPages();for(let b=1;b<=g;b++)r.setPage(b),r.setFontSize(8),r.setTextColor(140),r.text(`Reverie Fine Art Collective · Confidential · Page ${b} of ${g}`,i/2,s-20,{align:"center"}),r.setTextColor(0);r.save(t)},UV="/assets/LiberationSans-Regular-B8GnwO_8.ttf",zV="/assets/LiberationSans-Bold-Bsh__QjD.ttf",qV="/assets/LiberationSans-Italic-C91QzmwG.ttf";let db=null;const ub=async e=>{const n=await(await fetch(e)).arrayBuffer();let r="";const i=new Uint8Array(n),s=32768;for(let a=0;a<i.length;a+=s){const l=i.subarray(a,a+s);r+=String.fromCharCode(...l)}return btoa(r)},WV=async()=>(db||(db=Promise.all([ub(UV),ub(zV),ub(qV)]).then(([e,t,n])=>({regular:e,bold:t,italic:n}))),db),sx=async e=>{const t=await WV(),n=r=>typeof e.existsFileInVFS=="function"&&e.existsFileInVFS(r);n("LiberationSans-Regular.ttf")||(e.addFileToVFS("LiberationSans-Regular.ttf",t.regular),e.addFont("LiberationSans-Regular.ttf","LiberationSans","normal")),n("LiberationSans-Bold.ttf")||(e.addFileToVFS("LiberationSans-Bold.ttf",t.bold),e.addFont("LiberationSans-Bold.ttf","LiberationSans","bold")),n("LiberationSans-Italic.ttf")||(e.addFileToVFS("LiberationSans-Italic.ttf",t.italic),e.addFont("LiberationSans-Italic.ttf","LiberationSans","italic"))},ct=(e,t="normal")=>
595{e.setFont("LiberationSans",t)},Nt=e=>{if(!e)return"";let t=e;return t=t.replace(/^#{1,6}\s+/gm,""),t=t.replace(/\*\*\*(.+?)\*\*\*/g,"$1"),t=t.replace(/\*\*(.+?)\*\*/g,"$1"),t=t.replace(new RegExp("(?<!\\w)\\*(?!\\s)(.+?)(?<!\\s)\\*(?!\\w)","g"),"$1"),t=t.replace(new RegExp("(?<!\\w)_(?!\\s)(.+?)(?<!\\s)_(?!\\w)","g"),"$1"),t=t.replace(/```[\s\S]*?```/g,""),t=t.replace(/`([^`]+)`/g,"$1"),t=t.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1"),t=t.replace(/^\s*[•·●○▪◦]\s+/gm,"- "),t=t.replace(/^\s*\*\s+/gm,"- "),t=t.replace(/\*+/g,""),t=t.replace(/[\u2018\u2019\u201A\u201B]/g,"'").replace(/[\u201C\u201D\u201E\u201F]/g,'"').replace(/[\u2013\u2014]/g,"-").replace(/\u2026/g,"...").replace(/\u00A0/g," ").replace(/[\u2192\u27A1\u27F6\u2794\u279C]/g,"->").replace(/[\u2190\u27F5]/g,"<-").replace(/[\u2191\u2193\u2194\u2195]/g,"").replace(/[\u2022\u00B7\u25CF\u25CB\u25AA\u25E6]/g,"-").replace(/[\u2713\u2714]/g,"+").replace(/[\u2717\u2718]/g,"x").replace(/[^\x00-\xFF]/g,""),t=t.replace(/\n{3,}/g,`
596
597`),t.trim()},D2=async e=>{try{const t=await fetch(e);if(t.ok){const n=await t.blob(),r=await createImageBitmap(n,{imageOrientation:"from-image"}),i=document.createElement("canvas");i.width=r.width,i.height=r.height;const s=i.getContext("2d");if(s)return s.drawImage(r,0,0),{dataUrl:i.toDataURL("image/jpeg",.92),width:r.width,height:r.height}}}catch{}return new Promise((t,n)=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{try{const i=r.naturalWidth||r.width,s=r.naturalHeight||r.height,a=document.createElement("canvas");a.width=i,a.height=s;const l=a.getContext("2d");if(!l)return n(new Error("no 2d context available"));l.drawImage(r,0,0,i,s),t({dataUrl:a.toDataURL("image/jpeg",.92),width:i,height:s})}catch(i){n(i)}},r.onerror=n,r.src=e})},HV=(e,t,n=0)=>{const r=t;return e.getTextWidth(r)+Math.max(0,r.length-1)*n},VV=[176,138,62],Tm=[32,32,32],ld=e=>e==null?"—":`$${Math.round(Number(e)).toLocaleString()}`,hb=e=>e?new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}):"—",GV={pending:"Pending",processing:"Processing",paid:"Paid"},E1=async(e,t="Consignor",n="Reverie Fine Art Collective")=>{if(e.length===0)return;const r=new Xe({unit:"pt",format:"letter"});await sx(r);const i=r.internal.pageSize.getWidth(),s=48,a=i-s*2,l=new Date().toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}),c=h=>{r.setDrawColor(...VV),r.setLineWidth(1),r.line(s,h,i-s,h)},d=()=>{ct(r,"bold"),r.setFontSize(22),r.setTextColor(...Tm),r.text(Nt("Consignment Payout Statement"),s,96),ct(r,"normal"),r.setFontSize(10),r.setTextColor(110),r.text(Nt(`${n}  ·  Issued ${l}`),s,116),r.text(Nt(`Consignor: ${t}`),s,132),c(148)},u=(h,x,g,b=!1)=>{ct(r,"normal"),r.setFontSize(10),r.setTextColor(120),r.text(Nt(h),s,g),ct(r,b?"bold":"normal"),r.setFontSize(b?12:10),r.setTextColor(...Tm),r.text(Nt(x),s+a,g,{align:"right"})};if(e.forEach((h,x)=>{x>0&&r.addPage(),d();let g=182;ct(r,"bold"),r.setFontSize(14),r.setTextColor(...Tm),r.text(Nt(h.artist_name||"Unknown Artist"),s,g),g+=18,ct(r,"italic"),r.setFontSize(11),r.setTextColor(90),r.text(Nt(`${h.artwork_title||"Untitled"}${h.year?`, ${h.year}`:""}`),s,g),g+=16,ct(r,"normal"),r.setFontSize(9.5),r.setTextColor(120),r.text(Nt([h.medium,h.dimensions].filter(Boolean).join("  ·  ")||"—"),s,g),g+=30,c(g),g+=24;const b=h.commission_rate==null?50:Number(h.commission_rate),y=h.sale_price==null?null:Number(h.sale_price),_=y!=null?+(y*(b/100)).toFixed(2):null,w=h.payout_amount!=null?Number(h.payout_amount):y!=null?+(y*(1-b/100)).toFixed(2):null;if(u("Consigned on",hb(h.created_at),g),g+=18,u("List price",ld(h.list_price??h.asking_price),g),g+=18,u("Sale price (gross)",ld(y),g),g+=18,u(`Gallery commission (${b}%)`,_==null?"—":`- ${ld(_)}`,g),g+=18,u("Sold on",hb(h.sold_at),g),g+=26,c(g),g+=26,u("Net proceeds to you",ld(w),g,!0),g+=30,u("Payout status",GV[h.payout_status||"pending"]||"Pending",g),g+=18,u("Paid on",hb(h.payout_paid_at),g),g+=18,h.payout_reference&&(u("Reference",h.payout_reference,g),g+=18),h.payout_notes){g+=12,ct(r,"normal"),r.setFontSize(9.5),r.setTextColor(110);const C=r.splitTextToSize(Nt(h.payout_notes),a);r.text(C,s,g),g+=C.length*12}ct(r,"normal"),r.setFontSize(8),r.setTextColor(150);const S=r.splitTextToSize(Nt(`${n} — This statement reflects the consignment terms agreed in writing for the work above. Net proceeds are released 3–5 business days after buyer funds clear. Questions? Reply to your consignment thread in the Reverie dashboard.`),a);r.text(S,s,r.internal.pageSize.getHeight()-56)}),e.length>1){r.addPage(),d();let h=182;ct(r,"bold"),r.setFontSize(13),r.setTextColor(...Tm),r.text(Nt("Statement Summary"),s,h),h+=24;let x=0;e.forEach(g=>{const b=g.commission_rate==null?50:Number(g.commission_rate),y=g.payout_amount!=null?Number(g.payout_amount):g.sale_price!=null?Number(g.sale_price)*(1-b/100):0;x+=y,u(`${g.artist_name||"Unknown"} — ${g.artwork_title||"Untitled"}`,ld(y),h),h+=18}),h+=10,c(h),h+=24,u("Total net proceeds",ld(x),h,!0)}const f=e[0],p=e.length===1?`payout-statement-${(f.artist_name||"work").replace(/\s+/g,"-").toLowerCase()}.pdf`:`payout-statement-${e.length}-works.pdf`;r.save(p)};var gt=function(){return gt=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},gt.apply(this,arguments)};function YV(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 lP(e,t,n){for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}function ap(e){return e.mode==="multiple"}function lp(e){return e.mode==="range"}function ox(e){return e.mode==="single"}var KV={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:"rd
597p-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 JV(e,t){return fl(e,"LLLL y",t)}function XV(e,t){return fl(e,"d",t)}function ZV(e,t){return fl(e,"LLLL",t)}function QV(e){return"".concat(e)}function eG(e,t){return fl(e,"cccccc",t)}function tG(e,t){return fl(e,"yyyy",t)}var nG=Object.freeze({__proto__:null,formatCaption:JV,formatDay:XV,formatMonthCaption:ZV,formatWeekNumber:QV,formatWeekdayName:eG,formatYearCaption:tG}),rG=function(e,t,n){return fl(e,"do MMMM (EEEE)",n)},iG=function(){return"Month: "},sG=function(){return"Go to next month"},oG=function(){return"Go to previous month"},aG=function(e,t){return fl(e,"cccc",t)},lG=function(e){return"Week n. ".concat(e)},cG=function(){return"Year: "},dG=Object.freeze({__proto__:null,labelDay:rG,labelMonthDropdown:iG,labelNext:sG,labelPrevious:oG,labelWeekNumber:lG,labelWeekday:aG,labelYearDropdown:cG});function uG(){var e="buttons",t=KV,n=GA,r={},i={},s=1,a={},l=new Date;return{captionLayout:e,classNames:t,formatters:nG,labels:dG,locale:n,modifiersClassNames:r,modifiers:i,numberOfMonths:s,styles:a,today:l,mode:"default"}}function hG(e){var t=e.fromYear,n=e.toYear,r=e.fromMonth,i=e.toMonth,s=e.fromDate,a=e.toDate;return r?s=vi(r):t&&(s=new Date(t,0,1)),i?a=w2(i):n&&(a=new Date(n,11,31)),{fromDate:s?xu(s):void 0,toDate:a?xu(a):void 0}}var cP=k.createContext(void 0);function fG(e){var t,n=e.initialProps,r=uG(),i=hG(n),s=i.fromDate,a=i.toDate,l=(t=n.captionLayout)!==null&&t!==void 0?t:r.captionLayout;l!=="buttons"&&(!s||!a)&&(l="buttons");var c;(ox(n)||ap(n)||lp(n))&&(c=n.onSelect);var d=gt(gt(gt({},r),n),{captionLayout:l,classNames:gt(gt({},r.classNames),n.classNames),components:gt({},n.components),formatters:gt(gt({},r.formatters),n.formatters),fromDate:s,labels:gt(gt({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:gt(gt({},r.modifiers),n.modifiers),modifiersClassNames:gt(gt({},r.modifiersClassNames),n.modifiersClassNames),onSelect:c,styles:gt(gt({},r.styles),n.styles),toDate:a});return o.jsx(cP.Provider,{value:d,children:e.children})}function mn(){var e=k.useContext(cP);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function dP(e){var t=mn(),n=t.locale,r=t.classNames,i=t.styles,s=t.formatters.formatCaption;return o.jsx("div",{className:r.caption_label,style:i.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:s(e.displayMonth,{locale:n})})}function pG(e){return o.jsx("svg",gt({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:o.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.778175,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 uP(e){var t,n,r=e.onChange,i=e.value,s=e.children,a=e.caption,l=e.className,c=e.style,d=mn(),u=(n=(t=d.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&n!==void 0?n:pG;return o.jsxs("div",{className:l,style:c,children:[o.jsx("span",{className:d.classNames.vhidden,children:e["aria-label"]}),o.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:d.classNames.dropdown,style:d.styles.dropdown,value:i,onChange:r,children:s}),o.jsxs("div",{className:d.classNames.caption_label,style:d.styles.caption_label,"aria-hidden":"true",children:[a,o.jsx(u,{className:d.classNames.dropdown_icon,style:d.styles.dropdown_icon})]})]})}function mG(e){var t,n=mn(),r=n.fromDate,i=n.toDate,s=n.styles,a=n.locale,l=n.formatters.formatMonthCaption,c=n.classNames,d=n.components,u=n.labels.labelMonthDropdown;if(!r)return o.jsx(o.Fragment,{});if(!i)return o.jsx(o.Fragment,{});var f=[];if(Tz(r,i))for(var p=vi(r),h=r.getMonth();h<=i.getMonth();h++)f.push(Iv(p,h));else for(var p=vi(new Date),h=0;h<=11;h++)f.push(Iv(p,h));var x=function(b){var y=Number(b.target.value),_=Iv(vi(e.displayMonth),y);e.onChange(_)},g=(t=d==null?void 0:d.Dropdown)!==null&&t!==void 0?t:uP;return o.jsx(g,{name:"months","aria-label":u(),className:c.dropdown_month,style:s.dropdown_month,onChange:x,value:e.displayMonth.getMonth(),c
597aption:l(e.displayMonth,{locale:a}),children:f.map(function(b){return o.jsx("option",{value:b.getMonth(),children:l(b,{locale:a})},b.getMonth())})})}function gG(e){var t,n=e.displayMonth,r=mn(),i=r.fromDate,s=r.toDate,a=r.locale,l=r.styles,c=r.classNames,d=r.components,u=r.formatters.formatYearCaption,f=r.labels.labelYearDropdown,p=[];if(!i)return o.jsx(o.Fragment,{});if(!s)return o.jsx(o.Fragment,{});for(var h=i.getFullYear(),x=s.getFullYear(),g=h;g<=x;g++)p.push(bN(HA(new Date),g));var b=function(_){var w=bN(vi(n),Number(_.target.value));e.onChange(w)},y=(t=d==null?void 0:d.Dropdown)!==null&&t!==void 0?t:uP;return o.jsx(y,{name:"years","aria-label":f(),className:c.dropdown_year,style:l.dropdown_year,onChange:b,value:n.getFullYear(),caption:u(n,{locale:a}),children:p.map(function(_){return o.jsx("option",{value:_.getFullYear(),children:u(_,{locale:a})},_.getFullYear())})})}function xG(e,t){var n=k.useState(e),r=n[0],i=n[1],s=t===void 0?r:t;return[s,i]}function vG(e){var t=e.month,n=e.defaultMonth,r=e.today,i=t||n||r||new Date,s=e.toDate,a=e.fromDate,l=e.numberOfMonths,c=l===void 0?1:l;if(s&&Tf(s,i)<0){var d=-1*(c-1);i=Ss(s,d)}return a&&Tf(i,a)<0&&(i=a),vi(i)}function bG(){var e=mn(),t=vG(e),n=xG(t,e.month),r=n[0],i=n[1],s=function(a){var l;if(!e.disableNavigation){var c=vi(a);i(c),(l=e.onMonthChange)===null||l===void 0||l.call(e,c)}};return[r,s]}function yG(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,i=vi(e),s=vi(Ss(i,r)),a=Tf(s,i),l=[],c=0;c<a;c++){var d=Ss(i,c);l.push(d)}return n&&(l=l.reverse()),l}function wG(e,t){if(!t.disableNavigation){var n=t.toDate,r=t.pagedNavigation,i=t.numberOfMonths,s=i===void 0?1:i,a=r?s:1,l=vi(e);if(!n)return Ss(l,a);var c=Tf(n,e);if(!(c<s))return Ss(l,a)}}function _G(e,t){if(!t.disableNavigation){var n=t.fromDate,r=t.pagedNavigation,i=t.numberOfMonths,s=i===void 0?1:i,a=r?s:1,l=vi(e);if(!n)return Ss(l,-a);var c=Tf(l,n);if(!(c<=0))return Ss(l,-a)}}var hP=k.createContext(void 0);function kG(e){var t=mn(),n=bG(),r=n[0],i=n[1],s=yG(r,t),a=wG(r,t),l=_G(r,t),c=function(f){return s.some(function(p){return k2(f,p)})},d=function(f,p){c(f)||(p&&ZA(f,p)?i(Ss(f,1+t.numberOfMonths*-1)):i(f))},u={currentMonth:r,displayMonths:s,goToMonth:i,goToDate:d,previousMonth:l,nextMonth:a,isDateDisplayed:c};return o.jsx(hP.Provider,{value:u,children:e.children})}function cp(){var e=k.useContext(hP);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function WS(e){var t,n=mn(),r=n.classNames,i=n.styles,s=n.components,a=cp().goToMonth,l=function(u){a(Ss(u,e.displayIndex?-e.dis
597playIndex:0))},c=(t=s==null?void 0:s.CaptionLabel)!==null&&t!==void 0?t:dP,d=o.jsx(c,{id:e.id,displayMonth:e.displayMonth});return o.jsxs("div",{className:r.caption_dropdowns,style:i.caption_dropdowns,children:[o.jsx("div",{className:r.vhidden,children:d}),o.jsx(mG,{onChange:l,displayMonth:e.displayMonth}),o.jsx(gG,{onChange:l,displayMonth:e.displayMonth})]})}function NG(e){return o.jsx("svg",gt({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:o.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 SG(e){return o.jsx("svg",gt({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:o.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 m0=k.forwardRef(function(e,t){var n=mn(),r=n.classNames,i=n.styles,s=[r.button_reset,r.button];e.className&&s.push(e.className);var a=s.join(" "),l=gt(gt({},i.button_reset),i.button);return e.style&&Object.assign(l,e.style),o.jsx("button",gt({},e,{ref:t,type:"button",className:a,style:l}))});function jG(e){var t,n,r=mn(),i=r.dir,s=r.locale,a=r.classNames,l=r.styles,c=r.labels,d=c.labelPrevious,u=c.labelNext,f=r.components;if(!e.nextMonth&&!e.previousMonth)return o.jsx(o.Fragment,{});var p=d(e.previousMonth,{locale:s}),h=[a.nav_button,a.nav_button_previous].join(" "),x=u(e.nextMonth,{locale:s}),g=[a.nav_button,a.nav_button_next].join(" "),b=(t=f==null?void 0:f.IconRight)!==null&&t!==void 0?t:SG,y=(n=f==null?void 0:f.IconLeft)!==null&&n!==void 0?n:NG;return o.jsxs("div",{className:a.nav,style:l.nav,children:[!e.hidePrevious&&o.jsx(m0,{name:"previous-month","aria-label":p,className:h,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:i==="rtl"?o.jsx(b,{className:a.nav_icon,style:l.nav_icon}):o.jsx(y,{className:a.nav_icon,style:l.nav_icon})}),!e.hideNext&&o.jsx(m0,{name:"next-month","aria-label":x,className:g,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:i==="rtl"?o.jsx(y,{className:a.nav_icon,style:l.nav_icon}):o.jsx(b,{className:a.nav_icon,style:l.nav_icon})})]})}function HS(e){var t=mn().numberOfMonths,n=cp(),r=n.previousMonth,i=n.nextMonth,s=n.goToMonth,a=n.displayMonths,l=a.findIndex(function(x){return k2(e.displayMonth,x)}),c=l===0,d=l===a.length-1,u=t>1&&(c||!d),f=t>1&&(d||!c),p=function(){r&&s(r)},h=function(){i&&s(i)};return o.jsx(jG,{displayMonth:e.displayMonth,hideNext:u,hidePrevious:f,nextMonth:i,previousMonth:r,onPreviousClick:p,onNextClick:h})}function EG(e){var t,n=mn(),r=n.classNames,i=n.disableNavigation,s=n.styles,a=n.captionLayout,l=n.components,c=(t=l==null?void 0:l.CaptionLabel)!==null&&t!==void 0?t:dP,d;return i?d=o.jsx(c,{id:e.id,displayMonth:e.displayMonth}):a==="dropdown"?d=o.jsx(WS,{displayMonth:e.displayMonth,id:e.id}):a==="dropdown-buttons"?d=o.jsxs(o.Fragment,{children:[o.jsx(WS,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),o.jsx(HS,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):d=o.jsxs(o.Fragment,{children:[o.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),o.jsx(HS,{displayMonth:e.displayMonth,id:e.id})]}),o.jsx("div",{className:r.caption,style:s.caption,children:d})}function CG(e){var t=mn(),n=t.footer,r=t.styles,i=t.classNames.tfoot;return n?o.jsx("tfoot",{className:i,style:r.tfoot,children:o.jsx("tr",{children:o.jsx("td",{colSpan:8,children:n})})}):o.jsx(o.Fragment,{})}function AG(e,t,n){for(var r=n?pc(new Date):fo(new Date,{locale:e,weekStartsOn:t}),i=[],s=0;s<7;s++){var a=Qr(r,s);i.push(a)}return i}function PG(){var e=mn(),t=e.classNames,n=e.styles,r=e.showWeekNumber,i=e.locale,s=e.weekStartsOn,a=e.ISOWeek,l=e.formatters.formatWeekdayName,c=e.labels.labelWeekday,d=AG(i,s,a);return o.jsxs("tr",{style:n.head_row,className:t.head_row,children:[r&&o.jsx("td",{style:n.head_cell,className:t.head_cell}),d.map(function(u,f){return o.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":c(u,{locale:i}),children:l(u,{locale:i})},f)})]})}function LG(){var e,t=mn(),n=t.classNames,r=t.styles,i=t.components,s=(e=i==null?void 0:i.HeadRow)!==null&&e!==void 0?e:PG;return o.jsx("thead",{style:r.head,className:n.head,children:o.jsx(s,{})})}function RG(e){var t=mn(),n=t.locale,r=t.formatters.formatDay;return o.jsx(o.Fragment,{children:r(e.date,{locale:n})})}var F2=k.createContext(void 0);function TG(e){if(!ap(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return o.jsx(F2.Provider,{value:t,children:e.children})}return o.jsx(OG,{initialProps:e.initialProps,children:e.children})}function OG(e){var t=e.initialProps,n=e.children,r=t.selected,i=t.min,s=t.max,a=function(d,u,f){var p,h;(p=t.onDayClick)===null||p===void 0||p.call(t,d,u,f);var x=!!(u.selected&&i&&(r==null?void 0:r.length)===i);if(!x){var g=!!(!u.selected&&s&&(r==null?void 0:r.length)===s);if(!g){var b=r?lP([],r):[];if(u.selected){var y=b.findIndex(function(_){return fi(d,_)});b.splice(y,1)}else b.push(d);(h=t.onSelect)===null||h===void 0||h.call(t,b,d,u,f)}}},l={disabled:[]};r&&l.disabled.push(function(d){var u=s&&r.length>s-1,f=r.some(function(p){return fi(p,d)});return!!(u&&!f)});var c={selected:r,onDayClick:a,modifiers:l};return o.jsx(F2.Provider,{value:c,children:n})}function M2(){var e=k.useContext(F2);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function IG(e,t){var n=t||{},r=n.from,i=n.to;return r&&i?fi(i,e)&&fi(r,e)?void 0:fi(i,e)?{from:i,to:void 0}:fi(r,e)?void 0:o1(r,e)?{from:e,to:i}:{from:r,to:e}:i?o1(e,i)?{from:i,to:e}:{from:e,to:i}:r?ZA(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}var $2=k.createContext(void 0);function DG(e){if(!lp(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return o.jsx($2.Provider,{value:t,children:e.children})}return o.jsx(FG,{initialProps:e.initialProps,children:e.children})}function FG(e){var t=e.initialProps,n=e.children,r=t.selected,i=r||{},s=i.from,a=i.to,l=t.min,c=t.max,d=function(h,x,g){var b,y;(b=t.onDayClick)===null||b===void 0||b.call(t,h,x,g);var _=IG(h,r);(y=t.onSelect)===null||y===void 0||y.call(t,_,h,x,g)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(s?(u.range_start=[s],a?(u.range_end=[a],fi(s,a)||(u.range_middle=[{after:s,before:a}])):u.range_end=[s]):a&&(u.range_start=[a],u.range_end=[a]),l&&(s&&!a&&u.disabled.push({after:Ov(s,l-1),before:Qr(s,l-1)}),s&&a&&u.disabled.push({after:s,before:Qr(s,l-1)}),!s&&a&&u.disabled.push({after:Ov(a,l-1),before:Qr(a,l-1)})),c){if(s&&!a&&(u.disabled.push({before:Qr(s,-c+1)}),u.disabled.push({after:Qr(s,c-1)})),s&&a){var f=no(a,s)+1,p=c-f;u.disabled.push({before:Ov(s,p)}),u.disabled.push({after:Qr(a,p)})}!s&&a&&(u.disabled.push({before:Qr(a,-c+1)}),u.disabled.push({after:Qr(a,c-1)}))}return o.jsx($2.Provider,{value:{selected:r,onDayClick:d,modifiers:u},children:n})}function B2(){var e=k.useContext($2);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function vg(e){return Array.isArray(e)?lP([],e):e!==void 0?[e]:[]}function MG(e){var t={};return Object.entries(e).forEach(function(n){var r=n[0],i=n[1];t[r]=vg(i)}),t}var Es;(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"})(Es||(Es={}));var $G=Es.Selected,Po=Es.Disabled,BG=Es.Hidden,UG=Es.Today,fb=Es.RangeEnd,pb=Es.RangeMiddle,mb=Es.RangeStart,zG=Es.Outside;function qG(e,t,n){var r,i=(r={},r[$G]=vg(e.selected),r[Po]=vg(e.disabled),r[BG]=vg(e.hidden),r[UG]=[e.today],r[fb]=[],r[pb]=[],r[mb]=[],r[zG]=[],r);return e.fromDate&&i[Po].push({before:e.fromDate}),e.toDate&&i[Po].push({after:e.toDate}),ap(e)?i[Po]=i[Po].concat(t.modifiers[Po]):lp(e)&&(i[Po]=i[Po].concat(n.modifiers[Po]),i[mb]=n.modifiers[mb],i[pb]=n.modifiers[pb],i[fb]=n.modifiers[fb]),i}var fP=k.createContext(void 0);function WG(e){var t=mn(),n=M2(),r=B2(),i=qG(t,n,r),s=MG(t.modifiers),a=gt(gt({},i),s);return o.jsx(fP.Provider,{value:a,children:e.children})}function pP(){var e=k.useContext(fP);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function HG(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function VG(e){return!!(e&&typeof e=="object"&&"from"in e)}function GG(e){return!!(e&&typeof e=="object"&&"after"in e)}function YG(e){return!!(e&&typeof e=="object"&&"before"in e)}function KG(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function JG(e,t){var n,r=t.from,i=t.to;if(r&&i){var s=no(i,r)<0;s&&(n=[i,r],r=n[0],i=n[1]);var a=no(e,r)>=0&&no(i,e)>=0;return a}return i?fi(i,e):r?fi(r,e):!1}
597function XG(e){return y2(e)}function ZG(e){return Array.isArray(e)&&e.every(y2)}function QG(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(XG(n))return fi(e,n);if(ZG(n))return n.includes(e);if(VG(n))return JG(e,n);if(KG(n))return n.dayOfWeek.includes(e.getDay());if(HG(n)){var r=no(n.before,e),i=no(n.after,e),s=r>0,a=i<0,l=o1(n.before,n.after);return l?a&&s:s||a}return GG(n)?no(e,n.after)>0:YG(n)?no(n.before,e)>0:typeof n=="function"?n(e):!1})}function U2(e,t,n){var r=Object.keys(t).reduce(function(s,a){var l=t[a];return QG(e,l)&&s.push(a),s},[]),i={};return r.forEach(function(s){return i[s]=!0}),n&&!k2(e,n)&&(i.outside=!0),i}function eY(e,t){for(var n=vi(e[0]),r=w2(e[e.length-1]),i,s,a=n;a<=r;){var l=U2(a,t),c=!l.disabled&&!l.hidden;if(!c){a=Qr(a,1);continue}if(l.selected)return a;l.today&&!s&&(s=a),i||(i=a),a=Qr(a,1)}return s||i}var tY=365;function mP(e,t){var n=t.moveBy,r=t.direction,i=t.context,s=t.modifiers,a=t.retry,l=a===void 0?{count:0,lastFocused:e}:a,c=i.weekStartsOn,d=i.fromDate,u=i.toDate,f=i.locale,p={day:Qr,week:s1,month:Ss,year:AU,startOfWeek:function(b){return i.ISOWeek?pc(b):fo(b,{locale:f,weekStartsOn:c})},endOfWeek:function(b){return i.ISOWeek?VA(b):_2(b,{locale:f,weekStartsOn:c})}},h=p[n](e,r==="after"?1:-1);r==="before"&&d?h=PU([d,h]):r==="after"&&u&&(h=LU([u,h]));var x=!0;if(s){var g=U2(h,s);x=!g.disabled&&!g.hidden}return x?h:l.count>tY?l.lastFocused:mP(h,{moveBy:n,direction:r,context:i,modifiers:s,retry:gt(gt({},l),{count:l.count+1})})}var gP=k.createContext(void 0);function nY(e){var t=cp(),n=pP(),r=k.useState(),i=r[0],s=r[1],a=k.useState(),l=a[0],c=a[1],d=eY(t.displayMonths,n),u=i??(l&&t.isDateDisplayed(l))?l:d,f=function(){c(i),s(void 0)},p=function(b){s(b)},h=mn(),x=function(b,y){if(i){var _=mP(i,{moveBy:b,direction:y,context:h,modifiers:n});fi(i,_)||(t.goToDate(_,i),p(_))}},g={focusedDay:i,focusTarget:u,blur:f,focus:p,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 o.jsx(gP.Provider,{value:g,children:e.children})}function z2(){var e=k.useContext(gP);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function rY(e,t){var n=pP(),r=U2(e,n,t);return r}var q2=k.createContext(void 0);function iY(e){if(!ox(e.initialProps)){var t={selected:void 0};return o.jsx(q2.Provider,{value:t,children:e.children})}return o.jsx(sY,{initialProps:e.initialProps,children:e.children})}function sY(e){var t=e.initialProps,n=e.children,r=function(s,a,l){var c,d,u;if((c=t.onDayClick)===null||c===void 0||c.call(t,s,a,l),a.selected&&!t.required){(d=t.onSelect)===null||d===void 0||d.call(t,void 0,s,a,l);return}(u=t.onSelect)===null||u===void 0||u.call(t,s,s,a,l)},i={selected:t.selected,onDayClick:r};return o.jsx(q2.Provider,{value:i,children:n})}function xP(){var e=k.useContext(q2);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function oY(e,t){var n=mn(),r=xP(),i=M2(),s=B2(),a=z2(),l=a.focusDayAfter,c=a.focusDayBefore,d=a.focusWeekAfter,u=a.focusWeekBefore,f=a.blur,p=a.focus,h=a.focusMonthBefore,x=a.focusMonthAfter,g=a.focusYearBefore,b=a.focusYearAfter,y=a.focusStartOfWeek,_=a.focusEndOfWeek,w=function(V){var $,D,ie,X;ox(n)?($=r.onDayClick)===null||$===void 0||$.call(r,e,t,V):ap(n)?(D=i.onDayClick)===null||D===void 0||D.call(i,e,t,V):lp(n)?(ie=s.onDayClick)===null||ie===void 0||ie.call(s,e,t,V):(X=n.onDayClick)===null||X===void 0||X.call(n,e,t,V)},S=function(V){var $;p(e),($=n.onDayFocus)===null||$===void 0||$.call(n,e,t,V)},C=function(V){var $;f(),($=n.onDayBlur)===null||$===void 0||$.call(n,e,t,V)},P=function(V){var $;($=n.onDayMouseEnter)===null||$===void 0||$.call(n,e,t,V)},R=function(V){var $;($=n.onDayMouseLeave)===null||$===void 0||$.call(n,e,t,V)},M=function(V){var $;($=n.onDayPointerEnter)===null||$===void 0||$.call(n,e,t,V)},T=function(V){var $;($=n.onDayPointerLeave)===null||$===void 0||$.call(n,e,t,V)},H=function(V){var $;($=n.onDayTouchCancel)===null||$===void 0||$.call(n,e,t,V)},A=function(V){var $;($=n.onDayTouchEnd)===null||$===void 0||$.call(n,e,t,V)},O=function(V){var $;($=n.onDayTouchMove)===null||$===void 0||$.call(n,e,t,V)},K=function(V){var $;($=n.onDayTouchStart)===null||$===void 0||$.call(n,e,t,V)},U=function(V){var $;($=n.onDayKeyUp)===null||$===void 0||$.call(n,e,t,V)},I=function(V){var $;switch(V.key){case"ArrowLeft":V.preventDefault(),V.stopPropagation(),n.dir==="rtl"?l(
597):c();break;case"ArrowRight":V.preventDefault(),V.stopPropagation(),n.dir==="rtl"?c():l();break;case"ArrowDown":V.preventDefault(),V.stopPropagation(),d();break;case"ArrowUp":V.preventDefault(),V.stopPropagation(),u();break;case"PageUp":V.preventDefault(),V.stopPropagation(),V.shiftKey?g():h();break;case"PageDown":V.preventDefault(),V.stopPropagation(),V.shiftKey?b():x();break;case"Home":V.preventDefault(),V.stopPropagation(),y();break;case"End":V.preventDefault(),V.stopPropagation(),_();break}($=n.onDayKeyDown)===null||$===void 0||$.call(n,e,t,V)},re={onClick:w,onFocus:S,onBlur:C,onKeyDown:I,onKeyUp:U,onMouseEnter:P,onMouseLeave:R,onPointerEnter:M,onPointerLeave:T,onTouchCancel:H,onTouchEnd:A,onTouchMove:O,onTouchStart:K};return re}function aY(){var e=mn(),t=xP(),n=M2(),r=B2(),i=ox(e)?t.selected:ap(e)?n.selected:lp(e)?r.selected:void 0;return i}function lY(e){return Object.values(Es).includes(e)}function cY(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(lY(r)){var s=e.classNames["day_".concat(r)];s&&n.push(s)}}),n}function dY(e,t){var n=gt({},e.styles.day);return Object.keys(t).forEach(function(r){var i;n=gt(gt({},n),(i=e.modifiersStyles)===null||i===void 0?void 0:i[r])}),n}function uY(e,t,n){var r,i,s,a=mn(),l=z2(),c=rY(e,t),d=oY(e,c),u=aY(),f=!!(a.onDayCl
597ick||a.mode!=="default");k.useEffect(function(){var P;c.outside||l.focusedDay&&f&&fi(l.focusedDay,e)&&((P=n.current)===null||P===void 0||P.focus())},[l.focusedDay,e,n,f,c.outside]);var p=cY(a,c).join(" "),h=dY(a,c),x=!!(c.outside&&!a.showOutsideDays||c.hidden),g=(s=(i=a.components)===null||i===void 0?void 0:i.DayContent)!==null&&s!==void 0?s:RG,b=o.jsx(g,{date:e,displayMonth:t,activeModifiers:c}),y={style:h,className:p,children:b,role:"gridcell"},_=l.focusTarget&&fi(l.focusTarget,e)&&!c.outside,w=l.focusedDay&&fi(l.focusedDay,e),S=gt(gt(gt({},y),(r={disabled:c.disabled,role:"gridcell"},r["aria-selected"]=c.selected,r.tabIndex=w||_?0:-1,r)),d),C={isButton:f,isHidden:x,activeModifiers:c,selectedDays:u,buttonProps:S,divProps:y};return C}function hY(e){var t=k.useRef(null),n=uY(e.date,e.displayMonth,t);return n.isHidden?o.jsx("div",{role:"gridcell"}):n.isButton?o.jsx(m0,gt({name:"day",ref:t},n.buttonProps)):o.jsx("div",gt({},n.divProps))}function fY(e){var t=e.number,n=e.dates,r=mn(),i=r.onWeekNumberClick,s=r.styles,a=r.classNames,l=r.locale,c=r.labels.labelWeekNumber,d=r.formatters.formatWeekNumber,u=d(Number(t),{locale:l});if(!i)return o.jsx("span",{className:a.weeknumber,style:s.weeknumber,children:u});var f=c(Number(t),{locale:l}),p=function(h){i(t,n,h)};return o.jsx(m0,{name:"week-number","aria-label":f,className:a.weeknumber,style:s.weeknumber,onClick:p,children:u})}function pY(e){var t,n,r=mn(),i=r.styles,s=r.classNames,a=r.showWeekNumber,l=r.components,c=(t=l==null?void 0:l.Day)!==null&&t!==void 0?t:hY,d=(n=l==null?void 0:l.WeekNumber)!==null&&n!==void 0?n:fY,u;return a&&(u=o.jsx("td",{className:s.cell,style:i.cell,children:o.jsx(d,{number:e.weekNumber,dates:e.dates})})),o.jsxs("tr",{className:s.row,style:i.row,children:[u,e.dates.map(function(f){return o.jsx("td",{className:s.cell,style:i.cell,role:"presentation",children:o.jsx(c,{displayMonth:e.displayMonth,date:f})},Pz(f))})]})}function VS(e,t,n){for(var r=n!=null&&n.ISOWeek?VA(t):_2(t,n),i=n!=null&&n.ISOWeek?pc(e):fo(e,n),s=no(r,i),a=[],l=0;l<=s;l++)a.push(Qr(i,l));var c=a.reduce(function(d,u){var f=n!=null&&n.ISOWeek?YA(u):JA(u,n),p=d.find(function(h){return h.weekNumber===f});return p?(p.dates.push(u),d):(d.push({weekNumber:f,dates:[u]}),d)},[]);return c}function mY(e,t){var n=VS(vi(e),w2(e),t);if(t!=null&&t.useFixedWeeks){var r=Rz(e,t);if(r<6){var i=n[n.length-1],s=i.dates[i.dates.length-1],a=s1(s,6-r),l=VS(s1(s,1),a,t);n.push.apply(n,l)}}return n}function gY(e){var t,n,r,i=mn(),s=i.locale,a=i.classNames,l=i.styles,c=i.hideHead,d=i.fixedWeeks,u=i.components,f=i.weekStartsOn,p=i.firstWeekContainsDate,h=i.ISOWeek,x=mY(e.displayMonth,{useFixedWeeks:!!d,ISOWeek:h,locale:s,weekStartsOn:f,firstWeekContainsDate:p}),g=(t=u==null?void 0:u.Head)!==null&&t!==void 0?t:LG,b=(n=u==null?void 0:u.Row)!==null&&n!==void 0?n:pY,y=(r=u==null?void 0:u.Footer)!==null&&r!==void 0?r:CG;return o.jsxs("table",{id:e.id,className:a.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!c&&o.jsx(g,{}),o.jsx("tbody",{className:a.tbody,style:l.tbody,children:x.map(function(_){return o.jsx(b,{displayMonth:e.displayMonth,dates:_.dates,weekNumber:_.weekNumber},_.weekNumber)})}),o.jsx(y,{displayMonth:e.displayMonth})]})}function xY(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var vY=xY()?k.useLayoutEffect:k.useEffect,gb=!1,bY=0;function GS(){return"react-day-picker-".concat(++bY)}function yY(e){var t,n=e??(gb?GS():null),r=k.useState(n),i=r[0],s=r[1];return vY(function(){i===null&&s(GS())},[]),k.useEffect(function(){gb===!1&&(gb=!0)},[]),(t=e??i)!==null&&t!==void 0?t:void 0}function wY(e){var t,n,r=mn(),i=r.dir,s=r.classNames,a=r.styles,l=r.components,c=cp().displayMonths,d=yY(r.id?"".concat(r.id,"-").concat(e.displayIndex):void 0),u=r.id?"".concat(r.id,"-grid-").concat(e.displayIndex):void 0,f=[s.month],p=a.month,h=e.displayIndex===0,x=e.displayIndex===c.length-1,g=!h&&!x;i==="rtl"&&(t=[h,x],x=t[0],h=t[1]),h&&(f.push(s.caption_start),p=gt(gt({},p),a.caption_start)),x&&(f.push(s.caption_end),p=gt(gt({},p),a.caption_end)),g&&(f.push(s.caption_between),p=gt(gt({},p),a.caption_between));var b=(n=l==null?void 0:l.Caption)!==null&&n!==void 0?n:EG;return o.jsxs("div",{className:f.join(" "),style:p,children:[o.jsx(b,{id:d,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),o.jsx(gY,{id:u,"aria-labelledby":d,displayMonth:e.displayMonth})]},e.displayIndex)}function _Y(e){var t=mn(),n=t.classNames,r=t.styles;return o.jsx("div",{className:n.months,style:r.months,children:e.children})}function kY(e){var t,n,r=e.initialProps,i=mn(),s=z2(),a=cp(),l=k.useState(!1),c=l[0],d=l[1];k.useEffect(function(){i.initialFocus&&s.focusTarget&&(c||(s.focus(s.focusTarget),d(!0)))},[i.initialFocus,c,s.focus,s.focusTarget,s]);var u=[i.classNames.root,i.className];i.numberOfMonths>1&&u.push(i.classNames.multiple_months),i.showWeekNumber&&u.push(i.classNames.with_weeknumber);var f=gt(gt({},i.styles.root),i.style),p=Object.keys(r).filter(function(x){return x.startsWith("data-")}).reduce(function(x,g){var b;return gt(gt({},x),(b={},b[g]=r[g],b))},{}),h=(n=(t=r.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:_Y;return o.jsx("div",gt({className:u.join(" "),style:f,dir:i.dir,id:i.id,nonce:r.nonce,title:r.title,lang:r.lang},p,{children:o.jsx(h,{children:a.displayMonths.map(function(x,g){return o.jsx(wY,{displayIndex:g,displayMonth:x},g)})})}))}function NY(e){var t=e.children,n=YV(e,["children"]);return o.jsx(fG,{initialProps:n,children:o.jsx(kG,{children:o.jsx(iY,{initialProps:n,children:o.jsx(TG,{initialProps:n,children:o.jsx(DG,{initialProps:n,children:o.jsx(WG,{children:o.jsx(nY,{children:t})})})})})})})}function SY(e){return o.jsx(NY,gt({},e,{children:o.jsx(kY,{initialProps:e})}))}const C1=Zw("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors 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",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),A1=k.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},s)=>{const a=r?SD:"button";return o.jsx(a,{className:Bn(C1({variant:t,size:n,className:e})),ref:s,...i})});A1.displayName="Button";function vP({className:e,classNames:t,showOutsideDays:n=!0,...r}){return o.jsx(SY,{showOutsideDays:n,className:Bn("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:sp
597ace-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:Bn(C1({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:Bn(C1({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})=>o.jsx(j7,{className:"h-4 w-4"}),IconRight:({...i})=>o.jsx(E7,{className:"h-4 w-4"})},...r})}vP.displayName="Calendar";var xb=0;function bP(){k.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??YS()),document.body.insertAdjacentElement("beforeend",e[1]??YS()),xb++,()=>{xb===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),xb--}},[])}function YS(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var vb="focusScope.autoFocusOnMount",bb="focusScope.autoFocusOnUnmount",KS={bubbles:!1,cancelable:!0},jY="FocusScope",W2=k.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...a}=e,[l,c]=k.useState(null),d=co(i),u=co(s),f=k.useRef(null),p=Ln(t,g=>c(g)),h=k.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;k.useEffect(()=>{if(r){let g=function(w){if(h.paused||!l)return;const S=w.target;l.contains(S)?f.current=S:ja(f.current,{select:!0})},b=function(w){if(h.paused||!l)return;const S=w.relatedTarget;S!==null&&(l.contains(S)||ja(f.current,{select:!0}))},y=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&ja(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",b);const _=new MutationObserver(y);return l&&_.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",b),_.disconnect()}}},[r,l,h.paused]),k.useEffect(()=>{if(l){XS.add(h);const g=document.activeElement;if(!l.contains(g)){const y=new CustomEvent(vb,KS);l.addEventListener(vb,d),l.dispatchEvent(y),y.defaultPrevented||(EY(RY(yP(l)),{select:!0}),document.activeElement===g&&ja(l))}return()=>{l.removeEventListener(vb,d),setTimeout(()=>{const y=new CustomEvent(bb,KS);l.addEventListener(bb,u),l.dispatchEvent(y),y.defaultPrevented||ja(g??document.body,{select:!0}),l.removeEventListener(bb,u),XS.remove(h)},0)}}},[l,d,u,h]);const x=k.useCallback(g=>{if(!n&&!r||h.paused)return;const b=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,y=document.activeElement;if(b&&y){const _=g.currentTarget,[w,S]=CY(_);w&&S?!g.shiftKey&&y===S?(g.preventDefault(),n&&ja(w,{select:!0})):g.shiftKey&&y===w&&(g.preventDefault(),n&&ja(S,{select:!0})):y===_&&g.preventDefault()}},[n,r,h.paused]);return o.jsx(rn.div,{tabIndex:-1,...a,ref:p,onKeyDown:x})});W2.displayName=jY;function EY(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ja(r,{select:t}),document.activeElement!==n)return}function CY(e){const t=yP(e),n=JS(t,e),r=JS(t.reverse(),e);return[n,r]}function yP(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 JS(e,t){for(const n of e)if(!AY(n,{upTo:t}))return n}function AY(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 PY(e){return e instanceof HTMLInputElement&&"select"in e}function ja(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&PY(e)&&t&&e.select()}}var XS=LY();function LY(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=ZS(e,t),e.unshift(t)},remove(t){var n;e=ZS(e,t),(n=e[0])==null||n.resume()}}}function ZS(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function RY(e){return e.filter(t=>t.tagName!=="A")}var TY=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},cd=new WeakMap,Om=new WeakMap,Im={},yb=0,wP=function(e){return e&&(e.host||wP(e.parentNode))},OY=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=wP(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})},IY=function(e,t,n,r){var i=OY(t,Array.isArray(e)?e:[e]);Im[n]||(Im[n]=new WeakMap);var s=Im[n],a=[],l=new Set,c=new Set(i),d=function(f){!f||l.has(f)||(l.add(f),d(f.parentNode))};
vendor: 7,011 bytes, lines 597-612
597i.forEach(d);var u=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(p){if(l.has(p))u(p);else try{var h=p.getAttribute(r),x=h!==null&&h!=="false",g=(cd.get(p)||0)+1,b=(s.get(p)||0)+1;cd.set(p,g),s.set(p,b),a.push(p),g===1&&x&&Om.set(p,!0),b===1&&p.setAttribute(n,"true"),x||p.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return u(t),l.clear(),yb++,function(){a.forEach(function(f){var p=cd.get(f)-1,h=s.get(f)-1;cd.set(f,p),s.set(f,h),p||(Om.has(f)||f.removeAttribute(r),Om.delete(f)),h||f.removeAttribute(n)}),yb--,yb||(cd=new WeakMap,cd=new WeakMap,Om=new WeakMap,Im={})}},_P=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=TY(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),IY(r,i,n,"aria-hidden")):function(){return null}},Oa=function(){return Oa=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Oa.apply(this,arguments)};function DY(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 FY(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var bg="right-scroll-bar-position",yg="width-before-scroll-bar",MY="with-scroll-bars-hidden",$Y="--removed-body-scroll-bar-size";function wb(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function BY(e,t){var n=k.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 UY=typeof window<"u"?k.useLayoutEffect:k.useEffect,QS=new WeakMap;function zY(e,t){var n=BY(null,function(r){return e.forEach(function(i){return wb(i,r)})});return UY(function(){var r=QS.get(n);if(r){var i=new Set(r),s=new Set(e),a=n.current;i.forEach(function(l){s.has(l)||wb(l,null)}),s.forEach(function(l){i.has(l)||wb(l,a)})}QS.set(n,e)},[e]),n}var g0=function(){return g0=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},g0.apply(this,arguments)};function qY(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 WY(e){return e}function HY(e,t){t===void 0&&(t=WY);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(s){var a=t(s,r);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(s){for(r=!0;n.length;){var a=n;n=[],a.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(s),a=n}var c=function(){var u=a;a=[],u.forEach(s)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(u){a.push(u),d()},filter:function(u){return a=a.filter(u),n}}}};return i}function VY(e){e===void 0&&(e={});var t=HY(null);return t.options=g0({async:!0,ssr:!1},e),t}var kP=function(e){var t=e.sideCar,n=qY(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 k.createElement(r,g0({},n))};kP.isSideCarExport=!0;function GY(e,t){return e.useMedium(t),kP}var NP=VY(),_b=function(){},ax=k.forwardRef(function(e,t){var n=k.useRef(null),r=k.useState({onScrollCapture:_b,onWheelCapture:_b,onTouchMoveCapture:_b}),i=r[0],s=r[1],a=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,h=e.noRelative,x=e.noIsolation,g=e.inert,b=e.allowPinchZoom,y=e.as,_=y===void 0?"div":y,w=e.gapMode,S=DY(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=p,P=zY([n,t]),R=Oa(Oa({},S),i);return k.createElement(k.Fragment,null,u&&k.createElement(C,{sideCar:NP,removeScrollBar:d,shards:f,noRelative:h,noIsolation:x,inert:g,setCallbacks:s,allowPinchZoom:!!b,lockRef:n,gapMode:w}),a?k.cloneElement(k.Children.only(l),Oa(Oa({},R),{ref:P})):k.createElement(_,Oa({},R,{className:c,ref:P}),l))});ax.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ax.classNames={fullWidth:yg,zeroRight:bg};var YY=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function KY(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=YY();return t&&e.setAttribute("nonce",t),e}function JY(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function XY(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var ZY=function(){var e=0,t=null;return{add:function(n){e==0&&(t=KY())&&(JY(t,n),XY(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},QY=function(){var e=ZY();return function(t,n){k.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},SP=function(){var e=QY(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},eK={left:0,top:0,right:0,gap:0},kb=function(e){return parseInt(e||"",10)||0},tK=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[kb(n),kb(r),kb(i)]},nK=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return eK;var t=tK(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])}},rK=SP(),Jd="data-scroll-locked",iK=function(e,t,n,r){var i=e.left,s=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),`
598  .`.concat(MY,` {
599   overflow: hidden `).concat(r,`;
600   padding-right: `).concat(l,"px ").concat(r,`;
601  }
602  body[`).concat(Jd,`] {
603    overflow: hidden `).concat(r,`;
604    overscroll-behavior: contain;
605    `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
606    padding-left: `.concat(i,`px;
607    padding-top: `).concat(s,`px;
608    padding-right: `).concat(a,`px;
609    margin-left:0;
610    margin-top:0;
611    margin-right: `).concat(l,"px ").concat(r,`;
612    `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";
612")].filter(Boolean).join(""),`
613  }
614  
615  .`).concat(bg,` {
616    right: `).concat(l,"px ").concat(r,`;
617  }
618  
619  .`).concat(yg,` {
620    margin-right: `).concat(l,"px ").concat(r,`;
621  }
622  
623  .`).concat(bg," .").concat(bg,` {
624    right: 0 `).concat(r,`;
625  }
626  
627  .`).concat(yg," .").concat(yg,` {
628    margin-right: 0 `).concat(r,`;
629  }
630  
631  body[`).concat(Jd,`] {
632    `).concat($Y,": ").concat(l,`px;
633  }
634`)},ej=function(){var e=parseInt(document.body.getAttribute(Jd)||"0",10);return isFinite(e)?e:0},sK=function(){k.useEffect(function(){return document.body.setAttribute(Jd,(ej()+1).toString()),function(){var e=ej()-1;e<=0?document.body.removeAttribute(Jd):document.body.setAttribute(Jd,e.toString())}},[])},oK=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;sK();var s=k.useMemo(function(){return nK(i)},[i]);return k.createElement(rK,{styles:iK(s,!t,i,n?"":"!important")})},P1=!1;if(typeof window<"u")try{var Dm=Object.defineProperty({},"passive",{get:function(){return P1=!0,!0}});window.addEventListener("test",Dm,Dm),window.removeEventListener("test",Dm,Dm)}catch{P1=!1}var dd=P1?{passive:!1}:!1,aK=function(e){return e.tagName==="TEXTAREA"},jP=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!aK(e)&&n[t]==="visible")},lK=function(e){return jP(e,"overflowY")},cK=function(e){return jP(e,"overflowX")},tj=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=EP(e,r);if(i){var s=CP(e,r),a=s[1],l=s[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},dK=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},uK=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},EP=function(e,t){return e==="v"?lK(t):cK(t)},CP=function(e,t){return e==="v"?dK(t):uK(t)},hK=function(e,t){return e==="h"&&t==="rtl"?-1:1},fK=function(e,t,n,r,i){var s=hK(e,window.getComputedStyle(t).direction),a=s*r,l=n.target,c=t.contains(l),d=!1,u=a>0,f=0,p=0;do{if(!l)break;var h=CP(e,l),x=h[0],g=h[1],b=h[2],y=g-b-s*x;(x||y)&&EP(e,l)&&(f+=y,p+=x);var _=l.parentNode;l=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(u&&(Math.abs(f)<1||!i)||!u&&(Math.abs(p)<1||!i))&&(d=!0),d},Fm=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},nj=function(e){return[e.deltaX,e.deltaY]},rj=function(e){return e&&"current"in e?e.current:e},pK=function(e,t){return e[0]===t[0]&&e[1]===t[1]},mK=function(e){return`
635  .block-interactivity-`.concat(e,` {pointer-events: none;}
636  .allow-interactivity-`).concat(e,` {pointer-events: all;}
637`)},gK=0,ud=[];function xK(e){var t=k.useRef([]),n=k.useRef([0,0]),r=k.useRef(),i=k.useState(gK++)[0],s=k.useState(SP)[0],a=k.useRef(e);k.useEffect(function(){a.current=e},[e]),k.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var g=FY([e.lockRef.current],(e.shards||[]).map(rj),!0).filter(Boolean);return g.forEach(function(b){return b.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),g.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var l=k.useCallback(function(g,b){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!a.current.allowPinchZoom;var y=Fm(g),_=n.current,w="deltaX"in g?g.deltaX:_[0]-y[0],S="deltaY"in g?g.deltaY:_[1]-y[1],C,P=g.target,R=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in g&&R==="h"&&P.type==="range")return!1;var M=tj(R,P);if(!M)return!0;if(M?C=R:(C=R==="v"?"h":"v",M=tj(R,P)),!M)return!1;if(!r.current&&"changedTouches"in g&&(w||S)&&(r.current=C),!C)return!0;var T=r.current||C;return fK(T,b,g,T==="h"?w:S,!0)},[]),c=k.useCallback(function(g){var b=g;if(!(!ud.length||ud[ud.length-1]!==s)){var y="deltaY"in b?nj(b):Fm(b),_=t.current.filter(function(C){return C.name===b.type&&(C.target===b.target||b.target===C.shadowParent)&&pK(C.delta,y)})[0];if(_&&_.should){b.cancelable&&b.preventDefault();return}
vendor: 4,641 bytes, line 637
637if(!_){var w=(a.current.shards||[]).map(rj).filter(Boolean).filter(function(C){return C.contains(b.target)}),S=w.length>0?l(b,w[0]):!a.current.noIsolation;S&&b.cancelable&&b.preventDefault()}}},[]),d=k.useCallback(function(g,b,y,_){var w={name:g,delta:b,target:y,should:_,shadowParent:vK(y)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),u=k.useCallback(function(g){n.current=Fm(g),r.current=void 0},[]),f=k.useCallback(function(g){d(g.type,nj(g),g.target,l(g,e.lockRef.current))},[]),p=k.useCallback(function(g){d(g.type,Fm(g),g.target,l(g,e.lockRef.current))},[]);k.useEffect(function(){return ud.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,dd),document.addEventListener("touchmove",c,dd),document.addEventListener("touchstart",u,dd),function(){ud=ud.filter(function(g){return g!==s}),document.removeEventListener("wheel",c,dd),document.removeEventListener("touchmove",c,dd),document.removeEventListener("touchstart",u,dd)}},[]);var h=e.removeScrollBar,x=e.inert;return k.createElement(k.Fragment,null,x?k.createElement(s,{styles:mK(i)}):null,h?k.createElement(oK,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function vK(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const bK=GY(NP,xK);var H2=k.forwardRef(function(e,t){return k.createElement(ax,Oa({},e,{ref:t,sideCar:bK}))});H2.classNames=ax.classNames;var lx="Popover",[AP,QQ]=kc(lx,[Y0]),dp=Y0(),[yK,pl]=AP(lx),PP=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!1}=e,l=dp(t),c=k.useRef(null),[d,u]=k.useState(!1),[f,p]=$0({prop:r,defaultProp:i??!1,onChange:s,caller:lx});return o.jsx(HM,{...l,children:o.jsx(yK,{scope:t,contentId:lg(),triggerRef:c,open:f,onOpenChange:p,onOpenToggle:k.useCallback(()=>p(h=>!h),[p]),hasCustomAnchor:d,onCustomAnchorAdd:k.useCallback(()=>u(!0),[]),onCustomAnchorRemove:k.useCallback(()=>u(!1),[]),modal:a,children:n})})};PP.displayName=lx;var LP="PopoverAnchor",wK=k.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=pl(LP,n),s=dp(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:l}=i;return k.useEffect(()=>(a(),()=>l()),[a,l]),o.jsx(f2,{...s,...r,ref:t})});wK.displayName=LP;var RP="PopoverTrigger",TP=k.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=pl(RP,n),s=dp(n),a=Ln(t,i.triggerRef),l=o.jsx(rn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":MP(i.open),...r,ref:a,onClick:Ft(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?l:o.jsx(f2,{asChild:!0,...s,children:l})});TP.displayName=RP;var V2="PopoverPortal",[_K,kK]=AP(V2,{forceMount:void 0}),OP=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=pl(V2,t);return o.jsx(_K,{scope:t,forceMount:n,children:o.jsx(hl,{present:n||s.open,children:o.jsx(M0,{asChild:!0,container:i,children:r})})})};OP.displayName=V2;var wu="PopoverContent",IP=k.forwardRef((e,t)=>{const n=kK(wu,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,s=pl(wu,e.__scopePopover);return o.jsx(hl,{present:r||s.open,children:s.modal?o.jsx(SK,{...i,ref:t}):o.jsx(jK,{...i,ref:t})})});IP.displayName=wu;var NK=hu("PopoverContent.RemoveScroll"),SK=k.forwardRef((e,t)=>{const n=pl(wu,e.__scopePopover),r=k.useRef(null),i=Ln(t,r),s=k.useRef(!1);return k.useEffect(()=>{const a=r.current;if(a)return _P(a)},[]),o.jsx(H2,{as:NK,allowPinchZoom:!0,children:o.jsx(DP,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ft(e.onCloseAutoFocus,a=>{var l;a.preventDefault(),s.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Ft(e.onPointerDownOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:Ft(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),jK=k.forwardRef((e,t)=>{const n=pl(wu,e.__scopePopover),r=k.useRef(!1),i=k.useRef(!1);return o.jsx(DP,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,l;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=s.target;((d=n.triggerRef.current)==null?void 0:d.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),DP=k.forwardRef((e,t)=>
637{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...f}=e,p=pl(wu,n),h=dp(n);return bP(),o.jsx(W2,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:o.jsx(Xf,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:o.jsx(hA,{"data-state":MP(p.open),role:"dialog",id:p.contentId,...h,...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)"}})})})}),FP="PopoverClose",EK=k.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=pl(FP,n);return o.jsx(rn.button,{type:"button",...r,ref:t,onClick:Ft(e.onClick,()=>i.onOpenChange(!1))})});EK.displayName=FP;var CK="PopoverArrow",AK=k.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=dp(n);return o.jsx(fA,{...i,...r,ref:t})});AK.displayName=CK;function MP(e){return e?"open":"closed"}var PK=PP,LK=TP,RK=OP,$P=IP;const TK=PK,OK=LK,BP=k.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>o.jsx(RK,{children:o.jsx($P,{ref:i,align:t,sideOffset:n,className:Bn("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})}));BP.displayName=$P.displayName;const UP=({submissionId:e,asAdmin:t,maxHeightClass:n="max-h-64",title:r="Messages"})=>{const{user:i}=pn(),[s,a]=k.useState([]),[l,c]=k.useState(!0),[d,u]=k.useState(""),[f,p]=k.useState(!1),h=k.useRef(null);k.useEffect(()=>{let g=!1;(async()=>{c(!0);try{if(t){const{data:_,error:w}=await Ne.functions.invoke("admin-message-consignor",{body:{submissionId:e,action:"list"}});if(w)throw w;if(_!=null&&_.error)throw new Error(_.error);g||a((_==null?void 0:_.data)||[])}else{const{data:_,error:w}=await Ne.from("submission_messages").select("*").eq("submission_id",e).order("created_at",{ascending:!0});if(w)throw w;g||a(_||[])}}catch(_){console.error("Load messages failed:",_)}finally{g||c(!1)}})();const y=Ne.channel(`thread-${e}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"submission_messages",filter:`submission_id=eq.${e}`},_=>{const w=_.new;a(S=>S.some(C=>C.id===w.id)?S:[...S,w])}).subscribe();return()=>{g=!0,Ne.removeChannel(y)}},[e,t]),k.useEffect(()=>{h.current&&(h.current.scrollTop=h.current.scrollHeight)},[s.length]),k.useEffect(()=>{if(t)return;const g=s.filter(y=>y.sender_role==="admin"&&!y.read_at);if(g.length===0)return;const b=g.map(y=>y.id);Ne.from("submission_messages").update({read_at:new Date().toISOString()}).in("id",b).then(()=>{})},[s,t]);const x=async()=>{const g=d.trim();if(g){p(!0);try{if(t){const{data:b,error:y}=await Ne.functions.invoke("admin-message-consignor",{body:{submissionId:e,body:g}});if(y)throw y;if(b!=null&&b.error)throw new Error(b.error);me.success(b!=null&&b.emailQueued?"Message sent · consignor notified by email":"Message sent")}else{if(!i){me.error("Sign in to send messages");return}const{error:b}=await Ne.from("submission_messages").insert({submission_id:e,sender_user_id:i.id,sender_role:"consignor",body:g});if(b)throw b}u("")}catch(b){me.error(b.message||"Failed to send message")}finally{p(!1)}}};return o.jsxs("div",{className:"border border-border rounded-md bg-background",children:[o.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b border-border bg-muted/30",children:[o.jsx(pu,{size:12,className:"text-muted-foreground"}),o.jsx("p",{className:"text-[10px] font-body font-bold uppercase tracking-wider text-muted-foreground",children:r}),s.length>0&&o.jsxs("span",{className:"text-[10px] font-body text-muted-foreground ml-1",children:["· ",s.length]})]}),o.jsxs("div",{ref:h,className:`overflow-y-auto embed-scrollable p-3 space-y-2 ${n}`,children:[l&&o.jsx("p",{className:"text-xs font-body text-muted-foreground italic",children:"Loading…"}),!l&&s.length===0&&o.jsxs("p",{className:"text-xs font-body text-muted-foreground italic",children:["No messages yet. ",t?"Send a note to start the conversation.":"Our team will reply here."]}),s.map(g=>{const b=t?g.sender_role==="admin":g.sender_role==="consignor";return o.jsx("div",{className:`flex ${b?"justify-end":"justify-start"}`,children:o.jsxs("div",{className:`max-w-[80%] px-3 py-2 rounded-md text-xs font-body leading-relaxed ${g.sender_role==="admin"?"bg-primary/10 border border-primary/30 text-foreground":"bg-muted text-foreground"}`,children:[o.jsx("p",{className:"whitespace-pre-wrap break-words",children:g.body}),o.jsxs("p",{className:"text-[9px] font-body text-muted-foreground mt-1",children:[g.sender_role==="admin"?"Reverie Fine Art":"You"," ·"," ",new Date(g.created_at).toLocaleStr
637ing([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]})},g.id)})]}),o.jsxs("div",{className:"p-2 border-t border-border flex items-end gap-1.5",children:[o.jsx("textarea",{value:d,onChange:g=>u(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&(g.preventDefault(),x())},placeholder:t?"Reply to consignor… (⌘+Enter to send)":"Write a message… (⌘+Enter to send)",rows:2,disabled:f,className:"flex-1 px-2.5 py-1.5 text-xs font-body bg-background border border-input rounded-md focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20 resize-none placeholder:text-muted-foreground/50 disabled:opacity-50"}),o.jsx("button",{onClick:x,disabled:f||!d.trim(),className:"px-2.5 py-2 text-xs font-body font-semibold bg-primary text-primary-foreground rounded-md hover:brightness-105 transition-all flex items-center gap-1 disabled:opacity-50","aria-label":"Send message",children:f?o.jsx(Qw,{size:12,className:"animate-spin"}):o.jsx(z7,{size:12})})]})]})},ij={pending_review:"bg-amber-100 text-amber-800",approved:"bg-emerald-100 text-emerald-800",listed:"bg-sky-100 text-sky-800",sold:"bg-violet-100 text-violet-800",declined:"bg-red-100 text-red-800"},sj={pending_review:"Pending",approved:"Approved",listed:"Listed",sold:"Sold",declined:"Declined"},oj=[{key:"pending_review",label:"Pending"},{key:"approved",label:"Approved"},{key:"listed",label:"Listed"},{key:"sold",label:"Sold"},{key:"declined",label:"Declined"},{key:null,label:"All"}],IK=({isAdmin:e,onApproveToShopify:t})=>{const[n,r]=k.useState([]),i=Cs(),[s,a]=k.useState(!1),[l,c]=k.useState(e),[d,u]=k.useState("pending_review"),[f,p]=k.useState({}),[h,x]=k.useState(null),[g,b]=k.useState(""),[y,_]=k.useState(!1),[w,S]=k.useState(new Set),[C,P]=k.useState(!1),[R,M]=k.useState(""),[T,H]=k.useState("50"),[A,O]=k.useState("pending"),[K,U]=k.useState(""),[I,re]=k.useState(!1),[V,$]=k.useState(new Date),[D,ie]=k.useState(""),[X,E]=k.useState(""),[q,F]=k.useState(!1),[Z,Y]=k.useState(null),[ee,ce]=k.useState(!1);k.useEffect(()=>{var se,Q;h&&(M(((se=h.sale_price)==null?void 0:se.toString())??""),H(((Q=h.commission_rate)==null?void 0:Q.toString())??"50"),O(h.payout_status??"pending"),U(h.payout_notes??""))},[h]),k.useEffect(()=>{const se=h==null?void 0:h.user_id;if(!se){Y(null);return}let Q=!1;return ce(!0),Ne.functions.invoke("admin-payout-profile",{body:{userId:se}}).then(({data:he})=>{Q||Y((he==null?void 0:he.profile)??null)}).catch(()=>{Q||Y(null)}).finally(()=>{Q||ce(!1)}),()=>{Q=!0}},[h==null?void 0:h.user_id]);const ue=async()=>{a(!0);try{const{data:se,error:Q}=await Ne.rpc("get_all_consignment_submissions",{status_filter:d});if(Q)throw Q;r(se||[]);const{data:he}=await Ne.rpc("get_all_consignment_submissions",{status_filter:null}),ve={};he==null||he.forEach(we=>{ve[we.status]=(ve[we.status]||0)+1}),p(ve)}catch(se){me.error(se.message||"Failed to load consignments")}finally{a(!1)}};k.useEffect(()=>{l&&e&&ue(),S(new Set)},[l,e,d]);const ye=se=>{S(Q=>{const he=new Set(Q);return he.has(se)?he.delete(se):he.add(se),he})},Se=()=>{w.size===n.length?S(new Set):S(new Set(n.map(se=>se.id)))},De=async se=>{if(w.size===0)return;const Q=Array.from(w),he={approved:"approved",declined:"declined",listed:"marked as listed",sold:"marked as sold",pending_review:"reset to pending"},ve=`${he[se]||se} ${Q.length} submission${Q.length===1?"":"s"}?`;if(window.confirm(ve.charAt(0).toUpperCase()+ve.slice(1))){P(!0);try{const{data:we,error:Le}=await Ne.functions.invoke("admin-update-consignment",{body:{submissionIds:Q,newStatus:se}});if(Le)throw Le;if(we!=null&&we.error)throw new Error(we.error);me.success(`${(we==null?void 0:we.updatedCount)??Q.length} submission${((we==null?void 0:we.updatedCount)??Q.length)===1?"":"s"} ${he[se]||se}`+(we!=null&&we.emailsQueued?` · ${we.emailsQueued} email${we.emailsQueued===1?"":"s"} sent`:"")),S(new Set),ue()}catch(we){me.error(we.message||"Bulk update failed")}finally{P(!1)}}},Re=n.filter(se=>w.has(se.id)&&(se.payout_amount||0)>0&&se.payout_status!=="paid"),qe=async()=>{if(Re.length===0){me.error("Selected rows have no outstanding payout amounts.");return}F(!0);try{const{data:se,error:Q}=await Ne.functions.invoke("admin-update-consignment",{body:{submissionIds:Re.map(ve=>ve.id),bulkPayout:{payoutStatus:"paid",payoutPaidAt:V?V.toISOString():new Date().toISOString(),payoutReference:D.trim()||void 0,payoutN
637otes:X.trim()||void 0}}});if(Q)throw Q;if(se!=null&&se.error)throw new Error(se.error);const he=Re.reduce((ve,we)=>ve+(we.payout_amount||0),0);me.success(`Marked ${(se==null?void 0:se.updatedCount)??Re.length} payout${Re.length===1?"":"s"} paid · $${Math.round(he).toLocaleString()}`+(se!=null&&se.payoutEmailsQueued?` · ${se.payoutEmailsQueued} email${se.payoutEmailsQueued===1?"":"s"} sent`:"")),re(!1),ie(""),E(""),$(new Date),S(new Set),ue()}catch(se){me.error(se.message||"Bulk mark paid failed")}finally{F(!1)}},te=async(se,Q)=>{_(!0);try{const he=parseFloat(R),ve=parseFloat(T),we={};Number.isFinite(he)&&he>0&&(we.salePrice=he,we.commissionRate=Number.isFinite(ve)?ve:50),A&&A!==(se.payout_status??"pending")&&(we.payoutStatus=A),K!==(se.payout_notes??"")&&(we.payoutNotes=K);const{data:Le,error:Fe}=await Ne.functions.invoke("admin-update-consignment",{body:{submissionId:se.id,newStatus:Q,notes:g,payout:Object.keys(we).length>0?we:void 0}});if(Fe)throw Fe;if(Le!=null&&Le.error)throw new Error(Le.error);const Ve={approved:"approved",declined:"declined",listed:"marked as listed",sold:"marked as sold",pending_review:"reset to pending"};me.success(`Submission ${Ve[Q]||Q}${Le!=null&&Le.emailQueued?" · email sent to consignor":""}`),Q==="approved"&&t&&t(se),x(null),b(""),ue()}catch(he){me.error(he.message||"Failed to update status")}finally{_(!1)}};if(!e)return null;const Oe=se=>{if(se.formula_value&&Number(se.formula_value)>0)return Number(se.formula_value);if(se.ai_value&&Number(se.ai_value)>0)return Number(se.ai_value);const Q=se.base_value||0,he=se.scarcity_multiplier||0,ve=se.provenance_uplift||0;return Q+Q*(he/100)+Q*(ve/100)},be=f.pending_review||0;return o.jsxs("div",{className:"border border-border rounded-sm p-5 bg-muted/30 space-y-4",children:[o.jsxs("button",{onClick:()=>c(!l),className:"flex items-center justify-between w-full",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h3",{className:"font-display text-lg font-bold tracking-wide",children:"Consignment Submissions"}),!l&&be>0&&o.jsxs("span",{className:"px-2 py-0.5 text-[10px] font-body font-bold bg-amber-100 text-amber-800 rounded-full",children:[be," pending"]})]}),o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`transition-transform ${l?"rotate-180":""}`,children:o.jsx("path",{d:"m6 9 6 6 6-6"})})]}),l&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"flex flex-wrap gap-1",children:oj.map(({key:se,label:Q})=>{const he=se===null?Object.values(f).reduce((ve,we)=>ve+we,0):f[se]||0;return o.jsxs("button",{onClick:()=>u(se),className:`px-3 py-1.5 text-xs font-body font-semibold rounded-md transition-colors flex items-center gap-1.5 ${d===se?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"}`,children:[Q,o.jsx("span",{className:`px-1.5 py-0.5 text-[9px] font-bold rounded-full ${d===se?"bg-primary-foreground/20 text-primary-foreground":"bg-background text-foreground"}`,children:he})]},Q)})}),s&&o.jsx("p",{className:"text-sm font-body text-muted-foreground",children:"Loading…"}),!s&&n.length===0&&o.jsx("p",{className:"text-sm font-body text-muted-foreground",children:"No consignment submissions"}),!s&&n.length>0&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2 p-2.5 rounded-md bg-background border border-border",children:[o.jsxs("button",{onClick:Se,className:"flex items-center gap-1.5 text-xs font-body font-semibold text-muted-foreground hover:text-foreground transition-colors",children:[w.size===n.length&&n.length>0?o.jsx(yk,{size:14,className:"text-primary"}):o.jsx(wk,{size:14}),w.size===n.length&&n.length>0?"Deselect all":"Select all"]}),w.size>0&&o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"text-xs font-body font-semibold text-foreground ml-1",children:[w.size," selected"]}),o.jsxs("div",{className:"flex flex-wrap gap-1.5 ml-auto",children:[o.jsxs("button",{onClick:()=>De("approved"),disabled:C,className:"px-2.5 py-1 text-[11px] font-body font-semibold bg-emerald-600 text-white rounded-sm hover:brightness-105 transition-all flex items-center gap-1 disabled:opacity-50",children:[o.jsx(uo,{size:11})," Approve"]}),o.jsxs("button",{onClick:()=>De("listed"),disabled:C,className:"px-2.5 py-1 text-[11px] font-body font-semibold bg-sky-600 text-white rounded-sm hover:brightness-105 transition-all flex items-center gap-1 disabled:opacity-50",children:[o.jsx(Ud,{size:11})," Listed"]}),o.jsxs("button",{onClick:()=>De("sold"),disabled:C,className:"px-2.5 py-1 text-[11px] font-body font-semibold bg-vi
637olet-600 text-white rounded-sm hover:brightness-105 transition-all flex items-center gap-1 disabled:opacity-50",children:[o.jsx(Wo,{size:11})," Sold"]}),o.jsxs("button",{onClick:()=>De("declined"),disabled:C,className:"px-2.5 py-1 text-[11px] font-body font-semibold border border-red-300 text-red-700 rounded-sm hover:bg-red-50 transition-all flex items-center gap-1 disabled:opacity-50",children:[o.jsx(Hr,{size:11})," Decline"]}),o.jsxs("button",{onClick:async()=>{const se=n.filter(Q=>w.has(Q.id)&&(Q.sale_price!=null||Q.payout_amount!=null));if(se.length===0){me.error("Select sold works with payout figures first.");return}try{await E1(se,se.length===1?se[0].submitter_name||"Consignor":"Consignors"),me.success(`Statement for ${se.length} work${se.length===1?"":"s"} generated`)}catch{me.error("Could not generate statements")}},disabled:C,className:"px-2.5 py-1 text-[11px] font-body font-semibold border border-violet-300 text-violet-800 rounded-sm hover:bg-violet-50 transition-all flex items-center gap-1 disabled:opacity-50",title:"Generate payout statements for selected works",children:[o.jsx(Ho,{size:11})," Statements"]}),o.jsxs("button",{onClick:()=>{if(Re.length===0){me.error("Selected rows have no outstanding payouts. Set a sale price first.");return}re(!0)},disabled:C,className:"px-2.5 py-1 text-[11px] font-body font-semibold bg-emerald-700 text-white rounded-sm hover:brightness-105 transition-all flex items-center gap-1 disabled:opacity-50",title:"Mark selected payouts as paid",children:[o.jsx(ag,{size:11})," Mark Paid"]}),o.jsxs("button",{onClick:()=>De("pending_review"),disabled:C,className:"px-2.5 py-1 text-[11px] font-body font-semibold border border-input text-muted-foreground rounded-sm hover:bg-muted/60 transition-all flex items-center gap-1 disabled:opacity-50",children:[o.jsx(bk,{size:11})," Reset"]})]})]}),w.size===0&&o.jsx("span",{className:"text-[11px] font-body text-muted-foreground italic ml-auto mr-2",children:"Select rows to apply a bulk action"}),o.jsxs("div",{className:"flex gap-1.5",children:[o.jsxs("button",{onClick:()=>{const se=w.size>0?n.filter(ve=>w.has(ve.id)):n,Q=d||"all",he=new Date().toISOString().slice(0,10);$V(se,`consignments-${Q}-${he}.csv`),me.success(`Exported ${se.length} row${se.length===1?"":"s"} to CSV`)},className:"px-2.5 py-1 text-[11px] font-body font-semibold border border-input text-foreground rounded-sm hover:bg-muted/60 transition-all flex items-center gap-1",title:"Export to CSV",children:[o.jsx(R7,{size:11})," CSV"]}),o.jsxs("button",{onClick:()=>{var we;const se=w.size>0?n.filter(Le=>w.has(Le.id)):n,Q=d||"all",he=new Date().toISOString().slice(0,10),ve=((we=oj.find(Le=>Le.key===d))==null?void 0:we.label)||"All";BV(se,`consignments-${Q}-${he}.pdf`,ve),me.success(`Exported ${se.length} row${se.length===1?"":"s"} to PDF`)},className:"px-2.5 py-1 text-[11px] font-body font-semibold border border-input text-foreground rounded-sm hover:bg-muted/60 transition-all flex items-center gap-1",title:"Export to PDF",children:[o.jsx(q0,{size:11})," PDF"]})]})]}),n.map(se=>{const Q=w.has(se.id);return o.jsxs("div",{className:`border rounded-md p-4 bg-card space-y-2 hover:shadow-[var(--shadow-sm)] transition-shadow ${Q?"border-primary/60 ring-1 ring-primary/20":"border-border"}`,children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex gap-3 min-w-0 flex-1",children:[o.jsx("button",{onClick:()=>ye(se.id),className:"flex-shrink-0 mt-0.5 text-muted-foreground hover:text-foreground transition-colors","aria-label":Q?"Deselect submission":"Select submission",children:Q?o.jsx(yk,{size:16,className:"text-primary"}):o.jsx(wk,{size:16})}),se.image_url&&o.jsx("img",{src:se.image_url,alt:se.artwork_title||"Artwork",className:"w-16 h-16 rounded-sm object-cover border border-border flex-shrink-0"}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("p",{className:"text-sm font-body font-semibold truncate",children:[se.artist_name||"Unknown Artist"," — ",o.jsx("span",{className:"italic font-normal text-muted-foreground",children:se.artwork_title||"Untitled"})]}),o.jsxs("p",{className:"text-xs font-body text-muted-foreground mt-0.5",children:["Submitted by ",se.submitter_name||"Unknown"," · ",new Date(se.created_at).toLocaleDateString()]}),o.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-xs font-body text-muted-foreground mt-1",children:[se.medium&&o.jsx("span",{children:se.medium}),se.dimensions&&o.jsx("span",{children:se.dimensions}),Oe(se)>0&&o.jsxs("span",{className:"font-semibold text-foreground",children:["$",Oe(se).toLocaleStr
637ing()]})]})]})]}),o.jsx("span",{className:`px-2 py-0.5 text-[10px] font-body font-bold rounded-full whitespace-nowrap ${ij[se.status]||"bg-muted text-muted-foreground"}`,children:sj[se.status]||se.status})]}),se.admin_notes&&o.jsxs("p",{className:"text-xs font-body text-muted-foreground italic",children:["Admin notes: ",se.admin_notes]}),o.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[o.jsxs("button",{onClick:()=>{x(se),b(se.admin_notes||"")},className:"px-3 py-1.5 text-xs font-body font-semibold bg-primary text-primary-foreground rounded-md hover:brightness-105 transition-all flex items-center gap-1",children:[o.jsx(Qg,{size:12})," Review"]}),se.status==="approved"&&o.jsxs("button",{onClick:()=>{x(se),b(se.admin_notes||"")},className:"px-3 py-1.5 text-xs font-body font-semibold bg-sky-600 text-white rounded-md hover:brightness-105 transition-all flex items-center gap-1",children:[o.jsx(Ud,{size:12})," Mark Listed"]}),se.status==="listed"&&o.jsxs("button",{onClick:()=>{x(se),b(se.admin_notes||"")},className:"px-3 py-1.5 text-xs font-body font-semibold bg-violet-600 text-white rounded-md hover:brightness-105 transition-all flex items-center gap-1",children:[o.jsx(Wo,{size:12})," Mark Sold"]})]})]},se.id)})]})]}),h&&o.jsx("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center overflow-y-auto overscroll-contain bg-foreground
637/30 p-4 backdrop-blur-sm",style:i,onClick:()=>x(null),children:o.jsxs("div",{className:"max-h-[calc(var(--embed-visible-height,100vh)-2rem)] w-full max-w-lg space-y-4 overflow-y-auto rounded-md border border-border bg-card p-5 shadow-[var(--shadow-lg)] sm:p-6",onClick:se=>se.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"review-submission-title",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{id:"review-submission-title",className:"font-display text-lg font-bold tracking-wide",children:"Review Submission"}),o.jsx("span",{className:`px-2 py-0.5 text-[10px] font-body font-bold rounded-full ${ij[h.status]||"bg-muted text-muted-foreground"}`,children:sj[h.status]||h.status})]}),o.jsxs("div",{className:"space-y-2 text-sm font-body",children:[o.jsxs("p",{children:[o.jsx("strong",{children:"Artist:"})," ",h.artist_name||"—"]}),o.jsxs("p",{children:[o.jsx("strong",{children:"Title:"})," ",h.artwork_title||"—"]}),o.jsxs("p",{children:[o.jsx("strong",{children:"Year:"})," ",h.year||"—"]}),o.jsxs("p",{children:[o.jsx("strong",{children:"Medium:"})," ",h.medium||"—"]}),o.jsxs("p",{children:[o.jsx("strong",{children:"Dimensions:"})," ",h.dimensions||"—"]}),o.jsxs("p",{children:[o.jsx("strong",{children:"Condition:"})," ",h.condition||"—"]}),o.jsxs("p",{children:[o.jsx("strong",{children:"Edition:"})," ",h.edition||"—"]}),o.jsxs("p",{children:[o.jsx("strong",{children:"Suggested Value:"})," $",Oe(h).toLocaleString()]}),o.jsxs("p",{children:[o.jsx("strong",{children:"Consignor:"})," ",h.submitter_name||"—"]}),h.submitter_phone&&o.jsxs("p",{children:[o.jsx("strong",{children:"Phone:"})," ",h.submitter_phone]})]}),(()=>{const se=Oe(h),Q=h.asking_price,he=h.list_price,ve=Q!=null&&se>0?Q-se:null,we=ve!=null&&se>0?ve/se*100:null;return o.jsxs("div",{className:"border border-border rounded-md p-3 bg-background space-y-2",children:[o.jsx("p",{className:"text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground",children:"Pricing"}),o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[o.jsxs("div",{className:"rounded-sm bg-muted/40 px-2 py-1.5",children:[o.jsx("div",{className:"text-[9px] font-body uppercase tracking-wider text-muted-foreground",children:"Recommended"}),o.jsx("div",{className:"text-sm font-body font-semibold",children:se>0?`$${Math.round(se).toLocaleString()}`:"—"})]}),o.jsxs("div",{className:"rounded-sm bg-muted/40 px-2 py-1.5",children:[o.jsx("div",{className:"text-[9px] font-body uppercase tracking-wider text-muted-foreground",children:"Consignor Asking"}),o.jsx("div",{className:"text-sm font-body font-semibold",children:Q!=null?`$${Math.round(Q).toLocaleString()}`:"—"}),ve!=null&&Math.abs(ve)>=1&&o.jsxs("div",{className:`text-[10px] font-body ${ve>0?"text-amber-700":"text-emerald-700"}`,children:[ve>0?"+":"","$",Math.round(ve).toLocaleString(),we!=null&&` (${we>0?"+":""}${we.toFixed(1)}%)`]})]}),o.jsxs("div",{className:"rounded-sm bg-muted/40 px-2 py-1.5",children:[o.jsx("div",{className:"text-[9px] font-body uppercase tracking-wider text-muted-foreground",children:"Final List"}),o.jsx("div",{className:"text-sm font-body font-semibold",children:he!=null?`$${Math.round(he).toLocaleString()}`:"—"})]})]}),o.jsx("p",{className:"text-[10px] font-body text-muted-foreground italic",children:"You'll confirm the final retail price when approving / pushing to Shopify."})]})})(),h.image_url&&o.jsx("img",{src:h.image_url,alt:h.artwork_title||"Artwork",className:"w-full max-h-48 object-contain rounded-md border border-border"}),h.artist_bio&&o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-body font-semibold text-muted-foreground uppercase tracking-wider mb-1",children:"Artist Bio"}),o.jsx("p",{className:"text-xs font-body text-muted-foreground leading-relaxed",children:h.artist_bio})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("label",{className:"block text-xs font-semibold font-body uppercase tracking-wider text-muted-foreground",children:["Note to Consignor ",o.jsx("span",{className:"normal-case font-normal",children:"(included in status email)"})]}),o.jsx("textarea",{value:g,onChange:se=>b(se.target.value),placeholder:"Optional message — e.g. pricing notes, next steps",rows:3,className:"w-full px-3.5 py-2.5 text-sm font-medium font-body bg-background border border-input rounded-md shadow-[var(--shadow-sm)] focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20 transition-all resize-none placeholder:text-muted-foreground
637/50"})]}),o.jsx(UP,{submissionId:h.id,asAdmin:!0,title:"Conversation with consignor",maxHeightClass:"max-h-56"}),(h.status==="listed"||h.status==="sold"||h.sale_price!=null)&&(()=>{const se=parseFloat(R),Q=parseFloat(T),he=Number.isFinite(se)&&se>0,ve=Number.isFinite(Q)?Q:50,we=he?+(se*(1-ve/100)).toFixed(2):h.payout_amount??0,Le=he?+(se*(ve/100)).toFixed(2):0;return o.jsxs("div",{className:"space-y-2 p-3 rounded-md bg-violet-50/50 border border-violet-200",children:[o.jsx("p",{className:"text-[10px] font-body font-bold uppercase tracking-wider text-violet-900",children:"Payout Ledger"}),o.jsxs("div",{className:"p-2 rounded-sm bg-background border border-violet-200 space-y-0.5",children:[o.jsx("p",{className:"text-[9px] font-body font-bold uppercase tracking-wider text-muted-foreground",children:"Consignor payout details"}),ee?o.jsx("p",{className:"text-[11px] font-body text-muted-foreground",children:"Loading…"}):Z?o.jsxs("div",{className:"text-[11px] font-body space-y-0.5",children:[o.jsxs("p",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Pay to:"})," ",o.jsx("span",{className:"font-semibold",children:Z.payee_name||"—"})]}),o.jsxs("p",{className:"capitalize",children:[o.jsx("span",{className:"text-muted-foreground",children:"Method:"})," ",(Z.method||"—").replace("ach","Bank transfer (ACH)")]}),Z.payout_instructions&&o.jsxs("p",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Handle/note:"})," ",Z.payout_instructions]}),Z.mailing_address&&o.jsxs("p",{className:"whitespace-pre-line",children:[o.jsx("span",{className:"text-muted-foreground",children:"Address:"})," ",Z.mailing_address]}),(Z.contact_email||Z.phone)&&o.jsxs("p",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Contact:"})," ",[Z.contact_email,Z.phone].filter(Boolean).join(" · ")]}),o.jsxs("p",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Tax form:"})," ",(Z.tax_form_status||"not_submitted").replace(/_/g," ")]})]}):o.jsx("p",{className:"text-[11px] font-body text-amber-800",children:"No payout details on file — ask the consignor to complete “Payout details” in their dashboard before releasing funds."})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"block text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground",children:"Sale Price ($)"}),o.jsx("input",{type:"number",step:"0.01",min:"0",value:R,onChange:Fe=>M(Fe.target.value),placeholder:"0.00",className:"w-full px-2.5 py-1.5 text-sm font-body bg-background border border-input rounded-md focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"block text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground",children:"Commission (%)"}),o.jsx("input",{type:"number",step:"0.1",min:"0",max:"100",value:T,onChange:Fe=>H(Fe.target.value),className:"w-full px-2.5 py-1.5 text-sm font-body bg-background border border-input rounded-md focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20"})]})]}),he&&o.jsxs("div",{className:"grid grid-cols-3 gap-2 pt-1 text-[11px] font-body",children:[o.jsxs("div",{className:"text-center p-1.5 bg-background rounded-sm border border-border",children:[o.jsx("p",{className:"text-muted-foreground text-[9px] uppercase tracking-wider",children:"Gross"}),o.jsxs("p",{className:"font-semibold",children:["$",se.toLocaleString()]})]}),o.jsxs("div",{className:"text-center p-1.5 bg-background rounded-sm border border-border",children:[o.jsx("p",{className:"text-muted-foreground text-[9px] uppercase tracking-wider",children:"Commission"}),o.jsxs("p",{className:"font-semibold text-amber-700",children:["$",Le.toLocaleString()]})]}),o.jsxs("div",{className:"text-center p-1.5 bg-violet-100 rounded-sm border border-violet-300",children:[o.jsx("p",{className:"text-violet-800 text-[9px] uppercase tracking-wider",children:"Payout"}),o.jsxs("p",{className:"font-bold text-violet-900",children:["$",we.toLocaleStr
637ing()]})]})]}),o.jsx("div",{className:"grid grid-cols-3 gap-1",children:["pending","processing","paid"].map(Fe=>o.jsx("button",{type:"button",onClick:()=>O(Fe),className:`px-2 py-1.5 text-[10px] font-body font-semibold rounded-sm transition-all capitalize ${A===Fe?"bg-violet-600 text-white":"bg-background border border-input text-muted-foreground hover:bg-muted/60"}`,children:Fe},Fe))}),o.jsx("input",{type:"text",value:K,onChange:Fe=>U(Fe.target.value),placeholder:"Payment reference, method, or note (optional)",className:"w-full px-2.5 py-1.5 text-xs font-body bg-background border border-input rounded-md focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20 placeholder:text-muted-foreground/50"}),h.payout_paid_at&&o.jsxs("p",{className:"text-[10px] font-body text-muted-foreground italic",children:["Last paid ",new Date(h.payout_paid_at).toLocaleString()]}),o.jsxs("button",{type:"button",onClick:async()=>{try{await E1([h],h.submitter_name||"Consignor"),me.success("Payout statement generated")}catch{me.error("Could not generate statement")}},className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] font-body font-semibold border border-violet-300 text-violet-900 rounded-sm hover:bg-violet-100 transition-all",children:[o.jsx(Ho,{size:11})," Consignor payout statement (PDF)"]})]})})(),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-[10px] font-body font-bold uppercase tracking-wider text-muted-foreground",children:"Update Status"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.status!=="approved"&&o.jsxs("button",{onClick:()=>te(h,"approved"),disabled:y,className:"px-3 py-2.5 text-xs font-body font-semibold bg-emerald-600 text-white rounded-md hover:brightness-105 transition-all flex items-center justify-center gap-1.5 disabled:opacity-50",children:[o.jsx(uo,{size:13})," Approve"]}),h.status!=="listed"&&o.jsxs("button",{onClick:()=>te(h,"listed"),disabled:y,className:"px-3 py-2.5 text-xs font-body font-semibold bg-sky-600 text-white rounded-md hover:brightness-105 transition-all flex items-center justify-center gap-1.5 disabled:opacity-50",children:[o.jsx(Ud,{size:13})," Mark Listed"]}),h.status!=="sold"&&o.jsxs("button",{onClick:()=>te(h,"sold"),disabled:y,className:"px-3 py-2.5 text-xs font-body font-semibold bg-violet-600 text-white rounded-md hover:brightness-105 transition-all flex items-center justify-center gap-1.5 disabled:opacity-50",children:[o.jsx(Wo,{size:13})," Mark Sold"]}),h.status!=="declined"&&o.jsxs("button",{onClick:()=>te(h,"declined"),disabled:y,className:"px-3 py-2.5 text-xs font-body font-semibold border border-red-300 text-red-700 rounded-md hover:bg-red-50 transition-all flex items-center justify-center gap-1.5 disabled:opacity-50",children:[o.jsx(Hr,{size:13})," Decline"]}),h.status!=="pending_review"&&o.jsxs("button",{onClick:()=>te(h,"pending_review"),disabled:y,className:"px-3 py-2.5 text-xs font-body font-semibold border border-input text-muted-foreground rounded-md hover:bg-muted/60 transition-all flex items-center justify-center gap-1.5 disabled:opacity-50 col-span-2",children:[o.jsx(bk,{size:13})," Reset to Pending"]})]}),o.jsx("button",{onClick:()=>x(null),className:"w-full mt-1 px-3 py-2 text-xs font-body font-medium text-muted-foreground hover:text-foreground transition-colors",children:"Close"})]})]})}),I&&o.jsx("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center overflow-y-auto overscroll-contain bg-foreground
637/30 p-4 backdrop-blur-sm",style:i,onClick:()=>!q&&re(!1),children:o.jsxs("div",{className:"max-h-[calc(var(--embed-visible-height,100vh)-2rem)] w-full max-w-md space-y-4 overflow-y-auto rounded-md border border-border bg-card p-5 shadow-[var(--shadow-lg)] sm:p-6",onClick:se=>se.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bulk-paid-title",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ag,{size:18,className:"text-emerald-700"}),o.jsx("h3",{id:"bulk-paid-title",className:"font-display text-lg font-bold tracking-wide",children:"Bulk Mark Paid"})]}),o.jsxs("div",{className:"rounded-md border border-border bg-muted/40 p-3 space-y-1.5",children:[o.jsxs("p",{className:"text-xs font-body text-muted-foreground",children:[Re.length," payout",Re.length===1?"":"s"," will be marked as"," ",o.jsx("span",{className:"font-semibold text-foreground",children:"paid"})]}),o.jsxs("p",{className:"text-base font-display font-bold text-emerald-700",children:["$",Math.round(Re.reduce((se,Q)=>se+(Q.payout_amount||0),0)).toLocaleString()]}),o.jsx("p",{className:"text-[10px] font-body text-muted-foreground italic",children:"Already-paid rows in your selection are skipped automatically."})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{className:"block text-xs font-semibold font-body uppercase tracking-wider text-muted-foreground",children:"Paid Date"}),o.jsxs(TK,{children:[o.jsx(OK,{asChild:!0,children:o.jsxs("button",{type:"button",className:Bn("w-full px-3 py-2.5 text-sm font-body bg-background border border-input rounded-md text-left flex items-center gap-2 hover:border-primary/40 transition-colors",!V&&"text-muted-foreground"),children:[o.jsx(k7,{size:14,className:"text-muted-foreground"}),V?fl(V,"PPP"):"Pick a date"]})}),o.jsx(BP,{className:"w-auto p-0",align:"start",children:o.jsx(vP,{mode:"single",selected:V,onSelect:$,disabled:se=>se>new Date,initialFocus:!0,className:Bn("p-3 pointer-events-auto")})})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("label",{className:"block text-xs font-semibold font-body uppercase tracking-wider text-muted-foreground",children:["Payment Reference ",o.jsx("span",{className:"normal-case font-normal",children:"(optional)"})]}),o.jsx("input",{type:"text",value:D,onChange:se=>ie(se.target.value),placeholder:"e.g., ACH batch #2026-04-22, check #1042",className:"w-full px-3 py-2 text-sm font-body bg-background border border-input rounded-md focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20 placeholder:text-muted-foreground/50"})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("label",{className:"block text-xs font-semibold font-body uppercase tracking-wider text-muted-foreground",children:["Notes ",o.jsx("span",{className:"normal-case font-normal",children:"(optional)"})]}),o.jsx("textarea",{value:X,onChange:se=>E(se.target.value),rows:2,placeholder:"Internal note attached to all selected payouts",className:"w-full px-3 py-2 text-sm font-body bg-background border border-input rounded-md focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20 resize-none placeholder:text-muted-foreground/50"})]}),o.jsxs("div",{className:"flex gap-2 pt-1",children:[o.jsx("button",{onClick:()=>re(!1),disabled:q,className:"flex-1 px-4 py-2.5 text-sm font-body font-medium text-muted-foreground border border-input rounded-md hover:bg-muted/60 transition-all disabled:opacity-50",children:"Cancel"}),o.jsxs("button",{onClick:qe,disabled:q||Re.length===0||!V,className:"flex-1 px-4 py-2.5 text-sm font-body font-semibold bg-emerald-700 text-white rounded-md shadow-[var(--shadow-md)] hover:brightness-105 transition-all disabled:opacity-50 flex items-center justify-center gap-1.5",children:[o.jsx(ag,{size:14}),q?"Marking…":"Mark Paid"]})]})]})})]})},DK=[{id:"embed-loader",label:"Valuation tool page embed",where:"/pages/art-valuation"},{id:"badge",label:"Live valuation badge",where:"product.liquid"},{id:"provenance",label:"Provenance timeline",where:"product.liquid"},{id:"trust-strip",label:"Sitewide trust strip",where:"theme.liquid"},{id:"recently-revalued",label:"Recently revalued feed",where:"home / collection"},{id:"featured-artists",label:"Featured artists",where:"/pages/featured-artists"},{id:"collection-search",label:"Collection search",where:"home / collections"}],FK=e=>{if(!e)return"never";const t=Math.max(0,Math.round((Date.now()-new Date(e).getTime())/6e4));return t<60?`${t}m ago`:t<1440?`${Math.round(t/60)}h ago`:`${Math.round(t/1440)}d ago`},G2=()=>{const[e,t]=k.useState(null),[n,r]=k.useState(null),[i,s]=k.useState(0);k.useEffect(()=>{let d=!0;return t(null),r(null),Ne.functions.invoke("admin-embed-funnel",{body:{days:7}}).then(({data:u,error:f})=>{if(d){if(f)throw f;t((u==null?void 0:u.widgets)||[])}}).catch(u=>d&&r(u.message||"Could not load install health")),()=>{d=!1}},[i]);const a=new Map((e||[]).map(d=>[d.widget,d])),l=d=>{if(!d||d.pings===0)return{label:"Not detected",tone:"muted"};const u=d.rendered_pings??0;return u>0?d.error_pings>u?{label:"Live with errors",tone:"warn"}:{label:"Live",tone:"ok"}:d.error_pings>0?{label:"Live with errors",tone:"warn"}:d.ok_pings===0?{label:"Loading, not rendering",tone:"warn"}:{label:"Live",tone:"ok"}},c={ok:"bg-[#EDF4EE] text-[#3F7A4E] border-[#CBE0D0]",warn:"bg-[#FBF3E7] text-[#8A6A22] border-[#
637EBDCC0]",muted:"bg-[#F6F6F6] text-[#555555] border-[#E8E8E8]"};return o.jsxs("div",{className:"bg-white border border-[#E8E8E8] rounded-sm p-4",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4 mb-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] tracking-[0.18em] uppercase text-[#B08A3E] font-semibold",children:"Install health · last 7 days"}),o.jsx("p",{className:"text-xs text-[#555555] mt-1.5 max-w-xl leading-relaxed",children:`Each snippet reports in when a storefront page loads it. "Not detected" means the script isn't on any live page yet; "loading, not rendering" means it loads but can't find its container.`})]}),o.jsxs("button",{onClick:()=>s(d=>d+1),className:"text-xs px-3 py-1.5 border border-[#E8E8E8] text-[#333333] hover:bg-[#F6F6F6] inline-flex items-center gap-1.5 rounded-sm shrink-0",children:[o.jsx(Nc,{className:"w-3 h-3"})," Refresh"]})]}),n&&o.jsx("p",{className:"text-xs text-[#A8443A]",children:n}),!e&&!n&&o.jsx("p",{className:"text-xs text-[#555555]",children:"Checking…"}),e&&o.jsx("div",{className:"divide-y divide-[#F0F0F0]",children:DK.map(d=>{const u=a.get(d.id),f=l(u);return o.jsxs("div",{className:"py-2.5 flex items-center justify-between gap-3 flex-wrap",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-sm text-[#202020]",children:d.label}),o.jsxs("div",{className:"text-[11px] text-[#555555]",children:[d.where,u!=null&&u.sample_host?` · ${u.sample_host}`:"",u?` · ${u.pings} load${u.pings===1?"":"s"} · ${FK(u.last_seen)}`:""]})]}),o.jsx("span",{className:`text-[9.5px] tracking-[0.12em] uppercase font-semibold px-2 py-0.5 rounded-sm border ${c[f.tone]}`,children:f.label})]},d.id)})})]})},MK=({onOpenSubmission:e,thresholdDays:t=90})=>{const{user:n}=pn(),[r,i]=k.useState([]),[s,a]=k.useState(!1);return k.useEffect(()=>{n&&(async()=>{const l=new Date(Date.now()-t*24*60*60*1e3).toISOString(),{data:c}=await Ne.from("submissions").select("id,artist_name,artwork_title,last_valued_at,formula_value,ai_value").eq("user_id",n.id).not("last_valued_at","is",null).lt("last_valued_at",l).limit(50),d=(c||[]).filter(u=>(Number(u.formula_value)||0)>0||(Number(u.ai_value)||0)>0);i(d)})()},[n,t]),!n||s||r.length===0?null:o.jsx("div",{className:"rounded-md border border-primary/40 bg-primary/5 p-4 mb-4",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(C7,{size:16,className:"text-primary mt-0.5 shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("h3",{className:"font-display text-sm font-semibold tracking-wide",children:[r.length," ",r.length===1?"valuation is":"valuations are"," over ",t," days old"]}),o.jsx("p",{className:"text-xs font-body text-muted-foreground mt-1",children:"Markets shift. Re-value these to keep your portfolio accurate."}),o.jsxs("ul",{className:"mt-2 space-y-1",children:[r.slice(0,3).map(l=>o.jsxs("li",{className:"text-xs font-body flex items-center justify-between gap-3",children:[o.jsxs("span",{className:"truncate",children:[o.jsx("span",{className:"font-semibold",children:l.artist_name||"Unknown"}),l.artwork_title&&o.jsxs("span",{className:"text-muted-foreground italic",children:[" — ",l.artwork_title]})]}),e&&o.jsx("button",{onClick:()=>e(l.id),className:"text-[10px] uppercase tracking-wider font-semibold text-primary hover:underline shrink-0",children:"Re-value"})]},l.id)),r.length>3&&o.jsxs("li",{className:"text-[11px] font-body text-muted-foreground italic",children:["+",r.length-3," more — see Portfolio Dashboard"]})]})]}),o.jsx("button",{onClick:()=>a(!0),className:"text-[10px] uppercase tracking-wider font-semibold text-muted-foreground hover:text-foreground",children:"Dismiss"})]})})},$K={"oil on canvas":35,"oil on panel":30,"oil on linen":33,"acrylic on canvas":22,"acrylic on panel":20,watercolor:15,gouache:14,pastel:12,charcoal:8,graphite:6,pencil:6,ink:10,"mixed media":18,sculpture:40,bronze:50,ceramic:15,photograph:8,print:5,lithograph:7,etching:9,screenprint:6,woodcut:8},L1=600,aj=.78,BK={emerging:{factor:.7,label:"Emerging artist (limited secondary market)"},established:{factor:1.25,label:"Established artist (consistent gallery representation)"},"mid-career":{factor:1.6,label:"Mid-career artist (documented resale history)"},"blue-chip":{factor:3,label:"Blue-chip artist (institutional demand)"}},lj={auction:{weight:.75,toFmv:1,label:"auction result"},gallery:{weight:.55,toFmv:1/1.35,label:"gallery/retail purchase"},private:{weight:.6,toFmv:1,label:"private sale"},unknown:{weight:.5,toFmv:1/1.15,label:"unverified prior price"}};function Nb(e){if(e==null||e==="")return null;const t=typeof e=="number"?e:parseFloat(String(e).replace(/[^0-9.]/g,""));return Number.isFinite(t)?t:null}function UK(e){const t=(e||"").match(/(\d+\.?\d*)\s*[×xX]\s*(\d+\.?\d*)/);return t?parseFloat(t[1])*parseFloat(t[2]):null}function zK(e){const t=(e||"").toLowerCase().trim();if(t){for(const[n,r]of Object.entries($K))if(t.includes(n)||n.includes(t))return{rate:r,label:n}}return{rate:15,label:"general"}}function Sb(e){const t=L1*Math.pow(e/L1,aj);let n=1,r="";e>8e3?(n=.82,r=" with an 18% oversize/placement discount"):e>4e3&&(n=.9,r=" with a 10% oversize/placement discount");const i=t*n;return{effectiveArea:i,note:`Size scaling: ${Math.round(e).toLocaleStr
637ing()} sq in priced on a sublinear curve (area^${aj}) as ${Math.round(i).toLocaleString()} effective sq in${r}`}}function qK(e){switch(e){case"Excellent":return 1;case"Very Good":return .9;case"Good":return .75;case"Fair":return .55;case"Poor":return .3;default:return .8}}function WK(e,t){const n=parseInt(e);if(isNaN(n))return{factor:1,note:""};const r=new Date().getFullYear()-n;let i;return r>100?i=1.3:r>50?i=1.2:r>25?i=1.1:r>10?i=1:i=.9,t&&(i=1+(i-1)*.5),{factor:Math.round(i*100)/100,note:`Period factor (${e}, ${r} yrs)${t?", dampened because artist standing is recorded":""}: ×${Math.round(i*100)/100}`}}function HK(e){return e===null?{factor:1,note:""}:e<=1?{factor:1.15,note:"Unique work (edition of 1): ×1.15"}:e<=10?{factor:1,note:`Very small edition (${e}): ×1.00`}:e<=50?{factor:.85,note:`Small edition (${e}): ×0.85`}:e<=150?{factor:.7,note:`Mid-size edition (${e}): ×0.70`}:e<=500?{factor:.55,note:`Large edition (${e}): ×0.55`}:{factor:.4,note:`Open/very large edition (${e}): ×0.40`}}const VK=1.04;function cj(e,t){const n=new Date().getFullYear(),r=t&&t>1900&&t<=n?t:n;return Math.round(e*Math.pow(VK,Math.max(0,n-r)))}const GK=e=>{const t=[...e].sort((r,i)=>r-i),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2},Lo=e=>e>=1e5?Math.round(e/5e3)*5e3:e>=2e4?Math.round(e/1e3)*1e3:e>=5e3?Math.round(e/500)*500:e>=1e3?Math.round(e/100)*100:Math.round(e/25)*25;function zP(e){const t=[],n=[],r=[],i=[],s=new Date,{rate:a,label:l}=zK(e.medium),c=UK(e.dimensions),d=(e.comparables||[]).filter(E=>E&&E.salePrice>0);let u,f="model",p=null;if(d.length){const E=d.map(q=>{const F=cj(q.salePrice,q.saleYear??null),Z=q.area&&q.area>0?q.area:null;return Z?F/Sb(Z).effectiveArea:null}).filter(q=>q!==null&&Number.isFinite(q));E.length&&(p=GK(E))}if(c&&p){f="comparables";const{effectiveArea:E,note:q}=Sb(c);u=Math.round(E*p),t.push(q),t.push(`Comparable anchor: median of ${d.length} sold comparable${d.length>1?"s":""} at $${p.toFixed(2)}/effective sq in (indexed to ${s.getFullYear()}) = $${u.toLocaleString()}`),r.push("Sales comparison approach — anchored to documented sold comparables for this artist and medium, indexed to the effective date.")}else if(c&&e.medium){const{effectiveArea:E,note:q}=Sb(c);u=Math.round(E*a),t.push(q),t.push(`Base: ${l} at $${a}/sq in (reference size) × ${Math.round(E).toLocaleString()} effective sq in = $${u.toLocaleString()}`),r.push("Cost/market hybrid — category base rate by medium scaled on a sublinear size curve, then adjusted for condition, period, artist standing and provenance."),n.push("Sold comparables for this artist")}else e.medium?(u=Math.round(a*L1),t.push(`Base: ${l} rate at reference size = $${u.toLocaleString()}`),r.push("Category base rate at reference size — dimensions were not supplied."),n.push("Exact dimensions")):(u=5e3,t.push("Base: generic estimate (add medium and dimensions for accuracy) = $5,000"),r.push("Placeholder estimate — insufficient data for a market-based approach."),n.push("Medium","Exact dimensions"));const h=qK(e.condition);u=Math.round(u*h),e.condition?t.push(`Condition (${e.condition}): ×${h}`):n.push("Condition grade"),e.restored?(u=Math.round(u*.85),t.push("Disclosed restoration / conservation treatment: ×0.85"),i.push("Restoration or conservation treatment has been disclosed for this work. Buyers should request the treatment report.")):i.push("No restoration has been disclosed. This valuation assumes the work is unrestored beyond normal conservation.");const x=BK[e.artistTier||""],g=WK(e.year,!!x);g.note?(u=Math.round(u*g.factor),t.push(g.note)):n.push("Year of execution"),x?(u=Math.round(u*x.factor),t.push(`${x.label}: ×${x.factor}`)):n.push("Artist market standing");const b=Nb(e.editionSize),y=HK(b);y.note&&(u=Math.round(u*y.factor),t.push(y.note));let _=0;const w=(E,q)=>{_+=E,t.push(`${q} (+${E}%)`)};e.handSigned&&w(8,"Authentication: hand-signed by the artist"),e.hasCoa&&w(6,"Authentication: certificate of authenticity on file"),e.hasStamp&&w(3,"Authentication: studio or foundry stamp"),e.estateProvenance&&w(10,"Provenance: artist estate or foundation source"),e.galleryExhibited&&w(8,"Provenance: exhibited with a commercial gallery"),e.museumExhibited&&w(20,"Provenance: museum or institutional exhibition"),e.publishedLiterature&&w(10,"Provenance: published in catalogue or literature"),e.priorAuctionSale&&w(12,"Provenance: documented prior auction sale");const S=Math.round(60*(1-Math.exp(-_/60)));_===0?(t.push("Provenance: no supporting documentation recorded (no uplift applied)"),n.push("Signature, COA or exhibition history")):S<_&&t.push(`Provenance signals total +${_}%, applied as +${S}% after overlap adjustment`);const C=u;let P=Math.round(C*(1+S/100));const R=0,M=Nb(e.priorSalePrice),T=Nb(e.priorSaleYear);if(M&&M>0){const E=lj[e.priorSaleSource||"unknown"]||lj.unknown,q=cj(M,T),F=Math.round(q*E.toFmv),Z=T?Math.max(0,s.getFullYear()-T):0,Y=Math.max(.25,E.weight*Math.pow(.97,Z)),ee=Math.round(P*(1-Y)+F*Y);t.push(`Prior ${E.label}
637 of $${M.toLocaleString()}${T?` (${T})`:""} indexed to today at 4%/yr = $${q.toLocaleString()}`+(E.toFmv!==1?`, discounted to $${F.toLocaleString()} to remove dealer margin`:"")+`, weighted ${Math.round(Y*100)}% against the model — reconciled to $${ee.toLocaleString()}`),r.push("Prior transaction reconciliation — the reported prior sale is indexed to the effective date and weighted by source credibility and recency."),P=ee,f!=="comparables"&&(f="prior-sale")}else n.push("Any prior sale or purchase price");let H=0;const A=[];x||(H+=6,A.push("artist standing unrecorded")),c&&c>8e3&&(H+=5,A.push("oversized work with a narrow buyer pool")),b!==null&&b>500&&(H+=5,A.push("open/large edition")),(e.condition==="Poor"||e.condition==="Fair")&&(H+=4,A.push("condition limits the buyer pool")),H=Math.min(H,15),H>0&&(P=Math.round(P*(1-H/100)),t.push(`Marketability discount −${H}% (${A.join("; ")})`));let O=35;c&&(O+=10),e.medium&&(O+=8),e.condition&&(O+=8),e.year&&(O+=6),x&&(O+=10),b!==null&&(O+=4),_>0&&(O+=9),f==="prior-sale"&&(O+=12),f==="comparables"&&(O+=18),p&&M&&(O+=5),O=Math.max(20,Math.min(95,O));const K=O>=80?.12:O>=65?.18:O>=50?.25:.35;P=Lo(P);const U=e.framed?Math.round(P*.06):0;e.framed&&t.push(`Framed: $${U.toLocaleString()} presentation allowance added to retail and insurance figures only — framing is excluded from fair market value`);const I=Lo(P*1.35+U),re=Lo(I*1.1),V=typeof e.commissionRate=="number"&&e.commissionRate>=0&&e.commissionRate<1?e.commissionRate:.5,$=Lo(P*.8),D=Lo(P*1.2),ie=Lo(P*.85),X=Lo(I*(1-V));return r.push("All figures are stated in US dollars as of the effective date and assume clear title and an unrestricted right to sell."),{baseValue:C,scarcityMultiplier:R,provenanceUplift:S,reasoning:t,fairMarketValue:P,rangeLow:Lo(P*(1-K)),rangeHigh:Lo(P*(1+K)),retailValue:I,insuranceValue:re,confidence:O,missing:Array.from(new Set(n)),effectiveDate:s.toISOString().slice(0,10),valueDefinition:"Fair market value — the price at which the work would change hands between a willing buyer and a willing seller, neither under compulsion to act and both reasonably informed of the relevant facts.",methodology:r,disclosures:[...i,"This is an automated market estimate, not a certified appraisal, authentication or investment opinion. It is informational only and is not a USPAP-compliant appraisal report.","Values reflect market conditions as of the effective date and should be reviewed at least every 24 months."],marketabilityDiscount:H,auctionEstimateLow:$,auctionEstimateHigh:D,netAtAuction:ie,netOnConsignment:X,commissionRate:V,anchor:f,comparableCount:d.length}}const Y2=["artist_name","artwork_title"],qP=["year","medium","dimensions","condition","edition","hand_signed","has_stamp","has_coa","framed"];[...Y2,...qP];const YK=`artist_name,artwork_title,year,medium,dimensions,condition,edition,hand_signed,has_stamp,has_coa,framed
638Agnes Martin,Untitled #12,1965,Oil on canvas,72 x 72 in,Excellent,,true,false,true,true
639Sol LeWitt,Wall Drawing #289,1976,Graphite on wall,120 x 120 in,Very Good,AP,true,false,false,false
640Yayoi Kusama,Infinity Net,2002,Acrylic on canvas,51 x 64 in,Excellent,,true,true,true,true`;function KK(e){const t=[],n=e.replace(/\r\n/g,`
641`).split(`
642`).filter(a=>a.trim().length>0);if(n.length<2)return t.push("CSV must contain a header row and at least one data row"),{rows:[],errors:t};const r=n[0].split(",").map(a=>a.trim().toLowerCase());for(const a of Y2)r.includes(a)||t.push(`Missing required column: ${a}`);if(t.length>0)return{rows:[],errors:t};const i=[],s=a=>{const l=[];let c="",d=!1;for(let u=0;u<a.length;u++){const f=a[u];f==='"'?d&&a[u+1]==='"'?(c+='"',u++):d=!d:f===","&&!d?(l.push(c),c=""):c+=f}return l.push(c),l.map(u=>u.trim())};for(let a=1;a<n.length;a++){const l=s(n[a]),c=f=>{const p=r.indexOf(f);return p>=0?l[p]??"":""},d=f=>/^(true|yes|1|y)$/i.test(f.trim()),u={artist_name:c("artist_name"),artwork_title:c("artwork_title"),year:c("year"),medium:c("medium"),dimensions:c("dimensions"),condition:c("condition"),edition:c("edition"),hand_signed:d(c("hand_signed")),has_stamp:d(c("has_stamp")),has_coa:d(c("has_coa")),framed:d(c("framed"))};if(!u.artist_name||!u.artwork_title){t.push(`Row ${a+1}
642: missing artist_name or artwork_title`);continue}i.push(u)}return{rows:i,errors:t}}const JK=({onClose:e,onComplete:t})=>{const{user:n}=pn(),r=Cs(),i=k.useRef(null),[s,a]=k.useState([]),[l,c]=k.useState([]),[d,u]=k.useState([]),[f,p]=k.useState(!1),h=na(e),x=async w=>{if(!w)return;const S=await w.text(),{rows:C,errors:P}=KK(S);a(C),c(P),u([]),P.length===0&&me.success(`${C.length} rows ready to import`)},g=()=>{const w=new Blob([YK],{type:"text/csv"}),S=URL.createObjectURL(w),C=document.createElement("a");C.href=S,C.download="reverie-bulk-import-template.csv",C.click(),URL.revokeObjectURL(S)},b=async()=>{if(!n){me.error("Sign in required");return}if(s.length===0)return;p(!0);const w=s.map(P=>({row:P,status:"pending"}));u(w);for(let P=0;P<s.length;P++){const R=s[P];try{const M=zP({medium:R.medium,dimensions:R.dimensions,condition:R.condition,year:R.year,provenance:"",exhibitionHistory:"",framed:R.framed}),T=Math.round(M.baseValue+M.baseValue*(M.scarcityMultiplier/100)+M.baseValue*(M.provenanceUplift/100)),{error:H}=await Ne.from("submissions").insert({user_id:n.id,artist_name:R.artist_name,artwork_title:R.artwork_title,year:R.year,medium:R.medium,dimensions:R.dimensions,condition:R.condition,edition:R.edition,hand_signed:R.hand_signed,has_stamp:R.has_stamp,has_coa:R.has_coa,framed:R.framed,base_value:M.baseValue,scarcity_multiplier:M.scarcityMultiplier,provenance_uplift:M.provenanceUplift,formula_value:T,formula_reasoning:M.reasoning,last_valued_at:new Date().toISOString()});if(H)throw H;w[P]={row:R,status:"success",formulaValue:T}}catch(M){w[P]={row:R,status:"error",error:M.message||"Insert failed"}}u([...w])}p(!1);const S=w.filter(P=>P.status==="success").length,C=w.length-S;C===0?me.success(`Imported ${S} submissions`):me.warning(`Imported ${S} · ${C} failed`),t==null||t(S)},y=d.filter(w=>w.status==="success").length,_=d.filter(w=>w.status==="error").length;return o.jsx("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center overflow-y-auto overscroll-contain bg-black/60 p-4",style:r,onClick:e,children:o.jsxs("div",{ref:h,tabIndex:-1,className:"relative max-h-[calc(var(--embed-visible-height,100vh)-2rem)] w-full max-w-3xl overflow-y-auto rounded-lg bg-background shadow-2xl",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bulk-import-title",children:[o.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between px-6 py-4 bg-background border-b border-border",children:[o.jsxs("div",{children:[o.jsx("h3",{id:"bulk-import-title",className:"font-display text-xl font-semibold",children:"Bulk CSV Import"}),o.jsx("p",{className:"text-xs font-body text-muted-foreground mt-0.5",children:"Import multiple artworks at once. Formula valuation runs automatically per row."})]}),o.jsx("button",{onClick:e,className:"inline-flex h-11 w-11 shrink-0 items-center justify-center text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:o.jsx(Hr,{size:22})})]}),o.jsxs("div",{className:"p-6 space-y-5",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[o.jsxs("button",{onClick:g,className:"inline-flex items-center gap-2 px-3 py-2 text-xs font-body font-semibold uppercase tracking-wider border border-input rounded-md hover:bg-muted/60 transition-all",children:[o.jsx(Ho,{size:14})," Download Template"]}),o.jsx("input",{ref:i,type:"file",accept:".csv,text/csv",className:"hidden",onChange:w=>{var S;return((S=w.target.files)==null?void 0:S[0])&&x(w.target.files[0])}}),o.jsxs("button",{onClick:()=>{var w;return(w=i.current)==null?void 0:w.click()},className:"inline-flex items-center gap-2 px-3 py-2 text-xs font-body font-semibold uppercase tracking-wider bg-primary text-primary-foreground rounded-md hover:brightness-105 transition-all",children:[o.jsx(TC,{size:14})," Choose CSV File"]})]}),o.jsxs("div",{className:"text-[11px] font-body text-muted-foreground bg-muted/60 rounded-md p-3",children:[o.jsx("div",{className:"font-semibold uppercase tracking-wider mb-1",children:"Required columns"}),o.jsx("div",{children:Y2.join(", ")}),o.jsx("div",{className:"font-semibold uppercase tracking-wider mt-2 mb-1",children:"Optional columns"}),o.jsx("div",{children:qP.join(", ")}),o.jsx("div",{className:"mt-2 italic",children:"Boolean fields accept: true / false / yes / no / 1 / 0"})]}),l.length>0&&o.jsx("div",{className:"bg-destructive/10 border border-destructive/40 rounded-md p-3 space-y-1",children:l.map((w,S)=>o.jsxs("p",{className:"text-xs font-body text-destructive",children:["• ",w]},S))}),s.length>0&&o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("p",{className:"text-sm font-body font-semibold",children:[s.length," row",s.length===1?"":"s"," parsed",d.length>0&&o.jsxs("span",{className:"ml-2 text-xs text-muted-foreground font-normal",children:["· ",y," succeeded · ",_," failed"]})]}),o.jsx("button",{onClick:b,disabled:f,className:"px-4 py-2 text-xs font-body font-semibold uppercase tracking-wider bg-primary text-primary-foreground rounded-md hover:brightness-105 transition-all disabled:opacity-50",children:f?"Importing…":`Import ${s.length}`})]}),o.jsx("div",{className:"border border-border rounded-md overflow-hidden",children:o.jsxs("table",{className:"w-full text-xs font-body",children:[o.jsx("thead",{className:"bg-muted/60",children:o.jsxs("tr",{children:[o.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Artist"}),o.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Title"}),o.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Medium"}),o.jsx("th",{className:"text-right px-3 py-2 font-semibold",children:"Formula"}),o.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Status"})]})}),o.jsx("tbody",{children:s.map((w,S)=>{const C=d[S];return o.jsxs("tr",{className:"border-t border-border",children:[o.jsx("td",{className:"px-3 py-2",children:w.artist_name}),o.jsx("td",{className:"px-3 py-2",children:w.artwork_title}),o.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:w.medium||"—"}),o.jsx("td",{className:"px-3 py-2 text-right",children:C!=null&&C.formulaValue?`$${C.formulaValue.toLocaleStr
642ing()}`:"—"}),o.jsxs("td",{className:"px-3 py-2",children:[!C&&o.jsx("span",{className:"text-muted-foreground",children:"Ready"}),(C==null?void 0:C.status)==="pending"&&o.jsx("span",{className:"text-muted-foreground",children:"…"}),(C==null?void 0:C.status)==="success"&&o.jsx("span",{className:"text-emerald-600 font-semibold",children:"Saved"}),(C==null?void 0:C.status)==="error"&&o.jsx("span",{className:"text-destructive",title:C.error,children:"Failed"})]})]},S)})})]})})]}),s.length===0&&l.length===0&&o.jsxs("div",{className:"border border-dashed border-border rounded-md p-8 text-center",children:[o.jsx(q0,{size:28,className:"mx-auto text-muted-foreground mb-2"}),o.jsx("p",{className:"text-sm font-body text-muted-foreground",children:"Choose a CSV file to preview rows before importing."})]})]})]})})},XK=["shown","interested","sold"],ZK=({onClose:e,currentSubmissionId:t})=>{const{user:n}=pn(),r=na(e),[i,s]=k.useState([]),[a,l]=k.useState([]),[c,d]=k.useState([]),[u,f]=k.useState([]),[p,h]=k.useState(!0),[x,g]=k.useState(null),[b,y]=k.useState(!1),[_,w]=k.useState({name:"",email:"",phone:"",notes:"",tags:""}),[S,C]=k.useState(!1),[P,R]=k.useState({subject:"",body:"",submissionId:""}),[M,T]=k.useState(!1),H=async()=>{if(!n)return;h(!0);const[X,E,q,F]=await Promise.all([Ne.from("collectors").select("*").eq("user_id",n.id).order("name"),Ne.from("submissions").select("id,artist_name,artwork_title").eq("user_id",n.id).order("created_at",{ascending:!1}).limit(500),Ne.from("collector_submissions").select("*").eq("user_id",n.id),Ne.from("offers").select("id,submission_id,kind,status,amount,currency,message,created_at,buyer_email").eq("user_id",n.id).order("created_at",{ascending:!1}).limit(500)]);s(X.data||[]),l(E.data||[]),d(q.data||[]),f(F.data||[]),h(!1)};k.useEffect(()=>{H()},[n]);const A=k.useMemo(()=>i.find(X=>X.id===x)||null,[i,x]),O=k.useMemo(()=>c.filter(X=>X.collector_id===x),[c,x]),K=k.useMemo(()=>{if(!(A!=null&&A.email))return[];const X=A.email.trim().toLowerCase();return u.filter(E=>(E.buyer_email||"").toLowerCase()===X)},[A,u]),U=async()=>{var X;if(!(A!=null&&A.email))return me.error("Collector needs an email");if(!P.body.trim())return me.error("Message required");T(!0);try{const E=P.submissionId?a.find(F=>F.id===P.submissionId):null,{error:q}=await Ne.functions.invoke("send-transactional-email",{body:{templateName:"collector-follow-up",recipientEmail:A.email,idempotencyKey:`followup-${A.id}-${Date.now()}`,templateData:{collectorName:A.name,senderName:((X=n==null?void 0:n.email)==null?void 0:X.split("@")[0])||"The Reverie team",subjectLine:P.subject.trim()||void 0,bodyText:P.body.trim(),artist:(E==null?void 0:E.artist_name)||void 0,title:(E==null?void 0:E.artwork_title)||void 0}}});if(q)throw q;me.success("Follow-up sent"),C(!1),R({subject:"",body:"",submissionId:""})}catch(E){me.error(E.message||"Failed to send")}finally{T(!1)}},I=async()=>{if(!n||!_.name.trim()){me.error("Name is required");return}const X={user_id:n.id,name:_.name.trim(),email:_.email.trim()||null,phone:_.phone.trim()||null,notes:_.notes.trim()||null,tags:_.tags?_.tags.split(",").map(E=>E.trim()).filter(Boolean):null};if(A){const{error:E}=await Ne.from("collectors").update(X).eq("id",A.id);if(E)return me.error(E.message);me.success("Collector updated")}else{const{error:E}=await Ne.from("collectors").insert(X);if(E)return me.error(E.message);me.success("Collector added")}y(!1),w({name:"",email:"",phone:"",notes:"",tags:""}),g(null),H()},re=async X=>{if(!confirm("Delete this collector and all their links?"))return;const{error:E}=await Ne.from("collectors").delete().eq("id",X);if(E)return me.error(E.message);g(null),H()},V=async(X,E,q)=>{if(!n)return;const{error:F}=await Ne.from("collector_submissions").insert({user_id:n.id,collector_id:X,submission_id:E,relationship:q});if(F)return me.error(F.message);me.success("Linked"),H()},$=async X=>{const{error:E}=await Ne.from("collector_submissions").delete().eq("id",X);if(E)return me.error(E.message);H()},D=X=>{g(X.id),y(!1),w({name:X.name,email:X.email||"",phone:X.phone||"",notes:X.notes||"",tags:(X.tags||[]).join(", ")})},ie=X=>a.find(E=>E.id===X);return o.jsx("div",{className:"fixed inset-0 z-[1000] flex items-start justify-center overflow-y-auto overscroll-contain bg-black/60 p-4",onClick:e,children:o.jsxs("div",{ref:r,tabIndex:-1,
642className:"relative my-4 max-h-[calc(100vh-2rem)] w-full max-w-4xl overflow-y-auto rounded-lg bg-background shadow-2xl sm:my-8",onClick:X=>X.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"collectors-title",children:[o.jsx("button",{onClick:e,className:"absolute right-2 top-2 inline-flex h-11 w-11 items-center justify-center text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:o.jsx(Hr,{size:20})}),o.jsxs("div",{className:"p-7 border-b border-border",children:[o.jsx("h2",{id:"collectors-title",className:"font-display text-2xl font-bold tracking-wide",children:"Collectors"}),o.jsx("p",{className:"text-xs font-body text-muted-foreground mt-1 tracking-wide",children:"Track who has seen, is interested in, or has purchased each artwork."})]}),o.jsxs("div",{className:"grid md:grid-cols-[260px_1fr] min-h-[400px]",children:[o.jsxs("div",{className:"space-y-2 border-b border-border p-4 md:max-h-[600px] md:overflow-y-auto md:border-b-0 md:border-r",children:[o.jsxs("button",{onClick:()=>{y(!0),g(null),w({name:"",email:"",phone:"",notes:"",tags:""})},className:"w-full flex items-center justify-center gap-1 px-3 py-2 text-[10px] font-semibold font-body uppercase tracking-wider text-primary-foreground bg-primary rounded-md hover:brightness-105",children:[o.jsx(B7,{size:12})," Add Collector"]}),p?o.jsx("div",{className:"text-xs font-body text-muted-foreground text-center py-4",children:"Loading…"}):i.length===0?o.jsx("div",{className:"text-xs font-body text-muted-foreground text-center py-4",children:"No collectors yet"}):i.map(X=>o.jsxs("button",{onClick:()=>D(X),className:`w-full text-left px-3 py-2 rounded-md border text-xs font-body transition-colors ${x===X.id?"border-primary bg-primary/5":"border-input hover:bg-muted/60"}`,children:[o.jsx("div",{className:"font-semibold text-foreground truncate",children:X.name}),X.email&&o.jsx("div",{className:"text-muted-foreground truncate text-[11px]",children:X.email})]},X.id))]}),o.jsx("div",{className:"p-6 space-y-5",children:!A&&!b?o.jsx("div",{className:"text-sm font-body text-muted-foreground text-center py-10",children:"Select a collector or add a new one to get started."}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx("input",{placeholder:"Name *",value:_.name,onChange:X=>w({..._,name:X.target.value}),className:"w-full px-3 py-2 text-sm font-body border border-input rounded-md bg-background"}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsx("input",{placeholder:"Email",value:_.email,onChange:X=>w({..._,email:X.target.value}),className:"px-3 py-2 text-sm font-body border border-input rounded-md bg-background"}),o.jsx("input",{placeholder:"Phone",value:_.phone,onChange:X=>w({..._,phone:X.target.value}),className:"px-3 py-2 text-sm font-body border border-input rounded-md bg-background"})]}),o.jsx("input",{placeholder:"Tags (comma separated)",value:_.tags,onChange:X=>w({..._,tags:X.target.value}),className:"w-full px-3 py-2 text-sm font-body border border-input rounded-md bg-background"}),o.jsx("textarea",{placeholder:"Notes",value:_.notes,onChange:X=>w({..._,notes:X.target.value}),rows:3,className:"w-full px-3 py-2 text-sm font-body border border-input rounded-md bg-background resize-none"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:I,className:"flex-1 px-4 py-2 text-xs font-semibold font-body uppercase tracking-wider text-primary-foreground bg-primary rounded-md hover:brightness-105",children:A?"Save Changes":"Create Collector"}),A&&o.jsx("button",{onClick:()=>re(A.id),className:"px-3 py-2 text-muted-foreground hover:text-destructive border border-input rounded-md","aria-label":"Delete",children:o.jsx(RC,{size:14})})]})]}),A&&o.jsxs("div",{className:"space-y-3 pt-3 border-t border-border",children:[o.jsxs("h3",{className:"font-display text-sm font-semibold tracking-wide flex items-center gap-2",children:[o.jsx(PC,{size:14})," Linked Artworks (",O.length,")"]}),O.length===0?o.jsx("p",{className:"text-xs font-body text-muted-foreground italic",children:"No artworks linked yet."}):o.jsx("ul",{className:"space-y-1.5",children:O.map(X=>{const E=ie(X.submission_id);return o.jsxs("li",{className:"flex items-center justify-between gap-3 text-xs font-body",children:[o.jsxs("span",{className:"truncate",children:[o.jsx("span",{className:"font-semibold",children:(E==null?void 0:E.artist_name)||"—"}),(E==null?void 0:E.artwork_title)&&o.jsxs("span",{className:"text-muted-foreground italic",children:[" — ",E.artwork_title]}),o.jsx("span",{className:"ml-2 text-[10px] uppercase tracking-wider text-primary",children:X.relationship})]}),o.jsx("button",{onClick:()=>$(X.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Unlink",children:o.jsx(Hr,{size:12})})]},X.id)})}),o.jsx(QK,{submissions:a,currentSubmissionId:t,onLink:(X,E)=>V(A.id,X,E)}),o.jsxs("div",{className:"pt-4 mt-2 border-t border-border space-y-2",children:[o.jsxs("h3",{className:"font-display text-sm font-semibold tracking-wide flex items-center gap-2",children:[o.jsx(F7,{size:14})," Inquiries & Offers (",K.length,")"]}),A.email?K.length===0?o.jsxs("p",{className:"text-xs font-body text-muted-foreground italic",children:["No inquiries from ",A.email," yet."]}):o.jsx("ul",{className:"space-y-1.5 max-h-40 overflow-y-auto",children:K.map(X=>{const E=ie(X.submission_id);return o.jsxs("li",{className:"text-xs font-body border border-input rounded-md p-2 bg-muted/30",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("span",{className:"text-[10px] uppercase tracking-wider text-primary font-semibold",children:[X.kind,X.amount?` · ${X.currency}
642 ${Math.round(X.amount).toLocaleString()}`:""]}),o.jsx("span",{className:"text-[10px] text-muted-foreground",children:new Date(X.created_at).toLocaleDateString()})]}),E&&o.jsxs("div",{className:"text-[11px] mt-0.5 truncate",children:[o.jsx("span",{className:"font-semibold",children:E.artist_name||"—"}),E.artwork_title&&o.jsxs("span",{className:"text-muted-foreground italic",children:[" — ",E.artwork_title]})]}),X.message&&o.jsxs("p",{className:"text-[11px] text-muted-foreground italic mt-1 line-clamp-2",children:['"',X.message,'"']})]},X.id)})}):o.jsx("p",{className:"text-xs font-body text-muted-foreground italic",children:"Add an email above to surface this collector's inquiries."})]}),o.jsxs("div",{className:"pt-4 mt-2 border-t border-border space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("h3",{className:"font-display text-sm font-semibold tracking-wide flex items-center gap-2",children:[o.jsx(Qf,{size:14})," Send follow-up"]}),!S&&A.email&&o.jsx("button",{onClick:()=>C(!0),className:"text-[10px] font-semibold uppercase tracking-wider text-primary hover:underline",children:"Compose →"})]}),A.email?S?o.jsxs("div",{className:"space-y-2",children:[o.jsx("input",{placeholder:"Subject (optional)",value:P.subject,onChange:X=>R({...P,subject:X.target.value}),className:"w-full px-3 py-2 text-sm font-body border border-input rounded-md bg-background"}),o.jsxs("select",{value:P.submissionId,onChange:X=>R({...P,submissionId:X.target.value}),className:"w-full px-2 py-1.5 text-xs font-body border border-input rounded-md bg-background",children:[o.jsx("option",{value:"",children:"No specific artwork"}),a.map(X=>o.jsxs("option",{value:X.id,children:[X.artist_name||"Unknown"," — ",X.artwork_title||"Untitled"]},X.id))]}),o.jsx("textarea",{placeholder:`Hello ${A.name.split(" ")[0]}, just following up…`,value:P.body,onChange:X=>R({...P,body:X.target.value}),rows:4,className:"w-full px-3 py-2 text-sm font-body border border-input rounded-md bg-background resize-none"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:U,disabled:M,className:"flex-1 px-4 py-2 text-xs font-semibold font-body uppercase tracking-wider text-primary-foreground bg-primary rounded-md hover:brightness-105 disabled:opacity-50",children:M?"Sending…":"Send email"}),o.jsx("button",{onClick:()=>{C(!1),R({subject:"",body:"",submissionId:""})},className:"px-3 py-2 text-xs font-body text-muted-foreground hover:text-foreground border border-input rounded-md",children:"Cancel"})]}),o.jsxs("p",{className:"text-[10px] text-muted-foreground italic",children:["Sent from your Reverie domain to ",A.email,"."]})]}):null:o.jsx("p",{className:"text-xs font-body text-muted-foreground italic",children:"Add an email above to send follow-ups."})]})]})]})})]})]})})},QK=({submissions:e,currentSubmissionId:t,onLink:n})=>{const[r,i]=k.useState(t||""),[s,a]=k.useState("shown");return o.jsxs("div",{className:"flex gap-2 pt-2",children:[o.jsxs("select",{value:r,onChange:l=>i(l.target.value),className:"flex-1 px-2 py-1.5 text-xs font-body border border-input rounded-md bg-background",children:[o.jsx("option",{value:"",children:"Select artwork…"}),e.map(l=>o.jsxs("option",{value:l.id,children:[l.artist_name||"Unknown"," — ",l.artwork_title||"Untitled"]},l.id))]}),o.jsx("select",{value:s,onChange:l=>a(l.target.value),className:"px-2 py-1.5 text-xs font-body border border-input rounded-md bg-background",children:XK.map(l=>o.jsx("option",{value:l,children:l},l))}),o.jsx("button",{onClick:()=>{r&&(n(r,s),i(""))},disabled:!r,className:"px-3 py-1.5 text-[10px] font-semibold font-body uppercase tracking-wider text-primary-foreground bg-primary rounded-md hover:brightness-105 disabled:opacity-50",children:"Link"})]})},eJ=[{label:"Never",days:0},{label:"7 days",days:7},{label:"30 days",days:30},{label:"90 days",days:90}],tJ=({onClose:e})=>{const{user:t}=pn(),n=na(e),r=Cs(),[i,s]=k.useState([]),[a,l]=k.useState([]),[c,d]=k.useState([]),[u,f]=k.useState(new Set),[p,h]=k.useState(""),[x,g]=k.useState(""),[b,y]=k.useState(""),[_,w]=k.useState(30),[S,C]=k.useState(""),[P,R]=k.useState(!0),[M,T]=k.useState(!1);k.useEffect(()=>{t&&(async()=>{const[{data:I},{data:re},{data:V}]=await Promise.all([Ne.from("submissions").select("id,artist_name,artwork_title").eq("user_id",t.id).order("created_at",{ascending:!1}).limit(200),Ne.from("collectors").select("id,name").eq("user_id",t.id).order("name"),Ne.from("portfolio_shares").select("*").eq("user_id",t.id).order("created_at",{ascending:!1})]);s(I||[]),l(re||[]),d(V||[])})()},[t]);const H=I=>{f(re=>{const V=new Set(re);return V.has(I)?V.delete(I):V.add(I),V})},A=async()=>
642{if(!t)return;if(u.size===0){me.error("Select at least one artwork to share");return}T(!0);const I=crypto.randomUUID().replace(/-/g,""),{data:re,error:V}=await Ne.from("portfolio_shares").insert({user_id:t.id,collector_id:p||null,title:x||null,message:b||null,token:I,submission_ids:Array.from(u),expires_at:_>0?new Date(Date.now()+_*864e5).toISOString():null,passcode:S.trim()||null,allow_inquiries:P}).select("*").single();if(T(!1),V||!re){me.error((V==null?void 0:V.message)||"Failed to create share");return}const $=`${window.location.origin}/p/${I}`;await navigator.clipboard.writeText($).catch(()=>{}),me.success("Share link created and copied to clipboard"),d([re,...c]),f(new Set),g(""),y(""),h(""),C("")},O=async I=>{const re=`${window.location.origin}/p/${I}`;await navigator.clipboard.writeText(re).catch(()=>{}),me.success("Link copied")},K=async I=>{const re=!I.revoked,{error:V}=await Ne.from("portfolio_shares").update({revoked:re}).eq("id",I.id);if(V){me.error(V.message);return}d(c.map($=>$.id===I.id?{...$,revoked:re}:$)),me.success(re?"Link disabled":"Link re-enabled")},U=async I=>{if(!confirm("Delete this share link permanently? Anyone with it will lose access."))return;const{error:re}=await Ne.from("portfolio_shares").delete().eq("id",I);if(re){me.error(re.message);return}d(c.filter(V=>V.id!==I)),me.success("Share deleted")};return o.jsx("div",{className:"fixed inset-0 z-[1000] flex items-start justify-center overflow-y-auto overscroll-contain bg-black/60 p-4",style:r,onClick:e,children:o.jsxs("div",{ref:n,tabIndex:-1,className:"relative my-4 max-h-[calc(var(--embed-visible-height,100vh)-2rem)] w-full max-w-3xl overflow-y-auto rounded-lg bg-background shadow-2xl sm:my-8",onClick:I=>I.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"share-builder-title",children:[o.jsx("button",{onClick:e,className:"absolute right-2 top-2 inline-flex h-11 w-11 items-center justify-center text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:o.jsx(Hr,{size:20})}),o.jsxs("div",{className:"p-7 border-b border-border",children:[o.jsx("h2",{id:"share-builder-title",className:"font-display text-2xl font-bold tracking-wide",children:"Curated Viewing Room"}),o.jsx("p",{className:"text-xs font-body text-muted-foreground mt-1",children:"Bundle multiple artworks into a single private link for a specific collector."})]}),o.jsxs("div",{className:"p-7 space-y-6",children:[o.jsxs("section",{className:"space-y-3",children:[o.jsx("h3",{className:"font-display text-base font-semibold tracking-wide",children:"Build a new share"}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Title (optional)"}),o.jsx("input",{value:x,onChange:I=>g(I.target.value),placeholder:"e.g. Selection for Mrs. Chen, May 2026",className:"w-full px-3 py-2 text-xs font-body border border-input rounded-md bg-background"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Collector (optional)"}),o.jsxs("select",{value:p,onChange:I=>h(I.target.value),className:"w-full px-3 py-2 text-xs font-body border border-input rounded-md bg-background",children:[o.jsx("option",{value:"",children:"—"}),a.map(I=>o.jsx("option",{value:I.id,children:I.name},I.id))]})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Note (optional)"}),o.jsx("textarea",{value:b,onChange:I=>y(I.target.value),rows:2,placeholder:"A short note shown at the top of the viewing room",className:"w-full px-3 py-2 text-xs font-body border border-input rounded-md bg-background"})]}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Link expires"}),o.jsx("div",{className:"flex flex-wrap gap-1",children:eJ.map(I=>o.jsx("button",{onClick:()=>w(I.days),className:`px-2.5 py-1.5 rounded-md border text-[10px] font-body font-semibold uppercase tracking-wider transition-colors ${_===I.days?"border-primary bg-primary text-primary-foreground":"border-input text-muted-foreground hover:bg-muted/60"}`,children:I.label},I.label))})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Passcode (optional)"}),o.jsx("input",{value:S,onChange:I=>C(I.target.value),placeholder:"e.g. reverie26",className:"w-full px-3 py-2 text-xs font-body border border-input rounded-md bg-background"})]})]}),o.jsxs("label",{className:"flex items-center gap-2 text-xs font-body text-foreground cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:P,onChange:I=>R(I.target.checked)}),"Let the collector make an offer or ask a question from this link"]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("label",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:["Artworks (",u.size," selected)"]})}),o.jsx("div",{className:"border border-input rounded-md max-h-64 overflow-y-auto divide-y divide-border",children:i.length===0?o.jsx("p",{className:"p-4 text-xs font-body text-muted-foreground text-center",children:"No saved artworks yet."}):i.map(I=>o.jsxs("label",{className:"flex items-center gap-3 px-3 py-2 text-xs font-body cursor-pointer hover:bg-muted/40",children:[o.jsx("input",{type:"checkbox",checked:u.has(I.id),onChange:()=>H(I.id)}),o.jsx("span",{className:"font-semibold text-foreground truncate",children:I.artist_name||"Unknown"}),I.artwork_title&&o.jsx("span",{className:"italic text-muted-foreground truncate",children:I.artwork_title})]},I.id))})]}),o.jsxs("button",{onClick:A,disabled:M||u.size===0,className:"w-full inline-flex items-center justify-center gap-2 px-4 py-2.5 text-xs font-body font-semibold uppercase tracking-wider bg-primary text-primary-foreground rounded-md hover:brightness-105 disabled:opacity-50 disabled:cursor-not-allowed",children:[o.jsx(D7,{size:13})," ",M?"Creating…":"Create Share Link"]})]}),c.length>0&&o.jsxs("section",{className:"space-y-2 border-t border-border pt-6",children:[o.jsxs("h3",{className:"font-display text-base font-semibold tracking-wide",children:["Share links (",c.length,")"]}),o.jsx("div",{className:"space-y-1.5",children:c.map(I=>{const re=a.find(D=>D.id===I.collector_id),V=!!I.expires_at&&new Date(I.expires_at)<new Date,$=!!I.revoked||V;return o.jsxs("div",{className:`flex items-center justify-between gap-3 p-3 rounded-md border bg-card ${$?"border-border opacity-70":"border-border"}`,children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("p",{className:"text-xs font-body font-semibold truncate",children:[I.title||"Untitled share",re&&o.jsxs("span",{className:"text-muted-foreground font-normal",children:[" · ",re.name]}),$&&o.jsx("span",{className:"ml-2 text-[10px] uppercase tracking-wider text-muted-foreground",children:V?"Expired":"Disabled"})]}),o.jsxs("p",{className:"text-[10px] font-body text-muted-foreground",children:[I.submission_ids.length," artwork",I.submission_ids.length===1?"":"s"," · ",I.view_count," view",I.view_count===1?"":"s",I.last_viewed_at&&` · last viewed ${new Date(I.last_viewed_at).toLocaleDateString()}`,I.expires_at&&` · expires ${new Date(I.expires_at).toLocaleDateString()}`,I.passcode&&" · passcode",I.allow_inquiries===!1&&" · inquiries off"]})]}),o.jsx("button",{onClick:()=>O(I.token),className:"p-1.5 text-muted-foreground hover:text-foreground",title:"Copy link",children:o.jsx(yf,{size:14})}),o.jsx("button",{onClick:()=>K(I),className:"p-1.5 text-muted-foreground hover:text-foreground",title:I.revoked?"Re-enable link":"Disable link",children:I.revoked?o.jsx(Qg,{size:14}):o.jsx(L7,{size:14})}),o.jsx("button",{onClick:()=>U(I.id),className:"p-1.5 text-muted-foreground hover:text-destructive",title:"Delete",children:o.jsx(RC,{size:14})})]},I.id)})})]})]})]})})},dj=({state:e,onAddWork:t,onOpenBadges:n,onOpenCollectors:r,variant:i="panel"})=>{const s=[{key:"entry",done:e.hasEntry,title:"Add your first work",body:"Enter the artist, medium, and dimensions — photographs optional to start.",action:{label:"Add a work",run:t}},{key:"valuation",done:e.hasValuation,title:"Run a valuation",body:"Use the formula for an instant band, then Research Deeper for market comparables.",action:{label:"Open the tool",run:t}},{key:"listing",done:e.hasListing,title:"List a work on your storefront",body:"Push a valued work to Shopify with its recommended price already filled in.",action:null},{key:"badge",done:e.hasBadge,title:"Install the valuation badge",body:"Show the independent valuation, provenance timeline, and offer button on product pages.",action:{label:"Get the snippet",run:n}},{key:"collector",done:e.hasCollector,title:"Link a collector",body:"Attach a buyer to a work so they receive valuation updates and provenance records.",action:r?{label:"Open collectors",run:r}:null}],a=s.filter(c=>c.done).length,l=Math.round(a/s.length*100);return i==="panel"&&a===s.length?null:o.jsxs("section",{className:i==="empty"?"p-6 sm:p-10 max-w-xl mx-auto":"rounded-md border border-border bg-card p-5",children:[o.jsxs("div",{className:"flex items-baseline justify-between gap-3 flex-wrap",children:[o.jsx("h3",{className:"font-display text-lg font-semibold tracking-wide",children:i==="empty"?"Set up your gallery w
642orkspace":"Finish setting up"}),o.jsxs("span",{className:"text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground",children:[a," of ",s.length," complete"]})]}),o.jsx("div",{className:"h-1.5 bg-muted rounded-full overflow-hidden mt-3",children:o.jsx("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${Math.max(3,l)}%`}})}),o.jsx("ol",{className:"mt-5 space-y-3",children:s.map((c,d)=>o.jsxs("li",{className:"flex items-start gap-3",children:[o.jsx("span",{className:`mt-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full border text-[10px] font-bold ${c.done?"border-primary bg-primary text-primary-foreground":"border-border text-muted-foreground"}`,children:c.done?o.jsx(uo,{size:11,strokeWidth:3}):d+1}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:`text-sm font-body font-semibold ${c.done?"text-muted-foreground line-through":"text-foreground"}`,children:c.title}),!c.done&&o.jsx("p",{className:"text-xs font-body text-muted-foreground mt-0.5 leading-relaxed",children:c.body}),!c.done&&c.action&&o.jsxs("button",{onClick:c.action.run,className:"mt-2 inline-flex items-center gap-1.5 text-xs font-body font-semibold text-primary hover:underline",children:[c.action.label," ",o.jsx(b7,{size:12})]})]})]},c.key))})]})},WP=({values:e,width:t=80,height:n=22,className:r=""})=>{if(e.length<2)return o.jsx("span",{className:`text-[10px] font-body text-muted-foreground/60 ${r}`,children:e.length===1?"1 valuation":"—"});const i=Math.min(...e),a=Math.max(...e)-i||1,l=t/(e.length-1),c=e.map((h,x)=>`${(x*l).toFixed(1)},${(n-(h-i)/a*(n-4)-2).toFixed(1)}`).join(" "),d=e[e.length-1],u=e[0],f=u>0?(d-u)/u*100:0,p=f>=0;return o.jsxs("span",{className:`inline-flex items-center gap-1.5 ${r}`,children:[o.jsx("svg",{width:t,height:n,className:"overflow-visible",children:o.jsx("polyline",{points:c,fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:p?"text-emerald-600":"text-rose-600"})}),o.jsxs("span",{className:`text-[10px] font-body font-semibold tabular-nums ${p?"text-emerald-700":"text-rose-700"}`,children:[p?"▲":"▼"," ",Math.abs(f).toFixed(0),"%"]})]})},nJ={USD:"$",EUR:"€",GBP:"£",CAD:"C$",AUD:"A$",CHF:"CHF ",JPY:"¥",HKD:"HK$",SGD:"S$",AED:"AED "},hd=(e,t)=>`${nJ[t||"USD"]||"$"}${Math.round(e).toLocaleString()}`,Mm=e=>Array.isArray(e)?e:[],rJ=e=>Array.isArray(e)?e.map(t=>String(t)):[],iJ=[{label:"Off",days:0},{label:"Quarterly",days:90},{label:"Twice a year",days:182},{label:"Annually",days:365}],uj=e=>e>=80?"High":e>=60?"Moderate":e>0?"Low":"Unrated",sJ=({submissionId:e,onClose:t})=>{const n=na(t),r=Cs(),[i,s]=k.useState(null),[a,l]=k.useState([]),[c,d]=k.useState(!0),[u,f]=k.useState(!1);k.useEffect(()=>{(async()=>{d(!0);const[{data:C},{data:P}]=await Promise.all([Ne.from("submissions").select("id,artist_name,artwork_title,currency,formula_value,ai_value,ai_confidence,ai_comparables,ai_reasoning,formula_reasoning,last_valued_at,revalue_cadence_days,next_revalue_at").eq("id",e).maybeSingle(),Ne.from("valuation_history").select("id,method,value,confidence,comparable_count,comparables,reasoning,created_at").eq("submission_id",e).order("created_at",{ascending:!1}).limit(40)]);s(C||null),l(P||[]),d(!1)})()},[e]);const p=k.useMemo(()=>{const C=Mm(i==null?void 0:i.ai_comparables);if(C.length)return C;const P=a.find(R=>Mm(R.comparables).length);return Mm(P==null?void 0:P.comparables)},[i,a]),h=rJ(i==null?void 0:i.formula_reasoning),x=(i==null?void 0:i.currency)||"USD",g=Number((i==null?void 0:i.formula_value)||0),b=Number((i==null?void 0:i.ai_value)||0),y=Number((i==null?void 0:i.ai_confidence)||0),_=k.useMemo(()=>{const C=b>0?b:g;if(!C)return null;const P=y>=80?.1:y>=60?.18:.28;return{low:C*(1-P),high:C*(1+P)}},[b,g,y]),w=k.useMemo(()=>{const C=[...a].reverse().filter(M=>Number(M.value)>0);if(C.length<2)return null;const P=Number(C[0].value),R=Number(C[C.length-1].value);return P?{pct:(R-P)/P*100,runs:C.length}:null},[a]),S=async C=>{if(!i)return;f(!0);const P=C>0?new Date(new Date(i.last_valued_at||Date.now()).getTime()+C*864e5).toISOString():null,{error:R}=await Ne.from("submissions").update({revalue_cadence_days:C>0?C:null,next_revalue_at:P}).eq("id",i.id);if(f(!1),R){me.error(R.message);return}s({...i,revalue_cadence_days:C>0?C:null,next_revalue_at:P}),me.success(C>0?"Re-valuation reminder scheduled":"Reminder turned off")};return o.jsx("div",{className:"fixed inset-0 z-[1001] flex items-start justify-center overflow-y-auto overscroll-contain bg-black/60 p-4",style:r,onClick:t,children:o.jsxs("div",{ref:n,tabIndex:-1,
642className:"relative my-4 max-h-[calc(var(--embed-visible-height,100vh)-2rem)] w-full max-w-3xl overflow-y-auto rounded-lg bg-background shadow-2xl sm:my-8",onClick:C=>C.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"valuation-dossier-title",children:[o.jsx("button",{onClick:t,className:"absolute right-2 top-2 inline-flex h-11 w-11 items-center justify-center text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:o.jsx(Hr,{size:20})}),o.jsxs("div",{className:"p-7 border-b border-border",children:[o.jsx("h2",{id:"valuation-dossier-title",className:"font-display text-2xl font-bold tracking-wide",children:"Valuation Dossier"}),o.jsx("p",{className:"text-xs font-body text-muted-foreground mt-1",children:c?"Loading…":`${(i==null?void 0:i.artist_name)||"Unknown"}${i!=null&&i.artwork_title?` · ${i.artwork_title}`:""}`})]}),!c&&i&&o.jsxs("div",{className:"p-7 space-y-7",children:[o.jsxs("section",{className:"grid gap-3 sm:grid-cols-3",children:[o.jsxs("div",{className:"rounded-md border border-primary/50 bg-primary/5 p-4",children:[o.jsx("div",{className:"text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground",children:"Comparable-led value"}),o.jsx("div",{className:"font-display text-xl font-bold tracking-wide mt-1",children:b>0?hd(b,x):"—"})]}),o.jsxs("div",{className:"rounded-md border border-border bg-card p-4",children:[o.jsx("div",{className:"text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground",children:"Formula value"}),o.jsx("div",{className:"font-display text-xl font-bold tracking-wide mt-1",children:g>0?hd(g,x):"—"})]}),o.jsxs("div",{className:"rounded-md border border-border bg-card p-4",children:[o.jsx("div",{className:"text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground",children:"Confidence"}),o.jsx("div",{className:"font-display text-xl font-bold tracking-wide mt-1",children:y>0?`${y}%`:"—"}),o.jsx("div",{className:"text-[10px] font-body text-muted-foreground",children:uj(y)})]})]}),_&&o.jsxs("section",{className:"rounded-md border border-border p-4",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(W0,{size:13,className:"text-primary"}),o.jsx("h3",{className:"font-display text-sm font-semibold tracking-wide",children:"Defensible range"})]}),o.jsxs("p",{className:"font-body text-sm text-foreground",children:[hd(_.low,x)," – ",hd(_.high,x)]}),o.jsxs("p",{className:"text-[11px] font-body text-muted-foreground mt-1",children:["Range widens as confidence falls: ",uj(y).toLowerCase()," ","confidence, ",p.length," comparable",p.length===1?"":"s"," on file.",g>0&&b>0&&Math.abs(b-g)/g>.25&&o.jsx(o.Fragment,{children:" Comparables and the formula diverge by more than 25% — treat the range as indicative."})]})]}),o.jsxs("section",{className:"space-y-2",children:[o.jsx("h3",{className:"font-display text-base font-semibold tracking-wide",children:"Comparable sales behind this number"}),p.length===0?o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"No comparables recorded yet — re-value this work to generate them."}):o.jsx("div",{className:"border border-border rounded-md divide-y divide-border",children:p.map((C,P)=>o.jsxs("div",{className:"p-3 space-y-1",children:[o.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[o.jsxs("p",{className:"text-xs font-body font-semibold text-foreground truncate",children:[C.title||"Untitled comparable",C.year&&o.jsxs("span",{className:"text-muted-foreground font-normal",children:[" · ",C.year]})]}),typeof C.salePrice=="number"&&C.salePrice>0&&o.jsx("span",{className:"text-xs font-body font-semibold tabular-nums",children:hd(C.salePrice,x)})]}),o.jsx("p",{className:"text-[11px] font-body text-muted-foreground",children:[C.medium,C.dimensions,C.saleVenue,C.saleDate].filter(Boolean).join(" · ")}),C.note&&o.jsx("p",{className:"text-[11px] font-body text-muted-foreground italic",children:C.note})]},P))})]}),(i.ai_reasoning||h.length>0)&&o.jsxs("section",{className:"space-y-2",children:[o.jsx("h3",{className:"font-display text-base font-semibold tracking-wide",children:"Why this number"}),i.ai_reasoning&&o.jsx("p",{className:"text-xs font-body text-foreground leading-relaxed",children:i.ai_reasoning}),h.length>0&&o.jsx("ul",{className:"text-[11px] font-body text-muted-foreground space-y-1 list-disc pl-4",children:h.map((C,P)=>o.jsx("li",{children:C},P))})]}),o.jsxs("section",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"font-display text-base font-semibold tracking-wide",children:"Valuation history"}),w&&o.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] font-body font-semibold ${w.pct>=0?"text-primary":"text-destructive"}`,children:[o.jsx(t2,{size:12}),w.pct>=0?"+":"",w.pct.toFixed(1),"% across ",w.runs," valuations"]})]}),a.length===0?o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"No previous valuations recorded for this work yet."}):o.jsx("div",{className:"border border-border rounded-md overflow-x-auto",children:o.jsxs("table",{className:"w-full min-w-[480px] text-xs font-body",children:[o.jsx("thead",{className:"bg-muted/60",children:o.jsxs("tr",{className:"text-left text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[o.jsx("th",{className:"py-2 px-3",children:"Date"}),o.jsx("th",{className:"py-2 px-3",children:"Method"}),o.jsx("th",{className:"py-2 px-3 text-right",children:"Value"}),o.jsx("th",{className:"py-2 px-3 text-right",children:"Confidence"}),o.jsx("th",{className:"py-2 px-3 text-right",children:"Comps"})]})}),o.jsx("tbody",{children:a.map(C=>o.jsxs("tr",{className:"border-t border-border",children:[o.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:new Date(C.created_at).toLocaleDateString()}),o.jsx("td",{className:"py-2 px-3 capitalize",children:C.method||"—"}),o.jsx("td",{className:"py-2 px-3 text-right tabular-nums font-semibold",children:Number(C.value)>0?hd(Number(C.value),x):"—"}),o.jsx("td",{className:"py-2 px-3 text-right tabular-nums text-muted-foreground",children:C.confidence?`${C.confidence}%`:"—"}),o.jsx("td",{className:"py-2 px-3 text-right tabular-nums text-muted-foreground",children:(C.comparable_count??Mm(C.comparables).length)||"—"})]},C.id))})]})})]}),o.jsxs("section",{className:"space-y-2 border-t border-border pt-6",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(_7,{size:14,className:"text-muted-foreground"}),o.jsx("h3",{className:"font-display text-base font-semibold tracking-wide",children:"Re-valuation schedule"})]}),o.jsx("p",{className:"text-[11px] font-body text-muted-foreground",children:"Choose how often this work should be re-valued. Works past their date appear in your action queue and daily digest."}),o.jsx("div",{className:"flex flex-wrap gap-1.5",children:iJ.map(C=>{const P=(i.revalue_cadence_days||0)===C.days;return o.jsx("button",{onClick:()=>S(C.days),disabled:u,className:`px-3 py-1.5 rounded-md border text-[10px] font-body font-semibold uppercase tracking-wider transition-colors disabled:opacity-50 ${P?"border-primary bg-primary text-primary-foreground":"border-input text-muted-foreground hover:bg-muted/60"}`,children:C.label},C.label)})}),o.jsxs("p",{className:"text-[11px] font-body text-muted-foreground",children:[i.next_revalue_at?`Next due ${new Date(i.next_revalue_at).toLocaleDateString()}`:"No reminder set.",i.last_valued_at&&` · Last valued ${new Date(i.last_valued_at).toLocaleDateString()}`]})]})]})]})})},oJ={USD:"$",EUR:"€",GBP:"£",CAD:"C$",AUD:"A$",CHF:"CHF ",JPY:"¥",HKD:"HK$",SGD:"S$",AED:"AED "},hj=e=>{if(e.ai_value&&Number(e.ai_value)>0)return Number(e.ai_value);if(e.formula_value&&Number(e.formula_value)>0)return Number(e.formula_value);const t=Number(e.base_value||0),n=Number(e.scarcity_multiplier||0),r=Number(e.provenance_uplift||0);return t+t*(n/100)+t*(r/100)},fj=(e,t)=>`${oJ[t||"USD"]||"$"}
642${Math.round(e).toLocaleString()}`,aJ=async(e,t="Reverie Fine Art Collective")=>{const n=new Xe({unit:"pt",format:"letter"});await sx(n);const r=n.internal.pageSize.getWidth(),i=n.internal.pageSize.getHeight(),s=48,a=new Date().toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"});ct(n,"bold"),n.setFontSize(28),n.text(Nt("Insurance Schedule"),s,140),ct(n,"normal"),n.setFontSize(11),n.setTextColor(110),n.text(Nt(t),s,168),n.text(Nt(`Prepared ${a}`),s,184);const l=e.reduce((x,g)=>x+hj(g),0);n.setDrawColor(220),n.line(s,210,r-s,210),ct(n,"bold"),n.setFontSize(10),n.setTextColor(80),n.text(Nt("ENTRIES"),s,234),n.text(Nt("AGGREGATE VALUE"),s+200,234),ct(n,"bold"),n.setFontSize(22),n.setTextColor(20),n.text(String(e.length),s,264),n.text(fj(l,"USD"),s+200,264),ct(n,"normal"),n.setFontSize(9),n.setTextColor(120),n.text(n.splitTextToSize(Nt("This schedule lists artworks documented in the gallery's collection management system with their most recent valuation. Values reflect estimates derived from comparable-sales analysis and gallery-supplied data. They are not certified appraisals and should be reviewed by a qualified appraiser when binding coverage is established."),r-s*2),s,320,{lineHeightFactor:1.5});const d=96;let u=i,f=1;const p=()=>{u+d>i-s&&(n.addPage(),f+=1,u=s,ct(n,"bold"),n.setFontSize(8),n.setTextColor(140),n.text(Nt(`${t.toUpperCase()} · INSURANCE SCHEDULE`),s,28),n.text(Nt(`Page ${f}`),r-s,28,{align:"right"}),ct(n,"bold"),n.setFontSize(8),n.setTextColor(100),n.text(Nt("ARTIST / TITLE"),s+84,u+12),n.text(Nt("DETAILS"),s+84+200,u+12),n.text(Nt("VALUE"),r-s,u+12,{align:"right"}),n.setDrawColor(220),n.line(s,u+18,r-s,u+18),u+=28)};for(const x of e){p();const g=u;if(x.image_url)try{const w=await D2(x.image_url),S=w.dataUrl.startsWith("data:image/png")?"PNG":"JPEG";w.dataUrl&&n.addImage(w.dataUrl,S,s,g,72,72,void 0,"FAST")}catch{}else n.setDrawColor(220),n.rect(s,g,72,72);ct(n,"bold"),n.setFontSize(12),n.setTextColor(20),n.text(Nt(x.artist_name||"Unknown"),s+84,g+14),ct(n,"normal"),n.setFontSize(10),n.setTextColor(90);
642const b=[x.artwork_title,x.year].filter(Boolean).join(" · ");b&&n.text(Nt(b),s+84,g+30),ct(n,"normal"),n.setFontSize(9),n.setTextColor(80),[x.medium,x.dimensions,x.condition&&`Condition: ${x.condition}`,x.edition&&`Edition: ${x.edition}`,x.framed?"Framed":"Unframed"].filter(Boolean).slice(0,4).forEach((w,S)=>{n.text(Nt(w),s+84+200,g+14+S*13)});const _=hj(x);ct(n,"bold"),n.setFontSize(14),n.setTextColor(20),n.text(_>0?fj(_,x.currency):"—",r-s,g+22,{align:"right"}),ct(n,"normal"),n.setFontSize(8),n.setTextColor(140),x.last_valued_at&&n.text(Nt(`Valued ${new Date(x.last_valued_at).toLocaleDateString()}`),r-s,g+38,{align:"right"}),n.setDrawColor(235),n.line(s,g+84,r-s,g+84),u+=d}const h=`insurance-schedule-${new Date().toISOString().slice(0,10)}.pdf`;n.save(h)},pj="https://reverie-art-evaluation.lovable.app",HP=()=>{if(typeof window>"u")return pj;const e=window.location.hostname;return e==="localhost"||e==="127.0.0.1"||e.includes("id-preview--")?pj:window.location.origin};function VP(){const e=HP();return[{id:"app-embed",widgetId:"embed-loader",title:"Valuation tool",where:"/pages/art-valuation",file:"Pages → Art Valuation → page content (Show HTML <>)",desc:"Replaces the fixed-height iframe. Auto-resizes to content, keeps dialogs on screen inside Shopify, and supports deep links such as #/artists.",snippet:`<div data-reverie-app data-path="/" data-min-height="1200"></div>
643<script async src="${e}/reverie-embed.js"><\/script>`,verify:"Open the page — the tool should size itself with no inner scrollbar on mobile or desktop."},{id:"universal",widgetId:"badge",title:"Live valuation badge",where:"Product template",file:"Online Store → Edit code → sections/main-product.liquid (below the price block)",desc:"Paste once. Renders for every artwork you enable, with the published valuation, Make an offer and Ask about this work.",snippet:`<div data-reverie-badge data-handle="{{ product.handle }}"></div>
644<script async src="${e}/badge.js"><\/script>`,verify:"Open a product you enabled — the gold-ruled valuation panel appears under the price."},{id:"provenance",widgetId:"provenance",title:"Provenance timeline",where:"Product template",file:"sections/main-product.liquid (directly below the badge)",desc:"Shows the acquired → exhibited → revalued → sold history for that specific work.",snippet:`<div data-reverie-provenance data-handle="{{ product.handle }}"></div>
645<script async src="${e}/provenance.js"><\/script>`,verify:"A vertical dated timeline renders beneath the badge on works with history."},{id:"trust-strip",widgetId:"trust-strip",title:"Sitewide trust strip",where:"Every page (footer)",file:"Online Store → Edit code → layout/theme.liquid (just above </body>)",desc:"Adds the independent-methodology band to every storefront page, including collections and cart.",snippet:`<div data-reverie-trust-strip></div>
646<script async src="${e}/trust-strip.js"><\/script>`,verify:"Scroll to the bottom of any page — the methodology band is present."},{id:"artists",widgetId:"featured-artists",title:"Featured artists grid",where:"/pages/featured-artists",file:"Pages → Featured Artists → page content (Show HTML <>)",desc:"Lists every artist with publicly valued works and links through to their Reverie artist page.",snippet:`<div data-reverie-artists data-limit="24"></div>
647<script async src="${e}/featured-artists.js"><\/script>`,verify:"The grid lists artists with work counts; each card links to /artist/…"},{id:"recently-revalued",widgetId:"recently-revalued",title:"Recently revalued feed",where:"Homepage or /collections/our-inventory",file:"Theme editor → Add section → Custom Liquid",desc:"Surfaces the latest publicly revalued works with their price movement — social proof near the buy path.",snippet:`<div data-reverie-recently-revalued data-limit="6"></div>
648<script async src="${e}/recently-revalued.js"><\/script>`,verify:"A row of recently revalued works with % movement renders on the page."},{id:"collection-search",widgetId:"collection-search",title:"Collection search",where:"Homepage, /collections/all or a dedicated Search page",file:"Theme editor → Add section → Custom Liquid",desc:"Searchable, filterable catalogue of every publicly valued work — by artist, medium and value range — linking straight to the product page.",snippet:`<div data-reverie-search data-limit="12" data-shop="https://reverieart.com"></div>
649<script async src="${e}/collection-search.js"><\/script>`,verify:"Filters populate with your artists and mediums, and results link to /products/…"}]}const lJ=`${HP()}/badge.js`;function GP({onClose:e}){const{user:t}=pn(),n=na(e),[r,i]=k.useState([]),[s,a]=k.useState(!0),[l,c]=k.useState(null),[d,u]=k.useState({});k.useEffect(()=>{t&&(async()=>{a(!0);const{data:P,error:R}=await Ne.from("submissions").select("id, artist_name, artwork_title, ai_value, formula_value, currency, shopify_product_handle, shopify_product_id, public_valuation_enabled, auto_price_sync").eq("user_id",t.id).order("created_at",{ascending:!1});R?me.error("Failed to load artworks"):i(P||[]),a(!1)})()},[t]);const f=k.useMemo(()=>r.filter(P=>(P.ai_value??P.formula_value??0)>0),[r]),p=(P,R)=>i(M=>M.map(T=>T.id===P?{...T,...R}:T)),h=async(P,R)=>{if(R&&!P.shopify_product_handle&&!P.shopify_product_id){me.error("Add a Shopify product handle first");return}p(P.id,{public_valuation_enabled:R});const{error:M}=await Ne.from("submissions").update({public_valuation_enabled:R}).eq("id",P.id);M?(me.error("Failed to update"),p(P.id,{public_valuation_enabled:!R})):me.success(R?"Badge enabled":"Badge disabled")},x=async(P,R)=>{if(R&&!P.shopify_product_id){me.error("Link a Shopify product first (create or import it)");return}p(P.id,{auto_price_sync:R});const{error:M}=await Ne.from("submissions").update({auto_price_sync:R}).eq("id",P.id);M?(me.error("Failed to update"),p(P.id,{auto_price_sync:!R})):me.success(R?"Auto-sync on":"Auto-sync off")},[g,b]=k.useState(null),y=async P=>{if(!P.shopify_product_id){me.error("Not linked to a Shopify product");return}b(P.id);try{const{data:R,error:M}=await Ne.functions.invoke("sync-shopify-price",{body:{submission_id:P.id,force:!0}});if(M)throw M;R!=null&&R.updated?me.success(`Price pushed: $${R.previous_price} → $${R.new_price}`):me.message((R==null?void 0:R.reason)||"No change pushed")}catch(R){me.error(R.message||"Sync failed")}finally{b(null)}},_=async P=>{const R=(d[P.id]??P.shopify_product_handle??"").trim()||null;if(R===P.shopify_product_handle)return;const{error:M}=await Ne.from("submissions").update({shopify_product_handle:R}).eq("id",P.id);M?me.error("Failed to save handle"):(p(P.id,{shopify_product_handle:R}),me.success("Handle saved"))},w=P=>`<div data-reverie-badge ${P.shopify_product_handle?`data-handle="${P.shopify_product_handle}"`:`data-product-id="${P.shopify_product_id}"`}></div>
650<script async src="${lJ}"><\/script>`,S=k.useMemo(()=>VP(),[]),C=async(P,R)=>{try{await navigator.clipboard.writeText(P),c(R),me.success("Snippet copied"),setTimeout(()=>c(null),1800)}catch{me.error("Could not copy")}};return o.jsx("div",{className:"fixed inset-0 z-[1001] flex items-start justify-center overflow-y-auto overscroll-contain bg-black/40 px-4 py-4 sm:py-8",children:o.jsxs("div",{ref:n,tabIndex:-1,
650className:"max-h-[calc(100vh-2rem)] w-full max-w-4xl overflow-y-auto rounded-sm border border-[#E8E8E8] bg-[#FFFFFF] shadow-2xl",role:"dialog","aria-modal":"true","aria-labelledby":"badge-manager-title",children:[o.jsxs("div",{className:"flex items-start justify-between border-b border-[#E8E8E8] px-5 pb-5 pt-7 sm:px-8",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] tracking-[0.18em] uppercase text-[#B08A3E] font-semibold",children:"Shopify · Storefront Integration"}),o.jsx("h2",{id:"badge-manager-title",className:"font-serif text-3xl text-[#202020] mt-1",children:"Live valuation badge"}),o.jsxs("p",{className:"text-sm text-[#555555] italic mt-2 max-w-xl",children:["Show the current Reverie valuation on any Shopify product page. Enable per artwork, paste the snippet into ",o.jsx("code",{className:"text-[#333333]",children:"product.liquid"}),", and the price updates automatically."]})]}),o.jsx("button",{onClick:e,className:"inline-flex h-11 w-11 shrink-0 items-center justify-center text-[#555555] hover:text-[#202020] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:o.jsx(Hr,{className:"w-5 h-5"})})]}),o.jsxs("div",{className:"px-8 py-6 bg-[#F6F6F6] border-b border-[#E8E8E8]",children:[o.jsxs("div",{className:"mb-4",children:[o.jsx("div",{className:"text-[10px] tracking-[0.18em] uppercase text-[#B08A3E] font-semibold mb-1",children:"Storefront install kit"}),o.jsx("p",{className:"text-xs text-[#555555] max-w-2xl leading-relaxed",children:"Six snippets, each with the exact place it belongs in your Shopify theme. Install top to bottom — every one is self-contained, styled to match the site, and safe to paste twice."})]}),o.jsx("div",{className:"mb-4",children:o.jsx(G2,{})}),o.jsxs("a",{href:"/install",target:"_blank",rel:"noopener noreferrer",className:"mb-4 inline-flex items-center gap-1.5 text-[10px] tracking-[0.14em] uppercase font-semibold text-[#B08A3E] hover:underline",children:["Open the step-by-step install guide ",o.jsx(wf,{className:"w-3 h-3"})]}),o.jsx("div",{className:"space-y-4",children:S.map(P=>o.jsxs("div",{className:"bg-white border border-[#E8E8E8] rounded-sm p-4",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4 mb-2",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[o.jsx("h3",{className:"font-serif text-base text-[#202020]",children:P.title}),o.jsx("span",{className:"text-[9.5px] tracking-[0.12em] uppercase font-semibold text-[#B08A3E] bg-[#F6F6F6] border border-[#E8E8E8] px-2 py-0.5 rounded-sm",children:P.where})]}),o.jsx("p",{className:"text-xs text-[#555555] mt-1.5 leading-relaxed",children:P.desc})]}),o.jsxs("button",{onClick:()=>C(P.snippet,P.id),className:"text-xs px-3 py-1.5 bg-[#202020] text-[#FFFFFF] hover:bg-[#333333] inline-flex items-center gap-1.5 rounded-sm shrink-0",children:[l===P.id?o.jsx(uo,{className:"w-3 h-3"}):o.jsx(yf,{className:"w-3 h-3"}),"Copy"]})]}),o.jsx("pre",{className:"text-[11px] leading-relaxed bg-[#202020] text-[#F6F6F6] p-3 rounded-sm overflow-x-auto font-mono",children:P.snippet})]},P.id))})]}),o.jsx("div",{className:"px-8 py-6 max-h-[55vh] overflow-y-auto",children:s?o.jsx("p",{className:"text-sm text-[#555555]",children:"Loading artworks…"}):f.length===0?o.jsx("p",{className:"text-sm text-[#555555]",children:"No valued artworks yet. Save an artwork with a valuation to enable the badge."}):o.jsx("div",{className:"space-y-3",children:f.map(P=>{const R=d[P.id]??P.shopify_product_handle??"",M=!!(P.shopify_product_handle||P.shopify_product_id);return o.jsxs("div",{className:"border border-[#E8E8E8] bg-white p-4 rounded-sm",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4 mb-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"font-serif text-lg text-[#202020] truncate",children:P.artist_name||"Untitled artist"}),o.jsx("div",{className:"text-xs text-[#555555] italic truncate",children:P.artwork_title||"Untitled work"})]}),o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer shrink-0",children:[o.jsx("span",{className:"text-xs text-[#555555]",children:P.public_valuation_enabled?"Public":"Private"}),o.jsx("input",{type:"checkbox",checked:P.public_valuation_enabled,disabled:!M,onChange:T=>h(P,T.target.checked),className:"w-9 h-5 appearance-none bg-[#E8E8E8] rounded-full relative cursor-pointer checked:bg-[#B08A3E] transition-colors before:content-[''] before:absolute before:w-4 before:h-4 before:bg-white before:rounded-full before:top-0.5 before:left-0.5 before:transition-transform checked:before:translate-x-4 disabled:opacity-40 disabled:cursor-not-allowed"})]})]}),o.jsxs("div",{className:"grid grid-cols-[1fr_auto] gap-2 items-end",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-[10px] tracking-[0.12em] uppercase text-[#555555] font-semibold block mb-1",children:"Shopify product handle"}),o.jsx("input",{type:"text",value:R,placeholder:"e.g. untitled-1972",onCh
650ange:T=>u(H=>({...H,[P.id]:T.target.value})),onBlur:()=>_(P),className:"w-full px-3 py-2 text-sm bg-[#FFFFFF] border border-[#E8E8E8] rounded-sm focus:outline-none focus:border-[#B08A3E] font-mono"})]}),o.jsxs("button",{onClick:()=>C(w(P),P.id),disabled:!M,className:"text-xs px-3 py-2 border border-[#202020] text-[#202020] hover:bg-[#202020] hover:text-[#FFFFFF] inline-flex items-center gap-1.5 rounded-sm disabled:opacity-40 disabled:cursor-not-allowed",children:[l===P.id?o.jsx(uo,{className:"w-3 h-3"}):o.jsx(yf,{className:"w-3 h-3"}),"Snippet"]})]}),P.shopify_product_id&&o.jsxs("div",{className:"mt-3 flex items-center justify-between gap-3 pt-3 border-t border-[#F0EBDF]",children:[o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:P.auto_price_sync,onChange:T=>x(P,T.target.checked),className:"w-9 h-5 appearance-none bg-[#E8E8E8] rounded-full relative cursor-pointer checked:bg-[#B08A3E] transition-colors before:content-[''] before:absolute before:w-4 before:h-4 before:bg-white before:rounded-full before:top-0.5 before:left-0.5 before:transition-transform checked:before:translate-x-4"}),o.jsxs("span",{className:"text-xs text-[#555555]",children:["Auto-sync price to Shopify when re-valued ",o.jsx("span",{className:"text-[#B08A3E]",children:"(±10%)"})]})]}),o.jsx("button",{onClick:()=>y(P),disabled:g===P.id,className:"text-xs px-3 py-1.5 border border-[#B08A3E] text-[#B08A3E] hover:bg-[#B08A3E] hover:text-[#FFFFFF] rounded-sm disabled:opacity-40",children:g===P.id?"Syncing…":"Sync now"})]}),P.public_valuation_enabled&&o.jsxs("a",{href:`${window.location.origin}/functions/v1/public-valuation?${P.shopify_product_handle?`handle=${encodeURIComponent(P.shopify_product_handle)}`:`product_id=${encodeURIComponent(P.shopify_product_id||"")}`}`,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] tracking-[0.12em] uppercase text-[#B08A3E] font-semibold mt-3 inline-flex items-center gap-1 hover:underline",children:["Test endpoint ",o.jsx(wf,{className:"w-3 h-3"})]})]},P.id)})})}),o.jsx("div",{className:"px-8 py-4 border-t border-[#E8E8E8] bg-[#F6F6F6] text-[11px] text-[#555555] italic",children:"Badges cache for 5 minutes on the Shopify edge. Valuations refresh automatically when you re-run the AI consensus."})]})})}const cJ=["new","responded","countered","accepted","declined"],dJ=["all","offer","inquiry"];function uJ({onClose:e}){const t=na(e),{user:n}=pn(),r=Cs(),[i,s]=k.useState([]),[a,l]=k.useState(!0),[c,d]=k.useState("all"),[u,f]=k.useState("all"),[p,h]=k.useState(null),[x,g]=k.useState({}),[b,y]=k.useState({}),[_,w]=k.useState(null),[S,C]=k.useState(null),[P,R]=k.useState({}),[M,T]=k.useState({}),H=async D=>{const{data:ie}=await Ne.from("offer_messages").select("id, sender_role, body, created_at").eq("offer_id",D).order("created_at",{ascending:!0});g(X=>({...X,[D]:ie||[]}))},A=D=>{if(p===D){h(null);return}h(D),x[D]||H(D)},O=async D=>{const ie=(b[D.id]||"").trim();if(!(!ie||!n)){w(D.id);try{const{error:X}=await Ne.from("offer_messages").insert({offer_id:D.id,sender_role:"owner",sender_user_id:n.id,body:ie});if(X)throw X;const E=D.thread_token?`https://reverie-art-evaluation.lovable.app/inquiry/${D.thread_token}`:"https://reverie-art-evaluation.lovable.app";await Ne.functions.invoke("send-transactional-email",{body:{templateName:"owner-reply-to-buyer",recipientEmail:D.buyer_email,idempotencyKey:`owner-reply-${D.id}-${Date.now()}`,templateData:{buyerName:D.buyer_name,artist:D.artist_name||"the artist",title:D.artwork_title||"the work",message:ie,threadUrl:E}}}),await Ne.from("offers").update({status:"responded",responded_at:new Date().toISOString()}).eq("id",D.id),s(q=>q.map(F=>F.id===D.id?{...F,status:"responded"}:F)),y(q=>({...q,[D.id]:""})),await H(D.id),me.success("Reply sent")}catch(X){me.error(X.message||"Failed to send")}finally{w(null)}}},K=D=>{const ie=(D.buyer_name||"there").split(" ")[0],X=D.artwork_title||"the work",E=(D.kind||"offer")==="inquiry";return[{label:"Available",body:`Hello ${ie},
651
652Thank you for reaching out about ${X} — it is still available. Its current valuation is published on the product page, and I am happy to answer anything on condition, framing or provenance.
653
654Warm regards,
655Reverie Fine Art Collective`},{label:E?"Send details":"Accept",body:E?`Hello ${ie},
656
657Happy to share more on ${X}. Below are the details most collectors ask about:
658
659• Condition: 
660• Framing: 
661• Provenance: 
662• Shipping: insured, crated, quoted to your address
663
664Let me know what else would be useful.
665
666Warm regards,
667Reverie Fine Art Collective`:`Hello ${ie},
668
669We are pleased to accept your offer on ${X}. I will follow up shortly with an invoice and insured shipping details.
670
671Warm regards,
672Reverie Fine Art Collective`},{label:"Need info",body:`Hello ${ie},
673
674Thank you for your note on ${X}. So I can respond properly, could you confirm your delivery city and whether you would like framing included?
675
676Warm regards,
677Reverie Fine Art Collective`},{label:"Decline kindly",body:`Hello ${ie},
678
679Thank you for your interest in ${X}. We are not able to proceed at that figure, as the work's published valuation sits above it — but I would be glad to show you comparable works in your range.
680
681Warm regards,
682Reverie Fine Art Collective`}]},U=async D=>{const ie=(P[D.id]||"").replace(/[^0-9.]/g,""),X=Number(ie);if(!n||!X||X<=0){me.error("Enter a counter amount");return}w(D.id);try{const E=D.currency||"USD",q=(M[D.id]||"").trim(),F=`Counter-offer: ${$(X,E)}${q?`
683
684${q}`:""}`,{error:Z}=await Ne.from("offer_messages").insert({offer_id:D.id,sender_role:"owner",sender_user_id:n.id,body:F});if(Z)throw Z;const Y=D.thread_token?`${window.location.origin}/inquiry/${D.thread_token}`:window.location.origin;await Ne.functions.invoke("send-transactional-email",{body:{templateName:"owner-counter-offer",recipientEmail:D.buyer_email,idempotencyKey:`counter-${D.id}-${Date.now()}`,templateData:{buyerName:D.buyer_name,artist:D.artist_name||"the artist",title:D.artwork_title||"the work",offerAmount:D.amount?$(Number(D.amount),E):"",counterAmount:$(X,E),message:q,threadUrl:Y}}}),await Ne.from("offers").update({status:"countered",counter_amount:X,counter_currency:E,counter_sent_at:new Date().toISOString(),responded_at:new Date().toISOString()}).eq("id",D.id),s(ee=>ee.map(ce=>ce.id===D.id?{...ce,status:"countered",counter_amount:X,counter_currency:E}:ce)),R(ee=>({...ee,[D.id]:""})),T(ee=>({...ee,[D.id]:""})),C(null),x[D.id]?await H(D.id):await H(D.id),h(D.id),me.success("Counter-offer sent")}catch(E){me.error(E.message||"Failed to send counter")}finally{w(null)}};k.useEffect(()=>{n&&(async()=>
684{l(!0);const{data:D,error:ie}=await Ne.from("offers").select("*").eq("user_id",n.id).order("created_at",{ascending:!1});if(ie){me.error("Failed to load offers"),l(!1);return}const X=D||[],E=Array.from(new Set(X.map(F=>F.submission_id)));let q={};if(E.length){const{data:F}=await Ne.from("submissions").select("id, artist_name, artwork_title, ai_value, formula_value").in("id",E);for(const Z of F||[])q[Z.id]=Z}s(X.map(F=>{var Z,Y,ee,ce;return{...F,artwork_title:(Z=q[F.submission_id])==null?void 0:Z.artwork_title,artist_name:(Y=q[F.submission_id])==null?void 0:Y.artist_name,ai_value:(ee=q[F.submission_id])==null?void 0:ee.ai_value,formula_value:(ce=q[F.submission_id])==null?void 0:ce.formula_value}})),l(!1)})()},[n]);const I=async(D,ie)=>{s(E=>E.map(q=>q.id===D?{...q,status:ie}:q));const{error:X}=await Ne.from("offers").update({status:ie,responded_at:ie==="new"?null:new Date().toISOString()}).eq("id",D);X?me.error("Failed to update"):me.success(`Marked ${ie}`)},re=i.filter(D=>u==="all"||(D.kind||"offer")===u).filter(D=>c==="all"||D.status===c),V=D=>({USD:"$",EUR:"€",GBP:"£",CAD:"C$",AUD:"A$"})[D]||"$",$=(D,ie)=>`${V(ie)}${Math.round(D).toLocaleString()}`;return o.jsx("div",{className:"fixed inset-0 z-[1000] flex items-start justify-center overflow-y-auto overscroll-contain bg-black/40 px-4 py-4 sm:py-8",style:r,children:o.jsxs("div",{ref:t,tabIndex:-1,className:"max-h-[calc(var(--embed-visible-height,100vh)-2rem)] w-full max-w-3xl overflow-y-auto rounded-sm border border-[#E8E8E8] bg-[#FFFFFF] shadow-2xl",role:"dialog","aria-modal":"true","aria-labelledby":"offers-title",children:[o.jsxs("div",{className:"flex items-start justify-between border-b border-[#E8E8E8] px-5 pb-5 pt-7 sm:px-8",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] tracking-[0.18em] uppercase text-[#B08A3E] font-semibold",children:"Inbox · From Shopify"}),o.jsx("h2",{id:"offers-title",className:"font-serif text-3xl text-[#202020] mt-1",children:"Offers & inquiries"}),o.jsx("p",{className:"text-sm text-[#555555] italic mt-2 max-w-xl",children:"Buyers can submit offers or ask questions directly from the live valuation badge on your Shopify product pages. Respond by email and mark the entry below."})]}),o.jsx("button",{onClick:e,className:"inline-flex h-11 w-11 shrink-0 items-center justify-center text-[#555555] hover:text-[#202020] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:o.jsx(Hr,{className:"w-5 h-5"})})]}),o.jsxs("div",{className:"px-8 py-3 border-b border-[#E8E8E8] flex flex-wrap items-center gap-2 bg-[#F6F6F6]",children:[o.jsx("span",{className:"text-[9px] tracking-[0.18em] uppercase text-[#555555] font-semibold mr-1",children:"Type"}),dJ.map(D=>o.jsx("button",{onClick:()=>f(D),className:`min-h-[44px] text-[10px] tracking-[0.14em] uppercase font-semibold px-3 py-1.5 rounded-sm border ${u===D?"bg-[#202020] text-[#FFFFFF] border-[#202020]":"text-[#555555] border-[#E8E8E8] hover:border-[#B08A3E]"}`,children:D==="inquiry"?"Inquiries":D==="offer"?"Offers":"All"},D)),o.jsx("span",{className:"w-px h-5 bg-[#E8E8E8] mx-2"}),o.jsx("span",{className:"text-[9px] tracking-[0.18em] uppercase text-[#555555] font-semibold mr-1",children:"Status"}),["all",...cJ].map(D=>o.jsx("button",{onClick:()=>d(D),className:`min-h-[44px] text-[10px] tracking-[0.14em] uppercase font-semibold px-3 py-1.5 rounded-sm border ${c===D?"bg-[#202020] text-[#FFFFFF] border-[#202020]":"text-[#555555] border-[#E8E8E8] hover:border-[#B08A3E]"}`,children:D},D))]}),o.jsx("div",{className:"px-8 py-6 max-h-[60vh] overflow-y-auto",children:a?o.jsx("p",{className:"text-sm text-[#555555]",children:"Loading offers…"}):re.length===0?o.jsx("p",{className:"text-sm text-[#555555] italic",children:"No offers in this view yet."}):o.jsx("div",{className:"space-y-3",children:re.map(D=>{const ie=(D.kind||"offer")==="inquiry",X=Number(D.ai_value||D.formula_value||0),E=Number(D.amount||0),q=!ie&&X>0&&E>0?(E-X)/X*100:null;return o.jsxs("div",{className:"border border-[#E8E8E8] bg-white p-4 rounded-sm",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:`text-[9px] tracking-[0.16em] uppercase font-bold px-1.5 py-0.5 rounded-sm ${ie?"bg-[#E8DFC9] text-[#7A6033]":"bg-[#202020] text-[#FFFFFF]"}`,children:ie?"Inquiry":"Offer"}),o.jsx("div",{className:"text-xs text-[#555555]",children:new Date(D.created_at).toLocaleStr
684ing()})]}),o.jsxs("div",{className:"font-serif text-lg text-[#202020] truncate mt-1",children:[D.artist_name||"Untitled artist"," —"," ",o.jsx("span",{className:"italic",children:D.artwork_title||"Untitled"})]})]}),!ie&&E>0&&o.jsxs("div",{className:"text-right shrink-0",children:[o.jsx("div",{className:"font-serif text-2xl text-[#202020]",children:$(E,D.currency)}),X>0&&q!==null&&o.jsxs("div",{className:`text-[10px] uppercase tracking-wider font-semibold mt-0.5 ${q>=0?"text-[#3F7A4E]":"text-[#A8443A]"}`,children:[q>=0?"+":"",q.toFixed(1),"% vs ",$(X,D.currency)]})]})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2 mt-3 text-xs text-[#333333]",children:[o.jsx("div",{className:"font-semibold",children:D.buyer_name}),o.jsxs("a",{href:`mailto:${D.buyer_email}?subject=Your offer on ${encodeURIComponent(D.artwork_title||"the work")}`,className:"inline-flex items-center gap-1 text-[#B08A3E] hover:underline truncate",children:[o.jsx(Qf,{className:"w-3 h-3"})," ",D.buyer_email]}),D.buyer_phone&&o.jsxs("a",{href:`tel:${D.buyer_phone}`,className:"inline-flex items-center gap-1 text-[#555555] hover:underline",children:[o.jsx(e2,{className:"w-3 h-3"})," ",D.buyer_phone]})]}),D.message&&o.jsxs("div",{className:"mt-3 p-3 bg-[#FFFFFF] border-l-2 border-[#B08A3E] text-sm text-[#333333] italic",children:[o.jsx(pu,{className:"w-3 h-3 inline mr-1 text-[#B08A3E]"}),D.message]}),o.jsxs("div",{className:"mt-3 pt-3 border-t border-[#F0EBDF] flex items-center justify-between gap-2",children:[o.jsx("span",{className:`text-[10px] tracking-[0.14em] uppercase font-semibold px-2 py-1 rounded-sm ${D.status==="new"?"bg-[#B08A3E] text-white":D.status==="accepted"?"bg-[#3F7A4E] text-white":D.status==="declined"?"bg-[#A8443A] text-white":D.status==="countered"?"bg-[#7A6033] text-white":"bg-[#E8E8E8] text-[#333333]"}`,children:D.status}),o.jsxs("div",{className:"flex gap-1.5",children:[D.status!=="responded"&&o.jsx("button",{onClick:()=>I(D.id,"responded"),className:"text-[10px] tracking-wider uppercase px-2.5 py-1 border border-[#E8E8E8] text-[#555555] hover:border-[#202020] hover:text-[#202020] rounded-sm",children:"Responded"}),!ie&&o.jsx("button",{onClick:()=>C(S===D.id?null:D.id),className:"text-[10px] tracking-wider uppercase px-2.5 py-1 border border-[#B08A3E] text-[#B08A3E] hover:bg-[#B08A3E] hover:text-white rounded-sm",children:"Counter"}),D.status!=="accepted"&&o.jsx("button",{onClick:()=>I(D.id,"accepted"),className:"text-[10px] tracking-wider uppercase px-2.5 py-1 border border-[#3F7A4E] text-[#3F7A4E] hover:bg-[#3F7A4E] hover:text-white rounded-sm",children:"Accept"}),D.status!=="declined"&&o.jsx("button",{onClick:()=>I(D.id,"declined"),className:"text-[10px] tracking-wider uppercase px-2.5 py-1 border border-[#A8443A] text-[#A8443A] hover:bg-[#A8443A] hover:text-white rounded-sm",children:"Decline"})]})]}),S===D.id&&!ie&&o.jsxs("div",{className:"mt-3 p-3 border border-[#B08A3E]/40 bg-[#FBF8F1] rounded-sm",children:[o.jsx("div",{className:"text-[9px] tracking-[0.18em] uppercase font-semibold text-[#7A6033]",children:"Counter-offer"}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-2",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:"text-sm text-[#555555]",children:V(D.currency)}),o.jsx("input",{inputMode:"decimal",value:P[D.id]??(X>0?String(Math.round(X)):""),onChange:F=>R({...P,[D.id]:F.target.value}),placeholder:"Amount",className:"w-28 px-2 py-1.5 text-sm bg-white border border-[#E8E8E8] rounded-sm focus:outline-none focus:border-[#B08A3E]"})]}),X>0&&o.jsx("div",{className:"flex gap-1",children:[1,.95,.9].map(F=>o.jsx("button",{onClick:()=>R({...P,[D.id]:String(Math.round(X*F))}),className:"text-[10px] tracking-wider uppercase px-2 py-1 border border-[#E8E8E8] text-[#555555] hover:border-[#B08A3E] rounded-sm bg-white",children:F===1?"Valuation":`${Math.round(F*100)}%`},F))})]}),o.jsx("textarea",{rows:2,value:M[D.id]||"",onChange:F=>T({...M,[D.id]:F.target.value}),placeholder:"Optional note — what the figure includes (shipping, framing)…",className:"w-full mt-2 px-2 py-1.5 text-xs bg-white border border-[#
684E8E8E8] rounded-sm focus:outline-none focus:border-[#B08A3E] resize-none"}),o.jsx("button",{onClick:()=>U(D),disabled:_===D.id,className:"mt-2 text-[10px] tracking-[0.14em] uppercase font-semibold text-white bg-[#B08A3E] px-3 py-1.5 rounded-sm hover:brightness-105 disabled:opacity-50",children:_===D.id?"Sending…":"Send counter-offer"})]}),D.counter_amount?o.jsxs("div",{className:"mt-2 text-[11px] text-[#7A6033]",children:["Countered at"," ",o.jsx("strong",{children:$(Number(D.counter_amount),D.counter_currency||D.currency)})]}):null,o.jsxs("div",{className:"mt-3 pt-3 border-t border-[#F0EBDF]",children:[o.jsx("button",{onClick:()=>A(D.id),className:"text-[10px] tracking-[0.14em] uppercase font-semibold text-[#B08A3E] hover:underline",children:p===D.id?"Hide conversation":"Open conversation / Reply"}),p===D.id&&o.jsxs("div",{className:"mt-3 space-y-2",children:[(x[D.id]||[]).map(F=>o.jsxs("div",{className:`p-2 text-xs rounded-sm border ${F.sender_role==="owner"?"bg-[#F6F6F6] border-[#E8E8E8]":"bg-white border-[#E8E8E8]"}`,children:[o.jsxs("div",{className:"text-[9px] uppercase tracking-wider font-semibold text-[#B08A3E] mb-0.5",children:[F.sender_role==="owner"?"You":D.buyer_name," · ",new Date(F.created_at).toLocaleString()]}),o.jsx("div",{className:"whitespace-pre-wrap text-[#202020]",children:F.body})]},F.id)),o.jsxs("div",{className:"flex flex-wrap gap-1.5 mt-2",children:[o.jsx("span",{className:"text-[9px] tracking-[0.18em] uppercase text-[#555555] font-semibold self-center mr-1",children:"Quick reply"}),K(D).map(F=>o.jsx("button",{onClick:()=>y({...b,[D.id]:F.body}),className:"text-[10px] tracking-wider uppercase px-2 py-1 border border-[#E8E8E8] text-[#555555] hover:border-[#B08A3E] hover:text-[#202020] rounded-sm bg-white",children:F.label},F.label))]}),o.jsx("textarea",{rows:6,value:b[D.id]||"",onChange:F=>y({...b,[D.id]:F.target.value}),placeholder:"Type your reply…",className:"w-full mt-2 px-2 py-1.5 text-xs bg-white border border-[#E8E8E8] rounded-sm focus:outline-none focus:border-[#B08A3E] resize-none"}),o.jsx("button",{onClick:()=>O(D),disabled:_===D.id||!(b[D.id]||"").trim(),className:"text-[10px] tracking-[0.14em] uppercase font-semibold text-[#FFFFFF] bg-[#202020] px-3 py-1.5 rounded-sm hover:bg-[#333333] disabled:opacity-50",children:_===D.id?"Sending…":"Send reply"})]})]})]},D.id)})})})]})})}const mj=["new","contacted","valued","closed"];function YP({onClose:e}){const{user:t}=pn(),n=na(e),r=Cs(),[i,s]=k.useState([]),[a,l]=k.useState(!0),[c,d]=k.useState("all");k.useEffect(()=>{if(!t)return;let p=!0;return(async()=>{l(!0);const{data:h,error:x}=await Ne.from("valuation_leads").select("*").eq("kind","storefront").order("created_at",{ascending:!1}).limit(200);p&&(x&&me.error("Could not load valuation leads"),s(h||[]),l(!1))})(),()=>{p=!1}},[t]);const u=async(p,h)=>{s(g=>g.map(b=>b.id===p?{...b,status:h}:b));const{error:x}=await Ne.from("valuation_leads").update({status:h}).eq("id",p);x&&me.error("Could not update status")},f=c==="all"?i:i.filter(p=>p.status===c);return o.jsx("div",{className:"fixed inset-0 z-[1000] flex items-start justify-center overflow-y-auto overscroll-contain bg-black/50 p-4",style:r,onClick:e,children:o.jsxs("div",{ref:n,tabIndex:-1,className:"my-4 max-h-[calc(var(--embed-visible-height,100vh)-2rem)] w-full max-w-3xl overflow-y-auto rounded-lg border border-border bg-background shadow-xl sm:my-8",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"valuation-leads-title",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4 p-5 border-b border-border",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-[9px] font-body font-semibold uppercase tracking-[0.18em] text-[#B08A3E]",children:"Storefront"}),o.jsx("h2",{id:"valuation-leads-title",className:"font-display text-xl text-foreground",children:"Valuation requests"}),o.jsx("p",{className:"text-[11px] font-body text-muted-foreground mt-1",children:"Leads from product pages with no valuation on file yet."})]}),o.jsx("button",{onClick:e,className:"inline-flex h-11 w-11 shrink-0 items-center justify-center text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:o.jsx(Hr,{size:18})})]}),o.jsx("div",{className:"flex flex-wrap gap-1.5 px-5 py-3 border-b border-border",children:["all",...mj].map(p=>o.jsxs("button",{onClick:()=>d(p),className:`min-h-[44px] px-3 py-1 text-[10px] font-body font-semibold uppercase tracking-wider rounded-md border transition-colors ${c===p?"bg-foreground text-background border-foreground":"border-input text-foreground hover:bg-muted/60"}`,children:[p,p!=="all"&&o.jsx("span",{className:"ml-1 opacity-60",children:i.filter(h=>h.status===p).length})]},p))}),o.jsxs("div",{className:"p-5 space-y-3",children:[a&&o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"Loading…"}),!a&&f.length===0&&o.jsxs("div",{className:"text-center py-10 border border-dashed border-border rounded-md",children:[o.jsx("p",{className:"font-display text-lg text-foreground",children:"No valuation requests yet"}),o.jsx("p",{className:"text-[11px] font-body text-muted-foreground mt-1 max-w-sm mx-auto",children:"Once the badge snippet is live, any product without a linked valuation shows a “Request a free valuation” form and requests land here."})]}),f.map(p=>o.jsxs("div",{className:"border border-border rounded-md p-4",children:[o.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"font-body text-sm font-semibold text-foreground",children:p.lead_name}),o.jsxs("p",{className:"text-[11px] font-body text-muted-foreground flex flex-wrap items-center gap-3 mt-0.5",children:[o.jsxs("a",{href:`mailto:${p.lead_email}`,className:"inline-flex items-center gap-1 hover:text-foreground",children:[o.jsx(Qf,{size:11})," ",p.lead_email]}),p.lead_phone&&o.jsxs("span",{className:"inline-flex items-center gap-1",children:[o.jsx(e2,{size:11})," ",p.lead_phone]})]})]}),o.jsx("select",{value:p.status,onChange:h=>u(p.id,h.target.value),className:"text-[10px] font-body uppercase tracking-wider border border-input rounded-md px-2 py-1 bg-background",children:mj.map(h=>o.jsx("option",{value:h,children:h},h))})]}),o.jsxs("div",{className:"mt-3 text-[11px] font-body text-muted-foreground space-y-1",children:[(p.artwork_title||p.product_title)&&o.jsxs("p",{children:[o.jsx("span",{className:"uppercase tracking-wider text-[9px] mr-1.5",children:"Work"}),o.jsx("span",{className:"font-display italic text-foreground text-[13px]",children:p.artwork_title||p.product_title}),p.artist_name?` · ${p.artist_name}`:""]}
684),p.message&&o.jsxs("p",{className:"text-foreground/80 leading-relaxed",children:["“",p.message,"”"]}),o.jsxs("p",{className:"flex flex-wrap items-center gap-3",children:[o.jsx("span",{children:new Date(p.created_at).toLocaleString()}),p.product_handle&&p.source_host&&o.jsxs("a",{href:`https://${p.source_host}/products/${p.product_handle}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 hover:text-foreground",children:[o.jsx(wf,{size:11})," View product"]})]})]})]},p.id))]})]})})}const hJ={USD:"$",EUR:"€",GBP:"£",CAD:"C$",AUD:"A$"},fJ=(e,t)=>e?`${hJ[(t||"USD").toUpperCase()]||"$"}${Math.round(e).toLocaleString()}`:null,pJ={offer:Wo,inquiry:_f,message:pu,stale:fu},mJ=e=>{const t=Math.max(0,Math.round((Date.now()-new Date(e).getTime())/6e4));return t<60?`${t}m ago`:t<1440?`${Math.round(t/60)}h ago`:`${Math.round(t/1440)}d ago`},gJ=({onOpenOffers:e,onOpenStale:t})=>{const[n,r]=k.useState(null),[i,s]=k.useState(null),[a,l]=k.useState(!1),c=k.useCallback(async()=>{l(!0);const{data:d,error:u}=await Ne.rpc("get_owner_action_queue",{_user_id:void 0});if(l(!1),u){s(u.message),r([]);return}s(null),r(d||[])},[]);return k.useEffect(()=>{c()},[c]),i||n&&n.length===0?null:o.jsxs("div",{className:"border border-border rounded-md bg-card p-5 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("h3",{className:"flex items-center gap-2 font-display text-base font-bold tracking-wide",children:[o.jsx(_f,{size:15,className:"text-primary"})," Needs your attention",n&&o.jsx("span",{className:"text-[11px] font-body font-semibold bg-primary text-primary-foreground rounded-full px-2 py-0.5",children:n.length})]}),o.jsxs("button",{onClick:()=>void c(),disabled:a,className:"text-xs font-body px-2.5 py-1 rounded-md bg-muted text-muted-foreground hover:bg-muted/80 inline-flex items-center gap-1.5 disabled:opacity-50",children:[o.jsx(Nc,{size:11,className:a?"animate-spin":""})," Refresh"]})]}),!n&&o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"Loading…"}),n&&o.jsx("ul",{className:"divide-y divide-border",children:n.slice(0,12).map(d=>{const u=pJ[d.kind]||_f,f=fJ(d.amount,d.currency),p=d.kind==="stale"?t:e;return o.jsxs("li",{className:"py-2.5 flex items-start gap-3",children:[o.jsx(u,{size:14,className:"text-primary mt-0.5 shrink-0"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-sm font-body text-foreground truncate",children:d.title}),o.jsxs("p",{className:"text-xs font-body text-muted-foreground",children:[d.subtitle,f&&d.kind==="offer"?` · ${f}`:""," · ",mJ(d.occurred_at)]})]}),p&&o.jsx("button",{onClick:p,className:"text-[11px] font-body font-semibold px-2.5 py-1 rounded-md bg-foreground text-background hover:opacity-90 shrink-0",children:d.kind==="stale"?"Revalue":"Open"})]},`${d.kind}-${d.ref_id}-${d.occurred_at}`)})}),n&&n.length>12&&o.jsxs("p",{className:"text-xs font-body text-muted-foreground",children:["+",n.length-12," more"]})]})},gj=e=>e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60),xj={gallery_slug:"",gallery_name:"",gallery_bio:"",gallery_location:"",gallery_website:"",gallery_contact_email:"",gallery_public:!1},xJ=({onClose:e})=>{const{user:t}=pn(),[n,r]=k.useState(xj),[i,s]=k.useState(!0),[a,l]=k.useState(!1);k.useEffect(()=>{t&&(async()=>{const{data:f}=await Ne.from("profiles").select("gallery_slug, gallery_name, gallery_bio, gallery_location, gallery_website, gallery_contact_email, gallery_public").eq("user_id",t.id).maybeSingle();r(f?{gallery_slug:f.gallery_slug||"",gallery_name:f.gallery_name||"",gallery_bio:f.gallery_bio||"",gallery_location:f.gallery_location||"",gallery_website:f.gallery_website||"",gallery_contact_email:f.gallery_contact_email||t.email||"",gallery_public:!!f.gallery_public}:{...xj,gallery_contact_email:t.email||""}),s(!1)})()},[t]);const c=(f,p)=>r(h=>({...h,[f]:p})),d=n.gallery_slug?`https://reverieart.com/gallery/${n.gallery_slug}`:null,u=async()=>{if(!t)return;const f=(n.gallery_name||"").trim();if(!f){me.error("Give your gallery a public name first.");return}const p=gj(n.gallery_slug||f);if(!p){me.error("That name can't be turned into a web address — add letters or numbers.");return}l(!0);try{const{error:h}=await Ne.from("profiles").update({gallery_slug:p,gallery_name:f,gallery_bio:(n.gallery_bio||"").trim()||null,gallery_location:(n.gallery_location||"").trim()||null,gallery_website:(n.gallery_website||"").trim()||null,gallery_contact_email:(n.gallery_contact_email||"").trim()||null,gallery_public:!!n.gallery_public}).eq("user_id",t.id);if(h)throw h;c("gallery_slug",p),me.success(n.gallery_public?"Gallery page published":"Gallery profile saved (not yet public)")}catch(h){const x=h instanceof Error?h.message:"";me.error(/duplicate|unique/i.test(x)?"That web address is already taken — try another.":"Could not save your gallery profile.")}finally{l(!1)}};return i?o.jsx("div",{className:"p-6 text-sm font-body text-muted-foreground",children:"Loading gallery profile…"}):o.jsxs("div",{className:"space-y-5",children:[o.jsxs("div",{children:[o.jsxs("h3",{className:"font-display text-lg font-semibold tracking-wide flex items-center gap-2",children:[o.jsx(AC,{size:16,className:"text-primary"})," Public gallery page"]}),o.jsx("p",{className:"text-xs font-body text-muted-foreground mt-1 leading-relaxed",children:"Publish a landing page at reverieart.com listing every work you've enabled public valuation for. Collectors can search your inventory, see appraised values, and contact you directly."})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsx(fd,{label:"Gallery name",children:o.jsx("input",{value:n.gallery_name||"",onChange:f=>c("gallery_name",f.target.value),className:"w-full px-2.5 py-2 text-xs font-body border border-input rounded-md bg-background focus:outline-none focus:border-primary",maxLength:120,placeholder:"Reverie Fine Art Collective"})}),o.jsx(fd,{label:"Web address",children:o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:"text-[11px] font-body text-muted-foreground whitespace-nowrap",children:"/gallery/"}),o.jsx("input",{value:n.gallery_slug||"",onChange:f=>c("gallery_slug",f.target.value),onBlur:f=>c("gallery_slug",gj(f.target.value)),className:"w-full px-2.5 py-2 text-xs font-body border border-input rounded-md bg-background focus:outline-none focus:border-primary",maxLength:60,placeholder:"reverie-fine-art"})]})}),o.jsx(fd,{label:"Location",children:o.jsx("input",{value:n.gallery_location||"",onChange:f=>c("gallery_location",f.target.value),className:"w-full px-2.5 py-2 text-xs font-body border border-input rounded-md bg-background focus:outline-none focus:border-primary",maxLength:120,placeholder:"New York, NY"})}),o.jsx(fd,{label:"Contact email",children:o.jsx("input",{value:n.gallery_contact_email||"",onChange:f=>c("gallery_contact_email",f.target.value),className:"w-full px-2.5 py-2 text-xs font-body border border-input rounded-md bg-background focus:outline-none focus:border-primary",type:"email",maxLength:200})}),o.jsx(fd,{label:"Website",children:o.jsx("input",{value:n.gallery_website||"",onChange:f=>c("gallery_website",f.target.value),className:"w-full px-2.5 py-2 text-xs font-body border border-input rounded-md bg-background focus:outline-none focus:border-primary",maxLength:300,placeholder:"https://reverieart.com"})})]}),o.jsx(fd,{label:"Short story / bio",children:o.jsx("textarea",{value:n.gallery_bio||"",onChange:f=>c("gallery_bio",f.target.value),className:"w-full px-2.5 py-2 text-xs font-body border border-input rounded-md bg-background focus:outline-none focus:border-primary min-h-[90px] resize-y",maxLength:1200,placeholder:"What the gallery collects, how works are sourced, and how valuations are documented."})}),o.jsxs("label",{className:"flex items-start gap-2.5 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:!!n.gallery_public,onChange:f=>c("gallery_public",f.target.checked),className:"mt-0.5 w-4 h-4 accent-primary"}),o.jsxs("span",{className:"text-xs font-body text-foreground leading-relaxed",children:[o.jsx("strong",{className:"font-semibold",children:"Publish this page."})," When off, the page stays private and returns nothing publicly."]})]}),d&&o.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/40 px-3 py-2.5",children:[o.jsx("code",{className:"text-[11px] font-body text-foreground truncate flex-1",children:d}),o.jsx("button",{onClick:()=>{navigator.clipboard.writeText(d),me.success("Link copied")},className:"text-muted-foreground hover:text-foreground",title:"Copy link",children:o.jsx(yf,{size:13})}),o.jsx("a",{href:`/gallery/${n.gallery_slug}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground",title:"Open page",children:o.jsx(wf,{size:13})})]}),o.jsxs("div",{className:"flex gap-2 justify-end",children:[e&&o.jsx("button",{onClick:e,className:"px-4 py-2 text-[10px] font-semibold font-body uppercase tracking-wider border border-input rounded-md hover:bg-muted/60",children:"Close"}),o.jsx("button",{onClick:u,disabled:a,className:"px-4 py-2 text-[10px] font-semibold font-body uppercase tracking-wider bg-primary text-primary-foreground rounded-md hover:opacity-90 disabled:opacity-50",children:a?"Saving…":"Save profile"})]})]})},fd=({label:e,children:t})=>o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"block text-[10px] font-semibold font-body uppercase tracking-wider text-muted-foreground mb-1.5",children:e}),t]}),R1={USD:1,EUR:1.08,GBP:1.27,CAD:.73,AUD:.66,CHF:1.13,JPY:.0064,HKD:.128,SGD:.74,AED:.272},vJ={USD:"$",EUR:"€",GBP:"£",CAD:"C$",AUD:"A$",CHF:"CHF ",JPY:"¥",HKD:"HK$",SGD:"S$",AED:"AED "},vj=(e,t)=>`${vJ[t]||""}
684${Math.round(e).toLocaleString()}`,bJ=(e,t,n)=>e*(R1[t]||1)/(R1[n]||1),Nr=e=>{if(e.ai_value&&e.ai_value>0)return Number(e.ai_value);if(e.formula_value&&e.formula_value>0)return Number(e.formula_value);const t=Number(e.base_value||0),n=Number(e.scarcity_multiplier||0),r=Number(e.provenance_uplift||0);return t+t*(n/100)+t*(r/100)},_h=e=>e?Math.floor((Date.now()-new Date(e).getTime())/(1e3*60*60*24)):null,bj=e=>{const t=e==null?"":String(e);return/[",\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t},yJ=(e,t,n,r)=>{const s=[["Artist","Title","Year","Medium","Dimensions","Condition","Edition","Native Currency","Native Value",`Value (${n})`,"Collectors","Last Valued","Created"].map(bj).join(",")];e.forEach(d=>{const u=Nr(d),f=r(u,d.currency);s.push([d.artist_name||"",d.artwork_title||"","",d.medium||"","","","",d.currency||"USD",u>0?Math.round(u):"",f>0?Math.round(f):"",t.get(d.id)||0,d.last_valued_at?new Date(d.last_valued_at).toISOString().slice(0,10):"",new Date(d.created_at).toISOString().slice(0,10)].map(bj).join(","))});const a=new Blob([s.join(`
685`)],{type:"text/csv;charset=utf-8;"}),l=URL.createObjectURL(a),c=document.createElement("a");c.href=l,c.download=`portfolio-${new Date().toISOString().slice(0,10)}.csv`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(l)},wJ=({onClose:e,onOpenSubmission:t})=>{const{user:n}=pn(),r=Cs(),[i,s]=k.useState([]),[a,l]=k.useState(new Map),[c,d]=k.useState(new Map),[u,f]=k.useState(!0),[p,h]=k.useState("value"),[x,g]=k.useState(""),[b,y]=k.useState("all"),[_,w]=k.useState(null),[S,C]=k.useState("USD"),[P,R]=k.useState(!1),[M,T]=k.useState(!1),[H,A]=k.useState(!1),[O,K]=k.useState(0),[U,I]=k.useState(!1),[re,V]=k.useState(0),[$,D]=k.useState(null),[ie,X]=k.useState(new Set),[E,q]=k.useState(null),[F,Z]=k.useState(""),Y=be=>X(se=>{const Q=new Set(se);return Q.has(be)?Q.delete(be):Q.add(be),Q});k.useEffect(()=>{n&&(async()=>{const{count:be}=await Ne.from("offers").select("id",{count:"exact",head:!0}).eq("user_id",n.id).eq("status","new");K(be||0)})()},[n,H]),k.useEffect(()=>{n&&(async()=>{const{count:be}=await Ne.from("valuation_leads").select("id",{count:"exact",head:!0}).eq("assigned_user_id",n.id).eq("status","new");V(be||0)})()},[n,U]);const ee=async(be,se)=>{be.stopPropagation();const Q=Math.round(Nr(se));if(Q<=0){me.error("Run a valuation first before listing on Shopify.");return}const he=window.prompt(`Recommended price: $${Q.toLocaleString()}
686
687Enter list price (USD) for "${se.artwork_title||"Untitled"}":`,String(Q));if(he===null)return;const ve=parseFloat(he.replace(/[^0-9.]/g,""));if(!Number.isFinite(ve)||ve<=0){me.error("Enter a valid positive price");return}D(se.id);try{const{data:we,error:Le}=await Ne.functions.invoke("create-shopify-product",{body:{artistName:se.artist_name,artworkTitle:se.artwork_title,medium:se.medium,totalValue:Q,listPrice:ve,image:se.image_url,submissionId:se.id}});if(Le)throw Le;if(!(we!=null&&we.success))throw new Error((we==null?void 0:we.error)||"Failed to create product");me.success(`Listed: ${we.product.title}`),s(Fe=>Fe.map(Ve=>Ve.id===se.id?{...Ve,shopify_product_id:String(we.product.id),shopify_product_handle:we.product.handle,status:"listed"}:Ve))}catch(we){me.error(we.message||"Failed to list on Shopify")}finally{D(null)}},ce=be=>vj(be,S),ue=(be,se)=>bJ(be,se||"USD",S);k.useEffect(()=>{n&&(async()=>{f(!0);const{data:be,error:se}=await Ne.from("submissions").select("id,artist_name,artwork_title,medium,formula_value,ai_value,base_value,scarcity_multiplier,provenance_uplift,last_valued_at,created_at,image_url,currency,shopify_product_id,shopify_product_handle,public_valuation_enabled,status").eq("user_id",n.id).order("created_at",{ascending:!1}).limit(500);se||s(be||[]);const{data:Q}=await Ne.from("collector_submissions").select("submission_id").eq("user_id",n.id);if(Q){const ve=new Map;Q.forEach(we=>ve.set(we.submission_id,(ve.get(we.submission_id)||0)+1)),d(ve)}const{data:he}=await Ne.from("valuation_history").select("submission_id,method,value,created_at").eq("user_id",n.id).order("created_at",{ascending:!0}).limit(2e3);if(he){const ve=new Map,we={};he.forEach(Le=>{const Fe=Le.submission_id;we[Fe]||(we[Fe]={ai:[],formula:[]}),Le.method==="ai"?we[Fe].ai.push(Number(Le.value)):we[Fe].formula.push(Number(Le.value))}),Object.entries(we).forEach(([Le,Fe])=>{ve.set(Le,Fe.ai.length>0?Fe.ai:Fe.formula)}),l(ve)}f(!1)})()},[n]);const ye=k.useMemo(()=>{const be=Fe=>ue(Nr(Fe),Fe.currency),se=i.filter(Fe=>Nr(Fe)>0),Q=se.reduce((Fe,Ve)=>Fe+be(Ve),0),he=se.length?Q/se.length:0,ve=new Map;se.forEach(Fe=>{const Ve=Fe.artist_name||"Unknown",He=ve.get(Ve)||{count:0,value:0};He.count+=1,He.value+=be(Fe),ve.set(Ve,He)});const we=Array.from(ve.entries()).map(([Fe,Ve])=>({name:Fe,...Ve})).sort((Fe,Ve)=>Ve.value-Fe.value),Le=i.filter(Fe=>{const Ve=_h(Fe.last_valued_at);return Nr(Fe)>0&&(Ve===null||Ve>90)});return{total:Q,avg:he,count:se.length,totalEntries:i.length,artists:we,stale:Le}},[i,S]),Se=k.useMemo(()=>({hasEntry:i.length>0,hasValuation:i.some(be=>Nr(be)>0),hasListing:i.some(be=>!!be.shopify_product_id),hasBadge:i.some(be=>!!be.public_valuation_enabled),hasCollector:c.size>0}),[i,c]),De=async()=>{const be=Array.from(ie);if(be.length!==0){if(be.length>25){me.error("Re-value at most 25 works at a time");return}q("revalue"),Z(`Re-valuing ${be.length} ${be.length===1?"work":"works"}…`);try{const{data:se,error:Q}=await Ne.functions.invoke("bulk-revalue",{body:{submission_ids:be}});if(Q)throw Q;if(se!=null&&se.error)throw new Error(se.error);const he=new Map((se.results||[]).filter(we=>we.ok).map(we=>[we.id,we.value])),ve=new Date().toISOString();s(we=>we.map(Le=>he.has(Le.id)?{...Le,ai_value:he.get(Le.id),last_valued_at:ve}:Le)),me.success(`Re-valued ${se.updated} ${se.updated===1?"work":"works"}${se.failed?` · ${se.failed} failed`:""}`),X(new Set)}catch(se){me.error((se==null?void 0:se.message)||"Bulk re-valuation failed")}finally{q(null),Z("")}}},Re=k.useMemo(()=>{const be=i.filter(se=>Nr(se)>0);return{valued:be.length,published:be.filter(se=>se.public_valuation_enabled).length,linked:be.filter(se=>!!se.shopify_product_handle).length}},[i]),qe=async()=>{const be=Oe.filter(he=>ie.has(he.id)&&Nr(he)>0&&!he.public_valuation_enabled);if(be.length===0){me.error("Select valued works that are not published yet");return}q("publish"),Z(`Publishing ${be.length}…`);const se=be.map(he=>he.id),{error:Q}=await Ne.from("submissions").update({public_valuation_enabled:!0}).in("id",se);Q?me.error(Q.message||"Could not publish those works"):(s(he=>he.map(ve=>
687se.includes(ve.id)?{...ve,public_valuation_enabled:!0}:ve)),me.success(`${se.length} ${se.length===1?"work is":"works are"} now visible on the storefront`),X(new Set)),q(null),Z("")},te=async()=>{const be=Oe.filter(Q=>ie.has(Q.id)&&!Q.shopify_product_id&&Nr(Q)>0);if(be.length===0){me.error("Select valued works that are not listed yet");return}q("list");let se=0;for(let Q=0;Q<be.length;Q++){const he=be[Q];Z(`Listing ${Q+1} of ${be.length}…`);const ve=Math.round(Nr(he));try{const{data:we,error:Le}=await Ne.functions.invoke("create-shopify-product",{body:{artistName:he.artist_name,artworkTitle:he.artwork_title,medium:he.medium,totalValue:ve,listPrice:ve,image:he.image_url,submissionId:he.id}});if(Le||!(we!=null&&we.success))throw new Error((we==null?void 0:we.error)||"Failed");se+=1,s(Fe=>Fe.map(Ve=>Ve.id===he.id?{...Ve,shopify_product_id:String(we.product.id),shopify_product_handle:we.product.handle,status:"listed"}:Ve))}catch{}}me[se===be.length?"success":"message"](`Listed ${se} of ${be.length} at their recommended price`),X(new Set),q(null),Z("")},Oe=k.useMemo(()=>{const be=x.trim().toLowerCase();let se=[...i];return be&&(se=se.filter(Q=>[Q.artist_name,Q.artwork_title,Q.medium,Q.status].filter(Boolean).some(he=>String(he).toLowerCase().includes(be)))),b==="unpublished"?se=se.filter(Q=>!Q.public_valuation_enabled):b==="unlisted"?se=se.filter(Q=>!Q.shopify_product_id):b==="stale"?se=se.filter(Q=>Nr(Q)>0&&(_h(Q.last_valued_at)??9999)>90):b==="unvalued"&&(se=se.filter(Q=>Nr(Q)<=0)),p==="value"?se.sort((Q,he)=>Nr(he)-Nr(Q)):p==="recent"?se.sort((Q,he)=>new Date(he.created_at).getTime()-new Date(Q.created_at).getTime()):p==="stale"&&se.sort((Q,he)=>{const ve=_h(Q.last_valued_at)??9999;return(_h(he.last_valued_at)??9999)-ve}),se},[i,p,x,b]);return o.jsxs("div",{className:"fixed inset-0 z-[1000] flex items-start justify-center overflow-y-auto overscroll-contain bg-black/60 p-4",style:r,onClick:e,children:[o.jsxs("div",{className:"relative my-4 max-h-[calc(var(--embed-visible-height,100vh)-2rem)] w-full max-w-5xl overflow-y-auto rounded-lg bg-background shadow-2xl sm:my-8",onClick:be=>be.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"portfolio-dashboard-title",children:[o.jsx("button",{onClick:e,className:"absolute right-2 top-2 inline-flex h-11 w-11 items-center justify-center text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:o.jsx(Hr,{size:20})}),o.jsxs("div",{className:"p-7 border-b border-border flex items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h2",{id:"portfolio-dashboard-title",className:"font-display text-2xl font-bold tracking-wide",children:"Portfolio Dashboard"}),o.jsx("p",{className:"text-xs font-body text-muted-foreground mt-1 tracking-wide",children:"A rolled-up view of every saved entry — total value, artist concentration, and stale valuations."})]}),o.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[o.jsxs("button",{onClick:()=>yJ(ie.size>0?Oe.filter(be=>ie.has(be.id)):Oe,c,S,ue),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-body font-semibold uppercase tracking-wider text-foreground border border-input rounded-md hover:bg-muted/60 transition-colors",title:"Download all entries as CSV",children:[o.jsx(Ho,{size:12})," CSV",ie.size>0?` (${ie.size})`:""]}),o.jsxs("button",{onClick:()=>R(!0),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-body font-semibold uppercase tracking-wider text-foreground border border-input rounded-md hover:bg-muted/60 transition-colors",title:"Manage live valuation badges on your Shopify storefront",children:[o.jsx(Sv,{size:12})," Shopify Badges"]}),o.jsxs("button",{onClick:()=>T(!0),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-body font-semibold uppercase tracking-wider text-foreground border border-input rounded-md hover:bg-muted/60 transition-colors",title:"Publish a public gallery landing page",children:[o.jsx(AC,{size:12})," Gallery Page"]}),o.jsxs("button",{onClick:()=>A(!0),className:"relative inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-body font-semibold uppercase tracking-wider text-foreground border border-input rounded-md hover:bg-muted/60 transition-colors",title:"View offers received from Shopify badge",children:[o.jsx(_f,{size:12})," Offers",O>0&&o.jsx("span",{className:"ml-1 inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full bg-[#B08A3E] text-white text-[10px] font-bold",children:O})]}),o.jsxs("button",{onClick:()=>I(!0),className:"relative inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-body font-semibold uppercase tracking-wider text-foreground border border-input rounded-md hover:bg-muted/60 transition-colors",title:"Valuation requests from products with no valuation yet",children:[o.jsx(_f,{size:12})," Valuation Requests",re>0&&o.jsx("span",{className:"ml-1 inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full bg-[#B08A3E] text-white text-[10px] font-bold",children:re})]}),o.jsxs("button",{onClick:async()=>{const be=Oe.filter(se=>Nr(se)>0);if(be.length===0){me.error("Run a valuation on at least one entry first");return}me.info("Generating insurance schedule…");try{await aJ(be)}catch(se){me.error((se==null?void 0:se.message)||"Failed to generate PDF")}},className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-body font-semibold uppercase tracking-wider text-foreground border border-input rounded-md hover:bg-muted/60 transition-colors",title:"Download insurance schedule PDF",children:[o.jsx(q0,{size:12})," Insurance PDF"]}),o.jsx("label",{className:"text-[10px] font-semibold font-body uppercase tracking-wider text-muted-foreground",children:"Display in"}),o.jsx("select",{value:S,onChange:be=>C(be.target.value),className:"px-2 py-1.5 text-xs font-body border border-input rounded-md bg-background",children:Object.keys(R1).map(be=>o.jsx("option",{value:be,children:be},be))})]})]}),u?o.jsx("div",{className:"p-12 text-center text-sm font-body text-muted-foreground",children:"Loading portfolio…"}):i.length===0?o.jsx(dj,{variant:"empty",state:Se,onAddWork:e,onOpenBadges:()=>R(!0)}):o.jsxs("div",{className:"p-7 space-y-7",children:[o.jsx(dj,{state:Se,onAddWork:e,onOpenBadges:()=>R(!0)}),o.jsx(gJ,{onOpenOffers:()=>A(!0),onOpenStale:e}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[o.jsx($m,{label:"Total Portfolio Value",value:ce(ye.total)}),o.jsx($m,{label:"Entries Valued",value:`${ye.count} / ${ye.totalEntries}`}),o.jsx($m,{label:"Avg. Value",value:ce(ye.avg)}),o.jsx($m,{label:"Stale (>90 days)",value:`${ye.stale.length}`,accent:ye.stale.length>0})]}),ye.artists.length>0&&o.jsxs("section",{children:[o.jsx("h3",{className:"font-display text-base font-semibold tracking-wide mb-3",children:"Value by Artist"}),o.jsx("div",{className:"space-y-2",children:ye.artists.slice(0,8).map(be=>{const se=ye.total>0?be.value/ye.total*100:0;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-baseline justify-between text-xs font-body",children:[o.jsx("span",{className:"font-semibold text-foreground truncate pr-3",children:be.name}),o.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[ce(be.value)," · ",se.toFixed(0),"% · ",be.count," ",be.count===1?"piece":"pieces"]})]}),o.jsx("div",{className:"h-1.5 bg-muted rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary rounded-full",style:{width:`${Math.max(2,
687se)}%`}})})]},be.name)})})]}),ye.stale.length>0&&o.jsxs("section",{className:"rounded-md border border-border bg-muted/40 p-4",children:[o.jsxs("h3",{className:"font-display text-sm font-semibold tracking-wide",children:[ye.stale.length," ",ye.stale.length===1?"entry":"entries"," need re-valuation"]}),o.jsx("p",{className:"text-xs font-body text-muted-foreground mt-1",children:"Markets shift. Open any entry below and run a fresh valuation to update its band."})]}),o.jsxs("section",{children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-3",children:[o.jsxs("h3",{className:"font-display text-base font-semibold tracking-wide",children:["All Entries",o.jsxs("span",{className:"ml-2 text-[11px] font-body font-normal text-muted-foreground",children:[Oe.length," of ",i.length]})]}),o.jsx("div",{className:"flex gap-1 text-[10px] font-body uppercase tracking-wider",children:["value","recent","stale"].map(be=>o.jsx("button",{onClick:()=>h(be),className:`px-2.5 py-1 rounded-md border transition-colors ${p===be?"border-primary bg-primary text-primary-foreground":"border-input text-muted-foreground hover:bg-muted/60"}`,children:be==="value"?"By Value":be==="recent"?"Recent":"Stale First"},be))})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-3",children:[o.jsxs("div",{className:"relative flex-1 min-w-[180px]",children:[o.jsx(U7,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),o.jsx("input",{value:x,onChange:be=>g(be.target.value),placeholder:"Search artist, title, medium…","aria-label":"Search entries",className:"w-full pl-8 pr-3 py-1.5 text-xs font-body border border-input rounded-md bg-background"})]}),o.jsx("div",{className:"flex flex-wrap gap-1 text-[10px] font-body uppercase tracking-wider",children:[["all","All"],["unpublished","Unpublished"],["unlisted","Not on Shopify"],["stale","Stale"],["unvalued","Unvalued"]].map(([be,se])=>o.jsx("button",{onClick:()=>y(be),className:`px-2.5 py-1 rounded-md border transition-colors ${b===be?"border-primary bg-primary text-primary-foreground":"border-input text-muted-foreground hover:bg-muted/60"}`,children:se},be))})]}),Re.valued>0&&Re.published<Re.valued&&o.jsxs("div",{className:"mb-3 rounded-md border border-border bg-muted/40 p-3 flex flex-wrap items-center gap-x-3 gap-y-1",children:[o.jsx(Qg,{size:13,className:"text-muted-foreground"}),o.jsxs("span",{className:"text-xs font-body text-foreground",children:[o.jsx("strong",{children:Re.published})," of ",Re.valued," valued"," ",Re.valued===1?"work is":"works are"," visible on the storefront",Re.linked>0&&` · ${Re.linked} linked to a Shopify product`]}),o.jsx("span",{className:"text-[11px] font-body text-muted-foreground",children:"Select works below, then “Publish to storefront” — the badge, provenance timeline and feeds only show published works."})]}),ie.size>0&&o.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2 rounded-md border border-primary/40 bg-primary/5 p-3",children:[o.jsxs("span",{className:"text-xs font-body font-semibold text-foreground",children:[ie.size," selected"]}),o.jsxs("button",{onClick:De,disabled:E!==null,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-body font-semibold uppercase tracking-wider rounded-md bg-primary text-primary-foreground disabled:opacity-50",children:[o.jsx(Nc,{size:12,className:E==="revalue"?"animate-spin":""})," Re-value"]}),o.jsxs("button",{onClick:te,disabled:E!==null,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-body font-semibold uppercase tracking-wider rounded-md border border-input hover:bg-muted/60 disabled:opacity-50",children:[o.jsx(Sv,{size:12})," List on Shopify"]}),o.jsxs("button",{onClick:qe,disabled:E!==null,className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-body font-semibold uppercase tracking-wider rounded-md border border-input hover:bg-muted/60 disabled:opacity-50",children:[o.jsx(Qg,{size:12})," Publish to storefront"]}),o.jsx("button",{onClick:()=>X(new Set),className:"text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground hover:text-foreground",children:"Clear"}),F&&o.jsx("span",{className:"text-[11px] font-body text-muted-foreground",children:F})]}),o.jsx("div",{className:"border border-border rounded-md overflow-x-auto",children:o.jsxs("table",{className:"w-full min-w-[720px] text-xs font-body",children:[o.jsx("thead",{className:"bg-muted/60",children:o.jsxs("tr",{className:"text-left text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[o.jsx("th",{className:"py-2 pl-3 pr-1 w-8",children:o.jsx("input",{type:"checkbox","aria-label":"Select all entries",checked:ie.size>0&&ie.size===Oe.length,onChange:be=>X(be.target.checked?new Set(Oe.map(se=>se.id)):new Set),className:"h-3.5 w-3.5 rounded border-input accent-primary curs
687or-pointer"})}),o.jsx("th",{className:"py-2 px-3",children:"Artist / Title"}),o.jsx("th",{className:"py-2 px-3",children:"Medium"}),o.jsx("th",{className:"py-2 px-3 text-right",children:"Value"}),o.jsx("th",{className:"py-2 px-3",children:"Trend"}),o.jsx("th",{className:"py-2 px-3 text-center",children:"Collectors"}),o.jsx("th",{className:"py-2 px-3 text-right",children:"Last Valued"}),o.jsx("th",{className:"py-2 px-3 text-right",children:"Shopify"})]})}),o.jsx("tbody",{children:Oe.map(be=>{const se=_h(be.last_valued_at),Q=Nr(be)>0&&(se===null||se>90),he=a.get(be.id)??[],ve=c.get(be.id)||0,we=Nr(be),Le=ue(we,be.currency),Fe=(be.currency||"USD")!==S&&we>0;return o.jsxs("tr",{className:"border-t border-border hover:bg-muted/40 cursor-pointer",onClick:()=>t==null?void 0:t(be.id),children:[o.jsx("td",{className:"py-2 pl-3 pr-1",onClick:Ve=>Ve.stopPropagation(),children:o.jsx("input",{type:"checkbox","aria-label":`Select ${be.artwork_title||be.artist_name||"entry"}`,checked:ie.has(be.id),onChange:()=>Y(be.id),className:"h-3.5 w-3.5 rounded border-input accent-primary cursor-pointer"})}),o.jsxs("td",{className:"py-2 px-3",children:[o.jsx("div",{className:"font-semibold text-foreground truncate",children:be.artist_name||"Unknown"}),be.artwork_title&&o.jsx("div",{className:"text-muted-foreground italic truncate",children:be.artwork_title})]}),o.jsx("td",{className:"py-2 px-3 text-muted-foreground truncate",children:be.medium||"—"}),o.jsx("td",{className:"py-2 px-3 text-right tabular-nums",children:we>0?o.jsxs(o.Fragment,{children:[ce(Le),Fe&&o.jsx("div",{className:"text-[10px] text-muted-foreground",children:vj(we,be.currency||"USD")})]}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"py-2 px-3",onClick:Ve=>Ve.stopPropagation(),children:o.jsxs("button",{onClick:()=>w(be.id),title:"Open valuation dossier","aria-label":`Valuation dossier for ${be.artwork_title||be.artist_name||"entry"}`,className:"inline-flex items-center gap-1.5 rounded-md px-1.5 py-1 hover:bg-muted/60",children:[o.jsx(WP,{values:he}),o.jsx(S7,{size:11,className:"text-muted-foreground"})]})}),o.jsx("td",{className:"py-2 px-3 text-center",children:ve>0?o.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-primary",children:[o.jsx(n2,{size:10})," ",ve]}):o.jsx("span",{className:"text-muted-foreground",children:"—"})}),o.jsx("td",{className:"py-2 px-3 text-right text-muted-foreground tabular-nums",children:se===null?"Never":o.jsxs("span",{className:Q?"text-foreground font-semibold":"",children:[se,"d ago"]})}),o.jsx("td",{className:"py-2 px-3 text-right",children:be.shopify_product_id?o.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-primary",children:[o.jsx(Sv,{size:10})," Listed"]}):o.jsx("button",{onClick:Ve=>ee(Ve,be),disabled:$===be.id,className:"text-[10px] font-body font-semibold uppercase tracking-wider px-2 py-1 rounded-md border border-input hover:bg-muted/60 disabled:opacity-50",children:$===be.id?"Listing…":"List"})})]},be.id)})})]})})]})]})]}),P&&o.jsx(GP,{onClose:()=>R(!1)}),_&&o.jsx(sJ,{submissionId:_,onClose:()=>w(null)}),H&&o.jsx(uJ,{onClose:()=>A(!1)}),U&&o.jsx(YP,{onClose:()=>I(!1)}),M&&o.jsx("div",{className:"fixed inset-0 z-[1002] flex items-start justify-center overflow-y-auto overscroll-contain bg-black/40 p-4",children:o.jsx("div",{className:"mt-4 max-h-[calc(100vh-2rem)] w-full max-w-2xl overflow-y-auto rounded-lg border border-border bg-card p-5 shadow-xl sm:mt-10 sm:p-6",role:"dialog","aria-modal":"true","aria-label":"Gallery profile",children:o.jsx(xJ,{onClose:()=>T(!1)})})})]})},$m=({label:e,value:t,accent:n})=>o.jsxs("div",{className:`rounded-md border p-4 ${n?"border-primary/50 bg-primary/5":"border-border bg-card"}`,children:[o.jsx("div",{className:"text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground",children:e}),o.jsx("div",{className:"font-display text-xl font-bold tracking-wide mt-1",children:t})]}),_J=[{key:"pending",label:"Pending",Icon:fu},{key:"approved",label:"Approved",Icon:uo},{key:"declined",label:"Declined",Icon:EC}];function kJ({onClose:e}){const t=Cs(),[n,r]=k.useState([]),[i,s]=k.useState(!0),[a,l]=k.useState(null),[c,d]=k.useState("pending"),[u,f]=k.useState({}),[p,h]=k.useState(null);k.useEffect(()=>{const w=S=>{S.key==="Escape"&&e()};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[e]);const x=k.useCallback(async()=>{s(!0),l(null);const{data:w,error:S}=await Ne.from("valuation_leads").select("*").eq("kind","specialist_review").order("created_at",{ascending:!1}).limit(300);S&&l("Could not load review requests."),r(w||[]),s(!1)},[]);k.useEffect(()=>{x()},[x]);const g=async(w,S)=>{var T;h(w);const C=(u[w]||"").trim()||null,{data:P}=await Ne.auth.getSession(),{error:R}=await Ne.from("valuation_leads").update({decision:S,staff_note:C,decided_at:new Date().toISOString(),decided_by:((T=P.session)==null?void 0:T.user.id)??null,status:S==="approved"?"contacted":"closed"}).eq("id",w);if(h(null),R){me.error("Could not save that decision.");return}r(H=>H.map(A=>A.id===w?{...A,decision:S,staff_note:C,decided_at:new Date().toISOString()}:A));const M=n.find(H=>H.id===w);M!=null&&M.lead_email&&Ne.functions.invoke("send-transactional-email",{body:{templateName:"specialist-review-decision",recipientEmail:M.lead_email,idempotencyKey:`review-decision-${w}-${S}`,templateData:{artistName:M.artist_name||void 0,artworkTitle:M.artwork_title||void 0,decision:S,note:C||void 0}}}),me.success(S==="approved"?"Request approved":"Request declined")},b=async w=>{h(w);const{error:S}=await Ne.from("valuation_leads").update({decision:"pending",decided_at:null,decided_by:null,
687status:"new"}).eq("id",w);if(h(null),S){me.error("Could not reopen that request.");return}r(C=>C.map(P=>P.id===w?{...P,decision:"pending",decided_at:null}:P))},y=n.filter(w=>w.decision===c),_=w=>n.filter(S=>S.decision===w).length;return o.jsx("div",{className:"fixed inset-0 z-[1000] flex items-start justify-center overflow-y-auto overscroll-contain bg-black/50 p-4",style:t,onClick:e,role:"presentation",children:o.jsxs("div",{className:"my-4 max-h-[calc(var(--embed-visible-height,100vh)-2rem)] w-full max-w-3xl overflow-y-auto rounded-lg border border-border bg-background shadow-xl sm:my-8",onClick:w=>w.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"review-queue-title",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-border p-5",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-body text-[10px] font-semibold uppercase tracking-[0.22em] text-accent",children:"Internal"}),o.jsx("h2",{id:"review-queue-title",className:"font-display text-xl font-semibold tracking-tight",children:"Specialist review requests"}),o.jsx("p",{className:"mt-1 font-body text-[11px] text-muted-foreground",children:"Collectors asking a Reverie specialist to look at a work. Approve to take it on, or decline."})]}),o.jsx("button",{type:"button",onClick:e,className:"inline-flex h-11 w-11 shrink-0 items-center justify-center text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:o.jsx(Hr,{size:18})})]}),o.jsx("div",{className:"flex flex-wrap gap-1.5 border-b border-border px-5 py-3",children:_J.map(({key:w,label:S,Icon:C})=>o.jsxs("button",{type:"button",onClick:()=>d(w),"aria-pressed":c===w,className:`inline-flex min-h-[44px] items-center gap-1.5 rounded-md border px-3 py-1 font-body text-[10px] font-semibold uppercase tracking-wider transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${c===w?"border-foreground bg-foreground text-background":"border-input text-foreground hover:bg-muted/60"}`,children:[o.jsx(C,{size:11,"aria-hidden":"true"}),S,o.jsx("span",{className:"opacity-60",children:_(w)})]},w))}),o.jsxs("div",{className:"space-y-3 p-5",children:[i&&o.jsx("p",{className:"font-body text-xs text-muted-foreground",children:"Loading requests…"}),!i&&a&&o.jsxs("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 p-4",children:[o.jsx("p",{className:"font-body text-xs text-foreground",children:a}),o.jsx("button",{type:"button",onClick:()=>void x(),className:"mt-2 font-body text-xs font-semibold underline underline-offset-2",children:"Try again"})]}),!i&&!a&&y.length===0&&o.jsxs("div",{className:"rounded-md border border-dashed border-border py-10 text-center",children:[o.jsx("p",{className:"font-display text-lg font-semibold tracking-tight",children:c==="pending"?"Nothing waiting on you":`No ${c} requests`}),o.jsx("p",{className:"mx-auto mt-1 max-w-sm font-body text-[11px] text-muted-foreground",children:"Requests appear here when a collector chooses “Request Reverie specialist review” after an estimate."})]}),!i&&y.map(w=>o.jsxs("div",{className:"rounded-md border border-border p-4",children:[o.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"font-body text-sm font-semibold text-foreground",children:w.lead_name}),o.jsxs("p",{className:"mt-0.5 flex flex-wrap items-center gap-3 font-body text-[11px] text-muted-foreground",children:[o.jsxs("a",{href:`mailto:${w.lead_email}`,className:"inline-flex items-center gap-1 hover:text-foreground",children:[o.jsx(Qf,{size:11,"aria-hidden":"true"})," ",w.lead_email]}),w.lead_phone&&o.jsxs("span",{className:"inline-flex items-center gap-1",children:[o.jsx(e2,{size:11,"aria-hidden":"true"})," ",w.lead_phone]})]})]}),o.jsx("span",{className:"font-body text-[10px] uppercase tracking-wider text-muted-foreground",children:new Date(w.created_at).toLocaleDateString()})]}),o.jsxs("div",{className:"mt-3 space-y-1 font-body text-[11px] text-muted-foreground",children:[(w.artwork_title||w.artist_name)&&o.jsxs("p",{children:[o.jsx("span",{className:"mr-1.5 text-[9px] uppercase tracking-wider",children:"Work"}),o.jsx("span",{className:"font-display text-[13px] italic text-foreground",children:w.artwork_title||"Untitled"}),w.artist_name?` · ${w.artist_name}`:""]}),w.message&&o.jsxs("p",{className:"leading-relaxed text-foreground
687/80",children:["“",w.message,"”"]}),w.staff_note&&o.jsxs("p",{className:"leading-relaxed",children:[o.jsx("span",{className:"mr-1.5 text-[9px] uppercase tracking-wider",children:"Internal note"}),w.staff_note]})]}),w.decision==="pending"?o.jsxs("div",{className:"mt-3 space-y-2",children:[o.jsx("label",{htmlFor:`note-${w.id}`,className:"sr-only",children:"Internal note"}),o.jsx("input",{id:`note-${w.id}`,type:"text",value:u[w.id]||"",onChange:S=>f(C=>({...C,[w.id]:S.target.value})),placeholder:"Internal note (optional)",className:"min-h-[44px] w-full rounded-md border border-input bg-background px-3 font-body text-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1"}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsxs("button",{type:"button",onClick:()=>void g(w.id,"approved"),disabled:p===w.id,className:"inline-flex min-h-[44px] items-center gap-1.5 rounded-md bg-primary px-4 font-body text-xs font-semibold text-primary-foreground transition-all hover:brightness-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50",children:[o.jsx(uo,{size:13,"aria-hidden":"true"})," Approve"]}),o.jsxs("button",{type:"button",onClick:()=>void g(w.id,"declined"),disabled:p===w.id,className:"inline-flex min-h-[44px] items-center gap-1.5 rounded-md border border-input px-4 font-body text-xs font-semibold text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50",children:[o.jsx(EC,{size:13,"aria-hidden":"true"})," Decline"]})]})]}):o.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3",children:[o.jsxs("span",{className:"font-body text-[10px] font-semibold uppercase tracking-wider text-accent",children:[w.decision,w.decided_at?` · ${new Date(w.decided_at).toLocaleDateString()}`:""]}),o.jsx("button",{type:"button",onClick:()=>void b(w.id),disabled:p===w.id,className:"font-body text-[11px] font-semibold text-muted-foreground underline underline-offset-2 hover:text-foreground disabled:opacity-50",children:"Move back to pending"})]})]},w.id))]})]})})}const NJ=()=>{const{isAdmin:e,checking:t}=v2(),{user:n,loading:r,signOut:i}=pn(),[s,a]=k.useState(null),[l,c]=k.useState(0);if(k.useEffect(()=>{if(!e)return;let u=!0;return(async()=>{const{count:f}=await Ne.from("valuation_leads").select("id",{count:"exact",head:!0}).eq("kind","specialist_review").eq("decision","pending");u&&c(f??0)})(),()=>{u=!1}},[e,s]),r||t)return o.jsx("main",{className:"flex min-h-[60vh] items-center justify-center bg-cream px-6 py-16",children:o.jsx("p",{className:"font-body text-sm text-muted-foreground",children:"Checking your access…"})});if(!n)return o.jsx("main",{className:"min-h-[70vh] bg-cream px-5 py-14 sm:px-8",children:o.jsxs("div",{className:"mx-auto max-w-md space-y-6",children:[o.jsxs("header",{className:"text-center",children:[o.jsx("p",{className:"font-body text-[10px] font-semibold uppercase tracking-[0.28em] text-accent",children:"Reverie Fine Art Collective"}),o.jsx("h1",{className:"mt-2 font-display text-3xl font-semibold tracking-tight",children:"Staff sign in"}),o.jsx("p",{className:"mt-2 font-body text-xs leading-relaxed text-muted-foreground",children:"This workspace is for Reverie staff. Sign in with your Reverie account to continue."})]}),o.jsx(Rf,{standalone:!0}),o.jsx(St,{to:"/",className:"block text-center font-body text-xs text-muted-foreground underline underline-offset-2",children:"Back to the valuation tool"})]})});if(!e)return o.jsx("main",{className:"flex min-h-[60vh] items-center justify-center bg-cream px-6 py-16",children:o.jsxs("div",{className:"w-full max-w-sm space-y-4 rounded-md border border-border bg-card p-6 text-center",children:[o.jsx("h1",{className:"font-display text-xl font-semibold tracking-tight",children:"Access denied"}),o.jsx("p",{className:"font-body text-xs leading-relaxed text-muted-foreground",children:"Your account does not have access to the Reverie staff workspace. If you believe this is a mistake, contact the Reverie team."}),o.jsx(St,{to:"/value",className:"inline-flex min-h-[44px] w-full items-center justify-center rounded-md bg-primary px-4 font-body text-sm font-semibold text-primary-foreground transition-all hover:brightness-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"Return to the valuation tool"}),o.jsx("button",{type:"button",onClick:()=>i(),className:"font-body text-xs text-muted-foreground underline underline-offset-2",children:"Sign out"})]})});const d=[{key:"portfolio",label:"Portfolio dashboard"},{key:"bulk",label:"Bulk CSV import"},{key:"collectors",label:"Collectors / CRM"},{key:"share",label:"Curated viewing room"},{key:"badges",label:"Storefront widgets"},{key:"reviews",label:l>0?`Specialist review requests (${l})`:"Specialist review requests"},{key:"leads",label:"Storefront valuation requests"}];return o.jsxs("main",{className:"mx-auto max-w-5xl space-y-8 overflow-x-hidden px-4 py-8 sm:px-8",children:[o.jsxs("header",{className:"flex flex-wrap items-baseline justify-between gap-3 border-b border-border pb-5",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-body text-[10px] font-semibold uppercase tracking-[0.28em] text-accent",children:"Internal"}),o.jsx("h1",{className:"mt-1.5 font-display text-3xl font-semibold tracking-tight",children:"Reverie Admin"}),o.jsxs("p",{className:"mt-1 font-body text-xs text-muted-foreground",children:["Signed in as ",n.email]})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("a",{href:"https://reverieart.com",target:"_top",rel:"noopener",className:"inline-flex min-h-[44px] items-center rounded-md border border-accent px-3 font-body text-xs font-semibold text-accent hover:bg-accent/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"Return to ReverieArt.com ↗"}),o.jsx(St,{to:"/",className:"inline-flex min-h-[44px] items-center px-2 font-body text-xs font-semibold text-muted-foreground underline underline-offset-2",children:"Collector view"}),o.jsx("button",{type:"button",onClick:()=>i(),className:"inline-flex min-h-[44px] items-center px-2 font-body text-xs font-semibold text-muted-foreground underline underline-offset-2",children:"Sign out"})]})]}),o.jsx(MK,{}),o.jsxs("section",{"aria-label":"Staff workspaces",children:[o.jsx("h2",{className:"font-display text-xl font-semibold tracking-tight",children:"Staff workspaces"}),o.jsx("div",{className:"mt-3 grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[{to:"/admin/market-review",title:"Market Review",body:"Catalog pricing review, evidence and badges"},{to:"#submissions",title:"Submissions",body:"All saved valuations"},{to:"#consignments",title:"Consignments",body:"Review and list consigned works"},{to:"#tools",title:"Specialist reviews",body:l>0?`${l}
687 pending`:"Requests inbox",key:"reviews"}].map(u=>u.to.startsWith("/")?o.jsxs(St,{to:u.to,className:"flex min-h-[88px] flex-col justify-between rounded-md border border-accent bg-card p-4 transition-all hover:bg-accent/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[o.jsxs("span",{className:"font-body text-sm font-semibold text-foreground",children:[u.title," →"]}),o.jsx("span",{className:"font-body text-xs text-muted-foreground",children:u.body})]},u.title):o.jsxs("a",{href:u.to,onClick:f=>{var p;u.key?(f.preventDefault(),a(u.key)):(f.preventDefault(),(p=document.getElementById(u.to.slice(1)))==null||p.scrollIntoView({behavior:"smooth",block:"start"}))},className:"flex min-h-[88px] flex-col justify-between rounded-md border border-border bg-card p-4 transition-all hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[o.jsxs("span",{className:"font-body text-sm font-semibold text-foreground",children:[u.title," →"]}),o.jsx("span",{className:"font-body text-xs text-muted-foreground",children:u.body})]},u.title))})]}),o.jsxs("section",{id:"tools","aria-label":"Internal tools",children:[o.jsx("h2",{className:"font-display text-xl font-semibold tracking-tight",children:"Tools"}),o.jsx("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:d.map(u=>o.jsx("button",{type:"button",onClick:()=>a(u.key),className:"min-h-[48px] rounded-md border border-input px-4 text-left font-body text-sm font-semibold text-foreground transition-all hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:u.label},u.key))})]}),o.jsx(vU,{}),o.jsx(bU,{isAdmin:!0}),o.jsx(kU,{isAdmin:!0}),o.jsx(qA,{isAdmin:!0}),o.jsx(G2,{}),o.jsx("div",{id:"submissions",className:"scroll-mt-4",children:o.jsx(SU,{isAdmin:!0})}),o.jsx("div",{id:"consignments",className:"scroll-mt-4",children:o.jsx(IK,{isAdmin:!0,onApproveToShopify:u=>{const f=u.base_value||0,p=f+f*((u.scarcity_multiplier||0)/100)+f*((u.provenance_uplift||0)/100),h=u.asking_price,x=u.list_price,g=Number(u.formula_value)||0,b=Math.round(g||p),y=Math.round(x||h||g||p),_=window.prompt([`Recommended valuation: $${b.toLocaleString()}`,h?`Consignor asking price: $${Math.round(h).toLocaleString()}`:"Consignor asking price: not provided","","Enter final retail price to list on Shopify (USD):"].join(`
688`),String(y));if(_===null)return;const w=parseFloat(_.replace(/[^0-9.]/g,""));if(!Number.isFinite(w)||w<=0){me.error("Enter a valid positive price");return}Ne.functions.invoke("create-shopify-product",{body:{artistName:u.artist_name||"",artworkTitle:u.artwork_title||"",year:u.year||"",medium:u.medium||"",dimensions:u.dimensions||"",condition:u.condition||"",edition:u.edition||"",artistBio:u.artist_bio||"",provenance:u.provenance||"",exhibitionHistory:u.exhibition_history||"",image:u.image_url,totalValue:b,listPrice:w,submissionId:u.id}}).then(({data:S,error:C})=>{C||!(S!=null&&S.success)?me.error("Failed to list on Shopify"):me.success(`Listed on Shopify at $${w.toLocaleString()}`)})}})}),s==="portfolio"&&o.jsx(wJ,{onClose:()=>a(null)}),s==="bulk"&&o.jsx(JK,{onClose:()=>a(null),onComplete:()=>a(null)}),s==="collectors"&&o.jsx(ZK,{onClose:()=>a(null)}),s==="share"&&o.jsx(tJ,{onClose:()=>a(null)}),s==="badges"&&o.jsx(GP,{onClose:()=>a(null)}),s==="reviews"&&o.jsx(kJ,{onClose:()=>a(null)}),s==="leads"&&o.jsx(YP,{onClose:()=>a(null)})]})},yj={source:"",comparable_work:"",result:"",result_date:"",relevance:""},KP=[["source","Source description / URL"],["comparable_work","Comparable work or reference point"],["result","Sale, listing or estimate result"],["result_date","Date of result"],["relevance","Relevance note"]];function JP(e){return e?KP.every(([t])=>!!String(e[t]??"").trim()):!1}function up(e){return(Array.isArray(e)?e:[]).filter(JP)}function SJ(e){if(!e)return null;const t=String(e).replace(/,/g,"").match(/\d+(\.\d+)?/);if(!t)return null;const n=parseFloat(t[0]);return Number.isFinite(n)&&n>0?n:null}const wj=["A","B","C"],jJ={A:"A — Verified sold comparables",B:"B — Artist/gallery pricing + listings or auction estimates",C:"
688C — Proxy-market evidence (limited public history)"},_j={A:"At least one documented sold comparable with source, result and date.",B:"At least two independent documented reference points.",C:"Documented proxy methodology (comparable artists/works, medium, scale, edition, condition, framing, provenance, acquisition cost, gallery margin) plus manual staff approval."};function K2(e){return e==="B"?2:1}const kj=["Not Started","Tool Reviewed","Needs Manual Review","Approved","Shopify Sync Ready","Published"],EJ=["Approved","Shopify Sync Ready","Published"],T1=e=>EJ.includes(e),jb="Market Pricing Reviewed",Nj="This indicates a gallery pricing review, not a certified appraisal or guarantee of future value.",CJ="“Market Pricing Reviewed” means Reverie compared the work’s pricing with available market evidence and piece-specific attributes. It is not a certified appraisal or guarantee of future value.";function O1(e){if(!e)return null;const t=new Date(`${e}T00:00:00`);return Number.isNaN(t.getTime())?null:`Pricing reviewed by Reverie using available market evidence and piece-specific attributes — ${t.toLocaleDateString("en-US",{month:"long",year:"numeric"})}.`}function AJ(e){if(!e)return null;const t=new Date(`${e}T00:00:00`);return Number.isNaN(t.getTime())?null:(t.setFullYear(t.getFullYear()+1),t.toISOString().slice(0,10))}function PJ(e,t){return!e||!t||e<=0?null:Math.round((t-e)/e*1e3)/10}function I1(e){if(!e.evidence_tier)return"Set an evidence tier first";const t=up(e.market_evidence).length,n=K2(e.evidence_tier);return t<n?`Tier ${e.evidence_tier} needs ${n} documented reference point${n>1?"s":""} — ${t} stored`:String(e.source_references??"").trim()?e.evidence_tier==="C"&&!String(e.methodology_summary??"").trim()?"Tier C needs a documented methodology summary":null:"Add source URLs or references"}function XP(e){return I1(e)===null}function Eb(e){return T1(e.review_status)&&!!e.review_date&&!!e.approved_price&&e.approved_price>0&&XP(e)}const Sj={airtable_record_id:["airtablerecordid","recordid","airtableid","id"],shopify_product_id:["shopifyproductid","shopifyid","productid"],sku:["sku","variantsku"],artist:["artist","artistname"],title:["title","artworktitle","name"],medium:["medium"],dimensions:["dimensions","size","dims"],year:["year","date"],edition_authentication:["editionauthentication","edition","authentication","editionauth"],condition:["condition"],current_asking_price:["currentaskingprice","askingprice","price","retailprice"]},LJ=e=>e.toLowerCase().replace(/[^a-z0-9]/g,"");function jj(e){const t=[];let n="",r=!1;for(let i=0;i<e.length;i++){const s=e[i];s==='"'?r&&e[i+1]==='"'?(n+='"',i++):r=!r:s===","&&!r?(t.push(n),n=""):n+=s}return t.push(n),t.map(i=>i.trim())}function RJ(e){const t=[],n=e.replace(/\r\n/g,`
689`).split(`
690`).filter(c=>c.trim().length>0);if(n.length<2)return{rows:[],errors:["The file needs a header row and at least one inventory row."]};const r=jj(n[0]).map(LJ),i=c=>{for(const d of Sj[c]){const u=r.indexOf(d);if(u>=0)return u}return-1},s=Object.fromEntries(Object.keys(Sj).map(c=>[c,i(c)]));if(s.airtable_record_id<0&&s.shopify_product_id<0)return t.push("The file must include an Airtable Record ID or Shopify Product ID column."),{rows:[],errors:t};const a=[],l=new Set;for(let c=1;c<n.length;c++){const d=jj(n[c]),u=h=>s[h]>=0?(d[s[h]]??"").trim():"",f={airtable_record_id:u("airtable_record_id"),shopify_product_id:u("shopify_product_id"),sku:u("sku"),artist:u("artist"),title:u("title"),medium:u("medium"),dimensions:u("dimensions"),year:u("year"),edition_authentication:u("edition_authentication"),condition:u("condition"),current_asking_price:u("current_asking_price")};if(!f.airtable_record_id&&!f.shopify_product_id){t.push(`Row ${c+1}: no Airtable Record ID or Shopify Product ID — skipped.`);continue}const p=f.airtable_record_id||`shopify:${f.shopify_product_id}`;if(l.has(p)){t.push(`Row ${c+1}: duplicate of an earlier row in this file — skipped.`);continue}l.add(p),a.push(f)}return{rows:a,errors:t}}function TJ(e){if(!e)return null;const t=parseFloat(String(e).replace(/[^0-9.\-]/g,""));return Number.isFinite(t)?t:null}const OJ=[["Airtable Record ID",e=>e.airtable_record_id],["Shopify Product ID",e=>e.shopify_product_id],["SKU",e=>e.sku],["Artist",e=>e.artist],["Title",e=>e.title],["Evidence Tier",e=>e.evidence_tier],["Current Asking Price",e=>e.current_asking_price],["Valuation Range Low",e=>e.valuation_range_low],["Valuation Range High",e=>e.valuation_range_high],["Recommended Price",e=>e.recommended_market_price],["Approved Price",e=>e.approved_price],["Price Variance %",e=>e.price_variance_pct],["Confidence",e=>e.confidence],["Source URLs / References",e=>e.source_references],["Methodology Summary",e=>e.methodology_summary],["Comparable Market Evidence",e=>e.comparable_market_evidence],["Internal Review Notes",e=>e.internal_review_notes],["Last Reviewed Date",e=>e.review_date],["Next Review Date",e=>e.next_review_date],["Review Status",e=>e.review_status],["Badge Text",e=>e.badge_text],["Show Market Pricing Reviewed Badge",e=>e.show_market_reviewed_badge?"true":"false"],["Stored Reference Points",e=>up(e.market_evidence).map(t=>`${t.source} — ${t.comparable_work} — ${t.result} (${t.result_date}); ${t.relevance}`).join(" | ")]],IJ=[["Airtable Record ID",e=>e.airtable_record_id],["Shopify Product ID",e=>e.shopify_product_id],["Approved Price",e=>e.approved_price],["Badge Text",e=>e.badge_text??O1(e.review_date)],["Review Date",e=>e.review_date],["Confidence",e=>e.confidence],["Methodology Summary",e=>e.methodology_summary]],Ej=e=>{const t=e==null?"":String(e);return/[",\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t},ZP=(e,t)=>
690{const n=e.map(([i])=>Ej(i)).join(","),r=t.map(i=>e.map(([,s])=>Ej(s(i))).join(","));return[n,...r].join(`
691`)};function DJ(e){return ZP(OJ,e)}function FJ(e){return ZP(IJ,e)}const MJ=["Airtable Record ID,Shopify Product ID,SKU,Artist,Title,Medium,Dimensions,Year,Edition/Authentication,Condition,Current Asking Price","recAbc123,9683309854976,REV-0001,Demo Artist (sample),Demo Work (sample),Oil on canvas,24 x 30 in,2019,Unique / signed,Excellent,4800"].join(`
692`);function Cb(e,t){const n=new Blob([t],{type:"text/csv;charset=utf-8"}),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=e,i.click(),URL.revokeObjectURL(r)}const $J="No documented market references are stored for this work.";function BJ(e){const t=e.evidence_tier,n=up(e.market_evidence).length,r=[];if(!t)r.push("an evidence tier (A, B or C)");else{const i=K2(t);n<i&&r.push(`${i} documented reference point${i>1?"s":""} for Tier ${t} (${n} stored)`),t==="C"&&!String(e.methodology_summary??"").trim()&&r.push("a documented proxy methodology summary")}return String(e.source_references??"").trim()||r.push("source URLs or references"),r.length===0?"":` Missing: ${r.join("; ")}. The current asking price and piece attributes alone cannot support a market value.`}function kh(e,t){return{valuation_range_low:null,valuation_range_high:null,recommended_market_price:null,confidence:"Low",comparable_market_evidence:$J+BJ(e),review_status:"Needs Manual Review",review_date:t}}function UJ(e){const t=new Date().toISOString().slice(0,10),n=e.evidence_tier,r=up(e.market_evidence);if(!n||r.length<K2(n)||n==="C"&&!String(e.methodology_summary??"").trim()||!String(e.source_references??"").trim())return kh(e,t);const i=r.map(f=>SJ(f.result)).filter(f=>typeof f=="number").sort((f,p)=>f-p);if(i.length===0)return{...kh(e,t),comparable_market_evidence:"Documented references are stored but none contain a usable figure, so no range or recommended price was produced."};const s=i[0],a=i[i.length-1],l=i.length%2===1?i[(i.length-1)/2]:(i[i.length/2-1]+i[i.length/2])/2,c=n==="A"?i.length>=3?"High":"Medium":n==="B"?"Medium":"Low",d=[`Tier ${n} review from ${r.length} documented reference point${r.length>1?"s":""}.`,...r.map(f=>`${f.source} — ${f.comparable_work} — ${f.result} (${f.result_date}); ${f.relevance}`),n==="C"?`Proxy methodology: ${String(e.methodology_summary).trim()}`:"","The current Reverie asking price was not used to derive this range."].filter(Boolean).join(" "),u=n==="C"?"Needs Manual Review":"Tool Reviewed";return{valuation_range_low:Math.round(s),valuation_range_high:Math.round(a),recommended_market_price:Math.round(l),confidence:c,comparable_market_evidence:d,review_status:u,review_date:t}}const Fl="market_review_items",Ab=e=>e==null?"—":`$${Math.round(e).toLocaleString()}`,zJ={"Not Started":"text-muted-foreground","Tool Reviewed":"text-foreground","Needs Manual Review":"text-destructive",Approved:"text-accent","Shopify Sync Ready":"text-blue-700",Published:"text-emerald-700"},QP=["Airtable ID","Shopify ID","SKU","Artist","Title","Medium","Dimensions","Year","Edition / Auth.","Condition","Tier","Asking","Range low","Range high","Recommended","Approved","Variance","Confidence","References","Market evidence","Internal notes","Last reviewed","Next review","Status","Badge",""],Cj=QP.length+1,qJ=()=>{const{isAdmin:e,checking:t}=v2(),{user:n,loading:r}=pn(),i=k.useRef(null),[s,a]=k.useState([]),l=k.useRef(new Map),[c,d]=k.useState(new Set),[u,f]=k.useState(!1),[p,h]=k.useState(!0),[x,g]=k.useState("all"),[b,y]=k.useState(null),_=async()=>{h(!0);const{data:I,error:re}=await Ne.from(Fl).select("*").order("created_at",{ascending:!1});if(h(!1),re){me.error("Could not load the review queue");return}const V=I??[];l.current=new Map(V.filter($=>$.id).map($=>[$.id,$])),a(V)};k.useEffect(()=>{e&&_()},[e]);const w=k.useMemo(()=>x==="all"?s:s.filter(I=>I.review_status===x),[s,x]),S=k.useMemo(()=>{const I=re=>s.filter(V=>V.review_status===re).length;return{total:s.length,reviewed:I("Tool Reviewed"),manual:I("Needs Manual Review"),approved:I("Approved"),sync:I("Shopify Sync Ready"),published:I("Published"),badged:s.filter(re=>re.show_market_reviewed_badge).length}},[s]),C=async I=>{const re=await I.text(),{rows:V,errors:$}=RJ(re);if($.slice(0,4).forEach(E=>me.warning(E)),V.length===0)return;f(!0);let D=0,ie=0,X=0;for(const E of V){const q={airtable_record_id:E.airtable_record_id||null,shopify_product_id:E.shopify_product_id||null,sku:E.sku||null,artist:E.artist||null,title:E.title||null,medium:E.medium||null,dimensions:E.dimensions||null,year:E.year||null,edition_authentication:E.edition_authentication||null,condition:E.condition||null,current_asking_price:TJ(E.current_asking_price)};let F=null;if(q.airtable_record_id){const{data:Z}=await Ne.from(Fl).select("id").eq("airtable_record_id",q.airtable_record_id).maybeSingle();F=(Z==null?void 0:Z.id)??null}if(!F&&q.shopify_product_id){const{data:Z}=await Ne.from(Fl).select("id").eq("shopify_product_id",q.shopify_product_id).maybeSingle();F=(Z==null?void 0:Z.id)??null}if(F){const{error:Z}=await Ne.from(Fl).update(q).eq("id",F);Z?X++:ie++}else{const{error:Z}=await Ne.from(Fl).insert(q);Z?X++:D++}}f(!1),i.current&&(i.current.value=""),await _(),me.success(`Import finished — ${D} added, ${ie} updated${X?`, ${X} failed`:""}`)},P=async()=>{const I=s.filter(D=>D.id&&c.has(D.id));if(I.length===0){me.error("Select at least one work to review");return}f(!0);
692let re=0,V=0,$=0;for(const D of I){const ie=UJ(D),{error:X}=await Ne.from(Fl).update(ie).eq("id",D.id);X?$++:ie.review_status==="Needs Manual Review"?V++:re++}f(!1),await _(),d(new Set),me.success(`Pricing review complete — ${re} reviewed, ${V} need manual review${$?`, ${$} failed`:""}`)},R=async(I,re)=>{const V={...I,...re};if(T1(V.review_status)&&!XP(V)){me.error(I1(V)||"Documented evidence is required before approving this work");const X=I.id?l.current.get(I.id):void 0;X&&a(E=>E.map(q=>q.id===I.id?X:q));return}V.show_market_reviewed_badge&&!Eb(V)&&(V.show_market_reviewed_badge=!1,re.show_market_reviewed_badge=!1);const $=PJ(V.current_asking_price,V.approved_price);$!==V.price_variance_pct&&(V.price_variance_pct=$,re.price_variance_pct=$);const D=V.show_market_reviewed_badge?O1(V.review_date):V.badge_text;D!==V.badge_text&&(V.badge_text=D,re.badge_text=D),a(X=>X.map(E=>E.id===I.id?V:E));const{error:ie}=await Ne.from(Fl).update(re).eq("id",I.id);ie?(me.error("Change was not saved"),_()):I.id&&l.current.set(I.id,V)},M=I=>{const re=I.review_date||new Date().toISOString().slice(0,10);R(I,{review_status:"Approved",review_date:re,next_review_date:I.next_review_date||AJ(re),approved_price:I.approved_price??I.recommended_market_price})},T=(I,re)=>R(I,{market_evidence:re}),H=(I,re,V,$)=>{const D=[...I.market_evidence??[]];D[re]={...yj,...D[re],[V]:$},a(ie=>ie.map(X=>X.id===I.id?{...X,market_evidence:D}:X))},A=()=>{const I=c.size>0?s.filter(re=>re.id&&c.has(re.id)):w;if(I.length===0){me.error("Nothing to export");return}Cb(`reverie-market-review-${new Date().toISOString().slice(0,10)}.csv`,DJ(I))},O=()=>{const re=(c.size>0?s.filter(V=>V.id&&c.has(V.id)):s).filter(V=>Eb(V)&&!!V.approved_price);if(re.length===0){me.error("No approved works with an approved price to sync yet");return}Cb(`reverie-shopify-sync-${new Date().toISOString().slice(0,10)}.csv`,FJ(re))},K=I=>d(re=>{const V=new Set(re);return V.has(I)?V.delete(I):V.add(I),V}),U=w.length>0&&w.every(I=>I.id&&c.has(I.id));return r||t?o.jsx("main",{className:"flex min-h-[60vh] items-center justify-center bg-cream px-6 py-16",children:o.jsx("p",{className:"font-body text-sm text-muted-foreground",children:"Checking your access…"})}):n?e?o.jsxs("main",{className:"mx-auto max-w-[1400px] space-y-6 px-4 py-8 sm:px-8",children:[o.jsxs("header",{className:"flex flex-wrap items-baseline justify-between gap-3 border-b border-border pb-5",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-body text-[10px] font-semibold uppercase tracking-[0.28em] text-accent",children:"Internal"}),o.jsx("h1",{className:"mt-1.5 font-display text-3xl font-semibold tracking-tight",children:"Market Review"}),o.jsx("p",{className:"mt-1 font-body text-xs text-muted-foreground",children:"Catalog-wide pricing review of Reverie inventory. Nothing here is published to customers and no Shopify price is ever changed automatically."})]}),o.jsxs("nav",{"aria-label":"Staff navigation",className:"flex flex-wrap items-center gap-2",children:[o.jsx(St,{to:"/admin",className:"inline-flex min-h-[44px] items-center rounded-md border border-input px-3 font-body text-xs font-semibold text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"← Reverie Admin"}),o.jsx("a",{href:"https://reverieart.com",target:"_top",rel:"noopener",className:"inline-flex min-h-[44px] items-center rounded-md border border-accent px-3 font-body text-xs font-semibold text-accent hover:bg-accent/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"Return to ReverieArt.com ↗"})]})]}),o.jsxs("div",{className:"space-y-2 rounded-md border border-border bg-muted/50 p-3",children:[o.jsx("p",{className:"font-body text-[11px] leading-relaxed text-muted-foreground",children:CJ}),o.jsxs("p",{className:"flex items-start gap-2 font-body text-[11px] leading-relaxed text-muted-foreground",children:[o.jsx(I7,{size:13,className:"mt-0.5 shrink-0 text-accent","aria-hidden":!0}),o.jsxs("span",{children:[o.jsxs("strong",{className:"font-semibold text-foreground",children:[jb," disclosure:"]})," ",Nj]})]}),o.jsx("ul",{className:"space-y-1 font-body text-[11px] leading-relaxed text-muted-foreground",children:wj.map(I=>o.jsxs("li",{children:[o.jsx("strong",{className:"font-semibold text-foreground",children:jJ[I
692]})," — ",_j[I]]},I))})]}),o.jsx("section",{className:"grid grid-cols-2 gap-2 sm:grid-cols-7","aria-label":"Review progress",children:[["Total queued",S.total],["Tool reviewed",S.reviewed],["Needs manual review",S.manual],["Approved",S.approved],["Shopify sync ready",S.sync],["Published",S.published],["Badge on",S.badged]].map(([I,re])=>o.jsxs("div",{className:"rounded-md border border-border bg-card p-3",children:[o.jsx("p",{className:"font-body text-[10px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:I}),o.jsx("p",{className:"mt-1 font-display text-2xl font-semibold",children:re})]},I))}),o.jsxs("section",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("input",{ref:i,type:"file",accept:".csv,text/csv",className:"hidden",onChange:I=>{var re;return((re=I.target.files)==null?void 0:re[0])&&C(I.target.files[0])}}),o.jsxs("button",{type:"button",onClick:()=>{var I;return(I=i.current)==null?void 0:I.click()},disabled:u,className:"inline-flex min-h-[44px] items-center gap-2 rounded-md bg-primary px-4 font-body text-xs font-semibold uppercase tracking-wider text-primary-foreground transition-all hover:brightness-110 disabled:opacity-50",children:[o.jsx(TC,{size:14})," Import Airtable CSV"]}),o.jsxs("button",{type:"button",onClick:()=>Cb("reverie-market-review-template.csv",MJ),className:"inline-flex min-h-[44px] items-center gap-2 rounded-md border border-input px-4 font-body text-xs font-semibold uppercase tracking-wider transition-all hover:bg-muted",children:[o.jsx(Ho,{size:14})," Import template"]}),o.jsxs("button",{type:"button",onClick:P,disabled:u||c.size===0,className:"inline-flex min-h-[44px] items-center gap-2 rounded-md border border-accent px-4 font-body text-xs font-semibold uppercase tracking-wider text-accent transition-all hover:bg-accent/10 disabled:opacity-50",children:[o.jsx(Nc,{size:14})," Run pricing review",c.size>0?` (${c.size})`:""]}),o.jsxs("button",{type:"button",onClick:A,className:"inline-flex min-h-[44px] items-center gap-2 rounded-md border border-input px-4 font-body text-xs font-semibold uppercase tracking-wider transition-all hover:bg-muted",children:[o.jsx(Ho,{size:14})," Export for Airtable"]}),o.jsxs("button",{type:"button",onClick:O,className:"inline-flex min-h-[44px] items-center gap-2 rounded-md border border-input px-4 font-body text-xs font-semibold uppercase tracking-wider transition-all hover:bg-muted",children:[o.jsx(Ho,{size:14})," Export Shopify sync"]}),o.jsxs("select",{value:x,onChange:I=>g(I.target.value),className:"min-h-[44px] rounded-md border border-input bg-background px-3 font-body text-xs","aria-label":"Filter by review status",children:[o.jsx("option",{value:"all",children:"All statuses"}),kj.map(I=>o.jsx("option",{value:I,children:I},I))]}),u&&o.jsx("span",{className:"font-body text-xs text-muted-foreground",children:"Working…"})]}),o.jsx("p",{className:"font-body text-[11px] text-muted-foreground",children:"Scroll sideways to see every column — the selection box and Airtable Record ID stay pinned."}),o.jsx("section",{tabIndex:0,className:"max-h-[75vh] overflow-auto overscroll-contain rounded-md border border-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Market review queue",children:o.jsxs("table",{className:"w-max min-w-[2800px] table-auto font-body text-xs",children:[o.jsx("thead",{className:"sticky top-0 z-20 bg-muted shadow-[0_1px_0_hsl(var(--border))]",children:o.jsxs("tr",{className:"text-left",children:[o.jsx("th",{className:"sticky left-0 z-30 w-10 min-w-10 bg-muted px-2 py-2",children:o.jsx("input",{className:"h-4 w-4",type:"checkbox","aria-label":"Select all shown",checked:U,onChange:I=>d(I.target.checked?new Set(w.map(re=>re.id).filter(Boolean)):new Set)})}),QP.map((I,re)=>o.jsx("th",{className:`whitespace-nowrap px-3 py-2 font-semibold ${re===0?"sticky left-10 z-30 min-w-[130px] bg-muted shadow-[1px_0_0_hsl(var(--border))]":""}`,children:I},I||`blank-${re}`))]})}),o.jsxs("tbody",{children:[w.map(I=>{const re=Eb(I),V=up(I.market_evidence).length,$=I1(I),D=$===null;return o.jsxs(k.Fragment,{children:[o.jsxs("tr",{className:"border-t border-border align-middle",children:[o.jsx("td",{className:"sticky left-0 z-10 w-10 min-w-10 bg-background px-2 py-2",children:o.jsx("input",{className:"h-4 w-4",type:"checkbox","aria-label":`Select ${I.title||I.sku||I.airtable_record_id||"row"}`,checked:!!I.id&&c.has(I.id),onChange:()=>I.id&&K(I.id)})}),o.jsx("td",{className:"sticky left-10 z-10 min-w-[130px] bg-background px-3 py-2 font-mono text-[10px] text-foreground shadow-[1px_0_0_hsl(var(--border))]",children:I.airtable_record_id||"—"}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2 font-mono text-[10px] text-muted-foreground",children:I.shopify_product_id||"—"}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2",children:I.sku||"—"}),o.jsx("td",{className:"min-w-[160px] whitespace-nowrap px-3 py-2",children:I.artist||"—"}),o.jsx("td",{className:"min-w-[160px] whitespace-nowrap px-3 py-2",children:I.title||"—"}),o.jsx("td",{className:"min-w-[140px] whitespace-nowrap px-3 py-2 text-muted-foreground",children:I.medium||"Not provided"}),o.jsx("td",{className:"min-w-[120px] whitespace-nowrap px-3 py-2 text-muted-foreground",children:I.dimensions||"Not provided"}),o.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:I.year||"—"}),o.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:I.edition_authentication||"Not provided"}),o.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:I.condition||"Not provided"}),o.jsx("td",{className:"px-3 py-2",children:o.jsxs("select",{value:I.evidence_tier??"","aria-label":"Evidence tier",onChange:ie=>R(I,{evidence_tier:ie.target.value||null}),className:"rounded-md border border-input bg-background px-2 py-1 font-semibold",children:[o.jsx("option",{value:"",children:"—"}),wj.map(ie=>o.jsx("option",{value:ie,title:_j[ie],children:ie},ie))]})}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2",children:Ab(I.current_asking_price)}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2",children:Ab(I.valuation_range_low)}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2",children:Ab(I.valuation_range_high)}),o.jsx("td",{className:"px-3 py-2",children:o.jsx("input",{type:"number",value:I.recommended_market_price??"","aria-label":"Recommended price",disabled:!D,title:$??void 0,onChange:ie=>a(X=>X.map(E=>E.id===I.id?{...E,recommended_market_price:ie.target.value===""?null:Number(ie.target.value)}:E)),onBlur:ie=>R(I,{recommended_market_price:ie.target.value===""?null:Number(ie.target.value)}),className:"w-24 rounded-md border border-input bg-background px-2 py-1 disabled:opacity-40"})}),o.jsx("td",{className:"px-3 py-2",children:o.jsx("input",{type:"number",value:I.approved_price??"","aria-label":"Approved price",disabled:!D,title:$??void 0,onChange:ie=>a(X=>X.map(E=>E.id===I.id?{...E,approved_price:ie.target.value===""?null:Number(ie.target.value)}:E)),onBlur:ie=>R(I,{approved_price:ie.target.value===""?null:Number(ie.target.value)}),className:"w-24 rounded-md border border-input bg-background px-2 py-1 disabled:opacity-40"})}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2 text-muted-foreground",children:I.price_variance_pct===null||I.price_variance_pct===void 0?"—":`${I.price_variance_pct>0?"+":""}${I.price_variance_pct}%`}),o.jsx("td",{className:"px-3 py-2",children:I.confidence||"—"}),o.jsx("td",{className:"whitespace-nowrap px-3 py-2",children:o.jsx("button",{type:"button",onClick:()=>
692y(b===I.id?null:I.id??null),className:"rounded-md border border-input px-2 py-1 font-semibold hover:bg-muted","aria-expanded":b===I.id,children:V>0?`${V} record${V>1?"s":""}`:"None — add"})}),o.jsx("td",{className:"w-[320px] min-w-[320px] px-3 py-2 text-[11px] leading-relaxed text-muted-foreground",children:I.comparable_market_evidence||"No documented market references stored"}),o.jsx("td",{className:"px-3 py-2",children:o.jsx("textarea",{defaultValue:I.internal_review_notes??"","aria-label":"Internal review notes",rows:2,onBlur:ie=>R(I,{internal_review_notes:ie.target.value||null}),className:"w-44 rounded-md border border-input bg-background px-2 py-1"})}),o.jsx("td",{className:"px-3 py-2",children:o.jsx("input",{type:"date",value:I.review_date??"","aria-label":"Last reviewed date",onChange:ie=>R(I,{review_date:ie.target.value||null}),className:"rounded-md border border-input bg-background px-2 py-1"})}),o.jsx("td",{className:"px-3 py-2",children:o.jsx("input",{type:"date",value:I.next_review_date??"","aria-label":"Next review date",onChange:ie=>R(I,{next_review_date:ie.target.value||null}),className:"rounded-md border border-input bg-background px-2 py-1"})}),o.jsx("td",{className:"px-3 py-2",children:o.jsx("select",{value:I.review_status,"aria-label":"Review status",onChange:ie=>R(I,{review_status:ie.target.value}),className:`rounded-md border border-input bg-background px-2 py-1 font-semibold ${zJ[I.review_status]}`,children:kj.map(ie=>o.jsx("option",{value:ie,children:ie},ie))})}),o.jsx("td",{className:"w-[240px] min-w-[240px] px-3 py-2",children:o.jsxs("label",{className:"flex items-start gap-2",children:[o.jsx("input",{type:"checkbox",checked:I.show_market_reviewed_badge,disabled:!re,"aria-label":`Show ${jb} badge`,title:Nj,onChange:ie=>R(I,{show_market_reviewed_badge:ie.target.checked})}),o.jsx("span",{className:"text-[10px] leading-snug text-muted-foreground",children:re?I.show_market_reviewed_badge?I.badge_text??O1(I.review_date):jb:"Needs tier, references, approved price, date + approval"})]})}),o.jsx("td",{className:"px-3 py-2",children:!T1(I.review_status)&&o.jsx("button",{type:"button",onClick:()=>M(I),disabled:!D,title:$??void 0,className:"whitespace-nowrap rounded-md border border-accent px-3 py-1 font-semibold text-accent transition-all hover:bg-accent/10 disabled:opacity-40",children:"Approve price"})})]}),b===I.id&&o.jsx("tr",{className:"border-t border-border bg-muted/30",children:o.jsx("td",{colSpan:Cj,className:"px-4 py-4",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx("p",{className:"font-body text-[11px] leading-relaxed text-muted-foreground",children:"Every reference point needs all five parts. A range or recommended price is only produced from documented reference points — never from the current Reverie asking price, and never anchored to it. Tier A needs one sold comparable, Tier B two independent reference points, Tier C a documented proxy methodology plus manual staff approval."}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"block text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Source URLs / references"}),o.jsx("textarea",{defaultValue:I.source_references??"",rows:3,onBlur:ie=>R(I,{source_references:ie.target.value||null}),className:"mt-1 w-full rounded-md border border-input bg-background px-2 py-1"})]}),o.jsxs("label",{className:"block",children:[o.jsxs("span",{className:"block text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:["Methodology summary ",I.evidence_tier==="C"?"(required for Tier C)":""]}),o.jsx("textarea",{defaultValue:I.methodology_summary??"",rows:3,placeholder:"Comparable artists/works, medium, scale, edition, condition, framing, provenance, acquisition cost, gallery margin",onBlur:ie=>R(I,{methodology_summary:ie.target.value||null}),className:"mt-1 w-full rounded-md border border-input bg-background px-2 py-1"})]})]}),(I.market_evidence??[]).map((ie,X)=>o.jsxs("div",{className:"grid gap-2 rounded-md border border-border bg-card p-3 sm:grid-cols-5",children:[KP.map(([E,q])=>o.jsxs("label",{className:"block",children:[o.jsx("span",{className:"block text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:q}),o.jsx("input",{type:E==="result_date"?"date":"text",value:(ie==null?void 0:ie[E])??"",onChange:F=>H(I,X,E,F.target.value),onBlur:()=>T(I,I.market_evidence??[]),className:"mt-1 w-full rounded-md border border-input bg-background px-2 py-1"})]},E)),o.jsxs("div",{className:"sm:col-span-5 flex items-center justify-between gap-3",children:[o.jsx("span",{className:"text-[10px] text-muted-foreground",children:JP(ie)?"Complete record":"Incomplete — not counted"}),o.jsx("button",{type:"button",onClick:()=>T(I,(I.market_evidence??[]).filter((E,q)=>q!==X)),className:"rounded-md border border-input px-3 py-1 font-semibold text-muted-foreground hover:bg-muted",children:"Remove record"})]})]},X)),o.jsx("button",{type:"button",onClick:()=>T(I,[...I.market_evidence??[],{...yj}
692]),className:"rounded-md border border-accent px-3 py-1.5 font-semibold text-accent hover:bg-accent/10",children:"Add reference point"})]})})})]},I.id)}),!p&&w.length===0&&o.jsx("tr",{children:o.jsx("td",{colSpan:Cj,className:"px-4 py-10 text-center text-muted-foreground",children:"Nothing queued yet. Import an Airtable inventory export to begin."})})]})]})})]}):o.jsx("main",{className:"flex min-h-[60vh] items-center justify-center bg-cream px-6 py-16",children:o.jsxs("div",{className:"w-full max-w-sm space-y-4 rounded-md border border-border bg-card p-6 text-center",children:[o.jsx("h1",{className:"font-display text-xl font-semibold tracking-tight",children:"Access denied"}),o.jsx("p",{className:"font-body text-xs leading-relaxed text-muted-foreground",children:"Your account does not have access to this workspace."}),o.jsx(St,{to:"/value",className:"inline-flex min-h-[44px] w-full items-center justify-center rounded-md bg-primary px-4 font-body text-sm font-semibold text-primary-foreground",children:"Return to the valuation tool"})]})}):o.jsx("main",{className:"min-h-[70vh] bg-cream px-5 py-14 sm:px-8",children:o.jsxs("div",{className:"mx-auto max-w-md space-y-6",children:[o.jsxs("header",{className:"text-center",children:[o.jsx("p",{className:"font-body text-[10px] font-semibold uppercase tracking-[0.28em] text-accent",children:"Reverie Fine Art Collective"}),o.jsx("h1",{className:"mt-2 font-display text-3xl font-semibold tracking-tight",children:"Staff sign in"}),o.jsx("p",{className:"mt-2 font-body text-xs leading-relaxed text-muted-foreground",children:"Market Review is for Reverie staff. Sign in with your Reverie account to continue."})]}),o.jsx(Rf,{standalone:!0})]})})},wg=e=>{window.parent!==window&&window.parent.postMessage({source:"reverie",...e},"*")},Aj=(e=0)=>wg({type:"reverie-scroll",offset:e}),WJ=()=>{const e=ea();return k.useEffect(()=>{if(window.parent===window)return;cN({embedded:!0,top:0,height:window.innerHeight}),document.documentElement.classList.add("reverie-embedded");const t=n=>{const r=n.data;!r||r.source!=="reverie-parent"||r.type!=="reverie-viewport"||typeof r.top!="number"||typeof r.height!="number"||cN({embedded:!0,top:Math.max(0,r.top),height:Math.max(0,r.height),...typeof r.parentWidth=="number"&&r.parentWidth>0?{parentWidth:Math.round(r.parentWidth)}:{}})};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[]),k.useEffect(()=>{if(window.parent===window)return;let t=0,n=0;const r=()=>{n=0;const c=Math.ceil(Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.body.offsetHeight));c&&Math.abs(c-t)>6&&(t=c,wg({type:"reverie-resize",height:c}))},i=()=>{n||(n=requestAnimationFrame(r))};i(),window.addEventListener("resize",i),window.addEventListener("load",i);const s=new MutationObserver(i);s.observe(document.body,{childList:!0,subtree:!0});const a=typeof ResizeObserver<"u"?new ResizeObserver(i):null;a==null||a.observe(document.documentElement);const l=[150,500,1200,2500].map(c=>window.setTimeout(i,c));return()=>{window.removeEventListener("resize",i),window.removeEventListener("load",i),s.disconnect(),a==null||a.disconnect(),l.forEach(clearTimeout),n&&cancelAnimationFrame(n)}},[]),k.useEffect(()=>{wg({type:"reverie-navigate",path:e.pathname+e.search}),window.parent!==window?wg({type:"reverie-scroll",offset:0}):window.scrollTo({top:0,behavior:"smooth"})},[e.pathname]),null},e8="w-full px-3.5 py-3 text-sm font-medium font-body bg-card border border-input rounded-md shadow-[var(--shadow-sm)] transition-all placeholder:text-muted-foreground/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",t8=({label:e,htmlFor:t,hint:n,children:r})=>o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:t,className:"block text-xs font-semibold font-body uppercase tracking-wider text-muted-foreground",children:e}),r,n&&o.jsx("p",{className:"font-body text-[11px] text-muted-foreground",children:n})]}),Ro=({label:e,value:t,onChange:n,placeholder:r,hint:i})=>{const s=k.useId();return o.jsx(t8,{label:e,htmlFor:s,hint:i,children:o.jsx("input",{id:s,type:"text",value:t,onChange:a=>n(a.target.value),placeholder:r,className:e8})})},Pb=({label:e,value:t,onChange:n,options:r})=>{const i=k.useId();return o.jsx(t8,{label:e,htmlFor:i,children:o.jsx("select",{id:i,value:t,onChange:s=>n(s.target.value),className:e8,children:r.map(s=>o.jsx("option",{value:s.value,children:s.label},s.value))})})};var Pj=!1,Hl,D1,F1,_g,kg,n8,Ng,M1,$1,B1,r8,U1,z1,i8,s8;function ci(){if(!Pj){Pj=!0;var e=navigator.userAgent,t=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Ice
692weasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),n=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(U1=/\b(iPhone|iP[ao]d)/.exec(e),z1=/\b(iP[ao]d)/.exec(e),B1=/Android/i.exec(e),i8=/FBAN\/\w+;/i.exec(e),s8=/Mobile/i.exec(e),r8=!!/Win64/.exec(e),t){Hl=t[1]?parseFloat(t[1]):t[5]?parseFloat(t[5]):NaN,Hl&&document&&document.documentMode&&(Hl=document.documentMode);var r=/(?:Trident\/(\d+.\d+))/.exec(e);n8=r?parseFloat(r[1])+4:Hl,D1=t[2]?parseFloat(t[2]):NaN,F1=t[3]?parseFloat(t[3]):NaN,_g=t[4]?parseFloat(t[4]):NaN,_g?(t=/(?:Chrome\/(\d+\.\d+))/.exec(e),kg=t&&t[1]?parseFloat(t[1]):NaN):kg=NaN}else Hl=D1=F1=kg=_g=NaN;if(n){if(n[1]){var i=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);Ng=i?parseFloat(i[1].replace("_",".")):!0}else Ng=!1;M1=!!n[2],$1=!!n[3]}else Ng=M1=$1=!1}}var q1={ie:function(){return ci()||Hl},ieCompatibilityMode:function(){return ci()||n8>Hl},ie64:function(){return q1.ie()&&r8},firefox:function(){return ci()||D1},opera:function(){return ci()||F1},webkit:function(){return ci()||_g},safari:function(){return q1.webkit()},chrome:function(){return ci()||kg},windows:function(){return ci()||M1},osx:function(){return ci()||Ng},linux:function(){return ci()||$1},iphone:function(){return ci()||U1},mobile:function(){return ci()||U1||z1||B1||s8},nativeApp:function(){return ci()||i8},android:function(){return ci()||B1},ipad:function(){return ci()||z1}},HJ=q1,Bm=!!(typeof window<"u"&&window.document&&window.document.createElement),VJ={canUseDOM:Bm,canUseWorkers:typeof Worker<"u",canUseEventListeners:Bm&&!!(window.addEventListener||window.attachEvent),canUseViewport:Bm&&!!window.screen,isInWorker:!Bm},GJ=VJ,o8=GJ,a8;o8.canUseDOM&&(a8=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);/**
693 * Checks if an event is supported in the current execution environment.
694 *
695 * NOTE: This will not work correctly for non-generic events such as `change`,
696 * `reset`, `load`, `error`, and `select`.
697 *
698 * Borrows from Modernizr.
699 *
700 * @param {string} eventNameSuffix Event name, e.g. "click".
701 * @param {?boolean} capture Check if the capture phase is supported.
702 * @return {boolean} True if the event is supported.
703 * @internal
704 * @license Modernizr 3.0.0pre (Custom Build) | MIT
705 */function YJ(e,t){if(!o8.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var i=document.createElement("div");i.setAttribute(n,"return;"),r=typeof i[n]=="function"}return!r&&a8&&e==="wheel"&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var KJ=YJ,JJ=HJ,XJ=KJ,Lj=10,Rj=40,Tj=800;function l8(e){var t=0,n=0,r=0,i=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=t*Lj,i=n*Lj,"deltaY"in e&&(i=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||i)&&e.deltaMode&&(e.deltaMode==1?(r*=Rj,i*=Rj):(r*=Tj,i*=Tj)),r&&!t&&(t=r<1?-1:1),i&&!n&&(n=i<1?-1:1),{spinX:t,spinY:n,pixelX:r,pixelY:i}}l8.getEventType=function(){return JJ.firefox()?"DOMMouseScroll":XJ("wheel")?"wheel":"mousewheel"};var ZJ=l8,QJ=ZJ;const eX=Y1(QJ);function tX(e,t,n,r,i,s){s===void 0&&(s=0);var a=_u(e,t,s),l=a.width,c=a.height,d=Math.min(l,n),u=Math.min(c,r);return d>u*i?{width:u*i,height:u}:{width:d,height:d/i}}function nX(e){return e.width>e.height?e.width/e.naturalWidth:e.height/e.naturalHeight}function Nh(e,t,n,r,i){i===void 0&&(i=0);var s=_u(t.width,t.height,i),a=s.width,l=s.height;return{x:Oj(e.x,a,n.width,r),y:Oj(e.y,l,n.height,r)}}function Oj(e,t,n,r){var i=Math.abs(t*r/2-n/2);return cx(e,-i,i)}function Ij(e,t){return Math.sqrt(Math.pow(e.y-t.y,2)+Math.pow(e.x-t.x,2))}function Dj(e,t){return Math.atan2(t.y-e.y,t.x-e.x)*180/Math.PI}function rX(e,t,n,r,i,s,a){s===void 0&&(s=0),a===void 0&&(a=!0);var l=a?iX:sX,c=_u(t.width,t.height,s),d=_u(t.naturalWidth,t.naturalHeight,s),u={x:l(100,((c.width-n.width/i)/2-e.x/i)/c.width*100),y:l(100,((c.height-n.height/i)/2-e.y/i)/c.height*100),width:l(100,n.width/c.width*100/i),height:l(100,n.height/c.height*100/i)},f=Math.round(l(d.width,u.width*d.width/100)),p=Math.round(l(d.height,u.height*d.height/100)),h=d.width>=d.height*r,x=h?{width:Math.round(p*r),height:p}:{width:f,height:Math.round(f/r)},g=ur(ur({},x),{x:Math.round(l(d.width-x.width,u.x*d.width/100)),y:Math.round(l(d.height-x.height,u.y*d.height/100))});return{croppedAreaPercentages:u,croppedAreaPixels:g}}function iX(e,t){return Math.min(e,Math.max(0,t))}function sX(e,t){return t}function oX(e,t,n,r,i,s){var a=_u(t.width,t.height,n),l=cx(r.width/a.width*(100/e.width),i,s),c={x:l*a.width/2-r.width/2-a.width*l*(e.x/100),y:l*a.height/2-r.height/2-a.height*l*(e.y/100)};return{crop:c,zoom:l}}function aX(e,t,n){var r=nX(t);return n.height>n.width?n.height/(e.height*r):n.width/(e.width*r)}function lX(e,t,n,r,i,s){n===void 0&&(n=0);
705var a=_u(t.naturalWidth,t.naturalHeight,n),l=cx(aX(e,t,r),i,s),c=r.height>r.width?r.height/e.height:r.width/e.width,d={x:((a.width-e.width)/2-e.x)*c,y:((a.height-e.height)/2-e.y)*c};return{crop:d,zoom:l}}function Fj(e,t){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}function cX(e){return e*Math.PI/180}function _u(e,t,n){var r=cX(n);return{width:Math.abs(Math.cos(r)*e)+Math.abs(Math.sin(r)*t),height:Math.abs(Math.sin(r)*e)+Math.abs(Math.cos(r)*t)}}function cx(e,t,n){return Math.min(Math.max(e,t),n)}function Um(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter(function(n){return typeof n=="string"&&n.length>0}).join(" ").trim()}var dX=`.reactEasyCrop_Container {
706  position: absolute;
707  top: 0;
708  left: 0;
709  right: 0;
710  bottom: 0;
711  overflow: hidden;
712  user-select: none;
713  touch-action: none;
714  cursor: move;
715  display: flex;
716  justify-content: center;
717  align-items: center;
718}
719
720.reactEasyCrop_Image,
721.reactEasyCrop_Video {
722  will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */
723}
724
725.reactEasyCrop_Contain {
726  max-width: 100%;
727  max-height: 100%;
728  margin: auto;
729  position: absolute;
730  top: 0;
731  bottom: 0;
732  left: 0;
733  right: 0;
734}
735.reactEasyCrop_Cover_Horizontal {
736  width: 100%;
737  height: auto;
738}
739.reactEasyCrop_Cover_Vertical {
740  width: auto;
741  height: 100%;
742}
743
744.reactEasyCrop_CropArea {
745  position: absolute;
746  left: 50%;
747  top: 50%;
748  transform: translate(-50%, -50%);
749  border: 1px solid rgba(255, 255, 255, 0.5);
750  box-sizing: border-box;
751  box-shadow: 0 0 0 9999em;
752  color: rgba(0, 0, 0, 0.5);
753  overflow: hidden;
754}
755
756.reactEasyCrop_CropAreaRound {
757  border-radius: 50%;
758}
759
760.reactEasyCrop_CropAreaGrid::before {
761  content: ' ';
762  box-sizing: border-box;
763  position: absolute;
764  border: 1px solid rgba(255, 255, 255, 0.5);
765  top: 0;
766  bottom: 0;
767  left: 33.33%;
768  right: 33.33%;
769  border-top: 0;
770  border-bottom: 0;
771}
772
773.reactEasyCrop_CropAreaGrid::after {
774  content: ' ';
775  box-sizing: border-box;
776  position: absolute;
777  border: 1px solid rgba(255, 255, 255, 0.5);
778  top: 33.33%;
779  bottom: 33.33%;
780  left: 0;
781  right: 0;
782  border-left: 0;
783  border-right: 0;
784}
785`,uX=1,hX=3,fX=1,pX=function(e){u$(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.cropperRef=k.createRef(),n.imageRef=k.createRef(),n.videoRef=k.createRef(),n.containerPosition={x:0,y:0},n.containerRef=null,n.styleRef=null,n.containerRect=null,n.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},n.dragStartPosition={x:0,y:0},n.dragStartCrop={x:0,y:0},n.gestureZoomStart=0,n.gestureRotationStart=0,n.isTouching=!1,n.lastPinchDistance=0,n.lastPinchRotation=0,n.rafDragTimeout=null,n.rafPinchTimeout=null,n.wheelTimer=null,n.currentDoc=typeof document<"u"?document:null,n.currentWindow=typeof window<"u"?window:null,n.resizeObserver=null,n.previousCropSize=null,n.isInitialized=!1,n.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},n.initResizeObserver=function(){if(!(typeof window.ResizeObserver>"u"||!n.containerRef)){var r=!0;n.resizeObserver=new window.ResizeObserver(function(i){if(r){r=!1;return}n.computeSizes()}),n.resizeObserver.observe(n.containerRef)}},n.preventZoomSafari=function(r){return r.preventDefault()},n.cleanEvents=function(){n.currentDoc&&(n.currentDoc.removeEventListener("mousemove",n.onMouseMove),n.currentDoc.removeEventListener("mouseup",n.onDragStopped),n.currentDoc.removeEventListener("touchmove",n.onTouchMove),n.currentDoc.removeEventListener("touchend",n.onDragStopped),n.currentDoc.removeEventListener("gesturechange",n.onGestureChange),n.currentDoc.removeEventListener("gestureend",n.onGestureEnd),n.currentDoc.removeEventListener("scroll",n.onScroll))},n.clearScrollEvent=function(){n.containerRef&&n.containerRef.removeEventListener("wheel",n.onWheel),n.wheelTimer&&clearTimeout(n.wheelTimer)},n.onMediaLoad=function(){var r=n.computeSizes();r&&(n.previousCropSize=r,n.emitCropData(),n.setInitialCrop(r),n.isInitialized=!0),n.props.onMediaLoaded&&n.props.onMediaLoaded(n.mediaSize)},n.setInitialCrop=function(r){if(n.props.initialCroppedAreaPercentages){var i=oX(n.props.initialCroppedAreaPercentages,n.mediaSize,n.props.rotation,r,n.props.minZoom,n.props.maxZoom),s=i.crop,a=i.zoom;n.props.onCropChange(s),n.props.onZoomChange&&n.props.onZoomChange(a)}else if(n.props.initialCroppedAreaPixels){var l=lX(n.props.initialCroppedAreaPixels,n.mediaSize,n.props.rotation,r,n.props.minZoom,n.props.maxZoom),s=l.crop,a=l.zoom;n.props.onCropChange(s),n.props.onZoomChange&&n.props.onZoomChange(a)}},n.computeSizes=function(){var r,i,s,a,l,c,d=n.imageRef.current||n.videoRef.current;if(d&&n.containerRef){n.containerRect=n.containerRef.getBoundingClientRect(),n.saveContainerPosition();var u=n.containerRect.width/n.containerRect.height,f=((r=n.imageRef.current)===null||r===void 0?void 0:r.naturalWi
785dth)||((i=n.videoRef.current)===null||i===void 0?void 0:i.videoWidth)||0,p=((s=n.imageRef.current)===null||s===void 0?void 0:s.naturalHeight)||((a=n.videoRef.current)===null||a===void 0?void 0:a.videoHeight)||0,h=d.offsetWidth<f||d.offsetHeight<p,x=f/p,g=void 0;if(h)switch(n.state.mediaObjectFit){default:case"contain":g=u>x?{width:n.containerRect.height*x,height:n.containerRect.height}:{width:n.containerRect.width,height:n.containerRect.width/x};break;case"horizontal-cover":g={width:n.containerRect.width,height:n.containerRect.width/x};break;case"vertical-cover":g={width:n.containerRect.height*x,height:n.containerRect.height};break}else g={width:d.offsetWidth,height:d.offsetHeight};n.mediaSize=ur(ur({},g),{naturalWidth:f,naturalHeight:p}),n.props.setMediaSize&&n.props.setMediaSize(n.mediaSize);var b=n.props.cropSize?n.props.cropSize:tX(n.mediaSize.width,n.mediaSize.height,n.containerRect.width,n.containerRect.height,n.props.aspect,n.props.rotation);return(((l=n.state.cropSize)===null||l===void 0?void 0:l.height)!==b.height||((c=n.state.cropSize)===null||c===void 0?void 0:c.width)!==b.width)&&n.props.onCropSizeChange&&n.props.onCropSizeChange(b),n.setState({cropSize:b},n.recomputeCropPosition),n.props.setCropSize&&n.props.setCropSize(b),b}},n.saveContainerPosition=function(){if(n.containerRef){var r=n.containerRef.getBoundingClientRect();n.containerPosition={x:r.left,y:r.top}}},n.onMouseDown=function(r){n.currentDoc&&(r.preventDefault(),n.currentDoc.addEventListener("mousemove",n.onMouseMove),n.currentDoc.addEventListener("mouseup",n.onDragStopped),n.saveContainerPosition(),n.onDragStart(t.getMousePoint(r)))},n.onMouseMove=function(r){return n.onDrag(t.getMousePoint(r))},n.onScroll=function(r){n.currentDoc&&(r.preventDefault(),n.saveContainerPosition())},n.onTouchStart=function(r){n.currentDoc&&(n.isTouching=!0,!(n.props.onTouchRequest&&!n.props.onTouchRequest(r))&&(n.currentDoc.addEventListener("touchmove",n.onTouchMove,{passive:!1}),n.currentDoc.addEventListener("touchend",n.onDragStopped),n.saveContainerPosition(),r.touches.length===2?n.onPinchStart(r):r.touches.length===1&&n.onDragStart(t.getTouchPoint(r.touches[0]))))},n.onTouchMove=function(r){r.preventDefault(),r.touches.length===2?n.onPinchMove(r):r.touches.length===1&&n.onDrag(t.getTouchPoint(r.touches[0]))},n.onGestureStart=function(r){n.currentDoc&&(r.preventDefault(),n.currentDoc.addEventListener("gesturechange",n.onGestureChange),n.currentDoc.addEventListener("gestureend",n.onGestureEnd),n.gestureZoomStart=n.props.zoom,n.gestureRotationStart=n.props.rotation)},n.onGestureChange=function(r){if(r.preventDefault(),!n.isTouching){var i=t.getMousePoint(r),s=n.gestureZoomStart-1+r.scale;if(n.setNewZoom(s,i,{shouldUpdatePosition:!0}),n.props.onRotationChange){var a=n.gestureRotationStart+r.rotation;n.props.onRotationChange(a)}}},n.onGestureEnd=function(r){n.cleanEvents()},n.onDragStart=function(r){var i,s,a=r.x,l=r.y;n.dragStartPosition={x:a,y:l},n.dragStartCrop=ur({},n.props.crop),(s=(i=n.props).onInteractionStart)===null||s===void 0||s.call(i)},n.onDrag=function(r){var i=r.x,s=r.y;n.currentWindow&&(n.rafDragTimeout&&n.currentWindow.cancelAnimationFrame(n.rafDragTimeout),n.rafDragTimeout=n.currentWindow.requestAnimationFrame(function(){if(n.state.cropSize&&!(i===void 0||s===void 0)){var a=i-n.dragStartPosition.x,l=s-n.dragStartPosition.y,c={x:n.dragStartCrop.x+a,y:n.dragStartCrop.y+l},d=n.props.restrictPosition?Nh(c,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):c;n.props.onCropChange(d)}}))},n.onDragStopped=function(){var r,i;n.isTouching=!1,n.cleanEvents(),n.emitCropData(),(i=(r=n.props).onInteractionEnd)===null||i===void 0||i.call(r)},n.onWheel=function(r){if(n.currentWindow&&!(n.props.onWheelRequest&&!n.props.onWheelRequest(r))){r.preventDefault();var i=t.getMousePoint(r),s=eX(r).pixelY,a=n.props.zoom-s*n.props.zoomSpeed/200;n.setNewZoom(a,i,{shouldUpdatePosition:!0}),n.state.hasWheelJustStarted||n.setState({hasWheelJustStarted:!0},function(){var l,c;return(c=(l=n.props).onInteractionStart)===null||c===void 0?void 0:c.call(l)}),n.wheelTimer&&clearTimeout(n.wheelTimer),n.wheelTimer=n.currentWindow.setTimeout(function(){return n.setState({hasWheelJustStarted:!1},function(){var l,c;return(c=(l=n.props).onInteractionEnd)===null||c===void 0?void 0:c.call(l)})},250)}},n.getPointOnContainer=function(r,i){var s=r.x,a=r.y;if(!n.containerRect)throw new Error("The Cropper is not mounted");return{x:n.containerRect.width/2-(s-i.x),y:n.containerRect.height/2-(a-i.y)}},n.getPointOnMedia=function(r){var i=r.x,s=r.y,a=n.props,l=a.crop,c=a.zoom;return{x:(i+l.x)/c,y:(s+l.y)/c}},n.setNewZoom=function(r,i,s){var a=s===void 0?{}:s,l=a.shouldUpdatePosition,c=l===void 0?!0:l;if(!(!n.state.cropSize||!n.props.onZoomChange)){var d=cx(r,n.props.minZoom,n.props.maxZoom);if(c){var u=n.getPointOnContainer(i,n.containerPosition),f=n.getPointOnMedia(u),p={x:f.x*d-u.x,y:f.y*d-u.y},h=n.props.restrictPosition?Nh(p,n.mediaSize,n.state.cropSize,d,n.props.rotation):p;n.props.onCropChange(h)}n.props.onZoomChange(d)}},n.getCropData=function(){if(!n.state.cropSize)return null;var r=n.props.restrictPosition?Nh(n.props.crop,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):n.props.crop;return rX(r,n.mediaSize,n.state.cropSize,n.getAspect(),n.props.zoom,n.props.rotation,n.props.restrictPosition)},n.emitCropData=function(){var r=n.getCropData();if(r){var i=r.croppedAreaPercentages,s=r.croppedAreaPixels;n.props.onCropComplete&&n.props.onCropComplete(i,s),n.props.onCropAreaChange&&n.props.onCropAreaChange(i,s)}},n.emitCropAreaChange=function(){var r=n.getCropData();if(r){var i=r.croppedAreaPercentages,s=r.croppedAreaPixels;n.props.onCropAreaChange&&n.props.onCropAreaChange(i,s)}},n.recomputeCropPosition=function(){var r,i;if(n.state.cropSize){var s=n.props.crop;if(n.isInitialized&&(!((r=n.previousCropSize)===null||r===void 0)&&r.width)&&(!((i=n.previousCropSize)===null||i===void 0)&&i.height)){var a=Math.abs(n.previousCropSize.width-n.state.cropSize.width)>1e-6||Math.abs(n.previousCropSize.height-n.state.cropSize.height)>1e-6;if(a){var l=n.state.cropSize.width/n.previousCropSize.width,c=n.state.cropSize.height/n.previousCropSize.height;s={x:n.props.crop.x*l,y:n.props.crop.y*c}}}var d=n.props.restrictPosition?Nh(s,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):s;n.previousCropSize=n.state.cropSize,n.props.onCropChange(d),n.emitCropData()}},n.onKeyDown=function(r){var i,s,a=n.props,l=a.crop,c=a.onCropChange,d=a.keyboardStep,u=a.zoom,f=a.rotation,p=d;if(n.state.cropSize){r.shiftKey&&(p*=.2);var h=ur({},l);switch(r.key){case"ArrowUp":h.y-=p,r.preventDefault();break;case"ArrowDown":h.y+=p,r.preventDefault();break;case"ArrowLeft":h.x-=p,r.preventDefault();break;case"ArrowRight":h.x+=p,r.preventDefault();break;default:return}n.props.restrictPosition&&(h=Nh(h,n.mediaSize,n.state.cropSize,u,f)),r.repeat||(s=(i=n.props).onInteractionStart)===null||s===void 0||s.call(i),c(h)}},n.onKeyUp=function(r){var i,s;switch(r.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":r.preventDefault();break;default:return}n.emitCropData(),(s=(i=n.props).onInteractionEnd)===null||s===void 0||s.call(i)},n}return t.prototype.componentDidMount=function(){!this.currentDoc||!this.currentWindow||(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),typeof window.ResizeObserver>"u"&&this.currentWindow.addEventListener("resize",this.computeSizes),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.currentDoc.addEventListener("scroll",this.onScroll),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=dX,this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef),this.props.setCropperRef&&this.props.setCropperRef(this.cropperRef))},t.prototype.componentWillUnmount=function(){var n,r;!this.currentDoc||!this.currentWindow||(typeof window.ResizeObserver>"u"&&this.currentWindow.removeEventListener("resize",this.computeSizes),(n=this.resizeObserver)===null||n===void 0||n.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef&&((r=this.styleRef.parentNode)===null||r===void 0||r.removeChild(this.styleRef)),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent())},t.prototype.componentDidUpdate=function(n){var r,i,s,a,l,c,d,u,f;n.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):n.aspect!==this.props.aspect?this.computeSizes():n.objectFit!==this.props.objectFit?this.computeSizes():n.zoom!==this.props.zoom?this.recomputeCropPosition():((r=n.cropSize)===null||r===void 0?void 0:r.height)!==((i=this.props.cropSize)===null||i===void 0?void 0:i.height)||((s=n.cropSize)===null||s===void 0?void 0:s.width)!==((a=this.props.cropSize)===null||a===void 0?void 0:a.width)?this.computeSizes():(((l=n.crop)===null||l===void 0?void 0:l.x)!==((c=this.props.crop)===null||c===void 0?void 0:c.x)||((d=n.crop)===null||d===void 0?void 0:d.y)!==((u=this.props.crop)===null||u===void 0?void 0:u.y))&&this.emitCropAreaChange(),n.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),n.video!==this.props.video&&((f=this.videoRef.current)===null||f===void 0||f.load());var p=this.getObjectFit();p!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:p},this.computeSizes)},t.prototype.getAspect=function(){var n=this.props,r=n.cropSize,i=n.aspect;return r?r.width/r.height:i},t.prototype.getObjectFit=function(){var n,r,i,s;if(this.props.objectFit==="cover"){var a=this.imageRef.current||this.videoRef.current;if(a&&this.containerRef){this.containerRect=this.containerRef.getBoundingClientRect();var l=this.containerRect.width/this.containerRect.height,c=((n=this.imageRef.current)===null||n===void 0?void 0:n.naturalWi
785dth)||((r=this.videoRef.current)===null||r===void 0?void 0:r.videoWidth)||0,d=((i=this.imageRef.current)===null||i===void 0?void 0:i.naturalHeight)||((s=this.videoRef.current)===null||s===void 0?void 0:s.videoHeight)||0,u=c/d;return u<l?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit},t.prototype.onPinchStart=function(n){var r=t.getTouchPoint(n.touches[0]),i=t.getTouchPoint(n.touches[1]);this.lastPinchDistance=Ij(r,i),this.lastPinchRotation=Dj(r,i),this.onDragStart(Fj(r,i))},t.prototype.onPinchMove=function(n){var r=this;if(!(!this.currentDoc||!this.currentWindow)){var i=t.getTouchPoint(n.touches[0]),s=t.getTouchPoint(n.touches[1]),a=Fj(i,s);this.onDrag(a),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(function(){var l=Ij(i,s),c=r.props.zoom*(l/r.lastPinchDistance);r.setNewZoom(c,a,{shouldUpdatePosition:!1}),r.lastPinchDistance=l;var d=Dj(i,s),u=r.props.rotation+(d-r.lastPinchRotation);r.props.onRotationChange&&r.props.onRotationChange(u),r.lastPinchRotation=d})}},t.prototype.render=function(){var n=this,r,i=this.props,s=i.image,a=i.video,l=i.mediaProps,c=i.cropperProps,d=i.transform,u=i.crop,f=u.x,p=u.y,h=i.rotation,x=i.zoom,g=i.cropShape,b=i.showGrid,y=i.roundCropAreaPixels,_=i.style,w=_.containerStyle,S=_.cropAreaStyle,C=_.mediaStyle,P=i.classes,R=P.containerClassName,M=P.cropAreaClassName,T=P.mediaClassName,H=(r=this.state.mediaObjectFit)!==null&&r!==void 0?r:this.getObjectFit();return k.createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(O){return n.containerRef=O},"data-testid":"container",style:w,className:Um("reactEasyCrop_Container",R)},s?k.createElement("img",ur({alt:"",className:Um("reactEasyCrop_Image",H==="contain"&&"reactEasyCrop_Contain",H==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",H==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",T)},l,{src:s,ref:this.imageRef,style:ur(ur({},C),{transform:d||"translate(".concat(f,"px, ").concat(p,"px) rotate(").concat(h,"deg) scale(").concat(x,")")}),onLoad:this.onMediaLoad})):a&&k.createElement("video",ur({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:Um("reactEasyCrop_Video",H==="contain"&&"reactEasyCrop_Contain",H==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",H==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",T)},l,{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:ur(ur({},C),{transform:d||"translate(".concat(f,"px, ").concat(p,"px) rotate(").concat(h,"deg) scale(").concat(x,")")}),controls:!1}),(Array.isArray(a)?a:[{src:a}]).map(function(A){return k.createElement("source",ur({key:A.src},A))})),this.state.cropSize&&k.createElement("div",ur({ref:this.cropperRef,style:ur(ur({},S),{width:y?Math.round(this.state.cropSize.width):this.state.cropSize.width,height:y?Math.round(this.state.cropSize.height):this.state.cropSize.height}),tabIndex:0,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,"data-testid":"cropper",className:Um("reactEasyCrop_CropArea",g==="round"&&"reactEasyCrop_CropAreaRound",b&&"reactEasyCrop_CropAreaGrid",M)},c)))},t.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:hX,minZoom:uX,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},cropperProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0,keyboardStep:fX},t.getMousePoint=function(n){return{x:Number(n.clientX),y:Number(n.clientY)}},t.getTouchPoint=function(n){return{x:Number(n.clientX),y:Number(n.clientY)}},t}(k.Component),dx="Dialog",[c8,eee]=kc(dx),[mX,Ls]=c8(dx),d8=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!0}=e,l=k.useRef(null),c=k.useRef(null),[d,u]=$0({prop:r,defaultProp:i??!1,onChange:s,caller:dx});return o.jsx(mX,{scope:t,triggerRef:l,contentRef:c,contentId:lg(),titleId:lg(),descriptionId:lg(),open:d,onOpenChange:u,onOpenToggle:k.useCallback(()=>u(f=>!f),[u]),modal:a,children:n})};d8.displayName=dx;var u8="DialogTrigger",gX=k.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ls(u8,n),s=Ln(t,i.triggerRef);return o.jsx(rn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Z2
vendor: 7,332 bytes, lines 785-789
785(i.open),...r,ref:s,onClick:Ft(e.onClick,i.onOpenToggle)})});gX.displayName=u8;var J2="DialogPortal",[xX,h8]=c8(J2,{forceMount:void 0}),f8=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,s=Ls(J2,t);return o.jsx(xX,{scope:t,forceMount:n,children:k.Children.map(r,a=>o.jsx(hl,{present:n||s.open,children:o.jsx(M0,{asChild:!0,container:i,children:a})}))})};f8.displayName=J2;var x0="DialogOverlay",p8=k.forwardRef((e,t)=>{const n=h8(x0,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,s=Ls(x0,e.__scopeDialog);return s.modal?o.jsx(hl,{present:r||s.open,children:o.jsx(bX,{...i,ref:t})}):null});p8.displayName=x0;var vX=hu("DialogOverlay.RemoveScroll"),bX=k.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ls(x0,n);return o.jsx(H2,{as:vX,allowPinchZoom:!0,shards:[i.contentRef],children:o.jsx(rn.div,{"data-state":Z2(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),bc="DialogContent",m8=k.forwardRef((e,t)=>{const n=h8(bc,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,s=Ls(bc,e.__scopeDialog);return o.jsx(hl,{present:r||s.open,children:s.modal?o.jsx(yX,{...i,ref:t}):o.jsx(wX,{...i,ref:t})})});m8.displayName=bc;var yX=k.forwardRef((e,t)=>{const n=Ls(bc,e.__scopeDialog),r=k.useRef(null),i=Ln(t,n.contentRef,r);return k.useEffect(()=>{const s=r.current;if(s)return _P(s)},[]),o.jsx(g8,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ft(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Ft(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&s.preventDefault()}),onFocusOutside:Ft(e.onFocusOutside,s=>s.preventDefault())})}),wX=k.forwardRef((e,t)=>{const n=Ls(bc,e.__scopeDialog),r=k.useRef(!1),i=k.useRef(!1);return o.jsx(g8,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,l;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=s.target;((d=n.triggerRef.current)==null?void 0:d.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),g8=k.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...a}=e,l=Ls(bc,n),c=k.useRef(null),d=Ln(t,c);return bP(),o.jsxs(o.Fragment,{children:[o.jsx(W2,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:o.jsx(Xf,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Z2(l.open),...a,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(_X,{titleId:l.titleId}),o.jsx(NX,{contentRef:c,descriptionId:l.descriptionId})]})]})}),X2="DialogTitle",x8=k.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ls(X2,n);return o.jsx(rn.h2,{id:i.titleId,...r,ref:t})});x8.displayName=X2;var v8="DialogDescription",b8=k.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ls(v8,n);return o.jsx(rn.p,{id:i.descriptionId,...r,ref:t})});b8.displayName=v8;var y8="DialogClose",w8=k.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Ls(y8,n);return o.jsx(rn.button,{type:"button",...r,ref:t,onClick:Ft(e.onClick,()=>i.onOpenChange(!1))})});w8.displayName=y8;function Z2(e){return e?"open":"closed"}var _8="DialogTitleWarning",[tee,k8]=kD(_8,{contentName:bc,titleName:X2,docsSlug:"dialog"}),_X=({titleId:e})=>{const t=k8(_8),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
786
787If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
788
789For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return k.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},kX="DialogDescriptionWarning",NX=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${k8(kX).contentName}}.`;return k.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},SX=d8,jX=f8,N8=p8,S8=m8,j8=x8,E8=b8,EX=w8;const C8=SX,CX=jX,A8=k.forwardRef(({className:e,...t},n)=>o.jsx(N8,{ref:n,className:Bn("fixed inset-0 z-[1000] 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}));A8.displayName=N8.displayName;const Q2=k.forwardRef(({className:e,children:t,...n},r)=>o.jsxs(CX,{children:[o.jsx(A8,{}),o.jsxs(S8,{ref:r,className:Bn("fixed left-[50%] top-[var(--embed-center,50%)] z-[1001] grid max-h-[calc(var(--embed-visible-height,100vh)-2rem)] w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 overflow-y-auto overscroll-contain border bg-background p-4 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:p-6 sm:rounded-lg",e),...n,children:[t,o.jsxs(EX,{className:"absolute right-2 top-2 inline-flex h-11 w-11 items-center justify-center 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 sm:right-3 sm:top-3",children:[o.jsx(Hr,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Q2.displayName=S8.displayName;const e5=({className:e,...t})=>o.jsx("div",{className:Bn("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});e5.displayName="DialogHeader";const P8=({className:e,...t})=>o.jsx("div",{className:Bn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});P8.displayName="DialogFooter";const t5=k.forwardRef(({className:e,...t},n)=>o.jsx(j8,{ref:n,className:Bn("text-lg font-semibold leading-none tracking-tight",e),...t}));t5.displayName=j8.displayName;const L8=k.forwardRef(({className:e,...t},n)=>o.jsx(E8,{ref:n,className:Bn("text-sm text-muted-foreground",e),...t}));L8.displayName=E8.displayName;function R8(e,[t,n]){return Math.min(n,Math.max(t,e))}var AX=k.createContext(void 0);function PX(e){const t=k.useContext(AX);return e||t||"ltr"}function LX(e){const t=k.useRef({value:e,previous:e});return k.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var T8=["PageUp","PageDown"],O8=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],I8={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Iu="Slider",[W1,RX,TX]=eC(Iu),[D8,nee]=kc(Iu,[TX]),[OX,ux]=D8(Iu),F8=k.forwardRef((e,t)=>
789{const{name:n,min:r=0,max:i=100,step:s=1,orientation:a="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[r],value:u,onValueChange:f=()=>{},onValueCommit:p=()=>{},inverted:h=!1,form:x,...g}=e,b=k.useRef(new Set),y=k.useRef(0),w=a==="horizontal"?IX:DX,[S=[],C]=$0({prop:u,defaultProp:d,onChange:A=>{var K;(K=[...b.current][y.current])==null||K.focus(),f(A)}}),P=k.useRef(S);function R(A){const O=UX(S,A);H(A,O)}function M(A){H(A,y.current)}function T(){const A=P.current[y.current];S[y.current]!==A&&p(S)}function H(A,O,{commit:K}={commit:!1}){const U=HX(s),I=VX(Math.round((A-r)/s)*s+r,U),re=R8(I,[r,i]);C((V=[])=>{const $=$X(V,re,O);if(WX($,c*s)){y.current=$.indexOf(re);const D=String($)!==String(V);return D&&K&&p($),D?$:V}else return V})}return o.jsx(OX,{scope:e.__scopeSlider,name:n,disabled:l,min:r,max:i,valueIndexToChangeRef:y,thumbs:b.current,values:S,orientation:a,form:x,children:o.jsx(W1.Provider,{scope:e.__scopeSlider,children:o.jsx(W1.Slot,{scope:e.__scopeSlider,children:o.jsx(w,{"aria-disabled":l,"data-disabled":l?"":void 0,...g,ref:t,onPointerDown:Ft(g.onPointerDown,()=>{l||(P.current=S)}),min:r,max:i,inverted:h,onSlideStart:l?void 0:R,onSlideMove:l?void 0:M,onSlideEnd:l?void 0:T,onHomeKeyDown:()=>!l&&H(r,0,{commit:!0}),onEndKeyDown:()=>!l&&H(i,S.length-1,{commit:!0}),onStepKeyDown:({event:A,direction:O})=>{if(!l){const I=T8.includes(A.key)||A.shiftKey&&O8.includes(A.key)?10:1,re=y.current,V=S[re],$=s*I*O;H(V+$,re,{commit:!0})}}})})})})});F8.displayName=Iu;var[M8,$8]=D8(Iu,{startEdge:"left",endEdge:"right",size:"width",direction:1}),IX=k.forwardRef((e,t)=>{const{min:n,max:r,dir:i,inverted:s,onSlideStart:a,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...u}=e,[f,p]=k.useState(null),h=Ln(t,w=>p(w)),x=k.useRef(void 0),g=PX(i),b=g==="ltr",y=b&&!s||!b&&s;function _(w){const S=x.current||f.getBoundingClientRect(),C=[0,S.width],R=n5(C,y?[n,r]:[r,n]);return x.current=S,R(w-S.left)}return o.jsx(M8,{scope:e.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:o.jsx(B8,{dir:g,"data-orientation":"horizontal",...u,ref:h,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const S=_(w.clientX);a==null||a(S)},onSlideMove:w=>{const S=_(w.clientX);l==null||l(S)},onSlideEnd:()=>{x.current=void 0,c==null||c()},onStepKeyDown:w=>{const C=I8[y?"from-left":"from-right"].includes(w.key);d==null||d({event:w,direction:C?-1:1})}})})}),DX=k.forwardRef((e,t)=>{const{min:n,max:r,inverted:i,onSlideStart:s,onSlideMove:a,onSlideEnd:l,onStepKeyDown:c,...d}=e,u=k.useRef(null),f=Ln(t,u),p=k.useRef(void 0),h=!i;function x(g){const b=p.current||u.current.getBoundingClientRect(),y=[0,b.height],w=n5(y,h?[r,n]:[n,r]);return p.current=b,w(g-b.top)}return o.jsx(M8,{scope:e.__scopeSlider,startEdge:h?"bottom":"top",endEdge:h?"top":"bottom",size:"height",direction:h?1:-1,children:o.jsx(B8,{"data-orientation":"vertical",...d,ref:f,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:g=>{const b=x(g.clientY);s==null||s(b)},onSlideMove:g=>{const b=x(g.clientY);a==null||a(b)},onSlideEnd:()=>{p.current=void 0,l==null||l()},onStepKeyDown:g=>{const y=I8[h?"from-bottom":"from-top"].includes(g.key);c==null||c({event:g,direction:y?-1:1})}})})}),B8=k.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:s,onHomeKeyDown:a,onEndKeyDown:l,onStepKeyDown:c,...d}=e,u=ux(Iu,n);return o.jsx(rn.span,{...d,ref:t,onKeyDown:Ft(e.onKeyDown,f=>{f.key==="Home"?(a(f),f.preventDefault()):f.key==="End"?(l(f),f.preventDefault()):T8.concat(O8).includes(f.key)&&(c(f),f.preventDefault())}),onPointerDown:Ft(e.onPointerDown,f=>{const p=f.target;p.setPointerCapture(f.pointerId),f.preventDefault(),u.thumbs.has(p)?p.focus():r(f)}),onPointerMove:Ft(e.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&i(f)}),onPointerUp:Ft(e.onPointerUp,f=>{const p=f.target;p.hasPointerCapture(f.pointerId)&&(p.releasePointerCapture(f.pointerId),s(f))})})}),U8="SliderTrack",z8=k.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,i=ux(U8,n);return o.jsx(rn.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:t})});z8.displayName=U8;var H1="SliderRange",q8=k.forwardRef((e,t)=>
789{const{__scopeSlider:n,...r}=e,i=ux(H1,n),s=$8(H1,n),a=k.useRef(null),l=Ln(t,a),c=i.values.length,d=i.values.map(p=>V8(p,i.min,i.max)),u=c>1?Math.min(...d):0,f=100-Math.max(...d);return o.jsx(rn.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:l,style:{...e.style,[s.startEdge]:u+"%",[s.endEdge]:f+"%"}})});q8.displayName=H1;var V1="SliderThumb",W8=k.forwardRef((e,t)=>{const n=RX(e.__scopeSlider),[r,i]=k.useState(null),s=Ln(t,l=>i(l)),a=k.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return o.jsx(FX,{...e,ref:s,index:a})}),FX=k.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:i,...s}=e,a=ux(V1,n),l=$8(V1,n),[c,d]=k.useState(null),u=Ln(t,_=>d(_)),f=c?a.form||!!c.closest("form"):!0,p=nA(c),h=a.values[r],x=h===void 0?0:V8(h,a.min,a.max),g=BX(r,a.values.length),b=p==null?void 0:p[l.size],y=b?zX(b,x,l.direction):0;return k.useEffect(()=>{if(c)return a.thumbs.add(c),()=>{a.thumbs.delete(c)}},[c,a.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${x}% + ${y}px)`},children:[o.jsx(W1.ItemSlot,{scope:e.__scopeSlider,children:o.jsx(rn.span,{role:"slider","aria-label":e["aria-label"]||g,"aria-valuemin":a.min,"aria-valuenow":h,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...s,ref:u,style:h===void 0?{display:"none"}:e.style,onFocus:Ft(e.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),f&&o.jsx(H8,{name:i??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:h},r)]})});W8.displayName=V1;var MX="RadioBubbleInput",H8=k.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const i=k.useRef(null),s=Ln(i,r),a=LX(t);return k.useEffect(()=>{const l=i.current;if(!l)return;const c=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==t&&u){const f=new Event("input",{bubbles:!0});u.call(l,t),l.dispatchEvent(f)}},[a,t]),o.jsx(rn.input,{style:{display:"none"},...n,ref:s,defaultValue:t})});H8.displayName=MX;function $X(e=[],t,n){const r=[...e];return r[n]=t,r.sort((i,s)=>i-s)}function V8(e,t,n){const s=100/(n-t)*(e-t);return R8(s,[0,100])}function BX(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function UX(e,t){if(e.length===1)return 0;const n=e.map(i=>Math.abs(i-t)),r=Math.min(...n);return n.indexOf(r)}function zX(e,t,n){const r=e/2,s=n5([0,50],[0,r]);return(r-s(t)*n)*n}function qX(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function WX(e,t){if(t>0){const n=qX(e);return Math.min(...n)>=t}return!0}function n5(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 HX(e){return(String(e).split(".")[1]||"").length}function VX(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var G8=F8,GX=z8,YX=q8,KX=W8;const Y8=k.forwardRef(({className:e,...t},n)=>o.jsxs(G8,{ref:n,className:Bn("relative flex w-full touch-none select-none items-center",e),...t,children:[o.jsx(GX,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:o.jsx(YX,{className:"absolute h-full bg-primary"})}),o.jsx(KX,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));Y8.displayName=G8.displayName;var JX="Label",K8=k.forwardRef((e,t)=>o.jsx(rn.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())}}));K8.displayName=JX;var J8=K8;const XX=Zw("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),X8=k.forwardRef(({className:e,...t},n)=>o.jsx(J8,{ref:n,className:Bn(XX(),e),...t}));X8.displayName=J8.displayName;const ZX=[{label:"Free",value:"free"},{label:"1:1",value:1},{label:"4:3",value:4/3},{label:"3:4",value:3/4},{label:"16:9",value:16/9}],QX=async(e,t)=>{const n=await new Promise((s,a)=>{const l=new Image;l.crossOrigin="anonymous",l.onload=()=>s(l),l.onerror=a,l.src=e}),r=document.createElement("canvas");r.width=t.width,r.height=t.height;const i=r.getContext("2d");if(!i)throw new Error("No 2d context");return i.drawImage(n,t.x,t.y,t.width,t.height,0,0,t.width,t.height),r.toDataURL("image/jpeg",.92)},eZ=({open:e,imageSrc:t,onCancel:n,onCropComplete:r})=>{const[i,s]=k.useState({x:0,y:0}),[a,l]=k.useState(1),[c,d]=k.useState(1),[u,f]=k.useState(null),[p,h]=k.useState(!1),x=s,g=l,b=k.useCallback((_,w)=>{f(w)},[]),y=async()=>
789{if(!(!t||!u)){h(!0);try{const _=await QX(t,u);r(_),s({x:0,y:0}),l(1)}finally{h(!1)}}};return o.jsx(C8,{open:e,onOpenChange:_=>{_||n()},children:o.jsxs(Q2,{className:"max-w-2xl",children:[o.jsx(e5,{children:o.jsx(t5,{className:"font-display",children:"Crop image"})}),o.jsx("div",{className:"relative h-[min(420px,48vh)] min-h-[240px] w-full overflow-hidden rounded-md bg-muted",children:t&&o.jsx(pX,{image:t,crop:i,zoom:a,aspect:c==="free"?void 0:c,onCropChange:x,onZoomChange:g,onCropComplete:b,restrictPosition:!1})}),o.jsxs("div",{className:"space-y-3 pt-2",children:[o.jsx("div",{className:"flex flex-wrap gap-1.5",children:ZX.map(_=>o.jsx("button",{type:"button",onClick:()=>d(_.value),className:`min-h-[44px] text-xs px-3 py-1 rounded-md border font-body transition-colors ${c===_.value?"bg-foreground text-background border-foreground":"bg-background text-foreground border-input hover:bg-muted"}`,children:_.label},String(_.value)))}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(X8,{className:"text-xs font-body uppercase tracking-wider text-muted-foreground",children:"Zoom"}),o.jsx(Y8,{value:[a],min:1,max:4,step:.05,onValueChange:_=>l(_[0])})]})]}),o.jsxs(P8,{children:[o.jsx(A1,{variant:"outline",onClick:n,disabled:p,children:"Cancel"}),o.jsx(A1,{onClick:y,disabled:p||!u,children:p?"Saving…":"Apply crop"})]})]})})},tZ=2400,nZ=.88;class Sg extends Error{constructor(t,n){super(n),this.fileName=t,this.name="ImageDecodeError"}}const Mj=e=>/heic|heif/i.test(e.type)||/\.(heic|heif)$/i.test(e.name);function rZ(e){return new Promise((t,n)=>{const r=new FileReader;r.onloadend=()=>t(r.result),r.onerror=()=>n(new Error("Could not read the file")),r.readAsDataURL(e)})}async function iZ(e){if(typeof createImageBitmap=="function")try{const n=await createImageBitmap(e);return{src:n,width:n.width,height:n.height}}catch{}const t=await rZ(e);return await new Promise((n,r)=>{const i=new Image;i.onload=()=>n({src:i,width:i.naturalWidth,height:i.naturalHeight}),i.onerror=()=>r(new Error("decode failed")),i.src=t})}async function sZ(e){let t;try{t=await iZ(e)}catch{throw new Sg(e.name,Mj(e)?"This iPhone photo is in HEIC format, which this browser can’t open. On your iPhone: Settings → Camera → Formats → “Most Compatible”, then retake — or share the photo to yourself to convert it to JPEG.":"This file couldn’t be opened as an image. Please upload a JPEG or PNG.")}const{width:n,height:r}=t;if(!n||!r)throw new Sg(e.name,"This image appears to be empty or corrupted.");const i=Math.max(n,r),s=Math.min(1,tZ/i),a=Math.max(1,Math.round(n*s)),l=Math.max(1,Math.round(r*s)),c=document.createElement("canvas");c.width=a,c.height=l;const d=c.getContext("2d");if(!d)throw new Sg(e.name,"This browser could not process the image.");return d.fillStyle="#ffffff",d.fillRect(0,0,a,l),d.drawImage(t.src,0,0,a,l),typeof ImageBitmap<"u"&&t.src instanceof ImageBitmap&&t.src.close(),{dataUrl:c.toDataURL("image/jpeg",nZ),width:a,height:l,originalName:e.name,wasConverted:Mj(e)||!/jpe?g/i.test(e.type),wasDownscaled:s<1}}const v0=768;function oZ(){var i;if(typeof window>"u")return v0;const e=((i=document.documentElement)==null?void 0:i.clientWidth)||0,t=window.innerWidth||0,n=fU(),r=[e,t,n].filter(s=>s>0);return r.length?Math.min(...r):v0}function $j(e=v0){return oZ()<e}function Z8(e=v0){const[t,n]=k.useState(()=>$j(e));return k.useEffect(()=>{var s;const r=()=>n($j(e));r();const i=window.setTimeout(r,250);return window.addEventListener("resize",r),window.addEventListener("orientationchange",r),(s=window.visualViewport)==null||s.addEventListener("resize",r),()=>{var a;window.clearTimeout(i),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),(a=window.visualViewport)==null||a.removeEventListener("resize",r)}},[e]),t}const Lb=1200,G1=1800,Bj=40,Uj=230,zj=90,aZ=e=>new Promise(t=>{const n=new Image;n.onload=()=>{const r=n.naturalWidth,i=n.naturalHeight,s=r*i/1e6,a=Math.max(r,i),l=Math.min(1,256/a),c=Math.max(1,Math.round(r*l)),d=Math.max(1,Math.round(i*l)),u=document.createElement("canvas");u.width=c,u.height=d;const f=u.getContext("2d"),p=[];
789if(!f){t({width:r,height:i,megapixels:s,brightness:128,sharpness:200,warnings:[],level:"good"});return}f.drawImage(n,0,0,c,d);const{data:h}=f.getImageData(0,0,c,d),x=new Float32Array(c*d);let g=0;for(let M=0,T=0;M<h.length;M+=4,T+=1){const H=.299*h[M]+.587*h[M+1]+.114*h[M+2];x[T]=H,g+=H}const b=g/x.length;let y=0,_=0,w=0;for(let M=1;M<d-1;M++)for(let T=1;T<c-1;T++){const H=M*c+T,A=-x[H-c-1]-x[H-c]-x[H-c+1]-x[H-1]+8*x[H]-x[H+1]-x[H+c-1]-x[H+c]-x[H+c+1];y+=A,_+=A*A,w+=1}const S=y/w,C=Math.sqrt(_/w-S*S);a<Lb?p.push(`Low resolution (${r}×${i}). At least ${Lb}px on the long edge is recommended.`):a<G1&&p.push(`Resolution ${r}×${i} works, but ${G1}px+ produces sharper PDFs and listings.`),b<Bj?p.push("Image looks underexposed — try retaking under brighter, even light."):b>Uj&&p.push("Image looks overexposed — try reducing direct light or flash."),C<zj&&p.push("Image may be slightly blurry — verify focus and steady the camera.");const R=a<Lb||b<Bj||b>Uj||C<zj?"poor":p.length>0?"warn":"good";t({width:r,height:i,megapixels:s,brightness:b,sharpness:C,warnings:p,level:R})},n.onerror=()=>t({width:0,height:0,megapixels:0,brightness:128,sharpness:200,warnings:[],level:"good"}),n.src=e}),lZ=({images:e,onImagesChange:t})=>{const n=k.useRef(null),r=k.useRef(null),i=Z8(),[s,a]=k.useState(null),[l,c]=k.useState([]),[d,u]=k.useState([]),[f,p]=k.useState({}),[h,x]=k.useState(null);k.useEffect(()=>{let R=!1;return e.forEach(M=>{f[M]||aZ(M).then(T=>{R||p(H=>H[M]?H:{...H,[M]:T})})}),()=>{R=!0}},[e]);const g=async R=>{if(!R||R.length===0)return;Qn("image_uploaded",{count:R.length},{once:!0}),a({done:0,total:R.length}),c([]);const M=[],T=[],H=[];for(const A of Array.from(R))try{const O=await sZ(A);M.push(O.dataUrl),O.wasConverted&&H.push(`${A.name} was converted to JPEG for compatibility.`)}catch(O){T.push(O instanceof Sg?O.message:`${A.name} could not be processed. Please try a JPEG or PNG.`)}finally{a(O=>O&&{...O,done:O.done+1})}a(null),c(T),u(H),M.length>0&&t([...e,...M])},b=R=>{const M=R.target.files;g(M),R.target.value=""},y=R=>{if(h!==null){const M=e.slice();M[h]=R,t(M),x(null)}},_=()=>{x(null)},w=R=>{const M=e[R];t(e.filter((T,H)=>H!==R)),M&&p(T=>{const{[M]:H,...A}=T;return A})},S=h!==null?e[h]??null:null,C=e.map((R,M)=>({src:R,i:M,q:f[R]})).filter(R=>R.q&&(R.q.level==="warn"||R.q.level==="poor")),P=C.filter(R=>R.q.level==="poor").length;return o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{className:"block text-xs font-semibold font-body uppercase tracking-wider text-muted-foreground",children:"Artwork Images"}),e.length>0&&o.jsxs("div",{className:"space-y-2 mb-2",children:[o.jsx("div",{className:"flex flex-wrap gap-2",children:e.map((R,M)=>{const T=f[R],H=(T==null?void 0:T.level)==="poor"?"border-amber-400 ring-2 ring-amber-200":(T==null?void 0:T.level)==="warn"?"border-amber-300":(T==null?void 0:T.level)==="good"?"border-emerald-300":"border-input";return o.jsxs("div",{className:`relative group w-20 h-20 rounded-md overflow-hidden border ${H}`,title:T?`${T.width}×${T.height} · ${T.warnings.length===0?"Looks good":T.warnings.join(" ")}`:"Analyzing…",children:[o.jsx("img",{src:R,alt:`Artwork ${M+1}`,className:"w-full h-full object-cover"}),(T==null?void 0:T.level)==="good"&&o.jsx("span",{className:"absolute bottom-0.5 left-0.5 bg-emerald-500/90 text-white rounded-full p-0.5",children:o.jsx(z0,{size:10})}),((T==null?void 0:T.level)==="poor"||(T==null?void 0:T.level)==="warn")&&o.jsx("span",{className:"absolute bottom-0.5 left-0.5 bg-amber-500/90 text-white rounded-full p-0.5",children:o.jsx(My,{size:10})}),o.jsxs("div",{className:"absolute top-0.5 right-0.5 flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[o.jsx("button",{type:"button",onClick:()=>
789x(M),className:"bg-foreground/70 text-background rounded-full p-0.5",title:"Crop image",children:o.jsx(P7,{size:12})}),o.jsx("button",{type:"button",onClick:()=>w(M),className:"bg-foreground/70 text-background rounded-full p-0.5",title:"Remove image",children:o.jsx(Hr,{size:12})})]})]},M)})}),C.length>0&&o.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 space-y-1.5",children:[o.jsxs("p",{className:"text-[11px] font-body font-semibold text-amber-900 flex items-center gap-1.5",children:[o.jsx(My,{size:12}),P>0?`${P} image${P===1?"":"s"} may need attention`:`Suggestions for ${C.length} image${C.length===1?"":"s"}`]}),o.jsx("ul",{className:"space-y-0.5",children:C.slice(0,3).map(({i:R,q:M})=>o.jsxs("li",{className:"text-[10px] font-body text-amber-900/80 leading-relaxed",children:[o.jsxs("span",{className:"font-semibold",children:["Image ",R+1,":"]})," ",M.warnings[0]]},R))}),o.jsx("p",{className:"text-[10px] font-body text-amber-900/70 italic",children:"Submissions are still accepted — these are tips for sharper reports and listings."})]})]}),i?o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("button",{type:"button",onClick:()=>{var R;return(R=r.current)==null?void 0:R.click()},disabled:!!s,className:"flex flex-col items-center justify-center gap-1 rounded-md border border-input bg-background py-4 min-h-[76px] active:bg-primary/[0.04] disabled:opacity-60",children:[o.jsx(N7,{size:20,className:"text-primary/70"}),o.jsx("span",{className:"text-xs font-body font-medium",children:"Take photo"})]}),o.jsxs("button",{type:"button",onClick:()=>{var R;return(R=n.current)==null?void 0:R.click()},disabled:!!s,className:"flex flex-col items-center justify-center gap-1 rounded-md border border-input bg-background py-4 min-h-[76px] active:bg-primary/[0.04] disabled:opacity-60",children:[o.jsx(O7,{size:20,className:"text-primary/70"}),o.jsx("span",{className:"text-xs font-body font-medium",children:"Choose photos"})]}),o.jsx("p",{className:"col-span-2 text-[10px] text-muted-foreground/60 font-body text-center",children:"iPhone HEIC photos are converted to JPEG automatically."})]}):o.jsxs("div",{onClick:()=>{var R;return(R=n.current)==null?void 0:R.click()},className:"group border-2 border-dashed border-input rounded-md h-28 flex flex-col items-center justify-center cursor-pointer hover:border-primary hover:bg-primary/[0.02] transition-all",children:[o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground/40 group-hover:text-primary/60 transition-colors mb-2",children:[o.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),o.jsx("circle",{cx:"9",cy:"9",r:"2"}),o.jsx("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]}),o.jsx("span",{className:"text-xs font-medium text-muted-foreground/60 group-hover:text-muted-foreground font-body transition-colors",children:e.length>0?"Add more images":"Click to upload images"}),o.jsxs("span",{className:"text-[10px] text-muted-foreground/50 font-body mt-0.5",children:[G1,"px+ on the long edge recommended"]})]}),s&&o.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-input bg-muted/30 px-3 py-2",children:[o.jsx(Qw,{size:13,className:"animate-spin text-primary"}),o.jsxs("span",{className:"text-[11px] font-body text-muted-foreground",children:["Preparing image ",Math.min(s.done+1,s.total)," of ",s.total,"…"]})]}),l.length>0&&o.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 space-y-1",children:l.map((R,M)=>o.jsx("p",{className:"text-[11px] font-body text-destructive leading-relaxed",children:R},M))}),d.length>0&&l.length===0&&o.jsx("p",{className:"text-[10px] font-body text-muted-foreground/70 italic",children:d[0]}),o.jsx("input",{ref:r,type:"file",accept:"image/*",capture:"environment",onChange:b,className:"hidden"}),o.jsx("input",{ref:n,type:"file",accept:"image/*,.heic,.heif",multiple:!0,onChange:b,className:"hidden"}),o.jsx(eZ,{open:S!==null,imageSrc:S,onCancel:_,onCropComplete:y})]})},cZ={Draft:{update:"Saved without an estimate yet. Open it to finish and calculate a value.",tone
789:"border-border bg-muted/50 text-muted-foreground"},"Estimate ready":{update:"Your indicative estimate is saved. You can request a specialist review or offer it for consignment.",tone:"border-border bg-cream text-foreground"},"Review requested":{update:"Your request has been sent to the Reverie team. We'll follow up by email.",tone:"border-accent/40 bg-accent/10 text-foreground"},"Under review":{update:"A Reverie specialist is looking at this work. We usually reply within 5–7 business days.",tone:"border-accent/40 bg-accent/10 text-foreground"},"More information needed":{update:"We need a little more detail or a clearer photograph before we can continue.",tone:"border-amber-300 bg-amber-50 text-amber-900"},Accepted:{update:"Accepted for consignment. We'll agree pricing with you in writing before anything is listed.",tone:"border-emerald-300 bg-emerald-50 text-emerald-900"},Declined:{update:"We aren't able to take this work on at the moment. You're welcome to submit others.",tone:"border-border bg-muted/60 text-muted-foreground"},Listed:{update:"Listed for sale through Reverie.",tone:"border-sky-300 bg-sky-50 text-sky-900"},Sold:{update:"Sold. We'll confirm your payment details and timing by email.",tone:"border-violet-300 bg-violet-50 text-violet-900"},Paid:{update:"Payment has been issued to you.",tone:"border-emerald-300 bg-emerald-50 text-emerald-900"}},dZ=e=>({label:e,...cZ[e]});function uZ(e){const t=(e.status||"").toLowerCase();return e.submission_type==="consignment"?e.payout_status==="paid"?"Paid":t==="sold"?"Sold":t==="listed"?"Listed":t==="approved"?"Accepted":t==="declined"?"Declined":t==="info_needed"||t==="more_info"?"More information needed":"Under review":e.reviewDecision==="approved"?"Accepted":e.reviewDecision==="declined"?"Declined":e.reviewDecision==="pending"?"Review requested":t==="info_needed"||t==="more_info"?"More information needed":Number(e.formula_value||0)>0||Number(e.ai_value||0)>0?"Estimate ready":"Draft"}
789const hZ=(e,t="USD")=>new Intl.NumberFormat("en-US",{style:"currency",currency:t||"USD",maximumFractionDigits:0}).format(e),fZ=({onOpen:e,onStart:t})=>{const{user:n}=pn(),[r,i]=k.useState([]),[s,a]=k.useState({}),[l,c]=k.useState(!0),d=k.useCallback(async()=>{if(n){c(!0);try{const[u,f]=await Promise.all([Ne.from("submissions").select("*").eq("user_id",n.id).order("created_at",{ascending:!1}).limit(60),Ne.from("valuation_leads").select("submission_id, decision, created_at").eq("kind","specialist_review").eq("requester_user_id",n.id).order("created_at",{ascending:!1}).limit(100)]);i(u.data||[]);const p={};for(const h of f.data||[]){const x=h.submission_id;x&&!p[x]&&(p[x]=h.decision||"pending")}a(p)}finally{c(!1)}}},[n]);return k.useEffect(()=>{d()},[d]),n?l?o.jsx("p",{className:"font-body text-sm text-muted-foreground",children:"Loading your collection…"}):r.length===0?o.jsxs("div",{className:"rounded-md border border-border bg-cream p-8 text-center",children:[o.jsx("h3",{className:"font-display text-xl font-semibold tracking-tight",children:"Nothing saved yet"}),o.jsx("p",{className:"mx-auto mt-2 max-w-md font-body text-sm leading-relaxed text-muted-foreground",children:"Add a work and we'll give you a free indicative estimate in a few minutes. Everything you save stays private to your account."}),o.jsx("button",{onClick:t,className:"mt-5 inline-flex items-center justify-center rounded-md bg-primary px-5 py-3 font-body text-sm font-semibold text-primary-foreground shadow-[var(--shadow-md)] transition-all hover:brightness-105 active:scale-[0.99]",children:"Start a valuation"})]}):o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("p",{className:"font-body text-xs text-muted-foreground",children:[r.length," ",r.length===1?"work":"works"," in your collection"]}),o.jsxs("button",{onClick:()=>void d(),className:"inline-flex items-center gap-1.5 font-body text-xs font-semibold text-muted-foreground hover:text-foreground",children:[o.jsx(Nc,{size:12})," Refresh"]})]}),o.jsx("ul",{className:"space-y-3",children:r.map(u=>{const f=u.submission_type==="consignment",p=uZ({submission_type:u.submission_type,status:u.status,payout_status:u.payout_status,formula_value:u.formula_value,ai_value:u.ai_value,reviewDecision:s[u.id]??null}),h=dZ(p),x=Number(u.ai_value||u.formula_value||0);
789return o.jsxs("li",{className:"flex flex-col gap-4 rounded-md border border-border bg-card p-4 sm:flex-row sm:items-center",children:[o.jsx("div",{className:"h-20 w-20 shrink-0 overflow-hidden rounded bg-muted",children:u.image_url?o.jsx("img",{src:u.image_url,alt:`${u.artwork_title||"Untitled work"} by ${u.artist_name||"unknown artist"}`,loading:"lazy",className:"h-full w-full object-cover"}):o.jsx("div",{className:"flex h-full w-full items-center justify-center font-body text-[10px] uppercase tracking-widest text-muted-foreground",children:"No photo"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("h4",{className:"truncate font-display text-base font-semibold tracking-tight",children:u.artwork_title||"Untitled work"}),o.jsx("span",{className:`rounded-full border px-2 py-0.5 font-body text-[10px] font-semibold uppercase tracking-[0.12em] ${h.tone}`,children:h.label}),f&&o.jsx("span",{className:"rounded-full border border-border bg-muted/50 px-2 py-0.5 font-body text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Consignment"})]}),o.jsxs("p",{className:"mt-0.5 font-body text-xs text-muted-foreground",children:[u.artist_name||"Unknown artist"," ·"," ",new Date(u.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),x>0&&o.jsxs(o.Fragment,{children:[" · ",hZ(x,u.currency||"USD")," indicative"]})]}),o.jsx("p",{className:"mt-1.5 font-body text-xs leading-relaxed text-muted-foreground",children:h.update})]}),o.jsx("div",{className:"shrink-0",children:o.jsx("button",{onClick:()=>e(u),className:"w-full rounded-md border border-input px-4 py-2 font-body text-xs font-semibold transition-all hover:bg-muted/60 sm:w-auto",children:p==="Draft"?"Finish valuation":"Open"})})]},u.id)})})]}):null},Q8=[{q:"Is the estimate a certified appraisal?",a:"No. Reverie's automated estimate is an indicative market range calculated from the details you provide, plus any comparable sales Reverie holds on record for the work — and when none are held, the estimate says so. It is not a certified appraisal and should not be used for insurance claims, tax filings or legal purposes on its own."},{q:"How much does it cost?",a:"The indicative estimate is free. A detailed written report will be available for $9.99 once checkout opens. Specialist review and consignment enquiries are free."},{q:"What if I don't know some of the details?",a:"Leave them blank. Missing information simply widens the estimated range and lowers the confidence score — it never blocks you from getting an estimate."},{q:"What happens after I request a specialist review?",a:"Your request goes to the Reverie team. A specialist looks at the work and replies by email, usually within 5–7 business days. There is no obligation to sell."},{q:"Do you guarantee you will accept my work for consignment?",a:"No. Every submission is reviewed individually. If we accept a work, we agree pricing and terms with you in writing before anything is listed, and we never ask you to send a work until we invite you to."},{q:"Who can see my artwork and my details?",a:"Only you and the Reverie team. Saved works are private to your account and are never published unless you ask us to list them."}],pZ=()=>o.jsxs("section",{"aria-labelledby":"intake-faq",className:"space-y-5",children:[o.jsxs("div",{className:"flex items-start gap-3 rounded-md border border-border bg-cream p-4",children:[o.jsx(W0,{size:18,className:"mt-0.5 shrink-0 text-accent","aria-hidden":!0}),o.jsxs("p",{className:"font-body text-xs leading-relaxed text-muted-foreground",children:[o.jsx("span",{className:"font-semibold text-foreground",children:"Your details stay private."})," Photographs and artwork details are stored securely against your account, visible only to you and the Reverie team. We never publish or sell your information."]})]}),o.jsxs("div",{children:[o.jsx("h3",{id:"intake-faq",className:"font-display text-xl font-semibold tracking-tight",children:"Common questions"}),o.jsx("dl",{className:"mt-3 divide-y divide-border border-y border-border",children:Q8.map(e=>o.jsxs("div",{className:"py-3",children:[o.jsx("dt",{className:"font-body text-sm font-semibold text-foreground",children:e.q}),o.jsx("dd",{className:"mt-1 font-body text-xs leading-relaxed text-muted-foreground",children:e.a})]},e.q))})]})]}),qj=()=>({"@context":"https://schema.org","@type":"FAQPage",mainEntity:Q8.map(e=>
789({"@type":"Question",name:e.q,acceptedAnswer:{"@type":"Answer",text:e.a}}))});function eL(e,t,n={}){const{debounceMs:r=600,enabled:i=!0}=n,[s,a]=k.useState(()=>{if(!i||typeof window>"u")return t;try{const u=window.localStorage.getItem(e);if(u==null)return t;const f=JSON.parse(u);return f&&typeof f=="object"&&!Array.isArray(f)&&t&&typeof t=="object"&&!Array.isArray(t)?{...t,...f}:f}catch{return t}}),[l]=k.useState(()=>{if(!i||typeof window>"u")return!1;try{return window.localStorage.getItem(e)!=null}catch{return!1}}),c=k.useRef(null);return k.useEffect(()=>{if(!(!i||typeof window>"u"))return c.current&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>{try{window.localStorage.setItem(e,JSON.stringify(s))}catch{}},r),()=>{c.current&&window.clearTimeout(c.current)}},[e,s,r,i]),[s,a,()=>{try{window.localStorage.removeItem(e)}catch{}},l]}const mZ=({data:e,valuation:t,onClose:n,onSuccess:r})=>{const{user:i}=pn(),s=i?`reverie:consignment-draft:${i.id}`:"reverie:consignment-draft:anon",[a,l,c,d]=eL(s,{submitterName:"",submitterPhone:"",signatureName:""},{debounceMs:400}),u=Cs(),[f,p]=k.useState(!1),h=a.submitterName,x=a.submitterPhone,g=a.signatureName,b=E=>l(q=>({...q,submitterName:E})),y=E=>l(q=>({...q,submitterPhone:E})),_=E=>l(q=>({...q,signatureName:E})),[w,S]=k.useState(""),[C,P]=k.useState(!1),[R,M]=k.useState(!1),[T,H]=k.useState(null),A=na(n),O=async()=>{try{const E=await fetch("https://api.ipify.org?format=json");if(!E.ok)return null;const q=await E.json();return typeof(q==null?void 0:q.ip)=="string"?q.ip:null}catch{return null}},K=g.trim().length>0&&g.trim().toLowerCase()===h.trim().toLowerCase(),U=e.baseValue+e.baseValue*(e.scarcityMultiplier/100)+e.baseValue*(e.provenanceUplift/100),I=(t==null?void 0:t.fairMarketValue)||U,re=(t==null?void 0:t.retailValue)||0,V=I,$=re||I,D=parseFloat(w),ie=Number.isFinite(D)&&D>0?D:$,X=async()=>{if(i&&!(C||R)){if(!f){me.error("Please accept the consignment terms");return}if(!h.trim()){me.error("Please enter your full name");return}if(!K){me.error("Please type your full name in the signature field, exactly as above");return}P(!0);try{const{data:E}=await Ne.from("submissions").select("id").eq("user_id",i.id).eq("submission_type","consignment").eq("artwork_title",e.artworkTitle||"").eq("artist_name",e.artistName||"").in("status",["pending_review","approved","listed"]).limit(1);if(E&&E.length>0){H(E[0].id),M(!0),me.message("This work is already with our review team.");return}const q=new Date().toISOString(),F=await O();let Z=null;if(e.images.length>0){const Se=e.images[0].match(/^data:(image\/\w+);base64,(.+)$/);if(Se){const De=Se[1],Re=De.split("/")[1]||"jpeg",qe=atob(Se[2]),te=new ArrayBuffer(qe.length),Oe=new Uint8Array(te);for(let ve=0;ve<qe.length;ve++)Oe[ve]=qe.charCodeAt(ve);const be=new Blob([te],{type:De}),se=`${i.id}/consignment/${crypto.randomUUID()}.${Re}`,{error:Q}=await Ne.storage.from("artwork-images").upload(se,be,{contentType:De});if(Q)throw Q;const{data:he}=Ne.storage.from("artwork-images").getPublicUrl(se);Z=he.publicUrl}}const{data:Y,error:ee}=await Ne.from("submissions").insert({user_id:i.id,artist_name:e.artistName,artwork_title:e.artworkTitle,year:e.year,medium:e.medium,dimensions:e.dimensions,condition:e.condition,edition:e.edition,hand_signed:e.handSigned,has_stamp:e.hasStamp,has_coa:e.hasCoa,framed:e.framed,artist_bio:e.artistBio,provenance:e.provenance,exhibition_history:e.exhibitionHistory,base_value:e.baseValue,scarcity_multiplier:e.scarcityMultiplier,provenance_uplift:e.provenanceUplift,asking_price:w.trim()?parseFloat(w):null,...t?{formula_value:t.fairMarketValue||null,value_low:t.rangeLow||null,value_high:t.rangeHigh||null,retail_value:t.retailValue||null,net_on_consignment:t.netOnConsignment||null,formula_confidence:t.confidence||null,commission_rate:null}:{},image_url:Z,submission_type:"consignment",status:"pending_review",consignment_agreed:!0,submitter_name:h.trim(),submitter_phone:x.trim()||null,signature_name:g.trim(),signature_signed_at:q,signature_ip:F}).select("id").single();if(ee)throw ee;const ce=V,ue=(Y==null?void 0:Y.id)||`${i.id}-${Date.now()}`;H(ue),await Ne.functions.invoke("send-transactional-email",{body:{templateName:"new-consignment-submission",recipientEmail:"[email protected]",idempotencyKey:`consignment-notify-${ue}`,templateData:{artistName:e.artistName,artworkTitle:e.artworkTitle,submitterName:h.trim(),medium:e.medium,dimensions:e.dimensions,suggestedValue:ce>
7890?`$${ce.toLocaleString()}`:void 0}}}),i.email&&await Ne.functions.invoke("send-transactional-email",{body:{templateName:"consignment-submitter-confirmation",recipientEmail:i.email,idempotencyKey:`consignment-submitter-confirm-${ue}`,templateData:{submitterName:h.trim(),artistName:e.artistName,artworkTitle:e.artworkTitle,medium:e.medium,dimensions:e.dimensions}}}),Qn("consignment_submitted"),me.success("Consignment submitted for review!"),c(),M(!0)}catch(E){me.error(E.message||"Failed to submit")}finally{P(!1)}}};return R?o.jsx("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center overflow-y-auto overscroll-contain bg-foreground/30 p-4 backdrop-blur-sm",style:u,onClick:n,children:o.jsxs("div",{ref:A,tabIndex:-1,className:"max-h-[calc(var(--embed-visible-height,100vh)-2rem)] w-full max-w-md overflow-y-auto rounded-md border border-border bg-card p-5 text-center shadow-[var(--shadow-lg)] sm:p-6",onClick:E=>E.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"consignment-received-title",children:[o.jsx("div",{className:"text-4xl",children:"✓"}),o.jsx("h3",{id:"consignment-received-title",className:"font-display text-xl font-bold tracking-wide",children:"Submission Received"}),o.jsxs("p",{className:"text-sm font-body text-muted-foreground",children:["Your consignment for ",o.jsx("span",{className:"font-semibold text-foreground",children:e.artworkTitle||"your artwork"})," has been submitted for review. We'll follow up by email."]}),T&&o.jsxs("p",{className:"font-body text-[11px] text-muted-foreground",children:["Reference ",o.jsx("span",{className:"font-semibold text-foreground",children:T.slice(0,8).toUpperCase()})," · ",new Date().toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})]}),o.jsx("ol",{className:"space-y-2 text-left",children:[{t:"Submitted",d:"We have your details and photographs.",done:!0},{t:"Under review",d:"A specialist reviews condition, provenance and demand — usually 5–7 business days.",done:!1},{t:"Pricing agreed",d:"If accepted, we confirm price and terms with you in writing.",done:!1},{t:"Listed",d:"We ask you to send the work only once everything is agreed.",done:!1}].map(E=>o.jsxs("li",{className:"flex gap-2.5",children:[o.jsx("span",{"aria-hidden":!0,className:`mt-1.5 h-2 w-2 shrink-0 rounded-full ${E.done?"bg-accent":"bg-border"}`}),o.jsxs("span",{children:[o.jsx("span",{className:"block font-body text-xs font-semibold text-foreground",children:E.t}),o.jsx("span",{className:"block font-body text-[11px] leading-relaxed text-muted-foreground",children:E.d})]})]},E.t))}),o.jsx("p",{className:"font-body text-[11px] leading-relaxed text-muted-foreground",children:"You can follow this work's progress under My Consignments at any time."}),o.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[o.jsx("button",{onClick:r,className:"w-full px-4 py-3 text-sm font-body font-semibold bg-primary text-primary-foreground rounded-md shadow-[var(--shadow-md)] hover:brightness-105 active:scale-[0.99] transition-all",children:"Submit Another Artwork"}),o.jsx("button",{onClick:n,className:"w-full px-4 py-3 text-sm font-body font-medium text-muted-foreground border border-input rounded-md hover:bg-muted/60 transition-all",children:"Done"})]})]})}):o.jsx("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center overflow-y-auto overscroll-contain bg-foreground
789/30 p-4 backdrop-blur-sm",style:u,onClick:n,children:o.jsxs("div",{ref:A,tabIndex:-1,className:"max-h-[calc(var(--embed-visible-height,100vh)-2rem)] w-full max-w-lg space-y-5 overflow-y-auto rounded-md border border-border bg-card p-5 shadow-[var(--shadow-lg)] sm:p-6",onClick:E=>E.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"consignment-submit-title",children:[o.jsxs("div",{children:[o.jsx("h3",{id:"consignment-submit-title",className:"font-display text-xl font-bold tracking-wide",children:"Submit for Consignment"}),o.jsx("p",{className:"text-xs font-body text-muted-foreground mt-1",children:"Submit your artwork for review by Reverie Fine Art"})]}),o.jsxs("div",{className:"rounded-md border border-border bg-cream p-4",children:[o.jsx("h4",{className:"font-body text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"What to expect"}),o.jsxs("ul",{className:"mt-2 list-disc space-y-1 pl-4 font-body text-[11px] leading-relaxed text-muted-foreground",children:[o.jsx("li",{children:"A Reverie specialist reviews your submission, usually within 5–7 business days."}),o.jsx("li",{children:"Submitting a work does not guarantee that we can accept it."}),o.jsx("li",{children:"We may ask for more photographs, condition detail or provenance documents."}),o.jsx("li",{children:"If we accept the work, price is agreed with you before anything is listed."}),o.jsx("li",{children:"Commission and full terms are confirmed with you in writing separately."}),o.jsx("li",{children:"Do not ship or deliver the work until we ask you to."}),o.jsx("li",{children:"Payment and tax details are only collected after a consignment is accepted."})]})]}),o.jsx("div",{className:"grid grid-cols-3 gap-2 text-center",children:[{n:"1",t:"Submit",d:"Today"},{n:"2",t:"Review",d:"5–7 days"},{n:"3",t:"List & Sell",d:"If approved"}].map(E=>o.jsxs("div",{className:"bg-muted/40 rounded-md py-2 px-1",children:[o.jsxs("div",{className:"text-[10px] font-body font-bold text-muted-foreground",children:["STEP ",E.n]}),o.jsx("div",{className:"text-xs font-body font-semibold text-foreground mt-0.5",children:E.t}),o.jsx("div",{className:"text-[10px] font-body text-muted-foreground",children:E.d})]},E.n))}),o.jsxs("div",{className:"bg-muted/40 rounded-md p-4 flex gap-3 items-start",children:[e.images&&e.images.length>0&&o.jsx("img",{src:e.images[0],alt:e.artworkTitle||"Artwork",className:"w-16 h-16 rounded-sm object-cover border border-border flex-shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("p",{className:"text-sm font-body font-semibold truncate",children:[e.artistName||"Unknown Artist"," — ",o.jsx("span",{className:"italic font-normal text-muted-foreground",children:e.artworkTitle||"Untitled"})]}),e.medium&&o.jsxs("p",{className:"text-xs font-body text-muted-foreground truncate",children:[e.medium,e.dimensions?` · ${e.dimensions}`:""]}),V>0&&o.jsxs("p",{className:"text-sm font-body font-bold mt-1",children:["Fair market value: $",Math.round(V).toLocaleString(),t&&t.rangeLow>0&&o.jsxs("span",{className:"ml-1 font-normal text-muted-foreground",children:["($",Math.round(t.rangeLow).toLocaleString(),"–$",Math.round(t.rangeHigh).toLocaleString(),")"]})]}),re>0&&o.jsxs("p",{className:"text-[11px] font-body text-muted-foreground",children:["Suggested gallery list price $",Math.round(re).toLocaleString(),t!=null&&t.confidence?` · ${t.confidence}% confidence`:""]}),(!e.images||e.images.length===0)&&o.jsx("p",{className:"text-[11px] font-body text-amber-700 mt-1",children:"⚠ No image attached — adding a photo strengthens your submission."})]})]}),$>0&&o.jsxs("div",{className:"border border-primary/30 bg-primary/5 rounded-md p-4 space-y-2",children:[o.jsx("h4",{className:"text-xs font-semibold font-body uppercase tracking-wider text-muted-foreground",children:"Indicative list price"}),o.jsx("div",{className:"flex items-end justify-between gap-3",children:o.jsxs("div",{children:[o.jsx("p",{className:"text-[10px] font-body uppercase tracking-wider text-muted-foreground",children:"Suggested list price"}),o.jsxs("p",{className:"font-display text-2xl font-bold text-foreground",children:["$",Math.round(ie).toLocaleStr
789ing()]})]})}),o.jsx("p",{className:"text-[10px] font-body text-muted-foreground leading-relaxed",children:"This is a starting reference only. Pricing, commission, consignment duration, shipping and all other terms are reviewed and agreed in writing with you before a work is accepted or listed. No commission rate is set by this submission."})]}),(()=>{const E=parseFloat(w),q=Number.isFinite(E)&&E>0,F=q&&V>0?E-V:0,Z=q&&V>0?F/V*100:0;return o.jsxs("div",{className:"border border-border rounded-md p-4 bg-background space-y-2.5",children:[o.jsxs("div",{children:[o.jsxs("label",{className:"block text-xs font-semibold font-body uppercase tracking-wider text-muted-foreground",children:["Your Asking Price ",o.jsx("span",{className:"normal-case font-normal",children:"(optional)"})]}),o.jsx("p",{className:"text-[11px] font-body text-muted-foreground mt-1 leading-relaxed",children:"Tell us what you'd like to ask. The Reverie team will review against the recommended valuation and confirm the final list price with you before listing."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-sm font-body text-muted-foreground",children:"$"}),o.jsx("input",{type:"number",inputMode:"decimal",min:"0",step:"any",value:w,onChange:Y=>S(Y.target.value),placeholder:$>0?$.toFixed(0):"e.g., 5000",className:"flex-1 px-3 py-2 text-sm font-body bg-background border border-input rounded-md focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20 transition-all placeholder:text-muted-foreground/50"})]}),$>0&&o.jsxs("div",{className:"grid grid-cols-3 gap-2 pt-1",children:[o.jsxs("div",{className:"rounded-sm bg-muted/40 px-2.5 py-1.5",children:[o.jsx("div",{className:"text-[9px] font-body uppercase tracking-wider text-muted-foreground",children:"Suggested list"}),o.jsxs("div",{className:"text-sm font-body font-semibold",children:["$",$.toLocaleString(void 0,{maximumFractionDigits:0})]})]}),o.jsxs("div",{className:"rounded-sm bg-muted/40 px-2.5 py-1.5",children:[o.jsx("div",{className:"text-[9px] font-body uppercase tracking-wider text-muted-foreground",children:"Your Asking"}),o.jsx("div",{className:"text-sm font-body font-semibold",children:q?`$${E.toLocaleString(void 0,{maximumFractionDigits:0})}`:"—"})]}),o.jsxs("div",{className:"rounded-sm bg-muted/40 px-2.5 py-1.5",children:[o.jsx("div",{className:"text-[9px] font-body uppercase tracking-wider text-muted-foreground",children:"Your proceeds"}),o.jsx("div",{className:"text-sm font-body font-semibold",children:"Per agreed terms"})]})]}),q&&V>0&&Math.abs(F)>=1&&o.jsxs("p",{className:`text-[11px] font-body ${F>0?"text-amber-700":"text-emerald-700"}`,children:[F>0?"▲":"▼"," ",F>0?"+":"","$",Math.round(F).toLocaleString()," (",Z>0?"+":"",Z.toFixed(1),"%) vs. recommended"]})]})})(),o.jsxs("div",{className:"space-y-3",children:[d&&(h||x||g)&&o.jsxs("div",{className:"flex items-center justify-between gap-2 px-2.5 py-1.5 text-[10px] font-body bg-emerald-50 border border-emerald-200 rounded-sm",children:[o.jsx("span",{className:"text-emerald-800",children:"✓ Draft restored — your details auto-save as you type"}),o.jsx("button",{type:"button",onClick:()=>{c(),l({submitterName:"",submitterPhone:"",signatureName:""})},className:"font-semibold text-emerald-700 hover:underline",children:"Clear"})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{className:"block text-xs font-semibold font-body uppercase tracking-wider text-muted-foreground",children:"Your Full Name *"}),o.jsx("input",{type:"text",value:h,onChange:E=>b(E.target.value),placeholder:"e.g., Jane Smith",className:"w-full px-3.5 py-2.5 text-sm font-medium font-body bg-background border border-input rounded-md shadow-[var(--shadow-sm)] focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20 transition-all placeholder:text-muted-foreground/50"})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("label",{className:"block text-xs font-semibold font-body uppercase tracking-wider text-muted-foreground",children:["Phone Number ",o.jsx("span",{className:"normal-case font-normal",children:"(optional)"})]}),o.jsx("input",{type:"tel",value:x,onChange:E=>y(E.target.value),placeholder:"e.g., (555) 123-4567",className:"w-full px-3.5 py-2.5 text-sm font-medium font-body bg-background border border-input rounded-md shadow-[var(--shadow-sm)] focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20 transition-all placeholder:text-muted-foreground
789/50"})]})]}),o.jsxs("div",{className:"border border-border rounded-md p-4 bg-muted/20 space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold font-body uppercase tracking-wider text-muted-foreground",children:"Consignment Terms"}),o.jsxs("div",{className:"text-xs font-body text-muted-foreground leading-relaxed space-y-2",children:[o.jsx("p",{children:"By submitting your artwork to Reverie Fine Art for consignment, you agree to the following terms:"}),o.jsxs("p",{children:[o.jsx("strong",{className:"text-foreground",children:"Commission & terms:"})," Pricing, commission, consignment duration, shipping and all other commercial terms are reviewed with you and agreed in writing before a work is accepted or listed. Submitting this form does not set or accept any commission rate."]}),o.jsxs("p",{children:[o.jsx("strong",{className:"text-foreground",children:"Pricing:"})," The suggested valuation provided during submission serves as a starting reference. Final retail pricing is agreed in writing with the consignor before listing."]}),o.jsxs("p",{children:[o.jsx("strong",{className:"text-foreground",children:"Review Process:"})," All submissions are subject to review and approval by the Reverie Fine Art team. Submission does not guarantee listing. We reserve the right to decline any submission at our sole discretion."]}),o.jsxs("p",{children:[o.jsx("strong",{className:"text-foreground",children:"Artwork Condition:"})," The consignor warrants that all information provided, including condition reports and provenance, is accurate to the best of their knowledge. Any material misrepresentation may result in removal from the marketplace."]}),o.jsxs("p",{children:[o.jsx("strong",{className:"text-foreground",children:"Duration:"})," The consignment period, renewal and notice terms are confirmed in the written agreement before a work is listed."]})]}),o.jsxs("label",{className:"flex items-start gap-2.5 cursor-pointer select-none pt-1",children:[o.jsx("input",{type:"checkbox",checked:f,onChange:E=>p(E.target.checked),className:"h-4 w-4 rounded border-input accent-primary cursor-pointer mt-0.5"}),o.jsx("span",{className:"text-xs font-body font-semibold text-foreground leading-relaxed",children:"I have read the submission terms and understand that pricing, commission and all other terms are agreed in writing before a work is accepted or listed."})]})]}),o.jsxs("div",{className:"border border-border rounded-md p-4 bg-background space-y-2.5",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-xs font-semibold font-body uppercase tracking-wider text-muted-foreground",children:"Electronic Signature"}),o.jsx("p",{className:"text-[11px] font-body text-muted-foreground mt-1 leading-relaxed",children:"Type your full legal name below to sign this consignment agreement. This typed signature, your IP address, and a timestamp will be stored as a legal record of your acceptance."})]}),o.jsx("input",{type:"text",value:g,onChange:E=>_(E.target.value),placeholder:h.trim()?`Type "${h.trim()}"`:"Enter your full name above first",disabled:!h.trim(),className:"w-full px-3.5 py-3 text-base font-body italic bg-muted/30 border-2 border-input rounded-md focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20 transition-all placeholder:text-muted-foreground/50 placeholder:not-italic disabled:opacity-50 disabled:cursor-not-allowed",style:{fontFamily:"Cormorant Garamond, serif"},autoComplete:"off"}),g.trim().length>0&&!K&&o.jsx("p",{className:"text-[11px] font-body text-amber-700",children:"Signature must match your full name exactly."}),K&&o.jsxs("p",{className:"text-[11px] font-body text-emerald-700",children:["✓ Signed as ",o.jsx("span",{className:"font-semibold",children:g.trim()})," ·"," ",new Date().toLocaleString()]})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:n,className:"flex-1 px-4 py-3 text-sm font-body font-medium text-muted-foreground border border-input rounded-md hover:bg-muted/60 transition-all",children:"Cancel"}),o.jsx("button",{onClick:X,disabled:C||!f||!h.trim()||!K,className:"flex-1 px-4 py-3 text-sm font-body font-semibold bg-primary text-primary-foreground rounded-md shadow-[var(--shadow-md)] hover:brightness-105 active:scale-[0.99] transition-all disabled:opacity-50",children:C?"Submitting…":"Sign & Submit"})]})]})})},Wj={pending_review:{label:"Pending Review",tone:"bg-amber-50 text-amber-900 border-amber-200",Icon:fu,description:"Our curatorial team is reviewing your submission. E
789xpect a reply within 5–7 business days."},approved:{label:"Approved",tone:"bg-emerald-50 text-emerald-900 border-emerald-200",Icon:z0,description:"Approved for consignment. We'll be in touch to confirm pricing and prepare your listing."},listed:{label:"Live in Marketplace",tone:"bg-sky-50 text-sky-900 border-sky-200",Icon:Ud,description:"Your artwork is now listed in the Reverie Fine Art marketplace."},sold:{label:"Sold",tone:"bg-violet-50 text-violet-900 border-violet-200",Icon:Wo,description:"Congratulations — your artwork has sold. Our team will coordinate consignor payment within 3–5 business days."},declined:{label:"Not Selected",tone:"bg-stone-100 text-stone-700 border-stone-200",Icon:CC,description:"We weren't able to move forward this time. Future submissions are welcome."}},tL=e=>{if(e.formula_value)return Number(e.formula_value);const t=e.base_value||0,n=e.scarcity_multiplier||0,r=e.provenance_uplift||0;return t+t*(n/100)+t*(r/100)},Hj=e=>e.commission_rate==null?0:(Number(e.asking_price)||Number(e.retail_value)||tL(e))*(1-Number(e.commission_rate)/100),gZ=({defaultExpanded:e=!1})=>{const{user:t}=pn(),[n,r]=k.useState([]),[i,s]=k.useState(!1),[a,l]=k.useState(e),[c,d]=k.useState(new Set),[u,f]=k.useState(null),[p,h]=k.useState(null),[x,g]=k.useState({}),b=k.useRef([]);k.useEffect(()=>{b.current=n},[n]);const y=A=>{d(O=>new Set(O).add(A)),setTimeout(()=>{d(O=>{const K=new Set(O);return K.delete(A),K})},2200)},_=async(A=!1)=>{if(t){A||s(!0);try{const{data:O,error:K}=await Ne.from("submissions").select("id, artist_name, artwork_title, year, medium, dimensions, image_url, status, admin_notes, created_at, base_value, scarcity_multiplier, provenance_uplift, formula_value, retail_value, asking_price, list_price, net_on_consignment, sale_price, sold_at, commission_rate, payout_amount, payout_status, payout_paid_at, payout_reference, payout_notes").eq("user_id",t.id).eq("submission_type","consignment").order("created_at",{ascending:!1}).limit(20);if(K)throw K;r(O||[]),f(new Date)}catch(O){console.error("Failed to load consignments:",O)}finally{A||s(!1)}}};if(k.useEffect(()=>{a&&t&&_()},[a,t]),k.useEffect(()=>{if(!t)return;const A=Ne.channel(`my-consignments-${t.id}`).on("postgres_changes",{event:"*",schema:"public",table:"submissions",filter:`user_id=eq.${t.id}`},O=>{const K=O.new,U=O.old;if((K||U)&&!(K&&K.submission_type&&K.submission_type!=="consignment"||!K&&U&&U.submission_type&&U.submission_type!=="consignment")){if(O.eventType==="DELETE"&&U){r(re=>re.filter(V=>V.id!==U.id));return}K&&(r(re=>{const V=re.findIndex(ie=>ie.id===K.id);if(V===-1)return y(K.id),[K,...re].slice(0,20);const $=re[V];($.status!==K.status||$.admin_notes!==K.admin_notes)&&y(K.id);const D=[...re];return D[V]={...$,...K},D}),f(new Date))}}).subscribe();return()=>{Ne.removeChannel(A)}},[t]),k.useEffect(()=>{if(!t||n.length===0){g({});return}const A=n.map(K=>K.id);let O=!1;return Ne.from("submission_messages").select("submission_id").in("submission_id",A).eq("sender_role","admin").is("read_at",null).then(({data:K})=>{if(O||!K)return;const U={};K.forEach(I=>{U[I.submission_id]=(U[I.submission_id]||0)+1}),g(U)}),()=>{O=!0}},[t,n]),k.useEffect(()=>{if(!t||n.length===0)return;const A=new Set(n.map(K=>K.id)),O=Ne.channel(`my-consignments-messages-${t.id}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"submission_messages"},K=>{const U=K.new;!A.has(U.submission_id)||U.sender_role!=="admin"||p!==U.submission_id&&g(I=>({...I,[U.submission_id]:(I[U.submission_id]||0)+1}))}).subscribe();return()=>{Ne.removeChannel(O)}},[t,n,p]),!t)return null;const w=Object.values(x).reduce((A,O)=>A+O,0),S=n.filter(A=>A.status==="pending_review").length,C=n.filter(A=>A.status==="sold"||A.sale_price!=null),P=n.filter(A=>!C.includes(A)&&A.status!=="declined"),R=C.filter(A=>A.payout_status==="paid").reduce((A,O)=>A+(Number(O.payout_amount)||0),0),M=C.filter(A=>A.payout_status!=="paid").reduce((A,O)=>A+(Number(O.payout_amount)||0),0),T=P.reduce((A,O)=>A+Hj(O),0),H=A=>`$${Math.round(A).toLocaleString()}`;return o.jsxs("div",{className:"border-t border-border pt-5",children:[o.jsxs("button",{onClick:()=>l(!a),className:"flex items-center justify-between w-full text-sm font-semibold font-body",children:[o.jsxs("span",{className:"flex items-center gap-2",children:["My Consignments",!a&&S>0&&o.jsxs("span",{className:"px-1.5 py-0.5 text-[10px] font-bold bg-amber-100 text-amber-800 rounded-full",children:[S," pending"]}),!a&&w>0&&o.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] font-bold bg-primary text-primary-foreground rounded-full",children:[o.jsx(pu,{size:9}),w," new"]})]}),o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`transition-transform ${a?"rotate-180":""}`,children:o.jsx("path",{d:"m6 9 6 6 6-6"})})]}),a&&o.jsxs("div",{className:"mt-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("p",{className:"text-[10px] font-body text-muted-foreground",children:[o.jsxs("span",{className:"inline-flex items-center gap-1",children:[o.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[o.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-60"}),o.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-emerald-500"})]}),"Live"]}),u&&o.jsxs("span",{className:"ml-2",children:["· Updated ",u.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),o.jsxs("button",{onClick:()=>_(),disabled:i,className:"flex items-center gap-1 text-[10px] font-body text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50","aria-label":"Refresh consignments",children:[o.jsx(Nc,{size:10,
789className:i?"animate-spin":""}),"Refresh"]})]}),i&&n.length===0&&o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"Loading…"}),!i&&n.length===0&&o.jsxs("div",{className:"px-3 py-4 border border-dashed border-border rounded-md space-y-1",children:[o.jsx("p",{className:"text-xs font-body font-semibold text-foreground",children:"No consignments yet"}),o.jsxs("p",{className:"text-[11px] font-body text-muted-foreground leading-relaxed",children:["Value an artwork first, then choose ",o.jsx("span",{className:"font-semibold",children:"Submit for Consignment"}),". You'll see review status, messages from our team, and your payout here."]}),o.jsx("a",{href:"/value",className:"inline-flex items-center rounded-md bg-foreground px-3 py-2 text-[11px] font-body font-semibold uppercase tracking-wider text-background hover:opacity-90",children:"Start a valuation"})]}),n.length>0&&o.jsxs("div",{className:"grid grid-cols-3 gap-2 p-3 border border-border rounded-md bg-muted/30",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-[9px] font-body uppercase tracking-wider text-muted-foreground",children:"Paid to you"}),o.jsx("p",{className:"text-sm font-body font-bold text-emerald-700",children:H(R)})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-[9px] font-body uppercase tracking-wider text-muted-foreground",children:"Awaiting payout"}),o.jsx("p",{className:"text-sm font-body font-bold text-violet-800",children:H(M)})]}),o.jsxs("div",{children:[o.jsxs("p",{className:"text-[9px] font-body uppercase tracking-wider text-muted-foreground",children:["Projected (",P.length," active)"]}),o.jsx("p",{className:"text-sm font-body font-bold text-foreground",children:H(T)})]}),o.jsx("p",{className:"col-span-3 text-[9px] font-body text-muted-foreground leading-relaxed",children:"Projected figures appear only once a commission rate has been agreed in writing for a work, and remain estimates until a sale completes. Pricing, commission, duration and shipping are agreed with you before a work is accepted or listed."})]}),n.map(A=>{const O=Wj[A.status]||Wj.pending_review,K=O.Icon,U=tL(A),I=Hj(A),re=c.has(A.id);return o.jsxs("div",{className:`p-3 border rounded-md bg-card space-y-2 transition-all duration-500 ${re?"border-primary/60 ring-2 ring-primary/20 shadow-sm":"border-border"}`,children:[o.jsxs("div",{className:"flex items-start gap-3",children:[A.image_url?o.jsx("img",{src:A.image_url,alt:A.artwork_title||"Artwork",className:"w-14 h-14 rounded-sm object-cover border border-border flex-shrink-0"}):o.jsx("div",{className:"w-14 h-14 rounded-sm bg-muted flex-shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-body font-semibold truncate",children:A.artist_name||"Untitled"}),A.artwork_title&&o.jsx("p",{className:"text-xs font-body italic text-muted-foreground truncate",children:A.artwork_title}),o.jsxs("p",{className:"text-[10px] font-body text-muted-foreground mt-0.5",children:["Submitted ",new Date(A.created_at).toLocaleDateString(),U>0&&o.jsxs(o.Fragment,{children:[" · FMV $",Math.round(U).toLocaleString()]})]}),A.status!=="sold"&&A.status!=="declined"&&I>0&&o.jsxs("p",{className:"text-[10px] font-body text-foreground mt-0.5",children:["Your projected net"," ",o.jsxs("span",{className:"font-semibold",children:["$",Math.round(I).toLocaleString()]}),A.asking_price!=null&&o.jsxs("span",{className:"text-muted-foreground",children:[" ","· list $",Math.round(Number(A.asking_price)).toLocaleString()]})]})]})]}),o.jsxs("div",{className:`flex items-center gap-1.5 px-2 py-1 text-[10px] font-body font-semibold rounded-sm border w-fit ${O.tone} ${re?"animate-pulse":""}`,children:[o.jsx(K,{size:11}),O.label,re&&o.jsx("span",{className:"ml-1 text-[9px] font-bold uppercase tracking-wider",children:"· Updated"})]}),o.jsx("p",{className:"text-[11px] font-body text-muted-foreground leading-relaxed",children:O.description}),A.admin_notes&&o.jsxs("div",{className:"mt-1 px-2.5 py-2 bg-muted/40 border-l-2 border-primary/40 rounded-sm",children:[o.jsx("p",{className:"text-[9px] font-body font-semibold uppercase tracking-wider text-muted-foreground mb-0.5",children:"Note from our team"}),o.jsx("p",{className:"text-[11px] font-body text-foreground leading-relaxed",children:A.admin_notes})]}),(A.status==="sold"||A.sale_price)&&o.jsxs("div",{className:"mt-1 px-2.5 py-2 bg-violet-50 border-l-2 border-violet-300 rounded-sm space-y-1",children:[o.jsx("p",{className:"text-[9px] font-body font-semibold uppercase tracking-wider text-violet-800 mb-1",children:"Payout Summary"}),o.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-0.5 text-[11px] font-body",children:[A.sale_price!=null&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-muted-foreground",children:"Sale price"}),o.jsxs("span",{className:"text-right font-semibold text-foreground",children:["$",Number(A.sale_price).toLocaleStr
789ing()]})]}),A.commission_rate!=null&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-muted-foreground",children:"Gallery commission"}),o.jsxs("span",{className:"text-right text-foreground",children:[Number(A.commission_rate),"%"]})]}),A.payout_amount!=null&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-muted-foreground",children:"Your payout"}),o.jsxs("span",{className:"text-right font-bold text-violet-900",children:["$",Number(A.payout_amount).toLocaleString()]})]}),o.jsx("span",{className:"text-muted-foreground",children:"Status"}),o.jsxs("span",{className:"text-right font-semibold text-foreground capitalize",children:[A.payout_status||"pending",A.payout_paid_at&&o.jsxs("span",{className:"block text-[9px] font-normal text-muted-foreground",children:["Paid ",new Date(A.payout_paid_at).toLocaleDateString()]})]})]}),A.payout_notes&&o.jsx("p",{className:"text-[10px] font-body italic text-muted-foreground mt-1 pt-1 border-t border-violet-200",children:A.payout_notes}),o.jsxs("button",{onClick:async()=>{try{await E1([A],(t==null?void 0:t.email)||"Consignor"),me.success("Payout statement downloaded")}catch{me.error("Could not generate statement")}},className:"mt-2 inline-flex items-center gap-1.5 text-[11px] font-body font-semibold text-violet-900 hover:underline",children:[o.jsx(Ho,{size:11})," Download payout statement"]})]}),o.jsxs("div",{className:"pt-1",children:[o.jsxs("button",{onClick:()=>{const V=p!==A.id;h(V?A.id:null),V&&g($=>{if(!$[A.id])return $;const D={...$};return delete D[A.id],D})},className:"inline-flex items-center gap-1.5 text-[11px] font-body font-semibold text-primary hover:underline",children:[o.jsx(pu,{size:11}),p===A.id?"Hide messages":"Messages",(x[A.id]||0)>0&&o.jsxs("span",{className:"px-1.5 py-0.5 text-[9px] font-bold bg-primary text-primary-foreground rounded-full",children:[x[A.id]," new"]})]}),p===A.id&&o.jsx("div",{className:"mt-2",children:o.jsx(UP,{submissionId:A.id,asAdmin:!1})}),o.jsxs("button",{onClick:async()=>{const V=`${window.location.origin}/c/${A.id}`;try{await navigator.clipboard.writeText(V),me.success("Receipt link copied to clipboard")}catch{window.prompt("Copy this link:",V)}},className:"ml-3 inline-flex items-center gap-1 text-[11px] font-body text-muted-foreground hover:text-foreground",title:"Copy public receipt link",children:[o.jsx(PC,{size:11}),"Share receipt"]})]})]},A.id)})]})]})},nL=async e=>{const t=new Xe({unit:"pt",format:"letter"});await sx(t);const n=t.internal.pageSize.getWidth(),r=t.internal.pageSize.getHeight(),i=60,s=n-i*2,a=r-i-8;let l=i;const c=e.baseValue+e.baseValue*(e.scarcityMultiplier/100)+e.baseValue*(e.provenanceUplift/100),d=[45,45,42],u=[140,140,135],f=[168,142,92],p=[220,218,213],h=()=>{t.setCharSpace(0),ct(t,"normal")},x=()=>{t.addPage(),l=i,h()},g=Y=>l+Y>a?(x(),!0):!1,b=Y=>(t.setDrawColor(...p),t.setLineWidth(.5),t.line(i,Y,n-i,Y),Y+18),y=(Y,ee,ce,ue,ye=s,Se=i)=>{if(!Y)return;t.setCharSpace(0),t.setFontSize(ee),t.setTextColor(...ce);const Re=Nt(Y).replace(/\r/g,"").replace(/\t/g,"  ").split(/\n{2,}/);Re.forEach((qe,te)=>{const Oe=t.splitTextToSize(qe.trim(),ye);for(const be of Oe)g(ue),t.text(be,Se,l),l+=ue;te<Re.length-1&&(l+=ue*.5)})};t.setFillColor(...f),t.rect(0,0,n,4,"F"),l=44,h(),t.setFontSize(9),t.setTextColor(...u),t.setCharSpace(4),t.text("REVERIE",n/2,l,{align:"center"}),t.setCharSpace(0),l+=14,t.setFontSize(6.5),t.setCharSpace(3),t.text("FINE ART COLLECTIVE",n/2,l,{align:"center"}),t.setCharSpace(0),l+=22,ct(t,"bold"),t.setFontSize(8);const _="PREMIUM VALUATION REPORT",S=Math.max(260,HV(t,_,1.5)+24*2),C=24,P=(n-S)/2;if(t.setFillColor(...f),t.roundedRect(P,l,S,C,3,3,"F"),t.setTextColor(255,255,255),t.setCharSpace(1.5),t.text(_,n/2,l+16,{align:"center"}),t.setCharSpace(0),l+=C+26,l=b(l)+12,e.artistName){ct(t,"bold"),t.setFontSize(22),t.setTextColor(...d);const Y=t.splitTextToSize(Nt(e.artistName),s);for(const ee of Y)g(28),t.text(ee,i,l),l+=26;l+=4}const R=[];if(e.artworkTitle&&R.push(Nt(e.artworkTitle)),e.year&&R.push(Nt(e.year)),R.length){ct(t,"italic"),t.setFontSize(12),t.setTextColor(...u);const Y=t.splitTextToSize(R.join("  ·  "),s);for(const ee of Y)g(18),t.text(ee,i,l),l+=16;l+=12}l=b(l);const M=e.images&&e.images.length>0?e.images:e.image?[e.image]:[];for(const Y of M)try{const{dataUrl:ee,width:ce,height:ue}=await D2(Y),ye=Math.min(s,380),De=Math.min(ye/ce,320/ue,1);let Re=ce*De,qe=ue*De;l+qe+24>a&&x();const te=i+(s-Re)/2;t.addImage(ee,"JPEG",te,l,Re,qe,void 0,"FAST"),l+=qe+18}catch{}M.length>0&&(l=b(l));
789const T=s/2,A=T-16,O=(Y,ee)=>(ct(t,"bold"),t.setFontSize(10),13+t.splitTextToSize(Nt(ee)||"-",A).length*14),K=(Y,ee,ce,ue)=>{let ye=ue;ct(t,"normal"),t.setFontSize(7),t.setTextColor(...u),t.setCharSpace(1.5),t.text(Y.toUpperCase(),ce,ye),t.setCharSpace(0),ye+=13,ct(t,"bold"),t.setFontSize(10),t.setTextColor(...d);const Se=t.splitTextToSize(Nt(ee)||"-",A);for(const De of Se)t.text(De,ce,ye),ye+=14;return ye},U=[];e.medium&&U.push(["Medium",e.medium]),e.dimensions&&U.push(["Dimensions",e.dimensions]),e.condition&&U.push(["Condition",e.condition]),e.edition&&U.push(["Edition",e.edition]);const I=[e.handSigned&&"Hand Signed",e.hasStamp&&"Stamp",e.hasCoa&&"COA"].filter(Boolean).join(", ");I&&U.push(["Authentication",I]),U.push(["Framing",e.framed?"Framed":"Unframed"]);for(let Y=0;Y<U.length;Y+=2){const ee=O(U[Y][0],U[Y][1]),ce=Y+1<U.length?O(U[Y+1][0],U[Y+1][1]):0,ue=Math.max(ee,ce);g(ue+10);const ye=l;K(U[Y][0],U[Y][1],i,ye),Y+1<U.length&&K(U[Y+1][0],U[Y+1][1],i+T,ye),l=ye+ue+8}c>0&&(l+=4,g(82),l=b(l),ct(t,"normal"),t.setFontSize(7),t.setTextColor(...f),t.setCharSpace(1.5),t.text("FAIR MARKET VALUE DETERMINATION",i,l),t.setCharSpace(0),l+=28,ct(t,"bold"),t.setFontSize(24),t.setTextColor(...d),t.text(`$${Math.round(c).toLocaleString()}`,i,l),l+=36);const re=[{title:"Methodology & Limitations",content:e.reportContent.professionalAppraisal},{title:"Market Evidence",content:e.reportContent.marketComparables},{title:"Value Considerations",content:e.reportContent.investmentOutlook},{title:"Market Position",content:e.reportContent.marketPosition},{title:"Condition (as reported by the owner)",content:e.reportContent.conditionNotes}];for(const Y of re){if(!Y.content)continue;l+70>a?x():l=b(l);const ee=l+4;g(28),t.setFillColor(...f),t.rect(i,ee-9,3,14,"F"),ct(t,"bold"),t.setFontSize(12),t.setTextColor(...d),t.text(Y.title,i+12,ee),l=ee+18,ct(t,"normal"),y(Y.content,9.5,d,13.5),l+=12}const V=e.reportContent.comparableSales||[];if(V.length===0){l+70>a?x():l=b(l);const Y=l+4;g(28),t.setFillColor(...f),t.rect(i,Y-9,3,14,"F"),ct(t,"bold"),t.setFontSize(12),t.setTextColor(...d),t.text("Sources & Evidence",i+12,Y),l=Y+18,ct(t,"normal"),y(e.reportContent.evidenceStatement||"No verified market evidence available. Reverie holds no comparable sale records for this artist, so this estimate rests on the artwork's submitted attributes alone. A Reverie specialist can review supporting documentation such as receipts, certificates, exhibition records or a prior appraisal.",9.5,d,13.5),l+=12}if(V.length>0){l+90>a?x():l=b(l);const Y=l+4;g(28),t.setFillColor(...f),t.rect(i,Y-9,3,14,"F"),ct(t,"bold"),t.setFontSize(12),t.setTextColor(...d),t.text("Recorded Comparable Sales",i+12,Y),l=Y+8,ct(t,"italic"),t.setFontSize(8),t.setTextColor(...u),t.text("Records held by Reverie, cited with source. No other sales are implied.",i+12,l+8),l+=22,V.forEach((ue,ye)=>{const Se=Nt(`${ye+1}. ${ue.title||"Comparable work"}${ue.year?`, ${ue.year}`:""}`),De=s-24,Re=t.splitTextToSize(Se,De),qe=[];ue.medium&&qe.push(ue.medium),ue.dimensions&&qe.push(ue.dimensions);const te=Nt(qe.join(" - ")),Oe=te?t.splitTextToSize(te,De):[],be=Nt(ue.relevanceNote||""),se=be?t.splitTextToSize(be,De):[],Q=Nt(ue.source||"source"),he=ue.url&&/^https?:\/\//i.test(ue.url)?`View on ${Q} >`:"",ve=ue.lotNumber?`Lot ${Nt(ue.lotNumber)}`:"",we=Nt([ue.source||"Source unavailable",ve].filter(Boolean).join(" - ")),Le=ue.url&&he?[he,...ve?[ve]:[]]:t.splitTextToSize(we||"Source unavailable",De),Fe=typeof ue.salePrice=="number"&&ue.salePrice>0?`${(ue.currency||"USD")==="USD"?"$":""}${ue.salePrice.toLocaleString()}${ue.currency&&ue.currency!=="USD"?` ${ue.currency}`:""}`:"Price on request",Ve=ue.saleDate?Nt(ue.saleDate):"",He=[Fe,...Ve?[Ve]:[]],Ze=12+Re.length*13+(Oe.length?Oe.length*12+4:4)+Math.max(16,He.length*13)+Math.max(16,Le.length*13)+(se.length?se.length*12+6:0)+12;g(Ze+8);const at=l;t.setFillColor(249,247,243),t.setDrawColor(...p),t.setLineWidth(.5),t.roundedRect(i,at,s,Ze,3,3,"FD");let Be=at+16;const it=i+12;if(ct(t,"bold"),t.setFontSize(10),t.setTextColor(...d),Re.forEach(ze=>{t.text(ze,it,Be),Be+=13}),Oe.length&&(ct(t,"italic"),t.setFontSize(8.5),t.setTextColor(...u),Oe.forEach(ze=>{t.text(ze,it,Be),Be+=12}),Be+=2),ct(t,"bold"),t.setFontSize(10),t.setTextColor(...d),He.forEach((ze,zt)=>{zt===0?(ct(t,"bold"),t.setFontSize(10),t.setTextColor(...d),t.text(ze,it,Be)):(ct(t,"normal"),t.setFontSize(8.5),t.setTextColor(...u),t.text(ze,it,Be)),Be+=13}),ue.url&&he){let ze=Be;
789[he,...ve?[ve]:[]].forEach(yt=>{yt.startsWith("Lot ")?(ct(t,"normal"),t.setFontSize(8),t.setTextColor(...u),t.text(yt,it,ze)):(ct(t,"bold"),t.setFontSize(8.5),t.setTextColor(...f),t.textWithLink(yt,it,ze,{url:ue.url})),ze+=13}),Be=ze}else ct(t,"normal"),t.setFontSize(8.5),t.setTextColor(...u),Le.forEach(ze=>{t.text(ze,it,Be),Be+=12});se.length&&(Be+=2,ct(t,"italic"),t.setFontSize(8.5),t.setTextColor(85,87,93),se.forEach(ze=>{t.text(ze,it,Be),Be+=12})),l=at+Ze+8}),g(20),ct(t,"italic"),t.setFontSize(7.5),t.setTextColor(...u),t.splitTextToSize("Comparable sales are sourced from public auction records and gallery sale data. Where verified URLs are available, links route to the original source. Lot pages may expire; contact us for archival copies.",s).forEach(ue=>{t.text(ue,i,l+4),l+=10}),l+=8}const $="This report is produced by Reverie Fine Art from the attributes supplied by the owner, which are shown as submitted and are not independently verified, together with any comparable sale records Reverie holds, each cited with its source. Where no such records are held, no market evidence is claimed and no sale, exhibition, provenance or biography is asserted. The artwork has not been physically inspected and authenticity has not been assessed. Values are indicative estimates and are not a certified appraisal.";t.setFontSize(6);const ie=90+t.splitTextToSize($,s-40).length*8+8;let X=!1;l+ie>a?(x(),X=!0,l=150):l+=14,t.setDrawColor(...p),t.setLineWidth(.5),t.line(i,l,n-i,l),l+=14,t.setFillColor(...f),t.rect(i,l,s,.5,"F"),l+=14,h(),t.setFontSize(9),t.setTextColor(...u),t.setCharSpace(3),t.text("REVERIE",n/2,l,{align:"center"}),t.setCharSpace(0),l+=12,t.setFontSize(6),t.setCharSpace(2.5),t.text("FINE ART COLLECTIVE",n/2,l,{align:"center"}),t.setCharSpace(0),l+=12,t.setFontSize(7),t.text("reverieart.com",n/2,l,{align:"center"}),l+=14,t.setFontSize(6.5),t.setTextColor(...u),t.text(`Premium Report generated ${new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}`,n/2,l,{align:"center"}),l+=X?18:12,t.setFontSize(6),t.setTextColor(...p);const q=t.splitTextToSize("This report is produced by Reverie Fine Art from the attributes supplied by the owner, which are shown as submitted and are not independently verified, together with any comparable sale records Reverie holds, each cited with its source. Where no such records are held, no market evidence is claimed and no sale, exhibition, provenance or biography is asserted. The artwork has not been physically inspected and authenticity has not been assessed. Values are indicative estimates and are not a certified appraisal.",s-40);for(const Y of q)t.text(Y,n/2,l,{align:"center"}),l+=8;const F=t.getNumberOfPages();if(F>1)for(let Y=1;Y<=F;Y++)t.setPage(Y),t.setFontSize(7),t.setTextColor(...u),t.text(`${Y} / ${F}`,n-i,r-24,{align:"right"});const Z=[e.artistName,e.artworkTitle,"Premium Report"].filter(Boolean).join(" - ");t.save(`${Z}.pdf`)},xZ=()=>{const{user:e}=pn(),[t,n]=k.useState([]),[r,i]=k.useState(!1),[s,a]=k.useState(!1),[l,c]=k.useState(null),d=async()=>{if(e){i(!0);try{const{data:f,error:p}=await Ne.from("premium_purchases").select("id, created_at, used_at, environment, status, report_data, metadata, report_pdf_path").eq("user_id",e.id).eq("status","completed").not("report_data","is",null).order("created_at",{ascending:!1}).limit(20);if(p)throw p;n(f||[])}catch(f){console.error("Failed to load premium reports:",f)}finally{i(!1)}}};if(k.useEffect(()=>{s&&e&&d()},[s,e]),!e)return null;const u=async f=>{if(!f.report_data){me.error("This report has no saved data — generate it once before downloading.");return}c(f.id);try{if(f.report_pdf_path)try{const{data:h,error:x}=await Ne.functions.invoke("get-premium-pdf-url",{body:{purchaseId:f.id}});if(!x&&(h!=null&&h.success)&&h.url){window.open(h.url,"_blank"),me.success("Premium report downloaded");return}}catch{}const p=f.metadata||{};await nL({artistName:p.artistName||"Unknown Artist",artworkTitle:p.artworkTitle||"",year:p.year||"",medium:p.medium||"",dimensions:p.dimensions||"",condition:p.condition||"",edition:p.edition||"",handSigned:!!p.handSigned,hasStamp:!!p.hasStamp,hasCoa:!!p.hasCoa,framed:!!p.framed,baseValue:Number(p.baseValue)||0,scarcityMultiplier:Number(p.scarcityMultiplier)||0,provenanceUplift:Number(p.provenanceUplift)||0,image:p.image||null,images:Array.isArray(p.images)?p.images:void 0,reportContent:f.report_data}),me.success("Premium report downloaded")}catch(p){console.error(p),me.error("Could not regenerate this PDF")}finally{c(null)}};return o.jsxs("div",{className:"border-t border-border pt-5",children:[o.jsxs("button",{onClick:()=>a(!s),className:"flex items-center justify-between w-full text-sm font-semibold font-body",children:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(Ud,{size:13,className:"text-accent-foreground"}),"My Premium Reports",t.length>0&&!s&&o.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-bold bg-accent/20 text-accent-foreground rounded-full",children:t.length})]}),o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`transition-transform ${s?"rotate-180":""}`,children:o.jsx("path",{d:"m6 9 6 6 6-6"})})]}),s&&o.jsxs("div",{className:"mt-3 space-y-2",children:[r&&t.length===0&&o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"Loading…"}),!r&&t.length===0&&o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"No premium reports yet. Purchase one from any artwork preview to build your library — re-download anytime."}),t.map(f=>{const p=f.metadata||{},h=p.artistName||"Premium report",x=p.artworkTitle||"";return o.jsxs("div",{className:"p-3 border border-border rounded-md bg-card space-y-2",children:[o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(q0,{size:14,className:"text-muted-foreground mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-body font-semibold truncate",children:h}),x&&o.jsx("p",{className:"text-xs font-body italic text-muted-foreground truncate",children:x}),o.jsxs("p",{className:"text-[10px] font-body text-muted-foreground mt-0.5",children:["Purchased ",new Date(f.created_at).toLocaleDateString(),f.environment==="sandbox"&&o.jsx("span",{className:"ml-1 px-1 py-px rounded-sm bg-amber-100 text-amber-800 text-[9px] font-semibold uppercase tracking-wider",children:"Sandbox"})]})]})]}),o.jsxs("button",{onClick:()=>u(f),disabled:l===f.id,className:"w-full flex items-center justify-center gap-1.5 px-2 py-1.5 text-[11px] font-body font-semibold border border-input rounded-sm hover:bg-muted/60 transition-colors disabled:opacity-50",children:[o.jsx(Ho,{size:11}),l===f.id?"Generating PDF…":"Re-download PDF"]})]},f.id)}),o.jsx("p",{className:"text-[10px] font-body text-muted-foreground italic pt-1",children:"Reports remain available for re-download in your account."})]})]})},Vj=[{key:"check",label:"Paper check",hint:"Mailed to the address below."},{key:"ach",label:"Bank transfer (ACH)",hint:"We'll email a secure form to collect bank details — never enter account numbers here."},{key:"paypal",label:"PayPal",hint:"Enter the PayPal email to pay."},{key:"zelle",label:"Zelle",hint:"Enter the Zelle email or phone number."},{key:"wire",label:"Wire transfer",hint:"For international consignors. We'll email a secure form for bank details."}],vZ=[{key:"not_submitted",label:"Not submitted"},{key:"requested",label:"Requested"},{key:"on_file",label:"On file"}],bZ=()=>{const{user:e}=pn(),[t,n]=k.useState(!0),[r,i]=k.useState(!1),[s,a]=k.useState(""),[l,c]=k.useState("check"),[d,u]=k.useState(""),[f,p]=k.useState(""),[h,x]=k.useState(""),[g,b]=k.useState(""),[y,_]=k.useState("not_submitted"),[w,S]=k.useState(null);k.useEffect(()=>{if(!e){n(!1);return}(async()=>{const{data:R}=await Ne.from("payout_profiles").select("*").eq("user_id",e.id).maybeSingle();R?(a(R.payee_name??""),c(R.method??"check"),u(R.contact_email??e.email??""),p(R.phone??""),x(R.mailing_address??""),b(R.payout_instructions??""),_(R.tax_form_status??"not_submitted"),S(R.verified_at??null)):u(e.email??""),n(!1)})()},[e]);const C=async()=>
789{if(e){if(!s.trim()){me.error("Add the name that payments should be made out to.");return}if(l==="check"&&!h.trim()){me.error("Add a mailing address for check payments.");return}i(!0);try{const{error:R}=await Ne.from("payout_profiles").upsert({user_id:e.id,payee_name:s.trim(),method:l,contact_email:d.trim()||null,phone:f.trim()||null,mailing_address:h.trim()||null,payout_instructions:g.trim()||null,tax_form_status:y},{onConflict:"user_id"});if(R)throw R;me.success("Payout details saved")}catch{me.error("Could not save payout details")}finally{i(!1)}}};if(!e)return null;const P=Vj.find(R=>R.key===l);return o.jsxs("div",{className:"p-4 rounded-md border border-border bg-card space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ag,{size:15,className:"text-primary"}),o.jsx("h3",{className:"font-display text-base font-semibold",children:"Payout details"}),w&&o.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-body font-semibold uppercase tracking-wider text-emerald-800 bg-emerald-50 border border-emerald-200 rounded-sm px-1.5 py-0.5",children:[o.jsx(W0,{size:10})," Verified"]})]}),o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"Tell us how you'd like to be paid when a consigned work sells. Payouts are issued within 3–5 business days of cleared funds, net of the agreed commission."}),t?o.jsxs("p",{className:"text-xs font-body text-muted-foreground flex items-center gap-1.5",children:[o.jsx(Qw,{size:12,className:"animate-spin"})," Loading…"]}):o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"block text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground",children:"Pay to the order of"}),o.jsx("input",{value:s,onChange:R=>a(R.target.value),placeholder:"Legal name or business name",className:"w-full px-2.5 py-1.5 text-sm font-body bg-background border border-input rounded-md focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"block text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground",children:"Payment method"}),o.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:Vj.map(R=>o.jsx("button",{type:"button",onClick:()=>c(R.key),className:`px-2 py-1.5 text-[11px] font-body font-semibold rounded-sm transition-all text-left ${l===R.key?"bg-primary text-primary-foreground":"bg-background border border-input text-muted-foreground hover:bg-muted/60"}`,children:R.label},R.key))}),P&&o.jsx("p",{className:"text-[10px] font-body text-muted-foreground italic",children:P.hint})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"block text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground",children:"Contact email"}),o.jsx("input",{value:d,onChange:R=>u(R.target.value),className:"w-full px-2.5 py-1.5 text-sm font-body bg-background border border-input rounded-md focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"block text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground",children:"Phone"}),o.jsx("input",{value:f,onChange:R=>p(R.target.value),className:"w-full px-2.5 py-1.5 text-sm font-body bg-background border border-input rounded-md focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"block text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground",children:"Mailing address"}),o.jsx("textarea",{value:h,onChange:R=>x(R.target.value),rows:2,placeholder:"Street, city, state, ZIP",className:"w-full px-2.5 py-1.5 text-sm font-body bg-background border border-input rounded-md focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20 resize-none"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"block text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground",children:"Payment handle or note"}),o.jsx("input",{value:g,onChange:R=>b(R.target.value),placeholder:"PayPal / Zelle email or phone, or a note for our team",className:"w-full px-2.5 py-1.5 text-sm font-body bg-background border border-input rounded-md focus:outline-none focus:border-primary focus:ring-2 focus:ring-ring/20"}),o.jsx("p",{className:"text-[10px] font-body text-muted-foreground italic",children:"Never enter full bank account or routing numbers here — we collect those separately through a secure form."})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"block text-[10px] font-body font-semibold uppercase tracking-wider text-muted-foreground",children:"Tax form (W-9 / W-8BEN)"}),o.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:vZ.map(R=>o.jsx("button",{type:"button",onClick:()=>_(R.key),className:`px-2 py-1.5 text-[10px] font-body font-semibold rounded-sm transition-all ${y===R.key?"bg-primary text-primary-foreground":"bg-background border border-input text-muted-foreground hover:bg-muted/60"}`,children:R.label},R.key))})]}),o.jsx("button",{type:"button",onClick:C,disabled:r,className:"w-full px-3 py-2 text-xs font-body font-semibold bg-primary text-primary-foreground rounded-md hover:opacity-90 transition-all disabled:opacity-60",children:r?"Saving…":"Save payout details"})]})]})},yZ=({artistName:e,artworkTitle:t,saving:n,onSave:r,onConsign:i,requireAuth:s,submissionId:a})=>{const{user:l}=pn(),[c,d]=k.useState(!1),[u,f]=k.useState(!1),p=async()=>{var x;if(!(u||c)&&!(s&&!s("Create an account so a specialist can reply to you"))&&l!=null&&l.email){f(!0);try{const{data:g}=await Ne.from("valuation_leads").select("id").eq("kind","specialist_review").eq("decision","pending").eq("requester_user_id",l.id).eq("artwork_title",t||"").limit(1);if(g&&g.length>0){d(!0),me.success("Your request has been sent to the Reverie team. We'll follow up by email.");return}Qn("review_requested"),Qn("specialist_review_requested");const{error:b}=await Ne.functions.invoke("submit-valuation-lead",{body:{kind:"specialist_review",name:((x=l.user_metadata)==null?void 0:x.full_name)||l.email,email:l.email,artist_name:e||null,artwork_title:t||null,submission_id:a||null,message:"Specialist review requested from the valuation tool.",path:window.location.pathname}});if(b)throw b;d(!0),me.success("Your request has been sent to the Reverie team. We'll follow up by email."),Ne.functions.invoke("send-transactional-email",{body:{templateName:"specialist-review-received",recipientEmail:l.email,idempotencyKey:`specialist-review-${l.id}-${a||t||"work"}`,templateData:{artistName:e||void 0,artworkTitle:t||void 0}}})}catch(g){me.error(g instanceof Error?g.message:"Could not send that request.")}finally{f(!1)}}},h=[{key:"save",Icon:w7,title:"Save to My Collection",body:"Keeps this work and its estimate in your account. You can reopen it, revalue it later and download a report at any time.",action:o.jsx("button",{type:"button",onClick:r,disabled:n||!e,className:"mt-4 inline-flex min-h-[44px] w-full items-center justify-center rounded-md border border-foreground
789/20 px-4 font-body text-sm font-semibold text-foreground transition-all hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50",children:n?"Saving…":"Save to my collection"})},{key:"review",Icon:pu,title:"Request Reverie specialist review",body:"A member of our team looks at your photographs and details and replies with their read on the work — usually within 5–7 business days. No obligation.",action:o.jsx("button",{type:"button",onClick:p,disabled:u||c,className:"mt-4 inline-flex min-h-[44px] w-full items-center justify-center rounded-md border border-foreground/20 px-4 font-body text-sm font-semibold text-foreground transition-all hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50",children:c?"Request sent":u?"Sending…":"Request a review"}),note:c?"Your request has been sent to the Reverie team. We'll follow up by email.":null},{key:"consign",Icon:T7,title:"Submit for consignment",body:"Offer the work for sale through Reverie. We review it, agree pricing with you, then list it. Payment details are only collected once a consignment is accepted.",action:o.jsx("button",{type:"button",onClick:i,disabled:!e||!t,className:"mt-4 inline-flex min-h-[44px] w-full items-center justify-center rounded-md bg-primary px-4 font-body text-sm font-semibold text-primary-foreground shadow-[var(--shadow-md)] transition-all hover:brightness-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50",children:"Submit for consignment"})}];return o.jsxs("section",{className:"space-y-4","aria-labelledby":"next-steps",children:[o.jsxs("div",{children:[o.jsx("h3",{id:"next-steps",className:"font-display text-xl font-semibold tracking-tight",children:"What would you like to do next?"}),o.jsx("p",{className:"mt-1 font-body text-sm text-muted-foreground",children:"You can choose more than one, and nothing is final until you and Reverie agree it."})]}),o.jsx("div",{className:"grid gap-3",children:h.map(x=>o.jsxs("div",{className:"rounded-md border border-border bg-card p-4",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(x.Icon,{size:16,className:"mt-0.5 flex-shrink-0 text-accent","aria-hidden":"true"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h4",{className:"font-display text-base font-semibold tracking-tight",children:x.title}),o.jsx("p",{className:"mt-1 font-body text-xs leading-relaxed text-muted-foreground",children:x.body})]})]}),x.action,"note"in x&&x.note?o.jsx("p",{role:"status",className:"mt-2 font-body text-xs leading-relaxed text-accent",children:x.note}):null]},x.key))})]})},wZ=e=>e.toLocaleString("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}),Na=({label:e,value:t})=>o.jsxs("div",{className:"flex justify-between gap-4 py-1.5 border-b border-border/50 last:border-0",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:e}),o.jsx("span",{className:"text-xs text-right font-medium",children:t!=null&&t.trim()?t:"Not provided"})]}),_Z=({submitted:e,records:t,method:n,confidence:r,isDemo:i})=>{const s=t.length>0;return o.jsxs("div",{className:"space-y-4 rounded-lg border border-border bg-card p-4",children:[i&&o.jsx("p",{className:"rounded bg-accent/10 px-3 py-2 text-xs font-medium text-accent-foreground",children:"Demo data — this is a sample entry for illustration. It is not a real artwork, artist or sale record."}),o.jsxs("section",{children:[o.jsx("h4",{className:"font-serif text-sm mb-1",children:"Submitted details"}),o.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Entered by the owner. Submitted by the owner and not independently verified."}),o.jsx(Na,{label:"Artist name as given",value:e.artistName}),o.jsx(Na,{label:"Title as given",value:e.artworkTitle}),o.jsx(Na,{label:"Year",value:e.year}),o.jsx(Na,{label:"Medium",value:e.medium}),o.jsx(Na,{label:"Dimensions",value:e.dimensions}),o.jsx(Na,{label:"Condition (owner-reported)",value:e.condition}),o.jsx(Na,{label:"Provenance",value:e.provenance}),o.jsx(Na,{label:"Exhibition history",value:e.exhibitionHistory})]}),o.jsxs("section",{children:[o.jsx("h4",{className:"font-serif text-sm mb-1",children:"Verified evidence & sources"}),s?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs text-muted-foreground mb-2",children:[t.length," sale record",t.length===1?"":"s"," held by Reverie were used in this estimate."]}),o.jsx("ul",{className:"space-y-1.5",children:t.map((a,l)=>o.jsxs("li",{className:"flex justify-between gap-4 text-xs border-b border-border/50 pb-1.5 last:border-0",children:[o.jsxs("span",{className:"text-muted-foreground",children:[a.label||"Recorded sale",a.saleYear?` · ${a.saleYear}`:"",a.source?` · source: ${a.source}`:""]}),o.jsx("span",{className:"font-medium",children:wZ(a.salePrice)})]},l))})]}):o.jsx("p",{className:"text-xs text-muted-foreground",children:"No verified market evidence available. Reverie holds no sale records for this artist, so nothing about the artist, provenance, exhibitions or past sales is asserted here. A Reverie specialist can review supporting documentation — receipts, certificates, exhibition records or a prior appraisal — and update the estimate."})]}),o.jsxs("section",{children:[o.jsx("h4",{className:"font-serif text-sm mb-1",children:"Automated estimate"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[n==="comparables"?"Calculated from the submitted attributes and anchored to the sale records listed above.":"Calculated from the submitted attributes only — medium, size, year and owner-reported condition. No market records were used.",typeof r=="number"&&r>0&&o.jsxs(o.Fragment,{children:[" Coverage score ",r,"% reflects how complete the submitted details and available records are — it is not a measure of authenticity."]})]}),o.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"This is an indicative estimate, not a certified appraisal. The artwork has not been physically inspected and authenticity has not been assessed."})]})]})},kZ=e=>{if(!e||typeof e!="object"||Array.isArray(e))return{};const t=["user_submission","generated","demo","migrated","unknown"],n={};for(const r of["artist_bio","provenance","exhibition_history"]){const i=e[r];typeof i=="string"&&t.includes(i)&&(n[r]=i)}return n},NZ=(e,t)=>
789(e==null?void 0:e[t])==="user_submission",zr=(e,t,n)=>NZ(t,n)?(e||"").trim():"",SZ=e=>{var n,r,i;const t={};return(n=e.artistBio)!=null&&n.trim()&&(t.artist_bio="user_submission"),(r=e.provenance)!=null&&r.trim()&&(t.provenance="user_submission"),(i=e.exhibitionHistory)!=null&&i.trim()&&(t.exhibition_history="user_submission"),t},jZ=({payload:e,disabled:t})=>{const[n,r]=k.useState(!1),[i,s]=k.useState(""),[a,l]=k.useState(!1),[c,d]=k.useState(!1),u=async()=>{l(!0);try{const{data:f,error:p}=await Ne.functions.invoke("resume-valuation",{body:{email:i.trim(),payload:e}});if(p)throw p;if(!(f!=null&&f.ok))throw new Error((f==null?void 0:f.error)||"Could not send the link");d(!0),me.success("Link sent — check your inbox.")}catch(f){me.error(f instanceof Error?f.message:"Could not send the link")}finally{l(!1)}};return c?o.jsxs("p",{className:"mt-4 flex items-center gap-1.5 text-xs font-body text-muted-foreground",children:[o.jsx(uo,{size:13,className:"text-primary"})," We emailed your link to ",i,"."]}):o.jsx("div",{className:"mt-4",children:n?o.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3 space-y-2",children:[o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"We'll email a private link that reopens this entry. No account needed."}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{type:"email",value:i,autoFocus:!0,onChange:f=>s(f.target.value),onKeyDown:f=>f.key==="Enter"&&i.includes("@")&&!a&&u(),placeholder:"[email protected]",className:"flex-1 min-w-0 px-3 py-2 text-xs font-body bg-background border border-input rounded-md focus:outline-none focus:ring-1 focus:ring-ring"}),o.jsx("button",{onClick:u,disabled:a||!i.includes("@"),className:"px-3 py-2 text-xs font-body font-semibold bg-primary text-primary-foreground rounded-md disabled:opacity-50 hover:brightness-105 transition-all",children:a?"Sending…":"Send"})]})]}):o.jsxs("button",{onClick:()=>r(!0),disabled:t,className:"inline-flex items-center gap-1.5 text-xs font-body font-semibold text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors",children:[o.jsx(Qf,{size:13})," Email me a link to finish later"]})})},EZ=[{label:"Select condition…",value:""},{label:"Excellent — as new",value:"Excellent"},{label:"Very Good — minor signs of age",value:"Very Good"},{label:"Good — visible wear, stable",value:"Good"},{label:"Fair — needs attention",value:"Fair"},{label:"Poor — significant damage",value:"Poor"}],CZ=[{label:"Not sure / unrecorded",value:""},{label:"Emerging — early career, little resale record",value:"emerging"},{label:"Established — consistent gallery representation",value:"established"},{label:"Mid-career — documented resale history",value:"mid-career"},{label:"Blue-chip — museum & institutional demand",value:"blue-chip"}],AZ=[{label:"Not sure / no prior sale",value:""},{label:"Auction result — public, arm's length",value:"auction"},{label:"Gallery / retail purchase — includes dealer margin",value:"gallery"},{label:"Private sale",value:"private"}],Gj={artistName:"",artworkTitle:"",year:"",medium:"",dimensions:"",condition:"",edition:"",handSigned:!1,hasStamp:!1,hasCoa:!1,framed:!1,artistTier:"",editionSize:"",priorSalePrice:"",priorSaleYear:"",priorSaleSource:"",restored:!1,galleryExhibited:!1,museumExhibited:!1,publishedLiterature:!1,priorAuctionSale:!1,estateProvenance:!1,artistBio:"",provenance:"",exhibitionHistory:"",narrativeOrigin:{},baseValue:0,scarcityMultiplier:0,provenanceUplift:0,formulaValue:0,aiValue:0,images:[]},PZ=["Essential details","Photographs","Refine (optional)","Your estimate"],Sh=({title:e,hint:t,children:n})=>o.jsxs("details",{className:"group rounded-md border border-border bg-card",children:[o.jsxs("summary",{className:"flex cursor-pointer list-none items-start justify-between gap-3 px-4 py-3.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-md",children:[o.jsxs("span",{className:"min-w-0",children:[o.jsx("span",{className:"block font-body text-sm font-semibold text-foreground",children:e}),o.jsx("span",{className:"mt-0.5 block font-body text-xs text-muted-foreground",children:t})]}),o.jsx("span",{"aria-hidden":"true",className:"mt-1 font-body text-xs text-muted-foreground group-open:hidden",children:"Add"}),o.jsx("span",{"aria-hidden":"true",className:"mt-1 hidden font-body text-xs text-muted-foreground group-open:inline",children:"Close"})]}),o.jsx("div",{className:"space-y-4 border-t border-border px-4 py-4",children:n})]}),Yj=({items:e,data:t,update:n})=>o.jsx("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-1",children:e.map(({key:r,label:i})=>o.jsxs("label",{className:"flex min-h-[36px] cursor-pointer select-none items-center gap-2 py-1 font-body text-xs font-medium text-foreground transition-colors hover:text-accent",children:[o.jsx("input",{type:"checkbox",checked:!!t[r],onChange:s=>
789n(r,s.target.checked),className:"h-[18px] w-[18px] cursor-pointer rounded border-input accent-[hsl(var(--accent))] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"}),i]},String(r)))}),Kj=({data:e,onChange:t,onInsightsChange:n,onSubmissionLoaded:r,onSubmissionIdChange:i,onValuationChange:s,requireAuth:a,mode:l="wizard",intent:c="value",loadedSubmissionId:d=null})=>{const{user:u}=pn(),[f,p]=k.useState(d?4:1),[h,x]=k.useState([]),[g,b]=k.useState(null),y=k.useRef(s);y.current=s,k.useEffect(()=>{var Q;(Q=y.current)==null||Q.call(y,g)},[g]);const[_,w]=k.useState(!1),[S,C]=k.useState(null),[P,R]=k.useState([]),[M,T]=k.useState(0),[H,A]=k.useState([]),[O,K]=k.useState(null),[U,I]=k.useState(!1),[re,V]=k.useState(!1),[$,D]=k.useState(!1),[ie,X]=k.useState("USD"),[E,q]=k.useState(!1),[F,Z]=k.useState(d);k.useEffect(()=>{if(l!=="consignments"||!u)return;let Q=!0;return(async()=>{const{data:he}=await Ne.from("submissions").select("id").eq("user_id",u.id).eq("submission_type","consignment").in("status",["approved","listed","sold"]).limit(1);Q&&q(!!(he&&he.length>0))})(),()=>{Q=!1}},[l,u]);const Y=(Q,he)=>{Qn("entry_started",{field:String(Q)},{once:!0}),Qn("valuation_started",{},{once:!0}),t({...e,[Q]:he})},ee=async()=>{Qn("formula_estimate",{},{once:!0}),Qn("valuation_completed",{},{once:!0});let Q=[];if(u&&e.artistName.trim()){const{data:ve}=await Ne.from("comparable_sales").select("sale_price, area_sq_in, sale_year, source, note").ilike("artist_name",e.artistName.trim()).order("sale_year",{ascending:!1}).limit(25);Q=(ve||[]).map(we=>({salePrice:Number(we.sale_price)||0,area:we.area_sq_in!=null?Number(we.area_sq_in):null,saleYear:we.sale_year!=null?Number(we.sale_year):null,source:we.source||"auction",label:we.note||void 0})).filter(we=>we.salePrice>0)}const he=zP({medium:e.medium,dimensions:e.dimensions,condition:e.condition,year:e.year,provenance:zr(e.provenance,e.narrativeOrigin,"provenance"),exhibitionHistory:zr(e.exhibitionHistory,e.narrativeOrigin,"exhibition_history"),framed:e.framed,artistTier:e.artistTier,editionSize:e.editionSize,handSigned:e.handSigned,hasStamp:e.hasStamp,hasCoa:e.hasCoa,galleryExhibited:e.galleryExhibited,museumExhibited:e.museumExhibited,publishedLiterature:e.publishedLiterature,priorAuctionSale:e.priorAuctionSale,estateProvenance:e.estateProvenance,priorSalePrice:e.priorSalePrice,priorSaleYear:e.priorSaleYear,priorSaleSource:e.priorSaleSource,restored:e.restored,comparables:Q});t({...e,baseValue:he.baseValue,scarcityMultiplier:he.scarcityMultiplier,provenanceUplift:he.provenanceUplift,formulaValue:he.fairMarketValue}),b(he),x(he.reasoning),A(he.anchor==="comparables"?Q.map(ve=>({salePrice:ve.salePrice,saleYear:ve.saleYear,source:ve.source,label:ve.label})):[]),K(he.anchor==="comparables"?"comparables":"attributes"),me.success(he.anchor==="comparables"?`Estimate anchored to ${he.comparableCount} sold comparable${he.comparableCount===1?"":"s"}`:"Estimate ready")},ce=async()=>{if(Qn("ai_estimate",{},{once:!0}),!e.artistName&&!e.medium){me.error("Please enter at least an artist name or medium");return}w(!0),C(null);try{const{data:Q,error:he}=await Ne.functions.invoke("art-valuation",{body:{artistName:e.artistName,artworkTitle:e.artworkTitle,year:e.year,medium:e.medium,dimensions:e.dimensions,condition:e.condition}});if(he)throw he;if(Q!=null&&Q.success&&Q.data){const ve=Q.data,we=Math.round(ve.baseValue+ve.baseValue*(ve.scarcityMultiplier/100)+ve.baseValue*(ve.provenanceUplift/100)),Le={...e,baseValue:ve.baseValue,scarcityMultiplier:ve.scarcityMultiplier,provenanceUplift:ve.provenanceUplift,aiValue:we};t(Le),C(ve.reasoning);const Fe=typeof ve.confidence=="number"?ve.confidence:0;R([]),T(Fe),A([]),K("attributes"),n==null||n({comparables:[],confidence:Fe}),me.success("Estimate updated")}else throw new Error((Q==null?void 0:Q.error)||"Failed to get AI estimate")}catch(Q){console.error("AI estimation error:",Q),me.error(Q.message||"AI estimation failed")}finally{w(!1)}},ue=!!(e.artistName&&e.medium&&e.dimensions&&e.condition),ye=e.images.length>0,Se=!!(e.formulaValue||e.aiValue),De=!e.artistName&&!e.artworkTitle&&!e.medium&&!ye,Re=()=>{Qn("entry_started",{source:"sample"},{once:!0}),I(!0),t({...e,artistName:"Demo Artist (sample)",artworkTitle:"Demo Work — sample entry",year:"1978",medium:"Oil on canvas",dimensions:"36 × 48 in",condition:"Very Good",edition:"",framed:!0,artistBio:"",provenance:"",exhibitionHistory:"",narrativeOrigin:{}}),me.success("Demo data loaded — this is a sample entry, not a real artwork.")},qe=async()=>
789{if(!(a&&!a("Create an account to save your submission"))&&u){V(!0);try{const Q=[];for(let He=0;He<e.images.length;He++){const Ze=e.images[He];if(!Ze)continue;if(/^https?:\/\//.test(Ze)){Q.push(Ze);continue}const at=Ze.match(/^data:(image\/\w+);base64,(.+)$/);if(!at)continue;const Be=at[1],it=Be.split("/")[1]||"jpeg",ze=atob(at[2]),zt=new ArrayBuffer(ze.length),yt=new Uint8Array(zt);for(let qt=0;qt<ze.length;qt++)yt[qt]=ze.charCodeAt(qt);const mt=new Blob([zt],{type:Be}),wt=`${u.id}/${crypto.randomUUID()}-${He}.${it}`,{error:Mt}=await Ne.storage.from("artwork-images").upload(wt,mt,{contentType:Be});if(Mt)throw Mt;const{data:dt}=Ne.storage.from("artwork-images").getPublicUrl(wt);Q.push(dt.publicUrl)}const he=Q[0]||null,ve={user_id:u.id,artist_name:e.artistName,artwork_title:e.artworkTitle,year:e.year,medium:e.medium,dimensions:e.dimensions,condition:e.condition,edition:e.edition,hand_signed:e.handSigned,has_stamp:e.hasStamp,has_coa:e.hasCoa,artist_tier:e.artistTier||null,edition_size:e.editionSize&&parseInt(e.editionSize)||null,prior_sale_price:e.priorSalePrice&&parseFloat(e.priorSalePrice.replace(/[^0-9.]/g,""))||null,prior_sale_year:e.priorSaleYear&&parseInt(e.priorSaleYear)||null,prior_sale_source:e.priorSaleSource||null,restored:e.restored,gallery_exhibited:e.galleryExhibited,museum_exhibited:e.museumExhibited,published_literature:e.publishedLiterature,prior_auction_sale:e.priorAuctionSale,estate_provenance:e.estateProvenance,value_low:(g==null?void 0:g.rangeLow)??null,value_high:(g==null?void 0:g.rangeHigh)??null,retail_value:(g==null?void 0:g.retailValue)??null,insurance_value:(g==null?void 0:g.insuranceValue)??null,formula_confidence:(g==null?void 0:g.confidence)??null,marketability_discount:(g==null?void 0:g.marketabilityDiscount)??null,auction_estimate_low:(g==null?void 0:g.auctionEstimateLow)??null,auction_estimate_high:(g==null?void 0:g.auctionEstimateHigh)??null,net_on_consignment:(g==null?void 0:g.netOnConsignment)??null,valuation_effective_date:(g==null?void 0:g.effectiveDate)??null,framed:e.framed,artist_bio:zr(e.artistBio,e.narrativeOrigin,"artist_bio")||null,provenance:zr(e.provenance,e.narrativeOrigin,"provenance")||null,narrative_origin:SZ({artistBio:zr(e.artistBio,e.narrativeOrigin,"artist_bio"),provenance:zr(e.provenance,e.narrativeOrigin,"provenance"),exhibitionHistory:zr(e.exhibitionHistory,e.narrativeOrigin,"exhibition_history")}),exhibition_history:zr(e.exhibitionHistory,e.narrativeOrigin,"exhibition_history")||null,base_value:e.baseValue,scarcity_multiplier:e.scarcityMultiplier,provenance_uplift:e.provenanceUplift,formula_value:e.formulaValue||null,ai_value:e.aiValue||null,ai_confidence:M||null,ai_comparables:P.length>0?P:null,ai_reasoning:S||null,formula_reasoning:h.length>0?h:null,last_valued_at:e.formulaValue||e.aiValue?new Date().toISOString():null,image_url:he,image_urls:Q.length>0?Q:null,currency:ie},we=!!F,Le={...ve};if(we){const He={...e.narrativeOrigin||{}},Ze={...He};let at=!1;[["artist_bio","artistBio","artist_bio"],["provenance","provenance","provenance"],["exhibition_history","exhibitionHistory","exhibition_history"]].forEach(([Be,it,ze])=>{const zt=e[it]||"",yt=He[ze]==="user_submission";zt.trim()?(Le[Be]=zt.trim(),Ze[ze]="user_submission",at=!0):yt?(Le[Be]=null,delete Ze[ze],at=!0):delete Le[Be]}),at?Le.narrative_origin=Ze:delete Le.narrative_origin}const{data:Fe,error:Ve}=we?await Ne.from("submissions").update(Le).eq("id",F).eq("user_id",u.id).select("id").single():await Ne.from("submissions").insert(ve).select("id").single();if(Ve)throw Ve;if(Fe!=null&&Fe.id){const He=[];if(e.formulaValue>0&&He.push({submission_id:Fe.id,user_id:u.id,method:"formula",value:e.formulaValue,reasoning:h.length>0?h:null}),e.aiValue>0&&He.push({submission_id:Fe.id,user_id:u.id,method:"ai",value:e.aiValue,confidence:M||null,comparable_count:P.length||null,comparables:P.length>0?P:null,reasoning:S?{text:S}:null}),He.length>0&&await Ne.from("valuation_history").insert(He),e.artistName&&e.artworkTitle){const{data:Ze}=await Ne.from("submissions").select("shopify_product_id, shopify_product_handle, auto_price_sync, public_valuation_enabled").eq("user_id",u.id).eq("artist_name",e.artistName).eq("artwork_title",e.artworkTitle).not("shopify_product_id","is",null).neq("id",Fe.id).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(Ze!=null&&Ze.shopify_product_id&&Ze.auto_price_sync){await Ne.from("submissions").update({shopify_product_id:Ze.shopify_product_id,shopify_product_handle:Ze.shopify_product_handle,public_valuation_enabled:Ze.public_valuation_enabled,auto_price_sync:!0}).eq("id",Fe.id);try{const{data:at}=await Ne.functions.invoke("sync-shopify-price",{body:{submission_id:Fe.id}});at!=null&&at.updated&&me.success(`Shopify price updated: $${at.previous_price} → $${at.new_price}`)}catch(at){console.error("auto price-sync failed",at)}}}}Fe!=null&&Fe.id&&(Z(Fe.id),i==null||i(Fe.id),u.email&&(e.formulaValue||e.aiValue)&&Ne.functions.invoke("send-transactional-email",{body:{templateName:"valuation-saved",recipientEmail:u.email,idempotencyKey:`valuation-saved-${Fe.id}`,templateData:{artistName:e.artistName||void 0,artworkTitle:e.artworkTitle||void 0,fairMarketValue:g?`$${g.fairMarketValue.toLocaleStr
789ing()}`:void 0,rangeLow:g?`$${g.rangeLow.toLocaleString()}`:void 0,rangeHigh:g?`$${g.rangeHigh.toLocaleString()}`:void 0,effectiveDate:(g==null?void 0:g.effectiveDate)||void 0}}})),me.success(we?"Updated in your collection":"Saved to your collection")}catch(Q){me.error(Q.message||"Failed to save submission")}finally{V(!1)}}},te=Q=>{const he=Q;t({...e,artistName:Q.artist_name||"",artworkTitle:Q.artwork_title||"",year:Q.year||"",medium:Q.medium||"",dimensions:Q.dimensions||"",condition:Q.condition||"",edition:Q.edition||"",handSigned:Q.hand_signed??!1,hasStamp:Q.has_stamp??!1,hasCoa:he.has_coa??!1,framed:Q.framed??!1,artistBio:Q.artist_bio||"",provenance:Q.provenance||"",exhibitionHistory:Q.exhibition_history||"",narrativeOrigin:kZ(he.narrative_origin),baseValue:Q.base_value||0,scarcityMultiplier:Q.scarcity_multiplier||0,provenanceUplift:Q.provenance_uplift||0,formulaValue:Number(he.formula_value)||0,aiValue:Number(he.ai_value)||0,artistTier:he.artist_tier||"",editionSize:he.edition_size!=null?String(he.edition_size):"",priorSalePrice:he.prior_sale_price!=null?String(he.prior_sale_price):"",priorSaleYear:he.prior_sale_year!=null?String(he.prior_sale_year):"",priorSaleSource:he.prior_sale_source||"",restored:he.restored??!1,galleryExhibited:he.gallery_exhibited??!1,museumExhibited:he.museum_exhibited??!1,publishedLiterature:he.published_literature??!1,priorAuctionSale:he.prior_auction_sale??!1,estateProvenance:he.estate_provenance??!1,images:Q.image_url?[Q.image_url]:[]}),(he.retail_value!=null||he.value_low!=null)&&b({baseValue:Number(Q.base_value)||0,scarcityMultiplier:Number(Q.scarcity_multiplier)||0,provenanceUplift:Number(Q.provenance_uplift)||0,reasoning:Array.isArray(he.formula_reasoning)?he.formula_reasoning:[],fairMarketValue:Number(he.formula_value)||0,rangeLow:Number(he.value_low)||0,rangeHigh:Number(he.value_high)||0,retailValue:Number(he.retail_value)||0,insuranceValue:Number(he.insurance_value)||0,confidence:Number(he.formula_confidence)||0,missing:[],effectiveDate:he.valuation_effective_date||new Date().toISOString().slice(0,10),valueDefinition:"Fair market value — the price a willing buyer and willing seller would agree on, neither under compulsion, both reasonably informed.",methodology:[],disclosures:[],marketabilityDiscount:Number(he.marketability_discount)||0,auctionEstimateLow:Number(he.auction_estimate_low)||0,auctionEstimateHigh:Number(he.auction_estimate_high)||0,netAtAuction:0,netOnConsignment:Number(he.net_on_consignment)||0,commissionRate:.5,anchor:"model",comparableCount:0});const ve=Array.isArray(he.formula_reasoning)?he.formula_reasoning:[],we=typeof he.ai_reasoning=="string"?he.ai_reasoning:null,Le=Array.isArray(he.ai_comparables)?he.ai_comparables:[],Fe=typeof he.ai_confidence=="number"?he.ai_confidence:0;x(ve),C(we),R(Le),T(Fe),n==null||n({comparables:Le,confidence:Fe}),p(4),me.success("Submission loaded"),Z(Q.id),i==null||i(Q.id),r==null||r()};if(l==="submissions")return o.jsxs("div",{className:"space-y-10",children:[o.jsxs("header",{children:[o.jsx("h2",{className:"font-display text-2xl font-semibold tracking-tight",children:"My Submissions"}),o.jsx("p",{className:"mt-1 font-body text-sm text-muted-foreground",children:"Every work you have saved, with its most recent estimate. Open one to revalue it or download a report."})]}),o.jsx(fZ,{onOpen:te,onStart:()=>{typeof window<"u"&&window.location.assign("/value")}}),o.jsx(xZ,{})]});if(l==="consignments")return o.jsxs("div",{className:"space-y-10",children:[o.jsxs("header",{children:[o.jsx("h2",{className:"font-display text-2xl font-semibold tracking-tight",children:"My Consignments"}),o.jsx("p",{className:"mt-1 font-body text-sm text-muted-foreground",children:"Works you have offered to Reverie, their review status, and what you are due when a work sells."})]}),o.jsx(gZ,{defaultExpanded:!0}),E?o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"rounded-md border border-border bg-cream p-4",children:[o.jsx("h3",{className:"font-display text-base font-semibold tracking-tight",children:"Payment details"}),o.jsx("p",{className:"mt-1 font-body text-xs leading-relaxed text-muted-foreground",children:"One of your works has been accepted, so we now need to know how you would like to be paid. Payouts are issued within 3–5 business days of funds clearing."})]}),o.jsx(bZ,{})]}):o.jsx("p",{className:"rounded-md border border-border bg-muted/40 p-4 font-body text-xs leading-relaxed text-muted-foreground",children:"Payment and tax details are requested only after a consignment has been accepted — there is nothing to complete yet."})]});const Oe=f===1?ue:f===2?ye:!0,be=()=>{p(Q=>Math.min(4,Q+1)),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})},se=()=>{p(Q=>Math.max(1,Q-1)),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})};return o.jsxs("div",{className:"space-y-7",children:[o.jsxs("header",{children:[o.jsx("h2",{className:"font-display text-2xl font-semibold tracking-tight",children:c==="consign"?"Submit a work for consignment":"Value an artwork"}),o.jsx("p",{className:"mt-1 font-body text-sm leading-relaxed text-muted-foreground",children:c==="consign"?"Start with the same details we use for a valuation. At the end you can send the work to our specialists for consignment review.":"Four short steps. Anything you do not know can be left blank — the estimate simply widens."})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-baseline justify-between",children:[o.jsxs("span",{className:"font-body text-xs font-semibold text-foreground",children:["Step ",f," of 4 — ",PZ[f-1]]}),o.jsxs("span",{className:"font-body text-[10px] font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:[Math.round((f-1)/3*100),"%"]})]}),o.jsx("div",{className:"mt-2 h-1 w-full overflow-hidden rounded-full bg-muted",role:"progressbar","aria-valuemin":1,"aria-valuemax":4,"aria-valuenow":f,"aria-label":"Valuation progress",children:o.jsx("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${f/4*100}%`}})}),u&&o.jsx("p",{className:"mt-2 font-body text-[11px] text-muted-foreground",children:"Your answers are saved automatically — you can close this and come back later."})]}),f===1&&o.jsxs("section",{className:"space-y-4 animate-fade-up","aria-label":"Essential details",children:[o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Ro,{label:"Artist",value:e.artistName,onChange:Q=>Y("artistName",Q),placeholder:"e.g., Agnes Martin"}),o.jsx("button",{type:"button",onClick:()=>Y("artistName","Unknown artist"),className:"font-body text-[11px] font-semibold text-accent underline underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"I don't know the artist"})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Ro,{label:"Title of the work",value:e.artworkTitle,onChange:Q=>Y("artworkTitle",Q),placeholder:"e.g., Untitled #12"}),o.jsx("button",{type:"button",onClick:()=>Y("artworkTitle","Untitled"),className:"font-body text-[11px] font-semibold text-accent underline underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"Use “Untitled”"})]}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsx(Ro,{label:"Year (optional)",value:e.year,onChange:Q=>Y("year",Q),placeholder:"e.g., 1965"}),o.jsx(Ro,{label:"Medium",value:e.medium,onChange:Q=>Y("medium",Q),placeholder:"e.g., Oil on canvas"})]}),o.jsxs("div",{children:[o.jsx(Ro,{label:"Dimensions",value:e.dimensions,onChange:Q=>Y("dimensions",Q),placeholder:"e.g., 36 × 48 in"}),o.jsx("p",{className:"mt-1.5 font-body text-[11px] text-muted-foreground",children:"Measure the artwork itself, height first, excluding the frame. Inches or centimetres."})]}),o.jsx(Pb,{label:"Condition",value:e.condition,onChange:Q=>Y("condition",Q),options:EZ}),De&&o.jsx("button",{type:"button",onClick:Re,className:"font-body text-xs font-semibold text-muted-foreground underline underline-offset-2 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"Fill in a sample work to 
789see how this works"})]}),f===2&&o.jsxs("section",{className:"space-y-4 animate-fade-up","aria-label":"Photographs",children:[o.jsxs("div",{className:"rounded-md border border-border bg-cream p-4",children:[o.jsx("h3",{className:"font-display text-base font-semibold tracking-tight",children:"A clear photograph of the front is required"}),o.jsx("p",{className:"mt-1.5 font-body text-xs leading-relaxed text-muted-foreground",children:"Then add the signature, the back of the work and any labels, stamps or inscriptions. These are the images our specialists rely on most, and they meaningfully tighten your estimate. Daylight, no flash, straight on."})]}),o.jsx(lZ,{images:e.images,onImagesChange:Q=>Y("images",Q)}),!ye&&o.jsx("p",{className:"font-body text-xs text-muted-foreground",children:"Add at least one photograph to continue."})]}),f===3&&o.jsxs("section",{className:"space-y-3 animate-fade-up","aria-label":"Optional supporting detail",children:[o.jsxs("div",{className:"rounded-md border border-border bg-cream p-4",children:[o.jsx("h3",{className:"font-display text-base font-semibold tracking-tight",children:"Help us refine the estimate"}),o.jsx("p",{className:"mt-1.5 font-body text-xs leading-relaxed text-muted-foreground",children:"Everything here is optional. Each item you can answer narrows the range and raises the confidence shown on your estimate. Skip whatever you don't know."})]}),o.jsx(Sh,{title:"Edition",hint:"For prints, photographs and multiples",children:o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsx(Ro,{label:"Edition number",value:e.edition,onChange:Q=>Y("edition",Q),placeholder:"e.g., 45/200, AP, HC"}),o.jsx(Ro,{label:"Edition size",value:e.editionSize,onChange:Q=>Y("editionSize",Q),placeholder:"e.g., 200 (1 if unique)"})]})}),o.jsx(Sh,{title:"Market standing",hint:"Where the artist sits in the market today",children:o.jsx(Pb,{label:"Artist market standing",value:e.artistTier,onChange:Q=>Y("artistTier",Q),options:CZ})}),o.jsxs(Sh,{title:"Prior sale or purchase",hint:"What was paid for the work, and when",children:[o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsx(Ro,{label:"Price paid",value:e.priorSalePrice,onChange:Q=>Y("priorSalePrice",Q),placeholder:"e.g., 12500"}),o.jsx(Ro,{label:"Year",value:e.priorSaleYear,onChange:Q=>Y("priorSaleYear",Q),placeholder:"e.g., 2019"})]}),o.jsx(Pb,{label:"Where it was bought",value:e.priorSaleSource,onChange:Q=>Y("priorSaleSource",Q),options:AZ})]}),o.jsxs(Sh,{title:"Authentication",hint:"Signature, stamps, certificates, framing",children:[o.jsx(Yj,{data:e,update:Y,items:[{key:"handSigned",label:"Hand signed"},{key:"hasStamp",label:"Studio or estate stamp"},{key:"hasCoa",label:"Certificate of authenticity"},{key:"framed",label:"Framed"}]}),o.jsx("p",{className:"font-body text-[11px] leading-relaxed text-muted-foreground",children:"Framing is recorded for documentation but is not counted towards market value."})]}),o.jsx(Sh,{title:"Provenance, exhibition and restoration",hint:"History and treatment of the work",children:o.jsx(Yj,{data:e,update:Y,items:[{key:"galleryExhibited",label:"Exhibited at a gallery"},{key:"museumExhibited",label:"Exhibited at a museum"},{key:"publishedLiterature",label:"Published in literature"},{key:"priorAuctionSale",label:"Sold at auction before"},{key:"estateProvenance",label:"From the artist's estate or foundation"},{key:"restored",label:"Restored or conserved"}]})})]}),f===4&&o.jsxs("section",{className:"space-y-5 animate-fade-up","aria-label":"Your estimate",children:[o.jsxs("div",{className:"space-y-2.5",children:[o.jsx("button",{type:"button",onClick:ee,className:"w-full rounded-md bg-primary px-4 py-3.5 font-body text-sm font-semibold text-primary-foreground shadow-[var(--shadow-md)] transition-all hover:brightness-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:scale-[0.99]",children:Se?"Recalculate estimate":"Calculate my estimate"}),o.jsx("button",{type:"button",onClick:ce,disabled:_,className:"w-full rounded-md border border-foreground
789/20 px-4 py-3.5 font-body text-sm font-semibold text-foreground transition-all hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:scale-[0.99] disabled:opacity-50",children:_?"Researching the market…":"Research this artist's market"}),_&&o.jsx("div",{className:"h-0.5 overflow-hidden rounded-full bg-muted",children:o.jsx("div",{className:"h-full w-full bg-accent animate-progress-sweep"})}),!u&&o.jsx(jZ,{payload:e,disabled:De})]}),!g&&!Se&&o.jsx("p",{className:"rounded-md border border-dashed border-border p-4 font-body text-xs leading-relaxed text-muted-foreground",children:"No estimate yet. Calculate one above and your fair market range, gallery retail figure and insurance replacement figure will appear here."}),g&&o.jsxs("div",{className:"animate-fade-up space-y-3 rounded-md border border-border bg-card p-4",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-body text-[10px] font-semibold uppercase tracking-[0.16em] text-accent",children:"Fair market value"}),o.jsxs("p",{className:"font-display text-3xl font-semibold tracking-tight",children:["$",g.fairMarketValue.toLocaleString()]}),o.jsxs("p",{className:"mt-0.5 font-body text-xs text-muted-foreground",children:["Estimated range $",g.rangeLow.toLocaleString()," – $",g.rangeHigh.toLocaleString()]}),o.jsxs("p",{className:"mt-2 font-body text-xs leading-relaxed text-muted-foreground",children:["Read this as: on today's market, a work like yours would most likely change hands somewhere in that range, with"," ",o.jsxs("span",{className:"font-semibold text-foreground",children:["$",g.fairMarketValue.toLocaleString()]})," ","the most probable figure."]}),o.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[o.jsxs("div",{className:"rounded border border-border bg-muted/40 p-3",children:[o.jsx("span",{className:"font-body text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"What moves the range"}),o.jsx("p",{className:"mt-1 font-body text-[11px] leading-relaxed text-muted-foreground",children:"The artist's resale record, size and medium, condition, edition size, signature and paperwork, exhibition history and any documented prior sale."})]}),o.jsxs("div",{className:"rounded border border-border bg-muted/40 p-3",children:[o.jsx("span",{className:"font-body text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"What is not included"}),o.jsx("p",{className:"mt-1 font-body text-[11px] leading-relaxed text-muted-foreground",children:"The frame, shipping, insurance, taxes, restoration costs and selling fees. A physical inspection or authentication has not been carried out."})]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3 border-t border-border pt-1",children:[o.jsxs("div",{className:"pt-3",children:[o.jsx("span",{className:"font-body text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Gallery retail price"}),o.jsxs("p",{className:"font-body text-sm font-semibold",children:["$",g.retailValue.toLocaleString()]})]}),o.jsxs("div",{className:"pt-3",children:[o.jsx("span",{className:"font-body text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Insurance replacement"}),o.jsxs("p",{className:"font-body text-sm font-semibold",children:["$",g.insuranceValue.toLocaleString()]})]})]}),o.jsxs("div",{className:"border-t border-border pt-3",children:[o.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[o.jsx("span",{className:"font-body text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Evidence confidence"}),o.jsxs("span",{className:"font-body text-xs font-semibold",children:[g.confidence,"%"]})]}),o.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:o.jsx("div",{className:"h-full rounded-full bg-accent transition-all",style:{width:`${g.confidence}%`}})}),g.missing.length>0&&o.jsxs("p",{className:"mt-2 font-body text-xs leading-relaxed text-muted-foreground",children:["Add ",g.missing.join(", ").toLowerCase()," to tighten this range."]})]}),o.jsxs("div",{className:"space-y-2 border-t border-border pt-3",children:[o.jsx("span",{className:"font-body text-[10px] font-semibold uppercase tracking-[0.16em] text-accent",children:"Seller economics"}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-body text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Auction estimate"}),o.jsxs("p",{className:"font-body text-sm font-semibold",children:["$",g.auctionEstimateLow.toLocaleStr
789ing()," – $",g.auctionEstimateHigh.toLocaleString()]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-body text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Net at auction"}),o.jsxs("p",{className:"font-body text-sm font-semibold",children:["$",g.netAtAuction.toLocaleString()]})]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-body text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Net to you on consignment"}),o.jsx("p",{className:"font-body text-[11px] leading-relaxed text-muted-foreground",children:"Depends on the terms agreed in writing before a work is accepted or listed — pricing, commission, duration and shipping are confirmed with you first."})]})]}),o.jsxs("div",{className:"space-y-1.5 border-t border-border pt-3",children:[o.jsxs("p",{className:"font-body text-[11px] leading-relaxed text-muted-foreground",children:[o.jsx("span",{className:"font-semibold text-foreground",children:"Effective date:"})," ",g.effectiveDate]}),o.jsxs("p",{className:"font-body text-[11px] leading-relaxed text-muted-foreground",children:[o.jsx("span",{className:"font-semibold text-foreground",children:"Definition of value:"})," ",g.valueDefinition]}),o.jsxs("p",{className:"font-body text-[11px] leading-relaxed text-muted-foreground",children:[o.jsx("span",{className:"font-semibold text-foreground",children:"Basis:"})," ",g.anchor==="comparables"?`${g.comparableCount} sold comparable${g.comparableCount===1?"":"s"}`:g.anchor==="prior-sale"?"documented prior transaction, indexed to the effective date":"medium and market model",g.marketabilityDiscount>0&&` · ${g.marketabilityDiscount}% marketability discount applied`]}),g.methodology.length>0&&o.jsx("ul",{className:"list-disc space-y-0.5 pl-4 font-body text-[11px] leading-relaxed text-muted-foreground",children:g.methodology.map((Q,he)=>o.jsx("li",{children:Q},he))}),g.disclosures.length>0&&o.jsxs("div",{className:"pt-1.5",children:[o.jsx("span",{className:"font-body text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Disclosures"}),o.jsx("ul",{className:"mt-1 list-disc space-y-0.5 pl-4 font-body text-[11px] leading-relaxed text-muted-foreground",children:g.disclosures.map((Q,he)=>o.jsx("li",{children:Q},he))})]})]}),o.jsx("p",{className:"border-t border-border pt-3 font-body text-[11px] leading-relaxed text-muted-foreground",children:"This is an automated, indicative estimate — not a certified appraisal. Consignment and listing decisions are reviewed by a Reverie specialist."})]}),h.length>0&&o.jsxs("div",{className:"animate-fade-up space-y-1.5 rounded-md bg-muted/60 p-4",children:[o.jsx("span",{className:"font-body text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"How this estimate was reached"}),h.map((Q,he)=>o.jsxs("p",{className:"font-body text-xs leading-relaxed text-muted-foreground",children:["• ",Q]},he))]}),S&&o.jsxs("div",{className:"animate-fade-up rounded-md bg-muted/60 p-4",children:[o.jsx("span",{className:"font-body text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Method note"}),o.jsx("p",{className:"mt-1.5 font-body text-xs leading-relaxed text-muted-foreground",children:S})]}),o.jsx(_Z,{submitted:{...e,provenance:zr(e.provenance,e.narrativeOrigin,"provenance"),exhibitionHistory:zr(e.exhibitionHistory,e.narrativeOrigin,"exhibition_history")},records:H,method:O,confidence:M||(g==null?void 0:g.confidence)||null,isDemo:U}),o.jsx(yZ,{submissionId:F,artistName:e.artistName,artworkTitle:e.artworkTitle,saving:re,onSave:qe,onConsign:()=>{a&&!a("Create an account to submit for consignment")||D(!0)},requireAuth:a}),o.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[o.jsx("label",{htmlFor:"currency",className:"font-body text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Currency"}),o.jsx("select",{id:"currency",value:ie,onChange:Q=>X(Q.target.value),className:"flex-1 rounded-md border border-input bg-background px-3 py-2 font-body text-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:["USD","EUR","GBP","CAD","AUD","CHF","JPY","HKD","SGD","AED"].map(Q=>o.jsx("option",{value:Q,children:Q},Q))})]}),o.jsx("button",{type:"button",onClick:()=>{confirm("Clear this form and start another work? Unsaved changes will be lost.")&&(t({...Gj}),x([]),C(null),b(null),Z(null),i==null||i(null),p(1),me.success("Ready for another work"))},className:"w-full rounded-md border border-input px-4 py-2.5 font-body text-xs font-semibold uppercase tracking-wider text-muted-foreground transition-all hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"Start another work"}),o.jsx("div",{className:"border-t border-border pt-5",children:o.jsx(pZ,{})})]}),o.jsxs("div",{className:"flex items-center gap-3 border-t border-border pt-5",children:[o.jsx("button",{type:"button",onClick:se,disabled:f===1,className:"min-h-[48px] rounded-md border border-input px-5 font-body text-sm font-semibold text-foreground transition-all hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-40",children:"Back"}),f<4?o.jsx("button",{type:"button",onClick:be,disabled:!Oe,className:"min-h-[48px] flex-1 rounded-md bg-primary px-5 font-body text-sm font-semibold text-primary-foreground shadow-[var(--shadow-md)] transition-all hover:brightness-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:scale-[0.99] disabled:opacity-40 disabled:shadow-none",children:f===3?"See my estimate":"Continue"}):o.jsx("span",{className:"flex-1 font-body text-xs text-muted-foreground",children:"Step 4 of 4 — choose what happens next above."})]}),f===1&&!Oe&&o.jsx("p",{className:"font-body text-xs text-muted-foreground",children:"Artist, medium, dimensions and condition are needed before continuing."}),$&&o.jsx(mZ,{data:e,valuation:g,onClose:()=>D(!1),onSuccess:()=>{D(!1),t({...Gj}),x([]),C(null),b(null),p(1)}})]})},LZ=({baseValue:e,scarcityMultiplier:t,provenanceUplift:n})=>{const r=k.useMemo(()=>{const s=e*(t/100),a=e*(n/100);return[{label:"Base Artist Value",value:e,color:"bg-linen",description:"Established market value based on artist career, demand, and comparable sales."},{label:"Medium & Scarcity",value:s,color:"bg-steel-blue",description:"Adjustment for medium rarity, edition size, and market availability."},{label:"Provenance & Exhibition",value:a,color:"bg-graphite",description:"Uplift from exhibition history, notable collections, and documented provenance."}]},[e,t,n]),i=r.reduce((s,a)=>s+a.value,0);return i===0?o.jsxs("div",{className:"space-y-3",children:[o.jsx("h3",{className:"font-display text-lg font-semibold tracking-wide",children:"Valuation Breakdown"}),o.jsx("div",{className:"h-12 rounded-sm bg-muted flex items-center justify-center",children:o.jsx("span",{className:"text-sm text-muted-foreground font-body",children:"Enter a base value to see the breakdown"})})]}):o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-baseline justify-between",children:[o.jsx("h3",{className:"font-display text-lg font-semibold tracking-wide",children:"Valuation Breakdown"}),o.jsxs("span",{className:"font-display text-2xl font-bold",children:["$",i.toLocaleStr
789ing()]})]}),o.jsx("div",{className:"flex h-14 rounded-sm overflow-hidden",children:r.map(s=>{const a=s.value/i*100;return a===0?null:o.jsx("div",{className:`${s.color} relative group cursor-default transition-opacity`,style:{width:`${a}%`},children:o.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-10",children:o.jsxs("div",{className:"bg-foreground text-background text-xs px-3 py-2 rounded-sm whitespace-nowrap font-body",children:[o.jsx("div",{className:"font-medium",children:s.label}),o.jsxs("div",{children:["$",s.value.toLocaleString()," (",a.toFixed(1),"%)"]})]})})},s.label)})}),o.jsx("div",{className:"space-y-2",children:r.map(s=>o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:`w-3 h-3 rounded-sm mt-1 flex-shrink-0 ${s.color}`}),o.jsxs("div",{children:[o.jsxs("div",{className:"text-sm font-medium font-body",children:[s.label," — $",s.value.toLocaleString()]}),o.jsx("div",{className:"text-xs text-muted-foreground font-body",children:s.description})]})]},s.label))})]})},RZ=({artistName:e,artworkTitle:t,onSeeSample:n})=>{const{user:r}=pn(),[i,s]=k.useState((r==null?void 0:r.email)||""),[a,l]=k.useState(!1),[c,d]=k.useState(!1),u=async()=>{var f;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)){me.error("Please enter a valid email address.");return}d(!0);try{Qn("premium_launch_list_joined");const{error:p}=await Ne.functions.invoke("submit-valuation-lead",{body:{name:((f=r==null?void 0:r.user_metadata)==null?void 0:f.full_name)||i,email:i,artist_name:e||null,artwork_title:t||null,message:"Launch list: notify me when the premium valuation report is available.",path:window.location.pathname}});if(p)throw p;l(!0),me.success("You're on the list — we'll email you when reports open.")}catch(p){me.error(p instanceof Error?p.message:"Could not add you to the list.")}finally{d(!1)}};return o.jsxs("div",{className:"space-y-3 border-t border-border pt-3",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("span",{className:"font-body text-[10px] font-semibold uppercase tracking-[0.18em] text-accent",children:"Coming soon"}),n&&o.jsx("button",{type:"button",onClick:n,className:"font-body text-[11px] font-semibold text-muted-foreground underline underline-offset-2 hover:text-foreground",children:"See a sample"})]}),o.jsx("p",{className:"font-body text-xs leading-relaxed text-muted-foreground",children:"The premium report is not yet available to purchase. Your free estimate is unaffected, and you can still request a specialist review or submit the work for consignment. Leave your email and we will let you know the moment reports open."}),a?o.jsx("p",{className:"rounded-md border border-border bg-cream p-3 font-body text-xs font-semibold text-foreground",children:"Added — we will be in touch."}):o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[o.jsx("label",{htmlFor:"launch-email",className:"sr-only",children:"Email address"}),o.jsx("input",{id:"launch-email",type:"email",value:i,onChange:f=>s(f.target.value),placeholder:"[email protected]",className:"min-h-[44px] flex-1 rounded-md border border-input bg-background px-3 font-body text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"}),o.jsx("button",{type:"button",onClick:u,disabled:c,className:"min-h-[44px] rounded-md bg-primary px-5 font-body text-sm font-semibold text-primary-foreground transition-all hover:brightness-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50",children:c?"Adding…":"Join the launch list"})]})]})},TZ=async e=>{var O,K;const t=new Xe({unit:"pt",format:"letter"});await sx(t);const n=t.internal.pageSize.getWidth(),r=t.internal.pageSize.getHeight(),i=60,s=n-i*2;let a=i;const l=e.formulaValue&&e.formulaValue>0?e.formulaValue:0,c=[45,45,42],d=[140,140,135],u=[220,218,213],f=U=>(t.setDrawColor(...u),t.setLineWidth(.5),t.line(i,U,n-i,U),U+16),p=U=>{a+U>r-i&&(t.addPage(),a=i)},h=(U,I,re,V,$,D,ie)=>{t.setCharSpace(0),t.setFontSize($),t.setTextColor(...D);const X=t.splitTextToSize(Nt(U),V);for(const E of X)p(ie),t.text(E,I,a),a+=ie;return a};if(ct(t,"normal"),t.setFontSize(9),t.setTextColor(...d),t.setCharSpace(4),t.text("REVERIE",n
789/2,a,{align:"center"}),t.setCharSpace(0),a+=14,t.setFontSize(6.5),t.setCharSpace(3),t.text("FINE ART COLLECTIVE",n/2,a,{align:"center"}),t.setCharSpace(0),a+=24,a=f(a)+12,e.artistName){ct(t,"bold"),t.setFontSize(24),t.setTextColor(...c);const U=t.splitTextToSize(Nt(e.artistName),s);for(const I of U)t.text(I,i,a),a+=28;a+=2}const x=[];if(e.artworkTitle&&x.push(Nt(e.artworkTitle)),e.year&&x.push(Nt(e.year)),x.length){ct(t,"italic"),t.setFontSize(13),t.setTextColor(...d);const U=t.splitTextToSize(x.join("  ·  "),s);for(const I of U)p(18),t.text(I,i,a),a+=18;a+=8}a=f(a);const g=e.images&&e.images.length>0?e.images:e.image?[e.image]:[];for(const U of g)try{const{dataUrl:I,width:re,height:V}=await D2(U),$=Math.min(s,400),D=300;let ie=re,X=V;const E=$/ie,q=D/X,F=Math.min(E,q,1);if(ie=ie*F,X=X*F,ie<120){const Y=120/ie;ie*=Y,X*=Y}p(X+24);const Z=i+(s-ie)/2;t.addImage(I,"JPEG",Z,a,ie,X,void 0,"FAST"),a+=X+16}catch{}g.length>0&&(a=f(a));const b=s/2,y=b-16,_=U=>(ct(t,"bold"),t.setFontSize(10),13+t.splitTextToSize(Nt(U)||"-",y).length*14),w=(U,I,re,V)=>{let $=V;ct(t,"normal"),t.setFontSize(7),t.setTextColor(...d),t.setCharSpace(1.5),t.text(U.toUpperCase(),re,$),t.setCharSpace(0),$+=13,ct(t,"bold"),t.setFontSize(10),t.setTextColor(...c);const D=t.splitTextToSize(Nt(I)||"-",y);for(const ie of D)t.text(ie,re,$),$+=14},S=[];e.medium&&S.push(["Medium",e.medium]),e.dimensions&&S.push(["Dimensions",e.dimensions]),e.condition&&S.push(["Condition",e.condition]),e.edition&&S.push(["Edition",e.edition]);const C=[e.handSigned&&"Hand Signed",e.hasStamp&&"Stamp",e.hasCoa&&"COA"].filter(Boolean).join(", ");C&&S.push(["Authentication",C]),S.push(["Framing",e.framed?"Framed":"Unframed"]);for(let U=0;U<S.length;U+=2){const I=_(S[U][1]),re=U+1<S.length?_(S[U+1][1]):0,V=Math.max(I,re);p(V+10);const $=a;w(S[U][0],S[U][1],i,$),U+1<S.length&&w(S[U+1][0],S[U+1][1],i+b,$),a=$+V+8}const P=e.valuation,R=P!=null&&P.fairMarketValue&&P.fairMarketValue>0?P.fairMarketValue:l;R>0&&(a=f(a),p(110),ct(t,"normal"),t.setFontSize(7),t.setTextColor(...d),t.setCharSpace(1.5),t.text("INDICATIVE FAIR MARKET VALUE",i,a),t.setCharSpace(0),a+=28,ct(t,"bold"),t.setFontSize(22),t.setTextColor(...c),t.text(`$${Math.round(R).toLocaleString()}`,i,a),a+=20,ct(t,"normal"),t.setFontSize(9),t.setTextColor(...d),P&&P.rangeLow>0&&P.rangeHigh>0&&(t.text(`Estimated range $${P.rangeLow.toLocaleString()} – $${P.rangeHigh.toLocaleString()}`,i,a),a+=14),P!=null&&P.effectiveDate&&(t.text(`Effective date: ${P.effectiveDate}`,i,a),a+=14),P!=null&&P.valueDefinition&&(a=h(`Definition of value: ${P.valueDefinition}`,i,a,s,8.5,d,12),a+=4),(O=P==null?void 0:P.methodology)!=null&&O.length&&(a=h(`Basis: ${P.methodology.join(" ")}`,i,a,s,8.5,d,12),a+=4),(K=P==null?void 0:P.disclosures)!=null&&K.length&&(a=h(`Disclosures: ${P.disclosures.join(" ")}`,i,a,s,8.5,d,12),a+=4),a=h(P!=null&&P.comparableCount?`Evidence used: ${P.comparableCount} sold comparable record${P.comparableCount===1?"":"s"} held by Reverie. No other sales are implied or asserted.`:"No verified market evidence available for this artwork. The figure above is an automated estimate based only on the details submitted by the owner.",i,a,s,8.5,d,12),a+=4,a=h("This is an automated indicative estimate, not a certified appraisal, authentication or investment opinion. A Reverie specialist can review supporting documentation.",i,a,s,8.5,d,12),a+=10);const M=[{title:"Artist notes (submitted by the owner, not verified)",content:zr(e.artistBio,e.narrativeOrigin,"artist_bio")},{title:"Provenance (submitted by the owner, not verified)",content:zr(e.provenance,e.narrativeOrigin,"provenance")},{title:"Exhibition history (submitted by the owner, not verified)",content:zr(e.exhibitionHistory,e.narrativeOrigin,"exhibition_history")}];for(const U of M)U.content&&(p(50),a=f(a),ct(t,"bold"),t.setFontSize(12),t.setTextColor(...c),t.text(U.title,i,a),a+=18,h(U.content,i,a,s,9.5,d,13.5),a+=8);const T=80,H=r-i-T;a>H?(t.addPage(),a=r-i-T):a=H,a=f(a),a+=6,ct(t,"normal"),t.setFontSize(9),t.setTextColor(...d),t.setCharSpace(3),t.text("REVERIE",n/2,a,{align:"center"}),t.setCharSpace(0),a+=12,t.setFontSize(6),t.setCharSpace(2.5),t.text("FINE ART COLLECTIVE",n/2,a,{align:"center"}),t.setCharSpace(0),a+=12,t.setFontSize(7),t.setCharSpace(0),t.text("reverieart.com",n/2,a,{align:"center"}),a+=14,t.setFontSize(6.5),t.setTextColor(...u),t.text(`Report generated ${new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}`,n/2,a,{align:"center"});
789const A=[e.artistName,e.artworkTitle].filter(Boolean).join(" - ")||"Valuation Report";t.save(`${A}.pdf`)},OZ=async(e,t)=>{let n=null;const r=Xe.prototype.save;Xe.prototype.save=function(i){try{n=this.output("blob")}catch{}return r.call(this,i)};try{await nL(e)}finally{Xe.prototype.save=r}if(!(!t||!n))try{const i=await n.arrayBuffer(),s=new Uint8Array(i);let a="";const l=32768;for(let u=0;u<s.length;u+=l)a+=String.fromCharCode(...s.subarray(u,u+l));const c=btoa(a),d=`${e.artistName||"report"}-${e.artworkTitle||"premium"}`;await Ne.functions.invoke("archive-premium-pdf",{body:{purchaseId:t,pdfBase64:c,filenameHint:d}})}catch(i){console.warn("Premium PDF archive failed (non-fatal):",i)}},Jj=[{key:"marketComparables",label:"Recorded Comparables",desc:"Only sales on record, each with source and date"},{key:"investmentOutlook",label:"Range Commentary",desc:"How the evidence shapes the range — no forecasts"},{key:"professionalAppraisal",label:"Value Statement",desc:"Value definition, effective date and method"},{key:"marketPosition",label:"Evidence Coverage",desc:"How much evidence stands behind the estimate"},{key:"conditionNotes",label:"Condition Notes",desc:"Condition and framing as submitted by the owner"}],Rb={artist:"Demo Artist (sample)",title:"Sample Work",year:"1976",medium:"Acrylic on canvas",dimensions:'48" × 72"'},jh={marketComparables:'Demo data — structure only. In a real report this section lists only comparable sales you or Reverie staff have recorded, each with its venue, sale date, currency and result. If no comparable records exist for the work, the report states "No verified market evidence available" instead of estimating from unnamed sales.',investmentOutlook:"Demo data — structure only. A real report describes how the recorded evidence and the submitted details shape the estimate range. It does not forecast prices, promise appreciation, or describe demand that is not supported by recorded sales.",professionalAppraisal:"Demo data — structure only. A real report states the estimate, its range, the effective date, the definition of value used and the method applied. Reverie is not a licensed appraiser and the report is not a certified appraisal.",marketPosition:"Demo data — structure only. A real report explains the evidence coverage behind the estimate — how many comparable records were used and how closely they match on medium, period and scale — without implying authentication.",conditionNotes:"Demo data — structure only. A real report repeats the condition, restoration and framing details you submitted, labelled as owner-submitted and not independently verified, and notes where a specialist could review supporting documentation."},IZ=`Estimated value range (demo data)
790
791The free estimate shows the indicative range, the inputs it was calculated
792from, and what is excluded. Provenance and exhibition history stay blank
793unless you provide them.
794
795This is an automated estimate, not a certified appraisal.`,DZ=({open:e,onOpenChange:t})=>{const n=k.useRef(null),r=i=>{const s=n.current,a=s==null?void 0:s.querySelector(`[data-section="${i}"]`);if(s&&a){const l=a.offsetTop-s.offsetTop-12;s.scrollTo({top:l,behavior:"smooth"})}};return o.jsx(C8,{open:e,onOpenChange:t,children:o.jsxs(Q2,{ref:n,className:"max-w-4xl embed-panel-max overflow-y-auto embed-scrollable bg-background scroll-smooth",children:[o.jsxs(e5,{children:[o.jsx(t5,{className:"font-display text-2xl",children:"Sample Report Comparison"}),o.jsxs(L8,{className:"font-body text-sm",children:["Side-by-side preview using a sample work by ",Rb.artist,' — "',Rb.title,'", ',Rb.year,"."]})]}),o.jsxs("div",{className:"rounded-md border border-accent/40 bg-accent/5 p-4 mt-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsx("h4",{className:"font-display text-sm font-bold text-foreground",children:"Included in your Premium report"}),o.jsxs("span",{className:"text-[11px] font-body text-muted-foreground",children:[Jj.length," sections"]})]}),o.jsx("ul",{className:"grid sm:grid-cols-2 gap-x-4 gap-y-2",children:Jj.map(i=>o.jsx("li",{children:o.jsxs("button",{type:"button",onClick:()=>r(i.key),className:"flex w-full items-start gap-2 text-left rounded-sm px-1 py-1 -mx-1 hover:bg-accent/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors group",children:[o.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-accent/20 text-accent-foreground",children:o.jsx(uo,{className:"h-3 w-3"})}),o.jsxs("div",{className:"text-xs font-body leading-tight",children:[o.jsx("div",{className:"font-semibold text-foreground group-hover:underline underline-offset-2",children:i.label}),o.jsx("div",{className:"text-muted-foreground",children:i.desc})]})]})},i.key))})]}),o.jsxs("div",{className:"grid md:grid-cols-2 gap-4 mt-4",children:[o.jsxs("div",{className:"rounded-md border border-border p-5 space-y-3 bg-muted/30",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"font-display text-base font-bold",children:"Standard Report"}),o.jsx("span",{className:"text-xs font-body text-muted-foreground",children:"Free"})]}),o.jsx("div",{className:"text-xs font-body text-muted-foreground border-b border-border pb-3",children:"Qu
795ick valuation summary"}),o.jsx("pre",{className:"text-xs font-body whitespace-pre-wrap leading-relaxed text-foreground/80",children:IZ}),o.jsxs("ul",{className:"text-xs font-body text-muted-foreground space-y-1 pt-2 border-t border-border",children:[o.jsx("li",{children:"✓ Estimated value"}),o.jsx("li",{children:"✓ Calculation breakdown"}),o.jsx("li",{className:"opacity-40",children:"— No recorded comparables"}),o.jsx("li",{className:"opacity-40",children:"— No evidence coverage section"}),o.jsx("li",{className:"opacity-40",children:"— No value statement or effective date"})]})]}),o.jsxs("div",{className:"rounded-md border border-accent p-5 space-y-3 bg-gradient-to-b from-accent/10 to-transparent",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"font-display text-base font-bold",children:"Premium Report"}),o.jsx("span",{className:"text-xs font-body font-semibold text-accent-foreground",children:"$9.99"})]}),o.jsx("div",{className:"text-xs font-body text-muted-foreground border-b border-border pb-3",children:"Evidence, range and value statement — not a certified appraisal"}),o.jsxs("div",{className:"space-y-3 text-xs font-body leading-relaxed",children:[o.jsxs("div",{"data-section":"marketComparables",className:"scroll-mt-4",children:[o.jsx("div",{className:"font-semibold text-foreground mb-1",children:"Recorded Comparables"}),o.jsx("p",{className:"text-foreground/75",children:jh.marketComparables})]}),o.jsxs("div",{"data-section":"investmentOutlook",className:"scroll-mt-4",children:[o.jsx("div",{className:"font-semibold text-foreground mb-1",children:"Range Commentary"}),o.jsx("p",{className:"text-foreground/75",children:jh.investmentOutlook})]}),o.jsxs("div",{"data-section":"professionalAppraisal",className:"scroll-mt-4",children:[o.jsx("div",{className:"font-semibold text-foreground mb-1",children:"Value Statement"}),o.jsx("p",{className:"text-foreground/75",children:jh.professionalAppraisal})]}),o.jsxs("div",{"data-section":"marketPosition",className:"scroll-mt-4",children:[o.jsx("div",{className:"font-semibold text-foreground mb-1",children:"Evidence Coverage"}),o.jsx("p",{className:"text-foreground/75",children:jh.marketPosition})]}),o.jsxs("div",{"data-section":"conditionNotes",className:"scroll-mt-4",children:[o.jsx("div",{className:"font-semibold text-foreground mb-1",children:"Condition Notes"}),o.jsx("p",{className:"text-foreground/75",children:jh.conditionNotes})]})]}),o.jsxs("ul",{className:"text-xs font-body text-foreground/80 space-y-1 pt-3 border-t border-border",children:[o.jsx("li",{children:"✓ Everything in Standard"}),o.jsx("li",{children:"✓ Comparable sale records Reverie holds, with source and date — or a clear note when none are held"}),o.jsx("li",{children:"✓ Range commentary based only on the evidence available"}),o.jsx("li",{children:"✓ Value statement: definition of value, effective date and method"}),o.jsx("li",{children:"✓ Evidence coverage summary"}),o.jsx("li",{children:"✓ Condition and framing as submitted by the owner"})]})]})]}),o.jsx("p",{className:"text-[11px] font-body text-muted-foreground italic mt-4 text-center",children:"Sample content shown for illustration. Your premium report is generated specifically for your artwork."})]})})},FZ="shopify",MZ="true".toLowerCase()!=="false";function $Z(e){return MZ?!0:!!(e!=null&&e.isStaff)}const BZ="2025-07",UZ="4g6cww-08.myshopify.com",zZ=`https://${UZ}/api/${BZ}/graphql.json`,qZ="e7c3bad5ea08bb99c6f0939fc2741405";async function WZ(e,t={}){const n=await fetch(zZ,{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":qZ},body:JSON.stringify({query:e,variables:t})});if(n.status===402)return me.error("Checkout unavailable",{description:"The store's Shopify plan needs to be active before purchases can be taken."}),null;if(!n.ok)throw new Error(`Shopify request failed (${n.status})`);const r=await n.json();if(r.errors)throw new Error(`Shopify error: ${r.errors.map(i=>i.message).join(", ")}`);return r}function HZ(e){try{const t=new URL(e);return t.searchParams.set("channel","online_store"),t.toString()}catch{return e}}const VZ="gid://shopify/ProductVariant/49779410108672",GZ=`
796  mutation cartCreate($input: CartInput!) {
797    cartCreate(input: $input) {
798      cart { id checkoutUrl }
799      userErrors { field message }
800    }
801  }
802`;async function YZ(e){var s,a,l,c,d;const t=[{key:"reverie_user_id",value:e.userId},{key:"reverie_product",value:"premium_report"},e.artist?{key:"artist",value:e.artist}:null,e.title?{key:"artwork",value:e.title}:null,e.submissionId?{key:"reverie_submission_id",value:e.submissionId}
802:null].filter(Boolean),n=await WZ(GZ,{input:{lines:[{quantity:1,merchandiseId:VZ}],attributes:t,buyerIdentity:e.email?{email:e.email}:void 0}}),r=((a=(s=n==null?void 0:n.data)==null?void 0:s.cartCreate)==null?void 0:a.userErrors)??[];if(r.length>0)throw new Error(r.map(u=>u.message).join(", "));const i=(d=(c=(l=n==null?void 0:n.data)==null?void 0:l.cartCreate)==null?void 0:c.cart)==null?void 0:d.checkoutUrl;if(!i)throw new Error("Could not start checkout");return HZ(i)}const KZ={shown:"Shown to",interested:"Interested",sold:"Sold to"},JZ=({submissionId:e})=>{const[t,n]=k.useState([]),[r,i]=k.useState(!0);return k.useEffect(()=>{let s=!1;return(async()=>{i(!0);const{data:a,error:l}=await Ne.from("collector_submissions").select("id, relationship, notes, created_at, collector_id").eq("submission_id",e).order("created_at",{ascending:!1});if(l||!a){s||(n([]),i(!1));return}const c=Array.from(new Set(a.map(u=>u.collector_id))).filter(Boolean);let d=new Map;if(c.length>0){const{data:u}=await Ne.from("collectors").select("id, name, email").in("id",c);(u||[]).forEach(f=>d.set(f.id,f))}s||(n(a.map(u=>({id:u.id,relationship:u.relationship,notes:u.notes,created_at:u.created_at,collector:d.get(u.collector_id)||null}))),i(!1))})(),()=>{s=!0}},[e]),r||t.length===0?null:o.jsxs("div",{className:"rounded-md border border-border/60 bg-card p-4 space-y-2.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(n2,{size:13,className:"text-muted-foreground"}),o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/80",children:"Collector History"}),o.jsxs("span",{className:"text-[10px] font-body text-muted-foreground/60",children:["· ",t.length," contact",t.length===1?"":"s"]})]}),o.jsx("ul",{className:"space-y-1.5",children:t.slice(0,6).map(s=>{var a,l;return o.jsxs("li",{className:"flex items-baseline justify-between gap-3 text-xs font-body",children:[o.jsxs("span",{className:"flex items-baseline gap-2 min-w-0",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70 shrink-0",children:KZ[s.relationship]||s.relationship}),o.jsx("span",{className:"font-semibold text-foreground truncate",children:((a=s.collector)==null?void 0:a.name)||"Unknown"}),((l=s.collector)==null?void 0:l.email)&&o.jsx("span",{className:"text-muted-foreground/60 truncate",children:s.collector.email})]}),o.jsx("span",{className:"text-[10px] text-muted-foreground/60 shrink-0",children:new Date(s.created_at).toLocaleDateString()})]},s.id)})}),t.length>6&&o.jsxs("p",{className:"text-[10px] font-body text-muted-foreground/60 italic",children:["+",t.length-6," more — manage via the CRM panel."]})]})},XZ=({submissionId:e})=>{const[t,n]=k.useState([]),[r,i]=k.useState(!0);if(k.useEffect(()=>{let p=!1;return(async()=>{i(!0);const{data:h}=await Ne.from("valuation_history").select("value,method,created_at").eq("submission_id",e).order("created_at",{ascending:!0});p||(n((h||[]).map(x=>({...x,value:Number(x.value)}))),i(!1))})(),()=>{p=!0}},[e]),r||t.length<2)return null;const s=t.filter(p=>p.method==="ai").map(p=>p.value),a=t.filter(p=>p.method==="formula").map(p=>p.value),l=s.length>=2?s:a;if(l.length<2)return null;const c=l[0],d=l[l.length-1],u=c>0?(d-c)/c*100:0,f=u>=0;return o.jsxs("div",{className:"rounded-md border border-border/60 bg-card p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(t2,{size:13,className:"text-muted-foreground"}),o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/80",children:"Valuation History"}),o.jsxs("span",{className:"text-[10px] font-body text-muted-foreground/60",children:["· ",l.length," valuation",l.length===1?"":"s"]})]}),o.jsxs("div",{className:"flex items-end justify-between gap-4",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("p",{className:"font-display text-2xl font-semibold tabular-nums",children:["$",Math.round(d).toLocaleString()]}),o.jsxs("p",{className:`text-[11px] font-body font-semibold ${f?"text-emerald-700":"text-rose-700"}`,children:[f?"▲":"▼"," ",Math.abs(u).toFixed(1),"% since first valuation"]})]}),o.jsx(WP,{values:l,width:140,height:36})]}),o.jsxs("div",{className:"flex items-center justify-between text-[10px] font-body text-muted-foreground
802/70",children:[o.jsxs("span",{children:["First: $",Math.round(c).toLocaleString()," · ",new Date(t[0].created_at).toLocaleDateString()]}),o.jsxs("span",{children:["Latest: ",new Date(t[t.length-1].created_at).toLocaleDateString()]})]})]})},Ws=({value:e,onChange:t,className:n,as:r="p"})=>{const[i,s]=k.useState(!1),[a,l]=k.useState(e);if(i){const c=e.length>80,d=`${n} bg-transparent border border-primary/30 rounded px-1 focus:outline-none focus:ring-1 focus:ring-primary/40 w-full`;return c?o.jsx("textarea",{value:a,onChange:u=>l(u.target.value),onBlur:()=>{t(a),s(!1)},onKeyDown:u=>{u.key==="Escape"&&(l(e),s(!1))},className:`${d} resize-none min-h-[60px]`,rows:4,autoFocus:!0}):o.jsx("input",{value:a,onChange:u=>l(u.target.value),onBlur:()=>{t(a),s(!1)},onKeyDown:u=>{u.key==="Enter"&&(t(a),s(!1)),u.key==="Escape"&&(l(e),s(!1))},className:d,autoFocus:!0})}return o.jsx(r,{className:`${n} cursor-pointer hover:bg-muted/40 rounded px-1 -mx-1 transition-colors`,onClick:()=>{l(e),s(!0)},title:"Click to edit",children:e})},Xj=({data:e,insights:t,valuation:n,onDataChange:r,requireAuth:i,submissionId:s})=>{k.useState(!1);const[a,l]=k.useState(!1),[c,d]=k.useState(null),[u,f]=k.useState(!1),[p,h]=k.useState(!1),[x,g]=k.useState(!1),{user:b}=pn(),{isAdmin:y}=v2(),_=FZ,w=$Z({isStaff:y}),S=k.useCallback(async(F=15)=>{if(!b)return!1;for(let Z=0;Z<F;Z++){const{data:Y}=await Ne.from("premium_purchases").select("id").eq("user_id",b.id).eq("status","completed").eq("environment",_).is("used_at",null).limit(1);if(Y&&Y.length>0)return!0;await new Promise(ee=>setTimeout(ee,2e3))}return!1},[b,_]);k.useEffect(()=>{if(!b)return;const Z=new URLSearchParams(window.location.search).get("checkout")==="success";(async()=>{if(Z){f(!0);const ce=await S();f(!1),ce?me.success("Payment confirmed! Click 'Generate Premium Report' to create your report."):me.info("Payment is being processed. Try clicking the premium report button in a moment.")}})();const ee=async()=>{if(document.visibilityState!=="visible"||!sessionStorage.getItem("reverie_premium_checkout_open"))return;sessionStorage.removeItem("reverie_premium_checkout_open"),f(!0);const ce=await S(10);f(!1),ce&&me.success("Payment confirmed — generate your premium report.")};return document.addEventListener("visibilitychange",ee),()=>document.removeEventListener("visibilitychange",ee)},[b,S]);const C=(F,Z)=>{r==null||r({...e,[F]:Z})},P=e.baseValue+e.baseValue*(e.scarcityMultiplier/100)+e.baseValue*(e.provenanceUplift/100),R=k.useRef(!1);k.useEffect(()=>{R.current||P>0&&!c&&(R.current=!0,Qn("premium_cta_viewed"))},[P,c]);const M=(t==null?void 0:t.comparables)??[],[T,H]=k.useState(new Set);k.useEffect(()=>{H(new Set)},[t==null?void 0:t.comparables]);const A=M.filter((F,Z)=>!T.has(Z)),O=A.length,K=Math.max(0,Math.min(100,(t==null?void 0:t.confidence)??0)),U=A.map(F=>Number(F.salePrice)).filter(F=>F>0),I=T.size>0&&U.length>0?Math.round(U.reduce((F,Z)=>F+Z,0)/U.length):e.aiValue,re=Math.round(I>0?I:e.formulaValue>0?e.formulaValue:P),V=I>0&&(K>0||O>0),$=Math.max(8,Math.min(35,35-K*.2-Math.min(O,5)*2)),D=Math.round(re*(1-$/100)),ie=Math.round(re*(1+$/100)),X=K>=75?"High":K>=50?"Moderate":K>0?"Low":"Unrated";if(!(e.artistName||e.artworkTitle||e.baseValue>0))return o.jsx("div",{className:"flex items-start justify-center pt-16 pb-10 min-h-[280px]",children:o.jsxs("div",{className:"text-center space-y-3 max-w-xs",children:[o.jsx("div",{className:"w-12 h-12 mx-auto rounded-full border-2 border-dashed border-muted-foreground/20 flex items-center justify-center",children:o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground/30",children:[o.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),o.jsx("circle",{cx:"9",cy:"9",r:"2"}),o.jsx("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})}),o.jsx("h2",{className:"font-display text-xl font-semibold text-muted-foreground/70",children:"Begin entering artwork details"}
802),o.jsx("p",{className:"text-xs text-muted-foreground/50 font-body leading-relaxed",children:"The valuation report will appear here as you fill in the entry form."})]})});const q={...e,image:e.images[0]||null,valuation:n??null};return o.jsxs("div",{className:"space-y-8 max-w-2xl animate-fade-up",children:[o.jsxs("header",{className:"space-y-1.5 pb-6 border-b border-border",children:[e.artistName&&o.jsx(Ws,{value:e.artistName,onChange:F=>C("artistName",F),className:"font-display text-4xl font-bold tracking-wide leading-tight",as:"h1"}),o.jsxs("div",{className:"flex items-baseline gap-3 flex-wrap",children:[e.artworkTitle&&o.jsx(Ws,{value:e.artworkTitle,onChange:F=>C("artworkTitle",F),className:"font-display text-2xl italic text-muted-foreground",as:"h2"}),e.year&&o.jsx(Ws,{value:e.year,onChange:F=>C("year",F),className:"text-sm text-muted-foreground/70 font-body",as:"span"})]})]}),e.images.length>0&&o.jsx("div",{className:"space-y-4",children:e.images.map((F,Z)=>o.jsx("div",{className:"rounded-md overflow-hidden shadow-[var(--shadow-lg)]",children:o.jsx("img",{src:F,alt:`${e.artworkTitle||"Artwork"} ${e.images.length>1?`(${Z+1})`:""}`,className:"w-full max-h-[420px] object-contain bg-muted/30"})},Z))}),s&&o.jsx(XZ,{submissionId:s}),s&&o.jsx(JZ,{submissionId:s}),o.jsxs("div",{className:"grid grid-cols-2 gap-x-10 gap-y-5 text-sm font-body",children:[e.medium&&o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Medium"}),o.jsx(Ws,{value:e.medium,onChange:F=>C("medium",F),className:"font-semibold text-foreground"})]}),e.dimensions&&o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Dimensions"}),o.jsx(Ws,{value:e.dimensions,onChange:F=>C("dimensions",F),className:"font-semibold text-foreground"})]}),e.condition&&o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Condition"}),o.jsx(Ws,{value:e.condition,onChange:F=>C("condition",F),className:"font-semibold text-foreground"})]}),e.edition&&o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Edition"}),o.jsx(Ws,{value:e.edition,onChange:F=>C("edition",F),className:"font-semibold text-foreground"})]}),(e.handSigned||e.hasStamp||e.hasCoa)&&o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Authentication"}),o.jsx("p",{className:"font-semibold text-foreground",children:[e.handSigned&&"Hand Signed",e.hasStamp&&"Stamp",e.hasCoa&&"COA"].filter(Boolean).join(", ")})]}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Framing"}),o.jsx("p",{className:"font-semibold text-foreground",children:e.framed?"Framed":"Unframed"})]}),P>0&&o.jsxs("div",{className:"col-span-2 pt-4 border-t border-border space-y-3",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Recommended List Price"}),o.jsxs("p",{className:"font-display text-3xl font-bold tracking-wide",children:["$",re.toLocaleString()]}),o.jsx("p",{className:"text-[11px] font-body text-muted-foreground/80 italic",children:M.length>0?"Anchored to the recorded comparable sales listed below, each shown with its source and date.":"Calculated from the attributes you submitted. No comparable sale records are held for this work, so no market evidence is claimed."})]}),V&&o.jsxs("div",{className:"rounded-md border border-border/60 bg-card p-4 space-y-2",children:[o.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground
802/80",children:"Likely Price Range"}),o.jsxs("span",{className:"text-[10px] font-body text-muted-foreground/80",children:["Confidence: ",o.jsx("strong",{className:"text-foreground",children:X}),K>0&&o.jsxs("span",{className:"text-muted-foreground/60",children:[" (",K,"/100)"]}),O>0&&o.jsxs("span",{className:"text-muted-foreground/60",children:[" · ",O," comp",O===1?"":"s"]})]})]}),o.jsxs("div",{className:"flex items-baseline gap-3 flex-wrap",children:[o.jsxs("p",{className:"font-display text-xl font-semibold text-foreground",children:["$",D.toLocaleString()," – $",ie.toLocaleString()]}),o.jsxs("span",{className:"text-[11px] font-body text-muted-foreground",children:["most likely ",o.jsxs("strong",{className:"text-foreground",children:["$",re.toLocaleString()]})]})]}),o.jsxs("div",{className:"relative h-2 rounded-full bg-muted overflow-hidden mt-1",children:[o.jsx("div",{className:"absolute inset-y-0 left-[8%] right-[8%] bg-primary/25 rounded-full"}),o.jsx("div",{className:"absolute top-1/2 -translate-y-1/2 -translate-x-1/2 w-2.5 h-2.5 rounded-full bg-primary shadow-[var(--shadow-sm)]",style:{left:"50%"}})]}),o.jsx("p",{className:"text-[10px] font-body text-muted-foreground/70 italic leading-relaxed",children:"Range widens when fewer comparables or lower confidence; tightens as evidence strengthens. Use the midpoint as your list price and the low end as a negotiation floor."})]}),(e.formulaValue>0||e.aiValue>0)&&o.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2 border-t border-border/60",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Replacement Value (Formula)"}),o.jsx("p",{className:"font-display text-lg font-semibold text-foreground/90",children:e.formulaValue>0?`$${Math.round(e.formulaValue).toLocaleString()}`:"—"}),o.jsx("p",{className:"text-[10px] font-body text-muted-foreground/70",children:"Insurance / replacement floor"})]}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Fair Market Value"}),o.jsx("p",{className:"font-display text-lg font-semibold text-foreground/90",children:e.aiValue>0?`$${Math.round(e.aiValue).toLocaleString()}`:"—"}),o.jsx("p",{className:"text-[10px] font-body text-muted-foreground/70",children:M.length>0?`Anchored to ${M.length} recorded comparable sale${M.length===1?"":"s"}`:"No comparable sale records held — attributes only"})]})]}),M.length>0&&e.formulaValue>0&&e.aiValue>0&&(()=>{const F=e.aiValue-e.formulaValue,Z=Math.round(Math.abs(F)/e.formulaValue*100),Y=F>0,ee=Z>=25;return o.jsxs("div",{className:"rounded-md bg-muted/40 border border-border/60 p-3.5 space-y-1.5",children:[o.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/80",children:"Why the two numbers differ"}),o.jsx("p",{className:"text-[11px] font-body leading-relaxed text-muted-foreground",children:ee?o.jsxs(o.Fragment,{children:["The comparables-based value is ",o.jsxs("strong",{className:"text-foreground",children:[Z,"% ",Y?"higher":"lower"]})," than the formula."," ",Y?"The formula prices the physical object — medium, size, condition, age. The comparables value reflects this artist's actual auction and gallery record, demand, and recent market momentum, which the formula has no way to see. For collected or in-demand artists, the market price almost always exceeds the replacement cost.":"The formula prices the physical object — medium, size, condition, age — and assumes a baseline market. Comparable sales for this artist are coming in below that baseline, which can indicate softer demand, a quieter recent auction record, or an oversupplied segment."]}):o.jsxs(o.Fragment,{children:["The two numbers are within ",Z,"% of each other — a strong sign that both methods agree on price. Use the comparables value as your list price and the formula value as a defensible floor."]})}),o.jsx("p",{className:"text-[10px] font-body text-muted-foreground
802/70 italic",children:"Formula = replacement / insurance value (object cost). Comparables = fair market value (what it sells for today)."})]})})()]})]}),e.baseValue>0&&o.jsx("div",{className:"border border-border rounded-md p-6 bg-card shadow-[var(--shadow-sm)]",children:o.jsx(LZ,{baseValue:e.baseValue,scarcityMultiplier:e.scarcityMultiplier,provenanceUplift:e.provenanceUplift})}),zr(e.artistBio,e.narrativeOrigin,"artist_bio")&&o.jsxs("section",{className:"space-y-2.5",children:[o.jsx("h3",{className:"font-display text-xl font-bold tracking-wide",children:"Artist notes"}),o.jsx("p",{className:"text-[10px] font-body uppercase tracking-wider text-muted-foreground",children:"Submitted by the owner — not independently verified"}),o.jsx(Ws,{value:e.artistBio,onChange:F=>C("artistBio",F),className:"text-sm font-body font-medium leading-relaxed text-muted-foreground whitespace-pre-line"})]}),zr(e.provenance,e.narrativeOrigin,"provenance")&&o.jsxs("section",{className:"space-y-2.5",children:[o.jsx("h3",{className:"font-display text-xl font-bold tracking-wide",children:"Provenance"}),o.jsx("p",{className:"text-[10px] font-body uppercase tracking-wider text-muted-foreground",children:"Submitted by the owner — not independently verified"}),o.jsx(Ws,{value:e.provenance,onChange:F=>C("provenance",F),className:"text-sm font-body font-medium leading-relaxed text-muted-foreground whitespace-pre-line"})]}),zr(e.exhibitionHistory,e.narrativeOrigin,"exhibition_history")&&o.jsxs("section",{className:"space-y-2.5",children:[o.jsx("h3",{className:"font-display text-xl font-bold tracking-wide",children:"Exhibition History"}),o.jsx("p",{className:"text-[10px] font-body uppercase tracking-wider text-muted-foreground",children:"Submitted by the owner — not independently verified"}),o.jsx(Ws,{value:e.exhibitionHistory,onChange:F=>C("exhibitionHistory",F),className:"text-sm font-body font-medium leading-relaxed text-muted-foreground whitespace-pre-line"})]}),P>0&&t&&(t.confidence>0||t.comparables.length>0)&&o.jsxs("section",{className:"rounded-md border border-border bg-muted/30 p-5 space-y-4",children:[t.confidence>0&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h4",{className:"font-display text-sm font-bold tracking-wide",children:"Valuation Confidence"}),o.jsxs("span",{className:"text-xs font-body font-semibold text-foreground",children:[t.confidence,"/100"]})]}),o.jsx("div",{className:"h-1.5 w-full bg-background rounded-full overflow-hidden border border-border",children:o.jsx("div",{className:`h-full rounded-full transition-all ${t.confidence>=75?"bg-emerald-500":t.confidence>=50?"bg-amber-500":"bg-stone-400"}`,style:{width:`${t.confidence}%`}})}),o.jsx("p",{className:"text-[10px] font-body text-muted-foreground leading-relaxed",children:t.confidence>=75?"Good coverage — the submitted details are complete. This reflects data coverage only, not authenticity.":t.confidence>=50?"Moderate coverage — some details are missing. Adding condition or documentation detail will sharpen the estimate.":"Limited coverage — add more detail, and have a Reverie specialist review your documentation before transacting."})]}),M.length>0&&o.jsxs("div",{className:"space-y-2 pt-1",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("h4",{className:"font-display text-sm font-bold tracking-wide",children:"Recorded comparable sales"}),o.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-body uppercase tracking-wider text-muted-foreground",children:[o.jsxs("span",{children:[O,"/",M.length," included"]}),T.size>0&&o.jsx("button",{onClick:()=>H(new Set),className:"text-primary hover:underline",children:"Reset"})]})]}),o.jsx("p",{className:"text-[10px] font-body text-muted-foreground/80 leading-relaxed",children:"Uncheck a sale to exclude it as an outlier — the price band recomputes live."}),o.jsx("div",{className:"space-y-1.5",children:M.map((F,Z)=>{const Y=T.has(Z);return o.jsxs("label",{className:`flex items-start gap-3 p-2.5 rounded-sm border cursor-pointer transition-all ${Y?"bg-muted/40 border-border/40 opacity-60":"bg-background border-border/60 hover:border-primary/40"}
802`,children:[o.jsx("input",{type:"checkbox",checked:!Y,onChange:()=>{H(ee=>{const ce=new Set(ee);return Y?ce.delete(Z):ce.add(Z),ce})},className:"mt-0.5 h-3.5 w-3.5 accent-primary cursor-pointer"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("p",{className:`text-xs font-body font-semibold truncate ${Y?"line-through":"text-foreground"}`,children:[F.title||"Untitled",F.year&&o.jsxs("span",{className:"font-normal text-muted-foreground",children:[" · ",F.year]})]}),o.jsx("p",{className:"text-[10px] font-body text-muted-foreground truncate",children:[F.medium,F.dimensions].filter(Boolean).join(" · ")}),o.jsxs("p",{className:"text-[10px] font-body text-muted-foreground/80 mt-0.5",children:[F.saleVenue,F.saleDate&&` · ${F.saleDate}`]})]}),o.jsx("p",{className:`text-xs font-body font-bold flex-shrink-0 ${Y?"line-through text-muted-foreground":"text-foreground"}`,children:F.salePrice>0?`$${F.salePrice.toLocaleString()}`:"—"})]},Z)})}),o.jsx("p",{className:"text-[10px] font-body text-muted-foreground italic leading-relaxed pt-1",children:"Each record above is held by Reverie with the source shown. No other sales are implied or asserted."})]})]}),P>0&&o.jsxs("button",{onClick:()=>{if(!(i&&!i("Create an account to download your valuation report")))try{TZ(q),me.success("PDF downloaded")}catch{me.error("Failed to generate PDF")}},className:"w-full px-4 py-3 text-sm font-body font-semibold border border-input text-foreground rounded-md hover:bg-muted/60 active:scale-[0.99] transition-all flex items-center justify-center gap-2",children:[o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),o.jsx("polyline",{points:"7 10 12 15 17 10"}),o.jsx("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]}),"Download Report PDF"]}),P>0&&b&&o.jsxs("button",{onClick:async()=>{try{const{data:F}=await Ne.from("submissions").select("id, public_share_token").eq("user_id",b.id).eq("artist_name",e.artistName).eq("artwork_title",e.artworkTitle).order("created_at",{ascending:!1}).limit(1),Z=F==null?void 0:F[0];if(!Z){me.error("Save this entry first, then generate a share link");return}let Y=Z.public_share_token;if(!Y){Y=(crypto.randomUUID().replace(/-/g,"")+Date.now().toString(36)).slice(0,24);const{error:ce}=await Ne.from("submissions").update({public_share_token:Y}).eq("id",Z.id);if(ce)throw ce}const ee=`${window.location.origin}/r/${Y}`;await navigator.clipboard.writeText(ee),me.success("Public link copied — anyone with the URL can view this report")}catch(F){me.error(F.message||"Failed to create share link")}},className:"w-full px-4 py-3 text-sm font-body font-semibold border border-input text-foreground rounded-md hover:bg-muted/60 active:scale-[0.99] transition-all flex items-center justify-center gap-2",children:[o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}),o.jsx("polyline",{points:"16 6 12 2 8 6"}),o.jsx("line",{x1:"12",x2:"12",y1:"2",y2:"15"})]}),"Copy Shareable Link"]}),P>0&&o.jsxs("div",{className:"rounded-md border border-[hsl(var(--accent))] bg-gradient-to-b from-accent/10 to-transparent p-5 space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-accent-foreground",children:o.jsx("path",{d:"m2 4 3 12h14l3-12-6 7-4-7-4 7-6-7zm3 16h14"})}),o.jsx("h3",{className:"font-display text-sm font-bold tracking-wide",children:"Premium Valuation Report"})]}),o.jsx("p",{className:"text-xs font-body text-muted-foreground leading-relaxed",children:"An expanded informational record of the submitted artwork and the evidence available. It is not a certified appraisal, authentication or investment opinion."}),o.jsx("ul",{className:"space-y-1.5",children:["Any comparable sale records Reverie holds, each with source and date — or a clear note when none are held","How the submitted attributes and any recorded evidence shape the range","The estimate, its range, the effective date and the method used","Condition and framing exactly as submitted by the owner"].map(F=>o.jsxs("li",{className:"flex items-start gap-2 text-xs font-body text-foreground",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",className:"mt-0.5 flex-shrink-0 text-accent-foreground",children:o.jsx("polyline",{points:"20 6 9 17 4 12"})}),F]},F))}),o.jsxs("div",{className:"flex items-baseline justify-between gap-2 border-t border-border pt-2",children:[o.jsx("span",{className:"font-display text-lg font-bold",children:"$9.99"}),o.jsx("span",{className:"text-[11px] font-body text-muted-foreground",children:"one-time · no subscription"}),o.jsx("button",{type:"button",onClick:()=>h(!0),className:"text-[11px] font-body font-semibold uppercase tracking-wider text-muted-foreground hover:text-foreground transition-colors",children:"See a sample →"})]}),c?o.jsxs("button",{onClick:async()=>{try{let F;if(b){const{data:Z}=await Ne.from("premium_purchases").select("id").eq("user_id",b.id).eq("status","completed").eq("environment",_).not("report_data","is",null).order("created_at",{ascending:!1}).limit(1).maybeSingle();F=Z==null?void 0:Z.id}await OZ({...e,image:e.images[0]||null,reportContent:c},F),me.success("Premium PDF downloaded")}catch{me.error("Failed to generate premium PDF")}},className:"w-full px-4 py-3 text-sm font-body font-semibold bg-accent text-accent-foreground rounded-md shadow-[var(--shadow-md)] hover:brightness-105 active:scale-[0.99] transition-all flex items-center justify-center gap-2",children:[o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),o.jsx("polyline",{points:"7 10 12 15 17 10"}),o.jsx("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]}),"Download Premium Report PDF"]}):!w&&!y?o.jsx(RZ,{artistName:e.artistName,artworkTitle:e.artworkTitle,onSeeSample:()=>h(!0)}):o.jsx("button",{onClick:async()=>
802{if(!y&&i&&!i("Create an account to purchase a premium report")||!y&&!b)return;if(y){l(!0);try{Qn("premium_report_generated");const{data:Y,error:ee}=await Ne.functions.invoke("generate-premium-report",{body:{artistName:e.artistName,artworkTitle:e.artworkTitle,year:e.year,medium:e.medium,dimensions:e.dimensions,condition:e.condition,edition:e.edition,baseValue:e.baseValue,scarcityMultiplier:e.scarcityMultiplier,provenanceUplift:e.provenanceUplift,adminBypass:!0},headers:{"x-payments-environment":_}});if(ee)throw ee;if(Y!=null&&Y.success)d(Y.data),me.success("Premium report generated (admin)");else throw new Error((Y==null?void 0:Y.error)||"Generation failed")}catch(Y){me.error(Y.message||"Failed to generate premium report")}finally{l(!1)}return}const{data:F}=await Ne.from("premium_purchases").select("*").eq("user_id",b.id).eq("status","completed").eq("environment",_).is("used_at",null);if(F&&F.length>0){l(!0);try{Qn("premium_report_generated");const{data:Y,error:ee}=await Ne.functions.invoke("generate-premium-report",{body:{artistName:e.artistName,artworkTitle:e.artworkTitle,year:e.year,medium:e.medium,dimensions:e.dimensions,condition:e.condition,edition:e.edition,baseValue:e.baseValue,scarcityMultiplier:e.scarcityMultiplier,provenanceUplift:e.provenanceUplift},headers:{"x-payments-environment":_}});if(ee)throw ee;if(Y!=null&&Y.success)d(Y.data),me.success(Y.redownload?"Previous report loaded!":"Premium report generated!");else throw new Error((Y==null?void 0:Y.error)||"Generation failed")}catch(Y){me.error(Y.message||"Failed to generate premium report")}finally{l(!1)}return}const{data:Z}=await Ne.from("premium_purchases").select("report_data").eq("user_id",b.id).eq("status","completed").eq("environment",_).not("report_data","is",null).order("created_at",{ascending:!1}).limit(1);if(Z&&Z.length>0&&Z[0].report_data){d(Z[0].report_data),me.success("Previous report loaded — click to download.");return}g(!0);try{Qn("premium_checkout_started");const Y=await YZ({userId:b.id,email:b.email||void 0,artist:e.artistName||void 0,title:e.artworkTitle||void 0,submissionId:s||void 0});sessionStorage.setItem("reverie_premium_checkout_open","1"),window.open(Y,"_blank"),me.info("Checkout opened in a new tab. Your report unlocks here once the order is paid.")}catch(Y){me.error((Y==null?void 0:Y.message)||"Failed to open checkout")}finally{g(!1)}},disabled:a||x||u,className:"w-full px-4 py-3 text-sm font-body font-semibold bg-primary text-primary-foreground rounded-md shadow-[var(--shadow-md)] hover:brightness-105 active:scale-[0.99] transition-all disabled:opacity-50 flex items-center justify-center gap-2",children:u?"Confirming payment…":a?"Generating report…":x?"Opening checkout…":o.jsxs(o.Fragment,{children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"m2 4 3 12h14l3-12-6 7-4-7-4 7-6-7zm3 16h14"})}),y?"Generate Premium Report":"Get Premium Report — $9.99"]})}),!c&&o.jsx("button",{type:"button",onClick:()=>{Qn("premium_sample_previewed"),h(!0)},className:"w-full text-xs font-body text-muted-foreground hover:text-foreground underline underline-offset-2 transition-colors",children:"Preview a sample report →"})]}),o.jsx(DZ,{open:p,onOpenChange:h}),o.jsxs("footer",{className:"border-t border-border pt-10 mt-14 text-center space-y-2",children:[o.jsx("p",{className:"font-display text-xl tracking-[0.25em] uppercase text-foreground",children:"Reverie"}),o.jsx("p",{className:"font-body text-[10px] tracking-[0.35em] uppercase text-muted-foreground/60",children:"Fine Art Collective"}),o.jsx("a",{href:"https://reverieart.com",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-xs text-muted-foreground/50 hover:text-foreground transition-colors font-body mt-1",children:"reverieart.com"}),o.jsx("p",{className:"font-body text-[10px] text-muted-foreground/40 mt-4 pt-4 border-t border-border/50",children:"This tool was built, owned & designed by Reverie Fine Art"}),o.jsxs("div",{className:"flex items-center justify-center gap-1 mt-2 font-body text-[10px] text-muted-foreground
802/40",children:[o.jsx("a",{href:"/terms",className:"inline-flex min-h-[44px] items-center px-2 hover:text-foreground transition-colors",children:"Terms"}),o.jsx("span",{children:"·"}),o.jsx("a",{href:"/refund-policy",className:"inline-flex min-h-[44px] items-center px-2 hover:text-foreground transition-colors",children:"Refunds"}),o.jsx("span",{children:"·"}),o.jsx("a",{href:"/privacy",className:"inline-flex min-h-[44px] items-center px-2 hover:text-foreground transition-colors",children:"Privacy"})]}),o.jsx("p",{className:"font-body text-[9px] text-muted-foreground/35 mt-3 max-w-sm mx-auto leading-relaxed",children:"Estimates are produced by a formula developed by Reverie Fine Art from the attributes you submit — medium, size, year and owner-reported condition — and, where Reverie holds them, from recorded comparable sales cited with their source. Where no such records exist, no market evidence is claimed. Details you provide are shown as submitted and are not independently verified. Nothing here authenticates a work or constitutes a certified appraisal; the artwork has not been physically inspected."}),y&&o.jsx(St,{to:"/admin",className:"mt-4 inline-block font-body text-xs text-muted-foreground/60 transition-colors hover:text-foreground",children:"Reverie Admin workspace"})]})]})},ZZ=()=>{const{user:e}=pn(),[t,n]=k.useState(!1),[r,i]=k.useState([]),[s,a]=k.useState(()=>{const d=typeof localStorage<"u"?localStorage.getItem("reverie:notif-seen"):null;return d?parseInt(d,10):0});k.useEffect(()=>{if(!e)return;let d=!1;return(async()=>{const u=new Date(Date.now()-7776e6).toISOString(),[f,p,h]=await Promise.all([Ne.from("submissions").select("id, artist_name, artwork_title, last_valued_at, share_view_count, share_last_viewed_at, status, submission_type, payout_status").eq("user_id",e.id).order("created_at",{ascending:!1}).limit(200),Ne.from("portfolio_shares").select("id, title, view_count, last_viewed_at").eq("user_id",e.id).not("last_viewed_at","is",null).order("last_viewed_at",{ascending:!1}).limit(10),Promise.resolve({data:null})]);if(d)return;const x=[],g=f.data||[];g.filter(b=>b.submission_type!=="consignment"&&(!b.last_valued_at||b.last_valued_at<u)).slice(0,6).forEach(b=>{x.push({id:`stale-${b.id}`,kind:"stale",title:`${b.artist_name||"Untitled"} needs re-valuation`,detail:b.last_valued_at?`Last valued ${new Date(b.last_valued_at).toLocaleDateString()}`:"Never valued",when:b.last_valued_at})}),g.filter(b=>b.share_last_viewed_at).forEach(b=>{x.push({id:`view-${b.id}`,kind:"view",title:`Share opened: ${b.artist_name||"Untitled"}`,detail:`${b.share_view_count||1} view${(b.share_view_count||1)===1?"":"s"}`,when:b.share_last_viewed_at})}),(p.data||[]).forEach(b=>{x.push({id:`pview-${b.id}`,kind:"view",title:`Viewing room opened: ${b.title||"Untitled"}`,detail:`${b.view_count} view${b.view_count===1?"":"s"}`,when:b.last_viewed_at})}),g.filter(b=>b.submission_type==="consignment"&&b.status&&b.status!=="draft").slice(0,6).forEach(b=>{x.push({id:`cons-${b.id}`,kind:"consignment",title:`Consignment: ${b.artist_name||"Untitled"}`,detail:`Status: ${b.status}${b.payout_status&&b.payout_status!=="pending"?` · Payout: ${b.payout_status}`:""}`,when:null})}),x.sort((b,y)=>new Date(y.when||0).getTime()-new Date(b.when||0).getTime()),i(x.slice(0,20))})(),()=>{d=!0}},[e,t]);const l=k.useMemo(()=>r.filter(d=>d.when&&new Date(d.when).getTime()>s).length,[r,s]);if(!e)return null;const c=()=>{const d=Date.now();a(d);try{localStorage.setItem("reverie:notif-seen",String(d))}catch{}};return o.jsxs("div",{className:"relative",children:[o.jsxs("button",{onClick:()=>{n(d=>!d),t||c()},className:"relative inline-flex h-11 w-11 items-center justify-center rounded-full border border-input text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",title:"Notifications","aria-label":"Notifications",children:[o.jsx(y7,{size:15}),l>0&&o.jsx("span",{className:"absolute -top-1 -right-1 min-w-[16px] h-[16px] px-1 rounded-full bg-primary text-primary-foreground text-[9px] font-semibold font-body inline-flex items-center justify-center",children:l>9?"9+":l})]}),t&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-[1000]",onClick:()=>n(!1)}),o.jsxs("div",{className:"absolute right-0 z-[1001] mt-2 max-h-[min(480px,calc(100vh-6rem))] w-[min(20rem,calc(100vw-2rem))] overflow-y-auto rounded-md border border-border bg-background shadow-xl embed-scrollable",children:[o.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-body font-semibold uppercase tracking-wider",children:"Notifications"}),o.jsxs("span",{className:"text-[10px] font-body text-muted-foreground",children:[r.length," item",r.length===1?"":"s"]})]}),r.length===0?o.jsx("p",{className:"p-6 text-xs font-body text-muted-foreground text-center",children:"You're all caught up."}):o.jsx("ul",{className:"divide-y divide-border",children:r.map(d=>o.jsxs("li",{className:"px-4 py-3 hover:bg-muted/40",children:[o.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[o.jsx("span",{className:`text-[9px] font-body font-semibold uppercase tracking-wider shrink-0 ${d.kind==="view"?"text-emerald-700":d.kind==="stale"?"text-amber-700":"text-primary"}`,children:d.kind==="view"?"Viewed":d.kind==="stale"?"Stale":"Consignment"}),d.when&&o.jsx("span",{className:"text-[10px] text-muted-foreground
802/60 shrink-0",children:new Date(d.when).toLocaleDateString()})]}),o.jsx("p",{className:"text-xs font-body font-semibold text-foreground mt-0.5 truncate",children:d.title}),o.jsx("p",{className:"text-[11px] font-body text-muted-foreground",children:d.detail})]},d.id))})]})]})]})},QZ=["The artist's name, if you know it — “unknown” is fine","Photographs of the front, the signature and the back of the work","Height and width, and the medium (oil, print, watercolour, mixed media)","A short note on condition — tears, fading, restoration, frame","Any provenance or purchase information: receipts, labels, certificates"],eQ=[{n:"01",title:"Submit details",body:"Answer a short set of questions about the work and add photographs. It takes a few minutes."},{n:"02",title:"Receive an estimate",body:"You get an indicative market range, a gallery retail figure and an insurance replacement figure, free of charge."},{n:"03",title:"Choose what comes next",body:"Keep the work in your collection, ask a Reverie specialist to review it, or submit it for consignment."}],tQ=({onStartValuation:e,onStartConsignment:t})=>o.jsxs("div",{className:"bg-background",children:[o.jsx("section",{className:"border-b border-border bg-cream px-6 py-14 sm:px-10 sm:py-20 lg:px-16",children:o.jsxs("div",{className:"mx-auto max-w-3xl",children:[o.jsx("p",{className:"font-body text-[10px] font-semibold uppercase tracking-[0.32em] text-muted-foreground",children:"Reverie Fine Art Collective"}),o.jsx("h1",{className:"mt-5 font-display text-4xl font-semibold leading-[1.08] tracking-tight text-foreground sm:text-5xl lg:text-6xl",children:"Understand the art you own."}),o.jsx("p",{className:"mt-6 max-w-2xl font-body text-base leading-relaxed text-muted-foreground sm:text-lg",children:"Enter the details of a painting, print or work on paper and receive a free indicative market estimate. A premium valuation report ($9.99) that documents the work in full is coming soon, and our specialists can review any work for consignment through Reverie."}),o.jsxs("div",{className:"mt-9 flex flex-col gap-3 sm:flex-row",children:[o.jsx("button",{type:"button",onClick:e,className:"inline-flex min-h-[52px] items-center justify-center rounded-md bg-primary px-7 font-body text-sm font-semibold text-primary-foreground shadow-[var(--shadow-md)] transition-all hover:brightness-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:scale-[0.99]",children:"Value an artwork"}),o.jsx("button",{type:"button",onClick:t,className:"inline-flex min-h-[52px] items-center justify-center rounded-md border border-foreground
802/20 bg-background px-7 font-body text-sm font-semibold text-foreground transition-all hover:border-foreground/40 hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:scale-[0.99]",children:"Submit for consignment"})]}),o.jsx("p",{className:"mt-7 max-w-2xl border-l-2 border-accent pl-4 font-body text-xs leading-relaxed text-muted-foreground",children:"Estimates produced here are automated and indicative. They are not certified appraisals, and they are not offers to buy. Every consignment and listing decision is reviewed by a Reverie specialist before anything is agreed."})]})}),o.jsx("section",{className:"px-6 py-14 sm:px-10 lg:px-16","aria-labelledby":"how-it-works",children:o.jsxs("div",{className:"mx-auto max-w-5xl",children:[o.jsx("h2",{id:"how-it-works",className:"font-display text-2xl font-semibold tracking-tight sm:text-3xl",children:"How it works"}),o.jsx("ol",{className:"mt-8 grid gap-8 sm:grid-cols-3",children:eQ.map(n=>o.jsxs("li",{className:"border-t border-foreground
802/15 pt-5",children:[o.jsx("span",{className:"font-body text-[11px] font-semibold tracking-[0.28em] text-accent",children:n.n}),o.jsx("h3",{className:"mt-3 font-display text-xl font-semibold tracking-tight",children:n.title}),o.jsx("p",{className:"mt-2 font-body text-sm leading-relaxed text-muted-foreground",children:n.body})]},n.n))})]})}),o.jsx("section",{className:"border-t border-border bg-cream px-6 py-14 sm:px-10 lg:px-16","aria-labelledby":"before-you-begin",children:o.jsxs("div",{className:"mx-auto max-w-3xl",children:[o.jsx("h2",{id:"before-you-begin",className:"font-display text-2xl font-semibold tracking-tight sm:text-3xl",children:"Before you begin"}),o.jsx("p",{className:"mt-3 font-body text-sm leading-relaxed text-muted-foreground",children:"Have what you can to hand. Anything you do not know can be left blank or marked “not sure” — the estimate simply becomes wider."}),o.jsx("ul",{className:"mt-7 space-y-3",children:QZ.map(n=>o.jsxs("li",{className:"flex gap-3 font-body text-sm leading-relaxed text-foreground",children:[o.jsx("span",{"aria-hidden":"true",className:"mt-[7px] h-1.5 w-1.5 flex-shrink-0 rounded-full bg-accent"}),n]},n))}),o.jsx("button",{type:"button",onClick:e,className:"mt-9 inline-flex min-h-[52px] items-center justify-center rounded-md bg-primary px-7 font-body text-sm font-semibold text-primary-foreground shadow-[var(--shadow-md)] transition-all hover:brightness-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:scale-[0.99]",children:"Start a valuation"}),o.jsxs("p",{className:"mt-6 font-body text-xs leading-relaxed text-muted-foreground",children:["Questions about a work, an estate or a collection?"," ",o.jsx(St,{to:"/about",className:"font-semibold text-foreground underline underline-offset-2",children:"Read how Reverie works"}),"."]})]})})]});function zm(){return null}const nQ=[{to:"/",label:"Value Artwork"},{to:"/submissions",label:"My Submissions"},{to:"/consignments",label:"My Consignments"},{to:"/about",label:"How It Works"}],ml=({compact:e=!1})=>{const{pathname:t}=ea();return o.jsx("nav",{className:`flex flex-wrap items-center gap-x-5 gap-y-2 text-[10px] tracking-[0.18em] uppercase font-semibold ${e?"":"py-1"}`,"aria-label":"Reverie sections",children:nQ.map(n=>(n.to==="/"?t==="/"||t==="/value":t.startsWith(n.to))?o.jsx("span",{"aria-current":"page",className:"inline-flex items-center min-h-[32px] text-foreground border-b-2 border-accent pb-0.5",children:n.label},n.to):o.jsx(St,{to:n.to,className:"inline-flex items-center min-h-[32px] text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-sm transition-colors",children:n.label},n.to))})},rQ="https://reverie-art-evaluation.lovable.app",pd=(e,t,n)=>{let r=document.head.querySelector(`meta[${e}="${t}"]`);r||(r=document.createElement("meta"),r.setAttribute(e,t),document.head.appendChild(r)),r.setAttribute("content",n)},Zj="reverie-page-jsonld";function qm(e){var r;const t=`${rQ}${e.path}`;document.title=e.title,pd("name","description",e.description),pd("property","og:title",e.title),pd("property","og:description",e.description),pd("property","og:type","website"),pd("property","og:url",t),pd("name","twitter:card","summary_large_image");let n=document.head.querySelector('link[rel="canonical"]');if(n||(n=document.createElement("link"),n.rel="canonical",document.head.appendChild(n)),n.href=t,(r=document.getElementById(Zj))==null||r.remove(),e.jsonLd){const i=document.createElement("script");i.id=Zj,i.type="application/ld+json",i.textContent=JSON.stringify(e.jsonLd),document.head.appendChild(i)}}const iQ={artistName:"",artworkTitle:"",year:"",medium:"",dimensions:"",condition:"",artistBio:"",provenance:"",exhibitionHistory:"",edition:"",handSigned:!1,hasStamp:!1,hasCoa:!1,framed:!1,artistTier:"",editionSize:"",priorSalePrice:"",priorSaleYear:"",priorSaleSource:"",restored:!1,galleryExhibited:!1,museumExhibited:!1,publishedLiterature:!1,priorAuctionSale:!1,estateProvenance:!1,baseValue:0,scarcityMultiplier:0,provenanceUplift:0,formulaValue:0,aiValue:0,images:[]},sQ={comparables:[],confidence:0},oQ="https://uufdcsnvkixltkqaptzx.supabase.co/storage/v1/object/public/artwork-images/videos/reverie-walkthrough.mp4",Wm=()=>{const{signOut:e,user:t,loading:n}=pn(),{pathname:r}=ea(),i=Yw(),[s]=XE(),a=r==="/submissions"?"submissions":r==="/consignments"?"consignments":r==="/value"?"tool":"landing",l=s.get("intent")==="consign"?"consign":"value",c=t?`reverie:valuation-draft:${t.id}`:"reverie:valuation-draft:guest",[d,u]=eL(c,iQ,{debounceMs:600}),[f,p]=k.useState(sQ),[h,x]=k.useState(null),[g,b]=k.useState(null),[y,_]=k.useState("form"),w=F=>{_(F),window.parent!==window?Aj(0):window.scrollTo({top:0,behavior:"smooth"})},S=()=>{window.parent!==window?Aj(0):window.scrollTo({top:0,behavior:"smooth"})},C=Z8(),[P,R]=k.useState(!1),[M,T]=k.useState(!1),[H,A]=k.useState(!1),[O,K]=k.useState(),U=k.useRef(null),I=Cs();k.useEffect(()=>{Qn("tool_view",{},{once:!0})},[]),k.useEffect(()=>{qm(a==="tool"?{title:"Value an artwork — free indicative estimate | Reverie",description:"Enter your artwork's details and photographs for a free indicative market estimate from Reverie Fine Art. Estimates are not certified appraisals.",path:"/value",jsonLd:qj()}:a==="consignments"?{title:"Consign an artwork with Reverie Fine Art",description:"Submit a work for specialist review and possible consignment with Reverie Fine Art. Pricing and terms are agreed with you before anything is listed.",path:"/consignments"}:a==="submissions"?{title:"My collection | Reverie Fine Art",description:"Your saved artworks, indicative estimates and review requests with Reverie Fine Art.",path:"/submissions"}:{title:"Understand the art you own | Reverie Fine Art",description:"Free indicative art valuations, specialist review and consignment with Reverie Fine Art Collective.",path:"/",jsonLd:qj()})},[a]),k.useEffect(()=>{y==="preview"&&Qn("report_viewed",{},{once:!0})},[y]),k.useEffect(()=>{const Z=new URLSearchParams(window.location.search).get("resume");Z&&(async()=>{try{const{data:Y,error:ee}=await Ne.functions.invoke(`resume-valuation?token=${encodeURIComponent(Z)}`,{method:"GET"});if(ee)throw ee;if(!(Y!=null&&Y.ok))throw new Error((Y==null?void 0:Y.error)||"This link has expired.");u(ce=>({...ce,...Y.payload})),me.success("Welcome back — your entry has been restored.")}catch(Y){me.error(Y instanceof Error?Y.message:"Could not restore that link.")}finally{window.history.replaceState({},"",window.location.pathname)}})()},[]),k.useEffect(()=>{new URLSearchParams(window.location.search).get("checkout")==="success"&&(me.success("Payment successful. You can now generate your premium report."),window.history.replaceState({},"",window.location.pathname))},[]);const re=F=>t?!0:(K(F),A(!0),!1),V=a!=="landing"&&!n&&!t&&!M,$=P&&o.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-foreground
802/80 p-4",style:I,onClick:()=>R(!1),children:o.jsxs("div",{className:"relative w-full max-w-4xl overflow-hidden rounded-lg shadow-2xl",onClick:F=>F.stopPropagation(),children:[o.jsx("button",{onClick:()=>R(!1),className:"absolute -top-10 right-0 z-10 text-background/80 transition-colors hover:text-background","aria-label":"Close video",children:o.jsx(Hr,{size:28})}),o.jsx("video",{src:oQ,controls:!0,autoPlay:!0,className:"w-full rounded-lg",style:{maxHeight:"80vh"}})]})}),D=o.jsxs(o.Fragment,{children:[V&&o.jsx(Rf,{onClose:()=>T(!0)}),H&&o.jsx(Rf,{message:O,onClose:()=>A(!1)})]}),ie=o.jsxs("div",{className:"flex items-center justify-between gap-3 overflow-x-auto border-b border-border bg-background px-5 py-3 sm:px-8",children:[o.jsx(ml,{compact:!0}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(ZZ,{}),t?o.jsx("button",{onClick:e,className:"inline-flex min-h-[44px] items-center whitespace-nowrap px-2 font-body text-[10px] font-semibold uppercase tracking-[0.18em] text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"Sign out"}):o.jsx("button",{onClick:()=>{K(void 0),A(!0)},className:"inline-flex min-h-[44px] items-center whitespace-nowrap px-2 font-body text-[10px] font-semibold uppercase tracking-[0.18em] text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"Sign in"})]})]}),X=o.jsxs("footer",{className:"border-t border-border bg-cream px-5 py-8 text-center sm:px-8",children:[o.jsx("p",{className:"font-display text-lg uppercase tracking-[0.25em] text-foreground",children:"Reverie"}),o.jsx("p",{className:"mt-1 font-body text-[10px] uppercase tracking-[0.35em] text-muted-foreground",children:"Fine Art Collective"}),o.jsx("p",{className:"mx-auto mt-5 max-w-xl font-body text-[11px] leading-relaxed text-muted-foreground",children:"Estimates produced by this tool are automated and indicative. They are not certified appraisals and are not offers to buy. Consignment and listing decisions are reviewed by a Reverie specialist."}),o.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-center gap-1 font-body text-[10px] text-muted-foreground",children:[o.jsx(St,{to:"/about",className:"inline-flex min-h-[44px] items-center px-2 hover:text-foreground",children:"How it works"}),o.jsx("span",{"aria-hidden":"true",children:"·"}),o.jsx("a",{href:"/terms",className:"inline-flex min-h-[44px] items-center px-2 hover:text-foreground",children:"Terms"}),o.jsx("span",{"aria-hidden":"true",children:"·"}),o.jsx("a",{href:"/refund-policy",className:"inline-flex min-h-[44px] items-center px-2 hover:text-foreground",children:"Refunds"}),o.jsx("span",{"aria-hidden":"true",children:"·"}),o.jsx("a",{href:"/privacy",className:"inline-flex min-h-[44px] items-center px-2 hover:text-foreground",children:"Privacy"})]})]});if(a==="landing")return o.jsxs("div",{className:"flex flex-col",ref:U,children:[o.jsx(zm,{}),ie,D,o.jsx(tQ,{onStartValuation:()=>{i("/value"),S()},onStartConsignment:()=>{i("/value?intent=consign"),S()}}),X]});if(a==="submissions"||a==="consignments")return o.jsxs("div",{className:"flex flex-col",ref:U,children:[o.jsx(zm,{}),ie,D,o.jsx("main",{className:"mx-auto w-full max-w-3xl px-5 py-8 sm:px-8",children:t?o.jsx(Kj,{data:d,onChange:u,onInsightsChange:p,onValuationChange:x,onSubmissionLoaded:()=>{i("/value"),S()},onSubmissionIdChange:b,requireAuth:re,mode:a}):o.jsxs("div",{className:"rounded-md border border-border bg-cream p-6",children:[o.jsxs("h2",{className:"font-display text-xl font-semibold tracking-tight",children:["Sign in to see your ",a==="submissions"?"saved works":"consignments"]}),o.jsx("p",{className:"mt-2 font-body text-sm leading-relaxed text-muted-foreground",children:"Create a free account to keep your valuations, revisit them later and follow the progress of anything you have offered to Reverie."}),o.jsx("button",{type:"button",onClick:()=>{K(void 0),A(!0)},className:"mt-5 min-h-[48px] rounded-md bg-primary px-6 font-body text-sm font-semibold text-primary-foreground transition-all hover:brightness-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"Sign in or create an account"})]})}),X]});const E=o.jsxs("button",{onClick:()=>R(!0),className:"inline-flex min-h-[40px] items-center gap-2 rounded-md border border-input px-3 font-body text-xs font-semibold text-foreground transition-all hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[o.jsx(LC,{size:13,"aria-hidden":"true"})," Watch a walkthrough"]}),q=o.jsx(Kj,{data:d,onChange:u,onInsightsChange:p,onValuationChange:x,onSubmissionLoaded:()=>w("preview"),onSubmissionIdChange:b,loadedSubmissionId:g,requireAuth:re,intent:l});return C?o.jsxs("div",{className:"flex flex-col",ref:U,children:[o.jsx(zm,{}),$,D,ie,o.jsxs("div",{className:"z-10 flex items-center border-b border-border bg-background",children:[o.jsx("button",{onClick:()=>w("form"),className:`flex-1 py-3.5 font-body text-xs font-semibold uppercase tracking-wider transition-colors ${y==="form"?"border-b-2 border-accent text-foreground":"text-muted-foreground"}`,children:"Artwork"}),o.jsx("button",{onClick:()=>w("preview"),className:`flex-1 py-3.5 font-body text-xs font-semibold uppercase tracking-wider transition-colors ${y==="preview"?"border-b-2 border-accent text-foreground":"text-muted-foreground"}`,children:"Report"})]}),y==="form"?o.jsxs("div",{className:"flex-1 bg-background p-5",children:[q,o.jsx("div",{className:"mt-6 flex justify-center",children:E})]}):o.jsx("div",{className:"flex-1 bg-canvas p-5",children:o.jsx(Xj,{data:d,insights:f,valuation:h,onDataChange:u,requireAuth:re,submissionId:g})}),X]}):o.jsxs("div",{className:"flex flex-col",ref:U,children:[o.jsx(zm,{}),ie,$,D,o.jsxs("div",{className:"flex flex-1",children:[o.jsx("aside",{className:"flex w-[440px] flex-shrink-0 flex-col border-r border-border bg-background p-7",children:o.jsx("div",{className:"flex-1",children:q})}),o.jsxs("main",{className:"flex-1 bg-canvas px-10 pb-12 pt-5 xl:px-14",children:[o.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[o.jsx("p",{className:"font-body text-xs text-muted-foreground",children:"Free indicative estimate · premium report coming soon"}),E]}),o.jsx(Xj,{data:d,insights:f,valuation:h,onDataChange:u,requireAuth:re,submissionId:g})]})]}),X]})},aQ=()=>{const e=ea();return k.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted",children:o.jsxs("div",{className:"text-center",children:[o.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),o.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),o.jsx("a",{href:"/",className:"text-primary underline hover:text-primary/90",children:"Return to Home"})]})})},lQ=()=>{const[e,t]=k.useState("loading"),n=new URLSearchParams(window.location.search).get("token");k.useEffect(()=>{if(!n){t("invalid");return}(async()=>{try{const l=await fetch(`https://uufdcsnvkixltkqaptzx.supabase.co/functions/v1/handle-email-unsubscribe?token=${n}`,{headers:{apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InV1ZmRjc252a2l4bHRrcWFwdHp4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzMwODczOTUsImV4cCI6MjA4ODY2MzM5NX0.eSZOtAJ0Pe_7Lm42n5ChbIZoli9lRQQWrqRxnXNKJco"}}),c=await l.json();l.ok&&c.valid===!0?t("valid"):c.reason==="already_unsubscribed"?t("used"):t("invalid")}catch{t("invalid")}})()},[n]);const r=async()=>{try{const{data:i,error:s}=await Ne.functions.invoke("handle-email-unsubscribe",{body:{token:n}});if(s)throw s;i!=null&&i.success?t("success"):(i==null?void 0:i.reason)==="already_unsubscribed"?t("used"):t("error")}catch{t("error")}};return o.jsx("div",{className:"min-h-dvh flex items-center justify-center bg-background p-6",children:o.jsxs("div",{className:"max-w-sm w-full text-center space-y-6",children:[o.jsx("p",{className:"font-display text-xl tracking-[0.25em] uppercase text-foreground",children:"Reverie"}),o.jsx("p",{className:"font-body text-[10px] tracking-[0.35em] uppercase text-muted-foreground
802/60",children:"Fine Art Collective"}),e==="loading"&&o.jsx("p",{className:"text-sm font-body text-muted-foreground",children:"Verifying…"}),e==="valid"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("p",{className:"text-sm font-body text-muted-foreground",children:"Click below to unsubscribe from email notifications."}),o.jsx("button",{onClick:r,className:"w-full px-4 py-3 text-sm font-body font-semibold bg-primary text-primary-foreground rounded-md hover:brightness-105 transition-all",children:"Confirm Unsubscribe"})]}),e==="success"&&o.jsx("p",{className:"text-sm font-body text-muted-foreground",children:"You have been unsubscribed. You will no longer receive email notifications."}),e==="used"&&o.jsx("p",{className:"text-sm font-body text-muted-foreground",children:"You are already unsubscribed."}),e==="invalid"&&o.jsx("p",{className:"text-sm font-body text-muted-foreground",children:"This unsubscribe link is invalid or has expired."}),e==="error"&&o.jsx("p",{className:"text-sm font-body text-destructive",children:"Something went wrong. Please try again later."})]})})},cQ=()=>o.jsx("div",{className:"min-h-screen bg-background text-foreground",children:o.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-16 font-body space-y-8",children:[o.jsx(St,{to:"/",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"← Back to Reverie"}),o.jsx("h1",{className:"font-display text-3xl font-bold tracking-wide",children:"Terms & Conditions"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: April 14, 2026"}),o.jsxs("section",{className:"space-y-4 text-sm leading-relaxed",children:[o.jsx("h2",{className:"font-display text-lg font-semibold",children:"1. Introduction"}),o.jsxs("p",{children:['These Terms & Conditions ("Terms") govern your use of the art valuation and consignment services provided by ',o.jsx("strong",{children:"Reverie Fine Art, LLC"}),' ("we", "us", "our") through our website and applications (the "Service"). By accessing or using the Service you agree to be bound by these Terms. If you do not agree, please do not use the Service.']}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"2. Eligibility"}),o.jsx("p",{children:"You must be at least 18 years of age or the age of majority in your jurisdiction. If you are using the Service on behalf of an organization, you represent that you have authority to bind that organization to these Terms."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"3. Account & Credentials"}),o.jsx("p",{children:"You are responsible for maintaining the confidentiality of your account credentials and for all activity under your account. You must provide accurate information and keep it current."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"4. Description of the Service"}),o.jsx("p",{children:"Reverie Fine Art provides AI-assisted art valuation estimates, premium valuation reports, and consignment submission services. Valuations are indicative retail market estimates and should not be considered formal appraisals."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"5. License"}),o.jsx("p",{children:"We grant you a limited, non-exclusive, non-transferable, revocable right to access and use the Service for your personal or internal business purposes in accordance with your selected plan."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"6. Acceptable Use"}),o.jsx("p",{children:"You agree not to:"}),o.jsxs("ul",{className:"list-disc pl-6 space-y-1",children:[o.jsx("li",{children:"Use the Service for any unlawful purpose or in violation of any applicable law."}),o.jsx("li",{children:"Engage in fraud, spam, or distribute malicious software."}),o.jsx("li",{children:"Infringe the intellectual property rights of any third party."}),o.jsx("li",{children:"Interfere with the security or integrity of the Service, including probing, scraping, or reverse engineering."}),o.jsx("li",{children:"Resell, redistribute, or sublicense access to the Service without our prior written consent."})]}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"7. Intellectual Property"}
802),o.jsx("p",{children:"All content, software, documentation, branding, and other intellectual property comprising the Service remain the exclusive property of Reverie Fine Art, LLC. Nothing in these Terms transfers any IP rights to you except the limited license granted above."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"8. User Content"}),o.jsx("p",{children:"By submitting artwork images, descriptions, or other content to the Service, you grant us a limited license to host and process that content solely for the purpose of providing the Service. You retain all ownership rights to your content."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"9. AI-Generated Content"}),o.jsx("p",{children:"The Service uses artificial intelligence to help produce valuation estimates. AI outputs may be inaccurate or incomplete. They are provided for informational purposes only and are not a substitute for professional appraisal, financial, investment, legal, or tax advice. You are responsible for verifying accuracy and for how you use any AI-generated content."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"10. Payments & Billing"}),o.jsxs("p",{children:["Our order process is conducted by our online reseller"," ",o.jsx("a",{href:"https://www.paddle.com",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Paddle.com"}),". Paddle.com is the Merchant of Record for all our orders. Paddle provides all customer service inquiries and handles returns."]}),o.jsxs("p",{children:["For full details on payment terms, billing, taxes, cancellations, and refunds, please refer to"," ",o.jsx("a",{href:"https://www.paddle.com/legal/checkout-buyer-terms",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Paddle's Buyer Terms"})," ","and our"," ",o.jsx(St,{to:"/refund-policy",className:"underline",children:"Refund Policy"}),"."]}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"11. Service Availability"}),o.jsx("p",{children:"We strive to keep the Service available and error-free, but we do not guarantee uninterrupted or error-free performance. We may modify, suspend, or discontinue any part of the Service at any time."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"12. Disclaimer of Warranties"}),o.jsx("p",{children:'THE SERVICE IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.'}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"13. Limitation of Liability"}),o.jsx("p",{children:"To the fullest extent permitted by law, our aggregate liability arising out of or related to these Terms or the Service shall not exceed the total fees you have paid us in the twelve (12) months preceding the claim. We shall not be liable for any indirect, incidental, special, consequential, or punitive damages, including loss of profits, data, or goodwill. Nothing in these Terms limits liability for fraud, death, or personal injury caused by negligence."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"14. Indemnification"}),o.jsx("p",{children:"You agree to indemnify and hold harmless Reverie Fine Art, LLC from any claims, damages, or expenses arising from your use of the Service, your content, or your violation of these Terms."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"15. Suspension & Termination"}),o.jsx("p",{children:"We may suspend or terminate your access to the Service at any time for: material breach of these Terms, non-payment, security or fraud risk, or repeated or serious policy violations. Upon termination, your right to use the Service ceases immediately."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"16. Governing Law"}),o.jsx("p",{children:"These Terms are governed by the laws of the State of Florida, United States, without regard to conflict of law provisions."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"17. Changes to These Terms"}),o.jsx("p",{children:"We may update these Terms from time to time. Continued use of the Service after changes constitutes acceptance. We will notify you of material changes via the Service or email."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"18. Contact"}),o.jsxs("p",{children:["For questions about these Terms, contact us at"," ",o.jsx("a",{href:"mailto:[email protected]",className:"underline",children:"[email protected]"}),"."]})]})]})}),dQ=()=>o.jsx("div",{className:"min-h-screen bg-background text-foreground",children:o.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-16 font-body space-y-8",children:[o.jsx(St,{to:"/",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"← Back to Reverie"}),o.jsx("h1",{className:"font-display text-3xl font-bold tracking-wide",children:"Refund Policy"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: April 14, 2026"}),o.jsxs("section",{className:"space-y-4 text-sm leading-relaxed",children:[o.jsx("h2",{className:"font-display text-lg font-semibold",children:"30-Day Money-Back Guarantee"}),o.jsxs("p",{children:["We want you to be completely satisfied with your purchase. If you are not happy with a Premium Valuation Report or any other paid product from ",o.jsx("strong",{children:"Reverie Fine Art, LLC"}),", you may request a full refund within ",o.jsx("strong",{children:"30 days"})," of your order date — no questions asked."]}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"How to Request a Refund"}),o.jsx("p",{children:"Refunds are processed by our payment provider, Paddle. To request a refund:"}),o.jsxs("ul",{className:"list-disc pl-6 space-y-1",children:[o.jsxs("li",{children:["Visit"," ",o.jsx("a",{href:"https://paddle.net",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"paddle.net"})," ","and locate your transaction, or"]}),o.jsxs("li",{children:["Email us at"," ",o.jsx("a",{href:"mailto:[email protected]",className:"underline",children:"[email protected]"})," ","with your order details, and we will initiate the refund on your behalf."]})]}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"Processing"}),o.jsx("p",{children:"Once your refund request is approved, funds will be returned to your original payment method. Processing times depend on your bank or card issuer and typically take 5–10 business days."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"Questions?"}),o.jsxs("p",{children:["If you have any questions about our refund policy, please contact us at"," ",o.jsx("a",{href:"mailto:[email protected]",className:"underline",children:"[email protected]"}),"."]})]})]})}),uQ=()=>o.jsx("div",{className:"min-h-screen bg-background text-foreground",children:o.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-16 font-body space-y-8",children:[o.jsx(St,{to:"/",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"← Back to Reverie"}),o.jsx("h1",{className:"font-display text-3xl font-bold tracking-wide",children:"Privacy Notice"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: April 14, 2026"}),o.jsxs("section",{className:"space-y-4 text-sm leading-relaxed",children:[o.jsx("h2",{className:"font-display text-lg font-semibold",children:"1. Who We Are"}),o.jsxs("p",{children:[o.jsx("strong",{children:"Reverie Fine Art, LLC"}),' ("we", "us", "our") is the data controller responsible for your personal data collected through our website and services at reverieart.com (the "Service").']}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"2. Data We Collect"}),o.jsx("p",{children:"We may collect the following categories of personal data:"}),o.jsxs("ul",{className:"list-disc pl-6 space-y-1",children:[o.jsxs("li",{children:[o.jsx("strong",{children:"Account information"})," — name, email address, and login credentials when you create an account."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Artwork submissions"})," — artwork images, descriptions, provenance details, and related content you submit for valuation or consignment."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Usage data"})," — pages visited, features used, device type, browser, IP address, and similar analytics data."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Support communications"})," — messages and correspondence when you contact us."]})]}),o.jsxs("p",{children:["Payment and billing data (credit card details, billing address) is collected and processed directly by our Merchant of Record,"," ",o.jsx("a",{href:"https://www.paddle.com",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Paddle.com"}),", and is not stored on our servers."]}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"3. How We Use Your Data"}),o.jsxs("ul",{className:"list-disc pl-6 space-y-1",children:[o.jsxs("li",{children:[o.jsx("strong",{children:"Providing the Service"})," — to create and manage your account, process valuations, generate reports, and facilitate consignment submissions."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Payment processing"})," — coordinated through Paddle for sale of products, subscription management, tax compliance, and invoicing."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Security & fraud prevention"})," — to protect our users and the integrity of the Service."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Product improvement"})," — to analyze usage patterns and improve functionality and user experience."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Customer support"})," — to respond to your inquiries and provide assistance."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Communications"})," — to send transactional emails, service updates, and, with your consent, marketing communications."]})]}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"4. Legal Basis"}),o.jsx("p",{children:"We process your personal data on the following legal bases:"}),o.jsxs("ul",{className:"list-disc pl-6 space-y-1",children:[o.jsxs("li",{children:[o.jsx("strong",{children:"Contract performance"})," — processing necessary to provide the Service you have requested."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Legitimate interests"})," — improving our products, preventing fraud, and ensuring security."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Consent"})," — where you have opted in, such as for marketing emails."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Legal obligation"})," — where required to comply with applicable law."]})]}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"5. Data Sharing"}),o.jsx("p",{children:"We may share your personal data with the following categories of recipients:"}),o.jsxs("ul",{className:"list-disc pl-6 space-y-1",children:[o.jsxs("li",{children:[o.jsx("strong",{children:"Paddle.com"})," (Merchant of Record) — for sale of our products, payment processing, subscription management, tax compliance, and invoicing."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Service providers"})," — hosting, analytics, AI processing, and support tooling providers who process data on our behalf."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Professional advisers"})," — legal and accounting professionals as needed."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Authorities"})," — law enforcement or regulatory bodies where required by law."]})]}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"6. Data Retention"}),o.jsx("p",{children:"We retain your personal data for as long as your account is active or as needed to provide the Service. When data is no longer required, we will delete or anonymize it in accordance with our retention schedules. Valuation reports and submission data are retained for your continued access unless you request deleti
802on."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"7. Your Rights"}),o.jsx("p",{children:"Depending on your jurisdiction, you may have the right to:"}),o.jsxs("ul",{className:"list-disc pl-6 space-y-1",children:[o.jsx("li",{children:"Access the personal data we hold about you."}),o.jsx("li",{children:"Request correction of inaccurate data."}),o.jsx("li",{children:"Request deletion of your data."}),o.jsx("li",{children:"Object to or restrict certain processing activities."}),o.jsx("li",{children:"Request portability of your data."}),o.jsx("li",{children:"Withdraw consent at any time (where processing is based on consent)."})]}),o.jsxs("p",{children:["To exercise any of these rights, please contact us at"," ",o.jsx("a",{href:"mailto:[email protected]",className:"underline",children:"[email protected]"}),". We will respond within 30 days."]}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"8. Security"}),o.jsx("p",{children:"We implement appropriate technical and organizational measures to protect your personal data, including encryption in transit (TLS), access controls, and secure hosting infrastructure."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"9. Cookies"}),o.jsx("p",{children:"We use essential cookies to maintain your session and authentication state. We may also use analytics cookies to understand how visitors interact with the Service. You can manage cookie preferences through your browser settings."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"10. Changes to This Notice"}),o.jsx("p",{children:"We may update this Privacy Notice from time to time. We will notify you of material changes via the Service or email. Continued use of the Service after changes constitutes acceptance."}),o.jsx("h2",{className:"font-display text-lg font-semibold",children:"11. Contact"}),o.jsxs("p",{children:["For questions or concerns about this Privacy Notice or our data practices, contact us at"," ",o.jsx("a",{href:"mailto:[email protected]",className:"underline",children:"[email protected]"}),"."]})]})]})}),Qj={pending_review:{label:"Pending Review",tone:"bg-amber-50 text-amber-900 border-amber-200",Icon:fu,description:"The curatorial team is reviewing this submission."},approved:{label:"Approved",tone:"bg-emerald-50 text-emerald-900 border-emerald-200",Icon:z0,description:"Approved for consignment."},listed:{label:"Live in Marketplace",tone:"bg-sky-50 text-sky-900 border-sky-200",Icon:Ud,description:"This artwork is listed in the Reverie Fine Art marketplace."},sold:{label:"Sold",tone:"bg-violet-50 text-violet-900 border-violet-200",Icon:Wo,description:"This artwork has sold."},declined:{label:"Not Selected",tone:"bg-stone-100 text-stone-700 border-stone-200",Icon:CC,description:"This submission was not selected for consignment."}},hQ={pending:"Pending",processing:"Processing",paid:"Paid",on_hold:"On Hold"},fQ=()=>{const{id:e}=Eu(),[t,n]=k.useState(null),[r,i]=k.useState(!0),[s,a]=k.useState(null);if(k.useEffect(()=>{(async()=>{if(!e){a("Missing consignment ID"),i(!1);return}try{const{data:f,error:p}=await Ne.functions.invoke("get-consignment-receipt",{body:{id:e}});if(p||!(f!=null&&f.success)){const h=`https://uufdcsnvkixltkqaptzx.supabase.co/functions/v1/get-consignment-receipt?id=${encodeURIComponent(e)}`,g=await(await fetch(h,{headers:{apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InV1ZmRjc252a2l4bHRrcWFwdHp4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzMwODczOTUsImV4cCI6MjA4ODY2MzM5NX0.eSZOtAJ0Pe_7Lm42n5ChbIZoli9lRQQWrqRxnXNKJco"}})).json();if(!g.success)throw new Error(g.error||"Not found");n(g.data)}else n(f.data)}catch(f){a(f.message||"Could not load consignment")}finally{i(!1)}})()},[e]),r)return o.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:o.jsx("p",{className:"font-body text-sm text-muted-foreground",children:"Loading consignment record…"})});if(s||!t)return o.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-6",children:o.jsxs("div",{className:"max-w-md text-center space-y-4",children:[o.jsx("h1",{className:"font-display text-2xl",children:"Consignment Not Found"}),o.jsx("p",{className:"font-body text-sm text-muted-foreground",children:s||"We couldn't find a consignment with that reference."}),o.jsx(St,{to:"/",className:"inline-block text-sm font-body underline",children:"Return home"})]})});const l=Qj[t.status]||Qj.pending_review,c=l.Icon,d=(t.baseValue||0)+(t.baseValue||0)*((t.scarcityMultiplier||0)/100)+(t.baseValue||0)*((t.provenanceUplift||0)/100);return o.jsx("div",{className:"min-h-screen bg-background",children:o.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-12",children:[o.jsxs("header",{className:"mb-8 pb-6 border-b border-border",children:[o.jsx(St,{to:"/",className:"text-[10px] tracking-[0.2em] uppercase font-body text-muted-foreground hover:text-foreground transition-colors",children:"Reverie Fine Art Collective"}),o.jsx("h1",{className:"font-display text-3xl mt-3",children:"Consignment Receipt"}),o.jsxs("p",{className:"font-body text-xs text-muted-foreground mt-1",children:["Reference ",t.id.slice(0,8).toUpperCase()," · Submitted ",new Date(t.createdAt).toLocaleDateString()]})]}),o.jsx("div",{className:`p-4 rounded-md border ${l.tone} mb-6`,children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(c,{size:20,className:"flex-shrink-0 mt-0.5"}),o.jsxs("div",{children:[o.jsx("p",{className:"font-body font-semibold text-sm",children:l.label}),o.jsx("p",{className:"font-body text-xs mt-1",children:l.description})]})]})}),o.jsxs("section",{className:"grid md:grid-cols-[200px_1fr] gap-6 mb-8",children:[t.imageUrl?o.jsx("img",{src:t.imageUrl,alt:t.artworkTitle||"Artwork",className:"w-full h-auto object-contain border border-border rounded-sm bg-muted/30"}):o.jsx("div",{className:"aspect-square bg-muted/30 border border-border rounded-sm flex items-center justify-center",children:o.jsx("span",{className:"text-xs font-body text-muted-foreground",children:"No image"})}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-[10px] tracking-widest uppercase font-body text-muted-foreground",children:"Artist"}),o.jsx("p",{className:"font-display text-xl",children:t.artistName||"—"})]}),t.artworkTitle&&o.jsxs("div",{children:[o.jsx("p",{className:"text-[10px] tracking-widest uppercase font-body text-muted-foreground",children:"Title"}),o.jsxs("p",{className:"font-body text-sm italic",children:[t.artworkTitle,t.year?`, ${t.year}`:""]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[t.medium&&o.jsxs("div",{children:[o.jsx("p",{className:"text-[10px] tracking-widest uppercase font-body text-muted-foreground",children:"Medium"}),o.jsx("p",{className:"font-body text-xs",children:t.medium})]}),t.dimensions&&o.jsxs("div",{children:[o.jsx("p",{className:"text-[10px] tracking-widest uppercase font-body text-muted-foreground",children:"Dimensions"}),o.jsx("p",{className:"font-body text-xs",children:t.dimensions})]}),t.condition&&o.jsxs("div",{children:[o.jsx("p",{className:"text-[10px] tracking-widest uppercase font-body text-muted-foreground",children:"Condition"}),o.jsx("p",{className:"font-body text-xs",children:t.condition})]}),t.edition&&o.jsxs("div",{children:[o.jsx("p",{className:"text-[10px] tracking-widest uppercase font-body text-muted-foreground",children:"Edition"}),o.jsx("p",{className:"font-body text-xs",children:t.edition})]})]})]})]}),d>0&&o.jsxs("section",{className:"mb-8 p-5 border border-border rounded-md bg-muted/20",children:[o.jsx("p",{className:"text-[10px] tracking-widest uppercase font-body text-muted-foreground mb-2",children:"Estimated Fair Market Value"}),o.jsxs("p",{className:"font-display text-3xl",children:["$",Math.round(d).toLocaleStr
802ing()]}),o.jsx("p",{className:"text-[11px] font-body text-muted-foreground mt-2 italic",children:"Indicative value at the time of consignment. Not a formal appraisal."})]}),t.status==="sold"&&o.jsxs("section",{className:"mb-8 grid md:grid-cols-2 gap-4",children:[t.salePrice!=null&&o.jsxs("div",{className:"p-4 border border-border rounded-md",children:[o.jsx("p",{className:"text-[10px] tracking-widest uppercase font-body text-muted-foreground mb-1",children:"Sale Price"}),o.jsxs("p",{className:"font-display text-xl",children:["$",Math.round(t.salePrice).toLocaleString()]}),t.soldAt&&o.jsxs("p",{className:"text-[11px] font-body text-muted-foreground mt-1",children:["Sold ",new Date(t.soldAt).toLocaleDateString()]})]}),t.payoutStatus&&o.jsxs("div",{className:"p-4 border border-border rounded-md",children:[o.jsx("p",{className:"text-[10px] tracking-widest uppercase font-body text-muted-foreground mb-1",children:"Consignor Payout"}),o.jsx("p",{className:"font-body text-sm font-semibold",children:hQ[t.payoutStatus]||t.payoutStatus}),t.payoutPaidAt&&o.jsxs("p",{className:"text-[11px] font-body text-muted-foreground mt-1",children:["Paid ",new Date(t.payoutPaidAt).toLocaleDateString()]})]})]}),t.signatureSigned&&o.jsx("section",{className:"mb-8 p-4 border border-border rounded-md bg-emerald-50/50",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(W0,{size:18,className:"text-emerald-700 flex-shrink-0 mt-0.5"}),o.jsxs("div",{children:[o.jsx("p",{className:"font-body text-sm font-semibold text-emerald-900",children:"Consignment Agreement Signed"}),o.jsxs("p",{className:"font-body text-xs text-emerald-800 mt-1",children:[t.submitterDisplay&&o.jsxs(o.Fragment,{children:["Signed by ",t.submitterDisplay]}),t.signatureSignedAt&&o.jsxs(o.Fragment,{children:[" on ",new Date(t.signatureSignedAt).toLocaleDateString()]}),". A complete signature record is on file with Reverie Fine Art Collective."]})]})]})}),o.jsxs("footer",{className:"pt-6 border-t border-border text-center",children:[o.jsx("p",{className:"text-[11px] font-body text-muted-foreground",children:"Reverie Fine Art Collective · Curatorial Records"}),o.jsx("p",{className:"text-[10px] font-body text-muted-foreground mt-1",children:"This receipt is a public record of consignment. For full submission details or to communicate with the curator, the consignor should sign in to their account."}),o.jsx(St,{to:"/",className:"inline-block mt-4 text-[11px] tracking-widest uppercase font-body underline",children:"Visit Reverie"})]})]})})},Hm=e=>`$${Math.round(e).toLocaleString()}`,pQ=()=>{const{token:e}=Eu(),[t,n]=k.useState(null),[r,i]=k.useState(!0),[s,a]=k.useState(null);if(k.useEffect(()=>{e&&(async()=>{i(!0);const{data:x,error:g}=await Ne.rpc("get_shared_submission",{_token:e});g?a(g.message):!x||x.length===0?a("This share link is invalid or has been revoked."):(n(x[0]),Ne.functions.invoke("track-share-view",{body:{token:e,type:"report"}}).catch(()=>{})),i(!1)})()},[e]),r)return o.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background text-muted-foreground font-body text-sm",children:"Loading valuation…"});if(s||!t)return o.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-8",children:o.jsxs("div",{className:"text-center max-w-md",children:[o.jsx("h1",{className:"font-display text-2xl font-bold mb-2",children:"Report unavailable"}),o.jsx("p",{className:"text-sm font-body text-muted-foreground",children:s})]})});const l=t.ai_value&&t.ai_value>0?Number(t.ai_value):t.formula_value&&t.formula_value>0?Number(t.formula_value):0,c=t.ai_confidence??0,d=Array.isArray(t.ai_comparables)?t.ai_comparables:[],u=d.length,f=Math.max(8,Math.min(35,35-c*.2-Math.min(u,5)*2)),p=Math.round(l*(1-f/100)),h=Math.round(l*(1+f/100));return o.jsxs("div",{className:"min-h-screen bg-canvas",children:[o.jsxs("header",{className:"border-b border-border bg-background py-4 px-6",children:[o.jsx("p",{className:"font-display text-base font-semibold tracking-wide",children:"Reverie Fine Art Collective"}),o.jsx("p",{className:"text-[10px] font-body uppercase tracking-wider text-muted-foreground",children:"Private Valuation Report"})]}),o.jsxs("main",{className:"max-w-2xl mx-auto p-8 space-y-8",children:[o.jsxs("section",{className:"space-y-1.5 pb-6 border-b border-border",children:[o.jsx("h1",{className:"font-display text-4xl font-bold tracking-wide leading-tight",children:t.artist_name||"Untitled"}),o.jsxs("div",{className:"flex items-baseline gap-3 flex-wrap",children:[t.artwork_title&&o.jsx("h2",{className:"font-display text-2xl italic text-muted-foreground",children:t.artwork_title}),t.year&&o.jsx("span",{className:"text-sm text-muted-foreground
802/70 font-body",children:t.year})]})]}),t.image_url&&o.jsx("div",{className:"rounded-md overflow-hidden shadow-[var(--shadow-lg)]",children:o.jsx("img",{src:t.image_url,alt:t.artwork_title||"Artwork",className:"w-full max-h-[420px] object-contain bg-muted/30"})}),o.jsxs("div",{className:"grid grid-cols-2 gap-x-10 gap-y-5 text-sm font-body",children:[[["Medium",t.medium],["Dimensions",t.dimensions],["Condition",t.condition],["Edition",t.edition]].filter(([,x])=>x).map(([x,g])=>o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:x}),o.jsx("p",{className:"font-semibold text-foreground",children:g})]},x)),o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Framing"}),o.jsx("p",{className:"font-semibold text-foreground",children:t.framed?"Framed":"Unframed"})]})]}),l>0&&o.jsxs("section",{className:"border-t border-border pt-6 space-y-4",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Recommended List Price"}),o.jsx("p",{className:"font-display text-4xl font-bold tracking-wide",children:Hm(l)})]}),u>0&&o.jsxs("div",{className:"rounded-md border border-border bg-card p-4",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/80",children:"Likely Price Range"}),o.jsxs("p",{className:"font-display text-xl font-semibold mt-1",children:[Hm(p)," – ",Hm(h)]}),o.jsxs("p",{className:"text-[11px] font-body text-muted-foreground mt-1",children:["Based on ",u," comparable ",u===1?"sale":"sales"," · Confidence ",c,"/100"]})]}),t.ai_reasoning&&o.jsxs("div",{className:"rounded-md bg-muted/40 p-4",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Market Analysis"}),o.jsx("p",{className:"text-xs font-body text-muted-foreground mt-1.5 leading-relaxed",children:t.ai_reasoning})]})]}),d.length>0&&o.jsxs("section",{className:"space-y-3 border-t border-border pt-6",children:[o.jsx("h3",{className:"font-display text-base font-semibold tracking-wide",children:"Comparable Sales"}),o.jsx("div",{className:"space-y-1.5",children:d.map((x,g)=>o.jsxs("div",{className:"flex items-start justify-between gap-3 p-2.5 rounded-sm bg-background border border-border/60",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("p",{className:"text-xs font-body font-semibold truncate",children:[x.title||"Untitled",x.year&&o.jsxs("span",{className:"font-normal text-muted-foreground",children:[" · ",x.year]})]}),o.jsx("p",{className:"text-[10px] font-body text-muted-foreground truncate",children:[x.medium,x.dimensions].filter(Boolean).join(" · ")}),o.jsxs("p",{className:"text-[10px] font-body text-muted-foreground/80 mt-0.5",children:[x.saleVenue,x.saleDate&&` · ${x.saleDate}`]})]}),o.jsx("p",{className:"text-xs font-body font-bold flex-shrink-0",children:x.salePrice>0?Hm(x.salePrice):"—"})]},g))})]}),o.jsxs("footer",{className:"border-t border-border pt-6 text-[10px] font-body text-muted-foreground/70 leading-relaxed",children:["This valuation is an opinion based on available comparable sales and condition data. It is not a certified appraisal. For insurance or sale, consult a qualified appraiser.",t.last_valued_at&&o.jsxs(o.Fragment,{children:[" · Last valued ",new Date(t.last_valued_at).toLocaleDateString(),"."]})]})]})]})},mQ={USD:"$",EUR:"€",GBP:"£",CAD:"C$",AUD:"A$",CHF:"CHF ",JPY:"¥",HKD:"HK$",SGD:"S$",AED:"AED "},Tb=(e,t)=>`${mQ[t||"USD"]||"$"}${Math.round(e).toLocaleString()}`,gQ=e=>Array.isArray(e)?e:[],xQ=()=>{const{token:e}=Eu(),[t,n]=k.useState([]),[r,i]=k.useState(!0),[s,a]=k.useState(null),[l,c]=k.useState(!1),[d,u]=k.useState(""),[f,p]=k.useState(!1),h=async b=>{const{data:y,error:_}=await Ne.rpc("get_shared_portfolio",{_token:e,_passcode:b??null});return _?{ok:!1,message:_.message}:!y||y.length===0?{ok:!1,message:null}:(n(y),Ne.functions.invoke("track-share-view",{body:{token:e,type:"portfolio"}}).catch(()=>{}),{ok:!0,message:null})};k.useEffect(()=>{e&&(async()=>{i(!0);const{data:b}=await Ne.rpc("get_share_gate",{_token:e}),y=Array.isArray(b)?b[0]:void 0;if(!y){a("This viewing room does not exist or the link has been revoked."),i(!1);return}if(y.expired){a("This viewing room link has expired. Ask your advisor for a fresh link."),i(!1);return}if(y.requires_passcode){c(!0),i(!1);return}const _=await h();_.ok||a(_.message||"This viewing room is empty or the link has been revoked."),i(!1)})()},[e]);const x=async b=>{b.preventDefault(),p(!0);const y=await h(d.trim());if(p(!1),!y.ok){me.error("That passcode doesn't match this link.");return}c(!1)};if(r)return o.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background text-muted-foreground font-body text-sm",children:"Loading viewing room…"});if(l)return o.jsx("div",{className:"min-h-screen flex items-center justify-center bg-canvas p-8",children:o.jsxs("form",{onSubmit:x,className:"w-full max-w-sm space-y-4 text-center",children:[o.jsx("p",{className:"font-display text-base font-semibold tracking-wide",children:"Reverie Fine Art Collective"}),o.jsx("h1",{className:"font-display text-2xl font-bold tracking-wide",children:"Private viewing room"}),o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"Enter the passcode you were given to view this 
802selection."}),o.jsx("input",{value:d,onChange:b=>u(b.target.value),placeholder:"Passcode","aria-label":"Passcode",className:"w-full px-3 py-2.5 text-sm font-body border border-input rounded-md bg-background text-center"}),o.jsx("button",{type:"submit",disabled:f||!d.trim(),className:"w-full px-4 py-2.5 text-xs font-body font-semibold uppercase tracking-wider bg-primary text-primary-foreground rounded-md disabled:opacity-50",children:f?"Checking…":"Enter"})]})});if(s||t.length===0)return o.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-8",children:o.jsxs("div",{className:"text-center max-w-md",children:[o.jsx("h1",{className:"font-display text-2xl font-bold mb-2",children:"Viewing room unavailable"}),o.jsx("p",{className:"text-sm font-body text-muted-foreground",children:s})]})});const g=t[0];return o.jsxs("div",{className:"min-h-screen bg-canvas",children:[o.jsxs("header",{className:"border-b border-border bg-background py-5 px-6",children:[o.jsx("p",{className:"font-display text-base font-semibold tracking-wide",children:"Reverie Fine Art Collective"}),o.jsx("p",{className:"text-[10px] font-body uppercase tracking-wider text-muted-foreground",children:"Private Viewing Room"})]}),o.jsxs("main",{className:"max-w-3xl mx-auto p-8 space-y-10",children:[o.jsxs("section",{className:"space-y-2",children:[o.jsx("h1",{className:"font-display text-4xl font-bold tracking-wide leading-tight",children:g.title||"A curated selection"}),g.collector_name&&o.jsxs("p",{className:"text-sm font-body text-muted-foreground italic",children:["Prepared for ",g.collector_name]}),g.message&&o.jsx("p",{className:"text-sm font-body text-foreground leading-relaxed pt-2 border-t border-border mt-3",children:g.message}),o.jsxs("p",{className:"text-[10px] font-body uppercase tracking-wider text-muted-foreground pt-2",children:[t.length," ",t.length===1?"artwork":"artworks"," · Shared"," ",new Date(g.created_at).toLocaleDateString(),g.expires_at&&` · Access until ${new Date(g.expires_at).toLocaleDateString()}`]})]}),t.map(b=>o.jsx(vQ,{row:b,token:e},b.submission_id)),o.jsx("footer",{className:"border-t border-border pt-6 text-[10px] font-body text-muted-foreground/70 leading-relaxed",children:"Indicative prices reflect comparable-sales analysis at the time of valuation and are not certified appraisals."})]})]})},vQ=({row:e,token:t})=>{const[n,r]=k.useState(null),[i,s]=k.useState(""),[a,l]=k.useState(""),[c,d]=k.useState(""),[u,f]=k.useState(""),[p,h]=k.useState(!1),[x,g]=k.useState(!1),b=e.ai_value&&e.ai_value>0?Number(e.ai_value):e.formula_value&&e.formula_value>0?Number(e.formula_value):0,y=gQ(e.ai_comparables).slice(0,3),_=async w=>{w.preventDefault(),h(!0);const{data:S,error:C}=await Ne.functions.invoke("submit-offer",{body:{kind:n,share_token:t,submission_id:e.submission_id,buyer_name:i.trim(),buyer_email:a.trim(),amount:n==="offer"?Number(c):void 0,message:u.trim()}});if(h(!1),C||(S==null?void 0:S.ok)===!1){me.error("We couldn't send that — please check your details and try again.");return}g(!0),r(null),me.success("Sent — we'll be in touch shortly.")};return o.jsxs("article",{className:"space-y-4 pb-10 border-b border-border last:border-b-0",children:[o.jsxs("header",{className:"space-y-1",children:[o.jsx("h2",{className:"font-display text-2xl font-bold tracking-wide",children:e.artist_name||"Unknown"}),o.jsxs("div",{className:"flex items-baseline gap-3 flex-wrap",children:[e.artwork_title&&o.jsx("p",{className:"font-display text-lg italic text-muted-foreground",children:e.artwork_title}),e.year&&o.jsx("span",{className:"text-xs font-body text-muted-foreground/70",children:e.year})]})]}),e.image_url&&o.jsx("div",{className:"rounded-md overflow-hidden shadow-[var(--shadow-md)]",children:o.jsx("img",{src:e.image_url,alt:e.artwork_title||"Artwork",loading:"lazy",className:"w-full max-h-[480px] object-contain bg-muted/30"})}),o.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-3 text-xs font-body",children:[[["Medium",e.medium],["Dimensions",e.dimensions],["Condition",e.condition],["Edition",e.edition]].filter(([,w])=>w).map(([w,S])=>o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground
802/70",children:w}),o.jsx("p",{className:"font-semibold text-foreground",children:S})]},w)),b>0&&o.jsxs("div",{className:"col-span-2 pt-3 border-t border-border space-y-0.5",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:"Indicative Price"}),o.jsx("p",{className:"font-display text-2xl font-bold tracking-wide",children:Tb(b,e.currency)}),typeof e.ai_confidence=="number"&&e.ai_confidence>0&&o.jsxs("p",{className:"text-[10px] font-body text-muted-foreground",children:["Valuation confidence ",e.ai_confidence,"%"]})]})]}),y.length>0&&o.jsxs("div",{className:"rounded-md border border-border bg-background p-4 space-y-2",children:[o.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Comparable sales"}),o.jsx("ul",{className:"space-y-1",children:y.map((w,S)=>o.jsxs("li",{className:"flex items-baseline justify-between gap-3 text-xs font-body",children:[o.jsxs("span",{className:"truncate text-foreground",children:[w.title||"Comparable work",w.saleVenue&&o.jsxs("span",{className:"text-muted-foreground",children:[" · ",w.saleVenue]}),w.saleDate&&o.jsxs("span",{className:"text-muted-foreground",children:[" · ",w.saleDate]})]}),typeof w.salePrice=="number"&&w.salePrice>0&&o.jsx("span",{className:"tabular-nums font-semibold",children:Tb(w.salePrice,e.currency)})]},S))})]}),e.allow_inquiries!==!1&&o.jsx("div",{className:"space-y-3",children:x?o.jsx("p",{className:"text-xs font-body text-muted-foreground",children:"Thank you — your message about this work has been sent."}):n?o.jsxs("form",{onSubmit:_,className:"rounded-md border border-border bg-background p-4 space-y-2",children:[o.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[o.jsx("input",{required:!0,value:i,onChange:w=>s(w.target.value),placeholder:"Your name","aria-label":"Your name",className:"px-3 py-2 text-xs font-body border border-input rounded-md bg-background"}),o.jsx("input",{required:!0,type:"email",value:a,onChange:w=>l(w.target.value),placeholder:"Email","aria-label":"Email",className:"px-3 py-2 text-xs font-body border border-input rounded-md bg-background"})]}),n==="offer"&&o.jsx("input",{required:!0,type:"number",min:1,value:c,onChange:w=>d(w.target.value),placeholder:`Your offer${b>0?` (asking ${Tb(b,e.currency)})`:""}`,"aria-label":"Offer amount",className:"w-full px-3 py-2 text-xs font-body border border-input rounded-md bg-background"}),o.jsx("textarea",{required:n==="inquiry",value:u,onChange:w=>f(w.target.value),rows:2,placeholder:n==="offer"?"Anything we should know? (optional)":"Your question about this work",className:"w-full px-3 py-2 text-xs font-body border border-input rounded-md bg-background"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{type:"submit",disabled:p,className:"px-4 py-2 text-[10px] font-body font-semibold uppercase tracking-wider bg-primary text-primary-foreground rounded-md disabled:opacity-50",children:p?"Sending…":n==="offer"?"Send offer":"Send question"}),o.jsx("button",{type:"button",onClick:()=>r(null),className:"px-4 py-2 text-[10px] font-body font-semibold uppercase tracking-wider border border-input rounded-md text-muted-foreground",children:"Cancel"})]})]}):o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsx("button",{onClick:()=>r("offer"),className:"px-4 py-2 text-[10px] font-body font-semibold uppercase tracking-wider bg-primary text-primary-foreground rounded-md",children:"Make an offer"}),o.jsx("button",{onClick:()=>r("inquiry"),className:"px-4 py-2 text-[10px] font-body font-semibold uppercase tracking-wider border border-input rounded-md text-foreground hover:bg-muted/60",children:"Ask about this work"})]})})]})},bQ={USD:"$",EUR:"€",GBP:"£",CAD:"C$",AUD:"A$"},e3="https://uufdcsnvkixltkqaptzx.supabase.co",t3="https://reverie-art-evaluation.lovable.app",n3=e=>e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ");function Hs(e,t,n){let r=document.head.querySelector(`meta[${e}="${t}"]`);r||(r=document.createElement("meta"),r.setAttribute(e,t),document.head.appendChild(r)),r.setAttribute("content",n)}function yQ(e){let t=document.head.querySelector('link[rel="canonical"]');t||(t=document.createElement("link"),t.setAttribute("rel","canonical"),document.head.appendChild(t)),t.setAttribute("href",e)}function wQ(){var M;const{slug:e=""}=Eu(),[t,n]=k.useState(null),[r,i]=k.useState(null),[s,a]=k.useState(null),[l,c]=k.useState("recent"),[d,u]=k.useState(!0),[f,p]=k.useState({name:"",email:"",ph
802one:"",message:""}),[h,x]=k.useState(!1),[g,b]=k.useState(!1),[y,_]=k.useState(null);k.useEffect(()=>{e&&(Qn("artist_page_view",{slug:e},{once:!0}),fetch(`${e3}/functions/v1/public-artist?slug=${encodeURIComponent(e)}`).then(T=>T.json()).then(T=>{if(!T.ok)throw new Error(T.error||"Failed to load");i(T.artist||n3(e)),n(T.works||[])}).catch(T=>a(T.message)))},[e]);const w=r||n3(e),S=`${t3}/artist/${e}`,C=((M=t==null?void 0:t.find(T=>T.image_url))==null?void 0:M.image_url)||`${t3}/placeholder.svg`;k.useEffect(()=>{const T=`${w} — Independently valued works · Reverie Fine Art Collective`,H=`Browse ${w}'s independently valued works available through Reverie Fine Art Collective — dual-method appraisals blending comparable sales with a transparent valuation formula.`;document.title=T.slice(0,70),Hs("name","description",H.slice(0,160)),Hs("property","og:title",T),Hs("property","og:description",H.slice(0,200)),Hs("property","og:type","profile"),Hs("property","og:url",S),Hs("property","og:image",C),Hs("name","twitter:card","summary_large_image"),Hs("name","twitter:title",T),Hs("name","twitter:description",H.slice(0,200)),Hs("name","twitter:image",C),yQ(S)},[w,S,C]),k.useEffect(()=>{var K;if(!t)return;const T="reverie-artist-jsonld";(K=document.getElementById(T))==null||K.remove();const H={"@context":"https://schema.org","@type":"Person",name:w,url:S,image:C},A={"@context":"https://schema.org","@type":"ItemList",name:`${w} — Works at Reverie Fine Art Collective`,itemListElement:t.slice(0,24).map((U,I)=>({"@type":"ListItem",position:I+1,item:{"@type":"VisualArtwork",name:U.artwork_title||"Untitled",creator:{"@type":"Person",name:U.artist_name||w},dateCreated:U.year||void 0,artMedium:U.medium||void 0,artworkSurface:U.dimensions||void 0,image:U.image_url||void 0,offers:U.current_value?{"@type":"Offer",priceCurrency:U.currency||"USD",price:Math.round(U.current_value),availability:U.status==="sold"?"https://schema.org/SoldOut":"https://schema.org/InStock"}:void 0}}))},O=document.createElement("script");return O.type="application/ld+json",O.id=T,O.textContent=JSON.stringify([H,A]),document.head.appendChild(O),()=>{var U;(U=document.getElementById(T))==null||U.remove()}},[t,w,S,C]);const P=(T,H)=>T?`${bQ[H||"USD"]||"$"}${Math.round(T).toLocaleString()}`:"—",R=k.useMemo(()=>{if(!t)return null;let T=t.slice();return d||(T=T.filter(H=>H.status!=="sold")),l==="value-desc"?T.sort((H,A)=>(A.current_value||0)-(H.current_value||0)):l==="value-asc"?T.sort((H,A)=>(H.current_value||0)-(A.current_value||0)):T.sort((H,A)=>(A.last_valued_at||"").localeCompare(H.last_valued_at||"")),T},[t,l,d]);return o.jsxs("div",{className:"min-h-screen bg-[#FFFFFF] text-[#202020]",children:[o.jsx("header",{className:"border-b border-[#E8E8E8] bg-[#FFFFFF]",children:o.jsxs("div",{className:"max-w-5xl mx-auto px-6 py-8",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[o.jsx(St,{to:"/",className:"text-[10px] tracking-[0.18em] uppercase font-semibold text-[#B08A3E] hover:underline",children:"← Reverie Fine Art Collective"}),o.jsx(ml,{})]}),o.jsxs("div",{className:"mt-6",children:[o.jsx("div",{className:"text-[10px] tracking-[0.18em] uppercase text-[#B08A3E] font-semibold",children:"Artist Collection"}),o.jsx("h1",{className:"font-serif text-5xl mt-2",children:w}),o.jsx("p",{className:"italic text-[#555555] mt-3 max-w-2xl text-sm",children:"Independently valued works currently or recently available through Reverie Fine Art Collective. Each piece carries a dual-method appraisal blending comparable market sales with a transparent valuation formula."})]})]})}),o.jsxs("main",{className:"max-w-5xl mx-auto px-6 py-10",children:[s&&o.jsx("p",{className:"text-sm text-[#A8443A] italic",children:s}),!s&&t===null&&o.jsx("p",{className:"text-sm text-[#555555] italic",children:"Loading works…"}),t&&t.length>0&&o.jsxs("div",{className:"flex items-center justify-between gap-4 mb-6 flex-wrap",children:[o.jsxs("div",{className:"text-[10px] tracking-[0.18em] uppercase text-[#555555] font-semibold",children:[(R==null?void 0:R.length)||0," ",(R==null?void 0:R.length)===1?"work":"works"]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("label",{className:"flex items-center gap-2 text-xs text-[#555555] curs
802or-pointer",children:[o.jsx("input",{type:"checkbox",checked:d,onChange:T=>u(T.target.checked),className:"w-3.5 h-3.5 accent-[#B08A3E]"}),"Include sold"]}),o.jsxs("select",{value:l,onChange:T=>c(T.target.value),className:"text-xs bg-white border border-[#E8E8E8] rounded-sm px-2 py-1.5 text-[#202020] focus:outline-none focus:border-[#B08A3E]",children:[o.jsx("option",{value:"recent",children:"Recently revalued"}),o.jsx("option",{value:"value-desc",children:"Value: high → low"}),o.jsx("option",{value:"value-asc",children:"Value: low → high"})]})]})]}),t&&t.length===0&&o.jsxs("div",{className:"border border-[#E8E8E8] bg-white p-8 text-center rounded-sm",children:[o.jsx("p",{className:"font-serif text-2xl",children:"No public works yet"}),o.jsx("p",{className:"text-sm text-[#555555] italic mt-2",children:"We don't have any publicly listed works for this artist at the moment."}),o.jsx(St,{to:"/",className:"inline-block mt-5 text-[10px] tracking-[0.18em] uppercase font-semibold text-[#FFFFFF] bg-[#202020] px-4 py-2 rounded-sm hover:bg-[#333333]",children:"Browse the collective"})]}),R&&R.length>0&&o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6",children:R.map(T=>o.jsxs("article",{className:"border border-[#E8E8E8] bg-white rounded-sm overflow-hidden flex flex-col",children:[T.image_url?o.jsx("div",{className:"aspect-square bg-[#F6F6F6] overflow-hidden",children:o.jsx("img",{src:T.image_url,alt:`${T.artwork_title||"Untitled"} by ${T.artist_name||w}`,loading:"lazy",className:"w-full h-full object-cover"})}):o.jsx("div",{className:"aspect-square bg-[#F6F6F6] flex items-center justify-center text-[#B08A3E] font-serif text-2xl italic",children:T.artwork_title||"Untitled"}),o.jsxs("div",{className:"p-4 flex-1 flex flex-col",children:[o.jsx("h2",{className:"font-serif text-lg italic leading-tight",children:T.artwork_title||"Untitled"}),o.jsx("p",{className:"text-xs text-[#555555] mt-1",children:[T.year,T.medium,T.dimensions].filter(Boolean).join(" · ")}),o.jsxs("div",{className:"mt-3 pt-3 border-t border-[#F0EBDF] flex items-baseline justify-between",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-[9px] tracking-[0.18em] uppercase text-[#B08A3E] font-semibold",children:"Indicative value"}),o.jsx("div",{className:"font-serif text-2xl text-[#202020]",children:P(T.current_value,T.currency)})]}),T.ai_confidence?o.jsxs("div",{className:"text-[10px] italic text-[#555555]",children:[T.ai_confidence,"% confidence"]}):null]}),T.status==="sold"?o.jsx("div",{className:"mt-3 text-[10px] tracking-[0.14em] uppercase font-semibold text-[#A8443A]",children:"Sold"}):T.shopify_product_handle?o.jsx("a",{href:`https://reverieart.com/products/${T.shopify_product_handle}`,target:"_blank",rel:"noopener noreferrer",className:"mt-3 text-center text-[10px] tracking-[0.14em] uppercase font-semibold text-[#FFFFFF] bg-[#202020] px-3 py-2 rounded-sm hover:bg-[#333333]",children:"Inquire / Make offer"}):null]})]},T.submission_id))}),t&&t.length>0&&o.jsxs("section",{className:"mt-14 border border-[#E8E8E8] bg-white rounded-sm p-6 sm:p-8",children:[o.jsx("div",{className:"text-[10px] tracking-[0.18em] uppercase text-[#B08A3E] font-semibold",children:"Private inquiry"}),o.jsxs("h2",{className:"font-serif text-3xl mt-1",children:["Inquire about ",w]}),o.jsx("p",{className:"text-sm text-[#555555] italic mt-2 max-w-xl",children:"Looking for a specific work, a commission, or guidance on the artist's market? Send a note — a member of the collective will reply personally within one business day."}),g?o.jsxs("div",{className:"mt-5 p-4 bg-[#F6F6F6] border border-[#E8E8E8] rounded-sm",children:[o.jsx("p",{className:"font-serif text-lg text-[#202020]",children:"Thank you — your note has been received."}),o.jsx("p",{className:"text-xs text-[#555555] italic mt-1",children:"We've sent a confirmation to your inbox. Expect a personal reply within one business day."})]}):o.jsxs("form",{className:"mt-5 grid gap-3 max-w-xl",onSubmit:async T=>{if(T.preventDefault(),_(null),!f.name.trim()||!f.email.trim()||f.message.trim().length<5){_("Please add your name, email, and a brief message.");return}x(!0);try{const A=await(await fetch(`${e3}/functions/v1/submit-artist-inquiry`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e,buyer_name:f.name.trim(),buyer_email:f.email.trim(),buyer_phone:f.phone.trim()||void 0,message:f.message.trim()})})).json();if(!A.ok)throw new Error(A.error||"Failed to send");b(!0)}catch(H){_(H.message||"Failed to send")}finally{x(!1)}},children:[o.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[o.jsx("input",{required:!0,placeholder:"Your name",value:f.name,onChange:T=>p({...f,name:T.target.value}),maxLength:200,className:"px-3 py-2 text-sm bg-[#FFFFFF] border border-[#
802E8E8E8] rounded-sm focus:outline-none focus:border-[#B08A3E]"}),o.jsx("input",{required:!0,type:"email",placeholder:"Email",value:f.email,onChange:T=>p({...f,email:T.target.value}),maxLength:255,className:"px-3 py-2 text-sm bg-[#FFFFFF] border border-[#E8E8E8] rounded-sm focus:outline-none focus:border-[#B08A3E]"})]}),o.jsx("input",{placeholder:"Phone (optional)",value:f.phone,onChange:T=>p({...f,phone:T.target.value}),maxLength:40,className:"px-3 py-2 text-sm bg-[#FFFFFF] border border-[#E8E8E8] rounded-sm focus:outline-none focus:border-[#B08A3E]"}),o.jsx("textarea",{required:!0,rows:4,placeholder:`I'd like to know more about ${w}'s available works…`,value:f.message,onChange:T=>p({...f,message:T.target.value}),maxLength:1500,className:"px-3 py-2 text-sm bg-[#FFFFFF] border border-[#E8E8E8] rounded-sm focus:outline-none focus:border-[#B08A3E] resize-none"}),y&&o.jsx("p",{className:"text-xs text-[#A8443A] italic",children:y}),o.jsx("button",{type:"submit",disabled:h,className:"justify-self-start text-[10px] tracking-[0.18em] uppercase font-semibold text-[#FFFFFF] bg-[#202020] px-5 py-2.5 rounded-sm hover:bg-[#333333] disabled:opacity-50",children:h?"Sending…":"Send inquiry"})]})]}),o.jsx("footer",{className:"mt-12 pt-8 border-t border-[#E8E8E8] text-xs text-[#555555] italic",children:"Valuations are indicative, generated by Reverie's dual-method appraisal engine, and do not constitute a formal certified appraisal."})]})]})}const _Q="https://uufdcsnvkixltkqaptzx.supabase.co",r3="https://reverie-art-evaluation.lovable.app";function kQ(){const[e,t]=k.useState(null),[n,r]=k.useState(null),[i,s]=k.useState("");k.useEffect(()=>{fetch(`${_Q}/functions/v1/public-artists-index`).then(l=>l.json()).then(l=>{if(!l.ok)throw new Error(l.error||"Failed to load");t(l.artists||[])}).catch(l=>r(l.message))},[]),k.useEffect(()=>{document.title="Artists Directory · Reverie Fine Art Collective";const l=(d,u,f)=>{let p=document.head.querySelector(`meta[${d}="${u}"]`);p||(p=document.createElement("meta"),p.setAttribute(d,u),document.head.appendChild(p)),p.setAttribute("content",f)};l("name","description","Browse independently valued artists at Reverie Fine Art Collective — dual-method appraisals across the catalog."),l("property","og:title","Artists Directory · Reverie Fine Art Collective"),l("property","og:url",`${r3}/artists`);let c=document.head.querySelector('link[rel="canonical"]');c||(c=document.createElement("link"),c.rel="canonical",document.head.appendChild(c)),c.href=`${r3}/artists`},[]);const a=(e||[]).filter(l=>!i.trim()||l.artist_name.toLowerCase().includes(i.toLowerCase()));return o.jsxs("div",{className:"min-h-screen bg-[#FFFFFF] text-[#202020]",children:[o.jsx("header",{className:"border-b border-[#E8E8E8] bg-[#FFFFFF]",children:o.jsxs("div",{className:"max-w-5xl mx-auto px-6 py-8",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[o.jsx(St,{to:"/",className:"text-[10px] tracking-[0.18em] uppercase font-semibold text-[#B08A3E] hover:underline",children:"← Reverie Fine Art Collective"}),o.jsx(ml,{})]}),o.jsxs("div",{className:"mt-6",children:[o.jsx("div",{className:"text-[10px] tracking-[0.18em] uppercase text-[#B08A3E] font-semibold",children:"Directory"}),o.jsx("h1",{className:"font-serif text-5xl mt-2",children:"Artists"}),o.jsx("p",{className:"italic text-[#555555] mt-3 max-w-2xl text-sm",children:"Every artist with at least one independently valued work in the Reverie catalog."})]})]})}),o.jsxs("main",{className:"max-w-5xl mx-auto px-6 py-10",children:[o.jsxs("div",{className:"flex items-center justify-between mb-6 gap-4 flex-wrap",children:[o.jsx("input",{placeholder:"Search artists…",value:i,onChange:l=>s(l.target.value),className:"px-3 py-2 text-sm bg-white border border-[#E8E8E8] rounded-sm focus:outline-none focus:border-[#B08A3E] w-full max-w-xs"}),o.jsxs("div",{className:"text-[10px] tracking-[0.18em] uppercase text-[#555555] font-semibold",children:[a.length," ",a.length===1?"artist":"artists"]})]}),n&&o.jsx("p",{className:"text-sm text-[#A8443A] italic",children:n}),!n&&e===null&&o.jsx("p",{className:"text-sm text-[#555555] italic",children:"Loading directory…"}),a.length===0&&e!==null&&o.jsx("p",{className:"text-sm text-[#555555] italic",children:"No artists match."}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6",children:a.map(l
802=>o.jsxs(St,{to:`/artist/${l.artist_slug}`,className:"border border-[#E8E8E8] bg-white rounded-sm overflow-hidden flex flex-col hover:border-[#B08A3E] transition-colors group",children:[l.sample_image?o.jsx("div",{className:"aspect-[4/3] bg-[#F6F6F6] overflow-hidden",children:o.jsx("img",{src:l.sample_image,alt:l.artist_name,loading:"lazy",className:"w-full h-full object-cover group-hover:scale-[1.02] transition-transform"})}):o.jsx("div",{className:"aspect-[4/3] bg-[#F6F6F6] flex items-center justify-center font-serif text-3xl italic text-[#B08A3E]",children:l.artist_name.slice(0,1)}),o.jsxs("div",{className:"p-4 flex-1 flex flex-col",children:[o.jsx("h2",{className:"font-serif text-xl leading-tight",children:l.artist_name}),o.jsxs("div",{className:"mt-2 text-xs text-[#555555]",children:[l.work_count," ",l.work_count===1?"work":"works"]})]})]},l.artist_slug))})]})]})}const NQ="https://uufdcsnvkixltkqaptzx.supabase.co",i3="https://reverie-art-evaluation.lovable.app",SQ={USD:"$",EUR:"€",GBP:"£",CAD:"C$",AUD:"A$"};function jQ(){const[e,t]=k.useState(null),[n,r]=k.useState(null);k.useEffect(()=>{fetch(`${NQ}/functions/v1/public-recently-revalued?limit=24`).then(s=>s.json()).then(s=>{if(!s.ok)throw new Error(s.error||"Failed to load");t(s.items||s.works||[])}).catch(s=>r(s.message))},[]),k.useEffect(()=>{document.title="Recently Revalued · Reverie Fine Art Collective";const s=(l,c,d)=>{let u=document.head.querySelector(`meta[${l}="${c}"]`);u||(u=document.createElement("meta"),u.setAttribute(l,c),document.head.appendChild(u)),u.setAttribute("content",d)};s("name","description","The latest independent revaluations across the Reverie catalog — see how prices move over time."),s("property","og:title","Recently Revalued · Reverie Fine Art Collective"),s("property","og:url",`${i3}/recently-revalued`);let a=document.head.querySelector('link[rel="canonical"]');a||(a=document.createElement("link"),a.rel="canonical",document.head.appendChild(a)),a.href=`${i3}/recently-revalued`},[]);const i=(s,a)=>s?`${SQ[a||"USD"]||"$"}${Math.round(s).toLocaleString()}`:"—";return o.jsxs("div",{className:"min-h-screen bg-[#FFFFFF] text-[#202020]",children:[o.jsx("header",{className:"border-b border-[#E8E8E8] bg-[#FFFFFF]",children:o.jsxs("div",{className:"max-w-5xl mx-auto px-6 py-8",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[o.jsx(St,{to:"/",className:"text-[10px] tracking-[0.18em] uppercase font-semibold text-[#B08A3E] hover:underline",children:"← Reverie Fine Art Collective"}),o.jsx(ml,{})]}),o.jsxs("div",{className:"mt-6",children:[o.jsx("div",{className:"text-[10px] tracking-[0.18em] uppercase text-[#B08A3E] font-semibold",children:"Live Catalog"}),o.jsx("h1",{className:"font-serif text-5xl mt-2",children:"Recently Revalued"}),o.jsx("p",{className:"italic text-[#555555] mt-3 max-w-2xl text-sm",children:"The most recent independent revaluations across the Reverie collective — fresh appraisals using comparable sales and a transparent valuation formula."})]})]})}),o.jsxs("main",{className:"max-w-5xl mx-auto px-6 py-10",children:[n&&o.jsx("p",{className:"text-sm text-[#A8443A] italic",children:n}),!n&&e===null&&o.jsx("p",{className:"text-sm text-[#555555] italic",children:"Loading…"}),e&&e.length===0&&o.jsx("p",{className:"text-sm text-[#555555] italic",children:"No recent revaluations yet."}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6",children:(e||[]).map(s=>{const a=s.prior_value&&s.current_value?(s.current_value-s.prior_value)/s.prior_value*100:null;return o.jsxs("article",{className:"border border-[#E8E8E8] bg-white rounded-sm overflow-hidden flex flex-col",children:[s.image_url&&o.jsx(St,{to:`/artist/${s.artist_slug}`,className:"block aspect-square bg-[#F6F6F6] overflow-hidden",children:o.jsx("img",{src:s.image_url,alt:s.artwork_title,loading:"lazy",className:"w-full h-full object-cover"})}),o.jsxs("div",{className:"p-4 flex-1 flex flex-col",children:[o.jsx(St,{to:`/artist/${s.artist_slug}`,className:"text-xs text-[#B08A3E] font-semibold uppercase tracking-wider hover:underline",children:s.artist_name}),o.jsx("h2",{className:"font-serif text-lg italic mt-1 leading-tight",children:s.artwork_title}),o.jsxs("div",{className:"mt-3 pt-3 border-t border-[#F0EBDF] flex items-baseline justify-between",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-[9px] tracking-[0.18em] uppercase text-[#B08A3E] font-semibold",children:"Current value"}),o.jsx("div",{className:"font-serif text-2xl",children:i(s.current_value,s.currency)})]}),a!==null&&o.jsxs("div",{className:`text-xs font-semibold ${a>=0?"text-[#3F7A4E]":"text-[#A8443A]"}`,children:[a>=0?"▲":"▼"," ",Math.abs(a).toFixed(1),"%"]})]}),o.jsxs("div",{className:"mt-2 text-[10px] text-[#555555] italic",children:["Revalued ",new Date(s.last_valued_at).toLocaleDateString()]})]})]},s.submission_id)})})]})]})}const s3="https://uufdcsnvkixltkqaptzx.supabase.co",EQ={USD:"$",EUR:"€",GBP:"£",CAD:"C$",AUD:"A$"};function CQ(){const{token:e=""}=Eu(),[t,n]=k.useState(null),[r,i]=k.useState(null),[s,a]=k.useState(""),[l,c]=k.useState(!1),d=async()=>{try{const x=await(await fetch(`${s3}/functions/v1/inquiry-thread?token=${encodeURIComponent(e)}`)).json();if(!x.ok)throw new Error(x.error||"Failed to load");n(x.thread)}catch(h){i(h.message)}};k.useEffect(()=>{e&&d(),document.title="Your conversation · Reverie Fine Art Collective";const h=document.createElement("meta");return h.name="robots",h.content="noindex",document.head.appendChild(h),()=>{h.remove()}},[e]);const u=async h=>{if(h.preventDefault(),!(s.trim().length<1)){c(!0);try{const g=await(await fetch(`${s3}/functions/v1/inquiry-thread`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,body:s.trim()})})).json();if(!g.ok)throw new Error(g.error||"Failed to send");a(""),await d()}catch(x){i(x.message)}finally{c(!1)}}};if(r)return o.jsx("div",{className:"min-h-screen bg-[#FFFFFF] flex items-center justify-center p-6",children:o.jsxs("div",{className:"max-w-md text-center",children:[o.jsx("h1",{className:"font-serif text-3xl text-[#202020]",children:"Conversation not found"}),o.jsx("p",{className:"text-sm text-[#555555] italic mt-2",children:r}),o.jsx(St,{to:"/",className:"inline-block mt-6 text-[10px] tracking-[0.18em] uppercase font-semibold text-[#FFFFFF] bg-[#202020] px-4 py-2 rounded-sm",children:"Return home"})]})});if(!t)return o.jsx("div",{className:"min-h-screen bg-[#FFFFFF] flex items-center justify-center text-sm italic text-[#555555]",children:"Loading conversation…"});const f=EQ[t.currency||"USD"]||"$",p=t.amount?`${f}
802${Math.round(t.amount).toLocaleString()}`:null;return o.jsxs("div",{className:"min-h-screen bg-[#FFFFFF] text-[#202020]",children:[o.jsx("header",{className:"border-b border-[#E8E8E8] bg-[#FFFFFF]",children:o.jsxs("div",{className:"max-w-2xl mx-auto px-6 py-6",children:[o.jsx(St,{to:"/",className:"text-[10px] tracking-[0.18em] uppercase font-semibold text-[#B08A3E] hover:underline",children:"← Reverie Fine Art Collective"}),o.jsxs("div",{className:"mt-4 flex items-start gap-4",children:[t.image_url&&o.jsx("img",{src:t.image_url,alt:t.artwork_title||"",className:"w-20 h-20 object-cover rounded-sm border border-[#E8E8E8]"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"text-[10px] tracking-[0.18em] uppercase text-[#B08A3E] font-semibold",children:t.kind==="offer"?"Your offer":"Your inquiry"}),o.jsxs("h1",{className:"font-serif text-2xl mt-1 leading-tight",children:[t.artist_name||"Untitled"," — ",o.jsx("em",{children:t.artwork_title||"Untitled work"})]}),p&&o.jsxs("div",{className:"text-sm text-[#555555] mt-1",children:["Offer: ",o.jsx("strong",{className:"text-[#202020]",children:p})]})]})]})]})}),o.jsxs("main",{className:"max-w-2xl mx-auto px-6 py-8",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(o3,{role:"buyer",body:t.initial_message||"(no message)",ts:t.created_at,name:t.buyer_name}),t.messages.map(h=>o.jsx(o3,{role:h.sender_role,body:h.body,ts:h.created_at,name:h.sender_role==="owner"?"Reverie":t.buyer_name},h.id))]}),o.jsxs("form",{onSubmit:u,className:"mt-8 border-t border-[#E8E8E8] pt-6",children:[o.jsx("label",{className:"text-[10px] tracking-[0.18em] uppercase font-semibold text-[#555555]",children:"Reply"}),o.jsx("textarea",{value:s,onChange:h=>a(h.target.value),rows:4,maxLength:4e3,placeholder:"Write a reply…",className:"mt-2 w-full px-3 py-2 text-sm bg-white border border-[#E8E8E8] rounded-sm focus:outline-none focus:border-[#B08A3E] resize-none"}),o.jsx("button",{type:"submit",disabled:l||s.trim().length<1,className:"mt-3 text-[10px] tracking-[0.18em] uppercase font-semibold text-[#FFFFFF] bg-[#202020] px-5 py-2.5 rounded-sm hover:bg-[#333333] disabled:opacity-50",children:l?"Sending…":"Send reply"})]}),o.jsx("p",{className:"mt-8 text-xs text-[#555555] italic",children:"Bookmark this page — replies from the collective will appear here."})]})]})}function o3({role:e,body:t,ts:n,name:r}){const i=e==="owner";return o.jsx("div",{className:`flex ${i?"justify-start":"justify-end"}`,children:o.jsxs("div",{className:`max-w-[80%] p-4 rounded-sm border ${i?"bg-[#F6F6F6] border-[#E8E8E8]":"bg-white border-[#E8E8E8]"}`,children:[o.jsxs("div",{className:"text-[9px] tracking-[0.18em] uppercase font-semibold text-[#B08A3E] mb-1",children:[r," · ",new Date(n).toLocaleString()]}),o.jsx("div",{className:"text-sm text-[#202020] whitespace-pre-wrap leading-relaxed",children:t})]})})}const a3="https://reverie-art-evaluation.lovable.app",or=({title:e,children:t})=>o.jsxs("section",{className:"space-y-3",children:[o.jsx("h3",{className:"font-display text-xl text-[#202020] tracking-wide",children:e}),o.jsx("div",{className:"text-[15px] leading-relaxed text-[#3A352E] space-y-3",children:t})]}),Vm=({k:e,v:t})=>o.jsxs("div",{className:"border border-[#E8E8E8] bg-white px-5 py-4",children:[o.jsx("div",{className:"text-[10px] tracking-[0.18em] uppercase font-semibold text-[#555555]",children:e}),o.jsx("div",{className:"font-display text-2xl text-[#202020] mt-1",children:t})]});function AQ(){const[e,t]=k.useState("overview");k.useEffect(()=>{document.title="About Reverie · The Gallery Valuation Platform";const r=(s,a,l)=>{let c=document.head.querySelector(`meta[${s}="${a}"]`);c||(c=document.createElement("meta"),c.setAttribute(s,a),document.head.appendChild(c)),c.setAttribute("content",l)};r("name","description","Reverie Fine Art Collective is a dual-method valuation, consignment, and discovery platform for galleries, collectors, and artists. Read the full documentation."),r("property","og:title","About Reverie · The Gallery Valuation Platform"),r("property","og:url",`${a3}/about`);let i=document.head.querySelector('link[rel="canonical"]');i||(i=document.createElement("link"),i.rel="canonical",document.head.appendChild(i)),i.href=`${a3}/about`},[]);const n=[{id:"overview",label:"Overview"},{id:"investors",label:"Investors"},{id:"galleries",label:"Galleries"},{id:"collectors",label:"Collectors"},{id:"artists",label:"Artists"}];return o.jsxs("div",{className:"min-h-screen bg-[#FFFFFF] text-[#202020]",children:[o.jsx("header",{className:"border-b border-[#
802E8E8E8] bg-[#FFFFFF]",children:o.jsxs("div",{className:"max-w-5xl mx-auto px-6 py-8",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[o.jsx(St,{to:"/",className:"text-[10px] tracking-[0.18em] uppercase font-semibold text-[#B08A3E] hover:underline",children:"← Reverie Fine Art Collective"}),o.jsx(ml,{})]}),o.jsx("h1",{className:"font-display text-4xl md:text-5xl mt-6 tracking-wide",children:"The Reverie Platform"}),o.jsx("p",{className:"text-[15px] text-[#3A352E] mt-3 max-w-3xl leading-relaxed",children:"A dual-method valuation, consignment, and discovery system built for working galleries — and the collectors and artists who depend on them."}),o.jsxs("div",{className:"mt-5 flex flex-wrap gap-3",children:[o.jsx("a",{href:"/reverie-whitepaper.pdf",className:"inline-flex items-center gap-2 bg-[#202020] text-[#FFFFFF] px-5 py-2.5 text-[11px] tracking-[0.18em] uppercase font-semibold hover:bg-[#3A352E] transition-colors",children:"Download Whitepaper (PDF)"}),o.jsx(St,{to:"/roadmap",className:"inline-flex items-center gap-2 border border-[#202020] text-[#202020] px-5 py-2.5 text-[11px] tracking-[0.18em] uppercase font-semibold hover:bg-[#202020] hover:text-[#FFFFFF] transition-colors",children:"View Roadmap"})]})]})}),o.jsx("div",{className:"border-b border-[#E8E8E8] bg-white",children:o.jsx("div",{className:"max-w-5xl mx-auto px-6 flex gap-1 overflow-x-auto",children:n.map(r=>o.jsx("button",{onClick:()=>t(r.id),className:`px-4 py-3 text-[11px] tracking-[0.18em] uppercase font-semibold whitespace-nowrap transition-colors ${e===r.id?"text-[#202020] border-b-2 border-[#B08A3E]":"text-[#555555] hover:text-[#202020]"}`,children:r.label},r.id))})}),o.jsxs("main",{className:"max-w-5xl mx-auto px-6 py-12 space-y-10",children:[e==="overview"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[o.jsx(Vm,{k:"Methodology",v:"Dual-method"}),o.jsx(Vm,{k:"Premium Report",v:"Coming soon"}),o.jsx(Vm,{k:"Consignment Terms",v:"Agreed in writing"}),o.jsx(Vm,{k:"Channels",v:"Web · Shopify · Email"})]}),o.jsxs(or,{title:"What Reverie Is",children:[o.jsx("p",{children:"Reverie Fine Art Collective is an end-to-end workspace for galleries to document, value, publish, and transact artwork. The platform combines a formula-based valuation engine with multi-model AI consensus, then layers on the buyer-facing surfaces — public artist pages, shareable reports, an embeddable Shopify badge, and tokenized inquiry threads — that turn a private appraisal into a sale."}),o.jsx("p",{children:"The result is a single system of record that replaces what galleries today stitch together from spreadsheets, freelance appraisers, Squarespace pages, and DMs."})]}),o.jsx(or,{title:"The Core Loop",children:o.jsxs("ol",{className:"list-decimal pl-5 space-y-2",children:[o.jsxs("li",{children:[o.jsx("strong",{children:"Document"})," — upload images and metadata for a work (manual entry only; no AI image generation)."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Value"})," — receive a dual-method estimate: a deterministic formula plus a multi-model AI consensus."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Publish"})," — push to a public artist page, share a tokenized report link, or list on Shopify in one click."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Transact"})," — collectors submit offers or inquiries; the gallery replies inside a threaded inbox; consignments route to a review pipeline."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Re-value"})," — stale valuations are flagged automatically and refreshed on a schedule."]})]})}),o.jsx(or,{title:"What's Built Today",children:o.jsxs("ul",{className:"list-disc pl-5 space-y-1.5",children:[o.jsxs("li",{children:[o.jsx("strong",{children:"Valuation engine"})," — formula + AI consensus across Gemini and GPT models, with reasoning trail."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Premium PDF report"})," — $9.99 expanded informational record of the submitted artwork and the evidence available. Not a certified appraisal, authentication or investment opinion."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Artist pages"})," at ",o.jsx("code",{children:"/artist/:slug"})," with social proof, inquiry forms, and offer flow."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Discovery surfaces"})," — ",o.jsx("code",{children:"/artists"})," directory and ",o.jsx("code",{children:"/recently-revalued"})," SEO page."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Inquiry threads"})," — tokenized ",o.jsx("code",{children:"/inquiry/:token"})," pages let buyers reply without an account."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Unified inbox"})," for gallery owners with expandable threads and one-click reply emails."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Shopify integration"})," — embeddable trust badge, product export, order webhook, price sync."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Consignment pipeline"})," — submission flow with admin review and payout tracking; commercial terms agreed in writing per work."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Email infrastru
802cture"})," — transactional templates (inquiry confirmations, owner replies, consignment updates) and a Monday weekly digest cron."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Admin tooling"})," — submissions dashboard, analytics, alerts, consignment review, PIN-gated bypass."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Legal compliance"})," — public Terms, Refund Policy, Privacy Notice; Paddle as Merchant of Record."]})]})})]}),e==="investors"&&o.jsxs(o.Fragment,{children:[o.jsx(or,{title:"The Opportunity",children:o.jsxs("p",{children:["The global art market does ~$65B/yr in transactions. Mid-market galleries — the segment between blue-chip houses and Etsy sellers — operate on margins thin enough that an under-valued consignment or a missed buyer follow-up is the difference between a profitable quarter and a closed location. Existing tools (Artlogic, ArtBase, Artwork Archive) are inventory CRMs. None of them ",o.jsx("em",{children:"value"})," the work. None of them",o.jsx("em",{children:" close the buyer loop"}),". Reverie does both."]})}),o.jsx(or,{title:"Revenue Model",children:o.jsxs("ul",{className:"list-disc pl-5 space-y-1.5",children:[o.jsxs("li",{children:[o.jsx("strong",{children:"Transactional:"})," $9.99 premium AI report per artwork (Paddle, MoR)."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Consignment commission:"})," agreed in writing with each consignor before a work is accepted or listed."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Planned subscription:"})," per-seat gallery plan unlocking bulk re-valuation, white-labeled artist pages, and portfolio analytics."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Planned API/embed licensing:"})," the trust badge and recently-revalued widget are already shipping as JS embeds."]})]})}),o.jsx(or,{title:"Moat",children:o.jsxs("ul",{className:"list-disc pl-5 space-y-1.5",children:[o.jsxs("li",{children:[o.jsx("strong",{children:"Dual-method methodology"})," — formula + AI consensus is defensible and explainable; pure LLM output is not."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Proprietary valuation corpus"})," — every report adds to a private dataset of medium · dimensions · provenance · realized value."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Two-sided network"})," — galleries bring works; buyers arrive via SEO artist pages and Shopify; the inquiry thread keeps them inside our rails."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Compliance scaffolding"})," — Paddle MoR, RLS-enforced data isolation, public legal pages already shipped."]})]})}),o.jsx(or,{title:"Traction Surfaces",children:o.jsxs("ul",{className:"list-disc pl-5 space-y-1.5",children:[o.jsxs("li",{children:["Public artist pages indexed at ",o.jsx("code",{children:"/artist/:slug"})," with structured social proof."]}),o.jsx("li",{children:"Shopify trust-badge embed on partner storefronts (recently-revalued JS widget shipping live)."}),o.jsx("li",{children:"Tokenized inquiry threads driving repeat buyer engagement without account friction."}),o.jsx("li",{children:"Weekly digest email cron (Mondays 14:00 UTC) re-engaging gallery owners."})]})}),o.jsx(or,{title:"Architecture & Defensibility",children:o.jsxs("p",{children:["React + Vite frontend; Supabase (Postgres + RLS + Edge Functions + Storage) backend; Paddle for payments; Remotion for promotional video; multi-model AI gateway abstracting Gemini and GPT. RLS isolates gallery data; admin access is PIN-gated and moving to a proper ",o.jsx("code",{children:"user_roles"})," table. Edge functions ship continuously without DevOps overhead."]})})]}),e==="galleries"&&o.jsxs(o.Fragment,{children:[o.jsx(or,{title:"What You Get",children:o.jsxs("ul",{className:"list-disc pl-5 space-y-1.5",children:[o.jsx("li",{children:"A valuation in under 60 seconds per work — with reasoning you can show a collector."}),o.jsx("li",{children:"A public, SEO-indexed artist page that doubles as a sales channel."}),o.jsx("li",{children:"A Shopify product export so the work is listed and shippable in one click."}),o.jsx("li",{children:"A unified inbox for offers, inquiries, and artist-page leads — with threaded replies."}),o.jsx("li",{children:"A weekly digest email summarizing new inquiries, stale works, and revaluation deltas."}),o.jsx("li",{children:"Consignment intake from outside artists with an admin review pipeline."})]})}),o.jsx(or,{title:"Workflow",children:o.jsxs("ol",{className:"list-decimal pl-5 space-y-2",children:[o.jsx("li",{children:"Upload the work (image + medium + dimensions + condition + year)."}),o.jsx("li",{children:"Receive a dual-method valuation with full reasoning."}),o.jsx("li",{children:"Optionally purchase the $9.99 premium report (expanded record of the work and the evidence held)."}),o.jsx("li",{children:"Publish to the artist page and/or push to Shopify."}),o.jsx("li",{children:"Field inquiries and offers from the inbox; reply inline."}),o.jsx("li",{children:"Re-value on schedule; receive Monday digest with the week's activity."})]})}),o.jsx(or,{title:"Pricing",children:o.jsx("p",{children:"The valuation engine and gallery w
802orkspace are free to use. Premium reports are $9.99 per artwork, billed by Paddle. For consignments, pricing, commission, duration and shipping are reviewed and agreed in writing before a work is accepted or listed."})})]}),e==="collectors"&&o.jsxs(o.Fragment,{children:[o.jsxs(or,{title:"How Valuations Work",children:[o.jsxs("p",{children:["Every Reverie valuation combines two methods. The ",o.jsx("strong",{children:"formula"})," uses medium-specific base rates per square inch, then adjusts for condition, period, scarcity, provenance keywords, and framing. The ",o.jsx("strong",{children:"AI consensus"})," runs the same artwork past multiple frontier models (Google Gemini and OpenAI GPT) and reconciles their estimates. You see both numbers and the reasoning behind them."]}),o.jsx("p",{children:"Reverie valuations are indicative retail market estimates — not formal appraisals. For estate, tax, or insurance purposes, work with a USPAP-certified appraiser."})]}),o.jsx(or,{title:"Premium Reports",children:o.jsx("p",{children:"For $9.99, the premium report is an expanded informational record of the submitted artwork and the evidence available — any comparable sale records Reverie holds with their source and date, the estimate and its range, the effective date and the method used. It is not a certified appraisal, authentication or investment opinion. Reports are generated on demand and retained in your account."})}),o.jsx(or,{title:"Inquiring on a Work",children:o.jsxs("p",{children:["Every artwork on a Reverie artist page carries an ",o.jsx("strong",{children:"Inquire"})," and",o.jsx("strong",{children:" Make an Offer"})," action. Submissions go directly to the gallery and generate a tokenized thread at ",o.jsx("code",{children:"/inquiry/:token"})," — no account required. You'll receive confirmation and can reply to follow-ups from email."]})}),o.jsx(or,{title:"Trust",children:o.jsxs("ul",{className:"list-disc pl-5 space-y-1.5",children:[o.jsx("li",{children:"Paddle handles all payments as Merchant of Record."}),o.jsxs("li",{children:["Public ",o.jsx(St,{to:"/terms",className:"underline",children:"Terms"}),", ",o.jsx(St,{to:"/privacy",className:"underline",children:"Privacy"}),", and ",o.jsx(St,{to:"/refund-policy",className:"underline",children:"Refund Policy"}),"."]}),o.jsx("li",{children:"Methodology is disclosed on every report."}),o.jsx("li",{children:"Valuations are timestamped and revisable."})]})})]}),e==="artists"&&o.jsxs(o.Fragment,{children:[o.jsx(or,{title:"Your Artist Page",children:o.jsxs("p",{children:["Every artist documented on Reverie gets a public page at",o.jsx("code",{children:" /artist/:slug"})," with their catalog, valuation history, and direct inquiry/offer forms. The page is SEO-indexed and linked from the",o.jsx(St,{to:"/artists",className:"underline ml-1",children:"/artists"})," directory and",o.jsx(St,{to:"/recently-revalued",className:"underline ml-1",children:"/recently-revalued"})," feeds."]})}),o.jsx(or,{title:"Consigning Work",children:o.jsx("p",{children:"Artists can submit work for consignment through the platform. Each submission routes to an admin review pipeline; accepted work is listed on the gallery's Shopify storefront once pricing, commission, duration and shipping have been agreed in writing. Payout status is visible in your dashboard and updated by email."})}),o.jsx(or,{title:"Buyer Connection",children:o.jsxs("p",{children:["Inquiries and offers on your work flow into the gallery's unified inbox. You're notified on activity; the gallery handles negotiation. Buyer threads stay alive at",o.jsx("code",{children:" /inquiry/:token"})," — no email goes into the void."]})}),o.jsx(or,{title:"What's Coming",children:o.jsxs("ul",{className:"list-disc pl-5 space-y-1.5",children:[o.jsx("li",{children:"Self-serve artist accounts with their own page customization."}),o.jsx("li",{children:"Bio and provenance fields restored with strict no-AI-generation guardrails."}),o.jsx("li",{children:"Direct-to-artist messaging where the gallery opts in."})]})})]}
802),o.jsxs("footer",{className:"pt-10 border-t border-[#E8E8E8] text-[12px] text-[#555555] flex items-center justify-between flex-wrap gap-3",children:[o.jsx("span",{children:"© Reverie Fine Art, LLC. All rights reserved."}),o.jsxs("span",{className:"flex gap-4",children:[o.jsx(St,{to:"/terms",className:"hover:text-[#202020]",children:"Terms"}),o.jsx(St,{to:"/privacy",className:"hover:text-[#202020]",children:"Privacy"}),o.jsx(St,{to:"/refund-policy",className:"hover:text-[#202020]",children:"Refunds"}),o.jsx("a",{href:"mailto:[email protected]",className:"hover:text-[#202020]",children:"Contact"})]})]})]})]})}const l3="https://reverie-art-evaluation.lovable.app",PQ=[{title:"Dual-method valuation engine",body:"Formula (medium · dimensions · condition · period · scarcity · provenance · framing) plus multi-model AI consensus across Gemini and GPT."},{title:"Premium $9.99 PDF report",body:"An expanded informational record of the submitted artwork and the evidence held, archived for re-download. Not a certified appraisal, authentication or investment opinion."},{title:"Public artist pages",body:"/artist/:slug with social proof, inquiry form, and offer flow."},{title:"Artists directory + Recently Revalued feed",body:"SEO discovery surfaces with shared sub-navigation."},{title:"Tokenized buyer inquiry threads",body:"/inquiry/:token lets buyers reply without an account; gallery replies trigger transactional email."},{title:"Unified gallery inbox",body:"Offers, artist-page inquiries, and consignment messages in one expandable thread view."},{title:"Shopify integration",body:"Trust badge JS embed, product export, order webhook, price sync, recently-revalued widget."},{title:"Consignment pipeline",body:"Outside-artist intake, admin review, payout tracking, status emails; commercial terms agreed in writing per work."},{title:"Transactional email system",body:"Branded templates, suppression handling, unsubscribe routing, send queue."},{title:"Weekly digest cron",body:"Mondays 14:00 UTC: per-owner summary of inquiries, offers, stale works."},{title:"Admin tooling",body:"Submissions dashboard, analytics, alerts, consignment review, PIN bypass for [email protected]."},{title:"Legal & compliance",body:"Public Terms, Refund Policy, Privacy Notice. Paddle as Merchant of Record."},{title:"Promotional & walkthrough videos",body:"Remotion-rendered demo and walkthrough served in-modal."}],LQ=[{title:"Self-serve artist accounts",body:"Artists claim and customize their own /artist/:slug page; gallery opt-in for shared editing."},{title:"Portfolio analytics for galleries",body:"Total portfolio value over time, appreciation %, stale-work surfacing, per-medium performance."},{title:"Bulk operations",body:"Bulk re-valuation, bulk publish to Shopify, bulk premium report generation."},{title:"Saved entry cap lift",body:"Move galleries past the 20-entry guest cap to a tiered subscription."},{title:"Subscription tier",body:"Per-seat gallery plan unlocking bulk ops, white-labeled pages, advanced analytics, API access."},{title:"Role-based admin",body:"Migrate PIN gating to a proper user_roles table with role-aware RLS."}],RQ=[{title:"Public API + embed catalog",body:"Programmatic valuation, badge, recently-revalued, and artist-page embeds for third-party storefronts."},{title:"Auction-house comparable ingestion",body:"Ingest realized prices from public auction archives to strengthen the AI consensus floor."},{title:"Insurance scheduling export",body:"One-click export of portfolio valuations formatted for fine-
802art insurers."},{title:"Mobile capture app",body:"Native iOS/Android intake for fair-floor and studio-visit valuations."},{title:"Collector accounts",body:"Buyers track inquiries across galleries, save works, and receive revaluation alerts on owned pieces."}],Ob=({item:e,status:t})=>{const n=t==="shipped"?"bg-[#3D5C3A]":t==="next"?"bg-[#B08A3E]":"bg-[#555555]",r=t==="shipped"?"Shipped":t==="next"?"Next":"Later";return o.jsxs("li",{className:"grid grid-cols-[auto_1fr] gap-4 py-4 border-b border-[#E8E8E8] last:border-b-0",children:[o.jsxs("div",{className:"pt-1.5 flex items-center gap-2",children:[o.jsx("span",{className:`w-2 h-2 rounded-full ${n}`}),o.jsx("span",{className:"text-[10px] tracking-[0.18em] uppercase font-semibold text-[#555555] w-16",children:r})]}),o.jsxs("div",{children:[o.jsx("div",{className:"font-display text-lg text-[#202020]",children:e.title}),o.jsx("p",{className:"text-[14px] text-[#3A352E] leading-relaxed mt-1",children:e.body})]})]})};function TQ(){return k.useEffect(()=>{document.title="Roadmap · Reverie Fine Art Collective";const e=(n,r,i)=>{let s=document.head.querySelector(`meta[${n}="${r}"]`);s||(s=document.createElement("meta"),s.setAttribute(n,r),document.head.appendChild(s)),s.setAttribute("content",i)};e("name","description","Reverie roadmap — shipped features, what's coming next, and the longer-term vision for the gallery valuation platform."),e("property","og:title","Roadmap · Reverie Fine Art Collective"),e("property","og:url",`${l3}/roadmap`);let t=document.head.querySelector('link[rel="canonical"]');t||(t=document.createElement("link"),t.rel="canonical",document.head.appendChild(t)),t.href=`${l3}/roadmap`},[]),o.jsxs("div",{className:"min-h-screen bg-[#FFFFFF] text-[#202020]",children:[o.jsx("header",{className:"border-b border-[#E8E8E8] bg-[#FFFFFF]",children:o.jsxs("div",{className:"max-w-4xl mx-auto px-6 py-8",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[o.jsx(St,{to:"/",className:"text-[10px] tracking-[0.18em] uppercase font-semibold text-[#B08A3E] hover:underline",children:"← Reverie Fine Art Collective"}),o.jsx(ml,{})]}),o.jsx("h1",{className:"font-display text-4xl md:text-5xl mt-6 tracking-wide",children:"Roadmap"}),o.jsx("p",{className:"text-[15px] text-[#3A352E] mt-3 max-w-3xl leading-relaxed",children:"What's shipped, what's coming next, and where Reverie is headed. Updated continuously."}),o.jsx("div",{className:"mt-5",children:o.jsx("a",{href:"/reverie-whitepaper.pdf",className:"inline-flex items-center gap-2 bg-[#202020] text-[#FFFFFF] px-5 py-2.5 text-[11px] tracking-[0.18em] uppercase font-semibold hover:bg-[#3A352E] transition-colors",children:"Download Whitepaper (PDF)"})})]})}),o.jsxs("main",{className:"max-w-4xl mx-auto px-6 py-12 space-y-12",children:[o.jsxs("section",{children:[o.jsx("h2",{className:"font-display text-2xl tracking-wide mb-2",children:"Shipped"}),o.jsx("p",{className:"text-[13px] text-[#555555] mb-4",children:"Live in production and in use today."}),o.jsx("ul",{children:PQ.map(e=>o.jsx(Ob,{item:e,status:"shipped"},e.title))})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"font-display text-2xl tracking-wide mb-2",children:"Next"}),o.jsx("p",{className:"text-[13px] text-[#555555] mb-4",children:"In active design or build over the coming quarter."}),o.jsx("ul",{children:LQ.map(e=>o.jsx(Ob,{item:e,status:"next"},e.title))})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"font-display text-2xl tracking-wide mb-2",children:"Later"}),o.jsx("p",{className:"text-[13px] text-[#555555] mb-4",children:"Directional bets that depend on traction and partnerships."}),o.jsx("ul",{children:RQ.map(e=>o.jsx(Ob,{item:e,status:"later"},e.title))})]}),o.jsxs("footer",{className:"pt-10 border-t border-[#E8E8E8] text-[12px] text-[#555555] flex items-center justify-between flex-wrap gap-3",children:[o.jsx("span",{children:"© Reverie Fine Art, LLC. All rights reserved."}),o.jsxs("span",{className:"flex gap-4",children:[o.jsx(St,{to:"/terms",className:"hover:text-[#202020]",children:"Terms"}),o.jsx(St,{to:"/privacy",className:"hover:text-[#202020]",children:"Privacy"}),o.jsx(St,{to:"/refund-policy",className:"hover:text-[#202020]",children:"Refunds"}),o.jsx("a",{href:"mailto:[email protected]",className:"hover:text-[#202020]",children:"Contact"})]})]})]})]})}const OQ=()=>{const{session:e}=pn();return k.useEffect(()=>{var n;if(!e)return;try{(n=window.opener)==null||n.postMessage({source:"reverie-auth",type:"reverie-session",access_token:e.access_token,refresh_token:e.refresh_token},window.location.origin)}catch{}const t=setTimeout(()=>window.close(),400);return()=>clearTimeout(t)},[e]),k.useEffect(()=>{Ne.auth.getSession()},[]),o.jsx("div",{className:"min-h-screen bg-canvas",children:e?o.jsx("div",{className:"flex min-h-screen items-center justify-center p-8 text-center",children:o.jsx("p",{className:"font-body text-sm text-muted-foreground",children:"Signed in — returning you to Reverie…"})}):o.jsx(Rf,{standalone:!0})})},IQ="https://uufdcsnvkixltkqaptzx.supabase.co",DQ={USD:"$",EUR:"€",GBP:"£",CAD:"C$",AUD:"A$"},FQ=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),MQ=()=>{const{slug:e}=Eu(),[t,n]=k.useState(null),[r,i]=k.useState(null),[s,a]=k.useState(null),[l,c]=k.useState(""),[d,u]=k.useState("recent");k.useEffect(()=>{if(!e)return;let x=!0;return fetch(`${IQ}/functions/v1/public-gallery?slug=${encodeURIComponent(e)}`).then(g=>g.json()).then(g=>{if(x){if(!(g!=null&&g.found)){a("This gallery profile isn't published yet."),i([]);return}n(g.gallery),i(g.works||[])}}).catch(()=>x&&a("Unable to load this gallery right now.")),()=>{x=!1}},[e]);const f=`https://reverie-art-evaluation.lovable.app/gallery/${e||""}`;k.useEffect(()=>{var S;if(!t)return;const x=`${t.name} — Independently Valued Inventory | Reverie`;document.title=x.slice(0,60);const g=(t.bio||`${t.name}: ${t.work_count} independently valued works with transparent dual-method appraisals.`).slice(0,155),b=(C,P)=>{let R=document.head.querySelector(C);R||(R=document.createElement(C.startsWith("link")?"link":"meta"),document.head.appendChild(R)),Object.entries(P).forEach(([M,T])=>R.setAttribute(M,T))};b('meta[name="description"]',{name:"description",content:g}),b('link[rel="canonical"]',{rel:"canonical",href:f}),b('meta[property="og:title"]',{property:"og:title",content:x}),b('meta[property="og:description"]',{property:"og:description",content:g}),b('meta[property="og:type"]',{property:"og:type",content:"profile"}),b('meta[name="twitter:card"]',{name:"twitter:card",content:"summary_large_image"});const y="gallery-jsonld";(S=document.getElementById(y))==null||S.remove();const _={"@context":"https://schema.org","@type":"ArtGallery",name:t.name,description:t.bio||void 0,url:f,address:t.location||void 0,email:t.contact_email||void 0,sameAs:t.website||void 0,image:t.sample_image||void 0},w=document.createElement("script");return w.type="application/ld+json",w.id=y,w.textContent=JSON.stringify(_),document.head.appendChild(w),()=>{var C;return(C=document.getElementById(y))==null?void 0:C.remove()}},[t,f]);const p=(x,g)=>x?`${DQ[g||"USD"]||"$"}
802${Math.round(x).toLocaleString()}`:"—",h=k.useMemo(()=>{if(!r)return null;const x=l.trim().toLowerCase();let g=r.filter(b=>!x||[b.artist,b.title,b.medium,b.year].some(y=>(y||"").toLowerCase().includes(x)));return g=g.slice(),d==="value-desc"?g.sort((b,y)=>(y.value||0)-(b.value||0)):d==="artist"?g.sort((b,y)=>(b.artist||"").localeCompare(y.artist||"")):g.sort((b,y)=>(y.valued_at||"").localeCompare(b.valued_at||"")),g},[r,l,d]);return o.jsxs("div",{className:"min-h-screen bg-[#FFFFFF] text-[#202020]",children:[o.jsx("header",{className:"border-b border-[#E8E8E8] bg-[#FFFFFF]",children:o.jsxs("div",{className:"max-w-5xl mx-auto px-6 py-8",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[o.jsx(St,{to:"/",className:"text-[10px] tracking-[0.18em] uppercase font-semibold text-[#B08A3E] hover:underline",children:"← Reverie Fine Art Collective"}),o.jsx(ml,{})]}),o.jsxs("div",{className:"mt-6",children:[o.jsx("div",{className:"text-[10px] tracking-[0.18em] uppercase text-[#B08A3E] font-semibold",children:"Gallery Profile"}),o.jsx("h1",{className:"font-serif text-5xl mt-2",children:(t==null?void 0:t.name)||"Gallery"}),(t==null?void 0:t.location)&&o.jsx("p",{className:"text-xs tracking-[0.14em] uppercase text-[#555555] mt-2",children:t.location}),(t==null?void 0:t.bio)&&o.jsx("p",{className:"italic text-[#555555] mt-3 max-w-2xl text-sm leading-relaxed",children:t.bio}),t&&o.jsxs("div",{className:"flex gap-6 mt-5 flex-wrap",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] tracking-[0.16em] uppercase text-[#555555] font-semibold",children:"Works"}),o.jsx("div",{className:"font-serif text-2xl",children:t.work_count})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] tracking-[0.16em] uppercase text-[#555555] font-semibold",children:"Appraised value"}),o.jsx("div",{className:"font-serif text-2xl",children:p(t.total_value,"USD")})]}),t.contact_email&&o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] tracking-[0.16em] uppercase text-[#555555] font-semibold",children:"Contact"}),o.jsx("a",{href:`mailto:${t.contact_email}`,className:"text-sm text-[#B08A3E] hover:underline",children:t.contact_email})]}),t.website&&o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] tracking-[0.16em] uppercase text-[#555555] font-semibold",children:"Website"}),o.jsx("a",{href:t.website,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#B08A3E] hover:underline",children:"Visit →"})]})]})]})]})}),o.jsxs("main",{className:"max-w-5xl mx-auto px-6 py-10",children:[s&&o.jsx("p",{className:"text-sm text-[#A8443A] italic",children:s}),!s&&r===null&&o.jsx("p",{className:"text-sm text-[#555555] italic",children:"Loading inventory…"}),r&&r.length>0&&o.jsxs("div",{className:"flex items-center justify-between gap-4 mb-6 flex-wrap",children:[o.jsx("input",{value:l,onChange:x=>c(x.target.value),placeholder:"Search artist, title, medium…",className:"text-xs bg-white border border-[#E8E8E8] rounded-sm px-3 py-2 w-64 text-[#202020] focus:outline-none focus:border-[#B08A3E]"}),o.jsxs("select",{value:d,onChange:x=>u(x.target.value),className:"text-xs bg-white border border-[#E8E8E8] rounded-sm px-2 py-1.5 text-[#202020] focus:outline-none focus:border-[#B08A3E]",children:[o.jsx("option",{value:"recent",children:"Recently revalued"}),o.jsx("option",{value:"value-desc",children:"Value: high → low"}),o.jsx("option",{value:"artist",children:"Artist A → Z"})]})]}),r&&r.length===0&&!s&&o.jsxs("div",{className:"border border-[#E8E8E8] bg-white p-8 text-center rounded-sm",children:[o.jsx("p",{className:"font-serif text-2xl",children:"No published works yet"}),o.jsx("p",{className:"text-sm text-[#555555] italic mt-2",children:"This gallery hasn't published any publicly valued works."})]}),h&&h.length>0&&o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6",children:h.map(x=>o.jsxs("article",{className:"border border-[#E8E8E8] bg-white rounded-sm overflow-hidden flex flex-col",children:[x.image_url&&o.jsx("div",{className:"aspect-square bg-[#F6F6F6] overflow-hidden",children:o.jsx("img",{src:x.image_url,alt:`${x.title||"Untitled"} by ${x.artist||"unknown artist"}`,loading:"lazy",className:"w-full h-full object-cover"})}),o.jsxs("div",{className:"p-4 flex-1 flex flex-col",children:[x.artist&&o.jsx(St,{to:`/artist/${FQ(x.artist)}`,className:"text-[10px] tracking-[0.16em] uppercase font-semibold text-[#B08A3E] hover:underline",children:x.artist}),o.jsx("h2",{className:"font-serif text-xl mt-1",children:x.title||"Untitled"}),o.jsx("p",{className:"text-xs text-[#555555] italic mt-1",children:[x.year,x.medium,x.dimensions].filter(
802Boolean).join(" · ")}),o.jsxs("div",{className:"mt-auto pt-4",children:[o.jsx("div",{className:"font-serif text-2xl",children:p(x.value,x.currency)}),o.jsxs("div",{className:"text-[10px] text-[#555555] mt-0.5",children:[x.confidence?`${x.confidence}% confidence`:"Indicative",x.status==="sold"?" · Sold":""]}),x.handle&&o.jsx("a",{href:`https://reverieart.com/products/${x.handle}`,target:"_blank",rel:"noopener noreferrer",className:"inline-block mt-3 text-[10px] tracking-[0.16em] uppercase font-semibold text-[#B08A3E] hover:underline",children:"View the work →"})]})]})]},x.submission_id))}),o.jsx("p",{className:"text-[11px] text-[#8A8177] italic mt-10 leading-relaxed",children:"Values shown are indicative appraisals produced by Reverie's dual-method model — comparable market sales blended with a transparent valuation formula. They are not offers to buy or sell."})]})]})},c3="https://uufdcsnvkixltkqaptzx.supabase.co",$Q={USD:"$",EUR:"€",GBP:"£",CAD:"C$",AUD:"A$"},BQ=()=>{const[e]=XE(),t=e.get("token")||"",[n,r]=k.useState(null),[i,s]=k.useState(null),[a,l]=k.useState(null),[c,d]=k.useState(null);k.useEffect(()=>{document.title="Your Watchlist | Reverie Fine Art Collective"},[]),k.useEffect(()=>{if(!t){l("This watchlist link is missing its access token."),r([]);return}fetch(`${c3}/functions/v1/watch-work?token=${encodeURIComponent(t)}`).then(p=>p.json()).then(p=>{if(!(p!=null&&p.ok))throw new Error((p==null?void 0:p.error)||"not found");s(p.email),r(p.items||[])}).catch(()=>{l("We couldn't open this watchlist. The link may have expired."),r([])})},[t]);const u=async p=>{d(p||"all");try{const x=await(await fetch(`${c3}/functions/v1/watch-work`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,action:"unsubscribe",submission_id:p||void 0})})).json();if(!(x!=null&&x.ok))throw new Error((x==null?void 0:x.error)||"failed");r(g=>p?(g||[]).filter(b=>b.submission_id!==p):[]),me.success(p?"Removed from your watchlist":"You've been unsubscribed")}catch{me.error("Could not update your watchlist. Please try again.")}finally{d(null)}},f=(p,h)=>p?`${$Q[h||"USD"]||"$"}${Math.round(p).toLocaleString()}`:"—";return o.jsxs("div",{className:"min-h-screen bg-[#FFFFFF] text-[#202020]",children:[o.jsx("header",{className:"border-b border-[#E8E8E8] bg-[#FFFFFF]",children:o.jsxs("div",{className:"max-w-4xl mx-auto px-6 py-8",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[o.jsx(St,{to:"/",className:"text-[10px] tracking-[0.18em] uppercase font-semibold text-[#B08A3E] hover:underline",children:"← Reverie Fine Art Collective"}),o.jsx(ml,{})]}),o.jsxs("div",{className:"mt-6",children:[o.jsx("div",{className:"text-[10px] tracking-[0.18em] uppercase text-[#B08A3E] font-semibold",children:"Collector Watchlist"}),o.jsx("h1",{className:"font-serif text-5xl mt-2",children:"Works you're following"}),o.jsxs("p",{className:"italic text-[#555555] mt-3 text-sm max-w-2xl",children:["We email you whenever one of these pieces is revalued.",i?` Alerts go to ${i}.`:""]})]})]})}),o.jsxs("main",{className:"max-w-4xl mx-auto px-6 py-10",children:[a&&o.jsx("p",{className:"text-sm text-[#A8443A] italic",children:a}),!a&&n===null&&o.jsx("p",{className:"text-sm text-[#555555] italic",children:"Loading your watchlist…"}),n&&n.length===0&&!a&&o.jsxs("div",{className:"border border-[#E8E8E8] bg-white p-8 text-center rounded-sm",children:[o.jsx("p",{className:"font-serif text-2xl",children:"Nothing saved yet"}),o.jsx("p",{className:"text-sm text-[#555555] italic mt-2",children:"Use “Save this work” on any Reverie valuation badge to follow a piece."}),o.jsx(St,{to:"/recently-revalued",className:"inline-block mt-5 text-[10px] tracking-[0.18em] uppercase font-semibold text-[#FFFFFF] bg-[#202020] px-4 py-2 rounded-sm hover:bg-[#333333]",children:"Browse recently revalued"})]}),n&&n.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"space-y-4",children:n.map(p=>o.jsxs("article",{className:"border border-[#E8E8E8] bg-white rounded-sm p-4 flex gap-4 items-start",children:[p.image_url&&o.jsx("img",{src:p.image_url,alt:`${p.title||"Untitled"} by ${p.artist||"unknown artist"}`,loading:"lazy",className:"w-24 h-24 object-cover rounded-sm border border-[#
802E8E8E8]"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-[10px] tracking-[0.16em] uppercase font-semibold text-[#B08A3E]",children:p.artist||"Unattributed"}),o.jsx("h2",{className:"font-serif text-xl mt-0.5 truncate",children:p.title||"Untitled"}),o.jsx("p",{className:"text-xs text-[#555555] italic mt-0.5",children:[p.year,p.medium].filter(Boolean).join(" · ")}),o.jsxs("div",{className:"flex items-baseline gap-3 mt-2",children:[o.jsx("span",{className:"font-serif text-2xl",children:f(p.value,p.currency)}),o.jsxs("span",{className:"text-[10px] text-[#555555]",children:[p.confidence?`${p.confidence}% confidence`:"Indicative",p.status==="sold"?" · Sold":""]})]}),o.jsxs("div",{className:"flex gap-4 mt-3",children:[p.handle&&o.jsx("a",{href:`https://reverieart.com/products/${p.handle}`,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] tracking-[0.16em] uppercase font-semibold text-[#B08A3E] hover:underline",children:"View the work →"}),o.jsx("button",{onClick:()=>u(p.submission_id),disabled:c===p.submission_id,className:"text-[10px] tracking-[0.16em] uppercase font-semibold text-[#555555] hover:text-[#A8443A] disabled:opacity-50",children:"Remove"})]})]})]},p.id))}),o.jsx("button",{onClick:()=>u(null),disabled:c==="all",className:"mt-8 text-[10px] tracking-[0.16em] uppercase font-semibold text-[#555555] hover:text-[#A8443A] disabled:opacity-50",children:"Unsubscribe from all alerts"})]})]})]})},d3="reverie:install-progress";function UQ(){const e=k.useMemo(()=>VP(),[]),[t,n]=k.useState({}),[r,i]=k.useState(null);k.useEffect(()=>{document.title="Shopify install guide · Reverie Fine Art Collective";const c=document.querySelector('meta[name="description"]');c&&c.setAttribute("content","Step-by-step guide to installing the Reverie valuation tool and storefront widgets on your Shopify theme.");const d=document.createElement("meta");d.name="robots",d.content="noindex",document.head.appendChild(d);try{const u=localStorage.getItem(d3);u&&n(JSON.parse(u))}catch{}return()=>{d.remove()}},[]);const s=c=>{n(d=>{const u={...d,[c]:!d[c]};try{localStorage.setItem(d3,JSON.stringify(u))}catch{}return u})},a=async(c,d)=>{try{await navigator.clipboard.writeText(c),i(d),me.success("Snippet copied"),setTimeout(()=>i(null),1600)}catch{me.error("Could not copy — select the code and copy manually")}},l=e.filter(c=>t[c.id]).length;return o.jsx("div",{className:"min-h-screen bg-background",children:o.jsxs("div",{className:"max-w-3xl mx-auto px-5 py-12",children:[o.jsx("div",{className:"text-[10px] tracking-[0.2em] uppercase text-accent-foreground font-semibold",children:"Storefront installation"}),o.jsx("h1",{className:"font-display text-3xl md:text-4xl text-foreground mt-2",children:"Put the valuation tool live on reverieart.com"}),o.jsx("p",{className:"font-body text-sm text-muted-foreground mt-3 leading-relaxed",children:"Six snippets, in this order. Each one is independent — paste, save, reload the storefront page, and it reports in below. Nothing here touches your products or theme design."}),o.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[o.jsx("div",{className:"h-1.5 flex-1 rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full bg-accent transition-all",style:{width:`${l/e.length*100}%`}})}),o.jsxs("span",{className:"text-xs font-body text-muted-foreground whitespace-nowrap",children:[l,"/",e.length," pasted"]})]}),o.jsxs("div",{className:"mt-5 flex flex-wrap items-center gap-2",children:[o.jsx("button",{onClick:()=>a(window.location.href,"__link"),className:"text-[10px] tracking-[0.14em] uppercase font-semibold px-3 py-2 border border-border text-foreground hover:bg-muted rounded-sm",children:r==="__link"?"Link copied":"Copy link to this guide"}),o.jsx("a",{href:`mailto:?subject=${encodeURIComponent("Please install the Reverie valuation widgets on reverieart.com")}&body=${encodeURIComponent(`Hi — please follow this step-by-step guide to paste six small snippets into the Shopify theme:
803
804${typeof window<"u"?window.location.href:""}
805
806Each step says exactly which file to open and where to paste. Nothing changes the theme design or products. Thank y
806ou!`)}`,className:"text-[10px] tracking-[0.14em] uppercase font-semibold px-3 py-2 bg-foreground text-background hover:opacity-90 rounded-sm",children:"Email this to my developer"}),o.jsx("button",{onClick:()=>a(e.map(c=>`${c.title} — ${c.where}
807${c.snippet}`).join(`
808
809`),"__all"),className:"text-[10px] tracking-[0.14em] uppercase font-semibold px-3 py-2 border border-border text-foreground hover:bg-muted rounded-sm",children:r==="__all"?"All snippets copied":"Copy all snippets"})]}),o.jsx("div",{className:"mt-8 space-y-4",children:e.map((c,d)=>o.jsxs("section",{className:`rounded-md border p-5 transition-colors ${t[c.id]?"border-accent bg-accent/5":"border-border bg-card"}`,children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"text-[10px] tracking-[0.18em] uppercase font-semibold text-muted-foreground",children:["Step ",d+1," · ",c.where]}),o.jsx("h2",{className:"font-display text-lg text-foreground mt-1",children:c.title})]}),o.jsx("button",{onClick:()=>s(c.id),className:`shrink-0 text-[10px] tracking-wider uppercase font-semibold px-2.5 py-1.5 rounded-sm border ${t[c.id]?"bg-accent text-accent-foreground border-accent":"text-muted-foreground border-border hover:border-accent"}`,children:t[c.id]?"Done":"Mark done"})]}),o.jsx("p",{className:"font-body text-xs text-muted-foreground mt-2 leading-relaxed",children:c.desc}),o.jsxs("div",{className:"mt-3 text-xs font-body",children:[o.jsx("span",{className:"text-[10px] tracking-[0.16em] uppercase font-semibold text-muted-foreground",children:"Where"}),o.jsx("div",{className:"text-foreground mt-1",children:c.file})]}),o.jsxs("div",{className:"relative mt-3",children:[o.jsx("pre",{className:"text-[11px] font-mono bg-muted/60 border border-border rounded-sm p-3 pr-20 overflow-x-auto text-foreground whitespace-pre-wrap break-all",children:c.snippet}),o.jsxs("button",{onClick:()=>a(c.snippet,c.id),className:"absolute top-2 right-2 inline-flex items-center gap-1 text-[10px] tracking-wider uppercase font-semibold px-2 py-1 rounded-sm bg-primary text-primary-foreground hover:brightness-110",children:[r===c.id?o.jsx(uo,{className:"w-3 h-3"}):o.jsx(yf,{className:"w-3 h-3"}),r===c.id?"Copied":"Copy"]})]}),o.jsxs("div",{className:"mt-3 text-xs font-body text-muted-foreground border-l-2 border-accent pl-3",children:[o.jsx("strong",{className:"text-foreground",children:"Check it:"})," ",c.verify]})]},c.id))}),o.jsxs("div",{className:"mt-10",children:[o.jsx("h2",{className:"font-display text-xl text-foreground",children:"Is it reporting in?"}),o.jsx("p",{className:"font-body text-xs text-muted-foreground mt-1 mb-3",children:"Every snippet sends one anonymous beacon per page load. Load the storefront page after pasting, then refresh this panel."}),o.jsx(G2,{})]}),o.jsxs("div",{className:"mt-10 rounded-md border border-border bg-card p-5",children:[o.jsx("h2",{className:"font-display text-xl text-foreground",children:"If something does not appear"}),o.jsxs("ul",{className:"mt-3 space-y-2 font-body text-xs text-muted-foreground leading-relaxed",children:[o.jsxs("li",{children:[o.jsx("strong",{className:"text-foreground",children:"Badge shows nothing on a product:"})," the work needs a Shopify handle saved and its public badge enabled in the dashboard, and the handle must match the product URL exactly."]}),o.jsxs("li",{children:[o.jsx("strong",{className:"text-foreground",children:"Health says “loading, not rendering”:"})," the script loaded but found no container — the ",o.jsx("code",{children:"<div>"})," was dropped or sits inside a section that did not save. Re-paste both lines together."]}),o.jsxs("li",{children:[o.jsx("strong",{className:"text-foreground",children:"Nothing reports at all:"})," the snippet is on a page you have not loaded yet, or a theme setting is stripping scripts from page content — use a Custom Liquid section instead of the rich-text editor."]}),o.jsxs("li",{children:[o.jsx("strong",{className:"text-foreground",children:"Tool page scrolls inside a box:"})," an old fixed height iframe is still in place. Remove it entirely and use step 1."]})]})]}),o.jsx("div",{className:"mt-8 text-center",children:o.jsx(St,{to:"/",className:"text-xs font-body font-semibold uppercase tracking-wider text-accent-foreground hover:underline",children:"← Back to the valuation tool"})})]})})}const zQ=new DO,qQ=()=>o.jsx(MO,{client:zQ,children:o.jsxs(c$,{children:[o.jsx(NF,{}),o.jsx(gD,{}),o.jsx(II,{children:o.jsx(dU,{children:o.jsxs(uU,{children:[o.jsx(WJ,{}),o.jsxs(EI,{children:[o.jsx(yn,{path:"/",element:o.jsx(Wm,{})}),o.jsx(yn,{path:"/value",element:o.jsx(Wm,{})}),o.jsx(yn,{path:"/submissions",element:o.jsx(Wm,{})}),o.jsx(yn,{path:"/consignments",element:o.jsx(Wm,{})}),o.jsx(yn,{path:"/admin",element:o.jsx(NJ,{})}),o.jsx(yn,{path:"/admin/market-review",element:o.jsx(qJ,{})}),o.jsx(yn,{path:"/unsubscribe",element:o.jsx(lQ,{})}),o.jsx(yn,{path:"/terms",element:o.jsx(cQ,{})}),o.jsx(yn,{path:"/refund-policy",element:o.jsx(dQ,{})}),o.jsx(yn,{path:"/privacy",element:o.jsx(uQ,{})}),o.jsx(yn,{path:"/c/:id",element:o.jsx(fQ,{})}),o.jsx(yn,{path:"/r/:token",element:o.jsx(pQ,{})}),o.jsx(yn,{path:"/p/:token",element:o.jsx(xQ,{})}),o.jsx(yn,{path:"/artist/:slug",element:o.jsx(wQ,{})}
809),o.jsx(yn,{path:"/artists",element:o.jsx(kQ,{})}),o.jsx(yn,{path:"/recently-revalued",element:o.jsx(jQ,{})}),o.jsx(yn,{path:"/inquiry/:token",element:o.jsx(CQ,{})}),o.jsx(yn,{path:"/about",element:o.jsx(AQ,{})}),o.jsx(yn,{path:"/roadmap",element:o.jsx(TQ,{})}),o.jsx(yn,{path:"/gallery/:slug",element:o.jsx(MQ,{})}),o.jsx(yn,{path:"/watchlist",element:o.jsx(BQ,{})}),o.jsx(yn,{path:"/install",element:o.jsx(UQ,{})}),o.jsx(yn,{path:"/auth-popup",element:o.jsx(OQ,{})}),o.jsx(yn,{path:"*",element:o.jsx(aQ,{})})]})]})})})]})});RE(document.getElementById("root")).render(o.jsx(qQ,{}));export{en as _,HQ as c,Y1 as g};

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.