@epic-web/workshop-app 4.9.1 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/client/assets/_layout-CGxjCoIB.js +2 -0
- package/build/client/assets/_layout-CGxjCoIB.js.map +1 -0
- package/build/client/assets/{manifest-ccbb66ff.js → manifest-902d83c3.js} +1 -1
- package/build/server/index.js +136 -30
- package/build/server/index.js.map +1 -1
- package/package.json +3 -3
- package/build/client/assets/_layout-gFXglAOy.js +0 -2
- package/build/client/assets/_layout-gFXglAOy.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epic-web/workshop-app",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"@epic-web/invariant": "^1.0.0",
|
|
45
45
|
"@epic-web/remember": "^1.0.2",
|
|
46
46
|
"@epic-web/restore-scroll": "^1.1.1",
|
|
47
|
-
"@epic-web/workshop-presence": "4.
|
|
48
|
-
"@epic-web/workshop-utils": "4.
|
|
47
|
+
"@epic-web/workshop-presence": "4.10.0",
|
|
48
|
+
"@epic-web/workshop-utils": "4.10.0",
|
|
49
49
|
"@mdx-js/mdx": "^3.0.1",
|
|
50
50
|
"@mux/mux-player-react": "^2.6.0",
|
|
51
51
|
"@paralleldrive/cuid2": "^2.2.2",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as x,j as e,n as pe,k as xe,d as Rt}from"./index-Czg1ruVn.js";import{E as kt}from"./index-D6ukHE4T.js";import{c as Pe,u as $e,f as Ce,n as Ot,P as J,a as V,g as Te,b as De,S as G,T as It,h as fe,i as he,j as me,l as Ve,A as ze,d as Mt,D as _t,C as Ft,m as At,R as Lt}from"./tooltip-CfmIzAYi.js";import{c as Ut,u as Ge,R as Ht,T as Yt,V as Bt,I as Vt,P as zt,C as Gt,S as Kt,a as Wt,G as qt,L as Zt,b as Jt,d as Qt,e as Xt,f as er,g as tr,A as rr,D as nr}from"./diff-P5f7-8E4.js";import{c as re}from"./clsx-B-dksMZM.js";import{G as sr}from"./error-boundary-DxfVshQ5.js";import{N as ar}from"./nav-chevrons-BYKwyIgG.js";import{M as or,L as ce,E as ir}from"./mdx-CR7Me1v_.js";import{P as lr}from"./progress-B_mReZVE.js";import{I as O,u as Ee,a as Re,c as be,b as ke}from"./misc-CypjEQkt.js";import{s as Oe}from"./progress-bar-DCrt7X4t.js";import{a as K,u as W,A as Ke,L as ae,c as Ie,F as cr}from"./components-BMzmvxYw.js";import{g as ur}from"./seo-pBpFCWsy.js";import{L as We}from"./loading-CNWJVymJ.js";import{u as dr}from"./client-hints-BE5mB4r0.js";import{D as fr,u as hr}from"./discord-COPE8EOZ.js";import{J as mr}from"./index-Doi37489.js";import{z as h,u as Me}from"./request-info-CUT0ULYN.js";import{B as qe}from"./button-CyZl24U2.js";import{E as pr}from"./epic-video-CYnG2ziQ.js";import{u as xr}from"./use-event-source-ySol3hbz.js";import{h as gr,R as vr,u as jr,F as br,P as wr}from"./index-4E9_Sx3m.js";import"./user-C4QTtQw5.js";import"./index-90bzTYUX.js";var je="rovingFocusGroup.onEntryFocus",yr={bubbles:!1,cancelable:!0},ge="RovingFocusGroup",[we,Ze,Nr]=Ut(ge),[Sr,Je]=Pe(ge,[Nr]),[Pr,$r]=Sr(ge),Qe=x.forwardRef((t,s)=>e.jsx(we.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(we.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(Cr,{...t,ref:s})})}));Qe.displayName=ge;var Cr=x.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:m,preventScrollOnEntryFocus:u=!1,...p}=t,g=x.useRef(null),y=$e(s,g),S=Ge(o),[d=null,$]=Ce({prop:i,defaultProp:c,onChange:l}),[T,j]=x.useState(!1),E=Ot(m),L=Ze(n),R=x.useRef(!1),[F,U]=x.useState(0);return x.useEffect(()=>{const k=g.current;if(k)return k.addEventListener(je,E),()=>k.removeEventListener(je,E)},[E]),e.jsx(Pr,{scope:n,orientation:r,dir:S,loop:a,currentTabStopId:d,onItemFocus:x.useCallback(k=>$(k),[$]),onItemShiftTab:x.useCallback(()=>j(!0),[]),onFocusableItemAdd:x.useCallback(()=>U(k=>k+1),[]),onFocusableItemRemove:x.useCallback(()=>U(k=>k-1),[]),children:e.jsx(J.div,{tabIndex:T||F===0?-1:0,"data-orientation":r,...p,ref:y,style:{outline:"none",...t.style},onMouseDown:V(t.onMouseDown,()=>{R.current=!0}),onFocus:V(t.onFocus,k=>{const Y=!R.current;if(k.target===k.currentTarget&&Y&&!T){const M=new CustomEvent(je,yr);if(k.currentTarget.dispatchEvent(M),!M.defaultPrevented){const D=L().filter(f=>f.focusable),q=D.find(f=>f.active),X=D.find(f=>f.id===d),v=[q,X,...D].filter(Boolean).map(f=>f.ref.current);tt(v,u)}}R.current=!1}),onBlur:V(t.onBlur,()=>j(!1))})})}),Xe="RovingFocusGroupItem",et=x.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:o,...i}=t,c=Te(),l=o||c,m=$r(Xe,n),u=m.currentTabStopId===l,p=Ze(n),{onFocusableItemAdd:g,onFocusableItemRemove:y}=m;return x.useEffect(()=>{if(r)return g(),()=>y()},[r,g,y]),e.jsx(we.ItemSlot,{scope:n,id:l,focusable:r,active:a,children:e.jsx(J.span,{tabIndex:u?0:-1,"data-orientation":m.orientation,...i,ref:s,onMouseDown:V(t.onMouseDown,S=>{r?m.onItemFocus(l):S.preventDefault()}),onFocus:V(t.onFocus,()=>m.onItemFocus(l)),onKeyDown:V(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){m.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const d=Er(S,m.orientation,m.dir);if(d!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let T=p().filter(j=>j.focusable).map(j=>j.ref.current);if(d==="last")T.reverse();else if(d==="prev"||d==="next"){d==="prev"&&T.reverse();const j=T.indexOf(S.currentTarget);T=m.loop?Rr(T,j+1):T.slice(j+1)}setTimeout(()=>tt(T))}})})})});et.displayName=Xe;var Tr={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Dr(t,s){return s!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Er(t,s,n){const r=Dr(t.key,n);if(!(s==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(s==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Tr[r]}function tt(t,s=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:s}),document.activeElement!==n))return}function Rr(t,s){return t.map((n,r)=>t[(s+r)%t.length])}var kr=Qe,Or=et,_e="Tabs",[Ir,vs]=Pe(_e,[Je]),rt=Je(),[Mr,Fe]=Ir(_e),nt=x.forwardRef((t,s)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:o,orientation:i="horizontal",dir:c,activationMode:l="automatic",...m}=t,u=Ge(c),[p,g]=Ce({prop:r,onChange:a,defaultProp:o});return e.jsx(Mr,{scope:n,baseId:Te(),value:p,onValueChange:g,orientation:i,dir:u,activationMode:l,children:e.jsx(J.div,{dir:u,"data-orientation":i,...m,ref:s})})});nt.displayName=_e;var st="TabsList",at=x.forwardRef((t,s)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,o=Fe(st,n),i=rt(n);return e.jsx(kr,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:r,children:e.jsx(J.div,{role:"tablist","aria-orientation":o.orientation,...a,ref:s})})});at.displayName=st;var ot="TabsTrigger",it=x.forwardRef((t,s)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...o}=t,i=Fe(ot,n),c=rt(n),l=ut(i.baseId,r),m=dt(i.baseId,r),u=r===i.value;return e.jsx(Or,{asChild:!0,...c,focusable:!a,active:u,children:e.jsx(J.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":m,"data-state":u?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:l,...o,ref:s,onMouseDown:V(t.onMouseDown,p=>{!a&&p.button===0&&p.ctrlKey===!1?i.onValueChange(r):p.preventDefault()}),onKeyDown:V(t.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&i.onValueChange(r)}),onFocus:V(t.onFocus,()=>{const p=i.activationMode!=="manual";!u&&!a&&p&&i.onValueChange(r)})})})});it.displayName=ot;var lt="TabsContent",ct=x.forwardRef((t,s)=>{const{__scopeTabs:n,value:r,forceMount:a,children:o,...i}=t,c=Fe(lt,n),l=ut(c.baseId,r),m=dt(c.baseId,r),u=r===c.value,p=x.useRef(u);return x.useEffect(()=>{const g=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(g)},[]),e.jsx(De,{present:a||u,children:({present:g})=>e.jsx(J.div,{"data-state":u?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!g,id:m,tabIndex:0,...i,ref:s,style:{...t.style,animationDuration:p.current?"0s":void 0},children:g&&o})})});ct.displayName=lt;function ut(t,s){return`${t}-trigger-${s}`}function dt(t,s){return`${t}-content-${s}`}var _r=nt,Fr=at,Ar=it,se=ct;function ye({appName:t,reset:s=!1,tooltipText:n,...r}){var i;const a=K(),o=e.jsx("button",{type:"submit",...r,className:re(r.className,a.state!=="idle"?"cursor-progress":null,((i=a.data)==null?void 0:i.status)==="error"?"cursor-not-allowed":null)});return e.jsxs(a.Form,{action:"/set-playground",method:"POST",className:"inline-flex items-center justify-center",children:[e.jsx("input",{type:"hidden",name:"appName",value:t}),s?e.jsx("input",{type:"hidden",name:"reset",value:"true"}):null,Oe,n?e.jsx(G,{content:n,children:o}):o]})}function Lr({playgroundAppName:t,allApps:s}){var r;const n=K();return e.jsxs(Ht,{name:"appName",value:t,onValueChange:a=>{n.submit({appName:a},{method:"POST",action:"/set-playground"})},children:[e.jsxs(Yt,{"aria-label":"Select app for playground",className:re("flex h-full w-full items-center justify-between text-left radix-placeholder:text-gray-500 focus-visible:outline-none",n.state!=="idle"?"cursor-progress":null,((r=n.data)==null?void 0:r.status)==="error"?"cursor-not-allowed":null),children:[e.jsx("span",{className:"w-80 flex-1 overflow-hidden text-ellipsis whitespace-nowrap scrollbar-thin scrollbar-thumb-scrollbar",children:e.jsx(Bt,{placeholder:"Select current app",className:"inline-block w-40 text-ellipsis"})}),e.jsx(Vt,{children:e.jsx(O,{name:"TriangleDownSmall"})})]}),e.jsx(zt,{children:e.jsxs(Gt,{position:"popper",align:"start",className:"z-20 max-h-[50vh] bg-black text-white lg:max-h-[70vh]",children:[e.jsx(Kt,{className:"flex h-5 cursor-default items-center justify-center ",children:e.jsx(O,{name:"ChevronUp"})}),e.jsx(Wt,{className:"p-3",children:e.jsxs(qt,{children:[e.jsx(Zt,{className:"px-5 pb-3 font-mono uppercase",children:"App"}),s.filter(a=>a.name!=="playground").map(a=>e.jsx(Ur,{value:a.name,children:a.displayName},a.name))]})}),e.jsx(Jt,{className:"flex h-5 cursor-default items-center justify-center ",children:e.jsx(O,{name:"ChevronDown"})})]})})]})}function Ur({value:t,children:s}){return e.jsxs(Qt,{value:t,className:"relative flex cursor-pointer select-none items-center rounded px-10 py-2 leading-none opacity-80 radix-disabled:text-red-500 radix-highlighted:opacity-100 radix-highlighted:outline-none radix-state-checked:opacity-100",children:[e.jsx(Xt,{children:s}),e.jsx(er,{className:"absolute left-0 inline-flex w-[25px] items-center justify-center",children:e.jsx(O,{name:"CheckSmall"})})]})}function Ae({appName:t}){return ENV.EPICSHOP_DEPLOYED?null:e.jsx(ye,{appName:t,tooltipText:"Playground is not set to the right app. Click to set Playground.",children:e.jsxs("span",{className:"flex items-center justify-center gap-1 text-foreground-danger hover:underline",children:[e.jsx(O,{name:"Unlinked",className:"animate-ping"})," ",e.jsx("span",{className:"uppercase",children:"Set to Playground"})]})})}var ft={exports:{}};(function(t,s){(function(n,r){t.exports=r()})(xe,function(){var n=1e3,r=6e4,a=36e5,o="millisecond",i="second",c="minute",l="hour",m="day",u="week",p="month",g="quarter",y="year",S="date",d="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,T=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,j={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var v=["th","st","nd","rd"],f=N%100;return"["+N+(v[(f-20)%10]||v[f]||v[0])+"]"}},E=function(N,v,f){var P=String(N);return!P||P.length>=v?N:""+Array(v+1-P.length).join(f)+N},L={s:E,z:function(N){var v=-N.utcOffset(),f=Math.abs(v),P=Math.floor(f/60),b=f%60;return(v<=0?"+":"-")+E(P,2,"0")+":"+E(b,2,"0")},m:function N(v,f){if(v.date()<f.date())return-N(f,v);var P=12*(f.year()-v.year())+(f.month()-v.month()),b=v.clone().add(P,p),C=f-b<0,w=v.clone().add(P+(C?-1:1),p);return+(-(P+(f-b)/(C?b-w:w-b))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:p,y,w:u,d:m,D:S,h:l,m:c,s:i,ms:o,Q:g}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},R="en",F={};F[R]=j;var U="$isDayjsObject",k=function(N){return N instanceof q||!(!N||!N[U])},Y=function N(v,f,P){var b;if(!v)return R;if(typeof v=="string"){var C=v.toLowerCase();F[C]&&(b=C),f&&(F[C]=f,b=C);var w=v.split("-");if(!b&&w.length>1)return N(w[0])}else{var I=v.name;F[I]=v,b=I}return!P&&b&&(R=b),b||!P&&R},M=function(N,v){if(k(N))return N.clone();var f=typeof v=="object"?v:{};return f.date=N,f.args=arguments,new q(f)},D=L;D.l=Y,D.i=k,D.w=function(N,v){return M(N,{locale:v.$L,utc:v.$u,x:v.$x,$offset:v.$offset})};var q=function(){function N(f){this.$L=Y(f.locale,null,!0),this.parse(f),this.$x=this.$x||f.x||{},this[U]=!0}var v=N.prototype;return v.parse=function(f){this.$d=function(P){var b=P.date,C=P.utc;if(b===null)return new Date(NaN);if(D.u(b))return new Date;if(b instanceof Date)return new Date(b);if(typeof b=="string"&&!/Z$/i.test(b)){var w=b.match($);if(w){var I=w[2]-1||0,A=(w[7]||"0").substring(0,3);return C?new Date(Date.UTC(w[1],I,w[3]||1,w[4]||0,w[5]||0,w[6]||0,A)):new Date(w[1],I,w[3]||1,w[4]||0,w[5]||0,w[6]||0,A)}}return new Date(b)}(f),this.init()},v.init=function(){var f=this.$d;this.$y=f.getFullYear(),this.$M=f.getMonth(),this.$D=f.getDate(),this.$W=f.getDay(),this.$H=f.getHours(),this.$m=f.getMinutes(),this.$s=f.getSeconds(),this.$ms=f.getMilliseconds()},v.$utils=function(){return D},v.isValid=function(){return this.$d.toString()!==d},v.isSame=function(f,P){var b=M(f);return this.startOf(P)<=b&&b<=this.endOf(P)},v.isAfter=function(f,P){return M(f)<this.startOf(P)},v.isBefore=function(f,P){return this.endOf(P)<M(f)},v.$g=function(f,P,b){return D.u(f)?this[P]:this.set(b,f)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(f,P){var b=this,C=!!D.u(P)||P,w=D.p(f),I=function(te,B){var Z=D.w(b.$u?Date.UTC(b.$y,B,te):new Date(b.$y,B,te),b);return C?Z:Z.endOf(m)},A=function(te,B){return D.w(b.toDate()[te].apply(b.toDate("s"),(C?[0,0,0,0]:[23,59,59,999]).slice(B)),b)},_=this.$W,H=this.$M,z=this.$D,ne="set"+(this.$u?"UTC":"");switch(w){case y:return C?I(1,0):I(31,11);case p:return C?I(1,H):I(0,H+1);case u:var ee=this.$locale().weekStart||0,ie=(_<ee?_+7:_)-ee;return I(C?z-ie:z+(6-ie),H);case m:case S:return A(ne+"Hours",0);case l:return A(ne+"Minutes",1);case c:return A(ne+"Seconds",2);case i:return A(ne+"Milliseconds",3);default:return this.clone()}},v.endOf=function(f){return this.startOf(f,!1)},v.$set=function(f,P){var b,C=D.p(f),w="set"+(this.$u?"UTC":""),I=(b={},b[m]=w+"Date",b[S]=w+"Date",b[p]=w+"Month",b[y]=w+"FullYear",b[l]=w+"Hours",b[c]=w+"Minutes",b[i]=w+"Seconds",b[o]=w+"Milliseconds",b)[C],A=C===m?this.$D+(P-this.$W):P;if(C===p||C===y){var _=this.clone().set(S,1);_.$d[I](A),_.init(),this.$d=_.set(S,Math.min(this.$D,_.daysInMonth())).$d}else I&&this.$d[I](A);return this.init(),this},v.set=function(f,P){return this.clone().$set(f,P)},v.get=function(f){return this[D.p(f)]()},v.add=function(f,P){var b,C=this;f=Number(f);var w=D.p(P),I=function(H){var z=M(C);return D.w(z.date(z.date()+Math.round(H*f)),C)};if(w===p)return this.set(p,this.$M+f);if(w===y)return this.set(y,this.$y+f);if(w===m)return I(1);if(w===u)return I(7);var A=(b={},b[c]=r,b[l]=a,b[i]=n,b)[w]||1,_=this.$d.getTime()+f*A;return D.w(_,this)},v.subtract=function(f,P){return this.add(-1*f,P)},v.format=function(f){var P=this,b=this.$locale();if(!this.isValid())return b.invalidDate||d;var C=f||"YYYY-MM-DDTHH:mm:ssZ",w=D.z(this),I=this.$H,A=this.$m,_=this.$M,H=b.weekdays,z=b.months,ne=b.meridiem,ee=function(B,Z,le,de){return B&&(B[Z]||B(P,C))||le[Z].slice(0,de)},ie=function(B){return D.s(I%12||12,B,"0")},te=ne||function(B,Z,le){var de=B<12?"AM":"PM";return le?de.toLowerCase():de};return C.replace(T,function(B,Z){return Z||function(le){switch(le){case"YY":return String(P.$y).slice(-2);case"YYYY":return D.s(P.$y,4,"0");case"M":return _+1;case"MM":return D.s(_+1,2,"0");case"MMM":return ee(b.monthsShort,_,z,3);case"MMMM":return ee(z,_);case"D":return P.$D;case"DD":return D.s(P.$D,2,"0");case"d":return String(P.$W);case"dd":return ee(b.weekdaysMin,P.$W,H,2);case"ddd":return ee(b.weekdaysShort,P.$W,H,3);case"dddd":return H[P.$W];case"H":return String(I);case"HH":return D.s(I,2,"0");case"h":return ie(1);case"hh":return ie(2);case"a":return te(I,A,!0);case"A":return te(I,A,!1);case"m":return String(A);case"mm":return D.s(A,2,"0");case"s":return String(P.$s);case"ss":return D.s(P.$s,2,"0");case"SSS":return D.s(P.$ms,3,"0");case"Z":return w}return null}(B)||w.replace(":","")})},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(f,P,b){var C,w=this,I=D.p(P),A=M(f),_=(A.utcOffset()-this.utcOffset())*r,H=this-A,z=function(){return D.m(w,A)};switch(I){case y:C=z()/12;break;case p:C=z();break;case g:C=z()/3;break;case u:C=(H-_)/6048e5;break;case m:C=(H-_)/864e5;break;case l:C=H/a;break;case c:C=H/r;break;case i:C=H/n;break;default:C=H}return b?C:D.a(C)},v.daysInMonth=function(){return this.endOf(p).$D},v.$locale=function(){return F[this.$L]},v.locale=function(f,P){if(!f)return this.$L;var b=this.clone(),C=Y(f,P,!0);return C&&(b.$L=C),b},v.clone=function(){return D.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},N}(),X=q.prototype;return M.prototype=X,[["$ms",o],["$s",i],["$m",c],["$H",l],["$W",m],["$M",p],["$y",y],["$D",S]].forEach(function(N){X[N[1]]=function(v){return this.$g(v,N[0],N[1])}}),M.extend=function(N,v){return N.$i||(N(v,q,M),N.$i=!0),M},M.locale=Y,M.isDayjs=k,M.unix=function(N){return M(1e3*N)},M.en=F[R],M.Ls=F,M.p={},M})})(ft);var Hr=ft.exports;const ve=pe(Hr);var ht={exports:{}};(function(t,s){(function(n,r){t.exports=r()})(xe,function(){return function(n,r,a){n=n||{};var o=r.prototype,i={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function c(m,u,p,g){return o.fromToBase(m,u,p,g)}a.en.relativeTime=i,o.fromToBase=function(m,u,p,g,y){for(var S,d,$,T=p.$locale().relativeTime||i,j=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],E=j.length,L=0;L<E;L+=1){var R=j[L];R.d&&(S=g?a(m).diff(p,R.d,!0):p.diff(m,R.d,!0));var F=(n.rounding||Math.round)(Math.abs(S));if($=S>0,F<=R.r||!R.r){F<=1&&L>0&&(R=j[L-1]);var U=T[R.l];y&&(F=y(""+F)),d=typeof U=="string"?U.replace("%d",F):U(F,u,R.l,$);break}}if(u)return d;var k=$?T.future:T.past;return typeof k=="function"?k(d):k.replace("%s",d)},o.to=function(m,u){return c(m,u,this,!0)},o.from=function(m,u){return c(m,u,this)};var l=function(m){return m.$u?a.utc():a()};o.toNow=function(m){return this.to(l(this),m)},o.fromNow=function(m){return this.from(l(this),m)}}})})(ht);var Yr=ht.exports;const Br=pe(Yr);var mt={exports:{}};(function(t,s){(function(n,r){t.exports=r()})(xe,function(){var n={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(a,o,i){var c,l=function(g,y,S){S===void 0&&(S={});var d=new Date(g),$=function(T,j){j===void 0&&(j={});var E=j.timeZoneName||"short",L=T+"|"+E,R=r[L];return R||(R=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:T,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:E}),r[L]=R),R}(y,S);return $.formatToParts(d)},m=function(g,y){for(var S=l(g,y),d=[],$=0;$<S.length;$+=1){var T=S[$],j=T.type,E=T.value,L=n[j];L>=0&&(d[L]=parseInt(E,10))}var R=d[3],F=R===24?0:R,U=d[0]+"-"+d[1]+"-"+d[2]+" "+F+":"+d[4]+":"+d[5]+":000",k=+g;return(i.utc(U).valueOf()-(k-=k%1e3))/6e4},u=o.prototype;u.tz=function(g,y){g===void 0&&(g=c);var S=this.utcOffset(),d=this.toDate(),$=d.toLocaleString("en-US",{timeZone:g}),T=Math.round((d-new Date($))/1e3/60),j=i($,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(15*-Math.round(d.getTimezoneOffset()/15)-T,!0);if(y){var E=j.utcOffset();j=j.add(S-E,"minute")}return j.$x.$timezone=g,j},u.offsetName=function(g){var y=this.$x.$timezone||i.tz.guess(),S=l(this.valueOf(),y,{timeZoneName:g}).find(function(d){return d.type.toLowerCase()==="timezonename"});return S&&S.value};var p=u.startOf;u.startOf=function(g,y){if(!this.$x||!this.$x.$timezone)return p.call(this,g,y);var S=i(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return p.call(S,g,y).tz(this.$x.$timezone,!0)},i.tz=function(g,y,S){var d=S&&y,$=S||y||c,T=m(+i(),$);if(typeof g!="string")return i(g).tz($);var j=function(F,U,k){var Y=F-60*U*1e3,M=m(Y,k);if(U===M)return[Y,U];var D=m(Y-=60*(M-U)*1e3,k);return M===D?[Y,M]:[F-60*Math.min(M,D)*1e3,Math.max(M,D)]}(i.utc(g,d).valueOf(),T,$),E=j[0],L=j[1],R=i(E).utcOffset(L);return R.$x.$timezone=$,R},i.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},i.tz.setDefault=function(g){c=g}}})})(mt);var Vr=mt.exports;const zr=pe(Vr);var pt={exports:{}};(function(t,s){(function(n,r){t.exports=r()})(xe,function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,a=/([+-]|\d\d)/g;return function(o,i,c){var l=i.prototype;c.utc=function(d){var $={date:d,utc:!0,args:arguments};return new i($)},l.utc=function(d){var $=c(this.toDate(),{locale:this.$L,utc:!0});return d?$.add(this.utcOffset(),n):$},l.local=function(){return c(this.toDate(),{locale:this.$L,utc:!1})};var m=l.parse;l.parse=function(d){d.utc&&(this.$u=!0),this.$utils().u(d.$offset)||(this.$offset=d.$offset),m.call(this,d)};var u=l.init;l.init=function(){if(this.$u){var d=this.$d;this.$y=d.getUTCFullYear(),this.$M=d.getUTCMonth(),this.$D=d.getUTCDate(),this.$W=d.getUTCDay(),this.$H=d.getUTCHours(),this.$m=d.getUTCMinutes(),this.$s=d.getUTCSeconds(),this.$ms=d.getUTCMilliseconds()}else u.call(this)};var p=l.utcOffset;l.utcOffset=function(d,$){var T=this.$utils().u;if(T(d))return this.$u?0:T(this.$offset)?p.call(this):this.$offset;if(typeof d=="string"&&(d=function(R){R===void 0&&(R="");var F=R.match(r);if(!F)return null;var U=(""+F[0]).match(a)||["-",0,0],k=U[0],Y=60*+U[1]+ +U[2];return Y===0?0:k==="+"?Y:-Y}(d),d===null))return this;var j=Math.abs(d)<=16?60*d:d,E=this;if($)return E.$offset=j,E.$u=d===0,E;if(d!==0){var L=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(E=this.local().add(j+L,n)).$offset=j,E.$x.$localOffset=L}else E=this.utc();return E};var g=l.format;l.format=function(d){var $=d||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,$)},l.valueOf=function(){var d=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*d},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var y=l.toDate;l.toDate=function(d){return d==="s"&&this.$offset?c(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():y.call(this)};var S=l.diff;l.diff=function(d,$,T){if(d&&this.$u===d.$u)return S.call(this,d,$,T);var j=this.local(),E=c(d).local();return S.call(j,E,$,T)}}})})(pt);var Gr=pt.exports;const Kr=pe(Gr);ve.extend(Kr);ve.extend(zr);ve.extend(Br);function Wr(){const t=W();return e.jsxs("div",{className:"flex h-full w-full flex-col gap-4 pt-4",children:[e.jsx("div",{className:"text-center",children:e.jsx(fr,{discordAuthUrl:t.discordAuthUrl})}),e.jsx("div",{className:"flex-1 overflow-y-scroll bg-accent pb-4 scrollbar-thin scrollbar-thumb-scrollbar",children:e.jsx(qr,{})})]})}function qr(){const t=W(),s=hr({discordAuthUrl:t.discordAuthUrl}),n=Ee();return e.jsxs("div",{className:"flex h-full flex-col items-center justify-between",children:[e.jsx(x.Suspense,{fallback:e.jsx("div",{className:"flex h-full w-full flex-col items-center justify-center",children:e.jsx(We,{children:"Loading Discord Posts"})}),children:e.jsx(Ke,{resolve:t.discordPostsPromise,errorElement:e.jsx("div",{className:"text-red-500",children:"There was a problem loading the discord posts"}),children:r=>e.jsx("ul",{className:"flex w-full flex-col gap-4 p-3 xl:p-12",children:r.map(a=>e.jsx("li",{className:"rounded-xl border bg-background transition-all duration-200 focus-within:-translate-y-1 focus-within:shadow-lg hover:-translate-y-1 hover:shadow-lg",children:e.jsx(Zr,{thread:a})},a.id))})})}),e.jsx("div",{children:e.jsxs(ae,{to:n&&!s.includes("oauth")?s.replace(/^https/,"discord"):s,target:s.includes("oauth")?void 0:"_blank",rel:"noreferrer noopener",onClick:n?r=>{r.preventDefault(),window.open(r.currentTarget.href,"_blank","noreferrer noopener")}:void 0,className:"flex items-center gap-2 p-2 text-xl hover:underline",children:["Create Post ",e.jsx(O,{name:"ExternalLink"})]})})]})}function Zr({thread:t}){const s=t.reactions.filter(r=>r.count),n=dr();return e.jsx("div",{children:e.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[t.tags.length?e.jsx("div",{className:"flex gap-2",children:t.tags.map(r=>e.jsxs("div",{className:"flex items-center justify-center gap-1 rounded-full bg-accent px-2 py-1 text-sm",children:[e.jsx("span",{className:"h-3 w-3 leading-3",children:e.jsx(Ye,{name:r.emojiName,url:r.emojiUrl})}),e.jsx("span",{children:r.name})]},r.name))}):null,e.jsx("strong",{className:"text-xl font-bold",children:t.name}),e.jsxs("div",{className:"flex items-start gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[t.authorAvatarUrl?e.jsx("img",{src:t.authorAvatarUrl,alt:"",className:"h-6 w-6 rounded-full"}):null,e.jsxs("span",{children:[e.jsx("span",{className:"font-bold",style:t.authorHexAccentColor?{color:t.authorHexAccentColor}:{},children:t.authorDisplayName}),":"," "]})]}),e.jsx("span",{className:"flex-1 overflow-ellipsis text-muted-foreground",children:t.messagePreview})]})]}),t.previewImageUrl?e.jsx("img",{src:t.previewImageUrl,alt:"",className:"h-28 w-28 rounded-lg object-cover"}):null]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{children:s.length?e.jsx("ul",{className:"flex items-center gap-2",children:s.map((r,a)=>e.jsxs("li",{className:"flex items-center gap-1 rounded-md border border-blue-600 bg-blue-500/20 px-[5px] py-[0.5px] text-sm",children:[e.jsx("span",{className:"h-3 w-3 leading-3",children:e.jsx(Ye,{name:r.emojiName,url:r.emojiUrl})}),e.jsx("span",{children:r.count})]},a))}):null}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(O,{name:"Chat"})," ",t.messageCount]}),` · ${ve(t.lastUpdated).tz(n.timeZone).fromNow()}`]})]}),e.jsxs("span",{className:"flex items-center gap-4",children:[e.jsx("a",{href:t.link.replace(/^https/,"discord"),children:e.jsx(O,{name:"Discord"})}),e.jsx("a",{href:t.link,target:"_blank",rel:"noreferrer noopener",children:e.jsx(O,{name:"ExternalLink"})})]})]})]})})}function Ye({name:t,url:s}){return s?e.jsx("img",{src:s,alt:t,className:"h-full w-full"}):t||null}function xt({playgroundAppName:t,problemAppName:s,isUpToDate:n,allApps:r,children:a}){const o=t===s,i=o&&n?e.jsx(O,{size:"xl",name:"Linked"}):e.jsx(O,{size:"xl",name:"Unlinked",className:"animate-pulse text-foreground-danger"});let c="Click to reset Playground.";return n||(c="Playground is out of date. Click to reset Playground."),o||(c="Playground is not set to the right app. Click to set Playground."),e.jsxs("div",{className:"flex h-full w-full flex-col justify-between",children:[e.jsxs("div",{className:"flex h-14 flex-shrink-0 items-center justify-start gap-2 border-b px-3",children:[e.jsx("div",{className:"display-alt-up",children:s?e.jsx(ye,{appName:s,tooltipText:c,children:i}):e.jsx(G,{content:"No problem app available for this step",children:e.jsx("div",{children:e.jsx(O,{name:"Question"})})})}),e.jsx("div",{className:"display-alt-down",children:t?e.jsx(ye,{appName:t,reset:!0,tooltipText:"Reset Playground",children:e.jsx("div",{className:"flex h-7 w-7 items-center justify-center",children:e.jsx(O,{name:"Refresh"})})}):e.jsx("div",{className:"h-7 w-7"})}),e.jsx(Lr,{allApps:r,playgroundAppName:t})]}),e.jsx("div",{className:"flex h-full flex-1 flex-grow items-center justify-center",children:a})]})}function Jr({name:t}){var o;const s=K(),n=(o=s.formData)==null?void 0:o.get("intent"),r=n==="stop"?"Stopping App":n==="restart"?"Restarting App":null,a=Ee();return e.jsxs(s.Form,{method:"POST",action:"/start",children:[Oe,e.jsx("input",{type:"hidden",name:"name",value:t}),e.jsx("button",{type:"submit",name:"intent",value:a?"restart":"stop",className:"h-full border-r px-3 py-4 font-mono text-xs uppercase leading-none",children:r||(a?"Restart App":"Stop App")})]})}function gt({port:t}){const s=K();return e.jsxs(s.Form,{method:"POST",action:"/start",children:[e.jsx("input",{type:"hidden",name:"port",value:t}),e.jsx(qe,{varient:"mono",type:"submit",name:"intent",value:"stop-port",children:s.state==="idle"?"Stop Port":"Stopping Port"})]})}function Qr({name:t}){var n;const s=K();return((n=s.data)==null?void 0:n.status)==="app-not-started"?s.data.error==="port-unavailable"?e.jsxs("div",{children:["The port is unavailable. Would you like to stop whatever is running on that port and try again?",e.jsx(gt,{port:s.data.port})]}):e.jsx("div",{children:"An unknown error has happened."}):e.jsxs(s.Form,{method:"POST",action:"/start",children:[e.jsx("input",{type:"hidden",name:"name",value:t}),s.state==="idle"?e.jsx(qe,{type:"submit",name:"intent",value:"start",varient:"mono",children:"Start App"}):e.jsx("div",{children:e.jsx(We,{children:"Starting App"})})]})}const Xr=h.intersection(h.object({type:h.literal("epicshop:history-call")}),h.union([h.object({method:h.literal("pushState"),args:h.union([h.tuple([h.object({}).passthrough(),h.unknown()]),h.tuple([h.object({}).passthrough(),h.unknown(),h.string()])])}),h.object({method:h.literal("replaceState"),args:h.union([h.tuple([h.object({}).passthrough(),h.unknown()]),h.tuple([h.object({}).passthrough(),h.unknown(),h.string()])])}),h.object({method:h.literal("go"),args:h.tuple([h.number().optional()])}),h.object({method:h.literal("forward"),args:h.tuple([])}),h.object({method:h.literal("back"),args:h.tuple([])}),h.object({method:h.literal("popstate"),pathname:h.string(),delta:h.number()})])),en=h.object({type:h.literal("epicshop:loaded"),url:h.string()}),tn=h.union([Xr,en]);function Be(t,s,n){return Math.min(Math.max(t+s,0),n)}const rn=x.forwardRef(nn);function nn({name:t,port:s,portIsAvailable:n,isRunning:r,baseUrl:a,id:o,initialRoute:i},c){const l=Me();return r?e.jsx(sn,{baseUrl:a,id:o,name:t,ref:c,initialRoute:i}):n===!1?e.jsxs("div",{className:"flex flex-col items-center justify-center",children:[e.jsxs("p",{className:"max-w-xs pb-5 text-center",role:"status",children:["The port for this app is unavailable. It could be that you're running it ",e.jsx("a",{href:Re({domain:l.domain,port:s}),className:"underline",children:"elsewhere"}),"?"]}),e.jsx(gt,{port:s})]}):e.jsx(Qr,{name:t})}const sn=x.forwardRef(an);function an({baseUrl:t,id:s,name:n,initialRoute:r},a){const[o,i]=Ie(),c=o.get("pathname")??r,[l,m]=x.useState(0),u=s+l,p=x.useRef("new"),g=x.useRef(null),[y,S]=x.useState({history:[c],index:0}),[d,$]=x.useState(c),T=x.useRef(null),j=new URL(c,t),E=x.useRef(j);x.useEffect(()=>{E.current=j});const[L,R]=x.useState(j),F=x.useRef(s);F.current!==s&&(F.current=s,R(E.current)),x.useEffect(()=>{F.current=s}),x.useEffect(()=>{function N(v){var C;if(v.source!==((C=T.current)==null?void 0:C.contentWindow))return;const f=tn.safeParse(v.data,{path:["messageEvent","data"]});if(!f.success)return;const{data:P}=f;if(P.type==="epicshop:loaded"){S(w=>{const I=A=>Be(w.index,A,w.history.length-1);if(p.current==="back")return{...w,index:I(-1)};if(p.current==="forward")return{...w,index:I(1)};if(p.current==="new"){const A=w.history[w.index],_=new URL(P.url).pathname;if(A===_)return w;const H=[...w.history.slice(0,w.index+1),_];return{history:H,index:H.length-1}}else throw new Error("Unexpected lastDirectionRef value")});return}const{method:b}=P;S(w=>{const I=_=>Be(w.index,_,w.history.length-1),A=w.history[w.index];switch(b){case"popstate":return{...w,index:I(P.delta)};case"forward":return{...w,index:I(1)};case"back":return{...w,index:I(-1)};case"pushState":{const _=P.args[2]??A,H=[...w.history.slice(0,w.index+1),_].filter(Boolean);return{...w,history:H,index:H.length-1}}case"replaceState":{const _=P.args[2]??A;return{...w,history:[...w.history.slice(0,w.index),_,...w.history.slice(w.index+1)].filter(Boolean)}}case"go":{const[_=0]=P.args;return{...w,index:I(_)}}}})}return window.addEventListener("message",N),()=>{window.removeEventListener("message",N)}},[]);const U=x.useRef(i);x.useEffect(()=>{U.current=i},[i]);const k=y.history[y.index];x.useEffect(()=>{if(!k)return;$(k);const N=new URLSearchParams(window.location.search);k==="/"?N.delete("pathname"):N.set("pathname",k),`?${N.toString()}`!==window.location.search&&U.current(N,{replace:!0})},[k]);const Y=(...N)=>{var f,P;const v=N[0];typeof v=="number"?p.current=v>0?"forward":"back":p.current="new",g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{p.current="new"},100),(P=(f=T.current)==null?void 0:f.contentWindow)==null||P.postMessage({type:"epicshop:navigate-call",params:N},"*")};function M(N=d){$(N);const v=y.history[y.index];Y(N,{replace:v===N})}x.useImperativeHandle(a,()=>({handleExtrnalNavigation:M}));const D=y.index===y.history.length-1,q=y.index<=0,X=[];for(const[N,v]of o.entries())N!=="pathname"&&X.push(e.jsx("input",{type:"hidden",name:N,value:v},N));return e.jsx(It,{children:e.jsxs("div",{className:"flex h-full flex-grow flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b pl-1.5",children:[e.jsxs("div",{className:"mr-2 flex items-center justify-center gap-2 px-1",children:[e.jsxs(fe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("button",{type:"button",className:"hidden aspect-square h-full w-full items-center justify-center p-1 transition disabled:opacity-40 sm:flex",disabled:q,onClick:()=>Y(-1),children:e.jsx(O,{name:"ArrowLeft","aria-hidden":"true"})})}),e.jsx(me,{children:"Go back"})]}),e.jsxs(fe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("button",{type:"button",className:"hidden aspect-square h-full w-full items-center justify-center p-1 transition disabled:opacity-40 sm:flex",disabled:D,onClick:()=>Y(1),children:e.jsx(O,{name:"ArrowRight","aria-hidden":"true"})})}),e.jsx(me,{children:"Go forward"})]}),e.jsxs(fe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("button",{type:"button",className:"flex aspect-square h-full w-full items-center justify-center p-1 transition disabled:opacity-40",onClick:()=>{R(j),m(l+1),S({history:[j.pathname],index:0})},children:e.jsx(O,{name:"Refresh","aria-hidden":"true"})})}),e.jsx(me,{children:"Refresh"})]})]}),e.jsxs(cr,{method:"get",replace:!0,className:"flex flex-1 gap-2",onSubmit:()=>M(),children:[X,e.jsxs("div",{className:"flex flex-1 items-center border-x bg-background p-3 leading-none text-foreground",children:[e.jsx("a",{href:j.toString(),target:"_blank",rel:"noreferrer",children:L.host}),e.jsx("input",{"aria-label":"pathname",className:"w-full flex-1 bg-background focus-visible:outline-none",value:d,name:"pathname",onChange:N=>$(N.currentTarget.value)})]})]}),e.jsx(Jr,{name:n}),e.jsxs(fe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("a",{href:j.toString(),target:"_blank",rel:"noreferrer",className:re("flex aspect-square items-center justify-center px-3.5"),children:e.jsx(O,{name:"ExternalLink"})})}),e.jsx(me,{children:"Open in new tab"})]})]}),e.jsx("div",{className:"flex h-full w-full flex-grow dark:bg-white",children:e.jsx("iframe",{title:n,ref:T,src:L.toString(),className:"h-full w-full flex-grow bg-white"},u)})]})})}function Ne({id:t,appInfo:s,inBrowserBrowserRef:n}){const r=Me();if(!s)return e.jsx("p",{children:"No app here. Sorry."});const{isRunning:a,dev:o,name:i,portIsAvailable:c,title:l}=s;if(o.type==="script"){const m=Re({domain:r.domain,port:o.portNumber});return e.jsx(rn,{ref:n,isRunning:a,id:t??i,name:i,portIsAvailable:c,port:o.portNumber,baseUrl:m,initialRoute:o.initialRoute})}else return o.type==="browser"?e.jsxs("div",{className:"relative h-full flex-grow overflow-y-auto scrollbar-thin scrollbar-thumb-scrollbar",children:[e.jsxs("a",{href:o.pathname,target:"_blank",rel:"noreferrer",className:be("absolute bottom-5 right-5 flex items-center justify-center rounded-full bg-gray-100 p-2.5 transition hover:bg-gray-200 dark:bg-gray-800 hover:dark:bg-gray-600"),children:[e.jsx(O,{name:"ExternalLink","aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:"Open in New Window"})]}),e.jsx("iframe",{title:l,src:o.pathname,className:"h-full w-full flex-grow bg-white"})]}):e.jsxs("p",{children:["Preview for dev type of ",e.jsx("code",{children:o.type})," not supported."]})}function on({appInfo:t,inBrowserBrowserRef:s,problemAppName:n,allApps:r,isUpToDate:a}){return e.jsx(xt,{playgroundAppName:t==null?void 0:t.appName,problemAppName:n,allApps:r,isUpToDate:a,children:(t==null?void 0:t.dev.type)==="none"?e.jsxs("div",{children:[e.jsx("div",{className:"text-foreground-secondary flex h-full items-center justify-center text-2xl",children:"Non-UI playground"}),e.jsx("div",{children:e.jsxs("div",{className:"text-foreground-secondary flex flex-wrap gap-1 text-center",children:["Navigate to"," ",e.jsx(G,{content:t.fullPath,children:e.jsx("span",{className:"underline",onClick:()=>{navigator.clipboard.writeText(t.fullPath),mr.success("Copied playground path to clipboard")},children:"the playground directory"})})," ","in your editor and terminal to work on this exercise!"]})})]}):t?e.jsx(Ne,{id:t.appName,appInfo:t,inBrowserBrowserRef:s}):e.jsxs("div",{className:"flex flex-col justify-center gap-2",children:[e.jsx("p",{children:"Please set the playground first"}),n?e.jsx(Ae,{appName:n}):null]})})}function ln({handleClick:t,cacheLocation:s,embeddedKey:n,appFullPath:r}){const a=K();return e.jsxs(a.Form,{action:"/update-mdx-cache",method:"POST",children:[Oe,e.jsx("input",{type:"hidden",name:"cacheLocation",value:s}),e.jsx("input",{type:"hidden",name:"embeddedKey",value:n}),e.jsx("input",{type:"hidden",name:"appFullPath",value:r}),e.jsx("button",{type:"submit",onClick:t,className:re("launch_button",a.state==="idle"?null:"cursor-progress"),children:"Cancel Warning"})]})}const vt=x.createContext(null);function cn(){const t=x.useContext(vt);if(!t)throw new Error("useStepContext must be used within a StepContext.Provider");return t}function un({children:t,inBrowserBrowserRef:s}){return e.jsx(vt.Provider,{value:{inBrowserBrowserRef:s},children:t})}const dn={CodeFile:pn,CodeFileNotification:xn,DiffLink:Le,PrevDiffLink:mn,NextDiffLink:hn,InlineFile:gn,LinkToApp:jn};function fn({inBrowserBrowserRef:t}){const s=W();return s.exerciseStepApp.instructionsCode?e.jsx(un,{inBrowserBrowserRef:t,children:e.jsx(pr,{epicVideoInfosPromise:s.epicVideoInfosPromise,children:e.jsx("div",{className:"prose dark:prose-invert sm:prose-lg",children:e.jsx(or,{code:s.exerciseStepApp.instructionsCode,components:dn})})})}):null}function jt(t,s,n){const r=new URLSearchParams(t);return n===null?r.delete(s):r.set(s,n),r}function hn({app:t=0,fullPage:s=!1,children:n}){return e.jsx(Le,{app1:t,app2:t+1,fullPage:s,children:n})}function mn({app:t=-1,fullPage:s=!1,children:n}){return e.jsx(Le,{app1:t,app2:t+1,fullPage:s,children:n})}function Le({app1:t=0,app2:s=1,children:n,fullPage:r=!1,to:a}){const o=W();if(!a&&!t&&!s)return e.jsx("callout-danger",{className:"notification",children:e.jsx("div",{className:"title",children:"DiffLink Error: invalid input"})});function i(u){var p;if(typeof u=="number"){const g=o.exerciseIndex+u;return(p=o.allApps[g])==null?void 0:p.name}if(!u)return null;for(const{name:g,stepName:y}of o.allApps)if(u===g||u===y)return g;return null}if(a){const u=new URLSearchParams(a);t=u.get("app1"),s=u.get("app2")}const c=i(t),l=i(s);if(!c||!l)return e.jsxs("callout-danger",{className:"notification",children:[e.jsx("div",{className:"title",children:"DiffLink Error: invalid input"}),!c&&e.jsxs("div",{children:['app1: "',t,'" is not a valid app name']}),!l&&e.jsxs("div",{children:['app2: "',s,'" is not a valid app name']})]});a||(a=`app1=${c}&app2=${l}`);const m=r?`/diff?${a}`:`?${decodeURIComponent(jt(new URLSearchParams,"preview",`diff&${a}`).toString())}`;return n||(n=e.jsxs("span",{children:["Go to Diff ",r?"":"Preview"," from: ",e.jsx("code",{children:c})," to:"," ",e.jsx("code",{children:l})]})),e.jsx(ae,{to:m,children:n})}function pn({file:t}){return e.jsxs("div",{className:"border-4 border-[#ff4545] bg-[#ff454519] p-4 text-lg",children:["Something went wrong compiling ",e.jsx("b",{children:"CodeFile"})," for file: ",e.jsx("u",{children:t})," to markdown"]})}function xn({file:t,type:s="problem",children:n,variant:r,cacheLocation:a,embeddedKey:o,...i}){const[c,l]=x.useState("visible"),u=W()[s],p=()=>{c==="visible"&&(l("collapse"),setTimeout(()=>{l("none")},400))},g=re("rounded px-4 py-1 font-mono text-sm font-semibold outline-none transition duration-300 ease-in-out",{"bg-amber-300/70 hover:bg-amber-300/40 active:bg-amber-300/50":r==="warning","bg-red-300/70 hover:bg-red-300/40 active:bg-red-300/50":r==="error"});return e.jsxs("div",{className:re("notification important h-15 relative",{"duration-400 !my-0 !h-0 !py-0 !opacity-0 transition-all ease-out":c!=="visible",hidden:c==="none"}),children:[e.jsxs("div",{className:"absolute right-3 top-3 z-50 flex gap-4",children:[u?e.jsx("div",{className:g,title:`Edit ${t}`,children:e.jsx(ce,{appFile:t,appName:u.name,...i,children:"Edit this File"})}):null,u&&r==="warning"?e.jsx("div",{className:g,title:`Remove the warning from here and from ${t} cache file`,children:e.jsx(ln,{handleClick:p,cacheLocation:a,embeddedKey:o,appFullPath:u.fullPath})}):null]}),n]})}function gn({file:t,type:s="playground",children:n=e.jsx("code",{children:t}),...r}){const a=W(),o=a[s]||a[a.type],i=e.jsxs("div",{className:"launch-editor-button-wrapper flex underline underline-offset-4",children:[n," ",e.jsx("svg",{height:24,width:24,children:e.jsx("use",{href:"/icons.svg#keyboard"})})]});return ENV.EPICSHOP_DEPLOYED&&o?e.jsx("div",{className:"inline-block grow",children:e.jsx(ce,{appFile:t,appName:o.name,...r,children:i})}):o?e.jsx("div",{className:"inline-block grow",children:e.jsx(ce,{appFile:t,appName:o.name,...r,children:i})}):s==="playground"?e.jsx(G,{content:"You must 'Set to Playground' before opening a file",children:e.jsx("div",{className:"inline-block grow cursor-not-allowed",children:i})}):e.jsx(e.Fragment,{children:"children"})}function vn(t){return t==="problem"?"problem":t==="solution"?"solution":"playground"}function jn({to:t,children:s=e.jsx("code",{children:t.toString()}),...n}){var g;const[r]=Ie(),a=`?${jt(r,"pathname",t.toString()).toString()}`,o=W(),i=vn(r.get("preview")),c=Me(),l=o[i],m=(l==null?void 0:l.dev.type)==="script"?Re({domain:c.domain,port:l.dev.portNumber}):((g=o.playground)==null?void 0:g.dev.type)==="browser"?o.playground.dev.pathname:null,{inBrowserBrowserRef:u}=cn(),p=m?m.slice(0,-1)+t.toString():null;return e.jsxs("div",{className:"inline-flex items-center justify-between gap-1",children:[e.jsx(ae,{to:a,...n,className:be(n.className,{"cursor-not-allowed":ENV.EPICSHOP_DEPLOYED}),title:ENV.EPICSHOP_DEPLOYED?"Cannot link to app in deployed version":void 0,onClick:y=>{var S,d;ENV.EPICSHOP_DEPLOYED&&y.preventDefault(),(S=n.onClick)==null||S.call(n,y),(d=u.current)==null||d.handleExtrnalNavigation(t.toString())},children:s}),p?e.jsx(G,{content:"Open in new tab",children:e.jsx("a",{href:p,target:"_blank",rel:"noreferrer",className:be("flex aspect-square items-center justify-center",{"cursor-not-allowed":ENV.EPICSHOP_DEPLOYED}),title:ENV.EPICSHOP_DEPLOYED?"Cannot link to app in deployed version":"Open in new tab",onClick:y=>{ENV.EPICSHOP_DEPLOYED&&y.preventDefault()},children:e.jsx(O,{name:"ExternalLink"})})}):null]})}const bn=h.intersection(h.object({type:h.literal("epicshop:test-status-update"),timestamp:h.number()}),h.union([h.object({status:h.literal("pending")}),h.object({status:h.literal("pass")}),h.object({status:h.literal("fail"),error:h.string()})])),wn=h.object({type:h.literal("epicshop:test-step-update"),status:h.literal("pass"),title:h.string(),timestamp:h.number()}),yn=h.union([wn,bn]);function Nn({pathname:t,testFile:s}){const n=x.useRef(null),[r,a]=x.useState(null),[o,i]=x.useState([]);x.useEffect(()=>{function u(p){var S;if(p.source!==((S=n.current)==null?void 0:S.contentWindow)||"request"in p.data)return;const g=yn.safeParse(p.data,{path:["messageEvent","data"]});if(!g.success){console.error("Invalid message from test iframe",p.data,g.error);return}const{data:y}=g;y.type==="epicshop:test-status-update"&&(y.status==="pending"&&i([]),a(y)),y.type==="epicshop:test-step-update"&&i(d=>[...d,y])}return window.addEventListener("message",u),()=>{window.removeEventListener("message",u)}},[]);const c={pending:e.jsx(ke,{"aria-label":"Pending"}),pass:e.jsx(O,{name:"CheckSmall","aria-label":"Passed",className:"text-emerald-700"}),fail:e.jsx(O,{name:"Remove","aria-label":"Failed",className:"text-foreground-danger"}),unknown:e.jsx(O,{name:"Question","aria-label":"Unknown",className:"animate-pulse"})}[(r==null?void 0:r.status)??"unknown"],l=o.sort((u,p)=>u.timestamp-p.timestamp),m={pass:e.jsx(O,{name:"CheckSmall","aria-label":"Passed"}),fail:e.jsx(O,{name:"Remove","aria-label":"Failed"}),unknown:e.jsx(O,{name:"Question","aria-label":"Unknown",className:"animate-pulse"})};return e.jsx(e.Fragment,{children:e.jsx(tr,{className:"w-full",type:"multiple",children:e.jsx(rr,{icon:c,title:s,forceMount:!0,children:e.jsxs("div",{className:"not-prose",children:[e.jsxs("div",{className:"p-5 pt-3",children:[e.jsx("ul",{className:"",children:l.map(u=>e.jsx("li",{children:e.jsxs("div",{className:"flex items-baseline gap-2 text-emerald-700",children:[e.jsx("span",{children:m[u.status]}),e.jsx("pre",{className:"whitespace-pre-wrap",children:u.title})]})},u.timestamp+u.title))}),(r==null?void 0:r.status)==="fail"?e.jsxs("div",{className:"flex items-baseline gap-2 text-foreground-danger",children:[e.jsx("span",{children:m.fail}),e.jsx("pre",{className:"max-h-48 overflow-y-auto text-foreground-danger scrollbar-thin scrollbar-thumb-scrollbar",children:r.error})]}):null,e.jsx("iframe",{ref:n,title:s,src:t+s,className:"mt-5 min-h-[420px] w-full border bg-white"})]}),e.jsxs("div",{className:"flex border-y",children:[e.jsx("button",{onClick:()=>{var u,p;return(p=(u=n.current)==null?void 0:u.contentWindow)==null?void 0:p.location.reload()},className:"border-r p-3",children:e.jsx(O,{name:"Refresh","aria-label":"Rerun Tests"})}),e.jsx("a",{href:t+s,target:"_blank",rel:"noreferrer",className:"border-r p-3",children:e.jsx(O,{name:"ExternalLink","aria-label":"Open in New Window"})})]})]})})})})}const Sn=h.union([h.object({type:h.literal("init"),exitCode:h.number().nullable().optional(),isRunning:h.boolean(),output:h.array(h.object({type:h.union([h.literal("stdout"),h.literal("stderr")]),html:h.string(),timestamp:h.number()}))}),h.object({type:h.union([h.literal("stdout"),h.literal("stderr")]),data:h.string(),timestamp:h.number()}),h.object({type:h.literal("exit"),isRunning:h.literal(!1),code:h.number().nullable()})]),Pn=h.array(Sn);function $n(t,s){return s(t)}function Cn({name:t}){const[s,n]=x.useReducer($n,{version:0,isRunning:!1,exitCode:void 0,lines:[]}),{version:r,isRunning:a,exitCode:o,lines:i}=s,c=xr(`/test?${new URLSearchParams({name:t})}&v=${r}`);return x.useEffect(()=>{if(!c)return;const l=JSON.parse(c),m=Pn.safeParse(l);if(!m.success){console.error(m.error.flatten());return}for(const u of m.data)switch(u.type){case"exit":{const{isRunning:p,code:g}=u;n(y=>({...y,isRunning:p,exitCode:g}));break}case"init":{const{output:p,exitCode:g,isRunning:y}=u;n(S=>({...S,lines:p,exitCode:g,isRunning:y}));break}case"stderr":case"stdout":{const{type:p,data:g,timestamp:y}=u;n(S=>({...S,lines:[...S.lines,{type:p,html:g,timestamp:y}].sort((d,$)=>d.timestamp-$.timestamp),isRunning:!0}));break}}},[c]),e.jsxs("div",{className:"relative flex h-full w-full flex-col",children:[e.jsxs("div",{className:"flex h-12 w-full flex-shrink-0 items-center justify-between border-b",children:[e.jsxs("div",{className:"flex h-full items-center",children:[!a&&e.jsx(Tn,{name:t,onRun:()=>{n(l=>({...l,exitCode:void 0,lines:[],version:l.version+1}))}}),a?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex h-full flex-grow items-center justify-center border-r px-3.5",children:e.jsx(ke,{role:"status","aria-label":"Running Tests"})}),e.jsx(En,{name:t})]}):null]}),!a&&o!==void 0&&e.jsx("p",{className:"pr-3.5 leading-none",children:o===0?"Tests passed":`Test failed (exit code ${String(o)})`}),!a&&o!==void 0&&e.jsx(Dn,{name:t,onClear:()=>{n(l=>({...l,exitCode:void 0,lines:[]}))}})]}),e.jsxs("div",{className:"flex h-full flex-col gap-5 p-5",children:[e.jsx("p",{className:"font-mono text-sm font-medium uppercase",children:"Test Output"}),e.jsx("pre",{className:"shadow-on-scrollbox flex-1 overflow-y-scroll scrollbar-thin scrollbar-thumb-scrollbar",children:i.map(l=>e.jsx("code",{"data-type":l.type,dangerouslySetInnerHTML:{__html:l.html}},l.timestamp))})]})]})}function Tn({name:t,onRun:s}){const n=K(),r=x.useRef(s);return x.useEffect(()=>{r.current=s},[s]),x.useEffect(()=>{var a,o;(a=n.data)!=null&&a.success&&((o=r.current)==null||o.call(r))},[n.data]),e.jsxs(n.Form,{method:"POST",action:"/test",className:"h-full",children:[e.jsx("input",{type:"hidden",name:"name",value:t}),e.jsx(G,{content:n.state==="idle"?"Run Tests":"Running Tests...",children:e.jsx("button",{type:"submit",name:"intent",value:"run",className:"flex h-full flex-grow items-center justify-center border-r px-3.5",children:n.state==="idle"?e.jsx(O,{name:"TriangleSmall"}):e.jsx(ke,{role:"status"})})})]})}function Dn({name:t,onClear:s}){const n=K(),r=x.useRef(s);return x.useEffect(()=>{r.current=s},[s]),x.useEffect(()=>{var a,o;(a=n.data)!=null&&a.success&&((o=r.current)==null||o.call(r))},[n.data]),e.jsxs(n.Form,{method:"POST",action:"/test",className:"h-full",children:[e.jsx("input",{type:"hidden",name:"name",value:t}),e.jsx(G,{content:n.state==="idle"?"Clear Tests":"Clearing Tests...",children:e.jsx("button",{type:"submit",name:"intent",value:"clear",className:"flex h-full flex-grow items-center justify-center border-l px-3.5",children:n.state==="idle"?e.jsx(O,{name:"Clear"}):e.jsx(O,{name:"Clear",className:"animate-pulse",role:"status"})})})]})}function En({name:t,onStop:s}){const n=K(),r=x.useRef(s);return x.useEffect(()=>{r.current=s},[s]),x.useEffect(()=>{var a,o;(a=n.data)!=null&&a.success&&((o=r.current)==null||o.call(r))},[n.data]),e.jsxs(n.Form,{method:"POST",action:"/test",className:"h-full",children:[e.jsx("input",{type:"hidden",name:"name",value:t}),e.jsx(G,{content:n.state==="idle"?"Stop Tests":"Stopping Tests...",children:e.jsx("button",{type:"submit",name:"intent",value:"stop",className:"flex h-full flex-grow items-center justify-center border-r px-3.5",children:n.state==="idle"?e.jsx(O,{name:"Stop"}):e.jsx(O,{name:"Stop",className:"animate-pulse",role:"status"})})})]})}function Rn({appInfo:t,problemAppName:s,allApps:n,isUpToDate:r}){const[a,o]=x.useState(0);let i=e.jsx("p",{children:"No tests here. Sorry."});if((t==null?void 0:t.test.type)==="script"&&(i=e.jsx(Cn,{name:t.name})),(t==null?void 0:t.test.type)==="browser"){const{pathname:c}=t.test;i=e.jsxs("div",{className:"flex h-full w-full flex-grow flex-col",children:[t.test.testFiles.map(l=>e.jsx("div",{children:e.jsx(Nn,{pathname:c,testFile:l})},l)),e.jsx("div",{className:"px-3 py-[21px]",children:e.jsxs("button",{onClick:()=>o(l=>l+1),className:"flex items-center gap-2 font-mono text-sm uppercase leading-none",children:[e.jsx(O,{name:"Refresh","aria-hidden":!0})," Rerun All Tests"]})})]},a)}return e.jsx(xt,{playgroundAppName:t==null?void 0:t.appName,problemAppName:s,allApps:n,isUpToDate:r,children:i})}var Ue="Popover",[bt,js]=Pe(Ue,[Ve]),ue=Ve(),[kn,Q]=bt(Ue),wt=t=>{const{__scopePopover:s,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:i=!1}=t,c=ue(s),l=x.useRef(null),[m,u]=x.useState(!1),[p=!1,g]=Ce({prop:r,defaultProp:a,onChange:o});return e.jsx(Lt,{...c,children:e.jsx(kn,{scope:s,contentId:Te(),triggerRef:l,open:p,onOpenChange:g,onOpenToggle:x.useCallback(()=>g(y=>!y),[g]),hasCustomAnchor:m,onCustomAnchorAdd:x.useCallback(()=>u(!0),[]),onCustomAnchorRemove:x.useCallback(()=>u(!1),[]),modal:i,children:n})})};wt.displayName=Ue;var yt="PopoverAnchor",On=x.forwardRef((t,s)=>{const{__scopePopover:n,...r}=t,a=Q(yt,n),o=ue(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:c}=a;return x.useEffect(()=>(i(),()=>c()),[i,c]),e.jsx(ze,{...o,...r,ref:s})});On.displayName=yt;var Nt="PopoverTrigger",St=x.forwardRef((t,s)=>{const{__scopePopover:n,...r}=t,a=Q(Nt,n),o=ue(n),i=$e(s,a.triggerRef),c=e.jsx(J.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Dt(a.open),...r,ref:i,onClick:V(t.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:e.jsx(ze,{asChild:!0,...o,children:c})});St.displayName=Nt;var He="PopoverPortal",[In,Mn]=bt(He,{forceMount:void 0}),Pt=t=>{const{__scopePopover:s,forceMount:n,children:r,container:a}=t,o=Q(He,s);return e.jsx(In,{scope:s,forceMount:n,children:e.jsx(De,{present:n||o.open,children:e.jsx(wr,{asChild:!0,container:a,children:r})})})};Pt.displayName=He;var oe="PopoverContent",$t=x.forwardRef((t,s)=>{const n=Mn(oe,t.__scopePopover),{forceMount:r=n.forceMount,...a}=t,o=Q(oe,t.__scopePopover);return e.jsx(De,{present:r||o.open,children:o.modal?e.jsx(_n,{...a,ref:s}):e.jsx(Fn,{...a,ref:s})})});$t.displayName=oe;var _n=x.forwardRef((t,s)=>{const n=Q(oe,t.__scopePopover),r=x.useRef(null),a=$e(s,r),o=x.useRef(!1);return x.useEffect(()=>{const i=r.current;if(i)return gr(i)},[]),e.jsx(vr,{as:Mt,allowPinchZoom:!0,children:e.jsx(Ct,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:V(t.onCloseAutoFocus,i=>{var c;i.preventDefault(),o.current||(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:V(t.onPointerDownOutside,i=>{const c=i.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,m=c.button===2||l;o.current=m},{checkForDefaultPrevented:!1}),onFocusOutside:V(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),Fn=x.forwardRef((t,s)=>{const n=Q(oe,t.__scopePopover),r=x.useRef(!1),a=x.useRef(!1);return e.jsx(Ct,{...t,ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,c;(i=t.onCloseAutoFocus)==null||i.call(t,o),o.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),o.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:o=>{var l,m;(l=t.onInteractOutside)==null||l.call(t,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const i=o.target;((m=n.triggerRef.current)==null?void 0:m.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),Ct=x.forwardRef((t,s)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:i,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:m,onInteractOutside:u,...p}=t,g=Q(oe,n),y=ue(n);return jr(),e.jsx(br,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o,children:e.jsx(_t,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:m,onDismiss:()=>g.onOpenChange(!1),children:e.jsx(Ft,{"data-state":Dt(g.open),role:"dialog",id:g.contentId,...y,...p,ref:s,style:{...p.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)"}})})})}),Tt="PopoverClose",An=x.forwardRef((t,s)=>{const{__scopePopover:n,...r}=t,a=Q(Tt,n);return e.jsx(J.button,{type:"button",...r,ref:s,onClick:V(t.onClick,()=>a.onOpenChange(!1))})});An.displayName=Tt;var Ln="PopoverArrow",Un=x.forwardRef((t,s)=>{const{__scopePopover:n,...r}=t,a=ue(n);return e.jsx(At,{...a,...r,ref:s})});Un.displayName=Ln;function Dt(t){return t?"open":"closed"}var Hn=wt,Yn=St,Bn=Pt,Vn=$t;function zn(){var i,c;const t=W(),[s,n]=x.useState(!1),r=x.useRef(null);function a(){n(!1)}const o=(i=t.playground)==null?void 0:i.appName;return e.jsx(e.Fragment,{children:e.jsxs(Hn,{open:s,onOpenChange:n,children:[e.jsx(Yn,{asChild:!0,children:e.jsxs("button",{className:"flex h-full items-center gap-1 border-r px-6 py-3 font-mono text-sm uppercase","aria-label":"Relevant Files",children:[e.jsx(O,{name:"Files"}),"Files"]})}),e.jsx(Bn,{children:e.jsx(Vn,{ref:r,className:"slideRightContent lg:slideUpContent invert-theme z-10 select-none rounded bg-background px-9 py-8 text-foreground",align:"start",sideOffset:5,children:e.jsxs("div",{className:"launch-editor-wrapper",children:[e.jsx("strong",{className:"inline-block px-2 pb-4 font-semibold uppercase",children:"Relevant Files"}),t.problem&&((c=t.playground)==null?void 0:c.appName)!==t.problem.name?e.jsx("div",{className:"mb-2 rounded p-1 font-mono font-medium",children:e.jsx(Ae,{appName:t.problem.name})}):null,e.jsx("div",{id:"files",children:e.jsx(x.Suspense,{fallback:e.jsx(G,{content:"Loading diff",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(O,{name:"Refresh",className:"h-8 w-8 animate-spin"})})}),children:e.jsx(Ke,{resolve:t.diff,errorElement:e.jsx("div",{className:"text-foreground-danger",children:"Something went wrong."}),children:({diffFiles:l})=>{if(!l)return e.jsx("p",{className:"text-foreground-danger",children:"Unable to determine diff"});if(typeof l=="string")return e.jsx("p",{className:"text-foreground-danger",children:l});if(!l.length)return e.jsx("p",{children:"No files changed"});const m=o||ENV.EPICSHOP_GITHUB_ROOT?{}:{title:"You must 'Set to Playground' before opening a file",className:"not-allowed"};return e.jsxs("ul",{...m,children:[l.length>1&&!ENV.EPICSHOP_DEPLOYED?e.jsx("div",{className:"mb-2 border-b border-b-gray-50 border-opacity-50 pb-2 font-sans",children:e.jsx(ce,{appFile:l.map(u=>`${u.path},${u.line},1`),appName:"playground",onUpdate:a,children:e.jsx("p",{children:"Open All Files"})})}):null,l.map(u=>{var p;return e.jsx("li",{"data-state":u.status,children:e.jsx(ce,{appFile:`${u.path},${u.line},1`,appName:ENV.EPICSHOP_DEPLOYED?((p=t.problem)==null?void 0:p.name)??"playground":"playground",onUpdate:a,children:e.jsx("code",{children:u.path})})},u.path)})]})}})})})]})})})]})})}function Et(t,s){var i;const n=(t==null?void 0:t.exerciseStepApp.exerciseNumber.toString().padStart(2,"0"))??"00",r=(t==null?void 0:t.exerciseStepApp.stepNumber.toString().padStart(2,"0"))??"00",a={problem:"💪",solution:"🏁"}[(t==null?void 0:t.type)??"problem"],o=((i=t==null?void 0:t[t.type])==null?void 0:i.title)??"N/A";return{emoji:a,stepNumber:r,title:o,exerciseNumber:n,exerciseTitle:(t==null?void 0:t.exerciseTitle)??"Unknown exercise",workshopTitle:s,type:(t==null?void 0:t.type)??"problem"}}const bs=({data:t,matches:s,params:n})=>{var m;const r=(m=s.find(u=>u.id==="root"))==null?void 0:m.data;if(!t||!r)return[{title:"🦉 | Error"}];const{emoji:a,stepNumber:o,title:i,exerciseNumber:c,exerciseTitle:l}=Et(t);return ur({title:`${a} | ${o}. ${i} | ${c}. ${l} | ${r.workshopTitle}`,description:`${n.type} step for exercise ${c}. ${l}`,ogTitle:i,ogDescription:`${l} step ${Number(o)} ${n.type}`,instructor:r.instructor,requestInfo:r.requestInfo})},Se=["playground","problem","solution","tests","diff","chat"],Gn=t=>!!(t&&Se.includes(t));function Kn(t,s,n){const r=new URLSearchParams(t);return n===null?r.delete(s):r.set(s,n),r}function ws(){var p,g,y,S,d,$,T;const t=W(),[s]=Ie(),n=s.get("preview"),r=x.useRef(null),a=Et(t),o=Ee(),i=Rt();function c(j){var E,L;if(j==="tests")return ENV.EPICSHOP_DEPLOYED||!t.playground||t.playground.test.type==="none";if(j==="problem"||j==="solution"){if(((E=t[j])==null?void 0:E.dev.type)==="none")return!0;if(ENV.EPICSHOP_DEPLOYED)return((L=t[j])==null?void 0:L.dev.type)!=="browser"}return!!(j==="playground"&&ENV.EPICSHOP_DEPLOYED)}const l=Gn(n)?n:Se.find(j=>!c(j)),m=`/diff?${new URLSearchParams({app1:((p=t.problem)==null?void 0:p.name)??"",app2:((g=t.solution)==null?void 0:g.name)??""})}`;function u(j){j.altKey&&!j.ctrlKey&&!j.shiftKey&&!j.metaKey&&(j.preventDefault(),i(m))}return e.jsx("div",{className:"flex max-w-full flex-grow flex-col",children:e.jsxs("main",{className:"flex flex-grow flex-col sm:grid sm:h-full sm:min-h-[800px] sm:grid-cols-1 sm:grid-rows-2 md:min-h-[unset] lg:grid-cols-2 lg:grid-rows-1",children:[e.jsxs("div",{className:"relative flex flex-col sm:col-span-1 sm:row-span-1 sm:h-full lg:border-r",children:[e.jsx("h1",{className:"h-14 border-b pl-10 pr-5 text-sm font-medium leading-tight",children:e.jsxs("div",{className:"flex h-14 flex-wrap items-center justify-between gap-x-2 py-2",children:[e.jsxs("div",{className:"flex items-center justify-start gap-x-2 uppercase",children:[e.jsxs(ae,{to:`/${a.exerciseNumber}`,className:"hover:underline",children:[a.exerciseNumber,". ",a.exerciseTitle]}),"/",e.jsxs(ae,{to:".",className:"hover:underline",children:[a.stepNumber,". ",a.title," (",a.emoji," ",a.type,")"]})]}),t.problem&&((y=t.playground)==null?void 0:y.appName)!==t.problem.name?e.jsx("div",{className:"hidden md:block",children:e.jsx(Ae,{appName:t.problem.name})}):null]})}),e.jsx("article",{id:t.articleId,className:"shadow-on-scrollbox h-full w-full max-w-none flex-1 scroll-pt-6 space-y-6 overflow-y-auto p-2 scrollbar-thin scrollbar-thumb-scrollbar sm:p-10 sm:pt-8",children:t.exerciseStepApp.instructionsCode?e.jsx(fn,{inBrowserBrowserRef:r}):e.jsx("p",{children:"No instructions yet..."})},t.articleId),e.jsx(kt,{elementQuery:`#${t.articleId}`},`scroll-${t.articleId}`),t.type==="solution"?e.jsx(lr,{type:"step",exerciseNumber:t.exerciseStepApp.exerciseNumber,stepNumber:t.exerciseStepApp.stepNumber,className:"h-14 border-t px-6"}):null,e.jsxs("div",{className:"flex h-16 justify-between border-b-4 border-t lg:border-b-0",children:[e.jsx("div",{children:e.jsx("div",{className:"h-full",children:e.jsx(zn,{})})}),e.jsx(ir,{appName:t.exerciseStepApp.name,relativePath:t.exerciseStepApp.relativePath}),e.jsx(ar,{prev:t.prevStepLink?{to:t.prevStepLink.to,"aria-label":"Previous Step"}:null,next:t.nextStepLink?{to:t.nextStepLink.to,"aria-label":"Next Step"}:null})]})]}),e.jsxs(_r,{className:"relative flex flex-col overflow-y-auto sm:col-span-1 sm:row-span-1",value:l,children:[e.jsx(Fr,{className:"h-14 min-h-14 overflow-x-hidden border-b scrollbar-thin scrollbar-thumb-scrollbar",children:Se.map(j=>{const E=c(j);return e.jsx(Ar,{value:j,hidden:E,asChild:!0,children:e.jsx(ae,{id:`${j}-tab`,className:re("clip-path-button relative h-full px-6 py-4 font-mono text-sm uppercase outline-none radix-state-active:z-10 radix-state-active:bg-foreground radix-state-active:text-background radix-state-active:hover:bg-foreground/80 radix-state-active:hover:text-background/80 radix-state-inactive:hover:bg-foreground/20 radix-state-inactive:hover:text-foreground/80 focus:bg-foreground/80 focus:text-background/80",E?"hidden":"inline-block"),preventScrollReset:!0,prefetch:"intent",onClick:u,to:j==="diff"&&o?m:`?${Kn(s,"preview",j==="playground"?null:j)}`,children:j})},j)})}),e.jsxs("div",{className:"relative z-10 flex min-h-96 flex-grow flex-col overflow-y-auto",children:[e.jsx(se,{value:"playground",className:"flex w-full flex-grow items-center justify-center self-start radix-state-inactive:hidden",children:e.jsx(on,{appInfo:t.playground,problemAppName:(S=t.problem)==null?void 0:S.name,inBrowserBrowserRef:r,allApps:t.allApps,isUpToDate:((d=t.playground)==null?void 0:d.isUpToDate)??!1})}),e.jsx(se,{value:"problem",className:"flex w-full flex-grow items-center justify-center self-start radix-state-inactive:hidden",children:e.jsx(Ne,{appInfo:t.problem,inBrowserBrowserRef:r})}),e.jsx(se,{value:"solution",className:"flex w-full flex-grow items-center justify-center self-start radix-state-inactive:hidden",children:e.jsx(Ne,{appInfo:t.solution,inBrowserBrowserRef:r})}),e.jsx(se,{value:"tests",className:"flex w-full flex-grow items-start justify-center self-start overflow-hidden radix-state-inactive:hidden",children:e.jsx(Rn,{appInfo:t.playground,problemAppName:($=t.problem)==null?void 0:$.name,allApps:t.allApps,isUpToDate:((T=t.playground)==null?void 0:T.isUpToDate)??!1})}),e.jsx(se,{value:"diff",className:"flex h-full w-full flex-grow items-start justify-center self-start radix-state-inactive:hidden",children:e.jsx(nr,{diff:t.diff,allApps:t.allApps})}),e.jsx(se,{value:"chat",className:"flex h-full w-full flex-grow items-start justify-center self-start radix-state-inactive:hidden",children:e.jsx(Wr,{})})]})]})]})})}function ys(){return e.jsx(sr,{statusHandlers:{404:()=>e.jsx("p",{children:"Sorry, we couldn't find an app here."})}})}export{ys as ErrorBoundary,ws as default,bs as meta};
|
|
2
|
-
//# sourceMappingURL=_layout-gFXglAOy.js.map
|