PageSourceSearch

https://partyrock.aws/website/ff89e99e8c8a65fc1c60/toChallenge.js

js partyrock.aws collected 2026-10-02 03:30:42 UTC 9,030 bytes, 2 lines download raw bytes

1import{s as e}from"./rolldown-runtime.js";import{t}from"./react.js";import{L as n,Q as r,l as i}from"./routes.js";import{t as a}from"./Box.js";import{i as o}from"./MantineThemeProvider.js";import{t as s}from"./events.js";import{n as c}from"./ScrollArea.js";import{t as l}from"./UnstyledButton.js";import{t as u}from"./Paper.js";import{t as d}from"./ActionIcon.js";import{t as f}from"./Group.js";import{t as p}from"./Flex.js";import{t as m}from"./Text.js";import{t as h}from"./Checkbox.js";import{t as g}from"./Button.js";import{t as _}from"./Card.js";import{t as v}from"./Grid.js";import{t as y}from"./Pill.js";import{n as b,r as x}from"./dist.js";import{n as S,r as C}from"./awsRum.js";import{r as w,t as T}from"./clsx.m.js";import{t as E}from"./responsive-hooks.js";import{n as D}from"./authHooks.js";import{d as O,n as k,s as A,u as j}from"./data.js";import{a as M}from"./types.js";import{t as N}from"./CardFrame.js";import{t as P}from"./ExternalLinkIcon.js";import{t as F}from"./Markdown.js";var I=e(t()),L=o(),R=e=>(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:16,height:16,fill:`none`,viewBox:`0 0 16 16`,...e,children:(0,L.jsx)(`path`,{stroke:`currentcolor`,d:`m1.41 1.397 13.026 13.022M14.436 1.55 1.412 14.575`})});function z({challenge:e,previewWindow:t}){if(!t)return;let a=e.type===`app-canvas`?r.replace(`:challengeId`,encodeURIComponent(e.id)):`${e.type===`data-canvas`?i:n}?challengeId=${encodeURIComponent(e.id)}`;t.location.href=a}var B=`pr-challenge-attempts`,V=864e5;function H(e,t){return`${e}::${t}`}function U(e){let t=Date.now()-V,n=!1;for(let[r,i]of Object.entries(e))(!i||i.startedAt<t)&&(delete e[r],n=!0);return n?{...e}:e}function W(){try{let e=sessionStorage.getItem(B);return e?U(JSON.parse(e)):{}}catch{return{}}}function G(e){try{sessionStorage.setItem(B,JSON.stringify(e))}catch{}}function K(e,t){delete e[t],G(e)}function q(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function J(e,t){let n=W(),r=H(e,t),i=n[r];if(i)return i.attemptId;let a=q();return n[r]={attemptId:a,startedAt:Date.now()},G(n),a}function Y(e,t){let n=W(),r=H(e,t),i=n[r];if(i)return K(n,r),{attemptId:i.attemptId,durationMs:Date.now()-i.startedAt}}var X={gridContainer:`_gridContainer_16gf1_5`,challengeButtons:`_challengeButtons_16gf1_11`,paper:`_paper_16gf1_15`,metadataItem:`_metadataItem_16gf1_21`,metaLink:`_metaLink_16gf1_32`},Z=({metadata:e=[]})=>e.filter(e=>e.type!==`HIDDEN`).map(e=>(0,L.jsx)(p,{className:X.metadataItem,direction:`column`,align:`flex-start`,children:e.type===`LINK`?(0,L.jsxs)(`a`,{className:X.metaLink,href:e.value,target:`_blank`,children:[(0,L.jsx)(m,{variant:`pr-body-s-400`,children:e.name}),(0,L.jsx)(P,{})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(m,{variant:`pr-body-s-400`,fw:600,children:e.name}),(0,L.jsx)(m,{variant:`pr-body-s-400`,children:e.value})]})},e.name)),ee=({eventId:e,challenge:t,onChallengeStart:n,onSecondaryAction:r,primaryButtonLabel:i,onClose:a})=>{let{_:o}=x(),[l,h]=(0,I.useState)(!1),{requireRegister:v}=D(),b=E(),w=a??s.closeAll,T=async()=>{if(!v()){h(!0);try{await n(t);let r=J(e,t.id);S({event:`ChallengeStart`,eventId:e,challengeId:t.id,challengeType:t.type,attemptId:r})}catch(e){C(e)}finally{h(!1)}}},O=t.metadata?.filter(e=>e.type!==`HIDDEN`),k=t.type===`app-canvas`?o(M.APP_CHALLENGE):t.type===`mini-app`?o(M.MINI_APP_CHALLENGE):o(M.DATA_CHALLENGE),A=i??o(M.START_CHALLENGE),j=o(M.SUBMIT_SOLUTION),N=(0,L.jsxs)(p,{className:X.challengeButtons,wrap:`wrap`,gap:`sm`,children:[(0,L.jsx)(g,{variant:`retro`,size:`xs`,onClick:()=>void T(),loading:l,disabled:l,children:A}),r&&(0,L.jsx)(g,{variant:`outline`,size:`xs`,onClick:r,children:j})]});return(0,L.jsxs)(p,{direction:`column`,gap:`xs`,align:`flex-end`,w:`100%`,h:`100%`,children:[(0,L.jsx)(d,{onClick:w,variant:`cream`,size:`lg`,"aria-label":o({id:`yz7wBu`}),children:(0,L.jsx)(R,{})}),(0,L.jsx)(u,{radius:`md`,p:`lg`,pr:0,bg:`var(--pr-primary-300)`,className:X.paper,withBorder:!0,children:(0,L.jsx)(`div`,{className:X.gridContainer,children:(0,L.jsxs)(c,{type:`auto`,mah:`70vh`,styles:{viewport:{paddingRight:20}},children:[(0,L.jsxs)(f,{mr:b?0:200,children:[(0,L.jsxs)(p,{pr:`lg`,className:X.heading,direction:`column`,align:`start`,gap:`md`,children:[(0,L.jsx)(y,{variant:`retro`,children:k}),(0,L.jsx)(m,{variant:`pr-heading-l-500`,children:t.title}),b&&(0,L.jsxs)(L.Fragment,{children:[O&&O.length>0&&(0,L.jsx)(_,{variant:`output`,style:{padding:12,width:`100%`},children:(0,L.jsx)(f,{children:(0,L.jsx)(Z,{metadata:O})})}),(0,L.jsx)(`div`,{style:{width:`100%`},children:N})]})]}),(0,L.jsx)(F,{content:t.longDescription??``})]}),!b&&(0,L.jsxs)(f,{w:180,style:{position:`absolute`,top:0,right:`var(--mantine-spacing-lg)`},children:[(0,L.jsx)(Z,{metadata:O}),N]})]})})})]})};w();var Q={card:`_card_1lb1z_7`,content:`_content_1lb1z_23`,title:`_title_1lb1z_30`,description:`_description_1lb1z_34`,footer
1:`_footer_1lb1z_39`},te=({onPropose:e})=>{let{_:t}=x();return(0,L.jsxs)(_,{className:Q.card,children:[(0,L.jsx)(`div`,{className:Q.content,children:(0,L.jsxs)(p,{direction:`column`,gap:`sm`,children:[(0,L.jsx)(m,{variant:`pr-heading-l-600`,className:Q.title,children:t({id:`NFtVIB`})}),(0,L.jsx)(m,{variant:`pr-body-m-400`,className:Q.description,children:t({id:`QgdPGZ`})})]})}),(0,L.jsx)(`div`,{className:Q.footer,children:(0,L.jsx)(g,{variant:`inverted`,size:`md`,styles:{root:{borderColor:`transparent`}},onClick:e,children:t({id:`CZ7Yn4`})})})]})},$={container:`_container_l5zx7_6`,footer:`_footer_l5zx7_13`,typeToggle:`_typeToggle_l5zx7_22`,typePill:`_typePill_l5zx7_33`,typePillLabel:`_typePillLabel_l5zx7_47`,sectorFilters:`_sectorFilters_l5zx7_63`,sectorPill:`_sectorPill_l5zx7_67`,tagPill:`_tagPill_l5zx7_92`,secondaryTag:`_secondaryTag_l5zx7_93`,canvasTypePill:`_canvasTypePill_l5zx7_91`,cardCheckboxInline:`_cardCheckboxInline_l5zx7_169`,cardCheckboxInput:`_cardCheckboxInput_l5zx7_177`,cardCheckboxIcon:`_cardCheckboxIcon_l5zx7_189`},ne=[`mini-app`,`data-canvas`,`app-canvas`];function re(e){let t=e%2,n=e%3;return{base:12,md:t===0?12:6,xl:n===0?12:12-n*4}}var ie=({challenges:e,selectedIds:t,onToggle:n,onTryOut:r,containerResponsive:i=!1,hideFilters:o=!1,hideSelection:s=!1,showProposalCard:c,onPropose:u})=>{let{_:d}=x(),[f,m]=(0,I.useState)(null),[g,_]=(0,I.useState)(null),S=new Set(e.map(e=>e.type)),C=ne.filter(e=>S.has(e)),w=!o&&C.length>1,E=(0,I.useMemo)(()=>!o&&f?e.filter(e=>e.type===f):e,[f,e,o]),D=(0,I.useMemo)(()=>{let e=new Set;for(let t of E)for(let n of t.tags)n in O&&e.add(n);return Object.keys(O).filter(t=>e.has(t))},[E]),M=!o&&D.length>=2,P=E.filter(e=>!(!o&&g&&!e.tags.includes(g)));return(0,L.jsxs)(L.Fragment,{children:[w&&(0,L.jsx)(p,{justify:`flex-start`,children:(0,L.jsxs)(a,{className:$.typeToggle,children:[(0,L.jsx)(l,{className:$.typePill,"data-active":f===null,"aria-pressed":f===null,onClick:()=>{m(null),_(null)},children:(0,L.jsx)(`span`,{className:$.typePillLabel,children:(0,L.jsx)(b,{id:`N40H-G`})})}),C.map(e=>(0,L.jsx)(l,{className:$.typePill,"data-active":f===e,"aria-pressed":f===e,onClick:()=>{m(f===e?null:e),_(null)},children:(0,L.jsxs)(p,{gap:`x3s`,align:`center`,children:[A[e],(0,L.jsx)(`span`,{className:$.typePillLabel,children:d(j[e])})]})},e))]})}),M&&(0,L.jsx)(p,{gap:`x3s`,wrap:`wrap`,className:$.sectorFilters,children:D.map(e=>(0,L.jsx)(y,{className:$.sectorPill,variant:`selectable`,"data-active":g===e,onClick:()=>_(g===e?null:e),children:d(O[e])},e))}),(0,L.jsxs)(v,{type:i?`container`:`media`,breakpoints:i?{xs:`36rem`,sm:`42rem`,md:`48rem`,lg:`62rem`,xl:`64rem`}:void 0,children:[P.map(e=>{let o=t.has(e.id),{title:c}=e,l=e.tags,u=l.find(e=>e in O),f=l.filter(e=>e!==u&&e in O);return(0,L.jsx)(v.Col,{span:i?{base:12,sm:6,xl:4}:{base:12,md:6,xl:4},children:(0,L.jsx)(a,{style:{position:`relative`,height:`100%`},children:(0,L.jsx)(N,{variant:`challenge`,canvasType:e.type,selected:o,title:e.title,subtitle:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(k,{canvasType:e.type,className:$.tagPill}),u&&(0,L.jsx)(y,{className:$.tagPill,children:d(O[u])}),f.map(e=>(0,L.jsx)(y,{className:T($.tagPill,$.secondaryTag),children:d(O[e])},e))]}),description:e.description,mih:{base:`auto`,md:280},ta:`left`,actionText:d({id:`zwWKhA`}),onActionClick:()=>r(e),footerExtra:s?void 0:(0,L.jsx)(h,{checked:o,onChange:()=>n?.(e.id),"aria-label":d({id:`135JuL`,values:{title:c}}),size:`md`,classNames:{input:$.cardCheckboxInput},className:$.cardCheckboxInline,"data-canvas-type":e.type})})})},e.id)}),c&&(0,L.jsx)(v.Col,{span:re(P.length),children:(0,L.jsx)(te,{onPropose:u})})]})]})};function ae(e){let t={id:e.id,title:e.title,description:e.description,longDescription:e.longDescription,tags:e.tags,metadata:e.defaultMetadata?.map(e=>({name:e.name,value:e.value,type:e.type}))};return e.type===`data-canvas`?{...t,type:`data-canvas`,artifactIds:[]}:e.type===`mini-app`?{...t,type:`mini-app`}:{...t,type:`app-canvas`,templateAppId:e.templateAppId??``,templateAppUsername:e.templateAppUsername??``}}export{Y as a,X as i,ie as n,z as o,ee as r,R as s,ae as t};
2//# sourceMappingURL=toChallenge.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.