@juki-team/base-ui 1.4.129 → 1.4.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/{BarChart-BnEygCik.js → BarChart-BrncFZqv.js} +1 -1
- package/dist/esm/{CartesianChart-46JvJlt2.js → CartesianChart-DiEsv39t.js} +1 -1
- package/dist/esm/{ChangePasswordModal-W7o3d5xv.js → ChangePasswordModal-CvWtkjrN.js} +1 -1
- package/dist/esm/{CodeEditor-btUZu2Dy.js → CodeEditor-DACpjrsU.js} +1 -1
- package/dist/esm/{DataGrid-C-1PcbQ9.js → DataGrid-JAYAjywD.js} +1 -1
- package/dist/esm/{DataViewer-DdoMfhBT.js → DataViewer-Dlia2oSB.js} +1 -1
- package/dist/esm/{DrawerView-C59g89Qq.js → DrawerView-BblFUJEi.js} +1 -1
- package/dist/esm/{ExcalidrawButton-7RauNqcW.js → ExcalidrawButton-Bd8SBhas.js} +1 -1
- package/dist/esm/{GraphvizViewer-Cdd3s9Pz.js → GraphvizViewer-C1mAE7rX.js} +1 -1
- package/dist/esm/{ImageLoaderCropper-By7-NpjH.js → ImageLoaderCropper-C3Cx6O53.js} +1 -1
- package/dist/esm/{InputCellPhoneNumber-BoliLbve.js → InputCellPhoneNumber-CKYa10bN.js} +1 -1
- package/dist/esm/{InputColor-B6fjWGPV.js → InputColor-Z0jOOs3H.js} +1 -1
- package/dist/esm/{LineChart-yzQzjap8.js → LineChart-EhYBGR13.js} +1 -1
- package/dist/esm/{MdMath-DcAukZc5.js → MdMath-nccHUbMO.js} +1 -1
- package/dist/esm/{MdMathEditor-Ckf7tXlp.js → MdMathEditor-CqVpGAmF.js} +1 -1
- package/dist/esm/{Popover-DOgPkWfK.js → Popover-Dd5soClw.js} +2 -2
- package/dist/esm/{SlideDeck-yImvO_hq.js → SlideDeck-ls4Av4B6.js} +1 -1
- package/dist/esm/{TableOfContents-KP3dhzIR.js → TableOfContents-s2uXSPqs.js} +1 -1
- package/dist/esm/{Tooltip-CQx5RC2x.js → Tooltip-DkuB7dhH.js} +1 -1
- package/dist/esm/{UserCodeEditor-DVycUyoi.js → UserCodeEditor-ouwZZtsS.js} +2 -2
- package/dist/esm/{VirtualizedRowsFixed-CJRctik-.js → VirtualizedRowsFixed-B2F4OHWB.js} +1 -1
- package/dist/esm/{WorksheetAsSlides-33duB_50.js → WorksheetAsSlides-DERDrU2H.js} +1 -1
- package/dist/esm/{WorksheetBodies-Ptk1_moK.js → WorksheetBodies-CV7eAr61.js} +1 -1
- package/dist/esm/{WorksheetContents-WKXb5Uk4.js → WorksheetContents-Lm-_CdZ2.js} +1 -1
- package/dist/esm/{WorksheetEditor-z9ucL22I.js → WorksheetEditor-bWlxdb29.js} +1 -1
- package/dist/esm/{WorksheetNode-DdlERlmz.js → WorksheetNode-DEOXUEQe.js} +1 -1
- package/dist/esm/{WorksheetViewer-C8lplKFc.js → WorksheetViewer-lBAniTnA.js} +1 -1
- package/dist/esm/{architectureDiagram-3BPJPVTR-mkUe-O1b.js → architectureDiagram-3BPJPVTR-CTb5ayIp.js} +1 -1
- package/dist/esm/{blockDiagram-GPEHLZMM-DI6f452i.js → blockDiagram-GPEHLZMM-D4uFUU-G.js} +1 -1
- package/dist/esm/{c4Diagram-AAUBKEIU-CprJ4eDK.js → c4Diagram-AAUBKEIU-CAZLWuPq.js} +1 -1
- package/dist/esm/channel-D5EOmDMD.js +1 -0
- package/dist/esm/{chunk-2J33WTMH-CRrW12Q1.js → chunk-2J33WTMH-HhOFj0bf.js} +1 -1
- package/dist/esm/{chunk-4BX2VUAB-DP1enpjM.js → chunk-4BX2VUAB-CEdoBw7_.js} +1 -1
- package/dist/esm/{chunk-55IACEB6-Qy7BShb8.js → chunk-55IACEB6-aJ-Std67.js} +1 -1
- package/dist/esm/{chunk-727SXJPM-DCaL4Ssn.js → chunk-727SXJPM-CR7TtBVZ.js} +1 -1
- package/dist/esm/{chunk-AQP2D5EJ-MvQ9vOa8.js → chunk-AQP2D5EJ-K2Leo-fb.js} +1 -1
- package/dist/esm/{chunk-FMBD7UC4-C_QBV__I.js → chunk-FMBD7UC4-a15wpTbq.js} +1 -1
- package/dist/esm/{chunk-ND2GUHAM-Cz6MG9Ip.js → chunk-ND2GUHAM-3yBxVPAC.js} +1 -1
- package/dist/esm/{chunk-QZHKN3VN-CNeKC3i9.js → chunk-QZHKN3VN-BQxiWiUu.js} +1 -1
- package/dist/esm/{classDiagram-4FO5ZUOK-CIl1HCsD.js → classDiagram-4FO5ZUOK-Bp3azMO2.js} +1 -1
- package/dist/esm/{classDiagram-v2-Q7XG4LA2-CIl1HCsD.js → classDiagram-v2-Q7XG4LA2-Bp3azMO2.js} +1 -1
- package/dist/esm/{contest--aeYKKxf.js → contest-D0dFHHYS.js} +1 -1
- package/dist/esm/{cose-bilkent-S5V4N54A-BU_DfNnH.js → cose-bilkent-S5V4N54A-CF9x8P1X.js} +1 -1
- package/dist/esm/{dagre-BM42HDAG-B0jhlami.js → dagre-BM42HDAG-oa0J1DaE.js} +1 -1
- package/dist/esm/{diagram-2AECGRRQ-BoG6bCz0.js → diagram-2AECGRRQ-BuuG-RoB.js} +1 -1
- package/dist/esm/{diagram-5GNKFQAL-CmPEF4Gb.js → diagram-5GNKFQAL-CZujtOen.js} +1 -1
- package/dist/esm/{diagram-KO2AKTUF-otFu6fY1.js → diagram-KO2AKTUF-0KbELqZI.js} +1 -1
- package/dist/esm/{diagram-LMA3HP47-BNvQPERF.js → diagram-LMA3HP47-DVhy52x2.js} +1 -1
- package/dist/esm/{diagram-OG6HWLK6-GT5ck18c.js → diagram-OG6HWLK6-BBVpceTq.js} +1 -1
- package/dist/esm/{erDiagram-TEJ5UH35-DOTojUvv.js → erDiagram-TEJ5UH35-BHbfbqIk.js} +1 -1
- package/dist/esm/{flowDiagram-I6XJVG4X-DMNWQIoP.js → flowDiagram-I6XJVG4X-BaMVJs2u.js} +1 -1
- package/dist/esm/{ganttDiagram-6RSMTGT7-UueSCT2P.js → ganttDiagram-6RSMTGT7-DOUe8voF.js} +1 -1
- package/dist/esm/{gitGraphDiagram-PVQCEYII-BMejzE3B.js → gitGraphDiagram-PVQCEYII-Dyj0XEJk.js} +1 -1
- package/dist/esm/helpers.js +1 -1
- package/dist/esm/{index-2vw3cISu.js → index-BCzXl-MX.js} +1 -1
- package/dist/esm/index-DGfNHv1x.js +2 -0
- package/dist/esm/{infoDiagram-5YYISTIA-BSxjrZJf.js → infoDiagram-5YYISTIA-Boua4Tr8.js} +1 -1
- package/dist/esm/{ishikawaDiagram-YF4QCWOH-B2-9liDF.js → ishikawaDiagram-YF4QCWOH-BS_A_XBz.js} +1 -1
- package/dist/esm/{journeyDiagram-JHISSGLW-DBQd4ic_.js → journeyDiagram-JHISSGLW-YyjHX0yV.js} +1 -1
- package/dist/esm/{kanban-definition-UN3LZRKU-DFolGaRv.js → kanban-definition-UN3LZRKU-CcKCIal8.js} +1 -1
- package/dist/esm/main.js +1 -1
- package/dist/esm/{mermaid.core-EsBL2ECN.js → mermaid.core-QpTfboNw.js} +1 -1
- package/dist/esm/{mindmap-definition-RKZ34NQL-BIQZzlCy.js → mindmap-definition-RKZ34NQL-DjxxY08j.js} +1 -1
- package/dist/esm/{pieDiagram-4H26LBE5-DZBAcvRC.js → pieDiagram-4H26LBE5-Bu-BmZ8n.js} +1 -1
- package/dist/esm/{quadrantDiagram-W4KKPZXB-b5MVV3Rk.js → quadrantDiagram-W4KKPZXB-fK1bxThQ.js} +1 -1
- package/dist/esm/{requirementDiagram-4Y6WPE33-CLn9X-PZ.js → requirementDiagram-4Y6WPE33-D-96v_3q.js} +1 -1
- package/dist/esm/{sankeyDiagram-5OEKKPKP-D4-b_g7U.js → sankeyDiagram-5OEKKPKP-ZTvdQYzE.js} +1 -1
- package/dist/esm/{sequenceDiagram-3UESZ5HK-CCdY9Q3W.js → sequenceDiagram-3UESZ5HK-BFEtohrX.js} +1 -1
- package/dist/esm/{stateDiagram-AJRCARHV-BSMAHoem.js → stateDiagram-AJRCARHV-DWxVmIWt.js} +1 -1
- package/dist/esm/{stateDiagram-v2-BHNVJYJU-BeJ_O1Tl.js → stateDiagram-v2-BHNVJYJU-DnOatqpE.js} +1 -1
- package/dist/esm/{timeline-definition-PNZ67QCA-o-UlOwfU.js → timeline-definition-PNZ67QCA-FvMo_PxT.js} +1 -1
- package/dist/esm/{types-TNt9NcVE.js → types-DG_vw3We.js} +1 -1
- package/dist/esm/{vennDiagram-CIIHVFJN-CySj1ueN.js → vennDiagram-CIIHVFJN-DzI_A9Cl.js} +1 -1
- package/dist/esm/{wardleyDiagram-YWT4CUSO-B7YSHlE3.js → wardleyDiagram-YWT4CUSO-ClMyoKY9.js} +1 -1
- package/dist/esm/{xychartDiagram-2RQKCTM6-D6EqpoC5.js → xychartDiagram-2RQKCTM6-Cy92WO7L.js} +1 -1
- package/dist/module-types/src/components/helpers/problem.d.ts +11 -0
- package/package.json +3 -3
- package/dist/esm/channel-B3QafhkE.js +0 -1
- package/dist/esm/index-MXDpbG5L.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{u as t}from"./index-CHdwVvPu.js";import{memo as s,useRef as r,useCallback as o}from"react";import{dd as i}from"./index-
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{u as t}from"./index-CHdwVvPu.js";import{memo as s,useRef as r,useCallback as o}from"react";import{dd as i}from"./index-DGfNHv1x.js";import"react-dom";import"./ViewModuleIcon-CBJGd2NB.js";import"./index-P3Cb0cjc.js";import"./settings-DgLs6IK_.js";import"./enums.js";import"./date-D28INXpp.js";import"./time-BHcZPeyw.js";import"./contest-D0dFHHYS.js";import"./worksheet-BBAH_yZC.js";import"motion/react";import"./index-Dwi3ag-n.js";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"ably/react";import"@ably/spaces/dist/mjs/react";function a(s){const{rowHeight:a,size:m,renderRow:l,classNameContainer:n,classNameRows:c,classNameRow:p,getRowKey:d}=s,w=r(null),h=i(d),u=t({count:m,estimateSize:o(()=>a,[a]),overscan:5,getScrollElement:o(()=>w.current,[]),getItemKey:o(e=>{const t=h.current;return t?t(e):e},[h])});return e("div",{ref:w,style:{height:"100%",width:"100%",overflow:"auto"},className:n,children:e("div",{className:c,style:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"},children:u.getVirtualItems().map(t=>e("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:`${t.size}px`,transform:`translateY(${t.start}px)`},className:p,children:l(t.index)},t.key))})})}var m=s(a,(e,t)=>e.rowHeight===t.rowHeight&&e.size===t.size&&e.renderRow===t.renderRow&&e.classNameContainer===t.classNameContainer&&e.classNameRows===t.classNameRows&&e.classNameRow===t.classNameRow);export{a as VirtualizedRowsFixed,m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useMemo as a}from"react";import{x as o,q as s}from"./index-P3Cb0cjc.js";import{dk as i,cL as r,q as n,ai as m}from"./index-
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useMemo as a}from"react";import{x as o,q as s}from"./index-P3Cb0cjc.js";import{dk as i,cL as r,q as n,ai as m}from"./index-DGfNHv1x.js";import{g as d,W as l}from"./WorksheetNode-DEOXUEQe.js";import"./settings-DgLs6IK_.js";import"./enums.js";import"./ViewModuleIcon-CBJGd2NB.js";import"./date-D28INXpp.js";import"./time-BHcZPeyw.js";import"./contest-D0dFHHYS.js";import"./worksheet-BBAH_yZC.js";import"motion/react";import"react-dom";import"./index-Dwi3ag-n.js";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"ably/react";import"@ably/spaces/dist/mjs/react";import"./worksheet-GN3yGKYw.js";import"./SettingsIcon-DM1F7UIb.js";import"./index-CroDROK5.js";import"./worksheet-DTRmzBjG.js";import"./ArrowForwardIcon-IN9agpuQ.js";function p(p){const{worksheet:{content:c,quiz:{enable:u},key:g,slides:h},resultsUserKey:j,readOnly:k=!1,page:y}=p,b=i(e=>e.user.nickname),f=i(e=>e.organization.key),w=i(e=>e.user.isLogged),{data:x,mutate:v,isLoading:I,isValidating:S}=r(g&&u&&w?o.apiV2.worksheet.getSubmissionsUser({params:{key:g,userKey:j||s(b,f)}}).url:null),q=a(()=>({data:x?.success?x.content:void 0,isLoading:I,isValidating:S,mutate:v}),[x,I,S,v]);let L=a(()=>d(c),[c]);if("number"==typeof y&&y>=0&&y<L.length&&L[y]){L=[L[y]]}return L.map(a=>[[e("section",{"data-auto-animate":!0,style:{overflow:"hidden auto",maxHeight:"100%"},"data-background-image":h.titleBackgroundImage,children:[t(n,{name:"WorksheetAsSlides"}),t(m,{source:a.header.title,detectRequestAnimationFrame:!0})]},a.header.id+a.header.title)],a.content.map((e,o)=>t("section",{"data-auto-animate":!0,style:{overflow:"hidden auto",maxHeight:"100%"},"data-background-image":h.backgroundImage,children:t(l,{sheet:a.content,userResults:q,readOnly:k,isSolvable:u,worksheetKey:g,asSlides:!0,index:o,length:a.content.length})},e.id))]).flat(2)}export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{Children as s,useRef as o,useState as n,useCallback as r}from"react";import{QueryParamKey as a}from"./enums.js";import{b4 as i,aj as l,b as c}from"./index-
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{Children as s,useRef as o,useState as n,useCallback as r}from"react";import{QueryParamKey as a}from"./enums.js";import{b4 as i,aj as l,b as c}from"./index-DGfNHv1x.js";import{p as d}from"./ViewModuleIcon-CBJGd2NB.js";import{S as h}from"./SettingsIcon-DM1F7UIb.js";import{d as p}from"./index-P3Cb0cjc.js";import{W as m,A as u,E as f,i as k,a as g,b as w,c as j}from"./WorksheetNode-DEOXUEQe.js";import{g as S}from"./worksheet-BBAH_yZC.js";import{N as v}from"./worksheet-GN3yGKYw.js";import{F as y}from"./contest-D0dFHHYS.js";function b(o){const{ref:n,sheetPage:r,setSheet:a,userResults:i,readOnly:l,isSolvable:c,worksheetKey:d,children:h,asSlides:f}=o;return e("div",{className:p("jk-col center nowrap wh-100 jk-br-ie",{"ow-hn":!a}),id:"jk-worksheet-body",ref:n,children:[!!r.header.title&&!a&&t(m,{worksheetKey:d,sheet:[{type:S.JK_MD,content:r.header.title,id:"",title:"",points:0}],index:0,length:1,readOnly:!0,isSolvable:!1}),s.toArray(r.content.map((e,s)=>t(m,{sheet:r.content,setSheet:a,userResults:i,readOnly:l,isSolvable:c,worksheetKey:d,asSlides:f,index:s,length:r.content.length},e.id))),!r.content.length&&a&&t("div",{className:"jk-row gap extend nowrap center jk-divider tiny",children:t(u,{index:0,setSheet:a,mdSheet:!0,codeEditorSheet:!0,graphSheet:!0,quizProblemSheet:!0,quizOptionsSheetType:!0,pageDivider:!0,compacted:!0,floatToolbarPlacement:"bottom"})}),h]})}const x=s=>{const{sheetsInPages:m,isEditor:u,setSheets:S,userResults:x,isSolvable:C,worksheetKey:N,page:O,onPageChange:P,lastPageChildren:A,readOnly:E}=s,K=o(null),[R,z]=n(!1),F=r((e,t)=>{const s=[...m];s[O-1]={header:e??s[O-1]?.header??v(),content:t};const o=[];for(const{header:e,content:t}of s)o.push(e,...t);S?.(o)},[O,S,m]),I=r(e=>{const t="function"==typeof e?e(m[O-1]?.content??[]):e;F(null,t)},[O,F,m]),M=m.length,W=m[O-1];return W?e("div",{className:p("jk-col gap nowrap top stretch extend worksheet-bodies wh-100",{"is-solvable":C}),children:[S&&e("div",{className:"jk-row gap extend nowrap",children:[t(i,{className:"tt-se",children:"page title"}),t(l,{value:W.header.title,onChange:e=>{F({...W.header,title:e},W.content)}}),t(c,{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"remove page divider",icon:t(d,{}),onClick:()=>{const e=[...m],t=[];if(O===M){let s=0;for(const{header:o,content:n}of e)s!==O-1&&t.push(o),t.push(...n),s++;S(t)}else{let s=0,o=null;for(const{header:n,content:r}of e)s===O-1?o=r:(t.push(n),null!==o&&(t.push(...o),o=null),t.push(...r)),s++;S(t)}O>1&&O===M&&P(Math.max(O,1),1,{name:a.PAGE_FOCUS,value:"jk-worksheet-viewer-container"})},disabled:M<=1}),t(c,{icon:t(h,{size:"small"}),onClick:()=>z(!0)})]},`${O}`),S&&t(f,{isOpen:R,onClose:()=>z(!1),content:W.content,setContent:I,isValid:e=>{if(y(e)){const t=JSON.parse(e);if(Array.isArray(t))return t.every(e=>k(e)||g(e)||w(e)||j(e))}return!1}}),t(b,{sheetPage:W,setSheet:S?I:void 0,userResults:x,readOnly:!!E,isSolvable:C,isEditor:u,worksheetKey:N,ref:K}),O<M?t(c,{className:"next-button",type:"secondary",onClick:()=>P(O+1,1,{name:a.PAGE_FOCUS,value:"jk-worksheet-viewer-container"}),expand:!0,children:t(i,{className:"tt-se",children:"next page"})}):A]}):null};export{x as W};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as s}from"react/jsx-runtime";import{useState as r}from"react";import{QueryParamKey as o}from"./enums.js";import{al as a,b4 as t,r as n}from"./index-
|
|
1
|
+
import{jsx as e,jsxs as s}from"react/jsx-runtime";import{useState as r}from"react";import{QueryParamKey as o}from"./enums.js";import{al as a,b4 as t,r as n}from"./index-DGfNHv1x.js";import{c as i,aB as c}from"./ViewModuleIcon-CBJGd2NB.js";import{A as m}from"./ArrowForwardIcon-IN9agpuQ.js";import{d as l}from"./index-P3Cb0cjc.js";import{T as p}from"./TableOfContents-s2uXSPqs.js";import"./contest-D0dFHHYS.js";import"./settings-DgLs6IK_.js";import"./date-D28INXpp.js";import"./worksheet-BBAH_yZC.js";import"motion/react";import"react-dom";import"./index-Dwi3ag-n.js";import"./time-BHcZPeyw.js";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"ably/react";import"@ably/spaces/dist/mjs/react";const d=r=>{const{sheetsInPages:o,isOpen:n,onClose:i,page:c,subPage:m,onPageChange:l}=r;return e(a,{isOpen:n,onClose:i,closeIcon:!1,children:s("div",{className:"jk-col stretch",children:[e("div",{className:"jk-row bc-at jk-pg-sm",children:e(t,{className:"tt-se fw-bd cr-we",children:"table of content"})}),e(p,{page:c,subPage:m,sheetsInPages:o,onPageChange:l})]})})};function j(a){const{page:p,subPage:j,onPageChange:g,sheetsInPages:h}=a,[b,k]=r(!1),w=h.length;return s("div",{className:"jk-col stretch gap bc-sf-md jk-br-ie cr-tx-ht-dk fw-bd",children:[e(d,{page:p,subPage:j,isOpen:b,onPageChange:g,onClose:()=>k(!1),sheetsInPages:h}),s("div",{className:"jk-row gap center",children:[s(n,{onClick:p<=1?void 0:()=>g(p-1,1,{name:o.PAGE_FOCUS,value:"jk-worksheet-viewer-container"}),className:l("jk-row gap jk-pg-xsm jk-br-ie",{"cr-tx-ds":p<=1,"cr-pr hoverable":!(p<=1)}),onKeyDownClick:!0,children:[e(i,{}),e(t,{className:"tt-se",children:"previous"})]}),s(n,{className:"jk-row cr-pr hoverable jk-br-ie jk-pg-xsm",onClick:()=>k(!0),onKeyDownClick:!0,children:[e(c,{}),e(t,{className:"tt-se",children:"table of contents"})]}),s(n,{onClick:p===w?void 0:()=>g(p+1,1,{name:o.PAGE_FOCUS,value:"jk-worksheet-viewer-container"}),className:l("jk-row gap jk-pg-xsm jk-br-ie",{"cr-tx-ds":p===w,"cr-pr hoverable":!(p===w)}),onKeyDownClick:!0,children:[e(t,{className:"tt-se",children:"next"}),e(m,{})]})]})]})}export{j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useMemo as r}from"react";import{da as s,df as o,bA as a}from"./index-
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useMemo as r}from"react";import{da as s,df as o,bA as a}from"./index-DGfNHv1x.js";import{W as i}from"./WorksheetBodies-CV7eAr61.js";import{g as m}from"./WorksheetNode-DEOXUEQe.js";import"./ViewModuleIcon-CBJGd2NB.js";import"./index-P3Cb0cjc.js";import"./settings-DgLs6IK_.js";import"./enums.js";import"./date-D28INXpp.js";import"./time-BHcZPeyw.js";import"./contest-D0dFHHYS.js";import"./worksheet-BBAH_yZC.js";import"motion/react";import"react-dom";import"./index-Dwi3ag-n.js";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"ably/react";import"@ably/spaces/dist/mjs/react";import"./SettingsIcon-DM1F7UIb.js";import"./worksheet-GN3yGKYw.js";import"./index-CroDROK5.js";import"./worksheet-DTRmzBjG.js";import"./ArrowForwardIcon-IN9agpuQ.js";function n(n){const{worksheet:{content:p,quiz:{enable:c},key:d,user:{isManager:l}},setContent:j,page:g,subPage:h,onPageChangeRef:b,lastPageChildren:k,readOnly:w=!1}=n,u=s(e=>e.setSearchParams),[P,y]=o(g??1),[f,x]=o(h??1),C=b??((e,t,r)=>{y(e),x(t),u(r)}),I=r(()=>m(p),[p]);return e("div",{className:"jk-col gap nowrap worksheet-editor-container center top",children:[t("div",{className:"jk-row",children:t(a,{page:P,subPage:f,onPageChange:C,sheetsInPages:I})}),t(i,{sheetsInPages:I,setSheets:j,isSolvable:c,readOnly:w,isEditor:l,worksheetKey:d,page:P,subPage:f,onPageChange:C,lastPageChildren:k})]})}export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as s}from"react/jsx-runtime";import{useState as n,useEffect as l,useRef as a,Children as i,Fragment as o}from"react";import{a8 as c,ac as r,aw as d,b as h,d as p,b4 as m,ak as u,df as g,al as b,a6 as k,Z as y,an as v,a0 as w,bl as C,cW as N,da as f,r as j,L as S,dd as O,N as x,P as I,d5 as P,aj as K,a7 as E,a4 as A,G as D,as as L,aH as T,aK as R,K as z,q as M}from"./index-MXDpbG5L.js";import{C as _,d as J,x as V}from"./index-P3Cb0cjc.js";import{g as B,b as Q,E as U,a as Z,c as G,e as F,d as W,A as q,W as H,f as $,D as X,Q as Y,v as ee,R as te}from"./worksheet-BBAH_yZC.js";import{aa as se,p as ne,d as le,ae,j as ie,aD as oe,E as ce,g as re,an as de,h as he,c as pe,C as me}from"./ViewModuleIcon-CBJGd2NB.js";import{N as ue}from"./worksheet-GN3yGKYw.js";import{E as ge,S as be,g as ke,f as ye,F as ve,b as we,P as Ce}from"./contest--aeYKKxf.js";import{S as Ne,A as fe}from"./SettingsIcon-DM1F7UIb.js";import{A as je,S as Se}from"./index-CroDROK5.js";import{QueryParamKey as Oe}from"./enums.js";import{g as xe}from"./worksheet-DTRmzBjG.js";import{A as Ie}from"./ArrowForwardIcon-IN9agpuQ.js";import{C as Pe}from"./settings-DgLs6IK_.js";const Ke=e=>{const t=[...e];t[0]?.type!==B.NEW_PAGE&&t.unshift(ue());let s=t[0],n=[];const l=[];for(let e=1;e<t.length;e++){const a=t[e];a.type===B.NEW_PAGE?(l.push({header:s,content:[...n]}),s=a,n=[]):n.push(a)}return l.push({header:s,content:[...n]}),l},Ee=e=>{if("object"!=typeof e||null===e)return!1;const t=e;return"string"==typeof t.id&&!!t.id&&Object.values(B).includes(t.type)&&"string"==typeof t.title&&"number"==typeof t.points},Ae=e=>{if(!Ee(e))return!1;const t=e;return e.type===B.JK_MD&&"string"==typeof t.content},De=e=>{if(!Ee(e))return!1;const t=e;return e.type===B.CODE_EDITOR&&"object"==typeof t.sourceCode&&null!==t.sourceCode&&"object"==typeof t.testCases&&null!==t.testCases&&Array.isArray(t.languages)&&"number"==typeof t.height},Le=e=>{if("object"!=typeof e||null===e)return!1;const t=e;return Ee(e)&&e.type===B.QUIZ_PROBLEM&&Object.values(c).includes(t.problemJudge)||"string"==typeof t.problemJudge&&"string"==typeof t.problemKey&&Array.isArray(t.languages)&&"number"==typeof t.height},Te=e=>{if(!Ee(e))return!1;const t=e;return e.type===B.QUIZ_OPTIONS&&"string"==typeof t.description&&Array.isArray(t.options)&&t.options.every(e=>{if("object"!=typeof e||null===e)return!1;const t=e;return"string"==typeof t.label&&"boolean"==typeof t.correct&&"string"==typeof t.id})&&"boolean"==typeof t.multiple&&("TOTAL"===t.scoringMode||"PARTIAL"===t.scoringMode)},Re=s=>{const{index:n,setSheet:l,mdSheet:a,codeEditorSheet:i,graphSheet:o,listSheet:c,quizProblemSheet:u,pageDivider:g,compacted:b,quizOptionsSheetType:k,floatToolbarPlacement:y}=s,v=[];if(a){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,Q()),t})};v.push({...r("tiny")[B.JK_MD],onClick:e})}if(i){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,U()),t})};v.push({...r("tiny")[B.CODE_EDITOR],onClick:e})}if(o){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,Z()),t})};v.push({...r("tiny")[B.GRAPH],onClick:e})}if(c){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,G()),t})};v.push({...r("tiny")[B.LIST],onClick:e})}if(u){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,F()),t})};v.push({...r("tiny")[B.QUIZ_PROBLEM],onClick:e})}if(k){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,W()),t})};v.push({...r("tiny")[B.QUIZ_OPTIONS],onClick:e})}if(g){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,ue()),t})};v.push({...r("tiny")[B.NEW_PAGE],onClick:e})}return e("div",{className:"jk-row gap",children:[b&&t(d,{content:t("div",{className:"jk-col gap",children:v.map(({icon:e,onClick:s,label:n})=>t(p,{icon:e,size:"tiny",expand:!0,onClick:s,children:t(m,{children:n})},n))}),offset:8,placement:y,children:t(h,{icon:t(se,{}),size:"small"})}),!b&&v.map(({icon:e,label:s,onClick:n})=>t(h,{size:"small",icon:e,onClick:n,children:s},s))]})},ze=({content:e})=>!!e.title&&t(u,{source:e.title}),Me=s=>{const{isOpen:n,onClose:l,content:a,setContent:i,isValid:o}=s,[c,r]=g(n&&ge(a)?JSON.stringify(a,null,2):"");return t(b,{isOpen:n,onClose:l,children:e("div",{className:"jk-col gap jk-pg stretch",children:[t(k,{className:"wh-100",size:"auto",value:c,onChange:r}),e("div",{className:"jk-row-col gap right",children:[t(h,{onClick:l,type:"secondary",children:t(m,{className:"tt-se",children:"close"})}),t(h,{disabled:!o(c),onClick:()=>{if(o(c)){const e=JSON.parse(c);i(e),l()}},children:t(m,{className:"tt-se",children:"save"})})]})]})})},_e=({index:e,length:s,onChange:n})=>{const l=[];return 0!==e&&l.push({icon:t(je,{}),size:"tiny",label:t(m,{className:"tt-se",children:"move up"}),onClick:()=>{n(t=>{const s=[...t],n=s[e-1];return s[e]&&n&&([s[e],s[e-1]]=[n,s[e]]),s})},disabled:0===e}),l.push({icon:t(ne,{}),size:"tiny",label:t(m,{className:"tt-se",children:"remove"}),onClick:()=>{n(t=>t.filter((t,s)=>s!==e))}}),e!==s-1&&l.push({icon:t(le,{}),size:"tiny",label:t(m,{className:"tt-se",children:"move down"}),onClick:()=>{n(t=>{const s=[...t],n=s[e+1];return s[e]&&n&&([s[e],s[e+1]]=[n,s[e]]),s})},disabled:e===s-1}),l},Je=s=>{const{type:n,edit:l,index:a,sheetLength:i,setSheet:o,setModal:c,onSaveEdit:d,onCancel:p}=s;return[{children:e("div",{className:"bc-at-lt cr-at-it jk-pg-xsm jk-row gap nowrap jk-br-ie tx-t ws-np",style:{opacity:.6},children:[r("tiny")[n].icon,r("tiny")[n].label]})},...d&&p?l?[{icon:t(oe,{size:"small"}),children:e("div",{className:" jk-col gap stretch",children:[t(h,{size:"small",icon:t(ae,{}),onClick:d,children:t(m,{className:"tt-se",children:"save"})}),t(h,{size:"small",type:"secondary",icon:t(ie,{}),onClick:p,children:t(m,{className:"tt-se",children:"cancel"})})]}),placement:"left-start"}]:[{icon:t(ce,{size:"small"}),children:void 0,onClick:d,"data-tooltip-id":"jk-tooltip","data-tooltip-content":"edit","data-tooltip-place":"left",placement:"left-start"}]:[],{icon:t(Se,{className:"cr-we",up:!0,down:!0}),size:"tiny",buttons:_e({index:a,length:i,onChange:e=>o?.(t=>e(t))}),placement:"left-start"},{icon:t(Ne,{}),onClick:()=>c(!0),size:"tiny","data-tooltip-id":"jk-tooltip","data-tooltip-content":"view settings","data-tooltip-place":"left"}]},Ve=({content:s,setContent:n,isSolvable:l})=>e("div",{className:"jk-col gap stretch left jk-pg-sm br-ht jk-br-ie wh-100",children:[t(y,{label:t(m,{className:"tt-se",children:"title"}),labelPlacement:"top",value:s.title,onChange:e=>n(t=>({...t,title:e})),expand:!0}),l&&t(y,{type:"number",label:t(m,{className:"tt-se",children:"points"}),labelPlacement:"top",value:s.points,onChange:e=>n(t=>({...t,points:e})),expand:!0}),e("div",{className:"jk-row gap wh-100",children:[e("div",{className:"flex-1",children:[t(m,{className:"fw-bd tt-se",children:"languages"}),":",t(v,{options:q.map(e=>({value:e,label:_[e].label})),selectedOptions:s.languages?.map(e=>({value:e})),onChange:e=>n(t=>({...t,languages:e.map(e=>e.value)})),expand:!0})]}),e("div",{children:[e("div",{className:"jk-row gap space-between",children:[e("div",{children:[t(m,{className:"fw-bd tt-se",children:"height"}),":"]}),t(w,{checked:0===s.height,label:t(m,{children:"auto"}),onChange:e=>n(t=>({...t,height:e?0:H}))})]}),0!==s.height&&e("div",{className:"jk-row",children:[t(y,{type:"number",value:s.height,onChange:e=>n(t=>({...t,height:Math.abs(e)})),size:"auto"}),t(m,{children:"px"})]})]})]}),t("div",{style:{height:H},className:"jk-row wh-100",children:t(C,{storeKey:`${s.id}_edit`,initialFiles:s.files,onTestCasesChange:e=>n(t=>({...t,testCases:e})),onFilesChange:e=>n(t=>({...t,files:e})),initialTestCases:s.testCases,languages:s.languages.map(e=>({value:e,label:_[e]?.label||e})),enableAddSampleCases:!0})})]}),Be=o=>{const{content:c,worksheetKey:r,chunkId:d,userResults:h,readOnly:u,isSolvable:g}=o,{notifyResponse:b}=N(),k=f(e=>e.searchParams),[y,v]=n(0),w=h?.data?.submissions[B.CODE_EDITOR]?.[d]??[];l(()=>{v(0)},[h?.data?.user.nickname]);const S=w.length,O=S-y-1,x=w[O]?.files??c.files,I=a(void 0),P=async(e,t)=>{I.current?.(be.LOADING),v(0);const s={type:B.CODE_EDITOR,id:c.id,files:e,testCases:t},n=k.get(Oe.ASSIGNMENT),{url:l,...a}=V.apiV2.worksheet.submitCodeEditor({params:{worksheetKey:r,secondaryKey:n??""},body:s}),i=ke(await ye(l,a));await(h?.mutate?.()),b(i,I.current)};return t("div",{className:"jk-col stretch flex-1 gap",children:t("div",{style:{height:xe(c.height,""),minWidth:200,width:"100%"},className:"jk-row",children:t(C,{withoutRunCodeButton:u,readOnly:u,initialFiles:x,initialTestCases:w[O]?.testCases??c.testCases,languages:c.languages.map(e=>({value:e,label:_[e]?.label||e})),storeKey:`${c.id}_view`,enableAddCustomSampleCases:!0,onCodeRunStatusChange:(e,{files:t,testCases:s})=>{e===$.COMPLETED&&g&&P(t,s)},centerButtons:({runner:{testCases:n}={testCases:{}},files:l})=>{const a=[];return!u&&g&&a.push(t(p,{size:"tiny",onClick:()=>P(l,n),setLoaderStatusRef:e=>I.current=e,children:t(m,{className:"tt-se",children:"save"})},"save")),a.push(e("div",{className:"jk-row bc-ht-lt jk-br-ie",children:[t(j,{className:J("clickable br-50-pc jk-row",{"cr-ht":0===S}),onClick:S?()=>v(e=>(e+1)%S):void 0,onKeyDownClick:!0,children:t(re,{})}),h?.isLoading?t(de,{}):e(s,{children:[O+1," / ",S,t(m,{children:"v."})]}),t(j,{className:J("clickable br-50-pc jk-row",{"cr-ht":0===S}),onClick:S?()=>v(e=>(e-1+S)%S):void 0,onKeyDownClick:!0,children:t(he,{})})]},"buttons")),t("div",{className:"jk-row gap",children:i.toArray(a)})}})})})},Qe=s=>{const{content:l,setContent:i,index:o,chunkId:c,sheetLength:r,setSheet:d,worksheetKey:h,isSolvable:p,userResults:m,readOnly:u}=s,[g,b]=n(!1),k=a(null);return e("div",{ref:k,className:"jk-row top left nowrap stretch jk-br-ie pn-re wh-100",children:[i&&t(Me,{isOpen:g,onClose:()=>b(!1),content:l,setContent:i,isValid:e=>ve(e)&&De(JSON.parse(e))}),i?t(Ve,{content:l,setContent:i,isSolvable:p}):e("div",{className:"jk-col stretch gap nowrap code-editor-sheet-section-view wh-100",children:[t(ze,{content:l}),t(Be,{content:l,worksheetKey:h,chunkId:c,userResults:m,readOnly:u,isSolvable:p})]}),d&&t(S,{actionButtons:Je({type:B.CODE_EDITOR,edit:!0,setModal:b,index:o,sheetLength:r,setSheet:d}),placement:"right-end",outer:!0})]})},Ue=(e,t,s)=>{const n=O(s);l(()=>{const s=s=>{t&&e.current&&!e.current.contains(s.target)&&n.current()};return document.addEventListener("mousedown",s),()=>{document.removeEventListener("mousedown",s)}},[t])},Ze=({content:s,setContent:l})=>{const[a,i]=n(0);return e("div",{className:"jk-col stretch left wh-100 jk-pg-sm br-ht jk-br-ie",children:[t(y,{label:t(m,{className:"tt-se",children:"title"}),labelPlacement:"top",value:s.title,onChange:e=>l(t=>({...t,title:e})),expand:!0}),s.dots?.[a]&&t(x,{value:s.dots[a],onSave:e=>{const t=[...s.dots];t.splice(a,1,e),l({...s,dots:t})}}),e("div",{className:"jk-row gap center",children:[t(h,{icon:t(pe,{}),disabled:0===a,onClick:()=>i((a-1+s.dots.length)%s.dots.length),size:"small"}),new Array(s.dots.length).fill(1).map((e,s)=>t(j,{className:J("jk-tag clickable",{"bc-sf-hi":s!==a}),onClick:()=>i(s),onKeyDownClick:!0,children:s+1},s)),t(h,{icon:t(Ie,{}),disabled:a>=s.dots.length-1,onClick:()=>i((a+1)%s.dots.length),size:"small"})]}),e("div",{className:"jk-row gap nowrap",children:[t(h,{icon:t(pe,{}),onClick:()=>{const e=[...s.dots];e.splice(a,0,X),l({...s,dots:e})},size:"small",children:t(fe,{})}),t(h,{icon:t(ne,{}),onClick:()=>{const e=[...s.dots];e.splice(a,1),l({...s,dots:e})},size:"small",type:"secondary"}),t(h,{icon:t(fe,{}),onClick:()=>{const e=[...s.dots];e.splice(a+1,0,X),l({...s,dots:e}),i(a+1)},size:"small",children:t(Ie,{})})]})]})},Ge=({content:s,setSheet:a})=>{const[i,o]=n(0);return l(()=>{s.dots.length||a?.(e=>({...e,dots:['digraaph graph_name {\n bgcolor="transparent"\n a -> b;\n b -> c;\n a -> d;\n d -> c;\n a -> c;\n}']}))},[a,s.dots.length]),e("div",{className:"jk-col gap",children:[t("div",{className:"br-hl jk-br-ie bc-sf-md",children:s.dots?.[i]&&t(I,{dot:s.dots[i]})}),e("div",{className:"jk-row gap center",children:[t(h,{icon:t(pe,{}),disabled:0===i,onClick:()=>o((i-1+s.dots.length)%s.dots.length),size:"small"}),new Array(s.dots.length).fill(1).map((e,s)=>t(j,{className:J("jk-tag clickable",{"bc-sf-hi":s!==i}),onClick:()=>o(s),onKeyDownClick:!0,children:s+1},s)),t(h,{icon:t(Ie,{}),disabled:i>=s.dots.length-1,onClick:()=>o((i+1)%s.dots.length),size:"small"})]})]})},Fe=s=>{const{content:l,setContent:i,index:o,sheetLength:c,setSheet:r}=s,[d,h]=n(!1),[p,m]=n(!1),[u,b]=g(l),k=a(null),y=()=>{h(!d),i?.(u)};Ue(k,d,y);const v=i?b:void 0;return e("div",{ref:k,className:"jk-row top left nowrap stretch jk-br-ie pn-re wh-100",onDoubleClick:()=>h(!0),children:[v&&t(Me,{isOpen:p,onClose:()=>m(!1),content:u,setContent:v,isValid:e=>ve(e)}),v&&d?t(Ze,{content:u,setContent:v}):e("div",{className:"jk-col stretch gap nowrap graph-sheet-section-view wh-100",children:[t(ze,{content:u}),t(Ge,{content:u})]}),r&&t(S,{actionButtons:Je({type:B.GRAPH,edit:d,setModal:m,index:o,sheetLength:c,setSheet:r,onSaveEdit:y,onCancel:()=>{h(!1),b(l)}}),placement:"right-end",outer:!0})]})},We=s=>{const{isResolved:n,submitted:l,points:a,userPoints:i,children:o,childrenTop:c}=s,r=P(e=>e.viewPort.isSmallScreen);return t("div",{style:r?void 0:{position:"absolute",top:0,right:"calc(var(--pad-sm) * -1)",height:"100%",width:0},children:e("div",{className:"jk-pg-sm jk-col gap stretch space-between result-header sticky-top",children:[c,!!a&&e("div",{className:J("jk-row center jk-tag tx-s ws-np",{"bc-ss cr-we":n,"bc-sf-hi":!l,"bc-wg cr-we":i>0&&!n&&l,"bc-er cr-we":0===i&&!n&&l}),children:[(+i||0).toFixed(2)," ",t(m,{children:1===i?"pt":"pts"}),t("div",{className:"jk-divider tiny",style:{height:1}}),a," ",t(m,{children:1===a?"pt":"pts"})]}),t("div",{className:"jk-row gap",children:o})]})})},qe=s=>{const{points:n,submissions:l,children:a,selectedIndex:i,setSelectedIndex:o}=s,c=l.at(i);return t(We,{submitted:!!c,points:n,userPoints:c?.points??0,isResolved:!!c?.isCompleted,childrenTop:e("div",{className:"jk-row tx-s",children:[t(j,{className:"jk-row jk-br-ie hoverable",onClick:()=>{o(e=>(e-1+l.length)%l.length)},onKeyDownClick:!0,children:"←"}),e("div",{className:"jk-row",children:[i+1," (",t(j,{className:"jk-row jk-br-ie hoverable",onClick:()=>{o(l.length-1)},onKeyDownClick:!0,children:l.length}),")"]}),t(j,{className:"jk-row jk-br-ie hoverable",onClick:()=>{o(e=>(e+1)%l.length)},onKeyDownClick:!0,children:"→"})]}),children:a})},He=({content:s,setContent:n,isSolvable:l})=>e("div",{className:"jk-col left gap wh-100 jk-pg-sm tx-s",children:[t(y,{label:t(m,{className:"tt-se",children:"title"}),labelPlacement:"left",value:s.title,onChange:e=>n(t=>({...t,title:e})),expand:!0}),l&&t("div",{className:"jk-row extend left",children:t(y,{label:t(m,{className:"tt-se tx-s",children:"points"}),type:"number",value:s.points,onChange:e=>n(t=>({...t,points:e}))})}),t("div",{className:"flex-1 jk-md-math-editor-expanded wh-100",children:t(K,{informationButton:!0,value:s.content,onChange:e=>n(t=>({...t,content:e})),enableTextPlain:!0,enableIA:!0,enableImageUpload:!0})})]}),$e=s=>{const{content:l,setContent:i,index:o,chunkId:c,sheetLength:r,setSheet:d,worksheetKey:h,isSolvable:g,readOnly:b,userResults:k}=s,{notifyResponse:y}=N(),v=!0,[C,f]=n(!1),j=a(null),O=(k?.data?.submissions[B.JK_MD]?.[c]??[]).at(-1),x=l.content.trim();return e("div",{ref:j,className:"jk-row top left nowrap stretch jk-br-ie pn-re wh-100 jk-md-sheet-section",children:[i&&t(Me,{isOpen:C,onClose:()=>f(!1),content:l,setContent:i,isValid:e=>ve(e)&&Ae(JSON.parse(e))}),i?t(He,{content:l,setContent:i,isSolvable:!!g}):e("div",{className:"jk-col gap stretch jk-md-sheet-section-view wh-100 pn-re",children:[g&&!d&&x&&t(We,{submitted:!!O,points:l.points,userPoints:O?.points??0,isResolved:!!O?.isCompleted,children:!b&&t(p,{type:"secondary",expand:!0,size:"small","data-tooltip-id":"jk-tooltip","data-tooltip-content":O?.read?"mark as unread":"mark as read",onClick:async e=>{e(be.LOADING);const t={type:B.JK_MD,id:l.id,read:!O?.read},{url:s,...n}=V.apiV2.worksheet.submitJkMd({params:{worksheetKey:h},body:t}),a=ke(await ye(s,n));await(k?.mutate?.()),y(a,e)},icon:t(w,{checked:!!O?.read,onChange:()=>null}),children:t(m,{className:"tt-se",children:O?.read?"_read":"unread"})})}),e("div",{className:"jk-pg-rl wh-100 bc-sf-md",children:[t(ze,{content:l}),!!x&&t(u,{source:x})]})]}),d&&t(S,{actionButtons:Je({type:B.JK_MD,edit:v,setModal:f,index:o,sheetLength:r,setSheet:d}),placement:"right-end",outer:!0})]})},Xe=({content:n,setContent:l,isSolvable:a})=>e("div",{className:"jk-col gap stretch left jk-pg-sm wh-100 br-ht jk-br-ie",children:[e("div",{className:"jk-row-col gap tx-s",children:[e("div",{className:"jk-col",children:[t(m,{className:"fw-bd tt-se",children:"options"}),t(E,{size:"small",checked:n.multiple,onChange:e=>l(t=>({...t,multiple:e,options:t.options.map(e=>({...e,correct:!1}))})),leftLabel:t(m,{className:J("tt-se",{"fw-bd":!n.multiple}),children:"single"}),rightLabel:t(m,{className:J("tt-se",{"fw-bd":n.multiple}),children:"multiple"})})]}),a&&e(s,{children:[t("div",{className:"jk-row left",style:{width:64},children:t(y,{label:t(m,{className:"tt-se",children:"points"}),labelPlacement:"top",type:"number",expand:!0,value:n.points,onChange:e=>l(t=>({...t,points:e}))})}),e("div",{className:"jk-col",children:[t(m,{className:"fw-bd tt-se",children:"scoring mode"}),t(E,{size:"small",checked:n.scoringMode===Y.TOTAL,onChange:e=>l(t=>({...t,scoringMode:e?Y.TOTAL:Y.PARTIAL})),leftLabel:t(m,{className:J("tt-se",{"fw-bd":"PARTIAL"===n.scoringMode}),children:"partial"}),rightLabel:t(m,{className:J("tt-se",{"fw-bd":"TOTAL"===n.scoringMode}),children:"total"})})]})]})]}),t(y,{label:t(m,{className:"tt-se",children:"title"}),labelPlacement:"top",value:n.title,onChange:e=>l(t=>({...t,title:e})),expand:!0}),e("div",{className:"jk-col stretch",children:[t(m,{className:"tt-se fw-bd",children:"description"}),t(K,{value:n.description,onChange:e=>l(t=>({...t,description:e})),enableTextPlain:!0,enableIA:!0,enableImageUpload:!0})]}),e("div",{className:"jk-col stretch left gap",children:[t(m,{className:"tt-se cr-tx-ht-lt",children:"select the correct options"}),n.options.map((s,a)=>e("div",{className:"jk-row gap nowrap extend",children:[n.multiple?t(w,{checked:s.correct,onChange:e=>{l(t=>{const s=[...t.options];return s[a]&&(s[a]={...s[a],correct:e}),{...t,options:s}})}}):t(A,{name:n.id,checked:s.correct,onChange:e=>{l(t=>{const s=[...t.options].map(e=>({...e,correct:!1}));return s[a]&&(s[a]={...s[a],correct:e}),{...t,options:s}})}}),t(K,{className:"wh-100",value:s.label,onChange:e=>{l(t=>{const s=[...t.options];return s[a]&&(s[a]={...s[a],label:e}),{...t,options:s}})},enableTextPlain:!0,enableIA:!0,enableImageUpload:!0})]},s.id)),e(h,{type:"secondary",className:"jk-row gap",onClick:()=>l(e=>({...e,options:[...e.options,{label:"",correct:!1,id:ee()}]})),children:[t(fe,{})," ",t(m,{className:"tt-se",children:"add option"})]})]})]}),Ye=s=>{const{content:n,checkedOptions:l,setCheckedOptions:a,readOnly:i}=s;return e("div",{className:"bc-sf-md jk-br-ie jk-pg jk-col stretch gap wh-100",children:[t(u,{source:n.description,className:"bc-ht-lt jk-pg-xsm jk-br-ie"}),t(m,{className:"tt-se fw-bd cr-tx-ht",children:n.multiple?"select one or more options":"select one option"}),t("div",{className:"jk-col stretch left gap",children:n.options.map(s=>e(j,{className:J("jk-row gap nowrap extend left jk-br-ie option jk-br-ie jk-pg-xsm-rl",{"bc-ht-lt":l.includes(s.id)}),onClick:i?void 0:()=>{n.multiple?l.includes(s.id)?a(l.filter(e=>e!==s.id)):a([...l,s.id]):a([s.id])},onKeyDownClick:!0,children:[n.multiple?t(w,{checked:l.includes(s.id),onChange:()=>null,className:J({"bc-ss-lt jk-br-ie":s.correct})}):t(A,{checked:l.includes(s.id),onChange:()=>null,className:J({"bc-ss-lt br-50-pc":s.correct})}),t("div",{children:t(u,{source:s.label})})]},s.id))})]})},et=s=>{const{content:l,setContent:i,index:o,chunkId:c,sheetLength:r,setSheet:d,worksheetKey:h,isSolvable:u,userResults:b,readOnly:k}=s,{notifyResponse:y}=N(),[v,w]=n(!1),[C,f]=n(!1),[j,O]=g(l),x=i?O:void 0,I=a(null),P=()=>{w(!v),i?.(j)};Ue(I,v,P);const K=b?.data?.submissions[B.QUIZ_OPTIONS]?.[c]??[],[E,A]=g(K.length-1),D=K.at(E),[L,T]=g(D?.checkedOptions??[]);return e("div",{ref:I,className:"jk-row top left nowrap stretch jk-br-ie pn-re wh-100",onDoubleClick:()=>w(!0),children:[x&&t(Me,{isOpen:C,onClose:()=>f(!1),content:j,setContent:x,isValid:e=>ve(e)&&Te(JSON.parse(e))}),x&&v?t(Xe,{content:j,setContent:x,isSolvable:u}):e("div",{className:"jk-col stretch gap quiz-options-sheet-section-view wh-100 pn-re",children:[u&&!d&&t(qe,{submissions:K,points:j.points,selectedIndex:E,setSelectedIndex:A,children:!k&&t(p,{type:"secondary",size:"small",expand:!0,onClick:async e=>{e(be.LOADING);const t={type:B.QUIZ_OPTIONS,id:j.id,checkedOptions:L},{url:s,...n}=V.apiV2.worksheet.submitQuizOptions({params:{worksheetKey:h},body:t}),l=ke(await ye(s,n));await(b?.mutate?.()),y(l,e)},children:t(m,{className:"tt-se",children:"save"})})}),t(ze,{content:j}),t(Ye,{content:j,checkedOptions:L,setCheckedOptions:T,readOnly:k})]}),d&&t(S,{actionButtons:Je({type:B.QUIZ_OPTIONS,edit:v,setModal:f,index:o,sheetLength:r,setSheet:d,onSaveEdit:P,onCancel:()=>{w(!1),O(l)}}),placement:"right-end",outer:!0})]})},tt=({problemKey:s})=>t("div",{style:{},children:t(D,{url:V.apiV2.problem.getSummary({params:{key:s}}).url,errorView:t(L,{children:t(m,{className:"tt-se",children:"problem not found"})}),children:({data:s})=>e("div",{className:"jk-col",children:[t("div",{className:"fw-bd",children:s.content.name}),t("div",{className:"jk-tag bc-io",children:s.content.judge.key}),e("div",{children:[t(m,{className:"tt-se fw-bd",children:"type"}),": ",we[s.content.settings.type].label]}),e("div",{children:[t(m,{className:"tt-se fw-bd",children:"scoring mode"}),": ",Ce[s.content.settings.scoringMode].label]})]})})}),st=({content:s,setContent:n,isSolvable:l})=>t("div",{className:"jk-col stretch left",children:e("div",{className:"jk-col gap stretch flex-1",style:{width:"100%"},children:[t(y,{label:t(m,{className:"tt-se",children:"title"}),labelPlacement:"top",value:s.title,onChange:e=>n(t=>({...t,title:e})),expand:!0}),l&&t(y,{type:"number",label:t(m,{className:"tt-se",children:"points"}),labelPlacement:"top",value:s.points,onChange:e=>n(t=>({...t,points:e})),expand:!0}),e("div",{className:"flex-1",children:[t(m,{className:"fw-bd tt-se",children:"languages"}),":",t(v,{options:te.map(e=>({value:e,label:_[e]?.label??e})),selectedOptions:s.languages?.map(e=>({value:e})),onChange:e=>n(t=>({...t,languages:e.map(e=>e.value)})),expand:!0})]}),t("div",{children:s.problemKey?t(tt,{problemKey:s.problemKey}):t(m,{className:"tt-se",children:"please select a problem"})}),e("div",{className:"jk-row gap left",children:[e("div",{children:[t(m,{className:"fw-bd tt-se",children:"height"}),":"]}),t(w,{checked:0===s.height,label:t(m,{children:"auto"}),onChange:e=>n(t=>({...t,height:e?0:H}))}),t(y,{disabled:0===s.height,type:"number",value:s.height,onChange:e=>n(t=>({...t,height:Math.abs(e)})),size:"auto"}),t(m,{children:"px"})]}),t(T,{onSelect:e=>{n(t=>({...t,problemKey:e.key,problemJudge:e.judge.key}))}})]})}),nt=({content:e,worksheetKey:s})=>{const{notifyResponse:n}=N(),l=!Number.isNaN(+e.height)&&+e.height>0;return t("div",{className:"jk-col nowrap gap wh-100",style:{maxHeight:l?`calc(${+e.height}px + var(--gap))`:"calc(var(--100VH) - 300px)",height:l?`calc(${+e.height}px + var(--gap))`:"calc(var(--100VH) * 0.6)"},children:t("div",{className:"jk-col nowrap stretch flex-1 gap wh-100",style:{height:"100%"},children:t(D,{url:e.problemKey?V.apiV2.problem.getData({params:{key:e.problemKey}}).url:null,children:({data:l})=>t(R,{problem:l.content,infoPlacement:"name",codeEditorStoreKey:`${s}/${e.id}`,codeEditorCenterButtons:({files:l,currentFileName:a})=>{const{source:i="",language:o=Pe.TEXT}=l[a]||{};return[t(z,{children:t(p,{size:"small",onClick:async t=>{t(be.LOADING);const l={id:e.id,type:B.QUIZ_PROBLEM,language:o,source:i},{url:a,...c}=V.apiV2.worksheet.submitQuizProblem({params:{worksheetKey:s},body:l}),r=ke(await ye(a,c));n(r,t)},children:t(m,{className:"tt-se",children:"submit"})})},"submit")]}})})})})},lt=l=>{const{content:i,setContent:o,index:c,chunkId:r,sheetLength:d,setSheet:h,worksheetKey:p,isSolvable:u,userResults:b}=l,[k,y]=n(!1),[v,w]=n(!1),[C,N]=g(i),f=a(null),j=()=>{y(!k),o?.(C)};Ue(f,k,j);const O=o?N:void 0,x=(b?.data?.submissions[B.QUIZ_PROBLEM]?.[r]??[]).at(-1);return e("div",{className:"jk-row top left nowrap stretch jk-br-ie pn-re wh-100",onDoubleClick:()=>y(!0),children:[O&&t(Me,{isOpen:v,onClose:()=>w(!1),content:C,setContent:O,isValid:e=>ve(e)&&Le(JSON.parse(e))}),O&&k?t(st,{content:C,setContent:O,isSolvable:u}):e("div",{className:"jk-col gap stretch center quiz-problem-sheet-section-view wh-100 pn-re",children:[u&&!h&&t(We,{submitted:!!x,points:C.points,userPoints:x?.points??0,isResolved:!!x?.isCompleted,children:!!x?.isCompleted&&e(s,{children:[t(me,{size:"tiny"})," ",t(m,{className:"tt-se",children:"resolved"})]})}),t(ze,{content:C}),C.problemKey?t(nt,{content:C,worksheetKey:p}):t("div",{className:"jk-row center",children:t(m,{className:"tt-se cr-er",children:"problem not selected"})})]}),h&&t(S,{actionButtons:Je({type:B.QUIZ_PROBLEM,edit:k,setModal:w,index:c,sheetLength:d,setSheet:h,onSaveEdit:j,onCancel:()=>{y(!1),N(i)}}),placement:"right-end",outer:!0})]})},at=n=>{const{sheet:l,setSheet:a,userResults:i,readOnly:c,isSolvable:r,worksheetKey:d,asSlides:h,index:p,length:m}=n,g=l[p];if(!g)return null;const b=a?e=>{a(t=>{const s=[...t];if(s[p]){const t="function"==typeof e?e(s[p]):e;s.splice(p,1,structuredClone(t))}return s})}:void 0,k=l[p+1]?.type===B.JK_MD,y={content:g,setContent:h?void 0:b,index:p,chunkId:g.id,sheetLength:l.length,setSheet:h?void 0:a,worksheetKey:d,isSolvable:r,userResults:i,readOnly:c};return h&&g.type===B.JK_MD?e(s,{children:[t(M,{name:"WorksheetNode"}),t(u,{source:g.content.trim(),flatView:!0})]}):e(o,{children:[e("div",{id:g.id,className:J("jk-row nowrap stretch top gap pn-re jk-br-ie wh-100",`${g.type}-chunk`,{editing:!!a,"next-jkmd":k}),children:[g.type===B.JK_MD&&t($e,{...y}),g.type===B.CODE_EDITOR&&t(Qe,{...y}),g.type===B.GRAPH&&t(Fe,{...y}),g.type===B.QUIZ_PROBLEM&&t(lt,{...y}),g.type===B.QUIZ_OPTIONS&&t(et,{...y})]}),a&&!h&&t("div",{className:"jk-row gap extend nowrap center jk-divider tiny editing",style:{height:0},children:t(Re,{index:p,setSheet:a,mdSheet:!0,codeEditorSheet:!0,graphSheet:!0,quizProblemSheet:!0,quizOptionsSheetType:!0,pageDivider:!0,compacted:!0,floatToolbarPlacement:p===m-1?"top":"bottom"})})]},g.id)};export{Re as A,Me as E,at as W,Ae as a,Te as b,Le as c,Ke as g,De as i};
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as s}from"react/jsx-runtime";import{useState as n,useEffect as l,useRef as a,Children as i,Fragment as o}from"react";import{a8 as c,ac as r,aw as d,b as h,d as p,b4 as m,ak as u,df as g,al as b,a6 as k,Z as y,an as v,a0 as w,bl as C,cW as N,da as f,r as j,L as S,dd as O,N as x,P as I,d5 as P,aj as K,a7 as E,a4 as A,G as D,as as L,aH as T,aK as R,K as z,q as M}from"./index-DGfNHv1x.js";import{C as _,d as J,x as V}from"./index-P3Cb0cjc.js";import{g as B,b as Q,E as U,a as Z,c as G,e as F,d as W,A as q,W as H,f as $,D as X,Q as Y,v as ee,R as te}from"./worksheet-BBAH_yZC.js";import{aa as se,p as ne,d as le,ae,j as ie,aD as oe,E as ce,g as re,an as de,h as he,c as pe,C as me}from"./ViewModuleIcon-CBJGd2NB.js";import{N as ue}from"./worksheet-GN3yGKYw.js";import{E as ge,S as be,g as ke,f as ye,F as ve,b as we,P as Ce}from"./contest-D0dFHHYS.js";import{S as Ne,A as fe}from"./SettingsIcon-DM1F7UIb.js";import{A as je,S as Se}from"./index-CroDROK5.js";import{QueryParamKey as Oe}from"./enums.js";import{g as xe}from"./worksheet-DTRmzBjG.js";import{A as Ie}from"./ArrowForwardIcon-IN9agpuQ.js";import{C as Pe}from"./settings-DgLs6IK_.js";const Ke=e=>{const t=[...e];t[0]?.type!==B.NEW_PAGE&&t.unshift(ue());let s=t[0],n=[];const l=[];for(let e=1;e<t.length;e++){const a=t[e];a.type===B.NEW_PAGE?(l.push({header:s,content:[...n]}),s=a,n=[]):n.push(a)}return l.push({header:s,content:[...n]}),l},Ee=e=>{if("object"!=typeof e||null===e)return!1;const t=e;return"string"==typeof t.id&&!!t.id&&Object.values(B).includes(t.type)&&"string"==typeof t.title&&"number"==typeof t.points},Ae=e=>{if(!Ee(e))return!1;const t=e;return e.type===B.JK_MD&&"string"==typeof t.content},De=e=>{if(!Ee(e))return!1;const t=e;return e.type===B.CODE_EDITOR&&"object"==typeof t.sourceCode&&null!==t.sourceCode&&"object"==typeof t.testCases&&null!==t.testCases&&Array.isArray(t.languages)&&"number"==typeof t.height},Le=e=>{if("object"!=typeof e||null===e)return!1;const t=e;return Ee(e)&&e.type===B.QUIZ_PROBLEM&&Object.values(c).includes(t.problemJudge)||"string"==typeof t.problemJudge&&"string"==typeof t.problemKey&&Array.isArray(t.languages)&&"number"==typeof t.height},Te=e=>{if(!Ee(e))return!1;const t=e;return e.type===B.QUIZ_OPTIONS&&"string"==typeof t.description&&Array.isArray(t.options)&&t.options.every(e=>{if("object"!=typeof e||null===e)return!1;const t=e;return"string"==typeof t.label&&"boolean"==typeof t.correct&&"string"==typeof t.id})&&"boolean"==typeof t.multiple&&("TOTAL"===t.scoringMode||"PARTIAL"===t.scoringMode)},Re=s=>{const{index:n,setSheet:l,mdSheet:a,codeEditorSheet:i,graphSheet:o,listSheet:c,quizProblemSheet:u,pageDivider:g,compacted:b,quizOptionsSheetType:k,floatToolbarPlacement:y}=s,v=[];if(a){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,Q()),t})};v.push({...r("tiny")[B.JK_MD],onClick:e})}if(i){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,U()),t})};v.push({...r("tiny")[B.CODE_EDITOR],onClick:e})}if(o){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,Z()),t})};v.push({...r("tiny")[B.GRAPH],onClick:e})}if(c){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,G()),t})};v.push({...r("tiny")[B.LIST],onClick:e})}if(u){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,F()),t})};v.push({...r("tiny")[B.QUIZ_PROBLEM],onClick:e})}if(k){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,W()),t})};v.push({...r("tiny")[B.QUIZ_OPTIONS],onClick:e})}if(g){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,ue()),t})};v.push({...r("tiny")[B.NEW_PAGE],onClick:e})}return e("div",{className:"jk-row gap",children:[b&&t(d,{content:t("div",{className:"jk-col gap",children:v.map(({icon:e,onClick:s,label:n})=>t(p,{icon:e,size:"tiny",expand:!0,onClick:s,children:t(m,{children:n})},n))}),offset:8,placement:y,children:t(h,{icon:t(se,{}),size:"small"})}),!b&&v.map(({icon:e,label:s,onClick:n})=>t(h,{size:"small",icon:e,onClick:n,children:s},s))]})},ze=({content:e})=>!!e.title&&t(u,{source:e.title}),Me=s=>{const{isOpen:n,onClose:l,content:a,setContent:i,isValid:o}=s,[c,r]=g(n&&ge(a)?JSON.stringify(a,null,2):"");return t(b,{isOpen:n,onClose:l,children:e("div",{className:"jk-col gap jk-pg stretch",children:[t(k,{className:"wh-100",size:"auto",value:c,onChange:r}),e("div",{className:"jk-row-col gap right",children:[t(h,{onClick:l,type:"secondary",children:t(m,{className:"tt-se",children:"close"})}),t(h,{disabled:!o(c),onClick:()=>{if(o(c)){const e=JSON.parse(c);i(e),l()}},children:t(m,{className:"tt-se",children:"save"})})]})]})})},_e=({index:e,length:s,onChange:n})=>{const l=[];return 0!==e&&l.push({icon:t(je,{}),size:"tiny",label:t(m,{className:"tt-se",children:"move up"}),onClick:()=>{n(t=>{const s=[...t],n=s[e-1];return s[e]&&n&&([s[e],s[e-1]]=[n,s[e]]),s})},disabled:0===e}),l.push({icon:t(ne,{}),size:"tiny",label:t(m,{className:"tt-se",children:"remove"}),onClick:()=>{n(t=>t.filter((t,s)=>s!==e))}}),e!==s-1&&l.push({icon:t(le,{}),size:"tiny",label:t(m,{className:"tt-se",children:"move down"}),onClick:()=>{n(t=>{const s=[...t],n=s[e+1];return s[e]&&n&&([s[e],s[e+1]]=[n,s[e]]),s})},disabled:e===s-1}),l},Je=s=>{const{type:n,edit:l,index:a,sheetLength:i,setSheet:o,setModal:c,onSaveEdit:d,onCancel:p}=s;return[{children:e("div",{className:"bc-at-lt cr-at-it jk-pg-xsm jk-row gap nowrap jk-br-ie tx-t ws-np",style:{opacity:.6},children:[r("tiny")[n].icon,r("tiny")[n].label]})},...d&&p?l?[{icon:t(oe,{size:"small"}),children:e("div",{className:" jk-col gap stretch",children:[t(h,{size:"small",icon:t(ae,{}),onClick:d,children:t(m,{className:"tt-se",children:"save"})}),t(h,{size:"small",type:"secondary",icon:t(ie,{}),onClick:p,children:t(m,{className:"tt-se",children:"cancel"})})]}),placement:"left-start"}]:[{icon:t(ce,{size:"small"}),children:void 0,onClick:d,"data-tooltip-id":"jk-tooltip","data-tooltip-content":"edit","data-tooltip-place":"left",placement:"left-start"}]:[],{icon:t(Se,{className:"cr-we",up:!0,down:!0}),size:"tiny",buttons:_e({index:a,length:i,onChange:e=>o?.(t=>e(t))}),placement:"left-start"},{icon:t(Ne,{}),onClick:()=>c(!0),size:"tiny","data-tooltip-id":"jk-tooltip","data-tooltip-content":"view settings","data-tooltip-place":"left"}]},Ve=({content:s,setContent:n,isSolvable:l})=>e("div",{className:"jk-col gap stretch left jk-pg-sm br-ht jk-br-ie wh-100",children:[t(y,{label:t(m,{className:"tt-se",children:"title"}),labelPlacement:"top",value:s.title,onChange:e=>n(t=>({...t,title:e})),expand:!0}),l&&t(y,{type:"number",label:t(m,{className:"tt-se",children:"points"}),labelPlacement:"top",value:s.points,onChange:e=>n(t=>({...t,points:e})),expand:!0}),e("div",{className:"jk-row gap wh-100",children:[e("div",{className:"flex-1",children:[t(m,{className:"fw-bd tt-se",children:"languages"}),":",t(v,{options:q.map(e=>({value:e,label:_[e].label})),selectedOptions:s.languages?.map(e=>({value:e})),onChange:e=>n(t=>({...t,languages:e.map(e=>e.value)})),expand:!0})]}),e("div",{children:[e("div",{className:"jk-row gap space-between",children:[e("div",{children:[t(m,{className:"fw-bd tt-se",children:"height"}),":"]}),t(w,{checked:0===s.height,label:t(m,{children:"auto"}),onChange:e=>n(t=>({...t,height:e?0:H}))})]}),0!==s.height&&e("div",{className:"jk-row",children:[t(y,{type:"number",value:s.height,onChange:e=>n(t=>({...t,height:Math.abs(e)})),size:"auto"}),t(m,{children:"px"})]})]})]}),t("div",{style:{height:H},className:"jk-row wh-100",children:t(C,{storeKey:`${s.id}_edit`,initialFiles:s.files,onTestCasesChange:e=>n(t=>({...t,testCases:e})),onFilesChange:e=>n(t=>({...t,files:e})),initialTestCases:s.testCases,languages:s.languages.map(e=>({value:e,label:_[e]?.label||e})),enableAddSampleCases:!0})})]}),Be=o=>{const{content:c,worksheetKey:r,chunkId:d,userResults:h,readOnly:u,isSolvable:g}=o,{notifyResponse:b}=N(),k=f(e=>e.searchParams),[y,v]=n(0),w=h?.data?.submissions[B.CODE_EDITOR]?.[d]??[];l(()=>{v(0)},[h?.data?.user.nickname]);const S=w.length,O=S-y-1,x=w[O]?.files??c.files,I=a(void 0),P=async(e,t)=>{I.current?.(be.LOADING),v(0);const s={type:B.CODE_EDITOR,id:c.id,files:e,testCases:t},n=k.get(Oe.ASSIGNMENT),{url:l,...a}=V.apiV2.worksheet.submitCodeEditor({params:{worksheetKey:r,secondaryKey:n??""},body:s}),i=ke(await ye(l,a));await(h?.mutate?.()),b(i,I.current)};return t("div",{className:"jk-col stretch flex-1 gap",children:t("div",{style:{height:xe(c.height,""),minWidth:200,width:"100%"},className:"jk-row",children:t(C,{withoutRunCodeButton:u,readOnly:u,initialFiles:x,initialTestCases:w[O]?.testCases??c.testCases,languages:c.languages.map(e=>({value:e,label:_[e]?.label||e})),storeKey:`${c.id}_view`,enableAddCustomSampleCases:!0,onCodeRunStatusChange:(e,{files:t,testCases:s})=>{e===$.COMPLETED&&g&&P(t,s)},centerButtons:({runner:{testCases:n}={testCases:{}},files:l})=>{const a=[];return!u&&g&&a.push(t(p,{size:"tiny",onClick:()=>P(l,n),setLoaderStatusRef:e=>I.current=e,children:t(m,{className:"tt-se",children:"save"})},"save")),a.push(e("div",{className:"jk-row bc-ht-lt jk-br-ie",children:[t(j,{className:J("clickable br-50-pc jk-row",{"cr-ht":0===S}),onClick:S?()=>v(e=>(e+1)%S):void 0,onKeyDownClick:!0,children:t(re,{})}),h?.isLoading?t(de,{}):e(s,{children:[O+1," / ",S,t(m,{children:"v."})]}),t(j,{className:J("clickable br-50-pc jk-row",{"cr-ht":0===S}),onClick:S?()=>v(e=>(e-1+S)%S):void 0,onKeyDownClick:!0,children:t(he,{})})]},"buttons")),t("div",{className:"jk-row gap",children:i.toArray(a)})}})})})},Qe=s=>{const{content:l,setContent:i,index:o,chunkId:c,sheetLength:r,setSheet:d,worksheetKey:h,isSolvable:p,userResults:m,readOnly:u}=s,[g,b]=n(!1),k=a(null);return e("div",{ref:k,className:"jk-row top left nowrap stretch jk-br-ie pn-re wh-100",children:[i&&t(Me,{isOpen:g,onClose:()=>b(!1),content:l,setContent:i,isValid:e=>ve(e)&&De(JSON.parse(e))}),i?t(Ve,{content:l,setContent:i,isSolvable:p}):e("div",{className:"jk-col stretch gap nowrap code-editor-sheet-section-view wh-100",children:[t(ze,{content:l}),t(Be,{content:l,worksheetKey:h,chunkId:c,userResults:m,readOnly:u,isSolvable:p})]}),d&&t(S,{actionButtons:Je({type:B.CODE_EDITOR,edit:!0,setModal:b,index:o,sheetLength:r,setSheet:d}),placement:"right-end",outer:!0})]})},Ue=(e,t,s)=>{const n=O(s);l(()=>{const s=s=>{t&&e.current&&!e.current.contains(s.target)&&n.current()};return document.addEventListener("mousedown",s),()=>{document.removeEventListener("mousedown",s)}},[t])},Ze=({content:s,setContent:l})=>{const[a,i]=n(0);return e("div",{className:"jk-col stretch left wh-100 jk-pg-sm br-ht jk-br-ie",children:[t(y,{label:t(m,{className:"tt-se",children:"title"}),labelPlacement:"top",value:s.title,onChange:e=>l(t=>({...t,title:e})),expand:!0}),s.dots?.[a]&&t(x,{value:s.dots[a],onSave:e=>{const t=[...s.dots];t.splice(a,1,e),l({...s,dots:t})}}),e("div",{className:"jk-row gap center",children:[t(h,{icon:t(pe,{}),disabled:0===a,onClick:()=>i((a-1+s.dots.length)%s.dots.length),size:"small"}),new Array(s.dots.length).fill(1).map((e,s)=>t(j,{className:J("jk-tag clickable",{"bc-sf-hi":s!==a}),onClick:()=>i(s),onKeyDownClick:!0,children:s+1},s)),t(h,{icon:t(Ie,{}),disabled:a>=s.dots.length-1,onClick:()=>i((a+1)%s.dots.length),size:"small"})]}),e("div",{className:"jk-row gap nowrap",children:[t(h,{icon:t(pe,{}),onClick:()=>{const e=[...s.dots];e.splice(a,0,X),l({...s,dots:e})},size:"small",children:t(fe,{})}),t(h,{icon:t(ne,{}),onClick:()=>{const e=[...s.dots];e.splice(a,1),l({...s,dots:e})},size:"small",type:"secondary"}),t(h,{icon:t(fe,{}),onClick:()=>{const e=[...s.dots];e.splice(a+1,0,X),l({...s,dots:e}),i(a+1)},size:"small",children:t(Ie,{})})]})]})},Ge=({content:s,setSheet:a})=>{const[i,o]=n(0);return l(()=>{s.dots.length||a?.(e=>({...e,dots:['digraaph graph_name {\n bgcolor="transparent"\n a -> b;\n b -> c;\n a -> d;\n d -> c;\n a -> c;\n}']}))},[a,s.dots.length]),e("div",{className:"jk-col gap",children:[t("div",{className:"br-hl jk-br-ie bc-sf-md",children:s.dots?.[i]&&t(I,{dot:s.dots[i]})}),e("div",{className:"jk-row gap center",children:[t(h,{icon:t(pe,{}),disabled:0===i,onClick:()=>o((i-1+s.dots.length)%s.dots.length),size:"small"}),new Array(s.dots.length).fill(1).map((e,s)=>t(j,{className:J("jk-tag clickable",{"bc-sf-hi":s!==i}),onClick:()=>o(s),onKeyDownClick:!0,children:s+1},s)),t(h,{icon:t(Ie,{}),disabled:i>=s.dots.length-1,onClick:()=>o((i+1)%s.dots.length),size:"small"})]})]})},Fe=s=>{const{content:l,setContent:i,index:o,sheetLength:c,setSheet:r}=s,[d,h]=n(!1),[p,m]=n(!1),[u,b]=g(l),k=a(null),y=()=>{h(!d),i?.(u)};Ue(k,d,y);const v=i?b:void 0;return e("div",{ref:k,className:"jk-row top left nowrap stretch jk-br-ie pn-re wh-100",onDoubleClick:()=>h(!0),children:[v&&t(Me,{isOpen:p,onClose:()=>m(!1),content:u,setContent:v,isValid:e=>ve(e)}),v&&d?t(Ze,{content:u,setContent:v}):e("div",{className:"jk-col stretch gap nowrap graph-sheet-section-view wh-100",children:[t(ze,{content:u}),t(Ge,{content:u})]}),r&&t(S,{actionButtons:Je({type:B.GRAPH,edit:d,setModal:m,index:o,sheetLength:c,setSheet:r,onSaveEdit:y,onCancel:()=>{h(!1),b(l)}}),placement:"right-end",outer:!0})]})},We=s=>{const{isResolved:n,submitted:l,points:a,userPoints:i,children:o,childrenTop:c}=s,r=P(e=>e.viewPort.isSmallScreen);return t("div",{style:r?void 0:{position:"absolute",top:0,right:"calc(var(--pad-sm) * -1)",height:"100%",width:0},children:e("div",{className:"jk-pg-sm jk-col gap stretch space-between result-header sticky-top",children:[c,!!a&&e("div",{className:J("jk-row center jk-tag tx-s ws-np",{"bc-ss cr-we":n,"bc-sf-hi":!l,"bc-wg cr-we":i>0&&!n&&l,"bc-er cr-we":0===i&&!n&&l}),children:[(+i||0).toFixed(2)," ",t(m,{children:1===i?"pt":"pts"}),t("div",{className:"jk-divider tiny",style:{height:1}}),a," ",t(m,{children:1===a?"pt":"pts"})]}),t("div",{className:"jk-row gap",children:o})]})})},qe=s=>{const{points:n,submissions:l,children:a,selectedIndex:i,setSelectedIndex:o}=s,c=l.at(i);return t(We,{submitted:!!c,points:n,userPoints:c?.points??0,isResolved:!!c?.isCompleted,childrenTop:e("div",{className:"jk-row tx-s",children:[t(j,{className:"jk-row jk-br-ie hoverable",onClick:()=>{o(e=>(e-1+l.length)%l.length)},onKeyDownClick:!0,children:"←"}),e("div",{className:"jk-row",children:[i+1," (",t(j,{className:"jk-row jk-br-ie hoverable",onClick:()=>{o(l.length-1)},onKeyDownClick:!0,children:l.length}),")"]}),t(j,{className:"jk-row jk-br-ie hoverable",onClick:()=>{o(e=>(e+1)%l.length)},onKeyDownClick:!0,children:"→"})]}),children:a})},He=({content:s,setContent:n,isSolvable:l})=>e("div",{className:"jk-col left gap wh-100 jk-pg-sm tx-s",children:[t(y,{label:t(m,{className:"tt-se",children:"title"}),labelPlacement:"left",value:s.title,onChange:e=>n(t=>({...t,title:e})),expand:!0}),l&&t("div",{className:"jk-row extend left",children:t(y,{label:t(m,{className:"tt-se tx-s",children:"points"}),type:"number",value:s.points,onChange:e=>n(t=>({...t,points:e}))})}),t("div",{className:"flex-1 jk-md-math-editor-expanded wh-100",children:t(K,{informationButton:!0,value:s.content,onChange:e=>n(t=>({...t,content:e})),enableTextPlain:!0,enableIA:!0,enableImageUpload:!0})})]}),$e=s=>{const{content:l,setContent:i,index:o,chunkId:c,sheetLength:r,setSheet:d,worksheetKey:h,isSolvable:g,readOnly:b,userResults:k}=s,{notifyResponse:y}=N(),v=!0,[C,f]=n(!1),j=a(null),O=(k?.data?.submissions[B.JK_MD]?.[c]??[]).at(-1),x=l.content.trim();return e("div",{ref:j,className:"jk-row top left nowrap stretch jk-br-ie pn-re wh-100 jk-md-sheet-section",children:[i&&t(Me,{isOpen:C,onClose:()=>f(!1),content:l,setContent:i,isValid:e=>ve(e)&&Ae(JSON.parse(e))}),i?t(He,{content:l,setContent:i,isSolvable:!!g}):e("div",{className:"jk-col gap stretch jk-md-sheet-section-view wh-100 pn-re",children:[g&&!d&&x&&t(We,{submitted:!!O,points:l.points,userPoints:O?.points??0,isResolved:!!O?.isCompleted,children:!b&&t(p,{type:"secondary",expand:!0,size:"small","data-tooltip-id":"jk-tooltip","data-tooltip-content":O?.read?"mark as unread":"mark as read",onClick:async e=>{e(be.LOADING);const t={type:B.JK_MD,id:l.id,read:!O?.read},{url:s,...n}=V.apiV2.worksheet.submitJkMd({params:{worksheetKey:h},body:t}),a=ke(await ye(s,n));await(k?.mutate?.()),y(a,e)},icon:t(w,{checked:!!O?.read,onChange:()=>null}),children:t(m,{className:"tt-se",children:O?.read?"_read":"unread"})})}),e("div",{className:"jk-pg-rl wh-100 bc-sf-md",children:[t(ze,{content:l}),!!x&&t(u,{source:x})]})]}),d&&t(S,{actionButtons:Je({type:B.JK_MD,edit:v,setModal:f,index:o,sheetLength:r,setSheet:d}),placement:"right-end",outer:!0})]})},Xe=({content:n,setContent:l,isSolvable:a})=>e("div",{className:"jk-col gap stretch left jk-pg-sm wh-100 br-ht jk-br-ie",children:[e("div",{className:"jk-row-col gap tx-s",children:[e("div",{className:"jk-col",children:[t(m,{className:"fw-bd tt-se",children:"options"}),t(E,{size:"small",checked:n.multiple,onChange:e=>l(t=>({...t,multiple:e,options:t.options.map(e=>({...e,correct:!1}))})),leftLabel:t(m,{className:J("tt-se",{"fw-bd":!n.multiple}),children:"single"}),rightLabel:t(m,{className:J("tt-se",{"fw-bd":n.multiple}),children:"multiple"})})]}),a&&e(s,{children:[t("div",{className:"jk-row left",style:{width:64},children:t(y,{label:t(m,{className:"tt-se",children:"points"}),labelPlacement:"top",type:"number",expand:!0,value:n.points,onChange:e=>l(t=>({...t,points:e}))})}),e("div",{className:"jk-col",children:[t(m,{className:"fw-bd tt-se",children:"scoring mode"}),t(E,{size:"small",checked:n.scoringMode===Y.TOTAL,onChange:e=>l(t=>({...t,scoringMode:e?Y.TOTAL:Y.PARTIAL})),leftLabel:t(m,{className:J("tt-se",{"fw-bd":"PARTIAL"===n.scoringMode}),children:"partial"}),rightLabel:t(m,{className:J("tt-se",{"fw-bd":"TOTAL"===n.scoringMode}),children:"total"})})]})]})]}),t(y,{label:t(m,{className:"tt-se",children:"title"}),labelPlacement:"top",value:n.title,onChange:e=>l(t=>({...t,title:e})),expand:!0}),e("div",{className:"jk-col stretch",children:[t(m,{className:"tt-se fw-bd",children:"description"}),t(K,{value:n.description,onChange:e=>l(t=>({...t,description:e})),enableTextPlain:!0,enableIA:!0,enableImageUpload:!0})]}),e("div",{className:"jk-col stretch left gap",children:[t(m,{className:"tt-se cr-tx-ht-lt",children:"select the correct options"}),n.options.map((s,a)=>e("div",{className:"jk-row gap nowrap extend",children:[n.multiple?t(w,{checked:s.correct,onChange:e=>{l(t=>{const s=[...t.options];return s[a]&&(s[a]={...s[a],correct:e}),{...t,options:s}})}}):t(A,{name:n.id,checked:s.correct,onChange:e=>{l(t=>{const s=[...t.options].map(e=>({...e,correct:!1}));return s[a]&&(s[a]={...s[a],correct:e}),{...t,options:s}})}}),t(K,{className:"wh-100",value:s.label,onChange:e=>{l(t=>{const s=[...t.options];return s[a]&&(s[a]={...s[a],label:e}),{...t,options:s}})},enableTextPlain:!0,enableIA:!0,enableImageUpload:!0})]},s.id)),e(h,{type:"secondary",className:"jk-row gap",onClick:()=>l(e=>({...e,options:[...e.options,{label:"",correct:!1,id:ee()}]})),children:[t(fe,{})," ",t(m,{className:"tt-se",children:"add option"})]})]})]}),Ye=s=>{const{content:n,checkedOptions:l,setCheckedOptions:a,readOnly:i}=s;return e("div",{className:"bc-sf-md jk-br-ie jk-pg jk-col stretch gap wh-100",children:[t(u,{source:n.description,className:"bc-ht-lt jk-pg-xsm jk-br-ie"}),t(m,{className:"tt-se fw-bd cr-tx-ht",children:n.multiple?"select one or more options":"select one option"}),t("div",{className:"jk-col stretch left gap",children:n.options.map(s=>e(j,{className:J("jk-row gap nowrap extend left jk-br-ie option jk-br-ie jk-pg-xsm-rl",{"bc-ht-lt":l.includes(s.id)}),onClick:i?void 0:()=>{n.multiple?l.includes(s.id)?a(l.filter(e=>e!==s.id)):a([...l,s.id]):a([s.id])},onKeyDownClick:!0,children:[n.multiple?t(w,{checked:l.includes(s.id),onChange:()=>null,className:J({"bc-ss-lt jk-br-ie":s.correct})}):t(A,{checked:l.includes(s.id),onChange:()=>null,className:J({"bc-ss-lt br-50-pc":s.correct})}),t("div",{children:t(u,{source:s.label})})]},s.id))})]})},et=s=>{const{content:l,setContent:i,index:o,chunkId:c,sheetLength:r,setSheet:d,worksheetKey:h,isSolvable:u,userResults:b,readOnly:k}=s,{notifyResponse:y}=N(),[v,w]=n(!1),[C,f]=n(!1),[j,O]=g(l),x=i?O:void 0,I=a(null),P=()=>{w(!v),i?.(j)};Ue(I,v,P);const K=b?.data?.submissions[B.QUIZ_OPTIONS]?.[c]??[],[E,A]=g(K.length-1),D=K.at(E),[L,T]=g(D?.checkedOptions??[]);return e("div",{ref:I,className:"jk-row top left nowrap stretch jk-br-ie pn-re wh-100",onDoubleClick:()=>w(!0),children:[x&&t(Me,{isOpen:C,onClose:()=>f(!1),content:j,setContent:x,isValid:e=>ve(e)&&Te(JSON.parse(e))}),x&&v?t(Xe,{content:j,setContent:x,isSolvable:u}):e("div",{className:"jk-col stretch gap quiz-options-sheet-section-view wh-100 pn-re",children:[u&&!d&&t(qe,{submissions:K,points:j.points,selectedIndex:E,setSelectedIndex:A,children:!k&&t(p,{type:"secondary",size:"small",expand:!0,onClick:async e=>{e(be.LOADING);const t={type:B.QUIZ_OPTIONS,id:j.id,checkedOptions:L},{url:s,...n}=V.apiV2.worksheet.submitQuizOptions({params:{worksheetKey:h},body:t}),l=ke(await ye(s,n));await(b?.mutate?.()),y(l,e)},children:t(m,{className:"tt-se",children:"save"})})}),t(ze,{content:j}),t(Ye,{content:j,checkedOptions:L,setCheckedOptions:T,readOnly:k})]}),d&&t(S,{actionButtons:Je({type:B.QUIZ_OPTIONS,edit:v,setModal:f,index:o,sheetLength:r,setSheet:d,onSaveEdit:P,onCancel:()=>{w(!1),O(l)}}),placement:"right-end",outer:!0})]})},tt=({problemKey:s})=>t("div",{style:{},children:t(D,{url:V.apiV2.problem.getSummary({params:{key:s}}).url,errorView:t(L,{children:t(m,{className:"tt-se",children:"problem not found"})}),children:({data:s})=>e("div",{className:"jk-col",children:[t("div",{className:"fw-bd",children:s.content.name}),t("div",{className:"jk-tag bc-io",children:s.content.judge.key}),e("div",{children:[t(m,{className:"tt-se fw-bd",children:"type"}),": ",we[s.content.settings.type].label]}),e("div",{children:[t(m,{className:"tt-se fw-bd",children:"scoring mode"}),": ",Ce[s.content.settings.scoringMode].label]})]})})}),st=({content:s,setContent:n,isSolvable:l})=>t("div",{className:"jk-col stretch left",children:e("div",{className:"jk-col gap stretch flex-1",style:{width:"100%"},children:[t(y,{label:t(m,{className:"tt-se",children:"title"}),labelPlacement:"top",value:s.title,onChange:e=>n(t=>({...t,title:e})),expand:!0}),l&&t(y,{type:"number",label:t(m,{className:"tt-se",children:"points"}),labelPlacement:"top",value:s.points,onChange:e=>n(t=>({...t,points:e})),expand:!0}),e("div",{className:"flex-1",children:[t(m,{className:"fw-bd tt-se",children:"languages"}),":",t(v,{options:te.map(e=>({value:e,label:_[e]?.label??e})),selectedOptions:s.languages?.map(e=>({value:e})),onChange:e=>n(t=>({...t,languages:e.map(e=>e.value)})),expand:!0})]}),t("div",{children:s.problemKey?t(tt,{problemKey:s.problemKey}):t(m,{className:"tt-se",children:"please select a problem"})}),e("div",{className:"jk-row gap left",children:[e("div",{children:[t(m,{className:"fw-bd tt-se",children:"height"}),":"]}),t(w,{checked:0===s.height,label:t(m,{children:"auto"}),onChange:e=>n(t=>({...t,height:e?0:H}))}),t(y,{disabled:0===s.height,type:"number",value:s.height,onChange:e=>n(t=>({...t,height:Math.abs(e)})),size:"auto"}),t(m,{children:"px"})]}),t(T,{onSelect:e=>{n(t=>({...t,problemKey:e.key,problemJudge:e.judge.key}))}})]})}),nt=({content:e,worksheetKey:s})=>{const{notifyResponse:n}=N(),l=!Number.isNaN(+e.height)&&+e.height>0;return t("div",{className:"jk-col nowrap gap wh-100",style:{maxHeight:l?`calc(${+e.height}px + var(--gap))`:"calc(var(--100VH) - 300px)",height:l?`calc(${+e.height}px + var(--gap))`:"calc(var(--100VH) * 0.6)"},children:t("div",{className:"jk-col nowrap stretch flex-1 gap wh-100",style:{height:"100%"},children:t(D,{url:e.problemKey?V.apiV2.problem.getData({params:{key:e.problemKey}}).url:null,children:({data:l})=>t(R,{problem:l.content,infoPlacement:"name",codeEditorStoreKey:`${s}/${e.id}`,codeEditorCenterButtons:({files:l,currentFileName:a})=>{const{source:i="",language:o=Pe.TEXT}=l[a]||{};return[t(z,{children:t(p,{size:"small",onClick:async t=>{t(be.LOADING);const l={id:e.id,type:B.QUIZ_PROBLEM,language:o,source:i},{url:a,...c}=V.apiV2.worksheet.submitQuizProblem({params:{worksheetKey:s},body:l}),r=ke(await ye(a,c));n(r,t)},children:t(m,{className:"tt-se",children:"submit"})})},"submit")]}})})})})},lt=l=>{const{content:i,setContent:o,index:c,chunkId:r,sheetLength:d,setSheet:h,worksheetKey:p,isSolvable:u,userResults:b}=l,[k,y]=n(!1),[v,w]=n(!1),[C,N]=g(i),f=a(null),j=()=>{y(!k),o?.(C)};Ue(f,k,j);const O=o?N:void 0,x=(b?.data?.submissions[B.QUIZ_PROBLEM]?.[r]??[]).at(-1);return e("div",{className:"jk-row top left nowrap stretch jk-br-ie pn-re wh-100",onDoubleClick:()=>y(!0),children:[O&&t(Me,{isOpen:v,onClose:()=>w(!1),content:C,setContent:O,isValid:e=>ve(e)&&Le(JSON.parse(e))}),O&&k?t(st,{content:C,setContent:O,isSolvable:u}):e("div",{className:"jk-col gap stretch center quiz-problem-sheet-section-view wh-100 pn-re",children:[u&&!h&&t(We,{submitted:!!x,points:C.points,userPoints:x?.points??0,isResolved:!!x?.isCompleted,children:!!x?.isCompleted&&e(s,{children:[t(me,{size:"tiny"})," ",t(m,{className:"tt-se",children:"resolved"})]})}),t(ze,{content:C}),C.problemKey?t(nt,{content:C,worksheetKey:p}):t("div",{className:"jk-row center",children:t(m,{className:"tt-se cr-er",children:"problem not selected"})})]}),h&&t(S,{actionButtons:Je({type:B.QUIZ_PROBLEM,edit:k,setModal:w,index:c,sheetLength:d,setSheet:h,onSaveEdit:j,onCancel:()=>{y(!1),N(i)}}),placement:"right-end",outer:!0})]})},at=n=>{const{sheet:l,setSheet:a,userResults:i,readOnly:c,isSolvable:r,worksheetKey:d,asSlides:h,index:p,length:m}=n,g=l[p];if(!g)return null;const b=a?e=>{a(t=>{const s=[...t];if(s[p]){const t="function"==typeof e?e(s[p]):e;s.splice(p,1,structuredClone(t))}return s})}:void 0,k=l[p+1]?.type===B.JK_MD,y={content:g,setContent:h?void 0:b,index:p,chunkId:g.id,sheetLength:l.length,setSheet:h?void 0:a,worksheetKey:d,isSolvable:r,userResults:i,readOnly:c};return h&&g.type===B.JK_MD?e(s,{children:[t(M,{name:"WorksheetNode"}),t(u,{source:g.content.trim(),flatView:!0})]}):e(o,{children:[e("div",{id:g.id,className:J("jk-row nowrap stretch top gap pn-re jk-br-ie wh-100",`${g.type}-chunk`,{editing:!!a,"next-jkmd":k}),children:[g.type===B.JK_MD&&t($e,{...y}),g.type===B.CODE_EDITOR&&t(Qe,{...y}),g.type===B.GRAPH&&t(Fe,{...y}),g.type===B.QUIZ_PROBLEM&&t(lt,{...y}),g.type===B.QUIZ_OPTIONS&&t(et,{...y})]}),a&&!h&&t("div",{className:"jk-row gap extend nowrap center jk-divider tiny editing",style:{height:0},children:t(Re,{index:p,setSheet:a,mdSheet:!0,codeEditorSheet:!0,graphSheet:!0,quizProblemSheet:!0,quizOptionsSheetType:!0,pageDivider:!0,compacted:!0,floatToolbarPlacement:p===m-1?"top":"bottom"})})]},g.id)};export{Re as A,Me as E,at as W,Ae as a,Te as b,Le as c,Ke as g,De as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useCallback as t,useMemo as a}from"react";import{x as r,q as o,d as i}from"./index-P3Cb0cjc.js";import{d5 as n,dk as m,da as c,df as d,dd as p,cL as l,cZ as g,bA as h,b4 as j}from"./index-
|
|
1
|
+
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useCallback as t,useMemo as a}from"react";import{x as r,q as o,d as i}from"./index-P3Cb0cjc.js";import{d5 as n,dk as m,da as c,df as d,dd as p,cL as l,cZ as g,bA as h,b4 as j}from"./index-DGfNHv1x.js";import{T as u}from"./TableOfContents-s2uXSPqs.js";import{W as k}from"./WorksheetBodies-CV7eAr61.js";import{g as b}from"./WorksheetNode-DEOXUEQe.js";import"./settings-DgLs6IK_.js";import"./enums.js";import"./ViewModuleIcon-CBJGd2NB.js";import"./date-D28INXpp.js";import"./time-BHcZPeyw.js";import"./contest-D0dFHHYS.js";import"./worksheet-BBAH_yZC.js";import"motion/react";import"react-dom";import"./index-Dwi3ag-n.js";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"ably/react";import"@ably/spaces/dist/mjs/react";import"./SettingsIcon-DM1F7UIb.js";import"./worksheet-GN3yGKYw.js";import"./index-CroDROK5.js";import"./worksheet-DTRmzBjG.js";import"./ArrowForwardIcon-IN9agpuQ.js";function w(w){const{worksheet:{content:f,quiz:{enable:y},key:P,user:{isManager:x}},resultsUserKey:v,page:C,subPage:I,onPageChangeRef:S,lastPageChildren:L,readOnly:N=!1,withoutTableOfContents:A=!1}=w,M=n(e=>e.viewPort.isSmallScreen),O=m(e=>e.user.nickname),V=m(e=>e.organization.key),q=m(e=>e.user.isLogged),K=c(e=>e.setSearchParams),[R,T]=d(C??1),[W,z]=d(I??1),U=p(S),B=t((e,s,t)=>{U.current?U.current(e,s,t):(T(e),z(s),K(t))},[T,z,U,K]),{data:E,mutate:F,isLoading:Z,isValidating:D}=l(P&&y&&q?r.apiV2.worksheet.getSubmissionsUser({params:{key:P,userKey:v||o(O,V)}}).url:null),G=a(()=>({data:E?.success?E.content:void 0,isLoading:Z,isValidating:D,mutate:F}),[E,Z,D,F]),H=a(()=>b(f),[f]),J=N||!!G?.data&&O!==G.data.user.nickname,Q=H.length;return g(t(e=>{"ArrowRight"===e.code?B(Math.min(R+1,Q),1,[]):"ArrowLeft"===e.code&&B(Math.max(R-1,1),1,[])},[B,R,Q])),e("div",{id:"jk-worksheet-viewer-container",className:i("gap nowrap worksheet-viewer-container center top",{"jk-col":M,"jk-row":!M}),children:[!A&&(M?Q>1&&s("div",{className:"jk-row",children:s(h,{page:R,subPage:W,onPageChange:B,sheetsInPages:H})}):e("div",{className:"jk-col gap bc-sf-md jk-pg-xsm jk-br-ie left worksheet-content sticky-top",children:[s(j,{className:"tt-se fw-bd cr-tx-ht",children:"table of content"}),s(u,{sheetsInPages:H,page:R,subPage:W,onPageChange:B})]})),s(k,{sheetsInPages:H,isSolvable:y&&q,userResults:G,readOnly:J,isEditor:x,worksheetKey:P,page:R,onPageChange:B,subPage:W,lastPageChildren:L})]})}export{w as default};
|