import{a4 as h,a5 as S,a6 as M,r as v,a7 as O,a8 as R,a9 as T,u as k,aa as y,ab as b,ac as w,J as C}from"./index-D2DB8E0Q.js";function W(e){return R()?(T(e),!0):!1}function m(e){return typeof e=="function"?e():k(e)}const g=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const _=e=>e!=null,B=()=>{};function D(e){return y()}function U(...e){if(e.length!==1)return h(...e);const t=e[0];return typeof t=="function"?S(M(()=>({get:t,set:B}))):v(t)}function A(e,t){D()&&O(e,t)}function E(e){var t;const i=m(e);return(t=i==null?void 0:i.$el)!=null?t:i}const G=g?window:void 0,L=g?window.document:void 0;function $(){const e=v(!1),t=y();return t&&C(()=>{e.value=!0},t),e}function q(e){const t=$();return w(()=>(t.value,!!e()))}function x(e,t,i={}){const{window:s=G,...a}=i;let n;const l=q(()=>s&&"MutationObserver"in s),c=()=>{n&&(n.disconnect(),n=void 0)},r=w(()=>{const u=m(e),p=(Array.isArray(u)?u:[u]).map(E).filter(_);return new Set(p)}),d=b(()=>r.value,u=>{c(),l.value&&u.size&&(n=new MutationObserver(t),u.forEach(p=>n.observe(p,a)))},{immediate:!0,flush:"post"}),f=()=>n==null?void 0:n.takeRecords(),o=()=>{c(),d()};return W(o),{isSupported:l,stop:o,takeRecords:f}}function I(e=null,t={}){var i,s,a;const{document:n=L,restoreOnUnmount:l=o=>o}=t,c=(i=n==null?void 0:n.title)!=null?i:"",r=U((s=e??(n==null?void 0:n.title))!=null?s:null),d=e&&typeof e=="function";function f(o){if(!("titleTemplate"in t))return o;const u=t.titleTemplate||"%s";return typeof u=="function"?u(o):m(u).replace(/%s/g,o)}return b(r,(o,u)=>{o!==u&&n&&(n.title=f(typeof o=="string"?o:""))},{immediate:!0}),t.observe&&!t.titleTemplate&&n&&!d&&x((a=n.head)==null?void 0:a.querySelector("title"),()=>{n&&n.title!==r.value&&(r.value=f(n.title))},{childList:!0}),A(()=>{if(l){const o=l(c,r.value||"");o!=null&&n&&(n.title=o)}}),r}export{I as u};
