@juki-team/base-ui 1.4.118 → 1.4.121
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/{ArrowForwardIcon-CfqRXB-e.js → ArrowForwardIcon-CVIKnzmu.js} +1 -1
- package/dist/esm/{BarChart-BflV6xj2.js → BarChart-C4j466sV.js} +1 -1
- package/dist/esm/{CartesianChart-Be_Msy-L.js → CartesianChart-tXHM9yHp.js} +1 -1
- package/dist/esm/{ChangePasswordModal-DX01z_Xk.js → ChangePasswordModal-DAn7XeyD.js} +1 -1
- package/dist/esm/{CodeEditor-BOGzDG3d.js → CodeEditor-CFWIRByc.js} +1 -1
- package/dist/esm/{CodeViewer-DViv-qRC.js → CodeViewer-C6XCe0GT.js} +1 -1
- package/dist/esm/{Collapse-B-9MQjHh.js → Collapse-DpriDerh.js} +1 -1
- package/dist/esm/{DataGrid-DAZ5DKz9.js → DataGrid-CD44fkam.js} +1 -1
- package/dist/esm/{DataViewer-D8eXfNsQ.js → DataViewer-B1l0B0-d.js} +1 -1
- package/dist/esm/{DrawerView-BVaIELlv.js → DrawerView-hvnlPQq6.js} +1 -1
- package/dist/esm/{ExcalidrawButton-pTn865SY.js → ExcalidrawButton-COXAKOpn.js} +1 -1
- package/dist/esm/{GraphvizViewer-vH3t2wUS.js → GraphvizViewer-BK4ypl3L.js} +1 -1
- package/dist/esm/{ImageLoaderCropper-C5KjohnD.js → ImageLoaderCropper-DEt5ge51.js} +1 -1
- package/dist/esm/{InputCellPhoneNumber-D9uGI1bD.js → InputCellPhoneNumber-CbFB6H2i.js} +1 -1
- package/dist/esm/{InputColor-DrI8PNC-.js → InputColor-D_uAIBKY.js} +1 -1
- package/dist/esm/{LineChart-DLj6A5m5.js → LineChart-B3nrTHaA.js} +1 -1
- package/dist/esm/{MdMath-B4XKMYj5.js → MdMath-Mf8WxhKy.js} +1 -1
- package/dist/esm/{MdMathEditor-ChZMTVwl.js → MdMathEditor-BUf36EaT.js} +1 -1
- package/dist/esm/{Popover-Crnc5Mbi.js → Popover-myjbsRtv.js} +1 -1
- package/dist/esm/ProblemStatus-C5CR0Z8d.js +1 -0
- package/dist/esm/{ReplyIcon-MNlM5Yom.js → ReplyIcon-DJFT1Tjl.js} +1 -1
- package/dist/esm/{SettingsIcon-DYcyghgs.js → SettingsIcon-CaFHSleq.js} +1 -1
- package/dist/esm/{SlideDeck-CzwvVTCV.js → SlideDeck-DvVHz3uy.js} +1 -1
- package/dist/esm/{TableOfContents-CBjKYpSh.js → TableOfContents-I1zUQZlM.js} +1 -1
- package/dist/esm/{TextHeadCell-Br9BtjJh.js → TextHeadCell-CDT516Nd.js} +1 -1
- package/dist/esm/{Tooltip-BLaMAeAf.js → Tooltip-CHc2LM3e.js} +1 -1
- package/dist/esm/{UserCodeEditor-BawBx01d.js → UserCodeEditor-BwNoHEIy.js} +2 -2
- package/dist/esm/VirtualizedRowsFixed-SmGRufd0.js +1 -0
- package/dist/esm/WorksheetAsSlides-BQVnbTDc.js +1 -0
- package/dist/esm/{WorksheetBodies-CZeRGme9.js → WorksheetBodies-kphWX0g5.js} +1 -1
- package/dist/esm/WorksheetContents-CI8UrxIy.js +1 -0
- package/dist/esm/{WorksheetEditor-fMHttnD5.js → WorksheetEditor-CHC4ormG.js} +1 -1
- package/dist/esm/{WorksheetNode-Kpoi8x-M.js → WorksheetNode-C9ioDzE-.js} +1 -1
- package/dist/esm/{WorksheetViewer-CcPGkFZY.js → WorksheetViewer-Drg2e9_6.js} +1 -1
- package/dist/esm/{architecture-YZFGNWBL-B8OIAguO.js → architecture-YZFGNWBL-DHLZLvJj.js} +1 -1
- package/dist/esm/{architectureDiagram-Q4EWVU46-BqXqiLku.js → architectureDiagram-Q4EWVU46-DO8F0qz7.js} +1 -1
- package/dist/esm/{blockDiagram-DXYQGD6D-yjrbpeL0.js → blockDiagram-DXYQGD6D-DNKe0cgR.js} +1 -1
- package/dist/esm/{c4Diagram-AHTNJAMY-4NdVv0Ao.js → c4Diagram-AHTNJAMY-DN5fuFmb.js} +1 -1
- package/dist/esm/channel-4mHTJV-N.js +1 -0
- package/dist/esm/{chunk-4BX2VUAB-CdXAk4UL.js → chunk-4BX2VUAB-COJYrArq.js} +1 -1
- package/dist/esm/{chunk-4TB4RGXK-DeaLGiy0.js → chunk-4TB4RGXK-BgOhjp4u.js} +1 -1
- package/dist/esm/{chunk-55IACEB6-ZkJD77DM.js → chunk-55IACEB6-BlGeNxvg.js} +1 -1
- package/dist/esm/{chunk-EDXVE4YY-CqeZhnl8.js → chunk-EDXVE4YY-CrsJ2Hnl.js} +1 -1
- package/dist/esm/{chunk-FMBD7UC4-B4Z_oaMt.js → chunk-FMBD7UC4-PcmGZaXU.js} +1 -1
- package/dist/esm/{chunk-OYMX7WX6-CiBqSRlH.js → chunk-OYMX7WX6-Dd_OySsr.js} +1 -1
- package/dist/esm/{chunk-QZHKN3VN-C_DglKRL.js → chunk-QZHKN3VN-D5wczz_U.js} +1 -1
- package/dist/esm/{chunk-YZCP3GAM-C92EM7hh.js → chunk-YZCP3GAM-J0il8D93.js} +1 -1
- package/dist/esm/{classDiagram-6PBFFD2Q-IphAkZk8.js → classDiagram-6PBFFD2Q-BudcHsyy.js} +1 -1
- package/dist/esm/{classDiagram-v2-HSJHXN6E-IphAkZk8.js → classDiagram-v2-HSJHXN6E-BudcHsyy.js} +1 -1
- package/dist/esm/clone-Bdky4iBO.js +1 -0
- package/dist/esm/{cose-bilkent-S5V4N54A-DXHTtvh4.js → cose-bilkent-S5V4N54A-ZsIi3T0h.js} +1 -1
- package/dist/esm/dagre-KV5264BT-Ps6KiA13.js +1 -0
- package/dist/esm/{diagram-5BDNPKRD-CRH_FA4_.js → diagram-5BDNPKRD-CmcDSDfS.js} +1 -1
- package/dist/esm/{diagram-G4DWMVQ6-GP4ahuTv.js → diagram-G4DWMVQ6-MRapKKyA.js} +1 -1
- package/dist/esm/{diagram-MMDJMWI5-DFTlftEV.js → diagram-MMDJMWI5--Lf_QB5P.js} +1 -1
- package/dist/esm/{diagram-TYMM5635-Cn4xZrOw.js → diagram-TYMM5635-CfbzkptG.js} +1 -1
- package/dist/esm/{erDiagram-SMLLAGMA-Ck4PcI--.js → erDiagram-SMLLAGMA-DmAtzyw1.js} +1 -1
- package/dist/esm/{flowDiagram-DWJPFMVM-BBbHw1zk.js → flowDiagram-DWJPFMVM-Cd5g_eEq.js} +1 -1
- package/dist/esm/{ganttDiagram-T4ZO3ILL-GoBARLMA.js → ganttDiagram-T4ZO3ILL-O3kXJMuu.js} +1 -1
- package/dist/esm/{gitGraph-7Q5UKJZL-D0FpBDlQ.js → gitGraph-7Q5UKJZL-w9fSBFuS.js} +1 -1
- package/dist/esm/{gitGraphDiagram-UUTBAWPF-B-znwuk7.js → gitGraphDiagram-UUTBAWPF-XLFtNk0y.js} +1 -1
- package/dist/esm/{graph-D6v73SUk.js → graph-Bh_6Hxf_.js} +1 -1
- package/dist/esm/helpers.js +1 -1
- package/dist/esm/{index-CHC6KNKh.js → index-Bx0ktss6.js} +1 -1
- package/dist/esm/{index-DaLn6fdm.js → index-DdRpaNiN.js} +1 -1
- package/dist/esm/{index-B0Ju49H0.js → index-USryHMlL.js} +1 -1
- package/dist/esm/{index-CjH2xgIx.js → index-tDMZSRa9.js} +1 -1
- package/dist/esm/{info-OMHHGYJF-DloUnReg.js → info-OMHHGYJF-6icJTSRL.js} +1 -1
- package/dist/esm/infoDiagram-42DDH7IO-DiPK6iLZ.js +1 -0
- package/dist/esm/{ishikawaDiagram-UXIWVN3A-DyGvD6G7.js → ishikawaDiagram-UXIWVN3A-DNCSSMvk.js} +1 -1
- package/dist/esm/{journeyDiagram-VCZTEJTY-DxXXhahs.js → journeyDiagram-VCZTEJTY-BxyeAOhI.js} +1 -1
- package/dist/esm/{kanban-definition-6JOO6SKY-D4Fz7zVa.js → kanban-definition-6JOO6SKY-BR8Xd4RY.js} +1 -1
- package/dist/esm/{layout-FPgIfzKv.js → layout-BsYGzjO0.js} +1 -1
- package/dist/esm/main.js +1 -1
- package/dist/esm/{mermaid-parser.core-BCKOf1D4.js → mermaid-parser.core-DxB6tfwM.js} +1 -1
- package/dist/esm/{mermaid.core-Dx_hE5Vb.js → mermaid.core-DmkzFmrK.js} +1 -1
- package/dist/esm/{mindmap-definition-QFDTVHPH-BudCGGFH.js → mindmap-definition-QFDTVHPH-BUmIu9eO.js} +1 -1
- package/dist/esm/{packet-4T2RLAQJ-DrY-zHX-.js → packet-4T2RLAQJ-jB8585_W.js} +1 -1
- package/dist/esm/{pie-ZZUOXDRM-Ong88F43.js → pie-ZZUOXDRM-BKLoVTcY.js} +1 -1
- package/dist/esm/{pieDiagram-DEJITSTG-BhJWS0Q4.js → pieDiagram-DEJITSTG-CJQonP9T.js} +1 -1
- package/dist/esm/{quadrantDiagram-34T5L4WZ-WoNzEH2-.js → quadrantDiagram-34T5L4WZ-o3IEMDUC.js} +1 -1
- package/dist/esm/{radar-PYXPWWZC-D57lFxmR.js → radar-PYXPWWZC-BBal7TH8.js} +1 -1
- package/dist/esm/{requirementDiagram-MS252O5E-C0M6L425.js → requirementDiagram-MS252O5E-CSBSz0_J.js} +1 -1
- package/dist/esm/{sankeyDiagram-XADWPNL6-DwH4gDO6.js → sankeyDiagram-XADWPNL6-Dd0d-7E4.js} +1 -1
- package/dist/esm/{sequenceDiagram-FGHM5R23-DgDclAkj.js → sequenceDiagram-FGHM5R23-DEPMVZxI.js} +1 -1
- package/dist/esm/server.js +1 -1
- package/dist/esm/{stateDiagram-FHFEXIEX-CuWet3bI.js → stateDiagram-FHFEXIEX-B_eljgWF.js} +1 -1
- package/dist/esm/stateDiagram-v2-QKLJ7IA2-D9FCD1lO.js +1 -0
- package/dist/esm/time-BPMFfIa-.js +1 -0
- package/dist/esm/{timeline-definition-GMOUNBTQ-BMFr1mBJ.js → timeline-definition-GMOUNBTQ-Cg4NUF_H.js} +1 -1
- package/dist/esm/{treeView-SZITEDCU-CYq4WblB.js → treeView-SZITEDCU-S-ba_Q_y.js} +1 -1
- package/dist/esm/{treemap-W4RFUUIX-70AFdrYl.js → treemap-W4RFUUIX-CnmNi6qL.js} +1 -1
- package/dist/esm/{types-DMKo-tVy.js → types-NAGOQCyQ.js} +1 -1
- package/dist/esm/{vennDiagram-DHZGUBPP-D0NR4Ns6.js → vennDiagram-DHZGUBPP-B0vBQEXk.js} +1 -1
- package/dist/esm/{wardley-RL74JXVD-Kam1OQea.js → wardley-RL74JXVD-CQrog0ka.js} +1 -1
- package/dist/esm/{wardleyDiagram-NUSXRM2D-CTlkGBtH.js → wardleyDiagram-NUSXRM2D-BxnrOeU9.js} +1 -1
- package/dist/esm/websocket-Nx7WdiK7.js +1 -0
- package/dist/esm/{xychartDiagram-5P7HB3ND-CWDBw8NU.js → xychartDiagram-5P7HB3ND-B6KmAHYz.js} +1 -1
- package/dist/module-types/src/components/molecules/Timer/types.d.ts +1 -12
- package/dist/module-types/src/components/molecules/index.d.ts +0 -2
- package/dist/module-types/src/components/molecules/server/TimerDisplay/types.d.ts +13 -0
- package/dist/module-types/src/components/molecules/server/index.d.ts +2 -0
- package/dist/module-types/src/components/molecules/server/types.d.ts +1 -0
- package/package.json +1 -1
- package/dist/esm/ProblemStatus-FyUP73Qa.js +0 -1
- package/dist/esm/VirtualizedRowsFixed-CGitJjiS.js +0 -1
- package/dist/esm/WorksheetAsSlides-CLjpQVm5.js +0 -1
- package/dist/esm/WorksheetContents-CnJBOanQ.js +0 -1
- package/dist/esm/channel-BzbUIu8B.js +0 -1
- package/dist/esm/clone-c8fZ8s2e.js +0 -1
- package/dist/esm/dagre-KV5264BT-C1Bi5Hlh.js +0 -1
- package/dist/esm/date-Be2Mk-oF.js +0 -1
- package/dist/esm/infoDiagram-42DDH7IO-BZXN5IXJ.js +0 -1
- package/dist/esm/stateDiagram-v2-QKLJ7IA2-CGfwkJ3x.js +0 -1
- package/dist/esm/websocket-CoMeGplN.js +0 -1
- /package/dist/module-types/src/components/molecules/{Timer → server/TimerDisplay}/TimerDisplay.d.ts +0 -0
- /package/dist/module-types/src/components/molecules/{layouts → server/layouts}/ApplicationLoaderLayout.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{u as t}from"./index-Bp7rYslS.js";import{memo as s,useRef as r,useCallback as o}from"react";import{a as i}from"./index-tDMZSRa9.js";import"react-dom";import"./settings-DgLs6IK_.js";import"./ProblemStatus-C5CR0Z8d.js";import"./index-BWbfbDmw.js";import"./enums.js";import"./time-BPMFfIa-.js";import"./date-DabTuCYQ.js";import"./websocket-Nx7WdiK7.js";import"./worksheet-ClM0CaBH.js";import"motion/react";import"./index-BD_n8l03.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useMemo as a}from"react";import{j as s,g as i}from"./index-BWbfbDmw.js";import{e as o,m as r,D as m,n}from"./index-tDMZSRa9.js";import"./settings-DgLs6IK_.js";import"./ProblemStatus-C5CR0Z8d.js";import"motion/react";import"react-dom";import{g as d,W as l}from"./WorksheetNode-C9ioDzE-.js";import"./enums.js";import"./websocket-Nx7WdiK7.js";import"./date-DabTuCYQ.js";import"./worksheet-ClM0CaBH.js";import"./index-BD_n8l03.js";import"./time-BPMFfIa-.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-D1AAXRU9.js";import"./SettingsIcon-CaFHSleq.js";import"./index-DdRpaNiN.js";import"./worksheet-BxUIsAEo.js";import"./ArrowForwardIcon-CVIKnzmu.js";function p(p){const{worksheet:{content:c,quiz:{enable:u},key:g,slides:h},resultsUserKey:j,readOnly:b=!1,page:k}=p,y=o(e=>e.user.nickname),f=o(e=>e.organization.key),w=o(e=>e.user.isLogged),{data:x,mutate:S,isLoading:v,isValidating:I}=r(g&&u&&w?s.apiV2.worksheet.getSubmissionsUser({params:{key:g,userKey:j||i(y,f)}}).url:null),A=a(()=>({data:x?.success?x.content:void 0,isLoading:v,isValidating:I,mutate:S}),[x,v,I,S]);let F=a(()=>d(c),[c]);if("number"==typeof k&&k>=0&&k<F.length&&F[k]){F=[F[k]]}return F.map(a=>[[e("section",{"data-auto-animate":!0,style:{overflow:"hidden auto",maxHeight:"100%"},"data-background-image":h.titleBackgroundImage,children:[t(m,{name:"WorksheetAsSlides"}),t(n,{source:a.header.title,detectRequestAnimationFrame:!0})]},a.header.id+a.header.title)],a.content.map((e,s)=>t("section",{"data-auto-animate":!0,style:{overflow:"hidden auto",maxHeight:"100%"},"data-background-image":h.backgroundImage,children:t(l,{sheet:a.content,userResults:A,readOnly:b,isSolvable:u,worksheetKey:g,asSlides:!0,index:s,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 o,useRef as s,useState as n,useCallback as r}from"react";import{QueryParamKey as a}from"./enums.js";import{T as i,v as l,B as c}from"./index-
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{Children as o,useRef as s,useState as n,useCallback as r}from"react";import{QueryParamKey as a}from"./enums.js";import{T as i,v as l,B as c}from"./index-tDMZSRa9.js";import{c as d}from"./index-BWbfbDmw.js";import"./settings-DgLs6IK_.js";import{D as h}from"./ProblemStatus-C5CR0Z8d.js";import{S as p}from"./SettingsIcon-CaFHSleq.js";import"motion/react";import"react-dom";import{W as m,A as u,E as f,i as k,a as g,b as w,c as S}from"./WorksheetNode-C9ioDzE-.js";import{a as v}from"./worksheet-ClM0CaBH.js";import{N as j}from"./worksheet-D1AAXRU9.js";import{E as y}from"./websocket-Nx7WdiK7.js";function b(s){const{ref:n,sheetPage:r,setSheet:a,userResults:i,readOnly:l,isSolvable:c,worksheetKey:h,children:p,asSlides:f}=s;return e("div",{className:d("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:h,sheet:[{type:v.JK_MD,content:r.header.title,id:"",title:"",points:0}],index:0,length:1,readOnly:!0,isSolvable:!1}),o.toArray(r.content.map((e,o)=>t(m,{sheet:r.content,setSheet:a,userResults:i,readOnly:l,isSolvable:c,worksheetKey:h,asSlides:f,index:o,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"})}),p]})}const x=o=>{const{sheetsInPages:m,isEditor:u,setSheets:v,userResults:x,isSolvable:C,worksheetKey:N,page:O,onPageChange:P,lastPageChildren:E,readOnly:A}=o,K=s(null),[D,R]=n(!1),z=r((e,t)=>{const o=[...m];o[O-1]={header:e??o[O-1]?.header??j(),content:t};const s=[];for(const{header:e,content:t}of o)s.push(e,...t);v?.(s)},[O,v,m]),F=r(e=>{const t="function"==typeof e?e(m[O-1]?.content??[]):e;z(null,t)},[O,z,m]),W=m.length,_=m[O-1];return _?e("div",{className:d("jk-col gap nowrap top stretch extend worksheet-bodies wh-100",{"is-solvable":C}),children:[v&&e("div",{className:"jk-row gap extend nowrap",children:[t(i,{className:"tt-se",children:"page title"}),t(l,{value:_.header.title,onChange:e=>{z({..._.header,title:e},_.content)}}),t(c,{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"remove page divider",icon:t(h,{}),onClick:()=>{const e=[...m],t=[];if(O===W){let o=0;for(const{header:s,content:n}of e)o!==O-1&&t.push(s),t.push(...n),o++;v(t)}else{let o=0,s=null;for(const{header:n,content:r}of e)o===O-1?s=r:(t.push(n),null!==s&&(t.push(...s),s=null),t.push(...r)),o++;v(t)}O>1&&O===W&&P(Math.max(O,1),1,{name:a.PAGE_FOCUS,value:"jk-worksheet-viewer-container"})},disabled:W<=1}),t(c,{icon:t(p,{size:"small"}),onClick:()=>R(!0)})]},`${O}`),v&&t(f,{isOpen:D,onClose:()=>R(!1),content:_.content,setContent:F,isValid:e=>{if(y(e)){const t=JSON.parse(e);if(Array.isArray(t))return t.every(e=>k(e)||g(e)||w(e)||S(e))}return!1}}),t(b,{sheetPage:_,setSheet:v?F:void 0,userResults:x,readOnly:!!A,isSolvable:C,isEditor:u,worksheetKey:N,ref:K}),O<W?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"})}):E]}):null};export{x as W};
|
|
@@ -0,0 +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{M as a,T as t,r as i}from"./index-tDMZSRa9.js";import{c as n}from"./index-BWbfbDmw.js";import"./settings-DgLs6IK_.js";import{A as c,V as m}from"./ProblemStatus-C5CR0Z8d.js";import{A as l}from"./ArrowForwardIcon-CVIKnzmu.js";import"motion/react";import"react-dom";import{T as p}from"./TableOfContents-I1zUQZlM.js";import"./websocket-Nx7WdiK7.js";import"./date-DabTuCYQ.js";import"./worksheet-ClM0CaBH.js";import"./index-BD_n8l03.js";import"./time-BPMFfIa-.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:i,onClose:n,page:c,subPage:m,onPageChange:l}=r;return e(a,{isOpen:i,onClose:n,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(i,{onClick:p<=1?void 0:()=>g(p-1,1,{name:o.PAGE_FOCUS,value:"jk-worksheet-viewer-container"}),className:n("jk-row gap jk-pg-xsm jk-br-ie",{"cr-tx-ds":p<=1,"cr-pr hoverable":!(p<=1)}),onKeyDownClick:!0,children:[e(c,{}),e(t,{className:"tt-se",children:"previous"})]}),s(i,{className:"jk-row cr-pr hoverable jk-br-ie jk-pg-xsm",onClick:()=>k(!0),onKeyDownClick:!0,children:[e(m,{}),e(t,{className:"tt-se",children:"table of contents"})]}),s(i,{onClick:p===w?void 0:()=>g(p+1,1,{name:o.PAGE_FOCUS,value:"jk-worksheet-viewer-container"}),className:n("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(l,{})]})]})]})}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{p as s,q as o,W as a}from"./index-
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useMemo as r}from"react";import{p as s,q as o,W as a}from"./index-tDMZSRa9.js";import{W as i}from"./WorksheetBodies-kphWX0g5.js";import{g as m}from"./WorksheetNode-C9ioDzE-.js";import"./settings-DgLs6IK_.js";import"./ProblemStatus-C5CR0Z8d.js";import"./index-BWbfbDmw.js";import"./enums.js";import"./time-BPMFfIa-.js";import"./date-DabTuCYQ.js";import"./websocket-Nx7WdiK7.js";import"./worksheet-ClM0CaBH.js";import"motion/react";import"react-dom";import"./index-BD_n8l03.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-CaFHSleq.js";import"./worksheet-D1AAXRU9.js";import"./index-DdRpaNiN.js";import"./worksheet-BxUIsAEo.js";import"./ArrowForwardIcon-CVIKnzmu.js";function n(n){const{worksheet:{content:p,quiz:{enable:c},key:l,user:{isManager:d}},setContent:g,page:j,subPage:h,onPageChangeRef:b,lastPageChildren:k,readOnly:w=!1}=n,P=s(e=>e.setSearchParams),[u,y]=o(j??1),[f,x]=o(h??1),C=b??((e,t,r)=>{y(e),x(t),P(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:u,subPage:f,onPageChange:C,sheetsInPages:I})}),t(i,{sheetsInPages:I,setSheets:g,isSolvable:c,readOnly:w,isEditor:d,worksheetKey:l,page:u,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{av as c,L as r,ac as d,B as h,g as p,T as m,aw as u,q as g,M as b,ax as k,x as y,aj as v,ay as w,az as C,af as N,p as f,r as j,aA as S,a as O,aB as x,aC as I,f as P,v as D,s as A,aD as E,aE as K,aF as L,aG as T,aH as z,aI as R,D as M}from"./index-CjH2xgIx.js";import{D as _,c as J,j as B}from"./index-BWbfbDmw.js";import{C as V}from"./settings-DgLs6IK_.js";import{P as Q,D as U,e as G,h as Z,C as F,i as H,b as q,j as W,S as $,k as X,A as Y,l as ee}from"./ProblemStatus-FyUP73Qa.js";import"motion/react";import"react-dom";import"swr";import{a as te,c as se,E as ne,b as le,d as ae,f as ie,e as oe,A as ce,W as re,S as de,D as he,Q as pe,v as me,R as ue}from"./worksheet-ClM0CaBH.js";import{N as ge}from"./worksheet-D1AAXRU9.js";import{H as be,S as ke,G as ye,a as ve,F as we,P as Ce,I as Ne}from"./websocket-CoMeGplN.js";import{S as fe,A as je}from"./SettingsIcon-DYcyghgs.js";import{A as Se,S as Oe}from"./index-DaLn6fdm.js";import{QueryParamKey as xe}from"./enums.js";import{g as Ie}from"./worksheet-BxUIsAEo.js";import{A as Pe}from"./ArrowForwardIcon-CfqRXB-e.js";const De=e=>{const t=[...e];t[0]?.type!==te.NEW_PAGE&&t.unshift(ge());let s=t[0],n=[];const l=[];for(let e=1;e<t.length;e++){const a=t[e];a.type===te.NEW_PAGE?(l.push({header:s,content:[...n]}),s=a,n=[]):n.push(a)}return l.push({header:s,content:[...n]}),l},Ae=e=>{if("object"!=typeof e||null===e)return!1;const t=e;return"string"==typeof t.id&&!!t.id&&Object.values(te).includes(t.type)&&"string"==typeof t.title&&"number"==typeof t.points},Ee=e=>{if(!Ae(e))return!1;const t=e;return e.type===te.JK_MD&&"string"==typeof t.content},Ke=e=>{if(!Ae(e))return!1;const t=e;return e.type===te.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 Ae(e)&&e.type===te.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(!Ae(e))return!1;const t=e;return e.type===te.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)},ze=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,se()),t})};v.push({...r("tiny")[te.JK_MD],onClick:e})}if(i){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,ne()),t})};v.push({...r("tiny")[te.CODE_EDITOR],onClick:e})}if(o){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,le()),t})};v.push({...r("tiny")[te.GRAPH],onClick:e})}if(c){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,ae()),t})};v.push({...r("tiny")[te.LIST],onClick:e})}if(u){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,ie()),t})};v.push({...r("tiny")[te.QUIZ_PROBLEM],onClick:e})}if(k){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,oe()),t})};v.push({...r("tiny")[te.QUIZ_OPTIONS],onClick:e})}if(g){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,ge()),t})};v.push({...r("tiny")[te.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(Q,{}),size:"small"})}),!b&&v.map(({icon:e,label:s,onClick:n})=>t(h,{size:"small",icon:e,onClick:n,children:s},s))]})},Re=({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&&be(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(Se,{}),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(U,{}),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(G,{}),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(H,{size:"small"}),children:e("div",{className:" jk-col gap stretch",children:[t(h,{size:"small",icon:t(Z,{}),onClick:d,children:t(m,{className:"tt-se",children:"save"})}),t(h,{size:"small",type:"secondary",icon:t(F,{}),onClick:p,children:t(m,{className:"tt-se",children:"cancel"})})]}),placement:"left-start"}]:[{icon:t(q,{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(Oe,{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(fe,{}),onClick:()=>c(!0),size:"tiny","data-tooltip-id":"jk-tooltip","data-tooltip-content":"view settings","data-tooltip-place":"left"}]},Be=({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:ce.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:re}))})]}),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:re},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})})]}),Ve=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[te.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?.(ke.LOADING),v(0);const s={type:te.CODE_EDITOR,id:c.id,files:e,testCases:t},n=k.get(xe.ASSIGNMENT),{url:l,...a}=B.apiV2.worksheet.submitCodeEditor({params:{worksheetKey:r,secondaryKey:n??""},body:s}),i=ye(await ve(l,a));await(h?.mutate?.()),b(i,I.current)};return t("div",{className:"jk-col stretch flex-1 gap",children:t("div",{style:{height:Ie(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===de.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(W,{})}),h?.isLoading?t($,{}):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(X,{})})]},"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=>we(e)&&Ke(JSON.parse(e))}),i?t(Be,{content:l,setContent:i,isSolvable:p}):e("div",{className:"jk-col stretch gap nowrap code-editor-sheet-section-view wh-100",children:[t(Re,{content:l}),t(Ve,{content:l,worksheetKey:h,chunkId:c,userResults:m,readOnly:u,isSolvable:p})]}),d&&t(S,{actionButtons:Je({type:te.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])},Ge=({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(Y,{}),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(Pe,{}),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(Y,{}),onClick:()=>{const e=[...s.dots];e.splice(a,0,he),l({...s,dots:e})},size:"small",children:t(je,{})}),t(h,{icon:t(U,{}),onClick:()=>{const e=[...s.dots];e.splice(a,1),l({...s,dots:e})},size:"small",type:"secondary"}),t(h,{icon:t(je,{}),onClick:()=>{const e=[...s.dots];e.splice(a+1,0,he),l({...s,dots:e}),i(a+1)},size:"small",children:t(Pe,{})})]})]})},Ze=({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(Y,{}),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(Pe,{}),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=>we(e)}),v&&d?t(Ge,{content:u,setContent:v}):e("div",{className:"jk-col stretch gap nowrap graph-sheet-section-view wh-100",children:[t(Re,{content:u}),t(Ze,{content:u})]}),r&&t(S,{actionButtons:Je({type:te.GRAPH,edit:d,setModal:m,index:o,sheetLength:c,setSheet:r,onSaveEdit:y,onCancel:()=>{h(!1),b(l)}}),placement:"right-end",outer:!0})]})},He=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(He,{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})},We=({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(D,{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[te.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=>we(e)&&Ee(JSON.parse(e))}),i?t(We,{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(He,{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(ke.LOADING);const t={type:te.JK_MD,id:l.id,read:!O?.read},{url:s,...n}=B.apiV2.worksheet.submitJkMd({params:{worksheetKey:h},body:t}),a=ye(await ve(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(Re,{content:l}),!!x&&t(u,{source:x})]})]}),d&&t(S,{actionButtons:Je({type:te.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(A,{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(A,{size:"small",checked:n.scoringMode===pe.TOTAL,onChange:e=>l(t=>({...t,scoringMode:e?pe.TOTAL:pe.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(D,{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(E,{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(D,{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:me()}]})),children:[t(je,{})," ",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(E,{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 D=b?.data?.submissions[te.QUIZ_OPTIONS]?.[c]??[],[A,E]=g(D.length-1),K=D.at(A),[L,T]=g(K?.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=>we(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:D,points:j.points,selectedIndex:A,setSelectedIndex:E,children:!k&&t(p,{type:"secondary",size:"small",expand:!0,onClick:async e=>{e(ke.LOADING);const t={type:te.QUIZ_OPTIONS,id:j.id,checkedOptions:L},{url:s,...n}=B.apiV2.worksheet.submitQuizOptions({params:{worksheetKey:h},body:t}),l=ye(await ve(s,n));await(b?.mutate?.()),y(l,e)},children:t(m,{className:"tt-se",children:"save"})})}),t(Re,{content:j}),t(Ye,{content:j,checkedOptions:L,setCheckedOptions:T,readOnly:k})]}),d&&t(S,{actionButtons:Je({type:te.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(K,{url:B.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"}),": ",Ce[s.content.settings.type].label]}),e("div",{children:[t(m,{className:"tt-se fw-bd",children:"scoring mode"}),": ",Ne[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:ue.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:re}))}),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(K,{url:e.problemKey?B.apiV2.problem.getData({params:{key:e.problemKey}}).url:null,children:({data:l})=>t(z,{problem:l.content,infoPlacement:"name",codeEditorStoreKey:`${s}/${e.id}`,codeEditorCenterButtons:({files:l,currentFileName:a})=>{const{source:i="",language:o=V.TEXT}=l[a]||{};return[t(R,{children:t(p,{size:"small",onClick:async t=>{t(ke.LOADING);const l={id:e.id,type:te.QUIZ_PROBLEM,language:o,source:i},{url:a,...c}=B.apiV2.worksheet.submitQuizProblem({params:{worksheetKey:s},body:l}),r=ye(await ve(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[te.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=>we(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(He,{submitted:!!x,points:C.points,userPoints:x?.points??0,isResolved:!!x?.isCompleted,children:!!x?.isCompleted&&e(s,{children:[t(ee,{size:"tiny"})," ",t(m,{className:"tt-se",children:"resolved"})]})}),t(Re,{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:te.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===te.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===te.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===te.JK_MD&&t($e,{...y}),g.type===te.CODE_EDITOR&&t(Qe,{...y}),g.type===te.GRAPH&&t(Fe,{...y}),g.type===te.QUIZ_PROBLEM&&t(lt,{...y}),g.type===te.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(ze,{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{ze as A,Me as E,at as W,Ee as a,Te as b,Le as c,De as g,Ke 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{av as c,L as r,ac as d,B as h,g as p,T as m,aw as u,q as g,M as b,ax as k,x as y,aj as v,ay as w,az as C,af as N,p as f,r as j,aA as S,a as O,aB as x,aC as I,f as P,v as D,s as E,aD as A,aE as K,aF as L,aG as T,aH as z,aI as R,D as M}from"./index-tDMZSRa9.js";import{D as _,c as J,j as B}from"./index-BWbfbDmw.js";import{C as V}from"./settings-DgLs6IK_.js";import{P as Q,D as U,e as G,h as Z,C as F,i as H,b as q,j as W,S as $,k as X,A as Y,l as ee}from"./ProblemStatus-C5CR0Z8d.js";import"motion/react";import"react-dom";import"swr";import{a as te,c as se,E as ne,b as le,d as ae,f as ie,e as oe,A as ce,W as re,S as de,D as he,Q as pe,v as me,R as ue}from"./worksheet-ClM0CaBH.js";import{N as ge}from"./worksheet-D1AAXRU9.js";import{G as be,S as ke,F as ye,a as ve,E as we,P as Ce,H as Ne}from"./websocket-Nx7WdiK7.js";import{S as fe,A as je}from"./SettingsIcon-CaFHSleq.js";import{A as Se,S as Oe}from"./index-DdRpaNiN.js";import{QueryParamKey as xe}from"./enums.js";import{g as Ie}from"./worksheet-BxUIsAEo.js";import{A as Pe}from"./ArrowForwardIcon-CVIKnzmu.js";const De=e=>{const t=[...e];t[0]?.type!==te.NEW_PAGE&&t.unshift(ge());let s=t[0],n=[];const l=[];for(let e=1;e<t.length;e++){const a=t[e];a.type===te.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(te).includes(t.type)&&"string"==typeof t.title&&"number"==typeof t.points},Ae=e=>{if(!Ee(e))return!1;const t=e;return e.type===te.JK_MD&&"string"==typeof t.content},Ke=e=>{if(!Ee(e))return!1;const t=e;return e.type===te.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===te.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===te.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)},ze=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,se()),t})};v.push({...r("tiny")[te.JK_MD],onClick:e})}if(i){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,ne()),t})};v.push({...r("tiny")[te.CODE_EDITOR],onClick:e})}if(o){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,le()),t})};v.push({...r("tiny")[te.GRAPH],onClick:e})}if(c){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,ae()),t})};v.push({...r("tiny")[te.LIST],onClick:e})}if(u){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,ie()),t})};v.push({...r("tiny")[te.QUIZ_PROBLEM],onClick:e})}if(k){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,oe()),t})};v.push({...r("tiny")[te.QUIZ_OPTIONS],onClick:e})}if(g){const e=()=>{l(e=>{const t=[...e];return t.splice(n+1,0,ge()),t})};v.push({...r("tiny")[te.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(Q,{}),size:"small"})}),!b&&v.map(({icon:e,label:s,onClick:n})=>t(h,{size:"small",icon:e,onClick:n,children:s},s))]})},Re=({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&&be(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(Se,{}),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(U,{}),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(G,{}),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(H,{size:"small"}),children:e("div",{className:" jk-col gap stretch",children:[t(h,{size:"small",icon:t(Z,{}),onClick:d,children:t(m,{className:"tt-se",children:"save"})}),t(h,{size:"small",type:"secondary",icon:t(F,{}),onClick:p,children:t(m,{className:"tt-se",children:"cancel"})})]}),placement:"left-start"}]:[{icon:t(q,{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(Oe,{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(fe,{}),onClick:()=>c(!0),size:"tiny","data-tooltip-id":"jk-tooltip","data-tooltip-content":"view settings","data-tooltip-place":"left"}]},Be=({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:ce.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:re}))})]}),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:re},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})})]}),Ve=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[te.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?.(ke.LOADING),v(0);const s={type:te.CODE_EDITOR,id:c.id,files:e,testCases:t},n=k.get(xe.ASSIGNMENT),{url:l,...a}=B.apiV2.worksheet.submitCodeEditor({params:{worksheetKey:r,secondaryKey:n??""},body:s}),i=ye(await ve(l,a));await(h?.mutate?.()),b(i,I.current)};return t("div",{className:"jk-col stretch flex-1 gap",children:t("div",{style:{height:Ie(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===de.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(W,{})}),h?.isLoading?t($,{}):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(X,{})})]},"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=>we(e)&&Ke(JSON.parse(e))}),i?t(Be,{content:l,setContent:i,isSolvable:p}):e("div",{className:"jk-col stretch gap nowrap code-editor-sheet-section-view wh-100",children:[t(Re,{content:l}),t(Ve,{content:l,worksheetKey:h,chunkId:c,userResults:m,readOnly:u,isSolvable:p})]}),d&&t(S,{actionButtons:Je({type:te.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])},Ge=({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(Y,{}),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(Pe,{}),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(Y,{}),onClick:()=>{const e=[...s.dots];e.splice(a,0,he),l({...s,dots:e})},size:"small",children:t(je,{})}),t(h,{icon:t(U,{}),onClick:()=>{const e=[...s.dots];e.splice(a,1),l({...s,dots:e})},size:"small",type:"secondary"}),t(h,{icon:t(je,{}),onClick:()=>{const e=[...s.dots];e.splice(a+1,0,he),l({...s,dots:e}),i(a+1)},size:"small",children:t(Pe,{})})]})]})},Ze=({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(Y,{}),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(Pe,{}),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=>we(e)}),v&&d?t(Ge,{content:u,setContent:v}):e("div",{className:"jk-col stretch gap nowrap graph-sheet-section-view wh-100",children:[t(Re,{content:u}),t(Ze,{content:u})]}),r&&t(S,{actionButtons:Je({type:te.GRAPH,edit:d,setModal:m,index:o,sheetLength:c,setSheet:r,onSaveEdit:y,onCancel:()=>{h(!1),b(l)}}),placement:"right-end",outer:!0})]})},He=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(He,{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})},We=({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(D,{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[te.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=>we(e)&&Ae(JSON.parse(e))}),i?t(We,{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(He,{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(ke.LOADING);const t={type:te.JK_MD,id:l.id,read:!O?.read},{url:s,...n}=B.apiV2.worksheet.submitJkMd({params:{worksheetKey:h},body:t}),a=ye(await ve(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(Re,{content:l}),!!x&&t(u,{source:x})]})]}),d&&t(S,{actionButtons:Je({type:te.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===pe.TOTAL,onChange:e=>l(t=>({...t,scoringMode:e?pe.TOTAL:pe.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(D,{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(D,{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:me()}]})),children:[t(je,{})," ",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 D=b?.data?.submissions[te.QUIZ_OPTIONS]?.[c]??[],[E,A]=g(D.length-1),K=D.at(E),[L,T]=g(K?.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=>we(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:D,points:j.points,selectedIndex:E,setSelectedIndex:A,children:!k&&t(p,{type:"secondary",size:"small",expand:!0,onClick:async e=>{e(ke.LOADING);const t={type:te.QUIZ_OPTIONS,id:j.id,checkedOptions:L},{url:s,...n}=B.apiV2.worksheet.submitQuizOptions({params:{worksheetKey:h},body:t}),l=ye(await ve(s,n));await(b?.mutate?.()),y(l,e)},children:t(m,{className:"tt-se",children:"save"})})}),t(Re,{content:j}),t(Ye,{content:j,checkedOptions:L,setCheckedOptions:T,readOnly:k})]}),d&&t(S,{actionButtons:Je({type:te.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(K,{url:B.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"}),": ",Ce[s.content.settings.type].label]}),e("div",{children:[t(m,{className:"tt-se fw-bd",children:"scoring mode"}),": ",Ne[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:ue.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:re}))}),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(K,{url:e.problemKey?B.apiV2.problem.getData({params:{key:e.problemKey}}).url:null,children:({data:l})=>t(z,{problem:l.content,infoPlacement:"name",codeEditorStoreKey:`${s}/${e.id}`,codeEditorCenterButtons:({files:l,currentFileName:a})=>{const{source:i="",language:o=V.TEXT}=l[a]||{};return[t(R,{children:t(p,{size:"small",onClick:async t=>{t(ke.LOADING);const l={id:e.id,type:te.QUIZ_PROBLEM,language:o,source:i},{url:a,...c}=B.apiV2.worksheet.submitQuizProblem({params:{worksheetKey:s},body:l}),r=ye(await ve(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[te.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=>we(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(He,{submitted:!!x,points:C.points,userPoints:x?.points??0,isResolved:!!x?.isCompleted,children:!!x?.isCompleted&&e(s,{children:[t(ee,{size:"tiny"})," ",t(m,{className:"tt-se",children:"resolved"})]})}),t(Re,{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:te.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===te.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===te.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===te.JK_MD&&t($e,{...y}),g.type===te.CODE_EDITOR&&t(Qe,{...y}),g.type===te.GRAPH&&t(Fe,{...y}),g.type===te.QUIZ_PROBLEM&&t(lt,{...y}),g.type===te.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(ze,{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{ze as A,Me as E,at as W,Ae as a,Te as b,Le as c,De as g,Ke 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{j as r,g as o,c as i}from"./index-BWbfbDmw.js";import{f as n,e as m,p as c,q as p,a as l,m as
|
|
1
|
+
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useCallback as t,useMemo as a}from"react";import{j as r,g as o,c as i}from"./index-BWbfbDmw.js";import{f as n,e as m,p as c,q as p,a as l,m as g,b as d,W as h,T as j}from"./index-tDMZSRa9.js";import"./settings-DgLs6IK_.js";import"./ProblemStatus-C5CR0Z8d.js";import"motion/react";import"react-dom";import{T as u}from"./TableOfContents-I1zUQZlM.js";import{W as k}from"./WorksheetBodies-kphWX0g5.js";import{g as b}from"./WorksheetNode-C9ioDzE-.js";import"./enums.js";import"./websocket-Nx7WdiK7.js";import"./date-DabTuCYQ.js";import"./worksheet-ClM0CaBH.js";import"./index-BD_n8l03.js";import"./time-BPMFfIa-.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-CaFHSleq.js";import"./worksheet-D1AAXRU9.js";import"./index-DdRpaNiN.js";import"./worksheet-BxUIsAEo.js";import"./ArrowForwardIcon-CVIKnzmu.js";function w(w){const{worksheet:{content:f,quiz:{enable:P},key:y,user:{isManager:v}},resultsUserKey:x,page:C,subPage:S,onPageChangeRef:I,lastPageChildren:N,readOnly:K=!1,withoutTableOfContents:L=!1}=w,M=n(e=>e.viewPort.isSmallScreen),O=m(e=>e.user.nickname),W=m(e=>e.organization.key),A=m(e=>e.user.isLogged),R=c(e=>e.setSearchParams),[T,V]=p(C??1),[q,z]=p(S??1),E=l(I),F=t((e,s,t)=>{E.current?E.current(e,s,t):(V(e),z(s),R(t))},[V,z,E,R]),{data:U,mutate:B,isLoading:D,isValidating:G}=g(y&&P&&A?r.apiV2.worksheet.getSubmissionsUser({params:{key:y,userKey:x||o(O,W)}}).url:null),H=a(()=>({data:U?.success?U.content:void 0,isLoading:D,isValidating:G,mutate:B}),[U,D,G,B]),J=a(()=>b(f),[f]),Q=K||!!H?.data&&O!==H.data.user.nickname,X=J.length;return d(t(e=>{"ArrowRight"===e.code?F(Math.min(T+1,X),1,[]):"ArrowLeft"===e.code&&F(Math.max(T-1,1),1,[])},[F,T,X])),e("div",{id:"jk-worksheet-viewer-container",className:i("gap nowrap worksheet-viewer-container center top",{"jk-col":M,"jk-row":!M}),children:[!L&&(M?X>1&&s("div",{className:"jk-row",children:s(h,{page:T,subPage:q,onPageChange:F,sheetsInPages:J})}):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:J,page:T,subPage:q,onPageChange:F})]})),s(k,{sheetsInPages:J,isSolvable:P&&A,userResults:H,readOnly:Q,isEditor:v,worksheetKey:y,page:T,onPageChange:F,subPage:q,lastPageChildren:N})]})}export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as r}from"./mermaid-parser.core-
|
|
1
|
+
import{f as r}from"./mermaid-parser.core-DxB6tfwM.js";export{A as ArchitectureModule}from"./mermaid-parser.core-DxB6tfwM.js";import"./map-BvlAjF4J.js";import"./_baseIteratee-DJNkOVK7.js";import"./memoize-CPUrcYQl.js";import"./isSymbol-CATEdeai.js";import"./_baseUniq-BJKKUJ6e.js";import"./min-Dc9VrJ6M.js";import"./mermaid.core-DmkzFmrK.js";import"./index-tDMZSRa9.js";import"react/jsx-runtime";import"react";import"./settings-DgLs6IK_.js";import"./ProblemStatus-C5CR0Z8d.js";import"./index-BWbfbDmw.js";import"./enums.js";import"./time-BPMFfIa-.js";import"./date-DabTuCYQ.js";import"./websocket-Nx7WdiK7.js";import"./worksheet-ClM0CaBH.js";import"motion/react";import"react-dom";import"./index-BD_n8l03.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"./purify.es-BkjUCQC6.js";import"./string-LeDn2fkG.js";export{r as createArchitectureServices};
|