cognova 0.2.26 → 0.2.28
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/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{CxNJcty6.js → -XfM4jpu.js} +1 -1
- package/.output/public/_nuxt/0L-9iIbm.js +1 -0
- package/.output/public/_nuxt/{RIAd5Wd1.js → 0mcDe5Hg.js} +1 -1
- package/.output/public/_nuxt/{DLfV22bF.js → 4Nlt-3Ix.js} +1 -1
- package/.output/public/_nuxt/{C_hl3kCw.js → 5FVMuLeh.js} +1 -1
- package/.output/public/_nuxt/{C4Ii8cYC.js → 5qkiDtwf.js} +1 -1
- package/.output/public/_nuxt/{n_Arasow.js → 6_fEEpaq.js} +1 -1
- package/.output/public/_nuxt/{BZjMzGZM.js → 944smzho.js} +1 -1
- package/.output/public/_nuxt/{C-tfM08H.js → B03oRqJe.js} +1 -1
- package/.output/public/_nuxt/{CGgHmnnS.js → B06CcGVK.js} +3 -3
- package/.output/public/_nuxt/{FmfogFAR.js → B0UpgYEt.js} +1 -1
- package/.output/public/_nuxt/{CcJ0pNID.js → B0YLhHra.js} +1 -1
- package/.output/public/_nuxt/B0v0agy0.js +1 -0
- package/.output/public/_nuxt/{DmGbOc_e.js → B1A26hhf.js} +1 -1
- package/.output/public/_nuxt/{B38X0n2w.js → B592hx40.js} +1 -1
- package/.output/public/_nuxt/B5l6QVGz.js +1 -0
- package/.output/public/_nuxt/{BD07a6OS.js → B6BF2w8r.js} +3 -3
- package/.output/public/_nuxt/{rY0W1r76.js → B6m5ExpJ.js} +2 -2
- package/.output/public/_nuxt/{iTZxBLAr.js → B91qlTSF.js} +3 -3
- package/.output/public/_nuxt/B9sXHKws.js +1 -0
- package/.output/public/_nuxt/{eB60bVen.js → BAh-k-y8.js} +1 -1
- package/.output/public/_nuxt/{wSCSxjgr.js → BDQ6hxO7.js} +1 -1
- package/.output/public/_nuxt/{DEmzTuCa.js → BGytjslk.js} +1 -1
- package/.output/public/_nuxt/{CZQeFnOf.js → BIoHE1oQ.js} +1 -1
- package/.output/public/_nuxt/{BHcVB9Fo.js → BNXyokAF.js} +1 -1
- package/.output/public/_nuxt/{Irw5CrIe.js → BNxg8OvE.js} +1 -1
- package/.output/public/_nuxt/{C1wI_STa.js → BPBLcBHM.js} +2 -2
- package/.output/public/_nuxt/{BGV4_re9.js → BQeDYnyj.js} +1 -1
- package/.output/public/_nuxt/{pJF5jz72.js → BUfJTKJk.js} +1 -1
- package/.output/public/_nuxt/{B27NM422.js → BVJkcOi4.js} +1 -1
- package/.output/public/_nuxt/{B8fLdQfp.js → BVNZYpXH.js} +1 -1
- package/.output/public/_nuxt/{Dc_VwXJs.js → BZ3u3Znq.js} +1 -1
- package/.output/public/_nuxt/{CjkXqgrT.js → B_V_KZmg.js} +1 -1
- package/.output/public/_nuxt/{DB0uzc_1.js → BaTcZylh.js} +1 -1
- package/.output/public/_nuxt/{zvDhkxQS.js → BbdFZa4U.js} +1 -1
- package/.output/public/_nuxt/{DmHn_Ae8.js → BeAxkmtt.js} +1 -1
- package/.output/public/_nuxt/{CruI_TS3.js → BfiU8B4M.js} +1 -1
- package/.output/public/_nuxt/{DuH9QzIG.js → BhOf69HZ.js} +1 -1
- package/.output/public/_nuxt/{lfg-J79K.js → BlKgmZLh.js} +1 -1
- package/.output/public/_nuxt/{Cfce_cVw.js → BlplwzgB.js} +1 -1
- package/.output/public/_nuxt/{D5IKvGig.js → BnmZcuhY.js} +1 -1
- package/.output/public/_nuxt/{DfAWgXhg.js → BpExBTyC.js} +1 -1
- package/.output/public/_nuxt/{DIMnGgEU.js → BuURpKT4.js} +1 -1
- package/.output/public/_nuxt/{B5oEzB-M.js → Bvqgc_wA.js} +1 -1
- package/.output/public/_nuxt/{Dfi2mj_-.js → C0FuVjdX.js} +1 -1
- package/.output/public/_nuxt/{QNqSZCYh.js → C1RFLzd_.js} +1 -1
- package/.output/public/_nuxt/{DMCE1Up6.js → C4MrxKnP.js} +1 -1
- package/.output/public/_nuxt/{D5AjrkGO.js → C4ui9LWq.js} +1 -1
- package/.output/public/_nuxt/{iVfmia7K.js → C7RIYfkH.js} +1 -1
- package/.output/public/_nuxt/{D4wS6gzr.js → C7hn68Tp.js} +1 -1
- package/.output/public/_nuxt/{BHAaeL5L.js → C8gC5cUj.js} +1 -1
- package/.output/public/_nuxt/{CBJQYyqD.js → CAJH0xMY.js} +1 -1
- package/.output/public/_nuxt/{Bk_mzzQ3.js → CBpuaar1.js} +1 -1
- package/.output/public/_nuxt/{m9zGH_2s.js → CDP4J5em.js} +1 -1
- package/.output/public/_nuxt/{NNQizITf.js → CGTQGJ_c.js} +1 -1
- package/.output/public/_nuxt/{Ehiy7Wkv.js → CHd8mdNy.js} +1 -1
- package/.output/public/_nuxt/{BtVAOj3K.js → CHn6tbtE.js} +1 -1
- package/.output/public/_nuxt/{B1ea1Zc2.js → CKfAI3Hb.js} +1 -1
- package/.output/public/_nuxt/{CbLvLXmb.js → CLm_rHHY.js} +1 -1
- package/.output/public/_nuxt/{DFPu4h4a.js → CLzxl_Kg.js} +1 -1
- package/.output/public/_nuxt/{C3dJrgZH.js → CNVj60PG.js} +1 -1
- package/.output/public/_nuxt/{VRRYjCaC.js → CNi_mvQS.js} +1 -1
- package/.output/public/_nuxt/{46eRQaVv.js → COMJZX17.js} +1 -1
- package/.output/public/_nuxt/{Brmj91Ns.js → CQcJNYmv.js} +1 -1
- package/.output/public/_nuxt/{BMTKvzsm.js → CT8T1FW9.js} +1 -1
- package/.output/public/_nuxt/{B02JOKtW.js → CTJDAjdO.js} +1 -1
- package/.output/public/_nuxt/{w3RSHXA6.js → CTXxmwx3.js} +1 -1
- package/.output/public/_nuxt/{CIMG8oEU.js → CV92g0qz.js} +1 -1
- package/.output/public/_nuxt/{DEBOaUgW.js → CVwzer_Y.js} +1 -1
- package/.output/public/_nuxt/{6k0gxaWW.js → CXRkSVkD.js} +1 -1
- package/.output/public/_nuxt/{C7Wu2u5C.js → CamCmKfq.js} +1 -1
- package/.output/public/_nuxt/{DM9s28TO.js → CaohnGAD.js} +1 -1
- package/.output/public/_nuxt/{BqyI8nU4.js → Cg8k3_b4.js} +1 -1
- package/.output/public/_nuxt/{rVZcJ6Pz.js → CiQJYbKL.js} +1 -1
- package/.output/public/_nuxt/{Co86ycpI.js → Cjj-eCEV.js} +1 -1
- package/.output/public/_nuxt/{B3TXSB_R.js → CkfP4uja.js} +1 -1
- package/.output/public/_nuxt/{81-iumfM.js → CoUQ3qpL.js} +1 -1
- package/.output/public/_nuxt/{CPb6IrVT.js → CopZwjN8.js} +1 -1
- package/.output/public/_nuxt/{FGRiZ9J1.js → Cpyrc9BG.js} +1 -1
- package/.output/public/_nuxt/{6DKJrPTD.js → CtLfbSRS.js} +1 -1
- package/.output/public/_nuxt/{CVTUqEcr.js → CtyKXJ-J.js} +1 -1
- package/.output/public/_nuxt/{By5L5Smf.js → CvaD7s2l.js} +1 -1
- package/.output/public/_nuxt/{QmdcFt0E.js → Cw2TcJMF.js} +1 -1
- package/.output/public/_nuxt/{ByXbV9Xa.js → Cwel2ykQ.js} +1 -1
- package/.output/public/_nuxt/{CLmiWiqr.js → CyZlzytZ.js} +1 -1
- package/.output/public/_nuxt/{DXAD_aZW.js → Cygjd4rF.js} +1 -1
- package/.output/public/_nuxt/{DoSrePUc.js → CzxGRepV.js} +1 -1
- package/.output/public/_nuxt/{Dkpxacka.js → D0fJg-Y2.js} +1 -1
- package/.output/public/_nuxt/{BW-7wimi.js → D12yGpMq.js} +1 -1
- package/.output/public/_nuxt/{uCsI7fpg.js → D7Bxfxio.js} +1 -1
- package/.output/public/_nuxt/{D_1GDAlv.js → DEl5RR7R.js} +1 -1
- package/.output/public/_nuxt/{3hFj0Mf_.js → DFVXHy0C.js} +1 -1
- package/.output/public/_nuxt/{7msxmF5v.js → DFW8HOVB.js} +1 -1
- package/.output/public/_nuxt/{CD6r4z4e.js → DH2yWNbZ.js} +1 -1
- package/.output/public/_nuxt/{AMPsjNHJ.js → DIDjR8Ry.js} +1 -1
- package/.output/public/_nuxt/{B8na0pik.js → DKHJBr2m.js} +1 -1
- package/.output/public/_nuxt/{CDKJK4wW.js → DKd2_wBj.js} +1 -1
- package/.output/public/_nuxt/{CD_jDSWh.js → DKrd1pCW.js} +1 -1
- package/.output/public/_nuxt/{gTGPvkTX.js → DOcEwtqN.js} +1 -1
- package/.output/public/_nuxt/{B0_Iu2zi.js → DSQ9bpNJ.js} +1 -1
- package/.output/public/_nuxt/{BigIAhcT.js → DWG9jKCo.js} +1 -1
- package/.output/public/_nuxt/{Cj3gDP-y.js → DY78sr_b.js} +1 -1
- package/.output/public/_nuxt/{Cwdn7ZtG.js → DZQxxfue.js} +1 -1
- package/.output/public/_nuxt/{DN5cHXGS.js → DZpgj5sA.js} +1 -1
- package/.output/public/_nuxt/{CZ5B974o.js → Dc8vLBQN.js} +1 -1
- package/.output/public/_nuxt/{9vdFTPZC.js → DcT64MxD.js} +1 -1
- package/.output/public/_nuxt/{BwLYFg9w.js → DdmLHNRP.js} +1 -1
- package/.output/public/_nuxt/{Bn175bDC.js → Dg19_qAK.js} +1 -1
- package/.output/public/_nuxt/{BTImkTzA.js → DhIZvLeI.js} +1 -1
- package/.output/public/_nuxt/{DOTIy97K.js → DjaEQQhf.js} +1 -1
- package/.output/public/_nuxt/{CJLlvuDm.js → DkUMlRf8.js} +1 -1
- package/.output/public/_nuxt/{BTs0cu3F.js → DkjKiJOq.js} +1 -1
- package/.output/public/_nuxt/{CIDjuJ7I.js → DlR5hUi3.js} +1 -1
- package/.output/public/_nuxt/{P3qGksT8.js → DnfG5RzJ.js} +1 -1
- package/.output/public/_nuxt/{DOs_ozN6.js → DohhIeRk.js} +1 -1
- package/.output/public/_nuxt/{lA6pb86B.js → Dom1vIen.js} +1 -1
- package/.output/public/_nuxt/{BGa5KqPj.js → Ds97nj0P.js} +1 -1
- package/.output/public/_nuxt/{v-LIF5tR.js → DxT3YmAC.js} +1 -1
- package/.output/public/_nuxt/{UQIfAAmf.js → DxcN7Uv7.js} +1 -1
- package/.output/public/_nuxt/{qI8JV5dU.js → DxcbYcrE.js} +1 -1
- package/.output/public/_nuxt/{DfP6jcEM.js → DyVUuE07.js} +1 -1
- package/.output/public/_nuxt/{DoGLYOlq.js → Dz-vwDzE.js} +1 -1
- package/.output/public/_nuxt/{CrHLmWKE.js → EeCE4NvG.js} +1 -1
- package/.output/public/_nuxt/{BVkPh7-9.js → EnGykH_X.js} +1 -1
- package/.output/public/_nuxt/{By6urPVf.js → GJMyZaby.js} +1 -1
- package/.output/public/_nuxt/{mLs_Q7_U.js → I7OHJVxg.js} +1 -1
- package/.output/public/_nuxt/{bHsFNLQP.js → K0RZW9fp.js} +1 -1
- package/.output/public/_nuxt/{CSyssKl8.js → K1o4brLx.js} +1 -1
- package/.output/public/_nuxt/{CZvTOsiz.js → OKVQJ7yj.js} +1 -1
- package/.output/public/_nuxt/{3AgfIirx.js → Q3QJAuZ2.js} +1 -1
- package/.output/public/_nuxt/{D57E8FC4.js → Tirj2rC0.js} +1 -1
- package/.output/public/_nuxt/{BVcLiEDk.js → VcsszHDj.js} +1 -1
- package/.output/public/_nuxt/WG3LXN-9.js +1 -0
- package/.output/public/_nuxt/{CCmSsj4q.js → aUYaYlYl.js} +1 -1
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/7de5e0df-2e0a-435c-a2e3-fc2312beb6ad.json +1 -0
- package/.output/public/_nuxt/{swgNRlWy.js → cGEbEAGz.js} +1 -1
- package/.output/public/_nuxt/{BaHB7JKe.js → ds0WOZHj.js} +1 -1
- package/.output/public/_nuxt/{IIvTjJqa.js → e4zQkzJm.js} +1 -1
- package/.output/public/_nuxt/{D45gWhSU.js → eFu2sWbl.js} +1 -1
- package/.output/public/_nuxt/entry.B0qcqYYu.css +1 -0
- package/.output/public/_nuxt/{ChIzYvpz.js → ggWK6BEa.js} +1 -1
- package/.output/public/_nuxt/{pFPRVtL-.js → hkCaWCzP.js} +1 -1
- package/.output/public/_nuxt/{BW0bq0Nu.js → jF9FNyOl.js} +1 -1
- package/.output/public/_nuxt/{CjVBL0o-.js → jenjyHml.js} +1 -1
- package/.output/public/_nuxt/{CtNN2F57.js → kMwuhvCf.js} +1 -1
- package/.output/public/_nuxt/{1_nO5SO6.js → oWO88tvt.js} +1 -1
- package/.output/public/_nuxt/{d85YwuyC.js → olSL1K5t.js} +1 -1
- package/.output/public/_nuxt/{DwEfItxe.js → ptAR8AWT.js} +1 -1
- package/.output/public/_nuxt/{Dbv2gAYq.js → rTscsMvH.js} +1 -1
- package/.output/public/_nuxt/{Bxs6RCfp.js → xooRr3tW.js} +1 -1
- package/.output/public/_nuxt/{n5X4vNX9.js → zApTn6EM.js} +2 -2
- package/.output/server/chunks/build/client.precomputed.mjs +1 -1
- package/.output/server/chunks/build/{memories-BqA719O1.mjs → memories-DLa6uEfV.mjs} +2 -31
- package/.output/server/chunks/build/memories-DLa6uEfV.mjs.map +1 -0
- package/.output/server/chunks/build/server.mjs +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +944 -922
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/{terminal.mjs → _ws/terminal.mjs} +39 -28
- package/.output/server/chunks/routes/_ws/terminal.mjs.map +1 -0
- package/.output/server/chunks/routes/api/memory/context.get.mjs +13 -9
- package/.output/server/chunks/routes/api/memory/context.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/memory/extract.post.mjs +4 -7
- package/.output/server/chunks/routes/api/memory/extract.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/memory/search.get.mjs +22 -25
- package/.output/server/chunks/routes/api/memory/search.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/memory/store.post.mjs +1 -3
- package/.output/server/chunks/routes/api/memory/store.post.mjs.map +1 -1
- package/.output/server/chunks/routes/notifications.mjs +1 -1
- package/.output/server/package.json +1 -1
- package/Claude/skills/memory/memory.py +1 -7
- package/app/composables/useTerminal.ts +1 -1
- package/app/pages/memories.vue +0 -15
- package/dist/cli/index.js +1 -0
- package/package.json +1 -1
- package/server/api/memory/context.get.ts +19 -15
- package/server/api/memory/extract.post.ts +1 -2
- package/server/api/memory/search.get.ts +29 -34
- package/server/api/memory/store.post.ts +1 -2
- package/server/bridge/responder.ts +10 -5
- package/server/db/schema.ts +1 -2
- package/server/drizzle/migrations/0017_unusual_landau.sql +1 -0
- package/server/drizzle/migrations/meta/0017_snapshot.json +1965 -0
- package/server/drizzle/migrations/meta/_journal.json +7 -0
- package/server/routes/_ws/terminal.ts +111 -0
- package/server/services/memory-extractor.ts +3 -6
- package/server/utils/document-sync.ts +27 -20
- package/server/utils/pty-manager.ts +12 -3
- package/shared/types/index.ts +1 -4
- package/.output/public/_nuxt/BhtKu4xV.js +0 -1
- package/.output/public/_nuxt/CNB4wNeh.js +0 -1
- package/.output/public/_nuxt/CnB-ybCZ.js +0 -1
- package/.output/public/_nuxt/DAjV9Cip.js +0 -1
- package/.output/public/_nuxt/Suor9Vto.js +0 -1
- package/.output/public/_nuxt/builds/meta/d37c41da-8cec-4479-a3ac-3097aa4fb2e0.json +0 -1
- package/.output/public/_nuxt/entry.ZJxWCrU6.css +0 -1
- package/.output/server/chunks/build/memories-BqA719O1.mjs.map +0 -1
- package/.output/server/chunks/routes/terminal.mjs.map +0 -1
- package/server/routes/terminal.ts +0 -98
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as Y,h as R,C as gt,a6 as wt,d as ae,aQ as Ze,r as ce,u as ge,bO as Ge,c as Je,o as ne,w as we,a as _,P as _e,M as de,m as Ee,s as yt,f as Ae,y as vt,aK as xt,bP as ee,bQ as bt,bR as At,F as Ct,Z as et,a$ as tt}from"./CGgHmnnS.js";function Ot(e){const t=Y(),n=R(()=>t.value?.width??0),o=R(()=>t.value?.height??0);return gt(()=>{const i=wt(e);if(i){t.value={width:i.offsetWidth,height:i.offsetHeight};const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const l=s[0];let c,f;if("borderBoxSize"in l){const u=l.borderBoxSize,a=Array.isArray(u)?u[0]:u;c=a.inlineSize,f=a.blockSize}else c=i.offsetWidth,f=i.offsetHeight;t.value={width:c,height:f}});return r.observe(i,{box:"border-box"}),()=>r.unobserve(i)}else t.value=void 0}),{width:n,height:o}}const[nt,Pt]=Ze("PopperRoot");var St=ae({inheritAttrs:!1,__name:"PopperRoot",setup(e){const t=Y();return Pt({anchor:t,onAnchorChange:n=>t.value=n}),(n,o)=>ce(n.$slots,"default")}}),Yn=St,Rt=ae({__name:"PopperAnchor",props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){const t=e,{forwardRef:n,currentElement:o}=ge(),i=nt();return Ge(()=>{i.onAnchorChange(t.reference??o.value)}),(r,s)=>(ne(),Je(_(_e),{ref:_(n),as:r.as,"as-child":r.asChild},{default:we(()=>[ce(r.$slots,"default")]),_:3},8,["as","as-child"]))}}),jn=Rt;const _t={key:0,d:"M0 0L6 6L12 0"},Et={key:1,d:"M0 0L4.58579 4.58579C5.36683 5.36683 6.63316 5.36684 7.41421 4.58579L12 0"};var Lt=ae({__name:"Arrow",props:{width:{type:Number,required:!1,default:10},height:{type:Number,required:!1,default:5},rounded:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"svg"}},setup(e){const t=e;return ge(),(n,o)=>(ne(),Je(_(_e),Ee(t,{width:n.width,height:n.height,viewBox:n.asChild?void 0:"0 0 12 6",preserveAspectRatio:n.asChild?void 0:"none"}),{default:we(()=>[ce(n.$slots,"default",{},()=>[n.rounded?(ne(),de("path",Et)):(ne(),de("path",_t))])]),_:3},16,["width","height","viewBox","preserveAspectRatio"]))}}),Dt=Lt;function Bt(e){return e!==null}function Tt(e){return{name:"transformOrigin",options:e,fn(t){const{placement:n,rects:o,middlewareData:i}=t,s=i.arrow?.centerOffset!==0,l=s?0:e.arrowWidth,c=s?0:e.arrowHeight,[f,u]=Oe(n),a={start:"0%",center:"50%",end:"100%"}[u],h=(i.arrow?.x??0)+l/2,d=(i.arrow?.y??0)+c/2;let p="",m="";return f==="bottom"?(p=s?a:`${h}px`,m=`${-c}px`):f==="top"?(p=s?a:`${h}px`,m=`${o.floating.height+c}px`):f==="right"?(p=`${-c}px`,m=s?a:`${d}px`):f==="left"&&(p=`${o.floating.width+c}px`,m=s?a:`${d}px`),{data:{x:p,y:m}}}}}function Oe(e){const[t,n="center"]=e.split("-");return[t,n]}const ot=["top","right","bottom","left"],We=["start","end"],qe=ot.reduce((e,t)=>e.concat(t,t+"-"+We[0],t+"-"+We[1]),[]),N=Math.min,$=Math.max,pe=Math.round,ue=Math.floor,j=e=>({x:e,y:e}),$t={left:"right",right:"left",bottom:"top",top:"bottom"},kt={start:"end",end:"start"};function Pe(e,t,n){return $(e,N(t,n))}function V(e,t){return typeof e=="function"?e(t):e}function q(e){return e.split("-")[0]}function z(e){return e.split("-")[1]}function Le(e){return e==="x"?"y":"x"}function De(e){return e==="y"?"height":"width"}const Ft=new Set(["top","bottom"]);function H(e){return Ft.has(q(e))?"y":"x"}function Be(e){return Le(H(e))}function it(e,t,n){n===void 0&&(n=!1);const o=z(e),i=Be(e),r=De(i);let s=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(s=me(s)),[s,me(s)]}function Mt(e){const t=me(e);return[he(e),t,he(t)]}function he(e){return e.replace(/start|end/g,t=>kt[t])}const He=["left","right"],ze=["right","left"],Wt=["top","bottom"],qt=["bottom","top"];function Ht(e,t,n){switch(e){case"top":case"bottom":return n?t?ze:He:t?He:ze;case"left":case"right":return t?Wt:qt;default:return[]}}function zt(e,t,n,o){const i=z(e);let r=Ht(q(e),n==="start",o);return i&&(r=r.map(s=>s+"-"+i),t&&(r=r.concat(r.map(he)))),r}function me(e){return e.replace(/left|right|bottom|top/g,t=>$t[t])}function Nt(e){return{top:0,right:0,bottom:0,left:0,...e}}function Te(e){return typeof e!="number"?Nt(e):{top:e,right:e,bottom:e,left:e}}function ie(e){const{x:t,y:n,width:o,height:i}=e;return{width:o,height:i,top:n,left:t,right:t+o,bottom:n+i,x:t,y:n}}function Ne(e,t,n){let{reference:o,floating:i}=e;const r=H(t),s=Be(t),l=De(s),c=q(t),f=r==="y",u=o.x+o.width/2-i.width/2,a=o.y+o.height/2-i.height/2,h=o[l]/2-i[l]/2;let d;switch(c){case"top":d={x:u,y:o.y-i.height};break;case"bottom":d={x:u,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:a};break;case"left":d={x:o.x-i.width,y:a};break;default:d={x:o.x,y:o.y}}switch(z(t)){case"start":d[s]-=h*(n&&f?-1:1);break;case"end":d[s]+=h*(n&&f?-1:1);break}return d}const Vt=async(e,t,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:s}=n,l=r.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let f=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:a}=Ne(f,o,c),h=o,d={},p=0;for(let m=0;m<l.length;m++){const{name:g,fn:w}=l[m],{x:y,y:v,data:A,reset:x}=await w({x:u,y:a,initialPlacement:o,placement:h,strategy:i,middlewareData:d,rects:f,platform:s,elements:{reference:e,floating:t}});u=y??u,a=v??a,d={...d,[g]:{...d[g],...A}},x&&p<=50&&(p++,typeof x=="object"&&(x.placement&&(h=x.placement),x.rects&&(f=x.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:a}=Ne(f,h,c)),m=-1)}return{x:u,y:a,placement:h,strategy:i,middlewareData:d}};async function re(e,t){var n;t===void 0&&(t={});const{x:o,y:i,platform:r,rects:s,elements:l,strategy:c}=e,{boundary:f="clippingAncestors",rootBoundary:u="viewport",elementContext:a="floating",altBoundary:h=!1,padding:d=0}=V(t,e),p=Te(d),g=l[h?a==="floating"?"reference":"floating":a],w=ie(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(g)))==null||n?g:g.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(l.floating)),boundary:f,rootBoundary:u,strategy:c})),y=a==="floating"?{x:o,y:i,width:s.floating.width,height:s.floating.height}:s.reference,v=await(r.getOffsetParent==null?void 0:r.getOffsetParent(l.floating)),A=await(r.isElement==null?void 0:r.isElement(v))?await(r.getScale==null?void 0:r.getScale(v))||{x:1,y:1}:{x:1,y:1},x=ie(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:v,strategy:c}):y);return{top:(w.top-x.top+p.top)/A.y,bottom:(x.bottom-w.bottom+p.bottom)/A.y,left:(w.left-x.left+p.left)/A.x,right:(x.right-w.right+p.right)/A.x}}const It=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:i,rects:r,platform:s,elements:l,middlewareData:c}=t,{element:f,padding:u=0}=V(e,t)||{};if(f==null)return{};const a=Te(u),h={x:n,y:o},d=Be(i),p=De(d),m=await s.getDimensions(f),g=d==="y",w=g?"top":"left",y=g?"bottom":"right",v=g?"clientHeight":"clientWidth",A=r.reference[p]+r.reference[d]-h[d]-r.floating[p],x=h[d]-r.reference[d],O=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let b=O?O[v]:0;(!b||!await(s.isElement==null?void 0:s.isElement(O)))&&(b=l.floating[v]||r.floating[p]);const S=A/2-x/2,E=b/2-m[p]/2-1,C=N(a[w],E),L=N(a[y],E),P=C,B=b-m[p]-L,D=b/2-m[p]/2+S,M=Pe(P,D,B),F=!c.arrow&&z(i)!=null&&D!==M&&r.reference[p]/2-(D<P?C:L)-m[p]/2<0,k=F?D<P?D-P:D-B:0;return{[d]:h[d]+k,data:{[d]:M,centerOffset:D-M-k,...F&&{alignmentOffset:k}},reset:F}}});function Xt(e,t,n){return(e?[...n.filter(i=>z(i)===e),...n.filter(i=>z(i)!==e)]:n.filter(i=>q(i)===i)).filter(i=>e?z(i)===e||(t?he(i)!==i:!1):!0)}const Yt=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,o,i;const{rects:r,middlewareData:s,placement:l,platform:c,elements:f}=t,{crossAxis:u=!1,alignment:a,allowedPlacements:h=qe,autoAlignment:d=!0,...p}=V(e,t),m=a!==void 0||h===qe?Xt(a||null,d,h):h,g=await re(t,p),w=((n=s.autoPlacement)==null?void 0:n.index)||0,y=m[w];if(y==null)return{};const v=it(y,r,await(c.isRTL==null?void 0:c.isRTL(f.floating)));if(l!==y)return{reset:{placement:m[0]}};const A=[g[q(y)],g[v[0]],g[v[1]]],x=[...((o=s.autoPlacement)==null?void 0:o.overflows)||[],{placement:y,overflows:A}],O=m[w+1];if(O)return{data:{index:w+1,overflows:x},reset:{placement:O}};const b=x.map(C=>{const L=z(C.placement);return[C.placement,L&&u?C.overflows.slice(0,2).reduce((P,B)=>P+B,0):C.overflows[0],C.overflows]}).sort((C,L)=>C[1]-L[1]),E=((i=b.filter(C=>C[2].slice(0,z(C[0])?2:3).every(L=>L<=0))[0])==null?void 0:i[0])||b[0][0];return E!==l?{data:{index:w+1,overflows:x},reset:{placement:E}}:{}}}},jt=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:i,middlewareData:r,rects:s,initialPlacement:l,platform:c,elements:f}=t,{mainAxis:u=!0,crossAxis:a=!0,fallbackPlacements:h,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...g}=V(e,t);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const w=q(i),y=H(l),v=q(l)===l,A=await(c.isRTL==null?void 0:c.isRTL(f.floating)),x=h||(v||!m?[me(l)]:Mt(l)),O=p!=="none";!h&&O&&x.push(...zt(l,m,p,A));const b=[l,...x],S=await re(t,g),E=[];let C=((o=r.flip)==null?void 0:o.overflows)||[];if(u&&E.push(S[w]),a){const D=it(i,s,A);E.push(S[D[0]],S[D[1]])}if(C=[...C,{placement:i,overflows:E}],!E.every(D=>D<=0)){var L,P;const D=(((L=r.flip)==null?void 0:L.index)||0)+1,M=b[D];if(M&&(!(a==="alignment"?y!==H(M):!1)||C.every(T=>H(T.placement)===y?T.overflows[0]>0:!0)))return{data:{index:D,overflows:C},reset:{placement:M}};let F=(P=C.filter(k=>k.overflows[0]<=0).sort((k,T)=>k.overflows[1]-T.overflows[1])[0])==null?void 0:P.placement;if(!F)switch(d){case"bestFit":{var B;const k=(B=C.filter(T=>{if(O){const Q=H(T.placement);return Q===y||Q==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(Q=>Q>0).reduce((Q,mt)=>Q+mt,0)]).sort((T,Q)=>T[1]-Q[1])[0])==null?void 0:B[0];k&&(F=k);break}case"initialPlacement":F=l;break}if(i!==F)return{reset:{placement:F}}}return{}}}};function Ve(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ie(e){return ot.some(t=>e[t]>=0)}const Ut=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:o="referenceHidden",...i}=V(e,t);switch(o){case"referenceHidden":{const r=await re(t,{...i,elementContext:"reference"}),s=Ve(r,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Ie(s)}}}case"escaped":{const r=await re(t,{...i,altBoundary:!0}),s=Ve(r,n.floating);return{data:{escapedOffsets:s,escaped:Ie(s)}}}default:return{}}}}};function rt(e){const t=N(...e.map(r=>r.left)),n=N(...e.map(r=>r.top)),o=$(...e.map(r=>r.right)),i=$(...e.map(r=>r.bottom));return{x:t,y:n,width:o-t,height:i-n}}function Kt(e){const t=e.slice().sort((i,r)=>i.y-r.y),n=[];let o=null;for(let i=0;i<t.length;i++){const r=t[i];!o||r.y-o.y>o.height/2?n.push([r]):n[n.length-1].push(r),o=r}return n.map(i=>ie(rt(i)))}const Qt=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:o,rects:i,platform:r,strategy:s}=t,{padding:l=2,x:c,y:f}=V(e,t),u=Array.from(await(r.getClientRects==null?void 0:r.getClientRects(o.reference))||[]),a=Kt(u),h=ie(rt(u)),d=Te(l);function p(){if(a.length===2&&a[0].left>a[1].right&&c!=null&&f!=null)return a.find(g=>c>g.left-d.left&&c<g.right+d.right&&f>g.top-d.top&&f<g.bottom+d.bottom)||h;if(a.length>=2){if(H(n)==="y"){const C=a[0],L=a[a.length-1],P=q(n)==="top",B=C.top,D=L.bottom,M=P?C.left:L.left,F=P?C.right:L.right,k=F-M,T=D-B;return{top:B,bottom:D,left:M,right:F,width:k,height:T,x:M,y:B}}const g=q(n)==="left",w=$(...a.map(C=>C.right)),y=N(...a.map(C=>C.left)),v=a.filter(C=>g?C.left===y:C.right===w),A=v[0].top,x=v[v.length-1].bottom,O=y,b=w,S=b-O,E=x-A;return{top:A,bottom:x,left:O,right:b,width:S,height:E,x:O,y:A}}return h}const m=await r.getElementRects({reference:{getBoundingClientRect:p},floating:o.floating,strategy:s});return i.reference.x!==m.reference.x||i.reference.y!==m.reference.y||i.reference.width!==m.reference.width||i.reference.height!==m.reference.height?{reset:{rects:m}}:{}}}},st=new Set(["left","top"]);async function Zt(e,t){const{placement:n,platform:o,elements:i}=e,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),s=q(n),l=z(n),c=H(n)==="y",f=st.has(s)?-1:1,u=r&&c?-1:1,a=V(t,e);let{mainAxis:h,crossAxis:d,alignmentAxis:p}=typeof a=="number"?{mainAxis:a,crossAxis:0,alignmentAxis:null}:{mainAxis:a.mainAxis||0,crossAxis:a.crossAxis||0,alignmentAxis:a.alignmentAxis};return l&&typeof p=="number"&&(d=l==="end"?p*-1:p),c?{x:d*u,y:h*f}:{x:h*f,y:d*u}}const Gt=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:i,y:r,placement:s,middlewareData:l}=t,c=await Zt(t,e);return s===((n=l.offset)==null?void 0:n.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:i+c.x,y:r+c.y,data:{...c,placement:s}}}}},Jt=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:i}=t,{mainAxis:r=!0,crossAxis:s=!1,limiter:l={fn:g=>{let{x:w,y}=g;return{x:w,y}}},...c}=V(e,t),f={x:n,y:o},u=await re(t,c),a=H(q(i)),h=Le(a);let d=f[h],p=f[a];if(r){const g=h==="y"?"top":"left",w=h==="y"?"bottom":"right",y=d+u[g],v=d-u[w];d=Pe(y,d,v)}if(s){const g=a==="y"?"top":"left",w=a==="y"?"bottom":"right",y=p+u[g],v=p-u[w];p=Pe(y,p,v)}const m=l.fn({...t,[h]:d,[a]:p});return{...m,data:{x:m.x-n,y:m.y-o,enabled:{[h]:r,[a]:s}}}}}},en=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:i,rects:r,middlewareData:s}=t,{offset:l=0,mainAxis:c=!0,crossAxis:f=!0}=V(e,t),u={x:n,y:o},a=H(i),h=Le(a);let d=u[h],p=u[a];const m=V(l,t),g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const v=h==="y"?"height":"width",A=r.reference[h]-r.floating[v]+g.mainAxis,x=r.reference[h]+r.reference[v]-g.mainAxis;d<A?d=A:d>x&&(d=x)}if(f){var w,y;const v=h==="y"?"width":"height",A=st.has(q(i)),x=r.reference[a]-r.floating[v]+(A&&((w=s.offset)==null?void 0:w[a])||0)+(A?0:g.crossAxis),O=r.reference[a]+r.reference[v]+(A?0:((y=s.offset)==null?void 0:y[a])||0)-(A?g.crossAxis:0);p<x?p=x:p>O&&(p=O)}return{[h]:d,[a]:p}}}},tn=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:i,rects:r,platform:s,elements:l}=t,{apply:c=()=>{},...f}=V(e,t),u=await re(t,f),a=q(i),h=z(i),d=H(i)==="y",{width:p,height:m}=r.floating;let g,w;a==="top"||a==="bottom"?(g=a,w=h===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(w=a,g=h==="end"?"top":"bottom");const y=m-u.top-u.bottom,v=p-u.left-u.right,A=N(m-u[g],y),x=N(p-u[w],v),O=!t.middlewareData.shift;let b=A,S=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(S=v),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(b=y),O&&!h){const C=$(u.left,0),L=$(u.right,0),P=$(u.top,0),B=$(u.bottom,0);d?S=p-2*(C!==0||L!==0?C+L:$(u.left,u.right)):b=m-2*(P!==0||B!==0?P+B:$(u.top,u.bottom))}await c({...t,availableWidth:S,availableHeight:b});const E=await s.getDimensions(l.floating);return p!==E.width||m!==E.height?{reset:{rects:!0}}:{}}}};function ye(){return typeof window<"u"}function J(e){return $e(e)?(e.nodeName||"").toLowerCase():"#document"}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function K(e){var t;return(t=($e(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function $e(e){return ye()?e instanceof Node||e instanceof W(e).Node:!1}function I(e){return ye()?e instanceof Element||e instanceof W(e).Element:!1}function U(e){return ye()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function Xe(e){return!ye()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}const nn=new Set(["inline","contents"]);function fe(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=X(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!nn.has(i)}const on=new Set(["table","td","th"]);function rn(e){return on.has(J(e))}const sn=[":popover-open",":modal"];function ve(e){return sn.some(t=>{try{return e.matches(t)}catch{return!1}})}const ln=["transform","translate","scale","rotate","perspective"],an=["transform","translate","scale","rotate","perspective","filter"],cn=["paint","layout","strict","content"];function ke(e){const t=Fe(),n=I(e)?X(e):e;return ln.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||an.some(o=>(n.willChange||"").includes(o))||cn.some(o=>(n.contain||"").includes(o))}function fn(e){let t=Z(e);for(;U(t)&&!se(t);){if(ke(t))return t;if(ve(t))return null;t=Z(t)}return null}function Fe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const un=new Set(["html","body","#document"]);function se(e){return un.has(J(e))}function X(e){return W(e).getComputedStyle(e)}function xe(e){return I(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Z(e){if(J(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Xe(e)&&e.host||K(e);return Xe(t)?t.host:t}function lt(e){const t=Z(e);return se(t)?e.ownerDocument?e.ownerDocument.body:e.body:U(t)&&fe(t)?t:lt(t)}function le(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=lt(e),r=i===((o=e.ownerDocument)==null?void 0:o.body),s=W(i);if(r){const l=Se(s);return t.concat(s,s.visualViewport||[],fe(i)?i:[],l&&n?le(l):[])}return t.concat(i,le(i,[],n))}function Se(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function at(e){const t=X(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=U(e),r=i?e.offsetWidth:n,s=i?e.offsetHeight:o,l=pe(n)!==r||pe(o)!==s;return l&&(n=r,o=s),{width:n,height:o,$:l}}function Me(e){return I(e)?e:e.contextElement}function oe(e){const t=Me(e);if(!U(t))return j(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:r}=at(t);let s=(r?pe(n.width):n.width)/o,l=(r?pe(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const dn=j(0);function ct(e){const t=W(e);return!Fe()||!t.visualViewport?dn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==W(e)?!1:t}function G(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),r=Me(e);let s=j(1);t&&(o?I(o)&&(s=oe(o)):s=oe(e));const l=pn(r,n,o)?ct(r):j(0);let c=(i.left+l.x)/s.x,f=(i.top+l.y)/s.y,u=i.width/s.x,a=i.height/s.y;if(r){const h=W(r),d=o&&I(o)?W(o):o;let p=h,m=Se(p);for(;m&&o&&d!==p;){const g=oe(m),w=m.getBoundingClientRect(),y=X(m),v=w.left+(m.clientLeft+parseFloat(y.paddingLeft))*g.x,A=w.top+(m.clientTop+parseFloat(y.paddingTop))*g.y;c*=g.x,f*=g.y,u*=g.x,a*=g.y,c+=v,f+=A,p=W(m),m=Se(p)}}return ie({width:u,height:a,x:c,y:f})}function be(e,t){const n=xe(e).scrollLeft;return t?t.left+n:G(K(e)).left+n}function ft(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-be(e,n),i=n.top+t.scrollTop;return{x:o,y:i}}function hn(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const r=i==="fixed",s=K(o),l=t?ve(t.floating):!1;if(o===s||l&&r)return n;let c={scrollLeft:0,scrollTop:0},f=j(1);const u=j(0),a=U(o);if((a||!a&&!r)&&((J(o)!=="body"||fe(s))&&(c=xe(o)),U(o))){const d=G(o);f=oe(o),u.x=d.x+o.clientLeft,u.y=d.y+o.clientTop}const h=s&&!a&&!r?ft(s,c):j(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-c.scrollLeft*f.x+u.x+h.x,y:n.y*f.y-c.scrollTop*f.y+u.y+h.y}}function mn(e){return Array.from(e.getClientRects())}function gn(e){const t=K(e),n=xe(e),o=e.ownerDocument.body,i=$(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=$(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+be(e);const l=-n.scrollTop;return X(o).direction==="rtl"&&(s+=$(t.clientWidth,o.clientWidth)-i),{width:i,height:r,x:s,y:l}}const Ye=25;function wn(e,t){const n=W(e),o=K(e),i=n.visualViewport;let r=o.clientWidth,s=o.clientHeight,l=0,c=0;if(i){r=i.width,s=i.height;const u=Fe();(!u||u&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const f=be(o);if(f<=0){const u=o.ownerDocument,a=u.body,h=getComputedStyle(a),d=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,p=Math.abs(o.clientWidth-a.clientWidth-d);p<=Ye&&(r-=p)}else f<=Ye&&(r+=f);return{width:r,height:s,x:l,y:c}}const yn=new Set(["absolute","fixed"]);function vn(e,t){const n=G(e,!0,t==="fixed"),o=n.top+e.clientTop,i=n.left+e.clientLeft,r=U(e)?oe(e):j(1),s=e.clientWidth*r.x,l=e.clientHeight*r.y,c=i*r.x,f=o*r.y;return{width:s,height:l,x:c,y:f}}function je(e,t,n){let o;if(t==="viewport")o=wn(e,n);else if(t==="document")o=gn(K(e));else if(I(t))o=vn(t,n);else{const i=ct(e);o={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return ie(o)}function ut(e,t){const n=Z(e);return n===t||!I(n)||se(n)?!1:X(n).position==="fixed"||ut(n,t)}function xn(e,t){const n=t.get(e);if(n)return n;let o=le(e,[],!1).filter(l=>I(l)&&J(l)!=="body"),i=null;const r=X(e).position==="fixed";let s=r?Z(e):e;for(;I(s)&&!se(s);){const l=X(s),c=ke(s);!c&&l.position==="fixed"&&(i=null),(r?!c&&!i:!c&&l.position==="static"&&!!i&&yn.has(i.position)||fe(s)&&!c&&ut(e,s))?o=o.filter(u=>u!==s):i=l,s=Z(s)}return t.set(e,o),o}function bn(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const s=[...n==="clippingAncestors"?ve(t)?[]:xn(t,this._c):[].concat(n),o],l=s[0],c=s.reduce((f,u)=>{const a=je(t,u,i);return f.top=$(a.top,f.top),f.right=N(a.right,f.right),f.bottom=N(a.bottom,f.bottom),f.left=$(a.left,f.left),f},je(t,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function An(e){const{width:t,height:n}=at(e);return{width:t,height:n}}function Cn(e,t,n){const o=U(t),i=K(t),r=n==="fixed",s=G(e,!0,r,t);let l={scrollLeft:0,scrollTop:0};const c=j(0);function f(){c.x=be(i)}if(o||!o&&!r)if((J(t)!=="body"||fe(i))&&(l=xe(t)),o){const d=G(t,!0,r,t);c.x=d.x+t.clientLeft,c.y=d.y+t.clientTop}else i&&f();r&&!o&&i&&f();const u=i&&!o&&!r?ft(i,l):j(0),a=s.left+l.scrollLeft-c.x-u.x,h=s.top+l.scrollTop-c.y-u.y;return{x:a,y:h,width:s.width,height:s.height}}function Ce(e){return X(e).position==="static"}function Ue(e,t){if(!U(e)||X(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return K(e)===n&&(n=n.ownerDocument.body),n}function dt(e,t){const n=W(e);if(ve(e))return n;if(!U(e)){let i=Z(e);for(;i&&!se(i);){if(I(i)&&!Ce(i))return i;i=Z(i)}return n}let o=Ue(e,t);for(;o&&rn(o)&&Ce(o);)o=Ue(o,t);return o&&se(o)&&Ce(o)&&!ke(o)?n:o||fn(e)||n}const On=async function(e){const t=this.getOffsetParent||dt,n=this.getDimensions,o=await n(e.floating);return{reference:Cn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Pn(e){return X(e).direction==="rtl"}const Sn={convertOffsetParentRelativeRectToViewportRelativeRect:hn,getDocumentElement:K,getClippingRect:bn,getOffsetParent:dt,getElementRects:On,getClientRects:mn,getDimensions:An,getScale:oe,isElement:I,isRTL:Pn};function pt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Rn(e,t){let n=null,o;const i=K(e);function r(){var l;clearTimeout(o),(l=n)==null||l.disconnect(),n=null}function s(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),r();const f=e.getBoundingClientRect(),{left:u,top:a,width:h,height:d}=f;if(l||t(),!h||!d)return;const p=ue(a),m=ue(i.clientWidth-(u+h)),g=ue(i.clientHeight-(a+d)),w=ue(u),v={rootMargin:-p+"px "+-m+"px "+-g+"px "+-w+"px",threshold:$(0,N(1,c))||1};let A=!0;function x(O){const b=O[0].intersectionRatio;if(b!==c){if(!A)return s();b?s(!1,b):o=setTimeout(()=>{s(!1,1e-7)},1e3)}b===1&&!pt(f,e.getBoundingClientRect())&&s(),A=!1}try{n=new IntersectionObserver(x,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(x,v)}n.observe(e)}return s(!0),r}function _n(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,f=Me(e),u=i||r?[...f?le(f):[],...le(t)]:[];u.forEach(w=>{i&&w.addEventListener("scroll",n,{passive:!0}),r&&w.addEventListener("resize",n)});const a=f&&l?Rn(f,n):null;let h=-1,d=null;s&&(d=new ResizeObserver(w=>{let[y]=w;y&&y.target===f&&d&&(d.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var v;(v=d)==null||v.observe(t)})),n()}),f&&!c&&d.observe(f),d.observe(t));let p,m=c?G(e):null;c&&g();function g(){const w=G(e);m&&!pt(m,w)&&n(),m=w,p=requestAnimationFrame(g)}return n(),()=>{var w;u.forEach(y=>{i&&y.removeEventListener("scroll",n),r&&y.removeEventListener("resize",n)}),a?.(),(w=d)==null||w.disconnect(),d=null,c&&cancelAnimationFrame(p)}}const En=Gt,Un=Yt,Ln=Jt,Ke=jt,Dn=tn,Bn=Ut,Tn=It,Kn=Qt,$n=en,kn=(e,t,n)=>{const o=new Map,i={platform:Sn,...n},r={...i.platform,_c:o};return Vt(e,t,{...i,platform:r})};function Fn(e){return e!=null&&typeof e=="object"&&"$el"in e}function Re(e){if(Fn(e)){const t=e.$el;return $e(t)&&J(t)==="#comment"?null:t}return e}function te(e){return typeof e=="function"?e():_(e)}function Mn(e){return{name:"arrow",options:e,fn(t){const n=Re(te(e.element));return n==null?{}:Tn({element:n,padding:e.padding}).fn(t)}}}function ht(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qe(e,t){const n=ht(e);return Math.round(t*n)/n}function Wn(e,t,n){n===void 0&&(n={});const o=n.whileElementsMounted,i=R(()=>{var b;return(b=te(n.open))!=null?b:!0}),r=R(()=>te(n.middleware)),s=R(()=>{var b;return(b=te(n.placement))!=null?b:"bottom"}),l=R(()=>{var b;return(b=te(n.strategy))!=null?b:"absolute"}),c=R(()=>{var b;return(b=te(n.transform))!=null?b:!0}),f=R(()=>Re(e.value)),u=R(()=>Re(t.value)),a=Y(0),h=Y(0),d=Y(l.value),p=Y(s.value),m=yt({}),g=Y(!1),w=R(()=>{const b={position:d.value,left:"0",top:"0"};if(!u.value)return b;const S=Qe(u.value,a.value),E=Qe(u.value,h.value);return c.value?{...b,transform:"translate("+S+"px, "+E+"px)",...ht(u.value)>=1.5&&{willChange:"transform"}}:{position:d.value,left:S+"px",top:E+"px"}});let y;function v(){if(f.value==null||u.value==null)return;const b=i.value;kn(f.value,u.value,{middleware:r.value,placement:s.value,strategy:l.value}).then(S=>{a.value=S.x,h.value=S.y,d.value=S.strategy,p.value=S.placement,m.value=S.middlewareData,g.value=b!==!1})}function A(){typeof y=="function"&&(y(),y=void 0)}function x(){if(A(),o===void 0){v();return}if(f.value!=null&&u.value!=null){y=o(f.value,u.value,v);return}}function O(){i.value||(g.value=!1)}return Ae([r,s,l,i],v,{flush:"sync"}),Ae([f,u],x,{flush:"sync"}),Ae(i,O,{flush:"sync"}),vt()&&xt(A),{x:ee(a),y:ee(h),strategy:ee(d),placement:ee(p),middlewareData:ee(m),isPositioned:ee(g),floatingStyles:w,update:v}}const qn={side:"bottom",sideOffset:0,sideFlip:!0,align:"center",alignOffset:0,alignFlip:!0,arrowPadding:0,avoidCollisions:!0,collisionBoundary:()=>[],collisionPadding:0,sticky:"partial",hideWhenDetached:!1,positionStrategy:"fixed",updatePositionStrategy:"optimized",prioritizePosition:!1},[Hn,zn]=Ze("PopperContent");var Nn=ae({inheritAttrs:!1,__name:"PopperContent",props:bt({side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},{...qn}),emits:["placed"],setup(e,{emit:t}){const n=e,o=t,i=nt(),{forwardRef:r,currentElement:s}=ge(),l=Y(),c=Y(),{width:f,height:u}=Ot(c),a=R(()=>n.side+(n.align!=="center"?`-${n.align}`:"")),h=R(()=>typeof n.collisionPadding=="number"?n.collisionPadding:{top:0,right:0,bottom:0,left:0,...n.collisionPadding}),d=R(()=>Array.isArray(n.collisionBoundary)?n.collisionBoundary:[n.collisionBoundary]),p=R(()=>({padding:h.value,boundary:d.value.filter(Bt),altBoundary:d.value.length>0})),m=R(()=>({mainAxis:n.sideFlip,crossAxis:n.alignFlip})),g=At(()=>[En({mainAxis:n.sideOffset+u.value,alignmentAxis:n.alignOffset}),n.prioritizePosition&&n.avoidCollisions&&Ke({...p.value,...m.value}),n.avoidCollisions&&Ln({mainAxis:!0,crossAxis:!!n.prioritizePosition,limiter:n.sticky==="partial"?$n():void 0,...p.value}),!n.prioritizePosition&&n.avoidCollisions&&Ke({...p.value,...m.value}),Dn({...p.value,apply:({elements:P,rects:B,availableWidth:D,availableHeight:M})=>{const{width:F,height:k}=B.reference,T=P.floating.style;T.setProperty("--reka-popper-available-width",`${D}px`),T.setProperty("--reka-popper-available-height",`${M}px`),T.setProperty("--reka-popper-anchor-width",`${F}px`),T.setProperty("--reka-popper-anchor-height",`${k}px`)}}),c.value&&Mn({element:c.value,padding:n.arrowPadding}),Tt({arrowWidth:f.value,arrowHeight:u.value}),n.hideWhenDetached&&Bn({strategy:"referenceHidden",...p.value})]),w=R(()=>n.reference??i.anchor.value),{floatingStyles:y,placement:v,isPositioned:A,middlewareData:x}=Wn(w,l,{strategy:n.positionStrategy,placement:a,whileElementsMounted:(...P)=>_n(...P,{layoutShift:!n.disableUpdateOnLayoutShift,animationFrame:n.updatePositionStrategy==="always"}),middleware:g}),O=R(()=>Oe(v.value)[0]),b=R(()=>Oe(v.value)[1]);Ge(()=>{A.value&&o("placed")});const S=R(()=>x.value.arrow?.centerOffset!==0),E=Y("");Ct(()=>{s.value&&(E.value=window.getComputedStyle(s.value).zIndex)});const C=R(()=>x.value.arrow?.x??0),L=R(()=>x.value.arrow?.y??0);return zn({placedSide:O,onArrowChange:P=>c.value=P,arrowX:C,arrowY:L,shouldHideArrow:S}),(P,B)=>(ne(),de("div",{ref_key:"floatingRef",ref:l,"data-reka-popper-content-wrapper":"",style:tt({..._(y),transform:_(A)?_(y).transform:"translate(0, -200%)",minWidth:"max-content",zIndex:E.value,"--reka-popper-transform-origin":[_(x).transformOrigin?.x,_(x).transformOrigin?.y].join(" "),..._(x).hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}})},[et(_(_e),Ee({ref:_(r)},P.$attrs,{"as-child":n.asChild,as:P.as,"data-side":O.value,"data-align":b.value,style:{animation:_(A)?void 0:"none"}}),{default:we(()=>[ce(P.$slots,"default")]),_:3},16,["as-child","as","data-side","data-align","style"])],4))}}),Qn=Nn;const Vn={top:"bottom",right:"left",bottom:"top",left:"right"};var In=ae({inheritAttrs:!1,__name:"PopperArrow",props:{width:{type:Number,required:!1},height:{type:Number,required:!1},rounded:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"svg"}},setup(e){const{forwardRef:t}=ge(),n=Hn(),o=R(()=>Vn[n.placedSide.value]);return(i,r)=>(ne(),de("span",{ref:s=>{_(n).onArrowChange(s)},style:tt({position:"absolute",left:_(n).arrowX?.value?`${_(n).arrowX?.value}px`:void 0,top:_(n).arrowY?.value?`${_(n).arrowY?.value}px`:void 0,[o.value]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[_(n).placedSide.value],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[_(n).placedSide.value],visibility:_(n).shouldHideArrow.value?"hidden":void 0})},[et(Dt,Ee(i.$attrs,{ref:_(t),style:{display:"block"},as:i.as,"as-child":i.asChild,rounded:i.rounded,width:i.width,height:i.height}),{default:we(()=>[ce(i.$slots,"default")]),_:3},16,["as","as-child","rounded","width","height"])],4))}}),Zn=In;export{Zn as P,Yn as a,Qn as b,jn as c,Tn as d,Dn as e,Ke as f,Un as g,Bn as h,Kn as i,kn as j,qn as k,En as o,Ln as s};
|
|
1
|
+
import{e as Y,h as R,C as gt,a6 as wt,d as ae,aQ as Ze,r as ce,u as ge,bO as Ge,c as Je,o as ne,w as we,a as _,P as _e,M as de,m as Ee,s as yt,f as Ae,y as vt,aK as xt,bP as ee,bQ as bt,bR as At,F as Ct,Z as et,b6 as tt}from"./B06CcGVK.js";function Ot(e){const t=Y(),n=R(()=>t.value?.width??0),o=R(()=>t.value?.height??0);return gt(()=>{const i=wt(e);if(i){t.value={width:i.offsetWidth,height:i.offsetHeight};const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const l=s[0];let c,f;if("borderBoxSize"in l){const u=l.borderBoxSize,a=Array.isArray(u)?u[0]:u;c=a.inlineSize,f=a.blockSize}else c=i.offsetWidth,f=i.offsetHeight;t.value={width:c,height:f}});return r.observe(i,{box:"border-box"}),()=>r.unobserve(i)}else t.value=void 0}),{width:n,height:o}}const[nt,Pt]=Ze("PopperRoot");var St=ae({inheritAttrs:!1,__name:"PopperRoot",setup(e){const t=Y();return Pt({anchor:t,onAnchorChange:n=>t.value=n}),(n,o)=>ce(n.$slots,"default")}}),Yn=St,Rt=ae({__name:"PopperAnchor",props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){const t=e,{forwardRef:n,currentElement:o}=ge(),i=nt();return Ge(()=>{i.onAnchorChange(t.reference??o.value)}),(r,s)=>(ne(),Je(_(_e),{ref:_(n),as:r.as,"as-child":r.asChild},{default:we(()=>[ce(r.$slots,"default")]),_:3},8,["as","as-child"]))}}),jn=Rt;const _t={key:0,d:"M0 0L6 6L12 0"},Et={key:1,d:"M0 0L4.58579 4.58579C5.36683 5.36683 6.63316 5.36684 7.41421 4.58579L12 0"};var Lt=ae({__name:"Arrow",props:{width:{type:Number,required:!1,default:10},height:{type:Number,required:!1,default:5},rounded:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"svg"}},setup(e){const t=e;return ge(),(n,o)=>(ne(),Je(_(_e),Ee(t,{width:n.width,height:n.height,viewBox:n.asChild?void 0:"0 0 12 6",preserveAspectRatio:n.asChild?void 0:"none"}),{default:we(()=>[ce(n.$slots,"default",{},()=>[n.rounded?(ne(),de("path",Et)):(ne(),de("path",_t))])]),_:3},16,["width","height","viewBox","preserveAspectRatio"]))}}),Dt=Lt;function Bt(e){return e!==null}function Tt(e){return{name:"transformOrigin",options:e,fn(t){const{placement:n,rects:o,middlewareData:i}=t,s=i.arrow?.centerOffset!==0,l=s?0:e.arrowWidth,c=s?0:e.arrowHeight,[f,u]=Oe(n),a={start:"0%",center:"50%",end:"100%"}[u],h=(i.arrow?.x??0)+l/2,d=(i.arrow?.y??0)+c/2;let p="",m="";return f==="bottom"?(p=s?a:`${h}px`,m=`${-c}px`):f==="top"?(p=s?a:`${h}px`,m=`${o.floating.height+c}px`):f==="right"?(p=`${-c}px`,m=s?a:`${d}px`):f==="left"&&(p=`${o.floating.width+c}px`,m=s?a:`${d}px`),{data:{x:p,y:m}}}}}function Oe(e){const[t,n="center"]=e.split("-");return[t,n]}const ot=["top","right","bottom","left"],We=["start","end"],qe=ot.reduce((e,t)=>e.concat(t,t+"-"+We[0],t+"-"+We[1]),[]),N=Math.min,$=Math.max,pe=Math.round,ue=Math.floor,j=e=>({x:e,y:e}),$t={left:"right",right:"left",bottom:"top",top:"bottom"},kt={start:"end",end:"start"};function Pe(e,t,n){return $(e,N(t,n))}function V(e,t){return typeof e=="function"?e(t):e}function q(e){return e.split("-")[0]}function z(e){return e.split("-")[1]}function Le(e){return e==="x"?"y":"x"}function De(e){return e==="y"?"height":"width"}const Ft=new Set(["top","bottom"]);function H(e){return Ft.has(q(e))?"y":"x"}function Be(e){return Le(H(e))}function it(e,t,n){n===void 0&&(n=!1);const o=z(e),i=Be(e),r=De(i);let s=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(s=me(s)),[s,me(s)]}function Mt(e){const t=me(e);return[he(e),t,he(t)]}function he(e){return e.replace(/start|end/g,t=>kt[t])}const He=["left","right"],ze=["right","left"],Wt=["top","bottom"],qt=["bottom","top"];function Ht(e,t,n){switch(e){case"top":case"bottom":return n?t?ze:He:t?He:ze;case"left":case"right":return t?Wt:qt;default:return[]}}function zt(e,t,n,o){const i=z(e);let r=Ht(q(e),n==="start",o);return i&&(r=r.map(s=>s+"-"+i),t&&(r=r.concat(r.map(he)))),r}function me(e){return e.replace(/left|right|bottom|top/g,t=>$t[t])}function Nt(e){return{top:0,right:0,bottom:0,left:0,...e}}function Te(e){return typeof e!="number"?Nt(e):{top:e,right:e,bottom:e,left:e}}function ie(e){const{x:t,y:n,width:o,height:i}=e;return{width:o,height:i,top:n,left:t,right:t+o,bottom:n+i,x:t,y:n}}function Ne(e,t,n){let{reference:o,floating:i}=e;const r=H(t),s=Be(t),l=De(s),c=q(t),f=r==="y",u=o.x+o.width/2-i.width/2,a=o.y+o.height/2-i.height/2,h=o[l]/2-i[l]/2;let d;switch(c){case"top":d={x:u,y:o.y-i.height};break;case"bottom":d={x:u,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:a};break;case"left":d={x:o.x-i.width,y:a};break;default:d={x:o.x,y:o.y}}switch(z(t)){case"start":d[s]-=h*(n&&f?-1:1);break;case"end":d[s]+=h*(n&&f?-1:1);break}return d}const Vt=async(e,t,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:s}=n,l=r.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let f=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:a}=Ne(f,o,c),h=o,d={},p=0;for(let m=0;m<l.length;m++){const{name:g,fn:w}=l[m],{x:y,y:v,data:A,reset:x}=await w({x:u,y:a,initialPlacement:o,placement:h,strategy:i,middlewareData:d,rects:f,platform:s,elements:{reference:e,floating:t}});u=y??u,a=v??a,d={...d,[g]:{...d[g],...A}},x&&p<=50&&(p++,typeof x=="object"&&(x.placement&&(h=x.placement),x.rects&&(f=x.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:a}=Ne(f,h,c)),m=-1)}return{x:u,y:a,placement:h,strategy:i,middlewareData:d}};async function re(e,t){var n;t===void 0&&(t={});const{x:o,y:i,platform:r,rects:s,elements:l,strategy:c}=e,{boundary:f="clippingAncestors",rootBoundary:u="viewport",elementContext:a="floating",altBoundary:h=!1,padding:d=0}=V(t,e),p=Te(d),g=l[h?a==="floating"?"reference":"floating":a],w=ie(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(g)))==null||n?g:g.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(l.floating)),boundary:f,rootBoundary:u,strategy:c})),y=a==="floating"?{x:o,y:i,width:s.floating.width,height:s.floating.height}:s.reference,v=await(r.getOffsetParent==null?void 0:r.getOffsetParent(l.floating)),A=await(r.isElement==null?void 0:r.isElement(v))?await(r.getScale==null?void 0:r.getScale(v))||{x:1,y:1}:{x:1,y:1},x=ie(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:v,strategy:c}):y);return{top:(w.top-x.top+p.top)/A.y,bottom:(x.bottom-w.bottom+p.bottom)/A.y,left:(w.left-x.left+p.left)/A.x,right:(x.right-w.right+p.right)/A.x}}const It=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:i,rects:r,platform:s,elements:l,middlewareData:c}=t,{element:f,padding:u=0}=V(e,t)||{};if(f==null)return{};const a=Te(u),h={x:n,y:o},d=Be(i),p=De(d),m=await s.getDimensions(f),g=d==="y",w=g?"top":"left",y=g?"bottom":"right",v=g?"clientHeight":"clientWidth",A=r.reference[p]+r.reference[d]-h[d]-r.floating[p],x=h[d]-r.reference[d],O=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let b=O?O[v]:0;(!b||!await(s.isElement==null?void 0:s.isElement(O)))&&(b=l.floating[v]||r.floating[p]);const S=A/2-x/2,E=b/2-m[p]/2-1,C=N(a[w],E),L=N(a[y],E),P=C,B=b-m[p]-L,D=b/2-m[p]/2+S,M=Pe(P,D,B),F=!c.arrow&&z(i)!=null&&D!==M&&r.reference[p]/2-(D<P?C:L)-m[p]/2<0,k=F?D<P?D-P:D-B:0;return{[d]:h[d]+k,data:{[d]:M,centerOffset:D-M-k,...F&&{alignmentOffset:k}},reset:F}}});function Xt(e,t,n){return(e?[...n.filter(i=>z(i)===e),...n.filter(i=>z(i)!==e)]:n.filter(i=>q(i)===i)).filter(i=>e?z(i)===e||(t?he(i)!==i:!1):!0)}const Yt=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,o,i;const{rects:r,middlewareData:s,placement:l,platform:c,elements:f}=t,{crossAxis:u=!1,alignment:a,allowedPlacements:h=qe,autoAlignment:d=!0,...p}=V(e,t),m=a!==void 0||h===qe?Xt(a||null,d,h):h,g=await re(t,p),w=((n=s.autoPlacement)==null?void 0:n.index)||0,y=m[w];if(y==null)return{};const v=it(y,r,await(c.isRTL==null?void 0:c.isRTL(f.floating)));if(l!==y)return{reset:{placement:m[0]}};const A=[g[q(y)],g[v[0]],g[v[1]]],x=[...((o=s.autoPlacement)==null?void 0:o.overflows)||[],{placement:y,overflows:A}],O=m[w+1];if(O)return{data:{index:w+1,overflows:x},reset:{placement:O}};const b=x.map(C=>{const L=z(C.placement);return[C.placement,L&&u?C.overflows.slice(0,2).reduce((P,B)=>P+B,0):C.overflows[0],C.overflows]}).sort((C,L)=>C[1]-L[1]),E=((i=b.filter(C=>C[2].slice(0,z(C[0])?2:3).every(L=>L<=0))[0])==null?void 0:i[0])||b[0][0];return E!==l?{data:{index:w+1,overflows:x},reset:{placement:E}}:{}}}},jt=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:i,middlewareData:r,rects:s,initialPlacement:l,platform:c,elements:f}=t,{mainAxis:u=!0,crossAxis:a=!0,fallbackPlacements:h,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...g}=V(e,t);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const w=q(i),y=H(l),v=q(l)===l,A=await(c.isRTL==null?void 0:c.isRTL(f.floating)),x=h||(v||!m?[me(l)]:Mt(l)),O=p!=="none";!h&&O&&x.push(...zt(l,m,p,A));const b=[l,...x],S=await re(t,g),E=[];let C=((o=r.flip)==null?void 0:o.overflows)||[];if(u&&E.push(S[w]),a){const D=it(i,s,A);E.push(S[D[0]],S[D[1]])}if(C=[...C,{placement:i,overflows:E}],!E.every(D=>D<=0)){var L,P;const D=(((L=r.flip)==null?void 0:L.index)||0)+1,M=b[D];if(M&&(!(a==="alignment"?y!==H(M):!1)||C.every(T=>H(T.placement)===y?T.overflows[0]>0:!0)))return{data:{index:D,overflows:C},reset:{placement:M}};let F=(P=C.filter(k=>k.overflows[0]<=0).sort((k,T)=>k.overflows[1]-T.overflows[1])[0])==null?void 0:P.placement;if(!F)switch(d){case"bestFit":{var B;const k=(B=C.filter(T=>{if(O){const Q=H(T.placement);return Q===y||Q==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(Q=>Q>0).reduce((Q,mt)=>Q+mt,0)]).sort((T,Q)=>T[1]-Q[1])[0])==null?void 0:B[0];k&&(F=k);break}case"initialPlacement":F=l;break}if(i!==F)return{reset:{placement:F}}}return{}}}};function Ve(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ie(e){return ot.some(t=>e[t]>=0)}const Ut=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:o="referenceHidden",...i}=V(e,t);switch(o){case"referenceHidden":{const r=await re(t,{...i,elementContext:"reference"}),s=Ve(r,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Ie(s)}}}case"escaped":{const r=await re(t,{...i,altBoundary:!0}),s=Ve(r,n.floating);return{data:{escapedOffsets:s,escaped:Ie(s)}}}default:return{}}}}};function rt(e){const t=N(...e.map(r=>r.left)),n=N(...e.map(r=>r.top)),o=$(...e.map(r=>r.right)),i=$(...e.map(r=>r.bottom));return{x:t,y:n,width:o-t,height:i-n}}function Kt(e){const t=e.slice().sort((i,r)=>i.y-r.y),n=[];let o=null;for(let i=0;i<t.length;i++){const r=t[i];!o||r.y-o.y>o.height/2?n.push([r]):n[n.length-1].push(r),o=r}return n.map(i=>ie(rt(i)))}const Qt=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:o,rects:i,platform:r,strategy:s}=t,{padding:l=2,x:c,y:f}=V(e,t),u=Array.from(await(r.getClientRects==null?void 0:r.getClientRects(o.reference))||[]),a=Kt(u),h=ie(rt(u)),d=Te(l);function p(){if(a.length===2&&a[0].left>a[1].right&&c!=null&&f!=null)return a.find(g=>c>g.left-d.left&&c<g.right+d.right&&f>g.top-d.top&&f<g.bottom+d.bottom)||h;if(a.length>=2){if(H(n)==="y"){const C=a[0],L=a[a.length-1],P=q(n)==="top",B=C.top,D=L.bottom,M=P?C.left:L.left,F=P?C.right:L.right,k=F-M,T=D-B;return{top:B,bottom:D,left:M,right:F,width:k,height:T,x:M,y:B}}const g=q(n)==="left",w=$(...a.map(C=>C.right)),y=N(...a.map(C=>C.left)),v=a.filter(C=>g?C.left===y:C.right===w),A=v[0].top,x=v[v.length-1].bottom,O=y,b=w,S=b-O,E=x-A;return{top:A,bottom:x,left:O,right:b,width:S,height:E,x:O,y:A}}return h}const m=await r.getElementRects({reference:{getBoundingClientRect:p},floating:o.floating,strategy:s});return i.reference.x!==m.reference.x||i.reference.y!==m.reference.y||i.reference.width!==m.reference.width||i.reference.height!==m.reference.height?{reset:{rects:m}}:{}}}},st=new Set(["left","top"]);async function Zt(e,t){const{placement:n,platform:o,elements:i}=e,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),s=q(n),l=z(n),c=H(n)==="y",f=st.has(s)?-1:1,u=r&&c?-1:1,a=V(t,e);let{mainAxis:h,crossAxis:d,alignmentAxis:p}=typeof a=="number"?{mainAxis:a,crossAxis:0,alignmentAxis:null}:{mainAxis:a.mainAxis||0,crossAxis:a.crossAxis||0,alignmentAxis:a.alignmentAxis};return l&&typeof p=="number"&&(d=l==="end"?p*-1:p),c?{x:d*u,y:h*f}:{x:h*f,y:d*u}}const Gt=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:i,y:r,placement:s,middlewareData:l}=t,c=await Zt(t,e);return s===((n=l.offset)==null?void 0:n.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:i+c.x,y:r+c.y,data:{...c,placement:s}}}}},Jt=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:i}=t,{mainAxis:r=!0,crossAxis:s=!1,limiter:l={fn:g=>{let{x:w,y}=g;return{x:w,y}}},...c}=V(e,t),f={x:n,y:o},u=await re(t,c),a=H(q(i)),h=Le(a);let d=f[h],p=f[a];if(r){const g=h==="y"?"top":"left",w=h==="y"?"bottom":"right",y=d+u[g],v=d-u[w];d=Pe(y,d,v)}if(s){const g=a==="y"?"top":"left",w=a==="y"?"bottom":"right",y=p+u[g],v=p-u[w];p=Pe(y,p,v)}const m=l.fn({...t,[h]:d,[a]:p});return{...m,data:{x:m.x-n,y:m.y-o,enabled:{[h]:r,[a]:s}}}}}},en=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:i,rects:r,middlewareData:s}=t,{offset:l=0,mainAxis:c=!0,crossAxis:f=!0}=V(e,t),u={x:n,y:o},a=H(i),h=Le(a);let d=u[h],p=u[a];const m=V(l,t),g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const v=h==="y"?"height":"width",A=r.reference[h]-r.floating[v]+g.mainAxis,x=r.reference[h]+r.reference[v]-g.mainAxis;d<A?d=A:d>x&&(d=x)}if(f){var w,y;const v=h==="y"?"width":"height",A=st.has(q(i)),x=r.reference[a]-r.floating[v]+(A&&((w=s.offset)==null?void 0:w[a])||0)+(A?0:g.crossAxis),O=r.reference[a]+r.reference[v]+(A?0:((y=s.offset)==null?void 0:y[a])||0)-(A?g.crossAxis:0);p<x?p=x:p>O&&(p=O)}return{[h]:d,[a]:p}}}},tn=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:i,rects:r,platform:s,elements:l}=t,{apply:c=()=>{},...f}=V(e,t),u=await re(t,f),a=q(i),h=z(i),d=H(i)==="y",{width:p,height:m}=r.floating;let g,w;a==="top"||a==="bottom"?(g=a,w=h===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(w=a,g=h==="end"?"top":"bottom");const y=m-u.top-u.bottom,v=p-u.left-u.right,A=N(m-u[g],y),x=N(p-u[w],v),O=!t.middlewareData.shift;let b=A,S=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(S=v),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(b=y),O&&!h){const C=$(u.left,0),L=$(u.right,0),P=$(u.top,0),B=$(u.bottom,0);d?S=p-2*(C!==0||L!==0?C+L:$(u.left,u.right)):b=m-2*(P!==0||B!==0?P+B:$(u.top,u.bottom))}await c({...t,availableWidth:S,availableHeight:b});const E=await s.getDimensions(l.floating);return p!==E.width||m!==E.height?{reset:{rects:!0}}:{}}}};function ye(){return typeof window<"u"}function J(e){return $e(e)?(e.nodeName||"").toLowerCase():"#document"}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function K(e){var t;return(t=($e(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function $e(e){return ye()?e instanceof Node||e instanceof W(e).Node:!1}function I(e){return ye()?e instanceof Element||e instanceof W(e).Element:!1}function U(e){return ye()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function Xe(e){return!ye()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}const nn=new Set(["inline","contents"]);function fe(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=X(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!nn.has(i)}const on=new Set(["table","td","th"]);function rn(e){return on.has(J(e))}const sn=[":popover-open",":modal"];function ve(e){return sn.some(t=>{try{return e.matches(t)}catch{return!1}})}const ln=["transform","translate","scale","rotate","perspective"],an=["transform","translate","scale","rotate","perspective","filter"],cn=["paint","layout","strict","content"];function ke(e){const t=Fe(),n=I(e)?X(e):e;return ln.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||an.some(o=>(n.willChange||"").includes(o))||cn.some(o=>(n.contain||"").includes(o))}function fn(e){let t=Z(e);for(;U(t)&&!se(t);){if(ke(t))return t;if(ve(t))return null;t=Z(t)}return null}function Fe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const un=new Set(["html","body","#document"]);function se(e){return un.has(J(e))}function X(e){return W(e).getComputedStyle(e)}function xe(e){return I(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Z(e){if(J(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Xe(e)&&e.host||K(e);return Xe(t)?t.host:t}function lt(e){const t=Z(e);return se(t)?e.ownerDocument?e.ownerDocument.body:e.body:U(t)&&fe(t)?t:lt(t)}function le(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=lt(e),r=i===((o=e.ownerDocument)==null?void 0:o.body),s=W(i);if(r){const l=Se(s);return t.concat(s,s.visualViewport||[],fe(i)?i:[],l&&n?le(l):[])}return t.concat(i,le(i,[],n))}function Se(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function at(e){const t=X(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=U(e),r=i?e.offsetWidth:n,s=i?e.offsetHeight:o,l=pe(n)!==r||pe(o)!==s;return l&&(n=r,o=s),{width:n,height:o,$:l}}function Me(e){return I(e)?e:e.contextElement}function oe(e){const t=Me(e);if(!U(t))return j(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:r}=at(t);let s=(r?pe(n.width):n.width)/o,l=(r?pe(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const dn=j(0);function ct(e){const t=W(e);return!Fe()||!t.visualViewport?dn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==W(e)?!1:t}function G(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),r=Me(e);let s=j(1);t&&(o?I(o)&&(s=oe(o)):s=oe(e));const l=pn(r,n,o)?ct(r):j(0);let c=(i.left+l.x)/s.x,f=(i.top+l.y)/s.y,u=i.width/s.x,a=i.height/s.y;if(r){const h=W(r),d=o&&I(o)?W(o):o;let p=h,m=Se(p);for(;m&&o&&d!==p;){const g=oe(m),w=m.getBoundingClientRect(),y=X(m),v=w.left+(m.clientLeft+parseFloat(y.paddingLeft))*g.x,A=w.top+(m.clientTop+parseFloat(y.paddingTop))*g.y;c*=g.x,f*=g.y,u*=g.x,a*=g.y,c+=v,f+=A,p=W(m),m=Se(p)}}return ie({width:u,height:a,x:c,y:f})}function be(e,t){const n=xe(e).scrollLeft;return t?t.left+n:G(K(e)).left+n}function ft(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-be(e,n),i=n.top+t.scrollTop;return{x:o,y:i}}function hn(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const r=i==="fixed",s=K(o),l=t?ve(t.floating):!1;if(o===s||l&&r)return n;let c={scrollLeft:0,scrollTop:0},f=j(1);const u=j(0),a=U(o);if((a||!a&&!r)&&((J(o)!=="body"||fe(s))&&(c=xe(o)),U(o))){const d=G(o);f=oe(o),u.x=d.x+o.clientLeft,u.y=d.y+o.clientTop}const h=s&&!a&&!r?ft(s,c):j(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-c.scrollLeft*f.x+u.x+h.x,y:n.y*f.y-c.scrollTop*f.y+u.y+h.y}}function mn(e){return Array.from(e.getClientRects())}function gn(e){const t=K(e),n=xe(e),o=e.ownerDocument.body,i=$(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=$(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+be(e);const l=-n.scrollTop;return X(o).direction==="rtl"&&(s+=$(t.clientWidth,o.clientWidth)-i),{width:i,height:r,x:s,y:l}}const Ye=25;function wn(e,t){const n=W(e),o=K(e),i=n.visualViewport;let r=o.clientWidth,s=o.clientHeight,l=0,c=0;if(i){r=i.width,s=i.height;const u=Fe();(!u||u&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const f=be(o);if(f<=0){const u=o.ownerDocument,a=u.body,h=getComputedStyle(a),d=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,p=Math.abs(o.clientWidth-a.clientWidth-d);p<=Ye&&(r-=p)}else f<=Ye&&(r+=f);return{width:r,height:s,x:l,y:c}}const yn=new Set(["absolute","fixed"]);function vn(e,t){const n=G(e,!0,t==="fixed"),o=n.top+e.clientTop,i=n.left+e.clientLeft,r=U(e)?oe(e):j(1),s=e.clientWidth*r.x,l=e.clientHeight*r.y,c=i*r.x,f=o*r.y;return{width:s,height:l,x:c,y:f}}function je(e,t,n){let o;if(t==="viewport")o=wn(e,n);else if(t==="document")o=gn(K(e));else if(I(t))o=vn(t,n);else{const i=ct(e);o={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return ie(o)}function ut(e,t){const n=Z(e);return n===t||!I(n)||se(n)?!1:X(n).position==="fixed"||ut(n,t)}function xn(e,t){const n=t.get(e);if(n)return n;let o=le(e,[],!1).filter(l=>I(l)&&J(l)!=="body"),i=null;const r=X(e).position==="fixed";let s=r?Z(e):e;for(;I(s)&&!se(s);){const l=X(s),c=ke(s);!c&&l.position==="fixed"&&(i=null),(r?!c&&!i:!c&&l.position==="static"&&!!i&&yn.has(i.position)||fe(s)&&!c&&ut(e,s))?o=o.filter(u=>u!==s):i=l,s=Z(s)}return t.set(e,o),o}function bn(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const s=[...n==="clippingAncestors"?ve(t)?[]:xn(t,this._c):[].concat(n),o],l=s[0],c=s.reduce((f,u)=>{const a=je(t,u,i);return f.top=$(a.top,f.top),f.right=N(a.right,f.right),f.bottom=N(a.bottom,f.bottom),f.left=$(a.left,f.left),f},je(t,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function An(e){const{width:t,height:n}=at(e);return{width:t,height:n}}function Cn(e,t,n){const o=U(t),i=K(t),r=n==="fixed",s=G(e,!0,r,t);let l={scrollLeft:0,scrollTop:0};const c=j(0);function f(){c.x=be(i)}if(o||!o&&!r)if((J(t)!=="body"||fe(i))&&(l=xe(t)),o){const d=G(t,!0,r,t);c.x=d.x+t.clientLeft,c.y=d.y+t.clientTop}else i&&f();r&&!o&&i&&f();const u=i&&!o&&!r?ft(i,l):j(0),a=s.left+l.scrollLeft-c.x-u.x,h=s.top+l.scrollTop-c.y-u.y;return{x:a,y:h,width:s.width,height:s.height}}function Ce(e){return X(e).position==="static"}function Ue(e,t){if(!U(e)||X(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return K(e)===n&&(n=n.ownerDocument.body),n}function dt(e,t){const n=W(e);if(ve(e))return n;if(!U(e)){let i=Z(e);for(;i&&!se(i);){if(I(i)&&!Ce(i))return i;i=Z(i)}return n}let o=Ue(e,t);for(;o&&rn(o)&&Ce(o);)o=Ue(o,t);return o&&se(o)&&Ce(o)&&!ke(o)?n:o||fn(e)||n}const On=async function(e){const t=this.getOffsetParent||dt,n=this.getDimensions,o=await n(e.floating);return{reference:Cn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Pn(e){return X(e).direction==="rtl"}const Sn={convertOffsetParentRelativeRectToViewportRelativeRect:hn,getDocumentElement:K,getClippingRect:bn,getOffsetParent:dt,getElementRects:On,getClientRects:mn,getDimensions:An,getScale:oe,isElement:I,isRTL:Pn};function pt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Rn(e,t){let n=null,o;const i=K(e);function r(){var l;clearTimeout(o),(l=n)==null||l.disconnect(),n=null}function s(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),r();const f=e.getBoundingClientRect(),{left:u,top:a,width:h,height:d}=f;if(l||t(),!h||!d)return;const p=ue(a),m=ue(i.clientWidth-(u+h)),g=ue(i.clientHeight-(a+d)),w=ue(u),v={rootMargin:-p+"px "+-m+"px "+-g+"px "+-w+"px",threshold:$(0,N(1,c))||1};let A=!0;function x(O){const b=O[0].intersectionRatio;if(b!==c){if(!A)return s();b?s(!1,b):o=setTimeout(()=>{s(!1,1e-7)},1e3)}b===1&&!pt(f,e.getBoundingClientRect())&&s(),A=!1}try{n=new IntersectionObserver(x,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(x,v)}n.observe(e)}return s(!0),r}function _n(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,f=Me(e),u=i||r?[...f?le(f):[],...le(t)]:[];u.forEach(w=>{i&&w.addEventListener("scroll",n,{passive:!0}),r&&w.addEventListener("resize",n)});const a=f&&l?Rn(f,n):null;let h=-1,d=null;s&&(d=new ResizeObserver(w=>{let[y]=w;y&&y.target===f&&d&&(d.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var v;(v=d)==null||v.observe(t)})),n()}),f&&!c&&d.observe(f),d.observe(t));let p,m=c?G(e):null;c&&g();function g(){const w=G(e);m&&!pt(m,w)&&n(),m=w,p=requestAnimationFrame(g)}return n(),()=>{var w;u.forEach(y=>{i&&y.removeEventListener("scroll",n),r&&y.removeEventListener("resize",n)}),a?.(),(w=d)==null||w.disconnect(),d=null,c&&cancelAnimationFrame(p)}}const En=Gt,Un=Yt,Ln=Jt,Ke=jt,Dn=tn,Bn=Ut,Tn=It,Kn=Qt,$n=en,kn=(e,t,n)=>{const o=new Map,i={platform:Sn,...n},r={...i.platform,_c:o};return Vt(e,t,{...i,platform:r})};function Fn(e){return e!=null&&typeof e=="object"&&"$el"in e}function Re(e){if(Fn(e)){const t=e.$el;return $e(t)&&J(t)==="#comment"?null:t}return e}function te(e){return typeof e=="function"?e():_(e)}function Mn(e){return{name:"arrow",options:e,fn(t){const n=Re(te(e.element));return n==null?{}:Tn({element:n,padding:e.padding}).fn(t)}}}function ht(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qe(e,t){const n=ht(e);return Math.round(t*n)/n}function Wn(e,t,n){n===void 0&&(n={});const o=n.whileElementsMounted,i=R(()=>{var b;return(b=te(n.open))!=null?b:!0}),r=R(()=>te(n.middleware)),s=R(()=>{var b;return(b=te(n.placement))!=null?b:"bottom"}),l=R(()=>{var b;return(b=te(n.strategy))!=null?b:"absolute"}),c=R(()=>{var b;return(b=te(n.transform))!=null?b:!0}),f=R(()=>Re(e.value)),u=R(()=>Re(t.value)),a=Y(0),h=Y(0),d=Y(l.value),p=Y(s.value),m=yt({}),g=Y(!1),w=R(()=>{const b={position:d.value,left:"0",top:"0"};if(!u.value)return b;const S=Qe(u.value,a.value),E=Qe(u.value,h.value);return c.value?{...b,transform:"translate("+S+"px, "+E+"px)",...ht(u.value)>=1.5&&{willChange:"transform"}}:{position:d.value,left:S+"px",top:E+"px"}});let y;function v(){if(f.value==null||u.value==null)return;const b=i.value;kn(f.value,u.value,{middleware:r.value,placement:s.value,strategy:l.value}).then(S=>{a.value=S.x,h.value=S.y,d.value=S.strategy,p.value=S.placement,m.value=S.middlewareData,g.value=b!==!1})}function A(){typeof y=="function"&&(y(),y=void 0)}function x(){if(A(),o===void 0){v();return}if(f.value!=null&&u.value!=null){y=o(f.value,u.value,v);return}}function O(){i.value||(g.value=!1)}return Ae([r,s,l,i],v,{flush:"sync"}),Ae([f,u],x,{flush:"sync"}),Ae(i,O,{flush:"sync"}),vt()&&xt(A),{x:ee(a),y:ee(h),strategy:ee(d),placement:ee(p),middlewareData:ee(m),isPositioned:ee(g),floatingStyles:w,update:v}}const qn={side:"bottom",sideOffset:0,sideFlip:!0,align:"center",alignOffset:0,alignFlip:!0,arrowPadding:0,avoidCollisions:!0,collisionBoundary:()=>[],collisionPadding:0,sticky:"partial",hideWhenDetached:!1,positionStrategy:"fixed",updatePositionStrategy:"optimized",prioritizePosition:!1},[Hn,zn]=Ze("PopperContent");var Nn=ae({inheritAttrs:!1,__name:"PopperContent",props:bt({side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},{...qn}),emits:["placed"],setup(e,{emit:t}){const n=e,o=t,i=nt(),{forwardRef:r,currentElement:s}=ge(),l=Y(),c=Y(),{width:f,height:u}=Ot(c),a=R(()=>n.side+(n.align!=="center"?`-${n.align}`:"")),h=R(()=>typeof n.collisionPadding=="number"?n.collisionPadding:{top:0,right:0,bottom:0,left:0,...n.collisionPadding}),d=R(()=>Array.isArray(n.collisionBoundary)?n.collisionBoundary:[n.collisionBoundary]),p=R(()=>({padding:h.value,boundary:d.value.filter(Bt),altBoundary:d.value.length>0})),m=R(()=>({mainAxis:n.sideFlip,crossAxis:n.alignFlip})),g=At(()=>[En({mainAxis:n.sideOffset+u.value,alignmentAxis:n.alignOffset}),n.prioritizePosition&&n.avoidCollisions&&Ke({...p.value,...m.value}),n.avoidCollisions&&Ln({mainAxis:!0,crossAxis:!!n.prioritizePosition,limiter:n.sticky==="partial"?$n():void 0,...p.value}),!n.prioritizePosition&&n.avoidCollisions&&Ke({...p.value,...m.value}),Dn({...p.value,apply:({elements:P,rects:B,availableWidth:D,availableHeight:M})=>{const{width:F,height:k}=B.reference,T=P.floating.style;T.setProperty("--reka-popper-available-width",`${D}px`),T.setProperty("--reka-popper-available-height",`${M}px`),T.setProperty("--reka-popper-anchor-width",`${F}px`),T.setProperty("--reka-popper-anchor-height",`${k}px`)}}),c.value&&Mn({element:c.value,padding:n.arrowPadding}),Tt({arrowWidth:f.value,arrowHeight:u.value}),n.hideWhenDetached&&Bn({strategy:"referenceHidden",...p.value})]),w=R(()=>n.reference??i.anchor.value),{floatingStyles:y,placement:v,isPositioned:A,middlewareData:x}=Wn(w,l,{strategy:n.positionStrategy,placement:a,whileElementsMounted:(...P)=>_n(...P,{layoutShift:!n.disableUpdateOnLayoutShift,animationFrame:n.updatePositionStrategy==="always"}),middleware:g}),O=R(()=>Oe(v.value)[0]),b=R(()=>Oe(v.value)[1]);Ge(()=>{A.value&&o("placed")});const S=R(()=>x.value.arrow?.centerOffset!==0),E=Y("");Ct(()=>{s.value&&(E.value=window.getComputedStyle(s.value).zIndex)});const C=R(()=>x.value.arrow?.x??0),L=R(()=>x.value.arrow?.y??0);return zn({placedSide:O,onArrowChange:P=>c.value=P,arrowX:C,arrowY:L,shouldHideArrow:S}),(P,B)=>(ne(),de("div",{ref_key:"floatingRef",ref:l,"data-reka-popper-content-wrapper":"",style:tt({..._(y),transform:_(A)?_(y).transform:"translate(0, -200%)",minWidth:"max-content",zIndex:E.value,"--reka-popper-transform-origin":[_(x).transformOrigin?.x,_(x).transformOrigin?.y].join(" "),..._(x).hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}})},[et(_(_e),Ee({ref:_(r)},P.$attrs,{"as-child":n.asChild,as:P.as,"data-side":O.value,"data-align":b.value,style:{animation:_(A)?void 0:"none"}}),{default:we(()=>[ce(P.$slots,"default")]),_:3},16,["as-child","as","data-side","data-align","style"])],4))}}),Qn=Nn;const Vn={top:"bottom",right:"left",bottom:"top",left:"right"};var In=ae({inheritAttrs:!1,__name:"PopperArrow",props:{width:{type:Number,required:!1},height:{type:Number,required:!1},rounded:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"svg"}},setup(e){const{forwardRef:t}=ge(),n=Hn(),o=R(()=>Vn[n.placedSide.value]);return(i,r)=>(ne(),de("span",{ref:s=>{_(n).onArrowChange(s)},style:tt({position:"absolute",left:_(n).arrowX?.value?`${_(n).arrowX?.value}px`:void 0,top:_(n).arrowY?.value?`${_(n).arrowY?.value}px`:void 0,[o.value]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[_(n).placedSide.value],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[_(n).placedSide.value],visibility:_(n).shouldHideArrow.value?"hidden":void 0})},[et(Dt,Ee(i.$attrs,{ref:_(t),style:{display:"block"},as:i.as,"as-child":i.asChild,rounded:i.rounded,width:i.width,height:i.height}),{default:we(()=>[ce(i.$slots,"default")]),_:3},16,["as","as-child","rounded","width","height"])],4))}}),Zn=In;export{Zn as P,Yn as a,Qn as b,jn as c,Tn as d,Dn as e,Ke as f,Un as g,Bn as h,Kn as i,kn as j,qn as k,En as o,Ln as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aZ as _e,s as Ee,y as Te,aK as Pe,h as Q,n as Le}from"./CGgHmnnS.js";var Ie={},ie={};const G=Object.create(null),F=e=>Ie||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?G:globalThis),$=new Proxy(G,{get(e,t){return F()[t]??G[t]},has(e,t){return t in F()||t in G},set(e,t,n){const r=F(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;const n=F(!0);return delete n[t],!0},ownKeys(){const e=F(!0);return Object.keys(e)}});function g(e,t){return typeof process<"u"&&ie?ie[e]??t:typeof Deno<"u"?Deno.env.get(e)??t:typeof Bun<"u"?Bun.env[e]??t:t}const B=1,y=4,L=8,S=24,ae={eterm:y,cons25:y,console:y,cygwin:y,dtterm:y,gnome:y,hurd:y,jfbterm:y,konsole:y,kterm:y,mlterm:y,mosh:S,putty:y,st:y,"rxvt-unicode-24bit":S,terminator:S,"xterm-kitty":S},Ae=new Map(Object.entries({APPVEYOR:L,BUILDKITE:L,CIRCLECI:S,DRONE:L,GITEA_ACTIONS:S,GITHUB_ACTIONS:S,GITLAB_CI:L,TRAVIS:L})),xe=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function Ce(){if(g("FORCE_COLOR")!==void 0)switch(g("FORCE_COLOR")){case"":case"1":case"true":return y;case"2":return L;case"3":return S;default:return B}if(g("NODE_DISABLE_COLORS")!==void 0&&g("NODE_DISABLE_COLORS")!==""||g("NO_COLOR")!==void 0&&g("NO_COLOR")!==""||g("TERM")==="dumb")return B;if(g("TMUX"))return S;if("TF_BUILD"in $&&"AGENT_NAME"in $)return y;if("CI"in $){for(const{0:e,1:t}of Ae)if(e in $)return t;return g("CI_NAME")==="codeship"?L:B}if("TEAMCITY_VERSION"in $)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(g("TEAMCITY_VERSION"))!==null?y:B;switch(g("TERM_PROGRAM")){case"iTerm.app":return!g("TERM_PROGRAM_VERSION")||/^[0-2]\./.exec(g("TERM_PROGRAM_VERSION"))!==null?L:S;case"HyperTerm":case"MacTerm":return S;case"Apple_Terminal":return L}if(g("COLORTERM")==="truecolor"||g("COLORTERM")==="24bit")return S;if(g("TERM")){if(/truecolor/.exec(g("TERM"))!==null)return S;if(/^xterm-256/.exec(g("TERM"))!==null)return L;const e=g("TERM").toLowerCase();if(ae[e])return ae[e];if(xe.some(t=>t.exec(e)!==null))return y}return g("COLORTERM")?y:B}const I={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",fg:{red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m"}},ne=["debug","info","success","warn","error"];function Ne(e,t){return ne.indexOf(t)>=ne.indexOf(e)}const Me={info:I.fg.blue,success:I.fg.green,warn:I.fg.yellow,error:I.fg.red,debug:I.fg.magenta},Ue=(e,t,n)=>{const r=new Date().toISOString();return n?`${I.dim}${r}${I.reset} ${Me[e]}${e.toUpperCase()}${I.reset} ${I.bright}[Better Auth]:${I.reset} ${t}`:`${r} ${e.toUpperCase()} [Better Auth]: ${t}`},qe=e=>{const t="error",n=Ce()!==1,r=(s,c,a=[])=>{if(!Ne(t,s))return;const d=Ue(s,c,n);{s==="error"?console.error(d,...a):s==="warn"?console.warn(d,...a):console.log(d,...a);return}};return{...Object.fromEntries(ne.map(s=>[s,(...[c,...a])=>r(s,c,a)])),get level(){return t}}};qe();function Fe(e){return e.charAt(0).toUpperCase()+e.slice(1)}var J=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}};function $e(e){try{return(new URL(e).pathname.replace(/\/+$/,"")||"/")!=="/"}catch{throw new J(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function Be(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new J(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof J?t:new J(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function ue(e,t="/api/auth"){if(Be(e),$e(e))return e;const n=e.replace(/\/+$/,"");return!t||t==="/"?n:(t=t.startsWith("/")?t:`/${t}`,`${n}${t}`)}function De(e,t,n,r,s){if(e)return ue(e,t);if(typeof window<"u"&&window.location)return ue(window.location.origin,t)}const je={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&typeof window<"u"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},ke={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},Ve=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,ce={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},We=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function Ge(e){return e instanceof Date&&!isNaN(e.getTime())}function Je(e){const t=We.exec(e);if(!t)return null;const[,n,r,s,c,a,d,o,u,i,f]=t,h=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(s,10),parseInt(c,10),parseInt(a,10),parseInt(d,10),o?parseInt(o.padEnd(3,"0"),10):0));if(u){const m=(parseInt(i,10)*60+parseInt(f,10))*(u==="+"?-1:1);h.setUTCMinutes(h.getUTCMinutes()+m)}return Ge(h)?h:null}function He(e,t={}){const{strict:n=!1,warnings:r=!1,reviver:s,parseDates:c=!0}=t;if(typeof e!="string")return e;const a=e.trim();if(a.length>0&&a[0]==='"'&&a.endsWith('"')&&!a.slice(1,-1).includes('"'))return a.slice(1,-1);const d=a.toLowerCase();if(d.length<=9&&d in ce)return ce[d];if(!Ve.test(a)){if(n)throw new SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(ke).some(([o,u])=>{const i=u.test(a);return i&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${o} pattern`),i})&&n)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(a,(u,i)=>{if(u==="__proto__"||u==="constructor"&&i&&typeof i=="object"&&"prototype"in i){r&&console.warn(`[better-json] Dropping "${u}" key to prevent prototype pollution`);return}if(c&&typeof i=="string"){const f=Je(i);if(f)return f}return s?s(u,i):i})}catch(o){if(n)throw o;return e}}function Ye(e,t={strict:!0}){return He(e,t)}let E=[],U=0;const k=4,me=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},lc:0,listen(r){return n.lc=t.push(r),()=>{for(let c=U+k;c<E.length;)E[c]===r?E.splice(c,k):c+=k;let s=t.indexOf(r);~s&&(t.splice(s,1),--n.lc||n.off())}},notify(r,s){let c=!E.length;for(let a of t)E.push(a,n.value,r,s);if(c){for(U=0;U<E.length;U+=k)E[U](E[U+1],E[U+2],E[U+3]);E.length=0}},off(){},set(r){let s=n.value;s!==r&&(n.value=r,n.notify(s))},subscribe(r){let s=n.listen(r);return r(n.value),s},value:e};return n},Qe=5,V=6,W=10;let ze=(e,t,n,r)=>(e.events=e.events||{},e.events[n+W]||(e.events[n+W]=r(s=>{e.events[n].reduceRight((c,a)=>(a(c),c),{shared:{},...s})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let s=e.events[n],c=s.indexOf(t);s.splice(c,1),s.length||(delete e.events[n],e.events[n+W](),delete e.events[n+W])}),Xe=1e3,ve=(e,t)=>ze(e,r=>{let s=t(r);s&&e.events[V].push(s)},Qe,r=>{let s=e.listen;e.listen=(...a)=>(!e.lc&&!e.active&&(e.active=!0,r()),s(...a));let c=e.off;return e.events[V]=[],e.off=()=>{c(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let a of e.events[V])a();e.events[V]=[]}},Xe)},()=>{e.listen=s,e.off=c}});const Ze=()=>typeof window>"u",Ke=(e,t,n,r)=>{const s=me({data:null,error:null,isPending:!0,isRefetching:!1,refetch:d=>c(d)}),c=async d=>new Promise(o=>{const u=typeof r=="function"?r({data:s.get().data,error:s.get().error,isPending:s.get().isPending}):r;n(t,{...u,query:{...u?.query,...d?.query},async onSuccess(i){s.set({data:i.data,error:null,isPending:!1,isRefetching:!1,refetch:s.value.refetch}),await u?.onSuccess?.(i)},async onError(i){const{request:f}=i,h=typeof f.retry=="number"?f.retry:f.retry?.attempts,m=f.retryAttempt||0;h&&m<h||(s.set({error:i.error,data:null,isPending:!1,isRefetching:!1,refetch:s.value.refetch}),await u?.onError?.(i))},async onRequest(i){const f=s.get();s.set({isPending:f.data===null,data:f.data,error:null,isRefetching:!0,refetch:s.value.refetch}),await u?.onRequest?.(i)}}).catch(i=>{s.set({error:i,data:null,isPending:!1,isRefetching:!1,refetch:s.value.refetch})}).finally(()=>{o(void 0)})});e=Array.isArray(e)?e:[e];let a=!1;for(const d of e)d.subscribe(async()=>{Ze()||(a?await c():ve(s,()=>{const o=setTimeout(async()=>{a||(await c(),a=!0)},0);return()=>{s.off(),d.off(),clearTimeout(o)}}))});return s},z=Symbol.for("better-auth:broadcast-channel"),et=()=>Math.floor(Date.now()/1e3);var tt=class{listeners=new Set;name;constructor(e="better-auth.message"){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>"u"))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:et()}))}catch{}}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const e=t=>{if(t.key!==this.name)return;const n=JSON.parse(t.newValue??"{}");n?.event!=="session"||!n?.data||this.listeners.forEach(r=>r(n))};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}};function X(e="better-auth.message"){return globalThis[z]||(globalThis[z]=new tt(e)),globalThis[z]}const Z=Symbol.for("better-auth:focus-manager");var nt=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof document>"u"||typeof window.addEventListener>"u")return()=>{};const e=()=>{document.visibilityState==="visible"&&this.setFocused(!0)};return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e,!1)}}};function le(){return globalThis[Z]||(globalThis[Z]=new nt),globalThis[Z]}const K=Symbol.for("better-auth:online-manager");var rt=class{listeners=new Set;isOnline=typeof navigator<"u"?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",t,!1),()=>{window.removeEventListener("online",e,!1),window.removeEventListener("offline",t,!1)}}};function ee(){return globalThis[K]||(globalThis[K]=new rt),globalThis[K]}const q=()=>Math.floor(Date.now()/1e3),st=5;function ot(e){const{sessionAtom:t,sessionSignal:n,$fetch:r,options:s={}}=e,c=s.sessionOptions?.refetchInterval??0,a=s.sessionOptions?.refetchOnWindowFocus??!0,d=s.sessionOptions?.refetchWhenOffline??!1,o={lastSync:0,lastSessionRequest:0,cachedSession:void 0},u=()=>d||ee().isOnline,i=v=>{if(!u())return;if(v?.event==="storage"){o.lastSync=q(),n.set(!n.get());return}const O=t.get();if(v?.event==="poll"){o.lastSessionRequest=q(),r("/get-session").then(l=>{l.error?t.set({...O,data:null,error:l.error}):t.set({...O,data:l.data,error:null}),o.lastSync=q(),n.set(!n.get())}).catch(()=>{});return}if(v?.event==="visibilitychange"){if(q()-o.lastSessionRequest<st)return;o.lastSessionRequest=q()}(O?.data===null||O?.data===void 0||v?.event==="visibilitychange")&&(o.lastSync=q(),n.set(!n.get()))},f=v=>{X().post({event:"session",data:{trigger:v},clientId:Math.random().toString(36).substring(7)})},h=()=>{c&&c>0&&(o.pollInterval=setInterval(()=>{t.get()?.data&&i({event:"poll"})},c*1e3))},m=()=>{o.unsubscribeBroadcast=X().subscribe(()=>{i({event:"storage"})})},R=()=>{a&&(o.unsubscribeFocus=le().subscribe(()=>{i({event:"visibilitychange"})}))},A=()=>{o.unsubscribeOnline=ee().subscribe(v=>{v&&i({event:"visibilitychange"})})};return{init:()=>{h(),m(),R(),A(),X().setup(),le().setup(),ee().setup()},cleanup:()=>{o.pollInterval&&(clearInterval(o.pollInterval),o.pollInterval=void 0),o.unsubscribeBroadcast&&(o.unsubscribeBroadcast(),o.unsubscribeBroadcast=void 0),o.unsubscribeFocus&&(o.unsubscribeFocus(),o.unsubscribeFocus=void 0),o.unsubscribeOnline&&(o.unsubscribeOnline(),o.unsubscribeOnline=void 0),o.lastSync=0,o.lastSessionRequest=0,o.cachedSession=void 0},triggerRefetch:i,broadcastSessionUpdate:f}}function it(e,t){const n=me(!1),r=Ke(n,"/get-session",e,{method:"GET"});return ve(r,()=>{const s=ot({sessionAtom:r,sessionSignal:n,$fetch:e,options:t});return s.init(),()=>{s.cleanup()}}),{session:r,$sessionSignal:n}}var at=Object.defineProperty,ut=Object.defineProperties,ct=Object.getOwnPropertyDescriptors,fe=Object.getOwnPropertySymbols,lt=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,de=(e,t,n)=>t in e?at(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,T=(e,t)=>{for(var n in t||(t={}))lt.call(t,n)&&de(e,n,t[n]);if(fe)for(var n of fe(t))ft.call(t,n)&&de(e,n,t[n]);return e},P=(e,t)=>ut(e,ct(t)),dt=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}},ht=async(e,t)=>{var n,r,s,c,a,d;let o=t||{};const u={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:o,hooks:u};for(const i of t?.plugins||[]){if(i.init){const f=await((n=i.init)==null?void 0:n.call(i,e.toString(),t));o=f.options||o,e=f.url}u.onRequest.push((r=i.hooks)==null?void 0:r.onRequest),u.onResponse.push((s=i.hooks)==null?void 0:s.onResponse),u.onSuccess.push((c=i.hooks)==null?void 0:c.onSuccess),u.onError.push((a=i.hooks)==null?void 0:a.onError),u.onRetry.push((d=i.hooks)==null?void 0:d.onRetry)}return{url:e,options:o,hooks:u}},he=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},pt=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function gt(e){if(typeof e=="number")return new he({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new he(e);case"exponential":return new pt(e);default:throw new Error("Invalid retry strategy")}}var yt=async e=>{const t={},n=async r=>typeof r=="function"?await r():r;if(e?.auth){if(e.auth.type==="Bearer"){const r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type==="Basic"){const[r,s]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!s)return t;t.authorization=`Basic ${btoa(`${r}:${s}`)}`}else if(e.auth.type==="Custom"){const[r,s]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!s)return t;t.authorization=`${r??""} ${s}`}}return t},mt=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function vt(e){const t=e.headers.get("content-type"),n=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";const r=t.split(";").shift()||"";return mt.test(r)?"json":n.has(r)||r.startsWith("text/")?"text":"blob"}function bt(e){try{return JSON.parse(e),!0}catch{return!1}}function re(e){if(e===void 0)return!1;const t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function pe(e){try{return JSON.parse(e)}catch{return e}}function ge(e){return typeof e=="function"}function wt(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&ge(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&ge(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}async function Ot(e){const t=new Headers(e?.headers),n=await yt(e);for(const[r,s]of Object.entries(n||{}))t.set(r,s);if(!t.has("content-type")){const r=Rt(e?.body);r&&t.set("content-type",r)}return t}function Rt(e){return re(e)?"application/json":null}function St(e){if(!e?.body)return null;const t=new Headers(e?.headers);if(re(e.body)&&!t.has("content-type")){for(const[n,r]of Object.entries(e?.body))r instanceof Date&&(e.body[n]=r.toISOString());return JSON.stringify(e.body)}return t.has("content-type")&&t.get("content-type")==="application/x-www-form-urlencoded"&&re(e.body)?new URLSearchParams(e.body).toString():e.body}function _t(e,t){var n;if(t?.method)return t.method.toUpperCase();if(e.startsWith("@")){const r=(n=e.split("@")[1])==null?void 0:n.split("/")[0];return we.includes(r)?r.toUpperCase():t?.body?"POST":"GET"}return t?.body?"POST":"GET"}function Et(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var Tt=class be extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,be.prototype)}};async function H(e,t){const n=await e["~standard"].validate(t);if(n.issues)throw new Tt(n.issues);return n.value}var we=["get","post","put","patch","delete"],Pt=e=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(t,n){var r,s,c,a;const d=((s=(r=e.plugins)==null?void 0:r.find(o=>{var u;return(u=o.schema)!=null&&u.config?t.startsWith(o.schema.config.baseURL||"")||t.startsWith(o.schema.config.prefix||""):!1}))==null?void 0:s.schema)||e.schema;if(d){let o=t;(c=d.config)!=null&&c.prefix&&o.startsWith(d.config.prefix)&&(o=o.replace(d.config.prefix,""),d.config.baseURL&&(t=t.replace(d.config.prefix,d.config.baseURL))),(a=d.config)!=null&&a.baseURL&&o.startsWith(d.config.baseURL)&&(o=o.replace(d.config.baseURL,""));const u=d.schema[o];if(u){let i=P(T({},n),{method:u.method,output:u.output});return n?.disableValidation||(i=P(T({},i),{body:u.input?await H(u.input,n?.body):n?.body,params:u.params?await H(u.params,n?.params):n?.params,query:u.query?await H(u.query,n?.query):n?.query})),{url:t,options:i}}}return{url:t,options:n}}}),Lt=e=>{async function t(n,r){const s=P(T(T({},e),r),{plugins:[...e?.plugins||[],Pt(e||{}),...r?.plugins||[]]});if(e?.catchAllError)try{return await se(n,s)}catch(c){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:c}}}return await se(n,s)}return t};function It(e,t){const{baseURL:n,params:r,query:s}=t||{query:{},params:{},baseURL:""};let c=e.startsWith("http")?e.split("/").slice(0,3).join("/"):n||"";if(e.startsWith("@")){const f=e.toString().split("@")[1].split("/")[0];we.includes(f)&&(e=e.replace(`@${f}/`,"/"))}c.endsWith("/")||(c+="/");let[a,d]=e.replace(c,"").split("?");const o=new URLSearchParams(d);for(const[f,h]of Object.entries(s||{})){if(h==null)continue;let m;if(typeof h=="string")m=h;else if(Array.isArray(h)){for(const R of h)o.append(f,R);continue}else m=JSON.stringify(h);o.set(f,m)}if(r)if(Array.isArray(r)){const f=a.split("/").filter(h=>h.startsWith(":"));for(const[h,m]of f.entries()){const R=r[h];a=a.replace(m,R)}}else for(const[f,h]of Object.entries(r))a=a.replace(`:${f}`,String(h));a=a.split("/").map(encodeURIComponent).join("/"),a.startsWith("/")&&(a=a.slice(1));let u=o.toString();return u=u.length>0?`?${u}`.replace(/\+/g,"%20"):"",c.startsWith("http")?new URL(`${a}${u}`,c):`${c}${a}${u}`}var se=async(e,t)=>{var n,r,s,c,a,d,o,u;const{hooks:i,url:f,options:h}=await ht(e,t),m=wt(h),R=new AbortController,A=(n=h.signal)!=null?n:R.signal,w=It(f,h),M=St(h),v=await Ot(h),O=_t(f,h);let l=P(T({},h),{url:w,headers:v,body:M,method:O,signal:A});for(const _ of i.onRequest)if(_){const b=await _(l);typeof b=="object"&&b!==null&&(l=b)}("pipeTo"in l&&typeof l.pipeTo=="function"||typeof((r=t?.body)==null?void 0:r.pipe)=="function")&&("duplex"in l||(l.duplex="half"));const{clearTimeout:x}=Et(h,R);let p=await m(l.url,l);x();const D={response:p,request:l};for(const _ of i.onResponse)if(_){const b=await _(P(T({},D),{response:(s=t?.hookOptions)!=null&&s.cloneResponse?p.clone():p}));b instanceof Response?p=b:typeof b=="object"&&b!==null&&(p=b.response)}if(p.ok){if(!(l.method!=="HEAD"))return{data:"",error:null};const b=vt(p),C={data:null,response:p,request:l};if(b==="json"||b==="text"){const N=await p.text(),Se=(c=l.jsonParser)!=null?c:pe;C.data=await Se(N)}else C.data=await p[b]();l?.output&&l.output&&!l.disableValidation&&(C.data=await H(l.output,C.data));for(const N of i.onSuccess)N&&await N(P(T({},C),{response:(a=t?.hookOptions)!=null&&a.cloneResponse?p.clone():p}));return t?.throw?C.data:{data:C.data,error:null}}const Oe=(d=t?.jsonParser)!=null?d:pe,j=await p.text(),oe=bt(j),Y=oe?await Oe(j):null,Re={response:p,responseText:j,request:l,error:P(T({},Y),{status:p.status,statusText:p.statusText})};for(const _ of i.onError)_&&await _(P(T({},Re),{response:(o=t?.hookOptions)!=null&&o.cloneResponse?p.clone():p}));if(t?.retry){const _=gt(t.retry),b=(u=t.retryAttempt)!=null?u:0;if(await _.shouldAttemptRetry(b,p)){for(const N of i.onRetry)N&&await N(D);const C=_.getDelay(b);return await new Promise(N=>setTimeout(N,C)),await se(e,P(T({},t),{retryAttempt:b+1}))}}if(t?.throw)throw new dt(p.status,p.statusText,oe?Y:j);return{data:null,error:P(T({},Y),{status:p.status,statusText:p.statusText})}};const At=(e,t)=>{const n="credentials"in Request.prototype,r=De(e?.baseURL,e?.basePath)??"/api/auth",s=e?.plugins?.flatMap(l=>l.fetchPlugins).filter(l=>l!==void 0)||[],c={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:a,onError:d,onRequest:o,onResponse:u,...i}=e?.fetchOptions||{},f=Lt({baseURL:r,...n?{credentials:"include"}:{},method:"GET",jsonParser(l){return l?Ye(l,{strict:!1}):null},customFetchImpl:fetch,...i,plugins:[c,...i.plugins||[],...e?.disableDefaultFetchPlugins?[]:[je],...s]}),{$sessionSignal:h,session:m}=it(f,e),R=e?.plugins||[];let A={};const w={$sessionSignal:h,session:m},M={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},v=[{signal:"$sessionSignal",matcher(l){return l==="/sign-out"||l==="/update-user"||l==="/sign-up/email"||l==="/sign-in/email"||l==="/delete-user"||l==="/verify-email"||l==="/revoke-sessions"||l==="/revoke-session"||l==="/change-email"}}];for(const l of R)l.getAtoms&&Object.assign(w,l.getAtoms?.(f)),l.pathMethods&&Object.assign(M,l.pathMethods),l.atomListeners&&v.push(...l.atomListeners);const O={notify:l=>{w[l].set(!w[l].get())},listen:(l,x)=>{w[l].subscribe(x)},atoms:w};for(const l of R)l.getActions&&(A=_e(l.getActions?.(f,O,e)??{},A));return{get baseURL(){return r},pluginsActions:A,pluginsAtoms:w,pluginPathMethods:M,atomListeners:v,$fetch:f,$store:O}};function xt(e){return typeof e=="object"&&e!==null&&"get"in e&&typeof e.get=="function"&&"lc"in e&&typeof e.lc=="number"}function Ct(e,t,n){const r=t[e],{fetchOptions:s,query:c,...a}=n||{};return r||(s?.method?s.method:a&&Object.keys(a).length>0?"POST":"GET")}function Nt(e,t,n,r,s){function c(a=[]){return new Proxy(function(){},{get(d,o){if(typeof o!="string"||o==="then"||o==="catch"||o==="finally")return;const u=[...a,o];let i=e;for(const f of u)if(i&&typeof i=="object"&&f in i)i=i[f];else{i=void 0;break}return typeof i=="function"||xt(i)?i:c(u)},apply:async(d,o,u)=>{const i="/"+a.map(v=>v.replace(/[A-Z]/g,O=>`-${O.toLowerCase()}`)).join("/"),f=u[0]||{},h=u[1]||{},{query:m,fetchOptions:R,...A}=f,w={...h,...R},M=Ct(i,n,f);return await t(i,{...w,body:M==="GET"?void 0:{...A,...w?.body||{}},query:m||w?.query,method:M,async onSuccess(v){if(await w?.onSuccess?.(v),!s||w.disableSignal)return;const O=s.filter(x=>x.matcher(i));if(!O.length)return;const l=new Set;for(const x of O){const p=r[x.signal];if(!p)return;if(l.has(x.signal))continue;l.add(x.signal);const D=p.get();setTimeout(()=>{p.set(!D)},10)}}})}})}return c()}function ye(e){const t=Ee(),n=e.subscribe(r=>{t.value=r});return Te()&&Pe(n),t}function Mt(e){return`use${Fe(e)}`}function Ut(e){const{baseURL:t,pluginPathMethods:n,pluginsActions:r,pluginsAtoms:s,$fetch:c,$store:a,atomListeners:d}=At(e),o={};for(const[i,f]of Object.entries(s))o[Mt(i)]=()=>ye(f);function u(i){if(i){const f=ye(s.$sessionSignal);return i(`${t}/get-session`,{ref:f}).then(h=>({data:h.data,isPending:!1,error:h.error}))}return o.useSession()}return Nt({...r,...o,useSession:u,$fetch:c,$store:a},c,n,s,d)}let te=null;function qt(){if(!te){const e=window.location.origin;te=Ut({baseURL:e})}return te}function $t(){const e=qt(),t=e.useSession();async function n(o,u){return await e.signIn.email({email:o,password:u})}async function r(){await e.signOut(),Le("/login")}async function s(o,u,i){return await e.signUp.email({email:o,password:u,name:i})}async function c(o){return await e.updateUser(o)}async function a(o){try{return await $fetch("/api/user/email",{method:"PATCH",body:{email:o}}),await e.getSession({fetchOptions:{cache:"no-store"}}),{data:{success:!0},error:null}}catch(u){return{data:null,error:{message:u.data?.message||"Failed to change email"}}}}async function d(o){return await e.changePassword(o)}return{session:t,user:Q(()=>t.value?.data?.user),isAuthenticated:Q(()=>!!t.value?.data?.user),isPending:Q(()=>t.value?.isPending??!0),login:n,logout:r,register:s,updateProfile:c,changeEmail:a,changePassword:d}}export{$t as u};
|
|
1
|
+
import{aZ as _e,s as Ee,y as Te,aK as Pe,h as Q,n as Le}from"./B06CcGVK.js";var Ie={},ie={};const G=Object.create(null),F=e=>Ie||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?G:globalThis),$=new Proxy(G,{get(e,t){return F()[t]??G[t]},has(e,t){return t in F()||t in G},set(e,t,n){const r=F(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;const n=F(!0);return delete n[t],!0},ownKeys(){const e=F(!0);return Object.keys(e)}});function g(e,t){return typeof process<"u"&&ie?ie[e]??t:typeof Deno<"u"?Deno.env.get(e)??t:typeof Bun<"u"?Bun.env[e]??t:t}const B=1,y=4,L=8,S=24,ae={eterm:y,cons25:y,console:y,cygwin:y,dtterm:y,gnome:y,hurd:y,jfbterm:y,konsole:y,kterm:y,mlterm:y,mosh:S,putty:y,st:y,"rxvt-unicode-24bit":S,terminator:S,"xterm-kitty":S},Ae=new Map(Object.entries({APPVEYOR:L,BUILDKITE:L,CIRCLECI:S,DRONE:L,GITEA_ACTIONS:S,GITHUB_ACTIONS:S,GITLAB_CI:L,TRAVIS:L})),xe=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function Ce(){if(g("FORCE_COLOR")!==void 0)switch(g("FORCE_COLOR")){case"":case"1":case"true":return y;case"2":return L;case"3":return S;default:return B}if(g("NODE_DISABLE_COLORS")!==void 0&&g("NODE_DISABLE_COLORS")!==""||g("NO_COLOR")!==void 0&&g("NO_COLOR")!==""||g("TERM")==="dumb")return B;if(g("TMUX"))return S;if("TF_BUILD"in $&&"AGENT_NAME"in $)return y;if("CI"in $){for(const{0:e,1:t}of Ae)if(e in $)return t;return g("CI_NAME")==="codeship"?L:B}if("TEAMCITY_VERSION"in $)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(g("TEAMCITY_VERSION"))!==null?y:B;switch(g("TERM_PROGRAM")){case"iTerm.app":return!g("TERM_PROGRAM_VERSION")||/^[0-2]\./.exec(g("TERM_PROGRAM_VERSION"))!==null?L:S;case"HyperTerm":case"MacTerm":return S;case"Apple_Terminal":return L}if(g("COLORTERM")==="truecolor"||g("COLORTERM")==="24bit")return S;if(g("TERM")){if(/truecolor/.exec(g("TERM"))!==null)return S;if(/^xterm-256/.exec(g("TERM"))!==null)return L;const e=g("TERM").toLowerCase();if(ae[e])return ae[e];if(xe.some(t=>t.exec(e)!==null))return y}return g("COLORTERM")?y:B}const I={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",fg:{red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m"}},ne=["debug","info","success","warn","error"];function Ne(e,t){return ne.indexOf(t)>=ne.indexOf(e)}const Me={info:I.fg.blue,success:I.fg.green,warn:I.fg.yellow,error:I.fg.red,debug:I.fg.magenta},Ue=(e,t,n)=>{const r=new Date().toISOString();return n?`${I.dim}${r}${I.reset} ${Me[e]}${e.toUpperCase()}${I.reset} ${I.bright}[Better Auth]:${I.reset} ${t}`:`${r} ${e.toUpperCase()} [Better Auth]: ${t}`},qe=e=>{const t="error",n=Ce()!==1,r=(s,c,a=[])=>{if(!Ne(t,s))return;const d=Ue(s,c,n);{s==="error"?console.error(d,...a):s==="warn"?console.warn(d,...a):console.log(d,...a);return}};return{...Object.fromEntries(ne.map(s=>[s,(...[c,...a])=>r(s,c,a)])),get level(){return t}}};qe();function Fe(e){return e.charAt(0).toUpperCase()+e.slice(1)}var J=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}};function $e(e){try{return(new URL(e).pathname.replace(/\/+$/,"")||"/")!=="/"}catch{throw new J(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function Be(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new J(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof J?t:new J(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function ue(e,t="/api/auth"){if(Be(e),$e(e))return e;const n=e.replace(/\/+$/,"");return!t||t==="/"?n:(t=t.startsWith("/")?t:`/${t}`,`${n}${t}`)}function De(e,t,n,r,s){if(e)return ue(e,t);if(typeof window<"u"&&window.location)return ue(window.location.origin,t)}const je={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&typeof window<"u"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},ke={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},Ve=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,ce={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},We=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function Ge(e){return e instanceof Date&&!isNaN(e.getTime())}function Je(e){const t=We.exec(e);if(!t)return null;const[,n,r,s,c,a,d,o,u,i,f]=t,h=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(s,10),parseInt(c,10),parseInt(a,10),parseInt(d,10),o?parseInt(o.padEnd(3,"0"),10):0));if(u){const m=(parseInt(i,10)*60+parseInt(f,10))*(u==="+"?-1:1);h.setUTCMinutes(h.getUTCMinutes()+m)}return Ge(h)?h:null}function He(e,t={}){const{strict:n=!1,warnings:r=!1,reviver:s,parseDates:c=!0}=t;if(typeof e!="string")return e;const a=e.trim();if(a.length>0&&a[0]==='"'&&a.endsWith('"')&&!a.slice(1,-1).includes('"'))return a.slice(1,-1);const d=a.toLowerCase();if(d.length<=9&&d in ce)return ce[d];if(!Ve.test(a)){if(n)throw new SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(ke).some(([o,u])=>{const i=u.test(a);return i&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${o} pattern`),i})&&n)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(a,(u,i)=>{if(u==="__proto__"||u==="constructor"&&i&&typeof i=="object"&&"prototype"in i){r&&console.warn(`[better-json] Dropping "${u}" key to prevent prototype pollution`);return}if(c&&typeof i=="string"){const f=Je(i);if(f)return f}return s?s(u,i):i})}catch(o){if(n)throw o;return e}}function Ye(e,t={strict:!0}){return He(e,t)}let E=[],U=0;const k=4,me=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},lc:0,listen(r){return n.lc=t.push(r),()=>{for(let c=U+k;c<E.length;)E[c]===r?E.splice(c,k):c+=k;let s=t.indexOf(r);~s&&(t.splice(s,1),--n.lc||n.off())}},notify(r,s){let c=!E.length;for(let a of t)E.push(a,n.value,r,s);if(c){for(U=0;U<E.length;U+=k)E[U](E[U+1],E[U+2],E[U+3]);E.length=0}},off(){},set(r){let s=n.value;s!==r&&(n.value=r,n.notify(s))},subscribe(r){let s=n.listen(r);return r(n.value),s},value:e};return n},Qe=5,V=6,W=10;let ze=(e,t,n,r)=>(e.events=e.events||{},e.events[n+W]||(e.events[n+W]=r(s=>{e.events[n].reduceRight((c,a)=>(a(c),c),{shared:{},...s})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let s=e.events[n],c=s.indexOf(t);s.splice(c,1),s.length||(delete e.events[n],e.events[n+W](),delete e.events[n+W])}),Xe=1e3,ve=(e,t)=>ze(e,r=>{let s=t(r);s&&e.events[V].push(s)},Qe,r=>{let s=e.listen;e.listen=(...a)=>(!e.lc&&!e.active&&(e.active=!0,r()),s(...a));let c=e.off;return e.events[V]=[],e.off=()=>{c(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let a of e.events[V])a();e.events[V]=[]}},Xe)},()=>{e.listen=s,e.off=c}});const Ze=()=>typeof window>"u",Ke=(e,t,n,r)=>{const s=me({data:null,error:null,isPending:!0,isRefetching:!1,refetch:d=>c(d)}),c=async d=>new Promise(o=>{const u=typeof r=="function"?r({data:s.get().data,error:s.get().error,isPending:s.get().isPending}):r;n(t,{...u,query:{...u?.query,...d?.query},async onSuccess(i){s.set({data:i.data,error:null,isPending:!1,isRefetching:!1,refetch:s.value.refetch}),await u?.onSuccess?.(i)},async onError(i){const{request:f}=i,h=typeof f.retry=="number"?f.retry:f.retry?.attempts,m=f.retryAttempt||0;h&&m<h||(s.set({error:i.error,data:null,isPending:!1,isRefetching:!1,refetch:s.value.refetch}),await u?.onError?.(i))},async onRequest(i){const f=s.get();s.set({isPending:f.data===null,data:f.data,error:null,isRefetching:!0,refetch:s.value.refetch}),await u?.onRequest?.(i)}}).catch(i=>{s.set({error:i,data:null,isPending:!1,isRefetching:!1,refetch:s.value.refetch})}).finally(()=>{o(void 0)})});e=Array.isArray(e)?e:[e];let a=!1;for(const d of e)d.subscribe(async()=>{Ze()||(a?await c():ve(s,()=>{const o=setTimeout(async()=>{a||(await c(),a=!0)},0);return()=>{s.off(),d.off(),clearTimeout(o)}}))});return s},z=Symbol.for("better-auth:broadcast-channel"),et=()=>Math.floor(Date.now()/1e3);var tt=class{listeners=new Set;name;constructor(e="better-auth.message"){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>"u"))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:et()}))}catch{}}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const e=t=>{if(t.key!==this.name)return;const n=JSON.parse(t.newValue??"{}");n?.event!=="session"||!n?.data||this.listeners.forEach(r=>r(n))};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}};function X(e="better-auth.message"){return globalThis[z]||(globalThis[z]=new tt(e)),globalThis[z]}const Z=Symbol.for("better-auth:focus-manager");var nt=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof document>"u"||typeof window.addEventListener>"u")return()=>{};const e=()=>{document.visibilityState==="visible"&&this.setFocused(!0)};return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e,!1)}}};function le(){return globalThis[Z]||(globalThis[Z]=new nt),globalThis[Z]}const K=Symbol.for("better-auth:online-manager");var rt=class{listeners=new Set;isOnline=typeof navigator<"u"?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",t,!1),()=>{window.removeEventListener("online",e,!1),window.removeEventListener("offline",t,!1)}}};function ee(){return globalThis[K]||(globalThis[K]=new rt),globalThis[K]}const q=()=>Math.floor(Date.now()/1e3),st=5;function ot(e){const{sessionAtom:t,sessionSignal:n,$fetch:r,options:s={}}=e,c=s.sessionOptions?.refetchInterval??0,a=s.sessionOptions?.refetchOnWindowFocus??!0,d=s.sessionOptions?.refetchWhenOffline??!1,o={lastSync:0,lastSessionRequest:0,cachedSession:void 0},u=()=>d||ee().isOnline,i=v=>{if(!u())return;if(v?.event==="storage"){o.lastSync=q(),n.set(!n.get());return}const O=t.get();if(v?.event==="poll"){o.lastSessionRequest=q(),r("/get-session").then(l=>{l.error?t.set({...O,data:null,error:l.error}):t.set({...O,data:l.data,error:null}),o.lastSync=q(),n.set(!n.get())}).catch(()=>{});return}if(v?.event==="visibilitychange"){if(q()-o.lastSessionRequest<st)return;o.lastSessionRequest=q()}(O?.data===null||O?.data===void 0||v?.event==="visibilitychange")&&(o.lastSync=q(),n.set(!n.get()))},f=v=>{X().post({event:"session",data:{trigger:v},clientId:Math.random().toString(36).substring(7)})},h=()=>{c&&c>0&&(o.pollInterval=setInterval(()=>{t.get()?.data&&i({event:"poll"})},c*1e3))},m=()=>{o.unsubscribeBroadcast=X().subscribe(()=>{i({event:"storage"})})},R=()=>{a&&(o.unsubscribeFocus=le().subscribe(()=>{i({event:"visibilitychange"})}))},A=()=>{o.unsubscribeOnline=ee().subscribe(v=>{v&&i({event:"visibilitychange"})})};return{init:()=>{h(),m(),R(),A(),X().setup(),le().setup(),ee().setup()},cleanup:()=>{o.pollInterval&&(clearInterval(o.pollInterval),o.pollInterval=void 0),o.unsubscribeBroadcast&&(o.unsubscribeBroadcast(),o.unsubscribeBroadcast=void 0),o.unsubscribeFocus&&(o.unsubscribeFocus(),o.unsubscribeFocus=void 0),o.unsubscribeOnline&&(o.unsubscribeOnline(),o.unsubscribeOnline=void 0),o.lastSync=0,o.lastSessionRequest=0,o.cachedSession=void 0},triggerRefetch:i,broadcastSessionUpdate:f}}function it(e,t){const n=me(!1),r=Ke(n,"/get-session",e,{method:"GET"});return ve(r,()=>{const s=ot({sessionAtom:r,sessionSignal:n,$fetch:e,options:t});return s.init(),()=>{s.cleanup()}}),{session:r,$sessionSignal:n}}var at=Object.defineProperty,ut=Object.defineProperties,ct=Object.getOwnPropertyDescriptors,fe=Object.getOwnPropertySymbols,lt=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,de=(e,t,n)=>t in e?at(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,T=(e,t)=>{for(var n in t||(t={}))lt.call(t,n)&&de(e,n,t[n]);if(fe)for(var n of fe(t))ft.call(t,n)&&de(e,n,t[n]);return e},P=(e,t)=>ut(e,ct(t)),dt=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}},ht=async(e,t)=>{var n,r,s,c,a,d;let o=t||{};const u={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:o,hooks:u};for(const i of t?.plugins||[]){if(i.init){const f=await((n=i.init)==null?void 0:n.call(i,e.toString(),t));o=f.options||o,e=f.url}u.onRequest.push((r=i.hooks)==null?void 0:r.onRequest),u.onResponse.push((s=i.hooks)==null?void 0:s.onResponse),u.onSuccess.push((c=i.hooks)==null?void 0:c.onSuccess),u.onError.push((a=i.hooks)==null?void 0:a.onError),u.onRetry.push((d=i.hooks)==null?void 0:d.onRetry)}return{url:e,options:o,hooks:u}},he=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},pt=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function gt(e){if(typeof e=="number")return new he({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new he(e);case"exponential":return new pt(e);default:throw new Error("Invalid retry strategy")}}var yt=async e=>{const t={},n=async r=>typeof r=="function"?await r():r;if(e?.auth){if(e.auth.type==="Bearer"){const r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type==="Basic"){const[r,s]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!s)return t;t.authorization=`Basic ${btoa(`${r}:${s}`)}`}else if(e.auth.type==="Custom"){const[r,s]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!s)return t;t.authorization=`${r??""} ${s}`}}return t},mt=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function vt(e){const t=e.headers.get("content-type"),n=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";const r=t.split(";").shift()||"";return mt.test(r)?"json":n.has(r)||r.startsWith("text/")?"text":"blob"}function bt(e){try{return JSON.parse(e),!0}catch{return!1}}function re(e){if(e===void 0)return!1;const t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function pe(e){try{return JSON.parse(e)}catch{return e}}function ge(e){return typeof e=="function"}function wt(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&ge(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&ge(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}async function Ot(e){const t=new Headers(e?.headers),n=await yt(e);for(const[r,s]of Object.entries(n||{}))t.set(r,s);if(!t.has("content-type")){const r=Rt(e?.body);r&&t.set("content-type",r)}return t}function Rt(e){return re(e)?"application/json":null}function St(e){if(!e?.body)return null;const t=new Headers(e?.headers);if(re(e.body)&&!t.has("content-type")){for(const[n,r]of Object.entries(e?.body))r instanceof Date&&(e.body[n]=r.toISOString());return JSON.stringify(e.body)}return t.has("content-type")&&t.get("content-type")==="application/x-www-form-urlencoded"&&re(e.body)?new URLSearchParams(e.body).toString():e.body}function _t(e,t){var n;if(t?.method)return t.method.toUpperCase();if(e.startsWith("@")){const r=(n=e.split("@")[1])==null?void 0:n.split("/")[0];return we.includes(r)?r.toUpperCase():t?.body?"POST":"GET"}return t?.body?"POST":"GET"}function Et(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var Tt=class be extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,be.prototype)}};async function H(e,t){const n=await e["~standard"].validate(t);if(n.issues)throw new Tt(n.issues);return n.value}var we=["get","post","put","patch","delete"],Pt=e=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(t,n){var r,s,c,a;const d=((s=(r=e.plugins)==null?void 0:r.find(o=>{var u;return(u=o.schema)!=null&&u.config?t.startsWith(o.schema.config.baseURL||"")||t.startsWith(o.schema.config.prefix||""):!1}))==null?void 0:s.schema)||e.schema;if(d){let o=t;(c=d.config)!=null&&c.prefix&&o.startsWith(d.config.prefix)&&(o=o.replace(d.config.prefix,""),d.config.baseURL&&(t=t.replace(d.config.prefix,d.config.baseURL))),(a=d.config)!=null&&a.baseURL&&o.startsWith(d.config.baseURL)&&(o=o.replace(d.config.baseURL,""));const u=d.schema[o];if(u){let i=P(T({},n),{method:u.method,output:u.output});return n?.disableValidation||(i=P(T({},i),{body:u.input?await H(u.input,n?.body):n?.body,params:u.params?await H(u.params,n?.params):n?.params,query:u.query?await H(u.query,n?.query):n?.query})),{url:t,options:i}}}return{url:t,options:n}}}),Lt=e=>{async function t(n,r){const s=P(T(T({},e),r),{plugins:[...e?.plugins||[],Pt(e||{}),...r?.plugins||[]]});if(e?.catchAllError)try{return await se(n,s)}catch(c){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:c}}}return await se(n,s)}return t};function It(e,t){const{baseURL:n,params:r,query:s}=t||{query:{},params:{},baseURL:""};let c=e.startsWith("http")?e.split("/").slice(0,3).join("/"):n||"";if(e.startsWith("@")){const f=e.toString().split("@")[1].split("/")[0];we.includes(f)&&(e=e.replace(`@${f}/`,"/"))}c.endsWith("/")||(c+="/");let[a,d]=e.replace(c,"").split("?");const o=new URLSearchParams(d);for(const[f,h]of Object.entries(s||{})){if(h==null)continue;let m;if(typeof h=="string")m=h;else if(Array.isArray(h)){for(const R of h)o.append(f,R);continue}else m=JSON.stringify(h);o.set(f,m)}if(r)if(Array.isArray(r)){const f=a.split("/").filter(h=>h.startsWith(":"));for(const[h,m]of f.entries()){const R=r[h];a=a.replace(m,R)}}else for(const[f,h]of Object.entries(r))a=a.replace(`:${f}`,String(h));a=a.split("/").map(encodeURIComponent).join("/"),a.startsWith("/")&&(a=a.slice(1));let u=o.toString();return u=u.length>0?`?${u}`.replace(/\+/g,"%20"):"",c.startsWith("http")?new URL(`${a}${u}`,c):`${c}${a}${u}`}var se=async(e,t)=>{var n,r,s,c,a,d,o,u;const{hooks:i,url:f,options:h}=await ht(e,t),m=wt(h),R=new AbortController,A=(n=h.signal)!=null?n:R.signal,w=It(f,h),M=St(h),v=await Ot(h),O=_t(f,h);let l=P(T({},h),{url:w,headers:v,body:M,method:O,signal:A});for(const _ of i.onRequest)if(_){const b=await _(l);typeof b=="object"&&b!==null&&(l=b)}("pipeTo"in l&&typeof l.pipeTo=="function"||typeof((r=t?.body)==null?void 0:r.pipe)=="function")&&("duplex"in l||(l.duplex="half"));const{clearTimeout:x}=Et(h,R);let p=await m(l.url,l);x();const D={response:p,request:l};for(const _ of i.onResponse)if(_){const b=await _(P(T({},D),{response:(s=t?.hookOptions)!=null&&s.cloneResponse?p.clone():p}));b instanceof Response?p=b:typeof b=="object"&&b!==null&&(p=b.response)}if(p.ok){if(!(l.method!=="HEAD"))return{data:"",error:null};const b=vt(p),C={data:null,response:p,request:l};if(b==="json"||b==="text"){const N=await p.text(),Se=(c=l.jsonParser)!=null?c:pe;C.data=await Se(N)}else C.data=await p[b]();l?.output&&l.output&&!l.disableValidation&&(C.data=await H(l.output,C.data));for(const N of i.onSuccess)N&&await N(P(T({},C),{response:(a=t?.hookOptions)!=null&&a.cloneResponse?p.clone():p}));return t?.throw?C.data:{data:C.data,error:null}}const Oe=(d=t?.jsonParser)!=null?d:pe,j=await p.text(),oe=bt(j),Y=oe?await Oe(j):null,Re={response:p,responseText:j,request:l,error:P(T({},Y),{status:p.status,statusText:p.statusText})};for(const _ of i.onError)_&&await _(P(T({},Re),{response:(o=t?.hookOptions)!=null&&o.cloneResponse?p.clone():p}));if(t?.retry){const _=gt(t.retry),b=(u=t.retryAttempt)!=null?u:0;if(await _.shouldAttemptRetry(b,p)){for(const N of i.onRetry)N&&await N(D);const C=_.getDelay(b);return await new Promise(N=>setTimeout(N,C)),await se(e,P(T({},t),{retryAttempt:b+1}))}}if(t?.throw)throw new dt(p.status,p.statusText,oe?Y:j);return{data:null,error:P(T({},Y),{status:p.status,statusText:p.statusText})}};const At=(e,t)=>{const n="credentials"in Request.prototype,r=De(e?.baseURL,e?.basePath)??"/api/auth",s=e?.plugins?.flatMap(l=>l.fetchPlugins).filter(l=>l!==void 0)||[],c={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:a,onError:d,onRequest:o,onResponse:u,...i}=e?.fetchOptions||{},f=Lt({baseURL:r,...n?{credentials:"include"}:{},method:"GET",jsonParser(l){return l?Ye(l,{strict:!1}):null},customFetchImpl:fetch,...i,plugins:[c,...i.plugins||[],...e?.disableDefaultFetchPlugins?[]:[je],...s]}),{$sessionSignal:h,session:m}=it(f,e),R=e?.plugins||[];let A={};const w={$sessionSignal:h,session:m},M={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},v=[{signal:"$sessionSignal",matcher(l){return l==="/sign-out"||l==="/update-user"||l==="/sign-up/email"||l==="/sign-in/email"||l==="/delete-user"||l==="/verify-email"||l==="/revoke-sessions"||l==="/revoke-session"||l==="/change-email"}}];for(const l of R)l.getAtoms&&Object.assign(w,l.getAtoms?.(f)),l.pathMethods&&Object.assign(M,l.pathMethods),l.atomListeners&&v.push(...l.atomListeners);const O={notify:l=>{w[l].set(!w[l].get())},listen:(l,x)=>{w[l].subscribe(x)},atoms:w};for(const l of R)l.getActions&&(A=_e(l.getActions?.(f,O,e)??{},A));return{get baseURL(){return r},pluginsActions:A,pluginsAtoms:w,pluginPathMethods:M,atomListeners:v,$fetch:f,$store:O}};function xt(e){return typeof e=="object"&&e!==null&&"get"in e&&typeof e.get=="function"&&"lc"in e&&typeof e.lc=="number"}function Ct(e,t,n){const r=t[e],{fetchOptions:s,query:c,...a}=n||{};return r||(s?.method?s.method:a&&Object.keys(a).length>0?"POST":"GET")}function Nt(e,t,n,r,s){function c(a=[]){return new Proxy(function(){},{get(d,o){if(typeof o!="string"||o==="then"||o==="catch"||o==="finally")return;const u=[...a,o];let i=e;for(const f of u)if(i&&typeof i=="object"&&f in i)i=i[f];else{i=void 0;break}return typeof i=="function"||xt(i)?i:c(u)},apply:async(d,o,u)=>{const i="/"+a.map(v=>v.replace(/[A-Z]/g,O=>`-${O.toLowerCase()}`)).join("/"),f=u[0]||{},h=u[1]||{},{query:m,fetchOptions:R,...A}=f,w={...h,...R},M=Ct(i,n,f);return await t(i,{...w,body:M==="GET"?void 0:{...A,...w?.body||{}},query:m||w?.query,method:M,async onSuccess(v){if(await w?.onSuccess?.(v),!s||w.disableSignal)return;const O=s.filter(x=>x.matcher(i));if(!O.length)return;const l=new Set;for(const x of O){const p=r[x.signal];if(!p)return;if(l.has(x.signal))continue;l.add(x.signal);const D=p.get();setTimeout(()=>{p.set(!D)},10)}}})}})}return c()}function ye(e){const t=Ee(),n=e.subscribe(r=>{t.value=r});return Te()&&Pe(n),t}function Mt(e){return`use${Fe(e)}`}function Ut(e){const{baseURL:t,pluginPathMethods:n,pluginsActions:r,pluginsAtoms:s,$fetch:c,$store:a,atomListeners:d}=At(e),o={};for(const[i,f]of Object.entries(s))o[Mt(i)]=()=>ye(f);function u(i){if(i){const f=ye(s.$sessionSignal);return i(`${t}/get-session`,{ref:f}).then(h=>({data:h.data,isPending:!1,error:h.error}))}return o.useSession()}return Nt({...r,...o,useSession:u,$fetch:c,$store:a},c,n,s,d)}let te=null;function qt(){if(!te){const e=window.location.origin;te=Ut({baseURL:e})}return te}function $t(){const e=qt(),t=e.useSession();async function n(o,u){return await e.signIn.email({email:o,password:u})}async function r(){await e.signOut(),Le("/login")}async function s(o,u,i){return await e.signUp.email({email:o,password:u,name:i})}async function c(o){return await e.updateUser(o)}async function a(o){try{return await $fetch("/api/user/email",{method:"PATCH",body:{email:o}}),await e.getSession({fetchOptions:{cache:"no-store"}}),{data:{success:!0},error:null}}catch(u){return{data:null,error:{message:u.data?.message||"Failed to change email"}}}}async function d(o){return await e.changePassword(o)}return{session:t,user:Q(()=>t.value?.data?.user),isAuthenticated:Q(()=>!!t.value?.data?.user),isPending:Q(()=>t.value?.isPending??!0),login:n,logout:r,register:s,updateProfile:c,changeEmail:a,changePassword:d}}export{$t as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as M,d as H,aQ as W,aR as X,aS as L,h as _,bn as ee,c as j,o as z,w as P,Z as Q,a as g,P as U,bm as B,ao as q,r as Y,B as te,T as V,a4 as le,m as ae,bo as $}from"./
|
|
1
|
+
import{e as M,d as H,aQ as W,aR as X,aS as L,h as _,bn as ee,c as j,o as z,w as P,Z as Q,a as g,P as U,bm as B,ao as q,r as Y,B as te,T as V,a4 as le,m as ae,bo as $}from"./B06CcGVK.js";import{R as ne}from"./DZQxxfue.js";import{u as re}from"./DY78sr_b.js";import{f as O}from"./CKfAI3Hb.js";import{u as ue}from"./CXRkSVkD.js";import{R as ie,M as se}from"./olSL1K5t.js";function de(r,f){const e=M(),o=(t,C)=>{if(f.multiple&&Array.isArray(r.value))if(f.selectionBehavior==="replace")r.value=[t],e.value=t;else{const h=r.value.findIndex(i=>C(i));h!==-1?r.value=r.value.filter((i,p)=>p!==h):r.value=[...r.value,t]}else f.selectionBehavior==="replace"?r.value={...t}:!Array.isArray(r.value)&&C(r.value)?r.value=void 0:r.value={...t};return r.value};function x(t,C,h,i){if(!e?.value||!f.multiple||!Array.isArray(r.value))return;const A=h().filter(S=>S.ref.dataset.disabled!=="").find(S=>S.ref===C)?.value;if(!A)return;let K=null;switch(t){case"prev":case"next":{K=O(i,e.value,A);break}case"first":{K=O(i,e.value,i?.[0]);break}case"last":{K=O(i,e.value,i?.[i.length-1]);break}}r.value=K}return{firstValue:e,onSelectItem:o,handleMultipleReplace:x}}function F(r){return r.reduce((f,e)=>(f.push(e),e.children&&f.push(...F(e.children)),f),[])}const[oe,ce]=W("TreeRoot");var ve=H({__name:"TreeRoot",props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},items:{type:Array,required:!1},expanded:{type:Array,required:!1},defaultExpanded:{type:Array,required:!1},getKey:{type:Function,required:!0},getChildren:{type:Function,required:!1,default:r=>r.children},selectionBehavior:{type:String,required:!1,default:"toggle"},multiple:{type:Boolean,required:!1,skipCheck:!0},dir:{type:String,required:!1},disabled:{type:Boolean,required:!1},propagateSelect:{type:Boolean,required:!1},bubbleSelect:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"ul"}},emits:["update:modelValue","update:expanded"],setup(r,{emit:f}){const e=r,o=f,{items:x,multiple:t,disabled:C,propagateSelect:h,dir:i,bubbleSelect:p}=X(e),{handleTypeaheadSearch:A}=ue(),K=re(i),S=M(),k=M(!1),R=ee(),u=L(e,"modelValue",o,{defaultValue:e.defaultValue??(t.value?[]:void 0),passive:!0,deep:!0}),v=L(e,"expanded",o,{defaultValue:e.defaultExpanded??[],passive:e.expanded===void 0,deep:!0}),{onSelectItem:l,handleMultipleReplace:n}=de(u,e),s=_(()=>t.value&&Array.isArray(u.value)?u.value.map(a=>e.getKey(a)):[e.getKey(u.value??{})]);function I(a,d=1,y){return a.reduce((c,m,w)=>{const G=e.getKey(m),N=e.getChildren(m),Z=v.value.includes(G),J={_id:G,value:m,index:w,level:d,parentItem:y,hasChildren:!!N,bind:{value:m,level:d,"aria-setsize":a.length,"aria-posinset":w+1}};return c.push(J),N&&Z&&c.push(...I(N,d+1,m)),c},[])}const T=_(()=>{const a=e.items;return v.value.map(d=>d),I(a??[])});function E(a){if(k.value)R.trigger(a);else{const d=S.value?.getItems()??[];A(a.key,d)}}function b(a){if(k.value)return;const d=se[a.key];te(()=>{n(d,V(),S.value?.getItems,T.value.map(y=>y.value))})}function D(a){if(a.parentItem!=null&&Array.isArray(u.value)&&e.multiple){const d=T.value.find(y=>a.parentItem!=null&&e.getKey(y.value)===e.getKey(a.parentItem));d!=null&&(e.getChildren(d.value)?.every(c=>u.value.find(m=>e.getKey(m)===e.getKey(c)))?u.value=[...u.value,d.value]:u.value=u.value.filter(c=>e.getKey(c)!==e.getKey(d.value)),D(d))}}return ce({modelValue:u,selectedKeys:s,onSelect:a=>{const d=c=>e.getKey(c??{})===e.getKey(a),y=e.multiple&&Array.isArray(u.value)?u.value?.findIndex(d)!==-1:void 0;if(l(a,d),e.bubbleSelect&&e.multiple&&Array.isArray(u.value)){const c=T.value.find(m=>e.getKey(m.value)===e.getKey(a));c!=null&&D(c)}if(e.propagateSelect&&e.multiple&&Array.isArray(u.value)){const c=F(e.getChildren(a)??[]);y?u.value=[...u.value].filter(m=>!c.some(w=>e.getKey(m??{})===e.getKey(w))):u.value=[...u.value,...c]}},expanded:v,onToggle(a){if(!(a?e.getChildren(a):void 0))return;const y=e.getKey(a)??a;v.value.includes(y)?v.value=v.value.filter(c=>c!==y):v.value=[...v.value,y]},getKey:e.getKey,getChildren:e.getChildren,items:x,expandedItems:T,disabled:C,multiple:t,dir:K,propagateSelect:h,bubbleSelect:p,isVirtual:k,virtualKeydownHook:R,handleMultipleReplace:n}),(a,d)=>(z(),j(g(ie),{ref_key:"rovingFocusGroupRef",ref:S,"as-child":"",orientation:"vertical",dir:g(K)},{default:P(()=>[Q(g(U),{role:"tree",as:a.as,"as-child":a.asChild,"aria-multiselectable":g(t)?!0:void 0,onKeydown:[E,B(q(b,["shift"]),["up","down"])]},{default:P(()=>[Y(a.$slots,"default",{flattenItems:T.value,modelValue:g(u),expanded:g(v)})]),_:3},8,["as","as-child","aria-multiselectable","onKeydown"])]),_:3},8,["dir"]))}}),be=ve;const fe="tree.select",pe="tree.toggle";var ye=H({inheritAttrs:!1,__name:"TreeItem",props:{value:{type:null,required:!0},level:{type:Number,required:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"li"}},emits:["select","toggle"],setup(r,{expose:f,emit:e}){const o=r,x=e,t=oe(),{getItems:C}=le(),h=_(()=>!!t.getChildren(o.value)),i=_(()=>{const l=t.getKey(o.value);return t.expanded.value.includes(l)}),p=_(()=>{const l=t.getKey(o.value);return t.selectedKeys.value.includes(l)}),A=_(()=>{if(t.bubbleSelect.value&&h.value&&Array.isArray(t.modelValue.value)){const l=F(t.getChildren(o.value)||[]);return l.some(n=>t.modelValue.value.find(s=>t.getKey(s)===t.getKey(n)))&&!l.every(n=>t.modelValue.value.find(s=>t.getKey(s)===t.getKey(n)))}else return t.propagateSelect.value&&p.value&&h.value&&Array.isArray(t.modelValue.value)?!F(t.getChildren(o.value)||[]).every(n=>t.modelValue.value.find(s=>t.getKey(s)===t.getKey(n))):void 0});function K(l){if(h.value)if(i.value){const n=C().map(b=>b.ref),s=V(),I=n.indexOf(s),E=[...n].slice(I).find(b=>Number(b.getAttribute("data-indent"))===o.level+1);E&&E.focus()}else v(l)}function S(l){if(i.value)v(l);else{const n=C().map(b=>b.ref),s=V(),I=n.indexOf(s),E=[...n].slice(0,I).reverse().find(b=>Number(b.getAttribute("data-indent"))===o.level-1);E&&E.focus()}}async function k(l){x("select",l),!l?.defaultPrevented&&t.onSelect(o.value)}async function R(l){x("toggle",l),!l?.defaultPrevented&&t.onToggle(o.value)}async function u(l){if(!l)return;const n={originalEvent:l,value:o.value,isExpanded:i.value,isSelected:p.value};$(fe,k,n)}async function v(l){if(!l)return;const n={originalEvent:l,value:o.value,isExpanded:i.value,isSelected:p.value};$(pe,R,n)}return f({isExpanded:i,isSelected:p,isIndeterminate:A,handleToggle:()=>t.onToggle(o.value),handleSelect:()=>t.onSelect(o.value)}),(l,n)=>(z(),j(g(ne),{"as-child":"",value:l.value,"allow-shift-key":""},{default:P(()=>[Q(g(U),ae(l.$attrs,{role:"treeitem",as:l.as,"as-child":l.asChild,"aria-selected":p.value,"aria-expanded":h.value?i.value:void 0,"aria-level":l.level,"data-indent":l.level,"data-selected":p.value?"":void 0,"data-expanded":i.value?"":void 0,onKeydown:[B(q(u,["self","prevent"]),["enter","space"]),n[0]||(n[0]=B(q(s=>g(t).dir.value==="ltr"?K(s):S(s),["prevent"]),["right"])),n[1]||(n[1]=B(q(s=>g(t).dir.value==="ltr"?S(s):K(s),["prevent"]),["left"]))],onClick:n[2]||(n[2]=q(s=>{u(s),v(s)},["stop"]))}),{default:P(()=>[Y(l.$slots,"default",{isExpanded:i.value,isSelected:p.value,isIndeterminate:A.value,handleSelect:()=>g(t).onSelect(l.value),handleToggle:()=>g(t).onToggle(l.value)})]),_:3},16,["as","as-child","aria-selected","aria-expanded","aria-level","data-indent","data-selected","data-expanded","onKeydown"])]),_:3},8,["value"]))}}),Ae=ye;export{Ae as T,be as a,oe as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{W as l,h as n,M as c,o as p,r as u,$ as d,ap as e}from"./
|
|
1
|
+
import{W as l,h as n,M as c,o as p,r as u,$ as d,ap as e}from"./B06CcGVK.js";const m={base:"bg-muted"},h={__name:"ProseThead",props:{class:{type:null,required:!1}},setup(s){const a=s,t=l(),o=n(()=>e({extend:e(m),...t.ui?.prose?.thead||{}}));return(r,i)=>(p(),c("thead",{class:d(o.value({class:a.class}))},[u(r.$slots,"default")],2))}};export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{W as p,ad as f,h as i,M as o,o as n,r as c,$ as r,ap as u}from"./
|
|
1
|
+
import{W as p,ad as f,h as i,M as o,o as n,r as c,$ as r,ap as u}from"./B06CcGVK.js";const m={slots:{base:"text-lg text-highlighted font-bold mt-6 mb-2 scroll-mt-[calc(24px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(24px+var(--ui-header-height))] [&>a]:focus-visible:outline-primary",link:""}},g=["id"],k=["href"],y={__name:"ProseH4",props:{id:{type:String,required:!1},class:{type:null,required:!1},ui:{type:null,required:!1}},setup(e){const s=e,d=p(),{headings:a}=f().public?.mdc||{},t=i(()=>u({extend:u(m),...d.ui?.prose?.h4||{}})()),h=i(()=>s.id&&typeof a?.anchorLinks=="object"&&a.anchorLinks.h4);return(l,b)=>(n(),o("h4",{id:e.id,class:r(t.value.base({class:s.class}))},[e.id&&h.value?(n(),o("a",{key:0,href:`#${e.id}`,class:r(t.value.link({class:s.ui?.link}))},[c(l.$slots,"default")],10,k)):c(l.$slots,"default",{key:1})],10,g))}};export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as M,aR as K,aS as L,u as P,h as N,aQ as D,c as o,o as l,w as m,r as k,aa as h,a,m as T,bm as H,ao as O,P as V,aU as z,aq as Q,aV as W,W as X,X as Z,aB as G,aN as J,S as Y,ap as I,ac as _,M as q,$ as d,Z as $,_ as x,al as ee,ab as F,af as R}from"./
|
|
1
|
+
import{d as M,aR as K,aS as L,u as P,h as N,aQ as D,c as o,o as l,w as m,r as k,aa as h,a,m as T,bm as H,ao as O,P as V,aU as z,aq as Q,aV as W,W as X,X as Z,aB as G,aN as J,S as Y,ap as I,ac as _,M as q,$ as d,Z as $,_ as x,al as ee,ab as F,af as R}from"./B06CcGVK.js";import{L as ae}from"./CopZwjN8.js";import{u as te}from"./0L-9iIbm.js";import{V as se}from"./DnfG5RzJ.js";const[le,re]=D("SwitchRoot");var ie=M({__name:"SwitchRoot",props:{defaultValue:{type:Boolean,required:!1},modelValue:{type:[Boolean,null],required:!1,default:void 0},disabled:{type:Boolean,required:!1},id:{type:String,required:!1},value:{type:String,required:!1,default:"on"},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:["update:modelValue"],setup(t,{emit:u}){const e=t,n=u,{disabled:c}=K(e),r=L(e,"modelValue",n,{defaultValue:e.defaultValue,passive:e.modelValue===void 0});function f(){c.value||(r.value=!r.value)}const{forwardRef:g,currentElement:b}=P(),y=te(b),w=N(()=>e.id&&b.value?document.querySelector(`[for="${e.id}"]`)?.innerText:void 0);return re({modelValue:r,toggleCheck:f,disabled:c}),(s,S)=>(l(),o(a(V),T(s.$attrs,{id:s.id,ref:a(g),role:"switch",type:s.as==="button"?"button":void 0,value:s.value,"aria-label":s.$attrs["aria-label"]||w.value,"aria-checked":a(r),"aria-required":s.required,"data-state":a(r)?"checked":"unchecked","data-disabled":a(c)?"":void 0,"as-child":s.asChild,as:s.as,disabled:a(c),onClick:f,onKeydown:H(O(f,["prevent"]),["enter"])}),{default:m(()=>[k(s.$slots,"default",{modelValue:a(r)}),a(y)&&s.name?(l(),o(a(se),{key:0,type:"checkbox",name:s.name,disabled:a(c),required:s.required,value:s.value,checked:!!a(r)},null,8,["name","disabled","required","value","checked"])):h("v-if",!0)]),_:3},16,["id","type","value","aria-label","aria-checked","aria-required","data-state","data-disabled","as-child","as","disabled","onKeydown"]))}}),de=ie,oe=M({__name:"SwitchThumb",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"span"}},setup(t){const u=le();return P(),(e,n)=>(l(),o(a(V),{"data-state":a(u).modelValue?.value?"checked":"unchecked","data-disabled":a(u).disabled.value?"":void 0,"as-child":e.asChild,as:e.as},{default:m(()=>[k(e.$slots,"default")]),_:3},8,["data-state","data-disabled","as-child","as"]))}}),ne=oe;const ce={slots:{root:"relative flex items-start",base:["inline-flex items-center shrink-0 rounded-full border-2 border-transparent focus-visible:outline-2 focus-visible:outline-offset-2 data-[state=unchecked]:bg-accented","transition-[background] duration-200"],container:"flex items-center",thumb:"group pointer-events-none rounded-full bg-default shadow-lg ring-0 transition-transform duration-200 data-[state=unchecked]:translate-x-0 data-[state=unchecked]:rtl:-translate-x-0 flex items-center justify-center",icon:["absolute shrink-0 group-data-[state=unchecked]:text-dimmed opacity-0 size-10/12","transition-[color,opacity] duration-200"],wrapper:"ms-2",label:"block font-medium text-default",description:"text-muted"},variants:{color:{primary:{base:"data-[state=checked]:bg-primary focus-visible:outline-primary",icon:"group-data-[state=checked]:text-primary"},secondary:{base:"data-[state=checked]:bg-secondary focus-visible:outline-secondary",icon:"group-data-[state=checked]:text-secondary"},success:{base:"data-[state=checked]:bg-success focus-visible:outline-success",icon:"group-data-[state=checked]:text-success"},info:{base:"data-[state=checked]:bg-info focus-visible:outline-info",icon:"group-data-[state=checked]:text-info"},warning:{base:"data-[state=checked]:bg-warning focus-visible:outline-warning",icon:"group-data-[state=checked]:text-warning"},error:{base:"data-[state=checked]:bg-error focus-visible:outline-error",icon:"group-data-[state=checked]:text-error"},neutral:{base:"data-[state=checked]:bg-inverted focus-visible:outline-inverted",icon:"group-data-[state=checked]:text-highlighted"}},size:{xs:{base:"w-7",container:"h-4",thumb:"size-3 data-[state=checked]:translate-x-3 data-[state=checked]:rtl:-translate-x-3",wrapper:"text-xs"},sm:{base:"w-8",container:"h-4",thumb:"size-3.5 data-[state=checked]:translate-x-3.5 data-[state=checked]:rtl:-translate-x-3.5",wrapper:"text-xs"},md:{base:"w-9",container:"h-5",thumb:"size-4 data-[state=checked]:translate-x-4 data-[state=checked]:rtl:-translate-x-4",wrapper:"text-sm"},lg:{base:"w-10",container:"h-5",thumb:"size-4.5 data-[state=checked]:translate-x-4.5 data-[state=checked]:rtl:-translate-x-4.5",wrapper:"text-sm"},xl:{base:"w-11",container:"h-6",thumb:"size-5 data-[state=checked]:translate-x-5 data-[state=checked]:rtl:-translate-x-5",wrapper:"text-base"}},checked:{true:{icon:"group-data-[state=checked]:opacity-100"}},unchecked:{true:{icon:"group-data-[state=unchecked]:opacity-100"}},loading:{true:{icon:"animate-spin"}},required:{true:{label:"after:content-['*'] after:ms-0.5 after:text-error"}},disabled:{true:{root:"opacity-75",base:"cursor-not-allowed",label:"cursor-not-allowed",description:"cursor-not-allowed"}}},defaultVariants:{color:"primary",size:"md"}},pe=Object.assign({inheritAttrs:!1},{__name:"USwitch",props:z({as:{type:null,required:!1},color:{type:null,required:!1},size:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},checkedIcon:{type:null,required:!1},uncheckedIcon:{type:null,required:!1},label:{type:String,required:!1},description:{type:String,required:!1},class:{type:null,required:!1},ui:{type:null,required:!1},disabled:{type:Boolean,required:!1},id:{type:String,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1},value:{type:String,required:!1},defaultValue:{type:Boolean,required:!1}},{modelValue:{type:Boolean,default:void 0},modelModifiers:{}}),emits:z(["change"],["update:modelValue"]),setup(t,{emit:u}){const e=t,n=Q(),c=u,r=W(t,"modelValue",{type:Boolean,default:void 0}),f=X(),g=Z(G(e,"required","value","defaultValue")),{id:b,emitFormChange:y,emitFormInput:w,size:s,color:S,name:E,disabled:C,ariaAttrs:U}=J(e),B=b.value??Y(),i=N(()=>I({extend:I(ce),...f.ui?.switch||{}})({size:s.value,color:S.value,required:e.required,loading:e.loading,disabled:C.value||e.loading}));function j(p){const v=new Event("change",{target:{value:p}});c("change",v),y(),w()}return(p,v)=>(l(),o(a(V),{as:t.as,"data-slot":"root",class:d(i.value.root({class:[e.ui?.root,e.class]}))},{default:m(()=>[_("div",{"data-slot":"container",class:d(i.value.container({class:e.ui?.container}))},[$(a(de),T({id:a(B)},{...a(g),...p.$attrs,...a(U)},{modelValue:r.value,"onUpdate:modelValue":[v[0]||(v[0]=A=>r.value=A),j],name:a(E),disabled:a(C)||t.loading,"data-slot":"base",class:i.value.base({class:e.ui?.base})}),{default:m(()=>[$(a(ne),{"data-slot":"thumb",class:d(i.value.thumb({class:e.ui?.thumb}))},{default:m(()=>[t.loading?(l(),o(x,{key:0,name:t.loadingIcon||a(f).ui.icons.loading,"data-slot":"icon",class:d(i.value.icon({class:e.ui?.icon,checked:!0,unchecked:!0}))},null,8,["name","class"])):(l(),q(ee,{key:1},[t.checkedIcon?(l(),o(x,{key:0,name:t.checkedIcon,"data-slot":"icon",class:d(i.value.icon({class:e.ui?.icon,checked:!0}))},null,8,["name","class"])):h("",!0),t.uncheckedIcon?(l(),o(x,{key:1,name:t.uncheckedIcon,"data-slot":"icon",class:d(i.value.icon({class:e.ui?.icon,unchecked:!0}))},null,8,["name","class"])):h("",!0)],64))]),_:1},8,["class"])]),_:1},16,["id","modelValue","name","disabled","class"])],2),t.label||n.label||t.description||n.description?(l(),q("div",{key:0,"data-slot":"wrapper",class:d(i.value.wrapper({class:e.ui?.wrapper}))},[t.label||n.label?(l(),o(a(ae),{key:0,for:a(B),"data-slot":"label",class:d(i.value.label({class:e.ui?.label}))},{default:m(()=>[k(p.$slots,"label",{label:t.label},()=>[F(R(t.label),1)])]),_:3},8,["for","class"])):h("",!0),t.description||n.description?(l(),q("p",{key:1,"data-slot":"description",class:d(i.value.description({class:e.ui?.description}))},[k(p.$slots,"description",{description:t.description},()=>[F(R(t.description),1)])],2)):h("",!0)],2)):h("",!0)]),_:3},8,["as","class"]))}});export{pe as _};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as R,a as x,s as _,f as z,aK as k,bd as C}from"./
|
|
1
|
+
import{h as R,a as x,s as _,f as z,aK as k,bd as C}from"./B06CcGVK.js";function w(r,l,e){let s=e.initialDeps??[],t,n=!0;function o(){var i,h,u;let c;e.key&&((i=e.debug)!=null&&i.call(e))&&(c=Date.now());const d=r();if(!(d.length!==s.length||d.some((g,f)=>s[f]!==g)))return t;s=d;let m;if(e.key&&((h=e.debug)!=null&&h.call(e))&&(m=Date.now()),t=l(...d),e.key&&((u=e.debug)!=null&&u.call(e))){const g=Math.round((Date.now()-c)*100)/100,f=Math.round((Date.now()-m)*100)/100,b=f/16,S=(p,M)=>{for(p=String(p);p.length<M;)p=" "+p;return p};console.info(`%c⏱ ${S(f,5)} /${S(g,5)} ms`,`
|
|
2
2
|
font-size: .6rem;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
color: hsl(${Math.max(0,Math.min(120-120*b,120))}deg 100% 31%);`,e?.key)}return e?.onChange&&!(n&&e.skipInitialOnChange)&&e.onChange(t),n=!1,t}return o.updateDeps=i=>{s=i},o}function E(r,l){if(r===void 0)throw new Error("Unexpected undefined");return r}const T=(r,l)=>Math.abs(r-l)<1.01,D=(r,l,e)=>{let s;return function(...t){r.clearTimeout(s),s=r.setTimeout(()=>l.apply(this,t),e)}},O=r=>{const{offsetWidth:l,offsetHeight:e}=r;return{width:l,height:e}},W=r=>r,L=r=>{const l=Math.max(r.startIndex-r.overscan,0),e=Math.min(r.endIndex+r.overscan,r.count-1),s=[];for(let t=l;t<=e;t++)s.push(t);return s},j=(r,l)=>{const e=r.scrollElement;if(!e)return;const s=r.targetWindow;if(!s)return;const t=o=>{const{width:i,height:h}=o;l({width:Math.round(i),height:Math.round(h)})};if(t(O(e)),!s.ResizeObserver)return()=>{};const n=new s.ResizeObserver(o=>{const i=()=>{const h=o[0];if(h?.borderBoxSize){const u=h.borderBoxSize[0];if(u){t({width:u.inlineSize,height:u.blockSize});return}}t(O(e))};r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()});return n.observe(e,{box:"border-box"}),()=>{n.unobserve(e)}},I={passive:!0},A=typeof window>"u"?!0:"onscrollend"in window,P=(r,l)=>{const e=r.scrollElement;if(!e)return;const s=r.targetWindow;if(!s)return;let t=0;const n=r.options.useScrollendEvent&&A?()=>{}:D(s,()=>{l(t,!1)},r.options.isScrollingResetDelay),o=c=>()=>{const{horizontal:d,isRtl:a}=r.options;t=d?e.scrollLeft*(a&&-1||1):e.scrollTop,n(),l(t,c)},i=o(!0),h=o(!1);h(),e.addEventListener("scroll",i,I);const u=r.options.useScrollendEvent&&A;return u&&e.addEventListener("scrollend",h,I),()=>{e.removeEventListener("scroll",i),u&&e.removeEventListener("scrollend",h)}},B=(r,l,e)=>{if(l?.borderBoxSize){const s=l.borderBoxSize[0];if(s)return Math.round(s[e.options.horizontal?"inlineSize":"blockSize"])}return r[e.options.horizontal?"offsetWidth":"offsetHeight"]},V=(r,{adjustments:l=0,behavior:e},s)=>{var t,n;const o=r+l;(n=(t=s.scrollElement)==null?void 0:t.scrollTo)==null||n.call(t,{[s.options.horizontal?"left":"top"]:o,behavior:e})};class N{constructor(l){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const s=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(t=>{t.forEach(n=>{const o=()=>{this._measureElement(n.target,n)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var t;(t=s())==null||t.disconnect(),e=null},observe:t=>{var n;return(n=s())==null?void 0:n.observe(t,{box:"border-box"})},unobserve:t=>{var n;return(n=s())==null?void 0:n.unobserve(t)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([s,t])=>{typeof t>"u"&&delete e[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:W,rangeExtractor:L,onChange:()=>{},measureElement:B,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var s,t;(t=(s=this.options).onChange)==null||t.call(s,this,e)},this.maybeNotify=w(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(t=>{this.observer.observe(t)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,t=>{this.scrollRect=t,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(t,n)=>{this.scrollAdjustments=0,this.scrollDirection=n?this.getScrollOffset()<t?"forward":"backward":null,this.scrollOffset=t,this.isScrolling=n,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,s)=>{const t=new Map,n=new Map;for(let o=s-1;o>=0;o--){const i=e[o];if(t.has(i.lane))continue;const h=n.get(i.lane);if(h==null||i.end>h.end?n.set(i.lane,i):i.end<h.end&&t.set(i.lane,!0),t.size===this.options.lanes)break}return n.size===this.options.lanes?Array.from(n.values()).sort((o,i)=>o.end===i.end?o.index-i.index:o.end-i.end)[0]:void 0},this.getMeasurementOptions=w(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,s,t,n,o,i)=>(this.prevLanes!==void 0&&this.prevLanes!==i&&(this.lanesChangedFlag=!0),this.prevLanes=i,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:s,scrollMargin:t,getItemKey:n,enabled:o,lanes:i}),{key:!1,skipInitialOnChange:!0,onChange:()=>{this.notify(this.isScrolling)}}),this.getMeasurements=w(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:s,scrollMargin:t,getItemKey:n,enabled:o,lanes:i},h)=>{if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const a of this.laneAssignments.keys())a>=e&&this.laneAssignments.delete(a);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(a=>{this.itemSizeCache.set(a.key,a.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const c=this.measurementsCache.slice(0,u),d=new Array(i).fill(void 0);for(let a=0;a<u;a++){const m=c[a];m&&(d[m.lane]=a)}for(let a=u;a<e;a++){const m=n(a),g=this.laneAssignments.get(a);let f,b;if(g!==void 0&&this.options.lanes>1){f=g;const v=d[f],y=v!==void 0?c[v]:void 0;b=y?y.end+this.options.gap:s+t}else{const v=this.options.lanes===1?c[a-1]:this.getFurthestMeasurement(c,a);b=v?v.end+this.options.gap:s+t,f=v?v.lane:a%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(a,f)}const S=h.get(m),p=typeof S=="number"?S:this.options.estimateSize(a),M=b+p;c[a]={index:a,start:b,size:p,end:M,key:m,lane:f},d[f]=a}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=w(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,s,t,n)=>this.range=e.length>0&&s>0?$({measurements:e,outerSize:s,scrollOffset:t,lanes:n}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=w(()=>{let e=null,s=null;const t=this.calculateRange();return t&&(e=t.startIndex,s=t.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,s]},(e,s,t,n,o)=>n===null||o===null?[]:e({startIndex:n,endIndex:o,overscan:s,count:t}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const s=this.options.indexAttribute,t=e.getAttribute(s);return t?parseInt(t,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(e,s)=>{const t=this.indexFromElement(e),n=this.measurementsCache[t];if(!n)return;const o=n.key,i=this.elementsCache.get(o);i!==e&&(i&&this.observer.unobserve(i),this.observer.observe(e),this.elementsCache.set(o,e)),e.isConnected&&this.resizeItem(t,this.options.measureElement(e,s,this))},this.resizeItem=(e,s)=>{const t=this.measurementsCache[e];if(!t)return;const n=this.itemSizeCache.get(t.key)??t.size,o=s-n;o!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(t,o,this):t.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(t.index),this.itemSizeCache=new Map(this.itemSizeCache.set(t.key,s)),this.notify(!1))},this.measureElement=e=>{if(!e){this.elementsCache.forEach((s,t)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(t))});return}this._measureElement(e,void 0)},this.getVirtualItems=w(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,s)=>{const t=[];for(let n=0,o=e.length;n<o;n++){const i=e[n],h=s[i];t.push(h)}return t},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const s=this.getMeasurements();if(s.length!==0)return E(s[F(0,s.length-1,t=>E(s[t]).start,e)])},this.getOffsetForAlignment=(e,s,t=0)=>{const n=this.getSize(),o=this.getScrollOffset();s==="auto"&&(s=e>=o+n?"end":"start"),s==="center"?e+=(t-n)/2:s==="end"&&(e-=n);const i=this.getTotalSize()+this.options.scrollMargin-n;return Math.max(Math.min(i,e),0)},this.getOffsetForIndex=(e,s="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const t=this.measurementsCache[e];if(!t)return;const n=this.getSize(),o=this.getScrollOffset();if(s==="auto")if(t.end>=o+n-this.options.scrollPaddingEnd)s="end";else if(t.start<=o+this.options.scrollPaddingStart)s="start";else return[o,s];const i=s==="end"?t.end+this.options.scrollPaddingEnd:t.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,s,t.size),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:s="start",behavior:t}={})=>{t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,s),{adjustments:void 0,behavior:t})},this.scrollToIndex=(e,{align:s="auto",behavior:t}={})=>{t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let n=0;const o=10,i=u=>{if(!this.targetWindow)return;const c=this.getOffsetForIndex(e,u);if(!c){console.warn("Failed to get offset for index:",e);return}const[d,a]=c;this._scrollToOffset(d,{adjustments:void 0,behavior:t}),this.targetWindow.requestAnimationFrame(()=>{const m=this.getScrollOffset(),g=this.getOffsetForIndex(e,a);if(!g){console.warn("Failed to get offset for index:",e);return}T(g[0],m)||h(a)})},h=u=>{this.targetWindow&&(n++,n<o?this.targetWindow.requestAnimationFrame(()=>i(u)):console.warn(`Failed to scroll to index ${e} after ${o} attempts.`))};i(s)},this.scrollBy=(e,{behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var e;const s=this.getMeasurements();let t;if(s.length===0)t=this.options.paddingStart;else if(this.options.lanes===1)t=((e=s[s.length-1])==null?void 0:e.end)??0;else{const n=Array(this.options.lanes).fill(null);let o=s.length-1;for(;o>=0&&n.some(i=>i===null);){const i=s[o];n[i.lane]===null&&(n[i.lane]=i.end),o--}t=Math.max(...n.filter(i=>i!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:s,behavior:t})=>{this.options.scrollToFn(e,{behavior:t,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(l)}}const F=(r,l,e,s)=>{for(;r<=l;){const t=(r+l)/2|0,n=e(t);if(n<s)r=t+1;else if(n>s)l=t-1;else return t}return r>0?r-1:0};function $({measurements:r,outerSize:l,scrollOffset:e,lanes:s}){const t=r.length-1,n=h=>r[h].start;if(r.length<=s)return{startIndex:0,endIndex:t};let o=F(0,t,n,e),i=o;if(s===1)for(;i<t&&r[i].end<e+l;)i++;else if(s>1){const h=Array(s).fill(0);for(;i<t&&h.some(c=>c<e+l);){const c=r[i];h[c.lane]=c.end,i++}const u=Array(s).fill(e+l);for(;o>=0&&u.some(c=>c>=e);){const c=r[o];u[c.lane]=c.start,o--}o=Math.max(0,o-o%s),i=Math.min(t,i+(s-1-i%s))}return{startIndex:o,endIndex:i}}function q(r){const l=new N(x(r)),e=_(l),s=l._didMount();return z(()=>x(r).getScrollElement(),t=>{t&&l._willUpdate()},{immediate:!0}),z(()=>x(r),t=>{l.setOptions({...t,onChange:(n,o)=>{var i;C(e),(i=t.onChange)==null||i.call(t,n,o)}}),l._willUpdate(),C(e)},{immediate:!0}),k(s),e}function H(r){return q(R(()=>({observeElementRect:j,observeElementOffset:P,scrollToFn:V,...x(r)})))}export{H as u};
|