progresspulse-pwa
Version:
A modern PWA for tracking progress and achieving goals with iPhone-style design
1,647 lines • 1.19 MB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdfExport-Dm-2p29r.js","assets/ui-DTulVQEa.js","assets/vendor-BtIrUdbE.js","assets/router-CAWuvUE2.js","assets/charts-BwVdQLxe.js","assets/index.es-DizRFBzT.js"])))=>i.map(i=>d[i]);
var tj=Object.defineProperty;var nj=(t,e,n)=>e in t?tj(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Tn=(t,e,n)=>nj(t,typeof e!="symbol"?e+"":e,n);import{j as a,S as Kh,c as ed,P as sr,u as h2,a as la,b as f2,d as p2,e as rj,C as m2,I as g2,f as v2,g as y2,R as x2,L as b2,h as w2,i as sj,T as ij,k as aj,l as Gh,m as ks,A as Gm,n as rr,o as N2,p as j2,q as S2,F as k2,D as _2,r as A2,s as Yh,t as P2,v as C2,w as oj,x as fh,y as T2,O as Ym,z as Zm,B as Xm,E as Jm,G as Qm,H as L2,J as D2,K as I2,M as M2,N as E2,W as lj,Q as cj,U as uj}from"./ui-DTulVQEa.js";import{a as eg,r as I,b as dt,c as dj,d as u1,g as hj}from"./vendor-BtIrUdbE.js";import{u as tg,L as Cl,a as so,B as fj,R as d1,b as qn,N as Md}from"./router-CAWuvUE2.js";import{c as pj,R as Hd,L as O2,C as Bp,X as Vp,Y as qp,T as Kd,a as R2,b as F2,P as mj,d as gj,e as vj,B as yj,f as h1}from"./charts-BwVdQLxe.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var B2,f1=eg;B2=f1.createRoot,f1.hydrateRoot;var ph=["light","dark"],ng="(prefers-color-scheme: dark)",xj=typeof window>"u",rg=I.createContext(void 0),bj={setTheme:t=>{},themes:[]},V2=()=>{var t;return(t=I.useContext(rg))!=null?t:bj},wj=t=>I.useContext(rg)?t.children:I.createElement(jj,{...t}),Nj=["light","dark"],jj=({forcedTheme:t,disableTransitionOnChange:e=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:s="theme",themes:i=Nj,defaultTheme:o=n?"system":"light",attribute:l="data-theme",value:c,children:d,nonce:f})=>{let[m,g]=I.useState(()=>p1(s,o)),[v,N]=I.useState(()=>p1(s)),j=c?Object.values(c):i,P=I.useCallback($=>{let Y=$;if(!Y)return;$==="system"&&n&&(Y=m1());let U=c?c[Y]:Y,te=e?kj():null,W=document.documentElement;if(l==="class"?(W.classList.remove(...j),U&&W.classList.add(U)):U?W.setAttribute(l,U):W.removeAttribute(l),r){let ge=ph.includes(o)?o:null,oe=ph.includes(Y)?Y:ge;W.style.colorScheme=oe}te==null||te()},[]),k=I.useCallback($=>{let Y=typeof $=="function"?$($):$;g(Y);try{localStorage.setItem(s,Y)}catch{}},[t]),_=I.useCallback($=>{let Y=m1($);N(Y),m==="system"&&n&&!t&&P("system")},[m,t]);I.useEffect(()=>{let $=window.matchMedia(ng);return $.addListener(_),_($),()=>$.removeListener(_)},[_]),I.useEffect(()=>{let $=Y=>{if(Y.key!==s)return;let U=Y.newValue||o;k(U)};return window.addEventListener("storage",$),()=>window.removeEventListener("storage",$)},[k]),I.useEffect(()=>{P(t??m)},[t,m]);let M=I.useMemo(()=>({theme:m,setTheme:k,forcedTheme:t,resolvedTheme:m==="system"?v:m,themes:n?[...i,"system"]:i,systemTheme:n?v:void 0}),[m,k,t,v,n,i]);return I.createElement(rg.Provider,{value:M},I.createElement(Sj,{forcedTheme:t,disableTransitionOnChange:e,enableSystem:n,enableColorScheme:r,storageKey:s,themes:i,defaultTheme:o,attribute:l,value:c,children:d,attrs:j,nonce:f}),d)},Sj=I.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:s,defaultTheme:i,value:o,attrs:l,nonce:c})=>{let d=i==="system",f=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(N=>`'${N}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,m=s?ph.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",g=(N,j=!1,P=!0)=>{let k=o?o[N]:N,_=j?N+"|| ''":`'${k}'`,M="";return s&&P&&!j&&ph.includes(N)&&(M+=`d.style.colorScheme = '${N}';`),n==="class"?j||k?M+=`c.add(${_})`:M+="null":k&&(M+=`d[s](n,${_})`),M},v=t?`!function(){${f}${g(t)}}()`:r?`!function(){try{${f}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${d})){var t='${ng}',m=window.matchMedia(t);if(m.media!==t||m.matches){${g("dark")}}else{${g("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${g(o?"x[e]":"e",!0)}}${d?"":"else{"+g(i,!1,!1)+"}"}${m}}catch(e){}}()`:`!function(){try{${f}var e=localStorage.getItem('${e}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${g(o?"x[e]":"e",!0)}}else{${g(i,!1,!1)};}${m}}catch(t){}}();`;return I.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:v}})}),p1=(t,e)=>{if(xj)return;let n;try{n=localStorage.getItem(t)||void 0}catch{}return n||e},kj=()=>{let t=document.createElement("style");return t.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},m1=t=>(t||(t=window.matchMedia(ng)),t.matches?"dark":"light"),_j=t=>{switch(t){case"success":return Cj;case"info":return Lj;case"warning":return Tj;case"error":return Dj;default:return null}},Aj=Array(12).fill(0),Pj=({visible:t})=>dt.createElement("div",{className:"sonner-loading-wrapper","data-visible":t},dt.createElement("div",{className:"sonner-spinner"},Aj.map((e,n)=>dt.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),Cj=dt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},dt.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"})),Tj=dt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},dt.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"})),Lj=dt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},dt.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"})),Dj=dt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},dt.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"})),Ij=()=>{let[t,e]=dt.useState(document.hidden);return dt.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},Up=1,Mj=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;let{message:r,...s}=e,i=typeof(e==null?void 0:e.id)=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:Up++,o=this.toasts.find(c=>c.id===i),l=e.dismissible===void 0?!0:e.dismissible;return o?this.toasts=this.toasts.map(c=>c.id===i?(this.publish({...c,...e,id:i,title:r}),{...c,...e,id:i,dismissible:l,title:r}):c):this.addToast({title:r,...s,dismissible:l,id:i}),i},this.dismiss=e=>(e||this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),this.subscribers.forEach(n=>n({id:e,dismiss:!0})),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let s=e instanceof Promise?e:e(),i=r!==void 0;return s.then(async o=>{if(Oj(o)&&!o.ok){i=!1;let l=typeof n.error=="function"?await n.error(`HTTP error! status: ${o.status}`):n.error,c=typeof n.description=="function"?await n.description(`HTTP error! status: ${o.status}`):n.description;this.create({id:r,type:"error",message:l,description:c})}else if(n.success!==void 0){i=!1;let l=typeof n.success=="function"?await n.success(o):n.success,c=typeof n.description=="function"?await n.description(o):n.description;this.create({id:r,type:"success",message:l,description:c})}}).catch(async o=>{if(n.error!==void 0){i=!1;let l=typeof n.error=="function"?await n.error(o):n.error,c=typeof n.description=="function"?await n.description(o):n.description;this.create({id:r,type:"error",message:l,description:c})}}).finally(()=>{var o;i&&(this.dismiss(r),r=void 0),(o=n.finally)==null||o.call(n)}),r},this.custom=(e,n)=>{let r=(n==null?void 0:n.id)||Up++;return this.create({jsx:e(r),id:r,...n}),r},this.subscribers=[],this.toasts=[]}},Hs=new Mj,Ej=(t,e)=>{let n=(e==null?void 0:e.id)||Up++;return Hs.addToast({title:t,...e,id:n}),n},Oj=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",Rj=Ej,Fj=()=>Hs.toasts,St=Object.assign(Rj,{success:Hs.success,info:Hs.info,warning:Hs.warning,error:Hs.error,custom:Hs.custom,message:Hs.message,promise:Hs.promise,dismiss:Hs.dismiss,loading:Hs.loading},{getHistory:Fj});function Bj(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}Bj(`: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}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-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;left: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;background:var(--gray1);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}: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:0;right:0;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}: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, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);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-border: hsl(0, 0%, 20%);--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%);--error-text: hsl(358, 100%, 81%)}[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%)}
`);function Ed(t){return t.label!==void 0}var Vj=3,qj="32px",Uj=4e3,zj=356,Wj=14,$j=20,Hj=200;function Kj(...t){return t.filter(Boolean).join(" ")}var Gj=t=>{var e,n,r,s,i,o,l,c,d,f;let{invert:m,toast:g,unstyled:v,interacting:N,setHeights:j,visibleToasts:P,heights:k,index:_,toasts:M,expanded:$,removeToast:Y,defaultRichColors:U,closeButton:te,style:W,cancelButtonStyle:ge,actionButtonStyle:oe,className:B="",descriptionClassName:T="",duration:J,position:Z,gap:Ne,loadingIcon:he,expandByDefault:ae,classNames:G,icons:xe,closeButtonAriaLabel:De="Close toast",pauseWhenPageIsHidden:$e,cn:E}=t,[z,ee]=dt.useState(!1),[le,ue]=dt.useState(!1),[ve,Pe]=dt.useState(!1),[ce,Ye]=dt.useState(!1),[Ke,Ue]=dt.useState(0),[it,It]=dt.useState(0),qe=dt.useRef(null),re=dt.useRef(null),zt=_===0,X=_+1<=P,ne=g.type,fe=g.dismissible!==!1,Re=g.className||"",Oe=g.descriptionClassName||"",Fe=dt.useMemo(()=>k.findIndex(xt=>xt.toastId===g.id)||0,[k,g.id]),et=dt.useMemo(()=>{var xt;return(xt=g.closeButton)!=null?xt:te},[g.closeButton,te]),yt=dt.useMemo(()=>g.duration||J||Uj,[g.duration,J]),Pt=dt.useRef(0),Lt=dt.useRef(0),an=dt.useRef(0),Ot=dt.useRef(null),[Qt,ft]=Z.split("-"),In=dt.useMemo(()=>k.reduce((xt,gn,Ge)=>Ge>=Fe?xt:xt+gn.height,0),[k,Fe]),on=Ij(),Mr=g.invert||m,ln=ne==="loading";Lt.current=dt.useMemo(()=>Fe*Ne+In,[Fe,In]),dt.useEffect(()=>{ee(!0)},[]),dt.useLayoutEffect(()=>{if(!z)return;let xt=re.current,gn=xt.style.height;xt.style.height="auto";let Ge=xt.getBoundingClientRect().height;xt.style.height=gn,It(Ge),j(Hn=>Hn.find(ir=>ir.toastId===g.id)?Hn.map(ir=>ir.toastId===g.id?{...ir,height:Ge}:ir):[{toastId:g.id,height:Ge,position:g.position},...Hn])},[z,g.title,g.description,j,g.id]);let lt=dt.useCallback(()=>{ue(!0),Ue(Lt.current),j(xt=>xt.filter(gn=>gn.toastId!==g.id)),setTimeout(()=>{Y(g)},Hj)},[g,Y,j,Lt]);dt.useEffect(()=>{if(g.promise&&ne==="loading"||g.duration===1/0||g.type==="loading")return;let xt,gn=yt;return $||N||$e&&on?(()=>{if(an.current<Pt.current){let Ge=new Date().getTime()-Pt.current;gn=gn-Ge}an.current=new Date().getTime()})():gn!==1/0&&(Pt.current=new Date().getTime(),xt=setTimeout(()=>{var Ge;(Ge=g.onAutoClose)==null||Ge.call(g,g),lt()},gn)),()=>clearTimeout(xt)},[$,N,ae,g,yt,lt,g.promise,ne,$e,on]),dt.useEffect(()=>{let xt=re.current;if(xt){let gn=xt.getBoundingClientRect().height;return It(gn),j(Ge=>[{toastId:g.id,height:gn,position:g.position},...Ge]),()=>j(Ge=>Ge.filter(Hn=>Hn.toastId!==g.id))}},[j,g.id]),dt.useEffect(()=>{g.delete&<()},[lt,g.delete]);function zr(){return xe!=null&&xe.loading?dt.createElement("div",{className:"sonner-loader","data-visible":ne==="loading"},xe.loading):he?dt.createElement("div",{className:"sonner-loader","data-visible":ne==="loading"},he):dt.createElement(Pj,{visible:ne==="loading"})}return dt.createElement("li",{"aria-live":g.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:re,className:E(B,Re,G==null?void 0:G.toast,(e=g==null?void 0:g.classNames)==null?void 0:e.toast,G==null?void 0:G.default,G==null?void 0:G[ne],(n=g==null?void 0:g.classNames)==null?void 0:n[ne]),"data-sonner-toast":"","data-rich-colors":(r=g.richColors)!=null?r:U,"data-styled":!(g.jsx||g.unstyled||v),"data-mounted":z,"data-promise":!!g.promise,"data-removed":le,"data-visible":X,"data-y-position":Qt,"data-x-position":ft,"data-index":_,"data-front":zt,"data-swiping":ve,"data-dismissible":fe,"data-type":ne,"data-invert":Mr,"data-swipe-out":ce,"data-expanded":!!($||ae&&z),style:{"--index":_,"--toasts-before":_,"--z-index":M.length-_,"--offset":`${le?Ke:Lt.current}px`,"--initial-height":ae?"auto":`${it}px`,...W,...g.style},onPointerDown:xt=>{ln||!fe||(qe.current=new Date,Ue(Lt.current),xt.target.setPointerCapture(xt.pointerId),xt.target.tagName!=="BUTTON"&&(Pe(!0),Ot.current={x:xt.clientX,y:xt.clientY}))},onPointerUp:()=>{var xt,gn,Ge,Hn;if(ce||!fe)return;Ot.current=null;let ir=Number(((xt=re.current)==null?void 0:xt.style.getPropertyValue("--swipe-amount").replace("px",""))||0),An=new Date().getTime()-((gn=qe.current)==null?void 0:gn.getTime()),Yt=Math.abs(ir)/An;if(Math.abs(ir)>=$j||Yt>.11){Ue(Lt.current),(Ge=g.onDismiss)==null||Ge.call(g,g),lt(),Ye(!0);return}(Hn=re.current)==null||Hn.style.setProperty("--swipe-amount","0px"),Pe(!1)},onPointerMove:xt=>{var gn;if(!Ot.current||!fe)return;let Ge=xt.clientY-Ot.current.y,Hn=xt.clientX-Ot.current.x,ir=(Qt==="top"?Math.min:Math.max)(0,Ge),An=xt.pointerType==="touch"?10:2;Math.abs(ir)>An?(gn=re.current)==null||gn.style.setProperty("--swipe-amount",`${Ge}px`):Math.abs(Hn)>An&&(Ot.current=null)}},et&&!g.jsx?dt.createElement("button",{"aria-label":De,"data-disabled":ln,"data-close-button":!0,onClick:ln||!fe?()=>{}:()=>{var xt;lt(),(xt=g.onDismiss)==null||xt.call(g,g)},className:E(G==null?void 0:G.closeButton,(s=g==null?void 0:g.classNames)==null?void 0:s.closeButton)},dt.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"},dt.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),dt.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,g.jsx||dt.isValidElement(g.title)?g.jsx||g.title:dt.createElement(dt.Fragment,null,ne||g.icon||g.promise?dt.createElement("div",{"data-icon":"",className:E(G==null?void 0:G.icon,(i=g==null?void 0:g.classNames)==null?void 0:i.icon)},g.promise||g.type==="loading"&&!g.icon?g.icon||zr():null,g.type!=="loading"?g.icon||(xe==null?void 0:xe[ne])||_j(ne):null):null,dt.createElement("div",{"data-content":"",className:E(G==null?void 0:G.content,(o=g==null?void 0:g.classNames)==null?void 0:o.content)},dt.createElement("div",{"data-title":"",className:E(G==null?void 0:G.title,(l=g==null?void 0:g.classNames)==null?void 0:l.title)},g.title),g.description?dt.createElement("div",{"data-description":"",className:E(T,Oe,G==null?void 0:G.description,(c=g==null?void 0:g.classNames)==null?void 0:c.description)},g.description):null),dt.isValidElement(g.cancel)?g.cancel:g.cancel&&Ed(g.cancel)?dt.createElement("button",{"data-button":!0,"data-cancel":!0,style:g.cancelButtonStyle||ge,onClick:xt=>{var gn,Ge;Ed(g.cancel)&&fe&&((Ge=(gn=g.cancel).onClick)==null||Ge.call(gn,xt),lt())},className:E(G==null?void 0:G.cancelButton,(d=g==null?void 0:g.classNames)==null?void 0:d.cancelButton)},g.cancel.label):null,dt.isValidElement(g.action)?g.action:g.action&&Ed(g.action)?dt.createElement("button",{"data-button":!0,"data-action":!0,style:g.actionButtonStyle||oe,onClick:xt=>{var gn,Ge;Ed(g.action)&&(xt.defaultPrevented||((Ge=(gn=g.action).onClick)==null||Ge.call(gn,xt),lt()))},className:E(G==null?void 0:G.actionButton,(f=g==null?void 0:g.classNames)==null?void 0:f.actionButton)},g.action.label):null))};function g1(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}var Yj=t=>{let{invert:e,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:s,closeButton:i,className:o,offset:l,theme:c="light",richColors:d,duration:f,style:m,visibleToasts:g=Vj,toastOptions:v,dir:N=g1(),gap:j=Wj,loadingIcon:P,icons:k,containerAriaLabel:_="Notifications",pauseWhenPageIsHidden:M,cn:$=Kj}=t,[Y,U]=dt.useState([]),te=dt.useMemo(()=>Array.from(new Set([n].concat(Y.filter($e=>$e.position).map($e=>$e.position)))),[Y,n]),[W,ge]=dt.useState([]),[oe,B]=dt.useState(!1),[T,J]=dt.useState(!1),[Z,Ne]=dt.useState(c!=="system"?c:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),he=dt.useRef(null),ae=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),G=dt.useRef(null),xe=dt.useRef(!1),De=dt.useCallback($e=>{var E;(E=Y.find(z=>z.id===$e.id))!=null&&E.delete||Hs.dismiss($e.id),U(z=>z.filter(({id:ee})=>ee!==$e.id))},[Y]);return dt.useEffect(()=>Hs.subscribe($e=>{if($e.dismiss){U(E=>E.map(z=>z.id===$e.id?{...z,delete:!0}:z));return}setTimeout(()=>{dj.flushSync(()=>{U(E=>{let z=E.findIndex(ee=>ee.id===$e.id);return z!==-1?[...E.slice(0,z),{...E[z],...$e},...E.slice(z+1)]:[$e,...E]})})})}),[]),dt.useEffect(()=>{if(c!=="system"){Ne(c);return}c==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Ne("dark"):Ne("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:$e})=>{Ne($e?"dark":"light")})},[c]),dt.useEffect(()=>{Y.length<=1&&B(!1)},[Y]),dt.useEffect(()=>{let $e=E=>{var z,ee;r.every(le=>E[le]||E.code===le)&&(B(!0),(z=he.current)==null||z.focus()),E.code==="Escape"&&(document.activeElement===he.current||(ee=he.current)!=null&&ee.contains(document.activeElement))&&B(!1)};return document.addEventListener("keydown",$e),()=>document.removeEventListener("keydown",$e)},[r]),dt.useEffect(()=>{if(he.current)return()=>{G.current&&(G.current.focus({preventScroll:!0}),G.current=null,xe.current=!1)}},[he.current]),Y.length?dt.createElement("section",{"aria-label":`${_} ${ae}`,tabIndex:-1},te.map(($e,E)=>{var z;let[ee,le]=$e.split("-");return dt.createElement("ol",{key:$e,dir:N==="auto"?g1():N,tabIndex:-1,ref:he,className:o,"data-sonner-toaster":!0,"data-theme":Z,"data-y-position":ee,"data-x-position":le,style:{"--front-toast-height":`${((z=W[0])==null?void 0:z.height)||0}px`,"--offset":typeof l=="number"?`${l}px`:l||qj,"--width":`${zj}px`,"--gap":`${j}px`,...m},onBlur:ue=>{xe.current&&!ue.currentTarget.contains(ue.relatedTarget)&&(xe.current=!1,G.current&&(G.current.focus({preventScroll:!0}),G.current=null))},onFocus:ue=>{ue.target instanceof HTMLElement&&ue.target.dataset.dismissible==="false"||xe.current||(xe.current=!0,G.current=ue.relatedTarget)},onMouseEnter:()=>B(!0),onMouseMove:()=>B(!0),onMouseLeave:()=>{T||B(!1)},onPointerDown:ue=>{ue.target instanceof HTMLElement&&ue.target.dataset.dismissible==="false"||J(!0)},onPointerUp:()=>J(!1)},Y.filter(ue=>!ue.position&&E===0||ue.position===$e).map((ue,ve)=>{var Pe,ce;return dt.createElement(Gj,{key:ue.id,icons:k,index:ve,toast:ue,defaultRichColors:d,duration:(Pe=v==null?void 0:v.duration)!=null?Pe:f,className:v==null?void 0:v.className,descriptionClassName:v==null?void 0:v.descriptionClassName,invert:e,visibleToasts:g,closeButton:(ce=v==null?void 0:v.closeButton)!=null?ce:i,interacting:T,position:$e,style:v==null?void 0:v.style,unstyled:v==null?void 0:v.unstyled,classNames:v==null?void 0:v.classNames,cancelButtonStyle:v==null?void 0:v.cancelButtonStyle,actionButtonStyle:v==null?void 0:v.actionButtonStyle,removeToast:De,toasts:Y.filter(Ye=>Ye.position==ue.position),heights:W.filter(Ye=>Ye.position==ue.position),setHeights:ge,expandByDefault:s,gap:j,loadingIcon:P,expanded:oe,pauseWhenPageIsHidden:M,cn:$})}))})):null};const Zj="modulepreload",Xj=function(t){return"/"+t},v1={},eo=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=Xj(c),c in v1)return;v1[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":Zj,d||(m.as="script"),m.crossOrigin="",m.href=c,l&&m.setAttribute("nonce",l),document.head.appendChild(m),d)return new Promise((g,v)=>{m.addEventListener("load",g),m.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return e().catch(i)})};var q2={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(u1,function(){var n=function(h,y){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(w,A){w.__proto__=A}||function(w,A){for(var C in A)Object.prototype.hasOwnProperty.call(A,C)&&(w[C]=A[C])})(h,y)},r=function(){return(r=Object.assign||function(h){for(var y,w=1,A=arguments.length;w<A;w++)for(var C in y=arguments[w])Object.prototype.hasOwnProperty.call(y,C)&&(h[C]=y[C]);return h}).apply(this,arguments)};function s(h,y,w){for(var A,C=0,R=y.length;C<R;C++)!A&&C in y||((A=A||Array.prototype.slice.call(y,0,C))[C]=y[C]);return h.concat(A||Array.prototype.slice.call(y))}var i=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:u1,o=Object.keys,l=Array.isArray;function c(h,y){return typeof y!="object"||o(y).forEach(function(w){h[w]=y[w]}),h}typeof Promise>"u"||i.Promise||(i.Promise=Promise);var d=Object.getPrototypeOf,f={}.hasOwnProperty;function m(h,y){return f.call(h,y)}function g(h,y){typeof y=="function"&&(y=y(d(h))),(typeof Reflect>"u"?o:Reflect.ownKeys)(y).forEach(function(w){N(h,w,y[w])})}var v=Object.defineProperty;function N(h,y,w,A){v(h,y,c(w&&m(w,"get")&&typeof w.get=="function"?{get:w.get,set:w.set,configurable:!0}:{value:w,configurable:!0,writable:!0},A))}function j(h){return{from:function(y){return h.prototype=Object.create(y.prototype),N(h.prototype,"constructor",h),{extend:g.bind(null,h.prototype)}}}}var P=Object.getOwnPropertyDescriptor,k=[].slice;function _(h,y,w){return k.call(h,y,w)}function M(h,y){return y(h)}function $(h){if(!h)throw new Error("Assertion Failed")}function Y(h){i.setImmediate?setImmediate(h):setTimeout(h,0)}function U(h,y){if(typeof y=="string"&&m(h,y))return h[y];if(!y)return h;if(typeof y!="string"){for(var w=[],A=0,C=y.length;A<C;++A){var R=U(h,y[A]);w.push(R)}return w}var H=y.indexOf(".");if(H!==-1){var se=h[y.substr(0,H)];return se==null?void 0:U(se,y.substr(H+1))}}function te(h,y,w){if(h&&y!==void 0&&!("isFrozen"in Object&&Object.isFrozen(h)))if(typeof y!="string"&&"length"in y){$(typeof w!="string"&&"length"in w);for(var A=0,C=y.length;A<C;++A)te(h,y[A],w[A])}else{var R,H,se=y.indexOf(".");se!==-1?(R=y.substr(0,se),(H=y.substr(se+1))===""?w===void 0?l(h)&&!isNaN(parseInt(R))?h.splice(R,1):delete h[R]:h[R]=w:te(se=!(se=h[R])||!m(h,R)?h[R]={}:se,H,w)):w===void 0?l(h)&&!isNaN(parseInt(y))?h.splice(y,1):delete h[y]:h[y]=w}}function W(h){var y,w={};for(y in h)m(h,y)&&(w[y]=h[y]);return w}var ge=[].concat;function oe(h){return ge.apply([],h)}var Pt="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(oe([8,16,32,64].map(function(h){return["Int","Uint","Float"].map(function(y){return y+h+"Array"})}))).filter(function(h){return i[h]}),B=new Set(Pt.map(function(h){return i[h]})),T=null;function J(h){return T=new WeakMap,h=function y(w){if(!w||typeof w!="object")return w;var A=T.get(w);if(A)return A;if(l(w)){A=[],T.set(w,A);for(var C=0,R=w.length;C<R;++C)A.push(y(w[C]))}else if(B.has(w.constructor))A=w;else{var H,se=d(w);for(H in A=se===Object.prototype?{}:Object.create(se),T.set(w,A),w)m(w,H)&&(A[H]=y(w[H]))}return A}(h),T=null,h}var Z={}.toString;function Ne(h){return Z.call(h).slice(8,-1)}var he=typeof Symbol<"u"?Symbol.iterator:"@@iterator",ae=typeof he=="symbol"?function(h){var y;return h!=null&&(y=h[he])&&y.apply(h)}:function(){return null};function G(h,y){return y=h.indexOf(y),0<=y&&h.splice(y,1),0<=y}var xe={};function De(h){var y,w,A,C;if(arguments.length===1){if(l(h))return h.slice();if(this===xe&&typeof h=="string")return[h];if(C=ae(h)){for(w=[];!(A=C.next()).done;)w.push(A.value);return w}if(h==null)return[h];if(typeof(y=h.length)!="number")return[h];for(w=new Array(y);y--;)w[y]=h[y];return w}for(y=arguments.length,w=new Array(y);y--;)w[y]=arguments[y];return w}var $e=typeof Symbol<"u"?function(h){return h[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},yt=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Br=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(yt),E={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function z(h,y){this.name=h,this.message=y}function ee(h,y){return h+". Errors: "+Object.keys(y).map(function(w){return y[w].toString()}).filter(function(w,A,C){return C.indexOf(w)===A}).join(`
`)}function le(h,y,w,A){this.failures=y,this.failedKeys=A,this.successCount=w,this.message=ee(h,y)}function ue(h,y){this.name="BulkError",this.failures=Object.keys(y).map(function(w){return y[w]}),this.failuresByPos=y,this.message=ee(h,this.failures)}j(z).from(Error).extend({toString:function(){return this.name+": "+this.message}}),j(le).from(z),j(ue).from(z);var ve=Br.reduce(function(h,y){return h[y]=y+"Error",h},{}),Pe=z,ce=Br.reduce(function(h,y){var w=y+"Error";function A(C,R){this.name=w,C?typeof C=="string"?(this.message="".concat(C).concat(R?`
`+R:""),this.inner=R||null):typeof C=="object"&&(this.message="".concat(C.name," ").concat(C.message),this.inner=C):(this.message=E[y]||w,this.inner=null)}return j(A).from(Pe),h[y]=A,h},{});ce.Syntax=SyntaxError,ce.Type=TypeError,ce.Range=RangeError;var Ye=yt.reduce(function(h,y){return h[y+"Error"]=ce[y],h},{}),Ke=Br.reduce(function(h,y){return["Syntax","Type","Range"].indexOf(y)===-1&&(h[y+"Error"]=ce[y]),h},{});function Ue(){}function it(h){return h}function It(h,y){return h==null||h===it?y:function(w){return y(h(w))}}function qe(h,y){return function(){h.apply(this,arguments),y.apply(this,arguments)}}function re(h,y){return h===Ue?y:function(){var w=h.apply(this,arguments);w!==void 0&&(arguments[0]=w);var A=this.onsuccess,C=this.onerror;this.onsuccess=null,this.onerror=null;var R=y.apply(this,arguments);return A&&(this.onsuccess=this.onsuccess?qe(A,this.onsuccess):A),C&&(this.onerror=this.onerror?qe(C,this.onerror):C),R!==void 0?R:w}}function zt(h,y){return h===Ue?y:function(){h.apply(this,arguments);var w=this.onsuccess,A=this.onerror;this.onsuccess=this.onerror=null,y.apply(this,arguments),w&&(this.onsuccess=this.onsuccess?qe(w,this.onsuccess):w),A&&(this.onerror=this.onerror?qe(A,this.onerror):A)}}function X(h,y){return h===Ue?y:function(w){var A=h.apply(this,arguments);c(w,A);var C=this.onsuccess,R=this.onerror;return this.onsuccess=null,this.onerror=null,w=y.apply(this,arguments),C&&(this.onsuccess=this.onsuccess?qe(C,this.onsuccess):C),R&&(this.onerror=this.onerror?qe(R,this.onerror):R),A===void 0?w===void 0?void 0:w:c(A,w)}}function ne(h,y){return h===Ue?y:function(){return y.apply(this,arguments)!==!1&&h.apply(this,arguments)}}function fe(h,y){return h===Ue?y:function(){var w=h.apply(this,arguments);if(w&&typeof w.then=="function"){for(var A=this,C=arguments.length,R=new Array(C);C--;)R[C]=arguments[C];return w.then(function(){return y.apply(A,R)})}return y.apply(this,arguments)}}Ke.ModifyError=le,Ke.DexieError=z,Ke.BulkError=ue;var Re=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Oe(h){Re=h}var Fe={},et=100,Pt=typeof Promise>"u"?[]:function(){var h=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[h,d(h),h];var y=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[y,d(y),h]}(),yt=Pt[0],Br=Pt[1],Pt=Pt[2],Br=Br&&Br.then,Lt=yt&&yt.constructor,an=!!Pt,Ot=function(h,y){zr.push([h,y]),ft&&(queueMicrotask(Er),ft=!1)},Qt=!0,ft=!0,In=[],on=[],Mr=it,ln={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Ue,pgp:!1,env:{},finalize:Ue},lt=ln,zr=[],xt=0,gn=[];function Ge(h){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var y=this._PSD=lt;if(typeof h!="function"){if(h!==Fe)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&An(this,this._value))}this._state=null,this._value=null,++y.ref,function w(A,C){try{C(function(R){if(A._state===null){if(R===A)throw new TypeError("A promise cannot be resolved with itself.");var H=A._lib&&Xr();R&&typeof R.then=="function"?w(A,function(se,me){R instanceof Ge?R._then(se,me):R.then(se,me)}):(A._state=!0,A._value=R,Yt(A)),H&&Jr()}},An.bind(null,A))}catch(R){An(A,R)}}(this,h)}var Hn={get:function(){var h=lt,y=li;function w(A,C){var R=this,H=!h.global&&(h!==lt||y!==li),se=H&&!Cr(),me=new Ge(function(we,_e){Nn(R,new ir(ma(A,h,H,se),ma(C,h,H,se),we,_e,h))});return this._consoleTask&&(me._consoleTask=this._consoleTask),me}return w.prototype=Fe,w},set:function(h){N(this,"then",h&&h.prototype===Fe?Hn:{get:function(){return h},set:Hn.set})}};function ir(h,y,w,A,C){this.onFulfilled=typeof h=="function"?h:null,this.onRejected=typeof y=="function"?y:null,this.resolve=w,this.reject=A,this.psd=C}function An(h,y){var w,A;on.push(y),h._state===null&&(w=h._lib&&Xr(),y=Mr(y),h._state=!1,h._value=y,A=h,In.some(function(C){return C._value===A._value})||In.push(A),Yt(h),w&&Jr())}function Yt(h){var y=h._listeners;h._listeners=[];for(var w=0,A=y.length;w<A;++w)Nn(h,y[w]);var C=h._PSD;--C.ref||C.finalize(),xt===0&&(++xt,Ot(function(){--xt==0&&qt()},[]))}function Nn(h,y){if(h._state!==null){var w=h._state?y.onFulfilled:y.onRejected;if(w===null)return(h._state?y.resolve:y.reject)(h._value);++y.psd.ref,++xt,Ot(pa,[w,h,y])}else h._listeners.push(y)}function pa(h,y,w){try{var A,C=y._value;!y._state&&on.length&&(on=[]),A=Re&&y._consoleTask?y._consoleTask.run(function(){return h(C)}):h(C),y._state||on.indexOf(C)!==-1||function(R){for(var H=In.length;H;)if(In[--H]._value===R._value)return In.splice(H,1)}(y),w.resolve(A)}catch(R){w.reject(R)}finally{--xt==0&&qt(),--w.psd.ref||w.psd.finalize()}}function Er(){As(ln,function(){Xr()&&Jr()})}function Xr(){var h=Qt;return ft=Qt=!1,h}function Jr(){var h,y,w;do for(;0<zr.length;)for(h=zr,zr=[],w=h.length,y=0;y<w;++y){var A=h[y];A[0].apply(null,A[1])}while(0<zr.length);ft=Qt=!0}function qt(){var h=In;In=[],h.forEach(function(A){A._PSD.onunhandled.call(null,A._value,A)});for(var y=gn.slice(0),w=y.length;w;)y[--w]()}function is(h){return new Ge(Fe,!1,h)}function wn(h,y){var w=lt;return function(){var A=Xr(),C=lt;try{return Or(w,!0),h.apply(this,arguments)}catch(R){y&&y(R)}finally{Or(C,!1),A&&Jr()}}}g(Ge.prototype,{then:Hn,_then:function(h,y){Nn(this,new ir(null,null,h,y,lt))},catch:function(h){if(arguments.length===1)return this.then(null,h);var y=h,w=arguments[1];return typeof y=="function"?this.then(null,function(A){return(A instanceof y?w:is)(A)}):this.then(null,function(A){return(A&&A.name===y?w:is)(A)})},finally:function(h){return this.then(function(y){return Ge.resolve(h()).then(function(){return y})},function(y){return Ge.resolve(h()).then(function(){return is(y)})})},timeout:function(h,y){var w=this;return h<1/0?new Ge(function(A,C){var R=setTimeout(function(){return C(new ce.Timeout(y))},h);w.then(A,C).finally(clearTimeout.bind(null,R))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&N(Ge.prototype,Symbol.toStringTag,"Dexie.Promise"),ln.env=Fi(),g(Ge,{all:function(){var h=De.apply(null,arguments).map(bs);return new Ge(function(y,w){h.length===0&&y([]);var A=h.length;h.forEach(function(C,R){return Ge.resolve(C).then(function(H){h[R]=H,--A||y(h)},w)})})},resolve:function(h){return h instanceof Ge?h:h&&typeof h.then=="function"?new Ge(function(y,w){h.then(y,w)}):new Ge(Fe,!0,h)},reject:is,race:function(){var h=De.apply(null,arguments).map(bs);return new Ge(function(y,w){h.map(function(A){return Ge.resolve(A).then(y,w)})})},PSD:{get:function(){return lt},set:function(h){return lt=h}},totalEchoes:{get:function(){return li}},newPSD:Pr,usePSD:As,scheduler:{get:function(){return Ot},set:function(h){Ot=h}},rejectionMapper:{get:function(){return Mr},set:function(h){Mr=h}},follow:function(h,y){return new Ge(function(w,A){return Pr(function(C,R){var H=lt;H.unhandleds=[],H.onunhandled=R,H.finalize=qe(function(){var se,me=this;se=function(){me.unhandleds.length===0?C():R(me.unhandleds[0])},gn.push(function we(){se(),gn.splice(gn.indexOf(we),1)}),++xt,Ot(function(){--xt==0&&qt()},[])},H.finalize),h()},y,w,A)})}}),Lt&&(Lt.allSettled&&N(Ge,"allSettled",function(){var h=De.apply(null,arguments).map(bs);return new Ge(function(y){h.length===0&&y([]);var w=h.length,A=new Array(w);h.forEach(function(C,R){return Ge.resolve(C).then(function(H){return A[R]={status:"fulfilled",value:H}},function(H){return A[R]={status:"rejected",reason:H}}).then(function(){return--w||y(A)})})})}),Lt.any&&typeof AggregateError<"u"&&N(Ge,"any",function(){var h=De.apply(null,arguments).map(bs);return new Ge(function(y,w){h.length===0&&w(new AggregateError([]));var A=h.length,C=new Array(A);h.forEach(function(R,H){return Ge.resolve(R).then(function(se){return y(se)},function(se){C[H]=se,--A||w(new AggregateError(C))})})})}),Lt.withResolvers&&(Ge.withResolvers=Lt.withResolvers));var Sn={awaits:0,echoes:0,id:0},br=0,Yn=[],Wr=0,li=0,ci=0;function Pr(h,y,w,A){var C=lt,R=Object.create(C);return R.parent=C,R.ref=0,R.global=!1,R.id=++ci,ln.env,R.env=an?{Promise:Ge,PromiseProp:{value:Ge,configurable:!0,writable:!0},all:Ge.all,race:Ge.race,allSettled:Ge.allSettled,any:Ge.any,resolve:Ge.resolve,reject:Ge.reject}:{},y&&c(R,y),++C.ref,R.finalize=function(){--this.parent.ref||this.parent.finalize()},A=As(R,h,w,A),R.ref===0&&R.finalize(),A}function $r(){return Sn.id||(Sn.id=++br),++Sn.awaits,Sn.echoes+=et,Sn.id}function Cr(){return!!Sn.awaits&&(--Sn.awaits==0&&(Sn.id=0),Sn.echoes=Sn.awaits*et,!0)}function bs(h){return Sn.echoes&&h&&h.constructor===Lt?($r(),h.then(function(y){return Cr(),y},function(y){return Cr(),Bn(y)})):h}function _s(){var h=Yn[Yn.length-1];Yn.pop(),Or(h,!1)}function Or(h,y){var w,A=lt;(y?!Sn.echoes||Wr++&&h===lt:!Wr||--Wr&&h===lt)||queueMicrotask(y?(function(C){++li,Sn.echoes&&--Sn.echoes!=0||(Sn.echoes=Sn.awaits=Sn.id=0),Yn.push(lt),Or(C,!0)}).bind(null,h):_s),h!==lt&&(lt=h,A===ln&&(ln.env=Fi()),an&&(w=ln.env.Promise,y=h.env,(A.global||h.global)&&(Object.defineProperty(i,"Promise",y.PromiseProp),w.all=y.all,w.race=y.race,w.resolve=y.resolve,w.reject=y.reject,y.allSettled&&(w.allSettled=y.allSettled),y.any&&(w.any=y.any))))}function Fi(){var h=i.Promise;return an?{Promise:h,PromiseProp:Object.getOwnPropertyDescriptor(i,"Promise"),all:h.all,race:h.race,allSettled:h.allSettled,any:h.any,resolve:h.resolve,reject:h.reject}:{}}function As(h,y,w,A,C){var R=lt;try{return Or(h,!0),y(w,A,C)}finally{Or(R,!1)}}function ma(h,y,w,A){return typeof h!="function"?h:function(){var C=lt;w&&$r(),Or(y,!0);try{return h.apply(this,arguments)}finally{Or(C,!1),A&&queueMicrotask(Cr)}}}function Bi(h){Promise===Lt&&Sn.echoes===0?Wr===0?h():enqueueNativeMicroTask(h):setTimeout(h,0)}(""+Br).indexOf("[native code]")===-1&&($r=Cr=Ue);var Bn=Ge.reject,Xs="",Os="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Hl="String expected.",Rs=[],ga="__dbnames",rl="readonly",va="readwrite";function ui(h,y){return h?y?function(){return h.apply(this,arguments)&&y.apply(this,arguments)}:h:y}var sl={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function oo(h){return typeof h!="string"||/\./.test(h)?function(y){return y}:function(y){return y[h]===void 0&&h in y&&delete(y=J(y))[h],y}}function ya(){throw ce.Type()}function pn(h,y){try{var w=nr(h),A=nr(y);if(w!==A)return w==="Array"?1:A==="Array"?-1:w==="binary"?1:A==="binary"?-1:w==="string"?1:A==="string"?-1:w==="Date"?1:A!=="Date"?NaN:-1;switch(w){case"number":case"Date":case"string":return y<h?1:h<y?-1:0;case"binary":return function(C,R){for(var H=C.length,se=R.length,me=H<se?H:se,we=0;we<me;++we)if(C[we]!==R[we])return C[we]<R[we]?-1:1;return H===se?0:H<se?-1:1}(il(h),il(y));case"Array":return function(C,R){for(var H=C.length,se=R.length,me=H<se?H:se,we=0;we<me;++we){var _e=pn(C[we],R[we]);if(_e!==0)return _e}return H===se?0:H<se?-1:1}(h,y)}}catch{}return NaN}function nr(h){var y=typeof h;return y!="object"?y:ArrayBuffer.isView(h)?"binary":(h=Ne(h),h==="ArrayBuffer"?"binary":h)}function il(h){return h instanceof Uint8Array?h:ArrayBuffer.isView(h)?new Uint8Array(h.buffer,h.byteOffset,h.byteLength):new Uint8Array(h)}var al=(Cn.prototype._trans=function(h,y,w){var A=this._tx||lt.trans,C=this.name,R=Re&&typeof console<"u"&&console.createTask&&console.createTask("Dexie: ".concat(h==="readonly"?"read":"write"," ").concat(this.name));function H(we,_e,ie){if(!ie.schema[C])throw new ce.NotFound("Table "+C+" not part of transaction");return y(ie.idbtrans,ie)}var se=Xr();try{var me=A&&A.db._novip===this.db._novip?A===lt.trans?A._promise(h,H,w):Pr(function(){return A._promise(h,H,w)},{trans:A,transless:lt.transless||lt}):function we(_e,ie,Te,pe){if(_e.idbdb&&(_e._state.openComplete||lt.letThrough||_e._vip)){var je=_e._createTransaction(ie,Te,_e._dbSchema);try{je.create(),_e._state.PR1398_maxLoop=3}catch(Ce){return Ce.name===ve.InvalidState&&_e.isOpen()&&0<--_e._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),_e.close({disableAutoOpen:!1}),_e.open().then(function(){return we(_e,ie,Te,pe)})):Bn(Ce)}return je._promise(ie,function(Ce,Se){return Pr(function(){return lt.trans=je,pe(Ce,Se,je)})}).then(function(Ce){if(ie==="readwrite")try{je.idbtrans.commit()}catch{}return ie==="readonly"?Ce:je._completion.then(function(){return Ce})})}if(_e._state.openComplete)return Bn(new ce.DatabaseClosed(_e._state.dbOpenError));if(!_e._state.isBeingOpened){if(!_e._state.autoOpen)return Bn(new ce.DatabaseClosed);_e.open().catch(Ue)}return _e._state.dbReadyPromise.then(function(){return we(_e,ie,Te,pe)})}(this.db,h,[this.name],H);return R&&(me._consoleTask=R,me=me.catch(function(we){return console.trace(we),Bn(we)})),me}finally{se&&Jr()}},Cn.prototype.get=function(h,y){var w=this;return h&&h.constructor===Object?this.where(h).first(y):h==null?Bn(new ce.Type("Invalid argument to Table.get()")):this._trans("readonly",function(A){return w.core.get({trans:A,key:h}).then(function(C){return w.hook.reading.fire(C)})}).then(y)},Cn.prototype.where=function(h){if(typeof h=="string")return new this.db.WhereClause(this,h);if(l(h))return new this.db.WhereClause(this,"[".concat(h.join("+"),"]"));var y=o(h);if(y.length===1)return this.where(y[0]).equals(h[y[0]]);var w=this.schema.indexes.concat(this.schema.primKey).filter(function(se){if(se.compound&&y.every(function(we){return 0<=se.keyPath.indexOf(we)})){for(var me=0;me<y.length;++me)if(y.indexOf(se.keyPath[me])===-1)return!1;return!0}return!1}).sort(function(se,me){return se.keyPath.length-me.keyPath.length})[0];if(w&&this.db._maxKey!==Xs){var R=w.keyPath.slice(0,y.length);return this.where(R).equals(R.map(function(me){return h[me]}))}!w&&Re&&console.warn("The query ".concat(JSON.stringify(h)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(y.join("+"),"]"));var A=this.schema.idxByName;function C(se,me){return pn(se,me)===0}var H=y.reduce(function(ie,me){var we=ie[0],_e=ie[1],ie=A[me],Te=h[me];return[we||ie,we||!ie?ui(_e,ie&&ie.multi?function(pe){return pe=U(pe,me),l(pe)&&pe.some(function(je){return C(Te,je)})}:function(pe){return C(Te,U(pe,me))}):_e]},[null,null]),R=H[0],H=H[1];return R?this.where(R.name).equals(h[R.keyPath]).filter(H):w?this.filter(H):this.where(y).equals("")},Cn.prototype.filter=function(h){return this.toCollection().and(h)},Cn.prototype.count=function(h){return this.toCollection().count(h)},Cn.prototype.offset=function(h){return this.toCollection().offset(h)},Cn.prototype.limit=function(h){return this.toCollection().limit(h)},Cn.prototype.each=function(h){return this.toCollection().each(h)},Cn.prototype.toArray=function(h){return this.toCollection().toArray(h)},Cn.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},Cn.prototype.orderBy=function(h){return new this.db.Collection(new this.db.WhereClause(this,l(h)?"[".concat(h.join("+"),"]"):h))},Cn.prototype.reverse=function(){return this.toCollection().reverse()},Cn.prototype.mapToClass=function(h){var y,w=this.db,A=this.name;function C(){return y!==null&&y.apply(this,arguments)||this}(this.schema.mappedClass=h).prototype instanceof ya&&(function(me,we){if(typeof we!="function"&&we!==null)throw new TypeError("Class extends value "+String(we)+" is not a constructor or null");function _e(){this.constructor=me}n(me,we),me.prototype=we===null?Object.create(we):(_e.prototype=we.prototype,new _e)}(C,y=h),Object.defineProperty(C.prototype,"db",{get:function(){return w},enumerable:!1,configurable:!0}),C.prototype.table=function(){return A},h=C);for(var R=new Set,H=h.prototype;H;H=d(H))Object.getOwnPropertyNames(H).forEach(function(me){return R.add(me)});function se(me){if(!me)return me;var we,_e=Object.create(h.prototype);for(we in me)if(!R.has(we))try{_e[we]=me[we]}catch{}return _e}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=se,this.hook("reading",se),h},Cn.prototype.defineClass=function(){return this.mapToClass(function(h){c(this,h)})},Cn.prototype.add=function(h,y){var w=this,A=this.schema.primKey,C=A.auto,R=A.keyPath,H=h;return R&&C&&(H=oo(R)(h)),this._trans("readwrite",function(se){return w.core.mutate({trans:se,type:"add",keys:y!=null?[y]:null,values:[H]})}).then(function(se){return se.numFailures?Ge.reject(se.failures[0]):se.lastResult}).then(function(se){if(R)try{te(h,R,se)}catch{}return se})},Cn.prototype.update=function(h,y){return typeof h!="object"||l(h)?this.where(":id").equals(h).modify(y):(h=U(h,this.schema.primKey.keyPath),h===void 0?Bn(new ce.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(h).modify(y))},Cn.prototype.put=function(h,y){var w=this,A=this.schema.primKey,C=A.auto,R=A.keyPath,H=h;return R&&C&&(H=oo(R)(h)),this._trans("readwrite",function(se){return w.core.mutate({trans:se,type:"put",values:[H],keys:y!=null?[y]:null})}).then(function(se){return se.numFailures?Ge.reject(se.failures[0]):se.lastResult}).then(function(se){if(R)try{te(h,R,se)}catch{}return se})},Cn.prototype.delete=function(h){var y=this;return this._trans("readwrite",function(w){return y.core.mutate({trans:w,type:"delete",keys:[h]})}).then(function(w){return w.numFailures?Ge.reject(w.failures[0]):void 0})},Cn.prototype.clear=function(){var h=this;return this._trans("readwrite",function(y){return h.core.mutate({trans:y,type:"deleteRange",range:sl})}).then(function(y){return y.numFailures?Ge.reject(y.failures[0]):void 0})},Cn.prototype.bulkGet=function(h){var y=this;return this._trans("readonly",function(w){return y.core.getMany({keys:h,trans:w}).then(function(A){return A.map(function(C){return y.hook.reading.fire(C)})})})},Cn.prototype.bulkAdd=function(h,y,w){var A=this,C=Array.isArray(y)?y:void 0,R=(w=w||(C?void 0:y))?w.allKeys:void 0;return this._trans("readwrite",function(H){var we=A.schema.primKey,se=we.auto,we=we.keyPath;if(we&&C)throw new ce.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(C&&C.length!==h.length)throw new ce.InvalidArgument("Arguments objects and keys must have the same length");var me=h.length,we=we&&se?h.map(oo(we)):h;return A.core.mutate({trans:H,type:"add",keys:C,values:we,wantResults:R}).then(function(je){var ie=je.numFailures,Te=je.results,pe=je.lastResult,je=je.failures;if(ie===0)return R?Te:pe;throw new ue("".concat(A.name,".bulkAdd(): ").concat(ie," of ").concat(me," operations failed"),je)})})},Cn.prototype.bulkPut=function(h,y,w){var A=this,C=Array.isArray(y)?y:void 0,R=(w=w||(C?void 0:y))?w.allKeys:void 0;return this._trans("readwrite",function(H){var we=A.schema.primKey,se=we.auto,we=we.keyPath;if(we&&C)throw new ce.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(C&&C.length!==h.length)throw new ce.InvalidArgument("Arguments objects and keys must have the same length");var me=h.length,we=we&&se?h.map(oo(we)):h;return A.core.mutate({trans:H,type:"put",keys:C,values:we,wantResults:R}).then(function(je){var ie=je.numFailures,Te=je.results,pe=je.lastResult,je=je.failures;if(ie===0)return R?Te:pe;throw new ue("".concat(A.name,".bulkPut(): ").concat(ie," of ").concat(me," operations failed"),je)})})},Cn.prototype.bulkUpdate=function(h){var y=this,w=this.core,A=h.map(function(H){return H.key}),C=h.map(function(H){return H.changes}),R=[];return this._trans("readwrite",function(H){return w.getMany({trans:H,keys:A,cache:"clone"}).then(function(se){var me=[],we=[];h.forEach(function(ie,Te){var pe=ie.key,je=ie.changes,Ce=se[Te];if(Ce){for(var Se=0,Ee=Object.keys(je);Se<Ee.length;Se++){var Be=Ee[Se],Ve=je[Be];if(Be===y.schema.primKey.keyPath){if(pn(Ve,pe)!==0)throw new ce.Constraint("Cannot update primary key in bulkUpdate()")}else te(Ce,Be,Ve)}R.push(Te),me.push(pe),we.push(Ce)}});var _e=me.length;return w.mutate({trans:H,type:"put",keys:me,values:we,updates:{keys:A,changeSpecs:C}}).then(function(ie){var Te=ie.numFailures,pe=ie.failures;if(Te===0)return _e;for(var je=0,Ce=Object.keys(pe);je<Ce.length;je++){var Se,Ee=Ce[je],Be=R[Number(Ee)];Be!=null&&(Se=pe[Ee],delete pe[Ee],pe[Be]=Se)}throw new ue("".concat(y.name,".bulkUpdate(): ").concat(Te," of ").concat(_e," operations failed"),pe)})})})},Cn.prototype.bulkDelete=function(h){var y=this,w=h.length;return this._trans("readwrite",function(A){return y.core.mutate({trans:A,type:"delete",keys:h})}).then(function(H){var C=H.numFailures,R=H.lastResult,H=H.failures;if(C===0)return R;throw new ue("".concat(y.name,".bulkDelete(): ").concat(C," of ").concat(w," operations failed"),H)})},Cn);function Cn(){}function di(h){function y(H,se){if(se){for(var me=arguments.length,we=new Array(me-1);--me;)we[me-1]=arguments[me];return w[H].subscribe.apply(null,we),h}if(typeof H=="string")return w[H]}var w={};y.addEventType=R;for(var A=1,C=arguments.length;A<C;++A)R(arguments[A]);return y;function R(H,se,me){if(typeof H!="object"){var we;se=se||ne;var _e={subscribers:[],fire:me=me||Ue,subscribe:function(ie){_e.subscribers.indexOf(ie)===-1&&(_e.subscribers.push(ie),_e.fire=se(_e.fire,ie))},unsubscribe:function(ie){_e.subscribers=_e.subscribers.filter(function(Te){return Te!==ie}),_e.fire=_e.subscribers.reduce(se,me)}};return w[H]=y[H]=_e}o(we=H).forEach(function(ie){var Te=we[ie];if(l(Te))R(ie,we[ie][0],we[ie][1]);else{if(Te!=="asap")throw new ce.InvalidArgument("Invalid event config");var pe=R(ie,it,function(){for(var je=arguments.length,Ce=new Array(je);je--;)Ce[je]=arguments[je];pe.subscribers.forEach(function(Se){Y(function(){Se.apply(null,Ce)})})})}})}}function xa(h,y){return j(y).from({prototype:h}),y}function Hr(h,y){return!(h.filter||h.algorithm||h.or)&&(y?h.justLimit:!h.replayFilter)}function Vi(h,y){h.filter=ui(h.filter,y)}function Kr(h,y,w){var A=h.replayFilter;h.replayFilter=A?function(){return ui(A(),y())}:y,h.justLimit=w&&!A}function qi(h,y){if(h.isPrimKey)return y.primaryKey;var w=y.getIndexByKeyPath(h.index);if(!w)throw new ce.Schema("KeyPath "+h.index+" on object store "+y.name+" is not indexed");return w}function ol(h,y,w){var A=qi(h,y.schema);return y.openCursor({trans:w,values:!h.keysOnly,reverse:h.dir==="prev",unique:!!h.unique,query:{index:A,range:h.range}})}function lo(h,y,w,A){var C=h.replayFilter?ui(h.filter,h.replayFilter()):h.filter;if(h.or){var R={},H=function(se,me,we){var _e,ie;C&&!C(me,we,function(Te){return me.stop(Te)},function(Te){return me.fail(Te)})||((ie=""+(_e=me.primaryKey))=="[object ArrayBuffer]"&&(ie=""+new Uint8Array(_e)),m(R,ie)||(R[ie]=!0,y(se,me,we)))};return Promise.all([h.or._iterate(H,w),ll(ol(h,A,w),h.algorithm,H,!h.keysOnly&&h.valueMapper)])}return ll(ol(h,A,w),ui(h.algorithm,C),y,!h.keysOnly&&h.valueMapper)}function ll(h,y,w,A){var C=wn(A?function(R,H,se){return w(A(R),H,se)}:w);return h.then(function(R){if(R)return R.start(function(){var H=function(){return R.continue()};y&&!y(R,function(se){return H=se},function(se){R.stop(se),H=Ue},function(se){R.fail(se),H=Ue})||C(R.value,R,function(se){return H=se}),H()})})}var ba=(cl.prototype.execute=function(h){var y=this["@@propmod"];if(y.add!==void 0){var w=y.add;if(l(w))return s(s([],l(h)?h:[],!0),w).sort();if(typeof w=="number")return(Number(h)||0)+w;if(typeof w=="bigint")try{return BigInt(h)+w}catch{return BigInt(0)+w}throw new TypeError("Invalid term ".concat(w))}if(y.remove!==void 0){var A=y.remove;if(l(A))return l(h)?h.filter(function(C){return!A.includes(C)}).sort():[];if(typeof A=="number")return Number(h)-A;if(typeof A=="bigint")try{return BigInt(h)-A}catch{return BigInt(0)-A}throw new TypeError("Invalid subtrahend ".concat(A))}return w=(w=y.replacePrefix)===null||w===void 0?void 0:w[0],w&&typeof h=="string"&&h.startsWith(w)?y.replacePrefix[1]+h.substring(w.length):h},cl);function cl(h){this["@@propmod"]=h}var Xc=(vn.prototype._read=function(h,y){var w=this._ctx;return w.error?w.table._trans(null,Bn.bind(null,w.error)):w.table._trans("readonly",h).then(y)},vn.prototype._write=function(h){var y=this._ctx;return y.error?y.table._trans(null,Bn.bind(null,y.error)):y.table._trans("readwrite",h,"locked")},vn.prototype._addAlgorithm=function(h){var y=this._ctx;y.algorithm=ui(y.algorithm,h)},vn.prototype._iterate=function(h,y){return lo(this._ctx,h,y,this._ctx.table.core)},vn.prototype.clone=function(h){var y=Object.create(this.constructor.prototype),w=Object.create(this._ctx);return h&&c(w,h),y._ctx=w,y},vn.prototype.raw=function(){return this._ctx.valueMapper=null,this},vn.prototype.each=function(h){var y=this._ctx;return this._read(function(w){return lo(y,h,w,y.table.core)})},vn.prototype.count=function(h){var y=this;return this._read(function(w){var A=y._ctx,C=A.table.core;if(Hr(A,!0))return C.count({trans:w,query:{index:qi(A,C.schema),range:A.range}}).then(function(H){return Math.min(H,A.limit)});var R=0;return lo(A,function(){return++R,!1},w,C).then(function(){return R})}).then(h)},vn.prototype.sortBy=function(h,y){var w=h.split(".").reverse(),A=w[0],C=w.length-1;function R(me,we){return we?R(me[w[we]],we-1):me[A]}var H=this._ctx.dir==="next"?1:-1;function se(me,we){return pn(R(me,C),R(we,C))*H}return this.toArray(function(me){return me.sort(se)}).then(y)},vn.prototype.toArray=function(h){var y=this;return this._read(function(w){var A=y._ctx;if(A.dir==="next"&&Hr(A,!0)&&0<A.limit){var C=A.valueMapper,R=qi(A,A.table.core.schema);return A.table.core.query({trans:w,limit:A.limit,values:!0,query:{index:R,range:A.range}}).then(function(se){return se=se.result,C?se.map(C):se})}var H=[];return lo(A,function(se){return H.push(se)},w,A.table.core).then(function(){return H})},h)},vn.prototype.offset=function(h){var y=this._ctx;return h<=0||(y.offset+=h,Hr(y)?Kr(y,function(){var w=h;return function(A,C){return w===0||(w===1?--w:C(function(){A.advance(w),w=0}),!1)}}):Kr(y,function(){var w=h;return function(){return--w<0}})),this},vn.prototype.limit=function(h){return this._ctx.limit=Math.min(this._ctx.limit,h),Kr(this._ctx,function(){var y=h;return function(w,A,C){return--y<=0&&A(C),0<=y}},!0),this},vn.prototype.until=function(h,y){return Vi(this._ctx,function(w,A,C){return!h(w.value)||(A(C),y)}),this},vn.prototype.first=function(h){return this.limit(1).toArray(function(y){return y[0]}).then(h)},vn.prototype.last=function(h){return this.reverse().first(h)},vn.prototype.filter=function(h){var y;return Vi(this._ctx,function(w){return h(w.value)}),(y=this._ctx).isMatch=ui(y.isMatch,h),this},vn.prototype.and=function(h){return this.filter(h)},vn.prototype.or=function(h){return new this.db.WhereClause(this._ctx.table,h,this)},vn.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},vn.prototype.desc=function(){return this.reverse()},vn.prototype.eachKey=function(h){var y=this._ctx;return y.keysOnly=!y.isMatch,this.each(function(w,A){h(A.key,A)})},vn.prototype.eachUniqueKey=function(h){return this._ctx.unique="unique",this.eachKey(h)},vn.prototype.eachPrimaryKey=function(h){var y=this._ctx;return y.keysOnly=!y.isMatch,this.each(function(w,A){h(A.primaryKey,A)})},vn.prototype.keys=function(h){var y=this._ctx;y.keysOnly=!y.isMatch;var w=[];return this.each(function(A,C){w.push(C.key)}).then(function(){return w}).then(h)},vn.prototype.primaryKeys=function(h){var y=this._ctx;if(y.dir==="next"&&Hr(y,!0)&&0<y.limit)return this._read(function(A){var C=qi(y,y.table.core.schema);return y.table.core.query({trans:A,values:!1,limit:y.limit,query:{index:C,range:y.range}})}).then(function(A){return A.result}).then(h);y.keysOnly=!y.isMatch;var w=[];return this.each(function(A,C){w.push(C.primaryKey)}).then(function(){return w}).then(h)},vn.prototype.uniqueKeys=function(h){return this._ctx.unique="unique",this.keys(h)},vn.prototype.firstKey=function(h){return this.limit(1).keys(function(y){return y[0]}).then(h)},vn.prototype.lastKey=function(h){return this.reverse().firstKey(h)},vn.prototype.distinct=function(){var h=this._ctx,h=h.index&&h.table.schema.idxByName[h.index];if(!h||!h.multi)return this;var y={};return Vi(this._ctx,function(C){var A=C.primaryKey.toString(),C=m(y,A);return y[A]=!0,!C}),this},vn.prototype.modify=function(h){var y=this,w=this._ctx;return this._write(function(A){var C,R,H;H=typeof h=="function"?h:(C=o(h),R=C.length,function(Se){for(var Ee=!1,Be=0;Be<R;++Be){var Ve=C[Be],He=h[Ve],rt=U(Se,Ve);He instanceof ba?(te(Se,Ve,He.execute(rt)),Ee=!0):rt!==He&&(te(Se,Ve,He),Ee=!0)}return Ee});var se=w.table.core,ie=se.schema.primaryKey,me=ie.outbound,we=ie.extractKey,_e=200,ie=y.db._options.modifyChunkSize;ie&&(_e=typeof ie=="object"?ie[se.name]||ie["*"]||200:ie);function Te(Se,Ve){var Be=Ve.failures,Ve=Ve.numFailures;je+=Se-Ve;for(var He=0,rt=o(Be);He<rt.length;He++){var ut=rt[He];pe.push(Be[ut])}}var pe=[],je=0,Ce=[];return y.clone().primaryKeys().then(function(Se){function Ee(Ve){var He=Math.min(_e,Se.length-Ve);return se.getMany({trans:A,keys:Se.slice(Ve,Ve+He),cache:"immutable"}).then(function(rt){for(var ut=[],st=[],at=me?[]:null,pt=[],ot=0;ot<He;++ot){var bt=rt[ot],Ct={value:J(bt),primKey:Se[Ve+ot]};H.call(Ct,Ct.value,Ct)!==!1&&(Ct.value==null?pt.push(Se[Ve+ot]):me||pn(we(bt),we(Ct.value))===0?(st.push(Ct.value),me&&at.push(Se[Ve+ot])):(pt.push(Se[Ve+ot]),ut.push(Ct.value)))}return Promise.resolve(0<ut.length&&se.mutate({trans:A,type:"add",values:ut}).then(function(Mt){for(var Ft in Mt.failures)pt.splice(parseInt(Ft),1);Te(ut.length,Mt)})).then(function(){return(0<st.length||Be&&typeof h=="object")&&se.mutate({trans:A,type:"put",keys:at,values:st,criteria:Be,changeSpec:typeof h!="function"&&h,isAdditionalChunk:0<Ve}).then(function(Mt){return Te(st.length,Mt)})}).then(function(){return(0<pt.length||Be&&h===ul)&&se.mutate({trans:A,type:"delete",keys:pt,criteria:Be,isAdditionalChunk:0<Ve}).then(function(Mt){return Te(pt.length,Mt)})}).then(function(){return Se.length>Ve+He&&Ee(Ve+_e)})})}var Be=Hr(w)&&w.limit===1/0&&(typeof h!="function"||h===ul)&&{index:w.index,range:w.range};return Ee(0).then(function(){if(0<pe.length)throw new le("Error modifying one or more objects",pe,je,Ce);return Se.length})})})},vn.prototype.delete=function(){var h=this._ctx,y=h.range;return Hr(h)&&(h.isPrimKey||y.type===3)?this._write(function(w){var A=h.table.core.schema.primaryKey,C=y;return h.table.core.count({trans:w,query:{index:A,range:C}}).then(function(R){return h.table.core.mutate({trans:w,type:"deleteRange",range:C}).then(function(H){var se=H.failures;if(H.lastResult,H.results,H=H.numFailures,H)throw new le("Could not delete some values",Object.keys(se).map(function(me){return se[me]}),R-H);return R-H})})}):this.modify(ul)},vn);function vn(){}var ul=function(h,y){return y.value=null};function Jc(h,y){return h<y?-1:h===y?0:1}function Qc(h,y){return y<h?-1:h===y?0:1}function ar(h,y,w){return h=h instanceof Kl?new h.Collection(h):h,h._ctx.error=new(w||TypeError)(y),h}function Fs(h){return new h.Collection(h,function(){return Rr("")}).limit(0)}function hi(h,y,w,A){var C,R,H,se,me,we,_e,ie=w.length;if(!w.every(function(je){return typeof je=="string"}))return ar(h,Hl);function Te(je){C=je==="next"?function(Se){return Se.toUpperCase()}:function(Se){return Se.toLowerCase()},R=je==="next"?function(Se){return Se.toLowerCase()}:function(Se){return Se.toUpperCase()},H=je==="next"?Jc:Qc;var Ce=w.map(function(Se){return{lower:R(Se),upper:C(Se)}}).sort(function(Se,Ee){return H(Se.lower,Ee.lower)});se=Ce.map(function(Se){return Se.upper}),me=Ce.map(function(Se){return Se.lower}),_e=(we=je)==="next"?"":A}Te("next"),h=new h.Collection(h,function(){return Bs(se[0],me[ie-1]+A)}),h._ondirectionchange=function(je){Te(je)};var pe=0;return h._addAlgorithm(function(je,Ce,Se){var Ee=je.key;if(typeof Ee!="string")return!1;var Be=R(Ee);if(y(Be,me,pe))return!0;for(var Ve=null,He=pe;He<ie;++He){var rt=function(ut,st,at,pt,ot,bt){for(var Ct=Math.min(ut.length,pt.length),Mt=-1,Ft=0;Ft<Ct;++Ft){var kn=st[Ft];if(kn!==pt[Ft])return ot(ut[Ft],at[Ft])<0?ut.substr(0,Ft)+at[Ft]+at.substr(Ft+1):ot(ut[Ft],pt[Ft])<0?ut.substr(0,Ft)+pt[Ft]+at.substr(Ft+1):0<=Mt?ut.substr(0,Mt)+st[Mt]+at.substr(Mt+1):null;ot(ut[Ft],kn)<0&&(Mt=Ft)}return Ct<pt.length&&bt==="next"?ut+at.substr(ut.length):Ct<ut.length&&bt==="prev"?ut.substr(0,at.length):Mt<0?null:ut.substr(0,Mt)+pt[Mt]+at.substr(Mt+1)}(Ee,Be,se[He],me[He],H,we);rt===null&&Ve===null?pe=He+1:(Ve===null||0<H(Ve,rt))&&(Ve=rt)}return Ce(Ve!==null?function(){je.continue(Ve+_e)}:Se),!1}),h}function Bs(h,y,w,A){return{type:2,lower:h,upper:y,lowerOpen:w,upperOpen:A}}function Rr(h){return{type:1,lower:h,upper:h}}var Kl=(Object.defineProperty(or.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),or.prototype.between=function(h,y,w,A){w=w!==!1,A=A===!0;try{return 0<this._cmp(h,y)||this._cmp(h,y)===0&&(w||A)&&(!w||!A)?Fs(this):new this.Collection(this,function(){return Bs(h,y,!w,!A)})}catch{return ar(this,Os)}},or.prototype.equals=function(h){return h==null?ar(this,Os):new this.Collection(this,function(){return Rr(h)})},or.prototype.above=function(h){return h==null?ar(this,Os):new this.Collection(this,function(){return Bs(h,void 0,!0)})},or.prototype.aboveOrEqual=function(h){return h==null?ar(this,Os):new this.Collection(this,function(){return Bs(h,void 0,!1)})},or.prototype.below=function(h){return h==null?ar(this,Os):new this.Collection(this,function(){return Bs(void 0,h,!1,!0)})},or.prototype.belowOrEqual=function(h){return h==null?ar(this,Os):new this.Collection(this,function(){return Bs(void 0,h)})},or.prototype.startsWith=function(h){return typeof h!="string"?ar(this,Hl):this.between(h,h+Xs,!0,!0)},or.prototype.startsWithIgnoreCase=function(h){return h===""?this.startsWith(h):hi(this,function(y,w){return y.indexOf(w[0])===0},[h],Xs)},or.prototype.equalsIgnoreCase=function(h){return hi(this,function(y,w){return y===w[0]},[h],"")},or.prototype.anyOfIgnoreCase=function(){var h=De.apply(xe,arguments);return h.length===0?Fs(this):hi(this,function(y,w){return w.indexOf(y)!==-1},h,"")},or.prototype.startsWithAnyOfIgnoreCase=function(){var h=De.apply(xe,arguments);return h.length===0?Fs(this):hi(this,function(y,w){return w.some(function(A){return y.indexOf(A)===0})},h,Xs)},or.prototype.anyOf=function(){var h=this,y=De.apply(xe,arguments),w=this._cmp;try{y.sort(w)}catch{return ar(this,Os)}if(y.length===0)return Fs(this);var A=new this.Collection(this,function(){return Bs(y[0],y[y.length-1])});A._ondirectionchange=function(R){w=R==="next"?h._ascending:h._descending,y.sort(w)};var C=0;return A._addAlgorithm(function(R,H,se){for(var me=R.key;0<w(me,y[C]);)if(++C===y.length)return H(se),!1;return w(me,y[C])===0||(H(function(){R.continue(y[C])}),!1)}),A},or.prototype.notEqual=function(h){return this.inAnyRange([[-1/0,h],[h,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},or.prototype.noneOf=function(){var h=De.apply(xe,arguments);if(h.length===0)return new this.Collection(this);try{h.sort(this._ascending)}catch{return ar(this,Os)}var y=h.reduce(function(w,A){return w?w.concat([[w[w.length-1][1],A]]):[[-1/0,A]]},null);return y.push([h[h.length-1],this.db._maxKey]),this.inAnyRange(y,{includeLowers:!1,includeUppers:!1})},or.prototype.inAnyRange=function(Ee,y){var w=this,A=this._cmp,C=this._ascending,R=this._descending,H=this._min,se=this._max;if(Ee.length===0)return Fs(this);if(!Ee.every(function(Be){return Be[0]!==void 0&&Be[1]!==void 0&&C(Be[0],Be[1])<=0}))return ar(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",ce.InvalidArgument);var me=!y||y.includeLowers!==!1,we=y&&y.includeUppers===!0,_e,ie=C;function Te(Be,Ve){return ie(Be[0],Ve[0])}try{(_e=Ee.reduce(function(Be,Ve){for(var He=0,rt=Be.length;He<rt;++He){var ut=Be[He];if(A(Ve[0],ut[1])<0&&0<A(Ve[1],ut[0])){ut[0]=H(ut[0],Ve[0]),ut[1]=se(ut[1],Ve[1]);break}}return He===rt&&Be.push(Ve),Be},[])).sort(Te)}catch{return ar(this,Os)}var pe=0,je=we?function(Be){return 0<C(Be,_e[pe][1])}:function(Be){return 0<=C(Be,_e[pe][1])},Ce=me?function(Be){return 0<R(Be,_e[pe][0])}:function(Be){return 0<=R(Be,_e[pe][0])},Se=je,Ee=new this.Collection(this,function(){return Bs(_e[0][0],_e[_e.length-1][1],!me,!we)});return Ee._ondirectionchange=function(Be){ie=Be==="next"?(Se=je,C):(Se=Ce,R),_e.sort(Te)},Ee._addAlgorithm(function(Be,Ve,He){for(var rt,ut=Be.key;Se(ut);)if(++pe===_e.length)return Ve(He),!1;return!je(rt=ut)&&!Ce(rt)||(w._cmp(ut,_e[pe][1])===0||w._cmp(ut,_e[pe][0])===0||Ve(function(){ie===C?Be.continue(_e[pe][0]):Be.continue(_e[pe][1])}),!1)}),Ee},or.prototype.startsWithAnyOf=function(){var h=De.apply(xe,arguments);return h.every(function(y){return typeof y=="string"})?h.length===0?Fs(this):this.inAnyRange(h.map(function(y){return[y,y+Xs]})):ar(this,"startsWithAnyOf() only works with strings")},or);function or(){}function Vt(h){return wn(function(y){return wa(y),h(y.target.error),!1})}function wa(h){h.stopPropagation&&h.stopPropagation(),h.preventDefault&&h.preventDefault()}var Na="storagemutated",Ps="x-storagemutated-1",Vs=di(null,Na),Gl=(Qr.prototype._lock=function(){return $(!lt.global),++this._reculock,this._reculock!==1||lt.global||(lt.lockOwnerFor=this),this},Qr.prototype._unlock=function(){if($(!lt.global),--this._reculock==0)for(lt.global||(lt.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var h=this._blockedFuncs.shift();try{As(h[1],h[0])}catch{}}return this},Qr.prototype._locked=function(){return this._reculock&<.lockOwnerFor!==this},Qr.prototype.create=function(h){var y=this;if(!this.mode)return this;var w=this.db.idbdb,A=this.db._state.dbOpenError;if($(!this.idbtrans),!h&&!w)switch(A&&A.name){case"DatabaseClosedError":throw new ce.DatabaseClosed(A);case"MissingAPIError":throw new ce.MissingAPI(A.message,A);default:throw new ce.OpenFailed(A)}if(!this.active)throw new ce.TransactionInactive;return $(this._completion._state===null),(h=this.idbtrans=h||(this.db.core||w).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=wn(function(C){wa(C),y._reject(h.error)}),h.onabort=wn(function(C){wa(C),y.active&&y._reject(new ce.Abort(h.error)),y.active=!1,y.on("abort").fire(C)}),h.oncomplete=wn(function(){y.active=!1,y._resolve(),"mutatedParts"in h&&Vs.storagemutated.fire(h.mutatedParts)}),this},Qr.prototype._promise=function(h,y,w){var A=this;if(h==="readwrite"&&this.mode!=="readwrite")return Bn(new ce.ReadOnly("Transaction is readonly"));if(!this.active)return Bn(new ce.TransactionInactive);if(this._locked())return new Ge(function(R,H){A._blockedFuncs.push([function(){A._promise(h,y,w).then(R,H)},lt])});if(w)return Pr(function(){var R=new Ge(function(H,se){A._lock();var me=y(H,se,A);me&&me.then&&me.then(H,se)});return R.finally(function(){return A._unlock()}),R._lib=!0,R});var C=new Ge(function(R,H){var se=y(R,H,A);se&&se.then&&se.then(R,H)});return C._lib=!0,C},Qr.prototype._root=function(){return this.parent?this.parent._root():this},Qr.prototype.waitFor=function(h){var y,w=this._root(),A=Ge.resolve(h);w._waitingFor?w._waitingFor=w._waitingFor.then(function(){return A}):(w._waitingFor=A,w._waitingQueue=[],y=w.idbtrans.objectStore(w.storeNames[0]),function R(){for(++w._spinCount;w._waitingQueue.length;)w._waitingQueue.shift()();w._waitingFor&&(y.get(-1/0).onsuccess=R)}());var C=w._waitingFor;return new Ge(function(R,H){A.then(function(se){return w._waitingQueue.push(wn(R.bind(null,se)))},function(se){return w._waitingQueue.push(wn(H.bind(null,se)))}).finally(function(){w._waitingFor===C&&(w._waitingFor=null)})})},Qr.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new ce.Abort))},Qr.prototype.table=function(h){var y=this._memoizedTables||(this._memoizedTables={});if(m(y,h))return y[h];var w=this.schema[h];if(!w)throw new ce.NotFound("Table "+h+" not part of transaction");return w=new this.db.Table(h,w,this),w.core=this.db.core.table(h),y[h]=w},Qr);function Qr(){}function ja(h,y,w,A,C,R,H){return{name:h,keyPath:y,unique:w,multi:A,auto:C,compound:R,src:(w&&!H?"&":"")+(A?"*":"")+(C?"++":"")+Yl(y)}}function Yl(h){return typeof h=="string"?h:h?"["+[].join.call(h,"+")+"]":""}function dl(h,y,w){return{name:h,primKey:y,indexes:w,mappedClass:null,idxByName:(A=function(C){return[C.name,C]},w.reduce(function(C,R,H){return H=A(R,H),H&&(C[H[0]]=H[1]),C},{}))};var A}var Sa=function(h){try{return h.only([[]]),Sa=function(){return[[]]},[[]]}catch{return Sa=function(){return Xs},Xs}};function ka(h){return h==null?function(){}:typeof h=="string"?(y=h).split(".").length===1?function(w){return w[y]}:function(w){return U(w,y)}:function(w){return U(w,h)};var y}function Ui(h){return[].slice.call(h)}var zi=0;function _a(h){return h==null?":id":typeof h=="string"?h:"[".concat(h.join("+"),"]")}function Aa(h,y,me){function A(Se){if(Se.type===3)return null;if(Se.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var pe=Se.lower,je=Se.upper,Ce=Se.lowerOpen,Se=Se.upperOpen;return pe===void 0?je===void 0?null:y.upperBound(je,!!Se):je===void 0?y.lowerBound(pe,!!Ce):y.bound(pe,je,!!Ce,!!Se)}function C(Te){var pe,je=Te.name;return{name:je,schema:Te,mutate:function(Ce){var Se=Ce.trans,Ee=Ce.type,Be=Ce.keys,Ve=Ce.values,He=Ce.range;return new Promise(function(rt,ut){rt=wn(rt);var st=Se.objectStore(je),at=st.keyPath==null,pt=Ee==="put"||Ee==="add";if(!pt&&Ee!=="delete"&&Ee!=="deleteRange")throw new Error("Invalid operation type: "+Ee);var ot,bt=(Be||Ve||{length:1}).length;if(Be&&Ve&&Be.length!==Ve.length)throw new Error("Given keys array must have same length as given values array.");if(bt===0)return rt({numFailures:0,failures:{},results:[],lastResult:void 0});function Ct(Vr){++kn,wa(Vr)}var Mt=[],Ft=[],kn=0;if(Ee==="deleteRange"){if(He.type===4)return rt({numFailures:kn,failures:Ft,results:[],lastResult:void 0});He.type===3?Mt.push(ot=st.clear()):Mt.push(ot=st.delete(A(He)))}else{var at=pt?at?[Ve,Be]:[Ve,null]:[Be,null],Ut=at[0],mr=at[1];if(pt)for(var lr=0;lr<bt;++lr)Mt.push(ot=mr&&mr[lr]!==void 0?st[Ee](Ut[lr],mr[lr]):st[Ee](Ut[lr])),ot.onerror=Ct;else for(lr=0;lr<bt;++lr)Mt.push(ot=st[Ee](Ut[lr])),ot.onerror=Ct}function Ea(Vr){Vr=Vr.target.result,Mt.forEach(function(ei,ts){return ei.error!=null&&(Ft[ts]=ei.error)}),rt({numFailures:kn,failures:Ft,results:Ee==="delete"?Be:Mt.map(function(ei){return ei.result}),lastResult:Vr})}ot.onerror=function(Vr){Ct(Vr),Ea(Vr)},ot.onsuccess=Ea})},getMany:function(Ce){var Se=Ce.trans,Ee=Ce.keys;return new Promise(function(Be,Ve){Be=wn(Be);for(var He,rt=Se.objectStore(je),ut=Ee.length,st=new Array(ut),at=0,pt=0,ot=function(Mt){Mt=Mt.target,st[Mt._pos]=Mt.result,++pt===at&&Be(st)},bt=Vt(Ve),Ct=0;Ct<ut;++Ct)Ee[Ct]!=null&&((He=rt.get(Ee[Ct]))._pos=Ct,He.onsuccess=ot,He.onerror=bt,++at);at===0&&Be(st)})},get:function(Ce){var Se=Ce.trans,Ee=Ce.key;return new Promise(function(Be,Ve){Be=wn(Be);var He=Se.objectStore(je).get(Ee);He.onsuccess=function(rt){return Be(rt.target.result)},He.onerror=Vt(Ve)})},query:(pe=we,function(Ce){return new Promise(function(Se,Ee){Se=wn(Se);var Be,Ve,He,at=Ce.trans,rt=Ce.values,ut=Ce.limit,ot=Ce.query,st=ut===1/0?void 0:ut,pt=ot.index,ot=ot.range,at=at.objectStore(je),pt=pt.isPrimaryKey?at:at.index(pt.name),ot=A(ot);if(ut===0)return Se({result:[]});pe?((st=rt?pt.getAll(ot,st):pt.getAllKeys(ot,st)).onsuccess=function(bt){return Se({result:bt.target.result})},st.onerror=Vt(Ee)):(Be=0,Ve=!rt&&"openKeyCursor"in pt?pt.openKeyCursor(ot):pt.openCursor(ot),He=[],Ve.onsuccess=function(bt){var Ct=Ve.result;return Ct?(He.push(rt?Ct.value:Ct.primaryKey),++Be===ut?Se({result:He}):void Ct.continue()):Se({result:He})},Ve.onerror=Vt(Ee))})}),openCursor:function(Ce){var Se=Ce.trans,Ee=Ce.values,Be=Ce.query,Ve=Ce.reverse,He=Ce.unique;return new Promise(function(rt,ut){rt=wn(rt);var pt=Be.index,st=Be.range,at=Se.objectStore(je),at=pt.isPrimaryKey?at:at.index(pt.name),pt=Ve?He?"prevunique":"prev":He?"nextunique":"next",ot=!Ee&&"openKeyCursor"in at?at.openKeyCursor(A(st),pt):at.openCursor(A(st),pt);ot.onerror=Vt(ut),ot.onsuccess=wn(function(bt){var Ct,Mt,Ft,kn,Ut=ot.result;Ut?(Ut.___id=++zi,Ut.done=!1,Ct=Ut.continue.bind(Ut),Mt=(Mt=Ut.continuePrimaryKey)&&Mt.bind(Ut),Ft=Ut.advance.bind(Ut),kn=function(){throw new Error("Cursor not stopped")},Ut.trans=Se,Ut.stop=Ut.continue=Ut.continuePrimaryKey=Ut.advance=function(){throw new Error("Cursor not started")},Ut.fail=wn(ut),Ut.next=function(){var mr=this,lr=1;return this.start(function(){return lr--?mr.continue():mr.stop()}).then(function(){return mr})},Ut.start=function(mr){function lr(){if(ot.result)try{mr()}catch(Vr){Ut.fail(Vr)}else Ut.done=!0,Ut.start=function(){throw new Error("Cursor behind last entry")},Ut.stop()}var Ea=new Promise(function(Vr,ei){Vr=wn(Vr),ot.onerror=Vt(ei),Ut.fail=ei,Ut.stop=function(ts){Ut.stop=Ut.continue=Ut.continuePrimaryKey=Ut.advance=kn,Vr(ts)}});return ot.onsuccess=wn(function(Vr){ot.onsuccess=lr,lr()}),Ut.continue=Ct,Ut.continuePrimaryKey=Mt,Ut.advance=Ft,lr(),Ea},rt(Ut)):rt(null)},ut)})},count:function(Ce){var Se=Ce.query,Ee=Ce.trans,Be=Se.index,Ve=Se.range;return new Promise(function(He,rt){var ut=Ee.objectStore(je),st=Be.isPrimaryKey?ut:ut.index(Be.name),ut=A(Ve),st=ut?st.count(ut):st.count();st.onsuccess=wn(function(at){return He(at.target.result)}),st.onerror=Vt(rt)})}}}var R,H,se,_e=(H=me,se=Ui((R=h).objectStoreNames),{schema:{name:R.name,tables:se.map(function(Te){return H.objectStore(Te)}).map(function(Te){var pe=Te.keyPath,Se=Te.autoIncrement,je=l(pe),Ce={},Se={name:Te.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:pe==null,compound:je,keyPath:pe,autoIncrement:Se,unique:!0,extractKey:ka(pe)},indexes:Ui(Te.indexNames).map(function(Ee){return Te.index(Ee)}).map(function(He){var Be=He.name,Ve=He.unique,rt=He.multiEntry,He=He.keyPath,rt={name:Be,compound:l(He),keyPath:He,unique:Ve,multiEntry:rt,extractKey:ka(He)};return Ce[_a(He)]=rt}),getIndexByKeyPath:function(Ee){return Ce[_a(Ee)]}};return Ce[":id"]=Se.primaryKey,pe!=null&&(Ce[_a(pe)]=Se.primaryKey),Se})},hasGetAll:0<se.length&&"getAll"in H.objectStore(se[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),me=_e.schema,we=_e.hasGetAll,_e=me.tables.map(C),ie={};return _e.forEach(function(Te){return ie[Te.name]=Te}),{stack:"dbcore",transaction:h.transaction.bind(h),table:function(Te){if(!ie[Te])throw new Error("Table '".concat(Te,"' not found"));return ie[Te]},MIN_KEY:-1/0,MAX_KEY:Sa(y),schema:me}}function hl(h,y,w,A){var C=w.IDBKeyRange;return w.indexedDB,{dbcore:(A=Aa(y,C,A),h.dbcore.reduce(function(R,H){return H=H.create,r(r({},R),H(R))},A))}}function fi(h,A){var w=A.db,A=hl(h._middlewares,w,h._deps,A);h.core=A.dbcore,h.tables.forEach(function(C){var R=C.name;h.core.schema.tables.some(function(H){return H.name===R})&&(C.core=h.core.table(R),h[R]instanceof h.Table&&(h[R].core=C.core))})}function Pa(h,y,w,A){w.forEach(function(C){var R=A[C];y.forEach(function(H){var se=function me(we,_e){return P(we,_e)||(we=d(we))&&me(we,_e)}(H,C);(!se||"value"in se&&se.value===void 0)&&(H===h.Transaction.prototype||H instanceof h.Transaction?N(H,C,{get:function(){return this.table(C)},set:function(me){v(this,C,{value:me,writable:!0,configurable:!0,enumerable:!0})}}):H[C]=new h.Table(C,R))})})}function co(h,y){y.forEach(function(w){for(var A in w)w[A]instanceof h.Table&&delete w[A]})}function Zl(h,y){return h._cfg.version-y._cfg.version}function Xl(h,y,w,A){var C=h._dbSchema;w.objectStoreNames.contains("$meta")&&!C.$meta&&(C.$meta=dl("$meta",Jl("")[0],[]),h._storeNames.push("$meta"));var R=h._createTransaction("readwrite",h._storeNames,C);R.create(w),R._completion.catch(A);var H=R._reject.bind(R),se=lt.transless||lt;Pr(function(){return lt.trans=R,lt.transless=se,y!==0?(fi(h,w),we=y,((me=R).storeNames.includes("$meta")?me.table("$meta").get("version").then(function(_e){return _e??we}):Ge.resolve(we)).then(function(_e){return Te=_e,pe=R,je=w,Ce=[],_e=(ie=h)._versions,Se=ie._dbSchema=Wi(0,ie.idbdb,je),(_e=_e.filter(function(Ee){return Ee._cfg.version>=Te})).length!==0?(_e.forEach(function(Ee){Ce.push(function(){var Be=Se,Ve=Ee._cfg.dbschema;Qs(ie,Be,je),Qs(ie,Ve,je),Se=ie._dbSchema=Ve;var He=qs(Be,Ve);He.add.forEach(function(pt){fl(je,pt[0],pt[1].primKey,pt[1].indexes)}),He.change.forEach(function(pt){if(pt.recreate)throw new ce.Upgrade("Not yet support for changing primary key");var ot=je.objectStore(pt.name);pt.add.forEach(function(bt){return as(ot,bt)}),pt.change.forEach(function(bt){ot.deleteIndex(bt.name),as(ot,bt)}),pt.del.forEach(function(bt){return ot.deleteIndex(bt)})});var rt=Ee._cfg.contentUpgrade;if(rt&&Ee._cfg.version>Te){fi(ie,je),pe._memoizedTables={};var ut=W(Ve);He.del.forEach(function(pt){ut[pt]=Be[pt]}),co(ie,[ie.Transaction.prototype]),Pa(ie,[ie.Transaction.prototype],o(ut),ut),pe.schema=ut;var st,at=$e(rt);return at&&$r(),He=Ge.follow(function(){var pt;(st=rt(pe))&&at&&(pt=Cr.bind(null,null),st.then(pt,pt))}),st&&typeof st.then=="function"?Ge.resolve(st):He.then(function(){return st})}}),Ce.push(function(Be){var Ve,He,rt=Ee._cfg.dbschema;Ve=rt,He=Be,[].slice.call(He.db.objectStoreNames).forEach(function(ut){return Ve[ut]==null&&He.db.deleteObjectStore(ut)}),co(ie,[ie.Transaction.prototype]),Pa(ie,[ie.Transaction.prototype],ie._storeNames,ie._dbSchema),pe.schema=ie._dbSchema}),Ce.push(function(Be){ie.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(ie.idbdb.version/10)===Ee._cfg.version?(ie.idbdb.deleteObjectStore("$meta"),delete ie._dbSchema.$meta,ie._storeNames=ie._storeNames.filter(function(Ve){return Ve!=="$meta"})):Be.objectStore("$meta").put(Ee._cfg.version,"version"))})}),function Ee(){return Ce.length?Ge.resolve(Ce.shift()(pe.idbtrans)).then(Ee):Ge.resolve()}().then(function(){pi(Se,je)})):Ge.resolve();var ie,Te,pe,je,Ce,Se}).catch(H)):(o(C).forEach(function(_e){fl(w,_e,C[_e].primKey,C[_e].indexes)}),fi(h,w),void Ge.follow(function(){return h.on.populate.fire(R)}).catch(H));var me,we})}function Js(h,y){pi(h._dbSchema,y),y.db.version%10!=0||y.objectStoreNames.contains("$meta")||y.db.createObjectStore("$meta").add(Math.ceil(y.db.version/10-1),"version");var w=Wi(0,h.idbdb,y);Qs(h,h._dbSchema,y);for(var A=0,C=qs(w,h._dbSchema).change;A<C.length;A++){var R=function(H){if(H.change.length||H.recreate)return console.warn("Unable to patch indexes of table ".concat(H.name," because it has changes on the type of index or primary key.")),{value:void 0};var se=y.objectStore(H.name);H.add.forEach(function(me){Re&&console.debug("Dexie upgrade patch: Creating missing index ".concat(H.name,".").concat(me.src)),as(se,me)})}(C[A]);if(typeof R=="object")return R.value}}function qs(h,y){var w,A={del:[],add:[],change:[]};for(w in h)y[w]||A.del.push(w);for(w in y){var C=h[w],R=y[w];if(C){var H={name:w,def:R,recreate:!1,del:[],add:[],change:[]};if(""+(C.primKey.keyPath||"")!=""+(R.primKey.keyPath||"")||C.primKey.auto!==R.primKey.auto)H.recreate=!0,A.change.push(H);else{var se=C.idxByName,me=R.idxByName,we=void 0;for(we in se)me[we]||H.del.push(we);for(we in me){var _e=se[we],ie=me[we];_e?_e.src!==ie.src&&H.change.push(ie):H.add.push(ie)}(0<H.del.length||0<H.add.length||0<H.change.length)&&A.change.push(H)}}else A.add.push([w,R])}return A}function fl(h,y,w,A){var C=h.db.createObjectStore(y,w.keyPath?{keyPath:w.keyPath,autoIncrement:w.auto}:{autoIncrement:w.auto});return A.forEach(function(R){return as(C,R)}),C}function pi(h,y){o(h).forEach(function(w){y.db.objectStoreNames.contains(w)||(Re&&console.debug("Dexie: Creating missing table",w),fl(y,w,h[w].primKey,h[w].indexes))})}function as(h,y){h.createIndex(y.name,y.keyPath,{unique:y.unique,multiEntry:y.multi})}function Wi(h,y,w){var A={};return _(y.objectStoreNames,0).forEach(function(C){for(var R=w.objectStore(C),H=ja(Yl(we=R.keyPath),we||"",!0,!1,!!R.autoIncrement,we&&typeof we!="string",!0),se=[],me=0;me<R.indexNames.length;++me){var _e=R.index(R.indexNames[me]),we=_e.keyPath,_e=ja(_e.name,we,!!_e.unique,!!_e.multiEntry,!1,we&&typeof we!="string",!1);se.push(_e)}A[C]=dl(C,H,se)}),A}function Qs(h,y,w){for(var A=w.db.objectStoreNames,C=0;C<A.length;++C){var R=A[C],H=w.objectStore(R);h._hasGetAll="getAll"in H;for(var se=0;se<H.indexNames.length;++se){var me=H.indexNames[se],we=H.index(me).keyPath,_e=typeof we=="string"?we:"["+_(we).join("+")+"]";!y[R]||(we=y[R].idxByName[_e])&&(we.name=me,delete y[R].idxByName[_e],y[R].idxByName[me]=we)}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&i.WorkerGlobalScope&&i instanceof i.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(h._hasGetAll=!1)}function Jl(h){return h.split(",").map(function(y,w){var A=(y=y.trim()).replace(/([&*]|\+\+)/g,""),C=/^\[/.test(A)?A.match(/^\[(.*)\]$/)[1].split("+"):A;return ja(A,C||null,/\&/.test(y),/\*/.test(y),/\+\+/.test(y),l(C),w===0)})}var uo=(ho.prototype._parseStoresSpec=function(h,y){o(h).forEach(function(w){if(h[w]!==null){var A=Jl(h[w]),C=A.shift();if(C.unique=!0,C.multi)throw new ce.Schema("Primary key cannot be multi-valued");A.forEach(function(R){if(R.auto)throw new ce.Schema("Only primary key can be marked as autoIncrement (++)");if(!R.keyPath)throw new ce.Schema("Index must have a name and cannot be an empty string")}),y[w]=dl(w,C,A)}})},ho.prototype.stores=function(w){var y=this.db;this._cfg.storesSource=this._cfg.storesSource?c(this._cfg.storesSource,w):w;var w=y._versions,A={},C={};return w.forEach(function(R){c(A,R._cfg.storesSource),C=R._cfg.dbschema={},R._parseStoresSpec(A,C)}),y._dbSchema=C,co(y,[y._allTables,y,y.Transaction.prototype]),Pa(y,[y._allTables,y,y.Transaction.prototype,this._cfg.tables],o(C),C),y._storeNames=o(C),this},ho.prototype.upgrade=function(h){return this._cfg.contentUpgrade=fe(this._cfg.contentUpgrade||Ue,h),this},ho);function ho(){}function Ca(h,y){var w=h._dbNamesDB;return w||(w=h._dbNamesDB=new ls(ga,{addons:[],indexedDB:h,IDBKeyRange:y})).version(1).stores({dbnames:"name"}),w.table("dbnames")}function Ta(h){return h&&typeof h.databases=="function"}function fo(h){return Pr(function(){return lt.letThrough=!0,h()})}function $i(h){return!("from"in h)}var fr=function(h,y){if(!this){var w=new fr;return h&&"d"in h&&c(w,h),w}c(this,arguments.length?{d:1,from:h,to:1<arguments.length?y:h}:{d:0})};function mi(h,y,w){var A=pn(y,w);if(!isNaN(A)){if(0<A)throw RangeError();if($i(h))return c(h,{from:y,to:w,d:1});var C=h.l,A=h.r;if(pn(w,h.from)<0)return C?mi(C,y,w):h.l={from:y,to:w,d:1,l:null,r:null},Ki(h);if(0<pn(y,h.to))return A?mi(A,y,w):h.r={from:y,to:w,d:1,l:null,r:null},Ki(h);pn(y,h.from)<0&&(h.from=y,h.l=null,h.d=A?A.d+1:1),0<pn(w,h.to)&&(h.to=w,h.r=null,h.d=h.l?h.l.d+1:1),w=!h.r,C&&!h.l&&Hi(h,C),A&&w&&Hi(h,A)}}function Hi(h,y){$i(y)||function w(A,me){var R=me.from,H=me.to,se=me.l,me=me.r;mi(A,R,H),se&&w(A,se),me&&w(A,me)}(h,y)}function Ql(h,y){var w=gi(y),A=w.next();if(A.done)return!1;for(var C=A.value,R=gi(h),H=R.next(C.from),se=H.value;!A.done&&!H.done;){if(pn(se.from,C.to)<=0&&0<=pn(se.to,C.from))return!0;pn(C.from,se.from)<0?C=(A=w.next(se.from)).value:se=(H=R.next(C.from)).value}return!1}function gi(h){var y=$i(h)?null:{s:0,n:h};return{next:function(w){for(var A=0<arguments.length;y;)switch(y.s){case 0:if(y.s=1,A)for(;y.n.l&&pn(w,y.n.from)<0;)y={up:y,n:y.n.l,s:1};else for(;y.n.l;)y={up:y,n:y.n.l,s:1};case 1:if(y.s=2,!A||pn(w,y.n.to)<=0)return{value:y.n,done:!1};case 2:if(y.n.r){y.s=3,y={up:y,n:y.n.r,s:0};continue}case 3:y=y.up}return{done:!0}}}}function Ki(h){var y,w,A=(((y=h.r)===null||y===void 0?void 0:y.d)||0)-(((w=h.l)===null||w===void 0?void 0:w.d)||0),C=1<A?"r":A<-1?"l":"";C&&(y=C=="r"?"l":"r",w=r({},h),A=h[C],h.from=A.from,h.to=A.to,h[C]=A[C],w[C]=A[y],(h[y]=w).d=po(w)),h.d=po(h)}function po(w){var y=w.r,w=w.l;return(y?w?Math.max(y.d,w.d):y.d:w?w.d:0)+1}function Us(h,y){return o(y).forEach(function(w){h[w]?Hi(h[w],y[w]):h[w]=function A(C){var R,H,se={};for(R in C)m(C,R)&&(H=C[R],se[R]=!H||typeof H!="object"||B.has(H.constructor)?H:A(H));return se}(y[w])}),h}function La(h,y){return h.all||y.all||Object.keys(h).some(function(w){return y[w]&&Ql(y[w],h[w])})}g(fr.prototype,((Br={add:function(h){return Hi(this,h),this},addKey:function(h){return mi(this,h,h),this},addKeys:function(h){var y=this;return h.forEach(function(w){return mi(y,w,w)}),this},hasKey:function(h){var y=gi(this).next(h).value;return y&&pn(y.from,h)<=0&&0<=pn(y.to,h)}})[he]=function(){return gi(this)},Br));var x={},L={},Q=!1;function de(h){Us(L,h),Q||(Q=!0,setTimeout(function(){Q=!1,Le(L,!(L={}))},0))}function Le(h,y){y===void 0&&(y=!1);var w=new Set;if(h.all)for(var A=0,C=Object.values(x);A<C.length;A++)We(H=C[A],h,w,y);else for(var R in h){var H,se=/^idb\:\/\/(.*)\/(.*)\//.exec(R);se&&(R=se[1],se=se[2],(H=x["idb://".concat(R,"/").concat(se)])&&We(H,h,w,y))}w.forEach(function(me){return me()})}function We(h,y,w,A){for(var C=[],R=0,H=Object.entries(h.queries.query);R<H.length;R++){for(var se=H[R],me=se[0],we=[],_e=0,ie=se[1];_e<ie.length;_e++){var Te=ie[_e];La(y,Te.obsSet)?Te.subscribers.forEach(function(Se){return w.add(Se)}):A&&we.push(Te)}A&&C.push([me,we])}if(A)for(var pe=0,je=C;pe<je.length;pe++){var Ce=je[pe],me=Ce[0],we=Ce[1];h.queries.query[me]=we}}function tt(h){var y=h._state,w=h._deps.indexedDB;if(y.isBeingOpened||h.idbdb)return y.dbReadyPromise.then(function(){return y.dbOpenError?Bn(y.dbOpenError):h});y.isBeingOpened=!0,y.dbOpenError=null,y.openComplete=!1;var A=y.openCanceller,C=Math.round(10*h.verno),R=!1;function H(){if(y.openCanceller!==A)throw new ce.DatabaseClosed("db.open() was cancelled")}function se(){return new Ge(function(Te,pe){if(H(),!w)throw new ce.MissingAPI;var je=h.name,Ce=y.autoSchema||!C?w.open(je):w.open(je,C);if(!Ce)throw new ce.MissingAPI;Ce.onerror=Vt(pe),Ce.onblocked=wn(h._fireOnBlocked),Ce.onupgradeneeded=wn(function(Se){var Ee;_e=Ce.transaction,y.autoSchema&&!h._options.allowEmptyDB?(Ce.onerror=wa,_e.abort(),Ce.result.close(),(Ee=w.deleteDatabase(je)).onsuccess=Ee.onerror=wn(function(){pe(new ce.NoSuchDatabase("Database ".concat(je," doesnt exist")))})):(_e.onerror=Vt(pe),Se=Se.oldVersion>Math.pow(2,62)?0:Se.oldVersion,ie=Se<1,h.idbdb=Ce.result,R&&Js(h,_e),Xl(h,Se/10,_e,pe))},pe),Ce.onsuccess=wn(function(){_e=null;var Se,Ee,Be,Ve,He,rt=h.idbdb=Ce.result,ut=_(rt.objectStoreNames);if(0<ut.length)try{var st=rt.transaction((Ve=ut).length===1?Ve[0]:Ve,"readonly");if(y.autoSchema)Ee=rt,Be=st,(Se=h).verno=Ee.version/10,Be=Se._dbSchema=Wi(0,Ee,Be),Se._storeNames=_(Ee.objectStoreNames,0),Pa(Se,[Se._allTables],o(Be),Be);else if(Qs(h,h._dbSchema,st),((He=qs(Wi(0,(He=h).idbdb,st),He._dbSchema)).add.length||He.change.some(function(at){return at.add.length||at.change.length}))&&!R)return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),rt.close(),C=rt.version+1,R=!0,Te(se());fi(h,st)}catch{}Rs.push(h),rt.onversionchange=wn(function(at){y.vcFired=!0,h.on("versionchange").fire(at)}),rt.onclose=wn(function(at){h.on("close").fire(at)}),ie&&(He=h._deps,st=je,rt=He.indexedDB,He=He.IDBKeyRange,Ta(rt)||st===ga||Ca(rt,He).put({name:st}).catch(Ue)),Te()},pe)}).catch(function(Te){switch(Te==null?void 0:Te.name){case"UnknownError":if(0<y.PR1398_maxLoop)return y.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),se();break;case"VersionError":if(0<C)return C=0,se()}return Ge.reject(Te)})}var me,we=y.dbReadyResolve,_e=null,ie=!1;return Ge.race([A,(typeof navigator>"u"?Ge.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(Te){function pe(){return indexedDB.databases().finally(Te)}me=setInterval(pe,100),pe()}).finally(function(){return clearInterval(me)}):Promise.resolve()).then(se)]).then(function(){return H(),y.onReadyBeingFired=[],Ge.resolve(fo(function(){return h.on.ready.fire(h.vip)})).then(function Te(){if(0<y.onReadyBeingFired.length){var pe=y.onReadyBeingFired.reduce(fe,Ue);return y.onReadyBeingFired=[],Ge.resolve(fo(function(){return pe(h.vip)})).then(Te)}})}).finally(function(){y.openCanceller===A&&(y.onReadyBeingFired=null,y.isBeingOpened=!1)}).catch(function(Te){y.dbOpenError=Te;try{_e&&_e.abort()}catch{}return A===y.openCanceller&&h._close(),Bn(Te)}).finally(function(){y.openComplete=!0,we()}).then(function(){var Te;return ie&&(Te={},h.tables.forEach(function(pe){pe.schema.indexes.forEach(function(je){je.name&&(Te["idb://".concat(h.name,"/").concat(pe.name,"/").concat(je.name)]=new fr(-1/0,[[[]]]))}),Te["idb://".concat(h.name,"/").concat(pe.name,"/")]=Te["idb://".concat(h.name,"/").concat(pe.name,"/:dels")]=new fr(-1/0,[[[]]])}),Vs(Na).fire(Te),Le(Te,!0)),h})}function kt(h){function y(R){return h.next(R)}var w=C(y),A=C(function(R){return h.throw(R)});function C(R){return function(me){var se=R(me),me=se.value;return se.done?me:me&&typeof me.then=="function"?me.then(w,A):l(me)?Promise.all(me).then(w,A):w(me)}}return C(y)()}function Rt(h,y,w){for(var A=l(h)?h.slice():[h],C=0;C<w;++C)A.push(y);return A}var rn={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(h){return r(r({},h),{table:function(y){var w=h.table(y),A=w.schema,C={},R=[];function H(ie,Te,pe){var je=_a(ie),Ce=C[je]=C[je]||[],Se=ie==null?0:typeof ie=="string"?1:ie.length,Ee=0<Te,Ee=r(r({},pe),{name:Ee?"".concat(je,"(virtual-from:").concat(pe.name,")"):pe.name,lowLevelIndex:pe,isVirtual:Ee,keyTail:Te,keyLength:Se,extractKey:ka(ie),unique:!Ee&&pe.unique});return Ce.push(Ee),Ee.isPrimaryKey||R.push(Ee),1<Se&&H(Se===2?ie[0]:ie.slice(0,Se-1),Te+1,pe),Ce.sort(function(Be,Ve){return Be.keyTail-Ve.keyTail}),Ee}y=H(A.primaryKey.keyPath,0,A.primaryKey),C[":id"]=[y];for(var se=0,me=A.indexes;se<me.length;se++){var we=me[se];H(we.keyPath,0,we)}function _e(ie){var Te,pe=ie.query.index;return pe.isVirtual?r(r({},ie),{query:{index:pe.lowLevelIndex,range:(Te=ie.query.range,pe=pe.keyTail,{type:Te.type===1?2:Te.type,lower:Rt(Te.lower,Te.lowerOpen?h.MAX_KEY:h.MIN_KEY,pe),lowerOpen:!0,upper:Rt(Te.upper,Te.upperOpen?h.MIN_KEY:h.MAX_KEY,pe),upperOpen:!0})}}):ie}return r(r({},w),{schema:r(r({},A),{primaryKey:y,indexes:R,getIndexByKeyPath:function(ie){return(ie=C[_a(ie)])&&ie[0]}}),count:function(ie){return w.count(_e(ie))},query:function(ie){return w.query(_e(ie))},openCursor:function(ie){var Te=ie.query.index,pe=Te.keyTail,je=Te.isVirtual,Ce=Te.keyLength;return je?w.openCursor(_e(ie)).then(function(Ee){return Ee&&Se(Ee)}):w.openCursor(ie);function Se(Ee){return Object.create(Ee,{continue:{value:function(Be){Be!=null?Ee.continue(Rt(Be,ie.reverse?h.MAX_KEY:h.MIN_KEY,pe)):ie.unique?Ee.continue(Ee.key.slice(0,Ce).concat(ie.reverse?h.MIN_KEY:h.MAX_KEY,pe)):Ee.continue()}},continuePrimaryKey:{value:function(Be,Ve){Ee.continuePrimaryKey(Rt(Be,h.MAX_KEY,pe),Ve)}},primaryKey:{get:function(){return Ee.primaryKey}},key:{get:function(){var Be=Ee.key;return Ce===1?Be[0]:Be.slice(0,Ce)}},value:{get:function(){return Ee.value}}})}}})}})}};function en(h,y,w,A){return w=w||{},A=A||"",o(h).forEach(function(C){var R,H,se;m(y,C)?(R=h[C],H=y[C],typeof R=="object"&&typeof H=="object"&&R&&H?(se=Ne(R))!==Ne(H)?w[A+C]=y[C]:se==="Object"?en(R,H,w,A+C+"."):R!==H&&(w[A+C]=y[C]):R!==H&&(w[A+C]=y[C])):w[A+C]=void 0}),o(y).forEach(function(C){m(h,C)||(w[A+C]=y[C])}),w}function yn(h,y){return y.type==="delete"?y.keys:y.keys||y.values.map(h.extractKey)}var Zn={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(h){return r(r({},h),{table:function(y){var w=h.table(y),A=w.schema.primaryKey;return r(r({},w),{mutate:function(C){var R=lt.trans,H=R.table(y).hook,se=H.deleting,me=H.creating,we=H.updating;switch(C.type){case"add":if(me.fire===Ue)break;return R._promise("readwrite",function(){return _e(C)},!0);case"put":if(me.fire===Ue&&we.fire===Ue)break;return R._promise("readwrite",function(){return _e(C)},!0);case"delete":if(se.fire===Ue)break;return R._promise("readwrite",function(){return _e(C)},!0);case"deleteRange":if(se.fire===Ue)break;return R._promise("readwrite",function(){return function ie(Te,pe,je){return w.query({trans:Te,values:!1,query:{index:A,range:pe},limit:je}).then(function(Ce){var Se=Ce.result;return _e({type:"delete",keys:Se,trans:Te}).then(function(Ee){return 0<Ee.numFailures?Promise.reject(Ee.failures[0]):Se.length<je?{failures:[],numFailures:0,lastResult:void 0}:ie(Te,r(r({},pe),{lower:Se[Se.length-1],lowerOpen:!0}),je)})})}(C.trans,C.range,1e4)},!0)}return w.mutate(C);function _e(ie){var Te,pe,je,Ce=lt.trans,Se=ie.keys||yn(A,ie);if(!Se)throw new Error("Keys missing");return(ie=ie.type==="add"||ie.type==="put"?r(r({},ie),{keys:Se}):r({},ie)).type!=="delete"&&(ie.values=s([],ie.values)),ie.keys&&(ie.keys=s([],ie.keys)),Te=w,je=Se,((pe=ie).type==="add"?Promise.resolve([]):Te.getMany({trans:pe.trans,keys:je,cache:"immutable"})).then(function(Ee){var Be=Se.map(function(Ve,He){var rt,ut,st,at=Ee[He],pt={onerror:null,onsuccess:null};return ie.type==="delete"?se.fire.call(pt,Ve,at,Ce):ie.type==="add"||at===void 0?(rt=me.fire.call(pt,Ve,ie.values[He],Ce),Ve==null&&rt!=null&&(ie.keys[He]=Ve=rt,A.outbound||te(ie.values[He],A.keyPath,Ve))):(rt=en(at,ie.values[He]),(ut=we.fire.call(pt,rt,Ve,at,Ce))&&(st=ie.values[He],Object.keys(ut).forEach(function(ot){m(st,ot)?st[ot]=ut[ot]:te(st,ot,ut[ot])}))),pt});return w.mutate(ie).then(function(Ve){for(var He=Ve.failures,rt=Ve.results,ut=Ve.numFailures,Ve=Ve.lastResult,st=0;st<Se.length;++st){var at=(rt||Se)[st],pt=Be[st];at==null?pt.onerror&&pt.onerror(He[st]):pt.onsuccess&&pt.onsuccess(ie.type==="put"&&Ee[st]?ie.values[st]:at)}return{failures:He,results:rt,numFailures:ut,lastResult:Ve}}).catch(function(Ve){return Be.forEach(function(He){return He.onerror&&He.onerror(Ve)}),Promise.reject(Ve)})})}}})}})}};function Xn(h,y,w){try{if(!y||y.keys.length<h.length)return null;for(var A=[],C=0,R=0;C<y.keys.length&&R<h.length;++C)pn(y.keys[C],h[R])===0&&(A.push(w?J(y.values[C]):y.values[C]),++R);return A.length===h.length?A:null}catch{return null}}var pr={stack:"dbcore",level:-1,create:function(h){return{table:function(y){var w=h.table(y);return r(r({},w),{getMany:function(A){if(!A.cache)return w.getMany(A);var C=Xn(A.keys,A.trans._cache,A.cache==="clone");return C?Ge.resolve(C):w.getMany(A).then(function(R){return A.trans._cache={keys:A.keys,values:A.cache==="clone"?J(R):R},R})},mutate:function(A){return A.type!=="add"&&(A.trans._cache=null),w.mutate(A)}})}}}};function Fr(h,y){return h.trans.mode==="readonly"&&!!h.subscr&&!h.trans.explicit&&h.trans.db._options.cache!=="disabled"&&!y.schema.primaryKey.outbound}function wr(h,y){switch(h){case"query":return y.values&&!y.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var zs={stack:"dbcore",level:0,name:"Observability",create:function(h){var y=h.schema.name,w=new fr(h.MIN_KEY,h.MAX_KEY);return r(r({},h),{transaction:function(A,C,R){if(lt.subscr&&C!=="readonly")throw new ce.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(lt.querier));return h.transaction(A,C,R)},table:function(A){var C=h.table(A),R=C.schema,H=R.primaryKey,ie=R.indexes,se=H.extractKey,me=H.outbound,we=H.autoIncrement&&ie.filter(function(pe){return pe.compound&&pe.keyPath.includes(H.keyPath)}),_e=r(r({},C),{mutate:function(pe){function je(ot){return ot="idb://".concat(y,"/").concat(A,"/").concat(ot),Ve[ot]||(Ve[ot]=new fr)}var Ce,Se,Ee,Be=pe.trans,Ve=pe.mutatedParts||(pe.mutatedParts={}),He=je(""),rt=je(":dels"),ut=pe.type,pt=pe.type==="deleteRange"?[pe.range]:pe.type==="delete"?[pe.keys]:pe.values.length<50?[yn(H,pe).filter(function(ot){return ot}),pe.values]:[],st=pt[0],at=pt[1],pt=pe.trans._cache;return l(st)?(He.addKeys(st),(pt=ut==="delete"||st.length===at.length?Xn(st,pt):null)||rt.addKeys(st),(pt||at)&&(Ce=je,Se=pt,Ee=at,R.indexes.forEach(function(ot){var bt=Ce(ot.name||"");function Ct(Ft){return Ft!=null?ot.extractKey(Ft):null}function Mt(Ft){return ot.multiEntry&&l(Ft)?Ft.forEach(function(kn){return bt.addKey(kn)}):bt.addKey(Ft)}(Se||Ee).forEach(function(Ft,mr){var Ut=Se&&Ct(Se[mr]),mr=Ee&&Ct(Ee[mr]);pn(Ut,mr)!==0&&(Ut!=null&&Mt(Ut),mr!=null&&Mt(mr))})}))):st?(at={from:(at=st.lower)!==null&&at!==void 0?at:h.MIN_KEY,to:(at=st.upper)!==null&&at!==void 0?at:h.MAX_KEY},rt.add(at),He.add(at)):(He.add(w),rt.add(w),R.indexes.forEach(function(ot){return je(ot.name).add(w)})),C.mutate(pe).then(function(ot){return!st||pe.type!=="add"&&pe.type!=="put"||(He.addKeys(ot.results),we&&we.forEach(function(bt){for(var Ct=pe.values.map(function(Ut){return bt.extractKey(Ut)}),Mt=bt.keyPath.findIndex(function(Ut){return Ut===H.keyPath}),Ft=0,kn=ot.results.length;Ft<kn;++Ft)Ct[Ft][Mt]=ot.results[Ft];je(bt.name).addKeys(Ct)})),Be.mutatedParts=Us(Be.mutatedParts||{},Ve),ot})}}),ie=function(je){var Ce=je.query,je=Ce.index,Ce=Ce.range;return[je,new fr((je=Ce.lower)!==null&&je!==void 0?je:h.MIN_KEY,(Ce=Ce.upper)!==null&&Ce!==void 0?Ce:h.MAX_KEY)]},Te={get:function(pe){return[H,new fr(pe.key)]},getMany:function(pe){return[H,new fr().addKeys(pe.keys)]},count:ie,query:ie,openCursor:ie};return o(Te).forEach(function(pe){_e[pe]=function(je){var Ce=lt.subscr,Se=!!Ce,Ee=Fr(lt,C)&&wr(pe,je)?je.obsSet={}:Ce;if(Se){var Be=function(at){return at="idb://".concat(y,"/").concat(A,"/").concat(at),Ee[at]||(Ee[at]=new fr)},Ve=Be(""),He=Be(":dels"),Ce=Te[pe](je),Se=Ce[0],Ce=Ce[1];if((pe==="query"&&Se.isPrimaryKey&&!je.values?He:Be(Se.name||"")).add(Ce),!Se.isPrimaryKey){if(pe!=="count"){var rt=pe==="query"&&me&&je.values&&C.query(r(r({},je),{values:!1}));return C[pe].apply(this,arguments).then(function(at){if(pe==="query"){if(me&&je.values)return rt.then(function(Ct){return Ct=Ct.result,Ve.addKeys(Ct),at});var pt=je.values?at.result.map(se):at.result;(je.values?Ve:He).addKeys(pt)}else if(pe==="openCursor"){var ot=at,bt=je.values;return ot&&Object.create(ot,{key:{get:function(){return He.addKey(ot.primaryKey),ot.key}},primaryKey:{get:function(){var Ct=ot.primaryKey;return He.addKey(Ct),Ct}},value:{get:function(){return bt&&Ve.addKey(ot.primaryKey),ot.value}}})}return at})}He.add(w)}}return C[pe].apply(this,arguments)}}),_e}})}};function os(h,y,w){if(w.numFailures===0)return y;if(y.type==="deleteRange")return null;var A=y.keys?y.keys.length:"values"in y&&y.values?y.values.length:1;return w.numFailures===A?null:(y=r({},y),l(y.keys)&&(y.keys=y.keys.filter(function(C,R){return!(R in w.failures)})),"values"in y&&l(y.values)&&(y.values=y.values.filter(function(C,R){return!(R in w.failures)})),y)}function Cs(h,y){return w=h,((A=y).lower===void 0||(A.lowerOpen?0<pn(w,A.lower):0<=pn(w,A.lower)))&&(h=h,(y=y).upper===void 0||(y.upperOpen?pn(h,y.upper)<0:pn(h,y.upper)<=0));var w,A}function pl(h,y,Te,A,C,R){if(!Te||Te.length===0)return h;var H=y.query.index,se=H.multiEntry,me=y.query.range,we=A.schema.primaryKey.extractKey,_e=H.extractKey,ie=(H.lowLevelIndex||H).extractKey,Te=Te.reduce(function(pe,je){var Ce=pe,Se=[];if(je.type==="add"||je.type==="put")for(var Ee=new fr,Be=je.values.length-1;0<=Be;--Be){var Ve,He=je.values[Be],rt=we(He);Ee.hasKey(rt)||(Ve=_e(He),(se&&l(Ve)?Ve.some(function(ot){return Cs(ot,me)}):Cs(Ve,me))&&(Ee.addKey(rt),Se.push(He)))}switch(je.type){case"add":var ut=new fr().addKeys(y.values?pe.map(function(bt){return we(bt)}):pe),Ce=pe.concat(y.values?Se.filter(function(bt){return bt=we(bt),!ut.hasKey(bt)&&(ut.addKey(bt),!0)}):Se.map(function(bt){return we(bt)}).filter(function(bt){return!ut.hasKey(bt)&&(ut.addKey(bt),!0)}));break;case"put":var st=new fr().addKeys(je.values.map(function(bt){return we(bt)}));Ce=pe.filter(function(bt){return!st.hasKey(y.values?we(bt):bt)}).concat(y.values?Se:Se.map(function(bt){return we(bt)}));break;case"delete":var at=new fr().addKeys(je.keys);Ce=pe.filter(function(bt){return!at.hasKey(y.values?we(bt):bt)});break;case"deleteRange":var pt=je.range;Ce=pe.filter(function(bt){return!Cs(we(bt),pt)})}return Ce},h);return Te===h?h:(Te.sort(function(pe,je){return pn(ie(pe),ie(je))||pn(we(pe),we(je))}),y.limit&&y.limit<1/0&&(Te.length>y.limit?Te.length=y.limit:h.length===y.limit&&Te.length<y.limit&&(C.dirty=!0)),R?Object.freeze(Te):Te)}function mo(h,y){return pn(h.lower,y.lower)===0&&pn(h.upper,y.upper)===0&&!!h.lowerOpen==!!y.lowerOpen&&!!h.upperOpen==!!y.upperOpen}function ml(h,y){return function(w,A,C,R){if(w===void 0)return A!==void 0?-1:0;if(A===void 0)return 1;if((A=pn(w,A))===0){if(C&&R)return 0;if(C)return 1;if(R)return-1}return A}(h.lower,y.lower,h.lowerOpen,y.lowerOpen)<=0&&0<=function(w,A,C,R){if(w===void 0)return A!==void 0?1:0;if(A===void 0)return-1;if((A=pn(w,A))===0){if(C&&R)return 0;if(C)return-1;if(R)return 1}return A}(h.upper,y.upper,h.upperOpen,y.upperOpen)}function go(h,y,w,A){h.subscribers.add(w),A.addEventListener("abort",function(){var C,R;h.subscribers.delete(w),h.subscribers.size===0&&(C=h,R=y,setTimeout(function(){C.subscribers.size===0&&G(R,C)},3e3))})}var gl={stack:"dbcore",level:0,name:"Cache",create:function(h){var y=h.schema.name;return r(r({},h),{transaction:function(w,A,C){var R,H,se=h.transaction(w,A,C);return A==="readwrite"&&(H=(R=new AbortController).signal,C=function(me){return function(){if(R.abort(),A==="readwrite"){for(var we=new Set,_e=0,ie=w;_e<ie.length;_e++){var Te=ie[_e],pe=x["idb://".concat(y,"/").concat(Te)];if(pe){var je=h.table(Te),Ce=pe.optimisticOps.filter(function(bt){return bt.trans===se});if(se._explicit&&me&&se.mutatedParts)for(var Se=0,Ee=Object.values(pe.queries.query);Se<Ee.length;Se++)for(var Be=0,Ve=(ut=Ee[Se]).slice();Be<Ve.length;Be++)La((st=Ve[Be]).obsSet,se.mutatedParts)&&(G(ut,st),st.subscribers.forEach(function(bt){return we.add(bt)}));else if(0<Ce.length){pe.optimisticOps=pe.optimisticOps.filter(function(bt){return bt.trans!==se});for(var He=0,rt=Object.values(pe.queries.query);He<rt.length;He++)for(var ut,st,at,pt=0,ot=(ut=rt[He]).slice();pt<ot.length;pt++)(st=ot[pt]).res!=null&&se.mutatedParts&&(me&&!st.dirty?(at=Object.isFrozen(st.res),at=pl(st.res,st.req,Ce,je,st,at),st.dirty?(G(ut,st),st.subscribers.forEach(function(bt){return we.add(bt)})):at!==st.res&&(st.res=at,st.promise=Ge.resolve({result:at}))):(st.dirty&&G(ut,st),st.subscribers.forEach(function(bt){return we.add(bt)})))}}}we.forEach(function(bt){return bt()})}}},se.addEventListener("abort",C(!1),{signal:H}),se.addEventListener("error",C(!1),{signal:H}),se.addEventListener("complete",C(!0),{signal:H})),se},table:function(w){var A=h.table(w),C=A.schema.primaryKey;return r(r({},A),{mutate:function(R){var H=lt.trans;if(C.outbound||H.db._options.cache==="disabled"||H.explicit||H.idbtrans.mode!=="readwrite")return A.mutate(R);var se=x["idb://".concat(y,"/").concat(w)];return se?(H=A.mutate(R),R.type!=="add"&&R.type!=="put"||!(50<=R.values.length||yn(C,R).some(function(me){return me==null}))?(se.optimisticOps.push(R),R.mutatedParts&&de(R.mutatedParts),H.then(function(me){0<me.numFailures&&(G(se.optimisticOps,R),(me=os(0,R,me))&&se.optimisticOps.push(me),R.mutatedParts&&de(R.mutatedParts))}),H.catch(function(){G(se.optimisticOps,R),R.mutatedParts&&de(R.mutatedParts)})):H.then(function(me){var we=os(0,r(r({},R),{values:R.values.map(function(_e,ie){var Te;return me.failures[ie]?_e:(_e=(Te=C.keyPath)!==null&&Te!==void 0&&Te.includes(".")?J(_e):r({},_e),te(_e,C.keyPath,me.results[ie]),_e)})}),me);se.optimisticOps.push(we),queueMicrotask(function(){return R.mutatedParts&&de(R.mutatedParts)})}),H):A.mutate(R)},query:function(R){if(!Fr(lt,A)||!wr("query",R))return A.query(R);var H=((we=lt.trans)===null||we===void 0?void 0:we.db._options.cache)==="immutable",ie=lt,se=ie.requery,me=ie.signal,we=function(je,Ce,Se,Ee){var Be=x["idb://".concat(je,"/").concat(Ce)];if(!Be)return[];if(!(Ce=Be.queries[Se]))return[null,!1,Be,null];var Ve=Ce[(Ee.query?Ee.query.index.name:null)||""];if(!Ve)return[null,!1,Be,null];switch(Se){case"query":var He=Ve.find(function(rt){return rt.req.limit===Ee.limit&&rt.req.values===Ee.values&&mo(rt.req.query.range,Ee.query.range)});return He?[He,!0,Be,Ve]:[Ve.find(function(rt){return("limit"in rt.req?rt.req.limit:1/0)>=Ee.limit&&(!Ee.values||rt.req.values)&&ml(rt.req.query.range,Ee.query.range)}),!1,Be,Ve];case"count":return He=Ve.find(function(rt){return mo(rt.req.query.range,Ee.query.range)}),[He,!!He,Be,Ve]}}(y,w,"query",R),_e=we[0],ie=we[1],Te=we[2],pe=we[3];return _e&&ie?_e.obsSet=R.obsSet:(ie=A.query(R).then(function(je){var Ce=je.result;if(_e&&(_e.res=Ce),H){for(var Se=0,Ee=Ce.length;Se<Ee;++Se)Object.freeze(Ce[Se]);Object.freeze(Ce)}else je.result=J(Ce);return je}).catch(function(je){return pe&&_e&&G(pe,_e),Promise.reject(je)}),_e={obsSet:R.obsSet,promise:ie,subscribers:new Set,type:"query",req:R,dirty:!1},pe?pe.push(_e):(pe=[_e],(Te=Te||(x["idb://".concat(y,"/").concat(w)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[R.query.index.name||""]=pe)),go(_e,pe,se,me),_e.promise.then(function(je){return{result:pl(je.result,R,Te==null?void 0:Te.optimisticOps,A,_e,H)}})}})}})}};function Gi(h,y){return new Proxy(h,{get:function(w,A,C){return A==="db"?y:Reflect.get(w,A,C)}})}var ls=(mn.prototype.version=function(h){if(isNaN(h)||h<.1)throw new ce.Type("Given version is not a positive number");if(h=Math.round(10*h)/10,this.idbdb||this._state.isBeingOpened)throw new ce.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,h);var y=this._versions,w=y.filter(function(A){return A._cfg.version===h})[0];return w||(w=new this.Version(h),y.push(w),y.sort(Zl),w.stores({}),this._state.autoSchema=!1,w)},mn.prototype._whenReady=function(h){var y=this;return this.idbdb&&(this._state.openComplete||lt.letThrough||this._vip)?h():new Ge(function(w,A){if(y._state.openComplete)return A(new ce.DatabaseClosed(y._state.dbOpenError));if(!y._state.isBeingOpened){if(!y._state.autoOpen)return void A(new ce.DatabaseClosed);y.open().catch(Ue)}y._state.dbReadyPromise.then(w,A)}).then(h)},mn.prototype.use=function(h){var y=h.stack,w=h.create,A=h.level,C=h.name;return C&&this.unuse({stack:y,name:C}),h=this._middlewares[y]||(this._middlewares[y]=[]),h.push({stack:y,create:w,level:A??10,name:C}),h.sort(function(R,H){return R.level-H.level}),this},mn.prototype.unuse=function(h){var y=h.stack,w=h.name,A=h.create;return y&&this._middlewares[y]&&(this._middlewares[y]=this._middlewares[y].filter(function(C){return A?C.create!==A:!!w&&C.name!==w})),this},mn.prototype.open=function(){var h=this;return As(ln,function(){return tt(h)})},mn.prototype._close=function(){var h=this._state,y=Rs.indexOf(this);if(0<=y&&Rs.splice(y,1),this.idbdb){try{this.idbdb.close()}catch{}this.idbdb=null}h.isBeingOpened||(h.dbReadyPromise=new Ge(function(w){h.dbReadyResolve=w}),h.openCanceller=new Ge(function(w,A){h.cancelOpen=A}))},mn.prototype.close=function(w){var y=(w===void 0?{disableAutoOpen:!0}:w).disableAutoOpen,w=this._state;y?(w.isBeingOpened&&w.cancelOpen(new ce.DatabaseClosed),this._close(),w.autoOpen=!1,w.dbOpenError=new ce.DatabaseClosed):(this._close(),w.autoOpen=this._options.autoOpen||w.isBeingOpened,w.openComplete=!1,w.dbOpenError=null)},mn.prototype.delete=function(h){var y=this;h===void 0&&(h={disableAutoOpen:!0});var w=0<arguments.length&&typeof arguments[0]!="object",A=this._state;return new Ge(function(C,R){function H(){y.close(h);var se=y._deps.indexedDB.deleteDatabase(y.name);se.onsuccess=wn(function(){var me,we,_e;me=y._deps,we=y.name,_e=me.indexedDB,me=me.IDBKeyRange,Ta(_e)||we===ga||Ca(_e,me).delete(we).catch(Ue),C()}),se.onerror=Vt(R),se.onblocked=y._fireOnBlocked}if(w)throw new ce.InvalidArgument("Invalid closeOptions argument to db.delete()");A.isBeingOpened?A.dbReadyPromise.then(H):H()})},mn.prototype.backendDB=function(){return this.idbdb},mn.prototype.isOpen=function(){return this.idbdb!==null},mn.prototype.hasBeenClosed=function(){var h=this._state.dbOpenError;return h&&h.name==="DatabaseClosed"},mn.prototype.hasFailed=function(){return this._state.dbOpenError!==null},mn.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(mn.prototype,"tables",{get:function(){var h=this;return o(this._allTables).map(function(y){return h._allTables[y]})},enumerable:!1,configurable:!0}),mn.prototype.transaction=function(){var h=(function(y,w,A){var C=arguments.length;if(C<2)throw new ce.InvalidArgument("Too few arguments");for(var R=new Array(C-1);--C;)R[C-1]=arguments[C];return A=R.pop(),[y,oe(R),A]}).apply(this,arguments);return this._transaction.apply(this,h)},mn.prototype._transaction=function(h,y,w){var A=this,C=lt.trans;C&&C.db===this&&h.indexOf("!")===-1||(C=null);var R,H,se=h.indexOf("?")!==-1;h=h.replace("!","").replace("?","");try{if(H=y.map(function(we){if(we=we instanceof A.Table?we.name:we,typeof we!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return we}),h=="r"||h===rl)R=rl;else{if(h!="rw"&&h!=va)throw new ce.InvalidArgument("Invalid transaction mode: "+h);R=va}if(C){if(C.mode===rl&&R===va){if(!se)throw new ce.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");C=null}C&&H.forEach(function(we){if(C&&C.storeNames.indexOf(we)===-1){if(!se)throw new ce.SubTransaction("Table "+we+" not included in parent transaction.");C=null}}),se&&C&&!C.active&&(C=null)}}catch(we){return C?C._promise(null,function(_e,ie){ie(we)}):Bn(we)}var me=(function we(_e,ie,Te,pe,je){return Ge.resolve().then(function(){var Ce=lt.transless||lt,Se=_e._createTransaction(ie,Te,_e._dbSchema,pe);if(Se.explicit=!0,Ce={trans:Se,transless:Ce},pe)Se.idbtrans=pe.idbtrans;else try{Se.create(),Se.idbtrans._explicit=!0,_e._state.PR1398_maxLoop=3}catch(Ve){return Ve.name===ve.InvalidState&&_e.isOpen()&&0<--_e._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),_e.close({disableAutoOpen:!1}),_e.open().then(function(){return we(_e,ie,Te,null,je)})):Bn(Ve)}var Ee,Be=$e(je);return Be&&$r(),Ce=Ge.follow(function(){var Ve;(Ee=je.call(Se,Se))&&(Be?(Ve=Cr.bind(null,null),Ee.then(Ve,Ve)):typeof Ee.next=="function"&&typeof Ee.throw=="function"&&(Ee=kt(Ee)))},Ce),(Ee&&typeof Ee.then=="function"?Ge.resolve(Ee).then(function(Ve){return Se.active?Ve:Bn(new ce.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):Ce.then(function(){return Ee})).then(function(Ve){return pe&&Se._resolve(),Se._completion.then(function(){return Ve})}).catch(function(Ve){return Se._reject(Ve),Bn(Ve)})})}).bind(null,this,R,H,C,w);return C?C._promise(R,me,"lock"):lt.trans?As(lt.transless,function(){return A._whenReady(me)}):this._whenReady(me)},mn.prototype.table=function(h){if(!m(this._allTables,h))throw new ce.InvalidTable("Table ".concat(h," does not exist"));return this._allTables[h]},mn);function mn(h,y){var w=this;this._middlewares={},this.verno=0;var A=mn.dependencies;this._options=y=r({addons:mn.addons,autoOpen:!0,indexedDB:A.indexedDB,IDBKeyRange:A.IDBKeyRange,cache:"cloned"},y),this._deps={indexedDB:y.indexedDB,IDBKeyRange:y.IDBKeyRange},A=y.addons,this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var C,R,H,se,me,we={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:Ue,dbReadyPromise:null,cancelOpen:Ue,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:y.autoOpen};we.dbReadyPromise=new Ge(function(ie){we.dbReadyResolve=ie}),we.openCanceller=new Ge(function(ie,Te){we.cancelOpen=Te}),this._state=we,this.name=h,this.on=di(this,"populate","blocked","versionchange","close",{ready:[fe,Ue]}),this.on.ready.subscribe=M(this.on.ready.subscribe,function(ie){return function(Te,pe){mn.vip(function(){var je,Ce=w._state;Ce.openComplete?(Ce.dbOpenError||Ge.resolve().then(Te),pe&&ie(Te)):Ce.onReadyBeingFired?(Ce.onReadyBeingFired.push(Te),pe&&ie(Te)):(ie(Te),je=w,pe||ie(function Se(){je.on.ready.unsubscribe(Te),je.on.ready.unsubscribe(Se)}))})}}),this.Collection=(C=this,xa(Xc.prototype,function(Ee,Se){this.db=C;var pe=sl,je=null;if(Se)try{pe=Se()}catch(Be){je=Be}var Ce=Ee._ctx,Se=Ce.table,Ee=Se.hook.reading.fire;this._ctx={table:Se,index:Ce.index,isPrimKey:!Ce.index||Se.schema.primKey.keyPath&&Ce.index===Se.schema.primKey.name,range:pe,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:je,or:Ce.or,valueMapper:Ee!==it?Ee:null}})),this.Table=(R=this,xa(al.prototype,function(ie,Te,pe){this.db=R,this._tx=pe,this.name=ie,this.schema=Te,this.hook=R._allTables[ie]?R._allTables[ie].hook:di(null,{creating:[re,Ue],reading:[It,it],updating:[X,Ue],deleting:[zt,Ue]})})),this.Transaction=(H=this,xa(Gl.prototype,function(ie,Te,pe,je,Ce){var Se=this;this.db=H,this.mode=ie,this.storeNames=Te,this.schema=pe,this.chromeTransactionDurability=je,this.idbtrans=null,this.on=di(this,"complete","error","abort"),this.parent=Ce||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new Ge(function(Ee,Be){Se._resolve=Ee,Se._reject=Be}),this._completion.then(function(){Se.active=!1,Se.on.complete.fire()},function(Ee){var Be=Se.active;return Se.active=!1,Se.on.error.fire(Ee),Se.parent?Se.parent._reject(Ee):Be&&Se.idbtrans&&Se.idbtrans.abort(),Bn(Ee)})})),this.Version=(se=this,xa(uo.prototype,function(ie){this.db=se,this._cfg={version:ie,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})),this.WhereClause=(me=this,xa(Kl.prototype,function(ie,Te,pe){if(this.db=me,this._ctx={table:ie,index:Te===":id"?null:Te,or:pe},this._cmp=this._ascending=pn,this._descending=function(je,Ce){return pn(Ce,je)},this._max=function(je,Ce){return 0<pn(je,Ce)?je:Ce},this._min=function(je,Ce){return pn(je,Ce)<0?je:Ce},this._IDBKeyRange=me._deps.IDBKeyRange,!this._IDBKeyRange)throw new ce.MissingAPI})),this.on("versionchange",function(ie){0<ie.newVersion?console.warn("Another connection wants to upgrade database '".concat(w.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(w.name,"'. Closing db now to resume the delete request.")),w.close({disableAutoOpen:!1})}),this.on("blocked",function(ie){!ie.newVersion||ie.newVersion<ie.oldVersion?console.warn("Dexie.delete('".concat(w.name,"') was blocked")):console.warn("Upgrade '".concat(w.name,"' blocked by other connection holding version ").concat(ie.oldVersion/10))}),this._maxKey=Sa(y.IDBKeyRange),this._createTransaction=function(ie,Te,pe,je){return new w.Transaction(ie,Te,pe,w._options.chromeTransactionDurability,je)},this._fireOnBlocked=function(ie){w.on("blocked").fire(ie),Rs.filter(function(Te){return Te.name===w.name&&Te!==w&&!Te._state.vcFired}).map(function(Te){return Te.on("versionchange").fire(ie)})},this.use(pr),this.use(gl),this.use(zs),this.use(rn),this.use(Zn);var _e=new Proxy(this,{get:function(ie,Te,pe){if(Te==="_vip")return!0;if(Te==="table")return function(Ce){return Gi(w.table(Ce),_e)};var je=Reflect.get(ie,Te,pe);return je instanceof al?Gi(je,_e):Te==="tables"?je.map(function(Ce){return Gi(Ce,_e)}):Te==="_createTransaction"?function(){return Gi(je.apply(this,arguments),_e)}:je}});this.vip=_e,A.forEach(function(ie){return ie(w)})}var vi,Br=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",vo=(Da.prototype.subscribe=function(h,y,w){return this._subscribe(h&&typeof h!="function"?h:{next:h,error:y,complete:w})},Da.prototype[Br]=function(){return this},Da);function Da(h){this._subscribe=h}try{vi={indexedDB:i.indexedDB||i.mozIndexedDB||i.webkitIndexedDB||i.msIndexedDB,IDBKeyRange:i.IDBKeyRange||i.webkitIDBKeyRange}}catch{vi={indexedDB:null,IDBKeyRange:null}}function es(h){var y,w=!1,A=new vo(function(C){var R=$e(h),H,se=!1,me={},we={},_e={get closed(){return se},unsubscribe:function(){se||(se=!0,H&&H.abort(),ie&&Vs.storagemutated.unsubscribe(pe))}};C.start&&C.start(_e);var ie=!1,Te=function(){return Bi(je)},pe=function(Ce){Us(me,Ce),La(we,me)&&Te()},je=function(){var Ce,Se,Ee;!se&&vi.indexedDB&&(me={},Ce={},H&&H.abort(),H=new AbortController,Ee=function(Be){var Ve=Xr();try{R&&$r();var He=Pr(h,Be);return He=R?He.finally(Cr):He}finally{Ve&&Jr()}}(Se={subscr:Ce,signal:H.signal,requery:Te,querier:h,trans:null}),Promise.resolve(Ee).then(function(Be){w=!0,y=Be,se||Se.signal.aborted||(me={},function(Ve){for(var He in Ve)if(m(Ve,He))return;return 1}(we=Ce)||ie||(Vs(Na,pe),ie=!0),Bi(function(){return!se&&C.next&&C.next(Be)}))},function(Be){w=!1,["DatabaseClosedError","AbortError"].includes(Be==null?void 0:Be.name)||se||Bi(function(){se||C.error&&C.error(Be)})}))};return setTimeout(Te,0),_e});return A.hasValue=function(){return w},A.getValue=function(){return y},A}var yi=ls;function Ia(h){var y=Nr;try{Nr=!0,Vs.storagemutated.fire(h),Le(h,!0)}finally{Nr=y}}g(yi,r(r({},Ke),{delete:function(h){return new yi(h,{addons:[]}).delete()},exists:function(h){return new yi(h,{addons:[]}).open().then(function(y){return y.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(h){try{return y=yi.dependencies,w=y.indexedDB,y=y.IDBKeyRange,(Ta(w)?Promise.resolve(w.databases()).then(function(A){return A.map(function(C){return C.name}).filter(function(C){return C!==ga})}):Ca(w,y).toCollection().primaryKeys()).then(h)}catch{return Bn(new ce.MissingAPI)}var y,w},defineClass:function(){return function(h){c(this,h)}},ignoreTransaction:function(h){return lt.trans?As(lt.transless,h):h()},vip:fo,async:function(h){return function(){try{var y=kt(h.apply(this,arguments));return y&&typeof y.then=="function"?y:Ge.resolve(y)}catch(w){return Bn(w)}}},spawn:function(h,y,w){try{var A=kt(h.apply(w,y||[]));return A&&typeof A.then=="function"?A:Ge.resolve(A)}catch(C){return Bn(C)}},currentTransaction:{get:function(){return lt.trans||null}},waitFor:function(h,y){return y=Ge.resolve(typeof h=="function"?yi.ignoreTransaction(h):h).timeout(y||6e4),lt.trans?lt.trans.waitFor(y):y},Promise:Ge,debug:{get:function(){return Re},set:function(h){Oe(h)}},derive:j,extend:c,props:g,override:M,Events:di,on:Vs,liveQuery:es,extendObservabilitySet:Us,getByKeyPath:U,setByKeyPath:te,delByKeyPath:function(h,y){typeof y=="string"?te(h,y,void 0):"length"in y&&[].map.call(y,function(w){te(h,w,void 0)})},shallowClone:W,deepClone:J,getObjectDiff:en,cmp:pn,asap:Y,minKey:-1/0,addons:[],connections:Rs,errnames:ve,dependencies:vi,cache:x,semVer:"4.0.11",version:"4.0.11".split(".").map(function(h){return parseInt(h)}).reduce(function(h,y,w){return h+y/Math.pow(10,2*w)})})),yi.maxKey=Sa(yi.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(Vs(Na,function(h){Nr||(h=new CustomEvent(Ps,{detail:h}),Nr=!0,dispatchEvent(h),Nr=!1)}),addEventListener(Ps,function(h){h=h.detail,Nr||Ia(h)}));var xi,Nr=!1,Ma=function(){};return typeof BroadcastChannel<"u"&&((Ma=function(){(xi=new BroadcastChannel(Ps)).onmessage=function(h){return h.data&&Ia(h.data)}})(),typeof xi.unref=="function"&&xi.unref(),Vs(Na,function(h){Nr||xi.postMessage(h)})),typeof addEventListener<"u"&&(addEventListener("pagehide",function(h){if(!ls.disableBfCache&&h.persisted){Re&&console.debug("Dexie: handling persisted pagehide"),xi!=null&&xi.close();for(var y=0,w=Rs;y<w.length;y++)w[y].close({disableAutoOpen:!1})}}),addEventListener("pageshow",function(h){!ls.disableBfCache&&h.persisted&&(Re&&console.debug("Dexie: handling persisted pageshow"),Ma(),Ia({all:new fr(-1/0,[[]])}))})),Ge.rejectionMapper=function(h,y){return!h||h instanceof z||h instanceof TypeError||h instanceof SyntaxError||!h.name||!Ye[h.name]?h:(y=new Ye[h.name](y||h.message,h),"stack"in h&&N(y,"stack",{get:function(){return this.inner.stack}}),y)},Oe(Re),r(ls,Object.freeze({__proto__:null,Dexie:ls,liveQuery:es,Entity:ya,cmp:pn,PropModification:ba,replacePrefix:function(h,y){return new ba({replacePrefix:[h,y]})},add:function(h){return new ba({add:h})},remove:function(h){return new ba({remove:h})},default:ls,RangeSet:fr,mergeRanges:Hi,rangesOverlap:Ql}),{default:ls}),ls})})(q2);var Jj=q2.exports;const zp=hj(Jj),y1=Symbol.for("Dexie"),Wp=globalThis[y1]||(globalThis[y1]=zp);if(zp.semVer!==Wp.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${zp.semVer} and ${Wp.semVer}`);class Qj extends Wp{constructor(){super("ProgressPulseDB");Tn(this,"users");Tn(this,"goals");Tn(this,"progress");Tn(this,"milestones");Tn(this,"achievements");Tn(this,"notifications");Tn(this,"spreadsheetData");this.version(2).stores({users:"++id, email, createdAt",goals:"++id, userId, status, category, createdAt, updatedAt",progress:"++id, goalId, userId, date, createdAt",milestones:"++id, goalId, achieved, achievedAt",achievements:"++id, type, unlockedAt",notifications:"++id, userId, type, read, createdAt",spreadsheetData:"++id, goalId, userId, day, date, completed, createdAt"}),this.goals.hook("creating",(n,r,s)=>{r.createdAt=new Date,r.updatedAt=new Date}),this.goals.hook("updating",n=>{n.updatedAt=new Date}),this.progress.hook("creating",(n,r,s)=>{r.createdAt=new Date}),this.users.hook("creating",(n,r,s)=>{r.createdAt=new Date,r.updatedAt=new Date}),this.users.hook("updating",n=>{n.updatedAt=new Date})}async createUser(n){const r=crypto.randomUUID();return await this.users.add({...n,id:r,createdAt:new Date,updatedAt:new Date}),r}async getUserByEmail(n){return await this.users.where("email").equals(n).first()}async createGoal(n){return(await this.goals.add({...n,id:crypto.randomUUID(),createdAt:new Date,updatedAt:new Date})).toString()}async getGoalsByUser(n){return await this.goals.where("userId").equals(n).toArray()}async updateGoal(n,r){await this.goals.update(n,{...r,updatedAt:new Date})}async deleteGoal(n){await this.transaction("rw",[this.goals,this.progress,this.milestones],async()=>{await this.goals.delete(n),await this.progress.where("goalId").equals(n).delete(),await this.milestones.where("goalId").equals(n).delete()})}async addProgress(n){const r=await this.progress.add({...n,id:crypto.randomUUID(),createdAt:new Date}),s=await this.goals.get(n.goalId);return s&&await this.updateGoal(n.goalId,{currentValue:s.currentValue+n.value}),r.toString()}async getProgressByGoal(n){return await this.progress.where("goalId").equals(n).toArray()}async getRecentProgress(n,r=10){return await this.progress.where("userId").equals(n).reverse().sortBy("createdAt").then(s=>s.slice(0,r))}async getAnalytics(n){const r=await this.getGoalsByUser(n),s=r.length,i=r.filter(g=>g.status==="completed").length,o=r.filter(g=>g.status==="active").length,l=await this.progress.where("userId").equals(n).toArray(),c=l.reduce((g,v)=>g+v.value,0),d=new Date,f=new Date(d.getTime()-7*24*60*60*1e3),m=l.filter(g=>g.date>=f);return{totalGoals:s,completedGoals:i,activeGoals:o,totalProgress:c,weeklyProgress:m.length,streakDays:await this.calculateStreak(n)}}async calculateStreak(n){const r=await this.progress.where("userId").equals(n).reverse().sortBy("date");if(r.length===0)return 0;let s=0,i=new Date;i.setHours(0,0,0,0);for(let o=0;o<r.length;o++){const l=new Date(r[o].date);if(l.setHours(0,0,0,0),l.getTime()===i.getTime())s++,i.setDate(i.getDate()-1);else if(l.getTime()<i.getTime())break}return s}async exportUserData(n){const r=await this.users.get(n),s=await this.getGoalsByUser(n),i=await this.progress.where("userId").equals(n).toArray(),o=await this.achievements.toArray();return{user:r,goals:s,progress:i,achievements:o,exportedAt:new Date().toISOString()}}async createNotification(n){const r=crypto.randomUUID();return await this.notifications.add({...n,id:r,createdAt:new Date}),r}async getNotificationsByUser(n){return await this.notifications.where("userId").equals(n).reverse().sortBy("createdAt")}async markNotificationAsRead(n){await this.notifications.update(n,{read:!0})}async deleteNotification(n){await this.notifications.delete(n)}async saveSpreadsheetData(n){const r=crypto.randomUUID();return await this.spreadsheetData.add({...n,id:r,createdAt:new Date}),r}async getSpreadsheetDataByGoal(n){return await this.spreadsheetData.where("goalId").equals(n).sortBy("day")}async updateSpreadsheetDay(n,r,s){const i=await this.spreadsheetData.where({goalId:n,day:r}).first();if(i)await this.spreadsheetData.update(i.id,{completed:s});else{const o=await this.goals.get(n);o&&await this.saveSpreadsheetData({goalId:n,userId:o.userId,day:r,date:new Date,requiredAmount:0,cumulativeAmount:0,completed:s,percentage:0})}}async updateSpreadsheetData(n){const r=await this.spreadsheetData.where({goalId:n.goalId,day:n.day}).first();r?await this.spreadsheetData.update(r.id,{completed:n.completed}):await this.saveSpreadsheetData({goalId:n.goalId,userId:n.userId,day:n.day,date:new Date,requiredAmount:0,cumulativeAmount:0,completed:n.completed,percentage:0})}async clearSpreadsheetData(n){await this.spreadsheetData.where("goalId").equals(n).delete()}async deleteUserData(n){await this.transaction("rw",[this.users,this.goals,this.progress,this.milestones,this.notifications,this.spreadsheetData],async()=>{const s=(await this.getGoalsByUser(n)).map(i=>i.id);await this.users.delete(n),await this.goals.where("userId").equals(n).delete(),await this.progress.where("userId").equals(n).delete(),await this.notifications.where("userId").equals(n).delete(),await this.spreadsheetData.where("userId").equals(n).delete();for(const i of s)await this.milestones.where("goalId").equals(i).delete()})}}const Ln=new Qj;var x1={};/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const U2=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=s&63|128):(s&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=s&63|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=s&63|128)}return e},e3=function(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=t[n++];e[r++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=t[n++],o=t[n++],l=t[n++],c=((s&7)<<18|(i&63)<<12|(o&63)<<6|l&63)-65536;e[r++]=String.fromCharCode(55296+(c>>10)),e[r++]=String.fromCharCode(56320+(c&1023))}else{const i=t[n++],o=t[n++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|o&63)}}return e.join("")},z2={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s<t.length;s+=3){const i=t[s],o=s+1<t.length,l=o?t[s+1]:0,c=s+2<t.length,d=c?t[s+2]:0,f=i>>2,m=(i&3)<<4|l>>4;let g=(l&15)<<2|d>>6,v=d&63;c||(v=64,o||(g=64)),r.push(n[f],n[m],n[g],n[v])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(U2(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):e3(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<t.length;){const i=n[t.charAt(s++)],l=s<t.length?n[t.charAt(s)]:0;++s;const d=s<t.length?n[t.charAt(s)]:64;++s;const m=s<t.length?n[t.charAt(s)]:64;if(++s,i==null||l==null||d==null||m==null)throw new t3;const g=i<<2|l>>4;if(r.push(g),d!==64){const v=l<<4&240|d>>2;if(r.push(v),m!==64){const N=d<<6&192|m;r.push(N)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class t3 extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const n3=function(t){const e=U2(t);return z2.encodeByteArray(e,!0)},W2=function(t){return n3(t).replace(/\./g,"")},r3=function(t){try{return z2.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
* @license
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function s3(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
* @license
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const i3=()=>s3().__FIREBASE_DEFAULTS__,a3=()=>{if(typeof process>"u"||typeof x1>"u")return;const t=x1.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},o3=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&r3(t[1]);return e&&JSON.parse(e)},l3=()=>{try{return i3()||a3()||o3()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},$2=()=>{var t;return(t=l3())===null||t===void 0?void 0:t.config};/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class c3{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}}function H2(){try{return typeof indexedDB=="object"}catch{return!1}}function K2(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var i;e(((i=s.error)===null||i===void 0?void 0:i.message)||"")}}catch(n){e(n)}})}function u3(){return!(typeof navigator>"u"||!navigator.cookieEnabled)}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const d3="FirebaseError";class Ul extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=d3,Object.setPrototypeOf(this,Ul.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Zh.prototype.create)}}class Zh{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},s=`${this.service}/${e}`,i=this.errors[e],o=i?h3(i,r):"Error",l=`${this.serviceName}: ${o} (${s}).`;return new Ul(s,l,r)}}function h3(t,e){return t.replace(f3,(n,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const f3=/\{\$([^}]+)}/g;function $p(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const s of n){if(!r.includes(s))return!1;const i=t[s],o=e[s];if(b1(i)&&b1(o)){if(!$p(i,o))return!1}else if(i!==o)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function b1(t){return t!==null&&typeof t=="object"}/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function sg(t){return t&&t._delegate?t._delegate:t}class Vo{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const xl="[DEFAULT]";/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class p3{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const r=new c3;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:n});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;const r=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),s=(n=e==null?void 0:e.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(i){if(s)return null;throw i}else{if(s)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(g3(e))try{this.getOrInitializeService({instanceIdentifier:xl})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(n);try{const i=this.getOrInitializeService({instanceIdentifier:s});r.resolve(i)}catch{}}}}clearInstance(e=xl){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=xl){return this.instances.has(e)}getOptions(e=xl){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[i,o]of this.instancesDeferred.entries()){const l=this.normalizeInstanceIdentifier(i);r===l&&o.resolve(s)}return s}onInit(e,n){var r;const s=this.normalizeInstanceIdentifier(n),i=(r=this.onInitCallbacks.get(s))!==null&&r!==void 0?r:new Set;i.add(e),this.onInitCallbacks.set(s,i);const o=this.instances.get(s);return o&&e(o,s),()=>{i.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const s of r)try{s(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:m3(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=xl){return this.component?this.component.multipleInstances?e:xl:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function m3(t){return t===xl?void 0:t}function g3(t){return t.instantiationMode==="EAGER"}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class v3{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const n=new p3(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var Qn;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(Qn||(Qn={}));const y3={debug:Qn.DEBUG,verbose:Qn.VERBOSE,info:Qn.INFO,warn:Qn.WARN,error:Qn.ERROR,silent:Qn.SILENT},x3=Qn.INFO,b3={[Qn.DEBUG]:"log",[Qn.VERBOSE]:"log",[Qn.INFO]:"info",[Qn.WARN]:"warn",[Qn.ERROR]:"error"},w3=(t,e,...n)=>{if(e<t.logLevel)return;const r=new Date().toISOString(),s=b3[e];if(s)console[s](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class N3{constructor(e){this.name=e,this._logLevel=x3,this._logHandler=w3,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in Qn))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?y3[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,Qn.DEBUG,...e),this._logHandler(this,Qn.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,Qn.VERBOSE,...e),this._logHandler(this,Qn.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,Qn.INFO,...e),this._logHandler(this,Qn.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,Qn.WARN,...e),this._logHandler(this,Qn.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,Qn.ERROR,...e),this._logHandler(this,Qn.ERROR,...e)}}const j3=(t,e)=>e.some(n=>t instanceof n);let w1,N1;function S3(){return w1||(w1=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function k3(){return N1||(N1=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const G2=new WeakMap,Hp=new WeakMap,Y2=new WeakMap,Kf=new WeakMap,ig=new WeakMap;function _3(t){const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("success",i),t.removeEventListener("error",o)},i=()=>{n(Ga(t.result)),s()},o=()=>{r(t.error),s()};t.addEventListener("success",i),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&G2.set(n,t)}).catch(()=>{}),ig.set(e,t),e}function A3(t){if(Hp.has(t))return;const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",o),t.removeEventListener("abort",o)},i=()=>{n(),s()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",i),t.addEventListener("error",o),t.addEventListener("abort",o)});Hp.set(t,e)}let Kp={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return Hp.get(t);if(e==="objectStoreNames")return t.objectStoreNames||Y2.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Ga(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function P3(t){Kp=t(Kp)}function C3(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(Gf(this),e,...n);return Y2.set(r,e.sort?e.sort():[e]),Ga(r)}:k3().includes(t)?function(...e){return t.apply(Gf(this),e),Ga(G2.get(this))}:function(...e){return Ga(t.apply(Gf(this),e))}}function T3(t){return typeof t=="function"?C3(t):(t instanceof IDBTransaction&&A3(t),j3(t,S3())?new Proxy(t,Kp):t)}function Ga(t){if(t instanceof IDBRequest)return _3(t);if(Kf.has(t))return Kf.get(t);const e=T3(t);return e!==t&&(Kf.set(t,e),ig.set(e,t)),e}const Gf=t=>ig.get(t);function Xh(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),l=Ga(o);return r&&o.addEventListener("upgradeneeded",c=>{r(Ga(o.result),c.oldVersion,c.newVersion,Ga(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),l.then(c=>{i&&c.addEventListener("close",()=>i()),s&&c.addEventListener("versionchange",d=>s(d.oldVersion,d.newVersion,d))}).catch(()=>{}),l}function Yf(t,{blocked:e}={}){const n=indexedDB.deleteDatabase(t);return e&&n.addEventListener("blocked",r=>e(r.oldVersion,r)),Ga(n).then(()=>{})}const L3=["get","getKey","getAll","getAllKeys","count"],D3=["put","add","delete","clear"],Zf=new Map;function j1(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Zf.get(e))return Zf.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=D3.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||L3.includes(n)))return;const i=async function(o,...l){const c=this.transaction(o,s?"readwrite":"readonly");let d=c.store;return r&&(d=d.index(l.shift())),(await Promise.all([d[n](...l),s&&c.done]))[0]};return Zf.set(e,i),i}P3(t=>({...t,get:(e,n,r)=>j1(e,n)||t.get(e,n,r),has:(e,n)=>!!j1(e,n)||t.has(e,n)}));/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class I3{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(M3(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function M3(t){const e=t.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Gp="@firebase/app",S1="0.10.13";/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const to=new N3("@firebase/app"),E3="@firebase/app-compat",O3="@firebase/analytics-compat",R3="@firebase/analytics",F3="@firebase/app-check-compat",B3="@firebase/app-check",V3="@firebase/auth",q3="@firebase/auth-compat",U3="@firebase/database",z3="@firebase/data-connect",W3="@firebase/database-compat",$3="@firebase/functions",H3="@firebase/functions-compat",K3="@firebase/installations",G3="@firebase/installations-compat",Y3="@firebase/messaging",Z3="@firebase/messaging-compat",X3="@firebase/performance",J3="@firebase/performance-compat",Q3="@firebase/remote-config",eS="@firebase/remote-config-compat",tS="@firebase/storage",nS="@firebase/storage-compat",rS="@firebase/firestore",sS="@firebase/vertexai-preview",iS="@firebase/firestore-compat",aS="firebase";/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const mh="[DEFAULT]",oS={[Gp]:"fire-core",[E3]:"fire-core-compat",[R3]:"fire-analytics",[O3]:"fire-analytics-compat",[B3]:"fire-app-check",[F3]:"fire-app-check-compat",[V3]:"fire-auth",[q3]:"fire-auth-compat",[U3]:"fire-rtdb",[z3]:"fire-data-connect",[W3]:"fire-rtdb-compat",[$3]:"fire-fn",[H3]:"fire-fn-compat",[K3]:"fire-iid",[G3]:"fire-iid-compat",[Y3]:"fire-fcm",[Z3]:"fire-fcm-compat",[X3]:"fire-perf",[J3]:"fire-perf-compat",[Q3]:"fire-rc",[eS]:"fire-rc-compat",[tS]:"fire-gcs",[nS]:"fire-gcs-compat",[rS]:"fire-fst",[iS]:"fire-fst-compat",[sS]:"fire-vertex","fire-js":"fire-js",[aS]:"fire-js-all"};/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const _u=new Map,Z2=new Map,gh=new Map;function Yp(t,e){try{t.container.addComponent(e)}catch(n){to.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function qo(t){const e=t.name;if(gh.has(e))return to.debug(`There were multiple attempts to register component ${e}.`),!1;gh.set(e,t);for(const n of _u.values())Yp(n,t);for(const n of Z2.values())Yp(n,t);return!0}function Jh(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const lS={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},Fo=new Zh("app","Firebase",lS);/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class cS{constructor(e,n,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new Vo("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw Fo.create("app-deleted",{appName:this._name})}}function ag(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r=Object.assign({name:mh,automaticDataCollectionEnabled:!1},e),s=r.name;if(typeof s!="string"||!s)throw Fo.create("bad-app-name",{appName:String(s)});if(n||(n=$2()),!n)throw Fo.create("no-options");const i=_u.get(s);if(i){if($p(n,i.options)&&$p(r,i.config))return i;throw Fo.create("duplicate-app",{appName:s})}const o=new v3(s);for(const c of gh.values())o.addComponent(c);const l=new cS(n,r,o);return _u.set(s,l),l}function X2(t=mh){const e=_u.get(t);if(!e&&t===mh&&$2())return ag();if(!e)throw Fo.create("no-app",{appName:t});return e}function Ya(t,e,n){var r;let s=(r=oS[t])!==null&&r!==void 0?r:t;n&&(s+=`-${n}`);const i=s.match(/\s|\//),o=e.match(/\s|\//);if(i||o){const l=[`Unable to register library "${s}" with version "${e}":`];i&&l.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&o&&l.push("and"),o&&l.push(`version name "${e}" contains illegal characters (whitespace or "/")`),to.warn(l.join(" "));return}qo(new Vo(`${s}-version`,()=>({library:s,version:e}),"VERSION"))}/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const uS="firebase-heartbeat-database",dS=1,Au="firebase-heartbeat-store";let Xf=null;function J2(){return Xf||(Xf=Xh(uS,dS,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(Au)}catch(n){console.warn(n)}}}}).catch(t=>{throw Fo.create("idb-open",{originalErrorMessage:t.message})})),Xf}async function hS(t){try{const n=(await J2()).transaction(Au),r=await n.objectStore(Au).get(Q2(t));return await n.done,r}catch(e){if(e instanceof Ul)to.warn(e.message);else{const n=Fo.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});to.warn(n.message)}}}async function k1(t,e){try{const r=(await J2()).transaction(Au,"readwrite");await r.objectStore(Au).put(e,Q2(t)),await r.done}catch(n){if(n instanceof Ul)to.warn(n.message);else{const r=Fo.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});to.warn(r.message)}}}function Q2(t){return`${t.name}!${t.options.appId}`}/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const fS=1024,pS=30*24*60*60*1e3;class mS{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new vS(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,n;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=_1();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)===null||n===void 0?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(o=>o.date===i)?void 0:(this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(o=>{const l=new Date(o.date).valueOf();return Date.now()-l<=pS}),this._storage.overwrite(this._heartbeatsCache))}catch(r){to.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=_1(),{heartbeatsToSend:r,unsentEntries:s}=gS(this._heartbeatsCache.heartbeats),i=W2(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(n){return to.warn(n),""}}}function _1(){return new Date().toISOString().substring(0,10)}function gS(t,e=fS){const n=[];let r=t.slice();for(const s of t){const i=n.find(o=>o.agent===s.agent);if(i){if(i.dates.push(s.date),A1(n)>e){i.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),A1(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class vS{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return H2()?K2().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await hS(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){const s=await this.read();return k1(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:s.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){const s=await this.read();return k1(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}else return}}function A1(t){return W2(JSON.stringify({version:2,heartbeats:t})).length}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function yS(t){qo(new Vo("platform-logger",e=>new I3(e),"PRIVATE")),qo(new Vo("heartbeat",e=>new mS(e),"PRIVATE")),Ya(Gp,S1,t),Ya(Gp,S1,"esm2017"),Ya("fire-js","")}yS("");var xS="firebase",bS="10.14.1";/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/Ya(xS,bS,"app");const wS=Object.freeze(Object.defineProperty({__proto__:null,FirebaseError:Ul,_DEFAULT_ENTRY_NAME:mh,_addComponent:Yp,_apps:_u,_components:gh,_getProvider:Jh,_registerComponent:qo,_serverApps:Z2,getApp:X2,initializeApp:ag,registerVersion:Ya},Symbol.toStringTag,{value:"Module"})),ex="@firebase/installations",og="0.6.9";/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const tx=1e4,nx=`w:${og}`,rx="FIS_v2",NS="https://firebaseinstallations.googleapis.com/v1",jS=60*60*1e3,SS="installations",kS="Installations";/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const _S={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."},Ol=new Zh(SS,kS,_S);function sx(t){return t instanceof Ul&&t.code.includes("request-failed")}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function ix({projectId:t}){return`${NS}/projects/${t}/installations`}function ax(t){return{token:t.token,requestStatus:2,expiresIn:PS(t.expiresIn),creationTime:Date.now()}}async function ox(t,e){const r=(await e.json()).error;return Ol.create("request-failed",{requestName:t,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})}function lx({apiKey:t}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function AS(t,{refreshToken:e}){const n=lx(t);return n.append("Authorization",CS(e)),n}async function cx(t){const e=await t();return e.status>=500&&e.status<600?t():e}function PS(t){return Number(t.replace("s","000"))}function CS(t){return`${rx} ${t}`}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function TS({appConfig:t,heartbeatServiceProvider:e},{fid:n}){const r=ix(t),s=lx(t),i=e.getImmediate({optional:!0});if(i){const d=await i.getHeartbeatsHeader();d&&s.append("x-firebase-client",d)}const o={fid:n,authVersion:rx,appId:t.appId,sdkVersion:nx},l={method:"POST",headers:s,body:JSON.stringify(o)},c=await cx(()=>fetch(r,l));if(c.ok){const d=await c.json();return{fid:d.fid||n,registrationStatus:2,refreshToken:d.refreshToken,authToken:ax(d.authToken)}}else throw await ox("Create Installation",c)}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function ux(t){return new Promise(e=>{setTimeout(e,t)})}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function LS(t){return btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_")}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const DS=/^[cdef][\w-]{21}$/,Zp="";function IS(){try{const t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;const n=MS(t);return DS.test(n)?n:Zp}catch{return Zp}}function MS(t){return LS(t).substr(0,22)}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function Qh(t){return`${t.appName}!${t.appId}`}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const dx=new Map;function hx(t,e){const n=Qh(t);fx(n,e),ES(n,e)}function fx(t,e){const n=dx.get(t);if(n)for(const r of n)r(e)}function ES(t,e){const n=OS();n&&n.postMessage({key:t,fid:e}),RS()}let Tl=null;function OS(){return!Tl&&"BroadcastChannel"in self&&(Tl=new BroadcastChannel("[Firebase] FID Change"),Tl.onmessage=t=>{fx(t.data.key,t.data.fid)}),Tl}function RS(){dx.size===0&&Tl&&(Tl.close(),Tl=null)}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const FS="firebase-installations-database",BS=1,Rl="firebase-installations-store";let Jf=null;function lg(){return Jf||(Jf=Xh(FS,BS,{upgrade:(t,e)=>{switch(e){case 0:t.createObjectStore(Rl)}}})),Jf}async function vh(t,e){const n=Qh(t),s=(await lg()).transaction(Rl,"readwrite"),i=s.objectStore(Rl),o=await i.get(n);return await i.put(e,n),await s.done,(!o||o.fid!==e.fid)&&hx(t,e.fid),e}async function px(t){const e=Qh(t),r=(await lg()).transaction(Rl,"readwrite");await r.objectStore(Rl).delete(e),await r.done}async function ef(t,e){const n=Qh(t),s=(await lg()).transaction(Rl,"readwrite"),i=s.objectStore(Rl),o=await i.get(n),l=e(o);return l===void 0?await i.delete(n):await i.put(l,n),await s.done,l&&(!o||o.fid!==l.fid)&&hx(t,l.fid),l}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function cg(t){let e;const n=await ef(t.appConfig,r=>{const s=VS(r),i=qS(t,s);return e=i.registrationPromise,i.installationEntry});return n.fid===Zp?{installationEntry:await e}:{installationEntry:n,registrationPromise:e}}function VS(t){const e=t||{fid:IS(),registrationStatus:0};return mx(e)}function qS(t,e){if(e.registrationStatus===0){if(!navigator.onLine){const s=Promise.reject(Ol.create("app-offline"));return{installationEntry:e,registrationPromise:s}}const n={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},r=US(t,n);return{installationEntry:n,registrationPromise:r}}else return e.registrationStatus===1?{installationEntry:e,registrationPromise:zS(t)}:{installationEntry:e}}async function US(t,e){try{const n=await TS(t,e);return vh(t.appConfig,n)}catch(n){throw sx(n)&&n.customData.serverCode===409?await px(t.appConfig):await vh(t.appConfig,{fid:e.fid,registrationStatus:0}),n}}async function zS(t){let e=await P1(t.appConfig);for(;e.registrationStatus===1;)await ux(100),e=await P1(t.appConfig);if(e.registrationStatus===0){const{installationEntry:n,registrationPromise:r}=await cg(t);return r||n}return e}function P1(t){return ef(t,e=>{if(!e)throw Ol.create("installation-not-found");return mx(e)})}function mx(t){return WS(t)?{fid:t.fid,registrationStatus:0}:t}function WS(t){return t.registrationStatus===1&&t.registrationTime+tx<Date.now()}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function $S({appConfig:t,heartbeatServiceProvider:e},n){const r=HS(t,n),s=AS(t,n),i=e.getImmediate({optional:!0});if(i){const d=await i.getHeartbeatsHeader();d&&s.append("x-firebase-client",d)}const o={installation:{sdkVersion:nx,appId:t.appId}},l={method:"POST",headers:s,body:JSON.stringify(o)},c=await cx(()=>fetch(r,l));if(c.ok){const d=await c.json();return ax(d)}else throw await ox("Generate Auth Token",c)}function HS(t,{fid:e}){return`${ix(t)}/${e}/authTokens:generate`}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function ug(t,e=!1){let n;const r=await ef(t.appConfig,i=>{if(!gx(i))throw Ol.create("not-registered");const o=i.authToken;if(!e&&YS(o))return i;if(o.requestStatus===1)return n=KS(t,e),i;{if(!navigator.onLine)throw Ol.create("app-offline");const l=XS(i);return n=GS(t,l),l}});return n?await n:r.authToken}async function KS(t,e){let n=await C1(t.appConfig);for(;n.authToken.requestStatus===1;)await ux(100),n=await C1(t.appConfig);const r=n.authToken;return r.requestStatus===0?ug(t,e):r}function C1(t){return ef(t,e=>{if(!gx(e))throw Ol.create("not-registered");const n=e.authToken;return JS(n)?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e})}async function GS(t,e){try{const n=await $S(t,e),r=Object.assign(Object.assign({},e),{authToken:n});return await vh(t.appConfig,r),n}catch(n){if(sx(n)&&(n.customData.serverCode===401||n.customData.serverCode===404))await px(t.appConfig);else{const r=Object.assign(Object.assign({},e),{authToken:{requestStatus:0}});await vh(t.appConfig,r)}throw n}}function gx(t){return t!==void 0&&t.registrationStatus===2}function YS(t){return t.requestStatus===2&&!ZS(t)}function ZS(t){const e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+jS}function XS(t){const e={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},t),{authToken:e})}function JS(t){return t.requestStatus===1&&t.requestTime+tx<Date.now()}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function QS(t){const e=t,{installationEntry:n,registrationPromise:r}=await cg(e);return r?r.catch(console.error):ug(e).catch(console.error),n.fid}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function e6(t,e=!1){const n=t;return await t6(n),(await ug(n,e)).token}async function t6(t){const{registrationPromise:e}=await cg(t);e&&await e}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function n6(t){if(!t||!t.options)throw Qf("App Configuration");if(!t.name)throw Qf("App Name");const e=["projectId","apiKey","appId"];for(const n of e)if(!t.options[n])throw Qf(n);return{appName:t.name,projectId:t.options.projectId,apiKey:t.options.apiKey,appId:t.options.appId}}function Qf(t){return Ol.create("missing-app-config-values",{valueName:t})}/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const vx="installations",r6="installations-internal",s6=t=>{const e=t.getProvider("app").getImmediate(),n=n6(e),r=Jh(e,"heartbeat");return{app:e,appConfig:n,heartbeatServiceProvider:r,_delete:()=>Promise.resolve()}},i6=t=>{const e=t.getProvider("app").getImmediate(),n=Jh(e,vx).getImmediate();return{getId:()=>QS(n),getToken:s=>e6(n,s)}};function a6(){qo(new Vo(vx,s6,"PUBLIC")),qo(new Vo(r6,i6,"PRIVATE"))}a6();Ya(ex,og);Ya(ex,og,"esm2017");/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const o6="/firebase-messaging-sw.js",l6="/firebase-cloud-messaging-push-scope",yx="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",c6="https://fcmregistrations.googleapis.com/v1",xx="google.c.a.c_id",u6="google.c.a.c_l",d6="google.c.a.ts",h6="google.c.a.e";var T1;(function(t){t[t.DATA_MESSAGE=1]="DATA_MESSAGE",t[t.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"})(T1||(T1={}));/**
* @license
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/var Pu;(function(t){t.PUSH_RECEIVED="push-received",t.NOTIFICATION_CLICKED="notification-clicked"})(Pu||(Pu={}));/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function Ha(t){const e=new Uint8Array(t);return btoa(String.fromCharCode(...e)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function f6(t){const e="=".repeat((4-t.length%4)%4),n=(t+e).replace(/\-/g,"+").replace(/_/g,"/"),r=atob(n),s=new Uint8Array(r.length);for(let i=0;i<r.length;++i)s[i]=r.charCodeAt(i);return s}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const ep="fcm_token_details_db",p6=5,L1="fcm_token_object_Store";async function m6(t){if("databases"in indexedDB&&!(await indexedDB.databases()).map(i=>i.name).includes(ep))return null;let e=null;return(await Xh(ep,p6,{upgrade:async(r,s,i,o)=>{var l;if(s<2||!r.objectStoreNames.contains(L1))return;const c=o.objectStore(L1),d=await c.index("fcmSenderId").get(t);if(await c.clear(),!!d){if(s===2){const f=d;if(!f.auth||!f.p256dh||!f.endpoint)return;e={token:f.fcmToken,createTime:(l=f.createTime)!==null&&l!==void 0?l:Date.now(),subscriptionOptions:{auth:f.auth,p256dh:f.p256dh,endpoint:f.endpoint,swScope:f.swScope,vapidKey:typeof f.vapidKey=="string"?f.vapidKey:Ha(f.vapidKey)}}}else if(s===3){const f=d;e={token:f.fcmToken,createTime:f.createTime,subscriptionOptions:{auth:Ha(f.auth),p256dh:Ha(f.p256dh),endpoint:f.endpoint,swScope:f.swScope,vapidKey:Ha(f.vapidKey)}}}else if(s===4){const f=d;e={token:f.fcmToken,createTime:f.createTime,subscriptionOptions:{auth:Ha(f.auth),p256dh:Ha(f.p256dh),endpoint:f.endpoint,swScope:f.swScope,vapidKey:Ha(f.vapidKey)}}}}}})).close(),await Yf(ep),await Yf("fcm_vapid_details_db"),await Yf("undefined"),g6(e)?e:null}function g6(t){if(!t||!t.subscriptionOptions)return!1;const{subscriptionOptions:e}=t;return typeof t.createTime=="number"&&t.createTime>0&&typeof t.token=="string"&&t.token.length>0&&typeof e.auth=="string"&&e.auth.length>0&&typeof e.p256dh=="string"&&e.p256dh.length>0&&typeof e.endpoint=="string"&&e.endpoint.length>0&&typeof e.swScope=="string"&&e.swScope.length>0&&typeof e.vapidKey=="string"&&e.vapidKey.length>0}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const v6="firebase-messaging-database",y6=1,Cu="firebase-messaging-store";let tp=null;function bx(){return tp||(tp=Xh(v6,y6,{upgrade:(t,e)=>{switch(e){case 0:t.createObjectStore(Cu)}}})),tp}async function x6(t){const e=wx(t),r=await(await bx()).transaction(Cu).objectStore(Cu).get(e);if(r)return r;{const s=await m6(t.appConfig.senderId);if(s)return await dg(t,s),s}}async function dg(t,e){const n=wx(t),s=(await bx()).transaction(Cu,"readwrite");return await s.objectStore(Cu).put(e,n),await s.done,e}function wx({appConfig:t}){return t.appId}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const b6={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},vs=new Zh("messaging","Messaging",b6);/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function w6(t,e){const n=await fg(t),r=Nx(e),s={method:"POST",headers:n,body:JSON.stringify(r)};let i;try{i=await(await fetch(hg(t.appConfig),s)).json()}catch(o){throw vs.create("token-subscribe-failed",{errorInfo:o==null?void 0:o.toString()})}if(i.error){const o=i.error.message;throw vs.create("token-subscribe-failed",{errorInfo:o})}if(!i.token)throw vs.create("token-subscribe-no-token");return i.token}async function N6(t,e){const n=await fg(t),r=Nx(e.subscriptionOptions),s={method:"PATCH",headers:n,body:JSON.stringify(r)};let i;try{i=await(await fetch(`${hg(t.appConfig)}/${e.token}`,s)).json()}catch(o){throw vs.create("token-update-failed",{errorInfo:o==null?void 0:o.toString()})}if(i.error){const o=i.error.message;throw vs.create("token-update-failed",{errorInfo:o})}if(!i.token)throw vs.create("token-update-no-token");return i.token}async function j6(t,e){const r={method:"DELETE",headers:await fg(t)};try{const i=await(await fetch(`${hg(t.appConfig)}/${e}`,r)).json();if(i.error){const o=i.error.message;throw vs.create("token-unsubscribe-failed",{errorInfo:o})}}catch(s){throw vs.create("token-unsubscribe-failed",{errorInfo:s==null?void 0:s.toString()})}}function hg({projectId:t}){return`${c6}/projects/${t}/registrations`}async function fg({appConfig:t,installations:e}){const n=await e.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function Nx({p256dh:t,auth:e,endpoint:n,vapidKey:r}){const s={web:{endpoint:n,auth:e,p256dh:t}};return r!==yx&&(s.web.applicationPubKey=r),s}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const S6=7*24*60*60*1e3;async function k6(t){const e=await A6(t.swRegistration,t.vapidKey),n={vapidKey:t.vapidKey,swScope:t.swRegistration.scope,endpoint:e.endpoint,auth:Ha(e.getKey("auth")),p256dh:Ha(e.getKey("p256dh"))},r=await x6(t.firebaseDependencies);if(r){if(P6(r.subscriptionOptions,n))return Date.now()>=r.createTime+S6?_6(t,{token:r.token,createTime:Date.now(),subscriptionOptions:n}):r.token;try{await j6(t.firebaseDependencies,r.token)}catch(s){console.warn(s)}return D1(t.firebaseDependencies,n)}else return D1(t.firebaseDependencies,n)}async function _6(t,e){try{const n=await N6(t.firebaseDependencies,e),r=Object.assign(Object.assign({},e),{token:n,createTime:Date.now()});return await dg(t.firebaseDependencies,r),n}catch(n){throw n}}async function D1(t,e){const r={token:await w6(t,e),createTime:Date.now(),subscriptionOptions:e};return await dg(t,r),r.token}async function A6(t,e){const n=await t.pushManager.getSubscription();return n||t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:f6(e)})}function P6(t,e){const n=e.vapidKey===t.vapidKey,r=e.endpoint===t.endpoint,s=e.auth===t.auth,i=e.p256dh===t.p256dh;return n&&r&&s&&i}/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function I1(t){const e={from:t.from,collapseKey:t.collapse_key,messageId:t.fcmMessageId};return C6(e,t),T6(e,t),L6(e,t),e}function C6(t,e){if(!e.notification)return;t.notification={};const n=e.notification.title;n&&(t.notification.title=n);const r=e.notification.body;r&&(t.notification.body=r);const s=e.notification.image;s&&(t.notification.image=s);const i=e.notification.icon;i&&(t.notification.icon=i)}function T6(t,e){e.data&&(t.data=e.data)}function L6(t,e){var n,r,s,i,o;if(!e.fcmOptions&&!(!((n=e.notification)===null||n===void 0)&&n.click_action))return;t.fcmOptions={};const l=(s=(r=e.fcmOptions)===null||r===void 0?void 0:r.link)!==null&&s!==void 0?s:(i=e.notification)===null||i===void 0?void 0:i.click_action;l&&(t.fcmOptions.link=l);const c=(o=e.fcmOptions)===null||o===void 0?void 0:o.analytics_label;c&&(t.fcmOptions.analyticsLabel=c)}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function D6(t){return typeof t=="object"&&!!t&&xx in t}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function I6(t){if(!t||!t.options)throw np("App Configuration Object");if(!t.name)throw np("App Name");const e=["projectId","apiKey","appId","messagingSenderId"],{options:n}=t;for(const r of e)if(!n[r])throw np(r);return{appName:t.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}function np(t){return vs.create("missing-app-config-values",{valueName:t})}/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class M6{constructor(e,n,r){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const s=I6(e);this.firebaseDependencies={app:e,appConfig:s,installations:n,analyticsProvider:r}}_delete(){return Promise.resolve()}}/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function E6(t){try{t.swRegistration=await navigator.serviceWorker.register(o6,{scope:l6}),t.swRegistration.update().catch(()=>{})}catch(e){throw vs.create("failed-service-worker-registration",{browserErrorMessage:e==null?void 0:e.message})}}/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function O6(t,e){if(!e&&!t.swRegistration&&await E6(t),!(!e&&t.swRegistration)){if(!(e instanceof ServiceWorkerRegistration))throw vs.create("invalid-sw-registration");t.swRegistration=e}}/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function R6(t,e){e?t.vapidKey=e:t.vapidKey||(t.vapidKey=yx)}/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function jx(t,e){if(!navigator)throw vs.create("only-available-in-window");if(Notification.permission==="default"&&await Notification.requestPermission(),Notification.permission!=="granted")throw vs.create("permission-blocked");return await R6(t,e==null?void 0:e.vapidKey),await O6(t,e==null?void 0:e.serviceWorkerRegistration),k6(t)}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function F6(t,e,n){const r=B6(e);(await t.firebaseDependencies.analyticsProvider.get()).logEvent(r,{message_id:n[xx],message_name:n[u6],message_time:n[d6],message_device_time:Math.floor(Date.now()/1e3)})}function B6(t){switch(t){case Pu.NOTIFICATION_CLICKED:return"notification_open";case Pu.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function V6(t,e){const n=e.data;if(!n.isFirebaseMessaging)return;t.onMessageHandler&&n.messageType===Pu.PUSH_RECEIVED&&(typeof t.onMessageHandler=="function"?t.onMessageHandler(I1(n)):t.onMessageHandler.next(I1(n)));const r=n.data;D6(r)&&r[h6]==="1"&&await F6(t,n.messageType,r)}const M1="@firebase/messaging",E1="0.12.12";/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const q6=t=>{const e=new M6(t.getProvider("app").getImmediate(),t.getProvider("installations-internal").getImmediate(),t.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",n=>V6(e,n)),e},U6=t=>{const e=t.getProvider("messaging").getImmediate();return{getToken:r=>jx(e,r)}};function z6(){qo(new Vo("messaging",q6,"PUBLIC")),qo(new Vo("messaging-internal",U6,"PRIVATE")),Ya(M1,E1),Ya(M1,E1,"esm2017")}/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/async function pg(){try{await K2()}catch{return!1}return typeof window<"u"&&H2()&&u3()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function W6(t,e){if(!navigator)throw vs.create("only-available-in-window");return t.onMessageHandler=e,()=>{t.onMessageHandler=null}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function mg(t=X2()){return pg().then(e=>{if(!e)throw vs.create("unsupported-browser")},e=>{throw vs.create("indexed-db-unsupported")}),Jh(sg(t),"messaging").getImmediate()}async function gg(t,e){return t=sg(t),jx(t,e)}function vg(t,e){return t=sg(t),W6(t,e)}z6();const $6=Object.freeze(Object.defineProperty({__proto__:null,getMessaging:mg,getToken:gg,isSupported:pg,onMessage:vg},Symbol.toStringTag,{value:"Module"})),H6={apiKey:"AIzaSyBPE9kaWcLofrUh_dT_pswPDNkEhVtSBjU",authDomain:"progresspulse-5c1c9.firebaseapp.com",projectId:"progresspulse-5c1c9",storageBucket:"progresspulse-5c1c9.firebasestorage.app",messagingSenderId:"1020367919471",appId:"1:1020367919471:web:245125af8144bac9e3b09a"},K6="BEl62iUYgUivxIkv69yViEuiBIa40HI80NqIUHI80NqIUHI80NqIUHI80NqIUHI80NqIUHI80NqI",Sx=ag(H6);let O1=null;const G6=async()=>{try{return await pg()?(O1=mg(Sx),O1):null}catch(t){return console.log("Firebase messaging not supported:",t),null}};var ea;let Y6=(ea=class{constructor(){Tn(this,"messaging",null);Tn(this,"fcmToken",null);Tn(this,"isNativeApp",!1);this.detectEnvironment(),this.initialize()}static getInstance(){return ea.instance||(ea.instance=new ea),ea.instance}detectEnvironment(){this.isNativeApp=!!(window.median||window.cordova||window.PhoneGap||navigator.userAgent.includes("wv")||navigator.userAgent.includes("Median")),console.log("Environment detected:",this.isNativeApp?"Native App":"Web Browser")}async initialize(){try{this.isNativeApp?await this.initializeNativeNotifications():await this.initializeWebNotifications()}catch(e){console.error("Failed to initialize push notifications:",e)}}async initializeWebNotifications(){try{this.messaging=await G6(),this.messaging&&(this.fcmToken=await gg(this.messaging,{vapidKey:K6}),console.log("FCM Token (Web):",this.fcmToken),vg(this.messaging,e=>{console.log("Foreground message received:",e),this.handleForegroundMessage(e)}))}catch(e){console.error("Web notifications initialization failed:",e)}}async initializeNativeNotifications(){try{window.median&&window.median.push?(console.log("Initializing Median.co push notifications"),window.median.push.register({callback:e=>{this.fcmToken=e,console.log("FCM Token (Native):",e),this.sendTokenToServer(e)},error:e=>{console.error("Native push registration failed:",e)}}),window.median.push.onMessage({callback:e=>{console.log("Native push message received:",e),this.handleNativeMessage(e)}})):await this.initializeWebNotifications()}catch(e){console.error("Native notifications initialization failed:",e),await this.initializeWebNotifications()}}handleForegroundMessage(e){const{notification:n,data:r}=e;Notification.permission==="granted"&&new Notification((n==null?void 0:n.title)||"ProgressPulse",{body:n==null?void 0:n.body,icon:(n==null?void 0:n.icon)||"/pwa-192x192.png",badge:"/pwa-64x64.png",tag:(r==null?void 0:r.tag)||"default",data:r})}handleNativeMessage(e){console.log("Handling native message:",e),e.userId&&Ln.createNotification({userId:e.userId,type:e.type||"general",title:e.title||"ProgressPulse",message:e.body||e.message||"",read:!1,goalId:e.goalId})}async requestPermission(){try{return this.isNativeApp?!0:"Notification"in window?Notification.permission==="granted"?!0:Notification.permission==="denied"?!1:await Notification.requestPermission()==="granted":(console.warn("This browser does not support notifications"),!1)}catch(e){return console.error("Permission request failed:",e),!1}}async getToken(){return this.fcmToken}async sendTokenToServer(e){try{console.log("Token to send to server:",e),localStorage.setItem("fcm_token",e)}catch(n){console.error("Failed to send token to server:",n)}}async sendNotificationToServer(e){var n;try{console.log("Notification data to send to server:",e),this.isNativeApp&&((n=window.median)!=null&&n.push)?window.median.push.showNotification({title:e.title,body:e.body,data:{type:e.type,userId:e.userId,goalId:e.goalId}}):Notification.permission==="granted"&&new Notification(e.title,{body:e.body,icon:"/pwa-192x192.png",badge:"/pwa-64x64.png",tag:e.type||"default"})}catch(r){console.error("Failed to send notification:",r)}}async sendGoalCompletedNotification(e,n){await this.sendNotificationToServer({title:"🏆 Goal Completed!",body:`Congratulations! You've completed "${n}"!`,userId:e,type:"goal_completed"})}async sendDailyReminderNotification(e,n){await this.sendNotificationToServer({title:"⏰ Daily Reminder",body:n,userId:e,type:"daily_reminder"})}async sendProgressUpdateNotification(e,n,r){await this.sendNotificationToServer({title:"📈 Progress Update",body:`Great progress on "${n}"! You're ${r}% complete.`,userId:e,type:"progress_update"})}async sendStreakNotification(e,n){await this.sendNotificationToServer({title:"🔥 Streak Alert!",body:`Amazing! You're on a ${n}-day streak. Keep it going!`,userId:e,type:"streak_notification"})}async scheduleNotification(e){const n=e.scheduledTime.getTime()-Date.now();n>0&&setTimeout(()=>{this.sendNotificationToServer(e)},n)}},Tn(ea,"instance"),ea);const cc=Y6.getInstance(),kl=class kl{constructor(){Tn(this,"scheduledNotifications",new Map);Tn(this,"serviceWorkerRegistration",null);Tn(this,"dailyReminderInterval",null);Tn(this,"vapidPublicKey","BEl62iUYgUivxIkv69yViEuiBIa40HI80NqIUHI80NqIUHI80NqIUHI80NqIUHI80NqIUHI80NqI");Tn(this,"pushSubscription",null);this.initializeServiceWorker(),this.initializeDailyReminders()}static getInstance(){return kl.instance||(kl.instance=new kl),kl.instance}async initializeServiceWorker(){if("serviceWorker"in navigator)try{const e=await navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/"});this.serviceWorkerRegistration=await navigator.serviceWorker.ready,console.log("Service Worker registered successfully"),await this.initializePushSubscription()}catch(e){console.error("Service Worker registration failed:",e);try{this.serviceWorkerRegistration=await navigator.serviceWorker.ready,await this.initializePushSubscription()}catch(n){console.error("Service Worker fallback failed:",n)}}}async initializePushSubscription(){if(this.serviceWorkerRegistration)try{this.pushSubscription=await this.serviceWorkerRegistration.pushManager.getSubscription(),this.pushSubscription||(this.pushSubscription=await this.serviceWorkerRegistration.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:this.urlBase64ToUint8Array(this.vapidPublicKey)}),console.log("Push subscription:",JSON.stringify(this.pushSubscription)))}catch(e){console.error("Failed to initialize push subscription:",e)}}urlBase64ToUint8Array(e){const n="=".repeat((4-e.length%4)%4),r=(e+n).replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(r),i=new Uint8Array(s.length);for(let o=0;o<s.length;++o)i[o]=s.charCodeAt(o);return i}async subscribeToPush(){if(!this.serviceWorkerRegistration)return console.error("Service Worker not available"),null;try{const e=await this.serviceWorkerRegistration.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:this.urlBase64ToUint8Array(this.vapidPublicKey)});return this.pushSubscription=e,e}catch(e){return console.error("Failed to subscribe to push notifications:",e),null}}async sendPushNotification(e){this.serviceWorkerRegistration&&await this.serviceWorkerRegistration.showNotification(e.title,{body:e.body,icon:e.icon||"/pwa-192x192.png",badge:"/pwa-64x64.png",tag:e.tag||"default",requireInteraction:!0,data:{url:e.url}})}initializeDailyReminders(){this.dailyReminderInterval=window.setInterval(()=>{this.checkAndSendDailyReminders()},6e4)}async requestPermission(){if(!("Notification"in window))return console.warn("This browser does not support notifications"),!1;if(Notification.permission==="granted")return!0;if(Notification.permission==="denied")return console.warn("Notification permission denied"),!1;try{if(await Notification.requestPermission()==="granted"){if(console.log("Notification permission granted"),this.serviceWorkerRegistration)try{await this.subscribeToPush()}catch(n){console.warn("Push subscription failed:",n)}return!0}return!1}catch(e){return console.error("Permission request failed:",e),!1}}async showNotification(e,n,r,s,i){const o=await this.requestPermission();if(r&&await Ln.createNotification({userId:r,type:s||"reminder",title:e,message:(n==null?void 0:n.body)||"",read:!1,goalId:i}),!o){console.warn("Notification permission not granted");return}await cc.sendNotificationToServer({title:e,body:(n==null?void 0:n.body)||"",userId:r,type:s,goalId:i}),{...n},await this.sendPushNotification({title:e,body:(n==null?void 0:n.body)||"",tag:n==null?void 0:n.tag,icon:n==null?void 0:n.icon,url:"/"})}async scheduleReminder(e,n){const r=new Date,[s,i]=e.split(":").map(Number),o=new Date(r);o.setHours(s,i,0,0),o<=r&&o.setDate(o.getDate()+1);const l=o.getTime()-r.getTime();setTimeout(()=>{this.showNotification("ProgressPulse Reminder",{body:n,tag:"daily-reminder"})},l)}async showProgressCelebration(e,n){await this.showNotification("🎉 Progress Update!",{body:`Great job! You've made progress on "${e}". Keep it up!`,tag:"progress-celebration"})}async showGoalCompleted(e){await this.showNotification("🏆 Goal Completed!",{body:`Congratulations! You've completed "${e}"!`,tag:"goal-completed"})}async showDailyQuotaReminder(e,n,r){await this.showNotification("📊 Daily Quota Reminder",{body:`Don't forget your daily quota for "${e}": ${n} ${r}`,tag:"daily-quota"})}async showMilestoneAchieved(e,n){await this.showNotification("🎯 Milestone Achieved!",{body:`You've reached ${n} for "${e}"!`,tag:"milestone-achieved"})}async showStreakNotification(e){await this.showNotification("🔥 Streak Alert!",{body:`Amazing! You're on a ${e}-day streak. Keep it going!`,tag:"streak-notification"})}async scheduleDailyQuotaReminders(e,n="09:00",r="18:00"){this.clearAllReminders();for(const s of e)s.category==="finance"&&s.status==="active"&&(this.scheduleNotificationInternal(`morning-${s.id}`,n,()=>{this.showDailyQuotaReminder(s.title,s.dailyTarget||0,s.unit||"")}),this.scheduleNotificationInternal(`evening-${s.id}`,r,()=>{this.showDailyQuotaReminder(s.title,s.dailyTarget||0,s.unit||"")}))}scheduleNotificationInternal(e,n,r){const s=new Date,[i,o]=n.split(":").map(Number),l=new Date(s);l.setHours(i,o,0,0),l<=s&&l.setDate(l.getDate()+1);const c=l.getTime()-s.getTime(),d=setTimeout(r,c);this.scheduledNotifications.set(e,d)}clearAllReminders(){this.scheduledNotifications.forEach(e=>{clearTimeout(e)}),this.scheduledNotifications.clear()}clearReminder(e){const n=this.scheduledNotifications.get(e);n&&(clearTimeout(n),this.scheduledNotifications.delete(e))}async sendAllNotificationTypes(e){const{type:n,title:r,message:s,goalTitle:i,userId:o,...l}=e;switch(n){case"daily_reminder":await this.scheduleReminder(l.time||"09:00",s);break;case"progress_update":await this.showProgressCelebration(i,l.progress);break;case"goal_completed":await this.showGoalCompleted(i);break;case"milestone_achieved":await this.showMilestoneAchieved(i,l.milestone);break;case"daily_quota":await this.showDailyQuotaReminder(i,l.amount,l.unit);break;case"streak_notification":await this.showStreakNotification(l.days);break;default:await this.showNotification(r,{body:s,tag:n},o,n)}}async checkAndSendDailyReminders(){var e,n;try{const r=new Date,s=`${r.getHours().toString().padStart(2,"0")}:${r.getMinutes().toString().padStart(2,"0")}`,i=await Ln.users.toArray();for(const o of i)(e=o.preferences)!=null&&e.notifications&&((n=o.preferences)==null?void 0:n.reminderTime)===s&&await this.showNotification("⏰ Daily Progress Reminder",{body:"Don't forget to update your progress today! Keep your momentum going!",tag:"daily-reminder",requireInteraction:!0},o.id,"reminder")}catch(r){console.error("Failed to check daily reminders:",r)}}async scheduleNotification(e){const n=e.scheduledTime.getTime()-Date.now();if(n>0){const r=setTimeout(async()=>{await this.showNotification(e.title,{body:e.body,tag:e.id,data:e.data}),this.scheduledNotifications.delete(e.id)},n);this.scheduledNotifications.set(e.id,r)}}async cancelScheduledNotification(e){const n=this.scheduledNotifications.get(e);n&&(clearTimeout(n),this.scheduledNotifications.delete(e))}async sendAccountCreatedNotification(e,n){await this.showNotification("🎉 Welcome to ProgressPulse!",{body:`Hi ${n}! Your account has been created successfully. Start tracking your goals now!`,tag:"account-created",requireInteraction:!0},e,"achievement")}async sendGoalCompletedNotification(e,n){await this.showNotification("🏆 Goal Completed!",{body:`Congratulations! You've successfully completed "${n}"!`,tag:"goal-completed",requireInteraction:!0},e,"goal_completed")}async sendSpreadsheetCompletedNotification(e,n){await this.showNotification("📊 Daily Quota Completed!",{body:`Great job! You've completed today's quota for "${n}"!`,tag:"spreadsheet-completed",requireInteraction:!0},e,"daily_quota")}async sendAchievementUnlockedNotification(e,n){await this.showNotification("🏅 Achievement Unlocked!",{body:`You've unlocked the "${n}" achievement! Keep up the great work!`,tag:"achievement-unlocked",requireInteraction:!0},e,"achievement")}destroy(){this.dailyReminderInterval&&(clearInterval(this.dailyReminderInterval),this.dailyReminderInterval=null),this.clearAllReminders()}};Tn(kl,"instance");let yh=kl;const Dl=yh.getInstance(),Xp=Object.freeze(Object.defineProperty({__proto__:null,NotificationService:yh,notificationService:Dl},Symbol.toStringTag,{value:"Module"})),sc="progresspulse_current_user",_l=class _l{constructor(){Tn(this,"currentUser",null);Tn(this,"listeners",[]);this.initializeAuth()}static getInstance(){return _l.instance||(_l.instance=new _l),_l.instance}async initializeAuth(){const e=localStorage.getItem(sc);if(e)try{const n=JSON.parse(e),r=await Ln.users.get(n.id);r?this.setCurrentUser(r):localStorage.removeItem(sc)}catch{localStorage.removeItem(sc)}}async signUp(e,n,r){try{if(await Ln.getUserByEmail(e))return{success:!1,error:"User with this email already exists"};const i=await Ln.createUser({email:e,name:n,passwordHash:btoa(r),preferences:{theme:"system",notifications:!0,weekStartsOn:1}}),o=await Ln.users.get(i);return o?(this.setCurrentUser(o),await Dl.sendAccountCreatedNotification(i,n),St.success("Account created successfully!"),setTimeout(()=>{window.location.href="/dashboard"},100),{success:!0}):{success:!1,error:"Failed to create user"}}catch(s){return console.error("Sign up error:",s),{success:!1,error:"Failed to create account"}}}async signOut(){this.setCurrentUser(null),localStorage.removeItem(sc),St.success("Signed out successfully")}async changePassword(e,n){if(!this.currentUser)return{success:!1,error:"No user signed in"};try{if(this.currentUser.passwordHash!==btoa(e))return{success:!1,error:"Current password is incorrect"};const r=this.validatePassword(n);if(!r.isValid)return{success:!1,error:r.errors.join(", ")};await Ln.users.update(this.currentUser.id,{passwordHash:btoa(n),updatedAt:new Date});const s=await Ln.users.get(this.currentUser.id);return s&&this.setCurrentUser(s),{success:!0}}catch(r){return console.error("Change password error:",r),{success:!1,error:"Failed to change password"}}}async deleteAccount(){if(!this.currentUser)return{success:!1,error:"No user signed in"};try{return await Ln.deleteUserData(this.currentUser.id),await this.signOut(),St.success("Account deleted successfully"),{success:!0}}catch(e){return console.error("Delete account error:",e),{success:!1,error:"Failed to delete account"}}}getCurrentUser(){return this.currentUser}isAuthenticated(){return this.currentUser!==null}onAuthStateChange(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(n=>n!==e)}}setCurrentUser(e){this.currentUser=e,e?localStorage.setItem(sc,JSON.stringify(e)):localStorage.removeItem(sc),this.listeners.forEach(n=>n(e))}async updateUserPreferences(e){if(this.currentUser)try{const n={...this.currentUser.preferences,...e};await Ln.users.update(this.currentUser.id,{preferences:n});const r=await Ln.users.get(this.currentUser.id);r&&this.setCurrentUser(r)}catch(n){console.error("Failed to update preferences:",n),St.error("Failed to update preferences")}}validatePassword(e){const n=[];return e.length<8&&n.push("Password must be at least 8 characters long"),/[A-Z]/.test(e)||n.push("Password must contain at least one uppercase letter"),/[a-z]/.test(e)||n.push("Password must contain at least one lowercase letter"),/\d/.test(e)||n.push("Password must contain at least one number"),{isValid:n.length===0,errors:n}}getPasswordStrength(e){let n=0;return e.length>=8&&n++,e.length>=12&&n++,/[A-Z]/.test(e)&&n++,/[a-z]/.test(e)&&n++,/\d/.test(e)&&n++,/[^A-Za-z0-9]/.test(e)&&n++,n<=2?"weak":n<=4?"medium":"strong"}};Tn(_l,"instance");let Jp=_l;const Ba=Jp.getInstance();function Ir(){const[t,e]=I.useState(Ba.getCurrentUser()),[n,r]=I.useState(!0);return I.useEffect(()=>{const d=Ba.onAuthStateChange(f=>{e(f),r(!1)});return r(!1),d},[]),{user:t,loading:n,isAuthenticated:!!t,signUp:async(d,f,m)=>await Ba.signUp(d,f,m),signOut:async()=>{await Ba.signOut()},changePassword:async(d,f)=>await Ba.changePassword(d,f),deleteAccount:async()=>await Ba.deleteAccount(),updatePreferences:async d=>{if(await Ba.updateUserPreferences(d),d.notifications!==void 0){const{notificationService:f}=await eo(async()=>{const{notificationService:m}=await Promise.resolve().then(()=>Xp);return{notificationService:m}},void 0);d.notifications&&(await f.requestPermission(),d.reminderTime&&await f.scheduleReminder(d.reminderTime,"Time to check your progress!"))}},validatePassword:Ba.validatePassword,getPasswordStrength:Ba.getPasswordStrength}}const R1=t=>{let e;const n=new Set,r=(d,f)=>{const m=typeof d=="function"?d(e):d;if(!Object.is(m,e)){const g=e;e=f??(typeof m!="object"||m===null)?m:Object.assign({},e,m),n.forEach(v=>v(e,g))}},s=()=>e,l={setState:r,getState:s,getInitialState:()=>c,subscribe:d=>(n.add(d),()=>n.delete(d))},c=e=t(r,s,l);return l},Z6=t=>t?R1(t):R1,X6=t=>t;function J6(t,e=X6){const n=dt.useSyncExternalStore(t.subscribe,()=>e(t.getState()),()=>e(t.getInitialState()));return dt.useDebugValue(n),n}const F1=t=>{const e=Z6(t),n=r=>J6(e,r);return Object.assign(n,e),n},yg=t=>t?F1(t):F1;function Q6(t,e){let n;try{n=t()}catch{return}return{getItem:s=>{var i;const o=c=>c===null?null:JSON.parse(c,void 0),l=(i=n.getItem(s))!=null?i:null;return l instanceof Promise?l.then(o):o(l)},setItem:(s,i)=>n.setItem(s,JSON.stringify(i,void 0)),removeItem:s=>n.removeItem(s)}}const Qp=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(r){return Qp(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Qp(r)(n)}}}},ek=(t,e)=>(n,r,s)=>{let i={storage:Q6(()=>localStorage),partialize:j=>j,version:0,merge:(j,P)=>({...P,...j}),...e},o=!1;const l=new Set,c=new Set;let d=i.storage;if(!d)return t((...j)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...j)},r,s);const f=()=>{const j=i.partialize({...r()});return d.setItem(i.name,{state:j,version:i.version})},m=s.setState;s.setState=(j,P)=>{m(j,P),f()};const g=t((...j)=>{n(...j),f()},r,s);s.getInitialState=()=>g;let v;const N=()=>{var j,P;if(!d)return;o=!1,l.forEach(_=>{var M;return _((M=r())!=null?M:g)});const k=((P=i.onRehydrateStorage)==null?void 0:P.call(i,(j=r())!=null?j:g))||void 0;return Qp(d.getItem.bind(d))(i.name).then(_=>{if(_)if(typeof _.version=="number"&&_.version!==i.version){if(i.migrate){const M=i.migrate(_.state,_.version);return M instanceof Promise?M.then($=>[!0,$]):[!0,M]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,_.state];return[!1,void 0]}).then(_=>{var M;const[$,Y]=_;if(v=i.merge(Y,(M=r())!=null?M:g),n(v,!0),$)return f()}).then(()=>{k==null||k(v,void 0),v=r(),o=!0,c.forEach(_=>_(v))}).catch(_=>{k==null||k(void 0,_)})};return s.persist={setOptions:j=>{i={...i,...j},j.storage&&(d=j.storage)},clearStorage:()=>{d==null||d.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>N(),hasHydrated:()=>o,onHydrate:j=>(l.add(j),()=>{l.delete(j)}),onFinishHydration:j=>(c.add(j),()=>{c.delete(j)})},i.skipHydration||N(),v||g},tk=ek,B1="BEl62iUYgUivxIkv69yViEuiBIa40HI2BzcOKiMMkXYdMiPnssSKCjxotkJsqFhD7SsVJjevVdqbve6vFgudZWI";class nk{constructor(){Tn(this,"messaging");Tn(this,"isSupported");Tn(this,"isAPK");Tn(this,"reminderIntervals",new Map);Tn(this,"hasRequestedPermission",!1);if(this.isAPK=this.detectAPK(),this.isSupported="serviceWorker"in navigator&&"PushManager"in window,console.log("🔔 Push Service initialized:",{isAPK:this.isAPK,isSupported:this.isSupported,userAgent:navigator.userAgent}),this.isSupported&&!this.isAPK)try{this.messaging=mg(Sx)}catch(e){console.warn("Firebase messaging not available:",e),this.isSupported=!1}this.isAPK&&this.autoRequestAPKPermission()}detectAPK(){const e=navigator.userAgent.toLowerCase(),n=e.includes("wv")&&e.includes("android"),r=!!window.Capacitor,s=!!window.cordova,i=window.matchMedia("(display-mode: standalone)").matches,o=e.includes("android")&&e.includes("chrome"),l=e.includes("android")&&!e.includes("mobile safari");return n||r||s||i&&o||l}async initialize(){try{return console.log("🔔 Initializing push notification service..."),this.isAPK?await this.initializeAPKNotifications():await this.initializeWebNotifications(),!0}catch(e){return console.error("Failed to initialize push notifications:",e),!1}}async initializeAPKNotifications(){"serviceWorker"in navigator&&(await navigator.serviceWorker.ready,console.log("APK: Service worker ready for notifications"))}async initializeWebNotifications(){console.log("Web: Notification service initialized")}async autoRequestAPKPermission(){setTimeout(async()=>{!this.hasRequestedPermission&&Notification.permission==="default"&&(console.log("🔔 APK: Auto-requesting notification permission"),await this.requestPermission())},2e3)}async requestPermission(){if(this.hasRequestedPermission&&Notification.permission!=="default")return Notification.permission==="granted";if(this.hasRequestedPermission=!0,!this.isSupported)return console.warn("Push notifications not supported"),!1;try{return console.log("🔔 Requesting notification permission for:",this.isAPK?"APK":"Web"),this.isAPK?await this.requestAPKPermission():await this.requestWebPermission()}catch(e){return console.error("Error requesting notification permission:",e),!1}}async requestAPKPermission(){return await this.showAPKPermissionDialog()?await Notification.requestPermission()==="granted"?(console.log("🔔 APK: Notification permission granted"),setTimeout(()=>{this.showWelcomeNotification()},1e3),!0):(console.log("🔔 APK: Notification permission denied"),!1):!1}async requestWebPermission(){return await Notification.requestPermission()==="granted"?(console.log("🔔 Web: Notification permission granted"),!0):(console.log("🔔 Web: Notification permission denied"),!1)}async showAPKPermissionDialog(){return new Promise(e=>{const n=document.createElement("div");n.style.cssText=`
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.8);
display: flex;
align-items: center;
justify-content: center;
z-index: 10000;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
backdrop-filter: blur(10px);
`,n.innerHTML=`
<div style="
background: white;
border-radius: 20px;
padding: 30px;
max-width: 320px;
text-align: center;
box-shadow: 0 20px 40px rgba(0,0,0,0.3);
animation: slideUp 0.3s ease-out;
">
<div style="font-size: 48px; margin-bottom: 20px;">🎯</div>
<h3 style="margin: 0 0 15px 0; font-size: 20px; font-weight: 600; color: #1a1a1a;">Stay Updated</h3>
<p style="margin: 0 0 25px 0; color: #666; line-height: 1.5; font-size: 15px;">
Get notified about:<br>
• 🚀 App updates<br>
• 📊 Daily progress reminders<br>
• 🎯 Goal achievements
</p>
<div style="display: flex; gap: 12px;">
<button id="deny-btn" style="
flex: 1;
padding: 14px;
border: 1px solid #ddd;
border-radius: 12px;
background: white;
font-size: 16px;
cursor: pointer;
color: #666;
font-weight: 500;
">Not Now</button>
<button id="allow-btn" style="
flex: 1;
padding: 14px;
border: none;
border-radius: 12px;
background: #007AFF;
color: white;
font-size: 16px;
font-weight: 600;
cursor: pointer;
box-shadow: 0 2px 8px rgba(0,122,255,0.3);
">Allow</button>
</div>
</div>
<style>
@keyframes slideUp {
from { transform: translateY(50px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
</style>
`,document.body.appendChild(n);const r=n.querySelector("#allow-btn"),s=n.querySelector("#deny-btn");r==null||r.addEventListener("click",()=>{document.body.removeChild(n),e(!0)}),s==null||s.addEventListener("click",()=>{document.body.removeChild(n),e(!1)}),setTimeout(()=>{document.body.contains(n)&&(document.body.removeChild(n),e(!1))},3e4)})}async showWelcomeNotification(){try{await this.showNotification("🎯 ProgressPulse Ready!",{body:"Notifications enabled! You'll receive updates and daily reminders.",icon:"/icons/icon-192x192.png",badge:"/icons/badge-72x72.png",tag:"welcome",requireInteraction:!1,silent:!1})}catch(e){console.error("Failed to show welcome notification:",e)}}async getToken(){if(!this.isSupported||!this.messaging&&!this.isAPK)return null;try{return this.isAPK?`apk_${this.getDeviceId()}`:await gg(this.messaging,{vapidKey:B1})}catch(e){return console.error("Error getting token:",e),null}}getDeviceId(){let e=localStorage.getItem("device_id");return e||(e="device_"+Math.random().toString(36).substr(2,9)+"_"+Date.now(),localStorage.setItem("device_id",e)),e}async subscribeToUpdates(){if(!this.isSupported)return null;try{const n=await(await navigator.serviceWorker.ready).pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:this.urlBase64ToUint8Array(B1)});return await this.storeSubscription(n),n}catch(e){return console.error("Error subscribing to push notifications:",e),null}}async unsubscribeFromUpdates(){if(!this.isSupported)return!1;try{const n=await(await navigator.serviceWorker.ready).pushManager.getSubscription();return n?(await n.unsubscribe(),await this.removeSubscription(n),!0):!1}catch(e){return console.error("Error unsubscribing from push notifications:",e),!1}}setupMessageListener(e){this.isSupported&&this.messaging&&vg(this.messaging,n=>{var r,s;console.log("🔔 Message received:",n),e(n),n.notification&&this.showNotification(n.notification.title||"ProgressPulse",{body:n.notification.body,icon:n.notification.icon||"/icons/icon-192x192.png",badge:"/icons/badge-72x72.png",data:n.data,tag:((r=n.data)==null?void 0:r.type)||"general",requireInteraction:((s=n.data)==null?void 0:s.critical)==="true"})})}async setupDailyReminders(e="09:00"){if(console.log("🔔 Setting up daily reminders for",e),this.reminderIntervals.forEach(l=>clearInterval(l)),this.reminderIntervals.clear(),Notification.permission!=="granted"){console.log("🔔 Cannot setup reminders: permission not granted");return}const[n,r]=e.split(":").map(Number),s=new Date,i=new Date;i.setHours(n,r,0,0),i<=s&&i.setDate(i.getDate()+1);const o=i.getTime()-s.getTime();setTimeout(()=>{this.sendDailyReminder();const l=setInterval(()=>{this.sendDailyReminder()},24*60*60*1e3);this.reminderIntervals.set("daily",l)},o),console.log(`🔔 Daily reminder scheduled for ${e} (in ${Math.round(o/1e3/60)} minutes)`)}async sendDailyReminder(){const e=[{title:"🎯 Daily Progress Check",body:"How are your goals coming along today?"},{title:"📊 Track Your Progress",body:"Take a moment to update your achievements!"},{title:"🚀 Keep Going!",body:"You're doing great! Check your progress."},{title:"⭐ Goal Reminder",body:"Don't forget to work on your goals today!"}],n=e[Math.floor(Math.random()*e.length)];await this.showNotification(n.title,{body:n.body,icon:"/icons/icon-192x192.png",badge:"/icons/badge-72x72.png",tag:"daily-reminder",requireInteraction:!1,data:{type:"reminder",action:"open-app"}}),console.log("🔔 Daily reminder sent:",n.title)}async sendUpdateNotification(e,n){if(Notification.permission!=="granted"){console.log("🔔 Cannot send update notification: permission not granted");return}const r=n.slice(0,3).join(`
• `);await this.showNotification("🚀 ProgressPulse Update Available",{body:`Version ${e} is ready!
• ${r}`,icon:"/icons/icon-192x192.png",badge:"/icons/badge-72x72.png",tag:"app-update",requireInteraction:!0,data:{type:"update",version:e,action:"open-settings"}}),console.log("🔔 Update notification sent for version:",e)}async showNotification(e,n={}){if(!this.isSupported||Notification.permission!=="granted"){console.log("🔔 Cannot show notification: not supported or permission denied");return}try{if("serviceWorker"in navigator){const r=await navigator.serviceWorker.ready,s={icon:"/icons/icon-192x192.png",badge:"/icons/badge-72x72.png",...n};this.isAPK&&(s.vibrate=[200,100,200]),await r.showNotification(e,s),console.log("🔔 Notification shown:",e)}else new Notification(e,{icon:"/icons/icon-192x192.png",...n})}catch(r){console.error("Error showing notification:",r)}}async storeSubscription(e){try{const n={endpoint:e.endpoint,keys:{p256dh:this.arrayBufferToBase64(e.getKey("p256dh")),auth:this.arrayBufferToBase64(e.getKey("auth"))},timestamp:new Date().toISOString(),userAgent:navigator.userAgent,isAPK:this.isAPK};localStorage.setItem("push-subscription",JSON.stringify(n)),console.log("🔔 Push subscription stored:",n)}catch(n){console.error("Error storing subscription:",n)}}async removeSubscription(e){try{localStorage.removeItem("push-subscription"),console.log("🔔 Push subscription removed")}catch(n){console.error("Error removing subscription:",n)}}urlBase64ToUint8Array(e){const n="=".repeat((4-e.length%4)%4),r=(e+n).replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(r),i=new Uint8Array(s.length);for(let o=0;o<s.length;++o)i[o]=s.charCodeAt(o);return i}arrayBufferToBase64(e){if(!e)return"";const n=new Uint8Array(e);let r="";for(let s=0;s<n.byteLength;s++)r+=String.fromCharCode(n[s]);return window.btoa(r)}get isNotificationSupported(){return this.isSupported&&"Notification"in window}get notificationPermission(){return this.isNotificationSupported?Notification.permission:"denied"}get isRunningAsAPK(){return this.isAPK}async sendTestNotification(){await this.showNotification("🧪 Test Notification",{body:"This is a test notification to verify the system works!",tag:"test",requireInteraction:!1})}}const cr=new nk;function V1(t,e){const n=i=>i.split(".").map(o=>parseInt(o,10)),r=n(t),s=n(e);for(let i=0;i<Math.max(r.length,s.length);i++){const o=r[i]||0,l=s[i]||0;if(o>l)return!0;if(o<l)return!1}return!1}const xg=yg()(tk((t,e)=>({currentVersion:"1.0.0",availableUpdate:null,updateHistory:[],updateProgress:{phase:"idle",progress:0,downloadedBytes:0,totalBytes:0,speed:0,timeRemaining:0},autoUpdate:!1,updateNotifications:!0,wifiOnlyUpdates:!0,checkForUpdates:async()=>{const{setUpdateProgress:n,setAvailableUpdate:r,setCurrentVersion:s}=e();try{n({phase:"checking",progress:0});let i="1.0.0";try{console.log("🔍 Fetching version from:",window.location.origin+"/version.json");const c=await fetch("/version.json?"+Date.now(),{cache:"no-cache",headers:{"Cache-Control":"no-cache, no-store, must-revalidate",Pragma:"no-cache"}});console.log("📡 Version response status:",c.status),c.ok?(i=(await c.json()).version,s(i),console.log("📦 Current deployed version:",i)):console.log("❌ Version fetch failed:",c.status,c.statusText)}catch(c){console.log("⚠️ Could not get current version, using fallback:",i,c)}await new Promise(c=>setTimeout(c,1e3)),console.log("🔍 Fetching update manifest from:",window.location.origin+"/update-manifest.json");const o=await fetch("/update-manifest.json?"+Date.now(),{cache:"no-cache",headers:{"Cache-Control":"no-cache, no-store, must-revalidate",Pragma:"no-cache"}});if(console.log("📡 Update manifest response status:",o.status),!o.ok)throw new Error(`Failed to check for updates: ${o.status} ${o.statusText}`);const l=await o.json();console.log("🔍 Version check:",{current:i,available:l.version,isNewer:V1(l.version,i)}),V1(l.version,i)?(r(l),n({phase:"idle",progress:100}),e().updateNotifications&&await cr.sendUpdateNotification(l.version,l.changes)):(r(null),n({phase:"idle",progress:100}))}catch(i){console.error("Error checking for updates:",i),n({phase:"error",progress:0,error:i instanceof Error?i.message:"Unknown error"})}},downloadUpdate:async n=>{const{setUpdateProgress:r,wifiOnlyUpdates:s}=e();try{if(s&&"connection"in navigator){const d=navigator.connection;if(d&&d.type!=="wifi")throw new Error("WiFi connection required for updates")}r({phase:"downloading",progress:0,totalBytes:n.size,downloadedBytes:0});const i=n.size;let o=0;const l=i/100,c=Date.now();for(let d=0;d<=100;d++){await new Promise(N=>setTimeout(N,50+Math.random()*100)),o=Math.min(i,o+l);const f=o/i*100,m=(Date.now()-c)/1e3,g=o/m,v=(i-o)/g;r({progress:f,downloadedBytes:o,speed:g,timeRemaining:isFinite(v)?v:0})}r({phase:"installing",progress:0}),await e().installUpdate()}catch(i){console.error("Error downloading update:",i),r({phase:"error",progress:0,error:i instanceof Error?i.message:"Download failed"})}},installUpdate:async()=>{const{setUpdateProgress:n,availableUpdate:r,addToHistory:s}=e();if(r)try{n({phase:"installing",progress:0});for(let i=0;i<=100;i+=10)await new Promise(o=>setTimeout(o,200)),n({progress:i});t({currentVersion:r.version}),s(r),n({phase:"complete",progress:100}),await cr.showNotification("✅ Update Complete",{body:`ProgressPulse has been updated to version ${r.version}`,icon:"/icons/icon-192x192.png",tag:"update-complete",requireInteraction:!1}),t({availableUpdate:null}),setTimeout(()=>{window.location.reload()},2e3)}catch(i){console.error("Error installing update:",i),n({phase:"error",progress:0,error:i instanceof Error?i.message:"Installation failed"})}},dismissUpdate:()=>{t({availableUpdate:null})},setAutoUpdate:n=>{t({autoUpdate:n})},setUpdateNotifications:n=>{t({updateNotifications:n})},setWifiOnlyUpdates:n=>{t({wifiOnlyUpdates:n})},setUpdateProgress:n=>{t(r=>({updateProgress:{...r.updateProgress,...n}}))},setAvailableUpdate:n=>{t({availableUpdate:n})},setCurrentVersion:n=>{t({currentVersion:n})},addToHistory:n=>{t(r=>({updateHistory:[n,...r.updateHistory].slice(0,10)}))}}),{name:"update-store",partialize:t=>({currentVersion:t.currentVersion,updateHistory:t.updateHistory,autoUpdate:t.autoUpdate,updateNotifications:t.updateNotifications,wifiOnlyUpdates:t.wifiOnlyUpdates})}));function rk(){const{checkForUpdates:t,updateNotifications:e,autoUpdate:n,availableUpdate:r,downloadUpdate:s}=xg();I.useEffect(()=>{(async()=>{if(e)try{await cr.requestPermission()&&(await cr.subscribeToUpdates(),cr.setupMessageListener(l=>{var c;console.log("Update notification received:",l),((c=l.data)==null?void 0:c.type)==="update"&&(t(),St.info("🚀 New update available!",{description:`Version ${l.data.version} is ready to install`,action:{label:"Update Now",onClick:()=>{window.location.href="/settings?tab=updates"}},duration:1e4}))}))}catch(o){console.error("Failed to initialize push notifications:",o)}})()},[e,t]),I.useEffect(()=>{if(n&&r){const o=setTimeout(async()=>{try{(r.critical||n)&&(St.info("🔄 Auto-updating app...",{description:`Installing version ${r.version}`,duration:5e3}),await s(r))}catch(l){console.error("Auto-update failed:",l),St.error("Auto-update failed",{description:"Please update manually from settings"})}},5e3);return()=>clearTimeout(o)}},[n,r,s]),I.useEffect(()=>{(async()=>{try{await t()}catch(l){console.error("Failed to check for updates on start:",l)}})();const o=setInterval(t,30*60*1e3);return()=>clearInterval(o)},[t]),I.useEffect(()=>{(async()=>{if("serviceWorker"in navigator)try{if(await navigator.serviceWorker.getRegistration("/sw-push.js")){console.log("Push service worker already registered");return}const l=await navigator.serviceWorker.register("/sw-push.js");console.log("Push service worker registered:",l);let c=!1;l.addEventListener("updatefound",()=>{const d=l.installing;d&&!c&&d.addEventListener("statechange",()=>{d.state==="installed"&&navigator.serviceWorker.controller&&!c&&(c=!0,St.info("🔄 App update ready",{description:"Restart the app to apply updates",action:{label:"Restart",onClick:()=>window.location.reload()},duration:1e4}))})})}catch(o){console.error("Failed to register push service worker:",o)}})()},[]),I.useEffect(()=>{new URLSearchParams(window.location.search).get("action")==="update"&&r&&s(r)},[r,s])}function sk(){const[t,e]=I.useState(!1),[n,r]=I.useState(!1);return I.useEffect(()=>{const s=()=>{const o=navigator.userAgent.toLowerCase(),l=o.includes("wv")&&o.includes("android"),c=!!window.Capacitor,d=!!window.cordova,f=window.matchMedia("(display-mode: standalone)").matches,m=o.includes("android")&&o.includes("chrome"),g=o.includes("pwabuilder")||o.includes("twa"),v=o.includes("webapk"),N=l||c||d||g||v||f&&m||window.location.protocol==="https:"&&f;return console.log("🔔 APK Detection:",{isAndroidWebView:l,isCapacitor:c,isCordova:d,isStandalone:f,isAndroidChrome:m,isPWABuilder:g,isWebAPK:v,apkDetected:N,userAgent:o,protocol:window.location.protocol}),e(N),N};(async()=>{s()&&!n&&(console.log("🔔 APK detected, initializing notifications..."),setTimeout(async()=>{try{if("serviceWorker"in navigator){const l=await navigator.serviceWorker.register("/sw-notifications.js",{scope:"/"});console.log("🔔 APK notification service worker registered:",l),await navigator.serviceWorker.ready}if(console.log("🔔 APK: Current permission status:",Notification.permission),Notification.permission==="default"||Notification.permission==="denied")if(console.log("🔔 APK: Requesting notification permission with dialog"),await ak()){let c=await ik();console.log("🔔 APK: Final permission result:",c),c==="granted"?(console.log("🔔 APK: Notification permission granted"),await q1(),setTimeout(()=>{cr.showNotification("🎯 ProgressPulse Ready!",{body:"Notifications enabled! You'll receive updates and reminders.",tag:"apk-welcome",requireInteraction:!1})},1e3)):console.log("🔔 APK: Notification permission denied")}else console.log("🔔 APK: User declined notification permission");else Notification.permission==="granted"&&(console.log("🔔 APK: Notifications already granted"),await q1());r(!0)}catch(l){console.error("🔔 APK notification initialization error:",l)}},3e3))})()},[n]),{isAPK:t,permissionRequested:n}}async function q1(){try{if("serviceWorker"in navigator){const t=await navigator.serviceWorker.ready;try{const e=t.sync;e&&(await e.register("daily-reminder"),console.log("🔔 APK: Background sync registered for daily reminders"),await e.register("check-updates"),console.log("🔔 APK: Background sync registered for update checks"))}catch(e){console.log("🔔 APK: Background sync not available:",e.message)}try{const e=t.periodicSync;e&&(await e.register("daily-reminder",{minInterval:24*60*60*1e3}),console.log("🔔 APK: Periodic sync registered for daily reminders"))}catch(e){console.log("🔔 APK: Periodic sync not available:",e.message)}}}catch(t){console.error("🔔 APK: Error setting up background sync:",t)}}async function ik(){console.log("🔔 APK: Starting aggressive permission request...");try{let t=await Notification.requestPermission();if(console.log("🔔 APK: Standard request result:",t),t==="granted")return t;await new Promise(n=>setTimeout(n,500));const e=document.createElement("button");if(e.style.position="fixed",e.style.top="-1000px",e.style.left="-1000px",e.style.opacity="0",e.style.pointerEvents="none",document.body.appendChild(e),e.click(),t=await Notification.requestPermission(),console.log("🔔 APK: Second attempt result:",t),document.body.removeChild(e),t==="granted")return t;if("serviceWorker"in navigator){try{const n=await navigator.serviceWorker.ready;n.pushManager&&await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:null}).catch(()=>{console.log("🔔 APK: Push subscription failed, but continuing...")})}catch(n){console.log("🔔 APK: Service worker push attempt failed:",n)}t=await Notification.requestPermission(),console.log("🔔 APK: Third attempt result:",t)}return t}catch(t){return console.error("🔔 APK: Error in aggressive permission request:",t),Notification.permission}}function ak(){return new Promise(t=>{const e=document.createElement("div");e.style.cssText=`
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
display: flex;
align-items: center;
justify-content: center;
z-index: 10000;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
`,e.innerHTML=`
<div style="
background: white;
border-radius: 20px;
padding: 30px;
max-width: 320px;
margin: 20px;
text-align: center;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
">
<div style="font-size: 48px; margin-bottom: 20px;">🔔</div>
<h2 style="margin: 0 0 15px 0; color: #333; font-size: 20px; font-weight: 600;">
Enable Notifications
</h2>
<p style="margin: 0 0 25px 0; color: #666; font-size: 16px; line-height: 1.4;">
Get daily reminders to track your progress and notifications when app updates are available.
</p>
<div style="display: flex; gap: 10px;">
<button id="deny-btn" style="
flex: 1;
padding: 12px;
border: 2px solid #ddd;
background: white;
color: #666;
border-radius: 12px;
font-size: 16px;
font-weight: 500;
cursor: pointer;
">Not Now</button>
<button id="allow-btn" style="
flex: 1;
padding: 12px;
border: none;
background: #007AFF;
color: white;
border-radius: 12px;
font-size: 16px;
font-weight: 500;
cursor: pointer;
">Allow</button>
</div>
</div>
`,document.body.appendChild(e);const n=e.querySelector("#allow-btn"),r=e.querySelector("#deny-btn");n==null||n.addEventListener("click",()=>{document.body.removeChild(e),t(!0)}),r==null||r.addEventListener("click",()=>{document.body.removeChild(e),t(!1)})})}const Al=class Al{static getInstance(){return Al.instance||(Al.instance=new Al),Al.instance}async initialize(){console.log("Initializing PWA for APK environment..."),await this.registerServiceWorker(),await this.initializePushNotifications(),await this.setupOfflineCapabilities(),this.handleInstallPrompt(),await this.setupBackgroundSync(),console.log("PWA initialization complete")}async registerServiceWorker(){if("serviceWorker"in navigator)try{const e=await navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/"});console.log("Service Worker registered:",e),e.addEventListener("updatefound",()=>{const n=e.installing;n&&n.addEventListener("statechange",()=>{n.state==="installed"&&navigator.serviceWorker.controller&&(console.log("New service worker available"),this.showUpdateAvailableNotification())})})}catch(e){console.error("Service Worker registration failed:",e)}}async initializePushNotifications(){try{if("Notification"in window){const e=await Notification.requestPermission();if(console.log("Notification permission:",e),e==="granted"){const{getMessaging:n,getToken:r,onMessage:s}=await eo(async()=>{const{getMessaging:d,getToken:f,onMessage:m}=await Promise.resolve().then(()=>$6);return{getMessaging:d,getToken:f,onMessage:m}},void 0),{initializeApp:i}=await eo(async()=>{const{initializeApp:d}=await Promise.resolve().then(()=>wS);return{initializeApp:d}},void 0),l=i({apiKey:"AIzaSyBPE9kaWcLofrUh_dT_pswPDNkEhVtSBjU",authDomain:"progresspulse-5c1c9.firebaseapp.com",projectId:"progresspulse-5c1c9",storageBucket:"progresspulse-5c1c9.firebasestorage.app",messagingSenderId:"1020367919471",appId:"1:1020367919471:web:245125af8144bac9e3b09a"}),c=n(l);try{const d=await r(c,{vapidKey:"BEl62iUYgUivxIkv69yViEuiBIa40HI80NqIUHI80NqIUHI80NqIUHI80NqIUHI80NqIUHI80NqI"});d&&(console.log("FCM Token:",d),localStorage.setItem("fcm_token",d))}catch(d){console.warn("Failed to get FCM token:",d)}s(c,d=>{console.log("Foreground message received:",d),this.showForegroundNotification(d)})}}}catch(e){console.error("Push notification initialization failed:",e)}}async setupOfflineCapabilities(){if("caches"in window)try{const e=await caches.open("progresspulse-v1"),n=["/","/manifest.json","/pwa-192x192.png","/pwa-512x512.png"];await e.addAll(n),console.log("Resources cached for offline use")}catch(e){console.warn("Offline caching failed:",e)}}handleInstallPrompt(){let e;window.addEventListener("beforeinstallprompt",n=>{n.preventDefault(),e=n,console.log("Install prompt available"),this.showInstallButton(e)}),window.addEventListener("appinstalled",()=>{console.log("PWA was installed"),e=null})}async setupBackgroundSync(){if("serviceWorker"in navigator&&"sync"in window.ServiceWorkerRegistration.prototype)try{const e=await navigator.serviceWorker.ready;"sync"in e&&await e.sync.register("background-sync"),console.log("Background sync registered")}catch(e){console.warn("Background sync not supported:",e)}}showForegroundNotification(e){var s,i,o,l;const n=((s=e.notification)==null?void 0:s.title)||"ProgressPulse",r={body:((i=e.notification)==null?void 0:i.body)||"You have a new notification",icon:((o=e.notification)==null?void 0:o.icon)||"/pwa-192x192.png",badge:"/pwa-64x64.png",tag:((l=e.data)==null?void 0:l.tag)||"default",requireInteraction:!0,vibrate:[200,100,200],data:e.data};new Notification(n,r)}showUpdateAvailableNotification(){"Notification"in window&&Notification.permission==="granted"&&new Notification("App Update Available",{body:"A new version of ProgressPulse is available. Refresh to update.",icon:"/pwa-192x192.png",tag:"app-update",requireInteraction:!0})}showInstallButton(e){console.log("App can be installed"),window.dispatchEvent(new CustomEvent("pwa-installable",{detail:{prompt:e}}))}async installApp(e){if(!e)return!1;try{e.prompt();const{outcome:n}=await e.userChoice;return console.log("Install prompt outcome:",n),n==="accepted"}catch(n){return console.error("Install failed:",n),!1}}isStandalone(){return window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone===!0||document.referrer.includes("android-app://")}isAPK(){return document.referrer.includes("android-app://")||window.location.protocol==="file:"||window.Android!==void 0}};Tn(Al,"instance");let em=Al;const rp=em.getInstance(),td=yg(t=>({isOnline:navigator.onLine,isInstalled:!1,updateAvailable:!1,syncInProgress:!1,setOnlineStatus:e=>t({isOnline:e}),setInstallStatus:e=>t({isInstalled:e}),setUpdateAvailable:e=>t({updateAvailable:e}),setSyncInProgress:e=>t({syncInProgress:e})})),bg="-",ok=t=>{const e=ck(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const l=o.split(bg);return l[0]===""&&l.length!==1&&l.shift(),kx(l,e)||lk(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},kx=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),s=r?kx(t.slice(1),r):void 0;if(s)return s;if(e.validators.length===0)return;const i=t.join(bg);return(o=e.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},U1=/^\[(.+)\]$/,lk=t=>{if(U1.test(t)){const e=U1.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},ck=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return dk(Object.entries(t.classGroups),n).forEach(([i,o])=>{tm(o,r,i,e)}),r},tm=(t,e,n,r)=>{t.forEach(s=>{if(typeof s=="string"){const i=s===""?e:z1(e,s);i.classGroupId=n;return}if(typeof s=="function"){if(uk(s)){tm(s(r),e,n,r);return}e.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,o])=>{tm(o,z1(e,i),n,r)})})},z1=(t,e)=>{let n=t;return e.split(bg).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},uk=t=>t.isThemeGetter,dk=(t,e)=>e?t.map(([n,r])=>{const s=r.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[e+o,l])):i);return[n,s]}):t,hk=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const s=(i,o)=>{n.set(i,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return s(i,o),o},set(i,o){n.has(i)?n.set(i,o):s(i,o)}}},_x="!",fk=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,s=e[0],i=e.length,o=l=>{const c=[];let d=0,f=0,m;for(let P=0;P<l.length;P++){let k=l[P];if(d===0){if(k===s&&(r||l.slice(P,P+i)===e)){c.push(l.slice(f,P)),f=P+i;continue}if(k==="/"){m=P;continue}}k==="["?d++:k==="]"&&d--}const g=c.length===0?l:l.substring(f),v=g.startsWith(_x),N=v?g.substring(1):g,j=m&&m>f?m-f:void 0;return{modifiers:c,hasImportantModifier:v,baseClassName:N,maybePostfixModifierPosition:j}};return n?l=>n({className:l,parseClassName:o}):o},pk=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},mk=t=>({cache:hk(t.cacheSize),parseClassName:fk(t),...ok(t)}),gk=/\s+/,vk=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=e,i=[],o=t.trim().split(gk);let l="";for(let c=o.length-1;c>=0;c-=1){const d=o[c],{modifiers:f,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:v}=n(d);let N=!!v,j=r(N?g.substring(0,v):g);if(!j){if(!N){l=d+(l.length>0?" "+l:l);continue}if(j=r(g),!j){l=d+(l.length>0?" "+l:l);continue}N=!1}const P=pk(f).join(":"),k=m?P+_x:P,_=k+j;if(i.includes(_))continue;i.push(_);const M=s(j,N);for(let $=0;$<M.length;++$){const Y=M[$];i.push(k+Y)}l=d+(l.length>0?" "+l:l)}return l};function yk(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=Ax(e))&&(r&&(r+=" "),r+=n);return r}const Ax=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=Ax(t[r]))&&(n&&(n+=" "),n+=e);return n};function xk(t,...e){let n,r,s,i=o;function o(c){const d=e.reduce((f,m)=>m(f),t());return n=mk(d),r=n.cache.get,s=n.cache.set,i=l,l(c)}function l(c){const d=r(c);if(d)return d;const f=vk(c,n);return s(c,f),f}return function(){return i(yk.apply(null,arguments))}}const Jn=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},Px=/^\[(?:([a-z-]+):)?(.+)\]$/i,bk=/^\d+\/\d+$/,wk=new Set(["px","full","screen"]),Nk=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,jk=/\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$/,Sk=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,kk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_k=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Va=t=>jc(t)||wk.has(t)||bk.test(t),ko=t=>$c(t,"length",Mk),jc=t=>!!t&&!Number.isNaN(Number(t)),sp=t=>$c(t,"number",jc),au=t=>!!t&&Number.isInteger(Number(t)),Ak=t=>t.endsWith("%")&&jc(t.slice(0,-1)),hn=t=>Px.test(t),_o=t=>Nk.test(t),Pk=new Set(["length","size","percentage"]),Ck=t=>$c(t,Pk,Cx),Tk=t=>$c(t,"position",Cx),Lk=new Set(["image","url"]),Dk=t=>$c(t,Lk,Ok),Ik=t=>$c(t,"",Ek),ou=()=>!0,$c=(t,e,n)=>{const r=Px.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},Mk=t=>jk.test(t)&&!Sk.test(t),Cx=()=>!1,Ek=t=>kk.test(t),Ok=t=>_k.test(t),Rk=()=>{const t=Jn("colors"),e=Jn("spacing"),n=Jn("blur"),r=Jn("brightness"),s=Jn("borderColor"),i=Jn("borderRadius"),o=Jn("borderSpacing"),l=Jn("borderWidth"),c=Jn("contrast"),d=Jn("grayscale"),f=Jn("hueRotate"),m=Jn("invert"),g=Jn("gap"),v=Jn("gradientColorStops"),N=Jn("gradientColorStopPositions"),j=Jn("inset"),P=Jn("margin"),k=Jn("opacity"),_=Jn("padding"),M=Jn("saturate"),$=Jn("scale"),Y=Jn("sepia"),U=Jn("skew"),te=Jn("space"),W=Jn("translate"),ge=()=>["auto","contain","none"],oe=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto",hn,e],T=()=>[hn,e],J=()=>["",Va,ko],Z=()=>["auto",jc,hn],Ne=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],he=()=>["solid","dashed","dotted","double","none"],ae=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>["start","end","center","between","around","evenly","stretch"],xe=()=>["","0",hn],De=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$e=()=>[jc,hn];return{cacheSize:500,separator:":",theme:{colors:[ou],spacing:[Va,ko],blur:["none","",_o,hn],brightness:$e(),borderColor:[t],borderRadius:["none","","full",_o,hn],borderSpacing:T(),borderWidth:J(),contrast:$e(),grayscale:xe(),hueRotate:$e(),invert:xe(),gap:T(),gradientColorStops:[t],gradientColorStopPositions:[Ak,ko],inset:B(),margin:B(),opacity:$e(),padding:T(),saturate:$e(),scale:$e(),sepia:xe(),skew:$e(),space:T(),translate:T()},classGroups:{aspect:[{aspect:["auto","square","video",hn]}],container:["container"],columns:[{columns:[_o]}],"break-after":[{"break-after":De()}],"break-before":[{"break-before":De()}],"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:[...Ne(),hn]}],overflow:[{overflow:oe()}],"overflow-x":[{"overflow-x":oe()}],"overflow-y":[{"overflow-y":oe()}],overscroll:[{overscroll:ge()}],"overscroll-x":[{"overscroll-x":ge()}],"overscroll-y":[{"overscroll-y":ge()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[j]}],"inset-x":[{"inset-x":[j]}],"inset-y":[{"inset-y":[j]}],start:[{start:[j]}],end:[{end:[j]}],top:[{top:[j]}],right:[{right:[j]}],bottom:[{bottom:[j]}],left:[{left:[j]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",au,hn]}],basis:[{basis:B()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",hn]}],grow:[{grow:xe()}],shrink:[{shrink:xe()}],order:[{order:["first","last","none",au,hn]}],"grid-cols":[{"grid-cols":[ou]}],"col-start-end":[{col:["auto",{span:["full",au,hn]},hn]}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":[ou]}],"row-start-end":[{row:["auto",{span:[au,hn]},hn]}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",hn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",hn]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...G()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...G(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...G(),"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:[P]}],mx:[{mx:[P]}],my:[{my:[P]}],ms:[{ms:[P]}],me:[{me:[P]}],mt:[{mt:[P]}],mr:[{mr:[P]}],mb:[{mb:[P]}],ml:[{ml:[P]}],"space-x":[{"space-x":[te]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[te]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",hn,e]}],"min-w":[{"min-w":[hn,e,"min","max","fit"]}],"max-w":[{"max-w":[hn,e,"none","full","min","max","fit","prose",{screen:[_o]},_o]}],h:[{h:[hn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[hn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[hn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[hn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",_o,ko]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",sp]}],"font-family":[{font:[ou]}],"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-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",hn]}],"line-clamp":[{"line-clamp":["none",jc,sp]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Va,hn]}],"list-image":[{"list-image":["none",hn]}],"list-style-type":[{list:["none","disc","decimal",hn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Va,ko]}],"underline-offset":[{"underline-offset":["auto",Va,hn]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",hn]}],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",hn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Ne(),Tk]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Ck]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Dk]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[N]}],"gradient-via-pos":[{via:[N]}],"gradient-to-pos":[{to:[N]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"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":[k]}],"border-style":[{border:[...he(),"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":[k]}],"divide-style":[{divide:he()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...he()]}],"outline-offset":[{"outline-offset":[Va,hn]}],"outline-w":[{outline:[Va,ko]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Va,ko]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",_o,Ik]}],"shadow-color":[{shadow:[ou]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...ae(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ae()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",_o,hn]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[m]}],saturate:[{saturate:[M]}],sepia:[{sepia:[Y]}],"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":[f]}],"backdrop-invert":[{"backdrop-invert":[m]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[M]}],"backdrop-sepia":[{"backdrop-sepia":[Y]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",hn]}],duration:[{duration:$e()}],ease:[{ease:["linear","in","out","in-out",hn]}],delay:[{delay:$e()}],animate:[{animate:["none","spin","ping","pulse","bounce",hn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[$]}],"scale-x":[{"scale-x":[$]}],"scale-y":[{"scale-y":[$]}],rotate:[{rotate:[au,hn]}],"translate-x":[{"translate-x":[W]}],"translate-y":[{"translate-y":[W]}],"skew-x":[{"skew-x":[U]}],"skew-y":[{"skew-y":[U]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",hn]}],accent:[{accent:["auto",t]}],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",hn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",hn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Va,ko,sp]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Fk=xk(Rk);function vt(...t){return Fk(pj(t))}function Tx(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e<t.length;e++)t[e]&&(n=Tx(t[e]))&&(r&&(r+=" "),r+=n);else for(e in t)t[e]&&(r&&(r+=" "),r+=e);return r}function Bk(){for(var t,e,n=0,r="";n<arguments.length;)(t=arguments[n++])&&(e=Tx(t))&&(r&&(r+=" "),r+=e);return r}const W1=t=>typeof t=="boolean"?"".concat(t):t===0?"0":t,$1=Bk,nd=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return $1(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=e,o=Object.keys(s).map(d=>{const f=n==null?void 0:n[d],m=i==null?void 0:i[d];if(f===null)return null;const g=W1(f)||W1(m);return s[d][g]}),l=n&&Object.entries(n).reduce((d,f)=>{let[m,g]=f;return g===void 0||(d[m]=g),d},{}),c=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:m,className:g,...v}=f;return Object.entries(v).every(N=>{let[j,P]=N;return Array.isArray(P)?P.includes({...i,...l}[j]):{...i,...l}[j]===P})?[...d,m,g]:d},[]);return $1(t,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},Tu=nd("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ht=I.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const o=r?Kh:"button";return a.jsx(o,{className:vt(Tu({variant:e,size:n,className:t})),ref:i,...s})});ht.displayName="Button";var wg="Avatar",[Vk,lO]=ed(wg),[qk,Lx]=Vk(wg),Dx=I.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[s,i]=I.useState("idle");return a.jsx(qk,{scope:n,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:a.jsx(sr.span,{...r,ref:e})})});Dx.displayName=wg;var Ix="AvatarImage",Mx=I.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:s=()=>{},...i}=t,o=Lx(Ix,n),l=Uk(r,i.referrerPolicy),c=h2(d=>{s(d),o.onImageLoadingStatusChange(d)});return la(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?a.jsx(sr.img,{...i,ref:e,src:r}):null});Mx.displayName=Ix;var Ex="AvatarFallback",Ox=I.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...s}=t,i=Lx(Ex,n),[o,l]=I.useState(r===void 0);return I.useEffect(()=>{if(r!==void 0){const c=window.setTimeout(()=>l(!0),r);return()=>window.clearTimeout(c)}},[r]),o&&i.imageLoadingStatus!=="loaded"?a.jsx(sr.span,{...s,ref:e}):null});Ox.displayName=Ex;function Uk(t,e){const[n,r]=I.useState("idle");return la(()=>{if(!t){r("error");return}let s=!0;const i=new window.Image,o=l=>()=>{s&&r(l)};return r("loading"),i.onload=o("loaded"),i.onerror=o("error"),i.src=t,e&&(i.referrerPolicy=e),()=>{s=!1}},[t,e]),n}var Rx=Dx,Fx=Mx,Bx=Ox;const tf=I.forwardRef(({className:t,...e},n)=>a.jsx(Rx,{ref:n,className:vt("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));tf.displayName=Rx.displayName;const nf=I.forwardRef(({className:t,...e},n)=>a.jsx(Fx,{ref:n,className:vt("aspect-square h-full w-full",t),...e}));nf.displayName=Fx.displayName;const rf=I.forwardRef(({className:t,...e},n)=>a.jsx(Bx,{ref:n,className:vt("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));rf.displayName=Bx.displayName;/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zk=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Vx=(...t)=>t.filter((e,n,r)=>!!e&&r.indexOf(e)===n).join(" ");/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var Wk={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"};/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $k=I.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},c)=>I.createElement("svg",{ref:c,...Wk,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Vx("lucide",s),...l},[...o.map(([d,f])=>I.createElement(d,f)),...Array.isArray(i)?i:[i]]));/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Nt=(t,e)=>{const n=I.forwardRef(({className:r,...s},i)=>I.createElement($k,{ref:i,iconNode:e,className:Vx(`lucide-${zk(t)}`,r),...s}));return n.displayName=`${t}`,n};/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Hk=Nt("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Kk=Nt("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zl=Nt("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Gk=Nt("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Yk=Nt("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Oo=Nt("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ci=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Zk=Nt("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xk=Nt("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Jk=Nt("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ys=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Dc=Nt("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qx=Nt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qk=Nt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ux=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zx=Nt("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Io=Nt("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Lu=Nt("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wx=Nt("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const e_=Nt("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const t_=Nt("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const n_=Nt("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const r_=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ca=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const s_=Nt("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const i_=Nt("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const a_=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ng=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sf=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const af=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Sc=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const o_=Nt("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xh=Nt("Fingerprint",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bh=Nt("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const l_=Nt("Gavel",[["path",{d:"m14.5 12.5-8 8a2.119 2.119 0 1 1-3-3l8-8",key:"15492f"}],["path",{d:"m16 16 6-6",key:"vzrcl6"}],["path",{d:"m8 8 6-6",key:"18bi4p"}],["path",{d:"m9 7 8 8",key:"5jnvq1"}],["path",{d:"m21 11-8-8",key:"z4y7zo"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const c_=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const H1=Nt("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $x=Nt("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const u_=Nt("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const wh=Nt("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const d_=Nt("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Uo=Nt("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const h_=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const f_=Nt("Medal",[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Hx=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const p_=Nt("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Kx=Nt("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const m_=Nt("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const g_=Nt("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const v_=Nt("Percent",[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const y_=Nt("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ai=Nt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Nh=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const x_=Nt("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const b_=Nt("Scale",[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Gx=Nt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const w_=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Du=Nt("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Bo=Nt("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Yx=Nt("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Zx=Nt("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Iu=Nt("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xx=Nt("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const N_=Nt("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xr=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const j_=Nt("TestTube",[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const jg=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const oi=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const S_=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ta=Nt("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const k_=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const __=Nt("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Hc=Nt("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const A_=Nt("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"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const P_=Nt("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Sg=Nt("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const kg=Nt("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rd=Nt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
* @license lucide-react v0.446.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ic=Nt("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),_g=I.createContext({});function Ag(t){const e=I.useRef(null);return e.current===null&&(e.current=t()),e.current}const of=I.createContext(null),Pg=I.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class C_ extends I.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function T_({children:t,isPresent:e}){const n=I.useId(),r=I.useRef(null),s=I.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=I.useContext(Pg);return I.useInsertionEffect(()=>{const{width:o,height:l,top:c,left:d}=s.current;if(e||!r.current||!o||!l)return;r.current.dataset.motionPopId=n;const f=document.createElement("style");return i&&(f.nonce=i),document.head.appendChild(f),f.sheet&&f.sheet.insertRule(`
[data-motion-pop-id="${n}"] {
position: absolute !important;
width: ${o}px !important;
height: ${l}px !important;
top: ${c}px !important;
left: ${d}px !important;
}
`),()=>{document.head.removeChild(f)}},[e]),a.jsx(C_,{isPresent:e,childRef:r,sizeRef:s,children:I.cloneElement(t,{ref:r})})}const L_=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o})=>{const l=Ag(D_),c=I.useId(),d=I.useCallback(m=>{l.set(m,!0);for(const g of l.values())if(!g)return;r&&r()},[l,r]),f=I.useMemo(()=>({id:c,initial:e,isPresent:n,custom:s,onExitComplete:d,register:m=>(l.set(m,!1),()=>l.delete(m))}),i?[Math.random(),d]:[n,d]);return I.useMemo(()=>{l.forEach((m,g)=>l.set(g,!1))},[n]),I.useEffect(()=>{!n&&!l.size&&r&&r()},[n]),o==="popLayout"&&(t=a.jsx(T_,{isPresent:n,children:t})),a.jsx(of.Provider,{value:f,children:t})};function D_(){return new Map}function Jx(t=!0){const e=I.useContext(of);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=e,i=I.useId();I.useEffect(()=>{t&&s(i)},[t]);const o=I.useCallback(()=>t&&r&&r(i),[i,r,t]);return!n&&r?[!1,o]:[!0]}const Od=t=>t.key||"";function K1(t){const e=[];return I.Children.forEach(t,n=>{I.isValidElement(n)&&e.push(n)}),e}const Cg=typeof window<"u",Qx=Cg?I.useLayoutEffect:I.useEffect,zo=({children:t,custom:e,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:o=!1})=>{const[l,c]=Jx(o),d=I.useMemo(()=>K1(t),[t]),f=o&&!l?[]:d.map(Od),m=I.useRef(!0),g=I.useRef(d),v=Ag(()=>new Map),[N,j]=I.useState(d),[P,k]=I.useState(d);Qx(()=>{m.current=!1,g.current=d;for(let $=0;$<P.length;$++){const Y=Od(P[$]);f.includes(Y)?v.delete(Y):v.get(Y)!==!0&&v.set(Y,!1)}},[P,f.length,f.join("-")]);const _=[];if(d!==N){let $=[...d];for(let Y=0;Y<P.length;Y++){const U=P[Y],te=Od(U);f.includes(te)||($.splice(Y,0,U),_.push(U))}i==="wait"&&_.length&&($=_),k(K1($)),j(d);return}const{forceRender:M}=I.useContext(_g);return a.jsx(a.Fragment,{children:P.map($=>{const Y=Od($),U=o&&!l?!1:d===P||f.includes(Y),te=()=>{if(v.has(Y))v.set(Y,!0);else return;let W=!0;v.forEach(ge=>{ge||(W=!1)}),W&&(M==null||M(),k(g.current),o&&(c==null||c()),r&&r())};return a.jsx(L_,{isPresent:U,initial:!m.current||n?void 0:!1,custom:U?void 0:e,presenceAffectsLayout:s,mode:i,onExitComplete:U?void 0:te,children:$},Y)})})},Gs=t=>t;let nm=Gs;function Tg(t){let e;return()=>(e===void 0&&(e=t()),e)}const Mc=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r},Za=t=>t*1e3,Xa=t=>t/1e3,I_={skipAnimations:!1,useManualTiming:!1};function M_(t){let e=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function l(d){i.has(d)&&(c.schedule(d),t()),d(o)}const c={schedule:(d,f=!1,m=!1)=>{const v=m&&r?e:n;return f&&i.add(d),v.has(d)||v.add(d),d},cancel:d=>{n.delete(d),i.delete(d)},process:d=>{if(o=d,r){s=!0;return}r=!0,[e,n]=[n,e],e.forEach(l),e.clear(),r=!1,s&&(s=!1,c.process(d))}};return c}const Rd=["read","resolveKeyframes","update","preRender","render","postRender"],E_=40;function eb(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=Rd.reduce((k,_)=>(k[_]=M_(i),k),{}),{read:l,resolveKeyframes:c,update:d,preRender:f,render:m,postRender:g}=o,v=()=>{const k=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(k-s.timestamp,E_),1),s.timestamp=k,s.isProcessing=!0,l.process(s),c.process(s),d.process(s),f.process(s),m.process(s),g.process(s),s.isProcessing=!1,n&&e&&(r=!1,t(v))},N=()=>{n=!0,r=!0,s.isProcessing||t(v)};return{schedule:Rd.reduce((k,_)=>{const M=o[_];return k[_]=($,Y=!1,U=!1)=>(n||N(),M.schedule($,Y,U)),k},{}),cancel:k=>{for(let _=0;_<Rd.length;_++)o[Rd[_]].cancel(k)},state:s,steps:o}}const{schedule:tr,cancel:Wo,state:rs,steps:ip}=eb(typeof requestAnimationFrame<"u"?requestAnimationFrame:Gs,!0),tb=I.createContext({strict:!1}),G1={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Ec={};for(const t in G1)Ec[t]={isEnabled:e=>G1[t].some(n=>!!e[n])};function O_(t){for(const e in t)Ec[e]={...Ec[e],...t[e]}}const R_=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function jh(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||R_.has(t)}let nb=t=>!jh(t);function F_(t){t&&(nb=e=>e.startsWith("on")?!jh(e):t(e))}try{F_(require("@emotion/is-prop-valid").default)}catch{}function B_(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(nb(s)||n===!0&&jh(s)||!e&&!jh(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}function V_(t){if(typeof Proxy>"u")return t;const e=new Map,n=(...r)=>t(...r);return new Proxy(n,{get:(r,s)=>s==="create"?t:(e.has(s)||e.set(s,t(s)),e.get(s))})}const lf=I.createContext({});function Mu(t){return typeof t=="string"||Array.isArray(t)}function cf(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Lg=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Dg=["initial",...Lg];function uf(t){return cf(t.animate)||Dg.some(e=>Mu(t[e]))}function rb(t){return!!(uf(t)||t.variants)}function q_(t,e){if(uf(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Mu(n)?n:void 0,animate:Mu(r)?r:void 0}}return t.inherit!==!1?e:{}}function U_(t){const{initial:e,animate:n}=q_(t,I.useContext(lf));return I.useMemo(()=>({initial:e,animate:n}),[Y1(e),Y1(n)])}function Y1(t){return Array.isArray(t)?t.join(" "):t}const z_=Symbol.for("motionComponentSymbol");function pc(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function W_(t,e,n){return I.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):pc(n)&&(n.current=r))},[e])}const Ig=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),$_="framerAppearId",sb="data-"+Ig($_),{schedule:Mg,cancel:cO}=eb(queueMicrotask,!1),ib=I.createContext({});function H_(t,e,n,r,s){var i,o;const{visualElement:l}=I.useContext(lf),c=I.useContext(tb),d=I.useContext(of),f=I.useContext(Pg).reducedMotion,m=I.useRef(null);r=r||c.renderer,!m.current&&r&&(m.current=r(t,{visualState:e,parent:l,props:n,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:f}));const g=m.current,v=I.useContext(ib);g&&!g.projection&&s&&(g.type==="html"||g.type==="svg")&&K_(m.current,n,s,v);const N=I.useRef(!1);I.useInsertionEffect(()=>{g&&N.current&&g.update(n,d)});const j=n[sb],P=I.useRef(!!j&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,j))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,j)));return Qx(()=>{g&&(N.current=!0,window.MotionIsMounted=!0,g.updateFeatures(),Mg.render(g.render),P.current&&g.animationState&&g.animationState.animateChanges())}),I.useEffect(()=>{g&&(!P.current&&g.animationState&&g.animationState.animateChanges(),P.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)===null||k===void 0||k.call(window,j)}),P.current=!1))}),g}function K_(t,e,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:d}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:ab(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||l&&pc(l),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:d})}function ab(t){if(t)return t.options.allowProjection!==!1?t.projection:ab(t.parent)}function G_({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:s}){var i,o;t&&O_(t);function l(d,f){let m;const g={...I.useContext(Pg),...d,layoutId:Y_(d)},{isStatic:v}=g,N=U_(d),j=r(d,v);if(!v&&Cg){Z_();const P=X_(g);m=P.MeasureLayout,N.visualElement=H_(s,j,g,e,P.ProjectionNode)}return a.jsxs(lf.Provider,{value:N,children:[m&&N.visualElement?a.jsx(m,{visualElement:N.visualElement,...g}):null,n(s,d,W_(j,N.visualElement,f),j,v,N.visualElement)]})}l.displayName=`motion.${typeof s=="string"?s:`create(${(o=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&o!==void 0?o:""})`}`;const c=I.forwardRef(l);return c[z_]=s,c}function Y_({layoutId:t}){const e=I.useContext(_g).id;return e&&t!==void 0?e+"-"+t:t}function Z_(t,e){I.useContext(tb).strict}function X_(t){const{drag:e,layout:n}=Ec;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e!=null&&e.isEnabled(t)||n!=null&&n.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const J_=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Eg(t){return typeof t!="string"||t.includes("-")?!1:!!(J_.indexOf(t)>-1||/[A-Z]/u.test(t))}function Z1(t){const e=[{},{}];return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function Og(t,e,n,r){if(typeof e=="function"){const[s,i]=Z1(r);e=e(n!==void 0?n:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=Z1(r);e=e(n!==void 0?n:t.custom,s,i)}return e}const rm=t=>Array.isArray(t),Q_=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),eA=t=>rm(t)?t[t.length-1]||0:t,gs=t=>!!(t&&t.getVelocity);function Gd(t){const e=gs(t)?t.get():t;return Q_(e)?e.toValue():e}function tA({scrapeMotionValuesFromProps:t,createRenderState:e,onUpdate:n},r,s,i){const o={latestValues:nA(r,s,i,t),renderState:e()};return n&&(o.onMount=l=>n({props:r,current:l,...o}),o.onUpdate=l=>n(l)),o}const ob=t=>(e,n)=>{const r=I.useContext(lf),s=I.useContext(of),i=()=>tA(t,e,r,s);return n?i():Ag(i)};function nA(t,e,n,r){const s={},i=r(t,{});for(const g in i)s[g]=Gd(i[g]);let{initial:o,animate:l}=t;const c=uf(t),d=rb(t);e&&d&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),l===void 0&&(l=e.animate));let f=n?n.initial===!1:!1;f=f||o===!1;const m=f?l:o;if(m&&typeof m!="boolean"&&!cf(m)){const g=Array.isArray(m)?m:[m];for(let v=0;v<g.length;v++){const N=Og(t,g[v]);if(N){const{transitionEnd:j,transition:P,...k}=N;for(const _ in k){let M=k[_];if(Array.isArray(M)){const $=f?M.length-1:0;M=M[$]}M!==null&&(s[_]=M)}for(const _ in j)s[_]=j[_]}}}return s}const Kc=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Wl=new Set(Kc),lb=t=>e=>typeof e=="string"&&e.startsWith(t),cb=lb("--"),rA=lb("var(--"),Rg=t=>rA(t)?sA.test(t.split("/*")[0].trim()):!1,sA=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,ub=(t,e)=>e&&typeof t=="number"?e.transform(t):t,no=(t,e,n)=>n>e?e:n<t?t:n,Gc={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Eu={...Gc,transform:t=>no(0,1,t)},Fd={...Gc,default:1},sd=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),To=sd("deg"),na=sd("%"),Gt=sd("px"),iA=sd("vh"),aA=sd("vw"),X1={...na,parse:t=>na.parse(t)/100,transform:t=>na.transform(t*100)},oA={borderWidth:Gt,borderTopWidth:Gt,borderRightWidth:Gt,borderBottomWidth:Gt,borderLeftWidth:Gt,borderRadius:Gt,radius:Gt,borderTopLeftRadius:Gt,borderTopRightRadius:Gt,borderBottomRightRadius:Gt,borderBottomLeftRadius:Gt,width:Gt,maxWidth:Gt,height:Gt,maxHeight:Gt,top:Gt,right:Gt,bottom:Gt,left:Gt,padding:Gt,paddingTop:Gt,paddingRight:Gt,paddingBottom:Gt,paddingLeft:Gt,margin:Gt,marginTop:Gt,marginRight:Gt,marginBottom:Gt,marginLeft:Gt,backgroundPositionX:Gt,backgroundPositionY:Gt},lA={rotate:To,rotateX:To,rotateY:To,rotateZ:To,scale:Fd,scaleX:Fd,scaleY:Fd,scaleZ:Fd,skew:To,skewX:To,skewY:To,distance:Gt,translateX:Gt,translateY:Gt,translateZ:Gt,x:Gt,y:Gt,z:Gt,perspective:Gt,transformPerspective:Gt,opacity:Eu,originX:X1,originY:X1,originZ:Gt},J1={...Gc,transform:Math.round},Fg={...oA,...lA,zIndex:J1,size:Gt,fillOpacity:Eu,strokeOpacity:Eu,numOctaves:J1},cA={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},uA=Kc.length;function dA(t,e,n){let r="",s=!0;for(let i=0;i<uA;i++){const o=Kc[i],l=t[o];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(o.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const d=ub(l,Fg[o]);if(!c){s=!1;const f=cA[o]||o;r+=`${f}(${d}) `}n&&(e[o]=d)}}return r=r.trim(),n?r=n(e,s?"":r):s&&(r="none"),r}function Bg(t,e,n){const{style:r,vars:s,transformOrigin:i}=t;let o=!1,l=!1;for(const c in e){const d=e[c];if(Wl.has(c)){o=!0;continue}else if(cb(c)){s[c]=d;continue}else{const f=ub(d,Fg[c]);c.startsWith("origin")?(l=!0,i[c]=f):r[c]=f}}if(e.transform||(o||n?r.transform=dA(e,t.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:d="50%",originZ:f=0}=i;r.transformOrigin=`${c} ${d} ${f}`}}const hA={offset:"stroke-dashoffset",array:"stroke-dasharray"},fA={offset:"strokeDashoffset",array:"strokeDasharray"};function pA(t,e,n=1,r=0,s=!0){t.pathLength=1;const i=s?hA:fA;t[i.offset]=Gt.transform(-r);const o=Gt.transform(e),l=Gt.transform(n);t[i.array]=`${o} ${l}`}function Q1(t,e,n){return typeof t=="string"?t:Gt.transform(e+n*t)}function mA(t,e,n){const r=Q1(e,t.x,t.width),s=Q1(n,t.y,t.height);return`${r} ${s}`}function Vg(t,{attrX:e,attrY:n,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:l=1,pathOffset:c=0,...d},f,m){if(Bg(t,d,m),f){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:g,style:v,dimensions:N}=t;g.transform&&(N&&(v.transform=g.transform),delete g.transform),N&&(s!==void 0||i!==void 0||v.transform)&&(v.transformOrigin=mA(N,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(g.x=e),n!==void 0&&(g.y=n),r!==void 0&&(g.scale=r),o!==void 0&&pA(g,o,l,c,!1)}const qg=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),db=()=>({...qg(),attrs:{}}),Ug=t=>typeof t=="string"&&t.toLowerCase()==="svg";function hb(t,{style:e,vars:n},r,s){Object.assign(t.style,e,s&&s.getProjectionStyles(r));for(const i in n)t.style.setProperty(i,n[i])}const fb=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function pb(t,e,n,r){hb(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(fb.has(s)?s:Ig(s),e.attrs[s])}const Sh={};function gA(t){Object.assign(Sh,t)}function mb(t,{layout:e,layoutId:n}){return Wl.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Sh[t]||t==="opacity")}function zg(t,e,n){var r;const{style:s}=t,i={};for(const o in s)(gs(s[o])||e.style&&gs(e.style[o])||mb(o,t)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function gb(t,e,n){const r=zg(t,e,n);for(const s in t)if(gs(t[s])||gs(e[s])){const i=Kc.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=t[s]}return r}function vA(t,e){try{e.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{e.dimensions={x:0,y:0,width:0,height:0}}}const ev=["x","y","width","height","cx","cy","r"],yA={useVisualState:ob({scrapeMotionValuesFromProps:gb,createRenderState:db,onUpdate:({props:t,prevProps:e,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!t.drag;if(!i){for(const l in s)if(Wl.has(l)){i=!0;break}}if(!i)return;let o=!e;if(e)for(let l=0;l<ev.length;l++){const c=ev[l];t[c]!==e[c]&&(o=!0)}o&&tr.read(()=>{vA(n,r),tr.render(()=>{Vg(r,s,Ug(n.tagName),t.transformTemplate),pb(n,r)})})}})},xA={useVisualState:ob({scrapeMotionValuesFromProps:zg,createRenderState:qg})};function vb(t,e,n){for(const r in e)!gs(e[r])&&!mb(r,n)&&(t[r]=e[r])}function bA({transformTemplate:t},e){return I.useMemo(()=>{const n=qg();return Bg(n,e,t),Object.assign({},n.vars,n.style)},[e])}function wA(t,e){const n=t.style||{},r={};return vb(r,n,t),Object.assign(r,bA(t,e)),r}function NA(t,e){const n={},r=wA(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}function jA(t,e,n,r){const s=I.useMemo(()=>{const i=db();return Vg(i,e,Ug(r),t.transformTemplate),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};vb(i,t.style,t),s.style={...i,...s.style}}return s}function SA(t=!1){return(n,r,s,{latestValues:i},o)=>{const c=(Eg(n)?jA:NA)(r,i,o,n),d=B_(r,typeof n=="string",t),f=n!==I.Fragment?{...d,...c,ref:s}:{},{children:m}=r,g=I.useMemo(()=>gs(m)?m.get():m,[m]);return I.createElement(n,{...f,children:g})}}function kA(t,e){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const o={...Eg(r)?yA:xA,preloadedFeatures:t,useRender:SA(s),createVisualElement:e,Component:r};return G_(o)}}function yb(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function df(t,e,n){const r=t.getProps();return Og(r,e,n!==void 0?n:r.custom,t)}const _A=Tg(()=>window.ScrollTimeline!==void 0);class AA{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>"finished"in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,n){for(let r=0;r<this.animations.length;r++)this.animations[r][e]=n}attachTimeline(e,n){const r=this.animations.map(s=>{if(_A()&&s.attachTimeline)return s.attachTimeline(e);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let n=0;n<this.animations.length;n++)e=Math.max(e,this.animations[n].duration);return e}runAll(e){this.animations.forEach(n=>n[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class PA extends AA{then(e,n){return Promise.all(this.animations).then(e).catch(n)}}function Wg(t,e){return t?t[e]||t.default||t:void 0}const sm=2e4;function xb(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<sm;)e+=n,r=t.next(e);return e>=sm?1/0:e}function $g(t){return typeof t=="function"}function tv(t,e){t.timeline=e,t.onfinish=null}const Hg=t=>Array.isArray(t)&&typeof t[0]=="number",CA={linearEasing:void 0};function TA(t,e){const n=Tg(t);return()=>{var r;return(r=CA[e])!==null&&r!==void 0?r:n()}}const kh=TA(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),bb=(t,e,n=10)=>{let r="";const s=Math.max(Math.round(e/n),2);for(let i=0;i<s;i++)r+=t(Mc(0,s-1,i))+", ";return`linear(${r.substring(0,r.length-2)})`};function wb(t){return!!(typeof t=="function"&&kh()||!t||typeof t=="string"&&(t in im||kh())||Hg(t)||Array.isArray(t)&&t.every(wb))}const pu=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,im={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:pu([0,.65,.55,1]),circOut:pu([.55,0,1,.45]),backIn:pu([.31,.01,.66,-.59]),backOut:pu([.33,1.53,.69,.99])};function Nb(t,e){if(t)return typeof t=="function"&&kh()?bb(t,e):Hg(t)?pu(t):Array.isArray(t)?t.map(n=>Nb(n,e)||im.easeOut):im[t]}const Si={x:!1,y:!1};function jb(){return Si.x||Si.y}function LA(t,e,n){var r;if(t instanceof Element)return[t];if(typeof t=="string"){let s=document;const i=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t)}function Sb(t,e){const n=LA(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function nv(t){return e=>{e.pointerType==="touch"||jb()||t(e)}}function DA(t,e,n={}){const[r,s,i]=Sb(t,n),o=nv(l=>{const{target:c}=l,d=e(l);if(typeof d!="function"||!c)return;const f=nv(m=>{d(m),c.removeEventListener("pointerleave",f)});c.addEventListener("pointerleave",f,s)});return r.forEach(l=>{l.addEventListener("pointerenter",o,s)}),i}const kb=(t,e)=>e?t===e?!0:kb(t,e.parentElement):!1,Kg=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,IA=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function MA(t){return IA.has(t.tagName)||t.tabIndex!==-1}const mu=new WeakSet;function rv(t){return e=>{e.key==="Enter"&&t(e)}}function ap(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const EA=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=rv(()=>{if(mu.has(n))return;ap(n,"down");const s=rv(()=>{ap(n,"up")}),i=()=>ap(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",i,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function sv(t){return Kg(t)&&!jb()}function OA(t,e,n={}){const[r,s,i]=Sb(t,n),o=l=>{const c=l.currentTarget;if(!sv(l)||mu.has(c))return;mu.add(c);const d=e(l),f=(v,N)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",g),!(!sv(v)||!mu.has(c))&&(mu.delete(c),typeof d=="function"&&d(v,{success:N}))},m=v=>{f(v,n.useGlobalTarget||kb(c,v.target))},g=v=>{f(v,!1)};window.addEventListener("pointerup",m,s),window.addEventListener("pointercancel",g,s)};return r.forEach(l=>{!MA(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),l.addEventListener("focus",d=>EA(d,s),s)}),i}function RA(t){return t==="x"||t==="y"?Si[t]?null:(Si[t]=!0,()=>{Si[t]=!1}):Si.x||Si.y?null:(Si.x=Si.y=!0,()=>{Si.x=Si.y=!1})}const _b=new Set(["width","height","top","left","right","bottom",...Kc]);let Yd;function FA(){Yd=void 0}const ra={now:()=>(Yd===void 0&&ra.set(rs.isProcessing||I_.useManualTiming?rs.timestamp:performance.now()),Yd),set:t=>{Yd=t,queueMicrotask(FA)}};function Gg(t,e){t.indexOf(e)===-1&&t.push(e)}function Yg(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Zg{constructor(){this.subscriptions=[]}add(e){return Gg(this.subscriptions,e),()=>Yg(this.subscriptions,e)}notify(e,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function Ab(t,e){return e?t*(1e3/e):0}const iv=30,BA=t=>!isNaN(parseFloat(t));class VA{constructor(e,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=ra.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=ra.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=BA(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new Zg);const r=this.events[e].add(n);return e==="change"?()=>{r(),tr.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=ra.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>iv)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,iv);return Ab(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Ou(t,e){return new VA(t,e)}function qA(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Ou(n))}function UA(t,e){const n=df(t,e);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const l=eA(i[o]);qA(t,o,l)}}function zA(t){return!!(gs(t)&&t.add)}function am(t,e){const n=t.getValue("willChange");if(zA(n))return n.add(e)}function Pb(t){return t.props[sb]}const Cb=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,WA=1e-7,$A=12;function HA(t,e,n,r,s){let i,o,l=0;do o=e+(n-e)/2,i=Cb(o,r,s)-t,i>0?n=o:e=o;while(Math.abs(i)>WA&&++l<$A);return o}function id(t,e,n,r){if(t===e&&n===r)return Gs;const s=i=>HA(i,0,1,t,n);return i=>i===0||i===1?i:Cb(s(i),e,r)}const Tb=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Lb=t=>e=>1-t(1-e),Db=id(.33,1.53,.69,.99),Xg=Lb(Db),Ib=Tb(Xg),Mb=t=>(t*=2)<1?.5*Xg(t):.5*(2-Math.pow(2,-10*(t-1))),Jg=t=>1-Math.sin(Math.acos(t)),Eb=Lb(Jg),Ob=Tb(Jg),Rb=t=>/^0[^.\s]+$/u.test(t);function KA(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Rb(t):!0}const bu=t=>Math.round(t*1e5)/1e5,Qg=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function GA(t){return t==null}const YA=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,e0=(t,e)=>n=>!!(typeof n=="string"&&YA.test(n)&&n.startsWith(t)||e&&!GA(n)&&Object.prototype.hasOwnProperty.call(n,e)),Fb=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,l]=r.match(Qg);return{[t]:parseFloat(s),[e]:parseFloat(i),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},ZA=t=>no(0,255,t),op={...Gc,transform:t=>Math.round(ZA(t))},Ll={test:e0("rgb","red"),parse:Fb("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+op.transform(t)+", "+op.transform(e)+", "+op.transform(n)+", "+bu(Eu.transform(r))+")"};function XA(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const om={test:e0("#"),parse:XA,transform:Ll.transform},mc={test:e0("hsl","hue"),parse:Fb("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+na.transform(bu(e))+", "+na.transform(bu(n))+", "+bu(Eu.transform(r))+")"},fs={test:t=>Ll.test(t)||om.test(t)||mc.test(t),parse:t=>Ll.test(t)?Ll.parse(t):mc.test(t)?mc.parse(t):om.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Ll.transform(t):mc.transform(t)},JA=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function QA(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Qg))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(JA))===null||n===void 0?void 0:n.length)||0)>0}const Bb="number",Vb="color",eP="var",tP="var(",av="${}",nP=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ru(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const l=e.replace(nP,c=>(fs.test(c)?(r.color.push(i),s.push(Vb),n.push(fs.parse(c))):c.startsWith(tP)?(r.var.push(i),s.push(eP),n.push(c)):(r.number.push(i),s.push(Bb),n.push(parseFloat(c))),++i,av)).split(av);return{values:n,split:l,indexes:r,types:s}}function qb(t){return Ru(t).values}function Ub(t){const{split:e,types:n}=Ru(t),r=e.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=e[o],s[o]!==void 0){const l=n[o];l===Bb?i+=bu(s[o]):l===Vb?i+=fs.transform(s[o]):i+=s[o]}return i}}const rP=t=>typeof t=="number"?0:t;function sP(t){const e=qb(t);return Ub(t)(e.map(rP))}const $o={test:QA,parse:qb,createTransformer:Ub,getAnimatableNone:sP},iP=new Set(["brightness","contrast","saturate","opacity"]);function aP(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(Qg)||[];if(!r)return t;const s=n.replace(r,"");let i=iP.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+s+")"}const oP=/\b([a-z-]*)\(.*?\)/gu,lm={...$o,getAnimatableNone:t=>{const e=t.match(oP);return e?e.map(aP).join(" "):t}},lP={...Fg,color:fs,backgroundColor:fs,outlineColor:fs,fill:fs,stroke:fs,borderColor:fs,borderTopColor:fs,borderRightColor:fs,borderBottomColor:fs,borderLeftColor:fs,filter:lm,WebkitFilter:lm},t0=t=>lP[t];function zb(t,e){let n=t0(t);return n!==lm&&(n=$o),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const cP=new Set(["auto","none","0"]);function uP(t,e,n){let r=0,s;for(;r<t.length&&!s;){const i=t[r];typeof i=="string"&&!cP.has(i)&&Ru(i).values.length&&(s=t[r]),r++}if(s&&n)for(const i of e)t[i]=zb(n,s)}const ov=t=>t===Gc||t===Gt,lv=(t,e)=>parseFloat(t.split(", ")[e]),cv=(t,e)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return lv(s[1],e);{const i=r.match(/^matrix\((.+)\)$/u);return i?lv(i[1],t):0}},dP=new Set(["x","y","z"]),hP=Kc.filter(t=>!dP.has(t));function fP(t){const e=[];return hP.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const Oc={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:cv(4,13),y:cv(5,14)};Oc.translateX=Oc.x;Oc.translateY=Oc.y;const Il=new Set;let cm=!1,um=!1;function Wb(){if(um){const t=Array.from(Il).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=fP(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var l;(l=r.getValue(i))===null||l===void 0||l.set(o)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}um=!1,cm=!1,Il.forEach(t=>t.complete()),Il.clear()}function $b(){Il.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(um=!0)})}function pP(){$b(),Wb()}class n0{constructor(e,n,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Il.add(this),cm||(cm=!0,tr.read($b),tr.resolveKeyframes(Wb))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;for(let i=0;i<e.length;i++)if(e[i]===null)if(i===0){const o=s==null?void 0:s.get(),l=e[e.length-1];if(o!==void 0)e[0]=o;else if(r&&n){const c=r.readValue(n,l);c!=null&&(e[0]=c)}e[0]===void 0&&(e[0]=l),s&&o===void 0&&s.set(e[0])}else e[i]=e[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Il.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Il.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Hb=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),mP=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function gP(t){const e=mP.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}function Kb(t,e,n=1){const[r,s]=gP(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const o=i.trim();return Hb(o)?parseFloat(o):o}return Rg(s)?Kb(s,e,n+1):s}const Gb=t=>e=>e.test(t),vP={test:t=>t==="auto",parse:t=>t},Yb=[Gc,Gt,na,To,aA,iA,vP],uv=t=>Yb.find(Gb(t));class Zb extends n0{constructor(e,n,r,s,i){super(e,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let d=e[c];if(typeof d=="string"&&(d=d.trim(),Rg(d))){const f=Kb(d,n.current);f!==void 0&&(e[c]=f),c===e.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!_b.has(r)||e.length!==2)return;const[s,i]=e,o=uv(s),l=uv(i);if(o!==l)if(ov(o)&&ov(l))for(let c=0;c<e.length;c++){const d=e[c];typeof d=="string"&&(e[c]=parseFloat(d))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)KA(e[s])&&r.push(s);r.length&&uP(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Oc[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var e;const{element:n,name:r,unresolvedKeyframes:s}=this;if(!n||!n.current)return;const i=n.getValue(r);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,l=s[o];s[o]=Oc[r](n.measureViewportBox(),window.getComputedStyle(n.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([c,d])=>{n.getValue(c).set(d)}),this.resolveNoneKeyframes()}}const dv=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&($o.test(t)||t==="0")&&!t.startsWith("url("));function yP(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function xP(t,e,n,r){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],o=dv(s,e),l=dv(i,e);return!o||!l?!1:yP(t)||(n==="spring"||$g(n))&&r}const bP=t=>t!==null;function hf(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(bP),i=e&&n!=="loop"&&e%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const wP=40;class Xb{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=ra.now(),this.options={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>wP?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&pP(),this._resolved}onKeyframesResolved(e,n){this.resolvedAt=ra.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:l,onUpdate:c,isGenerator:d}=this.options;if(!d&&!xP(e,r,s,i))if(o)this.options.duration=0;else{c&&c(hf(e,this.options,n)),l&&l(),this.resolveFinishedPromise();return}const f=this.initPlayback(e,n);f!==!1&&(this._resolved={keyframes:e,finalKeyframe:n,...f},this.onPostResolved())}onPostResolved(){}then(e,n){return this.currentFinishedPromise.then(e,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}const hr=(t,e,n)=>t+(e-t)*n;function lp(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function NP({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,i=0,o=0;if(!e)s=i=o=n;else{const l=n<.5?n*(1+e):n+e-n*e,c=2*n-l;s=lp(c,l,t+1/3),i=lp(c,l,t),o=lp(c,l,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function _h(t,e){return n=>n>0?e:t}const cp=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},jP=[om,Ll,mc],SP=t=>jP.find(e=>e.test(t));function hv(t){const e=SP(t);if(!e)return!1;let n=e.parse(t);return e===mc&&(n=NP(n)),n}const fv=(t,e)=>{const n=hv(t),r=hv(e);if(!n||!r)return _h(t,e);const s={...n};return i=>(s.red=cp(n.red,r.red,i),s.green=cp(n.green,r.green,i),s.blue=cp(n.blue,r.blue,i),s.alpha=hr(n.alpha,r.alpha,i),Ll.transform(s))},kP=(t,e)=>n=>e(t(n)),ad=(...t)=>t.reduce(kP),dm=new Set(["none","hidden"]);function _P(t,e){return dm.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function AP(t,e){return n=>hr(t,e,n)}function r0(t){return typeof t=="number"?AP:typeof t=="string"?Rg(t)?_h:fs.test(t)?fv:TP:Array.isArray(t)?Jb:typeof t=="object"?fs.test(t)?fv:PP:_h}function Jb(t,e){const n=[...t],r=n.length,s=t.map((i,o)=>r0(i)(i,e[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function PP(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=r0(t[s])(t[s],e[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function CP(t,e){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const o=e.types[i],l=t.indexes[o][s[o]],c=(n=t.values[l])!==null&&n!==void 0?n:0;r[i]=c,s[o]++}return r}const TP=(t,e)=>{const n=$o.createTransformer(e),r=Ru(t),s=Ru(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?dm.has(t)&&!s.values.length||dm.has(e)&&!r.values.length?_P(t,e):ad(Jb(CP(r,s),s.values),n):_h(t,e)};function Qb(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?hr(t,e,n):r0(t)(t,e)}const LP=5;function e5(t,e,n){const r=Math.max(e-LP,0);return Ab(n-t(r),e-r)}const yr={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},up=.001;function DP({duration:t=yr.duration,bounce:e=yr.bounce,velocity:n=yr.velocity,mass:r=yr.mass}){let s,i,o=1-e;o=no(yr.minDamping,yr.maxDamping,o),t=no(yr.minDuration,yr.maxDuration,Xa(t)),o<1?(s=d=>{const f=d*o,m=f*t,g=f-n,v=hm(d,o),N=Math.exp(-m);return up-g/v*N},i=d=>{const m=d*o*t,g=m*n+n,v=Math.pow(o,2)*Math.pow(d,2)*t,N=Math.exp(-m),j=hm(Math.pow(d,2),o);return(-s(d)+up>0?-1:1)*((g-v)*N)/j}):(s=d=>{const f=Math.exp(-d*t),m=(d-n)*t+1;return-up+f*m},i=d=>{const f=Math.exp(-d*t),m=(n-d)*(t*t);return f*m});const l=5/t,c=MP(s,i,l);if(t=Za(t),isNaN(c))return{stiffness:yr.stiffness,damping:yr.damping,duration:t};{const d=Math.pow(c,2)*r;return{stiffness:d,damping:o*2*Math.sqrt(r*d),duration:t}}}const IP=12;function MP(t,e,n){let r=n;for(let s=1;s<IP;s++)r=r-t(r)/e(r);return r}function hm(t,e){return t*Math.sqrt(1-e*e)}const EP=["duration","bounce"],OP=["stiffness","damping","mass"];function pv(t,e){return e.some(n=>t[n]!==void 0)}function RP(t){let e={velocity:yr.velocity,stiffness:yr.stiffness,damping:yr.damping,mass:yr.mass,isResolvedFromDuration:!1,...t};if(!pv(t,OP)&&pv(t,EP))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*no(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:yr.mass,stiffness:s,damping:i}}else{const n=DP(t);e={...e,...n,mass:yr.mass},e.isResolvedFromDuration=!0}return e}function t5(t=yr.visualDuration,e=yr.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:d,mass:f,duration:m,velocity:g,isResolvedFromDuration:v}=RP({...n,velocity:-Xa(n.velocity||0)}),N=g||0,j=d/(2*Math.sqrt(c*f)),P=o-i,k=Xa(Math.sqrt(c/f)),_=Math.abs(P)<5;r||(r=_?yr.restSpeed.granular:yr.restSpeed.default),s||(s=_?yr.restDelta.granular:yr.restDelta.default);let M;if(j<1){const Y=hm(k,j);M=U=>{const te=Math.exp(-j*k*U);return o-te*((N+j*k*P)/Y*Math.sin(Y*U)+P*Math.cos(Y*U))}}else if(j===1)M=Y=>o-Math.exp(-k*Y)*(P+(N+k*P)*Y);else{const Y=k*Math.sqrt(j*j-1);M=U=>{const te=Math.exp(-j*k*U),W=Math.min(Y*U,300);return o-te*((N+j*k*P)*Math.sinh(W)+Y*P*Math.cosh(W))/Y}}const $={calculatedDuration:v&&m||null,next:Y=>{const U=M(Y);if(v)l.done=Y>=m;else{let te=0;j<1&&(te=Y===0?Za(N):e5(M,Y,U));const W=Math.abs(te)<=r,ge=Math.abs(o-U)<=s;l.done=W&&ge}return l.value=l.done?o:U,l},toString:()=>{const Y=Math.min(xb($),sm),U=bb(te=>$.next(Y*te).value,Y,30);return Y+"ms "+U}};return $}function mv({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:l,max:c,restDelta:d=.5,restSpeed:f}){const m=t[0],g={done:!1,value:m},v=W=>l!==void 0&&W<l||c!==void 0&&W>c,N=W=>l===void 0?c:c===void 0||Math.abs(l-W)<Math.abs(c-W)?l:c;let j=n*e;const P=m+j,k=o===void 0?P:o(P);k!==P&&(j=k-m);const _=W=>-j*Math.exp(-W/r),M=W=>k+_(W),$=W=>{const ge=_(W),oe=M(W);g.done=Math.abs(ge)<=d,g.value=g.done?k:oe};let Y,U;const te=W=>{v(g.value)&&(Y=W,U=t5({keyframes:[g.value,N(g.value)],velocity:e5(M,W,g.value),damping:s,stiffness:i,restDelta:d,restSpeed:f}))};return te(0),{calculatedDuration:null,next:W=>{let ge=!1;return!U&&Y===void 0&&(ge=!0,$(W),te(W)),Y!==void 0&&W>=Y?U.next(W-Y):(!ge&&$(W),g)}}}const FP=id(.42,0,1,1),BP=id(0,0,.58,1),n5=id(.42,0,.58,1),VP=t=>Array.isArray(t)&&typeof t[0]!="number",gv={linear:Gs,easeIn:FP,easeInOut:n5,easeOut:BP,circIn:Jg,circInOut:Ob,circOut:Eb,backIn:Xg,backInOut:Ib,backOut:Db,anticipate:Mb},vv=t=>{if(Hg(t)){nm(t.length===4);const[e,n,r,s]=t;return id(e,n,r,s)}else if(typeof t=="string")return nm(gv[t]!==void 0),gv[t];return t};function qP(t,e,n){const r=[],s=n||Qb,i=t.length-1;for(let o=0;o<i;o++){let l=s(t[o],t[o+1]);if(e){const c=Array.isArray(e)?e[o]||Gs:e;l=ad(c,l)}r.push(l)}return r}function UP(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const i=t.length;if(nm(i===e.length),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const l=qP(e,r,s),c=l.length,d=f=>{if(o&&f<t[0])return e[0];let m=0;if(c>1)for(;m<t.length-2&&!(f<t[m+1]);m++);const g=Mc(t[m],t[m+1],f);return l[m](g)};return n?f=>d(no(t[0],t[i-1],f)):d}function zP(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=Mc(0,e,r);t.push(hr(n,1,s))}}function WP(t){const e=[0];return zP(e,t.length-1),e}function $P(t,e){return t.map(n=>n*e)}function HP(t,e){return t.map(()=>e||n5).splice(0,t.length-1)}function Ah({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=VP(r)?r.map(vv):vv(r),i={done:!1,value:e[0]},o=$P(n&&n.length===e.length?n:WP(e),t),l=UP(o,e,{ease:Array.isArray(s)?s:HP(e,s)});return{calculatedDuration:t,next:c=>(i.value=l(c),i.done=c>=t,i)}}const KP=t=>{const e=({timestamp:n})=>t(n);return{start:()=>tr.update(e,!0),stop:()=>Wo(e),now:()=>rs.isProcessing?rs.timestamp:ra.now()}},GP={decay:mv,inertia:mv,tween:Ah,keyframes:Ah,spring:t5},YP=t=>t/100;class s0 extends Xb{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,o=(s==null?void 0:s.KeyframeResolver)||n0,l=(c,d)=>this.onKeyframesResolved(c,d);this.resolver=new o(i,l,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,l=$g(n)?n:GP[n]||Ah;let c,d;l!==Ah&&typeof e[0]!="number"&&(c=ad(YP,Qb(e[0],e[1])),e=[0,100]);const f=l({...this.options,keyframes:e});i==="mirror"&&(d=l({...this.options,keyframes:[...e].reverse(),velocity:-o})),f.calculatedDuration===null&&(f.calculatedDuration=xb(f));const{calculatedDuration:m}=f,g=m+s,v=g*(r+1)-s;return{generator:f,mirroredGenerator:d,mapPercentToKeyframes:c,calculatedDuration:m,resolvedDuration:g,totalDuration:v}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,n=!1){const{resolved:r}=this;if(!r){const{keyframes:W}=this.options;return{done:!0,value:W[W.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:d,totalDuration:f,resolvedDuration:m}=r;if(this.startTime===null)return i.next(0);const{delay:g,repeat:v,repeatType:N,repeatDelay:j,onUpdate:P}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-f/this.speed,this.startTime)),n?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const k=this.currentTime-g*(this.speed>=0?1:-1),_=this.speed>=0?k<0:k>f;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=f);let M=this.currentTime,$=i;if(v){const W=Math.min(this.currentTime,f)/m;let ge=Math.floor(W),oe=W%1;!oe&&W>=1&&(oe=1),oe===1&&ge--,ge=Math.min(ge,v+1),!!(ge%2)&&(N==="reverse"?(oe=1-oe,j&&(oe-=j/m)):N==="mirror"&&($=o)),M=no(0,1,oe)*m}const Y=_?{done:!1,value:c[0]}:$.next(M);l&&(Y.value=l(Y.value));let{done:U}=Y;!_&&d!==null&&(U=this.speed>=0?this.currentTime>=f:this.currentTime<=0);const te=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&U);return te&&s!==void 0&&(Y.value=hf(c,this.options,s)),P&&P(Y.value),te&&this.finish(),Y}get duration(){const{resolved:e}=this;return e?Xa(e.calculatedDuration):0}get time(){return Xa(this.currentTime)}set time(e){e=Za(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=Xa(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=KP,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const ZP=new Set(["opacity","clipPath","filter","transform"]);function XP(t,e,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:l="easeInOut",times:c}={}){const d={[e]:n};c&&(d.offset=c);const f=Nb(l,s);return Array.isArray(f)&&(d.easing=f),t.animate(d,{delay:r,duration:s,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const JP=Tg(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Ph=10,QP=2e4;function eC(t){return $g(t.type)||t.type==="spring"||!wb(t.ease)}function tC(t,e){const n=new s0({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const s=[];let i=0;for(;!r.done&&i<QP;)r=n.sample(i),s.push(r.value),i+=Ph;return{times:void 0,keyframes:s,duration:i-Ph,ease:"linear"}}const r5={anticipate:Mb,backInOut:Ib,circInOut:Ob};function nC(t){return t in r5}class yv extends Xb{constructor(e){super(e);const{name:n,motionValue:r,element:s,keyframes:i}=this.options;this.resolver=new Zb(i,(o,l)=>this.onKeyframesResolved(o,l),n,r,s),this.resolver.scheduleResolve()}initPlayback(e,n){let{duration:r=300,times:s,ease:i,type:o,motionValue:l,name:c,startTime:d}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof i=="string"&&kh()&&nC(i)&&(i=r5[i]),eC(this.options)){const{onComplete:m,onUpdate:g,motionValue:v,element:N,...j}=this.options,P=tC(e,j);e=P.keyframes,e.length===1&&(e[1]=e[0]),r=P.duration,s=P.times,i=P.ease,o="keyframes"}const f=XP(l.owner.current,c,e,{...this.options,duration:r,times:s,ease:i});return f.startTime=d??this.calcStartTime(),this.pendingTimeline?(tv(f,this.pendingTimeline),this.pendingTimeline=void 0):f.onfinish=()=>{const{onComplete:m}=this.options;l.set(hf(e,this.options,n)),m&&m(),this.cancel(),this.resolveFinishedPromise()},{animation:f,duration:r,times:s,type:o,ease:i,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:n}=e;return Xa(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return Xa(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=Za(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:n}=e;return n.playbackRate}set speed(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:n}=e;return n.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:n}=e;return n.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:n}=this;if(!n)return Gs;const{animation:r}=n;tv(r,e)}return Gs}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:n,keyframes:r,duration:s,type:i,ease:o,times:l}=e;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:d,onUpdate:f,onComplete:m,element:g,...v}=this.options,N=new s0({...v,keyframes:r,duration:s,type:i,ease:o,times:l,isGenerator:!0}),j=Za(this.time);d.setWithVelocity(N.sample(j-Ph).value,N.sample(j).value,Ph)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:o,type:l}=e;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:d}=n.owner.getProps();return JP()&&r&&ZP.has(r)&&!c&&!d&&!s&&i!=="mirror"&&o!==0&&l!=="inertia"}}const rC={type:"spring",stiffness:500,damping:25,restSpeed:10},sC=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),iC={type:"keyframes",duration:.8},aC={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},oC=(t,{keyframes:e})=>e.length>2?iC:Wl.has(t)?t.startsWith("scale")?sC(e[1]):rC:aC;function lC({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:l,from:c,elapsed:d,...f}){return!!Object.keys(f).length}const i0=(t,e,n,r={},s,i)=>o=>{const l=Wg(r,t)||{},c=l.delay||r.delay||0;let{elapsed:d=0}=r;d=d-Za(c);let f={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-d,onUpdate:g=>{e.set(g),l.onUpdate&&l.onUpdate(g)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:i?void 0:s};lC(l)||(f={...f,...oC(t,f)}),f.duration&&(f.duration=Za(f.duration)),f.repeatDelay&&(f.repeatDelay=Za(f.repeatDelay)),f.from!==void 0&&(f.keyframes[0]=f.from);let m=!1;if((f.type===!1||f.duration===0&&!f.repeatDelay)&&(f.duration=0,f.delay===0&&(m=!0)),m&&!i&&e.get()!==void 0){const g=hf(f.keyframes,l);if(g!==void 0)return tr.update(()=>{f.onUpdate(g),f.onComplete()}),new PA([])}return!i&&yv.supports(f)?new yv(f):new s0(f)};function cC({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function s5(t,e,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:o=t.getDefaultTransition(),transitionEnd:l,...c}=e;r&&(o=r);const d=[],f=s&&t.animationState&&t.animationState.getState()[s];for(const m in c){const g=t.getValue(m,(i=t.latestValues[m])!==null&&i!==void 0?i:null),v=c[m];if(v===void 0||f&&cC(f,m))continue;const N={delay:n,...Wg(o||{},m)};let j=!1;if(window.MotionHandoffAnimation){const k=Pb(t);if(k){const _=window.MotionHandoffAnimation(k,m,tr);_!==null&&(N.startTime=_,j=!0)}}am(t,m),g.start(i0(m,g,v,t.shouldReduceMotion&&_b.has(m)?{type:!1}:N,t,j));const P=g.animation;P&&d.push(P)}return l&&Promise.all(d).then(()=>{tr.update(()=>{l&&UA(t,l)})}),d}function fm(t,e,n={}){var r;const s=df(t,e,n.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>Promise.all(s5(t,s,n)):()=>Promise.resolve(),l=t.variantChildren&&t.variantChildren.size?(d=0)=>{const{delayChildren:f=0,staggerChildren:m,staggerDirection:g}=i;return uC(t,e,f+d,m,g,n)}:()=>Promise.resolve(),{when:c}=i;if(c){const[d,f]=c==="beforeChildren"?[o,l]:[l,o];return d().then(()=>f())}else return Promise.all([o(),l(n.delay)])}function uC(t,e,n=0,r=0,s=1,i){const o=[],l=(t.variantChildren.size-1)*r,c=s===1?(d=0)=>d*r:(d=0)=>l-d*r;return Array.from(t.variantChildren).sort(dC).forEach((d,f)=>{d.notify("AnimationStart",e),o.push(fm(d,e,{...i,delay:n+c(f)}).then(()=>d.notify("AnimationComplete",e)))}),Promise.all(o)}function dC(t,e){return t.sortNodePosition(e)}function hC(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>fm(t,i,n));r=Promise.all(s)}else if(typeof e=="string")r=fm(t,e,n);else{const s=typeof e=="function"?df(t,e,n.custom):e;r=Promise.all(s5(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}const fC=Dg.length;function i5(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?i5(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<fC;n++){const r=Dg[n],s=t.props[r];(Mu(s)||s===!1)&&(e[r]=s)}return e}const pC=[...Lg].reverse(),mC=Lg.length;function gC(t){return e=>Promise.all(e.map(({animation:n,options:r})=>hC(t,n,r)))}function vC(t){let e=gC(t),n=xv(),r=!0;const s=c=>(d,f)=>{var m;const g=df(t,f,c==="exit"?(m=t.presenceContext)===null||m===void 0?void 0:m.custom:void 0);if(g){const{transition:v,transitionEnd:N,...j}=g;d={...d,...j,...N}}return d};function i(c){e=c(t)}function o(c){const{props:d}=t,f=i5(t.parent)||{},m=[],g=new Set;let v={},N=1/0;for(let P=0;P<mC;P++){const k=pC[P],_=n[k],M=d[k]!==void 0?d[k]:f[k],$=Mu(M),Y=k===c?_.isActive:null;Y===!1&&(N=P);let U=M===f[k]&&M!==d[k]&&$;if(U&&r&&t.manuallyAnimateOnMount&&(U=!1),_.protectedKeys={...v},!_.isActive&&Y===null||!M&&!_.prevProp||cf(M)||typeof M=="boolean")continue;const te=yC(_.prevProp,M);let W=te||k===c&&_.isActive&&!U&&$||P>N&&$,ge=!1;const oe=Array.isArray(M)?M:[M];let B=oe.reduce(s(k),{});Y===!1&&(B={});const{prevResolvedValues:T={}}=_,J={...T,...B},Z=ae=>{W=!0,g.has(ae)&&(ge=!0,g.delete(ae)),_.needsAnimating[ae]=!0;const G=t.getValue(ae);G&&(G.liveStyle=!1)};for(const ae in J){const G=B[ae],xe=T[ae];if(v.hasOwnProperty(ae))continue;let De=!1;rm(G)&&rm(xe)?De=!yb(G,xe):De=G!==xe,De?G!=null?Z(ae):g.add(ae):G!==void 0&&g.has(ae)?Z(ae):_.protectedKeys[ae]=!0}_.prevProp=M,_.prevResolvedValues=B,_.isActive&&(v={...v,...B}),r&&t.blockInitialAnimation&&(W=!1),W&&(!(U&&te)||ge)&&m.push(...oe.map(ae=>({animation:ae,options:{type:k}})))}if(g.size){const P={};g.forEach(k=>{const _=t.getBaseTarget(k),M=t.getValue(k);M&&(M.liveStyle=!0),P[k]=_??null}),m.push({animation:P})}let j=!!m.length;return r&&(d.initial===!1||d.initial===d.animate)&&!t.manuallyAnimateOnMount&&(j=!1),r=!1,j?e(m):Promise.resolve()}function l(c,d){var f;if(n[c].isActive===d)return Promise.resolve();(f=t.variantChildren)===null||f===void 0||f.forEach(g=>{var v;return(v=g.animationState)===null||v===void 0?void 0:v.setActive(c,d)}),n[c].isActive=d;const m=o(c);for(const g in n)n[g].protectedKeys={};return m}return{animateChanges:o,setActive:l,setAnimateFunction:i,getState:()=>n,reset:()=>{n=xv(),r=!0}}}function yC(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!yb(e,t):!1}function yl(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function xv(){return{animate:yl(!0),whileInView:yl(),whileHover:yl(),whileTap:yl(),whileDrag:yl(),whileFocus:yl(),exit:yl()}}class Jo{constructor(e){this.isMounted=!1,this.node=e}update(){}}class xC extends Jo{constructor(e){super(e),e.animationState||(e.animationState=vC(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();cf(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let bC=0;class wC extends Jo{constructor(){super(...arguments),this.id=bC++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const NC={animation:{Feature:xC},exit:{Feature:wC}};function Fu(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function od(t){return{point:{x:t.pageX,y:t.pageY}}}const jC=t=>e=>Kg(e)&&t(e,od(e));function wu(t,e,n,r){return Fu(t,e,jC(n),r)}const bv=(t,e)=>Math.abs(t-e);function SC(t,e){const n=bv(t.x,e.x),r=bv(t.y,e.y);return Math.sqrt(n**2+r**2)}class a5{constructor(e,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const m=hp(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,v=SC(m.offset,{x:0,y:0})>=3;if(!g&&!v)return;const{point:N}=m,{timestamp:j}=rs;this.history.push({...N,timestamp:j});const{onStart:P,onMove:k}=this.handlers;g||(P&&P(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,m)},this.handlePointerMove=(m,g)=>{this.lastMoveEvent=m,this.lastMoveEventInfo=dp(g,this.transformPagePoint),tr.update(this.updatePoint,!0)},this.handlePointerUp=(m,g)=>{this.end();const{onEnd:v,onSessionEnd:N,resumeAnimation:j}=this.handlers;if(this.dragSnapToOrigin&&j&&j(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const P=hp(m.type==="pointercancel"?this.lastMoveEventInfo:dp(g,this.transformPagePoint),this.history);this.startEvent&&v&&v(m,P),N&&N(m,P)},!Kg(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const o=od(e),l=dp(o,this.transformPagePoint),{point:c}=l,{timestamp:d}=rs;this.history=[{...c,timestamp:d}];const{onSessionStart:f}=n;f&&f(e,hp(l,this.history)),this.removeListeners=ad(wu(this.contextWindow,"pointermove",this.handlePointerMove),wu(this.contextWindow,"pointerup",this.handlePointerUp),wu(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Wo(this.updatePoint)}}function dp(t,e){return e?{point:e(t.point)}:t}function wv(t,e){return{x:t.x-e.x,y:t.y-e.y}}function hp({point:t},e){return{point:t,delta:wv(t,o5(e)),offset:wv(t,kC(e)),velocity:_C(e,.1)}}function kC(t){return t[0]}function o5(t){return t[t.length-1]}function _C(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=o5(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>Za(e)));)n--;if(!r)return{x:0,y:0};const i=Xa(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const l5=1e-4,AC=1-l5,PC=1+l5,c5=.01,CC=0-c5,TC=0+c5;function Zs(t){return t.max-t.min}function LC(t,e,n){return Math.abs(t-e)<=n}function Nv(t,e,n,r=.5){t.origin=r,t.originPoint=hr(e.min,e.max,t.origin),t.scale=Zs(n)/Zs(e),t.translate=hr(n.min,n.max,t.origin)-t.originPoint,(t.scale>=AC&&t.scale<=PC||isNaN(t.scale))&&(t.scale=1),(t.translate>=CC&&t.translate<=TC||isNaN(t.translate))&&(t.translate=0)}function Nu(t,e,n,r){Nv(t.x,e.x,n.x,r?r.originX:void 0),Nv(t.y,e.y,n.y,r?r.originY:void 0)}function jv(t,e,n){t.min=n.min+e.min,t.max=t.min+Zs(e)}function DC(t,e,n){jv(t.x,e.x,n.x),jv(t.y,e.y,n.y)}function Sv(t,e,n){t.min=e.min-n.min,t.max=t.min+Zs(e)}function ju(t,e,n){Sv(t.x,e.x,n.x),Sv(t.y,e.y,n.y)}function IC(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?hr(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?hr(n,t,r.max):Math.min(t,n)),t}function kv(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function MC(t,{top:e,left:n,bottom:r,right:s}){return{x:kv(t.x,n,s),y:kv(t.y,e,r)}}function _v(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function EC(t,e){return{x:_v(t.x,e.x),y:_v(t.y,e.y)}}function OC(t,e){let n=.5;const r=Zs(t),s=Zs(e);return s>r?n=Mc(e.min,e.max-r,t.min):r>s&&(n=Mc(t.min,t.max-s,e.min)),no(0,1,n)}function RC(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const pm=.35;function FC(t=pm){return t===!1?t=0:t===!0&&(t=pm),{x:Av(t,"left","right"),y:Av(t,"top","bottom")}}function Av(t,e,n){return{min:Pv(t,e),max:Pv(t,n)}}function Pv(t,e){return typeof t=="number"?t:t[e]||0}const Cv=()=>({translate:0,scale:1,origin:0,originPoint:0}),gc=()=>({x:Cv(),y:Cv()}),Tv=()=>({min:0,max:0}),jr=()=>({x:Tv(),y:Tv()});function ai(t){return[t("x"),t("y")]}function u5({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function BC({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function VC(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function fp(t){return t===void 0||t===1}function mm({scale:t,scaleX:e,scaleY:n}){return!fp(t)||!fp(e)||!fp(n)}function bl(t){return mm(t)||d5(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function d5(t){return Lv(t.x)||Lv(t.y)}function Lv(t){return t&&t!=="0%"}function Ch(t,e,n){const r=t-n,s=e*r;return n+s}function Dv(t,e,n,r,s){return s!==void 0&&(t=Ch(t,s,r)),Ch(t,n,r)+e}function gm(t,e=0,n=1,r,s){t.min=Dv(t.min,e,n,r,s),t.max=Dv(t.max,e,n,r,s)}function h5(t,{x:e,y:n}){gm(t.x,e.translate,e.scale,e.originPoint),gm(t.y,n.translate,n.scale,n.originPoint)}const Iv=.999999999999,Mv=1.0000000000001;function qC(t,e,n,r=!1){const s=n.length;if(!s)return;e.x=e.y=1;let i,o;for(let l=0;l<s;l++){i=n[l],o=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&yc(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,h5(t,o)),r&&bl(i.latestValues)&&yc(t,i.latestValues))}e.x<Mv&&e.x>Iv&&(e.x=1),e.y<Mv&&e.y>Iv&&(e.y=1)}function vc(t,e){t.min=t.min+e,t.max=t.max+e}function Ev(t,e,n,r,s=.5){const i=hr(t.min,t.max,s);gm(t,e,n,i,r)}function yc(t,e){Ev(t.x,e.x,e.scaleX,e.scale,e.originX),Ev(t.y,e.y,e.scaleY,e.scale,e.originY)}function f5(t,e){return u5(VC(t.getBoundingClientRect(),e))}function UC(t,e,n){const r=f5(t,n),{scroll:s}=e;return s&&(vc(r.x,s.offset.x),vc(r.y,s.offset.y)),r}const p5=({current:t})=>t?t.ownerDocument.defaultView:null,zC=new WeakMap;class WC{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=jr(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=f=>{const{dragSnapToOrigin:m}=this.getProps();m?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(od(f).point)},i=(f,m)=>{const{drag:g,dragPropagation:v,onDragStart:N}=this.getProps();if(g&&!v&&(this.openDragLock&&this.openDragLock(),this.openDragLock=RA(g),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ai(P=>{let k=this.getAxisMotionValue(P).get()||0;if(na.test(k)){const{projection:_}=this.visualElement;if(_&&_.layout){const M=_.layout.layoutBox[P];M&&(k=Zs(M)*(parseFloat(k)/100))}}this.originPoint[P]=k}),N&&tr.postRender(()=>N(f,m)),am(this.visualElement,"transform");const{animationState:j}=this.visualElement;j&&j.setActive("whileDrag",!0)},o=(f,m)=>{const{dragPropagation:g,dragDirectionLock:v,onDirectionLock:N,onDrag:j}=this.getProps();if(!g&&!this.openDragLock)return;const{offset:P}=m;if(v&&this.currentDirection===null){this.currentDirection=$C(P),this.currentDirection!==null&&N&&N(this.currentDirection);return}this.updateAxis("x",m.point,P),this.updateAxis("y",m.point,P),this.visualElement.render(),j&&j(f,m)},l=(f,m)=>this.stop(f,m),c=()=>ai(f=>{var m;return this.getAnimationState(f)==="paused"&&((m=this.getAxisMotionValue(f).animation)===null||m===void 0?void 0:m.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new a5(e,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,contextWindow:p5(this.visualElement)})}stop(e,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&tr.postRender(()=>i(e,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:s}=this.getProps();if(!r||!Bd(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=IC(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var e;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,i=this.constraints;n&&pc(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=MC(s.layoutBox,n):this.constraints=!1,this.elastic=FC(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&ai(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=RC(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!pc(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=UC(r,s.root,this.visualElement.getTransformPagePoint());let o=EC(s.layout.layoutBox,i);if(n){const l=n(BC(o));this.hasMutatedConstraints=!!l,l&&(o=u5(l))}return o}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},d=ai(f=>{if(!Bd(f,n,this.currentDirection))return;let m=c&&c[f]||{};o&&(m={min:0,max:0});const g=s?200:1e6,v=s?40:1e7,N={type:"inertia",velocity:r?e[f]:0,bounceStiffness:g,bounceDamping:v,timeConstant:750,restDelta:1,restSpeed:10,...i,...m};return this.startAxisValueAnimation(f,N)});return Promise.all(d).then(l)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return am(this.visualElement,e),r.start(i0(e,r,0,n,this.visualElement,!1))}stopAnimation(){ai(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){ai(e=>{var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){ai(n=>{const{drag:r}=this.getProps();if(!Bd(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[n];i.set(e[n]-hr(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!pc(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};ai(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();s[o]=OC({min:c,max:c},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),ai(o=>{if(!Bd(o,e,null))return;const l=this.getAxisMotionValue(o),{min:c,max:d}=this.constraints[o];l.set(hr(c,d,s[o]))})}addListeners(){if(!this.visualElement.current)return;zC.set(this.visualElement,this);const e=this.visualElement.current,n=wu(e,"pointerdown",c=>{const{drag:d,dragListener:f=!0}=this.getProps();d&&f&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();pc(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),tr.read(r);const o=Fu(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&(ai(f=>{const m=this.getAxisMotionValue(f);m&&(this.originPoint[f]+=c[f].translate,m.set(m.get()+c[f].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),l&&l()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=pm,dragMomentum:l=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:l}}}function Bd(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function $C(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class HC extends Jo{constructor(e){super(e),this.removeGroupControls=Gs,this.removeListeners=Gs,this.controls=new WC(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Gs}unmount(){this.removeGroupControls(),this.removeListeners()}}const Ov=t=>(e,n)=>{t&&tr.postRender(()=>t(e,n))};class KC extends Jo{constructor(){super(...arguments),this.removePointerDownListener=Gs}onPointerDown(e){this.session=new a5(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:p5(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:Ov(e),onStart:Ov(n),onMove:r,onEnd:(i,o)=>{delete this.session,s&&tr.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=wu(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Zd={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Rv(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const lu={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Gt.test(t))t=parseFloat(t);else return t;const n=Rv(t,e.target.x),r=Rv(t,e.target.y);return`${n}% ${r}%`}},GC={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=$o.parse(t);if(s.length>5)return r;const i=$o.createTransformer(t),o=typeof s[0]!="number"?1:0,l=n.x.scale*e.x,c=n.y.scale*e.y;s[0+o]/=l,s[1+o]/=c;const d=hr(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=d),typeof s[3+o]=="number"&&(s[3+o]/=d),i(s)}};class YC extends I.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;gA(ZC),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),Zd.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||e.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||tr.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),Mg.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function m5(t){const[e,n]=Jx(),r=I.useContext(_g);return a.jsx(YC,{...t,layoutGroup:r,switchLayoutGroup:I.useContext(ib),isPresent:e,safeToRemove:n})}const ZC={borderRadius:{...lu,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:lu,borderTopRightRadius:lu,borderBottomLeftRadius:lu,borderBottomRightRadius:lu,boxShadow:GC};function XC(t,e,n){const r=gs(t)?t:Ou(t);return r.start(i0("",r,e,n)),r.animation}function JC(t){return t instanceof SVGElement&&t.tagName!=="svg"}const QC=(t,e)=>t.depth-e.depth;class e8{constructor(){this.children=[],this.isDirty=!1}add(e){Gg(this.children,e),this.isDirty=!0}remove(e){Yg(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(QC),this.isDirty=!1,this.children.forEach(e)}}function t8(t,e){const n=ra.now(),r=({timestamp:s})=>{const i=s-n;i>=e&&(Wo(r),t(i-e))};return tr.read(r,!0),()=>Wo(r)}const g5=["TopLeft","TopRight","BottomLeft","BottomRight"],n8=g5.length,Fv=t=>typeof t=="string"?parseFloat(t):t,Bv=t=>typeof t=="number"||Gt.test(t);function r8(t,e,n,r,s,i){s?(t.opacity=hr(0,n.opacity!==void 0?n.opacity:1,s8(r)),t.opacityExit=hr(e.opacity!==void 0?e.opacity:1,0,i8(r))):i&&(t.opacity=hr(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;o<n8;o++){const l=`border${g5[o]}Radius`;let c=Vv(e,l),d=Vv(n,l);if(c===void 0&&d===void 0)continue;c||(c=0),d||(d=0),c===0||d===0||Bv(c)===Bv(d)?(t[l]=Math.max(hr(Fv(c),Fv(d),r),0),(na.test(d)||na.test(c))&&(t[l]+="%")):t[l]=d}(e.rotate||n.rotate)&&(t.rotate=hr(e.rotate||0,n.rotate||0,r))}function Vv(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const s8=v5(0,.5,Eb),i8=v5(.5,.95,Gs);function v5(t,e,n){return r=>r<t?0:r>e?1:n(Mc(t,e,r))}function qv(t,e){t.min=e.min,t.max=e.max}function si(t,e){qv(t.x,e.x),qv(t.y,e.y)}function Uv(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function zv(t,e,n,r,s){return t-=e,t=Ch(t,1/n,r),s!==void 0&&(t=Ch(t,1/s,r)),t}function a8(t,e=0,n=1,r=.5,s,i=t,o=t){if(na.test(e)&&(e=parseFloat(e),e=hr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let l=hr(i.min,i.max,r);t===i&&(l-=e),t.min=zv(t.min,e,n,l,s),t.max=zv(t.max,e,n,l,s)}function Wv(t,e,[n,r,s],i,o){a8(t,e[n],e[r],e[s],e.scale,i,o)}const o8=["x","scaleX","originX"],l8=["y","scaleY","originY"];function $v(t,e,n,r){Wv(t.x,e,o8,n?n.x:void 0,r?r.x:void 0),Wv(t.y,e,l8,n?n.y:void 0,r?r.y:void 0)}function Hv(t){return t.translate===0&&t.scale===1}function y5(t){return Hv(t.x)&&Hv(t.y)}function Kv(t,e){return t.min===e.min&&t.max===e.max}function c8(t,e){return Kv(t.x,e.x)&&Kv(t.y,e.y)}function Gv(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function x5(t,e){return Gv(t.x,e.x)&&Gv(t.y,e.y)}function Yv(t){return Zs(t.x)/Zs(t.y)}function Zv(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class u8{constructor(){this.members=[]}add(e){Gg(this.members,e),e.scheduleRender()}remove(e){if(Yg(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(s=>e===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function d8(t,e,n){let r="";const s=t.x.translate/e.x,i=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:d,rotate:f,rotateX:m,rotateY:g,skewX:v,skewY:N}=n;d&&(r=`perspective(${d}px) ${r}`),f&&(r+=`rotate(${f}deg) `),m&&(r+=`rotateX(${m}deg) `),g&&(r+=`rotateY(${g}deg) `),v&&(r+=`skewX(${v}deg) `),N&&(r+=`skewY(${N}deg) `)}const l=t.x.scale*e.x,c=t.y.scale*e.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const wl={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},gu=typeof window<"u"&&window.MotionDebug!==void 0,pp=["","X","Y","Z"],h8={visibility:"hidden"},Xv=1e3;let f8=0;function mp(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function b5(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Pb(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",tr,!(s||i))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&b5(r)}function w5({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=e==null?void 0:e()){this.id=f8++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,gu&&(wl.totalNodes=wl.resolvedTargetDeltas=wl.recalculatedProjection=0),this.nodes.forEach(g8),this.nodes.forEach(w8),this.nodes.forEach(N8),this.nodes.forEach(v8),gu&&window.MotionDebug.record(wl)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new e8)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Zg),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,l=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=JC(o),this.instance=o;const{layoutId:c,layout:d,visualElement:f}=this.options;if(f&&!f.current&&f.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),l&&(d||c)&&(this.isLayoutDirty=!0),t){let m;const g=()=>this.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,m&&m(),m=t8(g,250),Zd.hasAnimatedSinceResize&&(Zd.hasAnimatedSinceResize=!1,this.nodes.forEach(Qv))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&f&&(c||d)&&this.addEventListener("didUpdate",({delta:m,hasLayoutChanged:g,hasRelativeTargetChanged:v,layout:N})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||f.getDefaultTransition()||A8,{onLayoutAnimationStart:P,onLayoutAnimationComplete:k}=f.getProps(),_=!this.targetLayout||!x5(this.targetLayout,N)||v,M=!g&&v;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||M||g&&(_||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(m,M);const $={...Wg(j,"layout"),onPlay:P,onComplete:k};(f.shouldReduceMotion||this.options.layoutRoot)&&($.delay=0,$.type=!1),this.startAnimation($)}else g||Qv(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=N})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Wo(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(j8),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&b5(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let f=0;f<this.path.length;f++){const m=this.path[f];m.shouldResetTransform=!0,m.updateScroll("snapshot"),m.options.layoutRoot&&m.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Jv);return}this.isUpdating||this.nodes.forEach(x8),this.isUpdating=!1,this.nodes.forEach(b8),this.nodes.forEach(p8),this.nodes.forEach(m8),this.clearAllSnapshots();const l=ra.now();rs.delta=no(0,1e3/60,l-rs.timestamp),rs.timestamp=l,rs.isProcessing=!0,ip.update.process(rs),ip.preRender.process(rs),ip.render.process(rs),rs.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Mg.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(y8),this.sharedNodes.forEach(S8)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,tr.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){tr.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=jr(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!y5(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,f=d!==this.prevTransformTemplateValue;o&&(l||bl(this.latestValues)||f)&&(s(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),P8(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var o;const{visualElement:l}=this.options;if(!l)return jr();const c=l.measureViewportBox();if(!(((o=this.scroll)===null||o===void 0?void 0:o.wasRoot)||this.path.some(C8))){const{scroll:f}=this.root;f&&(vc(c.x,f.offset.x),vc(c.y,f.offset.y))}return c}removeElementScroll(o){var l;const c=jr();if(si(c,o),!((l=this.scroll)===null||l===void 0)&&l.wasRoot)return c;for(let d=0;d<this.path.length;d++){const f=this.path[d],{scroll:m,options:g}=f;f!==this.root&&m&&g.layoutScroll&&(m.wasRoot&&si(c,o),vc(c.x,m.offset.x),vc(c.y,m.offset.y))}return c}applyTransform(o,l=!1){const c=jr();si(c,o);for(let d=0;d<this.path.length;d++){const f=this.path[d];!l&&f.options.layoutScroll&&f.scroll&&f!==f.root&&yc(c,{x:-f.scroll.offset.x,y:-f.scroll.offset.y}),bl(f.latestValues)&&yc(c,f.latestValues)}return bl(this.latestValues)&&yc(c,this.latestValues),c}removeTransform(o){const l=jr();si(l,o);for(let c=0;c<this.path.length;c++){const d=this.path[c];if(!d.instance||!bl(d.latestValues))continue;mm(d.latestValues)&&d.updateSnapshot();const f=jr(),m=d.measurePageBox();si(f,m),$v(l,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,f)}return bl(this.latestValues)&&$v(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==rs.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var l;const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const d=!!this.resumingFrom||this!==c;if(!(o||d&&this.isSharedProjectionDirty||this.isProjectionDirty||!((l=this.parent)===null||l===void 0)&&l.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:m,layoutId:g}=this.options;if(!(!this.layout||!(m||g))){if(this.resolvedRelativeTargetAt=rs.timestamp,!this.targetDelta&&!this.relativeTarget){const v=this.getClosestProjectingParent();v&&v.layout&&this.animationProgress!==1?(this.relativeParent=v,this.forceRelativeParentToResolveTarget(),this.relativeTarget=jr(),this.relativeTargetOrigin=jr(),ju(this.relativeTargetOrigin,this.layout.layoutBox,v.layout.layoutBox),si(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=jr(),this.targetWithTransforms=jr()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),DC(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):si(this.target,this.layout.layoutBox),h5(this.target,this.targetDelta)):si(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const v=this.getClosestProjectingParent();v&&!!v.resumingFrom==!!this.resumingFrom&&!v.options.layoutScroll&&v.target&&this.animationProgress!==1?(this.relativeParent=v,this.forceRelativeParentToResolveTarget(),this.relativeTarget=jr(),this.relativeTargetOrigin=jr(),ju(this.relativeTargetOrigin,this.target,v.target),si(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}gu&&wl.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||mm(this.parent.latestValues)||d5(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const l=this.getLead(),c=!!this.resumingFrom||this!==l;let d=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(d=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(d=!1),this.resolvedRelativeTargetAt===rs.timestamp&&(d=!1),d)return;const{layout:f,layoutId:m}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(f||m))return;si(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,v=this.treeScale.y;qC(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=jr());const{target:N}=l;if(!N){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Uv(this.prevProjectionDelta.x,this.projectionDelta.x),Uv(this.prevProjectionDelta.y,this.projectionDelta.y)),Nu(this.projectionDelta,this.layoutCorrected,N,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==v||!Zv(this.projectionDelta.x,this.prevProjectionDelta.x)||!Zv(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",N)),gu&&wl.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)===null||l===void 0||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=gc(),this.projectionDelta=gc(),this.projectionDeltaWithTransform=gc()}setAnimationOrigin(o,l=!1){const c=this.snapshot,d=c?c.latestValues:{},f={...this.latestValues},m=gc();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const g=jr(),v=c?c.source:void 0,N=this.layout?this.layout.source:void 0,j=v!==N,P=this.getStack(),k=!P||P.members.length<=1,_=!!(j&&!k&&this.options.crossfade===!0&&!this.path.some(_8));this.animationProgress=0;let M;this.mixTargetDelta=$=>{const Y=$/1e3;ey(m.x,o.x,Y),ey(m.y,o.y,Y),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ju(g,this.layout.layoutBox,this.relativeParent.layout.layoutBox),k8(this.relativeTarget,this.relativeTargetOrigin,g,Y),M&&c8(this.relativeTarget,M)&&(this.isProjectionDirty=!1),M||(M=jr()),si(M,this.relativeTarget)),j&&(this.animationValues=f,r8(f,d,this.latestValues,Y,_,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=Y},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Wo(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=tr.update(()=>{Zd.hasAnimatedSinceResize=!0,this.currentAnimation=XC(0,Xv,{...o,onUpdate:l=>{this.mixTargetDelta(l),o.onUpdate&&o.onUpdate(l)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Xv),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:d,latestValues:f}=o;if(!(!l||!c||!d)){if(this!==o&&this.layout&&d&&N5(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||jr();const m=Zs(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+m;const g=Zs(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+g}si(l,c),yc(l,f),Nu(this.projectionDeltaWithTransform,this.layoutCorrected,l,f)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new u8),this.sharedNodes.get(o).add(l);const d=l.options.initialPromotionConfig;l.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:l}=this.options;return l?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:l}=this.options;return l?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const d=this.getStack();d&&d.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const d={};c.z&&mp("z",o,d,this.animationValues);for(let f=0;f<pp.length;f++)mp(`rotate${pp[f]}`,o,d,this.animationValues),mp(`skew${pp[f]}`,o,d,this.animationValues);o.render();for(const f in d)o.setStaticValue(f,d[f]),this.animationValues&&(this.animationValues[f]=d[f]);o.scheduleRender()}getProjectionStyles(o){var l,c;if(!this.instance||this.isSVG)return;if(!this.isVisible)return h8;const d={visibility:""},f=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,d.opacity="",d.pointerEvents=Gd(o==null?void 0:o.pointerEvents)||"",d.transform=f?f(this.latestValues,""):"none",d;const m=this.getLead();if(!this.projectionDelta||!this.layout||!m.target){const j={};return this.options.layoutId&&(j.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,j.pointerEvents=Gd(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!bl(this.latestValues)&&(j.transform=f?f({},""):"none",this.hasProjected=!1),j}const g=m.animationValues||m.latestValues;this.applyTransformsToTarget(),d.transform=d8(this.projectionDeltaWithTransform,this.treeScale,g),f&&(d.transform=f(g,d.transform));const{x:v,y:N}=this.projectionDelta;d.transformOrigin=`${v.origin*100}% ${N.origin*100}% 0`,m.animationValues?d.opacity=m===this?(c=(l=g.opacity)!==null&&l!==void 0?l:this.latestValues.opacity)!==null&&c!==void 0?c:1:this.preserveOpacity?this.latestValues.opacity:g.opacityExit:d.opacity=m===this?g.opacity!==void 0?g.opacity:"":g.opacityExit!==void 0?g.opacityExit:0;for(const j in Sh){if(g[j]===void 0)continue;const{correct:P,applyTo:k}=Sh[j],_=d.transform==="none"?g[j]:P(g[j],m);if(k){const M=k.length;for(let $=0;$<M;$++)d[k[$]]=_}else d[j]=_}return this.options.layoutId&&(d.pointerEvents=m===this?Gd(o==null?void 0:o.pointerEvents)||"":"none"),d}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(Jv),this.root.sharedNodes.clear()}}}function p8(t){t.updateLayout()}function m8(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=t.layout,{animationType:i}=t.options,o=n.source!==t.layout.source;i==="size"?ai(m=>{const g=o?n.measuredBox[m]:n.layoutBox[m],v=Zs(g);g.min=r[m].min,g.max=g.min+v}):N5(i,n.layoutBox,r)&&ai(m=>{const g=o?n.measuredBox[m]:n.layoutBox[m],v=Zs(r[m]);g.max=g.min+v,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[m].max=t.relativeTarget[m].min+v)});const l=gc();Nu(l,r,n.layoutBox);const c=gc();o?Nu(c,t.applyTransform(s,!0),n.measuredBox):Nu(c,r,n.layoutBox);const d=!y5(l);let f=!1;if(!t.resumeFrom){const m=t.getClosestProjectingParent();if(m&&!m.resumeFrom){const{snapshot:g,layout:v}=m;if(g&&v){const N=jr();ju(N,n.layoutBox,g.layoutBox);const j=jr();ju(j,r,v.layoutBox),x5(N,j)||(f=!0),m.options.layoutRoot&&(t.relativeTarget=j,t.relativeTargetOrigin=N,t.relativeParent=m)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:d,hasRelativeTargetChanged:f})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function g8(t){gu&&wl.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function v8(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function y8(t){t.clearSnapshot()}function Jv(t){t.clearMeasurements()}function x8(t){t.isLayoutDirty=!1}function b8(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Qv(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function w8(t){t.resolveTargetDelta()}function N8(t){t.calcProjection()}function j8(t){t.resetSkewAndRotation()}function S8(t){t.removeLeadSnapshot()}function ey(t,e,n){t.translate=hr(e.translate,0,n),t.scale=hr(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function ty(t,e,n,r){t.min=hr(e.min,n.min,r),t.max=hr(e.max,n.max,r)}function k8(t,e,n,r){ty(t.x,e.x,n.x,r),ty(t.y,e.y,n.y,r)}function _8(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const A8={duration:.45,ease:[.4,0,.1,1]},ny=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),ry=ny("applewebkit/")&&!ny("chrome/")?Math.round:Gs;function sy(t){t.min=ry(t.min),t.max=ry(t.max)}function P8(t){sy(t.x),sy(t.y)}function N5(t,e,n){return t==="position"||t==="preserve-aspect"&&!LC(Yv(e),Yv(n),.2)}function C8(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const T8=w5({attachResizeListener:(t,e)=>Fu(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),gp={current:void 0},j5=w5({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!gp.current){const t=new T8({});t.mount(window),t.setOptions({layoutScroll:!0}),gp.current=t}return gp.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),L8={pan:{Feature:KC},drag:{Feature:HC,ProjectionNode:j5,MeasureLayout:m5}};function iy(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&tr.postRender(()=>i(e,od(e)))}class D8 extends Jo{mount(){const{current:e}=this.node;e&&(this.unmount=DA(e,n=>(iy(this.node,n,"Start"),r=>iy(this.node,r,"End"))))}unmount(){}}class I8 extends Jo{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ad(Fu(this.node.current,"focus",()=>this.onFocus()),Fu(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function ay(t,e,n){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&tr.postRender(()=>i(e,od(e)))}class M8 extends Jo{mount(){const{current:e}=this.node;e&&(this.unmount=OA(e,n=>(ay(this.node,n,"Start"),(r,{success:s})=>ay(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const vm=new WeakMap,vp=new WeakMap,E8=t=>{const e=vm.get(t.target);e&&e(t)},O8=t=>{t.forEach(E8)};function R8({root:t,...e}){const n=t||document;vp.has(n)||vp.set(n,{});const r=vp.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(O8,{root:t,...e})),r[s]}function F8(t,e,n){const r=R8(e);return vm.set(t,n),r.observe(t),()=>{vm.delete(t),r.unobserve(t)}}const B8={some:0,all:1};class V8 extends Jo{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:B8[s]},l=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:f,onViewportLeave:m}=this.node.getProps(),g=d?f:m;g&&g(c)};return F8(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(q8(e,n))&&this.startObserver()}unmount(){}}function q8({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const U8={inView:{Feature:V8},tap:{Feature:M8},focus:{Feature:I8},hover:{Feature:D8}},z8={layout:{ProjectionNode:j5,MeasureLayout:m5}},ym={current:null},S5={current:!1};function W8(){if(S5.current=!0,!!Cg)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ym.current=t.matches;t.addListener(e),e()}else ym.current=!1}const $8=[...Yb,fs,$o],H8=t=>$8.find(Gb(t)),oy=new WeakMap;function K8(t,e,n){for(const r in e){const s=e[r],i=n[r];if(gs(s))t.addValue(r,s);else if(gs(i))t.addValue(r,Ou(s,{owner:t}));else if(i!==s)if(t.hasValue(r)){const o=t.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=t.getStaticValue(r);t.addValue(r,Ou(o!==void 0?o:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const ly=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class G8{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=n0,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const v=ra.now();this.renderScheduledAt<v&&(this.renderScheduledAt=v,tr.render(this.render,!1,!0))};const{latestValues:c,renderState:d,onUpdate:f}=o;this.onUpdate=f,this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=d,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=uf(n),this.isVariantNode=rb(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:m,...g}=this.scrapeMotionValuesFromProps(n,{},this);for(const v in g){const N=g[v];c[v]!==void 0&&gs(N)&&N.set(c[v],!1)}}mount(e){this.current=e,oy.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),S5.current||W8(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:ym.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){oy.delete(this.current),this.projection&&this.projection.unmount(),Wo(this.notifyUpdate),Wo(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=Wl.has(e),s=n.on("change",l=>{this.latestValues[e]=l,this.props.onUpdate&&tr.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Ec){const n=Ec[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):jr()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<ly.length;r++){const s=ly[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=e[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=K8(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=Ou(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){var r;let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(r=this.getBaseTargetFromProps(this.props,e))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(Hb(s)||Rb(s))?s=parseFloat(s):!H8(s)&&$o.test(n)&&(s=zb(e,n)),this.setBaseTarget(e,gs(s)?s.get():s)),gs(s)?s.get():s}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=Og(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(s=o[e])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!gs(i)?i:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Zg),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class k5 extends G8{constructor(){super(...arguments),this.KeyframeResolver=Zb}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;gs(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function Y8(t){return window.getComputedStyle(t)}class Z8 extends k5{constructor(){super(...arguments),this.type="html",this.renderInstance=hb}readValueFromInstance(e,n){if(Wl.has(n)){const r=t0(n);return r&&r.default||0}else{const r=Y8(e),s=(cb(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return f5(e,n)}build(e,n,r){Bg(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return zg(e,n,r)}}class X8 extends k5{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=jr}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Wl.has(n)){const r=t0(n);return r&&r.default||0}return n=fb.has(n)?n:Ig(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return gb(e,n,r)}build(e,n,r){Vg(e,n,this.isSVGTag,r.transformTemplate)}renderInstance(e,n,r,s){pb(e,n,r,s)}mount(e){this.isSVGTag=Ug(e.tagName),super.mount(e)}}const J8=(t,e)=>Eg(t)?new X8(e):new Z8(e,{allowProjection:t!==I.Fragment}),Q8=kA({...NC,...U8,...L8,...z8},J8),nt=V_(Q8),e7=[{name:"Dashboard",href:"/dashboard",icon:$x},{name:"Goals",href:"/goals",icon:xr},{name:"Progress",href:"/progress",icon:oi},{name:"Analytics",href:"/analytics",icon:Dc},{name:"Calendar",href:"/calendar",icon:ys},{name:"Achievements",href:"/achievements",icon:ta}],t7=[{name:"Profile",href:"/profile",icon:Hc},{name:"Settings",href:"/settings",icon:Du}];function n7(){var n;const t=tg(),{user:e}=Ir();return a.jsxs("div",{className:"flex w-64 flex-col bg-card border-r border-border",children:[a.jsx("div",{className:"flex h-16 items-center px-6 border-b border-border",children:a.jsxs(nt.div,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},className:"flex items-center space-x-3",children:[a.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center",children:a.jsx(xr,{className:"w-5 h-5 text-primary-foreground"})}),a.jsx("span",{className:"text-xl font-bold text-foreground",children:"ProgressPulse"})]})}),a.jsx("div",{className:"px-6 py-4 border-b border-border",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(tf,{className:"h-10 w-10",children:[a.jsx(nf,{src:e==null?void 0:e.avatar}),a.jsx(rf,{className:"bg-primary/10 text-primary font-medium",children:(n=e==null?void 0:e.name)==null?void 0:n.charAt(0).toUpperCase()})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:e==null?void 0:e.name}),a.jsx("p",{className:"text-xs text-muted-foreground truncate",children:e==null?void 0:e.email})]})]})}),a.jsx("nav",{className:"flex-1 px-4 py-4 space-y-1",children:e7.map(r=>{const s=t.pathname===r.href;return a.jsx(Cl,{to:r.href,children:a.jsxs(ht,{variant:s?"secondary":"ghost",className:vt("w-full justify-start h-11 px-3",s&&"bg-primary/10 text-primary hover:bg-primary/15"),children:[a.jsx(r.icon,{className:"mr-3 h-5 w-5"}),r.name]})},r.name)})}),a.jsx("div",{className:"px-4 py-4 border-t border-border space-y-1",children:t7.map(r=>{const s=t.pathname===r.href;return a.jsx(Cl,{to:r.href,children:a.jsxs(ht,{variant:s?"secondary":"ghost",className:vt("w-full justify-start h-11 px-3",s&&"bg-primary/10 text-primary hover:bg-primary/15"),children:[a.jsx(r.icon,{className:"mr-3 h-5 w-5"}),r.name]})},r.name)})})]})}const r7=[{name:"Home",href:"/dashboard",icon:$x},{name:"Goals",href:"/goals",icon:xr},{name:"Progress",href:"/progress",icon:oi},{name:"Analytics",href:"/analytics",icon:Dc},{name:"Profile",href:"/profile",icon:Hc}];function s7(){const t=tg();return a.jsx(nt.div,{initial:{y:100,opacity:0},animate:{y:0,opacity:1},transition:{duration:.4,ease:"easeOut"},className:"nav-ios fixed bottom-0 left-0 right-0 z-50 safe-bottom",children:a.jsx("div",{className:"grid grid-cols-5 h-20 px-2",children:r7.map((e,n)=>{const r=t.pathname===e.href;return a.jsxs(Cl,{to:e.href,className:"nav-item-ios relative",children:[r&&a.jsx(nt.div,{layoutId:"activeNavTab",className:"absolute -top-1 left-1/2 transform -translate-x-1/2 w-1 h-1 bg-primary rounded-full",transition:{type:"spring",stiffness:500,damping:30}}),a.jsx(nt.div,{className:vt("p-2 rounded-xl transition-all duration-200",r?"bg-primary/20 text-primary scale-110":"text-muted-foreground"),whileTap:{scale:.9},animate:r?{scale:[1,1.1,1]}:{},transition:{duration:.3},children:a.jsx(e.icon,{className:"h-5 w-5"})}),a.jsx(nt.span,{className:vt("text-ios-caption font-medium transition-all duration-200",r?"text-primary opacity-100":"text-muted-foreground opacity-80"),animate:r?{y:[0,-2,0]}:{},transition:{duration:.3,delay:.1},children:e.name}),a.jsx(nt.div,{className:"absolute inset-0 rounded-xl",whileTap:{backgroundColor:"rgba(59, 130, 246, 0.1)"},transition:{duration:.1}})]},e.name)})})})}function Qo(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}var i7=["color"],a7=I.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,s=Qo(t,i7);return I.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:e}),I.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),o7=["color"],_5=I.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,s=Qo(t,o7);return I.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:e}),I.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),l7=["color"],c7=I.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,s=Qo(t,l7);return I.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:e}),I.createElement("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),u7=["color"],d7=I.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,s=Qo(t,u7);return I.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:e}),I.createElement("path",{d:"M8.84182 3.13514C9.04327 3.32401 9.05348 3.64042 8.86462 3.84188L5.43521 7.49991L8.86462 11.1579C9.05348 11.3594 9.04327 11.6758 8.84182 11.8647C8.64036 12.0535 8.32394 12.0433 8.13508 11.8419L4.38508 7.84188C4.20477 7.64955 4.20477 7.35027 4.38508 7.15794L8.13508 3.15794C8.32394 2.95648 8.64036 2.94628 8.84182 3.13514Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),h7=["color"],A5=I.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,s=Qo(t,h7);return I.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:e}),I.createElement("path",{d:"M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),f7=["color"],p7=I.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,s=Qo(t,f7);return I.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:e}),I.createElement("path",{d:"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),m7=["color"],g7=I.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,s=Qo(t,m7);return I.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:e}),I.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),v7=["color"],y7=I.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,s=Qo(t,v7);return I.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:e}),I.createElement("path",{d:"M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z",fill:r}))});const xm=sj,bm=ij,x7=I.forwardRef(({className:t,inset:e,children:n,...r},s)=>a.jsxs(f2,{ref:s,className:vt("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",e&&"pl-8",t),...r,children:[n,a.jsx(A5,{className:"ml-auto h-4 w-4"})]}));x7.displayName=f2.displayName;const b7=I.forwardRef(({className:t,...e},n)=>a.jsx(p2,{ref:n,className:vt("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));b7.displayName=p2.displayName;const Th=I.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(rj,{children:a.jsx(m2,{ref:r,sideOffset:e,className:vt("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));Th.displayName=m2.displayName;const Ur=I.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(g2,{ref:r,className:vt("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));Ur.displayName=g2.displayName;const w7=I.forwardRef(({className:t,children:e,checked:n,...r},s)=>a.jsxs(v2,{ref:s,className:vt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(y2,{children:a.jsx(_5,{className:"h-4 w-4"})})}),e]}));w7.displayName=v2.displayName;const N7=I.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(x2,{ref:r,className:vt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(y2,{children:a.jsx(y7,{className:"h-4 w-4 fill-current"})})}),e]}));N7.displayName=x2.displayName;const wm=I.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(b2,{ref:r,className:vt("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));wm.displayName=b2.displayName;const kc=I.forwardRef(({className:t,...e},n)=>a.jsx(w2,{ref:n,className:vt("-mx-1 my-1 h-px bg-muted",t),...e}));kc.displayName=w2.displayName;const j7=nd("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Dn({className:t,variant:e,...n}){return a.jsx("div",{className:vt(j7({variant:e}),t),...n})}function S7(){var d;const{user:t}=Ir(),{isOnline:e,syncInProgress:n}=td(),{theme:r,setTheme:s}=V2(),i=so(),o=async()=>{try{const{generateProgressReport:f}=await eo(async()=>{const{generateProgressReport:m}=await import("./pdfExport-Dm-2p29r.js");return{generateProgressReport:m}},__vite__mapDeps([0,1,2,3,4]));await f(t.id),St.success("PDF report generated successfully!")}catch{St.error("Failed to generate PDF report")}},l=()=>{i("/notifications")},c=f=>{const m=window.location.origin+f;window.open(m,"_blank","noopener,noreferrer")};return a.jsxs("header",{className:"h-16 bg-card/95 backdrop-blur-lg border-b border-border px-4 lg:px-6 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsxs(nt.div,{animate:{scale:n?[1,1.1,1]:1},transition:{repeat:n?1/0:0,duration:1.5},className:"flex items-center space-x-2",children:[e?a.jsx(kg,{className:"h-4 w-4 text-green-500"}):a.jsx(Sg,{className:"h-4 w-4 text-red-500"}),a.jsx(Dn,{variant:e?"default":"destructive",className:"text-xs",children:e?"Online":"Offline"})]}),n&&a.jsx(Dn,{variant:"outline",className:"text-xs",children:"Syncing..."})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs(ht,{variant:"ghost",size:"sm",onClick:()=>s(r==="light"?"dark":"light"),className:"h-9 w-9 p-0",children:[a.jsx(Xx,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),a.jsx(Kx,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),a.jsx("span",{className:"sr-only",children:"Toggle theme"})]}),a.jsxs(ht,{variant:"ghost",size:"sm",className:"h-9 w-9 p-0 relative",onClick:l,children:[a.jsx(Ci,{className:"h-4 w-4"}),a.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 bg-primary rounded-full"})]}),a.jsxs(xm,{children:[a.jsx(bm,{asChild:!0,children:a.jsx(ht,{variant:"ghost",size:"sm",className:"h-9 w-9 p-0",children:a.jsx(s_,{className:"h-4 w-4"})})}),a.jsxs(Th,{align:"end",className:"w-48",children:[a.jsx(wm,{children:"More Options"}),a.jsx(kc,{}),a.jsxs(Ur,{onClick:()=>i("/spreadsheet"),children:[a.jsx(af,{className:"mr-2 h-4 w-4"})," Spreadsheet"]}),a.jsxs(Ur,{onClick:()=>i("/certificates"),children:[a.jsx(Oo,{className:"mr-2 h-4 w-4"})," Certificates"]}),a.jsxs(Ur,{onClick:()=>i("/tutorial"),children:[a.jsx(Ic,{className:"mr-2 h-4 w-4"})," What's New"]}),a.jsx(kc,{}),a.jsxs(Ur,{onClick:()=>c("/privacy"),children:[a.jsx(Bo,{className:"mr-2 h-4 w-4"})," Privacy Policy"]}),a.jsxs(Ur,{onClick:()=>c("/terms"),children:[a.jsx(Sc,{className:"mr-2 h-4 w-4"})," Terms of Service"]}),a.jsxs(Ur,{onClick:()=>c("/releases"),children:[a.jsx(Sc,{className:"mr-2 h-4 w-4"})," Release Notes"]}),a.jsxs(Ur,{onClick:()=>c("/support"),children:[a.jsx(Lu,{className:"mr-2 h-4 w-4"})," Help & Support"]}),a.jsxs(Ur,{onClick:()=>c("/docs"),children:[a.jsx(Sc,{className:"mr-2 h-4 w-4"})," Documentation"]})]})]}),a.jsxs(xm,{children:[a.jsx(bm,{asChild:!0,children:a.jsx(ht,{variant:"ghost",size:"sm",className:"h-9 w-9 p-0 rounded-full",children:a.jsxs(tf,{className:"h-9 w-9",children:[a.jsx(nf,{src:(t==null?void 0:t.avatar)||""}),a.jsx(rf,{children:(d=t==null?void 0:t.name)==null?void 0:d[0]})]})})}),a.jsxs(Th,{align:"end",side:"bottom",className:"w-48",children:[a.jsx(wm,{className:"text-xs font-semibold",children:t==null?void 0:t.name}),a.jsx(kc,{}),a.jsxs(Ur,{onClick:()=>i("/profile"),children:[a.jsx(Hc,{className:"mr-2 h-4 w-4"})," Profile"]}),a.jsxs(Ur,{onClick:()=>i("/settings"),children:[a.jsx(Du,{className:"mr-2 h-4 w-4"})," Settings"]}),a.jsxs(Ur,{onClick:o,children:[a.jsx(ca,{className:"mr-2 h-4 w-4"})," Export PDF"]})]})]})]})]})}const mt=I.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:vt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));mt.displayName="Card";const $t=I.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:vt("flex flex-col space-y-1.5 p-6",t),...e}));$t.displayName="CardHeader";const Ht=I.forwardRef(({className:t,...e},n)=>a.jsx("h3",{ref:n,className:vt("font-semibold leading-none tracking-tight",t),...e}));Ht.displayName="CardTitle";const cn=I.forwardRef(({className:t,...e},n)=>a.jsx("p",{ref:n,className:vt("text-sm text-muted-foreground",t),...e}));cn.displayName="CardDescription";const gt=I.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:vt("p-6 pt-0",t),...e}));gt.displayName="CardContent";const k7=I.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:vt("flex items-center p-6 pt-0",t),...e}));k7.displayName="CardFooter";function _7(){const[t,e]=I.useState(null),[n,r]=I.useState(!1),{setInstallStatus:s}=td();I.useEffect(()=>{const l=d=>{d.preventDefault(),e(d),setTimeout(()=>{r(!0)},5e3)},c=()=>{s(!0),r(!1),e(null)};return window.addEventListener("beforeinstallprompt",l),window.addEventListener("appinstalled",c),()=>{window.removeEventListener("beforeinstallprompt",l),window.removeEventListener("appinstalled",c)}},[s]);const i=async()=>{if(!t)return;t.prompt();const{outcome:l}=await t.userChoice;l==="accepted"&&s(!0),e(null),r(!1)},o=()=>{r(!1),sessionStorage.setItem("pwa-prompt-dismissed","true")};return sessionStorage.getItem("pwa-prompt-dismissed")?null:a.jsx(zo,{children:n&&t&&a.jsx(nt.div,{initial:{y:100,opacity:0},animate:{y:0,opacity:1},exit:{y:100,opacity:0},className:"fixed bottom-4 left-4 right-4 z-50 lg:left-auto lg:right-4 lg:bottom-4 lg:max-w-sm",children:a.jsxs(mt,{className:"shadow-lg border-primary/20",children:[a.jsxs($t,{className:"pb-3",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Yx,{className:"h-5 w-5 text-primary"}),a.jsx(Ht,{className:"text-lg",children:"Install ProgressPulse"})]}),a.jsx(ht,{variant:"ghost",size:"sm",onClick:o,className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",children:a.jsx(rd,{className:"h-4 w-4"})})]}),a.jsx(cn,{children:"Get the full app experience with offline access and native features."})]}),a.jsx(gt,{className:"pt-0",children:a.jsxs("div",{className:"flex space-x-2",children:[a.jsxs(ht,{onClick:i,className:"flex-1",children:[a.jsx(ca,{className:"mr-2 h-4 w-4"}),"Install App"]}),a.jsx(ht,{variant:"outline",onClick:o,children:"Not Now"})]})})]})})})}const A7=nd("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),a0=I.forwardRef(({className:t,variant:e,...n},r)=>a.jsx("div",{ref:r,role:"alert",className:vt(A7({variant:e}),t),...n}));a0.displayName="Alert";const P7=I.forwardRef(({className:t,...e},n)=>a.jsx("h5",{ref:n,className:vt("mb-1 font-medium leading-none tracking-tight",t),...e}));P7.displayName="AlertTitle";const o0=I.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:vt("text-sm [&_p]:leading-relaxed",t),...e}));o0.displayName="AlertDescription";function C7(){const{isOnline:t}=td();return a.jsx(zo,{children:!t&&a.jsx(nt.div,{initial:{y:-100,opacity:0},animate:{y:0,opacity:1},exit:{y:-100,opacity:0},className:"fixed top-0 left-0 right-0 z-50",children:a.jsxs(a0,{className:"rounded-none border-0 bg-destructive text-destructive-foreground",children:[a.jsx(Sg,{className:"h-4 w-4"}),a.jsx(o0,{className:"font-medium",children:"You're offline. Don't worry - your progress is saved locally and will sync when you're back online."})]})})})}function T7(){const[t,e]=I.useState(!1),{updateAvailable:n,setUpdateAvailable:r}=td();I.useEffect(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("message",o=>{o.data&&o.data.type==="SKIP_WAITING"&&(r(!0),e(!0))})},[r]);const s=()=>{"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(o=>{o.waiting&&(o.waiting.postMessage({type:"SKIP_WAITING"}),window.location.reload())})},i=()=>{e(!1),r(!1)};return a.jsx(zo,{children:t&&n&&a.jsx(nt.div,{initial:{y:100,opacity:0},animate:{y:0,opacity:1},exit:{y:100,opacity:0},className:"fixed bottom-4 left-4 right-4 z-50 lg:left-auto lg:right-4 lg:bottom-20 lg:max-w-sm",children:a.jsxs(a0,{className:"border-primary/20 bg-card shadow-lg",children:[a.jsx(Nh,{className:"h-4 w-4"}),a.jsxs("div",{className:"flex items-center justify-between flex-1",children:[a.jsx(o0,{className:"font-medium flex-1 mr-4",children:"A new version is available. Update to get the latest features and improvements."}),a.jsxs("div",{className:"flex space-x-2",children:[a.jsx(ht,{size:"sm",onClick:s,children:"Update"}),a.jsx(ht,{variant:"ghost",size:"sm",onClick:i,children:a.jsx(rd,{className:"h-4 w-4"})})]})]})]})})})}function L7({children:t}){const{user:e}=Ir(),{isOnline:n,setOnlineStatus:r}=td();return I.useEffect(()=>{const s=()=>r(!0),i=()=>r(!1);return window.addEventListener("online",s),window.addEventListener("offline",i),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",i)}},[r]),e?a.jsxs("div",{className:"w-full h-full min-h-screen bg-background",children:[a.jsx(_7,{}),a.jsx(C7,{}),a.jsx(T7,{}),a.jsxs("div",{className:"flex w-full h-full min-h-screen overflow-hidden",children:[a.jsx("div",{className:"hidden lg:flex lg:flex-shrink-0",children:a.jsx(n7,{})}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[a.jsx(S7,{}),a.jsx("main",{className:"flex-1 relative overflow-y-auto focus:outline-none",children:a.jsx(nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2},className:"h-full w-full",children:a.jsx("div",{className:"w-full h-full overflow-x-hidden",children:t})})})]})]}),a.jsx("div",{className:"lg:hidden",children:a.jsx(s7,{})})]}):a.jsx(a.Fragment,{children:t})}const $n=I.forwardRef(({className:t,type:e,...n},r)=>a.jsx("input",{type:e,className:vt("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...n}));$n.displayName="Input";var D7="Label",P5=I.forwardRef((t,e)=>a.jsx(sr.label,{...t,ref:e,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=t.onMouseDown)==null||s.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));P5.displayName=D7;var C5=P5;const I7=nd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),bn=I.forwardRef(({className:t,...e},n)=>a.jsx(C5,{ref:n,className:vt(I7(),t),...e}));bn.displayName=C5.displayName;function M7(t,e=[]){let n=[];function r(i,o){const l=I.createContext(o),c=n.length;n=[...n,o];function d(m){const{scope:g,children:v,...N}=m,j=(g==null?void 0:g[t][c])||l,P=I.useMemo(()=>N,Object.values(N));return a.jsx(j.Provider,{value:P,children:v})}function f(m,g){const v=(g==null?void 0:g[t][c])||l,N=I.useContext(v);if(N)return N;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${i}\``)}return d.displayName=i+"Provider",[d,f]}const s=()=>{const i=n.map(o=>I.createContext(o));return function(l){const c=(l==null?void 0:l[t])||i;return I.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[r,E7(s,...e)]}function E7(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:d})=>{const m=c(i)[`__scope${d}`];return{...l,...m}},{});return I.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var l0="Progress",c0=100,[O7,dO]=M7(l0),[R7,F7]=O7(l0),T5=I.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=B7,...o}=t;(s||s===0)&&!cy(s)&&console.error(V7(`${s}`,"Progress"));const l=cy(s)?s:c0;r!==null&&!uy(r,l)&&console.error(q7(`${r}`,"Progress"));const c=uy(r,l)?r:null,d=Lh(c)?i(c,l):void 0;return a.jsx(R7,{scope:n,value:c,max:l,children:a.jsx(sr.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":Lh(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":I5(c,l),"data-value":c??void 0,"data-max":l,...o,ref:e})})});T5.displayName=l0;var L5="ProgressIndicator",D5=I.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=F7(L5,n);return a.jsx(sr.div,{"data-state":I5(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});D5.displayName=L5;function B7(t,e){return`${Math.round(t/e*100)}%`}function I5(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function Lh(t){return typeof t=="number"}function cy(t){return Lh(t)&&!isNaN(t)&&t>0}function uy(t,e){return Lh(t)&&!isNaN(t)&&t<=e&&t>=0}function V7(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${c0}\`.`}function q7(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
- a positive number
- less than the value passed to \`max\` (or ${c0} if no \`max\` prop is set)
- \`null\` or \`undefined\` if the progress is indeterminate.
Defaulting to \`null\`.`}var M5=T5,U7=D5;const ld=I.forwardRef(({className:t,value:e,...n},r)=>a.jsx(M5,{ref:r,className:vt("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:a.jsx(U7,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));ld.displayName=M5.displayName;var cd=t=>t.type==="checkbox",xc=t=>t instanceof Date,Ns=t=>t==null;const E5=t=>typeof t=="object";var Dr=t=>!Ns(t)&&!Array.isArray(t)&&E5(t)&&!xc(t),z7=t=>Dr(t)&&t.target?cd(t.target)?t.target.checked:t.target.value:t,W7=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,$7=(t,e)=>t.has(W7(e)),H7=t=>{const e=t.constructor&&t.constructor.prototype;return Dr(e)&&e.hasOwnProperty("isPrototypeOf")},u0=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ii(t){let e;const n=Array.isArray(t);if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(u0&&(t instanceof Blob||t instanceof FileList))&&(n||Dr(t)))if(e=n?[]:{},!n&&!H7(t))e=t;else for(const r in t)t.hasOwnProperty(r)&&(e[r]=ii(t[r]));else return t;return e}var ff=t=>Array.isArray(t)?t.filter(Boolean):[],Sr=t=>t===void 0,Dt=(t,e,n)=>{if(!e||!Dr(t))return n;const r=ff(e.split(/[,[\].]+?/)).reduce((s,i)=>Ns(s)?s:s[i],t);return Sr(r)||r===t?Sr(t[e])?n:t[e]:r},Xi=t=>typeof t=="boolean",d0=t=>/^\w*$/.test(t),O5=t=>ff(t.replace(/["|']|\]/g,"").split(/\.|\[/)),Un=(t,e,n)=>{let r=-1;const s=d0(e)?[e]:O5(e),i=s.length,o=i-1;for(;++r<i;){const l=s[r];let c=n;if(r!==o){const d=t[l];c=Dr(d)||Array.isArray(d)?d:isNaN(+s[r+1])?{}:[]}if(l==="__proto__")return;t[l]=c,t=t[l]}return t};const dy={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Pi={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},qa={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};dt.createContext(null);var K7=(t,e,n,r=!0)=>{const s={defaultValues:e._defaultValues};for(const i in t)Object.defineProperty(s,i,{get:()=>{const o=i;return e._proxyFormState[o]!==Pi.all&&(e._proxyFormState[o]=!r||Pi.all),t[o]}});return s},Ds=t=>Dr(t)&&!Object.keys(t).length,G7=(t,e,n,r)=>{n(t);const{name:s,...i}=t;return Ds(i)||Object.keys(i).length>=Object.keys(e).length||Object.keys(i).find(o=>e[o]===Pi.all)},Xd=t=>Array.isArray(t)?t:[t];function Y7(t){const e=dt.useRef(t);e.current=t,dt.useEffect(()=>{const n=!t.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{n&&n.unsubscribe()}},[t.disabled])}var Ji=t=>typeof t=="string",Z7=(t,e,n,r,s)=>Ji(t)?(r&&e.watch.add(t),Dt(n,t,s)):Array.isArray(t)?t.map(i=>(r&&e.watch.add(i),Dt(n,i))):(r&&(e.watchAll=!0),n),R5=(t,e,n,r,s)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:s||!0}}:{},hy=t=>({isOnSubmit:!t||t===Pi.onSubmit,isOnBlur:t===Pi.onBlur,isOnChange:t===Pi.onChange,isOnAll:t===Pi.all,isOnTouch:t===Pi.onTouched}),fy=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const Su=(t,e,n,r)=>{for(const s of n||Object.keys(t)){const i=Dt(t,s);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],s)&&!r)return!0;if(o.ref&&e(o.ref,o.name)&&!r)return!0;if(Su(l,e))break}else if(Dr(l)&&Su(l,e))break}}};var X7=(t,e,n)=>{const r=Xd(Dt(t,n));return Un(r,"root",e[n]),Un(t,n,r),t},h0=t=>t.type==="file",Ka=t=>typeof t=="function",Dh=t=>{if(!u0)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},Jd=t=>Ji(t),f0=t=>t.type==="radio",Ih=t=>t instanceof RegExp;const py={value:!1,isValid:!1},my={value:!0,isValid:!0};var F5=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!Sr(t[0].attributes.value)?Sr(t[0].value)||t[0].value===""?my:{value:t[0].value,isValid:!0}:my:py}return py};const gy={isValid:!1,value:null};var B5=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,gy):gy;function vy(t,e,n="validate"){if(Jd(t)||Array.isArray(t)&&t.every(Jd)||Xi(t)&&!t)return{type:n,message:Jd(t)?t:"",ref:e}}var ic=t=>Dr(t)&&!Ih(t)?t:{value:t,message:""},yy=async(t,e,n,r,s)=>{const{ref:i,refs:o,required:l,maxLength:c,minLength:d,min:f,max:m,pattern:g,validate:v,name:N,valueAsNumber:j,mount:P,disabled:k}=t._f,_=Dt(e,N);if(!P||k)return{};const M=o?o[0]:i,$=T=>{r&&M.reportValidity&&(M.setCustomValidity(Xi(T)?"":T||""),M.reportValidity())},Y={},U=f0(i),te=cd(i),W=U||te,ge=(j||h0(i))&&Sr(i.value)&&Sr(_)||Dh(i)&&i.value===""||_===""||Array.isArray(_)&&!_.length,oe=R5.bind(null,N,n,Y),B=(T,J,Z,Ne=qa.maxLength,he=qa.minLength)=>{const ae=T?J:Z;Y[N]={type:T?Ne:he,message:ae,ref:i,...oe(T?Ne:he,ae)}};if(s?!Array.isArray(_)||!_.length:l&&(!W&&(ge||Ns(_))||Xi(_)&&!_||te&&!F5(o).isValid||U&&!B5(o).isValid)){const{value:T,message:J}=Jd(l)?{value:!!l,message:l}:ic(l);if(T&&(Y[N]={type:qa.required,message:J,ref:M,...oe(qa.required,J)},!n))return $(J),Y}if(!ge&&(!Ns(f)||!Ns(m))){let T,J;const Z=ic(m),Ne=ic(f);if(!Ns(_)&&!isNaN(_)){const he=i.valueAsNumber||_&&+_;Ns(Z.value)||(T=he>Z.value),Ns(Ne.value)||(J=he<Ne.value)}else{const he=i.valueAsDate||new Date(_),ae=De=>new Date(new Date().toDateString()+" "+De),G=i.type=="time",xe=i.type=="week";Ji(Z.value)&&_&&(T=G?ae(_)>ae(Z.value):xe?_>Z.value:he>new Date(Z.value)),Ji(Ne.value)&&_&&(J=G?ae(_)<ae(Ne.value):xe?_<Ne.value:he<new Date(Ne.value))}if((T||J)&&(B(!!T,Z.message,Ne.message,qa.max,qa.min),!n))return $(Y[N].message),Y}if((c||d)&&!ge&&(Ji(_)||s&&Array.isArray(_))){const T=ic(c),J=ic(d),Z=!Ns(T.value)&&_.length>+T.value,Ne=!Ns(J.value)&&_.length<+J.value;if((Z||Ne)&&(B(Z,T.message,J.message),!n))return $(Y[N].message),Y}if(g&&!ge&&Ji(_)){const{value:T,message:J}=ic(g);if(Ih(T)&&!_.match(T)&&(Y[N]={type:qa.pattern,message:J,ref:i,...oe(qa.pattern,J)},!n))return $(J),Y}if(v){if(Ka(v)){const T=await v(_,e),J=vy(T,M);if(J&&(Y[N]={...J,...oe(qa.validate,J.message)},!n))return $(J.message),Y}else if(Dr(v)){let T={};for(const J in v){if(!Ds(T)&&!n)break;const Z=vy(await v[J](_,e),M,J);Z&&(T={...Z,...oe(J,Z.message)},$(Z.message),n&&(Y[N]=T))}if(!Ds(T)&&(Y[N]={ref:M,...T},!n))return Y}}return $(!0),Y};function J7(t,e){const n=e.slice(0,-1).length;let r=0;for(;r<n;)t=Sr(t)?r++:t[e[r++]];return t}function Q7(t){for(const e in t)if(t.hasOwnProperty(e)&&!Sr(t[e]))return!1;return!0}function qr(t,e){const n=Array.isArray(e)?e:d0(e)?[e]:O5(e),r=n.length===1?t:J7(t,n),s=n.length-1,i=n[s];return r&&delete r[i],s!==0&&(Dr(r)&&Ds(r)||Array.isArray(r)&&Q7(r))&&qr(t,n.slice(0,-1)),t}var yp=()=>{let t=[];return{get observers(){return t},next:s=>{for(const i of t)i.next&&i.next(s)},subscribe:s=>(t.push(s),{unsubscribe:()=>{t=t.filter(i=>i!==s)}}),unsubscribe:()=>{t=[]}}},Mh=t=>Ns(t)||!E5(t);function Mo(t,e){if(Mh(t)||Mh(e))return t===e;if(xc(t)&&xc(e))return t.getTime()===e.getTime();const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const s of n){const i=t[s];if(!r.includes(s))return!1;if(s!=="ref"){const o=e[s];if(xc(i)&&xc(o)||Dr(i)&&Dr(o)||Array.isArray(i)&&Array.isArray(o)?!Mo(i,o):i!==o)return!1}}return!0}var V5=t=>t.type==="select-multiple",eT=t=>f0(t)||cd(t),xp=t=>Dh(t)&&t.isConnected,q5=t=>{for(const e in t)if(Ka(t[e]))return!0;return!1};function Eh(t,e={}){const n=Array.isArray(t);if(Dr(t)||n)for(const r in t)Array.isArray(t[r])||Dr(t[r])&&!q5(t[r])?(e[r]=Array.isArray(t[r])?[]:{},Eh(t[r],e[r])):Ns(t[r])||(e[r]=!0);return e}function U5(t,e,n){const r=Array.isArray(t);if(Dr(t)||r)for(const s in t)Array.isArray(t[s])||Dr(t[s])&&!q5(t[s])?Sr(e)||Mh(n[s])?n[s]=Array.isArray(t[s])?Eh(t[s],[]):{...Eh(t[s])}:U5(t[s],Ns(e)?{}:e[s],n[s]):n[s]=!Mo(t[s],e[s]);return n}var Vd=(t,e)=>U5(t,e,Eh(e)),z5=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>Sr(t)?t:e?t===""?NaN:t&&+t:n&&Ji(t)?new Date(t):r?r(t):t;function bp(t){const e=t.ref;if(!(t.refs?t.refs.every(n=>n.disabled):e.disabled))return h0(e)?e.files:f0(e)?B5(t.refs).value:V5(e)?[...e.selectedOptions].map(({value:n})=>n):cd(e)?F5(t.refs).value:z5(Sr(e.value)?t.ref.value:e.value,t)}var tT=(t,e,n,r)=>{const s={};for(const i of t){const o=Dt(e,i);o&&Un(s,i,o._f)}return{criteriaMode:n,names:[...t],fields:s,shouldUseNativeValidation:r}},cu=t=>Sr(t)?t:Ih(t)?t.source:Dr(t)?Ih(t.value)?t.value.source:t.value:t;const xy="AsyncFunction";var nT=t=>(!t||!t.validate)&&!!(Ka(t.validate)&&t.validate.constructor.name===xy||Dr(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===xy)),rT=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function by(t,e,n){const r=Dt(t,n);if(r||d0(n))return{error:r,name:n};const s=n.split(".");for(;s.length;){const i=s.join("."),o=Dt(e,i),l=Dt(t,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};s.pop()}return{name:n}}var sT=(t,e,n,r,s)=>s.isOnAll?!1:!n&&s.isOnTouch?!(e||t):(n?r.isOnBlur:s.isOnBlur)?!t:(n?r.isOnChange:s.isOnChange)?t:!0,iT=(t,e)=>!ff(Dt(t,e)).length&&qr(t,e);const aT={mode:Pi.onSubmit,reValidateMode:Pi.onChange,shouldFocusError:!0};function oT(t={}){let e={...aT,...t},n={submitCount:0,isDirty:!1,isLoading:Ka(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},s=Dr(e.defaultValues)||Dr(e.values)?ii(e.defaultValues||e.values)||{}:{},i=e.shouldUnregister?{}:ii(s),o={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={values:yp(),array:yp(),state:yp()},g=hy(e.mode),v=hy(e.reValidateMode),N=e.criteriaMode===Pi.all,j=X=>ne=>{clearTimeout(d),d=setTimeout(X,ne)},P=async X=>{if(f.isValid||X){const ne=e.resolver?Ds((await W()).errors):await oe(r,!0);ne!==n.isValid&&m.state.next({isValid:ne})}},k=(X,ne)=>{(f.isValidating||f.validatingFields)&&((X||Array.from(l.mount)).forEach(fe=>{fe&&(ne?Un(n.validatingFields,fe,ne):qr(n.validatingFields,fe))}),m.state.next({validatingFields:n.validatingFields,isValidating:!Ds(n.validatingFields)}))},_=(X,ne=[],fe,Re,Oe=!0,Fe=!0)=>{if(Re&&fe){if(o.action=!0,Fe&&Array.isArray(Dt(r,X))){const et=fe(Dt(r,X),Re.argA,Re.argB);Oe&&Un(r,X,et)}if(Fe&&Array.isArray(Dt(n.errors,X))){const et=fe(Dt(n.errors,X),Re.argA,Re.argB);Oe&&Un(n.errors,X,et),iT(n.errors,X)}if(f.touchedFields&&Fe&&Array.isArray(Dt(n.touchedFields,X))){const et=fe(Dt(n.touchedFields,X),Re.argA,Re.argB);Oe&&Un(n.touchedFields,X,et)}f.dirtyFields&&(n.dirtyFields=Vd(s,i)),m.state.next({name:X,isDirty:T(X,ne),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Un(i,X,ne)},M=(X,ne)=>{Un(n.errors,X,ne),m.state.next({errors:n.errors})},$=X=>{n.errors=X,m.state.next({errors:n.errors,isValid:!1})},Y=(X,ne,fe,Re)=>{const Oe=Dt(r,X);if(Oe){const Fe=Dt(i,X,Sr(fe)?Dt(s,X):fe);Sr(Fe)||Re&&Re.defaultChecked||ne?Un(i,X,ne?Fe:bp(Oe._f)):Ne(X,Fe),o.mount&&P()}},U=(X,ne,fe,Re,Oe)=>{let Fe=!1,et=!1;const yt={name:X},Pt=!!(Dt(r,X)&&Dt(r,X)._f&&Dt(r,X)._f.disabled);if(!fe||Re){f.isDirty&&(et=n.isDirty,n.isDirty=yt.isDirty=T(),Fe=et!==yt.isDirty);const Lt=Pt||Mo(Dt(s,X),ne);et=!!(!Pt&&Dt(n.dirtyFields,X)),Lt||Pt?qr(n.dirtyFields,X):Un(n.dirtyFields,X,!0),yt.dirtyFields=n.dirtyFields,Fe=Fe||f.dirtyFields&&et!==!Lt}if(fe){const Lt=Dt(n.touchedFields,X);Lt||(Un(n.touchedFields,X,fe),yt.touchedFields=n.touchedFields,Fe=Fe||f.touchedFields&&Lt!==fe)}return Fe&&Oe&&m.state.next(yt),Fe?yt:{}},te=(X,ne,fe,Re)=>{const Oe=Dt(n.errors,X),Fe=f.isValid&&Xi(ne)&&n.isValid!==ne;if(t.delayError&&fe?(c=j(()=>M(X,fe)),c(t.delayError)):(clearTimeout(d),c=null,fe?Un(n.errors,X,fe):qr(n.errors,X)),(fe?!Mo(Oe,fe):Oe)||!Ds(Re)||Fe){const et={...Re,...Fe&&Xi(ne)?{isValid:ne}:{},errors:n.errors,name:X};n={...n,...et},m.state.next(et)}},W=async X=>{k(X,!0);const ne=await e.resolver(i,e.context,tT(X||l.mount,r,e.criteriaMode,e.shouldUseNativeValidation));return k(X),ne},ge=async X=>{const{errors:ne}=await W(X);if(X)for(const fe of X){const Re=Dt(ne,fe);Re?Un(n.errors,fe,Re):qr(n.errors,fe)}else n.errors=ne;return ne},oe=async(X,ne,fe={valid:!0})=>{for(const Re in X){const Oe=X[Re];if(Oe){const{_f:Fe,...et}=Oe;if(Fe){const yt=l.array.has(Fe.name),Pt=Oe._f&&nT(Oe._f);Pt&&f.validatingFields&&k([Re],!0);const Lt=await yy(Oe,i,N,e.shouldUseNativeValidation&&!ne,yt);if(Pt&&f.validatingFields&&k([Re]),Lt[Fe.name]&&(fe.valid=!1,ne))break;!ne&&(Dt(Lt,Fe.name)?yt?X7(n.errors,Lt,Fe.name):Un(n.errors,Fe.name,Lt[Fe.name]):qr(n.errors,Fe.name))}!Ds(et)&&await oe(et,ne,fe)}}return fe.valid},B=()=>{for(const X of l.unMount){const ne=Dt(r,X);ne&&(ne._f.refs?ne._f.refs.every(fe=>!xp(fe)):!xp(ne._f.ref))&&ue(X)}l.unMount=new Set},T=(X,ne)=>(X&&ne&&Un(i,X,ne),!Mo($e(),s)),J=(X,ne,fe)=>Z7(X,l,{...o.mount?i:Sr(ne)?s:Ji(X)?{[X]:ne}:ne},fe,ne),Z=X=>ff(Dt(o.mount?i:s,X,t.shouldUnregister?Dt(s,X,[]):[])),Ne=(X,ne,fe={})=>{const Re=Dt(r,X);let Oe=ne;if(Re){const Fe=Re._f;Fe&&(!Fe.disabled&&Un(i,X,z5(ne,Fe)),Oe=Dh(Fe.ref)&&Ns(ne)?"":ne,V5(Fe.ref)?[...Fe.ref.options].forEach(et=>et.selected=Oe.includes(et.value)):Fe.refs?cd(Fe.ref)?Fe.refs.length>1?Fe.refs.forEach(et=>(!et.defaultChecked||!et.disabled)&&(et.checked=Array.isArray(Oe)?!!Oe.find(yt=>yt===et.value):Oe===et.value)):Fe.refs[0]&&(Fe.refs[0].checked=!!Oe):Fe.refs.forEach(et=>et.checked=et.value===Oe):h0(Fe.ref)?Fe.ref.value="":(Fe.ref.value=Oe,Fe.ref.type||m.values.next({name:X,values:{...i}})))}(fe.shouldDirty||fe.shouldTouch)&&U(X,Oe,fe.shouldTouch,fe.shouldDirty,!0),fe.shouldValidate&&De(X)},he=(X,ne,fe)=>{for(const Re in ne){const Oe=ne[Re],Fe=`${X}.${Re}`,et=Dt(r,Fe);(l.array.has(X)||!Mh(Oe)||et&&!et._f)&&!xc(Oe)?he(Fe,Oe,fe):Ne(Fe,Oe,fe)}},ae=(X,ne,fe={})=>{const Re=Dt(r,X),Oe=l.array.has(X),Fe=ii(ne);Un(i,X,Fe),Oe?(m.array.next({name:X,values:{...i}}),(f.isDirty||f.dirtyFields)&&fe.shouldDirty&&m.state.next({name:X,dirtyFields:Vd(s,i),isDirty:T(X,Fe)})):Re&&!Re._f&&!Ns(Fe)?he(X,Fe,fe):Ne(X,Fe,fe),fy(X,l)&&m.state.next({...n}),m.values.next({name:o.mount?X:void 0,values:{...i}})},G=async X=>{o.mount=!0;const ne=X.target;let fe=ne.name,Re=!0;const Oe=Dt(r,fe),Fe=()=>ne.type?bp(Oe._f):z7(X),et=yt=>{Re=Number.isNaN(yt)||Mo(yt,Dt(i,fe,yt))};if(Oe){let yt,Pt;const Lt=Fe(),an=X.type===dy.BLUR||X.type===dy.FOCUS_OUT,Ot=!rT(Oe._f)&&!e.resolver&&!Dt(n.errors,fe)&&!Oe._f.deps||sT(an,Dt(n.touchedFields,fe),n.isSubmitted,v,g),Qt=fy(fe,l,an);Un(i,fe,Lt),an?(Oe._f.onBlur&&Oe._f.onBlur(X),c&&c(0)):Oe._f.onChange&&Oe._f.onChange(X);const ft=U(fe,Lt,an,!1),In=!Ds(ft)||Qt;if(!an&&m.values.next({name:fe,type:X.type,values:{...i}}),Ot)return f.isValid&&(t.mode==="onBlur"?an&&P():P()),In&&m.state.next({name:fe,...Qt?{}:ft});if(!an&&Qt&&m.state.next({...n}),e.resolver){const{errors:on}=await W([fe]);if(et(Lt),Re){const Mr=by(n.errors,r,fe),ln=by(on,r,Mr.name||fe);yt=ln.error,fe=ln.name,Pt=Ds(on)}}else k([fe],!0),yt=(await yy(Oe,i,N,e.shouldUseNativeValidation))[fe],k([fe]),et(Lt),Re&&(yt?Pt=!1:f.isValid&&(Pt=await oe(r,!0)));Re&&(Oe._f.deps&&De(Oe._f.deps),te(fe,Pt,yt,ft))}},xe=(X,ne)=>{if(Dt(n.errors,ne)&&X.focus)return X.focus(),1},De=async(X,ne={})=>{let fe,Re;const Oe=Xd(X);if(e.resolver){const Fe=await ge(Sr(X)?X:Oe);fe=Ds(Fe),Re=X?!Oe.some(et=>Dt(Fe,et)):fe}else X?(Re=(await Promise.all(Oe.map(async Fe=>{const et=Dt(r,Fe);return await oe(et&&et._f?{[Fe]:et}:et)}))).every(Boolean),!(!Re&&!n.isValid)&&P()):Re=fe=await oe(r);return m.state.next({...!Ji(X)||f.isValid&&fe!==n.isValid?{}:{name:X},...e.resolver||!X?{isValid:fe}:{},errors:n.errors}),ne.shouldFocus&&!Re&&Su(r,xe,X?Oe:l.mount),Re},$e=X=>{const ne={...o.mount?i:s};return Sr(X)?ne:Ji(X)?Dt(ne,X):X.map(fe=>Dt(ne,fe))},E=(X,ne)=>({invalid:!!Dt((ne||n).errors,X),isDirty:!!Dt((ne||n).dirtyFields,X),error:Dt((ne||n).errors,X),isValidating:!!Dt(n.validatingFields,X),isTouched:!!Dt((ne||n).touchedFields,X)}),z=X=>{X&&Xd(X).forEach(ne=>qr(n.errors,ne)),m.state.next({errors:X?n.errors:{}})},ee=(X,ne,fe)=>{const Re=(Dt(r,X,{_f:{}})._f||{}).ref,Oe=Dt(n.errors,X)||{},{ref:Fe,message:et,type:yt,...Pt}=Oe;Un(n.errors,X,{...Pt,...ne,ref:Re}),m.state.next({name:X,errors:n.errors,isValid:!1}),fe&&fe.shouldFocus&&Re&&Re.focus&&Re.focus()},le=(X,ne)=>Ka(X)?m.values.subscribe({next:fe=>X(J(void 0,ne),fe)}):J(X,ne,!0),ue=(X,ne={})=>{for(const fe of X?Xd(X):l.mount)l.mount.delete(fe),l.array.delete(fe),ne.keepValue||(qr(r,fe),qr(i,fe)),!ne.keepError&&qr(n.errors,fe),!ne.keepDirty&&qr(n.dirtyFields,fe),!ne.keepTouched&&qr(n.touchedFields,fe),!ne.keepIsValidating&&qr(n.validatingFields,fe),!e.shouldUnregister&&!ne.keepDefaultValue&&qr(s,fe);m.values.next({values:{...i}}),m.state.next({...n,...ne.keepDirty?{isDirty:T()}:{}}),!ne.keepIsValid&&P()},ve=({disabled:X,name:ne,field:fe,fields:Re,value:Oe})=>{if(Xi(X)&&o.mount||X){const Fe=X?void 0:Sr(Oe)?bp(fe?fe._f:Dt(Re,ne)._f):Oe;Un(i,ne,Fe),U(ne,Fe,!1,!1,!0)}},Pe=(X,ne={})=>{let fe=Dt(r,X);const Re=Xi(ne.disabled)||Xi(t.disabled);return Un(r,X,{...fe||{},_f:{...fe&&fe._f?fe._f:{ref:{name:X}},name:X,mount:!0,...ne}}),l.mount.add(X),fe?ve({field:fe,disabled:Xi(ne.disabled)?ne.disabled:t.disabled,name:X,value:ne.value}):Y(X,!0,ne.value),{...Re?{disabled:ne.disabled||t.disabled}:{},...e.progressive?{required:!!ne.required,min:cu(ne.min),max:cu(ne.max),minLength:cu(ne.minLength),maxLength:cu(ne.maxLength),pattern:cu(ne.pattern)}:{},name:X,onChange:G,onBlur:G,ref:Oe=>{if(Oe){Pe(X,ne),fe=Dt(r,X);const Fe=Sr(Oe.value)&&Oe.querySelectorAll&&Oe.querySelectorAll("input,select,textarea")[0]||Oe,et=eT(Fe),yt=fe._f.refs||[];if(et?yt.find(Pt=>Pt===Fe):Fe===fe._f.ref)return;Un(r,X,{_f:{...fe._f,...et?{refs:[...yt.filter(xp),Fe,...Array.isArray(Dt(s,X))?[{}]:[]],ref:{type:Fe.type,name:X}}:{ref:Fe}}}),Y(X,!1,void 0,Fe)}else fe=Dt(r,X,{}),fe._f&&(fe._f.mount=!1),(e.shouldUnregister||ne.shouldUnregister)&&!($7(l.array,X)&&o.action)&&l.unMount.add(X)}}},ce=()=>e.shouldFocusError&&Su(r,xe,l.mount),Ye=X=>{Xi(X)&&(m.state.next({disabled:X}),Su(r,(ne,fe)=>{const Re=Dt(r,fe);Re&&(ne.disabled=Re._f.disabled||X,Array.isArray(Re._f.refs)&&Re._f.refs.forEach(Oe=>{Oe.disabled=Re._f.disabled||X}))},0,!1))},Ke=(X,ne)=>async fe=>{let Re;fe&&(fe.preventDefault&&fe.preventDefault(),fe.persist&&fe.persist());let Oe=ii(i);if(m.state.next({isSubmitting:!0}),e.resolver){const{errors:Fe,values:et}=await W();n.errors=Fe,Oe=et}else await oe(r);if(qr(n.errors,"root"),Ds(n.errors)){m.state.next({errors:{}});try{await X(Oe,fe)}catch(Fe){Re=Fe}}else ne&&await ne({...n.errors},fe),ce(),setTimeout(ce);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ds(n.errors)&&!Re,submitCount:n.submitCount+1,errors:n.errors}),Re)throw Re},Ue=(X,ne={})=>{Dt(r,X)&&(Sr(ne.defaultValue)?ae(X,ii(Dt(s,X))):(ae(X,ne.defaultValue),Un(s,X,ii(ne.defaultValue))),ne.keepTouched||qr(n.touchedFields,X),ne.keepDirty||(qr(n.dirtyFields,X),n.isDirty=ne.defaultValue?T(X,ii(Dt(s,X))):T()),ne.keepError||(qr(n.errors,X),f.isValid&&P()),m.state.next({...n}))},it=(X,ne={})=>{const fe=X?ii(X):s,Re=ii(fe),Oe=Ds(X),Fe=Oe?s:Re;if(ne.keepDefaultValues||(s=fe),!ne.keepValues){if(ne.keepDirtyValues)for(const et of l.mount)Dt(n.dirtyFields,et)?Un(Fe,et,Dt(i,et)):ae(et,Dt(Fe,et));else{if(u0&&Sr(X))for(const et of l.mount){const yt=Dt(r,et);if(yt&&yt._f){const Pt=Array.isArray(yt._f.refs)?yt._f.refs[0]:yt._f.ref;if(Dh(Pt)){const Lt=Pt.closest("form");if(Lt){Lt.reset();break}}}}r={}}i=t.shouldUnregister?ne.keepDefaultValues?ii(s):{}:ii(Fe),m.array.next({values:{...Fe}}),m.values.next({values:{...Fe}})}l={mount:ne.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!ne.keepIsValid||!!ne.keepDirtyValues,o.watch=!!t.shouldUnregister,m.state.next({submitCount:ne.keepSubmitCount?n.submitCount:0,isDirty:Oe?!1:ne.keepDirty?n.isDirty:!!(ne.keepDefaultValues&&!Mo(X,s)),isSubmitted:ne.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Oe?{}:ne.keepDirtyValues?ne.keepDefaultValues&&i?Vd(s,i):n.dirtyFields:ne.keepDefaultValues&&X?Vd(s,X):ne.keepDirty?n.dirtyFields:{},touchedFields:ne.keepTouched?n.touchedFields:{},errors:ne.keepErrors?n.errors:{},isSubmitSuccessful:ne.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},It=(X,ne)=>it(Ka(X)?X(i):X,ne);return{control:{register:Pe,unregister:ue,getFieldState:E,handleSubmit:Ke,setError:ee,_executeSchema:W,_getWatch:J,_getDirty:T,_updateValid:P,_removeUnmounted:B,_updateFieldArray:_,_updateDisabledField:ve,_getFieldArray:Z,_reset:it,_resetDefaultValues:()=>Ka(e.defaultValues)&&e.defaultValues().then(X=>{It(X,e.resetOptions),m.state.next({isLoading:!1})}),_updateFormState:X=>{n={...n,...X}},_disableForm:Ye,_subjects:m,_proxyFormState:f,_setErrors:$,get _fields(){return r},get _formValues(){return i},get _state(){return o},set _state(X){o=X},get _defaultValues(){return s},get _names(){return l},set _names(X){l=X},get _formState(){return n},set _formState(X){n=X},get _options(){return e},set _options(X){e={...e,...X}}},trigger:De,register:Pe,handleSubmit:Ke,watch:le,setValue:ae,getValues:$e,reset:It,resetField:Ue,clearErrors:z,unregister:ue,setError:ee,setFocus:(X,ne={})=>{const fe=Dt(r,X),Re=fe&&fe._f;if(Re){const Oe=Re.refs?Re.refs[0]:Re.ref;Oe.focus&&(Oe.focus(),ne.shouldSelect&&Oe.select())}},getFieldState:E}}function pf(t={}){const e=dt.useRef(),n=dt.useRef(),[r,s]=dt.useState({isDirty:!1,isValidating:!1,isLoading:Ka(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:Ka(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...oT(t),formState:r});const i=e.current.control;return i._options=t,Y7({subject:i._subjects.state,next:o=>{G7(o,i._proxyFormState,i._updateFormState)&&s({...i._formState})}}),dt.useEffect(()=>i._disableForm(t.disabled),[i,t.disabled]),dt.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==r.isDirty&&i._subjects.state.next({isDirty:o})}},[i,r.isDirty]),dt.useEffect(()=>{t.values&&!Mo(t.values,n.current)?(i._reset(t.values,i._options.resetOptions),n.current=t.values,s(o=>({...o}))):i._resetDefaultValues()},[t.values,i]),dt.useEffect(()=>{t.errors&&i._setErrors(t.errors)},[t.errors,i]),dt.useEffect(()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),dt.useEffect(()=>{t.shouldUnregister&&i._subjects.values.next({values:i._getWatch()})},[t.shouldUnregister,i]),e.current.formState=K7(r,i),e.current}const wy=(t,e,n)=>{if(t&&"reportValidity"in t){const r=Dt(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},W5=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?wy(r.ref,n,t):r.refs&&r.refs.forEach(s=>wy(s,n,t))}},lT=(t,e)=>{e.shouldUseNativeValidation&&W5(t,e);const n={};for(const r in t){const s=Dt(e.fields,r),i=Object.assign(t[r]||{},{ref:s&&s.ref});if(cT(e.names||Object.keys(t),r)){const o=Object.assign({},Dt(n,r));Un(o,"root",i),Un(n,r,o)}else Un(n,r,i)}return n},cT=(t,e)=>t.some(n=>n.startsWith(e+"."));var uT=function(t,e){for(var n={};t.length;){var r=t[0],s=r.code,i=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[o]={message:l.message,type:l.code}}else n[o]={message:i,type:s};if("unionErrors"in r&&r.unionErrors.forEach(function(f){return f.errors.forEach(function(m){return t.push(m)})}),e){var c=n[o].types,d=c&&c[r.code];n[o]=R5(o,e,n,s,d?[].concat(d,r.message):r.message)}t.shift()}return n},mf=function(t,e,n){return n===void 0&&(n={}),function(r,s,i){try{return Promise.resolve(function(o,l){try{var c=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(d){return i.shouldUseNativeValidation&&W5({},i),{errors:{},values:n.raw?r:d}})}catch(d){return l(d)}return c&&c.then?c.then(void 0,l):c}(0,function(o){if(function(l){return Array.isArray(l==null?void 0:l.errors)}(o))return{values:{},errors:lT(uT(o.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw o}))}catch(o){return Promise.reject(o)}}},jn;(function(t){t.assertEqual=s=>s;function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(l=>typeof s[s[l]]!="number"),o={};for(const l of i)o[l]=s[l];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(jn||(jn={}));var Nm;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Nm||(Nm={}));const Tt=jn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Eo=t=>{switch(typeof t){case"undefined":return Tt.undefined;case"string":return Tt.string;case"number":return isNaN(t)?Tt.nan:Tt.number;case"boolean":return Tt.boolean;case"function":return Tt.function;case"bigint":return Tt.bigint;case"symbol":return Tt.symbol;case"object":return Array.isArray(t)?Tt.array:t===null?Tt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Tt.promise:typeof Map<"u"&&t instanceof Map?Tt.map:typeof Set<"u"&&t instanceof Set?Tt.set:typeof Date<"u"&&t instanceof Date?Tt.date:Tt.object;default:return Tt.unknown}},ct=jn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),dT=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class Ys extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let l=r,c=0;for(;c<o.path.length;){const d=o.path[c];c===o.path.length-1?(l[d]=l[d]||{_errors:[]},l[d]._errors.push(n(o))):l[d]=l[d]||{_errors:[]},l=l[d],c++}}};return s(this),r}static assert(e){if(!(e instanceof Ys))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,jn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ys.create=t=>new Ys(t);const Rc=(t,e)=>{let n;switch(t.code){case ct.invalid_type:t.received===Tt.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ct.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,jn.jsonStringifyReplacer)}`;break;case ct.unrecognized_keys:n=`Unrecognized key(s) in object: ${jn.joinValues(t.keys,", ")}`;break;case ct.invalid_union:n="Invalid input";break;case ct.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${jn.joinValues(t.options)}`;break;case ct.invalid_enum_value:n=`Invalid enum value. Expected ${jn.joinValues(t.options)}, received '${t.received}'`;break;case ct.invalid_arguments:n="Invalid function arguments";break;case ct.invalid_return_type:n="Invalid function return type";break;case ct.invalid_date:n="Invalid date";break;case ct.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:jn.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ct.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case ct.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case ct.custom:n="Invalid input";break;case ct.invalid_intersection_types:n="Intersection results could not be merged";break;case ct.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ct.not_finite:n="Number must be finite";break;default:n=e.defaultError,jn.assertNever(t)}return{message:n}};let $5=Rc;function hT(t){$5=t}function Oh(){return $5}const Rh=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let l="";const c=r.filter(d=>!!d).slice().reverse();for(const d of c)l=d(o,{data:e,defaultError:l}).message;return{...s,path:i,message:l}},fT=[];function _t(t,e){const n=Oh(),r=Rh({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Rc?void 0:Rc].filter(s=>!!s)});t.common.issues.push(r)}class xs{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return nn;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return xs.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return nn;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const nn=Object.freeze({status:"aborted"}),bc=t=>({status:"dirty",value:t}),Ss=t=>({status:"valid",value:t}),jm=t=>t.status==="aborted",Sm=t=>t.status==="dirty",Bu=t=>t.status==="valid",Vu=t=>typeof Promise<"u"&&t instanceof Promise;function Fh(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function H5(t,e,n,r,s){if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var Bt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Bt||(Bt={}));var vu,yu;class ua{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ny=(t,e)=>{if(Bu(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ys(t.common.issues);return this._error=n,this._error}}};function dn(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,l)=>{var c,d;const{message:f}=t;return o.code==="invalid_enum_value"?{message:f??l.defaultError}:typeof l.data>"u"?{message:(c=f??r)!==null&&c!==void 0?c:l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:(d=f??n)!==null&&d!==void 0?d:l.defaultError}},description:s}}class fn{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Eo(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Eo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new xs,ctx:{common:e.parent.common,data:e.data,parsedType:Eo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Vu(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const s={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Eo(e)},i=this._parseSync({data:e,path:s.path,parent:s});return Ny(s,i)}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Eo(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Vu(s)?s:Promise.resolve(s));return Ny(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),l=()=>i.addIssue({code:ct.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new Ii({schema:this,typeName:Jt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return sa.create(this,this._def)}nullable(){return Yo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Di.create(this,this._def)}promise(){return Bc.create(this,this._def)}or(e){return Wu.create([this,e],this._def)}and(e){return $u.create(this,e,this._def)}transform(e){return new Ii({...dn(this._def),schema:this,typeName:Jt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Zu({...dn(this._def),innerType:this,defaultValue:n,typeName:Jt.ZodDefault})}brand(){return new p0({typeName:Jt.ZodBranded,type:this,...dn(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Xu({...dn(this._def),innerType:this,catchValue:n,typeName:Jt.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return ud.create(this,e)}readonly(){return Ju.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const pT=/^c[^\s-]{8,}$/i,mT=/^[0-9a-z]+$/,gT=/^[0-9A-HJKMNP-TV-Z]{26}$/,vT=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,yT=/^[a-z0-9_-]{21}$/i,xT=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,bT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let wp;const NT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,jT=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ST=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,K5="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",kT=new RegExp(`^${K5}$`);function G5(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function _T(t){return new RegExp(`^${G5(t)}$`)}function Y5(t){let e=`${K5}T${G5(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function AT(t,e){return!!((e==="v4"||!e)&&NT.test(t)||(e==="v6"||!e)&&jT.test(t))}class Ti extends fn{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Tt.string){const i=this._getOrReturnCtx(e);return _t(i,{code:ct.invalid_type,expected:Tt.string,received:i.parsedType}),nn}const r=new xs;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),_t(s,{code:ct.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),_t(s,{code:ct.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,l=e.data.length<i.value;(o||l)&&(s=this._getOrReturnCtx(e,s),o?_t(s,{code:ct.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):l&&_t(s,{code:ct.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")bT.test(e.data)||(s=this._getOrReturnCtx(e,s),_t(s,{validation:"email",code:ct.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")wp||(wp=new RegExp(wT,"u")),wp.test(e.data)||(s=this._getOrReturnCtx(e,s),_t(s,{validation:"emoji",code:ct.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")vT.test(e.data)||(s=this._getOrReturnCtx(e,s),_t(s,{validation:"uuid",code:ct.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")yT.test(e.data)||(s=this._getOrReturnCtx(e,s),_t(s,{validation:"nanoid",code:ct.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")pT.test(e.data)||(s=this._getOrReturnCtx(e,s),_t(s,{validation:"cuid",code:ct.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")mT.test(e.data)||(s=this._getOrReturnCtx(e,s),_t(s,{validation:"cuid2",code:ct.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")gT.test(e.data)||(s=this._getOrReturnCtx(e,s),_t(s,{validation:"ulid",code:ct.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),_t(s,{validation:"url",code:ct.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),_t(s,{validation:"regex",code:ct.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),_t(s,{code:ct.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),_t(s,{code:ct.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),_t(s,{code:ct.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Y5(i).test(e.data)||(s=this._getOrReturnCtx(e,s),_t(s,{code:ct.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?kT.test(e.data)||(s=this._getOrReturnCtx(e,s),_t(s,{code:ct.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?_T(i).test(e.data)||(s=this._getOrReturnCtx(e,s),_t(s,{code:ct.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?xT.test(e.data)||(s=this._getOrReturnCtx(e,s),_t(s,{validation:"duration",code:ct.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?AT(e.data,i.version)||(s=this._getOrReturnCtx(e,s),_t(s,{validation:"ip",code:ct.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?ST.test(e.data)||(s=this._getOrReturnCtx(e,s),_t(s,{validation:"base64",code:ct.invalid_string,message:i.message}),r.dirty()):jn.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:ct.invalid_string,...Bt.errToObj(r)})}_addCheck(e){return new Ti({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Bt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Bt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Bt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Bt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Bt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Bt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Bt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Bt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Bt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Bt.errToObj(e)})}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...Bt.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Bt.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Bt.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Bt.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Bt.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Bt.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Bt.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Bt.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Bt.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Bt.errToObj(n)})}nonempty(e){return this.min(1,Bt.errToObj(e))}trim(){return new Ti({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ti({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ti({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Ti.create=t=>{var e;return new Ti({checks:[],typeName:Jt.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...dn(t)})};function PT(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=parseInt(t.toFixed(s).replace(".","")),o=parseInt(e.toFixed(s).replace(".",""));return i%o/Math.pow(10,s)}class Ho extends fn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Tt.number){const i=this._getOrReturnCtx(e);return _t(i,{code:ct.invalid_type,expected:Tt.number,received:i.parsedType}),nn}let r;const s=new xs;for(const i of this._def.checks)i.kind==="int"?jn.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),_t(r,{code:ct.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),_t(r,{code:ct.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),_t(r,{code:ct.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?PT(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),_t(r,{code:ct.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),_t(r,{code:ct.not_finite,message:i.message}),s.dirty()):jn.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Bt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Bt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Bt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Bt.toString(n))}setLimit(e,n,r,s){return new Ho({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Bt.toString(s)}]})}_addCheck(e){return new Ho({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Bt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Bt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Bt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Bt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Bt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Bt.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Bt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Bt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Bt.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&jn.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Ho.create=t=>new Ho({checks:[],typeName:Jt.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...dn(t)});class Ko extends fn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Tt.bigint){const i=this._getOrReturnCtx(e);return _t(i,{code:ct.invalid_type,expected:Tt.bigint,received:i.parsedType}),nn}let r;const s=new xs;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),_t(r,{code:ct.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),_t(r,{code:ct.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),_t(r,{code:ct.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):jn.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Bt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Bt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Bt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Bt.toString(n))}setLimit(e,n,r,s){return new Ko({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Bt.toString(s)}]})}_addCheck(e){return new Ko({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Bt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Bt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Bt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Bt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Bt.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Ko.create=t=>{var e;return new Ko({checks:[],typeName:Jt.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...dn(t)})};class qu extends fn{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Tt.boolean){const r=this._getOrReturnCtx(e);return _t(r,{code:ct.invalid_type,expected:Tt.boolean,received:r.parsedType}),nn}return Ss(e.data)}}qu.create=t=>new qu({typeName:Jt.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...dn(t)});class Fl extends fn{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Tt.date){const i=this._getOrReturnCtx(e);return _t(i,{code:ct.invalid_type,expected:Tt.date,received:i.parsedType}),nn}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return _t(i,{code:ct.invalid_date}),nn}const r=new xs;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),_t(s,{code:ct.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),_t(s,{code:ct.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):jn.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Fl({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Bt.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Bt.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Fl.create=t=>new Fl({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Jt.ZodDate,...dn(t)});class Bh extends fn{_parse(e){if(this._getType(e)!==Tt.symbol){const r=this._getOrReturnCtx(e);return _t(r,{code:ct.invalid_type,expected:Tt.symbol,received:r.parsedType}),nn}return Ss(e.data)}}Bh.create=t=>new Bh({typeName:Jt.ZodSymbol,...dn(t)});class Uu extends fn{_parse(e){if(this._getType(e)!==Tt.undefined){const r=this._getOrReturnCtx(e);return _t(r,{code:ct.invalid_type,expected:Tt.undefined,received:r.parsedType}),nn}return Ss(e.data)}}Uu.create=t=>new Uu({typeName:Jt.ZodUndefined,...dn(t)});class zu extends fn{_parse(e){if(this._getType(e)!==Tt.null){const r=this._getOrReturnCtx(e);return _t(r,{code:ct.invalid_type,expected:Tt.null,received:r.parsedType}),nn}return Ss(e.data)}}zu.create=t=>new zu({typeName:Jt.ZodNull,...dn(t)});class Fc extends fn{constructor(){super(...arguments),this._any=!0}_parse(e){return Ss(e.data)}}Fc.create=t=>new Fc({typeName:Jt.ZodAny,...dn(t)});class Ml extends fn{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ss(e.data)}}Ml.create=t=>new Ml({typeName:Jt.ZodUnknown,...dn(t)});class ro extends fn{_parse(e){const n=this._getOrReturnCtx(e);return _t(n,{code:ct.invalid_type,expected:Tt.never,received:n.parsedType}),nn}}ro.create=t=>new ro({typeName:Jt.ZodNever,...dn(t)});class Vh extends fn{_parse(e){if(this._getType(e)!==Tt.undefined){const r=this._getOrReturnCtx(e);return _t(r,{code:ct.invalid_type,expected:Tt.void,received:r.parsedType}),nn}return Ss(e.data)}}Vh.create=t=>new Vh({typeName:Jt.ZodVoid,...dn(t)});class Di extends fn{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==Tt.array)return _t(n,{code:ct.invalid_type,expected:Tt.array,received:n.parsedType}),nn;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,l=n.data.length<s.exactLength.value;(o||l)&&(_t(n,{code:o?ct.too_big:ct.too_small,minimum:l?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(_t(n,{code:ct.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(_t(n,{code:ct.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>s.type._parseAsync(new ua(n,o,n.path,l)))).then(o=>xs.mergeArray(r,o));const i=[...n.data].map((o,l)=>s.type._parseSync(new ua(n,o,n.path,l)));return xs.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Di({...this._def,minLength:{value:e,message:Bt.toString(n)}})}max(e,n){return new Di({...this._def,maxLength:{value:e,message:Bt.toString(n)}})}length(e,n){return new Di({...this._def,exactLength:{value:e,message:Bt.toString(n)}})}nonempty(e){return this.min(1,e)}}Di.create=(t,e)=>new Di({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Jt.ZodArray,...dn(e)});function uc(t){if(t instanceof ur){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=sa.create(uc(r))}return new ur({...t._def,shape:()=>e})}else return t instanceof Di?new Di({...t._def,type:uc(t.element)}):t instanceof sa?sa.create(uc(t.unwrap())):t instanceof Yo?Yo.create(uc(t.unwrap())):t instanceof da?da.create(t.items.map(e=>uc(e))):t}class ur extends fn{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=jn.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==Tt.object){const d=this._getOrReturnCtx(e);return _t(d,{code:ct.invalid_type,expected:Tt.object,received:d.parsedType}),nn}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof ro&&this._def.unknownKeys==="strip"))for(const d in s.data)o.includes(d)||l.push(d);const c=[];for(const d of o){const f=i[d],m=s.data[d];c.push({key:{status:"valid",value:d},value:f._parse(new ua(s,m,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof ro){const d=this._def.unknownKeys;if(d==="passthrough")for(const f of l)c.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(d==="strict")l.length>0&&(_t(s,{code:ct.unrecognized_keys,keys:l}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const f of l){const m=s.data[f];c.push({key:{status:"valid",value:f},value:d._parse(new ua(s,m,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const f of c){const m=await f.key,g=await f.value;d.push({key:m,value:g,alwaysSet:f.alwaysSet})}return d}).then(d=>xs.mergeObjectSync(r,d)):xs.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return Bt.errToObj,new ur({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var s,i,o,l;const c=(o=(i=(s=this._def).errorMap)===null||i===void 0?void 0:i.call(s,n,r).message)!==null&&o!==void 0?o:r.defaultError;return n.code==="unrecognized_keys"?{message:(l=Bt.errToObj(e).message)!==null&&l!==void 0?l:c}:{message:c}}}:{}})}strip(){return new ur({...this._def,unknownKeys:"strip"})}passthrough(){return new ur({...this._def,unknownKeys:"passthrough"})}extend(e){return new ur({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ur({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Jt.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new ur({...this._def,catchall:e})}pick(e){const n={};return jn.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new ur({...this._def,shape:()=>n})}omit(e){const n={};return jn.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new ur({...this._def,shape:()=>n})}deepPartial(){return uc(this)}partial(e){const n={};return jn.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}),new ur({...this._def,shape:()=>n})}required(e){const n={};return jn.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof sa;)i=i._def.innerType;n[r]=i}}),new ur({...this._def,shape:()=>n})}keyof(){return Z5(jn.objectKeys(this.shape))}}ur.create=(t,e)=>new ur({shape:()=>t,unknownKeys:"strip",catchall:ro.create(),typeName:Jt.ZodObject,...dn(e)});ur.strictCreate=(t,e)=>new ur({shape:()=>t,unknownKeys:"strict",catchall:ro.create(),typeName:Jt.ZodObject,...dn(e)});ur.lazycreate=(t,e)=>new ur({shape:t,unknownKeys:"strip",catchall:ro.create(),typeName:Jt.ZodObject,...dn(e)});class Wu extends fn{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const l of i)if(l.result.status==="valid")return l.result;for(const l of i)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=i.map(l=>new Ys(l.ctx.common.issues));return _t(n,{code:ct.invalid_union,unionErrors:o}),nn}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const c of r){const d={...n,common:{...n.common,issues:[]},parent:null},f=c._parseSync({data:n.data,path:n.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const l=o.map(c=>new Ys(c));return _t(n,{code:ct.invalid_union,unionErrors:l}),nn}}get options(){return this._def.options}}Wu.create=(t,e)=>new Wu({options:t,typeName:Jt.ZodUnion,...dn(e)});const $a=t=>t instanceof Ku?$a(t.schema):t instanceof Ii?$a(t.innerType()):t instanceof Gu?[t.value]:t instanceof Go?t.options:t instanceof Yu?jn.objectValues(t.enum):t instanceof Zu?$a(t._def.innerType):t instanceof Uu?[void 0]:t instanceof zu?[null]:t instanceof sa?[void 0,...$a(t.unwrap())]:t instanceof Yo?[null,...$a(t.unwrap())]:t instanceof p0||t instanceof Ju?$a(t.unwrap()):t instanceof Xu?$a(t._def.innerType):[];class gf extends fn{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Tt.object)return _t(n,{code:ct.invalid_type,expected:Tt.object,received:n.parsedType}),nn;const r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(_t(n,{code:ct.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),nn)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const i of n){const o=$a(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const l of o){if(s.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);s.set(l,i)}}return new gf({typeName:Jt.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...dn(r)})}}function km(t,e){const n=Eo(t),r=Eo(e);if(t===e)return{valid:!0,data:t};if(n===Tt.object&&r===Tt.object){const s=jn.objectKeys(e),i=jn.objectKeys(t).filter(l=>s.indexOf(l)!==-1),o={...t,...e};for(const l of i){const c=km(t[l],e[l]);if(!c.valid)return{valid:!1};o[l]=c.data}return{valid:!0,data:o}}else if(n===Tt.array&&r===Tt.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],l=e[i],c=km(o,l);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===Tt.date&&r===Tt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class $u extends fn{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(jm(i)||jm(o))return nn;const l=km(i.value,o.value);return l.valid?((Sm(i)||Sm(o))&&n.dirty(),{status:n.value,value:l.data}):(_t(r,{code:ct.invalid_intersection_types}),nn)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}$u.create=(t,e,n)=>new $u({left:t,right:e,typeName:Jt.ZodIntersection,...dn(n)});class da extends fn{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Tt.array)return _t(r,{code:ct.invalid_type,expected:Tt.array,received:r.parsedType}),nn;if(r.data.length<this._def.items.length)return _t(r,{code:ct.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),nn;!this._def.rest&&r.data.length>this._def.items.length&&(_t(r,{code:ct.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new ua(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>xs.mergeArray(n,o)):xs.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new da({...this._def,rest:e})}}da.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new da({items:t,typeName:Jt.ZodTuple,rest:null,...dn(e)})};class Hu extends fn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Tt.object)return _t(r,{code:ct.invalid_type,expected:Tt.object,received:r.parsedType}),nn;const s=[],i=this._def.keyType,o=this._def.valueType;for(const l in r.data)s.push({key:i._parse(new ua(r,l,r.path,l)),value:o._parse(new ua(r,r.data[l],r.path,l)),alwaysSet:l in r.data});return r.common.async?xs.mergeObjectAsync(n,s):xs.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof fn?new Hu({keyType:e,valueType:n,typeName:Jt.ZodRecord,...dn(r)}):new Hu({keyType:Ti.create(),valueType:e,typeName:Jt.ZodRecord,...dn(n)})}}class qh extends fn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Tt.map)return _t(r,{code:ct.invalid_type,expected:Tt.map,received:r.parsedType}),nn;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([l,c],d)=>({key:s._parse(new ua(r,l,r.path,[d,"key"])),value:i._parse(new ua(r,c,r.path,[d,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of o){const d=await c.key,f=await c.value;if(d.status==="aborted"||f.status==="aborted")return nn;(d.status==="dirty"||f.status==="dirty")&&n.dirty(),l.set(d.value,f.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const c of o){const d=c.key,f=c.value;if(d.status==="aborted"||f.status==="aborted")return nn;(d.status==="dirty"||f.status==="dirty")&&n.dirty(),l.set(d.value,f.value)}return{status:n.value,value:l}}}}qh.create=(t,e,n)=>new qh({valueType:e,keyType:t,typeName:Jt.ZodMap,...dn(n)});class Bl extends fn{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Tt.set)return _t(r,{code:ct.invalid_type,expected:Tt.set,received:r.parsedType}),nn;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(_t(r,{code:ct.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(_t(r,{code:ct.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(c){const d=new Set;for(const f of c){if(f.status==="aborted")return nn;f.status==="dirty"&&n.dirty(),d.add(f.value)}return{status:n.value,value:d}}const l=[...r.data.values()].map((c,d)=>i._parse(new ua(r,c,r.path,d)));return r.common.async?Promise.all(l).then(c=>o(c)):o(l)}min(e,n){return new Bl({...this._def,minSize:{value:e,message:Bt.toString(n)}})}max(e,n){return new Bl({...this._def,maxSize:{value:e,message:Bt.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Bl.create=(t,e)=>new Bl({valueType:t,minSize:null,maxSize:null,typeName:Jt.ZodSet,...dn(e)});class _c extends fn{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Tt.function)return _t(n,{code:ct.invalid_type,expected:Tt.function,received:n.parsedType}),nn;function r(l,c){return Rh({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Oh(),Rc].filter(d=>!!d),issueData:{code:ct.invalid_arguments,argumentsError:c}})}function s(l,c){return Rh({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Oh(),Rc].filter(d=>!!d),issueData:{code:ct.invalid_return_type,returnTypeError:c}})}const i={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof Bc){const l=this;return Ss(async function(...c){const d=new Ys([]),f=await l._def.args.parseAsync(c,i).catch(v=>{throw d.addIssue(r(c,v)),d}),m=await Reflect.apply(o,this,f);return await l._def.returns._def.type.parseAsync(m,i).catch(v=>{throw d.addIssue(s(m,v)),d})})}else{const l=this;return Ss(function(...c){const d=l._def.args.safeParse(c,i);if(!d.success)throw new Ys([r(c,d.error)]);const f=Reflect.apply(o,this,d.data),m=l._def.returns.safeParse(f,i);if(!m.success)throw new Ys([s(f,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new _c({...this._def,args:da.create(e).rest(Ml.create())})}returns(e){return new _c({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new _c({args:e||da.create([]).rest(Ml.create()),returns:n||Ml.create(),typeName:Jt.ZodFunction,...dn(r)})}}class Ku extends fn{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Ku.create=(t,e)=>new Ku({getter:t,typeName:Jt.ZodLazy,...dn(e)});class Gu extends fn{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return _t(n,{received:n.data,code:ct.invalid_literal,expected:this._def.value}),nn}return{status:"valid",value:e.data}}get value(){return this._def.value}}Gu.create=(t,e)=>new Gu({value:t,typeName:Jt.ZodLiteral,...dn(e)});function Z5(t,e){return new Go({values:t,typeName:Jt.ZodEnum,...dn(e)})}class Go extends fn{constructor(){super(...arguments),vu.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return _t(n,{expected:jn.joinValues(r),received:n.parsedType,code:ct.invalid_type}),nn}if(Fh(this,vu)||H5(this,vu,new Set(this._def.values)),!Fh(this,vu).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return _t(n,{received:n.data,code:ct.invalid_enum_value,options:r}),nn}return Ss(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Go.create(e,{...this._def,...n})}exclude(e,n=this._def){return Go.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}vu=new WeakMap;Go.create=Z5;class Yu extends fn{constructor(){super(...arguments),yu.set(this,void 0)}_parse(e){const n=jn.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Tt.string&&r.parsedType!==Tt.number){const s=jn.objectValues(n);return _t(r,{expected:jn.joinValues(s),received:r.parsedType,code:ct.invalid_type}),nn}if(Fh(this,yu)||H5(this,yu,new Set(jn.getValidEnumValues(this._def.values))),!Fh(this,yu).has(e.data)){const s=jn.objectValues(n);return _t(r,{received:r.data,code:ct.invalid_enum_value,options:s}),nn}return Ss(e.data)}get enum(){return this._def.values}}yu=new WeakMap;Yu.create=(t,e)=>new Yu({values:t,typeName:Jt.ZodNativeEnum,...dn(e)});class Bc extends fn{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Tt.promise&&n.common.async===!1)return _t(n,{code:ct.invalid_type,expected:Tt.promise,received:n.parsedType}),nn;const r=n.parsedType===Tt.promise?n.data:Promise.resolve(n.data);return Ss(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Bc.create=(t,e)=>new Bc({type:t,typeName:Jt.ZodPromise,...dn(e)});class Ii extends fn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Jt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{_t(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return nn;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?nn:c.status==="dirty"||n.value==="dirty"?bc(c.value):c});{if(n.value==="aborted")return nn;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?nn:l.status==="dirty"||n.value==="dirty"?bc(l.value):l}}if(s.type==="refinement"){const o=l=>{const c=s.refinement(l,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?nn:(l.status==="dirty"&&n.dirty(),o(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?nn:(l.status==="dirty"&&n.dirty(),o(l.value).then(()=>({status:n.value,value:l.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Bu(o))return o;const l=s.transform(o.value,i);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Bu(o)?Promise.resolve(s.transform(o.value,i)).then(l=>({status:n.value,value:l})):o);jn.assertNever(s)}}Ii.create=(t,e,n)=>new Ii({schema:t,typeName:Jt.ZodEffects,effect:e,...dn(n)});Ii.createWithPreprocess=(t,e,n)=>new Ii({schema:e,effect:{type:"preprocess",transform:t},typeName:Jt.ZodEffects,...dn(n)});class sa extends fn{_parse(e){return this._getType(e)===Tt.undefined?Ss(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}sa.create=(t,e)=>new sa({innerType:t,typeName:Jt.ZodOptional,...dn(e)});class Yo extends fn{_parse(e){return this._getType(e)===Tt.null?Ss(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Yo.create=(t,e)=>new Yo({innerType:t,typeName:Jt.ZodNullable,...dn(e)});class Zu extends fn{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===Tt.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Zu.create=(t,e)=>new Zu({innerType:t,typeName:Jt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...dn(e)});class Xu extends fn{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Vu(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ys(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ys(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Xu.create=(t,e)=>new Xu({innerType:t,typeName:Jt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...dn(e)});class Uh extends fn{_parse(e){if(this._getType(e)!==Tt.nan){const r=this._getOrReturnCtx(e);return _t(r,{code:ct.invalid_type,expected:Tt.nan,received:r.parsedType}),nn}return{status:"valid",value:e.data}}}Uh.create=t=>new Uh({typeName:Jt.ZodNaN,...dn(t)});const CT=Symbol("zod_brand");class p0 extends fn{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class ud extends fn{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?nn:i.status==="dirty"?(n.dirty(),bc(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?nn:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new ud({in:e,out:n,typeName:Jt.ZodPipeline})}}class Ju extends fn{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Bu(s)&&(s.value=Object.freeze(s.value)),s);return Vu(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Ju.create=(t,e)=>new Ju({innerType:t,typeName:Jt.ZodReadonly,...dn(e)});function X5(t,e={},n){return t?Fc.create().superRefine((r,s)=>{var i,o;if(!t(r)){const l=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,c=(o=(i=l.fatal)!==null&&i!==void 0?i:n)!==null&&o!==void 0?o:!0,d=typeof l=="string"?{message:l}:l;s.addIssue({code:"custom",...d,fatal:c})}}):Fc.create()}const TT={object:ur.lazycreate};var Jt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Jt||(Jt={}));const LT=(t,e={message:`Input not instance of ${t.name}`})=>X5(n=>n instanceof t,e),J5=Ti.create,Q5=Ho.create,DT=Uh.create,IT=Ko.create,ew=qu.create,MT=Fl.create,ET=Bh.create,OT=Uu.create,RT=zu.create,FT=Fc.create,BT=Ml.create,VT=ro.create,qT=Vh.create,UT=Di.create,zT=ur.create,WT=ur.strictCreate,$T=Wu.create,HT=gf.create,KT=$u.create,GT=da.create,YT=Hu.create,ZT=qh.create,XT=Bl.create,JT=_c.create,QT=Ku.create,eL=Gu.create,tL=Go.create,nL=Yu.create,rL=Bc.create,jy=Ii.create,sL=sa.create,iL=Yo.create,aL=Ii.createWithPreprocess,oL=ud.create,lL=()=>J5().optional(),cL=()=>Q5().optional(),uL=()=>ew().optional(),dL={string:t=>Ti.create({...t,coerce:!0}),number:t=>Ho.create({...t,coerce:!0}),boolean:t=>qu.create({...t,coerce:!0}),bigint:t=>Ko.create({...t,coerce:!0}),date:t=>Fl.create({...t,coerce:!0})},hL=nn;var dr=Object.freeze({__proto__:null,defaultErrorMap:Rc,setErrorMap:hT,getErrorMap:Oh,makeIssue:Rh,EMPTY_PATH:fT,addIssueToContext:_t,ParseStatus:xs,INVALID:nn,DIRTY:bc,OK:Ss,isAborted:jm,isDirty:Sm,isValid:Bu,isAsync:Vu,get util(){return jn},get objectUtil(){return Nm},ZodParsedType:Tt,getParsedType:Eo,ZodType:fn,datetimeRegex:Y5,ZodString:Ti,ZodNumber:Ho,ZodBigInt:Ko,ZodBoolean:qu,ZodDate:Fl,ZodSymbol:Bh,ZodUndefined:Uu,ZodNull:zu,ZodAny:Fc,ZodUnknown:Ml,ZodNever:ro,ZodVoid:Vh,ZodArray:Di,ZodObject:ur,ZodUnion:Wu,ZodDiscriminatedUnion:gf,ZodIntersection:$u,ZodTuple:da,ZodRecord:Hu,ZodMap:qh,ZodSet:Bl,ZodFunction:_c,ZodLazy:Ku,ZodLiteral:Gu,ZodEnum:Go,ZodNativeEnum:Yu,ZodPromise:Bc,ZodEffects:Ii,ZodTransformer:Ii,ZodOptional:sa,ZodNullable:Yo,ZodDefault:Zu,ZodCatch:Xu,ZodNaN:Uh,BRAND:CT,ZodBranded:p0,ZodPipeline:ud,ZodReadonly:Ju,custom:X5,Schema:fn,ZodSchema:fn,late:TT,get ZodFirstPartyTypeKind(){return Jt},coerce:dL,any:FT,array:UT,bigint:IT,boolean:ew,date:MT,discriminatedUnion:HT,effect:jy,enum:tL,function:JT,instanceof:LT,intersection:KT,lazy:QT,literal:eL,map:ZT,nan:DT,nativeEnum:nL,never:VT,null:RT,nullable:iL,number:Q5,object:zT,oboolean:uL,onumber:cL,optional:sL,ostring:lL,pipeline:oL,preprocess:aL,promise:rL,record:YT,set:XT,strictObject:WT,string:J5,symbol:ET,transformer:jy,tuple:GT,undefined:OT,union:$T,unknown:BT,void:qT,NEVER:hL,ZodIssueCode:ct,quotelessJson:dT,ZodError:Ys});const fL=dr.object({name:dr.string().min(2,"Name must be at least 2 characters"),email:dr.string().email("Invalid email address"),password:dr.string().min(8,"Password must be at least 8 characters"),confirmPassword:dr.string()}).refine(t=>t.password===t.confirmPassword,{message:"Passwords don't match",path:["confirmPassword"]});function pL(){const[t,e]=I.useState(!1),[n,r]=I.useState(!1),{signUp:s,getPasswordStrength:i}=Ir(),{register:o,handleSubmit:l,watch:c,formState:{errors:d},setError:f}=pf({resolver:mf(fL)}),m=c("password"),g=m?i(m):null,v=()=>{if(!g)return 0;switch(g){case"weak":return 25;case"medium":return 60;case"strong":return 100;default:return 0}},N=async j=>{r(!0);try{const P=await s(j.email,j.name,j.password);P.success||f("email",{message:P.error||"Failed to create account"})}catch(P){console.error("Auth error:",P),f("email",{message:"An unexpected error occurred"})}finally{r(!1)}};return a.jsx(nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-md mx-auto",children:a.jsxs(mt,{className:"shadow-2xl border-0 bg-card/95 backdrop-blur-lg",children:[a.jsxs($t,{className:"text-center space-y-4",children:[a.jsx(nt.div,{initial:{scale:.8},animate:{scale:1},className:"mx-auto w-16 h-16 bg-primary rounded-2xl flex items-center justify-center",children:a.jsx(xr,{className:"w-8 h-8 text-primary-foreground"})}),a.jsxs("div",{children:[a.jsx(Ht,{className:"text-2xl font-bold",children:"Create Account"}),a.jsx(cn,{children:"Start your progress tracking journey"})]})]}),a.jsx(gt,{children:a.jsxs("form",{onSubmit:l(N),className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{htmlFor:"name",children:"Full Name"}),a.jsxs("div",{className:"relative",children:[a.jsx(Hc,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx($n,{id:"name",type:"text",placeholder:"Enter your full name",className:"pl-10",...o("name")})]}),d.name&&a.jsx("p",{className:"text-sm text-destructive",children:d.name.message})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{htmlFor:"email",children:"Email"}),a.jsxs("div",{className:"relative",children:[a.jsx(h_,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx($n,{id:"email",type:"email",placeholder:"Enter your email",className:"pl-10",...o("email")})]}),d.email&&a.jsx("p",{className:"text-sm text-destructive",children:d.email.message})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{htmlFor:"password",children:"Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Uo,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx($n,{id:"password",type:t?"text":"password",placeholder:"Enter your password",className:"pl-10 pr-10",...o("password")}),a.jsx(ht,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>e(!t),children:t?a.jsx(Ng,{className:"h-4 w-4 text-muted-foreground"}):a.jsx(sf,{className:"h-4 w-4 text-muted-foreground"})})]}),m&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:"Password strength"}),a.jsx("span",{className:"capitalize",children:g})]}),a.jsx(ld,{value:v(),className:"h-2"})]}),d.password&&a.jsx("p",{className:"text-sm text-destructive",children:d.password.message})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{htmlFor:"confirmPassword",children:"Confirm Password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Uo,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx($n,{id:"confirmPassword",type:t?"text":"password",placeholder:"Confirm your password",className:"pl-10",...o("confirmPassword")})]}),d.confirmPassword&&a.jsx("p",{className:"text-sm text-destructive",children:d.confirmPassword.message})]}),a.jsx(ht,{type:"submit",className:"w-full h-11",disabled:n,children:n?a.jsx(nt.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full"}):"Create Account"})]})})]})})}function mL({children:t}){return a.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-primary/5 via-background to-secondary/5 flex items-center justify-center p-4",children:[a.jsx("div",{className:"absolute inset-0 opacity-30",children:a.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, rgba(255,255,255,0.15) 1px, transparent 0)",backgroundSize:"20px 20px"}})}),a.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[a.jsx(nt.div,{animate:{y:[0,-20,0],rotate:[0,5,0]},transition:{duration:6,repeat:1/0,ease:"easeInOut"},className:"absolute top-1/4 left-1/4 w-32 h-32 bg-primary/10 rounded-full blur-xl"}),a.jsx(nt.div,{animate:{y:[0,20,0],rotate:[0,-5,0]},transition:{duration:8,repeat:1/0,ease:"easeInOut",delay:1},className:"absolute bottom-1/4 right-1/4 w-24 h-24 bg-secondary/10 rounded-full blur-xl"})]}),a.jsx(nt.div,{initial:{opacity:0,scale:.8,y:50},animate:{opacity:1,scale:1,y:0},transition:{duration:.8,ease:"easeOut"},className:"absolute top-1/4 right-8 hidden lg:block",children:a.jsx("div",{className:"w-80 h-80 rounded-2xl bg-gradient-to-br from-primary/20 to-secondary/20 backdrop-blur-sm flex items-center justify-center overflow-hidden",children:a.jsx("iframe",{src:"https://lottie.host/embed/4b6f22e4-9c94-4e6d-a0c7-8c5e8b2f1a3d/QjZmN8K9vL.json",style:{width:"100%",height:"100%",border:"none",transform:"scale(1.2)"},title:"3D Character Animation"})})}),a.jsx("div",{className:"relative z-10 w-full max-w-md",children:t})]})}function gL(){return a.jsx(mL,{children:a.jsx(pL,{})})}const io=yg((t,e)=>({goals:[],recentProgress:[],analytics:null,isLoading:!1,loadGoals:async n=>{t({isLoading:!0});try{const r=await Ln.getGoalsByUser(n);t({goals:r})}catch(r){console.error("Failed to load goals:",r),St.error("Failed to load goals")}finally{t({isLoading:!1})}},createGoal:async n=>{try{const r={...n,currentValue:0},s=await Ln.createGoal(r),i=await Ln.goals.get(s);i&&(t(o=>({goals:[...o.goals,i]})),St.success("Goal created successfully!"))}catch(r){console.error("Failed to create goal:",r),St.error("Failed to create goal")}},updateGoal:async(n,r)=>{try{const s=e().goals.find(o=>o.id===n);await Ln.updateGoal(n,r);const i=await Ln.goals.get(n);if(i){if(t(o=>({goals:o.goals.map(l=>l.id===n?i:l)})),s&&s.status!=="completed"&&r.status==="completed"){const{notificationService:o}=await eo(async()=>{const{notificationService:l}=await Promise.resolve().then(()=>Xp);return{notificationService:l}},void 0);await o.sendGoalCompletedNotification(i.userId,i.title)}St.success("Goal updated successfully!")}}catch(s){console.error("Failed to update goal:",s),St.error("Failed to update goal")}},deleteGoal:async n=>{try{await Ln.deleteGoal(n),t(r=>({goals:r.goals.filter(s=>s.id!==n)})),St.success("Goal deleted successfully!")}catch(r){console.error("Failed to delete goal:",r),St.error("Failed to delete goal")}},addProgress:async n=>{try{await Ln.addProgress(n);const{notificationService:r}=await eo(async()=>{const{notificationService:c}=await Promise.resolve().then(()=>Xp);return{notificationService:c}},void 0),s=e().goals.find(c=>c.id===n.goalId);s&&(await r.showProgressCelebration(s.title,n.value),s.targetValue&&s.currentValue+n.value>=s.targetValue&&await r.showGoalCompleted(s.title));const{loadGoals:i,loadRecentProgress:o,loadAnalytics:l}=e();await Promise.all([i(n.userId),o(n.userId),l(n.userId)]),St.success("Progress updated!")}catch(r){console.error("Failed to add progress:",r),St.error("Failed to update progress")}},loadRecentProgress:async n=>{try{const r=await Ln.getRecentProgress(n,20);t({recentProgress:r})}catch(r){console.error("Failed to load recent progress:",r)}},loadAnalytics:async n=>{try{const r=await Ln.getAnalytics(n);t({analytics:r})}catch(r){console.error("Failed to load analytics:",r)}},syncData:async n=>{const{loadGoals:r,loadRecentProgress:s,loadAnalytics:i}=e();try{await Promise.all([r(n),s(n),i(n)])}catch(o){console.error("Failed to sync data:",o)}}})),vf=I.forwardRef(({className:t,...e},n)=>a.jsx("textarea",{className:vt("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));vf.displayName="Textarea";function Sy(t,[e,n]){return Math.min(n,Math.max(e,t))}function tw(t){const e=I.useRef({value:t,previous:t});return I.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var vL="VisuallyHidden",nw=I.forwardRef((t,e)=>a.jsx(sr.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));nw.displayName=vL;var yL=[" ","Enter","ArrowUp","ArrowDown"],xL=[" ","Enter"],dd="Select",[yf,xf,bL]=aj(dd),[Yc,hO]=ed(dd,[bL,Gh]),bf=Gh(),[wL,el]=Yc(dd),[NL,jL]=Yc(dd),rw=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:d,name:f,autoComplete:m,disabled:g,required:v,form:N}=t,j=bf(e),[P,k]=I.useState(null),[_,M]=I.useState(null),[$,Y]=I.useState(!1),U=oj(d),[te=!1,W]=fh({prop:r,defaultProp:s,onChange:i}),[ge,oe]=fh({prop:o,defaultProp:l,onChange:c}),B=I.useRef(null),T=P?N||!!P.closest("form"):!0,[J,Z]=I.useState(new Set),Ne=Array.from(J).map(he=>he.props.value).join(";");return a.jsx(T2,{...j,children:a.jsxs(wL,{required:v,scope:e,trigger:P,onTriggerChange:k,valueNode:_,onValueNodeChange:M,valueNodeHasChildren:$,onValueNodeHasChildrenChange:Y,contentId:Yh(),value:ge,onValueChange:oe,open:te,onOpenChange:W,dir:U,triggerPointerDownPosRef:B,disabled:g,children:[a.jsx(yf.Provider,{scope:e,children:a.jsx(NL,{scope:t.__scopeSelect,onNativeOptionAdd:I.useCallback(he=>{Z(ae=>new Set(ae).add(he))},[]),onNativeOptionRemove:I.useCallback(he=>{Z(ae=>{const G=new Set(ae);return G.delete(he),G})},[]),children:n})}),T?a.jsxs(Pw,{"aria-hidden":!0,required:v,tabIndex:-1,name:f,autoComplete:m,value:ge,onChange:he=>oe(he.target.value),disabled:g,form:N,children:[ge===void 0?a.jsx("option",{value:""}):null,Array.from(J)]},Ne):null]})})};rw.displayName=dd;var sw="SelectTrigger",iw=I.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...s}=t,i=bf(n),o=el(sw,n),l=o.disabled||r,c=ks(e,o.onTriggerChange),d=xf(n),f=I.useRef("touch"),[m,g,v]=Cw(j=>{const P=d().filter(M=>!M.disabled),k=P.find(M=>M.value===o.value),_=Tw(P,j,k);_!==void 0&&o.onValueChange(_.value)}),N=j=>{l||(o.onOpenChange(!0),v()),j&&(o.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return a.jsx(Gm,{asChild:!0,...i,children:a.jsx(sr.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Aw(o.value)?"":void 0,...s,ref:c,onClick:rr(s.onClick,j=>{j.currentTarget.focus(),f.current!=="mouse"&&N(j)}),onPointerDown:rr(s.onPointerDown,j=>{f.current=j.pointerType;const P=j.target;P.hasPointerCapture(j.pointerId)&&P.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(N(j),j.preventDefault())}),onKeyDown:rr(s.onKeyDown,j=>{const P=m.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&g(j.key),!(P&&j.key===" ")&&yL.includes(j.key)&&(N(),j.preventDefault())})})})});iw.displayName=sw;var aw="SelectValue",ow=I.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...l}=t,c=el(aw,n),{onValueNodeHasChildrenChange:d}=c,f=i!==void 0,m=ks(e,c.onValueNodeChange);return la(()=>{d(f)},[d,f]),a.jsx(sr.span,{...l,ref:m,style:{pointerEvents:"none"},children:Aw(c.value)?a.jsx(a.Fragment,{children:o}):i})});ow.displayName=aw;var SL="SelectIcon",lw=I.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...s}=t;return a.jsx(sr.span,{"aria-hidden":!0,...s,ref:e,children:r||"▼"})});lw.displayName=SL;var kL="SelectPortal",cw=t=>a.jsx(C2,{asChild:!0,...t});cw.displayName=kL;var Vl="SelectContent",uw=I.forwardRef((t,e)=>{const n=el(Vl,t.__scopeSelect),[r,s]=I.useState();if(la(()=>{s(new DocumentFragment)},[]),!n.open){const i=r;return i?eg.createPortal(a.jsx(dw,{scope:t.__scopeSelect,children:a.jsx(yf.Slot,{scope:t.__scopeSelect,children:a.jsx("div",{children:t.children})})}),i):null}return a.jsx(hw,{...t,ref:e})});uw.displayName=Vl;var ki=10,[dw,tl]=Yc(Vl),_L="SelectContentImpl",hw=I.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:v,sticky:N,hideWhenDetached:j,avoidCollisions:P,...k}=t,_=el(Vl,n),[M,$]=I.useState(null),[Y,U]=I.useState(null),te=ks(e,ve=>$(ve)),[W,ge]=I.useState(null),[oe,B]=I.useState(null),T=xf(n),[J,Z]=I.useState(!1),Ne=I.useRef(!1);I.useEffect(()=>{if(M)return N2(M)},[M]),j2();const he=I.useCallback(ve=>{const[Pe,...ce]=T().map(Ue=>Ue.ref.current),[Ye]=ce.slice(-1),Ke=document.activeElement;for(const Ue of ve)if(Ue===Ke||(Ue==null||Ue.scrollIntoView({block:"nearest"}),Ue===Pe&&Y&&(Y.scrollTop=0),Ue===Ye&&Y&&(Y.scrollTop=Y.scrollHeight),Ue==null||Ue.focus(),document.activeElement!==Ke))return},[T,Y]),ae=I.useCallback(()=>he([W,M]),[he,W,M]);I.useEffect(()=>{J&&ae()},[J,ae]);const{onOpenChange:G,triggerPointerDownPosRef:xe}=_;I.useEffect(()=>{if(M){let ve={x:0,y:0};const Pe=Ye=>{var Ke,Ue;ve={x:Math.abs(Math.round(Ye.pageX)-(((Ke=xe.current)==null?void 0:Ke.x)??0)),y:Math.abs(Math.round(Ye.pageY)-(((Ue=xe.current)==null?void 0:Ue.y)??0))}},ce=Ye=>{ve.x<=10&&ve.y<=10?Ye.preventDefault():M.contains(Ye.target)||G(!1),document.removeEventListener("pointermove",Pe),xe.current=null};return xe.current!==null&&(document.addEventListener("pointermove",Pe),document.addEventListener("pointerup",ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Pe),document.removeEventListener("pointerup",ce,{capture:!0})}}},[M,G,xe]),I.useEffect(()=>{const ve=()=>G(!1);return window.addEventListener("blur",ve),window.addEventListener("resize",ve),()=>{window.removeEventListener("blur",ve),window.removeEventListener("resize",ve)}},[G]);const[De,$e]=Cw(ve=>{const Pe=T().filter(Ke=>!Ke.disabled),ce=Pe.find(Ke=>Ke.ref.current===document.activeElement),Ye=Tw(Pe,ve,ce);Ye&&setTimeout(()=>Ye.ref.current.focus())}),E=I.useCallback((ve,Pe,ce)=>{const Ye=!Ne.current&&!ce;(_.value!==void 0&&_.value===Pe||Ye)&&(ge(ve),Ye&&(Ne.current=!0))},[_.value]),z=I.useCallback(()=>M==null?void 0:M.focus(),[M]),ee=I.useCallback((ve,Pe,ce)=>{const Ye=!Ne.current&&!ce;(_.value!==void 0&&_.value===Pe||Ye)&&B(ve)},[_.value]),le=r==="popper"?_m:fw,ue=le===_m?{side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:v,sticky:N,hideWhenDetached:j,avoidCollisions:P}:{};return a.jsx(dw,{scope:n,content:M,viewport:Y,onViewportChange:U,itemRefCallback:E,selectedItem:W,onItemLeave:z,itemTextRefCallback:ee,focusSelectedItem:ae,selectedItemText:oe,position:r,isPositioned:J,searchRef:De,children:a.jsx(S2,{as:Kh,allowPinchZoom:!0,children:a.jsx(k2,{asChild:!0,trapped:_.open,onMountAutoFocus:ve=>{ve.preventDefault()},onUnmountAutoFocus:rr(s,ve=>{var Pe;(Pe=_.trigger)==null||Pe.focus({preventScroll:!0}),ve.preventDefault()}),children:a.jsx(_2,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:ve=>ve.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:a.jsx(le,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:ve=>ve.preventDefault(),...k,...ue,onPlaced:()=>Z(!0),ref:te,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:rr(k.onKeyDown,ve=>{const Pe=ve.ctrlKey||ve.altKey||ve.metaKey;if(ve.key==="Tab"&&ve.preventDefault(),!Pe&&ve.key.length===1&&$e(ve.key),["ArrowUp","ArrowDown","Home","End"].includes(ve.key)){let Ye=T().filter(Ke=>!Ke.disabled).map(Ke=>Ke.ref.current);if(["ArrowUp","End"].includes(ve.key)&&(Ye=Ye.slice().reverse()),["ArrowUp","ArrowDown"].includes(ve.key)){const Ke=ve.target,Ue=Ye.indexOf(Ke);Ye=Ye.slice(Ue+1)}setTimeout(()=>he(Ye)),ve.preventDefault()}})})})})})})});hw.displayName=_L;var AL="SelectItemAlignedPosition",fw=I.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...s}=t,i=el(Vl,n),o=tl(Vl,n),[l,c]=I.useState(null),[d,f]=I.useState(null),m=ks(e,te=>f(te)),g=xf(n),v=I.useRef(!1),N=I.useRef(!0),{viewport:j,selectedItem:P,selectedItemText:k,focusSelectedItem:_}=o,M=I.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&d&&j&&P&&k){const te=i.trigger.getBoundingClientRect(),W=d.getBoundingClientRect(),ge=i.valueNode.getBoundingClientRect(),oe=k.getBoundingClientRect();if(i.dir!=="rtl"){const Ke=oe.left-W.left,Ue=ge.left-Ke,it=te.left-Ue,It=te.width+it,qe=Math.max(It,W.width),re=window.innerWidth-ki,zt=Sy(Ue,[ki,Math.max(ki,re-qe)]);l.style.minWidth=It+"px",l.style.left=zt+"px"}else{const Ke=W.right-oe.right,Ue=window.innerWidth-ge.right-Ke,it=window.innerWidth-te.right-Ue,It=te.width+it,qe=Math.max(It,W.width),re=window.innerWidth-ki,zt=Sy(Ue,[ki,Math.max(ki,re-qe)]);l.style.minWidth=It+"px",l.style.right=zt+"px"}const B=g(),T=window.innerHeight-ki*2,J=j.scrollHeight,Z=window.getComputedStyle(d),Ne=parseInt(Z.borderTopWidth,10),he=parseInt(Z.paddingTop,10),ae=parseInt(Z.borderBottomWidth,10),G=parseInt(Z.paddingBottom,10),xe=Ne+he+J+G+ae,De=Math.min(P.offsetHeight*5,xe),$e=window.getComputedStyle(j),E=parseInt($e.paddingTop,10),z=parseInt($e.paddingBottom,10),ee=te.top+te.height/2-ki,le=T-ee,ue=P.offsetHeight/2,ve=P.offsetTop+ue,Pe=Ne+he+ve,ce=xe-Pe;if(Pe<=ee){const Ke=B.length>0&&P===B[B.length-1].ref.current;l.style.bottom="0px";const Ue=d.clientHeight-j.offsetTop-j.offsetHeight,it=Math.max(le,ue+(Ke?z:0)+Ue+ae),It=Pe+it;l.style.height=It+"px"}else{const Ke=B.length>0&&P===B[0].ref.current;l.style.top="0px";const it=Math.max(ee,Ne+j.offsetTop+(Ke?E:0)+ue)+ce;l.style.height=it+"px",j.scrollTop=Pe-ee+j.offsetTop}l.style.margin=`${ki}px 0`,l.style.minHeight=De+"px",l.style.maxHeight=T+"px",r==null||r(),requestAnimationFrame(()=>v.current=!0)}},[g,i.trigger,i.valueNode,l,d,j,P,k,i.dir,r]);la(()=>M(),[M]);const[$,Y]=I.useState();la(()=>{d&&Y(window.getComputedStyle(d).zIndex)},[d]);const U=I.useCallback(te=>{te&&N.current===!0&&(M(),_==null||_(),N.current=!1)},[M,_]);return a.jsx(CL,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:v,onScrollButtonChange:U,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:$},children:a.jsx(sr.div,{...s,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});fw.displayName=AL;var PL="SelectPopperPosition",_m=I.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=ki,...i}=t,o=bf(n);return a.jsx(A2,{...o,...i,ref:e,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});_m.displayName=PL;var[CL,m0]=Yc(Vl,{}),Am="SelectViewport",pw=I.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...s}=t,i=tl(Am,n),o=m0(Am,n),l=ks(e,i.onViewportChange),c=I.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(yf.Slot,{scope:n,children:a.jsx(sr.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:rr(s.onScroll,d=>{const f=d.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&m){const v=Math.abs(c.current-f.scrollTop);if(v>0){const N=window.innerHeight-ki*2,j=parseFloat(m.style.minHeight),P=parseFloat(m.style.height),k=Math.max(j,P);if(k<N){const _=k+v,M=Math.min(N,_),$=_-M;m.style.height=M+"px",m.style.bottom==="0px"&&(f.scrollTop=$>0?$:0,m.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});pw.displayName=Am;var mw="SelectGroup",[TL,LL]=Yc(mw),DL=I.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=Yh();return a.jsx(TL,{scope:n,id:s,children:a.jsx(sr.div,{role:"group","aria-labelledby":s,...r,ref:e})})});DL.displayName=mw;var gw="SelectLabel",vw=I.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=LL(gw,n);return a.jsx(sr.div,{id:s.id,...r,ref:e})});vw.displayName=gw;var zh="SelectItem",[IL,yw]=Yc(zh),xw=I.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=t,l=el(zh,n),c=tl(zh,n),d=l.value===r,[f,m]=I.useState(i??""),[g,v]=I.useState(!1),N=ks(e,_=>{var M;return(M=c.itemRefCallback)==null?void 0:M.call(c,_,r,s)}),j=Yh(),P=I.useRef("touch"),k=()=>{s||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(IL,{scope:n,value:r,disabled:s,textId:j,isSelected:d,onItemTextChange:I.useCallback(_=>{m(M=>M||((_==null?void 0:_.textContent)??"").trim())},[]),children:a.jsx(yf.ItemSlot,{scope:n,value:r,disabled:s,textValue:f,children:a.jsx(sr.div,{role:"option","aria-labelledby":j,"data-highlighted":g?"":void 0,"aria-selected":d&&g,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:N,onFocus:rr(o.onFocus,()=>v(!0)),onBlur:rr(o.onBlur,()=>v(!1)),onClick:rr(o.onClick,()=>{P.current!=="mouse"&&k()}),onPointerUp:rr(o.onPointerUp,()=>{P.current==="mouse"&&k()}),onPointerDown:rr(o.onPointerDown,_=>{P.current=_.pointerType}),onPointerMove:rr(o.onPointerMove,_=>{var M;P.current=_.pointerType,s?(M=c.onItemLeave)==null||M.call(c):P.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:rr(o.onPointerLeave,_=>{var M;_.currentTarget===document.activeElement&&((M=c.onItemLeave)==null||M.call(c))}),onKeyDown:rr(o.onKeyDown,_=>{var $;(($=c.searchRef)==null?void 0:$.current)!==""&&_.key===" "||(xL.includes(_.key)&&k(),_.key===" "&&_.preventDefault())})})})})});xw.displayName=zh;var xu="SelectItemText",bw=I.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,...i}=t,o=el(xu,n),l=tl(xu,n),c=yw(xu,n),d=jL(xu,n),[f,m]=I.useState(null),g=ks(e,k=>m(k),c.onItemTextChange,k=>{var _;return(_=l.itemTextRefCallback)==null?void 0:_.call(l,k,c.value,c.disabled)}),v=f==null?void 0:f.textContent,N=I.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:v},c.value),[c.disabled,c.value,v]),{onNativeOptionAdd:j,onNativeOptionRemove:P}=d;return la(()=>(j(N),()=>P(N)),[j,P,N]),a.jsxs(a.Fragment,{children:[a.jsx(sr.span,{id:c.textId,...i,ref:g}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?eg.createPortal(i.children,o.valueNode):null]})});bw.displayName=xu;var ww="SelectItemIndicator",Nw=I.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return yw(ww,n).isSelected?a.jsx(sr.span,{"aria-hidden":!0,...r,ref:e}):null});Nw.displayName=ww;var Pm="SelectScrollUpButton",jw=I.forwardRef((t,e)=>{const n=tl(Pm,t.__scopeSelect),r=m0(Pm,t.__scopeSelect),[s,i]=I.useState(!1),o=ks(e,r.onScrollButtonChange);return la(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollTop>0;i(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(kw,{...t,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});jw.displayName=Pm;var Cm="SelectScrollDownButton",Sw=I.forwardRef((t,e)=>{const n=tl(Cm,t.__scopeSelect),r=m0(Cm,t.__scopeSelect),[s,i]=I.useState(!1),o=ks(e,r.onScrollButtonChange);return la(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;i(f)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(kw,{...t,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Sw.displayName=Cm;var kw=I.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=t,i=tl("SelectScrollButton",n),o=I.useRef(null),l=xf(n),c=I.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return I.useEffect(()=>()=>c(),[c]),la(()=>{var f;const d=l().find(m=>m.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[l]),a.jsx(sr.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:rr(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:rr(s.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:rr(s.onPointerLeave,()=>{c()})})}),ML="SelectSeparator",_w=I.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return a.jsx(sr.div,{"aria-hidden":!0,...r,ref:e})});_w.displayName=ML;var Tm="SelectArrow",EL=I.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=bf(n),i=el(Tm,n),o=tl(Tm,n);return i.open&&o.position==="popper"?a.jsx(P2,{...s,...r,ref:e}):null});EL.displayName=Tm;function Aw(t){return t===""||t===void 0}var Pw=I.forwardRef((t,e)=>{const{value:n,...r}=t,s=I.useRef(null),i=ks(e,s),o=tw(n);return I.useEffect(()=>{const l=s.current,c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==n&&f){const m=new Event("change",{bubbles:!0});f.call(l,n),l.dispatchEvent(m)}},[o,n]),a.jsx(nw,{asChild:!0,children:a.jsx("select",{...r,ref:i,defaultValue:n})})});Pw.displayName="BubbleSelect";function Cw(t){const e=h2(t),n=I.useRef(""),r=I.useRef(0),s=I.useCallback(o=>{const l=n.current+o;e(l),function c(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[e]),i=I.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return I.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function Tw(t,e,n){const s=e.length>1&&Array.from(e).every(d=>d===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=OL(t,Math.max(i,0));s.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function OL(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var RL=rw,Lw=iw,FL=ow,BL=lw,VL=cw,Dw=uw,qL=pw,Iw=vw,Mw=xw,UL=bw,zL=Nw,Ew=jw,Ow=Sw,Rw=_w;const Ja=RL,Qa=FL,ia=I.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(Lw,{ref:r,className:vt("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,a.jsx(BL,{asChild:!0,children:a.jsx(a7,{className:"h-4 w-4 opacity-50"})})]}));ia.displayName=Lw.displayName;const Fw=I.forwardRef(({className:t,...e},n)=>a.jsx(Ew,{ref:n,className:vt("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(p7,{})}));Fw.displayName=Ew.displayName;const Bw=I.forwardRef(({className:t,...e},n)=>a.jsx(Ow,{ref:n,className:vt("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(c7,{})}));Bw.displayName=Ow.displayName;const aa=I.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>a.jsx(VL,{children:a.jsxs(Dw,{ref:s,className:vt("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[a.jsx(Fw,{}),a.jsx(qL,{className:vt("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(Bw,{})]})}));aa.displayName=Dw.displayName;const WL=I.forwardRef(({className:t,...e},n)=>a.jsx(Iw,{ref:n,className:vt("px-2 py-1.5 text-sm font-semibold",t),...e}));WL.displayName=Iw.displayName;const Rn=I.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(Mw,{ref:r,className:vt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(zL,{children:a.jsx(_5,{className:"h-4 w-4"})})}),a.jsx(UL,{children:e})]}));Rn.displayName=Mw.displayName;const $L=I.forwardRef(({className:t,...e},n)=>a.jsx(Rw,{ref:n,className:vt("-mx-1 my-1 h-px bg-muted",t),...e}));$L.displayName=Rw.displayName;const g0=D2,HL=I2,KL=L2,Vw=I.forwardRef(({className:t,...e},n)=>a.jsx(Ym,{ref:n,className:vt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));Vw.displayName=Ym.displayName;const wf=I.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(KL,{children:[a.jsx(Vw,{}),a.jsxs(Zm,{ref:r,className:vt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,a.jsxs(Xm,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(g7,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));wf.displayName=Zm.displayName;const Nf=({className:t,...e})=>a.jsx("div",{className:vt("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Nf.displayName="DialogHeader";const jf=I.forwardRef(({className:t,...e},n)=>a.jsx(Jm,{ref:n,className:vt("text-lg font-semibold leading-none tracking-tight",t),...e}));jf.displayName=Jm.displayName;const Sf=I.forwardRef(({className:t,...e},n)=>a.jsx(Qm,{ref:n,className:vt("text-sm text-muted-foreground",t),...e}));Sf.displayName=Qm.displayName;function Kt(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function Ms(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function ss(t,e){const n=Kt(t);return isNaN(e)?Ms(t,NaN):(e&&n.setDate(n.getDate()+e),n)}function Mi(t,e){const n=Kt(t);if(isNaN(e))return Ms(t,NaN);if(!e)return n;const r=n.getDate(),s=Ms(t,n.getTime());s.setMonth(n.getMonth()+e+1,0);const i=s.getDate();return r>=i?s:(n.setFullYear(s.getFullYear(),s.getMonth(),r),n)}const v0=6048e5,GL=864e5,qd=43200,ky=1440;let YL={};function Zc(){return YL}function ha(t,e){var l,c,d,f;const n=Zc(),r=(e==null?void 0:e.weekStartsOn)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((f=(d=n.locale)==null?void 0:d.options)==null?void 0:f.weekStartsOn)??0,s=Kt(t),i=s.getDay(),o=(i<r?7:0)+i-r;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function ql(t){return ha(t,{weekStartsOn:1})}function qw(t){const e=Kt(t),n=e.getFullYear(),r=Ms(t,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const s=ql(r),i=Ms(t,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const o=ql(i);return e.getTime()>=s.getTime()?n+1:e.getTime()>=o.getTime()?n:n-1}function Vc(t){const e=Kt(t);return e.setHours(0,0,0,0),e}function qc(t){const e=Kt(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Li(t,e){const n=Vc(t),r=Vc(e),s=+n-qc(n),i=+r-qc(r);return Math.round((s-i)/GL)}function ZL(t){const e=qw(t),n=Ms(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),ql(n)}function Lm(t,e){const n=e*7;return ss(t,n)}function XL(t,e){return Mi(t,e*12)}function JL(t){let e;return t.forEach(function(n){const r=Kt(n);(e===void 0||e<r||isNaN(Number(r)))&&(e=r)}),e||new Date(NaN)}function QL(t){let e;return t.forEach(n=>{const r=Kt(n);(!e||e>r||isNaN(+r))&&(e=r)}),e||new Date(NaN)}function Qd(t,e){const n=Kt(t),r=Kt(e),s=n.getTime()-r.getTime();return s<0?-1:s>0?1:s}function eD(t){return Ms(t,Date.now())}function js(t,e){const n=Vc(t),r=Vc(e);return+n==+r}function y0(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function tD(t){if(!y0(t)&&typeof t!="number")return!1;const e=Kt(t);return!isNaN(Number(e))}function Uc(t,e){const n=Kt(t),r=Kt(e),s=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return s*12+i}function nD(t,e,n){const r=ha(t,n),s=ha(e,n),i=+r-qc(r),o=+s-qc(s);return Math.round((i-o)/v0)}function rD(t,e){const n=Kt(t),r=Kt(e),s=_y(n,r),i=Math.abs(Li(n,r));n.setDate(n.getDate()-s*i);const o=+(_y(n,r)===-s),l=s*(i-o);return l===0?0:l}function _y(t,e){const n=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return n<0?-1:n>0?1:n}function sD(t){return e=>{const r=(t?Math[t]:Math.trunc)(e);return r===0?0:r}}function iD(t,e){return+Kt(t)-+Kt(e)}function aD(t){const e=Kt(t);return e.setHours(23,59,59,999),e}function kf(t){const e=Kt(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function oD(t){const e=Kt(t);return+aD(e)==+kf(e)}function lD(t,e){const n=Kt(t),r=Kt(e),s=Qd(n,r),i=Math.abs(Uc(n,r));let o;if(i<1)o=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-s*i);let l=Qd(n,r)===-s;oD(Kt(t))&&i===1&&Qd(t,r)===1&&(l=!1),o=s*(i-Number(l))}return o===0?0:o}function cD(t,e,n){const r=iD(t,e)/1e3;return sD(n==null?void 0:n.roundingMethod)(r)}function uD(t,e){const n=Kt(t.start),r=Kt(t.end);let s=+n>+r;const i=s?+n:+r,o=s?r:n;o.setHours(0,0,0,0);let l=1;const c=[];for(;+o<=i;)c.push(Kt(o)),o.setDate(o.getDate()+l),o.setHours(0,0,0,0);return s?c.reverse():c}function Is(t){const e=Kt(t);return e.setDate(1),e.setHours(0,0,0,0),e}function Uw(t){const e=Kt(t),n=Ms(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}function x0(t,e){var l,c,d,f;const n=Zc(),r=(e==null?void 0:e.weekStartsOn)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((f=(d=n.locale)==null?void 0:d.options)==null?void 0:f.weekStartsOn)??0,s=Kt(t),i=s.getDay(),o=(i<r?-7:0)+6-(i-r);return s.setDate(s.getDate()+o),s.setHours(23,59,59,999),s}function zw(t){return x0(t,{weekStartsOn:1})}const dD={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"}},hD=(t,e,n)=>{let r;const s=dD[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Np(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const fD={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},pD={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},mD={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},gD={date:Np({formats:fD,defaultWidth:"full"}),time:Np({formats:pD,defaultWidth:"full"}),dateTime:Np({formats:mD,defaultWidth:"full"})},vD={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},yD=(t,e,n,r)=>vD[t];function uu(t){return(e,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,l=n!=null&&n.width?String(n.width):o;s=t.formattingValues[l]||t.formattingValues[o]}else{const o=t.defaultWidth,l=n!=null&&n.width?String(n.width):t.defaultWidth;s=t.values[l]||t.values[o]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const xD={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},bD={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},wD={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"]},ND={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},jD={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"}},SD={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"}},kD=(t,e)=>{const n=Number(t),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"},_D={ordinalNumber:kD,era:uu({values:xD,defaultWidth:"wide"}),quarter:uu({values:bD,defaultWidth:"wide",argumentCallback:t=>t-1}),month:uu({values:wD,defaultWidth:"wide"}),day:uu({values:ND,defaultWidth:"wide"}),dayPeriod:uu({values:jD,defaultWidth:"wide",formattingValues:SD,defaultFormattingWidth:"wide"})};function du(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const o=i[0],l=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(l)?PD(l,m=>m.test(o)):AD(l,m=>m.test(o));let d;d=t.valueCallback?t.valueCallback(c):c,d=n.valueCallback?n.valueCallback(d):d;const f=e.slice(o.length);return{value:d,rest:f}}}function AD(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function PD(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function CD(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let o=t.valueCallback?t.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const l=e.slice(s.length);return{value:o,rest:l}}}const TD=/^(\d+)(th|st|nd|rd)?/i,LD=/\d+/i,DD={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},ID={any:[/^b/i,/^(a|c)/i]},MD={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ED={any:[/1/i,/2/i,/3/i,/4/i]},OD={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},RD={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]},FD={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},BD={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]},VD={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},qD={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}},UD={ordinalNumber:CD({matchPattern:TD,parsePattern:LD,valueCallback:t=>parseInt(t,10)}),era:du({matchPatterns:DD,defaultMatchWidth:"wide",parsePatterns:ID,defaultParseWidth:"any"}),quarter:du({matchPatterns:MD,defaultMatchWidth:"wide",parsePatterns:ED,defaultParseWidth:"any",valueCallback:t=>t+1}),month:du({matchPatterns:OD,defaultMatchWidth:"wide",parsePatterns:RD,defaultParseWidth:"any"}),day:du({matchPatterns:FD,defaultMatchWidth:"wide",parsePatterns:BD,defaultParseWidth:"any"}),dayPeriod:du({matchPatterns:VD,defaultMatchWidth:"any",parsePatterns:qD,defaultParseWidth:"any"})},b0={code:"en-US",formatDistance:hD,formatLong:gD,formatRelative:yD,localize:_D,match:UD,options:{weekStartsOn:0,firstWeekContainsDate:1}};function zD(t){const e=Kt(t);return Li(e,Uw(e))+1}function Ww(t){const e=Kt(t),n=+ql(e)-+ZL(e);return Math.round(n/v0)+1}function $w(t,e){var f,m,g,v;const n=Kt(t),r=n.getFullYear(),s=Zc(),i=(e==null?void 0:e.firstWeekContainsDate)??((m=(f=e==null?void 0:e.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??s.firstWeekContainsDate??((v=(g=s.locale)==null?void 0:g.options)==null?void 0:v.firstWeekContainsDate)??1,o=Ms(t,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const l=ha(o,e),c=Ms(t,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const d=ha(c,e);return n.getTime()>=l.getTime()?r+1:n.getTime()>=d.getTime()?r:r-1}function WD(t,e){var l,c,d,f;const n=Zc(),r=(e==null?void 0:e.firstWeekContainsDate)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((f=(d=n.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??1,s=$w(t,e),i=Ms(t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),ha(i,e)}function Hw(t,e){const n=Kt(t),r=+ha(n,e)-+WD(n,e);return Math.round(r/v0)+1}function On(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Ao={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return On(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):On(n+1,2)},d(t,e){return On(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){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(t,e){return On(t.getHours()%12||12,e.length)},H(t,e){return On(t.getHours(),e.length)},m(t,e){return On(t.getMinutes(),e.length)},s(t,e){return On(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return On(s,e.length)}},ac={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ay={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){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(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return Ao.y(t,e)},Y:function(t,e,n,r){const s=$w(t,r),i=s>0?s:1-s;if(e==="YY"){const o=i%100;return On(o,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):On(i,e.length)},R:function(t,e){const n=qw(t);return On(n,e.length)},u:function(t,e){const n=t.getFullYear();return On(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return On(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(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return On(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(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return Ao.M(t,e);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(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return On(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(t,e,n,r){const s=Hw(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):On(s,e.length)},I:function(t,e,n){const r=Ww(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):On(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Ao.d(t,e)},D:function(t,e,n){const r=zD(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):On(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){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(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return On(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return On(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return On(s,e.length);case"io":return n.ordinalNumber(s,{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(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=ac.noon:r===0?s=ac.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=ac.evening:r>=12?s=ac.afternoon:r>=4?s=ac.morning:s=ac.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Ao.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Ao.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):On(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):On(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Ao.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Ao.s(t,e)},S:function(t,e){return Ao.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return Cy(r);case"XXXX":case"XX":return Nl(r);case"XXXXX":case"XXX":default:return Nl(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return Cy(r);case"xxxx":case"xx":return Nl(r);case"xxxxx":case"xxx":default:return Nl(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Py(r,":");case"OOOO":default:return"GMT"+Nl(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Py(r,":");case"zzzz":default:return"GMT"+Nl(r,":")}},t:function(t,e,n){const r=Math.trunc(t.getTime()/1e3);return On(r,e.length)},T:function(t,e,n){const r=t.getTime();return On(r,e.length)}};function Py(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+e+On(i,2)}function Cy(t,e){return t%60===0?(t>0?"-":"+")+On(Math.abs(t)/60,2):Nl(t,e)}function Nl(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=On(Math.trunc(r/60),2),i=On(r%60,2);return n+s+e+i}const Ty=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},Kw=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},$D=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return Ty(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",Ty(r,e)).replace("{{time}}",Kw(s,e))},HD={p:Kw,P:$D},KD=/^D+$/,GD=/^Y+$/,YD=["D","DD","YY","YYYY"];function ZD(t){return KD.test(t)}function XD(t){return GD.test(t)}function JD(t,e,n){const r=QD(t,e,n);if(console.warn(r),YD.includes(t))throw new RangeError(r)}function QD(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const eI=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,tI=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,nI=/^'([^]*?)'?$/,rI=/''/g,sI=/[a-zA-Z]/;function Kn(t,e,n){var f,m,g,v,N,j,P,k;const r=Zc(),s=(n==null?void 0:n.locale)??r.locale??b0,i=(n==null?void 0:n.firstWeekContainsDate)??((m=(f=n==null?void 0:n.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??r.firstWeekContainsDate??((v=(g=r.locale)==null?void 0:g.options)==null?void 0:v.firstWeekContainsDate)??1,o=(n==null?void 0:n.weekStartsOn)??((j=(N=n==null?void 0:n.locale)==null?void 0:N.options)==null?void 0:j.weekStartsOn)??r.weekStartsOn??((k=(P=r.locale)==null?void 0:P.options)==null?void 0:k.weekStartsOn)??0,l=Kt(t);if(!tD(l))throw new RangeError("Invalid time value");let c=e.match(tI).map(_=>{const M=_[0];if(M==="p"||M==="P"){const $=HD[M];return $(_,s.formatLong)}return _}).join("").match(eI).map(_=>{if(_==="''")return{isToken:!1,value:"'"};const M=_[0];if(M==="'")return{isToken:!1,value:iI(_)};if(Ay[M])return{isToken:!0,value:_};if(M.match(sI))throw new RangeError("Format string contains an unescaped latin alphabet character `"+M+"`");return{isToken:!1,value:_}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const d={firstWeekContainsDate:i,weekStartsOn:o,locale:s};return c.map(_=>{if(!_.isToken)return _.value;const M=_.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&XD(M)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&ZD(M))&&JD(M,e,String(t));const $=Ay[M[0]];return $(l,M,s.localize,d)}).join("")}function iI(t){const e=t.match(nI);return e?e[1].replace(rI,"'"):t}function aI(t,e,n){const r=Zc(),s=(n==null?void 0:n.locale)??r.locale??b0,i=2520,o=Qd(t,e);if(isNaN(o))throw new RangeError("Invalid time value");const l=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:o});let c,d;o>0?(c=Kt(e),d=Kt(t)):(c=Kt(t),d=Kt(e));const f=cD(d,c),m=(qc(d)-qc(c))/1e3,g=Math.round((f-m)/60);let v;if(g<2)return n!=null&&n.includeSeconds?f<5?s.formatDistance("lessThanXSeconds",5,l):f<10?s.formatDistance("lessThanXSeconds",10,l):f<20?s.formatDistance("lessThanXSeconds",20,l):f<40?s.formatDistance("halfAMinute",0,l):f<60?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",1,l):g===0?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",g,l);if(g<45)return s.formatDistance("xMinutes",g,l);if(g<90)return s.formatDistance("aboutXHours",1,l);if(g<ky){const N=Math.round(g/60);return s.formatDistance("aboutXHours",N,l)}else{if(g<i)return s.formatDistance("xDays",1,l);if(g<qd){const N=Math.round(g/ky);return s.formatDistance("xDays",N,l)}else if(g<qd*2)return v=Math.round(g/qd),s.formatDistance("aboutXMonths",v,l)}if(v=lD(d,c),v<12){const N=Math.round(g/qd);return s.formatDistance("xMonths",N,l)}else{const N=v%12,j=Math.trunc(v/12);return N<3?s.formatDistance("aboutXYears",j,l):N<9?s.formatDistance("overXYears",j,l):s.formatDistance("almostXYears",j+1,l)}}function Dm(t,e){return aI(t,eD(t),e)}function oI(t){const e=Kt(t),n=e.getFullYear(),r=e.getMonth(),s=Ms(t,0);return s.setFullYear(n,r+1,0),s.setHours(0,0,0,0),s.getDate()}function lI(t){return Math.trunc(+Kt(t)/1e3)}function cI(t){const e=Kt(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(0,0,0,0),e}function uI(t,e){return nD(cI(t),Is(t),e)+1}function Im(t,e){const n=Kt(t),r=Kt(e);return n.getTime()>r.getTime()}function Gw(t,e){const n=Kt(t),r=Kt(e);return+n<+r}function w0(t,e){const n=Kt(t),r=Kt(e);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function dI(t,e){const n=Kt(t),r=Kt(e);return n.getFullYear()===r.getFullYear()}function eh(t,e){return ss(t,-e)}function jp(t,e){const n=Kt(t),r=n.getFullYear(),s=n.getDate(),i=Ms(t,0);i.setFullYear(r,e,15),i.setHours(0,0,0,0);const o=oI(i);return n.setMonth(e,Math.min(s,o)),n}function Ly(t,e){const n=Kt(t);return isNaN(+n)?Ms(t,NaN):(n.setFullYear(e),n)}var tn=function(){return tn=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},tn.apply(this,arguments)};function hI(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function Yw(t,e,n){for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}function hd(t){return t.mode==="multiple"}function fd(t){return t.mode==="range"}function _f(t){return t.mode==="single"}var fI={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function pI(t,e){return Kn(t,"LLLL y",e)}function mI(t,e){return Kn(t,"d",e)}function gI(t,e){return Kn(t,"LLLL",e)}function vI(t){return"".concat(t)}function yI(t,e){return Kn(t,"cccccc",e)}function xI(t,e){return Kn(t,"yyyy",e)}var bI=Object.freeze({__proto__:null,formatCaption:pI,formatDay:mI,formatMonthCaption:gI,formatWeekNumber:vI,formatWeekdayName:yI,formatYearCaption:xI}),wI=function(t,e,n){return Kn(t,"do MMMM (EEEE)",n)},NI=function(){return"Month: "},jI=function(){return"Go to next month"},SI=function(){return"Go to previous month"},kI=function(t,e){return Kn(t,"cccc",e)},_I=function(t){return"Week n. ".concat(t)},AI=function(){return"Year: "},PI=Object.freeze({__proto__:null,labelDay:wI,labelMonthDropdown:NI,labelNext:jI,labelPrevious:SI,labelWeekNumber:_I,labelWeekday:kI,labelYearDropdown:AI});function CI(){var t="buttons",e=fI,n=b0,r={},s={},i=1,o={},l=new Date;return{captionLayout:t,classNames:e,formatters:bI,labels:PI,locale:n,modifiersClassNames:r,modifiers:s,numberOfMonths:i,styles:o,today:l,mode:"default"}}function TI(t){var e=t.fromYear,n=t.toYear,r=t.fromMonth,s=t.toMonth,i=t.fromDate,o=t.toDate;return r?i=Is(r):e&&(i=new Date(e,0,1)),s?o=kf(s):n&&(o=new Date(n,11,31)),{fromDate:i?Vc(i):void 0,toDate:o?Vc(o):void 0}}var Zw=I.createContext(void 0);function LI(t){var e,n=t.initialProps,r=CI(),s=TI(n),i=s.fromDate,o=s.toDate,l=(e=n.captionLayout)!==null&&e!==void 0?e:r.captionLayout;l!=="buttons"&&(!i||!o)&&(l="buttons");var c;(_f(n)||hd(n)||fd(n))&&(c=n.onSelect);var d=tn(tn(tn({},r),n),{captionLayout:l,classNames:tn(tn({},r.classNames),n.classNames),components:tn({},n.components),formatters:tn(tn({},r.formatters),n.formatters),fromDate:i,labels:tn(tn({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:tn(tn({},r.modifiers),n.modifiers),modifiersClassNames:tn(tn({},r.modifiersClassNames),n.modifiersClassNames),onSelect:c,styles:tn(tn({},r.styles),n.styles),toDate:o});return a.jsx(Zw.Provider,{value:d,children:t.children})}function Gn(){var t=I.useContext(Zw);if(!t)throw new Error("useDayPicker must be used within a DayPickerProvider.");return t}function Xw(t){var e=Gn(),n=e.locale,r=e.classNames,s=e.styles,i=e.formatters.formatCaption;return a.jsx("div",{className:r.caption_label,style:s.caption_label,"aria-live":"polite",role:"presentation",id:t.id,children:i(t.displayMonth,{locale:n})})}function DI(t){return a.jsx("svg",tn({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},t,{children:a.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 Jw(t){var e,n,r=t.onChange,s=t.value,i=t.children,o=t.caption,l=t.className,c=t.style,d=Gn(),f=(n=(e=d.components)===null||e===void 0?void 0:e.IconDropdown)!==null&&n!==void 0?n:DI;return a.jsxs("div",{className:l,style:c,children:[a.jsx("span",{className:d.classNames.vhidden,children:t["aria-label"]}),a.jsx("select",{name:t.name,"aria-label":t["aria-label"],className:d.classNames.dropdown,style:d.styles.dropdown,value:s,onChange:r,children:i}),a.jsxs("div",{className:d.classNames.caption_label,style:d.styles.caption_label,"aria-hidden":"true",children:[o,a.jsx(f,{className:d.classNames.dropdown_icon,style:d.styles.dropdown_icon})]})]})}function II(t){var e,n=Gn(),r=n.fromDate,s=n.toDate,i=n.styles,o=n.locale,l=n.formatters.formatMonthCaption,c=n.classNames,d=n.components,f=n.labels.labelMonthDropdown;if(!r)return a.jsx(a.Fragment,{});if(!s)return a.jsx(a.Fragment,{});var m=[];if(dI(r,s))for(var g=Is(r),v=r.getMonth();v<=s.getMonth();v++)m.push(jp(g,v));else for(var g=Is(new Date),v=0;v<=11;v++)m.push(jp(g,v));var N=function(P){var k=Number(P.target.value),_=jp(Is(t.displayMonth),k);t.onChange(_)},j=(e=d==null?void 0:d.Dropdown)!==null&&e!==void 0?e:Jw;return a.jsx(j,{name:"months","aria-label":f(),className:c.dropdown_month,style:i.dropdown_month,onChange:N,value:t.displayMonth.getMonth(),caption:l(t.displayMonth,{locale:o}),children:m.map(function(P){return a.jsx("option",{value:P.getMonth(),children:l(P,{locale:o})},P.getMonth())})})}function MI(t){var e,n=t.displayMonth,r=Gn(),s=r.fromDate,i=r.toDate,o=r.locale,l=r.styles,c=r.classNames,d=r.components,f=r.formatters.formatYearCaption,m=r.labels.labelYearDropdown,g=[];if(!s)return a.jsx(a.Fragment,{});if(!i)return a.jsx(a.Fragment,{});for(var v=s.getFullYear(),N=i.getFullYear(),j=v;j<=N;j++)g.push(Ly(Uw(new Date),j));var P=function(_){var M=Ly(Is(n),Number(_.target.value));t.onChange(M)},k=(e=d==null?void 0:d.Dropdown)!==null&&e!==void 0?e:Jw;return a.jsx(k,{name:"years","aria-label":m(),className:c.dropdown_year,style:l.dropdown_year,onChange:P,value:n.getFullYear(),caption:f(n,{locale:o}),children:g.map(function(_){return a.jsx("option",{value:_.getFullYear(),children:f(_,{locale:o})},_.getFullYear())})})}function EI(t,e){var n=I.useState(t),r=n[0],s=n[1],i=e===void 0?r:e;return[i,s]}function OI(t){var e=t.month,n=t.defaultMonth,r=t.today,s=e||n||r||new Date,i=t.toDate,o=t.fromDate,l=t.numberOfMonths,c=l===void 0?1:l;if(i&&Uc(i,s)<0){var d=-1*(c-1);s=Mi(i,d)}return o&&Uc(s,o)<0&&(s=o),Is(s)}function RI(){var t=Gn(),e=OI(t),n=EI(e,t.month),r=n[0],s=n[1],i=function(o){var l;if(!t.disableNavigation){var c=Is(o);s(c),(l=t.onMonthChange)===null||l===void 0||l.call(t,c)}};return[r,i]}function FI(t,e){for(var n=e.reverseMonths,r=e.numberOfMonths,s=Is(t),i=Is(Mi(s,r)),o=Uc(i,s),l=[],c=0;c<o;c++){var d=Mi(s,c);l.push(d)}return n&&(l=l.reverse()),l}function BI(t,e){if(!e.disableNavigation){var n=e.toDate,r=e.pagedNavigation,s=e.numberOfMonths,i=s===void 0?1:s,o=r?i:1,l=Is(t);if(!n)return Mi(l,o);var c=Uc(n,t);if(!(c<i))return Mi(l,o)}}function VI(t,e){if(!e.disableNavigation){var n=e.fromDate,r=e.pagedNavigation,s=e.numberOfMonths,i=s===void 0?1:s,o=r?i:1,l=Is(t);if(!n)return Mi(l,-o);var c=Uc(l,n);if(!(c<=0))return Mi(l,-o)}}var Qw=I.createContext(void 0);function qI(t){var e=Gn(),n=RI(),r=n[0],s=n[1],i=FI(r,e),o=BI(r,e),l=VI(r,e),c=function(m){return i.some(function(g){return w0(m,g)})},d=function(m,g){c(m)||(g&&Gw(m,g)?s(Mi(m,1+e.numberOfMonths*-1)):s(m))},f={currentMonth:r,displayMonths:i,goToMonth:s,goToDate:d,previousMonth:l,nextMonth:o,isDateDisplayed:c};return a.jsx(Qw.Provider,{value:f,children:t.children})}function pd(){var t=I.useContext(Qw);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t}function Dy(t){var e,n=Gn(),r=n.classNames,s=n.styles,i=n.components,o=pd().goToMonth,l=function(f){o(Mi(f,t.displayIndex?-t.displayIndex:0))},c=(e=i==null?void 0:i.CaptionLabel)!==null&&e!==void 0?e:Xw,d=a.jsx(c,{id:t.id,displayMonth:t.displayMonth});return a.jsxs("div",{className:r.caption_dropdowns,style:s.caption_dropdowns,children:[a.jsx("div",{className:r.vhidden,children:d}),a.jsx(II,{onChange:l,displayMonth:t.displayMonth}),a.jsx(MI,{onChange:l,displayMonth:t.displayMonth})]})}function UI(t){return a.jsx("svg",tn({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:a.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 zI(t){return a.jsx("svg",tn({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:a.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 Wh=I.forwardRef(function(t,e){var n=Gn(),r=n.classNames,s=n.styles,i=[r.button_reset,r.button];t.className&&i.push(t.className);var o=i.join(" "),l=tn(tn({},s.button_reset),s.button);return t.style&&Object.assign(l,t.style),a.jsx("button",tn({},t,{ref:e,type:"button",className:o,style:l}))});function WI(t){var e,n,r=Gn(),s=r.dir,i=r.locale,o=r.classNames,l=r.styles,c=r.labels,d=c.labelPrevious,f=c.labelNext,m=r.components;if(!t.nextMonth&&!t.previousMonth)return a.jsx(a.Fragment,{});var g=d(t.previousMonth,{locale:i}),v=[o.nav_button,o.nav_button_previous].join(" "),N=f(t.nextMonth,{locale:i}),j=[o.nav_button,o.nav_button_next].join(" "),P=(e=m==null?void 0:m.IconRight)!==null&&e!==void 0?e:zI,k=(n=m==null?void 0:m.IconLeft)!==null&&n!==void 0?n:UI;return a.jsxs("div",{className:o.nav,style:l.nav,children:[!t.hidePrevious&&a.jsx(Wh,{name:"previous-month","aria-label":g,className:v,style:l.nav_button_previous,disabled:!t.previousMonth,onClick:t.onPreviousClick,children:s==="rtl"?a.jsx(P,{className:o.nav_icon,style:l.nav_icon}):a.jsx(k,{className:o.nav_icon,style:l.nav_icon})}),!t.hideNext&&a.jsx(Wh,{name:"next-month","aria-label":N,className:j,style:l.nav_button_next,disabled:!t.nextMonth,onClick:t.onNextClick,children:s==="rtl"?a.jsx(k,{className:o.nav_icon,style:l.nav_icon}):a.jsx(P,{className:o.nav_icon,style:l.nav_icon})})]})}function Iy(t){var e=Gn().numberOfMonths,n=pd(),r=n.previousMonth,s=n.nextMonth,i=n.goToMonth,o=n.displayMonths,l=o.findIndex(function(N){return w0(t.displayMonth,N)}),c=l===0,d=l===o.length-1,f=e>1&&(c||!d),m=e>1&&(d||!c),g=function(){r&&i(r)},v=function(){s&&i(s)};return a.jsx(WI,{displayMonth:t.displayMonth,hideNext:f,hidePrevious:m,nextMonth:s,previousMonth:r,onPreviousClick:g,onNextClick:v})}function $I(t){var e,n=Gn(),r=n.classNames,s=n.disableNavigation,i=n.styles,o=n.captionLayout,l=n.components,c=(e=l==null?void 0:l.CaptionLabel)!==null&&e!==void 0?e:Xw,d;return s?d=a.jsx(c,{id:t.id,displayMonth:t.displayMonth}):o==="dropdown"?d=a.jsx(Dy,{displayMonth:t.displayMonth,id:t.id}):o==="dropdown-buttons"?d=a.jsxs(a.Fragment,{children:[a.jsx(Dy,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id}),a.jsx(Iy,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id})]}):d=a.jsxs(a.Fragment,{children:[a.jsx(c,{id:t.id,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),a.jsx(Iy,{displayMonth:t.displayMonth,id:t.id})]}),a.jsx("div",{className:r.caption,style:i.caption,children:d})}function HI(t){var e=Gn(),n=e.footer,r=e.styles,s=e.classNames.tfoot;return n?a.jsx("tfoot",{className:s,style:r.tfoot,children:a.jsx("tr",{children:a.jsx("td",{colSpan:8,children:n})})}):a.jsx(a.Fragment,{})}function KI(t,e,n){for(var r=n?ql(new Date):ha(new Date,{locale:t,weekStartsOn:e}),s=[],i=0;i<7;i++){var o=ss(r,i);s.push(o)}return s}function GI(){var t=Gn(),e=t.classNames,n=t.styles,r=t.showWeekNumber,s=t.locale,i=t.weekStartsOn,o=t.ISOWeek,l=t.formatters.formatWeekdayName,c=t.labels.labelWeekday,d=KI(s,i,o);return a.jsxs("tr",{style:n.head_row,className:e.head_row,children:[r&&a.jsx("td",{style:n.head_cell,className:e.head_cell}),d.map(function(f,m){return a.jsx("th",{scope:"col",className:e.head_cell,style:n.head_cell,"aria-label":c(f,{locale:s}),children:l(f,{locale:s})},m)})]})}function YI(){var t,e=Gn(),n=e.classNames,r=e.styles,s=e.components,i=(t=s==null?void 0:s.HeadRow)!==null&&t!==void 0?t:GI;return a.jsx("thead",{style:r.head,className:n.head,children:a.jsx(i,{})})}function ZI(t){var e=Gn(),n=e.locale,r=e.formatters.formatDay;return a.jsx(a.Fragment,{children:r(t.date,{locale:n})})}var N0=I.createContext(void 0);function XI(t){if(!hd(t.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return a.jsx(N0.Provider,{value:e,children:t.children})}return a.jsx(JI,{initialProps:t.initialProps,children:t.children})}function JI(t){var e=t.initialProps,n=t.children,r=e.selected,s=e.min,i=e.max,o=function(d,f,m){var g,v;(g=e.onDayClick)===null||g===void 0||g.call(e,d,f,m);var N=!!(f.selected&&s&&(r==null?void 0:r.length)===s);if(!N){var j=!!(!f.selected&&i&&(r==null?void 0:r.length)===i);if(!j){var P=r?Yw([],r):[];if(f.selected){var k=P.findIndex(function(_){return js(d,_)});P.splice(k,1)}else P.push(d);(v=e.onSelect)===null||v===void 0||v.call(e,P,d,f,m)}}},l={disabled:[]};r&&l.disabled.push(function(d){var f=i&&r.length>i-1,m=r.some(function(g){return js(g,d)});return!!(f&&!m)});var c={selected:r,onDayClick:o,modifiers:l};return a.jsx(N0.Provider,{value:c,children:n})}function j0(){var t=I.useContext(N0);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function QI(t,e){var n=e||{},r=n.from,s=n.to;return r&&s?js(s,t)&&js(r,t)?void 0:js(s,t)?{from:s,to:void 0}:js(r,t)?void 0:Im(r,t)?{from:t,to:s}:{from:r,to:t}:s?Im(t,s)?{from:s,to:t}:{from:t,to:s}:r?Gw(t,r)?{from:t,to:r}:{from:r,to:t}:{from:t,to:void 0}}var S0=I.createContext(void 0);function eM(t){if(!fd(t.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return a.jsx(S0.Provider,{value:e,children:t.children})}return a.jsx(tM,{initialProps:t.initialProps,children:t.children})}function tM(t){var e=t.initialProps,n=t.children,r=e.selected,s=r||{},i=s.from,o=s.to,l=e.min,c=e.max,d=function(v,N,j){var P,k;(P=e.onDayClick)===null||P===void 0||P.call(e,v,N,j);var _=QI(v,r);(k=e.onSelect)===null||k===void 0||k.call(e,_,v,N,j)},f={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(f.range_start=[i],o?(f.range_end=[o],js(i,o)||(f.range_middle=[{after:i,before:o}])):f.range_end=[i]):o&&(f.range_start=[o],f.range_end=[o]),l&&(i&&!o&&f.disabled.push({after:eh(i,l-1),before:ss(i,l-1)}),i&&o&&f.disabled.push({after:i,before:ss(i,l-1)}),!i&&o&&f.disabled.push({after:eh(o,l-1),before:ss(o,l-1)})),c){if(i&&!o&&(f.disabled.push({before:ss(i,-c+1)}),f.disabled.push({after:ss(i,c-1)})),i&&o){var m=Li(o,i)+1,g=c-m;f.disabled.push({before:eh(i,g)}),f.disabled.push({after:ss(o,g)})}!i&&o&&(f.disabled.push({before:ss(o,-c+1)}),f.disabled.push({after:ss(o,c-1)}))}return a.jsx(S0.Provider,{value:{selected:r,onDayClick:d,modifiers:f},children:n})}function k0(){var t=I.useContext(S0);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function th(t){return Array.isArray(t)?Yw([],t):t!==void 0?[t]:[]}function nM(t){var e={};return Object.entries(t).forEach(function(n){var r=n[0],s=n[1];e[r]=th(s)}),e}var Ei;(function(t){t.Outside="outside",t.Disabled="disabled",t.Selected="selected",t.Hidden="hidden",t.Today="today",t.RangeStart="range_start",t.RangeEnd="range_end",t.RangeMiddle="range_middle"})(Ei||(Ei={}));var rM=Ei.Selected,Ua=Ei.Disabled,sM=Ei.Hidden,iM=Ei.Today,Sp=Ei.RangeEnd,kp=Ei.RangeMiddle,_p=Ei.RangeStart,aM=Ei.Outside;function oM(t,e,n){var r,s=(r={},r[rM]=th(t.selected),r[Ua]=th(t.disabled),r[sM]=th(t.hidden),r[iM]=[t.today],r[Sp]=[],r[kp]=[],r[_p]=[],r[aM]=[],r);return t.fromDate&&s[Ua].push({before:t.fromDate}),t.toDate&&s[Ua].push({after:t.toDate}),hd(t)?s[Ua]=s[Ua].concat(e.modifiers[Ua]):fd(t)&&(s[Ua]=s[Ua].concat(n.modifiers[Ua]),s[_p]=n.modifiers[_p],s[kp]=n.modifiers[kp],s[Sp]=n.modifiers[Sp]),s}var eN=I.createContext(void 0);function lM(t){var e=Gn(),n=j0(),r=k0(),s=oM(e,n,r),i=nM(e.modifiers),o=tn(tn({},s),i);return a.jsx(eN.Provider,{value:o,children:t.children})}function tN(){var t=I.useContext(eN);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function cM(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function uM(t){return!!(t&&typeof t=="object"&&"from"in t)}function dM(t){return!!(t&&typeof t=="object"&&"after"in t)}function hM(t){return!!(t&&typeof t=="object"&&"before"in t)}function fM(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function pM(t,e){var n,r=e.from,s=e.to;if(r&&s){var i=Li(s,r)<0;i&&(n=[s,r],r=n[0],s=n[1]);var o=Li(t,r)>=0&&Li(s,t)>=0;return o}return s?js(s,t):r?js(r,t):!1}function mM(t){return y0(t)}function gM(t){return Array.isArray(t)&&t.every(y0)}function vM(t,e){return e.some(function(n){if(typeof n=="boolean")return n;if(mM(n))return js(t,n);if(gM(n))return n.includes(t);if(uM(n))return pM(t,n);if(fM(n))return n.dayOfWeek.includes(t.getDay());if(cM(n)){var r=Li(n.before,t),s=Li(n.after,t),i=r>0,o=s<0,l=Im(n.before,n.after);return l?o&&i:i||o}return dM(n)?Li(t,n.after)>0:hM(n)?Li(n.before,t)>0:typeof n=="function"?n(t):!1})}function _0(t,e,n){var r=Object.keys(e).reduce(function(i,o){var l=e[o];return vM(t,l)&&i.push(o),i},[]),s={};return r.forEach(function(i){return s[i]=!0}),n&&!w0(t,n)&&(s.outside=!0),s}function yM(t,e){for(var n=Is(t[0]),r=kf(t[t.length-1]),s,i,o=n;o<=r;){var l=_0(o,e),c=!l.disabled&&!l.hidden;if(!c){o=ss(o,1);continue}if(l.selected)return o;l.today&&!i&&(i=o),s||(s=o),o=ss(o,1)}return i||s}var xM=365;function nN(t,e){var n=e.moveBy,r=e.direction,s=e.context,i=e.modifiers,o=e.retry,l=o===void 0?{count:0,lastFocused:t}:o,c=s.weekStartsOn,d=s.fromDate,f=s.toDate,m=s.locale,g={day:ss,week:Lm,month:Mi,year:XL,startOfWeek:function(P){return s.ISOWeek?ql(P):ha(P,{locale:m,weekStartsOn:c})},endOfWeek:function(P){return s.ISOWeek?zw(P):x0(P,{locale:m,weekStartsOn:c})}},v=g[n](t,r==="after"?1:-1);r==="before"&&d?v=JL([d,v]):r==="after"&&f&&(v=QL([f,v]));var N=!0;if(i){var j=_0(v,i);N=!j.disabled&&!j.hidden}return N?v:l.count>xM?l.lastFocused:nN(v,{moveBy:n,direction:r,context:s,modifiers:i,retry:tn(tn({},l),{count:l.count+1})})}var rN=I.createContext(void 0);function bM(t){var e=pd(),n=tN(),r=I.useState(),s=r[0],i=r[1],o=I.useState(),l=o[0],c=o[1],d=yM(e.displayMonths,n),f=s??(l&&e.isDateDisplayed(l))?l:d,m=function(){c(s),i(void 0)},g=function(P){i(P)},v=Gn(),N=function(P,k){if(s){var _=nN(s,{moveBy:P,direction:k,context:v,modifiers:n});js(s,_)||(e.goToDate(_,s),g(_))}},j={focusedDay:s,focusTarget:f,blur:m,focus:g,focusDayAfter:function(){return N("day","after")},focusDayBefore:function(){return N("day","before")},focusWeekAfter:function(){return N("week","after")},focusWeekBefore:function(){return N("week","before")},focusMonthBefore:function(){return N("month","before")},focusMonthAfter:function(){return N("month","after")},focusYearBefore:function(){return N("year","before")},focusYearAfter:function(){return N("year","after")},focusStartOfWeek:function(){return N("startOfWeek","before")},focusEndOfWeek:function(){return N("endOfWeek","after")}};return a.jsx(rN.Provider,{value:j,children:t.children})}function A0(){var t=I.useContext(rN);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function wM(t,e){var n=tN(),r=_0(t,n,e);return r}var P0=I.createContext(void 0);function NM(t){if(!_f(t.initialProps)){var e={selected:void 0};return a.jsx(P0.Provider,{value:e,children:t.children})}return a.jsx(jM,{initialProps:t.initialProps,children:t.children})}function jM(t){var e=t.initialProps,n=t.children,r=function(i,o,l){var c,d,f;if((c=e.onDayClick)===null||c===void 0||c.call(e,i,o,l),o.selected&&!e.required){(d=e.onSelect)===null||d===void 0||d.call(e,void 0,i,o,l);return}(f=e.onSelect)===null||f===void 0||f.call(e,i,i,o,l)},s={selected:e.selected,onDayClick:r};return a.jsx(P0.Provider,{value:s,children:n})}function sN(){var t=I.useContext(P0);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function SM(t,e){var n=Gn(),r=sN(),s=j0(),i=k0(),o=A0(),l=o.focusDayAfter,c=o.focusDayBefore,d=o.focusWeekAfter,f=o.focusWeekBefore,m=o.blur,g=o.focus,v=o.focusMonthBefore,N=o.focusMonthAfter,j=o.focusYearBefore,P=o.focusYearAfter,k=o.focusStartOfWeek,_=o.focusEndOfWeek,M=function(ae){var G,xe,De,$e;_f(n)?(G=r.onDayClick)===null||G===void 0||G.call(r,t,e,ae):hd(n)?(xe=s.onDayClick)===null||xe===void 0||xe.call(s,t,e,ae):fd(n)?(De=i.onDayClick)===null||De===void 0||De.call(i,t,e,ae):($e=n.onDayClick)===null||$e===void 0||$e.call(n,t,e,ae)},$=function(ae){var G;g(t),(G=n.onDayFocus)===null||G===void 0||G.call(n,t,e,ae)},Y=function(ae){var G;m(),(G=n.onDayBlur)===null||G===void 0||G.call(n,t,e,ae)},U=function(ae){var G;(G=n.onDayMouseEnter)===null||G===void 0||G.call(n,t,e,ae)},te=function(ae){var G;(G=n.onDayMouseLeave)===null||G===void 0||G.call(n,t,e,ae)},W=function(ae){var G;(G=n.onDayPointerEnter)===null||G===void 0||G.call(n,t,e,ae)},ge=function(ae){var G;(G=n.onDayPointerLeave)===null||G===void 0||G.call(n,t,e,ae)},oe=function(ae){var G;(G=n.onDayTouchCancel)===null||G===void 0||G.call(n,t,e,ae)},B=function(ae){var G;(G=n.onDayTouchEnd)===null||G===void 0||G.call(n,t,e,ae)},T=function(ae){var G;(G=n.onDayTouchMove)===null||G===void 0||G.call(n,t,e,ae)},J=function(ae){var G;(G=n.onDayTouchStart)===null||G===void 0||G.call(n,t,e,ae)},Z=function(ae){var G;(G=n.onDayKeyUp)===null||G===void 0||G.call(n,t,e,ae)},Ne=function(ae){var G;switch(ae.key){case"ArrowLeft":ae.preventDefault(),ae.stopPropagation(),n.dir==="rtl"?l():c();break;case"ArrowRight":ae.preventDefault(),ae.stopPropagation(),n.dir==="rtl"?c():l();break;case"ArrowDown":ae.preventDefault(),ae.stopPropagation(),d();break;case"ArrowUp":ae.preventDefault(),ae.stopPropagation(),f();break;case"PageUp":ae.preventDefault(),ae.stopPropagation(),ae.shiftKey?j():v();break;case"PageDown":ae.preventDefault(),ae.stopPropagation(),ae.shiftKey?P():N();break;case"Home":ae.preventDefault(),ae.stopPropagation(),k();break;case"End":ae.preventDefault(),ae.stopPropagation(),_();break}(G=n.onDayKeyDown)===null||G===void 0||G.call(n,t,e,ae)},he={onClick:M,onFocus:$,onBlur:Y,onKeyDown:Ne,onKeyUp:Z,onMouseEnter:U,onMouseLeave:te,onPointerEnter:W,onPointerLeave:ge,onTouchCancel:oe,onTouchEnd:B,onTouchMove:T,onTouchStart:J};return he}function kM(){var t=Gn(),e=sN(),n=j0(),r=k0(),s=_f(t)?e.selected:hd(t)?n.selected:fd(t)?r.selected:void 0;return s}function _M(t){return Object.values(Ei).includes(t)}function AM(t,e){var n=[t.classNames.day];return Object.keys(e).forEach(function(r){var s=t.modifiersClassNames[r];if(s)n.push(s);else if(_M(r)){var i=t.classNames["day_".concat(r)];i&&n.push(i)}}),n}function PM(t,e){var n=tn({},t.styles.day);return Object.keys(e).forEach(function(r){var s;n=tn(tn({},n),(s=t.modifiersStyles)===null||s===void 0?void 0:s[r])}),n}function CM(t,e,n){var r,s,i,o=Gn(),l=A0(),c=wM(t,e),d=SM(t,c),f=kM(),m=!!(o.onDayClick||o.mode!=="default");I.useEffect(function(){var U;c.outside||l.focusedDay&&m&&js(l.focusedDay,t)&&((U=n.current)===null||U===void 0||U.focus())},[l.focusedDay,t,n,m,c.outside]);var g=AM(o,c).join(" "),v=PM(o,c),N=!!(c.outside&&!o.showOutsideDays||c.hidden),j=(i=(s=o.components)===null||s===void 0?void 0:s.DayContent)!==null&&i!==void 0?i:ZI,P=a.jsx(j,{date:t,displayMonth:e,activeModifiers:c}),k={style:v,className:g,children:P,role:"gridcell"},_=l.focusTarget&&js(l.focusTarget,t)&&!c.outside,M=l.focusedDay&&js(l.focusedDay,t),$=tn(tn(tn({},k),(r={disabled:c.disabled,role:"gridcell"},r["aria-selected"]=c.selected,r.tabIndex=M||_?0:-1,r)),d),Y={isButton:m,isHidden:N,activeModifiers:c,selectedDays:f,buttonProps:$,divProps:k};return Y}function TM(t){var e=I.useRef(null),n=CM(t.date,t.displayMonth,e);return n.isHidden?a.jsx("div",{role:"gridcell"}):n.isButton?a.jsx(Wh,tn({name:"day",ref:e},n.buttonProps)):a.jsx("div",tn({},n.divProps))}function LM(t){var e=t.number,n=t.dates,r=Gn(),s=r.onWeekNumberClick,i=r.styles,o=r.classNames,l=r.locale,c=r.labels.labelWeekNumber,d=r.formatters.formatWeekNumber,f=d(Number(e),{locale:l});if(!s)return a.jsx("span",{className:o.weeknumber,style:i.weeknumber,children:f});var m=c(Number(e),{locale:l}),g=function(v){s(e,n,v)};return a.jsx(Wh,{name:"week-number","aria-label":m,className:o.weeknumber,style:i.weeknumber,onClick:g,children:f})}function DM(t){var e,n,r=Gn(),s=r.styles,i=r.classNames,o=r.showWeekNumber,l=r.components,c=(e=l==null?void 0:l.Day)!==null&&e!==void 0?e:TM,d=(n=l==null?void 0:l.WeekNumber)!==null&&n!==void 0?n:LM,f;return o&&(f=a.jsx("td",{className:i.cell,style:s.cell,children:a.jsx(d,{number:t.weekNumber,dates:t.dates})})),a.jsxs("tr",{className:i.row,style:s.row,children:[f,t.dates.map(function(m){return a.jsx("td",{className:i.cell,style:s.cell,role:"presentation",children:a.jsx(c,{displayMonth:t.displayMonth,date:m})},lI(m))})]})}function My(t,e,n){for(var r=n!=null&&n.ISOWeek?zw(e):x0(e,n),s=n!=null&&n.ISOWeek?ql(t):ha(t,n),i=Li(r,s),o=[],l=0;l<=i;l++)o.push(ss(s,l));var c=o.reduce(function(d,f){var m=n!=null&&n.ISOWeek?Ww(f):Hw(f,n),g=d.find(function(v){return v.weekNumber===m});return g?(g.dates.push(f),d):(d.push({weekNumber:m,dates:[f]}),d)},[]);return c}function IM(t,e){var n=My(Is(t),kf(t),e);if(e!=null&&e.useFixedWeeks){var r=uI(t,e);if(r<6){var s=n[n.length-1],i=s.dates[s.dates.length-1],o=Lm(i,6-r),l=My(Lm(i,1),o,e);n.push.apply(n,l)}}return n}function MM(t){var e,n,r,s=Gn(),i=s.locale,o=s.classNames,l=s.styles,c=s.hideHead,d=s.fixedWeeks,f=s.components,m=s.weekStartsOn,g=s.firstWeekContainsDate,v=s.ISOWeek,N=IM(t.displayMonth,{useFixedWeeks:!!d,ISOWeek:v,locale:i,weekStartsOn:m,firstWeekContainsDate:g}),j=(e=f==null?void 0:f.Head)!==null&&e!==void 0?e:YI,P=(n=f==null?void 0:f.Row)!==null&&n!==void 0?n:DM,k=(r=f==null?void 0:f.Footer)!==null&&r!==void 0?r:HI;return a.jsxs("table",{id:t.id,className:o.table,style:l.table,role:"grid","aria-labelledby":t["aria-labelledby"],children:[!c&&a.jsx(j,{}),a.jsx("tbody",{className:o.tbody,style:l.tbody,children:N.map(function(_){return a.jsx(P,{displayMonth:t.displayMonth,dates:_.dates,weekNumber:_.weekNumber},_.weekNumber)})}),a.jsx(k,{displayMonth:t.displayMonth})]})}function EM(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var OM=EM()?I.useLayoutEffect:I.useEffect,Ap=!1,RM=0;function Ey(){return"react-day-picker-".concat(++RM)}function FM(t){var e,n=t??(Ap?Ey():null),r=I.useState(n),s=r[0],i=r[1];return OM(function(){s===null&&i(Ey())},[]),I.useEffect(function(){Ap===!1&&(Ap=!0)},[]),(e=t??s)!==null&&e!==void 0?e:void 0}function BM(t){var e,n,r=Gn(),s=r.dir,i=r.classNames,o=r.styles,l=r.components,c=pd().displayMonths,d=FM(r.id?"".concat(r.id,"-").concat(t.displayIndex):void 0),f=r.id?"".concat(r.id,"-grid-").concat(t.displayIndex):void 0,m=[i.month],g=o.month,v=t.displayIndex===0,N=t.displayIndex===c.length-1,j=!v&&!N;s==="rtl"&&(e=[v,N],N=e[0],v=e[1]),v&&(m.push(i.caption_start),g=tn(tn({},g),o.caption_start)),N&&(m.push(i.caption_end),g=tn(tn({},g),o.caption_end)),j&&(m.push(i.caption_between),g=tn(tn({},g),o.caption_between));var P=(n=l==null?void 0:l.Caption)!==null&&n!==void 0?n:$I;return a.jsxs("div",{className:m.join(" "),style:g,children:[a.jsx(P,{id:d,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),a.jsx(MM,{id:f,"aria-labelledby":d,displayMonth:t.displayMonth})]},t.displayIndex)}function VM(t){var e=Gn(),n=e.classNames,r=e.styles;return a.jsx("div",{className:n.months,style:r.months,children:t.children})}function qM(t){var e,n,r=t.initialProps,s=Gn(),i=A0(),o=pd(),l=I.useState(!1),c=l[0],d=l[1];I.useEffect(function(){s.initialFocus&&i.focusTarget&&(c||(i.focus(i.focusTarget),d(!0)))},[s.initialFocus,c,i.focus,i.focusTarget,i]);var f=[s.classNames.root,s.className];s.numberOfMonths>1&&f.push(s.classNames.multiple_months),s.showWeekNumber&&f.push(s.classNames.with_weeknumber);var m=tn(tn({},s.styles.root),s.style),g=Object.keys(r).filter(function(N){return N.startsWith("data-")}).reduce(function(N,j){var P;return tn(tn({},N),(P={},P[j]=r[j],P))},{}),v=(n=(e=r.components)===null||e===void 0?void 0:e.Months)!==null&&n!==void 0?n:VM;return a.jsx("div",tn({className:f.join(" "),style:m,dir:s.dir,id:s.id,nonce:r.nonce,title:r.title,lang:r.lang},g,{children:a.jsx(v,{children:o.displayMonths.map(function(N,j){return a.jsx(BM,{displayIndex:j,displayMonth:N},j)})})}))}function UM(t){var e=t.children,n=hI(t,["children"]);return a.jsx(LI,{initialProps:n,children:a.jsx(qI,{children:a.jsx(NM,{initialProps:n,children:a.jsx(XI,{initialProps:n,children:a.jsx(eM,{initialProps:n,children:a.jsx(lM,{children:a.jsx(bM,{children:e})})})})})})})}function zM(t){return a.jsx(UM,tn({},t,{children:a.jsx(qM,{initialProps:t})}))}function Af({className:t,classNames:e,showOutsideDays:n=!0,...r}){return a.jsx(zM,{showOutsideDays:n,className:vt("p-3",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-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:vt(Tu({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-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:vt("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",r.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:vt(Tu({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",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",...e},components:{IconLeft:({...s})=>a.jsx(d7,{className:"h-4 w-4"}),IconRight:({...s})=>a.jsx(A5,{className:"h-4 w-4"})},...r})}Af.displayName="Calendar";var C0="Popover",[iN,fO]=ed(C0,[Gh]),md=Gh(),[WM,nl]=iN(C0),aN=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=t,l=md(e),c=I.useRef(null),[d,f]=I.useState(!1),[m=!1,g]=fh({prop:r,defaultProp:s,onChange:i});return a.jsx(T2,{...l,children:a.jsx(WM,{scope:e,contentId:Yh(),triggerRef:c,open:m,onOpenChange:g,onOpenToggle:I.useCallback(()=>g(v=>!v),[g]),hasCustomAnchor:d,onCustomAnchorAdd:I.useCallback(()=>f(!0),[]),onCustomAnchorRemove:I.useCallback(()=>f(!1),[]),modal:o,children:n})})};aN.displayName=C0;var oN="PopoverAnchor",$M=I.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=nl(oN,n),i=md(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=s;return I.useEffect(()=>(o(),()=>l()),[o,l]),a.jsx(Gm,{...i,...r,ref:e})});$M.displayName=oN;var lN="PopoverTrigger",cN=I.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=nl(lN,n),i=md(n),o=ks(e,s.triggerRef),l=a.jsx(sr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":pN(s.open),...r,ref:o,onClick:rr(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:a.jsx(Gm,{asChild:!0,...i,children:l})});cN.displayName=lN;var T0="PopoverPortal",[HM,KM]=iN(T0,{forceMount:void 0}),uN=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=nl(T0,e);return a.jsx(HM,{scope:e,forceMount:n,children:a.jsx(M2,{present:n||i.open,children:a.jsx(C2,{asChild:!0,container:s,children:r})})})};uN.displayName=T0;var zc="PopoverContent",dN=I.forwardRef((t,e)=>{const n=KM(zc,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=nl(zc,t.__scopePopover);return a.jsx(M2,{present:r||i.open,children:i.modal?a.jsx(GM,{...s,ref:e}):a.jsx(YM,{...s,ref:e})})});dN.displayName=zc;var GM=I.forwardRef((t,e)=>{const n=nl(zc,t.__scopePopover),r=I.useRef(null),s=ks(e,r),i=I.useRef(!1);return I.useEffect(()=>{const o=r.current;if(o)return N2(o)},[]),a.jsx(S2,{as:Kh,allowPinchZoom:!0,children:a.jsx(hN,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:rr(t.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:rr(t.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;i.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:rr(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),YM=I.forwardRef((t,e)=>{const n=nl(zc,t.__scopePopover),r=I.useRef(!1),s=I.useRef(!1);return a.jsx(hN,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,d;(c=t.onInteractOutside)==null||c.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),hN=I.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,...m}=t,g=nl(zc,n),v=md(n);return j2(),a.jsx(k2,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(_2,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:f,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>g.onOpenChange(!1),children:a.jsx(A2,{"data-state":pN(g.open),role:"dialog",id:g.contentId,...v,...m,ref:e,style:{...m.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)"}})})})}),fN="PopoverClose",ZM=I.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=nl(fN,n);return a.jsx(sr.button,{type:"button",...r,ref:e,onClick:rr(t.onClick,()=>s.onOpenChange(!1))})});ZM.displayName=fN;var XM="PopoverArrow",JM=I.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=md(n);return a.jsx(P2,{...s,...r,ref:e})});JM.displayName=XM;function pN(t){return t?"open":"closed"}var QM=aN,eE=cN,tE=uN,mN=dN;const gN=QM,vN=eE,L0=I.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>a.jsx(tE,{children:a.jsx(mN,{ref:s,align:e,sideOffset:n,className:vt("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",t),...r})}));L0.displayName=mN.displayName;const nE=dr.object({title:dr.string().min(1,"Title is required").max(100,"Title must be less than 100 characters"),description:dr.string().optional(),category:dr.enum(["fitness","learning","career","health","finance","personal","creative","social","other"]),targetValue:dr.number().positive("Target value must be positive").optional(),startingCapital:dr.number().positive("Starting capital must be positive").optional(),unit:dr.string().optional(),targetDate:dr.date().optional(),priority:dr.enum(["low","medium","high"]),color:dr.string()}),Pp=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899","#06B6D4","#84CC16","#F97316","#6366F1"],rE=[{value:"fitness",label:"Fitness",emoji:"💪"},{value:"learning",label:"Learning",emoji:"📚"},{value:"career",label:"Career",emoji:"💼"},{value:"health",label:"Health",emoji:"🏥"},{value:"finance",label:"Finance",emoji:"💰"},{value:"personal",label:"Personal",emoji:"🌟"},{value:"creative",label:"Creative",emoji:"🎨"},{value:"social",label:"Social",emoji:"👥"},{value:"other",label:"Other",emoji:"📝"}];function yN({open:t,onOpenChange:e}){const{user:n}=Ir(),{createGoal:r}=io(),[s,i]=I.useState(!1),[o,l]=I.useState(Pp[0]),{register:c,handleSubmit:d,watch:f,setValue:m,reset:g,formState:{errors:v}}=pf({resolver:mf(nE),defaultValues:{priority:"medium",color:Pp[0],category:"personal"}}),N=async k=>{if(n){i(!0);try{await r({...k,userId:n.id,status:"active",color:o}),g(),e(!1)}catch(_){console.error("Failed to create goal:",_)}finally{i(!1)}}},j=()=>{g(),e(!1)},P=f("targetDate");return a.jsx(g0,{open:t,onOpenChange:j,children:a.jsxs(wf,{className:"sm:max-w-[500px] max-h-[90vh] overflow-y-auto",children:[a.jsxs(Nf,{children:[a.jsxs(jf,{className:"flex items-center space-x-2",children:[a.jsx(xr,{className:"h-5 w-5 text-primary"}),a.jsx("span",{children:"Create New Goal"})]}),a.jsx(Sf,{children:"Set a new target and start tracking your progress"})]}),a.jsxs("form",{onSubmit:d(N),className:"space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{htmlFor:"title",children:"Goal Title *"}),a.jsx($n,{id:"title",placeholder:"e.g. Run 5km daily, Learn Spanish, Save $10,000",...c("title")}),v.title&&a.jsx("p",{className:"text-sm text-destructive",children:v.title.message})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{htmlFor:"description",children:"Description"}),a.jsx(vf,{id:"description",placeholder:"Add more details about your goal...",rows:3,...c("description")})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{children:"Category *"}),a.jsxs(Ja,{value:f("category"),onValueChange:k=>m("category",k),children:[a.jsx(ia,{children:a.jsx(Qa,{placeholder:"Select category"})}),a.jsx(aa,{children:rE.map(k=>a.jsx(Rn,{value:k.value,children:a.jsxs("span",{className:"flex items-center space-x-2",children:[a.jsx("span",{children:k.emoji}),a.jsx("span",{children:k.label})]})},k.value))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{children:"Priority *"}),a.jsxs(Ja,{value:f("priority"),onValueChange:k=>m("priority",k),children:[a.jsx(ia,{children:a.jsx(Qa,{})}),a.jsxs(aa,{children:[a.jsx(Rn,{value:"low",children:"Low"}),a.jsx(Rn,{value:"medium",children:"Medium"}),a.jsx(Rn,{value:"high",children:"High"})]})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{htmlFor:"targetValue",children:"Target Value"}),a.jsx($n,{id:"targetValue",type:"number",placeholder:"100",...c("targetValue",{valueAsNumber:!0})}),v.targetValue&&a.jsx("p",{className:"text-sm text-destructive",children:v.targetValue.message})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{htmlFor:"unit",children:"Unit"}),a.jsx($n,{id:"unit",placeholder:"km, hours, $, books, etc.",...c("unit")})]})]}),f("category")==="finance"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{htmlFor:"startingCapital",children:"Starting Capital"}),a.jsx($n,{id:"startingCapital",type:"number",placeholder:"1000",...c("startingCapital",{valueAsNumber:!0})}),v.startingCapital&&a.jsx("p",{className:"text-sm text-destructive",children:v.startingCapital.message}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"The initial amount you're starting with for this financial goal"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{children:"Target Date"}),a.jsxs(gN,{children:[a.jsx(vN,{asChild:!0,children:a.jsxs(ht,{variant:"outline",className:vt("w-full justify-start text-left font-normal",!P&&"text-muted-foreground"),children:[a.jsx(ys,{className:"mr-2 h-4 w-4"}),P?Kn(P,"PPP"):"Select target date"]})}),a.jsx(L0,{className:"w-auto p-0",children:a.jsx(Af,{mode:"single",selected:P,onSelect:k=>m("targetDate",k),initialFocus:!0,disabled:k=>k<new Date})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{children:"Goal Color"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:Pp.map(k=>a.jsx(nt.button,{type:"button",whileHover:{scale:1.1},whileTap:{scale:.95},className:vt("w-8 h-8 rounded-full border-2 transition-all",o===k?"border-foreground ring-2 ring-offset-2 ring-offset-background ring-foreground/20":"border-border hover:border-foreground/50"),style:{backgroundColor:k},onClick:()=>{l(k),m("color",k)}},k))})]}),a.jsxs("div",{className:"flex justify-end space-x-2 pt-4 border-t",children:[a.jsx(ht,{type:"button",variant:"outline",onClick:j,children:"Cancel"}),a.jsxs(ht,{type:"submit",disabled:s,children:[s?a.jsx(nt.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full mr-2"}):null,"Create Goal"]})]})]})]})})}const sE=dr.object({goalId:dr.string().min(1,"Please select a goal"),value:dr.number().positive("Value must be positive"),note:dr.string().optional(),date:dr.date()});function xN({open:t,onOpenChange:e,goals:n}){const{user:r}=Ir(),{addProgress:s}=io(),[i,o]=I.useState(!1),[l,c]=I.useState([]),[d,f]=I.useState(!1),{register:m,handleSubmit:g,watch:v,setValue:N,reset:j,formState:{errors:P}}=pf({resolver:mf(sE),defaultValues:{date:new Date}}),k=v("goalId"),_=n.find(oe=>oe.id===k),M=v("date"),$=oe=>{if(!oe)return;const B=Array.from(oe).filter(T=>{const J=T.type.startsWith("image/"),Z=T.type.startsWith("video/"),Ne=T.size<=10*1024*1024;return!J&&!Z?(St.error(`${T.name} is not a valid image or video file`),!1):Ne?!0:(St.error(`${T.name} is too large. Maximum size is 10MB`),!1)});c(T=>[...T,...B]),St.success(`${B.length} file(s) uploaded successfully`)},Y=oe=>{oe.preventDefault(),oe.stopPropagation(),oe.type==="dragenter"||oe.type==="dragover"?f(!0):oe.type==="dragleave"&&f(!1)},U=oe=>{oe.preventDefault(),oe.stopPropagation(),f(!1),$(oe.dataTransfer.files)},te=oe=>{c(B=>B.filter((T,J)=>J!==oe))},W=async oe=>{if(r){o(!0);try{if(await s({...oe,userId:r.id}),l.length>0){const B=l.map(T=>URL.createObjectURL(T));St.success(`Progress saved with ${l.length} media file(s)`)}j({date:new Date}),c([]),e(!1)}catch(B){console.error("Failed to add progress:",B),St.error("Failed to add progress")}finally{o(!1)}}},ge=()=>{j({date:new Date}),c([]),e(!1)};return a.jsx(g0,{open:t,onOpenChange:ge,children:a.jsxs(wf,{className:"sm:max-w-[600px] max-h-[90vh] overflow-y-auto",children:[a.jsxs(Nf,{children:[a.jsxs(jf,{className:"flex items-center space-x-2",children:[a.jsx(oi,{className:"h-5 w-5 text-primary"}),a.jsx("span",{children:"Add Progress"})]}),a.jsx(Sf,{children:"Record your latest progress towards your goals"})]}),a.jsxs("form",{onSubmit:g(W),className:"space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{children:"Goal *"}),a.jsxs(Ja,{value:k,onValueChange:oe=>N("goalId",oe),children:[a.jsx(ia,{children:a.jsx(Qa,{placeholder:"Select a goal"})}),a.jsx(aa,{children:n.map(oe=>a.jsx(Rn,{value:oe.id,children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:oe.color}}),a.jsx("span",{children:oe.title}),oe.unit&&a.jsxs("span",{className:"text-muted-foreground",children:["(",oe.unit,")"]})]})},oe.id))})]}),P.goalId&&a.jsx("p",{className:"text-sm text-destructive",children:P.goalId.message})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(bn,{htmlFor:"value",children:["Progress Value *",(_==null?void 0:_.unit)&&a.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",_.unit,")"]})]}),a.jsx($n,{id:"value",type:"number",step:"0.01",placeholder:_!=null&&_.unit?`e.g. 5 ${_.unit}`:"10",...m("value",{valueAsNumber:!0})}),P.value&&a.jsx("p",{className:"text-sm text-destructive",children:P.value.message})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{children:"Date *"}),a.jsxs(gN,{children:[a.jsx(vN,{asChild:!0,children:a.jsxs(ht,{variant:"outline",className:vt("w-full justify-start text-left font-normal",!M&&"text-muted-foreground"),children:[a.jsx(ys,{className:"mr-2 h-4 w-4"}),M?Kn(M,"PPP"):"Select date"]})}),a.jsx(L0,{className:"w-auto p-0",children:a.jsx(Af,{mode:"single",selected:M,onSelect:oe=>oe&&N("date",oe),initialFocus:!0,disabled:oe=>oe>new Date})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{htmlFor:"note",children:"Note"}),a.jsx(vf,{id:"note",placeholder:"Add any notes about your progress...",rows:3,...m("note")})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{children:"Media Upload"}),a.jsxs("div",{className:vt("border-2 border-dashed rounded-lg p-6 text-center transition-colors",d?"border-primary bg-primary/5":"border-muted-foreground/25 hover:border-muted-foreground/50"),onDragEnter:Y,onDragLeave:Y,onDragOver:Y,onDrop:U,children:[a.jsx("input",{type:"file",multiple:!0,accept:"image/*,video/*",onChange:oe=>$(oe.target.files),className:"hidden",id:"file-upload"}),a.jsxs("label",{htmlFor:"file-upload",className:"cursor-pointer",children:[a.jsx(k_,{className:"h-8 w-8 text-muted-foreground mx-auto mb-2"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Drop files here or click to upload"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Images and videos up to 10MB"})]})]}),l.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs(bn,{children:["Uploaded Files (",l.length,")"]}),a.jsx("div",{className:"grid grid-cols-2 gap-2 max-h-32 overflow-y-auto",children:l.map((oe,B)=>a.jsxs("div",{className:"flex items-center space-x-2 p-2 bg-muted rounded-lg",children:[oe.type.startsWith("image/")?a.jsx(u_,{className:"h-4 w-4 text-blue-500"}):a.jsx(P_,{className:"h-4 w-4 text-purple-500"}),a.jsx("span",{className:"text-sm truncate flex-1",children:oe.name}),a.jsx(ht,{type:"button",variant:"ghost",size:"sm",onClick:()=>te(B),className:"h-6 w-6 p-0",children:a.jsx(rd,{className:"h-3 w-3"})})]},B))})]})]}),_&&a.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg space-y-2",children:[a.jsx("h4",{className:"font-medium",children:"Goal Progress"}),a.jsxs("div",{className:"text-sm text-muted-foreground",children:["Current: ",_.currentValue," ",_.unit,_.targetValue&&a.jsxs(a.Fragment,{children:[" / Target: ",_.targetValue," ",_.unit]})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2 pt-4 border-t",children:[a.jsx(ht,{type:"button",variant:"outline",onClick:ge,children:"Cancel"}),a.jsxs(ht,{type:"submit",disabled:i||!k,children:[i?a.jsx(nt.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full mr-2"}):null,"Add Progress"]})]})]})]})})}function iE(){var v;const{user:t}=Ir(),{goals:e,analytics:n,loadGoals:r,loadAnalytics:s}=io(),[i,o]=I.useState(!1),[l,c]=I.useState(!1);I.useEffect(()=>{t&&(r(t.id),s(t.id))},[t,r,s]);const d=e.filter(N=>N.status==="active"),f=d.slice(0,3),m={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.1}}},g={hidden:{opacity:0,y:20},visible:{opacity:1,y:0}};return a.jsxs("div",{className:"page-ios",children:[a.jsxs(nt.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"content-section-ios animate-ios-fade-in",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsxs("h1",{className:"text-ios-title",children:["Welcome back, ",(v=t==null?void 0:t.name)==null?void 0:v.split(" ")[0],"!"]}),a.jsx(nt.div,{animate:{rotate:[0,20,0]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"text-2xl",children:"👋"})]}),a.jsx("p",{className:"text-ios-body text-muted-foreground mt-2",children:"Track your progress and achieve your goals with data-driven insights."})]}),a.jsxs(nt.div,{variants:m,initial:"hidden",animate:"visible",className:"grid grid-cols-2 lg:grid-cols-4 gap-4 content-section-ios",children:[a.jsx(nt.div,{variants:g,className:"animate-ios-slide-up",children:a.jsx("div",{className:"card-ios bg-gradient-to-br from-primary/10 to-primary/5 border-primary/20",children:a.jsx("div",{className:"p-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"p-2 bg-primary/10 rounded-xl",children:a.jsx(xr,{className:"h-6 w-6 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-ios-headline",children:(n==null?void 0:n.totalGoals)||0}),a.jsx("p",{className:"text-ios-caption",children:"Total Goals"})]})]})})})}),a.jsx(nt.div,{variants:g,className:"animate-ios-slide-up",style:{animationDelay:"0.1s"},children:a.jsx("div",{className:"card-ios bg-gradient-to-br from-green-500/10 to-green-500/5 border-green-500/20",children:a.jsx("div",{className:"p-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"p-2 bg-green-500/10 rounded-xl",children:a.jsx(ta,{className:"h-6 w-6 text-green-500"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-ios-headline",children:(n==null?void 0:n.completedGoals)||0}),a.jsx("p",{className:"text-ios-caption",children:"Completed"})]})]})})})}),a.jsx(nt.div,{variants:g,className:"animate-ios-slide-up",style:{animationDelay:"0.2s"},children:a.jsx("div",{className:"card-ios bg-gradient-to-br from-orange-500/10 to-orange-500/5 border-orange-500/20",children:a.jsx("div",{className:"p-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"p-2 bg-orange-500/10 rounded-xl",children:a.jsx(bh,{className:"h-6 w-6 text-orange-500"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-ios-headline",children:(n==null?void 0:n.streakDays)||0}),a.jsx("p",{className:"text-ios-caption",children:"Day Streak"})]})]})})})}),a.jsx(nt.div,{variants:g,className:"animate-ios-slide-up",style:{animationDelay:"0.3s"},children:a.jsx("div",{className:"card-ios bg-gradient-to-br from-blue-500/10 to-blue-500/5 border-blue-500/20",children:a.jsx("div",{className:"p-4",children:a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"p-2 bg-blue-500/10 rounded-xl",children:a.jsx(oi,{className:"h-6 w-6 text-blue-500"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-ios-headline",children:Array.isArray(n==null?void 0:n.weeklyProgress)?n.weeklyProgress.length:(n==null?void 0:n.weeklyProgress)||0}),a.jsx("p",{className:"text-ios-caption",children:"This Week"})]})]})})})})]}),a.jsx(nt.div,{variants:g,initial:"hidden",animate:"visible",transition:{delay:.2},className:"content-section-ios animate-ios-bounce",children:a.jsx("div",{className:"card-ios",children:a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-ios-headline",children:"Active Goals"}),a.jsx("p",{className:"text-ios-body text-muted-foreground mt-1",children:"Keep pushing towards your targets"})]}),a.jsxs("button",{className:"btn-ios-secondary",onClick:()=>o(!0),children:[a.jsx(Ai,{className:"h-4 w-4 mr-2"}),"Add Goal"]})]}),f.length===0?a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"p-4 bg-muted/20 rounded-2xl w-fit mx-auto mb-4",children:a.jsx(xr,{className:"h-12 w-12 text-muted-foreground"})}),a.jsx("h3",{className:"text-ios-headline mb-2",children:"No active goals yet"}),a.jsx("p",{className:"text-ios-body text-muted-foreground mb-6",children:"Create your first goal to start tracking your progress"}),a.jsxs("button",{className:"btn-ios-primary",onClick:()=>o(!0),children:[a.jsx(Ai,{className:"h-4 w-4 mr-2"}),"Create Your First Goal"]})]}):a.jsxs("div",{className:"space-y-4",children:[f.map((N,j)=>{const P=N.targetValue?Math.round(N.currentValue/N.targetValue*100):0;return a.jsx(nt.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:j*.1},className:"card-ios p-4 hover:scale-[1.02] transition-all duration-300",children:a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx("div",{className:"w-1 h-16 rounded-full",style:{backgroundColor:N.color}}),a.jsxs("div",{className:"flex-1 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h4",{className:"text-ios-body font-semibold",children:N.title}),a.jsx("span",{className:`status-ios-${N.priority==="high"?"error":N.priority==="medium"?"warning":"success"} text-xs font-medium`,children:N.priority})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-ios-caption",children:"Progress"}),a.jsxs("span",{className:"text-ios-caption font-medium",children:[N.currentValue," / ",N.targetValue," ",N.unit]})]}),a.jsx("div",{className:"progress-ios",children:a.jsx("div",{className:"progress-ios-bar",style:{width:`${P}%`}})})]})]}),a.jsx(Cl,{to:"/goals",children:a.jsx("button",{className:"p-2 hover:bg-muted/20 rounded-xl transition-colors",children:a.jsx(Qk,{className:"h-5 w-5 text-muted-foreground"})})})]})},N.id)}),d.length>3&&a.jsx(Cl,{to:"/goals",children:a.jsxs("button",{className:"btn-ios-secondary w-full",children:["View All Goals (",d.length-3," more)"]})})]})]})})}),a.jsxs(nt.div,{variants:g,initial:"hidden",animate:"visible",transition:{delay:.3},className:"grid-ios content-section-ios",children:[a.jsx(nt.div,{className:"card-ios cursor-pointer animate-ios-scale",onClick:()=>c(!0),whileHover:{scale:1.05},whileTap:{scale:.95},children:a.jsxs("div",{className:"p-6 text-center",children:[a.jsx("div",{className:"p-4 bg-primary/10 rounded-2xl w-fit mx-auto mb-4",children:a.jsx(oi,{className:"h-8 w-8 text-primary"})}),a.jsx("h3",{className:"text-ios-body font-semibold mb-2",children:"Log Progress"}),a.jsx("p",{className:"text-ios-caption text-muted-foreground",children:"Update your goals with new progress"})]})}),a.jsx(Cl,{to:"/analytics",children:a.jsx(nt.div,{className:"card-ios cursor-pointer animate-ios-scale",whileHover:{scale:1.05},whileTap:{scale:.95},style:{animationDelay:"0.1s"},children:a.jsxs("div",{className:"p-6 text-center",children:[a.jsx("div",{className:"p-4 bg-yellow-500/10 rounded-2xl w-fit mx-auto mb-4",children:a.jsx(Iu,{className:"h-8 w-8 text-yellow-500"})}),a.jsx("h3",{className:"text-ios-body font-semibold mb-2",children:"View Analytics"}),a.jsx("p",{className:"text-ios-caption text-muted-foreground",children:"Insights and trends from your data"})]})})}),a.jsx(Cl,{to:"/calendar",children:a.jsx(nt.div,{className:"card-ios cursor-pointer animate-ios-scale",whileHover:{scale:1.05},whileTap:{scale:.95},style:{animationDelay:"0.2s"},children:a.jsxs("div",{className:"p-6 text-center",children:[a.jsx("div",{className:"p-4 bg-blue-500/10 rounded-2xl w-fit mx-auto mb-4",children:a.jsx(ys,{className:"h-8 w-8 text-blue-500"})}),a.jsx("h3",{className:"text-ios-body font-semibold mb-2",children:"Calendar View"}),a.jsx("p",{className:"text-ios-caption text-muted-foreground",children:"See your progress timeline"})]})})})]}),a.jsx(yN,{open:i,onOpenChange:o}),a.jsx(xN,{open:l,onOpenChange:c,goals:d})]})}function aE({goal:t}){const{updateGoal:e,deleteGoal:n}=io(),[r,s]=I.useState(!1),i=t.targetValue?Math.round(t.currentValue/t.targetValue*100):0,o=async f=>{s(!0);try{await e(t.id,{status:f})}finally{s(!1)}},l=async()=>{if(confirm("Are you sure you want to delete this goal? This action cannot be undone.")){s(!0);try{await n(t.id)}finally{s(!1)}}},c=f=>{switch(f){case"active":return"bg-green-500";case"completed":return"bg-blue-500";case"paused":return"bg-yellow-500";case"archived":return"bg-gray-500";default:return"bg-gray-500"}},d=f=>{switch(f){case"high":return"destructive";case"medium":return"default";case"low":return"secondary";default:return"secondary"}};return a.jsx(nt.div,{whileHover:{y:-4},transition:{duration:.2},children:a.jsxs(mt,{className:"h-full border-l-4",style:{borderLeftColor:t.color},children:[a.jsx($t,{className:"pb-3",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[a.jsx(Dn,{variant:"outline",className:"capitalize text-xs",children:t.category}),a.jsx(Dn,{variant:d(t.priority),className:"capitalize text-xs",children:t.priority})]}),a.jsx(Ht,{className:"text-lg leading-6 truncate",children:t.title}),t.description&&a.jsx(cn,{className:"line-clamp-2 mt-1",children:t.description})]}),a.jsxs(xm,{children:[a.jsx(bm,{asChild:!0,children:a.jsx(ht,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:a.jsx(i_,{className:"h-4 w-4"})})}),a.jsxs(Th,{align:"end",children:[a.jsxs(Ur,{children:[a.jsx(Zx,{className:"mr-2 h-4 w-4"}),"Edit Goal"]}),a.jsxs(Ur,{children:[a.jsx(Ai,{className:"mr-2 h-4 w-4"}),"Add Progress"]}),a.jsx(kc,{}),t.status==="active"&&a.jsxs(a.Fragment,{children:[a.jsxs(Ur,{onClick:()=>o("paused"),children:[a.jsx(g_,{className:"mr-2 h-4 w-4"}),"Pause Goal"]}),a.jsxs(Ur,{onClick:()=>o("completed"),children:[a.jsx(qx,{className:"mr-2 h-4 w-4"}),"Mark Complete"]})]}),t.status==="paused"&&a.jsxs(Ur,{onClick:()=>o("active"),children:[a.jsx(y_,{className:"mr-2 h-4 w-4"}),"Resume Goal"]}),t.status!=="archived"&&a.jsxs(Ur,{onClick:()=>o("archived"),children:[a.jsx(Kk,{className:"mr-2 h-4 w-4"}),"Archive Goal"]}),a.jsx(kc,{}),a.jsxs(Ur,{onClick:l,className:"text-destructive focus:text-destructive",children:[a.jsx(jg,{className:"mr-2 h-4 w-4"}),"Delete Goal"]})]})]})]})}),a.jsxs(gt,{className:"space-y-4",children:[t.targetValue&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{className:"text-muted-foreground",children:"Progress"}),a.jsxs("span",{className:"font-medium",children:[t.currentValue," / ",t.targetValue," ",t.unit]})]}),a.jsx(ld,{value:i,className:"h-2",style:{backgroundColor:`${t.color}20`}}),a.jsx("div",{className:"text-right",children:a.jsxs("span",{className:"text-xs text-muted-foreground",children:[i,"% complete"]})})]}),a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("div",{className:`w-2 h-2 rounded-full ${c(t.status)}`}),a.jsx("span",{className:"capitalize text-muted-foreground",children:t.status})]}),t.targetDate&&a.jsxs("span",{className:"text-muted-foreground",children:["Due ",Dm(new Date(t.targetDate),{addSuffix:!0})]})]}),a.jsxs("div",{className:"text-xs text-muted-foreground",children:["Updated ",Dm(new Date(t.updatedAt),{addSuffix:!0})]})]})]})})}function oE(){const{user:t}=Ir(),{goals:e,loadGoals:n}=io(),[r,s]=I.useState(!1),[i,o]=I.useState(""),[l,c]=I.useState("all"),[d,f]=I.useState("all"),[m,g]=I.useState("updated");I.useEffect(()=>{t&&n(t.id)},[t,n]);const N=[...e.filter(_=>{var U;const M=_.title.toLowerCase().includes(i.toLowerCase())||((U=_.description)==null?void 0:U.toLowerCase().includes(i.toLowerCase())),$=l==="all"||_.status===l,Y=d==="all"||_.category===d;return M&&$&&Y})].sort((_,M)=>{switch(m){case"title":return _.title.localeCompare(M.title);case"created":return new Date(M.createdAt).getTime()-new Date(_.createdAt).getTime();case"updated":return new Date(M.updatedAt).getTime()-new Date(_.updatedAt).getTime();case"progress":const $=_.targetValue?_.currentValue/_.targetValue:0;return(M.targetValue?M.currentValue/M.targetValue:0)-$;default:return 0}}),j=[{value:"fitness",label:"Fitness"},{value:"learning",label:"Learning"},{value:"career",label:"Career"},{value:"health",label:"Health"},{value:"finance",label:"Finance"},{value:"personal",label:"Personal"},{value:"creative",label:"Creative"},{value:"social",label:"Social"},{value:"other",label:"Other"}],P={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.05}}},k={hidden:{opacity:0,y:20},visible:{opacity:1,y:0}};return a.jsxs("div",{className:"w-full h-full min-h-screen p-0 m-0 space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between content-section",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Goals"}),a.jsx("p",{className:"text-muted-foreground",children:"Set targets and track your progress"})]}),a.jsxs(ht,{onClick:()=>s(!0),children:[a.jsx(Ai,{className:"h-4 w-4 mr-2"}),"New Goal"]})]}),a.jsx("div",{className:"content-section",children:a.jsx(mt,{children:a.jsxs(gt,{className:"p-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Gx,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx($n,{placeholder:"Search goals...",value:i,onChange:_=>o(_.target.value),className:"pl-10"})]}),a.jsxs(Ja,{value:l,onValueChange:c,children:[a.jsx(ia,{children:a.jsx(Qa,{placeholder:"Filter by status"})}),a.jsxs(aa,{children:[a.jsx(Rn,{value:"all",children:"All Status"}),a.jsx(Rn,{value:"active",children:"Active"}),a.jsx(Rn,{value:"completed",children:"Completed"}),a.jsx(Rn,{value:"paused",children:"Paused"}),a.jsx(Rn,{value:"archived",children:"Archived"})]})]}),a.jsxs(Ja,{value:d,onValueChange:f,children:[a.jsx(ia,{children:a.jsx(Qa,{placeholder:"Filter by category"})}),a.jsxs(aa,{children:[a.jsx(Rn,{value:"all",children:"All Categories"}),j.map(_=>a.jsx(Rn,{value:_.value,children:_.label},_.value))]})]}),a.jsxs(Ja,{value:m,onValueChange:g,children:[a.jsx(ia,{children:a.jsx(Qa,{placeholder:"Sort by"})}),a.jsxs(aa,{children:[a.jsx(Rn,{value:"updated",children:"Last Updated"}),a.jsx(Rn,{value:"created",children:"Date Created"}),a.jsx(Rn,{value:"title",children:"Title A-Z"}),a.jsx(Rn,{value:"progress",children:"Progress"})]})]})]}),(i||l!=="all"||d!=="all")&&a.jsxs("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",N.length," of ",e.length," goals"]}),a.jsx(ht,{variant:"ghost",size:"sm",onClick:()=>{o(""),c("all"),f("all")},children:"Clear Filters"})]})]})})}),a.jsx("div",{className:"content-section",children:e.length===0?a.jsx(mt,{children:a.jsxs(gt,{className:"text-center py-12",children:[a.jsx(xr,{className:"h-16 w-16 text-muted-foreground mx-auto mb-4"}),a.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No goals yet"}),a.jsx("p",{className:"text-muted-foreground mb-6",children:"Create your first goal to start tracking your progress"}),a.jsxs(ht,{onClick:()=>s(!0),children:[a.jsx(Ai,{className:"h-4 w-4 mr-2"}),"Create Your First Goal"]})]})}):N.length===0?a.jsx(mt,{children:a.jsxs(gt,{className:"text-center py-12",children:[a.jsx(o_,{className:"h-16 w-16 text-muted-foreground mx-auto mb-4"}),a.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No matching goals"}),a.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your search or filter criteria"})]})}):a.jsx(nt.div,{variants:P,initial:"hidden",animate:"visible",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:a.jsx(zo,{children:N.map(_=>a.jsx(nt.div,{variants:k,layout:!0,exit:{opacity:0,scale:.8},children:a.jsx(aE,{goal:_})},_.id))})})}),a.jsx(yN,{open:r,onOpenChange:s})]})}function lE({data:t,goals:e}){const n=I.useMemo(()=>{const r=t.reduce((s,i)=>{const o=Kn(new Date(i.date),"yyyy-MM-dd");s[o]||(s[o]={date:o,displayDate:Kn(new Date(i.date),"MMM dd")});const l=e.find(c=>c.id===i.goalId);if(l){const c=l.title.substring(0,20);s[o][c]=(s[o][c]||0)+i.value}return s},{});return Object.values(r).sort((s,i)=>new Date(s.date).getTime()-new Date(i.date).getTime())},[t,e]);return I.useMemo(()=>e.reduce((r,s)=>(r[s.title.substring(0,20)]=s.color,r),{}),[e]),n.length===0?a.jsx("div",{className:"h-64 flex items-center justify-center text-muted-foreground",children:a.jsx("p",{children:"No progress data to display"})}):a.jsx("div",{className:"h-64 w-full",children:a.jsx(Hd,{width:"100%",height:"100%",children:a.jsxs(O2,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(Bp,{strokeDasharray:"3 3",className:"opacity-30"}),a.jsx(Vp,{dataKey:"displayDate",tick:{fontSize:12},className:"text-muted-foreground"}),a.jsx(qp,{tick:{fontSize:12},className:"text-muted-foreground"}),a.jsx(Kd,{contentStyle:{backgroundColor:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"6px",color:"hsl(var(--card-foreground))"}}),a.jsx(R2,{}),e.map(r=>{const s=r.title.substring(0,20);return a.jsx(F2,{type:"monotone",dataKey:s,stroke:r.color,strokeWidth:2,dot:{fill:r.color,strokeWidth:2,r:4},activeDot:{r:6,stroke:r.color,strokeWidth:2}},r.id)})]})})})}function cE({progress:t,goals:e}){return t.length===0?a.jsxs("div",{className:"text-center py-8",children:[a.jsx(oi,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No progress entries yet"}),a.jsx("p",{className:"text-muted-foreground",children:"Start tracking your progress to see your journey here"})]}):a.jsx("div",{className:"space-y-4",children:t.map((n,r)=>{const s=e.find(i=>i.id===n.goalId);return a.jsx(nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:r*.05},children:a.jsx(mt,{className:"hover:shadow-md transition-shadow",children:a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex items-start space-x-4",children:[a.jsx("div",{className:"w-1 h-16 rounded-full flex-shrink-0",style:{backgroundColor:(s==null?void 0:s.color)||"#6B7280"}}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("h4",{className:"font-semibold text-sm",children:(s==null?void 0:s.title)||"Unknown Goal"}),a.jsx(Dn,{variant:"outline",className:"text-xs",children:(s==null?void 0:s.category)||"other"})]}),a.jsxs("div",{className:"flex items-center space-x-1 text-xs text-muted-foreground",children:[a.jsx(ys,{className:"h-3 w-3"}),a.jsx("span",{children:Dm(new Date(n.date),{addSuffix:!0})})]})]}),a.jsx("div",{className:"flex items-center space-x-2",children:a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx(oi,{className:"h-4 w-4 text-green-500"}),a.jsxs("span",{className:"font-medium text-lg",children:["+",n.value," ",(s==null?void 0:s.unit)||"units"]})]})}),n.note&&a.jsxs("div",{className:"flex items-start space-x-2",children:[a.jsx(Hx,{className:"h-4 w-4 text-muted-foreground mt-0.5 flex-shrink-0"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:n.note})]})]})]})})})},n.id)})})}function uE(){const{user:t}=Ir(),{goals:e,recentProgress:n,loadGoals:r,loadRecentProgress:s}=io(),[i,o]=I.useState(!1),[l,c]=I.useState("all");I.useEffect(()=>{t&&(r(t.id),s(t.id))},[t,r,s]);const d=e.filter(m=>m.status==="active"),f=l==="all"?n:n.filter(m=>m.goalId===l);return a.jsxs("div",{className:"w-full h-full min-h-screen p-0 m-0 space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between content-section",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Progress"}),a.jsx("p",{className:"text-muted-foreground",children:"Track and visualize your journey"})]}),a.jsxs(ht,{onClick:()=>o(!0),children:[a.jsx(Ai,{className:"h-4 w-4 mr-2"}),"Add Progress"]})]}),a.jsx("div",{className:"content-section",children:a.jsx(mt,{children:a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx("label",{className:"text-sm font-medium",children:"Filter by goal:"}),a.jsxs(Ja,{value:l,onValueChange:c,children:[a.jsx(ia,{className:"w-64",children:a.jsx(Qa,{placeholder:"Select a goal"})}),a.jsxs(aa,{children:[a.jsx(Rn,{value:"all",children:"All Goals"}),d.map(m=>a.jsx(Rn,{value:m.id,children:m.title},m.id))]})]}),a.jsxs(Dn,{variant:"outline",children:[f.length," entries"]})]})})})}),f.length>0&&a.jsx("div",{className:"content-section",children:a.jsx(nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(oi,{className:"h-5 w-5 mr-2"}),"Progress Overview"]}),a.jsx(cn,{children:"Visual representation of your progress over time"})]}),a.jsx(gt,{children:a.jsx(lE,{data:f,goals:l==="all"?d:d.filter(m=>m.id===l)})})]})})}),a.jsx("div",{className:"content-section",children:a.jsx(nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(ys,{className:"h-5 w-5 mr-2"}),"Recent Progress"]}),a.jsx(cn,{children:"Your latest progress entries"})]}),a.jsx(gt,{children:a.jsx(cE,{progress:f,goals:e})})]})})}),a.jsx(xN,{open:i,onOpenChange:o,goals:d})]})}function dE(){const{user:t}=Ir(),{goals:e,recentProgress:n,analytics:r,loadGoals:s,loadRecentProgress:i,loadAnalytics:o}=io();I.useEffect(()=>{t&&(s(t.id),i(t.id),o(t.id))},[t,s,i,o]);const l=e.reduce((g,v)=>{const N=g.find(j=>j.category===v.category);return N?(N.count+=1,N.completed+=v.status==="completed"?1:0):g.push({category:v.category,count:1,completed:v.status==="completed"?1:0}),g},[]),c=uD({start:eh(new Date,29),end:new Date}).map(v=>{const N=n.filter(j=>Kn(new Date(j.date),"yyyy-MM-dd")===Kn(v,"yyyy-MM-dd"));return{date:Kn(v,"MMM dd"),entries:N.length,value:N.reduce((j,P)=>j+P.value,0)}}),d=[{name:"Active",value:e.filter(g=>g.status==="active").length,color:"#10B981"},{name:"Completed",value:e.filter(g=>g.status==="completed").length,color:"#3B82F6"},{name:"Paused",value:e.filter(g=>g.status==="paused").length,color:"#F59E0B"},{name:"Archived",value:e.filter(g=>g.status==="archived").length,color:"#6B7280"}].filter(g=>g.value>0),f={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.1}}},m={hidden:{opacity:0,y:20},visible:{opacity:1,y:0}};return a.jsxs("div",{className:"w-full h-full min-h-screen p-0 m-0 space-y-6",children:[a.jsxs("div",{className:"content-section",children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Analytics"}),a.jsx("p",{className:"text-muted-foreground",children:"Insights and trends from your progress data"})]}),a.jsxs(nt.div,{variants:f,initial:"hidden",animate:"visible",className:"grid grid-cols-2 lg:grid-cols-4 gap-4 content-section",children:[a.jsx(nt.div,{variants:m,children:a.jsx(mt,{className:"bg-gradient-to-br from-blue-500/10 to-blue-500/5 border-blue-500/20",children:a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(xr,{className:"h-8 w-8 text-blue-500"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold",children:(r==null?void 0:r.totalGoals)||0}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Goals"})]})]})})})}),a.jsx(nt.div,{variants:m,children:a.jsx(mt,{className:"bg-gradient-to-br from-green-500/10 to-green-500/5 border-green-500/20",children:a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ta,{className:"h-8 w-8 text-green-500"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold",children:(r==null?void 0:r.completedGoals)||0}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Completed"})]})]})})})}),a.jsx(nt.div,{variants:m,children:a.jsx(mt,{className:"bg-gradient-to-br from-orange-500/10 to-orange-500/5 border-orange-500/20",children:a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(bh,{className:"h-8 w-8 text-orange-500"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold",children:(r==null?void 0:r.streakDays)||0}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Day Streak"})]})]})})})}),a.jsx(nt.div,{variants:m,children:a.jsx(mt,{className:"bg-gradient-to-br from-purple-500/10 to-purple-500/5 border-purple-500/20",children:a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Hk,{className:"h-8 w-8 text-purple-500"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold",children:n.length}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Entries"})]})]})})})})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 content-section",children:[a.jsx(nt.div,{variants:m,initial:"hidden",animate:"visible",transition:{delay:.2},children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(oi,{className:"h-5 w-5 mr-2"}),"Progress Trend (30 Days)"]}),a.jsx(cn,{children:"Daily progress entries over the last month"})]}),a.jsx(gt,{children:a.jsx("div",{className:"h-64",children:a.jsx(Hd,{width:"100%",height:"100%",children:a.jsxs(O2,{data:c,children:[a.jsx(Bp,{strokeDasharray:"3 3",className:"opacity-30"}),a.jsx(Vp,{dataKey:"date",tick:{fontSize:12},className:"text-muted-foreground"}),a.jsx(qp,{tick:{fontSize:12},className:"text-muted-foreground"}),a.jsx(Kd,{contentStyle:{backgroundColor:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"6px",color:"hsl(var(--card-foreground))"}}),a.jsx(F2,{type:"monotone",dataKey:"entries",stroke:"#3B82F6",strokeWidth:2,dot:{fill:"#3B82F6",strokeWidth:2,r:4},activeDot:{r:6}})]})})})})]})}),a.jsx(nt.div,{variants:m,initial:"hidden",animate:"visible",transition:{delay:.3},children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(Iu,{className:"h-5 w-5 mr-2"}),"Goal Status Distribution"]}),a.jsx(cn,{children:"Breakdown of your goals by current status"})]}),a.jsx(gt,{children:a.jsx("div",{className:"h-64",children:a.jsx(Hd,{width:"100%",height:"100%",children:a.jsxs(mj,{children:[a.jsx(gj,{data:d,cx:"50%",cy:"50%",innerRadius:60,outerRadius:100,paddingAngle:5,dataKey:"value",children:d.map((g,v)=>a.jsx(vj,{fill:g.color},`cell-${v}`))}),a.jsx(Kd,{contentStyle:{backgroundColor:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"6px",color:"hsl(var(--card-foreground))"}}),a.jsx(R2,{})]})})})})]})}),a.jsx(nt.div,{variants:m,initial:"hidden",animate:"visible",transition:{delay:.4},children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(Dc,{className:"h-5 w-5 mr-2"}),"Goals by Category"]}),a.jsx(cn,{children:"Distribution of goals across different categories"})]}),a.jsx(gt,{children:a.jsx("div",{className:"h-64",children:a.jsx(Hd,{width:"100%",height:"100%",children:a.jsxs(yj,{data:l,children:[a.jsx(Bp,{strokeDasharray:"3 3",className:"opacity-30"}),a.jsx(Vp,{dataKey:"category",tick:{fontSize:12},className:"text-muted-foreground"}),a.jsx(qp,{tick:{fontSize:12},className:"text-muted-foreground"}),a.jsx(Kd,{contentStyle:{backgroundColor:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"6px",color:"hsl(var(--card-foreground))"}}),a.jsx(h1,{dataKey:"count",fill:"#3B82F6",radius:[4,4,0,0]}),a.jsx(h1,{dataKey:"completed",fill:"#10B981",radius:[4,4,0,0]})]})})})})]})}),a.jsx(nt.div,{variants:m,initial:"hidden",animate:"visible",transition:{delay:.5},children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(ys,{className:"h-5 w-5 mr-2"}),"Active Goals Progress"]}),a.jsx(cn,{children:"Current progress on your active goals"})]}),a.jsx(gt,{children:a.jsxs("div",{className:"space-y-4",children:[e.filter(g=>g.status==="active").slice(0,5).map(g=>{const v=g.targetValue?Math.round(g.currentValue/g.targetValue*100):0;return a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:g.color}}),a.jsx("span",{className:"font-medium text-sm truncate",children:g.title})]}),a.jsxs(Dn,{variant:"outline",className:"text-xs",children:[v,"%"]})]}),a.jsx(ld,{value:v,className:"h-2"}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsxs("span",{children:[g.currentValue," ",g.unit]}),a.jsxs("span",{children:[g.targetValue," ",g.unit]})]})]},g.id)}),e.filter(g=>g.status==="active").length===0&&a.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[a.jsx(xr,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),a.jsx("p",{children:"No active goals to display"})]})]})})]})})]})]})}function hE(){const{user:t}=Ir(),{goals:e,recentProgress:n,loadGoals:r,loadRecentProgress:s}=io(),[i,o]=I.useState(new Date);I.useEffect(()=>{t&&(r(t.id),s(t.id))},[t,r,s]);const l=n.filter(m=>js(new Date(m.date),i)),c=n.map(m=>new Date(m.date)),d={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.1}}},f={hidden:{opacity:0,y:20},visible:{opacity:1,y:0}};return a.jsxs("div",{className:"w-full h-full min-h-screen p-0 m-0",children:[a.jsxs("div",{className:"content-section",children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Calendar"}),a.jsx("p",{className:"text-muted-foreground",children:"View your progress timeline and track daily activities"})]}),a.jsxs(nt.div,{variants:d,initial:"hidden",animate:"visible",className:"grid grid-cols-1 lg:grid-cols-3 gap-6 content-section",children:[a.jsx(nt.div,{variants:f,className:"lg:col-span-2",children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(ys,{className:"h-5 w-5 mr-2"}),"Progress Calendar"]}),a.jsx(cn,{children:"Click on any date to view progress entries"})]}),a.jsx(gt,{className:"flex justify-center",children:a.jsx(Af,{mode:"single",selected:i,onSelect:m=>m&&o(m),className:"rounded-md border",modifiers:{hasProgress:c},modifiersStyles:{hasProgress:{backgroundColor:"hsl(var(--primary))",color:"hsl(var(--primary-foreground))",fontWeight:"bold"}}})})]})}),a.jsx(nt.div,{variants:f,children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsx(Ht,{className:"text-lg",children:Kn(i,"MMMM dd, yyyy")}),a.jsx(cn,{children:"Progress entries for this date"})]}),a.jsx(gt,{children:l.length===0?a.jsxs("div",{className:"text-center py-8",children:[a.jsx(xr,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:"No progress entries for this date"})]}):a.jsx("div",{className:"space-y-4",children:l.map(m=>{const g=e.find(v=>v.id===m.goalId);return a.jsxs("div",{className:"flex items-start space-x-3 p-3 rounded-lg border bg-card/50",children:[a.jsx("div",{className:"w-3 h-3 rounded-full mt-2 flex-shrink-0",style:{backgroundColor:(g==null?void 0:g.color)||"#6B7280"}}),a.jsxs("div",{className:"flex-1 space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h4",{className:"font-medium text-sm",children:(g==null?void 0:g.title)||"Unknown Goal"}),a.jsx(Dn,{variant:"outline",className:"text-xs",children:g==null?void 0:g.category})]}),a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx(oi,{className:"h-4 w-4 text-green-500"}),a.jsxs("span",{className:"font-medium",children:["+",m.value," ",(g==null?void 0:g.unit)||"units"]})]}),m.note&&a.jsx("p",{className:"text-xs text-muted-foreground",children:m.note})]})]},m.id)})})})]})})]}),a.jsx(nt.div,{variants:f,initial:"hidden",animate:"visible",transition:{delay:.2},className:"content-section",children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsx(Ht,{children:"Monthly Summary"}),a.jsx(cn,{children:"Overview of your progress this month"})]}),a.jsx(gt,{children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"text-center p-4 rounded-lg bg-primary/5",children:[a.jsx("div",{className:"text-2xl font-bold text-primary",children:n.length}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Total Entries"})]}),a.jsxs("div",{className:"text-center p-4 rounded-lg bg-green-500/5",children:[a.jsx("div",{className:"text-2xl font-bold text-green-500",children:new Set(n.map(m=>Kn(new Date(m.date),"yyyy-MM-dd"))).size}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Active Days"})]}),a.jsxs("div",{className:"text-center p-4 rounded-lg bg-blue-500/5",children:[a.jsx("div",{className:"text-2xl font-bold text-blue-500",children:new Set(n.map(m=>m.goalId)).size}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Goals Worked On"})]})]})})]})})]})}function fE(){const{user:t}=Ir(),{goals:e,recentProgress:n,analytics:r,loadGoals:s,loadRecentProgress:i,loadAnalytics:o}=io();I.useEffect(()=>{t&&(s(t.id),i(t.id),o(t.id))},[t,s,i,o]);const l=[{id:"first-goal",title:"Getting Started",description:"Create your first goal",icon:a.jsx(xr,{className:"h-6 w-6"}),unlocked:e.length>0,rarity:"common"},{id:"goal-master",title:"Goal Master",description:"Create 10 goals",icon:a.jsx(ta,{className:"h-6 w-6"}),unlocked:e.length>=10,progress:Math.min(e.length,10),maxProgress:10,rarity:"rare"},{id:"first-progress",title:"First Steps",description:"Log your first progress entry",icon:a.jsx(Iu,{className:"h-6 w-6"}),unlocked:n.length>0,rarity:"common"},{id:"consistent-tracker",title:"Consistent Tracker",description:"Log progress for 7 consecutive days",icon:a.jsx(bh,{className:"h-6 w-6"}),unlocked:((r==null?void 0:r.streakDays)||0)>=7,progress:Math.min((r==null?void 0:r.streakDays)||0,7),maxProgress:7,rarity:"epic"},{id:"streak-master",title:"Streak Master",description:"Maintain a 30-day streak",icon:a.jsx(t_,{className:"h-6 w-6"}),unlocked:((r==null?void 0:r.streakDays)||0)>=30,progress:Math.min((r==null?void 0:r.streakDays)||0,30),maxProgress:30,rarity:"legendary"},{id:"goal-completer",title:"Goal Completer",description:"Complete your first goal",icon:a.jsx(Oo,{className:"h-6 w-6"}),unlocked:((r==null?void 0:r.completedGoals)||0)>0,rarity:"rare"},{id:"overachiever",title:"Overachiever",description:"Complete 5 goals",icon:a.jsx(f_,{className:"h-6 w-6"}),unlocked:((r==null?void 0:r.completedGoals)||0)>=5,progress:Math.min((r==null?void 0:r.completedGoals)||0,5),maxProgress:5,rarity:"epic"},{id:"progress-warrior",title:"Progress Warrior",description:"Log 100 progress entries",icon:a.jsx(Ic,{className:"h-6 w-6"}),unlocked:n.length>=100,progress:Math.min(n.length,100),maxProgress:100,rarity:"legendary"}],c=l.filter(N=>N.unlocked),d=l.filter(N=>!N.unlocked),f=N=>{switch(N){case"common":return"text-gray-500 border-gray-200";case"rare":return"text-blue-500 border-blue-200";case"epic":return"text-purple-500 border-purple-200";case"legendary":return"text-yellow-500 border-yellow-200";default:return"text-gray-500 border-gray-200"}},m=N=>{switch(N){case"common":return"bg-gray-50 dark:bg-gray-900/20";case"rare":return"bg-blue-50 dark:bg-blue-900/20";case"epic":return"bg-purple-50 dark:bg-purple-900/20";case"legendary":return"bg-yellow-50 dark:bg-yellow-900/20";default:return"bg-gray-50 dark:bg-gray-900/20"}},g={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.05}}},v={hidden:{opacity:0,y:20},visible:{opacity:1,y:0}};return a.jsxs("div",{className:"w-full h-full min-h-screen p-0 m-0",children:[a.jsxs("div",{className:"px-6 py-6",children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Achievements"}),a.jsx("p",{className:"text-muted-foreground",children:"Celebrate your milestones and unlock new badges"})]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 px-6 py-4",children:[a.jsx(mt,{children:a.jsxs(gt,{className:"p-4 text-center",children:[a.jsx(ta,{className:"h-8 w-8 text-yellow-500 mx-auto mb-2"}),a.jsx("div",{className:"text-2xl font-bold",children:c.length}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Unlocked"})]})}),a.jsx(mt,{children:a.jsxs(gt,{className:"p-4 text-center",children:[a.jsx(Iu,{className:"h-8 w-8 text-blue-500 mx-auto mb-2"}),a.jsx("div",{className:"text-2xl font-bold",children:l.length}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Total"})]})}),a.jsx(mt,{children:a.jsxs(gt,{className:"p-4 text-center",children:[a.jsx(bh,{className:"h-8 w-8 text-orange-500 mx-auto mb-2"}),a.jsx("div",{className:"text-2xl font-bold",children:(r==null?void 0:r.streakDays)||0}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Day Streak"})]})}),a.jsx(mt,{children:a.jsxs(gt,{className:"p-4 text-center",children:[a.jsx(Oo,{className:"h-8 w-8 text-green-500 mx-auto mb-2"}),a.jsxs("div",{className:"text-2xl font-bold",children:[Math.round(c.length/l.length*100),"%"]}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Complete"})]})})]}),c.length>0&&a.jsxs("div",{className:"px-6 py-4",children:[a.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Unlocked Achievements"}),a.jsx(nt.div,{variants:g,initial:"hidden",animate:"visible",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:c.map(N=>a.jsx(nt.div,{variants:v,children:a.jsx(mt,{className:`${m(N.rarity)} border-2 ${f(N.rarity)}`,children:a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${m(N.rarity)}`,children:a.jsx("div",{className:f(N.rarity),children:N.icon})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("h3",{className:"font-semibold",children:N.title}),a.jsx(Dn,{variant:"outline",className:f(N.rarity),children:N.rarity})]}),a.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:N.description}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ta,{className:"h-4 w-4 text-yellow-500"}),a.jsx("span",{className:"text-sm font-medium text-green-600",children:"Unlocked!"})]})]})]})})})},N.id))})]}),d.length>0&&a.jsxs("div",{className:"px-6 py-4",children:[a.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Locked Achievements"}),a.jsx(nt.div,{variants:g,initial:"hidden",animate:"visible",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:d.map(N=>a.jsx(nt.div,{variants:v,children:a.jsx(mt,{className:"opacity-60 hover:opacity-80 transition-opacity",children:a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx("div",{className:"p-2 rounded-lg bg-muted",children:a.jsx("div",{className:"text-muted-foreground",children:N.icon})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("h3",{className:"font-semibold",children:N.title}),a.jsx(Dn,{variant:"outline",className:f(N.rarity),children:N.rarity})]}),a.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:N.description}),N.maxProgress&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex justify-between text-xs",children:[a.jsx("span",{children:"Progress"}),a.jsxs("span",{children:[N.progress||0," / ",N.maxProgress]})]}),a.jsx(ld,{value:(N.progress||0)/N.maxProgress*100,className:"h-2"})]})]})]})})})},N.id))})]})]})}var pE="Separator",Oy="horizontal",mE=["horizontal","vertical"],bN=I.forwardRef((t,e)=>{const{decorative:n,orientation:r=Oy,...s}=t,i=gE(r)?r:Oy,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return a.jsx(sr.div,{"data-orientation":i,...l,...s,ref:e})});bN.displayName=pE;function gE(t){return mE.includes(t)}var wN=bN;const Wc=I.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>a.jsx(wN,{ref:s,decorative:n,orientation:e,className:vt("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));Wc.displayName=wN.displayName;var NN="AlertDialog",[vE,pO]=ed(NN,[E2]),ao=E2(),jN=t=>{const{__scopeAlertDialog:e,...n}=t,r=ao(e);return a.jsx(D2,{...r,...n,modal:!0})};jN.displayName=NN;var yE="AlertDialogTrigger",SN=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=ao(n);return a.jsx(I2,{...s,...r,ref:e})});SN.displayName=yE;var xE="AlertDialogPortal",kN=t=>{const{__scopeAlertDialog:e,...n}=t,r=ao(e);return a.jsx(L2,{...r,...n})};kN.displayName=xE;var bE="AlertDialogOverlay",_N=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=ao(n);return a.jsx(Ym,{...s,...r,ref:e})});_N.displayName=bE;var Ac="AlertDialogContent",[wE,NE]=vE(Ac),AN=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=ao(n),o=I.useRef(null),l=ks(e,o),c=I.useRef(null);return a.jsx(lj,{contentName:Ac,titleName:PN,docsSlug:"alert-dialog",children:a.jsx(wE,{scope:n,cancelRef:c,children:a.jsxs(Zm,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:rr(s.onOpenAutoFocus,d=>{var f;d.preventDefault(),(f=c.current)==null||f.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[a.jsx(cj,{children:r}),a.jsx(SE,{contentRef:o})]})})})});AN.displayName=Ac;var PN="AlertDialogTitle",CN=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=ao(n);return a.jsx(Jm,{...s,...r,ref:e})});CN.displayName=PN;var TN="AlertDialogDescription",LN=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=ao(n);return a.jsx(Qm,{...s,...r,ref:e})});LN.displayName=TN;var jE="AlertDialogAction",DN=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=ao(n);return a.jsx(Xm,{...s,...r,ref:e})});DN.displayName=jE;var IN="AlertDialogCancel",MN=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=NE(IN,n),i=ao(n),o=ks(e,s);return a.jsx(Xm,{...i,...r,ref:o})});MN.displayName=IN;var SE=({contentRef:t})=>{const e=`\`${Ac}\` requires a description for the component to be accessible for screen reader users.
You can add a description to the \`${Ac}\` by passing a \`${TN}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Ac}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return I.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},kE=jN,_E=SN,AE=kN,EN=_N,ON=AN,RN=DN,FN=MN,BN=CN,VN=LN;const Cp=kE,PE=_E,CE=AE,qN=I.forwardRef(({className:t,...e},n)=>a.jsx(EN,{className:vt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));qN.displayName=EN.displayName;const nh=I.forwardRef(({className:t,...e},n)=>a.jsxs(CE,{children:[a.jsx(qN,{}),a.jsx(ON,{ref:n,className:vt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));nh.displayName=ON.displayName;const rh=({className:t,...e})=>a.jsx("div",{className:vt("flex flex-col space-y-2 text-center sm:text-left",t),...e});rh.displayName="AlertDialogHeader";const sh=({className:t,...e})=>a.jsx("div",{className:vt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});sh.displayName="AlertDialogFooter";const ih=I.forwardRef(({className:t,...e},n)=>a.jsx(BN,{ref:n,className:vt("text-lg font-semibold",t),...e}));ih.displayName=BN.displayName;const ah=I.forwardRef(({className:t,...e},n)=>a.jsx(VN,{ref:n,className:vt("text-sm text-muted-foreground",t),...e}));ah.displayName=VN.displayName;const Mm=I.forwardRef(({className:t,...e},n)=>a.jsx(RN,{ref:n,className:vt(Tu(),t),...e}));Mm.displayName=RN.displayName;const oh=I.forwardRef(({className:t,...e},n)=>a.jsx(FN,{ref:n,className:vt(Tu({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));oh.displayName=FN.displayName;const Pl=class Pl{static getInstance(){return Pl.instance||(Pl.instance=new Pl),Pl.instance}async isSupported(){var r,s;if(console.log("🔐 Checking biometric support..."),"credentials"in navigator&&"create"in navigator.credentials)try{if(await((s=(r=navigator.credentials).isUserVerifyingPlatformAuthenticatorAvailable)==null?void 0:s.call(r)))return console.log("🔐 WebAuthn platform authenticator available"),!0}catch(i){console.log("🔐 WebAuthn check failed:",i)}const e=navigator.userAgent.toLowerCase(),n=e.includes("wv")||e.includes("pwabuilder")||e.includes("webapk")||!!window.Capacitor||!!window.cordova||window.matchMedia("(display-mode: standalone)").matches;return console.log("🔐 Environment detection:",{isAPK:n,userAgent:e}),n?window.Capacitor&&window.BiometricAuth?(console.log("🔐 Capacitor biometric available"),!0):window.cordova&&window.FingerprintAuth?(console.log("🔐 Cordova fingerprint available"),!0):(console.log("🔐 APK detected - biometric/PIN available"),!0):(console.log("🔐 Web browser - checking WebAuthn..."),"credentials"in navigator&&"create"in navigator.credentials)}async setupFingerprint(e){var n,r;try{if(console.log("🔐 Setting up biometric authentication for:",e),!await this.isSupported())return{success:!1,error:"Biometric authentication not supported"};const s=navigator.userAgent.toLowerCase();if(s.includes("wv")||s.includes("pwabuilder")||s.includes("webapk")||!!window.Capacitor||!!window.cordova||window.matchMedia("(display-mode: standalone)").matches){if(console.log("🔐 APK environment detected, trying native methods..."),window.Capacitor&&window.BiometricAuth)try{if(console.log("🔐 Trying Capacitor biometric..."),(await window.BiometricAuth.isAvailable()).isAvailable)return localStorage.setItem(`biometric_${e}`,JSON.stringify({method:"capacitor",enabled:!0,setupTime:Date.now()})),console.log("🔐 Capacitor biometric setup successful"),{success:!0}}catch(o){console.log("🔐 Capacitor biometric setup failed:",o)}if(window.cordova&&window.FingerprintAuth)try{return console.log("🔐 Trying Cordova fingerprint..."),await new Promise((o,l)=>{window.FingerprintAuth.isAvailable(c=>{c.isAvailable?o(!0):l(new Error("Fingerprint not available"))},l)}),localStorage.setItem(`biometric_${e}`,JSON.stringify({method:"cordova",enabled:!0,setupTime:Date.now()})),console.log("🔐 Cordova fingerprint setup successful"),{success:!0}}catch(o){console.log("🔐 Cordova fingerprint setup failed:",o)}}if("credentials"in navigator&&"create"in navigator.credentials)try{if(console.log("🔐 Trying WebAuthn setup..."),!await((r=(n=navigator.credentials).isUserVerifyingPlatformAuthenticatorAvailable)==null?void 0:r.call(n)))return console.log("🔐 Platform authenticator not available"),{success:!1,error:"Biometric authentication not available on this device"};const l=crypto.getRandomValues(new Uint8Array(32)),c=new TextEncoder().encode(e);console.log("🔐 Creating WebAuthn credential...");const d=await navigator.credentials.create({publicKey:{challenge:l,rp:{name:"ProgressPulse",id:window.location.hostname==="localhost"?"localhost":window.location.hostname},user:{id:c,name:e,displayName:"ProgressPulse User"},pubKeyCredParams:[{alg:-7,type:"public-key"},{alg:-257,type:"public-key"}],authenticatorSelection:{authenticatorAttachment:"platform",userVerification:"required",requireResidentKey:!1},timeout:6e4,attestation:"none"}});if(d&&"rawId"in d){const f={credentialId:Array.from(new Uint8Array(d.rawId)),method:"webauthn",enabled:!0,setupTime:Date.now()};return localStorage.setItem(`biometric_${e}`,JSON.stringify(f)),console.log("🔐 WebAuthn setup successful"),{success:!0}}}catch(o){return console.log("🔐 WebAuthn setup failed:",o),o.name==="NotAllowedError"?{success:!1,error:"Biometric setup was cancelled"}:o.name==="NotSupportedError"?{success:!1,error:"Biometric authentication not supported"}:o.name==="SecurityError"?{success:!1,error:"Security error - please try again"}:{success:!1,error:"Failed to setup biometric authentication"}}return{success:!1,error:"No biometric method available"}}catch(s){return console.error("🔐 Biometric setup error:",s),{success:!1,error:s.message||"Biometric setup failed"}}}async verifyFingerprint(e){try{console.log("🔐 Verifying biometric authentication for:",e);const n=localStorage.getItem(`biometric_${e}`);if(!n)return{success:!1,error:"No biometric authentication setup found"};const r=JSON.parse(n);if(console.log("🔐 Using biometric method:",r.method),r.method==="capacitor"&&window.Capacitor&&window.BiometricAuth)try{console.log("🔐 Verifying with Capacitor biometric...");const s=await window.BiometricAuth.verify({reason:"Authenticate to access ProgressPulse",title:"Biometric Authentication",subtitle:"Use your fingerprint or face to unlock",description:"Place your finger on the sensor or look at the camera"});return console.log("🔐 Capacitor verification result:",s),{success:s.verified}}catch(s){return console.log("🔐 Capacitor verification failed:",s),{success:!1,error:"Biometric verification failed"}}if(r.method==="cordova"&&window.cordova&&window.FingerprintAuth)try{return console.log("🔐 Verifying with Cordova fingerprint..."),await new Promise((s,i)=>{window.FingerprintAuth.show({clientId:"ProgressPulse",clientSecret:"password"},s,i)}),console.log("🔐 Cordova verification successful"),{success:!0}}catch(s){return console.log("🔐 Cordova verification failed:",s),{success:!1,error:"Fingerprint verification failed"}}if(r.method==="webauthn"&&r.credentialId)try{console.log("🔐 Verifying with WebAuthn...");const{credentialId:s}=r,i=crypto.getRandomValues(new Uint8Array(32));return await navigator.credentials.get({publicKey:{challenge:i,allowCredentials:[{id:new Uint8Array(s),type:"public-key"}],userVerification:"required",timeout:6e4,rpId:window.location.hostname==="localhost"?"localhost":window.location.hostname}})?(console.log("🔐 WebAuthn verification successful"),{success:!0}):(console.log("🔐 WebAuthn verification failed - no assertion"),{success:!1,error:"Biometric verification failed"})}catch(s){return console.log("🔐 WebAuthn verification failed:",s),s.name==="NotAllowedError"?{success:!1,error:"Biometric verification was cancelled"}:s.name==="SecurityError"?{success:!1,error:"Security error - please try again"}:{success:!1,error:"Biometric verification failed"}}return console.log("🔐 No valid biometric method found for verification"),{success:!1,error:"No valid biometric method found"}}catch(n){return console.error("🔐 Biometric verification error:",n),{success:!1,error:n.message||"Biometric verification failed"}}}setupPIN(e,n){localStorage.setItem(`pin_${e}`,btoa(n))}verifyPIN(e,n){return localStorage.getItem(`pin_${e}`)===btoa(n)}hasPIN(e){return!!localStorage.getItem(`pin_${e}`)}hasFingerprint(e){const n=localStorage.getItem(`biometric_${e}`);return n?JSON.parse(n).enabled:!1}setSessionAuthenticated(e){sessionStorage.setItem(`auth_session_${e}`,"true")}isSessionAuthenticated(e){return sessionStorage.getItem(`auth_session_${e}`)==="true"}clearSession(e){sessionStorage.removeItem(`auth_session_${e}`)}removePIN(e){localStorage.removeItem(`pin_${e}`)}removeFingerprint(e){localStorage.removeItem(`biometric_${e}`)}};Tn(Pl,"instance");let Em=Pl;const ps=Em.getInstance();function TE({userId:t,onComplete:e}){const[n,r]=I.useState(""),[s,i]=I.useState(""),[o,l]=I.useState(!1),[c,d]=I.useState(!1),f=()=>{if(n.length!==4){St.error("PIN must be 4 digits");return}if(n!==s){St.error("PINs do not match");return}ps.setupPIN(t,n),St.success("PIN setup successfully!"),r(""),i(""),e==null||e()},m=async()=>{d(!0);const v=await ps.setupFingerprint(t);v.success?(St.success("Fingerprint setup successfully!"),e==null||e()):St.error(v.error||"Failed to setup fingerprint"),d(!1)},g=(v,N)=>{v.length<=4&&/^\d*$/.test(v)&&N(v)};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center space-x-2",children:[a.jsx(Uo,{className:"h-5 w-5"}),a.jsx("span",{children:"Setup PIN"})]}),a.jsx(cn,{children:"Create a 4-digit PIN for quick access to your account"})]}),a.jsxs(gt,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{children:"Enter 4-digit PIN"}),a.jsxs("div",{className:"relative",children:[a.jsx($n,{type:o?"text":"password",placeholder:"••••",value:n,onChange:v=>g(v.target.value,r),className:"text-center text-2xl tracking-widest pr-10",maxLength:4}),a.jsx(ht,{type:"button",variant:"ghost",size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",onClick:()=>l(!o),children:o?a.jsx(Ng,{className:"h-4 w-4"}):a.jsx(sf,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{children:"Confirm PIN"}),a.jsx($n,{type:o?"text":"password",placeholder:"••••",value:s,onChange:v=>g(v.target.value,i),className:"text-center text-2xl tracking-widest",maxLength:4})]}),a.jsxs(ht,{onClick:f,disabled:n.length!==4||s.length!==4,className:"w-full",children:[a.jsx(Bo,{className:"h-4 w-4 mr-2"}),"Setup PIN"]})]})]}),a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center space-x-2",children:[a.jsx(xh,{className:"h-5 w-5"}),a.jsx("span",{children:"Setup Fingerprint"})]}),a.jsx(cn,{children:"Use your device's fingerprint sensor for secure access"})]}),a.jsx(gt,{children:a.jsxs(ht,{onClick:m,disabled:c,className:"w-full",variant:"outline",children:[a.jsx(xh,{className:"h-4 w-4 mr-2"}),c?"Setting up...":"Setup Fingerprint"]})})]})]})}const LE=dr.object({name:dr.string().min(2,"Name must be at least 2 characters"),email:dr.string().email("Invalid email address")});function DE(){var J;const{user:t,deleteAccount:e,changePassword:n}=Ir(),[r,s]=I.useState(!1),[i,o]=I.useState(!1),[l,c]=I.useState(!1),[d,f]=I.useState(!1),[m,g]=I.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[v,N]=I.useState(!1),[j,P]=I.useState(!1);I.useEffect(()=>{t&&(N(ps.hasPIN(t.id)),P(ps.hasFingerprint(t.id)))},[t]);const{register:k,handleSubmit:_,reset:M,formState:{errors:$}}=pf({resolver:mf(LE),defaultValues:{name:(t==null?void 0:t.name)||"",email:(t==null?void 0:t.email)||""}}),Y=async Z=>{o(!0);try{St.success("Profile updated successfully!"),s(!1)}catch{St.error("Failed to update profile")}finally{o(!1)}},U=()=>{M({name:(t==null?void 0:t.name)||"",email:(t==null?void 0:t.email)||""}),s(!1)},te=async()=>{const Z=await e();Z.success?St.success("Account deleted successfully"):St.error(Z.error||"Failed to delete account")},W=async()=>{if(m.newPassword!==m.confirmPassword){St.error("New passwords do not match");return}if(m.newPassword.length<8){St.error("New password must be at least 8 characters long");return}o(!0);const Z=await n(m.currentPassword,m.newPassword);Z.success?(St.success("Password changed successfully!"),c(!1),g({currentPassword:"",newPassword:"",confirmPassword:""})):St.error(Z.error||"Failed to change password"),o(!1)},ge=()=>{t&&(ps.removePIN(t.id),N(!1),St.success("PIN removed successfully"))},oe=()=>{t&&(ps.removeFingerprint(t.id),P(!1),St.success("Fingerprint removed successfully"))},B=()=>{t&&(N(ps.hasPIN(t.id)),P(ps.hasFingerprint(t.id)),f(!1))},T=()=>{St.success("Data export started - you will receive an email when ready")};return t?a.jsxs("div",{className:"w-full px-4 sm:px-6 lg:px-8 py-4 lg:py-6 space-y-4 sm:space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"Profile"}),a.jsx("p",{className:"text-muted-foreground text-sm sm:text-base",children:"Manage your account settings and preferences"})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 sm:gap-6",children:[a.jsx(nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"lg:col-span-2",children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"flex items-center",children:[a.jsx(Hc,{className:"h-5 w-5 mr-2"}),"Profile Information"]}),!r&&a.jsxs(ht,{variant:"outline",size:"sm",onClick:()=>s(!0),children:[a.jsx(Zx,{className:"h-4 w-4 mr-2"}),"Edit"]})]}),a.jsx(cn,{children:"Update your personal information and account details"})]}),a.jsx(gt,{children:a.jsxs("form",{onSubmit:_(Y),className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsxs(tf,{className:"h-20 w-20",children:[a.jsx(nf,{src:t.avatar}),a.jsx(rf,{className:"bg-primary/10 text-primary text-xl",children:(J=t.name)==null?void 0:J.charAt(0).toUpperCase()})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold",children:t.name}),a.jsx("p",{className:"text-muted-foreground",children:t.email}),a.jsxs(Dn,{variant:"outline",className:"mt-1",children:["Member since ",Kn(new Date(t.createdAt),"MMM yyyy")]})]})]}),a.jsx(Wc,{}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{htmlFor:"name",children:"Full Name"}),a.jsx($n,{id:"name",disabled:!r,...k("name")}),$.name&&a.jsx("p",{className:"text-sm text-destructive",children:$.name.message})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{htmlFor:"email",children:"Email Address"}),a.jsx($n,{id:"email",type:"email",disabled:!r,...k("email")}),$.email&&a.jsx("p",{className:"text-sm text-destructive",children:$.email.message})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{children:"Account Created"}),a.jsxs("div",{className:"flex items-center space-x-2 text-sm text-muted-foreground",children:[a.jsx(ys,{className:"h-4 w-4"}),a.jsx("span",{children:Kn(new Date(t.createdAt),"PPP")})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{children:"Last Updated"}),a.jsxs("div",{className:"flex items-center space-x-2 text-sm text-muted-foreground",children:[a.jsx(ys,{className:"h-4 w-4"}),a.jsx("span",{children:Kn(new Date(t.updatedAt),"PPP")})]})]})]}),r&&a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsxs(ht,{type:"button",variant:"outline",onClick:U,children:[a.jsx(rd,{className:"h-4 w-4 mr-2"}),"Cancel"]}),a.jsxs(ht,{type:"submit",disabled:i,children:[a.jsx(x_,{className:"h-4 w-4 mr-2"}),"Save Changes"]})]})]})})]})}),a.jsxs(nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"space-y-6",children:[a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(Bo,{className:"h-5 w-5 mr-2"}),"Security"]}),a.jsx(cn,{children:"Manage your account security settings"})]}),a.jsx(gt,{className:"space-y-3",children:a.jsxs(ht,{variant:"outline",className:"w-full justify-start",onClick:()=>c(!0),children:[a.jsx(Bo,{className:"h-4 w-4 mr-2"}),"Change Password"]})})]}),a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(Uo,{className:"h-5 w-5 mr-2"}),"Biometric Security"]}),a.jsx(cn,{children:"Setup PIN and fingerprint authentication"})]}),a.jsxs(gt,{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Uo,{className:"h-4 w-4"}),a.jsx("span",{className:"text-sm",children:"PIN Authentication"})]}),a.jsx("div",{className:"flex items-center space-x-2",children:v?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-xs text-green-600",children:"Enabled"}),a.jsx(ht,{variant:"outline",size:"sm",onClick:ge,children:"Remove"})]}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"Disabled"})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(xh,{className:"h-4 w-4"}),a.jsx("span",{className:"text-sm",children:"Fingerprint"})]}),a.jsx("div",{className:"flex items-center space-x-2",children:j?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-xs text-green-600",children:"Enabled"}),a.jsx(ht,{variant:"outline",size:"sm",onClick:oe,children:"Remove"})]}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"Disabled"})})]}),a.jsxs(ht,{variant:"outline",className:"w-full justify-start",onClick:()=>f(!0),children:[a.jsx(Bo,{className:"h-4 w-4 mr-2"}),"Setup Biometric Auth"]})]})]}),a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsx(Ht,{children:"Data Management"}),a.jsx(cn,{children:"Export or delete your account data"})]}),a.jsxs(gt,{className:"space-y-3",children:[a.jsxs(ht,{variant:"outline",className:"w-full justify-start",onClick:T,children:[a.jsx(ca,{className:"h-4 w-4 mr-2"}),"Export Data"]}),a.jsxs(Cp,{children:[a.jsx(PE,{asChild:!0,children:a.jsxs(ht,{variant:"destructive",className:"w-full justify-start",children:[a.jsx(jg,{className:"h-4 w-4 mr-2"}),"Delete Account"]})}),a.jsxs(nh,{children:[a.jsxs(rh,{children:[a.jsx(ih,{children:"Are you absolutely sure?"}),a.jsx(ah,{children:"This action cannot be undone. This will permanently delete your account and remove all your data from our servers."})]}),a.jsxs(sh,{children:[a.jsx(oh,{children:"Cancel"}),a.jsx(Mm,{onClick:te,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Yes, delete my account"})]})]})]})]})]}),a.jsx(Cp,{open:l,onOpenChange:c,children:a.jsxs(nh,{children:[a.jsxs(rh,{children:[a.jsx(ih,{children:"Change Password"}),a.jsx(ah,{children:"Enter your current password and choose a new one."})]}),a.jsxs("div",{className:"space-y-4 py-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{htmlFor:"currentPassword",children:"Current Password"}),a.jsx($n,{id:"currentPassword",type:"password",value:m.currentPassword,onChange:Z=>g(Ne=>({...Ne,currentPassword:Z.target.value})),placeholder:"Enter current password"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{htmlFor:"newPassword",children:"New Password"}),a.jsx($n,{id:"newPassword",type:"password",value:m.newPassword,onChange:Z=>g(Ne=>({...Ne,newPassword:Z.target.value})),placeholder:"Enter new password"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{htmlFor:"confirmPassword",children:"Confirm New Password"}),a.jsx($n,{id:"confirmPassword",type:"password",value:m.confirmPassword,onChange:Z=>g(Ne=>({...Ne,confirmPassword:Z.target.value})),placeholder:"Confirm new password"})]})]}),a.jsxs(sh,{children:[a.jsx(oh,{onClick:()=>{g({currentPassword:"",newPassword:"",confirmPassword:""})},children:"Cancel"}),a.jsx(Mm,{onClick:W,disabled:i||!m.currentPassword||!m.newPassword||!m.confirmPassword,children:i?"Changing...":"Change Password"})]})]})}),a.jsx(Cp,{open:d,onOpenChange:f,children:a.jsxs(nh,{className:"max-w-md",children:[a.jsxs(rh,{children:[a.jsx(ih,{children:"Setup Biometric Authentication"}),a.jsx(ah,{children:"Secure your account with PIN or fingerprint authentication."})]}),a.jsx("div",{className:"py-4",children:t&&a.jsx(TE,{userId:t.id,onComplete:B})}),a.jsx(sh,{children:a.jsx(oh,{children:"Close"})})]})}),a.jsxs(mt,{children:[a.jsx($t,{children:a.jsx(Ht,{children:"Account Statistics"})}),a.jsxs(gt,{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Account Age"}),a.jsxs("span",{className:"font-medium",children:[Math.floor((Date.now()-new Date(t.createdAt).getTime())/(1e3*60*60*24))," days"]})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Theme"}),a.jsx("span",{className:"font-medium capitalize",children:t.preferences.theme})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Notifications"}),a.jsx("span",{className:"font-medium",children:t.preferences.notifications?"Enabled":"Disabled"})]})]})]})]})]})]}):null}var D0="Switch",[IE,mO]=ed(D0),[ME,EE]=IE(D0),UN=I.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:d,form:f,...m}=t,[g,v]=I.useState(null),N=ks(e,M=>v(M)),j=I.useRef(!1),P=g?f||!!g.closest("form"):!0,[k=!1,_]=fh({prop:s,defaultProp:i,onChange:d});return a.jsxs(ME,{scope:n,checked:k,disabled:l,children:[a.jsx(sr.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":$N(k),"data-disabled":l?"":void 0,disabled:l,value:c,...m,ref:N,onClick:rr(t.onClick,M=>{_($=>!$),P&&(j.current=M.isPropagationStopped(),j.current||M.stopPropagation())})}),P&&a.jsx(OE,{control:g,bubbles:!j.current,name:r,value:c,checked:k,required:o,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});UN.displayName=D0;var zN="SwitchThumb",WN=I.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=EE(zN,n);return a.jsx(sr.span,{"data-state":$N(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});WN.displayName=zN;var OE=t=>{const{control:e,checked:n,bubbles:r=!0,...s}=t,i=I.useRef(null),o=tw(n),l=uj(e);return I.useEffect(()=>{const c=i.current,d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"checked").set;if(o!==n&&m){const g=new Event("click",{bubbles:r});m.call(c,n),c.dispatchEvent(g)}},[o,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:i,style:{...t.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function $N(t){return t?"checked":"unchecked"}var HN=UN,RE=WN;const wc=I.forwardRef(({className:t,...e},n)=>a.jsx(HN,{className:vt("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:a.jsx(RE,{className:vt("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));wc.displayName=HN.displayName;const FE=nd("inline-flex items-center justify-center whitespace-nowrap font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/20 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{primary:"btn-ios-primary",secondary:"btn-ios-secondary",ghost:"hover:bg-muted/20 text-foreground rounded-2xl",destructive:"bg-red-500 text-white hover:bg-red-600 rounded-2xl shadow-lg",outline:"border-2 border-border bg-transparent hover:bg-muted/20 rounded-2xl"},size:{default:"h-12 px-6 py-3",sm:"h-10 px-4 py-2 text-sm",lg:"h-14 px-8 py-4 text-lg",icon:"h-12 w-12"}},defaultVariants:{variant:"primary",size:"default"}}),lh=I.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,haptic:s=!0,children:i,...o},l)=>{const c=r?Kh:"button",d=a.jsx(c,{className:vt(FE({variant:e,size:n,className:t})),ref:l,...o,children:i});return s?a.jsx(nt.div,{whileHover:{scale:1.02},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:17},className:"inline-block",children:d}):d});lh.displayName="IOSButton";const KN=I.forwardRef(({className:t,value:e=0,max:n=100,size:r="md",variant:s="default",animated:i=!0,showValue:o=!1,label:l,...c},d)=>{const f=Math.min(Math.max(e/n*100,0),100),m={sm:"h-2",md:"h-3",lg:"h-4"},g={default:"from-primary to-primary/80",success:"from-green-500 to-green-400",warning:"from-yellow-500 to-yellow-400",error:"from-red-500 to-red-400"};return a.jsxs("div",{className:"space-y-2",children:[(l||o)&&a.jsxs("div",{className:"flex justify-between items-center",children:[l&&a.jsx("span",{className:"text-ios-caption text-muted-foreground",children:l}),o&&a.jsxs(nt.span,{className:"text-ios-caption font-medium",animate:i?{scale:[1,1.1,1]}:{},transition:{duration:.3},children:[Math.round(f),"%"]},f)]}),a.jsxs("div",{ref:d,className:vt("progress-ios overflow-hidden",m[r],t),...c,children:[a.jsx(nt.div,{className:vt("h-full rounded-full bg-gradient-to-r",g[s]),initial:{width:0},animate:{width:`${f}%`},transition:i?{duration:.8,ease:"easeOut",type:"spring",stiffness:100,damping:15}:{duration:0}}),i&&f>0&&a.jsx(nt.div,{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent",animate:{x:["-100%","100%"]},transition:{duration:2,repeat:1/0,ease:"linear",delay:.5},style:{width:`${f}%`}})]})]})});KN.displayName="IOSProgress";function BE(){const{availableUpdate:t,updateProgress:e,downloadUpdate:n,checkForUpdates:r,dismissUpdate:s,wifiOnlyUpdates:i}=xg(),[o,l]=I.useState(!1),c=async()=>{t&&(l(!0),await n(t))},d=async()=>{await r()},f=k=>{if(k===0)return"0 Bytes";const _=1024,M=["Bytes","KB","MB","GB"],$=Math.floor(Math.log(k)/Math.log(_));return parseFloat((k/Math.pow(_,$)).toFixed(2))+" "+M[$]},m=k=>f(k)+"/s",g=k=>{if(!isFinite(k)||k<=0)return"0s";const _=Math.floor(k/60),M=Math.floor(k%60);return _>0?`${_}m ${M}s`:`${M}s`},v=()=>{switch(e.phase){case"checking":return a.jsx(Nh,{className:"h-4 w-4 animate-spin"});case"downloading":return a.jsx(ca,{className:"h-4 w-4"});case"installing":return a.jsx(Nh,{className:"h-4 w-4 animate-spin"});case"complete":return a.jsx(zx,{className:"h-4 w-4 text-green-500"});case"error":return a.jsx(Ux,{className:"h-4 w-4 text-red-500"});default:return a.jsx(ca,{className:"h-4 w-4"})}},N=()=>{switch(e.phase){case"checking":return"Checking for updates...";case"downloading":return"Downloading update...";case"installing":return"Installing update...";case"complete":return"Update complete!";case"error":return"Update failed";default:return t?"Update available":"Check for updates"}},j=()=>{if(!i||!("connection"in navigator))return!0;const k=navigator.connection;return!k||k.type==="wifi"},P=["checking","downloading","installing"].includes(e.phase);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(nt.div,{layout:!0,className:vt("card-ios p-4 transition-all duration-300",t&&"border-primary/30 bg-primary/5",e.phase==="error"&&"border-red-500/30 bg-red-500/5"),children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx(nt.div,{animate:P?{rotate:360}:{},transition:{duration:2,repeat:P?1/0:0,ease:"linear"},children:v()}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-ios-body font-semibold",children:N()}),t&&a.jsxs("p",{className:"text-ios-caption text-muted-foreground",children:["Version ",t.version," • ",f(t.size)]}),e.phase==="error"&&e.error&&a.jsx("p",{className:"text-ios-caption text-red-500",children:e.error})]})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[t&&a.jsx(nt.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},className:vt("p-1 rounded-lg",j()?"text-green-500":"text-orange-500"),children:j()?a.jsx(kg,{className:"h-4 w-4"}):a.jsx(Sg,{className:"h-4 w-4"})}),t?a.jsx(lh,{size:"sm",variant:e.phase==="error"?"destructive":"primary",onClick:c,disabled:P||!j(),children:e.phase==="error"?"Retry":"Update"}):a.jsx(lh,{size:"sm",variant:"secondary",onClick:d,disabled:e.phase==="checking",children:"Check"})]})]}),a.jsx(zo,{children:(P||e.phase==="complete")&&a.jsxs(nt.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.3},className:"mt-4 space-y-3",children:[a.jsx(KN,{value:e.progress,variant:e.phase==="complete"?"success":e.phase==="error"?"error":"default",showValue:!0,animated:!0}),e.phase==="downloading"&&a.jsxs("div",{className:"flex justify-between text-ios-caption text-muted-foreground",children:[a.jsxs("span",{children:[f(e.downloadedBytes)," / ",f(e.totalBytes)]}),a.jsxs("span",{children:[m(e.speed)," • ",g(e.timeRemaining)," remaining"]})]})]})})]}),a.jsx(zo,{children:t&&a.jsxs(nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"card-ios p-4",children:[a.jsx("h4",{className:"text-ios-body font-semibold mb-3",children:"What's New"}),a.jsx("ul",{className:"space-y-2",children:t.changes.map((k,_)=>a.jsxs(nt.li,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:_*.1},className:"flex items-start space-x-2 text-ios-caption",children:[a.jsx("span",{className:"text-primary mt-1",children:"•"}),a.jsx("span",{children:k})]},_))}),a.jsxs("div",{className:"flex justify-between items-center mt-4 pt-3 border-t border-border",children:[a.jsxs("span",{className:"text-ios-caption text-muted-foreground",children:["Released ",new Date(t.timestamp).toLocaleDateString()]}),a.jsx(lh,{size:"sm",variant:"ghost",onClick:s,children:"Dismiss"})]})]})})]})}const dc=I.forwardRef(({className:t,variant:e="default",interactive:n=!1,children:r,...s},i)=>{const o=vt("rounded-2xl transition-all duration-300",{"card-ios":e==="default","card-ios-glass":e==="glass","card-ios shadow-ios-lg":e==="elevated"},t);return n?a.jsx(nt.div,{ref:i,className:o,whileHover:{scale:1.02,y:-2,transition:{duration:.2}},whileTap:{scale:.98,transition:{duration:.1}},...s,children:r}):a.jsx("div",{ref:i,className:o,...s,children:r})});dc.displayName="IOSCard";const VE=I.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:vt("flex flex-col space-y-1.5 p-6",t),...e}));VE.displayName="IOSCardHeader";const qE=I.forwardRef(({className:t,...e},n)=>a.jsx("h3",{ref:n,className:vt("text-ios-headline leading-none tracking-tight",t),...e}));qE.displayName="IOSCardTitle";const UE=I.forwardRef(({className:t,...e},n)=>a.jsx("p",{ref:n,className:vt("text-ios-body text-muted-foreground",t),...e}));UE.displayName="IOSCardDescription";const zE=I.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:vt("p-6 pt-0",t),...e}));zE.displayName="IOSCardContent";const WE=I.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:vt("flex items-center p-6 pt-0",t),...e}));WE.displayName="IOSCardFooter";function $E(){const{currentVersion:t,updateHistory:e,autoUpdate:n,updateNotifications:r,wifiOnlyUpdates:s,setAutoUpdate:i,setUpdateNotifications:o,setWifiOnlyUpdates:l}=xg(),[c,d]=I.useState(!1),[f,m]=I.useState("09:00"),[g,v]=I.useState("default");I.useEffect(()=>{const M=localStorage.getItem("daily-reminders")==="true",$=localStorage.getItem("reminder-time")||"09:00";d(M),m($),v(cr.notificationPermission),M&&cr.notificationPermission==="granted"&&cr.setupDailyReminders($)},[]);const N=async M=>{if(M&&cr.notificationPermission!=="granted"){if(!await cr.requestPermission())return;v("granted")}d(M),localStorage.setItem("daily-reminders",M.toString()),M&&await cr.setupDailyReminders(f)},j=async M=>{m(M),localStorage.setItem("reminder-time",M),c&&await cr.setupDailyReminders(M)},P=async()=>{if(cr.notificationPermission!=="granted"){if(!await cr.requestPermission())return;v("granted")}await cr.sendTestNotification()},k=M=>new Date(M).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),_=M=>{if(M===0)return"0 Bytes";const $=1024,Y=["Bytes","KB","MB","GB"],U=Math.floor(Math.log(M)/Math.log($));return parseFloat((M/Math.pow($,U)).toFixed(2))+" "+Y[U]};return a.jsxs("div",{className:"space-y-6",children:[a.jsx(dc,{children:a.jsx("div",{className:"p-6",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"p-2 bg-primary/10 rounded-xl",children:a.jsx(wh,{className:"h-5 w-5 text-primary"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-ios-body font-semibold",children:"Current Version"}),a.jsxs("p",{className:"text-ios-caption text-muted-foreground",children:["ProgressPulse v",t]})]})]}),a.jsx(Dn,{variant:"secondary",children:"Latest"})]})})}),a.jsx(dc,{children:a.jsxs("div",{className:"p-6",children:[a.jsx("h3",{className:"text-ios-headline mb-4",children:"Update Preferences"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"p-2 bg-green-500/10 rounded-xl",children:a.jsx(ca,{className:"h-4 w-4 text-green-500"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-ios-body font-medium",children:"Automatic Updates"}),a.jsx("p",{className:"text-ios-caption text-muted-foreground",children:"Install updates automatically"})]})]}),a.jsx(wc,{checked:n,onCheckedChange:i})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"p-2 bg-blue-500/10 rounded-xl",children:a.jsx(Ci,{className:"h-4 w-4 text-blue-500"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-ios-body font-medium",children:"Update Notifications"}),a.jsx("p",{className:"text-ios-caption text-muted-foreground",children:"Get notified when updates are available"})]})]}),a.jsx(wc,{checked:r,onCheckedChange:o})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"p-2 bg-orange-500/10 rounded-xl",children:a.jsx(kg,{className:"h-4 w-4 text-orange-500"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-ios-body font-medium",children:"WiFi Only"}),a.jsx("p",{className:"text-ios-caption text-muted-foreground",children:"Download updates only on WiFi"})]})]}),a.jsx(wc,{checked:s,onCheckedChange:l})]})]})]})}),a.jsx(dc,{children:a.jsxs("div",{className:"p-6",children:[a.jsx("h3",{className:"text-ios-headline mb-4",children:"Daily Reminders"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"p-2 bg-purple-500/10 rounded-xl",children:a.jsx(Wx,{className:"h-4 w-4 text-purple-500"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-ios-body font-medium",children:"Daily Progress Reminders"}),a.jsx("p",{className:"text-ios-caption text-muted-foreground",children:"Get reminded to check your progress"})]})]}),a.jsx(wc,{checked:c,onCheckedChange:N})]}),c&&a.jsx(nt.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"pl-11",children:a.jsx("div",{className:"flex items-center space-x-3",children:a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"text-ios-body font-medium mb-2",children:"Reminder Time"}),a.jsx($n,{type:"time",value:f,onChange:M=>j(M.target.value),className:"w-32"})]})})}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"p-2 bg-pink-500/10 rounded-xl",children:a.jsx(j_,{className:"h-4 w-4 text-pink-500"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-ios-body font-medium",children:"Test Notifications"}),a.jsx("p",{className:"text-ios-caption text-muted-foreground",children:"Send a test notification"})]})]}),a.jsx(ht,{variant:"outline",size:"sm",onClick:P,disabled:g==="denied",children:"Test"})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:`p-2 rounded-xl ${g==="granted"?"bg-green-500/10":g==="denied"?"bg-red-500/10":"bg-yellow-500/10"}`,children:a.jsx(Ci,{className:`h-4 w-4 ${g==="granted"?"text-green-500":g==="denied"?"text-red-500":"text-yellow-500"}`})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-ios-body font-medium",children:"Notification Permission"}),a.jsxs("p",{className:"text-ios-caption text-muted-foreground",children:[g==="granted"&&"Notifications enabled",g==="denied"&&"Notifications blocked",g==="default"&&"Permission not requested"]})]})]}),a.jsxs(Dn,{variant:g==="granted"?"default":g==="denied"?"destructive":"secondary",children:[g==="granted"&&"✅ Enabled",g==="denied"&&"❌ Blocked",g==="default"&&"⏳ Pending"]})]}),cr.isRunningAsAPK&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsx("div",{className:"p-2 bg-indigo-500/10 rounded-xl",children:a.jsx(wh,{className:"h-4 w-4 text-indigo-500"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-ios-body font-medium",children:"Running as APK"}),a.jsx("p",{className:"text-ios-caption text-muted-foreground",children:"Enhanced notification support"})]})]}),a.jsx(Dn,{variant:"outline",children:"📱 APK"})]})]})]})}),a.jsx(dc,{children:a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[a.jsx("div",{className:"p-2 bg-purple-500/10 rounded-xl",children:a.jsx(H1,{className:"h-5 w-5 text-purple-500"})}),a.jsx("h3",{className:"text-ios-headline",children:"Update History"})]}),e.length===0?a.jsxs("div",{className:"text-center py-8",children:[a.jsx(H1,{className:"h-12 w-12 text-muted-foreground mx-auto mb-3 opacity-50"}),a.jsx("p",{className:"text-ios-body text-muted-foreground",children:"No update history yet"}),a.jsx("p",{className:"text-ios-caption text-muted-foreground",children:"Updates will appear here once installed"})]}):a.jsx("div",{className:"space-y-3",children:e.map((M,$)=>a.jsxs(nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:$*.1},className:"p-4 bg-muted/20 rounded-xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsxs("span",{className:"text-ios-body font-semibold",children:["v",M.version]}),M.critical&&a.jsx(Dn,{variant:"destructive",className:"text-xs",children:"Critical"})]}),a.jsx("span",{className:"text-ios-caption text-muted-foreground",children:_(M.size)})]}),a.jsxs("p",{className:"text-ios-caption text-muted-foreground mb-2",children:["Installed ",k(M.timestamp)]}),M.changes.length>0&&a.jsxs("div",{className:"space-y-1",children:[M.changes.slice(0,2).map((Y,U)=>a.jsxs("p",{className:"text-ios-caption flex items-start space-x-2",children:[a.jsx("span",{className:"text-primary mt-1",children:"•"}),a.jsx("span",{children:Y})]},U)),M.changes.length>2&&a.jsxs("p",{className:"text-ios-caption text-muted-foreground",children:["+",M.changes.length-2," more changes"]})]})]},`${M.version}-${M.timestamp}`))})]})}),a.jsx(dc,{variant:"glass",children:a.jsxs("div",{className:"p-6",children:[a.jsx("h4",{className:"text-ios-body font-semibold mb-3",children:"About Updates"}),a.jsxs("div",{className:"space-y-2 text-ios-caption text-muted-foreground",children:[a.jsx("p",{children:"• Updates are delivered securely and verified before installation"}),a.jsx("p",{children:"• Critical security updates are installed automatically"}),a.jsx("p",{children:"• You can always check for updates manually"}),a.jsx("p",{children:"• Update history is kept for your reference"})]})]})})]})}function HE(){const{user:t,updatePreferences:e}=Ir(),{theme:n,setTheme:r}=V2();so();const[s,i]=I.useState(!1),[o,l]=I.useState(!1),[c,d]=I.useState(""),[f,m]=I.useState(""),[g,v]=I.useState(""),N=async($,Y)=>{i(!0);try{await e({[$]:Y}),St.success("Settings updated successfully!")}catch{St.error("Failed to update settings")}finally{i(!1)}},j=async()=>{if(f!==g){St.error("Passwords do not match");return}if(f.length<8){St.error("Password must be at least 8 characters");return}i(!0);try{await new Promise($=>setTimeout($,1e3)),St.success("Password changed successfully!"),l(!1),d(""),m(""),v("")}catch{St.error("Failed to change password")}finally{i(!1)}},P=async()=>{i(!0);try{await new Promise(W=>setTimeout(W,2e3));const $={user:t,exportDate:new Date().toISOString(),note:"This is your exported ProgressPulse data"},Y=new Blob([JSON.stringify($,null,2)],{type:"application/json"}),U=URL.createObjectURL(Y),te=document.createElement("a");te.href=U,te.download=`progresspulse-data-${new Date().toISOString().split("T")[0]}.json`,document.body.appendChild(te),te.click(),document.body.removeChild(te),URL.revokeObjectURL(U),St.success("Data exported successfully!")}catch{St.error("Failed to export data")}finally{i(!1)}},k=async $=>{if($&&"Notification"in window)if(await Notification.requestPermission()==="granted")St.success("Notifications enabled!"),await N("notifications",!0),new Notification("ProgressPulse",{body:"Notifications are now enabled!",icon:"/pwa-192x192.png"});else{St.error("Notification permission denied");return}else await N("notifications",$)},_={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.1}}},M={hidden:{opacity:0,y:20},visible:{opacity:1,y:0}};return a.jsxs("div",{className:"w-full px-4 sm:px-6 lg:px-8 py-4 lg:py-6 space-y-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Settings"}),a.jsx("p",{className:"text-muted-foreground",children:"Customize your app experience and preferences"})]}),a.jsxs(nt.div,{variants:_,initial:"hidden",animate:"visible",className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsx(nt.div,{variants:M,children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(m_,{className:"h-5 w-5 mr-2"}),"Appearance"]}),a.jsx(cn,{children:"Customize the look and feel of your app"})]}),a.jsxs(gt,{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx(bn,{children:"Theme"}),a.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[a.jsxs(ht,{variant:n==="light"?"default":"outline",size:"sm",onClick:()=>r("light"),className:"flex items-center justify-center",children:[a.jsx(Xx,{className:"h-4 w-4 mr-2"}),"Light"]}),a.jsxs(ht,{variant:n==="dark"?"default":"outline",size:"sm",onClick:()=>r("dark"),className:"flex items-center justify-center",children:[a.jsx(Kx,{className:"h-4 w-4 mr-2"}),"Dark"]}),a.jsxs(ht,{variant:n==="system"?"default":"outline",size:"sm",onClick:()=>r("system"),className:"flex items-center justify-center",children:[a.jsx(p_,{className:"h-4 w-4 mr-2"}),"System"]})]})]}),a.jsx(Wc,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(bn,{children:"Week starts on"}),a.jsxs(Ja,{value:t==null?void 0:t.preferences.weekStartsOn.toString(),onValueChange:$=>N("weekStartsOn",parseInt($)),children:[a.jsx(ia,{children:a.jsx(Qa,{})}),a.jsxs(aa,{children:[a.jsx(Rn,{value:"0",children:"Sunday"}),a.jsx(Rn,{value:"1",children:"Monday"})]})]})]})]})]})}),a.jsx(nt.div,{variants:M,children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(Ci,{className:"h-5 w-5 mr-2"}),"Notifications"]}),a.jsx(cn,{children:"Manage your notification preferences"})]}),a.jsxs(gt,{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-0.5",children:[a.jsx(bn,{children:"Enable Notifications"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Receive reminders and updates"})]}),a.jsx(wc,{checked:t==null?void 0:t.preferences.notifications,onCheckedChange:k,disabled:s})]}),a.jsx(Wc,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(bn,{children:"Daily Reminder Time"}),a.jsxs(Ja,{value:(t==null?void 0:t.preferences.reminderTime)||"09:00",onValueChange:$=>N("reminderTime",$),disabled:!(t!=null&&t.preferences.notifications),children:[a.jsx(ia,{children:a.jsx(Qa,{})}),a.jsxs(aa,{children:[a.jsx(Rn,{value:"07:00",children:"7:00 AM"}),a.jsx(Rn,{value:"08:00",children:"8:00 AM"}),a.jsx(Rn,{value:"09:00",children:"9:00 AM"}),a.jsx(Rn,{value:"10:00",children:"10:00 AM"}),a.jsx(Rn,{value:"18:00",children:"6:00 PM"}),a.jsx(Rn,{value:"19:00",children:"7:00 PM"}),a.jsx(Rn,{value:"20:00",children:"8:00 PM"}),a.jsx(Rn,{value:"21:00",children:"9:00 PM"})]})]})]})]})]})}),a.jsx(nt.div,{variants:M,children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(Bo,{className:"h-5 w-5 mr-2"}),"Security"]}),a.jsx(cn,{children:"Manage your account security settings"})]}),a.jsx(gt,{className:"space-y-4",children:a.jsxs(g0,{open:o,onOpenChange:l,children:[a.jsx(HL,{asChild:!0,children:a.jsxs(ht,{variant:"outline",className:"w-full justify-start",children:[a.jsx(d_,{className:"mr-2 h-4 w-4"}),"Change Password"]})}),a.jsxs(wf,{children:[a.jsxs(Nf,{children:[a.jsx(jf,{children:"Change Password"}),a.jsx(Sf,{children:"Enter your current password and choose a new one"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{children:"Current Password"}),a.jsx($n,{type:"password",value:c,onChange:$=>d($.target.value),placeholder:"Enter current password"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{children:"New Password"}),a.jsx($n,{type:"password",value:f,onChange:$=>m($.target.value),placeholder:"Enter new password"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(bn,{children:"Confirm New Password"}),a.jsx($n,{type:"password",value:g,onChange:$=>v($.target.value),placeholder:"Confirm new password"})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(ht,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),a.jsx(ht,{onClick:j,disabled:s,children:s?"Changing...":"Change Password"})]})]})]})]})})]})}),a.jsx(nt.div,{variants:M,children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsx(Ht,{children:"Data Management"}),a.jsx(cn,{children:"Export or delete your account data"})]}),a.jsxs(gt,{className:"space-y-4",children:[a.jsxs(ht,{variant:"outline",className:"w-full justify-start",onClick:P,disabled:s,children:[a.jsx(ca,{className:"mr-2 h-4 w-4"}),s?"Exporting...":"Export Data"]}),a.jsxs(ht,{variant:"outline",className:"w-full justify-start",children:[a.jsx(Sc,{className:"mr-2 h-4 w-4"}),"Privacy Policy"]}),a.jsxs(ht,{variant:"outline",className:"w-full justify-start",children:[a.jsx(Lu,{className:"mr-2 h-4 w-4"}),"Terms of Service"]})]})]})}),a.jsx(nt.div,{variants:M,className:"lg:col-span-2",children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(Yx,{className:"h-5 w-5 mr-2"}),"App Information"]}),a.jsx(cn,{children:"About this application"})]}),a.jsx(gt,{children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Version"}),a.jsx("span",{className:"font-medium",children:"1.0.0"})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Build"}),a.jsx("span",{className:"font-medium",children:"2024.01.15"})]}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("span",{className:"text-muted-foreground",children:"Platform"}),a.jsx("span",{className:"font-medium",children:"Progressive Web App"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(ht,{variant:"outline",className:"w-full justify-start",children:[a.jsx(ys,{className:"h-4 w-4 mr-2"}),"What's New"]}),a.jsxs(ht,{variant:"outline",className:"w-full justify-start",children:[a.jsx(Ci,{className:"h-4 w-4 mr-2"}),"Release Notes"]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(ht,{variant:"outline",className:"w-full justify-start",children:[a.jsx(Lu,{className:"h-4 w-4 mr-2"}),"Help & Support"]}),a.jsxs(ht,{variant:"outline",className:"w-full justify-start",children:[a.jsx(Sc,{className:"h-4 w-4 mr-2"}),"Documentation"]})]})]})})]})}),a.jsx(nt.div,{variants:M,className:"lg:col-span-2",children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(Nh,{className:"h-5 w-5 mr-2"}),"App Updates"]}),a.jsx(cn,{children:"Manage app updates and version information"})]}),a.jsx(gt,{children:a.jsx(BE,{})})]})}),a.jsx(nt.div,{variants:M,className:"lg:col-span-2",children:a.jsx($E,{})})]})]})}function KE(){const{user:t}=Ir(),e=so(),[n,r]=I.useState([]),[s,i]=I.useState(!0);I.useEffect(()=>{t&&o()},[t]);const o=async()=>{if(t)try{const g=await Ln.getNotificationsByUser(t.id);r(g)}catch(g){console.error("Failed to load notifications:",g),St.error("Failed to load notifications")}finally{i(!1)}},l=async g=>{try{await Ln.notifications.update(g,{read:!0}),r(v=>v.map(N=>N.id===g?{...N,read:!0}:N)),St.success("Notification marked as read")}catch(v){console.error("Failed to mark notification as read:",v),St.error("Failed to mark notification as read")}},c=async()=>{try{const g=n.filter(v=>!v.read);for(const v of g)await Ln.notifications.update(v.id,{read:!0});r(v=>v.map(N=>({...N,read:!0}))),St.success("All notifications marked as read")}catch(g){console.error("Failed to mark all notifications as read:",g),St.error("Failed to mark all notifications as read")}},d=async g=>{try{await Ln.notifications.delete(g),r(v=>v.filter(N=>N.id!==g)),St.success("Notification deleted")}catch(v){console.error("Failed to delete notification:",v),St.error("Failed to delete notification")}},f=g=>{switch(g){case"reminder":return a.jsx(Ci,{className:"h-5 w-5 text-blue-500"});case"achievement":return a.jsx(ta,{className:"h-5 w-5 text-yellow-500"});case"milestone":return a.jsx(xr,{className:"h-5 w-5 text-green-500"});case"goal_completed":return a.jsx(Io,{className:"h-5 w-5 text-green-600"});case"daily_quota":return a.jsx(oi,{className:"h-5 w-5 text-orange-500"});default:return a.jsx(Ci,{className:"h-5 w-5 text-gray-500"})}},m=n.filter(g=>!g.read).length;return s?a.jsx("div",{className:"w-full h-full min-h-screen p-0 m-0",children:a.jsxs("div",{className:"animate-pulse space-y-4 content-section",children:[a.jsx("div",{className:"h-8 bg-muted rounded w-1/3"}),a.jsx("div",{className:"space-y-3",children:[...Array(5)].map((g,v)=>a.jsx("div",{className:"h-20 bg-muted rounded"},v))})]})}):a.jsxs("div",{className:"w-full h-full min-h-screen p-0 m-0",children:[a.jsxs("div",{className:"flex items-center justify-between content-section",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[a.jsx(Ci,{className:"h-8 w-8"}),"Notifications",m>0&&a.jsx(Dn,{variant:"destructive",className:"ml-2",children:m})]}),a.jsx("p",{className:"text-muted-foreground",children:"Stay updated with your progress and achievements"})]}),a.jsxs("div",{className:"flex gap-2",children:[m>0&&a.jsxs(ht,{variant:"outline",onClick:c,className:"flex items-center gap-2",children:[a.jsx(Io,{className:"h-4 w-4"}),"Mark all as read"]}),a.jsxs(ht,{variant:"outline",onClick:()=>e("/settings"),className:"flex items-center gap-2",children:[a.jsx(Du,{className:"h-4 w-4"}),"Settings"]})]})]}),a.jsx("div",{className:"space-y-4",children:n.length===0?a.jsx(mt,{children:a.jsxs(gt,{className:"flex flex-col items-center justify-center py-12",children:[a.jsx(Ci,{className:"h-12 w-12 text-muted-foreground mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No notifications"}),a.jsx("p",{className:"text-muted-foreground text-center",children:"You're all caught up! We'll notify you when there's something new."})]})}):n.map((g,v)=>a.jsx(nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:v*.1},children:a.jsx(mt,{className:`transition-all hover:shadow-md ${g.read?"":"border-primary/50 bg-primary/5"}`,children:a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"flex-shrink-0 mt-1",children:f(g.type)}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("h3",{className:"font-semibold text-sm",children:[g.title,!g.read&&a.jsx("span",{className:"inline-block w-2 h-2 bg-primary rounded-full ml-2"})]}),a.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:g.message}),a.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[a.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a.jsx(ys,{className:"h-3 w-3"}),Kn(g.createdAt,"MMM d, h:mm a")]}),a.jsx(Dn,{variant:"outline",className:"text-xs",children:g.type.replace("_"," ")})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!g.read&&a.jsx(ht,{variant:"ghost",size:"sm",onClick:()=>l(g.id),className:"h-8 w-8 p-0",children:a.jsx(qx,{className:"h-4 w-4"})}),a.jsx(ht,{variant:"ghost",size:"sm",onClick:()=>d(g.id),className:"h-8 w-8 p-0 text-destructive hover:text-destructive",children:a.jsx(jg,{className:"h-4 w-4"})})]})]}),g.actionUrl&&a.jsx("div",{className:"mt-3 pt-3 border-t",children:a.jsx(ht,{variant:"outline",size:"sm",onClick:()=>e(g.actionUrl),children:"View Details"})})]})]})})})},g.id))}),a.jsxs(mt,{children:[a.jsx($t,{children:a.jsx(Ht,{className:"text-lg",children:"Notification Preferences"})}),a.jsxs(gt,{children:[a.jsx("p",{className:"text-muted-foreground mb-4",children:"Manage your notification settings to get updates that matter to you."}),a.jsxs(ht,{onClick:()=>e("/settings"),children:[a.jsx(Du,{className:"h-4 w-4 mr-2"}),"Configure Notifications"]})]})]})]})}const GN=I.forwardRef(({className:t,...e},n)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:n,className:vt("w-full caption-bottom text-sm",t),...e})}));GN.displayName="Table";const YN=I.forwardRef(({className:t,...e},n)=>a.jsx("thead",{ref:n,className:vt("[&_tr]:border-b",t),...e}));YN.displayName="TableHeader";const ZN=I.forwardRef(({className:t,...e},n)=>a.jsx("tbody",{ref:n,className:vt("[&_tr:last-child]:border-0",t),...e}));ZN.displayName="TableBody";const GE=I.forwardRef(({className:t,...e},n)=>a.jsx("tfoot",{ref:n,className:vt("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));GE.displayName="TableFooter";const Om=I.forwardRef(({className:t,...e},n)=>a.jsx("tr",{ref:n,className:vt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));Om.displayName="TableRow";const Lo=I.forwardRef(({className:t,...e},n)=>a.jsx("th",{ref:n,className:vt("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));Lo.displayName="TableHead";const Do=I.forwardRef(({className:t,...e},n)=>a.jsx("td",{ref:n,className:vt("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));Do.displayName="TableCell";const YE=I.forwardRef(({className:t,...e},n)=>a.jsx("caption",{ref:n,className:vt("mt-4 text-sm text-muted-foreground",t),...e}));YE.displayName="TableCaption";function Fn(t){"@babel/helpers - typeof";return Fn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fn(t)}var ms=Uint8Array,Ks=Uint16Array,I0=Int32Array,Pf=new ms([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]),Cf=new ms([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]),Rm=new ms([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),XN=function(t,e){for(var n=new Ks(31),r=0;r<31;++r)n[r]=e+=1<<t[r-1];for(var s=new I0(n[30]),r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)s[i]=i-n[r]<<5|r;return{b:n,r:s}},JN=XN(Pf,2),QN=JN.b,Fm=JN.r;QN[28]=258,Fm[258]=28;var e4=XN(Cf,0),ZE=e4.b,Ry=e4.r,Bm=new Ks(32768);for(var er=0;er<32768;++er){var Po=(er&43690)>>1|(er&21845)<<1;Po=(Po&52428)>>2|(Po&13107)<<2,Po=(Po&61680)>>4|(Po&3855)<<4,Bm[er]=((Po&65280)>>8|(Po&255)<<8)>>1}var oa=function(t,e,n){for(var r=t.length,s=0,i=new Ks(e);s<r;++s)t[s]&&++i[t[s]-1];var o=new Ks(e);for(s=1;s<e;++s)o[s]=o[s-1]+i[s-1]<<1;var l;if(n){l=new Ks(1<<e);var c=15-e;for(s=0;s<r;++s)if(t[s])for(var d=s<<4|t[s],f=e-t[s],m=o[t[s]-1]++<<f,g=m|(1<<f)-1;m<=g;++m)l[Bm[m]>>c]=d}else for(l=new Ks(r),s=0;s<r;++s)t[s]&&(l[s]=Bm[o[t[s]-1]++]>>15-t[s]);return l},Zo=new ms(288);for(var er=0;er<144;++er)Zo[er]=8;for(var er=144;er<256;++er)Zo[er]=9;for(var er=256;er<280;++er)Zo[er]=7;for(var er=280;er<288;++er)Zo[er]=8;var Qu=new ms(32);for(var er=0;er<32;++er)Qu[er]=5;var XE=oa(Zo,9,0),JE=oa(Zo,9,1),QE=oa(Qu,5,0),e9=oa(Qu,5,1),Tp=function(t){for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},Ni=function(t,e,n){var r=e/8|0;return(t[r]|t[r+1]<<8)>>(e&7)&n},Lp=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(e&7)},M0=function(t){return(t+7)/8|0},t4=function(t,e,n){return(n==null||n>t.length)&&(n=t.length),new ms(t.subarray(e,n))},t9=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],_i=function(t,e,n){var r=new Error(e||t9[t]);if(r.code=t,Error.captureStackTrace&&Error.captureStackTrace(r,_i),!n)throw r;return r},n9=function(t,e,n,r){var s=t.length,i=0;if(!s||e.f&&!e.l)return n||new ms(0);var o=!n,l=o||e.i!=2,c=e.i;o&&(n=new ms(s*3));var d=function(Ke){var Ue=n.length;if(Ke>Ue){var it=new ms(Math.max(Ue*2,Ke));it.set(n),n=it}},f=e.f||0,m=e.p||0,g=e.b||0,v=e.l,N=e.d,j=e.m,P=e.n,k=s*8;do{if(!v){f=Ni(t,m,1);var _=Ni(t,m+1,3);if(m+=3,_)if(_==1)v=JE,N=e9,j=9,P=5;else if(_==2){var U=Ni(t,m,31)+257,te=Ni(t,m+10,15)+4,W=U+Ni(t,m+5,31)+1;m+=14;for(var ge=new ms(W),oe=new ms(19),B=0;B<te;++B)oe[Rm[B]]=Ni(t,m+B*3,7);m+=te*3;for(var T=Tp(oe),J=(1<<T)-1,Z=oa(oe,T,1),B=0;B<W;){var Ne=Z[Ni(t,m,J)];m+=Ne&15;var M=Ne>>4;if(M<16)ge[B++]=M;else{var he=0,ae=0;for(M==16?(ae=3+Ni(t,m,3),m+=2,he=ge[B-1]):M==17?(ae=3+Ni(t,m,7),m+=3):M==18&&(ae=11+Ni(t,m,127),m+=7);ae--;)ge[B++]=he}}var G=ge.subarray(0,U),xe=ge.subarray(U);j=Tp(G),P=Tp(xe),v=oa(G,j,1),N=oa(xe,P,1)}else _i(1);else{var M=M0(m)+4,$=t[M-4]|t[M-3]<<8,Y=M+$;if(Y>s){c&&_i(0);break}l&&d(g+$),n.set(t.subarray(M,Y),g),e.b=g+=$,e.p=m=Y*8,e.f=f;continue}if(m>k){c&&_i(0);break}}l&&d(g+131072);for(var De=(1<<j)-1,$e=(1<<P)-1,E=m;;E=m){var he=v[Lp(t,m)&De],z=he>>4;if(m+=he&15,m>k){c&&_i(0);break}if(he||_i(2),z<256)n[g++]=z;else if(z==256){E=m,v=null;break}else{var ee=z-254;if(z>264){var B=z-257,le=Pf[B];ee=Ni(t,m,(1<<le)-1)+QN[B],m+=le}var ue=N[Lp(t,m)&$e],ve=ue>>4;ue||_i(3),m+=ue&15;var xe=ZE[ve];if(ve>3){var le=Cf[ve];xe+=Lp(t,m)&(1<<le)-1,m+=le}if(m>k){c&&_i(0);break}l&&d(g+131072);var Pe=g+ee;if(g<xe){var ce=i-xe,Ye=Math.min(xe,Pe);for(ce+g<0&&_i(3);g<Ye;++g)n[g]=r[ce+g]}for(;g<Pe;++g)n[g]=n[g-xe]}}e.l=v,e.p=E,e.b=g,e.f=f,v&&(f=1,e.m=j,e.d=N,e.n=P)}while(!f);return g!=n.length&&o?t4(n,0,g):n.subarray(0,g)},za=function(t,e,n){n<<=e&7;var r=e/8|0;t[r]|=n,t[r+1]|=n>>8},hu=function(t,e,n){n<<=e&7;var r=e/8|0;t[r]|=n,t[r+1]|=n>>8,t[r+2]|=n>>16},Dp=function(t,e){for(var n=[],r=0;r<t.length;++r)t[r]&&n.push({s:r,f:t[r]});var s=n.length,i=n.slice();if(!s)return{t:r4,l:0};if(s==1){var o=new ms(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(Y,U){return Y.f-U.f}),n.push({s:-1,f:25001});var l=n[0],c=n[1],d=0,f=1,m=2;for(n[0]={s:-1,f:l.f+c.f,l,r:c};f!=s-1;)l=n[n[d].f<n[m].f?d++:m++],c=n[d!=f&&n[d].f<n[m].f?d++:m++],n[f++]={s:-1,f:l.f+c.f,l,r:c};for(var g=i[0].s,r=1;r<s;++r)i[r].s>g&&(g=i[r].s);var v=new Ks(g+1),N=Vm(n[f-1],v,0);if(N>e){var r=0,j=0,P=N-e,k=1<<P;for(i.sort(function(U,te){return v[te.s]-v[U.s]||U.f-te.f});r<s;++r){var _=i[r].s;if(v[_]>e)j+=k-(1<<N-v[_]),v[_]=e;else break}for(j>>=P;j>0;){var M=i[r].s;v[M]<e?j-=1<<e-v[M]++-1:++r}for(;r>=0&&j;--r){var $=i[r].s;v[$]==e&&(--v[$],++j)}N=e}return{t:new ms(v),l:N}},Vm=function(t,e,n){return t.s==-1?Math.max(Vm(t.l,e,n+1),Vm(t.r,e,n+1)):e[t.s]=n},Fy=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new Ks(++e),r=0,s=t[0],i=1,o=function(c){n[r++]=c},l=1;l<=e;++l)if(t[l]==s&&l!=e)++i;else{if(!s&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(s),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(s);i=1,s=t[l]}return{c:n.subarray(0,r),n:e}},fu=function(t,e){for(var n=0,r=0;r<e.length;++r)n+=t[r]*e[r];return n},n4=function(t,e,n){var r=n.length,s=M0(e+2);t[s]=r&255,t[s+1]=r>>8,t[s+2]=t[s]^255,t[s+3]=t[s+1]^255;for(var i=0;i<r;++i)t[s+i+4]=n[i];return(s+4+r)*8},By=function(t,e,n,r,s,i,o,l,c,d,f){za(e,f++,n),++s[256];for(var m=Dp(s,15),g=m.t,v=m.l,N=Dp(i,15),j=N.t,P=N.l,k=Fy(g),_=k.c,M=k.n,$=Fy(j),Y=$.c,U=$.n,te=new Ks(19),W=0;W<_.length;++W)++te[_[W]&31];for(var W=0;W<Y.length;++W)++te[Y[W]&31];for(var ge=Dp(te,7),oe=ge.t,B=ge.l,T=19;T>4&&!oe[Rm[T-1]];--T);var J=d+5<<3,Z=fu(s,Zo)+fu(i,Qu)+o,Ne=fu(s,g)+fu(i,j)+o+14+3*T+fu(te,oe)+2*te[16]+3*te[17]+7*te[18];if(c>=0&&J<=Z&&J<=Ne)return n4(e,f,t.subarray(c,c+d));var he,ae,G,xe;if(za(e,f,1+(Ne<Z)),f+=2,Ne<Z){he=oa(g,v,0),ae=g,G=oa(j,P,0),xe=j;var De=oa(oe,B,0);za(e,f,M-257),za(e,f+5,U-1),za(e,f+10,T-4),f+=14;for(var W=0;W<T;++W)za(e,f+3*W,oe[Rm[W]]);f+=3*T;for(var $e=[_,Y],E=0;E<2;++E)for(var z=$e[E],W=0;W<z.length;++W){var ee=z[W]&31;za(e,f,De[ee]),f+=oe[ee],ee>15&&(za(e,f,z[W]>>5&127),f+=z[W]>>12)}}else he=XE,ae=Zo,G=QE,xe=Qu;for(var W=0;W<l;++W){var le=r[W];if(le>255){var ee=le>>18&31;hu(e,f,he[ee+257]),f+=ae[ee+257],ee>7&&(za(e,f,le>>23&31),f+=Pf[ee]);var ue=le&31;hu(e,f,G[ue]),f+=xe[ue],ue>3&&(hu(e,f,le>>5&8191),f+=Cf[ue])}else hu(e,f,he[le]),f+=ae[le]}return hu(e,f,he[256]),f+ae[256]},r9=new I0([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),r4=new ms(0),s9=function(t,e,n,r,s,i){var o=i.z||t.length,l=new ms(r+o+5*(1+Math.ceil(o/7e3))+s),c=l.subarray(r,l.length-s),d=i.l,f=(i.r||0)&7;if(e){f&&(c[0]=i.r>>3);for(var m=r9[e-1],g=m>>13,v=m&8191,N=(1<<n)-1,j=i.p||new Ks(32768),P=i.h||new Ks(N+1),k=Math.ceil(n/3),_=2*k,M=function(It){return(t[It]^t[It+1]<<k^t[It+2]<<_)&N},$=new I0(25e3),Y=new Ks(288),U=new Ks(32),te=0,W=0,ge=i.i||0,oe=0,B=i.w||0,T=0;ge+2<o;++ge){var J=M(ge),Z=ge&32767,Ne=P[J];if(j[Z]=Ne,P[J]=Z,B<=ge){var he=o-ge;if((te>7e3||oe>24576)&&(he>423||!d)){f=By(t,c,0,$,Y,U,W,oe,T,ge-T,f),oe=te=W=0,T=ge;for(var ae=0;ae<286;++ae)Y[ae]=0;for(var ae=0;ae<30;++ae)U[ae]=0}var G=2,xe=0,De=v,$e=Z-Ne&32767;if(he>2&&J==M(ge-$e))for(var E=Math.min(g,he)-1,z=Math.min(32767,ge),ee=Math.min(258,he);$e<=z&&--De&&Z!=Ne;){if(t[ge+G]==t[ge+G-$e]){for(var le=0;le<ee&&t[ge+le]==t[ge+le-$e];++le);if(le>G){if(G=le,xe=$e,le>E)break;for(var ue=Math.min($e,le-2),ve=0,ae=0;ae<ue;++ae){var Pe=ge-$e+ae&32767,ce=j[Pe],Ye=Pe-ce&32767;Ye>ve&&(ve=Ye,Ne=Pe)}}}Z=Ne,Ne=j[Z],$e+=Z-Ne&32767}if(xe){$[oe++]=268435456|Fm[G]<<18|Ry[xe];var Ke=Fm[G]&31,Ue=Ry[xe]&31;W+=Pf[Ke]+Cf[Ue],++Y[257+Ke],++U[Ue],B=ge+G,++te}else $[oe++]=t[ge],++Y[t[ge]]}}for(ge=Math.max(ge,B);ge<o;++ge)$[oe++]=t[ge],++Y[t[ge]];f=By(t,c,d,$,Y,U,W,oe,T,ge-T,f),d||(i.r=f&7|c[f/8|0]<<3,f-=7,i.h=P,i.p=j,i.i=ge,i.w=B)}else{for(var ge=i.w||0;ge<o+d;ge+=65535){var it=ge+65535;it>=o&&(c[f/8|0]=d,it=o),f=n4(c,f+1,t.subarray(ge,it))}i.i=o}return t4(l,0,r+M0(f)+s)},s4=function(){var t=1,e=0;return{p:function(n){for(var r=t,s=e,i=n.length|0,o=0;o!=i;){for(var l=Math.min(o+2655,i);o<l;++o)s+=r+=n[o];r=(r&65535)+15*(r>>16),s=(s&65535)+15*(s>>16)}t=r,e=s},d:function(){return t%=65521,e%=65521,(t&255)<<24|(t&65280)<<8|(e&255)<<8|e>>8}}},i9=function(t,e,n,r,s){if(!s&&(s={l:1},e.dictionary)){var i=e.dictionary.subarray(-32768),o=new ms(i.length+t.length);o.set(i),o.set(t,i.length),t=o,s.w=i.length}return s9(t,e.level==null?6:e.level,e.mem==null?s.l?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):20:12+e.mem,n,r,s)},i4=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},a9=function(t,e){var n=e.level,r=n==0?0:n<6?1:n==9?3:2;if(t[0]=120,t[1]=r<<6|(e.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,e.dictionary){var s=s4();s.p(e.dictionary),i4(t,2,s.d())}},o9=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&_i(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&_i(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2};function qm(t,e){e||(e={});var n=s4();n.p(t);var r=i9(t,e,e.dictionary?6:2,4);return a9(r,e),i4(r,r.length-4,n.d()),r}function l9(t,e){return n9(t.subarray(o9(t,e),-4),{i:2},e,e)}var c9=typeof TextDecoder<"u"&&new TextDecoder,u9=0;try{c9.decode(r4,{stream:!0}),u9=1}catch{}var Xt=function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this}();function Ip(){Xt.console&&typeof Xt.console.log=="function"&&Xt.console.log.apply(Xt.console,arguments)}var Wn={log:Ip,warn:function(t){Xt.console&&(typeof Xt.console.warn=="function"?Xt.console.warn.apply(Xt.console,arguments):Ip.call(null,arguments))},error:function(t){Xt.console&&(typeof Xt.console.error=="function"?Xt.console.error.apply(Xt.console,arguments):Ip(t))}};function Mp(t,e,n){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="blob",r.onload=function(){jl(r.response,e,n)},r.onerror=function(){Wn.error("could not download file")},r.send()}function Vy(t){var e=new XMLHttpRequest;e.open("HEAD",t,!1);try{e.send()}catch{}return e.status>=200&&e.status<=299}function Ud(t){try{t.dispatchEvent(new MouseEvent("click"))}catch{var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(e)}}var ku,Um,jl=Xt.saveAs||((typeof window>"u"?"undefined":Fn(window))!=="object"||window!==Xt?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(t,e,n){var r=Xt.URL||Xt.webkitURL,s=document.createElement("a");e=e||t.name||"download",s.download=e,s.rel="noopener",typeof t=="string"?(s.href=t,s.origin!==location.origin?Vy(s.href)?Mp(t,e,n):Ud(s,s.target="_blank"):Ud(s)):(s.href=r.createObjectURL(t),setTimeout(function(){r.revokeObjectURL(s.href)},4e4),setTimeout(function(){Ud(s)},0))}:"msSaveOrOpenBlob"in navigator?function(t,e,n){if(e=e||t.name||"download",typeof t=="string")if(Vy(t))Mp(t,e,n);else{var r=document.createElement("a");r.href=t,r.target="_blank",setTimeout(function(){Ud(r)})}else navigator.msSaveOrOpenBlob(function(s,i){return i===void 0?i={autoBom:!1}:Fn(i)!=="object"&&(Wn.warn("Deprecated: Expected third argument to be a object"),i={autoBom:!i}),i.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(s.type)?new Blob(["\uFEFF",s],{type:s.type}):s}(t,n),e)}:function(t,e,n,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),typeof t=="string")return Mp(t,e,n);var s=t.type==="application/octet-stream",i=/constructor/i.test(Xt.HTMLElement)||Xt.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||s&&i)&&(typeof FileReader>"u"?"undefined":Fn(FileReader))==="object"){var l=new FileReader;l.onloadend=function(){var f=l.result;f=o?f:f.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=f:location=f,r=null},l.readAsDataURL(t)}else{var c=Xt.URL||Xt.webkitURL,d=c.createObjectURL(t);r?r.location=d:location.href=d,r=null,setTimeout(function(){c.revokeObjectURL(d)},4e4)}});/**
* A class to parse color values
* @author Stoyan Stefanov <sstoo@gmail.com>
* {@link http://www.phpied.com/rgb-color-parser-in-javascript/}
* @license Use it if you like it
*/function a4(t){var e;t=t||"",this.ok=!1,t.charAt(0)=="#"&&(t=t.substr(1,6)),t={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:"90ee90",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"}[t=(t=t.replace(/ /g,"")).toLowerCase()]||t;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 s=n[r].re,i=n[r].process,o=s.exec(t);o&&(e=i(o),this.r=e[0],this.g=e[1],this.b=e[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}}/**
* @license
* Joseph Myers does not specify a particular license for his work.
*
* Author: Joseph Myers
* Accessed from: http://www.myersdaily.org/joseph/javascript/md5.js
*
* Modified by: Owen Leong
*/function Ep(t,e){var n=t[0],r=t[1],s=t[2],i=t[3];n=cs(n,r,s,i,e[0],7,-680876936),i=cs(i,n,r,s,e[1],12,-389564586),s=cs(s,i,n,r,e[2],17,606105819),r=cs(r,s,i,n,e[3],22,-1044525330),n=cs(n,r,s,i,e[4],7,-176418897),i=cs(i,n,r,s,e[5],12,1200080426),s=cs(s,i,n,r,e[6],17,-1473231341),r=cs(r,s,i,n,e[7],22,-45705983),n=cs(n,r,s,i,e[8],7,1770035416),i=cs(i,n,r,s,e[9],12,-1958414417),s=cs(s,i,n,r,e[10],17,-42063),r=cs(r,s,i,n,e[11],22,-1990404162),n=cs(n,r,s,i,e[12],7,1804603682),i=cs(i,n,r,s,e[13],12,-40341101),s=cs(s,i,n,r,e[14],17,-1502002290),n=us(n,r=cs(r,s,i,n,e[15],22,1236535329),s,i,e[1],5,-165796510),i=us(i,n,r,s,e[6],9,-1069501632),s=us(s,i,n,r,e[11],14,643717713),r=us(r,s,i,n,e[0],20,-373897302),n=us(n,r,s,i,e[5],5,-701558691),i=us(i,n,r,s,e[10],9,38016083),s=us(s,i,n,r,e[15],14,-660478335),r=us(r,s,i,n,e[4],20,-405537848),n=us(n,r,s,i,e[9],5,568446438),i=us(i,n,r,s,e[14],9,-1019803690),s=us(s,i,n,r,e[3],14,-187363961),r=us(r,s,i,n,e[8],20,1163531501),n=us(n,r,s,i,e[13],5,-1444681467),i=us(i,n,r,s,e[2],9,-51403784),s=us(s,i,n,r,e[7],14,1735328473),n=ds(n,r=us(r,s,i,n,e[12],20,-1926607734),s,i,e[5],4,-378558),i=ds(i,n,r,s,e[8],11,-2022574463),s=ds(s,i,n,r,e[11],16,1839030562),r=ds(r,s,i,n,e[14],23,-35309556),n=ds(n,r,s,i,e[1],4,-1530992060),i=ds(i,n,r,s,e[4],11,1272893353),s=ds(s,i,n,r,e[7],16,-155497632),r=ds(r,s,i,n,e[10],23,-1094730640),n=ds(n,r,s,i,e[13],4,681279174),i=ds(i,n,r,s,e[0],11,-358537222),s=ds(s,i,n,r,e[3],16,-722521979),r=ds(r,s,i,n,e[6],23,76029189),n=ds(n,r,s,i,e[9],4,-640364487),i=ds(i,n,r,s,e[12],11,-421815835),s=ds(s,i,n,r,e[15],16,530742520),n=hs(n,r=ds(r,s,i,n,e[2],23,-995338651),s,i,e[0],6,-198630844),i=hs(i,n,r,s,e[7],10,1126891415),s=hs(s,i,n,r,e[14],15,-1416354905),r=hs(r,s,i,n,e[5],21,-57434055),n=hs(n,r,s,i,e[12],6,1700485571),i=hs(i,n,r,s,e[3],10,-1894986606),s=hs(s,i,n,r,e[10],15,-1051523),r=hs(r,s,i,n,e[1],21,-2054922799),n=hs(n,r,s,i,e[8],6,1873313359),i=hs(i,n,r,s,e[15],10,-30611744),s=hs(s,i,n,r,e[6],15,-1560198380),r=hs(r,s,i,n,e[13],21,1309151649),n=hs(n,r,s,i,e[4],6,-145523070),i=hs(i,n,r,s,e[11],10,-1120210379),s=hs(s,i,n,r,e[2],15,718787259),r=hs(r,s,i,n,e[9],21,-343485551),t[0]=Ro(n,t[0]),t[1]=Ro(r,t[1]),t[2]=Ro(s,t[2]),t[3]=Ro(i,t[3])}function Tf(t,e,n,r,s,i){return e=Ro(Ro(e,t),Ro(r,i)),Ro(e<<s|e>>>32-s,n)}function cs(t,e,n,r,s,i,o){return Tf(e&n|~e&r,t,e,s,i,o)}function us(t,e,n,r,s,i,o){return Tf(e&r|n&~r,t,e,s,i,o)}function ds(t,e,n,r,s,i,o){return Tf(e^n^r,t,e,s,i,o)}function hs(t,e,n,r,s,i,o){return Tf(n^(e|~r),t,e,s,i,o)}function o4(t){var e,n=t.length,r=[1732584193,-271733879,-1732584194,271733878];for(e=64;e<=t.length;e+=64)Ep(r,d9(t.substring(e-64,e)));t=t.substring(e-64);var s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(e=0;e<t.length;e++)s[e>>2]|=t.charCodeAt(e)<<(e%4<<3);if(s[e>>2]|=128<<(e%4<<3),e>55)for(Ep(r,s),e=0;e<16;e++)s[e]=0;return s[14]=8*n,Ep(r,s),r}function d9(t){var e,n=[];for(e=0;e<64;e+=4)n[e>>2]=t.charCodeAt(e)+(t.charCodeAt(e+1)<<8)+(t.charCodeAt(e+2)<<16)+(t.charCodeAt(e+3)<<24);return n}ku=Xt.atob.bind(Xt),Um=Xt.btoa.bind(Xt);var qy="0123456789abcdef".split("");function h9(t){for(var e="",n=0;n<4;n++)e+=qy[t>>8*n+4&15]+qy[t>>8*n&15];return e}function f9(t){return String.fromCharCode((255&t)>>0,(65280&t)>>8,(16711680&t)>>16,(4278190080&t)>>24)}function zm(t){return o4(t).map(f9).join("")}var p9=function(t){for(var e=0;e<t.length;e++)t[e]=h9(t[e]);return t.join("")}(o4("hello"))!="5d41402abc4b2a76b9719d911017c592";function Ro(t,e){if(p9){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}return t+e&4294967295}/**
* @license
* FPDF is released under a permissive license: there is no usage restriction.
* You may embed it freely in your application (commercial or not), with or
* without modifications.
*
* Reference: http://www.fpdf.org/en/script/script37.php
*/function Wm(t,e){var n,r,s,i;if(t!==n){for(var o=(s=t,i=1+(256/t.length>>0),new Array(i+1).join(s)),l=[],c=0;c<256;c++)l[c]=c;var d=0;for(c=0;c<256;c++){var f=l[c];d=(d+f+o.charCodeAt(c))%256,l[c]=l[d],l[d]=f}n=t,r=l}else l=r;var m=e.length,g=0,v=0,N="";for(c=0;c<m;c++)v=(v+(f=l[g=(g+1)%256]))%256,l[g]=l[v],l[v]=f,o=l[(l[g]+l[v])%256],N+=String.fromCharCode(e.charCodeAt(c)^o);return N}/**
* @license
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
* Author: Owen Leong (@owenl131)
* Date: 15 Oct 2020
* References:
* https://www.cs.cmu.edu/~dst/Adobe/Gallery/anon21jul01-pdf-encryption.txt
* https://github.com/foliojs/pdfkit/blob/master/lib/security.js
* http://www.fpdf.org/en/script/script37.php
*/var Uy={print:4,modify:8,copy:16,"annot-forms":32};function hc(t,e,n,r){this.v=1,this.r=2;var s=192;t.forEach(function(l){if(Uy.perm!==void 0)throw new Error("Invalid permission: "+l);s+=Uy[l]}),this.padding="(¿N^NuAd\0NVÿú\b..\0¶Ðh>/\f©þdSiz";var i=(e+this.padding).substr(0,32),o=(n+this.padding).substr(0,32);this.O=this.processOwnerPassword(i,o),this.P=-(1+(255^s)),this.encryptionKey=zm(i+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(r)).substr(0,5),this.U=Wm(this.encryptionKey,this.padding)}function fc(t){if(/[^\u0000-\u00ff]/.test(t))throw new Error("Invalid PDF Name Object: "+t+", Only accept ASCII characters.");for(var e="",n=t.length,r=0;r<n;r++){var s=t.charCodeAt(r);s<33||s===35||s===37||s===40||s===41||s===47||s===60||s===62||s===91||s===93||s===123||s===125||s>126?e+="#"+("0"+s.toString(16)).slice(-2):e+=t[r]}return e}function zy(t){if(Fn(t)!=="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var e={};this.subscribe=function(n,r,s){if(s=s||!1,typeof n!="string"||typeof r!="function"||typeof s!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");e.hasOwnProperty(n)||(e[n]={});var i=Math.random().toString(35);return e[n][i]=[r,!!s],i},this.unsubscribe=function(n){for(var r in e)if(e[r][n])return delete e[r][n],Object.keys(e[r]).length===0&&delete e[r],!0;return!1},this.publish=function(n){if(e.hasOwnProperty(n)){var r=Array.prototype.slice.call(arguments,1),s=[];for(var i in e[n]){var o=e[n][i];try{o[0].apply(t,r)}catch(l){Xt.console&&Wn.error("jsPDF PubSub Error",l.message,l)}o[1]&&s.push(i)}s.length&&s.forEach(this.unsubscribe)}},this.getTopics=function(){return e}}function $h(t){if(!(this instanceof $h))return new $h(t);var e="opacity,stroke-opacity".split(",");for(var n in t)t.hasOwnProperty(n)&&e.indexOf(n)>=0&&(this[n]=t[n]);this.id="",this.objectNumber=-1}function l4(t,e){this.gState=t,this.matrix=e,this.id="",this.objectNumber=-1}function Sl(t,e,n,r,s){if(!(this instanceof Sl))return new Sl(t,e,n,r,s);this.type=t==="axial"?2:3,this.coords=e,this.colors=n,l4.call(this,r,s)}function Nc(t,e,n,r,s){if(!(this instanceof Nc))return new Nc(t,e,n,r,s);this.boundingBox=t,this.xStep=e,this.yStep=n,this.stream="",this.cloneIndex=0,l4.call(this,r,s)}function Zt(t){var e,n=typeof arguments[0]=="string"?arguments[0]:"p",r=arguments[1],s=arguments[2],i=arguments[3],o=[],l=1,c=16,d="S",f=null;Fn(t=t||{})==="object"&&(n=t.orientation,r=t.unit||r,s=t.format||s,i=t.compress||t.compressPdf||i,(f=t.encryption||null)!==null&&(f.userPassword=f.userPassword||"",f.ownerPassword=f.ownerPassword||"",f.userPermissions=f.userPermissions||[]),l=typeof t.userUnit=="number"?Math.abs(t.userUnit):1,t.precision!==void 0&&(e=t.precision),t.floatPrecision!==void 0&&(c=t.floatPrecision),d=t.defaultPathOperation||"S"),o=t.filters||(i===!0?["FlateEncode"]:o),r=r||"mm",n=(""+(n||"P")).toLowerCase();var m=t.putOnlyUsedFonts||!1,g={},v={internal:{},__private__:{}};v.__private__.PubSub=zy;var N="1.3",j=v.__private__.getPdfVersion=function(){return N};v.__private__.setPdfVersion=function(x){N=x};var P={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]};v.__private__.getPageFormats=function(){return P};var k=v.__private__.getPageFormat=function(x){return P[x]};s=s||"a4";var _={COMPAT:"compat",ADVANCED:"advanced"},M=_.COMPAT;function $(){this.saveGraphicsState(),re(new qt(ft,0,0,-ft,0,Us()*ft).toString()+" cm"),this.setFontSize(this.getFontSize()/ft),d="n",M=_.ADVANCED}function Y(){this.restoreGraphicsState(),d="S",M=_.COMPAT}var U=v.__private__.combineFontStyleAndFontWeight=function(x,L){if(x=="bold"&&L=="normal"||x=="bold"&&L==400||x=="normal"&&L=="italic"||x=="bold"&&L=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return L&&(x=L==400||L==="normal"?x==="italic"?"italic":"normal":L!=700&&L!=="bold"||x!=="normal"?(L==700?"bold":L)+""+x:"bold"),x};v.advancedAPI=function(x){var L=M===_.COMPAT;return L&&$.call(this),typeof x!="function"||(x(this),L&&Y.call(this)),this},v.compatAPI=function(x){var L=M===_.ADVANCED;return L&&Y.call(this),typeof x!="function"||(x(this),L&&$.call(this)),this},v.isAdvancedAPI=function(){return M===_.ADVANCED};var te,W=function(x){if(M!==_.ADVANCED)throw new Error(x+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},ge=v.roundToPrecision=v.__private__.roundToPrecision=function(x,L){var Q=e||L;if(isNaN(x)||isNaN(Q))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return x.toFixed(Q).replace(/0+$/,"")};te=v.hpf=v.__private__.hpf=typeof c=="number"?function(x){if(isNaN(x))throw new Error("Invalid argument passed to jsPDF.hpf");return ge(x,c)}:c==="smart"?function(x){if(isNaN(x))throw new Error("Invalid argument passed to jsPDF.hpf");return ge(x,x>-1&&x<1?16:5)}:function(x){if(isNaN(x))throw new Error("Invalid argument passed to jsPDF.hpf");return ge(x,16)};var oe=v.f2=v.__private__.f2=function(x){if(isNaN(x))throw new Error("Invalid argument passed to jsPDF.f2");return ge(x,2)},B=v.__private__.f3=function(x){if(isNaN(x))throw new Error("Invalid argument passed to jsPDF.f3");return ge(x,3)},T=v.scale=v.__private__.scale=function(x){if(isNaN(x))throw new Error("Invalid argument passed to jsPDF.scale");return M===_.COMPAT?x*ft:M===_.ADVANCED?x:void 0},J=function(x){return M===_.COMPAT?Us()-x:M===_.ADVANCED?x:void 0},Z=function(x){return T(J(x))};v.__private__.setPrecision=v.setPrecision=function(x){typeof parseInt(x,10)=="number"&&(e=parseInt(x,10))};var Ne,he="00000000000000000000000000000000",ae=v.__private__.getFileId=function(){return he},G=v.__private__.setFileId=function(x){return he=x!==void 0&&/^[a-fA-F0-9]{32}$/.test(x)?x.toUpperCase():he.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),f!==null&&(Rr=new hc(f.userPermissions,f.userPassword,f.ownerPassword,he)),he};v.setFileId=function(x){return G(x),this},v.getFileId=function(){return ae()};var xe=v.__private__.convertDateToPDFDate=function(x){var L=x.getTimezoneOffset(),Q=L<0?"+":"-",de=Math.floor(Math.abs(L/60)),Le=Math.abs(L%60),We=[Q,ee(de),"'",ee(Le),"'"].join("");return["D:",x.getFullYear(),ee(x.getMonth()+1),ee(x.getDate()),ee(x.getHours()),ee(x.getMinutes()),ee(x.getSeconds()),We].join("")},De=v.__private__.convertPDFDateToDate=function(x){var L=parseInt(x.substr(2,4),10),Q=parseInt(x.substr(6,2),10)-1,de=parseInt(x.substr(8,2),10),Le=parseInt(x.substr(10,2),10),We=parseInt(x.substr(12,2),10),tt=parseInt(x.substr(14,2),10);return new Date(L,Q,de,Le,We,tt,0)},$e=v.__private__.setCreationDate=function(x){var L;if(x===void 0&&(x=new Date),x instanceof Date)L=xe(x);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(x))throw new Error("Invalid argument passed to jsPDF.setCreationDate");L=x}return Ne=L},E=v.__private__.getCreationDate=function(x){var L=Ne;return x==="jsDate"&&(L=De(Ne)),L};v.setCreationDate=function(x){return $e(x),this},v.getCreationDate=function(x){return E(x)};var z,ee=v.__private__.padd2=function(x){return("0"+parseInt(x)).slice(-2)},le=v.__private__.padd2Hex=function(x){return("00"+(x=x.toString())).substr(x.length)},ue=0,ve=[],Pe=[],ce=0,Ye=[],Ke=[],Ue=!1,it=Pe,It=function(){ue=0,ce=0,Pe=[],ve=[],Ye=[],ci=Yn(),Pr=Yn()};v.__private__.setCustomOutputDestination=function(x){Ue=!0,it=x};var qe=function(x){Ue||(it=x)};v.__private__.resetCustomOutputDestination=function(){Ue=!1,it=Pe};var re=v.__private__.out=function(x){return x=x.toString(),ce+=x.length+1,it.push(x),it},zt=v.__private__.write=function(x){return re(arguments.length===1?x.toString():Array.prototype.join.call(arguments," "))},X=v.__private__.getArrayBuffer=function(x){for(var L=x.length,Q=new ArrayBuffer(L),de=new Uint8Array(Q);L--;)de[L]=x.charCodeAt(L);return Q},ne=[["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]];v.__private__.getStandardFonts=function(){return ne};var fe=t.fontSize||16;v.__private__.setFontSize=v.setFontSize=function(x){return fe=M===_.ADVANCED?x/ft:x,this};var Re,Oe=v.__private__.getFontSize=v.getFontSize=function(){return M===_.COMPAT?fe:fe*ft},Fe=t.R2L||!1;v.__private__.setR2L=v.setR2L=function(x){return Fe=x,this},v.__private__.getR2L=v.getR2L=function(){return Fe};var et,yt=v.__private__.setZoomMode=function(x){var L=[void 0,null,"fullwidth","fullheight","fullpage","original"];if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(x))Re=x;else if(isNaN(x)){if(L.indexOf(x)===-1)throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+x+'" is not recognized.');Re=x}else Re=parseInt(x,10)};v.__private__.getZoomMode=function(){return Re};var Pt,Lt=v.__private__.setPageMode=function(x){if([void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(x)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+x+'" is not recognized.');et=x};v.__private__.getPageMode=function(){return et};var an=v.__private__.setLayoutMode=function(x){if([void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(x)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+x+'" is not recognized.');Pt=x};v.__private__.getLayoutMode=function(){return Pt},v.__private__.setDisplayMode=v.setDisplayMode=function(x,L,Q){return yt(x),an(L),Lt(Q),this};var Ot={title:"",subject:"",author:"",keywords:"",creator:""};v.__private__.getDocumentProperty=function(x){if(Object.keys(Ot).indexOf(x)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return Ot[x]},v.__private__.getDocumentProperties=function(){return Ot},v.__private__.setDocumentProperties=v.setProperties=v.setDocumentProperties=function(x){for(var L in Ot)Ot.hasOwnProperty(L)&&x[L]&&(Ot[L]=x[L]);return this},v.__private__.setDocumentProperty=function(x,L){if(Object.keys(Ot).indexOf(x)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return Ot[x]=L};var Qt,ft,In,on,Mr,ln={},lt={},zr=[],xt={},gn={},Ge={},Hn={},ir=null,An=0,Yt=[],Nn=new zy(v),pa=t.hotfixes||[],Er={},Xr={},Jr=[],qt=function x(L,Q,de,Le,We,tt){if(!(this instanceof x))return new x(L,Q,de,Le,We,tt);isNaN(L)&&(L=1),isNaN(Q)&&(Q=0),isNaN(de)&&(de=0),isNaN(Le)&&(Le=1),isNaN(We)&&(We=0),isNaN(tt)&&(tt=0),this._matrix=[L,Q,de,Le,We,tt]};Object.defineProperty(qt.prototype,"sx",{get:function(){return this._matrix[0]},set:function(x){this._matrix[0]=x}}),Object.defineProperty(qt.prototype,"shy",{get:function(){return this._matrix[1]},set:function(x){this._matrix[1]=x}}),Object.defineProperty(qt.prototype,"shx",{get:function(){return this._matrix[2]},set:function(x){this._matrix[2]=x}}),Object.defineProperty(qt.prototype,"sy",{get:function(){return this._matrix[3]},set:function(x){this._matrix[3]=x}}),Object.defineProperty(qt.prototype,"tx",{get:function(){return this._matrix[4]},set:function(x){this._matrix[4]=x}}),Object.defineProperty(qt.prototype,"ty",{get:function(){return this._matrix[5]},set:function(x){this._matrix[5]=x}}),Object.defineProperty(qt.prototype,"a",{get:function(){return this._matrix[0]},set:function(x){this._matrix[0]=x}}),Object.defineProperty(qt.prototype,"b",{get:function(){return this._matrix[1]},set:function(x){this._matrix[1]=x}}),Object.defineProperty(qt.prototype,"c",{get:function(){return this._matrix[2]},set:function(x){this._matrix[2]=x}}),Object.defineProperty(qt.prototype,"d",{get:function(){return this._matrix[3]},set:function(x){this._matrix[3]=x}}),Object.defineProperty(qt.prototype,"e",{get:function(){return this._matrix[4]},set:function(x){this._matrix[4]=x}}),Object.defineProperty(qt.prototype,"f",{get:function(){return this._matrix[5]},set:function(x){this._matrix[5]=x}}),Object.defineProperty(qt.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(qt.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(qt.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(qt.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),qt.prototype.join=function(x){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(te).join(x)},qt.prototype.multiply=function(x){var L=x.sx*this.sx+x.shy*this.shx,Q=x.sx*this.shy+x.shy*this.sy,de=x.shx*this.sx+x.sy*this.shx,Le=x.shx*this.shy+x.sy*this.sy,We=x.tx*this.sx+x.ty*this.shx+this.tx,tt=x.tx*this.shy+x.ty*this.sy+this.ty;return new qt(L,Q,de,Le,We,tt)},qt.prototype.decompose=function(){var x=this.sx,L=this.shy,Q=this.shx,de=this.sy,Le=this.tx,We=this.ty,tt=Math.sqrt(x*x+L*L),kt=(x/=tt)*Q+(L/=tt)*de;Q-=x*kt,de-=L*kt;var Rt=Math.sqrt(Q*Q+de*de);return kt/=Rt,x*(de/=Rt)<L*(Q/=Rt)&&(x=-x,L=-L,kt=-kt,tt=-tt),{scale:new qt(tt,0,0,Rt,0,0),translate:new qt(1,0,0,1,Le,We),rotate:new qt(x,L,-L,x,0,0),skew:new qt(1,0,kt,1,0,0)}},qt.prototype.toString=function(x){return this.join(" ")},qt.prototype.inversed=function(){var x=this.sx,L=this.shy,Q=this.shx,de=this.sy,Le=this.tx,We=this.ty,tt=1/(x*de-L*Q),kt=de*tt,Rt=-L*tt,rn=-Q*tt,en=x*tt;return new qt(kt,Rt,rn,en,-kt*Le-rn*We,-Rt*Le-en*We)},qt.prototype.applyToPoint=function(x){var L=x.x*this.sx+x.y*this.shx+this.tx,Q=x.x*this.shy+x.y*this.sy+this.ty;return new $i(L,Q)},qt.prototype.applyToRectangle=function(x){var L=this.applyToPoint(x),Q=this.applyToPoint(new $i(x.x+x.w,x.y+x.h));return new fr(L.x,L.y,Q.x-L.x,Q.y-L.y)},qt.prototype.clone=function(){var x=this.sx,L=this.shy,Q=this.shx,de=this.sy,Le=this.tx,We=this.ty;return new qt(x,L,Q,de,Le,We)},v.Matrix=qt;var is=v.matrixMult=function(x,L){return L.multiply(x)},wn=new qt(1,0,0,1,0,0);v.unitMatrix=v.identityMatrix=wn;var Sn=function(x,L){if(!gn[x]){var Q=(L instanceof Sl?"Sh":"P")+(Object.keys(xt).length+1).toString(10);L.id=Q,gn[x]=Q,xt[Q]=L,Nn.publish("addPattern",L)}};v.ShadingPattern=Sl,v.TilingPattern=Nc,v.addShadingPattern=function(x,L){return W("addShadingPattern()"),Sn(x,L),this},v.beginTilingPattern=function(x){W("beginTilingPattern()"),Hi(x.boundingBox[0],x.boundingBox[1],x.boundingBox[2]-x.boundingBox[0],x.boundingBox[3]-x.boundingBox[1],x.matrix)},v.endTilingPattern=function(x,L){W("endTilingPattern()"),L.stream=Ke[z].join(`
`),Sn(x,L),Nn.publish("endTilingPattern",L),Jr.pop().restore()};var br=v.__private__.newObject=function(){var x=Yn();return Wr(x,!0),x},Yn=v.__private__.newObjectDeferred=function(){return ue++,ve[ue]=function(){return ce},ue},Wr=function(x,L){return L=typeof L=="boolean"&&L,ve[x]=ce,L&&re(x+" 0 obj"),x},li=v.__private__.newAdditionalObject=function(){var x={objId:Yn(),content:""};return Ye.push(x),x},ci=Yn(),Pr=Yn(),$r=v.__private__.decodeColorString=function(x){var L=x.split(" ");if(L.length!==2||L[1]!=="g"&&L[1]!=="G")L.length===5&&(L[4]==="k"||L[4]==="K")&&(L=[(1-L[0])*(1-L[3]),(1-L[1])*(1-L[3]),(1-L[2])*(1-L[3]),"r"]);else{var Q=parseFloat(L[0]);L=[Q,Q,Q,"r"]}for(var de="#",Le=0;Le<3;Le++)de+=("0"+Math.floor(255*parseFloat(L[Le])).toString(16)).slice(-2);return de},Cr=v.__private__.encodeColorString=function(x){var L;typeof x=="string"&&(x={ch1:x});var Q=x.ch1,de=x.ch2,Le=x.ch3,We=x.ch4,tt=x.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof Q=="string"&&Q.charAt(0)!=="#"){var kt=new a4(Q);if(kt.ok)Q=kt.toHex();else if(!/^\d*\.?\d*$/.test(Q))throw new Error('Invalid color "'+Q+'" passed to jsPDF.encodeColorString.')}if(typeof Q=="string"&&/^#[0-9A-Fa-f]{3}$/.test(Q)&&(Q="#"+Q[1]+Q[1]+Q[2]+Q[2]+Q[3]+Q[3]),typeof Q=="string"&&/^#[0-9A-Fa-f]{6}$/.test(Q)){var Rt=parseInt(Q.substr(1),16);Q=Rt>>16&255,de=Rt>>8&255,Le=255&Rt}if(de===void 0||We===void 0&&Q===de&&de===Le)if(typeof Q=="string")L=Q+" "+tt[0];else switch(x.precision){case 2:L=oe(Q/255)+" "+tt[0];break;case 3:default:L=B(Q/255)+" "+tt[0]}else if(We===void 0||Fn(We)==="object"){if(We&&!isNaN(We.a)&&We.a===0)return L=["1.","1.","1.",tt[1]].join(" ");if(typeof Q=="string")L=[Q,de,Le,tt[1]].join(" ");else switch(x.precision){case 2:L=[oe(Q/255),oe(de/255),oe(Le/255),tt[1]].join(" ");break;default:case 3:L=[B(Q/255),B(de/255),B(Le/255),tt[1]].join(" ")}}else if(typeof Q=="string")L=[Q,de,Le,We,tt[2]].join(" ");else switch(x.precision){case 2:L=[oe(Q),oe(de),oe(Le),oe(We),tt[2]].join(" ");break;case 3:default:L=[B(Q),B(de),B(Le),B(We),tt[2]].join(" ")}return L},bs=v.__private__.getFilters=function(){return o},_s=v.__private__.putStream=function(x){var L=(x=x||{}).data||"",Q=x.filters||bs(),de=x.alreadyAppliedFilters||[],Le=x.addLength1||!1,We=L.length,tt=x.objectId,kt=function(Fr){return Fr};if(f!==null&&tt===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");f!==null&&(kt=Rr.encryptor(tt,0));var Rt={};Q===!0&&(Q=["FlateEncode"]);var rn=x.additionalKeyValues||[],en=(Rt=Zt.API.processDataByFilters!==void 0?Zt.API.processDataByFilters(L,Q):{data:L,reverseChain:[]}).reverseChain+(Array.isArray(de)?de.join(" "):de.toString());if(Rt.data.length!==0&&(rn.push({key:"Length",value:Rt.data.length}),Le===!0&&rn.push({key:"Length1",value:We})),en.length!=0)if(en.split("/").length-1==1)rn.push({key:"Filter",value:en});else{rn.push({key:"Filter",value:"["+en+"]"});for(var yn=0;yn<rn.length;yn+=1)if(rn[yn].key==="DecodeParms"){for(var Zn=[],Xn=0;Xn<Rt.reverseChain.split("/").length-1;Xn+=1)Zn.push("null");Zn.push(rn[yn].value),rn[yn].value="["+Zn.join(" ")+"]"}}re("<<");for(var pr=0;pr<rn.length;pr++)re("/"+rn[pr].key+" "+rn[pr].value);re(">>"),Rt.data.length!==0&&(re("stream"),re(kt(Rt.data)),re("endstream"))},Or=v.__private__.putPage=function(x){var L=x.number,Q=x.data,de=x.objId,Le=x.contentsObjId;Wr(de,!0),re("<</Type /Page"),re("/Parent "+x.rootDictionaryObjId+" 0 R"),re("/Resources "+x.resourceDictionaryObjId+" 0 R"),re("/MediaBox ["+parseFloat(te(x.mediaBox.bottomLeftX))+" "+parseFloat(te(x.mediaBox.bottomLeftY))+" "+te(x.mediaBox.topRightX)+" "+te(x.mediaBox.topRightY)+"]"),x.cropBox!==null&&re("/CropBox ["+te(x.cropBox.bottomLeftX)+" "+te(x.cropBox.bottomLeftY)+" "+te(x.cropBox.topRightX)+" "+te(x.cropBox.topRightY)+"]"),x.bleedBox!==null&&re("/BleedBox ["+te(x.bleedBox.bottomLeftX)+" "+te(x.bleedBox.bottomLeftY)+" "+te(x.bleedBox.topRightX)+" "+te(x.bleedBox.topRightY)+"]"),x.trimBox!==null&&re("/TrimBox ["+te(x.trimBox.bottomLeftX)+" "+te(x.trimBox.bottomLeftY)+" "+te(x.trimBox.topRightX)+" "+te(x.trimBox.topRightY)+"]"),x.artBox!==null&&re("/ArtBox ["+te(x.artBox.bottomLeftX)+" "+te(x.artBox.bottomLeftY)+" "+te(x.artBox.topRightX)+" "+te(x.artBox.topRightY)+"]"),typeof x.userUnit=="number"&&x.userUnit!==1&&re("/UserUnit "+x.userUnit),Nn.publish("putPage",{objId:de,pageContext:Yt[L],pageNumber:L,page:Q}),re("/Contents "+Le+" 0 R"),re(">>"),re("endobj");var We=Q.join(`
`);return M===_.ADVANCED&&(We+=`
Q`),Wr(Le,!0),_s({data:We,filters:bs(),objectId:Le}),re("endobj"),de},Fi=v.__private__.putPages=function(){var x,L,Q=[];for(x=1;x<=An;x++)Yt[x].objId=Yn(),Yt[x].contentsObjId=Yn();for(x=1;x<=An;x++)Q.push(Or({number:x,data:Ke[x],objId:Yt[x].objId,contentsObjId:Yt[x].contentsObjId,mediaBox:Yt[x].mediaBox,cropBox:Yt[x].cropBox,bleedBox:Yt[x].bleedBox,trimBox:Yt[x].trimBox,artBox:Yt[x].artBox,userUnit:Yt[x].userUnit,rootDictionaryObjId:ci,resourceDictionaryObjId:Pr}));Wr(ci,!0),re("<</Type /Pages");var de="/Kids [";for(L=0;L<An;L++)de+=Q[L]+" 0 R ";re(de+"]"),re("/Count "+An),re(">>"),re("endobj"),Nn.publish("postPutPages")},As=function(x){Nn.publish("putFont",{font:x,out:re,newObject:br,putStream:_s}),x.isAlreadyPutted!==!0&&(x.objectNumber=br(),re("<<"),re("/Type /Font"),re("/BaseFont /"+fc(x.postScriptName)),re("/Subtype /Type1"),typeof x.encoding=="string"&&re("/Encoding /"+x.encoding),re("/FirstChar 32"),re("/LastChar 255"),re(">>"),re("endobj"))},ma=function(){for(var x in ln)ln.hasOwnProperty(x)&&(m===!1||m===!0&&g.hasOwnProperty(x))&&As(ln[x])},Bi=function(x){x.objectNumber=br();var L=[];L.push({key:"Type",value:"/XObject"}),L.push({key:"Subtype",value:"/Form"}),L.push({key:"BBox",value:"["+[te(x.x),te(x.y),te(x.x+x.width),te(x.y+x.height)].join(" ")+"]"}),L.push({key:"Matrix",value:"["+x.matrix.toString()+"]"});var Q=x.pages[1].join(`
`);_s({data:Q,additionalKeyValues:L,objectId:x.objectNumber}),re("endobj")},Bn=function(){for(var x in Er)Er.hasOwnProperty(x)&&Bi(Er[x])},Xs=function(x,L){var Q,de=[],Le=1/(L-1);for(Q=0;Q<1;Q+=Le)de.push(Q);if(de.push(1),x[0].offset!=0){var We={offset:0,color:x[0].color};x.unshift(We)}if(x[x.length-1].offset!=1){var tt={offset:1,color:x[x.length-1].color};x.push(tt)}for(var kt="",Rt=0,rn=0;rn<de.length;rn++){for(Q=de[rn];Q>x[Rt+1].offset;)Rt++;var en=x[Rt].offset,yn=(Q-en)/(x[Rt+1].offset-en),Zn=x[Rt].color,Xn=x[Rt+1].color;kt+=le(Math.round((1-yn)*Zn[0]+yn*Xn[0]).toString(16))+le(Math.round((1-yn)*Zn[1]+yn*Xn[1]).toString(16))+le(Math.round((1-yn)*Zn[2]+yn*Xn[2]).toString(16))}return kt.trim()},Os=function(x,L){L||(L=21);var Q=br(),de=Xs(x.colors,L),Le=[];Le.push({key:"FunctionType",value:"0"}),Le.push({key:"Domain",value:"[0.0 1.0]"}),Le.push({key:"Size",value:"["+L+"]"}),Le.push({key:"BitsPerSample",value:"8"}),Le.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),Le.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),_s({data:de,additionalKeyValues:Le,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:Q}),re("endobj"),x.objectNumber=br(),re("<< /ShadingType "+x.type),re("/ColorSpace /DeviceRGB");var We="/Coords ["+te(parseFloat(x.coords[0]))+" "+te(parseFloat(x.coords[1]))+" ";x.type===2?We+=te(parseFloat(x.coords[2]))+" "+te(parseFloat(x.coords[3])):We+=te(parseFloat(x.coords[2]))+" "+te(parseFloat(x.coords[3]))+" "+te(parseFloat(x.coords[4]))+" "+te(parseFloat(x.coords[5])),re(We+="]"),x.matrix&&re("/Matrix ["+x.matrix.toString()+"]"),re("/Function "+Q+" 0 R"),re("/Extend [true true]"),re(">>"),re("endobj")},Hl=function(x,L){var Q=Yn(),de=br();L.push({resourcesOid:Q,objectOid:de}),x.objectNumber=de;var Le=[];Le.push({key:"Type",value:"/Pattern"}),Le.push({key:"PatternType",value:"1"}),Le.push({key:"PaintType",value:"1"}),Le.push({key:"TilingType",value:"1"}),Le.push({key:"BBox",value:"["+x.boundingBox.map(te).join(" ")+"]"}),Le.push({key:"XStep",value:te(x.xStep)}),Le.push({key:"YStep",value:te(x.yStep)}),Le.push({key:"Resources",value:Q+" 0 R"}),x.matrix&&Le.push({key:"Matrix",value:"["+x.matrix.toString()+"]"}),_s({data:x.stream,additionalKeyValues:Le,objectId:x.objectNumber}),re("endobj")},Rs=function(x){var L;for(L in xt)xt.hasOwnProperty(L)&&(xt[L]instanceof Sl?Os(xt[L]):xt[L]instanceof Nc&&Hl(xt[L],x))},ga=function(x){for(var L in x.objectNumber=br(),re("<<"),x)switch(L){case"opacity":re("/ca "+oe(x[L]));break;case"stroke-opacity":re("/CA "+oe(x[L]))}re(">>"),re("endobj")},rl=function(){var x;for(x in Ge)Ge.hasOwnProperty(x)&&ga(Ge[x])},va=function(){for(var x in re("/XObject <<"),Er)Er.hasOwnProperty(x)&&Er[x].objectNumber>=0&&re("/"+x+" "+Er[x].objectNumber+" 0 R");Nn.publish("putXobjectDict"),re(">>")},ui=function(){Rr.oid=br(),re("<<"),re("/Filter /Standard"),re("/V "+Rr.v),re("/R "+Rr.r),re("/U <"+Rr.toHexString(Rr.U)+">"),re("/O <"+Rr.toHexString(Rr.O)+">"),re("/P "+Rr.P),re(">>"),re("endobj")},sl=function(){for(var x in re("/Font <<"),ln)ln.hasOwnProperty(x)&&(m===!1||m===!0&&g.hasOwnProperty(x))&&re("/"+x+" "+ln[x].objectNumber+" 0 R");re(">>")},oo=function(){if(Object.keys(xt).length>0){for(var x in re("/Shading <<"),xt)xt.hasOwnProperty(x)&&xt[x]instanceof Sl&&xt[x].objectNumber>=0&&re("/"+x+" "+xt[x].objectNumber+" 0 R");Nn.publish("putShadingPatternDict"),re(">>")}},ya=function(x){if(Object.keys(xt).length>0){for(var L in re("/Pattern <<"),xt)xt.hasOwnProperty(L)&&xt[L]instanceof v.TilingPattern&&xt[L].objectNumber>=0&&xt[L].objectNumber<x&&re("/"+L+" "+xt[L].objectNumber+" 0 R");Nn.publish("putTilingPatternDict"),re(">>")}},pn=function(){if(Object.keys(Ge).length>0){var x;for(x in re("/ExtGState <<"),Ge)Ge.hasOwnProperty(x)&&Ge[x].objectNumber>=0&&re("/"+x+" "+Ge[x].objectNumber+" 0 R");Nn.publish("putGStateDict"),re(">>")}},nr=function(x){Wr(x.resourcesOid,!0),re("<<"),re("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),sl(),oo(),ya(x.objectOid),pn(),va(),re(">>"),re("endobj")},il=function(){var x=[];ma(),rl(),Bn(),Rs(x),Nn.publish("putResources"),x.forEach(nr),nr({resourcesOid:Pr,objectOid:Number.MAX_SAFE_INTEGER}),Nn.publish("postPutResources")},al=function(){Nn.publish("putAdditionalObjects");for(var x=0;x<Ye.length;x++){var L=Ye[x];Wr(L.objId,!0),re(L.content),re("endobj")}Nn.publish("postPutAdditionalObjects")},Cn=function(x){lt[x.fontName]=lt[x.fontName]||{},lt[x.fontName][x.fontStyle]=x.id},di=function(x,L,Q,de,Le){var We={id:"F"+(Object.keys(ln).length+1).toString(10),postScriptName:x,fontName:L,fontStyle:Q,encoding:de,isStandardFont:Le||!1,metadata:{}};return Nn.publish("addFont",{font:We,instance:this}),ln[We.id]=We,Cn(We),We.id},xa=function(x){for(var L=0,Q=ne.length;L<Q;L++){var de=di.call(this,x[L][0],x[L][1],x[L][2],ne[L][3],!0);m===!1&&(g[de]=!0);var Le=x[L][0].split("-");Cn({id:de,fontName:Le[0],fontStyle:Le[1]||""})}Nn.publish("addFonts",{fonts:ln,dictionary:lt})},Hr=function(x){return x.foo=function(){try{return x.apply(this,arguments)}catch(de){var L=de.stack||"";~L.indexOf(" at ")&&(L=L.split(" at ")[1]);var Q="Error in function "+L.split(`
`)[0].split("<")[0]+": "+de.message;if(!Xt.console)throw new Error(Q);Xt.console.error(Q,de),Xt.alert&&alert(Q)}},x.foo.bar=x,x.foo},Vi=function(x,L){var Q,de,Le,We,tt,kt,Rt,rn,en;if(Le=(L=L||{}).sourceEncoding||"Unicode",tt=L.outputEncoding,(L.autoencode||tt)&&ln[Qt].metadata&&ln[Qt].metadata[Le]&&ln[Qt].metadata[Le].encoding&&(We=ln[Qt].metadata[Le].encoding,!tt&&ln[Qt].encoding&&(tt=ln[Qt].encoding),!tt&&We.codePages&&(tt=We.codePages[0]),typeof tt=="string"&&(tt=We[tt]),tt)){for(Rt=!1,kt=[],Q=0,de=x.length;Q<de;Q++)(rn=tt[x.charCodeAt(Q)])?kt.push(String.fromCharCode(rn)):kt.push(x[Q]),kt[Q].charCodeAt(0)>>8&&(Rt=!0);x=kt.join("")}for(Q=x.length;Rt===void 0&&Q!==0;)x.charCodeAt(Q-1)>>8&&(Rt=!0),Q--;if(!Rt)return x;for(kt=L.noBOM?[]:[254,255],Q=0,de=x.length;Q<de;Q++){if((en=(rn=x.charCodeAt(Q))>>8)>>8)throw new Error("Character at position "+Q+" of string '"+x+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");kt.push(en),kt.push(rn-(en<<8))}return String.fromCharCode.apply(void 0,kt)},Kr=v.__private__.pdfEscape=v.pdfEscape=function(x,L){return Vi(x,L).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},qi=v.__private__.beginPage=function(x){Ke[++An]=[],Yt[An]={objId:0,contentsObjId:0,userUnit:Number(l),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(x[0]),topRightY:Number(x[1])}},ll(An),qe(Ke[z])},ol=function(x,L){var Q,de,Le;switch(n=L||n,typeof x=="string"&&(Q=k(x.toLowerCase()),Array.isArray(Q)&&(de=Q[0],Le=Q[1])),Array.isArray(x)&&(de=x[0]*ft,Le=x[1]*ft),isNaN(de)&&(de=s[0],Le=s[1]),(de>14400||Le>14400)&&(Wn.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),Le=Math.min(14400,Le)),s=[de,Le],n.substr(0,1)){case"l":Le>de&&(s=[Le,de]);break;case"p":de>Le&&(s=[Le,de])}qi(s),Pa(hl),re(as),Ca!==0&&re(Ca+" J"),Ta!==0&&re(Ta+" j"),Nn.publish("addPage",{pageNumber:An})},lo=function(x){x>0&&x<=An&&(Ke.splice(x,1),Yt.splice(x,1),An--,z>An&&(z=An),this.setPage(z))},ll=function(x){x>0&&x<=An&&(z=x)},ba=v.__private__.getNumberOfPages=v.getNumberOfPages=function(){return Ke.length-1},cl=function(x,L,Q){var de,Le=void 0;return Q=Q||{},x=x!==void 0?x:ln[Qt].fontName,L=L!==void 0?L:ln[Qt].fontStyle,de=x.toLowerCase(),lt[de]!==void 0&<[de][L]!==void 0?Le=lt[de][L]:lt[x]!==void 0&<[x][L]!==void 0?Le=lt[x][L]:Q.disableWarning===!1&&Wn.warn("Unable to look up font label for font '"+x+"', '"+L+"'. Refer to getFontList() for available fonts."),Le||Q.noFallback||(Le=lt.times[L])==null&&(Le=lt.times.normal),Le},Xc=v.__private__.putInfo=function(){var x=br(),L=function(de){return de};for(var Q in f!==null&&(L=Rr.encryptor(x,0)),re("<<"),re("/Producer ("+Kr(L("jsPDF "+Zt.version))+")"),Ot)Ot.hasOwnProperty(Q)&&Ot[Q]&&re("/"+Q.substr(0,1).toUpperCase()+Q.substr(1)+" ("+Kr(L(Ot[Q]))+")");re("/CreationDate ("+Kr(L(Ne))+")"),re(">>"),re("endobj")},vn=v.__private__.putCatalog=function(x){var L=(x=x||{}).rootDictionaryObjId||ci;switch(br(),re("<<"),re("/Type /Catalog"),re("/Pages "+L+" 0 R"),Re||(Re="fullwidth"),Re){case"fullwidth":re("/OpenAction [3 0 R /FitH null]");break;case"fullheight":re("/OpenAction [3 0 R /FitV null]");break;case"fullpage":re("/OpenAction [3 0 R /Fit]");break;case"original":re("/OpenAction [3 0 R /XYZ null null 1]");break;default:var Q=""+Re;Q.substr(Q.length-1)==="%"&&(Re=parseInt(Re)/100),typeof Re=="number"&&re("/OpenAction [3 0 R /XYZ null null "+oe(Re)+"]")}switch(Pt||(Pt="continuous"),Pt){case"continuous":re("/PageLayout /OneColumn");break;case"single":re("/PageLayout /SinglePage");break;case"two":case"twoleft":re("/PageLayout /TwoColumnLeft");break;case"tworight":re("/PageLayout /TwoColumnRight")}et&&re("/PageMode /"+et),Nn.publish("putCatalog"),re(">>"),re("endobj")},ul=v.__private__.putTrailer=function(){re("trailer"),re("<<"),re("/Size "+(ue+1)),re("/Root "+ue+" 0 R"),re("/Info "+(ue-1)+" 0 R"),f!==null&&re("/Encrypt "+Rr.oid+" 0 R"),re("/ID [ <"+he+"> <"+he+"> ]"),re(">>")},Jc=v.__private__.putHeader=function(){re("%PDF-"+N),re("%ºß¬à")},Qc=v.__private__.putXRef=function(){var x="0000000000";re("xref"),re("0 "+(ue+1)),re("0000000000 65535 f ");for(var L=1;L<=ue;L++)typeof ve[L]=="function"?re((x+ve[L]()).slice(-10)+" 00000 n "):ve[L]!==void 0?re((x+ve[L]).slice(-10)+" 00000 n "):re("0000000000 00000 n ")},ar=v.__private__.buildDocument=function(){It(),qe(Pe),Nn.publish("buildDocument"),Jc(),Fi(),al(),il(),f!==null&&ui(),Xc(),vn();var x=ce;return Qc(),ul(),re("startxref"),re(""+x),re("%%EOF"),qe(Ke[z]),Pe.join(`
`)},Fs=v.__private__.getBlob=function(x){return new Blob([X(x)],{type:"application/pdf"})},hi=v.output=v.__private__.output=Hr(function(x,L){switch(typeof(L=L||{})=="string"?L={filename:L}:L.filename=L.filename||"generated.pdf",x){case void 0:return ar();case"save":v.save(L.filename);break;case"arraybuffer":return X(ar());case"blob":return Fs(ar());case"bloburi":case"bloburl":if(Xt.URL!==void 0&&typeof Xt.URL.createObjectURL=="function")return Xt.URL&&Xt.URL.createObjectURL(Fs(ar()))||void 0;Wn.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var Q="",de=ar();try{Q=Um(de)}catch{Q=Um(unescape(encodeURIComponent(de)))}return"data:application/pdf;filename="+L.filename+";base64,"+Q;case"pdfobjectnewwindow":if(Object.prototype.toString.call(Xt)==="[object Window]"){var Le="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",We=' integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==" crossorigin="anonymous"';L.pdfObjectUrl&&(Le=L.pdfObjectUrl,We="");var tt='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><script src="'+Le+'"'+We+'><\/script><script >PDFObject.embed("'+this.output("dataurlstring")+'", '+JSON.stringify(L)+");<\/script></body></html>",kt=Xt.open();return kt!==null&&kt.document.write(tt),kt}throw new Error("The option pdfobjectnewwindow just works in a browser-environment.");case"pdfjsnewwindow":if(Object.prototype.toString.call(Xt)==="[object Window]"){var Rt='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><iframe id="pdfViewer" src="'+(L.pdfJsUrl||"examples/PDF.js/web/viewer.html")+"?file=&downloadName="+L.filename+'" width="500px" height="400px" /></body></html>',rn=Xt.open();if(rn!==null){rn.document.write(Rt);var en=this;rn.document.documentElement.querySelector("#pdfViewer").onload=function(){rn.document.title=L.filename,rn.document.documentElement.querySelector("#pdfViewer").contentWindow.PDFViewerApplication.open(en.output("bloburl"))}}return rn}throw new Error("The option pdfjsnewwindow just works in a browser-environment.");case"dataurlnewwindow":if(Object.prototype.toString.call(Xt)!=="[object Window]")throw new Error("The option dataurlnewwindow just works in a browser-environment.");var yn='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><iframe src="'+this.output("datauristring",L)+'"></iframe></body></html>',Zn=Xt.open();if(Zn!==null&&(Zn.document.write(yn),Zn.document.title=L.filename),Zn||typeof safari>"u")return Zn;break;case"datauri":case"dataurl":return Xt.document.location.href=this.output("datauristring",L);default:return null}}),Bs=function(x){return Array.isArray(pa)===!0&&pa.indexOf(x)>-1};switch(r){case"pt":ft=1;break;case"mm":ft=72/25.4;break;case"cm":ft=72/2.54;break;case"in":ft=72;break;case"px":ft=Bs("px_scaling")==1?.75:96/72;break;case"pc":case"em":ft=12;break;case"ex":ft=6;break;default:if(typeof r!="number")throw new Error("Invalid unit: "+r);ft=r}var Rr=null;$e(),G();var Kl=function(x){return f!==null?Rr.encryptor(x,0):function(L){return L}},or=v.__private__.getPageInfo=v.getPageInfo=function(x){if(isNaN(x)||x%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfo");return{objId:Yt[x].objId,pageNumber:x,pageContext:Yt[x]}},Vt=v.__private__.getPageInfoByObjId=function(x){if(isNaN(x)||x%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");for(var L in Yt)if(Yt[L].objId===x)break;return or(L)},wa=v.__private__.getCurrentPageInfo=v.getCurrentPageInfo=function(){return{objId:Yt[z].objId,pageNumber:z,pageContext:Yt[z]}};v.addPage=function(){return ol.apply(this,arguments),this},v.setPage=function(){return ll.apply(this,arguments),qe.call(this,Ke[z]),this},v.insertPage=function(x){return this.addPage(),this.movePage(z,x),this},v.movePage=function(x,L){var Q,de;if(x>L){Q=Ke[x],de=Yt[x];for(var Le=x;Le>L;Le--)Ke[Le]=Ke[Le-1],Yt[Le]=Yt[Le-1];Ke[L]=Q,Yt[L]=de,this.setPage(L)}else if(x<L){Q=Ke[x],de=Yt[x];for(var We=x;We<L;We++)Ke[We]=Ke[We+1],Yt[We]=Yt[We+1];Ke[L]=Q,Yt[L]=de,this.setPage(L)}return this},v.deletePage=function(){return lo.apply(this,arguments),this},v.__private__.text=v.text=function(x,L,Q,de,Le){var We,tt,kt,Rt,rn,en,yn,Zn,Xn,pr=(de=de||{}).scope||this;if(typeof x=="number"&&typeof L=="number"&&(typeof Q=="string"||Array.isArray(Q))){var Fr=Q;Q=L,L=x,x=Fr}if(arguments[3]instanceof qt?(W("The transform parameter of text() with a Matrix value"),Xn=Le):(kt=arguments[4],Rt=arguments[5],Fn(yn=arguments[3])==="object"&&yn!==null||(typeof kt=="string"&&(Rt=kt,kt=null),typeof yn=="string"&&(Rt=yn,yn=null),typeof yn=="number"&&(kt=yn,yn=null),de={flags:yn,angle:kt,align:Rt})),isNaN(L)||isNaN(Q)||x==null)throw new Error("Invalid arguments passed to jsPDF.text");if(x.length===0)return pr;var wr="",zs=!1,os=typeof de.lineHeightFactor=="number"?de.lineHeightFactor:Aa,Cs=pr.internal.scaleFactor;function pl(Ct){return Ct=Ct.split(" ").join(Array(de.TabLen||9).join(" ")),Kr(Ct,yn)}function mo(Ct){for(var Mt,Ft=Ct.concat(),kn=[],Ut=Ft.length;Ut--;)typeof(Mt=Ft.shift())=="string"?kn.push(Mt):Array.isArray(Ct)&&(Mt.length===1||Mt[1]===void 0&&Mt[2]===void 0)?kn.push(Mt[0]):kn.push([Mt[0],Mt[1],Mt[2]]);return kn}function ml(Ct,Mt){var Ft;if(typeof Ct=="string")Ft=Mt(Ct)[0];else if(Array.isArray(Ct)){for(var kn,Ut,mr=Ct.concat(),lr=[],Ea=mr.length;Ea--;)typeof(kn=mr.shift())=="string"?lr.push(Mt(kn)[0]):Array.isArray(kn)&&typeof kn[0]=="string"&&(Ut=Mt(kn[0],kn[1],kn[2]),lr.push([Ut[0],Ut[1],Ut[2]]));Ft=lr}return Ft}var go=!1,gl=!0;if(typeof x=="string")go=!0;else if(Array.isArray(x)){var Gi=x.concat();tt=[];for(var ls,mn=Gi.length;mn--;)(typeof(ls=Gi.shift())!="string"||Array.isArray(ls)&&typeof ls[0]!="string")&&(gl=!1);go=gl}if(go===!1)throw new Error('Type of text must be string or Array. "'+x+'" is not recognized.');typeof x=="string"&&(x=x.match(/[\r?\n]/)?x.split(/\r\n|\r|\n/g):[x]);var vi=fe/pr.internal.scaleFactor,Br=vi*(os-1);switch(de.baseline){case"bottom":Q-=Br;break;case"top":Q+=vi-Br;break;case"hanging":Q+=vi-2*Br;break;case"middle":Q+=vi/2-Br}if((en=de.maxWidth||0)>0&&(typeof x=="string"?x=pr.splitTextToSize(x,en):Object.prototype.toString.call(x)==="[object Array]"&&(x=x.reduce(function(Ct,Mt){return Ct.concat(pr.splitTextToSize(Mt,en))},[]))),We={text:x,x:L,y:Q,options:de,mutex:{pdfEscape:Kr,activeFontKey:Qt,fonts:ln,activeFontSize:fe}},Nn.publish("preProcessText",We),x=We.text,kt=(de=We.options).angle,!(Xn instanceof qt)&&kt&&typeof kt=="number"){kt*=Math.PI/180,de.rotationDirection===0&&(kt=-kt),M===_.ADVANCED&&(kt=-kt);var vo=Math.cos(kt),Da=Math.sin(kt);Xn=new qt(vo,Da,-Da,vo,0,0)}else kt&&kt instanceof qt&&(Xn=kt);M!==_.ADVANCED||Xn||(Xn=wn),(rn=de.charSpace||uo)!==void 0&&(wr+=te(T(rn))+` Tc
`,this.setCharSpace(this.getCharSpace()||0)),(Zn=de.horizontalScale)!==void 0&&(wr+=te(100*Zn)+` Tz
`),de.lang;var es=-1,yi=de.renderingMode!==void 0?de.renderingMode:de.stroke,Ia=pr.internal.getCurrentPageInfo().pageContext;switch(yi){case 0:case!1:case"fill":es=0;break;case 1:case!0:case"stroke":es=1;break;case 2:case"fillThenStroke":es=2;break;case 3:case"invisible":es=3;break;case 4:case"fillAndAddForClipping":es=4;break;case 5:case"strokeAndAddPathForClipping":es=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":es=6;break;case 7:case"addToPathForClipping":es=7}var xi=Ia.usedRenderingMode!==void 0?Ia.usedRenderingMode:-1;es!==-1?wr+=es+` Tr
`:xi!==-1&&(wr+=`0 Tr
`),es!==-1&&(Ia.usedRenderingMode=es),Rt=de.align||"left";var Nr,Ma=fe*os,h=pr.internal.pageSize.getWidth(),y=ln[Qt];rn=de.charSpace||uo,en=de.maxWidth||0,yn=Object.assign({autoencode:!0,noBOM:!0},de.flags);var w=[],A=function(Ct){return pr.getStringUnitWidth(Ct,{font:y,charSpace:rn,fontSize:fe,doKerning:!1})*fe/Cs};if(Object.prototype.toString.call(x)==="[object Array]"){var C;tt=mo(x),Rt!=="left"&&(Nr=tt.map(A));var R,H=0;if(Rt==="right"){L-=Nr[0],x=[],mn=tt.length;for(var se=0;se<mn;se++)se===0?(R=Js(L),C=qs(Q)):(R=T(H-Nr[se]),C=-Ma),x.push([tt[se],R,C]),H=Nr[se]}else if(Rt==="center"){L-=Nr[0]/2,x=[],mn=tt.length;for(var me=0;me<mn;me++)me===0?(R=Js(L),C=qs(Q)):(R=T((H-Nr[me])/2),C=-Ma),x.push([tt[me],R,C]),H=Nr[me]}else if(Rt==="left"){x=[],mn=tt.length;for(var we=0;we<mn;we++)x.push(tt[we])}else if(Rt==="justify"&&y.encoding==="Identity-H"){x=[],mn=tt.length,en=en!==0?en:h;for(var _e=0,ie=0;ie<mn;ie++)if(C=ie===0?qs(Q):-Ma,R=ie===0?Js(L):_e,ie<mn-1){var Te=T((en-Nr[ie])/(tt[ie].split(" ").length-1)),pe=tt[ie].split(" ");x.push([pe[0]+" ",R,C]),_e=0;for(var je=1;je<pe.length;je++){var Ce=(A(pe[je-1]+" "+pe[je])-A(pe[je]))*Cs+Te;je==pe.length-1?x.push([pe[je],Ce,0]):x.push([pe[je]+" ",Ce,0]),_e-=Ce}}else x.push([tt[ie],R,C]);x.push(["",_e,0])}else{if(Rt!=="justify")throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');for(x=[],mn=tt.length,en=en!==0?en:h,ie=0;ie<mn;ie++)C=ie===0?qs(Q):-Ma,R=ie===0?Js(L):0,ie<mn-1?w.push(te(T((en-Nr[ie])/(tt[ie].split(" ").length-1)))):w.push(0),x.push([tt[ie],R,C])}}var Se=typeof de.R2L=="boolean"?de.R2L:Fe;Se===!0&&(x=ml(x,function(Ct,Mt,Ft){return[Ct.split("").reverse().join(""),Mt,Ft]})),We={text:x,x:L,y:Q,options:de,mutex:{pdfEscape:Kr,activeFontKey:Qt,fonts:ln,activeFontSize:fe}},Nn.publish("postProcessText",We),x=We.text,zs=We.mutex.isHex||!1;var Ee=ln[Qt].encoding;Ee!=="WinAnsiEncoding"&&Ee!=="StandardEncoding"||(x=ml(x,function(Ct,Mt,Ft){return[pl(Ct),Mt,Ft]})),tt=mo(x),x=[];for(var Be,Ve,He,rt=0,ut=1,st=Array.isArray(tt[0])?ut:rt,at="",pt=function(Ct,Mt,Ft){var kn="";return Ft instanceof qt?(Ft=typeof de.angle=="number"?is(Ft,new qt(1,0,0,1,Ct,Mt)):is(new qt(1,0,0,1,Ct,Mt),Ft),M===_.ADVANCED&&(Ft=is(new qt(1,0,0,-1,0,0),Ft)),kn=Ft.join(" ")+` Tm
`):kn=te(Ct)+" "+te(Mt)+` Td
`,kn},ot=0;ot<tt.length;ot++){switch(at="",st){case ut:He=(zs?"<":"(")+tt[ot][0]+(zs?">":")"),Be=parseFloat(tt[ot][1]),Ve=parseFloat(tt[ot][2]);break;case rt:He=(zs?"<":"(")+tt[ot]+(zs?">":")"),Be=Js(L),Ve=qs(Q)}w!==void 0&&w[ot]!==void 0&&(at=w[ot]+` Tw
`),ot===0?x.push(at+pt(Be,Ve,Xn)+He):st===rt?x.push(at+He):st===ut&&x.push(at+pt(Be,Ve,Xn)+He)}x=st===rt?x.join(` Tj
T* `):x.join(` Tj
`),x+=` Tj
`;var bt=`BT
/`;return bt+=Qt+" "+fe+` Tf
`,bt+=te(fe*os)+` TL
`,bt+=Qs+`
`,bt+=wr,bt+=x,re(bt+="ET"),g[Qt]=!0,pr};var Na=v.__private__.clip=v.clip=function(x){return re(x==="evenodd"?"W*":"W"),this};v.clipEvenOdd=function(){return Na("evenodd")},v.__private__.discardPath=v.discardPath=function(){return re("n"),this};var Ps=v.__private__.isValidStyle=function(x){var L=!1;return[void 0,null,"S","D","F","DF","FD","f","f*","B","B*","n"].indexOf(x)!==-1&&(L=!0),L};v.__private__.setDefaultPathOperation=v.setDefaultPathOperation=function(x){return Ps(x)&&(d=x),this};var Vs=v.__private__.getStyle=v.getStyle=function(x){var L=d;switch(x){case"D":case"S":L="S";break;case"F":L="f";break;case"FD":case"DF":L="B";break;case"f":case"f*":case"B":case"B*":L=x}return L},Gl=v.close=function(){return re("h"),this};v.stroke=function(){return re("S"),this},v.fill=function(x){return Qr("f",x),this},v.fillEvenOdd=function(x){return Qr("f*",x),this},v.fillStroke=function(x){return Qr("B",x),this},v.fillStrokeEvenOdd=function(x){return Qr("B*",x),this};var Qr=function(x,L){Fn(L)==="object"?dl(L,x):re(x)},ja=function(x){x===null||M===_.ADVANCED&&x===void 0||(x=Vs(x),re(x))};function Yl(x,L,Q,de,Le){var We=new Nc(L||this.boundingBox,Q||this.xStep,de||this.yStep,this.gState,Le||this.matrix);We.stream=this.stream;var tt=x+"$$"+this.cloneIndex+++"$$";return Sn(tt,We),We}var dl=function(x,L){var Q=gn[x.key],de=xt[Q];if(de instanceof Sl)re("q"),re(Sa(L)),de.gState&&v.setGState(de.gState),re(x.matrix.toString()+" cm"),re("/"+Q+" sh"),re("Q");else if(de instanceof Nc){var Le=new qt(1,0,0,-1,0,Us());x.matrix&&(Le=Le.multiply(x.matrix||wn),Q=Yl.call(de,x.key,x.boundingBox,x.xStep,x.yStep,Le).id),re("q"),re("/Pattern cs"),re("/"+Q+" scn"),de.gState&&v.setGState(de.gState),re(L),re("Q")}},Sa=function(x){switch(x){case"f":case"F":return"W n";case"f*":return"W* n";case"B":return"W S";case"B*":return"W* S";case"S":return"W S";case"n":return"W n"}},ka=v.moveTo=function(x,L){return re(te(T(x))+" "+te(Z(L))+" m"),this},Ui=v.lineTo=function(x,L){return re(te(T(x))+" "+te(Z(L))+" l"),this},zi=v.curveTo=function(x,L,Q,de,Le,We){return re([te(T(x)),te(Z(L)),te(T(Q)),te(Z(de)),te(T(Le)),te(Z(We)),"c"].join(" ")),this};v.__private__.line=v.line=function(x,L,Q,de,Le){if(isNaN(x)||isNaN(L)||isNaN(Q)||isNaN(de)||!Ps(Le))throw new Error("Invalid arguments passed to jsPDF.line");return M===_.COMPAT?this.lines([[Q-x,de-L]],x,L,[1,1],Le||"S"):this.lines([[Q-x,de-L]],x,L,[1,1]).stroke()},v.__private__.lines=v.lines=function(x,L,Q,de,Le,We){var tt,kt,Rt,rn,en,yn,Zn,Xn,pr,Fr,wr,zs;if(typeof x=="number"&&(zs=Q,Q=L,L=x,x=zs),de=de||[1,1],We=We||!1,isNaN(L)||isNaN(Q)||!Array.isArray(x)||!Array.isArray(de)||!Ps(Le)||typeof We!="boolean")throw new Error("Invalid arguments passed to jsPDF.lines");for(ka(L,Q),tt=de[0],kt=de[1],rn=x.length,Fr=L,wr=Q,Rt=0;Rt<rn;Rt++)(en=x[Rt]).length===2?(Fr=en[0]*tt+Fr,wr=en[1]*kt+wr,Ui(Fr,wr)):(yn=en[0]*tt+Fr,Zn=en[1]*kt+wr,Xn=en[2]*tt+Fr,pr=en[3]*kt+wr,Fr=en[4]*tt+Fr,wr=en[5]*kt+wr,zi(yn,Zn,Xn,pr,Fr,wr));return We&&Gl(),ja(Le),this},v.path=function(x){for(var L=0;L<x.length;L++){var Q=x[L],de=Q.c;switch(Q.op){case"m":ka(de[0],de[1]);break;case"l":Ui(de[0],de[1]);break;case"c":zi.apply(this,de);break;case"h":Gl()}}return this},v.__private__.rect=v.rect=function(x,L,Q,de,Le){if(isNaN(x)||isNaN(L)||isNaN(Q)||isNaN(de)||!Ps(Le))throw new Error("Invalid arguments passed to jsPDF.rect");return M===_.COMPAT&&(de=-de),re([te(T(x)),te(Z(L)),te(T(Q)),te(T(de)),"re"].join(" ")),ja(Le),this},v.__private__.triangle=v.triangle=function(x,L,Q,de,Le,We,tt){if(isNaN(x)||isNaN(L)||isNaN(Q)||isNaN(de)||isNaN(Le)||isNaN(We)||!Ps(tt))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[Q-x,de-L],[Le-Q,We-de],[x-Le,L-We]],x,L,[1,1],tt,!0),this},v.__private__.roundedRect=v.roundedRect=function(x,L,Q,de,Le,We,tt){if(isNaN(x)||isNaN(L)||isNaN(Q)||isNaN(de)||isNaN(Le)||isNaN(We)||!Ps(tt))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var kt=4/3*(Math.SQRT2-1);return Le=Math.min(Le,.5*Q),We=Math.min(We,.5*de),this.lines([[Q-2*Le,0],[Le*kt,0,Le,We-We*kt,Le,We],[0,de-2*We],[0,We*kt,-Le*kt,We,-Le,We],[2*Le-Q,0],[-Le*kt,0,-Le,-We*kt,-Le,-We],[0,2*We-de],[0,-We*kt,Le*kt,-We,Le,-We]],x+Le,L,[1,1],tt,!0),this},v.__private__.ellipse=v.ellipse=function(x,L,Q,de,Le){if(isNaN(x)||isNaN(L)||isNaN(Q)||isNaN(de)||!Ps(Le))throw new Error("Invalid arguments passed to jsPDF.ellipse");var We=4/3*(Math.SQRT2-1)*Q,tt=4/3*(Math.SQRT2-1)*de;return ka(x+Q,L),zi(x+Q,L-tt,x+We,L-de,x,L-de),zi(x-We,L-de,x-Q,L-tt,x-Q,L),zi(x-Q,L+tt,x-We,L+de,x,L+de),zi(x+We,L+de,x+Q,L+tt,x+Q,L),ja(Le),this},v.__private__.circle=v.circle=function(x,L,Q,de){if(isNaN(x)||isNaN(L)||isNaN(Q)||!Ps(de))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(x,L,Q,Q,de)},v.setFont=function(x,L,Q){return Q&&(L=U(L,Q)),Qt=cl(x,L,{disableWarning:!1}),this};var _a=v.__private__.getFont=v.getFont=function(){return ln[cl.apply(v,arguments)]};v.__private__.getFontList=v.getFontList=function(){var x,L,Q={};for(x in lt)if(lt.hasOwnProperty(x))for(L in Q[x]=[],lt[x])lt[x].hasOwnProperty(L)&&Q[x].push(L);return Q},v.addFont=function(x,L,Q,de,Le){var We=["StandardEncoding","MacRomanEncoding","Identity-H","WinAnsiEncoding"];return arguments[3]&&We.indexOf(arguments[3])!==-1?Le=arguments[3]:arguments[3]&&We.indexOf(arguments[3])==-1&&(Q=U(Q,de)),Le=Le||"Identity-H",di.call(this,x,L,Q,Le)};var Aa,hl=t.lineWidth||.200025,fi=v.__private__.getLineWidth=v.getLineWidth=function(){return hl},Pa=v.__private__.setLineWidth=v.setLineWidth=function(x){return hl=x,re(te(T(x))+" w"),this};v.__private__.setLineDash=Zt.API.setLineDash=Zt.API.setLineDashPattern=function(x,L){if(x=x||[],L=L||0,isNaN(L)||!Array.isArray(x))throw new Error("Invalid arguments passed to jsPDF.setLineDash");return x=x.map(function(Q){return te(T(Q))}).join(" "),L=te(T(L)),re("["+x+"] "+L+" d"),this};var co=v.__private__.getLineHeight=v.getLineHeight=function(){return fe*Aa};v.__private__.getLineHeight=v.getLineHeight=function(){return fe*Aa};var Zl=v.__private__.setLineHeightFactor=v.setLineHeightFactor=function(x){return typeof(x=x||1.15)=="number"&&(Aa=x),this},Xl=v.__private__.getLineHeightFactor=v.getLineHeightFactor=function(){return Aa};Zl(t.lineHeight);var Js=v.__private__.getHorizontalCoordinate=function(x){return T(x)},qs=v.__private__.getVerticalCoordinate=function(x){return M===_.ADVANCED?x:Yt[z].mediaBox.topRightY-Yt[z].mediaBox.bottomLeftY-T(x)},fl=v.__private__.getHorizontalCoordinateString=v.getHorizontalCoordinateString=function(x){return te(Js(x))},pi=v.__private__.getVerticalCoordinateString=v.getVerticalCoordinateString=function(x){return te(qs(x))},as=t.strokeColor||"0 G";v.__private__.getStrokeColor=v.getDrawColor=function(){return $r(as)},v.__private__.setStrokeColor=v.setDrawColor=function(x,L,Q,de){return as=Cr({ch1:x,ch2:L,ch3:Q,ch4:de,pdfColorType:"draw",precision:2}),re(as),this};var Wi=t.fillColor||"0 g";v.__private__.getFillColor=v.getFillColor=function(){return $r(Wi)},v.__private__.setFillColor=v.setFillColor=function(x,L,Q,de){return Wi=Cr({ch1:x,ch2:L,ch3:Q,ch4:de,pdfColorType:"fill",precision:2}),re(Wi),this};var Qs=t.textColor||"0 g",Jl=v.__private__.getTextColor=v.getTextColor=function(){return $r(Qs)};v.__private__.setTextColor=v.setTextColor=function(x,L,Q,de){return Qs=Cr({ch1:x,ch2:L,ch3:Q,ch4:de,pdfColorType:"text",precision:3}),this};var uo=t.charSpace,ho=v.__private__.getCharSpace=v.getCharSpace=function(){return parseFloat(uo||0)};v.__private__.setCharSpace=v.setCharSpace=function(x){if(isNaN(x))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return uo=x,this};var Ca=0;v.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},v.__private__.setLineCap=v.setLineCap=function(x){var L=v.CapJoinStyles[x];if(L===void 0)throw new Error("Line cap style of '"+x+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return Ca=L,re(L+" J"),this};var Ta=0;v.__private__.setLineJoin=v.setLineJoin=function(x){var L=v.CapJoinStyles[x];if(L===void 0)throw new Error("Line join style of '"+x+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return Ta=L,re(L+" j"),this},v.__private__.setLineMiterLimit=v.__private__.setMiterLimit=v.setLineMiterLimit=v.setMiterLimit=function(x){if(x=x||0,isNaN(x))throw new Error("Invalid argument passed to jsPDF.setLineMiterLimit");return re(te(T(x))+" M"),this},v.GState=$h,v.setGState=function(x){(x=typeof x=="string"?Ge[Hn[x]]:fo(null,x)).equals(ir)||(re("/"+x.id+" gs"),ir=x)};var fo=function(x,L){if(!x||!Hn[x]){var Q=!1;for(var de in Ge)if(Ge.hasOwnProperty(de)&&Ge[de].equals(L)){Q=!0;break}if(Q)L=Ge[de];else{var Le="GS"+(Object.keys(Ge).length+1).toString(10);Ge[Le]=L,L.id=Le}return x&&(Hn[x]=L.id),Nn.publish("addGState",L),L}};v.addGState=function(x,L){return fo(x,L),this},v.saveGraphicsState=function(){return re("q"),zr.push({key:Qt,size:fe,color:Qs}),this},v.restoreGraphicsState=function(){re("Q");var x=zr.pop();return Qt=x.key,fe=x.size,Qs=x.color,ir=null,this},v.setCurrentTransformationMatrix=function(x){return re(x.toString()+" cm"),this},v.comment=function(x){return re("#"+x),this};var $i=function(x,L){var Q=x||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return Q},set:function(We){isNaN(We)||(Q=parseFloat(We))}});var de=L||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return de},set:function(We){isNaN(We)||(de=parseFloat(We))}});var Le="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return Le},set:function(We){Le=We.toString()}}),this},fr=function(x,L,Q,de){$i.call(this,x,L),this.type="rect";var Le=Q||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return Le},set:function(tt){isNaN(tt)||(Le=parseFloat(tt))}});var We=de||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return We},set:function(tt){isNaN(tt)||(We=parseFloat(tt))}}),this},mi=function(){this.page=An,this.currentPage=z,this.pages=Ke.slice(0),this.pagesContext=Yt.slice(0),this.x=In,this.y=on,this.matrix=Mr,this.width=Ki(z),this.height=Us(z),this.outputDestination=it,this.id="",this.objectNumber=-1};mi.prototype.restore=function(){An=this.page,z=this.currentPage,Yt=this.pagesContext,Ke=this.pages,In=this.x,on=this.y,Mr=this.matrix,po(z,this.width),La(z,this.height),it=this.outputDestination};var Hi=function(x,L,Q,de,Le){Jr.push(new mi),An=z=0,Ke=[],In=x,on=L,Mr=Le,qi([Q,de])},Ql=function(x){if(Xr[x])Jr.pop().restore();else{var L=new mi,Q="Xo"+(Object.keys(Er).length+1).toString(10);L.id=Q,Xr[x]=Q,Er[Q]=L,Nn.publish("addFormObject",L),Jr.pop().restore()}};for(var gi in v.beginFormObject=function(x,L,Q,de,Le){return Hi(x,L,Q,de,Le),this},v.endFormObject=function(x){return Ql(x),this},v.doFormObject=function(x,L){var Q=Er[Xr[x]];return re("q"),re(L.toString()+" cm"),re("/"+Q.id+" Do"),re("Q"),this},v.getFormObject=function(x){var L=Er[Xr[x]];return{x:L.x,y:L.y,width:L.width,height:L.height,matrix:L.matrix}},v.save=function(x,L){return x=x||"generated.pdf",(L=L||{}).returnPromise=L.returnPromise||!1,L.returnPromise===!1?(jl(Fs(ar()),x),typeof jl.unload=="function"&&Xt.setTimeout&&setTimeout(jl.unload,911),this):new Promise(function(Q,de){try{var Le=jl(Fs(ar()),x);typeof jl.unload=="function"&&Xt.setTimeout&&setTimeout(jl.unload,911),Q(Le)}catch(We){de(We.message)}})},Zt.API)Zt.API.hasOwnProperty(gi)&&(gi==="events"&&Zt.API.events.length?function(x,L){var Q,de,Le;for(Le=L.length-1;Le!==-1;Le--)Q=L[Le][0],de=L[Le][1],x.subscribe.apply(x,[Q].concat(typeof de=="function"?[de]:de))}(Nn,Zt.API.events):v[gi]=Zt.API[gi]);var Ki=v.getPageWidth=function(x){return(Yt[x=x||z].mediaBox.topRightX-Yt[x].mediaBox.bottomLeftX)/ft},po=v.setPageWidth=function(x,L){Yt[x].mediaBox.topRightX=L*ft+Yt[x].mediaBox.bottomLeftX},Us=v.getPageHeight=function(x){return(Yt[x=x||z].mediaBox.topRightY-Yt[x].mediaBox.bottomLeftY)/ft},La=v.setPageHeight=function(x,L){Yt[x].mediaBox.topRightY=L*ft+Yt[x].mediaBox.bottomLeftY};return v.internal={pdfEscape:Kr,getStyle:Vs,getFont:_a,getFontSize:Oe,getCharSpace:ho,getTextColor:Jl,getLineHeight:co,getLineHeightFactor:Xl,getLineWidth:fi,write:zt,getHorizontalCoordinate:Js,getVerticalCoordinate:qs,getCoordinateString:fl,getVerticalCoordinateString:pi,collections:{},newObject:br,newAdditionalObject:li,newObjectDeferred:Yn,newObjectDeferredBegin:Wr,getFilters:bs,putStream:_s,events:Nn,scaleFactor:ft,pageSize:{getWidth:function(){return Ki(z)},setWidth:function(x){po(z,x)},getHeight:function(){return Us(z)},setHeight:function(x){La(z,x)}},encryptionOptions:f,encryption:Rr,getEncryptor:Kl,output:hi,getNumberOfPages:ba,pages:Ke,out:re,f2:oe,f3:B,getPageInfo:or,getPageInfoByObjId:Vt,getCurrentPageInfo:wa,getPDFVersion:j,Point:$i,Rectangle:fr,Matrix:qt,hasHotfix:Bs},Object.defineProperty(v.internal.pageSize,"width",{get:function(){return Ki(z)},set:function(x){po(z,x)},enumerable:!0,configurable:!0}),Object.defineProperty(v.internal.pageSize,"height",{get:function(){return Us(z)},set:function(x){La(z,x)},enumerable:!0,configurable:!0}),xa.call(v,ne),Qt="F1",ol(s,n),Nn.publish("initialized"),v}hc.prototype.lsbFirstWord=function(t){return String.fromCharCode(t>>0&255,t>>8&255,t>>16&255,t>>24&255)},hc.prototype.toHexString=function(t){return t.split("").map(function(e){return("0"+(255&e.charCodeAt(0)).toString(16)).slice(-2)}).join("")},hc.prototype.hexToBytes=function(t){for(var e=[],n=0;n<t.length;n+=2)e.push(String.fromCharCode(parseInt(t.substr(n,2),16)));return e.join("")},hc.prototype.processOwnerPassword=function(t,e){return Wm(zm(e).substr(0,5),t)},hc.prototype.encryptor=function(t,e){var n=zm(this.encryptionKey+String.fromCharCode(255&t,t>>8&255,t>>16&255,255&e,e>>8&255)).substr(0,10);return function(r){return Wm(n,r)}},$h.prototype.equals=function(t){var e,n="id,objectNumber,equals";if(!t||Fn(t)!==Fn(this))return!1;var r=0;for(e in this)if(!(n.indexOf(e)>=0)){if(this.hasOwnProperty(e)&&!t.hasOwnProperty(e)||this[e]!==t[e])return!1;r++}for(e in t)t.hasOwnProperty(e)&&n.indexOf(e)<0&&r--;return r===0},Zt.API={events:[]},Zt.version="3.0.1";var vr=Zt.API,E0=1,$l=function(t){return t.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},oc=function(t){return t.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},sn=function(t){return t.toFixed(2)},Co=function(t){return t.toFixed(5)};vr.__acroform__={};var Es=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t},Wy=function(t){return t*E0},Zi=function(t){var e=new u4,n=Et.internal.getHeight(t)||0,r=Et.internal.getWidth(t)||0;return e.BBox=[0,0,Number(sn(r)),Number(sn(n))],e},m9=vr.__acroform__.setBit=function(t,e){if(t=t||0,e=e||0,isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBit");return t|=1<<e},g9=vr.__acroform__.clearBit=function(t,e){if(t=t||0,e=e||0,isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBit");return t&=~(1<<e)},v9=vr.__acroform__.getBit=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBit");return t&1<<e?1:0},kr=vr.__acroform__.getBitForPdf=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return v9(t,e-1)},_r=vr.__acroform__.setBitForPdf=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return m9(t,e-1)},Ar=vr.__acroform__.clearBitForPdf=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return g9(t,e-1)},y9=vr.__acroform__.calculateCoordinates=function(t,e){var n=e.internal.getHorizontalCoordinate,r=e.internal.getVerticalCoordinate,s=t[0],i=t[1],o=t[2],l=t[3],c={};return c.lowerLeft_X=n(s)||0,c.lowerLeft_Y=r(i+l)||0,c.upperRight_X=n(s+o)||0,c.upperRight_Y=r(i)||0,[Number(sn(c.lowerLeft_X)),Number(sn(c.lowerLeft_Y)),Number(sn(c.upperRight_X)),Number(sn(c.upperRight_Y))]},x9=function(t){if(t.appearanceStreamContent)return t.appearanceStreamContent;if(t.V||t.DV){var e=[],n=t._V||t.DV,r=$m(t,n),s=t.scope.internal.getFont(t.fontName,t.fontStyle).id;e.push("/Tx BMC"),e.push("q"),e.push("BT"),e.push(t.scope.__private__.encodeColorString(t.color)),e.push("/"+s+" "+sn(r.fontSize)+" Tf"),e.push("1 0 0 1 0 0 Tm"),e.push(r.text),e.push("ET"),e.push("Q"),e.push("EMC");var i=Zi(t);return i.scope=t.scope,i.stream=e.join(`
`),i}},$m=function(t,e){var n=t.fontSize===0?t.maxFontSize:t.fontSize,r={text:"",fontSize:""},s=(e=(e=e.substr(0,1)=="("?e.substr(1):e).substr(e.length-1)==")"?e.substr(0,e.length-1):e).split(" ");s=t.multiline?s.map(function(B){return B.split(`
`)}):s.map(function(B){return[B]});var i=n,o=Et.internal.getHeight(t)||0;o=o<0?-o:o;var l=Et.internal.getWidth(t)||0;l=l<0?-l:l;var c=function(B,T,J){if(B+1<s.length){var Z=T+" "+s[B+1][0];return zd(Z,t,J).width<=l-4}return!1};i++;e:for(;i>0;){e="",i--;var d,f,m=zd("3",t,i).height,g=t.multiline?o-i:(o-m)/2,v=g+=2,N=0,j=0,P=0;if(i<=0){e=`(...) Tj
`,e+="% Width of Text: "+zd(e,t,i=12).width+", FieldWidth:"+l+`
`;break}for(var k="",_=0,M=0;M<s.length;M++)if(s.hasOwnProperty(M)){var $=!1;if(s[M].length!==1&&P!==s[M].length-1){if((m+2)*(_+2)+2>o)continue e;k+=s[M][P],$=!0,j=M,M--}else{k=(k+=s[M][P]+" ").substr(k.length-1)==" "?k.substr(0,k.length-1):k;var Y=parseInt(M),U=c(Y,k,i),te=M>=s.length-1;if(U&&!te){k+=" ",P=0;continue}if(U||te){if(te)j=Y;else if(t.multiline&&(m+2)*(_+2)+2>o)continue e}else{if(!t.multiline||(m+2)*(_+2)+2>o)continue e;j=Y}}for(var W="",ge=N;ge<=j;ge++){var oe=s[ge];if(t.multiline){if(ge===j){W+=oe[P]+" ",P=(P+1)%oe.length;continue}if(ge===N){W+=oe[oe.length-1]+" ";continue}}W+=oe[0]+" "}switch(W=W.substr(W.length-1)==" "?W.substr(0,W.length-1):W,f=zd(W,t,i).width,t.textAlign){case"right":d=l-f-2;break;case"center":d=(l-f)/2;break;case"left":default:d=2}e+=sn(d)+" "+sn(v)+` Td
`,e+="("+$l(W)+`) Tj
`,e+=-sn(d)+` 0 Td
`,v=-(i+2),f=0,N=$?j:j+1,_++,k=""}break}return r.text=e,r.fontSize=i,r},zd=function(t,e,n){var r=e.scope.internal.getFont(e.fontName,e.fontStyle),s=e.scope.getStringUnitWidth(t,{font:r,fontSize:parseFloat(n),charSpace:0})*parseFloat(n);return{height:e.scope.getStringUnitWidth("3",{font:r,fontSize:parseFloat(n),charSpace:0})*parseFloat(n)*1.5,width:s}},b9={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},w9=function(t,e){var n={type:"reference",object:t};e.internal.getPageInfo(t.page).pageContext.annotations.find(function(r){return r.type===n.type&&r.object===n.object})===void 0&&e.internal.getPageInfo(t.page).pageContext.annotations.push(n)},N9=function(t,e){for(var n in t)if(t.hasOwnProperty(n)){var r=n,s=t[n];e.internal.newObjectDeferredBegin(s.objId,!0),Fn(s)==="object"&&typeof s.putStream=="function"&&s.putStream(),delete t[r]}},j9=function(t,e){if(e.scope=t,t.internal!==void 0&&(t.internal.acroformPlugin===void 0||t.internal.acroformPlugin.isInitialized===!1)){if(Oi.FieldNum=0,t.internal.acroformPlugin=JSON.parse(JSON.stringify(b9)),t.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");E0=t.internal.scaleFactor,t.internal.acroformPlugin.acroFormDictionaryRoot=new d4,t.internal.acroformPlugin.acroFormDictionaryRoot.scope=t,t.internal.acroformPlugin.acroFormDictionaryRoot._eventID=t.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})(t)}),t.internal.events.subscribe("buildDocument",function(){(function(n){n.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var r=n.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var s in r)if(r.hasOwnProperty(s)){var i=r[s];i.objId=void 0,i.hasAnnotation&&w9(i,n)}})(t)}),t.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")})(t)}),t.internal.events.subscribe("postPutPages",function(n){(function(r,s){var i=!r;for(var o in r||(s.internal.newObjectDeferredBegin(s.internal.acroformPlugin.acroFormDictionaryRoot.objId,!0),s.internal.acroformPlugin.acroFormDictionaryRoot.putStream()),r=r||s.internal.acroformPlugin.acroFormDictionaryRoot.Kids)if(r.hasOwnProperty(o)){var l=r[o],c=[],d=l.Rect;if(l.Rect&&(l.Rect=y9(l.Rect,s)),s.internal.newObjectDeferredBegin(l.objId,!0),l.DA=Et.createDefaultAppearanceStream(l),Fn(l)==="object"&&typeof l.getKeyValueListForStream=="function"&&(c=l.getKeyValueListForStream()),l.Rect=d,l.hasAppearanceStream&&!l.appearanceStreamContent){var f=x9(l);c.push({key:"AP",value:"<</N "+f+">>"}),s.internal.acroformPlugin.xForms.push(f)}if(l.appearanceStreamContent){var m="";for(var g in l.appearanceStreamContent)if(l.appearanceStreamContent.hasOwnProperty(g)){var v=l.appearanceStreamContent[g];if(m+="/"+g+" ",m+="<<",Object.keys(v).length>=1||Array.isArray(v)){for(var o in v)if(v.hasOwnProperty(o)){var N=v[o];typeof N=="function"&&(N=N.call(s,l)),m+="/"+o+" "+N+" ",s.internal.acroformPlugin.xForms.indexOf(N)>=0||s.internal.acroformPlugin.xForms.push(N)}}else typeof(N=v)=="function"&&(N=N.call(s,l)),m+="/"+o+" "+N,s.internal.acroformPlugin.xForms.indexOf(N)>=0||s.internal.acroformPlugin.xForms.push(N);m+=">>"}c.push({key:"AP",value:`<<
`+m+">>"})}s.internal.putStream({additionalKeyValues:c,objectId:l.objId}),s.internal.out("endobj")}i&&N9(s.internal.acroformPlugin.xForms,s)})(n,t)}),t.internal.acroformPlugin.isInitialized=!0}},c4=vr.__acroform__.arrayToPdfArray=function(t,e,n){var r=function(o){return o};if(Array.isArray(t)){for(var s="[",i=0;i<t.length;i++)switch(i!==0&&(s+=" "),Fn(t[i])){case"boolean":case"number":case"object":s+=t[i].toString();break;case"string":t[i].substr(0,1)!=="/"?(e!==void 0&&n&&(r=n.internal.getEncryptor(e)),s+="("+$l(r(t[i].toString()))+")"):s+=t[i].toString()}return s+="]"}throw new Error("Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray")},Op=function(t,e,n){var r=function(s){return s};return e!==void 0&&n&&(r=n.internal.getEncryptor(e)),(t=t||"").toString(),t="("+$l(r(t))+")"},Qi=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(t){this._objId=t}}),Object.defineProperty(this,"scope",{value:this._scope,writable:!0})};Qi.prototype.toString=function(){return this.objId+" 0 R"},Qi.prototype.putStream=function(){var t=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:t,objectId:this.objId}),this.scope.internal.out("endobj")},Qi.prototype.getKeyValueListForStream=function(){var t=[],e=Object.getOwnPropertyNames(this).filter(function(i){return i!="content"&&i!="appearanceStreamContent"&&i!="scope"&&i!="objId"&&i.substring(0,1)!="_"});for(var n in e)if(Object.getOwnPropertyDescriptor(this,e[n]).configurable===!1){var r=e[n],s=this[r];s&&(Array.isArray(s)?t.push({key:r,value:c4(s,this.objId,this.scope)}):s instanceof Qi?(s.scope=this.scope,t.push({key:r,value:s.objId+" 0 R"})):typeof s!="function"&&t.push({key:r,value:s}))}return t};var u4=function(){Qi.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 t,e=[];Object.defineProperty(this,"BBox",{configurable:!1,get:function(){return e},set:function(n){e=n}}),Object.defineProperty(this,"Resources",{value:"2 0 R",configurable:!1,writable:!0}),Object.defineProperty(this,"stream",{enumerable:!1,configurable:!0,set:function(n){t=n.trim()},get:function(){return t||null}})};Es(u4,Qi);var d4=function(){Qi.call(this);var t,e=[];Object.defineProperty(this,"Kids",{enumerable:!1,configurable:!0,get:function(){return e.length>0?e:void 0}}),Object.defineProperty(this,"Fields",{enumerable:!1,configurable:!1,get:function(){return e}}),Object.defineProperty(this,"DA",{enumerable:!1,configurable:!1,get:function(){if(t){var n=function(r){return r};return this.scope&&(n=this.scope.internal.getEncryptor(this.objId)),"("+$l(n(t))+")"}},set:function(n){t=n}})};Es(d4,Qi);var Oi=function t(){Qi.call(this);var e=4;Object.defineProperty(this,"F",{enumerable:!1,configurable:!1,get:function(){return e},set:function(k){if(isNaN(k))throw new Error('Invalid value "'+k+'" for attribute F supplied.');e=k}}),Object.defineProperty(this,"showWhenPrinted",{enumerable:!0,configurable:!0,get:function(){return!!kr(e,3)},set:function(k){k?this.F=_r(e,3):this.F=Ar(e,3)}});var n=0;Object.defineProperty(this,"Ff",{enumerable:!1,configurable:!1,get:function(){return n},set:function(k){if(isNaN(k))throw new Error('Invalid value "'+k+'" for attribute Ff supplied.');n=k}});var r=[];Object.defineProperty(this,"Rect",{enumerable:!1,configurable:!1,get:function(){if(r.length!==0)return r},set:function(k){r=k!==void 0?k:[]}}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[0])?0:r[0]},set:function(k){r[0]=k}}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[1])?0:r[1]},set:function(k){r[1]=k}}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[2])?0:r[2]},set:function(k){r[2]=k}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,get:function(){return!r||isNaN(r[3])?0:r[3]},set:function(k){r[3]=k}});var s="";Object.defineProperty(this,"FT",{enumerable:!0,configurable:!1,get:function(){return s},set:function(k){switch(k){case"/Btn":case"/Tx":case"/Ch":case"/Sig":s=k;break;default:throw new Error('Invalid value "'+k+'" for attribute FT supplied.')}}});var i=null;Object.defineProperty(this,"T",{enumerable:!0,configurable:!1,get:function(){if(!i||i.length<1){if(this instanceof Hh)return;i="FieldObject"+t.FieldNum++}var k=function(_){return _};return this.scope&&(k=this.scope.internal.getEncryptor(this.objId)),"("+$l(k(i))+")"},set:function(k){i=k.toString()}}),Object.defineProperty(this,"fieldName",{configurable:!0,enumerable:!0,get:function(){return i},set:function(k){i=k}});var o="helvetica";Object.defineProperty(this,"fontName",{enumerable:!0,configurable:!0,get:function(){return o},set:function(k){o=k}});var l="normal";Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,get:function(){return l},set:function(k){l=k}});var c=0;Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,get:function(){return c},set:function(k){c=k}});var d=void 0;Object.defineProperty(this,"maxFontSize",{enumerable:!0,configurable:!0,get:function(){return d===void 0?50/E0:d},set:function(k){d=k}});var f="black";Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,get:function(){return f},set:function(k){f=k}});var m="/F1 0 Tf 0 g";Object.defineProperty(this,"DA",{enumerable:!0,configurable:!1,get:function(){if(!(!m||this instanceof Hh||this instanceof El))return Op(m,this.objId,this.scope)},set:function(k){k=k.toString(),m=k}});var g=null;Object.defineProperty(this,"DV",{enumerable:!1,configurable:!1,get:function(){if(g)return this instanceof Zr?g:Op(g,this.objId,this.scope)},set:function(k){k=k.toString(),g=this instanceof Zr?k:k.substr(0,1)==="("?oc(k.substr(1,k.length-2)):oc(k)}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof Zr?oc(g.substr(1,g.length-1)):g},set:function(k){k=k.toString(),g=this instanceof Zr?"/"+k:k}});var v=null;Object.defineProperty(this,"_V",{enumerable:!1,configurable:!1,get:function(){if(v)return v},set:function(k){this.V=k}}),Object.defineProperty(this,"V",{enumerable:!1,configurable:!1,get:function(){if(v)return this instanceof Zr?v:Op(v,this.objId,this.scope)},set:function(k){k=k.toString(),v=this instanceof Zr?k:k.substr(0,1)==="("?oc(k.substr(1,k.length-2)):oc(k)}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof Zr?oc(v.substr(1,v.length-1)):v},set:function(k){k=k.toString(),v=this instanceof Zr?"/"+k:k}}),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 N,j=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return j},set:function(k){k=!!k,j=k}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(N)return N},set:function(k){N=k}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,1)},set:function(k){k?this.Ff=_r(this.Ff,1):this.Ff=Ar(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,2)},set:function(k){k?this.Ff=_r(this.Ff,2):this.Ff=Ar(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,3)},set:function(k){k?this.Ff=_r(this.Ff,3):this.Ff=Ar(this.Ff,3)}});var P=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(P!==null)return P},set:function(k){if([0,1,2].indexOf(k)===-1)throw new Error('Invalid value "'+k+'" for attribute Q supplied.');P=k}}),Object.defineProperty(this,"textAlign",{get:function(){var k;switch(P){case 0:default:k="left";break;case 1:k="center";break;case 2:k="right"}return k},configurable:!0,enumerable:!0,set:function(k){switch(k){case"right":case 2:P=2;break;case"center":case 1:P=1;break;case"left":case 0:default:P=0}}})};Es(Oi,Qi);var Pc=function(){Oi.call(this),this.FT="/Ch",this.V="()",this.fontName="zapfdingbats";var t=0;Object.defineProperty(this,"TI",{enumerable:!0,configurable:!1,get:function(){return t},set:function(n){t=n}}),Object.defineProperty(this,"topIndex",{enumerable:!0,configurable:!0,get:function(){return t},set:function(n){t=n}});var e=[];Object.defineProperty(this,"Opt",{enumerable:!0,configurable:!1,get:function(){return c4(e,this.objId,this.scope)},set:function(n){var r,s;s=[],typeof(r=n)=="string"&&(s=function(i,o,l){l||(l=1);for(var c,d=[];c=o.exec(i);)d.push(c[l]);return d}(r,/\((.*?)\)/g)),e=s}}),this.getOptions=function(){return e},this.setOptions=function(n){e=n,this.sort&&e.sort()},this.addOption=function(n){n=(n=n||"").toString(),e.push(n),this.sort&&e.sort()},this.removeOption=function(n,r){for(r=r||!1,n=(n=n||"").toString();e.indexOf(n)!==-1&&(e.splice(e.indexOf(n),1),r!==!1););},Object.defineProperty(this,"combo",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,18)},set:function(n){n?this.Ff=_r(this.Ff,18):this.Ff=Ar(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,19)},set:function(n){this.combo===!0&&(n?this.Ff=_r(this.Ff,19):this.Ff=Ar(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,20)},set:function(n){n?(this.Ff=_r(this.Ff,20),e.sort()):this.Ff=Ar(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,22)},set:function(n){n?this.Ff=_r(this.Ff,22):this.Ff=Ar(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,23)},set:function(n){n?this.Ff=_r(this.Ff,23):this.Ff=Ar(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,27)},set:function(n){n?this.Ff=_r(this.Ff,27):this.Ff=Ar(this.Ff,27)}}),this.hasAppearanceStream=!1};Es(Pc,Oi);var Cc=function(){Pc.call(this),this.fontName="helvetica",this.combo=!1};Es(Cc,Pc);var Tc=function(){Cc.call(this),this.combo=!0};Es(Tc,Cc);var ch=function(){Tc.call(this),this.edit=!0};Es(ch,Tc);var Zr=function(){Oi.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,15)},set:function(n){n?this.Ff=_r(this.Ff,15):this.Ff=Ar(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,16)},set:function(n){n?this.Ff=_r(this.Ff,16):this.Ff=Ar(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,17)},set:function(n){n?this.Ff=_r(this.Ff,17):this.Ff=Ar(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,26)},set:function(n){n?this.Ff=_r(this.Ff,26):this.Ff=Ar(this.Ff,26)}});var t,e={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var n=function(i){return i};if(this.scope&&(n=this.scope.internal.getEncryptor(this.objId)),Object.keys(e).length!==0){var r,s=[];for(r in s.push("<<"),e)s.push("/"+r+" ("+$l(n(e[r]))+")");return s.push(">>"),s.join(`
`)}},set:function(n){Fn(n)==="object"&&(e=n)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return e.CA||""},set:function(n){typeof n=="string"&&(e.CA=n)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return t},set:function(n){t=n}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return t.substr(1,t.length-1)},set:function(n){t="/"+n}})};Es(Zr,Oi);var uh=function(){Zr.call(this),this.pushButton=!0};Es(uh,Zr);var Lc=function(){Zr.call(this),this.radio=!0,this.pushButton=!1;var t=[];Object.defineProperty(this,"Kids",{enumerable:!0,configurable:!1,get:function(){return t},set:function(e){t=e!==void 0?e:[]}})};Es(Lc,Zr);var Hh=function(){var t,e;Oi.call(this),Object.defineProperty(this,"Parent",{enumerable:!1,configurable:!1,get:function(){return t},set:function(s){t=s}}),Object.defineProperty(this,"optionName",{enumerable:!1,configurable:!0,get:function(){return e},set:function(s){e=s}});var n,r={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var s=function(l){return l};this.scope&&(s=this.scope.internal.getEncryptor(this.objId));var i,o=[];for(i in o.push("<<"),r)o.push("/"+i+" ("+$l(s(r[i]))+")");return o.push(">>"),o.join(`
`)},set:function(s){Fn(s)==="object"&&(r=s)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return r.CA||""},set:function(s){typeof s=="string"&&(r.CA=s)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return n},set:function(s){n=s}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return n.substr(1,n.length-1)},set:function(s){n="/"+s}}),this.caption="l",this.appearanceState="Off",this._AppearanceType=Et.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};Es(Hh,Oi),Lc.prototype.setAppearance=function(t){if(!("createAppearanceStream"in t)||!("getCA"in t))throw new Error("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");for(var e in this.Kids)if(this.Kids.hasOwnProperty(e)){var n=this.Kids[e];n.appearanceStreamContent=t.createAppearanceStream(n.optionName),n.caption=t.getCA()}},Lc.prototype.createOption=function(t){var e=new Hh;return e.Parent=this,e.optionName=t,this.Kids.push(e),S9.call(this.scope,e),e};var dh=function(){Zr.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=Et.CheckBox.createAppearanceStream()};Es(dh,Zr);var El=function(){Oi.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,13)},set:function(e){e?this.Ff=_r(this.Ff,13):this.Ff=Ar(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,21)},set:function(e){e?this.Ff=_r(this.Ff,21):this.Ff=Ar(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,23)},set:function(e){e?this.Ff=_r(this.Ff,23):this.Ff=Ar(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,24)},set:function(e){e?this.Ff=_r(this.Ff,24):this.Ff=Ar(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,25)},set:function(e){e?this.Ff=_r(this.Ff,25):this.Ff=Ar(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,26)},set:function(e){e?this.Ff=_r(this.Ff,26):this.Ff=Ar(this.Ff,26)}});var t=null;Object.defineProperty(this,"MaxLen",{enumerable:!0,configurable:!1,get:function(){return t},set:function(e){t=e}}),Object.defineProperty(this,"maxLength",{enumerable:!0,configurable:!0,get:function(){return t},set:function(e){Number.isInteger(e)&&(t=e)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return this.V||this.DV}})};Es(El,Oi);var hh=function(){El.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!kr(this.Ff,14)},set:function(t){t?this.Ff=_r(this.Ff,14):this.Ff=Ar(this.Ff,14)}}),this.password=!0};Es(hh,El);var Et={CheckBox:{createAppearanceStream:function(){return{N:{On:Et.CheckBox.YesNormal},D:{On:Et.CheckBox.YesPushDown,Off:Et.CheckBox.OffPushDown}}},YesPushDown:function(t){var e=Zi(t);e.scope=t.scope;var n=[],r=t.scope.internal.getFont(t.fontName,t.fontStyle).id,s=t.scope.__private__.encodeColorString(t.color),i=$m(t,t.caption);return n.push("0.749023 g"),n.push("0 0 "+sn(Et.internal.getWidth(t))+" "+sn(Et.internal.getHeight(t))+" re"),n.push("f"),n.push("BMC"),n.push("q"),n.push("0 0 1 rg"),n.push("/"+r+" "+sn(i.fontSize)+" Tf "+s),n.push("BT"),n.push(i.text),n.push("ET"),n.push("Q"),n.push("EMC"),e.stream=n.join(`
`),e},YesNormal:function(t){var e=Zi(t);e.scope=t.scope;var n=t.scope.internal.getFont(t.fontName,t.fontStyle).id,r=t.scope.__private__.encodeColorString(t.color),s=[],i=Et.internal.getHeight(t),o=Et.internal.getWidth(t),l=$m(t,t.caption);return s.push("1 g"),s.push("0 0 "+sn(o)+" "+sn(i)+" re"),s.push("f"),s.push("q"),s.push("0 0 1 rg"),s.push("0 0 "+sn(o-1)+" "+sn(i-1)+" re"),s.push("W"),s.push("n"),s.push("0 g"),s.push("BT"),s.push("/"+n+" "+sn(l.fontSize)+" Tf "+r),s.push(l.text),s.push("ET"),s.push("Q"),e.stream=s.join(`
`),e},OffPushDown:function(t){var e=Zi(t);e.scope=t.scope;var n=[];return n.push("0.749023 g"),n.push("0 0 "+sn(Et.internal.getWidth(t))+" "+sn(Et.internal.getHeight(t))+" re"),n.push("f"),e.stream=n.join(`
`),e}},RadioButton:{Circle:{createAppearanceStream:function(t){var e={D:{Off:Et.RadioButton.Circle.OffPushDown},N:{}};return e.N[t]=Et.RadioButton.Circle.YesNormal,e.D[t]=Et.RadioButton.Circle.YesPushDown,e},getCA:function(){return"l"},YesNormal:function(t){var e=Zi(t);e.scope=t.scope;var n=[],r=Et.internal.getWidth(t)<=Et.internal.getHeight(t)?Et.internal.getWidth(t)/4:Et.internal.getHeight(t)/4;r=Number((.9*r).toFixed(5));var s=Et.internal.Bezier_C,i=Number((r*s).toFixed(5));return n.push("q"),n.push("1 0 0 1 "+Co(Et.internal.getWidth(t)/2)+" "+Co(Et.internal.getHeight(t)/2)+" cm"),n.push(r+" 0 m"),n.push(r+" "+i+" "+i+" "+r+" 0 "+r+" c"),n.push("-"+i+" "+r+" -"+r+" "+i+" -"+r+" 0 c"),n.push("-"+r+" -"+i+" -"+i+" -"+r+" 0 -"+r+" c"),n.push(i+" -"+r+" "+r+" -"+i+" "+r+" 0 c"),n.push("f"),n.push("Q"),e.stream=n.join(`
`),e},YesPushDown:function(t){var e=Zi(t);e.scope=t.scope;var n=[],r=Et.internal.getWidth(t)<=Et.internal.getHeight(t)?Et.internal.getWidth(t)/4:Et.internal.getHeight(t)/4;r=Number((.9*r).toFixed(5));var s=Number((2*r).toFixed(5)),i=Number((s*Et.internal.Bezier_C).toFixed(5)),o=Number((r*Et.internal.Bezier_C).toFixed(5));return n.push("0.749023 g"),n.push("q"),n.push("1 0 0 1 "+Co(Et.internal.getWidth(t)/2)+" "+Co(Et.internal.getHeight(t)/2)+" cm"),n.push(s+" 0 m"),n.push(s+" "+i+" "+i+" "+s+" 0 "+s+" c"),n.push("-"+i+" "+s+" -"+s+" "+i+" -"+s+" 0 c"),n.push("-"+s+" -"+i+" -"+i+" -"+s+" 0 -"+s+" c"),n.push(i+" -"+s+" "+s+" -"+i+" "+s+" 0 c"),n.push("f"),n.push("Q"),n.push("0 g"),n.push("q"),n.push("1 0 0 1 "+Co(Et.internal.getWidth(t)/2)+" "+Co(Et.internal.getHeight(t)/2)+" cm"),n.push(r+" 0 m"),n.push(r+" "+o+" "+o+" "+r+" 0 "+r+" c"),n.push("-"+o+" "+r+" -"+r+" "+o+" -"+r+" 0 c"),n.push("-"+r+" -"+o+" -"+o+" -"+r+" 0 -"+r+" c"),n.push(o+" -"+r+" "+r+" -"+o+" "+r+" 0 c"),n.push("f"),n.push("Q"),e.stream=n.join(`
`),e},OffPushDown:function(t){var e=Zi(t);e.scope=t.scope;var n=[],r=Et.internal.getWidth(t)<=Et.internal.getHeight(t)?Et.internal.getWidth(t)/4:Et.internal.getHeight(t)/4;r=Number((.9*r).toFixed(5));var s=Number((2*r).toFixed(5)),i=Number((s*Et.internal.Bezier_C).toFixed(5));return n.push("0.749023 g"),n.push("q"),n.push("1 0 0 1 "+Co(Et.internal.getWidth(t)/2)+" "+Co(Et.internal.getHeight(t)/2)+" cm"),n.push(s+" 0 m"),n.push(s+" "+i+" "+i+" "+s+" 0 "+s+" c"),n.push("-"+i+" "+s+" -"+s+" "+i+" -"+s+" 0 c"),n.push("-"+s+" -"+i+" -"+i+" -"+s+" 0 -"+s+" c"),n.push(i+" -"+s+" "+s+" -"+i+" "+s+" 0 c"),n.push("f"),n.push("Q"),e.stream=n.join(`
`),e}},Cross:{createAppearanceStream:function(t){var e={D:{Off:Et.RadioButton.Cross.OffPushDown},N:{}};return e.N[t]=Et.RadioButton.Cross.YesNormal,e.D[t]=Et.RadioButton.Cross.YesPushDown,e},getCA:function(){return"8"},YesNormal:function(t){var e=Zi(t);e.scope=t.scope;var n=[],r=Et.internal.calculateCross(t);return n.push("q"),n.push("1 1 "+sn(Et.internal.getWidth(t)-2)+" "+sn(Et.internal.getHeight(t)-2)+" re"),n.push("W"),n.push("n"),n.push(sn(r.x1.x)+" "+sn(r.x1.y)+" m"),n.push(sn(r.x2.x)+" "+sn(r.x2.y)+" l"),n.push(sn(r.x4.x)+" "+sn(r.x4.y)+" m"),n.push(sn(r.x3.x)+" "+sn(r.x3.y)+" l"),n.push("s"),n.push("Q"),e.stream=n.join(`
`),e},YesPushDown:function(t){var e=Zi(t);e.scope=t.scope;var n=Et.internal.calculateCross(t),r=[];return r.push("0.749023 g"),r.push("0 0 "+sn(Et.internal.getWidth(t))+" "+sn(Et.internal.getHeight(t))+" re"),r.push("f"),r.push("q"),r.push("1 1 "+sn(Et.internal.getWidth(t)-2)+" "+sn(Et.internal.getHeight(t)-2)+" re"),r.push("W"),r.push("n"),r.push(sn(n.x1.x)+" "+sn(n.x1.y)+" m"),r.push(sn(n.x2.x)+" "+sn(n.x2.y)+" l"),r.push(sn(n.x4.x)+" "+sn(n.x4.y)+" m"),r.push(sn(n.x3.x)+" "+sn(n.x3.y)+" l"),r.push("s"),r.push("Q"),e.stream=r.join(`
`),e},OffPushDown:function(t){var e=Zi(t);e.scope=t.scope;var n=[];return n.push("0.749023 g"),n.push("0 0 "+sn(Et.internal.getWidth(t))+" "+sn(Et.internal.getHeight(t))+" re"),n.push("f"),e.stream=n.join(`
`),e}}},createDefaultAppearanceStream:function(t){var e=t.scope.internal.getFont(t.fontName,t.fontStyle).id,n=t.scope.__private__.encodeColorString(t.color);return"/"+e+" "+t.fontSize+" Tf "+n}};Et.internal={Bezier_C:.551915024494,calculateCross:function(t){var e=Et.internal.getWidth(t),n=Et.internal.getHeight(t),r=Math.min(e,n);return{x1:{x:(e-r)/2,y:(n-r)/2+r},x2:{x:(e-r)/2+r,y:(n-r)/2},x3:{x:(e-r)/2,y:(n-r)/2},x4:{x:(e-r)/2+r,y:(n-r)/2+r}}}},Et.internal.getWidth=function(t){var e=0;return Fn(t)==="object"&&(e=Wy(t.Rect[2])),e},Et.internal.getHeight=function(t){var e=0;return Fn(t)==="object"&&(e=Wy(t.Rect[3])),e};var S9=vr.addField=function(t){if(j9(this,t),!(t instanceof Oi))throw new Error("Invalid argument passed to jsPDF.addField.");var e;return(e=t).scope.internal.acroformPlugin.printedOut&&(e.scope.internal.acroformPlugin.printedOut=!1,e.scope.internal.acroformPlugin.acroFormDictionaryRoot=null),e.scope.internal.acroformPlugin.acroFormDictionaryRoot.Fields.push(e),t.page=t.scope.internal.getCurrentPageInfo().pageNumber,this};vr.AcroFormChoiceField=Pc,vr.AcroFormListBox=Cc,vr.AcroFormComboBox=Tc,vr.AcroFormEditBox=ch,vr.AcroFormButton=Zr,vr.AcroFormPushButton=uh,vr.AcroFormRadioButton=Lc,vr.AcroFormCheckBox=dh,vr.AcroFormTextField=El,vr.AcroFormPasswordField=hh,vr.AcroFormAppearance=Et,vr.AcroForm={ChoiceField:Pc,ListBox:Cc,ComboBox:Tc,EditBox:ch,Button:Zr,PushButton:uh,RadioButton:Lc,CheckBox:dh,TextField:El,PasswordField:hh,Appearance:Et},Zt.AcroForm={ChoiceField:Pc,ListBox:Cc,ComboBox:Tc,EditBox:ch,Button:Zr,PushButton:uh,RadioButton:Lc,CheckBox:dh,TextField:El,PasswordField:hh,Appearance:Et};function h4(t){return t.reduce(function(e,n,r){return e[n]=r,e},{})}(function(t){t.__addimage__={};var e="UNKNOWN",n={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]]},r=t.__addimage__.getImageFileTypeByImageData=function(B,T){var J,Z,Ne,he,ae,G=e;if((T=T||e)==="RGBA"||B.data!==void 0&&B.data instanceof Uint8ClampedArray&&"height"in B&&"width"in B)return"RGBA";if(U(B))for(ae in n)for(Ne=n[ae],J=0;J<Ne.length;J+=1){for(he=!0,Z=0;Z<Ne[J].length;Z+=1)if(Ne[J][Z]!==void 0&&Ne[J][Z]!==B[Z]){he=!1;break}if(he===!0){G=ae;break}}else for(ae in n)for(Ne=n[ae],J=0;J<Ne.length;J+=1){for(he=!0,Z=0;Z<Ne[J].length;Z+=1)if(Ne[J][Z]!==void 0&&Ne[J][Z]!==B.charCodeAt(Z)){he=!1;break}if(he===!0){G=ae;break}}return G===e&&T!==e&&(G=T),G},s=function B(T){for(var J=this.internal.write,Z=this.internal.putStream,Ne=(0,this.internal.getFilters)();Ne.indexOf("FlateEncode")!==-1;)Ne.splice(Ne.indexOf("FlateEncode"),1);T.objectId=this.internal.newObject();var he=[];if(he.push({key:"Type",value:"/XObject"}),he.push({key:"Subtype",value:"/Image"}),he.push({key:"Width",value:T.width}),he.push({key:"Height",value:T.height}),T.colorSpace===P.INDEXED?he.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(T.palette.length/3-1)+" "+("sMask"in T&&T.sMask!==void 0?T.objectId+2:T.objectId+1)+" 0 R]"}):(he.push({key:"ColorSpace",value:"/"+T.colorSpace}),T.colorSpace===P.DEVICE_CMYK&&he.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),he.push({key:"BitsPerComponent",value:T.bitsPerComponent}),"decodeParameters"in T&&T.decodeParameters!==void 0&&he.push({key:"DecodeParms",value:"<<"+T.decodeParameters+">>"}),"transparency"in T&&Array.isArray(T.transparency)){for(var ae="",G=0,xe=T.transparency.length;G<xe;G++)ae+=T.transparency[G]+" "+T.transparency[G]+" ";he.push({key:"Mask",value:"["+ae+"]"})}T.sMask!==void 0&&he.push({key:"SMask",value:T.objectId+1+" 0 R"});var De=T.filter!==void 0?["/"+T.filter]:void 0;if(Z({data:T.data,additionalKeyValues:he,alreadyAppliedFilters:De,objectId:T.objectId}),J("endobj"),"sMask"in T&&T.sMask!==void 0){var $e="/Predictor "+T.predictor+" /Colors 1 /BitsPerComponent "+T.bitsPerComponent+" /Columns "+T.width,E={width:T.width,height:T.height,colorSpace:"DeviceGray",bitsPerComponent:T.bitsPerComponent,decodeParameters:$e,data:T.sMask};"filter"in T&&(E.filter=T.filter),B.call(this,E)}if(T.colorSpace===P.INDEXED){var z=this.internal.newObject();Z({data:W(new Uint8Array(T.palette)),objectId:z}),J("endobj")}},i=function(){var B=this.internal.collections.addImage_images;for(var T in B)s.call(this,B[T])},o=function(){var B,T=this.internal.collections.addImage_images,J=this.internal.write;for(var Z in T)J("/I"+(B=T[Z]).index,B.objectId,"0","R")},l=function(){this.internal.collections.addImage_images||(this.internal.collections.addImage_images={},this.internal.events.subscribe("putResources",i),this.internal.events.subscribe("putXobjectDict",o))},c=function(){var B=this.internal.collections.addImage_images;return l.call(this),B},d=function(){return Object.keys(this.internal.collections.addImage_images).length},f=function(B){return typeof t["process"+B.toUpperCase()]=="function"},m=function(B){return Fn(B)==="object"&&B.nodeType===1},g=function(B,T){if(B.nodeName==="IMG"&&B.hasAttribute("src")){var J=""+B.getAttribute("src");if(J.indexOf("data:image/")===0)return ku(unescape(J).split("base64,").pop());var Z=t.loadFile(J,!0);if(Z!==void 0)return Z}if(B.nodeName==="CANVAS"){if(B.width===0||B.height===0)throw new Error("Given canvas must have data. Canvas width: "+B.width+", height: "+B.height);var Ne;switch(T){case"PNG":Ne="image/png";break;case"WEBP":Ne="image/webp";break;case"JPEG":case"JPG":default:Ne="image/jpeg"}return ku(B.toDataURL(Ne,1).split("base64,").pop())}},v=function(B){var T=this.internal.collections.addImage_images;if(T){for(var J in T)if(B===T[J].alias)return T[J]}},N=function(B,T,J){return B||T||(B=-96,T=-96),B<0&&(B=-1*J.width*72/B/this.internal.scaleFactor),T<0&&(T=-1*J.height*72/T/this.internal.scaleFactor),B===0&&(B=T*J.width/J.height),T===0&&(T=B*J.height/J.width),[B,T]},j=function(B,T,J,Z,Ne,he){var ae=N.call(this,J,Z,Ne),G=this.internal.getCoordinateString,xe=this.internal.getVerticalCoordinateString,De=c.call(this);if(J=ae[0],Z=ae[1],De[Ne.index]=Ne,he){he*=Math.PI/180;var $e=Math.cos(he),E=Math.sin(he),z=function(le){return le.toFixed(4)},ee=[z($e),z(E),z(-1*E),z($e),0,0,"cm"]}this.internal.write("q"),he?(this.internal.write([1,"0","0",1,G(B),xe(T+Z),"cm"].join(" ")),this.internal.write(ee.join(" ")),this.internal.write([G(J),"0","0",G(Z),"0","0","cm"].join(" "))):this.internal.write([G(J),"0","0",G(Z),G(B),xe(T+Z),"cm"].join(" ")),this.isAdvancedAPI()&&this.internal.write([1,0,0,-1,0,0,"cm"].join(" ")),this.internal.write("/I"+Ne.index+" Do"),this.internal.write("Q")},P=t.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"};t.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 k=t.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},_=t.__addimage__.sHashCode=function(B){var T,J,Z=0;if(typeof B=="string")for(J=B.length,T=0;T<J;T++)Z=(Z<<5)-Z+B.charCodeAt(T),Z|=0;else if(U(B))for(J=B.byteLength/2,T=0;T<J;T++)Z=(Z<<5)-Z+B[T],Z|=0;return Z},M=t.__addimage__.validateStringAsBase64=function(B){(B=B||"").toString().trim();var T=!0;return B.length===0&&(T=!1),B.length%4!=0&&(T=!1),/^[A-Za-z0-9+/]+$/.test(B.substr(0,B.length-2))===!1&&(T=!1),/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(B.substr(-2))===!1&&(T=!1),T},$=t.__addimage__.extractImageFromDataUrl=function(B){if(B==null||!(B=B.trim()).startsWith("data:"))return null;var T=B.indexOf(",");return T<0?null:B.substring(0,T).trim().endsWith("base64")?B.substring(T+1):null},Y=t.__addimage__.supportsArrayBuffer=function(){return typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"};t.__addimage__.isArrayBuffer=function(B){return Y()&&B instanceof ArrayBuffer};var U=t.__addimage__.isArrayBufferView=function(B){return Y()&&typeof Uint32Array<"u"&&(B instanceof Int8Array||B instanceof Uint8Array||typeof Uint8ClampedArray<"u"&&B instanceof Uint8ClampedArray||B instanceof Int16Array||B instanceof Uint16Array||B instanceof Int32Array||B instanceof Uint32Array||B instanceof Float32Array||B instanceof Float64Array)},te=t.__addimage__.binaryStringToUint8Array=function(B){for(var T=B.length,J=new Uint8Array(T),Z=0;Z<T;Z++)J[Z]=B.charCodeAt(Z);return J},W=t.__addimage__.arrayBufferToBinaryString=function(B){for(var T="",J=U(B)?B:new Uint8Array(B),Z=0;Z<J.length;Z+=8192)T+=String.fromCharCode.apply(null,J.subarray(Z,Z+8192));return T};t.addImage=function(){var B,T,J,Z,Ne,he,ae,G,xe;if(typeof arguments[1]=="number"?(T=e,J=arguments[1],Z=arguments[2],Ne=arguments[3],he=arguments[4],ae=arguments[5],G=arguments[6],xe=arguments[7]):(T=arguments[1],J=arguments[2],Z=arguments[3],Ne=arguments[4],he=arguments[5],ae=arguments[6],G=arguments[7],xe=arguments[8]),Fn(B=arguments[0])==="object"&&!m(B)&&"imageData"in B){var De=B;B=De.imageData,T=De.format||T||e,J=De.x||J||0,Z=De.y||Z||0,Ne=De.w||De.width||Ne,he=De.h||De.height||he,ae=De.alias||ae,G=De.compression||G,xe=De.rotation||De.angle||xe}var $e=this.internal.getFilters();if(G===void 0&&$e.indexOf("FlateEncode")!==-1&&(G="SLOW"),isNaN(J)||isNaN(Z))throw new Error("Invalid coordinates passed to jsPDF.addImage");l.call(this);var E=ge.call(this,B,T,ae,G);return j.call(this,J,Z,Ne,he,E,xe),this};var ge=function(B,T,J,Z){var Ne,he,ae;if(typeof B=="string"&&r(B)===e){B=unescape(B);var G=oe(B,!1);(G!==""||(G=t.loadFile(B,!0))!==void 0)&&(B=G)}if(m(B)&&(B=g(B,T)),T=r(B,T),!f(T))throw new Error("addImage does not support files of type '"+T+"', please ensure that a plugin for '"+T+"' support is added.");if(((ae=J)==null||ae.length===0)&&(J=function(xe){return typeof xe=="string"||U(xe)?_(xe):U(xe.data)?_(xe.data):null}(B)),(Ne=v.call(this,J))||(Y()&&(B instanceof Uint8Array||T==="RGBA"||(he=B,B=te(B))),Ne=this["process"+T.toUpperCase()](B,d.call(this),J,function(xe){return xe&&typeof xe=="string"&&(xe=xe.toUpperCase()),xe in t.image_compression?xe:k.NONE}(Z),he)),!Ne)throw new Error("An unknown error occurred whilst processing the image.");return Ne},oe=t.__addimage__.convertBase64ToBinaryString=function(B,T){T=typeof T!="boolean"||T;var J,Z="";if(typeof B=="string"){var Ne;J=(Ne=$(B))!==null&&Ne!==void 0?Ne:B;try{Z=ku(J)}catch(he){if(T)throw M(J)?new Error("atob-Error in jsPDF.convertBase64ToBinaryString "+he.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ")}}return Z};t.getImageProperties=function(B){var T,J,Z="";if(m(B)&&(B=g(B)),typeof B=="string"&&r(B)===e&&((Z=oe(B,!1))===""&&(Z=t.loadFile(B)||""),B=Z),J=r(B),!f(J))throw new Error("addImage does not support files of type '"+J+"', please ensure that a plugin for '"+J+"' support is added.");if(!Y()||B instanceof Uint8Array||(B=te(B)),!(T=this["process"+J.toUpperCase()](B)))throw new Error("An unknown error occurred whilst processing the image");return T.fileType=J,T}})(Zt.API),function(t){var e=function(n){if(n!==void 0&&n!="")return!0};Zt.API.events.push(["addPage",function(n){this.internal.getPageInfo(n.pageNumber).pageContext.annotations=[]}]),t.events.push(["putPage",function(n){for(var r,s,i,o=this.internal.getCoordinateString,l=this.internal.getVerticalCoordinateString,c=this.internal.getPageInfoByObjId(n.objId),d=n.pageContext.annotations,f=!1,m=0;m<d.length&&!f;m++)switch((r=d[m]).type){case"link":(e(r.options.url)||e(r.options.pageNumber))&&(f=!0);break;case"reference":case"text":case"freetext":f=!0}if(f!=0){this.internal.write("/Annots [");for(var g=0;g<d.length;g++){r=d[g];var v=this.internal.pdfEscape,N=this.internal.getEncryptor(n.objId);switch(r.type){case"reference":this.internal.write(" "+r.object.objId+" 0 R ");break;case"text":var j=this.internal.newAdditionalObject(),P=this.internal.newAdditionalObject(),k=this.internal.getEncryptor(j.objId),_=r.title||"Note";i="<</Type /Annot /Subtype /Text "+(s="/Rect ["+o(r.bounds.x)+" "+l(r.bounds.y+r.bounds.h)+" "+o(r.bounds.x+r.bounds.w)+" "+l(r.bounds.y)+"] ")+"/Contents ("+v(k(r.contents))+")",i+=" /Popup "+P.objId+" 0 R",i+=" /P "+c.objId+" 0 R",i+=" /T ("+v(k(_))+") >>",j.content=i;var M=j.objId+" 0 R";i="<</Type /Annot /Subtype /Popup "+(s="/Rect ["+o(r.bounds.x+30)+" "+l(r.bounds.y+r.bounds.h)+" "+o(r.bounds.x+r.bounds.w+30)+" "+l(r.bounds.y)+"] ")+" /Parent "+M,r.open&&(i+=" /Open true"),i+=" >>",P.content=i,this.internal.write(j.objId,"0 R",P.objId,"0 R");break;case"freetext":s="/Rect ["+o(r.bounds.x)+" "+l(r.bounds.y)+" "+o(r.bounds.x+r.bounds.w)+" "+l(r.bounds.y+r.bounds.h)+"] ";var $=r.color||"#000000";i="<</Type /Annot /Subtype /FreeText "+s+"/Contents ("+v(N(r.contents))+")",i+=" /DS(font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+$+")",i+=" /Border [0 0 0]",i+=" >>",this.internal.write(i);break;case"link":if(r.options.name){var Y=this.annotations._nameMap[r.options.name];r.options.pageNumber=Y.page,r.options.top=Y.y}else r.options.top||(r.options.top=0);if(s="/Rect ["+r.finalBounds.x+" "+r.finalBounds.y+" "+r.finalBounds.w+" "+r.finalBounds.h+"] ",i="",r.options.url)i="<</Type /Annot /Subtype /Link "+s+"/Border [0 0 0] /A <</S /URI /URI ("+v(N(r.options.url))+") >>";else if(r.options.pageNumber)switch(i="<</Type /Annot /Subtype /Link "+s+"/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":i+=" /Fit]";break;case"FitH":i+=" /FitH "+r.options.top+"]";break;case"FitV":r.options.left=r.options.left||0,i+=" /FitV "+r.options.left+"]";break;case"XYZ":default:var U=l(r.options.top);r.options.left=r.options.left||0,r.options.zoom===void 0&&(r.options.zoom=0),i+=" /XYZ "+r.options.left+" "+U+" "+r.options.zoom+"]"}i!=""&&(i+=" >>",this.internal.write(i))}}this.internal.write("]")}}]),t.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)}},t.link=function(n,r,s,i,o){var l=this.internal.getCurrentPageInfo(),c=this.internal.getCoordinateString,d=this.internal.getVerticalCoordinateString;l.pageContext.annotations.push({finalBounds:{x:c(n),y:d(r),w:c(n+s),h:d(r+i)},options:o,type:"link"})},t.textWithLink=function(n,r,s,i){var o,l,c=this.getTextWidth(n),d=this.internal.getLineHeight()/this.internal.scaleFactor;if(i.maxWidth!==void 0){l=i.maxWidth;var f=this.splitTextToSize(n,l).length;o=Math.ceil(d*f)}else l=c,o=d;return this.text(n,r,s,i),s+=.2*d,i.align==="center"&&(r-=c/2),i.align==="right"&&(r-=c),this.link(r,s-d,l,o,i),c},t.getTextWidth=function(n){var r=this.internal.getFontSize();return this.getStringUnitWidth(n)*r/this.internal.scaleFactor}}(Zt.API),function(t){var e={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},s=[1570,1571,1573,1575];t.__arabicParser__={};var i=t.__arabicParser__.isInArabicSubstitutionA=function(j){return e[j.charCodeAt(0)]!==void 0},o=t.__arabicParser__.isArabicLetter=function(j){return typeof j=="string"&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(j)},l=t.__arabicParser__.isArabicEndLetter=function(j){return o(j)&&i(j)&&e[j.charCodeAt(0)].length<=2},c=t.__arabicParser__.isArabicAlfLetter=function(j){return o(j)&&s.indexOf(j.charCodeAt(0))>=0};t.__arabicParser__.arabicLetterHasIsolatedForm=function(j){return o(j)&&i(j)&&e[j.charCodeAt(0)].length>=1};var d=t.__arabicParser__.arabicLetterHasFinalForm=function(j){return o(j)&&i(j)&&e[j.charCodeAt(0)].length>=2};t.__arabicParser__.arabicLetterHasInitialForm=function(j){return o(j)&&i(j)&&e[j.charCodeAt(0)].length>=3};var f=t.__arabicParser__.arabicLetterHasMedialForm=function(j){return o(j)&&i(j)&&e[j.charCodeAt(0)].length==4},m=t.__arabicParser__.resolveLigatures=function(j){var P=0,k=n,_="",M=0;for(P=0;P<j.length;P+=1)k[j.charCodeAt(P)]!==void 0?(M++,typeof(k=k[j.charCodeAt(P)])=="number"&&(_+=String.fromCharCode(k),k=n,M=0),P===j.length-1&&(k=n,_+=j.charAt(P-(M-1)),P-=M-1,M=0)):(k=n,_+=j.charAt(P-M),P-=M,M=0);return _};t.__arabicParser__.isArabicDiacritic=function(j){return j!==void 0&&r[j.charCodeAt(0)]!==void 0};var g=t.__arabicParser__.getCorrectForm=function(j,P,k){return o(j)?i(j)===!1?-1:!d(j)||!o(P)&&!o(k)||!o(k)&&l(P)||l(j)&&!o(P)||l(j)&&c(P)||l(j)&&l(P)?0:f(j)&&o(P)&&!l(P)&&o(k)&&d(k)?3:l(j)||!o(k)?1:2:-1},v=function(j){var P=0,k=0,_=0,M="",$="",Y="",U=(j=j||"").split("\\s+"),te=[];for(P=0;P<U.length;P+=1){for(te.push(""),k=0;k<U[P].length;k+=1)M=U[P][k],$=U[P][k-1],Y=U[P][k+1],o(M)?(_=g(M,$,Y),te[P]+=_!==-1?String.fromCharCode(e[M.charCodeAt(0)][_]):M):te[P]+=M;te[P]=m(te[P])}return te.join(" ")},N=t.__arabicParser__.processArabic=t.processArabic=function(){var j,P=typeof arguments[0]=="string"?arguments[0]:arguments[0].text,k=[];if(Array.isArray(P)){var _=0;for(k=[],_=0;_<P.length;_+=1)Array.isArray(P[_])?k.push([v(P[_][0]),P[_][1],P[_][2]]):k.push([v(P[_])]);j=k}else j=v(P);return typeof arguments[0]=="string"?j:(arguments[0].text=j,arguments[0])};t.events.push(["preProcessText",N])}(Zt.API),Zt.API.autoPrint=function(t){var e;switch((t=t||{}).variant=t.variant||"non-conform",t.variant){case"javascript":this.addJS("print({});");break;case"non-conform":default:this.internal.events.subscribe("postPutResources",function(){e=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 "+e+" 0 R")})}return this},function(t){var e=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 s=300;Object.defineProperty(this,"height",{get:function(){return s},set:function(l){s=isNaN(l)||Number.isInteger(l)===!1||l<0?300:l,this.getContext("2d").pageWrapYEnabled&&(this.getContext("2d").pageWrapY=s+1)}});var i=[];Object.defineProperty(this,"childNodes",{get:function(){return i},set:function(l){i=l}});var o={};Object.defineProperty(this,"style",{get:function(){return o},set:function(l){o=l}}),Object.defineProperty(this,"parentNode",{})};e.prototype.getContext=function(n,r){var s;if((n=n||"2d")!=="2d")return null;for(s in r)this.pdf.context2d.hasOwnProperty(s)&&(this.pdf.context2d[s]=r[s]);return this.pdf.context2d._canvas=this,this.pdf.context2d},e.prototype.toDataURL=function(){throw new Error("toDataURL is not implemented.")},t.events.push(["initialized",function(){this.canvas=new e,this.canvas.pdf=this}])}(Zt.API),function(t){var e={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({},e),this.internal.__cell__.margins.width=this.getPageWidth(),s.call(this))},s=function(){this.internal.__cell__.lastCell=new i,this.internal.__cell__.pages=1},i=function(){var c=arguments[0];Object.defineProperty(this,"x",{enumerable:!0,get:function(){return c},set:function(j){c=j}});var d=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return d},set:function(j){d=j}});var f=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return f},set:function(j){f=j}});var m=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return m},set:function(j){m=j}});var g=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return g},set:function(j){g=j}});var v=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return v},set:function(j){v=j}});var N=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return N},set:function(j){N=j}}),this};i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align)},i.prototype.toArray=function(){return[this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align]},t.setHeaderFunction=function(c){return r.call(this),this.internal.__cell__.headerFunction=typeof c=="function"?c:void 0,this},t.getTextDimensions=function(c,d){r.call(this);var f=(d=d||{}).fontSize||this.getFontSize(),m=d.font||this.getFont(),g=d.scaleFactor||this.internal.scaleFactor,v=0,N=0,j=0,P=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 k=d.maxWidth;k>0?typeof c=="string"?c=this.splitTextToSize(c,k):Object.prototype.toString.call(c)==="[object Array]"&&(c=c.reduce(function(M,$){return M.concat(P.splitTextToSize($,k))},[])):c=Array.isArray(c)?c:[c];for(var _=0;_<c.length;_++)v<(j=this.getStringUnitWidth(c[_],{font:m})*f)&&(v=j);return v!==0&&(N=c.length),{w:v/=g,h:Math.max((N*f*this.getLineHeightFactor()-f*(this.getLineHeightFactor()-1))/g,0)}},t.cellAddPage=function(){r.call(this),this.addPage();var c=this.internal.__cell__.margins||e;return this.internal.__cell__.lastCell=new i(c.left,c.top,void 0,void 0),this.internal.__cell__.pages+=1,this};var o=t.cell=function(){var c;c=arguments[0]instanceof i?arguments[0]:new i(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]),r.call(this);var d=this.internal.__cell__.lastCell,f=this.internal.__cell__.padding,m=this.internal.__cell__.margins||e,g=this.internal.__cell__.tableHeaderRow,v=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+m.bottom>this.getPageHeight()?(this.cellAddPage(),c.y=m.top,v&&g&&(this.printHeaderRow(c.lineNumber,!0),c.y+=g[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-f,c.y+f,{align:"right",baseline:"top"}):c.align==="center"?this.text(c.text,c.x+c.width/2,c.y+f,{align:"center",baseline:"top",maxWidth:c.width-f-f}):this.text(c.text,c.x+f,c.y+f,{align:"left",baseline:"top",maxWidth:c.width-f-f})),this.internal.__cell__.lastCell=c,this};t.table=function(c,d,f,m,g){if(r.call(this),!f)throw new Error("No data for PDF table.");var v,N,j,P,k=[],_=[],M=[],$={},Y={},U=[],te=[],W=(g=g||{}).autoSize||!1,ge=g.printHeaders!==!1,oe=g.css&&g.css["font-size"]!==void 0?16*g.css["font-size"]:g.fontSize||12,B=g.margins||Object.assign({width:this.getPageWidth()},e),T=typeof g.padding=="number"?g.padding:3,J=g.headerBackgroundColor||"#c8c8c8",Z=g.headerTextColor||"#000";if(s.call(this),this.internal.__cell__.printHeaders=ge,this.internal.__cell__.margins=B,this.internal.__cell__.table_font_size=oe,this.internal.__cell__.padding=T,this.internal.__cell__.headerBackgroundColor=J,this.internal.__cell__.headerTextColor=Z,this.setFontSize(oe),m==null)_=k=Object.keys(f[0]),M=k.map(function(){return"left"});else if(Array.isArray(m)&&Fn(m[0])==="object")for(k=m.map(function(De){return De.name}),_=m.map(function(De){return De.prompt||De.name||""}),M=m.map(function(De){return De.align||"left"}),v=0;v<m.length;v+=1)Y[m[v].name]=m[v].width*(19.049976/25.4);else Array.isArray(m)&&typeof m[0]=="string"&&(_=k=m,M=k.map(function(){return"left"}));if(W||Array.isArray(m)&&typeof m[0]=="string")for(v=0;v<k.length;v+=1){for($[P=k[v]]=f.map(function(De){return De[P]}),this.setFont(void 0,"bold"),U.push(this.getTextDimensions(_[v],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),N=$[P],this.setFont(void 0,"normal"),j=0;j<N.length;j+=1)U.push(this.getTextDimensions(N[j],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);Y[P]=Math.max.apply(null,U)+T+T,U=[]}if(ge){var Ne={};for(v=0;v<k.length;v+=1)Ne[k[v]]={},Ne[k[v]].text=_[v],Ne[k[v]].align=M[v];var he=l.call(this,Ne,Y);te=k.map(function(De){return new i(c,d,Y[De],he,Ne[De].text,void 0,Ne[De].align)}),this.setTableHeaderRow(te),this.printHeaderRow(1,!1)}var ae=m.reduce(function(De,$e){return De[$e.name]=$e.align,De},{});for(v=0;v<f.length;v+=1){"rowStart"in g&&g.rowStart instanceof Function&&g.rowStart({row:v,data:f[v]},this);var G=l.call(this,f[v],Y);for(j=0;j<k.length;j+=1){var xe=f[v][k[j]];"cellStart"in g&&g.cellStart instanceof Function&&g.cellStart({row:v,col:j,data:xe},this),o.call(this,new i(c,d,Y[k[j]],G,xe,v+2,ae[k[j]]))}}return this.internal.__cell__.table_x=c,this.internal.__cell__.table_y=d,this};var l=function(c,d){var f=this.internal.__cell__.padding,m=this.internal.__cell__.table_font_size,g=this.internal.scaleFactor;return Object.keys(c).map(function(v){var N=c[v];return this.splitTextToSize(N.hasOwnProperty("text")?N.text:N,d[v]-f-f)},this).map(function(v){return this.getLineHeightFactor()*v.length*m/g+f+f},this).reduce(function(v,N){return Math.max(v,N)},0)};t.setTableHeaderRow=function(c){r.call(this),this.internal.__cell__.tableHeaderRow=c},t.printHeaderRow=function(c,d){if(r.call(this),!this.internal.__cell__.tableHeaderRow)throw new Error("Property tableHeaderRow does not exist.");var f;if(n=!0,typeof this.internal.__cell__.headerFunction=="function"){var m=this.internal.__cell__.headerFunction(this,this.internal.__cell__.pages);this.internal.__cell__.lastCell=new i(m[0],m[1],m[2],m[3],void 0,-1)}this.setFont(void 0,"bold");for(var g=[],v=0;v<this.internal.__cell__.tableHeaderRow.length;v+=1){f=this.internal.__cell__.tableHeaderRow[v].clone(),d&&(f.y=this.internal.__cell__.margins.top||0,g.push(f)),f.lineNumber=c;var N=this.getTextColor();this.setTextColor(this.internal.__cell__.headerTextColor),this.setFillColor(this.internal.__cell__.headerBackgroundColor),o.call(this,f),this.setTextColor(N)}g.length>0&&this.setTableHeaderRow(g),this.setFont(void 0,"normal"),n=!1}}(Zt.API);var f4={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},p4=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],Hm=h4(p4),m4=[100,200,300,400,500,600,700,800,900],k9=h4(m4);function Km(t){var e=t.family.replace(/"|'/g,"").toLowerCase(),n=function(i){return f4[i=i||"normal"]?i:"normal"}(t.style),r=function(i){if(!i)return 400;if(typeof i=="number")return i>=100&&i<=900&&i%100==0?i:400;if(/^\d00$/.test(i))return parseInt(i);switch(i){case"bold":return 700;case"normal":default:return 400}}(t.weight),s=function(i){return typeof Hm[i=i||"normal"]=="number"?i:"normal"}(t.stretch);return{family:e,style:n,weight:r,stretch:s,src:t.src||[],ref:t.ref||{name:e,style:[s,n,r].join(" ")}}}function $y(t,e,n,r){var s;for(s=n;s>=0&&s<e.length;s+=r)if(t[e[s]])return t[e[s]];for(s=n;s>=0&&s<e.length;s-=r)if(t[e[s]])return t[e[s]]}var _9={"sans-serif":"helvetica",fixed:"courier",monospace:"courier",terminal:"courier",cursive:"times",fantasy:"times",serif:"times"},Hy={caption:"times",icon:"times",menu:"times","message-box":"times","small-caption":"times","status-bar":"times"};function Ky(t){return[t.stretch,t.style,t.weight,t.family].join(" ")}function A9(t,e,n){for(var r=(n=n||{}).defaultFontFamily||"times",s=Object.assign({},_9,n.genericFontFamilies||{}),i=null,o=null,l=0;l<e.length;++l)if(s[(i=Km(e[l])).family]&&(i.family=s[i.family]),t.hasOwnProperty(i.family)){o=t[i.family];break}if(!(o=o||t[r]))throw new Error("Could not find a font-family for the rule '"+Ky(i)+"' and default family '"+r+"'.");if(o=function(c,d){if(d[c])return d[c];var f=Hm[c],m=f<=Hm.normal?-1:1,g=$y(d,p4,f,m);if(!g)throw new Error("Could not find a matching font-stretch value for "+c);return g}(i.stretch,o),o=function(c,d){if(d[c])return d[c];for(var f=f4[c],m=0;m<f.length;++m)if(d[f[m]])return d[f[m]];throw new Error("Could not find a matching font-style for "+c)}(i.style,o),!(o=function(c,d){if(d[c])return d[c];if(c===400&&d[500])return d[500];if(c===500&&d[400])return d[400];var f=k9[c],m=$y(d,m4,f,c<400?-1:1);if(!m)throw new Error("Could not find a matching font-weight for value "+c);return m}(i.weight,o)))throw new Error("Failed to resolve a font for the rule '"+Ky(i)+"'.");return o}function Gy(t){return t.trimLeft()}function P9(t,e){for(var n=0;n<t.length;){if(t.charAt(n)===e)return[t.substring(0,n),t.substring(n+1)];n+=1}return null}function C9(t){var e=t.match(/^(-[a-z_]|[a-z_])[a-z0-9_-]*/i);return e===null?null:[e[0],t.substring(e[0].length)]}var Wd,Yy,Zy,Rp=["times"];(function(t){var e,n,r,s,i,o,l,c,d,f=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 o,this.miterLimit=E.miterLimit||10,this.lastPoint=E.lastPoint||new o,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};t.events.push(["initialized",function(){this.context2d=new m(this),e=this.internal.f2,n=this.internal.getCoordinateString,r=this.internal.getVerticalCoordinateString,s=this.internal.getHorizontalCoordinate,i=this.internal.getVerticalCoordinate,o=this.internal.Point,l=this.internal.Rectangle,c=this.internal.Matrix,d=new f}]);var m=function(E){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var z=E;Object.defineProperty(this,"pdf",{get:function(){return z}});var ee=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return ee},set:function(qe){ee=!!qe}});var le=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return le},set:function(qe){le=!!qe}});var ue=0;Object.defineProperty(this,"posX",{get:function(){return ue},set:function(qe){isNaN(qe)||(ue=qe)}});var ve=0;Object.defineProperty(this,"posY",{get:function(){return ve},set:function(qe){isNaN(qe)||(ve=qe)}}),Object.defineProperty(this,"margin",{get:function(){return d.margin},set:function(qe){var re;typeof qe=="number"?re=[qe,qe,qe,qe]:((re=new Array(4))[0]=qe[0],re[1]=qe.length>=2?qe[1]:re[0],re[2]=qe.length>=3?qe[2]:re[0],re[3]=qe.length>=4?qe[3]:re[1]),d.margin=re}});var Pe=!1;Object.defineProperty(this,"autoPaging",{get:function(){return Pe},set:function(qe){Pe=qe}});var ce=0;Object.defineProperty(this,"lastBreak",{get:function(){return ce},set:function(qe){ce=qe}});var Ye=[];Object.defineProperty(this,"pageBreaks",{get:function(){return Ye},set:function(qe){Ye=qe}}),Object.defineProperty(this,"ctx",{get:function(){return d},set:function(qe){qe instanceof f&&(d=qe)}}),Object.defineProperty(this,"path",{get:function(){return d.path},set:function(qe){d.path=qe}});var Ke=[];Object.defineProperty(this,"ctxStack",{get:function(){return Ke},set:function(qe){Ke=qe}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(qe){var re;re=g(qe),this.ctx.fillStyle=re.style,this.ctx.isFillTransparent=re.a===0,this.ctx.fillOpacity=re.a,this.pdf.setFillColor(re.r,re.g,re.b,{a:re.a}),this.pdf.setTextColor(re.r,re.g,re.b,{a:re.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(qe){var re=g(qe);this.ctx.strokeStyle=re.style,this.ctx.isStrokeTransparent=re.a===0,this.ctx.strokeOpacity=re.a,re.a===0?this.pdf.setDrawColor(255,255,255):(re.a,this.pdf.setDrawColor(re.r,re.g,re.b))}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(qe){["butt","round","square"].indexOf(qe)!==-1&&(this.ctx.lineCap=qe,this.pdf.setLineCap(qe))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(qe){isNaN(qe)||(this.ctx.lineWidth=qe,this.pdf.setLineWidth(qe))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(qe){["bevel","round","miter"].indexOf(qe)!==-1&&(this.ctx.lineJoin=qe,this.pdf.setLineJoin(qe))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(qe){isNaN(qe)||(this.ctx.miterLimit=qe,this.pdf.setMiterLimit(qe))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(qe){this.ctx.textBaseline=qe}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(qe){["right","end","center","left","start"].indexOf(qe)!==-1&&(this.ctx.textAlign=qe)}});var Ue=null;function it(qe,re){if(Ue===null){var zt=function(X){var ne=[];return Object.keys(X).forEach(function(fe){X[fe].forEach(function(Re){var Oe=null;switch(Re){case"bold":Oe={family:fe,weight:"bold"};break;case"italic":Oe={family:fe,style:"italic"};break;case"bolditalic":Oe={family:fe,weight:"bold",style:"italic"};break;case"":case"normal":Oe={family:fe}}Oe!==null&&(Oe.ref={name:fe,style:Re},ne.push(Oe))})}),ne}(qe.getFontList());Ue=function(X){for(var ne={},fe=0;fe<X.length;++fe){var Re=Km(X[fe]),Oe=Re.family,Fe=Re.stretch,et=Re.style,yt=Re.weight;ne[Oe]=ne[Oe]||{},ne[Oe][Fe]=ne[Oe][Fe]||{},ne[Oe][Fe][et]=ne[Oe][Fe][et]||{},ne[Oe][Fe][et][yt]=Re}return ne}(zt.concat(re))}return Ue}var It=null;Object.defineProperty(this,"fontFaces",{get:function(){return It},set:function(qe){Ue=null,It=qe}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(qe){var re;if(this.ctx.font=qe,(re=/^\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-z]+?)\s*$/i.exec(qe))!==null){var zt=re[1];re[2];var X=re[3],ne=re[4];re[5];var fe=re[6],Re=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(ne)[2];ne=Math.floor(Re==="px"?parseFloat(ne)*this.pdf.internal.scaleFactor:Re==="em"?parseFloat(ne)*this.pdf.getFontSize():parseFloat(ne)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(ne);var Oe=function(Ot){var Qt,ft,In=[],on=Ot.trim();if(on==="")return Rp;if(on in Hy)return[Hy[on]];for(;on!=="";){switch(ft=null,Qt=(on=Gy(on)).charAt(0)){case'"':case"'":ft=P9(on.substring(1),Qt);break;default:ft=C9(on)}if(ft===null||(In.push(ft[0]),(on=Gy(ft[1]))!==""&&on.charAt(0)!==","))return Rp;on=on.replace(/^,/,"")}return In}(fe);if(this.fontFaces){var Fe=A9(it(this.pdf,this.fontFaces),Oe.map(function(Ot){return{family:Ot,stretch:"normal",weight:X,style:zt}}));this.pdf.setFont(Fe.ref.name,Fe.ref.style)}else{var et="";(X==="bold"||parseInt(X,10)>=700||zt==="bold")&&(et="bold"),zt==="italic"&&(et+="italic"),et.length===0&&(et="normal");for(var yt="",Pt={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"},Lt=0;Lt<Oe.length;Lt++){if(this.pdf.internal.getFont(Oe[Lt],et,{noFallback:!0,disableWarning:!0})!==void 0){yt=Oe[Lt];break}if(et==="bolditalic"&&this.pdf.internal.getFont(Oe[Lt],"bold",{noFallback:!0,disableWarning:!0})!==void 0)yt=Oe[Lt],et="bold";else if(this.pdf.internal.getFont(Oe[Lt],"normal",{noFallback:!0,disableWarning:!0})!==void 0){yt=Oe[Lt],et="normal";break}}if(yt===""){for(var an=0;an<Oe.length;an++)if(Pt[Oe[an]]){yt=Pt[Oe[an]];break}}yt=yt===""?"Times":yt,this.pdf.setFont(yt,et)}}}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(qe){this.ctx.globalCompositeOperation=qe}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(qe){this.ctx.globalAlpha=qe}}),Object.defineProperty(this,"lineDashOffset",{get:function(){return this.ctx.lineDashOffset},set:function(qe){this.ctx.lineDashOffset=qe,$e.call(this)}}),Object.defineProperty(this,"lineDash",{get:function(){return this.ctx.lineDash},set:function(qe){this.ctx.lineDash=qe,$e.call(this)}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(qe){this.ctx.ignoreClearRect=!!qe}})};m.prototype.setLineDash=function(E){this.lineDash=E},m.prototype.getLineDash=function(){return this.lineDash.length%2?this.lineDash.concat(this.lineDash):this.lineDash.slice()},m.prototype.fill=function(){$.call(this,"fill",!1)},m.prototype.stroke=function(){$.call(this,"stroke",!1)},m.prototype.beginPath=function(){this.path=[{type:"begin"}]},m.prototype.moveTo=function(E,z){if(isNaN(E)||isNaN(z))throw Wn.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.moveTo");var ee=this.ctx.transform.applyToPoint(new o(E,z));this.path.push({type:"mt",x:ee.x,y:ee.y}),this.ctx.lastPoint=new o(E,z)},m.prototype.closePath=function(){var E=new o(0,0),z=0;for(z=this.path.length-1;z!==-1;z--)if(this.path[z].type==="begin"&&Fn(this.path[z+1])==="object"&&typeof this.path[z+1].x=="number"){E=new o(this.path[z+1].x,this.path[z+1].y);break}this.path.push({type:"close"}),this.ctx.lastPoint=new o(E.x,E.y)},m.prototype.lineTo=function(E,z){if(isNaN(E)||isNaN(z))throw Wn.error("jsPDF.context2d.lineTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.lineTo");var ee=this.ctx.transform.applyToPoint(new o(E,z));this.path.push({type:"lt",x:ee.x,y:ee.y}),this.ctx.lastPoint=new o(ee.x,ee.y)},m.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),$.call(this,null,!0)},m.prototype.quadraticCurveTo=function(E,z,ee,le){if(isNaN(ee)||isNaN(le)||isNaN(E)||isNaN(z))throw Wn.error("jsPDF.context2d.quadraticCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");var ue=this.ctx.transform.applyToPoint(new o(ee,le)),ve=this.ctx.transform.applyToPoint(new o(E,z));this.path.push({type:"qct",x1:ve.x,y1:ve.y,x:ue.x,y:ue.y}),this.ctx.lastPoint=new o(ue.x,ue.y)},m.prototype.bezierCurveTo=function(E,z,ee,le,ue,ve){if(isNaN(ue)||isNaN(ve)||isNaN(E)||isNaN(z)||isNaN(ee)||isNaN(le))throw Wn.error("jsPDF.context2d.bezierCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");var Pe=this.ctx.transform.applyToPoint(new o(ue,ve)),ce=this.ctx.transform.applyToPoint(new o(E,z)),Ye=this.ctx.transform.applyToPoint(new o(ee,le));this.path.push({type:"bct",x1:ce.x,y1:ce.y,x2:Ye.x,y2:Ye.y,x:Pe.x,y:Pe.y}),this.ctx.lastPoint=new o(Pe.x,Pe.y)},m.prototype.arc=function(E,z,ee,le,ue,ve){if(isNaN(E)||isNaN(z)||isNaN(ee)||isNaN(le)||isNaN(ue))throw Wn.error("jsPDF.context2d.arc: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.arc");if(ve=!!ve,!this.ctx.transform.isIdentity){var Pe=this.ctx.transform.applyToPoint(new o(E,z));E=Pe.x,z=Pe.y;var ce=this.ctx.transform.applyToPoint(new o(0,ee)),Ye=this.ctx.transform.applyToPoint(new o(0,0));ee=Math.sqrt(Math.pow(ce.x-Ye.x,2)+Math.pow(ce.y-Ye.y,2))}Math.abs(ue-le)>=2*Math.PI&&(le=0,ue=2*Math.PI),this.path.push({type:"arc",x:E,y:z,radius:ee,startAngle:le,endAngle:ue,counterclockwise:ve})},m.prototype.arcTo=function(E,z,ee,le,ue){throw new Error("arcTo not implemented.")},m.prototype.rect=function(E,z,ee,le){if(isNaN(E)||isNaN(z)||isNaN(ee)||isNaN(le))throw Wn.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(E,z),this.lineTo(E+ee,z),this.lineTo(E+ee,z+le),this.lineTo(E,z+le),this.lineTo(E,z),this.lineTo(E+ee,z),this.lineTo(E,z)},m.prototype.fillRect=function(E,z,ee,le){if(isNaN(E)||isNaN(z)||isNaN(ee)||isNaN(le))throw Wn.error("jsPDF.context2d.fillRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillRect");if(!v.call(this)){var ue={};this.lineCap!=="butt"&&(ue.lineCap=this.lineCap,this.lineCap="butt"),this.lineJoin!=="miter"&&(ue.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(E,z,ee,le),this.fill(),ue.hasOwnProperty("lineCap")&&(this.lineCap=ue.lineCap),ue.hasOwnProperty("lineJoin")&&(this.lineJoin=ue.lineJoin)}},m.prototype.strokeRect=function(E,z,ee,le){if(isNaN(E)||isNaN(z)||isNaN(ee)||isNaN(le))throw Wn.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");N.call(this)||(this.beginPath(),this.rect(E,z,ee,le),this.stroke())},m.prototype.clearRect=function(E,z,ee,le){if(isNaN(E)||isNaN(z)||isNaN(ee)||isNaN(le))throw Wn.error("jsPDF.context2d.clearRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(E,z,ee,le))},m.prototype.save=function(E){E=typeof E!="boolean"||E;for(var z=this.pdf.internal.getCurrentPageInfo().pageNumber,ee=0;ee<this.pdf.internal.getNumberOfPages();ee++)this.pdf.setPage(ee+1),this.pdf.internal.out("q");if(this.pdf.setPage(z),E){this.ctx.fontSize=this.pdf.internal.getFontSize();var le=new f(this.ctx);this.ctxStack.push(this.ctx),this.ctx=le}},m.prototype.restore=function(E){E=typeof E!="boolean"||E;for(var z=this.pdf.internal.getCurrentPageInfo().pageNumber,ee=0;ee<this.pdf.internal.getNumberOfPages();ee++)this.pdf.setPage(ee+1),this.pdf.internal.out("Q");this.pdf.setPage(z),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)},m.prototype.toDataURL=function(){throw new Error("toDataUrl not implemented.")};var g=function(E){var z,ee,le,ue;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))z=0,ee=0,le=0,ue=0;else{var ve=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(E);if(ve!==null)z=parseInt(ve[1]),ee=parseInt(ve[2]),le=parseInt(ve[3]),ue=1;else if((ve=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(E))!==null)z=parseInt(ve[1]),ee=parseInt(ve[2]),le=parseInt(ve[3]),ue=parseFloat(ve[4]);else{if(ue=1,typeof E=="string"&&E.charAt(0)!=="#"){var Pe=new a4(E);E=Pe.ok?Pe.toHex():"#000000"}E.length===4?(z=E.substring(1,2),z+=z,ee=E.substring(2,3),ee+=ee,le=E.substring(3,4),le+=le):(z=E.substring(1,3),ee=E.substring(3,5),le=E.substring(5,7)),z=parseInt(z,16),ee=parseInt(ee,16),le=parseInt(le,16)}}return{r:z,g:ee,b:le,a:ue,style:E}},v=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},N=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};m.prototype.fillText=function(E,z,ee,le){if(isNaN(z)||isNaN(ee)||typeof E!="string")throw Wn.error("jsPDF.context2d.fillText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillText");if(le=isNaN(le)?void 0:le,!v.call(this)){var ue=G(this.ctx.transform.rotation),ve=this.ctx.transform.scaleX;T.call(this,{text:E,x:z,y:ee,scale:ve,angle:ue,align:this.textAlign,maxWidth:le})}},m.prototype.strokeText=function(E,z,ee,le){if(isNaN(z)||isNaN(ee)||typeof E!="string")throw Wn.error("jsPDF.context2d.strokeText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeText");if(!N.call(this)){le=isNaN(le)?void 0:le;var ue=G(this.ctx.transform.rotation),ve=this.ctx.transform.scaleX;T.call(this,{text:E,x:z,y:ee,scale:ve,renderingMode:"stroke",angle:ue,align:this.textAlign,maxWidth:le})}},m.prototype.measureText=function(E){if(typeof E!="string")throw Wn.error("jsPDF.context2d.measureText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.measureText");var z=this.pdf,ee=this.pdf.internal.scaleFactor,le=z.internal.getFontSize(),ue=z.getStringUnitWidth(E)*le/z.internal.scaleFactor,ve=function(Pe){var ce=(Pe=Pe||{}).width||0;return Object.defineProperty(this,"width",{get:function(){return ce}}),this};return new ve({width:ue*=Math.round(96*ee/72*1e4)/1e4})},m.prototype.scale=function(E,z){if(isNaN(E)||isNaN(z))throw Wn.error("jsPDF.context2d.scale: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.scale");var ee=new c(E,0,0,z,0,0);this.ctx.transform=this.ctx.transform.multiply(ee)},m.prototype.rotate=function(E){if(isNaN(E))throw Wn.error("jsPDF.context2d.rotate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rotate");var z=new c(Math.cos(E),Math.sin(E),-Math.sin(E),Math.cos(E),0,0);this.ctx.transform=this.ctx.transform.multiply(z)},m.prototype.translate=function(E,z){if(isNaN(E)||isNaN(z))throw Wn.error("jsPDF.context2d.translate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.translate");var ee=new c(1,0,0,1,E,z);this.ctx.transform=this.ctx.transform.multiply(ee)},m.prototype.transform=function(E,z,ee,le,ue,ve){if(isNaN(E)||isNaN(z)||isNaN(ee)||isNaN(le)||isNaN(ue)||isNaN(ve))throw Wn.error("jsPDF.context2d.transform: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.transform");var Pe=new c(E,z,ee,le,ue,ve);this.ctx.transform=this.ctx.transform.multiply(Pe)},m.prototype.setTransform=function(E,z,ee,le,ue,ve){E=isNaN(E)?1:E,z=isNaN(z)?0:z,ee=isNaN(ee)?0:ee,le=isNaN(le)?1:le,ue=isNaN(ue)?0:ue,ve=isNaN(ve)?0:ve,this.ctx.transform=new c(E,z,ee,le,ue,ve)};var j=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};m.prototype.drawImage=function(E,z,ee,le,ue,ve,Pe,ce,Ye){var Ke=this.pdf.getImageProperties(E),Ue=1,it=1,It=1,qe=1;le!==void 0&&ce!==void 0&&(It=ce/le,qe=Ye/ue,Ue=Ke.width/le*ce/le,it=Ke.height/ue*Ye/ue),ve===void 0&&(ve=z,Pe=ee,z=0,ee=0),le!==void 0&&ce===void 0&&(ce=le,Ye=ue),le===void 0&&ce===void 0&&(ce=Ke.width,Ye=Ke.height);for(var re,zt=this.ctx.transform.decompose(),X=G(zt.rotate.shx),ne=new c,fe=(ne=(ne=(ne=ne.multiply(zt.translate)).multiply(zt.skew)).multiply(zt.scale)).applyToRectangle(new l(ve-z*It,Pe-ee*qe,le*Ue,ue*it)),Re=P.call(this,fe),Oe=[],Fe=0;Fe<Re.length;Fe+=1)Oe.indexOf(Re[Fe])===-1&&Oe.push(Re[Fe]);if(M(Oe),this.autoPaging)for(var et=Oe[0],yt=Oe[Oe.length-1],Pt=et;Pt<yt+1;Pt++){this.pdf.setPage(Pt);var Lt=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],an=Pt===1?this.posY+this.margin[0]:this.margin[0],Ot=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Qt=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],ft=Pt===1?0:Ot+(Pt-2)*Qt;if(this.ctx.clip_path.length!==0){var In=this.path;re=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=_(re,this.posX+this.margin[3],-ft+an+this.ctx.prevPageLastElemOffset),Y.call(this,"fill",!0),this.path=In}var on=JSON.parse(JSON.stringify(fe));on=_([on],this.posX+this.margin[3],-ft+an+this.ctx.prevPageLastElemOffset)[0];var Mr=(Pt>et||Pt<yt)&&j.call(this);Mr&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Lt,Qt,null).clip().discardPath()),this.pdf.addImage(E,"JPEG",on.x,on.y,on.w,on.h,null,null,X),Mr&&this.pdf.restoreGraphicsState()}else this.pdf.addImage(E,"JPEG",fe.x,fe.y,fe.w,fe.h,null,null,X)};var P=function(E,z,ee){var le=[];z=z||this.pdf.internal.pageSize.width,ee=ee||this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var ue=this.posY+this.ctx.prevPageLastElemOffset;switch(E.type){default:case"mt":case"lt":le.push(Math.floor((E.y+ue)/ee)+1);break;case"arc":le.push(Math.floor((E.y+ue-E.radius)/ee)+1),le.push(Math.floor((E.y+ue+E.radius)/ee)+1);break;case"qct":var ve=xe(this.ctx.lastPoint.x,this.ctx.lastPoint.y,E.x1,E.y1,E.x,E.y);le.push(Math.floor((ve.y+ue)/ee)+1),le.push(Math.floor((ve.y+ve.h+ue)/ee)+1);break;case"bct":var Pe=De(this.ctx.lastPoint.x,this.ctx.lastPoint.y,E.x1,E.y1,E.x2,E.y2,E.x,E.y);le.push(Math.floor((Pe.y+ue)/ee)+1),le.push(Math.floor((Pe.y+Pe.h+ue)/ee)+1);break;case"rect":le.push(Math.floor((E.y+ue)/ee)+1),le.push(Math.floor((E.y+E.h+ue)/ee)+1)}for(var ce=0;ce<le.length;ce+=1)for(;this.pdf.internal.getNumberOfPages()<le[ce];)k.call(this);return le},k=function(){var E=this.fillStyle,z=this.strokeStyle,ee=this.font,le=this.lineCap,ue=this.lineWidth,ve=this.lineJoin;this.pdf.addPage(),this.fillStyle=E,this.strokeStyle=z,this.font=ee,this.lineCap=le,this.lineWidth=ue,this.lineJoin=ve},_=function(E,z,ee){for(var le=0;le<E.length;le++)switch(E[le].type){case"bct":E[le].x2+=z,E[le].y2+=ee;case"qct":E[le].x1+=z,E[le].y1+=ee;case"mt":case"lt":case"arc":default:E[le].x+=z,E[le].y+=ee}return E},M=function(E){return E.sort(function(z,ee){return z-ee})},$=function(E,z){for(var ee,le,ue=this.fillStyle,ve=this.strokeStyle,Pe=this.lineCap,ce=this.lineWidth,Ye=Math.abs(ce*this.ctx.transform.scaleX),Ke=this.lineJoin,Ue=JSON.parse(JSON.stringify(this.path)),it=JSON.parse(JSON.stringify(this.path)),It=[],qe=0;qe<it.length;qe++)if(it[qe].x!==void 0)for(var re=P.call(this,it[qe]),zt=0;zt<re.length;zt+=1)It.indexOf(re[zt])===-1&&It.push(re[zt]);for(var X=0;X<It.length;X++)for(;this.pdf.internal.getNumberOfPages()<It[X];)k.call(this);if(M(It),this.autoPaging)for(var ne=It[0],fe=It[It.length-1],Re=ne;Re<fe+1;Re++){this.pdf.setPage(Re),this.fillStyle=ue,this.strokeStyle=ve,this.lineCap=Pe,this.lineWidth=Ye,this.lineJoin=Ke;var Oe=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Fe=Re===1?this.posY+this.margin[0]:this.margin[0],et=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],yt=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],Pt=Re===1?0:et+(Re-2)*yt;if(this.ctx.clip_path.length!==0){var Lt=this.path;ee=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=_(ee,this.posX+this.margin[3],-Pt+Fe+this.ctx.prevPageLastElemOffset),Y.call(this,E,!0),this.path=Lt}if(le=JSON.parse(JSON.stringify(Ue)),this.path=_(le,this.posX+this.margin[3],-Pt+Fe+this.ctx.prevPageLastElemOffset),z===!1||Re===0){var an=(Re>ne||Re<fe)&&j.call(this);an&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Oe,yt,null).clip().discardPath()),Y.call(this,E,z),an&&this.pdf.restoreGraphicsState()}this.lineWidth=ce}else this.lineWidth=Ye,Y.call(this,E,z),this.lineWidth=ce;this.path=Ue},Y=function(E,z){if((E!=="stroke"||z||!N.call(this))&&(E==="stroke"||z||!v.call(this))){for(var ee,le,ue=[],ve=this.path,Pe=0;Pe<ve.length;Pe++){var ce=ve[Pe];switch(ce.type){case"begin":ue.push({begin:!0});break;case"close":ue.push({close:!0});break;case"mt":ue.push({start:ce,deltas:[],abs:[]});break;case"lt":var Ye=ue.length;if(ve[Pe-1]&&!isNaN(ve[Pe-1].x)&&(ee=[ce.x-ve[Pe-1].x,ce.y-ve[Pe-1].y],Ye>0)){for(;Ye>=0;Ye--)if(ue[Ye-1].close!==!0&&ue[Ye-1].begin!==!0){ue[Ye-1].deltas.push(ee),ue[Ye-1].abs.push(ce);break}}break;case"bct":ee=[ce.x1-ve[Pe-1].x,ce.y1-ve[Pe-1].y,ce.x2-ve[Pe-1].x,ce.y2-ve[Pe-1].y,ce.x-ve[Pe-1].x,ce.y-ve[Pe-1].y],ue[ue.length-1].deltas.push(ee);break;case"qct":var Ke=ve[Pe-1].x+2/3*(ce.x1-ve[Pe-1].x),Ue=ve[Pe-1].y+2/3*(ce.y1-ve[Pe-1].y),it=ce.x+2/3*(ce.x1-ce.x),It=ce.y+2/3*(ce.y1-ce.y),qe=ce.x,re=ce.y;ee=[Ke-ve[Pe-1].x,Ue-ve[Pe-1].y,it-ve[Pe-1].x,It-ve[Pe-1].y,qe-ve[Pe-1].x,re-ve[Pe-1].y],ue[ue.length-1].deltas.push(ee);break;case"arc":ue.push({deltas:[],abs:[],arc:!0}),Array.isArray(ue[ue.length-1].abs)&&ue[ue.length-1].abs.push(ce)}}le=z?null:E==="stroke"?"stroke":"fill";for(var zt=!1,X=0;X<ue.length;X++)if(ue[X].arc)for(var ne=ue[X].abs,fe=0;fe<ne.length;fe++){var Re=ne[fe];Re.type==="arc"?W.call(this,Re.x,Re.y,Re.radius,Re.startAngle,Re.endAngle,Re.counterclockwise,void 0,z,!zt):J.call(this,Re.x,Re.y),zt=!0}else if(ue[X].close===!0)this.pdf.internal.out("h"),zt=!1;else if(ue[X].begin!==!0){var Oe=ue[X].start.x,Fe=ue[X].start.y;Z.call(this,ue[X].deltas,Oe,Fe),zt=!0}le&&ge.call(this,le),z&&oe.call(this)}},U=function(E){var z=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,ee=z*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case"bottom":return E-ee;case"top":return E+z-ee;case"hanging":return E+z-2*ee;case"middle":return E+z/2-ee;case"ideographic":return E;case"alphabetic":default:return E}},te=function(E){return E+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};m.prototype.createLinearGradient=function(){var E=function(){};return E.colorStops=[],E.addColorStop=function(z,ee){this.colorStops.push([z,ee])},E.getColor=function(){return this.colorStops.length===0?"#000000":this.colorStops[0][1]},E.isCanvasGradient=!0,E},m.prototype.createPattern=function(){return this.createLinearGradient()},m.prototype.createRadialGradient=function(){return this.createLinearGradient()};var W=function(E,z,ee,le,ue,ve,Pe,ce,Ye){for(var Ke=he.call(this,ee,le,ue,ve),Ue=0;Ue<Ke.length;Ue++){var it=Ke[Ue];Ue===0&&(Ye?B.call(this,it.x1+E,it.y1+z):J.call(this,it.x1+E,it.y1+z)),Ne.call(this,E,z,it.x2,it.y2,it.x3,it.y3,it.x4,it.y4)}ce?oe.call(this):ge.call(this,Pe)},ge=function(E){switch(E){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f")}},oe=function(){this.pdf.clip(),this.pdf.discardPath()},B=function(E,z){this.pdf.internal.out(n(E)+" "+r(z)+" m")},T=function(E){var z;switch(E.align){case"right":case"end":z="right";break;case"center":z="center";break;case"left":case"start":default:z="left"}var ee=this.pdf.getTextDimensions(E.text),le=U.call(this,E.y),ue=te.call(this,le)-ee.h,ve=this.ctx.transform.applyToPoint(new o(E.x,le)),Pe=this.ctx.transform.decompose(),ce=new c;ce=(ce=(ce=ce.multiply(Pe.translate)).multiply(Pe.skew)).multiply(Pe.scale);for(var Ye,Ke,Ue,it=this.ctx.transform.applyToRectangle(new l(E.x,le,ee.w,ee.h)),It=ce.applyToRectangle(new l(E.x,ue,ee.w,ee.h)),qe=P.call(this,It),re=[],zt=0;zt<qe.length;zt+=1)re.indexOf(qe[zt])===-1&&re.push(qe[zt]);if(M(re),this.autoPaging)for(var X=re[0],ne=re[re.length-1],fe=X;fe<ne+1;fe++){this.pdf.setPage(fe);var Re=fe===1?this.posY+this.margin[0]:this.margin[0],Oe=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Fe=this.pdf.internal.pageSize.height-this.margin[2],et=Fe-this.margin[0],yt=this.pdf.internal.pageSize.width-this.margin[1],Pt=yt-this.margin[3],Lt=fe===1?0:Oe+(fe-2)*et;if(this.ctx.clip_path.length!==0){var an=this.path;Ye=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=_(Ye,this.posX+this.margin[3],-1*Lt+Re),Y.call(this,"fill",!0),this.path=an}var Ot=_([JSON.parse(JSON.stringify(It))],this.posX+this.margin[3],-Lt+Re+this.ctx.prevPageLastElemOffset)[0];E.scale>=.01&&(Ke=this.pdf.internal.getFontSize(),this.pdf.setFontSize(Ke*E.scale),Ue=this.lineWidth,this.lineWidth=Ue*E.scale);var Qt=this.autoPaging!=="text";if(Qt||Ot.y+Ot.h<=Fe){if(Qt||Ot.y>=Re&&Ot.x<=yt){var ft=Qt?E.text:this.pdf.splitTextToSize(E.text,E.maxWidth||yt-Ot.x)[0],In=_([JSON.parse(JSON.stringify(it))],this.posX+this.margin[3],-Lt+Re+this.ctx.prevPageLastElemOffset)[0],on=Qt&&(fe>X||fe<ne)&&j.call(this);on&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Pt,et,null).clip().discardPath()),this.pdf.text(ft,In.x,In.y,{angle:E.angle,align:z,renderingMode:E.renderingMode}),on&&this.pdf.restoreGraphicsState()}}else Ot.y<Fe&&(this.ctx.prevPageLastElemOffset+=Fe-Ot.y);E.scale>=.01&&(this.pdf.setFontSize(Ke),this.lineWidth=Ue)}else E.scale>=.01&&(Ke=this.pdf.internal.getFontSize(),this.pdf.setFontSize(Ke*E.scale),Ue=this.lineWidth,this.lineWidth=Ue*E.scale),this.pdf.text(E.text,ve.x+this.posX,ve.y+this.posY,{angle:E.angle,align:z,renderingMode:E.renderingMode,maxWidth:E.maxWidth}),E.scale>=.01&&(this.pdf.setFontSize(Ke),this.lineWidth=Ue)},J=function(E,z,ee,le){ee=ee||0,le=le||0,this.pdf.internal.out(n(E+ee)+" "+r(z+le)+" l")},Z=function(E,z,ee){return this.pdf.lines(E,z,ee,null,null)},Ne=function(E,z,ee,le,ue,ve,Pe,ce){this.pdf.internal.out([e(s(ee+E)),e(i(le+z)),e(s(ue+E)),e(i(ve+z)),e(s(Pe+E)),e(i(ce+z)),"c"].join(" "))},he=function(E,z,ee,le){for(var ue=2*Math.PI,ve=Math.PI/2;z>ee;)z-=ue;var Pe=Math.abs(ee-z);Pe<ue&&le&&(Pe=ue-Pe);for(var ce=[],Ye=le?-1:1,Ke=z;Pe>1e-5;){var Ue=Ke+Ye*Math.min(Pe,ve);ce.push(ae.call(this,E,Ke,Ue)),Pe-=Math.abs(Ue-Ke),Ke=Ue}return ce},ae=function(E,z,ee){var le=(ee-z)/2,ue=E*Math.cos(le),ve=E*Math.sin(le),Pe=ue,ce=-ve,Ye=Pe*Pe+ce*ce,Ke=Ye+Pe*ue+ce*ve,Ue=4/3*(Math.sqrt(2*Ye*Ke)-Ke)/(Pe*ve-ce*ue),it=Pe-Ue*ce,It=ce+Ue*Pe,qe=it,re=-It,zt=le+z,X=Math.cos(zt),ne=Math.sin(zt);return{x1:E*Math.cos(z),y1:E*Math.sin(z),x2:it*X-It*ne,y2:it*ne+It*X,x3:qe*X-re*ne,y3:qe*ne+re*X,x4:E*Math.cos(ee),y4:E*Math.sin(ee)}},G=function(E){return 180*E/Math.PI},xe=function(E,z,ee,le,ue,ve){var Pe=E+.5*(ee-E),ce=z+.5*(le-z),Ye=ue+.5*(ee-ue),Ke=ve+.5*(le-ve),Ue=Math.min(E,ue,Pe,Ye),it=Math.max(E,ue,Pe,Ye),It=Math.min(z,ve,ce,Ke),qe=Math.max(z,ve,ce,Ke);return new l(Ue,It,it-Ue,qe-It)},De=function(E,z,ee,le,ue,ve,Pe,ce){var Ye,Ke,Ue,it,It,qe,re,zt,X,ne,fe,Re,Oe,Fe,et=ee-E,yt=le-z,Pt=ue-ee,Lt=ve-le,an=Pe-ue,Ot=ce-ve;for(Ke=0;Ke<41;Ke++)X=(re=(Ue=E+(Ye=Ke/40)*et)+Ye*((It=ee+Ye*Pt)-Ue))+Ye*(It+Ye*(ue+Ye*an-It)-re),ne=(zt=(it=z+Ye*yt)+Ye*((qe=le+Ye*Lt)-it))+Ye*(qe+Ye*(ve+Ye*Ot-qe)-zt),Ke==0?(fe=X,Re=ne,Oe=X,Fe=ne):(fe=Math.min(fe,X),Re=Math.min(Re,ne),Oe=Math.max(Oe,X),Fe=Math.max(Fe,ne));return new l(Math.round(fe),Math.round(Re),Math.round(Oe-fe),Math.round(Fe-Re))},$e=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var E,z,ee=(E=this.ctx.lineDash,z=this.ctx.lineDashOffset,JSON.stringify({lineDash:E,lineDashOffset:z}));this.prevLineDash!==ee&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=ee)}}})(Zt.API),function(t){var e=function(i){var o,l,c,d,f,m,g,v,N,j;for(l=[],c=0,d=(i+=o="\0\0\0\0".slice(i.length%4||4)).length;d>c;c+=4)(f=(i.charCodeAt(c)<<24)+(i.charCodeAt(c+1)<<16)+(i.charCodeAt(c+2)<<8)+i.charCodeAt(c+3))!==0?(m=(f=((f=((f=((f=(f-(j=f%85))/85)-(N=f%85))/85)-(v=f%85))/85)-(g=f%85))/85)%85,l.push(m+33,g+33,v+33,N+33,j+33)):l.push(122);return function(P,k){for(var _=k;_>0;_--)P.pop()}(l,o.length),String.fromCharCode.apply(String,l)+"~>"},n=function(i){var o,l,c,d,f,m=String,g="length",v=255,N="charCodeAt",j="slice",P="replace";for(i[j](-2),i=i[j](0,-2)[P](/\s/g,"")[P]("z","!!!!!"),c=[],d=0,f=(i+=o="uuuuu"[j](i[g]%5||5))[g];f>d;d+=5)l=52200625*(i[N](d)-33)+614125*(i[N](d+1)-33)+7225*(i[N](d+2)-33)+85*(i[N](d+3)-33)+(i[N](d+4)-33),c.push(v&l>>24,v&l>>16,v&l>>8,v&l);return function(k,_){for(var M=_;M>0;M--)k.pop()}(c,o[g]),m.fromCharCode.apply(m,c)},r=function(i){var o=new RegExp(/^([0-9A-Fa-f]{2})+$/);if((i=i.replace(/\s/g,"")).indexOf(">")!==-1&&(i=i.substr(0,i.indexOf(">"))),i.length%2&&(i+="0"),o.test(i)===!1)return"";for(var l="",c=0;c<i.length;c+=2)l+=String.fromCharCode("0x"+(i[c]+i[c+1]));return l},s=function(i){for(var o=new Uint8Array(i.length),l=i.length;l--;)o[l]=i.charCodeAt(l);return i=(o=qm(o)).reduce(function(c,d){return c+String.fromCharCode(d)},"")};t.processDataByFilters=function(i,o){var l=0,c=i||"",d=[];for(typeof(o=o||[])=="string"&&(o=[o]),l=0;l<o.length;l+=1)switch(o[l]){case"ASCII85Decode":case"/ASCII85Decode":c=n(c),d.push("/ASCII85Encode");break;case"ASCII85Encode":case"/ASCII85Encode":c=e(c),d.push("/ASCII85Decode");break;case"ASCIIHexDecode":case"/ASCIIHexDecode":c=r(c),d.push("/ASCIIHexEncode");break;case"ASCIIHexEncode":case"/ASCIIHexEncode":c=c.split("").map(function(f){return("0"+f.charCodeAt().toString(16)).slice(-2)}).join("")+">",d.push("/ASCIIHexDecode");break;case"FlateEncode":case"/FlateEncode":c=s(c),d.push("/FlateDecode");break;default:throw new Error('The filter: "'+o[l]+'" is not implemented')}return{data:c,reverseChain:d.reverse().join(" ")}}}(Zt.API),function(t){t.loadFile=function(e,n,r){return function(s,i,o){i=i!==!1,o=typeof o=="function"?o:function(){};var l=void 0;try{l=function(c,d,f){var m=new XMLHttpRequest,g=0,v=function(N){var j=N.length,P=[],k=String.fromCharCode;for(g=0;g<j;g+=1)P.push(k(255&N.charCodeAt(g)));return P.join("")};if(m.open("GET",c,!d),m.overrideMimeType("text/plain; charset=x-user-defined"),d===!1&&(m.onload=function(){m.status===200?f(v(this.responseText)):f(void 0)}),m.send(null),d&&m.status===200)return v(m.responseText)}(s,i,o)}catch{}return l}(e,n,r)},t.loadImageFile=t.loadFile}(Zt.API),function(t){function e(){return(Xt.html2canvas?Promise.resolve(Xt.html2canvas):eo(()=>import("./html2canvas.esm-CBrSDip1.js"),[])).catch(function(o){return Promise.reject(new Error("Could not load html2canvas: "+o))}).then(function(o){return o.default?o.default:o})}function n(){return(Xt.DOMPurify?Promise.resolve(Xt.DOMPurify):eo(()=>import("./purify.es-BFmuJLeH.js"),[])).catch(function(o){return Promise.reject(new Error("Could not load dompurify: "+o))}).then(function(o){return o.default?o.default:o})}var r=function(o){var l=Fn(o);return l==="undefined"?"undefined":l==="string"||o instanceof String?"string":l==="number"||o instanceof Number?"number":l==="function"||o instanceof Function?"function":o&&o.constructor===Array?"array":o&&o.nodeType===1?"element":l==="object"?"object":"unknown"},s=function(o,l){var c=document.createElement(o);for(var d in l.className&&(c.className=l.className),l.innerHTML&&l.dompurify&&(c.innerHTML=l.dompurify.sanitize(l.innerHTML)),l.style)c.style[d]=l.style[d];return c},i=function o(l){var c=Object.assign(o.convert(Promise.resolve()),JSON.parse(JSON.stringify(o.template))),d=o.convert(Promise.resolve(),c);return d=(d=d.setProgress(1,o,1,[o])).set(l)};(i.prototype=Object.create(Promise.prototype)).constructor=i,i.convert=function(o,l){return o.__proto__=l||i.prototype,o},i.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"}},i.prototype.from=function(o,l){return this.then(function(){switch(l=l||function(c){switch(r(c)){case"string":return"string";case"element":return c.nodeName.toLowerCase()==="canvas"?"canvas":"element";default:return"unknown"}}(o)){case"string":return this.then(n).then(function(c){return this.set({src:s("div",{innerHTML:o,dompurify:c})})});case"element":return this.set({src:o});case"canvas":return this.set({canvas:o});case"img":return this.set({img:o});default:return this.error("Unknown source type.")}})},i.prototype.to=function(o){switch(o){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.")}},i.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 o={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},l=function c(d,f){for(var m=d.nodeType===3?document.createTextNode(d.nodeValue):d.cloneNode(!1),g=d.firstChild;g;g=g.nextSibling)f!==!0&&g.nodeType===1&&g.nodeName==="SCRIPT"||m.appendChild(c(g,f));return d.nodeType===1&&(d.nodeName==="CANVAS"?(m.width=d.width,m.height=d.height,m.getContext("2d").drawImage(d,0,0)):d.nodeName!=="TEXTAREA"&&d.nodeName!=="SELECT"||(m.value=d.value),m.addEventListener("load",function(){m.scrollTop=d.scrollTop,m.scrollLeft=d.scrollLeft},!0)),m}(this.prop.src,this.opt.html2canvas.javascriptEnabled);l.tagName==="BODY"&&(o.height=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)+"px"),this.prop.overlay=s("div",{className:"html2pdf__overlay",style:{position:"fixed",overflow:"hidden",zIndex:1e3,left:"-100000px",right:0,bottom:0,top:0}}),this.prop.container=s("div",{className:"html2pdf__container",style:o}),this.prop.container.appendChild(l),this.prop.container.firstChild.appendChild(s("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"})},i.prototype.toCanvas=function(){var o=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(o).then(e).then(function(l){var c=Object.assign({},this.opt.html2canvas);return delete c.onrendered,l(this.prop.container,c)}).then(function(l){(this.opt.html2canvas.onrendered||function(){})(l),this.prop.canvas=l,document.body.removeChild(this.prop.overlay)})},i.prototype.toContext2d=function(){var o=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(o).then(e).then(function(l){var c=this.opt.jsPDF,d=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,m=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 m.onrendered,c.context2d.autoPaging=this.opt.autoPaging===void 0||this.opt.autoPaging,c.context2d.posX=this.opt.x,c.context2d.posY=this.opt.y,c.context2d.margin=this.opt.margin,c.context2d.fontFaces=d,d)for(var g=0;g<d.length;++g){var v=d[g],N=v.src.find(function(j){return j.format==="truetype"});N&&c.addFont(N.url,v.ref.name,v.ref.style)}return m.windowHeight=m.windowHeight||0,m.windowHeight=m.windowHeight==0?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):m.windowHeight,c.context2d.save(!0),l(this.prop.container,m)}).then(function(l){this.opt.jsPDF.context2d.restore(!0),(this.opt.html2canvas.onrendered||function(){})(l),this.prop.canvas=l,document.body.removeChild(this.prop.overlay)})},i.prototype.toImg=function(){return this.thenList([function(){return this.prop.canvas||this.toCanvas()}]).then(function(){var o=this.prop.canvas.toDataURL("image/"+this.opt.image.type,this.opt.image.quality);this.prop.img=document.createElement("img"),this.prop.img.src=o})},i.prototype.toPdf=function(){return this.thenList([function(){return this.toContext2d()}]).then(function(){this.prop.pdf=this.prop.pdf||this.opt.jsPDF})},i.prototype.output=function(o,l,c){return(c=c||"pdf").toLowerCase()==="img"||c.toLowerCase()==="image"?this.outputImg(o,l):this.outputPdf(o,l)},i.prototype.outputPdf=function(o,l){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){return this.prop.pdf.output(o,l)})},i.prototype.outputImg=function(o){return this.thenList([function(){return this.prop.img||this.toImg()}]).then(function(){switch(o){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 "'+o+'" is not supported.'}})},i.prototype.save=function(o){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).set(o?{filename:o}:null).then(function(){this.prop.pdf.save(this.opt.filename)})},i.prototype.doCallback=function(){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){this.prop.callback(this.prop.pdf)})},i.prototype.set=function(o){if(r(o)!=="object")return this;var l=Object.keys(o||{}).map(function(c){if(c in i.template.prop)return function(){this.prop[c]=o[c]};switch(c){case"margin":return this.setMargin.bind(this,o.margin);case"jsPDF":return function(){return this.opt.jsPDF=o.jsPDF,this.setPageSize()};case"pageSize":return this.setPageSize.bind(this,o.pageSize);default:return function(){this.opt[c]=o[c]}}},this);return this.then(function(){return this.thenList(l)})},i.prototype.get=function(o,l){return this.then(function(){var c=o in i.template.prop?this.prop[o]:this.opt[o];return l?l(c):c})},i.prototype.setMargin=function(o){return this.then(function(){switch(r(o)){case"number":o=[o,o,o,o];case"array":if(o.length===2&&(o=[o[0],o[1],o[0],o[1]]),o.length===4)break;default:return this.error("Invalid margin array.")}this.opt.margin=o}).then(this.setPageSize)},i.prototype.setPageSize=function(o){function l(c,d){return Math.floor(c*d/72*96)}return this.then(function(){(o=o||Zt.getPageSize(this.opt.jsPDF)).hasOwnProperty("inner")||(o.inner={width:o.width-this.opt.margin[1]-this.opt.margin[3],height:o.height-this.opt.margin[0]-this.opt.margin[2]},o.inner.px={width:l(o.inner.width,o.k),height:l(o.inner.height,o.k)},o.inner.ratio=o.inner.height/o.inner.width),this.prop.pageSize=o})},i.prototype.setProgress=function(o,l,c,d){return o!=null&&(this.progress.val=o),l!=null&&(this.progress.state=l),c!=null&&(this.progress.n=c),d!=null&&(this.progress.stack=d),this.progress.ratio=this.progress.val/this.progress.state,this},i.prototype.updateProgress=function(o,l,c,d){return this.setProgress(o?this.progress.val+o:null,l||null,c?this.progress.n+c:null,d?this.progress.stack.concat(d):null)},i.prototype.then=function(o,l){var c=this;return this.thenCore(o,l,function(d,f){return c.updateProgress(null,null,1,[d]),Promise.prototype.then.call(this,function(m){return c.updateProgress(null,d),m}).then(d,f).then(function(m){return c.updateProgress(1),m})})},i.prototype.thenCore=function(o,l,c){c=c||Promise.prototype.then,o&&(o=o.bind(this)),l&&(l=l.bind(this));var d=Promise.toString().indexOf("[native code]")!==-1&&Promise.name==="Promise"?this:i.convert(Object.assign({},this),Promise.prototype),f=c.call(d,o,l);return i.convert(f,this.__proto__)},i.prototype.thenExternal=function(o,l){return Promise.prototype.then.call(this,o,l)},i.prototype.thenList=function(o){var l=this;return o.forEach(function(c){l=l.thenCore(c)}),l},i.prototype.catch=function(o){o&&(o=o.bind(this));var l=Promise.prototype.catch.call(this,o);return i.convert(l,this)},i.prototype.catchExternal=function(o){return Promise.prototype.catch.call(this,o)},i.prototype.error=function(o){return this.then(function(){throw new Error(o)})},i.prototype.using=i.prototype.set,i.prototype.saveAs=i.prototype.save,i.prototype.export=i.prototype.output,i.prototype.run=i.prototype.then,Zt.getPageSize=function(o,l,c){if(Fn(o)==="object"){var d=o;o=d.orientation,l=d.unit||l,c=d.format||c}l=l||"mm",c=c||"a4",o=(""+(o||"P")).toLowerCase();var f,m=(""+c).toLowerCase(),g={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(l){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: "+l}var v,N=0,j=0;if(g.hasOwnProperty(m))N=g[m][1]/f,j=g[m][0]/f;else try{N=c[1],j=c[0]}catch{throw new Error("Invalid format: "+c)}if(o==="p"||o==="portrait")o="p",j>N&&(v=j,j=N,N=v);else{if(o!=="l"&&o!=="landscape")throw"Invalid orientation: "+o;o="l",N>j&&(v=j,j=N,N=v)}return{width:j,height:N,unit:l,k:f,orientation:o}},t.html=function(o,l){(l=l||{}).callback=l.callback||function(){},l.html2canvas=l.html2canvas||{},l.html2canvas.canvas=l.html2canvas.canvas||this.canvas,l.jsPDF=l.jsPDF||this,l.fontFaces=l.fontFaces?l.fontFaces.map(Km):null;var c=new i(l);return l.worker?c:c.from(o).doCallback()}}(Zt.API),Zt.API.addJS=function(t){return Zy=t,this.internal.events.subscribe("postPutResources",function(){Wd=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(Wd+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),Yy=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+Zy+")"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){Wd!==void 0&&Yy!==void 0&&this.internal.out("/Names <</JavaScript "+Wd+" 0 R>>")}),this},function(t){var e;t.events.push(["postPutResources",function(){var n=this,r=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var s=n.outline.render().split(/\r\n/),i=0;i<s.length;i++){var o=s[i],l=r.exec(o);if(l!=null){var c=l[1];n.internal.newObjectDeferredBegin(c,!1)}n.internal.write(o)}if(this.outline.createNamedDestinations){var d=this.internal.pages.length,f=[];for(i=0;i<d;i++){var m=n.internal.newObject();f.push(m);var g=n.internal.getPageInfo(i+1);n.internal.write("<< /D["+g.objId+" 0 R /XYZ null null null]>> endobj")}var v=n.internal.newObject();for(n.internal.write("<< /Names [ "),i=0;i<f.length;i++)n.internal.write("(page_"+(i+1)+")"+f[i]+" 0 R");n.internal.write(" ] >>","endobj"),e=n.internal.newObject(),n.internal.write("<< /Dests "+v+" 0 R"),n.internal.write(">>","endobj")}}]),t.events.push(["putCatalog",function(){this.outline.root.children.length>0&&(this.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&this.internal.write("/Names "+e+" 0 R"))}]),t.events.push(["initialized",function(){var n=this;n.outline={createNamedDestinations:!1,root:{children:[]}},n.outline.add=function(r,s,i){var o={title:s,options:i,children:[]};return r==null&&(r=this.root),r.children.push(o),o},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 s=0;s<r.children.length;s++)this.genIds_r(r.children[s])},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 s=this.ctx.pdf.internal.getVerticalCoordinateString,i=0;i<r.children.length;i++){var o=r.children[i];this.objStart(o),this.line("/Title "+this.makeString(o.title)),this.line("/Parent "+this.makeRef(r)),i>0&&this.line("/Prev "+this.makeRef(r.children[i-1])),i<r.children.length-1&&this.line("/Next "+this.makeRef(r.children[i+1])),o.children.length>0&&(this.line("/First "+this.makeRef(o.children[0])),this.line("/Last "+this.makeRef(o.children[o.children.length-1])));var l=this.count=this.count_r({count:0},o);if(l>0&&this.line("/Count "+l),o.options&&o.options.pageNumber){var c=n.internal.getPageInfo(o.options.pageNumber);this.line("/Dest ["+c.objId+" 0 R /XYZ 0 "+s(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
`},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
`+r.id+` 0 obj\r
<<\r
`},n.outline.objEnd=function(){this.ctx.val+=`>> \r
endobj\r
`},n.outline.count_r=function(r,s){for(var i=0;i<s.children.length;i++)r.count++,this.count_r(r,s.children[i]);return r.count}}])}(Zt.API),function(t){var e=[192,193,194,195,196,197,198,199];t.processJPEG=function(n,r,s,i,o,l){var c,d=this.decode.DCT_DECODE,f=null;if(typeof n=="string"||this.__addimage__.isArrayBuffer(n)||this.__addimage__.isArrayBufferView(n)){switch(n=o||n,n=this.__addimage__.isArrayBuffer(n)?new Uint8Array(n):n,(c=function(m){for(var g,v=256*m.charCodeAt(4)+m.charCodeAt(5),N=m.length,j={width:0,height:0,numcomponents:1},P=4;P<N;P+=2){if(P+=v,e.indexOf(m.charCodeAt(P+1))!==-1){g=256*m.charCodeAt(P+5)+m.charCodeAt(P+6),j={width:256*m.charCodeAt(P+7)+m.charCodeAt(P+8),height:g,numcomponents:m.charCodeAt(P+9)};break}v=256*m.charCodeAt(P+2)+m.charCodeAt(P+3)}return j}(n=this.__addimage__.isArrayBufferView(n)?this.__addimage__.arrayBufferToBinaryString(n):n)).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}f={data:n,width:c.width,height:c.height,colorSpace:l,bitsPerComponent:8,filter:d,index:r,alias:s}}return f}}(Zt.API);var lc,$d,Xy,Jy,Qy,T9=function(){var t,e,n;function r(i){var o,l,c,d,f,m,g,v,N,j,P,k,_,M;for(this.data=i,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},m=null;;){switch(o=this.readUInt32(),N=(function(){var $,Y;for(Y=[],$=0;$<4;++$)Y.push(String.fromCharCode(this.data[this.pos++]));return Y}).call(this).join("")){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(o);break;case"fcTL":m&&this.animation.frames.push(m),this.pos+=4,m={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},f=this.readUInt16(),d=this.readUInt16()||100,m.delay=1e3*f/d,m.disposeOp=this.data[this.pos++],m.blendOp=this.data[this.pos++],m.data=[];break;case"IDAT":case"fdAT":for(N==="fdAT"&&(this.pos+=4,o-=4),i=(m!=null?m.data:void 0)||this.imgData,k=0;0<=o?k<o:k>o;0<=o?++k:--k)i.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(c=this.palette.length/3,this.transparency.indexed=this.read(o),this.transparency.indexed.length>c)throw new Error("More transparent colors than palette size");if((j=c-this.transparency.indexed.length)>0)for(_=0;0<=j?_<j:_>j;0<=j?++_:--_)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(o)[0];break;case 2:this.transparency.rgb=this.read(o)}break;case"tEXt":g=(P=this.read(o)).indexOf(0),v=String.fromCharCode.apply(String,P.slice(0,g)),this.text[v]=String.fromCharCode.apply(String,P.slice(g+1));break;case"IEND":return m&&this.animation.frames.push(m),this.colors=(function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}).call(this),this.hasAlphaChannel=(M=this.colorType)===4||M===6,l=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*l,this.colorSpace=(function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}).call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=o}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}r.prototype.read=function(i){var o,l;for(l=[],o=0;0<=i?o<i:o>i;0<=i?++o:--o)l.push(this.data[this.pos++]);return l},r.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},r.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},r.prototype.decodePixels=function(i){var o=this.pixelBitlength/8,l=new Uint8Array(this.width*this.height*o),c=0,d=this;if(i==null&&(i=this.imgData),i.length===0)return new Uint8Array(0);function f(m,g,v,N){var j,P,k,_,M,$,Y,U,te,W,ge,oe,B,T,J,Z,Ne,he,ae,G,xe,De=Math.ceil((d.width-m)/v),$e=Math.ceil((d.height-g)/N),E=d.width==De&&d.height==$e;for(T=o*De,oe=E?l:new Uint8Array(T*$e),$=i.length,B=0,P=0;B<$e&&c<$;){switch(i[c++]){case 0:for(_=Ne=0;Ne<T;_=Ne+=1)oe[P++]=i[c++];break;case 1:for(_=he=0;he<T;_=he+=1)j=i[c++],M=_<o?0:oe[P-o],oe[P++]=(j+M)%256;break;case 2:for(_=ae=0;ae<T;_=ae+=1)j=i[c++],k=(_-_%o)/o,J=B&&oe[(B-1)*T+k*o+_%o],oe[P++]=(J+j)%256;break;case 3:for(_=G=0;G<T;_=G+=1)j=i[c++],k=(_-_%o)/o,M=_<o?0:oe[P-o],J=B&&oe[(B-1)*T+k*o+_%o],oe[P++]=(j+Math.floor((M+J)/2))%256;break;case 4:for(_=xe=0;xe<T;_=xe+=1)j=i[c++],k=(_-_%o)/o,M=_<o?0:oe[P-o],B===0?J=Z=0:(J=oe[(B-1)*T+k*o+_%o],Z=k&&oe[(B-1)*T+(k-1)*o+_%o]),Y=M+J-Z,U=Math.abs(Y-M),W=Math.abs(Y-J),ge=Math.abs(Y-Z),te=U<=W&&U<=ge?M:W<=ge?J:Z,oe[P++]=(j+te)%256;break;default:throw new Error("Invalid filter algorithm: "+i[c-1])}if(!E){var z=((g+B*N)*d.width+m)*o,ee=B*T;for(_=0;_<De;_+=1){for(var le=0;le<o;le+=1)l[z++]=oe[ee++];z+=(v-1)*o}}B++}}return i=l9(i),d.interlaceMethod==1?(f(0,0,8,8),f(4,0,8,8),f(0,4,4,8),f(2,0,4,4),f(0,2,2,4),f(1,0,2,2),f(0,1,1,2)):f(0,0,1,1),l},r.prototype.decodePalette=function(){var i,o,l,c,d,f,m,g,v;for(l=this.palette,f=this.transparency.indexed||[],d=new Uint8Array((f.length||0)+l.length),c=0,i=0,o=m=0,g=l.length;m<g;o=m+=3)d[c++]=l[o],d[c++]=l[o+1],d[c++]=l[o+2],d[c++]=(v=f[i++])!=null?v:255;return d},r.prototype.copyToImageData=function(i,o){var l,c,d,f,m,g,v,N,j,P,k;if(c=this.colors,j=null,l=this.hasAlphaChannel,this.palette.length&&(j=(k=this._decodedPalette)!=null?k:this._decodedPalette=this.decodePalette(),c=4,l=!0),N=(d=i.data||i).length,m=j||o,f=g=0,c===1)for(;f<N;)v=j?4*o[f/4]:g,P=m[v++],d[f++]=P,d[f++]=P,d[f++]=P,d[f++]=l?m[v++]:255,g=v;else for(;f<N;)v=j?4*o[f/4]:g,d[f++]=m[v++],d[f++]=m[v++],d[f++]=m[v++],d[f++]=l?m[v++]:255,g=v},r.prototype.decode=function(){var i;return i=new Uint8Array(this.width*this.height*4),this.copyToImageData(i,this.decodePixels()),i};var s=function(){if(Object.prototype.toString.call(Xt)==="[object Window]"){try{e=Xt.document.createElement("canvas"),n=e.getContext("2d")}catch{return!1}return!0}return!1};return s(),t=function(i){var o;if(s()===!0)return n.width=i.width,n.height=i.height,n.clearRect(0,0,i.width,i.height),n.putImageData(i,0,0),(o=new Image).src=e.toDataURL(),o;throw new Error("This method requires a Browser with Canvas-capability.")},r.prototype.decodeFrames=function(i){var o,l,c,d,f,m,g,v;if(this.animation){for(v=[],l=f=0,m=(g=this.animation.frames).length;f<m;l=++f)o=g[l],c=i.createImageData(o.width,o.height),d=this.decodePixels(new Uint8Array(o.data)),this.copyToImageData(c,d),o.imageData=c,v.push(o.image=t(c));return v}},r.prototype.renderFrame=function(i,o){var l,c,d;return l=(c=this.animation.frames)[o],d=c[o-1],o===0&&i.clearRect(0,0,this.width,this.height),(d!=null?d.disposeOp:void 0)===1?i.clearRect(d.xOffset,d.yOffset,d.width,d.height):(d!=null?d.disposeOp:void 0)===2&&i.putImageData(d.imageData,d.xOffset,d.yOffset),l.blendOp===0&&i.clearRect(l.xOffset,l.yOffset,l.width,l.height),i.drawImage(l.image,l.xOffset,l.yOffset)},r.prototype.animate=function(i){var o,l,c,d,f,m,g=this;return l=0,m=this.animation,d=m.numFrames,c=m.frames,f=m.numPlays,(o=function(){var v,N;if(v=l++%d,N=c[v],g.renderFrame(i,v),d>1&&l/d<f)return g.animation._timeout=setTimeout(o,N.delay)})()},r.prototype.stopAnimation=function(){var i;return clearTimeout((i=this.animation)!=null?i._timeout:void 0)},r.prototype.render=function(i){var o,l;return i._png&&i._png.stopAnimation(),i._png=this,i.width=this.width,i.height=this.height,o=i.getContext("2d"),this.animation?(this.decodeFrames(o),this.animate(o)):(l=o.createImageData(this.width,this.height),this.copyToImageData(l,this.decodePixels()),o.putImageData(l,0,0))},r}();/**
* @license
*
* Copyright (c) 2014 James Robb, https://github.com/jamesbrobb
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================
*//**
* @license
* (c) Dean McNamee <dean@gmail.com>, 2013.
*
* https://github.com/deanm/omggif
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* omggif is a JavaScript implementation of a GIF 89a encoder and decoder,
* including animation and compression. It does not rely on any specific
* underlying system, so should run in the browser, Node, or Plask.
*/function L9(t){var e=0;if(t[e++]!==71||t[e++]!==73||t[e++]!==70||t[e++]!==56||(t[e++]+1&253)!=56||t[e++]!==97)throw new Error("Invalid GIF 87a/89a header.");var n=t[e++]|t[e++]<<8,r=t[e++]|t[e++]<<8,s=t[e++],i=s>>7,o=1<<(7&s)+1;t[e++],t[e++];var l=null,c=null;i&&(l=e,c=o,e+=3*o);var d=!0,f=[],m=0,g=null,v=0,N=null;for(this.width=n,this.height=r;d&&e<t.length;)switch(t[e++]){case 33:switch(t[e++]){case 255:if(t[e]!==11||t[e+1]==78&&t[e+2]==69&&t[e+3]==84&&t[e+4]==83&&t[e+5]==67&&t[e+6]==65&&t[e+7]==80&&t[e+8]==69&&t[e+9]==50&&t[e+10]==46&&t[e+11]==48&&t[e+12]==3&&t[e+13]==1&&t[e+16]==0)e+=14,N=t[e++]|t[e++]<<8,e++;else for(e+=12;;){if(!((B=t[e++])>=0))throw Error("Invalid block size");if(B===0)break;e+=B}break;case 249:if(t[e++]!==4||t[e+4]!==0)throw new Error("Invalid graphics extension block.");var j=t[e++];m=t[e++]|t[e++]<<8,g=t[e++],!(1&j)&&(g=null),v=j>>2&7,e++;break;case 254:for(;;){if(!((B=t[e++])>=0))throw Error("Invalid block size");if(B===0)break;e+=B}break;default:throw new Error("Unknown graphic control label: 0x"+t[e-1].toString(16))}break;case 44:var P=t[e++]|t[e++]<<8,k=t[e++]|t[e++]<<8,_=t[e++]|t[e++]<<8,M=t[e++]|t[e++]<<8,$=t[e++],Y=$>>6&1,U=1<<(7&$)+1,te=l,W=c,ge=!1;$>>7&&(ge=!0,te=e,W=U,e+=3*U);var oe=e;for(e++;;){var B;if(!((B=t[e++])>=0))throw Error("Invalid block size");if(B===0)break;e+=B}f.push({x:P,y:k,width:_,height:M,has_local_palette:ge,palette_offset:te,palette_size:W,data_offset:oe,data_length:e-oe,transparent_index:g,interlaced:!!Y,delay:m,disposal:v});break;case 59:d=!1;break;default:throw new Error("Unknown gif block: 0x"+t[e-1].toString(16))}this.numFrames=function(){return f.length},this.loopCount=function(){return N},this.frameInfo=function(T){if(T<0||T>=f.length)throw new Error("Frame index out of range.");return f[T]},this.decodeAndBlitFrameBGRA=function(T,J){var Z=this.frameInfo(T),Ne=Z.width*Z.height,he=new Uint8Array(Ne);e2(t,Z.data_offset,he,Ne);var ae=Z.palette_offset,G=Z.transparent_index;G===null&&(G=256);var xe=Z.width,De=n-xe,$e=xe,E=4*(Z.y*n+Z.x),z=4*((Z.y+Z.height)*n+Z.x),ee=E,le=4*De;Z.interlaced===!0&&(le+=4*n*7);for(var ue=8,ve=0,Pe=he.length;ve<Pe;++ve){var ce=he[ve];if($e===0&&($e=xe,(ee+=le)>=z&&(le=4*De+4*n*(ue-1),ee=E+(xe+De)*(ue<<1),ue>>=1)),ce===G)ee+=4;else{var Ye=t[ae+3*ce],Ke=t[ae+3*ce+1],Ue=t[ae+3*ce+2];J[ee++]=Ue,J[ee++]=Ke,J[ee++]=Ye,J[ee++]=255}--$e}},this.decodeAndBlitFrameRGBA=function(T,J){var Z=this.frameInfo(T),Ne=Z.width*Z.height,he=new Uint8Array(Ne);e2(t,Z.data_offset,he,Ne);var ae=Z.palette_offset,G=Z.transparent_index;G===null&&(G=256);var xe=Z.width,De=n-xe,$e=xe,E=4*(Z.y*n+Z.x),z=4*((Z.y+Z.height)*n+Z.x),ee=E,le=4*De;Z.interlaced===!0&&(le+=4*n*7);for(var ue=8,ve=0,Pe=he.length;ve<Pe;++ve){var ce=he[ve];if($e===0&&($e=xe,(ee+=le)>=z&&(le=4*De+4*n*(ue-1),ee=E+(xe+De)*(ue<<1),ue>>=1)),ce===G)ee+=4;else{var Ye=t[ae+3*ce],Ke=t[ae+3*ce+1],Ue=t[ae+3*ce+2];J[ee++]=Ye,J[ee++]=Ke,J[ee++]=Ue,J[ee++]=255}--$e}}}function e2(t,e,n,r){for(var s=t[e++],i=1<<s,o=i+1,l=o+1,c=s+1,d=(1<<c)-1,f=0,m=0,g=0,v=t[e++],N=new Int32Array(4096),j=null;;){for(;f<16&&v!==0;)m|=t[e++]<<f,f+=8,v===1?v=t[e++]:--v;if(f<c)break;var P=m&d;if(m>>=c,f-=c,P!==i){if(P===o)break;for(var k=P<l?P:j,_=0,M=k;M>i;)M=N[M]>>8,++_;var $=M;if(g+_+(k!==P?1:0)>r)return void Wn.log("Warning, gif stream longer than expected.");n[g++]=$;var Y=g+=_;for(k!==P&&(n[g++]=$),M=k;_--;)M=N[M],n[--Y]=255&M,M>>=8;j!==null&&l<4096&&(N[l++]=j<<8|$,l>=d+1&&c<12&&(++c,d=d<<1|1)),j=P}else l=o+1,d=(1<<(c=s+1))-1,j=null}return g!==r&&Wn.log("Warning, gif stream shorter than expected."),n}/**
* @license
Copyright (c) 2008, Adobe Systems Incorporated
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Adobe Systems Incorporated nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/function Fp(t){var e,n,r,s,i,o=Math.floor,l=new Array(64),c=new Array(64),d=new Array(64),f=new Array(64),m=new Array(65535),g=new Array(65535),v=new Array(64),N=new Array(64),j=[],P=0,k=7,_=new Array(64),M=new Array(64),$=new Array(64),Y=new Array(256),U=new Array(2048),te=[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],W=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],ge=[0,1,2,3,4,5,6,7,8,9,10,11],oe=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],B=[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],T=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],J=[0,1,2,3,4,5,6,7,8,9,10,11],Z=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],Ne=[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 he(E,z){for(var ee=0,le=0,ue=new Array,ve=1;ve<=16;ve++){for(var Pe=1;Pe<=E[ve];Pe++)ue[z[le]]=[],ue[z[le]][0]=ee,ue[z[le]][1]=ve,le++,ee++;ee*=2}return ue}function ae(E){for(var z=E[0],ee=E[1]-1;ee>=0;)z&1<<ee&&(P|=1<<k),ee--,--k<0&&(P==255?(G(255),G(0)):G(P),k=7,P=0)}function G(E){j.push(E)}function xe(E){G(E>>8&255),G(255&E)}function De(E,z,ee,le,ue){for(var ve,Pe=ue[0],ce=ue[240],Ye=function(ne,fe){var Re,Oe,Fe,et,yt,Pt,Lt,an,Ot,Qt,ft=0;for(Ot=0;Ot<8;++Ot){Re=ne[ft],Oe=ne[ft+1],Fe=ne[ft+2],et=ne[ft+3],yt=ne[ft+4],Pt=ne[ft+5],Lt=ne[ft+6];var In=Re+(an=ne[ft+7]),on=Re-an,Mr=Oe+Lt,ln=Oe-Lt,lt=Fe+Pt,zr=Fe-Pt,xt=et+yt,gn=et-yt,Ge=In+xt,Hn=In-xt,ir=Mr+lt,An=Mr-lt;ne[ft]=Ge+ir,ne[ft+4]=Ge-ir;var Yt=.707106781*(An+Hn);ne[ft+2]=Hn+Yt,ne[ft+6]=Hn-Yt;var Nn=.382683433*((Ge=gn+zr)-(An=ln+on)),pa=.5411961*Ge+Nn,Er=1.306562965*An+Nn,Xr=.707106781*(ir=zr+ln),Jr=on+Xr,qt=on-Xr;ne[ft+5]=qt+pa,ne[ft+3]=qt-pa,ne[ft+1]=Jr+Er,ne[ft+7]=Jr-Er,ft+=8}for(ft=0,Ot=0;Ot<8;++Ot){Re=ne[ft],Oe=ne[ft+8],Fe=ne[ft+16],et=ne[ft+24],yt=ne[ft+32],Pt=ne[ft+40],Lt=ne[ft+48];var is=Re+(an=ne[ft+56]),wn=Re-an,Sn=Oe+Lt,br=Oe-Lt,Yn=Fe+Pt,Wr=Fe-Pt,li=et+yt,ci=et-yt,Pr=is+li,$r=is-li,Cr=Sn+Yn,bs=Sn-Yn;ne[ft]=Pr+Cr,ne[ft+32]=Pr-Cr;var _s=.707106781*(bs+$r);ne[ft+16]=$r+_s,ne[ft+48]=$r-_s;var Or=.382683433*((Pr=ci+Wr)-(bs=br+wn)),Fi=.5411961*Pr+Or,As=1.306562965*bs+Or,ma=.707106781*(Cr=Wr+br),Bi=wn+ma,Bn=wn-ma;ne[ft+40]=Bn+Fi,ne[ft+24]=Bn-Fi,ne[ft+8]=Bi+As,ne[ft+56]=Bi-As,ft++}for(Ot=0;Ot<64;++Ot)Qt=ne[Ot]*fe[Ot],v[Ot]=Qt>0?Qt+.5|0:Qt-.5|0;return v}(E,z),Ke=0;Ke<64;++Ke)N[te[Ke]]=Ye[Ke];var Ue=N[0]-ee;ee=N[0],Ue==0?ae(le[0]):(ae(le[g[ve=32767+Ue]]),ae(m[ve]));for(var it=63;it>0&&N[it]==0;)it--;if(it==0)return ae(Pe),ee;for(var It,qe=1;qe<=it;){for(var re=qe;N[qe]==0&&qe<=it;)++qe;var zt=qe-re;if(zt>=16){It=zt>>4;for(var X=1;X<=It;++X)ae(ce);zt&=15}ve=32767+N[qe],ae(ue[(zt<<4)+g[ve]]),ae(m[ve]),qe++}return it!=63&&ae(Pe),ee}function $e(E){E=Math.min(Math.max(E,1),100),i!=E&&(function(z){for(var ee=[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],le=0;le<64;le++){var ue=o((ee[le]*z+50)/100);ue=Math.min(Math.max(ue,1),255),l[te[le]]=ue}for(var ve=[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],Pe=0;Pe<64;Pe++){var ce=o((ve[Pe]*z+50)/100);ce=Math.min(Math.max(ce,1),255),c[te[Pe]]=ce}for(var Ye=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],Ke=0,Ue=0;Ue<8;Ue++)for(var it=0;it<8;it++)d[Ke]=1/(l[te[Ke]]*Ye[Ue]*Ye[it]*8),f[Ke]=1/(c[te[Ke]]*Ye[Ue]*Ye[it]*8),Ke++}(E<50?Math.floor(5e3/E):Math.floor(200-2*E)),i=E)}this.encode=function(E,z){z&&$e(z),j=new Array,P=0,k=7,xe(65496),xe(65504),xe(16),G(74),G(70),G(73),G(70),G(0),G(1),G(1),G(0),xe(1),xe(1),G(0),G(0),function(){xe(65499),xe(132),G(0);for(var Oe=0;Oe<64;Oe++)G(l[Oe]);G(1);for(var Fe=0;Fe<64;Fe++)G(c[Fe])}(),function(Oe,Fe){xe(65472),xe(17),G(8),xe(Fe),xe(Oe),G(3),G(1),G(17),G(0),G(2),G(17),G(1),G(3),G(17),G(1)}(E.width,E.height),function(){xe(65476),xe(418),G(0);for(var Oe=0;Oe<16;Oe++)G(W[Oe+1]);for(var Fe=0;Fe<=11;Fe++)G(ge[Fe]);G(16);for(var et=0;et<16;et++)G(oe[et+1]);for(var yt=0;yt<=161;yt++)G(B[yt]);G(1);for(var Pt=0;Pt<16;Pt++)G(T[Pt+1]);for(var Lt=0;Lt<=11;Lt++)G(J[Lt]);G(17);for(var an=0;an<16;an++)G(Z[an+1]);for(var Ot=0;Ot<=161;Ot++)G(Ne[Ot])}(),xe(65498),xe(12),G(3),G(1),G(0),G(2),G(17),G(3),G(17),G(0),G(63),G(0);var ee=0,le=0,ue=0;P=0,k=7,this.encode.displayName="_encode_";for(var ve,Pe,ce,Ye,Ke,Ue,it,It,qe,re=E.data,zt=E.width,X=E.height,ne=4*zt,fe=0;fe<X;){for(ve=0;ve<ne;){for(Ke=ne*fe+ve,it=-1,It=0,qe=0;qe<64;qe++)Ue=Ke+(It=qe>>3)*ne+(it=4*(7&qe)),fe+It>=X&&(Ue-=ne*(fe+1+It-X)),ve+it>=ne&&(Ue-=ve+it-ne+4),Pe=re[Ue++],ce=re[Ue++],Ye=re[Ue++],_[qe]=(U[Pe]+U[ce+256>>0]+U[Ye+512>>0]>>16)-128,M[qe]=(U[Pe+768>>0]+U[ce+1024>>0]+U[Ye+1280>>0]>>16)-128,$[qe]=(U[Pe+1280>>0]+U[ce+1536>>0]+U[Ye+1792>>0]>>16)-128;ee=De(_,d,ee,e,r),le=De(M,f,le,n,s),ue=De($,f,ue,n,s),ve+=32}fe+=8}if(k>=0){var Re=[];Re[1]=k+1,Re[0]=(1<<k+1)-1,ae(Re)}return xe(65497),new Uint8Array(j)},t=t||50,function(){for(var E=String.fromCharCode,z=0;z<256;z++)Y[z]=E(z)}(),e=he(W,ge),n=he(T,J),r=he(oe,B),s=he(Z,Ne),function(){for(var E=1,z=2,ee=1;ee<=15;ee++){for(var le=E;le<z;le++)g[32767+le]=ee,m[32767+le]=[],m[32767+le][1]=ee,m[32767+le][0]=le;for(var ue=-(z-1);ue<=-E;ue++)g[32767+ue]=ee,m[32767+ue]=[],m[32767+ue][1]=ee,m[32767+ue][0]=z-1+ue;E<<=1,z<<=1}}(),function(){for(var E=0;E<256;E++)U[E]=19595*E,U[E+256>>0]=38470*E,U[E+512>>0]=7471*E+32768,U[E+768>>0]=-11059*E,U[E+1024>>0]=-21709*E,U[E+1280>>0]=32768*E+8421375,U[E+1536>>0]=-27439*E,U[E+1792>>0]=-5329*E}(),$e(t)}/**
* @license
* Copyright (c) 2017 Aras Abbasi
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/function ji(t,e){if(this.pos=0,this.buffer=t,this.datav=new DataView(t.buffer),this.is_with_alpha=!!e,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 t2(t){function e(W){if(!W)throw Error("assert :P")}function n(W,ge,oe){for(var B=0;4>B;B++)if(W[ge+B]!=oe.charCodeAt(B))return!0;return!1}function r(W,ge,oe,B,T){for(var J=0;J<T;J++)W[ge+J]=oe[B+J]}function s(W,ge,oe,B){for(var T=0;T<B;T++)W[ge+T]=oe}function i(W){return new Int32Array(W)}function o(W,ge){for(var oe=[],B=0;B<W;B++)oe.push(new ge);return oe}function l(W,ge){var oe=[];return function B(T,J,Z){for(var Ne=Z[J],he=0;he<Ne&&(T.push(Z.length>J+1?[]:new ge),!(Z.length<J+1));he++)B(T[he],J+1,Z)}(oe,0,W),oe}var c=function(){var W=this;function ge(u,p){for(var b=1<<p-1>>>0;u&b;)b>>>=1;return b?(u&b-1)+b:u}function oe(u,p,b,S,D){e(!(S%b));do u[p+(S-=b)]=D;while(0<S)}function B(u,p,b,S,D){if(e(2328>=D),512>=D)var O=i(512);else if((O=i(D))==null)return 0;return function(F,V,q,K,ye,Ie){var Me,Ae,Je=V,ze=1<<q,be=i(16),ke=i(16);for(e(ye!=0),e(K!=null),e(F!=null),e(0<q),Ae=0;Ae<ye;++Ae){if(15<K[Ae])return 0;++be[K[Ae]]}if(be[0]==ye)return 0;for(ke[1]=0,Me=1;15>Me;++Me){if(be[Me]>1<<Me)return 0;ke[Me+1]=ke[Me]+be[Me]}for(Ae=0;Ae<ye;++Ae)Me=K[Ae],0<K[Ae]&&(Ie[ke[Me]++]=Ae);if(ke[15]==1)return(K=new T).g=0,K.value=Ie[0],oe(F,Je,1,ze,K),ze;var Ze,Qe=-1,Xe=ze-1,At=0,wt=1,Wt=1,jt=1<<q;for(Ae=0,Me=1,ye=2;Me<=q;++Me,ye<<=1){if(wt+=Wt<<=1,0>(Wt-=be[Me]))return 0;for(;0<be[Me];--be[Me])(K=new T).g=Me,K.value=Ie[Ae++],oe(F,Je+At,ye,jt,K),At=ge(At,Me)}for(Me=q+1,ye=2;15>=Me;++Me,ye<<=1){if(wt+=Wt<<=1,0>(Wt-=be[Me]))return 0;for(;0<be[Me];--be[Me]){if(K=new T,(At&Xe)!=Qe){for(Je+=jt,Ze=1<<(Qe=Me)-q;15>Qe&&!(0>=(Ze-=be[Qe]));)++Qe,Ze<<=1;ze+=jt=1<<(Ze=Qe-q),F[V+(Qe=At&Xe)].g=Ze+q,F[V+Qe].value=Je-V-Qe}K.g=Me-q,K.value=Ie[Ae++],oe(F,Je+(At>>q),ye,jt,K),At=ge(At,Me)}}return wt!=2*ke[15]-1?0:ze}(u,p,b,S,D,O)}function T(){this.value=this.g=0}function J(){this.value=this.g=0}function Z(){this.G=o(5,T),this.H=i(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=o(mn,J)}function Ne(u,p,b,S){e(u!=null),e(p!=null),e(2147483648>S),u.Ca=254,u.I=0,u.b=-8,u.Ka=0,u.oa=p,u.pa=b,u.Jd=p,u.Yc=b+S,u.Zc=4<=S?b+S-4+1:b,ve(u)}function he(u,p){for(var b=0;0<p--;)b|=ce(u,128)<<p;return b}function ae(u,p){var b=he(u,p);return Pe(u)?-b:b}function G(u,p,b,S){var D,O=0;for(e(u!=null),e(p!=null),e(4294967288>S),u.Sb=S,u.Ra=0,u.u=0,u.h=0,4<S&&(S=4),D=0;D<S;++D)O+=p[b+D]<<8*D;u.Ra=O,u.bb=S,u.oa=p,u.pa=b}function xe(u){for(;8<=u.u&&u.bb<u.Sb;)u.Ra>>>=8,u.Ra+=u.oa[u.pa+u.bb]<<vo-8>>>0,++u.bb,u.u-=8;ee(u)&&(u.h=1,u.u=0)}function De(u,p){if(e(0<=p),!u.h&&p<=Br){var b=z(u)&vi[p];return u.u+=p,xe(u),b}return u.h=1,u.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 E(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function z(u){return u.Ra>>>(u.u&vo-1)>>>0}function ee(u){return e(u.bb<=u.Sb),u.h||u.bb==u.Sb&&u.u>vo}function le(u,p){u.u=p,u.h=ee(u)}function ue(u){u.u>=Da&&(e(u.u>=Da),xe(u))}function ve(u){e(u!=null&&u.oa!=null),u.pa<u.Zc?(u.I=(u.oa[u.pa++]|u.I<<8)>>>0,u.b+=8):(e(u!=null&&u.oa!=null),u.pa<u.Yc?(u.b+=8,u.I=u.oa[u.pa++]|u.I<<8):u.Ka?u.b=0:(u.I<<=8,u.b+=8,u.Ka=1))}function Pe(u){return he(u,1)}function ce(u,p){var b=u.Ca;0>u.b&&ve(u);var S=u.b,D=b*p>>>8,O=(u.I>>>S>D)+0;for(O?(b-=D,u.I-=D+1<<S>>>0):b=D+1,S=b,D=0;256<=S;)D+=8,S>>=8;return S=7^D+es[S],u.b-=S,u.Ca=(b<<S)-1,O}function Ye(u,p,b){u[p+0]=b>>24&255,u[p+1]=b>>16&255,u[p+2]=b>>8&255,u[p+3]=b>>0&255}function Ke(u,p){return u[p+0]<<0|u[p+1]<<8}function Ue(u,p){return Ke(u,p)|u[p+2]<<16}function it(u,p){return Ke(u,p)|Ke(u,p+2)<<16}function It(u,p){var b=1<<p;return e(u!=null),e(0<p),u.X=i(b),u.X==null?0:(u.Mb=32-p,u.Xa=p,1)}function qe(u,p){e(u!=null),e(p!=null),e(u.Xa==p.Xa),r(p.X,0,u.X,0,1<<p.Xa)}function re(){this.X=[],this.Xa=this.Mb=0}function zt(u,p,b,S){e(b!=null),e(S!=null);var D=b[0],O=S[0];return D==0&&(D=(u*O+p/2)/p),O==0&&(O=(p*D+u/2)/u),0>=D||0>=O?0:(b[0]=D,S[0]=O,1)}function X(u,p){return u+(1<<p)-1>>>p}function ne(u,p){return((4278255360&u)+(4278255360&p)>>>0&4278255360)+((16711935&u)+(16711935&p)>>>0&16711935)>>>0}function fe(u,p){W[p]=function(b,S,D,O,F,V,q){var K;for(K=0;K<F;++K){var ye=W[u](V[q+K-1],D,O+K);V[q+K]=ne(b[S+K],ye)}}}function Re(){this.ud=this.hd=this.jd=0}function Oe(u,p){return((4278124286&(u^p))>>>1)+(u&p)>>>0}function Fe(u){return 0<=u&&256>u?u:0>u?0:255<u?255:void 0}function et(u,p){return Fe(u+(u-p+.5>>1))}function yt(u,p,b){return Math.abs(p-b)-Math.abs(u-b)}function Pt(u,p,b,S,D,O,F){for(S=O[F-1],b=0;b<D;++b)O[F+b]=S=ne(u[p+b],S)}function Lt(u,p,b,S,D){var O;for(O=0;O<b;++O){var F=u[p+O],V=F>>8&255,q=16711935&(q=(q=16711935&F)+((V<<16)+V));S[D+O]=(4278255360&F)+q>>>0}}function an(u,p){p.jd=u>>0&255,p.hd=u>>8&255,p.ud=u>>16&255}function Ot(u,p,b,S,D,O){var F;for(F=0;F<S;++F){var V=p[b+F],q=V>>>8,K=V,ye=255&(ye=(ye=V>>>16)+((u.jd<<24>>24)*(q<<24>>24)>>>5));K=255&(K=(K=K+((u.hd<<24>>24)*(q<<24>>24)>>>5))+((u.ud<<24>>24)*(ye<<24>>24)>>>5)),D[O+F]=(4278255360&V)+(ye<<16)+K}}function Qt(u,p,b,S,D){W[p]=function(O,F,V,q,K,ye,Ie,Me,Ae){for(q=Ie;q<Me;++q)for(Ie=0;Ie<Ae;++Ie)K[ye++]=D(V[S(O[F++])])},W[u]=function(O,F,V,q,K,ye,Ie){var Me=8>>O.b,Ae=O.Ea,Je=O.K[0],ze=O.w;if(8>Me)for(O=(1<<O.b)-1,ze=(1<<Me)-1;F<V;++F){var be,ke=0;for(be=0;be<Ae;++be)be&O||(ke=S(q[K++])),ye[Ie++]=D(Je[ke&ze]),ke>>=Me}else W["VP8LMapColor"+b](q,K,Je,ze,ye,Ie,F,V,Ae)}}function ft(u,p,b,S,D){for(b=p+b;p<b;){var O=u[p++];S[D++]=O>>16&255,S[D++]=O>>8&255,S[D++]=O>>0&255}}function In(u,p,b,S,D){for(b=p+b;p<b;){var O=u[p++];S[D++]=O>>16&255,S[D++]=O>>8&255,S[D++]=O>>0&255,S[D++]=O>>24&255}}function on(u,p,b,S,D){for(b=p+b;p<b;){var O=(F=u[p++])>>16&240|F>>12&15,F=F>>0&240|F>>28&15;S[D++]=O,S[D++]=F}}function Mr(u,p,b,S,D){for(b=p+b;p<b;){var O=(F=u[p++])>>16&248|F>>13&7,F=F>>5&224|F>>3&31;S[D++]=O,S[D++]=F}}function ln(u,p,b,S,D){for(b=p+b;p<b;){var O=u[p++];S[D++]=O>>0&255,S[D++]=O>>8&255,S[D++]=O>>16&255}}function lt(u,p,b,S,D,O){if(O==0)for(b=p+b;p<b;)Ye(S,((O=u[p++])[0]>>24|O[1]>>8&65280|O[2]<<8&16711680|O[3]<<24)>>>0),D+=32;else r(S,D,u,p,b)}function zr(u,p){W[p][0]=W[u+"0"],W[p][1]=W[u+"1"],W[p][2]=W[u+"2"],W[p][3]=W[u+"3"],W[p][4]=W[u+"4"],W[p][5]=W[u+"5"],W[p][6]=W[u+"6"],W[p][7]=W[u+"7"],W[p][8]=W[u+"8"],W[p][9]=W[u+"9"],W[p][10]=W[u+"10"],W[p][11]=W[u+"11"],W[p][12]=W[u+"12"],W[p][13]=W[u+"13"],W[p][14]=W[u+"0"],W[p][15]=W[u+"0"]}function xt(u){return u==Df||u==If||u==bd||u==Mf}function gn(){this.eb=[],this.size=this.A=this.fb=0}function Ge(){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 Hn(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new gn,this.f.kb=new Ge,this.sd=null}function ir(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function An(){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 Yt(u){return alert("todo:WebPSamplerProcessPlane"),u.T}function Nn(u,p){var b=u.T,S=p.ba.f.RGBA,D=S.eb,O=S.fb+u.ka*S.A,F=ni[p.ba.S],V=u.y,q=u.O,K=u.f,ye=u.N,Ie=u.ea,Me=u.W,Ae=p.cc,Je=p.dc,ze=p.Mc,be=p.Nc,ke=u.ka,Ze=u.ka+u.T,Qe=u.U,Xe=Qe+1>>1;for(ke==0?F(V,q,null,null,K,ye,Ie,Me,K,ye,Ie,Me,D,O,null,null,Qe):(F(p.ec,p.fc,V,q,Ae,Je,ze,be,K,ye,Ie,Me,D,O-S.A,D,O,Qe),++b);ke+2<Ze;ke+=2)Ae=K,Je=ye,ze=Ie,be=Me,ye+=u.Rc,Me+=u.Rc,O+=2*S.A,F(V,(q+=2*u.fa)-u.fa,V,q,Ae,Je,ze,be,K,ye,Ie,Me,D,O-S.A,D,O,Qe);return q+=u.fa,u.j+Ze<u.o?(r(p.ec,p.fc,V,q,Qe),r(p.cc,p.dc,K,ye,Xe),r(p.Mc,p.Nc,Ie,Me,Xe),b--):1&Ze||F(V,q,null,null,K,ye,Ie,Me,K,ye,Ie,Me,D,O+S.A,null,null,Qe),b}function pa(u,p,b){var S=u.F,D=[u.J];if(S!=null){var O=u.U,F=p.ba.S,V=F==xd||F==bd;p=p.ba.f.RGBA;var q=[0],K=u.ka;q[0]=u.T,u.Kb&&(K==0?--q[0]:(--K,D[0]-=u.width),u.j+u.ka+u.T==u.o&&(q[0]=u.o-u.j-K));var ye=p.eb;K=p.fb+K*p.A,u=Mt(S,D[0],u.width,O,q,ye,K+(V?0:3),p.A),e(b==q),u&&xt(F)&&bt(ye,K,V,O,q,p.A)}return 0}function Er(u){var p=u.ma,b=p.ba.S,S=11>b,D=b==vd||b==yd||b==xd||b==Lf||b==12||xt(b);if(p.memory=null,p.Ib=null,p.Jb=null,p.Nd=null,!gl(p.Oa,u,D?11:12))return 0;if(D&&xt(b)&&tt(),u.da)alert("todo:use_scaling");else{if(S){if(p.Ib=Yt,u.Kb){if(b=u.U+1>>1,p.memory=i(u.U+2*b),p.memory==null)return 0;p.ec=p.memory,p.fc=0,p.cc=p.ec,p.dc=p.fc+u.U,p.Mc=p.cc,p.Nc=p.dc+b,p.Ib=Nn,tt()}}else alert("todo:EmitYUV");D&&(p.Jb=pa,S&&Le())}if(S&&!H0){for(u=0;256>u;++u)O4[u]=89858*(u-128)+Nd>>wd,B4[u]=-22014*(u-128)+Nd,F4[u]=-45773*(u-128),R4[u]=113618*(u-128)+Nd>>wd;for(u=tu;u<Rf;++u)p=76283*(u-16)+Nd>>wd,V4[u-tu]=os(p,255),q4[u-tu]=os(p+8>>4,15);H0=1}return 1}function Xr(u){var p=u.ma,b=u.U,S=u.T;return e(!(1&u.ka)),0>=b||0>=S?0:(b=p.Ib(u,p),p.Jb!=null&&p.Jb(u,p,b),p.Dc+=b,1)}function Jr(u){u.ma.memory=null}function qt(u,p,b,S){return De(u,8)!=47?0:(p[0]=De(u,14)+1,b[0]=De(u,14)+1,S[0]=De(u,1),De(u,3)!=0?0:!u.h)}function is(u,p){if(4>u)return u+1;var b=u-2>>1;return(2+(1&u)<<b)+De(p,b)+1}function wn(u,p){return 120<p?p-120:1<=(b=((b=N4[p-1])>>4)*u+(8-(15&b)))?b:1;var b}function Sn(u,p,b){var S=z(b),D=u[p+=255&S].g-8;return 0<D&&(le(b,b.u+8),S=z(b),p+=u[p].value,p+=S&(1<<D)-1),le(b,b.u+u[p].g),u[p].value}function br(u,p,b){return b.g+=u.g,b.value+=u.value<<p>>>0,e(8>=b.g),u.g}function Yn(u,p,b){var S=u.xc;return e((p=S==0?0:u.vc[u.md*(b>>S)+(p>>S)])<u.Wb),u.Ya[p]}function Wr(u,p,b,S){var D=u.ab,O=u.c*p,F=u.C;p=F+p;var V=b,q=S;for(S=u.Ta,b=u.Ua;0<D--;){var K=u.gc[D],ye=F,Ie=p,Me=V,Ae=q,Je=(q=S,V=b,K.Ea);switch(e(ye<Ie),e(Ie<=K.nc),K.hc){case 2:xi(Me,Ae,(Ie-ye)*Je,q,V);break;case 0:var ze=ye,be=Ie,ke=q,Ze=V,Qe=(jt=K).Ea;ze==0&&(yi(Me,Ae,null,null,1,ke,Ze),Pt(Me,Ae+1,0,0,Qe-1,ke,Ze+1),Ae+=Qe,Ze+=Qe,++ze);for(var Xe=1<<jt.b,At=Xe-1,wt=X(Qe,jt.b),Wt=jt.K,jt=jt.w+(ze>>jt.b)*wt;ze<be;){var Pn=Wt,Mn=jt,_n=1;for(Ia(Me,Ae,ke,Ze-Qe,1,ke,Ze);_n<Qe;){var xn=(_n&~At)+Xe;xn>Qe&&(xn=Qe),(0,w[Pn[Mn++]>>8&15])(Me,Ae+ +_n,ke,Ze+_n-Qe,xn-_n,ke,Ze+_n),_n=xn}Ae+=Qe,Ze+=Qe,++ze&At||(jt+=wt)}Ie!=K.nc&&r(q,V-Je,q,V+(Ie-ye-1)*Je,Je);break;case 1:for(Je=Me,be=Ae,Qe=(Me=K.Ea)-(Ze=Me&~(ke=(Ae=1<<K.b)-1)),ze=X(Me,K.b),Xe=K.K,K=K.w+(ye>>K.b)*ze;ye<Ie;){for(At=Xe,wt=K,Wt=new Re,jt=be+Ze,Pn=be+Me;be<jt;)an(At[wt++],Wt),A(Wt,Je,be,Ae,q,V),be+=Ae,V+=Ae;be<Pn&&(an(At[wt++],Wt),A(Wt,Je,be,Qe,q,V),be+=Qe,V+=Qe),++ye&ke||(K+=ze)}break;case 3:if(Me==q&&Ae==V&&0<K.b){for(be=q,Me=Je=V+(Ie-ye)*Je-(Ze=(Ie-ye)*X(K.Ea,K.b)),Ae=q,ke=V,ze=[],Ze=(Qe=Ze)-1;0<=Ze;--Ze)ze[Ze]=Ae[ke+Ze];for(Ze=Qe-1;0<=Ze;--Ze)be[Me+Ze]=ze[Ze];Nr(K,ye,Ie,q,Je,q,V)}else Nr(K,ye,Ie,Me,Ae,q,V)}V=S,q=b}q!=b&&r(S,b,V,q,O)}function li(u,p){var b=u.V,S=u.Ba+u.c*u.C,D=p-u.C;if(e(p<=u.l.o),e(16>=D),0<D){var O=u.l,F=u.Ta,V=u.Ua,q=O.width;if(Wr(u,D,b,S),D=V=[V],e((b=u.C)<(S=p)),e(O.v<O.va),S>O.o&&(S=O.o),b<O.j){var K=O.j-b;b=O.j,D[0]+=K*q}if(b>=S?b=0:(D[0]+=4*O.v,O.ka=b-O.j,O.U=O.va-O.v,O.T=S-b,b=1),b){if(V=V[0],11>(b=u.ca).S){var ye=b.f.RGBA,Ie=(S=b.S,D=O.U,O=O.T,K=ye.eb,ye.A),Me=O;for(ye=ye.fb+u.Ma*ye.A;0<Me--;){var Ae=F,Je=V,ze=D,be=K,ke=ye;switch(S){case gd:C(Ae,Je,ze,be,ke);break;case vd:R(Ae,Je,ze,be,ke);break;case Df:R(Ae,Je,ze,be,ke),bt(be,ke,0,ze,1,0);break;case O0:me(Ae,Je,ze,be,ke);break;case yd:lt(Ae,Je,ze,be,ke,1);break;case If:lt(Ae,Je,ze,be,ke,1),bt(be,ke,0,ze,1,0);break;case xd:lt(Ae,Je,ze,be,ke,0);break;case bd:lt(Ae,Je,ze,be,ke,0),bt(be,ke,1,ze,1,0);break;case Lf:H(Ae,Je,ze,be,ke);break;case Mf:H(Ae,Je,ze,be,ke),Ct(be,ke,ze,1,0);break;case R0:se(Ae,Je,ze,be,ke);break;default:e(0)}V+=q,ye+=Ie}u.Ma+=O}else alert("todo:EmitRescaledRowsYUVA");e(u.Ma<=b.height)}}u.C=p,e(u.C<=u.i)}function ci(u){var p;if(0<u.ua)return 0;for(p=0;p<u.Wb;++p){var b=u.Ya[p].G,S=u.Ya[p].H;if(0<b[1][S[1]+0].g||0<b[2][S[2]+0].g||0<b[3][S[3]+0].g)return 0}return 1}function Pr(u,p,b,S,D,O){if(u.Z!=0){var F=u.qd,V=u.rd;for(e(xo[u.Z]!=null);p<b;++p)xo[u.Z](F,V,S,D,S,D,O),F=S,V=D,D+=O;u.qd=F,u.rd=V}}function $r(u,p){var b=u.l.ma,S=b.Z==0||b.Z==1?u.l.j:u.C;if(S=u.C<S?S:u.C,e(p<=u.l.o),p>S){var D=u.l.width,O=b.ca,F=b.tb+D*S,V=u.V,q=u.Ba+u.c*S,K=u.gc;e(u.ab==1),e(K[0].hc==3),h(K[0],S,p,V,q,O,F),Pr(b,S,p,O,F,D)}u.C=u.Ma=p}function Cr(u,p,b,S,D,O,F){var V=u.$/S,q=u.$%S,K=u.m,ye=u.s,Ie=b+u.$,Me=Ie;D=b+S*D;var Ae=b+S*O,Je=280+ye.ua,ze=u.Pb?V:16777216,be=0<ye.ua?ye.Wa:null,ke=ye.wc,Ze=Ie<Ae?Yn(ye,q,V):null;e(u.C<O),e(Ae<=D);var Qe=!1;e:for(;;){for(;Qe||Ie<Ae;){var Xe=0;if(V>=ze){var At=Ie-b;e((ze=u).Pb),ze.wd=ze.m,ze.xd=At,0<ze.s.ua&&qe(ze.s.Wa,ze.s.vb),ze=V+S4}if(q&ke||(Ze=Yn(ye,q,V)),e(Ze!=null),Ze.Qb&&(p[Ie]=Ze.qb,Qe=!0),!Qe)if(ue(K),Ze.jc){Xe=K,At=p;var wt=Ie,Wt=Ze.pd[z(Xe)&mn-1];e(Ze.jc),256>Wt.g?(le(Xe,Xe.u+Wt.g),At[wt]=Wt.value,Xe=0):(le(Xe,Xe.u+Wt.g-256),e(256<=Wt.value),Xe=Wt.value),Xe==0&&(Qe=!0)}else Xe=Sn(Ze.G[0],Ze.H[0],K);if(K.h)break;if(Qe||256>Xe){if(!Qe)if(Ze.nd)p[Ie]=(Ze.qb|Xe<<8)>>>0;else{if(ue(K),Qe=Sn(Ze.G[1],Ze.H[1],K),ue(K),At=Sn(Ze.G[2],Ze.H[2],K),wt=Sn(Ze.G[3],Ze.H[3],K),K.h)break;p[Ie]=(wt<<24|Qe<<16|Xe<<8|At)>>>0}if(Qe=!1,++Ie,++q>=S&&(q=0,++V,F!=null&&V<=O&&!(V%16)&&F(u,V),be!=null))for(;Me<Ie;)Xe=p[Me++],be.X[(506832829*Xe&4294967295)>>>be.Mb]=Xe}else if(280>Xe){if(Xe=is(Xe-256,K),At=Sn(Ze.G[4],Ze.H[4],K),ue(K),At=wn(S,At=is(At,K)),K.h)break;if(Ie-b<At||D-Ie<Xe)break e;for(wt=0;wt<Xe;++wt)p[Ie+wt]=p[Ie+wt-At];for(Ie+=Xe,q+=Xe;q>=S;)q-=S,++V,F!=null&&V<=O&&!(V%16)&&F(u,V);if(e(Ie<=D),q&ke&&(Ze=Yn(ye,q,V)),be!=null)for(;Me<Ie;)Xe=p[Me++],be.X[(506832829*Xe&4294967295)>>>be.Mb]=Xe}else{if(!(Xe<Je))break e;for(Qe=Xe-280,e(be!=null);Me<Ie;)Xe=p[Me++],be.X[(506832829*Xe&4294967295)>>>be.Mb]=Xe;Xe=Ie,e(!(Qe>>>(At=be).Xa)),p[Xe]=At.X[Qe],Qe=!0}Qe||e(K.h==ee(K))}if(u.Pb&&K.h&&Ie<D)e(u.m.h),u.a=5,u.m=u.wd,u.$=u.xd,0<u.s.ua&&qe(u.s.vb,u.s.Wa);else{if(K.h)break e;F!=null&&F(u,V>O?O:V),u.a=0,u.$=Ie-b}return 1}return u.a=3,0}function bs(u){e(u!=null),u.vc=null,u.yc=null,u.Ya=null;var p=u.Wa;p!=null&&(p.X=null),u.vb=null,e(u!=null)}function _s(){var u=new Ql;return u==null?null:(u.a=0,u.xb=V0,zr("Predictor","VP8LPredictors"),zr("Predictor","VP8LPredictors_C"),zr("PredictorAdd","VP8LPredictorsAdd"),zr("PredictorAdd","VP8LPredictorsAdd_C"),xi=Lt,A=Ot,C=ft,R=In,H=on,se=Mr,me=ln,W.VP8LMapColor32b=Ma,W.VP8LMapColor8b=y,u)}function Or(u,p,b,S,D){var O=1,F=[u],V=[p],q=S.m,K=S.s,ye=null,Ie=0;e:for(;;){if(b)for(;O&&De(q,1);){var Me=F,Ae=V,Je=S,ze=1,be=Je.m,ke=Je.gc[Je.ab],Ze=De(be,2);if(Je.Oc&1<<Ze)O=0;else{switch(Je.Oc|=1<<Ze,ke.hc=Ze,ke.Ea=Me[0],ke.nc=Ae[0],ke.K=[null],++Je.ab,e(4>=Je.ab),Ze){case 0:case 1:ke.b=De(be,3)+2,ze=Or(X(ke.Ea,ke.b),X(ke.nc,ke.b),0,Je,ke.K),ke.K=ke.K[0];break;case 3:var Qe,Xe=De(be,8)+1,At=16<Xe?0:4<Xe?1:2<Xe?2:3;if(Me[0]=X(ke.Ea,At),ke.b=At,Qe=ze=Or(Xe,1,0,Je,ke.K)){var wt,Wt=Xe,jt=ke,Pn=1<<(8>>jt.b),Mn=i(Pn);if(Mn==null)Qe=0;else{var _n=jt.K[0],xn=jt.w;for(Mn[0]=jt.K[0][0],wt=1;wt<1*Wt;++wt)Mn[wt]=ne(_n[xn+wt],Mn[wt-1]);for(;wt<4*Pn;++wt)Mn[wt]=0;jt.K[0]=null,jt.K[0]=Mn,Qe=1}}ze=Qe;break;case 2:break;default:e(0)}O=ze}}if(F=F[0],V=V[0],O&&De(q,1)&&!(O=1<=(Ie=De(q,4))&&11>=Ie)){S.a=3;break e}var zn;if(zn=O)t:{var Vn,un,Tr,Ts=S,Lr=F,Ls=V,En=Ie,Ws=b,$s=Ts.m,Gr=Ts.s,ns=[null],ws=1,ri=0,Yi=j4[En];n:for(;;){if(Ws&&De($s,1)){var Yr=De($s,3)+2,Ra=X(Lr,Yr),vl=X(Ls,Yr),ec=Ra*vl;if(!Or(Ra,vl,0,Ts,ns))break n;for(ns=ns[0],Gr.xc=Yr,Vn=0;Vn<ec;++Vn){var bo=ns[Vn]>>8&65535;ns[Vn]=bo,bo>=ws&&(ws=bo+1)}}if($s.h)break n;for(un=0;5>un;++un){var gr=F0[un];!un&&0<En&&(gr+=1<<En),ri<gr&&(ri=gr)}var Ff=o(ws*Yi,T),Y0=ws,Z0=o(Y0,Z);if(Z0==null)var Sd=null;else e(65536>=Y0),Sd=Z0;var nu=i(ri);if(Sd==null||nu==null||Ff==null){Ts.a=1;break n}var kd=Ff;for(Vn=Tr=0;Vn<ws;++Vn){var wi=Sd[Vn],tc=wi.G,nc=wi.H,X0=0,_d=1,J0=0;for(un=0;5>un;++un){gr=F0[un],tc[un]=kd,nc[un]=Tr,!un&&0<En&&(gr+=1<<En);s:{var Ad,Bf=gr,Pd=Ts,ru=nu,W4=kd,$4=Tr,Vf=0,wo=Pd.m,H4=De(wo,1);if(s(ru,0,0,Bf),H4){var K4=De(wo,1)+1,G4=De(wo,1),Q0=De(wo,G4==0?1:8);ru[Q0]=1,K4==2&&(ru[Q0=De(wo,8)]=1);var Cd=1}else{var e1=i(19),t1=De(wo,4)+4;if(19<t1){Pd.a=3;var Td=0;break s}for(Ad=0;Ad<t1;++Ad)e1[w4[Ad]]=De(wo,3);var qf=void 0,su=void 0,n1=Pd,Y4=e1,Ld=Bf,r1=ru,Uf=0,No=n1.m,s1=8,i1=o(128,T);r:for(;B(i1,0,7,Y4,19);){if(De(No,1)){var Z4=2+2*De(No,3);if((qf=2+De(No,Z4))>Ld)break r}else qf=Ld;for(su=0;su<Ld&&qf--;){ue(No);var a1=i1[0+(127&z(No))];le(No,No.u+a1.g);var rc=a1.value;if(16>rc)r1[su++]=rc,rc!=0&&(s1=rc);else{var X4=rc==16,o1=rc-16,J4=x4[o1],l1=De(No,y4[o1])+J4;if(su+l1>Ld)break r;for(var Q4=X4?s1:0;0<l1--;)r1[su++]=Q4}}Uf=1;break r}Uf||(n1.a=3),Cd=Uf}(Cd=Cd&&!wo.h)&&(Vf=B(W4,$4,8,ru,Bf)),Cd&&Vf!=0?Td=Vf:(Pd.a=3,Td=0)}if(Td==0)break n;if(_d&&b4[un]==1&&(_d=kd[Tr].g==0),X0+=kd[Tr].g,Tr+=Td,3>=un){var iu,zf=nu[0];for(iu=1;iu<gr;++iu)nu[iu]>zf&&(zf=nu[iu]);J0+=zf}}if(wi.nd=_d,wi.Qb=0,_d&&(wi.qb=(tc[3][nc[3]+0].value<<24|tc[1][nc[1]+0].value<<16|tc[2][nc[2]+0].value)>>>0,X0==0&&256>tc[0][nc[0]+0].value&&(wi.Qb=1,wi.qb+=tc[0][nc[0]+0].value<<8)),wi.jc=!wi.Qb&&6>J0,wi.jc){var Dd,Fa=wi;for(Dd=0;Dd<mn;++Dd){var jo=Dd,So=Fa.pd[jo],Id=Fa.G[0][Fa.H[0]+jo];256<=Id.value?(So.g=Id.g+256,So.value=Id.value):(So.g=0,So.value=0,jo>>=br(Id,8,So),jo>>=br(Fa.G[1][Fa.H[1]+jo],16,So),jo>>=br(Fa.G[2][Fa.H[2]+jo],0,So),br(Fa.G[3][Fa.H[3]+jo],24,So))}}}Gr.vc=ns,Gr.Wb=ws,Gr.Ya=Sd,Gr.yc=Ff,zn=1;break t}zn=0}if(!(O=zn)){S.a=3;break e}if(0<Ie){if(K.ua=1<<Ie,!It(K.Wa,Ie)){S.a=1,O=0;break e}}else K.ua=0;var Wf=S,c1=F,ej=V,$f=Wf.s,Hf=$f.xc;if(Wf.c=c1,Wf.i=ej,$f.md=X(c1,Hf),$f.wc=Hf==0?-1:(1<<Hf)-1,b){S.xb=L4;break e}if((ye=i(F*V))==null){S.a=1,O=0;break e}O=(O=Cr(S,ye,0,F,V,V,null))&&!q.h;break e}return O?(D!=null?D[0]=ye:(e(ye==null),e(b)),S.$=0,b||bs(K)):bs(K),O}function Fi(u,p){var b=u.c*u.i,S=b+p+16*p;return e(u.c<=p),u.V=i(S),u.V==null?(u.Ta=null,u.Ua=0,u.a=1,0):(u.Ta=u.V,u.Ua=u.Ba+b+p,1)}function As(u,p){var b=u.C,S=p-b,D=u.V,O=u.Ba+u.c*b;for(e(p<=u.l.o);0<S;){var F=16<S?16:S,V=u.l.ma,q=u.l.width,K=q*F,ye=V.ca,Ie=V.tb+q*b,Me=u.Ta,Ae=u.Ua;Wr(u,F,D,O),Ft(Me,Ae,ye,Ie,K),Pr(V,b,b+F,ye,Ie,q),S-=F,D+=F*u.c,b+=F}e(b==p),u.C=u.Ma=p}function ma(){this.ub=this.yd=this.td=this.Rb=0}function Bi(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function Bn(){this.Fb=this.Bb=this.Cb=0,this.Zb=i(4),this.Lb=i(4)}function Xs(){this.Yb=function(){var u=[];return function p(b,S,D){for(var O=D[S],F=0;F<O&&(b.push(D.length>S+1?[]:0),!(D.length<S+1));F++)p(b[F],S+1,D)}(u,0,[3,11]),u}()}function Os(){this.jb=i(3),this.Wc=l([4,8],Xs),this.Xc=l([4,17],Xs)}function Hl(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new i(4),this.od=new i(4)}function Rs(){this.ld=this.La=this.dd=this.tc=0}function ga(){this.Na=this.la=0}function rl(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function va(){this.ad=i(384),this.Za=0,this.Ob=i(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function ui(){this.uc=this.M=this.Nb=0,this.wa=Array(new Rs),this.Y=0,this.ya=Array(new va),this.aa=0,this.l=new ya}function sl(){this.y=i(16),this.f=i(8),this.ea=i(8)}function oo(){this.cb=this.a=0,this.sc="",this.m=new $e,this.Od=new ma,this.Kc=new Bi,this.ed=new Hl,this.Qa=new Bn,this.Ic=this.$c=this.Aa=0,this.D=new ui,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=o(8,$e),this.ia=0,this.pb=o(4,rl),this.Pa=new Os,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new sl),this.Hd=0,this.rb=Array(new ga),this.sb=0,this.wa=Array(new Rs),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 va),this.L=this.aa=0,this.gd=l([4,2],Rs),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 ya(){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 pn(){var u=new oo;return u!=null&&(u.a=0,u.sc="OK",u.cb=0,u.Xb=0,eu||(eu=Cn)),u}function nr(u,p,b){return u.a==0&&(u.a=p,u.sc=b,u.cb=0),0}function il(u,p,b){return 3<=b&&u[p+0]==157&&u[p+1]==1&&u[p+2]==42}function al(u,p){if(u==null)return 0;if(u.a=0,u.sc="OK",p==null)return nr(u,2,"null VP8Io passed to VP8GetHeaders()");var b=p.data,S=p.w,D=p.ha;if(4>D)return nr(u,7,"Truncated header.");var O=b[S+0]|b[S+1]<<8|b[S+2]<<16,F=u.Od;if(F.Rb=!(1&O),F.td=O>>1&7,F.yd=O>>4&1,F.ub=O>>5,3<F.td)return nr(u,3,"Incorrect keyframe parameters.");if(!F.yd)return nr(u,4,"Frame not displayable.");S+=3,D-=3;var V=u.Kc;if(F.Rb){if(7>D)return nr(u,7,"cannot parse picture header");if(!il(b,S,D))return nr(u,3,"Bad code word");V.c=16383&(b[S+4]<<8|b[S+3]),V.Td=b[S+4]>>6,V.i=16383&(b[S+6]<<8|b[S+5]),V.Ud=b[S+6]>>6,S+=7,D-=7,u.za=V.c+15>>4,u.Ub=V.i+15>>4,p.width=V.c,p.height=V.i,p.Da=0,p.j=0,p.v=0,p.va=p.width,p.o=p.height,p.da=0,p.ib=p.width,p.hb=p.height,p.U=p.width,p.T=p.height,s((O=u.Pa).jb,0,255,O.jb.length),e((O=u.Qa)!=null),O.Cb=0,O.Bb=0,O.Fb=1,s(O.Zb,0,0,O.Zb.length),s(O.Lb,0,0,O.Lb)}if(F.ub>D)return nr(u,7,"bad partition length");Ne(O=u.m,b,S,F.ub),S+=F.ub,D-=F.ub,F.Rb&&(V.Ld=Pe(O),V.Kd=Pe(O)),V=u.Qa;var q,K=u.Pa;if(e(O!=null),e(V!=null),V.Cb=Pe(O),V.Cb){if(V.Bb=Pe(O),Pe(O)){for(V.Fb=Pe(O),q=0;4>q;++q)V.Zb[q]=Pe(O)?ae(O,7):0;for(q=0;4>q;++q)V.Lb[q]=Pe(O)?ae(O,6):0}if(V.Bb)for(q=0;3>q;++q)K.jb[q]=Pe(O)?he(O,8):255}else V.Bb=0;if(O.Ka)return nr(u,3,"cannot parse segment header");if((V=u.ed).zd=Pe(O),V.Tb=he(O,6),V.wb=he(O,3),V.Pc=Pe(O),V.Pc&&Pe(O)){for(K=0;4>K;++K)Pe(O)&&(V.vd[K]=ae(O,6));for(K=0;4>K;++K)Pe(O)&&(V.od[K]=ae(O,6))}if(u.L=V.Tb==0?0:V.zd?1:2,O.Ka)return nr(u,3,"cannot parse filter header");var ye=D;if(D=q=S,S=q+ye,V=ye,u.Xb=(1<<he(u.m,2))-1,ye<3*(K=u.Xb))b=7;else{for(q+=3*K,V-=3*K,ye=0;ye<K;++ye){var Ie=b[D+0]|b[D+1]<<8|b[D+2]<<16;Ie>V&&(Ie=V),Ne(u.Jc[+ye],b,q,Ie),q+=Ie,V-=Ie,D+=3}Ne(u.Jc[+K],b,q,V),b=q<S?0:5}if(b!=0)return nr(u,b,"cannot parse partitions");for(b=he(q=u.m,7),D=Pe(q)?ae(q,4):0,S=Pe(q)?ae(q,4):0,V=Pe(q)?ae(q,4):0,K=Pe(q)?ae(q,4):0,q=Pe(q)?ae(q,4):0,ye=u.Qa,Ie=0;4>Ie;++Ie){if(ye.Cb){var Me=ye.Zb[Ie];ye.Fb||(Me+=b)}else{if(0<Ie){u.pb[Ie]=u.pb[0];continue}Me=b}var Ae=u.pb[Ie];Ae.Sc[0]=Ef[os(Me+D,127)],Ae.Sc[1]=Of[os(Me+0,127)],Ae.Eb[0]=2*Ef[os(Me+S,127)],Ae.Eb[1]=101581*Of[os(Me+V,127)]>>16,8>Ae.Eb[1]&&(Ae.Eb[1]=8),Ae.Qc[0]=Ef[os(Me+K,117)],Ae.Qc[1]=Of[os(Me+q,127)],Ae.lc=Me+q}if(!F.Rb)return nr(u,4,"Not a key frame.");for(Pe(O),F=u.Pa,b=0;4>b;++b){for(D=0;8>D;++D)for(S=0;3>S;++S)for(V=0;11>V;++V)K=ce(O,C4[b][D][S][V])?he(O,8):A4[b][D][S][V],F.Wc[b][D].Yb[S][V]=K;for(D=0;17>D;++D)F.Xc[b][D]=F.Wc[b][T4[D]]}return u.kc=Pe(O),u.kc&&(u.Bd=he(O,8)),u.cb=1}function Cn(u,p,b,S,D,O,F){var V=p[D].Yb[b];for(b=0;16>D;++D){if(!ce(u,V[b+0]))return D;for(;!ce(u,V[b+1]);)if(V=p[++D].Yb[0],b=0,D==16)return 16;var q=p[D+1].Yb;if(ce(u,V[b+2])){var K=u,ye=0;if(ce(K,(Me=V)[(Ie=b)+3]))if(ce(K,Me[Ie+6])){for(V=0,Ie=2*(ye=ce(K,Me[Ie+8]))+(Me=ce(K,Me[Ie+9+ye])),ye=0,Me=k4[Ie];Me[V];++V)ye+=ye+ce(K,Me[V]);ye+=3+(8<<Ie)}else ce(K,Me[Ie+7])?(ye=7+2*ce(K,165),ye+=ce(K,145)):ye=5+ce(K,159);else ye=ce(K,Me[Ie+4])?3+ce(K,Me[Ie+5]):2;V=q[2]}else ye=1,V=q[1];q=F+_4[D],0>(K=u).b&&ve(K);var Ie,Me=K.b,Ae=(Ie=K.Ca>>1)-(K.I>>Me)>>31;--K.b,K.Ca+=Ae,K.Ca|=1,K.I-=(Ie+1&Ae)<<Me,O[q]=((ye^Ae)-Ae)*S[(0<D)+0]}return 16}function di(u){var p=u.rb[u.sb-1];p.la=0,p.Na=0,s(u.zc,0,0,u.zc.length),u.ja=0}function xa(u,p){if(u==null)return 0;if(p==null)return nr(u,2,"NULL VP8Io parameter in VP8Decode().");if(!u.cb&&!al(u,p))return 0;if(e(u.cb),p.ac==null||p.ac(p)){p.ob&&(u.L=0);var b=jd[u.L];if(u.L==2?(u.yb=0,u.zb=0):(u.yb=p.v-b>>4,u.zb=p.j-b>>4,0>u.yb&&(u.yb=0),0>u.zb&&(u.zb=0)),u.Va=p.o+15+b>>4,u.Hb=p.va+15+b>>4,u.Hb>u.za&&(u.Hb=u.za),u.Va>u.Ub&&(u.Va=u.Ub),0<u.L){var S=u.ed;for(b=0;4>b;++b){var D;if(u.Qa.Cb){var O=u.Qa.Lb[b];u.Qa.Fb||(O+=S.Tb)}else O=S.Tb;for(D=0;1>=D;++D){var F=u.gd[b][D],V=O;if(S.Pc&&(V+=S.vd[0],D&&(V+=S.od[0])),0<(V=0>V?0:63<V?63:V)){var q=V;0<S.wb&&(q=4<S.wb?q>>2:q>>1)>9-S.wb&&(q=9-S.wb),1>q&&(q=1),F.dd=q,F.tc=2*V+q,F.ld=40<=V?2:15<=V?1:0}else F.tc=0;F.La=D}}}b=0}else nr(u,6,"Frame setup failed"),b=u.a;if(b=b==0){if(b){u.$c=0,0<u.Aa||(u.Ic=z4);e:{b=u.Ic,S=4*(q=u.za);var K=32*q,ye=q+1,Ie=0<u.L?q*(0<u.Aa?2:1):0,Me=(u.Aa==2?2:1)*q;if((F=S+832+(D=3*(16*b+jd[u.L])/2*K)+(O=u.Fa!=null&&0<u.Fa.length?u.Kc.c*u.Kc.i:0))!=F)b=0;else{if(F>u.Vb){if(u.Vb=0,u.Ec=i(F),u.Fc=0,u.Ec==null){b=nr(u,1,"no memory during frame initialization.");break e}u.Vb=F}F=u.Ec,V=u.Fc,u.Ac=F,u.Bc=V,V+=S,u.Gd=o(K,sl),u.Hd=0,u.rb=o(ye+1,ga),u.sb=1,u.wa=Ie?o(Ie,Rs):null,u.Y=0,u.D.Nb=0,u.D.wa=u.wa,u.D.Y=u.Y,0<u.Aa&&(u.D.Y+=q),e(!0),u.oc=F,u.pc=V,V+=832,u.ya=o(Me,va),u.aa=0,u.D.ya=u.ya,u.D.aa=u.aa,u.Aa==2&&(u.D.aa+=q),u.R=16*q,u.B=8*q,q=(K=jd[u.L])*u.R,K=K/2*u.B,u.sa=F,u.ta=V+q,u.qa=u.sa,u.ra=u.ta+16*b*u.R+K,u.Ha=u.qa,u.Ia=u.ra+8*b*u.B+K,u.$c=0,V+=D,u.mb=O?F:null,u.nb=O?V:null,e(V+O<=u.Fc+u.Vb),di(u),s(u.Ac,u.Bc,0,S),b=1}}if(b){if(p.ka=0,p.y=u.sa,p.O=u.ta,p.f=u.qa,p.N=u.ra,p.ea=u.Ha,p.Vd=u.Ia,p.fa=u.R,p.Rc=u.B,p.F=null,p.J=0,!Ea){for(b=-255;255>=b;++b)kn[255+b]=0>b?-b:b;for(b=-1020;1020>=b;++b)Ut[1020+b]=-128>b?-128:127<b?127:b;for(b=-112;112>=b;++b)mr[112+b]=-16>b?-16:15<b?15:b;for(b=-255;510>=b;++b)lr[255+b]=0>b?0:255<b?255:b;Ea=1}we=Xc,_e=lo,Te=ll,pe=ba,je=cl,ie=ol,Ce=Wi,Se=Qs,Ee=ho,Be=Ca,Ve=Jl,He=uo,rt=Ta,ut=fo,st=Xl,at=Js,pt=qs,ot=fl,bi[0]=Ps,bi[1]=ul,bi[2]=wa,bi[3]=Na,bi[4]=Vs,bi[5]=Qr,bi[6]=Gl,bi[7]=ja,bi[8]=dl,bi[9]=Yl,yo[0]=Bs,yo[1]=Qc,yo[2]=ar,yo[3]=Fs,yo[4]=Rr,yo[5]=Kl,yo[6]=or,Oa[0]=zi,Oa[1]=Jc,Oa[2]=Sa,Oa[3]=ka,Oa[4]=Aa,Oa[5]=_a,Oa[6]=hl,b=1}else b=0}b&&(b=function(Ae,Je){for(Ae.M=0;Ae.M<Ae.Va;++Ae.M){var ze,be=Ae.Jc[Ae.M&Ae.Xb],ke=Ae.m,Ze=Ae;for(ze=0;ze<Ze.za;++ze){var Qe=ke,Xe=Ze,At=Xe.Ac,wt=Xe.Bc+4*ze,Wt=Xe.zc,jt=Xe.ya[Xe.aa+ze];if(Xe.Qa.Bb?jt.$b=ce(Qe,Xe.Pa.jb[0])?2+ce(Qe,Xe.Pa.jb[2]):ce(Qe,Xe.Pa.jb[1]):jt.$b=0,Xe.kc&&(jt.Ad=ce(Qe,Xe.Bd)),jt.Za=!ce(Qe,145)+0,jt.Za){var Pn=jt.Ob,Mn=0;for(Xe=0;4>Xe;++Xe){var _n,xn=Wt[0+Xe];for(_n=0;4>_n;++_n){xn=P4[At[wt+_n]][xn];for(var zn=B0[ce(Qe,xn[0])];0<zn;)zn=B0[2*zn+ce(Qe,xn[zn])];xn=-zn,At[wt+_n]=xn}r(Pn,Mn,At,wt,4),Mn+=4,Wt[0+Xe]=xn}}else xn=ce(Qe,156)?ce(Qe,128)?1:3:ce(Qe,163)?2:0,jt.Ob[0]=xn,s(At,wt,xn,4),s(Wt,0,xn,4);jt.Dd=ce(Qe,142)?ce(Qe,114)?ce(Qe,183)?1:3:2:0}if(Ze.m.Ka)return nr(Ae,7,"Premature end-of-partition0 encountered.");for(;Ae.ja<Ae.za;++Ae.ja){if(Ze=be,Qe=(ke=Ae).rb[ke.sb-1],At=ke.rb[ke.sb+ke.ja],ze=ke.ya[ke.aa+ke.ja],wt=ke.kc?ze.Ad:0)Qe.la=At.la=0,ze.Za||(Qe.Na=At.Na=0),ze.Hc=0,ze.Gc=0,ze.ia=0;else{var Vn,un;if(Qe=At,At=Ze,wt=ke.Pa.Xc,Wt=ke.ya[ke.aa+ke.ja],jt=ke.pb[Wt.$b],Xe=Wt.ad,Pn=0,Mn=ke.rb[ke.sb-1],xn=_n=0,s(Xe,Pn,0,384),Wt.Za)var Tr=0,Ts=wt[3];else{zn=i(16);var Lr=Qe.Na+Mn.Na;if(Lr=eu(At,wt[1],Lr,jt.Eb,0,zn,0),Qe.Na=Mn.Na=(0<Lr)+0,1<Lr)we(zn,0,Xe,Pn);else{var Ls=zn[0]+3>>3;for(zn=0;256>zn;zn+=16)Xe[Pn+zn]=Ls}Tr=1,Ts=wt[0]}var En=15&Qe.la,Ws=15&Mn.la;for(zn=0;4>zn;++zn){var $s=1&Ws;for(Ls=un=0;4>Ls;++Ls)En=En>>1|($s=(Lr=eu(At,Ts,Lr=$s+(1&En),jt.Sc,Tr,Xe,Pn))>Tr)<<7,un=un<<2|(3<Lr?3:1<Lr?2:Xe[Pn+0]!=0),Pn+=16;En>>=4,Ws=Ws>>1|$s<<7,_n=(_n<<8|un)>>>0}for(Ts=En,Tr=Ws>>4,Vn=0;4>Vn;Vn+=2){for(un=0,En=Qe.la>>4+Vn,Ws=Mn.la>>4+Vn,zn=0;2>zn;++zn){for($s=1&Ws,Ls=0;2>Ls;++Ls)Lr=$s+(1&En),En=En>>1|($s=0<(Lr=eu(At,wt[2],Lr,jt.Qc,0,Xe,Pn)))<<3,un=un<<2|(3<Lr?3:1<Lr?2:Xe[Pn+0]!=0),Pn+=16;En>>=2,Ws=Ws>>1|$s<<5}xn|=un<<4*Vn,Ts|=En<<4<<Vn,Tr|=(240&Ws)<<Vn}Qe.la=Ts,Mn.la=Tr,Wt.Hc=_n,Wt.Gc=xn,Wt.ia=43690&xn?0:jt.ia,wt=!(_n|xn)}if(0<ke.L&&(ke.wa[ke.Y+ke.ja]=ke.gd[ze.$b][ze.Za],ke.wa[ke.Y+ke.ja].La|=!wt),Ze.Ka)return nr(Ae,7,"Premature end-of-file encountered.")}if(di(Ae),ke=Je,Ze=1,ze=(be=Ae).D,Qe=0<be.L&&be.M>=be.zb&&be.M<=be.Va,be.Aa==0)e:{if(ze.M=be.M,ze.uc=Qe,ml(be,ze),Ze=1,ze=(un=be.D).Nb,Qe=(xn=jd[be.L])*be.R,At=xn/2*be.B,zn=16*ze*be.R,Ls=8*ze*be.B,wt=be.sa,Wt=be.ta-Qe+zn,jt=be.qa,Xe=be.ra-At+Ls,Pn=be.Ha,Mn=be.Ia-At+Ls,Ws=(En=un.M)==0,_n=En>=be.Va-1,be.Aa==2&&ml(be,un),un.uc)for($s=(Lr=be).D.M,e(Lr.D.uc),un=Lr.yb;un<Lr.Hb;++un){Tr=un,Ts=$s;var Gr=(ns=(gr=Lr).D).Nb;Vn=gr.R;var ns=ns.wa[ns.Y+Tr],ws=gr.sa,ri=gr.ta+16*Gr*Vn+16*Tr,Yi=ns.dd,Yr=ns.tc;if(Yr!=0)if(e(3<=Yr),gr.L==1)0<Tr&&at(ws,ri,Vn,Yr+4),ns.La&&ot(ws,ri,Vn,Yr),0<Ts&&st(ws,ri,Vn,Yr+4),ns.La&&pt(ws,ri,Vn,Yr);else{var Ra=gr.B,vl=gr.qa,ec=gr.ra+8*Gr*Ra+8*Tr,bo=gr.Ha,gr=gr.Ia+8*Gr*Ra+8*Tr;Gr=ns.ld,0<Tr&&(Se(ws,ri,Vn,Yr+4,Yi,Gr),Be(vl,ec,bo,gr,Ra,Yr+4,Yi,Gr)),ns.La&&(He(ws,ri,Vn,Yr,Yi,Gr),ut(vl,ec,bo,gr,Ra,Yr,Yi,Gr)),0<Ts&&(Ce(ws,ri,Vn,Yr+4,Yi,Gr),Ee(vl,ec,bo,gr,Ra,Yr+4,Yi,Gr)),ns.La&&(Ve(ws,ri,Vn,Yr,Yi,Gr),rt(vl,ec,bo,gr,Ra,Yr,Yi,Gr))}}if(be.ia&&alert("todo:DitherRow"),ke.put!=null){if(un=16*En,En=16*(En+1),Ws?(ke.y=be.sa,ke.O=be.ta+zn,ke.f=be.qa,ke.N=be.ra+Ls,ke.ea=be.Ha,ke.W=be.Ia+Ls):(un-=xn,ke.y=wt,ke.O=Wt,ke.f=jt,ke.N=Xe,ke.ea=Pn,ke.W=Mn),_n||(En-=xn),En>ke.o&&(En=ke.o),ke.F=null,ke.J=null,be.Fa!=null&&0<be.Fa.length&&un<En&&(ke.J=La(be,ke,un,En-un),ke.F=be.mb,ke.F==null&&ke.F.length==0)){Ze=nr(be,3,"Could not decode alpha data.");break e}un<ke.j&&(xn=ke.j-un,un=ke.j,e(!(1&xn)),ke.O+=be.R*xn,ke.N+=be.B*(xn>>1),ke.W+=be.B*(xn>>1),ke.F!=null&&(ke.J+=ke.width*xn)),un<En&&(ke.O+=ke.v,ke.N+=ke.v>>1,ke.W+=ke.v>>1,ke.F!=null&&(ke.J+=ke.v),ke.ka=un-ke.j,ke.U=ke.va-ke.v,ke.T=En-un,Ze=ke.put(ke))}ze+1!=be.Ic||_n||(r(be.sa,be.ta-Qe,wt,Wt+16*be.R,Qe),r(be.qa,be.ra-At,jt,Xe+8*be.B,At),r(be.Ha,be.Ia-At,Pn,Mn+8*be.B,At))}if(!Ze)return nr(Ae,6,"Output aborted.")}return 1}(u,p)),p.bc!=null&&p.bc(p),b&=1}return b?(u.cb=0,b):0}function Hr(u,p,b,S,D){D=u[p+b+32*S]+(D>>3),u[p+b+32*S]=-256&D?0>D?0:255:D}function Vi(u,p,b,S,D,O){Hr(u,p,0,b,S+D),Hr(u,p,1,b,S+O),Hr(u,p,2,b,S-O),Hr(u,p,3,b,S-D)}function Kr(u){return(20091*u>>16)+u}function qi(u,p,b,S){var D,O=0,F=i(16);for(D=0;4>D;++D){var V=u[p+0]+u[p+8],q=u[p+0]-u[p+8],K=(35468*u[p+4]>>16)-Kr(u[p+12]),ye=Kr(u[p+4])+(35468*u[p+12]>>16);F[O+0]=V+ye,F[O+1]=q+K,F[O+2]=q-K,F[O+3]=V-ye,O+=4,p++}for(D=O=0;4>D;++D)V=(u=F[O+0]+4)+F[O+8],q=u-F[O+8],K=(35468*F[O+4]>>16)-Kr(F[O+12]),Hr(b,S,0,0,V+(ye=Kr(F[O+4])+(35468*F[O+12]>>16))),Hr(b,S,1,0,q+K),Hr(b,S,2,0,q-K),Hr(b,S,3,0,V-ye),O++,S+=32}function ol(u,p,b,S){var D=u[p+0]+4,O=35468*u[p+4]>>16,F=Kr(u[p+4]),V=35468*u[p+1]>>16;Vi(b,S,0,D+F,u=Kr(u[p+1]),V),Vi(b,S,1,D+O,u,V),Vi(b,S,2,D-O,u,V),Vi(b,S,3,D-F,u,V)}function lo(u,p,b,S,D){qi(u,p,b,S),D&&qi(u,p+16,b,S+4)}function ll(u,p,b,S){_e(u,p+0,b,S,1),_e(u,p+32,b,S+128,1)}function ba(u,p,b,S){var D;for(u=u[p+0]+4,D=0;4>D;++D)for(p=0;4>p;++p)Hr(b,S,p,D,u)}function cl(u,p,b,S){u[p+0]&&pe(u,p+0,b,S),u[p+16]&&pe(u,p+16,b,S+4),u[p+32]&&pe(u,p+32,b,S+128),u[p+48]&&pe(u,p+48,b,S+128+4)}function Xc(u,p,b,S){var D,O=i(16);for(D=0;4>D;++D){var F=u[p+0+D]+u[p+12+D],V=u[p+4+D]+u[p+8+D],q=u[p+4+D]-u[p+8+D],K=u[p+0+D]-u[p+12+D];O[0+D]=F+V,O[8+D]=F-V,O[4+D]=K+q,O[12+D]=K-q}for(D=0;4>D;++D)F=(u=O[0+4*D]+3)+O[3+4*D],V=O[1+4*D]+O[2+4*D],q=O[1+4*D]-O[2+4*D],K=u-O[3+4*D],b[S+0]=F+V>>3,b[S+16]=K+q>>3,b[S+32]=F-V>>3,b[S+48]=K-q>>3,S+=64}function vn(u,p,b){var S,D=p-32,O=ts,F=255-u[D-1];for(S=0;S<b;++S){var V,q=O,K=F+u[p-1];for(V=0;V<b;++V)u[p+V]=q[K+u[D+V]];p+=32}}function ul(u,p){vn(u,p,4)}function Jc(u,p){vn(u,p,8)}function Qc(u,p){vn(u,p,16)}function ar(u,p){var b;for(b=0;16>b;++b)r(u,p+32*b,u,p-32,16)}function Fs(u,p){var b;for(b=16;0<b;--b)s(u,p,u[p-1],16),p+=32}function hi(u,p,b){var S;for(S=0;16>S;++S)s(p,b+32*S,u,16)}function Bs(u,p){var b,S=16;for(b=0;16>b;++b)S+=u[p-1+32*b]+u[p+b-32];hi(S>>5,u,p)}function Rr(u,p){var b,S=8;for(b=0;16>b;++b)S+=u[p-1+32*b];hi(S>>4,u,p)}function Kl(u,p){var b,S=8;for(b=0;16>b;++b)S+=u[p+b-32];hi(S>>4,u,p)}function or(u,p){hi(128,u,p)}function Vt(u,p,b){return u+2*p+b+2>>2}function wa(u,p){var b,S=p-32;for(S=new Uint8Array([Vt(u[S-1],u[S+0],u[S+1]),Vt(u[S+0],u[S+1],u[S+2]),Vt(u[S+1],u[S+2],u[S+3]),Vt(u[S+2],u[S+3],u[S+4])]),b=0;4>b;++b)r(u,p+32*b,S,0,S.length)}function Na(u,p){var b=u[p-1],S=u[p-1+32],D=u[p-1+64],O=u[p-1+96];Ye(u,p+0,16843009*Vt(u[p-1-32],b,S)),Ye(u,p+32,16843009*Vt(b,S,D)),Ye(u,p+64,16843009*Vt(S,D,O)),Ye(u,p+96,16843009*Vt(D,O,O))}function Ps(u,p){var b,S=4;for(b=0;4>b;++b)S+=u[p+b-32]+u[p-1+32*b];for(S>>=3,b=0;4>b;++b)s(u,p+32*b,S,4)}function Vs(u,p){var b=u[p-1+0],S=u[p-1+32],D=u[p-1+64],O=u[p-1-32],F=u[p+0-32],V=u[p+1-32],q=u[p+2-32],K=u[p+3-32];u[p+0+96]=Vt(S,D,u[p-1+96]),u[p+1+96]=u[p+0+64]=Vt(b,S,D),u[p+2+96]=u[p+1+64]=u[p+0+32]=Vt(O,b,S),u[p+3+96]=u[p+2+64]=u[p+1+32]=u[p+0+0]=Vt(F,O,b),u[p+3+64]=u[p+2+32]=u[p+1+0]=Vt(V,F,O),u[p+3+32]=u[p+2+0]=Vt(q,V,F),u[p+3+0]=Vt(K,q,V)}function Gl(u,p){var b=u[p+1-32],S=u[p+2-32],D=u[p+3-32],O=u[p+4-32],F=u[p+5-32],V=u[p+6-32],q=u[p+7-32];u[p+0+0]=Vt(u[p+0-32],b,S),u[p+1+0]=u[p+0+32]=Vt(b,S,D),u[p+2+0]=u[p+1+32]=u[p+0+64]=Vt(S,D,O),u[p+3+0]=u[p+2+32]=u[p+1+64]=u[p+0+96]=Vt(D,O,F),u[p+3+32]=u[p+2+64]=u[p+1+96]=Vt(O,F,V),u[p+3+64]=u[p+2+96]=Vt(F,V,q),u[p+3+96]=Vt(V,q,q)}function Qr(u,p){var b=u[p-1+0],S=u[p-1+32],D=u[p-1+64],O=u[p-1-32],F=u[p+0-32],V=u[p+1-32],q=u[p+2-32],K=u[p+3-32];u[p+0+0]=u[p+1+64]=O+F+1>>1,u[p+1+0]=u[p+2+64]=F+V+1>>1,u[p+2+0]=u[p+3+64]=V+q+1>>1,u[p+3+0]=q+K+1>>1,u[p+0+96]=Vt(D,S,b),u[p+0+64]=Vt(S,b,O),u[p+0+32]=u[p+1+96]=Vt(b,O,F),u[p+1+32]=u[p+2+96]=Vt(O,F,V),u[p+2+32]=u[p+3+96]=Vt(F,V,q),u[p+3+32]=Vt(V,q,K)}function ja(u,p){var b=u[p+0-32],S=u[p+1-32],D=u[p+2-32],O=u[p+3-32],F=u[p+4-32],V=u[p+5-32],q=u[p+6-32],K=u[p+7-32];u[p+0+0]=b+S+1>>1,u[p+1+0]=u[p+0+64]=S+D+1>>1,u[p+2+0]=u[p+1+64]=D+O+1>>1,u[p+3+0]=u[p+2+64]=O+F+1>>1,u[p+0+32]=Vt(b,S,D),u[p+1+32]=u[p+0+96]=Vt(S,D,O),u[p+2+32]=u[p+1+96]=Vt(D,O,F),u[p+3+32]=u[p+2+96]=Vt(O,F,V),u[p+3+64]=Vt(F,V,q),u[p+3+96]=Vt(V,q,K)}function Yl(u,p){var b=u[p-1+0],S=u[p-1+32],D=u[p-1+64],O=u[p-1+96];u[p+0+0]=b+S+1>>1,u[p+2+0]=u[p+0+32]=S+D+1>>1,u[p+2+32]=u[p+0+64]=D+O+1>>1,u[p+1+0]=Vt(b,S,D),u[p+3+0]=u[p+1+32]=Vt(S,D,O),u[p+3+32]=u[p+1+64]=Vt(D,O,O),u[p+3+64]=u[p+2+64]=u[p+0+96]=u[p+1+96]=u[p+2+96]=u[p+3+96]=O}function dl(u,p){var b=u[p-1+0],S=u[p-1+32],D=u[p-1+64],O=u[p-1+96],F=u[p-1-32],V=u[p+0-32],q=u[p+1-32],K=u[p+2-32];u[p+0+0]=u[p+2+32]=b+F+1>>1,u[p+0+32]=u[p+2+64]=S+b+1>>1,u[p+0+64]=u[p+2+96]=D+S+1>>1,u[p+0+96]=O+D+1>>1,u[p+3+0]=Vt(V,q,K),u[p+2+0]=Vt(F,V,q),u[p+1+0]=u[p+3+32]=Vt(b,F,V),u[p+1+32]=u[p+3+64]=Vt(S,b,F),u[p+1+64]=u[p+3+96]=Vt(D,S,b),u[p+1+96]=Vt(O,D,S)}function Sa(u,p){var b;for(b=0;8>b;++b)r(u,p+32*b,u,p-32,8)}function ka(u,p){var b;for(b=0;8>b;++b)s(u,p,u[p-1],8),p+=32}function Ui(u,p,b){var S;for(S=0;8>S;++S)s(p,b+32*S,u,8)}function zi(u,p){var b,S=8;for(b=0;8>b;++b)S+=u[p+b-32]+u[p-1+32*b];Ui(S>>4,u,p)}function _a(u,p){var b,S=4;for(b=0;8>b;++b)S+=u[p+b-32];Ui(S>>3,u,p)}function Aa(u,p){var b,S=4;for(b=0;8>b;++b)S+=u[p-1+32*b];Ui(S>>3,u,p)}function hl(u,p){Ui(128,u,p)}function fi(u,p,b){var S=u[p-b],D=u[p+0],O=3*(D-S)+Vr[1020+u[p-2*b]-u[p+b]],F=ei[112+(O+4>>3)];u[p-b]=ts[255+S+ei[112+(O+3>>3)]],u[p+0]=ts[255+D-F]}function Pa(u,p,b,S){var D=u[p+0],O=u[p+b];return ti[255+u[p-2*b]-u[p-b]]>S||ti[255+O-D]>S}function co(u,p,b,S){return 4*ti[255+u[p-b]-u[p+0]]+ti[255+u[p-2*b]-u[p+b]]<=S}function Zl(u,p,b,S,D){var O=u[p-3*b],F=u[p-2*b],V=u[p-b],q=u[p+0],K=u[p+b],ye=u[p+2*b],Ie=u[p+3*b];return 4*ti[255+V-q]+ti[255+F-K]>S?0:ti[255+u[p-4*b]-O]<=D&&ti[255+O-F]<=D&&ti[255+F-V]<=D&&ti[255+Ie-ye]<=D&&ti[255+ye-K]<=D&&ti[255+K-q]<=D}function Xl(u,p,b,S){var D=2*S+1;for(S=0;16>S;++S)co(u,p+S,b,D)&&fi(u,p+S,b)}function Js(u,p,b,S){var D=2*S+1;for(S=0;16>S;++S)co(u,p+S*b,1,D)&&fi(u,p+S*b,1)}function qs(u,p,b,S){var D;for(D=3;0<D;--D)Xl(u,p+=4*b,b,S)}function fl(u,p,b,S){var D;for(D=3;0<D;--D)Js(u,p+=4,b,S)}function pi(u,p,b,S,D,O,F,V){for(O=2*O+1;0<D--;){if(Zl(u,p,b,O,F))if(Pa(u,p,b,V))fi(u,p,b);else{var q=u,K=p,ye=b,Ie=q[K-2*ye],Me=q[K-ye],Ae=q[K+0],Je=q[K+ye],ze=q[K+2*ye],be=27*(Ze=Vr[1020+3*(Ae-Me)+Vr[1020+Ie-Je]])+63>>7,ke=18*Ze+63>>7,Ze=9*Ze+63>>7;q[K-3*ye]=ts[255+q[K-3*ye]+Ze],q[K-2*ye]=ts[255+Ie+ke],q[K-ye]=ts[255+Me+be],q[K+0]=ts[255+Ae-be],q[K+ye]=ts[255+Je-ke],q[K+2*ye]=ts[255+ze-Ze]}p+=S}}function as(u,p,b,S,D,O,F,V){for(O=2*O+1;0<D--;){if(Zl(u,p,b,O,F))if(Pa(u,p,b,V))fi(u,p,b);else{var q=u,K=p,ye=b,Ie=q[K-ye],Me=q[K+0],Ae=q[K+ye],Je=ei[112+((ze=3*(Me-Ie))+4>>3)],ze=ei[112+(ze+3>>3)],be=Je+1>>1;q[K-2*ye]=ts[255+q[K-2*ye]+be],q[K-ye]=ts[255+Ie+ze],q[K+0]=ts[255+Me-Je],q[K+ye]=ts[255+Ae-be]}p+=S}}function Wi(u,p,b,S,D,O){pi(u,p,b,1,16,S,D,O)}function Qs(u,p,b,S,D,O){pi(u,p,1,b,16,S,D,O)}function Jl(u,p,b,S,D,O){var F;for(F=3;0<F;--F)as(u,p+=4*b,b,1,16,S,D,O)}function uo(u,p,b,S,D,O){var F;for(F=3;0<F;--F)as(u,p+=4,1,b,16,S,D,O)}function ho(u,p,b,S,D,O,F,V){pi(u,p,D,1,8,O,F,V),pi(b,S,D,1,8,O,F,V)}function Ca(u,p,b,S,D,O,F,V){pi(u,p,1,D,8,O,F,V),pi(b,S,1,D,8,O,F,V)}function Ta(u,p,b,S,D,O,F,V){as(u,p+4*D,D,1,8,O,F,V),as(b,S+4*D,D,1,8,O,F,V)}function fo(u,p,b,S,D,O,F,V){as(u,p+4,1,D,8,O,F,V),as(b,S+4,1,D,8,O,F,V)}function $i(){this.ba=new Hn,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new An,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function fr(){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 mi(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function Hi(){this.ua=0,this.Wa=new re,this.vb=new re,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new Z,this.yc=new T}function Ql(){this.xb=this.a=0,this.l=new ya,this.ca=new Hn,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new E,this.Pb=0,this.wd=new E,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new Hi,this.ab=0,this.gc=o(4,mi),this.Oc=0}function gi(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new ya,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function Ki(u,p,b,S,D,O,F){for(u=u==null?0:u[p+0],p=0;p<F;++p)D[O+p]=u+b[S+p]&255,u=D[O+p]}function po(u,p,b,S,D,O,F){var V;if(u==null)Ki(null,null,b,S,D,O,F);else for(V=0;V<F;++V)D[O+V]=u[p+V]+b[S+V]&255}function Us(u,p,b,S,D,O,F){if(u==null)Ki(null,null,b,S,D,O,F);else{var V,q=u[p+0],K=q,ye=q;for(V=0;V<F;++V)K=ye+(q=u[p+V])-K,ye=b[S+V]+(-256&K?0>K?0:255:K)&255,K=q,D[O+V]=ye}}function La(u,p,b,S){var D=p.width,O=p.o;if(e(u!=null&&p!=null),0>b||0>=S||b+S>O)return null;if(!u.Cc){if(u.ga==null){var F;if(u.ga=new gi,(F=u.ga==null)||(F=p.width*p.o,e(u.Gb.length==0),u.Gb=i(F),u.Uc=0,u.Gb==null?F=0:(u.mb=u.Gb,u.nb=u.Uc,u.rc=null,F=1),F=!F),!F){F=u.ga;var V=u.Fa,q=u.P,K=u.qc,ye=u.mb,Ie=u.nb,Me=q+1,Ae=K-1,Je=F.l;if(e(V!=null&&ye!=null&&p!=null),xo[0]=null,xo[1]=Ki,xo[2]=po,xo[3]=Us,F.ca=ye,F.tb=Ie,F.c=p.width,F.i=p.height,e(0<F.c&&0<F.i),1>=K)p=0;else if(F.$a=V[q+0]>>0&3,F.Z=V[q+0]>>2&3,F.Lc=V[q+0]>>4&3,q=V[q+0]>>6&3,0>F.$a||1<F.$a||4<=F.Z||1<F.Lc||q)p=0;else if(Je.put=Xr,Je.ac=Er,Je.bc=Jr,Je.ma=F,Je.width=p.width,Je.height=p.height,Je.Da=p.Da,Je.v=p.v,Je.va=p.va,Je.j=p.j,Je.o=p.o,F.$a)e:{e(F.$a==1),p=_s();t:for(;;){if(p==null){p=0;break e}if(e(F!=null),F.mc=p,p.c=F.c,p.i=F.i,p.l=F.l,p.l.ma=F,p.l.width=F.c,p.l.height=F.i,p.a=0,G(p.m,V,Me,Ae),!Or(F.c,F.i,1,p,null)||(p.ab==1&&p.gc[0].hc==3&&ci(p.s)?(F.ic=1,V=p.c*p.i,p.Ta=null,p.Ua=0,p.V=i(V),p.Ba=0,p.V==null?(p.a=1,p=0):p=1):(F.ic=0,p=Fi(p,F.c)),!p))break t;p=1;break e}F.mc=null,p=0}else p=Ae>=F.c*F.i;F=!p}if(F)return null;u.ga.Lc!=1?u.Ga=0:S=O-b}e(u.ga!=null),e(b+S<=O);e:{if(p=(V=u.ga).c,O=V.l.o,V.$a==0){if(Me=u.rc,Ae=u.Vc,Je=u.Fa,q=u.P+1+b*p,K=u.mb,ye=u.nb+b*p,e(q<=u.P+u.qc),V.Z!=0)for(e(xo[V.Z]!=null),F=0;F<S;++F)xo[V.Z](Me,Ae,Je,q,K,ye,p),Me=K,Ae=ye,ye+=p,q+=p;else for(F=0;F<S;++F)r(K,ye,Je,q,p),Me=K,Ae=ye,ye+=p,q+=p;u.rc=Me,u.Vc=Ae}else{if(e(V.mc!=null),p=b+S,e((F=V.mc)!=null),e(p<=F.i),F.C>=p)p=1;else if(V.ic||Le(),V.ic){V=F.V,Me=F.Ba,Ae=F.c;var ze=F.i,be=(Je=1,q=F.$/Ae,K=F.$%Ae,ye=F.m,Ie=F.s,F.$),ke=Ae*ze,Ze=Ae*p,Qe=Ie.wc,Xe=be<Ze?Yn(Ie,K,q):null;e(be<=ke),e(p<=ze),e(ci(Ie));t:for(;;){for(;!ye.h&&be<Ze;){if(K&Qe||(Xe=Yn(Ie,K,q)),e(Xe!=null),ue(ye),256>(ze=Sn(Xe.G[0],Xe.H[0],ye)))V[Me+be]=ze,++be,++K>=Ae&&(K=0,++q<=p&&!(q%16)&&$r(F,q));else{if(!(280>ze)){Je=0;break t}ze=is(ze-256,ye);var At,wt=Sn(Xe.G[4],Xe.H[4],ye);if(ue(ye),!(be>=(wt=wn(Ae,wt=is(wt,ye)))&&ke-be>=ze)){Je=0;break t}for(At=0;At<ze;++At)V[Me+be+At]=V[Me+be+At-wt];for(be+=ze,K+=ze;K>=Ae;)K-=Ae,++q<=p&&!(q%16)&&$r(F,q);be<Ze&&K&Qe&&(Xe=Yn(Ie,K,q))}e(ye.h==ee(ye))}$r(F,q>p?p:q);break t}!Je||ye.h&&be<ke?(Je=0,F.a=ye.h?5:3):F.$=be,p=Je}else p=Cr(F,F.V,F.Ba,F.c,F.i,p,As);if(!p){S=0;break e}}b+S>=O&&(u.Cc=1),S=1}if(!S)return null;if(u.Cc&&((S=u.ga)!=null&&(S.mc=null),u.ga=null,0<u.Ga))return alert("todo:WebPDequantizeLevels"),null}return u.nb+b*D}function x(u,p,b,S,D,O){for(;0<D--;){var F,V=u,q=p+(b?1:0),K=u,ye=p+(b?0:3);for(F=0;F<S;++F){var Ie=K[ye+4*F];Ie!=255&&(Ie*=32897,V[q+4*F+0]=V[q+4*F+0]*Ie>>23,V[q+4*F+1]=V[q+4*F+1]*Ie>>23,V[q+4*F+2]=V[q+4*F+2]*Ie>>23)}p+=O}}function L(u,p,b,S,D){for(;0<S--;){var O;for(O=0;O<b;++O){var F=u[p+2*O+0],V=15&(K=u[p+2*O+1]),q=4369*V,K=(240&K|K>>4)*q>>16;u[p+2*O+0]=(240&F|F>>4)*q>>16&240|(15&F|F<<4)*q>>16>>4&15,u[p+2*O+1]=240&K|V}p+=D}}function Q(u,p,b,S,D,O,F,V){var q,K,ye=255;for(K=0;K<D;++K){for(q=0;q<S;++q){var Ie=u[p+q];O[F+4*q]=Ie,ye&=Ie}p+=b,F+=V}return ye!=255}function de(u,p,b,S,D){var O;for(O=0;O<D;++O)b[S+O]=u[p+O]>>8}function Le(){bt=x,Ct=L,Mt=Q,Ft=de}function We(u,p,b){W[u]=function(S,D,O,F,V,q,K,ye,Ie,Me,Ae,Je,ze,be,ke,Ze,Qe){var Xe,At=Qe-1>>1,wt=V[q+0]|K[ye+0]<<16,Wt=Ie[Me+0]|Ae[Je+0]<<16;e(S!=null);var jt=3*wt+Wt+131074>>2;for(p(S[D+0],255&jt,jt>>16,ze,be),O!=null&&(jt=3*Wt+wt+131074>>2,p(O[F+0],255&jt,jt>>16,ke,Ze)),Xe=1;Xe<=At;++Xe){var Pn=V[q+Xe]|K[ye+Xe]<<16,Mn=Ie[Me+Xe]|Ae[Je+Xe]<<16,_n=wt+Pn+Wt+Mn+524296,xn=_n+2*(Pn+Wt)>>3;jt=xn+wt>>1,wt=(_n=_n+2*(wt+Mn)>>3)+Pn>>1,p(S[D+2*Xe-1],255&jt,jt>>16,ze,be+(2*Xe-1)*b),p(S[D+2*Xe-0],255&wt,wt>>16,ze,be+(2*Xe-0)*b),O!=null&&(jt=_n+Wt>>1,wt=xn+Mn>>1,p(O[F+2*Xe-1],255&jt,jt>>16,ke,Ze+(2*Xe-1)*b),p(O[F+2*Xe+0],255&wt,wt>>16,ke,Ze+(2*Xe+0)*b)),wt=Pn,Wt=Mn}1&Qe||(jt=3*wt+Wt+131074>>2,p(S[D+Qe-1],255&jt,jt>>16,ze,be+(Qe-1)*b),O!=null&&(jt=3*Wt+wt+131074>>2,p(O[F+Qe-1],255&jt,jt>>16,ke,Ze+(Qe-1)*b)))}}function tt(){ni[gd]=D4,ni[vd]=q0,ni[O0]=I4,ni[yd]=U0,ni[xd]=z0,ni[Lf]=W0,ni[R0]=M4,ni[Df]=q0,ni[If]=U0,ni[bd]=z0,ni[Mf]=W0}function kt(u){return u&~E4?0>u?0:255:u>>$0}function Rt(u,p){return kt((19077*u>>8)+(26149*p>>8)-14234)}function rn(u,p,b){return kt((19077*u>>8)-(6419*p>>8)-(13320*b>>8)+8708)}function en(u,p){return kt((19077*u>>8)+(33050*p>>8)-17685)}function yn(u,p,b,S,D){S[D+0]=Rt(u,b),S[D+1]=rn(u,p,b),S[D+2]=en(u,p)}function Zn(u,p,b,S,D){S[D+0]=en(u,p),S[D+1]=rn(u,p,b),S[D+2]=Rt(u,b)}function Xn(u,p,b,S,D){var O=rn(u,p,b);p=O<<3&224|en(u,p)>>3,S[D+0]=248&Rt(u,b)|O>>5,S[D+1]=p}function pr(u,p,b,S,D){var O=240&en(u,p)|15;S[D+0]=240&Rt(u,b)|rn(u,p,b)>>4,S[D+1]=O}function Fr(u,p,b,S,D){S[D+0]=255,yn(u,p,b,S,D+1)}function wr(u,p,b,S,D){Zn(u,p,b,S,D),S[D+3]=255}function zs(u,p,b,S,D){yn(u,p,b,S,D),S[D+3]=255}function os(u,p){return 0>u?0:u>p?p:u}function Cs(u,p,b){W[u]=function(S,D,O,F,V,q,K,ye,Ie){for(var Me=ye+(-2&Ie)*b;ye!=Me;)p(S[D+0],O[F+0],V[q+0],K,ye),p(S[D+1],O[F+0],V[q+0],K,ye+b),D+=2,++F,++q,ye+=2*b;1&Ie&&p(S[D+0],O[F+0],V[q+0],K,ye)}}function pl(u,p,b){return b==0?u==0?p==0?6:5:p==0?4:0:b}function mo(u,p,b,S,D){switch(u>>>30){case 3:_e(p,b,S,D,0);break;case 2:ie(p,b,S,D);break;case 1:pe(p,b,S,D)}}function ml(u,p){var b,S,D=p.M,O=p.Nb,F=u.oc,V=u.pc+40,q=u.oc,K=u.pc+584,ye=u.oc,Ie=u.pc+600;for(b=0;16>b;++b)F[V+32*b-1]=129;for(b=0;8>b;++b)q[K+32*b-1]=129,ye[Ie+32*b-1]=129;for(0<D?F[V-1-32]=q[K-1-32]=ye[Ie-1-32]=129:(s(F,V-32-1,127,21),s(q,K-32-1,127,9),s(ye,Ie-32-1,127,9)),S=0;S<u.za;++S){var Me=p.ya[p.aa+S];if(0<S){for(b=-1;16>b;++b)r(F,V+32*b-4,F,V+32*b+12,4);for(b=-1;8>b;++b)r(q,K+32*b-4,q,K+32*b+4,4),r(ye,Ie+32*b-4,ye,Ie+32*b+4,4)}var Ae=u.Gd,Je=u.Hd+S,ze=Me.ad,be=Me.Hc;if(0<D&&(r(F,V-32,Ae[Je].y,0,16),r(q,K-32,Ae[Je].f,0,8),r(ye,Ie-32,Ae[Je].ea,0,8)),Me.Za){var ke=F,Ze=V-32+16;for(0<D&&(S>=u.za-1?s(ke,Ze,Ae[Je].y[15],4):r(ke,Ze,Ae[Je+1].y,0,4)),b=0;4>b;b++)ke[Ze+128+b]=ke[Ze+256+b]=ke[Ze+384+b]=ke[Ze+0+b];for(b=0;16>b;++b,be<<=2)ke=F,Ze=V+K0[b],bi[Me.Ob[b]](ke,Ze),mo(be,ze,16*+b,ke,Ze)}else if(ke=pl(S,D,Me.Ob[0]),yo[ke](F,V),be!=0)for(b=0;16>b;++b,be<<=2)mo(be,ze,16*+b,F,V+K0[b]);for(b=Me.Gc,ke=pl(S,D,Me.Dd),Oa[ke](q,K),Oa[ke](ye,Ie),be=ze,ke=q,Ze=K,255&(Me=b>>0)&&(170&Me?Te(be,256,ke,Ze):je(be,256,ke,Ze)),Me=ye,be=Ie,255&(b>>=8)&&(170&b?Te(ze,320,Me,be):je(ze,320,Me,be)),D<u.Ub-1&&(r(Ae[Je].y,0,F,V+480,16),r(Ae[Je].f,0,q,K+224,8),r(Ae[Je].ea,0,ye,Ie+224,8)),b=8*O*u.B,Ae=u.sa,Je=u.ta+16*S+16*O*u.R,ze=u.qa,Me=u.ra+8*S+b,be=u.Ha,ke=u.Ia+8*S+b,b=0;16>b;++b)r(Ae,Je+b*u.R,F,V+32*b,16);for(b=0;8>b;++b)r(ze,Me+b*u.B,q,K+32*b,8),r(be,ke+b*u.B,ye,Ie+32*b,8)}}function go(u,p,b,S,D,O,F,V,q){var K=[0],ye=[0],Ie=0,Me=q!=null?q.kd:0,Ae=q??new fr;if(u==null||12>b)return 7;Ae.data=u,Ae.w=p,Ae.ha=b,p=[p],b=[b],Ae.gb=[Ae.gb];e:{var Je=p,ze=b,be=Ae.gb;if(e(u!=null),e(ze!=null),e(be!=null),be[0]=0,12<=ze[0]&&!n(u,Je[0],"RIFF")){if(n(u,Je[0]+8,"WEBP")){be=3;break e}var ke=it(u,Je[0]+4);if(12>ke||4294967286<ke){be=3;break e}if(Me&&ke>ze[0]-8){be=7;break e}be[0]=ke,Je[0]+=12,ze[0]-=12}be=0}if(be!=0)return be;for(ke=0<Ae.gb[0],b=b[0];;){e:{var Ze=u;ze=p,be=b;var Qe=K,Xe=ye,At=Je=[0];if((jt=Ie=[Ie])[0]=0,8>be[0])be=7;else{if(!n(Ze,ze[0],"VP8X")){if(it(Ze,ze[0]+4)!=10){be=3;break e}if(18>be[0]){be=7;break e}var wt=it(Ze,ze[0]+8),Wt=1+Ue(Ze,ze[0]+12);if(2147483648<=Wt*(Ze=1+Ue(Ze,ze[0]+15))){be=3;break e}At!=null&&(At[0]=wt),Qe!=null&&(Qe[0]=Wt),Xe!=null&&(Xe[0]=Ze),ze[0]+=18,be[0]-=18,jt[0]=1}be=0}}if(Ie=Ie[0],Je=Je[0],be!=0)return be;if(ze=!!(2&Je),!ke&&Ie)return 3;if(O!=null&&(O[0]=!!(16&Je)),F!=null&&(F[0]=ze),V!=null&&(V[0]=0),F=K[0],Je=ye[0],Ie&&ze&&q==null){be=0;break}if(4>b){be=7;break}if(ke&&Ie||!ke&&!Ie&&!n(u,p[0],"ALPH")){b=[b],Ae.na=[Ae.na],Ae.P=[Ae.P],Ae.Sa=[Ae.Sa];e:{wt=u,be=p,ke=b;var jt=Ae.gb;Qe=Ae.na,Xe=Ae.P,At=Ae.Sa,Wt=22,e(wt!=null),e(ke!=null),Ze=be[0];var Pn=ke[0];for(e(Qe!=null),e(At!=null),Qe[0]=null,Xe[0]=null,At[0]=0;;){if(be[0]=Ze,ke[0]=Pn,8>Pn){be=7;break e}var Mn=it(wt,Ze+4);if(4294967286<Mn){be=3;break e}var _n=8+Mn+1&-2;if(Wt+=_n,0<jt&&Wt>jt){be=3;break e}if(!n(wt,Ze,"VP8 ")||!n(wt,Ze,"VP8L")){be=0;break e}if(Pn[0]<_n){be=7;break e}n(wt,Ze,"ALPH")||(Qe[0]=wt,Xe[0]=Ze+8,At[0]=Mn),Ze+=_n,Pn-=_n}}if(b=b[0],Ae.na=Ae.na[0],Ae.P=Ae.P[0],Ae.Sa=Ae.Sa[0],be!=0)break}b=[b],Ae.Ja=[Ae.Ja],Ae.xa=[Ae.xa];e:if(jt=u,be=p,ke=b,Qe=Ae.gb[0],Xe=Ae.Ja,At=Ae.xa,wt=be[0],Ze=!n(jt,wt,"VP8 "),Wt=!n(jt,wt,"VP8L"),e(jt!=null),e(ke!=null),e(Xe!=null),e(At!=null),8>ke[0])be=7;else{if(Ze||Wt){if(jt=it(jt,wt+4),12<=Qe&&jt>Qe-12){be=3;break e}if(Me&&jt>ke[0]-8){be=7;break e}Xe[0]=jt,be[0]+=8,ke[0]-=8,At[0]=Wt}else At[0]=5<=ke[0]&&jt[wt+0]==47&&!(jt[wt+4]>>5),Xe[0]=ke[0];be=0}if(b=b[0],Ae.Ja=Ae.Ja[0],Ae.xa=Ae.xa[0],p=p[0],be!=0)break;if(4294967286<Ae.Ja)return 3;if(V==null||ze||(V[0]=Ae.xa?2:1),F=[F],Je=[Je],Ae.xa){if(5>b){be=7;break}V=F,Me=Je,ze=O,u==null||5>b?u=0:5<=b&&u[p+0]==47&&!(u[p+4]>>5)?(ke=[0],jt=[0],Qe=[0],G(Xe=new E,u,p,b),qt(Xe,ke,jt,Qe)?(V!=null&&(V[0]=ke[0]),Me!=null&&(Me[0]=jt[0]),ze!=null&&(ze[0]=Qe[0]),u=1):u=0):u=0}else{if(10>b){be=7;break}V=Je,u==null||10>b||!il(u,p+3,b-3)?u=0:(Me=u[p+0]|u[p+1]<<8|u[p+2]<<16,ze=16383&(u[p+7]<<8|u[p+6]),u=16383&(u[p+9]<<8|u[p+8]),1&Me||3<(Me>>1&7)||!(Me>>4&1)||Me>>5>=Ae.Ja||!ze||!u?u=0:(F&&(F[0]=ze),V&&(V[0]=u),u=1))}if(!u||(F=F[0],Je=Je[0],Ie&&(K[0]!=F||ye[0]!=Je)))return 3;q!=null&&(q[0]=Ae,q.offset=p-q.w,e(4294967286>p-q.w),e(q.offset==q.ha-b));break}return be==0||be==7&&Ie&&q==null?(O!=null&&(O[0]|=Ae.na!=null&&0<Ae.na.length),S!=null&&(S[0]=F),D!=null&&(D[0]=Je),0):be}function gl(u,p,b){var S=p.width,D=p.height,O=0,F=0,V=S,q=D;if(p.Da=u!=null&&0<u.Da,p.Da&&(V=u.cd,q=u.bd,O=u.v,F=u.j,11>b||(O&=-2,F&=-2),0>O||0>F||0>=V||0>=q||O+V>S||F+q>D))return 0;if(p.v=O,p.j=F,p.va=O+V,p.o=F+q,p.U=V,p.T=q,p.da=u!=null&&0<u.da,p.da){if(!zt(V,q,b=[u.ib],O=[u.hb]))return 0;p.ib=b[0],p.hb=O[0]}return p.ob=u!=null&&u.ob,p.Kb=u==null||!u.Sd,p.da&&(p.ob=p.ib<3*S/4&&p.hb<3*D/4,p.Kb=0),1}function Gi(u){if(u==null)return 2;if(11>u.S){var p=u.f.RGBA;p.fb+=(u.height-1)*p.A,p.A=-p.A}else p=u.f.kb,u=u.height,p.O+=(u-1)*p.fa,p.fa=-p.fa,p.N+=(u-1>>1)*p.Ab,p.Ab=-p.Ab,p.W+=(u-1>>1)*p.Db,p.Db=-p.Db,p.F!=null&&(p.J+=(u-1)*p.lb,p.lb=-p.lb);return 0}function ls(u,p,b,S){if(S==null||0>=u||0>=p)return 2;if(b!=null){if(b.Da){var D=b.cd,O=b.bd,F=-2&b.v,V=-2&b.j;if(0>F||0>V||0>=D||0>=O||F+D>u||V+O>p)return 2;u=D,p=O}if(b.da){if(!zt(u,p,D=[b.ib],O=[b.hb]))return 2;u=D[0],p=O[0]}}S.width=u,S.height=p;e:{var q=S.width,K=S.height;if(u=S.S,0>=q||0>=K||!(u>=gd&&13>u))u=2;else{if(0>=S.Rd&&S.sd==null){F=O=D=p=0;var ye=(V=q*G0[u])*K;if(11>u||(O=(K+1)/2*(p=(q+1)/2),u==12&&(F=(D=q)*K)),(K=i(ye+2*O+F))==null){u=1;break e}S.sd=K,11>u?((q=S.f.RGBA).eb=K,q.fb=0,q.A=V,q.size=ye):((q=S.f.kb).y=K,q.O=0,q.fa=V,q.Fd=ye,q.f=K,q.N=0+ye,q.Ab=p,q.Cd=O,q.ea=K,q.W=0+ye+O,q.Db=p,q.Ed=O,u==12&&(q.F=K,q.J=0+ye+2*O),q.Tc=F,q.lb=D)}if(p=1,D=S.S,O=S.width,F=S.height,D>=gd&&13>D)if(11>D)u=S.f.RGBA,p&=(V=Math.abs(u.A))*(F-1)+O<=u.size,p&=V>=O*G0[D],p&=u.eb!=null;else{u=S.f.kb,V=(O+1)/2,ye=(F+1)/2,q=Math.abs(u.fa),K=Math.abs(u.Ab);var Ie=Math.abs(u.Db),Me=Math.abs(u.lb),Ae=Me*(F-1)+O;p&=q*(F-1)+O<=u.Fd,p&=K*(ye-1)+V<=u.Cd,p=(p&=Ie*(ye-1)+V<=u.Ed)&q>=O&K>=V&Ie>=V,p&=u.y!=null,p&=u.f!=null,p&=u.ea!=null,D==12&&(p&=Me>=O,p&=Ae<=u.Tc,p&=u.F!=null)}else p=0;u=p?0:2}}return u!=0||b!=null&&b.fd&&(u=Gi(S)),u}var mn=64,vi=[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],Br=24,vo=32,Da=8,es=[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];fe("Predictor0","PredictorAdd0"),W.Predictor0=function(){return 4278190080},W.Predictor1=function(u){return u},W.Predictor2=function(u,p,b){return p[b+0]},W.Predictor3=function(u,p,b){return p[b+1]},W.Predictor4=function(u,p,b){return p[b-1]},W.Predictor5=function(u,p,b){return Oe(Oe(u,p[b+1]),p[b+0])},W.Predictor6=function(u,p,b){return Oe(u,p[b-1])},W.Predictor7=function(u,p,b){return Oe(u,p[b+0])},W.Predictor8=function(u,p,b){return Oe(p[b-1],p[b+0])},W.Predictor9=function(u,p,b){return Oe(p[b+0],p[b+1])},W.Predictor10=function(u,p,b){return Oe(Oe(u,p[b-1]),Oe(p[b+0],p[b+1]))},W.Predictor11=function(u,p,b){var S=p[b+0];return 0>=yt(S>>24&255,u>>24&255,(p=p[b-1])>>24&255)+yt(S>>16&255,u>>16&255,p>>16&255)+yt(S>>8&255,u>>8&255,p>>8&255)+yt(255&S,255&u,255&p)?S:u},W.Predictor12=function(u,p,b){var S=p[b+0];return(Fe((u>>24&255)+(S>>24&255)-((p=p[b-1])>>24&255))<<24|Fe((u>>16&255)+(S>>16&255)-(p>>16&255))<<16|Fe((u>>8&255)+(S>>8&255)-(p>>8&255))<<8|Fe((255&u)+(255&S)-(255&p)))>>>0},W.Predictor13=function(u,p,b){var S=p[b-1];return(et((u=Oe(u,p[b+0]))>>24&255,S>>24&255)<<24|et(u>>16&255,S>>16&255)<<16|et(u>>8&255,S>>8&255)<<8|et(u>>0&255,S>>0&255))>>>0};var yi=W.PredictorAdd0;W.PredictorAdd1=Pt,fe("Predictor2","PredictorAdd2"),fe("Predictor3","PredictorAdd3"),fe("Predictor4","PredictorAdd4"),fe("Predictor5","PredictorAdd5"),fe("Predictor6","PredictorAdd6"),fe("Predictor7","PredictorAdd7"),fe("Predictor8","PredictorAdd8"),fe("Predictor9","PredictorAdd9"),fe("Predictor10","PredictorAdd10"),fe("Predictor11","PredictorAdd11"),fe("Predictor12","PredictorAdd12"),fe("Predictor13","PredictorAdd13");var Ia=W.PredictorAdd2;Qt("ColorIndexInverseTransform","MapARGB","32b",function(u){return u>>8&255},function(u){return u}),Qt("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",function(u){return u},function(u){return u>>8&255});var xi,Nr=W.ColorIndexInverseTransform,Ma=W.MapARGB,h=W.VP8LColorIndexInverseTransformAlpha,y=W.MapAlpha,w=W.VP8LPredictorsAdd=[];w.length=16,(W.VP8LPredictors=[]).length=16,(W.VP8LPredictorsAdd_C=[]).length=16,(W.VP8LPredictors_C=[]).length=16;var A,C,R,H,se,me,we,_e,ie,Te,pe,je,Ce,Se,Ee,Be,Ve,He,rt,ut,st,at,pt,ot,bt,Ct,Mt,Ft,kn=i(511),Ut=i(2041),mr=i(225),lr=i(767),Ea=0,Vr=Ut,ei=mr,ts=lr,ti=kn,gd=0,vd=1,O0=2,yd=3,xd=4,Lf=5,R0=6,Df=7,If=8,bd=9,Mf=10,y4=[2,3,7],x4=[3,3,11],F0=[280,256,256,256,40],b4=[0,1,1,1,0],w4=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],N4=[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],j4=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],S4=8,Ef=[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],Of=[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],eu=null,k4=[[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]],_4=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],B0=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],A4=[[[[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,255,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]]]],P4=[[[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,1,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]]],C4=[[[[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,255,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]]]],T4=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],yo=[],bi=[],Oa=[],L4=1,V0=2,xo=[],ni=[];We("UpsampleRgbLinePair",yn,3),We("UpsampleBgrLinePair",Zn,3),We("UpsampleRgbaLinePair",zs,4),We("UpsampleBgraLinePair",wr,4),We("UpsampleArgbLinePair",Fr,4),We("UpsampleRgba4444LinePair",pr,2),We("UpsampleRgb565LinePair",Xn,2);var D4=W.UpsampleRgbLinePair,I4=W.UpsampleBgrLinePair,q0=W.UpsampleRgbaLinePair,U0=W.UpsampleBgraLinePair,z0=W.UpsampleArgbLinePair,W0=W.UpsampleRgba4444LinePair,M4=W.UpsampleRgb565LinePair,wd=16,Nd=1<<wd-1,tu=-227,Rf=482,$0=6,E4=(256<<$0)-1,H0=0,O4=i(256),R4=i(256),F4=i(256),B4=i(256),V4=i(Rf-tu),q4=i(Rf-tu);Cs("YuvToRgbRow",yn,3),Cs("YuvToBgrRow",Zn,3),Cs("YuvToRgbaRow",zs,4),Cs("YuvToBgraRow",wr,4),Cs("YuvToArgbRow",Fr,4),Cs("YuvToRgba4444Row",pr,2),Cs("YuvToRgb565Row",Xn,2);var K0=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],jd=[0,2,8],U4=[8,7,6,4,4,2,2,2,1,1,1,1],z4=1;this.WebPDecodeRGBA=function(u,p,b,S,D){var O=vd,F=new $i,V=new Hn;F.ba=V,V.S=O,V.width=[V.width],V.height=[V.height];var q=V.width,K=V.height,ye=new ir;if(ye==null||u==null)var Ie=2;else e(ye!=null),Ie=go(u,p,b,ye.width,ye.height,ye.Pd,ye.Qd,ye.format,null);if(Ie!=0?q=0:(q!=null&&(q[0]=ye.width[0]),K!=null&&(K[0]=ye.height[0]),q=1),q){V.width=V.width[0],V.height=V.height[0],S!=null&&(S[0]=V.width),D!=null&&(D[0]=V.height);e:{if(S=new ya,(D=new fr).data=u,D.w=p,D.ha=b,D.kd=1,p=[0],e(D!=null),((u=go(D.data,D.w,D.ha,null,null,null,p,null,D))==0||u==7)&&p[0]&&(u=4),(p=u)==0){if(e(F!=null),S.data=D.data,S.w=D.w+D.offset,S.ha=D.ha-D.offset,S.put=Xr,S.ac=Er,S.bc=Jr,S.ma=F,D.xa){if((u=_s())==null){F=1;break e}if(function(Me,Ae){var Je=[0],ze=[0],be=[0];t:for(;;){if(Me==null)return 0;if(Ae==null)return Me.a=2,0;if(Me.l=Ae,Me.a=0,G(Me.m,Ae.data,Ae.w,Ae.ha),!qt(Me.m,Je,ze,be)){Me.a=3;break t}if(Me.xb=V0,Ae.width=Je[0],Ae.height=ze[0],!Or(Je[0],ze[0],1,Me,null))break t;return 1}return e(Me.a!=0),0}(u,S)){if(S=(p=ls(S.width,S.height,F.Oa,F.ba))==0){t:{S=u;n:for(;;){if(S==null){S=0;break t}if(e(S.s.yc!=null),e(S.s.Ya!=null),e(0<S.s.Wb),e((b=S.l)!=null),e((D=b.ma)!=null),S.xb!=0){if(S.ca=D.ba,S.tb=D.tb,e(S.ca!=null),!gl(D.Oa,b,yd)){S.a=2;break n}if(!Fi(S,b.width)||b.da)break n;if((b.da||xt(S.ca.S))&&Le(),11>S.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),S.ca.f.kb.F!=null&&Le()),S.Pb&&0<S.s.ua&&S.s.vb.X==null&&!It(S.s.vb,S.s.Wa.Xa)){S.a=1;break n}S.xb=0}if(!Cr(S,S.V,S.Ba,S.c,S.i,b.o,li))break n;D.Dc=S.Ma,S=1;break t}e(S.a!=0),S=0}S=!S}S&&(p=u.a)}else p=u.a}else{if((u=new pn)==null){F=1;break e}if(u.Fa=D.na,u.P=D.P,u.qc=D.Sa,al(u,S)){if((p=ls(S.width,S.height,F.Oa,F.ba))==0){if(u.Aa=0,b=F.Oa,e((D=u)!=null),b!=null){if(0<(q=0>(q=b.Md)?0:100<q?255:255*q/100)){for(K=ye=0;4>K;++K)12>(Ie=D.pb[K]).lc&&(Ie.ia=q*U4[0>Ie.lc?0:Ie.lc]>>3),ye|=Ie.ia;ye&&(alert("todo:VP8InitRandom"),D.ia=1)}D.Ga=b.Id,100<D.Ga?D.Ga=100:0>D.Ga&&(D.Ga=0)}xa(u,S)||(p=u.a)}}else p=u.a}p==0&&F.Oa!=null&&F.Oa.fd&&(p=Gi(F.ba))}F=p}O=F!=0?null:11>O?V.f.RGBA.eb:V.f.kb.y}else O=null;return O};var G0=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function d(W,ge){for(var oe="",B=0;B<4;B++)oe+=String.fromCharCode(W[ge++]);return oe}function f(W,ge){return(W[ge+0]<<0|W[ge+1]<<8|W[ge+2]<<16)>>>0}function m(W,ge){return(W[ge+0]<<0|W[ge+1]<<8|W[ge+2]<<16|W[ge+3]<<24)>>>0}new c;var g=[0],v=[0],N=[],j=new c,P=t,k=function(W,ge){var oe={},B=0,T=!1,J=0,Z=0;if(oe.frames=[],!function(z,ee,le,ue){for(var ve=0;ve<ue;ve++)if(z[ee+ve]!=le.charCodeAt(ve))return!0;return!1}(W,ge,"RIFF",4)){for(m(W,ge+=4),ge+=8;ge<W.length;){var Ne=d(W,ge),he=m(W,ge+=4);ge+=4;var ae=he+(1&he);switch(Ne){case"VP8 ":case"VP8L":oe.frames[B]===void 0&&(oe.frames[B]={}),(De=oe.frames[B]).src_off=T?Z:ge-8,De.src_size=J+he+8,B++,T&&(T=!1,J=0,Z=0);break;case"VP8X":(De=oe.header={}).feature_flags=W[ge];var G=ge+4;De.canvas_width=1+f(W,G),G+=3,De.canvas_height=1+f(W,G),G+=3;break;case"ALPH":T=!0,J=ae+8,Z=ge-8;break;case"ANIM":(De=oe.header).bgcolor=m(W,ge),G=ge+4,De.loop_count=($e=W)[(E=G)+0]<<0|$e[E+1]<<8,G+=2;break;case"ANMF":var xe,De;(De=oe.frames[B]={}).offset_x=2*f(W,ge),ge+=3,De.offset_y=2*f(W,ge),ge+=3,De.width=1+f(W,ge),ge+=3,De.height=1+f(W,ge),ge+=3,De.duration=f(W,ge),ge+=3,xe=W[ge++],De.dispose=1&xe,De.blend=xe>>1&1}Ne!="ANMF"&&(ge+=ae)}var $e,E;return oe}}(P,0);k.response=P,k.rgbaoutput=!0,k.dataurl=!1;var _=k.header?k.header:null,M=k.frames?k.frames:null;if(_){_.loop_counter=_.loop_count,g=[_.canvas_height],v=[_.canvas_width];for(var $=0;$<M.length&&M[$].blend!=0;$++);}var Y=M[0],U=j.WebPDecodeRGBA(P,Y.src_off,Y.src_size,v,g);Y.rgba=U,Y.imgwidth=v[0],Y.imgheight=g[0];for(var te=0;te<v[0]*g[0]*4;te++)N[te]=U[te];return this.width=v,this.height=g,this.data=N,this}(function(t){var e=function(){return typeof qm=="function"},n=function(g,v,N,j){var P=4,k=o;switch(j){case t.image_compression.FAST:P=1,k=i;break;case t.image_compression.MEDIUM:P=6,k=l;break;case t.image_compression.SLOW:P=9,k=c}g=r(g,v,N,k);var _=qm(g,{level:P});return t.__addimage__.arrayBufferToBinaryString(_)},r=function(g,v,N,j){for(var P,k,_,M=g.length/v,$=new Uint8Array(g.length+M),Y=f(),U=0;U<M;U+=1){if(_=U*v,P=g.subarray(_,_+v),j)$.set(j(P,N,k),_+U);else{for(var te,W=Y.length,ge=[];te<W;te+=1)ge[te]=Y[te](P,N,k);var oe=m(ge.concat());$.set(ge[oe],_+U)}k=P}return $},s=function(g){var v=Array.apply([],g);return v.unshift(0),v},i=function(g,v){var N,j=[],P=g.length;j[0]=1;for(var k=0;k<P;k+=1)N=g[k-v]||0,j[k+1]=g[k]-N+256&255;return j},o=function(g,v,N){var j,P=[],k=g.length;P[0]=2;for(var _=0;_<k;_+=1)j=N&&N[_]||0,P[_+1]=g[_]-j+256&255;return P},l=function(g,v,N){var j,P,k=[],_=g.length;k[0]=3;for(var M=0;M<_;M+=1)j=g[M-v]||0,P=N&&N[M]||0,k[M+1]=g[M]+256-(j+P>>>1)&255;return k},c=function(g,v,N){var j,P,k,_,M=[],$=g.length;M[0]=4;for(var Y=0;Y<$;Y+=1)j=g[Y-v]||0,P=N&&N[Y]||0,k=N&&N[Y-v]||0,_=d(j,P,k),M[Y+1]=g[Y]-_+256&255;return M},d=function(g,v,N){if(g===v&&v===N)return g;var j=Math.abs(v-N),P=Math.abs(g-N),k=Math.abs(g+v-N-N);return j<=P&&j<=k?g:P<=k?v:N},f=function(){return[s,i,o,l,c]},m=function(g){var v=g.map(function(N){return N.reduce(function(j,P){return j+Math.abs(P)},0)});return v.indexOf(Math.min.apply(null,v))};t.processPNG=function(g,v,N,j){var P,k,_,M,$,Y,U,te,W,ge,oe,B,T,J,Z,Ne=this.decode.FLATE_DECODE,he="";if(this.__addimage__.isArrayBuffer(g)&&(g=new Uint8Array(g)),this.__addimage__.isArrayBufferView(g)){if(g=(_=new T9(g)).imgData,k=_.bits,P=_.colorSpace,$=_.colors,[4,6].indexOf(_.colorType)!==-1){if(_.bits===8){W=(te=_.pixelBitlength==32?new Uint32Array(_.decodePixels().buffer):_.pixelBitlength==16?new Uint16Array(_.decodePixels().buffer):new Uint8Array(_.decodePixels().buffer)).length,oe=new Uint8Array(W*_.colors),ge=new Uint8Array(W);var ae,G=_.pixelBitlength-_.bits;for(J=0,Z=0;J<W;J++){for(T=te[J],ae=0;ae<G;)oe[Z++]=T>>>ae&255,ae+=_.bits;ge[J]=T>>>ae&255}}if(_.bits===16){W=(te=new Uint32Array(_.decodePixels().buffer)).length,oe=new Uint8Array(W*(32/_.pixelBitlength)*_.colors),ge=new Uint8Array(W*(32/_.pixelBitlength)),B=_.colors>1,J=0,Z=0;for(var xe=0;J<W;)T=te[J++],oe[Z++]=T>>>0&255,B&&(oe[Z++]=T>>>16&255,T=te[J++],oe[Z++]=T>>>0&255),ge[xe++]=T>>>16&255;k=8}j!==t.image_compression.NONE&&e()?(g=n(oe,_.width*_.colors,_.colors,j),U=n(ge,_.width,1,j)):(g=oe,U=ge,Ne=void 0)}if(_.colorType===3&&(P=this.color_spaces.INDEXED,Y=_.palette,_.transparency.indexed)){var De=_.transparency.indexed,$e=0;for(J=0,W=De.length;J<W;++J)$e+=De[J];if(($e/=255)===W-1&&De.indexOf(0)!==-1)M=[De.indexOf(0)];else if($e!==W){for(te=_.decodePixels(),ge=new Uint8Array(te.length),J=0,W=te.length;J<W;J++)ge[J]=De[te[J]];U=n(ge,_.width,1)}}var E=function(z){var ee;switch(z){case t.image_compression.FAST:ee=11;break;case t.image_compression.MEDIUM:ee=13;break;case t.image_compression.SLOW:ee=14;break;default:ee=12}return ee}(j);return Ne===this.decode.FLATE_DECODE&&(he="/Predictor "+E+" "),he+="/Colors "+$+" /BitsPerComponent "+k+" /Columns "+_.width,(this.__addimage__.isArrayBuffer(g)||this.__addimage__.isArrayBufferView(g))&&(g=this.__addimage__.arrayBufferToBinaryString(g)),(U&&this.__addimage__.isArrayBuffer(U)||this.__addimage__.isArrayBufferView(U))&&(U=this.__addimage__.arrayBufferToBinaryString(U)),{alias:N,data:g,index:v,filter:Ne,decodeParameters:he,transparency:M,palette:Y,sMask:U,predictor:E,width:_.width,height:_.height,bitsPerComponent:k,colorSpace:P}}}})(Zt.API),function(t){t.processGIF89A=function(e,n,r,s){var i=new L9(e),o=i.width,l=i.height,c=[];i.decodeAndBlitFrameRGBA(0,c);var d={data:c,width:o,height:l},f=new Fp(100).encode(d,100);return t.processJPEG.call(this,f,n,r,s)},t.processGIF87A=t.processGIF89A}(Zt.API),ji.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 t=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(t);for(var e=0;e<t;e++){var n=this.datav.getUint8(this.pos++,!0),r=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0);this.palette[e]={red:s,green:r,blue:n,quad:i}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},ji.prototype.parseBGR=function(){this.pos=this.offset;try{var t="bit"+this.bitPP,e=this.width*this.height*4;this.data=new Uint8Array(e),this[t]()}catch(n){Wn.log("bit decode error:"+n)}},ji.prototype.bit1=function(){var t,e=Math.ceil(this.width/8),n=e%4;for(t=this.height-1;t>=0;t--){for(var r=this.bottom_up?t:this.height-1-t,s=0;s<e;s++)for(var i=this.datav.getUint8(this.pos++,!0),o=r*this.width*4+8*s*4,l=0;l<8&&8*s+l<this.width;l++){var c=this.palette[i>>7-l&1];this.data[o+4*l]=c.blue,this.data[o+4*l+1]=c.green,this.data[o+4*l+2]=c.red,this.data[o+4*l+3]=255}n!==0&&(this.pos+=4-n)}},ji.prototype.bit4=function(){for(var t=Math.ceil(this.width/2),e=t%4,n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,s=0;s<t;s++){var i=this.datav.getUint8(this.pos++,!0),o=r*this.width*4+2*s*4,l=i>>4,c=15&i,d=this.palette[l];if(this.data[o]=d.blue,this.data[o+1]=d.green,this.data[o+2]=d.red,this.data[o+3]=255,2*s+1>=this.width)break;d=this.palette[c],this.data[o+4]=d.blue,this.data[o+4+1]=d.green,this.data[o+4+2]=d.red,this.data[o+4+3]=255}e!==0&&(this.pos+=4-e)}},ji.prototype.bit8=function(){for(var t=this.width%4,e=this.height-1;e>=0;e--){for(var n=this.bottom_up?e:this.height-1-e,r=0;r<this.width;r++){var s=this.datav.getUint8(this.pos++,!0),i=n*this.width*4+4*r;if(s<this.palette.length){var o=this.palette[s];this.data[i]=o.red,this.data[i+1]=o.green,this.data[i+2]=o.blue,this.data[i+3]=255}else this.data[i]=255,this.data[i+1]=255,this.data[i+2]=255,this.data[i+3]=255}t!==0&&(this.pos+=4-t)}},ji.prototype.bit15=function(){for(var t=this.width%3,e=parseInt("11111",2),n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,s=0;s<this.width;s++){var i=this.datav.getUint16(this.pos,!0);this.pos+=2;var o=(i&e)/e*255|0,l=(i>>5&e)/e*255|0,c=(i>>10&e)/e*255|0,d=i>>15?255:0,f=r*this.width*4+4*s;this.data[f]=c,this.data[f+1]=l,this.data[f+2]=o,this.data[f+3]=d}this.pos+=t}},ji.prototype.bit16=function(){for(var t=this.width%3,e=parseInt("11111",2),n=parseInt("111111",2),r=this.height-1;r>=0;r--){for(var s=this.bottom_up?r:this.height-1-r,i=0;i<this.width;i++){var o=this.datav.getUint16(this.pos,!0);this.pos+=2;var l=(o&e)/e*255|0,c=(o>>5&n)/n*255|0,d=(o>>11)/e*255|0,f=s*this.width*4+4*i;this.data[f]=d,this.data[f+1]=c,this.data[f+2]=l,this.data[f+3]=255}this.pos+=t}},ji.prototype.bit24=function(){for(var t=this.height-1;t>=0;t--){for(var e=this.bottom_up?t:this.height-1-t,n=0;n<this.width;n++){var r=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),o=e*this.width*4+4*n;this.data[o]=i,this.data[o+1]=s,this.data[o+2]=r,this.data[o+3]=255}this.pos+=this.width%4}},ji.prototype.bit32=function(){for(var t=this.height-1;t>=0;t--)for(var e=this.bottom_up?t:this.height-1-t,n=0;n<this.width;n++){var r=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),o=this.datav.getUint8(this.pos++,!0),l=e*this.width*4+4*n;this.data[l]=i,this.data[l+1]=s,this.data[l+2]=r,this.data[l+3]=o}},ji.prototype.getData=function(){return this.data},function(t){t.processBMP=function(e,n,r,s){var i=new ji(e,!1),o=i.width,l=i.height,c={data:i.getData(),width:o,height:l},d=new Fp(100).encode(c,100);return t.processJPEG.call(this,d,n,r,s)}}(Zt.API),t2.prototype.getData=function(){return this.data},function(t){t.processWEBP=function(e,n,r,s){var i=new t2(e),o=i.width,l=i.height,c={data:i.getData(),width:o,height:l},d=new Fp(100).encode(c,100);return t.processJPEG.call(this,d,n,r,s)}}(Zt.API),Zt.API.processRGBA=function(t,e,n){for(var r=t.data,s=r.length,i=new Uint8Array(s/4*3),o=new Uint8Array(s/4),l=0,c=0,d=0;d<s;d+=4){var f=r[d],m=r[d+1],g=r[d+2],v=r[d+3];i[l++]=f,i[l++]=m,i[l++]=g,o[c++]=v}var N=this.__addimage__.arrayBufferToBinaryString(i);return{alpha:this.__addimage__.arrayBufferToBinaryString(o),data:N,index:e,alias:n,colorSpace:"DeviceRGB",bitsPerComponent:8,width:t.width,height:t.height}},Zt.API.setLanguage=function(t){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 (Spain)","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"}[t]!==void 0&&(this.internal.languageSettings.languageCode=t,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},lc=Zt.API,$d=lc.getCharWidthsArray=function(t,e){var n,r,s=(e=e||{}).font||this.internal.getFont(),i=e.fontSize||this.internal.getFontSize(),o=e.charSpace||this.internal.getCharSpace(),l=e.widths?e.widths:s.metadata.Unicode.widths,c=l.fof?l.fof:1,d=e.kerning?e.kerning:s.metadata.Unicode.kerning,f=d.fof?d.fof:1,m=e.doKerning!==!1,g=0,v=t.length,N=0,j=l[0]||c,P=[];for(n=0;n<v;n++)r=t.charCodeAt(n),typeof s.metadata.widthOfString=="function"?P.push((s.metadata.widthOfGlyph(s.metadata.characterToGlyph(r))+o*(1e3/i)||0)/1e3):(g=m&&Fn(d[r])==="object"&&!isNaN(parseInt(d[r][N],10))?d[r][N]/f:0,P.push((l[r]||j)/c+g)),N=r;return P},Xy=lc.getStringUnitWidth=function(t,e){var n=(e=e||{}).fontSize||this.internal.getFontSize(),r=e.font||this.internal.getFont(),s=e.charSpace||this.internal.getCharSpace();return lc.processArabic&&(t=lc.processArabic(t)),typeof r.metadata.widthOfString=="function"?r.metadata.widthOfString(t,n,s)/n:$d.apply(this,arguments).reduce(function(i,o){return i+o},0)},Jy=function(t,e,n,r){for(var s=[],i=0,o=t.length,l=0;i!==o&&l+e[i]<n;)l+=e[i],i++;s.push(t.slice(0,i));var c=i;for(l=0;i!==o;)l+e[i]>r&&(s.push(t.slice(c,i)),l=0,c=i),l+=e[i],i++;return c!==i&&s.push(t.slice(c,i)),s},Qy=function(t,e,n){n||(n={});var r,s,i,o,l,c,d,f=[],m=[f],g=n.textIndent||0,v=0,N=0,j=t.split(" "),P=$d.apply(this,[" ",n])[0];if(c=n.lineIndent===-1?j[0].length+2:n.lineIndent||0){var k=Array(c).join(" "),_=[];j.map(function($){($=$.split(/\s*\n/)).length>1?_=_.concat($.map(function(Y,U){return(U&&Y.length?`
`:"")+Y})):_.push($[0])}),j=_,c=Xy.apply(this,[k,n])}for(i=0,o=j.length;i<o;i++){var M=0;if(r=j[i],c&&r[0]==`
`&&(r=r.substr(1),M=1),g+v+(N=(s=$d.apply(this,[r,n])).reduce(function($,Y){return $+Y},0))>e||M){if(N>e){for(l=Jy.apply(this,[r,s,e-(g+v),e]),f.push(l.shift()),f=[l.pop()];l.length;)m.push([l.shift()]);N=s.slice(r.length-(f[0]?f[0].length:0)).reduce(function($,Y){return $+Y},0)}else f=[r];m.push(f),g=N+c,v=P}else f.push(r),g+=v+N,v=P}return d=c?function($,Y){return(Y?k:"")+$.join(" ")}:function($){return $.join(" ")},m.map(d)},lc.splitTextToSize=function(t,e,n){var r,s=(n=n||{}).fontSize||this.internal.getFontSize(),i=(function(f){if(f.widths&&f.kerning)return{widths:f.widths,kerning:f.kerning};var m=this.internal.getFont(f.fontName,f.fontStyle);return m.metadata.Unicode?{widths:m.metadata.Unicode.widths||{0:1},kerning:m.metadata.Unicode.kerning||{}}:{font:m.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,n);r=Array.isArray(t)?t:String(t).split(/\r?\n/);var o=1*this.internal.scaleFactor*e/s;i.textIndent=n.textIndent?1*n.textIndent*this.internal.scaleFactor/s:0,i.lineIndent=n.lineIndent;var l,c,d=[];for(l=0,c=r.length;l<c;l++)d=d.concat(Qy.apply(this,[r[l],o,i]));return d},function(t){t.__fontmetrics__=t.__fontmetrics__||{};for(var e="klmnopqrstuvwxyz",n={},r={},s=0;s<e.length;s++)n[e[s]]="0123456789abcdef"[s],r["0123456789abcdef"[s]]=e[s];var i=function(m){return"0x"+parseInt(m,10).toString(16)},o=t.__fontmetrics__.compress=function(m){var g,v,N,j,P=["{"];for(var k in m){if(g=m[k],isNaN(parseInt(k,10))?v="'"+k+"'":(k=parseInt(k,10),v=(v=i(k).slice(2)).slice(0,-1)+r[v.slice(-1)]),typeof g=="number")g<0?(N=i(g).slice(3),j="-"):(N=i(g).slice(2),j=""),N=j+N.slice(0,-1)+r[N.slice(-1)];else{if(Fn(g)!=="object")throw new Error("Don't know what to do with value type "+Fn(g)+".");N=o(g)}P.push(v+N)}return P.push("}"),P.join("")},l=t.__fontmetrics__.uncompress=function(m){if(typeof m!="string")throw new Error("Invalid argument passed to uncompress.");for(var g,v,N,j,P={},k=1,_=P,M=[],$="",Y="",U=m.length-1,te=1;te<U;te+=1)(j=m[te])=="'"?g?(N=g.join(""),g=void 0):g=[]:g?g.push(j):j=="{"?(M.push([_,N]),_={},N=void 0):j=="}"?((v=M.pop())[0][v[1]]=_,N=void 0,_=v[0]):j=="-"?k=-1:N===void 0?n.hasOwnProperty(j)?($+=n[j],N=parseInt($,16)*k,k=1,$=""):$+=j:n.hasOwnProperty(j)?(Y+=n[j],_[N]=parseInt(Y,16)*k,k=1,N=void 0,Y=""):Y+=j;return P},c={codePages:["WinAnsiEncoding"],WinAnsiEncoding:l("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},d={Unicode:{Courier:c,"Courier-Bold":c,"Courier-BoldOblique":c,"Courier-Oblique":c,Helvetica:c,"Helvetica-Bold":c,"Helvetica-BoldOblique":c,"Helvetica-Oblique":c,"Times-Roman":c,"Times-Bold":c,"Times-BoldItalic":c,"Times-Italic":c}},f={Unicode:{"Courier-Oblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":l("{'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":l("{'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:l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":l("{'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:l("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:l("{'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":l("{'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:l("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":l("{'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":l("{'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":l("{'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}}}")}};t.events.push(["addFont",function(m){var g=m.font,v=f.Unicode[g.postScriptName];v&&(g.metadata.Unicode={},g.metadata.Unicode.widths=v.widths,g.metadata.Unicode.kerning=v.kerning);var N=d.Unicode[g.postScriptName];N&&(g.metadata.Unicode.encoding=N,g.encoding=N.codePages[0])}])}(Zt.API),function(t){var e=function(n){for(var r=n.length,s=new Uint8Array(r),i=0;i<r;i++)s[i]=n.charCodeAt(i);return s};t.API.events.push(["addFont",function(n){var r=void 0,s=n.font,i=n.instance;if(!s.isStandardFont){if(i===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+s.postScriptName+"').");if(typeof(r=i.existsFileInVFS(s.postScriptName)===!1?i.loadFile(s.postScriptName):i.getFileFromVFS(s.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+s.postScriptName+"').");(function(o,l){l=/^\x00\x01\x00\x00/.test(l)?e(l):e(ku(l)),o.metadata=t.API.TTFFont.open(l),o.metadata.Unicode=o.metadata.Unicode||{encoding:{},kerning:{},widths:[]},o.metadata.glyIdsUsed=[0]})(s,r)}}])}(Zt),function(t){function e(){return(Xt.canvg?Promise.resolve(Xt.canvg):eo(()=>import("./index.es-DizRFBzT.js"),__vite__mapDeps([5,2,1,3,4]))).catch(function(n){return Promise.reject(new Error("Could not load canvg: "+n))}).then(function(n){return n.default?n.default:n})}Zt.API.addSvgAsImage=function(n,r,s,i,o,l,c,d){if(isNaN(r)||isNaN(s))throw Wn.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(i)||isNaN(o))throw Wn.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var f=document.createElement("canvas");f.width=i,f.height=o;var m=f.getContext("2d");m.fillStyle="#fff",m.fillRect(0,0,f.width,f.height);var g={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},v=this;return e().then(function(N){return N.fromString(m,n,g)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(N){return N.render(g)}).then(function(){v.addImage(f.toDataURL("image/jpeg",1),r,s,i,o,c,d)})}}(),Zt.API.putTotalPages=function(t){var e,n=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(e=new RegExp(t,"g"),n=this.internal.getNumberOfPages()):(e=new RegExp(this.pdfEscape16(t,this.internal.getFont()),"g"),n=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var r=1;r<=this.internal.getNumberOfPages();r++)for(var s=0;s<this.internal.pages[r].length;s++)this.internal.pages[r][s]=this.internal.pages[r][s].replace(e,n);return this},Zt.API.viewerPreferences=function(t,e){var n;t=t||{},e=e||!1;var r,s,i,o={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(o),c=[],d=0,f=0,m=0;function g(N,j){var P,k=!1;for(P=0;P<N.length;P+=1)N[P]===j&&(k=!0);return k}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(o)),this.internal.viewerpreferences.isSubscribed=!1),n=this.internal.viewerpreferences.configuration,t==="reset"||e===!0){var v=l.length;for(m=0;m<v;m+=1)n[l[m]].value=n[l[m]].defaultValue,n[l[m]].explicitSet=!1}if(Fn(t)==="object"){for(s in t)if(i=t[s],g(l,s)&&i!==void 0){if(n[s].type==="boolean"&&typeof i=="boolean")n[s].value=i;else if(n[s].type==="name"&&g(n[s].valueSet,i))n[s].value=i;else if(n[s].type==="integer"&&Number.isInteger(i))n[s].value=i;else if(n[s].type==="array"){for(d=0;d<i.length;d+=1)if(r=!0,i[d].length===1&&typeof i[d][0]=="number")c.push(String(i[d]-1));else if(i[d].length>1){for(f=0;f<i[d].length;f+=1)typeof i[d][f]!="number"&&(r=!1);r===!0&&c.push([i[d][0]-1,i[d][1]-1].join(" "))}n[s].value="["+c.join(" ")+"]"}else n[s].value=n[s].defaultValue;n[s].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var N,j=[];for(N in n)n[N].explicitSet===!0&&(n[N].type==="name"?j.push("/"+N+" /"+n[N].value):j.push("/"+N+" "+n[N].value));j.length!==0&&this.internal.write(`/ViewerPreferences
<<
`+j.join(`
`)+`
>>`)}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=n,this},function(t){var e=function(){var r='<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>',s=unescape(encodeURIComponent('<x:xmpmeta xmlns:x="adobe:ns:meta/">')),i=unescape(encodeURIComponent(r)),o=unescape(encodeURIComponent(this.internal.__metadata__.metadata)),l=unescape(encodeURIComponent("</jspdf:metadata></rdf:Description></rdf:RDF>")),c=unescape(encodeURIComponent("</x:xmpmeta>")),d=i.length+o.length+l.length+s.length+c.length;this.internal.__metadata__.metadata_object_number=this.internal.newObject(),this.internal.write("<< /Type /Metadata /Subtype /XML /Length "+d+" >>"),this.internal.write("stream"),this.internal.write(s+i+o+l+c),this.internal.write("endstream"),this.internal.write("endobj")},n=function(){this.internal.__metadata__.metadata_object_number&&this.internal.write("/Metadata "+this.internal.__metadata__.metadata_object_number+" 0 R")};t.addMetadata=function(r,s){return this.internal.__metadata__===void 0&&(this.internal.__metadata__={metadata:r,namespaceuri:s||"http://jspdf.default.namespaceuri/"},this.internal.events.subscribe("putCatalog",n),this.internal.events.subscribe("postPutResources",e)),this}}(Zt.API),function(t){var e=t.API,n=e.pdfEscape16=function(i,o){for(var l,c=o.metadata.Unicode.widths,d=["","0","00","000","0000"],f=[""],m=0,g=i.length;m<g;++m){if(l=o.metadata.characterToGlyph(i.charCodeAt(m)),o.metadata.glyIdsUsed.push(l),o.metadata.toUnicode[l]=i.charCodeAt(m),c.indexOf(l)==-1&&(c.push(l),c.push([parseInt(o.metadata.widthOfGlyph(l),10)])),l=="0")return f.join("");l=l.toString(16),f.push(d[4-l.length],l)}return f.join("")},r=function(i){var o,l,c,d,f,m,g;for(f=`/CIDInit /ProcSet findresource begin
12 dict begin
begincmap
/CIDSystemInfo <<
/Registry (Adobe)
/Ordering (UCS)
/Supplement 0
>> def
/CMapName /Adobe-Identity-UCS def
/CMapType 2 def
1 begincodespacerange
<0000><ffff>
endcodespacerange`,c=[],m=0,g=(l=Object.keys(i).sort(function(v,N){return v-N})).length;m<g;m++)o=l[m],c.length>=100&&(f+=`
`+c.length+` beginbfchar
`+c.join(`
`)+`
endbfchar`,c=[]),i[o]!==void 0&&i[o]!==null&&typeof i[o].toString=="function"&&(d=("0000"+i[o].toString(16)).slice(-4),o=("0000"+(+o).toString(16)).slice(-4),c.push("<"+o+"><"+d+">"));return c.length&&(f+=`
`+c.length+` beginbfchar
`+c.join(`
`)+`
endbfchar
`),f+=`endcmap
CMapName currentdict /CMap defineresource pop
end
end`};e.events.push(["putFont",function(i){(function(o){var l=o.font,c=o.out,d=o.newObject,f=o.putStream;if(l.metadata instanceof t.API.TTFFont&&l.encoding==="Identity-H"){for(var m=l.metadata.Unicode.widths,g=l.metadata.subset.encode(l.metadata.glyIdsUsed,1),v="",N=0;N<g.length;N++)v+=String.fromCharCode(g[N]);var j=d();f({data:v,addLength1:!0,objectId:j}),c("endobj");var P=d();f({data:r(l.metadata.toUnicode),addLength1:!0,objectId:P}),c("endobj");var k=d();c("<<"),c("/Type /FontDescriptor"),c("/FontName /"+fc(l.fontName)),c("/FontFile2 "+j+" 0 R"),c("/FontBBox "+t.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 /"+fc(l.fontName)),c("/FontDescriptor "+k+" 0 R"),c("/W "+t.API.PDFObject.convert(m)),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 "+P+" 0 R"),c("/BaseFont /"+fc(l.fontName)),c("/Encoding /"+l.encoding),c("/DescendantFonts ["+_+" 0 R]"),c(">>"),c("endobj"),l.isAlreadyPutted=!0}})(i)}]),e.events.push(["putFont",function(i){(function(o){var l=o.font,c=o.out,d=o.newObject,f=o.putStream;if(l.metadata instanceof t.API.TTFFont&&l.encoding==="WinAnsiEncoding"){for(var m=l.metadata.rawData,g="",v=0;v<m.length;v++)g+=String.fromCharCode(m[v]);var N=d();f({data:g,addLength1:!0,objectId:N}),c("endobj");var j=d();f({data:r(l.metadata.toUnicode),addLength1:!0,objectId:j}),c("endobj");var P=d();c("<<"),c("/Descent "+l.metadata.decender),c("/CapHeight "+l.metadata.capHeight),c("/StemV "+l.metadata.stemV),c("/Type /FontDescriptor"),c("/FontFile2 "+N+" 0 R"),c("/Flags 96"),c("/FontBBox "+t.API.PDFObject.convert(l.metadata.bbox)),c("/FontName /"+fc(l.fontName)),c("/ItalicAngle "+l.metadata.italicAngle),c("/Ascent "+l.metadata.ascender),c(">>"),c("endobj"),l.objectNumber=d();for(var k=0;k<l.metadata.hmtx.widths.length;k++)l.metadata.hmtx.widths[k]=parseInt(l.metadata.hmtx.widths[k]*(1e3/l.metadata.head.unitsPerEm));c("<</Subtype/TrueType/Type/Font/ToUnicode "+j+" 0 R/BaseFont/"+fc(l.fontName)+"/FontDescriptor "+P+" 0 R/Encoding/"+l.encoding+" /FirstChar 29 /LastChar 255 /Widths "+t.API.PDFObject.convert(l.metadata.hmtx.widths)+">>"),c("endobj"),l.isAlreadyPutted=!0}})(i)}]);var s=function(i){var o,l=i.text||"",c=i.x,d=i.y,f=i.options||{},m=i.mutex||{},g=m.pdfEscape,v=m.activeFontKey,N=m.fonts,j=v,P="",k=0,_="",M=N[j].encoding;if(N[j].encoding!=="Identity-H")return{text:l,x:c,y:d,options:f,mutex:m};for(_=l,j=v,Array.isArray(l)&&(_=l[0]),k=0;k<_.length;k+=1)N[j].metadata.hasOwnProperty("cmap")&&(o=N[j].metadata.cmap.unicode.codeMap[_[k].charCodeAt(0)]),o||_[k].charCodeAt(0)<256&&N[j].metadata.hasOwnProperty("Unicode")?P+=_[k]:P+="";var $="";return parseInt(j.slice(1))<14||M==="WinAnsiEncoding"?$=g(P,j).split("").map(function(Y){return Y.charCodeAt(0).toString(16)}).join(""):M==="Identity-H"&&($=n(P,N[j])),m.isHex=!0,{text:$,x:c,y:d,options:f,mutex:m}};e.events.push(["postProcessText",function(i){var o=i.text||"",l=[],c={text:o,x:i.x,y:i.y,options:i.options,mutex:i.mutex};if(Array.isArray(o)){var d=0;for(d=0;d<o.length;d+=1)Array.isArray(o[d])&&o[d].length===3?l.push([s(Object.assign({},c,{text:o[d][0]})).text,o[d][1],o[d][2]]):l.push(s(Object.assign({},c,{text:o[d]})).text);i.text=l}else i.text=s(Object.assign({},c,{text:o})).text}])}(Zt),function(t){var e=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};t.existsFileInVFS=function(n){return e.call(this),this.internal.vFS[n]!==void 0},t.addFileToVFS=function(n,r){return e.call(this),this.internal.vFS[n]=r,this},t.getFileFromVFS=function(n){return e.call(this),this.internal.vFS[n]!==void 0?this.internal.vFS[n]:null}}(Zt.API),function(t){t.__bidiEngine__=t.prototype.__bidiEngine__=function(r){var s,i,o,l,c,d,f,m=e,g=[[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]],v=[[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]],N={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},j={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},P=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],k=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,M=0;this.__bidiEngine__={};var $=function(B){var T=B.charCodeAt(),J=T>>8,Z=j[J];return Z!==void 0?m[256*Z+(255&T)]:J===252||J===253?"AL":k.test(J)?"L":J===8?"R":"N"},Y=function(B){for(var T,J=0;J<B.length;J++){if((T=$(B.charAt(J)))==="L")return!1;if(T==="R")return!0}return!1},U=function(B,T,J,Z){var Ne,he,ae,G,xe=T[Z];switch(xe){case"L":case"R":_=!1;break;case"N":case"AN":break;case"EN":_&&(xe="AN");break;case"AL":_=!0,xe="R";break;case"WS":xe="N";break;case"CS":Z<1||Z+1>=T.length||(Ne=J[Z-1])!=="EN"&&Ne!=="AN"||(he=T[Z+1])!=="EN"&&he!=="AN"?xe="N":_&&(he="AN"),xe=he===Ne?he:"N";break;case"ES":xe=(Ne=Z>0?J[Z-1]:"B")==="EN"&&Z+1<T.length&&T[Z+1]==="EN"?"EN":"N";break;case"ET":if(Z>0&&J[Z-1]==="EN"){xe="EN";break}if(_){xe="N";break}for(ae=Z+1,G=T.length;ae<G&&T[ae]==="ET";)ae++;xe=ae<G&&T[ae]==="EN"?"EN":"N";break;case"NSM":if(o&&!l){for(G=T.length,ae=Z+1;ae<G&&T[ae]==="NSM";)ae++;if(ae<G){var De=B[Z],$e=De>=1425&&De<=2303||De===64286;if(Ne=T[ae],$e&&(Ne==="R"||Ne==="AL")){xe="R";break}}}xe=Z<1||(Ne=T[Z-1])==="B"?"N":J[Z-1];break;case"B":_=!1,s=!0,xe=M;break;case"S":i=!0,xe="N";break;case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":_=!1;break;case"BN":xe="N"}return xe},te=function(B,T,J){var Z=B.split("");return J&&W(Z,J,{hiLevel:M}),Z.reverse(),T&&T.reverse(),Z.join("")},W=function(B,T,J){var Z,Ne,he,ae,G,xe=-1,De=B.length,$e=0,E=[],z=M?v:g,ee=[];for(_=!1,s=!1,i=!1,Ne=0;Ne<De;Ne++)ee[Ne]=$(B[Ne]);for(he=0;he<De;he++){if(G=$e,E[he]=U(B,ee,E,he),Z=240&($e=z[G][N[E[he]]]),$e&=15,T[he]=ae=z[$e][5],Z>0)if(Z===16){for(Ne=xe;Ne<he;Ne++)T[Ne]=1;xe=-1}else xe=-1;if(z[$e][6])xe===-1&&(xe=he);else if(xe>-1){for(Ne=xe;Ne<he;Ne++)T[Ne]=ae;xe=-1}ee[he]==="B"&&(T[he]=0),J.hiLevel|=ae}i&&function(le,ue,ve){for(var Pe=0;Pe<ve;Pe++)if(le[Pe]==="S"){ue[Pe]=M;for(var ce=Pe-1;ce>=0&&le[ce]==="WS";ce--)ue[ce]=M}}(ee,T,De)},ge=function(B,T,J,Z,Ne){if(!(Ne.hiLevel<B)){if(B===1&&M===1&&!s)return T.reverse(),void(J&&J.reverse());for(var he,ae,G,xe,De=T.length,$e=0;$e<De;){if(Z[$e]>=B){for(G=$e+1;G<De&&Z[G]>=B;)G++;for(xe=$e,ae=G-1;xe<ae;xe++,ae--)he=T[xe],T[xe]=T[ae],T[ae]=he,J&&(he=J[xe],J[xe]=J[ae],J[ae]=he);$e=G}$e++}}},oe=function(B,T,J){var Z=B.split(""),Ne={hiLevel:M};return J||(J=[]),W(Z,J,Ne),function(he,ae,G){if(G.hiLevel!==0&&f)for(var xe,De=0;De<he.length;De++)ae[De]===1&&(xe=P.indexOf(he[De]))>=0&&(he[De]=P[xe+1])}(Z,J,Ne),ge(2,Z,T,J,Ne),ge(1,Z,T,J,Ne),Z.join("")};return this.__bidiEngine__.doBidiReorder=function(B,T,J){if(function(Ne,he){if(he)for(var ae=0;ae<Ne.length;ae++)he[ae]=ae;l===void 0&&(l=Y(Ne)),d===void 0&&(d=Y(Ne))}(B,T),o||!c||d)if(o&&c&&l^d)M=l?1:0,B=te(B,T,J);else if(!o&&c&&d)M=l?1:0,B=oe(B,T,J),B=te(B,T);else if(!o||l||c||d){if(o&&!c&&l^d)B=te(B,T),l?(M=0,B=oe(B,T,J)):(M=1,B=oe(B,T,J),B=te(B,T));else if(o&&l&&!c&&d)M=1,B=oe(B,T,J),B=te(B,T);else if(!o&&!c&&l^d){var Z=f;l?(M=1,B=oe(B,T,J),M=0,f=!1,B=oe(B,T,J),f=Z):(M=0,B=oe(B,T,J),B=te(B,T),M=1,f=!1,B=oe(B,T,J),f=Z,B=te(B,T))}}else M=0,B=oe(B,T,J);else M=l?1:0,B=oe(B,T,J);return B},this.__bidiEngine__.setOptions=function(B){B&&(o=B.isInputVisual,c=B.isOutputVisual,l=B.isInputRtl,d=B.isOutputRtl,f=B.isSymmetricSwapping)},this.__bidiEngine__.setOptions(r),this.__bidiEngine__};var e=["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 t.__bidiEngine__({isInputVisual:!0});t.API.events.push(["postProcessText",function(r){var s=r.text;r.x,r.y;var i=r.options||{};r.mutex,i.lang;var o=[];if(i.isInputVisual=typeof i.isInputVisual!="boolean"||i.isInputVisual,n.setOptions(i),Object.prototype.toString.call(s)==="[object Array]"){var l=0;for(o=[],l=0;l<s.length;l+=1)Object.prototype.toString.call(s[l])==="[object Array]"?o.push([n.doBidiReorder(s[l][0]),s[l][1],s[l][2]]):o.push([n.doBidiReorder(s[l])]);r.text=o}else r.text=n.doBidiReorder(s);n.setOptions({isInputVisual:!0})}])}(Zt),Zt.API.TTFFont=function(){function t(e){var n;if(this.rawData=e,n=this.contents=new Xo(e),this.contents.pos=4,n.readString(4)==="ttcf")throw new Error("TTCF not supported.");n.pos=0,this.parse(),this.subset=new H9(this),this.registerTTF()}return t.open=function(e){return new t(e)},t.prototype.parse=function(){return this.directory=new D9(this.contents),this.head=new M9(this),this.name=new B9(this),this.cmap=new g4(this),this.toUnicode={},this.hhea=new E9(this),this.maxp=new V9(this),this.hmtx=new q9(this),this.post=new R9(this),this.os2=new O9(this),this.loca=new $9(this),this.glyf=new U9(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]},t.prototype.registerTTF=function(){var e,n,r,s,i;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=(function(){var o,l,c,d;for(d=[],o=0,l=(c=this.bbox).length;o<l;o++)e=c[o],d.push(Math.round(e*this.scaleFactor));return d}).call(this),this.stemV=0,this.post.exists?(r=255&(s=this.post.italic_angle),32768&(n=s>>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=(i=this.familyClass)===1||i===2||i===3||i===4||i===5||i===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")},t.prototype.characterToGlyph=function(e){var n;return((n=this.cmap.unicode)!=null?n.codeMap[e]:void 0)||0},t.prototype.widthOfGlyph=function(e){var n;return n=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(e).advance*n},t.prototype.widthOfString=function(e,n,r){var s,i,o,l;for(o=0,i=0,l=(e=""+e).length;0<=l?i<l:i>l;i=0<=l?++i:--i)s=e.charCodeAt(i),o+=this.widthOfGlyph(this.characterToGlyph(s))+r*(1e3/n)||0;return o*(n/1e3)},t.prototype.lineHeight=function(e,n){var r;return n==null&&(n=!1),r=n?this.lineGap:0,(this.ascender+r-this.decender)/1e3*e},t}();var Ri,Xo=function(){function t(e){this.data=e??[],this.pos=0,this.length=this.data.length}return t.prototype.readByte=function(){return this.data[this.pos++]},t.prototype.writeByte=function(e){return this.data[this.pos++]=e},t.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},t.prototype.writeUInt32=function(e){return this.writeByte(e>>>24&255),this.writeByte(e>>16&255),this.writeByte(e>>8&255),this.writeByte(255&e)},t.prototype.readInt32=function(){var e;return(e=this.readUInt32())>=2147483648?e-4294967296:e},t.prototype.writeInt32=function(e){return e<0&&(e+=4294967296),this.writeUInt32(e)},t.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},t.prototype.writeUInt16=function(e){return this.writeByte(e>>8&255),this.writeByte(255&e)},t.prototype.readInt16=function(){var e;return(e=this.readUInt16())>=32768?e-65536:e},t.prototype.writeInt16=function(e){return e<0&&(e+=65536),this.writeUInt16(e)},t.prototype.readString=function(e){var n,r;for(r=[],n=0;0<=e?n<e:n>e;n=0<=e?++n:--n)r[n]=String.fromCharCode(this.readByte());return r.join("")},t.prototype.writeString=function(e){var n,r,s;for(s=[],n=0,r=e.length;0<=r?n<r:n>r;n=0<=r?++n:--n)s.push(this.writeByte(e.charCodeAt(n)));return s},t.prototype.readShort=function(){return this.readInt16()},t.prototype.writeShort=function(e){return this.writeInt16(e)},t.prototype.readLongLong=function(){var e,n,r,s,i,o,l,c;return e=this.readByte(),n=this.readByte(),r=this.readByte(),s=this.readByte(),i=this.readByte(),o=this.readByte(),l=this.readByte(),c=this.readByte(),128&e?-1*(72057594037927940*(255^e)+281474976710656*(255^n)+1099511627776*(255^r)+4294967296*(255^s)+16777216*(255^i)+65536*(255^o)+256*(255^l)+(255^c)+1):72057594037927940*e+281474976710656*n+1099511627776*r+4294967296*s+16777216*i+65536*o+256*l+c},t.prototype.writeLongLong=function(e){var n,r;return n=Math.floor(e/4294967296),r=4294967295&e,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)},t.prototype.readInt=function(){return this.readInt32()},t.prototype.writeInt=function(e){return this.writeInt32(e)},t.prototype.read=function(e){var n,r;for(n=[],r=0;0<=e?r<e:r>e;r=0<=e?++r:--r)n.push(this.readByte());return n},t.prototype.write=function(e){var n,r,s,i;for(i=[],r=0,s=e.length;r<s;r++)n=e[r],i.push(this.writeByte(n));return i},t}(),D9=function(){var t;function e(n){var r,s,i;for(this.scalarType=n.readInt(),this.tableCount=n.readShort(),this.searchRange=n.readShort(),this.entrySelector=n.readShort(),this.rangeShift=n.readShort(),this.tables={},s=0,i=this.tableCount;0<=i?s<i:s>i;s=0<=i?++s:--s)r={tag:n.readString(4),checksum:n.readInt(),offset:n.readInt(),length:n.readInt()},this.tables[r.tag]=r}return e.prototype.encode=function(n){var r,s,i,o,l,c,d,f,m,g,v,N,j;for(j in v=Object.keys(n).length,c=Math.log(2),m=16*Math.floor(Math.log(v)/c),o=Math.floor(m/c),f=16*v-m,(s=new Xo).writeInt(this.scalarType),s.writeShort(v),s.writeShort(m),s.writeShort(o),s.writeShort(f),i=16*v,d=s.pos+i,l=null,N=[],n)for(g=n[j],s.writeString(j),s.writeInt(t(g)),s.writeInt(d),s.writeInt(g.length),N=N.concat(g),j==="head"&&(l=d),d+=g.length;d%4;)N.push(0),d++;return s.write(N),r=2981146554-t(s.data),s.pos=l+8,s.writeUInt32(r),s.data},t=function(n){var r,s,i,o;for(n=v4.call(n);n.length%4;)n.push(0);for(i=new Xo(n),s=0,r=0,o=n.length;r<o;r=r+=4)s+=i.readUInt32();return 4294967295&s},e}(),I9={}.hasOwnProperty,fa=function(t,e){for(var n in e)I9.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};Ri=function(){function t(e){var n;this.file=e,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 t.prototype.parse=function(){},t.prototype.encode=function(){},t.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},t}();var M9=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return fa(e,Ri),e.prototype.tag="head",e.prototype.parse=function(n){return n.pos=this.offset,this.version=n.readInt(),this.revision=n.readInt(),this.checkSumAdjustment=n.readInt(),this.magicNumber=n.readInt(),this.flags=n.readShort(),this.unitsPerEm=n.readShort(),this.created=n.readLongLong(),this.modified=n.readLongLong(),this.xMin=n.readShort(),this.yMin=n.readShort(),this.xMax=n.readShort(),this.yMax=n.readShort(),this.macStyle=n.readShort(),this.lowestRecPPEM=n.readShort(),this.fontDirectionHint=n.readShort(),this.indexToLocFormat=n.readShort(),this.glyphDataFormat=n.readShort()},e.prototype.encode=function(n){var r;return(r=new Xo).writeInt(this.version),r.writeInt(this.revision),r.writeInt(this.checkSumAdjustment),r.writeInt(this.magicNumber),r.writeShort(this.flags),r.writeShort(this.unitsPerEm),r.writeLongLong(this.created),r.writeLongLong(this.modified),r.writeShort(this.xMin),r.writeShort(this.yMin),r.writeShort(this.xMax),r.writeShort(this.yMax),r.writeShort(this.macStyle),r.writeShort(this.lowestRecPPEM),r.writeShort(this.fontDirectionHint),r.writeShort(n),r.writeShort(this.glyphDataFormat),r.data},e}(),n2=function(){function t(e,n){var r,s,i,o,l,c,d,f,m,g,v,N,j,P,k,_,M;switch(this.platformID=e.readUInt16(),this.encodingID=e.readShort(),this.offset=n+e.readInt(),m=e.pos,e.pos=this.offset,this.format=e.readUInt16(),this.length=e.readUInt16(),this.language=e.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]=e.readByte();break;case 4:for(v=e.readUInt16(),g=v/2,e.pos+=6,i=function(){var $,Y;for(Y=[],c=$=0;0<=g?$<g:$>g;c=0<=g?++$:--$)Y.push(e.readUInt16());return Y}(),e.pos+=2,j=function(){var $,Y;for(Y=[],c=$=0;0<=g?$<g:$>g;c=0<=g?++$:--$)Y.push(e.readUInt16());return Y}(),d=function(){var $,Y;for(Y=[],c=$=0;0<=g?$<g:$>g;c=0<=g?++$:--$)Y.push(e.readUInt16());return Y}(),f=function(){var $,Y;for(Y=[],c=$=0;0<=g?$<g:$>g;c=0<=g?++$:--$)Y.push(e.readUInt16());return Y}(),s=(this.length-e.pos+this.offset)/2,l=function(){var $,Y;for(Y=[],c=$=0;0<=s?$<s:$>s;c=0<=s?++$:--$)Y.push(e.readUInt16());return Y}(),c=k=0,M=i.length;k<M;c=++k)for(P=i[c],r=_=N=j[c];N<=P?_<=P:_>=P;r=N<=P?++_:--_)f[c]===0?o=r+d[c]:(o=l[f[c]/2+(r-N)-(g-c)]||0)!==0&&(o+=d[c]),this.codeMap[r]=65535&o}e.pos=m}return t.encode=function(e,n){var r,s,i,o,l,c,d,f,m,g,v,N,j,P,k,_,M,$,Y,U,te,W,ge,oe,B,T,J,Z,Ne,he,ae,G,xe,De,$e,E,z,ee,le,ue,ve,Pe,ce,Ye,Ke,Ue;switch(Z=new Xo,o=Object.keys(e).sort(function(it,It){return it-It}),n){case"macroman":for(j=0,P=function(){var it=[];for(N=0;N<256;++N)it.push(0);return it}(),_={0:0},i={},Ne=0,xe=o.length;Ne<xe;Ne++)_[ce=e[s=o[Ne]]]==null&&(_[ce]=++j),i[s]={old:e[s],new:_[e[s]]},P[s]=_[e[s]];return Z.writeUInt16(1),Z.writeUInt16(0),Z.writeUInt32(12),Z.writeUInt16(0),Z.writeUInt16(262),Z.writeUInt16(0),Z.write(P),{charMap:i,subtable:Z.data,maxGlyphID:j+1};case"unicode":for(T=[],m=[],M=0,_={},r={},k=d=null,he=0,De=o.length;he<De;he++)_[Y=e[s=o[he]]]==null&&(_[Y]=++M),r[s]={old:Y,new:_[Y]},l=_[Y]-s,k!=null&&l===d||(k&&m.push(k),T.push(s),d=l),k=s;for(k&&m.push(k),m.push(65535),T.push(65535),oe=2*(ge=T.length),W=2*Math.pow(Math.log(ge)/Math.LN2,2),g=Math.log(W/2)/Math.LN2,te=2*ge-W,c=[],U=[],v=[],N=ae=0,$e=T.length;ae<$e;N=++ae){if(B=T[N],f=m[N],B===65535){c.push(0),U.push(0);break}if(B-(J=r[B].new)>=32768)for(c.push(0),U.push(2*(v.length+ge-N)),s=G=B;B<=f?G<=f:G>=f;s=B<=f?++G:--G)v.push(r[s].new);else c.push(J-B),U.push(0)}for(Z.writeUInt16(3),Z.writeUInt16(1),Z.writeUInt32(12),Z.writeUInt16(4),Z.writeUInt16(16+8*ge+2*v.length),Z.writeUInt16(0),Z.writeUInt16(oe),Z.writeUInt16(W),Z.writeUInt16(g),Z.writeUInt16(te),ve=0,E=m.length;ve<E;ve++)s=m[ve],Z.writeUInt16(s);for(Z.writeUInt16(0),Pe=0,z=T.length;Pe<z;Pe++)s=T[Pe],Z.writeUInt16(s);for(Ye=0,ee=c.length;Ye<ee;Ye++)l=c[Ye],Z.writeUInt16(l);for(Ke=0,le=U.length;Ke<le;Ke++)$=U[Ke],Z.writeUInt16($);for(Ue=0,ue=v.length;Ue<ue;Ue++)j=v[Ue],Z.writeUInt16(j);return{charMap:r,subtable:Z.data,maxGlyphID:M+1}}},t}(),g4=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return fa(e,Ri),e.prototype.tag="cmap",e.prototype.parse=function(n){var r,s,i;for(n.pos=this.offset,this.version=n.readUInt16(),i=n.readUInt16(),this.tables=[],this.unicode=null,s=0;0<=i?s<i:s>i;s=0<=i?++s:--s)r=new n2(n,this.offset),this.tables.push(r),r.isUnicode&&this.unicode==null&&(this.unicode=r);return!0},e.encode=function(n,r){var s,i;return r==null&&(r="macroman"),s=n2.encode(n,r),(i=new Xo).writeUInt16(0),i.writeUInt16(1),s.table=i.data.concat(s.subtable),s},e}(),E9=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return fa(e,Ri),e.prototype.tag="hhea",e.prototype.parse=function(n){return n.pos=this.offset,this.version=n.readInt(),this.ascender=n.readShort(),this.decender=n.readShort(),this.lineGap=n.readShort(),this.advanceWidthMax=n.readShort(),this.minLeftSideBearing=n.readShort(),this.minRightSideBearing=n.readShort(),this.xMaxExtent=n.readShort(),this.caretSlopeRise=n.readShort(),this.caretSlopeRun=n.readShort(),this.caretOffset=n.readShort(),n.pos+=8,this.metricDataFormat=n.readShort(),this.numberOfMetrics=n.readUInt16()},e}(),O9=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return fa(e,Ri),e.prototype.tag="OS/2",e.prototype.parse=function(n){if(n.pos=this.offset,this.version=n.readUInt16(),this.averageCharWidth=n.readShort(),this.weightClass=n.readUInt16(),this.widthClass=n.readUInt16(),this.type=n.readShort(),this.ySubscriptXSize=n.readShort(),this.ySubscriptYSize=n.readShort(),this.ySubscriptXOffset=n.readShort(),this.ySubscriptYOffset=n.readShort(),this.ySuperscriptXSize=n.readShort(),this.ySuperscriptYSize=n.readShort(),this.ySuperscriptXOffset=n.readShort(),this.ySuperscriptYOffset=n.readShort(),this.yStrikeoutSize=n.readShort(),this.yStrikeoutPosition=n.readShort(),this.familyClass=n.readShort(),this.panose=function(){var r,s;for(s=[],r=0;r<10;++r)s.push(n.readByte());return s}(),this.charRange=function(){var r,s;for(s=[],r=0;r<4;++r)s.push(n.readInt());return s}(),this.vendorID=n.readString(4),this.selection=n.readShort(),this.firstCharIndex=n.readShort(),this.lastCharIndex=n.readShort(),this.version>0&&(this.ascent=n.readShort(),this.descent=n.readShort(),this.lineGap=n.readShort(),this.winAscent=n.readShort(),this.winDescent=n.readShort(),this.codePageRange=function(){var r,s;for(s=[],r=0;r<2;r=++r)s.push(n.readInt());return s}(),this.version>1))return this.xHeight=n.readShort(),this.capHeight=n.readShort(),this.defaultChar=n.readShort(),this.breakChar=n.readShort(),this.maxContext=n.readShort()},e}(),R9=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return fa(e,Ri),e.prototype.tag="post",e.prototype.parse=function(n){var r,s,i;switch(n.pos=this.offset,this.format=n.readInt(),this.italicAngle=n.readInt(),this.underlinePosition=n.readShort(),this.underlineThickness=n.readShort(),this.isFixedPitch=n.readInt(),this.minMemType42=n.readInt(),this.maxMemType42=n.readInt(),this.minMemType1=n.readInt(),this.maxMemType1=n.readInt(),this.format){case 65536:break;case 131072:var o;for(s=n.readUInt16(),this.glyphNameIndex=[],o=0;0<=s?o<s:o>s;o=0<=s?++o:--o)this.glyphNameIndex.push(n.readUInt16());for(this.names=[],i=[];n.pos<this.offset+this.length;)r=n.readByte(),i.push(this.names.push(n.readString(r)));return i;case 151552:return s=n.readUInt16(),this.offsets=n.read(s);case 196608:break;case 262144:return this.map=(function(){var l,c,d;for(d=[],o=l=0,c=this.file.maxp.numGlyphs;0<=c?l<c:l>c;o=0<=c?++l:--l)d.push(n.readUInt32());return d}).call(this)}},e}(),F9=function(t,e){this.raw=t,this.length=t.length,this.platformID=e.platformID,this.encodingID=e.encodingID,this.languageID=e.languageID},B9=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return fa(e,Ri),e.prototype.tag="name",e.prototype.parse=function(n){var r,s,i,o,l,c,d,f,m,g,v;for(n.pos=this.offset,n.readShort(),r=n.readShort(),c=n.readShort(),s=[],o=0;0<=r?o<r:o>r;o=0<=r?++o:--o)s.push({platformID:n.readShort(),encodingID:n.readShort(),languageID:n.readShort(),nameID:n.readShort(),length:n.readShort(),offset:this.offset+c+n.readShort()});for(d={},o=m=0,g=s.length;m<g;o=++m)i=s[o],n.pos=i.offset,f=n.readString(i.length),l=new F9(f,i),d[v=i.nameID]==null&&(d[v]=[]),d[i.nameID].push(l);this.strings=d,this.copyright=d[0],this.fontFamily=d[1],this.fontSubfamily=d[2],this.uniqueSubfamily=d[3],this.fontName=d[4],this.version=d[5];try{this.postscriptName=d[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch{this.postscriptName=d[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=d[7],this.manufacturer=d[8],this.designer=d[9],this.description=d[10],this.vendorUrl=d[11],this.designerUrl=d[12],this.license=d[13],this.licenseUrl=d[14],this.preferredFamily=d[15],this.preferredSubfamily=d[17],this.compatibleFull=d[18],this.sampleText=d[19]},e}(),V9=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return fa(e,Ri),e.prototype.tag="maxp",e.prototype.parse=function(n){return n.pos=this.offset,this.version=n.readInt(),this.numGlyphs=n.readUInt16(),this.maxPoints=n.readUInt16(),this.maxContours=n.readUInt16(),this.maxCompositePoints=n.readUInt16(),this.maxComponentContours=n.readUInt16(),this.maxZones=n.readUInt16(),this.maxTwilightPoints=n.readUInt16(),this.maxStorage=n.readUInt16(),this.maxFunctionDefs=n.readUInt16(),this.maxInstructionDefs=n.readUInt16(),this.maxStackElements=n.readUInt16(),this.maxSizeOfInstructions=n.readUInt16(),this.maxComponentElements=n.readUInt16(),this.maxComponentDepth=n.readUInt16()},e}(),q9=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return fa(e,Ri),e.prototype.tag="hmtx",e.prototype.parse=function(n){var r,s,i,o,l,c,d;for(n.pos=this.offset,this.metrics=[],r=0,c=this.file.hhea.numberOfMetrics;0<=c?r<c:r>c;r=0<=c?++r:--r)this.metrics.push({advance:n.readUInt16(),lsb:n.readInt16()});for(i=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=function(){var f,m;for(m=[],r=f=0;0<=i?f<i:f>i;r=0<=i?++f:--f)m.push(n.readInt16());return m}(),this.widths=(function(){var f,m,g,v;for(v=[],f=0,m=(g=this.metrics).length;f<m;f++)o=g[f],v.push(o.advance);return v}).call(this),s=this.widths[this.widths.length-1],d=[],r=l=0;0<=i?l<i:l>i;r=0<=i?++l:--l)d.push(this.widths.push(s));return d},e.prototype.forGlyph=function(n){return n in this.metrics?this.metrics[n]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[n-this.metrics.length]}},e}(),v4=[].slice,U9=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return fa(e,Ri),e.prototype.tag="glyf",e.prototype.parse=function(){return this.cache={}},e.prototype.glyphFor=function(n){var r,s,i,o,l,c,d,f,m,g;return n in this.cache?this.cache[n]:(o=this.file.loca,r=this.file.contents,s=o.indexOf(n),(i=o.lengthOf(n))===0?this.cache[n]=null:(r.pos=this.offset+s,l=(c=new Xo(r.read(i))).readShort(),f=c.readShort(),g=c.readShort(),d=c.readShort(),m=c.readShort(),this.cache[n]=l===-1?new W9(c,f,g,d,m):new z9(c,l,f,g,d,m),this.cache[n]))},e.prototype.encode=function(n,r,s){var i,o,l,c,d;for(l=[],o=[],c=0,d=r.length;c<d;c++)i=n[r[c]],o.push(l.length),i&&(l=l.concat(i.encode(s)));return o.push(l.length),{table:l,offsets:o}},e}(),z9=function(){function t(e,n,r,s,i,o){this.raw=e,this.numberOfContours=n,this.xMin=r,this.yMin=s,this.xMax=i,this.yMax=o,this.compound=!1}return t.prototype.encode=function(){return this.raw.data},t}(),W9=function(){function t(e,n,r,s,i){var o,l;for(this.raw=e,this.xMin=n,this.yMin=r,this.xMax=s,this.yMax=i,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],o=this.raw;l=o.readShort(),this.glyphOffsets.push(o.pos),this.glyphIDs.push(o.readUInt16()),32&l;)o.pos+=1&l?4:2,128&l?o.pos+=8:64&l?o.pos+=4:8&l&&(o.pos+=2)}return t.prototype.encode=function(){var e,n,r;for(n=new Xo(v4.call(this.raw.data)),e=0,r=this.glyphIDs.length;e<r;++e)n.pos=this.glyphOffsets[e];return n.data},t}(),$9=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return fa(e,Ri),e.prototype.tag="loca",e.prototype.parse=function(n){var r,s;return n.pos=this.offset,r=this.file.head.indexToLocFormat,this.offsets=r===0?(function(){var i,o;for(o=[],s=0,i=this.length;s<i;s+=2)o.push(2*n.readUInt16());return o}).call(this):(function(){var i,o;for(o=[],s=0,i=this.length;s<i;s+=4)o.push(n.readUInt32());return o}).call(this)},e.prototype.indexOf=function(n){return this.offsets[n]},e.prototype.lengthOf=function(n){return this.offsets[n+1]-this.offsets[n]},e.prototype.encode=function(n,r){for(var s=new Uint32Array(this.offsets.length),i=0,o=0,l=0;l<s.length;++l)if(s[l]=i,o<r.length&&r[o]==l){++o,s[l]=i;var c=this.offsets[l],d=this.offsets[l+1]-c;d>0&&(i+=d)}for(var f=new Array(4*s.length),m=0;m<s.length;++m)f[4*m+3]=255&s[m],f[4*m+2]=(65280&s[m])>>8,f[4*m+1]=(16711680&s[m])>>16,f[4*m]=(4278190080&s[m])>>24;return f},e}(),H9=function(){function t(e){this.font=e,this.subset={},this.unicodes={},this.next=33}return t.prototype.generateCmap=function(){var e,n,r,s,i;for(n in s=this.font.cmap.tables[0].codeMap,e={},i=this.subset)r=i[n],e[n]=s[r];return e},t.prototype.glyphsFor=function(e){var n,r,s,i,o,l,c;for(s={},o=0,l=e.length;o<l;o++)s[i=e[o]]=this.font.glyf.glyphFor(i);for(i in n=[],s)(r=s[i])!=null&&r.compound&&n.push.apply(n,r.glyphIDs);if(n.length>0)for(i in c=this.glyphsFor(n))r=c[i],s[i]=r;return s},t.prototype.encode=function(e,n){var r,s,i,o,l,c,d,f,m,g,v,N,j,P,k;for(s in r=g4.encode(this.generateCmap(),"unicode"),o=this.glyphsFor(e),v={0:0},k=r.charMap)v[(c=k[s]).old]=c.new;for(N in g=r.maxGlyphID,o)N in v||(v[N]=g++);return f=function(_){var M,$;for(M in $={},_)$[_[M]]=M;return $}(v),m=Object.keys(f).sort(function(_,M){return _-M}),j=function(){var _,M,$;for($=[],_=0,M=m.length;_<M;_++)l=m[_],$.push(f[l]);return $}(),i=this.font.glyf.encode(o,j,v),d=this.font.loca.encode(i.offsets,j),P={cmap:this.font.cmap.raw(),glyf:i.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&&(P["OS/2"]=this.font.os2.raw()),this.font.directory.encode(P)},t}();Zt.API.PDFObject=function(){var t;function e(){}return t=function(n,r){return(Array(r+1).join("0")+n).slice(-r)},e.convert=function(n){var r,s,i,o;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(e.convert(r));return d}().join(" ")+"]";if(typeof n=="string")return"/"+n;if(n!=null&&n.isString)return"("+n+")";if(n instanceof Date)return"(D:"+t(n.getUTCFullYear(),4)+t(n.getUTCMonth(),2)+t(n.getUTCDate(),2)+t(n.getUTCHours(),2)+t(n.getUTCMinutes(),2)+t(n.getUTCSeconds(),2)+"Z)";if({}.toString.call(n)==="[object Object]"){for(s in i=["<<"],n)o=n[s],i.push("/"+s+" "+e.convert(o));return i.push(">>"),i.join(`
`)}return""+n},e}();function K9(){const{user:t}=Ir(),[e,n]=I.useState([]),[r,s]=I.useState(null),[i,o]=I.useState(null),[l,c]=I.useState(!0),[d,f]=I.useState(!0);I.useEffect(()=>{m()},[t]);const m=async()=>{if(t)try{const te=(await Ln.getGoalsByUser(t.id)).filter(W=>W.category==="finance"||W.targetValue&&W.targetValue>0);n(te)}catch(U){console.error("Failed to load goals:",U),St.error("Failed to load goals")}finally{c(!1)}},g=async U=>{const te=U.startingCapital||U.currentValue||1,W=U.targetValue||1e3,ge=new Date,oe=U.targetDate||ss(ge,90),B=Math.max(1,rD(oe,ge)),T=B>1?Math.pow(W/te,1/B)-1:0,J=await Ln.getSpreadsheetDataByGoal(U.id),Z=new Map(J.map(he=>[he.day,he.completed])),Ne=[];for(let he=1;he<=B;he++){const ae=ss(ge,he-1),G=te*Math.pow(1+T,he-1),xe=he===1?te:te*Math.pow(1+T,he-2),De=G-xe,$e=G/W*100,E=Z.get(he)||!1,z={day:he,date:ae,requiredAmount:De,cumulativeAmount:G,completed:E,percentage:$e};Ne.push(z),Z.has(he)||await Ln.saveSpreadsheetData({goalId:U.id,userId:U.userId,...z})}return{goal:U,dailyQuotas:Ne,totalDays:B,dailyGrowthRate:T*100}},v=async U=>{s(U);const te=await g(U);o(te),f(!1)},N=()=>{f(!0),s(null),o(null)},j=async U=>{if(!i||!t)return;const te=i.dailyQuotas[U],W=!te.completed;try{await Ln.updateSpreadsheetData({goalId:i.goal.id,userId:t.id,day:te.day,completed:W});const ge={...i};if(ge.dailyQuotas[U].completed=W,o(ge),St.success(W?"Day marked as complete!":"Day marked as incomplete"),W)await Dl.sendSpreadsheetCompletedNotification(t.id,i.goal.title),await Dl.cancelScheduledNotification(`quota-reminder-${i.goal.id}-${te.day}`);else{const oe=new Date(te.date);oe.setHours(9,0,0,0),oe>new Date&&await Dl.showNotification("Daily Quota Reminder",{body:`Don't forget your daily quota for ${i.goal.title}!`,tag:`quota-reminder-${i.goal.id}-${te.day}`},t.id,"daily_quota")}}catch(ge){console.error("Failed to update completion status:",ge),St.error("Failed to update completion status")}},P=()=>{if(!(!i||!t))try{const U=new Zt,{goal:te,dailyQuotas:W,dailyGrowthRate:ge}=i,oe=U.internal.pageSize.width,B=U.internal.pageSize.height;let T=20;U.setTextColor(0,0,0),U.setFontSize(16),U.setFont("helvetica","bold"),U.text("PROGRESSPULSE",20,T),U.text("GOAL PROGRESS STATEMENT",oe-20,T,{align:"right"}),T+=10,U.setDrawColor(0,0,0),U.setLineWidth(.5),U.line(20,T,oe-20,T),T+=15,U.setFontSize(10),U.setFont("helvetica","normal"),U.text(`Account Holder: ${t.name}`,20,T),U.text(`Statement Date: ${Kn(new Date,"MM/dd/yyyy")}`,oe-20,T,{align:"right"}),T+=8,U.text(`Goal: ${te.title}`,20,T),U.text(`Category: ${te.category.toUpperCase()}`,oe-20,T,{align:"right"}),T+=8,U.text(`Target Amount: ${te.targetValue}${te.unit||""}`,20,T),U.text(`Daily Growth Rate: ${ge.toFixed(2)}%`,oe-20,T,{align:"right"}),T+=20,U.setFontSize(12),U.setFont("helvetica","bold"),U.text("ACCOUNT SUMMARY",20,T),T+=10;const J=[["Total Days",W.length.toString()],["Completed Days",W.filter(xe=>xe.completed).length.toString()],["Completion Rate",`${(W.filter(xe=>xe.completed).length/W.length*100).toFixed(1)}%`],["Current Progress",`${te.targetValue?(te.currentValue/te.targetValue*100).toFixed(1):"0"}%`]],Z=(oe-40)/2;J.forEach((xe,De)=>{De%2===1&&(U.setFillColor(250,250,250),U.rect(20,T-3,oe-40,8,"F")),U.setDrawColor(200,200,200),U.rect(20,T-3,oe-40,8,"S"),U.setTextColor(0,0,0),U.setFontSize(9),U.setFont("helvetica","normal"),U.text(xe[0],22,T+2),U.text(xe[1],22+Z,T+2),U.line(20+Z,T-3,20+Z,T+5),T+=8}),T+=15,U.setFontSize(12),U.setFont("helvetica","bold"),U.text("DAILY QUOTA TRANSACTIONS",20,T),T+=10;const Ne=["Day","Date","Required","Cumulative","Progress","Status"],he=[25,35,35,35,30,30];let ae=20;U.setFillColor(240,240,240),U.rect(20,T-3,oe-40,8,"F"),U.setDrawColor(0,0,0),U.setLineWidth(.1),U.rect(20,T-3,oe-40,8,"S"),U.setTextColor(0,0,0),U.setFontSize(9),U.setFont("helvetica","bold"),Ne.forEach((xe,De)=>{U.text(xe,ae+2,T+2),De<Ne.length-1&&U.line(ae+he[De],T-3,ae+he[De],T+5),ae+=he[De]}),T+=8,U.setFont("helvetica","normal"),U.setFontSize(8),W.forEach((xe,De)=>{T>B-30&&(U.addPage(),T=20,U.setFillColor(240,240,240),U.rect(20,T-3,oe-40,8,"F"),U.setDrawColor(0,0,0),U.rect(20,T-3,oe-40,8,"S"),U.setTextColor(0,0,0),U.setFontSize(9),U.setFont("helvetica","bold"),ae=20,Ne.forEach((E,z)=>{U.text(E,ae+2,T+2),z<Ne.length-1&&U.line(ae+he[z],T-3,ae+he[z],T+5),ae+=he[z]}),T+=8,U.setFont("helvetica","normal"),U.setFontSize(8)),De%2===1&&(U.setFillColor(250,250,250),U.rect(20,T-2,oe-40,6,"F")),U.setDrawColor(200,200,200),U.rect(20,T-2,oe-40,6,"S");const $e=[xe.day.toString(),Kn(xe.date,"MM/dd/yy"),`+${xe.requiredAmount.toFixed(2)}`,xe.cumulativeAmount.toFixed(2),`${xe.percentage.toFixed(1)}%`,xe.completed?"COMPLETE":"PENDING"];ae=20,$e.forEach((E,z)=>{U.setTextColor(0,0,0),z===5&&U.setTextColor(xe.completed?0:100,xe.completed?150:100,xe.completed?0:100),U.text(E,ae+2,T+2),z<$e.length-1&&U.line(ae+he[z],T-2,ae+he[z],T+4),ae+=he[z]}),T+=6});const G=U.internal.pages.length-1;for(let xe=1;xe<=G;xe++)U.setPage(xe),U.setDrawColor(0,0,0),U.setLineWidth(.5),U.line(20,B-20,oe-20,B-20),U.setTextColor(0,0,0),U.setFontSize(8),U.setFont("helvetica","normal"),U.text(`Page ${xe} of ${G}`,oe-20,B-10,{align:"right"}),U.text("ProgressPulse - Goal Progress Tracking Platform",20,B-10);U.save(`${te.title.replace(/[^a-z0-9]/gi,"_").toLowerCase()}-statement.pdf`),St.success("Professional statement exported to PDF!")}catch(U){console.error("Export error:",U),St.error("Failed to export statement")}};if(l)return a.jsx("div",{className:"w-full h-full min-h-screen p-0 m-0",children:a.jsxs("div",{className:"animate-pulse space-y-4 content-section",children:[a.jsx("div",{className:"h-8 bg-muted rounded w-1/3"}),a.jsx("div",{className:"space-y-3",children:[...Array(3)].map((U,te)=>a.jsx("div",{className:"h-20 bg-muted rounded"},te))})]})});if(d)return a.jsxs("div",{className:"w-full h-full min-h-screen p-0 m-0",children:[a.jsxs("div",{className:"content-section",children:[a.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[a.jsx(af,{className:"h-8 w-8"}),"Goal Spreadsheet"]}),a.jsx("p",{className:"text-muted-foreground",children:"Calculate daily quotas and track progress for your goals"})]}),a.jsx("div",{className:"grid gap-4",children:e.length===0?a.jsx(mt,{children:a.jsxs(gt,{className:"flex flex-col items-center justify-center py-12",children:[a.jsx(xr,{className:"h-12 w-12 text-muted-foreground mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No calculable goals found"}),a.jsx("p",{className:"text-muted-foreground text-center mb-4",children:"Create a financial goal or a goal with a target value to use the spreadsheet feature."}),a.jsx(ht,{onClick:()=>window.location.href="/goals",children:"Create Goal"})]})}):e.map((U,te)=>a.jsx(nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:te*.1},children:a.jsx(mt,{className:"cursor-pointer hover:shadow-md transition-all",children:a.jsx(gt,{className:"p-6",onClick:()=>v(U),children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"p-3 rounded-lg bg-primary/10",children:U.category==="finance"?a.jsx(r_,{className:"h-6 w-6 text-primary"}):a.jsx(xr,{className:"h-6 w-6 text-primary"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-lg",children:U.title}),a.jsxs("p",{className:"text-muted-foreground",children:[U.currentValue,U.unit||""," → ",U.targetValue,U.unit||""]}),a.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[a.jsx(Dn,{variant:"outline",className:"capitalize",children:U.category}),a.jsx(Dn,{variant:U.status==="active"?"default":"secondary",children:U.status})]})]})]}),a.jsxs("div",{className:"text-right",children:[a.jsxs("div",{className:"text-2xl font-bold text-primary",children:[(U.currentValue/(U.targetValue||1)*100).toFixed(1),"%"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Complete"})]})]})})})},U.id))})]});if(!i)return null;const{goal:k,dailyQuotas:_,dailyGrowthRate:M}=i,$=_.filter(U=>U.completed).length,Y=$/_.length*100;return a.jsxs("div",{className:"w-full h-full min-h-screen p-0 m-0",children:[a.jsx("div",{className:"space-y-4 content-section",children:a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[a.jsxs(ht,{variant:"outline",onClick:N,className:"w-fit text-sm sm:text-base",children:[a.jsx(zl,{className:"h-4 w-4 mr-2"}),"Back to Goals"]}),a.jsxs("div",{children:[a.jsxs("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:[k.title," Spreadsheet"]}),a.jsx("p",{className:"text-muted-foreground text-sm sm:text-base",children:"Daily quota calculator for reaching your goal"})]})]}),a.jsxs(ht,{onClick:P,className:"w-fit text-sm sm:text-base flex items-center gap-2",children:[a.jsx(ca,{className:"h-4 w-4"}),"Export PDF"]})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[a.jsx(mt,{children:a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(xr,{className:"h-5 w-5 text-blue-500"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Target"}),a.jsxs("p",{className:"font-semibold",children:[k.targetValue,k.unit||""]})]})]})})}),a.jsx(mt,{children:a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(v_,{className:"h-5 w-5 text-green-500"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Daily Growth"}),a.jsxs("p",{className:"font-semibold",children:[M.toFixed(2),"%"]})]})]})})}),a.jsx(mt,{children:a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ys,{className:"h-5 w-5 text-orange-500"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Days Completed"}),a.jsxs("p",{className:"font-semibold",children:[$," / ",_.length]})]})]})})}),a.jsx(mt,{children:a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(oi,{className:"h-5 w-5 text-purple-500"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Completion Rate"}),a.jsxs("p",{className:"font-semibold",children:[Y.toFixed(1),"%"]})]})]})})})]}),a.jsxs(mt,{children:[a.jsx($t,{children:a.jsxs(Ht,{className:"flex items-center gap-2",children:[a.jsx(Jk,{className:"h-5 w-5"}),"Daily Quota Spreadsheet"]})}),a.jsxs(gt,{children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs(GN,{children:[a.jsx(YN,{children:a.jsxs(Om,{children:[a.jsx(Lo,{children:"Day"}),a.jsx(Lo,{children:"Date"}),a.jsx(Lo,{children:"Required Amount"}),a.jsx(Lo,{children:"Cumulative"}),a.jsx(Lo,{children:"Progress %"}),a.jsx(Lo,{children:"Status"}),a.jsx(Lo,{children:"Actions"})]})}),a.jsx(ZN,{children:_.slice(0,30).map((U,te)=>a.jsxs(Om,{className:U.completed?"bg-green-50 dark:bg-green-950/20":"",children:[a.jsx(Do,{className:"font-medium",children:U.day}),a.jsx(Do,{children:Kn(U.date,"MMM dd")}),a.jsxs(Do,{children:["+",U.requiredAmount.toFixed(2),k.unit||""]}),a.jsxs(Do,{className:"font-semibold",children:[U.cumulativeAmount.toFixed(2),k.unit||""]}),a.jsx(Do,{children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex-1 bg-muted rounded-full h-2",children:a.jsx("div",{className:"bg-primary rounded-full h-2 transition-all",style:{width:`${Math.min(U.percentage,100)}%`}})}),a.jsxs("span",{className:"text-sm font-medium",children:[U.percentage.toFixed(1),"%"]})]})}),a.jsx(Do,{children:U.completed?a.jsxs(Dn,{variant:"default",className:"bg-green-500",children:[a.jsx(Io,{className:"h-3 w-3 mr-1"}),"Done"]}):a.jsx(Dn,{variant:"outline",children:"Pending"})}),a.jsx(Do,{children:a.jsx(ht,{variant:"ghost",size:"sm",onClick:()=>j(te),className:"h-8 px-2",children:U.completed?"Undo":"Mark Done"})})]},U.day))})]})}),_.length>30&&a.jsx("div",{className:"text-center py-4 text-muted-foreground",children:"Showing first 30 days. Export to PDF to see all days."})]})]})]})}class G9{constructor(){Tn(this,"canvas");Tn(this,"ctx");this.canvas=document.createElement("canvas"),this.canvas.width=1200,this.canvas.height=800,this.ctx=this.canvas.getContext("2d")}async generateCertificate(e,n){const r=this.ctx,s=this.canvas;r.clearRect(0,0,s.width,s.height);const i=r.createLinearGradient(0,0,s.width,s.height);i.addColorStop(0,"#f8fafc"),i.addColorStop(.5,"#ffffff"),i.addColorStop(1,"#f1f5f9"),r.fillStyle=i,r.fillRect(0,0,s.width,s.height),await this.addBackgroundPattern(r),r.strokeStyle="#1e40af",r.lineWidth=8,r.strokeRect(40,40,s.width-80,s.height-80),r.strokeStyle="#3b82f6",r.lineWidth=2,r.strokeRect(60,60,s.width-120,s.height-120),await this.drawHeaderDecoration(r),r.fillStyle="#1e40af",r.font="bold 48px serif",r.textAlign="center",r.fillText("CERTIFICATE OF ACHIEVEMENT",s.width/2,180),r.fillStyle="#64748b",r.font="24px serif",r.fillText("This is to certify that",s.width/2,230),r.fillStyle="#0f172a",r.font="bold 56px serif",r.fillText(n.name.toUpperCase(),s.width/2,300),r.fillStyle="#64748b",r.font="24px serif",r.fillText("has successfully completed the goal",s.width/2,350),r.fillStyle="#1e40af",r.font="bold 36px serif";const o=this.wrapText(r,e.title,s.width-200);let l=400;return o.forEach(c=>{r.fillText(c,s.width/2,l),l+=45}),l+=20,r.fillStyle="#475569",r.font="20px sans-serif",e.targetValue&&(r.fillText(`Target: ${e.targetValue} ${e.unit||""}`,s.width/2,l),l+=30),r.fillText(`Category: ${e.category.charAt(0).toUpperCase()+e.category.slice(1)}`,s.width/2,l),l+=30,r.fillText(`Completed on: ${Kn(new Date(e.updatedAt),"MMMM dd, yyyy")}`,s.width/2,l),await this.drawAchievementBadge(r,s.width-200,120),await this.drawFooterDecoration(r),r.strokeStyle="#94a3b8",r.lineWidth=2,r.beginPath(),r.moveTo(s.width/2-150,s.height-120),r.lineTo(s.width/2+150,s.height-120),r.stroke(),r.fillStyle="#64748b",r.font="16px sans-serif",r.fillText("ProgressPulse Certification Authority",s.width/2,s.height-100),r.fillText(`Issued: ${Kn(new Date,"MMMM dd, yyyy")}`,s.width/2,s.height-80),s.toDataURL("image/png",1)}async addBackgroundPattern(e){e.strokeStyle="#e2e8f0",e.lineWidth=1,e.globalAlpha=.3;for(let n=0;n<this.canvas.width;n+=60)for(let r=0;r<this.canvas.height;r+=60)e.beginPath(),e.moveTo(n+30,r),e.lineTo(n+60,r+30),e.lineTo(n+30,r+60),e.lineTo(n,r+30),e.closePath(),e.stroke();e.globalAlpha=1}async drawHeaderDecoration(e){const n=this.canvas.width/2;e.fillStyle="#3b82f6",e.beginPath(),e.moveTo(n-200,140),e.lineTo(n-150,120),e.lineTo(n-150,160),e.closePath(),e.fill(),e.beginPath(),e.moveTo(n+200,140),e.lineTo(n+150,120),e.lineTo(n+150,160),e.closePath(),e.fill(),this.drawStar(e,n,140,5,20,10)}async drawAchievementBadge(e,n,r){e.fillStyle="#fbbf24",e.beginPath(),e.arc(n,r,50,0,2*Math.PI),e.fill(),e.fillStyle="#f59e0b",e.beginPath(),e.arc(n,r,42,0,2*Math.PI),e.fill(),e.fillStyle="#ffffff",e.font="bold 40px sans-serif",e.textAlign="center",e.fillText("🏆",n,r+15),e.fillStyle="#92400e",e.font="bold 12px sans-serif",e.fillText("ACHIEVED",n,r+70)}async drawFooterDecoration(e){const n=this.canvas.width/2,r=this.canvas.height-150;e.strokeStyle="#3b82f6",e.lineWidth=3,e.beginPath(),e.moveTo(n-300,r),e.quadraticCurveTo(n-250,r-20,n-200,r),e.quadraticCurveTo(n-150,r+20,n-100,r),e.stroke(),e.beginPath(),e.moveTo(n+300,r),e.quadraticCurveTo(n+250,r-20,n+200,r),e.quadraticCurveTo(n+150,r+20,n+100,r),e.stroke()}drawStar(e,n,r,s,i,o){let l=Math.PI/2*3,c=n,d=r;const f=Math.PI/s;e.fillStyle="#fbbf24",e.beginPath(),e.moveTo(n,r-i);for(let m=0;m<s;m++)c=n+Math.cos(l)*i,d=r+Math.sin(l)*i,e.lineTo(c,d),l+=f,c=n+Math.cos(l)*o,d=r+Math.sin(l)*o,e.lineTo(c,d),l+=f;e.lineTo(n,r-i),e.closePath(),e.fill()}wrapText(e,n,r){const s=n.split(" "),i=[];let o=s[0];for(let l=1;l<s.length;l++){const c=s[l];e.measureText(o+" "+c).width<r?o+=" "+c:(i.push(o),o=c)}return i.push(o),i}downloadCertificate(e,n){const r=document.createElement("a");r.download=`${n.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_certificate.png`,r.href=e,document.body.appendChild(r),r.click(),document.body.removeChild(r)}}const r2=new G9;function Y9(){const{user:t}=Ir(),[e,n]=I.useState([]),[r,s]=I.useState(!0),[i,o]=I.useState(null);I.useEffect(()=>{l()},[t]);const l=async()=>{if(t)try{const g=(await Ln.getGoalsByUser(t.id)).filter(v=>v.status==="completed");n(g)}catch(m){console.error("Failed to load completed goals:",m),St.error("Failed to load completed goals")}finally{s(!1)}},c=async m=>{if(!(i||!t)){o(m.id);try{const g=await r2.generateCertificate(m,t);r2.downloadCertificate(g,m.title),St.success("Certificate downloaded successfully!")}catch(g){console.error("Failed to generate certificate:",g),St.error("Failed to generate certificate")}finally{o(null)}}},d=m=>{switch(m){case"fitness":return"💪";case"learning":return"📚";case"career":return"💼";case"health":return"🏥";case"finance":return"💰";case"personal":return"🌱";case"creative":return"🎨";case"social":return"👥";default:return"🎯"}},f=m=>{switch(m){case"fitness":return"bg-red-500";case"learning":return"bg-blue-500";case"career":return"bg-purple-500";case"health":return"bg-green-500";case"finance":return"bg-yellow-500";case"personal":return"bg-pink-500";case"creative":return"bg-orange-500";case"social":return"bg-indigo-500";default:return"bg-gray-500"}};return r?a.jsx("div",{className:"w-full h-full min-h-screen p-0 m-0",children:a.jsxs("div",{className:"animate-pulse space-y-4 content-section",children:[a.jsx("div",{className:"h-8 bg-muted rounded w-1/3"}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(6)].map((m,g)=>a.jsx("div",{className:"h-64 bg-muted rounded"},g))})]})}):a.jsxs("div",{className:"w-full h-full min-h-screen p-0 m-0",children:[a.jsxs("div",{className:"content-section",children:[a.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[a.jsx(Oo,{className:"h-8 w-8 text-yellow-500"}),"Certificates"]}),a.jsx("p",{className:"text-muted-foreground",children:"Download certificates for your completed goals and celebrate your achievements"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsx(mt,{children:a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 rounded-lg bg-green-100 dark:bg-green-900/20",children:a.jsx(ta,{className:"h-6 w-6 text-green-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold",children:e.length}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Goals Completed"})]})]})})}),a.jsx(mt,{children:a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 rounded-lg bg-blue-100 dark:bg-blue-900/20",children:a.jsx(Iu,{className:"h-6 w-6 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold",children:new Set(e.map(m=>m.category)).size}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Categories Mastered"})]})]})})}),a.jsx(mt,{children:a.jsx(gt,{className:"p-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 rounded-lg bg-purple-100 dark:bg-purple-900/20",children:a.jsx(Oo,{className:"h-6 w-6 text-purple-600"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold",children:e.length}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Certificates Available"})]})]})})})]}),e.length===0?a.jsx(mt,{children:a.jsxs(gt,{className:"flex flex-col items-center justify-center py-12",children:[a.jsx(Oo,{className:"h-16 w-16 text-muted-foreground mb-4"}),a.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No certificates available yet"}),a.jsx("p",{className:"text-muted-foreground text-center mb-6",children:"Complete your goals to earn certificates that you can download and share."}),a.jsxs(ht,{onClick:()=>window.location.href="/goals",children:[a.jsx(xr,{className:"h-4 w-4 mr-2"}),"View Your Goals"]})]})}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:e.map((m,g)=>a.jsx(nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:g*.1},children:a.jsxs(mt,{className:"overflow-hidden hover:shadow-lg transition-all duration-300 border-2 border-transparent hover:border-primary/20",children:[a.jsx("div",{className:`h-2 ${f(m.category)}`}),a.jsx($t,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"text-3xl",children:d(m.category)}),a.jsxs("div",{children:[a.jsx(Dn,{variant:"outline",className:"mb-2 capitalize",children:m.category}),a.jsx(Ht,{className:"text-lg line-clamp-2",children:m.title})]})]}),a.jsx(Io,{className:"h-5 w-5 text-green-500 flex-shrink-0"})]})}),a.jsxs(gt,{className:"space-y-4",children:[m.description&&a.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:m.description}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(xr,{className:"h-4 w-4 text-muted-foreground"}),a.jsxs("span",{children:["Achieved: ",m.currentValue,"/",m.targetValue,m.unit&&` ${m.unit}`]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(ys,{className:"h-4 w-4 text-muted-foreground"}),a.jsxs("span",{children:["Completed: ",Kn(new Date(m.updatedAt),"MMM dd, yyyy")]})]})]}),a.jsx("div",{className:"pt-2",children:a.jsx(ht,{onClick:()=>c(m),disabled:i===m.id,className:"w-full",children:i===m.id?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Generating..."]}):a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ca,{className:"h-4 w-4"}),"Download Certificate"]})})})]})]})},m.id))}),a.jsx(mt,{className:"bg-gradient-to-r from-primary/5 to-primary/10 border-primary/20",children:a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:a.jsx(Oo,{className:"h-6 w-6 text-primary"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"font-semibold text-lg mb-2",children:"About Your Certificates"}),a.jsx("p",{className:"text-muted-foreground mb-4",children:"Each certificate is uniquely generated for your completed goals and includes:"}),a.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Io,{className:"h-4 w-4 text-green-500"}),"Your name and goal achievement details"]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Io,{className:"h-4 w-4 text-green-500"}),"Completion date and unique certificate ID"]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Io,{className:"h-4 w-4 text-green-500"}),"Professional design suitable for sharing"]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(Io,{className:"h-4 w-4 text-green-500"}),"PNG format for easy printing and sharing"]})]})]})]})})})]})}const Wa=[{id:"welcome",title:"Welcome to ProgressPulse!",description:"Let's take a quick tour of the app to help you get started with tracking your goals and achievements.",icon:a.jsx(Ic,{className:"h-8 w-8"})},{id:"dashboard",title:"Dashboard Overview",description:"Your dashboard shows a summary of all your goals, recent progress, and key metrics at a glance.",icon:a.jsx(Dc,{className:"h-8 w-8"}),route:"/dashboard",highlight:"main-content"},{id:"goals",title:"Manage Your Goals",description:"Create, edit, and track your personal goals. Set targets, deadlines, and categorize them for better organization.",icon:a.jsx(xr,{className:"h-8 w-8"}),route:"/goals",highlight:"goals-section"},{id:"progress",title:"Track Progress",description:"Log your daily progress with notes and photos. See your journey unfold with detailed tracking.",icon:a.jsx(Dc,{className:"h-8 w-8"}),route:"/progress",highlight:"progress-section"},{id:"calendar",title:"Calendar View",description:"View your progress and milestones in a calendar format. Perfect for seeing patterns and planning ahead.",icon:a.jsx(ys,{className:"h-8 w-8"}),route:"/calendar",highlight:"calendar-view"},{id:"achievements",title:"Celebrate Achievements",description:"Unlock badges and achievements as you complete goals and maintain streaks. Celebrate your wins!",icon:a.jsx(ta,{className:"h-8 w-8"}),route:"/achievements",highlight:"achievements-section"},{id:"spreadsheet",title:"Financial Goal Spreadsheet",description:"For financial goals, use our advanced spreadsheet calculator to determine daily quotas and compound growth.",icon:a.jsx(af,{className:"h-8 w-8"}),route:"/spreadsheet",highlight:"spreadsheet-feature"},{id:"certificates",title:"Download Certificates",description:"Generate and download professional certificates for your completed goals. Perfect for sharing achievements!",icon:a.jsx(Oo,{className:"h-8 w-8"}),route:"/certificates",highlight:"certificates-section"},{id:"notifications",title:"Stay Updated",description:"Receive notifications for daily reminders, milestone achievements, and important updates.",icon:a.jsx(Ci,{className:"h-8 w-8"}),route:"/notifications",highlight:"notifications-button"},{id:"profile",title:"Manage Your Profile",description:"Update your profile information, preferences, and account settings. Enable two-factor authentication for security.",icon:a.jsx(Hc,{className:"h-8 w-8"}),route:"/profile",highlight:"profile-menu"},{id:"settings",title:"Customize Settings",description:"Personalize your experience with theme settings, notification preferences, and reminder times.",icon:a.jsx(Du,{className:"h-8 w-8"}),route:"/settings",highlight:"settings-section"},{id:"complete",title:"You're All Set!",description:"You've completed the tutorial! Start creating your first goal and begin your progress tracking journey.",icon:a.jsx(xr,{className:"h-8 w-8"})}];function Z9(){const[t,e]=I.useState(0),[n,r]=I.useState(!0),s=so(),i=Wa[t],o=()=>{t<Wa.length-1?e(t+1):d()},l=()=>{t>0&&e(t-1)},c=()=>{s("/dashboard")},d=()=>{s("/dashboard")},f=g=>{e(g)},m=()=>{const g=Wa[t];g.route&&s(g.route)};return n?a.jsx("div",{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",children:a.jsx("div",{className:"flex items-center justify-center min-h-screen p-4",children:a.jsx(zo,{mode:"wait",children:a.jsx(nt.div,{initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:-20},transition:{duration:.3},className:"w-full max-w-2xl",children:a.jsx(mt,{className:"border-2 border-primary/20 shadow-2xl",children:a.jsxs(gt,{className:"p-8",children:[a.jsxs("div",{className:"flex items-start justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"p-3 rounded-full bg-primary/10 text-primary",children:i.icon}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-bold",children:i.title}),a.jsxs(Dn,{variant:"outline",className:"mt-1",children:["Step ",t+1," of ",Wa.length]})]})]}),a.jsx(ht,{variant:"ghost",size:"sm",onClick:c,className:"text-muted-foreground hover:text-foreground",children:a.jsx(rd,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"mb-8",children:a.jsx("p",{className:"text-lg text-muted-foreground leading-relaxed",children:i.description})}),a.jsxs("div",{className:"mb-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-2",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Progress"}),a.jsxs("span",{className:"text-sm font-medium",children:[Math.round((t+1)/Wa.length*100),"%"]})]}),a.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:a.jsx(nt.div,{className:"bg-primary rounded-full h-2",initial:{width:0},animate:{width:`${(t+1)/Wa.length*100}%`},transition:{duration:.5}})})]}),a.jsx("div",{className:"flex flex-wrap gap-2 mb-8",children:Wa.map((g,v)=>a.jsx("button",{onClick:()=>f(v),className:`w-3 h-3 rounded-full transition-all ${v===t?"bg-primary scale-125":v<t?"bg-primary/60":"bg-muted hover:bg-muted-foreground/20"}`},g.id))}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(ht,{variant:"outline",onClick:l,disabled:t===0,className:"flex items-center gap-2",children:[a.jsx(zl,{className:"h-4 w-4"}),"Previous"]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(ht,{variant:"ghost",onClick:c,className:"text-muted-foreground",children:"Skip Tutorial"}),a.jsx(ht,{onClick:o,className:"flex items-center gap-2",children:t===Wa.length-1?a.jsxs(a.Fragment,{children:["Get Started",a.jsx(Ic,{className:"h-4 w-4"})]}):a.jsxs(a.Fragment,{children:["Next",a.jsx(Gk,{className:"h-4 w-4"})]})})]})]}),i.route&&t>0&&t<Wa.length-1&&a.jsxs(nt.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},className:"mt-6 p-4 bg-primary/5 rounded-lg border border-primary/20",children:[a.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["💡 ",a.jsx("strong",{children:"Tip:"})," This step covers the ",i.title.toLowerCase()," section. Click the button below to view the actual page while following the tutorial."]}),a.jsxs(ht,{variant:"outline",size:"sm",onClick:m,className:"w-full",children:["View ",i.title]})]})]})})},t)})})}):null}function X9(){const{user:t}=Ir(),[e,n]=I.useState("unknown"),[r,s]=I.useState(null),[i,o]=I.useState("unknown");I.useEffect(()=>{const c=()=>{const f=!!(window.median||window.cordova||window.PhoneGap||navigator.userAgent.includes("wv")||navigator.userAgent.includes("Median"));n(f?"native":"web")},d=async()=>{try{const f=await cc.requestPermission();o(f?"granted":"denied");const m=await cc.getToken();s(m)}catch(f){console.error("Failed to initialize notifications:",f),o("error")}};c(),d()},[]);const l=[{id:"goal_completed",title:"Test Goal Completion",action:()=>Dl.sendGoalCompletedNotification((t==null?void 0:t.id)||"test","Test Goal"),description:"Tests goal completion notification"},{id:"daily_reminder",title:"Test Daily Reminder",action:()=>cc.sendDailyReminderNotification((t==null?void 0:t.id)||"test","Don't forget to update your progress!"),description:"Tests daily reminder notification"},{id:"progress_update",title:"Test Progress Update",action:()=>cc.sendProgressUpdateNotification((t==null?void 0:t.id)||"test","Test Goal",75),description:"Tests progress update notification"},{id:"streak_notification",title:"Test Streak Alert",action:()=>cc.sendStreakNotification((t==null?void 0:t.id)||"test",7),description:"Tests streak notification"},{id:"custom_notification",title:"Test Custom Notification",action:()=>Dl.showNotification("🧪 Test Notification",{body:"This is a test notification to verify push notifications work in both web and APK!",tag:"test-notification",requireInteraction:!0},t==null?void 0:t.id,"test"),description:"Tests custom notification"}];return a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("h1",{className:"text-3xl font-bold",children:"Push Notification Test"}),a.jsx("p",{className:"text-muted-foreground",children:"Test push notifications for both web and native APK environments"})]}),a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsx(Ht,{children:"Environment Information"}),a.jsx(cn,{children:"Current app environment and notification status"})]}),a.jsxs(gt,{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-medium",children:"Environment:"}),a.jsx(Dn,{variant:e==="native"?"default":"secondary",children:e.toUpperCase()})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-medium",children:"Permission Status:"}),a.jsx(Dn,{variant:i==="granted"?"default":"destructive",children:i.toUpperCase()})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"font-medium",children:"FCM Token:"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:r?`${r.substring(0,20)}...`:"Not available"})]}),a.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Web:"})," Uses Firebase Web SDK + Service Workers"]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Native:"})," Uses Median.co native push API + Firebase"]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Note:"})," APK notifications will only work after conversion via Median.co"]})]})]})]}),a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsx(Ht,{children:"Test Notifications"}),a.jsx(cn,{children:"Click any button below to test different types of notifications"})]}),a.jsxs(gt,{children:[a.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:l.map(c=>a.jsxs("div",{className:"space-y-2",children:[a.jsx(ht,{onClick:c.action,className:"w-full",disabled:i!=="granted",children:c.title}),a.jsx("p",{className:"text-sm text-muted-foreground",children:c.description})]},c.id))}),i!=="granted"&&a.jsx("div",{className:"mt-4 p-4 bg-yellow-50 dark:bg-yellow-900/20 rounded-lg",children:a.jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200",children:"⚠️ Notification permission is required to test push notifications. Please allow notifications when prompted."})})]})]}),a.jsxs(mt,{children:[a.jsx($t,{children:a.jsx(Ht,{children:"Testing Instructions"})}),a.jsxs(gt,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium",children:"For Web Testing:"}),a.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1 ml-4",children:[a.jsx("li",{children:"• Click any test button above"}),a.jsx("li",{children:"• Notifications should appear in your browser"}),a.jsx("li",{children:"• Check browser console for debug information"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"font-medium",children:"For APK Testing (after Median.co conversion):"}),a.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1 ml-4",children:[a.jsx("li",{children:"• Install the APK on your Android device"}),a.jsx("li",{children:"• Open the app and navigate to this test page"}),a.jsx("li",{children:"• Click test buttons - notifications should appear as native Android notifications"}),a.jsx("li",{children:'• Environment should show "NATIVE" instead of "WEB"'})]})]}),a.jsx("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg",children:a.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["💡 ",a.jsx("strong",{children:"Pro Tip:"})," The same notification code works for both web and APK. The system automatically detects the environment and uses the appropriate method."]})})]})]})]})}const s2=[{id:"getting-started",title:"Getting Started",icon:a.jsx(xr,{className:"h-5 w-5"}),content:[{title:"Creating Your First Goal",description:"Learn how to set up and track your first goal in ProgressPulse.",steps:["Navigate to the Goals page",'Click "Create New Goal"',"Fill in your goal details (title, category, target)","Set a target date and priority level","Choose a color theme for your goal",'Click "Create Goal" to save']},{title:"Understanding Goal Categories",description:"Different goal types and how to use them effectively.",steps:["Fitness: Track workouts, running distance, weight loss","Learning: Monitor study hours, courses completed, skills acquired","Career: Professional development, certifications, promotions","Health: Medical appointments, medication tracking, wellness goals","Finance: Savings targets, investment goals, debt reduction","Personal: Habits, hobbies, personal development","Creative: Art projects, writing goals, creative challenges","Social: Networking, relationships, community involvement"]}]},{id:"tracking-progress",title:"Tracking Progress",icon:a.jsx(Dc,{className:"h-5 w-5"}),content:[{title:"Daily Progress Logging",description:"How to effectively log your daily progress.",steps:["Go to the Progress page",'Click "Add Progress" for your goal',"Enter the amount of progress made","Add notes about your experience","Upload photos if relevant","Save your progress entry"]},{title:"Progress Visualization",description:"Understanding your progress charts and metrics.",steps:["View progress charts on the dashboard","Check completion percentages","Monitor daily, weekly, and monthly trends","Identify patterns in your progress","Use insights to adjust your approach"]}]},{id:"financial-goals",title:"Financial Goal Spreadsheet",icon:a.jsx(af,{className:"h-5 w-5"}),content:[{title:"Setting Up Financial Goals",description:"How to use the advanced spreadsheet calculator for financial goals.",steps:['Create a goal with "Finance" category',"Set your starting capital amount","Define your target value","Choose your target date","Set daily growth rate percentage","The system calculates daily quotas automatically"]},{title:"Using the Spreadsheet",description:"Navigate and use the financial spreadsheet effectively.",steps:["Access the Spreadsheet page","Select your financial goal","View daily quota requirements","Mark days as complete when targets are met","Track cumulative progress","Export spreadsheet as PDF for records"]}]},{id:"achievements",title:"Achievements & Certificates",icon:a.jsx(ta,{className:"h-5 w-5"}),content:[{title:"Unlocking Achievements",description:"How the achievement system works.",steps:["Complete goals to unlock achievements","Maintain streaks for streak-based badges","Reach milestones for milestone achievements","View all achievements on the Achievements page","Share your achievements with others"]},{title:"Downloading Certificates",description:"Generate professional certificates for completed goals.",steps:["Complete a goal successfully","Go to the Certificates page","Select the completed goal",'Click "Generate Certificate"',"Download as high-quality PNG image","Share or print your certificate"]}]},{id:"notifications",title:"Notifications & Reminders",icon:a.jsx(Ci,{className:"h-5 w-5"}),content:[{title:"Setting Up Notifications",description:"Configure push notifications and reminders.",steps:["Go to Settings page","Enable notifications permission","Set your preferred reminder time","Choose notification types to receive","Configure daily quota reminders","Set milestone achievement alerts"]},{title:"Managing Notifications",description:"View and manage your notification history.",steps:["Access the Notifications page","View recent notifications","Mark notifications as read","Delete unwanted notifications","Filter by notification type","Clear all notifications at once"]}]},{id:"security",title:"Account Security",icon:a.jsx(Bo,{className:"h-5 w-5"}),content:[{title:"Biometric Authentication",description:"Secure your account with PIN or fingerprint.",steps:["Go to Profile page",'Click "Setup Biometric Auth"',"Setup 4-digit PIN or fingerprint","Confirm your setup","Use PIN/fingerprint when opening app","Manage settings in Profile page"]},{title:"Account Management",description:"Manage your account settings and data.",steps:["Update profile information","Change password regularly","Review login activity","Export your data if needed","Delete account if necessary"]}]}],i2=[{question:"How do I reset my password?",answer:"You can change your password in the Profile page under Security settings. Enter your current password and set a new one."},{question:"Can I export my data?",answer:"Yes, you can export progress reports as professional PDF statements from the header menu, or export all data from Profile settings."},{question:"How does progress tracking work?",answer:"Create goals with target values, then log progress entries with values and notes. The app automatically calculates completion percentages and shows visual progress."},{question:"Why am I not receiving notifications?",answer:"Make sure you have granted notification permissions in your browser and enabled notifications in the Settings page. The app supports both web and native push notifications."},{question:"Can I change my goal after creating it?",answer:"Yes, you can edit most goal properties by clicking the edit button on your goal card. However, changing target values may affect your progress calculations."},{question:"How do achievements work?",answer:"Achievements are automatically unlocked based on your progress. Complete goals, maintain streaks, and reach milestones to unlock different badges and certificates."}];function a2(){const t=so();return a.jsxs("div",{className:"container mx-auto px-4 py-6 max-w-4xl",children:[a.jsxs("div",{className:"flex items-center gap-4 mb-8",children:[a.jsxs(ht,{variant:"outline",onClick:()=>t(-1),children:[a.jsx(zl,{className:"h-4 w-4 mr-2"}),"Back"]}),a.jsxs("div",{children:[a.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[a.jsx(Zk,{className:"h-8 w-8 text-primary"}),"Documentation"]}),a.jsx("p",{className:"text-muted-foreground",children:"Complete guide to using ProgressPulse effectively"})]})]}),a.jsxs(mt,{className:"mb-8",children:[a.jsxs($t,{children:[a.jsx(Ht,{children:"Quick Navigation"}),a.jsx(cn,{children:"Jump to specific sections"})]}),a.jsx(gt,{children:a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:s2.map(e=>a.jsx(ht,{variant:"outline",className:"justify-start h-auto p-3",onClick:()=>{const n=document.getElementById(e.id);n==null||n.scrollIntoView({behavior:"smooth"})},children:a.jsxs("div",{className:"flex items-center gap-2",children:[e.icon,a.jsx("span",{className:"text-sm",children:e.title})]})},e.id))})})]}),a.jsx("div",{className:"space-y-8",children:s2.map((e,n)=>a.jsx(nt.div,{id:e.id,initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:n*.1},children:a.jsxs(mt,{children:[a.jsx($t,{children:a.jsxs(Ht,{className:"flex items-center gap-3",children:[e.icon,e.title]})}),a.jsx(gt,{className:"space-y-6",children:e.content.map((r,s)=>a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold mb-2",children:r.title}),a.jsx("p",{className:"text-muted-foreground mb-4",children:r.description}),a.jsx("ol",{className:"list-decimal list-inside space-y-2 ml-4",children:r.steps.map((i,o)=>a.jsx("li",{className:"text-sm",children:i},o))}),s<e.content.length-1&&a.jsx(Wc,{className:"mt-6"})]},s))})]})},e.id))}),a.jsx(nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.6},className:"mt-12",children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center gap-3",children:[a.jsx(e_,{className:"h-5 w-5"}),"Frequently Asked Questions"]}),a.jsx(cn,{children:"Common questions and answers about ProgressPulse"})]}),a.jsx(gt,{className:"space-y-6",children:i2.map((e,n)=>a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold mb-2",children:e.question}),a.jsx("p",{className:"text-muted-foreground text-sm",children:e.answer}),n<i2.length-1&&a.jsx(Wc,{className:"mt-4"})]},n))})]})}),a.jsx(nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.7},className:"mt-8",children:a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsx(Ht,{children:"Need More Help?"}),a.jsx(cn,{children:"Additional resources and support options"})]}),a.jsx(gt,{children:a.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[a.jsx(ht,{variant:"outline",className:"h-auto p-4 justify-start",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(a_,{className:"h-5 w-5"}),a.jsxs("div",{className:"text-left",children:[a.jsx("div",{className:"font-medium",children:"Video Tutorials"}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Watch step-by-step guides"})]})]})}),a.jsx(ht,{variant:"outline",className:"h-auto p-4 justify-start",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ca,{className:"h-5 w-5"}),a.jsxs("div",{className:"text-left",children:[a.jsx("div",{className:"font-medium",children:"Download Guide"}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Get the complete PDF guide"})]})]})})]})})]})})]})}function o2(){return so(),a.jsxs("div",{className:"container mx-auto p-6 max-w-4xl space-y-6",children:[a.jsxs("div",{className:"flex items-center space-x-4 mb-6",children:[a.jsxs(ht,{variant:"ghost",size:"sm",onClick:()=>window.close(),children:[a.jsx(zl,{className:"h-4 w-4 mr-2"}),"Close"]}),a.jsxs("div",{children:[a.jsxs("h1",{className:"text-3xl font-bold flex items-center",children:[a.jsx(Bo,{className:"h-8 w-8 mr-3 text-primary"}),"Privacy Policy"]}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"How we protect and handle your personal information"})]})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(sf,{className:"h-5 w-5 mr-2"}),"Information We Collect"]}),a.jsx(cn,{children:"What data we collect and how we use it"})]}),a.jsxs(gt,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Personal Information"}),a.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1 ml-4",children:[a.jsx("li",{children:"• Name and email address (for account creation)"}),a.jsx("li",{children:"• Profile information you choose to provide"}),a.jsx("li",{children:"• Goals and progress data you create"}),a.jsx("li",{children:"• Usage analytics to improve the app"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Technical Information"}),a.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1 ml-4",children:[a.jsx("li",{children:"• Device information and browser type"}),a.jsx("li",{children:"• IP address and location data"}),a.jsx("li",{children:"• App usage patterns and performance data"}),a.jsx("li",{children:"• Push notification tokens"})]})]})]})]}),a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(n_,{className:"h-5 w-5 mr-2"}),"Data Storage & Security"]}),a.jsx(cn,{children:"How we store and protect your information"})]}),a.jsxs(gt,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Local Storage"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Your data is primarily stored locally on your device using encrypted IndexedDB. This ensures your information remains private and accessible offline."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"No Cloud Storage"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"All your data stays on your device. We don't store your personal information on external servers, ensuring complete privacy."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Security Measures"}),a.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1 ml-4",children:[a.jsx("li",{children:"• End-to-end encryption for sensitive data"}),a.jsx("li",{children:"• Secure HTTPS connections"}),a.jsx("li",{children:"• Regular security audits and updates"}),a.jsx("li",{children:"• No third-party data sharing"})]})]})]})]}),a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(__,{className:"h-5 w-5 mr-2"}),"Your Rights"]}),a.jsx(cn,{children:"What you can do with your personal data"})]}),a.jsx(gt,{className:"space-y-4",children:a.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Access & Export"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Download all your data in a portable format anytime from your profile settings."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Delete Account"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Permanently delete your account and all associated data with one click."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Data Correction"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Update or correct your personal information directly in the app."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Opt-out"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Disable analytics, notifications, or other optional features anytime."})]})]})})]}),a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(c_,{className:"h-5 w-5 mr-2"}),"Third-Party Services"]}),a.jsx(cn,{children:"External services we use and their privacy implications"})]}),a.jsxs(gt,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Telegram Bot"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Support messages are sent via Telegram bot for customer service. Only support inquiries are transmitted."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"No Analytics"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"We don't use any analytics or tracking services. Your usage patterns remain completely private."})]})]})]}),a.jsxs(mt,{children:[a.jsx($t,{children:a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(Uo,{className:"h-5 w-5 mr-2"}),"Contact & Updates"]})}),a.jsxs(gt,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Privacy Questions"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"If you have questions about this privacy policy or how we handle your data, please contact us through the app's support section."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Policy Updates"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"We may update this privacy policy occasionally. You'll be notified of significant changes through the app or email."})]}),a.jsxs("div",{className:"text-xs text-muted-foreground pt-4 border-t",children:[a.jsxs("p",{children:["Last updated: ",new Date().toLocaleDateString()]}),a.jsx("p",{children:"Version: 1.0"})]})]})]})]})]})}function l2(){return so(),a.jsxs("div",{className:"container mx-auto p-6 max-w-4xl space-y-6",children:[a.jsxs("div",{className:"flex items-center space-x-4 mb-6",children:[a.jsxs(ht,{variant:"ghost",size:"sm",onClick:()=>window.close(),children:[a.jsx(zl,{className:"h-4 w-4 mr-2"}),"Close"]}),a.jsxs("div",{children:[a.jsxs("h1",{className:"text-3xl font-bold flex items-center",children:[a.jsx(Sc,{className:"h-8 w-8 mr-3 text-primary"}),"Terms of Service"]}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"Terms and conditions for using ProgressPulse"})]})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(b_,{className:"h-5 w-5 mr-2"}),"Acceptance of Terms"]}),a.jsx(cn,{children:"By using ProgressPulse, you agree to these terms"})]}),a.jsxs(gt,{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:'By accessing and using ProgressPulse ("the App"), you accept and agree to be bound by the terms and provision of this agreement. If you do not agree to abide by the above, please do not use this service.'}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Eligibility"}),a.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1 ml-4",children:[a.jsx("li",{children:"• You must be at least 13 years old to use this app"}),a.jsx("li",{children:"• You must provide accurate and complete information"}),a.jsx("li",{children:"• You are responsible for maintaining account security"}),a.jsx("li",{children:"• One account per person"})]})]})]})]}),a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(A_,{className:"h-5 w-5 mr-2"}),"User Responsibilities"]}),a.jsx(cn,{children:"What we expect from our users"})]}),a.jsxs(gt,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Acceptable Use"}),a.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1 ml-4",children:[a.jsx("li",{children:"• Use the app for personal goal tracking only"}),a.jsx("li",{children:"• Do not share inappropriate or harmful content"}),a.jsx("li",{children:"• Respect other users and their privacy"}),a.jsx("li",{children:"• Do not attempt to hack or exploit the app"}),a.jsx("li",{children:"• Follow all applicable laws and regulations"})]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Account Security"}),a.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1 ml-4",children:[a.jsx("li",{children:"• Keep your login credentials secure"}),a.jsx("li",{children:"• Notify us immediately of any security breaches"}),a.jsx("li",{children:"• You are responsible for all activity on your account"}),a.jsx("li",{children:"• Use strong, unique passwords"})]})]})]})]}),a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(l_,{className:"h-5 w-5 mr-2"}),"Service Availability"]}),a.jsx(cn,{children:"What you can expect from our service"})]}),a.jsxs(gt,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Service Provision"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"We strive to provide reliable service but cannot guarantee 100% uptime. The app may be temporarily unavailable for maintenance or updates."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Local Data Storage"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Your data is stored locally on your device. You are responsible for maintaining backups of important data. Use the export feature to backup your progress."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Feature Changes"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"We may add, modify, or remove features at any time. We'll notify users of significant changes that affect functionality."})]})]})]}),a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(S_,{className:"h-5 w-5 mr-2"}),"Limitations & Disclaimers"]}),a.jsx(cn,{children:"Important limitations of our service"})]}),a.jsxs(gt,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Disclaimer of Warranties"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:'The app is provided "as is" without warranties of any kind. We do not guarantee that the service will be error-free or uninterrupted.'})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"Limitation of Liability"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"We shall not be liable for any indirect, incidental, special, or consequential damages resulting from the use or inability to use the app."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"User Content"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"You retain full ownership of your content. All data stays on your device. You are responsible for the content you create and its backup."})]})]})]}),a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsx(Ht,{children:"Termination"}),a.jsx(cn,{children:"How accounts can be terminated"})]}),a.jsxs(gt,{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"By You"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"You may delete your account at any time from the app settings. This will permanently remove all your data."})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold mb-2",children:"By Us"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"We may terminate accounts that violate these terms or engage in harmful behavior. We'll provide notice when possible."})]})]})]}),a.jsxs(mt,{children:[a.jsx($t,{children:a.jsx(Ht,{children:"Changes to Terms"})}),a.jsxs(gt,{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"We may update these terms from time to time. Significant changes will be communicated through the app or email. Continued use after changes constitutes acceptance."}),a.jsxs("div",{className:"text-xs text-muted-foreground pt-4 border-t",children:[a.jsxs("p",{children:["Last updated: ",new Date().toLocaleDateString()]}),a.jsx("p",{children:"Version: 1.0"}),a.jsxs("p",{children:["Effective date: ",new Date().toLocaleDateString()]})]})]})]})]})]})}function c2(){so();const t=[{version:"1.0.0",date:"2024-12-20",type:"major",title:"Initial Release",description:"The first stable release of ProgressPulse with all core features.",changes:[{type:"feature",text:"Complete goal tracking system with categories and priorities"},{type:"feature",text:"Interactive analytics dashboard with charts and insights"},{type:"feature",text:"Achievement system with unlockable badges"},{type:"feature",text:"Calendar view for progress visualization"},{type:"feature",text:"PWA support with offline functionality"},{type:"feature",text:"Professional PDF export for progress reports"},{type:"feature",text:"Dark/light theme support with system detection"},{type:"feature",text:"Local data storage with IndexedDB"},{type:"feature",text:"Biometric authentication (PIN and fingerprint)"},{type:"feature",text:"Telegram bot integration for support"}]}],e=r=>{switch(r){case"feature":return a.jsx(Ai,{className:"h-4 w-4 text-green-500"});case"fix":return a.jsx(Xk,{className:"h-4 w-4 text-red-500"});case"improvement":return a.jsx(Yk,{className:"h-4 w-4 text-blue-500"});default:return a.jsx(Ic,{className:"h-4 w-4 text-yellow-500"})}},n=r=>{switch(r){case"major":return a.jsx(Dn,{variant:"default",children:"Major"});case"minor":return a.jsx(Dn,{variant:"secondary",children:"Minor"});case"patch":return a.jsx(Dn,{variant:"outline",children:"Patch"});default:return a.jsx(Dn,{variant:"outline",children:"Release"})}};return a.jsxs("div",{className:"container mx-auto p-6 max-w-4xl space-y-6",children:[a.jsxs("div",{className:"flex items-center space-x-4 mb-6",children:[a.jsxs(ht,{variant:"ghost",size:"sm",onClick:()=>window.close(),children:[a.jsx(zl,{className:"h-4 w-4 mr-2"}),"Close"]}),a.jsxs("div",{children:[a.jsxs("h1",{className:"text-3xl font-bold flex items-center",children:[a.jsx(N_,{className:"h-8 w-8 mr-3 text-primary"}),"Release Notes"]}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"Latest updates and improvements to ProgressPulse"})]})]}),a.jsx("div",{className:"space-y-6",children:t.map((r,s)=>a.jsxs(mt,{className:s===0?"border-primary":"",children:[a.jsxs($t,{children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(Ht,{className:"flex items-center space-x-3",children:[a.jsxs("span",{className:"text-2xl font-bold",children:["v",r.version]}),n(r.type),s===0&&a.jsx(Dn,{variant:"default",children:"Latest"})]}),a.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[a.jsx(ys,{className:"h-4 w-4 mr-1"}),new Date(r.date).toLocaleDateString()]})]}),a.jsxs(cn,{className:"text-base",children:[a.jsx("strong",{children:r.title})," - ",r.description]})]}),a.jsx(gt,{children:a.jsxs("div",{className:"space-y-3",children:[a.jsx("h4",{className:"font-semibold text-sm uppercase tracking-wide text-muted-foreground",children:"What's Changed"}),a.jsx("div",{className:"space-y-2",children:r.changes.map((i,o)=>a.jsxs("div",{className:"flex items-start space-x-3",children:[e(i.type),a.jsx("span",{className:"text-sm flex-1",children:i.text})]},o))})]})})]},r.version))}),a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsxs(Ht,{className:"flex items-center",children:[a.jsx(Ic,{className:"h-5 w-5 mr-2"}),"Coming Soon"]}),a.jsx(cn,{children:"Features we're working on for future releases"})]}),a.jsx(gt,{children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx(Ai,{className:"h-4 w-4 text-green-500 mt-0.5"}),a.jsx("span",{className:"text-sm",children:"Enhanced notification system"})]}),a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx(Ai,{className:"h-4 w-4 text-green-500 mt-0.5"}),a.jsx("span",{className:"text-sm",children:"Goal templates and presets"})]}),a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx(Ai,{className:"h-4 w-4 text-green-500 mt-0.5"}),a.jsx("span",{className:"text-sm",children:"Data import/export improvements"})]}),a.jsxs("div",{className:"flex items-start space-x-3",children:[a.jsx(Ai,{className:"h-4 w-4 text-green-500 mt-0.5"}),a.jsx("span",{className:"text-sm",children:"Advanced progress analytics"})]})]})})]}),a.jsx("div",{className:"text-center text-sm text-muted-foreground",children:a.jsx("p",{children:"Have suggestions for new features? Let us know through the support section!"})})]})}function u2(){so();const[t,e]=I.useState({name:"",email:"",subject:"",message:"",category:"general"}),[n,r]=I.useState(""),s=[{category:"Getting Started",questions:[{question:"How do I create my first goal?",answer:'Navigate to the Goals page and click "Add Goal". Fill in the details like title, target value, deadline, and category. You can also set daily targets and reminders.'},{question:"Can I use the app offline?",answer:"Yes! ProgressPulse is a Progressive Web App (PWA) that works offline. Your data is stored locally and will sync when you're back online."},{question:"How do I track my progress?",answer:"Go to the Progress page and select a goal. You can log progress with values, notes, and even attach images. The app will automatically calculate your progress percentage."}]},{category:"Features",questions:[{question:"What types of goals can I track?",answer:"You can track various goal types including fitness, learning, finance, health, career, and personal goals. Each category has specific features tailored to that goal type."},{question:"How do push notifications work?",answer:"Push notifications work in both web browsers and native mobile apps. You can set daily reminders, milestone celebrations, and progress updates. Make sure to allow notifications when prompted."},{question:"Can I export my data?",answer:"Yes! You can export your progress data as PDF reports from the header menu, or export all your data from the Profile settings."}]},{category:"Technical",questions:[{question:"Why aren't my notifications working?",answer:"Check that you've allowed notifications in your browser/device settings. For mobile apps, ensure the app has notification permissions. Try refreshing the page or restarting the app."},{question:"My data isn't syncing. What should I do?",answer:"Check your internet connection. The app shows your online status in the header. If you're online but data isn't syncing, try refreshing the page."},{question:"How do I install the app on my phone?",answer:`For web: Use your browser's "Add to Home Screen" option. For native apps: Download the APK from our website or app store when available.`}]}],i=async c=>{const d="8366110415:AAGqQ0qoae1fHF7-lCSt6e1isjoOFrqG3ys";try{const m=await(await fetch(`https://api.telegram.org/bot${d}/getUpdates`)).json();if(console.log("Bot updates:",m),!m.ok||!m.result||m.result.length===0)throw new Error("No chat found. Please send a message to @retrieval1bot first, then try again.");const g=m.result[m.result.length-1].message.chat.id;console.log("Using chat ID:",g);const v=`🆘 New Support Request - ProgressPulse
👤 Name: ${c.name}
📧 Email: ${c.email}
📂 Category: ${c.category}
📝 Subject: ${c.subject}
💬 Message:
${c.message}
⏰ Submitted: ${new Date().toLocaleString()}`,N=await fetch(`https://api.telegram.org/bot${d}/sendMessage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({chat_id:g,text:v})}),j=await N.json();if(console.log("Send message result:",j),!N.ok)throw new Error(j.description||"Failed to send message");return!0}catch(f){throw console.error("Telegram error:",f),f}},o=s.map(c=>({...c,questions:c.questions.filter(d=>d.question.toLowerCase().includes(n.toLowerCase())||d.answer.toLowerCase().includes(n.toLowerCase()))})).filter(c=>c.questions.length>0),l=async c=>{if(c.preventDefault(),!t.name||!t.email||!t.subject||!t.message){St.error("Please fill in all required fields.");return}const d=St.loading("Sending your message...");try{await i(t),St.dismiss(d),St.success("Support request submitted! We'll get back to you within 24 hours."),e({name:"",email:"",subject:"",message:"",category:"general"})}catch(f){console.error("Support form error:",f),St.dismiss(d),St.error(f instanceof Error?f.message:"Failed to send message. Please try again.")}};return a.jsxs("div",{className:"container mx-auto p-6 max-w-4xl space-y-6",children:[a.jsxs("div",{className:"flex items-center space-x-4 mb-6",children:[a.jsxs(ht,{variant:"ghost",size:"sm",onClick:()=>window.close(),children:[a.jsx(zl,{className:"h-4 w-4 mr-2"}),"Close"]}),a.jsxs("div",{children:[a.jsxs("h1",{className:"text-3xl font-bold flex items-center",children:[a.jsx(Lu,{className:"h-8 w-8 mr-3 text-primary"}),"Help & Support"]}),a.jsx("p",{className:"text-muted-foreground mt-1",children:"Get help with ProgressPulse or contact our support team"})]})]}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-4 mb-8",children:[a.jsx(mt,{className:"text-center",children:a.jsxs(gt,{className:"pt-6",children:[a.jsx(Wx,{className:"h-8 w-8 mx-auto mb-2 text-primary"}),a.jsx("h3",{className:"font-semibold mb-1",children:"Response Time"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Usually within 24 hours"})]})}),a.jsx(mt,{className:"text-center",children:a.jsxs(gt,{className:"pt-6",children:[a.jsx(Hx,{className:"h-8 w-8 mx-auto mb-2 text-primary"}),a.jsx("h3",{className:"font-semibold mb-1",children:"Contact Form"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Send us a message below"})]})})]}),a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsx(Ht,{children:"Frequently Asked Questions"}),a.jsx(cn,{children:"Search our knowledge base for quick answers"})]}),a.jsxs(gt,{children:[a.jsxs("div",{className:"relative mb-6",children:[a.jsx(Gx,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),a.jsx($n,{placeholder:"Search FAQs...",value:n,onChange:c=>r(c.target.value),className:"pl-10"})]}),a.jsx("div",{className:"space-y-6",children:o.map((c,d)=>a.jsxs("div",{children:[a.jsxs("h3",{className:"font-semibold text-lg mb-3 flex items-center",children:[a.jsx(wh,{className:"h-5 w-5 mr-2 text-primary"}),c.category]}),a.jsx("div",{className:"space-y-4",children:c.questions.map((f,m)=>a.jsxs("div",{className:"border rounded-lg p-4",children:[a.jsxs("h4",{className:"font-medium mb-2 flex items-start",children:[a.jsx(zx,{className:"h-4 w-4 mr-2 text-green-500 mt-0.5 flex-shrink-0"}),f.question]}),a.jsx("p",{className:"text-sm text-muted-foreground ml-6",children:f.answer})]},m))})]},d))}),n&&o.length===0&&a.jsxs("div",{className:"text-center py-8",children:[a.jsx(Ux,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground"}),a.jsx("p",{className:"text-muted-foreground",children:"No FAQs found matching your search."}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Try different keywords or contact support below."})]})]})]}),a.jsxs(mt,{children:[a.jsxs($t,{children:[a.jsx(Ht,{children:"Contact Support"}),a.jsx(cn,{children:"Can't find what you're looking for? Send us a message"})]}),a.jsx(gt,{children:a.jsxs("form",{onSubmit:l,className:"space-y-4",children:[a.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Name"}),a.jsx($n,{value:t.name,onChange:c=>e({...t,name:c.target.value}),placeholder:"Your name",required:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Email"}),a.jsx($n,{type:"email",value:t.email,onChange:c=>e({...t,email:c.target.value}),placeholder:"your@email.com",required:!0})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Category"}),a.jsxs("select",{value:t.category,onChange:c=>e({...t,category:c.target.value}),className:"w-full p-2 border rounded-md bg-background",children:[a.jsx("option",{value:"general",children:"General Question"}),a.jsx("option",{value:"bug",children:"Bug Report"}),a.jsx("option",{value:"feature",children:"Feature Request"}),a.jsx("option",{value:"account",children:"Account Issue"}),a.jsx("option",{value:"technical",children:"Technical Problem"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Subject"}),a.jsx($n,{value:t.subject,onChange:c=>e({...t,subject:c.target.value}),placeholder:"Brief description of your issue",required:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Message"}),a.jsx(vf,{value:t.message,onChange:c=>e({...t,message:c.target.value}),placeholder:"Please provide as much detail as possible...",rows:5,required:!0})]}),a.jsxs(ht,{type:"submit",className:"w-full",children:[a.jsx(w_,{className:"h-4 w-4 mr-2"}),"Send Message"]})]})})]}),a.jsxs(mt,{children:[a.jsx($t,{children:a.jsx(Ht,{children:"Additional Resources"})}),a.jsx(gt,{children:a.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[a.jsxs(ht,{variant:"outline",onClick:()=>window.open("/docs","_blank"),className:"justify-start",children:[a.jsx(Lu,{className:"h-4 w-4 mr-2"}),"Documentation"]}),a.jsxs(ht,{variant:"outline",onClick:()=>window.open("/releases","_blank"),className:"justify-start",children:[a.jsx(wh,{className:"h-4 w-4 mr-2"}),"Release Notes"]})]})})]})]})}function J9(){return a.jsx("div",{className:"page-ios fixed inset-0 flex items-center justify-center",children:a.jsxs("div",{className:"text-center animate-ios-fade-in relative",children:[a.jsxs(nt.div,{className:"relative w-32 h-32 mx-auto mb-8",initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.6,ease:"easeOut"},children:[a.jsx(nt.div,{className:"absolute inset-0 border-4 border-primary/20 rounded-full",animate:{rotate:360},transition:{duration:3,repeat:1/0,ease:"linear"}}),a.jsx(nt.div,{className:"absolute inset-3 border-4 border-transparent border-t-primary rounded-full",animate:{rotate:-360},transition:{duration:1.5,repeat:1/0,ease:"linear"}}),a.jsx(nt.div,{className:"absolute inset-8 bg-primary rounded-full flex items-center justify-center",animate:{scale:[1,1.1,1],opacity:[.9,.6,.9]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},children:a.jsx(xr,{className:"w-8 h-8 text-primary-foreground"})})]}),a.jsx(nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3,duration:.6},children:a.jsxs("h1",{className:"text-ios-title mb-3",children:[a.jsx(nt.span,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.5,duration:.4},children:"Progress"}),a.jsx(nt.span,{className:"text-primary ml-1",initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{delay:.7,duration:.4},children:"Pulse"})]})}),a.jsxs(nt.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.9,duration:.4},className:"text-ios-body text-muted-foreground mb-6",children:["Preparing your dashboard",a.jsx(nt.span,{animate:{opacity:[0,1,0]},transition:{duration:1.5,repeat:1/0,ease:"easeInOut",times:[0,.5,1]},children:"..."})]}),a.jsx(nt.div,{className:"progress-ios w-48 mx-auto",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:1.1,duration:.4},children:a.jsx(nt.div,{className:"progress-ios-bar",initial:{width:"0%"},animate:{width:"100%"},transition:{delay:1.3,duration:2,ease:"easeInOut",repeat:1/0,repeatType:"reverse"}})}),[...Array(6)].map((t,e)=>a.jsx(nt.div,{className:"absolute w-2 h-2 bg-primary/30 rounded-full",style:{left:`${20+e*10}%`,top:`${40+e%2*20}%`},animate:{y:[-10,-30,-10],opacity:[.3,.8,.3],scale:[.8,1.2,.8]},transition:{duration:2+e*.2,repeat:1/0,ease:"easeInOut",delay:e*.3}},e))]})})}function Q9({userId:t,onSuccess:e,onSkip:n}){const[r,s]=I.useState(""),[i,o]=I.useState(!1),[l,c]=I.useState(!1),[d,f]=I.useState(!1),[m,g]=I.useState(!1);I.useEffect(()=>{f(ps.hasFingerprint(t)),g(ps.hasPIN(t))},[t]);const v=async()=>{c(!0);const P=await ps.verifyFingerprint(t);P.success?(St.success("Fingerprint verified!"),e()):St.error(P.error||"Fingerprint verification failed"),c(!1)},N=()=>{if(r.length!==4){St.error("PIN must be 4 digits");return}ps.verifyPIN(t,r)?(St.success("PIN verified!"),e()):(St.error("Incorrect PIN"),s(""))},j=P=>{P.length<=4&&/^\d*$/.test(P)&&s(P)};return a.jsx("div",{className:"fixed inset-0 bg-gradient-to-br from-background to-muted/20 flex items-center justify-center",children:a.jsx(nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-sm px-6",children:a.jsxs("div",{className:"bg-card/80 backdrop-blur-sm border rounded-3xl shadow-xl p-8",children:[a.jsxs("div",{className:"text-center mb-10",children:[a.jsx("div",{className:"w-16 h-16 bg-primary rounded-2xl flex items-center justify-center mx-auto mb-6 shadow-lg",children:a.jsx(Uo,{className:"h-8 w-8 text-white"})}),a.jsx("h2",{className:"text-2xl font-semibold mb-2",children:"Welcome Back"}),a.jsx("p",{className:"text-muted-foreground",children:"Enter your passcode to continue"})]}),a.jsxs("div",{className:"space-y-8",children:[m&&a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"flex justify-center",children:a.jsxs("div",{className:"relative w-48",children:[a.jsx($n,{type:i?"text":"password",placeholder:"••••",value:r,onChange:P=>j(P.target.value),onKeyDown:P=>P.key==="Enter"&&r.length===4&&N(),className:"text-center text-3xl tracking-[0.5em] h-14 rounded-xl border-2 bg-background/50 focus:bg-background focus:border-primary w-full pr-10 [&::-ms-reveal]:hidden [&::-webkit-credentials-auto-fill-button]:hidden",maxLength:4,autoComplete:"off","data-lpignore":"true"}),a.jsx(ht,{type:"button",variant:"ghost",size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2 h-8 w-8 p-0",onClick:()=>o(!i),children:i?a.jsx(Ng,{className:"h-4 w-4"}):a.jsx(sf,{className:"h-4 w-4"})})]})}),r.length===4&&a.jsx(nt.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},children:a.jsx(ht,{onClick:N,className:"w-full h-12 text-base font-medium rounded-xl",children:"Unlock ProgressPulse"})})]}),d&&a.jsxs("div",{className:"flex justify-center",children:[m&&a.jsxs("div",{className:"relative mb-4",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("div",{className:"w-full border-t border-border"})}),a.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:a.jsx("span",{className:"bg-card px-3 text-muted-foreground",children:"or"})})]}),a.jsxs(ht,{onClick:v,disabled:l,variant:"outline",className:"h-14 px-8 rounded-xl border-2",children:[a.jsx(xh,{className:"h-5 w-5 mr-2"}),l?"Verifying...":"Use Biometric"]})]}),!d&&!m&&a.jsxs("div",{className:"text-center py-8",children:[a.jsx("div",{className:"w-12 h-12 bg-muted rounded-xl flex items-center justify-center mx-auto mb-4",children:a.jsx(Uo,{className:"h-6 w-6 text-muted-foreground"})}),a.jsx("p",{className:"text-muted-foreground mb-2",children:"No authentication method setup"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure PIN or biometric in Profile settings"})]})]})]})})})}const d2=["/docs","/documentation","/privacy","/terms","/releases","/support"];function eO({children:t}){const{user:e}=Ir(),n=tg(),[r,s]=I.useState(!1),[i,o]=I.useState(!1),[l,c]=I.useState(!0);I.useEffect(()=>{if(!e){c(!1);return}if(d2.includes(n.pathname)){s(!0),o(!1),c(!1);return}const f=ps.hasPIN(e.id),m=ps.hasFingerprint(e.id);f||m?ps.isSessionAuthenticated(e.id)?(s(!0),o(!1)):(sessionStorage.setItem("intended_route",n.pathname),o(!0),s(!1)):(s(!0),o(!1)),c(!1)},[e,n.pathname]);const d=()=>{if(e){ps.setSessionAuthenticated(e.id);const f=sessionStorage.getItem("intended_route");if(f&&f!==n.pathname){sessionStorage.removeItem("intended_route"),window.location.href=f;return}}s(!0),o(!1)};return l?a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):e?d2.includes(n.pathname)?a.jsx(a.Fragment,{children:t}):i&&!r?a.jsx(Q9,{userId:e.id,onSuccess:d}):a.jsx(a.Fragment,{children:t}):a.jsx(a.Fragment,{children:t})}function tO(){const{user:t,loading:e}=Ir();rk();const{isAPK:n}=sk();return I.useEffect(()=>{(async()=>{try{if(console.log("🚀 Initializing PWA...",{isAPK:n}),await rp.initialize(),await cr.initialize(),!n&&await cr.requestPermission()){const i=await cr.getToken();console.log("🔔 Web push token:",i)}cr.setupMessageListener(s=>{console.log("🔔 Foreground notification received:",s)}),console.log("🚀 PWA Environment:",{isStandalone:rp.isStandalone(),isAPK:rp.isAPK(),isRunningAsAPK:cr.isRunningAsAPK,notificationPermission:cr.notificationPermission,userAgent:navigator.userAgent})}catch(s){console.error("❌ PWA initialization failed:",s)}})()},[n]),e?a.jsx(J9,{}):a.jsx(wj,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,children:a.jsxs(fj,{children:[a.jsx("div",{className:"w-full h-full min-h-screen bg-background text-foreground",children:a.jsx(zo,{mode:"wait",children:t?a.jsx(eO,{children:a.jsx(L7,{children:a.jsxs(d1,{children:[a.jsx(qn,{path:"/dashboard",element:a.jsx(iE,{})}),a.jsx(qn,{path:"/goals",element:a.jsx(oE,{})}),a.jsx(qn,{path:"/progress",element:a.jsx(uE,{})}),a.jsx(qn,{path:"/analytics",element:a.jsx(dE,{})}),a.jsx(qn,{path:"/calendar",element:a.jsx(hE,{})}),a.jsx(qn,{path:"/achievements",element:a.jsx(fE,{})}),a.jsx(qn,{path:"/profile",element:a.jsx(DE,{})}),a.jsx(qn,{path:"/settings",element:a.jsx(HE,{})}),a.jsx(qn,{path:"/notifications",element:a.jsx(KE,{})}),a.jsx(qn,{path:"/spreadsheet",element:a.jsx(K9,{})}),a.jsx(qn,{path:"/certificates",element:a.jsx(Y9,{})}),a.jsx(qn,{path:"/tutorial",element:a.jsx(Z9,{})}),a.jsx(qn,{path:"/push-test",element:a.jsx(X9,{})}),a.jsx(qn,{path:"/docs",element:a.jsx(a2,{})}),a.jsx(qn,{path:"/documentation",element:a.jsx(a2,{})}),a.jsx(qn,{path:"/privacy",element:a.jsx(o2,{})}),a.jsx(qn,{path:"/terms",element:a.jsx(l2,{})}),a.jsx(qn,{path:"/releases",element:a.jsx(c2,{})}),a.jsx(qn,{path:"/support",element:a.jsx(u2,{})}),a.jsx(qn,{path:"/",element:a.jsx(Md,{to:"/dashboard",replace:!0})}),a.jsx(qn,{path:"*",element:a.jsx(Md,{to:"/dashboard",replace:!0})})]})})}):a.jsxs(d1,{children:[a.jsx(qn,{path:"/signup",element:a.jsx(gL,{})}),a.jsx(qn,{path:"/auth",element:a.jsx(Md,{to:"/signup",replace:!0})}),a.jsx(qn,{path:"/privacy",element:a.jsx(o2,{})}),a.jsx(qn,{path:"/terms",element:a.jsx(l2,{})}),a.jsx(qn,{path:"/releases",element:a.jsx(c2,{})}),a.jsx(qn,{path:"/support",element:a.jsx(u2,{})}),a.jsx(qn,{path:"*",element:a.jsx(Md,{to:"/signup",replace:!0})})]})})}),a.jsx(Yj,{position:"top-center",toastOptions:{duration:4e3,style:{background:"hsl(var(--card))",color:"hsl(var(--card-foreground))",border:"1px solid hsl(var(--border))"}}})]})})}B2(document.getElementById("root")).render(a.jsx(I.StrictMode,{children:a.jsx(tO,{})}));export{Zt as E,Fn as _,Ln as d};