index-BRiF7qcI.js 1.8 KB

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