import{o as t}from"./rolldown-runtime-iuO8RvI4.js";import{At as e,Lt as s}from"./vendor-all-0-fRSUBfCr.js";import{t as o}from"./preload-helper-DxVatP6Z.js";import{Mi as n,ki as i}from"./vendor-frame-CwiylG4Y.js";import{B as r,F as a,P as l,U as u,m as h,x as p}from"./c11cdaa8f-CprPpd-o.js";var c=t(n(),1),y=class{#t;#e;#s;#o;#n=!1;#i;#r;#a;#l;#u;#h;#p;#c;constructor(t){const{client:e,queryFlavor:s,version:o,onlineManager:n,buttonPosition:i,position:r,initialIsOpen:a,errorTypes:l,styleNonce:u,shadowDOMTarget:h}=t;this.#t=p(e),this.#s=s,this.#o=o,this.#e=n,this.#i=u,this.#r=h,this.#a=p(i),this.#l=p(r),this.#u=p(a),this.#h=p(l)}setButtonPosition(t){this.#a[1](t)}setPosition(t){this.#l[1](t)}setInitialIsOpen(t){this.#u[1](t)}setErrorTypes(t){this.#h[1](t)}setClient(t){this.#t[1](t)}mount(t){if(this.#n)throw new Error("Devtools is already mounted");const e=r(()=>{const t=this,[e]=this.#a,[s]=this.#l,[n]=this.#u,[i]=this.#h,[r]=this.#t;let p;return this.#p?p=this.#p:(p=l(()=>o(()=>import("./c6bb640f7-CFiBhaLr.js"),[])),this.#p=p),u(this.#i,this.#r),h(p,a({get queryFlavor(){return t.#s},get version(){return t.#o},get onlineManager(){return t.#e},get shadowDOMTarget(){return t.#r}},{get client(){return r()},get buttonPosition(){return e()},get position(){return s()},get initialIsOpen(){return n()},get errorTypes(){return i()}}))},t);this.#n=!0,this.#c=e}unmount(){if(!this.#n)throw new Error("Devtools is not mounted");this.#c?.(),this.#n=!1}},d=class{#t;#e;#s;#o;#n=!1;#i;#r;#a;#l;#u;#h;#y;#p;#c;constructor(t){const{client:e,queryFlavor:s,version:o,onlineManager:n,buttonPosition:i,position:r,initialIsOpen:a,errorTypes:l,styleNonce:u,shadowDOMTarget:h,onClose:c}=t;this.#t=p(e),this.#s=s,this.#o=o,this.#e=n,this.#i=u,this.#r=h,this.#a=p(i),this.#l=p(r),this.#u=p(a),this.#h=p(l),this.#y=p(c)}setButtonPosition(t){this.#a[1](t)}setPosition(t){this.#l[1](t)}setInitialIsOpen(t){this.#u[1](t)}setErrorTypes(t){this.#h[1](t)}setClient(t){this.#t[1](t)}setOnClose(t){this.#y[1](()=>t)}mount(t){if(this.#n)throw new Error("Devtools is already mounted");const e=r(()=>{const t=this,[e]=this.#a,[s]=this.#l,[n]=this.#u,[i]=this.#h,[r]=this.#t,[p]=this.#y;let c;return this.#p?c=this.#p:(c=l(()=>o(()=>import("./c8a954cb6-DWPSRNQn.js"),[])),this.#p=c),u(this.#i,this.#r),h(c,a({get queryFlavor(){return t.#s},get version(){return t.#o},get onlineManager(){return t.#e},get shadowDOMTarget(){return t.#r}},{get client(){return r()},get buttonPosition(){return e()},get position(){return s()},get initialIsOpen(){return n()},get errorTypes(){return i()},get onClose(){return p()}}))},t);this.#n=!0,this.#c=e}unmount(){if(!this.#n)throw new Error("Devtools is not mounted");this.#c?.(),this.#n=!1}},g=i();var f=function(t){const o=e(t.client),n=c.useRef(null),{buttonPosition:i,position:r,initialIsOpen:a,errorTypes:l,styleNonce:u,shadowDOMTarget:h}=t,[p]=c.useState(new y({client:o,queryFlavor:"React Query",version:"5",onlineManager:s,buttonPosition:i,position:r,initialIsOpen:a,errorTypes:l,styleNonce:u,shadowDOMTarget:h}));return c.useEffect(()=>{p.setClient(o)},[o,p]),c.useEffect(()=>{i&&p.setButtonPosition(i)},[i,p]),c.useEffect(()=>{r&&p.setPosition(r)},[r,p]),c.useEffect(()=>{p.setInitialIsOpen(a||!1)},[a,p]),c.useEffect(()=>{p.setErrorTypes(l||[])},[l,p]),c.useEffect(()=>(n.current&&p.mount(n.current),()=>{p.unmount()}),[p]),(0,g.jsx)("div",{className:"tsqd-parent-container",ref:n})},m=function(t){const o=e(t.client),n=c.useRef(null),{errorTypes:i,styleNonce:r,shadowDOMTarget:a}=t,[l]=c.useState(new d({client:o,queryFlavor:"React Query",version:"5",onlineManager:s,buttonPosition:"bottom-left",position:"bottom",initialIsOpen:!0,errorTypes:i,styleNonce:r,shadowDOMTarget:a,onClose:t.onClose}));return c.useEffect(()=>{l.setClient(o)},[o,l]),c.useEffect(()=>{l.setOnClose(t.onClose??(()=>{}))},[t.onClose,l]),c.useEffect(()=>{l.setErrorTypes(i||[])},[i,l]),c.useEffect(()=>(n.current&&l.mount(n.current),()=>{l.unmount()}),[l]),(0,g.jsx)("div",{style:{height:"500px",...t.style},className:"tsqd-parent-container",ref:n})};export{f as ReactQueryDevtools,m as ReactQueryDevtoolsPanel};