var pE=Object.defineProperty;var gE=(yt,p,ze)=>p in yt?pE(yt,p,{enumerable:!0,configurable:!0,writable:!0,value:ze}):yt[p]=ze;var I=(yt,p,ze)=>(gE(yt,typeof p!="symbol"?p+"":p,ze),ze);var DESettingsPluginPages=function(yt,p,ze){var Og,Lg,Ag,Fg,zg,Wg,Bg,Hg,Hi,En;"use strict";function jd(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const G=jd(p),no=jd(ze);var Sd={exports:{}},so={};/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Yg=p,Kg=Symbol.for("react.element"),Gg=Symbol.for("react.fragment"),Xg=Object.prototype.hasOwnProperty,Qg=Yg.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Zg={key:!0,ref:!0,__self:!0,__source:!0};function Nd(e,t,n){var s,r={},o=null,i=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(i=t.ref);for(s in t)Xg.call(t,s)&&!Zg.hasOwnProperty(s)&&(r[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)r[s]===void 0&&(r[s]=t[s]);return{$$typeof:Kg,type:e,key:o,ref:i,props:r,_owner:Qg.current}}so.Fragment=Gg,so.jsx=Nd,so.jsxs=Nd,Sd.exports=so;var l=Sd.exports;function Cd(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Cd(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function ae(){for(var e,t,n=0,s="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Cd(e))&&(s&&(s+=" "),s+=t);return s}function Jg({soft:e=!1,className:t,...n}){return l.jsx("hr",{role:"presentation",...n,className:ae(t,"w-full border-t",e&&"border-neutral-950/5 dark:border-white/5",!e&&"border-neutral-950/10 dark:border-white/10")})}const Md=p.createContext(null);function eb({initialValues:e={},onChange:t,children:n}){const[s,r]=p.useState(e),o=(a,d)=>{r(c=>{const u=typeof d=="function"?d(c[a]):d,h=tb(c,a,u);return t==null||t(h),h})},i=p.useMemo(()=>({values:s,setValue:o}),[s]);return l.jsx(Md.Provider,{value:i,children:n})}function it(){const e=p.useContext(Md);return e||{values:{},setValue:()=>{}}}function tb(e,t,n){if(!t||!t.includes("."))return{...e,[t]:n};const s=t.split("."),r={...e};let o=r;for(let i=0;i<s.length-1;i++){const a=s[i];o[a]={...o[a]??{}},o=o[a]}return o[s[s.length-1]]=n,r}function nb({onSave:e,onReset:t,resetTo:n,saveLabel:s="Save",resetLabel:r="Reset",saveState:o="idle",disabled:i=!1,...a}){const{values:d,setValue:c}=it();async function u(w){var _;(_=w==null?void 0:w.preventDefault)==null||_.call(w),e?await e(d):alert("Settings saved!")}async function h(w){var _;if((_=w==null?void 0:w.preventDefault)==null||_.call(w),t){await t();return}n&&c?Object.keys(n).forEach(y=>c(y,n[y])):alert("Settings reset!")}const m=o==="saving",f=o==="saved",g=o==="error",b=m?"Saving…":f?"Saved":g?"Retry":s,x="inline-flex items-center px-4 py-2 rounded text-white font-semibold transition disabled:opacity-60 "+(f?"bg-green-600 hover:bg-green-700":g?"bg-red-600 hover:bg-red-700":"bg-indigo-600 hover:bg-indigo-700");return l.jsxs("div",{className:"mt-10",...a,children:[l.jsx(Jg,{}),l.jsxs("div",{className:"flex flex-col-reverse sm:flex-row gap-3 mt-10 justify-end items-stretch sm:items-center",children:[l.jsx("button",{type:"button",className:"inline-flex items-center px-4 py-2 rounded bg-neutral-200 text-neutral-900 font-semibold hover:bg-neutral-300 transition dark:bg-neutral-800 dark:text-white dark:hover:bg-neutral-700",onClick:h,disabled:m||i,children:r}),l.jsx("button",{type:"button",className:x,onClick:u,disabled:m||i,"aria-live":"polite",children:b})]})]})}const Ed=typeof window<"u"&&((Og=window.diviEngineApiSettings)!=null&&Og.restUrl)?window.diviEngineApiSettings.restUrl.replace(/\/?$/,"/"):"/wp-json/",Pd=typeof window<"u"&&((Lg=window.diviEngineApiSettings)==null?void 0:Lg.nonce)||"",sb=()=>{var t;return(typeof window<"u"&&((t=window.diviEngineSettingsObject)==null?void 0:t.organization)||"divi-engine")==="wp-enhanced"?"wpe/v1":"de/v1"};function Re({slug:e,defaults:t={}}){const[n,s]=p.useState(t),[r,o]=p.useState(!0),[i,a]=p.useState("idle"),d=sb(),c=async()=>{const h=await fetch(`${Ed}${d}/settings/${e}`,{credentials:"same-origin",headers:{"X-WP-Nonce":Pd}});if(!h.ok)throw new Error(`Load failed: ${h.status}`);return h.json()},u=async h=>{const m=await fetch(`${Ed}${d}/settings/${e}`,{method:"PUT",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":Pd},body:JSON.stringify(h)});if(!m.ok)throw new Error(`Save failed: ${m.status}`);return m.json()};return p.useEffect(()=>{let h=!0;return(async()=>{try{const m=await c();if(!h)return;s({...t,...m||{}})}catch(m){console.error(m),s(t)}finally{h&&o(!1)}})(),()=>{h=!1}},[e]),p.useMemo(()=>({slug:e,loading:r,initialValues:n,defaults:t,saveState:i,async saveWithState(h){try{return a("saving"),await u(h),a("saved"),setTimeout(()=>a("idle"),1200),"success"}catch(m){return console.error(m),a("error"),setTimeout(()=>a("idle"),2e3),"error"}}}),[e,r,n,t,i])}/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rb=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ob=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase()),Td=e=>{const t=ob(e);return t.charAt(0).toUpperCase()+t.slice(1)},Dd=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim(),ib=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var ab={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.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lb=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:r="",children:o,iconNode:i,...a},d)=>p.createElement("svg",{ref:d,...ab,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:Dd("lucide",r),...!o&&!ib(a)&&{"aria-hidden":"true"},...a},[...i.map(([c,u])=>p.createElement(c,u)),...Array.isArray(o)?o:[o]]));/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const de=(e,t)=>{const n=p.forwardRef(({className:s,...r},o)=>p.createElement(lb,{ref:o,iconNode:t,className:Dd(`lucide-${rb(Td(e))}`,`lucide-${e}`,s),...r}));return n.displayName=Td(e),n};/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Id=de("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.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const db=de("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.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cb=de("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.513.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=de("chart-bar",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16h8",key:"srdodz"}],["path",{d:"M7 11h12",key:"127s9w"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const an=de("chart-column",[["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.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qs=de("chart-pie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Od=de("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ub=de("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hb=de("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ld=de("circle-help",[["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.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ui=de("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fb=de("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mb=de("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.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ro=de("file-down",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/**
 * @license lucide-react v0.513.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=de("file-spreadsheet",[["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.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pb=de("file-text",[["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.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gb=de("file-type",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bb=de("files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ri=de("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ds=de("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.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ad=de("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xb=de("mailbox",[["path",{d:"M22 17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.5C2 7 4 5 6.5 5H18c2.2 0 4 1.8 4 4v8Z",key:"1lbycx"}],["polyline",{points:"15,9 18,9 18,11",key:"1pm9c0"}],["path",{d:"M6.5 5C9 5 11 7 11 9.5V17a2 2 0 0 1-2 2",key:"15i455"}],["line",{x1:"6",x2:"7",y1:"10",y2:"10",key:"1e2scm"}]]);/**
 * @license lucide-react v0.513.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=de("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cs=de("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wb=de("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);/**
 * @license lucide-react v0.513.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=de("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.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yb=de("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.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fd=de("trash-2",[["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.513.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=de("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qi=de("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vb=de("truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zd=de("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);/**
 * @license lucide-react v0.513.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yi=de("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Tt=e=>(e==null?void 0:e.ownerDocument)??document,ao=e=>e&&"window"in e&&e.window===e?e:Tt(e).defaultView||window;function kb(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function jb(e){return kb(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Sb=!1;function Ki(){return Sb}function Pn(e,t){if(!Ki())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:jb(n)?n=n.host:n=n.parentNode}return!1}const us=(e=document)=>{var n;if(!Ki())return e.activeElement;let t=e.activeElement;for(;t&&"shadowRoot"in t&&((n=t.shadowRoot)!=null&&n.activeElement);)t=t.shadowRoot.activeElement;return t};function Ye(e){if(Ki()&&e.target instanceof Element&&e.target.shadowRoot){if("composedPath"in e)return e.composedPath()[0]??null;if("composedPath"in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}function Nb(e){if(Cb())e.focus({preventScroll:!0});else{let t=Mb(e);e.focus(),Eb(t)}}let lo=null;function Cb(){if(lo==null){lo=!1;try{document.createElement("div").focus({get preventScroll(){return lo=!0,!0}})}catch{}}return lo}function Mb(e){let t=e.parentNode,n=[],s=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==s;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return s instanceof HTMLElement&&n.push({element:s,scrollTop:s.scrollTop,scrollLeft:s.scrollLeft}),n}function Eb(e){for(let{element:t,scrollTop:n,scrollLeft:s}of e)t.scrollTop=n,t.scrollLeft=s}const Pb=typeof document<"u"?p.useLayoutEffect:()=>{};function Wd(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Tb(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Bd(e){let t=p.useRef({isFocused:!1,observer:null});return Pb(()=>{const n=t.current;return()=>{n.observer&&(n.observer.disconnect(),n.observer=null)}},[]),p.useCallback(n=>{let s=Ye(n);if(s instanceof HTMLButtonElement||s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||s instanceof HTMLSelectElement){t.current.isFocused=!0;let r=s,o=i=>{if(t.current.isFocused=!1,r.disabled){let a=Wd(i);e==null||e(a)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};r.addEventListener("focusout",o,{once:!0}),t.current.observer=new MutationObserver(()=>{var i;if(t.current.isFocused&&r.disabled){(i=t.current.observer)==null||i.disconnect();let a=r===us()?null:us();r.dispatchEvent(new FocusEvent("blur",{relatedTarget:a})),r.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:a}))}}),t.current.observer.observe(r,{attributes:!0,attributeFilter:["disabled"]})}},[e])}let Db=!1;function co(e){var n;if(typeof window>"u"||window.navigator==null)return!1;let t=(n=window.navigator.userAgentData)==null?void 0:n.brands;return Array.isArray(t)&&t.some(s=>e.test(s.brand))||e.test(window.navigator.userAgent)}function Hd(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)==null?void 0:t.platform)||window.navigator.platform):!1}function hs(e){let t=null;return()=>(t==null&&(t=e()),t)}const uo=hs(function(){return Hd(/^Mac/i)}),Ib=hs(function(){return Hd(/^iPad/i)||uo()&&navigator.maxTouchPoints>1}),Ob=hs(function(){return co(/AppleWebKit/i)&&!Lb()}),Lb=hs(function(){return co(/Chrome/i)}),Ab=hs(function(){return co(/Android/i)}),Fb=hs(function(){return co(/Firefox/i)});function zb(e){return e.pointerType===""&&e.isTrusted?!0:Ab()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Ys(e,t,n=!0){var d,c;let{metaKey:s,ctrlKey:r,altKey:o,shiftKey:i}=t;Fb()&&((c=(d=window.event)==null?void 0:d.type)!=null&&c.startsWith("key"))&&e.target==="_blank"&&(uo()?s=!0:r=!0);let a=Ob()&&uo()&&!Ib()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:s,ctrlKey:r,altKey:o,shiftKey:i}):new MouseEvent("click",{metaKey:s,ctrlKey:r,altKey:o,shiftKey:i,detail:1,bubbles:!0,cancelable:!0});Ys.isOpening=n,Nb(e),e.dispatchEvent(a),Ys.isOpening=!1}Ys.isOpening=!1;let Ks=null;const Gi=new Set;let Gs=new Map,Tn=!1,Xi=!1;const Wb={Tab:!0,Escape:!0};function Qi(e,t){for(let n of Gi)n(e,t)}function Bb(e){return!(e.metaKey||!uo()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function ho(e){Tn=!0,!Ys.isOpening&&Bb(e)&&(Ks="keyboard",Qi("keyboard",e))}function fs(e){Ks="pointer","pointerType"in e&&e.pointerType,(e.type==="mousedown"||e.type==="pointerdown")&&(Tn=!0,Qi("pointer",e))}function Vd(e){!Ys.isOpening&&zb(e)&&(Tn=!0,Ks="virtual")}function Ud(e){let t=ao(Ye(e)),n=Tt(Ye(e));Ye(e)===t||Ye(e)===n||Db||!e.isTrusted||(!Tn&&!Xi&&(Ks="virtual",Qi("virtual",e)),Tn=!1,Xi=!1)}function Rd(){Tn=!1,Xi=!0}function Zi(e){if(typeof window>"u"||typeof document>"u")return;const t=ao(e),n=Tt(e);if(Gs.get(t))return;let s=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Tn=!0,s.apply(this,arguments)},n.addEventListener("keydown",ho,!0),n.addEventListener("keyup",ho,!0),n.addEventListener("click",Vd,!0),t.addEventListener("focus",Ud,!0),t.addEventListener("blur",Rd,!1),typeof PointerEvent<"u"&&(n.addEventListener("pointerdown",fs,!0),n.addEventListener("pointermove",fs,!0),n.addEventListener("pointerup",fs,!0)),t.addEventListener("beforeunload",()=>{$d(e)},{once:!0}),Gs.set(t,{focus:s})}const $d=(e,t)=>{const n=ao(e),s=Tt(e);t&&s.removeEventListener("DOMContentLoaded",t),Gs.has(n)&&(n.HTMLElement.prototype.focus=Gs.get(n).focus,s.removeEventListener("keydown",ho,!0),s.removeEventListener("keyup",ho,!0),s.removeEventListener("click",Vd,!0),n.removeEventListener("focus",Ud,!0),n.removeEventListener("blur",Rd,!1),typeof PointerEvent<"u"&&(s.removeEventListener("pointerdown",fs,!0),s.removeEventListener("pointermove",fs,!0),s.removeEventListener("pointerup",fs,!0)),Gs.delete(n))};function Hb(e){const t=Tt(e);let n;return t.readyState!=="loading"?Zi(e):(n=()=>{Zi(e)},t.addEventListener("DOMContentLoaded",n)),()=>$d(e,n)}typeof document<"u"&&Hb();function Ji(){return Ks!=="pointer"}const Vb=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Ub(e,t,n){let s=n?Ye(n):void 0,r=Tt(s),o=ao(s);const i=typeof o<"u"?o.HTMLInputElement:HTMLInputElement,a=typeof o<"u"?o.HTMLTextAreaElement:HTMLTextAreaElement,d=typeof o<"u"?o.HTMLElement:HTMLElement,c=typeof o<"u"?o.KeyboardEvent:KeyboardEvent;let u=us(r);return e=e||u instanceof i&&!Vb.has(u.type)||u instanceof a||u instanceof d&&u.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!Wb[n.key])}function Rb(e,t,n){Zi(),p.useEffect(()=>{if((n==null?void 0:n.enabled)===!1)return;let s=(r,o)=>{Ub(!!(n!=null&&n.isTextInput),r,o)&&e(Ji())};return Gi.add(s),()=>{Gi.delete(s)}},t)}function $b(e){let{isDisabled:t,onFocus:n,onBlur:s,onFocusChange:r}=e;const o=p.useCallback(d=>{if(Ye(d)===d.currentTarget)return s&&s(d),r&&r(!1),!0},[s,r]),i=Bd(o),a=p.useCallback(d=>{let c=Ye(d);const u=Tt(c),h=u?us(u):us();c===d.currentTarget&&c===h&&(n&&n(d),r&&r(!0),i(d))},[r,n,i]);return{focusProps:{onFocus:!t&&(n||r||s)?a:void 0,onBlur:!t&&(s||r)?o:void 0}}}function qd(){let e=p.useRef(new Map),t=p.useCallback((r,o,i,a)=>{let d=a!=null&&a.once?(...c)=>{e.current.delete(i),i(...c)}:i;e.current.set(i,{type:o,eventTarget:r,fn:d,options:a}),r.addEventListener(o,d,a)},[]),n=p.useCallback((r,o,i,a)=>{var c;let d=((c=e.current.get(i))==null?void 0:c.fn)||i;r.removeEventListener(o,d,a),e.current.delete(i)},[]),s=p.useCallback(()=>{e.current.forEach((r,o)=>{n(r.eventTarget,r.type,o,r.options)})},[n]);return p.useEffect(()=>s,[s]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:s}}function qb(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:s,onFocusWithinChange:r}=e,o=p.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:a}=qd(),d=p.useCallback(h=>{Pn(h.currentTarget,Ye(h))&&o.current.isFocusWithin&&!Pn(h.currentTarget,h.relatedTarget)&&(o.current.isFocusWithin=!1,a(),n&&n(h),r&&r(!1))},[n,r,o,a]),c=Bd(d),u=p.useCallback(h=>{if(!Pn(h.currentTarget,Ye(h)))return;let m=Ye(h);const f=Tt(m),g=us(f);if(!o.current.isFocusWithin&&g===m){s&&s(h),r&&r(!0),o.current.isFocusWithin=!0,c(h);let b=h.currentTarget;i(f,"focus",x=>{let w=Ye(x);if(o.current.isFocusWithin&&!Pn(b,w)){let _=new f.defaultView.FocusEvent("blur",{relatedTarget:w});Tb(_,b);let y=Wd(_);d(y)}},{capture:!0})}},[s,r,c,i,d]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:d}}}function Dn(e={}){let{autoFocus:t=!1,isTextInput:n,within:s}=e,r=p.useRef({isFocused:!1,isFocusVisible:t||Ji()}),[o,i]=p.useState(!1),[a,d]=p.useState(()=>r.current.isFocused&&r.current.isFocusVisible),c=p.useCallback(()=>d(r.current.isFocused&&r.current.isFocusVisible),[]),u=p.useCallback(f=>{r.current.isFocused=f,r.current.isFocusVisible=Ji(),i(f),c()},[c]);Rb(f=>{r.current.isFocusVisible=f,c()},[n,o],{enabled:o,isTextInput:n});let{focusProps:h}=$b({isDisabled:s,onFocusChange:u}),{focusWithinProps:m}=qb({isDisabled:!s,onFocusWithinChange:u});return{isFocused:o,isFocusVisible:a,focusProps:s?m:h}}let ea=!1,fo=0;function Yb(){ea=!0,setTimeout(()=>{ea=!1},500)}function Yd(e){e.pointerType==="touch"&&Yb()}function Kb(){let e=Tt(null);if(!(typeof e>"u"))return fo===0&&typeof PointerEvent<"u"&&e.addEventListener("pointerup",Yd),fo++,()=>{fo--,!(fo>0)&&typeof PointerEvent<"u"&&e.removeEventListener("pointerup",Yd)}}function In(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:s,isDisabled:r}=e,[o,i]=p.useState(!1),a=p.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;p.useEffect(Kb,[]);let{addGlobalListener:d,removeAllGlobalListeners:c}=qd(),{hoverProps:u,triggerHoverEnd:h}=p.useMemo(()=>{let m=(b,x)=>{if(a.pointerType=x,r||x==="touch"||a.isHovered||!Pn(b.currentTarget,Ye(b)))return;a.isHovered=!0;let w=b.currentTarget;a.target=w,d(Tt(Ye(b)),"pointerover",_=>{a.isHovered&&a.target&&!Pn(a.target,Ye(_))&&f(_,_.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:w,pointerType:x}),n&&n(!0),i(!0)},f=(b,x)=>{let w=a.target;a.pointerType="",a.target=null,!(x==="touch"||!a.isHovered||!w)&&(a.isHovered=!1,c(),s&&s({type:"hoverend",target:w,pointerType:x}),n&&n(!1),i(!1))},g={};return typeof PointerEvent<"u"&&(g.onPointerEnter=b=>{ea&&b.pointerType==="mouse"||m(b,b.pointerType)},g.onPointerLeave=b=>{!r&&Pn(b.currentTarget,Ye(b))&&f(b,b.pointerType)}),{hoverProps:g,triggerHoverEnd:f}},[t,n,s,r,a,d,c]);return p.useEffect(()=>{r&&h({currentTarget:a.target},a.pointerType)},[r]),{hoverProps:u,isHovered:o}}var Gb=Object.defineProperty,Xb=(e,t,n)=>t in e?Gb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ta=(e,t,n)=>(Xb(e,typeof t!="symbol"?t+"":t,n),n);let Qb=class{constructor(){ta(this,"current",this.detect()),ta(this,"handoffState","pending"),ta(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Dt=new Qb;function On(e){var t;return Dt.isServer?null:e==null?document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function mo(e){var t,n;return Dt.isServer?null:e==null?document:(n=(t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))!=null?n:document}function na(e){var t,n;return(n=(t=mo(e))==null?void 0:t.activeElement)!=null?n:null}function po(e){return na(e)===e}function go(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function st(){let e=[],t={addEventListener(n,s,r,o){return n.addEventListener(s,r,o),t.add(()=>n.removeEventListener(s,r,o))},requestAnimationFrame(...n){let s=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(s))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let s=setTimeout(...n);return t.add(()=>clearTimeout(s))},microTask(...n){let s={current:!0};return go(()=>{s.current&&n[0]()}),t.add(()=>{s.current=!1})},style(n,s,r){let o=n.style.getPropertyValue(s);return Object.assign(n.style,{[s]:r}),this.add(()=>{Object.assign(n.style,{[s]:o})})},group(n){let s=st();return n(s),this.add(()=>s.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let s=e.indexOf(n);if(s>=0)for(let r of e.splice(s,1))r()}},dispose(){for(let n of e.splice(0))n()}};return t}function It(){let[e]=p.useState(st);return p.useEffect(()=>()=>e.dispose(),[e]),e}let ue=(e,t)=>{Dt.isServer?p.useEffect(e,t):p.useLayoutEffect(e,t)};function ln(e){let t=p.useRef(e);return ue(()=>{t.current=e},[e]),t}let q=function(e){let t=ln(e);return p.useCallback((...n)=>t.current(...n),[t])};function Zb(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function Jb(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function ms({disabled:e=!1}={}){let t=p.useRef(null),[n,s]=p.useState(!1),r=It(),o=q(()=>{t.current=null,s(!1),r.dispose()}),i=q(a=>{if(r.dispose(),t.current===null){t.current=a.currentTarget,s(!0);{let d=On(a.currentTarget);r.addEventListener(d,"pointerup",o,!1),r.addEventListener(d,"pointermove",c=>{if(t.current){let u=Zb(c);s(Jb(u,t.current.getBoundingClientRect()))}},!1),r.addEventListener(d,"pointercancel",o,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:o,onClick:o}}}function We(e){return p.useMemo(()=>e,Object.values(e))}let Kd=p.createContext(void 0);function Ln(){return p.useContext(Kd)}function e0({value:e,children:t}){return p.createElement(Kd.Provider,{value:e},t)}function sa(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function $e(e,t,...n){if(e in t){let r=t[e];return typeof r=="function"?r(...n):r}let s=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(r=>`"${r}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(s,$e),s}var dn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(dn||{}),cn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(cn||{});function me(){let e=n0();return p.useCallback(t=>t0({mergeRefs:e,...t}),[e])}function t0({ourProps:e,theirProps:t,slot:n,defaultTag:s,features:r,visible:o=!0,name:i,mergeRefs:a}){a=a??s0;let d=Gd(t,e);if(o)return bo(d,n,s,i,a);let c=r??0;if(c&2){let{static:u=!1,...h}=d;if(u)return bo(h,n,s,i,a)}if(c&1){let{unmount:u=!0,...h}=d;return $e(u?0:1,{0(){return null},1(){return bo({...h,hidden:!0,style:{display:"none"}},n,s,i,a)}})}return bo(d,n,s,i,a)}function bo(e,t={},n,s,r){let{as:o=n,children:i,refName:a="ref",...d}=ra(e,["unmount","static"]),c=e.ref!==void 0?{[a]:e.ref}:{},u=typeof i=="function"?i(t):i;u=Xd(u),"className"in d&&d.className&&typeof d.className=="function"&&(d.className=d.className(t)),d["aria-labelledby"]&&d["aria-labelledby"]===d.id&&(d["aria-labelledby"]=void 0);let h={};if(t){let m=!1,f=[];for(let[g,b]of Object.entries(t))typeof b=="boolean"&&(m=!0),b===!0&&f.push(g.replace(/([A-Z])/g,x=>`-${x.toLowerCase()}`));if(m){h["data-headlessui-state"]=f.join(" ");for(let g of f)h[`data-${g}`]=""}}if(Xs(o)&&(Object.keys(un(d)).length>0||Object.keys(un(h)).length>0))if(!p.isValidElement(u)||Array.isArray(u)&&u.length>1||o0(u)){if(Object.keys(un(d)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${s} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(un(d)).concat(Object.keys(un(h))).map(m=>`  - ${m}`).join(`
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(m=>`  - ${m}`).join(`
`)].join(`
`))}else{let m=u.props,f=m==null?void 0:m.className,g=typeof f=="function"?(...w)=>sa(f(...w),d.className):sa(f,d.className),b=g?{className:g}:{},x=Gd(u.props,un(ra(d,["ref"])));for(let w in h)w in x&&delete h[w];return p.cloneElement(u,Object.assign({},x,h,c,{ref:r(r0(u),c.ref)},b))}return p.createElement(o,Object.assign({},ra(d,["ref"]),!Xs(o)&&c,!Xs(o)&&h),u)}function n0(){let e=p.useRef([]),t=p.useCallback(n=>{for(let s of e.current)s!=null&&(typeof s=="function"?s(n):s.current=n)},[]);return(...n)=>{if(!n.every(s=>s==null))return e.current=n,t}}function s0(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function Gd(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let s of e)for(let r in s)r.startsWith("on")&&typeof s[r]=="function"?(n[r]!=null||(n[r]=[]),n[r].push(s[r])):t[r]=s[r];if(t.disabled||t["aria-disabled"])for(let s in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(s)&&(n[s]=[r=>{var o;return(o=r==null?void 0:r.preventDefault)==null?void 0:o.call(r)}]);for(let s in n)Object.assign(t,{[s](r,...o){let i=n[s];for(let a of i){if((r instanceof Event||(r==null?void 0:r.nativeEvent)instanceof Event)&&r.defaultPrevented)return;a(r,...o)}}});return t}function Yt(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let s of e)for(let r in s)r.startsWith("on")&&typeof s[r]=="function"?(n[r]!=null||(n[r]=[]),n[r].push(s[r])):t[r]=s[r];for(let s in n)Object.assign(t,{[s](...r){let o=n[s];for(let i of o)i==null||i(...r)}});return t}function he(e){var t;return Object.assign(p.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function un(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function ra(e,t=[]){let n=Object.assign({},e);for(let s of t)s in n&&delete n[s];return n}function r0(e){return p.version.split(".")[0]>="19"?e.props.ref:e.ref}function Xd(e){if(e!=null&&e.$$typeof===Symbol.for("react.lazy")){let t=e._payload;if(t!=null&&t.status==="fulfilled")return Xd(t.value)}return e}function Xs(e){return e===p.Fragment||e===Symbol.for("react.fragment")}function o0(e){return Xs(e.type)}let i0="button";function a0(e,t){var n;let s=Ln(),{disabled:r=s||!1,autoFocus:o=!1,...i}=e,{isFocusVisible:a,focusProps:d}=Dn({autoFocus:o}),{isHovered:c,hoverProps:u}=In({isDisabled:r}),{pressed:h,pressProps:m}=ms({disabled:r}),f=Yt({ref:t,type:(n=i.type)!=null?n:"button",disabled:r||void 0,autoFocus:o},d,u,m),g=We({disabled:r,hover:c,focus:a,active:h,autofocus:o});return me()({ourProps:f,theirProps:i,slot:g,defaultTag:i0,name:"Button"})}let l0=he(a0);function Qd(e,t,n){let[s,r]=p.useState(n),o=e!==void 0,i=p.useRef(o),a=p.useRef(!1),d=p.useRef(!1);return o&&!i.current&&!a.current?(a.current=!0,i.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!o&&i.current&&!d.current&&(d.current=!0,i.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[o?e:s,q(c=>(o||ze.flushSync(()=>r(c)),t==null?void 0:t(c)))]}function Zd(e){let[t]=p.useState(e);return t}function Jd(e={},t=null,n=[]){for(let[s,r]of Object.entries(e))tc(n,ec(t,s),r);return n}function ec(e,t){return e?e+"["+t+"]":t}function tc(e,t,n){if(Array.isArray(n))for(let[s,r]of n.entries())tc(e,ec(t,s.toString()),r);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):c0(n)&&!p.isValidElement(n)&&Jd(n,t,e)}function d0(e){var t,n;let s=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(s){for(let r of s.elements)if(r!==e&&(r.tagName==="INPUT"&&r.type==="submit"||r.tagName==="BUTTON"&&r.type==="submit"||r.nodeName==="INPUT"&&r.type==="image")){r.click();return}(n=s.requestSubmit)==null||n.call(s)}}function c0(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}let u0="span";var An=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(An||{});function h0(e,t){var n;let{features:s=1,...r}=e,o={ref:t,"aria-hidden":(s&2)===2?!0:(n=r["aria-hidden"])!=null?n:void 0,hidden:(s&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(s&4)===4&&(s&2)!==2&&{display:"none"}}};return me()({ourProps:o,theirProps:r,slot:{},defaultTag:u0,name:"Hidden"})}let ps=he(h0),nc=p.createContext(null);function f0(e){let[t,n]=p.useState(null);return p.createElement(nc.Provider,{value:{target:t}},e.children,p.createElement(ps,{features:An.Hidden,ref:n}))}function m0({children:e}){let t=p.useContext(nc);if(!t)return p.createElement(p.Fragment,null,e);let{target:n}=t;return n?ze.createPortal(p.createElement(p.Fragment,null,e),n):null}function sc({data:e,form:t,disabled:n,onReset:s,overrides:r}){let[o,i]=p.useState(null),a=It();return p.useEffect(()=>{if(s&&o)return a.addEventListener(o,"reset",s)},[o,t,s]),p.createElement(m0,null,p.createElement(p0,{setForm:i,formId:t}),Jd(e).map(([d,c])=>p.createElement(ps,{features:An.Hidden,...un({key:d,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:d,value:c,...r})})))}function p0({setForm:e,formId:t}){return p.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:p.createElement(ps,{features:An.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let s=n.closest("form");s&&e(s)}})}let rc=p.createContext(void 0);function xo(){return p.useContext(rc)}function g0({id:e,children:t}){return p.createElement(rc.Provider,{value:e},t)}function oc(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Kt(e){return oc(e)&&"tagName"in e}function at(e){return Kt(e)&&"accessKey"in e}function Ot(e){return Kt(e)&&"tabIndex"in e}function b0(e){return Kt(e)&&"style"in e}function x0(e){return at(e)&&e.nodeName==="IFRAME"}function wo(e){return at(e)&&e.nodeName==="INPUT"}function oa(e){return at(e)&&e.nodeName==="LABEL"}function w0(e){return at(e)&&e.nodeName==="FIELDSET"}function ic(e){return at(e)&&e.nodeName==="LEGEND"}function _0(e){return Kt(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function ia(e){let t=e.parentElement,n=null;for(;t&&!w0(t);)ic(t)&&(n=t),t=t.parentElement;let s=(t==null?void 0:t.getAttribute("disabled"))==="";return s&&y0(n)?!1:s}function y0(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(ic(t))return!1;t=t.previousElementSibling}return!0}let ac=Symbol();function v0(e,t=!0){return Object.assign(e,{[ac]:t})}function Be(...e){let t=p.useRef(e);p.useEffect(()=>{t.current=e},[e]);let n=q(s=>{for(let r of t.current)r!=null&&(typeof r=="function"?r(s):r.current=s)});return e.every(s=>s==null||(s==null?void 0:s[ac]))?void 0:n}let _o=p.createContext(null);_o.displayName="DescriptionContext";function lc(){let e=p.useContext(_o);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,lc),t}return e}function aa(){var e,t;return(t=(e=p.useContext(_o))==null?void 0:e.value)!=null?t:void 0}function yo(){let[e,t]=p.useState([]);return[e.length>0?e.join(" "):void 0,p.useMemo(()=>function(n){let s=q(o=>(t(i=>[...i,o]),()=>t(i=>{let a=i.slice(),d=a.indexOf(o);return d!==-1&&a.splice(d,1),a}))),r=p.useMemo(()=>({register:s,slot:n.slot,name:n.name,props:n.props,value:n.value}),[s,n.slot,n.name,n.props,n.value]);return p.createElement(_o.Provider,{value:r},n.children)},[t])]}let k0="p";function j0(e,t){let n=p.useId(),s=Ln(),{id:r=`headlessui-description-${n}`,...o}=e,i=lc(),a=Be(t);ue(()=>i.register(r),[r,i.register]);let d=We({...i.slot,disabled:s||!1}),c={ref:a,...i.props,id:r};return me()({ourProps:c,theirProps:o,slot:d,defaultTag:k0,name:i.name||"Description"})}let S0=he(j0),vo=Object.assign(S0,{});var le=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(le||{});let ko=p.createContext(null);ko.displayName="LabelContext";function la(){let e=p.useContext(ko);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,la),t}return e}function gs(e){var t,n,s;let r=(n=(t=p.useContext(ko))==null?void 0:t.value)!=null?n:void 0;return((s=e==null?void 0:e.length)!=null?s:0)>0?[r,...e].filter(Boolean).join(" "):r}function Qs({inherit:e=!1}={}){let t=gs(),[n,s]=p.useState([]),r=e?[t,...n].filter(Boolean):n;return[r.length>0?r.join(" "):void 0,p.useMemo(()=>function(o){let i=q(d=>(s(c=>[...c,d]),()=>s(c=>{let u=c.slice(),h=u.indexOf(d);return h!==-1&&u.splice(h,1),u}))),a=p.useMemo(()=>({register:i,slot:o.slot,name:o.name,props:o.props,value:o.value}),[i,o.slot,o.name,o.props,o.value]);return p.createElement(ko.Provider,{value:a},o.children)},[s])]}let N0="label";function C0(e,t){var n;let s=p.useId(),r=la(),o=xo(),i=Ln(),{id:a=`headlessui-label-${s}`,htmlFor:d=o??((n=r.props)==null?void 0:n.htmlFor),passive:c=!1,...u}=e,h=Be(t);ue(()=>r.register(a),[a,r.register]);let m=q(b=>{let x=b.currentTarget;if(!(b.target!==b.currentTarget&&_0(b.target))&&(oa(x)&&b.preventDefault(),r.props&&"onClick"in r.props&&typeof r.props.onClick=="function"&&r.props.onClick(b),oa(x))){let w=document.getElementById(x.htmlFor);if(w){let _=w.getAttribute("disabled");if(_==="true"||_==="")return;let y=w.getAttribute("aria-disabled");if(y==="true"||y==="")return;(wo(w)&&(w.type==="file"||w.type==="radio"||w.type==="checkbox")||w.role==="radio"||w.role==="checkbox"||w.role==="switch")&&w.click(),w.focus({preventScroll:!0})}}}),f=We({...r.slot,disabled:i||!1}),g={ref:h,...r.props,id:a,htmlFor:d,onClick:m};return c&&("onClick"in g&&(delete g.htmlFor,delete g.onClick),"onClick"in u&&delete u.onClick),me()({ourProps:g,theirProps:u,slot:f,defaultTag:d?N0:"div",name:r.name||"Label"})}let M0=he(C0),da=Object.assign(M0,{}),E0=p.createContext(()=>{});function P0({value:e,children:t}){return p.createElement(E0.Provider,{value:e},t)}function bs(e,t,n){let s=n.initialDeps??[],r,o=!0;function i(){var a,d,c;let u;n.key&&((a=n.debug)!=null&&a.call(n))&&(u=Date.now());const h=e();if(!(h.length!==s.length||h.some((g,b)=>s[b]!==g)))return r;s=h;let f;if(n.key&&((d=n.debug)!=null&&d.call(n))&&(f=Date.now()),r=t(...h),n.key&&((c=n.debug)!=null&&c.call(n))){const g=Math.round((Date.now()-u)*100)/100,b=Math.round((Date.now()-f)*100)/100,x=b/16,w=(_,y)=>{for(_=String(_);_.length<y;)_=" "+_;return _};console.info(`%c⏱ ${w(b,5)} /${w(g,5)} ms`,`
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(0,Math.min(120-120*x,120))}deg 100% 31%);`,n==null?void 0:n.key)}return n!=null&&n.onChange&&!(o&&n.skipInitialOnChange)&&n.onChange(r),o=!1,r}return i.updateDeps=a=>{s=a},i}function dc(e,t){if(e===void 0)throw new Error(`Unexpected undefined${t?`: ${t}`:""}`);return e}const T0=(e,t)=>Math.abs(e-t)<1.01,D0=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}},cc=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},I0=e=>e,O0=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),s=[];for(let r=t;r<=n;r++)s.push(r);return s},L0=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const r=i=>{const{width:a,height:d}=i;t({width:Math.round(a),height:Math.round(d)})};if(r(cc(n)),!s.ResizeObserver)return()=>{};const o=new s.ResizeObserver(i=>{const a=()=>{const d=i[0];if(d!=null&&d.borderBoxSize){const c=d.borderBoxSize[0];if(c){r({width:c.inlineSize,height:c.blockSize});return}}r(cc(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},uc={passive:!0},hc=typeof window>"u"?!0:"onscrollend"in window,A0=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;let r=0;const o=e.options.useScrollendEvent&&hc?()=>{}:D0(s,()=>{t(r,!1)},e.options.isScrollingResetDelay),i=u=>()=>{const{horizontal:h,isRtl:m}=e.options;r=h?n.scrollLeft*(m&&-1||1):n.scrollTop,o(),t(r,u)},a=i(!0),d=i(!1);n.addEventListener("scroll",a,uc);const c=e.options.useScrollendEvent&&hc;return c&&n.addEventListener("scrollend",d,uc),()=>{n.removeEventListener("scroll",a),c&&n.removeEventListener("scrollend",d)}},F0=(e,t,n)=>{if(t!=null&&t.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},z0=(e,{adjustments:t=0,behavior:n},s)=>{var r,o;const i=e+t;(o=(r=s.scrollElement)==null?void 0:r.scrollTo)==null||o.call(r,{[s.options.horizontal?"left":"top"]:i,behavior:n})};class W0{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var n,s,r;return((r=(s=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:s.now)==null?void 0:r.call(s))??Date.now()},this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(r=>{r.forEach(o=>{const i=()=>{const a=o.target,d=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(a,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var r;(r=s())==null||r.disconnect(),n=null},observe:r=>{var o;return(o=s())==null?void 0:o.observe(r,{box:"border-box"})},unobserve:r=>{var o;return(o=s())==null?void 0:o.unobserve(r)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([s,r])=>{typeof r>"u"&&delete n[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:I0,rangeExtractor:O0,onChange:()=>{},measureElement:F0,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...n}},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=bs(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=o,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const r=new Map,o=new Map;for(let i=s-1;i>=0;i--){const a=n[i];if(r.has(a.lane))continue;const d=o.get(a.lane);if(d==null||a.end>d.end?o.set(a.lane,a):a.end<d.end&&r.set(a.lane,!0),r.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=bs(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,s,r,o,i,a,d)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:s,scrollMargin:r,getItemKey:o,enabled:i,lanes:a,laneAssignmentMode:d}),{key:!1}),this.getMeasurements=bs(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:s,scrollMargin:r,getItemKey:o,enabled:i,lanes:a,laneAssignmentMode:d},c)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const f of this.laneAssignments.keys())f>=n&&this.laneAssignments.delete(f);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const h=this.measurementsCache.slice(0,u),m=new Array(a).fill(void 0);for(let f=0;f<u;f++){const g=h[f];g&&(m[g.lane]=f)}for(let f=u;f<n;f++){const g=o(f),b=this.laneAssignments.get(f);let x,w;const _=d==="estimate"||c.has(g);if(b!==void 0&&this.options.lanes>1){x=b;const k=m[x],M=k!==void 0?h[k]:void 0;w=M?M.end+this.options.gap:s+r}else{const k=this.options.lanes===1?h[f-1]:this.getFurthestMeasurement(h,f);w=k?k.end+this.options.gap:s+r,x=k?k.lane:f%this.options.lanes,this.options.lanes>1&&_&&this.laneAssignments.set(f,x)}const y=c.get(g),v=typeof y=="number"?y:this.options.estimateSize(f),j=w+v;h[f]={index:f,start:w,size:v,end:j,key:g,lane:x},m[x]=f}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=bs(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,r,o)=>this.range=n.length>0&&s>0?B0({measurements:n,outerSize:s,scrollOffset:r,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=bs(()=>{let n=null,s=null;const r=this.calculateRange();return r&&(n=r.startIndex,s=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,r,o,i)=>o===null||i===null?[]:n({startIndex:o,endIndex:i,overscan:s,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,r=n.getAttribute(s);return r?parseInt(r,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const r=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(r!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,r-o),a=Math.min(this.options.count-1,r+o);return n>=i&&n<=a}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((i,a)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(a))});return}const s=this.indexFromElement(n),r=this.options.getItemKey(s),o=this.elementsCache.get(r);o!==n&&(o&&this.observer.unobserve(o),this.observer.observe(n),this.elementsCache.set(r,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,s)=>{var r;const o=this.measurementsCache[n];if(!o)return;const i=this.itemSizeCache.get(o.key)??o.size,a=s-i;a!==0&&(((r=this.scrollState)==null?void 0:r.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,a,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,s)),this.notify(!1))},this.getVirtualItems=bs(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const r=[];for(let o=0,i=n.length;o<i;o++){const a=n[o],d=s[a];r.push(d)}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length!==0)return dc(s[fc(0,s.length-1,r=>dc(s[r]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,s,r=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),i=this.getScrollOffset();s==="auto"&&(s=n>=i+o?"end":"start"),s==="center"?n+=(r-o)/2:s==="end"&&(n-=o);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const r=this.getSize(),o=this.getScrollOffset(),i=this.measurementsCache[n];if(!i)return;if(s==="auto")if(i.end>=o+r-this.options.scrollPaddingEnd)s="end";else if(i.start<=o+this.options.scrollPaddingStart)s="start";else return[o,s];if(s==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),s];const a=s==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s,i.size),s]},this.scrollToOffset=(n,{align:s="start",behavior:r="auto"}={})=>{const o=this.getOffsetForAlignment(n,s),i=this.now();this.scrollState={index:null,align:s,behavior:r,startedAt:i,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:s="auto",behavior:r="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.getOffsetForIndex(n,s);if(!o)return;const[i,a]=o,d=this.now();this.scrollState={index:n,align:a,behavior:r,startedAt:d,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:s="auto"}={})=>{const r=this.getScrollOffset()+n,o=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:o,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let r;if(s.length===0)r=this.options.paddingStart;else if(this.options.lanes===1)r=((n=s[s.length-1])==null?void 0:n.end)??0;else{const o=Array(this.options.lanes).fill(null);let i=s.length-1;for(;i>=0&&o.some(a=>a===null);){const a=s[i];o[a.lane]===null&&(o[a.lane]=a.end),i--}r=Math.max(...o.filter(a=>a!==null))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:s,behavior:r})=>{this.options.scrollToFn(n,{behavior:r,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;const n=5e3;if(this.now()-this.scrollState.startedAt>n){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,r=s?s[0]:this.scrollState.lastTargetOffset,o=1,i=r!==this.scrollState.lastTargetOffset;if(!i&&T0(r,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.scrollState=null;return}}else this.scrollState.stableFrames=0,i&&(this.scrollState.lastTargetOffset=r,this.scrollState.behavior="auto",this._scrollToOffset(r,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const fc=(e,t,n,s)=>{for(;e<=t;){const r=(e+t)/2|0,o=n(r);if(o<s)e=r+1;else if(o>s)t=r-1;else return r}return e>0?e-1:0};function B0({measurements:e,outerSize:t,scrollOffset:n,lanes:s}){const r=e.length-1,o=d=>e[d].start;if(e.length<=s)return{startIndex:0,endIndex:r};let i=fc(0,r,o,n),a=i;if(s===1)for(;a<r&&e[a].end<n+t;)a++;else if(s>1){const d=Array(s).fill(0);for(;a<r&&d.some(u=>u<n+t);){const u=e[a];d[u.lane]=u.end,a++}const c=Array(s).fill(n+t);for(;i>=0&&c.some(u=>u>=n);){const u=e[i];c[u.lane]=u.start,i--}i=Math.max(0,i-i%s),a=Math.min(r,a+(s-1-a%s))}return{startIndex:i,endIndex:a}}const mc=typeof document<"u"?G.useLayoutEffect:G.useEffect;function H0({useFlushSync:e=!0,...t}){const n=G.useReducer(()=>({}),{})[1],s={...t,onChange:(o,i)=>{var a;e&&i?ze.flushSync(n):n(),(a=t.onChange)==null||a.call(t,o,i)}},[r]=G.useState(()=>new W0(s));return r.setOptions(s),mc(()=>r._didMount(),[]),mc(()=>r._willUpdate()),r}function V0(e){return H0({observeElementRect:L0,observeElementOffset:A0,scrollToFn:z0,...e})}function U0(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function R0(e=U0){return p.useCallback((t,n)=>{if(typeof e=="string"){let s=e;return(t==null?void 0:t[s])===(n==null?void 0:n[s])}return e(t,n)},[e])}function pc(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function ca(e,t,n=!1){let[s,r]=p.useState(()=>pc(t));return ue(()=>{if(!t||!e)return;let o=st();return o.requestAnimationFrame(function i(){o.requestAnimationFrame(i),r(a=>{let d=pc(t);return d.width===a.width&&d.height===a.height?a:d})}),()=>{o.dispose()}},[t,e]),n?{width:`${s.width}px`,height:`${s.height}px`}:s}var ua=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(ua||{});function gc(e){let t=p.useRef(null),n=q(r=>{t.current=r.pointerType,!ia(r.currentTarget)&&r.pointerType==="mouse"&&r.button===ua.Left&&(r.preventDefault(),e(r))}),s=q(r=>{t.current!=="mouse"&&(ia(r.currentTarget)||e(r))});return{onPointerDown:n,onClick:s}}let bc=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var $0=Object.defineProperty,q0=(e,t,n)=>t in e?$0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y0=(e,t,n)=>(q0(e,typeof t!="symbol"?t+"":t,n),n),xc=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},pt=(e,t,n)=>(xc(e,t,"read from private field"),n?n.call(e):t.get(e)),ha=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},wc=(e,t,n,s)=>(xc(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),Lt,Zs,Js;let fa=class{constructor(t){ha(this,Lt,{}),ha(this,Zs,new bc(()=>new Set)),ha(this,Js,new Set),Y0(this,"disposables",st()),wc(this,Lt,t),Dt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return pt(this,Lt)}subscribe(t,n){if(Dt.isServer)return()=>{};let s={selector:t,callback:n,current:t(pt(this,Lt))};return pt(this,Js).add(s),this.disposables.add(()=>{pt(this,Js).delete(s)})}on(t,n){return Dt.isServer?()=>{}:(pt(this,Zs).get(t).add(n),this.disposables.add(()=>{pt(this,Zs).get(t).delete(n)}))}send(t){let n=this.reduce(pt(this,Lt),t);if(n!==pt(this,Lt)){wc(this,Lt,n);for(let s of pt(this,Js)){let r=s.selector(pt(this,Lt));_c(s.current,r)||(s.current=r,s.callback(r))}for(let s of pt(this,Zs).get(t.type))s(pt(this,Lt),t)}}};Lt=new WeakMap,Zs=new WeakMap,Js=new WeakMap;function _c(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:ma(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:ma(e.entries(),t.entries()):yc(e)&&yc(t)?ma(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function ma(e,t){do{let n=e.next(),s=t.next();if(n.done&&s.done)return!0;if(n.done||s.done||!Object.is(n.value,s.value))return!1}while(!0)}function yc(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function vc(e){let[t,n]=e(),s=st();return(...r)=>{t(...r),s.dispose(),s.microTask(n)}}var K0=Object.defineProperty,G0=(e,t,n)=>t in e?K0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kc=(e,t,n)=>(G0(e,typeof t!="symbol"?t+"":t,n),n),pa=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(pa||{});let X0={0(e,t){let n=t.id,s=e.stack,r=e.stack.indexOf(n);if(r!==-1){let o=e.stack.slice();return o.splice(r,1),o.push(n),s=o,{...e,stack:s}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,s=e.stack.indexOf(n);if(s===-1)return e;let r=e.stack.slice();return r.splice(s,1),{...e,stack:r}}},Q0=class Rg extends fa{constructor(){super(...arguments),kc(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),kc(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Rg({stack:[]})}reduce(t,n){return $e(n.type,X0,t,n)}};const xs=new bc(()=>Q0.new());var jc={exports:{}},Sc={};/**
 * @license React
 * use-sync-external-store-with-selector.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var er=p;function Z0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var J0=typeof Object.is=="function"?Object.is:Z0,ex=er.useSyncExternalStore,tx=er.useRef,nx=er.useEffect,sx=er.useMemo,rx=er.useDebugValue;Sc.useSyncExternalStoreWithSelector=function(e,t,n,s,r){var o=tx(null);if(o.current===null){var i={hasValue:!1,value:null};o.current=i}else i=o.current;o=sx(function(){function d(f){if(!c){if(c=!0,u=f,f=s(f),r!==void 0&&i.hasValue){var g=i.value;if(r(g,f))return h=g}return h=f}if(g=h,J0(u,f))return g;var b=s(f);return r!==void 0&&r(g,b)?(u=f,g):(u=f,h=b)}var c=!1,u,h,m=n===void 0?null:n;return[function(){return d(t())},m===null?void 0:function(){return d(m())}]},[t,n,s,r]);var a=ex(e,o[0],o[1]);return nx(function(){i.hasValue=!0,i.value=a},[a]),rx(a),a},jc.exports=Sc;var ox=jc.exports;function xe(e,t,n=_c){return ox.useSyncExternalStoreWithSelector(q(s=>e.subscribe(ix,s)),q(()=>e.state),q(()=>e.state),q(t),n)}function ix(e){return e}function tr(e,t){let n=p.useId(),s=xs.get(t),[r,o]=xe(s,p.useCallback(i=>[s.selectors.isTop(i,n),s.selectors.inStack(i,n)],[s,n]));return ue(()=>{if(e)return s.actions.push(n),()=>s.actions.pop(n)},[s,e,n]),e?o?r:!0:!1}let ga=new Map,nr=new Map;function Nc(e){var t;let n=(t=nr.get(e))!=null?t:0;return nr.set(e,n+1),n!==0?()=>Cc(e):(ga.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Cc(e))}function Cc(e){var t;let n=(t=nr.get(e))!=null?t:1;if(n===1?nr.delete(e):nr.set(e,n-1),n!==1)return;let s=ga.get(e);s&&(s["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",s["aria-hidden"]),e.inert=s.inert,ga.delete(e))}function ba(e,{allowed:t,disallowed:n}={}){let s=tr(e,"inert-others");ue(()=>{var r,o;if(!s)return;let i=st();for(let d of(r=n==null?void 0:n())!=null?r:[])d&&i.add(Nc(d));let a=(o=t==null?void 0:t())!=null?o:[];for(let d of a){if(!d)continue;let c=On(d);if(!c)continue;let u=d.parentElement;for(;u&&u!==c.body;){for(let h of u.children)a.some(m=>h.contains(m))||i.add(Nc(h));u=u.parentElement}}return i.dispose},[s,t,n])}function xa(e,t,n){let s=ln(r=>{let o=r.getBoundingClientRect();o.x===0&&o.y===0&&o.width===0&&o.height===0&&n()});p.useEffect(()=>{if(!e)return;let r=t===null?null:at(t)?t:t.current;if(!r)return;let o=st();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>s.current(r));i.observe(r),o.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>s.current(r));i.observe(r),o.add(()=>i.disconnect())}return()=>o.dispose()},[t,s,e])}let jo=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),ax=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var vt=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(vt||{}),wa=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(wa||{}),lx=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(lx||{});function Mc(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(jo)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function dx(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(ax)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var _a=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(_a||{});function ya(e,t=0){var n;return e===((n=On(e))==null?void 0:n.body)?!1:$e(t,{0(){return e.matches(jo)},1(){let s=e;for(;s!==null;){if(s.matches(jo))return!0;s=s.parentElement}return!1}})}function Ec(e){st().nextFrame(()=>{let t=na(e);t&&Ot(t)&&!ya(t,0)&&At(e)})}var cx=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(cx||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function At(e){e==null||e.focus({preventScroll:!0})}let ux=["textarea","input"].join(",");function hx(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,ux))!=null?n:!1}function va(e,t=n=>n){return e.slice().sort((n,s)=>{let r=t(n),o=t(s);if(r===null||o===null)return 0;let i=r.compareDocumentPosition(o);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function fx(e,t,n=e===null?document.body:mo(e)){return ws(Mc(n),t,{relativeTo:e})}function ws(e,t,{sorted:n=!0,relativeTo:s=null,skipElements:r=[]}={}){let o=Array.isArray(e)?e.length>0?mo(e[0]):document:mo(e),i=Array.isArray(e)?n?va(e):e:t&64?dx(e):Mc(e);r.length>0&&i.length>1&&(i=i.filter(f=>!r.some(g=>g!=null&&"current"in g?(g==null?void 0:g.current)===f:g===f))),s=s??(o==null?void 0:o.activeElement);let a=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),d=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(s))-1;if(t&4)return Math.max(0,i.indexOf(s))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=t&32?{preventScroll:!0}:{},u=0,h=i.length,m;do{if(u>=h||u+h<=0)return 0;let f=d+u;if(t&16)f=(f+h)%h;else{if(f<0)return 3;if(f>=h)return 1}m=i[f],m==null||m.focus(c),u+=a}while(m!==na(m));return t&6&&hx(m)&&m.select(),2}function Pc(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function mx(){return/Android/gi.test(window.navigator.userAgent)}function ka(){return Pc()||mx()}function _s(e,t,n,s){let r=ln(n);p.useEffect(()=>{if(!e)return;function o(i){r.current(i)}return document.addEventListener(t,o,s),()=>document.removeEventListener(t,o,s)},[e,t,s])}function Tc(e,t,n,s){let r=ln(n);p.useEffect(()=>{if(!e)return;function o(i){r.current(i)}return window.addEventListener(t,o,s),()=>window.removeEventListener(t,o,s)},[e,t,s])}const Dc=30;function ja(e,t,n){let s=ln(n),r=p.useCallback(function(a,d){if(a.defaultPrevented)return;let c=d(a);if(c===null||!c.getRootNode().contains(c)||!c.isConnected)return;let u=function h(m){return typeof m=="function"?h(m()):Array.isArray(m)||m instanceof Set?m:[m]}(t);for(let h of u)if(h!==null&&(h.contains(c)||a.composed&&a.composedPath().includes(h)))return;return!ya(c,_a.Loose)&&c.tabIndex!==-1&&a.preventDefault(),s.current(a,c)},[s,t]),o=p.useRef(null);_s(e,"pointerdown",a=>{var d,c;ka()||(o.current=((c=(d=a.composedPath)==null?void 0:d.call(a))==null?void 0:c[0])||a.target)},!0),_s(e,"pointerup",a=>{if(ka()||!o.current)return;let d=o.current;return o.current=null,r(a,()=>d)},!0);let i=p.useRef({x:0,y:0});_s(e,"touchstart",a=>{i.current.x=a.touches[0].clientX,i.current.y=a.touches[0].clientY},!0),_s(e,"touchend",a=>{let d={x:a.changedTouches[0].clientX,y:a.changedTouches[0].clientY};if(!(Math.abs(d.x-i.current.x)>=Dc||Math.abs(d.y-i.current.y)>=Dc))return r(a,()=>Ot(a.target)?a.target:null)},!0),Tc(e,"blur",a=>r(a,()=>x0(window.document.activeElement)?window.document.activeElement:null),!0)}function Fn(...e){return p.useMemo(()=>On(...e),[...e])}var px=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(px||{});const Gt={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},gx=200,Ic=5;function Oc(e,{trigger:t,action:n,close:s,select:r}){let o=p.useRef(null),i=p.useRef(null),a=p.useRef(null);_s(e&&t!==null,"pointerdown",d=>{oc(d==null?void 0:d.target)&&t!=null&&t.contains(d.target)&&(i.current=d.x,a.current=d.y,o.current=d.timeStamp)}),_s(e&&t!==null,"pointerup",d=>{var c,u;let h=o.current;if(h===null||(o.current=null,!Ot(d.target))||Math.abs(d.x-((c=i.current)!=null?c:d.x))<Ic&&Math.abs(d.y-((u=a.current)!=null?u:d.y))<Ic)return;let m=n(d);switch(m.kind){case 0:return;case 1:{d.timeStamp-h>gx&&(r(m.target),s());break}case 2:{s();break}}},{capture:!0})}function Sa(e,t,n,s){let r=ln(n);p.useEffect(()=>{e=e??window;function o(i){r.current(i)}return e.addEventListener(t,o,s),()=>e.removeEventListener(t,o,s)},[e,t,s])}function Lc(e){let t=p.useRef({value:"",selectionStart:null,selectionEnd:null});return Sa(e,"blur",n=>{let s=n.target;wo(s)&&(t.current={value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd})}),q(()=>{if(!po(e)&&wo(e)&&e.isConnected){if(e.focus({preventScroll:!0}),e.value!==t.current.value)e.setSelectionRange(e.value.length,e.value.length);else{let{selectionStart:n,selectionEnd:s}=t.current;n!==null&&s!==null&&e.setSelectionRange(n,s)}t.current={value:"",selectionStart:null,selectionEnd:null}}})}function Na(e,t){return p.useMemo(()=>{var n;if(e.type)return e.type;let s=(n=e.as)!=null?n:"button";if(typeof s=="string"&&s.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function bx(e){return p.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function xx(e,t){let n=e(),s=new Set;return{getSnapshot(){return n},subscribe(r){return s.add(r),()=>s.delete(r)},dispatch(r,...o){let i=t[r].call(n,...o);i&&(n=i,s.forEach(a=>a()))}}}function wx(){let e;return{before({doc:t}){var n;let s=t.documentElement,r=(n=t.defaultView)!=null?n:window;e=Math.max(0,r.innerWidth-s.clientWidth)},after({doc:t,d:n}){let s=t.documentElement,r=Math.max(0,s.clientWidth-s.offsetWidth),o=Math.max(0,e-r);n.style(s,"paddingRight",`${o}px`)}}}function _x(){return Pc()?{before({doc:e,d:t,meta:n}){function s(r){for(let o of n().containers)for(let i of o())if(i.contains(r))return!0;return!1}t.microTask(()=>{var r;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let a=st();a.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>a.dispose()))}let o=(r=window.scrollY)!=null?r:window.pageYOffset,i=null;t.addEventListener(e,"click",a=>{if(Ot(a.target))try{let d=a.target.closest("a");if(!d)return;let{hash:c}=new URL(d.href),u=e.querySelector(c);Ot(u)&&!s(u)&&(i=u)}catch{}},!0),t.group(a=>{t.addEventListener(e,"touchstart",d=>{if(a.dispose(),Ot(d.target)&&b0(d.target))if(s(d.target)){let c=d.target;for(;c.parentElement&&s(c.parentElement);)c=c.parentElement;a.style(c,"overscrollBehavior","contain")}else a.style(d.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",a=>{if(Ot(a.target)){if(wo(a.target))return;if(s(a.target)){let d=a.target;for(;d.parentElement&&d.dataset.headlessuiPortal!==""&&!(d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth);)d=d.parentElement;d.dataset.headlessuiPortal===""&&a.preventDefault()}else a.preventDefault()}},{passive:!1}),t.add(()=>{var a;let d=(a=window.scrollY)!=null?a:window.pageYOffset;o!==d&&window.scrollTo(0,o),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function yx(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Ac(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let zn=xx(()=>new Map,{PUSH(e,t){var n;let s=(n=this.get(e))!=null?n:{doc:e,count:0,d:st(),meta:new Set,computedMeta:{}};return s.count++,s.meta.add(t),s.computedMeta=Ac(s.meta),this.set(e,s),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t),n.computedMeta=Ac(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},n=[_x(),wx(),yx()];n.forEach(({before:s})=>s==null?void 0:s(t)),n.forEach(({after:s})=>s==null?void 0:s(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});zn.subscribe(()=>{let e=zn.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let s=t.get(n.doc)==="hidden",r=n.count!==0;(r&&!s||!r&&s)&&zn.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&zn.dispatch("TEARDOWN",n)}});function vx(e,t,n=()=>({containers:[]})){let s=bx(zn),r=t?s.get(t):void 0,o=r?r.count>0:!1;return ue(()=>{if(!(!t||!e))return zn.dispatch("PUSH",t,n),()=>zn.dispatch("POP",t,n)},[e,t]),o}function Ca(e,t,n=()=>[document.body]){let s=tr(e,"scroll-lock");vx(s,t,r=>{var o;return{containers:[...(o=r.containers)!=null?o:[],n]}})}function Fc(e){return[e.screenX,e.screenY]}function zc(){let e=p.useRef([-1,-1]);return{wasMoved(t){let n=Fc(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Fc(t)}}}function kx(e=0){let[t,n]=p.useState(e),s=p.useCallback(d=>n(d),[]),r=p.useCallback(d=>n(c=>c|d),[]),o=p.useCallback(d=>(t&d)===d,[t]),i=p.useCallback(d=>n(c=>c&~d),[]),a=p.useCallback(d=>n(c=>c^d),[]);return{flags:t,setFlag:s,addFlag:r,hasFlag:o,removeFlag:i,toggleFlag:a}}var Wc,Bc;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Wc=process==null?void 0:process.env)==null?void 0:Wc.NODE_ENV)==="test"&&typeof((Bc=Element==null?void 0:Element.prototype)==null?void 0:Bc.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
`)),[]});var jx=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(jx||{});function Ma(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Ea(e,t,n,s){let[r,o]=p.useState(n),{hasFlag:i,addFlag:a,removeFlag:d}=kx(e&&r?3:0),c=p.useRef(!1),u=p.useRef(!1),h=It();return ue(()=>{var m;if(e){if(n&&o(!0),!t){n&&a(3);return}return(m=s==null?void 0:s.start)==null||m.call(s,n),Sx(t,{inFlight:c,prepare(){u.current?u.current=!1:u.current=c.current,c.current=!0,!u.current&&(n?(a(3),d(4)):(a(4),d(2)))},run(){u.current?n?(d(3),a(4)):(d(4),a(3)):n?d(1):a(1)},done(){var f;u.current&&Mx(t)||(c.current=!1,d(7),n||o(!1),(f=s==null?void 0:s.end)==null||f.call(s,n))}})}},[e,n,t,h]),e?[r,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Sx(e,{prepare:t,run:n,done:s,inFlight:r}){let o=st();return Cx(e,{prepare:t,inFlight:r}),o.nextFrame(()=>{n(),o.requestAnimationFrame(()=>{o.add(Nx(e,s))})}),o.dispose}function Nx(e,t){var n,s;let r=st();if(!e)return r.dispose;let o=!1;r.add(()=>{o=!0});let i=(s=(n=e.getAnimations)==null?void 0:n.call(e).filter(a=>a instanceof CSSTransition))!=null?s:[];return i.length===0?(t(),r.dispose):(Promise.allSettled(i.map(a=>a.finished)).then(()=>{o||t()}),r.dispose)}function Cx(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let s=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=s}function Mx(e){var t,n;return((n=(t=e.getAnimations)==null?void 0:t.call(e))!=null?n:[]).some(s=>s instanceof CSSTransition&&s.playState!=="finished")}function Hc(e,{container:t,accept:n,walk:s}){let r=p.useRef(n),o=p.useRef(s);p.useEffect(()=>{r.current=n,o.current=s},[n,s]),ue(()=>{if(!t||!e)return;let i=On(t);if(!i)return;let a=r.current,d=o.current,c=Object.assign(h=>a(h),{acceptNode:a}),u=i.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,c,!1);for(;u.nextNode();)d(u.currentNode)},[t,e,r,o])}function sr(e,t){let n=p.useRef([]),s=q(e);p.useEffect(()=>{let r=[...n.current];for(let[o,i]of t.entries())if(n.current[o]!==i){let a=s(t,r);return n.current=t,a}},[s,...t])}function So(){return typeof window<"u"}function ys(e){return Vc(e)?(e.nodeName||"").toLowerCase():"#document"}function ut(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ft(e){var t;return(t=(Vc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Vc(e){return So()?e instanceof Node||e instanceof ut(e).Node:!1}function rt(e){return So()?e instanceof Element||e instanceof ut(e).Element:!1}function Xt(e){return So()?e instanceof HTMLElement||e instanceof ut(e).HTMLElement:!1}function Uc(e){return!So()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ut(e).ShadowRoot}function rr(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=kt(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&r!=="inline"&&r!=="contents"}function Ex(e){return/^(table|td|th)$/.test(ys(e))}function No(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Px=/transform|translate|scale|rotate|perspective|filter/,Tx=/paint|layout|strict|content/,Wn=e=>!!e&&e!=="none";let Pa;function Ta(e){const t=rt(e)?kt(e):e;return Wn(t.transform)||Wn(t.translate)||Wn(t.scale)||Wn(t.rotate)||Wn(t.perspective)||!Da()&&(Wn(t.backdropFilter)||Wn(t.filter))||Px.test(t.willChange||"")||Tx.test(t.contain||"")}function Dx(e){let t=hn(e);for(;Xt(t)&&!vs(t);){if(Ta(t))return t;if(No(t))return null;t=hn(t)}return null}function Da(){return Pa==null&&(Pa=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Pa}function vs(e){return/^(html|body|#document)$/.test(ys(e))}function kt(e){return ut(e).getComputedStyle(e)}function Co(e){return rt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function hn(e){if(ys(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Uc(e)&&e.host||Ft(e);return Uc(t)?t.host:t}function Rc(e){const t=hn(e);return vs(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xt(t)&&rr(t)?t:Rc(t)}function or(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Rc(e),o=r===((s=e.ownerDocument)==null?void 0:s.body),i=ut(r);if(o){const a=Ia(i);return t.concat(i,i.visualViewport||[],rr(r)?r:[],a&&n?or(a):[])}else return t.concat(r,or(r,[],n))}function Ia(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ix(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:s}=t;return n+"/"+s}).join(" "):navigator.userAgent}const Bn=Math.min,Ke=Math.max,ir=Math.round,Mo=Math.floor,zt=e=>({x:e,y:e}),Ox={left:"right",right:"left",bottom:"top",top:"bottom"};function $c(e,t,n){return Ke(e,Bn(t,n))}function ks(e,t){return typeof e=="function"?e(t):e}function fn(e){return e.split("-")[0]}function ar(e){return e.split("-")[1]}function qc(e){return e==="x"?"y":"x"}function Yc(e){return e==="y"?"height":"width"}function Qt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Kc(e){return qc(Qt(e))}function Lx(e,t,n){n===void 0&&(n=!1);const s=ar(e),r=Kc(e),o=Yc(r);let i=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Eo(i)),[i,Eo(i)]}function Ax(e){const t=Eo(e);return[Oa(e),t,Oa(t)]}function Oa(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Gc=["left","right"],Xc=["right","left"],Fx=["top","bottom"],zx=["bottom","top"];function Wx(e,t,n){switch(e){case"top":case"bottom":return n?t?Xc:Gc:t?Gc:Xc;case"left":case"right":return t?Fx:zx;default:return[]}}function Bx(e,t,n,s){const r=ar(e);let o=Wx(fn(e),n==="start",s);return r&&(o=o.map(i=>i+"-"+r),t&&(o=o.concat(o.map(Oa)))),o}function Eo(e){const t=fn(e);return Ox[t]+e.slice(t.length)}function Hx(e){return{top:0,right:0,bottom:0,left:0,...e}}function Vx(e){return typeof e!="number"?Hx(e):{top:e,right:e,bottom:e,left:e}}function Po(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}function Qc(e,t,n){let{reference:s,floating:r}=e;const o=Qt(t),i=Kc(t),a=Yc(i),d=fn(t),c=o==="y",u=s.x+s.width/2-r.width/2,h=s.y+s.height/2-r.height/2,m=s[a]/2-r[a]/2;let f;switch(d){case"top":f={x:u,y:s.y-r.height};break;case"bottom":f={x:u,y:s.y+s.height};break;case"right":f={x:s.x+s.width,y:h};break;case"left":f={x:s.x-r.width,y:h};break;default:f={x:s.x,y:s.y}}switch(ar(t)){case"start":f[i]-=m*(n&&c?-1:1);break;case"end":f[i]+=m*(n&&c?-1:1);break}return f}async function Zc(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:o,rects:i,elements:a,strategy:d}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:m=!1,padding:f=0}=ks(t,e),g=Vx(f),x=a[m?h==="floating"?"reference":"floating":h],w=Po(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(x)))==null||n?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:d})),_=h==="floating"?{x:s,y:r,width:i.floating.width,height:i.floating.height}:i.reference,y=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),v=await(o.isElement==null?void 0:o.isElement(y))?await(o.getScale==null?void 0:o.getScale(y))||{x:1,y:1}:{x:1,y:1},j=Po(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:_,offsetParent:y,strategy:d}):_);return{top:(w.top-j.top+g.top)/v.y,bottom:(j.bottom-w.bottom+g.bottom)/v.y,left:(w.left-j.left+g.left)/v.x,right:(j.right-w.right+g.right)/v.x}}const Ux=50,Rx=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:o=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:Zc},d=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:h}=Qc(c,s,d),m=s,f=0;const g={};for(let b=0;b<o.length;b++){const x=o[b];if(!x)continue;const{name:w,fn:_}=x,{x:y,y:v,data:j,reset:k}=await _({x:u,y:h,initialPlacement:s,placement:m,strategy:r,middlewareData:g,rects:c,platform:a,elements:{reference:e,floating:t}});u=y??u,h=v??h,g[w]={...g[w],...j},k&&f<Ux&&(f++,typeof k=="object"&&(k.placement&&(m=k.placement),k.rects&&(c=k.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):k.rects),{x:u,y:h}=Qc(c,m,d)),b=-1)}return{x:u,y:h,placement:m,strategy:r,middlewareData:g}},$x=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:o,rects:i,initialPlacement:a,platform:d,elements:c}=t,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...x}=ks(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const w=fn(r),_=Qt(a),y=fn(a)===a,v=await(d.isRTL==null?void 0:d.isRTL(c.floating)),j=m||(y||!b?[Eo(a)]:Ax(a)),k=g!=="none";!m&&k&&j.push(...Bx(a,b,g,v));const M=[a,...j],N=await d.detectOverflow(t,x),T=[];let P=((s=o.flip)==null?void 0:s.overflows)||[];if(u&&T.push(N[w]),h){const R=Lx(r,i,v);T.push(N[R[0]],N[R[1]])}if(P=[...P,{placement:r,overflows:T}],!T.every(R=>R<=0)){var E,D;const R=(((E=o.flip)==null?void 0:E.index)||0)+1,O=M[R];if(O&&(!(h==="alignment"?_!==Qt(O):!1)||P.every(C=>Qt(C.placement)===_?C.overflows[0]>0:!0)))return{data:{index:R,overflows:P},reset:{placement:O}};let A=(D=P.filter(B=>B.overflows[0]<=0).sort((B,C)=>B.overflows[1]-C.overflows[1])[0])==null?void 0:D.placement;if(!A)switch(f){case"bestFit":{var z;const B=(z=P.filter(C=>{if(k){const F=Qt(C.placement);return F===_||F==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(F=>F>0).reduce((F,U)=>F+U,0)]).sort((C,F)=>C[1]-F[1])[0])==null?void 0:z[0];B&&(A=B);break}case"initialPlacement":A=a;break}if(r!==A)return{reset:{placement:A}}}return{}}}},qx=new Set(["left","top"]);async function Yx(e,t){const{placement:n,platform:s,elements:r}=e,o=await(s.isRTL==null?void 0:s.isRTL(r.floating)),i=fn(n),a=ar(n),d=Qt(n)==="y",c=qx.has(i)?-1:1,u=o&&d?-1:1,h=ks(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof g=="number"&&(f=a==="end"?g*-1:g),d?{x:f*u,y:m*c}:{x:m*c,y:f*u}}const Kx=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:r,y:o,placement:i,middlewareData:a}=t,d=await Yx(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:r+d.x,y:o+d.y,data:{...d,placement:i}}}}},Gx=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r,platform:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:d={fn:w=>{let{x:_,y}=w;return{x:_,y}}},...c}=ks(e,t),u={x:n,y:s},h=await o.detectOverflow(t,c),m=Qt(fn(r)),f=qc(m);let g=u[f],b=u[m];if(i){const w=f==="y"?"top":"left",_=f==="y"?"bottom":"right",y=g+h[w],v=g-h[_];g=$c(y,g,v)}if(a){const w=m==="y"?"top":"left",_=m==="y"?"bottom":"right",y=b+h[w],v=b-h[_];b=$c(y,b,v)}const x=d.fn({...t,[f]:g,[m]:b});return{...x,data:{x:x.x-n,y:x.y-s,enabled:{[f]:i,[m]:a}}}}}},Xx=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:r,rects:o,platform:i,elements:a}=t,{apply:d=()=>{},...c}=ks(e,t),u=await i.detectOverflow(t,c),h=fn(r),m=ar(r),f=Qt(r)==="y",{width:g,height:b}=o.floating;let x,w;h==="top"||h==="bottom"?(x=h,w=m===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(w=h,x=m==="end"?"top":"bottom");const _=b-u.top-u.bottom,y=g-u.left-u.right,v=Bn(b-u[x],_),j=Bn(g-u[w],y),k=!t.middlewareData.shift;let M=v,N=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=y),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(M=_),k&&!m){const P=Ke(u.left,0),E=Ke(u.right,0),D=Ke(u.top,0),z=Ke(u.bottom,0);f?N=g-2*(P!==0||E!==0?P+E:Ke(u.left,u.right)):M=b-2*(D!==0||z!==0?D+z:Ke(u.top,u.bottom))}await d({...t,availableWidth:N,availableHeight:M});const T=await i.getDimensions(a.floating);return g!==T.width||b!==T.height?{reset:{rects:!0}}:{}}}};function Jc(e){const t=kt(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=Xt(e),o=r?e.offsetWidth:n,i=r?e.offsetHeight:s,a=ir(n)!==o||ir(s)!==i;return a&&(n=o,s=i),{width:n,height:s,$:a}}function La(e){return rt(e)?e:e.contextElement}function js(e){const t=La(e);if(!Xt(t))return zt(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:o}=Jc(t);let i=(o?ir(n.width):n.width)/s,a=(o?ir(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Qx=zt(0);function eu(e){const t=ut(e);return!Da()||!t.visualViewport?Qx:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zx(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ut(e)?!1:t}function Hn(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=La(e);let i=zt(1);t&&(s?rt(s)&&(i=js(s)):i=js(e));const a=Zx(o,n,s)?eu(o):zt(0);let d=(r.left+a.x)/i.x,c=(r.top+a.y)/i.y,u=r.width/i.x,h=r.height/i.y;if(o){const m=ut(o),f=s&&rt(s)?ut(s):s;let g=m,b=Ia(g);for(;b&&s&&f!==g;){const x=js(b),w=b.getBoundingClientRect(),_=kt(b),y=w.left+(b.clientLeft+parseFloat(_.paddingLeft))*x.x,v=w.top+(b.clientTop+parseFloat(_.paddingTop))*x.y;d*=x.x,c*=x.y,u*=x.x,h*=x.y,d+=y,c+=v,g=ut(b),b=Ia(g)}}return Po({width:u,height:h,x:d,y:c})}function To(e,t){const n=Co(e).scrollLeft;return t?t.left+n:Hn(Ft(e)).left+n}function tu(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-To(e,n),r=n.top+t.scrollTop;return{x:s,y:r}}function Jx(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const o=r==="fixed",i=Ft(s),a=t?No(t.floating):!1;if(s===i||a&&o)return n;let d={scrollLeft:0,scrollTop:0},c=zt(1);const u=zt(0),h=Xt(s);if((h||!h&&!o)&&((ys(s)!=="body"||rr(i))&&(d=Co(s)),h)){const f=Hn(s);c=js(s),u.x=f.x+s.clientLeft,u.y=f.y+s.clientTop}const m=i&&!h&&!o?tu(i,d):zt(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-d.scrollLeft*c.x+u.x+m.x,y:n.y*c.y-d.scrollTop*c.y+u.y+m.y}}function ew(e){return Array.from(e.getClientRects())}function tw(e){const t=Ft(e),n=Co(e),s=e.ownerDocument.body,r=Ke(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),o=Ke(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let i=-n.scrollLeft+To(e);const a=-n.scrollTop;return kt(s).direction==="rtl"&&(i+=Ke(t.clientWidth,s.clientWidth)-r),{width:r,height:o,x:i,y:a}}const nu=25;function nw(e,t){const n=ut(e),s=Ft(e),r=n.visualViewport;let o=s.clientWidth,i=s.clientHeight,a=0,d=0;if(r){o=r.width,i=r.height;const u=Da();(!u||u&&t==="fixed")&&(a=r.offsetLeft,d=r.offsetTop)}const c=To(s);if(c<=0){const u=s.ownerDocument,h=u.body,m=getComputedStyle(h),f=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,g=Math.abs(s.clientWidth-h.clientWidth-f);g<=nu&&(o-=g)}else c<=nu&&(o+=c);return{width:o,height:i,x:a,y:d}}function sw(e,t){const n=Hn(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,o=Xt(e)?js(e):zt(1),i=e.clientWidth*o.x,a=e.clientHeight*o.y,d=r*o.x,c=s*o.y;return{width:i,height:a,x:d,y:c}}function su(e,t,n){let s;if(t==="viewport")s=nw(e,n);else if(t==="document")s=tw(Ft(e));else if(rt(t))s=sw(t,n);else{const r=eu(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Po(s)}function ru(e,t){const n=hn(e);return n===t||!rt(n)||vs(n)?!1:kt(n).position==="fixed"||ru(n,t)}function rw(e,t){const n=t.get(e);if(n)return n;let s=or(e,[],!1).filter(a=>rt(a)&&ys(a)!=="body"),r=null;const o=kt(e).position==="fixed";let i=o?hn(e):e;for(;rt(i)&&!vs(i);){const a=kt(i),d=Ta(i);!d&&a.position==="fixed"&&(r=null),(o?!d&&!r:!d&&a.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||rr(i)&&!d&&ru(e,i))?s=s.filter(u=>u!==i):r=a,i=hn(i)}return t.set(e,s),s}function ow(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?No(t)?[]:rw(t,this._c):[].concat(n),s],a=su(t,i[0],r);let d=a.top,c=a.right,u=a.bottom,h=a.left;for(let m=1;m<i.length;m++){const f=su(t,i[m],r);d=Ke(f.top,d),c=Bn(f.right,c),u=Bn(f.bottom,u),h=Ke(f.left,h)}return{width:c-h,height:u-d,x:h,y:d}}function iw(e){const{width:t,height:n}=Jc(e);return{width:t,height:n}}function aw(e,t,n){const s=Xt(t),r=Ft(t),o=n==="fixed",i=Hn(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const d=zt(0);function c(){d.x=To(r)}if(s||!s&&!o)if((ys(t)!=="body"||rr(r))&&(a=Co(t)),s){const f=Hn(t,!0,o,t);d.x=f.x+t.clientLeft,d.y=f.y+t.clientTop}else r&&c();o&&!s&&r&&c();const u=r&&!s&&!o?tu(r,a):zt(0),h=i.left+a.scrollLeft-d.x-u.x,m=i.top+a.scrollTop-d.y-u.y;return{x:h,y:m,width:i.width,height:i.height}}function Aa(e){return kt(e).position==="static"}function ou(e,t){if(!Xt(e)||kt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ft(e)===n&&(n=n.ownerDocument.body),n}function iu(e,t){const n=ut(e);if(No(e))return n;if(!Xt(e)){let r=hn(e);for(;r&&!vs(r);){if(rt(r)&&!Aa(r))return r;r=hn(r)}return n}let s=ou(e,t);for(;s&&Ex(s)&&Aa(s);)s=ou(s,t);return s&&vs(s)&&Aa(s)&&!Ta(s)?n:s||Dx(e)||n}const lw=async function(e){const t=this.getOffsetParent||iu,n=this.getDimensions,s=await n(e.floating);return{reference:aw(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function dw(e){return kt(e).direction==="rtl"}const cw={convertOffsetParentRelativeRectToViewportRelativeRect:Jx,getDocumentElement:Ft,getClippingRect:ow,getOffsetParent:iu,getElementRects:lw,getClientRects:ew,getDimensions:iw,getScale:js,isElement:rt,isRTL:dw};function au(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function uw(e,t){let n=null,s;const r=Ft(e);function o(){var a;clearTimeout(s),(a=n)==null||a.disconnect(),n=null}function i(a,d){a===void 0&&(a=!1),d===void 0&&(d=1),o();const c=e.getBoundingClientRect(),{left:u,top:h,width:m,height:f}=c;if(a||t(),!m||!f)return;const g=Mo(h),b=Mo(r.clientWidth-(u+m)),x=Mo(r.clientHeight-(h+f)),w=Mo(u),y={rootMargin:-g+"px "+-b+"px "+-x+"px "+-w+"px",threshold:Ke(0,Bn(1,d))||1};let v=!0;function j(k){const M=k[0].intersectionRatio;if(M!==d){if(!v)return i();M?i(!1,M):s=setTimeout(()=>{i(!1,1e-7)},1e3)}M===1&&!au(c,e.getBoundingClientRect())&&i(),v=!1}try{n=new IntersectionObserver(j,{...y,root:r.ownerDocument})}catch{n=new IntersectionObserver(j,y)}n.observe(e)}return i(!0),o}function hw(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:d=!1}=s,c=La(e),u=r||o?[...c?or(c):[],...t?or(t):[]]:[];u.forEach(w=>{r&&w.addEventListener("scroll",n,{passive:!0}),o&&w.addEventListener("resize",n)});const h=c&&a?uw(c,n):null;let m=-1,f=null;i&&(f=new ResizeObserver(w=>{let[_]=w;_&&_.target===c&&f&&t&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=f)==null||y.observe(t)})),n()}),c&&!d&&f.observe(c),t&&f.observe(t));let g,b=d?Hn(e):null;d&&x();function x(){const w=Hn(e);b&&!au(b,w)&&n(),b=w,g=requestAnimationFrame(x)}return n(),()=>{var w;u.forEach(_=>{r&&_.removeEventListener("scroll",n),o&&_.removeEventListener("resize",n)}),h==null||h(),(w=f)==null||w.disconnect(),f=null,d&&cancelAnimationFrame(g)}}const Fa=Zc,fw=Kx,mw=Gx,pw=$x,gw=Xx,bw=(e,t,n)=>{const s=new Map,r={platform:cw,...n},o={...r.platform,_c:s};return Rx(e,t,{...r,platform:o})};var xw=typeof document<"u",ww=function(){},Do=xw?p.useLayoutEffect:ww;function Io(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!Io(e[s],t[s]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,r[s]))return!1;for(s=n;s--!==0;){const o=r[s];if(!(o==="_owner"&&e.$$typeof)&&!Io(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function lu(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function du(e,t){const n=lu(e);return Math.round(t*n)/n}function za(e){const t=G.useRef(e);return Do(()=>{t.current=e}),t}function _w(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:r,elements:{reference:o,floating:i}={},transform:a=!0,whileElementsMounted:d,open:c}=e,[u,h]=G.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,f]=G.useState(s);Io(m,s)||f(s);const[g,b]=G.useState(null),[x,w]=G.useState(null),_=G.useCallback(C=>{C!==k.current&&(k.current=C,b(C))},[]),y=G.useCallback(C=>{C!==M.current&&(M.current=C,w(C))},[]),v=o||g,j=i||x,k=G.useRef(null),M=G.useRef(null),N=G.useRef(u),T=d!=null,P=za(d),E=za(r),D=za(c),z=G.useCallback(()=>{if(!k.current||!M.current)return;const C={placement:t,strategy:n,middleware:m};E.current&&(C.platform=E.current),bw(k.current,M.current,C).then(F=>{const U={...F,isPositioned:D.current!==!1};R.current&&!Io(N.current,U)&&(N.current=U,no.flushSync(()=>{h(U)}))})},[m,t,n,E,D]);Do(()=>{c===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,h(C=>({...C,isPositioned:!1})))},[c]);const R=G.useRef(!1);Do(()=>(R.current=!0,()=>{R.current=!1}),[]),Do(()=>{if(v&&(k.current=v),j&&(M.current=j),v&&j){if(P.current)return P.current(v,j,z);z()}},[v,j,z,P,T]);const O=G.useMemo(()=>({reference:k,floating:M,setReference:_,setFloating:y}),[_,y]),A=G.useMemo(()=>({reference:v,floating:j}),[v,j]),B=G.useMemo(()=>{const C={position:n,left:0,top:0};if(!A.floating)return C;const F=du(A.floating,u.x),U=du(A.floating,u.y);return a?{...C,transform:"translate("+F+"px, "+U+"px)",...lu(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:U}},[n,a,A.floating,u.x,u.y]);return G.useMemo(()=>({...u,update:z,refs:O,elements:A,floatingStyles:B}),[u,z,O,A,B])}const cu=(e,t)=>{const n=fw(e);return{name:n.name,fn:n.fn,options:[e,t]}},yw=(e,t)=>{const n=mw(e);return{name:n.name,fn:n.fn,options:[e,t]}},vw=(e,t)=>{const n=pw(e);return{name:n.name,fn:n.fn,options:[e,t]}},kw=(e,t)=>{const n=gw(e);return{name:n.name,fn:n.fn,options:[e,t]}},uu={...G},jw=uu.useInsertionEffect||(e=>e());function hu(e){const t=G.useRef(()=>{});return jw(()=>{t.current=e}),G.useCallback(function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];return t.current==null?void 0:t.current(...s)},[])}var Wa=typeof document<"u"?p.useLayoutEffect:p.useEffect;let fu=!1,Sw=0;const mu=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Sw++;function Nw(){const[e,t]=G.useState(()=>fu?mu():void 0);return Wa(()=>{e==null&&t(mu())},[]),G.useEffect(()=>{fu=!0},[]),e}const Cw=uu.useId||Nw;function Mw(){const e=new Map;return{emit(t,n){var s;(s=e.get(t))==null||s.forEach(r=>r(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var s;e.set(t,((s=e.get(t))==null?void 0:s.filter(r=>r!==n))||[])}}}const Ew=G.createContext(null),Pw=G.createContext(null),Tw=()=>{var e;return((e=G.useContext(Ew))==null?void 0:e.id)||null},Dw=()=>G.useContext(Pw),Iw="data-floating-ui-focusable";function Ow(e){const{open:t=!1,onOpenChange:n,elements:s}=e,r=Cw(),o=G.useRef({}),[i]=G.useState(()=>Mw()),a=Tw()!=null,[d,c]=G.useState(s.reference),u=hu((f,g,b)=>{o.current.openEvent=f?g:void 0,i.emit("openchange",{open:f,event:g,reason:b,nested:a}),n==null||n(f,g,b)}),h=G.useMemo(()=>({setPositionReference:c}),[]),m=G.useMemo(()=>({reference:d||s.reference||null,floating:s.floating||null,domReference:s.reference}),[d,s.reference,s.floating]);return G.useMemo(()=>({dataRef:o,open:t,onOpenChange:u,elements:m,events:i,floatingId:r,refs:h}),[t,u,m,i,r,h])}function Lw(e){e===void 0&&(e={});const{nodeId:t}=e,n=Ow({...e,elements:{reference:null,floating:null,...e.elements}}),s=e.rootContext||n,r=s.elements,[o,i]=G.useState(null),[a,d]=G.useState(null),u=(r==null?void 0:r.domReference)||o,h=G.useRef(null),m=Dw();Wa(()=>{u&&(h.current=u)},[u]);const f=_w({...e,elements:{...r,...a&&{reference:a}}}),g=G.useCallback(y=>{const v=rt(y)?{getBoundingClientRect:()=>y.getBoundingClientRect(),contextElement:y}:y;d(v),f.refs.setReference(v)},[f.refs]),b=G.useCallback(y=>{(rt(y)||y===null)&&(h.current=y,i(y)),(rt(f.refs.reference.current)||f.refs.reference.current===null||y!==null&&!rt(y))&&f.refs.setReference(y)},[f.refs]),x=G.useMemo(()=>({...f.refs,setReference:b,setPositionReference:g,domReference:h}),[f.refs,b,g]),w=G.useMemo(()=>({...f.elements,domReference:u}),[f.elements,u]),_=G.useMemo(()=>({...f,...s,refs:x,elements:w,nodeId:t}),[f,x,w,t,s]);return Wa(()=>{s.dataRef.current.floatingContext=_;const y=m==null?void 0:m.nodesRef.current.find(v=>v.id===t);y&&(y.context=_)}),G.useMemo(()=>({...f,context:_,refs:x,elements:w}),[f,x,w,_])}const pu="active",gu="selected";function Ba(e,t,n){const s=new Map,r=n==="item";let o=e;if(r&&e){const{[pu]:i,[gu]:a,...d}=e;o=d}return{...n==="floating"&&{tabIndex:-1,[Iw]:""},...o,...t.map(i=>{const a=i?i[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((i,a)=>(a&&Object.entries(a).forEach(d=>{let[c,u]=d;if(!(r&&[pu,gu].includes(c)))if(c.indexOf("on")===0){if(s.has(c)||s.set(c,[]),typeof u=="function"){var h;(h=s.get(c))==null||h.push(u),i[c]=function(){for(var m,f=arguments.length,g=new Array(f),b=0;b<f;b++)g[b]=arguments[b];return(m=s.get(c))==null?void 0:m.map(x=>x(...g)).find(x=>x!==void 0)}}}else i[c]=u}),i),{})}}function Aw(e){e===void 0&&(e=[]);const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),s=e.map(a=>a==null?void 0:a.item),r=G.useCallback(a=>Ba(a,e,"reference"),t),o=G.useCallback(a=>Ba(a,e,"floating"),n),i=G.useCallback(a=>Ba(a,e,"item"),s);return G.useMemo(()=>({getReferenceProps:r,getFloatingProps:o,getItemProps:i}),[r,o,i])}function bu(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Fw=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:s,onFallbackChange:r,offset:o=0,index:i=0,minItemsVisible:a=4,referenceOverflowThreshold:d=0,scrollRef:c,...u}=ks(e,t),{rects:h,elements:{floating:m}}=t,f=n.current[i],g=(c==null?void 0:c.current)||m,b=m.clientTop||g.clientTop,x=m.clientTop!==0,w=g.clientTop!==0,_=m===g;if(!f)return{};const y={...t,...await cu(-f.offsetTop-m.clientTop-h.reference.height/2-f.offsetHeight/2-o).fn(t)},v=await Fa(bu(y,g.scrollHeight+b+m.clientTop),u),j=await Fa(y,{...u,elementContext:"reference"}),k=Ke(0,v.top),M=y.y+k,P=(g.scrollHeight>g.clientHeight?E=>E:ir)(Ke(0,g.scrollHeight+(x&&_||w?b*2:0)-k-Ke(0,v.bottom)));if(g.style.maxHeight=P+"px",g.scrollTop=k,r){const E=g.offsetHeight<f.offsetHeight*Bn(a,n.current.length)-1||j.top>=-d||j.bottom>=-d;no.flushSync(()=>r(E))}return s&&(s.current=await Fa(bu({...y,y:M},g.offsetHeight+b+m.clientTop),u)),{y:M}}});function zw(e,t){const{open:n,elements:s}=e,{enabled:r=!0,overflowRef:o,scrollRef:i,onChange:a}=t,d=hu(a),c=G.useRef(!1),u=G.useRef(null),h=G.useRef(null);G.useEffect(()=>{if(!r)return;function f(b){if(b.ctrlKey||!g||o.current==null)return;const x=b.deltaY,w=o.current.top>=-.5,_=o.current.bottom>=-.5,y=g.scrollHeight-g.clientHeight,v=x<0?-1:1,j=x<0?"max":"min";g.scrollHeight<=g.clientHeight||(!w&&x>0||!_&&x<0?(b.preventDefault(),no.flushSync(()=>{d(k=>k+Math[j](x,y*v))})):/firefox/i.test(Ix())&&(g.scrollTop+=x))}const g=(i==null?void 0:i.current)||s.floating;if(n&&g)return g.addEventListener("wheel",f),requestAnimationFrame(()=>{u.current=g.scrollTop,o.current!=null&&(h.current={...o.current})}),()=>{u.current=null,h.current=null,g.removeEventListener("wheel",f)}},[r,n,s.floating,o,i,d]);const m=G.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const f=(i==null?void 0:i.current)||s.floating;if(!(!o.current||!f||!c.current)){if(u.current!==null){const g=f.scrollTop-u.current;(o.current.bottom<-.5&&g<-1||o.current.top<-.5&&g>1)&&no.flushSync(()=>d(b=>b+g))}requestAnimationFrame(()=>{u.current=f.scrollTop})}}}),[s.floating,d,o,i]);return G.useMemo(()=>r?{floating:m}:{},[r,m])}let Ss=p.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Ss.displayName="FloatingContext";let Ha=p.createContext(null);Ha.displayName="PlacementContext";function xu(e){return p.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function wu(){return p.useContext(Ss).setReference}function Ww(){return p.useContext(Ss).getReferenceProps}function _u(){let{getFloatingProps:e,slot:t}=p.useContext(Ss);return p.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function yu(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=p.useContext(Ha),n=p.useMemo(()=>e,[JSON.stringify(e,(r,o)=>{var i;return(i=o==null?void 0:o.outerHTML)!=null?i:o})]);ue(()=>{t==null||t(n??null)},[t,n]);let s=p.useContext(Ss);return p.useMemo(()=>[s.setFloating,e?s.styles:{}],[s.setFloating,e,s.styles])}let vu=4;function ku({children:e,enabled:t=!0}){let[n,s]=p.useState(null),[r,o]=p.useState(0),i=p.useRef(null),[a,d]=p.useState(null);Bw(a);let c=t&&n!==null&&a!==null,{to:u="bottom",gap:h=0,offset:m=0,padding:f=0,inner:g}=Hw(n,a),[b,x="center"]=u.split(" ");ue(()=>{c&&o(0)},[c]);let{refs:w,floatingStyles:_,context:y}=Lw({open:c,placement:b==="selection"?x==="center"?"bottom":`bottom-${x}`:x==="center"?`${b}`:`${b}-${x}`,strategy:"absolute",transform:!1,middleware:[cu({mainAxis:b==="selection"?0:h,crossAxis:m}),yw({padding:f}),b!=="selection"&&vw({padding:f}),b==="selection"&&g?Fw({...g,padding:f,overflowRef:i,offset:r,minItemsVisible:vu,referenceOverflowThreshold:f,onFallbackChange(E){var D,z;if(!E)return;let R=y.elements.floating;if(!R)return;let O=parseFloat(getComputedStyle(R).scrollPaddingBottom)||0,A=Math.min(vu,R.childElementCount),B=0,C=0;for(let F of(z=(D=y.elements.floating)==null?void 0:D.childNodes)!=null?z:[])if(at(F)){let U=F.offsetTop,H=U+F.clientHeight+O,L=R.scrollTop,$=L+R.clientHeight;if(U>=L&&H<=$)A--;else{C=Math.max(0,Math.min(H,$)-Math.max(U,L)),B=F.clientHeight;break}}A>=1&&o(F=>{let U=B*A-C+O;return F>=U?F:U})}}):null,kw({padding:f,apply({availableWidth:E,availableHeight:D,elements:z}){Object.assign(z.floating.style,{overflow:"auto",maxWidth:`${E}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${D}px)`})}})].filter(Boolean),whileElementsMounted:hw}),[v=b,j=x]=y.placement.split("-");b==="selection"&&(v="selection");let k=p.useMemo(()=>({anchor:[v,j].filter(Boolean).join(" ")}),[v,j]),M=zw(y,{overflowRef:i,onChange:o}),{getReferenceProps:N,getFloatingProps:T}=Aw([M]),P=q(E=>{d(E),w.setFloating(E)});return G.createElement(Ha.Provider,{value:s},G.createElement(Ss.Provider,{value:{setFloating:P,setReference:w.setReference,styles:_,getReferenceProps:N,getFloatingProps:T,slot:k}},e))}function Bw(e){ue(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,s=parseFloat(n);if(isNaN(s))return;let r=parseInt(n);isNaN(r)||s!==r&&(e.style.maxHeight=`${Math.ceil(s)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function Hw(e,t){var n,s,r;let o=Va((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=Va((s=e==null?void 0:e.offset)!=null?s:"var(--anchor-offset, 0)",t),a=Va((r=e==null?void 0:e.padding)!=null?r:"var(--anchor-padding, 0)",t);return{...e,gap:o,offset:i,padding:a}}function Va(e,t,n=void 0){let s=It(),r=q((d,c)=>{if(d==null)return[n,null];if(typeof d=="number")return[d,null];if(typeof d=="string"){if(!c)return[n,null];let u=Su(d,c);return[u,h=>{let m=ju(d);{let f=m.map(g=>window.getComputedStyle(c).getPropertyValue(g));s.requestAnimationFrame(function g(){s.nextFrame(g);let b=!1;for(let[w,_]of m.entries()){let y=window.getComputedStyle(c).getPropertyValue(_);if(f[w]!==y){f[w]=y,b=!0;break}}if(!b)return;let x=Su(d,c);u!==x&&(h(x),u=x)})}return s.dispose}]}return[n,null]}),o=p.useMemo(()=>r(e,t)[0],[e,t]),[i=o,a]=p.useState();return ue(()=>{let[d,c]=r(e,t);if(a(d),!!c)return c(a)},[e,t]),i}function ju(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let s=t[1].slice(0,n).trim(),r=t[1].slice(n+1).trim();return r?[s,...ju(r)]:[s]}return[]}function Su(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let s=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),s}function Vw({children:e,freeze:t},n){let s=Ua(t,e);return p.isValidElement(s)?p.cloneElement(s,{ref:n}):p.createElement(p.Fragment,null,s)}const Uw=p.forwardRef(Vw);function Ua(e,t){let[n,s]=p.useState(t);return!e&&n!==t&&s(t),e?n:t}let Oo=p.createContext(null);Oo.displayName="OpenClosedContext";var He=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(He||{});function Ns(){return p.useContext(Oo)}function Ra({value:e,children:t}){return p.createElement(Oo.Provider,{value:e},t)}function Rw({children:e}){return p.createElement(Oo.Provider,{value:null},e)}function $w(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Wt=[];$w(()=>{function e(t){if(!Ot(t.target)||t.target===document.body||Wt[0]===t.target)return;let n=t.target;n=n.closest(jo),Wt.unshift(n??t.target),Wt=Wt.filter(s=>s!=null&&s.isConnected),Wt.splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function qw(e){throw new Error("Unexpected object: "+e)}var re=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(re||{});function Cs(e,t){let n=t.resolveItems();if(n.length<=0)return null;let s=t.resolveActiveIndex(),r=s??-1;switch(e.focus){case 0:{for(let o=0;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 1:{r===-1&&(r=n.length);for(let o=r-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 2:{for(let o=r+1;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 3:{for(let o=n.length-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 4:{for(let o=0;o<n.length;++o)if(t.resolveId(n[o],o,n)===e.id)return o;return s}case 5:return null;default:qw(e)}}function Lo(e){let t=q(e),n=p.useRef(!1);p.useEffect(()=>(n.current=!1,()=>{n.current=!0,go(()=>{n.current&&t()})}),[t])}function Yw(){let e=typeof document>"u";return"useSyncExternalStore"in G?(t=>t.useSyncExternalStore)(G)(()=>()=>{},()=>!1,()=>!e):!1}function lr(){let e=Yw(),[t,n]=G.useState(Dt.isHandoffComplete);return t&&Dt.isHandoffComplete===!1&&n(!1),G.useEffect(()=>{t!==!0&&n(!0)},[t]),G.useEffect(()=>Dt.handoff(),[]),e?!1:t}let Nu=p.createContext(!1);function Kw(){return p.useContext(Nu)}function Cu(e){return p.createElement(Nu.Provider,{value:e.force},e.children)}function Gw(e){let t=Kw(),n=p.useContext(Eu),[s,r]=p.useState(()=>{var o;if(!t&&n!==null)return(o=n.current)!=null?o:null;if(Dt.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let a=e.createElement("div");return a.setAttribute("id","headlessui-portal-root"),e.body.appendChild(a)});return p.useEffect(()=>{s!==null&&(e!=null&&e.body.contains(s)||e==null||e.body.appendChild(s))},[s,e]),p.useEffect(()=>{t||n!==null&&r(n.current)},[n,r,t]),s}let Mu=p.Fragment,Xw=he(function(e,t){let{ownerDocument:n=null,...s}=e,r=p.useRef(null),o=Be(v0(f=>{r.current=f}),t),i=Fn(r.current),a=n??i,d=Gw(a),c=p.useContext($a),u=It(),h=lr(),m=me();return Lo(()=>{var f;d&&d.childNodes.length<=0&&((f=d.parentElement)==null||f.removeChild(d))}),!d||!h?null:ze.createPortal(p.createElement("div",{"data-headlessui-portal":"",ref:f=>{u.dispose(),c&&f&&u.add(c.register(f))}},m({ourProps:{ref:o},theirProps:s,slot:{},defaultTag:Mu,name:"Portal"})),d)});function Qw(e,t){let n=Be(t),{enabled:s=!0,ownerDocument:r,...o}=e,i=me();return s?p.createElement(Xw,{...o,ownerDocument:r,ref:n}):i({ourProps:{ref:n},theirProps:o,slot:{},defaultTag:Mu,name:"Portal"})}let Zw=p.Fragment,Eu=p.createContext(null);function Jw(e,t){let{target:n,...s}=e,r={ref:Be(t)},o=me();return p.createElement(Eu.Provider,{value:n},o({ourProps:r,theirProps:s,defaultTag:Zw,name:"Popover.Group"}))}let $a=p.createContext(null);function e_(){let e=p.useContext($a),t=p.useRef([]),n=q(o=>(t.current.push(o),e&&e.register(o),()=>s(o))),s=q(o=>{let i=t.current.indexOf(o);i!==-1&&t.current.splice(i,1),e&&e.unregister(o)}),r=p.useMemo(()=>({register:n,unregister:s,portals:t}),[n,s,t]);return[t,p.useMemo(()=>function({children:o}){return p.createElement($a.Provider,{value:r},o)},[r])]}let t_=he(Qw),Pu=he(Jw),qa=Object.assign(t_,{Group:Pu});const Zt={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function Ya(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function Tu(e,t,n){let s=st();if(t.kind==="Tracked"){let r=function(){o!==Ya(e)&&(s.dispose(),n())},{position:o}=t,i=new ResizeObserver(r);i.observe(e),s.add(()=>i.disconnect()),s.addEventListener(window,"scroll",r,{passive:!0}),s.addEventListener(window,"resize",r)}return()=>s.dispose()}var n_=Object.defineProperty,s_=(e,t,n)=>t in e?n_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Du=(e,t,n)=>(s_(e,typeof t!="symbol"?t+"":t,n),n),oe=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(oe||{}),ht=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(ht||{}),Bt=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(Bt||{}),Iu=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.SetTyping=3]="SetTyping",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e[e.DefaultToFirstOption=6]="DefaultToFirstOption",e[e.SetActivationTrigger=7]="SetActivationTrigger",e[e.UpdateVirtualConfiguration=8]="UpdateVirtualConfiguration",e[e.SetInputElement=9]="SetInputElement",e[e.SetButtonElement=10]="SetButtonElement",e[e.SetOptionsElement=11]="SetOptionsElement",e[e.MarkInputAsMoved=12]="MarkInputAsMoved",e))(Iu||{});function Ka(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,s=t(e.options.slice()),r=s.length>0&&s[0].dataRef.current.order!==null?s.sort((i,a)=>i.dataRef.current.order-a.dataRef.current.order):va(s,i=>i.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let r_={1(e){var t;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1)return e;let n=e.inputElement?Zt.Tracked(Ya(e.inputElement)):e.inputPositionState;return{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,inputPositionState:n,__demoMode:!1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let s=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(s!==-1)return{...e,activeOptionIndex:s,comboboxState:0,__demoMode:!1,inputPositionState:Zt.Idle}}return{...e,comboboxState:0,inputPositionState:Zt.Idle,__demoMode:!1}},3(e,t){return e.isTyping===t.isTyping?e:{...e,isTyping:t.isTyping}},2(e,t){var n,s,r,o;if((n=e.dataRef.current)!=null&&n.disabled||e.optionsElement&&!((s=e.dataRef.current)!=null&&s.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:c,disabled:u}=e.virtual,h=t.focus===re.Specific?t.idx:Cs(t,{resolveItems:()=>c,resolveActiveIndex:()=>{var f,g;return(g=(f=e.activeOptionIndex)!=null?f:c.findIndex(b=>!u(b)))!=null?g:null},resolveDisabled:u,resolveId(){throw new Error("Function not implemented.")}}),m=(r=t.trigger)!=null?r:2;return e.activeOptionIndex===h&&e.activationTrigger===m?e:{...e,activeOptionIndex:h,activationTrigger:m,isTyping:!1,__demoMode:!1}}let i=Ka(e);if(i.activeOptionIndex===null){let c=i.options.findIndex(u=>!u.dataRef.current.disabled);c!==-1&&(i.activeOptionIndex=c)}let a=t.focus===re.Specific?t.idx:Cs(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled}),d=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===a&&e.activationTrigger===d?e:{...e,...i,isTyping:!1,activeOptionIndex:a,activationTrigger:d,__demoMode:!1}},4:(e,t)=>{var n,s,r,o;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let i=t.payload,a=Ka(e,c=>(c.push(i),c));e.activeOptionIndex===null&&(r=(s=e.dataRef.current).isSelected)!=null&&r.call(s,t.payload.dataRef.current.value)&&(a.activeOptionIndex=a.options.indexOf(i));let d={...e,...a,activationTrigger:2};return(o=e.dataRef.current)!=null&&o.__demoMode&&e.dataRef.current.value===void 0&&(d.activeOptionIndex=0),d},5:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(r=>r.id!==t.id)};let s=Ka(e,r=>{let o=r.findIndex(i=>i.id===t.id);return o!==-1&&r.splice(o,1),r});return{...e,...s,activationTrigger:2}},6:(e,t)=>e.defaultToFirstOption===t.value?e:{...e,defaultToFirstOption:t.value},7:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},8:(e,t)=>{var n,s;if(e.virtual===null)return{...e,virtual:{options:t.options,disabled:(n=t.disabled)!=null?n:()=>!1}};if(e.virtual.options===t.options&&e.virtual.disabled===t.disabled)return e;let r=e.activeOptionIndex;if(e.activeOptionIndex!==null){let o=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);o!==-1?r=o:r=null}return{...e,activeOptionIndex:r,virtual:{options:t.options,disabled:(s=t.disabled)!=null?s:()=>!1}}},9:(e,t)=>e.inputElement===t.element?e:{...e,inputElement:t.element},10:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},11:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},12(e){return e.inputPositionState.kind!=="Tracked"?e:{...e,inputPositionState:Zt.Moved}}},o_=class $g extends fa{constructor(t){super(t),Du(this,"actions",{onChange:n=>{let{onChange:s,compare:r,mode:o,value:i}=this.state.dataRef.current;return $e(o,{0:()=>s==null?void 0:s(n),1:()=>{let a=i.slice(),d=a.findIndex(c=>r(c,n));return d===-1?a.push(n):a.splice(d,1),s==null?void 0:s(a)}})},registerOption:(n,s)=>(this.send({type:4,payload:{id:n,dataRef:s}}),()=>{this.state.activeOptionIndex===this.state.dataRef.current.calculateIndex(s.current.value)&&this.send({type:6,value:!0}),this.send({type:5,id:n})}),goToOption:(n,s)=>(this.send({type:6,value:!1}),this.send({type:2,...n,trigger:s})),setIsTyping:n=>{this.send({type:3,isTyping:n})},closeCombobox:()=>{var n,s;this.send({type:1}),this.send({type:6,value:!1}),(s=(n=this.state.dataRef.current).onClose)==null||s.call(n)},openCombobox:()=>{this.send({type:0}),this.send({type:6,value:!0})},setActivationTrigger:n=>{this.send({type:7,trigger:n})},selectActiveOption:()=>{let n=this.selectors.activeOptionIndex(this.state);if(n!==null){if(this.actions.setIsTyping(!1),this.state.virtual)this.actions.onChange(this.state.virtual.options[n]);else{let{dataRef:s}=this.state.options[n];this.actions.onChange(s.current.value)}this.actions.goToOption({focus:re.Specific,idx:n})}},setInputElement:n=>{this.send({type:9,element:n})},setButtonElement:n=>{this.send({type:10,element:n})},setOptionsElement:n=>{this.send({type:11,element:n})}}),Du(this,"selectors",{activeDescendantId:n=>{var s,r;let o=this.selectors.activeOptionIndex(n);if(o!==null)return n.virtual?(r=n.options.find(i=>!i.dataRef.current.disabled&&n.dataRef.current.compare(i.dataRef.current.value,n.virtual.options[o])))==null?void 0:r.id:(s=n.options[o])==null?void 0:s.id},activeOptionIndex:n=>{if(n.defaultToFirstOption&&n.activeOptionIndex===null&&(n.virtual?n.virtual.options.length>0:n.options.length>0)){if(n.virtual){let{options:r,disabled:o}=n.virtual,i=r.findIndex(a=>{var d;return!((d=o==null?void 0:o(a))!=null&&d)});if(i!==-1)return i}let s=n.options.findIndex(r=>!r.dataRef.current.disabled);if(s!==-1)return s}return n.activeOptionIndex},activeOption:n=>{var s,r;let o=this.selectors.activeOptionIndex(n);return o===null?null:n.virtual?n.virtual.options[o??0]:(r=(s=n.options[o])==null?void 0:s.dataRef.current.value)!=null?r:null},isActive:(n,s,r)=>{var o;let i=this.selectors.activeOptionIndex(n);return i===null?!1:n.virtual?i===n.dataRef.current.calculateIndex(s):((o=n.options[i])==null?void 0:o.id)===r},shouldScrollIntoView:(n,s,r)=>!(n.virtual||n.__demoMode||n.comboboxState!==0||n.activationTrigger===0||!this.selectors.isActive(n,s,r)),didInputMove(n){return n.inputPositionState.kind==="Moved"}});{let n=this.state.id,s=xs.get(null);this.disposables.add(s.on(pa.Push,r=>{!s.selectors.isTop(r,n)&&this.state.comboboxState===0&&this.actions.closeCombobox()})),this.on(0,()=>s.actions.push(n)),this.on(1,()=>s.actions.pop(n))}this.disposables.group(n=>{this.on(1,s=>{s.inputElement&&(n.dispose(),n.add(Tu(s.inputElement,s.inputPositionState,()=>{this.send({type:12})})))})})}static new({id:t,virtual:n=null,__demoMode:s=!1}){var r;return new $g({id:t,dataRef:{current:{}},comboboxState:s?0:1,isTyping:!1,options:[],virtual:n?{options:n.options,disabled:(r=n.disabled)!=null?r:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:s,inputPositionState:Zt.Idle})}reduce(t,n){return $e(n.type,r_,t,n)}};const Ou=p.createContext(null);function dr(e){let t=p.useContext(Ou);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Lu),n}return t}function Lu({id:e,virtual:t=null,__demoMode:n=!1}){let s=p.useMemo(()=>o_.new({id:e,virtual:t,__demoMode:n}),[]);return Lo(()=>s.dispose()),s}let cr=p.createContext(null);cr.displayName="ComboboxDataContext";function Ms(e){let t=p.useContext(cr);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ms),n}return t}let Au=p.createContext(null);function i_(e){let t=dr("VirtualProvider"),n=Ms("VirtualProvider"),{options:s}=n.virtual,r=xe(t,f=>f.optionsElement),[o,i]=p.useMemo(()=>{let f=r;if(!f)return[0,0];let g=window.getComputedStyle(f);return[parseFloat(g.paddingBlockStart||g.paddingTop),parseFloat(g.paddingBlockEnd||g.paddingBottom)]},[r]),a=V0({enabled:s.length!==0,scrollPaddingStart:o,scrollPaddingEnd:i,count:s.length,estimateSize(){return 40},getScrollElement(){return t.state.optionsElement},overscan:12}),[d,c]=p.useState(0);ue(()=>{c(f=>f+1)},[s]);let u=a.getVirtualItems(),h=xe(t,f=>f.activationTrigger===Bt.Pointer),m=xe(t,t.selectors.activeOptionIndex);return u.length===0?null:p.createElement(Au.Provider,{value:a},p.createElement("div",{style:{position:"relative",width:"100%",height:`${a.getTotalSize()}px`},ref:f=>{f&&(h||m!==null&&s.length>m&&a.scrollToIndex(m))}},u.map(f=>{var g;return p.createElement(p.Fragment,{key:f.key},p.cloneElement((g=e.children)==null?void 0:g.call(e,{...e.slot,option:s[f.index]}),{key:`${d}-${f.key}`,"data-index":f.index,"aria-setsize":s.length,"aria-posinset":f.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${f.start}px)`,overflowAnchor:"none"}}))})))}let a_=p.Fragment;function l_(e,t){let n=p.useId(),s=Ln(),{value:r,defaultValue:o,onChange:i,form:a,name:d,by:c,invalid:u=!1,disabled:h=s||!1,onClose:m,__demoMode:f=!1,multiple:g=!1,immediate:b=!1,virtual:x=null,nullable:w,..._}=e,y=Zd(o),[v=g?[]:void 0,j]=Qd(r,i,y),k=Lu({id:n,virtual:x,__demoMode:f}),M=p.useRef({static:!1,hold:!1}),N=R0(c),T=q(K=>x?c===null?x.options.indexOf(K):x.options.findIndex(te=>N(te,K)):k.state.options.findIndex(te=>N(te.dataRef.current.value,K))),P=p.useCallback(K=>$e(z.mode,{[ht.Multi]:()=>v.some(te=>N(te,K)),[ht.Single]:()=>N(v,K)}),[v]),E=xe(k,K=>K.virtual),D=q(()=>m==null?void 0:m()),z=p.useMemo(()=>({__demoMode:f,immediate:b,optionsPropsRef:M,value:v,defaultValue:y,disabled:h,invalid:u,mode:g?ht.Multi:ht.Single,virtual:x?E:null,onChange:j,isSelected:P,calculateIndex:T,compare:N,onClose:D}),[f,b,M,v,y,h,u,g,x,E,j,P,T,N,D]);ue(()=>{var K;x&&k.send({type:Iu.UpdateVirtualConfiguration,options:x.options,disabled:(K=x.disabled)!=null?K:null})},[x,x==null?void 0:x.options,x==null?void 0:x.disabled]),ue(()=>{k.state.dataRef.current=z},[z]);let[R,O,A,B]=xe(k,K=>[K.comboboxState,K.buttonElement,K.inputElement,K.optionsElement]),C=xs.get(null),F=xe(C,p.useCallback(K=>C.selectors.isTop(K,n),[C,n]));ja(F,[O,A,B],()=>k.actions.closeCombobox());let U=xe(k,k.selectors.activeOptionIndex),H=xe(k,k.selectors.activeOption),L=We({open:R===oe.Open,disabled:h,invalid:u,activeIndex:U,activeOption:H,value:v}),[$,J]=Qs(),ne=t===null?{}:{ref:t},Q=p.useCallback(()=>{if(y!==void 0)return j==null?void 0:j(y)},[j,y]),V=me();return p.createElement(J,{value:$,props:{htmlFor:A==null?void 0:A.id},slot:{open:R===oe.Open,disabled:h}},p.createElement(ku,null,p.createElement(cr.Provider,{value:z},p.createElement(Ou.Provider,{value:k},p.createElement(Ra,{value:$e(R,{[oe.Open]:He.Open,[oe.Closed]:He.Closed})},d!=null&&p.createElement(sc,{disabled:h,data:v!=null?{[d]:v}:{},form:a,onReset:Q}),V({ourProps:ne,theirProps:_,slot:L,defaultTag:a_,name:"Combobox"}))))))}let d_="input";function c_(e,t){var n,s;let r=dr("Combobox.Input"),o=Ms("Combobox.Input"),i=p.useId(),a=xo(),{id:d=a||`headlessui-combobox-input-${i}`,onChange:c,displayValue:u,disabled:h=o.disabled||!1,autoFocus:m=!1,type:f="text",...g}=e,b=p.useRef(null),x=Be(b,t,wu(),r.actions.setInputElement),[w,_]=xe(r,L=>[L.comboboxState,L.isTyping]),y=It(),v=q(()=>{r.actions.onChange(null),r.state.optionsElement&&(r.state.optionsElement.scrollTop=0),r.actions.goToOption({focus:re.Nothing})}),j=p.useMemo(()=>{var L;return typeof u=="function"&&o.value!==void 0?(L=u(o.value))!=null?L:"":typeof o.value=="string"?o.value:""},[o.value,u]);sr(([L,$],[J,ne])=>{if(r.state.isTyping)return;let Q=b.current;Q&&((ne===oe.Open&&$===oe.Closed||L!==J)&&(Q.value=L),requestAnimationFrame(()=>{if(r.state.isTyping||!Q||po(Q))return;let{selectionStart:V,selectionEnd:K}=Q;Math.abs((K??0)-(V??0))===0&&V===0&&Q.setSelectionRange(Q.value.length,Q.value.length)}))},[j,w,_]),sr(([L],[$])=>{if(L===oe.Open&&$===oe.Closed){if(r.state.isTyping)return;let J=b.current;if(!J)return;let ne=J.value,{selectionStart:Q,selectionEnd:V,selectionDirection:K}=J;J.value="",J.value=ne,K!==null?J.setSelectionRange(Q,V,K):J.setSelectionRange(Q,V)}},[w]);let k=p.useRef(!1),M=q(()=>{k.current=!0}),N=q(()=>{y.nextFrame(()=>{k.current=!1})}),T=q(L=>{switch(r.actions.setIsTyping(!0),L.key){case le.Enter:if(r.state.comboboxState!==oe.Open||k.current)return;if(L.preventDefault(),L.stopPropagation(),r.selectors.activeOptionIndex(r.state)===null){r.actions.closeCombobox();return}r.actions.selectActiveOption(),o.mode===ht.Single&&r.actions.closeCombobox();break;case le.ArrowDown:return L.preventDefault(),L.stopPropagation(),$e(r.state.comboboxState,{[oe.Open]:()=>r.actions.goToOption({focus:re.Next}),[oe.Closed]:()=>r.actions.openCombobox()});case le.ArrowUp:return L.preventDefault(),L.stopPropagation(),$e(r.state.comboboxState,{[oe.Open]:()=>r.actions.goToOption({focus:re.Previous}),[oe.Closed]:()=>{ze.flushSync(()=>r.actions.openCombobox()),o.value||r.actions.goToOption({focus:re.Last})}});case le.Home:if(r.state.comboboxState===oe.Closed||L.shiftKey)break;return L.preventDefault(),L.stopPropagation(),r.actions.goToOption({focus:re.First});case le.PageUp:return L.preventDefault(),L.stopPropagation(),r.actions.goToOption({focus:re.First});case le.End:if(r.state.comboboxState===oe.Closed||L.shiftKey)break;return L.preventDefault(),L.stopPropagation(),r.actions.goToOption({focus:re.Last});case le.PageDown:return L.preventDefault(),L.stopPropagation(),r.actions.goToOption({focus:re.Last});case le.Escape:return r.state.comboboxState!==oe.Open?void 0:(L.preventDefault(),r.state.optionsElement&&!o.optionsPropsRef.current.static&&L.stopPropagation(),o.mode===ht.Single&&o.value===null&&v(),r.actions.closeCombobox());case le.Tab:if(r.actions.setIsTyping(!1),r.state.comboboxState!==oe.Open)return;o.mode===ht.Single&&r.state.activationTrigger!==Bt.Focus&&r.actions.selectActiveOption(),r.actions.closeCombobox();break}}),P=q(L=>{c==null||c(L),o.mode===ht.Single&&L.target.value===""&&v(),r.actions.openCombobox()}),E=q(L=>{var $,J,ne;let Q=($=L.relatedTarget)!=null?$:Wt.find(V=>V!==L.currentTarget);if(!((J=r.state.optionsElement)!=null&&J.contains(Q))&&!((ne=r.state.buttonElement)!=null&&ne.contains(Q))&&r.state.comboboxState===oe.Open)return L.preventDefault(),o.mode===ht.Single&&o.value===null&&v(),r.actions.closeCombobox()}),D=q(L=>{var $,J,ne;let Q=($=L.relatedTarget)!=null?$:Wt.find(V=>V!==L.currentTarget);(J=r.state.buttonElement)!=null&&J.contains(Q)||(ne=r.state.optionsElement)!=null&&ne.contains(Q)||o.disabled||o.immediate&&r.state.comboboxState!==oe.Open&&y.microTask(()=>{ze.flushSync(()=>r.actions.openCombobox()),r.actions.setActivationTrigger(Bt.Focus)})}),z=gs(),R=aa(),{isFocused:O,focusProps:A}=Dn({autoFocus:m}),{isHovered:B,hoverProps:C}=In({isDisabled:h}),F=xe(r,L=>L.optionsElement),U=We({open:w===oe.Open,disabled:h,invalid:o.invalid,hover:B,focus:O,autofocus:m}),H=Yt({ref:x,id:d,role:"combobox",type:f,"aria-controls":F==null?void 0:F.id,"aria-expanded":w===oe.Open,"aria-activedescendant":xe(r,r.selectors.activeDescendantId),"aria-labelledby":z,"aria-describedby":R,"aria-autocomplete":"list",defaultValue:(s=(n=e.defaultValue)!=null?n:o.defaultValue!==void 0?u==null?void 0:u(o.defaultValue):null)!=null?s:o.defaultValue,disabled:h||void 0,autoFocus:m,onCompositionStart:M,onCompositionEnd:N,onKeyDown:T,onChange:P,onFocus:D,onBlur:E},A,C);return me()({ourProps:H,theirProps:g,slot:U,defaultTag:d_,name:"Combobox.Input"})}let u_="button";function h_(e,t){let n=dr("Combobox.Button"),s=Ms("Combobox.Button"),[r,o]=p.useState(null),i=Be(t,o,n.actions.setButtonElement),a=p.useId(),{id:d=`headlessui-combobox-button-${a}`,disabled:c=s.disabled||!1,autoFocus:u=!1,...h}=e,[m,f,g]=xe(n,D=>[D.comboboxState,D.inputElement,D.optionsElement]),b=Lc(f),x=m===oe.Open;Oc(x,{trigger:r,action:p.useCallback(D=>{if(r!=null&&r.contains(D.target)||f!=null&&f.contains(D.target))return Gt.Ignore;let z=D.target.closest('[role="option"]:not([data-disabled])');return at(z)?Gt.Select(z):g!=null&&g.contains(D.target)?Gt.Ignore:Gt.Close},[r,f,g]),close:n.actions.closeCombobox,select:n.actions.selectActiveOption});let w=q(D=>{switch(D.key){case le.Space:case le.Enter:D.preventDefault(),D.stopPropagation(),n.state.comboboxState===oe.Closed&&ze.flushSync(()=>n.actions.openCombobox()),b();return;case le.ArrowDown:D.preventDefault(),D.stopPropagation(),n.state.comboboxState===oe.Closed&&(ze.flushSync(()=>n.actions.openCombobox()),n.state.dataRef.current.value||n.actions.goToOption({focus:re.First})),b();return;case le.ArrowUp:D.preventDefault(),D.stopPropagation(),n.state.comboboxState===oe.Closed&&(ze.flushSync(()=>n.actions.openCombobox()),n.state.dataRef.current.value||n.actions.goToOption({focus:re.Last})),b();return;case le.Escape:if(n.state.comboboxState!==oe.Open)return;D.preventDefault(),n.state.optionsElement&&!s.optionsPropsRef.current.static&&D.stopPropagation(),ze.flushSync(()=>n.actions.closeCombobox()),b();return;default:return}}),_=gc(()=>{n.state.comboboxState===oe.Open?n.actions.closeCombobox():n.actions.openCombobox(),b()}),y=gs([d]),{isFocusVisible:v,focusProps:j}=Dn({autoFocus:u}),{isHovered:k,hoverProps:M}=In({isDisabled:c}),{pressed:N,pressProps:T}=ms({disabled:c}),P=We({open:m===oe.Open,active:N||m===oe.Open,disabled:c,invalid:s.invalid,value:s.value,hover:k,focus:v}),E=Yt({ref:i,id:d,type:Na(e,r),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":g==null?void 0:g.id,"aria-expanded":m===oe.Open,"aria-labelledby":y,disabled:c||void 0,autoFocus:u,onKeyDown:w},_,j,M,T);return me()({ourProps:E,theirProps:h,slot:P,defaultTag:u_,name:"Combobox.Button"})}let f_="div",m_=dn.RenderStrategy|dn.Static;function p_(e,t){var n,s,r;let o=p.useId(),{id:i=`headlessui-combobox-options-${o}`,hold:a=!1,anchor:d,portal:c=!1,modal:u=!0,transition:h=!1,...m}=e,f=dr("Combobox.Options"),g=Ms("Combobox.Options"),b=xu(d);b&&(c=!0);let[x,w]=yu(b),[_,y]=p.useState(null),v=_u(),j=Be(t,b?x:null,f.actions.setOptionsElement,y),[k,M,N,T,P]=xe(f,Me=>[Me.comboboxState,Me.inputElement,Me.buttonElement,Me.optionsElement,Me.activationTrigger]),E=Fn(M||N),D=Fn(T),z=Ns(),[R,O]=Ea(h,_,z!==null?(z&He.Open)===He.Open:k===oe.Open);xa(R,M,f.actions.closeCombobox);let A=g.__demoMode?!1:u&&k===oe.Open;Ca(A,D);let B=g.__demoMode?!1:u&&k===oe.Open;ba(B,{allowed:p.useCallback(()=>[M,N,T],[M,N,T])});let C=xe(f,f.selectors.didInputMove)?!1:R;ue(()=>{var Me;g.optionsPropsRef.current.static=(Me=e.static)!=null?Me:!1},[g.optionsPropsRef,e.static]),ue(()=>{g.optionsPropsRef.current.hold=a},[g.optionsPropsRef,a]),Hc(k===oe.Open,{container:T,accept(Me){return Me.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:Me.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(Me){Me.setAttribute("role","none")}});let F=gs([N==null?void 0:N.id]),U=We({open:k===oe.Open,option:void 0}),H=q(()=>{f.actions.setActivationTrigger(Bt.Pointer)}),L=q(Me=>{Me.preventDefault(),f.actions.setActivationTrigger(Bt.Pointer)}),$=Yt(b?v():{},{"aria-labelledby":F,role:"listbox","aria-multiselectable":g.mode===ht.Multi?!0:void 0,id:i,ref:j,style:{...m.style,...w,"--input-width":ca(R,M,!0).width,"--button-width":ca(R,N,!0).width},onWheel:P===Bt.Pointer?void 0:H,onMouseDown:L,...Ma(O)}),J=R&&k===oe.Closed&&!e.static,ne=Ua(J,(n=g.virtual)==null?void 0:n.options),Q=Ua(J,g.value),V=p.useCallback(Me=>g.compare(Q,Me),[g.compare,Q]),K=p.useMemo(()=>{if(!g.virtual)return g;if(ne===void 0)throw new Error("Missing `options` in virtual mode");return ne!==g.virtual.options?{...g,virtual:{...g.virtual,options:ne}}:g},[g,ne,(s=g.virtual)==null?void 0:s.options]);g.virtual&&Object.assign(m,{children:p.createElement(cr.Provider,{value:K},p.createElement(i_,{slot:U},m.children))});let te=me(),Ne=p.useMemo(()=>g.mode===ht.Multi?g:{...g,isSelected:V},[g,V]);return p.createElement(qa,{enabled:c?e.static||R:!1,ownerDocument:E},p.createElement(cr.Provider,{value:Ne},te({ourProps:$,theirProps:{...m,children:p.createElement(Uw,{freeze:J},typeof m.children=="function"?(r=m.children)==null?void 0:r.call(m,U):m.children)},slot:U,defaultTag:f_,features:m_,visible:C,name:"Combobox.Options"})))}let g_="div";function b_(e,t){var n,s,r;let o=Ms("Combobox.Option"),i=dr("Combobox.Option"),a=p.useId(),{id:d=`headlessui-combobox-option-${a}`,value:c,disabled:u=(r=(s=(n=o.virtual)==null?void 0:n.disabled)==null?void 0:s.call(n,c))!=null?r:!1,order:h=null,...m}=e,[f]=xe(i,O=>[O.inputElement]),g=Lc(f),b=xe(i,p.useCallback(O=>i.selectors.isActive(O,c,d),[c,d])),x=o.isSelected(c),w=p.useRef(null),_=ln({disabled:u,value:c,domRef:w,order:h}),y=p.useContext(Au),v=Be(t,w,y?y.measureElement:null),j=q(()=>{i.actions.setIsTyping(!1),i.actions.onChange(c)});ue(()=>i.actions.registerOption(d,_),[_,d]);let k=xe(i,p.useCallback(O=>i.selectors.shouldScrollIntoView(O,c,d),[c,d]));ue(()=>{if(k)return st().requestAnimationFrame(()=>{var O,A;(A=(O=w.current)==null?void 0:O.scrollIntoView)==null||A.call(O,{block:"nearest"})})},[k,w]);let M=q(O=>{O.preventDefault(),O.button===ua.Left&&(u||(j(),ka()||requestAnimationFrame(()=>g()),o.mode===ht.Single&&i.actions.closeCombobox()))}),N=q(()=>{if(u)return i.actions.goToOption({focus:re.Nothing});let O=o.calculateIndex(c);i.actions.goToOption({focus:re.Specific,idx:O})}),T=zc(),P=q(O=>T.update(O)),E=q(O=>{if(!T.wasMoved(O)||u||b&&i.state.activationTrigger===Bt.Pointer)return;let A=o.calculateIndex(c);i.actions.goToOption({focus:re.Specific,idx:A},Bt.Pointer)}),D=q(O=>{T.wasMoved(O)&&(u||b&&(o.optionsPropsRef.current.hold||i.state.activationTrigger===Bt.Pointer&&i.actions.goToOption({focus:re.Nothing})))}),z=We({active:b,focus:b,selected:x,disabled:u}),R={id:d,ref:v,role:"option",tabIndex:u===!0?void 0:-1,"aria-disabled":u===!0?!0:void 0,"aria-selected":x,disabled:void 0,onMouseDown:M,onFocus:N,onPointerEnter:P,onMouseEnter:P,onPointerMove:E,onMouseMove:E,onPointerLeave:D,onMouseLeave:D};return me()({ourProps:R,theirProps:m,slot:z,defaultTag:g_,name:"Combobox.Option"})}let x_=he(l_),Fu=he(h_),zu=he(c_),w_=da,Wu=he(p_),Bu=he(b_),__=Object.assign(x_,{Input:zu,Button:Fu,Label:w_,Options:Wu,Option:Bu}),y_=p.Fragment;function v_(e,t){let{...n}=e,s=!1,{isFocusVisible:r,focusProps:o}=Dn(),{isHovered:i,hoverProps:a}=In({isDisabled:s}),{pressed:d,pressProps:c}=ms({disabled:s}),u=Yt({ref:t},o,a,c),h=We({hover:i,focus:r,active:d});return me()({ourProps:u,theirProps:n,slot:h,defaultTag:y_,name:"DataInteractive"})}let k_=he(v_);function j_(e,t=typeof document<"u"?document.defaultView:null,n){let s=tr(e,"escape");Sa(t,"keydown",r=>{s&&(r.defaultPrevented||r.key===le.Escape&&n(r))})}function S_(){var e;let[t]=p.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[n,s]=p.useState((e=t==null?void 0:t.matches)!=null?e:!1);return ue(()=>{if(!t)return;function r(o){s(o.matches)}return t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[t]),n}function N_({defaultContainers:e=[],portals:t,mainTreeNode:n}={}){let s=q(()=>{var r,o;let i=On(n),a=[];for(let d of e)d!==null&&(Kt(d)?a.push(d):"current"in d&&Kt(d.current)&&a.push(d.current));if(t!=null&&t.current)for(let d of t.current)a.push(d);for(let d of(r=i==null?void 0:i.querySelectorAll("html > *, body > *"))!=null?r:[])d!==document.body&&d!==document.head&&Kt(d)&&d.id!=="headlessui-portal-root"&&(n&&(d.contains(n)||d.contains((o=n==null?void 0:n.getRootNode())==null?void 0:o.host))||a.some(c=>d.contains(c))||a.push(d));return a});return{resolveContainers:s,contains:q(r=>s().some(o=>o.contains(r)))}}let Hu=p.createContext(null);function Vu({children:e,node:t}){let[n,s]=p.useState(null),r=Uu(t??n);return p.createElement(Hu.Provider,{value:r},e,r===null&&p.createElement(ps,{features:An.Hidden,ref:o=>{var i,a;if(o){for(let d of(a=(i=On(o))==null?void 0:i.querySelectorAll("html > *, body > *"))!=null?a:[])if(d!==document.body&&d!==document.head&&Kt(d)&&d!=null&&d.contains(o)){s(d);break}}}}))}function Uu(e=null){var t;return(t=p.useContext(Hu))!=null?t:e}function Ga(){let e=p.useRef(!1);return ue(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var ur=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(ur||{});function C_(){let e=p.useRef(0);return Tc(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function Ru(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let n of e.current)Kt(n.current)&&t.add(n.current);return t}let M_="div";var Vn=(e=>(e[e.None=0]="None",e[e.InitialFocus=1]="InitialFocus",e[e.TabLock=2]="TabLock",e[e.FocusLock=4]="FocusLock",e[e.RestoreFocus=8]="RestoreFocus",e[e.AutoFocus=16]="AutoFocus",e))(Vn||{});function E_(e,t){let n=p.useRef(null),s=Be(n,t),{initialFocus:r,initialFocusFallback:o,containers:i,features:a=15,...d}=e;lr()||(a=0);let c=Fn(n.current);I_(a,{ownerDocument:c});let u=O_(a,{ownerDocument:c,container:n,initialFocus:r,initialFocusFallback:o});L_(a,{ownerDocument:c,container:n,containers:i,previousActiveElement:u});let h=C_(),m=q(_=>{if(!at(n.current))return;let y=n.current;(v=>v())(()=>{$e(h.current,{[ur.Forwards]:()=>{ws(y,vt.First,{skipElements:[_.relatedTarget,o]})},[ur.Backwards]:()=>{ws(y,vt.Last,{skipElements:[_.relatedTarget,o]})}})})}),f=tr(!!(a&2),"focus-trap#tab-lock"),g=It(),b=p.useRef(!1),x={ref:s,onKeyDown(_){_.key=="Tab"&&(b.current=!0,g.requestAnimationFrame(()=>{b.current=!1}))},onBlur(_){if(!(a&4))return;let y=Ru(i);at(n.current)&&y.add(n.current);let v=_.relatedTarget;Ot(v)&&v.dataset.headlessuiFocusGuard!=="true"&&($u(y,v)||(b.current?ws(n.current,$e(h.current,{[ur.Forwards]:()=>vt.Next,[ur.Backwards]:()=>vt.Previous})|vt.WrapAround,{relativeTo:_.target}):Ot(_.target)&&At(_.target)))}},w=me();return p.createElement(p.Fragment,null,f&&p.createElement(ps,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:m,features:An.Focusable}),w({ourProps:x,theirProps:d,defaultTag:M_,name:"FocusTrap"}),f&&p.createElement(ps,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:m,features:An.Focusable}))}let P_=he(E_),T_=Object.assign(P_,{features:Vn});function D_(e=!0){let t=p.useRef(Wt.slice());return sr(([n],[s])=>{s===!0&&n===!1&&go(()=>{t.current.splice(0)}),s===!1&&n===!0&&(t.current=Wt.slice())},[e,Wt,t]),q(()=>{var n;return(n=t.current.find(s=>s!=null&&s.isConnected))!=null?n:null})}function I_(e,{ownerDocument:t}){let n=!!(e&8),s=D_(n);sr(()=>{n||po(t==null?void 0:t.body)&&At(s())},[n]),Lo(()=>{n&&At(s())})}function O_(e,{ownerDocument:t,container:n,initialFocus:s,initialFocusFallback:r}){let o=p.useRef(null),i=tr(!!(e&1),"focus-trap#initial-focus"),a=Ga();return sr(()=>{if(e===0)return;if(!i){r!=null&&r.current&&At(r.current);return}let d=n.current;d&&go(()=>{if(!a.current)return;let c=t==null?void 0:t.activeElement;if(s!=null&&s.current){if((s==null?void 0:s.current)===c){o.current=c;return}}else if(d.contains(c)){o.current=c;return}if(s!=null&&s.current)At(s.current);else{if(e&16){if(ws(d,vt.First|vt.AutoFocus)!==wa.Error)return}else if(ws(d,vt.First)!==wa.Error)return;if(r!=null&&r.current&&(At(r.current),(t==null?void 0:t.activeElement)===r.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}o.current=t==null?void 0:t.activeElement})},[r,i,e]),o}function L_(e,{ownerDocument:t,container:n,containers:s,previousActiveElement:r}){let o=Ga(),i=!!(e&4);Sa(t==null?void 0:t.defaultView,"focus",a=>{if(!i||!o.current)return;let d=Ru(s);at(n.current)&&d.add(n.current);let c=r.current;if(!c)return;let u=a.target;at(u)?$u(d,u)?(r.current=u,At(u)):(a.preventDefault(),a.stopPropagation(),At(c)):At(r.current)},!0)}function $u(e,t){for(let n of e)if(n.contains(t))return!0;return!1}function qu(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!Xs((t=e.as)!=null?t:Ku)||p.Children.count(e.children)===1}let Ao=p.createContext(null);Ao.displayName="TransitionContext";var A_=(e=>(e.Visible="visible",e.Hidden="hidden",e))(A_||{});function F_(){let e=p.useContext(Ao);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function z_(){let e=p.useContext(Fo);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Fo=p.createContext(null);Fo.displayName="NestingContext";function zo(e){return"children"in e?zo(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Yu(e,t){let n=ln(e),s=p.useRef([]),r=Ga(),o=It(),i=q((f,g=cn.Hidden)=>{let b=s.current.findIndex(({el:x})=>x===f);b!==-1&&($e(g,{[cn.Unmount](){s.current.splice(b,1)},[cn.Hidden](){s.current[b].state="hidden"}}),o.microTask(()=>{var x;!zo(s)&&r.current&&((x=n.current)==null||x.call(n))}))}),a=q(f=>{let g=s.current.find(({el:b})=>b===f);return g?g.state!=="visible"&&(g.state="visible"):s.current.push({el:f,state:"visible"}),()=>i(f,cn.Unmount)}),d=p.useRef([]),c=p.useRef(Promise.resolve()),u=p.useRef({enter:[],leave:[]}),h=q((f,g,b)=>{d.current.splice(0),t&&(t.chains.current[g]=t.chains.current[g].filter(([x])=>x!==f)),t==null||t.chains.current[g].push([f,new Promise(x=>{d.current.push(x)})]),t==null||t.chains.current[g].push([f,new Promise(x=>{Promise.all(u.current[g].map(([w,_])=>_)).then(()=>x())})]),g==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(g)):b(g)}),m=q((f,g,b)=>{Promise.all(u.current[g].splice(0).map(([x,w])=>w)).then(()=>{var x;(x=d.current.shift())==null||x()}).then(()=>b(g))});return p.useMemo(()=>({children:s,register:a,unregister:i,onStart:h,onStop:m,wait:c,chains:u}),[a,i,s,h,m,u,c])}let Ku=p.Fragment,Gu=dn.RenderStrategy;function W_(e,t){var n,s;let{transition:r=!0,beforeEnter:o,afterEnter:i,beforeLeave:a,afterLeave:d,enter:c,enterFrom:u,enterTo:h,entered:m,leave:f,leaveFrom:g,leaveTo:b,...x}=e,[w,_]=p.useState(null),y=p.useRef(null),v=qu(e),j=Be(...v?[y,t,_]:t===null?[]:[t]),k=(n=x.unmount)==null||n?cn.Unmount:cn.Hidden,{show:M,appear:N,initial:T}=F_(),[P,E]=p.useState(M?"visible":"hidden"),D=z_(),{register:z,unregister:R}=D;ue(()=>z(y),[z,y]),ue(()=>{if(k===cn.Hidden&&y.current){if(M&&P!=="visible"){E("visible");return}return $e(P,{hidden:()=>R(y),visible:()=>z(y)})}},[P,y,z,R,M,k]);let O=lr();ue(()=>{if(v&&O&&P==="visible"&&y.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[y,P,O,v]);let A=T&&!N,B=N&&M&&T,C=p.useRef(!1),F=Yu(()=>{C.current||(E("hidden"),R(y))},D),U=q(V=>{C.current=!0;let K=V?"enter":"leave";F.onStart(y,K,te=>{te==="enter"?o==null||o():te==="leave"&&(a==null||a())})}),H=q(V=>{let K=V?"enter":"leave";C.current=!1,F.onStop(y,K,te=>{te==="enter"?i==null||i():te==="leave"&&(d==null||d())}),K==="leave"&&!zo(F)&&(E("hidden"),R(y))});p.useEffect(()=>{v&&r||(U(M),H(M))},[M,v,r]);let L=(()=>!(!r||!v||!O||A))(),[,$]=Ea(L,w,M,{start:U,end:H}),J=un({ref:j,className:((s=sa(x.className,B&&c,B&&u,$.enter&&c,$.enter&&$.closed&&u,$.enter&&!$.closed&&h,$.leave&&f,$.leave&&!$.closed&&g,$.leave&&$.closed&&b,!$.transition&&M&&m))==null?void 0:s.trim())||void 0,...Ma($)}),ne=0;P==="visible"&&(ne|=He.Open),P==="hidden"&&(ne|=He.Closed),M&&P==="hidden"&&(ne|=He.Opening),!M&&P==="visible"&&(ne|=He.Closing);let Q=me();return p.createElement(Fo.Provider,{value:F},p.createElement(Ra,{value:ne},Q({ourProps:J,theirProps:x,defaultTag:Ku,features:Gu,visible:P==="visible",name:"Transition.Child"})))}function B_(e,t){let{show:n,appear:s=!1,unmount:r=!0,...o}=e,i=p.useRef(null),a=qu(e),d=Be(...a?[i,t]:t===null?[]:[t]);lr();let c=Ns();if(n===void 0&&c!==null&&(n=(c&He.Open)===He.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,h]=p.useState(n?"visible":"hidden"),m=Yu(()=>{n||h("hidden")}),[f,g]=p.useState(!0),b=p.useRef([n]);ue(()=>{f!==!1&&b.current[b.current.length-1]!==n&&(b.current.push(n),g(!1))},[b,n]);let x=p.useMemo(()=>({show:n,appear:s,initial:f}),[n,s,f]);ue(()=>{n?h("visible"):!zo(m)&&i.current!==null&&h("hidden")},[n,m]);let w={unmount:r},_=q(()=>{var j;f&&g(!1),(j=e.beforeEnter)==null||j.call(e)}),y=q(()=>{var j;f&&g(!1),(j=e.beforeLeave)==null||j.call(e)}),v=me();return p.createElement(Fo.Provider,{value:m},p.createElement(Ao.Provider,{value:x},v({ourProps:{...w,as:p.Fragment,children:p.createElement(Xu,{ref:d,...w,...o,beforeEnter:_,beforeLeave:y})},theirProps:{},defaultTag:p.Fragment,features:Gu,visible:u==="visible",name:"Transition"})))}function H_(e,t){let n=p.useContext(Ao)!==null,s=Ns()!==null;return p.createElement(p.Fragment,null,!n&&s?p.createElement(Xa,{ref:t,...e}):p.createElement(Xu,{ref:t,...e}))}let Xa=he(B_),Xu=he(W_),Qa=he(H_),V_=Object.assign(Xa,{Child:Qa,Root:Xa});var U_=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(U_||{}),R_=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(R_||{});let $_={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},Za=p.createContext(null);Za.displayName="DialogContext";function Wo(e){let t=p.useContext(Za);if(t===null){let n=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Wo),n}return t}function q_(e,t){return $e(t.type,$_,e,t)}let Qu=he(function(e,t){let n=p.useId(),{id:s=`headlessui-dialog-${n}`,open:r,onClose:o,initialFocus:i,role:a="dialog",autoFocus:d=!0,__demoMode:c=!1,unmount:u=!1,...h}=e,m=p.useRef(!1);a=function(){return a==="dialog"||a==="alertdialog"?a:(m.current||(m.current=!0,console.warn(`Invalid role [${a}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let f=Ns();r===void 0&&f!==null&&(r=(f&He.Open)===He.Open);let g=p.useRef(null),b=Be(g,t),x=Fn(g.current),w=r?0:1,[_,y]=p.useReducer(q_,{titleId:null,descriptionId:null,panelRef:p.createRef()}),v=q(()=>o(!1)),j=q($=>y({type:0,id:$})),k=lr()?w===0:!1,[M,N]=e_(),T={get current(){var $;return($=_.panelRef.current)!=null?$:g.current}},P=Uu(),{resolveContainers:E}=N_({mainTreeNode:P,portals:M,defaultContainers:[T]}),D=f!==null?(f&He.Closing)===He.Closing:!1;ba(c||D?!1:k,{allowed:q(()=>{var $,J;return[(J=($=g.current)==null?void 0:$.closest("[data-headlessui-portal]"))!=null?J:null]}),disallowed:q(()=>{var $;return[($=P==null?void 0:P.closest("body > *:not(#headlessui-portal-root)"))!=null?$:null]})});let z=xs.get(null);ue(()=>{if(k)return z.actions.push(s),()=>z.actions.pop(s)},[z,s,k]);let R=xe(z,p.useCallback($=>z.selectors.isTop($,s),[z,s]));ja(R,E,$=>{$.preventDefault(),v()}),j_(R,x==null?void 0:x.defaultView,$=>{$.preventDefault(),$.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),v()}),Ca(c||D?!1:k,x,E),xa(k,g,v);let[O,A]=yo(),B=p.useMemo(()=>[{dialogState:w,close:v,setTitleId:j,unmount:u},_],[w,v,j,u,_]),C=We({open:w===0}),F={ref:b,id:s,role:a,tabIndex:-1,"aria-modal":c?void 0:w===0?!0:void 0,"aria-labelledby":_.titleId,"aria-describedby":O,unmount:u},U=!S_(),H=Vn.None;k&&!c&&(H|=Vn.RestoreFocus,H|=Vn.TabLock,d&&(H|=Vn.AutoFocus),U&&(H|=Vn.InitialFocus));let L=me();return p.createElement(Rw,null,p.createElement(Cu,{force:!0},p.createElement(qa,null,p.createElement(Za.Provider,{value:B},p.createElement(Pu,{target:g},p.createElement(Cu,{force:!1},p.createElement(A,{slot:C},p.createElement(N,null,p.createElement(T_,{initialFocus:i,initialFocusFallback:g,containers:E,features:H},p.createElement(P0,{value:v},L({ourProps:F,theirProps:h,slot:C,defaultTag:Y_,features:K_,visible:w===0,name:"Dialog"})))))))))))}),Y_="div",K_=dn.RenderStrategy|dn.Static;function G_(e,t){let{transition:n=!1,open:s,...r}=e,o=Ns(),i=e.hasOwnProperty("open")||o!==null,a=e.hasOwnProperty("onClose");if(!i&&!a)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!i)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!a)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!o&&typeof e.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(s!==void 0||n)&&!r.static?p.createElement(Vu,null,p.createElement(V_,{show:s,transition:n,unmount:r.unmount},p.createElement(Qu,{ref:t,...r}))):p.createElement(Vu,null,p.createElement(Qu,{ref:t,open:s,...r}))}let X_="div";function Q_(e,t){let n=p.useId(),{id:s=`headlessui-dialog-panel-${n}`,transition:r=!1,...o}=e,[{dialogState:i,unmount:a},d]=Wo("Dialog.Panel"),c=Be(t,d.panelRef),u=We({open:i===0}),h=q(x=>{x.stopPropagation()}),m={ref:c,id:s,onClick:h},f=r?Qa:p.Fragment,g=r?{unmount:a}:{},b=me();return p.createElement(f,{...g},b({ourProps:m,theirProps:o,slot:u,defaultTag:X_,name:"Dialog.Panel"}))}let Z_="div";function J_(e,t){let{transition:n=!1,...s}=e,[{dialogState:r,unmount:o}]=Wo("Dialog.Backdrop"),i=We({open:r===0}),a={ref:t,"aria-hidden":!0},d=n?Qa:p.Fragment,c=n?{unmount:o}:{},u=me();return p.createElement(d,{...c},u({ourProps:a,theirProps:s,slot:i,defaultTag:Z_,name:"Dialog.Backdrop"}))}let ey="h2";function ty(e,t){let n=p.useId(),{id:s=`headlessui-dialog-title-${n}`,...r}=e,[{dialogState:o,setTitleId:i}]=Wo("Dialog.Title"),a=Be(t);p.useEffect(()=>(i(s),()=>i(null)),[s,i]);let d=We({open:o===0}),c={ref:a,id:s};return me()({ourProps:c,theirProps:r,slot:d,defaultTag:ey,name:"Dialog.Title"})}let ny=he(G_),Ja=he(Q_),Zu=he(J_),el=he(ty),Bo=Object.assign(ny,{Panel:Ja,Title:el,Description:vo}),sy="div";function ry(e,t){let n=`headlessui-control-${p.useId()}`,[s,r]=Qs(),[o,i]=yo(),a=Ln(),{disabled:d=a||!1,...c}=e,u=We({disabled:d}),h={ref:t,disabled:d||void 0,"aria-disabled":d||void 0},m=me();return p.createElement(e0,{value:d},p.createElement(r,{value:s},p.createElement(i,{value:o},p.createElement(g0,{id:n},m({ourProps:h,theirProps:{...c,children:p.createElement(f0,null,typeof c.children=="function"?c.children(u):c.children)},slot:u,defaultTag:sy,name:"Field"})))))}let oy=he(ry),Ju=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function eh(e){var t,n;let s=(t=e.innerText)!=null?t:"",r=e.cloneNode(!0);if(!at(r))return s;let o=!1;for(let a of r.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))a.remove(),o=!0;let i=o?(n=r.innerText)!=null?n:"":s;return Ju.test(i)&&(i=i.replace(Ju,"")),i}function iy(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let s=n.split(" ").map(r=>{let o=document.getElementById(r);if(o){let i=o.getAttribute("aria-label");return typeof i=="string"?i.trim():eh(o).trim()}return null}).filter(Boolean);if(s.length>0)return s.join(", ")}return eh(e).trim()}function ay(e){let t=p.useRef(""),n=p.useRef("");return q(()=>{let s=e.current;if(!s)return"";let r=s.innerText;if(t.current===r)return n.current;let o=iy(s).trim().toLowerCase();return t.current=r,n.current=o,o})}var ly=Object.defineProperty,dy=(e,t,n)=>t in e?ly(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,th=(e,t,n)=>(dy(e,typeof t!="symbol"?t+"":t,n),n),Ge=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Ge||{}),Ho=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Ho||{}),ve=(e=>(e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItems=5]="RegisterItems",e[e.UnregisterItems=6]="UnregisterItems",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetItemsElement=8]="SetItemsElement",e[e.SortItems=9]="SortItems",e[e.MarkButtonAsMoved=10]="MarkButtonAsMoved",e))(ve||{});function nh(e,t=n=>n){let n=e.activeItemIndex!==null?e.items[e.activeItemIndex]:null,s=va(t(e.items.slice()),o=>o.dataRef.current.domRef.current),r=n?s.indexOf(n):null;return r===-1&&(r=null),{items:s,activeItemIndex:r}}let cy={1(e){if(e.menuState===1)return e;let t=e.buttonElement?Zt.Tracked(Ya(e.buttonElement)):e.buttonPositionState;return{...e,activeItemIndex:null,pendingFocus:{focus:re.Nothing},menuState:1,buttonPositionState:t}},0(e,t){return e.menuState===0?e:{...e,__demoMode:!1,pendingFocus:t.focus,menuState:0,buttonPositionState:Zt.Idle}},2:(e,t)=>{var n,s,r,o,i;if(e.menuState===1)return e;let a={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===re.Nothing)return{...a,activeItemIndex:null};if(t.focus===re.Specific)return{...a,activeItemIndex:e.items.findIndex(u=>u.id===t.id)};if(t.focus===re.Previous){let u=e.activeItemIndex;if(u!==null){let h=e.items[u].dataRef.current.domRef,m=Cs(t,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(m!==null){let f=e.items[m].dataRef.current.domRef;if(((s=h.current)==null?void 0:s.previousElementSibling)===f.current||((r=f.current)==null?void 0:r.previousElementSibling)===null)return{...a,activeItemIndex:m}}}}else if(t.focus===re.Next){let u=e.activeItemIndex;if(u!==null){let h=e.items[u].dataRef.current.domRef,m=Cs(t,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(m!==null){let f=e.items[m].dataRef.current.domRef;if(((o=h.current)==null?void 0:o.nextElementSibling)===f.current||((i=f.current)==null?void 0:i.nextElementSibling)===null)return{...a,activeItemIndex:m}}}}let d=nh(e),c=Cs(t,{resolveItems:()=>d.items,resolveActiveIndex:()=>d.activeItemIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...a,...d,activeItemIndex:c}},3:(e,t)=>{let n=e.searchQuery!==""?0:1,s=e.searchQuery+t.value.toLowerCase(),r=(e.activeItemIndex!==null?e.items.slice(e.activeItemIndex+n).concat(e.items.slice(0,e.activeItemIndex+n)):e.items).find(i=>{var a;return((a=i.dataRef.current.textValue)==null?void 0:a.startsWith(s))&&!i.dataRef.current.disabled}),o=r?e.items.indexOf(r):-1;return o===-1||o===e.activeItemIndex?{...e,searchQuery:s}:{...e,searchQuery:s,activeItemIndex:o,activationTrigger:1}},4(e){return e.searchQuery===""?e:{...e,searchQuery:"",searchActiveItemIndex:null}},5:(e,t)=>{let n=e.items.concat(t.items.map(r=>r)),s=e.activeItemIndex;return e.pendingFocus.focus!==re.Nothing&&(s=Cs(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeItemIndex,resolveId:r=>r.id,resolveDisabled:r=>r.dataRef.current.disabled})),{...e,items:n,activeItemIndex:s,pendingFocus:{focus:re.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.items,s=[],r=new Set(t.items);for(let[o,i]of n.entries())if(r.has(i.id)&&(s.push(o),r.delete(i.id),r.size===0))break;if(s.length>0){n=n.slice();for(let o of s.reverse())n.splice(o,1)}return{...e,items:n,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.itemsElement===t.element?e:{...e,itemsElement:t.element},9:e=>e.pendingShouldSort?{...e,...nh(e),pendingShouldSort:!1}:e,10(e){return e.buttonPositionState.kind!=="Tracked"?e:{...e,buttonPositionState:Zt.Moved}}},uy=class qg extends fa{constructor(t){super(t),th(this,"actions",{registerItem:vc(()=>{let n=[],s=new Set;return[(r,o)=>{s.has(o)||(s.add(o),n.push({id:r,dataRef:o}))},()=>(s.clear(),this.send({type:5,items:n.splice(0)}))]}),unregisterItem:vc(()=>{let n=[];return[s=>n.push(s),()=>this.send({type:6,items:n.splice(0)})]})}),th(this,"selectors",{activeDescendantId(n){var s;let r=n.activeItemIndex,o=n.items;return r===null||(s=o[r])==null?void 0:s.id},isActive(n,s){var r;let o=n.activeItemIndex,i=n.items;return o!==null?((r=i[o])==null?void 0:r.id)===s:!1},shouldScrollIntoView(n,s){return n.__demoMode||n.menuState!==0||n.activationTrigger===0?!1:this.isActive(n,s)},didButtonMove(n){return n.buttonPositionState.kind==="Moved"}}),this.on(5,()=>{this.disposables.requestAnimationFrame(()=>{this.send({type:9})})});{let n=this.state.id,s=xs.get(null);this.disposables.add(s.on(pa.Push,r=>{!s.selectors.isTop(r,n)&&this.state.menuState===0&&this.send({type:1})})),this.on(0,()=>s.actions.push(n)),this.on(1,()=>s.actions.pop(n))}this.disposables.group(n=>{this.on(1,s=>{s.buttonElement&&(n.dispose(),n.add(Tu(s.buttonElement,s.buttonPositionState,()=>{this.send({type:10})})))})})}static new({id:t,__demoMode:n=!1}){return new qg({id:t,__demoMode:n,menuState:n?0:1,buttonElement:null,itemsElement:null,items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1,pendingShouldSort:!1,pendingFocus:{focus:re.Nothing},buttonPositionState:Zt.Idle})}reduce(t,n){return $e(n.type,cy,t,n)}};const sh=p.createContext(null);function tl(e){let t=p.useContext(sh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,rh),n}return t}function rh({id:e,__demoMode:t=!1}){let n=p.useMemo(()=>uy.new({id:e,__demoMode:t}),[]);return Lo(()=>n.dispose()),n}let hy=p.Fragment;function fy(e,t){let n=p.useId(),{__demoMode:s=!1,...r}=e,o=rh({id:n,__demoMode:s}),[i,a,d]=xe(o,x=>[x.menuState,x.itemsElement,x.buttonElement]),c=Be(t),u=xs.get(null),h=xe(u,p.useCallback(x=>u.selectors.isTop(x,n),[u,n]));ja(h,[d,a],(x,w)=>{var _;o.send({type:ve.CloseMenu}),ya(w,_a.Loose)||(x.preventDefault(),(_=o.state.buttonElement)==null||_.focus())});let m=q(()=>{o.send({type:ve.CloseMenu})}),f=We({open:i===Ge.Open,close:m}),g={ref:c},b=me();return p.createElement(ku,null,p.createElement(sh.Provider,{value:o},p.createElement(Ra,{value:$e(i,{[Ge.Open]:He.Open,[Ge.Closed]:He.Closed})},b({ourProps:g,theirProps:r,slot:f,defaultTag:hy,name:"Menu"}))))}let my="button";function py(e,t){let n=tl("Menu.Button"),s=p.useId(),{id:r=`headlessui-menu-button-${s}`,disabled:o=!1,autoFocus:i=!1,...a}=e,d=p.useRef(null),c=Ww(),u=Be(t,d,wu(),q(P=>n.send({type:ve.SetButtonElement,element:P}))),h=q(P=>{switch(P.key){case le.Space:case le.Enter:case le.ArrowDown:P.preventDefault(),P.stopPropagation(),n.send({type:ve.OpenMenu,focus:{focus:re.First}});break;case le.ArrowUp:P.preventDefault(),P.stopPropagation(),n.send({type:ve.OpenMenu,focus:{focus:re.Last}});break}}),m=q(P=>{switch(P.key){case le.Space:P.preventDefault();break}}),[f,g,b]=xe(n,P=>[P.menuState,P.buttonElement,P.itemsElement]),x=f===Ge.Open;Oc(x,{trigger:g,action:p.useCallback(P=>{if(g!=null&&g.contains(P.target))return Gt.Ignore;let E=P.target.closest('[role="menuitem"]:not([data-disabled])');return at(E)?Gt.Select(E):b!=null&&b.contains(P.target)?Gt.Ignore:Gt.Close},[g,b]),close:p.useCallback(()=>n.send({type:ve.CloseMenu}),[]),select:p.useCallback(P=>P.click(),[])});let w=gc(P=>{var E;o||(f===Ge.Open?(ze.flushSync(()=>n.send({type:ve.CloseMenu})),(E=d.current)==null||E.focus({preventScroll:!0})):(P.preventDefault(),n.send({type:ve.OpenMenu,focus:{focus:re.Nothing},trigger:Ho.Pointer})))}),{isFocusVisible:_,focusProps:y}=Dn({autoFocus:i}),{isHovered:v,hoverProps:j}=In({isDisabled:o}),{pressed:k,pressProps:M}=ms({disabled:o}),N=We({open:f===Ge.Open,active:k||f===Ge.Open,disabled:o,hover:v,focus:_,autofocus:i}),T=Yt(c(),{ref:u,id:r,type:Na(e,d.current),"aria-haspopup":"menu","aria-controls":b==null?void 0:b.id,"aria-expanded":f===Ge.Open,disabled:o||void 0,autoFocus:i,onKeyDown:h,onKeyUp:m},w,y,j,M);return me()({ourProps:T,theirProps:a,slot:N,defaultTag:my,name:"Menu.Button"})}let gy="div",by=dn.RenderStrategy|dn.Static;function xy(e,t){let n=p.useId(),{id:s=`headlessui-menu-items-${n}`,anchor:r,portal:o=!1,modal:i=!0,transition:a=!1,...d}=e,c=xu(r),u=tl("Menu.Items"),[h,m]=yu(c),f=_u(),[g,b]=p.useState(null),x=Be(t,c?h:null,q(C=>u.send({type:ve.SetItemsElement,element:C})),b),[w,_]=xe(u,C=>[C.menuState,C.buttonElement]),y=Fn(_),v=Fn(g);c&&(o=!0);let j=Ns(),[k,M]=Ea(a,g,j!==null?(j&He.Open)===He.Open:w===Ge.Open);xa(k,_,()=>{u.send({type:ve.CloseMenu})});let N=xe(u,C=>C.__demoMode),T=N?!1:i&&w===Ge.Open;Ca(T,v);let P=N?!1:i&&w===Ge.Open;ba(P,{allowed:p.useCallback(()=>[_,g],[_,g])});let E=xe(u,u.selectors.didButtonMove)?!1:k;p.useEffect(()=>{let C=g;C&&w===Ge.Open&&(po(C)||C.focus({preventScroll:!0}))},[w,g]),Hc(w===Ge.Open,{container:g,accept(C){return C.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:C.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(C){C.setAttribute("role","none")}});let D=It(),z=q(C=>{var F,U,H;switch(D.dispose(),C.key){case le.Space:if(u.state.searchQuery!=="")return C.preventDefault(),C.stopPropagation(),u.send({type:ve.Search,value:C.key});case le.Enter:if(C.preventDefault(),C.stopPropagation(),u.state.activeItemIndex!==null){let{dataRef:L}=u.state.items[u.state.activeItemIndex];(U=(F=L.current)==null?void 0:F.domRef.current)==null||U.click()}u.send({type:ve.CloseMenu}),Ec(u.state.buttonElement);break;case le.ArrowDown:return C.preventDefault(),C.stopPropagation(),u.send({type:ve.GoToItem,focus:re.Next});case le.ArrowUp:return C.preventDefault(),C.stopPropagation(),u.send({type:ve.GoToItem,focus:re.Previous});case le.Home:case le.PageUp:return C.preventDefault(),C.stopPropagation(),u.send({type:ve.GoToItem,focus:re.First});case le.End:case le.PageDown:return C.preventDefault(),C.stopPropagation(),u.send({type:ve.GoToItem,focus:re.Last});case le.Escape:C.preventDefault(),C.stopPropagation(),ze.flushSync(()=>u.send({type:ve.CloseMenu})),(H=u.state.buttonElement)==null||H.focus({preventScroll:!0});break;case le.Tab:C.preventDefault(),C.stopPropagation(),ze.flushSync(()=>u.send({type:ve.CloseMenu})),fx(u.state.buttonElement,C.shiftKey?vt.Previous:vt.Next);break;default:C.key.length===1&&(u.send({type:ve.Search,value:C.key}),D.setTimeout(()=>u.send({type:ve.ClearSearch}),350));break}}),R=q(C=>{switch(C.key){case le.Space:C.preventDefault();break}}),O=We({open:w===Ge.Open}),A=Yt(c?f():{},{"aria-activedescendant":xe(u,u.selectors.activeDescendantId),"aria-labelledby":xe(u,C=>{var F;return(F=C.buttonElement)==null?void 0:F.id}),id:s,onKeyDown:z,onKeyUp:R,role:"menu",tabIndex:w===Ge.Open?0:void 0,ref:x,style:{...d.style,...m,"--button-width":ca(k,_,!0).width},...Ma(M)}),B=me();return p.createElement(qa,{enabled:o?e.static||k:!1,ownerDocument:y},B({ourProps:A,theirProps:d,slot:O,defaultTag:gy,features:by,visible:E,name:"Menu.Items"}))}let wy=p.Fragment;function _y(e,t){let n=p.useId(),{id:s=`headlessui-menu-item-${n}`,disabled:r=!1,...o}=e,i=tl("Menu.Item"),a=xe(i,E=>i.selectors.isActive(E,s)),d=p.useRef(null),c=Be(t,d),u=xe(i,E=>i.selectors.shouldScrollIntoView(E,s));ue(()=>{if(u)return st().requestAnimationFrame(()=>{var E,D;(D=(E=d.current)==null?void 0:E.scrollIntoView)==null||D.call(E,{block:"nearest"})})},[u,d]);let h=ay(d),m=p.useRef({disabled:r,domRef:d,get textValue(){return h()}});ue(()=>{m.current.disabled=r},[m,r]),ue(()=>(i.actions.registerItem(s,m),()=>i.actions.unregisterItem(s)),[m,s]);let f=q(()=>{i.send({type:ve.CloseMenu})}),g=q(E=>{if(r)return E.preventDefault();i.send({type:ve.CloseMenu}),Ec(i.state.buttonElement)}),b=q(()=>{if(r)return i.send({type:ve.GoToItem,focus:re.Nothing});i.send({type:ve.GoToItem,focus:re.Specific,id:s})}),x=zc(),w=q(E=>x.update(E)),_=q(E=>{x.wasMoved(E)&&(r||a||i.send({type:ve.GoToItem,focus:re.Specific,id:s,trigger:Ho.Pointer}))}),y=q(E=>{x.wasMoved(E)&&(r||a&&i.state.activationTrigger===Ho.Pointer&&i.send({type:ve.GoToItem,focus:re.Nothing}))}),[v,j]=Qs(),[k,M]=yo(),N=We({active:a,focus:a,disabled:r,close:f}),T={id:s,ref:c,role:"menuitem",tabIndex:r===!0?void 0:-1,"aria-disabled":r===!0?!0:void 0,"aria-labelledby":v,"aria-describedby":k,disabled:void 0,onClick:g,onFocus:b,onPointerEnter:w,onMouseEnter:w,onPointerMove:_,onMouseMove:_,onPointerLeave:y,onMouseLeave:y},P=me();return p.createElement(j,null,p.createElement(M,null,P({ourProps:T,theirProps:o,slot:N,defaultTag:wy,name:"Menu.Item"})))}let yy="div";function vy(e,t){let[n,s]=Qs(),r=e,o={ref:t,"aria-labelledby":n,role:"group"},i=me();return p.createElement(s,null,i({ourProps:o,theirProps:r,slot:{},defaultTag:yy,name:"Menu.Section"}))}let ky="header";function jy(e,t){let n=p.useId(),{id:s=`headlessui-menu-heading-${n}`,...r}=e,o=la();ue(()=>o.register(s),[s,o.register]);let i={id:s,ref:t,role:"presentation",...o.props};return me()({ourProps:i,theirProps:r,slot:{},defaultTag:ky,name:"Menu.Heading"})}let Sy="div";function Ny(e,t){let n=e,s={ref:t,role:"separator"};return me()({ourProps:s,theirProps:n,slot:{},defaultTag:Sy,name:"Menu.Separator"})}let Cy=he(fy),oh=he(py),ih=he(xy),nl=he(_y),My=he(vy),Ey=he(jy),Py=he(Ny),Ty=Object.assign(Cy,{Button:oh,Items:ih,Item:nl,Section:My,Heading:Ey,Separator:Py}),Dy="select";function Iy(e,t){let n=p.useId(),s=xo(),r=Ln(),{id:o=s||`headlessui-select-${n}`,disabled:i=r||!1,invalid:a=!1,autoFocus:d=!1,...c}=e,u=gs(),h=aa(),{isFocusVisible:m,focusProps:f}=Dn({autoFocus:d}),{isHovered:g,hoverProps:b}=In({isDisabled:i}),{pressed:x,pressProps:w}=ms({disabled:i}),_=Yt({ref:t,id:o,"aria-labelledby":u,"aria-describedby":h,"aria-invalid":a?"true":void 0,disabled:i||void 0,autoFocus:d},f,b,w),y=We({disabled:i,invalid:a,hover:g,focus:m,active:x,autofocus:d});return me()({ourProps:_,theirProps:c,slot:y,defaultTag:Dy,name:"Select"})}let Oy=he(Iy),sl=p.createContext(null);sl.displayName="GroupContext";let Ly=p.Fragment;function Ay(e){var t;let[n,s]=p.useState(null),[r,o]=Qs(),[i,a]=yo(),d=p.useMemo(()=>({switch:n,setSwitch:s}),[n,s]),c={},u=e,h=me();return p.createElement(a,{name:"Switch.Description",value:i},p.createElement(o,{name:"Switch.Label",value:r,props:{htmlFor:(t=d.switch)==null?void 0:t.id,onClick(m){n&&(oa(m.currentTarget)&&m.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},p.createElement(sl.Provider,{value:d},h({ourProps:c,theirProps:u,slot:{},defaultTag:Ly,name:"Switch.Group"}))))}let Fy="button";function zy(e,t){var n;let s=p.useId(),r=xo(),o=Ln(),{id:i=r||`headlessui-switch-${s}`,disabled:a=o||!1,checked:d,defaultChecked:c,onChange:u,name:h,value:m,form:f,autoFocus:g=!1,...b}=e,x=p.useContext(sl),[w,_]=p.useState(null),y=p.useRef(null),v=Be(y,t,x===null?null:x.setSwitch,_),j=Zd(c),[k,M]=Qd(d,u,j??!1),N=It(),[T,P]=p.useState(!1),E=q(()=>{P(!0),M==null||M(!k),N.nextFrame(()=>{P(!1)})}),D=q(V=>{if(ia(V.currentTarget))return V.preventDefault();V.preventDefault(),E()}),z=q(V=>{V.key===le.Space?(V.preventDefault(),E()):V.key===le.Enter&&d0(V.currentTarget)}),R=q(V=>V.preventDefault()),O=gs(),A=aa(),{isFocusVisible:B,focusProps:C}=Dn({autoFocus:g}),{isHovered:F,hoverProps:U}=In({isDisabled:a}),{pressed:H,pressProps:L}=ms({disabled:a}),$=We({checked:k,disabled:a,hover:F,focus:B,active:H,autofocus:g,changing:T}),J=Yt({id:i,ref:v,role:"switch",type:Na(e,w),tabIndex:e.tabIndex===-1?0:(n=e.tabIndex)!=null?n:0,"aria-checked":k,"aria-labelledby":O,"aria-describedby":A,disabled:a||void 0,autoFocus:g,onClick:D,onKeyUp:z,onKeyPress:R},C,U,L),ne=p.useCallback(()=>{if(j!==void 0)return M==null?void 0:M(j)},[M,j]),Q=me();return p.createElement(p.Fragment,null,h!=null&&p.createElement(sc,{disabled:a,data:{[h]:m||"on"},overrides:{type:"checkbox",checked:k},form:f,onReset:ne}),Q({ourProps:J,theirProps:b,slot:$,defaultTag:Fy,name:"Switch"}))}let Wy=he(zy),By=Ay,Hy=da,Vy=vo,Uy=Object.assign(Wy,{Group:By,Label:Hy,Description:Vy});function mn({className:e,...t}){return l.jsx(oy,{...t,className:ae(e,"[&>[data-slot=label]+[data-slot=control]]:mt-3","[&>[data-slot=label]+[data-slot=description]]:mt-1","[&>[data-slot=description]+[data-slot=control]]:mt-3","[&>[data-slot=control]+[data-slot=description]]:mt-3","[&>[data-slot=control]+[data-slot=error]]:mt-3","*:data-[slot=label]:font-medium")})}function pn({className:e,...t}){return l.jsx(da,{"data-slot":"label",...t,className:ae(e,"relative text-base/10 font-bold text-neutral-950 select-none data-disabled:opacity-50 sm:text-sm/8 dark:text-white")})}function gn({className:e,...t}){return l.jsx(vo,{"data-slot":"description",...t,className:ae(e,"pb-2 text-base/6 text-neutral-500 data-disabled:opacity-50 sm:text-sm/6 dark:text-neutral-400")})}function Ry({checked:e,onChange:t,className:n="",iconOn:s=l.jsx("svg",{fill:"currentColor",viewBox:"0 0 12 12",className:"size-3 text-indigo-600",children:l.jsx("path",{d:"M3.707 5.293a1 1 0 00-1.414 1.414l1.414-1.414zM5 8l-.707.707a1 1 0 001.414 0L5 8zm4.707-3.293a1 1 0 00-1.414-1.414l1.414 1.414zm-7.414 2l2 2 1.414-1.414-2-2-1.414 1.414zm3.414 2l4-4-1.414-1.414-4 4 1.414 1.414z"})}),iconOff:r=l.jsx("svg",{fill:"none",viewBox:"0 0 12 12",className:"size-3 text-gray-400",children:l.jsx("path",{d:"M4 8l2-2m0 0l2-2M6 6L4 4m2 2l2 2",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}),...o}){return l.jsxs(Uy,{checked:e,onChange:t,className:ae("group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent bg-gray-200 transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2 data-[checked]:bg-indigo-600",n),...o,children:[l.jsx("span",{className:"sr-only",children:"Toggle setting"}),l.jsxs("span",{className:"pointer-events-none relative inline-block size-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out group-data-[checked]:translate-x-5",children:[l.jsx("span",{"aria-hidden":"true",className:"absolute inset-0 flex size-full items-center justify-center transition-opacity duration-200 ease-in group-data-[checked]:opacity-0 group-data-[checked]:duration-100 group-data-[checked]:ease-out",children:r}),l.jsx("span",{"aria-hidden":"true",className:"absolute inset-0 flex size-full items-center justify-center opacity-0 transition-opacity duration-100 ease-out group-data-[checked]:opacity-100 group-data-[checked]:duration-200 group-data-[checked]:ease-in",children:s})]})]})}function bn({label:e,help:t,iconClassName:n="size-4",buttonClassName:s="",buttonTop:r=5,...o}){const[i,a]=p.useState(!1),d=p.useMemo(()=>typeof r=="number"?`${r}px`:String(r),[r]);return t?l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button","aria-label":"Show help",onClick:()=>a(!0),style:{top:d},className:`absolute right-[-25px] inline-flex items-center justify-center rounded-full p-1 text-gray-400 hover:text-indigo-600 focus:outline-none focus:ring-2 focus:ring-indigo-500 ${s}`,tabIndex:0,children:l.jsx(Ld,{className:n})}),l.jsxs(Bo,{open:i,onClose:a,className:"relative z-999",children:[l.jsx(Zu,{transition:!0,className:"fixed inset-0 bg-gray-500/75 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),l.jsx("div",{className:"fixed inset-0 z-999 w-screen overflow-y-auto",children:l.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:l.jsxs(Ja,{transition:!0,className:"relative transform overflow-hidden rounded-lg bg-white px-4 pb-4 pt-5 text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in sm:my-8 sm:w-full sm:max-w-lg sm:p-6 data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"flex-shrink-0 flex items-center justify-center rounded-full bg-indigo-100 size-10",children:l.jsx(Ld,{className:"size-6 text-indigo-600"})}),l.jsxs("div",{children:[l.jsx(el,{as:"h3",className:"text-base font-semibold text-gray-900",children:e}),l.jsx("div",{className:"mt-2",children:l.jsx("div",{className:"text-sm text-gray-500",dangerouslySetInnerHTML:{__html:t}})})]})]}),l.jsx("div",{className:"mt-5 flex justify-end",children:l.jsx("button",{type:"button",onClick:()=>a(!1),className:"inline-flex justify-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500",children:"Close"})})]})})})]})]}):null}const rl=(e,t)=>!t||!t.includes(".")?e==null?void 0:e[t]:t.split(".").reduce((n,s)=>n==null?void 0:n[s],e);function be(e){const{values:t}=it(),n=p.useMemo(()=>Array.from(hr(e)),[e]),s=JSON.stringify(n.map(r=>rl(t,r)));return p.useMemo(()=>fr(e,t),[e,s])}function hr(e,t=new Set){return!e||typeof e=="function"?t:Array.isArray(e)?(e.forEach(n=>hr(n,t)),t):typeof e=="object"?e.all||e.any||e.not?(e.all&&e.all.forEach(n=>hr(n,t)),e.any&&e.any.forEach(n=>hr(n,t)),e.not&&hr(e.not,t),t):e.field?(t.add(e.field),t):(Object.keys(e).forEach(n=>t.add(n)),t):t}function fr(e,t){if(!e)return!0;if(typeof e=="function")return!!e(t);if(Array.isArray(e))return e.every(n=>fr(n,t));if(typeof e=="object"){if(e.all)return e.all.every(n=>fr(n,t));if(e.any)return e.any.some(n=>fr(n,t));if(e.not)return!fr(e.not,t);if(e.field){const n=rl(t,e.field);return"eq"in e?n===e.eq:"ne"in e?n!==e.ne:"gt"in e?n>e.gt:"gte"in e?n>=e.gte:"lt"in e?n<e.lt:"lte"in e?n<=e.lte:"in"in e?(e.in??[]).includes(n):e.truthy?!!n:e.falsy?!n:"contains"in e?Array.isArray(n)?n.includes(e.contains):typeof n=="string"?n.includes(String(e.contains)):!1:!!n}return Object.entries(e).every(([n,s])=>{const r=rl(t,n);return Array.isArray(s)?s.includes(r):s===!0?r===!0||r==="on"||r===1||r==="1":s===!1?r===!1||r===""||r===0||r==="0"||r===null||r===void 0:r===s})}return!!e}function Z({label:e,id:t,description:n,value:s,onChange:r,help:o,showIf:i,mountWhenHidden:a=!0}){const{values:d,setValue:c}=it(),u=be(i);if(!a&&i&&!u)return null;const h=s??(d==null?void 0:d[t])??!1,m=h===!0||h==="on"||h===1||h==="1",f=t||(e?e.replace(/\s+/g,"-").toLowerCase():"toggle");return l.jsxs(mn,{hidden:i&&!u,"aria-hidden":i&&!u,children:[l.jsx("div",{className:"flex items-center gap-2",children:e&&l.jsxs(pn,{children:[e,l.jsx(bn,{label:e,help:o})]})}),n&&l.jsx(gn,{children:n}),l.jsx("div",{className:"mt-2",children:l.jsx(Ry,{id:f,checked:m,disabled:i&&!u,onChange:g=>{const b=!!g;t&&c(t,b),r==null||r(b)},className:`
            bg-gray-200 data-[checked]:bg-indigo-600
            dark:bg-neutral-800 dark:data-[checked]:bg-indigo-500
            border-2 border-transparent
            focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2
            transition-colors
          `,iconOn:l.jsx("svg",{fill:"currentColor",viewBox:"0 0 12 12",className:"size-3 text-indigo-600 dark:text-indigo-300",children:l.jsx("path",{d:"M3.707 5.293a1 1 0 00-1.414 1.414l1.414-1.414zM5 8l-.707.707a1 1 0 001.414 0L5 8zm4.707-3.293a1 1 0 00-1.414-1.414l1.414 1.414zm-7.414 2l2 2 1.414-1.414-2-2-1.414 1.414zm3.414 2l4-4-1.414-1.414-4 4 1.414 1.414z"})}),iconOff:l.jsx("svg",{fill:"none",viewBox:"0 0 12 12",className:"size-3 text-gray-400 dark:text-neutral-400",children:l.jsx("path",{d:"M4 8l2-2m0 0l2-2M6 6L4 4m2 2l2 2",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})})})]})}function X({id:e,name:t,label:n,description:s,help:r,value:o,onChange:i,type:a="text",placeholder:d,prefix:c,suffix:u,optional:h,showIf:m,resetOnHide:f,mountWhenHidden:g=!0,className:b,step:x,min:w,max:_,...y}){const{values:v,setValue:j}=it(),k=be(m),M=p.useRef(k);let N=a,T=c,P=u;const E={step:x,min:w,max:_};a==="price"?(N="number",T=T??"$",P=P??"USD",E.step===void 0&&(E.step="any"),E.min===void 0&&(E.min="0")):a==="url"?(N="text",T=T??"https://"):a==="email"?N="email":a==="number"&&(N="number");const D=e?v==null?void 0:v[e]:void 0,z=o!==void 0,R=p.useMemo(()=>(z?o:D)??"",[z,o,D]);if(p.useEffect(()=>{M.current&&!k&&f!==void 0&&e&&j(e,f===!0?void 0:f),M.current=k},[k,f,e,j]),!g&&m&&!k)return null;const O=!k&&g,A=B=>{const C=N==="number"?B.target.value===""?"":Number(B.target.value):B.target.value;!z&&e&&j(e,C),i==null||i(C)};return l.jsxs(mn,{hidden:m&&!k,"aria-hidden":m&&!k,className:b,...y,children:[l.jsxs("div",{className:"flex justify-between items-center",children:[n&&l.jsxs(pn,{htmlFor:e,children:[n,l.jsx(bn,{label:n,help:r})]}),h&&l.jsx("span",{id:`${e}-optional`,className:"text-sm/6 text-gray-500 dark:text-neutral-400",children:"Optional"})]}),s&&l.jsx(gn,{children:s}),l.jsx("div",{className:"mt-2 max-w-lg",children:T||P?l.jsxs("div",{className:"flex items-center rounded-md bg-white px-3 outline outline-1 -outline-offset-1 outline-gray-300 focus-within:outline focus-within:outline-2 focus-within:-outline-offset-2 focus-within:outline-indigo-600 dark:bg-neutral-900 dark:outline-neutral-700",children:[T&&l.jsx("div",{className:"shrink-0 select-none text-base text-gray-500 dark:text-neutral-400 sm:text-sm/6",children:T}),l.jsx("input",{id:e,name:t||e,type:N,value:R,onChange:A,placeholder:d,"aria-describedby":h?`${e}-optional`:void 0,disabled:O,className:`block min-w-0 grow py-1.5 !pl-1 pr-3 text-base text-gray-900 placeholder:text-gray-400 focus:outline focus:outline-0 sm:text-sm/6 bg-transparent dark:text-white dark:placeholder:text-neutral-500 ${a==="url"?"!border-0 !outline-none !shadow-none !focus:ring-0 !focus:border-0 dark:!bg-neutral-900":""}`,...E}),P&&l.jsx("div",{id:a==="price"?`${e}-currency`:void 0,className:"shrink-0 select-none text-base text-gray-500 dark:text-neutral-400 sm:text-sm/6",children:P})]}):l.jsx("input",{id:e,name:t||e,type:N,value:R,onChange:A,placeholder:d,"aria-describedby":h?`${e}-optional`:void 0,disabled:O,className:"block w-full rounded-md bg-white px-3 py-1.5 text-base text-gray-900 outline outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 sm:text-sm/6 dark:bg-neutral-900 dark:text-white dark:placeholder:text-neutral-500 dark:outline-neutral-700",...E})})]})}function jt({id:e,name:t,label:n,description:s,help:r,value:o,onChange:i,rows:a=4,placeholder:d,optional:c,showIf:u,resetOnHide:h,mountWhenHidden:m=!0,className:f,...g}){const{values:b,setValue:x}=it(),w=be(u),_=p.useRef(w),y=e?b==null?void 0:b[e]:void 0,v=o!==void 0,j=p.useMemo(()=>(v?o:y)??"",[v,o,y]);if(p.useEffect(()=>{_.current&&!w&&h!==void 0&&e&&x(e,h===!0?void 0:h),_.current=w},[w,h,e,x]),!m&&u&&!w)return null;const k=!w&&m,M=N=>{const T=N.target.value;!v&&e&&x(e,T),i==null||i(T)};return l.jsxs(mn,{hidden:u&&!w,"aria-hidden":u&&!w,className:f,...g,children:[l.jsxs("div",{className:"flex justify-between items-center",children:[n&&l.jsxs(pn,{htmlFor:e,children:[n,l.jsx(bn,{label:n,help:r})]}),c&&l.jsx("span",{id:`${e}-optional`,className:"text-sm/6 text-gray-500 dark:text-neutral-400",children:"Optional"})]}),s&&l.jsx(gn,{children:s}),l.jsx("div",{className:"mt-2 max-w-lg",children:l.jsx("textarea",{id:e,name:t||e,rows:a,value:j,onChange:M,placeholder:d,"aria-describedby":c?`${e}-optional`:void 0,disabled:k,className:"block w-full rounded-md bg-white px-3 py-1.5 text-base text-gray-900 outline outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 sm:text-sm/6 dark:bg-neutral-900 dark:text-white dark:placeholder:text-neutral-500 dark:outline-neutral-700"})})]})}const $y=p.forwardRef(function({className:t,multiple:n,...s},r){return l.jsxs("span",{"data-slot":"control",className:ae([t,"group relative block w-full max-w-lg","before:absolute before:inset-px before:rounded-[calc(var(--radius-lg)-1px)] before:bg-white before:shadow-sm","dark:before:hidden","after:pointer-events-none after:absolute after:inset-0 after:rounded-lg after:ring-transparent after:ring-inset has-data-focus:after:ring-2 has-data-focus:after:ring-blue-500","has-data-disabled:opacity-50 has-data-disabled:before:bg-stone-950/5 has-data-disabled:before:shadow-none"]),children:[l.jsx(Oy,{ref:r,multiple:n,...s,className:ae(["relative block w-full max-w-lg appearance-none rounded-lg py-[calc(--spacing(2.5)-1px)] sm:py-[calc(--spacing(1.5)-1px)]",n?"px-[calc(--spacing(3.5)-1px)] sm:px-[calc(--spacing(3)-1px)]":"pr-[calc(--spacing(10)-1px)] pl-[calc(--spacing(3.5)-1px)] sm:pr-[calc(--spacing(9)-1px)] sm:pl-[calc(--spacing(3)-1px)]","[&_optgroup]:font-semibold","text-base/6 text-stone-950 placeholder:text-stone-500 sm:text-sm/6 dark:text-white dark:*:text-white","!hover:text-stone-950/80 !sm:hover:text-stone-950/90 !dark:hover:text-white/80 !dark:*:hover:text-white/90","border border-stone-950/10 data-hover:border-stone-950/20 dark:border-white/10 dark:data-hover:border-white/20","bg-transparent dark:bg-white/5 dark:*:bg-stone-800","focus:outline-hidden","data-invalid:border-red-500 data-invalid:data-hover:border-red-500 dark:data-invalid:border-red-600 dark:data-invalid:data-hover:border-red-600","data-disabled:border-stone-950/20 data-disabled:opacity-100 dark:data-disabled:border-white/15 dark:data-disabled:bg-white/2.5 dark:data-hover:data-disabled:border-white/15"])}),!n&&l.jsx("span",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2",children:l.jsxs("svg",{className:"size-5 stroke-stone-500 group-has-data-disabled:stroke-stone-600 sm:size-4 dark:stroke-stone-400 forced-colors:stroke-[CanvasText]",viewBox:"0 0 16 16","aria-hidden":"true",fill:"none",children:[l.jsx("path",{d:"M5.75 10.75L8 13L10.25 10.75",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M10.25 5.25L8 3L5.75 5.25",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})})]})});function ft({label:e,description:t,options:n,value:s,onChange:r,help:o,name:i,id:a,showIf:d,resetOnHide:c,mountWhenHidden:u=!0,className:h,...m}){const f=p.useId(),g=a||`${i||(e?e.replace(/\s+/g,"-").toLowerCase():"select")}-select-${f}`,b=be(d),x=p.useRef(b),{values:w,setValue:_}=it(),y=a?w==null?void 0:w[a]:void 0,v=s!==void 0,j=v?s:y??"";if(p.useEffect(()=>{x.current&&!b&&c!==void 0&&a&&_(a,c===!0?void 0:c),x.current=b},[b,c,a,_]),!u&&!b)return null;const k=M=>{const N=M.target.value;!v&&a&&_(a,N),r==null||r(N)};return l.jsxs(mn,{hidden:!b,"aria-hidden":!b,children:[l.jsx("div",{className:"flex items-center gap-2",children:e&&l.jsxs(pn,{htmlFor:g,children:[e,l.jsx(bn,{label:e,help:o})]})}),t&&l.jsx(gn,{children:t}),l.jsx($y,{id:g,name:i,value:j,onChange:k,disabled:!b&&u,className:h,...m,children:n==null?void 0:n.map(M=>l.jsx("option",{value:M.value??M.label,disabled:M.disabled,children:M.label},(M.value??M.label).toString()))})]})}const ah=p.forwardRef(function(t,n){return l.jsx(k_,{children:l.jsx("a",{...t,ref:n})})}),mr={base:["relative isolate inline-flex items-baseline justify-center gap-x-2 rounded-lg border text-base/6 font-semibold","px-4 py-2.5 sm:px-3.5 sm:py-2 sm:text-sm/6","focus:not-data-focus:outline-hidden data-focus:outline-2 data-focus:outline-offset-2 data-focus:outline-blue-500","data-disabled:opacity-50","*:data-[slot=icon]:-mx-0.5 *:data-[slot=icon]:my-0.5 *:data-[slot=icon]:size-5 *:data-[slot=icon]:shrink-0 *:data-[slot=icon]:self-center *:data-[slot=icon]:text-(--btn-icon) sm:*:data-[slot=icon]:my-1 sm:*:data-[slot=icon]:size-4 forced-colors:[--btn-icon:ButtonText] forced-colors:data-hover:[--btn-icon:ButtonText]"],solid:["border-transparent bg-(--btn-border)","dark:bg-(--btn-bg)","before:absolute before:inset-0 before:-z-10 before:rounded-[calc(var(--radius-lg)-1px)] before:bg-(--btn-bg)","before:shadow-sm","dark:before:hidden","dark:border-white/5","after:absolute after:inset-0 after:-z-10 after:rounded-[calc(var(--radius-lg)-1px)]","after:shadow-[inset_0_1px_--theme(--color-white/15%)]","data-active:after:bg-(--btn-hover-overlay) data-hover:after:bg-(--btn-hover-overlay)","dark:after:-inset-px dark:after:rounded-lg","data-disabled:before:shadow-none data-disabled:after:shadow-none"],outline:["border-neutral-950/10 text-neutral-950 data-active:bg-neutral-950/2.5 data-hover:bg-neutral-950/2.5","dark:border-white/15 dark:text-white dark:[--btn-bg:transparent] dark:data-active:bg-white/5 dark:data-hover:bg-white/5","[--btn-icon:var(--color-neutral-500)] data-active:[--btn-icon:var(--color-neutral-700)] data-hover:[--btn-icon:var(--color-neutral-700)] dark:data-active:[--btn-icon:var(--color-neutral-400)] dark:data-hover:[--btn-icon:var(--color-neutral-400)]"],plain:["border-transparent text-neutral-950 data-active:bg-neutral-950/5 data-hover:bg-neutral-950/5","dark:text-white dark:data-active:bg-white/10 dark:data-hover:bg-white/10","[--btn-icon:var(--color-neutral-500)] data-active:[--btn-icon:var(--color-neutral-700)] data-hover:[--btn-icon:var(--color-neutral-700)] dark:[--btn-icon:var(--color-neutral-500)] dark:data-active:[--btn-icon:var(--color-neutral-400)] dark:data-hover:[--btn-icon:var(--color-neutral-400)]"],colors:{"dark/zinc":["text-white [--btn-bg:var(--color-neutral-900)] [--btn-border:var(--color-neutral-950)]/90 [--btn-hover-overlay:var(--color-white)]/10","dark:text-white dark:[--btn-bg:var(--color-neutral-600)] dark:[--btn-hover-overlay:var(--color-white)]/5","[--btn-icon:var(--color-neutral-400)] data-active:[--btn-icon:var(--color-neutral-300)] data-hover:[--btn-icon:var(--color-neutral-300)]"],light:["text-neutral-950 [--btn-bg:white] [--btn-border:var(--color-neutral-950)]/10 [--btn-hover-overlay:var(--color-neutral-950)]/2.5 data-active:[--btn-border:var(--color-neutral-950)]/15 data-hover:[--btn-border:var(--color-neutral-950)]/15","dark:text-white dark:[--btn-hover-overlay:var(--color-white)]/5 dark:[--btn-bg:var(--color-neutral-800)]","[--btn-icon:var(--color-neutral-500)] data-active:[--btn-icon:var(--color-neutral-700)] data-hover:[--btn-icon:var(--color-neutral-700)] dark:[--btn-icon:var(--color-neutral-500)] dark:data-active:[--btn-icon:var(--color-neutral-400)] dark:data-hover:[--btn-icon:var(--color-neutral-400)]"],"dark/white":["text-white [--btn-bg:var(--color-neutral-900)] [--btn-border:var(--color-neutral-950)]/90 [--btn-hover-overlay:var(--color-white)]/10","dark:text-neutral-950 dark:[--btn-bg:white] dark:[--btn-hover-overlay:var(--color-neutral-950)]/5","[--btn-icon:var(--color-neutral-400)] data-active:[--btn-icon:var(--color-neutral-300)] data-hover:[--btn-icon:var(--color-neutral-300)] dark:[--btn-icon:var(--color-neutral-500)] dark:data-active:[--btn-icon:var(--color-neutral-400)] dark:data-hover:[--btn-icon:var(--color-neutral-400)]"],dark:["text-white [--btn-bg:var(--color-neutral-900)] [--btn-border:var(--color-neutral-950)]/90 [--btn-hover-overlay:var(--color-white)]/10","dark:[--btn-hover-overlay:var(--color-white)]/5 dark:[--btn-bg:var(--color-neutral-800)]","[--btn-icon:var(--color-neutral-400)] data-active:[--btn-icon:var(--color-neutral-300)] data-hover:[--btn-icon:var(--color-neutral-300)]"],white:["text-neutral-950 [--btn-bg:white] [--btn-border:var(--color-neutral-950)]/10 [--btn-hover-overlay:var(--color-neutral-950)]/2.5 data-active:[--btn-border:var(--color-neutral-950)]/15 data-hover:[--btn-border:var(--color-neutral-950)]/15","dark:[--btn-hover-overlay:var(--color-neutral-950)]/5","[--btn-icon:var(--color-neutral-400)] data-active:[--btn-icon:var(--color-neutral-500)] data-hover:[--btn-icon:var(--color-neutral-500)]"],zinc:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-neutral-600)] [--btn-border:var(--color-neutral-700)]/90","dark:[--btn-hover-overlay:var(--color-white)]/5","[--btn-icon:var(--color-neutral-400)] data-active:[--btn-icon:var(--color-neutral-300)] data-hover:[--btn-icon:var(--color-neutral-300)]"],indigo:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-indigo-500)] [--btn-border:var(--color-indigo-600)]/90","[--btn-icon:var(--color-indigo-300)] data-active:[--btn-icon:var(--color-indigo-200)] data-hover:[--btn-icon:var(--color-indigo-200)]"],cyan:["text-cyan-950 [--btn-bg:var(--color-cyan-300)] [--btn-border:var(--color-cyan-400)]/80 [--btn-hover-overlay:var(--color-white)]/25","[--btn-icon:var(--color-cyan-500)]"],red:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-red-600)] [--btn-border:var(--color-red-700)]/90","[--btn-icon:var(--color-red-300)] data-active:[--btn-icon:var(--color-red-200)] data-hover:[--btn-icon:var(--color-red-200)]"],orange:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-orange-500)] [--btn-border:var(--color-orange-600)]/90","[--btn-icon:var(--color-orange-300)] data-active:[--btn-icon:var(--color-orange-200)] data-hover:[--btn-icon:var(--color-orange-200)]"],amber:["text-amber-950 [--btn-hover-overlay:var(--color-white)]/25 [--btn-bg:var(--color-amber-400)] [--btn-border:var(--color-amber-500)]/80","[--btn-icon:var(--color-amber-600)]"],yellow:["text-yellow-950 [--btn-hover-overlay:var(--color-white)]/25 [--btn-bg:var(--color-yellow-300)] [--btn-border:var(--color-yellow-400)]/80","[--btn-icon:var(--color-yellow-600)] data-active:[--btn-icon:var(--color-yellow-700)] data-hover:[--btn-icon:var(--color-yellow-700)]"],lime:["text-lime-950 [--btn-hover-overlay:var(--color-white)]/25 [--btn-bg:var(--color-lime-300)] [--btn-border:var(--color-lime-400)]/80","[--btn-icon:var(--color-lime-600)] data-active:[--btn-icon:var(--color-lime-700)] data-hover:[--btn-icon:var(--color-lime-700)]"],green:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-green-600)] [--btn-border:var(--color-green-700)]/90","[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80"],emerald:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-emerald-600)] [--btn-border:var(--color-emerald-700)]/90","[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80"],teal:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-teal-600)] [--btn-border:var(--color-teal-700)]/90","[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80"],sky:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-sky-500)] [--btn-border:var(--color-sky-600)]/80","[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80"],blue:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-blue-600)] [--btn-border:var(--color-blue-700)]/90","[--btn-icon:var(--color-blue-400)] data-active:[--btn-icon:var(--color-blue-300)] data-hover:[--btn-icon:var(--color-blue-300)]"],violet:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-violet-500)] [--btn-border:var(--color-violet-600)]/90","[--btn-icon:var(--color-violet-300)] data-active:[--btn-icon:var(--color-violet-200)] data-hover:[--btn-icon:var(--color-violet-200)]"],purple:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-purple-500)] [--btn-border:var(--color-purple-600)]/90","[--btn-icon:var(--color-purple-300)] data-active:[--btn-icon:var(--color-purple-200)] data-hover:[--btn-icon:var(--color-purple-200)]"],fuchsia:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-fuchsia-500)] [--btn-border:var(--color-fuchsia-600)]/90","[--btn-icon:var(--color-fuchsia-300)] data-active:[--btn-icon:var(--color-fuchsia-200)] data-hover:[--btn-icon:var(--color-fuchsia-200)]"],pink:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-pink-500)] [--btn-border:var(--color-pink-600)]/90","[--btn-icon:var(--color-pink-300)] data-active:[--btn-icon:var(--color-pink-200)] data-hover:[--btn-icon:var(--color-pink-200)]"],rose:["text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-rose-500)] [--btn-border:var(--color-rose-600)]/90","[--btn-icon:var(--color-rose-300)] data-active:[--btn-icon:var(--color-rose-200)] data-hover:[--btn-icon:var(--color-rose-200)]"]}},ol=p.forwardRef(function({color:t,outline:n,plain:s,className:r,children:o,...i},a){let d=ae(r,mr.base,n?mr.outline:s?mr.plain:ae(mr.solid,mr.colors[t??"dark/zinc"]));return"href"in i?l.jsx(ah,{...i,className:d,ref:a,children:l.jsx(lh,{children:o})}):l.jsx(l0,{...i,className:ae(d,"cursor-default"),ref:a,children:l.jsx(lh,{children:o})})});function lh({children:e}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"absolute top-1/2 left-1/2 size-[max(100%,2.75rem)] -translate-x-1/2 -translate-y-1/2 pointer-fine:hidden","aria-hidden":"true"}),e]})}function il({className:e,...t}){return l.jsx("p",{"data-slot":"text",...t,className:ae(e,"text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400")})}const qy={xs:"sm:max-w-xs",sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-xl","2xl":"sm:max-w-2xl","3xl":"sm:max-w-3xl","4xl":"sm:max-w-4xl","5xl":"sm:max-w-5xl"};function dh({size:e="lg",className:t,children:n,...s}){return l.jsxs(Bo,{...s,children:[l.jsx(Zu,{transition:!0,className:"fixed inset-0 flex w-screen justify-center overflow-y-auto bg-neutral-950/25 px-2 py-2 transition duration-100 focus:outline-0 data-closed:opacity-0 data-enter:ease-out data-leave:ease-in sm:px-6 sm:py-8 lg:px-8 lg:py-16 dark:bg-neutral-950/50"}),l.jsx("div",{className:"fixed inset-0 w-screen overflow-y-auto pt-6 sm:pt-0",children:l.jsx("div",{className:"grid min-h-full grid-rows-[1fr_auto] justify-items-center sm:grid-rows-[1fr_auto_3fr] sm:p-4",children:l.jsx(Ja,{transition:!0,className:ae(t,qy[e],"row-start-2 w-full min-w-0 rounded-t-3xl bg-white p-4 shadow-lg ring-1 ring-neutral-950/10 sm:mb-auto sm:rounded-2xl sm:p-6 dark:bg-neutral-900 dark:ring-white/10 forced-colors:outline","transition duration-100 will-change-transform data-closed:translate-y-12 data-closed:opacity-0 data-enter:ease-out data-leave:ease-in sm:data-closed:translate-y-0 sm:data-closed:data-enter:scale-95"),children:n})})})]})}function ch({className:e,...t}){return l.jsx(el,{...t,className:ae(e,"text-lg/6 font-semibold text-balance text-neutral-950 sm:text-base/6 dark:text-white")})}function uh({className:e,...t}){return l.jsx(vo,{as:il,...t,className:ae(e,"mt-2 text-pretty")})}function Yy({className:e,...t}){return l.jsx("div",{...t,className:ae(e,"mt-6")})}function Ky({className:e,...t}){return l.jsx("div",{...t,className:ae(e,"mt-8 flex flex-col-reverse items-center justify-end gap-3 *:w-full sm:flex-row sm:*:w-auto")})}function W({title:e,description:t,upgradeUrl:n}){const[s,r]=p.useState(!1),o=(n??"").trim(),i=(e==null?void 0:e.trim())||"Pro feature",a=(t==null?void 0:t.trim())||"This setting is available in the Pro edition.";return l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",onClick:()=>r(!0),"aria-haspopup":"dialog","aria-expanded":s,"aria-label":`${i} — Pro feature, open details`,className:"inline-flex shrink-0 items-center rounded-md bg-indigo-600 px-2 py-1 text-[10px] font-bold uppercase tracking-wider text-white shadow-sm outline-none hover:bg-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2 dark:bg-indigo-500 dark:hover:bg-indigo-400 dark:focus-visible:ring-offset-neutral-900",children:"PRO"}),l.jsxs(dh,{open:s,onClose:()=>r(!1),size:"md",children:[l.jsx(ch,{children:i}),l.jsx(uh,{children:a}),l.jsxs(Ky,{children:[l.jsx(ol,{type:"button",plain:!0,onClick:()=>r(!1),children:"Close"}),o?l.jsx(ol,{href:o,target:"_blank",rel:"noopener noreferrer",color:"indigo",className:"!no-underline !bg-blue-600 !text-white hover:!bg-blue-700 dark:!bg-blue-600 dark:hover:!bg-blue-500",children:"Upgrade"}):null]})]})]})}function Gy(...e){return e.filter(Boolean).join(" ")}function hh({tabs:e,onTabChange:t,value:n,setValue:s}){const r=p.useMemo(()=>n?e.find(a=>a.value===n||a.name===n)||e[0]:e.find(a=>a.current)||e[0],[e,n]);function o(a){const d=a.target.value,c=e.find(u=>u.name===d||u.value===d);s&&s((c==null?void 0:c.value)||(c==null?void 0:c.name)),t?t(d,c):c&&c.href&&(window.location.href=c.href)}function i(a){s&&s(a.value||a.name),t?t(a.name,a):a.href&&(window.location.href=a.href)}return l.jsxs("div",{children:[l.jsxs("div",{className:"grid grid-cols-1 sm:hidden",children:[l.jsx("select",{value:r.value||r.name,"aria-label":"Select a tab",className:"col-start-1 row-start-1 w-full appearance-none rounded-md bg-white py-2 pl-3 pr-8 text-base text-gray-900 outline outline-1 -outline-offset-1 outline-gray-300 focus:outline focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600",onChange:o,children:e.map(a=>l.jsx("option",{value:a.value||a.name,children:a.name},a.value||a.name))}),l.jsx(Od,{"aria-hidden":"true",className:"pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end fill-gray-500"})]}),l.jsx("div",{className:"hidden sm:block",children:l.jsx("nav",{"aria-label":"Tabs",className:"flex space-x-8 border-b border-neutral-200 dark:border-neutral-700",children:e.map(a=>{const d=n?(a.value||a.name)===(r.value||r.name):a.current,c=a.icon;return l.jsxs("button",{type:"button","aria-current":d?"page":void 0,className:Gy(d?"border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400":"border-transparent text-neutral-500 hover:border-neutral-300 hover:text-neutral-700 dark:text-neutral-400 dark:hover:border-neutral-600 dark:hover:text-neutral-200","-mb-px border-b-2 px-1 py-4 text-sm font-medium transition-colors inline-flex items-center gap-2"),onClick:()=>i(a),children:[c&&l.jsx(c,{className:"size-4 shrink-0","aria-hidden":"true"}),a.name]},a.value||a.name)})})})]})}const xn=new Map;function Xy(e){const t=xn.get(e);t&&t.sort((n,s)=>n.priority-s.priority)}function fh(e,t,n,s=10){typeof n!="function"||!e||(xn.has(e)||xn.set(e,[]),xn.get(e).push({namespace:String(t),callback:n,priority:Number(s)||10}),Xy(e))}function mh(e,t){const n=xn.get(e);if(!(n!=null&&n.length))return;const s=String(t),r=n.filter(o=>o.namespace!==s);r.length?xn.set(e,r):xn.delete(e)}function S(e,t,...n){const s=xn.get(e);return s!=null&&s.length?s.reduce((r,{callback:o})=>{try{return o(r,...n)}catch(i){return console.error(`[wpeSettingsFilters] "${e}":`,i),r}},t):t}function Qy(){if(typeof window>"u")return;if(!window.wpeSettingsFilters){window.wpeSettingsFilters={addFilter:fh,removeFilter:mh,applyFilters:S};return}const e=window.wpeSettingsFilters;typeof e.addFilter!="function"&&(e.addFilter=fh),typeof e.removeFilter!="function"&&(e.removeFilter=mh),typeof e.applyFilters!="function"&&(e.applyFilters=S)}Qy();function gt({settingId:e,children:t,className:n=""}){const s=o=>{o.preventDefault();const i=document.getElementById(e);if(i){const a=i.closest("[data-tab]");if(a&&a.classList.contains("hidden")){const d=a.getAttribute("data-tab");document.querySelectorAll('button[type="button"][aria-current]');const c=document.querySelectorAll('nav[aria-label="Tabs"] button');for(const u of c)if(u.textContent.toLowerCase()===d.toLowerCase()){u.click();break}setTimeout(()=>{r(i)},50)}else r(i)}else{const a=document.querySelector(`section#${e}`);a&&a.scrollIntoView({behavior:"smooth",block:"start"})}},r=o=>{let i=o,a=o.parentElement;for(;a&&!(a.tagName==="SECTION"||a.hasAttribute("data-tab"));)a.children.length>=2&&(i=a),a=a.parentElement;i.scrollIntoView({behavior:"smooth",block:"center"}),i.classList.add("ring-2","ring-blue-500","ring-offset-4","rounded-lg"),i.style.transition="box-shadow 0.3s ease-in-out",setTimeout(()=>{i.classList.remove("ring-2","ring-blue-500","ring-offset-4","rounded-lg")},2500)};return l.jsx("button",{type:"button",onClick:s,className:`text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-200 underline underline-offset-2 cursor-pointer ${n}`,children:t})}const Ee="free-downloads-woocommerce",ph={somdn_pro_disable_ecommerce:!1,somdn_shop_download_logged_in_text:"",somdn_shop_download_logged_out_text:"",somdn_shop_disabled_logged_in_text:"",somdn_shop_disabled_logged_out_text:"",somdn_require_login:!1,somdn_require_login_message:"",somdn_require_login_grouped_message:"",somdn_download_in_new_window:!1,somdn_include_archive_items:!1,somdn_hide_readmore_button_archive:!1,somdn_include_sale_items:!1,somdn_indy_items:!1,somdn_indy_exclude_items:!1,somdn_disable_security_key_check:!1,somdn_enable_download_sorting:!1,somdn_download_counts_output:0,somdn_download_counts_output_text:"",somdn_button_class:"",somdn_button_css:"",somdn_link_class:"",somdn_link_css:""};function gh(){const[e,t]=p.useState("access"),n=be({somdn_require_login:!0}),s=[{name:"Access",value:"access"},{name:"Shop Pages",value:"shop"},{name:"Display",value:"display"},{name:"Styling",value:"styling"}];return l.jsxs("section",{className:"space-y-6",id:"general",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"General Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure how free downloads work across your site."}),l.jsx(hh,{tabs:s,value:e,setValue:t}),l.jsxs("div",{className:"mt-6",children:[l.jsxs("div",{className:e==="access"?"space-y-6":"hidden","data-tab":"access",children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_disable_ecommerce",l.jsx(W,{title:"Disable All eCommerce Functionality",description:"Disable all eCommerce functionality on your site. Useful for sites that only have free downloads available.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_disable_ecommerce",l.jsx(Z,{id:"somdn_pro_disable_ecommerce",label:"Disable All eCommerce Functionality",description:"Prevent any product, paid or otherwise, from being purchased. All cart/checkout functionality is removed. Free products still need to be free and set up correctly for free download to work.",disabled:!0}))]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-4"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Login Requirements"}),l.jsx(Z,{id:"somdn_require_login",label:"Only Show Button to Logged In Users",description:"Require users to be logged in to see the download button."}),l.jsx(jt,{id:"somdn_require_login_message",label:"Require Login Message",description:"Message to display on product pages if not logged in.",help:"<p><strong>Default:</strong> Only registered users can download this free product.</p>",placeholder:"Only registered users can download this free product.",rows:3,showIf:{somdn_require_login:!0}}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute -top-1 right-0 z-10",children:S("somdn_pro_badge_grouped_message",l.jsx(W,{title:"Grouped Product Login Message",description:"Customize the message shown on grouped product pages when users need to log in to download.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_grouped_message",l.jsx(jt,{id:"somdn_require_login_grouped_message",label:"Grouped Product Login Message",description:"Message to display on grouped product page if not logged in.",help:"<p><strong>Default:</strong> Only registered users can download the free product part of this group.</p>",placeholder:"Only registered users can download the free product part of this group.",rows:3,disabled:!0}))]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-4"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Download Behavior"}),l.jsx(Z,{id:"somdn_download_in_new_window",label:"Always Open Download Links in New Window",description:"Download links will open in a new browser tab/window."}),l.jsx(Z,{id:"somdn_include_archive_items",label:"Allow Download on Shop/Archive Pages",description:"Replace the View/Read More button with a download button on shop and archive pages."}),l.jsx(Z,{id:"somdn_hide_readmore_button_archive",label:"Hide View/Read More Button",description:"Hide the View/Read More button on shop pages if the user can't download the free product. For example, if site registration is required to purchase, but would be free otherwise.",showIf:{somdn_include_archive_items:!0}}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-4"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Product Selection"}),l.jsx(Z,{id:"somdn_include_sale_items",label:"Include Paid Items on Sale for Free",description:"Include paid items that are currently on sale for free. Not recommended if you use the 'redirect' download method."}),l.jsx(Z,{id:"somdn_indy_items",label:"Include Selected Products Only",description:"Only allow free downloads on products that have been individually selected. When enabled, a checkbox labeled 'Allow free download' will appear on each product's edit page. Check this box on the products you want to include for free downloads.",help:"<p><strong>How to select products:</strong></p><ol><li>Enable this setting by toggling it on</li><li>Go to <strong>Products</strong> → <strong>All Products</strong> in your WordPress admin</li><li>Edit each product you want to allow free downloads for</li><li>Look for the <strong>'Allow free download'</strong> checkbox in the product meta box</li><li>Check the box and save the product</li></ol><p><strong>Note:</strong> Only products with the checkbox checked will allow free downloads. All other products will not show the download button, even if they are free digital products.</p>"}),l.jsx(Z,{id:"somdn_indy_exclude_items",label:"Exclude Selected Products Only",description:"Prevent free downloads on products that have been individually selected. When enabled, a checkbox labeled 'Disallow free download' will appear on each product's edit page. Check this box on the products you want to exclude from free downloads.",help:"<p><strong>How to exclude products:</strong></p><ol><li>Enable this setting by toggling it on</li><li>Go to <strong>Products</strong> → <strong>All Products</strong> in your WordPress admin</li><li>Edit each product you want to prevent free downloads for</li><li>Look for the <strong>'Disallow free download'</strong> checkbox in the product meta box</li><li>Check the box and save the product</li></ol><p><strong>Note:</strong> Products with the checkbox checked will NOT allow free downloads, even if they are free digital products. All other products will work normally.</p>"}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-4"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Security"}),l.jsx(Z,{id:"somdn_disable_security_key_check",label:"Disable Checking Download Security Keys",description:"Not recommended. Disable checking security keys during downloads. This might help improve compatibility with cache plugins."})]}),l.jsxs("div",{className:e==="shop"?"space-y-6":"hidden","data-tab":"shop",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"When Downloads Are Enabled on Shop Pages"}),l.jsxs("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:["These settings apply when ",l.jsx(gt,{settingId:"somdn_include_archive_items",children:"Allow Download on Shop/Archive Pages"})," is enabled."]}),l.jsx(X,{id:"somdn_shop_download_logged_in_text",label:"Logged In Text",description:"Text to show on shop/archive pages if the user can download the file.",help:"<p><strong>Note:</strong> PDF Viewer text will still show for PDF files, if enabled.</p><p><strong>Default:</strong> Download</p>",placeholder:"Download"}),l.jsx(X,{id:"somdn_shop_download_logged_out_text",label:"Logged Out Text",description:"Text to show on shop/archive pages if the user is logged out but could download otherwise.",help:"<p><strong>Note:</strong> Only applies if the user only needs to log in to download.</p><p><strong>Default:</strong> View</p>",placeholder:"View"}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-4"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"When Downloads Are Disabled on Shop Pages"}),l.jsxs("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:["These settings apply when ",l.jsx(gt,{settingId:"somdn_include_archive_items",children:"Allow Download on Shop/Archive Pages"})," is disabled."]}),l.jsx(X,{id:"somdn_shop_disabled_logged_in_text",label:"Logged In Text",description:"Text to show on shop/archive pages if the user can download the file.",help:"<p><strong>Default:</strong> Download</p>",placeholder:"Download"}),l.jsx(X,{id:"somdn_shop_disabled_logged_out_text",label:"Logged Out Text",description:"Text to show on shop/archive pages if the user is logged out but could download otherwise.",help:"<p><strong>Default:</strong> View</p>",placeholder:"View"})]}),l.jsxs("div",{className:e==="display"?"space-y-6":"hidden","data-tab":"display",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Download Counts"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Show download statistics on product pages."}),l.jsx(ft,{id:"somdn_download_counts_output",label:"Display Position",description:"Choose where to display the download count on product pages.",options:[{label:"Don't show",value:0},{label:"Above download button",value:1},{label:"Below download button",value:2}]}),l.jsx(X,{id:"somdn_download_counts_output_text",label:"Download Count Text",description:"Customize the text. Use {count} to show the number.",help:"<p><strong>Default:</strong> (Downloads - {count})</p>",placeholder:"(Downloads - {count})",showIf:{somdn_download_counts_output:[1,2]}}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-4"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Product Sorting"}),l.jsx(Z,{id:"somdn_enable_download_sorting",label:"Enable Sorting by Free Download Count",description:l.jsxs(l.Fragment,{children:['Adds "Sort by free downloads" option to the product sorting dropdown on shop pages. Only applies to products with ',l.jsx(gt,{settingId:"tracking",children:"download tracking"})," enabled."]})})]}),l.jsxs("div",{className:e==="styling"?"space-y-6":"hidden","data-tab":"styling",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Button Styling"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Add custom CSS classes and inline styles to download buttons."}),l.jsx(X,{id:"somdn_button_class",label:"Button Custom Classes",description:"Add custom classes to the download button, separated by spaces."}),l.jsx(X,{id:"somdn_button_css",label:"Button CSS",description:"Add inline CSS styles to the download button.",help:"<p>For theme styling the button uses the following CSS classes:</p><p><code>somdn-download-button</code></p>"}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-4"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Link Styling"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Add custom CSS classes and inline styles to download links."}),l.jsx(X,{id:"somdn_link_class",label:"Link Custom Classes",description:"Add custom classes to the download link, separated by spaces."}),l.jsx(X,{id:"somdn_link_css",label:"Link CSS",description:"Add inline CSS styles to the download link.",help:"<p>For theme styling the links use the following CSS class:</p><p><code>somdn-download-link</code></p>"})]})]})]})}const bh=[{fieldId:"somdn_pro_disable_ecommerce",label:"Disable All eCommerce Functionality",help:"Prevent any product from being purchased. All cart/checkout functionality is removed.",sectionKey:"general",pluginSlug:Ee,keywords:["ecommerce","disable","cart","checkout","purchase","pro"]},{fieldId:"somdn_shop_download_logged_in_text",label:"Shop Button Text (Logged In)",help:"Text shown when the user can download the file on shop/archive pages.",sectionKey:"general",pluginSlug:Ee,keywords:["shop","button","text","logged in","archive","download"]},{fieldId:"somdn_shop_download_logged_out_text",label:"Shop Button Text (Logged Out)",help:"Text shown when the user is logged out on shop/archive pages.",sectionKey:"general",pluginSlug:Ee,keywords:["shop","button","text","logged out","archive","view"]},{fieldId:"somdn_shop_disabled_logged_in_text",label:"Disabled Shop Button Text (Logged In)",help:"Text shown when archive download is disabled and user is logged in.",sectionKey:"general",pluginSlug:Ee,keywords:["shop","button","text","disabled","logged in"]},{fieldId:"somdn_shop_disabled_logged_out_text",label:"Disabled Shop Button Text (Logged Out)",help:"Text shown when archive download is disabled and user is logged out.",sectionKey:"general",pluginSlug:Ee,keywords:["shop","button","text","disabled","logged out"]},{fieldId:"somdn_require_login",label:"Require Login",help:"Only show the download button to logged in users.",sectionKey:"general",pluginSlug:Ee,keywords:["require","login","logged in","user","authentication"]},{fieldId:"somdn_require_login_message",label:"Require Login Message",help:"Message to display on product pages if the user is not logged in.",sectionKey:"general",pluginSlug:Ee,keywords:["require","login","message","logged out"]},{fieldId:"somdn_require_login_grouped_message",label:"Grouped Product Login Message",help:"Message to display on grouped product page if not logged in.",sectionKey:"general",pluginSlug:Ee,keywords:["require","login","message","grouped","product","pro"]},{fieldId:"somdn_download_in_new_window",label:"Open in New Window",help:"Always open download links in a new window.",sectionKey:"general",pluginSlug:Ee,keywords:["new","window","tab","open","target","blank"]},{fieldId:"somdn_include_archive_items",label:"Allow Download on Shop/Archive Pages",help:"Allow downloads directly from shop/archive pages.",sectionKey:"general",pluginSlug:Ee,keywords:["archive","shop","download","pages","allow"]},{fieldId:"somdn_hide_readmore_button_archive",label:"Hide Read More Button",help:"Hide the View/Read More button if user cannot download.",sectionKey:"general",pluginSlug:Ee,keywords:["hide","read more","button","view","archive"]},{fieldId:"somdn_include_sale_items",label:"Include Sale Items",help:"Include paid items that are currently on sale for free.",sectionKey:"general",pluginSlug:Ee,keywords:["sale","items","free","include","paid"]},{fieldId:"somdn_indy_items",label:"Include Selected Products Only",help:"Only include products that have been individually selected.",sectionKey:"general",pluginSlug:Ee,keywords:["include","selected","products","individual"]},{fieldId:"somdn_indy_exclude_items",label:"Exclude Selected Products Only",help:"Exclude products that have been individually selected.",sectionKey:"general",pluginSlug:Ee,keywords:["exclude","selected","products","individual"]},{fieldId:"somdn_disable_security_key_check",label:"Disable Security Key Check",help:"Disable checking download security keys.",sectionKey:"general",pluginSlug:Ee,keywords:["security","key","check","disable","cache"]},{fieldId:"somdn_enable_download_sorting",label:"Enable Download Sorting",help:"Add sort by free downloads option to product sorting.",sectionKey:"general",pluginSlug:Ee,keywords:["sort","sorting","downloads","order","products"]},{fieldId:"somdn_download_counts_output",label:"Download Count Display Position",help:"Choose where to display the download count on product pages.",sectionKey:"general",pluginSlug:Ee,keywords:["download","count","display","position","above","below"]},{fieldId:"somdn_download_counts_output_text",label:"Download Count Text",help:"Customize the download count text.",sectionKey:"general",pluginSlug:Ee,keywords:["download","count","text","customize"]},{fieldId:"somdn_button_class",label:"Button Custom Classes",help:"Add custom CSS classes to the download button.",sectionKey:"general",pluginSlug:Ee,keywords:["button","class","css","style","custom"]},{fieldId:"somdn_button_css",label:"Button Inline CSS",help:"Add inline CSS styles to the download button.",sectionKey:"general",pluginSlug:Ee,keywords:["button","css","style","inline","custom"]},{fieldId:"somdn_link_class",label:"Link Custom Classes",help:"Add custom CSS classes to the download link.",sectionKey:"general",pluginSlug:Ee,keywords:["link","class","css","style","custom"]},{fieldId:"somdn_link_css",label:"Link Inline CSS",help:"Add inline CSS styles to the download link.",sectionKey:"general",pluginSlug:Ee,keywords:["link","css","style","inline","custom"]}],Zy=Object.freeze(Object.defineProperty({__proto__:null,GeneralSettings:gh,generalDefaults:ph,generalSettingsIndex:bh},Symbol.toStringTag,{value:"Module"}));function Xe({children:e,showIf:t,as:n="div"}){if(!be(t))return null;if(n==="fragment")return l.jsx(l.Fragment,{children:e});const r=n;return l.jsx(r,{children:e})}function Qe({showIf:e}){return be(e)?l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}):null}const Un="free-downloads-woocommerce",xh={somdn_single_type:1,somdn_single_button_text:"",somdn_single_again_button_text:"",somdn_single_button_filename:!1,somdn_single_force_zip:!1,somdn_single_zip_rename:!1,somdn_single_zip_rename_attributes:!1};function wh(){return l.jsxs("section",{className:"space-y-6",id:"single-files",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Single File Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Customize how products with a single file are handled."}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Display Options"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure how single file downloads appear on product pages."}),l.jsx(ft,{id:"somdn_single_type",label:"Download Type",description:"Choose how to display the download option on product pages.",options:[{label:"Button",value:1},{label:"Link",value:2}]}),l.jsx(X,{id:"somdn_single_button_text",label:"Button/Link Text",description:"Customize the text displayed on the download button or link.",help:"<p><strong>Default:</strong> Download Now</p>",placeholder:"Download Now"}),l.jsx(X,{id:"somdn_single_again_button_text",label:"Download Again Text",description:l.jsxs(l.Fragment,{children:["Text to show when a user has already downloaded the file (requires ",l.jsx(gt,{settingId:"tracking",children:"tracking"})," enabled)."]}),help:"<p>If you want the button to change text when someone has downloaded the product before, specify it here.</p><p><strong>Note:</strong> Make sure tracking is enabled for this to work.</p><p><strong>Default:</strong> Uses the normal button text if left blank.</p>",placeholder:""}),l.jsx(Z,{id:"somdn_single_button_filename",label:"Show Filename Instead of Text",description:"Display the filename instead of the button/link text on product pages. This will override the Button Text option above."}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"ZIP Options"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure ZIP file creation for single file downloads."}),l.jsx(Z,{id:"somdn_single_force_zip",label:"Force ZIP Creation",description:"Always create a ZIP file for downloads with single files, even when only one file is attached."}),l.jsx(Z,{id:"somdn_single_zip_rename",label:"Rename File in ZIP to Product Name",description:"The file inside the ZIP will be renamed to match the product name.",showIf:{somdn_single_force_zip:!0}}),l.jsx(Z,{id:"somdn_single_zip_rename_attributes",label:"Append Attributes to Renamed File",description:"When renaming the file in the ZIP, append the product attributes (e.g., variations) to the file name.",showIf:{somdn_single_force_zip:!0}})]})}const _h=[{fieldId:"somdn_single_type",label:"Download Type (Single File)",help:"Choose how to display single file downloads - button or link.",sectionKey:"single-files",pluginSlug:Un,keywords:["single","file","download","type","button","link"]},{fieldId:"somdn_single_button_text",label:"Single File Button Text",help:"Customize the text on the download button for single files.",sectionKey:"single-files",pluginSlug:Un,keywords:["single","file","button","text","download now"]},{fieldId:"somdn_single_again_button_text",label:"Download Again Text",help:"Text shown when user has already downloaded the file.",sectionKey:"single-files",pluginSlug:Un,keywords:["single","file","again","repeat","text","tracking"]},{fieldId:"somdn_single_button_filename",label:"Show Filename Instead",help:"Display the filename instead of button text.",sectionKey:"single-files",pluginSlug:Un,keywords:["single","file","filename","display","text"]},{fieldId:"somdn_single_force_zip",label:"Force ZIP Creation",help:"Always create a ZIP for single file downloads.",sectionKey:"single-files",pluginSlug:Un,keywords:["single","file","zip","force","create","archive"]},{fieldId:"somdn_single_zip_rename",label:"Rename File in ZIP",help:"Rename the file in ZIP to product name.",sectionKey:"single-files",pluginSlug:Un,keywords:["single","file","zip","rename","product","name"]},{fieldId:"somdn_single_zip_rename_attributes",label:"Append Attributes to ZIP Filename",help:"Append product attributes to the renamed file in ZIP.",sectionKey:"single-files",pluginSlug:Un,keywords:["single","file","zip","attributes","variations","append"]}],Jy=Object.freeze(Object.defineProperty({__proto__:null,SingleFilesSettings:wh,singleFilesDefaults:xh,singleFilesSettingsIndex:_h},Symbol.toStringTag,{value:"Module"})),Es="free-downloads-woocommerce",yh={somdn_display_type:"1",somdn_multi_button_text:"",somdn_available_downloads_text:"",somdn_checkbox_error_text:"",somdn_select_all:!1,somdn_show_numbers:!1};function vh(){return l.jsxs("section",{className:"space-y-6",id:"multiple-files",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Multiple Files Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Customise how products with multiple files are handled."}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:'Allowing the downloading of multiple files at once means those files will be zipped, which might be an issue for files hosted externally. If you use external files and have any errors, select "Links Only" for the display method. Otherwise, you can select any others.'}),l.jsx("div",{className:"rounded-md bg-amber-50 p-4 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800",children:l.jsxs("div",{className:"flex",children:[l.jsx("div",{className:"flex-shrink-0",children:l.jsx("svg",{className:"h-5 w-5 text-amber-400",viewBox:"0 0 20 20",fill:"currentColor",children:l.jsx("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})})}),l.jsxs("div",{className:"ml-3",children:[l.jsx("h3",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"ZipArchive Requirement"}),l.jsx("p",{className:"mt-1 text-sm text-amber-700 dark:text-amber-300",children:"Multiple file downloads require the PHP ZipArchive extension to be installed on your server. If zipping isn't working, please contact your host to ensure ZipArchive is enabled."})]})]})}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Display Options"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure how multiple file downloads appear on product pages."}),l.jsx(ft,{id:"somdn_display_type",label:"Display Type",description:"Choose how to display products with multiple downloadable files.",options:[{label:"Links Only (default)",value:"1"},{label:"Button Only (download all)",value:"2"},{label:"Button + Checkboxes",value:"3"},{label:"Button + Links",value:"4"},{label:"Button + Filenames",value:"5"}]}),l.jsx(X,{id:"somdn_multi_button_text",label:"Download Button Text",description:"Customize the text on the download all button.",help:"<p><strong>Default:</strong> Download All (.zip)</p>",placeholder:"Download All (.zip)",showIf:{somdn_display_type:["2","3","4","5"]}}),l.jsx(X,{id:"somdn_available_downloads_text",label:"Available Downloads Heading",description:"The heading text shown above the list of available downloads.",help:"<p><strong>Default:</strong> <em>Available Downloads:</em></p>",placeholder:"Available Downloads:",showIf:{somdn_display_type:["1","3","4","5"]}}),l.jsx(Qe,{showIf:{somdn_display_type:"3"}}),l.jsxs(Xe,{showIf:{somdn_display_type:"3"},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Checkbox Options"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:'These options only apply when using the "Button + Checkboxes" display type.'})]}),l.jsx(X,{id:"somdn_checkbox_error_text",label:"Checkbox Error Text",description:"Error message shown when the user tries to download without selecting any files.",help:"<p><strong>Default:</strong> Please select at least 1 checkbox</p>",placeholder:"Please select at least 1 checkbox",showIf:{somdn_display_type:"3"}}),l.jsx(Z,{id:"somdn_select_all",label:"Show Select All Checkbox",description:"Display a 'Select All' checkbox that allows users to quickly select all files at once.",showIf:{somdn_display_type:"3"}}),l.jsx(Qe,{showIf:{somdn_display_type:["1","4","5"]}}),l.jsx(Xe,{showIf:{somdn_display_type:["1","4","5"]},as:"fragment",children:l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Additional Options"})}),l.jsx(Z,{id:"somdn_show_numbers",label:"Show Number Next to Filename",description:"Display a number prefix (1, 2, 3...) next to each filename in the download list.",help:"<p>Only used when links or filenames are shown.</p>",showIf:{somdn_display_type:["1","4","5"]}})]})}const kh=[{fieldId:"somdn_display_type",label:"Multiple Files Display Type",help:"Choose how to display products with multiple downloadable files.",sectionKey:"multiple-files",pluginSlug:Es,keywords:["multiple","files","display","type","links","button","checkboxes"]},{fieldId:"somdn_multi_button_text",label:"Download Button Text",help:"Customize the text on the download all button.",sectionKey:"multiple-files",pluginSlug:Es,keywords:["multiple","files","button","text","download all","zip"]},{fieldId:"somdn_available_downloads_text",label:"Available Downloads Heading",help:"The heading text shown above the list of available downloads.",sectionKey:"multiple-files",pluginSlug:Es,keywords:["multiple","files","heading","available","downloads","text"]},{fieldId:"somdn_checkbox_error_text",label:"Checkbox Error Text",help:"Error message shown when no files are selected.",sectionKey:"multiple-files",pluginSlug:Es,keywords:["multiple","files","checkbox","error","validation","message"]},{fieldId:"somdn_select_all",label:"Show Select All Checkbox",help:"Display a Select All checkbox for quick selection.",sectionKey:"multiple-files",pluginSlug:Es,keywords:["multiple","files","select","all","checkbox"]},{fieldId:"somdn_show_numbers",label:"Show Number Next to Filename",help:"Display number prefix next to each filename.",sectionKey:"multiple-files",pluginSlug:Es,keywords:["multiple","files","number","filename","prefix","list"]}],ev=Object.freeze(Object.defineProperty({__proto__:null,MultipleFilesSettings:vh,multipleFilesDefaults:yh,multipleFilesSettingsIndex:kh},Symbol.toStringTag,{value:"Module"})),Vo="free-downloads-woocommerce",jh={somdn_owned_enable:!1,somdn_owned_button_text:"",somdn_owned_badge_text:"",somdn_owned_badge_hide:!1};function Sh(){return l.jsxs("section",{className:"space-y-6",id:"owned-products",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Owned Products"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Allow users to re-download products they have already purchased directly from the product page."}),l.jsx(Z,{id:"somdn_owned_enable",label:"Enable Free Downloads for Owned Products",description:"Show a download button on product pages for paid products already owned by the user.",help:"<p><strong>Note:</strong> Products will be set to a 100% discount.</p><p><strong>Note:</strong> This function takes into account the user's ability to download the file from their account page.</p>"}),l.jsx(Qe,{showIf:{somdn_owned_enable:!0}}),l.jsxs(Xe,{showIf:{somdn_owned_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Button & Badge Customization"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Customize the download button text and product badge for owned items."})]}),l.jsx(X,{id:"somdn_owned_button_text",label:"Download Button Text",description:"Customise the download button text for owned items. Also applies to multiple files and PDFs.",help:"<p><strong>Default:</strong> Download Again</p>",placeholder:"Download Again",showIf:{somdn_owned_enable:!0}}),l.jsx(X,{id:"somdn_owned_badge_text",label:"Owned Badge Text",description:"Customise the text in the product badge that appears on owned products.",help:"<p><strong>Default:</strong> OWNED!</p>",placeholder:"OWNED!",showIf:{somdn_owned_enable:!0}}),l.jsx(Z,{id:"somdn_owned_badge_hide",label:"Hide the Badge",description:"Hide the owned badge from product pages.",showIf:{somdn_owned_enable:!0}})]})}const Nh=[{fieldId:"somdn_owned_enable",label:"Enable Free Downloads for Owned Products",help:"Enable free downloads on product pages for paid products already owned by the user.",sectionKey:"owned-products",pluginSlug:Vo,keywords:["owned","purchased","products","enable","download","again","bought"]},{fieldId:"somdn_owned_button_text",label:"Owned Products Download Button Text",help:"Customise the download button text for owned items.",sectionKey:"owned-products",pluginSlug:Vo,keywords:["owned","button","text","download","again","customize"]},{fieldId:"somdn_owned_badge_text",label:"Owned Badge Text",help:"Customise the text in the product badge for owned products.",sectionKey:"owned-products",pluginSlug:Vo,keywords:["owned","badge","text","customize","label"]},{fieldId:"somdn_owned_badge_hide",label:"Hide Owned Badge",help:"Hide the owned badge from product pages.",sectionKey:"owned-products",pluginSlug:Vo,keywords:["owned","badge","hide","remove","invisible"]}],tv=Object.freeze(Object.defineProperty({__proto__:null,OwnedProductsSettings:Sh,ownedProductsDefaults:jh,ownedProductsSettingsIndex:Nh},Symbol.toStringTag,{value:"Module"})),al="free-downloads-woocommerce",Ch={somdn_docviewer_enable:!1,somdn_docviewer_single_display:"1",somdn_docviewer_single_link_text:""};function Mh(){return l.jsxs("section",{className:"space-y-6",id:"pdf-settings",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"PDF Viewer"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Open a preview of PDF files attached to products instead of downloading directly. Users can print or download from the viewer."}),l.jsx(Z,{id:"somdn_docviewer_enable",label:"Enable PDF Viewer",description:"Enable the PDF Viewer feature for PDF file downloads."}),l.jsx(Qe,{showIf:{somdn_docviewer_enable:!0}}),l.jsxs(Xe,{showIf:{somdn_docviewer_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Display Options"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure how the PDF viewer link is displayed on product pages."})]}),l.jsx(ft,{id:"somdn_docviewer_single_display",label:"Display Type",description:"Choose how the PDF viewer link is displayed on single product pages.",options:[{label:"Button",value:"1"},{label:"Link",value:"2"}],showIf:{somdn_docviewer_enable:!0}}),l.jsx(X,{id:"somdn_docviewer_single_link_text",label:"Link/Button Text",description:"Customize the text for the PDF viewer link or button.",help:"<p><strong>Default:</strong> Download PDF</p>",placeholder:"Download PDF",showIf:{somdn_docviewer_enable:!0}})]})}const Eh=[{fieldId:"somdn_docviewer_enable",label:"Enable PDF Viewer",help:"Enable the PDF Viewer feature for PDF file downloads.",sectionKey:"pdf-settings",pluginSlug:al,keywords:["pdf","viewer","enable","document","preview","docviewer"]},{fieldId:"somdn_docviewer_single_display",label:"PDF Viewer Display Type",help:"Choose how the PDF viewer link is displayed (Button or Link).",sectionKey:"pdf-settings",pluginSlug:al,keywords:["pdf","display","button","link","type","style"]},{fieldId:"somdn_docviewer_single_link_text",label:"PDF Viewer Link Text",help:"Customize the text for the PDF viewer link or button.",sectionKey:"pdf-settings",pluginSlug:al,keywords:["pdf","text","link","button","customize","download"]}],nv=Object.freeze(Object.defineProperty({__proto__:null,PdfSettings:Mh,pdfDefaults:Ch,pdfSettingsIndex:Eh},Symbol.toStringTag,{value:"Module"}));function Uo(){return(Uo=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}function Ph(e,t){if(e==null)return{};var n,s,r={},o=Object.keys(e);for(s=0;s<o.length;s++)t.indexOf(n=o[s])>=0||(r[n]=e[n]);return r}function pr(e){var t=p.useRef(e),n=p.useRef(function(s){t.current&&t.current(s)});return t.current=e,n.current}var Ps=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},gr=function(e){return"touches"in e},ll=function(e){return e&&e.ownerDocument.defaultView||self},Th=function(e,t,n){var s=e.getBoundingClientRect(),r=gr(t)?function(o,i){for(var a=0;a<o.length;a++)if(o[a].identifier===i)return o[a];return o[0]}(t.touches,n):t;return{left:Ps((r.pageX-(s.left+ll(e).pageXOffset))/s.width),top:Ps((r.pageY-(s.top+ll(e).pageYOffset))/s.height)}},Dh=function(e){!gr(e)&&e.preventDefault()},dl=p.memo(function(e){var t=e.onMove,n=e.onKey,s=e.onEnd,r=Ph(e,["onMove","onKey","onEnd"]),o=p.useRef(null),i=pr(t),a=pr(n),d=pr(s),c=p.useRef(null),u=p.useRef(!1),h=p.useMemo(function(){var x=function(y){Dh(y),(gr(y)?y.touches.length>0:y.buttons>0)&&o.current?i(Th(o.current,y,c.current)):(_(!1),d())},w=function(){_(!1),d()};function _(y){var v=u.current,j=ll(o.current),k=y?j.addEventListener:j.removeEventListener;k(v?"touchmove":"mousemove",x),k(v?"touchend":"mouseup",w)}return[function(y){var v=y.nativeEvent,j=o.current;if(j&&(Dh(v),!function(M,N){return N&&!gr(M)}(v,u.current)&&j)){if(gr(v)){u.current=!0;var k=v.changedTouches||[];k.length&&(c.current=k[0].identifier)}j.focus(),i(Th(j,v,c.current)),_(!0)}},function(y){var v=y.which||y.keyCode;v<37||v>40||(y.preventDefault(),a({left:v===39?.05:v===37?-.05:0,top:v===40?.05:v===38?-.05:0}))},function(y){var v=y.which||y.keyCode;v>=37&&v<=40&&d()},_]},[a,i,d]),m=h[0],f=h[1],g=h[2],b=h[3];return p.useEffect(function(){return b},[b]),p.createElement("div",Uo({},r,{onTouchStart:m,onMouseDown:m,className:"react-colorful__interactive",ref:o,onKeyDown:f,onKeyUp:g,tabIndex:0,role:"slider"}))}),Ro=function(e){return e.filter(Boolean).join(" ")},cl=function(e){var t=e.color,n=e.left,s=e.top,r=s===void 0?.5:s,o=Ro(["react-colorful__pointer",e.className]);return p.createElement("div",{className:o,style:{top:100*r+"%",left:100*n+"%"}},p.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},ot=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},Ih=function(e){var t=e.s,n=e.v,s=e.a,r=(200-t)*n/100;return{h:ot(e.h),s:ot(r>0&&r<200?t*n/100/(r<=100?r:200-r)*100:0),l:ot(r/2),a:ot(s,2)}},ul=function(e){var t=Ih(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},hl=function(e){var t=Ih(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},sv=function(e){var t=e.h,n=e.s,s=e.v,r=e.a;t=t/360*6,n/=100,s/=100;var o=Math.floor(t),i=s*(1-n),a=s*(1-(t-o)*n),d=s*(1-(1-t+o)*n),c=o%6;return{r:ot(255*[s,a,i,i,d,s][c]),g:ot(255*[d,s,s,a,i,i][c]),b:ot(255*[i,i,d,s,s,a][c]),a:ot(r,2)}},rv=function(e){var t=e.r,n=e.g,s=e.b,r=e.a,o=Math.max(t,n,s),i=o-Math.min(t,n,s),a=i?o===t?(n-s)/i:o===n?2+(s-t)/i:4+(t-n)/i:0;return{h:ot(60*(a<0?a+6:a)),s:ot(o?i/o*100:0),v:ot(o/255*100),a:r}},ov=p.memo(function(e){var t=e.hue,n=e.onChange,s=e.onChangeEnd,r=Ro(["react-colorful__hue",e.className]);return p.createElement("div",{className:r},p.createElement(dl,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Ps(t+360*o.left,0,360)})},onEnd:s,"aria-label":"Hue","aria-valuenow":ot(t),"aria-valuemax":"360","aria-valuemin":"0"},p.createElement(cl,{className:"react-colorful__hue-pointer",left:t/360,color:ul({h:t,s:100,v:100,a:1})})))}),iv=p.memo(function(e){var t=e.hsva,n=e.onChange,s=e.onChangeEnd,r={backgroundColor:ul({h:t.h,s:100,v:100,a:1})};return p.createElement("div",{className:"react-colorful__saturation",style:r},p.createElement(dl,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Ps(t.s+100*o.left,0,100),v:Ps(t.v-100*o.top,0,100)})},onEnd:s,"aria-label":"Color","aria-valuetext":"Saturation "+ot(t.s)+"%, Brightness "+ot(t.v)+"%"},p.createElement(cl,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:ul(t)})))}),Oh=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function av(e,t,n,s){var r=pr(n),o=pr(s),i=p.useState(function(){return e.toHsva(t)}),a=i[0],d=i[1],c=p.useRef({color:t,hsva:a}),u=p.useRef(!1);p.useEffect(function(){if(!e.equal(t,c.current.color)){var f=e.toHsva(t);c.current={hsva:f,color:t},d(f),u.current=!1}},[t,e]),p.useEffect(function(){var f;Oh(a,c.current.hsva)||e.equal(f=e.fromHsva(a),c.current.color)||(c.current={hsva:a,color:f},r(f),u.current=!0)},[a,e,r]);var h=p.useCallback(function(f){d(function(g){return Object.assign({},g,f)})},[]),m=p.useCallback(function(){u.current&&(u.current=!1,o(c.current.color))},[o]);return[a,h,m]}var lv=typeof window<"u"?p.useLayoutEffect:p.useEffect,dv=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Lh=new Map,cv=function(e){lv(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!Lh.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Lh.set(t,n);var s=dv();s&&n.setAttribute("nonce",s),t.head.appendChild(n)}},[])},uv=function(e){var t=e.className,n=e.hsva,s=e.onChange,r=e.onChangeEnd,o={backgroundImage:"linear-gradient(90deg, "+hl(Object.assign({},n,{a:0}))+", "+hl(Object.assign({},n,{a:1}))+")"},i=Ro(["react-colorful__alpha",t]),a=ot(100*n.a);return p.createElement("div",{className:i},p.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),p.createElement(dl,{onMove:function(d){s({a:d.left})},onKey:function(d){s({a:Ps(n.a+d.left)})},onEnd:r,"aria-label":"Alpha","aria-valuetext":a+"%","aria-valuenow":a,"aria-valuemin":"0","aria-valuemax":"100"},p.createElement(cl,{className:"react-colorful__alpha-pointer",left:n.a,color:hl(n)})))},hv=function(e){var t=e.className,n=e.colorModel,s=e.color,r=s===void 0?n.defaultColor:s,o=e.onChange,i=e.onChangeEnd,a=Ph(e,["className","colorModel","color","onChange","onChangeEnd"]),d=p.useRef(null);cv(d);var c=av(n,r,o,i),u=c[0],h=c[1],m=c[2],f=Ro(["react-colorful",t]);return p.createElement("div",Uo({},a,{ref:d,className:f}),p.createElement(iv,{hsva:u,onChange:h,onChangeEnd:m}),p.createElement(ov,{hue:u.h,onChange:h,onChangeEnd:m}),p.createElement(uv,{hsva:u,onChange:h,onChangeEnd:m,className:"react-colorful__last-control"}))},fv={defaultColor:{r:0,g:0,b:0,a:1},toHsva:rv,fromHsva:sv,equal:Oh},mv=function(e){return p.createElement(hv,Uo({},e,{colorModel:fv}))};function $o({id:e,label:t,description:n,help:s,value:r,onChange:o,optional:i,showIf:a,resetOnHide:d,mountWhenHidden:c=!0,defaultColor:u={r:255,g:0,b:0,a:1},allowClear:h=!1,...m}){const{values:f,setValue:g}=it(),b=be(a),x=p.useRef(b),w=e?f==null?void 0:f[e]:void 0,_=r!==void 0,y=_?r:w,v=p.useMemo(()=>Fh(y,u),[y,u]),[j,k]=p.useState(!1),[M,N]=p.useState(v);p.useEffect(()=>{gv(M,v)||N(v)},[v]),p.useEffect(()=>{if(x.current&&!b&&d!==void 0&&e){const D=d===!0?void 0:Fh(d,u);g(e,D)}x.current=b},[b,d,e,g,u]);const T=p.useCallback(D=>{N(D),_?o==null||o(D):e&&g(e,D)},[e,_,o,g]);if(!c&&a&&!b)return null;const P=!b&&c,E=ml(M);return l.jsxs(mn,{hidden:a&&!b,"aria-hidden":a&&!b,...m,children:[l.jsxs("div",{className:"flex justify-between items-center mb-2",children:[t&&l.jsxs(pn,{htmlFor:e,children:[t,l.jsx(bn,{label:t,help:s})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[i&&l.jsx("span",{id:`${e}-optional`,className:"text-sm/6 text-gray-500 dark:text-neutral-400",children:"Optional"}),h&&l.jsx("button",{type:"button",className:"text-xs px-2 py-1 rounded border border-gray-300 hover:bg-gray-50 dark:border-neutral-700 dark:hover:bg-neutral-800",onClick:()=>{_?o==null||o(void 0):e&&g(e,void 0)},disabled:P,children:"Clear"})]})]}),n&&l.jsx(gn,{children:n}),l.jsxs("button",{type:"button",className:"inline-flex items-center gap-2 mt-2",onClick:()=>k(!0),disabled:P,style:{outline:"none"},children:[l.jsx("span",{className:"inline-block w-8 h-8 rounded-full border border-gray-300 shadow dark:border-neutral-700",style:{background:E}}),l.jsx("span",{className:"text-sm dark:text-white",children:E})]}),l.jsxs(Bo,{open:j,onClose:()=>k(!1),className:"relative z-50",children:[l.jsx("div",{className:"fixed inset-0 bg-black/30","aria-hidden":"true",onClick:()=>k(!1)}),l.jsx("div",{className:"fixed inset-0 flex items-center justify-center",children:l.jsxs(Bo.Panel,{className:"bg-white dark:bg-neutral-900 rounded-lg p-6 shadow-xl max-w-xs w-full",children:[l.jsx(mv,{color:M,onChange:T}),l.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[l.jsx("span",{className:"inline-block w-8 h-8 rounded-full border border-gray-300 dark:border-neutral-700",style:{background:ml(M)}}),l.jsx("span",{className:"text-sm dark:text-white",children:ml(M)})]}),l.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[h&&l.jsx("button",{className:"px-4 py-1.5 rounded border border-neutral-300 dark:border-neutral-700",onClick:()=>{_?o==null||o(void 0):e&&g(e,void 0),k(!1)},children:"Clear"}),l.jsx("button",{className:"col-span-2 px-4 py-1.5 rounded bg-indigo-600 text-white font-semibold text-sm w-full",onClick:()=>k(!1),children:"Done"})]})]})})]})]})}function St(e,t,n){return Math.max(t,Math.min(n,e))}function Ah(e){return e&&typeof e=="object"}function pv(e){return`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`}function fl(e){if(typeof e!="string")return null;const t=e.trim(),n=/^#([0-9a-fA-F]{3})$/.exec(t);if(n){const o=pv(n[0]);return fl(o)}const s=/^#([0-9a-fA-F]{6})$/.exec(t);if(s){const o=s[1],i=parseInt(o.slice(0,2),16),a=parseInt(o.slice(2,4),16),d=parseInt(o.slice(4,6),16);return{r:i,g:a,b:d,a:1}}const r=/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*(?:,\s*([\d.]+)\s*)?\)$/.exec(t);if(r){const o=St(Number(r[1])||0,0,255),i=St(Number(r[2])||0,0,255),a=St(Number(r[3])||0,0,255),d=St(r[4]!==void 0?Number(r[4]):1,0,1);return{r:o,g:i,b:a,a:d}}return null}function Fh(e,t){if(Ah(e)&&"r"in e&&"g"in e&&"b"in e){const r=St(Number(e.r)||0,0,255),o=St(Number(e.g)||0,0,255),i=St(Number(e.b)||0,0,255),a=St(e.a!==void 0?Number(e.a):1,0,1);return{r,g:o,b:i,a}}const n=fl(e);if(n)return n;const s=fl(t)||(Ah(t)?t:{r:255,g:0,b:0,a:1});return{r:s.r,g:s.g,b:s.b,a:s.a??1}}function ml({r:e,g:t,b:n,a:s}){const r=s===void 0?1:s;return`rgba(${St(e,0,255)}, ${St(t,0,255)}, ${St(n,0,255)}, ${Number(r).toFixed(2)})`}function gv(e,t){return!e||!t?e===t:e.r===t.r&&e.g===t.g&&e.b===t.b&&Number(e.a??1)===Number(t.a??1)}const br="free-downloads-woocommerce",zh={somdn_woo_quickview_enable:!1,somdn_woo_quickview_variations:!1,somdn_woo_quickview_button_text:"",somdn_woo_quickview_button_colour:"#2679ce",somdn_woo_quickview_button_text_colour:"#ffffff"};function Wh(){return l.jsxs("section",{className:"space-y-6",id:"quick-view",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Quick View"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Display a modal popup with product details directly on shop pages."}),l.jsx(Z,{id:"somdn_woo_quickview_enable",label:"Enable Quick View",description:"Enable the WooCommerce Quick View feature. When enabled, a Quick View button will appear on product archive pages."}),l.jsx(Qe,{showIf:{somdn_woo_quickview_enable:!0}}),l.jsxs(Xe,{showIf:{somdn_woo_quickview_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Variable Products"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure how variable products are handled in Quick View."})]}),l.jsx(Z,{id:"somdn_woo_quickview_variations",label:"Show Variation Options",description:"Display variation selection options directly in the Quick View modal. If disabled, users will see a 'Select Options' button that redirects to the product page.",showIf:{somdn_woo_quickview_enable:!0}}),l.jsx(Qe,{showIf:{somdn_woo_quickview_enable:!0}}),l.jsxs(Xe,{showIf:{somdn_woo_quickview_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Button Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Customize the appearance of the Quick View button."})]}),l.jsx(X,{id:"somdn_woo_quickview_button_text",label:"Button Text",description:"Customize the Quick View button text.",help:"<p><strong>Default:</strong> Quick View</p>",placeholder:"Quick View",showIf:{somdn_woo_quickview_enable:!0}}),l.jsx($o,{id:"somdn_woo_quickview_button_colour",label:"Button Background Colour",description:"Set the background color for the Quick View button.",showIf:{somdn_woo_quickview_enable:!0}}),l.jsx($o,{id:"somdn_woo_quickview_button_text_colour",label:"Button Text Colour",description:"Set the text color for the Quick View button.",showIf:{somdn_woo_quickview_enable:!0}})]})}const Bh=[{fieldId:"somdn_woo_quickview_enable",label:"Enable Quick View",help:"Enable the WooCommerce Quick View feature for product archive pages.",sectionKey:"quick-view",pluginSlug:br,keywords:["quick","view","modal","popup","enable","woocommerce"]},{fieldId:"somdn_woo_quickview_variations",label:"Show Variation Options",help:"Display variation selection options in the Quick View modal.",sectionKey:"quick-view",pluginSlug:br,keywords:["quick","view","variations","variable","products","options"]},{fieldId:"somdn_woo_quickview_button_text",label:"Quick View Button Text",help:"Customize the text displayed on the Quick View button.",sectionKey:"quick-view",pluginSlug:br,keywords:["quick","view","button","text","customize","label"]},{fieldId:"somdn_woo_quickview_button_colour",label:"Quick View Button Background Colour",help:"Set the background color for the Quick View button.",sectionKey:"quick-view",pluginSlug:br,keywords:["quick","view","button","color","background","style"]},{fieldId:"somdn_woo_quickview_button_text_colour",label:"Quick View Button Text Colour",help:"Set the text color for the Quick View button.",sectionKey:"quick-view",pluginSlug:br,keywords:["quick","view","button","font","text","color","style"]}],bv=Object.freeze(Object.defineProperty({__proto__:null,QuickViewSettings:Wh,quickViewDefaults:zh,quickViewSettingsIndex:Bh},Symbol.toStringTag,{value:"Module"})),xv=typeof window<"u"&&((Ag=window.diviEngineApiSettings)!=null&&Ag.restUrl)?window.diviEngineApiSettings.restUrl.replace(/\/?$/,"/"):"/wp-json/",wv=typeof window<"u"&&((Fg=window.diviEngineApiSettings)==null?void 0:Fg.nonce)||"",Hh=()=>l.jsx("svg",{className:"h-5 w-5 text-green-500",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),Vh=()=>l.jsx("svg",{className:"h-5 w-5 text-red-500",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),Uh=()=>l.jsx("svg",{className:"h-5 w-5 text-amber-500",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})}),Rh=()=>l.jsxs("svg",{className:"h-5 w-5 animate-spin text-blue-500",fill:"none",viewBox:"0 0 24 24",children:[l.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),l.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]});function _v({status:e}){return e==="pass"?l.jsx(Hh,{}):e==="fail"?l.jsx(Vh,{}):e==="warning"?l.jsx(Uh,{}):l.jsx(Rh,{})}function yv({check:e}){return l.jsxs("div",{className:"flex items-start gap-3 py-3 border-b border-neutral-200 dark:border-neutral-700 last:border-b-0",children:[l.jsx("div",{className:"flex-shrink-0 mt-0.5",children:l.jsx(_v,{status:e.status})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"text-sm font-medium text-neutral-900 dark:text-white",children:e.title}),l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:e.message}),e.action&&l.jsxs("a",{href:e.action.href,className:"mt-1 inline-block text-sm text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:[e.action.label," →"]})]})]})}function vv(){var m;const[e,t]=p.useState(!1),[n,s]=p.useState(!1),[r,o]=p.useState(null),{values:i}=it(),a=((m=window.somdn_settings)==null?void 0:m.is_pro)||!1,d=p.useCallback(()=>{const f=[];f.push({id:"woocommerce_active",title:"WooCommerce",status:"pass",message:"Checking if WooCommerce is active...",serverCheck:!0});const g=i.somdn_single_button_text||i.somdn_shop_download_logged_in_text||i.somdn_shop_download_logged_out_text;if(f.push({id:"button_text_set",title:"Download Button Text",status:g?"pass":"warning",message:g?"Download button text is configured.":"No custom button text set. Default text will be used."}),a){const b=i.somdn_download_type_option,x=i.somdn_download_type_redirect_page,w=i.somdn_download_type_email_page;if((b==="1"||b==="2")&&(x?f.push({id:"redirect_page_set",title:"Redirect Page",status:"pass",message:"Redirect page is configured."}):f.push({id:"redirect_page_missing",title:"Redirect Page Not Set",status:"fail",message:"You have enabled redirect delivery but no redirect page is selected. Please set a page with the [download_redirect] shortcode.",action:{label:"Configure Download Delivery",href:"#free-downloads-woocommerce/download-delivery"}})),b==="2"){w?f.push({id:"email_page_set",title:"Email Confirmation Page",status:"pass",message:"Email confirmation page is configured."}):f.push({id:"email_page_missing",title:"Email Confirmation Page Not Set",status:"fail",message:"You have enabled email link delivery but no confirmation page is selected.",action:{label:"Configure Download Delivery",href:"#free-downloads-woocommerce/download-delivery"}});const M=i.somdn_capture_email_enable,N=i.somdn_require_login;!M&&!N&&f.push({id:"email_delivery_requires_capture",title:"Email Capture Required",status:"warning",message:`Email link delivery is enabled but email capture is disabled. Guest users won't be able to receive download links. Enable "Require Login" or "Email Capture" in Tracking settings.`,action:{label:"Configure Tracking",href:"#free-downloads-woocommerce/tracking"}})}const _=i.somdn_capture_email_subscribe,y=i.somdn_newsletter_mailchimp_api_key,v=i.somdn_newsletter_mailchimp_list_id;_==="mailchimp"&&(y?f.push({id:"mailchimp_api_set",title:"MailChimp API Key",status:"pass",message:"MailChimp API key is configured.",serverCheck:!0}):f.push({id:"mailchimp_api_missing",title:"MailChimp API Key Missing",status:"fail",message:"Newsletter is set to MailChimp but no API key is configured.",action:{label:"Configure Newsletter",href:"#free-downloads-woocommerce/newsletter"}}),v?f.push({id:"mailchimp_list_set",title:"MailChimp List ID",status:"pass",message:"MailChimp list ID is configured."}):f.push({id:"mailchimp_list_missing",title:"MailChimp List ID Missing",status:"warning",message:"No MailChimp list/audience ID is set. Subscribers won't be added to any list.",action:{label:"Configure Newsletter",href:"#free-downloads-woocommerce/newsletter"}}));const j=i.somdn_limits_enable,k=i.somdn_pro_track_enable;j&&!k&&f.push({id:"limits_require_tracking",title:"Tracking Required for Limits",status:"warning",message:"Download limits are enabled but tracking is disabled. Tracking will be automatically enabled."})}return f},[i,a]),c=p.useCallback(async()=>{s(!0);let f=d();o(f);try{const g=await fetch(`${xv}wpe/v1/somdn-config-check`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":wv},body:JSON.stringify({settings:i})});if(!g.ok)throw new Error(`Server check failed: ${g.status}`);const b=await g.json();b&&b.checks&&(f=f.map(x=>{const w=b.checks.find(_=>_.id===x.id);return w?{...x,...w}:x}),b.checks.forEach(x=>{f.find(w=>w.id===x.id)||f.push(x)})),o(f)}catch{}finally{s(!1)}},[d,i]),u=p.useCallback(()=>{t(!0),o(null),c()},[c]),h=r?{pass:r.filter(f=>f.status==="pass").length,warning:r.filter(f=>f.status==="warning").length,fail:r.filter(f=>f.status==="fail").length}:null;return l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:u,className:"inline-flex items-center gap-2 px-4 py-2 text-sm font-semibold text-white rounded-lg shadow-sm transition-colors",style:{backgroundColor:"rgb(79, 70, 228)"},children:[l.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Check Configuration"]}),l.jsx(dh,{open:e,onClose:()=>t(!1),size:"lg",children:l.jsxs("div",{className:"p-6",children:[l.jsx(ch,{children:"Configuration Check"}),l.jsx(uh,{children:"Validating your plugin settings to ensure everything is configured correctly."}),l.jsxs(Yy,{className:"mt-6",children:[n&&!r&&l.jsxs("div",{className:"flex items-center justify-center py-8",children:[l.jsx(Rh,{}),l.jsx("span",{className:"ml-3 text-neutral-500 dark:text-neutral-400",children:"Running checks..."})]}),r&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex gap-4 mb-6 p-4 bg-neutral-50 dark:bg-neutral-800 rounded-lg",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Hh,{}),l.jsxs("span",{className:"text-sm font-medium text-neutral-700 dark:text-neutral-300",children:[h.pass," Passed"]})]}),h.warning>0&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Uh,{}),l.jsxs("span",{className:"text-sm font-medium text-neutral-700 dark:text-neutral-300",children:[h.warning," Warnings"]})]}),h.fail>0&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Vh,{}),l.jsxs("span",{className:"text-sm font-medium text-neutral-700 dark:text-neutral-300",children:[h.fail," Failed"]})]})]}),l.jsx("div",{className:"max-h-96 overflow-y-auto pr-2",children:r.sort((f,g)=>{const b={fail:0,warning:1,pass:2};return(b[f.status]??3)-(b[g.status]??3)}).map(f=>l.jsx(yv,{check:f},f.id))})]})]}),l.jsxs("div",{className:"mt-8 flex flex-col-reverse items-center justify-end gap-3 sm:flex-row",children:[l.jsx("button",{onClick:()=>t(!1),className:"w-full sm:w-auto px-4 py-2 text-sm font-medium text-neutral-700 dark:text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-800 rounded-lg transition-colors cursor-pointer",children:"Close"}),l.jsx("button",{onClick:c,disabled:n,className:"w-full sm:w-auto px-4 py-2 text-sm font-semibold text-white rounded-lg shadow-sm transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:"rgb(79, 70, 228)"},children:n?"Checking...":"Re-run Checks"})]})]})})]})}const kv=typeof window<"u"&&((zg=window.diviEngineApiSettings)!=null&&zg.restUrl)?window.diviEngineApiSettings.restUrl.replace(/\/?$/,"/"):"/wp-json/",jv=typeof window<"u"&&((Wg=window.diviEngineApiSettings)==null?void 0:Wg.nonce)||"";function Sv({status:e}){const t={pass:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",fail:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400",warning:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"},n={pass:"Pass",fail:"Fail",warning:"Warning"};return l.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${t[e]||t.warning}`,children:n[e]||e})}function Nv({name:e,tests:t,defaultOpen:n=!1}){const[s,r]=p.useState(n);if(!t||t.length===0)return null;const o=t.filter(d=>d.status==="pass").length,i=t.filter(d=>d.status==="fail").length,a=t.filter(d=>d.status==="warning").length;return l.jsxs("div",{className:"border border-neutral-200 dark:border-neutral-700 rounded-lg overflow-hidden",children:[l.jsxs("button",{type:"button",onClick:()=>r(!s),className:"w-full px-4 py-3 flex items-center justify-between bg-neutral-50 dark:bg-neutral-800/50 hover:bg-neutral-100 dark:hover:bg-neutral-800 transition-colors",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("svg",{className:`w-4 h-4 transform transition-transform ${s?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),l.jsxs("span",{className:"font-medium text-neutral-900 dark:text-white capitalize",children:[e.replace("_"," ")," Tests"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[o>0&&l.jsxs("span",{className:"text-xs text-green-600 dark:text-green-400",children:[o," passed"]}),a>0&&l.jsxs("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:[a," warnings"]}),i>0&&l.jsxs("span",{className:"text-xs text-red-600 dark:text-red-400",children:[i," failed"]})]})]}),s&&l.jsx("div",{className:"divide-y divide-neutral-200 dark:divide-neutral-700",children:t.map((d,c)=>l.jsxs("div",{className:"px-4 py-3 flex items-start justify-between gap-4",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"font-medium text-sm text-neutral-900 dark:text-white",children:d.name}),l.jsx("div",{className:"text-xs text-neutral-500 dark:text-neutral-400 mt-0.5",children:d.message})]}),l.jsx(Sv,{status:d.status})]},d.id||c))})]})}function Cv({summary:e}){if(!e)return null;const{total:t,passed:n,failed:s,warning:r}=e,o=s===0;return l.jsxs("div",{className:`p-4 rounded-lg border ${o?"bg-green-50 border-green-200 dark:bg-green-900/20 dark:border-green-800":"bg-red-50 border-red-200 dark:bg-red-900/20 dark:border-red-800"}`,children:[l.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[o?l.jsx("svg",{className:"w-6 h-6 text-green-600 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}):l.jsx("svg",{className:"w-6 h-6 text-red-600 dark:text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),l.jsx("span",{className:`font-semibold ${o?"text-green-800 dark:text-green-300":"text-red-800 dark:text-red-300"}`,children:o?"All Tests Passed":"Some Tests Failed"})]}),l.jsxs("div",{className:"grid grid-cols-4 gap-4 mt-3",children:[l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-2xl font-bold text-neutral-900 dark:text-white",children:t}),l.jsx("div",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"Total"})]}),l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-2xl font-bold text-green-600 dark:text-green-400",children:n}),l.jsx("div",{className:"text-xs text-green-600 dark:text-green-400",children:"Passed"})]}),l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-2xl font-bold text-yellow-600 dark:text-yellow-400",children:r}),l.jsx("div",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:"Warnings"})]}),l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-2xl font-bold text-red-600 dark:text-red-400",children:s}),l.jsx("div",{className:"text-xs text-red-600 dark:text-red-400",children:"Failed"})]})]})]})}function Mv(){const[e,t]=p.useState(!1),[n,s]=p.useState(null),[r,o]=p.useState(null),i=p.useCallback(async(a="all")=>{t(!0),o(null);try{const d=await fetch(`${kv}wpe/v1/somdn-integration-test`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":jv},body:JSON.stringify({test_type:a})});if(!d.ok)throw new Error(`HTTP error: ${d.status}`);const c=await d.json();s(c)}catch(d){o(d.message||"Failed to run integration tests"),s(null)}finally{t(!1)}},[]);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{type:"button",onClick:()=>i("all"),disabled:e,className:"inline-flex items-center gap-2 px-4 py-2 bg-indigo-600 hover:bg-indigo-700 disabled:bg-indigo-400 text-white text-sm font-medium rounded-lg transition-colors",children:e?l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[l.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),l.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Running Tests..."]}):l.jsxs(l.Fragment,{children:[l.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),"Run Integration Tests"]})}),(n==null?void 0:n.is_pro)&&l.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded text-xs font-medium bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",children:"Pro Active"})]}),r&&l.jsxs("div",{className:"p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg",children:[l.jsxs("div",{className:"flex items-center gap-2 text-red-800 dark:text-red-300",children:[l.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),l.jsx("span",{className:"font-medium",children:"Error running tests"})]}),l.jsx("p",{className:"mt-1 text-sm text-red-700 dark:text-red-400",children:r})]}),n&&l.jsxs("div",{className:"space-y-4",children:[l.jsx(Cv,{summary:n.summary}),l.jsx("div",{className:"space-y-3",children:Object.entries(n.results).map(([a,d])=>l.jsx(Nv,{name:a,tests:d,defaultOpen:a==="loading"||d.some(c=>c.status==="fail")},a))}),l.jsx("div",{className:"text-xs text-neutral-500 dark:text-neutral-400 pt-2",children:"Tests verify: option name mappings, save/retrieve operations, edge cases (special chars, long text, toggles), and compatibility with existing settings."})]}),!n&&!r&&!e&&l.jsx("div",{className:"p-4 bg-neutral-50 dark:bg-neutral-800/50 rounded-lg border border-neutral-200 dark:border-neutral-700",children:l.jsx("p",{className:"text-sm text-neutral-600 dark:text-neutral-400",children:'Click "Run Integration Tests" to verify the settings framework is working correctly. This tests option name mappings, save/retrieve operations, edge cases, and compatibility.'})})]})}const pl=typeof window<"u"&&((Bg=window.diviEngineApiSettings)!=null&&Bg.restUrl)?window.diviEngineApiSettings.restUrl.replace(/\/?$/,"/"):"/wp-json/",gl=typeof window<"u"&&((Hg=window.diviEngineApiSettings)==null?void 0:Hg.nonce)||"",Ev=()=>{var t;return(typeof window<"u"&&((t=window.diviEngineSettingsObject)==null?void 0:t.organization)||"divi-engine")==="wp-enhanced"?"wpe/v1":"de/v1"},Pv=e=>!e||typeof e!="string"?"":e.split(`
`).map(s=>{const r=s.trim();if(!r)return"";if(r.startsWith("{")&&r.endsWith("}"))try{const o=JSON.parse(r);return JSON.stringify(o,null,2)}catch{return s}return s}).join(`

`);function Tv({logPath:e,title:t="Error Logs",description:n="Notable errors and warnings are stored on the server and displayed here for convenience.",emptyMessage:s="No errors logged yet.",restNamespace:r=null}){const[o,i]=p.useState(""),[a,d]=p.useState(!0),[c,u]=p.useState(null),[h,m]=p.useState(!1),[f,g]=p.useState(!1),[b,x]=p.useState(!1),[w,_]=p.useState(!1),y=r||Ev(),v=p.useCallback(async()=>{d(!0),u(null);try{const E=await fetch(`${pl}${y}/error-logs?log_path=${encodeURIComponent(e)}`,{credentials:"same-origin",headers:{"X-WP-Nonce":gl}});if(!E.ok)throw new Error(`Failed to fetch logs: ${E.status}`);const D=await E.json();i(Pv(D.content||"")),m(D.exists)}catch(E){u(E.message||"Failed to fetch logs")}finally{d(!1)}},[e,y]);p.useEffect(()=>{v()},[v]);const j=async()=>{try{await navigator.clipboard.writeText(o),g(!0),setTimeout(()=>g(!1),2e3)}catch(E){console.error("Failed to copy:",E)}},k=()=>{const E=new Blob([o],{type:"text/plain"}),D=URL.createObjectURL(E),z=document.createElement("a");z.href=D,z.download=`error-logs-${new Date().toISOString().split("T")[0]}.txt`,document.body.appendChild(z),z.click(),document.body.removeChild(z),URL.revokeObjectURL(D)},M=async()=>{if(confirm("Are you sure you want to delete the error logs? This cannot be undone.")){x(!0);try{const E=await fetch(`${pl}${y}/error-logs?log_path=${encodeURIComponent(e)}`,{method:"DELETE",credentials:"same-origin",headers:{"X-WP-Nonce":gl}});if(!E.ok)throw new Error(`Failed to delete logs: ${E.status}`);i(""),m(!1)}catch(E){u(E.message||"Failed to delete logs")}finally{x(!1)}}},N=async()=>{_(!0);try{const E=await fetch(`${pl}${y}/error-logs/test?log_path=${encodeURIComponent(e)}`,{method:"POST",credentials:"same-origin",headers:{"X-WP-Nonce":gl,"Content-Type":"application/json"},body:JSON.stringify({message:"Test log entry from settings page"})});if(!E.ok)throw new Error(`Failed to write test log: ${E.status}`);await v()}catch(E){u(E.message||"Failed to write test log")}finally{_(!1)}};if(a)return l.jsxs("div",{className:"space-y-4",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:t}),l.jsx("div",{className:"animate-pulse rounded-md bg-gray-200/70 dark:bg-neutral-800/70 h-48"})]});if(c)return l.jsxs("div",{className:"space-y-4",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:t}),l.jsx("div",{className:"rounded-md bg-red-50 p-4 dark:bg-red-900/20",children:l.jsxs("p",{className:"text-sm text-red-700 dark:text-red-300",children:["Error: ",c]})})]});const T=h?o:s,P=h&&o.trim().length>0;return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:t}),l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400 mt-1",children:n})]}),l.jsx("div",{className:"relative",children:l.jsx("pre",{className:"bg-neutral-100 dark:bg-neutral-800 rounded-lg p-4 text-sm font-mono text-neutral-700 dark:text-neutral-300 overflow-auto max-h-96 whitespace-pre-wrap break-words border border-neutral-200 dark:border-neutral-700",children:T})}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx("button",{type:"button",onClick:j,disabled:!P,className:"inline-flex items-center gap-1.5 rounded-md bg-white dark:bg-neutral-800 px-3 py-2 text-sm font-medium text-neutral-700 dark:text-neutral-300 shadow-sm ring-1 ring-inset ring-neutral-300 dark:ring-neutral-600 hover:bg-neutral-50 dark:hover:bg-neutral-700 disabled:opacity-50 disabled:cursor-not-allowed",children:f?l.jsxs(l.Fragment,{children:[l.jsx("svg",{className:"h-4 w-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Copied!"]}):l.jsxs(l.Fragment,{children:[l.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Copy"]})}),l.jsxs("button",{type:"button",onClick:k,disabled:!P,className:"inline-flex items-center gap-1.5 rounded-md bg-white dark:bg-neutral-800 px-3 py-2 text-sm font-medium text-neutral-700 dark:text-neutral-300 shadow-sm ring-1 ring-inset ring-neutral-300 dark:ring-neutral-600 hover:bg-neutral-50 dark:hover:bg-neutral-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[l.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Export"]}),l.jsxs("button",{type:"button",onClick:M,disabled:!P||b,className:"inline-flex items-center gap-1.5 rounded-md bg-white dark:bg-neutral-800 px-3 py-2 text-sm font-medium text-red-600 dark:text-red-400 shadow-sm ring-1 ring-inset ring-neutral-300 dark:ring-neutral-600 hover:bg-red-50 dark:hover:bg-red-900/20 disabled:opacity-50 disabled:cursor-not-allowed",children:[l.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),b?"Deleting...":"Delete"]}),l.jsxs("button",{type:"button",onClick:v,className:"inline-flex items-center gap-1.5 rounded-md bg-white dark:bg-neutral-800 px-3 py-2 text-sm font-medium text-neutral-700 dark:text-neutral-300 shadow-sm ring-1 ring-inset ring-neutral-300 dark:ring-neutral-600 hover:bg-neutral-50 dark:hover:bg-neutral-700",children:[l.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Refresh"]}),l.jsxs("button",{type:"button",onClick:N,disabled:w,className:"inline-flex items-center gap-1.5 rounded-md bg-white dark:bg-neutral-800 px-3 py-2 text-sm font-medium text-blue-600 dark:text-blue-400 shadow-sm ring-1 ring-inset ring-neutral-300 dark:ring-neutral-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 disabled:opacity-50 disabled:cursor-not-allowed",children:[l.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),w?"Writing...":"Write Test Log"]})]})]})}const qo="free-downloads-woocommerce",$h={somdn_debug_logging_enable:!1};function qh(){return l.jsxs("section",{className:"space-y-6",id:"debug",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Debug Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Settings related to plugin debugging and troubleshooting."}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Configuration Checker"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Validate your plugin configuration to ensure everything is set up correctly."}),l.jsx("div",{className:"flex items-start gap-4 p-4 bg-neutral-50 dark:bg-neutral-800/50 rounded-lg border border-neutral-200 dark:border-neutral-700",children:l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-sm text-neutral-600 dark:text-neutral-400 mb-3",children:"Run a configuration check to verify your settings, WooCommerce compatibility, and ensure all required options are properly configured."}),l.jsx(vv,{})]})}),l.jsx("h3",{className:"text-base font-medium dark:text-white mt-8",children:"Integration Tests"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Run comprehensive tests to verify the settings framework is functioning correctly."}),l.jsx("div",{className:"p-4 bg-neutral-50 dark:bg-neutral-800/50 rounded-lg border border-neutral-200 dark:border-neutral-700",children:l.jsx(Mv,{})}),l.jsx("h3",{className:"text-base font-medium dark:text-white mt-8",children:"Error Logging"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Enable debug logging to help troubleshoot issues with the plugin."}),l.jsx(Z,{id:"somdn_debug_logging_enable",label:"Enable Debug Logging",description:"Show debug messages in error logs. Enable this when troubleshooting issues with the plugin. It's recommended to disable this in production environments."}),l.jsx("div",{className:"mt-8",children:l.jsx(Tv,{logPath:"free-downloads-files/free_downloads_log.txt",title:"Free Download Error Logs",description:"Notable free download errors and warnings are stored on the server and displayed here for convenience."})})]})}const Yh=[{fieldId:"somdn_debug_logging_enable",label:"Enable Debug Logging",help:"Show debug messages in error logs for troubleshooting.",sectionKey:"debug",pluginSlug:qo,keywords:["debug","logging","logs","error","troubleshoot","enable"]},{fieldId:"configuration_checker",label:"Configuration Checker",help:"Validate your plugin settings and check for issues.",sectionKey:"debug",pluginSlug:qo,keywords:["check","validate","configuration","settings","test","verify","diagnostic"]},{fieldId:"integration_tester",label:"Integration Tests",help:"Run comprehensive tests to verify the settings framework is functioning correctly.",sectionKey:"debug",pluginSlug:qo,keywords:["integration","test","verify","save","load","compatibility","migration"]},{fieldId:"error_logs_viewer",label:"Error Logs Viewer",help:"View, copy, export, and delete error logs from the server.",sectionKey:"debug",pluginSlug:qo,keywords:["error","logs","viewer","copy","export","delete","troubleshoot","debug"]}],Dv=Object.freeze(Object.defineProperty({__proto__:null,DebugSettings:qh,debugDefaults:$h,debugSettingsIndex:Yh},Symbol.toStringTag,{value:"Module"}));function Kh({options:e,displayValue:t,filter:n,anchor:s="bottom",className:r,placeholder:o,autoFocus:i,"aria-label":a,children:d,...c}){const[u,h]=p.useState(""),m=u===""?e:e.filter(f=>{var g;return n?n(f,u):(g=t(f))==null?void 0:g.toLowerCase().includes(u.toLowerCase())});return l.jsxs(__,{...c,multiple:!1,virtual:{options:m},onClose:()=>h(""),children:[l.jsxs("span",{"data-slot":"control",className:ae([r,"relative block w-full max-w-lg","before:absolute before:inset-px before:rounded-[calc(var(--radius-lg)-1px)] before:bg-white before:shadow-sm","dark:before:hidden","after:pointer-events-none after:absolute after:inset-0 after:rounded-lg after:ring-transparent after:ring-inset sm:focus-within:after:ring-2 sm:focus-within:after:ring-blue-500","has-data-disabled:opacity-50 has-data-disabled:before:bg-neutral-950/5 has-data-disabled:before:shadow-none","has-data-invalid:before:shadow-red-500/10"]),children:[l.jsx(zu,{autoFocus:i,"data-slot":"control","aria-label":a,displayValue:f=>t(f)??"",onChange:f=>h(f.target.value),placeholder:o,className:ae([r,"relative block w-full max-w-lg appearance-none rounded-lg py-[calc(--spacing(2.5)-1px)] sm:py-[calc(--spacing(1.5)-1px)]","pr-[calc(--spacing(10)-1px)] pl-[calc(--spacing(3.5)-1px)] sm:pr-[calc(--spacing(9)-1px)] sm:pl-[calc(--spacing(3)-1px)]","text-base/6 text-neutral-950 placeholder:text-neutral-500 sm:text-sm/6 dark:text-white","border border-neutral-950/10 data-hover:border-neutral-950/20 dark:border-white/10 dark:data-hover:border-white/20","bg-transparent dark:bg-white/5","focus:outline-hidden","data-invalid:border-red-500 data-invalid:data-hover:border-red-500 dark:data-invalid:border-red-500 dark:data-invalid:data-hover:border-red-500","data-disabled:border-neutral-950/20 dark:data-disabled:border-white/15 dark:data-disabled:bg-white/2.5 dark:data-hover:data-disabled:border-white/15","dark:scheme-dark"])}),l.jsx(Fu,{className:"group absolute inset-y-0 right-0 flex items-center px-2",children:l.jsxs("svg",{className:"size-5 stroke-neutral-500 group-data-disabled:stroke-neutral-600 group-data-hover:stroke-neutral-700 sm:size-4 dark:stroke-neutral-400 dark:group-data-hover:stroke-neutral-300 forced-colors:stroke-[CanvasText]",viewBox:"0 0 16 16","aria-hidden":"true",fill:"none",children:[l.jsx("path",{d:"M5.75 10.75L8 13L10.25 10.75",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M10.25 5.25L8 3L5.75 5.25",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]})})]}),l.jsx(Wu,{transition:!0,anchor:s,className:ae("[--anchor-gap:--spacing(2)] [--anchor-padding:--spacing(4)] sm:data-[anchor~=start]:[--anchor-offset:-4px]","isolate min-w-[calc(var(--input-width)+8px)] scroll-py-1 rounded-xl p-1 select-none empty:invisible","outline outline-transparent focus:outline-hidden","overflow-y-scroll overscroll-contain","bg-white/75 backdrop-blur-xl dark:bg-neutral-800/75","shadow-lg ring-1 ring-neutral-950/10 dark:ring-white/10 dark:ring-inset","transition-opacity duration-100 ease-in data-closed:data-leave:opacity-0 data-transition:pointer-events-none"),children:({option:f})=>d(f)})]})}function Gh({children:e,className:t,...n}){let s=ae("flex min-w-0 items-center","*:data-[slot=icon]:size-5 *:data-[slot=icon]:shrink-0 sm:*:data-[slot=icon]:size-4","*:data-[slot=icon]:text-neutral-500 group-data-focus/option:*:data-[slot=icon]:text-white dark:*:data-[slot=icon]:text-neutral-400","forced-colors:*:data-[slot=icon]:text-[CanvasText] forced-colors:group-data-focus/option:*:data-[slot=icon]:text-[Canvas]","*:data-[slot=avatar]:-mx-0.5 *:data-[slot=avatar]:size-6 sm:*:data-[slot=avatar]:size-5");return l.jsxs(Bu,{...n,className:ae("group/option grid w-full cursor-default grid-cols-[1fr_--spacing(5)] items-baseline gap-x-2 rounded-lg py-2.5 pr-2 pl-3.5 sm:grid-cols-[1fr_--spacing(4)] sm:py-1.5 sm:pr-2 sm:pl-3","text-base/6 text-neutral-950 sm:text-sm/6 dark:text-white forced-colors:text-[CanvasText]","outline-hidden data-focus:bg-blue-500 data-focus:text-white","forced-color-adjust-none forced-colors:data-focus:bg-[Highlight] forced-colors:data-focus:text-[HighlightText]","data-disabled:opacity-50"),children:[l.jsx("span",{className:ae(t,s),children:e}),l.jsx("svg",{className:"relative col-start-2 hidden size-5 self-center stroke-current group-data-selected/option:inline sm:size-4",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"M4 8.5l3 3L12 4",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})]})}function Xh({className:e,...t}){return l.jsx("span",{...t,className:ae(e,"ml-2.5 truncate first:ml-0 sm:ml-2 sm:first:ml-0")})}const Iv=100,Qh=new Map;function bl({id:e,label:t,description:n,taxonomy:s,terms:r,value:o,onChange:i,help:a,showIf:d,resetOnHide:c,mountWhenHidden:u=!0,className:h,...m}){const{values:f,setValue:g}=it(),b=be(d),x=p.useRef(b),w=!!e,_=w?f==null?void 0:f[e]:void 0,y=o!==void 0,v=y?o:_,[j,k]=p.useState([]),[M,N]=p.useState(!1),[T,P]=p.useState(null),E=p.useMemo(()=>Array.isArray(r)?r:j,[r,j]),D=e||`${s||"taxonomy"}-select`,z=()=>typeof window>"u"?"":window.location.origin+window.location.pathname.replace(/\/wp-admin.*/,"");p.useEffect(()=>{let C=new AbortController;async function F(){if(Array.isArray(r)){k(r);return}if(!s)return;P(null);const U=Qh.get(s);if(U){k(U);return}N(!0);try{const H=z(),L=s==="category"?"categories":encodeURIComponent(s),$=`${H}/wp-json/wp/v2/${L}?per_page=${Iv}&hide_empty=false`;let J=[],ne=1,Q=1;for(;;){const te=`${$}&page=${ne}`,Ne=await fetch(te,{signal:C.signal});if(!Ne.ok)throw new Error(`Failed to fetch taxonomy terms from ${te}`);const Me=parseInt(Ne.headers.get("X-WP-TotalPages")||"1",10);Q=Number.isFinite(Me)?Me:1;const to=await Ne.json();if(J=J.concat(to),ne>=Q)break;ne+=1}const V=new Set,K=[];for(const te of J)V.has(te.id)||(V.add(te.id),K.push(te));K.sort((te,Ne)=>((te==null?void 0:te.name)||"").localeCompare((Ne==null?void 0:Ne.name)||"",void 0,{sensitivity:"base"})),Qh.set(s,K),k(K)}catch(H){H.name!=="AbortError"&&(P(H.message||"Failed to load terms"),k([]))}finally{N(!1)}}return F(),()=>C.abort()},[s,r]);const R=p.useMemo(()=>v&&E.find(C=>{var F,U;return(C==null?void 0:C.id)===v||(C==null?void 0:C.slug)===v||((F=C==null?void 0:C.id)==null?void 0:F.toString())===String(v)||((U=C==null?void 0:C.slug)==null?void 0:U.toString())===String(v)})||null,[E,v]),O=p.useMemo(()=>!R||!s?null:`${z()}/wp-admin/term.php?taxonomy=${encodeURIComponent(s)}&tag_ID=${R.id}`,[R,s]);if(p.useEffect(()=>{if(x.current&&!b&&c!==void 0){const C=c===!0?void 0:c;w?g(e,C):y||i==null||i(C)}x.current=b},[b,c,w,e,g,y,i]),!u&&d&&!b)return null;const A=!b&&u,B=C=>{!y&&w&&g(e,C),i==null||i(C)};return l.jsxs(mn,{hidden:d&&!b,"aria-hidden":d&&!b,className:h,...m,children:[l.jsx("div",{className:"flex items-center gap-2 mb-2",children:t&&l.jsxs(pn,{htmlFor:D,children:[t,l.jsx(bn,{label:t,help:a})]})}),n&&l.jsx(gn,{children:n}),l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsx("div",{className:"flex-1",children:l.jsx(Kh,{as:"div",id:D,name:s,options:E,displayValue:C=>(C==null?void 0:C.name)||"",value:R,onChange:C=>B((C==null?void 0:C.id)??(C==null?void 0:C.slug)??""),placeholder:M?"Loading…":"Search…",disabled:A||M||E.length===0,children:C=>l.jsx(Gh,{value:C,children:l.jsx(Xh,{children:(C==null?void 0:C.name)||"(no name)"})},C.id||C.slug)})}),R&&O&&l.jsx("a",{href:O,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-3 py-1.5 rounded bg-neutral-200 text-neutral-900 text-xs font-semibold hover:bg-indigo-600 hover:text-white transition dark:bg-neutral-800 dark:text-white dark:hover:bg-indigo-700",title:"Edit term",style:{whiteSpace:"nowrap"},children:"Edit"})]}),M&&l.jsx("div",{className:"text-xs text-gray-500 mt-2",children:"Loading…"}),T&&l.jsx("div",{className:"text-xs text-red-500 mt-2",children:T}),!M&&!T&&l.jsxs("div",{className:"text-xs text-gray-400 mt-2",children:[E.length," terms loaded."]})]})}const Ze="free-downloads-woocommerce",Ov=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.is_pro)||!1},Lv=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.has_memberships)||!1},Zh={somdn_pro_basic_limit_enable:!1,somdn_pro_basic_limit_type:"0",somdn_pro_basic_login_req:"login-required",somdn_pro_basic_limit_freq:"",somdn_pro_basic_limit_amount:"",somdn_pro_basic_limit_products:"",somdn_pro_basic_limit_product_name:"",somdn_pro_exclude_months:"",somdn_pro_exclude_cat_list:[],somdn_pro_basic_limit_error:"",somdn_pro_limit_acc_page:!1,somdn_pro_limit_acc_page_title_enable:!1,somdn_pro_limit_acc_page_title:"",somdn_pro_limit_acc_page_message:""},Jh={somdn_pro_limit_member_exclude:!1,somdn_pro_limit_refresh_on_subscribe_date:!1};function ef(){const e=Ov(),t=Lv(),n=be({somdn_pro_basic_limit_enable:!0}),s=be({somdn_pro_basic_limit_enable:!0,somdn_pro_limit_acc_page:!0});return l.jsxs("section",{className:"space-y-6",id:"download-limits",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Download Limits"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Limit the number of times users can download free products. Track downloads by user or IP address."}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_limit_enable",l.jsx(W,{title:"Download Limitations",description:"Limit the number of times users can download free products. Track downloads by User ID or IP Address.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_limit_enable",l.jsx(Z,{id:"somdn_pro_basic_limit_enable",label:"Enable Download Limitations",description:"When enabled, you can customize download limits for your site.",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_limit_type",l.jsx(W,{title:"Limit Downloads By",description:"Choose how to track download limits - by User ID (requires login) or IP Address.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_limit_type",l.jsx(ft,{id:"somdn_pro_basic_limit_type",label:"Limit Downloads By",description:l.jsxs(l.Fragment,{children:["Limiting by User ID only works if ",l.jsx(gt,{settingId:"somdn_require_login",children:"Only Show Button to Logged In Users"})," is enabled."]}),help:"<p>Any limits selected will mean downloads will be tracked in the database.</p><p>If no option selected, no limits apply.</p>",options:[{label:"Please choose...",value:"0"},{label:"User ID",value:"1"},{label:"IP Address",value:"2"}],disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_login_req",l.jsx(W,{title:"Login Required",description:"Configure whether users must be logged in for download limits to apply.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_login_req",l.jsx(ft,{id:"somdn_pro_basic_login_req",label:"Login Required",description:"For download limits to work by user ID, you need to require login. Choose 'Not Required' if you have memberships with paid downloads but also free downloads for guests.",options:[{label:"Login Required for all",value:"login-required"},{label:"Not Required (useful with the mix of memberships and free downloads)",value:"not-required"}],disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_limit_freq",l.jsx(W,{title:"Download Limit Period",description:"Set the time period for download limits (daily, weekly, monthly, or yearly).",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_limit_freq",l.jsx(ft,{id:"somdn_pro_basic_limit_freq",label:"Download Limit Period",description:"Set download limits for each day/week/month/year. If no option selected, no limits apply.",options:[{label:"Please choose...",value:""},{label:"Day",value:"1"},{label:"Week",value:"2"},{label:"Month",value:"3"},{label:"Year",value:"4"}],disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_limit_amount",l.jsx(W,{title:"Number of Downloads",description:"Limit the number of times a download can be requested.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_limit_amount",l.jsx(X,{id:"somdn_pro_basic_limit_amount",label:"Number of Downloads",description:"Limit the number of times a download can be requested. Leave blank for unlimited.",type:"number",min:0,max:1e3,placeholder:"0 - 1000",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_limit_products",l.jsx(W,{title:"Number of Products",description:"Limit the number of different products that can be downloaded.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_limit_products",l.jsx(X,{id:"somdn_pro_basic_limit_products",label:"Number of Products",description:"Limit the number of different products that can be downloaded. Leave blank for unlimited. If a product limit is set, the number of downloads will apply per product.",type:"number",min:0,max:1e3,placeholder:"0 - 1000",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_limit_product_name",l.jsx(W,{title:"Products Text",description:"Customize the text that shows 'Products' in the download limits display.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_limit_product_name",l.jsx(X,{id:"somdn_pro_basic_limit_product_name",label:"Download Limits 'Products' Text",description:"Change the text that says 'Products'. Example: Change 'Downloads 20, Products 0' to 'Downloads 20, Files 0'.",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_exclude_months",l.jsx(W,{title:"Exclude Months",description:"Set the number of months that downloads from My Account don't count towards limits.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_exclude_months",l.jsx(X,{id:"somdn_pro_exclude_months",label:"Months to Exclude from Counting",description:"The number of months that downloads from My Account (for owned products) won't count towards limits. Leave blank for no exclusion.",type:"number",min:0,max:36,disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_exclude_cat_list",l.jsx(W,{title:"Exclude Categories",description:"Products in selected categories will not be counted when downloaded.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_exclude_cat_list",l.jsx(bl,{id:"somdn_pro_exclude_cat_list",label:"Exclude Categories",description:"Products in selected categories will not be counted when downloaded.",taxonomy:"product_cat",disabled:!e}))]}),l.jsx(Qe,{showIf:{somdn_pro_basic_limit_enable:!0}}),l.jsxs(Xe,{showIf:{somdn_pro_basic_limit_enable:!0},as:"div",className:"rounded-md bg-neutral-50 p-4 dark:bg-neutral-800/50",children:[l.jsx("h4",{className:"text-sm font-medium dark:text-white mb-3",children:"Examples"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-sm text-neutral-600 dark:text-neutral-400",children:[l.jsxs("li",{children:[l.jsx("strong",{children:"Downloads 20, Products 0"})," - 20 total downloads."]}),l.jsxs("li",{children:[l.jsx("strong",{children:"Downloads 5, Products 5"})," - 5 downloads of up to 5 different products."]}),l.jsxs("li",{children:[l.jsx("strong",{children:"Downloads 0, Products 5"})," - Unlimited downloads of up to 5 different products."]})]})]}),l.jsx(Qe,{showIf:{somdn_pro_basic_limit_enable:!0}}),l.jsxs(Xe,{showIf:{somdn_pro_basic_limit_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Error Message"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Customize the message shown when download limits are reached."})]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_limit_error",l.jsx(W,{title:"Error Message",description:"Customize the download limit reached error message.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_limit_error",l.jsx(jt,{id:"somdn_pro_basic_limit_error",label:"Custom Error Message",description:"Customize the download limit reached error message.",help:"<p><strong>Default for limited downloads, unlimited products:</strong><br/>Your free download limit is (Number of downloads) downloads per (Download limit period).</p><br/><p><strong>Default for limited downloads, limited products:</strong><br/>Your free download limit is (Number of downloads) downloads for (Number of products) products per (Download limit period).</p><br/><p><strong>Default for unlimited downloads, limited products:</strong><br/>Your free download limit is (Number of products) products per (Download limit period).</p>",rows:4,disabled:!e}))]}),l.jsx(Qe,{showIf:{somdn_pro_basic_limit_enable:!0}}),l.jsxs(Xe,{showIf:{somdn_pro_basic_limit_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Account Page"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Show download limit information on the customer's account page."})]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_limit_acc_page",l.jsx(W,{title:"Account Page Display",description:"Show customer download limits on their WooCommerce account page.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_limit_acc_page",l.jsx(Z,{id:"somdn_pro_limit_acc_page",label:"Show Limits on Account Page",description:"Display download limits in the downloads section of the [woocommerce_my_account] shortcode.",disabled:!e}))]}),s&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_limit_acc_page_title_enable",l.jsx(W,{title:"Section Title",description:"Display a heading above the download limit section on the account page.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_limit_acc_page_title_enable",l.jsx(Z,{id:"somdn_pro_limit_acc_page_title_enable",label:"Show Section Title Heading",description:"Displays a heading above the download limit section.",disabled:!e}))]}),s&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_limit_acc_page_title",l.jsx(W,{title:"Section Title Text",description:"Customize the section title heading text.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_limit_acc_page_title",l.jsx(X,{id:"somdn_pro_limit_acc_page_title",label:"Section Title",description:"Customize the section title heading.",help:"<p><strong>Default:</strong> Free Download Limits</p>",placeholder:"Free Download Limits",disabled:!e}))]}),s&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_limit_acc_page_message",l.jsx(W,{title:"Section Message",description:"Include a short section of text below the free download limits section title.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_limit_acc_page_message",l.jsx(jt,{id:"somdn_pro_limit_acc_page_message",label:"Section Message",description:"Include a short section of text below the free download limits section title.",rows:3,disabled:!e}))]}),t&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Membership Limit Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Additional settings for download limitations of your site memberships."}),n?l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_limit_member_exclude",l.jsx(W,{title:"Exclude Memberships",description:"Exclude memberships from download limitations.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_limit_member_exclude",l.jsx(Z,{id:"somdn_pro_limit_member_exclude",label:"Exclude Memberships from Limitations",description:"When enabled, you can select which memberships are excluded from limitations in the Membership Plans page.",disabled:!e}))]},"exclude-memberships"):null,n?l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_limit_refresh_on_subscribe",l.jsx(W,{title:"Refresh on Subscribe Date",description:"Refresh download limits on the customer's subscription date.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_limit_refresh_on_subscribe",l.jsx(Z,{id:"somdn_pro_limit_refresh_on_subscribe_date",label:"Refresh on Subscribed Date",description:"If enabled, the download limits will refresh on the customer's subscription date.",disabled:!e}))]},"refresh-on-subscribe"):null]}),l.jsxs("div",{className:"rounded-md bg-blue-50 p-4 dark:bg-blue-900/20 mt-6",children:[l.jsx("h4",{className:"text-sm font-medium text-blue-800 dark:text-blue-300 mb-3",children:"Notes on Priority"}),l.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-400 mb-2",children:"Download limit priority is as follows:"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-blue-700 dark:text-blue-400 mb-3",children:[l.jsx("li",{children:"User Account"}),l.jsx("li",{children:"Membership Plan"}),l.jsx("li",{children:"User Role"}),l.jsx("li",{children:"Global Setting"})]}),l.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-400",children:"Any rule that excludes a specific user from any download limits will always take priority. For example: If the user has specific download limits tied to their profile, but they have a user role that has excluded download limits, then the user will have no download limits."})]})]})}const tf=[{fieldId:"somdn_pro_basic_limit_enable",label:"Enable Download Limitations",help:"Enable or disable download limits for your site.",sectionKey:"download-limits",pluginSlug:Ze,keywords:["limit","enable","disable","download","pro"]},{fieldId:"somdn_pro_basic_limit_type",label:"Limit Downloads By",help:"Choose to limit downloads by User ID or IP Address.",sectionKey:"download-limits",pluginSlug:Ze,keywords:["limit","type","user","id","ip","address","pro"]},{fieldId:"somdn_pro_basic_login_req",label:"Login Required",help:"Configure login requirements for download limits.",sectionKey:"download-limits",pluginSlug:Ze,keywords:["login","required","limit","user","pro"]},{fieldId:"somdn_pro_basic_limit_freq",label:"Download Limit Period",help:"Set the time period for download limits.",sectionKey:"download-limits",pluginSlug:Ze,keywords:["limit","period","frequency","day","week","month","year","pro"]},{fieldId:"somdn_pro_basic_limit_amount",label:"Number of Downloads",help:"Limit the number of times a download can be requested.",sectionKey:"download-limits",pluginSlug:Ze,keywords:["limit","number","downloads","amount","pro"]},{fieldId:"somdn_pro_basic_limit_products",label:"Number of Products",help:"Limit the number of different products that can be downloaded.",sectionKey:"download-limits",pluginSlug:Ze,keywords:["limit","number","products","pro"]},{fieldId:"somdn_pro_basic_limit_product_name",label:"Products Text",help:'Customize the "Products" text in download limits display.',sectionKey:"download-limits",pluginSlug:Ze,keywords:["limit","product","name","text","pro"]},{fieldId:"somdn_pro_exclude_months",label:"Exclude Months",help:"Number of months to exclude from counting for owned products.",sectionKey:"download-limits",pluginSlug:Ze,keywords:["exclude","months","owned","products","pro"]},{fieldId:"somdn_pro_exclude_cat_list",label:"Exclude Categories",help:"Products in selected categories will not be counted when downloaded.",sectionKey:"download-limits",pluginSlug:Ze,keywords:["exclude","categories","category","product","pro"]},{fieldId:"somdn_pro_basic_limit_error",label:"Error Message",help:"Customize the download limit reached error message.",sectionKey:"download-limits",pluginSlug:Ze,keywords:["error","message","limit","reached","pro"]},{fieldId:"somdn_pro_limit_acc_page",label:"Account Page Display",help:"Show customer download limits on their account page.",sectionKey:"download-limits",pluginSlug:Ze,keywords:["account","page","display","limits","pro"]},{fieldId:"somdn_pro_limit_acc_page_title_enable",label:"Show Section Title",help:"Display a heading above the download limit section.",sectionKey:"download-limits",pluginSlug:Ze,keywords:["account","title","heading","section","pro"]},{fieldId:"somdn_pro_limit_acc_page_title",label:"Section Title",help:"Customize the section title heading.",sectionKey:"download-limits",pluginSlug:Ze,keywords:["account","title","text","heading","pro"]},{fieldId:"somdn_pro_limit_acc_page_message",label:"Section Message",help:"Add text below the free download limits section title.",sectionKey:"download-limits",pluginSlug:Ze,keywords:["account","message","text","section","pro"]},{fieldId:"somdn_pro_limit_member_exclude",label:"Exclude Memberships",help:"Exclude memberships from download limitations.",sectionKey:"download-limits",pluginSlug:Ze,keywords:["membership","exclude","limit","pro"]},{fieldId:"somdn_pro_limit_refresh_on_subscribe_date",label:"Refresh on Subscribe Date",help:"Refresh download limits on subscription date.",sectionKey:"download-limits",pluginSlug:Ze,keywords:["membership","refresh","subscribe","date","limit","pro"]}],Av=Object.freeze(Object.defineProperty({__proto__:null,DownloadLimitsSettings:ef,downloadLimitsDefaults:Zh,downloadLimitsSettingsIndex:tf,membershipLimitsDefaults:Jh},Symbol.toStringTag,{value:"Module"})),Oe="free-downloads-woocommerce",Fv=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.is_pro)||!1},nf={somdn_pro_track_enable:!1,somdn_capture_email_enable:!1,somdn_capture_email_remember:!1,somdn_capture_email_remember_time:"30",somdn_capture_email_users_enable:!1,somdn_capture_email_subscribe:"0",somdn_capture_email_title:"",somdn_capture_email_placeholder:"",somdn_capture_email_error_none:"",somdn_capture_email_error_invalid:"",somdn_capture_email_title_bg:"#2679ce",somdn_capture_email_title_colour:"#ffffff",somdn_capture_email_body:"",somdn_capture_email_button:"",somdn_download_history_enable:!1,somdn_download_history_hide_purchase:!1,somdn_download_history_title_enable:!1,somdn_download_history_title:"",somdn_download_history_message:"",somdn_download_no_results_text:"",somdn_download_history_button:""};function sf(){var i;const e=Fv(),t=be({somdn_pro_track_enable:!0}),n=be({somdn_pro_track_enable:!0,somdn_capture_email_enable:!0}),s=be({somdn_pro_track_enable:!0}),r=be({somdn_pro_track_enable:!0,somdn_capture_email_enable:!0,somdn_capture_email_remember:!0}),o=be({somdn_pro_track_enable:!0,somdn_download_history_enable:!0});return l.jsxs("section",{className:"space-y-6",id:"tracking",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Tracking & Email Capture"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Create a detailed record each time a free download is made, capture guest emails, and display download history on user accounts."}),l.jsx("p",{className:"pb-2 text-sm text-neutral-500 dark:text-neutral-400",children:l.jsxs("em",{children:["Note: Tracking is automatically enabled when ",l.jsx(gt,{settingId:"somdn_pro_basic_limit_enable",children:"download limitations"})," are active."]})}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_track_enable",l.jsx(W,{title:"Track Free Downloads",description:"Enable detailed free download tracking to monitor and analyze downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_track_enable",l.jsx(Z,{id:"somdn_pro_track_enable",label:"Enable Detailed Free Download Tracking",description:"When enabled, a detailed record is created each time a free download is made.",help:"<p><strong>Tip:</strong> Click 'View download records' link to see all tracked downloads after enabling.</p>",disabled:!e}))]}),l.jsx(Qe,{showIf:{somdn_pro_track_enable:!0}}),l.jsxs(Xe,{showIf:{somdn_pro_track_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Email Capture"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Capture email addresses from guest users before allowing downloads."})]}),s&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_capture_email_enable",l.jsx(W,{title:"Capture Emails",description:"Ask guest users for their email address before downloading.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_capture_email_enable",l.jsx(Z,{id:"somdn_capture_email_enable",label:"Capture Emails",description:"Ask guest users for their email address before downloading.",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_capture_email_remember",l.jsx(W,{title:"Remember Guest Email",description:"Remember the email address of guests for a set period of time using cookies.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_capture_email_remember",l.jsx(Z,{id:"somdn_capture_email_remember",label:"Remember Guest Email Address",description:"Remember the email address of guests for a set period of time. It will set a cookie in the browser and check this, if set it will allow the download without having to add the email again.",disabled:!e}))]}),r&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_capture_email_remember_time",l.jsx(W,{title:"Remember Duration",description:"Set the number of days to remember the email address (cookie expiry time).",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_capture_email_remember_time",l.jsx(X,{id:"somdn_capture_email_remember_time",label:"Days to Remember",description:"Set the number of days to remember the email address (cookie expiry time).",type:"number",min:1,max:365,placeholder:"30",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_capture_email_users_enable",l.jsx(W,{title:"Show for Registered Users",description:"Show the email capture window for registered users as well as guests.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_capture_email_users_enable",l.jsx(Z,{id:"somdn_capture_email_users_enable",label:"Show for Registered Users",description:"Show the email capture window for registered users. The email address field will be pre-filled for registered users.",disabled:!e}))]}),l.jsx(Qe,{showIf:{somdn_pro_track_enable:!0,somdn_capture_email_enable:!0}}),l.jsxs(Xe,{showIf:{somdn_pro_track_enable:!0,somdn_capture_email_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Newsletter Subscription"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Optionally subscribe users to your newsletter when capturing emails."})]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_capture_email_subscribe",l.jsx(W,{title:"Newsletter Subscription",description:"Choose if you want to subscribe users to your newsletter when they download.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_capture_email_subscribe",l.jsx(ft,{id:"somdn_capture_email_subscribe",label:"Newsletter Subscription Option",description:l.jsxs(l.Fragment,{children:["Choose if you want to subscribe users to your newsletter. Configure newsletter settings on the ",l.jsx(gt,{settingId:"newsletter",children:"Newsletter page"}),"."]}),help:"<p><strong>Manual:</strong> If you just want to take extra information like first name etc without a 3rd party newsletter service. Then you can customise the fields on the Newsletter page.</p>",options:Array.isArray((i=window.somdn_settings)==null?void 0:i.newsletter_subscribe_options)&&window.somdn_settings.newsletter_subscribe_options.length>0?window.somdn_settings.newsletter_subscribe_options:[{label:"— None —",value:"0"},{label:"Manual",value:"manual"},{label:"MailChimp",value:"mailchimp"}],disabled:!e}))]}),l.jsx(Qe,{showIf:{somdn_pro_track_enable:!0,somdn_capture_email_enable:!0}}),l.jsxs(Xe,{showIf:{somdn_pro_track_enable:!0,somdn_capture_email_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Email Capture Box Customization"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Customize the appearance of the email capture popup box."})]}),n&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_capture_email_title",l.jsx(W,{title:"Box Title",description:"Customize the title text shown in the email capture popup.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_capture_email_title",l.jsx(X,{id:"somdn_capture_email_title",label:"Box Title",description:"Customize the capture email box title.",help:"<p><strong>Default:</strong> Download FREE!</p>",placeholder:"Download FREE!",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_capture_email_placeholder",l.jsx(W,{title:"Email Placeholder",description:"Customize the email input field placeholder text.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_capture_email_placeholder",l.jsx(X,{id:"somdn_capture_email_placeholder",label:"Email Placeholder",description:"Customize the email address input field placeholder.",help:"<p><strong>Default:</strong> Email address...</p>",placeholder:"Email address...",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_capture_email_error_none",l.jsx(W,{title:"No Email Error",description:"Customize the error message when no email is entered.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_capture_email_error_none",l.jsx(X,{id:"somdn_capture_email_error_none",label:"Error Message - No Email",description:"Customize the error message if no email address is entered.",help:"<p><strong>Default:</strong> Please enter your email address</p>",placeholder:"Please enter your email address",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_capture_email_error_invalid",l.jsx(W,{title:"Invalid Email Error",description:"Customize the error message when an invalid email is entered.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_capture_email_error_invalid",l.jsx(X,{id:"somdn_capture_email_error_invalid",label:"Error Message - Invalid Email",description:"Customize the error message if an invalid email address is entered.",help:"<p><strong>Default:</strong> Please enter a valid email address</p>",placeholder:"Please enter a valid email address",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_capture_email_title_bg",l.jsx(W,{title:"Title Background Color",description:"Customize the background color of the popup title bar.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_capture_email_title_bg",l.jsx($o,{id:"somdn_capture_email_title_bg",label:"Title Background Color",description:"Customize the background color of the popup title bar.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_capture_email_title_colour",l.jsx(W,{title:"Title Font Color",description:"Customize the font color of the popup title.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_capture_email_title_colour",l.jsx($o,{id:"somdn_capture_email_title_colour",label:"Title Font Color",description:"Customize the font color of the popup title.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_capture_email_body",l.jsx(W,{title:"Box Text",description:"Customize the capture email message text.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_capture_email_body",l.jsx(jt,{id:"somdn_capture_email_body",label:"Box Text",description:"Customize the capture email message. Use {product} to include the product name.",help:"<p><strong>Default:</strong> To download (product title) today just enter your email address!</p>",rows:3,disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_capture_email_button",l.jsx(W,{title:"Button Text",description:"Customize the download button text in the email capture popup.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_capture_email_button",l.jsx(X,{id:"somdn_capture_email_button",label:"Button Text",description:"Customize the download button text.",help:"<p><strong>Default:</strong> Submit & Download</p>",placeholder:"Submit & Download",disabled:!e}))]})]}),l.jsx(Qe,{showIf:{somdn_pro_track_enable:!0}}),l.jsxs(Xe,{showIf:{somdn_pro_track_enable:!0},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Download History"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Show free download history on customer account pages."})]}),t&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_history_enable",l.jsx(W,{title:"Download History",description:"Show free download history on user account page.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_history_enable",l.jsx(Z,{id:"somdn_download_history_enable",label:"Show Free Download History",description:"Show free download history on user account page. Displays in the downloads section of the [woocommerce_my_account] shortcode.",help:"<p>Only includes products the user has already downloaded for free and is still eligible to download.</p>",disabled:!e}))]}),o&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_history_hide_purchase",l.jsx(W,{title:"Hide Purchased Downloads",description:"Hide purchased downloads section from account page when user has no purchased downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_history_hide_purchase",l.jsx(Z,{id:"somdn_download_history_hide_purchase",label:"Hide Purchased Downloads Section",description:"Hide purchased downloads section from account page if the user has no purchased downloads.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_history_title_enable",l.jsx(W,{title:"Section Title",description:"Display a heading above the download history section.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_history_title_enable",l.jsx(Z,{id:"somdn_download_history_title_enable",label:"Show Section Title Heading",description:"Displays a heading above the download history list.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_history_title",l.jsx(W,{title:"Section Title Text",description:"Customize the section title heading text.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_history_title",l.jsx(X,{id:"somdn_download_history_title",label:"Section Title",description:"Customize the section title heading.",help:"<p><strong>Default:</strong> Free Downloads</p>",placeholder:"Free Downloads",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_history_message",l.jsx(W,{title:"Section Message",description:"Include a short section of text below the free downloads section title.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_history_message",l.jsx(jt,{id:"somdn_download_history_message",label:"Section Message",description:"Include a short section of text below the free downloads section title.",rows:3,disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_no_results_text",l.jsx(W,{title:"No Downloads Text",description:"Add text that appears when the user has no free downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_no_results_text",l.jsx(jt,{id:"somdn_download_no_results_text",label:"No Downloads Text",description:"Add some text that will appear when they have no free downloads.",rows:3,disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_history_button",l.jsx(W,{title:"Download Button Text",description:"Customize the download button text in the history list.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_history_button",l.jsx(X,{id:"somdn_download_history_button",label:"Button Text",description:"Customize the download button text.",help:"<p><strong>Default:</strong> Download</p>",placeholder:"Download",disabled:!e}))]})]})]})}const rf=[{fieldId:"somdn_pro_track_enable",label:"Enable Download Tracking",help:"Enable detailed free download tracking.",sectionKey:"tracking",pluginSlug:Oe,keywords:["track","tracking","downloads","enable","pro"]},{fieldId:"somdn_capture_email_enable",label:"Capture Emails",help:"Ask guest users for their email address before downloading.",sectionKey:"tracking",pluginSlug:Oe,keywords:["email","capture","guest","pro"]},{fieldId:"somdn_capture_email_remember",label:"Remember Guest Email",help:"Remember the email address of guests using cookies.",sectionKey:"tracking",pluginSlug:Oe,keywords:["email","remember","guest","cookie","pro"]},{fieldId:"somdn_capture_email_remember_time",label:"Remember Duration",help:"Number of days to remember the guest email address.",sectionKey:"tracking",pluginSlug:Oe,keywords:["email","remember","days","duration","pro"]},{fieldId:"somdn_capture_email_users_enable",label:"Show for Registered Users",help:"Show email capture for registered users.",sectionKey:"tracking",pluginSlug:Oe,keywords:["email","capture","registered","users","pro"]},{fieldId:"somdn_capture_email_subscribe",label:"Newsletter Subscription",help:"Subscribe users to newsletter when capturing email.",sectionKey:"tracking",pluginSlug:Oe,keywords:["newsletter","subscribe","mailchimp","email","pro"]},{fieldId:"somdn_capture_email_title",label:"Box Title",help:"Customize the email capture box title.",sectionKey:"tracking",pluginSlug:Oe,keywords:["email","capture","title","box","pro"]},{fieldId:"somdn_capture_email_placeholder",label:"Email Placeholder",help:"Customize the email input placeholder text.",sectionKey:"tracking",pluginSlug:Oe,keywords:["email","placeholder","input","pro"]},{fieldId:"somdn_capture_email_error_none",label:"No Email Error Message",help:"Error message when no email is entered.",sectionKey:"tracking",pluginSlug:Oe,keywords:["email","error","message","validation","pro"]},{fieldId:"somdn_capture_email_error_invalid",label:"Invalid Email Error Message",help:"Error message when invalid email is entered.",sectionKey:"tracking",pluginSlug:Oe,keywords:["email","error","message","invalid","validation","pro"]},{fieldId:"somdn_capture_email_title_bg",label:"Title Background Color",help:"Background color for the popup title bar.",sectionKey:"tracking",pluginSlug:Oe,keywords:["email","capture","color","background","title","pro"]},{fieldId:"somdn_capture_email_title_colour",label:"Title Font Color",help:"Font color for the popup title.",sectionKey:"tracking",pluginSlug:Oe,keywords:["email","capture","color","font","title","pro"]},{fieldId:"somdn_capture_email_body",label:"Box Text",help:"Customize the email capture popup message.",sectionKey:"tracking",pluginSlug:Oe,keywords:["email","capture","body","text","message","pro"]},{fieldId:"somdn_capture_email_button",label:"Submit Button Text",help:"Customize the submit button text.",sectionKey:"tracking",pluginSlug:Oe,keywords:["email","capture","button","submit","pro"]},{fieldId:"somdn_download_history_enable",label:"Download History",help:"Show free download history on account page.",sectionKey:"tracking",pluginSlug:Oe,keywords:["download","history","account","pro"]},{fieldId:"somdn_download_history_hide_purchase",label:"Hide Purchased Downloads",help:"Hide purchased downloads section when empty.",sectionKey:"tracking",pluginSlug:Oe,keywords:["download","history","hide","purchased","pro"]},{fieldId:"somdn_download_history_title_enable",label:"History Section Title",help:"Show section title heading.",sectionKey:"tracking",pluginSlug:Oe,keywords:["download","history","title","heading","pro"]},{fieldId:"somdn_download_history_title",label:"Section Title Text",help:"Customize the section title text.",sectionKey:"tracking",pluginSlug:Oe,keywords:["download","history","title","text","pro"]},{fieldId:"somdn_download_history_message",label:"Section Message",help:"Text below the section title.",sectionKey:"tracking",pluginSlug:Oe,keywords:["download","history","message","text","pro"]},{fieldId:"somdn_download_no_results_text",label:"No Downloads Text",help:"Text shown when user has no free downloads.",sectionKey:"tracking",pluginSlug:Oe,keywords:["download","history","no","results","empty","pro"]},{fieldId:"somdn_download_history_button",label:"Download Button Text",help:"Customize the download button text.",sectionKey:"tracking",pluginSlug:Oe,keywords:["download","history","button","text","pro"]}],zv=Object.freeze(Object.defineProperty({__proto__:null,TrackingSettings:sf,trackingDefaults:nf,trackingSettingsIndex:rf},Symbol.toStringTag,{value:"Module"}));function xl({id:e,label:t,description:n,options:s=[],value:r,onChange:o,help:i,type:a="normal",name:d,cols:c,showIf:u,resetOnHide:h,mountWhenHidden:m=!0,className:f,...g}){const{values:b,setValue:x}=it(),w=be(u),_=p.useRef(w),y=!!e,v=y?b==null?void 0:b[e]:void 0,j=r!==void 0,k=p.useMemo(()=>{var C,F;return r??v??((C=s==null?void 0:s[0])==null?void 0:C.value)??((F=s==null?void 0:s[0])==null?void 0:F.label)??""},[]),[M,N]=p.useState(k),T=j?r:y?v??"":M,P=p.useMemo(()=>d||(t?t.replace(/\s+/g,"-").toLowerCase():"radio-group"),[d,t]),E=C=>C.value??C.label,D=C=>{!j&&y&&x(e,C),!y&&!j&&N(C),o==null||o(C)};if(p.useEffect(()=>{if(_.current&&!w&&h!==void 0){const C=h===!0?void 0:h;y?x(e,C):j||N(C??"")}_.current=w},[w,h,y,e,x,j]),!m&&u&&!w)return null;const z=!w&&m,R=()=>{const C=c||3;return l.jsx("div",{className:"gap-4",style:{display:"grid",gridTemplateColumns:`repeat(${C}, minmax(0, 1fr))`},children:s.map(F=>{const U=E(F),H=`${P}-image-${U}`,L=T===U;return l.jsxs("label",{htmlFor:H,"aria-label":F.label||"image",title:F.label||"image",className:`group flex flex-col items-center justify-center border rounded-md p-2 cursor-pointer transition
                ${L?"border-indigo-600 bg-indigo-50 dark:border-indigo-500 dark:bg-neutral-900":"border-gray-200 dark:border-neutral-700 dark:bg-neutral-900"}
                hover:border-indigo-400 dark:hover:border-indigo-400`,onClick:$=>{z||F.disabled||$.target.tagName!=="INPUT"&&($.preventDefault(),D(U))},children:[l.jsx("input",{id:H,type:"radio",name:P,value:U,checked:L,onChange:()=>D(U),disabled:z||F.disabled,className:"de-hide-input"}),F.image&&l.jsx("img",{src:F.image,alt:F.label||"image",className:`rounded border ${L?"border-indigo-600 dark:border-indigo-500":"border-gray-200 dark:border-neutral-700"}`,style:{width:48,height:48,objectFit:"cover"}}),F.label&&l.jsx("span",{className:`text-sm mt-2 font-medium ${L?"text-indigo-700 dark:text-indigo-400":"text-gray-900 dark:text-white"}`,children:F.label}),F.description&&l.jsx("span",{className:"block text-xs text-gray-500 dark:text-neutral-400 text-center mt-1",children:F.description})]},H)})})},O=()=>l.jsx("div",{className:"space-y-5",children:s.map(C=>{const F=E(C),U=`${P}-normal-${F}`,H=T===F;return l.jsxs("div",{className:"relative flex items-start",children:[l.jsx("div",{className:"flex h-6 items-center",children:l.jsx("input",{id:U,name:P,type:"radio",value:F,checked:H,onChange:()=>D(F),disabled:z||C.disabled,"aria-describedby":C.description?`${U}-desc`:void 0,className:"relative size-4 appearance-none rounded-full border border-gray-300 bg-white before:absolute before:inset-1 before:rounded-full before:bg-white checked:border-indigo-600 checked:bg-indigo-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 disabled:border-gray-300 disabled:bg-gray-100 disabled:before:bg-gray-400 dark:border-neutral-700 dark:bg-neutral-900 dark:checked:border-indigo-500 dark:checked:bg-indigo-500 dark:disabled:border-neutral-700 dark:disabled:bg-neutral-800 forced-colors:appearance-auto forced-colors:before:hidden [&:not(:checked)]:before:hidden"})}),l.jsxs("div",{className:"ml-3 text-sm/6",children:[l.jsx("label",{htmlFor:U,className:"font-medium text-gray-900 dark:text-white cursor-pointer",children:C.label}),C.description&&l.jsx("p",{id:`${U}-desc`,className:"text-gray-500 dark:text-neutral-400",children:C.description})]})]},U)})}),A=()=>{const C=c||6;return l.jsx("div",{className:"mt-2 gap-3",style:{display:"grid",gridTemplateColumns:`repeat(${C}, minmax(0, 1fr))`},children:s.map(F=>{const U=E(F),H=`${P}-button-${U}`,L=T===U;return l.jsxs("label",{htmlFor:H,"aria-label":F.label,title:F.label,className:"group relative flex items-center justify-center rounded-md border border-gray-300 bg-white px-3 py-2.5 has-[:checked]:border-indigo-600 has-[:checked]:bg-indigo-600 has-[:disabled]:opacity-25 has-[:focus-visible]:outline has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-indigo-600 cursor-pointer dark:border-neutral-700 dark:bg-neutral-900 dark:has-[:checked]:border-indigo-500 dark:has-[:checked]:bg-indigo-500",onClick:$=>{z||F.disabled||$.target.tagName!=="INPUT"&&($.preventDefault(),D(U))},children:[l.jsx("input",{id:H,type:"radio",name:P,value:U,checked:L,onChange:()=>D(U),disabled:z||F.disabled,className:"de-hide-input absolute inset-0 appearance-none focus:outline focus:outline-0 disabled:cursor-not-allowed"}),l.jsx("span",{className:"text-sm font-semibold uppercase group-has-[:checked]:text-white dark:group-has-[:checked]:text-white",children:F.label})]},H)})})},B=()=>{const C=c||1;return l.jsx("div",{className:"gap-3",style:{display:"grid",gridTemplateColumns:`repeat(${C}, minmax(0, 1fr))`},children:s.map(F=>{const U=E(F),H=`${P}-list-${U}`,L=T===U;return l.jsxs("label",{htmlFor:H,"aria-label":F.label,"aria-description":F.description,title:F.label,className:"group flex border border-gray-200 p-4 first:rounded-tl-md first:rounded-tr-md last:rounded-bl-md last:rounded-br-md focus:outline-none has-[:checked]:relative has-[:checked]:border-indigo-200 has-[:checked]:bg-indigo-50 cursor-pointer dark:border-neutral-700 dark:bg-neutral-900 dark:has-[:checked]:border-indigo-500 dark:has-[:checked]:bg-indigo-950",onClick:$=>{z||F.disabled||$.target.tagName!=="INPUT"&&($.preventDefault(),D(U))},children:[l.jsx("input",{id:H,type:"radio",name:P,value:U,checked:L,onChange:()=>D(U),disabled:z||F.disabled,className:"de-hide-input relative mt-0.5 size-4 shrink-0 appearance-none rounded-full border border-gray-300 bg-white before:absolute before:inset-1 before:rounded-full before:bg-white checked:border-indigo-600 checked:bg-indigo-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 disabled:border-gray-300 disabled:bg-gray-100 disabled:before:bg-gray-400 dark:border-neutral-700 dark:bg-neutral-900 dark:checked:border-indigo-500 dark:checked:bg-indigo-500 dark:disabled:border-neutral-700 dark:disabled:bg-neutral-800 forced-colors:appearance-auto forced-colors:before:hidden [&:not(:checked)]:before:hidden"}),l.jsxs("span",{className:"ml-3 flex flex-col",children:[l.jsx("span",{className:"block text-sm font-medium text-gray-900 group-has-[:checked]:text-indigo-900 dark:text-white dark:group-has-[:checked]:text-indigo-300",children:F.label}),F.description&&l.jsx("span",{className:"block text-sm text-gray-500 group-has-[:checked]:text-indigo-700 dark:text-neutral-400 dark:group-has-[:checked]:text-indigo-400",children:F.description})]})]},H)})})};return l.jsxs(mn,{hidden:u&&!w,"aria-hidden":u&&!w,className:f,...g,children:[l.jsx("div",{className:"flex items-center gap-2 mb-2",children:t&&l.jsxs(pn,{children:[t,l.jsx(bn,{label:t,help:i})]})}),n&&l.jsx(gn,{children:n}),a==="image"?R():a==="button"?A():a==="list"?B():O()]})}const Wv=100,of=new Map,Yo=new Map;function wl({label:e,description:t,postType:n="post",value:s,onChange:r,help:o,id:i,showIf:a,resetOnHide:d,mountWhenHidden:c=!0,className:u,...h}){const{values:m,setValue:f}=it(),g=be(a),b=p.useRef(g),[x,w]=p.useState([]),[_,y]=p.useState(!1),[v,j]=p.useState(null),k=i?m==null?void 0:m[i]:void 0,M=s!==void 0,N=M?s:k,T=i||`${n}-select`,P=()=>typeof window>"u"?"":window.location.origin+window.location.pathname.replace(/\/wp-admin.*/,"");p.useEffect(()=>{let O=!1;if(!n)return;j(null);const A=typeof window<"u"?window.wpeSettingsPostListFallback:null;if(!A||!A.url||!A.action||!A.nonce){j("Post list not configured"),w([]);return}const B=of.get(n);if(B){w(B);return}async function C(){let U=[],H=1,L=1;const $=new URLSearchParams({action:A.action,nonce:A.nonce,post_type:n,per_page:String(Wv)});do{$.set("page",String(H));const Q=await fetch(`${A.url}?${$}`,{credentials:"same-origin"}),V=await Q.text();let K={};try{K=V?JSON.parse(V):{}}catch{}const te=Array.isArray(K)?K:K.data||[];L=parseInt(Q.headers.get("X-WP-TotalPages")||"1",10)||1,U=U.concat(te),H+=1}while(H<=L);const J=new Set,ne=[];for(const Q of U)J.has(Q.id)||(ne.push(Q),J.add(Q.id));return ne.sort((Q,V)=>{var K,te;return(((K=Q==null?void 0:Q.title)==null?void 0:K.rendered)||"").localeCompare(((te=V==null?void 0:V.title)==null?void 0:te.rendered)||"",void 0,{sensitivity:"base"})}),ne}let F=Yo.get(n);return F||(F=C(),Yo.set(n,F)),y(!0),F.then(U=>{O||(of.set(n,U),Yo.delete(n),w(U))}).catch(U=>{O||(Yo.delete(n),j(U.message||"Failed to load posts"),w([]))}).finally(()=>{O||y(!1)}),()=>{O=!0}},[n]);const E=p.useMemo(()=>N&&x.find(O=>{var A,B;return(O==null?void 0:O.id)===N||(O==null?void 0:O.slug)===N||((A=O==null?void 0:O.id)==null?void 0:A.toString())===String(N)||((B=O==null?void 0:O.slug)==null?void 0:B.toString())===String(N)})||null,[x,N]);if(p.useEffect(()=>{b.current&&!g&&d!==void 0&&i&&f(i,d===!0?void 0:d),b.current=g},[g,d,i,f]),!c&&a&&!g)return null;const D=!g&&c,z=p.useMemo(()=>E?`${P()}/wp-admin/post.php?post=${E.id}&action=edit`:null,[E]),R=O=>{!M&&i&&f(i,O),r==null||r(O)};return l.jsxs(mn,{hidden:a&&!g,"aria-hidden":a&&!g,className:u,...h,children:[l.jsx("div",{className:"flex items-center gap-2 mb-2",children:e&&l.jsxs(pn,{htmlFor:T,children:[e,l.jsx(bn,{label:e,help:o})]})}),t&&l.jsx(gn,{children:t}),l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsx("div",{className:"flex-1",children:l.jsx(Kh,{as:"div",id:T,name:n,options:x,displayValue:O=>{var A;return((A=O==null?void 0:O.title)==null?void 0:A.rendered)||""},value:E,onChange:O=>R((O==null?void 0:O.id)??(O==null?void 0:O.slug)??""),placeholder:_?"Loading…":"Search…",disabled:D||_||x.length===0,children:O=>{var A;return l.jsx(Gh,{value:O,children:l.jsx(Xh,{children:((A=O==null?void 0:O.title)==null?void 0:A.rendered)||"(no title)"})},O.id||O.slug)}})}),E&&z&&l.jsx("a",{href:z,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-3 py-1.5 rounded bg-neutral-200 text-neutral-900 text-xs font-semibold hover:bg-indigo-600 hover:text-white transition dark:bg-neutral-800 dark:text-white dark:hover:bg-indigo-700",title:"Edit post",style:{whiteSpace:"nowrap"},children:"Edit"})]}),_&&l.jsx("div",{className:"text-xs text-gray-500 mt-2",children:"Loading…"}),v&&l.jsx("div",{className:"text-xs text-red-500 mt-2",children:v}),!_&&!v&&l.jsxs("div",{className:"text-xs text-gray-400 mt-2",children:[x.length," posts loaded."]})]})}const Nt="free-downloads-woocommerce",Bv=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.is_pro)||!1},af={somdn_download_type_option:"0",somdn_download_type_redirect_page:"",somdn_download_type_redirect_time:"5",somdn_download_type_redirect_message:"",somdn_download_type_redirect_text:"",somdn_download_type_email_page:"",somdn_download_type_email_page_message:"",somdn_download_type_email_expire_time:"24",somdn_download_type_email_expire_used:!1,somdn_download_type_email_expire_message:"",somdn_download_type_email_used_message:""};function lf(){const e=Bv(),t=be({somdn_download_type_option:["1","2"]}),n=be({somdn_download_type_option:"2"}),s=be({somdn_download_type_option:"2",somdn_download_type_email_expire_used:!0});return l.jsxs("section",{className:"space-y-6",id:"download-delivery",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Download Delivery"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Choose how free downloads are delivered: instant download, redirect to a confirmation page, or email a download link."}),l.jsx("p",{className:"pb-2 text-sm text-neutral-500 dark:text-neutral-400",children:l.jsx("em",{children:"Note: This is separate from your WooCommerce File Download Method setting."})}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_type_option",l.jsx(W,{title:"Delivery Type",description:"Choose how downloads are delivered to users - instant download, redirect to confirmation page, or email link.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_type_option",l.jsx(xl,{id:"somdn_download_type_option",label:"Download Delivery Method",description:"Select how files should be delivered when users request a free download.",type:"list",cols:1,options:[{label:"Instant download (Default)",value:"0",description:"Files will be downloaded as soon as the download button is clicked, or when the email capture form is submitted.",disabled:!e},{label:"Redirect to confirmation page",value:"1",description:"Users will be redirected to a page of your choice and their download will start a few seconds later. A link to start the download will also show just in case.",disabled:!e},{label:"Email link then redirect to confirmation page",value:"2",description:"Users will be redirected to a page of your choice, and their download URL will be emailed to them.",disabled:!e}]})),l.jsxs("p",{className:"text-sm text-neutral-500 dark:text-neutral-400 mt-3 pr-20",children:[l.jsx("strong",{children:"Note:"}),' The "Email link" option requires ',l.jsx(gt,{settingId:"somdn_capture_email_enable",children:"Email Capture"})," to be enabled for guest downloads."]})]}),l.jsx(Qe,{showIf:{somdn_download_type_option:["1","2"]}}),l.jsxs(Xe,{showIf:{somdn_download_type_option:["1","2"]},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Redirect Page Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure the redirect behavior when users download files."})]}),t&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_type_redirect_page",l.jsx(W,{title:"Redirect Page",description:"Select which page to redirect users to after they request a download.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_type_redirect_page",l.jsx(wl,{id:"somdn_download_type_redirect_page",label:"Redirect Page",description:"This is the page users will be redirected to after submitting a download form. Select which page your [download_redirect] shortcode is on.",postType:"pages",disabled:!e}))]}),t&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_type_redirect_time",l.jsx(W,{title:"Redirect Time",description:"Set the number of seconds before the download starts automatically on the redirect page.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_type_redirect_time",l.jsx(X,{id:"somdn_download_type_redirect_time",label:"Redirect Time (seconds)",description:"The time in seconds before the download starts automatically on the redirect page.",help:"<p><strong>Default:</strong> 5 seconds</p><p><strong>Max:</strong> 60 seconds</p>",type:"number",min:1,max:60,placeholder:"5",disabled:!e}))]}),t&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_type_redirect_message",l.jsx(W,{title:"Page Text",description:"Customize the message displayed on the confirmation page.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_type_redirect_message",l.jsx(jt,{id:"somdn_download_type_redirect_message",label:"Page Text",description:"Customize the message displayed on the confirmation page. Use {click_here} to show the download link. Use {time} to show the redirect time in seconds.",help:"<p><strong>Default:</strong> Your download should start automatically in {time} seconds. If it doesn't please {click_here}. Do not refresh this page.</p>",rows:4,disabled:!e}))]}),t&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_type_redirect_text",l.jsx(W,{title:"Click Here Text",description:"Customize the download link text that replaces {click_here} in the page message.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_type_redirect_text",l.jsx(X,{id:"somdn_download_type_redirect_text",label:"'Click Here' Text",description:"Customize the download link text.",help:"<p><strong>Default:</strong> click here</p>",placeholder:"click here",disabled:!e}))]}),l.jsx(Qe,{showIf:{somdn_download_type_option:"2"}}),l.jsxs(Xe,{showIf:{somdn_download_type_option:"2"},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Confirmation Page Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure the confirmation page when using email link delivery."})]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_type_email_page",l.jsx(W,{title:"Email Confirmation Page",description:"Select the page users will be redirected to after submitting the download form when using email delivery.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_type_email_page",l.jsx(wl,{id:"somdn_download_type_email_page",label:"Email Confirmation Page",description:"This is the page users will be redirected to after submitting a download form. Select which page your [download_redirect] shortcode is on.",postType:"pages",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_type_email_page_message",l.jsx(W,{title:"Page Text",description:"Customize the message displayed on the confirmation page for email delivery.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_type_email_page_message",l.jsx(jt,{id:"somdn_download_type_email_page_message",label:"Page Text",description:"Customize the message displayed on the confirmation page. Use {email} if you want to show the email address they used.",help:"<p><strong>Default:</strong> A link to download the file has been emailed to you, please check your inbox.</p>",rows:4,disabled:!e}))]}),l.jsx(Qe,{showIf:{somdn_download_type_option:"2"}}),l.jsxs(Xe,{showIf:{somdn_download_type_option:"2"},as:"fragment",children:[l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Email Link Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure email link expiry and usage settings."})]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_type_email_expire_time",l.jsx(W,{title:"Link Expiry Time",description:"Set how long the download URL remains valid.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_type_email_expire_time",l.jsx(X,{id:"somdn_download_type_email_expire_time",label:"Link Expiry Time (hours)",description:"Set how long (hours) the download URL remains valid. Values between 1 and 168 (168 hours = 7 days).",help:"<p><strong>Note:</strong> This is just the URL link expiry itself. Normal download checks are always made regardless.</p><p><strong>Default:</strong> 24 hours</p>",type:"number",min:1,max:168,placeholder:"24",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_type_email_expire_used",l.jsx(W,{title:"Expire When Used",description:"Choose whether email links should be expired once used.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_type_email_expire_used",l.jsx(Z,{id:"somdn_download_type_email_expire_used",label:"Expire When Used",description:"Whether or not email links should be expired once used.",disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_type_email_expire_message",l.jsx(W,{title:"Expired Link Message",description:"Customize the message displayed when a download link has expired.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_type_email_expire_message",l.jsx(X,{id:"somdn_download_type_email_expire_message",label:"Expired Link Message",description:"Customize the message displayed on a product page when a download link has expired.",help:"<p><strong>Default:</strong> Your download key has now expired, please try again.</p>",placeholder:"Your download key has now expired, please try again.",disabled:!e}))]}),s&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_download_type_email_used_message",l.jsx(W,{title:"Used Link Message",description:"Customize the message displayed when a download link has already been used.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_download_type_email_used_message",l.jsx(X,{id:"somdn_download_type_email_used_message",label:"Used Link Message",description:"Customize the message displayed on a product page when a download link has been used.",help:"<p><strong>Default:</strong> Your download key has already been used, please try again.</p>",placeholder:"Your download key has already been used, please try again.",disabled:!e}))]})]})}const df=[{fieldId:"somdn_download_type_option",label:"Download Delivery Method",help:"Choose how downloads are delivered - instant, redirect, or email link.",sectionKey:"download-delivery",pluginSlug:Nt,keywords:["download","delivery","type","instant","redirect","email","pro"]},{fieldId:"somdn_download_type_redirect_page",label:"Redirect Page",help:"Select the page users are redirected to after requesting download.",sectionKey:"download-delivery",pluginSlug:Nt,keywords:["redirect","page","confirmation","pro"]},{fieldId:"somdn_download_type_redirect_time",label:"Redirect Time",help:"Seconds before download starts automatically on redirect page.",sectionKey:"download-delivery",pluginSlug:Nt,keywords:["redirect","time","seconds","delay","pro"]},{fieldId:"somdn_download_type_redirect_message",label:"Redirect Page Text",help:"Customize the message on the confirmation page.",sectionKey:"download-delivery",pluginSlug:Nt,keywords:["redirect","message","text","confirmation","pro"]},{fieldId:"somdn_download_type_redirect_text",label:"Click Here Text",help:"Customize the download link text.",sectionKey:"download-delivery",pluginSlug:Nt,keywords:["redirect","click","link","text","pro"]},{fieldId:"somdn_download_type_email_page",label:"Email Confirmation Page",help:"Select the page for email link delivery confirmation.",sectionKey:"download-delivery",pluginSlug:Nt,keywords:["email","page","confirmation","pro"]},{fieldId:"somdn_download_type_email_page_message",label:"Email Page Text",help:"Customize the email confirmation page message.",sectionKey:"download-delivery",pluginSlug:Nt,keywords:["email","message","text","confirmation","pro"]},{fieldId:"somdn_download_type_email_expire_time",label:"Link Expiry Time",help:"How long email download links remain valid.",sectionKey:"download-delivery",pluginSlug:Nt,keywords:["email","expire","expiry","time","hours","pro"]},{fieldId:"somdn_download_type_email_expire_used",label:"Expire When Used",help:"Whether links expire after being used once.",sectionKey:"download-delivery",pluginSlug:Nt,keywords:["email","expire","used","single","use","pro"]},{fieldId:"somdn_download_type_email_expire_message",label:"Expired Link Message",help:"Message shown when download link has expired.",sectionKey:"download-delivery",pluginSlug:Nt,keywords:["email","expire","expired","message","pro"]},{fieldId:"somdn_download_type_email_used_message",label:"Used Link Message",help:"Message shown when download link has already been used.",sectionKey:"download-delivery",pluginSlug:Nt,keywords:["email","used","message","pro"]}],Hv=Object.freeze(Object.defineProperty({__proto__:null,DownloadDeliverySettings:lf,downloadDeliveryDefaults:af,downloadDeliverySettingsIndex:df},Symbol.toStringTag,{value:"Module"})),Ts="free-downloads-woocommerce",Vv=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.is_pro)||!1},cf={somdn_pro_include_product_setting:"",somdn_pro_include_product_list:[]},uf={somdn_pro_include_cat_setting:"",somdn_pro_include_cat_list:[]},hf={somdn_pro_include_tag_setting:"",somdn_pro_include_tag_list:[]},_l=[{label:"— None —",value:""},{label:"Included",value:"included"},{label:"Excluded",value:"excluded"}];function ff(){const e=Vv(),t=be({somdn_pro_include_product_setting:["included","excluded"]}),n=be({somdn_pro_include_cat_setting:["included","excluded"]}),s=be({somdn_pro_include_tag_setting:["included","excluded"]});return l.jsxs("section",{className:"space-y-6",id:"advanced-restrictions",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Advanced Product Restrictions"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Create lists of products, categories, or tags that are either included or excluded from free downloads. These restrictions work together - a product must pass all restriction checks to be available for free download."}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Product Restrictions"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Create a list of products that are either excluded from any free download, or a list of only the products that free downloading applies to."}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_include_product_setting",l.jsx(W,{title:"Product Restrictions",description:"Include or exclude specific products from free downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_include_product_setting",l.jsx(ft,{id:"somdn_pro_include_product_setting",label:"Product Restriction Type",description:"Only the selected products are included or excluded for free downloads.",options:_l,disabled:!e}))]}),t&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_include_product_list",l.jsx(W,{title:"Product Selection",description:"Select which products to include or exclude from free downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_include_product_list",l.jsx(wl,{id:"somdn_pro_include_product_list",label:"Select Products",description:"Search and select products to apply the restriction to.",postType:"product",multiple:!0,disabled:!e}))]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Category Restrictions"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Create a list of product categories that are either excluded from any free download, or a list of only the product categories that free downloading applies to."}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_include_cat_setting",l.jsx(W,{title:"Category Restrictions",description:"Include or exclude products in specific categories from free downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_include_cat_setting",l.jsx(ft,{id:"somdn_pro_include_cat_setting",label:"Category Restriction Type",description:"Only the products in selected categories are included or excluded for free downloads.",options:_l,disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_include_cat_list",l.jsx(W,{title:"Category Selection",description:"Select which product categories to include or exclude from free downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_include_cat_list",l.jsx(bl,{id:"somdn_pro_include_cat_list",label:"Select Categories",description:"Select product categories to apply the restriction to.",taxonomy:"product_cat",multiple:!0,disabled:!e}))]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Tag Restrictions"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Create a list of product tags that are either excluded from any free download, or a list of only the product tags that free downloading applies to."}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_include_tag_setting",l.jsx(W,{title:"Tag Restrictions",description:"Include or exclude products with specific tags from free downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_include_tag_setting",l.jsx(ft,{id:"somdn_pro_include_tag_setting",label:"Tag Restriction Type",description:"Only the products with selected tags are included or excluded for free downloads.",options:_l,disabled:!e}))]}),s&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_include_tag_list",l.jsx(W,{title:"Tag Selection",description:"Select which product tags to include or exclude from free downloads.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_include_tag_list",l.jsx(bl,{id:"somdn_pro_include_tag_list",label:"Select Tags",description:"Select product tags to apply the restriction to.",taxonomy:"product_tag",multiple:!0,disabled:!e}))]}),l.jsxs("div",{className:"rounded-md bg-blue-50 p-4 dark:bg-blue-900/20 mt-8",children:[l.jsx("h4",{className:"text-sm font-medium text-blue-800 dark:text-blue-300 mb-3",children:"How Restrictions Work"}),l.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-400 mb-3",children:"All restriction checks must pass for a product to be available for free download. The restrictions work together as follows:"}),l.jsxs("ul",{className:"list-disc list-inside space-y-1 text-sm text-blue-700 dark:text-blue-400",children:[l.jsxs("li",{children:[l.jsx("strong",{children:"Included:"})," Only selected items are available for free downloads."]}),l.jsxs("li",{children:[l.jsx("strong",{children:"Excluded:"})," Selected items are NOT available for free downloads."]}),l.jsxs("li",{children:[l.jsx("strong",{children:"None:"})," No restriction applied for that type."]})]}),l.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-400 mt-3",children:[l.jsx("strong",{children:"Example:"}),' If you set categories to "Included" and select "Music", and tags to "Excluded" with "Premium" selected, only products in the Music category that do NOT have the Premium tag will be available for free download.']})]}),l.jsxs("div",{className:"rounded-md bg-amber-50 p-4 dark:bg-amber-900/20 mt-4",children:[l.jsx("h4",{className:"text-sm font-medium text-amber-800 dark:text-amber-300 mb-2",children:"Note"}),l.jsxs("p",{className:"text-sm text-amber-700 dark:text-amber-400",children:["Product restrictions here will override the"," ",l.jsx(gt,{settingId:"somdn_indy_items",children:"Include Selected Products Only"})," and"," ",l.jsx(gt,{settingId:"somdn_indy_exclude_items",children:"Exclude Selected Products Only"})," ","options in General Settings. If you use product restrictions here, the general include/exclude settings will be disabled."]})]})]})}const mf=[{fieldId:"somdn_pro_include_product_setting",label:"Product Restriction Type",help:"Include or exclude specific products from free downloads.",sectionKey:"advanced-restrictions",pluginSlug:Ts,keywords:["product","restriction","include","exclude","advanced","pro"]},{fieldId:"somdn_pro_include_product_list",label:"Select Products",help:"Search and select products to apply the restriction to.",sectionKey:"advanced-restrictions",pluginSlug:Ts,keywords:["product","list","select","restriction","pro"]},{fieldId:"somdn_pro_include_cat_setting",label:"Category Restriction Type",help:"Include or exclude products in specific categories from free downloads.",sectionKey:"advanced-restrictions",pluginSlug:Ts,keywords:["category","restriction","include","exclude","advanced","pro"]},{fieldId:"somdn_pro_include_cat_list",label:"Select Categories",help:"Select product categories to apply the restriction to.",sectionKey:"advanced-restrictions",pluginSlug:Ts,keywords:["category","list","select","restriction","pro"]},{fieldId:"somdn_pro_include_tag_setting",label:"Tag Restriction Type",help:"Include or exclude products with specific tags from free downloads.",sectionKey:"advanced-restrictions",pluginSlug:Ts,keywords:["tag","restriction","include","exclude","advanced","pro"]},{fieldId:"somdn_pro_include_tag_list",label:"Select Tags",help:"Select product tags to apply the restriction to.",sectionKey:"advanced-restrictions",pluginSlug:Ts,keywords:["tag","list","select","restriction","pro"]}],Uv=Object.freeze(Object.defineProperty({__proto__:null,AdvancedRestrictionsSettings:ff,advancedRestrictionsDefaults:cf,advancedRestrictionsSettingsIndex:mf,categoryRestrictionsDefaults:uf,tagRestrictionsDefaults:hf},Symbol.toStringTag,{value:"Module"})),fe="free-downloads-woocommerce",Rv=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.is_pro)||!1},pf={somdn_newsletter_display_type:"0",somdn_newsletter_checkbox_error:"",somdn_newsletter_text:"",somdn_newsletter_fname_placeholder:"",somdn_newsletter_fname_error:"",somdn_newsletter_fname_email:!1,somdn_newsletter_lname:!1,somdn_newsletter_lname_placeholder:"",somdn_newsletter_lname_required:!1,somdn_newsletter_lname_error:"",somdn_newsletter_lname_email:!1,somdn_newsletter_tel:!1,somdn_newsletter_tel_placeholder:"",somdn_newsletter_tel_required:!1,somdn_newsletter_tel_error:"",somdn_newsletter_tel_email:!1,somdn_newsletter_company:!1,somdn_newsletter_company_placeholder:"",somdn_newsletter_company_required:!1,somdn_newsletter_company_error:"",somdn_newsletter_company_email:!1,somdn_newsletter_website:!1,somdn_newsletter_website_placeholder:"",somdn_newsletter_website_required:!1,somdn_newsletter_website_error:"",somdn_newsletter_website_email:!1,somdn_newsletter_confirmations:!1,somdn_newsletter_confirmations_errors:!1},gf={somdn_newsletter_mailchimp_api_key:"",somdn_newsletter_mailchimp_list_id:"",somdn_newsletter_mailchimp_doubleoptin:!1,somdn_newsletter_tags:""};function bf(){const e=Rv(),{values:t}=it(),n=be({somdn_newsletter_display_type:"3"}),s=be({somdn_newsletter_lname:!0}),r=be({somdn_newsletter_tel:!0}),o=be({somdn_newsletter_company:!0}),i=be({somdn_newsletter_website:!0}),a=t.somdn_capture_email_enable,d=t.somdn_capture_email_subscribe,c=a&&d&&d!=="0",u=d==="mailchimp";return c?l.jsxs("section",{className:"space-y-6",id:"newsletter",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Newsletter Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"General settings for subscribing users to your newsletter."}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Display Settings"}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_display_type",l.jsx(W,{title:"Display Type",description:"Choose how to let your users subscribe to your newsletter.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_display_type",l.jsx(ft,{id:"somdn_newsletter_display_type",label:"Display Type",description:"Choose how to let your users subscribe to your newsletter.",help:`<p><strong>Checkbox with Text:</strong> Default. The user has to tick a box to subscribe and you can display some text.</p>
                   <p><strong>Required Checkbox with Text:</strong> The user is required to tick a box to subscribe/download and you can display some text.</p>
                   <p><strong>Text Only:</strong> Add a short line of text above the download button in the email capture window.</p>
                   <p><strong>None:</strong> When the user clicks download they will be subscribed. You might want to change your email capture window text to let them know.</p>
                   <p><em>Essentially only "Checkbox with Text" allows the user the option to subscribe. The others are forced.</em></p>`,options:[{label:"Checkbox with Text",value:"0"},{label:"Required Checkbox with Text",value:"3"},{label:"Text Only",value:"1"},{label:"None",value:"2"}],disabled:!e}))]}),n&&l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_checkbox_error",l.jsx(W,{title:"Checkbox Error Message",description:"Customize the error message if the checkbox isn't selected.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_checkbox_error",l.jsx(X,{id:"somdn_newsletter_checkbox_error",label:"Checkbox Error Message",description:"Customize the error message if the checkbox isn't selected.",help:"<p><strong>Default:</strong> You must select the checkbox to download</p><p><strong>Note:</strong> Only applies if Display Type is 'Required Checkbox with Text'.</p>",placeholder:"You must select the checkbox to download",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_text",l.jsx(W,{title:"Newsletter Text",description:"Customize the 'Subscribe to our newsletter' text.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_text",l.jsx(X,{id:"somdn_newsletter_text",label:"Newsletter Text",description:"Customize the 'Subscribe to our newsletter' text.",help:"<p><strong>Default:</strong> Subscribe to our newsletter</p><p><strong>Note:</strong> Only applies to 'Checkbox with Text' and 'Text Only' display options.</p>",placeholder:"Subscribe to our newsletter",disabled:!e}))]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"First Name Field"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"First name is always required."}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_fname_placeholder",l.jsx(W,{title:"First Name Placeholder",description:"Customize the first name input field placeholder.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_fname_placeholder",l.jsx(X,{id:"somdn_newsletter_fname_placeholder",label:"First Name Placeholder",description:"Customize the first name input field placeholder.",help:"<p><strong>Default:</strong> Your first name...</p>",placeholder:"Your first name...",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_fname_error",l.jsx(W,{title:"First Name Error",description:"Customize the error message if no first name entered.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_fname_error",l.jsx(X,{id:"somdn_newsletter_fname_error",label:"First Name Error Message",description:"Customize the error message if no first name entered.",help:"<p><strong>Default:</strong> Please enter your first name</p>",placeholder:"Please enter your first name",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_fname_email",l.jsx(W,{title:"Add to Email Notification",description:"Add first name to admin email notification.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_fname_email",l.jsx(Z,{id:"somdn_newsletter_fname_email",label:"Add to Admin Email Notification",description:"Add first name to admin email notification.",disabled:!e}))]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Last Name Field"}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_lname",l.jsx(W,{title:"Last Name Field",description:"Ask for the user's last name.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_lname",l.jsx(Z,{id:"somdn_newsletter_lname",label:"Ask for Last Name",description:"Ask for the user's last name. Once enabled you can customise the last name field settings.",disabled:!e}))]}),s&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_lname_placeholder",l.jsx(W,{title:"Last Name Placeholder",description:"Customize the last name input field placeholder.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_lname_placeholder",l.jsx(X,{id:"somdn_newsletter_lname_placeholder",label:"Last Name Placeholder",description:"Customize the last name input field placeholder.",help:"<p><strong>Default:</strong> Your last name...</p>",placeholder:"Your last name...",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_lname_required",l.jsx(W,{title:"Make Last Name Required",description:"Make last name a required field.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_lname_required",l.jsx(Z,{id:"somdn_newsletter_lname_required",label:"Make Last Name Required",description:"Make last name a required field.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_lname_error",l.jsx(W,{title:"Last Name Error",description:"Customize the error message if no last name entered.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_lname_error",l.jsx(X,{id:"somdn_newsletter_lname_error",label:"Last Name Error Message",description:"Customize the error message if no last name entered.",help:"<p><strong>Default:</strong> Please enter your last name</p><p><strong>Note:</strong> Only applies if last name is required.</p>",placeholder:"Please enter your last name",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_lname_email",l.jsx(W,{title:"Add to Email Notification",description:"Add last name to admin email notification.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_lname_email",l.jsx(Z,{id:"somdn_newsletter_lname_email",label:"Add to Admin Email Notification",description:"Add last name to admin email notification.",disabled:!e}))]})]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Telephone Field"}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_tel",l.jsx(W,{title:"Telephone Field",description:"Ask for the user's telephone number.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_tel",l.jsx(Z,{id:"somdn_newsletter_tel",label:"Ask for Telephone Number",description:"Ask for the user's telephone number. Once enabled you can customise the telephone field settings.",disabled:!e}))]}),r&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_tel_placeholder",l.jsx(W,{title:"Telephone Placeholder",description:"Customize the telephone input field placeholder.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_tel_placeholder",l.jsx(X,{id:"somdn_newsletter_tel_placeholder",label:"Telephone Placeholder",description:"Customize the telephone input field placeholder.",help:"<p><strong>Default:</strong> Your telephone number...</p>",placeholder:"Your telephone number...",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_tel_required",l.jsx(W,{title:"Make Telephone Required",description:"Make telephone number a required field.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_tel_required",l.jsx(Z,{id:"somdn_newsletter_tel_required",label:"Make Telephone Required",description:"Make telephone number a required field.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_tel_error",l.jsx(W,{title:"Telephone Error",description:"Customize the error message if no telephone number entered.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_tel_error",l.jsx(X,{id:"somdn_newsletter_tel_error",label:"Telephone Error Message",description:"Customize the error message if no telephone number entered.",help:"<p><strong>Default:</strong> Please enter your telephone number</p><p><strong>Note:</strong> Only applies if telephone is required.</p>",placeholder:"Please enter your telephone number",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_tel_email",l.jsx(W,{title:"Add to Email Notification",description:"Add telephone to admin email notification.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_tel_email",l.jsx(Z,{id:"somdn_newsletter_tel_email",label:"Add to Admin Email Notification",description:"Add telephone to admin email notification.",disabled:!e}))]})]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Company Field"}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_company",l.jsx(W,{title:"Company Field",description:"Ask for the user's company name.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_company",l.jsx(Z,{id:"somdn_newsletter_company",label:"Ask for Company Name",description:"Ask for the user's company name. Once enabled you can customise the company name field settings.",disabled:!e}))]}),o&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_company_placeholder",l.jsx(W,{title:"Company Placeholder",description:"Customize the company name input field placeholder.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_company_placeholder",l.jsx(X,{id:"somdn_newsletter_company_placeholder",label:"Company Placeholder",description:"Customize the company name input field placeholder.",help:"<p><strong>Default:</strong> Your company name...</p>",placeholder:"Your company name...",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_company_required",l.jsx(W,{title:"Make Company Required",description:"Make company name a required field.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_company_required",l.jsx(Z,{id:"somdn_newsletter_company_required",label:"Make Company Name Required",description:"Make company name a required field.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_company_error",l.jsx(W,{title:"Company Error",description:"Customize the error message if no company name entered.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_company_error",l.jsx(X,{id:"somdn_newsletter_company_error",label:"Company Error Message",description:"Customize the error message if no company name entered.",help:"<p><strong>Default:</strong> Please enter your company name</p><p><strong>Note:</strong> Only applies if company name is required.</p>",placeholder:"Please enter your company name",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_company_email",l.jsx(W,{title:"Add to Email Notification",description:"Add company to admin email notification.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_company_email",l.jsx(Z,{id:"somdn_newsletter_company_email",label:"Add to Admin Email Notification",description:"Add company to admin email notification.",disabled:!e}))]})]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Website Field"}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_website",l.jsx(W,{title:"Website Field",description:"Ask for the user's website.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_website",l.jsx(Z,{id:"somdn_newsletter_website",label:"Ask for Website",description:"Ask for the user's website. Once enabled you can customise the website field settings.",disabled:!e}))]}),i&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_website_placeholder",l.jsx(W,{title:"Website Placeholder",description:"Customize the website input field placeholder.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_website_placeholder",l.jsx(X,{id:"somdn_newsletter_website_placeholder",label:"Website Placeholder",description:"Customize the website input field placeholder.",help:"<p><strong>Default:</strong> Your website...</p>",placeholder:"Your website...",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_website_required",l.jsx(W,{title:"Make Website Required",description:"Make website a required field.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_website_required",l.jsx(Z,{id:"somdn_newsletter_website_required",label:"Make Website Required",description:"Make website a required field.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_website_error",l.jsx(W,{title:"Website Error",description:"Customize the error message if no website entered.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_website_error",l.jsx(X,{id:"somdn_newsletter_website_error",label:"Website Error Message",description:"Customize the error message if no website entered.",help:"<p><strong>Default:</strong> Please enter your website</p><p><strong>Note:</strong> Only applies if website is required.</p>",placeholder:"Please enter your website",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_website_email",l.jsx(W,{title:"Add to Email Notification",description:"Add website to admin email notification.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_website_email",l.jsx(Z,{id:"somdn_newsletter_website_email",label:"Add to Admin Email Notification",description:"Add website to admin email notification.",disabled:!e}))]})]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Confirmations"}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_confirmations",l.jsx(W,{title:"Subscription Confirmations",description:"Receive a confirmation email when a user downloads and subscribes.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_confirmations",l.jsx(Z,{id:"somdn_newsletter_confirmations",label:"Receive Confirmation Emails",description:"Receive a confirmation email when a user downloads and subscribes.",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_newsletter_confirmations_errors",l.jsx(W,{title:"Error Notifications",description:"Receive an email if a subscription generated an error.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_newsletter_confirmations_errors",l.jsx(Z,{id:"somdn_newsletter_confirmations_errors",label:"Receive Error Notifications",description:"Receive an email if a subscription generated an error.",help:"<p><strong>Note:</strong> These kinds of errors are not displayed to the user.</p>",disabled:!e}))]}),u&&l.jsxs(l.Fragment,{children:[l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"MailChimp Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Your MailChimp account and list settings."}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_mailchimp_api_key",l.jsx(W,{title:"MailChimp API Key",description:"Connect to your MailChimp account with your API key.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_mailchimp_api_key",l.jsx(X,{id:"somdn_newsletter_mailchimp_api_key",label:"API Key",description:"This connects to your MailChimp account.",help:`<p><strong>This connects to your MailChimp account.</strong></p>
                       <p><a href="https://kb.mailchimp.com/integrations/api-integrations/about-api-keys" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:underline dark:text-blue-400">Click here</a> to see how to obtain your MailChimp API key.</p>`,placeholder:"Enter your MailChimp API Key",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_mailchimp_list_id",l.jsx(W,{title:"MailChimp List ID",description:"The specific list you want people to be subscribed to.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_mailchimp_list_id",l.jsx(X,{id:"somdn_newsletter_mailchimp_list_id",label:"List ID",description:"This is the specific list you want people to be subscribed to.",help:`<p><strong>This is the specific list you want people to be subscribed to.</strong></p>
                       <p><a href="https://kb.mailchimp.com/lists/manage-contacts/find-your-list-id" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:underline dark:text-blue-400">Click here</a> to see how to obtain your MailChimp List ID.</p>`,placeholder:"Enter your MailChimp List ID",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_mailchimp_doubleoptin",l.jsx(W,{title:"Double Opt-In",description:"Enable if you use the 'double opt-in' subscriber setting in your list.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_mailchimp_doubleoptin",l.jsx(Z,{id:"somdn_newsletter_mailchimp_doubleoptin",label:"Double Opt-In",description:"Tick if you use the 'double opt-in' subscriber setting in your list.",help:'<p>More info on double opt-in <a href="https://kb.mailchimp.com/lists/signup-forms/about-double-opt-in" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:underline dark:text-blue-400">here</a>.</p>',disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_mailchimp_tags",l.jsx(W,{title:"MailChimp Tags",description:"A list of tags to send to MailChimp, separated by a comma.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_mailchimp_tags",l.jsx(X,{id:"somdn_newsletter_tags",label:"Tags",description:"A list of tags to send to your selected subscription service, separated by a comma.",help:`<p><strong>Use the following to replace certain elements:</strong></p>
                       <p><code>{product_id}</code> - The product ID</p>
                       <p><code>{product_name}</code> - The product name</p>
                       <p><code>{variation_id}</code> - The variation ID (Will not be used if the download wasn't a variation)</p>
                       <p><code>{variation_name}</code> - The variation name (Will not be used if the download wasn't a variation)</p>
                       <p><strong>Example:</strong> Free Download, Product {product_id}, No Checkout</p>`,placeholder:"Free Download, Product {product_id}",disabled:!e}))]})]})]}):l.jsxs("section",{className:"space-y-6",id:"newsletter",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Newsletter Settings"}),l.jsx("div",{className:"rounded-md bg-amber-50 p-4 dark:bg-amber-900/20",children:l.jsxs("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:[l.jsx("strong",{children:"Note:"})," Newsletter settings are only available when"," ",l.jsx(gt,{settingId:"somdn_capture_email_enable",children:"Email Capture"})," and"," ",l.jsx(gt,{settingId:"somdn_capture_email_subscribe",children:"Newsletter Subscription"})," ","are enabled in Tracking settings."]})})]})}const xf=[{fieldId:"somdn_newsletter_display_type",label:"Newsletter Display Type",help:"Choose how to let your users subscribe to your newsletter.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","display","type","checkbox","subscribe","pro"]},{fieldId:"somdn_newsletter_checkbox_error",label:"Checkbox Error Message",help:"Customize the error message if the checkbox is not selected.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","checkbox","error","message","pro"]},{fieldId:"somdn_newsletter_text",label:"Newsletter Text",help:"Customize the subscribe to newsletter text.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","text","subscribe","pro"]},{fieldId:"somdn_newsletter_fname_placeholder",label:"First Name Placeholder",help:"Customize the first name input field placeholder.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","first","name","placeholder","pro"]},{fieldId:"somdn_newsletter_fname_error",label:"First Name Error",help:"Customize the error message if no first name entered.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","first","name","error","pro"]},{fieldId:"somdn_newsletter_fname_email",label:"First Name in Email",help:"Add first name to admin email notification.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","first","name","email","notification","pro"]},{fieldId:"somdn_newsletter_lname",label:"Ask for Last Name",help:"Ask for the users last name.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","last","name","enable","pro"]},{fieldId:"somdn_newsletter_lname_placeholder",label:"Last Name Placeholder",help:"Customize the last name input field placeholder.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","last","name","placeholder","pro"]},{fieldId:"somdn_newsletter_lname_required",label:"Last Name Required",help:"Make last name a required field.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","last","name","required","pro"]},{fieldId:"somdn_newsletter_lname_error",label:"Last Name Error",help:"Customize the error message if no last name entered.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","last","name","error","pro"]},{fieldId:"somdn_newsletter_lname_email",label:"Last Name in Email",help:"Add last name to admin email notification.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","last","name","email","notification","pro"]},{fieldId:"somdn_newsletter_tel",label:"Ask for Telephone",help:"Ask for the users telephone number.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","telephone","phone","enable","pro"]},{fieldId:"somdn_newsletter_tel_placeholder",label:"Telephone Placeholder",help:"Customize the telephone input field placeholder.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","telephone","phone","placeholder","pro"]},{fieldId:"somdn_newsletter_tel_required",label:"Telephone Required",help:"Make telephone a required field.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","telephone","phone","required","pro"]},{fieldId:"somdn_newsletter_tel_error",label:"Telephone Error",help:"Customize the error message if no telephone entered.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","telephone","phone","error","pro"]},{fieldId:"somdn_newsletter_tel_email",label:"Telephone in Email",help:"Add telephone to admin email notification.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","telephone","phone","email","notification","pro"]},{fieldId:"somdn_newsletter_company",label:"Ask for Company",help:"Ask for the users company name.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","company","enable","pro"]},{fieldId:"somdn_newsletter_company_placeholder",label:"Company Placeholder",help:"Customize the company input field placeholder.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","company","placeholder","pro"]},{fieldId:"somdn_newsletter_company_required",label:"Company Required",help:"Make company name a required field.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","company","required","pro"]},{fieldId:"somdn_newsletter_company_error",label:"Company Error",help:"Customize the error message if no company entered.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","company","error","pro"]},{fieldId:"somdn_newsletter_company_email",label:"Company in Email",help:"Add company to admin email notification.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","company","email","notification","pro"]},{fieldId:"somdn_newsletter_website",label:"Ask for Website",help:"Ask for the users website.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","website","enable","pro"]},{fieldId:"somdn_newsletter_website_placeholder",label:"Website Placeholder",help:"Customize the website input field placeholder.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","website","placeholder","pro"]},{fieldId:"somdn_newsletter_website_required",label:"Website Required",help:"Make website a required field.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","website","required","pro"]},{fieldId:"somdn_newsletter_website_error",label:"Website Error",help:"Customize the error message if no website entered.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","website","error","pro"]},{fieldId:"somdn_newsletter_website_email",label:"Website in Email",help:"Add website to admin email notification.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","website","email","notification","pro"]},{fieldId:"somdn_newsletter_confirmations",label:"Subscription Confirmations",help:"Receive a confirmation email when a user downloads and subscribes.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","confirmation","email","subscribe","pro"]},{fieldId:"somdn_newsletter_confirmations_errors",label:"Error Notifications",help:"Receive an email if a subscription generated an error.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","error","notification","subscribe","pro"]},{fieldId:"somdn_newsletter_mailchimp_api_key",label:"MailChimp API Key",help:"Your MailChimp API key to connect to your account.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","mailchimp","api","key","pro"]},{fieldId:"somdn_newsletter_mailchimp_list_id",label:"MailChimp List ID",help:"The MailChimp list ID to subscribe users to.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","mailchimp","list","id","pro"]},{fieldId:"somdn_newsletter_mailchimp_doubleoptin",label:"MailChimp Double Opt-In",help:"Enable double opt-in for MailChimp subscriptions.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","mailchimp","double","optin","pro"]},{fieldId:"somdn_newsletter_tags",label:"Newsletter Tags",help:"Tags to send to your newsletter service.",sectionKey:"newsletter",pluginSlug:fe,keywords:["newsletter","mailchimp","tags","pro"]}],$v=Object.freeze(Object.defineProperty({__proto__:null,NewsletterSettings:bf,mailchimpDefaults:gf,newsletterDefaults:pf,newsletterSettingsIndex:xf},Symbol.toStringTag,{value:"Module"})),Ct="free-downloads-woocommerce",qv=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.is_pro)||!1},wf={somdn_email_settings_sender_name:"",somdn_email_settings_sender_address:"",somdn_email_settings_content_type:"0",somdn_email_download_url_subject:"",somdn_email_download_url_heading:"",somdn_email_download_url_message:"",somdn_email_new_download_enable:!1,somdn_email_new_download_sendto:"",somdn_email_new_download_subject:"",somdn_email_new_download_heading:"",somdn_email_new_download_message:""};function _f(){const e=qv(),t=be({somdn_email_new_download_enable:!0});return l.jsxs("section",{className:"space-y-6",id:"emails",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Email Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Customise how this plugin sends emails to your customers."}),l.jsx("div",{className:"rounded-md bg-blue-50 p-4 dark:bg-blue-900/20 mb-6",children:l.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:[l.jsx("strong",{children:"Note:"})," Some default settings are taken from your WooCommerce email settings, and these can be overridden below."]})}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Global Email Settings"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"Configure global sender details for all emails sent by this plugin."}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_email_sender_name",l.jsx(W,{title:"From Name",description:"Customize the name shown as the email sender.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_email_sender_name",l.jsx(X,{id:"somdn_email_settings_sender_name",label:"From Name",description:"Customize the name to be shown as the email sender.",help:"<p>Leave blank to use the default WooCommerce sender name.</p>",placeholder:"Your Store Name",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_email_sender_address",l.jsx(W,{title:"From Address",description:"Customize the email address to send from.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_email_sender_address",l.jsx(X,{id:"somdn_email_settings_sender_address",label:"From Address",description:"Customize the email address to send from.",help:"<p>Leave blank to use the default WooCommerce sender address.</p>",type:"email",placeholder:"store@example.com",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_email_content_type",l.jsx(W,{title:"Content Type",description:"Choose whether to send HTML or Plain Text emails.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_email_content_type",l.jsx(ft,{id:"somdn_email_settings_content_type",label:"Content Type",description:"By default emails are sent as HTML.",options:[{label:"HTML",value:"0"},{label:"Plain Text",value:"1"}],disabled:!e}))]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"Download Links Email"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"The email sent to users with their file download URL when this option is selected in your Download Delivery settings."}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_email_download_url_subject",l.jsx(W,{title:"Email Subject",description:"Customize the email subject line for download link emails.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_email_download_url_subject",l.jsx(X,{id:"somdn_email_download_url_subject",label:"Email Subject",description:"Customize the email subject line.",help:`<p><strong>Available placeholders:</strong></p>
                   <p><code>{site_name}</code> - The site name</p>
                   <p><code>{product}</code> - The product name</p>`,placeholder:"Your download from {site_name}",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_email_download_url_heading",l.jsx(W,{title:"Email Heading",description:"Customize the email heading text for download link emails.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_email_download_url_heading",l.jsx(X,{id:"somdn_email_download_url_heading",label:"Email Heading",description:"Customize the email heading text.",help:`<p><strong>Available placeholders:</strong></p>
                   <p><code>{site_name}</code> - The site name</p>
                   <p><code>{product}</code> - The product name</p>`,placeholder:"Your Download Link",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_email_download_url_message",l.jsx(W,{title:"Email Body",description:"Customize the email body content for download link emails.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_email_download_url_message",l.jsx(jt,{id:"somdn_email_download_url_message",label:"Email Body",description:"Customize the email body content.",help:`<p><strong>Available placeholders:</strong></p>
                   <p><code>{link}</code> - The download URL</p>
                   <p><code>{product}</code> - The product name</p>
                   <p><code>{username}</code> - The user's login username. Default is "Customer" if none found</p>
                   <p><code>{first_name}</code> - The user's first name. Default is "Customer" if none found</p>
                   <p><code>{site_name}</code> - The site name</p>
                   <p><code>{hours}</code> - Number of hours until link expires (number)</p>`,placeholder:"Hi {first_name}, here is your download link for {product}...",rows:6,disabled:!e}))]}),l.jsx("hr",{className:"border-t border-neutral-200 dark:border-neutral-700 my-8"}),l.jsx("h3",{className:"text-base font-medium dark:text-white",children:"New Free Downloads Email"}),l.jsx("p",{className:"pb-2 text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:"The email sent to site admins when a new free download has been actioned. Disabled by default."}),l.jsx("div",{className:"rounded-md bg-amber-50 p-4 dark:bg-amber-900/20 mb-4",children:l.jsxs("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:[l.jsx("strong",{children:"Note:"})," This feature also requires"," ",l.jsx("a",{href:"#free-downloads-woocommerce/tracking",className:"underline hover:no-underline",children:"Download Tracking"})," ","to be enabled."]})}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_email_new_download_enable",l.jsx(W,{title:"Enable Email Notifications",description:"Receive an email every time a user downloads a free product.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_email_new_download_enable",l.jsx(Z,{id:"somdn_email_new_download_enable",label:"Enable Email Notifications",description:"Receive an email every time a user downloads a free product.",disabled:!e}))]}),t&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_email_new_download_sendto",l.jsx(W,{title:"Email Recipients",description:"Customize who should receive the admin notification email.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_email_new_download_sendto",l.jsx(X,{id:"somdn_email_new_download_sendto",label:"Email Recipients",description:"Customize who should receive this email.",help:"<p>For multiple email addresses, separate each one by a comma and space. For example: a@b.com, c@d.com</p><p>Leave blank to use the default admin email.</p>",placeholder:"admin@example.com, manager@example.com",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_email_new_download_subject",l.jsx(W,{title:"Email Subject",description:"Customize the email subject line for admin notification emails.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_email_new_download_subject",l.jsx(X,{id:"somdn_email_new_download_subject",label:"Email Subject",description:"Customize the email subject line.",help:`<p><strong>Available placeholders:</strong></p>
                       <p><code>{site_name}</code> - The site name</p>
                       <p><code>{product}</code> - The product name</p>`,placeholder:"New Free Download on {site_name}",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_email_new_download_heading",l.jsx(W,{title:"Email Heading",description:"Customize the email heading text for admin notification emails.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_email_new_download_heading",l.jsx(X,{id:"somdn_email_new_download_heading",label:"Email Heading",description:"Customize the email heading text.",placeholder:"New Free Download",disabled:!e}))]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute top-0 right-0 z-10",children:S("somdn_pro_badge_email_new_download_message",l.jsx(W,{title:"Email Body",description:"Customize the email body content for admin notification emails.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"}))}),S("somdn_pro_control_email_new_download_message",l.jsx(jt,{id:"somdn_email_new_download_message",label:"Email Body",description:"Customize the email body content.",help:`<p><strong>Available placeholders:</strong></p>
                       <p><code>{id}</code> - The download ID</p>
                       <p><code>{link}</code> - Link to the download log</p>
                       <p><code>{product}</code> - The product name</p>
                       <p><code>{username}</code> - The user's login username. Default is "Customer" if none found</p>
                       <p><code>{email}</code> - The user's email address. Default is blank if none found</p>
                       <p><code>{date}</code> - Date & time of the download</p>
                       <p><code>{site_name}</code> - The site name</p>`,placeholder:"A new free download has been recorded...",rows:6,disabled:!e}))]})]})]})}const yf=[{fieldId:"somdn_email_settings_sender_name",label:"Email From Name",help:"Customize the name shown as the email sender.",sectionKey:"emails",pluginSlug:Ct,keywords:["email","sender","from","name","pro"]},{fieldId:"somdn_email_settings_sender_address",label:"Email From Address",help:"Customize the email address to send from.",sectionKey:"emails",pluginSlug:Ct,keywords:["email","sender","from","address","pro"]},{fieldId:"somdn_email_settings_content_type",label:"Email Content Type",help:"Choose whether to send HTML or Plain Text emails.",sectionKey:"emails",pluginSlug:Ct,keywords:["email","content","type","html","plain","text","pro"]},{fieldId:"somdn_email_download_url_subject",label:"Download Email Subject",help:"Customize the email subject line for download link emails.",sectionKey:"emails",pluginSlug:Ct,keywords:["email","download","link","subject","pro"]},{fieldId:"somdn_email_download_url_heading",label:"Download Email Heading",help:"Customize the email heading text for download link emails.",sectionKey:"emails",pluginSlug:Ct,keywords:["email","download","link","heading","pro"]},{fieldId:"somdn_email_download_url_message",label:"Download Email Body",help:"Customize the email body content for download link emails.",sectionKey:"emails",pluginSlug:Ct,keywords:["email","download","link","message","body","content","pro"]},{fieldId:"somdn_email_new_download_enable",label:"Enable New Download Notifications",help:"Receive an email every time a user downloads a free product.",sectionKey:"emails",pluginSlug:Ct,keywords:["email","new","download","notification","enable","admin","pro"]},{fieldId:"somdn_email_new_download_sendto",label:"New Download Recipients",help:"Customize who should receive the admin notification email.",sectionKey:"emails",pluginSlug:Ct,keywords:["email","new","download","recipient","sendto","admin","pro"]},{fieldId:"somdn_email_new_download_subject",label:"New Download Email Subject",help:"Customize the email subject line for admin notification emails.",sectionKey:"emails",pluginSlug:Ct,keywords:["email","new","download","subject","admin","pro"]},{fieldId:"somdn_email_new_download_heading",label:"New Download Email Heading",help:"Customize the email heading text for admin notification emails.",sectionKey:"emails",pluginSlug:Ct,keywords:["email","new","download","heading","admin","pro"]},{fieldId:"somdn_email_new_download_message",label:"New Download Email Body",help:"Customize the email body content for admin notification emails.",sectionKey:"emails",pluginSlug:Ct,keywords:["email","new","download","message","body","content","admin","pro"]}],Yv=Object.freeze(Object.defineProperty({__proto__:null,EmailsSettings:_f,emailsDefaults:wf,emailsSettingsIndex:yf},Symbol.toStringTag,{value:"Module"}));function vf({className:e,level:t=1,...n}){let s=`h${t}`;return l.jsx(s,{...n,className:ae(e,"text-2xl/8 font-semibold text-neutral-950 sm:text-xl/8 dark:text-white")})}/*!
 * @kurkle/color v0.3.4
 * https://github.com/kurkle/color#readme
 * (c) 2024 Jukka Kurkela
 * Released under the MIT License
 */function xr(e){return e+.5|0}const wn=(e,t,n)=>Math.max(Math.min(e,n),t);function wr(e){return wn(xr(e*2.55),0,255)}function _n(e){return wn(xr(e*255),0,255)}function Jt(e){return wn(xr(e/2.55)/100,0,1)}function kf(e){return wn(xr(e*100),0,100)}const bt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},yl=[..."0123456789ABCDEF"],Kv=e=>yl[e&15],Gv=e=>yl[(e&240)>>4]+yl[e&15],Ko=e=>(e&240)>>4===(e&15),Xv=e=>Ko(e.r)&&Ko(e.g)&&Ko(e.b)&&Ko(e.a);function Qv(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&bt[e[1]]*17,g:255&bt[e[2]]*17,b:255&bt[e[3]]*17,a:t===5?bt[e[4]]*17:255}:(t===7||t===9)&&(n={r:bt[e[1]]<<4|bt[e[2]],g:bt[e[3]]<<4|bt[e[4]],b:bt[e[5]]<<4|bt[e[6]],a:t===9?bt[e[7]]<<4|bt[e[8]]:255})),n}const Zv=(e,t)=>e<255?t(e):"";function Jv(e){var t=Xv(e)?Kv:Gv;return e?"#"+t(e.r)+t(e.g)+t(e.b)+Zv(e.a,t):void 0}const ek=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function jf(e,t,n){const s=t*Math.min(n,1-n),r=(o,i=(o+e/30)%12)=>n-s*Math.max(Math.min(i-3,9-i,1),-1);return[r(0),r(8),r(4)]}function tk(e,t,n){const s=(r,o=(r+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[s(5),s(3),s(1)]}function nk(e,t,n){const s=jf(e,1,.5);let r;for(t+n>1&&(r=1/(t+n),t*=r,n*=r),r=0;r<3;r++)s[r]*=1-t-n,s[r]+=t;return s}function sk(e,t,n,s,r){return e===r?(t-n)/s+(t<n?6:0):t===r?(n-e)/s+2:(e-t)/s+4}function vl(e){const n=e.r/255,s=e.g/255,r=e.b/255,o=Math.max(n,s,r),i=Math.min(n,s,r),a=(o+i)/2;let d,c,u;return o!==i&&(u=o-i,c=a>.5?u/(2-o-i):u/(o+i),d=sk(n,s,r,u,o),d=d*60+.5),[d|0,c||0,a]}function kl(e,t,n,s){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,s)).map(_n)}function jl(e,t,n){return kl(jf,e,t,n)}function rk(e,t,n){return kl(nk,e,t,n)}function ok(e,t,n){return kl(tk,e,t,n)}function Sf(e){return(e%360+360)%360}function ik(e){const t=ek.exec(e);let n=255,s;if(!t)return;t[5]!==s&&(n=t[6]?wr(+t[5]):_n(+t[5]));const r=Sf(+t[2]),o=+t[3]/100,i=+t[4]/100;return t[1]==="hwb"?s=rk(r,o,i):t[1]==="hsv"?s=ok(r,o,i):s=jl(r,o,i),{r:s[0],g:s[1],b:s[2],a:n}}function ak(e,t){var n=vl(e);n[0]=Sf(n[0]+t),n=jl(n),e.r=n[0],e.g=n[1],e.b=n[2]}function lk(e){if(!e)return;const t=vl(e),n=t[0],s=kf(t[1]),r=kf(t[2]);return e.a<255?`hsla(${n}, ${s}%, ${r}%, ${Jt(e.a)})`:`hsl(${n}, ${s}%, ${r}%)`}const Nf={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Cf={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function dk(){const e={},t=Object.keys(Cf),n=Object.keys(Nf);let s,r,o,i,a;for(s=0;s<t.length;s++){for(i=a=t[s],r=0;r<n.length;r++)o=n[r],a=a.replace(o,Nf[o]);o=parseInt(Cf[i],16),e[a]=[o>>16&255,o>>8&255,o&255]}return e}let Go;function ck(e){Go||(Go=dk(),Go.transparent=[0,0,0,0]);const t=Go[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const uk=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function hk(e){const t=uk.exec(e);let n=255,s,r,o;if(t){if(t[7]!==s){const i=+t[7];n=t[8]?wr(i):wn(i*255,0,255)}return s=+t[1],r=+t[3],o=+t[5],s=255&(t[2]?wr(s):wn(s,0,255)),r=255&(t[4]?wr(r):wn(r,0,255)),o=255&(t[6]?wr(o):wn(o,0,255)),{r:s,g:r,b:o,a:n}}}function fk(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${Jt(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const Sl=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,Ds=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function mk(e,t,n){const s=Ds(Jt(e.r)),r=Ds(Jt(e.g)),o=Ds(Jt(e.b));return{r:_n(Sl(s+n*(Ds(Jt(t.r))-s))),g:_n(Sl(r+n*(Ds(Jt(t.g))-r))),b:_n(Sl(o+n*(Ds(Jt(t.b))-o))),a:e.a+n*(t.a-e.a)}}function Xo(e,t,n){if(e){let s=vl(e);s[t]=Math.max(0,Math.min(s[t]+s[t]*n,t===0?360:1)),s=jl(s),e.r=s[0],e.g=s[1],e.b=s[2]}}function Mf(e,t){return e&&Object.assign(t||{},e)}function Ef(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=_n(e[3]))):(t=Mf(e,{r:0,g:0,b:0,a:1}),t.a=_n(t.a)),t}function pk(e){return e.charAt(0)==="r"?hk(e):ik(e)}class _r{constructor(t){if(t instanceof _r)return t;const n=typeof t;let s;n==="object"?s=Ef(t):n==="string"&&(s=Qv(t)||ck(t)||pk(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=Mf(this._rgb);return t&&(t.a=Jt(t.a)),t}set rgb(t){this._rgb=Ef(t)}rgbString(){return this._valid?fk(this._rgb):void 0}hexString(){return this._valid?Jv(this._rgb):void 0}hslString(){return this._valid?lk(this._rgb):void 0}mix(t,n){if(t){const s=this.rgb,r=t.rgb;let o;const i=n===o?.5:n,a=2*i-1,d=s.a-r.a,c=((a*d===-1?a:(a+d)/(1+a*d))+1)/2;o=1-c,s.r=255&c*s.r+o*r.r+.5,s.g=255&c*s.g+o*r.g+.5,s.b=255&c*s.b+o*r.b+.5,s.a=i*s.a+(1-i)*r.a,this.rgb=s}return this}interpolate(t,n){return t&&(this._rgb=mk(this._rgb,t._rgb,n)),this}clone(){return new _r(this.rgb)}alpha(t){return this._rgb.a=_n(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=xr(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Xo(this._rgb,2,t),this}darken(t){return Xo(this._rgb,2,-t),this}saturate(t){return Xo(this._rgb,1,t),this}desaturate(t){return Xo(this._rgb,1,-t),this}rotate(t){return ak(this._rgb,t),this}}/*!
 * Chart.js v4.5.1
 * https://www.chartjs.org
 * (c) 2025 Chart.js Contributors
 * Released under the MIT License
 */function en(){}const gk=(()=>{let e=0;return()=>e++})();function ce(e){return e==null}function je(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function ie(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function Pe(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function mt(e,t){return Pe(e)?e:t}function se(e,t){return typeof e>"u"?t:e}const bk=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/t,Pf=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function ke(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function we(e,t,n,s){let r,o,i;if(je(e))if(o=e.length,s)for(r=o-1;r>=0;r--)t.call(n,e[r],r);else for(r=0;r<o;r++)t.call(n,e[r],r);else if(ie(e))for(i=Object.keys(e),o=i.length,r=0;r<o;r++)t.call(n,e[i[r]],i[r])}function Qo(e,t){let n,s,r,o;if(!e||!t||e.length!==t.length)return!1;for(n=0,s=e.length;n<s;++n)if(r=e[n],o=t[n],r.datasetIndex!==o.datasetIndex||r.index!==o.index)return!1;return!0}function Zo(e){if(je(e))return e.map(Zo);if(ie(e)){const t=Object.create(null),n=Object.keys(e),s=n.length;let r=0;for(;r<s;++r)t[n[r]]=Zo(e[n[r]]);return t}return e}function Tf(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function xk(e,t,n,s){if(!Tf(e))return;const r=t[e],o=n[e];ie(r)&&ie(o)?yr(r,o,s):t[e]=Zo(o)}function yr(e,t,n){const s=je(t)?t:[t],r=s.length;if(!ie(e))return e;n=n||{};const o=n.merger||xk;let i;for(let a=0;a<r;++a){if(i=s[a],!ie(i))continue;const d=Object.keys(i);for(let c=0,u=d.length;c<u;++c)o(d[c],e,i,n)}return e}function vr(e,t){return yr(e,t,{merger:wk})}function wk(e,t,n){if(!Tf(e))return;const s=t[e],r=n[e];ie(s)&&ie(r)?vr(s,r):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=Zo(r))}const Df={"":e=>e,x:e=>e.x,y:e=>e.y};function _k(e){const t=e.split("."),n=[];let s="";for(const r of t)s+=r,s.endsWith("\\")?s=s.slice(0,-1)+".":(n.push(s),s="");return n}function yk(e){const t=_k(e);return n=>{for(const s of t){if(s==="")break;n=n&&n[s]}return n}}function Rn(e,t){return(Df[t]||(Df[t]=yk(t)))(e)}function Nl(e){return e.charAt(0).toUpperCase()+e.slice(1)}const kr=e=>typeof e<"u",yn=e=>typeof e=="function",If=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function vk(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const pe=Math.PI,Se=2*pe,kk=Se+pe,Jo=Number.POSITIVE_INFINITY,jk=pe/180,Le=pe/2,$n=pe/4,Of=pe*2/3,vn=Math.log10,Ht=Math.sign;function jr(e,t,n){return Math.abs(e-t)<n}function Lf(e){const t=Math.round(e);e=jr(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(vn(e))),s=e/n;return(s<=1?1:s<=2?2:s<=5?5:10)*n}function Sk(e){const t=[],n=Math.sqrt(e);let s;for(s=1;s<n;s++)e%s===0&&(t.push(s),t.push(e/s));return n===(n|0)&&t.push(n),t.sort((r,o)=>r-o).pop(),t}function Nk(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function Sr(e){return!Nk(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function Ck(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function Af(e,t,n){let s,r,o;for(s=0,r=e.length;s<r;s++)o=e[s][n],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Vt(e){return e*(pe/180)}function Cl(e){return e*(180/pe)}function Ff(e){if(!Pe(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function zf(e,t){const n=t.x-e.x,s=t.y-e.y,r=Math.sqrt(n*n+s*s);let o=Math.atan2(s,n);return o<-.5*pe&&(o+=Se),{angle:o,distance:r}}function Ml(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Mk(e,t){return(e-t+kk)%Se-pe}function Je(e){return(e%Se+Se)%Se}function Nr(e,t,n,s){const r=Je(e),o=Je(t),i=Je(n),a=Je(o-r),d=Je(i-r),c=Je(r-o),u=Je(r-i);return r===o||r===i||s&&o===i||a>d&&c<u}function et(e,t,n){return Math.max(t,Math.min(n,e))}function Ek(e){return et(e,-32768,32767)}function tn(e,t,n,s=1e-6){return e>=Math.min(t,n)-s&&e<=Math.max(t,n)+s}function El(e,t,n){n=n||(i=>e[i]<t);let s=e.length-1,r=0,o;for(;s-r>1;)o=r+s>>1,n(o)?r=o:s=o;return{lo:r,hi:s}}const qn=(e,t,n,s)=>El(e,n,s?r=>{const o=e[r][t];return o<n||o===n&&e[r+1][t]===n}:r=>e[r][t]<n),Pk=(e,t,n)=>El(e,n,s=>e[s][t]>=n);function Tk(e,t,n){let s=0,r=e.length;for(;s<r&&e[s]<t;)s++;for(;r>s&&e[r-1]>n;)r--;return s>0||r<e.length?e.slice(s,r):e}const Wf=["push","pop","shift","splice","unshift"];function Dk(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Wf.forEach(n=>{const s="_onData"+Nl(n),r=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const i=r.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[s]=="function"&&a[s](...o)}),i}})})}function Bf(e,t){const n=e._chartjs;if(!n)return;const s=n.listeners,r=s.indexOf(t);r!==-1&&s.splice(r,1),!(s.length>0)&&(Wf.forEach(o=>{delete e[o]}),delete e._chartjs)}function Hf(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const Vf=function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame}();function Uf(e,t){let n=[],s=!1;return function(...r){n=r,s||(s=!0,Vf.call(window,()=>{s=!1,e.apply(t,n)}))}}function Ik(e,t){let n;return function(...s){return t?(clearTimeout(n),n=setTimeout(e,t,s)):e.apply(this,s),t}}const Pl=e=>e==="start"?"left":e==="end"?"right":"center",tt=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,Ok=(e,t,n,s)=>e===(s?"left":"right")?n:e==="center"?(t+n)/2:t;function Lk(e,t,n){const s=t.length;let r=0,o=s;if(e._sorted){const{iScale:i,vScale:a,_parsed:d}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=i.axis,{min:h,max:m,minDefined:f,maxDefined:g}=i.getUserBounds();if(f){if(r=Math.min(qn(d,u,h).lo,n?s:qn(t,u,i.getPixelForValue(h)).lo),c){const b=d.slice(0,r+1).reverse().findIndex(x=>!ce(x[a.axis]));r-=Math.max(0,b)}r=et(r,0,s-1)}if(g){let b=Math.max(qn(d,i.axis,m,!0).hi+1,n?0:qn(t,u,i.getPixelForValue(m),!0).hi+1);if(c){const x=d.slice(b-1).findIndex(w=>!ce(w[a.axis]));b+=Math.max(0,x)}o=et(b,r,s)-r}else o=s-r}return{start:r,count:o}}function Ak(e){const{xScale:t,yScale:n,_scaleRanges:s}=e,r={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!s)return e._scaleRanges=r,!0;const o=s.xmin!==t.min||s.xmax!==t.max||s.ymin!==n.min||s.ymax!==n.max;return Object.assign(s,r),o}const ei=e=>e===0||e===1,Rf=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*Se/n)),$f=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*Se/n)+1,Cr={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*Le)+1,easeOutSine:e=>Math.sin(e*Le),easeInOutSine:e=>-.5*(Math.cos(pe*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>ei(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>ei(e)?e:Rf(e,.075,.3),easeOutElastic:e=>ei(e)?e:$f(e,.075,.3),easeInOutElastic(e){return ei(e)?e:e<.5?.5*Rf(e*2,.1125,.45):.5+.5*$f(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-Cr.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?Cr.easeInBounce(e*2)*.5:Cr.easeOutBounce(e*2-1)*.5+.5};function Tl(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function qf(e){return Tl(e)?e:new _r(e)}function Dl(e){return Tl(e)?e:new _r(e).saturate(.5).darken(.1).hexString()}const Fk=["x","y","borderWidth","radius","tension"],zk=["color","borderColor","backgroundColor"];function Wk(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:zk},numbers:{type:"number",properties:Fk}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Bk(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Yf=new Map;function Hk(e,t){t=t||{};const n=e+JSON.stringify(t);let s=Yf.get(n);return s||(s=new Intl.NumberFormat(e,t),Yf.set(n,s)),s}function ti(e,t,n){return Hk(t,n).format(e)}const Kf={values(e){return je(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const s=this.chart.options.locale;let r,o=e;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(r="scientific"),o=Vk(e,n)}const i=vn(Math.abs(o)),a=isNaN(i)?1:Math.max(Math.min(-1*Math.floor(i),20),0),d={notation:r,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(d,this.options.ticks.format),ti(e,s,d)},logarithmic(e,t,n){if(e===0)return"0";const s=n[t].significand||e/Math.pow(10,Math.floor(vn(e)));return[1,2,3,5,10,15].includes(s)||t>.8*n.length?Kf.numeric.call(this,e,t,n):""}};function Vk(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var ni={formatters:Kf};function Uk(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:ni.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Yn=Object.create(null),Il=Object.create(null);function Mr(e,t){if(!t)return e;const n=t.split(".");for(let s=0,r=n.length;s<r;++s){const o=n[s];e=e[o]||(e[o]=Object.create(null))}return e}function Ol(e,t,n){return typeof t=="string"?yr(Mr(e,t),n):yr(Mr(e,""),t)}class Rk{constructor(t,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=s=>s.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(s,r)=>Dl(r.backgroundColor),this.hoverBorderColor=(s,r)=>Dl(r.borderColor),this.hoverColor=(s,r)=>Dl(r.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return Ol(this,t,n)}get(t){return Mr(this,t)}describe(t,n){return Ol(Il,t,n)}override(t,n){return Ol(Yn,t,n)}route(t,n,s,r){const o=Mr(this,t),i=Mr(this,s),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const d=this[a],c=i[r];return ie(d)?Object.assign({},c,d):se(d,c)},set(d){this[a]=d}}})}apply(t){t.forEach(n=>n(this))}}var Te=new Rk({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Wk,Bk,Uk]);function $k(e){return!e||ce(e.size)||ce(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function si(e,t,n,s,r){let o=t[r];return o||(o=t[r]=e.measureText(r).width,n.push(r)),o>s&&(s=o),s}function qk(e,t,n,s){s=s||{};let r=s.data=s.data||{},o=s.garbageCollect=s.garbageCollect||[];s.font!==t&&(r=s.data={},o=s.garbageCollect=[],s.font=t),e.save(),e.font=t;let i=0;const a=n.length;let d,c,u,h,m;for(d=0;d<a;d++)if(h=n[d],h!=null&&!je(h))i=si(e,r,o,i,h);else if(je(h))for(c=0,u=h.length;c<u;c++)m=h[c],m!=null&&!je(m)&&(i=si(e,r,o,i,m));e.restore();const f=o.length/2;if(f>n.length){for(d=0;d<f;d++)delete r[o[d]];o.splice(0,f)}return i}function Kn(e,t,n){const s=e.currentDevicePixelRatio,r=n!==0?Math.max(n/2,.5):0;return Math.round((t-r)*s)/s+r}function Gf(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function Ll(e,t,n,s){Xf(e,t,n,s,null)}function Xf(e,t,n,s,r){let o,i,a,d,c,u,h,m;const f=t.pointStyle,g=t.rotation,b=t.radius;let x=(g||0)*jk;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,s),e.rotate(x),e.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),e.restore();return}if(!(isNaN(b)||b<=0)){switch(e.beginPath(),f){default:r?e.ellipse(n,s,r/2,b,0,0,Se):e.arc(n,s,b,0,Se),e.closePath();break;case"triangle":u=r?r/2:b,e.moveTo(n+Math.sin(x)*u,s-Math.cos(x)*b),x+=Of,e.lineTo(n+Math.sin(x)*u,s-Math.cos(x)*b),x+=Of,e.lineTo(n+Math.sin(x)*u,s-Math.cos(x)*b),e.closePath();break;case"rectRounded":c=b*.516,d=b-c,i=Math.cos(x+$n)*d,h=Math.cos(x+$n)*(r?r/2-c:d),a=Math.sin(x+$n)*d,m=Math.sin(x+$n)*(r?r/2-c:d),e.arc(n-h,s-a,c,x-pe,x-Le),e.arc(n+m,s-i,c,x-Le,x),e.arc(n+h,s+a,c,x,x+Le),e.arc(n-m,s+i,c,x+Le,x+pe),e.closePath();break;case"rect":if(!g){d=Math.SQRT1_2*b,u=r?r/2:d,e.rect(n-u,s-d,2*u,2*d);break}x+=$n;case"rectRot":h=Math.cos(x)*(r?r/2:b),i=Math.cos(x)*b,a=Math.sin(x)*b,m=Math.sin(x)*(r?r/2:b),e.moveTo(n-h,s-a),e.lineTo(n+m,s-i),e.lineTo(n+h,s+a),e.lineTo(n-m,s+i),e.closePath();break;case"crossRot":x+=$n;case"cross":h=Math.cos(x)*(r?r/2:b),i=Math.cos(x)*b,a=Math.sin(x)*b,m=Math.sin(x)*(r?r/2:b),e.moveTo(n-h,s-a),e.lineTo(n+h,s+a),e.moveTo(n+m,s-i),e.lineTo(n-m,s+i);break;case"star":h=Math.cos(x)*(r?r/2:b),i=Math.cos(x)*b,a=Math.sin(x)*b,m=Math.sin(x)*(r?r/2:b),e.moveTo(n-h,s-a),e.lineTo(n+h,s+a),e.moveTo(n+m,s-i),e.lineTo(n-m,s+i),x+=$n,h=Math.cos(x)*(r?r/2:b),i=Math.cos(x)*b,a=Math.sin(x)*b,m=Math.sin(x)*(r?r/2:b),e.moveTo(n-h,s-a),e.lineTo(n+h,s+a),e.moveTo(n+m,s-i),e.lineTo(n-m,s+i);break;case"line":i=r?r/2:Math.cos(x)*b,a=Math.sin(x)*b,e.moveTo(n-i,s-a),e.lineTo(n+i,s+a);break;case"dash":e.moveTo(n,s),e.lineTo(n+Math.cos(x)*(r?r/2:b),s+Math.sin(x)*b);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function nn(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function ri(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function oi(e){e.restore()}function Yk(e,t,n,s,r){if(!t)return e.lineTo(n.x,n.y);if(r==="middle"){const o=(t.x+n.x)/2;e.lineTo(o,t.y),e.lineTo(o,n.y)}else r==="after"!=!!s?e.lineTo(t.x,n.y):e.lineTo(n.x,t.y);e.lineTo(n.x,n.y)}function Kk(e,t,n,s){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(s?t.cp1x:t.cp2x,s?t.cp1y:t.cp2y,s?n.cp2x:n.cp1x,s?n.cp2y:n.cp1y,n.x,n.y)}function Gk(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),ce(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function Xk(e,t,n,s,r){if(r.strikethrough||r.underline){const o=e.measureText(s),i=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,d=n-o.actualBoundingBoxAscent,c=n+o.actualBoundingBoxDescent,u=r.strikethrough?(d+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=r.decorationWidth||2,e.moveTo(i,u),e.lineTo(a,u),e.stroke()}}function Qk(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function Gn(e,t,n,s,r,o={}){const i=je(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let d,c;for(e.save(),e.font=r.string,Gk(e,o),d=0;d<i.length;++d)c=i[d],o.backdrop&&Qk(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),ce(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,n,s,o.maxWidth)),e.fillText(c,n,s,o.maxWidth),Xk(e,n,s,c,o),s+=Number(r.lineHeight);e.restore()}function Er(e,t){const{x:n,y:s,w:r,h:o,radius:i}=t;e.arc(n+i.topLeft,s+i.topLeft,i.topLeft,1.5*pe,pe,!0),e.lineTo(n,s+o-i.bottomLeft),e.arc(n+i.bottomLeft,s+o-i.bottomLeft,i.bottomLeft,pe,Le,!0),e.lineTo(n+r-i.bottomRight,s+o),e.arc(n+r-i.bottomRight,s+o-i.bottomRight,i.bottomRight,Le,0,!0),e.lineTo(n+r,s+i.topRight),e.arc(n+r-i.topRight,s+i.topRight,i.topRight,0,-Le,!0),e.lineTo(n+i.topLeft,s)}const Zk=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Jk=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function e2(e,t){const n=(""+e).match(Zk);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}const t2=e=>+e||0;function Al(e,t){const n={},s=ie(t),r=s?Object.keys(t):t,o=ie(e)?s?i=>se(e[i],e[t[i]]):i=>e[i]:()=>e;for(const i of r)n[i]=t2(o(i));return n}function Qf(e){return Al(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Xn(e){return Al(e,["topLeft","topRight","bottomLeft","bottomRight"])}function nt(e){const t=Qf(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Ve(e,t){e=e||{},t=t||Te.font;let n=se(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let s=se(e.style,t.style);s&&!(""+s).match(Jk)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const r={family:se(e.family,t.family),lineHeight:e2(se(e.lineHeight,t.lineHeight),n),size:n,style:s,weight:se(e.weight,t.weight),string:""};return r.string=$k(r),r}function ii(e,t,n,s){let r=!0,o,i,a;for(o=0,i=e.length;o<i;++o)if(a=e[o],a!==void 0&&(t!==void 0&&typeof a=="function"&&(a=a(t),r=!1),n!==void 0&&je(a)&&(a=a[n%a.length],r=!1),a!==void 0))return s&&!r&&(s.cacheable=!1),a}function n2(e,t,n){const{min:s,max:r}=e,o=Pf(t,(r-s)/2),i=(a,d)=>n&&a===0?0:a+d;return{min:i(s,-Math.abs(o)),max:i(r,o)}}function kn(e,t){return Object.assign(Object.create(e),t)}function Fl(e,t=[""],n,s,r=()=>e[0]){const o=n||e;typeof s>"u"&&(s=nm("_fallback",e));const i={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:s,_getTarget:r,override:a=>Fl([a,...e],t,o,s)};return new Proxy(i,{deleteProperty(a,d){return delete a[d],delete a._keys,delete e[0][d],!0},get(a,d){return Jf(a,d,()=>c2(d,t,e,a))},getOwnPropertyDescriptor(a,d){return Reflect.getOwnPropertyDescriptor(a._scopes[0],d)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,d){return sm(a).includes(d)},ownKeys(a){return sm(a)},set(a,d,c){const u=a._storage||(a._storage=r());return a[d]=u[d]=c,delete a._keys,!0}})}function Is(e,t,n,s){const r={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:Zf(e,s),setContext:o=>Is(e,o,n,s),override:o=>Is(e.override(o),t,n,s)};return new Proxy(r,{deleteProperty(o,i){return delete o[i],delete e[i],!0},get(o,i,a){return Jf(o,i,()=>r2(o,i,a))},getOwnPropertyDescriptor(o,i){return o._descriptors.allKeys?Reflect.has(e,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,i)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,i){return Reflect.has(e,i)},ownKeys(){return Reflect.ownKeys(e)},set(o,i,a){return e[i]=a,delete o[i],!0}})}function Zf(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:s=t.indexable,_allKeys:r=t.allKeys}=e;return{allKeys:r,scriptable:n,indexable:s,isScriptable:yn(n)?n:()=>n,isIndexable:yn(s)?s:()=>s}}const s2=(e,t)=>e?e+Nl(t):t,zl=(e,t)=>ie(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Jf(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const s=n();return e[t]=s,s}function r2(e,t,n){const{_proxy:s,_context:r,_subProxy:o,_descriptors:i}=e;let a=s[t];return yn(a)&&i.isScriptable(t)&&(a=o2(t,a,e,n)),je(a)&&a.length&&(a=i2(t,a,e,i.isIndexable)),zl(t,a)&&(a=Is(a,r,o&&o[t],i)),a}function o2(e,t,n,s){const{_proxy:r,_context:o,_subProxy:i,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let d=t(o,i||s);return a.delete(e),zl(e,d)&&(d=Wl(r._scopes,r,e,d)),d}function i2(e,t,n,s){const{_proxy:r,_context:o,_subProxy:i,_descriptors:a}=n;if(typeof o.index<"u"&&s(e))return t[o.index%t.length];if(ie(t[0])){const d=t,c=r._scopes.filter(u=>u!==d);t=[];for(const u of d){const h=Wl(c,r,e,u);t.push(Is(h,o,i&&i[e],a))}}return t}function em(e,t,n){return yn(e)?e(t,n):e}const a2=(e,t)=>e===!0?t:typeof e=="string"?Rn(t,e):void 0;function l2(e,t,n,s,r){for(const o of t){const i=a2(n,o);if(i){e.add(i);const a=em(i._fallback,n,r);if(typeof a<"u"&&a!==n&&a!==s)return a}else if(i===!1&&typeof s<"u"&&n!==s)return null}return!1}function Wl(e,t,n,s){const r=t._rootScopes,o=em(t._fallback,n,s),i=[...e,...r],a=new Set;a.add(s);let d=tm(a,i,n,o||n,s);return d===null||typeof o<"u"&&o!==n&&(d=tm(a,i,o,d,s),d===null)?!1:Fl(Array.from(a),[""],r,o,()=>d2(t,n,s))}function tm(e,t,n,s,r){for(;n;)n=l2(e,t,n,s,r);return n}function d2(e,t,n){const s=e._getTarget();t in s||(s[t]={});const r=s[t];return je(r)&&ie(n)?n:r||{}}function c2(e,t,n,s){let r;for(const o of t)if(r=nm(s2(o,e),n),typeof r<"u")return zl(e,r)?Wl(n,s,e,r):r}function nm(e,t){for(const n of t){if(!n)continue;const s=n[e];if(typeof s<"u")return s}}function sm(e){let t=e._keys;return t||(t=e._keys=u2(e._scopes)),t}function u2(e){const t=new Set;for(const n of e)for(const s of Object.keys(n).filter(r=>!r.startsWith("_")))t.add(s);return Array.from(t)}const h2=Number.EPSILON||1e-14,Os=(e,t)=>t<e.length&&!e[t].skip&&e[t],rm=e=>e==="x"?"y":"x";function f2(e,t,n,s){const r=e.skip?t:e,o=t,i=n.skip?t:n,a=Ml(o,r),d=Ml(i,o);let c=a/(a+d),u=d/(a+d);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const h=s*c,m=s*u;return{previous:{x:o.x-h*(i.x-r.x),y:o.y-h*(i.y-r.y)},next:{x:o.x+m*(i.x-r.x),y:o.y+m*(i.y-r.y)}}}function m2(e,t,n){const s=e.length;let r,o,i,a,d,c=Os(e,0);for(let u=0;u<s-1;++u)if(d=c,c=Os(e,u+1),!(!d||!c)){if(jr(t[u],0,h2)){n[u]=n[u+1]=0;continue}r=n[u]/t[u],o=n[u+1]/t[u],a=Math.pow(r,2)+Math.pow(o,2),!(a<=9)&&(i=3/Math.sqrt(a),n[u]=r*i*t[u],n[u+1]=o*i*t[u])}}function p2(e,t,n="x"){const s=rm(n),r=e.length;let o,i,a,d=Os(e,0);for(let c=0;c<r;++c){if(i=a,a=d,d=Os(e,c+1),!a)continue;const u=a[n],h=a[s];i&&(o=(u-i[n])/3,a[`cp1${n}`]=u-o,a[`cp1${s}`]=h-o*t[c]),d&&(o=(d[n]-u)/3,a[`cp2${n}`]=u+o,a[`cp2${s}`]=h+o*t[c])}}function g2(e,t="x"){const n=rm(t),s=e.length,r=Array(s).fill(0),o=Array(s);let i,a,d,c=Os(e,0);for(i=0;i<s;++i)if(a=d,d=c,c=Os(e,i+1),!!d){if(c){const u=c[t]-d[t];r[i]=u!==0?(c[n]-d[n])/u:0}o[i]=a?c?Ht(r[i-1])!==Ht(r[i])?0:(r[i-1]+r[i])/2:r[i-1]:r[i]}m2(e,r,o),p2(e,o,t)}function ai(e,t,n){return Math.max(Math.min(e,n),t)}function b2(e,t){let n,s,r,o,i,a=nn(e[0],t);for(n=0,s=e.length;n<s;++n)i=o,o=a,a=n<s-1&&nn(e[n+1],t),o&&(r=e[n],i&&(r.cp1x=ai(r.cp1x,t.left,t.right),r.cp1y=ai(r.cp1y,t.top,t.bottom)),a&&(r.cp2x=ai(r.cp2x,t.left,t.right),r.cp2y=ai(r.cp2y,t.top,t.bottom)))}function x2(e,t,n,s,r){let o,i,a,d;if(t.spanGaps&&(e=e.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")g2(e,r);else{let c=s?e[e.length-1]:e[0];for(o=0,i=e.length;o<i;++o)a=e[o],d=f2(c,a,e[Math.min(o+1,i-(s?0:1))%i],t.tension),a.cp1x=d.previous.x,a.cp1y=d.previous.y,a.cp2x=d.next.x,a.cp2y=d.next.y,c=a}t.capBezierPoints&&b2(e,n)}function Bl(){return typeof window<"u"&&typeof document<"u"}function Hl(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function li(e,t,n){let s;return typeof e=="string"?(s=parseInt(e,10),e.indexOf("%")!==-1&&(s=s/100*t.parentNode[n])):s=e,s}const di=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function w2(e,t){return di(e).getPropertyValue(t)}const _2=["top","right","bottom","left"];function Qn(e,t,n){const s={};n=n?"-"+n:"";for(let r=0;r<4;r++){const o=_2[r];s[o]=parseFloat(e[t+"-"+o+n])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const y2=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function v2(e,t){const n=e.touches,s=n&&n.length?n[0]:e,{offsetX:r,offsetY:o}=s;let i=!1,a,d;if(y2(r,o,e.target))a=r,d=o;else{const c=t.getBoundingClientRect();a=s.clientX-c.left,d=s.clientY-c.top,i=!0}return{x:a,y:d,box:i}}function Zn(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:s}=t,r=di(n),o=r.boxSizing==="border-box",i=Qn(r,"padding"),a=Qn(r,"border","width"),{x:d,y:c,box:u}=v2(e,n),h=i.left+(u&&a.left),m=i.top+(u&&a.top);let{width:f,height:g}=t;return o&&(f-=i.width+a.width,g-=i.height+a.height),{x:Math.round((d-h)/f*n.width/s),y:Math.round((c-m)/g*n.height/s)}}function k2(e,t,n){let s,r;if(t===void 0||n===void 0){const o=e&&Hl(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const i=o.getBoundingClientRect(),a=di(o),d=Qn(a,"border","width"),c=Qn(a,"padding");t=i.width-c.width-d.width,n=i.height-c.height-d.height,s=li(a.maxWidth,o,"clientWidth"),r=li(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:s||Jo,maxHeight:r||Jo}}const jn=e=>Math.round(e*10)/10;function j2(e,t,n,s){const r=di(e),o=Qn(r,"margin"),i=li(r.maxWidth,e,"clientWidth")||Jo,a=li(r.maxHeight,e,"clientHeight")||Jo,d=k2(e,t,n);let{width:c,height:u}=d;if(r.boxSizing==="content-box"){const m=Qn(r,"border","width"),f=Qn(r,"padding");c-=f.width+m.width,u-=f.height+m.height}return c=Math.max(0,c-o.width),u=Math.max(0,s?c/s:u-o.height),c=jn(Math.min(c,i,d.maxWidth)),u=jn(Math.min(u,a,d.maxHeight)),c&&!u&&(u=jn(c/2)),(t!==void 0||n!==void 0)&&s&&d.height&&u>d.height&&(u=d.height,c=jn(Math.floor(u*s))),{width:c,height:u}}function om(e,t,n){const s=t||1,r=jn(e.height*s),o=jn(e.width*s);e.height=jn(e.height),e.width=jn(e.width);const i=e.canvas;return i.style&&(n||!i.style.height&&!i.style.width)&&(i.style.height=`${e.height}px`,i.style.width=`${e.width}px`),e.currentDevicePixelRatio!==s||i.height!==r||i.width!==o?(e.currentDevicePixelRatio=s,i.height=r,i.width=o,e.ctx.setTransform(s,0,0,s,0,0),!0):!1}const S2=function(){let e=!1;try{const t={get passive(){return e=!0,!1}};Bl()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e}();function im(e,t){const n=w2(e,t),s=n&&n.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function Jn(e,t,n,s){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function N2(e,t,n,s){return{x:e.x+n*(t.x-e.x),y:s==="middle"?n<.5?e.y:t.y:s==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function C2(e,t,n,s){const r={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},i=Jn(e,r,n),a=Jn(r,o,n),d=Jn(o,t,n),c=Jn(i,a,n),u=Jn(a,d,n);return Jn(c,u,n)}const M2=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,s){return n-s},leftForLtr(n,s){return n-s}}},E2=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Ls(e,t,n){return e?M2(t,n):E2()}function am(e,t){let n,s;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,s=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=s)}function lm(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function dm(e){return e==="angle"?{between:Nr,compare:Mk,normalize:Je}:{between:tn,compare:(t,n)=>t-n,normalize:t=>t}}function cm({start:e,end:t,count:n,loop:s,style:r}){return{start:e%n,end:t%n,loop:s&&(t-e+1)%n===0,style:r}}function P2(e,t,n){const{property:s,start:r,end:o}=n,{between:i,normalize:a}=dm(s),d=t.length;let{start:c,end:u,loop:h}=e,m,f;if(h){for(c+=d,u+=d,m=0,f=d;m<f&&i(a(t[c%d][s]),r,o);++m)c--,u--;c%=d,u%=d}return u<c&&(u+=d),{start:c,end:u,loop:h,style:e.style}}function um(e,t,n){if(!n)return[e];const{property:s,start:r,end:o}=n,i=t.length,{compare:a,between:d,normalize:c}=dm(s),{start:u,end:h,loop:m,style:f}=P2(e,t,n),g=[];let b=!1,x=null,w,_,y;const v=()=>d(r,y,w)&&a(r,y)!==0,j=()=>a(o,w)===0||d(o,y,w),k=()=>b||v(),M=()=>!b||j();for(let N=u,T=u;N<=h;++N)_=t[N%i],!_.skip&&(w=c(_[s]),w!==y&&(b=d(w,r,o),x===null&&k()&&(x=a(w,r)===0?N:T),x!==null&&M()&&(g.push(cm({start:x,end:N,loop:m,count:i,style:f})),x=null),T=N,y=w));return x!==null&&g.push(cm({start:x,end:h,loop:m,count:i,style:f})),g}function hm(e,t){const n=[],s=e.segments;for(let r=0;r<s.length;r++){const o=um(s[r],e.points,t);o.length&&n.push(...o)}return n}function T2(e,t,n,s){let r=0,o=t-1;if(n&&!s)for(;r<t&&!e[r].skip;)r++;for(;r<t&&e[r].skip;)r++;for(r%=t,n&&(o+=r);o>r&&e[o%t].skip;)o--;return o%=t,{start:r,end:o}}function D2(e,t,n,s){const r=e.length,o=[];let i=t,a=e[t],d;for(d=t+1;d<=n;++d){const c=e[d%r];c.skip||c.stop?a.skip||(s=!1,o.push({start:t%r,end:(d-1)%r,loop:s}),t=i=c.stop?d:null):(i=d,a.skip&&(t=d)),a=c}return i!==null&&o.push({start:t%r,end:i%r,loop:s}),o}function I2(e,t){const n=e.points,s=e.options.spanGaps,r=n.length;if(!r)return[];const o=!!e._loop,{start:i,end:a}=T2(n,r,o,s);if(s===!0)return fm(e,[{start:i,end:a,loop:o}],n,t);const d=a<i?a+r:a,c=!!e._fullLoop&&i===0&&a===r-1;return fm(e,D2(n,i,d,c),n,t)}function fm(e,t,n,s){return!s||!s.setContext||!n?t:O2(e,t,n,s)}function O2(e,t,n,s){const r=e._chart.getContext(),o=mm(e.options),{_datasetIndex:i,options:{spanGaps:a}}=e,d=n.length,c=[];let u=o,h=t[0].start,m=h;function f(g,b,x,w){const _=a?-1:1;if(g!==b){for(g+=d;n[g%d].skip;)g-=_;for(;n[b%d].skip;)b+=_;g%d!==b%d&&(c.push({start:g%d,end:b%d,loop:x,style:w}),u=w,h=b%d)}}for(const g of t){h=a?h:g.start;let b=n[h%d],x;for(m=h+1;m<=g.end;m++){const w=n[m%d];x=mm(s.setContext(kn(r,{type:"segment",p0:b,p1:w,p0DataIndex:(m-1)%d,p1DataIndex:m%d,datasetIndex:i}))),L2(x,u)&&f(h,m-1,g.loop,u),b=w,u=x}h<m-1&&f(h,m-1,g.loop,u)}return c}function mm(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function L2(e,t){if(!t)return!1;const n=[],s=function(r,o){return Tl(o)?(n.includes(o)||n.push(o),n.indexOf(o)):o};return JSON.stringify(e,s)!==JSON.stringify(t,s)}function ci(e,t,n){return e.options.clip?e[n]:t[n]}function A2(e,t){const{xScale:n,yScale:s}=e;return n&&s?{left:ci(n,t,"left"),right:ci(n,t,"right"),top:ci(s,t,"top"),bottom:ci(s,t,"bottom")}:t}function pm(e,t){const n=t._clip;if(n.disabled)return!1;const s=A2(t,e.chartArea);return{left:n.left===!1?0:s.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:s.right+(n.right===!0?0:n.right),top:n.top===!1?0:s.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:s.bottom+(n.bottom===!0?0:n.bottom)}}/*!
 * Chart.js v4.5.1
 * https://www.chartjs.org
 * (c) 2025 Chart.js Contributors
 * Released under the MIT License
 */class F2{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,s,r){const o=n.listeners[r],i=n.duration;o.forEach(a=>a({chart:t,initial:n.initial,numSteps:i,currentStep:Math.min(s-n.start,i)}))}_refresh(){this._request||(this._running=!0,this._request=Vf.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((s,r)=>{if(!s.running||!s.items.length)return;const o=s.items;let i=o.length-1,a=!1,d;for(;i>=0;--i)d=o[i],d._active?(d._total>s.duration&&(s.duration=d._total),d.tick(t),a=!0):(o[i]=o[o.length-1],o.pop());a&&(r.draw(),this._notify(r,s,t,"progress")),o.length||(s.running=!1,this._notify(r,s,t,"complete"),s.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let s=n.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,s)),s}listen(t,n,s){this._getAnims(t).listeners[n].push(s)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((s,r)=>Math.max(s,r._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const s=n.items;let r=s.length-1;for(;r>=0;--r)s[r].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var sn=new F2;const gm="transparent",z2={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const s=qf(e||gm),r=s.valid&&qf(t||gm);return r&&r.valid?r.mix(s,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class W2{constructor(t,n,s,r){const o=n[s];r=ii([t.to,r,o,t.from]);const i=ii([t.from,o,r]);this._active=!0,this._fn=t.fn||z2[t.type||typeof i],this._easing=Cr[t.easing]||Cr.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=s,this._from=i,this._to=r,this._promises=void 0}active(){return this._active}update(t,n,s){if(this._active){this._notify(!1);const r=this._target[this._prop],o=s-this._start,i=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(i,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=ii([t.to,n,r,t.from]),this._from=ii([t.from,r,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,s=this._duration,r=this._prop,o=this._from,i=this._loop,a=this._to;let d;if(this._active=o!==a&&(i||n<s),!this._active){this._target[r]=a,this._notify(!0);return}if(n<0){this._target[r]=o;return}d=n/s%2,d=i&&d>1?2-d:d,d=this._easing(Math.min(1,Math.max(0,d))),this._target[r]=this._fn(o,a,d)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,s)=>{t.push({res:n,rej:s})})}_notify(t){const n=t?"res":"rej",s=this._promises||[];for(let r=0;r<s.length;r++)s[r][n]()}}class bm{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!ie(t))return;const n=Object.keys(Te.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(r=>{const o=t[r];if(!ie(o))return;const i={};for(const a of n)i[a]=o[a];(je(o.properties)&&o.properties||[r]).forEach(a=>{(a===r||!s.has(a))&&s.set(a,i)})})}_animateOptions(t,n){const s=n.options,r=H2(t,s);if(!r)return[];const o=this._createAnimations(r,s);return s.$shared&&B2(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,n){const s=this._properties,r=[],o=t.$animations||(t.$animations={}),i=Object.keys(n),a=Date.now();let d;for(d=i.length-1;d>=0;--d){const c=i[d];if(c.charAt(0)==="$")continue;if(c==="options"){r.push(...this._animateOptions(t,n));continue}const u=n[c];let h=o[c];const m=s.get(c);if(h)if(m&&h.active()){h.update(m,u,a);continue}else h.cancel();if(!m||!m.duration){t[c]=u;continue}o[c]=h=new W2(m,t,c,u),r.push(h)}return r}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const s=this._createAnimations(t,n);if(s.length)return sn.add(this._chart,s),!0}}function B2(e,t){const n=[],s=Object.keys(t);for(let r=0;r<s.length;r++){const o=e[s[r]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function H2(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function xm(e,t){const n=e&&e.options||{},s=n.reverse,r=n.min===void 0?t:0,o=n.max===void 0?t:0;return{start:s?o:r,end:s?r:o}}function V2(e,t,n){if(n===!1)return!1;const s=xm(e,n),r=xm(t,n);return{top:r.end,right:s.end,bottom:r.start,left:s.start}}function U2(e){let t,n,s,r;return ie(e)?(t=e.top,n=e.right,s=e.bottom,r=e.left):t=n=s=r=e,{top:t,right:n,bottom:s,left:r,disabled:e===!1}}function wm(e,t){const n=[],s=e._getSortedDatasetMetas(t);let r,o;for(r=0,o=s.length;r<o;++r)n.push(s[r].index);return n}function _m(e,t,n,s={}){const r=e.keys,o=s.mode==="single";let i,a,d,c;if(t===null)return;let u=!1;for(i=0,a=r.length;i<a;++i){if(d=+r[i],d===n){if(u=!0,s.all)continue;break}c=e.values[d],Pe(c)&&(o||t===0||Ht(t)===Ht(c))&&(t+=c)}return!u&&!s.all?0:t}function R2(e,t){const{iScale:n,vScale:s}=t,r=n.axis==="x"?"x":"y",o=s.axis==="x"?"x":"y",i=Object.keys(e),a=new Array(i.length);let d,c,u;for(d=0,c=i.length;d<c;++d)u=i[d],a[d]={[r]:u,[o]:e[u]};return a}function Vl(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function $2(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function q2(e){const{min:t,max:n,minDefined:s,maxDefined:r}=e.getUserBounds();return{min:s?t:Number.NEGATIVE_INFINITY,max:r?n:Number.POSITIVE_INFINITY}}function Y2(e,t,n){const s=e[t]||(e[t]={});return s[n]||(s[n]={})}function ym(e,t,n,s){for(const r of t.getMatchingVisibleMetas(s).reverse()){const o=e[r.index];if(n&&o>0||!n&&o<0)return r.index}return null}function vm(e,t){const{chart:n,_cachedMeta:s}=e,r=n._stacks||(n._stacks={}),{iScale:o,vScale:i,index:a}=s,d=o.axis,c=i.axis,u=$2(o,i,s),h=t.length;let m;for(let f=0;f<h;++f){const g=t[f],{[d]:b,[c]:x}=g,w=g._stacks||(g._stacks={});m=w[c]=Y2(r,u,b),m[a]=x,m._top=ym(m,i,!0,s.type),m._bottom=ym(m,i,!1,s.type);const _=m._visualValues||(m._visualValues={});_[a]=x}}function Ul(e,t){const n=e.scales;return Object.keys(n).filter(s=>n[s].axis===t).shift()}function K2(e,t){return kn(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function G2(e,t,n){return kn(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function Pr(e,t){const n=e.controller.index,s=e.vScale&&e.vScale.axis;if(s){t=t||e._parsed;for(const r of t){const o=r._stacks;if(!o||o[s]===void 0||o[s][n]===void 0)return;delete o[s][n],o[s]._visualValues!==void 0&&o[s]._visualValues[n]!==void 0&&delete o[s]._visualValues[n]}}}const Rl=e=>e==="reset"||e==="none",km=(e,t)=>t?e:Object.assign({},e),X2=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:wm(n,!0),values:null};class es{constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Vl(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Pr(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,s=this.getDataset(),r=(h,m,f,g)=>h==="x"?m:h==="r"?g:f,o=n.xAxisID=se(s.xAxisID,Ul(t,"x")),i=n.yAxisID=se(s.yAxisID,Ul(t,"y")),a=n.rAxisID=se(s.rAxisID,Ul(t,"r")),d=n.indexAxis,c=n.iAxisID=r(d,o,i,a),u=n.vAxisID=r(d,i,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(i),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Bf(this._data,this),t._stacked&&Pr(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),s=this._data;if(ie(n)){const r=this._cachedMeta;this._data=R2(n,r)}else if(s!==n){if(s){Bf(s,this);const r=this._cachedMeta;Pr(r),r._parsed=[]}n&&Object.isExtensible(n)&&Dk(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,s=this.getDataset();let r=!1;this._dataCheck();const o=n._stacked;n._stacked=Vl(n.vScale,n),n.stack!==s.stack&&(r=!0,Pr(n),n.stack=s.stack),this._resyncElements(t),(r||o!==n._stacked)&&(vm(this,n._parsed),n._stacked=Vl(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:s,_data:r}=this,{iScale:o,_stacked:i}=s,a=o.axis;let d=t===0&&n===r.length?!0:s._sorted,c=t>0&&s._parsed[t-1],u,h,m;if(this._parsing===!1)s._parsed=r,s._sorted=!0,m=r;else{je(r[t])?m=this.parseArrayData(s,r,t,n):ie(r[t])?m=this.parseObjectData(s,r,t,n):m=this.parsePrimitiveData(s,r,t,n);const f=()=>h[a]===null||c&&h[a]<c[a];for(u=0;u<n;++u)s._parsed[u+t]=h=m[u],d&&(f()&&(d=!1),c=h);s._sorted=d}i&&vm(this,m)}parsePrimitiveData(t,n,s,r){const{iScale:o,vScale:i}=t,a=o.axis,d=i.axis,c=o.getLabels(),u=o===i,h=new Array(r);let m,f,g;for(m=0,f=r;m<f;++m)g=m+s,h[m]={[a]:u||o.parse(c[g],g),[d]:i.parse(n[g],g)};return h}parseArrayData(t,n,s,r){const{xScale:o,yScale:i}=t,a=new Array(r);let d,c,u,h;for(d=0,c=r;d<c;++d)u=d+s,h=n[u],a[d]={x:o.parse(h[0],u),y:i.parse(h[1],u)};return a}parseObjectData(t,n,s,r){const{xScale:o,yScale:i}=t,{xAxisKey:a="x",yAxisKey:d="y"}=this._parsing,c=new Array(r);let u,h,m,f;for(u=0,h=r;u<h;++u)m=u+s,f=n[m],c[u]={x:o.parse(Rn(f,a),m),y:i.parse(Rn(f,d),m)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,s){const r=this.chart,o=this._cachedMeta,i=n[t.axis],a={keys:wm(r,!0),values:n._stacks[t.axis]._visualValues};return _m(a,i,o.index,{mode:s})}updateRangeFromParsed(t,n,s,r){const o=s[n.axis];let i=o===null?NaN:o;const a=r&&s._stacks[n.axis];r&&a&&(r.values=a,i=_m(r,o,this._cachedMeta.index)),t.min=Math.min(t.min,i),t.max=Math.max(t.max,i)}getMinMax(t,n){const s=this._cachedMeta,r=s._parsed,o=s._sorted&&t===s.iScale,i=r.length,a=this._getOtherScale(t),d=X2(n,s,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:h}=q2(a);let m,f;function g(){f=r[m];const b=f[a.axis];return!Pe(f[t.axis])||u>b||h<b}for(m=0;m<i&&!(!g()&&(this.updateRangeFromParsed(c,t,f,d),o));++m);if(o){for(m=i-1;m>=0;--m)if(!g()){this.updateRangeFromParsed(c,t,f,d);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,s=[];let r,o,i;for(r=0,o=n.length;r<o;++r)i=n[r][t.axis],Pe(i)&&s.push(i);return s}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,s=n.iScale,r=n.vScale,o=this.getParsed(t);return{label:s?""+s.getLabelForValue(o[s.axis]):"",value:r?""+r.getLabelForValue(o[r.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=U2(se(this.options.clip,V2(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,s=this._cachedMeta,r=s.data||[],o=n.chartArea,i=[],a=this._drawStart||0,d=this._drawCount||r.length-a,c=this.options.drawActiveElementsOnTop;let u;for(s.dataset&&s.dataset.draw(t,o,a,d),u=a;u<a+d;++u){const h=r[u];h.hidden||(h.active&&c?i.push(h):h.draw(t,o))}for(u=0;u<i.length;++u)i[u].draw(t,o)}getStyle(t,n){const s=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(s):this.resolveDataElementOptions(t||0,s)}getContext(t,n,s){const r=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const i=this._cachedMeta.data[t];o=i.$context||(i.$context=G2(this.getContext(),t,i)),o.parsed=this.getParsed(t),o.raw=r.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=K2(this.chart.getContext(),this.index)),o.dataset=r,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=s,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",s){const r=n==="active",o=this._cachedDataOpts,i=t+"-"+n,a=o[i],d=this.enableOptionSharing&&kr(s);if(a)return km(a,d);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),h=r?[`${t}Hover`,"hover",t,""]:[t,""],m=c.getOptionScopes(this.getDataset(),u),f=Object.keys(Te.elements[t]),g=()=>this.getContext(s,r,n),b=c.resolveNamedOptions(m,f,g,h);return b.$shared&&(b.$shared=d,o[i]=Object.freeze(km(b,d))),b}_resolveAnimations(t,n,s){const r=this.chart,o=this._cachedDataOpts,i=`animation-${n}`,a=o[i];if(a)return a;let d;if(r.options.animation!==!1){const u=this.chart.config,h=u.datasetAnimationScopeKeys(this._type,n),m=u.getOptionScopes(this.getDataset(),h);d=u.createResolver(m,this.getContext(t,s,n))}const c=new bm(r,d&&d.animations);return d&&d._cacheable&&(o[i]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||Rl(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const s=this.resolveDataElementOptions(t,n),r=this._sharedOptions,o=this.getSharedOptions(s),i=this.includeOptions(n,o)||o!==r;return this.updateSharedOptions(o,n,s),{sharedOptions:o,includeOptions:i}}updateElement(t,n,s,r){Rl(r)?Object.assign(t,s):this._resolveAnimations(n,r).update(t,s)}updateSharedOptions(t,n,s){t&&!Rl(n)&&this._resolveAnimations(void 0,n).update(t,s)}_setStyle(t,n,s,r){t.active=r;const o=this.getStyle(n,r);this._resolveAnimations(n,s,r).update(t,{options:!r&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,n,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,s=this._cachedMeta.data;for(const[a,d,c]of this._syncList)this[a](d,c);this._syncList=[];const r=s.length,o=n.length,i=Math.min(o,r);i&&this.parse(0,i),o>r?this._insertElements(r,o-r,t):o<r&&this._removeElements(o,r-o)}_insertElements(t,n,s=!0){const r=this._cachedMeta,o=r.data,i=t+n;let a;const d=c=>{for(c.length+=n,a=c.length-1;a>=i;a--)c[a]=c[a-n]};for(d(o),a=t;a<i;++a)o[a]=new this.dataElementType;this._parsing&&d(r._parsed),this.parse(t,n),s&&this.updateElements(o,t,n,"reset")}updateElements(t,n,s,r){}_removeElements(t,n){const s=this._cachedMeta;if(this._parsing){const r=s._parsed.splice(t,n);s._stacked&&Pr(s,r)}s.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,s,r]=t;this[n](s,r)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const s=arguments.length-2;s&&this._sync(["_insertElements",t,s])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}I(es,"defaults",{}),I(es,"datasetElementType",null),I(es,"dataElementType",null);function Q2(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let s=[];for(let r=0,o=n.length;r<o;r++)s=s.concat(n[r].controller.getAllParsedValues(e));e._cache.$bar=Hf(s.sort((r,o)=>r-o))}return e._cache.$bar}function Z2(e){const t=e.iScale,n=Q2(t,e.type);let s=t._length,r,o,i,a;const d=()=>{i===32767||i===-32768||(kr(a)&&(s=Math.min(s,Math.abs(i-a)||s)),a=i)};for(r=0,o=n.length;r<o;++r)i=t.getPixelForValue(n[r]),d();for(a=void 0,r=0,o=t.ticks.length;r<o;++r)i=t.getPixelForTick(r),d();return s}function J2(e,t,n,s){const r=n.barThickness;let o,i;return ce(r)?(o=t.min*n.categoryPercentage,i=n.barPercentage):(o=r*s,i=1),{chunk:o/s,ratio:i,start:t.pixels[e]-o/2}}function e1(e,t,n,s){const r=t.pixels,o=r[e];let i=e>0?r[e-1]:null,a=e<r.length-1?r[e+1]:null;const d=n.categoryPercentage;i===null&&(i=o-(a===null?t.end-t.start:a-o)),a===null&&(a=o+o-i);const c=o-(o-Math.min(i,a))/2*d;return{chunk:Math.abs(a-i)/2*d/s,ratio:n.barPercentage,start:c}}function t1(e,t,n,s){const r=n.parse(e[0],s),o=n.parse(e[1],s),i=Math.min(r,o),a=Math.max(r,o);let d=i,c=a;Math.abs(i)>Math.abs(a)&&(d=a,c=i),t[n.axis]=c,t._custom={barStart:d,barEnd:c,start:r,end:o,min:i,max:a}}function jm(e,t,n,s){return je(e)?t1(e,t,n,s):t[n.axis]=n.parse(e,s),t}function Sm(e,t,n,s){const r=e.iScale,o=e.vScale,i=r.getLabels(),a=r===o,d=[];let c,u,h,m;for(c=n,u=n+s;c<u;++c)m=t[c],h={},h[r.axis]=a||r.parse(i[c],c),d.push(jm(m,h,o,c));return d}function $l(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function n1(e,t,n){return e!==0?Ht(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}function s1(e){let t,n,s,r,o;return e.horizontal?(t=e.base>e.x,n="left",s="right"):(t=e.base<e.y,n="bottom",s="top"),t?(r="end",o="start"):(r="start",o="end"),{start:n,end:s,reverse:t,top:r,bottom:o}}function r1(e,t,n,s){let r=t.borderSkipped;const o={};if(!r){e.borderSkipped=o;return}if(r===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:i,end:a,reverse:d,top:c,bottom:u}=s1(e);r==="middle"&&n&&(e.enableBorderRadius=!0,(n._top||0)===s?r=c:(n._bottom||0)===s?r=u:(o[Nm(u,i,a,d)]=!0,r=c)),o[Nm(r,i,a,d)]=!0,e.borderSkipped=o}function Nm(e,t,n,s){return s?(e=o1(e,t,n),e=Cm(e,n,t)):e=Cm(e,t,n),e}function o1(e,t,n){return e===t?n:e===n?t:e}function Cm(e,t,n){return e==="start"?t:e==="end"?n:e}function i1(e,{inflateAmount:t},n){e.inflateAmount=t==="auto"?n===1?.33:0:t}class ui extends es{parsePrimitiveData(t,n,s,r){return Sm(t,n,s,r)}parseArrayData(t,n,s,r){return Sm(t,n,s,r)}parseObjectData(t,n,s,r){const{iScale:o,vScale:i}=t,{xAxisKey:a="x",yAxisKey:d="y"}=this._parsing,c=o.axis==="x"?a:d,u=i.axis==="x"?a:d,h=[];let m,f,g,b;for(m=s,f=s+r;m<f;++m)b=n[m],g={},g[o.axis]=o.parse(Rn(b,c),m),h.push(jm(Rn(b,u),g,i,m));return h}updateRangeFromParsed(t,n,s,r){super.updateRangeFromParsed(t,n,s,r);const o=s._custom;o&&n===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const n=this._cachedMeta,{iScale:s,vScale:r}=n,o=this.getParsed(t),i=o._custom,a=$l(i)?"["+i.start+", "+i.end+"]":""+r.getLabelForValue(o[r.axis]);return{label:""+s.getLabelForValue(o[s.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,t)}updateElements(t,n,s,r){const o=r==="reset",{index:i,_cachedMeta:{vScale:a}}=this,d=a.getBasePixel(),c=a.isHorizontal(),u=this._getRuler(),{sharedOptions:h,includeOptions:m}=this._getSharedOptions(n,r);for(let f=n;f<n+s;f++){const g=this.getParsed(f),b=o||ce(g[a.axis])?{base:d,head:d}:this._calculateBarValuePixels(f),x=this._calculateBarIndexPixels(f,u),w=(g._stacks||{})[a.axis],_={horizontal:c,base:b.base,enableBorderRadius:!w||$l(g._custom)||i===w._top||i===w._bottom,x:c?b.head:x.center,y:c?x.center:b.head,height:c?x.size:Math.abs(b.size),width:c?Math.abs(b.size):x.size};m&&(_.options=h||this.resolveDataElementOptions(f,t[f].active?"active":r));const y=_.options||t[f].options;r1(_,y,w,i),i1(_,y,u.ratio),this.updateElement(t[f],f,_,r)}}_getStacks(t,n){const{iScale:s}=this._cachedMeta,r=s.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),o=s.options.stacked,i=[],a=this._cachedMeta.controller.getParsed(n),d=a&&a[s.axis],c=u=>{const h=u._parsed.find(f=>f[s.axis]===d),m=h&&h[u.vScale.axis];if(ce(m)||isNaN(m))return!0};for(const u of r)if(!(n!==void 0&&c(u))&&((o===!1||i.indexOf(u.stack)===-1||o===void 0&&u.stack===void 0)&&i.push(u.stack),u.index===t))break;return i.length||i.push(void 0),i}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(t).filter(s=>t[s].axis===n).shift()}_getAxis(){const t={},n=this.getFirstScaleIdForIndexAxis();for(const s of this.chart.data.datasets)t[se(this.chart.options.indexAxis==="x"?s.xAxisID:s.yAxisID,n)]=!0;return Object.keys(t)}_getStackIndex(t,n,s){const r=this._getStacks(t,s),o=n!==void 0?r.indexOf(n):-1;return o===-1?r.length-1:o}_getRuler(){const t=this.options,n=this._cachedMeta,s=n.iScale,r=[];let o,i;for(o=0,i=n.data.length;o<i;++o)r.push(s.getPixelForValue(this.getParsed(o)[s.axis],o));const a=t.barThickness;return{min:a||Z2(n),pixels:r,start:s._startPixel,end:s._endPixel,stackCount:this._getStackCount(),scale:s,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:n,_stacked:s,index:r},options:{base:o,minBarLength:i}}=this,a=o||0,d=this.getParsed(t),c=d._custom,u=$l(c);let h=d[n.axis],m=0,f=s?this.applyStack(n,d,s):h,g,b;f!==h&&(m=f-h,f=h),u&&(h=c.barStart,f=c.barEnd-c.barStart,h!==0&&Ht(h)!==Ht(c.barEnd)&&(m=0),m+=h);const x=!ce(o)&&!u?o:m;let w=n.getPixelForValue(x);if(this.chart.getDataVisibility(t)?g=n.getPixelForValue(m+f):g=w,b=g-w,Math.abs(b)<i){b=n1(b,n,a)*i,h===a&&(w-=b/2);const _=n.getPixelForDecimal(0),y=n.getPixelForDecimal(1),v=Math.min(_,y),j=Math.max(_,y);w=Math.max(Math.min(w,j),v),g=w+b,s&&!u&&(d._stacks[n.axis]._visualValues[r]=n.getValueForPixel(g)-n.getValueForPixel(w))}if(w===n.getPixelForValue(a)){const _=Ht(b)*n.getLineWidthForValue(a)/2;w+=_,b-=_}return{size:b,base:w,head:g,center:g+b/2}}_calculateBarIndexPixels(t,n){const s=n.scale,r=this.options,o=r.skipNull,i=se(r.maxBarThickness,1/0);let a,d;const c=this._getAxisCount();if(n.grouped){const u=o?this._getStackCount(t):n.stackCount,h=r.barThickness==="flex"?e1(t,n,r,u*c):J2(t,n,r,u*c),m=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,f=this._getAxis().indexOf(se(m,this.getFirstScaleIdForIndexAxis())),g=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+f;a=h.start+h.chunk*g+h.chunk/2,d=Math.min(i,h.chunk*h.ratio)}else a=s.getPixelForValue(this.getParsed(t)[s.axis],t),d=Math.min(i,n.min*n.ratio);return{base:a-d/2,head:a+d/2,center:a,size:d}}draw(){const t=this._cachedMeta,n=t.vScale,s=t.data,r=s.length;let o=0;for(;o<r;++o)this.getParsed(o)[n.axis]!==null&&!s[o].hidden&&s[o].draw(this._ctx)}}I(ui,"id","bar"),I(ui,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),I(ui,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});function a1(e,t,n){let s=1,r=1,o=0,i=0;if(t<Se){const a=e,d=a+t,c=Math.cos(a),u=Math.sin(a),h=Math.cos(d),m=Math.sin(d),f=(y,v,j)=>Nr(y,a,d,!0)?1:Math.max(v,v*n,j,j*n),g=(y,v,j)=>Nr(y,a,d,!0)?-1:Math.min(v,v*n,j,j*n),b=f(0,c,h),x=f(Le,u,m),w=g(pe,c,h),_=g(pe+Le,u,m);s=(b-w)/2,r=(x-_)/2,o=-(b+w)/2,i=-(x+_)/2}return{ratioX:s,ratioY:r,offsetX:o,offsetY:i}}class As extends es{constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const s=this.getDataset().data,r=this._cachedMeta;if(this._parsing===!1)r._parsed=s;else{let o=d=>+s[d];if(ie(s[t])){const{key:d="value"}=this._parsing;o=c=>+Rn(s[c],d)}let i,a;for(i=t,a=t+n;i<a;++i)r._parsed[i]=o(i)}}_getRotation(){return Vt(this.options.rotation-90)}_getCircumference(){return Vt(this.options.circumference)}_getRotationExtents(){let t=Se,n=-Se;for(let s=0;s<this.chart.data.datasets.length;++s)if(this.chart.isDatasetVisible(s)&&this.chart.getDatasetMeta(s).type===this._type){const r=this.chart.getDatasetMeta(s).controller,o=r._getRotation(),i=r._getCircumference();t=Math.min(t,o),n=Math.max(n,o+i)}return{rotation:t,circumference:n-t}}update(t){const n=this.chart,{chartArea:s}=n,r=this._cachedMeta,o=r.data,i=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,a=Math.max((Math.min(s.width,s.height)-i)/2,0),d=Math.min(bk(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:u,rotation:h}=this._getRotationExtents(),{ratioX:m,ratioY:f,offsetX:g,offsetY:b}=a1(h,u,d),x=(s.width-i)/m,w=(s.height-i)/f,_=Math.max(Math.min(x,w)/2,0),y=Pf(this.options.radius,_),v=Math.max(y*d,0),j=(y-v)/this._getVisibleDatasetWeightTotal();this.offsetX=g*y,this.offsetY=b*y,r.total=this.calculateTotal(),this.outerRadius=y-j*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-j*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,n){const s=this.options,r=this._cachedMeta,o=this._getCircumference();return n&&s.animation.animateRotate||!this.chart.getDataVisibility(t)||r._parsed[t]===null||r.data[t].hidden?0:this.calculateCircumference(r._parsed[t]*o/Se)}updateElements(t,n,s,r){const o=r==="reset",i=this.chart,a=i.chartArea,c=i.options.animation,u=(a.left+a.right)/2,h=(a.top+a.bottom)/2,m=o&&c.animateScale,f=m?0:this.innerRadius,g=m?0:this.outerRadius,{sharedOptions:b,includeOptions:x}=this._getSharedOptions(n,r);let w=this._getRotation(),_;for(_=0;_<n;++_)w+=this._circumference(_,o);for(_=n;_<n+s;++_){const y=this._circumference(_,o),v=t[_],j={x:u+this.offsetX,y:h+this.offsetY,startAngle:w,endAngle:w+y,circumference:y,outerRadius:g,innerRadius:f};x&&(j.options=b||this.resolveDataElementOptions(_,v.active?"active":r)),w+=y,this.updateElement(v,_,j,r)}}calculateTotal(){const t=this._cachedMeta,n=t.data;let s=0,r;for(r=0;r<n.length;r++){const o=t._parsed[r];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(r)&&!n[r].hidden&&(s+=Math.abs(o))}return s}calculateCircumference(t){const n=this._cachedMeta.total;return n>0&&!isNaN(t)?Se*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,s=this.chart,r=s.data.labels||[],o=ti(n._parsed[t],s.options.locale);return{label:r[t]||"",value:o}}getMaxBorderWidth(t){let n=0;const s=this.chart;let r,o,i,a,d;if(!t){for(r=0,o=s.data.datasets.length;r<o;++r)if(s.isDatasetVisible(r)){i=s.getDatasetMeta(r),t=i.data,a=i.controller;break}}if(!t)return 0;for(r=0,o=t.length;r<o;++r)d=a.resolveDataElementOptions(r),d.borderAlign!=="inner"&&(n=Math.max(n,d.borderWidth||0,d.hoverBorderWidth||0));return n}getMaxOffset(t){let n=0;for(let s=0,r=t.length;s<r;++s){const o=this.resolveDataElementOptions(s);n=Math.max(n,o.offset||0,o.hoverOffset||0)}return n}_getRingWeightOffset(t){let n=0;for(let s=0;s<t;++s)this.chart.isDatasetVisible(s)&&(n+=this._getRingWeight(s));return n}_getRingWeight(t){return Math.max(se(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}I(As,"id","doughnut"),I(As,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),I(As,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),I(As,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data,{labels:{pointStyle:s,textAlign:r,color:o,useBorderRadius:i,borderRadius:a}}=t.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((d,c)=>{const h=t.getDatasetMeta(0).controller.getStyle(c);return{text:d,fillStyle:h.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:h.borderDash,lineDashOffset:h.borderDashOffset,lineJoin:h.borderJoinStyle,lineWidth:h.borderWidth,strokeStyle:h.borderColor,textAlign:r,pointStyle:s,borderRadius:i&&(a||h.borderRadius),index:c}}):[]}},onClick(t,n,s){s.chart.toggleDataVisibility(n.index),s.chart.update()}}}});class hi extends es{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:s,data:r=[],_dataset:o}=n,i=this.chart._animationsDisabled;let{start:a,count:d}=Lk(n,r,i);this._drawStart=a,this._drawCount=d,Ak(n)&&(a=0,d=r.length),s._chart=this.chart,s._datasetIndex=this.index,s._decimated=!!o._decimated,s.points=r;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(s,void 0,{animated:!i,options:c},t),this.updateElements(r,a,d,t)}updateElements(t,n,s,r){const o=r==="reset",{iScale:i,vScale:a,_stacked:d,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:h}=this._getSharedOptions(n,r),m=i.axis,f=a.axis,{spanGaps:g,segment:b}=this.options,x=Sr(g)?g:Number.POSITIVE_INFINITY,w=this.chart._animationsDisabled||o||r==="none",_=n+s,y=t.length;let v=n>0&&this.getParsed(n-1);for(let j=0;j<y;++j){const k=t[j],M=w?k:{};if(j<n||j>=_){M.skip=!0;continue}const N=this.getParsed(j),T=ce(N[f]),P=M[m]=i.getPixelForValue(N[m],j),E=M[f]=o||T?a.getBasePixel():a.getPixelForValue(d?this.applyStack(a,N,d):N[f],j);M.skip=isNaN(P)||isNaN(E)||T,M.stop=j>0&&Math.abs(N[m]-v[m])>x,b&&(M.parsed=N,M.raw=c.data[j]),h&&(M.options=u||this.resolveDataElementOptions(j,k.active?"active":r)),w||this.updateElement(k,j,M,r),v=N}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,s=n.options&&n.options.borderWidth||0,r=t.data||[];if(!r.length)return s;const o=r[0].size(this.resolveDataElementOptions(0)),i=r[r.length-1].size(this.resolveDataElementOptions(r.length-1));return Math.max(s,o,i)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}I(hi,"id","line"),I(hi,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),I(hi,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class ql extends As{}I(ql,"id","pie"),I(ql,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});function ts(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Yl{constructor(t){I(this,"options");this.options=t||{}}static override(t){Object.assign(Yl.prototype,t)}init(){}formats(){return ts()}parse(){return ts()}format(){return ts()}add(){return ts()}diff(){return ts()}startOf(){return ts()}endOf(){return ts()}}var Mm={_date:Yl};function l1(e,t,n,s){const{controller:r,data:o,_sorted:i}=e,a=r._cachedMeta.iScale,d=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&i&&o.length){const c=a._reversePixels?Pk:qn;if(s){if(r._sharedOptions){const u=o[0],h=typeof u.getRange=="function"&&u.getRange(t);if(h){const m=c(o,t,n-h),f=c(o,t,n+h);return{lo:m.lo,hi:f.hi}}}}else{const u=c(o,t,n);if(d){const{vScale:h}=r._cachedMeta,{_parsed:m}=e,f=m.slice(0,u.lo+1).reverse().findIndex(b=>!ce(b[h.axis]));u.lo-=Math.max(0,f);const g=m.slice(u.hi).findIndex(b=>!ce(b[h.axis]));u.hi+=Math.max(0,g)}return u}}return{lo:0,hi:o.length-1}}function Tr(e,t,n,s,r){const o=e.getSortedVisibleDatasetMetas(),i=n[t];for(let a=0,d=o.length;a<d;++a){const{index:c,data:u}=o[a],{lo:h,hi:m}=l1(o[a],t,i,r);for(let f=h;f<=m;++f){const g=u[f];g.skip||s(g,c,f)}}}function d1(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(s,r){const o=t?Math.abs(s.x-r.x):0,i=n?Math.abs(s.y-r.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(i,2))}}function Kl(e,t,n,s,r){const o=[];return!r&&!e.isPointInArea(t)||Tr(e,n,t,function(a,d,c){!r&&!nn(a,e.chartArea,0)||a.inRange(t.x,t.y,s)&&o.push({element:a,datasetIndex:d,index:c})},!0),o}function c1(e,t,n,s){let r=[];function o(i,a,d){const{startAngle:c,endAngle:u}=i.getProps(["startAngle","endAngle"],s),{angle:h}=zf(i,{x:t.x,y:t.y});Nr(h,c,u)&&r.push({element:i,datasetIndex:a,index:d})}return Tr(e,n,t,o),r}function u1(e,t,n,s,r,o){let i=[];const a=d1(n);let d=Number.POSITIVE_INFINITY;function c(u,h,m){const f=u.inRange(t.x,t.y,r);if(s&&!f)return;const g=u.getCenterPoint(r);if(!(!!o||e.isPointInArea(g))&&!f)return;const x=a(t,g);x<d?(i=[{element:u,datasetIndex:h,index:m}],d=x):x===d&&i.push({element:u,datasetIndex:h,index:m})}return Tr(e,n,t,c),i}function Gl(e,t,n,s,r,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!s?c1(e,t,n,r):u1(e,t,n,s,r,o)}function Em(e,t,n,s,r){const o=[],i=n==="x"?"inXRange":"inYRange";let a=!1;return Tr(e,n,t,(d,c,u)=>{d[i]&&d[i](t[n],r)&&(o.push({element:d,datasetIndex:c,index:u}),a=a||d.inRange(t.x,t.y,r))}),s&&!a?[]:o}var h1={evaluateInteractionItems:Tr,modes:{index(e,t,n,s){const r=Zn(t,e),o=n.axis||"x",i=n.includeInvisible||!1,a=n.intersect?Kl(e,r,o,s,i):Gl(e,r,o,!1,s,i),d=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,h=c.data[u];h&&!h.skip&&d.push({element:h,datasetIndex:c.index,index:u})}),d):[]},dataset(e,t,n,s){const r=Zn(t,e),o=n.axis||"xy",i=n.includeInvisible||!1;let a=n.intersect?Kl(e,r,o,s,i):Gl(e,r,o,!1,s,i);if(a.length>0){const d=a[0].datasetIndex,c=e.getDatasetMeta(d).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:d,index:u})}return a},point(e,t,n,s){const r=Zn(t,e),o=n.axis||"xy",i=n.includeInvisible||!1;return Kl(e,r,o,s,i)},nearest(e,t,n,s){const r=Zn(t,e),o=n.axis||"xy",i=n.includeInvisible||!1;return Gl(e,r,o,n.intersect,s,i)},x(e,t,n,s){const r=Zn(t,e);return Em(e,r,"x",n.intersect,s)},y(e,t,n,s){const r=Zn(t,e);return Em(e,r,"y",n.intersect,s)}}};const Pm=["left","top","right","bottom"];function Dr(e,t){return e.filter(n=>n.pos===t)}function Tm(e,t){return e.filter(n=>Pm.indexOf(n.pos)===-1&&n.box.axis===t)}function Ir(e,t){return e.sort((n,s)=>{const r=t?s:n,o=t?n:s;return r.weight===o.weight?r.index-o.index:r.weight-o.weight})}function f1(e){const t=[];let n,s,r,o,i,a;for(n=0,s=(e||[]).length;n<s;++n)r=e[n],{position:o,options:{stack:i,stackWeight:a=1}}=r,t.push({index:n,box:r,pos:o,horizontal:r.isHorizontal(),weight:r.weight,stack:i&&o+i,stackWeight:a});return t}function m1(e){const t={};for(const n of e){const{stack:s,pos:r,stackWeight:o}=n;if(!s||!Pm.includes(r))continue;const i=t[s]||(t[s]={count:0,placed:0,weight:0,size:0});i.count++,i.weight+=o}return t}function p1(e,t){const n=m1(e),{vBoxMaxWidth:s,hBoxMaxHeight:r}=t;let o,i,a;for(o=0,i=e.length;o<i;++o){a=e[o];const{fullSize:d}=a.box,c=n[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*s:d&&t.availableWidth,a.height=r):(a.width=s,a.height=u?u*r:d&&t.availableHeight)}return n}function g1(e){const t=f1(e),n=Ir(t.filter(c=>c.box.fullSize),!0),s=Ir(Dr(t,"left"),!0),r=Ir(Dr(t,"right")),o=Ir(Dr(t,"top"),!0),i=Ir(Dr(t,"bottom")),a=Tm(t,"x"),d=Tm(t,"y");return{fullSize:n,leftAndTop:s.concat(o),rightAndBottom:r.concat(d).concat(i).concat(a),chartArea:Dr(t,"chartArea"),vertical:s.concat(r).concat(d),horizontal:o.concat(i).concat(a)}}function Dm(e,t,n,s){return Math.max(e[n],t[n])+Math.max(e[s],t[s])}function Im(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function b1(e,t,n,s){const{pos:r,box:o}=n,i=e.maxPadding;if(!ie(r)){n.size&&(e[r]-=n.size);const h=s[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?o.height:o.width),n.size=h.size/h.count,e[r]+=n.size}o.getPadding&&Im(i,o.getPadding());const a=Math.max(0,t.outerWidth-Dm(i,e,"left","right")),d=Math.max(0,t.outerHeight-Dm(i,e,"top","bottom")),c=a!==e.w,u=d!==e.h;return e.w=a,e.h=d,n.horizontal?{same:c,other:u}:{same:u,other:c}}function x1(e){const t=e.maxPadding;function n(s){const r=Math.max(t[s]-e[s],0);return e[s]+=r,r}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function w1(e,t){const n=t.maxPadding;function s(r){const o={left:0,top:0,right:0,bottom:0};return r.forEach(i=>{o[i]=Math.max(t[i],n[i])}),o}return s(e?["left","right"]:["top","bottom"])}function Or(e,t,n,s){const r=[];let o,i,a,d,c,u;for(o=0,i=e.length,c=0;o<i;++o){a=e[o],d=a.box,d.update(a.width||t.w,a.height||t.h,w1(a.horizontal,t));const{same:h,other:m}=b1(t,n,a,s);c|=h&&r.length,u=u||m,d.fullSize||r.push(a)}return c&&Or(r,t,n,s)||u}function fi(e,t,n,s,r){e.top=n,e.left=t,e.right=t+s,e.bottom=n+r,e.width=s,e.height=r}function Om(e,t,n,s){const r=n.padding;let{x:o,y:i}=t;for(const a of e){const d=a.box,c=s[a.stack]||{count:1,placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){const h=t.w*u,m=c.size||d.height;kr(c.start)&&(i=c.start),d.fullSize?fi(d,r.left,i,n.outerWidth-r.right-r.left,m):fi(d,t.left+c.placed,i,h,m),c.start=i,c.placed+=h,i=d.bottom}else{const h=t.h*u,m=c.size||d.width;kr(c.start)&&(o=c.start),d.fullSize?fi(d,o,r.top,m,n.outerHeight-r.bottom-r.top):fi(d,o,t.top+c.placed,m,h),c.start=o,c.placed+=h,o=d.right}}t.x=o,t.y=i}var xt={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,s){if(!e)return;const r=nt(e.options.layout.padding),o=Math.max(t-r.width,0),i=Math.max(n-r.height,0),a=g1(e.boxes),d=a.vertical,c=a.horizontal;we(e.boxes,b=>{typeof b.beforeLayout=="function"&&b.beforeLayout()});const u=d.reduce((b,x)=>x.box.options&&x.box.options.display===!1?b:b+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:n,padding:r,availableWidth:o,availableHeight:i,vBoxMaxWidth:o/2/u,hBoxMaxHeight:i/2}),m=Object.assign({},r);Im(m,nt(s));const f=Object.assign({maxPadding:m,w:o,h:i,x:r.left,y:r.top},r),g=p1(d.concat(c),h);Or(a.fullSize,f,h,g),Or(d,f,h,g),Or(c,f,h,g)&&Or(d,f,h,g),x1(f),Om(a.leftAndTop,f,h,g),f.x+=f.w,f.y+=f.h,Om(a.rightAndBottom,f,h,g),e.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},we(a.chartArea,b=>{const x=b.box;Object.assign(x,e.chartArea),x.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class Lm{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,s){}removeEventListener(t,n,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,s,r){return n=Math.max(0,n||t.width),s=s||t.height,{width:n,height:Math.max(0,r?Math.floor(n/r):s)}}isAttached(t){return!0}updateConfig(t){}}class _1 extends Lm{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const mi="$chartjs",y1={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Am=e=>e===null||e==="";function v1(e,t){const n=e.style,s=e.getAttribute("height"),r=e.getAttribute("width");if(e[mi]={initial:{height:s,width:r,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Am(r)){const o=im(e,"width");o!==void 0&&(e.width=o)}if(Am(s))if(e.style.height==="")e.height=e.width/(t||2);else{const o=im(e,"height");o!==void 0&&(e.height=o)}return e}const Fm=S2?{passive:!0}:!1;function k1(e,t,n){e&&e.addEventListener(t,n,Fm)}function j1(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,Fm)}function S1(e,t){const n=y1[e.type]||e.type,{x:s,y:r}=Zn(e,t);return{type:n,chart:t,native:e,x:s!==void 0?s:null,y:r!==void 0?r:null}}function pi(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function N1(e,t,n){const s=e.canvas,r=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||pi(a.addedNodes,s),i=i&&!pi(a.removedNodes,s);i&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}function C1(e,t,n){const s=e.canvas,r=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||pi(a.removedNodes,s),i=i&&!pi(a.addedNodes,s);i&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}const Lr=new Map;let zm=0;function Wm(){const e=window.devicePixelRatio;e!==zm&&(zm=e,Lr.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function M1(e,t){Lr.size||window.addEventListener("resize",Wm),Lr.set(e,t)}function E1(e){Lr.delete(e),Lr.size||window.removeEventListener("resize",Wm)}function P1(e,t,n){const s=e.canvas,r=s&&Hl(s);if(!r)return;const o=Uf((a,d)=>{const c=r.clientWidth;n(a,d),c<r.clientWidth&&n()},window),i=new ResizeObserver(a=>{const d=a[0],c=d.contentRect.width,u=d.contentRect.height;c===0&&u===0||o(c,u)});return i.observe(r),M1(e,o),i}function Xl(e,t,n){n&&n.disconnect(),t==="resize"&&E1(e)}function T1(e,t,n){const s=e.canvas,r=Uf(o=>{e.ctx!==null&&n(S1(o,e))},e);return k1(s,t,r),r}class D1 extends Lm{acquireContext(t,n){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(v1(t,n),s):null}releaseContext(t){const n=t.canvas;if(!n[mi])return!1;const s=n[mi].initial;["height","width"].forEach(o=>{const i=s[o];ce(i)?n.removeAttribute(o):n.setAttribute(o,i)});const r=s.style||{};return Object.keys(r).forEach(o=>{n.style[o]=r[o]}),n.width=n.width,delete n[mi],!0}addEventListener(t,n,s){this.removeEventListener(t,n);const r=t.$proxies||(t.$proxies={}),i={attach:N1,detach:C1,resize:P1}[n]||T1;r[n]=i(t,n,s)}removeEventListener(t,n){const s=t.$proxies||(t.$proxies={}),r=s[n];if(!r)return;({attach:Xl,detach:Xl,resize:Xl}[n]||j1)(t,n,r),s[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,s,r){return j2(t,n,s,r)}isAttached(t){const n=t&&Hl(t);return!!(n&&n.isConnected)}}function I1(e){return!Bl()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?_1:D1}let rn=(Hi=class{constructor(){I(this,"x");I(this,"y");I(this,"active",!1);I(this,"options");I(this,"$animations")}tooltipPosition(t){const{x:n,y:s}=this.getProps(["x","y"],t);return{x:n,y:s}}hasValue(){return Sr(this.x)&&Sr(this.y)}getProps(t,n){const s=this.$animations;if(!n||!s)return this;const r={};return t.forEach(o=>{r[o]=s[o]&&s[o].active()?s[o]._to:this[o]}),r}},I(Hi,"defaults",{}),I(Hi,"defaultRoutes"),Hi);function O1(e,t){const n=e.options.ticks,s=L1(e),r=Math.min(n.maxTicksLimit||s,s),o=n.major.enabled?F1(t):[],i=o.length,a=o[0],d=o[i-1],c=[];if(i>r)return z1(t,c,o,i/r),c;const u=A1(o,t,r);if(i>0){let h,m;const f=i>1?Math.round((d-a)/(i-1)):null;for(gi(t,c,u,ce(f)?0:a-f,a),h=0,m=i-1;h<m;h++)gi(t,c,u,o[h],o[h+1]);return gi(t,c,u,d,ce(f)?t.length:d+f),c}return gi(t,c,u),c}function L1(e){const t=e.options.offset,n=e._tickSize(),s=e._length/n+(t?0:1),r=e._maxLength/n;return Math.floor(Math.min(s,r))}function A1(e,t,n){const s=W1(e),r=t.length/n;if(!s)return Math.max(r,1);const o=Sk(s);for(let i=0,a=o.length-1;i<a;i++){const d=o[i];if(d>r)return d}return Math.max(r,1)}function F1(e){const t=[];let n,s;for(n=0,s=e.length;n<s;n++)e[n].major&&t.push(n);return t}function z1(e,t,n,s){let r=0,o=n[0],i;for(s=Math.ceil(s),i=0;i<e.length;i++)i===o&&(t.push(e[i]),r++,o=n[r*s])}function gi(e,t,n,s,r){const o=se(s,0),i=Math.min(se(r,e.length),e.length);let a=0,d,c,u;for(n=Math.ceil(n),r&&(d=r-s,n=d/Math.floor(d/n)),u=o;u<0;)a++,u=Math.round(o+a*n);for(c=Math.max(o,0);c<i;c++)c===u&&(t.push(e[c]),a++,u=Math.round(o+a*n))}function W1(e){const t=e.length;let n,s;if(t<2)return!1;for(s=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==s)return!1;return s}const B1=e=>e==="left"?"right":e==="right"?"left":e,Bm=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Hm=(e,t)=>Math.min(t||e,e);function Vm(e,t){const n=[],s=e.length/t,r=e.length;let o=0;for(;o<r;o+=s)n.push(e[Math.floor(o)]);return n}function H1(e,t,n){const s=e.ticks.length,r=Math.min(t,s-1),o=e._startPixel,i=e._endPixel,a=1e-6;let d=e.getPixelForTick(r),c;if(!(n&&(s===1?c=Math.max(d-o,i-d):t===0?c=(e.getPixelForTick(1)-d)/2:c=(d-e.getPixelForTick(r-1))/2,d+=r<t?c:-c,d<o-a||d>i+a)))return d}function V1(e,t){we(e,n=>{const s=n.gc,r=s.length/2;let o;if(r>t){for(o=0;o<r;++o)delete n.data[s[o]];s.splice(0,r)}})}function Ar(e){return e.drawTicks?e.tickLength:0}function Um(e,t){if(!e.display)return 0;const n=Ve(e.font,t),s=nt(e.padding);return(je(e.text)?e.text.length:1)*n.lineHeight+s.height}function U1(e,t){return kn(e,{scale:t,type:"scale"})}function R1(e,t,n){return kn(e,{tick:n,index:t,type:"tick"})}function $1(e,t,n){let s=Pl(e);return(n&&t!=="right"||!n&&t==="right")&&(s=B1(s)),s}function q1(e,t,n,s){const{top:r,left:o,bottom:i,right:a,chart:d}=e,{chartArea:c,scales:u}=d;let h=0,m,f,g;const b=i-r,x=a-o;if(e.isHorizontal()){if(f=tt(s,o,a),ie(n)){const w=Object.keys(n)[0],_=n[w];g=u[w].getPixelForValue(_)+b-t}else n==="center"?g=(c.bottom+c.top)/2+b-t:g=Bm(e,n,t);m=a-o}else{if(ie(n)){const w=Object.keys(n)[0],_=n[w];f=u[w].getPixelForValue(_)-x+t}else n==="center"?f=(c.left+c.right)/2-x+t:f=Bm(e,n,t);g=tt(s,i,r),h=n==="left"?-Le:Le}return{titleX:f,titleY:g,maxWidth:m,rotation:h}}class ns extends rn{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:s,_suggestedMax:r}=this;return t=mt(t,Number.POSITIVE_INFINITY),n=mt(n,Number.NEGATIVE_INFINITY),s=mt(s,Number.POSITIVE_INFINITY),r=mt(r,Number.NEGATIVE_INFINITY),{min:mt(t,s),max:mt(n,r),minDefined:Pe(t),maxDefined:Pe(n)}}getMinMax(t){let{min:n,max:s,minDefined:r,maxDefined:o}=this.getUserBounds(),i;if(r&&o)return{min:n,max:s};const a=this.getMatchingVisibleMetas();for(let d=0,c=a.length;d<c;++d)i=a[d].controller.getMinMax(this,t),r||(n=Math.min(n,i.min)),o||(s=Math.max(s,i.max));return n=o&&n>s?s:n,s=r&&n>s?n:s,{min:mt(n,mt(s,n)),max:mt(s,mt(n,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ke(this.options.beforeUpdate,[this])}update(t,n,s){const{beginAtZero:r,grace:o,ticks:i}=this.options,a=i.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=n2(this,o,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const d=a<this.ticks.length;this._convertTicksToLabels(d?Vm(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),i.display&&(i.autoSkip||i.source==="auto")&&(this.ticks=O1(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),d&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,s;this.isHorizontal()?(n=this.left,s=this.right):(n=this.top,s=this.bottom,t=!t),this._startPixel=n,this._endPixel=s,this._reversePixels=t,this._length=s-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ke(this.options.afterUpdate,[this])}beforeSetDimensions(){ke(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){ke(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),ke(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ke(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let s,r,o;for(s=0,r=t.length;s<r;s++)o=t[s],o.label=ke(n.callback,[o.value,s,t],this)}afterTickToLabelConversion(){ke(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ke(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,s=Hm(this.ticks.length,t.ticks.maxTicksLimit),r=n.minRotation||0,o=n.maxRotation;let i=r,a,d,c;if(!this._isVisible()||!n.display||r>=o||s<=1||!this.isHorizontal()){this.labelRotation=r;return}const u=this._getLabelSizes(),h=u.widest.width,m=u.highest.height,f=et(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/s:f/(s-1),h+6>a&&(a=f/(s-(t.offset?.5:1)),d=this.maxHeight-Ar(t.grid)-n.padding-Um(t.title,this.chart.options.font),c=Math.sqrt(h*h+m*m),i=Cl(Math.min(Math.asin(et((u.highest.height+6)/a,-1,1)),Math.asin(et(d/c,-1,1))-Math.asin(et(m/c,-1,1)))),i=Math.max(r,Math.min(o,i))),this.labelRotation=i}afterCalculateLabelRotation(){ke(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ke(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:s,title:r,grid:o}}=this,i=this._isVisible(),a=this.isHorizontal();if(i){const d=Um(r,n.options.font);if(a?(t.width=this.maxWidth,t.height=Ar(o)+d):(t.height=this.maxHeight,t.width=Ar(o)+d),s.display&&this.ticks.length){const{first:c,last:u,widest:h,highest:m}=this._getLabelSizes(),f=s.padding*2,g=Vt(this.labelRotation),b=Math.cos(g),x=Math.sin(g);if(a){const w=s.mirror?0:x*h.width+b*m.height;t.height=Math.min(this.maxHeight,t.height+w+f)}else{const w=s.mirror?0:b*h.width+x*m.height;t.width=Math.min(this.maxWidth,t.width+w+f)}this._calculatePadding(c,u,x,b)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,s,r){const{ticks:{align:o,padding:i},position:a}=this.options,d=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let m=0,f=0;d?c?(m=r*t.width,f=s*n.height):(m=s*t.height,f=r*n.width):o==="start"?f=n.width:o==="end"?m=t.width:o!=="inner"&&(m=t.width/2,f=n.width/2),this.paddingLeft=Math.max((m-u+i)*this.width/(this.width-u),0),this.paddingRight=Math.max((f-h+i)*this.width/(this.width-h),0)}else{let u=n.height/2,h=t.height/2;o==="start"?(u=0,h=t.height):o==="end"&&(u=n.height,h=0),this.paddingTop=u+i,this.paddingBottom=h+i}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ke(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,s;for(n=0,s=t.length;n<s;n++)ce(t[n].label)&&(t.splice(n,1),s--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let s=this.ticks;n<s.length&&(s=Vm(s,n)),this._labelSizes=t=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,s){const{ctx:r,_longestTextCache:o}=this,i=[],a=[],d=Math.floor(n/Hm(n,s));let c=0,u=0,h,m,f,g,b,x,w,_,y,v,j;for(h=0;h<n;h+=d){if(g=t[h].label,b=this._resolveTickFontOptions(h),r.font=x=b.string,w=o[x]=o[x]||{data:{},gc:[]},_=b.lineHeight,y=v=0,!ce(g)&&!je(g))y=si(r,w.data,w.gc,y,g),v=_;else if(je(g))for(m=0,f=g.length;m<f;++m)j=g[m],!ce(j)&&!je(j)&&(y=si(r,w.data,w.gc,y,j),v+=_);i.push(y),a.push(v),c=Math.max(y,c),u=Math.max(v,u)}V1(o,n);const k=i.indexOf(c),M=a.indexOf(u),N=T=>({width:i[T]||0,height:a[T]||0});return{first:N(0),last:N(n-1),widest:N(k),highest:N(M),widths:i,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return Ek(this._alignToPixels?Kn(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const s=n[t];return s.$context||(s.$context=R1(this.getContext(),t,s))}return this.$context||(this.$context=U1(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=Vt(this.labelRotation),s=Math.abs(Math.cos(n)),r=Math.abs(Math.sin(n)),o=this._getLabelSizes(),i=t.autoSkipPadding||0,a=o?o.widest.width+i:0,d=o?o.highest.height+i:0;return this.isHorizontal()?d*s>a*r?a/s:d/r:d*r<a*s?d/s:a/r}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,s=this.chart,r=this.options,{grid:o,position:i,border:a}=r,d=o.offset,c=this.isHorizontal(),h=this.ticks.length+(d?1:0),m=Ar(o),f=[],g=a.setContext(this.getContext()),b=g.display?g.width:0,x=b/2,w=function(A){return Kn(s,A,b)};let _,y,v,j,k,M,N,T,P,E,D,z;if(i==="top")_=w(this.bottom),M=this.bottom-m,T=_-x,E=w(t.top)+x,z=t.bottom;else if(i==="bottom")_=w(this.top),E=t.top,z=w(t.bottom)-x,M=_+x,T=this.top+m;else if(i==="left")_=w(this.right),k=this.right-m,N=_-x,P=w(t.left)+x,D=t.right;else if(i==="right")_=w(this.left),P=t.left,D=w(t.right)-x,k=_+x,N=this.left+m;else if(n==="x"){if(i==="center")_=w((t.top+t.bottom)/2+.5);else if(ie(i)){const A=Object.keys(i)[0],B=i[A];_=w(this.chart.scales[A].getPixelForValue(B))}E=t.top,z=t.bottom,M=_+x,T=M+m}else if(n==="y"){if(i==="center")_=w((t.left+t.right)/2);else if(ie(i)){const A=Object.keys(i)[0],B=i[A];_=w(this.chart.scales[A].getPixelForValue(B))}k=_-x,N=k-m,P=t.left,D=t.right}const R=se(r.ticks.maxTicksLimit,h),O=Math.max(1,Math.ceil(h/R));for(y=0;y<h;y+=O){const A=this.getContext(y),B=o.setContext(A),C=a.setContext(A),F=B.lineWidth,U=B.color,H=C.dash||[],L=C.dashOffset,$=B.tickWidth,J=B.tickColor,ne=B.tickBorderDash||[],Q=B.tickBorderDashOffset;v=H1(this,y,d),v!==void 0&&(j=Kn(s,v,F),c?k=N=P=D=j:M=T=E=z=j,f.push({tx1:k,ty1:M,tx2:N,ty2:T,x1:P,y1:E,x2:D,y2:z,width:F,color:U,borderDash:H,borderDashOffset:L,tickWidth:$,tickColor:J,tickBorderDash:ne,tickBorderDashOffset:Q}))}return this._ticksLength=h,this._borderValue=_,f}_computeLabelItems(t){const n=this.axis,s=this.options,{position:r,ticks:o}=s,i=this.isHorizontal(),a=this.ticks,{align:d,crossAlign:c,padding:u,mirror:h}=o,m=Ar(s.grid),f=m+u,g=h?-u:f,b=-Vt(this.labelRotation),x=[];let w,_,y,v,j,k,M,N,T,P,E,D,z="middle";if(r==="top")k=this.bottom-g,M=this._getXAxisLabelAlignment();else if(r==="bottom")k=this.top+g,M=this._getXAxisLabelAlignment();else if(r==="left"){const O=this._getYAxisLabelAlignment(m);M=O.textAlign,j=O.x}else if(r==="right"){const O=this._getYAxisLabelAlignment(m);M=O.textAlign,j=O.x}else if(n==="x"){if(r==="center")k=(t.top+t.bottom)/2+f;else if(ie(r)){const O=Object.keys(r)[0],A=r[O];k=this.chart.scales[O].getPixelForValue(A)+f}M=this._getXAxisLabelAlignment()}else if(n==="y"){if(r==="center")j=(t.left+t.right)/2-f;else if(ie(r)){const O=Object.keys(r)[0],A=r[O];j=this.chart.scales[O].getPixelForValue(A)}M=this._getYAxisLabelAlignment(m).textAlign}n==="y"&&(d==="start"?z="top":d==="end"&&(z="bottom"));const R=this._getLabelSizes();for(w=0,_=a.length;w<_;++w){y=a[w],v=y.label;const O=o.setContext(this.getContext(w));N=this.getPixelForTick(w)+o.labelOffset,T=this._resolveTickFontOptions(w),P=T.lineHeight,E=je(v)?v.length:1;const A=E/2,B=O.color,C=O.textStrokeColor,F=O.textStrokeWidth;let U=M;i?(j=N,M==="inner"&&(w===_-1?U=this.options.reverse?"left":"right":w===0?U=this.options.reverse?"right":"left":U="center"),r==="top"?c==="near"||b!==0?D=-E*P+P/2:c==="center"?D=-R.highest.height/2-A*P+P:D=-R.highest.height+P/2:c==="near"||b!==0?D=P/2:c==="center"?D=R.highest.height/2-A*P:D=R.highest.height-E*P,h&&(D*=-1),b!==0&&!O.showLabelBackdrop&&(j+=P/2*Math.sin(b))):(k=N,D=(1-E)*P/2);let H;if(O.showLabelBackdrop){const L=nt(O.backdropPadding),$=R.heights[w],J=R.widths[w];let ne=D-L.top,Q=0-L.left;switch(z){case"middle":ne-=$/2;break;case"bottom":ne-=$;break}switch(M){case"center":Q-=J/2;break;case"right":Q-=J;break;case"inner":w===_-1?Q-=J:w>0&&(Q-=J/2);break}H={left:Q,top:ne,width:J+L.width,height:$+L.height,color:O.backdropColor}}x.push({label:v,font:T,textOffset:D,options:{rotation:b,color:B,strokeColor:C,strokeWidth:F,textAlign:U,textBaseline:z,translation:[j,k],backdrop:H}})}return x}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-Vt(this.labelRotation))return t==="top"?"left":"right";let r="center";return n.align==="start"?r="left":n.align==="end"?r="right":n.align==="inner"&&(r="inner"),r}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:s,mirror:r,padding:o}}=this.options,i=this._getLabelSizes(),a=t+o,d=i.widest.width;let c,u;return n==="left"?r?(u=this.right+o,s==="near"?c="left":s==="center"?(c="center",u+=d/2):(c="right",u+=d)):(u=this.right-a,s==="near"?c="right":s==="center"?(c="center",u-=d/2):(c="left",u=this.left)):n==="right"?r?(u=this.left+o,s==="near"?c="right":s==="center"?(c="center",u-=d/2):(c="left",u-=d)):(u=this.left+a,s==="near"?c="left":s==="center"?(c="center",u+=d/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:s,top:r,width:o,height:i}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(s,r,o,i),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const r=this.ticks.findIndex(o=>o.value===t);return r>=0?n.setContext(this.getContext(r)).lineWidth:0}drawGrid(t){const n=this.options.grid,s=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,i;const a=(d,c,u)=>{!u.width||!u.color||(s.save(),s.lineWidth=u.width,s.strokeStyle=u.color,s.setLineDash(u.borderDash||[]),s.lineDashOffset=u.borderDashOffset,s.beginPath(),s.moveTo(d.x,d.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(n.display)for(o=0,i=r.length;o<i;++o){const d=r[o];n.drawOnChartArea&&a({x:d.x1,y:d.y1},{x:d.x2,y:d.y2},d),n.drawTicks&&a({x:d.tx1,y:d.ty1},{x:d.tx2,y:d.ty2},{color:d.tickColor,width:d.tickWidth,borderDash:d.tickBorderDash,borderDashOffset:d.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:s,grid:r}}=this,o=s.setContext(this.getContext()),i=s.display?o.width:0;if(!i)return;const a=r.setContext(this.getContext(0)).lineWidth,d=this._borderValue;let c,u,h,m;this.isHorizontal()?(c=Kn(t,this.left,i)-i/2,u=Kn(t,this.right,a)+a/2,h=m=d):(h=Kn(t,this.top,i)-i/2,m=Kn(t,this.bottom,a)+a/2,c=u=d),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(c,h),n.lineTo(u,m),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const s=this.ctx,r=this._computeLabelArea();r&&ri(s,r);const o=this.getLabelItems(t);for(const i of o){const a=i.options,d=i.font,c=i.label,u=i.textOffset;Gn(s,c,0,u,d,a)}r&&oi(s)}drawTitle(){const{ctx:t,options:{position:n,title:s,reverse:r}}=this;if(!s.display)return;const o=Ve(s.font),i=nt(s.padding),a=s.align;let d=o.lineHeight/2;n==="bottom"||n==="center"||ie(n)?(d+=i.bottom,je(s.text)&&(d+=o.lineHeight*(s.text.length-1))):d+=i.top;const{titleX:c,titleY:u,maxWidth:h,rotation:m}=q1(this,d,n,a);Gn(t,s.text,0,0,o,{color:s.color,maxWidth:h,rotation:m,textAlign:$1(a,n,r),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,s=se(t.grid&&t.grid.z,-1),r=se(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==ns.prototype.draw?[{z:n,draw:o=>{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:r,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",r=[];let o,i;for(o=0,i=n.length;o<i;++o){const a=n[o];a[s]===this.id&&(!t||a.type===t)&&r.push(a)}return r}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return Ve(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class bi{constructor(t,n,s){this.type=t,this.scope=n,this.override=s,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let s;G1(n)&&(s=this.register(n));const r=this.items,o=t.id,i=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in r||(r[o]=t,Y1(t,i,s),this.override&&Te.override(t.id,t.overrides)),i}get(t){return this.items[t]}unregister(t){const n=this.items,s=t.id,r=this.scope;s in n&&delete n[s],r&&s in Te[r]&&(delete Te[r][s],this.override&&delete Yn[s])}}function Y1(e,t,n){const s=yr(Object.create(null),[n?Te.get(n):{},Te.get(t),e.defaults]);Te.set(t,s),e.defaultRoutes&&K1(t,e.defaultRoutes),e.descriptors&&Te.describe(t,e.descriptors)}function K1(e,t){Object.keys(t).forEach(n=>{const s=n.split("."),r=s.pop(),o=[e].concat(s).join("."),i=t[n].split("."),a=i.pop(),d=i.join(".");Te.route(o,r,d,a)})}function G1(e){return"id"in e&&"defaults"in e}class X1{constructor(){this.controllers=new bi(es,"datasets",!0),this.elements=new bi(rn,"elements"),this.plugins=new bi(Object,"plugins"),this.scales=new bi(ns,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,s){[...n].forEach(r=>{const o=s||this._getRegistryForType(r);s||o.isForType(r)||o===this.plugins&&r.id?this._exec(t,o,r):we(r,i=>{const a=s||this._getRegistryForType(i);this._exec(t,a,i)})})}_exec(t,n,s){const r=Nl(t);ke(s["before"+r],[],s),n[t](s),ke(s["after"+r],[],s)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const s=this._typedRegistries[n];if(s.isForType(t))return s}return this.plugins}_get(t,n,s){const r=n.get(t);if(r===void 0)throw new Error('"'+t+'" is not a registered '+s+".");return r}}var Ut=new X1;class Q1{constructor(){this._init=void 0}notify(t,n,s,r){if(n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;const o=r?this._descriptors(t).filter(r):this._descriptors(t),i=this._notify(o,t,n,s);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),i}_notify(t,n,s,r){r=r||{};for(const o of t){const i=o.plugin,a=i[s],d=[n,r,o.options];if(ke(a,d,i)===!1&&r.cancelable)return!1}return!0}invalidate(){ce(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const s=t&&t.config,r=se(s.options&&s.options.plugins,{}),o=Z1(s);return r===!1&&!n?[]:ej(t,o,r,n)}_notifyStateChanges(t){const n=this._oldCache||[],s=this._cache,r=(o,i)=>o.filter(a=>!i.some(d=>a.plugin.id===d.plugin.id));this._notify(r(n,s),t,"stop"),this._notify(r(s,n),t,"start")}}function Z1(e){const t={},n=[],s=Object.keys(Ut.plugins.items);for(let o=0;o<s.length;o++)n.push(Ut.getPlugin(s[o]));const r=e.plugins||[];for(let o=0;o<r.length;o++){const i=r[o];n.indexOf(i)===-1&&(n.push(i),t[i.id]=!0)}return{plugins:n,localIds:t}}function J1(e,t){return!t&&e===!1?null:e===!0?{}:e}function ej(e,{plugins:t,localIds:n},s,r){const o=[],i=e.getContext();for(const a of t){const d=a.id,c=J1(s[d],r);c!==null&&o.push({plugin:a,options:tj(e.config,{plugin:a,local:n[d]},c,i)})}return o}function tj(e,{plugin:t,local:n},s,r){const o=e.pluginScopeKeys(t),i=e.getOptionScopes(s,o);return n&&t.defaults&&i.push(t.defaults),e.createResolver(i,r,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Ql(e,t){const n=Te.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function nj(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function sj(e,t){return e===t?"_index_":"_value_"}function Rm(e){if(e==="x"||e==="y"||e==="r")return e}function rj(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function Zl(e,...t){if(Rm(e))return e;for(const n of t){const s=n.axis||rj(n.position)||e.length>1&&Rm(e[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function $m(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function oj(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(s=>s.xAxisID===e||s.yAxisID===e);if(n.length)return $m(e,"x",n[0])||$m(e,"y",n[0])}return{}}function ij(e,t){const n=Yn[e.type]||{scales:{}},s=t.scales||{},r=Ql(e.type,t),o=Object.create(null);return Object.keys(s).forEach(i=>{const a=s[i];if(!ie(a))return console.error(`Invalid scale configuration for scale: ${i}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${i}`);const d=Zl(i,a,oj(i,e),Te.scales[a.type]),c=sj(d,r),u=n.scales||{};o[i]=vr(Object.create(null),[{axis:d},a,u[d],u[c]])}),e.data.datasets.forEach(i=>{const a=i.type||e.type,d=i.indexAxis||Ql(a,t),u=(Yn[a]||{}).scales||{};Object.keys(u).forEach(h=>{const m=nj(h,d),f=i[m+"AxisID"]||m;o[f]=o[f]||Object.create(null),vr(o[f],[{axis:m},s[f],u[h]])})}),Object.keys(o).forEach(i=>{const a=o[i];vr(a,[Te.scales[a.type],Te.scale])}),o}function qm(e){const t=e.options||(e.options={});t.plugins=se(t.plugins,{}),t.scales=ij(e,t)}function Ym(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function aj(e){return e=e||{},e.data=Ym(e.data),qm(e),e}const Km=new Map,Gm=new Set;function xi(e,t){let n=Km.get(e);return n||(n=t(),Km.set(e,n),Gm.add(n)),n}const Fr=(e,t,n)=>{const s=Rn(t,n);s!==void 0&&e.add(s)};class lj{constructor(t){this._config=aj(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Ym(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),qm(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return xi(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return xi(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return xi(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,s=this.type;return xi(`${s}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const s=this._scopeCache;let r=s.get(t);return(!r||n)&&(r=new Map,s.set(t,r)),r}getOptionScopes(t,n,s){const{options:r,type:o}=this,i=this._cachedScopes(t,s),a=i.get(n);if(a)return a;const d=new Set;n.forEach(u=>{t&&(d.add(t),u.forEach(h=>Fr(d,t,h))),u.forEach(h=>Fr(d,r,h)),u.forEach(h=>Fr(d,Yn[o]||{},h)),u.forEach(h=>Fr(d,Te,h)),u.forEach(h=>Fr(d,Il,h))});const c=Array.from(d);return c.length===0&&c.push(Object.create(null)),Gm.has(n)&&i.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,Yn[n]||{},Te.datasets[n]||{},{type:n},Te,Il]}resolveNamedOptions(t,n,s,r=[""]){const o={$shared:!0},{resolver:i,subPrefixes:a}=Xm(this._resolverCache,t,r);let d=i;if(cj(i,n)){o.$shared=!1,s=yn(s)?s():s;const c=this.createResolver(t,s,a);d=Is(i,s,c)}for(const c of n)o[c]=d[c];return o}createResolver(t,n,s=[""],r){const{resolver:o}=Xm(this._resolverCache,t,s);return ie(n)?Is(o,n,void 0,r):o}}function Xm(e,t,n){let s=e.get(t);s||(s=new Map,e.set(t,s));const r=n.join();let o=s.get(r);return o||(o={resolver:Fl(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},s.set(r,o)),o}const dj=e=>ie(e)&&Object.getOwnPropertyNames(e).some(t=>yn(e[t]));function cj(e,t){const{isScriptable:n,isIndexable:s}=Zf(e);for(const r of t){const o=n(r),i=s(r),a=(i||o)&&e[r];if(o&&(yn(a)||dj(a))||i&&je(a))return!0}return!1}var uj="4.5.1";const hj=["top","bottom","left","right","chartArea"];function Qm(e,t){return e==="top"||e==="bottom"||hj.indexOf(e)===-1&&t==="x"}function Zm(e,t){return function(n,s){return n[e]===s[e]?n[t]-s[t]:n[e]-s[e]}}function Jm(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),ke(n&&n.onComplete,[e],t)}function fj(e){const t=e.chart,n=t.options.animation;ke(n&&n.onProgress,[e],t)}function ep(e){return Bl()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const wi={},tp=e=>{const t=ep(e);return Object.values(wi).filter(n=>n.canvas===t).pop()};function mj(e,t,n){const s=Object.keys(e);for(const r of s){const o=+r;if(o>=t){const i=e[r];delete e[r],(n>0||o>t)&&(e[o+n]=i)}}}function pj(e,t,n,s){return!n||e.type==="mouseout"?null:s?t:e}let _i=(En=class{static register(...t){Ut.add(...t),np()}static unregister(...t){Ut.remove(...t),np()}constructor(t,n){const s=this.config=new lj(n),r=ep(t),o=tp(r);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const i=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||I1(r)),this.platform.updateConfig(s);const a=this.platform.acquireContext(r,i.aspectRatio),d=a&&a.canvas,c=d&&d.height,u=d&&d.width;if(this.id=gk(),this.ctx=a,this.canvas=d,this.width=u,this.height=c,this._options=i,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Q1,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Ik(h=>this.update(h),i.resizeDelay||0),this._dataChanges=[],wi[this.id]=this,!a||!d){console.error("Failed to create chart: can't acquire context from the given item");return}sn.listen(this,"complete",Jm),sn.listen(this,"progress",fj),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:s,height:r,_aspectRatio:o}=this;return ce(t)?n&&o?o:r?s/r:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Ut}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():om(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Gf(this.canvas,this.ctx),this}stop(){return sn.stop(this),this}resize(t,n){sn.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const s=this.options,r=this.canvas,o=s.maintainAspectRatio&&this.aspectRatio,i=this.platform.getMaximumSize(r,t,n,o),a=s.devicePixelRatio||this.platform.getDevicePixelRatio(),d=this.width?"resize":"attach";this.width=i.width,this.height=i.height,this._aspectRatio=this.aspectRatio,om(this,a,!0)&&(this.notifyPlugins("resize",{size:i}),ke(s.onResize,[this,i],this),this.attached&&this._doResize(d)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};we(n,(s,r)=>{s.id=r})}buildOrUpdateScales(){const t=this.options,n=t.scales,s=this.scales,r=Object.keys(s).reduce((i,a)=>(i[a]=!1,i),{});let o=[];n&&(o=o.concat(Object.keys(n).map(i=>{const a=n[i],d=Zl(i,a),c=d==="r",u=d==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),we(o,i=>{const a=i.options,d=a.id,c=Zl(d,a),u=se(a.type,i.dtype);(a.position===void 0||Qm(a.position,c)!==Qm(i.dposition))&&(a.position=i.dposition),r[d]=!0;let h=null;if(d in s&&s[d].type===u)h=s[d];else{const m=Ut.getScale(u);h=new m({id:d,type:u,ctx:this.ctx,chart:this}),s[h.id]=h}h.init(a,t)}),we(r,(i,a)=>{i||delete s[a]}),we(s,i=>{xt.configure(this,i,i.options),xt.addBox(this,i)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,s=t.length;if(t.sort((r,o)=>r.index-o.index),s>n){for(let r=n;r<s;++r)this._destroyDatasetMeta(r);t.splice(n,s-n)}this._sortedMetasets=t.slice(0).sort(Zm("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((s,r)=>{n.filter(o=>o===s._dataset).length===0&&this._destroyDatasetMeta(r)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let s,r;for(this._removeUnreferencedMetasets(),s=0,r=n.length;s<r;s++){const o=n[s];let i=this.getDatasetMeta(s);const a=o.type||this.config.type;if(i.type&&i.type!==a&&(this._destroyDatasetMeta(s),i=this.getDatasetMeta(s)),i.type=a,i.indexAxis=o.indexAxis||Ql(a,this.options),i.order=o.order||0,i.index=s,i.label=""+o.label,i.visible=this.isDatasetVisible(s),i.controller)i.controller.updateIndex(s),i.controller.linkScales();else{const d=Ut.getController(a),{datasetElementType:c,dataElementType:u}=Te.datasets[a];Object.assign(d,{dataElementType:Ut.getElement(u),datasetElementType:c&&Ut.getElement(c)}),i.controller=new d(this,s),t.push(i.controller)}}return this._updateMetasets(),t}_resetElements(){we(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const s=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let c=0,u=this.data.datasets.length;c<u;c++){const{controller:h}=this.getDatasetMeta(c),m=!r&&o.indexOf(h)===-1;h.buildOrUpdateElements(m),i=Math.max(+h.getMaxOverflow(),i)}i=this._minPadding=s.layout.autoPadding?i:0,this._updateLayout(i),r||we(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Zm("z","_idx"));const{_active:a,_lastEvent:d}=this;d?this._eventHandler(d,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){we(this.scales,t=>{xt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!If(n,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:s,start:r,count:o}of n){const i=s==="_removeElements"?-o:o;mj(t,r,i)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,s=o=>new Set(t.filter(i=>i[0]===o).map((i,a)=>a+","+i.splice(1).join(","))),r=s(0);for(let o=1;o<n;o++)if(!If(r,s(o)))return;return Array.from(r).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;xt.update(this,this.width,this.height,t);const n=this.chartArea,s=n.width<=0||n.height<=0;this._layers=[],we(this.boxes,r=>{s&&r.position==="chartArea"||(r.configure&&r.configure(),this._layers.push(...r._layers()))},this),this._layers.forEach((r,o)=>{r._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,s=this.data.datasets.length;n<s;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,s=this.data.datasets.length;n<s;++n)this._updateDataset(n,yn(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const s=this.getDatasetMeta(t),r={meta:s,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",r)!==!1&&(s.controller._update(n),r.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",r))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(sn.has(this)?this.attached&&!sn.running(this)&&sn.start(this):(this.draw(),Jm({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:s,height:r}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(s,r)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,s=[];let r,o;for(r=0,o=n.length;r<o;++r){const i=n[r];(!t||i.visible)&&s.push(i)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,s={meta:t,index:t.index,cancelable:!0},r=pm(this,t);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(r&&ri(n,r),t.controller.draw(),r&&oi(n),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return nn(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,s,r){const o=h1.modes[n];return typeof o=="function"?o(this,t,s,r):[]}getDatasetMeta(t){const n=this.data.datasets[t],s=this._metasets;let r=s.filter(o=>o&&o._dataset===n).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},s.push(r)),r}getContext(){return this.$context||(this.$context=kn(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!n.hidden}setDatasetVisibility(t,n){const s=this.getDatasetMeta(t);s.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,s){const r=s?"show":"hide",o=this.getDatasetMeta(t),i=o.controller._resolveAnimations(void 0,r);kr(n)?(o.data[n].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),i.update(o,{visible:s}),this.update(a=>a.datasetIndex===t?r:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),sn.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Gf(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete wi[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,n=this.platform,s=(o,i)=>{n.addEventListener(this,o,i),t[o]=i},r=(o,i,a)=>{o.offsetX=i,o.offsetY=a,this._eventHandler(o)};we(this.options.events,o=>s(o,r))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,s=(d,c)=>{n.addEventListener(this,d,c),t[d]=c},r=(d,c)=>{t[d]&&(n.removeEventListener(this,d,c),delete t[d])},o=(d,c)=>{this.canvas&&this.resize(d,c)};let i;const a=()=>{r("attach",a),this.attached=!0,this.resize(),s("resize",o),s("detach",i)};i=()=>{this.attached=!1,r("resize",o),this._stop(),this._resize(0,0),s("attach",a)},n.isAttached(this.canvas)?a():i()}unbindEvents(){we(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},we(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,s){const r=s?"set":"remove";let o,i,a,d;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+r+"DatasetHoverStyle"]()),a=0,d=t.length;a<d;++a){i=t[a];const c=i&&this.getDatasetMeta(i.datasetIndex).controller;c&&c[r+"HoverStyle"](i.element,i.datasetIndex,i.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],s=t.map(({datasetIndex:o,index:i})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[i],index:i}});!Qo(s,n)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,n))}notifyPlugins(t,n,s){return this._plugins.notify(this,t,n,s)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,s){const r=this.options.hover,o=(d,c)=>d.filter(u=>!c.some(h=>u.datasetIndex===h.datasetIndex&&u.index===h.index)),i=o(n,t),a=s?t:o(t,n);i.length&&this.updateHoverStyle(i,r.mode,!1),a.length&&r.mode&&this.updateHoverStyle(a,r.mode,!0)}_eventHandler(t,n){const s={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},r=i=>(i.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,r)===!1)return;const o=this._handleEvent(t,n,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,r),(o||s.changed)&&this.render(),this}_handleEvent(t,n,s){const{_active:r=[],options:o}=this,i=n,a=this._getActiveElements(t,r,s,i),d=vk(t),c=pj(t,this._lastEvent,s,d);s&&(this._lastEvent=null,ke(o.onHover,[t,a,this],this),d&&ke(o.onClick,[t,a,this],this));const u=!Qo(a,r);return(u||n)&&(this._active=a,this._updateHoverStyles(a,r,n)),this._lastEvent=c,u}_getActiveElements(t,n,s,r){if(t.type==="mouseout")return[];if(!s)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,r)}},I(En,"defaults",Te),I(En,"instances",wi),I(En,"overrides",Yn),I(En,"registry",Ut),I(En,"version",uj),I(En,"getChart",tp),En);function np(){return we(_i.instances,e=>e._plugins.invalidate())}function gj(e,t,n){const{startAngle:s,x:r,y:o,outerRadius:i,innerRadius:a,options:d}=t,{borderWidth:c,borderJoinStyle:u}=d,h=Math.min(c/i,Je(s-n));if(e.beginPath(),e.arc(r,o,i-c/2,s+h/2,n-h/2),a>0){const m=Math.min(c/a,Je(s-n));e.arc(r,o,a+c/2,n-m/2,s+m/2,!0)}else{const m=Math.min(c/2,i*Je(s-n));if(u==="round")e.arc(r,o,m,n-pe/2,s+pe/2,!0);else if(u==="bevel"){const f=2*m*m,g=-f*Math.cos(n+pe/2)+r,b=-f*Math.sin(n+pe/2)+o,x=f*Math.cos(s+pe/2)+r,w=f*Math.sin(s+pe/2)+o;e.lineTo(g,b),e.lineTo(x,w)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function bj(e,t,n){const{startAngle:s,pixelMargin:r,x:o,y:i,outerRadius:a,innerRadius:d}=t;let c=r/a;e.beginPath(),e.arc(o,i,a,s-c,n+c),d>r?(c=r/d,e.arc(o,i,d,n+c,s-c,!0)):e.arc(o,i,r,n+Le,s-Le),e.closePath(),e.clip()}function xj(e){return Al(e,["outerStart","outerEnd","innerStart","innerEnd"])}function wj(e,t,n,s){const r=xj(e.options.borderRadius),o=(n-t)/2,i=Math.min(o,s*t/2),a=d=>{const c=(n-Math.min(o,d))*s/2;return et(d,0,Math.min(o,c))};return{outerStart:a(r.outerStart),outerEnd:a(r.outerEnd),innerStart:et(r.innerStart,0,i),innerEnd:et(r.innerEnd,0,i)}}function Fs(e,t,n,s){return{x:n+e*Math.cos(t),y:s+e*Math.sin(t)}}function yi(e,t,n,s,r,o){const{x:i,y:a,startAngle:d,pixelMargin:c,innerRadius:u}=t,h=Math.max(t.outerRadius+s+n-c,0),m=u>0?u+s+n+c:0;let f=0;const g=r-d;if(s){const O=u>0?u-s:0,A=h>0?h-s:0,B=(O+A)/2,C=B!==0?g*B/(B+s):g;f=(g-C)/2}const b=Math.max(.001,g*h-n/pe)/h,x=(g-b)/2,w=d+x+f,_=r-x-f,{outerStart:y,outerEnd:v,innerStart:j,innerEnd:k}=wj(t,m,h,_-w),M=h-y,N=h-v,T=w+y/M,P=_-v/N,E=m+j,D=m+k,z=w+j/E,R=_-k/D;if(e.beginPath(),o){const O=(T+P)/2;if(e.arc(i,a,h,T,O),e.arc(i,a,h,O,P),v>0){const F=Fs(N,P,i,a);e.arc(F.x,F.y,v,P,_+Le)}const A=Fs(D,_,i,a);if(e.lineTo(A.x,A.y),k>0){const F=Fs(D,R,i,a);e.arc(F.x,F.y,k,_+Le,R+Math.PI)}const B=(_-k/m+(w+j/m))/2;if(e.arc(i,a,m,_-k/m,B,!0),e.arc(i,a,m,B,w+j/m,!0),j>0){const F=Fs(E,z,i,a);e.arc(F.x,F.y,j,z+Math.PI,w-Le)}const C=Fs(M,w,i,a);if(e.lineTo(C.x,C.y),y>0){const F=Fs(M,T,i,a);e.arc(F.x,F.y,y,w-Le,T)}}else{e.moveTo(i,a);const O=Math.cos(T)*h+i,A=Math.sin(T)*h+a;e.lineTo(O,A);const B=Math.cos(P)*h+i,C=Math.sin(P)*h+a;e.lineTo(B,C)}e.closePath()}function _j(e,t,n,s,r){const{fullCircles:o,startAngle:i,circumference:a}=t;let d=t.endAngle;if(o){yi(e,t,n,s,d,r);for(let c=0;c<o;++c)e.fill();isNaN(a)||(d=i+(a%Se||Se))}return yi(e,t,n,s,d,r),e.fill(),d}function yj(e,t,n,s,r){const{fullCircles:o,startAngle:i,circumference:a,options:d}=t,{borderWidth:c,borderJoinStyle:u,borderDash:h,borderDashOffset:m,borderRadius:f}=d,g=d.borderAlign==="inner";if(!c)return;e.setLineDash(h||[]),e.lineDashOffset=m,g?(e.lineWidth=c*2,e.lineJoin=u||"round"):(e.lineWidth=c,e.lineJoin=u||"bevel");let b=t.endAngle;if(o){yi(e,t,n,s,b,r);for(let x=0;x<o;++x)e.stroke();isNaN(a)||(b=i+(a%Se||Se))}g&&bj(e,t,b),d.selfJoin&&b-i>=pe&&f===0&&u!=="miter"&&gj(e,t,b),o||(yi(e,t,n,s,b,r),e.stroke())}class zr extends rn{constructor(n){super();I(this,"circumference");I(this,"endAngle");I(this,"fullCircles");I(this,"innerRadius");I(this,"outerRadius");I(this,"pixelMargin");I(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,n&&Object.assign(this,n)}inRange(n,s,r){const o=this.getProps(["x","y"],r),{angle:i,distance:a}=zf(o,{x:n,y:s}),{startAngle:d,endAngle:c,innerRadius:u,outerRadius:h,circumference:m}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],r),f=(this.options.spacing+this.options.borderWidth)/2,g=se(m,c-d),b=Nr(i,d,c)&&d!==c,x=g>=Se||b,w=tn(a,u+f,h+f);return x&&w}getCenterPoint(n){const{x:s,y:r,startAngle:o,endAngle:i,innerRadius:a,outerRadius:d}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:c,spacing:u}=this.options,h=(o+i)/2,m=(a+d+u+c)/2;return{x:s+Math.cos(h)*m,y:r+Math.sin(h)*m}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:s,circumference:r}=this,o=(s.offset||0)/4,i=(s.spacing||0)/2,a=s.circular;if(this.pixelMargin=s.borderAlign==="inner"?.33:0,this.fullCircles=r>Se?Math.floor(r/Se):0,r===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const d=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(d)*o,Math.sin(d)*o);const c=1-Math.sin(Math.min(pe,r||0)),u=o*c;n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,_j(n,this,u,i,a),yj(n,this,u,i,a),n.restore()}}I(zr,"id","arc"),I(zr,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),I(zr,"defaultRoutes",{backgroundColor:"backgroundColor"}),I(zr,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function sp(e,t,n=t){e.lineCap=se(n.borderCapStyle,t.borderCapStyle),e.setLineDash(se(n.borderDash,t.borderDash)),e.lineDashOffset=se(n.borderDashOffset,t.borderDashOffset),e.lineJoin=se(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=se(n.borderWidth,t.borderWidth),e.strokeStyle=se(n.borderColor,t.borderColor)}function vj(e,t,n){e.lineTo(n.x,n.y)}function kj(e){return e.stepped?Yk:e.tension||e.cubicInterpolationMode==="monotone"?Kk:vj}function rp(e,t,n={}){const s=e.length,{start:r=0,end:o=s-1}=n,{start:i,end:a}=t,d=Math.max(r,i),c=Math.min(o,a),u=r<i&&o<i||r>a&&o>a;return{count:s,start:d,loop:t.loop,ilen:c<d&&!u?s+c-d:c-d}}function jj(e,t,n,s){const{points:r,options:o}=t,{count:i,start:a,loop:d,ilen:c}=rp(r,n,s),u=kj(o);let{move:h=!0,reverse:m}=s||{},f,g,b;for(f=0;f<=c;++f)g=r[(a+(m?c-f:f))%i],!g.skip&&(h?(e.moveTo(g.x,g.y),h=!1):u(e,b,g,m,o.stepped),b=g);return d&&(g=r[(a+(m?c:0))%i],u(e,b,g,m,o.stepped)),!!d}function Sj(e,t,n,s){const r=t.points,{count:o,start:i,ilen:a}=rp(r,n,s),{move:d=!0,reverse:c}=s||{};let u=0,h=0,m,f,g,b,x,w;const _=v=>(i+(c?a-v:v))%o,y=()=>{b!==x&&(e.lineTo(u,x),e.lineTo(u,b),e.lineTo(u,w))};for(d&&(f=r[_(0)],e.moveTo(f.x,f.y)),m=0;m<=a;++m){if(f=r[_(m)],f.skip)continue;const v=f.x,j=f.y,k=v|0;k===g?(j<b?b=j:j>x&&(x=j),u=(h*u+v)/++h):(y(),e.lineTo(v,j),g=k,h=0,b=x=j),w=j}y()}function Jl(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?Sj:jj}function Nj(e){return e.stepped?N2:e.tension||e.cubicInterpolationMode==="monotone"?C2:Jn}function Cj(e,t,n,s){let r=t._path;r||(r=t._path=new Path2D,t.path(r,n,s)&&r.closePath()),sp(e,t.options),e.stroke(r)}function Mj(e,t,n,s){const{segments:r,options:o}=t,i=Jl(t);for(const a of r)sp(e,o,a.style),e.beginPath(),i(e,t,a,{start:n,end:n+s-1})&&e.closePath(),e.stroke()}const Ej=typeof Path2D=="function";function Pj(e,t,n,s){Ej&&!t.options.segment?Cj(e,t,n,s):Mj(e,t,n,s)}class Sn extends rn{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const r=s.spanGaps?this._loop:this._fullLoop;x2(this._points,s,t,r,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=I2(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,s=t.length;return s&&n[t[s-1].end]}interpolate(t,n){const s=this.options,r=t[n],o=this.points,i=hm(this,{property:n,start:r,end:r});if(!i.length)return;const a=[],d=Nj(s);let c,u;for(c=0,u=i.length;c<u;++c){const{start:h,end:m}=i[c],f=o[h],g=o[m];if(f===g){a.push(f);continue}const b=Math.abs((r-f[n])/(g[n]-f[n])),x=d(f,g,b,s.stepped);x[n]=t[n],a.push(x)}return a.length===1?a[0]:a}pathSegment(t,n,s){return Jl(this)(t,this,n,s)}path(t,n,s){const r=this.segments,o=Jl(this);let i=this._loop;n=n||0,s=s||this.points.length-n;for(const a of r)i&=o(t,this,a,{start:n,end:n+s-1});return!!i}draw(t,n,s,r){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Pj(t,this,s,r),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}I(Sn,"id","line"),I(Sn,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),I(Sn,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),I(Sn,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function op(e,t,n,s){const r=e.options,{[n]:o}=e.getProps([n],s);return Math.abs(t-o)<r.radius+r.hitRadius}class vi extends rn{constructor(n){super();I(this,"parsed");I(this,"skip");I(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,n&&Object.assign(this,n)}inRange(n,s,r){const o=this.options,{x:i,y:a}=this.getProps(["x","y"],r);return Math.pow(n-i,2)+Math.pow(s-a,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(n,s){return op(this,n,"x",s)}inYRange(n,s){return op(this,n,"y",s)}getCenterPoint(n){const{x:s,y:r}=this.getProps(["x","y"],n);return{x:s,y:r}}size(n){n=n||this.options||{};let s=n.radius||0;s=Math.max(s,s&&n.hoverRadius||0);const r=s&&n.borderWidth||0;return(s+r)*2}draw(n,s){const r=this.options;this.skip||r.radius<.1||!nn(this,s,this.size(r)/2)||(n.strokeStyle=r.borderColor,n.lineWidth=r.borderWidth,n.fillStyle=r.backgroundColor,Ll(n,r,this.x,this.y))}getRange(){const n=this.options||{};return n.radius+n.hitRadius}}I(vi,"id","point"),I(vi,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),I(vi,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function ip(e,t){const{x:n,y:s,base:r,width:o,height:i}=e.getProps(["x","y","base","width","height"],t);let a,d,c,u,h;return e.horizontal?(h=i/2,a=Math.min(n,r),d=Math.max(n,r),c=s-h,u=s+h):(h=o/2,a=n-h,d=n+h,c=Math.min(s,r),u=Math.max(s,r)),{left:a,top:c,right:d,bottom:u}}function Nn(e,t,n,s){return e?0:et(t,n,s)}function Tj(e,t,n){const s=e.options.borderWidth,r=e.borderSkipped,o=Qf(s);return{t:Nn(r.top,o.top,0,n),r:Nn(r.right,o.right,0,t),b:Nn(r.bottom,o.bottom,0,n),l:Nn(r.left,o.left,0,t)}}function Dj(e,t,n){const{enableBorderRadius:s}=e.getProps(["enableBorderRadius"]),r=e.options.borderRadius,o=Xn(r),i=Math.min(t,n),a=e.borderSkipped,d=s||ie(r);return{topLeft:Nn(!d||a.top||a.left,o.topLeft,0,i),topRight:Nn(!d||a.top||a.right,o.topRight,0,i),bottomLeft:Nn(!d||a.bottom||a.left,o.bottomLeft,0,i),bottomRight:Nn(!d||a.bottom||a.right,o.bottomRight,0,i)}}function Ij(e){const t=ip(e),n=t.right-t.left,s=t.bottom-t.top,r=Tj(e,n/2,s/2),o=Dj(e,n/2,s/2);return{outer:{x:t.left,y:t.top,w:n,h:s,radius:o},inner:{x:t.left+r.l,y:t.top+r.t,w:n-r.l-r.r,h:s-r.t-r.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(r.t,r.l)),topRight:Math.max(0,o.topRight-Math.max(r.t,r.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(r.b,r.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(r.b,r.r))}}}}function ed(e,t,n,s){const r=t===null,o=n===null,a=e&&!(r&&o)&&ip(e,s);return a&&(r||tn(t,a.left,a.right))&&(o||tn(n,a.top,a.bottom))}function Oj(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function Lj(e,t){e.rect(t.x,t.y,t.w,t.h)}function td(e,t,n={}){const s=e.x!==n.x?-t:0,r=e.y!==n.y?-t:0,o=(e.x+e.w!==n.x+n.w?t:0)-s,i=(e.y+e.h!==n.y+n.h?t:0)-r;return{x:e.x+s,y:e.y+r,w:e.w+o,h:e.h+i,radius:e.radius}}class ki extends rn{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:n,options:{borderColor:s,backgroundColor:r}}=this,{inner:o,outer:i}=Ij(this),a=Oj(i.radius)?Er:Lj;t.save(),(i.w!==o.w||i.h!==o.h)&&(t.beginPath(),a(t,td(i,n,o)),t.clip(),a(t,td(o,-n,i)),t.fillStyle=s,t.fill("evenodd")),t.beginPath(),a(t,td(o,n)),t.fillStyle=r,t.fill(),t.restore()}inRange(t,n,s){return ed(this,t,n,s)}inXRange(t,n){return ed(this,t,null,n)}inYRange(t,n){return ed(this,null,t,n)}getCenterPoint(t){const{x:n,y:s,base:r,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(n+r)/2:n,y:o?s:(s+r)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}I(ki,"id","bar"),I(ki,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),I(ki,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function Aj(e,t,n){const s=e.segments,r=e.points,o=t.points,i=[];for(const a of s){let{start:d,end:c}=a;c=ji(d,c,r);const u=nd(n,r[d],r[c],a.loop);if(!t.segments){i.push({source:a,target:u,start:r[d],end:r[c]});continue}const h=hm(t,u);for(const m of h){const f=nd(n,o[m.start],o[m.end],m.loop),g=um(a,r,f);for(const b of g)i.push({source:b,target:m,start:{[n]:ap(u,f,"start",Math.max)},end:{[n]:ap(u,f,"end",Math.min)}})}}return i}function nd(e,t,n,s){if(s)return;let r=t[e],o=n[e];return e==="angle"&&(r=Je(r),o=Je(o)),{property:e,start:r,end:o}}function Fj(e,t){const{x:n=null,y:s=null}=e||{},r=t.points,o=[];return t.segments.forEach(({start:i,end:a})=>{a=ji(i,a,r);const d=r[i],c=r[a];s!==null?(o.push({x:d.x,y:s}),o.push({x:c.x,y:s})):n!==null&&(o.push({x:n,y:d.y}),o.push({x:n,y:c.y}))}),o}function ji(e,t,n){for(;t>e;t--){const s=n[t];if(!isNaN(s.x)&&!isNaN(s.y))break}return t}function ap(e,t,n,s){return e&&t?s(e[n],t[n]):e?e[n]:t?t[n]:0}function lp(e,t){let n=[],s=!1;return je(e)?(s=!0,n=e):n=Fj(e,t),n.length?new Sn({points:n,options:{tension:0},_loop:s,_fullLoop:s}):null}function dp(e){return e&&e.fill!==!1}function zj(e,t,n){let r=e[t].fill;const o=[t];let i;if(!n)return r;for(;r!==!1&&o.indexOf(r)===-1;){if(!Pe(r))return r;if(i=e[r],!i)return!1;if(i.visible)return r;o.push(r),r=i.fill}return!1}function Wj(e,t,n){const s=Uj(e);if(ie(s))return isNaN(s.value)?!1:s;let r=parseFloat(s);return Pe(r)&&Math.floor(r)===r?Bj(s[0],t,r,n):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function Bj(e,t,n,s){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=s?!1:n}function Hj(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:ie(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function Vj(e,t,n){let s;return e==="start"?s=n:e==="end"?s=t.options.reverse?t.min:t.max:ie(e)?s=e.value:s=t.getBaseValue(),s}function Uj(e){const t=e.options,n=t.fill;let s=se(n&&n.target,n);return s===void 0&&(s=!!t.backgroundColor),s===!1||s===null?!1:s===!0?"origin":s}function Rj(e){const{scale:t,index:n,line:s}=e,r=[],o=s.segments,i=s.points,a=$j(t,n);a.push(lp({x:null,y:t.bottom},s));for(let d=0;d<o.length;d++){const c=o[d];for(let u=c.start;u<=c.end;u++)qj(r,i[u],a)}return new Sn({points:r,options:{}})}function $j(e,t){const n=[],s=e.getMatchingVisibleMetas("line");for(let r=0;r<s.length;r++){const o=s[r];if(o.index===t)break;o.hidden||n.unshift(o.dataset)}return n}function qj(e,t,n){const s=[];for(let r=0;r<n.length;r++){const o=n[r],{first:i,last:a,point:d}=Yj(o,t,"x");if(!(!d||i&&a)){if(i)s.unshift(d);else if(e.push(d),!a)break}}e.push(...s)}function Yj(e,t,n){const s=e.interpolate(t,n);if(!s)return{};const r=s[n],o=e.segments,i=e.points;let a=!1,d=!1;for(let c=0;c<o.length;c++){const u=o[c],h=i[u.start][n],m=i[u.end][n];if(tn(r,h,m)){a=r===h,d=r===m;break}}return{first:a,last:d,point:s}}class cp{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,n,s){const{x:r,y:o,radius:i}=this;return n=n||{start:0,end:Se},t.arc(r,o,i,n.end,n.start,!0),!s.bounds}interpolate(t){const{x:n,y:s,radius:r}=this,o=t.angle;return{x:n+Math.cos(o)*r,y:s+Math.sin(o)*r,angle:o}}}function Kj(e){const{chart:t,fill:n,line:s}=e;if(Pe(n))return Gj(t,n);if(n==="stack")return Rj(e);if(n==="shape")return!0;const r=Xj(e);return r instanceof cp?r:lp(r,s)}function Gj(e,t){const n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function Xj(e){return(e.scale||{}).getPointPositionForValue?Zj(e):Qj(e)}function Qj(e){const{scale:t={},fill:n}=e,s=Hj(n,t);if(Pe(s)){const r=t.isHorizontal();return{x:r?s:null,y:r?null:s}}return null}function Zj(e){const{scale:t,fill:n}=e,s=t.options,r=t.getLabels().length,o=s.reverse?t.max:t.min,i=Vj(n,t,o),a=[];if(s.grid.circular){const d=t.getPointPositionForValue(0,o);return new cp({x:d.x,y:d.y,radius:t.getDistanceFromCenterForValue(i)})}for(let d=0;d<r;++d)a.push(t.getPointPositionForValue(d,i));return a}function sd(e,t,n){const s=Kj(t),{chart:r,index:o,line:i,scale:a,axis:d}=t,c=i.options,u=c.fill,h=c.backgroundColor,{above:m=h,below:f=h}=u||{},g=r.getDatasetMeta(o),b=pm(r,g);s&&i.points.length&&(ri(e,n),Jj(e,{line:i,target:s,above:m,below:f,area:n,scale:a,axis:d,clip:b}),oi(e))}function Jj(e,t){const{line:n,target:s,above:r,below:o,area:i,scale:a,clip:d}=t,c=n._loop?"angle":t.axis;e.save();let u=o;o!==r&&(c==="x"?(up(e,s,i.top),rd(e,{line:n,target:s,color:r,scale:a,property:c,clip:d}),e.restore(),e.save(),up(e,s,i.bottom)):c==="y"&&(hp(e,s,i.left),rd(e,{line:n,target:s,color:o,scale:a,property:c,clip:d}),e.restore(),e.save(),hp(e,s,i.right),u=r)),rd(e,{line:n,target:s,color:u,scale:a,property:c,clip:d}),e.restore()}function up(e,t,n){const{segments:s,points:r}=t;let o=!0,i=!1;e.beginPath();for(const a of s){const{start:d,end:c}=a,u=r[d],h=r[ji(d,c,r)];o?(e.moveTo(u.x,u.y),o=!1):(e.lineTo(u.x,n),e.lineTo(u.x,u.y)),i=!!t.pathSegment(e,a,{move:i}),i?e.closePath():e.lineTo(h.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function hp(e,t,n){const{segments:s,points:r}=t;let o=!0,i=!1;e.beginPath();for(const a of s){const{start:d,end:c}=a,u=r[d],h=r[ji(d,c,r)];o?(e.moveTo(u.x,u.y),o=!1):(e.lineTo(n,u.y),e.lineTo(u.x,u.y)),i=!!t.pathSegment(e,a,{move:i}),i?e.closePath():e.lineTo(n,h.y)}e.lineTo(n,t.first().y),e.closePath(),e.clip()}function rd(e,t){const{line:n,target:s,property:r,color:o,scale:i,clip:a}=t,d=Aj(n,s,r);for(const{source:c,target:u,start:h,end:m}of d){const{style:{backgroundColor:f=o}={}}=c,g=s!==!0;e.save(),e.fillStyle=f,eS(e,i,a,g&&nd(r,h,m)),e.beginPath();const b=!!n.pathSegment(e,c);let x;if(g){b?e.closePath():fp(e,s,m,r);const w=!!s.pathSegment(e,u,{move:b,reverse:!0});x=b&&w,x||fp(e,s,h,r)}e.closePath(),e.fill(x?"evenodd":"nonzero"),e.restore()}}function eS(e,t,n,s){const r=t.chart.chartArea,{property:o,start:i,end:a}=s||{};if(o==="x"||o==="y"){let d,c,u,h;o==="x"?(d=i,c=r.top,u=a,h=r.bottom):(d=r.left,c=i,u=r.right,h=a),e.beginPath(),n&&(d=Math.max(d,n.left),u=Math.min(u,n.right),c=Math.max(c,n.top),h=Math.min(h,n.bottom)),e.rect(d,c,u-d,h-c),e.clip()}}function fp(e,t,n,s){const r=t.interpolate(n,s);r&&e.lineTo(r.x,r.y)}var tS={id:"filler",afterDatasetsUpdate(e,t,n){const s=(e.data.datasets||[]).length,r=[];let o,i,a,d;for(i=0;i<s;++i)o=e.getDatasetMeta(i),a=o.dataset,d=null,a&&a.options&&a instanceof Sn&&(d={visible:e.isDatasetVisible(i),index:i,fill:Wj(a,i,s),chart:e,axis:o.controller.options.indexAxis,scale:o.vScale,line:a}),o.$filler=d,r.push(d);for(i=0;i<s;++i)d=r[i],!(!d||d.fill===!1)&&(d.fill=zj(r,i,n.propagate))},beforeDraw(e,t,n){const s=n.drawTime==="beforeDraw",r=e.getSortedVisibleDatasetMetas(),o=e.chartArea;for(let i=r.length-1;i>=0;--i){const a=r[i].$filler;a&&(a.line.updateControlPoints(o,a.axis),s&&a.fill&&sd(e.ctx,a,o))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;const s=e.getSortedVisibleDatasetMetas();for(let r=s.length-1;r>=0;--r){const o=s[r].$filler;dp(o)&&sd(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,t,n){const s=t.meta.$filler;!dp(s)||n.drawTime!=="beforeDatasetDraw"||sd(e.ctx,s,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const mp=(e,t)=>{let{boxHeight:n=t,boxWidth:s=t}=e;return e.usePointStyle&&(n=Math.min(n,t),s=e.pointStyleWidth||Math.min(s,t)),{boxWidth:s,boxHeight:n,itemHeight:Math.max(t,n)}},nS=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class pp extends rn{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,s){this.maxWidth=t,this.maxHeight=n,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=ke(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(s=>t.filter(s,this.chart.data))),t.sort&&(n=n.sort((s,r)=>t.sort(s,r,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const s=t.labels,r=Ve(s.font),o=r.size,i=this._computeTitleHeight(),{boxWidth:a,itemHeight:d}=mp(s,o);let c,u;n.font=r.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(i,o,a,d)+10):(u=this.maxHeight,c=this._fitCols(i,r,a,d)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,s,r){const{ctx:o,maxWidth:i,options:{labels:{padding:a}}}=this,d=this.legendHitBoxes=[],c=this.lineWidths=[0],u=r+a;let h=t;o.textAlign="left",o.textBaseline="middle";let m=-1,f=-u;return this.legendItems.forEach((g,b)=>{const x=s+n/2+o.measureText(g.text).width;(b===0||c[c.length-1]+x+2*a>i)&&(h+=u,c[c.length-(b>0?0:1)]=0,f+=u,m++),d[b]={left:0,top:f,row:m,width:x,height:r},c[c.length-1]+=x+a}),h}_fitCols(t,n,s,r){const{ctx:o,maxHeight:i,options:{labels:{padding:a}}}=this,d=this.legendHitBoxes=[],c=this.columnSizes=[],u=i-t;let h=a,m=0,f=0,g=0,b=0;return this.legendItems.forEach((x,w)=>{const{itemWidth:_,itemHeight:y}=sS(s,n,o,x,r);w>0&&f+y+2*a>u&&(h+=m+a,c.push({width:m,height:f}),g+=m+a,b++,m=f=0),d[w]={left:g,top:f,col:b,width:_,height:y},m=Math.max(m,_),f+=y+a}),h+=m,c.push({width:m,height:f}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:s,labels:{padding:r},rtl:o}}=this,i=Ls(o,this.left,this.width);if(this.isHorizontal()){let a=0,d=tt(s,this.left+r,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,d=tt(s,this.left+r,this.right-this.lineWidths[a])),c.top+=this.top+t+r,c.left=i.leftForLtr(i.x(d),c.width),d+=c.width+r}else{let a=0,d=tt(s,this.top+t+r,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,d=tt(s,this.top+t+r,this.bottom-this.columnSizes[a].height)),c.top=d,c.left+=this.left+r,c.left=i.leftForLtr(i.x(c.left),c.width),d+=c.height+r}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;ri(t,this),this._draw(),oi(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:s,ctx:r}=this,{align:o,labels:i}=t,a=Te.color,d=Ls(t.rtl,this.left,this.width),c=Ve(i.font),{padding:u}=i,h=c.size,m=h/2;let f;this.drawTitle(),r.textAlign=d.textAlign("left"),r.textBaseline="middle",r.lineWidth=.5,r.font=c.string;const{boxWidth:g,boxHeight:b,itemHeight:x}=mp(i,h),w=function(k,M,N){if(isNaN(g)||g<=0||isNaN(b)||b<0)return;r.save();const T=se(N.lineWidth,1);if(r.fillStyle=se(N.fillStyle,a),r.lineCap=se(N.lineCap,"butt"),r.lineDashOffset=se(N.lineDashOffset,0),r.lineJoin=se(N.lineJoin,"miter"),r.lineWidth=T,r.strokeStyle=se(N.strokeStyle,a),r.setLineDash(se(N.lineDash,[])),i.usePointStyle){const P={radius:b*Math.SQRT2/2,pointStyle:N.pointStyle,rotation:N.rotation,borderWidth:T},E=d.xPlus(k,g/2),D=M+m;Xf(r,P,E,D,i.pointStyleWidth&&g)}else{const P=M+Math.max((h-b)/2,0),E=d.leftForLtr(k,g),D=Xn(N.borderRadius);r.beginPath(),Object.values(D).some(z=>z!==0)?Er(r,{x:E,y:P,w:g,h:b,radius:D}):r.rect(E,P,g,b),r.fill(),T!==0&&r.stroke()}r.restore()},_=function(k,M,N){Gn(r,N.text,k,M+x/2,c,{strikethrough:N.hidden,textAlign:d.textAlign(N.textAlign)})},y=this.isHorizontal(),v=this._computeTitleHeight();y?f={x:tt(o,this.left+u,this.right-s[0]),y:this.top+u+v,line:0}:f={x:this.left+u,y:tt(o,this.top+v+u,this.bottom-n[0].height),line:0},am(this.ctx,t.textDirection);const j=x+u;this.legendItems.forEach((k,M)=>{r.strokeStyle=k.fontColor,r.fillStyle=k.fontColor;const N=r.measureText(k.text).width,T=d.textAlign(k.textAlign||(k.textAlign=i.textAlign)),P=g+m+N;let E=f.x,D=f.y;d.setWidth(this.width),y?M>0&&E+P+u>this.right&&(D=f.y+=j,f.line++,E=f.x=tt(o,this.left+u,this.right-s[f.line])):M>0&&D+j>this.bottom&&(E=f.x=E+n[f.line].width+u,f.line++,D=f.y=tt(o,this.top+v+u,this.bottom-n[f.line].height));const z=d.x(E);if(w(z,D,k),E=Ok(T,E+g+m,y?E+P:this.right,t.rtl),_(d.x(E),D,k),y)f.x+=P+u;else if(typeof k.text!="string"){const R=c.lineHeight;f.y+=gp(k,R)+u}else f.y+=j}),lm(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,s=Ve(n.font),r=nt(n.padding);if(!n.display)return;const o=Ls(t.rtl,this.left,this.width),i=this.ctx,a=n.position,d=s.size/2,c=r.top+d;let u,h=this.left,m=this.width;if(this.isHorizontal())m=Math.max(...this.lineWidths),u=this.top+c,h=tt(t.align,h,this.right-m);else{const g=this.columnSizes.reduce((b,x)=>Math.max(b,x.height),0);u=c+tt(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const f=tt(a,h,h+m);i.textAlign=o.textAlign(Pl(a)),i.textBaseline="middle",i.strokeStyle=n.color,i.fillStyle=n.color,i.font=s.string,Gn(i,n.text,f,u,s)}_computeTitleHeight(){const t=this.options.title,n=Ve(t.font),s=nt(t.padding);return t.display?n.lineHeight+s.height:0}_getLegendItemAt(t,n){let s,r,o;if(tn(t,this.left,this.right)&&tn(n,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;s<o.length;++s)if(r=o[s],tn(t,r.left,r.left+r.width)&&tn(n,r.top,r.top+r.height))return this.legendItems[s]}return null}handleEvent(t){const n=this.options;if(!iS(t.type,n))return;const s=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const r=this._hoveredItem,o=nS(r,s);r&&!o&&ke(n.onLeave,[t,r,this],this),this._hoveredItem=s,s&&!o&&ke(n.onHover,[t,s,this],this)}else s&&ke(n.onClick,[t,s,this],this)}}function sS(e,t,n,s,r){const o=rS(s,e,t,n),i=oS(r,s,t.lineHeight);return{itemWidth:o,itemHeight:i}}function rS(e,t,n,s){let r=e.text;return r&&typeof r!="string"&&(r=r.reduce((o,i)=>o.length>i.length?o:i)),t+n.size/2+s.measureText(r).width}function oS(e,t,n){let s=e;return typeof t.text!="string"&&(s=gp(t,n)),s}function gp(e,t){const n=e.text?e.text.length:0;return t*n}function iS(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var aS={id:"legend",_element:pp,start(e,t,n){const s=e.legend=new pp({ctx:e.ctx,options:n,chart:e});xt.configure(e,s,n),xt.addBox(e,s)},stop(e){xt.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const s=e.legend;xt.configure(e,s,n),s.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const s=t.datasetIndex,r=n.chart;r.isDatasetVisible(s)?(r.hide(s),t.hidden=!0):(r.show(s),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:s,textAlign:r,color:o,useBorderRadius:i,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(d=>{const c=d.controller.getStyle(n?0:void 0),u=nt(c.borderWidth);return{text:t[d.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!d.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:r||c.textAlign,borderRadius:i&&(a||c.borderRadius),datasetIndex:d.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class bp extends rn{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const s=this.options;if(this.left=0,this.top=0,!s.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const r=je(s.text)?s.text.length:1;this._padding=nt(s.padding);const o=r*Ve(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:s,bottom:r,right:o,options:i}=this,a=i.align;let d=0,c,u,h;return this.isHorizontal()?(u=tt(a,s,o),h=n+t,c=o-s):(i.position==="left"?(u=s+t,h=tt(a,r,n),d=pe*-.5):(u=o-t,h=tt(a,n,r),d=pe*.5),c=r-n),{titleX:u,titleY:h,maxWidth:c,rotation:d}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const s=Ve(n.font),o=s.lineHeight/2+this._padding.top,{titleX:i,titleY:a,maxWidth:d,rotation:c}=this._drawArgs(o);Gn(t,n.text,0,0,s,{color:n.color,maxWidth:d,rotation:c,textAlign:Pl(n.align),textBaseline:"middle",translation:[i,a]})}}function lS(e,t){const n=new bp({ctx:e.ctx,options:t,chart:e});xt.configure(e,n,t),xt.addBox(e,n),e.titleBlock=n}var dS={id:"title",_element:bp,start(e,t,n){lS(e,n)},stop(e){const t=e.titleBlock;xt.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const s=e.titleBlock;xt.configure(e,s,n),s.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Wr={average(e){if(!e.length)return!1;let t,n,s=new Set,r=0,o=0;for(t=0,n=e.length;t<n;++t){const a=e[t].element;if(a&&a.hasValue()){const d=a.tooltipPosition();s.add(d.x),r+=d.y,++o}}return o===0||s.size===0?!1:{x:[...s].reduce((a,d)=>a+d)/s.size,y:r/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,s=t.y,r=Number.POSITIVE_INFINITY,o,i,a;for(o=0,i=e.length;o<i;++o){const d=e[o].element;if(d&&d.hasValue()){const c=d.getCenterPoint(),u=Ml(t,c);u<r&&(r=u,a=d)}}if(a){const d=a.tooltipPosition();n=d.x,s=d.y}return{x:n,y:s}}};function Rt(e,t){return t&&(je(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function on(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
`)>-1?e.split(`
`):e}function cS(e,t){const{element:n,datasetIndex:s,index:r}=t,o=e.getDatasetMeta(s).controller,{label:i,value:a}=o.getLabelAndValue(r);return{chart:e,label:i,parsed:o.getParsed(r),raw:e.data.datasets[s].data[r],formattedValue:a,dataset:o.getDataset(),dataIndex:r,datasetIndex:s,element:n}}function xp(e,t){const n=e.chart.ctx,{body:s,footer:r,title:o}=e,{boxWidth:i,boxHeight:a}=t,d=Ve(t.bodyFont),c=Ve(t.titleFont),u=Ve(t.footerFont),h=o.length,m=r.length,f=s.length,g=nt(t.padding);let b=g.height,x=0,w=s.reduce((v,j)=>v+j.before.length+j.lines.length+j.after.length,0);if(w+=e.beforeBody.length+e.afterBody.length,h&&(b+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),w){const v=t.displayColors?Math.max(a,d.lineHeight):d.lineHeight;b+=f*v+(w-f)*d.lineHeight+(w-1)*t.bodySpacing}m&&(b+=t.footerMarginTop+m*u.lineHeight+(m-1)*t.footerSpacing);let _=0;const y=function(v){x=Math.max(x,n.measureText(v).width+_)};return n.save(),n.font=c.string,we(e.title,y),n.font=d.string,we(e.beforeBody.concat(e.afterBody),y),_=t.displayColors?i+2+t.boxPadding:0,we(s,v=>{we(v.before,y),we(v.lines,y),we(v.after,y)}),_=0,n.font=u.string,we(e.footer,y),n.restore(),x+=g.width,{width:x,height:b}}function uS(e,t){const{y:n,height:s}=t;return n<s/2?"top":n>e.height-s/2?"bottom":"center"}function hS(e,t,n,s){const{x:r,width:o}=s,i=n.caretSize+n.caretPadding;if(e==="left"&&r+o+i>t.width||e==="right"&&r-o-i<0)return!0}function fS(e,t,n,s){const{x:r,width:o}=n,{width:i,chartArea:{left:a,right:d}}=e;let c="center";return s==="center"?c=r<=(a+d)/2?"left":"right":r<=o/2?c="left":r>=i-o/2&&(c="right"),hS(c,e,t,n)&&(c="center"),c}function wp(e,t,n){const s=n.yAlign||t.yAlign||uS(e,n);return{xAlign:n.xAlign||t.xAlign||fS(e,t,n,s),yAlign:s}}function mS(e,t){let{x:n,width:s}=e;return t==="right"?n-=s:t==="center"&&(n-=s/2),n}function pS(e,t,n){let{y:s,height:r}=e;return t==="top"?s+=n:t==="bottom"?s-=r+n:s-=r/2,s}function _p(e,t,n,s){const{caretSize:r,caretPadding:o,cornerRadius:i}=e,{xAlign:a,yAlign:d}=n,c=r+o,{topLeft:u,topRight:h,bottomLeft:m,bottomRight:f}=Xn(i);let g=mS(t,a);const b=pS(t,d,c);return d==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(u,m)+r:a==="right"&&(g+=Math.max(h,f)+r),{x:et(g,0,s.width-t.width),y:et(b,0,s.height-t.height)}}function Si(e,t,n){const s=nt(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-s.right:e.x+s.left}function yp(e){return Rt([],on(e))}function gS(e,t,n){return kn(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function vp(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const kp={beforeTitle:en,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,s=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex<s)return n[t.dataIndex]}return""},afterTitle:en,beforeBody:en,beforeLabel:en,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return ce(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:en,afterBody:en,beforeFooter:en,footer:en,afterFooter:en};function lt(e,t,n,s){const r=e[t].call(n,s);return typeof r>"u"?kp[t].call(n,s):r}class od extends rn{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,s=this.options.setContext(this.getContext()),r=s.enabled&&n.options.animation&&s.animations,o=new bm(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=gS(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:s}=n,r=lt(s,"beforeTitle",this,t),o=lt(s,"title",this,t),i=lt(s,"afterTitle",this,t);let a=[];return a=Rt(a,on(r)),a=Rt(a,on(o)),a=Rt(a,on(i)),a}getBeforeBody(t,n){return yp(lt(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:s}=n,r=[];return we(t,o=>{const i={before:[],lines:[],after:[]},a=vp(s,o);Rt(i.before,on(lt(a,"beforeLabel",this,o))),Rt(i.lines,lt(a,"label",this,o)),Rt(i.after,on(lt(a,"afterLabel",this,o))),r.push(i)}),r}getAfterBody(t,n){return yp(lt(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:s}=n,r=lt(s,"beforeFooter",this,t),o=lt(s,"footer",this,t),i=lt(s,"afterFooter",this,t);let a=[];return a=Rt(a,on(r)),a=Rt(a,on(o)),a=Rt(a,on(i)),a}_createItems(t){const n=this._active,s=this.chart.data,r=[],o=[],i=[];let a=[],d,c;for(d=0,c=n.length;d<c;++d)a.push(cS(this.chart,n[d]));return t.filter&&(a=a.filter((u,h,m)=>t.filter(u,h,m,s))),t.itemSort&&(a=a.sort((u,h)=>t.itemSort(u,h,s))),we(a,u=>{const h=vp(t.callbacks,u);r.push(lt(h,"labelColor",this,u)),o.push(lt(h,"labelPointStyle",this,u)),i.push(lt(h,"labelTextColor",this,u))}),this.labelColors=r,this.labelPointStyles=o,this.labelTextColors=i,this.dataPoints=a,a}update(t,n){const s=this.options.setContext(this.getContext()),r=this._active;let o,i=[];if(!r.length)this.opacity!==0&&(o={opacity:0});else{const a=Wr[s.position].call(this,r,this._eventPosition);i=this._createItems(s),this.title=this.getTitle(i,s),this.beforeBody=this.getBeforeBody(i,s),this.body=this.getBody(i,s),this.afterBody=this.getAfterBody(i,s),this.footer=this.getFooter(i,s);const d=this._size=xp(this,s),c=Object.assign({},a,d),u=wp(this.chart,s,c),h=_p(s,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:h.x,y:h.y,width:d.width,height:d.height,caretX:a.x,caretY:a.y}}this._tooltipItems=i,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,s,r){const o=this.getCaretPosition(t,s,r);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,s){const{xAlign:r,yAlign:o}=this,{caretSize:i,cornerRadius:a}=s,{topLeft:d,topRight:c,bottomLeft:u,bottomRight:h}=Xn(a),{x:m,y:f}=t,{width:g,height:b}=n;let x,w,_,y,v,j;return o==="center"?(v=f+b/2,r==="left"?(x=m,w=x-i,y=v+i,j=v-i):(x=m+g,w=x+i,y=v-i,j=v+i),_=x):(r==="left"?w=m+Math.max(d,u)+i:r==="right"?w=m+g-Math.max(c,h)-i:w=this.caretX,o==="top"?(y=f,v=y-i,x=w-i,_=w+i):(y=f+b,v=y+i,x=w+i,_=w-i),j=y),{x1:x,x2:w,x3:_,y1:y,y2:v,y3:j}}drawTitle(t,n,s){const r=this.title,o=r.length;let i,a,d;if(o){const c=Ls(s.rtl,this.x,this.width);for(t.x=Si(this,s.titleAlign,s),n.textAlign=c.textAlign(s.titleAlign),n.textBaseline="middle",i=Ve(s.titleFont),a=s.titleSpacing,n.fillStyle=s.titleColor,n.font=i.string,d=0;d<o;++d)n.fillText(r[d],c.x(t.x),t.y+i.lineHeight/2),t.y+=i.lineHeight+a,d+1===o&&(t.y+=s.titleMarginBottom-a)}}_drawColorBox(t,n,s,r,o){const i=this.labelColors[s],a=this.labelPointStyles[s],{boxHeight:d,boxWidth:c}=o,u=Ve(o.bodyFont),h=Si(this,"left",o),m=r.x(h),f=d<u.lineHeight?(u.lineHeight-d)/2:0,g=n.y+f;if(o.usePointStyle){const b={radius:Math.min(c,d)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},x=r.leftForLtr(m,c)+c/2,w=g+d/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Ll(t,b,x,w),t.strokeStyle=i.borderColor,t.fillStyle=i.backgroundColor,Ll(t,b,x,w)}else{t.lineWidth=ie(i.borderWidth)?Math.max(...Object.values(i.borderWidth)):i.borderWidth||1,t.strokeStyle=i.borderColor,t.setLineDash(i.borderDash||[]),t.lineDashOffset=i.borderDashOffset||0;const b=r.leftForLtr(m,c),x=r.leftForLtr(r.xPlus(m,1),c-2),w=Xn(i.borderRadius);Object.values(w).some(_=>_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Er(t,{x:b,y:g,w:c,h:d,radius:w}),t.fill(),t.stroke(),t.fillStyle=i.backgroundColor,t.beginPath(),Er(t,{x,y:g+1,w:c-2,h:d-2,radius:w}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(b,g,c,d),t.strokeRect(b,g,c,d),t.fillStyle=i.backgroundColor,t.fillRect(x,g+1,c-2,d-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,n,s){const{body:r}=this,{bodySpacing:o,bodyAlign:i,displayColors:a,boxHeight:d,boxWidth:c,boxPadding:u}=s,h=Ve(s.bodyFont);let m=h.lineHeight,f=0;const g=Ls(s.rtl,this.x,this.width),b=function(N){n.fillText(N,g.x(t.x+f),t.y+m/2),t.y+=m+o},x=g.textAlign(i);let w,_,y,v,j,k,M;for(n.textAlign=i,n.textBaseline="middle",n.font=h.string,t.x=Si(this,x,s),n.fillStyle=s.bodyColor,we(this.beforeBody,b),f=a&&x!=="right"?i==="center"?c/2+u:c+2+u:0,v=0,k=r.length;v<k;++v){for(w=r[v],_=this.labelTextColors[v],n.fillStyle=_,we(w.before,b),y=w.lines,a&&y.length&&(this._drawColorBox(n,t,v,g,s),m=Math.max(h.lineHeight,d)),j=0,M=y.length;j<M;++j)b(y[j]),m=h.lineHeight;we(w.after,b)}f=0,m=h.lineHeight,we(this.afterBody,b),t.y-=o}drawFooter(t,n,s){const r=this.footer,o=r.length;let i,a;if(o){const d=Ls(s.rtl,this.x,this.width);for(t.x=Si(this,s.footerAlign,s),t.y+=s.footerMarginTop,n.textAlign=d.textAlign(s.footerAlign),n.textBaseline="middle",i=Ve(s.footerFont),n.fillStyle=s.footerColor,n.font=i.string,a=0;a<o;++a)n.fillText(r[a],d.x(t.x),t.y+i.lineHeight/2),t.y+=i.lineHeight+s.footerSpacing}}drawBackground(t,n,s,r){const{xAlign:o,yAlign:i}=this,{x:a,y:d}=t,{width:c,height:u}=s,{topLeft:h,topRight:m,bottomLeft:f,bottomRight:g}=Xn(r.cornerRadius);n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,n.lineWidth=r.borderWidth,n.beginPath(),n.moveTo(a+h,d),i==="top"&&this.drawCaret(t,n,s,r),n.lineTo(a+c-m,d),n.quadraticCurveTo(a+c,d,a+c,d+m),i==="center"&&o==="right"&&this.drawCaret(t,n,s,r),n.lineTo(a+c,d+u-g),n.quadraticCurveTo(a+c,d+u,a+c-g,d+u),i==="bottom"&&this.drawCaret(t,n,s,r),n.lineTo(a+f,d+u),n.quadraticCurveTo(a,d+u,a,d+u-f),i==="center"&&o==="left"&&this.drawCaret(t,n,s,r),n.lineTo(a,d+h),n.quadraticCurveTo(a,d,a+h,d),n.closePath(),n.fill(),r.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,s=this.$animations,r=s&&s.x,o=s&&s.y;if(r||o){const i=Wr[t.position].call(this,this._active,this._eventPosition);if(!i)return;const a=this._size=xp(this,t),d=Object.assign({},i,this._size),c=wp(n,t,d),u=_p(t,d,c,n);(r._to!==u.x||o._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(n);const r={width:this.width,height:this.height},o={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const i=nt(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=s,this.drawBackground(o,t,r,n),am(t,n.textDirection),o.y+=i.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),lm(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const s=this._active,r=t.map(({datasetIndex:a,index:d})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[d],index:d}}),o=!Qo(s,r),i=this._positionChanged(r,n);(o||i)&&(this._active=r,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,s=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const r=this.options,o=this._active||[],i=this._getActiveElements(t,o,n,s),a=this._positionChanged(i,t),d=n||!Qo(i,o)||a;return d&&(this._active=i,(r.enabled||r.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),d}_getActiveElements(t,n,s,r){const o=this.options;if(t.type==="mouseout")return[];if(!r)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const i=this.chart.getElementsAtEventForMode(t,o.mode,o,s);return o.reverse&&i.reverse(),i}_positionChanged(t,n){const{caretX:s,caretY:r,options:o}=this,i=Wr[o.position].call(this,t,n);return i!==!1&&(s!==i.x||r!==i.y)}}I(od,"positioners",Wr);var bS={id:"tooltip",_element:od,positioners:Wr,afterInit(e,t,n){n&&(e.tooltip=new od({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:kp},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const xS=(e,t,n,s)=>(typeof t=="string"?(n=e.push(t)-1,s.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function wS(e,t,n,s){const r=e.indexOf(t);if(r===-1)return xS(e,t,n,s);const o=e.lastIndexOf(t);return r!==o?n:r}const _S=(e,t)=>e===null?null:et(Math.round(e),0,t);function jp(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class id extends ns{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const s=this.getLabels();for(const{index:r,label:o}of n)s[r]===o&&s.splice(r,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(ce(t))return null;const s=this.getLabels();return n=isFinite(n)&&s[n]===t?n:wS(s,t,se(n,t),this._addedLabels),_S(n,s.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:s,max:r}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(s=0),n||(r=this.getLabels().length-1)),this.min=s,this.max=r}buildTicks(){const t=this.min,n=this.max,s=this.options.offset,r=[];let o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(s?0:1),1),this._startValue=this.min-(s?.5:0);for(let i=t;i<=n;i++)r.push({value:i});return r}getLabelForValue(t){return jp.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}I(id,"id","category"),I(id,"defaults",{ticks:{callback:jp}});function yS(e,t){const n=[],{bounds:r,step:o,min:i,max:a,precision:d,count:c,maxTicks:u,maxDigits:h,includeBounds:m}=e,f=o||1,g=u-1,{min:b,max:x}=t,w=!ce(i),_=!ce(a),y=!ce(c),v=(x-b)/(h+1);let j=Lf((x-b)/g/f)*f,k,M,N,T;if(j<1e-14&&!w&&!_)return[{value:b},{value:x}];T=Math.ceil(x/j)-Math.floor(b/j),T>g&&(j=Lf(T*j/g/f)*f),ce(d)||(k=Math.pow(10,d),j=Math.ceil(j*k)/k),r==="ticks"?(M=Math.floor(b/j)*j,N=Math.ceil(x/j)*j):(M=b,N=x),w&&_&&o&&Ck((a-i)/o,j/1e3)?(T=Math.round(Math.min((a-i)/j,u)),j=(a-i)/T,M=i,N=a):y?(M=w?i:M,N=_?a:N,T=c-1,j=(N-M)/T):(T=(N-M)/j,jr(T,Math.round(T),j/1e3)?T=Math.round(T):T=Math.ceil(T));const P=Math.max(Ff(j),Ff(M));k=Math.pow(10,ce(d)?P:d),M=Math.round(M*k)/k,N=Math.round(N*k)/k;let E=0;for(w&&(m&&M!==i?(n.push({value:i}),M<i&&E++,jr(Math.round((M+E*j)*k)/k,i,Sp(i,v,e))&&E++):M<i&&E++);E<T;++E){const D=Math.round((M+E*j)*k)/k;if(_&&D>a)break;n.push({value:D})}return _&&m&&N!==a?n.length&&jr(n[n.length-1].value,a,Sp(a,v,e))?n[n.length-1].value=a:n.push({value:a}):(!_||N===a)&&n.push({value:N}),n}function Sp(e,t,{horizontal:n,minRotation:s}){const r=Vt(s),o=(n?Math.sin(r):Math.cos(r))||.001,i=.75*t*(""+e).length;return Math.min(t/o,i)}class Ni extends ns{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return ce(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:s}=this.getUserBounds();let{min:r,max:o}=this;const i=d=>r=n?r:d,a=d=>o=s?o:d;if(t){const d=Ht(r),c=Ht(o);d<0&&c<0?a(0):d>0&&c>0&&i(0)}if(r===o){let d=o===0?1:Math.abs(o*.05);a(o+d),t||i(r-d)}this.min=r,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:s}=t,r;return s?(r=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,r>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${r} ticks. Limiting to 1000.`),r=1e3)):(r=this.computeTickLimit(),n=n||11),n&&(r=Math.min(n,r)),r}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const r={maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,i=yS(r,o);return t.bounds==="ticks"&&Af(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}configure(){const t=this.ticks;let n=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const r=(s-n)/Math.max(t.length-1,1)/2;n-=r,s+=r}this._startValue=n,this._endValue=s,this._valueRange=s-n}getLabelForValue(t){return ti(t,this.chart.options.locale,this.options.ticks.format)}}class ad extends Ni{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Pe(t)?t:0,this.max=Pe(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,s=Vt(this.options.ticks.minRotation),r=(t?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/r))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}I(ad,"id","linear"),I(ad,"defaults",{ticks:{callback:ni.formatters.numeric}});const Br=e=>Math.floor(vn(e)),ss=(e,t)=>Math.pow(10,Br(e)+t);function Np(e){return e/Math.pow(10,Br(e))===1}function Cp(e,t,n){const s=Math.pow(10,n),r=Math.floor(e/s);return Math.ceil(t/s)-r}function vS(e,t){const n=t-e;let s=Br(n);for(;Cp(e,t,s)>10;)s++;for(;Cp(e,t,s)<10;)s--;return Math.min(s,Br(e))}function kS(e,{min:t,max:n}){t=mt(e.min,t);const s=[],r=Br(t);let o=vS(t,n),i=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),d=r>o?Math.pow(10,r):0,c=Math.round((t-d)*i)/i,u=Math.floor((t-d)/a/10)*a*10;let h=Math.floor((c-u)/Math.pow(10,o)),m=mt(e.min,Math.round((d+u+h*Math.pow(10,o))*i)/i);for(;m<n;)s.push({value:m,major:Np(m),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(o++,h=2,i=o>=0?1:i),m=Math.round((d+u+h*Math.pow(10,o))*i)/i;const f=mt(e.max,m);return s.push({value:f,major:Np(f),significand:h}),s}class Mp extends ns{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const s=Ni.prototype.parse.apply(this,[t,n]);if(s===0){this._zero=!0;return}return Pe(s)&&s>0?s:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Pe(t)?Math.max(0,t):null,this.max=Pe(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Pe(this._userMin)&&(this.min=t===ss(this.min,0)?ss(this.min,-1):ss(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let s=this.min,r=this.max;const o=a=>s=t?s:a,i=a=>r=n?r:a;s===r&&(s<=0?(o(1),i(10)):(o(ss(s,-1)),i(ss(r,1)))),s<=0&&o(ss(r,-1)),r<=0&&i(ss(s,1)),this.min=s,this.max=r}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},s=kS(n,this);return t.bounds==="ticks"&&Af(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}getLabelForValue(t){return t===void 0?"0":ti(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=vn(t),this._valueRange=vn(this.max)-vn(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(vn(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}I(Mp,"id","logarithmic"),I(Mp,"defaults",{ticks:{callback:ni.formatters.logarithmic,major:{enabled:!0}}});function ld(e){const t=e.ticks;if(t.display&&e.display){const n=nt(t.backdropPadding);return se(t.font&&t.font.size,Te.font.size)+n.height}return 0}function jS(e,t,n){return n=je(n)?n:[n],{w:qk(e,t.string,n),h:n.length*t.lineHeight}}function Ep(e,t,n,s,r){return e===s||e===r?{start:t-n/2,end:t+n/2}:e<s||e>r?{start:t-n,end:t}:{start:t,end:t+n}}function SS(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),s=[],r=[],o=e._pointLabels.length,i=e.options.pointLabels,a=i.centerPointLabels?pe/o:0;for(let d=0;d<o;d++){const c=i.setContext(e.getPointLabelContext(d));r[d]=c.padding;const u=e.getPointPosition(d,e.drawingArea+r[d],a),h=Ve(c.font),m=jS(e.ctx,h,e._pointLabels[d]);s[d]=m;const f=Je(e.getIndexAngle(d)+a),g=Math.round(Cl(f)),b=Ep(g,u.x,m.w,0,180),x=Ep(g,u.y,m.h,90,270);NS(n,t,f,b,x)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=ES(e,s,r)}function NS(e,t,n,s,r){const o=Math.abs(Math.sin(n)),i=Math.abs(Math.cos(n));let a=0,d=0;s.start<t.l?(a=(t.l-s.start)/o,e.l=Math.min(e.l,t.l-a)):s.end>t.r&&(a=(s.end-t.r)/o,e.r=Math.max(e.r,t.r+a)),r.start<t.t?(d=(t.t-r.start)/i,e.t=Math.min(e.t,t.t-d)):r.end>t.b&&(d=(r.end-t.b)/i,e.b=Math.max(e.b,t.b+d))}function CS(e,t,n){const s=e.drawingArea,{extra:r,additionalAngle:o,padding:i,size:a}=n,d=e.getPointPosition(t,s+r+i,o),c=Math.round(Cl(Je(d.angle+Le))),u=DS(d.y,a.h,c),h=PS(c),m=TS(d.x,a.w,h);return{visible:!0,x:d.x,y:u,textAlign:h,left:m,top:u,right:m+a.w,bottom:u+a.h}}function MS(e,t){if(!t)return!0;const{left:n,top:s,right:r,bottom:o}=e;return!(nn({x:n,y:s},t)||nn({x:n,y:o},t)||nn({x:r,y:s},t)||nn({x:r,y:o},t))}function ES(e,t,n){const s=[],r=e._pointLabels.length,o=e.options,{centerPointLabels:i,display:a}=o.pointLabels,d={extra:ld(o)/2,additionalAngle:i?pe/r:0};let c;for(let u=0;u<r;u++){d.padding=n[u],d.size=t[u];const h=CS(e,u,d);s.push(h),a==="auto"&&(h.visible=MS(h,c),h.visible&&(c=h))}return s}function PS(e){return e===0||e===180?"center":e<180?"left":"right"}function TS(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function DS(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function IS(e,t,n){const{left:s,top:r,right:o,bottom:i}=n,{backdropColor:a}=t;if(!ce(a)){const d=Xn(t.borderRadius),c=nt(t.backdropPadding);e.fillStyle=a;const u=s-c.left,h=r-c.top,m=o-s+c.width,f=i-r+c.height;Object.values(d).some(g=>g!==0)?(e.beginPath(),Er(e,{x:u,y:h,w:m,h:f,radius:d}),e.fill()):e.fillRect(u,h,m,f)}}function OS(e,t){const{ctx:n,options:{pointLabels:s}}=e;for(let r=t-1;r>=0;r--){const o=e._pointLabelItems[r];if(!o.visible)continue;const i=s.setContext(e.getPointLabelContext(r));IS(n,i,o);const a=Ve(i.font),{x:d,y:c,textAlign:u}=o;Gn(n,e._pointLabels[r],d,c+a.lineHeight/2,a,{color:i.color,textAlign:u,textBaseline:"middle"})}}function Pp(e,t,n,s){const{ctx:r}=e;if(n)r.arc(e.xCenter,e.yCenter,t,0,Se);else{let o=e.getPointPosition(0,t);r.moveTo(o.x,o.y);for(let i=1;i<s;i++)o=e.getPointPosition(i,t),r.lineTo(o.x,o.y)}}function LS(e,t,n,s,r){const o=e.ctx,i=t.circular,{color:a,lineWidth:d}=t;!i&&!s||!a||!d||n<0||(o.save(),o.strokeStyle=a,o.lineWidth=d,o.setLineDash(r.dash||[]),o.lineDashOffset=r.dashOffset,o.beginPath(),Pp(e,n,i,s),o.closePath(),o.stroke(),o.restore())}function AS(e,t,n){return kn(e,{label:n,index:t,type:"pointLabel"})}class Ci extends Ni{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=nt(ld(this.options)/2),n=this.width=this.maxWidth-t.width,s=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+n/2+t.left),this.yCenter=Math.floor(this.top+s/2+t.top),this.drawingArea=Math.floor(Math.min(n,s)/2)}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!1);this.min=Pe(t)&&!isNaN(t)?t:0,this.max=Pe(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/ld(this.options))}generateTickLabels(t){Ni.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,s)=>{const r=ke(this.options.pointLabels.callback,[n,s],this);return r||r===0?r:""}).filter((n,s)=>this.chart.getDataVisibility(s))}fit(){const t=this.options;t.display&&t.pointLabels.display?SS(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,s,r){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((s-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,s,r))}getIndexAngle(t){const n=Se/(this._pointLabels.length||1),s=this.options.startAngle||0;return Je(t*n+Vt(s))}getDistanceFromCenterForValue(t){if(ce(t))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(ce(t))return NaN;const n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){const n=this._pointLabels||[];if(t>=0&&t<n.length){const s=n[t];return AS(this.getContext(),t,s)}}getPointPosition(t,n,s=0){const r=this.getIndexAngle(t)-Le+s;return{x:Math.cos(r)*n+this.xCenter,y:Math.sin(r)*n+this.yCenter,angle:r}}getPointPositionForValue(t,n){return this.getPointPosition(t,this.getDistanceFromCenterForValue(n))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:n,top:s,right:r,bottom:o}=this._pointLabelItems[t];return{left:n,top:s,right:r,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:n}}=this.options;if(t){const s=this.ctx;s.save(),s.beginPath(),Pp(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),s.closePath(),s.fillStyle=t,s.fill(),s.restore()}}drawGrid(){const t=this.ctx,n=this.options,{angleLines:s,grid:r,border:o}=n,i=this._pointLabels.length;let a,d,c;if(n.pointLabels.display&&OS(this,i),r.display&&this.ticks.forEach((u,h)=>{if(h!==0||h===0&&this.min<0){d=this.getDistanceFromCenterForValue(u.value);const m=this.getContext(h),f=r.setContext(m),g=o.setContext(m);LS(this,f,d,i,g)}}),s.display){for(t.save(),a=i-1;a>=0;a--){const u=s.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:m}=u;!m||!h||(t.lineWidth=m,t.strokeStyle=h,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,d=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),c=this.getPointPosition(a,d),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,s=n.ticks;if(!s.display)return;const r=this.getIndexAngle(0);let o,i;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(r),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,d)=>{if(d===0&&this.min>=0&&!n.reverse)return;const c=s.setContext(this.getContext(d)),u=Ve(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[d].value),c.showLabelBackdrop){t.font=u.string,i=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const h=nt(c.backdropPadding);t.fillRect(-i/2-h.left,-o-u.size/2-h.top,i+h.width,u.size+h.height)}Gn(t,a.label,0,-o,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}I(Ci,"id","radialLinear"),I(Ci,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ni.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),I(Ci,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),I(Ci,"descriptors",{angleLines:{_fallback:"grid"}});const Mi={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},dt=Object.keys(Mi);function Tp(e,t){return e-t}function Dp(e,t){if(ce(t))return null;const n=e._adapter,{parser:s,round:r,isoWeekday:o}=e._parseOpts;let i=t;return typeof s=="function"&&(i=s(i)),Pe(i)||(i=typeof s=="string"?n.parse(i,s):n.parse(i)),i===null?null:(r&&(i=r==="week"&&(Sr(o)||o===!0)?n.startOf(i,"isoWeek",o):n.startOf(i,r)),+i)}function Ip(e,t,n,s){const r=dt.length;for(let o=dt.indexOf(e);o<r-1;++o){const i=Mi[dt[o]],a=i.steps?i.steps:Number.MAX_SAFE_INTEGER;if(i.common&&Math.ceil((n-t)/(a*i.size))<=s)return dt[o]}return dt[r-1]}function FS(e,t,n,s,r){for(let o=dt.length-1;o>=dt.indexOf(n);o--){const i=dt[o];if(Mi[i].common&&e._adapter.diff(r,s,i)>=t-1)return i}return dt[n?dt.indexOf(n):0]}function zS(e){for(let t=dt.indexOf(e)+1,n=dt.length;t<n;++t)if(Mi[dt[t]].common)return dt[t]}function Op(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:s,hi:r}=El(n,t),o=n[s]>=t?n[s]:n[r];e[o]=!0}}function WS(e,t,n,s){const r=e._adapter,o=+r.startOf(t[0].value,s),i=t[t.length-1].value;let a,d;for(a=o;a<=i;a=+r.add(a,1,s))d=n[a],d>=0&&(t[d].major=!0);return t}function Lp(e,t,n){const s=[],r={},o=t.length;let i,a;for(i=0;i<o;++i)a=t[i],r[a]=i,s.push({value:a,major:!1});return o===0||!n?s:WS(e,s,r,n)}class Hr extends ns{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const s=t.time||(t.time={}),r=this._adapter=new Mm._date(t.adapters.date);r.init(n),vr(s.displayFormats,r.formats()),this._parseOpts={parser:s.parser,round:s.round,isoWeekday:s.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:Dp(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,s=t.time.unit||"day";let{min:r,max:o,minDefined:i,maxDefined:a}=this.getUserBounds();function d(c){!i&&!isNaN(c.min)&&(r=Math.min(r,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!i||!a)&&(d(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&d(this.getMinMax(!1))),r=Pe(r)&&!isNaN(r)?r:+n.startOf(Date.now(),s),o=Pe(o)&&!isNaN(o)?o:+n.endOf(Date.now(),s)+1,this.min=Math.min(r,o-1),this.max=Math.max(r+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],s=t[t.length-1]),{min:n,max:s}}buildTicks(){const t=this.options,n=t.time,s=t.ticks,r=s.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&r.length&&(this.min=this._userMin||r[0],this.max=this._userMax||r[r.length-1]);const o=this.min,i=this.max,a=Tk(r,o,i);return this._unit=n.unit||(s.autoSkip?Ip(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):FS(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:zS(this._unit),this.initOffsets(r),t.reverse&&a.reverse(),Lp(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,s=0,r,o;this.options.offset&&t.length&&(r=this.getDecimalForValue(t[0]),t.length===1?n=1-r:n=(this.getDecimalForValue(t[1])-r)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?s=o:s=(o-this.getDecimalForValue(t[t.length-2]))/2);const i=t.length<3?.5:.25;n=et(n,0,i),s=et(s,0,i),this._offsets={start:n,end:s,factor:1/(n+1+s)}}_generate(){const t=this._adapter,n=this.min,s=this.max,r=this.options,o=r.time,i=o.unit||Ip(o.minUnit,n,s,this._getLabelCapacity(n)),a=se(r.ticks.stepSize,1),d=i==="week"?o.isoWeekday:!1,c=Sr(d)||d===!0,u={};let h=n,m,f;if(c&&(h=+t.startOf(h,"isoWeek",d)),h=+t.startOf(h,c?"day":i),t.diff(s,n,i)>1e5*a)throw new Error(n+" and "+s+" are too far apart with stepSize of "+a+" "+i);const g=r.ticks.source==="data"&&this.getDataTimestamps();for(m=h,f=0;m<s;m=+t.add(m,a,i),f++)Op(u,m,g);return(m===s||r.bounds==="ticks"||f===1)&&Op(u,m,g),Object.keys(u).sort(Tp).map(b=>+b)}getLabelForValue(t){const n=this._adapter,s=this.options.time;return s.tooltipFormat?n.format(t,s.tooltipFormat):n.format(t,s.displayFormats.datetime)}format(t,n){const r=this.options.time.displayFormats,o=this._unit,i=n||r[o];return this._adapter.format(t,i)}_tickFormatFunction(t,n,s,r){const o=this.options,i=o.ticks.callback;if(i)return ke(i,[t,n,s],this);const a=o.time.displayFormats,d=this._unit,c=this._majorUnit,u=d&&a[d],h=c&&a[c],m=s[n],f=c&&h&&m&&m.major;return this._adapter.format(t,r||(f?h:u))}generateTickLabels(t){let n,s,r;for(n=0,s=t.length;n<s;++n)r=t[n],r.label=this._tickFormatFunction(r.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,s=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+s)*n.factor)}getValueForPixel(t){const n=this._offsets,s=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+s*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,s=this.ctx.measureText(t).width,r=Vt(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(r),i=Math.sin(r),a=this._resolveTickFontOptions(0).size;return{w:s*o+a*i,h:s*i+a*o}}_getLabelCapacity(t){const n=this.options.time,s=n.displayFormats,r=s[n.unit]||s.millisecond,o=this._tickFormatFunction(t,0,Lp(this,[t],this._majorUnit),r),i=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/i.w:this.height/i.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,s;if(t.length)return t;const r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(n=0,s=r.length;n<s;++n)t=t.concat(r[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,s;if(t.length)return t;const r=this.getLabels();for(n=0,s=r.length;n<s;++n)t.push(Dp(this,r[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Hf(t.sort(Tp))}}I(Hr,"id","time"),I(Hr,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Ei(e,t,n){let s=0,r=e.length-1,o,i,a,d;n?(t>=e[s].pos&&t<=e[r].pos&&({lo:s,hi:r}=qn(e,"pos",t)),{pos:o,time:a}=e[s],{pos:i,time:d}=e[r]):(t>=e[s].time&&t<=e[r].time&&({lo:s,hi:r}=qn(e,"time",t)),{time:o,pos:a}=e[s],{time:i,pos:d}=e[r]);const c=i-o;return c?a+(d-a)*(t-o)/c:a}class Ap extends Hr{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=Ei(n,this.min),this._tableRange=Ei(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:s}=this,r=[],o=[];let i,a,d,c,u;for(i=0,a=t.length;i<a;++i)c=t[i],c>=n&&c<=s&&r.push(c);if(r.length<2)return[{time:n,pos:0},{time:s,pos:1}];for(i=0,a=r.length;i<a;++i)u=r[i+1],d=r[i-1],c=r[i],Math.round((u+d)/2)!==c&&o.push({time:c,pos:i/(a-1)});return o}_generate(){const t=this.min,n=this.max;let s=super.getDataTimestamps();return(!s.includes(t)||!s.length)&&s.splice(0,0,t),(!s.includes(n)||s.length===1)&&s.push(n),s.sort((r,o)=>r-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),s=this.getLabelTimestamps();return n.length&&s.length?t=this.normalize(n.concat(s)):t=n.length?n:s,t=this._cache.all=t,t}getDecimalForValue(t){return(Ei(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,s=this.getDecimalForPixel(t)/n.factor-n.end;return Ei(this._table,s*this._tableRange+this._minPos,!0)}}I(Ap,"id","timeseries"),I(Ap,"defaults",Hr.defaults);const Fp=6048e5,BS=864e5,Vr=6e4,Ur=36e5,HS=1e3,zp=Symbol.for("constructDateFrom");function De(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&zp in e?e[zp](t):e instanceof Date?new e.constructor(t):new Date(t)}function ee(e,t){return De(t||e,e)}function Rr(e,t,n){const s=ee(e,n==null?void 0:n.in);return isNaN(t)?De((n==null?void 0:n.in)||e,NaN):(t&&s.setDate(s.getDate()+t),s)}function Pi(e,t,n){const s=ee(e,n==null?void 0:n.in);if(isNaN(t))return De((n==null?void 0:n.in)||e,NaN);if(!t)return s;const r=s.getDate(),o=De((n==null?void 0:n.in)||e,s.getTime());o.setMonth(s.getMonth()+t+1,0);const i=o.getDate();return r>=i?o:(s.setFullYear(o.getFullYear(),o.getMonth(),r),s)}function dd(e,t,n){return De((n==null?void 0:n.in)||e,+ee(e)+t)}function VS(e,t,n){return dd(e,t*Ur,n)}let US={};function rs(){return US}function Mt(e,t){var a,d,c,u;const n=rs(),s=(t==null?void 0:t.weekStartsOn)??((d=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:d.weekStartsOn)??n.weekStartsOn??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,r=ee(e,t==null?void 0:t.in),o=r.getDay(),i=(o<s?7:0)+o-s;return r.setDate(r.getDate()-i),r.setHours(0,0,0,0),r}function zs(e,t){return Mt(e,{...t,weekStartsOn:1})}function Wp(e,t){const n=ee(e,t==null?void 0:t.in),s=n.getFullYear(),r=De(n,0);r.setFullYear(s+1,0,4),r.setHours(0,0,0,0);const o=zs(r),i=De(n,0);i.setFullYear(s,0,4),i.setHours(0,0,0,0);const a=zs(i);return n.getTime()>=o.getTime()?s+1:n.getTime()>=a.getTime()?s:s-1}function Ti(e){const t=ee(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function os(e,...t){const n=De.bind(null,e||t.find(s=>typeof s=="object"));return t.map(n)}function is(e,t){const n=ee(e,t==null?void 0:t.in);return n.setHours(0,0,0,0),n}function Bp(e,t,n){const[s,r]=os(n==null?void 0:n.in,e,t),o=is(s),i=is(r),a=+o-Ti(o),d=+i-Ti(i);return Math.round((a-d)/BS)}function RS(e,t){const n=Wp(e,t),s=De((t==null?void 0:t.in)||e,0);return s.setFullYear(n,0,4),s.setHours(0,0,0,0),zs(s)}function $S(e,t,n){const s=ee(e,n==null?void 0:n.in);return s.setTime(s.getTime()+t*Vr),s}function qS(e,t,n){return Pi(e,t*3,n)}function YS(e,t,n){return dd(e,t*1e3,n)}function KS(e,t,n){return Rr(e,t*7,n)}function Hp(e,t,n){return Pi(e,t*12,n)}function $r(e,t){const n=+ee(e)-+ee(t);return n<0?-1:n>0?1:n}function GS(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Vp(e){return!(!GS(e)&&typeof e!="number"||isNaN(+ee(e)))}function XS(e,t,n){const[s,r]=os(n==null?void 0:n.in,e,t),o=s.getFullYear()-r.getFullYear(),i=s.getMonth()-r.getMonth();return o*12+i}function QS(e,t,n){const[s,r]=os(n==null?void 0:n.in,e,t);return s.getFullYear()-r.getFullYear()}function Up(e,t,n){const[s,r]=os(n==null?void 0:n.in,e,t),o=Rp(s,r),i=Math.abs(Bp(s,r));s.setDate(s.getDate()-o*i);const a=+(Rp(s,r)===-o),d=o*(i-a);return d===0?0:d}function Rp(e,t){const n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function qr(e){return t=>{const s=(e?Math[e]:Math.trunc)(t);return s===0?0:s}}function ZS(e,t,n){const[s,r]=os(n==null?void 0:n.in,e,t),o=(+s-+r)/Ur;return qr(n==null?void 0:n.roundingMethod)(o)}function cd(e,t){return+ee(e)-+ee(t)}function JS(e,t,n){const s=cd(e,t)/Vr;return qr(n==null?void 0:n.roundingMethod)(s)}function wt(e,t){const n=ee(e,t==null?void 0:t.in);return n.setHours(23,59,59,999),n}function $p(e,t){const n=ee(e,t==null?void 0:t.in),s=n.getMonth();return n.setFullYear(n.getFullYear(),s+1,0),n.setHours(23,59,59,999),n}function eN(e,t){const n=ee(e,t==null?void 0:t.in);return+wt(n,t)==+$p(n,t)}function qp(e,t,n){const[s,r,o]=os(n==null?void 0:n.in,e,e,t),i=$r(r,o),a=Math.abs(XS(r,o));if(a<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*a);let d=$r(r,o)===-i;eN(s)&&a===1&&$r(s,o)===1&&(d=!1);const c=i*(a-+d);return c===0?0:c}function tN(e,t,n){const s=qp(e,t,n)/3;return qr(n==null?void 0:n.roundingMethod)(s)}function nN(e,t,n){const s=cd(e,t)/1e3;return qr(n==null?void 0:n.roundingMethod)(s)}function sN(e,t,n){const s=Up(e,t,n)/7;return qr(n==null?void 0:n.roundingMethod)(s)}function rN(e,t,n){const[s,r]=os(n==null?void 0:n.in,e,t),o=$r(s,r),i=Math.abs(QS(s,r));s.setFullYear(1584),r.setFullYear(1584);const a=$r(s,r)===-o,d=o*(i-+a);return d===0?0:d}function oN(e,t){const n=ee(e,t==null?void 0:t.in),s=n.getMonth(),r=s-s%3;return n.setMonth(r,1),n.setHours(0,0,0,0),n}function Di(e,t){const n=ee(e,t==null?void 0:t.in);return n.setDate(1),n.setHours(0,0,0,0),n}function iN(e,t){const n=ee(e,t==null?void 0:t.in),s=n.getFullYear();return n.setFullYear(s+1,0,0),n.setHours(23,59,59,999),n}function Yr(e,t){const n=ee(e,t==null?void 0:t.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function aN(e,t){const n=ee(e,t==null?void 0:t.in);return n.setMinutes(59,59,999),n}function lN(e,t){var a,d,c,u;const n=rs(),s=(t==null?void 0:t.weekStartsOn)??((d=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:d.weekStartsOn)??n.weekStartsOn??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,r=ee(e,t==null?void 0:t.in),o=r.getDay(),i=(o<s?-7:0)+6-(o-s);return r.setDate(r.getDate()+i),r.setHours(23,59,59,999),r}function dN(e,t){const n=ee(e,t==null?void 0:t.in);return n.setSeconds(59,999),n}function cN(e,t){const n=ee(e,t==null?void 0:t.in),s=n.getMonth(),r=s-s%3+3;return n.setMonth(r,0),n.setHours(23,59,59,999),n}function uN(e,t){const n=ee(e,t==null?void 0:t.in);return n.setMilliseconds(999),n}const hN={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"}},fN=(e,t,n)=>{let s;const r=hN[e];return typeof r=="string"?s=r:t===1?s=r.one:s=r.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function ud(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const mN={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},pN={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},gN={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},bN={date:ud({formats:mN,defaultWidth:"full"}),time:ud({formats:pN,defaultWidth:"full"}),dateTime:ud({formats:gN,defaultWidth:"full"})},xN={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},wN=(e,t,n,s)=>xN[e];function Kr(e){return(t,n)=>{const s=n!=null&&n.context?String(n.context):"standalone";let r;if(s==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,a=n!=null&&n.width?String(n.width):i;r=e.formattingValues[a]||e.formattingValues[i]}else{const i=e.defaultWidth,a=n!=null&&n.width?String(n.width):e.defaultWidth;r=e.values[a]||e.values[i]}const o=e.argumentCallback?e.argumentCallback(t):t;return r[o]}}const _N={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},yN={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},vN={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"]},kN={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"]},jN={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"}},SN={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"}},NN={ordinalNumber:(e,t)=>{const n=Number(e),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:Kr({values:_N,defaultWidth:"wide"}),quarter:Kr({values:yN,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Kr({values:vN,defaultWidth:"wide"}),day:Kr({values:kN,defaultWidth:"wide"}),dayPeriod:Kr({values:jN,defaultWidth:"wide",formattingValues:SN,defaultFormattingWidth:"wide"})};function Gr(e){return(t,n={})=>{const s=n.width,r=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],o=t.match(r);if(!o)return null;const i=o[0],a=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(a)?MN(a,h=>h.test(i)):CN(a,h=>h.test(i));let c;c=e.valueCallback?e.valueCallback(d):d,c=n.valueCallback?n.valueCallback(c):c;const u=t.slice(i.length);return{value:c,rest:u}}}function CN(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function MN(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function EN(e){return(t,n={})=>{const s=t.match(e.matchPattern);if(!s)return null;const r=s[0],o=t.match(e.parsePattern);if(!o)return null;let i=e.valueCallback?e.valueCallback(o[0]):o[0];i=n.valueCallback?n.valueCallback(i):i;const a=t.slice(r.length);return{value:i,rest:a}}}const PN=/^(\d+)(th|st|nd|rd)?/i,TN=/\d+/i,DN={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},IN={any:[/^b/i,/^(a|c)/i]},ON={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},LN={any:[/1/i,/2/i,/3/i,/4/i]},AN={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},FN={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]},zN={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},WN={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]},BN={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},HN={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}},VN={ordinalNumber:EN({matchPattern:PN,parsePattern:TN,valueCallback:e=>parseInt(e,10)}),era:Gr({matchPatterns:DN,defaultMatchWidth:"wide",parsePatterns:IN,defaultParseWidth:"any"}),quarter:Gr({matchPatterns:ON,defaultMatchWidth:"wide",parsePatterns:LN,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Gr({matchPatterns:AN,defaultMatchWidth:"wide",parsePatterns:FN,defaultParseWidth:"any"}),day:Gr({matchPatterns:zN,defaultMatchWidth:"wide",parsePatterns:WN,defaultParseWidth:"any"}),dayPeriod:Gr({matchPatterns:BN,defaultMatchWidth:"any",parsePatterns:HN,defaultParseWidth:"any"})},Yp={code:"en-US",formatDistance:fN,formatLong:bN,formatRelative:wN,localize:NN,match:VN,options:{weekStartsOn:0,firstWeekContainsDate:1}};function UN(e,t){const n=ee(e,t==null?void 0:t.in);return Bp(n,Yr(n))+1}function Kp(e,t){const n=ee(e,t==null?void 0:t.in),s=+zs(n)-+RS(n);return Math.round(s/Fp)+1}function hd(e,t){var u,h,m,f;const n=ee(e,t==null?void 0:t.in),s=n.getFullYear(),r=rs(),o=(t==null?void 0:t.firstWeekContainsDate)??((h=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??r.firstWeekContainsDate??((f=(m=r.locale)==null?void 0:m.options)==null?void 0:f.firstWeekContainsDate)??1,i=De((t==null?void 0:t.in)||e,0);i.setFullYear(s+1,0,o),i.setHours(0,0,0,0);const a=Mt(i,t),d=De((t==null?void 0:t.in)||e,0);d.setFullYear(s,0,o),d.setHours(0,0,0,0);const c=Mt(d,t);return+n>=+a?s+1:+n>=+c?s:s-1}function RN(e,t){var a,d,c,u;const n=rs(),s=(t==null?void 0:t.firstWeekContainsDate)??((d=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:d.firstWeekContainsDate)??n.firstWeekContainsDate??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,r=hd(e,t),o=De((t==null?void 0:t.in)||e,0);return o.setFullYear(r,0,s),o.setHours(0,0,0,0),Mt(o,t)}function Gp(e,t){const n=ee(e,t==null?void 0:t.in),s=+Mt(n,t)-+RN(n,t);return Math.round(s/Fp)+1}function _e(e,t){const n=e<0?"-":"",s=Math.abs(e).toString().padStart(t,"0");return n+s}const Cn={y(e,t){const n=e.getFullYear(),s=n>0?n:1-n;return _e(t==="yy"?s%100:s,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):_e(n+1,2)},d(e,t){return _e(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return _e(e.getHours()%12||12,t.length)},H(e,t){return _e(e.getHours(),t.length)},m(e,t){return _e(e.getMinutes(),t.length)},s(e,t){return _e(e.getSeconds(),t.length)},S(e,t){const n=t.length,s=e.getMilliseconds(),r=Math.trunc(s*Math.pow(10,n-3));return _e(r,t.length)}},Ws={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Xp={G:function(e,t,n){const s=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});case"GGGG":default:return n.era(s,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const s=e.getFullYear(),r=s>0?s:1-s;return n.ordinalNumber(r,{unit:"year"})}return Cn.y(e,t)},Y:function(e,t,n,s){const r=hd(e,s),o=r>0?r:1-r;if(t==="YY"){const i=o%100;return _e(i,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):_e(o,t.length)},R:function(e,t){const n=Wp(e);return _e(n,t.length)},u:function(e,t){const n=e.getFullYear();return _e(n,t.length)},Q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return _e(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return _e(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(e,t,n){const s=e.getMonth();switch(t){case"M":case"MM":return Cn.M(e,t);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(e,t,n){const s=e.getMonth();switch(t){case"L":return String(s+1);case"LL":return _e(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(e,t,n,s){const r=Gp(e,s);return t==="wo"?n.ordinalNumber(r,{unit:"week"}):_e(r,t.length)},I:function(e,t,n){const s=Kp(e);return t==="Io"?n.ordinalNumber(s,{unit:"week"}):_e(s,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Cn.d(e,t)},D:function(e,t,n){const s=UN(e);return t==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):_e(s,t.length)},E:function(e,t,n){const s=e.getDay();switch(t){case"E":case"EE":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"})}},e:function(e,t,n,s){const r=e.getDay(),o=(r-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return _e(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});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"})}},c:function(e,t,n,s){const r=e.getDay(),o=(r-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return _e(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});case"cccc":default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(e,t,n){const s=e.getDay(),r=s===0?7:s;switch(t){case"i":return String(r);case"ii":return _e(r,t.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});case"iiii":default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(e,t,n){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){const s=e.getHours();let r;switch(s===12?r=Ws.noon:s===0?r=Ws.midnight:r=s/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){const s=e.getHours();let r;switch(s>=17?r=Ws.evening:s>=12?r=Ws.afternoon:s>=4?r=Ws.morning:r=Ws.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let s=e.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return Cn.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Cn.H(e,t)},K:function(e,t,n){const s=e.getHours()%12;return t==="Ko"?n.ordinalNumber(s,{unit:"hour"}):_e(s,t.length)},k:function(e,t,n){let s=e.getHours();return s===0&&(s=24),t==="ko"?n.ordinalNumber(s,{unit:"hour"}):_e(s,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Cn.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Cn.s(e,t)},S:function(e,t){return Cn.S(e,t)},X:function(e,t,n){const s=e.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return Zp(s);case"XXXX":case"XX":return as(s);case"XXXXX":case"XXX":default:return as(s,":")}},x:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"x":return Zp(s);case"xxxx":case"xx":return as(s);case"xxxxx":case"xxx":default:return as(s,":")}},O:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Qp(s,":");case"OOOO":default:return"GMT"+as(s,":")}},z:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Qp(s,":");case"zzzz":default:return"GMT"+as(s,":")}},t:function(e,t,n){const s=Math.trunc(+e/1e3);return _e(s,t.length)},T:function(e,t,n){return _e(+e,t.length)}};function Qp(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),r=Math.trunc(s/60),o=s%60;return o===0?n+String(r):n+String(r)+t+_e(o,2)}function Zp(e,t){return e%60===0?(e>0?"-":"+")+_e(Math.abs(e)/60,2):as(e,t)}function as(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),r=_e(Math.trunc(s/60),2),o=_e(s%60,2);return n+r+t+o}const Jp=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},eg=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},fd={p:eg,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],s=n[1],r=n[2];if(!r)return Jp(e,t);let o;switch(s){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",Jp(s,t)).replace("{{time}}",eg(r,t))}},$N=/^D+$/,qN=/^Y+$/,YN=["D","DD","YY","YYYY"];function tg(e){return $N.test(e)}function ng(e){return qN.test(e)}function md(e,t,n){const s=KN(e,t,n);if(console.warn(s),YN.includes(e))throw new RangeError(s)}function KN(e,t,n){const s=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const GN=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,XN=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,QN=/^'([^]*?)'?$/,ZN=/''/g,JN=/[a-zA-Z]/;function Xr(e,t,n){var u,h,m,f,g,b,x,w;const s=rs(),r=(n==null?void 0:n.locale)??s.locale??Yp,o=(n==null?void 0:n.firstWeekContainsDate)??((h=(u=n==null?void 0:n.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??s.firstWeekContainsDate??((f=(m=s.locale)==null?void 0:m.options)==null?void 0:f.firstWeekContainsDate)??1,i=(n==null?void 0:n.weekStartsOn)??((b=(g=n==null?void 0:n.locale)==null?void 0:g.options)==null?void 0:b.weekStartsOn)??s.weekStartsOn??((w=(x=s.locale)==null?void 0:x.options)==null?void 0:w.weekStartsOn)??0,a=ee(e,n==null?void 0:n.in);if(!Vp(a))throw new RangeError("Invalid time value");let d=t.match(XN).map(_=>{const y=_[0];if(y==="p"||y==="P"){const v=fd[y];return v(_,r.formatLong)}return _}).join("").match(GN).map(_=>{if(_==="''")return{isToken:!1,value:"'"};const y=_[0];if(y==="'")return{isToken:!1,value:eC(_)};if(Xp[y])return{isToken:!0,value:_};if(y.match(JN))throw new RangeError("Format string contains an unescaped latin alphabet character `"+y+"`");return{isToken:!1,value:_}});r.localize.preprocessor&&(d=r.localize.preprocessor(a,d));const c={firstWeekContainsDate:o,weekStartsOn:i,locale:r};return d.map(_=>{if(!_.isToken)return _.value;const y=_.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&ng(y)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&tg(y))&&md(y,t,String(e));const v=Xp[y[0]];return v(a,y,r.localize,c)}).join("")}function eC(e){const t=e.match(QN);return t?t[1].replace(ZN,"'"):e}function tC(){return Object.assign({},rs())}function nC(e,t){const n=ee(e,t==null?void 0:t.in).getDay();return n===0?7:n}function sC(e,t){const n=rC(t)?new t(0):De(t,0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}function rC(e){var t;return typeof e=="function"&&((t=e.prototype)==null?void 0:t.constructor)===e}const oC=10;class sg{constructor(){I(this,"subPriority",0)}validate(t,n){return!0}}class iC extends sg{constructor(t,n,s,r,o){super(),this.value=t,this.validateValue=n,this.setValue=s,this.priority=r,o&&(this.subPriority=o)}validate(t,n){return this.validateValue(t,this.value,n)}set(t,n,s){return this.setValue(t,n,this.value,s)}}class aC extends sg{constructor(n,s){super();I(this,"priority",oC);I(this,"subPriority",-1);this.context=n||(r=>De(s,r))}set(n,s){return s.timestampIsSet?n:De(n,sC(n,this.context))}}class ge{run(t,n,s,r){const o=this.parse(t,n,s,r);return o?{setter:new iC(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(t,n,s){return!0}}class lC extends ge{constructor(){super(...arguments);I(this,"priority",140);I(this,"incompatibleTokens",["R","u","t","T"])}parse(n,s,r){switch(s){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"})||r.era(n,{width:"narrow"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})||r.era(n,{width:"abbreviated"})||r.era(n,{width:"narrow"})}}set(n,s,r){return s.era=r,n.setFullYear(r,0,1),n.setHours(0,0,0,0),n}}const Ae={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},$t={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function Fe(e,t){return e&&{value:t(e.value),rest:e.rest}}function Ce(e,t){const n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function qt(e,t){const n=t.match(e);if(!n)return null;if(n[0]==="Z")return{value:0,rest:t.slice(1)};const s=n[1]==="+"?1:-1,r=n[2]?parseInt(n[2],10):0,o=n[3]?parseInt(n[3],10):0,i=n[5]?parseInt(n[5],10):0;return{value:s*(r*Ur+o*Vr+i*HS),rest:t.slice(n[0].length)}}function rg(e){return Ce(Ae.anyDigitsSigned,e)}function Ie(e,t){switch(e){case 1:return Ce(Ae.singleDigit,t);case 2:return Ce(Ae.twoDigits,t);case 3:return Ce(Ae.threeDigits,t);case 4:return Ce(Ae.fourDigits,t);default:return Ce(new RegExp("^\\d{1,"+e+"}"),t)}}function Ii(e,t){switch(e){case 1:return Ce(Ae.singleDigitSigned,t);case 2:return Ce(Ae.twoDigitsSigned,t);case 3:return Ce(Ae.threeDigitsSigned,t);case 4:return Ce(Ae.fourDigitsSigned,t);default:return Ce(new RegExp("^-?\\d{1,"+e+"}"),t)}}function pd(e){switch(e){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function og(e,t){const n=t>0,s=n?t:1-t;let r;if(s<=50)r=e||100;else{const o=s+50,i=Math.trunc(o/100)*100,a=e>=o%100;r=e+i-(a?100:0)}return n?r:1-r}function ig(e){return e%400===0||e%4===0&&e%100!==0}class dC extends ge{constructor(){super(...arguments);I(this,"priority",130);I(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(n,s,r){const o=i=>({year:i,isTwoDigitYear:s==="yy"});switch(s){case"y":return Fe(Ie(4,n),o);case"yo":return Fe(r.ordinalNumber(n,{unit:"year"}),o);default:return Fe(Ie(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,r){const o=n.getFullYear();if(r.isTwoDigitYear){const a=og(r.year,o);return n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}const i=!("era"in s)||s.era===1?r.year:1-r.year;return n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}}class cC extends ge{constructor(){super(...arguments);I(this,"priority",130);I(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(n,s,r){const o=i=>({year:i,isTwoDigitYear:s==="YY"});switch(s){case"Y":return Fe(Ie(4,n),o);case"Yo":return Fe(r.ordinalNumber(n,{unit:"year"}),o);default:return Fe(Ie(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,r,o){const i=hd(n,o);if(r.isTwoDigitYear){const d=og(r.year,i);return n.setFullYear(d,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),Mt(n,o)}const a=!("era"in s)||s.era===1?r.year:1-r.year;return n.setFullYear(a,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),Mt(n,o)}}class uC extends ge{constructor(){super(...arguments);I(this,"priority",130);I(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,s){return Ii(s==="R"?4:s.length,n)}set(n,s,r){const o=De(n,0);return o.setFullYear(r,0,4),o.setHours(0,0,0,0),zs(o)}}class hC extends ge{constructor(){super(...arguments);I(this,"priority",130);I(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,s){return Ii(s==="u"?4:s.length,n)}set(n,s,r){return n.setFullYear(r,0,1),n.setHours(0,0,0,0),n}}class fC extends ge{constructor(){super(...arguments);I(this,"priority",120);I(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,r){switch(s){case"Q":case"QQ":return Ie(s.length,n);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"})||r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})||r.quarter(n,{width:"abbreviated",context:"formatting"})||r.quarter(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=1&&s<=4}set(n,s,r){return n.setMonth((r-1)*3,1),n.setHours(0,0,0,0),n}}class mC extends ge{constructor(){super(...arguments);I(this,"priority",120);I(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,r){switch(s){case"q":case"qq":return Ie(s.length,n);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"})||r.quarter(n,{width:"narrow",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})||r.quarter(n,{width:"abbreviated",context:"standalone"})||r.quarter(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=1&&s<=4}set(n,s,r){return n.setMonth((r-1)*3,1),n.setHours(0,0,0,0),n}}class pC extends ge{constructor(){super(...arguments);I(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);I(this,"priority",110)}parse(n,s,r){const o=i=>i-1;switch(s){case"M":return Fe(Ce(Ae.month,n),o);case"MM":return Fe(Ie(2,n),o);case"Mo":return Fe(r.ordinalNumber(n,{unit:"month"}),o);case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"})||r.month(n,{width:"narrow",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})||r.month(n,{width:"abbreviated",context:"formatting"})||r.month(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=11}set(n,s,r){return n.setMonth(r,1),n.setHours(0,0,0,0),n}}class gC extends ge{constructor(){super(...arguments);I(this,"priority",110);I(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(n,s,r){const o=i=>i-1;switch(s){case"L":return Fe(Ce(Ae.month,n),o);case"LL":return Fe(Ie(2,n),o);case"Lo":return Fe(r.ordinalNumber(n,{unit:"month"}),o);case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"})||r.month(n,{width:"narrow",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})||r.month(n,{width:"abbreviated",context:"standalone"})||r.month(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=11}set(n,s,r){return n.setMonth(r,1),n.setHours(0,0,0,0),n}}function bC(e,t,n){const s=ee(e,n==null?void 0:n.in),r=Gp(s,n)-t;return s.setDate(s.getDate()-r*7),ee(s,n==null?void 0:n.in)}class xC extends ge{constructor(){super(...arguments);I(this,"priority",100);I(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,s,r){switch(s){case"w":return Ce(Ae.week,n);case"wo":return r.ordinalNumber(n,{unit:"week"});default:return Ie(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,r,o){return Mt(bC(n,r,o),o)}}function wC(e,t,n){const s=ee(e,n==null?void 0:n.in),r=Kp(s,n)-t;return s.setDate(s.getDate()-r*7),s}class _C extends ge{constructor(){super(...arguments);I(this,"priority",100);I(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(n,s,r){switch(s){case"I":return Ce(Ae.week,n);case"Io":return r.ordinalNumber(n,{unit:"week"});default:return Ie(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,r){return zs(wC(n,r))}}const yC=[31,28,31,30,31,30,31,31,30,31,30,31],vC=[31,29,31,30,31,30,31,31,30,31,30,31];class kC extends ge{constructor(){super(...arguments);I(this,"priority",90);I(this,"subPriority",1);I(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,s,r){switch(s){case"d":return Ce(Ae.date,n);case"do":return r.ordinalNumber(n,{unit:"date"});default:return Ie(s.length,n)}}validate(n,s){const r=n.getFullYear(),o=ig(r),i=n.getMonth();return o?s>=1&&s<=vC[i]:s>=1&&s<=yC[i]}set(n,s,r){return n.setDate(r),n.setHours(0,0,0,0),n}}class jC extends ge{constructor(){super(...arguments);I(this,"priority",90);I(this,"subpriority",1);I(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(n,s,r){switch(s){case"D":case"DD":return Ce(Ae.dayOfYear,n);case"Do":return r.ordinalNumber(n,{unit:"date"});default:return Ie(s.length,n)}}validate(n,s){const r=n.getFullYear();return ig(r)?s>=1&&s<=366:s>=1&&s<=365}set(n,s,r){return n.setMonth(0,r),n.setHours(0,0,0,0),n}}function gd(e,t,n){var h,m,f,g;const s=rs(),r=(n==null?void 0:n.weekStartsOn)??((m=(h=n==null?void 0:n.locale)==null?void 0:h.options)==null?void 0:m.weekStartsOn)??s.weekStartsOn??((g=(f=s.locale)==null?void 0:f.options)==null?void 0:g.weekStartsOn)??0,o=ee(e,n==null?void 0:n.in),i=o.getDay(),d=(t%7+7)%7,c=7-r,u=t<0||t>6?t-(i+c)%7:(d+c)%7-(i+c)%7;return Rr(o,u,n)}class SC extends ge{constructor(){super(...arguments);I(this,"priority",90);I(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(n,s,r){switch(s){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"})||r.day(n,{width:"short",context:"formatting"})||r.day(n,{width:"narrow",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"})||r.day(n,{width:"narrow",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})||r.day(n,{width:"abbreviated",context:"formatting"})||r.day(n,{width:"short",context:"formatting"})||r.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,r,o){return n=gd(n,r,o),n.setHours(0,0,0,0),n}}class NC extends ge{constructor(){super(...arguments);I(this,"priority",90);I(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(n,s,r,o){const i=a=>{const d=Math.floor((a-1)/7)*7;return(a+o.weekStartsOn+6)%7+d};switch(s){case"e":case"ee":return Fe(Ie(s.length,n),i);case"eo":return Fe(r.ordinalNumber(n,{unit:"day"}),i);case"eee":return r.day(n,{width:"abbreviated",context:"formatting"})||r.day(n,{width:"short",context:"formatting"})||r.day(n,{width:"narrow",context:"formatting"});case"eeeee":return r.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(n,{width:"short",context:"formatting"})||r.day(n,{width:"narrow",context:"formatting"});case"eeee":default:return r.day(n,{width:"wide",context:"formatting"})||r.day(n,{width:"abbreviated",context:"formatting"})||r.day(n,{width:"short",context:"formatting"})||r.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,r,o){return n=gd(n,r,o),n.setHours(0,0,0,0),n}}class CC extends ge{constructor(){super(...arguments);I(this,"priority",90);I(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(n,s,r,o){const i=a=>{const d=Math.floor((a-1)/7)*7;return(a+o.weekStartsOn+6)%7+d};switch(s){case"c":case"cc":return Fe(Ie(s.length,n),i);case"co":return Fe(r.ordinalNumber(n,{unit:"day"}),i);case"ccc":return r.day(n,{width:"abbreviated",context:"standalone"})||r.day(n,{width:"short",context:"standalone"})||r.day(n,{width:"narrow",context:"standalone"});case"ccccc":return r.day(n,{width:"narrow",context:"standalone"});case"cccccc":return r.day(n,{width:"short",context:"standalone"})||r.day(n,{width:"narrow",context:"standalone"});case"cccc":default:return r.day(n,{width:"wide",context:"standalone"})||r.day(n,{width:"abbreviated",context:"standalone"})||r.day(n,{width:"short",context:"standalone"})||r.day(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=6}set(n,s,r,o){return n=gd(n,r,o),n.setHours(0,0,0,0),n}}function MC(e,t,n){const s=ee(e,n==null?void 0:n.in),r=nC(s,n),o=t-r;return Rr(s,o,n)}class EC extends ge{constructor(){super(...arguments);I(this,"priority",90);I(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(n,s,r){const o=i=>i===0?7:i;switch(s){case"i":case"ii":return Ie(s.length,n);case"io":return r.ordinalNumber(n,{unit:"day"});case"iii":return Fe(r.day(n,{width:"abbreviated",context:"formatting"})||r.day(n,{width:"short",context:"formatting"})||r.day(n,{width:"narrow",context:"formatting"}),o);case"iiiii":return Fe(r.day(n,{width:"narrow",context:"formatting"}),o);case"iiiiii":return Fe(r.day(n,{width:"short",context:"formatting"})||r.day(n,{width:"narrow",context:"formatting"}),o);case"iiii":default:return Fe(r.day(n,{width:"wide",context:"formatting"})||r.day(n,{width:"abbreviated",context:"formatting"})||r.day(n,{width:"short",context:"formatting"})||r.day(n,{width:"narrow",context:"formatting"}),o)}}validate(n,s){return s>=1&&s<=7}set(n,s,r){return n=MC(n,r),n.setHours(0,0,0,0),n}}class PC extends ge{constructor(){super(...arguments);I(this,"priority",80);I(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(n,s,r){switch(s){case"a":case"aa":case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"})||r.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(n,{width:"wide",context:"formatting"})||r.dayPeriod(n,{width:"abbreviated",context:"formatting"})||r.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,r){return n.setHours(pd(r),0,0,0),n}}class TC extends ge{constructor(){super(...arguments);I(this,"priority",80);I(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(n,s,r){switch(s){case"b":case"bb":case"bbb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"})||r.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbbb":return r.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(n,{width:"wide",context:"formatting"})||r.dayPeriod(n,{width:"abbreviated",context:"formatting"})||r.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,r){return n.setHours(pd(r),0,0,0),n}}class DC extends ge{constructor(){super(...arguments);I(this,"priority",80);I(this,"incompatibleTokens",["a","b","t","T"])}parse(n,s,r){switch(s){case"B":case"BB":case"BBB":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"})||r.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBBB":return r.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(n,{width:"wide",context:"formatting"})||r.dayPeriod(n,{width:"abbreviated",context:"formatting"})||r.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,r){return n.setHours(pd(r),0,0,0),n}}class IC extends ge{constructor(){super(...arguments);I(this,"priority",70);I(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,s,r){switch(s){case"h":return Ce(Ae.hour12h,n);case"ho":return r.ordinalNumber(n,{unit:"hour"});default:return Ie(s.length,n)}}validate(n,s){return s>=1&&s<=12}set(n,s,r){const o=n.getHours()>=12;return o&&r<12?n.setHours(r+12,0,0,0):!o&&r===12?n.setHours(0,0,0,0):n.setHours(r,0,0,0),n}}class OC extends ge{constructor(){super(...arguments);I(this,"priority",70);I(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,s,r){switch(s){case"H":return Ce(Ae.hour23h,n);case"Ho":return r.ordinalNumber(n,{unit:"hour"});default:return Ie(s.length,n)}}validate(n,s){return s>=0&&s<=23}set(n,s,r){return n.setHours(r,0,0,0),n}}class LC extends ge{constructor(){super(...arguments);I(this,"priority",70);I(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,s,r){switch(s){case"K":return Ce(Ae.hour11h,n);case"Ko":return r.ordinalNumber(n,{unit:"hour"});default:return Ie(s.length,n)}}validate(n,s){return s>=0&&s<=11}set(n,s,r){return n.getHours()>=12&&r<12?n.setHours(r+12,0,0,0):n.setHours(r,0,0,0),n}}class AC extends ge{constructor(){super(...arguments);I(this,"priority",70);I(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,s,r){switch(s){case"k":return Ce(Ae.hour24h,n);case"ko":return r.ordinalNumber(n,{unit:"hour"});default:return Ie(s.length,n)}}validate(n,s){return s>=1&&s<=24}set(n,s,r){const o=r<=24?r%24:r;return n.setHours(o,0,0,0),n}}class FC extends ge{constructor(){super(...arguments);I(this,"priority",60);I(this,"incompatibleTokens",["t","T"])}parse(n,s,r){switch(s){case"m":return Ce(Ae.minute,n);case"mo":return r.ordinalNumber(n,{unit:"minute"});default:return Ie(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,r){return n.setMinutes(r,0,0),n}}class zC extends ge{constructor(){super(...arguments);I(this,"priority",50);I(this,"incompatibleTokens",["t","T"])}parse(n,s,r){switch(s){case"s":return Ce(Ae.second,n);case"so":return r.ordinalNumber(n,{unit:"second"});default:return Ie(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,r){return n.setSeconds(r,0),n}}class WC extends ge{constructor(){super(...arguments);I(this,"priority",30);I(this,"incompatibleTokens",["t","T"])}parse(n,s){const r=o=>Math.trunc(o*Math.pow(10,-s.length+3));return Fe(Ie(s.length,n),r)}set(n,s,r){return n.setMilliseconds(r),n}}class BC extends ge{constructor(){super(...arguments);I(this,"priority",10);I(this,"incompatibleTokens",["t","T","x"])}parse(n,s){switch(s){case"X":return qt($t.basicOptionalMinutes,n);case"XX":return qt($t.basic,n);case"XXXX":return qt($t.basicOptionalSeconds,n);case"XXXXX":return qt($t.extendedOptionalSeconds,n);case"XXX":default:return qt($t.extended,n)}}set(n,s,r){return s.timestampIsSet?n:De(n,n.getTime()-Ti(n)-r)}}class HC extends ge{constructor(){super(...arguments);I(this,"priority",10);I(this,"incompatibleTokens",["t","T","X"])}parse(n,s){switch(s){case"x":return qt($t.basicOptionalMinutes,n);case"xx":return qt($t.basic,n);case"xxxx":return qt($t.basicOptionalSeconds,n);case"xxxxx":return qt($t.extendedOptionalSeconds,n);case"xxx":default:return qt($t.extended,n)}}set(n,s,r){return s.timestampIsSet?n:De(n,n.getTime()-Ti(n)-r)}}class VC extends ge{constructor(){super(...arguments);I(this,"priority",40);I(this,"incompatibleTokens","*")}parse(n){return rg(n)}set(n,s,r){return[De(n,r*1e3),{timestampIsSet:!0}]}}class UC extends ge{constructor(){super(...arguments);I(this,"priority",20);I(this,"incompatibleTokens","*")}parse(n){return rg(n)}set(n,s,r){return[De(n,r),{timestampIsSet:!0}]}}const RC={G:new lC,y:new dC,Y:new cC,R:new uC,u:new hC,Q:new fC,q:new mC,M:new pC,L:new gC,w:new xC,I:new _C,d:new kC,D:new jC,E:new SC,e:new NC,c:new CC,i:new EC,a:new PC,b:new TC,B:new DC,h:new IC,H:new OC,K:new LC,k:new AC,m:new FC,s:new zC,S:new WC,X:new BC,x:new HC,t:new VC,T:new UC},$C=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,qC=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,YC=/^'([^]*?)'?$/,KC=/''/g,GC=/\S/,XC=/[a-zA-Z]/;function QC(e,t,n,s){var x,w,_,y,v,j,k,M;const r=()=>De((s==null?void 0:s.in)||n,NaN),o=tC(),i=(s==null?void 0:s.locale)??o.locale??Yp,a=(s==null?void 0:s.firstWeekContainsDate)??((w=(x=s==null?void 0:s.locale)==null?void 0:x.options)==null?void 0:w.firstWeekContainsDate)??o.firstWeekContainsDate??((y=(_=o.locale)==null?void 0:_.options)==null?void 0:y.firstWeekContainsDate)??1,d=(s==null?void 0:s.weekStartsOn)??((j=(v=s==null?void 0:s.locale)==null?void 0:v.options)==null?void 0:j.weekStartsOn)??o.weekStartsOn??((M=(k=o.locale)==null?void 0:k.options)==null?void 0:M.weekStartsOn)??0;if(!t)return e?r():ee(n,s==null?void 0:s.in);const c={firstWeekContainsDate:a,weekStartsOn:d,locale:i},u=[new aC(s==null?void 0:s.in,n)],h=t.match(qC).map(N=>{const T=N[0];if(T in fd){const P=fd[T];return P(N,i.formatLong)}return N}).join("").match($C),m=[];for(let N of h){!(s!=null&&s.useAdditionalWeekYearTokens)&&ng(N)&&md(N,t,e),!(s!=null&&s.useAdditionalDayOfYearTokens)&&tg(N)&&md(N,t,e);const T=N[0],P=RC[T];if(P){const{incompatibleTokens:E}=P;if(Array.isArray(E)){const z=m.find(R=>E.includes(R.token)||R.token===T);if(z)throw new RangeError(`The format string mustn't contain \`${z.fullToken}\` and \`${N}\` at the same time`)}else if(P.incompatibleTokens==="*"&&m.length>0)throw new RangeError(`The format string mustn't contain \`${N}\` and any other token at the same time`);m.push({token:T,fullToken:N});const D=P.run(e,N,i.match,c);if(!D)return r();u.push(D.setter),e=D.rest}else{if(T.match(XC))throw new RangeError("Format string contains an unescaped latin alphabet character `"+T+"`");if(N==="''"?N="'":T==="'"&&(N=ZC(N)),e.indexOf(N)===0)e=e.slice(N.length);else return r()}}if(e.length>0&&GC.test(e))return r();const f=u.map(N=>N.priority).sort((N,T)=>T-N).filter((N,T,P)=>P.indexOf(N)===T).map(N=>u.filter(T=>T.priority===N).sort((T,P)=>P.subPriority-T.subPriority)).map(N=>N[0]);let g=ee(n,s==null?void 0:s.in);if(isNaN(+g))return r();const b={};for(const N of f){if(!N.validate(g,c))return r();const T=N.set(g,b,c);Array.isArray(T)?(g=T[0],Object.assign(b,T[1])):g=T}return g}function ZC(e){return e.match(YC)[1].replace(KC,"'")}function JC(e,t){const n=ee(e,t==null?void 0:t.in);return n.setMinutes(0,0,0),n}function eM(e,t){const n=ee(e,t==null?void 0:t.in);return n.setSeconds(0,0),n}function tM(e,t){const n=ee(e,t==null?void 0:t.in);return n.setMilliseconds(0),n}function Qr(e,t,n){return Rr(e,-t,n)}function nM(e,t){const n=()=>De(t==null?void 0:t.in,NaN),s=(t==null?void 0:t.additionalDigits)??2,r=iM(e);let o;if(r.date){const c=aM(r.date,s);o=lM(c.restDateString,c.year)}if(!o||isNaN(+o))return n();const i=+o;let a=0,d;if(r.time&&(a=dM(r.time),isNaN(a)))return n();if(r.timezone){if(d=cM(r.timezone),isNaN(d))return n()}else{const c=new Date(i+a),u=ee(0,t==null?void 0:t.in);return u.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),u.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),u}return ee(i+a+d,t==null?void 0:t.in)}const Oi={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},sM=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,rM=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,oM=/^([+-])(\d{2})(?::?(\d{2}))?$/;function iM(e){const t={},n=e.split(Oi.dateTimeDelimiter);let s;if(n.length>2)return t;if(/:/.test(n[0])?s=n[0]:(t.date=n[0],s=n[1],Oi.timeZoneDelimiter.test(t.date)&&(t.date=e.split(Oi.timeZoneDelimiter)[0],s=e.substr(t.date.length,e.length))),s){const r=Oi.timezone.exec(s);r?(t.time=s.replace(r[1],""),t.timezone=r[1]):t.time=s}return t}function aM(e,t){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),s=e.match(n);if(!s)return{year:NaN,restDateString:""};const r=s[1]?parseInt(s[1]):null,o=s[2]?parseInt(s[2]):null;return{year:o===null?r:o*100,restDateString:e.slice((s[1]||s[2]).length)}}function lM(e,t){if(t===null)return new Date(NaN);const n=e.match(sM);if(!n)return new Date(NaN);const s=!!n[4],r=Zr(n[1]),o=Zr(n[2])-1,i=Zr(n[3]),a=Zr(n[4]),d=Zr(n[5])-1;if(s)return pM(t,a,d)?uM(t,a,d):new Date(NaN);{const c=new Date(0);return!fM(t,o,i)||!mM(t,r)?new Date(NaN):(c.setUTCFullYear(t,o,Math.max(r,i)),c)}}function Zr(e){return e?parseInt(e):1}function dM(e){const t=e.match(rM);if(!t)return NaN;const n=bd(t[1]),s=bd(t[2]),r=bd(t[3]);return gM(n,s,r)?n*Ur+s*Vr+r*1e3:NaN}function bd(e){return e&&parseFloat(e.replace(",","."))||0}function cM(e){if(e==="Z")return 0;const t=e.match(oM);if(!t)return 0;const n=t[1]==="+"?-1:1,s=parseInt(t[2]),r=t[3]&&parseInt(t[3])||0;return bM(s,r)?n*(s*Ur+r*Vr):NaN}function uM(e,t,n){const s=new Date(0);s.setUTCFullYear(e,0,4);const r=s.getUTCDay()||7,o=(t-1)*7+n+1-r;return s.setUTCDate(s.getUTCDate()+o),s}const hM=[31,null,31,30,31,30,31,31,30,31,30,31];function ag(e){return e%400===0||e%4===0&&e%100!==0}function fM(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(hM[t]||(ag(e)?29:28))}function mM(e,t){return t>=1&&t<=(ag(e)?366:365)}function pM(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function gM(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function bM(e,t){return t>=0&&t<=59}function xM(e,t,n){return Pi(e,-t,n)}function wM(e,t,n){return Hp(e,-t,n)}/*!
 * chartjs-adapter-date-fns v3.0.0
 * https://www.chartjs.org
 * (c) 2022 chartjs-adapter-date-fns Contributors
 * Released under the MIT license
 */const _M={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};Mm._date.override({_id:"date-fns",formats:function(){return _M},parse:function(e,t){if(e===null||typeof e>"u")return null;const n=typeof e;return n==="number"||e instanceof Date?e=ee(e):n==="string"&&(typeof t=="string"?e=QC(e,t,new Date,this.options):e=nM(e,this.options)),Vp(e)?e.getTime():null},format:function(e,t){return Xr(e,t,this.options)},add:function(e,t,n){switch(n){case"millisecond":return dd(e,t);case"second":return YS(e,t);case"minute":return $S(e,t);case"hour":return VS(e,t);case"day":return Rr(e,t);case"week":return KS(e,t);case"month":return Pi(e,t);case"quarter":return qS(e,t);case"year":return Hp(e,t);default:return e}},diff:function(e,t,n){switch(n){case"millisecond":return cd(e,t);case"second":return nN(e,t);case"minute":return JS(e,t);case"hour":return ZS(e,t);case"day":return Up(e,t);case"week":return sN(e,t);case"month":return qp(e,t);case"quarter":return tN(e,t);case"year":return rN(e,t);default:return 0}},startOf:function(e,t,n){switch(t){case"second":return tM(e);case"minute":return eM(e);case"hour":return JC(e);case"day":return is(e);case"week":return Mt(e);case"isoWeek":return Mt(e,{weekStartsOn:+n});case"month":return Di(e);case"quarter":return oN(e);case"year":return Yr(e);default:return e}},endOf:function(e,t){switch(t){case"second":return uN(e);case"minute":return dN(e);case"hour":return aN(e);case"day":return wt(e);case"week":return lN(e);case"month":return $p(e);case"quarter":return cN(e);case"year":return iN(e);default:return e}}}),_i.register(id,ad,vi,Sn,ki,zr,dS,bS,aS,tS,Hr);const ct={primary:{light:"rgb(99, 102, 241)",dark:"rgb(129, 140, 248)"},secondary:{light:"rgb(34, 197, 94)",dark:"rgb(74, 222, 128)"},tertiary:{light:"rgb(249, 115, 22)",dark:"rgb(251, 146, 60)"},palette:[{light:"rgb(99, 102, 241)",dark:"rgb(209, 213, 219)"},{light:"rgb(34, 197, 94)",dark:"rgb(134, 239, 172)"},{light:"rgb(249, 115, 22)",dark:"rgb(253, 224, 71)"},{light:"rgb(236, 72, 153)",dark:"rgb(249, 168, 212)"},{light:"rgb(14, 165, 233)",dark:"rgb(125, 211, 252)"},{light:"rgb(168, 85, 247)",dark:"rgb(196, 181, 253)"},{light:"rgb(234, 179, 8)",dark:"rgb(253, 230, 138)"},{light:"rgb(239, 68, 68)",dark:"rgb(252, 165, 165)"}],grid:{light:"rgb(229, 231, 235)",dark:"rgb(55, 65, 81)"},text:{light:"rgb(107, 114, 128)",dark:"rgb(156, 163, 175)"},background:{light:"rgb(255, 255, 255)",dark:"rgb(31, 41, 55)"}};function _t(e,t=!1){return t?e.dark:e.light}function lg(e,t=!1){const n=ct.palette[e%ct.palette.length];return t?n.dark:n.light}function dg(e,t=!1){return lg(e,t)}function yM(e,t=!1){return Array.from({length:e},(n,s)=>lg(s,t))}function cg(e,t){if(e.startsWith("rgb("))return e.replace("rgb(","rgba(").replace(")",`, ${t})`);if(e.startsWith("rgba("))return e.replace(/,\s*[\d.]+\)$/,`, ${t})`);if(e.startsWith("#")){const n=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16);return`rgba(${n}, ${s}, ${r}, ${t})`}return e}function Jr(){return typeof window>"u"?!1:document.documentElement.classList.contains("dark")}function xd(e,t={}){const{decimals:n=0,locale:s="en-US"}=t;return new Intl.NumberFormat(s,{minimumFractionDigits:n,maximumFractionDigits:n}).format(e)}function vM(e,t={}){const{decimals:n=1,locale:s="en-US"}=t;return new Intl.NumberFormat(s,{style:"percent",minimumFractionDigits:n,maximumFractionDigits:n}).format(e/100)}function ug(e=!1){return{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{backgroundColor:e?"rgb(31, 41, 55)":"rgb(255, 255, 255)",titleColor:e?"rgb(229, 231, 235)":"rgb(17, 24, 39)",bodyColor:e?"rgb(156, 163, 175)":"rgb(107, 114, 128)",borderColor:e?"rgb(55, 65, 81)":"rgb(229, 231, 235)",borderWidth:1,padding:12,cornerRadius:8}},scales:{x:{grid:{color:_t(ct.grid,e),drawBorder:!1},ticks:{color:_t(ct.text,e)}},y:{grid:{color:_t(ct.grid,e),drawBorder:!1},ticks:{color:_t(ct.text,e)}}}}}function Li({title:e,description:t,loading:n=!1,empty:s=!1,emptyMessage:r="No data available",emptyIcon:o,height:i=300,className:a,toolbar:d,children:c}){return l.jsxs("div",{className:ae("rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",a),children:[(e||d)&&l.jsxs("div",{className:"mb-4 flex items-start justify-between",children:[l.jsxs("div",{children:[e&&l.jsx("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white",children:e}),t&&l.jsx("p",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:t})]}),d&&l.jsx("div",{className:"flex items-center gap-2",children:d})]}),l.jsx("div",{style:{height:i},className:"relative overflow-hidden",children:n?l.jsx(kM,{}):s?l.jsx(jM,{message:r,icon:o}):c})]})}function kM(){return l.jsx("div",{className:"flex h-full w-full items-end justify-around gap-2 p-4",children:[40,65,45,80,55,70,35,60].map((e,t)=>l.jsx("div",{className:"w-full animate-pulse rounded-t bg-neutral-200 dark:bg-neutral-700",style:{height:`${e}%`}},t))})}function jM({message:e,icon:t}){return l.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[t&&l.jsx("div",{className:"mb-2 text-neutral-400 dark:text-neutral-500",children:t}),l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:e})]})}function Bs({children:e}){return l.jsx("div",{className:"flex items-center gap-2",children:e})}function qe({icon:e,label:t,onClick:n,active:s=!1,disabled:r=!1,className:o,...i}){return l.jsxs("button",{type:"button",onClick:n,disabled:r,className:ae("inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-sm font-medium transition-colors",s?"bg-blue-600 text-white dark:bg-blue-500 dark:text-white":"bg-neutral-100 text-neutral-700 hover:bg-neutral-200 dark:bg-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-700",r&&"cursor-not-allowed opacity-50",o),title:t,...i,children:[e,t&&l.jsx("span",{className:"hidden sm:inline",children:t})]})}const hg="label";function fg(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function SM(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function mg(e,t){e.labels=t}function pg(e,t,n=hg){const s=[];e.datasets=t.map(r=>{const o=e.datasets.find(i=>i[n]===r[n]);return!o||!r.data||s.includes(o)?{...r}:(s.push(o),Object.assign(o,r),o)})}function NM(e,t=hg){const n={labels:[],datasets:[]};return mg(n,e.labels),pg(n,e.datasets,t),n}function CM(e,t){const{height:n=150,width:s=300,redraw:r=!1,datasetIdKey:o,type:i,data:a,options:d,plugins:c=[],fallbackContent:u,updateMode:h,...m}=e,f=p.useRef(null),g=p.useRef(null),b=()=>{f.current&&(g.current=new _i(f.current,{type:i,data:NM(a,o),options:d&&{...d},plugins:c}),fg(t,g.current))},x=()=>{fg(t,null),g.current&&(g.current.destroy(),g.current=null)};return p.useEffect(()=>{!r&&g.current&&d&&SM(g.current,d)},[r,d]),p.useEffect(()=>{!r&&g.current&&mg(g.current.config.data,a.labels)},[r,a.labels]),p.useEffect(()=>{!r&&g.current&&a.datasets&&pg(g.current.config.data,a.datasets,o)},[r,a.datasets]),p.useEffect(()=>{g.current&&(r?(x(),setTimeout(b)):g.current.update(h))},[r,d,a.labels,a.datasets,h]),p.useEffect(()=>{g.current&&(x(),setTimeout(b))},[i]),p.useEffect(()=>(b(),()=>x()),[]),l.jsx("canvas",{ref:f,role:"img",height:n,width:s,...m,children:u})}const MM=p.forwardRef(CM);function Ai(e,t){return _i.register(t),p.forwardRef((n,s)=>l.jsx(MM,{...n,ref:s,type:e}))}const EM=Ai("line",hi),PM=Ai("bar",ui),TM=Ai("doughnut",As),DM=Ai("pie",ql);function eo({labels:e=[],datasets:t=[],horizontal:n=!1,stacked:s=!1,showLegend:r=!1,showGrid:o=!0,formatValue:i=u=>xd(u),yAxisLabel:a,xAxisLabel:d,options:c={}}){const[u,h]=p.useState(Jr());p.useEffect(()=>{const g=new MutationObserver(()=>{h(Jr())});return g.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>g.disconnect()},[]);const m=p.useMemo(()=>t&&t.length>0?{labels:e,datasets:t.map((g,b)=>{const x=g.color||g.backgroundColor||dg(b,u);return{label:g.label||`Dataset ${b+1}`,data:g.data,backgroundColor:g.backgroundColor||(u?x:cg(x,.8)),borderColor:g.borderColor||x,borderWidth:g.borderWidth??(u?0:1),borderRadius:g.borderRadius??4,barThickness:g.barThickness,maxBarThickness:g.maxBarThickness||50}})}:{labels:e||[],datasets:[]},[e,t,u]),f=p.useMemo(()=>{const g=ug(u);return{...g,indexAxis:n?"y":"x",plugins:{...g.plugins,legend:{display:r,position:"top",labels:{color:_t(ct.text,u),usePointStyle:!0,padding:16}},tooltip:{...g.plugins.tooltip,callbacks:{label:b=>{const x=b.dataset.label||"",w=i(b.parsed[n?"x":"y"]);return x?`${x}: ${w}`:w}}}},scales:{x:{...g.scales.x,stacked:s,grid:{...g.scales.x.grid,display:o&&!n},title:{display:!!d,text:d,color:_t(ct.text,u)}},y:{...g.scales.y,stacked:s,grid:{...g.scales.y.grid,display:o&&n},title:{display:!!a,text:a,color:_t(ct.text,u)},ticks:{...g.scales.y.ticks,callback:n?void 0:b=>i(b)}}},...c}},[u,n,s,r,o,i,a,d,c]);return l.jsx(PM,{data:m,options:f})}function IM({labels:e=[],datasets:t=[],showLegend:n=!1,showGrid:s=!0,fill:r=!1,smooth:o=!0,showPoints:i=!0,timeUnit:a,formatValue:d=m=>xd(m),yAxisLabel:c,xAxisLabel:u,options:h={}}){const[m,f]=p.useState(Jr());p.useEffect(()=>{const x=new MutationObserver(()=>{f(Jr())});return x.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>x.disconnect()},[]);const g=p.useMemo(()=>({labels:e,datasets:t.map((x,w)=>{const _=x.color||x.borderColor||dg(w,m),y=x.fill??r;return{label:x.label||`Dataset ${w+1}`,data:x.data,borderColor:x.borderColor||_,backgroundColor:y?cg(_,.1):"transparent",fill:y,tension:o?.4:0,pointRadius:i?x.pointRadius??4:0,pointHoverRadius:i?x.pointHoverRadius??6:0,pointBackgroundColor:_,pointBorderColor:m?"rgb(31, 41, 55)":"rgb(255, 255, 255)",pointBorderWidth:2,borderWidth:x.borderWidth??2}})}),[e,t,m,r,o,i]),b=p.useMemo(()=>{const x=ug(m),w=a?{type:"time",time:{unit:a,displayFormats:{day:"MMM d",week:"MMM d",month:"MMM yyyy",year:"yyyy"}},...x.scales.x,grid:{...x.scales.x.grid,display:s},title:{display:!!u,text:u,color:_t(ct.text,m)}}:{...x.scales.x,grid:{...x.scales.x.grid,display:s},title:{display:!!u,text:u,color:_t(ct.text,m)}};return{...x,plugins:{...x.plugins,legend:{display:n,position:"top",labels:{color:_t(ct.text,m),usePointStyle:!0,padding:16}},tooltip:{...x.plugins.tooltip,callbacks:{label:_=>{const y=_.dataset.label||"",v=d(_.parsed.y);return y?`${y}: ${v}`:v}}}},scales:{x:w,y:{...x.scales.y,grid:{...x.scales.y.grid,display:s},title:{display:!!c,text:c,color:_t(ct.text,m)},ticks:{...x.scales.y.ticks,callback:_=>d(_)}}},interaction:{intersect:!1,mode:"index"},...h}},[m,n,s,a,d,c,u,h]);return l.jsx(EM,{data:g,options:b})}function wd({labels:e=[],data:t=[],colors:n,showLegend:s=!0,legendPosition:r="right",pie:o=!1,cutout:i=70,formatValue:a=h=>xd(h),showPercentage:d=!0,centerText:c,options:u={}}){const h=Jr(),m=o?DM:TM,f=p.useMemo(()=>{const b=n||yM(t.length,h);return{labels:e,datasets:[{data:t,backgroundColor:b,borderColor:h?"rgb(31, 41, 55)":"rgb(255, 255, 255)",borderWidth:2,hoverOffset:8}]}},[e,t,n,h]),g=p.useMemo(()=>{const b=t.reduce((x,w)=>x+w,0);return{responsive:!0,maintainAspectRatio:!1,cutout:o?0:`${i}%`,plugins:{legend:{display:s,position:r,labels:{color:_t(ct.text,h),usePointStyle:!0,padding:16,font:{size:12}}},tooltip:{backgroundColor:h?"rgb(31, 41, 55)":"rgb(255, 255, 255)",titleColor:h?"rgb(229, 231, 235)":"rgb(17, 24, 39)",bodyColor:h?"rgb(156, 163, 175)":"rgb(107, 114, 128)",borderColor:h?"rgb(55, 65, 81)":"rgb(229, 231, 235)",borderWidth:1,padding:12,cornerRadius:8,callbacks:{label:x=>{const w=x.parsed,_=x.label||"",y=a(w);if(d&&b>0){const v=vM(w/b*100);return`${_}: ${y} (${v})`}return`${_}: ${y}`}}}},...u}},[t,h,o,i,s,r,a,d,u]);return l.jsxs("div",{className:"relative h-full w-full overflow-hidden",children:[l.jsx(m,{data:f,options:g}),!o&&c&&l.jsxs("div",{className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center",children:[c.title&&l.jsx("span",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:c.title}),c.value&&l.jsx("span",{className:"text-2xl font-bold text-neutral-900 dark:text-white",children:c.value})]})]})}function Hs({title:e,value:t,icon:n,iconColor:s="bg-indigo-500",trend:r,trendLabel:o="vs last period",trendInverted:i=!1,description:a,loading:d=!1,className:c}){const u=i?r<0:r>0,h=i?r>0:r<0;return d?l.jsx("div",{className:ae("rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",c),children:l.jsxs("div",{className:"animate-pulse",children:[l.jsx("div",{className:"mb-2 h-4 w-24 rounded bg-neutral-200 dark:bg-neutral-700"}),l.jsx("div",{className:"h-8 w-32 rounded bg-neutral-200 dark:bg-neutral-700"})]})}):l.jsx("div",{className:ae("rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",c),children:l.jsxs("div",{className:"flex items-start justify-between",children:[l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-sm font-medium text-neutral-500 dark:text-neutral-400",children:e}),l.jsx("p",{className:"mt-1 text-2xl font-bold text-neutral-900 dark:text-white",children:t}),typeof r=="number"&&l.jsxs("div",{className:"mt-2 flex items-center gap-1",children:[l.jsxs("span",{className:ae("inline-flex items-center text-sm font-medium",u&&"text-green-600 dark:text-green-400",h&&"text-red-600 dark:text-red-400",!u&&!h&&"text-neutral-500 dark:text-neutral-400"),children:[r>0?l.jsx(OM,{className:"mr-0.5 h-4 w-4"}):r<0?l.jsx(LM,{className:"mr-0.5 h-4 w-4"}):null,Math.abs(r),"%"]}),l.jsx("span",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:o})]}),a&&l.jsx("p",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:a})]}),n&&l.jsx("div",{className:ae("flex h-10 w-10 shrink-0 items-center justify-center rounded-lg text-white",s),children:n})]})})}function _d({children:e,columns:t=4,className:n}){return l.jsx("div",{className:ae("grid gap-4",t===2&&"grid-cols-1 sm:grid-cols-2",t===3&&"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",t===4&&"grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",n),children:e})}function OM({className:e}){return l.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"})})}function LM({className:e}){return l.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 17h8m0 0V9m0 8l-8-8-4 4-6-6"})})}function gg({value:e={start:Qr(new Date,30),end:new Date},onChange:t,presets:n,showCustom:s=!0,className:r}){const[o,i]=p.useState(!1),[a,d]=p.useState(Xr(e.start,"yyyy-MM-dd")),[c,u]=p.useState(Xr(e.end,"yyyy-MM-dd")),h=p.useMemo(()=>[{label:"Today",getValue:()=>({start:is(new Date),end:wt(new Date)})},{label:"Last 7 days",getValue:()=>({start:is(Qr(new Date,6)),end:wt(new Date)})},{label:"Last 30 days",getValue:()=>({start:is(Qr(new Date,29)),end:wt(new Date)})},{label:"This week",getValue:()=>({start:Mt(new Date,{weekStartsOn:1}),end:wt(new Date)})},{label:"This month",getValue:()=>({start:Di(new Date),end:wt(new Date)})},{label:"Last month",getValue:()=>({start:Di(xM(new Date,1)),end:wt(Qr(Di(new Date),1))})},{label:"This year",getValue:()=>({start:Yr(new Date),end:wt(new Date)})},{label:"Last year",getValue:()=>({start:Yr(wM(new Date,1)),end:wt(Qr(Yr(new Date),1))})},{label:"All time",getValue:()=>({start:new Date(2e3,0,1),end:wt(new Date)})}],[]),m=n||h,f=x=>{i(!1);const w=x.getValue();t==null||t(w)},g=()=>{const x=new Date(a),w=new Date(c);x<=w&&(t==null||t({start:is(x),end:wt(w)}))},b=p.useMemo(()=>!e.start||!e.end?"Select range":`${Xr(e.start,"MMM d, yyyy")} - ${Xr(e.end,"MMM d, yyyy")}`,[e]);return l.jsxs("div",{className:ae("flex flex-wrap items-center gap-2",r),children:[l.jsx("div",{className:"flex flex-wrap gap-1",children:m.map((x,w)=>l.jsx("button",{type:"button",onClick:()=>f(x),className:ae("rounded-md px-3 py-1.5 text-sm font-medium transition-colors","bg-neutral-100 text-neutral-700 hover:bg-neutral-200","dark:bg-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-700"),children:x.label},w))}),s&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"or"}),l.jsx("input",{type:"date",value:a,onChange:x=>{d(x.target.value),i(!0)},className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-sm text-neutral-900 dark:border-neutral-600 dark:bg-neutral-800 dark:text-white"}),l.jsx("span",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"to"}),l.jsx("input",{type:"date",value:c,onChange:x=>{u(x.target.value),i(!0)},className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-sm text-neutral-900 dark:border-neutral-600 dark:bg-neutral-800 dark:text-white"}),o&&l.jsx("button",{type:"button",onClick:g,className:"rounded-md bg-indigo-600 px-3 py-1 text-sm font-medium text-white hover:bg-indigo-700",children:"Apply"})]}),l.jsx("div",{className:"ml-auto text-sm text-neutral-500 dark:text-neutral-400",children:b})]})}function bg(e){return l.jsx(Ty,{...e})}function xg({as:e=ol,...t}){return l.jsx(oh,{as:e,...t})}function wg({anchor:e="bottom",className:t,...n}){return l.jsx(ih,{...n,transition:!0,anchor:e,className:ae(t,"[--anchor-gap:--spacing(2)] [--anchor-padding:--spacing(1)] data-[anchor~=end]:[--anchor-offset:6px] data-[anchor~=start]:[--anchor-offset:-6px] sm:data-[anchor~=end]:[--anchor-offset:4px] sm:data-[anchor~=start]:[--anchor-offset:-4px]","isolate w-max rounded-xl p-1","outline outline-transparent focus:outline-hidden","overflow-y-auto","bg-white/75 backdrop-blur-xl dark:bg-neutral-800/75","shadow-lg ring-1 ring-neutral-950/10 dark:ring-white/10 dark:ring-inset","supports-[grid-template-columns:subgrid]:grid supports-[grid-template-columns:subgrid]:grid-cols-[auto_1fr_1.5rem_0.5rem_auto]","transition data-leave:duration-100 data-leave:ease-in data-closed:data-leave:opacity-0")})}function Vs({className:e,...t}){let n=ae(e,"group cursor-default rounded-lg px-3.5 py-2.5 focus:outline-hidden sm:px-3 sm:py-1.5","text-left text-base/6 text-neutral-950 sm:text-sm/6 dark:text-white forced-colors:text-[CanvasText]","data-focus:bg-blue-500 data-focus:text-white","data-disabled:opacity-50","forced-color-adjust-none forced-colors:data-focus:bg-[Highlight] forced-colors:data-focus:text-[HighlightText] forced-colors:data-focus:*:data-[slot=icon]:text-[HighlightText]","col-span-full grid grid-cols-[auto_1fr_1.5rem_0.5rem_auto] items-center supports-[grid-template-columns:subgrid]:grid-cols-subgrid","*:data-[slot=icon]:col-start-1 *:data-[slot=icon]:row-start-1 *:data-[slot=icon]:mr-2.5 *:data-[slot=icon]:-ml-0.5 *:data-[slot=icon]:size-5 sm:*:data-[slot=icon]:mr-2 sm:*:data-[slot=icon]:size-4","*:data-[slot=icon]:text-neutral-500 data-focus:*:data-[slot=icon]:text-white dark:*:data-[slot=icon]:text-neutral-400 dark:data-focus:*:data-[slot=icon]:text-white","*:data-[slot=avatar]:mr-2.5 *:data-[slot=avatar]:-ml-1 *:data-[slot=avatar]:size-6 sm:*:data-[slot=avatar]:mr-2 sm:*:data-[slot=avatar]:size-5");return"href"in t?l.jsx(nl,{as:ah,...t,className:n}):l.jsx(nl,{as:"button",type:"button",...t,className:n})}const Fi="free-downloads-woocommerce",AM=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.is_pro)||!1},FM=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.rest_url)||""},zM=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.rest_path)||""},zi=()=>{var e;return((e=window.somdn_settings)==null?void 0:e.nonce)||""},WM=()=>{var e;return!!((e=window.somdn_settings)!=null&&e.can_delete_logs)};function Wi(){const e=(zM()||"").trim();if(e){const s=e.startsWith("/")?e:`/${e}`;return`${window.location.origin}${s}`.replace(/\/+$/,"")+"/"}let t=(FM()||"").trim();if(!t)return`${window.location.origin}/wp-json/`;if(t.startsWith("http//")&&(t="http:"+t.slice(5)),t.startsWith("https//")&&(t="https:"+t.slice(6)),/^https?:\/\//i.test(t))try{const s=new URL(t);return(s.origin+s.pathname).replace(/\/+$/,"")+"/"}catch{return t.replace(/\/?$/,"/")}const n=t.startsWith("/")?t:`/${t}`;return`${window.location.origin}${n}`.replace(/\/?$/,"/")}const Et=["#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#f97316","#eab308","#22c55e","#14b8a6","#06b6d4","#3b82f6"];function Us(e){return{indigo:"bg-indigo-500",emerald:"bg-emerald-500",amber:"bg-amber-500",blue:"bg-blue-500"}[e]||"bg-indigo-500"}function yd(e,t){return t==null||t===0?e>0?100:0:Math.round((Number(e)-Number(t))/Number(t)*100)}async function Pt(e,t={}){const n=Wi(),s=zi(),r=new URL(`${n}somdn/v1/${e}`);Object.entries(t).forEach(([i,a])=>{a!=null&&r.searchParams.append(i,a)});const o=await fetch(r.toString(),{credentials:"same-origin",headers:{"X-WP-Nonce":s}});if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.json()}function BM({dateRange:e,onDateRangeChange:t}){const[n,s]=p.useState(null),[r,o]=p.useState(!0),[i,a]=p.useState(null),d=p.useCallback(async()=>{var b,x;o(!0),a(null);try{const w=await Pt("stats/overview",{start_date:(b=e==null?void 0:e.start)==null?void 0:b.toISOString().split("T")[0],end_date:(x=e==null?void 0:e.end)==null?void 0:x.toISOString().split("T")[0]});s(w)}catch(w){a(w.message),s({total_downloads:0,unique_products:0,unique_users:0,downloads_today:0,downloads_yesterday:0,downloads_this_week:0,downloads_last_week:0,downloads_this_month:0,downloads_last_month:0})}finally{o(!1)}},[e]);p.useEffect(()=>{d()},[d]);const c=p.useMemo(()=>{if(!(e!=null&&e.start)||!(e!=null&&e.end))return{days:0,includesToday:!1,comparisonLabel:""};const b=new Date(e.start),x=new Date(e.end),w=new Date;w.setHours(0,0,0,0);const _=new Date(x);_.setHours(0,0,0,0);const y=Math.ceil((x-b)/(1e3*60*60*24))+1,v=_.getTime()===w.getTime();let j="";return y===1?j="vs yesterday":y===7?j="vs previous 7 days":y===30?j="vs previous 30 days":y===90?j="vs previous 90 days":y===365?j="vs previous year":j=`vs previous ${y} days`,{days:y,includesToday:v,comparisonLabel:j}},[e]),u=p.useMemo(()=>{if(!n)return null;const b=c.days;return b<=7?n.downloads_last_week:(b<=30,n.downloads_last_month)},[n,c.days]),h=p.useMemo(()=>!(n!=null&&n.total_downloads)||c.days===0?0:Math.round(n.total_downloads/c.days*10)/10,[n==null?void 0:n.total_downloads,c.days]),m=p.useMemo(()=>!u||c.days===0?null:Math.round(u/c.days*10)/10,[u,c.days]),f=p.useMemo(()=>{const{days:b,includesToday:x,comparisonLabel:w}=c;if(x&&b<=7){const _=(n==null?void 0:n.downloads_today)||0,y=n==null?void 0:n.downloads_yesterday;return l.jsx(Hs,{title:"Today",value:_,trend:yd(_,y),trendLabel:"vs yesterday",icon:l.jsx(io,{className:"h-5 w-5"}),iconColor:Us("blue")},"today")}return l.jsx(Hs,{title:"Average per Day",value:h,trend:yd(h,m),trendLabel:w,icon:l.jsx(io,{className:"h-5 w-5"}),iconColor:Us("blue")},"average")},[c.days,c.includesToday,c.comparisonLabel,n==null?void 0:n.downloads_today,n==null?void 0:n.downloads_yesterday,h,m]);if(r)return l.jsx(_d,{columns:4,children:[1,2,3,4].map(b=>l.jsxs("div",{className:"animate-pulse rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:[l.jsx("div",{className:"h-4 w-24 bg-neutral-200 dark:bg-neutral-700 rounded mb-2"}),l.jsx("div",{className:"h-8 w-16 bg-neutral-200 dark:bg-neutral-700 rounded"})]},b))});const g=(n==null?void 0:n.total_downloads)||0;return l.jsxs(_d,{columns:4,children:[l.jsx(Hs,{title:"Total Downloads",value:g,trend:yd(g,u),trendLabel:c.comparisonLabel,icon:l.jsx(Ui,{className:"h-5 w-5"}),iconColor:Us("indigo")},"total"),l.jsx(Hs,{title:"Unique Products",value:(n==null?void 0:n.unique_products)||0,icon:l.jsx($i,{className:"h-5 w-5"}),iconColor:Us("emerald")},"products"),l.jsx(Hs,{title:"Unique Users",value:(n==null?void 0:n.unique_users)||0,icon:l.jsx(zd,{className:"h-5 w-5"}),iconColor:Us("amber")},"users"),f]})}function HM({dateRange:e}){var h,m;const[t,n]=p.useState(null),[s,r]=p.useState(!0),[o,i]=p.useState("bar"),a=p.useCallback(async()=>{var f,g;r(!0);try{const b=await Pt("stats/downloads-by-date",{start_date:(f=e==null?void 0:e.start)==null?void 0:f.toISOString().split("T")[0],end_date:(g=e==null?void 0:e.end)==null?void 0:g.toISOString().split("T")[0]});n(b)}catch{n({labels:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],values:[12,19,15,25,22,8,5]})}finally{r(!1)}},[e]);p.useEffect(()=>{a()},[a]);const d=p.useMemo(()=>t?{labels:t.labels||[],datasets:[{label:"Downloads",data:t.values||[],backgroundColor:o==="bar"?Et[0]:void 0,borderColor:o==="line"?Et[0]:void 0,fill:o==="line"}]}:null,[t,o]),c=o==="line"?IM:eo,u=!((h=d==null?void 0:d.labels)!=null&&h.length)||!((m=d==null?void 0:d.datasets)!=null&&m.some(f=>{var g;return(g=f.data)==null?void 0:g.length}));return l.jsx(Li,{title:"Downloads Over Time",description:"Number of downloads per day",loading:s,empty:u,emptyMessage:"No download data for this period",height:350,toolbar:l.jsxs(Bs,{children:[l.jsx(qe,{label:"Bar",icon:l.jsx(an,{className:"h-4 w-4"}),active:o==="bar",onClick:()=>i("bar")}),l.jsx(qe,{label:"Line",icon:l.jsx(io,{className:"h-4 w-4"}),active:o==="line",onClick:()=>i("line")})]}),children:l.jsx(c,{labels:(d==null?void 0:d.labels)||[],datasets:(d==null?void 0:d.datasets)||[],fill:o==="line",showLegend:!1})})}function VM({dateRange:e}){var u,h;const[t,n]=p.useState(null),[s,r]=p.useState(!0),[o,i]=p.useState("horizontal"),a=p.useCallback(async()=>{var m,f;r(!0);try{const g=await Pt("stats/top-products",{start_date:(m=e==null?void 0:e.start)==null?void 0:m.toISOString().split("T")[0],end_date:(f=e==null?void 0:e.end)==null?void 0:f.toISOString().split("T")[0],limit:10});n(g)}catch{n({labels:["Product A","Product B","Product C","Product D","Product E"],values:[156,98,76,54,32]})}finally{r(!1)}},[e]);p.useEffect(()=>{a()},[a]);const d=p.useMemo(()=>t?o==="donut"?{labels:t.labels||[],data:t.values||[]}:{labels:t.labels||[],datasets:[{label:"Downloads",data:t.values||[],backgroundColor:Et.slice(0,(t.labels||[]).length)}]}:null,[t,o]);if(!d)return l.jsx("div",{className:"rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:l.jsx("div",{className:"flex h-[350px] items-center justify-center",children:s?l.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-neutral-300 border-t-indigo-600"}):l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No data available"})})});if(o==="donut"){const m=d.labels||[],f=d.data||[],g=f.reduce((b,x)=>b+x,0);return m.length===0||f.length===0?l.jsx(Li,{title:"Top Downloaded Products",description:"Most popular free downloads",loading:s,empty:!0,emptyMessage:"No data available",height:350,toolbar:l.jsxs(Bs,{children:[l.jsx(qe,{label:"Donut",icon:l.jsx(qs,{className:"h-4 w-4"}),active:!0,onClick:()=>i("donut")}),l.jsx(qe,{label:"Bar",icon:l.jsx(an,{className:"h-4 w-4"}),onClick:()=>i("bar")}),l.jsx(qe,{label:"Horizontal",icon:l.jsx($s,{className:"h-4 w-4"}),onClick:()=>i("horizontal")})]}),children:null}):l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:[l.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white",children:"Top Downloaded Products"}),l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"Most popular free downloads"})]}),l.jsxs(Bs,{children:[l.jsx(qe,{label:"Donut",icon:l.jsx(qs,{className:"h-4 w-4"}),active:o==="donut",onClick:()=>i("donut")}),l.jsx(qe,{label:"Bar",icon:l.jsx(an,{className:"h-4 w-4"}),active:o==="bar",onClick:()=>i("bar")}),l.jsx(qe,{label:"Horizontal",icon:l.jsx($s,{className:"h-4 w-4"}),active:o==="horizontal",onClick:()=>i("horizontal")})]})]}),l.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-start lg:gap-6",children:[l.jsx("div",{className:"w-full lg:w-1/2 overflow-hidden",style:{height:300},children:l.jsx(wd,{labels:m,data:f,colors:Et.slice(0,m.length),showLegend:!1,cutout:60,centerText:{title:"Total",value:g.toLocaleString()}})}),l.jsxs("div",{className:"mt-4 lg:mt-0 lg:w-1/2",children:[l.jsx("div",{className:"space-y-2",children:m.map((b,x)=>{const w=f[x]||0,_=g>0?(w/g*100).toFixed(1):0,y=Et[x%Et.length];return l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[l.jsx("span",{className:"h-3 w-3 flex-shrink-0 rounded-full",style:{backgroundColor:y}}),l.jsx("span",{className:"max-w-28 truncate text-neutral-700 dark:text-neutral-300",title:b,children:b}),l.jsxs("span",{className:"text-neutral-500 dark:text-neutral-400",children:["(",_,"%)"]}),l.jsx("span",{className:"ml-auto font-medium text-neutral-900 dark:text-white",children:w.toLocaleString()})]},x)})}),l.jsx("div",{className:"mt-3 border-t border-neutral-200 pt-2 dark:border-neutral-700",children:l.jsxs("div",{className:"flex items-center justify-between text-sm",children:[l.jsx("span",{className:"font-medium text-neutral-700 dark:text-neutral-300",children:"Total Downloads"}),l.jsx("span",{className:"font-semibold text-neutral-900 dark:text-white",children:g.toLocaleString()})]})})]})]})]})}const c=!((u=d==null?void 0:d.labels)!=null&&u.length)||!((h=d==null?void 0:d.datasets)!=null&&h.length);return l.jsx(Li,{title:"Top Downloaded Products",description:"Most popular free downloads",loading:s,empty:c,emptyMessage:"No data available",height:350,toolbar:l.jsxs(Bs,{children:[l.jsx(qe,{label:"Donut",icon:l.jsx(qs,{className:"h-4 w-4"}),active:o==="donut",onClick:()=>i("donut")}),l.jsx(qe,{label:"Bar",icon:l.jsx(an,{className:"h-4 w-4"}),active:o==="bar",onClick:()=>i("bar")}),l.jsx(qe,{label:"Horizontal",icon:l.jsx($s,{className:"h-4 w-4"}),active:o==="horizontal",onClick:()=>i("horizontal")})]}),children:l.jsx(eo,{labels:(d==null?void 0:d.labels)||[],datasets:(d==null?void 0:d.datasets)||[],horizontal:o==="horizontal",showLegend:!1})})}function UM({dateRange:e}){const[t,n]=p.useState(null),[s,r]=p.useState(!0),[o,i]=p.useState("donut"),a=p.useCallback(async()=>{var g,b;r(!0);try{const x=await Pt("stats/by-file-type",{start_date:(g=e==null?void 0:e.start)==null?void 0:g.toISOString().split("T")[0],end_date:(b=e==null?void 0:e.end)==null?void 0:b.toISOString().split("T")[0]});n(x)}catch{n({labels:["PDF","ZIP","MP3","DOCX","Other"],values:[45,25,15,10,5]})}finally{r(!1)}},[e]);if(p.useEffect(()=>{a()},[a]),!t||!t.labels||!t.values)return l.jsx("div",{className:"rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:l.jsx("div",{className:"flex h-[300px] items-center justify-center",children:s?l.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-neutral-300 border-t-indigo-600"}):l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No data available"})})});const d=t.labels||[],c=t.values||[],u=c.reduce((g,b)=>g+(b||0),0),h=Et.slice(0,d.length);if(d.length===0||c.length===0)return l.jsx("div",{className:"rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:l.jsx("div",{className:"flex h-[300px] items-center justify-center",children:l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No data available"})})});const m=d.map((g,b)=>({label:g||"",percentage:u>0?((c[b]||0)/u*100).toFixed(1):"0",value:c[b]||0,color:h[b%Et.length]}));if(o==="donut")return l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-white p-4 dark:border-neutral-700 dark:bg-neutral-900",children:[l.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[l.jsx("div",{children:l.jsx("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white",children:"Downloads by File Type"})}),l.jsxs(Bs,{children:[l.jsx(qe,{icon:l.jsx(qs,{className:"h-4 w-4"}),active:o==="donut",onClick:()=>i("donut")}),l.jsx(qe,{icon:l.jsx(an,{className:"h-4 w-4"}),active:o==="bar",onClick:()=>i("bar")}),l.jsx(qe,{icon:l.jsx($s,{className:"h-4 w-4"}),active:o==="horizontal",onClick:()=>i("horizontal")})]})]}),l.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-start lg:gap-6",children:[l.jsx("div",{className:"w-full lg:w-1/2 overflow-hidden",style:{height:300},children:l.jsx(wd,{labels:d,data:c,colors:h,showLegend:!1,cutout:60,centerText:{title:"Total",value:u.toLocaleString()}})}),l.jsxs("div",{className:"mt-4 lg:mt-0 lg:w-1/2",children:[l.jsx("div",{className:"space-y-2",children:m.map((g,b)=>l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[l.jsx("span",{className:"h-3 w-3 flex-shrink-0 rounded-full",style:{backgroundColor:g.color}}),l.jsx("span",{className:"max-w-28 truncate text-neutral-700 dark:text-neutral-300",title:g.label,children:g.label}),l.jsxs("span",{className:"text-neutral-500 dark:text-neutral-400",children:["(",g.percentage,"%)"]}),l.jsx("span",{className:"ml-auto font-medium text-neutral-900 dark:text-white",children:g.value.toLocaleString()})]},b))}),l.jsx("div",{className:"mt-3 border-t border-neutral-200 pt-2 dark:border-neutral-700",children:l.jsxs("div",{className:"flex items-center justify-between text-sm",children:[l.jsx("span",{className:"font-medium text-neutral-700 dark:text-neutral-300",children:"Total Downloads"}),l.jsx("span",{className:"font-semibold text-neutral-900 dark:text-white",children:u.toLocaleString()})]})})]})]})]});const f={labels:d,datasets:[{label:"Downloads",data:c,backgroundColor:h}]};return l.jsx(Li,{title:"Downloads by File Type",loading:s,empty:!1,height:300,toolbar:l.jsxs(Bs,{children:[l.jsx(qe,{label:"Donut",icon:l.jsx(qs,{className:"h-4 w-4"}),active:o==="donut",onClick:()=>i("donut")}),l.jsx(qe,{label:"Bar",icon:l.jsx(an,{className:"h-4 w-4"}),active:o==="bar",onClick:()=>i("bar")}),l.jsx(qe,{label:"Horizontal",icon:l.jsx($s,{className:"h-4 w-4"}),active:o==="horizontal",onClick:()=>i("horizontal")})]}),children:l.jsx(eo,{labels:f.labels,datasets:f.datasets,horizontal:o==="horizontal",showLegend:!1})})}async function _g(e){const t=await fetch(`${Wi()}somdn/v1/stats/download-log/${e}`,{method:"DELETE",credentials:"same-origin",headers:{"X-WP-Nonce":zi()}}),n=await t.json().catch(()=>({}));if(!t.ok){const s=(n==null?void 0:n.message)||(n==null?void 0:n.code)||`HTTP ${t.status}`;throw new Error(typeof s=="string"?s:"Could not delete this entry.")}}const Bi=[{id:"ID",label:"Download ID"},{id:"Date",label:"Date"},{id:"Product ID",label:"Product ID"},{id:"Product Name",label:"Product Name"},{id:"Files",label:"Files"},{id:"Variation ID",label:"Variation ID"},{id:"User ID",label:"User ID"},{id:"Username",label:"Username"},{id:"Email Address",label:"Email Address"},{id:"IP Address",label:"IP Address"},{id:"Country based on IP",label:"Country"},{id:"Subscribed",label:"Subscribed"},{id:"First Name",label:"First Name"},{id:"Last Name",label:"Last Name"},{id:"Telephone",label:"Telephone"},{id:"Company",label:"Company"},{id:"Website",label:"Website"}];async function yg({format:e,dateRange:t,exportType:n="all-downloads",exportProducts:s=[],exportColumns:r,logIds:o=null}){var x,w;const i=window.somdn_settings||{},a=i.export_url,d=i.export_nonce;if(!a||!d)throw new Error("Export is not available in this context. Please refresh the page and try again.");if(!(r!=null&&r.length))throw new Error("Please select at least one column to export.");const c=new FormData;c.append("format",e),c.append("start_date",((x=t==null?void 0:t.start)==null?void 0:x.toISOString().split("T")[0])||""),c.append("end_date",((w=t==null?void 0:t.end)==null?void 0:w.toISOString().split("T")[0])||""),c.append("export_type",n),c.append("export_products",JSON.stringify(s)),c.append("export_columns",JSON.stringify(r)),o!=null&&o.length&&c.append("log_ids",JSON.stringify(o)),c.append("_wpnonce",d);const u=await fetch(a,{method:"POST",credentials:"same-origin",body:c});if(!u.ok){const _=await u.text();let y=`Export failed (${u.status})`;try{const v=JSON.parse(_);v.message&&(y=v.message)}catch{const v=_.match(/class="wp-die-message"[^>]*>([^<]+)</);v&&v[1]?y=v[1].trim():_&&_.length<300&&!/<\s*!?DOCTYPE/i.test(_)&&(y=_)}throw new Error(y)}const h=await u.blob(),m=u.headers.get("Content-Disposition");let f=`free-downloads-export.${e}`;if(m){const _=m.match(/filename="?([^";]+)"?/);_&&_[1]&&(f=_[1].trim())}const g=URL.createObjectURL(h),b=document.createElement("a");b.href=g,b.download=f,b.click(),URL.revokeObjectURL(g)}function vg({dateRange:e,fromDownloadLog:t=!1,showDateInHeader:n=!1,onDateRangeChange:s}){const[r,o]=p.useState([]),[i,a]=p.useState(!0),[d,c]=p.useState(1),[u,h]=p.useState(1),[m,f]=p.useState(0),[g,b]=p.useState(""),[x,w]=p.useState(""),[_,y]=p.useState(""),[v,j]=p.useState(""),[k,M]=p.useState(10),[N,T]=p.useState([]),[P,E]=p.useState(!1),[D,z]=p.useState(null),[R,O]=p.useState(!1),[A,B]=p.useState(()=>new Set),C=p.useRef(null),[F,U]=p.useState(null),H=t&&WM(),L=R||F,$=H?6:4,J=p.useMemo(()=>r.map(Y=>Y.id),[r]),ne=p.useMemo(()=>J.filter(Y=>A.has(Y)).length,[J,A]),Q=r.length>0&&ne===r.length,V=ne>0&&!Q;p.useEffect(()=>{const Y=C.current;Y&&(Y.indeterminate=V)},[V]),p.useEffect(()=>{B(new Set)},[d,k,x,_,v,e==null?void 0:e.start,e==null?void 0:e.end,t]);const K=Y=>{B(Ue=>{const ye=new Set(Ue);return ye.has(Y)?ye.delete(Y):ye.add(Y),ye})},te=()=>{B(Y=>{const Ue=new Set(Y);return Q?J.forEach(ye=>Ue.delete(ye)):J.forEach(ye=>Ue.add(ye)),Ue})},Ne=p.useMemo(()=>r.filter(Y=>A.has(Y.id)),[r,A]),Me=A.size,to=p.useCallback(async()=>{var Y,Ue;a(!0);try{const ye={start_date:(Y=e==null?void 0:e.start)==null?void 0:Y.toISOString().split("T")[0],end_date:(Ue=e==null?void 0:e.end)==null?void 0:Ue.toISOString().split("T")[0],page:d,per_page:k};t&&(ye.from_download_log=1),x.trim()&&(ye.search=x.trim()),_&&(ye.product_id=parseInt(_,10)),v&&(ye.user_type=v);const ls=await Pt("stats/recent-downloads",ye);o(ls.items||[]),h(ls.total_pages||1),f(ls.total??0)}catch{o([]),f(0)}finally{a(!1)}},[e,d,k,x,_,v,t]);p.useEffect(()=>{to()},[to]),p.useEffect(()=>{E(!0),Pt("stats/products-list").then(Y=>T(Y||[])).catch(()=>T([])).finally(()=>E(!1))},[]);const Vg=()=>{w(g.trim()),c(1)},lE=()=>{b(""),w(""),c(1)},dE=Y=>{y(Y.target.value),c(1)},cE=Y=>{j(Y.target.value),c(1)},uE=Y=>{M(Number(Y.target.value)),c(1)},hE=async()=>{if(D){O(!0);try{if(D.mode==="single")await _g(D.item.id);else for(const Y of D.items)await _g(Y.id);z(null),B(new Set),await to()}catch(Y){console.error(Y),alert(Y.message||"Could not delete.")}finally{O(!1)}}},fE=()=>{Ne.length!==0&&z({mode:"bulk",items:Ne})},mE=p.useCallback(async()=>{var Ue;let Y=Bi.map(ye=>ye.id);try{const ye=await Pt("stats/export-settings");((Ue=ye==null?void 0:ye.export_columns)==null?void 0:Ue.length)>0&&(Y=ye.export_columns)}catch{}return Y},[]),Vi=async(Y,Ue)=>{if(!(Ue!=null&&Ue.length))return;const ye=await mE();if(!(ye!=null&&ye.length)){alert("Please select at least one column in Reports → Export data first.");return}U(Y);try{await yg({format:Y,dateRange:e,exportType:"all-downloads",exportProducts:[],exportColumns:ye,logIds:Ue.map(ls=>ls.id)})}catch(ls){alert(ls.message||"Export failed. Please try again.")}finally{U(null)}},Ug=x.trim()||_||v;return l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",children:[l.jsxs("div",{className:"border-b border-neutral-200 px-4 py-3 dark:border-neutral-700",children:[l.jsx("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white",children:"Recent Downloads"}),n&&(e==null?void 0:e.start)&&(e==null?void 0:e.end)&&l.jsxs("p",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:[e.start.toLocaleDateString()," – ",e.end.toLocaleDateString()]})]}),l.jsxs("div",{className:"border-b border-neutral-200 px-4 py-3 dark:border-neutral-700 space-y-3",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s&&(e==null?void 0:e.start)&&(e==null?void 0:e.end)&&l.jsx(gg,{startDate:e.start,endDate:e.end,onChange:s}),l.jsxs("div",{className:"flex flex-1 min-w-[200px] max-w-sm items-center gap-2",children:[l.jsx("input",{type:"text",value:g,onChange:Y=>b(Y.target.value),onKeyDown:Y=>Y.key==="Enter"&&Vg(),placeholder:"Search by customer email...",className:"block w-full rounded-md border border-neutral-300 bg-white px-3 py-1.5 text-sm text-neutral-900 shadow-sm placeholder:text-neutral-400 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 dark:border-neutral-600 dark:bg-neutral-800 dark:text-white dark:placeholder:text-neutral-500"}),l.jsxs("button",{type:"button",onClick:Vg,className:"inline-flex items-center gap-1.5 rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-medium text-white shadow-sm hover:bg-indigo-700",children:[l.jsx(wb,{className:"h-4 w-4"}),"Search"]}),(g||x)&&l.jsx("button",{type:"button",onClick:lE,className:"inline-flex items-center rounded-md px-2 py-1.5 text-sm text-neutral-600 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:bg-neutral-800",title:"Clear search",children:l.jsx(Yi,{className:"h-4 w-4"})})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("label",{htmlFor:"somdn-filter-product",className:"text-sm text-neutral-600 dark:text-neutral-400 whitespace-nowrap",children:"Product:"}),l.jsxs("select",{id:"somdn-filter-product",value:_,onChange:dE,disabled:P,className:"rounded-md border border-neutral-300 bg-white px-2 py-1.5 text-sm text-neutral-900 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 dark:border-neutral-600 dark:bg-neutral-800 dark:text-white",children:[l.jsx("option",{value:"",children:"All products"}),N.map(Y=>l.jsx("option",{value:Y.id,children:Y.name},Y.id))]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("label",{htmlFor:"somdn-filter-user-type",className:"text-sm text-neutral-600 dark:text-neutral-400 whitespace-nowrap",children:"User:"}),l.jsxs("select",{id:"somdn-filter-user-type",value:v,onChange:cE,className:"rounded-md border border-neutral-300 bg-white px-2 py-1.5 text-sm text-neutral-900 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 dark:border-neutral-600 dark:bg-neutral-800 dark:text-white",children:[l.jsx("option",{value:"",children:"All"}),l.jsx("option",{value:"guest",children:"Guest only"}),l.jsx("option",{value:"registered",children:"Registered only"})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("label",{htmlFor:"somdn-per-page",className:"text-sm text-neutral-600 dark:text-neutral-400 whitespace-nowrap",children:"Rows:"}),l.jsxs("select",{id:"somdn-per-page",value:k,onChange:uE,className:"rounded-md border border-neutral-300 bg-white px-2 py-1.5 text-sm text-neutral-900 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 dark:border-neutral-600 dark:bg-neutral-800 dark:text-white",children:[l.jsx("option",{value:10,children:"10"}),l.jsx("option",{value:25,children:"25"}),l.jsx("option",{value:50,children:"50"})]})]})]}),Ug&&l.jsxs("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:["Showing ",m.toLocaleString()," result",m!==1?"s":""," for the selected filters."]})]}),H&&Me>0&&l.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-neutral-200 bg-indigo-50/80 px-4 py-2.5 dark:border-neutral-700 dark:bg-indigo-950/40",children:[l.jsxs("span",{className:"text-sm font-medium text-neutral-800 dark:text-neutral-200",children:[Me," selected"]}),l.jsxs(bg,{children:[l.jsxs(xg,{plain:!0,disabled:L,className:"inline-flex items-center gap-1.5 rounded-md !border !border-neutral-300 bg-white px-3 py-1.5 text-sm font-medium text-neutral-900 shadow-sm hover:bg-neutral-50 dark:!border-neutral-600 dark:bg-neutral-800 dark:text-neutral-100 dark:hover:bg-neutral-700",children:["Actions",l.jsx(Od,{className:"h-4 w-4 opacity-70","aria-hidden":!0})]}),l.jsxs(wg,{anchor:"bottom start",children:[l.jsx(Vs,{className:"cursor-pointer text-neutral-800 transition-colors hover:bg-neutral-100 hover:text-neutral-900 !data-focus:bg-neutral-100 !data-focus:text-neutral-900 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:hover:text-white dark:!data-focus:bg-neutral-800 dark:!data-focus:text-white",onClick:()=>{L||Vi("csv",Ne)},children:l.jsxs("span",{className:"inline-flex items-center gap-2",children:[l.jsx(ro,{className:"h-4 w-4 shrink-0 opacity-80","aria-hidden":!0}),"Download selected (CSV)"]})}),l.jsx(Vs,{className:"cursor-pointer text-neutral-800 transition-colors hover:bg-neutral-100 hover:text-neutral-900 !data-focus:bg-neutral-100 !data-focus:text-neutral-900 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:hover:text-white dark:!data-focus:bg-neutral-800 dark:!data-focus:text-white",onClick:()=>{L||Vi("xlsx",Ne)},children:l.jsxs("span",{className:"inline-flex items-center gap-2",children:[l.jsx(oo,{className:"h-4 w-4 shrink-0 opacity-80","aria-hidden":!0}),"Download selected (Excel)"]})}),l.jsx(Vs,{className:"cursor-pointer text-red-600 transition-colors hover:bg-red-50 hover:text-red-700 !data-focus:bg-red-100 !data-focus:text-red-800 dark:text-red-400 dark:hover:bg-red-950/50 dark:hover:text-red-300 dark:!data-focus:bg-red-950/60 dark:!data-focus:text-red-200",onClick:()=>{L||fE()},children:"Delete selected"})]})]})]}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"min-w-full divide-y divide-neutral-200 dark:divide-neutral-700",children:[l.jsx("thead",{className:"bg-neutral-50 dark:bg-neutral-800",children:l.jsxs("tr",{children:[H&&l.jsxs("th",{scope:"col",className:"w-12 px-3 py-3",children:[l.jsx("span",{className:"sr-only",children:"Select row"}),l.jsx("input",{ref:C,type:"checkbox",checked:Q&&r.length>0,onChange:te,disabled:i||r.length===0||L,className:"h-4 w-4 rounded border-neutral-300 text-indigo-600 focus:ring-indigo-500 dark:border-neutral-600","aria-label":"Select all on this page"})]}),l.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-neutral-500 dark:text-neutral-400",children:"Product"}),l.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-neutral-500 dark:text-neutral-400",children:"File"}),l.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-neutral-500 dark:text-neutral-400",children:"User"}),l.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-neutral-500 dark:text-neutral-400",children:"Date"}),H&&l.jsx("th",{className:"w-14 px-2 py-3 text-right text-xs font-medium uppercase tracking-wider text-neutral-500 dark:text-neutral-400",children:l.jsx("span",{className:"sr-only",children:"Actions"})})]})}),l.jsx("tbody",{className:"divide-y divide-neutral-200 bg-white dark:divide-neutral-700 dark:bg-neutral-900",children:i?[...Array(5)].map((Y,Ue)=>l.jsxs("tr",{children:[H&&l.jsx("td",{className:"px-3 py-3",children:l.jsx("div",{className:"h-4 w-4 animate-pulse rounded bg-neutral-200 dark:bg-neutral-700"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-neutral-200 dark:bg-neutral-700"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-neutral-200 dark:bg-neutral-700"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("div",{className:"h-4 w-28 animate-pulse rounded bg-neutral-200 dark:bg-neutral-700"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("div",{className:"h-4 w-20 animate-pulse rounded bg-neutral-200 dark:bg-neutral-700"})}),H&&l.jsx("td",{className:"px-2 py-3",children:l.jsx("div",{className:"ml-auto h-4 w-8 animate-pulse rounded bg-neutral-200 dark:bg-neutral-700"})})]},Ue)):r.length===0?l.jsx("tr",{children:l.jsx("td",{colSpan:$,className:"px-4 py-8 text-center text-neutral-500 dark:text-neutral-400",children:Ug?"No downloads found for the current search or filters. Try a different email or product.":"No downloads found for the selected period."})}):r.map(Y=>l.jsxs("tr",{children:[H&&l.jsx("td",{className:"px-3 py-3 align-middle",children:l.jsx("input",{type:"checkbox",checked:A.has(Y.id),onChange:()=>K(Y.id),disabled:L,className:"h-4 w-4 rounded border-neutral-300 text-indigo-600 focus:ring-indigo-500 dark:border-neutral-600","aria-label":`Select ${Y.product_name||"row"}`})}),l.jsx("td",{className:"px-4 py-3 text-sm text-neutral-900 dark:text-white",children:Y.product_name}),l.jsx("td",{className:"px-4 py-3 text-sm text-neutral-500 dark:text-neutral-400",children:Y.file_name}),l.jsx("td",{className:"px-4 py-3 text-sm text-neutral-500 dark:text-neutral-400",children:Y.user_email||"Guest"}),l.jsx("td",{className:"px-4 py-3 text-sm text-neutral-500 dark:text-neutral-400",children:new Date(Y.download_date).toLocaleDateString()}),H&&l.jsx("td",{className:"px-2 py-3 text-right align-middle",children:l.jsxs(bg,{children:[l.jsxs(xg,{plain:!0,className:"inline-flex rounded-md p-1.5 text-neutral-500 transition-colors hover:bg-neutral-200/90 hover:text-neutral-900 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:hover:text-neutral-100","aria-label":"Row actions",disabled:L,children:[l.jsx("span",{className:"sr-only",children:"Actions"}),l.jsx(fb,{className:"h-5 w-5 transition-colors","aria-hidden":!0})]}),l.jsxs(wg,{anchor:"bottom end",children:[l.jsx(Vs,{className:"cursor-pointer text-neutral-800 transition-colors hover:bg-neutral-100 hover:text-neutral-900 !data-focus:bg-neutral-100 !data-focus:text-neutral-900 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:hover:text-white dark:!data-focus:bg-neutral-800 dark:!data-focus:text-white",onClick:()=>{L||Vi("csv",[Y])},children:l.jsxs("span",{className:"inline-flex items-center gap-2",children:[l.jsx(ro,{className:"h-4 w-4 shrink-0 opacity-80","aria-hidden":!0}),"Download as CSV"]})}),l.jsx(Vs,{className:"cursor-pointer text-neutral-800 transition-colors hover:bg-neutral-100 hover:text-neutral-900 !data-focus:bg-neutral-100 !data-focus:text-neutral-900 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:hover:text-white dark:!data-focus:bg-neutral-800 dark:!data-focus:text-white",onClick:()=>{L||Vi("xlsx",[Y])},children:l.jsxs("span",{className:"inline-flex items-center gap-2",children:[l.jsx(oo,{className:"h-4 w-4 shrink-0 opacity-80","aria-hidden":!0}),"Download as Excel"]})}),l.jsx(Vs,{className:"cursor-pointer text-red-600 transition-colors hover:bg-red-50 hover:text-red-700 !data-focus:bg-red-100 !data-focus:text-red-800 dark:text-red-400 dark:hover:bg-red-950/50 dark:hover:text-red-300 dark:!data-focus:bg-red-950/60 dark:!data-focus:text-red-200",onClick:()=>{L||z({mode:"single",item:Y})},children:"Delete entry"})]})]})})]},Y.id))})]})}),D&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",children:l.jsxs("div",{className:"relative w-full max-w-md rounded-lg bg-white p-6 shadow-xl dark:bg-neutral-800",children:[l.jsx("button",{type:"button",onClick:()=>!R&&z(null),className:"absolute right-4 top-4 text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-200","aria-label":"Close",children:l.jsx(Yi,{className:"h-5 w-5"})}),l.jsxs("div",{className:"flex items-start gap-4",children:[l.jsx("div",{className:"flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/50",children:l.jsx(qi,{className:"h-6 w-6 text-red-600 dark:text-red-400"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h3",{className:"text-lg font-semibold text-neutral-900 dark:text-white",children:D.mode==="single"?"Delete this log entry?":`Delete ${D.items.length} log entries?`}),D.mode==="single"?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-300",children:[l.jsx("span",{className:"font-medium text-neutral-900 dark:text-white",children:D.item.product_name})," · ",new Date(D.item.download_date).toLocaleString()]}),l.jsx("p",{className:"mt-2 text-sm text-neutral-500 dark:text-neutral-400",children:"This cannot be undone."})]}):l.jsxs(l.Fragment,{children:[l.jsx("ul",{className:"mt-2 max-h-40 list-inside list-disc space-y-1 overflow-y-auto text-sm text-neutral-600 dark:text-neutral-300",children:D.items.slice(0,5).map(Y=>l.jsxs("li",{children:[l.jsx("span",{className:"font-medium text-neutral-900 dark:text-white",children:Y.product_name})," · ",new Date(Y.download_date).toLocaleString()]},Y.id))}),D.items.length>5&&l.jsxs("p",{className:"mt-2 text-sm text-neutral-500 dark:text-neutral-400",children:["and ",D.items.length-5," more…"]}),l.jsx("p",{className:"mt-2 text-sm text-neutral-500 dark:text-neutral-400",children:"This cannot be undone."})]})]})]}),l.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[l.jsx("button",{type:"button",onClick:()=>!R&&z(null),disabled:R,className:"rounded-md px-4 py-2 text-sm font-medium text-neutral-700 hover:bg-neutral-100 disabled:opacity-50 dark:text-neutral-300 dark:hover:bg-neutral-700",children:"Cancel"}),l.jsx("button",{type:"button",onClick:hE,disabled:R,className:"inline-flex items-center gap-2 rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700 disabled:opacity-50",children:R?l.jsxs(l.Fragment,{children:[l.jsx(Ri,{className:"h-4 w-4 animate-spin"}),"Deleting…"]}):"Delete"})]})]})}),u>1&&l.jsxs("div",{className:"flex items-center justify-between border-t border-neutral-200 px-4 py-3 dark:border-neutral-700",children:[l.jsx("button",{onClick:()=>c(Y=>Math.max(1,Y-1)),disabled:d===1,className:"rounded-md px-3 py-1.5 text-sm font-medium text-neutral-700 hover:bg-neutral-100 disabled:opacity-50 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Previous"}),l.jsxs("span",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:["Page ",d," of ",u]}),l.jsx("button",{onClick:()=>c(Y=>Math.min(u,Y+1)),disabled:d===u,className:"rounded-md px-3 py-1.5 text-sm font-medium text-neutral-700 hover:bg-neutral-100 disabled:opacity-50 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Next"})]})]})}function RM({dateRange:e}){const[t,n]=p.useState(null),[s,r]=p.useState("all-downloads"),[o,i]=p.useState([]),[a,d]=p.useState(Bi.map(k=>k.id)),[c,u]=p.useState([]),[h,m]=p.useState(!1),f=p.useRef({exportType:s,selectedProducts:o,selectedColumns:a});p.useEffect(()=>{f.current={exportType:s,selectedProducts:o,selectedColumns:a}},[s,o,a]);const g=p.useCallback(async()=>{const{exportType:k,selectedProducts:M,selectedColumns:N}=f.current,T={export_type:k,export_products:M,export_columns:N},P=await fetch(`${Wi()}somdn/v1/stats/export-settings`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":zi()},body:JSON.stringify(T)});if(!P.ok)throw new Error(`Failed to save export settings: ${P.status}`);return P.json()},[]);Dg("export-settings",g),p.useEffect(()=>{s==="specific-products"&&c.length===0&&x()},[s]),p.useEffect(()=>{b()},[]);const b=async()=>{try{const k=await Pt("stats/export-settings");k&&(k.export_type&&r(k.export_type),k.export_products&&k.export_products.length>0&&i(k.export_products),k.export_columns&&k.export_columns.length>0&&d(k.export_columns))}catch{}},x=async()=>{m(!0);try{const k=await Pt("stats/products-list");u(k||[])}catch{u([])}finally{m(!1)}},w=()=>{d(Bi.map(k=>k.id))},_=()=>{d([])},y=k=>{d(M=>M.includes(k)?M.filter(N=>N!==k):[...M,k])},v=k=>{i(M=>M.includes(k)?M.filter(N=>N!==k):[...M,k])},j=async k=>{if(a.length===0){alert("Please select at least one column to export.");return}n(k);try{await yg({format:k,dateRange:e,exportType:s,exportProducts:o,exportColumns:a})}catch(M){alert(M.message||"Export failed. Please try again.")}finally{n(null)}};return l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",children:[l.jsxs("div",{className:"border-b border-neutral-200 px-4 py-3 dark:border-neutral-700",children:[l.jsx("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white",children:"Export Data"}),l.jsx("p",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:"The settings below only apply to the data that will be exported. We will use the date range above."})]}),l.jsxs("div",{className:"space-y-6 p-4",children:[l.jsx(xl,{label:"What do you want to export?",options:[{value:"all-downloads",label:"All Downloads"},{value:"all-products",label:"All Products"},{value:"specific-products",label:"Specific Products"}],value:s,onChange:r,type:"button",cols:3}),s==="specific-products"&&l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-neutral-50 p-4 dark:border-neutral-700 dark:bg-neutral-800/50",children:[l.jsx("h4",{className:"mb-3 text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Select Products"}),h?l.jsxs("div",{className:"flex items-center gap-2 text-sm text-neutral-500",children:[l.jsx(cs,{className:"h-4 w-4 animate-spin"}),"Loading products..."]}):c.length===0?l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No products found."}):l.jsx("div",{className:"max-h-48 overflow-y-auto space-y-2",children:c.map(k=>l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:o.includes(k.id),onChange:()=>v(k.id),className:"h-4 w-4 rounded text-indigo-600 focus:ring-indigo-500 border-neutral-300 dark:border-neutral-600"}),l.jsx("span",{className:"text-sm text-neutral-700 dark:text-neutral-300",children:k.name})]},k.id))})]}),l.jsxs("div",{children:[l.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[l.jsx("h4",{className:"text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Customize Export Columns"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{type:"button",onClick:w,className:"text-xs font-medium text-indigo-600 hover:text-indigo-700 dark:text-indigo-400 dark:hover:text-indigo-300",children:"Select All"}),l.jsx("span",{className:"text-neutral-300 dark:text-neutral-600",children:"|"}),l.jsx("button",{type:"button",onClick:_,className:"text-xs font-medium text-indigo-600 hover:text-indigo-700 dark:text-indigo-400 dark:hover:text-indigo-300",children:"Clear All"})]})]}),l.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6",children:Bi.map(k=>l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:a.includes(k.id),onChange:()=>y(k.id),className:"h-4 w-4 rounded text-indigo-600 focus:ring-indigo-500 border-neutral-300 dark:border-neutral-600"}),l.jsx("span",{className:"text-xs text-neutral-700 dark:text-neutral-300",children:k.label})]},k.id))})]}),a.includes("Country based on IP")&&l.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 dark:border-amber-800 dark:bg-amber-900/30",children:l.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:[l.jsx("strong",{children:"Note:"})," Including ",l.jsx("strong",{children:"Country"})," looks up the country for each IP address and can make the export take several minutes for large datasets. You can leave it unchecked for a faster export."]})}),l.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-4 border-t border-neutral-200 dark:border-neutral-700",children:[l.jsxs("button",{onClick:()=>j("xlsx"),disabled:t,className:"inline-flex items-center gap-2 rounded-md bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 disabled:opacity-50",children:[l.jsx(oo,{className:"h-4 w-4"}),t==="xlsx"?"Generating...":"Export XLSX"]}),l.jsxs("button",{onClick:()=>j("csv"),disabled:t,className:"inline-flex items-center gap-2 rounded-md bg-white px-4 py-2 text-sm font-medium text-neutral-700 shadow-sm ring-1 ring-inset ring-neutral-300 hover:bg-neutral-50 disabled:opacity-50 dark:bg-neutral-800 dark:text-neutral-300 dark:ring-neutral-600 dark:hover:bg-neutral-700",children:[l.jsx(ro,{className:"h-4 w-4"}),t==="csv"?"Generating...":"Export CSV"]})]}),l.jsxs("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:[l.jsx("strong",{children:"Note:"})," Only the first 15,000 records starting from the start date will be exported, due to memory limitations."]})]}),t&&l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",children:[l.jsx("style",{children:`
            @keyframes somdn-export-progress {
              0% { transform: translateX(-100%); }
              100% { transform: translateX(400%); }
            }
          `}),l.jsx("div",{className:"relative w-full max-w-sm rounded-lg bg-white p-6 shadow-xl dark:bg-neutral-800",children:l.jsxs("div",{className:"flex flex-col items-center gap-4",children:[l.jsx(Ri,{className:"h-12 w-12 text-indigo-600 dark:text-indigo-400 animate-spin"}),l.jsxs("div",{className:"text-center space-y-1",children:[l.jsx("p",{className:"text-base font-medium text-neutral-900 dark:text-white",children:"Preparing your export…"}),l.jsxs("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:[t==="xlsx"?"Building Excel file":"Building CSV file",".",a.includes("Country based on IP")?" This may take several minutes while we look up countries for each IP.":""]})]}),l.jsx("div",{className:"w-full h-2 bg-neutral-200 dark:bg-neutral-700 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full bg-indigo-600 dark:bg-indigo-400 rounded-full",style:{width:"25%",animation:"somdn-export-progress 1.5s ease-in-out infinite"}})})]})})]})]})}function $M(){var A;const[e,t]=p.useState("older-than"),[n,s]=p.useState(90),[r,o]=p.useState([]),[i,a]=p.useState(""),[d,c]=p.useState(""),[u,h]=p.useState([]),[m,f]=p.useState(!1),[g,b]=p.useState(null),[x,w]=p.useState(!1),[_,y]=p.useState(!1),[v,j]=p.useState(!1),[k,M]=p.useState(null),[N,T]=p.useState(null);p.useEffect(()=>{e==="by-product"&&u.length===0&&P()},[e]);const P=async()=>{f(!0);try{const B=await Pt("stats/products-list");h(B||[])}catch{h([])}finally{f(!1)}},E=B=>{o(C=>C.includes(B)?C.filter(F=>F!==B):[...C,B])},D=async()=>{w(!0),b(null);try{const B={delete_type:e,days:n,product_ids:JSON.stringify(r),start_date:i,end_date:d},C=await Pt("stats/logs-count",B);b(C)}catch{b({count:0,message:"Failed to get count."})}finally{w(!1)}},z=()=>{if(!g||g.count===0){D();return}y(!0)},R=async()=>{y(!1),j(!0),M({deleted:0,remaining:(g==null?void 0:g.count)||0,complete:!1}),T(null);let B=0,C=!1,F=0;const U=500;for(;!C&&F<U;){F++;try{const H=await fetch(`${Wi()}somdn/v1/stats/delete-logs-batch`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":zi()},body:JSON.stringify({delete_type:e,days:n,product_ids:r,start_date:i,end_date:d,batch_size:500})});if(!H.ok)throw new Error(`HTTP ${H.status}`);const L=await H.json();B+=L.deleted_this_batch||0,C=L.complete||L.remaining===0,M({deleted:B,remaining:L.remaining||0,complete:C}),C||await new Promise($=>setTimeout($,100))}catch(H){T({success:!1,message:`Deletion stopped after ${B} entries. Error: ${H.message}`}),j(!1);return}}j(!1),T({success:!0,message:`Successfully deleted ${B.toLocaleString()} download log entries.`}),b(null)},O=()=>{switch(e){case"older-than":return`logs older than ${n} days`;case"date-range":return`logs from ${i||"beginning"} to ${d||"now"}`;case"by-product":return`logs for ${r.length} selected product(s)`;case"all":return"ALL download logs";default:return"logs"}};return l.jsxs("div",{className:"rounded-lg border border-red-200 bg-white dark:border-red-900 dark:bg-neutral-900",children:[l.jsxs("div",{className:"border-b border-red-200 px-4 py-3 dark:border-red-900",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Fd,{className:"h-5 w-5 text-red-600 dark:text-red-400"}),l.jsx("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white",children:"Manage Download Logs"})]}),l.jsx("p",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:"Delete old download log entries to reduce database size. This only removes tracking data, not the actual files."})]}),l.jsxs("div",{className:"space-y-6 p-4",children:[l.jsx(xl,{label:"What do you want to delete?",options:[{value:"older-than",label:"Logs older than X days"},{value:"date-range",label:"Logs in date range"},{value:"by-product",label:"Logs for specific products"},{value:"all",label:"All logs"}],value:e,onChange:B=>{t(B),b(null)},type:"button",cols:4}),e==="older-than"&&l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-neutral-50 p-4 dark:border-neutral-700 dark:bg-neutral-800/50",children:[l.jsx("label",{className:"block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2",children:"Delete logs older than:"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"number",min:"1",max:"3650",value:n,onChange:B=>{s(Math.max(1,Math.min(3650,parseInt(B.target.value)||1))),b(null)},className:"w-24 rounded-md border-neutral-300 shadow-sm focus:border-red-500 focus:ring-red-500 dark:border-neutral-600 dark:bg-neutral-700 dark:text-white sm:text-sm"}),l.jsx("span",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"days"})]}),l.jsx("p",{className:"mt-2 text-xs text-neutral-500 dark:text-neutral-400",children:"Common values: 30 (1 month), 90 (3 months), 180 (6 months), 365 (1 year)"})]}),e==="date-range"&&l.jsx("div",{className:"rounded-lg border border-neutral-200 bg-neutral-50 p-4 dark:border-neutral-700 dark:bg-neutral-800/50",children:l.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2",children:"From date:"}),l.jsx("input",{type:"date",value:i,onChange:B=>{a(B.target.value),b(null)},className:"w-full rounded-md border-neutral-300 shadow-sm focus:border-red-500 focus:ring-red-500 dark:border-neutral-600 dark:bg-neutral-700 dark:text-white sm:text-sm"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2",children:"To date:"}),l.jsx("input",{type:"date",value:d,onChange:B=>{c(B.target.value),b(null)},className:"w-full rounded-md border-neutral-300 shadow-sm focus:border-red-500 focus:ring-red-500 dark:border-neutral-600 dark:bg-neutral-700 dark:text-white sm:text-sm"})]})]})}),e==="by-product"&&l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-neutral-50 p-4 dark:border-neutral-700 dark:bg-neutral-800/50",children:[l.jsx("h4",{className:"mb-3 text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Select Products"}),m?l.jsxs("div",{className:"flex items-center gap-2 text-sm text-neutral-500",children:[l.jsx(cs,{className:"h-4 w-4 animate-spin"}),"Loading products..."]}):u.length===0?l.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No products found."}):l.jsx("div",{className:"max-h-48 overflow-y-auto space-y-2",children:u.map(B=>l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:r.includes(B.id),onChange:()=>{E(B.id),b(null)},className:"h-4 w-4 rounded text-red-600 focus:ring-red-500 border-neutral-300 dark:border-neutral-600"}),l.jsx("span",{className:"text-sm text-neutral-700 dark:text-neutral-300",children:B.name})]},B.id))})]}),e==="all"&&l.jsx("div",{className:"rounded-lg border border-red-300 bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/30",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(qi,{className:"h-5 w-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-medium text-red-800 dark:text-red-200",children:"Warning: This will delete ALL download logs"}),l.jsx("p",{className:"mt-1 text-sm text-red-700 dark:text-red-300",children:"This action cannot be undone. All download tracking history will be permanently deleted. Your export data and statistics will be lost."})]})]})}),g&&l.jsx("div",{className:`rounded-lg p-4 ${g.count>0?"border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-900/30":"border border-green-200 bg-green-50 dark:border-green-800 dark:bg-green-900/30"}`,children:l.jsx("p",{className:`text-sm font-medium ${g.count>0?"text-amber-800 dark:text-amber-200":"text-green-800 dark:text-green-200"}`,children:g.message})}),k&&!k.complete&&l.jsx("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-4 dark:border-blue-800 dark:bg-blue-900/30",children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Ri,{className:"h-5 w-5 text-blue-600 dark:text-blue-400 animate-spin"}),l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:"text-sm font-medium text-blue-800 dark:text-blue-200",children:"Deleting logs..."}),l.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:["Deleted ",k.deleted.toLocaleString()," entries. ",k.remaining.toLocaleString()," remaining."]}),l.jsx("div",{className:"mt-2 w-full bg-blue-200 dark:bg-blue-800 rounded-full h-2",children:l.jsx("div",{className:"bg-blue-600 dark:bg-blue-400 h-2 rounded-full transition-all duration-300",style:{width:`${Math.max(5,k.deleted/(k.deleted+k.remaining)*100)}%`}})})]})]})}),N&&l.jsx("div",{className:`rounded-lg p-4 ${N.success?"border border-green-200 bg-green-50 dark:border-green-800 dark:bg-green-900/30":"border border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-900/30"}`,children:l.jsx("p",{className:`text-sm font-medium ${N.success?"text-green-800 dark:text-green-200":"text-red-800 dark:text-red-200"}`,children:N.message})}),l.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-4 border-t border-neutral-200 dark:border-neutral-700",children:[l.jsx("button",{onClick:D,disabled:x||v,className:"inline-flex items-center gap-2 rounded-md bg-white px-4 py-2 text-sm font-medium text-neutral-700 shadow-sm ring-1 ring-inset ring-neutral-300 hover:bg-neutral-50 disabled:opacity-50 dark:bg-neutral-800 dark:text-neutral-300 dark:ring-neutral-600 dark:hover:bg-neutral-700",children:x?l.jsxs(l.Fragment,{children:[l.jsx(cs,{className:"h-4 w-4 animate-spin"}),"Counting..."]}):l.jsxs(l.Fragment,{children:[l.jsx(cs,{className:"h-4 w-4"}),"Preview Count"]})}),l.jsxs("button",{onClick:z,disabled:v||x||e==="by-product"&&r.length===0,className:"inline-flex items-center gap-2 rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-red-700 disabled:opacity-50",children:[l.jsx(Fd,{className:"h-4 w-4"}),"Delete Logs"]})]}),l.jsxs("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:[l.jsx("strong",{children:"Note:"})," Deleting logs will remove entries from the database permanently. This cannot be undone. We recommend exporting your data before deleting."]})]}),_&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",children:l.jsxs("div",{className:"relative w-full max-w-md rounded-lg bg-white p-6 shadow-xl dark:bg-neutral-800",children:[l.jsx("button",{onClick:()=>y(!1),className:"absolute right-4 top-4 text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-200",children:l.jsx(Yi,{className:"h-5 w-5"})}),l.jsxs("div",{className:"flex items-start gap-4",children:[l.jsx("div",{className:"flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/50",children:l.jsx(qi,{className:"h-6 w-6 text-red-600 dark:text-red-400"})}),l.jsxs("div",{className:"flex-1",children:[l.jsx("h3",{className:"text-lg font-semibold text-neutral-900 dark:text-white",children:"Confirm Deletion"}),l.jsxs("p",{className:"mt-2 text-sm text-neutral-600 dark:text-neutral-300",children:["You are about to permanently delete ",l.jsx("strong",{children:((A=g==null?void 0:g.count)==null?void 0:A.toLocaleString())||0})," ",O(),"."]}),l.jsx("p",{className:"mt-2 text-sm text-neutral-500 dark:text-neutral-400",children:"This action cannot be undone. Are you sure you want to continue?"})]})]}),l.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[l.jsx("button",{onClick:()=>y(!1),className:"rounded-md px-4 py-2 text-sm font-medium text-neutral-700 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-700",children:"Cancel"}),l.jsx("button",{onClick:R,className:"rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700",children:"Yes, Delete Logs"})]})]})})]})}function qM(){const e=[{label:"Total Downloads",value:"1,247",icon:l.jsx(Ui,{className:"h-5 w-5"}),color:"indigo"},{label:"Unique Products",value:"34",icon:l.jsx($i,{className:"h-5 w-5"}),color:"emerald"},{label:"Unique Users",value:"892",icon:l.jsx(zd,{className:"h-5 w-5"}),color:"amber"},{label:"Today",value:"23",icon:l.jsx(io,{className:"h-5 w-5"}),color:"blue"}],t=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],n=[45,62,48,85,73,31,28],s=["Product A","Product B","Product C","Product D","Product E"],r=[156,98,76,54,32],o=["PDF","ZIP","MP3","DOCX","Other"],i=[45,25,15,10,5];return l.jsxs("section",{className:"space-y-8",children:[l.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(vf,{level:2,children:"Download Reports"}),l.jsx(W,{title:"Download Reports & Analytics",description:"Track every download, view detailed charts, analyze trends, and export reports. See which products are most popular and monitor user download activity.",upgradeUrl:"https://wpenhanced.com/products/free-downloads-woocommerce"})]}),l.jsx(il,{className:"mt-1",children:"View download reports, trends, and export data."})]}),l.jsxs("div",{className:"flex items-center gap-3 opacity-50 pointer-events-none",children:[l.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-500 dark:border-neutral-700 dark:bg-neutral-800",children:[l.jsx(cb,{className:"h-4 w-4"}),l.jsx("span",{children:"Last 30 days"})]}),l.jsx("div",{className:"rounded-md p-2 text-neutral-400",children:l.jsx(cs,{className:"h-5 w-5"})})]})]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:l.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-neutral-900/80 px-4 py-2 text-sm font-medium text-white dark:bg-neutral-800",children:[l.jsx(ds,{className:"h-4 w-4"}),l.jsx("span",{children:"Upgrade to Pro to view reports"})]})}),l.jsx("div",{className:"pointer-events-none opacity-40 blur-[2px]",children:l.jsx(_d,{columns:4,children:e.map((a,d)=>l.jsx(Hs,{title:a.label,value:a.value,icon:a.icon,iconColor:Us(a.color)},d))})})]}),l.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-lg",children:l.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-neutral-900/80 px-4 py-2 text-sm font-medium text-white dark:bg-neutral-800",children:[l.jsx(ds,{className:"h-4 w-4"}),l.jsx("span",{children:"Pro Feature"})]})}),l.jsx("div",{className:"pointer-events-none opacity-40 blur-[2px]",children:l.jsx(eo,{labels:t,datasets:[{label:"Downloads",data:n,backgroundColor:Et[0]}],showLegend:!1})})]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-lg",children:l.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-neutral-900/80 px-4 py-2 text-sm font-medium text-white dark:bg-neutral-800",children:[l.jsx(ds,{className:"h-4 w-4"}),l.jsx("span",{children:"Pro Feature"})]})}),l.jsx("div",{className:"pointer-events-none opacity-40 blur-[2px]",children:l.jsx(eo,{labels:s,datasets:[{label:"Downloads",data:r,backgroundColor:Et.slice(0,s.length)}],horizontal:!0,showLegend:!1})})]})]}),l.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-3",children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-lg",children:l.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-neutral-900/80 px-4 py-2 text-sm font-medium text-white dark:bg-neutral-800",children:[l.jsx(ds,{className:"h-4 w-4"}),l.jsx("span",{children:"Pro Feature"})]})}),l.jsx("div",{className:"pointer-events-none opacity-40 blur-[2px]",children:l.jsx(wd,{labels:o,data:i,colors:Et.slice(0,o.length),showLegend:!1,cutout:60,centerText:{title:"Total",value:i.reduce((a,d)=>a+d,0).toLocaleString()}})})]}),l.jsxs("div",{className:"lg:col-span-2 relative",children:[l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-lg",children:l.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-neutral-900/80 px-4 py-2 text-sm font-medium text-white dark:bg-neutral-800",children:[l.jsx(ds,{className:"h-4 w-4"}),l.jsx("span",{children:"Pro Feature"})]})}),l.jsx("div",{className:"pointer-events-none opacity-40 blur-[2px]",children:l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",children:[l.jsx("div",{className:"border-b border-neutral-200 px-4 py-3 dark:border-neutral-700",children:l.jsx("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white",children:"Recent Downloads"})}),l.jsx("div",{className:"overflow-x-auto",children:l.jsxs("table",{className:"min-w-full divide-y divide-neutral-200 dark:divide-neutral-700",children:[l.jsx("thead",{className:"bg-neutral-50 dark:bg-neutral-800",children:l.jsxs("tr",{children:[l.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-neutral-500",children:"Product"}),l.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-neutral-500",children:"File"}),l.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-neutral-500",children:"User"}),l.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-neutral-500",children:"Date"})]})}),l.jsx("tbody",{className:"divide-y divide-neutral-200 bg-white dark:divide-neutral-700 dark:bg-neutral-900",children:[1,2,3,4,5].map(a=>l.jsxs("tr",{children:[l.jsx("td",{className:"px-4 py-3",children:l.jsx("div",{className:"h-4 w-32 bg-neutral-200 dark:bg-neutral-700 rounded"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("div",{className:"h-4 w-24 bg-neutral-200 dark:bg-neutral-700 rounded"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("div",{className:"h-4 w-28 bg-neutral-200 dark:bg-neutral-700 rounded"})}),l.jsx("td",{className:"px-4 py-3",children:l.jsx("div",{className:"h-4 w-20 bg-neutral-200 dark:bg-neutral-700 rounded"})})]},a))})]})})]})})]})]}),l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-lg",children:l.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-neutral-900/80 px-4 py-2 text-sm font-medium text-white dark:bg-neutral-800",children:[l.jsx(ds,{className:"h-4 w-4"}),l.jsx("span",{children:"Export data with Pro"})]})}),l.jsx("div",{className:"pointer-events-none opacity-40 blur-[2px]",children:l.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",children:[l.jsxs("div",{className:"border-b border-neutral-200 px-4 py-3 dark:border-neutral-700",children:[l.jsx("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white",children:"Export Data"}),l.jsx("p",{className:"mt-1 text-sm text-neutral-500",children:"Export download reports to Excel or CSV."})]}),l.jsxs("div",{className:"p-4 flex gap-3",children:[l.jsxs("div",{className:"rounded-md bg-indigo-600 px-4 py-2 text-sm font-medium text-white flex items-center gap-2",children:[l.jsx(oo,{className:"h-4 w-4"}),"Export XLSX"]}),l.jsxs("div",{className:"rounded-md bg-white border border-neutral-300 px-4 py-2 text-sm font-medium text-neutral-700 flex items-center gap-2",children:[l.jsx(ro,{className:"h-4 w-4"}),"Export CSV"]})]})]})})]}),l.jsx("div",{className:"rounded-lg border border-indigo-200 bg-indigo-50 p-6 dark:border-indigo-900 dark:bg-indigo-950/30",children:l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(an,{className:"h-6 w-6 text-indigo-600 dark:text-indigo-400 flex-shrink-0 mt-0.5"}),l.jsxs("div",{children:[l.jsx("h3",{className:"font-semibold text-indigo-800 dark:text-indigo-200",children:"Unlock Download Reports"}),l.jsx("p",{className:"mt-1 text-sm text-indigo-700 dark:text-indigo-300",children:"Upgrade to Pro to track downloads, view detailed charts, analyze trends, and export comprehensive reports."})]})]}),l.jsx("a",{href:"https://wpenhanced.com/products/free-downloads-woocommerce",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center rounded-md bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 whitespace-nowrap",children:"Upgrade to Pro"})]})})]})}const kg="somdn_reports_date_range",jg="somdn_download_log_date_range";function YM(){try{const n=new URLSearchParams(window.location.search),s=n.get("start_date"),r=n.get("end_date");if(s&&r){const i=new Date(s+"T00:00:00"),a=new Date(r+"T23:59:59");if(!Number.isNaN(i.getTime())&&!Number.isNaN(a.getTime())&&i<=a)return{start:i,end:a}}const o=typeof sessionStorage<"u"?sessionStorage.getItem(kg):null;if(o){const{start:i,end:a}=JSON.parse(o);if(i&&a){const d=new Date(i),c=new Date(a);if(!Number.isNaN(d.getTime())&&!Number.isNaN(c.getTime())&&d<=c)return{start:d,end:c}}}}catch{}const e=new Date,t=new Date;return t.setDate(t.getDate()-30),{start:t,end:e}}function KM(e){if(!(!(e!=null&&e.start)||!(e!=null&&e.end)))try{const t=e.start.toISOString().split("T")[0],n=e.end.toISOString().split("T")[0];sessionStorage.setItem(kg,JSON.stringify({start:t,end:n}));const s=new URL(window.location.href);s.searchParams.set("start_date",t),s.searchParams.set("end_date",n),window.history.replaceState({},"",s.toString())}catch{}}function GM(){try{const n=typeof sessionStorage<"u"?sessionStorage.getItem(jg):null;if(n){const{start:s,end:r}=JSON.parse(n);if(s&&r){const o=new Date(s),i=new Date(r);if(!Number.isNaN(o.getTime())&&!Number.isNaN(i.getTime())&&o<=i)return{start:o,end:i}}}}catch{}const e=new Date,t=new Date;return t.setFullYear(t.getFullYear()-1),{start:t,end:e}}function XM(e){if(!(!(e!=null&&e.start)||!(e!=null&&e.end)))try{const t=e.start.toISOString().split("T")[0],n=e.end.toISOString().split("T")[0];sessionStorage.setItem(jg,JSON.stringify({start:t,end:n}))}catch{}}function Sg(){const e=AM(),[t,n]=p.useState("overview"),[s,r]=p.useState(YM),o=d=>{r(d),KM(d)},i=()=>{r(d=>({...d}))};if(!e)return l.jsx(qM,{});const a=[{name:"Overview",value:"overview",current:t==="overview"},{name:"Export Data",value:"export",current:t==="export"},{name:"Delete Logs",value:"delete",current:t==="delete"}];return l.jsxs("section",{className:"space-y-8",children:[l.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[l.jsxs("div",{children:[l.jsx(vf,{level:2,children:"Download Reports"}),l.jsx(il,{className:"mt-1",children:"View download reports, trends, and export data."})]}),(t==="overview"||t==="export")&&l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(gg,{startDate:s.start,endDate:s.end,onChange:o}),t==="overview"&&l.jsx("button",{onClick:i,className:"rounded-md p-2 text-neutral-500 hover:bg-neutral-100 hover:text-neutral-700 dark:text-neutral-400 dark:hover:bg-neutral-800 dark:hover:text-neutral-200",title:"Refresh data",children:l.jsx(cs,{className:"h-5 w-5"})})]})]}),l.jsx(hh,{tabs:a,value:t,setValue:n}),l.jsxs("div",{className:"mt-6",children:[t==="overview"&&l.jsxs("div",{"data-tab":"overview",className:"space-y-8",children:[l.jsx(BM,{dateRange:s,onDateRangeChange:o}),l.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[l.jsx(HM,{dateRange:s}),l.jsx(VM,{dateRange:s})]}),l.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-3",children:[l.jsx(UM,{dateRange:s}),l.jsx("div",{className:"lg:col-span-2",children:l.jsx(vg,{dateRange:s})})]})]}),t==="export"&&l.jsx("div",{"data-tab":"export",className:"space-y-6",children:l.jsx(RM,{dateRange:s})}),t==="delete"&&l.jsx("div",{"data-tab":"delete",className:"space-y-6",children:l.jsx($M,{})})]})]})}function Ng(){const[e,t]=p.useState(GM),n=s=>{t(s),XM(s)};return l.jsxs("section",{className:"w-full max-w-none",children:[l.jsx("div",{className:"mb-6",children:l.jsx("h2",{className:"text-lg font-semibold text-neutral-900 dark:text-white",children:"Download log"})}),l.jsx(vg,{dateRange:e,fromDownloadLog:!0,onDateRangeChange:n})]})}const QM={},Cg=[{fieldId:"download-log",label:"Download Log",help:"View full download history with search and filters.",sectionKey:"download-log",pluginSlug:Fi,keywords:["download","log","history","reports","pro"]}],ZM={},Mg=[{fieldId:"reports-overview",label:"Download Reports",help:"View download reports, charts, and export data.",sectionKey:"reports",pluginSlug:Fi,keywords:["reports","analytics","charts","downloads","statistics","pro"]},{fieldId:"reports-export",label:"Export Reports",help:"Export download data to Excel or CSV.",sectionKey:"reports",pluginSlug:Fi,keywords:["export","excel","csv","xlsx","download","reports","pro"]},{fieldId:"reports-delete-logs",label:"Delete Download Logs",help:"Delete old download log entries to reduce database size.",sectionKey:"reports",pluginSlug:Fi,keywords:["delete","logs","cleanup","database","pro"]}],JM=Object.freeze(Object.defineProperty({__proto__:null,DownloadLogSettings:Ng,ReportsSettings:Sg,downloadLogDefaults:QM,downloadLogSettingsIndex:Cg,reportsDefaults:ZM,reportsSettingsIndex:Mg},Symbol.toStringTag,{value:"Module"}));function Rs(...e){return e.filter(Boolean).join(" ")}const Eg="free-downloads-woocommerce",Pg=()=>{var e;return typeof window>"u"?!1:((e=window.somdn_settings)==null?void 0:e.is_pro)===!0};function eE(){const{setValue:e}=it();return(t={})=>{Object.entries(t).forEach(([n,s])=>e(n,s))}}const Tg=p.createContext({registerSaveAction:()=>{},unregisterSaveAction:()=>{}});function Dg(e,t){const{registerSaveAction:n,unregisterSaveAction:s}=p.useContext(Tg);p.useEffect(()=>{if(t)return n(e,t),()=>s(e)},[e,t,n,s])}function tE({resources:e,additionalSaveActions:t}){var a;const{values:n}=it(),s=eE(),r=p.useMemo(()=>e.reduce((d,c)=>({...d,...c.defaults}),{}),[e]),o=async()=>{const d={};e.forEach(u=>{d[u.slug]={},Object.keys(u.defaults).forEach(h=>{h in n&&(d[u.slug][h]=n[h])})});const c=await Promise.all(e.map(u=>u.saveWithState(d[u.slug]||{})));if(t&&Object.keys(t).length>0)try{await Promise.all(Object.values(t).map(u=>u()))}catch{}return c.every(u=>u==="success")?"success":"error"},i=(a=e.find(d=>d.saveState))==null?void 0:a.saveState;return l.jsx(nb,{onSave:o,onReset:()=>s(r),saveState:i})}function nE({currentSection:e}){var Q;const[t,n]=p.useState(()=>Pg());p.useEffect(()=>{const V=()=>{const Ne=Pg();Ne!==t&&n(Ne)};V();const K=()=>{setTimeout(V,100)};window.addEventListener("license-activated",K);const te=setInterval(V,2e3);return()=>{window.removeEventListener("license-activated",K),clearInterval(te)}},[t]);const s=Re({slug:"free-downloads-gen",restNamespace:"wpe/v1",defaults:ph}),r=Re({slug:"free-downloads-single",restNamespace:"wpe/v1",defaults:xh}),o=Re({slug:"free-downloads-multi",restNamespace:"wpe/v1",defaults:yh}),i=Re({slug:"free-downloads-owned",restNamespace:"wpe/v1",defaults:jh}),a=Re({slug:"free-downloads-docviewer",restNamespace:"wpe/v1",defaults:Ch}),d=Re({slug:"free-downloads-debug",restNamespace:"wpe/v1",defaults:$h}),c=Re({slug:"free-downloads-quickview",restNamespace:"wpe/v1",defaults:zh}),u=Re({slug:"free-downloads-limits",restNamespace:"wpe/v1",defaults:Zh,skip:!t}),h=Re({slug:"free-downloads-membership-limits",restNamespace:"wpe/v1",defaults:Jh,skip:!t}),m=Re({slug:"free-downloads-tracking",restNamespace:"wpe/v1",defaults:nf,skip:!t}),f=Re({slug:"free-downloads-newsletter",restNamespace:"wpe/v1",defaults:pf,skip:!t}),g=Re({slug:"free-downloads-mailchimp",restNamespace:"wpe/v1",defaults:gf,skip:!t}),b=Re({slug:"free-downloads-download-type",restNamespace:"wpe/v1",defaults:af,skip:!t}),x=Re({slug:"free-downloads-include-products",restNamespace:"wpe/v1",defaults:cf,skip:!t}),w=Re({slug:"free-downloads-include-cats",restNamespace:"wpe/v1",defaults:uf,skip:!t}),_=Re({slug:"free-downloads-include-tags",restNamespace:"wpe/v1",defaults:hf,skip:!t}),y=Re({slug:"free-downloads-emails",restNamespace:"wpe/v1",defaults:wf,skip:!t}),v=[s,r,o,i,a,d,c],j=t?[u,h,m,f,g,b,x,w,_,y]:[],k=[...v,...j],[M,N]=p.useState({}),T=p.useCallback((V,K)=>{N(te=>({...te,[V]:K}))},[]),P=p.useCallback(V=>{N(K=>{const te={...K};return delete te[V],te})},[]),E=p.useMemo(()=>({registerSaveAction:T,unregisterSaveAction:P}),[T,P]),D=[{name:"General",key:"general",icon:_b},{name:"Single Files",key:"single-files",icon:pb},{name:"Multiple Files",key:"multiple-files",icon:bb},{name:"Owned Products",key:"owned-products",icon:$i},{name:"PDF Settings",key:"pdf-settings",icon:gb},{name:"Quick View",key:"quick-view",icon:mb},{name:"Debug",key:"debug",icon:db}],z=typeof window<"u"&&((Q=window.somdn_settings)==null?void 0:Q.addon_sections)||[],R=z.map(V=>({name:V.name||V.key,key:V.key,icon:Ad})),O=[{name:"Reports",key:"stats",icon:an},{name:"Download log",key:"download-log",icon:Id},{name:"Download Limits",key:"download-limits",icon:Ui},{name:"Tracking",key:"tracking",icon:Id},{name:"Download Delivery",key:"download-delivery",icon:vb},{name:"Advanced Restrictions",key:"advanced-restrictions",icon:yb},{name:"Newsletter",key:"newsletter",icon:xb},{name:"Emails",key:"emails",icon:Ad},...R],[A,B]=p.useState(()=>{if(typeof window<"u"){const V=localStorage.getItem("somdn-sidebar-collapsed");return V?JSON.parse(V):!1}return!1}),C=p.useCallback(()=>{B(V=>{const K=!V;return typeof window<"u"&&(localStorage.setItem("somdn-sidebar-collapsed",JSON.stringify(K)),document.body.setAttribute("data-sidebar-collapsed",String(K))),K})},[]);p.useEffect(()=>{typeof window<"u"&&document.body.setAttribute("data-sidebar-collapsed",String(A))},[A]);const U=p.useMemo(()=>[...D,...O],[]).map(V=>V.key),H=U.includes(e||"general")&&e||"general",L=({className:V=""})=>l.jsx("div",{className:`animate-pulse rounded-md bg-gray-200/70 dark:bg-neutral-800/70 ${V}`});function $(){return l.jsxs("div",{className:"flex gap-6",children:[l.jsx("aside",{className:"w-72 shrink-0 border-r border-neutral-200 dark:border-neutral-700 pr-4",children:l.jsxs("nav",{className:"py-2",children:[l.jsxs("div",{className:"mb-4",children:[l.jsx(L,{className:"h-4 w-16 mb-2"}),l.jsx(L,{className:"h-8 mb-2"}),l.jsx(L,{className:"h-8 mb-2"}),l.jsx(L,{className:"h-8 mb-2"}),l.jsx(L,{className:"h-8 mb-2"}),l.jsx(L,{className:"h-8 mb-2"}),l.jsx(L,{className:"h-8 mb-2"}),l.jsx(L,{className:"h-8 w-2/3"})]}),l.jsxs("div",{className:"mt-6 pt-4 border-t border-neutral-200 dark:border-neutral-700",children:[l.jsx(L,{className:"h-4 w-12 mb-2"}),l.jsx(L,{className:"h-8 mb-2"}),l.jsx(L,{className:"h-8 mb-2"}),l.jsx(L,{className:"h-8 mb-2"}),l.jsx(L,{className:"h-8 mb-2"}),l.jsx(L,{className:"h-8 mb-2"}),l.jsx(L,{className:"h-8 w-2/3"})]})]})}),l.jsxs("main",{className:"flex-1 py-6",children:[l.jsx(L,{className:"h-7 w-72 mb-3"}),l.jsxs("div",{className:"space-y-3 mb-8",children:[l.jsx(L,{className:"h-3 w-5/6"}),l.jsx(L,{className:"h-3 w-4/6"}),l.jsx(L,{className:"h-3 w-3/5"})]}),l.jsxs("div",{className:"space-y-6 max-w-2xl",children:[l.jsxs("div",{children:[l.jsx(L,{className:"h-4 w-40 mb-2"}),l.jsx(L,{className:"h-10 w-full"})]}),l.jsxs("div",{children:[l.jsx(L,{className:"h-4 w-32 mb-2"}),l.jsx(L,{className:"h-7 w-16 rounded-full"})]}),l.jsxs("div",{children:[l.jsx(L,{className:"h-4 w-48 mb-2"}),l.jsx(L,{className:"h-10 w-full"})]})]}),l.jsx("div",{className:"mt-10 pt-10 border-t border-neutral-200 dark:border-neutral-700",children:l.jsxs("div",{className:"flex justify-end gap-3",children:[l.jsx(L,{className:"h-9 w-24"}),l.jsx(L,{className:"h-9 w-24"})]})})]})]})}if(v.some(V=>V.loading)||t&&j.some(V=>V.loading))return l.jsx($,{});const ne=k.reduce((V,K)=>({...V,...K.initialValues}),{});return l.jsx(eb,{initialValues:ne,children:l.jsx(Tg.Provider,{value:E,children:l.jsxs("div",{className:"flex gap-6",children:[l.jsx("aside",{className:Rs(A?"w-16":"w-72","shrink-0 border-r border-neutral-200 dark:border-neutral-700 transition-all duration-200",A?"px-0 -ml-4 sm:-ml-5 lg:-ml-6":"pr-4"),children:l.jsxs("nav",{className:"relative flex flex-col",children:[l.jsx("div",{className:Rs("mb-4 flex",A?"justify-center":"justify-end"),children:l.jsx("button",{onClick:C,className:"rounded-md p-1.5 text-neutral-500 hover:bg-neutral-100 hover:text-neutral-700 dark:text-neutral-400 dark:hover:bg-white/5 dark:hover:text-neutral-200 transition-colors","aria-label":A?"Expand sidebar":"Collapse sidebar",title:A?"Expand sidebar":"Collapse sidebar",children:A?l.jsx(hb,{className:"size-4"}):l.jsx(ub,{className:"size-4"})})}),!A&&l.jsx("div",{className:"mb-2",children:l.jsx("span",{className:"px-3 text-xs font-semibold uppercase tracking-wider text-neutral-500 dark:text-neutral-400",children:"Free"})}),l.jsx("ul",{role:"list",className:"flex flex-col gap-y-1",children:D.map(V=>{const K=`#${Eg}/${V.key}`,te=H===V.key,Ne=V.icon;return l.jsxs("li",{className:Rs(A&&"relative group"),children:[l.jsxs("a",{href:K,className:Rs(te?"bg-neutral-50 dark:bg-white/5":"hover:bg-neutral-50 dark:hover:bg-white/5","block rounded-md py-2 text-sm font-medium text-neutral-800 dark:text-neutral-300 inline-flex items-center gap-2 transition-colors",A?"justify-center px-0 w-full":"pl-3 pr-2"),"aria-current":te?"page":void 0,children:[Ne&&l.jsx(Ne,{className:"size-4 shrink-0","aria-hidden":"true"}),!A&&l.jsx("span",{children:V.name})]}),A&&l.jsxs("div",{className:"absolute left-full ml-2 top-1/2 -translate-y-1/2 px-2 py-1.5 bg-neutral-900 dark:bg-neutral-800 text-white text-xs font-medium rounded-md whitespace-nowrap opacity-0 pointer-events-none group-hover:opacity-100 transition-opacity duration-200 z-50 shadow-lg",children:[V.name,l.jsx("div",{className:"absolute right-full top-1/2 -translate-y-1/2 border-4 border-transparent border-r-neutral-900 dark:border-r-neutral-800"})]})]},V.key)})}),!A&&l.jsx("div",{className:"mt-6 pt-4 border-t border-neutral-200 dark:border-neutral-700 mb-2",children:l.jsx("span",{className:"px-3 text-xs font-semibold uppercase tracking-wider text-indigo-600 dark:text-indigo-500",children:"Pro"})}),A&&l.jsx("div",{className:"mt-4 pt-4 border-t border-neutral-200 dark:border-neutral-700 mb-2"}),!t&&!A&&l.jsx("div",{className:"mb-3 px-3",children:l.jsx("div",{className:"p-2.5 rounded-md bg-indigo-50 dark:bg-indigo-900/20 border border-indigo-200 dark:border-indigo-800 shadow-sm",children:l.jsxs("p",{className:"text-xs leading-relaxed text-indigo-800 dark:text-indigo-200",children:[l.jsx("strong",{className:"block mb-1.5 font-semibold",children:"License Required"}),l.jsx("span",{className:"block mb-1.5",children:"Pro features require an active license."}),l.jsx("a",{href:"/wp-admin/admin.php?page=wp-enhanced#license",className:"inline-block underline hover:no-underline font-semibold text-indigo-900 dark:text-indigo-100 hover:text-indigo-700 dark:hover:text-indigo-300",onClick:V=>{V.preventDefault(),window.location.href="/wp-admin/admin.php?page=wp-enhanced#license"},children:"Activate license →"})]})})}),l.jsx("ul",{role:"list",className:"flex flex-col gap-y-1",children:O.map(V=>{const K=`#${Eg}/${V.key}`,te=H===V.key,Ne=V.icon;return l.jsxs("li",{className:Rs(A&&"relative group"),children:[l.jsxs("a",{href:K,className:Rs(te?"bg-neutral-50 dark:bg-white/5":"hover:bg-neutral-50 dark:hover:bg-white/5","block rounded-md py-2 text-sm font-medium text-neutral-800 dark:text-neutral-300 inline-flex items-center gap-2 transition-colors",A?"justify-center px-0 w-full":"pl-3 pr-2"),"aria-current":te?"page":void 0,children:[Ne&&l.jsx(Ne,{className:"size-4 shrink-0","aria-hidden":"true"}),!A&&l.jsx("span",{children:V.name})]}),A&&l.jsxs("div",{className:"absolute left-full ml-2 top-1/2 -translate-y-1/2 px-2 py-1.5 bg-neutral-900 dark:bg-neutral-800 text-white text-xs font-medium rounded-md whitespace-nowrap opacity-0 pointer-events-none group-hover:opacity-100 transition-opacity duration-200 z-50 shadow-lg",children:[V.name,l.jsx("div",{className:"absolute right-full top-1/2 -translate-y-1/2 border-4 border-transparent border-r-neutral-900 dark:border-r-neutral-800"})]})]},V.key)})})]})}),l.jsxs("main",{className:"flex-1",children:[!t&&(H==="stats"||H==="download-log"||H==="download-limits"||H==="tracking"||H==="download-delivery"||H==="advanced-restrictions"||H==="newsletter"||H==="emails")&&l.jsx("div",{className:"mb-6 p-5 rounded-lg bg-gradient-to-r from-indigo-50 to-indigo-100 dark:from-indigo-900/30 dark:to-indigo-900/20 border border-indigo-200 dark:border-indigo-800 shadow-md",children:l.jsx("div",{className:"flex items-start gap-4",children:l.jsxs("div",{className:"flex-1",children:[l.jsx("h3",{className:"text-base font-bold text-indigo-900 dark:text-indigo-100 mb-2",children:"⚠️ Pro License Required"}),l.jsxs("p",{className:"text-sm text-indigo-800 dark:text-indigo-200 mb-4 leading-relaxed",children:["These Pro features require an active license key. Activate your license in ",l.jsx("strong",{children:"License Management"})," to unlock all Pro functionality including Reports, Download Limits, Tracking, and more."]}),l.jsx("a",{href:"/wp-admin/admin.php?page=wp-enhanced#license",className:"inline-flex items-center gap-2 px-5 py-2.5 text-sm font-semibold text-white hover:text-white bg-indigo-600 hover:bg-indigo-700 dark:bg-indigo-700 dark:hover:bg-indigo-600 rounded-md transition-colors shadow-sm",onClick:V=>{V.preventDefault(),window.location.href="/wp-admin/admin.php?page=wp-enhanced#license"},children:"Go to License Management →"})]})})}),H==="general"&&l.jsx(gh,{}),H==="single-files"&&l.jsx(wh,{}),H==="multiple-files"&&l.jsx(vh,{}),H==="owned-products"&&l.jsx(Sh,{}),H==="pdf-settings"&&l.jsx(Mh,{}),H==="quick-view"&&l.jsx(Wh,{}),H==="debug"&&l.jsx(qh,{}),H==="stats"&&l.jsx(Sg,{}),H==="download-log"&&l.jsx(Ng,{}),H==="download-limits"&&l.jsx(ef,{}),H==="tracking"&&l.jsx(sf,{}),H==="download-delivery"&&l.jsx(lf,{}),H==="advanced-restrictions"&&l.jsx(ff,{}),H==="newsletter"&&l.jsx(bf,{}),H==="emails"&&l.jsx(_f,{}),z.some(V=>V.key===H)&&l.jsx("div",{id:`somdn-addon-root-${H}`,className:"somdn-addon-section","data-addon-key":H}),!U.includes(H)&&l.jsx(sE,{section:H}),l.jsx(tE,{resources:k,additionalSaveActions:M})]})]})})})}function sE({section:e}){return l.jsxs("section",{className:"space-y-6",children:[l.jsx("h2",{className:"text-lg font-semibold dark:text-white",children:"Unknown Section"}),l.jsxs("p",{className:"text-base/6 text-neutral-500 sm:text-sm/6 dark:text-neutral-400",children:['The section "',e,'" does not exist.']})]})}const rE=[...bh,..._h,...kh,...Nh,...Eh,...Bh,...Yh,...Mg,...Cg,...tf,...rf,...df,...mf,...xf,...yf],oE=Object.freeze(Object.defineProperty({__proto__:null,default:nE,settingsIndex:rE,useRegisterSaveAction:Dg},Symbol.toStringTag,{value:"Module"})),Mn={slug:"free-downloads-woocommerce",label:"Free Downloads WooCommerce",color:"#4f46e5",order:1},iE=Object.assign({"./pages/free-downloads-woocommerce.jsx":oE,"./pages/sections/debug-settings.jsx":Dv,"./pages/sections/general-settings.jsx":Zy,"./pages/sections/multiple-files-settings.jsx":ev,"./pages/sections/owned-products-settings.jsx":tv,"./pages/sections/pdf-settings.jsx":nv,"./pages/sections/pro/advanced-restrictions-settings.jsx":Uv,"./pages/sections/pro/download-delivery-settings.jsx":Hv,"./pages/sections/pro/download-limits-settings.jsx":Av,"./pages/sections/pro/emails-settings.jsx":Yv,"./pages/sections/pro/newsletter-settings.jsx":$v,"./pages/sections/pro/stats-settings.jsx":JM,"./pages/sections/pro/tracking-settings.jsx":zv,"./pages/sections/quick-view-settings.jsx":bv,"./pages/sections/single-files-settings.jsx":Jy});function aE(e){const t=e.split("/"),n=t.pop(),s=t.pop();return/^index\.(jsx|tsx)$/i.test(n)?s:n.replace(/\.(jsx|tsx)$/i,"")}const vd={},kd=[];for(const[e,t]of Object.entries(iE)){const n=aE(e);t.default&&(vd[n]=t.default),Array.isArray(t.settingsIndex)?kd.push(...t.settingsIndex):Array.isArray(t.SETTINGS_INDEX)&&kd.push(...t.SETTINGS_INDEX)}function Ig(){var n,s,r;if(!Mn||!Mn.slug)return;const e={slug:Mn.slug,label:Mn.label||Mn.slug,color:Mn.color,order:Mn.order,pages:vd,settingsIndex:kd};(typeof window<"u"&&((n=window.diviEngineSettingsObject)==null?void 0:n.organization)||"divi-engine")==="wp-enhanced"?typeof window<"u"&&((s=window.WPESettingsFramework)!=null&&s.registerPlugin)?window.WPESettingsFramework.registerPlugin(e):(window.__WPE_PENDING_PLUGINS__=window.__WPE_PENDING_PLUGINS__||[],window.__WPE_PENDING_PLUGINS__.push(e)):typeof window<"u"&&((r=window.DESettingsFramework)!=null&&r.registerPlugin)?window.DESettingsFramework.registerPlugin(e):(window.__DE_PENDING_PLUGINS__=window.__DE_PENDING_PLUGINS__||[],window.__DE_PENDING_PLUGINS__.push(e))}return typeof window<"u"&&Ig(),yt.pages=vd,yt.pluginConfig=Mn,yt.registerPlugin=Ig,Object.defineProperty(yt,Symbol.toStringTag,{value:"Module"}),yt}({},React,ReactDOM);
