@mathscan/geometry-engine 0.1.0 → 0.1.1
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/README.md +24 -7
- package/dist/core.cjs +1 -1
- package/dist/core.mjs +4 -4
- package/dist/entries/core.d.cts +1 -1
- package/dist/entries/core.d.ts +1 -1
- package/dist/entries/core.d.ts.map +1 -1
- package/dist/exercise.schema-Bma3qN9P.js +251 -0
- package/dist/exercise.schema-Bma3qN9P.js.map +1 -0
- package/dist/exercise.schema-Oj5ZH-yO.cjs +2 -0
- package/dist/exercise.schema-Oj5ZH-yO.cjs.map +1 -0
- package/dist/exerciseLoad-Db9Cigxi.cjs +2 -0
- package/dist/exerciseLoad-Db9Cigxi.cjs.map +1 -0
- package/dist/{geometryAttemptStatus-5L_q6-9l.js → exerciseLoad-DgeDXYbf.js} +84 -71
- package/dist/exerciseLoad-DgeDXYbf.js.map +1 -0
- package/dist/geometry/entities/angle.d.cts +56 -0
- package/dist/geometry/entities/angle.d.ts +57 -0
- package/dist/geometry/entities/angle.d.ts.map +1 -0
- package/dist/geometry/entities/circle.d.ts.map +1 -1
- package/dist/geometry/entities/index.d.cts +8 -4
- package/dist/geometry/entities/index.d.ts +8 -4
- package/dist/geometry/entities/index.d.ts.map +1 -1
- package/dist/geometry/entities/line.d.ts.map +1 -1
- package/dist/geometry/entities/point.d.ts.map +1 -1
- package/dist/geometry/entities/relations.d.cts +8 -1
- package/dist/geometry/entities/relations.d.ts +8 -1
- package/dist/geometry/entities/relations.d.ts.map +1 -1
- package/dist/geometry/entities/segment.d.ts.map +1 -1
- package/dist/geometry/entityModel.d.cts +21 -3
- package/dist/geometry/entityModel.d.ts +21 -3
- package/dist/geometry/entityModel.d.ts.map +1 -1
- package/dist/geometryState.schema-B5ccMKDa.cjs +2 -0
- package/dist/geometryState.schema-B5ccMKDa.cjs.map +1 -0
- package/dist/geometryState.schema-CKFPlX8j.js +1177 -0
- package/dist/geometryState.schema-CKFPlX8j.js.map +1 -0
- package/dist/goals-BlSeniyt.js +563 -0
- package/dist/goals-BlSeniyt.js.map +1 -0
- package/dist/goals-DLbmBZD8.cjs +2 -0
- package/dist/goals-DLbmBZD8.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +8 -8
- package/dist/measure/angleType.d.cts +2 -0
- package/dist/measure/angleType.d.ts +3 -0
- package/dist/measure/angleType.d.ts.map +1 -0
- package/dist/measure/geometryAdapter.d.cts +3 -0
- package/dist/measure/geometryAdapter.d.ts +3 -0
- package/dist/measure/geometryAdapter.d.ts.map +1 -1
- package/dist/react-B26_e52I.cjs +2 -0
- package/dist/react-B26_e52I.cjs.map +1 -0
- package/dist/{react-BEcdx1f6.js → react-B5cGaxH8.js} +738 -513
- package/dist/react-B5cGaxH8.js.map +1 -0
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +1 -1
- package/dist/renderer/GeometryCanvas.d.ts.map +1 -1
- package/dist/renderer/StudentGeometryCanvas.d.ts.map +1 -1
- package/dist/renderer/Toolbar.d.ts.map +1 -1
- package/dist/renderer/angleMeasure.d.cts +14 -0
- package/dist/renderer/angleMeasure.d.ts +15 -0
- package/dist/renderer/angleMeasure.d.ts.map +1 -0
- package/dist/renderer/deriveRenderableGeometry.d.cts +1 -0
- package/dist/renderer/deriveRenderableGeometry.d.ts +1 -0
- package/dist/renderer/deriveRenderableGeometry.d.ts.map +1 -1
- package/dist/renderer/deriveSemanticScene.d.ts.map +1 -1
- package/dist/renderer/dragSnap.d.cts +14 -0
- package/dist/renderer/dragSnap.d.ts +15 -0
- package/dist/renderer/dragSnap.d.ts.map +1 -0
- package/dist/renderer/shapes/AngleShape.d.cts +19 -0
- package/dist/renderer/shapes/AngleShape.d.ts +20 -0
- package/dist/renderer/shapes/AngleShape.d.ts.map +1 -0
- package/dist/renderer/shapes/EntityLabel.d.cts +9 -1
- package/dist/renderer/shapes/EntityLabel.d.ts +9 -1
- package/dist/renderer/shapes/EntityLabel.d.ts.map +1 -1
- package/dist/renderer/shapes/EntityShape.d.cts +2 -1
- package/dist/renderer/shapes/EntityShape.d.ts +2 -1
- package/dist/renderer/shapes/EntityShape.d.ts.map +1 -1
- package/dist/renderer/useConnectionPreview.d.cts +12 -1
- package/dist/renderer/useConnectionPreview.d.ts +12 -1
- package/dist/renderer/useConnectionPreview.d.ts.map +1 -1
- package/dist/renderer/usePointerGestures.d.cts +1 -1
- package/dist/renderer/usePointerGestures.d.ts +1 -1
- package/dist/renderer/usePointerGestures.d.ts.map +1 -1
- package/dist/schemas/entityDefinition.schema.d.cts +7 -0
- package/dist/schemas/entityDefinition.schema.d.ts +7 -0
- package/dist/schemas/entityDefinition.schema.d.ts.map +1 -1
- package/dist/schemas/entityDocument.d.cts +34 -13
- package/dist/schemas/entityDocument.d.ts +34 -13
- package/dist/schemas/entityDocument.d.ts.map +1 -1
- package/dist/schemas/entityPresentation.schema.d.cts +3 -0
- package/dist/schemas/entityPresentation.schema.d.ts +3 -0
- package/dist/schemas/entityPresentation.schema.d.ts.map +1 -1
- package/dist/schemas/exercise.schema.d.cts +80 -2
- package/dist/schemas/exercise.schema.d.ts +80 -2
- package/dist/schemas/exercise.schema.d.ts.map +1 -1
- package/dist/schemas/exerciseV2.schema.d.cts +57 -0
- package/dist/schemas/exerciseV2.schema.d.ts +57 -0
- package/dist/schemas/exerciseV2.schema.d.ts.map +1 -1
- package/dist/schemas/exerciseV4.schema.d.cts +168 -0
- package/dist/schemas/exerciseV4.schema.d.ts +169 -0
- package/dist/schemas/exerciseV4.schema.d.ts.map +1 -0
- package/dist/schemas/geometryState.schema.d.cts +8 -0
- package/dist/schemas/geometryState.schema.d.ts +8 -0
- package/dist/schemas/geometryState.schema.d.ts.map +1 -1
- package/dist/schemas/goals/angleBisectorGoal.schema.d.cts +15 -0
- package/dist/schemas/goals/angleBisectorGoal.schema.d.ts +16 -0
- package/dist/schemas/goals/angleBisectorGoal.schema.d.ts.map +1 -0
- package/dist/schemas/goals/angleCriterion.schema.d.cts +28 -0
- package/dist/schemas/goals/angleCriterion.schema.d.ts +29 -0
- package/dist/schemas/goals/angleCriterion.schema.d.ts.map +1 -0
- package/dist/schemas/goals/angleMeasureGoal.schema.d.cts +26 -0
- package/dist/schemas/goals/angleMeasureGoal.schema.d.ts +27 -0
- package/dist/schemas/goals/angleMeasureGoal.schema.d.ts.map +1 -0
- package/dist/schemas/goals/createGoal.schema.d.cts +1 -0
- package/dist/schemas/goals/createGoal.schema.d.ts +1 -0
- package/dist/schemas/goals/createGoal.schema.d.ts.map +1 -1
- package/dist/schemas/goals/geometryGoal.schema.d.cts +61 -0
- package/dist/schemas/goals/geometryGoal.schema.d.ts +61 -0
- package/dist/schemas/goals/geometryGoal.schema.d.ts.map +1 -1
- package/dist/schemas/goals/givenAngleGoal.schema.d.cts +35 -0
- package/dist/schemas/goals/givenAngleGoal.schema.d.ts +36 -0
- package/dist/schemas/goals/givenAngleGoal.schema.d.ts.map +1 -0
- package/dist/schemas/goals/goalKindDeclaration.d.cts +7 -0
- package/dist/schemas/goals/goalKindDeclaration.d.ts +7 -0
- package/dist/schemas/goals/goalKindDeclaration.d.ts.map +1 -1
- package/dist/schemas/goals/parallelGoal.schema.d.cts +1 -0
- package/dist/schemas/goals/parallelGoal.schema.d.ts +1 -0
- package/dist/schemas/goals/parallelGoal.schema.d.ts.map +1 -1
- package/dist/schemas/goals/perpendicularGoal.schema.d.cts +1 -0
- package/dist/schemas/goals/perpendicularGoal.schema.d.ts +1 -0
- package/dist/schemas/goals/perpendicularGoal.schema.d.ts.map +1 -1
- package/dist/schemas/goals/throughPointsGoal.schema.d.cts +1 -0
- package/dist/schemas/goals/throughPointsGoal.schema.d.ts +1 -0
- package/dist/schemas/goals/throughPointsGoal.schema.d.ts.map +1 -1
- package/dist/schemas/objectTypeName.schema.d.cts +1 -0
- package/dist/schemas/objectTypeName.schema.d.ts +1 -0
- package/dist/schemas/objectTypeName.schema.d.ts.map +1 -1
- package/dist/schemas/v2ToV3.d.cts +15 -1
- package/dist/schemas/v2ToV3.d.ts +15 -1
- package/dist/schemas/v2ToV3.d.ts.map +1 -1
- package/dist/schemas/v3ToV4.d.cts +2 -1
- package/dist/schemas/v3ToV4.d.ts +2 -1
- package/dist/schemas/v3ToV4.d.ts.map +1 -1
- package/dist/schemas/v4ToV5.d.cts +7 -0
- package/dist/schemas/v4ToV5.d.ts +8 -0
- package/dist/schemas/v4ToV5.d.ts.map +1 -0
- package/dist/schemas.cjs +1 -1
- package/dist/schemas.mjs +3 -3
- package/dist/snapping/computeDragSnap.d.cts +30 -0
- package/dist/snapping/computeDragSnap.d.ts +31 -0
- package/dist/snapping/computeDragSnap.d.ts.map +1 -0
- package/dist/state/geometryContext.d.ts.map +1 -1
- package/dist/store/attemptChange.d.cts +1 -1
- package/dist/store/attemptChange.d.ts +1 -1
- package/dist/store/attemptChange.d.ts.map +1 -1
- package/dist/store/constructionCommand.d.cts +14 -2
- package/dist/store/constructionCommand.d.ts +14 -2
- package/dist/store/constructionCommand.d.ts.map +1 -1
- package/dist/store/constructionIdentity.d.cts +9 -0
- package/dist/store/constructionIdentity.d.ts +9 -0
- package/dist/store/constructionIdentity.d.ts.map +1 -1
- package/dist/store/studentStore.d.cts +7 -0
- package/dist/store/studentStore.d.ts +7 -0
- package/dist/store/studentStore.d.ts.map +1 -1
- package/dist/store/teacherStore.d.cts +16 -0
- package/dist/store/teacherStore.d.ts +16 -0
- package/dist/store/teacherStore.d.ts.map +1 -1
- package/dist/{studentStore-CEKTtMCh.js → studentStore-CyYa0N93.js} +502 -370
- package/dist/studentStore-CyYa0N93.js.map +1 -0
- package/dist/studentStore-ubldy4PJ.cjs +2 -0
- package/dist/studentStore-ubldy4PJ.cjs.map +1 -0
- package/dist/validation/getGeometryExerciseWarnings.d.cts +3 -2
- package/dist/validation/getGeometryExerciseWarnings.d.ts +3 -2
- package/dist/validation/getGeometryExerciseWarnings.d.ts.map +1 -1
- package/dist/validation/goals/angleBisector.d.cts +3 -0
- package/dist/validation/goals/angleBisector.d.ts +4 -0
- package/dist/validation/goals/angleBisector.d.ts.map +1 -0
- package/dist/validation/goals/angleCriterion.d.cts +12 -0
- package/dist/validation/goals/angleCriterion.d.ts +13 -0
- package/dist/validation/goals/angleCriterion.d.ts.map +1 -0
- package/dist/validation/goals/angleMeasure.d.cts +9 -0
- package/dist/validation/goals/angleMeasure.d.ts +10 -0
- package/dist/validation/goals/angleMeasure.d.ts.map +1 -0
- package/dist/validation/goals/create.d.cts +2 -2
- package/dist/validation/goals/create.d.ts +2 -2
- package/dist/validation/goals/create.d.ts.map +1 -1
- package/dist/validation/goals/givenAngle.d.cts +11 -0
- package/dist/validation/goals/givenAngle.d.ts +12 -0
- package/dist/validation/goals/givenAngle.d.ts.map +1 -0
- package/dist/validation/goals/goalKindHandler.d.cts +38 -1
- package/dist/validation/goals/goalKindHandler.d.ts +38 -1
- package/dist/validation/goals/goalKindHandler.d.ts.map +1 -1
- package/dist/validation/goals/index.d.cts +9 -2
- package/dist/validation/goals/index.d.ts +9 -2
- package/dist/validation/goals/index.d.ts.map +1 -1
- package/dist/validation/goals/midpoint.d.cts +2 -2
- package/dist/validation/goals/midpoint.d.ts +2 -2
- package/dist/validation/goals/midpoint.d.ts.map +1 -1
- package/dist/validation/goals/parallel.d.cts +2 -2
- package/dist/validation/goals/parallel.d.ts +2 -2
- package/dist/validation/goals/parallel.d.ts.map +1 -1
- package/dist/validation/goals/perpendicular.d.cts +2 -2
- package/dist/validation/goals/perpendicular.d.ts +2 -2
- package/dist/validation/goals/perpendicular.d.ts.map +1 -1
- package/dist/validation/goals/segmentLength.d.cts +2 -2
- package/dist/validation/goals/segmentLength.d.ts +2 -2
- package/dist/validation/goals/segmentLength.d.ts.map +1 -1
- package/dist/validation/goals/throughPoints.d.cts +2 -2
- package/dist/validation/goals/throughPoints.d.ts +2 -2
- package/dist/validation/goals/throughPoints.d.ts.map +1 -1
- package/dist/validation/types.d.cts +5 -1
- package/dist/validation/types.d.ts +5 -1
- package/dist/validation/types.d.ts.map +1 -1
- package/dist/validation/validateGeometryState.d.ts.map +1 -1
- package/dist/validation/validateGeometryStateInput.d.ts.map +1 -1
- package/dist/validation.cjs +1 -1
- package/dist/validation.cjs.map +1 -1
- package/dist/validation.mjs +106 -85
- package/dist/validation.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/exercise.schema-BV2b7rtN.cjs +0 -2
- package/dist/exercise.schema-BV2b7rtN.cjs.map +0 -1
- package/dist/exercise.schema-ckVBW9XA.js +0 -212
- package/dist/exercise.schema-ckVBW9XA.js.map +0 -1
- package/dist/geometryAttemptStatus-5L_q6-9l.js.map +0 -1
- package/dist/geometryAttemptStatus-N_XHIkiS.cjs +0 -2
- package/dist/geometryAttemptStatus-N_XHIkiS.cjs.map +0 -1
- package/dist/geometryState.schema-D0ixyGYE.js +0 -955
- package/dist/geometryState.schema-D0ixyGYE.js.map +0 -1
- package/dist/geometryState.schema-DKQ-durx.cjs +0 -2
- package/dist/geometryState.schema-DKQ-durx.cjs.map +0 -1
- package/dist/goals-C3ZwbEh_.js +0 -451
- package/dist/goals-C3ZwbEh_.js.map +0 -1
- package/dist/goals-CxR5qPDC.cjs +0 -2
- package/dist/goals-CxR5qPDC.cjs.map +0 -1
- package/dist/react-BEcdx1f6.js.map +0 -1
- package/dist/react-Pp_VSk--.cjs +0 -2
- package/dist/react-Pp_VSk--.cjs.map +0 -1
- package/dist/studentStore-CEKTtMCh.js.map +0 -1
- package/dist/studentStore-DLftfFAl.cjs +0 -2
- package/dist/studentStore-DLftfFAl.cjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { $ as q, A as J, B as Y, C as X, D as Z, E as Q, F as $, G as ee, H as te, I as ne, J as re, K as ie, L as ae, M as oe, N as se, O as ce, P as le, Q as ue, R as de, S as fe, T as pe, U as me, V as he, W as ge, X as _e, Y as ve, Z as ye, _ as be, a as xe, at as Se, b as Ce, c as we, ct as Te, d as Ee,
|
|
1
|
+
import { B as e, C as t, Ct as n, J as r, M as i, St as a, Tt as o, _ as s, _t as c, at as l, b as u, bt as d, ct as f, dt as p, et as m, ft as h, g, gt as _, h as v, ht as y, i as b, it as x, j as S, l as C, lt as w, m as T, mt as E, n as D, nt as O, o as k, ot as A, pt as j, r as M, rt as N, st as P, t as F, tt as I, ut as L, v as R, vt as z, wt as B, xt as V, yt as H, z as U } from "./geometryState.schema-CKFPlX8j.js";
|
|
2
|
+
import { f as W, n as G, p as K } from "./goals-BlSeniyt.js";
|
|
3
|
+
import { $ as q, A as J, B as Y, C as X, D as Z, E as Q, F as $, G as ee, H as te, I as ne, J as re, K as ie, L as ae, M as oe, N as se, O as ce, P as le, Q as ue, R as de, S as fe, T as pe, U as me, V as he, W as ge, X as _e, Y as ve, Z as ye, _ as be, a as xe, at as Se, b as Ce, c as we, ct as Te, d as Ee, dt as De, et as Oe, f as ke, g as Ae, h as je, i as Me, it as Ne, j as Pe, k as Fe, l as Ie, lt as Le, m as Re, n as ze, nt as Be, o as Ve, ot as He, p as Ue, q as We, r as Ge, rt as Ke, s as qe, st as Je, t as Ye, tt as Xe, u as Ze, ut as Qe, v as $e, w as et, x as tt, y as nt, z as rt } from "./studentStore-CyYa0N93.js";
|
|
4
4
|
import "./core.mjs";
|
|
5
|
-
import { a as
|
|
5
|
+
import { a as it, c as at, i as ot, l as st, n as ct, o as lt, r as ut, s as dt, t as ft, u as pt } from "./exercise.schema-Bma3qN9P.js";
|
|
6
6
|
import "./schemas.mjs";
|
|
7
|
-
import { a as
|
|
8
|
-
import { checkGeometryAnswer as
|
|
9
|
-
import { C as
|
|
10
|
-
export {
|
|
7
|
+
import { a as mt, c as ht, d as gt, i as _t, l as vt, r as yt, u as bt } from "./exerciseLoad-DgeDXYbf.js";
|
|
8
|
+
import { checkGeometryAnswer as xt, checkGeometryAnswerDetailed as St, evaluateGeometryState as Ct, evaluateGeometryStateDetailed as wt, revealGeometryAnswers as Tt, revealGeometryAttempt as Et, validateGeometryExercise as Dt, validateGeometryExerciseJson as Ot, validateGeometryState as kt } from "./validation.mjs";
|
|
9
|
+
import { C as At, S as jt, _ as Mt, a as Nt, b as Pt, c as Ft, d as It, f as Lt, g as Rt, h as zt, i as Bt, l as Vt, m as Ht, n as Ut, o as Wt, p as Gt, r as Kt, s as qt, t as Jt, u as Yt, v as Xt, x as Zt, y as Qt } from "./react-B5cGaxH8.js";
|
|
10
|
+
export { f as CALCULATION_EPSILON, w as CONNECTION_SNAP_RADIUS_PX, L as COORDINATE_EPSILON, Rt as CircleShape, zt as EntityShape, p as GRADING_BOUNDARY_EPSILON, It as GeometryCanvas, Kt as GeometryCompanion, Ht as GeometryGrid, Gt as GeometryInstruments, Mt as LineShape, h as PARAMETER_EPSILON, j as PLACEMENT_SNAP_RADIUS_PX, E as POINT_REUSE_EPSILON, Qt as PointShape, y as RELATIVE_DEGENERACY_EPSILON, Xt as SegmentShape, Pt as SnapMarker, Vt as StudentGeometryCanvas, Bt as StudentGeometryCompanion, Jt as StudentGeometryExercise, Nt as TeacherGeometryCompanion, Ut as Toolbar, fe as addGivenLine, X as addGivenPoint, et as addGivenSegment, pe as addGoal, Ye as addStudentPoint, Wt as announceSceneChange, k as applyMigrations, _ as approximatelyEqual, W as buildGeometryContext, Q as cancelGivenConstruction, ze as cancelStudentConstruction, xt as checkGeometryAnswer, St as checkGeometryAnswerDetailed, Se as clipLineToViewport, m as closestPointOnCircle, I as closestPointOnLine, O as closestPointOnSegment, He as computePlacement, q as computeSnap, c as coordinatesCoincide, _t as createEmptyGeometryAttempt, u as createGoalSchema, ue as createStore, Ge as createStudentStore, Z as createTeacherStore, Me as deleteStudentObject, ht as deriveGeometryCanvasFeedback, jt as deriveRenderableGeometry, At as deriveStudentRenderableGeometry, qt as deriveStudentSemanticScene, Ft as deriveTeacherSemanticScene, B as distanceBetween, N as distancePointToCircle, x as distancePointToLine, l as distancePointToSegment, ce as endGivenPointDrag, xe as endStudentPointDrag, Yt as entityDisplayName, i as entryOf, Ct as evaluateGeometryState, wt as evaluateGeometryStateDetailed, Ve as executeConstruction, Fe as executeGivenConstruction, ft as exerciseGradingSchema, ct as extraObjectPolicySchema, Qe as firstHit, ut as geometryExerciseMigrations, ot as geometryExerciseSchema, st as geometryGoalSchema, S as geometryIdSchema, F as geometryStateMigrations, D as geometryStateSchema, yt as getGeometryExerciseWarnings, J as getGivenRemovalImpact, G as getGoalKindHandler, qe as getStudentRemovalImpact, Be as gridStep, Ke as gridSteps, mt as hasGeometryWork, De as hitTest, r as intersectionsOf, K as isCandidatePoint, z as isDegenerateAtScale, Pe as isGivenPointDraggable, H as isSameStoredPoint, we as isStudentOwned, Ie as isStudentPointDraggable, d as isWithinSegmentParameter, it as latestGeometryExerciseVersion, M as latestGeometryStateVersion, oe as loadExercise, Je as mathToScreen, pt as mathViewportSchema, R as midpointGoalSchema, o as midpointOf, lt as migrateGeometryExercise, b as migrateGeometryState, se as moveGivenPoint, Ze as moveStudentPoint, Ne as nearestGridPoint, t as objectTypeNameSchema, Oe as originForSnap, s as parallelGoalSchema, U as parentsOfDefinition, dt as parseGeometryExercise, g as perpendicularGoalSchema, le as pickPointForPendingObject, Ee as pickStudentPoint, V as pixelRadiusToMathTolerance, A as pointAlong, C as pointSchema, P as projectionParameter, $ as promoteGivenEntity, ne as promoteGivenPoint, ke as promoteStudentPoint, Ue as redoStudentChange, ae as redoTeacherChange, de as removeGiven, rt as removeGoal, Y as replaceGoal, Re as replaceStudentAttempt, je as replaceStudentSession, Ae as resetStudentAttempt, e as resolveAgainstPoints, Tt as revealGeometryAnswers, Et as revealGeometryAttempt, be as revealStudentAnswer, Te as screenLengthToMath, Le as screenToMath, v as segmentLengthGoalSchema, he as selectGiven, te as selectPendingObjectType, $e as selectStudentObject, nt as selectStudentObjectType, vt as serializeGeometryState, me as setAllowedObjects, ge as setExtraObjectPolicy, ee as setGivenLabel, ie as setGivenMeasureLabel, We as setGivenPointDraggable, re as setShowGrid, Ce as setStudentReadOnly, ve as setTools, _e as setViewport, Xe as snapPosition, T as throughPointsGoalSchema, at as toolNameSchema, tt as undoStudentChange, ye as undoTeacherChange, Zt as usePlacementSnap, Lt as useStoreState, Dt as validateGeometryExercise, Ot as validateGeometryExerciseJson, kt as validateGeometryState, bt as validateGeometryStateInput, gt as validateGeometryStateJson, a as withinAuthoredDeviation, n as withinAuthoredTolerance };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angleType.d.ts","sourceRoot":"","sources":["../../src/measure/angleType.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAA;AAU5E,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAQ7D"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Point } from '../geometry/point.cjs';
|
|
2
2
|
export declare function pointsCoincide(a: Point, b: Point): boolean;
|
|
3
3
|
export declare function lineAngleRadians(from: Point, to: Point): number;
|
|
4
|
+
export declare function directionTurn(from: Point, to: Point): number | null;
|
|
5
|
+
export declare function sweepTurn(from: number, to: number): number;
|
|
4
6
|
export declare function linesAngleBetweenDegrees(from1: Point, to1: Point, from2: Point, to2: Point): number;
|
|
7
|
+
export declare function angleDifferenceDegrees(a: number, b: number): number;
|
|
5
8
|
export interface MeasuredLinear {
|
|
6
9
|
type: 'segment' | 'line';
|
|
7
10
|
from: Point;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Point } from '../geometry/point.js';
|
|
2
2
|
export declare function pointsCoincide(a: Point, b: Point): boolean;
|
|
3
3
|
export declare function lineAngleRadians(from: Point, to: Point): number;
|
|
4
|
+
export declare function directionTurn(from: Point, to: Point): number | null;
|
|
5
|
+
export declare function sweepTurn(from: number, to: number): number;
|
|
4
6
|
export declare function linesAngleBetweenDegrees(from1: Point, to1: Point, from2: Point, to2: Point): number;
|
|
7
|
+
export declare function angleDifferenceDegrees(a: number, b: number): number;
|
|
5
8
|
export interface MeasuredLinear {
|
|
6
9
|
type: 'segment' | 'line';
|
|
7
10
|
from: Point;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometryAdapter.d.ts","sourceRoot":"","sources":["../../src/measure/geometryAdapter.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAmB,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAa/D,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,OAAO,CAE1D;AAUD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,GAAG,MAAM,CAG/D;
|
|
1
|
+
{"version":3,"file":"geometryAdapter.d.ts","sourceRoot":"","sources":["../../src/measure/geometryAdapter.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAmB,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAa/D,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,OAAO,CAE1D;AAUD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,GAAG,MAAM,CAG/D;AASD,wBAAgB,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAGnE;AAKD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAE1D;AAUD,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,KAAK,EACV,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,KAAK,GACT,MAAM,CAQR;AAMD,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAGnE;AASD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,SAAS,GAAG,MAAM,CAAA;IACxB,IAAI,EAAE,KAAK,CAAA;IACX,EAAE,EAAE,KAAK,CAAA;CACV;AAMD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAA;IACd,MAAM,EAAE,KAAK,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,cAAc,CAAA;AAS5D;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAEpE;AA6HD,wBAAgB,eAAe,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,GAAG,KAAK,EAAE,CAK7E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./geometryState.schema-B5ccMKDa.cjs"),t=require("./goals-DLbmBZD8.cjs"),n=require("./studentStore-ubldy4PJ.cjs"),r=require("./exerciseLoad-Db9Cigxi.cjs");let i=require("react"),a=require("react-konva"),o=require("react/jsx-runtime");var s={implicit:{rendered:!1,selectable:!1,snapTarget:!0},explicit:{rendered:!0,selectable:!0,snapTarget:!0}};function c(e){return s[e]}function l(e,t){if(e.presentationOf(t).measureLabel!==`degrees`)return;let n=e.resolvedOf(t);if(n?.kind!==`angle`)return;let r=Number((n.sweepTurn*360).toFixed(0));return`${(r>=360?0:r).toFixed(0)}°`}function u(e){let n=t.c(e.exercise),r=n.points,i=new Map,a=[];for(let[t,n]of Object.entries(e.exercise.entities)){if(n.kind!==`point`){a.push({id:t,definition:n});continue}let e=r.get(t);e&&i.set(t,e)}return f(i,a,n)}function d(e,n){let r=t.f(e,n);return f(r.points,[...t.l(e,n).values()],r)}function f(e,t,n){let r=e=>c(n.presentationOf(e).role),i=e=>n.presentationOf(e).role===`explicit`?l(n,e):void 0;return{points:e,objects:t,capabilitiesOf:r,labelOf:e=>{let t=n.presentationOf(e);if(t.role!==`explicit`)return;let r=i(e);return r===void 0?t.label:t.label===void 0?r:`${t.label} = ${r}`},measureOf:i,isSnapTarget:e=>r(e).snapTarget}}var p={gestureFrom:null,pointer:null,snap:null};function m(t,n,r,i){let a=e.B({kind:`angle`,parents:[n,r,i]},t);return a&&e.H(a)}function h({points:e,viewport:t,canvas:r,pendingObjectType:a,pendingFirstPointId:o,pendingVertexPointId:s=null,connect:c,pick:l,objects:u=[],isSnapTarget:d,canCreatePoints:f=!1,preserveCreatedPointOrigins:h=!0}){let g=(0,i.useRef)(null),_=(0,i.useRef)(null),v=(0,i.useRef)(null),[y,b]=(0,i.useState)(p),x=a===`angle`,S=x||a===`segment`||a===`line`,C=n.ot(t,r),w=n.ct(32,C),T={points:e,objects:u,viewport:t,isSnapTarget:d},E=y.snap?.kind===`point`?y.snap.targetIds[0]??null:null;function D(){let e=g.current;b(e?{gestureFrom:e.fromPoint,pointer:e.pointer,snap:v.current}:{gestureFrom:null,pointer:_.current,snap:v.current})}function O(e){return n.lt(e,t,r,C)}function k(t){return e.has(t)&&(!d||d(t))}function A(e,t){return n.$(O(e),T,{tolerance:w,exclude:t?.kind===`existing`?[t.id]:[],kinds:f&&!x?[`point`,`intersection`,`onObject`]:[`point`]})}let j=(()=>{let i=y.gestureFrom??(o?e.get(o)??null:null),{pointer:c}=y;if(!S||!i||!c||s)return null;let l=y.snap?n.st(y.snap.position,t,r):c;if(a!==`line`){let e=n.st(i,t,r);return[e.x,e.y,l.x,l.y]}let u=n.at(i,O(l),t);if(!u)return null;let d=n.st(u[0],t,r),f=n.st(u[1],t,r);return[d.x,d.y,f.x,f.y]})(),M=x&&o&&s&&E?m(e,o,s,E):null;function N(t,r){if(g.current=null,_.current=null,v.current=null,!S)return;if(o){let n={kind:`existing`,id:o};g.current={from:n,fromPoint:e.get(o)??O(t),completing:!0,pointer:t},v.current=A(t,n),D();return}let i=r&&k(r)?r:null,a=O(t),s=null;if(!i&&(!f||(s=n.$(a,T,{tolerance:w,kinds:[`point`,`intersection`,`onObject`]}),s?.kind===`point`&&(i=s.targetIds[0]??null,!i||!k(i)))))return;if(i){g.current={from:{kind:`existing`,id:i},fromPoint:e.get(i),completing:!1,pointer:null};return}if(x)return;let c=s?.position??a,l=s&&h?n.et({position:c,snap:s}):null;g.current={from:{kind:`create`,origin:l??{kind:`point`,at:c}},fromPoint:c,completing:!1,pointer:null}}function P(e){let t=g.current;!t||x||(v.current=A(e,t.from),g.current={...t,pointer:e},D())}function F(e){if(!g.current){if(!S||!o||!e){if(!_.current&&!v.current)return;_.current=null,v.current=null,D();return}_.current=e,v.current=A(e,{kind:`existing`,id:o}),D()}}function ee(e,t,r){let i=e?{kind:`existing`,id:e}:f?{kind:`create`,origin:{kind:`point`,at:t}}:null;if(!r)return i;if(r.kind===`point`){let e=r.targetIds[0];return e?{kind:`existing`,id:e}:i}if(!f)return i;if(!h)return{kind:`create`,origin:{kind:`point`,at:r.position}};let a=n.et({position:r.position,snap:r});return a?{kind:`create`,origin:a}:i}function I(e,t,n){let r=g.current;if(g.current=null,v.current=null,D(),!r||!S)return!1;let i=t&&k(t)?t:null;if(!n){let t=r.completing?i??te(e):r.from.kind===`existing`?r.from.id:null;return t?(l(t),!0):!1}if(x)return!0;let a=ee(i,O(e),A(e,r.from));return a&&c(r.from,a),!0}function te(e){let t=n.$(O(e),T,{tolerance:w,kinds:[`point`]}),r=t?.kind===`point`?t.targetIds[0]:void 0;return r&&k(r)?r:null}function L(){!g.current&&!_.current&&!v.current||(g.current=null,_.current=null,v.current=null,D())}return{connecting:S,previewPoints:j,previewAngle:M,snapTargetId:S?E:null,snapPreview:S&&y.snap&&y.snap.kind!==`point`?y.snap:null,press:N,drag:P,hover:F,release:I,cancel:L}}function g({points:e,objects:t,viewport:r,canvas:a,showGrid:o,isSnapTarget:s,active:c}){let[l,u]=(0,i.useState)(null),d=n.ot(r,a),f={points:e,objects:t,viewport:r,showGrid:o,isSnapTarget:s},p={tolerance:n.ct(24,d)};function m(e){if(!c){l&&u(null);return}u(n.$(n.lt(e,r,a,d),f,p))}function h(e){let t=e.target.getStage()?.getPointerPosition();t?m(t):!c&&l&&u(null)}function g(){l&&u(null)}function _(e){let t=n.lt(e,r,a,d);if(!c)return{position:t,snap:null};let i=n.$(t,f,p);return{position:i?.position??t,snap:i}}return{snap:c?l:null,trackAt:m,trackPointer:h,clearPointer:g,resolvePlacement:_}}function _(e){let t=new Set;for(let n of e)switch(n.type){case`create`:case`throughPoints`:case`perpendicular`:case`parallel`:case`segmentLength`:case`midpoint`:case`angleMeasure`:case`angleBisector`:break;case`givenAngle`:t.add(n.angleId)}return t}function v(t){let{scene:r,pointId:i,pointer:a,start:o,judgedAngleIds:s,isExerciseEntity:c}=t;if(!t.free)return a;let l=null,u=e=>(s.has(e)?2:0)+ +!!c(e);for(let{id:t,definition:n}of r.objects){if(n.kind!==`angle`)continue;let[a,o,s]=n.parents;if(o===i||a!==i&&s!==i)continue;if(l){let e=u(t)-u(l.id);if(e<0||e===0&&l.id<t)continue}let c=e.B(n,r.points);c?.kind===`angle`&&(l={id:t,definition:n,resolved:c})}if(!l)return n.$(a,r,{tolerance:t.tolerance,kinds:[`grid`]})?.position??a;let[d,,f]=l.definition.parents,{vertex:p,startTurn:m,sweepTurn:h}=l.resolved,g=e.q(p,a);if(g===null)return null;let _=d===i?g:m,v=f===i?g:m+h,y=Math.round(e.Z(_,v)*360/1)*1%360/360,b=d===i?v-y:_+y,x=e.wt(o,p),S=b*2*Math.PI;return{x:p.x+x*Math.cos(S),y:p.y+x*Math.sin(S)}}function y({exercise:t,attempt:r={},points:i,objects:a,canvas:o},s,c,l){let{viewport:u,entities:d}=t,f=n.ot(u,o),p=e.M(r,s)??e.M(d,s);return v({scene:{points:i,objects:a,viewport:u,showGrid:t.showGrid},pointId:s,pointer:n.lt(c,u,o,f),start:n.lt(l,u,o,f),free:p?.kind===`point`&&`at`in p,tolerance:n.ct(24,f),judgedAngleIds:_(t.goals),isExerciseEntity:t=>e.M(d,t)!==void 0})}function b(e,t,n){let r=n.width>0&&t.width/n.width||1,i=n.height>0&&t.height/n.height||1;return{x:(e.x-t.left)/r,y:(e.y-t.top)/i}}function x(e){return e===`touch`?8:4}function S(e,t,n){return{pointerId:e,pointerType:t,origin:n,maxDisplacement:0,dragging:!1}}function C(e,t){let n=Math.hypot(t.x-e.origin.x,t.y-e.origin.y),r=Math.max(e.maxDisplacement,n);return{...e,maxDisplacement:r,dragging:e.dragging||r>=x(e.pointerType)}}function w(e){return e.isPrimary?e.pointerType!==`mouse`||e.button===0:!1}var T={touchAction:`none`,userSelect:`none`,WebkitUserSelect:`none`};function E(e,t){return e.x>=0&&e.y>=0&&e.x<=t.width&&e.y<=t.height}var D=`geometry-point-`,O=`geometry-object-`;function k(e){return`${D}${e}`}function A(e){return`${O}${e}`}function j(e){return e.startsWith(D)?{kind:`point`,id:e.slice(15)}:e.startsWith(O)?{kind:`object`,id:e.slice(16)}:null}function M(e,t,n,r){let a=(0,i.useRef)({handlers:r,canvas:t,store:n});(0,i.useLayoutEffect)(()=>{a.current={handlers:r,canvas:t,store:n}});let o=(0,i.useRef)(null),s=(0,i.useRef)(()=>{}),c=(0,i.useRef)(n);(0,i.useEffect)(()=>{let t=e.current;if(!t)return;let n=t.container();function r(e){let n=t.content;return b({x:e.clientX,y:e.clientY},n.getBoundingClientRect(),{width:n.clientWidth,height:n.clientHeight})}function i(e){return{x:e.clientX,y:e.clientY}}let c=new Map;function l(e){let n=t.getIntersection(e);if(!n)return{kind:`stage`};let r=j(n.id());return r?.kind===`point`&&!a.current.handlers.pointOnScreen(r.id)?{kind:`foreign`}:r??{kind:`foreign`}}function u(e){let t=l(e);return t.kind===`point`?t.id:null}function d(e){if(o.current===e&&(o.current=null),e.captured)try{n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId)}catch{}}function f(e){let t=o.current;t&&d(t);let{handlers:n}=a.current;n.connection.cancel(),n.placement.clearPointer(),t?(t.role===`point`&&t.dragging&&t.dragFrom&&t.handlers.endPointDrag(t.target.id),t.handlers.abandonConstruction()):e!==`store-replaced`&&n.abandonConstruction(),e===`escape`&&n.tool&&n.disarmTool()}s.current=f;function p(e){return a.current.store!==e.store||(e.store.getState().interactionEpoch??0)!==e.epoch}function m(e){let t=o.current;return!t||t.pointerId!==e.pointerId?null:p(t)?(f(`invalidated`),null):t}function h(e){if(o.current||!w(e)||c.size>1)return;let t=r(e),s=l(t);if(s.kind===`foreign`)return;let{handlers:u,store:d}=a.current,f=u.tool===`segment`||u.tool===`line`||u.tool===`angle`?`connect`:s.kind,p=f===`point`&&s.kind===`point`&&u.canDragPoint(s.id)?u.pointOnScreen(s.id):null,m=!1;try{n.setPointerCapture(e.pointerId),m=!0}catch{}o.current={...S(e.pointerId,e.pointerType,i(e)),store:d,epoch:d.getState().interactionEpoch??0,handlers:u,stageOrigin:t,target:s,role:f,dragFrom:p,captured:m},f===`connect`?u.connection.press(t,s.kind===`point`?s.id:null):u.tool===`point`&&f===`stage`&&u.placement.trackAt(t)}function g(e){if(e.isPrimary)for(let[t,n]of c)n===e.pointerType&&t!==e.pointerId&&c.delete(t);c.set(e.pointerId,e.pointerType);let t=o.current;t&&t.pointerId!==e.pointerId&&f(`second-pointer`)}function _(e){c.delete(e.pointerId)}function v(e){e.buttons===0&&c.delete(e.pointerId);let t=m(e);if(!t)return;let n=r(e),s={...t,...C(t,i(e))};if(o.current=s,!s.dragging)return;let{handlers:l}=a.current;s.role===`connect`?l.connection.drag(n):s.role===`point`&&s.dragFrom?l.dragPoint(s.target.id,{x:s.dragFrom.x+n.x-s.stageOrigin.x,y:s.dragFrom.y+n.y-s.stageOrigin.y},s.dragFrom):s.role===`stage`&&!t.dragging&&l.placement.clearPointer()}function y(e){let t=m(e);if(!t)return;let n=r(e);if(!E(n,a.current.canvas)){f(`outside-release`);return}let{dragging:o}=C(t,i(e));d(t);let{handlers:s}=a.current,{target:c}=t;switch(t.role){case`connect`:!s.connection.release(n,u(n),o)&&!o&&c.kind===`stage`&&s.tapStage(n);break;case`point`:o?t.dragFrom&&s.endPointDrag(c.id):s.tapPoint(c.id);break;case`object`:o||s.tapObject(c.id);break;case`stage`:o||s.tapStage(n)}e.pointerType!==`mouse`&&e.pointerType!==`pen`&&s.placement.clearPointer()}function x(e){m(e)&&f(`pointercancel`)}function T(e){let t=o.current;t?.captured&&t.pointerId===e.pointerId&&f(`lost-capture`)}function D(e){if(o.current||e.pointerType===`touch`)return;let t=r(e),{handlers:n}=a.current;n.connection.hover(t),n.tool===`point`&&n.placement.trackAt(t)}function O(){if(o.current)return;let{handlers:e}=a.current;e.connection.hover(null),e.placement.clearPointer()}function k(){c.clear(),f(`blur`)}function A(){document.visibilityState===`hidden`&&(c.clear(),f(`hidden`))}function M(e){e.key===`Escape`&&(!o.current&&!a.current.handlers.tool||f(`escape`))}let N=[];function P(e,t,n,r=!1){let i=n;e.addEventListener(t,i,r),N.push(()=>e.removeEventListener(t,i,r))}return P(n,`pointerdown`,h),P(n,`pointermove`,D),P(n,`pointerleave`,O),P(n,`lostpointercapture`,T),P(window,`pointerdown`,g,!0),P(window,`pointerup`,_,!0),P(window,`pointercancel`,_,!0),P(window,`pointermove`,v),P(window,`pointerup`,y),P(window,`pointercancel`,x),P(window,`blur`,k),P(window,`keydown`,M),P(document,`visibilitychange`,A),()=>{for(let e of N)e();f(`unmount`),s.current=()=>{}}},[e]),(0,i.useEffect)(()=>{c.current!==n&&(c.current=n,s.current(`store-replaced`));let e=n.getState().interactionEpoch??0;return n.subscribe(t=>{let n=t.interactionEpoch??0;n!==e&&(e=n,s.current(`invalidated`))})},[n]),(0,i.useEffect)(()=>{o.current&&s.current(`resize`)},[t.width,t.height])}var N=`#786af5`,P={point:`point`,intersection:`intersection`,grid:`grid`,onObject:`on object`};function F({snap:e,viewport:t,canvas:r}){let i=n.st(e.position,t,r);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(a.Circle,{x:i.x,y:i.y,radius:12,stroke:N,strokeWidth:2,dash:[4,3],listening:!1}),(0,o.jsx)(a.Circle,{x:i.x,y:i.y,radius:3.5,fill:N,listening:!1}),(0,o.jsx)(a.Text,{x:i.x+15,y:i.y+8,text:P[e.kind],fontSize:13,fontStyle:`bold`,fill:N,listening:!1})]})}var ee=22;function I({id:e,position:t,viewport:r,canvas:i,selected:s=!1,connectable:c=!1,snapTarget:l=!1,label:u,color:d=`#24304a`,feedbackRingColor:f,feedbackRingDashed:p=!1}){let m=n.st(t,r,i),h=l||s?13:c?10:9;return(0,o.jsxs)(o.Fragment,{children:[f&&(0,o.jsx)(a.Circle,{x:m.x,y:m.y,radius:15,stroke:f,strokeWidth:4,dash:p?[7,5]:void 0,listening:!1}),l&&(0,o.jsx)(a.Circle,{x:m.x,y:m.y,radius:20,fill:`#786af526`,stroke:`#786af5`,strokeWidth:2,shadowColor:`#786af5`,shadowBlur:18,listening:!1}),(0,o.jsx)(a.Circle,{id:k(e),x:m.x,y:m.y,radius:h,fill:l||s?`#6d5dfc`:d,stroke:c&&!s&&!l?`#a69df8`:`#fff`,strokeWidth:3,hitStrokeWidth:2*(ee-h),shadowColor:`#24304a`,shadowBlur:s?12:4}),(0,o.jsx)(a.Text,{x:m.x+13,y:m.y-23,text:u??e,fontSize:18,fontStyle:`bold`,fill:d,listening:!1})]})}var te=44;function L({id:e,a:t,b:n,color:r,strokeWidth:i,dashed:s,selected:c,opacity:l,listening:u}){return(0,o.jsx)(a.Line,{id:A(e),points:[t.x,t.y,n.x,n.y],stroke:r,strokeWidth:c?i+3:i,lineCap:`round`,dash:s?[10,6]:void 0,hitStrokeWidth:te,opacity:l,listening:u})}function R({id:e,from:t,to:r,viewport:i,canvas:a,color:s=`#6d5dfc`,strokeWidth:c=5,dashed:l=!1,selected:u=!1,opacity:d=1,listening:f=!0}){let p=n.st(t,i,a),m=n.st(r,i,a);return(0,o.jsx)(L,{id:e,a:p,b:m,color:s,strokeWidth:c,dashed:l,selected:u,opacity:d,listening:f})}function z({id:e,through:t,viewport:r,canvas:i,color:a=`#6d5dfc`,strokeWidth:s=4,dashed:c=!1,selected:l=!1,opacity:u=1,listening:d=!0}){let f=n.at(t[0],t[1],r);if(!f)return null;let p=n.st(f[0],r,i),m=n.st(f[1],r,i);return(0,o.jsx)(L,{id:e,a:p,b:m,color:a,strokeWidth:s,dashed:c,selected:l,opacity:u,listening:d})}var ne=44,re=48;function ie({id:t,vertex:r,startTurn:i,sweepTurn:s,radius:c,viewport:l,canvas:u,color:d=`#6d5dfc`,strokeWidth:f=4,dashed:p=!1,selected:m=!1,opacity:h=1,listening:g=!0}){let _=[],v=e=>{let t=n.st(e,l,u);_.push(t.x,t.y)},y=(e,t)=>({x:t*Math.cos(2*Math.PI*e),y:t*Math.sin(2*Math.PI*e)}),b=e.G({vertex:r,startTurn:i,sweepTurn:s,markRadius:c});if(b)b.forEach(v);else for(let e=0;e<=re;e+=1){let t=y(i+s*e/re,c);v({x:r.x+t.x,y:r.y+t.y})}return(0,o.jsx)(a.Line,{id:A(t),points:_,stroke:d,strokeWidth:m?f+3:f,dash:p?[10,6]:void 0,hitStrokeWidth:ne,opacity:h,listening:g,lineCap:`round`,lineJoin:`round`,closed:!1})}var ae=44;function oe({id:e,center:t,radius:r,viewport:i,canvas:s,color:c=`#6d5dfc`,strokeWidth:l=4,dashed:u=!1,selected:d=!1,opacity:f=1,listening:p=!0}){let m=n.ot(i,s),h=n.st(t,i,s,m);return(0,o.jsx)(a.Ellipse,{id:A(e),x:h.x,y:h.y,radiusX:r*m.scaleX,radiusY:r*m.scaleY,stroke:c,strokeWidth:d?l+3:l,dash:u?[10,6]:void 0,hitStrokeWidth:ae,opacity:f,listening:p})}var se={point:()=>null,segment:e=>B(e.from,e.to),line:(e,t)=>{let r=n.at(e.through[0],e.through[1],t);return r?B(r[0],r[1]):null},circle:e=>({x:e.center.x,y:e.center.y+e.radius}),angle:e=>{let t=2*Math.PI*(e.startTurn+e.sweepTurn/2);return{x:e.vertex.x+e.radius*Math.cos(t),y:e.vertex.y+e.radius*Math.sin(t)}}};function ce(e,t){let n=se[e.shape];return n(e,t)}function le({text:e,measured:t=!1,descriptor:r,viewport:i,canvas:s,color:c=`#24304a`,opacity:l=1}){let u=ce(r,i);if(!u)return null;let d=n.st(u,i,s),f={text:e,fontSize:18,fontStyle:`bold`,fill:c,opacity:l,listening:!1};if(t&&r.shape===`angle`){let e=n.st(r.vertex,i,s),t=2*Math.PI*(r.startTurn+r.sweepTurn/2),c=n.st({x:r.vertex.x+Math.cos(t),y:r.vertex.y+Math.sin(t)},i,s),l=Math.hypot(c.x-e.x,c.y-e.y);return(0,o.jsx)(a.Text,{...f,x:d.x+(c.x-e.x)/l*40,y:d.y+(c.y-e.y)/l*40,ref:e=>ue(e)})}return(0,o.jsx)(a.Text,{...f,x:d.x+10,y:d.y-24})}function ue(e){e?.offset({x:e.width()/2,y:e.height()/2})}function B(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var de={point:()=>null,segment:(e,t)=>(0,o.jsx)(R,{...t,from:e.from,to:e.to}),line:(e,t)=>(0,o.jsx)(z,{...t,through:[e.through[0],e.through[1]]}),circle:(e,t)=>(0,o.jsx)(oe,{...t,center:e.center,radius:e.radius}),angle:(e,t)=>(0,o.jsx)(ie,{...t,vertex:e.vertex,startTurn:e.startTurn,sweepTurn:e.sweepTurn,radius:e.radius})};function V({descriptor:e,label:t,measured:n,...r}){let i=de[e.shape],a=i(e,r);return!a||t===void 0?a:(0,o.jsxs)(o.Fragment,{children:[a,(0,o.jsx)(le,{text:t,measured:n,descriptor:e,viewport:r.viewport,canvas:r.canvas,color:r.color,opacity:r.opacity})]})}function H({viewport:e,canvas:t,visible:r}){let[i,s,c,l]=e,u=n.ot(e,t),d=n.st({x:i,y:l},e,t,u),f=n.st({x:c,y:s},e,t,u),{x:p,y:m}=n.rt(e),h=[],g=[];if(r){for(let r=Math.ceil(i/p)*p;r<=c;r+=p){let i=n.st({x:r,y:0},e,t,u);h.push((0,o.jsx)(a.Line,{points:[i.x,d.y,i.x,f.y],stroke:`#e6e9f2`,strokeWidth:1,listening:!1},`grid-x-${r}`))}for(let r=Math.ceil(s/m)*m;r<=l;r+=m){let i=n.st({x:0,y:r},e,t,u);g.push((0,o.jsx)(a.Line,{points:[d.x,i.y,f.x,i.y],stroke:`#e6e9f2`,strokeWidth:1,listening:!1},`grid-y-${r}`))}}return(0,o.jsxs)(o.Fragment,{children:[h,g,(0,o.jsx)(a.Rect,{x:d.x+.5,y:d.y+.5,width:Math.max(0,f.x-d.x-1),height:Math.max(0,f.y-d.y-1),stroke:`#cfd5e3`,strokeWidth:1,listening:!1})]})}var U=`#5b6b82`,W=`rgba(211, 225, 242, 0.58)`,G=`#6558e8`;function K(e,t){return e===`ruler`?{x:t.width*.5,y:t.height*.72,rotation:0,flipped:!1}:e===`setSquare`?{x:t.width*.32,y:t.height*.46,rotation:0,flipped:!1}:{x:t.width*.68,y:t.height*.46,rotation:0,flipped:!1}}function fe(){let e=Array.from({length:21},(e,t)=>t);return(0,o.jsxs)(a.Group,{listening:!1,children:[(0,o.jsx)(a.Rect,{x:-150,y:-30,width:300,height:60,cornerRadius:5,fill:W,stroke:U,strokeWidth:2}),e.map(e=>{let t=-140+e*14,n=e%2==0;return(0,o.jsx)(a.Line,{points:[t,-29,t,-29+(n?17:10)],stroke:U,strokeWidth:n?1.5:1},e)}),e.filter(e=>e%2==0).map(e=>(0,o.jsx)(a.Text,{x:-145+e*14,y:-8,width:20,align:`center`,text:String(e/2),fontSize:10,fill:U},`label-${e}`))]})}function pe(){return(0,o.jsxs)(a.Group,{listening:!1,children:[(0,o.jsx)(a.Line,{points:[-105,70,105,70,-105,-75],closed:!0,fill:W,stroke:U,strokeWidth:2,lineJoin:`round`}),(0,o.jsx)(a.Line,{points:[-72,48,48,48,-72,-34],closed:!0,fill:`#fbfcff`,stroke:U,strokeWidth:1.5,lineJoin:`round`}),Array.from({length:11},(e,t)=>(0,o.jsx)(a.Line,{points:[-91+t*18,70,-91+t*18,t%5==0?54:60],stroke:U,strokeWidth:1},t))]})}function me(){let e=Array.from({length:37},(e,t)=>t*5);return(0,o.jsxs)(a.Group,{listening:!1,children:[(0,o.jsx)(a.Arc,{x:0,y:0,innerRadius:38,outerRadius:112,angle:180,rotation:180,fill:W,stroke:U,strokeWidth:2}),(0,o.jsx)(a.Line,{points:[-112,0,112,0],stroke:U,strokeWidth:2}),e.map(e=>{let t=Math.PI*e/180,n=e%10==0,r=n?94:100;return(0,o.jsx)(a.Line,{points:[Math.cos(Math.PI-t)*108,-Math.sin(t)*108,Math.cos(Math.PI-t)*r,-Math.sin(t)*r],stroke:U,strokeWidth:n?1.4:.8},e)}),(0,o.jsx)(a.Circle,{x:0,y:0,radius:3,fill:U})]})}function he({tool:e}){return e===`ruler`?(0,o.jsx)(fe,{}):e===`setSquare`?(0,o.jsx)(pe,{}):(0,o.jsx)(me,{})}function q(e,t,n){let r=n*Math.PI/180;return{x:e*Math.cos(r)-t*Math.sin(r),y:e*Math.sin(r)+t*Math.cos(r)}}function ge(e,t){let n=e===`ruler`?{x:0,y:19}:e===`setSquare`?{x:-42,y:24}:{x:0,y:-20};return{x:t?-n.x:n.x,y:n.y}}function J({tools:e,canvas:t}){let[n,r]=(0,i.useState)(()=>Object.fromEntries(e.map(e=>[e,K(e,t)]))),[s,c]=(0,i.useState)(null),l=s&&e.includes(s)?s:null;function u(e,n){r(r=>({...r,[e]:{...r[e]??K(e,t),...n}}))}return(0,o.jsx)(o.Fragment,{children:e.map(e=>{let r=n[e]??K(e,t),i=l===e,s=ge(e,r.flipped),d=q(s.x,s.y,r.rotation),f={x:r.x+d.x,y:r.y+d.y},p=q(0,-105,r.rotation),m=q(0,e===`setSquare`?96:e===`ruler`?50:48,r.rotation);return(0,o.jsxs)(a.Group,{children:[(0,o.jsx)(a.Group,{x:r.x,y:r.y,rotation:r.rotation,scaleX:r.flipped?-1:1,listening:!1,children:(0,o.jsx)(he,{tool:e})}),i&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(a.Line,{points:[r.x,r.y,r.x+p.x,r.y+p.y],stroke:G,strokeWidth:1.5,dash:[4,4],listening:!1}),(0,o.jsx)(a.Circle,{x:r.x+p.x,y:r.y+p.y,radius:11,fill:`#fff`,stroke:G,strokeWidth:2.5,draggable:!0,onDragMove:t=>{let n=t.target.x()-r.x,i=t.target.y()-r.y;u(e,{rotation:Math.atan2(i,n)*180/Math.PI+90})},onMouseDown:e=>{e.cancelBubble=!0},onTouchStart:e=>{e.cancelBubble=!0}}),(0,o.jsx)(a.Text,{x:r.x+p.x-8,y:r.y+p.y-8,width:16,height:16,text:`↻`,align:`center`,verticalAlign:`middle`,fontSize:14,fontStyle:`bold`,fill:G,listening:!1}),(0,o.jsx)(a.Rect,{x:r.x+m.x-29,y:r.y+m.y-11,width:58,height:22,cornerRadius:11,fill:`#fff`,stroke:G,strokeWidth:1.5,onClick:t=>{t.cancelBubble=!0,u(e,{flipped:!r.flipped})},onTap:t=>{t.cancelBubble=!0,u(e,{flipped:!r.flipped})}}),(0,o.jsx)(a.Text,{x:r.x+m.x-27,y:r.y+m.y-7,width:54,height:14,text:`⇄ Flip`,align:`center`,verticalAlign:`middle`,fontSize:10,fontStyle:`600`,fill:G,listening:!1})]}),(0,o.jsx)(a.Circle,{id:`geometry-instrument-${e}-move-handle`,x:f.x,y:f.y,radius:i?8:12,fill:i?`rgba(255, 255, 255, 0.94)`:`rgba(255, 255, 255, 0.01)`,stroke:G,strokeWidth:i?1.5:0,shadowColor:`#24304a`,shadowBlur:i?2:0,draggable:!0,dragBoundFunc:e=>({x:Math.max(22,Math.min(t.width-22,e.x)),y:Math.max(22,Math.min(t.height-22,e.y))}),onDragStart:()=>c(e),onDragMove:t=>u(e,{x:t.target.x()-d.x,y:t.target.y()-d.y}),onMouseEnter:e=>{let t=e.target.getStage();t&&(t.container().style.cursor=`grab`)},onMouseLeave:e=>{let t=e.target.getStage();t&&(t.container().style.cursor=`default`)},onClick:t=>{t.cancelBubble=!0,c(e)},onTap:t=>{t.cancelBubble=!0,c(e)}}),i?(0,o.jsx)(a.Text,{x:f.x-6,y:f.y-5,width:12,height:10,text:`✣`,align:`center`,verticalAlign:`middle`,fontSize:9,fontStyle:`bold`,fill:G,listening:!1}):(0,o.jsx)(a.Circle,{x:f.x,y:f.y,radius:2.5,fill:U,opacity:.65,listening:!1})]},e)})})}function Y(e){return(0,i.useSyncExternalStore)(t=>e.subscribe(t),()=>e.getState())}function _e({store:t,size:r,onExerciseChange:s,onGivenSelect:c,highlightedGivenIds:l=[],goalPreviews:d=[]}){let f=Y(t),{points:p,objects:m,capabilitiesOf:_,labelOf:v,measureOf:b,isSnapTarget:x}=u(f),{viewport:S}=f.exercise,C=(0,i.useRef)(null),w=h({points:p,viewport:S,canvas:r,pendingObjectType:f.pendingObjectType,pendingFirstPointId:f.pendingFirstPointId,pendingVertexPointId:f.pendingVertexPointId,connect:(e,r)=>{(f.pendingObjectType===`segment`||f.pendingObjectType===`line`)&&n.k(t,{tool:f.pendingObjectType,from:e,to:r})},pick:e=>{n.P(t,e),c?.(e)},objects:m,isSnapTarget:x,canCreatePoints:!0,preserveCreatedPointOrigins:!1}),{connecting:E,previewPoints:D,previewAngle:O,snapTargetId:k}=w,A=g({points:p,objects:m,viewport:S,canvas:r,showGrid:!!f.exercise.showGrid,isSnapTarget:x,active:f.pendingObjectType===`point`});(0,i.useEffect)(()=>{if(s)return t.subscribe(e=>s(e.exercise))},[t,s]);function j(e){if(f.pendingObjectType!==`point`){n.V(t,null);return}let r=A.resolvePlacement(e);if(r.snap?.kind===`point`){let e=r.snap.targetIds[0];e&&n.I(t,e);return}let i=n.et(r);i&&n.C(t,i,`at`in i)}function N(e){n.V(t,e),c?.(e)}return M(C,r,t,{tool:f.pendingObjectType,connection:w,placement:A,pointOnScreen:e=>{let t=p.get(e);return t?n.st(t,S,r):null},canDragPoint:e=>n.j(f,e),dragPoint:(e,i,a)=>{let o=y({exercise:f.exercise,points:p,objects:m,canvas:r},e,i,a);o&&n.N(t,e,o)},endPointDrag:()=>n.O(t),tapPoint:e=>{_(e).selectable&&N(e)},tapObject:N,tapStage:j,abandonConstruction:()=>n.E(t),disarmTool:()=>n.H(t,null)}),(0,o.jsx)(a.Stage,{ref:C,width:r.width,height:r.height,style:{...T,cursor:f.pendingObjectType===`point`||E?`crosshair`:`default`},children:(0,o.jsxs)(a.Layer,{children:[(0,o.jsx)(a.Rect,{width:r.width,height:r.height,fill:`#fbfcff`,listening:!1}),(0,o.jsx)(H,{viewport:S,canvas:r,visible:!!f.exercise.showGrid}),D&&(0,o.jsx)(a.Line,{points:D,stroke:`#786af5`,strokeWidth:3,dash:[9,6],lineCap:`round`,listening:!1}),O&&(0,o.jsx)(V,{id:`angle-preview`,descriptor:O,viewport:S,canvas:r,color:`#786af5`,dashed:!0,listening:!1}),m.map(({id:t,definition:n})=>{let i=_(t);if(!i.rendered)return null;let a=e.B(n,p);return a?(0,o.jsx)(V,{id:t,descriptor:e.H(a),viewport:S,canvas:r,label:v(t),measured:b(t)!==void 0,selected:t===f.selectedGivenId||l.includes(t),listening:i.selectable&&!f.pendingObjectType},t):null}),d.map(e=>{if(!e.shape)return null;if(e.shape.type===`segment`)return(0,o.jsx)(R,{id:`goal-preview-${e.id}`,from:e.shape.from,to:e.shape.to,viewport:S,canvas:r,color:`#f59e0b`,strokeWidth:4,dashed:!0,opacity:.72,listening:!1},`goal-preview-${e.id}`);if(e.shape.type===`angle`){let{vertex:t,arms:n}=e.shape;return n.map((n,i)=>(0,o.jsx)(R,{id:`goal-preview-${e.id}-${i}`,from:t,to:n,viewport:S,canvas:r,color:`#f59e0b`,strokeWidth:4,dashed:!0,opacity:.72,listening:!1},`goal-preview-${e.id}-${i}`))}return e.shape.type===`point`?(0,o.jsx)(I,{id:`goal-preview-${e.id}`,position:e.shape.at,viewport:S,canvas:r,color:`#f59e0b`},`goal-preview-${e.id}`):(0,o.jsx)(z,{id:`goal-preview-${e.id}`,through:e.shape.through,viewport:S,canvas:r,color:`#f59e0b`,strokeWidth:3,dashed:!0,opacity:.72,listening:!1},`goal-preview-${e.id}`)}),[...p].map(([e,t])=>{let n=_(e);return n.rendered?(0,o.jsx)(I,{id:e,position:t,viewport:S,canvas:r,label:v(e)??e,selected:e===f.pendingFirstPointId||e===f.pendingVertexPointId||e===f.selectedGivenId||l.includes(e),connectable:E&&n.snapTarget,snapTarget:e===k},e):null}),A.snap&&(0,o.jsx)(F,{snap:A.snap,viewport:S,canvas:r}),(0,o.jsx)(J,{tools:f.exercise.tools,canvas:r})]})})}var ve=/^student-(.+)-(\d+)$/;function X(e,t,n){if(t)return t;if(n===`given`)return e;let r=ve.exec(e);return!r?.[1]||!r[2]?e:r[1]===`point`?`P${r[2]}`:`${r[1]} ${r[2]}`}var ye=`#1683ff`,be=`#159a68`,xe=`#d64555`;function Se(e){return e===`correct`?be:e===`incorrect`?xe:void 0}function Ce({store:t,size:s,validationFeedback:c=null,focusedGoalId:l=null}){let u=Y(t),{exercise:f,geometry:p}=u,{points:m,objects:_,capabilitiesOf:v,labelOf:b,measureOf:x,isSnapTarget:S}=d(f,p),C=r.c(c,p,l),w=(0,i.useRef)(null),E=h({points:m,viewport:f.viewport,canvas:s,pendingObjectType:u.pendingObjectType,pendingFirstPointId:u.pendingFirstPointId,pendingVertexPointId:u.pendingVertexPointId,connect:(e,r)=>{(u.pendingObjectType===`segment`||u.pendingObjectType===`line`)&&n.o(t,{tool:u.pendingObjectType,from:e,to:r})},pick:e=>n.d(t,e),objects:_,isSnapTarget:S,canCreatePoints:!0}),{connecting:D,previewPoints:O,previewAngle:k,snapTargetId:A,snapPreview:j}=E,N=g({points:m,objects:_,viewport:f.viewport,canvas:s,showGrid:!!f.showGrid,isSnapTarget:S,active:u.pendingObjectType===`point`});function P(e){if(u.selectedObjectId&&n.v(t,null),u.pendingObjectType!==`point`)return;let r=N.resolvePlacement(e);if(r.snap?.kind===`point`){let e=r.snap.targetIds[0];e&&n.f(t,e);return}let i=n.et(r);i&&n.t(t,i,!0)}return M(w,s,t,{tool:u.pendingObjectType,connection:E,placement:N,pointOnScreen:e=>{let t=m.get(e);return t?n.st(t,f.viewport,s):null},canDragPoint:e=>n.l(u,e),dragPoint:(e,r,i)=>{let a=y({exercise:f,attempt:p.entities,points:m,objects:_,canvas:s},e,r,i);a&&n.u(t,e,a)},endPointDrag:()=>n.a(t),tapPoint:e=>{let r=v(e).selectable&&n.c(u,e);n.v(t,r?e:null)},tapObject:e=>n.v(t,e),tapStage:P,abandonConstruction:()=>n.n(t),disarmTool:()=>n.y(t,null)}),(0,o.jsx)(a.Stage,{ref:w,width:s.width,height:s.height,style:T,children:(0,o.jsxs)(a.Layer,{children:[(0,o.jsx)(a.Rect,{width:s.width,height:s.height,fill:`#fbfcff`,listening:!1}),(0,o.jsx)(H,{viewport:f.viewport,canvas:s,visible:!!f.showGrid}),O&&(0,o.jsx)(a.Line,{points:O,stroke:`#786af5`,strokeWidth:3,dash:[9,6],lineCap:`round`,listening:!1}),k&&(0,o.jsx)(V,{id:`angle-preview`,descriptor:k,viewport:f.viewport,canvas:s,color:`#786af5`,dashed:!0,listening:!1}),_.map(({id:t,definition:n})=>{let r=Object.prototype.hasOwnProperty.call(p.entities,t),i=v(t);if(!i.rendered)return null;let a=e.M(C.constructions,t),c=Se(a),l=e.B(n,m);if(!l)return null;let d=i.selectable&&r;return(0,o.jsx)(V,{id:t,descriptor:e.H(l),viewport:f.viewport,canvas:s,label:b(t),measured:x(t)!==void 0,color:r?c??ye:void 0,dashed:a===`incorrect`,selected:d&&t===u.selectedObjectId,listening:d&&!u.pendingObjectType},t)}),[...m].map(([t,n])=>{let r=v(t);if(!r.rendered)return null;let i=Object.prototype.hasOwnProperty.call(f.entities,t),a=!i,c=e.M(C.points,t),l=Se(c);return(0,o.jsx)(I,{id:t,position:n,viewport:f.viewport,canvas:s,label:X(t,b(t),i?`given`:`student`),color:a?l??ye:void 0,feedbackRingColor:l,feedbackRingDashed:c===`incorrect`,selected:t===u.pendingFirstPointId||t===u.pendingVertexPointId||t===u.selectedObjectId,connectable:D&&r.snapTarget,snapTarget:t===A},t)}),(N.snap??j)&&(0,o.jsx)(F,{snap:N.snap??j,viewport:f.viewport,canvas:s}),(0,o.jsx)(J,{tools:f.tools,canvas:s})]})})}function we(n,i=null,a=null){let{exercise:o,geometry:s}=n,c=t.f(o,s),l=r.c(i,s,a),u=Oe(c),d=Ee(c,c.entityIds,{nameOf:u,selectedId:n.selectedObjectId,isSelectable:(e,t)=>t&&!c.isGiven(e),statusOf:(t,n)=>e.M(n===`point`?l.points:l.constructions,t)??null});return{toolLine:Ae(n.pendingObjectType),pendingLine:je(n,u),answerLine:Me(i),entities:d,selectedId:n.selectedObjectId}}function Te(e){let n=t.c(e.exercise),r=Oe(n),i=Ee(n,Object.keys(e.exercise.entities),{nameOf:r,selectedId:e.selectedGivenId,isSelectable:(e,t)=>t,statusOf:()=>null});return{toolLine:Ae(e.pendingObjectType),pendingLine:je(e,r),answerLine:null,entities:i,selectedId:e.selectedGivenId}}function Ee(t,n,r){let i=[];for(let a of n){let n=t.presentationOf(a);if(!c(n.role).rendered)continue;let o=t.definitionOf(a),s=t.kindOf(a);if(!o||!s)continue;let u=t.isGiven(a)?`given`:`student`,d=X(a,n.label,u),f=e.N(o,r.nameOf),p=t.resolvedOf(a)!==void 0,m=r.statusOf(a,s);i.push({id:a,kind:s,owner:u,name:d,description:f,placed:p,selected:a===r.selectedId,selectable:r.isSelectable(a,c(n.role).selectable),status:m,text:De(d,f,l(t,a),p,m)})}return i}function De(e,t,n,r,i){return`${e}: ${t}${`${n?`, measures ${n}`:``}${r?``:`, not on screen`}${i?`, ${i}`:``}`}`}function Oe(e){return t=>X(t,ke(e,t),e.isGiven(t)?`given`:`student`)}function ke(e,t){let n=e.presentationOf(t);return n.role===`explicit`?n.label:void 0}function Ae(e){return`Tool: ${e??`none`}`}function je({pendingObjectType:e,pendingFirstPointId:t,pendingVertexPointId:n},r){if(!e||!t)return`Building: nothing`;let i=n?` at ${r(n)}`:``;return`Building: ${e} from ${r(t)}${i}`}function Me(e){return e?`Answer: ${e.result.goals.filter(e=>e.status===`correct`).length} of ${e.result.goals.length} goals correct`:`Answer: not checked`}function Ne(e,t){if(!e)return null;let n=new Map(e.entities.map(e=>[e.id,e])),r=new Map(t.entities.map(e=>[e.id,e])),i=t.entities.filter(e=>!n.has(e.id)),a=e.entities.filter(e=>!r.has(e.id)),o=[];return i.length===1&&i[0]?o.push(`Added ${i[0].text}`):i.length>1&&o.push(`Added ${i.length} objects`),a.length===1&&a[0]?o.push(`Removed ${a[0].text}`):a.length>1&&o.push(`Removed ${a.length} objects`),t.answerLine&&t.answerLine!==e.answerLine&&o.push(t.answerLine),o.length===0&&t.toolLine!==e.toolLine&&o.push(t.toolLine),o.length?`${o.join(`. `)}.`:null}function Z({scene:e,onSelect:t,label:n=`Figure contents`,className:r}){let i=Fe(e);return(0,o.jsxs)(`section`,{"aria-label":n,className:r,children:[(0,o.jsx)(`p`,{children:e.toolLine}),(0,o.jsx)(`p`,{children:e.pendingLine}),(0,o.jsxs)(`ul`,{"aria-label":`Figure objects`,children:[e.entities.length===0&&(0,o.jsx)(`li`,{children:`Nothing has been drawn yet.`}),e.entities.map(e=>e.selectable?(0,o.jsx)(`li`,{children:(0,o.jsx)(`button`,{type:`button`,"aria-pressed":e.selected,onClick:()=>t(e.selected?null:e.id),children:e.text})},e.id):(0,o.jsx)(`li`,{children:e.text},e.id))]}),e.answerLine!==null&&(0,o.jsx)(`p`,{children:e.answerLine}),(0,o.jsx)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:(0,o.jsx)(`span`,{children:i.message},i.tick)})]})}function Q({store:e,validationFeedback:t=null,focusedGoalId:r=null,label:i,className:a}){let s=we(Y(e),t,r);return(0,o.jsx)(Z,{scene:s,onSelect:t=>n.v(e,t),label:i,className:a})}function Pe({store:e,label:t,className:r}){let i=Te(Y(e));return(0,o.jsx)(Z,{scene:i,onSelect:t=>n.V(e,t),label:t,className:r})}function Fe(e){let t=(0,i.useRef)(null),[n,r]=(0,i.useState)({message:``,tick:0});return(0,i.useEffect)(()=>{let n=Ne(t.current,e);t.current=e,n!==null&&r(e=>({message:n,tick:e.tick+1}))},[e]),n}function Ie(e,t){let n=r.t(e);if(!n.success)return{success:!1,issues:n.errors.map(e=>({source:`exercise`,...e}))};let i=t==null?{success:!0,data:r.i()}:r.u(t,n.data);return i.success?{success:!0,exercise:n.data,attempt:i.data,exerciseFingerprint:r.s(n.data),attemptFingerprint:r.o(i.data)}:{success:!1,issues:i.errors.map(e=>({source:`value`,...e}))}}function Le(e,t){let n=r.u(t,e);return n.success?r.o(n.data):null}function Re(e){return{store:n.r(e.exercise,e.attempt),exercise:e.exerciseFingerprint,value:e.attemptFingerprint}}function ze(e,t){if(t.exerciseFingerprint!==e.exercise){e.exercise=t.exerciseFingerprint,e.value=t.attemptFingerprint,n.h(e.store,t.exercise,t.attempt);return}if(t.attemptFingerprint===e.value)return;e.value=t.attemptFingerprint;let{exercise:r,geometry:i}=e.store.getState();Le(r,i)!==t.attemptFingerprint&&n.m(e.store,t.attempt)}function Be(e,t){return e.subscribe((e,n)=>{let r=e.lastAttemptChange;r&&r!==n.lastAttemptChange&&t().onChange(JSON.parse(JSON.stringify(e.geometry)),{action:r.action,entityIds:[...r.entityIds]});let i=e.constructionNotice;i&&i!==n.constructionNotice&&t().onNotice?.(i)})}function Ve(e,t,n){return!e?.success||e.fingerprints.exercise!==r.s(t)?null:e.fingerprints.attempt===Le(t,n)?e.data:null}var He=[`point`,`segment`,`line`,`angle`],Ue={minWidth:44,minHeight:44};function We({selected:e,onSelect:t,available:n=He}){let r=n.filter(e=>He.includes(e));return(0,o.jsx)(`div`,{role:`toolbar`,"aria-label":`Geometry tools`,children:r.map(n=>(0,o.jsx)(`button`,{type:`button`,"aria-pressed":e===n,style:Ue,onClick:()=>t(e===n?null:n),children:n},n))})}var $={minWidth:44,minHeight:44},Ge={border:0,margin:0,padding:0,minWidth:0};function Ke(e){let{exercise:t,value:r,readOnly:a=!1,validationFeedback:s=null,focusedGoalId:c=null,controls:l,className:u}=e,d=Ie(t,r),[f,p]=(0,i.useState)(null),m=(0,i.useRef)(e),h=(0,i.useRef)(null);return!f&&d.success&&p(Re(d)),(0,i.useLayoutEffect)(()=>{m.current=e}),(0,i.useLayoutEffect)(()=>{f&&d.success&&ze(f,d)},[d,f]),(0,i.useLayoutEffect)(()=>f?Be(f.store,()=>m.current):void 0,[f]),(0,i.useLayoutEffect)(()=>{f&&n.b(f.store,a)},[f,a]),(0,i.useLayoutEffect)(()=>{let e=d.success?null:JSON.stringify(d.issues);!d.success&&e!==h.current&&m.current.onError?.(d.issues),h.current=e},[d]),d.success?f?(0,o.jsx)(qe,{store:f.store,validationFeedback:s,focusedGoalId:c,controls:l,className:u}):null:(0,o.jsx)(`div`,{className:u,role:`alert`,children:`This exercise cannot be displayed.`})}function qe({store:t,validationFeedback:r,focusedGoalId:a,controls:s,className:c}){let l=Y(t),{exercise:u,geometry:d,selectedObjectId:f,constructionNotice:p}=l,m=(0,i.useMemo)(()=>Ve(r,u,d),[r,u,d]),h=m?a:null,g=(0,i.useRef)(null),[_,v]=(0,i.useState)({width:0,height:0}),[y,b,x,S]=u.viewport;(0,i.useLayoutEffect)(()=>{let e=g.current;if(!e)return;let t=({width:e,height:t})=>{let n={width:Math.floor(e),height:Math.floor(t)};v(e=>e.width===n.width&&e.height===n.height?e:n)};t(e.getBoundingClientRect());let n=new ResizeObserver(([e])=>e&&t(e.contentRect));return n.observe(e),()=>n.disconnect()},[]);let C=e=>s?.[e]!==!1,w=p&&`This construction already exists: ${X(p.entityId,e.M(d.presentation,p.entityId)?.label,`student`)}`;return(0,o.jsxs)(`div`,{className:c,children:[(0,o.jsxs)(`fieldset`,{disabled:l.readOnly,style:Ge,children:[C(`toolbar`)&&(0,o.jsx)(We,{selected:l.pendingObjectType,available:u.allowedObjects,onSelect:e=>n.y(t,e)}),C(`history`)&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`button`,{type:`button`,style:$,disabled:!l.past.length,onClick:()=>n.x(t),children:`Undo`}),(0,o.jsx)(`button`,{type:`button`,style:$,disabled:!l.future.length,onClick:()=>n.p(t),children:`Redo`})]}),C(`delete`)&&(0,o.jsx)(`button`,{type:`button`,style:$,disabled:!f,onClick:()=>f&&n.i(t,f),children:`Delete`}),C(`reset`)&&(0,o.jsx)(`button`,{type:`button`,style:$,onClick:()=>n.g(t),children:`Reset`})]}),(0,o.jsx)(`div`,{ref:g,style:{position:`relative`,width:`100%`,aspectRatio:`${x-y} / ${S-b}`},children:_.width>0&&_.height>0&&(0,o.jsx)(`div`,{style:{position:`absolute`,inset:0},children:(0,o.jsx)(Ce,{store:t,size:_,validationFeedback:m,focusedGoalId:h})})}),(0,o.jsx)(`p`,{role:`status`,children:w}),(0,o.jsx)(Q,{store:t,validationFeedback:m,focusedGoalId:h})]})}Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return We}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return I}});
|
|
2
|
+
//# sourceMappingURL=react-B26_e52I.cjs.map
|