@digabi/exam-engine-core 23.4.7 → 23.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/playwright/Annotations.test.js +110 -28
- package/dist/__tests__/playwright/Annotations.test.js.map +1 -1
- package/dist/__tests__/playwright/attachments/Attachments.test.js +1 -1
- package/dist/__tests__/playwright/attachments/Attachments.test.js.map +1 -1
- package/dist/__tests__/playwright/exam/Exam.test.js +1 -1
- package/dist/__tests__/playwright/exam/Exam.test.js.map +1 -1
- package/dist/__tests__/playwright/grading-instructions/GradingInstructions.test.js +1 -1
- package/dist/__tests__/playwright/grading-instructions/GradingInstructions.test.js.map +1 -1
- package/dist/__tests__/playwright/stories/Annotations.story.d.ts +2 -2
- package/dist/__tests__/playwright/stories/Annotations.story.d.ts.map +1 -1
- package/dist/__tests__/playwright/stories/attachments/Attachments.story.d.ts +2 -2
- package/dist/__tests__/playwright/stories/attachments/Attachments.story.d.ts.map +1 -1
- package/dist/__tests__/playwright/stories/exam/Exam.story.d.ts +2 -2
- package/dist/__tests__/playwright/stories/exam/Exam.story.d.ts.map +1 -1
- package/dist/__tests__/playwright/stories/grading-intructions/GradingInstructions.story.d.ts +2 -2
- package/dist/__tests__/playwright/stories/grading-intructions/GradingInstructions.story.d.ts.map +1 -1
- package/dist/__tests__/playwright/utils/utils.d.ts +2 -1
- package/dist/__tests__/playwright/utils/utils.d.ts.map +1 -1
- package/dist/__tests__/playwright/utils/utils.js +19 -3
- package/dist/__tests__/playwright/utils/utils.js.map +1 -1
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/components/context/AnnotationProvider.d.ts +11 -9
- package/dist/components/context/AnnotationProvider.d.ts.map +1 -1
- package/dist/components/context/AnnotationProvider.js +29 -13
- package/dist/components/context/AnnotationProvider.js.map +1 -1
- package/dist/components/exam/Exam.d.ts +2 -2
- package/dist/components/exam/Exam.d.ts.map +1 -1
- package/dist/components/exam/Exam.js.map +1 -1
- package/dist/components/grading/examAnnotationUtils.d.ts +2 -1
- package/dist/components/grading/examAnnotationUtils.d.ts.map +1 -1
- package/dist/components/grading/examAnnotationUtils.js +55 -49
- package/dist/components/grading/examAnnotationUtils.js.map +1 -1
- package/dist/components/shared/AnnotatableText.d.ts.map +1 -1
- package/dist/components/shared/AnnotatableText.js +6 -6
- package/dist/components/shared/AnnotatableText.js.map +1 -1
- package/dist/components/shared/AnnotationImageMark.d.ts +3 -2
- package/dist/components/shared/AnnotationImageMark.d.ts.map +1 -1
- package/dist/components/shared/AnnotationImageMark.js +4 -3
- package/dist/components/shared/AnnotationImageMark.js.map +1 -1
- package/dist/components/shared/AnnotationPopup.d.ts.map +1 -1
- package/dist/components/shared/AnnotationPopup.js +5 -2
- package/dist/components/shared/AnnotationPopup.js.map +1 -1
- package/dist/components/shared/Formula.d.ts +2 -2
- package/dist/components/shared/Formula.d.ts.map +1 -1
- package/dist/components/shared/Formula.js +81 -9
- package/dist/components/shared/Formula.js.map +1 -1
- package/dist/components/shared/markText.d.ts +4 -3
- package/dist/components/shared/markText.d.ts.map +1 -1
- package/dist/components/shared/markText.js +4 -3
- package/dist/components/shared/markText.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/main-bundle.js +1 -1
- package/dist/main.css +1 -1
- package/dist/types/ExamAnnotations.d.ts +0 -1
- package/dist/types/ExamAnnotations.d.ts.map +1 -1
- package/dist/types/Score.d.ts +0 -26
- package/dist/types/Score.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/__tests__/annotations.test.d.ts +0 -2
- package/dist/__tests__/annotations.test.d.ts.map +0 -1
- package/dist/__tests__/annotations.test.js +0 -306
- package/dist/__tests__/annotations.test.js.map +0 -1
- package/dist/assets/closeButton.svg +0 -1
- package/dist/assets/collapse.svg +0 -12
- package/dist/assets/expand.svg +0 -12
- package/dist/assets/helpButton.svg +0 -9
- package/dist/assets/redoButton.svg +0 -5
- package/dist/assets/undoButton.svg +0 -5
- package/dist/components/results/DNDAnswerContainer.d.ts +0 -4
- package/dist/components/results/DNDAnswerContainer.d.ts.map +0 -1
- package/dist/components/results/DNDAnswerContainer.js +0 -22
- package/dist/components/results/DNDAnswerContainer.js.map +0 -1
- package/dist/eslint.config.d.ts +0 -22
- package/dist/eslint.config.d.ts.map +0 -1
- package/dist/eslint.config.js +0 -31
- package/dist/eslint.config.js.map +0 -1
- package/dist/i18n/exam_titles_fi-FI.d.ts +0 -46
- package/dist/i18n/exam_titles_fi-FI.d.ts.map +0 -1
- package/dist/i18n/exam_titles_fi-FI.js +0 -46
- package/dist/i18n/exam_titles_fi-FI.js.map +0 -1
- package/dist/i18n/exam_titles_fi-FI.json +0 -45
- package/dist/i18n/exam_titles_sv-FI.d.ts +0 -46
- package/dist/i18n/exam_titles_sv-FI.d.ts.map +0 -1
- package/dist/i18n/exam_titles_sv-FI.js +0 -46
- package/dist/i18n/exam_titles_sv-FI.js.map +0 -1
- package/dist/i18n/exam_titles_sv-FI.json +0 -45
- package/dist/i18n/exams.d.ts +0 -11
- package/dist/i18n/exams.d.ts.map +0 -1
- package/dist/i18n/exams.js +0 -10
- package/dist/i18n/exams.js.map +0 -1
@@ -1,13 +1,85 @@
|
|
1
1
|
import classNames from 'classnames';
|
2
|
-
import React from 'react';
|
3
|
-
import { getAttribute } from '../../dom-utils';
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
import React, { useContext } from 'react';
|
3
|
+
import { getAttribute, getElementPath } from '../../dom-utils';
|
4
|
+
import { AnnotationContext } from '../context/AnnotationProvider';
|
5
|
+
import { IsInSidebarContext } from '../context/IsInSidebarContext';
|
6
|
+
import { isExistingAnnotation } from './markText';
|
7
|
+
import AnnotationMark from './AnnotationTextMark';
|
8
|
+
import HiddenAnnotationMark from './HiddenAnnotationMark';
|
9
|
+
import { AnnotationImageMark, useImageAnnotation } from './AnnotationImageMark';
|
10
|
+
// eslint-disable-next-line prefer-arrow-callback
|
11
|
+
export default React.memo(function Formula({ element, className }) {
|
12
|
+
const annotationContext = useContext(AnnotationContext);
|
13
|
+
const { isInSidebar } = useContext(IsInSidebarContext);
|
14
|
+
if (!annotationContext.annotationsEnabled || isInSidebar !== undefined) {
|
15
|
+
return React.createElement(PlainFormula, { element: element, className: className });
|
16
|
+
}
|
17
|
+
return React.createElement(AnnotatableFormula, { element: element, className: className, annotationContext: annotationContext });
|
18
|
+
});
|
19
|
+
// eslint-disable-next-line prefer-arrow-callback
|
20
|
+
const PlainFormula = React.memo(function PlainFormula(props) {
|
21
|
+
const { svg, assistiveTitle, className } = useElementAttributes(props);
|
8
22
|
return (React.createElement(React.Fragment, null,
|
9
|
-
React.createElement("span", { className:
|
10
|
-
React.createElement(
|
23
|
+
React.createElement("span", { className: className, dangerouslySetInnerHTML: { __html: svg }, "aria-hidden": "true" }),
|
24
|
+
React.createElement(AssistiveTitle, { assistiveTitle: assistiveTitle })));
|
25
|
+
});
|
26
|
+
// eslint-disable-next-line prefer-arrow-callback
|
27
|
+
const AssistiveTitle = React.memo(function AssistiveTitle({ assistiveTitle }) {
|
28
|
+
return React.createElement("span", { className: "e-screen-reader-only" }, assistiveTitle);
|
29
|
+
});
|
30
|
+
// eslint-disable-next-line prefer-arrow-callback
|
31
|
+
const AnnotatableFormula = React.memo(function AnnotatableFormula(props) {
|
32
|
+
var _a, _b, _c, _d;
|
33
|
+
const { textAnnotations, imageAnnotations, onClickAnnotation, setNewAnnotationRef, newAnnotation, setNewAnnotation } = props.annotationContext;
|
34
|
+
const { svg, assistiveTitle, textContent, className } = useElementAttributes(props);
|
35
|
+
const path = getElementPath(props.element);
|
36
|
+
const { elementRef, annotationRect, onMouseDown } = useImageAnnotation(path, `kaava ${textContent}`, setNewAnnotation);
|
37
|
+
const textElementAnnotations = [
|
38
|
+
...((_a = textAnnotations[path]) !== null && _a !== void 0 ? _a : []),
|
39
|
+
...((newAnnotation === null || newAnnotation === void 0 ? void 0 : newAnnotation.annotationType) === 'text'
|
40
|
+
? ((_c = (_b = newAnnotation === null || newAnnotation === void 0 ? void 0 : newAnnotation.annotationParts) === null || _b === void 0 ? void 0 : _b.filter(p => p.annotationAnchor === path)) !== null && _c !== void 0 ? _c : [])
|
41
|
+
: [])
|
42
|
+
];
|
43
|
+
const textMarks = textElementAnnotations.map(annotation => {
|
44
|
+
const annotationId = isExistingAnnotation(annotation) ? annotation.annotationId : null;
|
45
|
+
const key = `${annotationId !== null && annotationId !== void 0 ? annotationId : 0}_${annotation.startIndex}`;
|
46
|
+
if (annotation.hidden) {
|
47
|
+
return React.createElement(HiddenAnnotationMark, { key: key, annotationId: annotationId });
|
48
|
+
}
|
49
|
+
return (React.createElement(AnnotationMark, { key: key, annotation: annotation, onClickAnnotation: onClickAnnotation, setNewAnnotationRef: setNewAnnotationRef, __html: svg }));
|
50
|
+
});
|
51
|
+
const imageMarks = ((_d = imageAnnotations[path]) !== null && _d !== void 0 ? _d : [])
|
52
|
+
.map(({ annotationId, markNumber, resolved, hidden, rect }) => {
|
53
|
+
const key = `${annotationId}_${markNumber}`;
|
54
|
+
if (hidden) {
|
55
|
+
return React.createElement(HiddenAnnotationMark, { key: key, annotationId: annotationId });
|
56
|
+
}
|
57
|
+
return (React.createElement(AnnotationImageMark, { key: key, rect: rect, onClickAnnotation: onClickAnnotation, setNewAnnotationRef: setNewAnnotationRef, annotationId: annotationId, markNumber: markNumber, resolved: resolved }));
|
58
|
+
})
|
59
|
+
.concat((newAnnotation === null || newAnnotation === void 0 ? void 0 : newAnnotation.annotationType) === 'image' && newAnnotation.annotationAnchor === path
|
60
|
+
? [
|
61
|
+
React.createElement(AnnotationImageMark, { key: "new-annotation-mark", rect: newAnnotation.rect, onClickAnnotation: onClickAnnotation, setNewAnnotationRef: setNewAnnotationRef })
|
62
|
+
]
|
63
|
+
: [])
|
64
|
+
.concat(annotationRect
|
65
|
+
? [
|
66
|
+
React.createElement(AnnotationImageMark, { key: "annotation-rect", rect: annotationRect, onClickAnnotation: onClickAnnotation, setNewAnnotationRef: setNewAnnotationRef })
|
67
|
+
]
|
68
|
+
: []);
|
69
|
+
return (React.createElement(React.Fragment, null,
|
70
|
+
React.createElement("span", { ref: elementRef, className: className, "aria-hidden": "true", "data-annotation-path": path, "data-annotation-content": textContent, "data-testid": path, onMouseDown: onMouseDown },
|
71
|
+
textMarks.length > 0 ? null : React.createElement("span", { dangerouslySetInnerHTML: { __html: svg } }),
|
72
|
+
textMarks,
|
73
|
+
imageMarks),
|
74
|
+
React.createElement(AssistiveTitle, { assistiveTitle: assistiveTitle })));
|
75
|
+
});
|
76
|
+
function useElementAttributes(props) {
|
77
|
+
var _a, _b;
|
78
|
+
const svg = getAttribute(props.element, 'svg');
|
79
|
+
const textContent = (_a = props.element.textContent) === null || _a === void 0 ? void 0 : _a.trim();
|
80
|
+
const assistiveTitle = (_b = (getAttribute(props.element, 'assistive-title') || textContent)) !== null && _b !== void 0 ? _b : '';
|
81
|
+
const isDisplayFormula = getAttribute(props.element, 'mode') === 'display';
|
82
|
+
const className = classNames('e-formula e-annotatable', { 'e-block e-text-center': isDisplayFormula }, props.className);
|
83
|
+
return { svg, assistiveTitle, textContent, className };
|
11
84
|
}
|
12
|
-
export default React.memo(Formula);
|
13
85
|
//# sourceMappingURL=Formula.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Formula.js","sourceRoot":"","sources":["../../../src/components/shared/Formula.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;
|
1
|
+
{"version":3,"file":"Formula.js","sourceRoot":"","sources":["../../../src/components/shared/Formula.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAyB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SAAS,GAAG,UAAU,CAC1B,yBAAyB,EACzB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,EAC7C,KAAK,CAAC,SAAS,CAChB,CAAA;IAED,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,CAAA;AACxD,CAAC"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
3
|
-
export declare function
|
4
|
-
export declare function
|
2
|
+
import { AnnotationPart, WithAnnotationId } from '../../types/ExamAnnotations';
|
3
|
+
export declare function getKey(annotation: AnnotationPart): number;
|
4
|
+
export declare function isExistingAnnotation(annotation: AnnotationPart): annotation is WithAnnotationId<AnnotationPart>;
|
5
|
+
export declare function markText(text: string, annotations: AnnotationPart[], onClickAnnotation: (e: React.MouseEvent<HTMLElement, MouseEvent>, annotationId: number) => void, setNewAnnotationRef: (ref: HTMLElement | null) => void): React.ReactNode[];
|
5
6
|
//# sourceMappingURL=markText.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"markText.d.ts","sourceRoot":"","sources":["../../../src/components/shared/markText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"markText.d.ts","sourceRoot":"","sources":["../../../src/components/shared/markText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAI9E,wBAAgB,MAAM,CAAC,UAAU,EAAE,cAAc,UAEhD;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,cAAc,GAAG,UAAU,IAAI,gBAAgB,CAAC,cAAc,CAAC,CAE/G;AAMD,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,cAAc,EAAE,EAC7B,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,EAC/F,mBAAmB,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,qBAqGvD"}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import * as _ from 'lodash-es';
|
2
2
|
import React from 'react';
|
3
|
-
import
|
4
|
-
|
3
|
+
import AnnotationMark from './AnnotationTextMark';
|
4
|
+
import HiddenAnnotationMark from './HiddenAnnotationMark';
|
5
|
+
export function getKey(annotation) {
|
5
6
|
return isExistingAnnotation(annotation) ? annotation.annotationId + annotation.startIndex : annotation.startIndex;
|
6
7
|
}
|
7
8
|
export function isExistingAnnotation(annotation) {
|
@@ -62,7 +63,7 @@ export function markText(text, annotations, onClickAnnotation, setNewAnnotationR
|
|
62
63
|
}
|
63
64
|
// Add marked text
|
64
65
|
const key = getKey(annotation);
|
65
|
-
nodes.push(annotation.hidden ? (React.createElement(
|
66
|
+
nodes.push(annotation.hidden ? (React.createElement(HiddenAnnotationMark, { annotationId: isExistingAnnotation(annotation) ? annotation.annotationId : null })) : (React.createElement(AnnotationMark, { key: key, annotation: annotation, onClickAnnotation: onClickAnnotation, setNewAnnotationRef: setNewAnnotationRef }, annotatedTextWithCorrectedStartIndex)));
|
66
67
|
lastIndex = correctStartIndex + annotation.length;
|
67
68
|
}
|
68
69
|
// Add remaining unmarked text
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"markText.js","sourceRoot":"","sources":["../../../src/components/shared/markText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,
|
1
|
+
{"version":3,"file":"markText.js","sourceRoot":"","sources":["../../../src/components/shared/markText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB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ANGED
@@ -7,6 +7,7 @@ import parseExam from './parser/parseExam';
|
|
7
7
|
export { Attachments, Exam, GradingInstructions, Results, parseExam };
|
8
8
|
export { ExamComponentProps } from './createRenderChildNodes';
|
9
9
|
export { GradingAnswer } from './components/grading/GradingAnswer';
|
10
|
+
export * from './types/ExamAnnotations';
|
10
11
|
export * from './types/ExamAnswer';
|
11
12
|
export * from './types/ExamServerAPI';
|
12
13
|
export * from './types/GradingStructure';
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAA;AAC7B,OAAO,WAAW,MAAM,sCAAsC,CAAA;AAC9D,OAAO,IAAI,MAAM,wBAAwB,CAAA;AACzC,OAAO,mBAAmB,MAAM,uDAAuD,CAAA;AACvF,OAAO,OAAO,MAAM,8BAA8B,CAAA;AAClD,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAE1C,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,SAAS,EAAE,CAAA;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAClE,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,eAAe,CAAA;AAE7B,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,OAAO,WAAW,CAAA;IAC/B,IAAI,EAAE,OAAO,IAAI,CAAA;IACjB,SAAS,EAAE,OAAO,SAAS,CAAA;IAC3B,OAAO,EAAE,OAAO,OAAO,CAAA;CACxB"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAA;AAC7B,OAAO,WAAW,MAAM,sCAAsC,CAAA;AAC9D,OAAO,IAAI,MAAM,wBAAwB,CAAA;AACzC,OAAO,mBAAmB,MAAM,uDAAuD,CAAA;AACvF,OAAO,OAAO,MAAM,8BAA8B,CAAA;AAClD,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAE1C,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,SAAS,EAAE,CAAA;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAClE,cAAc,yBAAyB,CAAA;AACvC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,eAAe,CAAA;AAE7B,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,OAAO,WAAW,CAAA;IAC/B,IAAI,EAAE,OAAO,IAAI,CAAA;IACjB,SAAS,EAAE,OAAO,SAAS,CAAA;IAC3B,OAAO,EAAE,OAAO,OAAO,CAAA;CACxB"}
|
package/dist/index.js
CHANGED
@@ -6,6 +6,7 @@ import Results from './components/results/Results';
|
|
6
6
|
import parseExam from './parser/parseExam';
|
7
7
|
export { Attachments, Exam, GradingInstructions, Results, parseExam };
|
8
8
|
export { GradingAnswer } from './components/grading/GradingAnswer';
|
9
|
+
export * from './types/ExamAnnotations';
|
9
10
|
export * from './types/ExamAnswer';
|
10
11
|
export * from './types/ExamServerAPI';
|
11
12
|
export * from './types/GradingStructure';
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAA;AAC7B,OAAO,WAAW,MAAM,sCAAsC,CAAA;AAC9D,OAAO,IAAI,MAAM,wBAAwB,CAAA;AACzC,OAAO,mBAAmB,MAAM,uDAAuD,CAAA;AACvF,OAAO,OAAO,MAAM,8BAA8B,CAAA;AAClD,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAE1C,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,SAAS,EAAE,CAAA;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAClE,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,eAAe,CAAA"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAA;AAC7B,OAAO,WAAW,MAAM,sCAAsC,CAAA;AAC9D,OAAO,IAAI,MAAM,wBAAwB,CAAA;AACzC,OAAO,mBAAmB,MAAM,uDAAuD,CAAA;AACvF,OAAO,OAAO,MAAM,8BAA8B,CAAA;AAClD,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAE1C,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,SAAS,EAAE,CAAA;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAClE,cAAc,yBAAyB,CAAA;AACvC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,eAAe,CAAA"}
|