Skip to content

The only tool you need to know what is happening and how to fix it.

8.3 KB
Raw Blame
import"./DsnmJJEf.js";import{u as v,g as s,l as R,j as st,ar as gt,p as I,c as u,f as h,d as i,a as x,s as N,e as it,h as j,x as Z,r as q}from"./BKFspo1J.js";import{c as $}from"./CWm9VMfX.js";import{p as o,s as E,r as K}from"./CARHnQ8P.js";import{P as _t,b as bt,g as ut,a as wt,F as Ct}from"./C2bhSnr2.js";import{C as Ot,E as At,S as Nt,b as ht,a as ft,n as G,P as Et}from"./R7BU62x2.js";import{a as vt,g as mt,h as Ft,d as kt,b as f,c as Pt,m as Y}from"./BoImjCaE.js";import{c as yt}from"./BXr1Q65P.js";import{i as V}from"./COK9M2N0.js";import{d as W}from"./DwMHXN8q.js";const at=kt({component:"popover",parts:["root","trigger","content","close","overlay"]}),ct=new Ot("Popover.Root");class pt{static create(t){return ct.set(new pt(t))}opts;#e=st(null);get contentNode(){return s(this.#e)}set contentNode(t){R(this.#e,t,!0)}contentPresence;#t=st(null);get triggerNode(){return s(this.#t)}set triggerNode(t){R(this.#t,t,!0)}#r=st(null);get overlayNode(){return s(this.#r)}set overlayNode(t){R(this.#r,t,!0)}overlayPresence;constructor(t){this.opts=t,this.contentPresence=new ft({ref:f(()=>this.contentNode),open:this.opts.open,onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)}}),this.overlayPresence=new ft({ref:f(()=>this.overlayNode),open:this.opts.open})}toggleOpen(){this.opts.open.current=!this.opts.open.current}handleClose(){this.opts.open.current&&(this.opts.open.current=!1)}}class lt{static create(t){return new lt(t,ct.get())}opts;root;attachment;constructor(t,e){this.opts=t,this.root=e,this.attachment=vt(this.opts.ref,r=>this.root.triggerNode=r),this.onclick=this.onclick.bind(this),this.onkeydown=this.onkeydown.bind(this)}onclick(t){this.opts.disabled.current||t.button===0&&this.root.toggleOpen()}onkeydown(t){this.opts.disabled.current||(t.key===At||t.key===Nt)&&(t.preventDefault(),this.root.toggleOpen())}#e(){if(this.root.opts.open.current&&this.root.contentNode?.id)return this.root.contentNode?.id}#t=v(()=>({id:this.opts.id.current,"aria-haspopup":"dialog","aria-expanded":Ft(this.root.opts.open.current),"data-state":mt(this.root.opts.open.current),"aria-controls":this.#e(),[at.trigger]:"",disabled:this.opts.disabled.current,onkeydown:this.onkeydown,onclick:this.onclick,...this.attachment}));get props(){return s(this.#t)}set props(t){R(this.#t,t)}}class dt{static create(t){return new dt(t,ct.get())}opts;root;attachment;constructor(t,e){this.opts=t,this.root=e,this.attachment=vt(this.opts.ref,r=>this.root.contentNode=r)}onInteractOutside=t=>{if(this.opts.onInteractOutside.current(t),t.defaultPrevented||!ht(t.target))return;const e=t.target.closest(at.selector("trigger"));if(!(e&&e===this.root.triggerNode)){if(this.opts.customAnchor.current){if(ht(this.opts.customAnchor.current)){if(this.opts.customAnchor.current.contains(t.target))return}else if(typeof this.opts.customAnchor.current=="string"){const r=document.querySelector(this.opts.customAnchor.current);if(r&&r.contains(t.target))return}}this.root.handleClose()}};onEscapeKeydown=t=>{this.opts.onEscapeKeydown.current(t),!t.defaultPrevented&&this.root.handleClose()};get shouldRender(){return this.root.contentPresence.shouldRender}#e=v(()=>({open:this.root.opts.open.current}));get snippetProps(){return s(this.#e)}set snippetProps(t){R(this.#e,t)}#t=v(()=>({id:this.opts.id.current,tabindex:-1,"data-state":mt(this.root.opts.open.current),[at.content]:"",style:{pointerEvents:"auto"},...this.attachment}));get props(){return s(this.#t)}set props(t){R(this.#t,t)}popperProps={onInteractOutside:this.onInteractOutside,onEscapeKeydown:this.onEscapeKeydown}}var St=it("<div><div><!></div></div>"),Rt=it("<div><div><!></div></div>");function It(p,t){const e=gt();I(t,!0);let r=o(t,"ref",15,null),n=o(t,"id",19,()=>Pt(e)),a=o(t,"forceMount",3,!1),l=o(t,"onCloseAutoFocus",3,G),g=o(t,"onEscapeKeydown",3,G),d=o(t,"onInteractOutside",3,G),m=o(t,"trapFocus",3,!0),b=o(t,"preventScroll",3,!1),F=o(t,"customAnchor",3,null),k=K(t,["$$slots","$$events","$$legacy","child","children","ref","id","forceMount","onCloseAutoFocus","onEscapeKeydown","onInteractOutside","trapFocus","preventScroll","customAnchor"]);const c=dt.create({id:f(()=>n()),ref:f(()=>r(),C=>r(C)),onInteractOutside:f(()=>d()),onEscapeKeydown:f(()=>g()),customAnchor:f(()=>F())}),H=v(()=>Y(k,c.props));var J=u(),w=h(J);{var P=C=>{_t(C,E(()=>s(H),()=>c.popperProps,{get ref(){return c.opts.ref},get enabled(){return c.root.opts.open.current},get id(){return n()},get trapFocus(){return m()},get preventScroll(){return b()},loop:!0,forceMount:!0,get customAnchor(){return F()},get onCloseAutoFocus(){return l()},get shouldRender(){return c.shouldRender},popper:(et,L)=>{let z=()=>L?.().props,rt=()=>L?.().wrapperProps;const Q=v(()=>Y(z(),{style:ut("popover")}));var T=u(),ot=h(T);{var U=y=>{var _=u(),O=h(_);{let B=v(()=>({props:s(Q),wrapperProps:rt(),...c.snippetProps}));N(O,()=>t.child,()=>s(B))}i(y,_)},X=y=>{var _=St();W(_,()=>({...rt()}));var O=j(_);W(O,()=>({...s(Q)}));var B=j(O);N(B,()=>t.children??Z),q(O),q(_),i(y,_)};V(ot,y=>{t.child?y(U):y(X,!1)})}i(et,T)},$$slots:{popper:!0}}))},M=C=>{var tt=u(),et=h(tt);{var L=z=>{bt(z,E(()=>s(H),()=>c.popperProps,{get ref(){return c.opts.ref},get open(){return c.root.opts.open.current},get id(){return n()},get trapFocus(){return m()},get preventScroll(){return b()},loop:!0,forceMount:!1,get customAnchor(){return F()},get onCloseAutoFocus(){return l()},get shouldRender(){return c.shouldRender},popper:(Q,T)=>{let ot=()=>T?.().props,U=()=>T?.().wrapperProps;const X=v(()=>Y(ot(),{style:ut("popover")}));var y=u(),_=h(y);{var O=S=>{var A=u(),D=h(A);{let nt=v(()=>({props:s(X),wrapperProps:U(),...c.snippetProps}));N(D,()=>t.child,()=>s(nt))}i(S,A)},B=S=>{var A=Rt();W(A,()=>({...U()}));var D=j(A);W(D,()=>({...s(X)}));var nt=j(D);N(nt,()=>t.children??Z),q(D),q(A),i(S,A)};V(_,S=>{t.child?S(O):S(B,!1)})}i(Q,y)},$$slots:{popper:!0}}))};V(et,z=>{a()||z(L)},!0)}i(C,tt)};V(w,C=>{a()?C(P):C(M,!1)})}i(p,J),x()}var xt=it("<button><!></button>");function Kt(p,t){const e=gt();I(t,!0);let r=o(t,"id",19,()=>Pt(e)),n=o(t,"ref",15,null),a=o(t,"type",3,"button"),l=o(t,"disabled",3,!1),g=K(t,["$$slots","$$events","$$legacy","children","child","id","ref","type","disabled"]);const d=lt.create({id:f(()=>r()),ref:f(()=>n(),b=>n(b)),disabled:f(()=>!!l())}),m=v(()=>Y(g,d.props,{type:a()}));wt(p,{get id(){return r()},get ref(){return d.opts.ref},children:(b,F)=>{var k=u(),c=h(k);{var H=w=>{var P=u(),M=h(P);N(M,()=>t.child,()=>({props:s(m)})),i(w,P)},J=w=>{var P=xt();W(P,()=>({...s(m)}));var M=j(P);N(M,()=>t.children??Z),q(P),i(w,P)};V(c,w=>{t.child?w(H):w(J,!1)})}i(b,k)},$$slots:{default:!0}}),x()}function Mt(p,t){I(t,!0);let e=o(t,"open",15,!1),r=o(t,"onOpenChange",3,G),n=o(t,"onOpenChangeComplete",3,G);pt.create({open:f(()=>e(),a=>{e(a),r()(a)}),onOpenChangeComplete:f(()=>n())}),Ct(p,{children:(a,l)=>{var g=u(),d=h(g);N(d,()=>t.children??Z),i(a,g)},$$slots:{default:!0}}),x()}function Lt(p,t){I(t,!0);let e=o(t,"open",15,!1),r=K(t,["$$slots","$$events","$$legacy","open"]);var n=u(),a=h(n);$(a,()=>Mt,(l,g)=>{g(l,E(()=>r,{get open(){return e()},set open(d){e(d)}}))}),i(p,n),x()}function zt(p,t){let e=K(t,["$$slots","$$events","$$legacy"]);var r=u(),n=h(r);$(n,()=>Et,(a,l)=>{l(a,E(()=>e))}),i(p,r)}function Qt(p,t){I(t,!0);let e=o(t,"ref",15,null),r=o(t,"sideOffset",3,4),n=o(t,"align",3,"center"),a=K(t,["$$slots","$$events","$$legacy","ref","class","sideOffset","align","portalProps"]);zt(p,E(()=>t.portalProps,{children:(l,g)=>{var d=u(),m=h(d);{let b=v(()=>yt("z-50 w-72 origin-(--bits-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-end-2 data-[side=right]:slide-in-from-start-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",t.class));$(m,()=>It,(F,k)=>{k(F,E({"data-slot":"popover-content",get sideOffset(){return r()},get align(){return n()},get class(){return s(b)}},()=>a,{get ref(){return e()},set ref(c){e(c)}}))})}i(l,d)},$$slots:{default:!0}})),x()}function Ut(p,t){I(t,!0);let e=o(t,"ref",15,null),r=K(t,["$$slots","$$events","$$legacy","ref","class"]);var n=u(),a=h(n);{let l=v(()=>yt("",t.class));$(a,()=>Kt,(g,d)=>{d(g,E({"data-slot":"popover-trigger",get class(){return s(l)}},()=>r,{get ref(){return e()},set ref(m){e(m)}}))})}i(p,n),x()}export{Ut as P,Qt as a,Lt as b};