Build 533169stable
Module 59845
2,929 characters · in no known chunkDependencies
Source Raw
function(e,t,n){"use strict";n.d(t,{GQ:()=>p,KU:()=>S,pM:()=>C,yq:()=>y});var r=n(178375),i=n(392223),s=n(183590),a=n(564004),o=n(340287),l=n(946020),u=n(64700),c=n(341221),d=n(524519);let _=(0,u.createContext)(!1),f=(0,u.createContext)(null);function p(e){if((0,u.useContext)(f))return e.content;let{collection:t,document:n}=g(e.createCollection);return u.createElement(u.Fragment,null,u.createElement(a.jZ,null,u.createElement(f.Provider,{value:n},e.content)),u.createElement(h,{render:e.children,collection:t}))}function h({collection:e,render:t}){return t(e)}function m(e,t,n){let r=(0,c.wR)(),i=(0,u.useRef)(r);i.current=r;let s=(0,u.useCallback)(()=>i.current?n():t(),[t,n]);return(0,d.useSyncExternalStore)(e,s)}let E="function"==typeof u.useSyncExternalStore?u.useSyncExternalStore:m;function g(e){let[t]=(0,u.useState)(()=>new(0,i.yo)((null==e?void 0:e())||new(0,r.Wk)));return{collection:E((0,u.useCallback)(e=>t.subscribe(e),[t]),(0,u.useCallback)(()=>{let e=t.getCollection();return t.isSSR&&t.resetAfterSSR(),e},[t]),(0,u.useCallback)(()=>(t.isSSR=!0,t.getCollection()),[t])),document:t}}let A=(0,u.createContext)(null);function I(e){var t;return(t=class extends r.Pt{}).type=e,t}function T(e,t,n,r,i,s){"string"==typeof e&&(e=I(e));let a=(0,u.useCallback)(i=>{null==i||i.setProps(t,n,e,r,s)},[t,n,r,s,e]),o=(0,u.useContext)(A);if(o){let a=o.ownerDocument.nodesByProps.get(t);return a||((a=o.ownerDocument.createElement(e.type)).setProps(t,n,e,r,s),o.appendChild(a),o.ownerDocument.updateCollection(),o.ownerDocument.nodesByProps.set(t,a)),i?u.createElement(A.Provider,{value:a},i):null}return u.createElement(e.type,{ref:a},i)}function S(e,t){let n=({node:e})=>t(e.props,e.props.ref,e),r=(0,u.forwardRef)((r,i)=>{let s=(0,u.useContext)(l.gY);if(!(0,u.useContext)(_)){if(t.length>=3)throw Error(t.name+" cannot be rendered outside a collection.");return t(r,i)}return T(e,r,i,"children"in r?r.children:null,null,e=>u.createElement(l.gY.Provider,{value:s},u.createElement(n,{node:e})))});return r.displayName=t.name,r}function y(e,t,n=v){let r=({node:e})=>t(e.props,e.props.ref,e),i=(0,u.forwardRef)((t,i)=>{var s;let a=n(t);return null!=(s=T(e,t,i,null,a,e=>u.createElement(r,{node:e})))?s:u.createElement(u.Fragment,null)});return i.displayName=t.name,i}function v(e){return(0,s.p)({...e,addIdAndValue:!0})}let N=(0,u.createContext)(null);function C(e){let t=(0,u.useContext)(N),n=((null==t?void 0:t.dependencies)||[]).concat(e.dependencies),r=e.idScope||(null==t?void 0:t.idScope),i=v({...e,idScope:r,dependencies:n});return(0,u.useContext)(f)&&(i=u.createElement(R,null,i)),t=(0,u.useMemo)(()=>({dependencies:n,idScope:r}),[r,...n]),u.createElement(N.Provider,{value:t},i)}function R({children:e}){let t=(0,u.useContext)(f),n=(0,u.useMemo)(()=>u.createElement(f.Provider,{value:null},u.createElement(_.Provider,{value:!0},e)),[e]);return(0,c.wR)()?u.createElement(A.Provider,{value:t},n):(0,o.createPortal)(n,t)}}