github-stars-organizer 0.1.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -23
- package/dist/app/THIRD-PARTY-LICENSES.txt +26 -0
- package/dist/app/apple-touch-icon.png +0 -0
- package/dist/app/assets/backups-r4Hq-y_s.js +1 -0
- package/dist/app/assets/{badge-Ba4FNylI.js → badge-DWmLT6OI.js} +1 -1
- package/dist/app/assets/button-C0MQwO-R.js +14 -0
- package/dist/app/assets/coerce-D595RIhb.js +1 -0
- package/dist/app/assets/{explore-CrybvCPL.js → explore-Cizp4zKW.js} +5 -5
- package/dist/app/assets/{history-C-bdlEYN.js → history-OZ9l4TiG.js} +1 -1
- package/dist/app/assets/index--a4C8I0g.css +2 -0
- package/dist/app/assets/index-Cks444Kn.js +10 -0
- package/dist/app/assets/list._listId-C5TBL1sd.js +2 -0
- package/dist/app/assets/list._listId-Cq8rSqKM.js +1 -0
- package/dist/app/assets/local-backups-BGSAd5Gu.js +1 -0
- package/dist/app/assets/{local-sync-DQzF1V9q.js → local-sync-Dd3hEb9I.js} +1 -1
- package/dist/app/assets/registry-DZ4hp3Pl.js +4 -0
- package/dist/app/assets/routes-C8TmhzRl.js +2 -0
- package/dist/app/assets/routes-CXgqVl-F.js +3 -0
- package/dist/app/assets/schemas-B0gCwksU.js +39 -0
- package/dist/app/assets/{star-DgcTDj5Y.js → star-BoN7NVgv.js} +2 -2
- package/dist/app/assets/triangle-alert-Cgw2r-Xm.js +1 -0
- package/dist/app/favicon.svg +6 -1
- package/dist/app/index.html +10 -9
- package/dist/cli.js +7 -3
- package/package.json +1 -1
- package/dist/app/assets/backups-DxRMQO9O.js +0 -1
- package/dist/app/assets/button-ZbiqMfUE.js +0 -14
- package/dist/app/assets/coerce-B4B_TTls.js +0 -1
- package/dist/app/assets/download-CzXogqy0.js +0 -1
- package/dist/app/assets/index-B6vy4QhK.css +0 -2
- package/dist/app/assets/index-C_V67CMR.js +0 -10
- package/dist/app/assets/list._listId-BHMtNFq8.js +0 -1
- package/dist/app/assets/list._listId-tfkSZzxB.js +0 -2
- package/dist/app/assets/registry-BKuxwL5K.js +0 -4
- package/dist/app/assets/routes-C_O77OAA.js +0 -1
- package/dist/app/assets/routes-lhdAnl7w.js +0 -2
- package/dist/app/assets/schemas-D_ddKDHk.js +0 -39
- package/dist/app/icons.svg +0 -24
- /package/dist/app/assets/{esm-hHQKpih6.js → esm-Cyyp48ez.js} +0 -0
package/README.md
CHANGED
|
@@ -1,33 +1,16 @@
|
|
|
1
1
|
# github-stars-organizer
|
|
2
2
|
|
|
3
|
-
Search, tag, rate and
|
|
4
|
-
score for every repo. Runs on your machine with the GitHub login you already have.
|
|
3
|
+
Search, tag, rate and sort your GitHub stars into Lists that sync back to GitHub.
|
|
5
4
|
|
|
6
5
|
```bash
|
|
7
|
-
gh auth login # once, if you haven't
|
|
8
6
|
npx github-stars-organizer
|
|
9
7
|
```
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
are written to GitHub; tags, ratings and notes are saved in your browser. Set `GITHUB_TOKEN` to use
|
|
13
|
-
a different token, `--port` to use another port, `--no-open` to skip opening the browser.
|
|
9
|
+
Uses your `gh` login (or `GITHUB_TOKEN`) and opens http://127.0.0.1:5185. Ctrl-C to quit.
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
restore never unstars or deletes anything. GitHub dates a re-starred repo the day it was restored.
|
|
11
|
+
- Backs up your stars and Lists to `~/.github-stars-organizer/backups/` before every launch.
|
|
12
|
+
- Talks only to `api.github.com`. No telemetry; your data stays on your machine.
|
|
18
13
|
|
|
19
|
-
|
|
14
|
+
Source and demo: https://github.com/armanckeser/github-stars-organizer
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
telemetry. What it keeps stays on your computer, in that browser's storage and the backups folder.
|
|
23
|
-
|
|
24
|
-
## License
|
|
25
|
-
|
|
26
|
-
Copyright (C) 2026 Armanc Keser. Free software under the GNU Affero General Public License, version 3
|
|
27
|
-
or (at your option) any later version; see `LICENSE`. It comes with ABSOLUTELY NO WARRANTY.
|
|
28
|
-
`dist/THIRD-PARTY-LICENSES.txt` and `dist/app/THIRD-PARTY-LICENSES.txt` list the licenses of the
|
|
29
|
-
packages bundled into it.
|
|
30
|
-
|
|
31
|
-
Not affiliated with or endorsed by GitHub. GitHub is a trademark of GitHub, Inc.
|
|
32
|
-
|
|
33
|
-
Source, demo and a self-hosted version: https://github.com/armanckeser/github-stars-organizer
|
|
16
|
+
Copyright (C) 2026 Armanc Keser. AGPL-3.0-or-later, with absolutely no warranty. Bundled licenses are in `dist/THIRD-PARTY-LICENSES.txt`. Not affiliated with or endorsed by GitHub.
|
|
@@ -1853,6 +1853,32 @@ The above copyright notice and this permission notice (including the next paragr
|
|
|
1853
1853
|
|
|
1854
1854
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1855
1855
|
|
|
1856
|
+
------------------------------------------------------------------------
|
|
1857
|
+
sonner@2.0.8
|
|
1858
|
+
License: MIT
|
|
1859
|
+
|
|
1860
|
+
MIT License
|
|
1861
|
+
|
|
1862
|
+
Copyright (c) 2023 Emil Kowalski
|
|
1863
|
+
|
|
1864
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1865
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
1866
|
+
in the Software without restriction, including without limitation the rights
|
|
1867
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1868
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
1869
|
+
furnished to do so, subject to the following conditions:
|
|
1870
|
+
|
|
1871
|
+
The above copyright notice and this permission notice shall be included in all
|
|
1872
|
+
copies or substantial portions of the Software.
|
|
1873
|
+
|
|
1874
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1875
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1876
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1877
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1878
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1879
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1880
|
+
SOFTWARE.
|
|
1881
|
+
|
|
1856
1882
|
------------------------------------------------------------------------
|
|
1857
1883
|
tailwind-merge@3.5.0
|
|
1858
1884
|
License: MIT
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{K as e,it as t,nt as n,st as r,t as i}from"./button-C0MQwO-R.js";import{a,c as o,d as s,f as c,i as l,l as u,n as d,o as f,p,r as m,s as h,t as g,u as _}from"./local-backups-BGSAd5Gu.js";import{t as v}from"./history-OZ9l4TiG.js";var y=r(t()),b=n(),x={launch:`On launch`,manual:`Backed up by hand`,"before-restore":`Before a restore`,uploaded:`From a file`},S=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function C(e){return e instanceof Error?e.message:String(e)}function w(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function T(){return(0,b.jsx)(E,{})}function E(){let[t,n]=(0,y.useState)(null),[r,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(!1),[u,f]=(0,y.useState)(null),m=(0,y.useRef)(null);async function h(){n(await e.listBackups())}(0,y.useEffect)(()=>{h().catch(e=>a(`Couldn't read the backups: ${C(e)}`))},[]);async function _(e,t){s(!0),a(e);try{a(await t()),await h()}catch(e){a(C(e))}finally{s(!1)}}function T(){_(`Backing up...`,async()=>{let e=await g();return`Backed up ${w(e.stars,`star`)} and ${w(e.lists,`List`)}, with your tags, ratings and notes.`})}function E(e){e&&_(`Reading ${e.name}...`,async()=>(f(await l(e)),`Kept a copy of ${e.name}.`))}return(0,b.jsxs)(`div`,{className:`max-w-3xl space-y-6`,children:[(0,b.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`space-y-1`,children:[(0,b.jsx)(`h1`,{className:`font-display text-2xl font-bold tracking-tight`,children:`Backups`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Each launch backs up your stars and Lists before the app can change anything. A restore only adds back what is missing: it never unstars a repo or deletes a List.`}),t&&(0,b.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Saved in `,(0,b.jsx)(`code`,{children:t.directory})]})]}),(0,b.jsx)(i,{onClick:T,disabled:o,children:`Back up now`})]}),r&&(0,b.jsx)(`p`,{role:`status`,className:`text-sm`,children:r}),(0,b.jsxs)(`ul`,{className:`divide-y divide-border rounded-lg border border-border`,children:[t?.backups.length===0&&(0,b.jsx)(`li`,{className:`p-4 text-sm text-muted-foreground`,children:`No backups yet.`}),t?.backups.map(e=>(0,b.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 p-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium`,children:S.format(new Date(e.createdAt))}),(0,b.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[x[e.reason],` · `,w(e.stars,`star`),` · `,w(e.lists,`List`)]})]}),(0,b.jsxs)(i,{variant:`ghost`,size:`sm`,disabled:o,onClick:()=>void _(`Preparing the file...`,async()=>(await d(e),`Downloaded.`)),children:[(0,b.jsx)(p,{className:`mr-1.5 size-4`}),`Download`]}),(0,b.jsxs)(i,{variant:`outline`,size:`sm`,disabled:o,onClick:()=>f(e),children:[(0,b.jsx)(v,{className:`mr-1.5 size-4`}),`Restore...`]})]},e.id))]}),(0,b.jsxs)(`section`,{className:`space-y-2`,children:[(0,b.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Restore from a file`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`A backup you downloaded, from this computer or another. You see what it would change before anything does.`}),(0,b.jsx)(`input`,{ref:m,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{E(e.target.files?.[0]),e.target.value=``}}),(0,b.jsxs)(i,{variant:`outline`,size:`sm`,disabled:o,onClick:()=>m.current?.click(),children:[(0,b.jsx)(c,{className:`mr-1.5 size-4`}),`Choose a file`]})]}),u&&(0,b.jsx)(k,{backup:u,onClose:()=>f(null),onRestored:()=>void h()})]})}var D=5;function O({names:e}){let t=e.length-D;return(0,b.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[e.slice(0,D).join(`, `),t>0&&`, and ${t} more`]})}function k({backup:t,onClose:n,onRestored:r}){let[c,l]=(0,y.useState)({step:`planning`});(0,y.useEffect)(()=>{Promise.all([e.planRestore({backupId:t.id}),e.readBackup(t.id)]).then(([e,t])=>l({step:`review`,plan:e,hasLocal:t.local!==void 0})).catch(e=>l({step:`failed`,message:C(e)}))},[t.id]);async function d(){l({step:`applying`});try{l({step:`done`,result:await m(t)}),r()}catch(e){l({step:`failed`,message:C(e)})}}return(0,b.jsx)(f,{open:!0,onOpenChange:e=>{!e&&c.step!==`applying`&&n()},children:(0,b.jsxs)(h,{children:[(0,b.jsxs)(_,{children:[(0,b.jsxs)(s,{children:[`Restore the backup from `,S.format(new Date(t.createdAt))]}),(0,b.jsx)(o,{children:`Only adds what GitHub is missing. Nothing you starred or made since is touched.`})]}),(0,b.jsx)(A,{state:c}),(0,b.jsxs)(u,{children:[c.step===`review`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(i,{variant:`ghost`,onClick:n,children:`Cancel`}),(0,b.jsx)(i,{onClick:()=>void d(),disabled:a(c.plan)===0&&!c.hasLocal,children:`Restore`})]}),(c.step===`done`||c.step===`failed`)&&(0,b.jsx)(i,{onClick:n,children:`Close`})]})]})})}function A({state:e}){switch(e.step){case`planning`:return(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Comparing the backup with GitHub...`});case`applying`:return(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Restoring. Leave this open until it finishes.`});case`failed`:return(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:e.message});case`review`:return(0,b.jsx)(j,{plan:e.plan,hasLocal:e.hasLocal});case`done`:return(0,b.jsx)(N,{result:e.result})}}function j({plan:e,hasLocal:t}){let n=new Set(e.addToLists.map(e=>e.repo.fullName));return a(e)===0?(0,b.jsxs)(`p`,{className:`text-sm`,children:[`GitHub already has every star and List in this backup.`,t&&` Restoring fills in any tags, ratings and notes this browser is missing.`]}):(0,b.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[e.restar.length>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`p`,{children:[`Star `,w(e.restar.length,`repo`),` again. GitHub dates them today, so they move to the top.`]}),(0,b.jsx)(O,{names:e.restar.map(e=>e.fullName)})]}),e.recreateLists.length>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`p`,{children:[`Recreate `,w(e.recreateLists.length,`List`),`.`]}),(0,b.jsx)(O,{names:e.recreateLists.map(e=>e.isPrivate?`${e.name} (private)`:e.name)})]}),n.size>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`p`,{children:[`Put `,w(n.size,`repo`),` back in their Lists.`]}),(0,b.jsx)(O,{names:[...n]})]}),t&&(0,b.jsx)(`p`,{children:`Fill in tags, ratings and notes this browser is missing. Nothing you have is overwritten.`}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`A backup of how things are now is taken first, so you can go back.`})]})}function M(e){let t=[e.notesAndRatings>0&&`notes or ratings on ${w(e.notesAndRatings,`repo`)}`,e.tagLinks>0&&w(e.tagLinks,`tag`)].filter(e=>e!==!1);return t.length===0?`This browser already had every tag, rating and note.`:`Filled in ${t.join(` and `)}.`}function N({result:e}){return(0,b.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,b.jsxs)(`p`,{children:[`Starred `,w(e.restarred,`repo`),` again, recreated `,w(e.recreatedLists,`List`),`, and re-added`,` `,w(e.addedToLists,`List entry`,`List entries`),`.`,e.local&&` ${M(e.local)}`]}),e.failed.length>0&&(0,b.jsxs)(`div`,{className:`rounded-md border border-destructive/40 p-2`,children:[(0,b.jsxs)(`p`,{className:`font-medium text-destructive`,children:[`GitHub refused `,w(e.failed.length,`change`),`:`]}),(0,b.jsx)(`ul`,{className:`mt-1 space-y-0.5 text-xs`,children:e.failed.map(e=>(0,b.jsxs)(`li`,{children:[e.what,`: `,e.reason]},e.what))})]})]})}export{T as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as e,a as t,m as n,n as r,r as i}from"./button-
|
|
1
|
+
import{R as e,a as t,m as n,n as r,r as i}from"./button-C0MQwO-R.js";var a=e(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]);function o(e){return t(e.defaultTagName??`div`,e,e)}var s=i(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function c({className:e,variant:t=`default`,render:i,...a}){return o({defaultTagName:`span`,props:n({className:r(s({variant:t}),e)},a),render:i,state:{slot:`badge`,variant:t}})}export{a as n,c as t};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/esm-Cyyp48ez.js","assets/sync-persistence-f8LlQoHO.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{A as e,D as t,E as n,P as r,_ as i,b as a,f as o,g as s,h as c,j as l,m as u,n as d,r as f,v as p}from"./sync-persistence-f8LlQoHO.js";var m=Object.create,h=Object.defineProperty,g=Object.getOwnPropertyDescriptor,_=Object.getOwnPropertyNames,v=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty,b=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),x=(e,t)=>{let n={};for(var r in e)h(n,r,{get:e[r],enumerable:!0});return t||h(n,Symbol.toStringTag,{value:`Module`}),n},S=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=_(t),a=0,o=i.length,s;a<o;a++)s=i[a],!y.call(e,s)&&s!==n&&h(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=g(t,s))||r.enumerable});return e},C=(e,t,n)=>(n=e==null?{}:m(v(e)),S(t||!e||!e.__esModule?h(n,`default`,{value:e,enumerable:!0}):n,e)),w=b((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ee(e,t){return E(e.type,t,e.props)}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var te=/\/+/g;function ne(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function k(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function A(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,A(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ne(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(te,`$&/`)+`/`),A(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=ee(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(te,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+ne(a,u),c+=A(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+ne(a,u++),c+=A(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return A(k(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function j(e,t,n){if(e==null)return e;var r=[],i=0;return A(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function re(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var M=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},ie={map:j,forEach:function(e,t,n){j(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return j(e,function(){t++}),t},toArray:function(e){return j(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ie,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:re}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,M)}catch(e){M(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.5`})),T=b(((e,t)=>{t.exports=w()})),E=b((e=>{var t=T();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.5`})),ee=b(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=E()})),D=b((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),O=b(((e,t)=>{t.exports=D()})),te=b((e=>{var t=T();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),ne=b(((e,t)=>{t.exports=te()})),k=b((e=>{var t=T(),n=ne();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),A=b(((e,t)=>{t.exports=k()})),j=C(T(),1),re=C(ee(),1);function M(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var ie=e=>{switch(e){case`success`:return se;case`info`:return P;case`warning`:return N;case`error`:return ce;default:return null}},ae=Array(12).fill(0),oe=({visible:e,className:t})=>j.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},j.createElement(`div`,{className:`sonner-spinner`},ae.map((e,t)=>j.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),se=j.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},j.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),N=j.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},j.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),P=j.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},j.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),ce=j.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},j.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),F=j.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},j.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),j.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),I=()=>{let[e,t]=j.useState(document.hidden);return j.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e},le=1,ue=100,de=e=>typeof e?.id==`number`||e?.id?.length>0?e.id:le++,L=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-ue;e<=0||(this.toasts=this.toasts.filter(t=>e>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),e--,!1):!0))},this.create=e=>{let{message:t,...n}=e,r=de(e),i=this.pendingDismissals.get(r);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(r),this.dismissedToasts.delete(r));let a=this.dismissedToasts.has(r),o=e.dismissible===void 0?!0:e.dismissible;return a&&(this.dismissedToasts.delete(r),this.toasts=this.toasts.filter(e=>e.id!==r)),!a&&this.toasts.find(e=>e.id===r)?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:o,title:t}):n):this.addToast({title:t,...n,dismissible:o,id:r}),r},this.dismiss=e=>{if(e==null)return this.getActiveToasts().forEach(e=>{this.dismissedToasts.add(e.id),this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);let t=this.pendingDismissals.get(e);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(t=>t({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],j.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(pe(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!j.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!j.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!j.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!j.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=de(t);return this.create({...t,jsx:e(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},fe=(e,t)=>L.message(e,t),pe=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,me=Object.assign(fe,{success:L.success,info:L.info,warning:L.warning,error:L.error,custom:L.custom,message:L.message,promise:L.promise,dismiss:L.dismiss,loading:L.loading},{getHistory:()=>L.toasts,getToasts:()=>L.getActiveToasts()});M(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function he(e){return e.label!==void 0}var ge=3,R=`24px`,_e=`16px`,ve=4e3,ye=356,be=14,xe=45,Se=200;function Ce(...e){return e.filter(Boolean).join(` `)}function we(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Te=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:T=`Close toast`}=e,[E,ee]=j.useState(null),[D,O]=j.useState(null),[te,ne]=j.useState(!1),[k,A]=j.useState(!1),[re,M]=j.useState(!1),[ae,se]=j.useState(!1),[N,P]=j.useState(!1),[ce,le]=j.useState(0),[ue,de]=j.useState(0),L=j.useRef(n.duration||y||ve),fe=j.useRef(null),pe=j.useRef(null),me=c===0,ge=c+1<=o,R=n.type,_e=R??`default`,ye=n.dismissible!==!1,be=n.className||``,Te=n.descriptionClassName||``,Ee=j.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),De=j.useMemo(()=>n.closeButton??p,[n.closeButton,p]),Oe=j.useMemo(()=>n.duration||y||ve,[n.duration,y]),ke=j.useRef(0),Ae=j.useRef(0),je=j.useRef(0),Me=j.useRef(null),[Ne,Pe]=b.split(`-`),Fe=j.useMemo(()=>s.reduce((e,t,n)=>n>=Ee?e:e+t.height,0),[s,Ee]),Ie=I(),z=j.useMemo(()=>e.swipeDirections??we(b),[e.swipeDirections,b]),Le=n.invert||t,Re=R===`loading`;Ae.current=j.useMemo(()=>Ee*x+Fe,[Ee,Fe]),j.useEffect(()=>{L.current=Oe},[Oe]),j.useEffect(()=>{ne(!0)},[]),j.useEffect(()=>{let e=pe.current;if(e){let t=e.getBoundingClientRect().height;return de(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),j.useLayoutEffect(()=>{if(!te)return;let e=pe.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,de(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[te,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let B=j.useCallback(()=>{A(!0),le(Ae.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Se)},[n,d,a,Ae]);j.useEffect(()=>{if(n.promise&&R===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||Ie?(()=>{if(je.current<ke.current){let e=new Date().getTime()-ke.current;L.current-=e}je.current=new Date().getTime()})():L.current!==1/0&&(ke.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),B()},L.current)),()=>clearTimeout(e)},[u,i,n,R,Ie,B]),j.useEffect(()=>{n.delete&&(B(),n.onDismiss==null||n.onDismiss.call(n,n))},[B,n.delete]);function V(){return w?.loading?j.createElement(`div`,{className:Ce(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":R===`loading`},w.loading):j.createElement(oe,{className:Ce(C?.loader,n?.classNames?.loader),visible:R===`loading`})}let ze=n.icon||w?.[R]||ie(R);return j.createElement(`li`,{tabIndex:0,ref:pe,className:Ce(_,be,C?.toast,n?.classNames?.toast,C?.[_e],n?.classNames?.[_e]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":te,"data-promise":!!n.promise,"data-swiped":N,"data-removed":k,"data-visible":ge,"data-y-position":Ne,"data-x-position":Pe,"data-index":c,"data-front":me,"data-swiping":re,"data-dismissible":ye,"data-type":R,"data-invert":Le,"data-swipe-out":ae,"data-swipe-direction":D,"data-expanded":!!(u||S&&te),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${k?ce:Ae.current}px`,"--initial-height":S?`auto`:`${ue}px`,...m,...n.style},onDragEnd:()=>{M(!1),ee(null),Me.current=null},onPointerDown:e=>{e.button!==2&&(Re||!ye||(fe.current=new Date,le(Ae.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(M(!0),Me.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(ae||!ye)return;Me.current=null;let e=Number(pe.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(pe.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-fe.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if((E===`x`?z.includes(e>0?`right`:`left`):z.includes(t>0?`bottom`:`top`))&&(Math.abs(i)>=xe||a>.11)){le(Ae.current),n.onDismiss==null||n.onDismiss.call(n,n),O(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),B(),se(!0);return}else{var o,s;(o=pe.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=pe.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}P(!1),M(!1),ee(null)},onPointerMove:e=>{var t,n;if(!Me.current||!ye||window.getSelection()?.toString().length>0)return;let r=e.clientY-Me.current.y,i=e.clientX-Me.current.x;!E&&(Math.abs(i)>1||Math.abs(r)>1)&&ee(Math.abs(i)>Math.abs(r)?`x`:`y`);let a={x:0,y:0},o=e=>1/(1.5+Math.abs(e)/20);if(E===`y`){if(z.includes(`top`)||z.includes(`bottom`))if(z.includes(`top`)&&r<0||z.includes(`bottom`)&&r>0)a.y=r;else{let e=r*o(r);a.y=Math.abs(e)<Math.abs(r)?e:r}}else if(E===`x`&&(z.includes(`left`)||z.includes(`right`)))if(z.includes(`left`)&&i<0||z.includes(`right`)&&i>0)a.x=i;else{let e=i*o(i);a.x=Math.abs(e)<Math.abs(i)?e:i}(Math.abs(a.x)>0||Math.abs(a.y)>0)&&P(!0),(t=pe.current)==null||t.style.setProperty(`--swipe-amount-x`,`${a.x}px`),(n=pe.current)==null||n.style.setProperty(`--swipe-amount-y`,`${a.y}px`)}},De&&!n.jsx&&R!==`loading`?j.createElement(`button`,{"aria-label":T,"data-disabled":Re,"data-close-button":!0,onClick:Re||!ye?()=>{}:()=>{B(),n.onDismiss==null||n.onDismiss.call(n,n)},className:Ce(C?.closeButton,n?.classNames?.closeButton)},w?.close??F):null,(R||n.icon||n.promise)&&n.icon!==null&&(w?.[R]!==null||n.icon)?j.createElement(`div`,{"data-icon":``,className:Ce(C?.icon,n?.classNames?.icon)},R===`loading`?n.icon||V():n.promise?V():null,R===`loading`?null:ze):null,j.createElement(`div`,{"data-content":``,className:Ce(C?.content,n?.classNames?.content)},j.createElement(`div`,{"data-title":``,className:Ce(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?j.createElement(`div`,{"data-description":``,className:Ce(v,Te,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),j.isValidElement(n.cancel)?n.cancel:n.cancel&&he(n.cancel)?j.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{he(n.cancel)&&ye&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),B())},className:Ce(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,j.isValidElement(n.action)?n.action:n.action&&he(n.action)?j.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{he(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&B())},className:Ce(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function Ee(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function De(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?_e:R;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var Oe=j.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=ge,toastOptions:g,dir:_=Ee(),gap:v=be,icons:y,customAriaLabel:b,containerAriaLabel:x=`Notifications`}=e,[S,C]=j.useState([]),w=j.useMemo(()=>n?S.filter(e=>e.toasterId===n):S.filter(e=>!e.toasterId),[S,n]),T=j.useMemo(()=>Array.from(new Set([i].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,i]),[E,ee]=j.useState([]),[D,O]=j.useState(!1),[te,ne]=j.useState(!1),[k,A]=j.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),M=j.useRef(null),ie=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),ae=j.useRef(null),oe=j.useRef(!1),se=j.useCallback(e=>{C(t=>(t.find(t=>t.id===e.id)?.delete||L.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return j.useEffect(()=>L.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{re.flushSync(()=>{C(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),j.useEffect(()=>{if(d!==`system`){A(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?A(`dark`):A(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{A(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{A(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),j.useEffect(()=>{S.length<=1&&O(!1)},[S]),j.useEffect(()=>{let e=e=>{if(a.length>0&&a.every(t=>e[t]||e.code===t)){var t;O(!0),(t=M.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===M.current||M.current?.contains(document.activeElement))&&O(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),j.useEffect(()=>{if(M.current)return()=>{ae.current&&(ae.current.focus({preventScroll:!0}),ae.current=null,oe.current=!1)}},[M.current]),j.createElement(`section`,{ref:t,"aria-label":b??`${x} ${ie}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},T.map((t,n)=>{let[i,a]=t.split(`-`);return w.length?j.createElement(`ol`,{key:t,dir:_===`auto`?Ee():_,tabIndex:-1,ref:M,className:c,"data-sonner-toaster":!0,"data-sonner-theme":k,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${E[0]?.height||0}px`,"--width":`${ye}px`,"--gap":`${v}px`,...m,...De(l,u)},onBlur:e=>{oe.current&&!e.currentTarget.contains(e.relatedTarget)&&(oe.current=!1,ae.current&&=(ae.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||oe.current||(oe.current=!0,ae.current=e.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{te||O(!1)},onDragEnd:()=>O(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||ne(!0)},onPointerUp:()=>ne(!1)},w.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>j.createElement(Te,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:te,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:se,toasts:w.filter(e=>e.position==n.position),heights:E.filter(e=>e.position==n.position),setHeights:ee,expandByDefault:o,gap:v,expanded:D,swipeDirections:e.swipeDirections}))):null}))});function ke(e){let{initialData:t,onInsert:n,onUpdate:i,onDelete:a,id:o,...s}=e,c=o??r(),l=new Set;n||l.add(`insert`),i||l.add(`update`),a||l.add(`delete`);let u=Ae(t,l),d=async e=>{let t;return n&&(t=await n(e)??{}),u.confirmOperationsSync(e.transaction.mutations),t},p=async e=>{let t;return i&&(t=await i(e)??{}),u.confirmOperationsSync(e.transaction.mutations),t},m=async e=>{let t;return a&&(t=await a(e)??{}),u.confirmOperationsSync(e.transaction.mutations),t},h=e=>{let t=e.mutations.filter(e=>e.collection.id===c);t.length!==0&&u.confirmOperationsSync(t)};return f({...s,id:c,sync:u.sync,onInsert:d,onUpdate:p,onDelete:m,utils:{acceptMutations:h},startSync:!0,gcTime:0},()=>ke({...e,id:c}))}function Ae(e,t){let n=null,r=null,i=null,a=null,o={rowUpdateMode:`full`,sync:o=>{let{begin:c,write:l,commit:u,markReady:d}=o;if(n=c,r=l,i=u,a=o.collection,o.collection._state.isLocalOnly=!0,o.collection._state.localOnlyDirectWrite={types:t,write:s},e&&e.length>0){for(let t of e){let e=o.collection.getKeyFromItem(t);o.collection._state.pendingLocalChanges.add(e)}c(),e.forEach(e=>{l({type:`insert`,value:e})}),u()}return d(),()=>{}},getSyncMetadata:()=>({})},s=e=>{!n||!r||!i||(n(),e.forEach(e=>{r&&r({type:e.type,value:e.modified})}),i())};return{sync:o,confirmOperationsSync:s,collection:a}}var je=class{constructor(e){this.options=e,this.completed=new Set,this.ez=new Map,this.generation=0,this.loadSubset=e=>{let t=o(e);if(!e.refetch&&this.completed.has(t))return this.options.onDeduplicate?.(e),!0;let n=e.signal||e.refetch?void 0:this.ez.get(t);if(n)return n.then(()=>this.options.onDeduplicate?.(e)).catch(()=>{}),n;let r=this.generation,i=this.options.loadSubset(e);if(i===!0)return r===this.generation&&!e.signal?.aborted&&this.completed.add(t),!0;let a=i.then(n=>(r===this.generation&&!e.signal?.aborted&&this.completed.add(t),n)).finally(()=>{this.ez.get(t)===a&&this.ez.delete(t)});return!e.signal&&r===this.generation&&this.ez.set(t,a),a}}reset(){this.completed.clear(),this.ez.clear(),this.generation++}},Me=Object.defineProperty,Ne=Object.defineProperties,Pe=Object.getOwnPropertyDescriptors,Fe=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,Le=e=>{throw TypeError(e)},Re=(e,t,n)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,B=(e,t)=>{for(var n in t||={})Ie.call(t,n)&&Re(e,n,t[n]);if(Fe)for(var n of Fe(t))z.call(t,n)&&Re(e,n,t[n]);return e},V=(e,t)=>Ne(e,Pe(t)),ze=(e,t)=>{var n={};for(var r in e)Ie.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Fe)for(var r of Fe(e))t.indexOf(r)<0&&z.call(e,r)&&(n[r]=e[r]);return n},Be=(e,t,n)=>t.has(e)||Le(`Cannot `+n),H=(e,t,n)=>(Be(e,t,`read from private field`),n?n.call(e):t.get(e)),U=(e,t,n)=>t.has(e)?Le(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),W=(e,t,n,r)=>(Be(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),G=(e,t,n)=>(Be(e,t,`access private method`),n),Ve=(e,t,n,r)=>({set _(r){W(e,t,r,n)},get _(){return H(e,t,r)}}),K=class e extends Error{constructor(e,t,n,r,i,a){super(a||`HTTP Error ${e} at ${i}: ${t??JSON.stringify(n)}`),this.url=i,this.name=`FetchError`,this.status=e,this.text=t,this.json=n,this.headers=r}static async fromResponse(t,n){let r=t.status,i=Object.fromEntries([...t.headers.entries()]),a,o,s=t.headers.get(`content-type`);return t.bodyUsed||(s&&s.includes(`application/json`)?o=await t.json():a=await t.text()),new e(r,a,o,i,n)}},He=class extends Error{constructor(){super(`Fetch with backoff aborted`),this.name=`FetchBackoffAbortError`}},Ue=class extends Error{constructor(){super(`Invalid shape options: missing required url parameter`),this.name=`MissingShapeUrlError`}},We=class extends Error{constructor(){super(`Invalid signal option. It must be an instance of AbortSignal.`),this.name=`InvalidSignalError`}},Ge=class extends Error{constructor(){super(`shapeHandle is required if this isn't an initial fetch (i.e. offset > -1)`),this.name=`MissingShapeHandleError`}},Ke=class extends Error{constructor(e){super(`Cannot use reserved Electric parameter names in custom params: ${e.join(`, `)}`),this.name=`ReservedParamError`}},qe=class extends Error{constructor(e){super(`Column "${e??`unknown`}" does not allow NULL values`),this.name=`ParserNullValueError`}},Je=class extends Error{constructor(e,t){let n=`The response for the shape request to ${e} didn't include the following required headers:
|
|
3
|
+
`;t.forEach(e=>{n+=`- ${e}
|
|
4
|
+
`}),n+=`
|
|
5
|
+
This is often due to a proxy not setting CORS correctly so that all Electric headers can be read by the client.`,n+=`
|
|
6
|
+
For more information visit the troubleshooting guide: /docs/guides/troubleshooting/missing-headers`,super(n)}},Ye=class extends Error{constructor(e){super(e),this.name=`StaleCacheError`}},Xe=e=>Number(e),Ze=e=>e===`true`||e===`t`,Qe=e=>BigInt(e),$e=e=>JSON.parse(e),et=e=>e,tt={int2:Xe,int4:Xe,int8:Qe,bool:Ze,float4:Xe,float8:Xe,json:$e,jsonb:$e};function nt(e,t){let n=0,r=null,i=``,a=!1,o=0,s;function c(e,n,r){let i=e.slice(n,r);return i=i===`NULL`?null:i,t?t(i):i}function l(e){let u=[];for(;n<e.length;n++){if(r=e[n],a)r===`\\`?i+=e[++n]:r===`"`?(u.push(t?t(i):i),i=``,a=e[n+1]===`"`,o=n+2):i+=r;else if(r===`"`)a=!0;else if(r===`{`)o=++n,u.push(l(e));else if(r===`}`){a=!1,o<n&&u.push(c(e,o,n)),o=n+1;break}else r===`,`&&s!==`}`&&s!==`"`&&(u.push(c(e,o,n)),o=n+1);s=r}return o<n&&u.push(u.push(c(e,o,n+1))),u}return l(e)[0]}var rt=class{constructor(e,t){this.parser=B(B({},tt),e),this.transformer=t}parse(e,t){return JSON.parse(e,(e,n)=>(e===`value`||e===`old_value`)&&typeof n==`object`&&n?this.transformMessageValue(n,t):n)}parseSnapshotData(e,t){return e.map(e=>{let n=e;return n.value&&typeof n.value==`object`&&n.value!==null&&(n.value=this.transformMessageValue(n.value,t)),n.old_value&&typeof n.old_value==`object`&&n.old_value!==null&&(n.old_value=this.transformMessageValue(n.old_value,t)),n})}transformMessageValue(e,t){let n=e;return Object.keys(n).forEach(e=>{n[e]=this.parseRow(e,n[e],t)}),this.transformer?this.transformer(n):n}parseRow(e,t,n){let r=n[e];if(!r)return t;let i=r,{type:a,dims:o}=i,s=ze(i,[`type`,`dims`]),c=it(this.parser[a]??et,r,e);return o&&o>0?it((e,t)=>nt(e,c),r,e)(t):c(t,s)}};function it(e,t,n){let r=!(t.not_null??!1);return i=>{if(i===null){if(!r)throw new qe(n??`unknown`);return null}return e(i,t)}}function at(e){return`"${e.replace(/"/g,`""`)}"`}function ot(e,t){if(!e||!t)return e??``;let n=new Set(`SELECT.FROM.WHERE.AND.OR.NOT.IN.IS.NULL.NULLS.FIRST.LAST.TRUE.FALSE.LIKE.ILIKE.BETWEEN.ASC.DESC.LIMIT.OFFSET.ORDER.BY.GROUP.HAVING.DISTINCT.AS.ON.JOIN.LEFT.RIGHT.INNER.OUTER.CROSS.CASE.WHEN.THEN.ELSE.END.CAST.LOWER.UPPER.COALESCE.NULLIF`.split(`.`)),r=[],i=0;for(;i<e.length;){let t=e[i];if(t===`'`||t===`"`){let n=i,a=t;for(i++;i<e.length;)if(e[i]===a)if(e[i+1]===a)i+=2;else{i++;break}else i++;r.push({start:n,end:i})}else i++}let a=e=>r.some(t=>e>=t.start&&e<t.end),o=RegExp(`(?<![a-zA-Z0-9_])([a-zA-Z_][a-zA-Z0-9_]*)(?![a-zA-Z0-9_])`,`g`);return e.replace(o,(e,r,i)=>a(i)||n.has(e.toUpperCase())||e.startsWith(`$`)?e:t(e))}function st(e){return e!=null&&`key`in e}function ct(e){return e!=null&&`headers`in e&&`control`in e.headers}function lt(e){return ct(e)&&e.headers.control===`up-to-date`}function ut(e){if(e.headers.control!=`up-to-date`)return;let t=e.headers.global_last_seen_lsn;return t?`${t}_0`:void 0}function dt(e,t){return typeof t==`bigint`?t.toString():t}function ft(e){return JSON.stringify(e,dt)}function pt(e,t){let n=BigInt(e),r=BigInt(t.xmin),i=BigInt(t.xmax),a=t.xip_list.map(BigInt);return n<r||n<i&&!a.includes(n)}var mt=`electric-cursor`,ht=`electric-handle`,gt=`electric-offset`,_t=`electric-schema`,vt=`electric-up-to-date`,yt=`columns`,bt=`cursor`,xt=`expired_handle`,St=`handle`,Ct=`live`,wt=`offset`,Tt=`table`,Et=`where`,Dt=`replica`,Ot=`params`,kt=`experimental_live_sse`,At=`live_sse`,jt=`force-disconnect-and-refresh`,Mt=`pause-stream`,Nt=`system-wake`,Pt=`log`,Ft=`subset__where`,It=`subset__limit`,Lt=`subset__offset`,Rt=`subset__order_by`,zt=`subset__params`,Bt=`subset__where_expr`,Vt=`subset__order_by_expr`,Ht=`cache-buster`,Ut=[Ct,At,kt,St,wt,bt,xt,Pt,Ft,It,Lt,Rt,zt,Bt,Vt,Ht],Wt=[429],Gt={initialDelay:1e3,maxDelay:32e3,multiplier:2,maxRetries:1/0};function Kt(e){if(!e)return 0;let t=Number(e);if(Number.isFinite(t)&&t>0)return t*1e3;let n=Date.parse(e);if(!isNaN(n)){let e=n-Date.now();return Math.max(0,Math.min(e,36e5))}return 0}function qt(e,t=Gt){let{initialDelay:n,maxDelay:r,multiplier:i,debug:a=!1,onFailedAttempt:o,maxRetries:s=1/0}=t;return async(...t)=>{let c=t[0],l=t[1],u=n,d=0;for(;;)try{let n=await e(...t);if(n.ok)return n;throw await K.fromResponse(n,c.toString())}catch(e){if(o?.(),l?.signal?.aborted)throw new He;if(e instanceof K&&!Wt.includes(e.status)&&e.status>=400&&e.status<500)throw e;{if(d++,d>s)throw a&&console.log(`Max retries reached (${d}/${s}), giving up`),e;let t=e instanceof K&&e.headers?Kt(e.headers[`retry-after`]):0,n=Math.random()*u,o=Math.min(n,r),c=Math.max(t,o);a&&console.log(`Retry attempt #${d} after ${c}ms (${t>0?`server+client`:`client`}, serverMin=${t}ms, clientBackoff=${o}ms)`),await new Promise(e=>setTimeout(e,c)),u=Math.min(u*i,r)}}}}var Jt=[201,204,205];function Yt(e){return async(...t)=>{let n=t[0],r=await e(...t);try{if(r.status<200||Jt.includes(r.status))return r;let e=await r.text();return new Response(e,r)}catch(e){throw t[1]?.signal?.aborted?new He:new K(r.status,void 0,void 0,Object.fromEntries([...r.headers.entries()]),n.toString(),e instanceof Error?e.message:typeof e==`string`?e:`failed to read body`)}}}var Xt={maxChunksToPrefetch:2};function Zt(e,t=Xt){let{maxChunksToPrefetch:n}=t,r;return async(...t)=>{let i=t[0].toString();if(mn(t[0],t[1])!==`GET`)return r?.abort(),r=void 0,e(...t);let a=r?.consume(...t);if(a)return a;r?.abort(),r=void 0;let o=await e(...t),s=dn(i,o);return s&&(r=new un({fetchClient:e,maxPrefetchedRequests:n,url:s,requestInit:t[1]})),o}}var Qt=[gt,ht],$t=[mt],en=[_t];function tn(e){return async(...t)=>{let n=await e(...t);if(n.ok){let e=n.headers,r=[],i=t=>r.push(...t.filter(t=>!e.has(t))),a=t[0].toString(),o=new URL(a);if([Ft,zt,It,Lt,Rt].some(e=>o.searchParams.has(e)))return n;if(i(Qt),o.searchParams.get(Ct)===`true`&&i($t),(!o.searchParams.has(Ct)||o.searchParams.get(Ct)===`false`)&&i(en),r.length>0)throw new Je(a,r)}return n}}var nn,rn,an,on,sn,cn,ln,un=class{constructor(e){U(this,cn),U(this,nn),U(this,rn),U(this,an,new Map),U(this,on),U(this,sn),W(this,nn,e.fetchClient??((...e)=>fetch(...e))),W(this,rn,e.maxPrefetchedRequests),W(this,on,e.url.toString()),W(this,sn,H(this,on)),G(this,cn,ln).call(this,e.url,e.requestInit)}abort(){H(this,an).forEach(([e,t])=>t.abort()),H(this,an).clear()}consume(...e){let t=e[0].toString(),n=H(this,an).get(t);if(!n||t!==H(this,on))return;let[r,i]=n;if(i.signal.aborted){H(this,an).delete(t);return}return H(this,an).delete(t),r.then(n=>{let r=dn(t,n);W(this,on,r),H(this,sn)&&!H(this,an).has(H(this,sn))&&G(this,cn,ln).call(this,H(this,sn),e[1])}).catch(()=>{}),r}};nn=new WeakMap,rn=new WeakMap,an=new WeakMap,on=new WeakMap,sn=new WeakMap,cn=new WeakSet,ln=function(...e){let t=e[0].toString();if(H(this,an).size>=H(this,rn))return;let n=new AbortController;try{let{signal:r,cleanup:i}=fn(n,e[1]?.signal),a=H(this,nn).call(this,t,V(B({},e[1]??{}),{signal:r}));H(this,an).set(t,[a,n]),a.then(r=>{if(!r.ok||n.signal.aborted)return;let i=dn(t,r);if(!i||i===t){W(this,sn,void 0);return}return W(this,sn,i),G(this,cn,ln).call(this,i,e[1])}).catch(()=>{}).finally(i)}catch{}};function dn(e,t){let n=t.headers.get(ht),r=t.headers.get(gt),i=t.headers.has(vt);if(!n||!r||i)return;let a=new URL(e);if(a.searchParams.has(Ct))return;let o=a.searchParams.get(xt);if(o&&n===o){console.warn(`[Electric] Received stale cached response with expired shape handle. This should not happen and indicates a proxy/CDN caching misconfiguration. The response contained handle "${n}" which was previously marked as expired. Check that your proxy includes all query parameters (especially 'handle' and 'offset') in its cache key. Skipping prefetch to prevent infinite 409 loop.`);return}return a.searchParams.set(St,n),a.searchParams.set(wt,r),a.searchParams.sort(),a.toString()}function fn(e,t){let n=pn;if(t)if(t.aborted)e.abort();else{let r=()=>e.abort();t.addEventListener(`abort`,r,{once:!0,signal:e.signal}),n=()=>t.removeEventListener(`abort`,r)}return{signal:e.signal,cleanup:n}}function pn(){}function mn(e,t){return t?.method?t.method.toUpperCase():typeof Request<`u`&&e instanceof Request?e.method.toUpperCase():`GET`}function hn(e,t){switch(e.type){case`ref`:return at(t?t(e.column):e.column);case`val`:return`$${e.paramIndex}`;case`func`:return gn(e,t);default:throw Error(`Unknown expression type: ${JSON.stringify(e)}`)}}function gn(e,t){let n=e.args.map(e=>hn(e,t));switch(e.name){case`eq`:return`${n[0]} = ${n[1]}`;case`gt`:return`${n[0]} > ${n[1]}`;case`gte`:return`${n[0]} >= ${n[1]}`;case`lt`:return`${n[0]} < ${n[1]}`;case`lte`:return`${n[0]} <= ${n[1]}`;case`and`:return n.map(e=>`(${e})`).join(` AND `);case`or`:return n.map(e=>`(${e})`).join(` OR `);case`not`:return`NOT (${n[0]})`;case`in`:return`${n[0]} = ANY(${n[1]})`;case`like`:return`${n[0]} LIKE ${n[1]}`;case`ilike`:return`${n[0]} ILIKE ${n[1]}`;case`isNull`:case`isUndefined`:return`${n[0]} IS NULL`;case`upper`:return`UPPER(${n[0]})`;case`lower`:return`LOWER(${n[0]})`;case`length`:return`LENGTH(${n[0]})`;case`concat`:return`CONCAT(${n.join(`, `)})`;case`coalesce`:return`COALESCE(${n.join(`, `)})`;default:throw Error(`Unknown function: ${e.name}`)}}function _n(e,t){return e.map(e=>{let n=at(t?t(e.column):e.column);return e.direction===`desc`&&(n+=` DESC`),e.nulls===`first`&&(n+=` NULLS FIRST`),e.nulls===`last`&&(n+=` NULLS LAST`),n}).join(`, `)}async function vn(e,t){let n=e.getReader(),r;for(;!(r=await n.read()).done;)t(r.value)}function yn(e){let t,n,r,i=!1;return function(a){t===void 0?(t=a,n=0,r=-1):t=xn(t,a);let o=t.length,s=0;for(;n<o;){i&&=(t[n]===10&&(s=++n),!1);let a=-1;for(;n<o&&a===-1;++n)switch(t[n]){case 58:r===-1&&(r=n-s);break;case 13:i=!0;case 10:a=n;break}if(a===-1)break;e(t.subarray(s,a),r),s=n,r=-1}s===o?t=void 0:s!==0&&(t=t.subarray(s),n-=s)}}function bn(e,t,n){let r=Sn(),i=new TextDecoder;return function(a,o){if(a.length===0)n?.(r),r=Sn();else if(o>0){let n=i.decode(a.subarray(0,o)),s=o+(a[o+1]===32?2:1),c=i.decode(a.subarray(s));switch(n){case`data`:r.data=r.data?r.data+`
|
|
7
|
+
`+c:c;break;case`event`:r.event=c;break;case`id`:e(r.id=c);break;case`retry`:let n=parseInt(c,10);isNaN(n)||t(r.retry=n);break}}}}function xn(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function Sn(){return{data:``,event:``,id:``,retry:void 0}}var Cn=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},wn=`text/event-stream`,Tn=1e3,En=`last-event-id`;function Dn(e,t){var{signal:n,headers:r,onopen:i,onmessage:a,onclose:o,onerror:s,openWhenHidden:c,fetch:l}=t,u=Cn(t,[`signal`,`headers`,`onopen`,`onmessage`,`onclose`,`onerror`,`openWhenHidden`,`fetch`]);return new Promise((t,d)=>{let f=Object.assign({},r);f.accept||=wn;let p;function m(){p.abort(),typeof document<`u`&&!document.hidden&&b()}typeof document<`u`&&!c&&document.addEventListener(`visibilitychange`,m);let h=Tn,g=0;function _(){typeof document<`u`&&document.removeEventListener(`visibilitychange`,m),clearTimeout(g),p.abort()}n?.addEventListener(`abort`,()=>{_()});let v=l??window.fetch,y=i??On;async function b(){p=new AbortController;let r=n.aborted?n:p.signal;try{let n=await v(e,Object.assign(Object.assign({},u),{headers:f,signal:r}));await y(n),await vn(n.body,yn(bn(e=>{e?f[En]=e:delete f[En]},e=>{h=e},a))),o?.(),_(),t()}catch(e){if(r.aborted)_(),d(e);else if(!p.signal.aborted)try{let t=s?.(e)??h;clearTimeout(g),g=setTimeout(b,t)}catch(e){_(),d(e)}}}b()})}function On(e){let t=e.headers.get(`content-type`);if(!t?.startsWith(wn))throw Error(`Expected content-type to be ${wn}, Actual: ${t}`)}var kn=new class{constructor(){this.data={},this.max=250,this.storageKey=`electric_expired_shapes`,this.load()}getExpiredHandle(e){let t=this.data[e];return t?(t.lastUsed=Date.now(),this.save(),t.expiredHandle):null}markExpired(e,t){this.data[e]={expiredHandle:t,lastUsed:Date.now()};let n=Object.keys(this.data);if(n.length>this.max){let e=n.reduce((e,t)=>this.data[t].lastUsed<this.data[e].lastUsed?t:e);delete this.data[e]}this.save()}save(){if(!(typeof localStorage>`u`))try{localStorage.setItem(this.storageKey,JSON.stringify(this.data))}catch{}}load(){if(!(typeof localStorage>`u`))try{let e=localStorage.getItem(this.storageKey);e&&(this.data=JSON.parse(e))}catch{this.data={}}}clear(){this.data={},this.save()}delete(e){delete this.data[e],this.save()}},An=new class{constructor(){this.data={},this.storageKey=`electric_up_to_date_tracker`,this.cacheTTL=6e4,this.maxEntries=250,this.writeThrottleMs=6e4,this.lastWriteTime=0,this.load(),this.cleanup()}recordUpToDate(e,t){this.data[e]={timestamp:Date.now(),cursor:t};let n=Object.keys(this.data);if(n.length>this.maxEntries){let e=n.reduce((e,t)=>this.data[t].timestamp<this.data[e].timestamp?t:e);delete this.data[e]}this.scheduleSave()}scheduleSave(){let e=Date.now(),t=e-this.lastWriteTime;if(t>=this.writeThrottleMs)this.lastWriteTime=e,this.save();else if(!this.pendingSaveTimer){let e=this.writeThrottleMs-t;this.pendingSaveTimer=setTimeout(()=>{this.lastWriteTime=Date.now(),this.pendingSaveTimer=void 0,this.save()},e)}}shouldEnterReplayMode(e){let t=this.data[e];return!t||Date.now()-t.timestamp>=this.cacheTTL?null:t.cursor}cleanup(){let e=Date.now(),t=Object.keys(this.data),n=!1;for(let r of t)e-this.data[r].timestamp>this.cacheTTL&&(delete this.data[r],n=!0);n&&this.save()}save(){if(!(typeof localStorage>`u`))try{localStorage.setItem(this.storageKey,JSON.stringify(this.data))}catch{}}load(){if(!(typeof localStorage>`u`))try{let e=localStorage.getItem(this.storageKey);e&&(this.data=JSON.parse(e))}catch{this.data={}}}clear(){this.data={},this.pendingSaveTimer&&=(clearTimeout(this.pendingSaveTimer),void 0),this.save()}delete(e){delete this.data[e],this.save()}},jn,Mn,Nn,Pn,Fn=class{constructor(){U(this,jn),this.activeSnapshots=new Map,this.xmaxSnapshots=new Map,this.snapshotsByDatabaseLsn=new Map}addSnapshot(e,t){G(this,jn,Mn).call(this,e.snapshot_mark);let n=BigInt(e.xmax),r=BigInt(e.database_lsn);this.activeSnapshots.set(e.snapshot_mark,{xmin:BigInt(e.xmin),xmax:n,xip_list:e.xip_list.map(BigInt),keys:t,databaseLsn:r}),G(this,jn,Nn).call(this,this.xmaxSnapshots,n,e.snapshot_mark),G(this,jn,Nn).call(this,this.snapshotsByDatabaseLsn,r,e.snapshot_mark)}removeSnapshot(e){G(this,jn,Mn).call(this,e),this.activeSnapshots.delete(e)}shouldRejectMessage(e){let t=e.headers.txids||[];if(t.length===0)return!1;let n=Math.max(...t);for(let[e,t]of this.xmaxSnapshots.entries())if(n>=e)for(let e of t)this.removeSnapshot(e);return[...this.activeSnapshots.values()].some(t=>t.keys.has(e.key)&&pt(n,t))}lastSeenUpdate(e){for(let[t,n]of this.snapshotsByDatabaseLsn.entries())if(t<=e)for(let e of n)this.removeSnapshot(e)}};jn=new WeakSet,Mn=function(e){let t=this.activeSnapshots.get(e);t&&(G(this,jn,Pn).call(this,this.xmaxSnapshots,t.xmax,e),G(this,jn,Pn).call(this,this.snapshotsByDatabaseLsn,t.databaseLsn,e))},Nn=function(e,t,n){let r=e.get(t);r?r.add(n):e.set(t,new Set([n]))},Pn=function(e,t,n){let r=e.get(t);r&&(r.delete(n),r.size===0&&e.delete(t))};var In=class{get isUpToDate(){return!1}get staleCacheBuster(){}get staleCacheRetryCount(){return 0}get sseFallbackToLongPolling(){return!1}get consecutiveShortSseConnections(){return 0}get replayCursor(){}canEnterReplayMode(){return!1}enterReplayMode(e){return this}shouldUseSse(e){return!1}handleSseConnectionClosed(e){return{state:this,fellBackToLongPolling:!1,wasShortConnection:!1}}applyUrlParams(e,t){}handleResponseMetadata(e){return{action:`ignored`,state:this}}handleMessageBatch(e){return{state:this,suppressBatch:!1,becameUpToDate:!1}}pause(){return new Qn(this)}toErrorState(e){return new $n(this,e)}markMustRefetch(e){return new zn({handle:e,offset:`-1`,liveCacheBuster:``,lastSyncedAt:this.lastSyncedAt,schema:void 0})}},q,Ln=class extends In{constructor(e){super(),U(this,q),W(this,q,e)}get handle(){return H(this,q).handle}get offset(){return H(this,q).offset}get schema(){return H(this,q).schema}get liveCacheBuster(){return H(this,q).liveCacheBuster}get lastSyncedAt(){return H(this,q).lastSyncedAt}get currentFields(){return H(this,q)}applyUrlParams(e,t){e.searchParams.set(wt,H(this,q).offset),H(this,q).handle&&e.searchParams.set(St,H(this,q).handle)}parseResponseFields(e){let t=e.responseHandle,n=t&&t!==e.expiredHandle?t:H(this,q).handle,r=e.responseOffset??H(this,q).offset,i=e.responseCursor??H(this,q).liveCacheBuster;return{handle:n,offset:r,schema:H(this,q).schema??e.responseSchema,liveCacheBuster:i,lastSyncedAt:e.status===204?e.now:H(this,q).lastSyncedAt}}checkStaleResponse(e){let t=e.responseHandle,n=e.expiredHandle;if(!t||t!==n)return null;let r=this.staleCacheRetryCount+1;return{action:`stale-retry`,state:new Wn(V(B({},this.currentFields),{staleCacheBuster:e.createCacheBuster(),staleCacheRetryCount:r})),exceededMaxRetries:r>e.maxStaleCacheRetries}}handleMessageBatch(e){if(!e.hasMessages||!e.hasUpToDateMessage)return{state:this,suppressBatch:!1,becameUpToDate:!1};let t=H(this,q).offset;e.isSse&&e.upToDateOffset&&(t=e.upToDateOffset);let n={handle:H(this,q).handle,offset:t,schema:H(this,q).schema,liveCacheBuster:H(this,q).liveCacheBuster,lastSyncedAt:e.now};return this.onUpToDate(n,e)}onUpToDate(e,t){return{state:new Jn(e),suppressBatch:!1,becameUpToDate:!0}}};q=new WeakMap;var Rn=class extends Ln{handleResponseMetadata(e){let t=this.checkStaleResponse(e);if(t)return t;let n=this.parseResponseFields(e);return e.status===204?{action:`accepted`,state:new Jn(n,{sseFallbackToLongPolling:!0})}:{action:`accepted`,state:new Bn(n)}}canEnterReplayMode(){return!0}enterReplayMode(e){return new Zn(V(B({},this.currentFields),{replayCursor:e}))}},zn=class e extends Rn{constructor(e){super(e),this.kind=`initial`}withHandle(t){return new e(V(B({},this.currentFields),{handle:t}))}},Bn=class e extends Rn{constructor(e){super(e),this.kind=`syncing`}withHandle(t){return new e(V(B({},this.currentFields),{handle:t}))}},Vn,Hn,Un=class e extends Rn{constructor(e){let t=e,{staleCacheBuster:n,staleCacheRetryCount:r}=t,i=ze(t,[`staleCacheBuster`,`staleCacheRetryCount`]);super(i),this.kind=`stale-retry`,U(this,Vn),U(this,Hn),W(this,Vn,n),W(this,Hn,r)}get staleCacheBuster(){return H(this,Vn)}get staleCacheRetryCount(){return H(this,Hn)}canEnterReplayMode(){return!1}withHandle(t){return new e(V(B({},this.currentFields),{handle:t,staleCacheBuster:H(this,Vn),staleCacheRetryCount:H(this,Hn)}))}applyUrlParams(e,t){super.applyUrlParams(e,t),e.searchParams.set(Ht,H(this,Vn))}};Vn=new WeakMap,Hn=new WeakMap;var Wn=Un,Gn,Kn,qn=class e extends Ln{constructor(e,t){super(e),this.kind=`live`,U(this,Gn),U(this,Kn),W(this,Gn,t?.consecutiveShortSseConnections??0),W(this,Kn,t?.sseFallbackToLongPolling??!1)}get isUpToDate(){return!0}get consecutiveShortSseConnections(){return H(this,Gn)}get sseFallbackToLongPolling(){return H(this,Kn)}withHandle(t){return new e(V(B({},this.currentFields),{handle:t}),this.sseState)}applyUrlParams(e,t){super.applyUrlParams(e,t),t.isSnapshotRequest||(e.searchParams.set(bt,this.liveCacheBuster),t.canLongPoll&&e.searchParams.set(Ct,`true`))}get sseState(){return{consecutiveShortSseConnections:H(this,Gn),sseFallbackToLongPolling:H(this,Kn)}}handleResponseMetadata(t){return this.checkStaleResponse(t)||{action:`accepted`,state:new e(this.parseResponseFields(t),this.sseState)}}onUpToDate(t,n){return{state:new e(t,this.sseState),suppressBatch:!1,becameUpToDate:!0}}shouldUseSse(e){return e.liveSseEnabled&&!e.isRefreshing&&!e.resumingFromPause&&!H(this,Kn)}handleSseConnectionClosed(t){let n=H(this,Gn),r=H(this,Kn),i=!1,a=!1;return t.connectionDuration<t.minConnectionDuration&&!t.wasAborted?(a=!0,n+=1,n>=t.maxShortConnections&&(r=!0,i=!0)):t.connectionDuration>=t.minConnectionDuration&&(n=0),{state:new e(this.currentFields,{consecutiveShortSseConnections:n,sseFallbackToLongPolling:r}),fellBackToLongPolling:i,wasShortConnection:a}}};Gn=new WeakMap,Kn=new WeakMap;var Jn=qn,Yn,Xn=class e extends Ln{constructor(e){let t=e,{replayCursor:n}=t,r=ze(t,[`replayCursor`]);super(r),this.kind=`replaying`,U(this,Yn),W(this,Yn,n)}get replayCursor(){return H(this,Yn)}withHandle(t){return new e(V(B({},this.currentFields),{handle:t,replayCursor:H(this,Yn)}))}handleResponseMetadata(t){return this.checkStaleResponse(t)||{action:`accepted`,state:new e(V(B({},this.parseResponseFields(t)),{replayCursor:H(this,Yn)}))}}onUpToDate(e,t){let n=!t.isSse&&H(this,Yn)===t.currentCursor;return{state:new Jn(e),suppressBatch:n,becameUpToDate:!0}}};Yn=new WeakMap;var Zn=Xn,Qn=class e extends In{constructor(t){super(),this.kind=`paused`,this.previousState=t instanceof e?t.previousState:t}get handle(){return this.previousState.handle}get offset(){return this.previousState.offset}get schema(){return this.previousState.schema}get liveCacheBuster(){return this.previousState.liveCacheBuster}get lastSyncedAt(){return this.previousState.lastSyncedAt}get isUpToDate(){return this.previousState.isUpToDate}get staleCacheBuster(){return this.previousState.staleCacheBuster}get staleCacheRetryCount(){return this.previousState.staleCacheRetryCount}get sseFallbackToLongPolling(){return this.previousState.sseFallbackToLongPolling}get consecutiveShortSseConnections(){return this.previousState.consecutiveShortSseConnections}get replayCursor(){return this.previousState.replayCursor}handleResponseMetadata(t){let n=this.previousState.handleResponseMetadata(t);if(n.action===`accepted`)return{action:`accepted`,state:new e(n.state)};if(n.action===`ignored`)return{action:`ignored`,state:this};if(n.action===`stale-retry`)return{action:`stale-retry`,state:new e(n.state),exceededMaxRetries:n.exceededMaxRetries};throw Error(`PausedState.handleResponseMetadata: unhandled transition action "${n.action}"`)}withHandle(t){return new e(this.previousState.withHandle(t))}applyUrlParams(e,t){this.previousState.applyUrlParams(e,t)}pause(){return this}resume(){return this.previousState}},$n=class e extends In{constructor(t,n){super(),this.kind=`error`,this.previousState=t instanceof e?t.previousState:t,this.error=n}get handle(){return this.previousState.handle}get offset(){return this.previousState.offset}get schema(){return this.previousState.schema}get liveCacheBuster(){return this.previousState.liveCacheBuster}get lastSyncedAt(){return this.previousState.lastSyncedAt}get isUpToDate(){return this.previousState.isUpToDate}get staleCacheBuster(){return this.previousState.staleCacheBuster}get staleCacheRetryCount(){return this.previousState.staleCacheRetryCount}get sseFallbackToLongPolling(){return this.previousState.sseFallbackToLongPolling}get consecutiveShortSseConnections(){return this.previousState.consecutiveShortSseConnections}get replayCursor(){return this.previousState.replayCursor}withHandle(t){return new e(this.previousState.withHandle(t),this.error)}applyUrlParams(e,t){this.previousState.applyUrlParams(e,t)}retry(){return this.previousState}reset(e){return this.previousState.markMustRefetch(e)}};function er(e){return new zn({handle:e.handle,offset:e.offset,liveCacheBuster:``,lastSyncedAt:void 0,schema:void 0})}var tr,nr,rr,ir=class{constructor(e){U(this,tr,new Set),U(this,nr),U(this,rr),W(this,nr,e.onAcquired),W(this,rr,e.onReleased)}acquire(e){if(H(this,tr).has(e)){console.warn(`[Electric] PauseLock: "${e}" already held \u2014 ignoring duplicate acquire`);return}let t=H(this,tr).size===0;H(this,tr).add(e),t&&H(this,nr).call(this)}release(e){if(!H(this,tr).delete(e)){console.warn(`[Electric] PauseLock: "${e}" not held \u2014 ignoring release (possible acquire/release mismatch)`);return}H(this,tr).size===0&&H(this,rr).call(this)}get isPaused(){return H(this,tr).size>0}isHeldBy(e){return H(this,tr).has(e)}releaseAllMatching(e){for(let t of H(this,tr))t.startsWith(e)&&H(this,tr).delete(t)}};tr=new WeakMap,nr=new WeakMap,rr=new WeakMap;var ar=new Set([bt,St,Ct,wt,Ht]),or=`https://electric-sql.com/docs/guides/troubleshooting`;function sr(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}async function cr(e){return typeof e==`function`?e():e}async function lr(e){let t=Object.entries(e),n=await Promise.all(t.map(async([e,t])=>{if(t===void 0)return[e,void 0];let n=await cr(t);return[e,Array.isArray(n)?n.join(`,`):n]}));return Object.fromEntries(n.filter(([e,t])=>t!==void 0))}async function ur(e){if(!e)return{};let t=Object.entries(e),n=await Promise.all(t.map(async([e,t])=>[e,await cr(t)]));return Object.fromEntries(n)}function dr(e){let t=new URL(e.origin+e.pathname);for(let[n,r]of e.searchParams)Ut.includes(n)||t.searchParams.append(n,r);return t.searchParams.sort(),t.toString()}var fr,pr,mr,hr,gr,_r,J,vr,yr,br,xr,Sr,Cr,Y,wr,Tr,Er,Dr,Or,kr,Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi=class{constructor(e){U(this,Y),U(this,fr,null),U(this,pr),U(this,mr),U(this,hr),U(this,gr,new Map),U(this,_r,!1),U(this,J),U(this,vr,!1),U(this,yr),U(this,br),U(this,xr),U(this,Sr,0),U(this,Cr,0),U(this,Tr),U(this,Er),U(this,Dr),U(this,Or,Promise.resolve([])),U(this,kr,new Fn),U(this,Ar),U(this,jr),U(this,Mr),U(this,Nr,1e3),U(this,Pr,3),U(this,Fr,100),U(this,Ir,5e3),U(this,Lr),U(this,Rr),U(this,zr,3),U(this,Br,[]),U(this,Vr,500),U(this,Hr,5),U(this,Ur,100),U(this,Wr,5e3),U(this,Gr,0),U(this,Kr,5),U(this,qr),U(this,Jr,5),U(this,Yr,null),U(this,Xr,null),U(this,Zr,0),U(this,Qr,50),this.options=B({subscribe:!0},e),Si(this.options),W(this,J,er({offset:this.options.offset??`-1`,handle:this.options.handle})),W(this,Ar,new ir({onAcquired:()=>{var e;W(this,J,H(this,J).pause()),H(this,_r)&&((e=H(this,xr))==null||e.abort(Mt))},onReleased:()=>{H(this,_r)&&(this.options.signal?.aborted||G(this,Y,$r).call(this).catch(()=>{}))}}));let t;if(e.columnMapper){let n=t=>{let n={};for(let[r,i]of Object.entries(t)){let t=e.columnMapper.decode(r);n[t]=i}return n};t=e.transformer?t=>e.transformer(n(t)):n}else t=e.transformer;W(this,hr,new rt(e.parser,t)),W(this,br,this.options.onError),W(this,yr,this.options.log??`full`);let n=qt(e.fetchClient??((...e)=>fetch(...e)),V(B({},e.backoffOptions??Gt),{onFailedAttempt:()=>{var t,n;W(this,vr,!1),(n=(t=e.backoffOptions)?.onFailedAttempt)==null||n.call(t)}}));W(this,mr,tn(Zt(n))),W(this,pr,Yt(H(this,mr))),G(this,Y,mi).call(this)}get shapeHandle(){return H(this,J).handle}get error(){return H(this,fr)}get isUpToDate(){return H(this,J).isUpToDate}get lastOffset(){return H(this,J).offset}get mode(){return H(this,yr)}subscribe(e,t=()=>{}){let n={};return H(this,gr).set(n,[e,t]),H(this,_r)||G(this,Y,$r).call(this),()=>{H(this,gr).delete(n)}}unsubscribeAll(){var e,t;H(this,gr).clear(),(e=H(this,Lr))==null||e.call(this),(t=H(this,Rr))==null||t.call(this)}lastSyncedAt(){return H(this,J).lastSyncedAt}lastSynced(){return H(this,J).lastSyncedAt===void 0?1/0:Date.now()-H(this,J).lastSyncedAt}isConnected(){return H(this,vr)}isLoading(){return!H(this,J).isUpToDate}hasStarted(){return H(this,_r)}isPaused(){return H(this,Ar).isPaused}async forceDisconnectAndRefresh(){var e;Ve(this,Sr)._++;try{H(this,J).isUpToDate&&!H(this,xr)?.signal.aborted&&((e=H(this,xr))==null||e.abort(jt)),await G(this,Y,ui).call(this)}finally{Ve(this,Sr)._--}}async requestSnapshot(e){if(H(this,yr)===`full`)throw Error(`Snapshot requests are not supported in ${H(this,yr)} mode, as the consumer is guaranteed to observe all data`);H(this,_r)||G(this,Y,$r).call(this).catch(()=>{});let t=`snapshot-${++Ve(this,Cr)._}`;H(this,Ar).acquire(t);let n=setTimeout(()=>{console.warn(`[Electric] Snapshot "${t}" has held the pause lock for 30s \u2014 possible hung request or leaked lock. Current holders: ${[...new Set([t])].join(`, `)}`,Error(`stack trace`))},3e4);try{let{metadata:t,data:n,responseOffset:r,responseHandle:i}=await this.fetchSnapshot(e),a=n.concat([{headers:B({control:`snapshot-end`},t)},{headers:B({control:`subset-end`},e)}]);if(H(this,kr).addSnapshot(t,new Set(n.map(e=>e.key))),G(this,Y,oi).call(this,a,!1),r!==null||i!==null){let e=H(this,J).handleResponseMetadata({status:200,responseHandle:i,responseOffset:r,responseCursor:null,expiredHandle:null,now:Date.now(),maxStaleCacheRetries:H(this,zr),createCacheBuster:sr});e.action===`accepted`?W(this,J,e.state):console.warn(`[Electric] Snapshot response metadata was not accepted by state "${H(this,J).kind}" (action: ${e.action}). Stream offset was not advanced from snapshot.`,Error(`stack trace`))}return{metadata:t,data:n}}finally{clearTimeout(n),H(this,Ar).release(t)}}async fetchSnapshot(e){return G(this,Y,_i).call(this,e,0)}};fr=new WeakMap,pr=new WeakMap,mr=new WeakMap,hr=new WeakMap,gr=new WeakMap,_r=new WeakMap,J=new WeakMap,vr=new WeakMap,yr=new WeakMap,br=new WeakMap,xr=new WeakMap,Sr=new WeakMap,Cr=new WeakMap,Y=new WeakSet,wr=function(){return H(this,Sr)>0},Tr=new WeakMap,Er=new WeakMap,Dr=new WeakMap,Or=new WeakMap,kr=new WeakMap,Ar=new WeakMap,jr=new WeakMap,Mr=new WeakMap,Nr=new WeakMap,Pr=new WeakMap,Fr=new WeakMap,Ir=new WeakMap,Lr=new WeakMap,Rr=new WeakMap,zr=new WeakMap,Br=new WeakMap,Vr=new WeakMap,Hr=new WeakMap,Ur=new WeakMap,Wr=new WeakMap,Gr=new WeakMap,Kr=new WeakMap,qr=new WeakMap,Jr=new WeakMap,Yr=new WeakMap,Xr=new WeakMap,Zr=new WeakMap,Qr=new WeakMap,$r=async function(){W(this,_r,!0),G(this,Y,hi).call(this);try{await G(this,Y,ti).call(this)}catch(e){if(W(this,fr,e),e instanceof Error&&W(this,J,H(this,J).toErrorState(e)),H(this,br)){let t=await H(this,br).call(this,e),n=!(e instanceof Je);if(t&&typeof t==`object`&&n){if(t.params&&(this.options.params=B(B({},this.options.params??{}),t.params)),t.headers&&(this.options.headers=B(B({},this.options.headers??{}),t.headers)),Ve(this,Zr)._++,H(this,Zr)>H(this,Qr)){console.warn(`[Electric] onError retry loop exhausted after ${H(this,Qr)} consecutive retries. The error was never resolved by the onError handler. Error: ${e instanceof Error?e.message:String(e)}`,Error(`stack trace`)),e instanceof Error&&G(this,Y,fi).call(this,e),G(this,Y,ei).call(this);return}return W(this,fr,null),H(this,J)instanceof $n&&W(this,J,H(this,J).retry()),W(this,Gr,0),W(this,Br,[]),W(this,_r,!1),G(this,Y,$r).call(this)}e instanceof Error&&G(this,Y,fi).call(this,e),G(this,Y,ei).call(this);return}throw e instanceof Error&&G(this,Y,fi).call(this,e),G(this,Y,ei).call(this),e}G(this,Y,ei).call(this)},ei=function(){var e,t;W(this,vr,!1),(e=H(this,Dr))==null||e.call(this),(t=H(this,Rr))==null||t.call(this)},ti=async function(e){var t;if(H(this,J)instanceof $n)throw H(this,J).error;let n=e??H(this,qr);if(H(this,Ar).isPaused){n&&W(this,qr,n);return}if(!this.options.subscribe&&(this.options.signal?.aborted||H(this,J).isUpToDate))return;H(this,J).isUpToDate?(W(this,Gr,0),W(this,Br,[])):await G(this,Y,ni).call(this);let r=!1;H(this,J)instanceof Qn&&(r=!0,W(this,J,H(this,J).resume()));let{url:i,signal:a}=this.options,{fetchUrl:o,requestHeaders:s}=await G(this,Y,ri).call(this,i,r);n&&(o.searchParams.set(Ht,n),o.searchParams.sort());let c=await G(this,Y,ii).call(this,a),l=H(this,xr);if(H(this,Ar).isPaused){c&&a&&a.removeEventListener(`abort`,c),n&&W(this,qr,n),W(this,xr,void 0);return}W(this,qr,void 0);try{await G(this,Y,si).call(this,{fetchUrl:o,requestAbortController:l,headers:s,resumingFromPause:r})}catch(e){let t=l.signal.reason,n=l.signal.aborted&&(t===jt||t===Nt);if((e instanceof K||e instanceof He)&&n)return G(this,Y,ti).call(this);if(e instanceof He)return;if(e instanceof Ye)return G(this,Y,ti).call(this);if(!(e instanceof K))throw e;if(e.status==409){if(H(this,J).handle){let e=dr(o);kn.markExpired(e,H(this,J).handle)}let t=e.headers[ht];t||console.warn(`[Electric] Received 409 response without a shape handle header. This likely indicates a proxy or CDN stripping required headers.`,Error(`stack trace`));let n=sr();return G(this,Y,gi).call(this,t),await G(this,Y,di).call(this,[{headers:{control:`must-refetch`}}]),G(this,Y,ti).call(this,n)}else throw e}finally{c&&a&&a.removeEventListener(`abort`,c),W(this,xr,void 0)}return(t=H(this,Er))==null||t.call(this),G(this,Y,ti).call(this)},ni=async function(){let e=Date.now(),t=H(this,J).offset;if(W(this,Br,H(this,Br).filter(t=>e-t.timestamp<H(this,Vr))),H(this,Br).push({timestamp:e,offset:t}),H(this,Br).filter(e=>e.offset===t).length<H(this,Hr))return;if(Ve(this,Gr)._++,H(this,Gr)>=H(this,Kr))throw new K(502,void 0,void 0,{},this.options.url,`Client is stuck in a fast retry loop (${H(this,Hr)} requests in ${H(this,Vr)}ms at the same offset, repeated ${H(this,Kr)} times). Client-side caches were cleared automatically on first detection, but the loop persists. This usually indicates a proxy or CDN misconfiguration. Common causes:
|
|
8
|
+
- Proxy is not including query parameters (handle, offset) in its cache key
|
|
9
|
+
- CDN is serving stale 409 responses
|
|
10
|
+
- Proxy is stripping required Electric headers from responses
|
|
11
|
+
For more information visit the troubleshooting guide: ${or}`);if(H(this,Gr)===1){if(console.warn(`[Electric] Detected fast retry loop (${H(this,Hr)} requests in ${H(this,Vr)}ms at the same offset). Clearing client-side caches and resetting stream to recover. If this persists, check that your proxy includes all query parameters (especially 'handle' and 'offset') in its cache key, and that required Electric headers are forwarded to the client. For more information visit the troubleshooting guide: ${or}`,Error(`stack trace`)),H(this,jr)){let e=dr(H(this,jr));kn.delete(e),An.delete(e)}else kn.clear(),An.clear();G(this,Y,gi).call(this),W(this,Br,[]);return}let n=Math.min(H(this,Wr),H(this,Ur)*2**H(this,Gr)),r=Math.floor(Math.random()*n);await new Promise(e=>setTimeout(e,r)),W(this,Br,[])},ri=async function(e,t,n){let[r,i]=await Promise.all([ur(this.options.headers),this.options.params?lr(wi(this.options.params)):void 0]);i&&xi(i);let a=new URL(e);if(i){if(i.table&&Ci(a,Tt,i.table),i.where&&typeof i.where==`string`&&Ci(a,Et,ot(i.where,this.options.columnMapper?.encode)),i.columns){let e=await cr(this.options.params?.columns);if(Array.isArray(e)){let t=e.map(String);this.options.columnMapper&&(t=t.map(this.options.columnMapper.encode)),Ci(a,yt,t.map(at).join(`,`))}else Ci(a,yt,i.columns)}i.replica&&Ci(a,Dt,i.replica),i.params&&Ci(a,Ot,i.params);let e=B({},i);delete e.table,delete e.where,delete e.columns,delete e.replica,delete e.params;for(let[t,n]of Object.entries(e))Ci(a,t,n)}n&&(n.whereExpr?(Ci(a,Ft,hn(n.whereExpr,this.options.columnMapper?.encode)),a.searchParams.set(Bt,JSON.stringify(n.whereExpr))):n.where&&typeof n.where==`string`&&Ci(a,Ft,ot(n.where,this.options.columnMapper?.encode)),n.params&&a.searchParams.set(zt,ft(n.params)),n.limit!==void 0&&Ci(a,It,n.limit),n.offset!==void 0&&Ci(a,Lt,n.offset),n.orderByExpr?(Ci(a,Rt,_n(n.orderByExpr,this.options.columnMapper?.encode)),a.searchParams.set(Vt,JSON.stringify(n.orderByExpr))):n.orderBy&&typeof n.orderBy==`string`&&Ci(a,Rt,ot(n.orderBy,this.options.columnMapper?.encode))),H(this,J).applyUrlParams(a,{isSnapshotRequest:n!==void 0,canLongPoll:!H(this,Y,wr)&&!t}),a.searchParams.set(Pt,H(this,yr));let o=dr(a),s=kn.getExpiredHandle(o);return s&&a.searchParams.set(xt,s),a.searchParams.sort(),{fetchUrl:a,requestHeaders:r}},ii=async function(e){var t;if(W(this,xr,new AbortController),e){let n=()=>{var t;(t=H(this,xr))==null||t.abort(e.reason)};return e.addEventListener(`abort`,n,{once:!0}),e.aborted&&((t=H(this,xr))==null||t.abort(e.reason)),n}},ai=async function(e){let{headers:t,status:n}=e,r=t.get(ht),i=H(this,jr)?dr(H(this,jr)):null,a=i?kn.getExpiredHandle(i):null;if(H(this,Xr)){let{shapeKey:e,staleHandle:t}=H(this,Xr);W(this,Xr,null),i===e&&r===t&&console.warn(`[Electric] Self-healing retry received the same handle "${t}" that was just marked expired. This means your proxy/CDN is serving a stale cached response and ignoring cache-buster query params. The client will proceed with this stale data to avoid a permanent failure, but it may be out of date until the cache refreshes. Fix: configure your proxy/CDN to include all query parameters (especially 'handle' and 'offset') in its cache key. For more information visit the troubleshooting guide: ${or}`,Error(`stack trace`))}let o=H(this,J).handleResponseMetadata({status:n,responseHandle:r,responseOffset:t.get(gt),responseCursor:t.get(mt),responseSchema:bi(t),expiredHandle:a,now:Date.now(),maxStaleCacheRetries:H(this,zr),createCacheBuster:sr});if(W(this,J,o.state),n===204&&W(this,Yr,null),o.action===`accepted`&&n===204&&W(this,Zr,0),o.action===`stale-retry`)throw await e.body?.cancel(),o.exceededMaxRetries?i&&(kn.delete(i),H(this,Yr)!==i)?(console.warn(`[Electric] Stale cache retries exhausted (${H(this,zr)} attempts). Clearing expired handle entry and attempting self-healing retry without the expired_handle parameter. For more information visit the troubleshooting guide: ${or}`,Error(`stack trace`)),W(this,Yr,i),r&&W(this,Xr,{shapeKey:i,staleHandle:r}),G(this,Y,gi).call(this),new Ye(`Expired handle entry evicted for self-healing retry`)):new K(502,void 0,void 0,{},H(this,jr)?.toString()??``,`CDN continues serving stale cached responses after ${H(this,zr)} retry attempts. This indicates a severe proxy/CDN misconfiguration. Check that your proxy includes all query parameters (especially 'handle' and 'offset') in its cache key. For more information visit the troubleshooting guide: ${or}`):(console.warn(`[Electric] Received stale cached response with expired shape handle. This should not happen and indicates a proxy/CDN caching misconfiguration. The response contained handle "${r}" which was previously marked as expired. Check that your proxy includes all query parameters (especially 'handle' and 'offset') in its cache key. For more information visit the troubleshooting guide: ${or} Retrying with a random cache buster to bypass the stale cache (attempt ${H(this,J).staleCacheRetryCount}/${H(this,zr)}).`,Error(`stack trace`)),new Ye(`Received stale cached response with expired handle "${r}". This indicates a proxy/CDN caching misconfiguration. Check that your proxy includes all query parameters (especially 'handle' and 'offset') in its cache key.`));return o.action===`ignored`?(console.warn(`[Electric] Response was ignored by state "${H(this,J).kind}". The response body will be skipped. This may indicate a proxy/CDN caching issue or a client state machine bug.`,Error(`stack trace`)),!1):!0},oi=async function(e,t=!1){if(!Array.isArray(e)){console.warn(`[Electric] #onMessages called with non-array argument (${typeof e}). This is a client bug \u2014 please report it.`,Error(`stack trace`));return}if(e.length===0)return;W(this,Zr,0);let n=e[e.length-1],r=lt(n),i=r?ut(n):void 0,a=H(this,J).handleMessageBatch({hasMessages:!0,hasUpToDateMessage:r,isSse:t,upToDateOffset:i,now:Date.now(),currentCursor:H(this,J).liveCacheBuster});if(W(this,J,a.state),r){if(a.suppressBatch)return;if(H(this,jr)){let e=dr(H(this,jr));An.recordUpToDate(e,H(this,J).liveCacheBuster),W(this,Yr,null)}}let o=e.filter(e=>st(e)?!H(this,kr).shouldRejectMessage(e):!0);await G(this,Y,di).call(this,o)},si=async function(e){if(W(this,jr,e.fetchUrl),!H(this,J).isUpToDate&&H(this,J).canEnterReplayMode()){let t=dr(e.fetchUrl),n=An.shouldEnterReplayMode(t);n&&W(this,J,H(this,J).enterReplayMode(n))}let t=this.options.liveSse??this.options.experimentalLiveSse;return H(this,J).shouldUseSse({liveSseEnabled:!!t,isRefreshing:H(this,Y,wr),resumingFromPause:!!e.resumingFromPause})?(e.fetchUrl.searchParams.set(kt,`true`),e.fetchUrl.searchParams.set(At,`true`),G(this,Y,li).call(this,e)):G(this,Y,ci).call(this,e)},ci=async function(e){let{fetchUrl:t,requestAbortController:n,headers:r}=e,i=await H(this,pr).call(this,t.toString(),{signal:n.signal,headers:r});if(W(this,vr,!0),!await G(this,Y,ai).call(this,i))return;let a=H(this,J).schema,o=await i.text()||`[]`,s=H(this,hr).parse(o,a);if(!Array.isArray(s)){let e=ft(s)?.slice(0,200);throw new K(i.status,`Received non-array response body from shape endpoint. This may indicate a proxy or CDN is returning an unexpected response. Expected a JSON array, got ${typeof s}: ${e}`,void 0,Object.fromEntries(i.headers.entries()),t.toString())}await G(this,Y,oi).call(this,s)},li=async function(e){let{fetchUrl:t,requestAbortController:n,headers:r}=e,i=H(this,mr);W(this,Mr,Date.now());let a=V(B({},r),{Accept:`text/event-stream`}),o=!1;try{let e=[];await Dn(t.toString(),{headers:a,fetch:i,onopen:async e=>{if(W(this,vr,!0),!await G(this,Y,ai).call(this,e))throw o=!0,Error(`stale response ignored`)},onmessage:t=>{if(t.data){let n=H(this,J).schema,r=H(this,hr).parse(t.data,n);e.push(r),lt(r)&&(G(this,Y,oi).call(this,e,!0),e=[])}},onerror:e=>{throw e},signal:n.signal})}catch(e){if(o)return;if(n.signal.aborted)throw new He;if(e instanceof K||e instanceof Ye||e instanceof Je)throw e}finally{let e=Date.now()-H(this,Mr),t=n.signal.aborted,r=H(this,J).handleSseConnectionClosed({connectionDuration:e,wasAborted:t,minConnectionDuration:H(this,Nr),maxShortConnections:H(this,Pr)});if(W(this,J,r.state),r.fellBackToLongPolling)console.warn(`[Electric] SSE connections are closing immediately (possibly due to proxy buffering or misconfiguration). Falling back to long polling. Your proxy must support streaming SSE responses (not buffer the complete response). Configuration: Nginx add 'X-Accel-Buffering: no', Caddy add 'flush_interval -1' to reverse_proxy. Note: Do NOT disable caching entirely - Electric uses cache headers to enable request collapsing for efficiency.`,Error(`stack trace`));else if(r.wasShortConnection){let e=Math.min(H(this,Ir),H(this,Fr)*2**H(this,J).consecutiveShortSseConnections),t=Math.floor(Math.random()*e);await new Promise(e=>setTimeout(e,t))}}},ui=async function(){if(H(this,Ar).isPaused)throw Error(`Cannot wait for next tick while PauseLock is held — this would deadlock because the request loop is paused`);return H(this,Tr)?H(this,Tr):(W(this,Tr,new Promise((e,t)=>{W(this,Er,e),W(this,Dr,t)})),H(this,Tr).finally(()=>{W(this,Tr,void 0),W(this,Er,void 0),W(this,Dr,void 0)}),H(this,Tr))},di=async function(e){return W(this,Or,H(this,Or).then(()=>Promise.all(Array.from(H(this,gr).values()).map(async([t,n])=>{try{await t(e)}catch(e){queueMicrotask(()=>{throw e})}})))),H(this,Or)},fi=function(e){H(this,gr).forEach(([t,n])=>{n?.(e)})},pi=function(){return typeof document==`object`&&typeof document.hidden==`boolean`&&typeof document.addEventListener==`function`},mi=function(){if(G(this,Y,pi).call(this)){let e=()=>{document.hidden?H(this,Ar).acquire(`visibility`):H(this,Ar).release(`visibility`)};document.addEventListener(`visibilitychange`,e),W(this,Lr,()=>{document.removeEventListener(`visibilitychange`,e),W(this,Lr,void 0)})}},hi=function(){if(G(this,Y,pi).call(this)||H(this,Rr))return;let e=2e3,t=Date.now(),n=setInterval(()=>{let n=Date.now(),r=n-t;t=n,r>e+4e3&&!H(this,Ar).isPaused&&H(this,xr)&&(Ve(this,Sr)._++,H(this,xr).abort(Nt),queueMicrotask(()=>{Ve(this,Sr)._--}))},e);typeof n==`object`&&`unref`in n&&n.unref(),W(this,Rr,()=>{clearInterval(n),W(this,Rr,void 0)})},gi=function(e){W(this,J,H(this,J).markMustRefetch(e)),W(this,vr,!1),H(this,Ar).releaseAllMatching(`snapshot`)},_i=async function(e,t,n){let r=(e.method??this.options.subsetMethod??`GET`)===`POST`,i,a;if(r){let t=await G(this,Y,ri).call(this,this.options.url,!0);i=t.fetchUrl,a={method:`POST`,headers:V(B({},t.requestHeaders),{"Content-Type":`application/json`}),body:ft(G(this,Y,vi).call(this,e))}}else{let t=await G(this,Y,ri).call(this,this.options.url,!0,e);i=t.fetchUrl,a={headers:t.requestHeaders}}n&&(i.searchParams.set(Ht,n),i.searchParams.sort());let o=H(this,J).handle,s;try{s=await H(this,pr).call(this,i.toString(),a)}catch(n){if(n instanceof K&&n.status===409){let r=t+1;if(r>H(this,Jr))throw new K(502,void 0,void 0,{},i.toString(),`Snapshot request stuck in 409 retry loop after ${H(this,Jr)} attempts. This indicates a proxy/CDN misconfiguration. For more information visit the troubleshooting guide: ${or}`);if(o){let e=dr(i);kn.markExpired(e,o)}let a=n.headers[ht];a?W(this,J,H(this,J).withHandle(a)):console.warn(`[Electric] Received 409 response without a shape handle header. This likely indicates a proxy or CDN stripping required headers.`,Error(`stack trace`));let s=sr();return G(this,Y,_i).call(this,e,r,s)}throw n}if(!s.ok)throw await K.fromResponse(s,i.toString());let c=H(this,J).schema??bi(s.headers,{required:!0,url:i.toString()}),{metadata:l,data:u}=await s.json();return{metadata:l,data:H(this,hr).parseSnapshotData(u,c),responseOffset:s.headers.get(gt)||null,responseHandle:s.headers.get(ht)}},vi=function(e){let t={};return e.whereExpr?(t.where=hn(e.whereExpr,this.options.columnMapper?.encode),t.where_expr=e.whereExpr):e.where&&typeof e.where==`string`&&(t.where=ot(e.where,this.options.columnMapper?.encode)),e.params&&(t.params=e.params),e.limit!==void 0&&(t.limit=e.limit),e.offset!==void 0&&(t.offset=e.offset),e.orderByExpr?(t.order_by=_n(e.orderByExpr,this.options.columnMapper?.encode),t.order_by_expr=e.orderByExpr):e.orderBy&&typeof e.orderBy==`string`&&(t.order_by=ot(e.orderBy,this.options.columnMapper?.encode)),t},yi.Replica={FULL:`full`,DEFAULT:`default`};function bi(e,t){let n=e.get(_t);if(!n){if(t?.required&&t?.url)throw new Je(t.url,[_t]);return{}}return JSON.parse(n)}function xi(e){if(!e)return;let t=Object.keys(e).filter(e=>ar.has(e));if(t.length>0)throw new Ke(t)}function Si(e){if(!e.url)throw new Ue;if(e.signal&&!(e.signal instanceof AbortSignal))throw new We;if(e.offset!==void 0&&e.offset!==`-1`&&e.offset!==`now`&&!e.handle)throw new Ge;xi(e.params)}function Ci(e,t,n){if(!(n===void 0||n==null))if(typeof n==`string`)e.searchParams.set(t,n);else if(typeof n==`object`)for(let[r,i]of Object.entries(n))e.searchParams.set(`${t}[${r}]`,i);else e.searchParams.set(t,n.toString())}function wi(e){return Array.isArray(e.params)?V(B({},e),{params:Object.fromEntries(e.params.map((e,t)=>[t+1,e]))}):e}var Ti=b(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}})),Ei=b(((e,t)=>{function n(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=s,n.humanize=Ti(),n.destroy=l,Object.keys(e).forEach(t=>{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={};function t(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]}n.selectColor=t;function n(e){let t,i=null,a,o;function s(...e){if(!s.enabled)return;let r=s,i=Number(new Date);r.diff=i-(t||i),r.prev=t,r.curr=i,t=i,e[0]=n.coerce(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if(t===`%%`)return`%`;a++;let o=n.formatters[i];if(typeof o==`function`){let n=e[a];t=o.call(r,n),e.splice(a,1),a--}return t}),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=r,s.destroy=n.destroy,Object.defineProperty(s,`enabled`,{enumerable:!0,configurable:!1,get:()=>i===null?(a!==n.namespaces&&(a=n.namespaces,o=n.enabled(e)),o):i,set:e=>{i=e}}),typeof n.init==`function`&&n.init(s),s}function r(e,t){let r=n(this.namespace+(t===void 0?`:`:t)+e);return r.log=this.log,r}function i(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?n.skips.push(e.slice(1)):n.names.push(e)}function a(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function o(){let e=[...n.names,...n.skips.map(e=>`-`+e)].join(`,`);return n.enable(``),e}function s(e){for(let t of n.skips)if(a(e,t))return!1;for(let t of n.names)if(a(e,t))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}t.exports=n})),Di=C(b(((e,t)=>{e.formatArgs=r,e.save=i,e.load=a,e.useColors=n,e.storage=o(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function n(){if(typeof window<`u`&&window.process&&(window.process.type===`renderer`||window.process.__nwjs))return!0;if(typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<`u`&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<`u`&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<`u`&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(e){if(e[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+e[0]+(this.useColors?`%c `:` `)+`+`+t.exports.humanize(this.diff),!this.useColors)return;let n=`color: `+this.color;e.splice(1,0,n,`color: inherit`);let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{e!==`%%`&&(r++,e===`%c`&&(i=r))}),e.splice(i,0,n)}e.log=console.debug||console.log||(()=>{});function i(t){try{t?e.storage.setItem(`debug`,t):e.storage.removeItem(`debug`)}catch{}}function a(){let t;try{t=e.storage.getItem(`debug`)||e.storage.getItem(`DEBUG`)}catch{}return!t&&typeof process<`u`&&`env`in process&&(t={}.DEBUG),t}function o(){try{return localStorage}catch{}}t.exports=Ei()(e);var{formatters:s}=t.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: `+e.message}}}))(),1),Oi=class extends l{constructor(e,t){super(`${t?`[${t}] `:``}${e}`),this.name=`ElectricDBCollectionError`}},ki=class extends Oi{constructor(e,t){super(`Expected number in awaitTxId, received ${e}`,t),this.name=`ExpectedNumberInAwaitTxIdError`}},Ai=class extends Oi{constructor(e,t){super(`Timeout waiting for txId: ${e}`,t),this.name=`TimeoutWaitingForTxIdError`}},ji=class extends Oi{constructor(e){super(`Timeout waiting for custom match function`,e),this.name=`TimeoutWaitingForMatchError`}},Mi=class extends Oi{constructor(e){super(`Stream aborted`,e),this.name=`StreamAbortedError`}};function Ni(e){if(e==null)return``;if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`bigint`)return e.toString();if(typeof e==`boolean`)return e?`true`:`false`;if(e instanceof Date)return e.toISOString();if(Array.isArray(e))return`{${e.map(e=>e==null?`NULL`:typeof e==`string`?`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`:Ni(e)).join(`,`)}}`;let t;try{t=JSON.stringify(e)}catch{t=String(e)}throw Error(`Cannot serialize value: ${t}`)}function Pi(e,t){let{where:n,orderBy:r,limit:i}=e,a=t?.encodeColumnName,o=[],s={params:o};n&&(s.where=Ii(n,o,a)),r&&(s.orderBy=Li(r,o,a)),i&&(s.limit=i),n||(s.where=`true = true`);let c=o.reduce((e,t,n)=>{let r=Ni(t);return t!=null&&(e[`${n+1}`]=r),e},{});return{...s,params:c}}function Fi(e,t){return`"${(t?t(e):e).replace(/"/g,`""`)}"`}function Ii(e,t,n){switch(e.type){case`val`:return t.push(e.value),`$${t.length}`;case`ref`:if(e.path.length!==1)throw Error(`Compiler can't handle nested properties: ${e.path.join(`.`)}`);return Fi(e.path[0],n);case`func`:return Bi(e,t,n);default:throw Error(`Unknown expression type`)}}function Li(e,t,n){return e.map(e=>Ri(e,t,n)).join(`,`)}function Ri(e,t,n){let{expression:r,compareOptions:i}=e,a=Ii(r,t,n);return i.direction===`desc`&&(a=`${a} DESC`),i.nulls===`first`&&(a=`${a} NULLS FIRST`),i.nulls===`last`&&(a=`${a} NULLS LAST`),a}function zi(e){return e.type===`val`&&(e.value===null||e.value===void 0)}function Bi(e,t=[],n){let{name:r,args:i}=e,a=Wi(r);if(Hi(r)&&i.findIndex(e=>zi(e))!==-1)throw Error(`Cannot use null/undefined value with '${r}' operator. Comparisons with null always evaluate to UNKNOWN in SQL. Use isNull() or isUndefined() to check for null values, or filter out null values before building the query.`);if(r===`not`){if(i.length!==1)throw Error(`NOT expects 1 argument`);let e=i[0];if(e?.type===`func`&&(e.name===`isNull`||e.name===`isUndefined`)){if(e.args.length!==1)throw Error(`${e.name} expects 1 argument`);let r=e.args[0],i=Ii(r,t,n);return`${r.type===`func`?`(${i})`:i} IS NOT NULL`}}let o=i.findIndex(e=>e.type===`val`&&typeof e.value==`boolean`);if(i.length===2&&Ui(r)&&o!==-1){let e=i[o].value,a=i[+(o===0)],s=`(${Ii(a,t,n)})`,c=(r===`lt`||r===`lte`)==(o===1),l=r===`lte`||r===`gte`;return l&&e===c?`${s} = ${s}`:!l&&e!==c?`${s} <> ${s}`:`${s} = ${c?`FALSE`:`TRUE`}`}let s=i.map(e=>{let i=Ii(e,t,n);return e.type===`func`&&(e.name===`and`||e.name===`or`||r!==`and`&&r!==`or`&&r!==`not`&&(Vi(e.name)||e.name===`not`||e.name===`isNull`||e.name===`isUndefined`))?`(${i})`:i});if(r===`isNull`||r===`isUndefined`){if(s.length!==1)throw Error(`${r} expects 1 argument`);return`${s[0]} ${a}`}if(r===`not`)return`${a} (${s[0]})`;if(Vi(r)){if((r===`and`||r===`or`)&&s.length>2)return s.join(` ${a} `);if(s.length!==2)throw Error(`Binary operator ${r} expects 2 arguments`);let[e,t]=s;if(r===`in`){let n=i[0],r=i[1];if(n.type===`val`&&Array.isArray(n.value))throw Error(`Array-valued 'in' left operand; expected a scalar`);return r.type===`ref`&&n.type===`val`?`${e} = ANY(${t}) AND ${t} @> ARRAY[${e}] AND ${t} IS NOT NULL`:`${e} ${a}(${t})`}return`${e} ${a} ${t}`}return`${a}(${s.join(`,`)})`}function Vi(e){return[`eq`,`gt`,`gte`,`lt`,`lte`,`and`,`or`,`in`,`like`,`ilike`].includes(e)}function Hi(e){return[`eq`,`gt`,`gte`,`lt`,`lte`,`like`,`ilike`,`in`].includes(e)}function Ui(e){return[`gt`,`gte`,`lt`,`lte`].includes(e)}function Wi(e){let t={eq:`=`,gt:`>`,gte:`>=`,lt:`<`,lte:`<=`,add:`+`,and:`AND`,or:`OR`,not:`NOT`,isUndefined:`IS NULL`,isNull:`IS NULL`,in:`= ANY`,like:`LIKE`,ilike:`ILIKE`,upper:`UPPER`,lower:`LOWER`,length:`LENGTH`,concat:`CONCAT`,coalesce:`COALESCE`}[e];if(!t)throw Error(`Unknown operator/function: ${e}`);return t}function Gi(e){return e.split(`/`).map(e=>e===``?null:e)}function Ki(e,t){if(t>=e.length)throw Error(`Position out of bounds`);return e[t]}function qi(e){return e}function Ji(e){return e.length}function Yi(e,t){let{pos:n,value:r}=qi(t);return Ki(e,n)===r}function Xi(e,t,n,r){for(let i=0;i<r;i++){let r=Ki(e,i);if(r!==null){let e=n[i];e.has(r)||e.set(r,new Set),e.get(r).add(t)}}}function Zi(e,t,n,r){for(let i=0;i<r;i++){let r=Ki(e,i);if(r!==null){let e=n[i];if(e){let n=e.get(r);n&&(n.delete(t),n.size===0&&e.delete(r))}}}}function Qi(e,t){let{pos:n,value:r}=qi(e);return t[n]?.get(r)??new Set}function $i(e){return e.map(e=>{let t=[];for(let n=0;n<e.length;n++)e[n]!==null&&t.push(n);return t})}function ea(e,t){return t.some(t=>t.every(t=>e[t]))}function ta(e){return e.headers.event===`move-out`}function na(e){return e.headers.event===`move-in`}var ra=Di.default.debug(`ts/db:electric`),ia=Symbol(`electricTestHooks`);function aa(e){let t=e.hydratedResumeState;return{version:1,...t?{resume:t}:{},seenTxids:Array.from(e.seenTxids).sort((e,t)=>e-t)}}function oa(e,t){let n=ca(t);n&&(e.hydratedResumeState=n.resume,e.seenTxids=new Set(n.seenTxids))}function sa(e){if(!e||typeof e!=`object`)return;let t=e;if(t.kind===`resume`&&typeof t.offset==`string`&&typeof t.handle==`string`&&typeof t.shapeId==`string`&&typeof t.updatedAt==`number`&&Number.isFinite(t.updatedAt))return{kind:`resume`,offset:t.offset,handle:t.handle,shapeId:t.shapeId,updatedAt:t.updatedAt,...typeof t.requiresTagState==`boolean`&&{requiresTagState:t.requiresTagState}};if(t.kind===`reset`&&typeof t.updatedAt==`number`&&Number.isFinite(t.updatedAt))return{kind:`reset`,updatedAt:t.updatedAt}}function ca(e){if(!e||typeof e!=`object`)return;let t=e;if(t.version!==1||!Array.isArray(t.seenTxids)||!t.seenTxids.every(e=>typeof e==`number`&&Number.isFinite(e)))return;let n=t.resume===void 0?void 0:sa(t.resume);if(!(t.resume!==void 0&&n===void 0))return{version:1,...n?{resume:n}:{},seenTxids:Array.from(new Set(t.seenTxids)).sort((e,t)=>e-t)}}function la(e,t){let n=ca(e),r=ca(t);if(!r)return e;if(!n)return r;let i=ua(n.resume,r.resume);return{version:1,...i?{resume:i}:{},seenTxids:Array.from(new Set([...n.seenTxids,...r.seenTxids])).sort((e,t)=>e-t)}}function ua(e,t){return e?t?t.updatedAt>e.updatedAt?t:t.updatedAt<e.updatedAt||e.kind===t.kind&&(e.kind===`reset`||t.kind===`resume`&&e.offset===t.offset&&e.handle===t.handle&&e.shapeId===t.shapeId)?e:{kind:`reset`,updatedAt:e.updatedAt}:e:t}function da(e){return ct(e)&&e.headers.control===`up-to-date`}function fa(e){return ct(e)&&e.headers.control===`must-refetch`}function pa(e){return ct(e)&&e.headers.control===`snapshot-end`}function ma(e){return ct(e)&&e.headers.control===`subset-end`}function ha(e){return{xmin:e.headers.xmin,xmax:e.headers.xmax,xip_list:e.headers.xip_list}}function ga(e){if(e==null)return e;if(Array.isArray(e))return e.map(e=>ga(e));if(e instanceof Date)return e.toISOString();if(typeof e==`object`){let t=e,n={},r=Object.keys(t).sort((e,t)=>e<t?-1:+(e>t));for(let e of r)n[e]=ga(t[e]);return n}return e}function _a(e){return JSON.stringify(ga({url:e.url,params:e.params??null}))}function va(e){return`txids`in e.headers&&Array.isArray(e.headers.txids)}var ya=e=>e.reason??new t,ba=(e,t)=>{if(!t)return e;let n=()=>{},r=new Promise((e,r)=>{let i=()=>r(ya(t));t.addEventListener(`abort`,i,{once:!0}),n=()=>t.removeEventListener(`abort`,i),t.aborted&&i()});return Promise.race([e,r]).finally(n)};function xa({stream:e,syncMode:t,isBufferingInitialSync:n,waitForFullSnapshot:r,waitForEstablishedSnapshot:i,begin:o,write:s,commit:c,getCommitCursor:l,waitForCommitsAfter:u,recordSnapshotRow:d,collectionId:f,encodeColumnName:p,signal:m,isCleanupAbort:h,beforeSnapshot:g}){if(t===`eager`)return null;let _=p?{encodeColumnName:p}:void 0,v=f?`[${f}] `:``,y;function b(e,t){return m.aborted&&h()?(ra(`${v}Ignoring ${t} error during cleanup: %o`,e),!0):(ra(`${v}Error in ${t}: %o`,e),!1)}return new je({loadSubset:async f=>{let p=l(),x=()=>{if(m.aborted)throw ya(m);if(f.signal?.aborted)throw ya(f.signal)},S=()=>{if(!m.aborted)return!1;if(!h())throw ya(m);return!0},C=t=>{let n=()=>(x(),e.requestSnapshot(t)),r=y?y.then(n):n();return y=r.then(()=>void 0,()=>void 0),ba(r,f.signal)};x(),g&&(await g(),x());let w=async e=>{let t=f.signal;try{await ba(e,t)}catch(e){if(m.aborted&&h())return;throw t?.aborted?ya(t):e}if(!(m.aborted&&h())&&t?.aborted)throw ya(t)};if(r)return w(r());if(n()){let t=Pi(f,_);try{let{data:r}=await e.fetchSnapshot(t);if(!n())return ra(`${v}Ignoring snapshot - sync completed while fetching`),w(i());if(x(),r.length>0){o();for(let e of r)s({type:`insert`,value:e.value,metadata:{...e.headers}});let e=c(f.signal);for(let e of r)d?.(e.value,e);e!==!0&&await e,ra(`${v}Applied snapshot with ${r.length} rows`)}}catch(e){if(b(e,`fetchSnapshot`))return;throw f.signal?.aborted?ya(f.signal):e}if(f.signal?.aborted)throw ya(f.signal);return}if(t===`progressive`)return w(i());let{cursor:T,where:E,orderBy:ee,limit:D}=f;x();try{if(T){let e=Pi({where:E?a(E,T.whereCurrent):T.whereCurrent,orderBy:ee},_),t=Pi({where:E?a(E,T.whereFrom):T.whereFrom,orderBy:ee,limit:D},_);ra(`${v}Requesting cursor.whereCurrent snapshot (all ties)`),ra(`${v}Requesting cursor.whereFrom snapshot (with limit ${D})`),await C(e),await C(t)}else await C(Pi(f,_))}catch(e){if(f.signal?.aborted)throw ya(f.signal);if(b(e,`requestSnapshot`))return;throw e}if(f.signal?.aborted)throw ya(f.signal);if(!S()){if(await ba(u(p),f.signal),f.signal?.aborted)throw ya(f.signal);S()}}})}var Sa=class{constructor(e){this.collectionId=e,this.evidence={seenTxids:new Set,seenSnapshots:[]},this.pendingMatches=new Map,this.pendingTxidWaits=new Map,this.matchBuffer={committedMessages:[],pendingMessages:[]},this.nextWaiterId=0,this.epoch=0,this.active=!1,this.utils={awaitTxId:(e,t)=>this.awaitTxId(e,t),awaitMatch:(e,t)=>this.awaitMatch(e,t)}}start(){return this.active&&this.retire(),this.active=!0,this.epoch++,this.matchBuffer={committedMessages:[],pendingMessages:[]},this.epoch}isActive(e){return this.active&&this.epoch===e}retire(e){if(!(e!==void 0&&!this.isActive(e))){this.active=!1,this.epoch++;for(let e of this.pendingMatches.values())clearTimeout(e.timeoutId),e.reject(new Mi(this.collectionId));this.pendingMatches.clear();for(let e of this.pendingTxidWaits.values())clearTimeout(e.timeoutId),e.reject(new Mi(this.collectionId));this.pendingTxidWaits.clear(),this.matchBuffer={committedMessages:[],pendingMessages:[]},this.evidence.hydratedResumeState=void 0}}forgetEvidenceAfterScopedRecovery(){this.evidence.seenTxids.clear(),this.evidence.seenSnapshots.length=0,this.evidence.hydratedResumeState=void 0}exportMeta(){return aa(this.evidence)}importMeta(e){oa(this.evidence,e),this.resolveTxidWaiters()}get resumeState(){return this.evidence.hydratedResumeState}set resumeState(e){this.evidence.hydratedResumeState=e}publishEvidence(e,t){e.forEach(e=>this.evidence.seenTxids.add(e)),this.evidence.seenSnapshots.push(...t),this.resolveTxidWaiters()}hasTxid(e){return this.evidence.seenTxids.has(e)||this.evidence.seenSnapshots.some(t=>pt(e,t))}resolveTxidWaiters(){for(let[e,t]of this.pendingTxidWaits)this.hasTxid(t.txId)&&(clearTimeout(t.timeoutId),this.pendingTxidWaits.delete(e),t.resolve(!0))}async awaitTxId(e,t=15e3){if(ra(`${this.collectionId?`[${this.collectionId}] `:``}awaitTxId called with txid %d`,e),typeof e!=`number`)throw new ki(typeof e,this.collectionId);return this.hasTxid(e)?!0:new Promise((n,r)=>{let i=this.nextWaiterId++,a=setTimeout(()=>{this.pendingTxidWaits.delete(i),r(new Ai(e,this.collectionId))},t);this.pendingTxidWaits.set(i,{txId:e,resolve:n,reject:r,timeoutId:a})})}async awaitMatch(e,t=15e3){ra(`${this.collectionId?`[${this.collectionId}] `:``}awaitMatch called with custom function`);for(let t of this.matchBuffer.committedMessages)if(e(t))return!0;for(let n of this.matchBuffer.pendingMessages)if(e(n))return this.registerMatch(e,t,!0);return this.registerMatch(e,t,!1)}registerMatch(e,t,n){return new Promise((r,i)=>{let a=this.nextWaiterId++,o=setTimeout(()=>{this.pendingMatches.delete(a),i(new ji(this.collectionId))},t);this.pendingMatches.set(a,{matchFn:e,resolve:r,reject:i,timeoutId:o,matched:n})})}beginMatchGeneration(e){if(e.some(fa)){this.matchBuffer={committedMessages:[],pendingMessages:[]};for(let e of this.pendingMatches.values())e.matched=!1}}observeMatchMessage(e){if(st(e)||ta(e)||na(e)){this.matchBuffer.pendingMessages.push(e);let t=this.matchBuffer.committedMessages.length+this.matchBuffer.pendingMessages.length-1e3;if(t>0){let e=Math.min(t,this.matchBuffer.committedMessages.length);this.matchBuffer.committedMessages.splice(0,e),t-=e,t>0&&this.matchBuffer.pendingMessages.splice(0,t)}}let t=this.epoch;for(let[n,r]of this.pendingMatches)if(!r.matched){try{r.matched=r.matchFn(e)}catch(e){clearTimeout(r.timeoutId),this.pendingMatches.delete(n),r.reject(e instanceof Error?e:Error(String(e)))}if(!this.isActive(t))return}}commitMatches(){this.matchBuffer.committedMessages.push(...this.matchBuffer.pendingMessages),this.matchBuffer.pendingMessages=[],this.matchBuffer.committedMessages.length>1e3&&this.matchBuffer.committedMessages.splice(0,this.matchBuffer.committedMessages.length-1e3);for(let[e,t]of this.pendingMatches)t.matched&&(clearTimeout(t.timeoutId),this.pendingMatches.delete(e),t.resolve(!0))}};function Ca(e){let t=new Sa(e.id),r=t,i=e.syncMode??`eager`,a=i===`progressive`?`on-demand`:i,o=new WeakMap,l=(e,t)=>r.utils.awaitTxId(e,t),u=(e,t)=>r.utils.awaitMatch(e,t),d=wa(e.shapeOptions,{getLifecycle:e=>o.get(e)??t,syncMode:i,collectionId:e.id,testHooks:e[ia]}),p=async(e,t)=>{if((typeof e==`object`&&e||typeof e==`function`)&&`txid`in e){let r=e;n(`electric-collection-txid-return`,"[TanStack DB] DEPRECATED: Returning { txid } from mutation handlers is deprecated and will be removed in v1.0. Use `await collection.utils.awaitTxId(txid)` instead of returning { txid }. See migration guide: https://tanstack.com/db/latest/docs/collections/electric-collection#persistence-handlers--synchronization");let i=r.timeout;Array.isArray(r.txid)?await Promise.all(r.txid.map(e=>t(e,i))):await t(r.txid,i)}},m=e=>e.collection?.utils?.awaitTxId??l,h=e.onInsert?async t=>{await p(await e.onInsert(t),m(t))}:void 0,g=e.onUpdate?async t=>{await p(await e.onUpdate(t),m(t))}:void 0,_=e.onDelete?async t=>{await p(await e.onDelete(t),m(t))}:void 0,{shapeOptions:v,onInsert:y,onUpdate:b,onDelete:x,...S}=e,C={awaitTxId:l,awaitMatch:u},w=()=>{let n=t;return t=new Sa(e.id),r=n,n},T=(e,t)=>{let n=w(),r;return Object.assign(t,n.utils),c({...e,sync:t=>(o.has(t.collection)||(r=t.collection,o.set(t.collection,n)),e.sync(t)),exportSyncMeta:()=>n.exportMeta(),importSyncMeta:e=>n.importMeta(e),mergeSyncMeta:la},()=>{n.retire(),r&&o.delete(r)})},E=s({...d,exportSyncMeta:()=>t.exportMeta(),importSyncMeta:e=>t.importMeta(e),mergeSyncMeta:la},T),ee={...S,syncMode:a,sync:E,onInsert:h,onUpdate:g,onDelete:_,utils:C};return Object.defineProperty(ee,`utils`,{enumerable:!0,get:()=>({...C})}),f(ee,()=>Ca(e))}function wa(n,r){let{getLifecycle:i,syncMode:a,collectionId:o,testHooks:s}=r,c,l=()=>{let e=new Map,t=t=>{let n=e.get(t);if(n)return n;let r=Gi(t);return e.set(t,r),r},n=new Map,r=[],i,a=new Map,s,c=e=>{if(r.length<e)for(let t=r.length;t<e;t++)r[t]=new Map},l=(e,n,a)=>{for(let s of e){let e=t(s);i===void 0&&(i=Ji(e),c(i));let l=Ji(e);if(l!==i){ra(`${o?`[${o}] `:``}Tag length mismatch: expected ${i}, got ${l}`);continue}a.add(s),Xi(e,n,r,i)}},u=(n,a,o)=>{if(i!==void 0)for(let s of n){let n=t(s);o.delete(s),Zi(n,a,r,i),e.delete(s)}},d=(e,r,i,o)=>{n.has(i)||n.set(i,new Set);let c=n.get(i);return e&&(l(e,i,c),s===void 0&&(s=$i(e.map(t)))),r&&u(r,i,c),o&&o.length>0&&a.set(i,[...o]),c},f=()=>{n.clear(),r.length=0,i=void 0,a.clear(),s=void 0},p=o=>{if(i===void 0)return;let s=n.get(o);if(s){for(let n of s){let a=t(n);Ji(a)===i&&Zi(a,o,r,i),e.delete(n)}n.delete(o),a.delete(o)}},m=(o,c)=>{let l=n.get(o);if(!l)return!1;let u=a.get(o);if(u&&s){if(u[c.pos]=!1,!ea(u,s)){for(let n of l)Zi(t(n),o,r,i),e.delete(n);return n.delete(o),a.delete(o),!0}return!1}for(let e of l){let n=t(e);Yi(n,c)&&(l.delete(e),Zi(n,o,r,i))}return l.size===0?(n.delete(o),!0):!1};return{hasTags:()=>i!==void 0,processTagsForChangeMessage:d,clearTagTrackingState:f,clearTagsForRow:p,processMoveOutEvent:(e,t,n,a,s)=>{if(i===void 0)return ra(`${o?`[${o}] `:``}Received move-out message but no tag length set yet, ignoring`),a;let c=a;for(let i of e){let e=Qi(i,r);for(let r of e)m(r,i)&&(c||=(t(),!0),n({type:`delete`,key:r}),s(r))}return c},processMoveInEvent:e=>{if(i===void 0){ra(`${o?`[${o}] `:``}Received move-in message but no tag length set yet, ignoring`);return}for(let t of e){let e=Qi(t,r);for(let n of e){let e=a.get(n);e&&(e[t.pos]=!0)}}}}},u=new WeakMap,f=(e,t=!1)=>{let r=u.has(e.collection),f=u.get(e.collection);f||(f=l(),u.set(e.collection,f));let{processTagsForChangeMessage:m,clearTagTrackingState:h,clearTagsForRow:g,processMoveOutEvent:_,processMoveInEvent:v}=f;t&&h();let y=i(e.collection);t&&y.forgetEvidenceAfterScopedRecovery();let b=y.start(),x=()=>y.isActive(b);Object.assign(e.collection.utils,y.utils);let{begin:S,write:C,commit:w,markReady:T,markError:E,truncate:ee,collection:D,metadata:O}=e,te=0,ne=new Map,k=e=>{let t=++te,n=w(e);if(n===!0)return!0;ne.set(t,n);let r=()=>ne.delete(t);return n.then(r,r),n},A=async e=>{await Promise.all(Array.from(ne,([t,n])=>t>e?n:void 0))},j=O===void 0?null:d(O.persistence),re=j?.hydrateBaseline,M=j?.resumeSnapshot,ie=M?.certify,ae=M?.getKeySetEvidence,oe=M?.expectCurrentCommit,se=ae?.(),N=t?void 0:O?.collection.get(`electric:resume`),P=sa(N),ce=N!==void 0&&P===void 0,F=ua(P,y.resumeState),I=_a({url:n.url,params:n.params}),le=F?.kind===`resume`&&F.shapeId!==I,ue=F?.kind===`resume`&&ae!==void 0&&se?.status!==`consistent`,de=j?.managedCacheGeneration===!0&&se?.status===`incompatible`,L=!t&&(de||n.offset===void 0&&n.handle===void 0&&(F!==void 0||ce)&&(ce||le||F?.kind===`reset`||ue||!r&&F?.kind===`resume`&&F.requiresTagState!==!1)),fe=a===`on-demand`&&L&&j?.managedCacheGeneration===!0&&j.startScopedRecovery!==void 0;fe&&y.forgetEvidenceAfterScopedRecovery();let pe=a===`on-demand`&&(!L||fe),me=a===`on-demand`&&!pe,he=me||a===`progressive`,ge=()=>{},R=()=>{},_e=Promise.resolve(),ve=()=>{he&&(_e=new Promise((e,t)=>{ge=t=>e(t===!0?void 0:t),R=t}),_e.catch(()=>void 0))};ve();let ye=n.offset===void 0&&n.handle===void 0&&F?.kind===`resume`&&!le&&!L,be=n.offset!==void 0&&n.offset!==`-1`;!ye&&!be&&h();let xe=n.params?.replica===`full`,Se=ye&&ie!==void 0,Ce=a!==`on-demand`&&(ye||be&&!xe),we=(a===`eager`||L&&!fe)&&!ye&&!be&&re!==void 0,Te=null,Ee=0,De=(e,t=Ee)=>{!x()||Ee!==t||(e&&a===`progressive`&&s?.beforeMarkingReady?(Te=s.beforeMarkingReady(),Te.then(()=>{Ee===t&&T()})):T())},Oe=new AbortController,ke=!1,Ae=!1,je=!1,Me=!1,Ne=e=>{je||(Ae=!0,E(e))},Pe=(e,t)=>{Me||D.status!==`loading`||(t===void 0?x()?De(e,Ee):T():(Ae=!0,E(t)))},Fe=()=>{let e=x()&&D.status===`loading`;Oe.abort(),e&&Ne(new Mi(o))};n.signal&&(n.signal.addEventListener(`abort`,Fe,{once:!0}),n.signal.aborted&&Fe()),Oe.signal.addEventListener(`abort`,()=>{R(new Mi(o)),y.retire(b)});let Ie=new yi({...n,log:pe?`changes_only`:void 0,offset:n.offset??(ye?F.offset:pe?`now`:void 0),handle:n.handle??(ye?F.handle:void 0),signal:Oe.signal,onError:async e=>{if(!x()||Oe.signal.aborted)return;Ee++;let t=e=>{R(e),D.status===`loading`&&Ne(e)};if(n.onError){let r;try{r=await n.onError(e)}catch(e){throw t(e),e}return(!r||typeof r!=`object`)&&t(e),r}else{let n=D.status===`loading`;t(e),console.error(`An error occurred while syncing collection: ${D.id},
|
|
12
|
+
`+(n?`the initial sync has been marked as failed.
|
|
13
|
+
`:`the last ready snapshot has been preserved.
|
|
14
|
+
`)+`You can provide an 'onError' handler on the shapeOptions to handle this error, and this message will not be logged.`,e)}}}),z=!1,Le=new Set,Re=[],B=a===`progressive`&&Ce;B&&ge(!0);let V=!1,ze=0,Be=()=>a===`progressive`&&!B&&!V,H=[],U=new Map,W=new Map,G=!0,Ve=0,K=(e,t)=>{Ve++,W.set(e,t)},He=()=>{Ve++,W.clear(),U.clear(),G=!1},Ue=()=>{let e=Ve,t=k();if(O?.persistence){let n=()=>{Ve===e&&(W.clear(),G=!0)};t===!0?n():t.then(n,()=>void 0)}return t},We=()=>{S(),O?.persistence?.reserveCommitTurn()},Ge=new Set,Ke=!1,qe=()=>{if(!x()||Ke||fe||t)return;let e=Ie.shapeHandle,n=Ie.lastOffset;if(!e||n===`-1`)return;let r={kind:`resume`,offset:n,handle:e,shapeId:I,updatedAt:Date.now(),requiresTagState:f.hasTags()};y.resumeState=r,O?.collection.set(`electric:resume`,r)},Je=(e=!1)=>{let t={kind:`reset`,updatedAt:Math.max(Date.now(),F?.updatedAt??0,y.resumeState?.updatedAt??0)+1};y.resumeState=t,O&&(S(),O.collection.set(`electric:resume`,t),e&&oe?.(),k())};L&&!fe&&(ce||le||F?.kind===`resume`)&&Je(!0);let Ye=fe?F?.kind===`reset`?F:y.resumeState?.kind===`reset`?y.resumeState:{kind:`reset`,updatedAt:Date.now()}:void 0;Ye&&(y.resumeState=Ye);let Xe=Ye&&j?.startScopedRecovery?j.startScopedRecovery({key:`electric:resume`,value:Ye}):void 0,Ze=e=>{if(!st(e))return;let t=e.headers.tags,n=e.headers.removed_tags,r=t||n,i=e.headers.active_conditions,a=D.getKeyFromItem(e.value),o=e.headers.operation,s=o===`delete`,c=o===`insert`&&Ge.has(a);s?Ge.delete(a):Ge.add(a),s?g(a):r&&m(t,n,a,i),C({type:c?`update`:o,value:e.value,metadata:{...e.headers}})},Qe=xa({stream:Ie,syncMode:a,isBufferingInitialSync:Be,waitForFullSnapshot:me?()=>_e:void 0,waitForEstablishedSnapshot:()=>_e,begin:S,write:C,commit:k,getCommitCursor:()=>te,waitForCommitsAfter:A,recordSnapshotRow:(e,t)=>{K(D.getKeyFromItem(e),!0),U.set(D.getKeyFromItem(e),t)},collectionId:o,encodeColumnName:n.columnMapper?.encode,signal:Oe.signal,isCleanupAbort:()=>ke,beforeSnapshot:Xe?()=>Xe:void 0}),$e=Xe??(Ce||we?re?(async()=>{await re();let e=ae?.();if(ye&&e?.status!==`consistent`)throw Error(`Electric persisted resume baseline could not be certified during hydration`)})():void 0:Se?(async()=>{if(await ie(),ae?.()?.status!==`consistent`)throw Error(`Electric persisted resume baseline could not be certified`)})():void 0),et=!$e,tt=[],nt=()=>{},rt=()=>{if(Ke=!0,z){let e=new AbortController;e.abort(),k(e.signal),z=!1}Ge.clear(),Le.clear(),Re.length=0,Je(),Ee++,nt(),Oe.abort(),E(Error(`Electric resume state referenced an unseen row; a full snapshot is required`))},it=e=>{if(!x()||Ke)return;if(we&&(we=!1,We(),z=!0,ee(),He(),Ge.clear(),h(),V=!0,ze++),!O?.persistence&&!z){W.clear(),G=!0;for(let e of D._state.pendingSyncedTransactions){e.truncate&&(W.clear(),G=!1);for(let t of e.operations)W.set(t.key,t.type!==`delete`)}for(let e of H)st(e)&&W.set(D.getKeyFromItem(e.value),e.headers.operation!==`delete`)}let t=null;y.beginMatchGeneration(e);for(let n of e){if(y.observeMatchMessage(n),!x())return;if(va(n)&&(!Be()||z)&&n.headers.txids?.forEach(e=>Le.add(e)),st(n)){let e=D.getKeyFromItem(n.value),t=n.headers.operation,r=W.get(e)??(G&&D._state.syncedData.has(e));if(t===`update`&&!r){if(Ce&&!V){rt();return}if(!xe)continue}K(e,t!==`delete`),t!==`update`&&U.delete(e)}if(st(n)){let e=n.headers.schema;if(e&&typeof e==`string`&&(c=e),Be()&&!z){if(n.headers.operation===`update`){let e=D.getKeyFromItem(n.value),t=U.get(e);t&&(H.push(t),U.delete(e))}H.push(n)}else z||=(We(),!0),Ze(n)}else pa(n)?(!Be()||z)&&Re.push(ha(n)):da(n)?t=`up-to-date`:ma(n)?t!==`up-to-date`&&(t=`subset-end`):ta(n)?Be()&&!z?H.push(n):z=_(n.headers.patterns,We,C,z,e=>{K(e,!1),Ge.delete(e)}):na(n)?Be()&&!z?H.push(n):v(n.headers.patterns):fa(n)&&(B&&ve(),ra(`${o?`[${o}] `:``}Received must-refetch message, starting transaction with truncate`),Je(),z||=(We(),!0),ee(),h(),Ge.clear(),He(),V=!0,ze++,Qe?.reset(),t=null,B=!1,H.length=0,U.clear())}if(!(L&&!fe&&V&&t===`subset-end`)&&t!==null){let e=!0,n=Be(),r=V&&t===`up-to-date`,i=ze;if(Be()&&t===`up-to-date`&&!z){ra(`${o?`[${o}] `:``}Progressive mode: Performing atomic swap with ${H.length} buffered messages`),We(),ee(),h(),Ge.clear();for(let e of H)st(e)?(Ze(e),va(e)&&e.headers.txids?.forEach(e=>Le.add(e))):pa(e)?Re.push(ha(e)):ta(e)?_(e.headers.patterns,S,C,!0,e=>{K(e,!1),Ge.delete(e)}):na(e)&&v(e.headers.patterns);qe(),e=Ue(),H.length=0,U.clear(),ra(`${o?`[${o}] `:``}Progressive mode: Atomic swap complete, now in normal sync mode`)}else z?((!V||r)&&qe(),e=Ue(),z=!1):t===`up-to-date`&&O&&(We(),qe(),e=Ue());let a=Ee,s=p(e),c=t===`up-to-date`&&D.status===`loading`;if(t===`up-to-date`&&ge(e),s===!0?De(n,a):c?(je=!0,s.then(()=>Pe(n),e=>Pe(n,e))):s.then(()=>De(n,a),()=>void 0),e!==!0&&e.then(()=>void 0,e=>{!x()||Oe.signal.aborted||(Ee++,nt(),Oe.abort(),D.status!==`error`&&E(e))}),r){let t=()=>{ze===i&&(V=!1)};e===!0?t():e.then(t,()=>void 0)}t===`up-to-date`&&(B=!0),Le.size>0&&ra(`${o?`[${o}] `:``}new txids synced from pg %O`,Array.from(Le)),Re.forEach(e=>ra(`${o?`[${o}] `:``}new snapshot synced from pg %o`,e)),y.publishEvidence(Le,Re),Le.clear(),Re.length=0,y.commitMatches()}};return nt=Ie.subscribe(e=>{if(!et){tt.push([...e]);return}it(e)},e=>{R(e),x()&&!Oe.signal.aborted&&D.status===`loading`&&Ne(e)}),!et&&$e&&$e.then(()=>{Oe.signal.aborted||(et=!0,tt.splice(0).forEach(it))},e=>{Oe.signal.aborted||(tt.length=0,Ke=!0,R(e),Je(),Ee++,nt(),Oe.abort(),E(e))}),{loadSubset:Qe?.loadSubset,cleanup:()=>{if(Me=!0,!Oe.signal.aborted&&!Ae&&(ke=!0),n.signal?.removeEventListener(`abort`,Fe),nt(),Oe.abort(),z){z=!1;let e=new AbortController;e.abort();let t=k(e.signal);t!==!0&&t.catch(()=>void 0)}tt.length=0,Qe?.reset(),y.retire(b)}}};return{getSyncMetadata:()=>({relation:n.params?.table?[c||`public`,n.params.table]:void 0}),sync:n=>{if(a!==`on-demand`||!n.metadata?.persistence?.managedCacheGeneration)return f(n);let r=f(n),i,o=new Promise(e=>{i=e}),s,c,l=0,u=!1,d=!1,p=()=>d,m=()=>{if(u)return Promise.resolve();u=!0;try{return Promise.resolve(r.cleanup())}catch(e){return Promise.reject(e)}},h=e=>{let t=e.catch(e=>{throw c={error:e},e}).finally(()=>{s===t&&(s=void 0)});return s=t,t},g=e=>{p()||e!==l||(r=f(n,!0),u=!1,o=new Promise(e=>{i=e}))};return{loadSubset:async e=>{for(;!p();){if(c)throw c.error;if(e.signal?.aborted)throw e.signal.reason??new t;let n=r,i=o,a=n.loadSubset?.(e)??!0;if(await Promise.race([Promise.resolve(a).then(()=>`settled`),i.then(()=>`retired`)])===`settled`)return;s&&await ba(s,e.signal)}if(c)throw c.error},restartAfterScopedRecovery:e=>{if(p())return Promise.resolve();if(c)return Promise.reject(c.error);let t=++l;i();let n=m();if(s){let r=s;return h((async()=>{await Promise.all([r,n]),await e,g(t)})())}return h((async()=>{await n,await e,g(t)})())},cleanup:async()=>{d=!0,i();try{await s}catch(t){if(!(t instanceof e))throw t}await m()}}}}}var Ta=`http://localhost:4000`;async function Ea(e){if(e.ok)return e.json();let t=await e.json().catch(()=>null);throw Error(t?.error??`API error: ${e.status}`)}async function Da(e,t){return Ea(await fetch(`${Ta}/api/${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}))}async function Oa(e,t){return Ea(await fetch(`${Ta}/api/${e}/${t}`,{method:`DELETE`}))}async function ka(e,t,n){return Ea(await fetch(`${Ta}/api/${e}/${t}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}))}async function Aa(e){return Ea(await fetch(`${Ta}/api/lists/create`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}))}async function ja(e){return Ea(await fetch(`${Ta}/api/lists/${e}/delete`,{method:`DELETE`}))}async function Ma(e,t){return Ea(await fetch(`${Ta}/api/lists/${e}/update`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}))}async function Na(e){return Ea(await fetch(`${Ta}/api/repos/${e}/unstar`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})}))}async function Pa(e,t){return Ea(await fetch(`${Ta}/api/lists/${e}/add-repo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}))}async function Fa(e,t){return Ea(await fetch(`${Ta}/api/lists/${e}/remove-repo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({repo_id:t})}))}var Ia=`local`,La=Ia===`demo`,Ra=(La?Object.values(Object.assign({}))[0]:void 0)?.user??null;async function za(e,t,n){let r=await fetch(`/api/local/${t}`,{method:e,headers:{"Content-Type":`application/json`},body:e===`GET`?void 0:JSON.stringify(n)}),i=await r.json();if(!r.ok)throw Error(i.error??`GitHub request failed (${r.status}).`);return i}var Ba={importStars:()=>za(`POST`,`import`,{}),scoreHealth:e=>za(`POST`,`health`,e),createList:e=>za(`POST`,`lists`,e),updateList:(e,t)=>za(`PATCH`,`lists/${encodeURIComponent(e)}`,t),deleteList:e=>za(`DELETE`,`lists/${encodeURIComponent(e)}`,{}),changeMembership:e=>za(`POST`,`membership`,e),unstar:e=>za(`POST`,`unstar`,e),listBackups:()=>za(`GET`,`backups`,void 0),backUpNow:e=>za(`POST`,`backups`,e),readBackup:e=>za(`GET`,`backups/${encodeURIComponent(e)}`,void 0),uploadBackup:e=>za(`POST`,`backups/upload`,e),planRestore:e=>za(`POST`,`restore/plan`,e),applyRestore:e=>za(`POST`,`restore/apply`,e)};function Va(e){let t=e instanceof Error?e.message:String(e);me.error(t,{id:t})}async function Ha(e){try{return await e()}catch(e){throw Va(e),e}}var Ua=`modulepreload`,Wa=function(e){return`/`+e},Ga={},Ka=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Wa(t,n),t in Ga)return;Ga[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Ua,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},qa=`http://localhost:4000`;function Ja(e){return new URL(`${qa}/api/electric/${e}`,window.location.origin).toString()}var Ya=await Xa();async function Xa(){let e=await Ka(()=>import(`./esm-Cyyp48ez.js`),__vite__mapDeps([0,1]));return{persistence:e.createBrowserWASQLitePersistence({database:await e.openBrowserWASQLiteOPFSDatabase({databaseName:`stars-organizer.sqlite`}),coordinator:new e.BrowserCollectionCoordinator({dbName:`stars-organizer`})}),persistedCollectionOptions:e.persistedCollectionOptions}}var Za=1;function Qa(e,t){let n=e=>e.id;if(Ya){let r=t.local;return Ya.persistedCollectionOptions({id:e,getKey:n,persistence:Ya.persistence,schemaVersion:Za,onInsert:r.insert&&(async({transaction:e})=>{for(let t of e.mutations)await Ha(()=>r.insert(t.modified,e))}),onUpdate:r.update&&(async({transaction:e})=>{for(let t of e.mutations)await Ha(()=>r.update(t.original,t.changes))}),onDelete:r.delete&&(async({transaction:e})=>{for(let t of e.mutations)await Ha(()=>r.delete(t.original,e))})})}let{server:r}=t;return Ca({id:e,shapeOptions:{url:Ja(e)},getKey:n,onInsert:r.insert&&(async({transaction:e,collection:t})=>{for(let n of e.mutations)await Ha(async()=>t.utils.awaitTxId((await r.insert(n.modified)).txid))}),onUpdate:r.update&&(async({transaction:e,collection:t})=>{for(let n of e.mutations)await Ha(async()=>t.utils.awaitTxId((await r.update(n.original,n.changes)).txid))}),onDelete:r.delete&&(async({transaction:e,collection:t})=>{for(let n of e.mutations)await Ha(async()=>t.utils.awaitTxId((await r.delete(n.original)).txid))})})}var $a=u(Qa(`repos`,{server:{insert:e=>Da(`repos`,e),update:(e,t)=>ka(`repos`,e.id,t),delete:e=>Na(e.id)},local:{delete:async(e,t)=>{await Ba.unstar({owner:e.owner,name:e.name}),ao(t,()=>oo(to,t=>t.repo_id===e.id)),ao(t,()=>oo(ro,t=>t.repo_id===e.id))}}})),eo=u(Qa(`lists`,{server:{insert:e=>Aa({name:e.name,description:e.description}),update:(e,t)=>Ma(e.id,t),delete:e=>ja(e.id)},local:{insert:async(e,t)=>{let{githubListId:n}=await Ba.createList({name:e.name,description:e.description??null});ao(t,()=>eo.update(e.id,e=>{e.github_list_id=n}))},update:async(e,t)=>{e.github_list_id&&await Ba.updateList(e.github_list_id,{name:t.name,description:t.description})},delete:async(e,t)=>{e.github_list_id&&await Ba.deleteList(e.github_list_id),ao(t,()=>oo(to,t=>t.list_id===e.id))}}})),to=u(Qa(`list_items`,{server:{insert:e=>Pa(e.list_id,{repo_id:e.repo_id}),delete:e=>Fa(e.list_id,e.repo_id)},local:{insert:e=>so(e,`add`),delete:e=>so(e,`remove`)}})),no=u(Qa(`tags`,{server:{insert:e=>Da(`tags`,e),delete:e=>Oa(`tags`,e.id)},local:{}})),ro=u(Qa(`repo_tags`,{server:{insert:e=>Da(`repo_tags`,e),delete:e=>Oa(`repo_tags`,e.id)},local:{}}));async function io(e){let t=i({mutationFn:async({transaction:e})=>{for(let t of[$a,eo,to,no,ro])await t.utils.acceptMutations(e)}});t.mutate(e),await t.isPersisted.promise}function ao(e,t){e.isPersisted.promise.then(()=>io(t))}function oo(e,t){let n=e.toArray.filter(t).map(e=>e.id);n.length>0&&e.delete(n)}async function so(e,t){let n=$a.get(e.repo_id),r=eo.get(e.list_id)?.github_list_id;if(n?.node_id){if(!r)throw Error(`That List is still being created on GitHub. Try again in a moment.`);await Ba.changeMembership({repoNodeId:n.node_id,repoGithubId:n.github_id,githubListId:r,change:t})}}var co=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),lo=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),uo=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),fo=e=>{let t=uo(e);return t.charAt(0).toUpperCase()+t.slice(1)},po={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`},mo=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ho=(0,j.createContext)({}),go=()=>(0,j.useContext)(ho),_o=(0,j.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=go()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,j.createElement)(`svg`,{ref:c,...po,width:t??l??po.width,height:t??l??po.height,stroke:e??f,strokeWidth:m,className:co(`lucide`,p,i),...!a&&!mo(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,j.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),vo=(e,t)=>{let n=(0,j.forwardRef)(({className:n,...r},i)=>(0,j.createElement)(_o,{ref:i,iconNode:t,className:co(`lucide-${lo(fo(e))}`,`lucide-${e}`,n),...r}));return n.displayName=fo(e),n};function yo(){return typeof window<`u`}function bo(e){return Co(e)?(e.nodeName||``).toLowerCase():`#document`}function xo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function So(e){return((Co(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Co(e){return yo()?e instanceof Node||e instanceof xo(e).Node:!1}function wo(e){return yo()?e instanceof Element||e instanceof xo(e).Element:!1}function To(e){return yo()?e instanceof HTMLElement||e instanceof xo(e).HTMLElement:!1}function Eo(e){return!yo()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof xo(e).ShadowRoot}function Do(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ro(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Oo(e){return/^(table|td|th)$/.test(bo(e))}function ko(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ao=/transform|translate|scale|rotate|perspective|filter/,jo=/paint|layout|strict|content/,Mo=e=>!!e&&e!==`none`,No;function Po(e){let t=wo(e)?Ro(e):e;return Mo(t.transform)||Mo(t.translate)||Mo(t.scale)||Mo(t.rotate)||Mo(t.perspective)||!Io()&&(Mo(t.backdropFilter)||Mo(t.filter))||Ao.test(t.willChange||``)||jo.test(t.contain||``)}function Fo(e){let t=Bo(e);for(;To(t)&&!Lo(t);){if(Po(t))return t;if(ko(t))return null;t=Bo(t)}return null}function Io(){return No??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),No}function Lo(e){return/^(html|body|#document)$/.test(bo(e))}function Ro(e){return xo(e).getComputedStyle(e)}function zo(e){return wo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Bo(e){if(bo(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Eo(e)&&e.host||So(e);return Eo(t)?t.host:t}function Vo(e){let t=Bo(e);return Lo(t)?e.ownerDocument?e.ownerDocument.body:e.body:To(t)&&Do(t)?t:Vo(t)}function Ho(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Vo(e),i=r===e.ownerDocument?.body,a=xo(r);if(i){let e=Uo(a);return t.concat(a,a.visualViewport||[],Do(r)?r:[],e&&n?Ho(e):[])}else return t.concat(r,Ho(r,[],n))}function Uo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Wo={};function Go(e,t){let n=j.useRef(Wo);return n.current===Wo&&(n.current=e(t)),n}var Ko=j[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],qo=Ko&&Ko!==j.useLayoutEffect?Ko:e=>e();function Jo(e){let t=Go(Yo).current;return t.next=e,qo(t.effect),t.trampoline}function Yo(){let e={next:void 0,callback:Xo,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Xo(){}var Zo={...j},Qo=typeof document<`u`?j.useLayoutEffect:()=>{};function $o(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var es={};function ts(e,t,n,r,i){if(!n&&!r&&!i&&!e)return rs(t);let a=rs(e);return t&&(a=is(a,t)),n&&(a=is(a,n)),r&&(a=is(a,r)),i&&(a=is(a,i)),a}function ns(e){if(e.length===0)return es;if(e.length===1)return rs(e[0]);let t=rs(e[0]);for(let n=1;n<e.length;n+=1)t=is(t,e[n]);return t}function rs(e){return cs(e)?{...ls(e,es)}:as(e)}function is(e,t){return cs(t)?ls(t,e):os(e,t)}function as(e){let t={...e};for(let e in t){let n=t[e];ss(e,n)&&(t[e]=ds(n))}return t}function os(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=$o(e.style,r);break;case`className`:e[n]=ps(e.className,r);break;default:ss(n,r)?e[n]=us(e[n],r):e[n]=r}}return e}function ss(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function cs(e){return typeof e==`function`}function ls(e,t){return cs(e)?e(t):e??es}function us(e,t){return t?e?(...n)=>{let r=n[0];if(ms(r)){let i=r;fs(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:ds(t):e}function ds(e){return e&&((...t)=>{let n=t[0];return ms(n)&&fs(n),e(...t)})}function fs(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function ps(e,t){return t?e?t+` `+e:t:e}function ms(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function hs(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var gs=hs(`https://base-ui.com/production-error`,`Base UI`),_s=j.createContext(void 0);function vs(e=!1){let t=j.useContext(_s);if(t===void 0&&!e)throw Error(gs(16));return t}function ys(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:j.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function bs(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=j.useRef(null),s=vs(!0),c=a??s!==void 0,{props:l}=ys({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=j.useCallback(()=>{let e=o.current;xs(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Qo(u,[u]),{getButtonProps:j.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return ts({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(fs(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=xs(a),l=!i&&Ss(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(fs(e),a?.(e),e.target===e.currentTarget&&i&&c&&xs(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?void 0:{role:`button`},l,u)},[t,l,c,i]),buttonRef:Jo(e=>{o.current=e,u()})}}function xs(e){return To(e)&&e.tagName===`BUTTON`}function Ss(e){return!!(e?.tagName===`A`&&e?.href)}function Cs(e,t,n,r){let i=Go(Ts).current;return Es(i,e,t,n,r)&&Os(i,[e,t,n,r]),i.callback}function ws(e){let t=Go(Ts).current;return Ds(t,e)&&Os(t,e),t.callback}function Ts(){return{callback:null,cleanup:null,refs:[]}}function Es(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Ds(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function Os(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var ks=19;function As(e){return ks>=e}function js(e){if(!j.isValidElement(e))return null;let t=e,n=t.props;return(As(19)?n?.ref:t.ref)??null}function Ms(){}var Ns=Object.freeze([]),Ps=Object.freeze({});function Fs(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function Is(e,t){return typeof e==`function`?e(t):e}function Ls(e,t){return typeof e==`function`?e(t):e}function Rs(e,t,n={}){let r=t.render,i=zs(t,n);return n.enabled===!1?null:Hs(e,r,i,n.state??Ps)}function zs(e,t={}){let{className:n,style:r,render:i}=e,{state:a=Ps,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?Is(n,a):void 0,d=l?Ls(r,a):void 0,f=l?Fs(a,c):Ps,p=l&&s?Bs(s):void 0,m=l?$o(f,p)??{}:Ps;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=ws([m.ref,js(i),...o]):m.ref=Cs(m.ref,js(i),o):Cs(null,null)),l?(u!==void 0&&(m.className=ps(m.className,u)),d!==void 0&&(m.style=$o(m.style,d)),m):Ps}function Bs(e){return Array.isArray(e)?ns(e):ts(void 0,e)}var Vs=Symbol.for(`react.lazy`);function Hs(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=ts(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===Vs&&(i=j.Children.toArray(t)[0]),j.cloneElement(i,e)}if(e&&typeof e==`string`)return Us(e,n);throw Error(gs(8))}function Us(e,t){return e===`button`?(0,j.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,j.createElement)(`img`,{alt:``,...t,key:t.key}):j.createElement(e,t)}var Ws=j.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=bs({disabled:i,focusableWhenDisabled:a,native:o});return Rs(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})});function Gs(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Gs(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Ks(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Gs(e))&&(r&&(r+=` `),r+=t);return r}var qs=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Js=Ks,Ys=(e,t)=>n=>{if(t?.variants==null)return Js(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=qs(t)||qs(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Js(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Xs=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Zs=(e,t)=>({classGroupId:e,validator:t}),Qs=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),$s=`-`,ec=[],tc=`arbitrary..`,nc=e=>{let t=ac(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return ic(e);let n=e.split($s);return rc(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Xs(i,t):t:i||ec}return n[e]||ec}}},rc=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=rc(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join($s):e.slice(t).join($s),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},ic=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?tc+r:void 0})(),ac=e=>{let{theme:t,classGroups:n}=e;return oc(n,t)},oc=(e,t)=>{let n=Qs();for(let r in e){let i=e[r];sc(i,n,r,t)}return n},sc=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];cc(i,t,n,r)}},cc=(e,t,n,r)=>{if(typeof e==`string`){lc(e,t,n);return}if(typeof e==`function`){uc(e,t,n,r);return}dc(e,t,n,r)},lc=(e,t,n)=>{let r=e===``?t:fc(t,e);r.classGroupId=n},uc=(e,t,n,r)=>{if(pc(e)){sc(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Zs(n,e))},dc=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];sc(o,fc(t,a),n,r)}},fc=(e,t)=>{let n=e,r=t.split($s),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Qs(),n.nextPart.set(t,i)),n=i}return n},pc=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,mc=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},hc=`!`,gc=`:`,_c=[],vc=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),yc=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===gc){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(hc)?(c=s.slice(0,-1),l=!0):s.startsWith(hc)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return vc(t,l,c,u)};if(t){let e=t+gc,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):vc(_c,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},bc=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},xc=e=>({cache:mc(e.cacheSize),parseClassName:yc(e),sortModifiers:bc(e),...nc(e)}),Sc=/\s+/,Cc=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Sc),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+hc:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},wc=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Tc(n))&&(i&&(i+=` `),i+=r);return i},Tc=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Tc(e[r]))&&(n&&(n+=` `),n+=t);return n},Ec=(e,...t)=>{let n,r,i,a,o=o=>(n=xc(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Cc(e,n);return i(e,a),a};return a=o,(...e)=>a(wc(...e))},Dc=[],X=e=>{let t=t=>t[e]||Dc;return t.isThemeGetter=!0,t},Oc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,kc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ac=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,jc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Mc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Nc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Pc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Fc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ic=e=>Ac.test(e),Z=e=>!!e&&!Number.isNaN(Number(e)),Lc=e=>!!e&&Number.isInteger(Number(e)),Rc=e=>e.endsWith(`%`)&&Z(e.slice(0,-1)),zc=e=>jc.test(e),Bc=()=>!0,Vc=e=>Mc.test(e)&&!Nc.test(e),Hc=()=>!1,Uc=e=>Pc.test(e),Wc=e=>Fc.test(e),Gc=e=>!Q(e)&&!$(e),Kc=e=>sl(e,dl,Hc),Q=e=>Oc.test(e),qc=e=>sl(e,fl,Vc),Jc=e=>sl(e,pl,Z),Yc=e=>sl(e,hl,Bc),Xc=e=>sl(e,ml,Hc),Zc=e=>sl(e,ll,Hc),Qc=e=>sl(e,ul,Wc),$c=e=>sl(e,gl,Uc),$=e=>kc.test(e),el=e=>cl(e,fl),tl=e=>cl(e,ml),nl=e=>cl(e,ll),rl=e=>cl(e,dl),il=e=>cl(e,ul),al=e=>cl(e,gl,!0),ol=e=>cl(e,hl,!0),sl=(e,t,n)=>{let r=Oc.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},cl=(e,t,n=!1)=>{let r=kc.exec(e);return r?r[1]?t(r[1]):n:!1},ll=e=>e===`position`||e===`percentage`,ul=e=>e===`image`||e===`url`,dl=e=>e===`length`||e===`size`||e===`bg-size`,fl=e=>e===`length`,pl=e=>e===`number`,ml=e=>e===`family-name`,hl=e=>e===`number`||e===`weight`,gl=e=>e===`shadow`,_l=Ec(()=>{let e=X(`color`),t=X(`font`),n=X(`text`),r=X(`font-weight`),i=X(`tracking`),a=X(`leading`),o=X(`breakpoint`),s=X(`container`),c=X(`spacing`),l=X(`radius`),u=X(`shadow`),d=X(`inset-shadow`),f=X(`text-shadow`),p=X(`drop-shadow`),m=X(`blur`),h=X(`perspective`),g=X(`aspect`),_=X(`ease`),v=X(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),$,Q],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[$,Q,c],T=()=>[Ic,`full`,`auto`,...w()],E=()=>[Lc,`none`,`subgrid`,$,Q],ee=()=>[`auto`,{span:[`full`,Lc,$,Q]},Lc,$,Q],D=()=>[Lc,`auto`,$,Q],O=()=>[`auto`,`min`,`max`,`fr`,$,Q],te=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],ne=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],k=()=>[`auto`,...w()],A=()=>[Ic,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],j=()=>[Ic,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],re=()=>[Ic,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],M=()=>[e,$,Q],ie=()=>[...b(),nl,Zc,{position:[$,Q]}],ae=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],oe=()=>[`auto`,`cover`,`contain`,rl,Kc,{size:[$,Q]}],se=()=>[Rc,el,qc],N=()=>[``,`none`,`full`,l,$,Q],P=()=>[``,Z,el,qc],ce=()=>[`solid`,`dashed`,`dotted`,`double`],F=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],I=()=>[Z,Rc,nl,Zc],le=()=>[``,`none`,m,$,Q],ue=()=>[`none`,Z,$,Q],de=()=>[`none`,Z,$,Q],L=()=>[Z,$,Q],fe=()=>[Ic,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[zc],breakpoint:[zc],color:[Bc],container:[zc],"drop-shadow":[zc],ease:[`in`,`out`,`in-out`],font:[Gc],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[zc],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[zc],shadow:[zc],spacing:[`px`,Z],text:[zc],"text-shadow":[zc],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Ic,Q,$,g]}],container:[`container`],columns:[{columns:[Z,Q,$,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Lc,`auto`,$,Q]}],basis:[{basis:[Ic,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Z,Ic,`auto`,`initial`,`none`,Q]}],grow:[{grow:[``,Z,$,Q]}],shrink:[{shrink:[``,Z,$,Q]}],order:[{order:[Lc,`first`,`last`,`none`,$,Q]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:ee()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:ee()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...te(),`normal`]}],"justify-items":[{"justify-items":[...ne(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...ne()]}],"align-content":[{content:[`normal`,...te()]}],"align-items":[{items:[...ne(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...ne(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":te()}],"place-items":[{"place-items":[...ne(),`baseline`]}],"place-self":[{"place-self":[`auto`,...ne()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:k()}],mx:[{mx:k()}],my:[{my:k()}],ms:[{ms:k()}],me:[{me:k()}],mbs:[{mbs:k()}],mbe:[{mbe:k()}],mt:[{mt:k()}],mr:[{mr:k()}],mb:[{mb:k()}],ml:[{ml:k()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:A()}],"inline-size":[{inline:[`auto`,...j()]}],"min-inline-size":[{"min-inline":[`auto`,...j()]}],"max-inline-size":[{"max-inline":[`none`,...j()]}],"block-size":[{block:[`auto`,...re()]}],"min-block-size":[{"min-block":[`auto`,...re()]}],"max-block-size":[{"max-block":[`none`,...re()]}],w:[{w:[s,`screen`,...A()]}],"min-w":[{"min-w":[s,`screen`,`none`,...A()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...A()]}],h:[{h:[`screen`,`lh`,...A()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...A()]}],"max-h":[{"max-h":[`screen`,`lh`,...A()]}],"font-size":[{text:[`base`,n,el,qc]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,ol,Yc]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Rc,Q]}],"font-family":[{font:[tl,Xc,t]}],"font-features":[{"font-features":[Q]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,$,Q]}],"line-clamp":[{"line-clamp":[Z,`none`,$,Jc]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,$,Q]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,$,Q]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ce(),`wavy`]}],"text-decoration-thickness":[{decoration:[Z,`from-font`,`auto`,$,qc]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Z,`auto`,$,Q]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,$,Q]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,$,Q]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:ie()}],"bg-repeat":[{bg:ae()}],"bg-size":[{bg:oe()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Lc,$,Q],radial:[``,$,Q],conic:[Lc,$,Q]},il,Qc]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:se()}],"gradient-via-pos":[{via:se()}],"gradient-to-pos":[{to:se()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:N()}],"rounded-s":[{"rounded-s":N()}],"rounded-e":[{"rounded-e":N()}],"rounded-t":[{"rounded-t":N()}],"rounded-r":[{"rounded-r":N()}],"rounded-b":[{"rounded-b":N()}],"rounded-l":[{"rounded-l":N()}],"rounded-ss":[{"rounded-ss":N()}],"rounded-se":[{"rounded-se":N()}],"rounded-ee":[{"rounded-ee":N()}],"rounded-es":[{"rounded-es":N()}],"rounded-tl":[{"rounded-tl":N()}],"rounded-tr":[{"rounded-tr":N()}],"rounded-br":[{"rounded-br":N()}],"rounded-bl":[{"rounded-bl":N()}],"border-w":[{border:P()}],"border-w-x":[{"border-x":P()}],"border-w-y":[{"border-y":P()}],"border-w-s":[{"border-s":P()}],"border-w-e":[{"border-e":P()}],"border-w-bs":[{"border-bs":P()}],"border-w-be":[{"border-be":P()}],"border-w-t":[{"border-t":P()}],"border-w-r":[{"border-r":P()}],"border-w-b":[{"border-b":P()}],"border-w-l":[{"border-l":P()}],"divide-x":[{"divide-x":P()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":P()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ce(),`hidden`,`none`]}],"divide-style":[{divide:[...ce(),`hidden`,`none`]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...ce(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Z,$,Q]}],"outline-w":[{outline:[``,Z,el,qc]}],"outline-color":[{outline:M()}],shadow:[{shadow:[``,`none`,u,al,$c]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":[`none`,d,al,$c]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:P()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Z,qc]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":P()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":[`none`,f,al,$c]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Z,$,Q]}],"mix-blend":[{"mix-blend":[...F(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":F()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Z]}],"mask-image-linear-from-pos":[{"mask-linear-from":I()}],"mask-image-linear-to-pos":[{"mask-linear-to":I()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":I()}],"mask-image-t-to-pos":[{"mask-t-to":I()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":I()}],"mask-image-r-to-pos":[{"mask-r-to":I()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":I()}],"mask-image-b-to-pos":[{"mask-b-to":I()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":I()}],"mask-image-l-to-pos":[{"mask-l-to":I()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":I()}],"mask-image-x-to-pos":[{"mask-x-to":I()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":I()}],"mask-image-y-to-pos":[{"mask-y-to":I()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[$,Q]}],"mask-image-radial-from-pos":[{"mask-radial-from":I()}],"mask-image-radial-to-pos":[{"mask-radial-to":I()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Z]}],"mask-image-conic-from-pos":[{"mask-conic-from":I()}],"mask-image-conic-to-pos":[{"mask-conic-to":I()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ie()}],"mask-repeat":[{mask:ae()}],"mask-size":[{mask:oe()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,$,Q]}],filter:[{filter:[``,`none`,$,Q]}],blur:[{blur:le()}],brightness:[{brightness:[Z,$,Q]}],contrast:[{contrast:[Z,$,Q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,al,$c]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:[``,Z,$,Q]}],"hue-rotate":[{"hue-rotate":[Z,$,Q]}],invert:[{invert:[``,Z,$,Q]}],saturate:[{saturate:[Z,$,Q]}],sepia:[{sepia:[``,Z,$,Q]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,$,Q]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[Z,$,Q]}],"backdrop-contrast":[{"backdrop-contrast":[Z,$,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Z,$,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Z,$,Q]}],"backdrop-invert":[{"backdrop-invert":[``,Z,$,Q]}],"backdrop-opacity":[{"backdrop-opacity":[Z,$,Q]}],"backdrop-saturate":[{"backdrop-saturate":[Z,$,Q]}],"backdrop-sepia":[{"backdrop-sepia":[``,Z,$,Q]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,$,Q]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Z,`initial`,$,Q]}],ease:[{ease:[`linear`,`initial`,_,$,Q]}],delay:[{delay:[Z,$,Q]}],animate:[{animate:[`none`,v,$,Q]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,$,Q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":[`scale-3d`],skew:[{skew:L()}],"skew-x":[{"skew-x":L()}],"skew-y":[{"skew-y":L()}],transform:[{transform:[$,Q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:fe()}],"translate-x":[{"translate-x":fe()}],"translate-y":[{"translate-y":fe()}],"translate-z":[{"translate-z":fe()}],"translate-none":[`translate-none`],accent:[{accent:M()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,$,Q]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,$,Q]}],fill:[{fill:[`none`,...M()]}],"stroke-w":[{stroke:[Z,el,qc,Jc]}],stroke:[{stroke:[`none`,...M()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function vl(...e){return _l(Ks(e))}var yl=O(),bl=Ys(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function xl({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,yl.jsx)(Ws,{"data-slot":`button`,className:vl(bl({variant:t,size:n,className:e})),...r})}export{Oe as $,To as A,to as B,bo as C,xo as D,Bo as E,Oo as F,Ka as G,ro as H,ko as I,Ra as J,Ba as K,Io as L,Co as M,Do as N,Po as O,Eo as P,ka as Q,vo as R,Uo as S,Ho as T,no as U,$a as V,io as W,Pa as X,Ia as Y,Aa as Z,Jo as _,Rs as a,b as at,Fo as b,Ms as c,bs as d,A as et,vs as f,Zo as g,Qo as h,Ks as i,T as it,Lo as j,wo as k,As as l,ts as m,vl as n,O as nt,Ns as o,x as ot,gs as p,La as q,Ys as r,ee as rt,Ps as s,C as st,xl as t,ne as tt,Cs as u,Go as v,zo as w,So as x,Ro as y,eo as z};
|