@valbuild/ui 0.86.1 → 0.86.2

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.
@@ -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.86.1";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;
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.86.2";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;
@@ -1,4 +1,4 @@
1
- const _ = "/spa/index.css", s = "/app", A = "val-app", o = "val-overlay", V = !1, a = "0.86.1";
1
+ const _ = "/spa/index.css", s = "/app", A = "val-app", o = "val-overlay", V = !1, a = "0.86.2";
2
2
  export {
3
3
  V as IS_DEV,
4
4
  A as VAL_APP_ID,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/ui",
3
- "version": "0.86.1",
3
+ "version": "0.86.2",
4
4
  "sideEffects": false,
5
5
  "scripts": {
6
6
  "typecheck": "tsc --noEmit",
@@ -60,8 +60,8 @@
60
60
  "@types/express": "^4.17.17",
61
61
  "@types/react": "^18.2.38",
62
62
  "@types/react-resizable": "^3.0.5",
63
- "@valbuild/core": "~0.86.1",
64
- "@valbuild/shared": "~0.86.1",
63
+ "@valbuild/core": "~0.86.2",
64
+ "@valbuild/shared": "~0.86.2",
65
65
  "autoprefixer": "^10.4.13",
66
66
  "class-variance-authority": "^0.7.0",
67
67
  "classnames": "^2.3.2",
@@ -457,7 +457,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
457
457
  `)},$N=function(){var e=parseInt(document.body.getAttribute(Xc)||"0",10);return isFinite(e)?e:0},EG=function(){g.useEffect(function(){return document.body.setAttribute(Xc,($N()+1).toString()),function(){var e=$N()-1;e<=0?document.body.removeAttribute(Xc):document.body.setAttribute(Xc,e.toString())}},[])},CG=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;EG();var i=g.useMemo(function(){return wG(o)},[o]);return g.createElement(SG,{styles:kG(i,!t,o,n?"":"!important")})},Yb=!1;if(typeof window<"u")try{var rm=Object.defineProperty({},"passive",{get:function(){return Yb=!0,!0}});window.addEventListener("test",rm,rm),window.removeEventListener("test",rm,rm)}catch{Yb=!1}var hc=Yb?{passive:!1}:!1,NG=function(e){return e.tagName==="TEXTAREA"},A2=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!NG(e)&&n[t]==="visible")},PG=function(e){return A2(e,"overflowY")},_G=function(e){return A2(e,"overflowX")},BN=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=I2(e,r);if(o){var i=D2(e,r),s=i[1],a=i[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},jG=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},TG=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},I2=function(e,t){return e==="v"?PG(t):_G(t)},D2=function(e,t){return e==="v"?jG(t):TG(t)},OG=function(e,t){return e==="h"&&t==="rtl"?-1:1},MG=function(e,t,n,r,o){var i=OG(e,window.getComputedStyle(t).direction),s=i*r,a=n.target,l=t.contains(a),c=!1,u=s>0,f=0,h=0;do{var p=D2(e,a),m=p[0],v=p[1],x=p[2],b=v-x-i*m;(m||b)&&I2(e,a)&&(f+=b,h+=m),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&(Math.abs(f)<1||!o)||!u&&(Math.abs(h)<1||!o))&&(c=!0),c},om=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},VN=function(e){return[e.deltaX,e.deltaY]},UN=function(e){return e&&"current"in e?e.current:e},RG=function(e,t){return e[0]===t[0]&&e[1]===t[1]},AG=function(e){return`
458
458
  .block-interactivity-`.concat(e,` {pointer-events: none;}
459
459
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
460
- `)},IG=0,pc=[];function DG(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),o=g.useState(IG++)[0],i=g.useState(R2)[0],s=g.useRef(e);g.useEffect(function(){s.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var v=rG([e.lockRef.current],(e.shards||[]).map(UN),!0).filter(Boolean);return v.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),v.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(v,x){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!s.current.allowPinchZoom;var b=om(v),w=n.current,S="deltaX"in v?v.deltaX:w[0]-b[0],C="deltaY"in v?v.deltaY:w[1]-b[1],N,P=v.target,_=Math.abs(S)>Math.abs(C)?"h":"v";if("touches"in v&&_==="h"&&P.type==="range")return!1;var O=BN(_,P);if(!O)return!0;if(O?N=_:(N=_==="v"?"h":"v",O=BN(_,P)),!O)return!1;if(!r.current&&"changedTouches"in v&&(S||C)&&(r.current=N),!N)return!0;var M=r.current||N;return MG(M,x,v,M==="h"?S:C,!0)},[]),l=g.useCallback(function(v){var x=v;if(!(!pc.length||pc[pc.length-1]!==i)){var b="deltaY"in x?VN(x):om(x),w=t.current.filter(function(N){return N.name===x.type&&(N.target===x.target||x.target===N.shadowParent)&&RG(N.delta,b)})[0];if(w&&w.should){x.cancelable&&x.preventDefault();return}if(!w){var S=(s.current.shards||[]).map(UN).filter(Boolean).filter(function(N){return N.contains(x.target)}),C=S.length>0?a(x,S[0]):!s.current.noIsolation;C&&x.cancelable&&x.preventDefault()}}},[]),c=g.useCallback(function(v,x,b,w){var S={name:v,delta:x,target:b,should:w,shadowParent:LG(b)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(C){return C!==S})},1)},[]),u=g.useCallback(function(v){n.current=om(v),r.current=void 0},[]),f=g.useCallback(function(v){c(v.type,VN(v),v.target,a(v,e.lockRef.current))},[]),h=g.useCallback(function(v){c(v.type,om(v),v.target,a(v,e.lockRef.current))},[]);g.useEffect(function(){return pc.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,hc),document.addEventListener("touchmove",l,hc),document.addEventListener("touchstart",u,hc),function(){pc=pc.filter(function(v){return v!==i}),document.removeEventListener("wheel",l,hc),document.removeEventListener("touchmove",l,hc),document.removeEventListener("touchstart",u,hc)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(i,{styles:AG(o)}):null,p?g.createElement(CG,{gapMode:e.gapMode}):null)}function LG(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const FG=fG(M2,DG);var up=g.forwardRef(function(e,t){return g.createElement(py,pi({},e,{ref:t,sideCar:FG}))});up.classNames=py.classNames;var XS="Popover",[L2,yge]=So(XS,[Ti]),dp=Ti(),[zG,Ua]=L2(XS),F2=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=e,a=dp(t),l=g.useRef(null),[c,u]=g.useState(!1),[f=!1,h]=Kr({prop:r,defaultProp:o,onChange:i});return d.jsx(np,{...a,children:d.jsx(zG,{scope:t,contentId:Vr(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:g.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:c,onCustomAnchorAdd:g.useCallback(()=>u(!0),[]),onCustomAnchorRemove:g.useCallback(()=>u(!1),[]),modal:s,children:n})})};F2.displayName=XS;var z2="PopoverAnchor",$G=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ua(z2,n),i=dp(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:a}=o;return g.useEffect(()=>(s(),()=>a()),[s,a]),d.jsx(Hu,{...i,...r,ref:t})});$G.displayName=z2;var $2="PopoverTrigger",$g=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ua($2,n),i=dp(n),s=Ve(t,o.triggerRef),a=d.jsx(Oe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":H2(o.open),...r,ref:s,onClick:te(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:d.jsx(Hu,{asChild:!0,...i,children:a})});$g.displayName=$2;var ZS="PopoverPortal",[BG,VG]=L2(ZS,{forceMount:void 0}),B2=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,i=Ua(ZS,t);return d.jsx(BG,{scope:t,forceMount:n,children:d.jsx(ln,{present:n||i.open,children:d.jsx(Ku,{asChild:!0,container:o,children:r})})})};B2.displayName=ZS;var Pu="PopoverContent",V2=g.forwardRef((e,t)=>{const n=VG(Pu,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,i=Ua(Pu,e.__scopePopover);return d.jsx(ln,{present:r||i.open,children:i.modal?d.jsx(UG,{...o,ref:t}):d.jsx(WG,{...o,ref:t})})});V2.displayName=Pu;var UG=g.forwardRef((e,t)=>{const n=Ua(Pu,e.__scopePopover),r=g.useRef(null),o=Ve(t,r),i=g.useRef(!1);return g.useEffect(()=>{const s=r.current;if(s)return hy(s)},[]),d.jsx(up,{as:cs,allowPinchZoom:!0,children:d.jsx(U2,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:te(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),WG=g.forwardRef((e,t)=>{const n=Ua(Pu,e.__scopePopover),r=g.useRef(!1),o=g.useRef(!1);return d.jsx(U2,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),U2=g.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=e,h=Ua(Pu,n),p=dp(n);return fy(),d.jsx(cp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:d.jsx(Zl,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:d.jsx(rp,{"data-state":H2(h.open),role:"dialog",id:h.contentId,...p,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),W2="PopoverClose",Il=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ua(W2,n);return d.jsx(Oe.button,{type:"button",...r,ref:t,onClick:te(e.onClick,()=>o.onOpenChange(!1))})});Il.displayName=W2;var HG="PopoverArrow",KG=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=dp(n);return d.jsx(op,{...o,...r,ref:t})});KG.displayName=HG;function H2(e){return e?"open":"closed"}var GG=F2,qG=$g,YG=B2,K2=V2;const br=GG,xo=qG,tr=g.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>d.jsx(YG,{container:r.container,children:d.jsx(K2,{ref:o,align:t,sideOffset:n,className:fe("z-50 w-72 rounded-md border bg-bg-secondary p-4 text-fg-secondary shadow-md outline-none 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));tr.displayName=K2.displayName;function WN({profile:e,size:t="md"}){var c,u,f;const[n,r]=g.useState(((c=e==null?void 0:e.avatar)==null?void 0:c.url)||null);g.useEffect(()=>{var h,p;(h=e==null?void 0:e.avatar)!=null&&h.url?r((p=e==null?void 0:e.avatar)==null?void 0:p.url):r(null)},[(u=e==null?void 0:e.avatar)==null?void 0:u.url]);const[o,...i]=((f=e.fullName)==null?void 0:f.split(" "))||[""],s=i[i.length-1]||"",a=`${o[0].toUpperCase()}${s[0].toUpperCase()}`,l=Ne("rounded-full text-center inline-block bg-bg-brand-primary text-fg-brand-primary",{"h-8 w-8 leading-8 text-xs":t==="sm","h-10 w-10 leading-10 text-base":t==="md","h-12 w-12 leading-[3rem] text-lg":t==="lg"});return n?d.jsx("img",{src:n,alt:a,className:l,onError:()=>{r(null)}}):d.jsx("span",{className:l,children:a})}function JG(e,t,n,r){if(t[n]===void 0)return console.error(`Get keysOf source not found for ${n}`),[];if(!e[n])return console.error(`Schema not found for ${n}`),[];const s=n,a=[],l=(c,u,f)=>{var h;if(u===void 0){console.error(`Schema not found for ${c}`);return}if(u.type==="keyOf")u.path===s&&(r?typeof f=="string"&&f===r&&(a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c)):a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c));else if(u.type==="object"||u.type==="record"){if(KN(f)||G2(f))for(const p in f){const m=f==null?void 0:f[p],v=u.type==="object"?(h=u.items)==null?void 0:h[p]:u.item;m&&l(HN(c,p),v,m)}}else if(u.type==="array"){if(XG(f)){let p=0;for(const m of f)l(HN(c,p),u.item,m),p++}}else if(u.type==="union"){const p=u.key;if(typeof p=="string"&&KN(f)){const m=f[p];if(typeof m=="string"){const v=u.items.filter(x=>x.type==="object").find(x=>{const b=x.items[p];if((b==null?void 0:b.type)==="literal")return b.value===m});v&&l(c,v,f)}}}else u.type==="string"||u.type==="number"||u.type==="boolean"||u.type==="literal"||u.type==="date"||u.type==="image"||u.type==="file"||u.type==="richtext"||console.error("Could not get keyOf references. Unhandled schema type",u)};for(const c in e){const u=c;l(c,e[u],t[u])}return a}function HN(e,t){return e.includes(wa)?`${e}.${JSON.stringify(t)}`:`${e}${wa}${JSON.stringify(t)}`}function KN(e){return G2(e)}function G2(e){return typeof e=="object"&&!!e&&!ea(e)}function XG(e){return typeof e=="object"&&!!e&&ea(e)}function q2(e,t){const n=Va(),r=cy(),o=$S();return g.useMemo(()=>e!==void 0&&"data"in n&&n.data!==void 0&&n.data[e]!==void 0?JG(n.data,o,e,t):[],[r,o,"data"in n&&n.data,e,t])}const GN=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,qN=$R,ZG=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return qN(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(c=>{const u=n==null?void 0:n[c],f=i==null?void 0:i[c];if(u===null)return null;const h=GN(u)||GN(f);return o[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[f,h]=u;return h===void 0||(c[f]=h),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:f,className:h,...p}=u;return Object.entries(p).every(m=>{let[v,x]=m;return Array.isArray(x)?x.includes({...i,...a}[v]):{...i,...a}[v]===x})?[...c,f,h]:c},[]);return qN(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},Jb=ZG("inline-flex items-center justify-center whitespace-nowrap rounded-md text-fg-primary text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:text-fg-disabled disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:fe("cursor-pointer","border border-border-brand-primary","bg-bg-brand-primary text-fg-brand-primary","hover:bg-bg-brand-primary-hover hover:text-fg-brand-primary-hover","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary"),destructive:fe("cursor-pointer","border border-bg-error-primary","bg-bg-error-primary text-fg-error-primary hover:bg-bg-error-primary-hover disabled:text-fg-error-primary"),outline:fe("cursor-pointer","border border-transparent","bg-bg-background hover:bg-bg-secondary","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary"),secondary:fe("cursor-pointer","border border-border-secondary","bg-bg-secondary text-fg-secondary hover:bg-bg-secondary-hover"),ghost:fe("cursor-pointer","border border-transparent","bg-bg-background hover:bg-bg-secondary","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary","hover:bg-bg-secondary-hover hover:text-fg-secondary"),link:fe("cursor-pointer","border border-transparent","text-fg-primary underline-offset-4 hover:underline")},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),qe=g.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?cs:"button";return d.jsx(s,{className:fe(Jb({variant:t,size:n,className:e})),ref:i,...o})});qe.displayName="Button";function QG({path:e,disabled:t}){const[n,r]=Y.splitModuleFilePathAndModulePath(e),o=Y.splitModuleFilePath(n),i=Y.splitModulePath(r),{navigate:s}=xn();return d.jsxs("div",{className:"w-full",children:[d.jsx("button",{type:"button",title:n,disabled:t,className:"inline-block text-left truncate",onClick:()=>{s(n)},children:o.map((a,l)=>d.jsxs(g.Fragment,{children:[l===0&&d.jsx("span",{className:"text-muted",children:"/"}),d.jsx("span",{className:Ne({"text-muted":!(i.length===0&&l===o.length-1)}),children:Cu(a)}),l>0&&l<o.length-1&&d.jsx("span",{className:"text-muted",children:"/"})]},`${a}-${l}`))}),d.jsx("button",{type:"button",disabled:t,title:Y.joinModuleFilePathAndModulePath(n,r),className:"inline-block text-left truncate",onClick:()=>{s(Y.joinModuleFilePathAndModulePath(n,r))},children:i.map((a,l)=>d.jsxs(g.Fragment,{children:[d.jsx("span",{className:"text-muted",children:"/"}),d.jsx("span",{className:Ne({"text-muted":l===i.length-2}),children:Cu(a)})]},`${a}-${l}`))})]})}function Y2({path:e,parentPath:t,variant:n,refs:r,children:o,size:i,onComplete:s,confirmationMessage:a,className:l}){const c=In();return d.jsxs(br,{children:[d.jsx(xo,{asChild:!0,children:d.jsx(qe,{size:i,variant:n,className:l,children:o})}),d.jsxs(tr,{container:c,className:"flex flex-col gap-2 p-4",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsx("div",{children:a}),d.jsx(Il,{asChild:!0,children:d.jsx(eq,{path:e,parentPath:t,refs:r,variant:"destructive",onComplete:s,children:d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(HS,{size:12}),d.jsx("span",{children:"Delete"})]})})})]})]})}function eq({path:e,parentPath:t,variant:n,refs:r,children:o,size:i,onComplete:s}){const{navigate:a}=xn(),{addPatch:l,patchPath:c}=bn(e),u=lt(t,"record");return!("data"in u)||u.data===void 0||u.data===null?(console.error("Parent source not found",u,{path:e}),null):d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{size:i,variant:n,disabled:r.length>0,onClick:()=>{l([{op:"remove",path:c}],"record"),a(t),s&&s()},children:o})}),d.jsx(fr,{side:"top",children:r.length>0?d.jsxs("div",{children:[d.jsx("p",{children:"Cannot delete record."}),d.jsxs("p",{children:["You must change the following references"," ",d.jsx(f2,{size:10,className:"inline"})," to be able to delete:"]}),d.jsx("ul",{children:r.map(f=>d.jsx("li",{children:d.jsx(QG,{path:f})},f))})]}):d.jsx("p",{children:"Delete record"})})]})}function Dl(e){if(e.type==="object")return Object.fromEntries(Object.keys(e.items).map(n=>[n,Dl(e.items[n])]));if(e.type==="array")return[];if(e.type==="record")return{};if(e.opt)return null;if(e.type==="richtext")return[];if(e.type==="string")return"";if(e.type==="boolean")return!1;if(e.type==="number")return 0;if(e.type==="keyOf")return e.values==="string"?"":e.values[0];if(e.type==="file"||e.type==="image")return null;if(e.type==="literal")return e.value;if(e.type==="union")return typeof e.key=="string"?Dl(e.items[0]):e.key.value;if(e.type==="date")return ms(new Date,"yyyy-MM-dd");throw Error("Unexpected schema type: "+JSON.stringify(e))}const Qu=g.forwardRef(({className:e,type:t,...n},r)=>d.jsx("input",{type:t,className:fe("flex h-10 m-1 w-[calc(100%-8px)] rounded-md border border-input bg-bg-primary px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Qu.displayName="Input";function tq(e,t){const n={},r=t==null?void 0:t.split("/");(r==null?void 0:r[0])===""&&r.shift();const o=(r==null?void 0:r.filter(s=>s!==""))||[];let i=0;for(let s=0;s<e.length;s++){const a=e[s];if(a.type==="literal"){const l=o[i];if(!l)return{status:"error",message:`Missing required literal part: ${a.name}`};if(a.name!==l)return{status:"error",message:`Invalid path part: expected "${a.name}", got "${l}"`};i++}else if(a.type==="string-param"){const l=o[i];if(!l){if(a.optional)continue;return{status:"error",message:`Missing required parameter: ${a.paramName}`}}n[a.paramName]=l,i++}else if(a.type==="array-param"){const l=o.slice(i);if(l.length===0){if(a.optional)continue;return{status:"error",message:`Missing required catch-all parameter: ${a.paramName}`}}n[a.paramName]=l,i+=l.length}}return i<o.length?{status:"error",message:`Extra path parts found: ${o.slice(i).join("/")}`}:{status:"success",params:n}}function J2({routePattern:e,existingKeys:t,onSubmit:n,submitText:r,defaultParams:o,onCancel:i,defaultValue:s}){const[a,l]=g.useState({});g.useEffect(()=>{o&&l(o)},[o]);const[c,u]=g.useState({});g.useEffect(()=>{if(s){const m=tq(e,s);m.status==="success"&&l(m.params)}},[s,e]);const f=g.useMemo(()=>"/"+e.map(m=>{if(m.type==="string-param"||m.type==="array-param"){const v=a[m.paramName];return Array.isArray(v)?v.join("/"):v}return m.name}).join("/"),[e,a]),p=!g.useMemo(()=>e.every(m=>m.type==="string-param"||m.type==="array-param"?!!a[m.paramName]&&!c[m.paramName]:!0),[e,a,c])||f in t;return d.jsxs("form",{className:"p-4 space-y-3",onSubmit:m=>{m.preventDefault(),n(f)},children:[d.jsx("div",{className:"flex items-center",children:e.map((m,v)=>d.jsx("span",{className:"truncate",children:m.type==="string-param"||m.type==="array-param"?d.jsxs("span",{className:"flex items-center",children:[d.jsx("span",{children:"/"}),d.jsxs("span",{className:"flex flex-col",children:[d.jsx("input",{className:fe("p-1 bg-transparent border-0 max-w-[10ch]",{"border-border-secondary border-1":c[m.paramName]}),placeholder:m.paramName,value:nq(a,m.paramName),onChange:x=>{l({...a,[m.paramName]:x.target.value});const b=m.type==="string-param"?x.target.value:x.target.value.replace(/\//g,"");encodeURIComponent(b)!==b?u({...c,[m.paramName]:"Invalid characters"}):u({...c,[m.paramName]:void 0})}}),c[m.paramName]&&d.jsx("span",{className:"text-xs text-fg-error-secondary",children:c[m.paramName]})]})]}):d.jsxs("span",{className:"text-fg-secondary",children:["/",m.name]})},v))}),d.jsxs("div",{className:"flex gap-4",children:[d.jsx(qe,{disabled:p,children:r}),d.jsx(qe,{variant:"ghost",type:"reset",onClick:i,children:"Cancel"})]})]})}function nq(e,t){const n=e[t];return Array.isArray(n)?n.join("/"):n||""}function X2({path:e,size:t,variant:n,children:r,open:o,setOpen:i,defaultOpen:s,routePattern:a}){const l=lt(e,"record"),c=Ft(e),u=In(),{addPatch:f}=bn(e),{navigate:h}=xn(),[p,m]=g.useState(s??!1);g.useEffect(()=>{o!==void 0&&m(o)},[o]),g.useEffect(()=>{i!==void 0&&i(p)},[p,i]),g.useEffect(()=>{s!==void 0&&m(s)},[s]);const v=g.useCallback(S=>{const C="data"in c?c.data:null;if(C===null||C.type!=="record")return;const N=Y.createPatchPath(w).concat(S);f([{op:"add",path:N,value:Dl(C.item)}],"record"),h(Y.joinModuleFilePathAndModulePath(b,Y.patchPathToModulePath(N))),m(!1)},[f,h,c,e]);if(!("data"in l)||l.data===void 0||l.data===null)return console.error("Source not found",l,{path:e}),null;if(!("data"in c)||c.data===void 0)return console.error("Schema not found",l,{path:e}),null;if(c.data.type!=="record")return console.error("Schema is not a record",c,{path:e}),null;const[b,w]=Y.splitModuleFilePathAndModulePath(e);return d.jsxs(br,{open:p,onOpenChange:m,children:[d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(xo,{onClick:()=>{m(!0)},asChild:!0,children:d.jsx(qe,{size:t,variant:n,children:r})})}),d.jsx(fr,{children:d.jsx("p",{children:"Add"})})]}),d.jsx(tr,{container:u,children:a?d.jsx(J2,{routePattern:a,existingKeys:Object.keys(l.data),onSubmit:v,onCancel:()=>{m(!1)},submitText:"Create"}):d.jsx(rq,{existingKeys:Object.keys(l.data),onSubmit:v})})]})}function rq({existingKeys:e,onSubmit:t}){const[n,r]=g.useState(""),o=n===""||n in e;return d.jsxs("form",{className:"flex flex-col gap-2",onSubmit:i=>{i.preventDefault(),t(n)},children:[d.jsx(Qu,{autoFocus:!0,value:n,onChange:i=>{r(i.target.value)}}),d.jsx("div",{children:d.jsx(qe,{type:"submit",disabled:o,variant:"outline",children:"Add"})})]})}function oq({existingKeys:e,defaultValue:t,onCancel:n,onSubmit:r}){const[o,i]=g.useState(t),s=o===t||o===""||o in e;return d.jsxs("form",{className:"flex flex-col gap-2",onSubmit:a=>{a.preventDefault(),r(o)},children:[d.jsx(Qu,{type:"text",value:o,onChange:a=>{i(a.target.value)}}),d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(qe,{disabled:s,variant:"outline",type:"submit",children:"Update"}),d.jsx(qe,{variant:"ghost",type:"reset",onClick:()=>{n(),i(t)},children:"Cancel"})]})]})}function Z2({defaultValue:e,path:t,parentPath:n,variant:r,existingKeys:o,routePattern:i,size:s,children:a,onComplete:l}){const{navigate:c}=xn(),[u,f]=g.useState(!1),h=In();g.useEffect(()=>{const S=C=>{C.key==="Escape"&&f(!1)};return window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S)}},[]);const{addPatch:p,addModuleFilePatch:m}=bn(t),[v,x]=Y.splitModuleFilePathAndModulePath(n),b=Y.createPatchPath(x),w=g.useCallback(S=>{const C=[{op:"move",from:b.concat(e),path:b.concat(S)}];p(C,"record");for(const P of o){const[_,O]=Y.splitModuleFilePathAndModulePath(P),M=Y.createPatchPath(O);m(_,[{op:"replace",path:M,value:S}],"record")}const N=Y.joinModuleFilePathAndModulePath(v,Y.patchPathToModulePath(b.concat(S)));c(N,{replace:!0}),l&&l()},[p,m,v,b,c,l]);return d.jsxs(br,{open:u,children:[d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{asChild:!0,size:s,variant:r,children:d.jsx(xo,{onClick:()=>{f(!0)},children:a})})}),d.jsx(fr,{side:"top",children:"Rename record"})]}),d.jsx(tr,{container:h,className:"text-fg-primary",children:i?d.jsx(J2,{routePattern:i,existingKeys:o,defaultValue:e,onSubmit:S=>{w(S),f(!1)},onCancel:()=>{f(!1)},submitText:"Update"}):d.jsx(oq,{parentPath:n,defaultValue:e,existingKeys:o,onSubmit:S=>{w(S),f(!1)},onCancel:()=>{f(!1)}})})]})}function iq({moduleFilePaths:e}){const t=e2(e,"record"),n=t2(),r=g.useMemo(()=>{const o=[];if(n.status!=="success")return n;if(n.data===null)return{status:"error",error:"No src folder found"};if(t.status!=="success")return t.status==="not-found"?{status:"error",error:"No data found"}:t.status==="error"?{status:"error",error:`Failed to load ${Object.keys(t.errors).length} modules: ${Object.entries(t.errors).map(([a,l])=>`"${a}": ${l.message}`).join(", ")}`}:t;for(const s of t.data||[])for(const a in s){const[l]=Y.splitModuleFilePathAndModulePath(s[a]);o.push({urlPath:a,moduleFilePath:l})}const i=D8(n.data,o);return{status:t.status,data:i}},[t,n]);return r.status==="loading"||r.status==="not-asked"?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx(Gr,{size:16,className:"animate-spin"})}):r.status==="error"?(console.error("Sitemap errors",r.error),null):d.jsx(Q2,{node:r.data})}function Q2({node:e}){var m;const t=In(),{currentSourcePath:n}=xn(),[r,o]=g.useState(!0),{navigate:i}=xn(),[s,a]=g.useState(!1),[l,c]=g.useState(!1),u=g.useMemo(()=>{var v;return!!((v=e.sourcePath)!=null&&v.startsWith(n))},[n,e.sourcePath]),f=g.useMemo(()=>{if(!e.pattern)return;const v=$M(e.pattern);if(v.some(x=>x.type==="string-param"||x.type==="array-param"))return v},[e.pattern]),h=g.useCallback(()=>{var v;e.sourcePath?i(e.sourcePath):e.type==="node"&&((v=e.children)==null?void 0:v.length)>0&&o(x=>!x)},[i,e]),p=e.moduleFilePath;return d.jsxs("div",{children:[d.jsxs("div",{className:"relative flex items-center justify-between w-full h-10 group",children:[d.jsxs("div",{className:"flex items-center my-1",children:[d.jsx("button",{onClick:()=>o(!r),className:fe("hidden h-4 w-4 mr-2",{block:((m=e.children)==null?void 0:m.length)>0}),children:d.jsx(Zu,{size:16,className:fe("transform",{"rotate-90":r})})}),d.jsx("span",{children:e.sourcePath?d.jsxs("button",{onClick:h,className:fe("flex items-center gap-1",{}),children:[e.name==="/"?d.jsx(tK,{size:14}):e.type==="leaf"||e.type==="node"&&e.page?d.jsx(a2,{size:14}):null,d.jsxs("span",{children:[e.name==="/"&&d.jsx("span",{className:"ml-2 text-fg-primary-alt",children:"Main page"}),e.name!=="/"&&d.jsx("span",{className:fe({underline:u}),children:e.name})]})]}):d.jsxs("button",{onClick:h,className:fe("flex items-center gap-1",{}),children:[d.jsx(aK,{size:14}),d.jsx("span",{children:d.jsx("span",{children:e.name})})]})})]}),d.jsxs("div",{className:fe("absolute right-0 top-0 items-center group-hover:flex h-10 bg-bg-primary",{hidden:!s&&!l,flex:s||l}),children:[e.sourcePath&&d.jsx(qe,{size:"sm",variant:"ghost",onClick:h,className:"flex items-center gap-2",children:d.jsx(US,{size:12})}),(e.sourcePath||e.type==="leaf"||e.page)&&d.jsxs(br,{onOpenChange:a,open:s,children:[d.jsx(xo,{asChild:!0,children:d.jsx(qe,{size:"sm",variant:"ghost",children:d.jsx(VS,{size:12})})}),d.jsx(tr,{container:t,children:d.jsx(sq,{node:e,routePatternWithParams:f,onClose:()=>a(!1)})})]}),f&&p&&d.jsx(X2,{path:p,size:"sm",variant:"ghost",open:l,setOpen:c,routePattern:f,children:d.jsx(WS,{size:12})})]})]}),d.jsx(Eu,{isOpen:r,className:"pl-3",children:e.children.map((v,x)=>d.jsx(Q2,{node:v},x))})]})}function sq({node:e,onClose:t,routePatternWithParams:n}){const r=g.useMemo(()=>{var s;return e.type==="leaf"?e.fullPath:(s=e.page)==null?void 0:s.fullPath},[e]),o=g.useMemo(()=>e.sourcePath?Y.splitModuleFilePathAndModulePath(e.sourcePath)[0]:void 0,[e==null?void 0:e.sourcePath]),i=q2(o,r);return d.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[o&&e.sourcePath&&d.jsx(Y2,{path:e.sourcePath,parentPath:o,refs:i,size:"sm",variant:"ghost",onComplete:t,confirmationMessage:`This will delete the ${r} page.`,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(HS,{size:14}),d.jsx("span",{children:"Delete"})]})}),r!==void 0&&e.sourcePath&&o&&d.jsx(Z2,{variant:"ghost",size:"sm",existingKeys:i,path:e.sourcePath,defaultValue:r,routePattern:n,parentPath:o,onComplete:t,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(bK,{size:12}),d.jsx("span",{children:"Rename"})]})})]})}function aq(e){const t={"/":{name:"/",fullPath:"/",isDirectory:!0,children:[]}};for(const n of e){const r=n.split("/");if(r[0]!=="")throw new Error("Expected path to start with '/'");for(let o=1;o<r.length;o++){const i=r.slice(0,o).join("/"),s=[i,r[o]].join("/"),a=r[o];if(!a)throw new Error("Expected name to be non-empty");if(!t[s]){const l={name:a,fullPath:s,children:[]};o<r.length-1&&(l.isDirectory=!0),t[s]=l,t[i||"/"].children.push(t[s])}}}return t["/"]}function lq(){const e=Va();return g.useMemo(()=>{if(e.status==="success"){const t=[],n={};for(const r in e.data){const o=r,i=e.data[o];i.type==="record"&&i.router?(n[i.router]=n[i.router]||[],n[i.router].push(o)):t.push(o)}return{status:e.status,data:{root:aq(t),sitemap:n}}}return e},[e])}const eA=1280;function cq(){const e=qu(),[t,n]=g.useState(""),[r,o]=g.useState("");g.useEffect(()=>{async function w(){let S=!1;const C=async N=>{if(!S)try{(await fetch(N)).ok&&(S=!0,n(N))}catch{}};await C("/favicon.ico"),await C("/favicon.svg"),await C("/favicon.png"),await C("/apple-touch-icon.png"),await C("https://valbuild.com/favicon.ico")}if(w(),e!=null&&e.project)o(e.project);else try{let S=new URL(location.origin).hostname;if(S!=="localhost"){const C=S.split(".");C.length>=2&&(S=C.slice(1,-1).join(".")),o(Sf(S))}else o("Dev mode")}catch{o("Studio")}},[JSON.stringify(e)]);const i=Va(),s=In(),{theme:a,setTheme:l}=ly(),{navMenu:c}=Xy(),u=lq(),f=(e==null?void 0:e.appHost)||_b,[h,p]=r.split("/"),m=B7(),v=`${f}/orgs/${h}`,x=`${f}/orgs/${h}/members`,b=`${v}/projects/${p}`;return d.jsxs("nav",{className:"relative min-h-[100svh] bg-bg-primary",children:[d.jsxs("div",{className:"flex gap-4 justify-between items-center p-4 pr-6 h-16 border-b border-border-primary",children:[d.jsxs("div",{className:"flex gap-4 items-center",children:[t?d.jsx("img",{src:t,alt:"",className:"w-4 h-4"}):d.jsx("div",{className:"w-4 h-4"}),h&&p?d.jsx("a",{className:"truncate hover:underline",href:b,children:r}):d.jsx("span",{className:"truncate",children:r})]}),d.jsx("button",{className:"lg:hidden",onClick:()=>{c.setOpen(!c.isOpen)},children:d.jsx(Ig,{size:16,className:Ne("transform",{"rotate-180":!c.isOpen})})})]}),"data"in i&&d.jsx("div",{className:Ne("py-4 pl-2",{}),children:d.jsxs(hr,{children:[d.jsx("div",{className:"max-h-[calc(100svh-32px-64px-32px-16px)] max-w-[320px] px-2",children:"data"in u?d.jsxs(d.Fragment,{children:[d.jsx(dq,{title:"Site map",defaultOpen:!0,sitemap:u.data.sitemap}),d.jsx(uq,{title:"Explorer",defaultOpen:!0,node:u.data.root})]}):u.status==="loading"?d.jsx(fq,{}):null}),d.jsx(JS,{orientation:"horizontal"})]})}),d.jsx("div",{className:"p-4 h-6"}),d.jsx("div",{className:"absolute bottom-0 left-0 w-full",children:d.jsxs(br,{children:[d.jsxs(xo,{className:"flex items-center justify-between w-full p-4 border-t border-border-primary hover:bg-bg-secondary data-[state=open]:bg-bg-secondary",children:[d.jsx("span",{children:m&&d.jsx(WN,{size:"sm",profile:m})}),d.jsx(VS,{size:16})]}),d.jsx(tr,{className:"p-0 py-2",container:s,side:"top",children:d.jsxs("div",{className:"flex flex-col gap-2 justify-between items-center",children:[m&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex gap-2 items-center px-4 py-2 w-full",children:[d.jsx(WN,{size:"sm",profile:m}),d.jsxs("div",{className:"text-sm",children:[d.jsx("div",{className:"truncate",children:m.fullName}),m.email&&d.jsx("div",{className:"font-light truncate",children:m.email})]})]}),d.jsx("hr",{className:"mb-1 w-full h-1 border-t border-border-primary"})]}),d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[a==="dark"?d.jsx(vK,{size:"1rem"}):d.jsx(NK,{size:"1rem"}),d.jsx("button",{className:"",onClick:()=>{l(a==="dark"?"light":"dark")},children:a==="dark"?d.jsx("span",{className:"text-sm",children:"Dark mode"}):d.jsx("span",{className:"text-sm",children:"Light mode"})})]}),m&&d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[d.jsx(MK,{size:"1rem"}),d.jsx("a",{href:x,children:d.jsx("span",{className:"text-sm truncate",children:"Manage members"})})]}),m&&d.jsxs(d.Fragment,{children:[d.jsx("hr",{className:"mt-1 mb-1 w-full h-1 border-t border-border-primary"}),d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[d.jsx(mK,{size:"1rem"}),d.jsx("a",{href:vu("/api/val/logout",{redirect_to:`${window.location.origin}`}),children:d.jsx("span",{className:"text-sm",children:"Log out"})})]})]})]})})]})})]})}function uq({title:e,defaultOpen:t,node:n}){return!n||(n==null?void 0:n.children.length)===0?null:d.jsx(tA,{icon:d.jsx(Dg,{size:16}),title:e,defaultOpen:t,children:n.children.sort(nA).map((r,o)=>g.createElement(rA,{...r,name:r.name,key:o,root:!0}))})}function tA({title:e,children:t,defaultOpen:n,icon:r}){const[o,i]=g.useState(n??!0);return d.jsxs("div",{className:"py-2",children:[d.jsxs("button",{className:"flex justify-between items-center py-2 w-full text-sm tracking-tighter uppercase text-fg-secondary",onClick:()=>{i(!o)},children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[r,e]}),d.jsx(Zu,{size:16,className:Ne("transform",{"rotate-90":o})})]}),d.jsx(Eu,{isOpen:o,className:"pr-1",children:t})]})}function dq({title:e,defaultOpen:t,sitemap:n}){const r=n["next-app-router"];return r?d.jsx(tA,{title:e,defaultOpen:t,icon:d.jsx(Ag,{size:16}),children:d.jsx(iq,{moduleFilePaths:r})}):null}function fq(){return d.jsx("div",{className:"flex justify-start items-center w-full h-full",children:d.jsx(Gr,{size:16,className:"animate-spin"})})}function nA(e,t){return e.isDirectory&&!t.isDirectory?-1:!e.isDirectory&&t.isDirectory?1:e.name.localeCompare(t.name)}function rA({name:e,fullPath:t,isDirectory:n,children:r,root:o}){const{navigate:i,currentSourcePath:s}=xn(),{navMenu:a}=Xy(),[l,c]=g.useState(!0),u=ec()||{},f=g.useMemo(()=>{let x=!1;for(const b in u)if(b.startsWith(t)){x=!0;break}return x},[u,t]),h=g.useMemo(()=>{if(n){if(!l)return f}else if(!n)return f;return!1},[f,l,n]),p=t,m=Ft(p),v="data"in m?m.data.type:"loading";return d.jsxs("div",{className:"w-full text-sm",children:[d.jsxs("button",{className:Ne("relative flex items-center justify-between w-full ",{"py-2":o,"p-2":!o,underline:s.startsWith(p)&&!n,"font-bold":s.startsWith(p)&&n}),onClick:()=>{n?c(!l):(window.innerWidth<eA&&a.setOpen(!1),i(p))},children:[d.jsxs("div",{className:"flex items-center pr-2",children:[n?d.jsx(Zu,{size:16,className:Ne("transform mr-2",{"rotate-90":l,hidden:!r.length})}):d.jsx(hq,{type:v,size:14}),d.jsx("span",{children:Cu(e)})]}),h&&d.jsx("div",{className:"ml-2 w-2 h-2 rounded-full bg-bg-error-secondary"})]}),d.jsx("div",{className:"pl-2",children:d.jsx(Eu,{isOpen:l,children:r.sort(nA).map((x,b)=>g.createElement(rA,{...x,key:b}))})})]})}function hq({size:e,type:t}){if(t==="loading")return d.jsx(Gr,{size:e,className:"mr-2 animate-spin"});switch(t){case"string":return d.jsx(TK,{size:e,className:"mr-2"});case"number":return d.jsx(cK,{size:e,className:"mr-2"});case"boolean":return d.jsx(_K,{size:e,className:"mr-2"});case"object":return d.jsx(fK,{size:e,className:"mr-2"});case"literal":return d.jsx(eK,{size:e,className:"mr-2"});case"array":return d.jsx(u2,{size:e,className:"mr-2"});case"union":return d.jsx(wK,{size:e,className:"mr-2"});case"richtext":return d.jsx(a2,{size:e,className:"mr-2"});case"record":return d.jsx(PK,{size:e,className:"mr-2"});case"keyOf":return d.jsx(dK,{size:e,className:"mr-2"});case"file":return d.jsx(l2,{size:e,className:"mr-2"});case"date":return d.jsx(s2,{size:e,className:"mr-2"});case"image":return d.jsx(c2,{size:e,className:"mr-2"});default:return d.jsx(Z7,{size:e,className:"mr-2"})}}function QS(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ek="Checkbox",[pq,xge]=So(ek),[mq,gq]=pq(ek),oA=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,form:u,...f}=e,[h,p]=g.useState(null),m=Ve(t,C=>p(C)),v=g.useRef(!1),x=h?u||!!h.closest("form"):!0,[b=!1,w]=Kr({prop:o,defaultProp:i,onChange:c}),S=g.useRef(b);return g.useEffect(()=>{const C=h==null?void 0:h.form;if(C){const N=()=>w(S.current);return C.addEventListener("reset",N),()=>C.removeEventListener("reset",N)}},[h,w]),d.jsxs(mq,{scope:n,state:b,disabled:a,children:[d.jsx(Oe.button,{type:"button",role:"checkbox","aria-checked":fa(b)?"mixed":b,"aria-required":s,"data-state":aA(b),"data-disabled":a?"":void 0,disabled:a,value:l,...f,ref:m,onKeyDown:te(e.onKeyDown,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:te(e.onClick,C=>{w(N=>fa(N)?!0:!N),x&&(v.current=C.isPropagationStopped(),v.current||C.stopPropagation())})}),x&&d.jsx(vq,{control:h,bubbles:!v.current,name:r,value:l,checked:b,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"},defaultChecked:fa(i)?!1:i})]})});oA.displayName=ek;var iA="CheckboxIndicator",sA=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=gq(iA,n);return d.jsx(ln,{present:r||fa(i.state)||i.state===!0,children:d.jsx(Oe.span,{"data-state":aA(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});sA.displayName=iA;var vq=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i}=e,s=g.useRef(null),a=QS(n),l=PS(t);g.useEffect(()=>{const u=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==n&&p){const m=new Event("click",{bubbles:r});u.indeterminate=fa(n),p.call(u,fa(n)?!1:n),u.dispatchEvent(m)}},[a,n,r]);const c=g.useRef(fa(n)?!1:n);return d.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??c.current,...i,tabIndex:-1,ref:s,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function fa(e){return e==="indeterminate"}function aA(e){return fa(e)?"indeterminate":e?"checked":"unchecked"}var lA=oA,yq=sA;const ed=g.forwardRef(({className:e,...t},n)=>{const[r,o]=g.useState();return g.useEffect(()=>{o(t.checked)},[t.checked]),d.jsx(lA,{ref:n,checked:r,onCheckedChange:i=>{o(i),t.onCheckedChange&&t.onCheckedChange(i)},className:fe("peer h-4 w-4 shrink-0 rounded-sm bg-bg-primary border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 data-[state=checked]:bg-bg-primary data-[state=checked]:text-fg-primary",e),...t,children:d.jsxs(yq,{className:fe("flex items-center justify-center text-current"),children:[r===!0&&d.jsx(Ju,{size:12}),r==="indeterminate"&&d.jsx(gK,{size:12})]})})});ed.displayName=lA.displayName;function Tm(e,t){const n=new Date(t).getTime(),r=e.getTime(),o=Math.floor((r-n)/1e3),i=Math.floor(o/60),s=Math.floor(o/3600),a=Math.floor(o/86400),l=Math.floor(a/30);return o<60?"just now":i<60?`${i}m ago`:s<24?`${s}h ago`:a===1?"yesterday":a<30?`${a}d ago`:`${l}mo ago`}function cA({onPublish:e,onClose:t}){const[n,r]=g.useState(null),o=sp(),{summary:i,canGenerate:s,setSummary:a,publishDisabled:l,generateSummary:c}=ap(),[u,f]=g.useState(!1),h=()=>{f(!1),i.type!=="not-asked"&&a({...i})};g.useEffect(()=>{i.type!=="not-asked"&&!i.isGenerating&&!bu(i.patchIds,o)&&f(!0)},[i,o]);const p=g.useCallback(()=>{h(),c().then(x=>{x.type==="ai"?a({type:"ai",text:x.text.trim()}):r(x.message)})},[h,c,a,r]),m="w-full p-2 border rounded bg-bg-secondary",v="text"in i?i.text:"";return d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsxs("div",{className:"flex items-center justify-between w-full gap-2",children:[d.jsx("span",{className:"font-semibold",children:"Summary"}),s&&d.jsx(YN,{onClick:p,isGenerating:i.isGenerating})]}),n&&d.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-fg-error-primary",children:n}),d.jsxs("div",{className:"grid text-xs font-light",children:[d.jsx("div",{"aria-hidden":!0,className:fe(m,"invisible whitespace-pre-wrap"),style:{gridArea:"1 / 1 / 2 / 2"},children:v+" "}),d.jsx("textarea",{disabled:!!i.isGenerating,className:fe(m,"resize-none overflow-clip disabled:opacity-50"),value:v,style:{gridArea:"1 / 1 / 2 / 2"},placeholder:"Write a summary of your changes"+(s?" or generate one using AI":""),onChange:x=>{h(),a({type:"manual",text:x.currentTarget.value})}})]}),d.jsxs("div",{className:fe("p-2 text-xs flex-grow font-light bg-bg-warning-primary text-[black] rounded flex items-center","flex justify-between w-full gap-2 py-2",{hidden:!u}),"aria-hidden":u,children:[d.jsx("span",{children:"Summary might be outdated. "}),d.jsx("button",{className:"underline",onClick:h,children:"Dismiss"})]}),d.jsx("div",{className:"flex items-center justify-end gap-2",children:e?d.jsxs(d.Fragment,{children:[d.jsx(qe,{variant:"outline",onClick:()=>{t()},children:"Close"}),u&&s&&d.jsx(YN,{isGenerating:i.isGenerating,onClick:p}),!u&&d.jsxs(qe,{disabled:l||v.trim()==="",onClick:()=>{i.type!=="not-asked"&&e()},variant:"default",className:"flex items-center gap-2",children:[d.jsxs("span",{children:[" ",l?"Pushing...":"Publish"]}),d.jsx(Lg,{size:16})]})]}):d.jsx(d.Fragment,{children:d.jsx(qe,{variant:"outline",onClick:()=>{t()},children:"Close"})})})]})}function YN({isGenerating:e,onClick:t}){return d.jsx(qe,{className:"truncate",disabled:!!e,onClick:()=>{t()},variant:"outline",children:d.jsxs("span",{className:"flex items-center gap-2",children:[d.jsx("span",{children:e?"Generating...":"Generate"}),d.jsx(d2,{size:16})]})})}function xq(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:p,...m}=f,v=(h==null?void 0:h[e][l])||a,x=g.useMemo(()=>m,Object.values(m));return d.jsx(v.Provider,{value:x,children:p})}function u(f,h){const p=(h==null?void 0:h[e][l])||a,m=g.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,bq(o,...t)]}function bq(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function my(e){const t=e+"CollectionProvider",[n,r]=xq(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:m,children:v}=p,x=Ce.useRef(null),b=Ce.useRef(new Map).current;return d.jsx(o,{scope:m,itemMap:b,collectionRef:x,children:v})};s.displayName=t;const a=e+"CollectionSlot",l=Ce.forwardRef((p,m)=>{const{scope:v,children:x}=p,b=i(a,v),w=Ve(m,b.collectionRef);return d.jsx(cs,{ref:w,children:x})});l.displayName=a;const c=e+"CollectionItemSlot",u="data-radix-collection-item",f=Ce.forwardRef((p,m)=>{const{scope:v,children:x,...b}=p,w=Ce.useRef(null),S=Ve(m,w),C=i(c,v);return Ce.useEffect(()=>(C.itemMap.set(w,{ref:w,...b}),()=>void C.itemMap.delete(w))),d.jsx(cs,{[u]:"",ref:S,children:x})});f.displayName=c;function h(p){const m=i(e+"CollectionConsumer",p);return Ce.useCallback(()=>{const x=m.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${u}]`));return Array.from(m.itemMap.values()).sort((C,N)=>b.indexOf(C.ref.current)-b.indexOf(N.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},h,r]}var tk="Collapsible",[wq,uA]=So(tk),[Sq,nk]=wq(tk),dA=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:s,...a}=e,[l=!1,c]=Kr({prop:r,defaultProp:o,onChange:s});return d.jsx(Sq,{scope:n,disabled:i,contentId:Vr(),open:l,onOpenToggle:g.useCallback(()=>c(u=>!u),[c]),children:d.jsx(Oe.div,{"data-state":ok(l),"data-disabled":i?"":void 0,...a,ref:t})})});dA.displayName=tk;var fA="CollapsibleTrigger",hA=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=nk(fA,n);return d.jsx(Oe.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":ok(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:te(e.onClick,o.onOpenToggle)})});hA.displayName=fA;var rk="CollapsibleContent",pA=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=nk(rk,e.__scopeCollapsible);return d.jsx(ln,{present:n||o.open,children:({present:i})=>d.jsx(kq,{...r,ref:t,present:i})})});pA.displayName=rk;var kq=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,s=nk(rk,n),[a,l]=g.useState(r),c=g.useRef(null),u=Ve(t,c),f=g.useRef(0),h=f.current,p=g.useRef(0),m=p.current,v=s.open||a,x=g.useRef(v),b=g.useRef();return g.useEffect(()=>{const w=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(w)},[]),On(()=>{const w=c.current;if(w){b.current=b.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const S=w.getBoundingClientRect();f.current=S.height,p.current=S.width,x.current||(w.style.transitionDuration=b.current.transitionDuration,w.style.animationName=b.current.animationName),l(r)}},[s.open,r]),d.jsx(Oe.div,{"data-state":ok(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!v,...i,ref:u,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:v&&o})});function ok(e){return e?"open":"closed"}var Eq=dA,Cq=hA,Nq=pA,gs="Accordion",Pq=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ik,_q,jq]=my(gs),[gy,bge]=So(gs,[jq,uA]),sk=uA(),mA=Ce.forwardRef((e,t)=>{const{type:n,...r}=e,o=r,i=r;return d.jsx(ik.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?d.jsx(Rq,{...i,ref:t}):d.jsx(Mq,{...o,ref:t})})});mA.displayName=gs;var[gA,Tq]=gy(gs),[vA,Oq]=gy(gs,{collapsible:!1}),Mq=Ce.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:i=!1,...s}=e,[a,l]=Kr({prop:n,defaultProp:r,onChange:o});return d.jsx(gA,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:l,onItemClose:Ce.useCallback(()=>i&&l(""),[i,l]),children:d.jsx(vA,{scope:e.__scopeAccordion,collapsible:i,children:d.jsx(yA,{...s,ref:t})})})}),Rq=Ce.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[s=[],a]=Kr({prop:n,defaultProp:r,onChange:o}),l=Ce.useCallback(u=>a((f=[])=>[...f,u]),[a]),c=Ce.useCallback(u=>a((f=[])=>f.filter(h=>h!==u)),[a]);return d.jsx(gA,{scope:e.__scopeAccordion,value:s,onItemOpen:l,onItemClose:c,children:d.jsx(vA,{scope:e.__scopeAccordion,collapsible:!0,children:d.jsx(yA,{...i,ref:t})})})}),[Aq,vy]=gy(gs),yA=Ce.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:i="vertical",...s}=e,a=Ce.useRef(null),l=Ve(a,t),c=_q(n),f=lp(o)==="ltr",h=te(e.onKeyDown,p=>{var O;if(!Pq.includes(p.key))return;const m=p.target,v=c().filter(M=>{var D;return!((D=M.ref.current)!=null&&D.disabled)}),x=v.findIndex(M=>M.ref.current===m),b=v.length;if(x===-1)return;p.preventDefault();let w=x;const S=0,C=b-1,N=()=>{w=x+1,w>C&&(w=S)},P=()=>{w=x-1,w<S&&(w=C)};switch(p.key){case"Home":w=S;break;case"End":w=C;break;case"ArrowRight":i==="horizontal"&&(f?N():P());break;case"ArrowDown":i==="vertical"&&N();break;case"ArrowLeft":i==="horizontal"&&(f?P():N());break;case"ArrowUp":i==="vertical"&&P();break}const _=w%b;(O=v[_].ref.current)==null||O.focus()});return d.jsx(Aq,{scope:n,disabled:r,direction:o,orientation:i,children:d.jsx(ik.Slot,{scope:n,children:d.jsx(Oe.div,{...s,"data-orientation":i,ref:l,onKeyDown:r?void 0:h})})})}),Bg="AccordionItem",[Iq,ak]=gy(Bg),lk=Ce.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...o}=e,i=vy(Bg,n),s=Tq(Bg,n),a=sk(n),l=Vr(),c=r&&s.value.includes(r)||!1,u=i.disabled||e.disabled;return d.jsx(Iq,{scope:n,open:c,disabled:u,triggerId:l,children:d.jsx(Eq,{"data-orientation":i.orientation,"data-state":SA(c),...a,...o,ref:t,disabled:u,open:c,onOpenChange:f=>{f?s.onItemOpen(r):s.onItemClose(r)}})})});lk.displayName=Bg;var xA="AccordionHeader",bA=Ce.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=vy(gs,n),i=ak(xA,n);return d.jsx(Oe.h3,{"data-orientation":o.orientation,"data-state":SA(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});bA.displayName=xA;var Xb="AccordionTrigger",ck=Ce.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=vy(gs,n),i=ak(Xb,n),s=Oq(Xb,n),a=sk(n);return d.jsx(ik.ItemSlot,{scope:n,children:d.jsx(Cq,{"aria-disabled":i.open&&!s.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId,...a,...r,ref:t})})});ck.displayName=Xb;var wA="AccordionContent",uk=Ce.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=vy(gs,n),i=ak(wA,n),s=sk(n);return d.jsx(Nq,{role:"region","aria-labelledby":i.triggerId,"data-orientation":o.orientation,...s,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});uk.displayName=wA;function SA(e){return e?"open":"closed"}var kA=mA,Dq=lk,Lq=bA,EA=ck,CA=uk;const Ll=kA,ja=g.forwardRef(({className:e,...t},n)=>d.jsx(Dq,{ref:n,className:fe("border-b",e),...t}));ja.displayName="AccordionItem";const Fl=g.forwardRef(({className:e,children:t,...n},r)=>d.jsx(Lq,{className:"flex",children:d.jsxs(EA,{ref:r,className:fe("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,d.jsx(Xu,{className:"w-4 h-4 transition-transform duration-200 shrink-0"})]})}));Fl.displayName=EA.displayName;const Ta=g.forwardRef(({className:e,children:t,...n},r)=>d.jsx(CA,{ref:r,className:fe("overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...n,children:d.jsx("div",{className:"pt-0 pb-4",children:t})}));Ta.displayName=CA.displayName;function NA(e,t,n){if(e.length===0)return{success:!1,error:"Empty path"};let r=-1,o="";const i=c=>{o===""?o=c:o+="."+c};if(t===void 0)return{success:!1,error:`Undefined schema in: '${e.join("/")}'.`};if(n===void 0)return{success:!1,error:`Undefined source in: '${e.join("/")}'.`};let s=t,a=n;const l=[{modulePath:o,schema:s,source:a}];for(const c of e){if(r++,c==="")return{success:!1,error:`Empty path part in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(s.type==="array"){s=s.item;const u=Number(c);if(!Number.isSafeInteger(u))return{success:!1,error:`Invalid array index in: '${e.join("/")}'. Expected an integer but got '${c}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(typeof a!="object")return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got '${typeof a}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(a===null)return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got 'null' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(a===void 0)return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got 'undefined' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(!Array.isArray(a))return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an array but got '${typeof a}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(!a[u])return{success:!1,error:`Invalid array index in: '${e.join("/")}'. Expected an index less than ${a.length} but got '${u}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};a=a[u],i(c)}else if(s.type==="record"){s=s.item;const u=im(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else if(s.type==="object"){s=s.items[c];const u=im(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else if(s.type==="union"){const u=typeof s.key=="object"&&s.key.type==="literal"?s:void 0,f=typeof s.key=="string"?s:void 0;if(u)return{success:!1,error:"Invalid lookup in string union"};if(f){const h=im(e,c,r,a,"union object");if(!h.success)return{success:!1,error:h.error};const p=h.source;let m;for(const v of f.items){const x=v.items[f.key];if(x.type==="literal"){if(p[f.key]===x.value){m=v;break}}else return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`}}if(!m)return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};s=m.items[c],a=p[c],i(JSON.stringify(c))}else return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`}}else if(s.type==="image"||s.type==="file"){const u=im(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else return{success:!1,error:`Cannot construct sub-path in schema of '${s.type}' in: '${e.join("/")}'. Path was: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")}`};l.push({modulePath:o,schema:s,source:a})}return{success:!0,modulePath:o,schema:s,source:a,allResolved:l}}function im(e,t,n,r,o){return typeof r!="object"?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got '${typeof r}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:r===null?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'null' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:r===void 0?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'undefined' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:typeof r!="object"?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got '${typeof r}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:Array.isArray(r)?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'array' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:t in r?{success:!0,source:r}:{success:!1,error:`Could not find key of source: '${e.join("/")}'. Expected a key in ${Object.keys(r).join(", ")} but got '${t}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}}function Fq(e,t){return(t==null?void 0:t.type)==="array"?e.type!=="string":(t==null?void 0:t.type)==="record"}function PA(e,t,n){if(!n)return null;const[r,o]=Y.splitModuleFilePathAndModulePath(e);if(!o)return r;const i=t[r],s=n[r];if(i===void 0||!s)return null;const a=NA(Y.splitModulePath(o),s,i);if(a.success){for(let l=a.allResolved.length-1;l>=0;l--){const c=a.allResolved[l],u=a.allResolved[l-1];if(Fq(c.schema,(u==null?void 0:u.schema)||null))return c.modulePath===""?r:Y.joinModuleFilePathAndModulePath(r,c.modulePath)}return r}else console.error(`Error resolving path: ${a.error} for path: ${e}`);return null}function fp({moduleFilePath:e,patchPath:t,className:n,toolTip:r=!0,link:o=!0}){const i=qu(),s=g.useRef(null),a=g.useRef(new Map),[l,c]=g.useState([]),[u,f]=g.useState(),h=$S(),p=Va(),{navigate:m}=xn();g.useEffect(()=>{const x=e?Y.splitModuleFilePath(e):[],b=t,w=()=>{if(!s.current)return;const C=s.current,N=getComputedStyle(C),P=`${N.fontSize} ${N.fontFamily}`,_=C.offsetWidth,O=x.map(zq).concat(b).map(H=>`/${H}`);f(O.join(""));const M=H=>{const V=`${H}:${P}`,I=a.current.get(V)??$q(H,P);return a.current.set(V,I),I},D="/…",U=M(D),z=[];let K=0;for(let H=O.length-1;H>=0;H--){const V=M(O[H]),A=!(H===0);if(K+V+(A?U:0)<=_){const j=H>x.length?"module-path":"module-file-path";z.unshift({text:O[H],type:j,moduleFilePath:e,modulePathSegments:b.slice(0,H)}),K+=V}else{z.unshift({type:"ellipsis",text:D});break}}c(z)},S=new ResizeObserver(w);return s.current&&(S.observe(s.current),w()),()=>{s.current&&S.unobserve(s.current)}},[e,t]);const v=g.useMemo(()=>{if(!o)return null;const x="data"in p?p.data:{};if(t.length===0){const w=e;return{navPath:w,sourcePath:w}}const b=NA(t,x[e],h[e]);if(b.success){const w=Y.joinModuleFilePathAndModulePath(e,b.modulePath),S=PA(w,h,x);if(S)return{navPath:S,scrollToId:w};console.debug(`Failed to resolve nav path for ${e} and ${t.join(".")}: ${S}`)}else console.debug(`Failed to resolve source path for ${e} and ${t.join(".")}: ${b.error}`);return null},[e,t,h,p]);return d.jsxs(zr,{open:r===!1?!1:void 0,children:[d.jsx(MS,{asChild:!0,children:d.jsx("a",{href:v&&i?`${i.studioPrefix}${v.navPath}#${v.scrollToId}`:void 0,ref:s,className:Ne("inline-block whitespace-nowrap overflow-hidden w-full align-baseline",{"cursor-pointer hover:underline":o},n),onClick:x=>{o&&v&&x.metaKey===!1&&x.ctrlKey===!1&&x.shiftKey===!1&&(x.preventDefault(),m(v.navPath,{scrollToId:v.scrollToId}))},children:l.map((x,b)=>d.jsx("span",{children:x.text},b))})}),d.jsx(fr,{side:"top",children:d.jsx(hr,{orientation:"horizontal",className:"max-w-[calc(100vw-3rem)] whitespace-nowrap",children:u})})]})}function zq(e){const t=Cu(e);return t.slice(0,1).toUpperCase()+t.slice(1)}function $q(e,t){const r=document.createElement("canvas").getContext("2d");return r?(r.font=t,r.measureText(e).width):0}function _A({className:e,loadingStatus:t}){const n=sp(),r=Yu(),o=D7(),i=I7(),s=In(),[a,l]=g.useState(!1),{canGenerate:c}=ap(),u=ec(),{autoPublish:f}=LS(),h=g.useMemo(()=>{var D;let M=0;for(const U in u)M+=((D=u[U])==null?void 0:D.length)||0;return M},[u]),p=n.length-o.size,{deployments:m,dismissDeployment:v,observedCommitShas:x}=A7(),{globalTransientErrors:b,removeGlobalTransientErrors:w}=V7(),{patchErrors:S}=QR(),[C,N]=g.useState(new Date);g.useEffect(()=>{const M=setInterval(()=>{N(new Date)},6e4);return()=>{clearInterval(M)}},[]);const{deletePatches:P}=qR(),_=T7(),O=async(M,D,U)=>{const z=await _("/patches","GET",{query:{patch_id:[D],exclude_patch_ops:!1}});if(z.status===200){const K=z.json,H=`val-patch-error-report-${M.replace("/","__").replace(/\.val\./,"-")}-${D}.json`,V=new Blob([JSON.stringify({moduleFilePath:M,patchId:D,error:U,patch:K},null,2)],{type:"application/json"}),I=document.createElement("a");I.href=URL.createObjectURL(V),I.download=H,I.click()}else alert("Failed to download report")};return d.jsxs("div",{className:Ne("text-sm",e),children:[S&&Object.values(S).some(M=>M!==null)&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[d.jsxs("div",{className:"px-4 text-pretty",children:[d.jsx("div",{children:"Unfortunately, one or more changes have errors."}),d.jsx("div",{children:"No changes can currently be applied."})]}),Object.entries(S).map(([M,D],U)=>d.jsx("div",{className:"pb-4",children:d.jsx(hr,{orientation:"horizontal",className:"max-w-[280px] text-pretty text-xs",children:D&&Object.entries(D).map(([z,K],H)=>d.jsx(kA,{className:"grid grid-cols-2 gap-2",type:"single",collapsible:!0,children:d.jsxs(lk,{value:z,children:[d.jsx("div",{children:d.jsx(qe,{variant:"destructive",onClick:()=>{P([z])},children:d.jsx("span",{className:"flex gap-2 justify-between items-center text-left",children:d.jsx("span",{children:"Remove change and fix issue"})})})}),d.jsx(ck,{asChild:!0,className:"group",children:d.jsxs(qe,{variant:"destructive",children:[d.jsx("span",{className:"text-left truncate group-data-[state=open]:hidden",children:"Report"}),d.jsx("span",{className:"text-left truncate group-data-[state=open]:block hidden",children:"Hide"})]})}),d.jsxs(uk,{children:[d.jsx(qe,{variant:"destructive",onClick:()=>{O(M,z,K.message)},children:d.jsxs("span",{className:"flex gap-2 justify-between items-center text-left",children:[d.jsx("span",{children:"Download debug report"}),d.jsx(rK,{size:14})]})}),d.jsxs("div",{className:"p-4",children:[d.jsx("div",{className:"font-bold",children:"Details"}),d.jsx("div",{children:"Module file path"}),d.jsx("div",{children:d.jsx(JN,{sourcePath:M})}),d.jsx("div",{children:"Error message"}),d.jsx("pre",{children:K.message})]})]})]})},H))})},M+"#"+U))]})}),u&&h>0&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsx(hr,{orientation:"horizontal",children:d.jsx(Ll,{type:"single",className:"px-4 font-serif",collapsible:!0,children:d.jsxs(ja,{value:"error",className:"border-b-0",children:[d.jsx(Fl,{className:" data-[state=open]:mb-4 text-fg-error-primary border-fg-error-primary ",children:d.jsxs("div",{className:"flex justify-between items-center w-full",children:[d.jsxs("div",{children:[h," validation issue",h>1?"s":""]}),d.jsx(ku,{size:16})]})}),d.jsx(Ta,{className:"",children:d.jsx("div",{className:"flex flex-col gap-4",children:Object.entries(u).map(([M,D],U)=>d.jsxs("div",{className:"pb-4",children:[d.jsx("div",{className:"items-start text-left",children:d.jsx(JN,{sourcePath:M})}),d.jsx("div",{children:d.jsx(hr,{orientation:"horizontal",className:"max-w-[280px] text-pretty text-xs",children:D==null?void 0:D.map((z,K)=>d.jsx("div",{className:"",children:d.jsx("div",{children:z.message})},K))})})]},M+"#"+U))})})]})})})}),b&&b.length>0&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsx(hr,{orientation:"horizontal",children:d.jsx(Ll,{type:"single",className:"px-4 font-serif",collapsible:!0,children:d.jsxs(ja,{value:"error",className:"border-b-0 data-[state=open]:mb-4",children:[d.jsxs(Fl,{children:[b.length," transient error",b.length>1?"s":""]}),d.jsx(Ta,{className:"w-full",children:d.jsx("div",{className:"flex flex-col gap-2",children:b.map(M=>d.jsxs("div",{className:"flex gap-2 justify-between items-start",children:[d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("div",{className:"font-bold",children:M.message}),M.details&&d.jsx("div",{children:M.details}),d.jsx("div",{className:"text-[10px] font-thin",children:Tm(C,new Date(M.timestamp).toISOString())})]}),d.jsx("button",{onClick:()=>w([M.id]),children:d.jsx(Al,{size:14})})]},M.id))})})]})})})}),m.length>0&&d.jsx("div",{className:"p-4 border-b border-border-primary",children:d.jsx(Bq,{deployments:m,observedCommitShas:x,onDismiss:v})}),r==="http"&&d.jsx("div",{className:"flex justify-end items-center p-4 border-b z-5 border-border-primary",children:d.jsxs(br,{open:a,onOpenChange:M=>{l(M)},children:[d.jsx(xo,{asChild:!0,children:d.jsxs(qe,{variant:"secondary",className:"flex gap-2 items-center text-sm",children:[d.jsx("span",{children:"Summary"}),c&&d.jsx(d2,{size:14})]})}),d.jsxs(tr,{container:s,align:"end",className:"z-[9001] flex flex-col gap-4",children:[d.jsx(Il,{asChild:!0,className:"self-end cursor-pointer",children:d.jsx(Al,{size:12})}),d.jsx(cA,{onClose:()=>{l(!1)}})]})]})}),d.jsx("div",{className:"p-4 z-5",children:d.jsxs("div",{className:"flex justify-between items-center",children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsxs("div",{className:"font-bold",children:[p<=0?"No ":`${p} `,"pending change",p===1?"":"s"]}),(t==="loading"||t==="not-asked")&&d.jsx("div",{className:"",children:d.jsx(Gr,{size:16,className:"animate-spin"})})]}),d.jsxs(br,{children:[d.jsx(xo,{asChild:!0,children:d.jsxs(qe,{disabled:n.length===0,variant:"secondary",className:"flex gap-2 items-center text-sm",children:[d.jsx("span",{children:"Undo all"}),d.jsx(Gb,{size:14})]})}),d.jsx(tr,{container:s,className:"z-[9001]",children:d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsx("div",{children:"This will undo all changes to the current state."}),d.jsx("div",{children:d.jsx(Il,{asChild:!0,children:d.jsxs(qe,{variant:"destructive",className:"flex gap-2 items-center text-sm",onClick:()=>{P(n)},children:[d.jsx("span",{children:"Undo all changes"}),d.jsx(Gb,{size:14})]})})})]})})]})]})}),(!f||h>0)&&d.jsx("div",{className:"flex flex-col gap-[2px]",children:"data"in i&&n.length>0&&i.data.map(M=>d.jsx(Hq,{committedPatchIds:o,patchSet:M,patchErrors:(S==null?void 0:S[M.moduleFilePath])??{}},M.moduleFilePath+":"+M.patchPath.join("/")))})]})}function JN({sourcePath:e}){const[t,n]=Y.splitModuleFilePathAndModulePath(e),r=Y.splitModulePath(n);return d.jsx(fp,{moduleFilePath:t,patchPath:r})}function Bq({deployments:e,observedCommitShas:t,onDismiss:n}){return g.useEffect(()=>{for(const r of e)t.has(r.commitSha)&&setTimeout(()=>{n(r.commitSha)},5e3)},[e,t]),d.jsxs("div",{children:[d.jsxs("div",{className:"flex justify-between items-center p-2 font-bold",children:[d.jsx("span",{children:"Deployments"}),d.jsx(Gr,{size:16,className:"inline animate-spin"})]}),d.jsx("div",{children:e.reverse().map(r=>d.jsx(Vq,{deployment:r,isFinished:t.has(r.commitSha),onDismiss:()=>{n(r.commitSha)}},r.commitSha))})]})}function Vq({deployment:e,isFinished:t,onDismiss:n}){var s;const r=zS(),o=In(),i=e.creator&&r[e.creator];return d.jsxs("div",{className:"flex justify-between items-start p-2",children:[d.jsxs("div",{className:"flex gap-2 items-start",children:[i&&d.jsx("img",{src:(s=i.avatar)==null?void 0:s.url,alt:i.fullName,className:"w-8 h-8 rounded-full"}),d.jsxs(zr,{children:[d.jsx(AR,{container:o}),d.jsx(ho,{children:d.jsx("div",{className:"max-w-[180px] overflow-clip font-light truncate",children:e.commitMessage})}),d.jsx(fr,{className:"max-w-[320px]",children:d.jsx("pre",{className:"font-sans font-light whitespace-break-spaces",children:e.commitMessage})})]})]}),t&&d.jsxs("div",{className:"flex gap-2 items-start",children:[d.jsx("span",{className:"text-xs font-light text-fg-quaternary",children:"Deployed"}),d.jsx("button",{onClick:()=>{n()},children:d.jsx(Ju,{size:14})})]}),!t&&d.jsx(Uq,{since:new Date(e.createdAt)})]})}function Uq({since:e}){const[t,n]=g.useState("00"),[r,o]=g.useState("00");return g.useEffect(()=>{let i;const s=()=>{const a=Date.now(),l=Math.floor((a-e.getTime())/1e3),c=Math.floor(l/60),u=l%60;let f;c>4?(f=(60-u)*1e3,n(c.toString()),o(null)):(f=1e3,n(c.toString().padStart(2,"0")),o(u.toString().padStart(2,"0"))),i=setTimeout(s,f)};return s(),()=>{clearTimeout(i)}},[e]),d.jsxs("div",{className:"text-xs font-light text-fg-quaternary",children:[t,r!==null?`:${r}`:" mins"]})}function Wq({moduleFilePath:e,patchMetadata:t,committedPatchIds:n}){var u;const r=jA([t.opType],t.createdAt,n.has(t.patchId)),o=zS(),{skippedPatches:i}=FS(),s=void 0,[a]=g.useMemo(()=>[!!i[t.patchId]],[t.patchId,i[t.patchId]]),l=Yu();let c=[];if(t.author){const f=o[t.author];if(f){const h=((u=f==null?void 0:f.avatar)==null?void 0:u.url)??null;c=[{fullName:f.fullName,url:h}]}else console.warn("Did not find profile for author: ",t.author,{profilesById:o})}return c.length===0&&l==="http"&&console.warn("No authors",{patchMetadata:t}),d.jsx(Zb,{moduleFilePath:e,patchPath:t.patchPath,changeDescription:a?"Skipped":r,authors:c,errors:s,skipped:a,isApplied:n.has(t.patchId)})}function jA(e,t,n){const[r,o]=g.useState(new Date);if(g.useEffect(()=>{const a=setInterval(()=>{o(new Date)},6e4);return()=>{clearInterval(a)}},[]),n)return"Pushed "+Tm(r,t);if(e.length>1)return"Updated "+Tm(r,t);const i=e[0];let s=i;return i==="add"?s="Added":i==="remove"?s="Removed":i==="replace"?s="Replaced":i==="move"?s="Moved":i==="copy"?s="Copied":i==="test"?s="Tested":i==="file"?s="Updated":console.warn("Unexpected op type: ",i),s+" "+Tm(r,t)}function Hq({patchSet:e,committedPatchIds:t,patchErrors:n}){const[r,o]=g.useState(!1),i=g.useRef(null),[s,a]=g.useState(!1);g.useEffect(()=>{const v=new IntersectionObserver(x=>{x[0].isIntersecting&&a(!0)},{threshold:0});return i.current&&v.observe(i.current),()=>{v.disconnect()}},[]);const{skippedPatches:l}=FS(),{deletePatches:c}=qR(),u=g.useMemo(()=>e.patches.map(v=>v.patchId),[e.patches.map(v=>v.patchId).join(",")]),f=g.useMemo(()=>{const v=[];for(const x of u){const b=n==null?void 0:n[x];!l[x]&&b&&v.unshift(b.message)}return v},[u,n,l]),h=jA(e.opTypes,e.lastUpdated,!1),p=zS(),m=e.patches.every(v=>t.has(v.patchId));return s?d.jsxs(d.Fragment,{children:[d.jsx(Zb,{moduleFilePath:e.moduleFilePath,patchPath:e.patchPath,isApplied:m,authors:e.authors.reduce((v,x)=>v.includes(x)?v:v.concat(x),[]).flatMap(v=>{var b;const x=p[v];if(x){const w=((b=x==null?void 0:x.avatar)==null?void 0:b.url)??null;return[{fullName:x.fullName,url:w}]}return[]}),changeDescription:h,isOpen:r,setOpen:o,errors:f,onDelete:()=>{c(u.filter(v=>!t.has(v)))},amount:new Set(u).size}),d.jsx(Eu,{isOpen:r,children:e.patches.map((v,x)=>d.jsx(Wq,{committedPatchIds:t,moduleFilePath:e.moduleFilePath,patchMetadata:v},e.moduleFilePath+":"+e.patchPath.join("/")+v.patchId+x))})]}):d.jsx(Zb,{ref:i,isApplied:m})}const Zb=g.forwardRef(({moduleFilePath:e,patchPath:t,changeDescription:n,authors:r,isOpen:o,setOpen:i,isSelected:s,setSelected:a,errors:l,skipped:c,onDelete:u,amount:f,isApplied:h},p)=>{const m=In();return d.jsxs("div",{ref:p,className:Ne("p-6",{"bg-bg-secondary":!o,"bg-bg-tertiary":o,"opacity-50":h}),children:[d.jsxs("div",{className:"relative",children:[d.jsx("span",{className:"inline-block w-[calc(320px-24px-8px-16px-24px-48px)] truncate mr-2 ",children:e&&t&&d.jsx(fp,{moduleFilePath:e,patchPath:t,link:!0,toolTip:!0})}),s===void 0&&d.jsx("span",{className:Ne("inline-block w-6 h-6 rounded",{"bg-bg-disabled animate-pulse":t===void 0})}),s!==void 0&&!h&&d.jsx(ed,{checked:s,onCheckedChange:v=>{a&&a(v)}}),d.jsxs("div",{className:"inline relative ml-5",children:[f&&d.jsxs(zr,{children:[d.jsx(ho,{children:d.jsx("span",{className:"absolute -right-5 -top-6 w-6 h-6 text-xs leading-6 text-center rounded-full bg-bg-primary text-fg-primary",children:f>9?"9+":f})}),d.jsx(fr,{side:"left",children:d.jsxs("p",{children:[f," change",f>1?"s":""," in this patch set"]})})]}),u&&!h&&f&&f>0&&d.jsxs(br,{children:[d.jsx(xo,{children:d.jsx(Gb,{size:16,className:"inline"})}),d.jsxs(tr,{container:m,className:"flex flex-col gap-2 z-[9001]",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsxs("div",{children:["This will undo ",f," change",f>1?"s":"","."]}),d.jsx("div",{children:d.jsx(Il,{asChild:!0,children:d.jsxs(qe,{variant:"destructive",onClick:u,children:["Undo change",f>1?"s":""]})})})]})]})]})]}),l&&l.length>0&&!c&&d.jsxs("div",{className:"p-2 max-w-[240px] bg-bg-error-primary text-fg-primary rounded-lg",children:[l.slice(0,1).map((v,x)=>d.jsx("div",{title:v,className:"truncate",children:"Invalid change"},x)),l.length>1&&d.jsxs("div",{className:"truncate",children:["+",l.length-1," more"]})]}),(!l||l.length===0)&&c&&d.jsx("div",{className:"p-2 max-w-[240px] bg-bg-error-primary text-fg-primary",children:d.jsx("div",{className:"truncate",children:"Skipped"})}),d.jsxs("div",{className:"flex justify-between items-center pt-2",children:[d.jsxs("span",{className:"flex flex-shrink-0 gap-2",children:[r!==void 0&&r.length>0&&d.jsxs("span",{className:"flex gap-1 mr-2",children:[r.slice(0,2).map((v,x)=>{if(v.url)return d.jsxs(zr,{children:[d.jsx(ho,{className:"flex-shrink-0 w-6 h-6",children:d.jsx("img",{src:v.url,alt:v.fullName,className:Ne("rounded-full",{"-ml-3":r.length>2&&x>0})})}),d.jsx(fr,{children:d.jsx("div",{children:v.fullName})})]},v.url);const b=Kq(v.fullName);return d.jsxs(zr,{children:[d.jsx(ho,{className:Ne({"-ml-3":r.length>2&&x>0}),children:d.jsx("span",{className:Ne("flex items-center justify-center w-6 h-6 text-xs font-semibold rounded-full bg-bg-primary text-fg-primary"),"aria-label":"Initials for: "+v.fullName,children:b})}),d.jsx(fr,{children:d.jsx("div",{children:v.fullName})})]},v.fullName+v.url)}),r.length>2&&d.jsxs(zr,{children:[d.jsx(ho,{className:Ne({"-ml-3":r.length>2}),children:d.jsxs("span",{className:"flex justify-center items-center -ml-3 w-6 h-6 text-xs font-semibold rounded-full bg-bg-primary text-fg-primary",children:["+",r.length-2]})}),d.jsx(fr,{className:"grid grid-cols-[auto,1fr] gap-2",children:r.slice(2).map(v=>d.jsxs(g.Fragment,{children:[v.url?d.jsx("img",{src:v.url,alt:v.fullName,title:v.fullName,className:Ne("w-6 h-6 rounded-full")},v.url):d.jsx("div",{}),d.jsx("div",{children:v.fullName})]},v.fullName+v.url))})]})]}),r===void 0&&d.jsx("span",{className:Ne("inline-block w-6 h-6 mr-2",{"bg-bg-disabled animate-pulse rounded-3xl":r===void 0})}),n&&d.jsx("span",{className:Ne({"text-fg-disabled":c}),children:n})]}),o!==void 0&&d.jsx("button",{className:"inline-block flex-shrink-0",onClick:()=>{i&&i(!o)},children:d.jsx(Xu,{size:16,className:Ne("transform",{"rotate-180":o})})})]})]})});function Kq(e){return!e||typeof e!="string"?"":e.trim().normalize("NFC").split(/\s+/).filter(r=>r.length>0).map(r=>/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u.test(r)?r[0]:r[0].toLocaleUpperCase()).join("")}function Qb(){const[e,t]=g.useState(!1),{publish:n,publishDisabled:r,isPublishing:o,summary:i}=ap(),s=ec(),a=s!==void 0&&Object.keys(s).length>0,l=YR(),c=JR(),u=Yu(),f=In(),{autoPublish:h}=LS();return a?d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{className:"flex gap-2 items-center",disabled:!0,children:u==="fs"?"Save":d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Ready"}),d.jsx(Lg,{size:16})]})})}),d.jsx(fr,{children:d.jsx("div",{className:"flex flex-col gap-2",children:d.jsx("p",{children:"Fix validation errors to continue"})})})]}):u==="fs"?d.jsxs(qe,{className:"flex gap-2 items-center",disabled:r||a||h||l.length===0||c.length>0,title:a?"Please fix validation errors":"",onClick:()=>{n("No summary provided")},children:[a?d.jsx("span",{children:"Save"}):d.jsx("span",{children:o?"Saving":"Save"}),o&&d.jsx(Gr,{className:"animate-spin",size:16})]}):d.jsx("span",{children:d.jsxs(br,{open:e,onOpenChange:p=>{t(p)},children:[d.jsx(xo,{asChild:!0,children:d.jsxs(qe,{className:"flex gap-2 items-center",disabled:r||a||l.length===0||c.length>0,onClick:()=>{t(!0)},children:[!o&&d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Ready"}),d.jsx(Lg,{size:16})]}),o&&d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Pushing"}),d.jsx(Gr,{className:"animate-spin",size:16})]})]})}),d.jsxs(tr,{container:f,align:"end",className:"z-[9001] flex flex-col gap-4",children:[d.jsx(Il,{asChild:!0,className:"self-end cursor-pointer",children:d.jsx(Al,{size:12})}),d.jsx(cA,{onClose:()=>{t(!1)},onPublish:()=>{if(t(!1),i.type==="not-asked")return;const p=i.text.trim();n(p)}})]})]})})}function Gq(){const e=cy(),{isPublishing:t}=ap(),n=ec()||{},{globalErrors:r}=FS(),o=Yu(),[i,s]=g.useMemo(()=>{const a=new Set;let l=0;for(const c in n){const[u]=Y.splitModuleFilePathAndModulePath(c);a.add(u),l+=1}return[Array.from(a).sort(),l]},[n]);return d.jsxs("div",{className:"min-h-[100svh] bg-bg-primary",style:{"--menu-width":"320px"},children:[d.jsx("div",{className:"h-16 border-b border-border-primary",children:d.jsx(Jq,{})}),t&&d.jsxs("div",{className:"flex gap-2 justify-end items-center p-4 text-right border-t bg-bg-tertiary text-fg-primary border-border-primary",children:[d.jsx("span",{children:"Publishing changes "}),d.jsx(Gr,{size:16,className:"animate-spin"})]}),d.jsx(hr,{children:d.jsxs("div",{className:"max-h-[calc(100svh-64px)]",children:[r&&r.length>0&&r.length!==s&&d.jsx(Ll,{type:"single",collapsible:!0,children:d.jsxs(ja,{value:"global-errors",children:[d.jsxs(Fl,{className:"p-4 font-normal text-left rounded data-[state=open]:rounded-b-none bg-bg-error-primary text-fg-error-primary",children:["Cannot ",o==="fs"?"save":"publish"," now. Found"," ",r==null?void 0:r.length," errors in all."," ",r.length-s," were non-validation errors. A developer might need to fix these issues."]}),d.jsx(Ta,{children:d.jsx(hr,{children:d.jsx("div",{className:"max-h-[calc(100svh-128px)] max-w-[var(--menu-width)]",children:r==null?void 0:r.map((a,l)=>d.jsx(Yq,{error:a},l))})})})]})}),(r==null?void 0:r.length)===s&&i.length>0&&d.jsx(Ll,{type:"single",collapsible:!0,children:d.jsxs(ja,{value:"global-errors",children:[d.jsx(Fl,{className:"p-4 font-normal text-left rounded data-[state=open]:rounded-b-none bg-bg-error-primary text-fg-error-primary",children:d.jsxs("div",{children:[d.jsxs("div",{children:["Cannot ",o==="fs"?"save":"publish"," now."]}),d.jsx("div",{children:"Found errors in modules"})]})}),d.jsx(Ta,{children:d.jsx(hr,{children:d.jsx("div",{className:"max-h-[calc(100svh-64px)] max-w-[var(--menu-width)]",children:i==null?void 0:i.map((a,l)=>d.jsx(qq,{moduleFilePath:a},l))})})})]})}),e!=="not-asked"&&d.jsx("div",{className:Ne("",{}),children:d.jsx(hr,{children:d.jsx("div",{className:"max-h-[calc(100svh-64px)] border-b border-border-primary",children:d.jsx(_A,{loadingStatus:e})})})})]})})]})}function qq({moduleFilePath:e}){const t=Y.splitModuleFilePath(e),n=xn();return d.jsx("div",{className:"px-4 py-2 border-b bg-bg-error-primary text-fg-error-primary border-border-error-primary",children:d.jsx("button",{className:"underline cursor-pointer",onClick:()=>{n.navigate(e)},children:t.map((r,o)=>d.jsxs(g.Fragment,{children:[d.jsx("span",{className:fe("text-fg-brand-secondary",{"ml-1":o>0}),children:"/"}),d.jsx("span",{children:Cu(r)})]},o))})})}function Yq({error:e}){const[t,n]=g.useState(!1);return d.jsx("div",{className:fe("px-1 py-2 bg-bg-error-primary text-fg-error-primary border-b border-border-error-primary",{truncate:!t,"whitespace-normal":t}),onClick:()=>n(!t),children:e})}function Jq(){const{currentSourcePath:e}=xn(),t=Va(),[n,r]=Y.splitModuleFilePathAndModulePath(e),o=lt(n,"record"),i=g.useMemo(()=>{if(t.status!=="success")return t;if(o.status!=="success")return o;const f=t.data[n];if(f.type==="record"&&f.router){if(o.data===null)return{status:"success",data:null};const h=Object.keys(o.data),p=Y.splitModulePath(r)[0];for(const m of h)if(p&&p.startsWith(m))return{status:"success",data:{previewRoute:m}}}return{status:"success",data:null}},["data"in t&&t.data,n,r,o]),{navMenu:s,toolsMenu:a}=Xy(),l=Yu(),{setAutoPublish:c,autoPublish:u}=LS();return d.jsx("div",{className:"flex flex-col",children:d.jsxs("div",{className:"flex gap-2 justify-between items-center p-4 w-full",children:[d.jsx("button",{className:"lg:hidden",onClick:()=>{a.setOpen(!a.isOpen)},children:d.jsx(Ig,{size:16,className:Ne("transform",{"rotate-180":!s.isOpen})})}),d.jsxs("div",{className:"flex gap-2 justify-end items-center w-full",children:[l==="fs"&&d.jsxs("div",{className:"overflow-hidden flex items-center gap-2 text-[10px] lg:text-xs",children:[d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx("span",{className:"truncate text-fg-secondary",children:"Auto-save"})}),d.jsxs(fr,{children:[d.jsx("p",{children:"When auto-save is enabled Val will save to changes to disk automatically"}),d.jsx("p",{children:"This is a development mode feature"})]})]}),d.jsx(ed,{checked:u,onCheckedChange:c})]}),d.jsx(Xq,{maybePreviewRoute:i}),d.jsx(Qb,{})]})]})})}function Xq({maybePreviewRoute:e}){var n,r;const t=g.useMemo(()=>{var o;return e.status==="success"&&((o=e.data)!=null&&o.previewRoute)?vu("/api/val/enable",{redirect_to:window.origin+e.data.previewRoute}):vu("/api/val/enable",{redirect_to:window.origin})},[e]);return d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{className:"flex gap-2 items-center",variant:"secondary",asChild:!0,children:d.jsxs("a",{href:t,children:[d.jsx("span",{children:"Preview"}),e.status==="success"&&((n=e.data)!=null&&n.previewRoute)?d.jsx(Ag,{size:16}):d.jsx(Dg,{size:16})]})})}),d.jsx(fr,{children:e.status==="success"&&((r=e.data)!=null&&r.previewRoute)?d.jsxs("p",{children:["Preview your changes in ",e.data.previewRoute]}):d.jsx("p",{children:"Preview your changes on the main page"})})]})}function Xt({error:e,path:t}){return d.jsx("div",{id:t,children:d.jsx("div",{className:"p-4 bg-bg-error-primary text-fg-error-primary",children:e})})}function yt({path:e,type:t}){return d.jsx("div",{id:e,className:Ne("pt-6",{"w-full flex items-center justify-center":t==="module","text-left":t!=="module"}),children:d.jsx(Gr,{size:t==="module"?24:16,className:"animate-spin"})})}function Mn({path:e,type:t}){const[n,r]=g.useState(!1);return g.useEffect(()=>{const o=setTimeout(()=>{r(!0)},2e3);return()=>{clearTimeout(o)}},[]),e.length===0?null:n?d.jsx("div",{className:"pt-6",id:e,children:d.jsx("div",{children:"Could not get data"})}):d.jsx(yt,{path:e,type:t})}function kr({actualType:e,expectedType:t,path:n}){return d.jsx("div",{id:n,children:d.jsxs("div",{children:["Schema mismatch: actual: ",e," vs expected: ",t," "]})})}function it({error:e,path:t,schema:n}){const{addPatch:r,patchPath:o}=bn(t);return d.jsxs("div",{id:t,className:"flex justify-between items-center px-2 py-3 rounded-lg bg-bg-error-primary text-fg-primary",children:[d.jsxs("div",{children:["Source error: ",e]}),d.jsxs("div",{className:"flex gap-2 items-center",children:[n&&n.status==="success"&&!(n.data.type==="file"||n.data.type==="image")&&d.jsx(qe,{variant:"outline",className:"hover:bg-bg-error-secondary-hover",onClick:()=>{r([{op:"replace",path:o,value:Dl(n.data)}],n.data.type)},children:"Fix"}),d.jsx(ku,{size:16})]})]})}function Zq(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const yy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function td(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function dk(e){return"nodeType"in e}function Er(e){var t,n;return e?td(e)?e:dk(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function fk(e){const{Document:t}=Er(e);return e instanceof t}function hp(e){return td(e)?!1:e instanceof Er(e).HTMLElement}function TA(e){return e instanceof Er(e).SVGElement}function nd(e){return e?td(e)?e.document:dk(e)?fk(e)?e:hp(e)||TA(e)?e.ownerDocument:document:document:document}const Ei=yy?g.useLayoutEffect:g.useEffect;function hk(e){const t=g.useRef(e);return Ei(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Qq(){const e=g.useRef(null),t=g.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function vh(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return Ei(()=>{n.current!==e&&(n.current=e)},t),n}function pp(e,t){const n=g.useRef();return g.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Vg(e){const t=hk(e),n=g.useRef(null),r=g.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function ew(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let o0={};function mp(e,t){return g.useMemo(()=>{if(t)return t;const n=o0[e]==null?0:o0[e]+1;return o0[e]=n,e+"-"+n},[e,t])}function OA(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[l,c]of a){const u=i[l];u!=null&&(i[l]=u+e*c)}return i},{...t})}}const Zc=OA(1),yh=OA(-1);function eY(e){return"clientX"in e&&"clientY"in e}function pk(e){if(!e)return!1;const{KeyboardEvent:t}=Er(e.target);return t&&e instanceof t}function tY(e){if(!e)return!1;const{TouchEvent:t}=Er(e.target);return t&&e instanceof t}function tw(e){if(tY(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return eY(e)?{x:e.clientX,y:e.clientY}:null}const xh=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[xh.Translate.toString(e),xh.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),XN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function nY(e){return e.matches(XN)?e:e.querySelector(XN)}const rY={display:"none"};function oY(e){let{id:t,value:n}=e;return Ce.createElement("div",{id:t,style:rY},n)}function iY(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Ce.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function sY(){const[e,t]=g.useState("");return{announce:g.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const MA=g.createContext(null);function aY(e){const t=g.useContext(MA);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function lY(){const[e]=g.useState(()=>new Set),t=g.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[g.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const cY={draggable:`
460
+ `)},IG=0,pc=[];function DG(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),o=g.useState(IG++)[0],i=g.useState(R2)[0],s=g.useRef(e);g.useEffect(function(){s.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var v=rG([e.lockRef.current],(e.shards||[]).map(UN),!0).filter(Boolean);return v.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),v.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(v,x){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!s.current.allowPinchZoom;var b=om(v),w=n.current,S="deltaX"in v?v.deltaX:w[0]-b[0],C="deltaY"in v?v.deltaY:w[1]-b[1],N,P=v.target,_=Math.abs(S)>Math.abs(C)?"h":"v";if("touches"in v&&_==="h"&&P.type==="range")return!1;var O=BN(_,P);if(!O)return!0;if(O?N=_:(N=_==="v"?"h":"v",O=BN(_,P)),!O)return!1;if(!r.current&&"changedTouches"in v&&(S||C)&&(r.current=N),!N)return!0;var M=r.current||N;return MG(M,x,v,M==="h"?S:C,!0)},[]),l=g.useCallback(function(v){var x=v;if(!(!pc.length||pc[pc.length-1]!==i)){var b="deltaY"in x?VN(x):om(x),w=t.current.filter(function(N){return N.name===x.type&&(N.target===x.target||x.target===N.shadowParent)&&RG(N.delta,b)})[0];if(w&&w.should){x.cancelable&&x.preventDefault();return}if(!w){var S=(s.current.shards||[]).map(UN).filter(Boolean).filter(function(N){return N.contains(x.target)}),C=S.length>0?a(x,S[0]):!s.current.noIsolation;C&&x.cancelable&&x.preventDefault()}}},[]),c=g.useCallback(function(v,x,b,w){var S={name:v,delta:x,target:b,should:w,shadowParent:LG(b)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(C){return C!==S})},1)},[]),u=g.useCallback(function(v){n.current=om(v),r.current=void 0},[]),f=g.useCallback(function(v){c(v.type,VN(v),v.target,a(v,e.lockRef.current))},[]),h=g.useCallback(function(v){c(v.type,om(v),v.target,a(v,e.lockRef.current))},[]);g.useEffect(function(){return pc.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,hc),document.addEventListener("touchmove",l,hc),document.addEventListener("touchstart",u,hc),function(){pc=pc.filter(function(v){return v!==i}),document.removeEventListener("wheel",l,hc),document.removeEventListener("touchmove",l,hc),document.removeEventListener("touchstart",u,hc)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(i,{styles:AG(o)}):null,p?g.createElement(CG,{gapMode:e.gapMode}):null)}function LG(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const FG=fG(M2,DG);var up=g.forwardRef(function(e,t){return g.createElement(py,pi({},e,{ref:t,sideCar:FG}))});up.classNames=py.classNames;var XS="Popover",[L2,yge]=So(XS,[Ti]),dp=Ti(),[zG,Ua]=L2(XS),F2=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=e,a=dp(t),l=g.useRef(null),[c,u]=g.useState(!1),[f=!1,h]=Kr({prop:r,defaultProp:o,onChange:i});return d.jsx(np,{...a,children:d.jsx(zG,{scope:t,contentId:Vr(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:g.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:c,onCustomAnchorAdd:g.useCallback(()=>u(!0),[]),onCustomAnchorRemove:g.useCallback(()=>u(!1),[]),modal:s,children:n})})};F2.displayName=XS;var z2="PopoverAnchor",$G=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ua(z2,n),i=dp(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:a}=o;return g.useEffect(()=>(s(),()=>a()),[s,a]),d.jsx(Hu,{...i,...r,ref:t})});$G.displayName=z2;var $2="PopoverTrigger",$g=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ua($2,n),i=dp(n),s=Ve(t,o.triggerRef),a=d.jsx(Oe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":H2(o.open),...r,ref:s,onClick:te(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:d.jsx(Hu,{asChild:!0,...i,children:a})});$g.displayName=$2;var ZS="PopoverPortal",[BG,VG]=L2(ZS,{forceMount:void 0}),B2=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,i=Ua(ZS,t);return d.jsx(BG,{scope:t,forceMount:n,children:d.jsx(ln,{present:n||i.open,children:d.jsx(Ku,{asChild:!0,container:o,children:r})})})};B2.displayName=ZS;var Pu="PopoverContent",V2=g.forwardRef((e,t)=>{const n=VG(Pu,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,i=Ua(Pu,e.__scopePopover);return d.jsx(ln,{present:r||i.open,children:i.modal?d.jsx(UG,{...o,ref:t}):d.jsx(WG,{...o,ref:t})})});V2.displayName=Pu;var UG=g.forwardRef((e,t)=>{const n=Ua(Pu,e.__scopePopover),r=g.useRef(null),o=Ve(t,r),i=g.useRef(!1);return g.useEffect(()=>{const s=r.current;if(s)return hy(s)},[]),d.jsx(up,{as:cs,allowPinchZoom:!0,children:d.jsx(U2,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:te(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),WG=g.forwardRef((e,t)=>{const n=Ua(Pu,e.__scopePopover),r=g.useRef(!1),o=g.useRef(!1);return d.jsx(U2,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),U2=g.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=e,h=Ua(Pu,n),p=dp(n);return fy(),d.jsx(cp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:d.jsx(Zl,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:d.jsx(rp,{"data-state":H2(h.open),role:"dialog",id:h.contentId,...p,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),W2="PopoverClose",Il=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ua(W2,n);return d.jsx(Oe.button,{type:"button",...r,ref:t,onClick:te(e.onClick,()=>o.onOpenChange(!1))})});Il.displayName=W2;var HG="PopoverArrow",KG=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=dp(n);return d.jsx(op,{...o,...r,ref:t})});KG.displayName=HG;function H2(e){return e?"open":"closed"}var GG=F2,qG=$g,YG=B2,K2=V2;const br=GG,xo=qG,tr=g.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>d.jsx(YG,{container:r.container,children:d.jsx(K2,{ref:o,align:t,sideOffset:n,className:fe("z-50 w-72 rounded-md border bg-bg-secondary p-4 text-fg-secondary shadow-md outline-none 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));tr.displayName=K2.displayName;function WN({profile:e,size:t="md"}){var c,u,f;const[n,r]=g.useState(((c=e==null?void 0:e.avatar)==null?void 0:c.url)||null);g.useEffect(()=>{var h,p;(h=e==null?void 0:e.avatar)!=null&&h.url?r((p=e==null?void 0:e.avatar)==null?void 0:p.url):r(null)},[(u=e==null?void 0:e.avatar)==null?void 0:u.url]);const[o,...i]=((f=e.fullName)==null?void 0:f.split(" "))||[""],s=i[i.length-1]||"",a=`${o[0].toUpperCase()}${s[0].toUpperCase()}`,l=Ne("rounded-full text-center inline-block bg-bg-brand-primary text-fg-brand-primary",{"h-8 w-8 leading-8 text-xs":t==="sm","h-10 w-10 leading-10 text-base":t==="md","h-12 w-12 leading-[3rem] text-lg":t==="lg"});return n?d.jsx("img",{src:n,alt:a,className:l,onError:()=>{r(null)}}):d.jsx("span",{className:l,children:a})}function JG(e,t,n,r){if(t[n]===void 0)return console.error(`Get keysOf source not found for ${n}`),[];if(!e[n])return console.error(`Schema not found for ${n}`),[];const s=n,a=[],l=(c,u,f)=>{var h;if(u===void 0){console.error(`Schema not found for ${c}`);return}if(u.type==="keyOf")u.path===s&&(r?typeof f=="string"&&f===r&&(a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c)):a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c));else if(u.type==="object"||u.type==="record"){if(KN(f)||G2(f))for(const p in f){const m=f==null?void 0:f[p],v=u.type==="object"?(h=u.items)==null?void 0:h[p]:u.item;m&&l(HN(c,p),v,m)}}else if(u.type==="array"){if(XG(f)){let p=0;for(const m of f)l(HN(c,p),u.item,m),p++}}else if(u.type==="union"){const p=u.key;if(typeof p=="string"&&KN(f)){const m=f[p];if(typeof m=="string"){const v=u.items.filter(x=>x.type==="object").find(x=>{const b=x.items[p];if((b==null?void 0:b.type)==="literal")return b.value===m});v&&l(c,v,f)}}}else u.type==="string"||u.type==="number"||u.type==="boolean"||u.type==="literal"||u.type==="date"||u.type==="image"||u.type==="file"||u.type==="richtext"||console.error("Could not get keyOf references. Unhandled schema type",u)};for(const c in e){const u=c;l(c,e[u],t[u])}return a}function HN(e,t){return e.includes(wa)?`${e}.${JSON.stringify(t)}`:`${e}${wa}${JSON.stringify(t)}`}function KN(e){return G2(e)}function G2(e){return typeof e=="object"&&!!e&&!ea(e)}function XG(e){return typeof e=="object"&&!!e&&ea(e)}function q2(e,t){const n=Va(),r=cy(),o=$S();return g.useMemo(()=>e!==void 0&&"data"in n&&n.data!==void 0&&n.data[e]!==void 0?JG(n.data,o,e,t):[],[r,o,"data"in n&&n.data,e,t])}const GN=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,qN=$R,ZG=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return qN(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(c=>{const u=n==null?void 0:n[c],f=i==null?void 0:i[c];if(u===null)return null;const h=GN(u)||GN(f);return o[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[f,h]=u;return h===void 0||(c[f]=h),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:f,className:h,...p}=u;return Object.entries(p).every(m=>{let[v,x]=m;return Array.isArray(x)?x.includes({...i,...a}[v]):{...i,...a}[v]===x})?[...c,f,h]:c},[]);return qN(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},Jb=ZG("inline-flex items-center justify-center whitespace-nowrap rounded-md text-fg-primary text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:text-fg-disabled disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:fe("cursor-pointer","border border-border-brand-primary","bg-bg-brand-primary text-fg-brand-primary","hover:bg-bg-brand-primary-hover hover:text-fg-brand-primary-hover","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary"),destructive:fe("cursor-pointer","border border-bg-error-primary","bg-bg-error-primary text-fg-error-primary hover:bg-bg-error-primary-hover disabled:text-fg-error-primary"),outline:fe("cursor-pointer","border border-transparent","bg-bg-background hover:bg-bg-secondary","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary"),secondary:fe("cursor-pointer","border border-border-secondary","bg-bg-secondary text-fg-secondary hover:bg-bg-secondary-hover"),ghost:fe("cursor-pointer","border border-transparent","bg-bg-background hover:bg-bg-secondary","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary","hover:bg-bg-secondary-hover hover:text-fg-secondary"),link:fe("cursor-pointer","border border-transparent","text-fg-primary underline-offset-4 hover:underline")},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),qe=g.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?cs:"button";return d.jsx(s,{className:fe(Jb({variant:t,size:n,className:e})),ref:i,...o})});qe.displayName="Button";function QG({path:e,disabled:t}){const[n,r]=Y.splitModuleFilePathAndModulePath(e),o=Y.splitModuleFilePath(n),i=Y.splitModulePath(r),{navigate:s}=xn();return d.jsxs("div",{className:"w-full",children:[d.jsx("button",{type:"button",title:n,disabled:t,className:"inline-block text-left truncate",onClick:()=>{s(n)},children:o.map((a,l)=>d.jsxs(g.Fragment,{children:[l===0&&d.jsx("span",{className:"text-muted",children:"/"}),d.jsx("span",{className:Ne({"text-muted":!(i.length===0&&l===o.length-1)}),children:Cu(a)}),l>0&&l<o.length-1&&d.jsx("span",{className:"text-muted",children:"/"})]},`${a}-${l}`))}),d.jsx("button",{type:"button",disabled:t,title:Y.joinModuleFilePathAndModulePath(n,r),className:"inline-block text-left truncate",onClick:()=>{s(Y.joinModuleFilePathAndModulePath(n,r))},children:i.map((a,l)=>d.jsxs(g.Fragment,{children:[d.jsx("span",{className:"text-muted",children:"/"}),d.jsx("span",{className:Ne({"text-muted":l===i.length-2}),children:Cu(a)})]},`${a}-${l}`))})]})}function Y2({path:e,parentPath:t,variant:n,refs:r,children:o,size:i,onComplete:s,confirmationMessage:a,className:l}){const c=In();return d.jsxs(br,{children:[d.jsx(xo,{asChild:!0,children:d.jsx(qe,{size:i,variant:n,className:l,children:o})}),d.jsxs(tr,{container:c,className:"flex flex-col gap-2 p-4",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsx("div",{children:a}),d.jsx(Il,{asChild:!0,children:d.jsx(eq,{path:e,parentPath:t,refs:r,variant:"destructive",onComplete:s,children:d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(HS,{size:12}),d.jsx("span",{children:"Delete"})]})})})]})]})}function eq({path:e,parentPath:t,variant:n,refs:r,children:o,size:i,onComplete:s}){const{navigate:a}=xn(),{addPatch:l,patchPath:c}=bn(e),u=lt(t,"record");return!("data"in u)||u.data===void 0||u.data===null?(console.error("Parent source not found",u,{path:e}),null):d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{size:i,variant:n,disabled:r.length>0,onClick:()=>{l([{op:"remove",path:c}],"record"),a(t),s&&s()},children:o})}),d.jsx(fr,{side:"top",children:r.length>0?d.jsxs("div",{children:[d.jsx("p",{children:"Cannot delete record."}),d.jsxs("p",{children:["You must change the following references"," ",d.jsx(f2,{size:10,className:"inline"})," to be able to delete:"]}),d.jsx("ul",{children:r.map(f=>d.jsx("li",{children:d.jsx(QG,{path:f})},f))})]}):d.jsx("p",{children:"Delete record"})})]})}function Dl(e){if(e.type==="object")return Object.fromEntries(Object.keys(e.items).map(n=>[n,Dl(e.items[n])]));if(e.type==="array")return[];if(e.type==="record")return{};if(e.opt)return null;if(e.type==="richtext")return[];if(e.type==="string")return"";if(e.type==="boolean")return!1;if(e.type==="number")return 0;if(e.type==="keyOf")return e.values==="string"?"":e.values[0];if(e.type==="file"||e.type==="image")return null;if(e.type==="literal")return e.value;if(e.type==="union")return typeof e.key=="string"?Dl(e.items[0]):e.key.value;if(e.type==="date")return ms(new Date,"yyyy-MM-dd");throw Error("Unexpected schema type: "+JSON.stringify(e))}const Qu=g.forwardRef(({className:e,type:t,...n},r)=>d.jsx("input",{type:t,className:fe("flex h-10 m-1 w-[calc(100%-8px)] rounded-md border border-input bg-bg-primary px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Qu.displayName="Input";function tq(e,t){const n={},r=t==null?void 0:t.split("/");(r==null?void 0:r[0])===""&&r.shift();const o=(r==null?void 0:r.filter(s=>s!==""))||[];let i=0;for(let s=0;s<e.length;s++){const a=e[s];if(a.type==="literal"){const l=o[i];if(!l)return{status:"error",message:`Missing required literal part: ${a.name}`};if(a.name!==l)return{status:"error",message:`Invalid path part: expected "${a.name}", got "${l}"`};i++}else if(a.type==="string-param"){const l=o[i];if(!l){if(a.optional)continue;return{status:"error",message:`Missing required parameter: ${a.paramName}`}}n[a.paramName]=l,i++}else if(a.type==="array-param"){const l=o.slice(i);if(l.length===0){if(a.optional)continue;return{status:"error",message:`Missing required catch-all parameter: ${a.paramName}`}}n[a.paramName]=l,i+=l.length}}return i<o.length?{status:"error",message:`Extra path parts found: ${o.slice(i).join("/")}`}:{status:"success",params:n}}function J2({routePattern:e,existingKeys:t,onSubmit:n,submitText:r,defaultParams:o,onCancel:i,defaultValue:s}){const[a,l]=g.useState({});g.useEffect(()=>{o&&l(o)},[o]);const[c,u]=g.useState({});g.useEffect(()=>{if(s){const m=tq(e,s);m.status==="success"&&l(m.params)}},[s,e]);const f=g.useMemo(()=>"/"+e.map(m=>{if(m.type==="string-param"||m.type==="array-param"){const v=a[m.paramName];return Array.isArray(v)?v.join("/"):v}return m.name}).join("/"),[e,a]),p=!g.useMemo(()=>e.every(m=>m.type==="string-param"||m.type==="array-param"?!!a[m.paramName]&&!c[m.paramName]:!0),[e,a,c])||f in t;return d.jsxs("form",{className:"p-4 space-y-3",onSubmit:m=>{m.preventDefault(),n(f)},children:[d.jsx("div",{className:"flex items-center",children:e.map((m,v)=>d.jsx("span",{className:"truncate",children:m.type==="string-param"||m.type==="array-param"?d.jsxs("span",{className:"flex items-center",children:[d.jsx("span",{children:"/"}),d.jsxs("span",{className:"flex flex-col",children:[d.jsx("input",{className:fe("p-1 bg-transparent border-0 max-w-[10ch]",{"border-border-secondary border-1":c[m.paramName]}),placeholder:m.paramName,value:nq(a,m.paramName),onChange:x=>{l({...a,[m.paramName]:x.target.value});const b=m.type==="string-param"?x.target.value:x.target.value.replace(/\//g,"");encodeURIComponent(b)!==b?u({...c,[m.paramName]:"Invalid characters"}):u({...c,[m.paramName]:void 0})}}),c[m.paramName]&&d.jsx("span",{className:"text-xs text-fg-error-secondary",children:c[m.paramName]})]})]}):d.jsxs("span",{className:"text-fg-secondary",children:["/",m.name]})},v))}),d.jsxs("div",{className:"flex gap-4",children:[d.jsx(qe,{disabled:p,children:r}),d.jsx(qe,{variant:"ghost",type:"reset",onClick:i,children:"Cancel"})]})]})}function nq(e,t){const n=e[t];return Array.isArray(n)?n.join("/"):n||""}function X2({path:e,size:t,variant:n,children:r,open:o,setOpen:i,defaultOpen:s,routePattern:a}){const l=lt(e,"record"),c=Ft(e),u=In(),{addPatch:f}=bn(e),{navigate:h}=xn(),[p,m]=g.useState(s??!1);g.useEffect(()=>{o!==void 0&&m(o)},[o]),g.useEffect(()=>{i!==void 0&&i(p)},[p,i]),g.useEffect(()=>{s!==void 0&&m(s)},[s]);const v=g.useCallback(S=>{const C="data"in c?c.data:null;if(C===null||C.type!=="record")return;const N=Y.createPatchPath(w).concat(S);f([{op:"add",path:N,value:Dl(C.item)}],"record"),h(Y.joinModuleFilePathAndModulePath(b,Y.patchPathToModulePath(N))),m(!1)},[f,h,c,e]);if(!("data"in l)||l.data===void 0||l.data===null)return console.error("Source not found",l,{path:e}),null;if(!("data"in c)||c.data===void 0)return console.error("Schema not found",l,{path:e}),null;if(c.data.type!=="record")return console.error("Schema is not a record",c,{path:e}),null;const[b,w]=Y.splitModuleFilePathAndModulePath(e);return d.jsxs(br,{open:p,onOpenChange:m,children:[d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(xo,{onClick:()=>{m(!0)},asChild:!0,children:d.jsx(qe,{size:t,variant:n,children:r})})}),d.jsx(fr,{children:d.jsx("p",{children:"Add"})})]}),d.jsx(tr,{container:u,children:a?d.jsx(J2,{routePattern:a,existingKeys:Object.keys(l.data),onSubmit:v,onCancel:()=>{m(!1)},submitText:"Create"}):d.jsx(rq,{existingKeys:Object.keys(l.data),onSubmit:v})})]})}function rq({existingKeys:e,onSubmit:t}){const[n,r]=g.useState(""),o=n===""||n in e;return d.jsxs("form",{className:"flex flex-col gap-2",onSubmit:i=>{i.preventDefault(),t(n)},children:[d.jsx(Qu,{autoFocus:!0,value:n,onChange:i=>{r(i.target.value)}}),d.jsx("div",{children:d.jsx(qe,{type:"submit",disabled:o,variant:"outline",children:"Add"})})]})}function oq({existingKeys:e,defaultValue:t,onCancel:n,onSubmit:r}){const[o,i]=g.useState(t),s=o===t||o===""||o in e;return d.jsxs("form",{className:"flex flex-col gap-2",onSubmit:a=>{a.preventDefault(),r(o)},children:[d.jsx(Qu,{type:"text",value:o,onChange:a=>{i(a.target.value)}}),d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(qe,{disabled:s,variant:"outline",type:"submit",children:"Update"}),d.jsx(qe,{variant:"ghost",type:"reset",onClick:()=>{n(),i(t)},children:"Cancel"})]})]})}function Z2({defaultValue:e,path:t,parentPath:n,variant:r,existingKeys:o,routePattern:i,size:s,children:a,onComplete:l}){const{navigate:c}=xn(),[u,f]=g.useState(!1),h=In();g.useEffect(()=>{const S=C=>{C.key==="Escape"&&f(!1)};return window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S)}},[]);const{addPatch:p,addModuleFilePatch:m}=bn(t),[v,x]=Y.splitModuleFilePathAndModulePath(n),b=Y.createPatchPath(x),w=g.useCallback(S=>{const C=[{op:"move",from:b.concat(e),path:b.concat(S)}];p(C,"record");for(const P of o){const[_,O]=Y.splitModuleFilePathAndModulePath(P),M=Y.createPatchPath(O);m(_,[{op:"replace",path:M,value:S}],"record")}const N=Y.joinModuleFilePathAndModulePath(v,Y.patchPathToModulePath(b.concat(S)));c(N,{replace:!0}),l&&l()},[p,m,v,b,c,l]);return d.jsxs(br,{open:u,children:[d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{asChild:!0,size:s,variant:r,children:d.jsx(xo,{onClick:()=>{f(!0)},children:a})})}),d.jsx(fr,{side:"top",children:"Rename record"})]}),d.jsx(tr,{container:h,className:"text-fg-primary",children:i?d.jsx(J2,{routePattern:i,existingKeys:o,defaultValue:e,onSubmit:S=>{w(S),f(!1)},onCancel:()=>{f(!1)},submitText:"Update"}):d.jsx(oq,{parentPath:n,defaultValue:e,existingKeys:o,onSubmit:S=>{w(S),f(!1)},onCancel:()=>{f(!1)}})})]})}function iq({moduleFilePaths:e}){const t=e2(e,"record"),n=t2(),r=g.useMemo(()=>{const o=[];if(n.status!=="success")return n;if(n.data===null)return{status:"error",error:"No src folder found"};if(t.status!=="success")return t.status==="not-found"?{status:"error",error:"No data found"}:t.status==="error"?{status:"error",error:`Failed to load ${Object.keys(t.errors).length} modules: ${Object.entries(t.errors).map(([a,l])=>`"${a}": ${l.message}`).join(", ")}`}:t;for(const s of t.data||[])for(const a in s){const[l]=Y.splitModuleFilePathAndModulePath(s[a]);o.push({urlPath:a,moduleFilePath:l})}const i=D8(n.data,o);return{status:t.status,data:i}},[t,n]);return r.status==="loading"||r.status==="not-asked"?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx(Gr,{size:16,className:"animate-spin"})}):r.status==="error"?(console.error("Sitemap errors",r.error),null):d.jsx(Q2,{node:r.data})}function Q2({node:e}){var m;const t=In(),{currentSourcePath:n}=xn(),[r,o]=g.useState(!0),{navigate:i}=xn(),[s,a]=g.useState(!1),[l,c]=g.useState(!1),u=g.useMemo(()=>{var v;return!!((v=e.sourcePath)!=null&&v.startsWith(n))},[n,e.sourcePath]),f=g.useMemo(()=>{if(!e.pattern)return;const v=$M(e.pattern);if(v.some(x=>x.type==="string-param"||x.type==="array-param"))return v},[e.pattern]),h=g.useCallback(()=>{var v;e.sourcePath?i(e.sourcePath):e.type==="node"&&((v=e.children)==null?void 0:v.length)>0&&o(x=>!x)},[i,e]),p=e.moduleFilePath;return d.jsxs("div",{children:[d.jsxs("div",{className:"relative flex items-center justify-between w-full h-10 group",children:[d.jsxs("div",{className:"flex items-center my-1",children:[d.jsx("button",{onClick:()=>o(!r),className:fe("hidden h-4 w-4 mr-2",{block:((m=e.children)==null?void 0:m.length)>0}),children:d.jsx(Zu,{size:16,className:fe("transform",{"rotate-90":r})})}),d.jsx("span",{children:e.sourcePath?d.jsxs("button",{onClick:h,className:fe("flex items-center gap-1",{}),children:[e.name==="/"?d.jsx(tK,{size:14}):e.type==="leaf"||e.type==="node"&&e.page?d.jsx(a2,{size:14}):null,d.jsxs("span",{children:[e.name==="/"&&d.jsx("span",{className:"ml-2 text-fg-primary-alt",children:"Main page"}),e.name!=="/"&&d.jsx("span",{className:fe({underline:u}),children:e.name})]})]}):d.jsxs("button",{onClick:h,className:fe("flex items-center gap-1",{}),children:[d.jsx(aK,{size:14}),d.jsx("span",{children:d.jsx("span",{children:e.name})})]})})]}),d.jsxs("div",{className:fe("absolute right-0 top-0 items-center group-hover:flex h-10 bg-bg-primary",{hidden:!s&&!l,flex:s||l}),children:[e.sourcePath&&d.jsx(qe,{size:"sm",variant:"ghost",onClick:h,className:"flex items-center gap-2",children:d.jsx(US,{size:12})}),(e.sourcePath||e.type==="leaf"||e.page)&&d.jsxs(br,{onOpenChange:a,open:s,children:[d.jsx(xo,{asChild:!0,children:d.jsx(qe,{size:"sm",variant:"ghost",children:d.jsx(VS,{size:12})})}),d.jsx(tr,{container:t,children:d.jsx(sq,{node:e,routePatternWithParams:f,onClose:()=>a(!1)})})]}),f&&p&&d.jsx(X2,{path:p,size:"sm",variant:"ghost",open:l,setOpen:c,routePattern:f,children:d.jsx(WS,{size:12})})]})]}),d.jsx(Eu,{isOpen:r,className:"pl-3",children:e.children.map((v,x)=>d.jsx(Q2,{node:v},x))})]})}function sq({node:e,onClose:t,routePatternWithParams:n}){const r=g.useMemo(()=>{var s;return e.type==="leaf"?e.fullPath:(s=e.page)==null?void 0:s.fullPath},[e]),o=g.useMemo(()=>e.sourcePath?Y.splitModuleFilePathAndModulePath(e.sourcePath)[0]:void 0,[e==null?void 0:e.sourcePath]),i=q2(o,r);return d.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[o&&e.sourcePath&&d.jsx(Y2,{path:e.sourcePath,parentPath:o,refs:i,size:"sm",variant:"ghost",onComplete:t,confirmationMessage:`This will delete the ${r} page.`,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(HS,{size:14}),d.jsx("span",{children:"Delete"})]})}),r!==void 0&&e.sourcePath&&o&&d.jsx(Z2,{variant:"ghost",size:"sm",existingKeys:i,path:e.sourcePath,defaultValue:r,routePattern:n,parentPath:o,onComplete:t,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(bK,{size:12}),d.jsx("span",{children:"Rename"})]})})]})}function aq(e){const t={"/":{name:"/",fullPath:"/",isDirectory:!0,children:[]}};for(const n of e){const r=n.split("/");if(r[0]!=="")throw new Error("Expected path to start with '/'");for(let o=1;o<r.length;o++){const i=r.slice(0,o).join("/"),s=[i,r[o]].join("/"),a=r[o];if(!a)throw new Error("Expected name to be non-empty");if(!t[s]){const l={name:a,fullPath:s,children:[]};o<r.length-1&&(l.isDirectory=!0),t[s]=l,t[i||"/"].children.push(t[s])}}}return t["/"]}function lq(){const e=Va();return g.useMemo(()=>{if(e.status==="success"){const t=[],n={};for(const r in e.data){const o=r,i=e.data[o];i.type==="record"&&i.router?(n[i.router]=n[i.router]||[],n[i.router].push(o)):t.push(o)}return{status:e.status,data:{root:aq(t),sitemap:n}}}return e},[e])}const eA=1280;function cq(){const e=qu(),[t,n]=g.useState(""),[r,o]=g.useState("");g.useEffect(()=>{async function w(){let S=!1;const C=async N=>{if(!S)try{(await fetch(N)).ok&&(S=!0,n(N))}catch{}};await C("/favicon.ico"),await C("/favicon.svg"),await C("/favicon.png"),await C("/apple-touch-icon.png"),await C("https://valbuild.com/favicon.ico")}if(w(),e!=null&&e.project)o(e.project);else try{let S=new URL(location.origin).hostname;if(S!=="localhost"){const C=S.split(".");C.length>=2&&(S=C.slice(1,-1).join(".")),o(Sf(S))}else o("Dev mode")}catch{o("Studio")}},[JSON.stringify(e)]);const i=Va(),s=In(),{theme:a,setTheme:l}=ly(),{navMenu:c}=Xy(),u=lq(),f=(e==null?void 0:e.appHost)||_b,[h,p]=r.split("/"),m=B7(),v=`${f}/manage-members/${h}`,b=`${`${f}/~/${h}`}/${p}`;return d.jsxs("nav",{className:"relative min-h-[100svh] bg-bg-primary",children:[d.jsxs("div",{className:"flex gap-4 justify-between items-center p-4 pr-6 h-16 border-b border-border-primary",children:[d.jsxs("div",{className:"flex gap-4 items-center",children:[t?d.jsx("img",{src:t,alt:"",className:"w-4 h-4"}):d.jsx("div",{className:"w-4 h-4"}),h&&p?d.jsx("a",{className:"truncate hover:underline",href:b,children:r}):d.jsx("span",{className:"truncate",children:r})]}),d.jsx("button",{className:"lg:hidden",onClick:()=>{c.setOpen(!c.isOpen)},children:d.jsx(Ig,{size:16,className:Ne("transform",{"rotate-180":!c.isOpen})})})]}),"data"in i&&d.jsx("div",{className:Ne("py-4 pl-2",{}),children:d.jsxs(hr,{children:[d.jsx("div",{className:"max-h-[calc(100svh-32px-64px-32px-16px)] max-w-[320px] px-2",children:"data"in u?d.jsxs(d.Fragment,{children:[d.jsx(dq,{title:"Site map",defaultOpen:!0,sitemap:u.data.sitemap}),d.jsx(uq,{title:"Explorer",defaultOpen:!0,node:u.data.root})]}):u.status==="loading"?d.jsx(fq,{}):null}),d.jsx(JS,{orientation:"horizontal"})]})}),d.jsx("div",{className:"p-4 h-6"}),d.jsx("div",{className:"absolute bottom-0 left-0 w-full",children:d.jsxs(br,{children:[d.jsxs(xo,{className:"flex items-center justify-between w-full p-4 border-t border-border-primary hover:bg-bg-secondary data-[state=open]:bg-bg-secondary",children:[d.jsx("span",{children:m&&d.jsx(WN,{size:"sm",profile:m})}),d.jsx(VS,{size:16})]}),d.jsx(tr,{className:"p-0 py-2",container:s,side:"top",children:d.jsxs("div",{className:"flex flex-col gap-2 justify-between items-center",children:[m&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex gap-2 items-center px-4 py-2 w-full",children:[d.jsx(WN,{size:"sm",profile:m}),d.jsxs("div",{className:"text-sm",children:[d.jsx("div",{className:"truncate",children:m.fullName}),m.email&&d.jsx("div",{className:"font-light truncate",children:m.email})]})]}),d.jsx("hr",{className:"mb-1 w-full h-1 border-t border-border-primary"})]}),d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[a==="dark"?d.jsx(vK,{size:"1rem"}):d.jsx(NK,{size:"1rem"}),d.jsx("button",{className:"",onClick:()=>{l(a==="dark"?"light":"dark")},children:a==="dark"?d.jsx("span",{className:"text-sm",children:"Dark mode"}):d.jsx("span",{className:"text-sm",children:"Light mode"})})]}),m&&d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[d.jsx(MK,{size:"1rem"}),d.jsx("a",{href:v,children:d.jsx("span",{className:"text-sm truncate",children:"Manage members"})})]}),m&&d.jsxs(d.Fragment,{children:[d.jsx("hr",{className:"mt-1 mb-1 w-full h-1 border-t border-border-primary"}),d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[d.jsx(mK,{size:"1rem"}),d.jsx("a",{href:vu("/api/val/logout",{redirect_to:`${window.location.origin}`}),children:d.jsx("span",{className:"text-sm",children:"Log out"})})]})]})]})})]})})]})}function uq({title:e,defaultOpen:t,node:n}){return!n||(n==null?void 0:n.children.length)===0?null:d.jsx(tA,{icon:d.jsx(Dg,{size:16}),title:e,defaultOpen:t,children:n.children.sort(nA).map((r,o)=>g.createElement(rA,{...r,name:r.name,key:o,root:!0}))})}function tA({title:e,children:t,defaultOpen:n,icon:r}){const[o,i]=g.useState(n??!0);return d.jsxs("div",{className:"py-2",children:[d.jsxs("button",{className:"flex justify-between items-center py-2 w-full text-sm tracking-tighter uppercase text-fg-secondary",onClick:()=>{i(!o)},children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[r,e]}),d.jsx(Zu,{size:16,className:Ne("transform",{"rotate-90":o})})]}),d.jsx(Eu,{isOpen:o,className:"pr-1",children:t})]})}function dq({title:e,defaultOpen:t,sitemap:n}){const r=n["next-app-router"];return r?d.jsx(tA,{title:e,defaultOpen:t,icon:d.jsx(Ag,{size:16}),children:d.jsx(iq,{moduleFilePaths:r})}):null}function fq(){return d.jsx("div",{className:"flex justify-start items-center w-full h-full",children:d.jsx(Gr,{size:16,className:"animate-spin"})})}function nA(e,t){return e.isDirectory&&!t.isDirectory?-1:!e.isDirectory&&t.isDirectory?1:e.name.localeCompare(t.name)}function rA({name:e,fullPath:t,isDirectory:n,children:r,root:o}){const{navigate:i,currentSourcePath:s}=xn(),{navMenu:a}=Xy(),[l,c]=g.useState(!0),u=ec()||{},f=g.useMemo(()=>{let x=!1;for(const b in u)if(b.startsWith(t)){x=!0;break}return x},[u,t]),h=g.useMemo(()=>{if(n){if(!l)return f}else if(!n)return f;return!1},[f,l,n]),p=t,m=Ft(p),v="data"in m?m.data.type:"loading";return d.jsxs("div",{className:"w-full text-sm",children:[d.jsxs("button",{className:Ne("relative flex items-center justify-between w-full ",{"py-2":o,"p-2":!o,underline:s.startsWith(p)&&!n,"font-bold":s.startsWith(p)&&n}),onClick:()=>{n?c(!l):(window.innerWidth<eA&&a.setOpen(!1),i(p))},children:[d.jsxs("div",{className:"flex items-center pr-2",children:[n?d.jsx(Zu,{size:16,className:Ne("transform mr-2",{"rotate-90":l,hidden:!r.length})}):d.jsx(hq,{type:v,size:14}),d.jsx("span",{children:Cu(e)})]}),h&&d.jsx("div",{className:"ml-2 w-2 h-2 rounded-full bg-bg-error-secondary"})]}),d.jsx("div",{className:"pl-2",children:d.jsx(Eu,{isOpen:l,children:r.sort(nA).map((x,b)=>g.createElement(rA,{...x,key:b}))})})]})}function hq({size:e,type:t}){if(t==="loading")return d.jsx(Gr,{size:e,className:"mr-2 animate-spin"});switch(t){case"string":return d.jsx(TK,{size:e,className:"mr-2"});case"number":return d.jsx(cK,{size:e,className:"mr-2"});case"boolean":return d.jsx(_K,{size:e,className:"mr-2"});case"object":return d.jsx(fK,{size:e,className:"mr-2"});case"literal":return d.jsx(eK,{size:e,className:"mr-2"});case"array":return d.jsx(u2,{size:e,className:"mr-2"});case"union":return d.jsx(wK,{size:e,className:"mr-2"});case"richtext":return d.jsx(a2,{size:e,className:"mr-2"});case"record":return d.jsx(PK,{size:e,className:"mr-2"});case"keyOf":return d.jsx(dK,{size:e,className:"mr-2"});case"file":return d.jsx(l2,{size:e,className:"mr-2"});case"date":return d.jsx(s2,{size:e,className:"mr-2"});case"image":return d.jsx(c2,{size:e,className:"mr-2"});default:return d.jsx(Z7,{size:e,className:"mr-2"})}}function QS(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ek="Checkbox",[pq,xge]=So(ek),[mq,gq]=pq(ek),oA=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,form:u,...f}=e,[h,p]=g.useState(null),m=Ve(t,C=>p(C)),v=g.useRef(!1),x=h?u||!!h.closest("form"):!0,[b=!1,w]=Kr({prop:o,defaultProp:i,onChange:c}),S=g.useRef(b);return g.useEffect(()=>{const C=h==null?void 0:h.form;if(C){const N=()=>w(S.current);return C.addEventListener("reset",N),()=>C.removeEventListener("reset",N)}},[h,w]),d.jsxs(mq,{scope:n,state:b,disabled:a,children:[d.jsx(Oe.button,{type:"button",role:"checkbox","aria-checked":fa(b)?"mixed":b,"aria-required":s,"data-state":aA(b),"data-disabled":a?"":void 0,disabled:a,value:l,...f,ref:m,onKeyDown:te(e.onKeyDown,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:te(e.onClick,C=>{w(N=>fa(N)?!0:!N),x&&(v.current=C.isPropagationStopped(),v.current||C.stopPropagation())})}),x&&d.jsx(vq,{control:h,bubbles:!v.current,name:r,value:l,checked:b,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"},defaultChecked:fa(i)?!1:i})]})});oA.displayName=ek;var iA="CheckboxIndicator",sA=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=gq(iA,n);return d.jsx(ln,{present:r||fa(i.state)||i.state===!0,children:d.jsx(Oe.span,{"data-state":aA(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});sA.displayName=iA;var vq=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i}=e,s=g.useRef(null),a=QS(n),l=PS(t);g.useEffect(()=>{const u=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==n&&p){const m=new Event("click",{bubbles:r});u.indeterminate=fa(n),p.call(u,fa(n)?!1:n),u.dispatchEvent(m)}},[a,n,r]);const c=g.useRef(fa(n)?!1:n);return d.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??c.current,...i,tabIndex:-1,ref:s,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function fa(e){return e==="indeterminate"}function aA(e){return fa(e)?"indeterminate":e?"checked":"unchecked"}var lA=oA,yq=sA;const ed=g.forwardRef(({className:e,...t},n)=>{const[r,o]=g.useState();return g.useEffect(()=>{o(t.checked)},[t.checked]),d.jsx(lA,{ref:n,checked:r,onCheckedChange:i=>{o(i),t.onCheckedChange&&t.onCheckedChange(i)},className:fe("peer h-4 w-4 shrink-0 rounded-sm bg-bg-primary border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 data-[state=checked]:bg-bg-primary data-[state=checked]:text-fg-primary",e),...t,children:d.jsxs(yq,{className:fe("flex items-center justify-center text-current"),children:[r===!0&&d.jsx(Ju,{size:12}),r==="indeterminate"&&d.jsx(gK,{size:12})]})})});ed.displayName=lA.displayName;function Tm(e,t){const n=new Date(t).getTime(),r=e.getTime(),o=Math.floor((r-n)/1e3),i=Math.floor(o/60),s=Math.floor(o/3600),a=Math.floor(o/86400),l=Math.floor(a/30);return o<60?"just now":i<60?`${i}m ago`:s<24?`${s}h ago`:a===1?"yesterday":a<30?`${a}d ago`:`${l}mo ago`}function cA({onPublish:e,onClose:t}){const[n,r]=g.useState(null),o=sp(),{summary:i,canGenerate:s,setSummary:a,publishDisabled:l,generateSummary:c}=ap(),[u,f]=g.useState(!1),h=()=>{f(!1),i.type!=="not-asked"&&a({...i})};g.useEffect(()=>{i.type!=="not-asked"&&!i.isGenerating&&!bu(i.patchIds,o)&&f(!0)},[i,o]);const p=g.useCallback(()=>{h(),c().then(x=>{x.type==="ai"?a({type:"ai",text:x.text.trim()}):r(x.message)})},[h,c,a,r]),m="w-full p-2 border rounded bg-bg-secondary",v="text"in i?i.text:"";return d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsxs("div",{className:"flex items-center justify-between w-full gap-2",children:[d.jsx("span",{className:"font-semibold",children:"Summary"}),s&&d.jsx(YN,{onClick:p,isGenerating:i.isGenerating})]}),n&&d.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-fg-error-primary",children:n}),d.jsxs("div",{className:"grid text-xs font-light",children:[d.jsx("div",{"aria-hidden":!0,className:fe(m,"invisible whitespace-pre-wrap"),style:{gridArea:"1 / 1 / 2 / 2"},children:v+" "}),d.jsx("textarea",{disabled:!!i.isGenerating,className:fe(m,"resize-none overflow-clip disabled:opacity-50"),value:v,style:{gridArea:"1 / 1 / 2 / 2"},placeholder:"Write a summary of your changes"+(s?" or generate one using AI":""),onChange:x=>{h(),a({type:"manual",text:x.currentTarget.value})}})]}),d.jsxs("div",{className:fe("p-2 text-xs flex-grow font-light bg-bg-warning-primary text-[black] rounded flex items-center","flex justify-between w-full gap-2 py-2",{hidden:!u}),"aria-hidden":u,children:[d.jsx("span",{children:"Summary might be outdated. "}),d.jsx("button",{className:"underline",onClick:h,children:"Dismiss"})]}),d.jsx("div",{className:"flex items-center justify-end gap-2",children:e?d.jsxs(d.Fragment,{children:[d.jsx(qe,{variant:"outline",onClick:()=>{t()},children:"Close"}),u&&s&&d.jsx(YN,{isGenerating:i.isGenerating,onClick:p}),!u&&d.jsxs(qe,{disabled:l||v.trim()==="",onClick:()=>{i.type!=="not-asked"&&e()},variant:"default",className:"flex items-center gap-2",children:[d.jsxs("span",{children:[" ",l?"Pushing...":"Publish"]}),d.jsx(Lg,{size:16})]})]}):d.jsx(d.Fragment,{children:d.jsx(qe,{variant:"outline",onClick:()=>{t()},children:"Close"})})})]})}function YN({isGenerating:e,onClick:t}){return d.jsx(qe,{className:"truncate",disabled:!!e,onClick:()=>{t()},variant:"outline",children:d.jsxs("span",{className:"flex items-center gap-2",children:[d.jsx("span",{children:e?"Generating...":"Generate"}),d.jsx(d2,{size:16})]})})}function xq(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:p,...m}=f,v=(h==null?void 0:h[e][l])||a,x=g.useMemo(()=>m,Object.values(m));return d.jsx(v.Provider,{value:x,children:p})}function u(f,h){const p=(h==null?void 0:h[e][l])||a,m=g.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,bq(o,...t)]}function bq(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function my(e){const t=e+"CollectionProvider",[n,r]=xq(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:m,children:v}=p,x=Ce.useRef(null),b=Ce.useRef(new Map).current;return d.jsx(o,{scope:m,itemMap:b,collectionRef:x,children:v})};s.displayName=t;const a=e+"CollectionSlot",l=Ce.forwardRef((p,m)=>{const{scope:v,children:x}=p,b=i(a,v),w=Ve(m,b.collectionRef);return d.jsx(cs,{ref:w,children:x})});l.displayName=a;const c=e+"CollectionItemSlot",u="data-radix-collection-item",f=Ce.forwardRef((p,m)=>{const{scope:v,children:x,...b}=p,w=Ce.useRef(null),S=Ve(m,w),C=i(c,v);return Ce.useEffect(()=>(C.itemMap.set(w,{ref:w,...b}),()=>void C.itemMap.delete(w))),d.jsx(cs,{[u]:"",ref:S,children:x})});f.displayName=c;function h(p){const m=i(e+"CollectionConsumer",p);return Ce.useCallback(()=>{const x=m.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${u}]`));return Array.from(m.itemMap.values()).sort((C,N)=>b.indexOf(C.ref.current)-b.indexOf(N.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},h,r]}var tk="Collapsible",[wq,uA]=So(tk),[Sq,nk]=wq(tk),dA=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:s,...a}=e,[l=!1,c]=Kr({prop:r,defaultProp:o,onChange:s});return d.jsx(Sq,{scope:n,disabled:i,contentId:Vr(),open:l,onOpenToggle:g.useCallback(()=>c(u=>!u),[c]),children:d.jsx(Oe.div,{"data-state":ok(l),"data-disabled":i?"":void 0,...a,ref:t})})});dA.displayName=tk;var fA="CollapsibleTrigger",hA=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=nk(fA,n);return d.jsx(Oe.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":ok(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:te(e.onClick,o.onOpenToggle)})});hA.displayName=fA;var rk="CollapsibleContent",pA=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=nk(rk,e.__scopeCollapsible);return d.jsx(ln,{present:n||o.open,children:({present:i})=>d.jsx(kq,{...r,ref:t,present:i})})});pA.displayName=rk;var kq=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,s=nk(rk,n),[a,l]=g.useState(r),c=g.useRef(null),u=Ve(t,c),f=g.useRef(0),h=f.current,p=g.useRef(0),m=p.current,v=s.open||a,x=g.useRef(v),b=g.useRef();return g.useEffect(()=>{const w=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(w)},[]),On(()=>{const w=c.current;if(w){b.current=b.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const S=w.getBoundingClientRect();f.current=S.height,p.current=S.width,x.current||(w.style.transitionDuration=b.current.transitionDuration,w.style.animationName=b.current.animationName),l(r)}},[s.open,r]),d.jsx(Oe.div,{"data-state":ok(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!v,...i,ref:u,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:v&&o})});function ok(e){return e?"open":"closed"}var Eq=dA,Cq=hA,Nq=pA,gs="Accordion",Pq=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ik,_q,jq]=my(gs),[gy,bge]=So(gs,[jq,uA]),sk=uA(),mA=Ce.forwardRef((e,t)=>{const{type:n,...r}=e,o=r,i=r;return d.jsx(ik.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?d.jsx(Rq,{...i,ref:t}):d.jsx(Mq,{...o,ref:t})})});mA.displayName=gs;var[gA,Tq]=gy(gs),[vA,Oq]=gy(gs,{collapsible:!1}),Mq=Ce.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:i=!1,...s}=e,[a,l]=Kr({prop:n,defaultProp:r,onChange:o});return d.jsx(gA,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:l,onItemClose:Ce.useCallback(()=>i&&l(""),[i,l]),children:d.jsx(vA,{scope:e.__scopeAccordion,collapsible:i,children:d.jsx(yA,{...s,ref:t})})})}),Rq=Ce.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[s=[],a]=Kr({prop:n,defaultProp:r,onChange:o}),l=Ce.useCallback(u=>a((f=[])=>[...f,u]),[a]),c=Ce.useCallback(u=>a((f=[])=>f.filter(h=>h!==u)),[a]);return d.jsx(gA,{scope:e.__scopeAccordion,value:s,onItemOpen:l,onItemClose:c,children:d.jsx(vA,{scope:e.__scopeAccordion,collapsible:!0,children:d.jsx(yA,{...i,ref:t})})})}),[Aq,vy]=gy(gs),yA=Ce.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:i="vertical",...s}=e,a=Ce.useRef(null),l=Ve(a,t),c=_q(n),f=lp(o)==="ltr",h=te(e.onKeyDown,p=>{var O;if(!Pq.includes(p.key))return;const m=p.target,v=c().filter(M=>{var D;return!((D=M.ref.current)!=null&&D.disabled)}),x=v.findIndex(M=>M.ref.current===m),b=v.length;if(x===-1)return;p.preventDefault();let w=x;const S=0,C=b-1,N=()=>{w=x+1,w>C&&(w=S)},P=()=>{w=x-1,w<S&&(w=C)};switch(p.key){case"Home":w=S;break;case"End":w=C;break;case"ArrowRight":i==="horizontal"&&(f?N():P());break;case"ArrowDown":i==="vertical"&&N();break;case"ArrowLeft":i==="horizontal"&&(f?P():N());break;case"ArrowUp":i==="vertical"&&P();break}const _=w%b;(O=v[_].ref.current)==null||O.focus()});return d.jsx(Aq,{scope:n,disabled:r,direction:o,orientation:i,children:d.jsx(ik.Slot,{scope:n,children:d.jsx(Oe.div,{...s,"data-orientation":i,ref:l,onKeyDown:r?void 0:h})})})}),Bg="AccordionItem",[Iq,ak]=gy(Bg),lk=Ce.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...o}=e,i=vy(Bg,n),s=Tq(Bg,n),a=sk(n),l=Vr(),c=r&&s.value.includes(r)||!1,u=i.disabled||e.disabled;return d.jsx(Iq,{scope:n,open:c,disabled:u,triggerId:l,children:d.jsx(Eq,{"data-orientation":i.orientation,"data-state":SA(c),...a,...o,ref:t,disabled:u,open:c,onOpenChange:f=>{f?s.onItemOpen(r):s.onItemClose(r)}})})});lk.displayName=Bg;var xA="AccordionHeader",bA=Ce.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=vy(gs,n),i=ak(xA,n);return d.jsx(Oe.h3,{"data-orientation":o.orientation,"data-state":SA(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});bA.displayName=xA;var Xb="AccordionTrigger",ck=Ce.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=vy(gs,n),i=ak(Xb,n),s=Oq(Xb,n),a=sk(n);return d.jsx(ik.ItemSlot,{scope:n,children:d.jsx(Cq,{"aria-disabled":i.open&&!s.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId,...a,...r,ref:t})})});ck.displayName=Xb;var wA="AccordionContent",uk=Ce.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=vy(gs,n),i=ak(wA,n),s=sk(n);return d.jsx(Nq,{role:"region","aria-labelledby":i.triggerId,"data-orientation":o.orientation,...s,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});uk.displayName=wA;function SA(e){return e?"open":"closed"}var kA=mA,Dq=lk,Lq=bA,EA=ck,CA=uk;const Ll=kA,ja=g.forwardRef(({className:e,...t},n)=>d.jsx(Dq,{ref:n,className:fe("border-b",e),...t}));ja.displayName="AccordionItem";const Fl=g.forwardRef(({className:e,children:t,...n},r)=>d.jsx(Lq,{className:"flex",children:d.jsxs(EA,{ref:r,className:fe("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,d.jsx(Xu,{className:"w-4 h-4 transition-transform duration-200 shrink-0"})]})}));Fl.displayName=EA.displayName;const Ta=g.forwardRef(({className:e,children:t,...n},r)=>d.jsx(CA,{ref:r,className:fe("overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...n,children:d.jsx("div",{className:"pt-0 pb-4",children:t})}));Ta.displayName=CA.displayName;function NA(e,t,n){if(e.length===0)return{success:!1,error:"Empty path"};let r=-1,o="";const i=c=>{o===""?o=c:o+="."+c};if(t===void 0)return{success:!1,error:`Undefined schema in: '${e.join("/")}'.`};if(n===void 0)return{success:!1,error:`Undefined source in: '${e.join("/")}'.`};let s=t,a=n;const l=[{modulePath:o,schema:s,source:a}];for(const c of e){if(r++,c==="")return{success:!1,error:`Empty path part in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(s.type==="array"){s=s.item;const u=Number(c);if(!Number.isSafeInteger(u))return{success:!1,error:`Invalid array index in: '${e.join("/")}'. Expected an integer but got '${c}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(typeof a!="object")return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got '${typeof a}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(a===null)return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got 'null' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(a===void 0)return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got 'undefined' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(!Array.isArray(a))return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an array but got '${typeof a}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(!a[u])return{success:!1,error:`Invalid array index in: '${e.join("/")}'. Expected an index less than ${a.length} but got '${u}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};a=a[u],i(c)}else if(s.type==="record"){s=s.item;const u=im(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else if(s.type==="object"){s=s.items[c];const u=im(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else if(s.type==="union"){const u=typeof s.key=="object"&&s.key.type==="literal"?s:void 0,f=typeof s.key=="string"?s:void 0;if(u)return{success:!1,error:"Invalid lookup in string union"};if(f){const h=im(e,c,r,a,"union object");if(!h.success)return{success:!1,error:h.error};const p=h.source;let m;for(const v of f.items){const x=v.items[f.key];if(x.type==="literal"){if(p[f.key]===x.value){m=v;break}}else return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`}}if(!m)return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};s=m.items[c],a=p[c],i(JSON.stringify(c))}else return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`}}else if(s.type==="image"||s.type==="file"){const u=im(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else return{success:!1,error:`Cannot construct sub-path in schema of '${s.type}' in: '${e.join("/")}'. Path was: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")}`};l.push({modulePath:o,schema:s,source:a})}return{success:!0,modulePath:o,schema:s,source:a,allResolved:l}}function im(e,t,n,r,o){return typeof r!="object"?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got '${typeof r}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:r===null?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'null' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:r===void 0?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'undefined' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:typeof r!="object"?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got '${typeof r}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:Array.isArray(r)?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'array' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:t in r?{success:!0,source:r}:{success:!1,error:`Could not find key of source: '${e.join("/")}'. Expected a key in ${Object.keys(r).join(", ")} but got '${t}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}}function Fq(e,t){return(t==null?void 0:t.type)==="array"?e.type!=="string":(t==null?void 0:t.type)==="record"}function PA(e,t,n){if(!n)return null;const[r,o]=Y.splitModuleFilePathAndModulePath(e);if(!o)return r;const i=t[r],s=n[r];if(i===void 0||!s)return null;const a=NA(Y.splitModulePath(o),s,i);if(a.success){for(let l=a.allResolved.length-1;l>=0;l--){const c=a.allResolved[l],u=a.allResolved[l-1];if(Fq(c.schema,(u==null?void 0:u.schema)||null))return c.modulePath===""?r:Y.joinModuleFilePathAndModulePath(r,c.modulePath)}return r}else console.error(`Error resolving path: ${a.error} for path: ${e}`);return null}function fp({moduleFilePath:e,patchPath:t,className:n,toolTip:r=!0,link:o=!0}){const i=qu(),s=g.useRef(null),a=g.useRef(new Map),[l,c]=g.useState([]),[u,f]=g.useState(),h=$S(),p=Va(),{navigate:m}=xn();g.useEffect(()=>{const x=e?Y.splitModuleFilePath(e):[],b=t,w=()=>{if(!s.current)return;const C=s.current,N=getComputedStyle(C),P=`${N.fontSize} ${N.fontFamily}`,_=C.offsetWidth,O=x.map(zq).concat(b).map(H=>`/${H}`);f(O.join(""));const M=H=>{const V=`${H}:${P}`,I=a.current.get(V)??$q(H,P);return a.current.set(V,I),I},D="/…",U=M(D),z=[];let K=0;for(let H=O.length-1;H>=0;H--){const V=M(O[H]),A=!(H===0);if(K+V+(A?U:0)<=_){const j=H>x.length?"module-path":"module-file-path";z.unshift({text:O[H],type:j,moduleFilePath:e,modulePathSegments:b.slice(0,H)}),K+=V}else{z.unshift({type:"ellipsis",text:D});break}}c(z)},S=new ResizeObserver(w);return s.current&&(S.observe(s.current),w()),()=>{s.current&&S.unobserve(s.current)}},[e,t]);const v=g.useMemo(()=>{if(!o)return null;const x="data"in p?p.data:{};if(t.length===0){const w=e;return{navPath:w,sourcePath:w}}const b=NA(t,x[e],h[e]);if(b.success){const w=Y.joinModuleFilePathAndModulePath(e,b.modulePath),S=PA(w,h,x);if(S)return{navPath:S,scrollToId:w};console.debug(`Failed to resolve nav path for ${e} and ${t.join(".")}: ${S}`)}else console.debug(`Failed to resolve source path for ${e} and ${t.join(".")}: ${b.error}`);return null},[e,t,h,p]);return d.jsxs(zr,{open:r===!1?!1:void 0,children:[d.jsx(MS,{asChild:!0,children:d.jsx("a",{href:v&&i?`${i.studioPrefix}${v.navPath}#${v.scrollToId}`:void 0,ref:s,className:Ne("inline-block whitespace-nowrap overflow-hidden w-full align-baseline",{"cursor-pointer hover:underline":o},n),onClick:x=>{o&&v&&x.metaKey===!1&&x.ctrlKey===!1&&x.shiftKey===!1&&(x.preventDefault(),m(v.navPath,{scrollToId:v.scrollToId}))},children:l.map((x,b)=>d.jsx("span",{children:x.text},b))})}),d.jsx(fr,{side:"top",children:d.jsx(hr,{orientation:"horizontal",className:"max-w-[calc(100vw-3rem)] whitespace-nowrap",children:u})})]})}function zq(e){const t=Cu(e);return t.slice(0,1).toUpperCase()+t.slice(1)}function $q(e,t){const r=document.createElement("canvas").getContext("2d");return r?(r.font=t,r.measureText(e).width):0}function _A({className:e,loadingStatus:t}){const n=sp(),r=Yu(),o=D7(),i=I7(),s=In(),[a,l]=g.useState(!1),{canGenerate:c}=ap(),u=ec(),{autoPublish:f}=LS(),h=g.useMemo(()=>{var D;let M=0;for(const U in u)M+=((D=u[U])==null?void 0:D.length)||0;return M},[u]),p=n.length-o.size,{deployments:m,dismissDeployment:v,observedCommitShas:x}=A7(),{globalTransientErrors:b,removeGlobalTransientErrors:w}=V7(),{patchErrors:S}=QR(),[C,N]=g.useState(new Date);g.useEffect(()=>{const M=setInterval(()=>{N(new Date)},6e4);return()=>{clearInterval(M)}},[]);const{deletePatches:P}=qR(),_=T7(),O=async(M,D,U)=>{const z=await _("/patches","GET",{query:{patch_id:[D],exclude_patch_ops:!1}});if(z.status===200){const K=z.json,H=`val-patch-error-report-${M.replace("/","__").replace(/\.val\./,"-")}-${D}.json`,V=new Blob([JSON.stringify({moduleFilePath:M,patchId:D,error:U,patch:K},null,2)],{type:"application/json"}),I=document.createElement("a");I.href=URL.createObjectURL(V),I.download=H,I.click()}else alert("Failed to download report")};return d.jsxs("div",{className:Ne("text-sm",e),children:[S&&Object.values(S).some(M=>M!==null)&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[d.jsxs("div",{className:"px-4 text-pretty",children:[d.jsx("div",{children:"Unfortunately, one or more changes have errors."}),d.jsx("div",{children:"No changes can currently be applied."})]}),Object.entries(S).map(([M,D],U)=>d.jsx("div",{className:"pb-4",children:d.jsx(hr,{orientation:"horizontal",className:"max-w-[280px] text-pretty text-xs",children:D&&Object.entries(D).map(([z,K],H)=>d.jsx(kA,{className:"grid grid-cols-2 gap-2",type:"single",collapsible:!0,children:d.jsxs(lk,{value:z,children:[d.jsx("div",{children:d.jsx(qe,{variant:"destructive",onClick:()=>{P([z])},children:d.jsx("span",{className:"flex gap-2 justify-between items-center text-left",children:d.jsx("span",{children:"Remove change and fix issue"})})})}),d.jsx(ck,{asChild:!0,className:"group",children:d.jsxs(qe,{variant:"destructive",children:[d.jsx("span",{className:"text-left truncate group-data-[state=open]:hidden",children:"Report"}),d.jsx("span",{className:"text-left truncate group-data-[state=open]:block hidden",children:"Hide"})]})}),d.jsxs(uk,{children:[d.jsx(qe,{variant:"destructive",onClick:()=>{O(M,z,K.message)},children:d.jsxs("span",{className:"flex gap-2 justify-between items-center text-left",children:[d.jsx("span",{children:"Download debug report"}),d.jsx(rK,{size:14})]})}),d.jsxs("div",{className:"p-4",children:[d.jsx("div",{className:"font-bold",children:"Details"}),d.jsx("div",{children:"Module file path"}),d.jsx("div",{children:d.jsx(JN,{sourcePath:M})}),d.jsx("div",{children:"Error message"}),d.jsx("pre",{children:K.message})]})]})]})},H))})},M+"#"+U))]})}),u&&h>0&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsx(hr,{orientation:"horizontal",children:d.jsx(Ll,{type:"single",className:"px-4 font-serif",collapsible:!0,children:d.jsxs(ja,{value:"error",className:"border-b-0",children:[d.jsx(Fl,{className:" data-[state=open]:mb-4 text-fg-error-primary border-fg-error-primary ",children:d.jsxs("div",{className:"flex justify-between items-center w-full",children:[d.jsxs("div",{children:[h," validation issue",h>1?"s":""]}),d.jsx(ku,{size:16})]})}),d.jsx(Ta,{className:"",children:d.jsx("div",{className:"flex flex-col gap-4",children:Object.entries(u).map(([M,D],U)=>d.jsxs("div",{className:"pb-4",children:[d.jsx("div",{className:"items-start text-left",children:d.jsx(JN,{sourcePath:M})}),d.jsx("div",{children:d.jsx(hr,{orientation:"horizontal",className:"max-w-[280px] text-pretty text-xs",children:D==null?void 0:D.map((z,K)=>d.jsx("div",{className:"",children:d.jsx("div",{children:z.message})},K))})})]},M+"#"+U))})})]})})})}),b&&b.length>0&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsx(hr,{orientation:"horizontal",children:d.jsx(Ll,{type:"single",className:"px-4 font-serif",collapsible:!0,children:d.jsxs(ja,{value:"error",className:"border-b-0 data-[state=open]:mb-4",children:[d.jsxs(Fl,{children:[b.length," transient error",b.length>1?"s":""]}),d.jsx(Ta,{className:"w-full",children:d.jsx("div",{className:"flex flex-col gap-2",children:b.map(M=>d.jsxs("div",{className:"flex gap-2 justify-between items-start",children:[d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("div",{className:"font-bold",children:M.message}),M.details&&d.jsx("div",{children:M.details}),d.jsx("div",{className:"text-[10px] font-thin",children:Tm(C,new Date(M.timestamp).toISOString())})]}),d.jsx("button",{onClick:()=>w([M.id]),children:d.jsx(Al,{size:14})})]},M.id))})})]})})})}),m.length>0&&d.jsx("div",{className:"p-4 border-b border-border-primary",children:d.jsx(Bq,{deployments:m,observedCommitShas:x,onDismiss:v})}),r==="http"&&d.jsx("div",{className:"flex justify-end items-center p-4 border-b z-5 border-border-primary",children:d.jsxs(br,{open:a,onOpenChange:M=>{l(M)},children:[d.jsx(xo,{asChild:!0,children:d.jsxs(qe,{variant:"secondary",className:"flex gap-2 items-center text-sm",children:[d.jsx("span",{children:"Summary"}),c&&d.jsx(d2,{size:14})]})}),d.jsxs(tr,{container:s,align:"end",className:"z-[9001] flex flex-col gap-4",children:[d.jsx(Il,{asChild:!0,className:"self-end cursor-pointer",children:d.jsx(Al,{size:12})}),d.jsx(cA,{onClose:()=>{l(!1)}})]})]})}),d.jsx("div",{className:"p-4 z-5",children:d.jsxs("div",{className:"flex justify-between items-center",children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsxs("div",{className:"font-bold",children:[p<=0?"No ":`${p} `,"pending change",p===1?"":"s"]}),(t==="loading"||t==="not-asked")&&d.jsx("div",{className:"",children:d.jsx(Gr,{size:16,className:"animate-spin"})})]}),d.jsxs(br,{children:[d.jsx(xo,{asChild:!0,children:d.jsxs(qe,{disabled:n.length===0,variant:"secondary",className:"flex gap-2 items-center text-sm",children:[d.jsx("span",{children:"Undo all"}),d.jsx(Gb,{size:14})]})}),d.jsx(tr,{container:s,className:"z-[9001]",children:d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsx("div",{children:"This will undo all changes to the current state."}),d.jsx("div",{children:d.jsx(Il,{asChild:!0,children:d.jsxs(qe,{variant:"destructive",className:"flex gap-2 items-center text-sm",onClick:()=>{P(n)},children:[d.jsx("span",{children:"Undo all changes"}),d.jsx(Gb,{size:14})]})})})]})})]})]})}),(!f||h>0)&&d.jsx("div",{className:"flex flex-col gap-[2px]",children:"data"in i&&n.length>0&&i.data.map(M=>d.jsx(Hq,{committedPatchIds:o,patchSet:M,patchErrors:(S==null?void 0:S[M.moduleFilePath])??{}},M.moduleFilePath+":"+M.patchPath.join("/")))})]})}function JN({sourcePath:e}){const[t,n]=Y.splitModuleFilePathAndModulePath(e),r=Y.splitModulePath(n);return d.jsx(fp,{moduleFilePath:t,patchPath:r})}function Bq({deployments:e,observedCommitShas:t,onDismiss:n}){return g.useEffect(()=>{for(const r of e)t.has(r.commitSha)&&setTimeout(()=>{n(r.commitSha)},5e3)},[e,t]),d.jsxs("div",{children:[d.jsxs("div",{className:"flex justify-between items-center p-2 font-bold",children:[d.jsx("span",{children:"Deployments"}),d.jsx(Gr,{size:16,className:"inline animate-spin"})]}),d.jsx("div",{children:e.reverse().map(r=>d.jsx(Vq,{deployment:r,isFinished:t.has(r.commitSha),onDismiss:()=>{n(r.commitSha)}},r.commitSha))})]})}function Vq({deployment:e,isFinished:t,onDismiss:n}){var s;const r=zS(),o=In(),i=e.creator&&r[e.creator];return d.jsxs("div",{className:"flex justify-between items-start p-2",children:[d.jsxs("div",{className:"flex gap-2 items-start",children:[i&&d.jsx("img",{src:(s=i.avatar)==null?void 0:s.url,alt:i.fullName,className:"w-8 h-8 rounded-full"}),d.jsxs(zr,{children:[d.jsx(AR,{container:o}),d.jsx(ho,{children:d.jsx("div",{className:"max-w-[180px] overflow-clip font-light truncate",children:e.commitMessage})}),d.jsx(fr,{className:"max-w-[320px]",children:d.jsx("pre",{className:"font-sans font-light whitespace-break-spaces",children:e.commitMessage})})]})]}),t&&d.jsxs("div",{className:"flex gap-2 items-start",children:[d.jsx("span",{className:"text-xs font-light text-fg-quaternary",children:"Deployed"}),d.jsx("button",{onClick:()=>{n()},children:d.jsx(Ju,{size:14})})]}),!t&&d.jsx(Uq,{since:new Date(e.createdAt)})]})}function Uq({since:e}){const[t,n]=g.useState("00"),[r,o]=g.useState("00");return g.useEffect(()=>{let i;const s=()=>{const a=Date.now(),l=Math.floor((a-e.getTime())/1e3),c=Math.floor(l/60),u=l%60;let f;c>4?(f=(60-u)*1e3,n(c.toString()),o(null)):(f=1e3,n(c.toString().padStart(2,"0")),o(u.toString().padStart(2,"0"))),i=setTimeout(s,f)};return s(),()=>{clearTimeout(i)}},[e]),d.jsxs("div",{className:"text-xs font-light text-fg-quaternary",children:[t,r!==null?`:${r}`:" mins"]})}function Wq({moduleFilePath:e,patchMetadata:t,committedPatchIds:n}){var u;const r=jA([t.opType],t.createdAt,n.has(t.patchId)),o=zS(),{skippedPatches:i}=FS(),s=void 0,[a]=g.useMemo(()=>[!!i[t.patchId]],[t.patchId,i[t.patchId]]),l=Yu();let c=[];if(t.author){const f=o[t.author];if(f){const h=((u=f==null?void 0:f.avatar)==null?void 0:u.url)??null;c=[{fullName:f.fullName,url:h}]}else console.warn("Did not find profile for author: ",t.author,{profilesById:o})}return c.length===0&&l==="http"&&console.warn("No authors",{patchMetadata:t}),d.jsx(Zb,{moduleFilePath:e,patchPath:t.patchPath,changeDescription:a?"Skipped":r,authors:c,errors:s,skipped:a,isApplied:n.has(t.patchId)})}function jA(e,t,n){const[r,o]=g.useState(new Date);if(g.useEffect(()=>{const a=setInterval(()=>{o(new Date)},6e4);return()=>{clearInterval(a)}},[]),n)return"Pushed "+Tm(r,t);if(e.length>1)return"Updated "+Tm(r,t);const i=e[0];let s=i;return i==="add"?s="Added":i==="remove"?s="Removed":i==="replace"?s="Replaced":i==="move"?s="Moved":i==="copy"?s="Copied":i==="test"?s="Tested":i==="file"?s="Updated":console.warn("Unexpected op type: ",i),s+" "+Tm(r,t)}function Hq({patchSet:e,committedPatchIds:t,patchErrors:n}){const[r,o]=g.useState(!1),i=g.useRef(null),[s,a]=g.useState(!1);g.useEffect(()=>{const v=new IntersectionObserver(x=>{x[0].isIntersecting&&a(!0)},{threshold:0});return i.current&&v.observe(i.current),()=>{v.disconnect()}},[]);const{skippedPatches:l}=FS(),{deletePatches:c}=qR(),u=g.useMemo(()=>e.patches.map(v=>v.patchId),[e.patches.map(v=>v.patchId).join(",")]),f=g.useMemo(()=>{const v=[];for(const x of u){const b=n==null?void 0:n[x];!l[x]&&b&&v.unshift(b.message)}return v},[u,n,l]),h=jA(e.opTypes,e.lastUpdated,!1),p=zS(),m=e.patches.every(v=>t.has(v.patchId));return s?d.jsxs(d.Fragment,{children:[d.jsx(Zb,{moduleFilePath:e.moduleFilePath,patchPath:e.patchPath,isApplied:m,authors:e.authors.reduce((v,x)=>v.includes(x)?v:v.concat(x),[]).flatMap(v=>{var b;const x=p[v];if(x){const w=((b=x==null?void 0:x.avatar)==null?void 0:b.url)??null;return[{fullName:x.fullName,url:w}]}return[]}),changeDescription:h,isOpen:r,setOpen:o,errors:f,onDelete:()=>{c(u.filter(v=>!t.has(v)))},amount:new Set(u).size}),d.jsx(Eu,{isOpen:r,children:e.patches.map((v,x)=>d.jsx(Wq,{committedPatchIds:t,moduleFilePath:e.moduleFilePath,patchMetadata:v},e.moduleFilePath+":"+e.patchPath.join("/")+v.patchId+x))})]}):d.jsx(Zb,{ref:i,isApplied:m})}const Zb=g.forwardRef(({moduleFilePath:e,patchPath:t,changeDescription:n,authors:r,isOpen:o,setOpen:i,isSelected:s,setSelected:a,errors:l,skipped:c,onDelete:u,amount:f,isApplied:h},p)=>{const m=In();return d.jsxs("div",{ref:p,className:Ne("p-6",{"bg-bg-secondary":!o,"bg-bg-tertiary":o,"opacity-50":h}),children:[d.jsxs("div",{className:"relative",children:[d.jsx("span",{className:"inline-block w-[calc(320px-24px-8px-16px-24px-48px)] truncate mr-2 ",children:e&&t&&d.jsx(fp,{moduleFilePath:e,patchPath:t,link:!0,toolTip:!0})}),s===void 0&&d.jsx("span",{className:Ne("inline-block w-6 h-6 rounded",{"bg-bg-disabled animate-pulse":t===void 0})}),s!==void 0&&!h&&d.jsx(ed,{checked:s,onCheckedChange:v=>{a&&a(v)}}),d.jsxs("div",{className:"inline relative ml-5",children:[f&&d.jsxs(zr,{children:[d.jsx(ho,{children:d.jsx("span",{className:"absolute -right-5 -top-6 w-6 h-6 text-xs leading-6 text-center rounded-full bg-bg-primary text-fg-primary",children:f>9?"9+":f})}),d.jsx(fr,{side:"left",children:d.jsxs("p",{children:[f," change",f>1?"s":""," in this patch set"]})})]}),u&&!h&&f&&f>0&&d.jsxs(br,{children:[d.jsx(xo,{children:d.jsx(Gb,{size:16,className:"inline"})}),d.jsxs(tr,{container:m,className:"flex flex-col gap-2 z-[9001]",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsxs("div",{children:["This will undo ",f," change",f>1?"s":"","."]}),d.jsx("div",{children:d.jsx(Il,{asChild:!0,children:d.jsxs(qe,{variant:"destructive",onClick:u,children:["Undo change",f>1?"s":""]})})})]})]})]})]}),l&&l.length>0&&!c&&d.jsxs("div",{className:"p-2 max-w-[240px] bg-bg-error-primary text-fg-primary rounded-lg",children:[l.slice(0,1).map((v,x)=>d.jsx("div",{title:v,className:"truncate",children:"Invalid change"},x)),l.length>1&&d.jsxs("div",{className:"truncate",children:["+",l.length-1," more"]})]}),(!l||l.length===0)&&c&&d.jsx("div",{className:"p-2 max-w-[240px] bg-bg-error-primary text-fg-primary",children:d.jsx("div",{className:"truncate",children:"Skipped"})}),d.jsxs("div",{className:"flex justify-between items-center pt-2",children:[d.jsxs("span",{className:"flex flex-shrink-0 gap-2",children:[r!==void 0&&r.length>0&&d.jsxs("span",{className:"flex gap-1 mr-2",children:[r.slice(0,2).map((v,x)=>{if(v.url)return d.jsxs(zr,{children:[d.jsx(ho,{className:"flex-shrink-0 w-6 h-6",children:d.jsx("img",{src:v.url,alt:v.fullName,className:Ne("rounded-full",{"-ml-3":r.length>2&&x>0})})}),d.jsx(fr,{children:d.jsx("div",{children:v.fullName})})]},v.url);const b=Kq(v.fullName);return d.jsxs(zr,{children:[d.jsx(ho,{className:Ne({"-ml-3":r.length>2&&x>0}),children:d.jsx("span",{className:Ne("flex items-center justify-center w-6 h-6 text-xs font-semibold rounded-full bg-bg-primary text-fg-primary"),"aria-label":"Initials for: "+v.fullName,children:b})}),d.jsx(fr,{children:d.jsx("div",{children:v.fullName})})]},v.fullName+v.url)}),r.length>2&&d.jsxs(zr,{children:[d.jsx(ho,{className:Ne({"-ml-3":r.length>2}),children:d.jsxs("span",{className:"flex justify-center items-center -ml-3 w-6 h-6 text-xs font-semibold rounded-full bg-bg-primary text-fg-primary",children:["+",r.length-2]})}),d.jsx(fr,{className:"grid grid-cols-[auto,1fr] gap-2",children:r.slice(2).map(v=>d.jsxs(g.Fragment,{children:[v.url?d.jsx("img",{src:v.url,alt:v.fullName,title:v.fullName,className:Ne("w-6 h-6 rounded-full")},v.url):d.jsx("div",{}),d.jsx("div",{children:v.fullName})]},v.fullName+v.url))})]})]}),r===void 0&&d.jsx("span",{className:Ne("inline-block w-6 h-6 mr-2",{"bg-bg-disabled animate-pulse rounded-3xl":r===void 0})}),n&&d.jsx("span",{className:Ne({"text-fg-disabled":c}),children:n})]}),o!==void 0&&d.jsx("button",{className:"inline-block flex-shrink-0",onClick:()=>{i&&i(!o)},children:d.jsx(Xu,{size:16,className:Ne("transform",{"rotate-180":o})})})]})]})});function Kq(e){return!e||typeof e!="string"?"":e.trim().normalize("NFC").split(/\s+/).filter(r=>r.length>0).map(r=>/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u.test(r)?r[0]:r[0].toLocaleUpperCase()).join("")}function Qb(){const[e,t]=g.useState(!1),{publish:n,publishDisabled:r,isPublishing:o,summary:i}=ap(),s=ec(),a=s!==void 0&&Object.keys(s).length>0,l=YR(),c=JR(),u=Yu(),f=In(),{autoPublish:h}=LS();return a?d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{className:"flex gap-2 items-center",disabled:!0,children:u==="fs"?"Save":d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Ready"}),d.jsx(Lg,{size:16})]})})}),d.jsx(fr,{children:d.jsx("div",{className:"flex flex-col gap-2",children:d.jsx("p",{children:"Fix validation errors to continue"})})})]}):u==="fs"?d.jsxs(qe,{className:"flex gap-2 items-center",disabled:r||a||h||l.length===0||c.length>0,title:a?"Please fix validation errors":"",onClick:()=>{n("No summary provided")},children:[a?d.jsx("span",{children:"Save"}):d.jsx("span",{children:o?"Saving":"Save"}),o&&d.jsx(Gr,{className:"animate-spin",size:16})]}):d.jsx("span",{children:d.jsxs(br,{open:e,onOpenChange:p=>{t(p)},children:[d.jsx(xo,{asChild:!0,children:d.jsxs(qe,{className:"flex gap-2 items-center",disabled:r||a||l.length===0||c.length>0,onClick:()=>{t(!0)},children:[!o&&d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Ready"}),d.jsx(Lg,{size:16})]}),o&&d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Pushing"}),d.jsx(Gr,{className:"animate-spin",size:16})]})]})}),d.jsxs(tr,{container:f,align:"end",className:"z-[9001] flex flex-col gap-4",children:[d.jsx(Il,{asChild:!0,className:"self-end cursor-pointer",children:d.jsx(Al,{size:12})}),d.jsx(cA,{onClose:()=>{t(!1)},onPublish:()=>{if(t(!1),i.type==="not-asked")return;const p=i.text.trim();n(p)}})]})]})})}function Gq(){const e=cy(),{isPublishing:t}=ap(),n=ec()||{},{globalErrors:r}=FS(),o=Yu(),[i,s]=g.useMemo(()=>{const a=new Set;let l=0;for(const c in n){const[u]=Y.splitModuleFilePathAndModulePath(c);a.add(u),l+=1}return[Array.from(a).sort(),l]},[n]);return d.jsxs("div",{className:"min-h-[100svh] bg-bg-primary",style:{"--menu-width":"320px"},children:[d.jsx("div",{className:"h-16 border-b border-border-primary",children:d.jsx(Jq,{})}),t&&d.jsxs("div",{className:"flex gap-2 justify-end items-center p-4 text-right border-t bg-bg-tertiary text-fg-primary border-border-primary",children:[d.jsx("span",{children:"Publishing changes "}),d.jsx(Gr,{size:16,className:"animate-spin"})]}),d.jsx(hr,{children:d.jsxs("div",{className:"max-h-[calc(100svh-64px)]",children:[r&&r.length>0&&r.length!==s&&d.jsx(Ll,{type:"single",collapsible:!0,children:d.jsxs(ja,{value:"global-errors",children:[d.jsxs(Fl,{className:"p-4 font-normal text-left rounded data-[state=open]:rounded-b-none bg-bg-error-primary text-fg-error-primary",children:["Cannot ",o==="fs"?"save":"publish"," now. Found"," ",r==null?void 0:r.length," errors in all."," ",r.length-s," were non-validation errors. A developer might need to fix these issues."]}),d.jsx(Ta,{children:d.jsx(hr,{children:d.jsx("div",{className:"max-h-[calc(100svh-128px)] max-w-[var(--menu-width)]",children:r==null?void 0:r.map((a,l)=>d.jsx(Yq,{error:a},l))})})})]})}),(r==null?void 0:r.length)===s&&i.length>0&&d.jsx(Ll,{type:"single",collapsible:!0,children:d.jsxs(ja,{value:"global-errors",children:[d.jsx(Fl,{className:"p-4 font-normal text-left rounded data-[state=open]:rounded-b-none bg-bg-error-primary text-fg-error-primary",children:d.jsxs("div",{children:[d.jsxs("div",{children:["Cannot ",o==="fs"?"save":"publish"," now."]}),d.jsx("div",{children:"Found errors in modules"})]})}),d.jsx(Ta,{children:d.jsx(hr,{children:d.jsx("div",{className:"max-h-[calc(100svh-64px)] max-w-[var(--menu-width)]",children:i==null?void 0:i.map((a,l)=>d.jsx(qq,{moduleFilePath:a},l))})})})]})}),e!=="not-asked"&&d.jsx("div",{className:Ne("",{}),children:d.jsx(hr,{children:d.jsx("div",{className:"max-h-[calc(100svh-64px)] border-b border-border-primary",children:d.jsx(_A,{loadingStatus:e})})})})]})})]})}function qq({moduleFilePath:e}){const t=Y.splitModuleFilePath(e),n=xn();return d.jsx("div",{className:"px-4 py-2 border-b bg-bg-error-primary text-fg-error-primary border-border-error-primary",children:d.jsx("button",{className:"underline cursor-pointer",onClick:()=>{n.navigate(e)},children:t.map((r,o)=>d.jsxs(g.Fragment,{children:[d.jsx("span",{className:fe("text-fg-brand-secondary",{"ml-1":o>0}),children:"/"}),d.jsx("span",{children:Cu(r)})]},o))})})}function Yq({error:e}){const[t,n]=g.useState(!1);return d.jsx("div",{className:fe("px-1 py-2 bg-bg-error-primary text-fg-error-primary border-b border-border-error-primary",{truncate:!t,"whitespace-normal":t}),onClick:()=>n(!t),children:e})}function Jq(){const{currentSourcePath:e}=xn(),t=Va(),[n,r]=Y.splitModuleFilePathAndModulePath(e),o=lt(n,"record"),i=g.useMemo(()=>{if(t.status!=="success")return t;if(o.status!=="success")return o;const f=t.data[n];if(f.type==="record"&&f.router){if(o.data===null)return{status:"success",data:null};const h=Object.keys(o.data),p=Y.splitModulePath(r)[0];for(const m of h)if(p&&p.startsWith(m))return{status:"success",data:{previewRoute:m}}}return{status:"success",data:null}},["data"in t&&t.data,n,r,o]),{navMenu:s,toolsMenu:a}=Xy(),l=Yu(),{setAutoPublish:c,autoPublish:u}=LS();return d.jsx("div",{className:"flex flex-col",children:d.jsxs("div",{className:"flex gap-2 justify-between items-center p-4 w-full",children:[d.jsx("button",{className:"lg:hidden",onClick:()=>{a.setOpen(!a.isOpen)},children:d.jsx(Ig,{size:16,className:Ne("transform",{"rotate-180":!s.isOpen})})}),d.jsxs("div",{className:"flex gap-2 justify-end items-center w-full",children:[l==="fs"&&d.jsxs("div",{className:"overflow-hidden flex items-center gap-2 text-[10px] lg:text-xs",children:[d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx("span",{className:"truncate text-fg-secondary",children:"Auto-save"})}),d.jsxs(fr,{children:[d.jsx("p",{children:"When auto-save is enabled Val will save to changes to disk automatically"}),d.jsx("p",{children:"This is a development mode feature"})]})]}),d.jsx(ed,{checked:u,onCheckedChange:c})]}),d.jsx(Xq,{maybePreviewRoute:i}),d.jsx(Qb,{})]})]})})}function Xq({maybePreviewRoute:e}){var n,r;const t=g.useMemo(()=>{var o;return e.status==="success"&&((o=e.data)!=null&&o.previewRoute)?vu("/api/val/enable",{redirect_to:window.origin+e.data.previewRoute}):vu("/api/val/enable",{redirect_to:window.origin})},[e]);return d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{className:"flex gap-2 items-center",variant:"secondary",asChild:!0,children:d.jsxs("a",{href:t,children:[d.jsx("span",{children:"Preview"}),e.status==="success"&&((n=e.data)!=null&&n.previewRoute)?d.jsx(Ag,{size:16}):d.jsx(Dg,{size:16})]})})}),d.jsx(fr,{children:e.status==="success"&&((r=e.data)!=null&&r.previewRoute)?d.jsxs("p",{children:["Preview your changes in ",e.data.previewRoute]}):d.jsx("p",{children:"Preview your changes on the main page"})})]})}function Xt({error:e,path:t}){return d.jsx("div",{id:t,children:d.jsx("div",{className:"p-4 bg-bg-error-primary text-fg-error-primary",children:e})})}function yt({path:e,type:t}){return d.jsx("div",{id:e,className:Ne("pt-6",{"w-full flex items-center justify-center":t==="module","text-left":t!=="module"}),children:d.jsx(Gr,{size:t==="module"?24:16,className:"animate-spin"})})}function Mn({path:e,type:t}){const[n,r]=g.useState(!1);return g.useEffect(()=>{const o=setTimeout(()=>{r(!0)},2e3);return()=>{clearTimeout(o)}},[]),e.length===0?null:n?d.jsx("div",{className:"pt-6",id:e,children:d.jsx("div",{children:"Could not get data"})}):d.jsx(yt,{path:e,type:t})}function kr({actualType:e,expectedType:t,path:n}){return d.jsx("div",{id:n,children:d.jsxs("div",{children:["Schema mismatch: actual: ",e," vs expected: ",t," "]})})}function it({error:e,path:t,schema:n}){const{addPatch:r,patchPath:o}=bn(t);return d.jsxs("div",{id:t,className:"flex justify-between items-center px-2 py-3 rounded-lg bg-bg-error-primary text-fg-primary",children:[d.jsxs("div",{children:["Source error: ",e]}),d.jsxs("div",{className:"flex gap-2 items-center",children:[n&&n.status==="success"&&!(n.data.type==="file"||n.data.type==="image")&&d.jsx(qe,{variant:"outline",className:"hover:bg-bg-error-secondary-hover",onClick:()=>{r([{op:"replace",path:o,value:Dl(n.data)}],n.data.type)},children:"Fix"}),d.jsx(ku,{size:16})]})]})}function Zq(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const yy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function td(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function dk(e){return"nodeType"in e}function Er(e){var t,n;return e?td(e)?e:dk(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function fk(e){const{Document:t}=Er(e);return e instanceof t}function hp(e){return td(e)?!1:e instanceof Er(e).HTMLElement}function TA(e){return e instanceof Er(e).SVGElement}function nd(e){return e?td(e)?e.document:dk(e)?fk(e)?e:hp(e)||TA(e)?e.ownerDocument:document:document:document}const Ei=yy?g.useLayoutEffect:g.useEffect;function hk(e){const t=g.useRef(e);return Ei(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Qq(){const e=g.useRef(null),t=g.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function vh(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return Ei(()=>{n.current!==e&&(n.current=e)},t),n}function pp(e,t){const n=g.useRef();return g.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Vg(e){const t=hk(e),n=g.useRef(null),r=g.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function ew(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let o0={};function mp(e,t){return g.useMemo(()=>{if(t)return t;const n=o0[e]==null?0:o0[e]+1;return o0[e]=n,e+"-"+n},[e,t])}function OA(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[l,c]of a){const u=i[l];u!=null&&(i[l]=u+e*c)}return i},{...t})}}const Zc=OA(1),yh=OA(-1);function eY(e){return"clientX"in e&&"clientY"in e}function pk(e){if(!e)return!1;const{KeyboardEvent:t}=Er(e.target);return t&&e instanceof t}function tY(e){if(!e)return!1;const{TouchEvent:t}=Er(e.target);return t&&e instanceof t}function tw(e){if(tY(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return eY(e)?{x:e.clientX,y:e.clientY}:null}const xh=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[xh.Translate.toString(e),xh.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),XN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function nY(e){return e.matches(XN)?e:e.querySelector(XN)}const rY={display:"none"};function oY(e){let{id:t,value:n}=e;return Ce.createElement("div",{id:t,style:rY},n)}function iY(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Ce.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function sY(){const[e,t]=g.useState("");return{announce:g.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const MA=g.createContext(null);function aY(e){const t=g.useContext(MA);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function lY(){const[e]=g.useState(()=>new Set),t=g.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[g.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const cY={draggable:`
461
461
  To pick up a draggable item, press the space bar.
462
462
  While dragging, use the arrow keys to move the item.
463
463
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -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-FAI3Nx0f.js"></script>
7
+ <script type="module" crossorigin src="/api/val/static/assets/index-B7fBTnLq.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/api/val/static/assets/index-1ofWrCU9.css">
9
9
  </head>
10
10
  <body>