@valbuild/ui 0.75.3 → 0.75.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/valbuild-ui.cjs.js +1 -1
- package/dist/valbuild-ui.esm.js +1 -1
- package/package.json +1 -1
- package/server/.tmp/assets/{index-DkqRt0HE.js → index-Co_yjHaq.js} +1 -1
- package/server/.tmp/index.html +1 -1
- package/server/dist/valbuild-ui-server.cjs.js +2 -2
- package/server/dist/valbuild-ui-server.esm.js +2 -2
package/dist/valbuild-ui.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _="/spa/index.css",A="/app",V="val-app",P="val-overlay",s=!1,t="0.75.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _="/spa/index.css",A="/app",V="val-app",P="val-overlay",s=!1,t="0.75.4";exports.IS_DEV=s;exports.VAL_APP_ID=V;exports.VAL_APP_PATH=A;exports.VAL_CSS_PATH=_;exports.VAL_OVERLAY_ID=P;exports.VERSION=t;
|
package/dist/valbuild-ui.esm.js
CHANGED
package/package.json
CHANGED
|
@@ -490,7 +490,7 @@ If you are using Node.js, you can install JSDOM and Remirror will try to use it
|
|
|
490
490
|
|
|
491
491
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
492
492
|
|
|
493
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Hpe="DialogDescriptionWarning",Wpe=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${p3(Hpe).contentName}}.`;return g.useEffect(()=>{var i;const o=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Kpe=n3,Gpe=i3,m3=s3,g3=a3,v3=oE,y3=u3,qpe=f3;const Ype=Kpe,Jpe=Gpe,x3=g.forwardRef(({className:e,...t},n)=>f.jsx(m3,{ref:n,className:ze("fixed inset-0 z-50 bg-bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));x3.displayName=m3.displayName;const b3=g.forwardRef(({className:e,children:t,container:n,hideClose:r,...o},i)=>f.jsxs(Jpe,{container:n,children:[f.jsx(x3,{}),f.jsxs(g3,{ref:i,className:ze("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-bg-background text-text-primary p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",e),...o,children:[t,r?null:f.jsxs(qpe,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-bg-brand-primary data-[state=open]:text-primary_on-brand",children:[f.jsx(Nl,{className:"w-4 h-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));b3.displayName=g3.displayName;const w3=({className:e,...t})=>f.jsx("div",{className:ze("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});w3.displayName="DialogHeader";const Xpe=g.forwardRef(({className:e,...t},n)=>f.jsx(v3,{ref:n,className:ze("text-lg font-semibold leading-none tracking-tight",e),...t}));Xpe.displayName=v3.displayName;const S3=g.forwardRef(({className:e,...t},n)=>f.jsx(y3,{ref:n,className:ze("text-sm text-text-primary",e),...t}));S3.displayName=y3.displayName;function Zpe(){const e=Kr();return f.jsx(Ype,{open:!0,modal:!0,children:f.jsxs(b3,{container:e,"aria-label":"Login required",className:"bg-bg-primary text-text-primary",children:[f.jsx(w3,{children:f.jsx(oE,{children:f.jsx("span",{children:"Log in required"})})}),f.jsx(S3,{children:"You need to log in to access Val."}),f.jsx(Lt,{asChild:!0,children:f.jsx("a",{href:eh("/api/val/authorize",{redirect_to:window.origin+eh("/val")}),children:"Log in"})})]})})}function Qpe(){const{theme:e}=Hv(),[t,n]=g.useState(!1),[r,o]=g.useState(!1),[i,s]=g.useState(!1),{currentSourcePath:a,ready:l}=Vn();return g.useEffect(()=>{!t&&l&&(window.innerWidth<cI?(a||o(!0),n(!0)):(s(!0),o(!0),n(!0)))},[t,l,a]),hR()==="login-required"?f.jsx("div",{className:"min-h-[100svh] bg-bg-primary",children:f.jsx(Zpe,{})}):f.jsx(k3.Provider,{value:{navMenu:{isOpen:r,setOpen:o},toolsMenu:{isOpen:i,setOpen:s}},children:f.jsxs("main",{style:{visibility:"hidden",minHeight:"100svh",width:"100vw"},id:"val-app-container",className:ke("font-sans bg-bg-primary text-text-primary grid grid-cols-1",{"xl:grid-cols-[320px,1fr,320px]":r&&i,"xl:grid-cols-[320px,1fr]":r&&!i,"xl:grid-cols-[1fr,320px]":!r&&i}),...e?{"data-mode":e}:{},children:[f.jsx("div",{className:ke({hidden:!r,"w-[min(320px,100vw)] border-r overflow-x-hidden border-border-primary fixed top-0 left-0 xl:relative xl:left-auto z-[41]":r}),children:f.jsx(uG,{})}),f.jsx("div",{children:f.jsx(Ipe,{})}),f.jsx("div",{className:ke({hidden:!i,"w-[min(320px,100vw)] border-l border-border-primary fixed top-0 right-0 xl:relative xl:right-auto z-[42]":i}),children:f.jsx("div",{className:"min-h-[100svh] bg-bg-primary",children:f.jsx(iq,{})})})]})})}const k3=Se.createContext(new Proxy({},{get(){throw new Error("LayoutContext not provided")}}));function zy(){return g.useContext(k3)}const eme=({client:e,config:t})=>f.jsx(fR,{client:e,dispatchValEvents:!1,config:t,children:f.jsx(PR,{children:f.jsx(Qpe,{})})}),tme=g.createContext(null),p0={didCatch:!1,error:null};class E3 extends g.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=p0}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:i,reason:"imperative-api"}),this.setState(p0)}}componentDidCatch(t,n){var r,o;(r=(o=this.props).onError)===null||r===void 0||r.call(o,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:o}=this.props;if(r&&n.error!==null&&nme(t.resetKeys,o)){var i,s;(i=(s=this.props).onReset)===null||i===void 0||i.call(s,{next:o,prev:t.resetKeys,reason:"keys"}),this.setState(p0)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:o}=this.props,{didCatch:i,error:s}=this.state;let a=t;if(i){const l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")a=n(l);else if(r)a=g.createElement(r,l);else if(o!==void 0)a=o;else throw s}return g.createElement(tme.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},a)}}function nme(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}const rme=({className:e})=>f.jsxs("svg",{width:"58",height:"34",viewBox:"0 0 58 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[f.jsx("g",{filter:"url(#filter0_d_21_1677)",children:f.jsx("path",{d:"M5 5.36426C5 5.16309 5.16309 5 5.36426 5H17.6581C17.8593 5 18.0223 5.16309 18.0223 5.36426V28.4949C18.0223 28.696 17.8593 28.8591 17.6581 28.8591H5.36426C5.16309 28.8591 5 28.696 5 28.4949V5.36426Z",fill:"hsl(var(--accent))"})}),f.jsx("g",{filter:"url(#filter1_i_21_1677)",children:f.jsx("circle",{cx:"11.4656",cy:"23.7595",r:"2.18557",fill:"currentColor"})}),f.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M52.8588 23.839H48.7257H48.537H48.1128C47.6715 23.839 47.4508 23.5942 47.4508 23.1044V13.7293C47.4508 13.5784 47.3285 13.4561 47.1777 13.4561H45.8118C45.6609 13.4561 45.5386 13.5784 45.5386 13.7293V15.1836C45.5386 15.2844 45.4569 15.3661 45.3561 15.3661C45.2876 15.3661 45.225 15.3275 45.1924 15.2672C44.805 14.5503 44.283 14.02 43.6264 13.6765C42.9563 13.301 42.2045 13.1132 41.3709 13.1132C40.6028 13.1132 39.8755 13.252 39.189 13.5295C38.5026 13.8071 37.8979 14.2152 37.3748 14.7539C36.8682 15.2764 36.4678 15.9212 36.1736 16.6885C35.8794 17.4558 35.7323 18.3374 35.7323 19.3332V19.725C35.7323 20.7372 35.8794 21.627 36.1736 22.3942C36.4678 23.1615 36.8682 23.8146 37.3748 24.3533C37.8979 24.8757 38.5026 25.2757 39.189 25.5532C39.8755 25.8144 40.6191 25.945 41.42 25.945C42.1881 25.945 42.9154 25.7491 43.6019 25.3573C44.2751 24.982 44.8058 24.4119 45.1941 23.6471C45.2255 23.5852 45.2886 23.5452 45.358 23.5452H45.3917C45.4728 23.5452 45.5386 23.611 45.5386 23.6921C45.5386 23.7904 45.544 23.8856 45.5547 23.9777V25.1392C45.5547 25.3904 45.7584 25.5941 46.0096 25.5941H47.2261C47.2914 25.5995 47.3581 25.6022 47.4263 25.6022H48.537H48.7257H57.7268C57.8777 25.6022 58 25.4799 58 25.329V24.1122C58 23.9614 57.8777 23.839 57.7268 23.839H55.3174C55.1665 23.839 55.0442 23.7167 55.0442 23.5659V8.73368C55.0442 8.58279 54.9219 8.46048 54.771 8.46048H50.5054C50.3545 8.46048 50.2322 8.58279 50.2322 8.73368V9.95043C50.2322 10.1013 50.3545 10.2236 50.5054 10.2236H52.8588C53.0097 10.2236 53.132 10.3459 53.132 10.4968V23.5659C53.132 23.7167 53.0097 23.839 52.8588 23.839ZM41.6161 24.1329C42.1881 24.1329 42.7111 24.0268 43.1851 23.8146C43.6754 23.6023 44.0922 23.3003 44.4354 22.9085C44.7786 22.5167 45.0483 22.0514 45.2444 21.5127C45.4406 20.9576 45.5386 20.3454 45.5386 19.6761V19.3822C45.5386 18.7292 45.4406 18.1333 45.2444 17.5946C45.0483 17.0395 44.7705 16.5661 44.4109 16.1743C44.0677 15.7824 43.6509 15.4804 43.1606 15.2682C42.6866 15.0396 42.1718 14.9254 41.6161 14.9254C41.044 14.9254 40.521 15.0315 40.0471 15.2437C39.5731 15.4559 39.1563 15.758 38.7968 16.1498C38.4535 16.5252 38.1839 16.9905 37.9877 17.5456C37.7916 18.0843 37.6936 18.6802 37.6936 19.3332V19.725C37.6936 21.1127 38.0531 22.1983 38.7722 22.982C39.5077 23.7493 40.4557 24.1329 41.6161 24.1329ZM31.1115 25.4191C31.0732 25.5287 30.9698 25.6022 30.8536 25.6022H27.4661C27.35 25.6022 27.2465 25.5287 27.2082 25.4191L23.1578 13.8193C23.0958 13.6417 23.2276 13.4561 23.4157 13.4561H25.089C25.2068 13.4561 25.3114 13.5316 25.3484 13.6435L28.9666 24.581C28.9942 24.6643 29.0721 24.7206 29.1599 24.7206C29.2477 24.7206 29.3256 24.6643 29.3532 24.581L32.9714 13.6435C33.0084 13.5316 33.1129 13.4561 33.2308 13.4561H34.9041C35.0922 13.4561 35.224 13.6417 35.162 13.8193L31.1115 25.4191Z",fill:"currentColor"}),f.jsxs("defs",{children:[f.jsxs("filter",{id:"filter0_d_21_1677",x:"0.124722",y:"0.124722",width:"22.7729",height:"33.6097",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[f.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),f.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),f.jsx("feOffset",{}),f.jsx("feGaussianBlur",{stdDeviation:"2.43764"}),f.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),f.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),f.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_21_1677"}),f.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_21_1677",result:"shape"})]}),f.jsxs("filter",{id:"filter1_i_21_1677",x:"9.28003",y:"21.5739",width:"4.37112",height:"4.37112",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[f.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),f.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),f.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),f.jsx("feOffset",{}),f.jsx("feGaussianBlur",{stdDeviation:"0.546392"}),f.jsx("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),f.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),f.jsx("feBlend",{mode:"normal",in2:"shape",result:"effect1_innerShadow_21_1677"})]})]})]});function C3({error:e,resetErrorBoundary:t}){return console.error(e),f.jsx("div",{className:"absolute top-0 left-0 flex items-center justify-center w-screen h-screen bg-bg-primary text-text-primary",children:f.jsx("div",{className:"w-full h-full p-10",children:f.jsxs("div",{className:"w-full h-full p-10 overflow-scroll bg-card text-primary",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-[0.5em] text-lg font-bold text-center py-2",children:[f.jsx(rme,{})," encountered an error"]}),f.jsx("button",{onClick:t,children:f.jsx(Nl,{})})]}),f.jsx("div",{className:"text-4xl font-normal ",children:"Message:"}),f.jsx("pre",{children:e.message}),e.stack&&f.jsx(Uc,{type:"single",className:"font-serif",collapsible:!0,defaultValue:"error",children:f.jsxs(sa,{value:"error",children:[f.jsx(aa,{children:"Stack trace:"}),f.jsx(la,{className:"p-4 bg-bg-secondary",children:e.stack&&f.jsx("pre",{children:e.stack})})]})})]})})})}function ome({root:e,children:t}){return Mr.createPortal(t,e)}const _3=({children:e,style:t})=>{const n=g.useRef(null),[r,o]=g.useState(null);return g.useLayoutEffect(()=>{if(n.current)if(n.current.shadowRoot)o(n.current.shadowRoot);else{const i=n.current.attachShadow({mode:"open"});o(i)}},[]),f.jsx("div",{ref:n,style:t,id:"val-shadow-root",children:r&&f.jsx(ome,{root:r,children:e})})},T3="/spa/index.css",ime="val-app",sme="val-overlay",N3="0.0.0";function P3(){return f.jsxs(f.Fragment,{children:[f.jsx("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),f.jsx("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"use-credentials"}),f.jsx("link",{href:"https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Space+Grotesk:wght@300..700&display=swap",rel:"stylesheet"})]})}function O3(){const[e,t]=g.useState(null);return g.useEffect(()=>{const n=r=>{var a;if(!(r instanceof CustomEvent)){console.warn("Received message of type val-config, but it was not a CustomEvent",r);return}if(r.detail.type!=="val-config"){console.warn("Received message of type val-config, but it did not have the expected type",r.detail);return}const o=r.detail.hash;if(!o){console.warn("Received message of type val-config, but it did not have a hash",r.detail);return}const i=r.detail.config,s=J9.safeParse(i);s.success?t(s.data):(console.error("Invalid config. Recreating...",s.error),t({project:typeof(i==null?void 0:i.project)=="string"?i.project:void 0,root:typeof(i==null?void 0:i.root)=="string"?i.root:void 0,gitCommit:typeof(i==null?void 0:i.gitCommit)=="string"?i.gitCommit:void 0,ai:i!=null&&i.ai&&i.ai.commitMessages&&typeof i.ai.commitMessages.disabled=="boolean"?{commitMessages:{disabled:i.ai.commitMessages.disabled}}:void 0,files:i!=null&&i.files?{directory:typeof((a=i==null?void 0:i.files)==null?void 0:a.directory)=="string"?i.files.directory:"/public/val"}:void 0,gitBranch:typeof(i==null?void 0:i.gitBranch)=="string"?i.gitBranch:void 0,defaultTheme:(i==null?void 0:i.defaultTheme)==="dark"?"dark":"light"})),window.dispatchEvent(new CustomEvent(Y9,{detail:{type:"val-config-received",hash:o}}))};return window.addEventListener(VC,n),()=>{window.removeEventListener(VC,n)}},[]),e}function ame(){const e=O3(),t="/api/val",{client:n}=g.useMemo(()=>({client:wj(t,{...e,contentHostUrl:yM})}),[t,e]);return f.jsxs(f.Fragment,{children:[f.jsx(P3,{}),f.jsxs(_3,{children:[f.jsx("link",{rel:"stylesheet",href:`${t}/static${`/${N3}`}${T3}`}),f.jsx(E3,{fallbackRender:C3,children:f.jsx(eme,{client:n,config:e})})]})]})}var sE="Switch",[lme,Rme]=uo(sE),[cme,ume]=lme(sE),M3=g.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,form:u,...d}=e,[h,p]=g.useState(null),m=$e(t,S=>p(S)),v=g.useRef(!1),b=h?u||!!h.closest("form"):!0,[x=!1,w]=Fr({prop:o,defaultProp:i,onChange:c});return f.jsxs(cme,{scope:n,checked:x,disabled:a,children:[f.jsx(_e.button,{type:"button",role:"switch","aria-checked":x,"aria-required":s,"data-state":I3(x),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:m,onClick:te(e.onClick,S=>{w(C=>!C),b&&(v.current=S.isPropagationStopped(),v.current||S.stopPropagation())})}),b&&f.jsx(dme,{control:h,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});M3.displayName=sE;var j3="SwitchThumb",R3=g.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=ume(j3,n);return f.jsx(_e.span,{"data-state":I3(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});R3.displayName=j3;var dme=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=g.useRef(null),s=OS(n),a=aS(t);return g.useEffect(()=>{const l=i.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&d){const h=new Event("click",{bubbles:r});d.call(l,n),l.dispatchEvent(h)}},[s,n,r]),f.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function I3(e){return e?"checked":"unchecked"}var A3=M3,fme=R3;const D3=g.forwardRef(({className:e,...t},n)=>f.jsx(A3,{className:ze("peer inline-flex h-[22px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:bg-bg-quartenary disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-bg-brand-secondary data-[state=unchecked]:bg-bg-secondary-solid",e),...t,ref:n,children:f.jsx(fme,{className:ze("pointer-events-none block h-[18px] w-5 rounded-full bg-bg-primary-solid shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));D3.displayName=A3.displayName;function hme(e){const[t,n]=g.useState(null),[r,o]=g.useState([]),[i,s]=g.useState({x:0,y:0});g.useEffect(()=>{const v=()=>{s({x:window.scrollX,y:window.scrollY})};return window.addEventListener("scroll",v,{passive:!1}),()=>{window.removeEventListener("scroll",v)}},[]),g.useEffect(()=>{if(t==="select"){let v;const b=()=>{const x=[];document.querySelectorAll("[data-val-path]").forEach(w=>{const S=w.getAttribute("data-val-path");if(!S)return;const C=w.getBoundingClientRect();x.push({top:C.top,left:C.left,width:C.width,height:C.height,joinedPaths:S})}),o(x),v=setTimeout(b,1e3)};return b(),()=>{clearTimeout(v)}}else o([])},[t,i]);const[a,l]=g.useState(null);g.useEffect(()=>{if(t==="select"&&a===null){const v=b=>{b.key==="Escape"&&n(null)};return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v)}}},[t,a]);const{theme:c}=Hv(),[u,d]=g.useState(null),h=Lu(),p="val-menu-right-center";g.useEffect(()=>{try{const v=h&&localStorage.getItem("val-menu-drop-zone-"+((h==null?void 0:h.project)||"unknown"))||localStorage.getItem("val-menu-drop-zone-default");if(v)if(v==="val-menu-left-top"||v==="val-menu-left-center"||v==="val-menu-left-bottom"||v==="val-menu-center-top"||v==="val-menu-center-bottom"||v==="val-menu-right-top"||v==="val-menu-right-center"||v==="val-menu-right-bottom")d(v);else throw new Error("Invalid drop zone: "+v);else d(p)}catch(v){console.error("Error getting drop zone from local storage",v),d(p)}},[(h==null?void 0:h.project)||"unknown"]);const m=v=>{d(v);try{v&&(localStorage.setItem("val-menu-drop-zone-"+((h==null?void 0:h.project)||"unknown"),v),localStorage.setItem("val-menu-drop-zone-default",v))}catch(b){console.error("Error setting drop zone to local storage",b)}};return f.jsxs("div",{...c?{"data-mode":c}:{},id:"val-overlay-container",children:[f.jsx(pme,{editMode:a,setMode:n,setEditMode:l}),r.map((v,b)=>f.jsx("div",{className:"absolute top-0 border border-bg-brand-primary z-[8998] hover:border-2 rounded",onClickCapture:x=>{x.stopPropagation(),n(null),l({joinedPaths:v.joinedPaths,clientY:x.clientY,clientX:x.clientX,boundingBox:v})},style:{display:"block",top:(v==null?void 0:v.top)+i.y,left:(v==null?void 0:v.left)+i.x,width:v==null?void 0:v.width,height:v==null?void 0:v.height},children:f.jsx("div",{className:"relative top-0 left-0 w-full",children:f.jsx("div",{className:"absolute top-[0px] right-[0px] w-full truncate bg-bg-brand-primary text-text-brand-primary flex gap-2 px-2 rounded-bl hover:opacity-20 cursor-pointer",style:{fontSize:`${Math.min(v.height-2,10)}px`,maxHeight:`${Math.min(v.height-2,16)}px`,maxWidth:`${Math.min(v.width-2,300)}px`},children:ee.splitJoinedSourcePaths(v.joinedPaths).map(x=>{const[w,S]=ee.splitModuleFilePathAndModulePath(x);return f.jsx(ry,{link:!1,toolTip:!1,moduleFilePath:w,patchPath:ee.splitModulePath(S)})})})})},b)),a===null&&f.jsx(gme,{...e,mode:t,setMode:n,loading:c===null,dropZone:u,setDropZone:m})]})}function pme({editMode:e,setMode:t,setEditMode:n}){const[r,o]=g.useState({x:window.innerWidth,y:window.innerHeight}),[i,s]=g.useState(window.innerWidth),a=g.useRef(null);g.useEffect(()=>{const u=()=>{e?setTimeout(()=>{if(a.current){const{innerWidth:d,innerHeight:h}=window,{offsetWidth:p,offsetHeight:m}=a.current,v=m,b=p;let x=e.clientX,w=e.clientY;const S=80,C=d-(e.clientX+b);C<0&&(x=x+(C-S));const _=h-(e.clientY+v);_<0&&(w=w+(_-S)),o({x,y:w})}},100):o({x:window.innerWidth,y:window.innerHeight})};window.innerWidth<1024?o({x:16,y:16}):u()},[e]),g.useEffect(()=>{const u=()=>{s(window.innerWidth),i<1024&&o({x:16,y:16})};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[]);const[l,c]=g.useState(!1);return g.useEffect(()=>{if(l){const u=p=>{if(p instanceof MouseEvent)o(m=>({x:m.x+p.movementX,y:m.y+p.movementY}));else{const m=p.touches[0];o(()=>({x:m.clientX,y:m.clientY}))}},d=()=>{c(!1)},h=()=>{c(!1)};return window.addEventListener("mousemove",u),window.addEventListener("mouseup",d),window.addEventListener("click",h),()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",d),window.removeEventListener("click",h)}}},[l]),g.useEffect(()=>{const u=d=>{d.key==="Escape"&&(t("select"),n(null))};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},[]),f.jsxs("div",{className:ke("fixed top-0 left-0 z-[8998]",{hidden:e===null,"opacity-100 w-[200svw] h-[100svh]":e!==null}),children:[f.jsx("div",{className:ke("fixed top-0 left-0",{hidden:e===null,"opacity-100 w-[100vw] h-[100svh]":e!==null}),onClick:u=>{u.preventDefault(),l||(t("select"),n(null))}}),f.jsxs("div",{className:ke("absolute grid grid-cols-[32px,1fr,32px] rounded bg-bg-primary text-text-primary cursor-pointer",{"w-[calc(100vw-32px)] h-[calc(100svh-32px)]":i<1024}),ref:a,style:{top:r.y,left:r.x},children:[f.jsx("div",{className:"cursor-grab",onMouseDown:()=>{c(!0)}}),f.jsxs("div",{className:"grid grid-rows-[32px,1fr,32px]",children:[f.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}}),f.jsxs("form",{className:"flex flex-col items-start justify-start w-full gap-4 lg:justify-start",onSubmit:u=>{u.preventDefault(),u.stopPropagation(),t("select"),n(null)},children:[e&&ee.splitJoinedSourcePaths(e.joinedPaths).map(u=>{const[d,h]=ee.splitModuleFilePathAndModulePath(u),p=ee.splitModulePath(h);return f.jsxs(g.Fragment,{children:[f.jsx(ry,{link:!0,toolTip:!0,moduleFilePath:d,patchPath:p}),f.jsx(mme,{path:u})]},u)}),f.jsx(Lt,{className:"self-end",type:"submit",children:"Done"})]}),f.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}})]}),f.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}})]})]})}function mme({path:e}){const t=It(e);return!("data"in t)||t.data===void 0?f.jsx("div",{className:"flex flex-col gap-4",children:f.jsx(gt,{path:e})}):f.jsx("div",{className:"flex flex-col gap-4 max-w-[600px] w-full",children:f.jsx(Fy,{path:e,schema:t.data,autoFocus:!0})})}function FN({dropZone:e,ghost:t,draftMode:n,draftModeLoading:r,setDraftMode:o,mode:i,setMode:s,disableOverlay:a,loading:l,setDropZone:c}){const u=e==="val-menu-right-center"||e==="val-menu-left-center"?"vertical":"horizontal",d=hR(),h=Kr(),{theme:p,setTheme:m}=Hv(),v=Wv(),[b,x]=g.useState(0),w=qh(),S=Aa()||{},C=Object.keys(S).length,_=Fu();g.useEffect(()=>{const M=()=>{window.innerWidth<400?x(-56):x(32)};return M(),window.addEventListener("resize",M),()=>{window.removeEventListener("resize",M)}},[]);const{publishDisabled:N}=Yh(),P=e==="val-menu-center-bottom"?"top":e==="val-menu-center-top"?"bottom":e==="val-menu-right-center"?"left":e==="val-menu-left-center"?"right":e==="val-menu-left-bottom"||e==="val-menu-right-bottom"?"top":e==="val-menu-right-top"||e==="val-menu-left-top"?"bottom":"top";return f.jsxs("div",{className:"p-4 right-16",children:[l&&f.jsx("div",{className:hv(e)+" p-4",children:f.jsx("div",{className:"flex items-center justify-center p-2 text-white bg-black rounded backdrop-blur",children:f.jsx(Mx,{className:"animate-spin",size:16})})}),d==="login-required"&&f.jsx("div",{className:hv(e)+" p-4",children:f.jsx("div",{className:"flex items-center justify-center p-2 text-white bg-black rounded backdrop-blur",children:f.jsx("a",{href:eh("/api/val/authorize",{redirect_to:window.location.href}),children:f.jsx(E7,{size:16})})})}),f.jsx(rh,{isOpen:n&&!r&&!l&&d!=="login-required",children:f.jsxs("div",{className:ke("flex relative rounded bg-bg-primary border border-border-primary text-text-primary gap-2",{"flex-col py-4 px-2":u==="vertical","flex-row px-4 py-2":u==="horizontal","opacity-70":t}),children:[f.jsx(lc,{label:"Pick content",active:i==="select",onClick:()=>s(M=>M==="select"?null:"select"),icon:f.jsx(I7,{size:16})}),f.jsx(lc,{label:"Disable preview mode",disabled:r,icon:r?f.jsx(Mx,{size:16,className:"animate-spin"}):f.jsx(m7,{size:16}),onClick:()=>o(!1)}),f.jsx("div",{className:"pb-1 mt-1 border-t border-border-primary"}),f.jsxs(ns,{children:[f.jsx(oh,{disabled:N,className:ke("p-2 rounded-full disabled:bg-bg-disabled"),children:f.jsxs(ul,{children:[f.jsx(IS,{children:f.jsxs("div",{className:"relative",children:[w.length>0&&f.jsx("div",{className:"absolute -top-3 -right-3",children:f.jsxs("div",{className:ke("w-4 h-4 text-[9px] leading-4 text-center rounded-full",{"bg-bg-brand-primary":C===0,"bg-bg-error-primary text-text-error-primary":C>0}),children:[C===0&&w.length>9&&f.jsx("span",{children:"9+"}),C===0&&w.length<=9&&f.jsx("span",{children:w.length}),C>9&&f.jsx("span",{children:"9+"}),C<=9&&C>0&&f.jsx("span",{children:C})]})}),f.jsx(kS,{size:16})]})}),f.jsx(AS,{children:f.jsxs("div",{className:"p-2 rounded bg-bg-primary text-text-primary",children:[C>0&&f.jsxs("div",{className:"text-text-error-primary",children:["Cannot ",_==="fs"?"save":"publish"," due to"," ",C," validation error",C>1&&"s"]}),w.length>0&&C==0&&f.jsxs("div",{children:[w.length," patch",w.length>1&&"es"," ready to publish"]})]})})]})}),f.jsxs(hi,{container:h,align:"center",side:P,sideOffset:b,className:"z-[9000] relative max-w-[352px] w-screen rounded-none sm:rounded flex flex-col items-end",children:[f.jsx("div",{className:"absolute sm:hidden top-4 right-4",children:f.jsx(Zv,{children:f.jsx(Nl,{size:16})})}),!N&&f.jsx("div",{className:"flex items-center justify-between gap-4 px-4 py-4 pt-8 sm:hidden",children:f.jsx(Ib,{})}),f.jsx(jo,{children:f.jsx("div",{className:"sm:max-h-[min(400px,80svh)] max-h-[calc(100svh-96px-64px)] w-[320px]",children:f.jsx(BI,{loadingStatus:v})})}),!N&&f.jsx("div",{className:"hidden py-4 sm:block",children:f.jsx(Ib,{})})]})]}),f.jsx(lc,{label:"Studio",icon:f.jsx(l_,{size:16}),onClick:()=>{window.location.href=window.origin+"/val/~"}}),f.jsxs(ns,{children:[f.jsx(oh,{className:ke("p-2 rounded-full disabled:bg-bg-disabled"),children:f.jsx(bR,{size:16})}),f.jsx(hi,{container:h,className:"z-[9003]",children:f.jsxs("div",{className:"grid grid-cols-[1fr,auto] gap-2",children:[f.jsx("span",{children:"Dock to top"}),f.jsx("button",{onClick:()=>{c("val-menu-center-top")},children:f.jsx(M7,{size:16})}),f.jsx("span",{children:"Dock to right"}),f.jsx("button",{onClick:()=>{c("val-menu-right-center")},children:f.jsx(O7,{size:16})}),f.jsx("span",{children:"Dock to left"}),f.jsx("button",{onClick:()=>{c("val-menu-left-center")},children:f.jsx(P7,{size:16})}),f.jsx("span",{children:"Dock to bottom"}),f.jsx("button",{onClick:()=>{c("val-menu-center-bottom")},children:f.jsx(N7,{size:16})}),f.jsx("span",{children:"Dark mode"}),f.jsx(D3,{checked:p==="dark",onCheckedChange:M=>{m(M?"dark":"light")}})]})})]})]})}),f.jsx(rh,{isOpen:!(n&&!r)&&!l&&d!=="login-required",children:f.jsxs("div",{className:ke("flex relative rounded bg-bg-primary text-text-primary gap-2",{"flex-col py-4 px-2":u==="vertical","flex-row px-4 py-2":u==="horizontal","opacity-70":t}),children:[f.jsx(lc,{label:"Enable preview mode",disabled:r,icon:r?f.jsx(Mx,{size:16,className:"animate-spin"}):f.jsx(wR,{size:16}),onClick:()=>{o(!0)}}),f.jsx(lc,{label:"Studio",icon:f.jsx(l_,{size:16}),onClick:()=>{window.location.href=window.origin+"/val/~"}}),f.jsx(lc,{label:"Disable Val",icon:f.jsx(Nl,{size:16}),onClick:()=>a()})]})})]})}function lc({icon:e,onClick:t,disabled:n,active:r,label:o,variant:i}){return f.jsx("button",{disabled:n,className:ke("p-2 rounded-full disabled:bg-bg-disabled",{"bg-bg-brand-primary text-text-brand-primary":i==="primary","text-bg-brand-primary":!!r}),onClick:t,"aria-label":o,title:o,children:e})}function gme(e){const[t,n]=g.useState(!1),{dropZone:r,setDropZone:o}=e,[i,s]=g.useState(null),a=c=>u=>{u.preventDefault(),o(c)},l=c=>u=>{u.preventDefault(),s(c)};return f.jsxs(f.Fragment,{children:[r&&f.jsx("div",{className:ke("z-[8999] cursor-grab",hv(r)),draggable:!0,onDragStart:()=>{n(!0)},onDragEnd:()=>{n(!1)},children:f.jsx(FN,{...e,dropZone:r})}),t&&r&&f.jsxs(f.Fragment,{children:[i&&i!==r&&f.jsx("div",{className:ke("z-[3]",hv(i)),onDrop:a(i),onDragOver:l(i),children:f.jsx(FN,{ghost:!0,...e,dropZone:i})}),f.jsxs("div",{className:"fixed top-0 left-0 grid w-screen h-screen grid-cols-3 grid-rows-3 z-[2]",children:[f.jsx(Cs,{id:"val-menu-left-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-center-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-right-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-left-center",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx("div",{}),f.jsx(Cs,{id:"val-menu-right-center",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-left-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-center-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-right-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l})]})]})]})}function hv(e){let t="fixed transform";return e==="val-menu-left-top"?t+=" left-0 top-0":e==="val-menu-left-center"?t+=" left-0 top-1/2 -translate-y-1/2":e==="val-menu-left-bottom"?t+=" left-0 bottom-0":e==="val-menu-center-top"?t+=" left-1/2 -translate-x-1/2 top-0":e==="val-menu-center-bottom"?t+=" left-1/2 -translate-x-1/2 bottom-0":e==="val-menu-right-top"?t+=" right-0 top-0":e==="val-menu-right-center"?t+=" right-0 top-1/2 -translate-y-1/2":t+=" right-0 bottom-0",t}const Cs=({id:e,onDrop:t,onDragOver:n})=>f.jsx("div",{onDrop:t(e),onDragOver:n(e)});function vme(){const e=O3(),t="/api/val",n=wj("/api/val",{...e,contentHostUrl:yM}),[r,o]=g.useState(!1),[i,s]=g.useState(!1);return g.useEffect(()=>{const a=l=>{l instanceof CustomEvent?(l==null?void 0:l.detail.type)==="draftMode"&&typeof(l==null?void 0:l.detail.value)=="boolean"?o(l.detail.value):l.detail.type==="draftModeLoading"&&typeof l.detail.value=="boolean"?s(l.detail.value):console.error("Val: invalid event detail (val-overlay-spa)",l.detail):console.error("Val: invalid event (val-overlay-spa)",l)};return window.addEventListener("val-overlay-spa",a),window.dispatchEvent(new CustomEvent("val-overlay-provider",{detail:{type:"spa-ready"}})),()=>{window.removeEventListener("val-overlay-spa",a)}},[]),f.jsxs(f.Fragment,{children:[f.jsx(P3,{}),f.jsxs(_3,{children:[f.jsx("style",{children:`
|
|
493
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Hpe="DialogDescriptionWarning",Wpe=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${p3(Hpe).contentName}}.`;return g.useEffect(()=>{var i;const o=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Kpe=n3,Gpe=i3,m3=s3,g3=a3,v3=oE,y3=u3,qpe=f3;const Ype=Kpe,Jpe=Gpe,x3=g.forwardRef(({className:e,...t},n)=>f.jsx(m3,{ref:n,className:ze("fixed inset-0 z-50 bg-bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));x3.displayName=m3.displayName;const b3=g.forwardRef(({className:e,children:t,container:n,hideClose:r,...o},i)=>f.jsxs(Jpe,{container:n,children:[f.jsx(x3,{}),f.jsxs(g3,{ref:i,className:ze("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-bg-background text-text-primary p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",e),...o,children:[t,r?null:f.jsxs(qpe,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-bg-brand-primary data-[state=open]:text-primary_on-brand",children:[f.jsx(Nl,{className:"w-4 h-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));b3.displayName=g3.displayName;const w3=({className:e,...t})=>f.jsx("div",{className:ze("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});w3.displayName="DialogHeader";const Xpe=g.forwardRef(({className:e,...t},n)=>f.jsx(v3,{ref:n,className:ze("text-lg font-semibold leading-none tracking-tight",e),...t}));Xpe.displayName=v3.displayName;const S3=g.forwardRef(({className:e,...t},n)=>f.jsx(y3,{ref:n,className:ze("text-sm text-text-primary",e),...t}));S3.displayName=y3.displayName;function Zpe(){const e=Kr();return f.jsx(Ype,{open:!0,modal:!0,children:f.jsxs(b3,{container:e,"aria-label":"Login required",className:"bg-bg-primary text-text-primary",children:[f.jsx(w3,{children:f.jsx(oE,{children:f.jsx("span",{children:"Log in required"})})}),f.jsx(S3,{children:"You need to log in to access Val."}),f.jsx(Lt,{asChild:!0,children:f.jsx("a",{href:eh("/api/val/authorize",{redirect_to:window.origin+eh("/val")}),children:"Log in"})})]})})}function Qpe(){const{theme:e}=Hv(),[t,n]=g.useState(!1),[r,o]=g.useState(!1),[i,s]=g.useState(!1),{currentSourcePath:a,ready:l}=Vn();return g.useEffect(()=>{!t&&l&&(window.innerWidth<cI?(a||o(!0),n(!0)):(s(!0),o(!0),n(!0)))},[t,l,a]),hR()==="login-required"?f.jsx("div",{className:"min-h-[100svh] bg-bg-primary",children:f.jsx(Zpe,{})}):f.jsx(k3.Provider,{value:{navMenu:{isOpen:r,setOpen:o},toolsMenu:{isOpen:i,setOpen:s}},children:f.jsxs("main",{style:{visibility:"hidden",minHeight:"100svh",width:"100vw"},id:"val-app-container",className:ke("font-sans bg-bg-primary text-text-primary grid grid-cols-1",{"xl:grid-cols-[320px,1fr,320px]":r&&i,"xl:grid-cols-[320px,1fr]":r&&!i,"xl:grid-cols-[1fr,320px]":!r&&i}),...e?{"data-mode":e}:{},children:[f.jsx("div",{className:ke({hidden:!r,"w-[min(320px,100vw)] border-r overflow-x-hidden border-border-primary fixed top-0 left-0 xl:relative xl:left-auto z-[41]":r}),children:f.jsx(uG,{})}),f.jsx("div",{children:f.jsx(Ipe,{})}),f.jsx("div",{className:ke({hidden:!i,"w-[min(320px,100vw)] border-l border-border-primary fixed top-0 right-0 xl:relative xl:right-auto z-[42]":i}),children:f.jsx("div",{className:"min-h-[100svh] bg-bg-primary",children:f.jsx(iq,{})})})]})})}const k3=Se.createContext(new Proxy({},{get(){throw new Error("LayoutContext not provided")}}));function zy(){return g.useContext(k3)}const eme=({client:e,config:t})=>f.jsx(fR,{client:e,dispatchValEvents:!1,config:t,children:f.jsx(PR,{children:f.jsx(Qpe,{})})}),tme=g.createContext(null),p0={didCatch:!1,error:null};class E3 extends g.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=p0}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:i,reason:"imperative-api"}),this.setState(p0)}}componentDidCatch(t,n){var r,o;(r=(o=this.props).onError)===null||r===void 0||r.call(o,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:o}=this.props;if(r&&n.error!==null&&nme(t.resetKeys,o)){var i,s;(i=(s=this.props).onReset)===null||i===void 0||i.call(s,{next:o,prev:t.resetKeys,reason:"keys"}),this.setState(p0)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:o}=this.props,{didCatch:i,error:s}=this.state;let a=t;if(i){const l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")a=n(l);else if(r)a=g.createElement(r,l);else if(o!==void 0)a=o;else throw s}return g.createElement(tme.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},a)}}function nme(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}const rme=({className:e})=>f.jsxs("svg",{width:"58",height:"34",viewBox:"0 0 58 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[f.jsx("g",{filter:"url(#filter0_d_21_1677)",children:f.jsx("path",{d:"M5 5.36426C5 5.16309 5.16309 5 5.36426 5H17.6581C17.8593 5 18.0223 5.16309 18.0223 5.36426V28.4949C18.0223 28.696 17.8593 28.8591 17.6581 28.8591H5.36426C5.16309 28.8591 5 28.696 5 28.4949V5.36426Z",fill:"hsl(var(--accent))"})}),f.jsx("g",{filter:"url(#filter1_i_21_1677)",children:f.jsx("circle",{cx:"11.4656",cy:"23.7595",r:"2.18557",fill:"currentColor"})}),f.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M52.8588 23.839H48.7257H48.537H48.1128C47.6715 23.839 47.4508 23.5942 47.4508 23.1044V13.7293C47.4508 13.5784 47.3285 13.4561 47.1777 13.4561H45.8118C45.6609 13.4561 45.5386 13.5784 45.5386 13.7293V15.1836C45.5386 15.2844 45.4569 15.3661 45.3561 15.3661C45.2876 15.3661 45.225 15.3275 45.1924 15.2672C44.805 14.5503 44.283 14.02 43.6264 13.6765C42.9563 13.301 42.2045 13.1132 41.3709 13.1132C40.6028 13.1132 39.8755 13.252 39.189 13.5295C38.5026 13.8071 37.8979 14.2152 37.3748 14.7539C36.8682 15.2764 36.4678 15.9212 36.1736 16.6885C35.8794 17.4558 35.7323 18.3374 35.7323 19.3332V19.725C35.7323 20.7372 35.8794 21.627 36.1736 22.3942C36.4678 23.1615 36.8682 23.8146 37.3748 24.3533C37.8979 24.8757 38.5026 25.2757 39.189 25.5532C39.8755 25.8144 40.6191 25.945 41.42 25.945C42.1881 25.945 42.9154 25.7491 43.6019 25.3573C44.2751 24.982 44.8058 24.4119 45.1941 23.6471C45.2255 23.5852 45.2886 23.5452 45.358 23.5452H45.3917C45.4728 23.5452 45.5386 23.611 45.5386 23.6921C45.5386 23.7904 45.544 23.8856 45.5547 23.9777V25.1392C45.5547 25.3904 45.7584 25.5941 46.0096 25.5941H47.2261C47.2914 25.5995 47.3581 25.6022 47.4263 25.6022H48.537H48.7257H57.7268C57.8777 25.6022 58 25.4799 58 25.329V24.1122C58 23.9614 57.8777 23.839 57.7268 23.839H55.3174C55.1665 23.839 55.0442 23.7167 55.0442 23.5659V8.73368C55.0442 8.58279 54.9219 8.46048 54.771 8.46048H50.5054C50.3545 8.46048 50.2322 8.58279 50.2322 8.73368V9.95043C50.2322 10.1013 50.3545 10.2236 50.5054 10.2236H52.8588C53.0097 10.2236 53.132 10.3459 53.132 10.4968V23.5659C53.132 23.7167 53.0097 23.839 52.8588 23.839ZM41.6161 24.1329C42.1881 24.1329 42.7111 24.0268 43.1851 23.8146C43.6754 23.6023 44.0922 23.3003 44.4354 22.9085C44.7786 22.5167 45.0483 22.0514 45.2444 21.5127C45.4406 20.9576 45.5386 20.3454 45.5386 19.6761V19.3822C45.5386 18.7292 45.4406 18.1333 45.2444 17.5946C45.0483 17.0395 44.7705 16.5661 44.4109 16.1743C44.0677 15.7824 43.6509 15.4804 43.1606 15.2682C42.6866 15.0396 42.1718 14.9254 41.6161 14.9254C41.044 14.9254 40.521 15.0315 40.0471 15.2437C39.5731 15.4559 39.1563 15.758 38.7968 16.1498C38.4535 16.5252 38.1839 16.9905 37.9877 17.5456C37.7916 18.0843 37.6936 18.6802 37.6936 19.3332V19.725C37.6936 21.1127 38.0531 22.1983 38.7722 22.982C39.5077 23.7493 40.4557 24.1329 41.6161 24.1329ZM31.1115 25.4191C31.0732 25.5287 30.9698 25.6022 30.8536 25.6022H27.4661C27.35 25.6022 27.2465 25.5287 27.2082 25.4191L23.1578 13.8193C23.0958 13.6417 23.2276 13.4561 23.4157 13.4561H25.089C25.2068 13.4561 25.3114 13.5316 25.3484 13.6435L28.9666 24.581C28.9942 24.6643 29.0721 24.7206 29.1599 24.7206C29.2477 24.7206 29.3256 24.6643 29.3532 24.581L32.9714 13.6435C33.0084 13.5316 33.1129 13.4561 33.2308 13.4561H34.9041C35.0922 13.4561 35.224 13.6417 35.162 13.8193L31.1115 25.4191Z",fill:"currentColor"}),f.jsxs("defs",{children:[f.jsxs("filter",{id:"filter0_d_21_1677",x:"0.124722",y:"0.124722",width:"22.7729",height:"33.6097",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[f.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),f.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),f.jsx("feOffset",{}),f.jsx("feGaussianBlur",{stdDeviation:"2.43764"}),f.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),f.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),f.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_21_1677"}),f.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_21_1677",result:"shape"})]}),f.jsxs("filter",{id:"filter1_i_21_1677",x:"9.28003",y:"21.5739",width:"4.37112",height:"4.37112",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[f.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),f.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),f.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),f.jsx("feOffset",{}),f.jsx("feGaussianBlur",{stdDeviation:"0.546392"}),f.jsx("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),f.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),f.jsx("feBlend",{mode:"normal",in2:"shape",result:"effect1_innerShadow_21_1677"})]})]})]});function C3({error:e,resetErrorBoundary:t}){return console.error(e),f.jsx("div",{className:"absolute top-0 left-0 flex items-center justify-center w-screen h-screen bg-bg-primary text-text-primary",children:f.jsx("div",{className:"w-full h-full p-10",children:f.jsxs("div",{className:"w-full h-full p-10 overflow-scroll bg-card text-primary",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-[0.5em] text-lg font-bold text-center py-2",children:[f.jsx(rme,{})," encountered an error"]}),f.jsx("button",{onClick:t,children:f.jsx(Nl,{})})]}),f.jsx("div",{className:"text-4xl font-normal ",children:"Message:"}),f.jsx("pre",{children:e.message}),e.stack&&f.jsx(Uc,{type:"single",className:"font-serif",collapsible:!0,defaultValue:"error",children:f.jsxs(sa,{value:"error",children:[f.jsx(aa,{children:"Stack trace:"}),f.jsx(la,{className:"p-4 bg-bg-secondary",children:e.stack&&f.jsx("pre",{children:e.stack})})]})})]})})})}function ome({root:e,children:t}){return Mr.createPortal(t,e)}const _3=({children:e,style:t})=>{const n=g.useRef(null),[r,o]=g.useState(null);return g.useLayoutEffect(()=>{if(n.current)if(n.current.shadowRoot)o(n.current.shadowRoot);else{const i=n.current.attachShadow({mode:"open"});o(i)}},[]),f.jsx("div",{ref:n,style:t,id:"val-shadow-root",children:r&&f.jsx(ome,{root:r,children:e})})},T3="/spa/index.css",ime="val-app",sme="val-overlay",N3="$$BUILD_$$REPLACE_WITH_VERSION$$";function P3(){return f.jsxs(f.Fragment,{children:[f.jsx("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),f.jsx("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"use-credentials"}),f.jsx("link",{href:"https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Space+Grotesk:wght@300..700&display=swap",rel:"stylesheet"})]})}function O3(){const[e,t]=g.useState(null);return g.useEffect(()=>{const n=r=>{var a;if(!(r instanceof CustomEvent)){console.warn("Received message of type val-config, but it was not a CustomEvent",r);return}if(r.detail.type!=="val-config"){console.warn("Received message of type val-config, but it did not have the expected type",r.detail);return}const o=r.detail.hash;if(!o){console.warn("Received message of type val-config, but it did not have a hash",r.detail);return}const i=r.detail.config,s=J9.safeParse(i);s.success?t(s.data):(console.error("Invalid config. Recreating...",s.error),t({project:typeof(i==null?void 0:i.project)=="string"?i.project:void 0,root:typeof(i==null?void 0:i.root)=="string"?i.root:void 0,gitCommit:typeof(i==null?void 0:i.gitCommit)=="string"?i.gitCommit:void 0,ai:i!=null&&i.ai&&i.ai.commitMessages&&typeof i.ai.commitMessages.disabled=="boolean"?{commitMessages:{disabled:i.ai.commitMessages.disabled}}:void 0,files:i!=null&&i.files?{directory:typeof((a=i==null?void 0:i.files)==null?void 0:a.directory)=="string"?i.files.directory:"/public/val"}:void 0,gitBranch:typeof(i==null?void 0:i.gitBranch)=="string"?i.gitBranch:void 0,defaultTheme:(i==null?void 0:i.defaultTheme)==="dark"?"dark":"light"})),window.dispatchEvent(new CustomEvent(Y9,{detail:{type:"val-config-received",hash:o}}))};return window.addEventListener(VC,n),()=>{window.removeEventListener(VC,n)}},[]),e}function ame(){const e=O3(),t="/api/val",{client:n}=g.useMemo(()=>({client:wj(t,{...e,contentHostUrl:yM})}),[t,e]);return f.jsxs(f.Fragment,{children:[f.jsx(P3,{}),f.jsxs(_3,{children:[f.jsx("link",{rel:"stylesheet",href:`${t}/static${`/${N3}`}${T3}`}),f.jsx(E3,{fallbackRender:C3,children:f.jsx(eme,{client:n,config:e})})]})]})}var sE="Switch",[lme,Rme]=uo(sE),[cme,ume]=lme(sE),M3=g.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,form:u,...d}=e,[h,p]=g.useState(null),m=$e(t,S=>p(S)),v=g.useRef(!1),b=h?u||!!h.closest("form"):!0,[x=!1,w]=Fr({prop:o,defaultProp:i,onChange:c});return f.jsxs(cme,{scope:n,checked:x,disabled:a,children:[f.jsx(_e.button,{type:"button",role:"switch","aria-checked":x,"aria-required":s,"data-state":I3(x),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:m,onClick:te(e.onClick,S=>{w(C=>!C),b&&(v.current=S.isPropagationStopped(),v.current||S.stopPropagation())})}),b&&f.jsx(dme,{control:h,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});M3.displayName=sE;var j3="SwitchThumb",R3=g.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=ume(j3,n);return f.jsx(_e.span,{"data-state":I3(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});R3.displayName=j3;var dme=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=g.useRef(null),s=OS(n),a=aS(t);return g.useEffect(()=>{const l=i.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&d){const h=new Event("click",{bubbles:r});d.call(l,n),l.dispatchEvent(h)}},[s,n,r]),f.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function I3(e){return e?"checked":"unchecked"}var A3=M3,fme=R3;const D3=g.forwardRef(({className:e,...t},n)=>f.jsx(A3,{className:ze("peer inline-flex h-[22px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:bg-bg-quartenary disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-bg-brand-secondary data-[state=unchecked]:bg-bg-secondary-solid",e),...t,ref:n,children:f.jsx(fme,{className:ze("pointer-events-none block h-[18px] w-5 rounded-full bg-bg-primary-solid shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));D3.displayName=A3.displayName;function hme(e){const[t,n]=g.useState(null),[r,o]=g.useState([]),[i,s]=g.useState({x:0,y:0});g.useEffect(()=>{const v=()=>{s({x:window.scrollX,y:window.scrollY})};return window.addEventListener("scroll",v,{passive:!1}),()=>{window.removeEventListener("scroll",v)}},[]),g.useEffect(()=>{if(t==="select"){let v;const b=()=>{const x=[];document.querySelectorAll("[data-val-path]").forEach(w=>{const S=w.getAttribute("data-val-path");if(!S)return;const C=w.getBoundingClientRect();x.push({top:C.top,left:C.left,width:C.width,height:C.height,joinedPaths:S})}),o(x),v=setTimeout(b,1e3)};return b(),()=>{clearTimeout(v)}}else o([])},[t,i]);const[a,l]=g.useState(null);g.useEffect(()=>{if(t==="select"&&a===null){const v=b=>{b.key==="Escape"&&n(null)};return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v)}}},[t,a]);const{theme:c}=Hv(),[u,d]=g.useState(null),h=Lu(),p="val-menu-right-center";g.useEffect(()=>{try{const v=h&&localStorage.getItem("val-menu-drop-zone-"+((h==null?void 0:h.project)||"unknown"))||localStorage.getItem("val-menu-drop-zone-default");if(v)if(v==="val-menu-left-top"||v==="val-menu-left-center"||v==="val-menu-left-bottom"||v==="val-menu-center-top"||v==="val-menu-center-bottom"||v==="val-menu-right-top"||v==="val-menu-right-center"||v==="val-menu-right-bottom")d(v);else throw new Error("Invalid drop zone: "+v);else d(p)}catch(v){console.error("Error getting drop zone from local storage",v),d(p)}},[(h==null?void 0:h.project)||"unknown"]);const m=v=>{d(v);try{v&&(localStorage.setItem("val-menu-drop-zone-"+((h==null?void 0:h.project)||"unknown"),v),localStorage.setItem("val-menu-drop-zone-default",v))}catch(b){console.error("Error setting drop zone to local storage",b)}};return f.jsxs("div",{...c?{"data-mode":c}:{},id:"val-overlay-container",children:[f.jsx(pme,{editMode:a,setMode:n,setEditMode:l}),r.map((v,b)=>f.jsx("div",{className:"absolute top-0 border border-bg-brand-primary z-[8998] hover:border-2 rounded",onClickCapture:x=>{x.stopPropagation(),n(null),l({joinedPaths:v.joinedPaths,clientY:x.clientY,clientX:x.clientX,boundingBox:v})},style:{display:"block",top:(v==null?void 0:v.top)+i.y,left:(v==null?void 0:v.left)+i.x,width:v==null?void 0:v.width,height:v==null?void 0:v.height},children:f.jsx("div",{className:"relative top-0 left-0 w-full",children:f.jsx("div",{className:"absolute top-[0px] right-[0px] w-full truncate bg-bg-brand-primary text-text-brand-primary flex gap-2 px-2 rounded-bl hover:opacity-20 cursor-pointer",style:{fontSize:`${Math.min(v.height-2,10)}px`,maxHeight:`${Math.min(v.height-2,16)}px`,maxWidth:`${Math.min(v.width-2,300)}px`},children:ee.splitJoinedSourcePaths(v.joinedPaths).map(x=>{const[w,S]=ee.splitModuleFilePathAndModulePath(x);return f.jsx(ry,{link:!1,toolTip:!1,moduleFilePath:w,patchPath:ee.splitModulePath(S)})})})})},b)),a===null&&f.jsx(gme,{...e,mode:t,setMode:n,loading:c===null,dropZone:u,setDropZone:m})]})}function pme({editMode:e,setMode:t,setEditMode:n}){const[r,o]=g.useState({x:window.innerWidth,y:window.innerHeight}),[i,s]=g.useState(window.innerWidth),a=g.useRef(null);g.useEffect(()=>{const u=()=>{e?setTimeout(()=>{if(a.current){const{innerWidth:d,innerHeight:h}=window,{offsetWidth:p,offsetHeight:m}=a.current,v=m,b=p;let x=e.clientX,w=e.clientY;const S=80,C=d-(e.clientX+b);C<0&&(x=x+(C-S));const _=h-(e.clientY+v);_<0&&(w=w+(_-S)),o({x,y:w})}},100):o({x:window.innerWidth,y:window.innerHeight})};window.innerWidth<1024?o({x:16,y:16}):u()},[e]),g.useEffect(()=>{const u=()=>{s(window.innerWidth),i<1024&&o({x:16,y:16})};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[]);const[l,c]=g.useState(!1);return g.useEffect(()=>{if(l){const u=p=>{if(p instanceof MouseEvent)o(m=>({x:m.x+p.movementX,y:m.y+p.movementY}));else{const m=p.touches[0];o(()=>({x:m.clientX,y:m.clientY}))}},d=()=>{c(!1)},h=()=>{c(!1)};return window.addEventListener("mousemove",u),window.addEventListener("mouseup",d),window.addEventListener("click",h),()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",d),window.removeEventListener("click",h)}}},[l]),g.useEffect(()=>{const u=d=>{d.key==="Escape"&&(t("select"),n(null))};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},[]),f.jsxs("div",{className:ke("fixed top-0 left-0 z-[8998]",{hidden:e===null,"opacity-100 w-[200svw] h-[100svh]":e!==null}),children:[f.jsx("div",{className:ke("fixed top-0 left-0",{hidden:e===null,"opacity-100 w-[100vw] h-[100svh]":e!==null}),onClick:u=>{u.preventDefault(),l||(t("select"),n(null))}}),f.jsxs("div",{className:ke("absolute grid grid-cols-[32px,1fr,32px] rounded bg-bg-primary text-text-primary cursor-pointer",{"w-[calc(100vw-32px)] h-[calc(100svh-32px)]":i<1024}),ref:a,style:{top:r.y,left:r.x},children:[f.jsx("div",{className:"cursor-grab",onMouseDown:()=>{c(!0)}}),f.jsxs("div",{className:"grid grid-rows-[32px,1fr,32px]",children:[f.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}}),f.jsxs("form",{className:"flex flex-col items-start justify-start w-full gap-4 lg:justify-start",onSubmit:u=>{u.preventDefault(),u.stopPropagation(),t("select"),n(null)},children:[e&&ee.splitJoinedSourcePaths(e.joinedPaths).map(u=>{const[d,h]=ee.splitModuleFilePathAndModulePath(u),p=ee.splitModulePath(h);return f.jsxs(g.Fragment,{children:[f.jsx(ry,{link:!0,toolTip:!0,moduleFilePath:d,patchPath:p}),f.jsx(mme,{path:u})]},u)}),f.jsx(Lt,{className:"self-end",type:"submit",children:"Done"})]}),f.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}})]}),f.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}})]})]})}function mme({path:e}){const t=It(e);return!("data"in t)||t.data===void 0?f.jsx("div",{className:"flex flex-col gap-4",children:f.jsx(gt,{path:e})}):f.jsx("div",{className:"flex flex-col gap-4 max-w-[600px] w-full",children:f.jsx(Fy,{path:e,schema:t.data,autoFocus:!0})})}function FN({dropZone:e,ghost:t,draftMode:n,draftModeLoading:r,setDraftMode:o,mode:i,setMode:s,disableOverlay:a,loading:l,setDropZone:c}){const u=e==="val-menu-right-center"||e==="val-menu-left-center"?"vertical":"horizontal",d=hR(),h=Kr(),{theme:p,setTheme:m}=Hv(),v=Wv(),[b,x]=g.useState(0),w=qh(),S=Aa()||{},C=Object.keys(S).length,_=Fu();g.useEffect(()=>{const M=()=>{window.innerWidth<400?x(-56):x(32)};return M(),window.addEventListener("resize",M),()=>{window.removeEventListener("resize",M)}},[]);const{publishDisabled:N}=Yh(),P=e==="val-menu-center-bottom"?"top":e==="val-menu-center-top"?"bottom":e==="val-menu-right-center"?"left":e==="val-menu-left-center"?"right":e==="val-menu-left-bottom"||e==="val-menu-right-bottom"?"top":e==="val-menu-right-top"||e==="val-menu-left-top"?"bottom":"top";return f.jsxs("div",{className:"p-4 right-16",children:[l&&f.jsx("div",{className:hv(e)+" p-4",children:f.jsx("div",{className:"flex items-center justify-center p-2 text-white bg-black rounded backdrop-blur",children:f.jsx(Mx,{className:"animate-spin",size:16})})}),d==="login-required"&&f.jsx("div",{className:hv(e)+" p-4",children:f.jsx("div",{className:"flex items-center justify-center p-2 text-white bg-black rounded backdrop-blur",children:f.jsx("a",{href:eh("/api/val/authorize",{redirect_to:window.location.href}),children:f.jsx(E7,{size:16})})})}),f.jsx(rh,{isOpen:n&&!r&&!l&&d!=="login-required",children:f.jsxs("div",{className:ke("flex relative rounded bg-bg-primary border border-border-primary text-text-primary gap-2",{"flex-col py-4 px-2":u==="vertical","flex-row px-4 py-2":u==="horizontal","opacity-70":t}),children:[f.jsx(lc,{label:"Pick content",active:i==="select",onClick:()=>s(M=>M==="select"?null:"select"),icon:f.jsx(I7,{size:16})}),f.jsx(lc,{label:"Disable preview mode",disabled:r,icon:r?f.jsx(Mx,{size:16,className:"animate-spin"}):f.jsx(m7,{size:16}),onClick:()=>o(!1)}),f.jsx("div",{className:"pb-1 mt-1 border-t border-border-primary"}),f.jsxs(ns,{children:[f.jsx(oh,{disabled:N,className:ke("p-2 rounded-full disabled:bg-bg-disabled"),children:f.jsxs(ul,{children:[f.jsx(IS,{children:f.jsxs("div",{className:"relative",children:[w.length>0&&f.jsx("div",{className:"absolute -top-3 -right-3",children:f.jsxs("div",{className:ke("w-4 h-4 text-[9px] leading-4 text-center rounded-full",{"bg-bg-brand-primary":C===0,"bg-bg-error-primary text-text-error-primary":C>0}),children:[C===0&&w.length>9&&f.jsx("span",{children:"9+"}),C===0&&w.length<=9&&f.jsx("span",{children:w.length}),C>9&&f.jsx("span",{children:"9+"}),C<=9&&C>0&&f.jsx("span",{children:C})]})}),f.jsx(kS,{size:16})]})}),f.jsx(AS,{children:f.jsxs("div",{className:"p-2 rounded bg-bg-primary text-text-primary",children:[C>0&&f.jsxs("div",{className:"text-text-error-primary",children:["Cannot ",_==="fs"?"save":"publish"," due to"," ",C," validation error",C>1&&"s"]}),w.length>0&&C==0&&f.jsxs("div",{children:[w.length," patch",w.length>1&&"es"," ready to publish"]})]})})]})}),f.jsxs(hi,{container:h,align:"center",side:P,sideOffset:b,className:"z-[9000] relative max-w-[352px] w-screen rounded-none sm:rounded flex flex-col items-end",children:[f.jsx("div",{className:"absolute sm:hidden top-4 right-4",children:f.jsx(Zv,{children:f.jsx(Nl,{size:16})})}),!N&&f.jsx("div",{className:"flex items-center justify-between gap-4 px-4 py-4 pt-8 sm:hidden",children:f.jsx(Ib,{})}),f.jsx(jo,{children:f.jsx("div",{className:"sm:max-h-[min(400px,80svh)] max-h-[calc(100svh-96px-64px)] w-[320px]",children:f.jsx(BI,{loadingStatus:v})})}),!N&&f.jsx("div",{className:"hidden py-4 sm:block",children:f.jsx(Ib,{})})]})]}),f.jsx(lc,{label:"Studio",icon:f.jsx(l_,{size:16}),onClick:()=>{window.location.href=window.origin+"/val/~"}}),f.jsxs(ns,{children:[f.jsx(oh,{className:ke("p-2 rounded-full disabled:bg-bg-disabled"),children:f.jsx(bR,{size:16})}),f.jsx(hi,{container:h,className:"z-[9003]",children:f.jsxs("div",{className:"grid grid-cols-[1fr,auto] gap-2",children:[f.jsx("span",{children:"Dock to top"}),f.jsx("button",{onClick:()=>{c("val-menu-center-top")},children:f.jsx(M7,{size:16})}),f.jsx("span",{children:"Dock to right"}),f.jsx("button",{onClick:()=>{c("val-menu-right-center")},children:f.jsx(O7,{size:16})}),f.jsx("span",{children:"Dock to left"}),f.jsx("button",{onClick:()=>{c("val-menu-left-center")},children:f.jsx(P7,{size:16})}),f.jsx("span",{children:"Dock to bottom"}),f.jsx("button",{onClick:()=>{c("val-menu-center-bottom")},children:f.jsx(N7,{size:16})}),f.jsx("span",{children:"Dark mode"}),f.jsx(D3,{checked:p==="dark",onCheckedChange:M=>{m(M?"dark":"light")}})]})})]})]})}),f.jsx(rh,{isOpen:!(n&&!r)&&!l&&d!=="login-required",children:f.jsxs("div",{className:ke("flex relative rounded bg-bg-primary text-text-primary gap-2",{"flex-col py-4 px-2":u==="vertical","flex-row px-4 py-2":u==="horizontal","opacity-70":t}),children:[f.jsx(lc,{label:"Enable preview mode",disabled:r,icon:r?f.jsx(Mx,{size:16,className:"animate-spin"}):f.jsx(wR,{size:16}),onClick:()=>{o(!0)}}),f.jsx(lc,{label:"Studio",icon:f.jsx(l_,{size:16}),onClick:()=>{window.location.href=window.origin+"/val/~"}}),f.jsx(lc,{label:"Disable Val",icon:f.jsx(Nl,{size:16}),onClick:()=>a()})]})})]})}function lc({icon:e,onClick:t,disabled:n,active:r,label:o,variant:i}){return f.jsx("button",{disabled:n,className:ke("p-2 rounded-full disabled:bg-bg-disabled",{"bg-bg-brand-primary text-text-brand-primary":i==="primary","text-bg-brand-primary":!!r}),onClick:t,"aria-label":o,title:o,children:e})}function gme(e){const[t,n]=g.useState(!1),{dropZone:r,setDropZone:o}=e,[i,s]=g.useState(null),a=c=>u=>{u.preventDefault(),o(c)},l=c=>u=>{u.preventDefault(),s(c)};return f.jsxs(f.Fragment,{children:[r&&f.jsx("div",{className:ke("z-[8999] cursor-grab",hv(r)),draggable:!0,onDragStart:()=>{n(!0)},onDragEnd:()=>{n(!1)},children:f.jsx(FN,{...e,dropZone:r})}),t&&r&&f.jsxs(f.Fragment,{children:[i&&i!==r&&f.jsx("div",{className:ke("z-[3]",hv(i)),onDrop:a(i),onDragOver:l(i),children:f.jsx(FN,{ghost:!0,...e,dropZone:i})}),f.jsxs("div",{className:"fixed top-0 left-0 grid w-screen h-screen grid-cols-3 grid-rows-3 z-[2]",children:[f.jsx(Cs,{id:"val-menu-left-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-center-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-right-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-left-center",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx("div",{}),f.jsx(Cs,{id:"val-menu-right-center",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-left-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-center-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-right-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l})]})]})]})}function hv(e){let t="fixed transform";return e==="val-menu-left-top"?t+=" left-0 top-0":e==="val-menu-left-center"?t+=" left-0 top-1/2 -translate-y-1/2":e==="val-menu-left-bottom"?t+=" left-0 bottom-0":e==="val-menu-center-top"?t+=" left-1/2 -translate-x-1/2 top-0":e==="val-menu-center-bottom"?t+=" left-1/2 -translate-x-1/2 bottom-0":e==="val-menu-right-top"?t+=" right-0 top-0":e==="val-menu-right-center"?t+=" right-0 top-1/2 -translate-y-1/2":t+=" right-0 bottom-0",t}const Cs=({id:e,onDrop:t,onDragOver:n})=>f.jsx("div",{onDrop:t(e),onDragOver:n(e)});function vme(){const e=O3(),t="/api/val",n=wj("/api/val",{...e,contentHostUrl:yM}),[r,o]=g.useState(!1),[i,s]=g.useState(!1);return g.useEffect(()=>{const a=l=>{l instanceof CustomEvent?(l==null?void 0:l.detail.type)==="draftMode"&&typeof(l==null?void 0:l.detail.value)=="boolean"?o(l.detail.value):l.detail.type==="draftModeLoading"&&typeof l.detail.value=="boolean"?s(l.detail.value):console.error("Val: invalid event detail (val-overlay-spa)",l.detail):console.error("Val: invalid event (val-overlay-spa)",l)};return window.addEventListener("val-overlay-spa",a),window.dispatchEvent(new CustomEvent("val-overlay-provider",{detail:{type:"spa-ready"}})),()=>{window.removeEventListener("val-overlay-spa",a)}},[]),f.jsxs(f.Fragment,{children:[f.jsx(P3,{}),f.jsxs(_3,{children:[f.jsx("style",{children:`
|
|
494
494
|
#val-overlay-container {
|
|
495
495
|
visibility: hidden;
|
|
496
496
|
}
|
package/server/.tmp/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Val</title>
|
|
7
|
-
<script type="module" crossorigin src="/api/val/static/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/api/val/static/assets/index-Co_yjHaq.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/api/val/static/assets/index-CaPHBXgK.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|