@tobyt/expo-pdf-markup 1.1.1 → 1.1.3

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.
Files changed (69) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +9 -6
  3. package/build/ExpoPdfMarkup.types.d.ts.map +1 -1
  4. package/build/ExpoPdfMarkup.types.js.map +1 -1
  5. package/build/ExpoPdfMarkupView.d.ts +1 -1
  6. package/build/ExpoPdfMarkupView.d.ts.map +1 -1
  7. package/build/ExpoPdfMarkupView.js +2 -1
  8. package/build/ExpoPdfMarkupView.js.map +1 -1
  9. package/build/ExpoPdfMarkupView.web.d.ts +2 -0
  10. package/build/ExpoPdfMarkupView.web.d.ts.map +1 -1
  11. package/build/ExpoPdfMarkupView.web.js +39 -36
  12. package/build/ExpoPdfMarkupView.web.js.map +1 -1
  13. package/build/index.d.ts +1 -1
  14. package/build/index.d.ts.map +1 -1
  15. package/build/index.js +1 -1
  16. package/build/index.js.map +1 -1
  17. package/build/pdfjs.d.ts +1 -0
  18. package/build/pdfjs.d.ts.map +1 -1
  19. package/build/pdfjs.js +3 -0
  20. package/build/pdfjs.js.map +1 -1
  21. package/build/pdfjs.web.d.ts +1 -1
  22. package/build/pdfjs.web.d.ts.map +1 -1
  23. package/build/pdfjs.web.js +1 -1
  24. package/build/pdfjs.web.js.map +1 -1
  25. package/build/web/annotationUtils.d.ts.map +1 -1
  26. package/build/web/annotationUtils.js +13 -5
  27. package/build/web/annotationUtils.js.map +1 -1
  28. package/docs/.nojekyll +1 -0
  29. package/docs/assets/hierarchy.js +1 -0
  30. package/docs/assets/highlight.css +113 -0
  31. package/docs/assets/icons.js +18 -0
  32. package/docs/assets/icons.svg +1 -0
  33. package/docs/assets/main.js +60 -0
  34. package/docs/assets/navigation.js +1 -0
  35. package/docs/assets/search.js +1 -0
  36. package/docs/assets/style.css +1648 -0
  37. package/docs/functions/ExpoPdfMarkupView.html +42 -0
  38. package/docs/functions/setPdfJsWorkerSrc.html +42 -0
  39. package/docs/hierarchy.html +29 -0
  40. package/docs/index.html +148 -0
  41. package/docs/modules.html +40 -0
  42. package/docs/types/Annotation.html +33 -0
  43. package/docs/types/AnnotationBounds.html +73 -0
  44. package/docs/types/AnnotationMode.html +33 -0
  45. package/docs/types/AnnotationPoint.html +61 -0
  46. package/docs/types/AnnotationsData.html +61 -0
  47. package/docs/types/ExpoPdfMarkupViewProps.html +184 -0
  48. package/docs/types/HighlightAnnotation.html +91 -0
  49. package/docs/types/InkAnnotation.html +91 -0
  50. package/docs/types/StampAnnotation.html +95 -0
  51. package/docs/types/StampDefinition.html +72 -0
  52. package/docs/types/TextAnnotation.html +110 -0
  53. package/docs/types/TextInputRequest.html +73 -0
  54. package/docs/types/UnderlineAnnotation.html +85 -0
  55. package/ios/AnnotationSerializer.swift +6 -34
  56. package/ios/ExpoPdfMarkupView+Ink.swift +2 -10
  57. package/ios/ExpoPdfMarkupView+Move.swift +4 -3
  58. package/ios/ExpoPdfMarkupView.swift +4 -3
  59. package/ios/InkPDFAnnotation.swift +45 -0
  60. package/ios/Tests/AnnotationSerializerTests.swift +26 -0
  61. package/metro.js +47 -20
  62. package/package.json +8 -8
  63. package/src/ExpoPdfMarkup.types.ts +2 -13
  64. package/src/ExpoPdfMarkupView.tsx +1 -1
  65. package/src/ExpoPdfMarkupView.web.tsx +26 -13
  66. package/src/index.ts +1 -1
  67. package/src/pdfjs.ts +4 -0
  68. package/src/pdfjs.web.ts +1 -1
  69. package/src/web/annotationUtils.ts +11 -5
package/build/pdfjs.js CHANGED
@@ -2,4 +2,7 @@
2
2
  export function setPdfJsWorkerSrc(_url) {
3
3
  // no-op on native
4
4
  }
5
+ export function setPdfJsWasmUrl(_url) {
6
+ // no-op on native
7
+ }
5
8
  //# sourceMappingURL=pdfjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pdfjs.js","sourceRoot":"","sources":["../src/pdfjs.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,kBAAkB;AACpB,CAAC","sourcesContent":["// Native stub — pdfjs-dist is not available on iOS/Android.\nexport function setPdfJsWorkerSrc(_url: string): void {\n // no-op on native\n}\n"]}
1
+ {"version":3,"file":"pdfjs.js","sourceRoot":"","sources":["../src/pdfjs.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,kBAAkB;AACpB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,kBAAkB;AACpB,CAAC","sourcesContent":["// Native stub — pdfjs-dist is not available on iOS/Android.\nexport function setPdfJsWorkerSrc(_url: string): void {\n // no-op on native\n}\n\nexport function setPdfJsWasmUrl(_url: string): void {\n // no-op on native\n}\n"]}
@@ -1,2 +1,2 @@
1
- export { setPdfJsWorkerSrc } from './ExpoPdfMarkupView.web';
1
+ export { setPdfJsWorkerSrc, setPdfJsWasmUrl } from './ExpoPdfMarkupView.web';
2
2
  //# sourceMappingURL=pdfjs.web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pdfjs.web.d.ts","sourceRoot":"","sources":["../src/pdfjs.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"pdfjs.web.d.ts","sourceRoot":"","sources":["../src/pdfjs.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1,2 +1,2 @@
1
- export { setPdfJsWorkerSrc } from './ExpoPdfMarkupView.web';
1
+ export { setPdfJsWorkerSrc, setPdfJsWasmUrl } from './ExpoPdfMarkupView.web';
2
2
  //# sourceMappingURL=pdfjs.web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pdfjs.web.js","sourceRoot":"","sources":["../src/pdfjs.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { setPdfJsWorkerSrc } from './ExpoPdfMarkupView.web';\n"]}
1
+ {"version":3,"file":"pdfjs.web.js","sourceRoot":"","sources":["../src/pdfjs.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { setPdfJsWorkerSrc, setPdfJsWasmUrl } from './ExpoPdfMarkupView.web';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"annotationUtils.d.ts","sourceRoot":"","sources":["../../src/web/annotationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAM3C,iEAAiE;AACjE,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GACjB,eAAe,CAKjB;AAED,iEAAiE;AACjE,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GACjB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAK1B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GACjB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAOzD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,E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GAAG,gBAAgB,GAAG,IAAI,CA+B1F;AAED,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,eAAe,CAejB;AAED,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,UAAU,CAyBZ;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,eAAe,EACzB,WAAW,EAAE,UAAU,EAAE,EACzB,SAAS,EAAE,MAAM,GAChB,UAAU,GAAG,IAAI,CA6BnB;AAMD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,wBAAwB,EAC7B,WAAW,EAAE,UAAU,EAAE,EACzB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,WAAW,EACjB,OAAO,GAAE;IACP,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,iBAAiB,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;CAClC,GACL,IAAI,CA4GN;AAMD,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,eAAe,CAc/D;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAElE;AAED,wBAAgB,eAAe,IAAI,MAAM,CAKxC"}
@@ -134,18 +134,23 @@ export function hitTestAnnotation(pdfPoint, annotations, pageIndex) {
134
134
  const onPage = annotations.filter((a) => a.page === pageIndex);
135
135
  for (let i = onPage.length - 1; i >= 0; i--) {
136
136
  const annotation = onPage[i];
137
+ if (!annotation)
138
+ continue;
137
139
  if (annotation.type === 'ink') {
138
140
  const tolerance = Math.max(annotation.lineWidth ?? 2, 10);
139
141
  const paths = annotation.paths ?? [];
140
142
  for (const stroke of paths) {
141
- if (stroke.length === 1) {
142
- const dx = pdfPoint.x - stroke[0].x;
143
- const dy = pdfPoint.y - stroke[0].y;
143
+ const first = stroke[0];
144
+ if (stroke.length === 1 && first) {
145
+ const dx = pdfPoint.x - first.x;
146
+ const dy = pdfPoint.y - first.y;
144
147
  if (Math.sqrt(dx * dx + dy * dy) <= tolerance)
145
148
  return annotation;
146
149
  }
147
150
  for (let j = 0; j < stroke.length - 1; j++) {
148
- if (distanceToSegment(pdfPoint, stroke[j], stroke[j + 1]) <= tolerance) {
151
+ const from = stroke[j];
152
+ const to = stroke[j + 1];
153
+ if (from && to && distanceToSegment(pdfPoint, from, to) <= tolerance) {
149
154
  return annotation;
150
155
  }
151
156
  }
@@ -189,7 +194,10 @@ export function drawAnnotationsOnCanvas(ctx, annotations, pageIndex, meta, optio
189
194
  continue;
190
195
  ctx.beginPath();
191
196
  for (let i = 0; i < stroke.length; i++) {
192
- const { x, y } = pdfToCanvas(stroke[i].x, stroke[i].y, scale, pdfHeight);
197
+ const point = stroke[i];
198
+ if (!point)
199
+ continue;
200
+ const { x, y } = pdfToCanvas(point.x, point.y, scale, pdfHeight);
193
201
  if (i === 0)
194
202
  ctx.moveTo(x, y);
195
203
  else
@@ -1 +1 @@
1
- {"version":3,"file":"annotationUtils.js","sourceRoot":"","sources":["../../src/web/annotationUtils.ts"],"names":[],"mappings":"AAQA,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E,iEAAiE;AACjE,MAAM,UAAU,WAAW,CACzB,OAAe,EACf,OAAe,EACf,KAAa,EACb,UAAkB;IAElB,OAAO;QACL,CAAC,EAAE,OAAO,GAAG,KAAK;QAClB,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,KAAK;KAChC,CAAC;AACJ,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,WAAW,CACzB,IAAY,EACZ,IAAY,EACZ,KAAa,EACb,UAAkB;IAElB,OAA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ACvE,CAAC","sourcesContent":["import type {\n Annotation,\n AnnotationBounds,\n AnnotationPoint,\n AnnotationsData,\n} from '../ExpoPdfMarkup.types';\nimport type { PdfPageMeta } from './types';\n\n// ---------------------------------------------------------------------------\n// Coordinate transforms\n// ---------------------------------------------------------------------------\n\n/** Convert canvas pixel coords → PDF user-space coords (y-up) */\nexport function canvasToPdf(\n canvasX: number,\n canvasY: number,\n scale: number,\n pageHeight: number\n): AnnotationPoint {\n return {\n x: canvasX / scale,\n y: pageHeight - canvasY / scale,\n };\n}\n\n/** Convert PDF user-space coords (y-up) → canvas pixel coords */\nexport function pdfToCanvas(\n pdfX: number,\n pdfY: number,\n scale: number,\n pageHeight: number\n): { x: number; y: number } {\n return {\n x: pdfX * scale,\n y: (pageHeight - pdfY) * scale,\n };\n}\n\n/**\n * Convert a PDF bounds rect (y-up, y = bottom edge) → canvas rect (y-down, y = top edge).\n * All values are in CSS pixels (not physical pixels).\n */\nexport function pdfBoundsToCanvas(\n bounds: AnnotationBounds,\n scale: number,\n pageHeight: number\n): { x: number; y: number; width: number; height: number } {\n return {\n x: bounds.x * scale,\n y: (pageHeight - bounds.y - bounds.height) * scale,\n width: bounds.width * scale,\n height: bounds.height * scale,\n };\n}\n\n/**\n * Convert a canvas drag rect (minX/Y, maxX/Y in CSS pixels) → PDF bounds (y-up).\n * `bounds.y` is the bottom edge in PDF space, consistent with iOS/Android.\n */\nexport function canvasRectToPdfBounds(\n minX: number,\n minY: number,\n maxX: number,\n maxY: number,\n scale: number,\n pageHeight: number\n): AnnotationBounds {\n return {\n x: minX / scale,\n y: pageHeight - maxY / scale,\n width: (maxX - minX) / scale,\n height: (maxY - minY) / scale,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Hit testing (ported from AnnotationHitTester.kt)\n// ---------------------------------------------------------------------------\n\nexport function distanceToSegment(\n point: AnnotationPoint,\n a: AnnotationPoint,\n b: AnnotationPoint\n): number {\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n const lenSq = dx * dx + dy * dy;\n if (lenSq === 0) {\n const px = point.x - a.x;\n const py = point.y - a.y;\n return Math.sqrt(px * px + py * py);\n }\n let t = ((point.x - a.x) * dx + (point.y - a.y) * dy) / lenSq;\n t = Math.max(0, Math.min(1, t));\n const projX = a.x + t * dx;\n const projY = a.y + t * dy;\n const ex = point.x - projX;\n const ey = point.y - projY;\n return Math.sqrt(ex * ex + ey * ey);\n}\n\nfunction boundsContains(bounds: AnnotationBounds, point: AnnotationPoint): boolean {\n return (\n point.x >= bounds.x &&\n point.x <= bounds.x + bounds.width &&\n point.y >= bounds.y &&\n point.y <= bounds.y + bounds.height\n );\n}\n\nexport function getAnnotationOutlineBounds(annotation: Annotation): AnnotationBounds | null {\n if (annotation.type !== 'ink') {\n return annotation.bounds;\n }\n\n const paths = annotation.paths ?? [];\n let minX = Number.POSITIVE_INFINITY;\n let minY = Number.POSITIVE_INFINITY;\n let maxX = Number.NEGATIVE_INFINITY;\n let maxY = Number.NEGATIVE_INFINITY;\n\n for (const stroke of paths) {\n for (const point of stroke) {\n minX = Math.min(minX, point.x);\n minY = Math.min(minY, point.y);\n maxX = Math.max(maxX, point.x);\n maxY = Math.max(maxY, point.y);\n }\n }\n\n if (!Number.isFinite(minX) || !Number.isFinite(minY)) {\n return null;\n }\n\n const padding = Math.max(annotation.lineWidth ?? 2, 10);\n return {\n x: minX - padding,\n y: minY - padding,\n width: maxX - minX + padding * 2,\n height: maxY - minY + padding * 2,\n };\n}\n\nexport function clampAnnotationTranslation(\n annotation: Annotation,\n deltaX: number,\n deltaY: number,\n pageWidth: number,\n pageHeight: number\n): AnnotationPoint {\n const bounds = getAnnotationOutlineBounds(annotation);\n if (!bounds) {\n return { x: deltaX, y: deltaY };\n }\n\n const minDeltaX = -bounds.x;\n const maxDeltaX = pageWidth - (bounds.x + bounds.width);\n const minDeltaY = -bounds.y;\n const maxDeltaY = pageHeight - (bounds.y + bounds.height);\n\n return {\n x: Math.min(Math.max(deltaX, minDeltaX), maxDeltaX),\n y: Math.min(Math.max(deltaY, minDeltaY), maxDeltaY),\n };\n}\n\nexport function translateAnnotation(\n annotation: Annotation,\n deltaX: number,\n deltaY: number\n): Annotation {\n if (deltaX === 0 && deltaY === 0) {\n return annotation;\n }\n\n if (annotation.type === 'ink') {\n return {\n ...annotation,\n paths: (annotation.paths ?? []).map((stroke) =>\n stroke.map((point) => ({\n x: point.x + deltaX,\n y: point.y + deltaY,\n }))\n ),\n };\n }\n\n return {\n ...annotation,\n bounds: {\n ...annotation.bounds,\n x: annotation.bounds.x + deltaX,\n y: annotation.bounds.y + deltaY,\n },\n };\n}\n\n/** Return the topmost annotation hit at pdfPoint on pageIndex, or null. */\nexport function hitTestAnnotation(\n pdfPoint: AnnotationPoint,\n annotations: Annotation[],\n pageIndex: number\n): Annotation | null {\n const onPage = annotations.filter((a) => a.page === pageIndex);\n for (let i = onPage.length - 1; i >= 0; i--) {\n const annotation = onPage[i];\n if (annotation.type === 'ink') {\n const tolerance = Math.max(annotation.lineWidth ?? 2, 10);\n const paths = annotation.paths ?? [];\n for (const stroke of paths) {\n if (stroke.length === 1) {\n const dx = pdfPoint.x - stroke[0].x;\n const dy = pdfPoint.y - stroke[0].y;\n if (Math.sqrt(dx * dx + dy * dy) <= tolerance) return annotation;\n }\n for (let j = 0; j < stroke.length - 1; j++) {\n if (distanceToSegment(pdfPoint, stroke[j], stroke[j + 1]) <= tolerance) {\n return annotation;\n }\n }\n }\n } else {\n const bounds = annotation.bounds;\n if (bounds && boundsContains(bounds, pdfPoint)) return annotation;\n }\n }\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Canvas drawing (mirrors AnnotationRenderer.kt)\n// ---------------------------------------------------------------------------\n\n/**\n * Draw all annotations for pageIndex onto ctx.\n * meta.scale is CSS-pixels-per-PDF-point; canvas backing = CSS * devicePixelRatio,\n * but the caller should have called ctx.scale(dpr, dpr) so we work in CSS pixels here.\n */\nexport function drawAnnotationsOnCanvas(\n ctx: CanvasRenderingContext2D,\n annotations: Annotation[],\n pageIndex: number,\n meta: PdfPageMeta,\n options: {\n highlightAnnotations?: boolean;\n highlightColor?: string;\n previewAnnotationId?: string | null;\n previewAnnotation?: Annotation | null;\n } = {}\n): void {\n const { scale, pdfHeight } = meta;\n const pageAnnotations = annotations\n .filter((annotation) => annotation.page === pageIndex)\n .map((annotation) =>\n options.previewAnnotationId === annotation.id && options.previewAnnotation\n ? options.previewAnnotation\n : annotation\n )\n .filter((annotation) => annotation.page === pageIndex);\n\n for (const annotation of pageAnnotations) {\n switch (annotation.type) {\n case 'ink': {\n const paths = annotation.paths ?? [];\n ctx.save();\n ctx.strokeStyle = annotation.color;\n ctx.lineWidth = (annotation.lineWidth ?? 2) * scale;\n ctx.lineCap = 'round';\n ctx.lineJoin = 'round';\n for (const stroke of paths) {\n if (stroke.length === 0) continue;\n ctx.beginPath();\n for (let i = 0; i < stroke.length; i++) {\n const { x, y } = pdfToCanvas(stroke[i].x, stroke[i].y, scale, pdfHeight);\n if (i === 0) ctx.moveTo(x, y);\n else ctx.lineTo(x, y);\n }\n ctx.stroke();\n }\n ctx.restore();\n break;\n }\n case 'highlight': {\n const bounds = annotation.bounds;\n if (!bounds) break;\n const rect = pdfBoundsToCanvas(bounds, scale, pdfHeight);\n ctx.save();\n ctx.globalAlpha = annotation.alpha ?? 0.5;\n ctx.fillStyle = annotation.color;\n ctx.fillRect(rect.x, rect.y, rect.width, rect.height);\n ctx.restore();\n break;\n }\n case 'underline': {\n const bounds = annotation.bounds;\n if (!bounds) break;\n // Underline sits at the bottom of bounds (PDF y = bounds.y = bottom edge)\n const left = bounds.x * scale;\n const bottom = (pdfHeight - bounds.y) * scale;\n const right = left + bounds.width * scale;\n ctx.save();\n ctx.strokeStyle = annotation.color;\n ctx.lineWidth = scale;\n ctx.beginPath();\n ctx.moveTo(left, bottom);\n ctx.lineTo(right, bottom);\n ctx.stroke();\n ctx.restore();\n break;\n }\n case 'text':\n case 'freeText': {\n const bounds = annotation.bounds;\n const text = annotation.contents;\n if (!bounds || !text) break;\n const fontSize = (annotation.fontSize ?? 16) * scale;\n ctx.save();\n ctx.fillStyle = annotation.color;\n ctx.font = `${fontSize}px ${annotation.fontFamily ?? 'sans-serif'}`;\n const canvasTop = (pdfHeight - bounds.y - bounds.height) * scale;\n ctx.fillText(text, bounds.x * scale, canvasTop + fontSize);\n ctx.restore();\n break;\n }\n case 'stamp': {\n const bounds = annotation.bounds;\n if (!bounds || !annotation.text) break;\n const rect = pdfBoundsToCanvas(bounds, scale, pdfHeight);\n ctx.save();\n ctx.fillStyle = annotation.color;\n ctx.font = `${rect.height * 0.7}px sans-serif`;\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.fillText(annotation.text, rect.x + rect.width / 2, rect.y + rect.height / 2);\n ctx.restore();\n break;\n }\n }\n }\n\n if (!options.highlightAnnotations) {\n return;\n }\n\n for (const annotation of pageAnnotations) {\n const bounds = getAnnotationOutlineBounds(annotation);\n if (!bounds) continue;\n const rect = pdfBoundsToCanvas(bounds, scale, pdfHeight);\n ctx.save();\n ctx.strokeStyle = options.highlightColor ?? '#0A84FF';\n ctx.lineWidth = 1.5;\n ctx.setLineDash([6, 4]);\n ctx.strokeRect(rect.x, rect.y, rect.width, rect.height);\n ctx.restore();\n }\n}\n\n// ---------------------------------------------------------------------------\n// Serialization\n// ---------------------------------------------------------------------------\n\nexport function parseAnnotations(json?: string): AnnotationsData {\n if (!json) return { version: 1, annotations: [] };\n try {\n const data = JSON.parse(json) as AnnotationsData;\n if (!Array.isArray(data?.annotations)) return { version: 1, annotations: [] };\n // Deduplicate by id — last wins\n const seen = new Map<string, Annotation>();\n for (const a of data.annotations) {\n seen.set(a.id, a);\n }\n return { version: 1, annotations: Array.from(seen.values()) };\n } catch {\n return { version: 1, annotations: [] };\n }\n}\n\nexport function serializeAnnotations(data: AnnotationsData): string {\n return JSON.stringify(data);\n}\n\nexport function newAnnotationId(): string {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n return crypto.randomUUID();\n }\n return Math.random().toString(36).slice(2) + Date.now().toString(36);\n}\n"]}
1
+ {"version":3,"file":"annotationUtils.js","sourceRoot":"","sources":["../../src/web/annotationUtils.ts"],"names":[],"mappings":"AAQA,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E,iEAAiE;AACjE,MAAM,UAAU,WAAW,CACzB,OAAe,EACf,OAAe,EACf,KAAa,EACb,UAAkB;IAElB,OAAO;QACL,CAAC,EAAE,OAAO,GAAG,KAAK;QAClB,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,KAAK;KAChC,CAAC;AACJ,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,WAAW,CACzB,IAAY,EACZ,IAAY,EACZ,KAAa,EACb,UAAkB;IAElB,OAAO;QACL,CAAC,EAAE,IAAI,GAAG,KAAK;QACf,CAAC,EAAE,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,KAAK;KAC/B,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAwB,EACxB,KAAa,EACb,UAAkB;IAElB,OAAO;QACL,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,KAAK;QACnB,CAAC,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK;QAClD,KAAK,EAAE,MAAM,CAAC,KAAK,GAAG,KAAK;QAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,KAAK;KAC9B,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,KAAa,EACb,UAAkB;IAElB,OAAO;QACL,CAAC,EAAE,IAAI,GAAG,KAAK;QACf,CAAC,EAAE,UAAU,GAAG,IAAI,GAAG,KAAK;QAC5B,KAAK,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,KAAK;QAC5B,MAAM,E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AC;QACpB,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;IACzC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAqB;IACxD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;QAC7E,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC;IAC7B,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import type {\n Annotation,\n AnnotationBounds,\n AnnotationPoint,\n AnnotationsData,\n} from '../ExpoPdfMarkup.types';\nimport type { PdfPageMeta } from './types';\n\n// ---------------------------------------------------------------------------\n// Coordinate transforms\n// ---------------------------------------------------------------------------\n\n/** Convert canvas pixel coords → PDF user-space coords (y-up) */\nexport function canvasToPdf(\n canvasX: number,\n canvasY: number,\n scale: number,\n pageHeight: number\n): AnnotationPoint {\n return {\n x: canvasX / scale,\n y: pageHeight - canvasY / scale,\n };\n}\n\n/** Convert PDF user-space coords (y-up) → canvas pixel coords */\nexport function pdfToCanvas(\n pdfX: number,\n pdfY: number,\n scale: number,\n pageHeight: number\n): { x: number; y: number } {\n return {\n x: pdfX * scale,\n y: (pageHeight - pdfY) * scale,\n };\n}\n\n/**\n * Convert a PDF bounds rect (y-up, y = bottom edge) → canvas rect (y-down, y = top edge).\n * All values are in CSS pixels (not physical pixels).\n */\nexport function pdfBoundsToCanvas(\n bounds: AnnotationBounds,\n scale: number,\n pageHeight: number\n): { x: number; y: number; width: number; height: number } {\n return {\n x: bounds.x * scale,\n y: (pageHeight - bounds.y - bounds.height) * scale,\n width: bounds.width * scale,\n height: bounds.height * scale,\n };\n}\n\n/**\n * Convert a canvas drag rect (minX/Y, maxX/Y in CSS pixels) → PDF bounds (y-up).\n * `bounds.y` is the bottom edge in PDF space, consistent with iOS/Android.\n */\nexport function canvasRectToPdfBounds(\n minX: number,\n minY: number,\n maxX: number,\n maxY: number,\n scale: number,\n pageHeight: number\n): AnnotationBounds {\n return {\n x: minX / scale,\n y: pageHeight - maxY / scale,\n width: (maxX - minX) / scale,\n height: (maxY - minY) / scale,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Hit testing (ported from AnnotationHitTester.kt)\n// ---------------------------------------------------------------------------\n\nexport function distanceToSegment(\n point: AnnotationPoint,\n a: AnnotationPoint,\n b: AnnotationPoint\n): number {\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n const lenSq = dx * dx + dy * dy;\n if (lenSq === 0) {\n const px = point.x - a.x;\n const py = point.y - a.y;\n return Math.sqrt(px * px + py * py);\n }\n let t = ((point.x - a.x) * dx + (point.y - a.y) * dy) / lenSq;\n t = Math.max(0, Math.min(1, t));\n const projX = a.x + t * dx;\n const projY = a.y + t * dy;\n const ex = point.x - projX;\n const ey = point.y - projY;\n return Math.sqrt(ex * ex + ey * ey);\n}\n\nfunction boundsContains(bounds: AnnotationBounds, point: AnnotationPoint): boolean {\n return (\n point.x >= bounds.x &&\n point.x <= bounds.x + bounds.width &&\n point.y >= bounds.y &&\n point.y <= bounds.y + bounds.height\n );\n}\n\nexport function getAnnotationOutlineBounds(annotation: Annotation): AnnotationBounds | null {\n if (annotation.type !== 'ink') {\n return annotation.bounds;\n }\n\n const paths = annotation.paths ?? [];\n let minX = Number.POSITIVE_INFINITY;\n let minY = Number.POSITIVE_INFINITY;\n let maxX = Number.NEGATIVE_INFINITY;\n let maxY = Number.NEGATIVE_INFINITY;\n\n for (const stroke of paths) {\n for (const point of stroke) {\n minX = Math.min(minX, point.x);\n minY = Math.min(minY, point.y);\n maxX = Math.max(maxX, point.x);\n maxY = Math.max(maxY, point.y);\n }\n }\n\n if (!Number.isFinite(minX) || !Number.isFinite(minY)) {\n return null;\n }\n\n const padding = Math.max(annotation.lineWidth ?? 2, 10);\n return {\n x: minX - padding,\n y: minY - padding,\n width: maxX - minX + padding * 2,\n height: maxY - minY + padding * 2,\n };\n}\n\nexport function clampAnnotationTranslation(\n annotation: Annotation,\n deltaX: number,\n deltaY: number,\n pageWidth: number,\n pageHeight: number\n): AnnotationPoint {\n const bounds = getAnnotationOutlineBounds(annotation);\n if (!bounds) {\n return { x: deltaX, y: deltaY };\n }\n\n const minDeltaX = -bounds.x;\n const maxDeltaX = pageWidth - (bounds.x + bounds.width);\n const minDeltaY = -bounds.y;\n const maxDeltaY = pageHeight - (bounds.y + bounds.height);\n\n return {\n x: Math.min(Math.max(deltaX, minDeltaX), maxDeltaX),\n y: Math.min(Math.max(deltaY, minDeltaY), maxDeltaY),\n };\n}\n\nexport function translateAnnotation(\n annotation: Annotation,\n deltaX: number,\n deltaY: number\n): Annotation {\n if (deltaX === 0 && deltaY === 0) {\n return annotation;\n }\n\n if (annotation.type === 'ink') {\n return {\n ...annotation,\n paths: (annotation.paths ?? []).map((stroke) =>\n stroke.map((point) => ({\n x: point.x + deltaX,\n y: point.y + deltaY,\n }))\n ),\n };\n }\n\n return {\n ...annotation,\n bounds: {\n ...annotation.bounds,\n x: annotation.bounds.x + deltaX,\n y: annotation.bounds.y + deltaY,\n },\n };\n}\n\n/** Return the topmost annotation hit at pdfPoint on pageIndex, or null. */\nexport function hitTestAnnotation(\n pdfPoint: AnnotationPoint,\n annotations: Annotation[],\n pageIndex: number\n): Annotation | null {\n const onPage = annotations.filter((a) => a.page === pageIndex);\n for (let i = onPage.length - 1; i >= 0; i--) {\n const annotation = onPage[i];\n if (!annotation) continue;\n if (annotation.type === 'ink') {\n const tolerance = Math.max(annotation.lineWidth ?? 2, 10);\n const paths = annotation.paths ?? [];\n for (const stroke of paths) {\n const first = stroke[0];\n if (stroke.length === 1 && first) {\n const dx = pdfPoint.x - first.x;\n const dy = pdfPoint.y - first.y;\n if (Math.sqrt(dx * dx + dy * dy) <= tolerance) return annotation;\n }\n for (let j = 0; j < stroke.length - 1; j++) {\n const from = stroke[j];\n const to = stroke[j + 1];\n if (from && to && distanceToSegment(pdfPoint, from, to) <= tolerance) {\n return annotation;\n }\n }\n }\n } else {\n const bounds = annotation.bounds;\n if (bounds && boundsContains(bounds, pdfPoint)) return annotation;\n }\n }\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Canvas drawing (mirrors AnnotationRenderer.kt)\n// ---------------------------------------------------------------------------\n\n/**\n * Draw all annotations for pageIndex onto ctx.\n * meta.scale is CSS-pixels-per-PDF-point; canvas backing = CSS * devicePixelRatio,\n * but the caller should have called ctx.scale(dpr, dpr) so we work in CSS pixels here.\n */\nexport function drawAnnotationsOnCanvas(\n ctx: CanvasRenderingContext2D,\n annotations: Annotation[],\n pageIndex: number,\n meta: PdfPageMeta,\n options: {\n highlightAnnotations?: boolean;\n highlightColor?: string;\n previewAnnotationId?: string | null;\n previewAnnotation?: Annotation | null;\n } = {}\n): void {\n const { scale, pdfHeight } = meta;\n const pageAnnotations = annotations\n .filter((annotation) => annotation.page === pageIndex)\n .map((annotation) =>\n options.previewAnnotationId === annotation.id && options.previewAnnotation\n ? options.previewAnnotation\n : annotation\n )\n .filter((annotation) => annotation.page === pageIndex);\n\n for (const annotation of pageAnnotations) {\n switch (annotation.type) {\n case 'ink': {\n const paths = annotation.paths ?? [];\n ctx.save();\n ctx.strokeStyle = annotation.color;\n ctx.lineWidth = (annotation.lineWidth ?? 2) * scale;\n ctx.lineCap = 'round';\n ctx.lineJoin = 'round';\n for (const stroke of paths) {\n if (stroke.length === 0) continue;\n ctx.beginPath();\n for (let i = 0; i < stroke.length; i++) {\n const point = stroke[i];\n if (!point) continue;\n const { x, y } = pdfToCanvas(point.x, point.y, scale, pdfHeight);\n if (i === 0) ctx.moveTo(x, y);\n else ctx.lineTo(x, y);\n }\n ctx.stroke();\n }\n ctx.restore();\n break;\n }\n case 'highlight': {\n const bounds = annotation.bounds;\n if (!bounds) break;\n const rect = pdfBoundsToCanvas(bounds, scale, pdfHeight);\n ctx.save();\n ctx.globalAlpha = annotation.alpha ?? 0.5;\n ctx.fillStyle = annotation.color;\n ctx.fillRect(rect.x, rect.y, rect.width, rect.height);\n ctx.restore();\n break;\n }\n case 'underline': {\n const bounds = annotation.bounds;\n if (!bounds) break;\n // Underline sits at the bottom of bounds (PDF y = bounds.y = bottom edge)\n const left = bounds.x * scale;\n const bottom = (pdfHeight - bounds.y) * scale;\n const right = left + bounds.width * scale;\n ctx.save();\n ctx.strokeStyle = annotation.color;\n ctx.lineWidth = scale;\n ctx.beginPath();\n ctx.moveTo(left, bottom);\n ctx.lineTo(right, bottom);\n ctx.stroke();\n ctx.restore();\n break;\n }\n case 'text':\n case 'freeText': {\n const bounds = annotation.bounds;\n const text = annotation.contents;\n if (!bounds || !text) break;\n const fontSize = (annotation.fontSize ?? 16) * scale;\n ctx.save();\n ctx.fillStyle = annotation.color;\n ctx.font = `${fontSize}px ${annotation.fontFamily ?? 'sans-serif'}`;\n const canvasTop = (pdfHeight - bounds.y - bounds.height) * scale;\n ctx.fillText(text, bounds.x * scale, canvasTop + fontSize);\n ctx.restore();\n break;\n }\n case 'stamp': {\n const bounds = annotation.bounds;\n if (!bounds || !annotation.text) break;\n const rect = pdfBoundsToCanvas(bounds, scale, pdfHeight);\n ctx.save();\n ctx.fillStyle = annotation.color;\n ctx.font = `${rect.height * 0.7}px sans-serif`;\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.fillText(annotation.text, rect.x + rect.width / 2, rect.y + rect.height / 2);\n ctx.restore();\n break;\n }\n }\n }\n\n if (!options.highlightAnnotations) {\n return;\n }\n\n for (const annotation of pageAnnotations) {\n const bounds = getAnnotationOutlineBounds(annotation);\n if (!bounds) continue;\n const rect = pdfBoundsToCanvas(bounds, scale, pdfHeight);\n ctx.save();\n ctx.strokeStyle = options.highlightColor ?? '#0A84FF';\n ctx.lineWidth = 1.5;\n ctx.setLineDash([6, 4]);\n ctx.strokeRect(rect.x, rect.y, rect.width, rect.height);\n ctx.restore();\n }\n}\n\n// ---------------------------------------------------------------------------\n// Serialization\n// ---------------------------------------------------------------------------\n\nexport function parseAnnotations(json?: string): AnnotationsData {\n if (!json) return { version: 1, annotations: [] };\n try {\n const data = JSON.parse(json) as AnnotationsData;\n if (!Array.isArray(data?.annotations)) return { version: 1, annotations: [] };\n // Deduplicate by id — last wins\n const seen = new Map<string, Annotation>();\n for (const a of data.annotations) {\n seen.set(a.id, a);\n }\n return { version: 1, annotations: Array.from(seen.values()) };\n } catch {\n return { version: 1, annotations: [] };\n }\n}\n\nexport function serializeAnnotations(data: AnnotationsData): string {\n return JSON.stringify(data);\n}\n\nexport function newAnnotationId(): string {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n return crypto.randomUUID();\n }\n return Math.random().toString(36).slice(2) + Date.now().toString(36);\n}\n"]}
package/docs/.nojekyll ADDED
@@ -0,0 +1 @@
1
+ TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
@@ -0,0 +1 @@
1
+ window.hierarchyData = "eJyrVirKzy8pVrKKjtVRKkpNy0lNLsnMzytWsqqurQUAmx4Kpg=="
@@ -0,0 +1,113 @@
1
+ :root {
2
+ --light-hl-0: #795E26;
3
+ --dark-hl-0: #DCDCAA;
4
+ --light-hl-1: #000000;
5
+ --dark-hl-1: #D4D4D4;
6
+ --light-hl-2: #A31515;
7
+ --dark-hl-2: #CE9178;
8
+ --light-hl-3: #0000FF;
9
+ --dark-hl-3: #569CD6;
10
+ --light-hl-4: #0070C1;
11
+ --dark-hl-4: #4FC1FF;
12
+ --light-hl-5: #001080;
13
+ --dark-hl-5: #9CDCFE;
14
+ --light-hl-6: #267F99;
15
+ --dark-hl-6: #4EC9B0;
16
+ --light-hl-7: #AF00DB;
17
+ --dark-hl-7: #C586C0;
18
+ --light-hl-8: #008000;
19
+ --dark-hl-8: #6A9955;
20
+ --light-hl-9: #098658;
21
+ --dark-hl-9: #B5CEA8;
22
+ --light-hl-10: #800000;
23
+ --dark-hl-10: #808080;
24
+ --light-hl-11: #E50000;
25
+ --dark-hl-11: #9CDCFE;
26
+ --light-hl-12: #000000FF;
27
+ --dark-hl-12: #D4D4D4;
28
+ --light-code-background: #FFFFFF;
29
+ --dark-code-background: #1E1E1E;
30
+ }
31
+
32
+ @media (prefers-color-scheme: light) { :root {
33
+ --hl-0: var(--light-hl-0);
34
+ --hl-1: var(--light-hl-1);
35
+ --hl-2: var(--light-hl-2);
36
+ --hl-3: var(--light-hl-3);
37
+ --hl-4: var(--light-hl-4);
38
+ --hl-5: var(--light-hl-5);
39
+ --hl-6: var(--light-hl-6);
40
+ --hl-7: var(--light-hl-7);
41
+ --hl-8: var(--light-hl-8);
42
+ --hl-9: var(--light-hl-9);
43
+ --hl-10: var(--light-hl-10);
44
+ --hl-11: var(--light-hl-11);
45
+ --hl-12: var(--light-hl-12);
46
+ --code-background: var(--light-code-background);
47
+ } }
48
+
49
+ @media (prefers-color-scheme: dark) { :root {
50
+ --hl-0: var(--dark-hl-0);
51
+ --hl-1: var(--dark-hl-1);
52
+ --hl-2: var(--dark-hl-2);
53
+ --hl-3: var(--dark-hl-3);
54
+ --hl-4: var(--dark-hl-4);
55
+ --hl-5: var(--dark-hl-5);
56
+ --hl-6: var(--dark-hl-6);
57
+ --hl-7: var(--dark-hl-7);
58
+ --hl-8: var(--dark-hl-8);
59
+ --hl-9: var(--dark-hl-9);
60
+ --hl-10: var(--dark-hl-10);
61
+ --hl-11: var(--dark-hl-11);
62
+ --hl-12: var(--dark-hl-12);
63
+ --code-background: var(--dark-code-background);
64
+ } }
65
+
66
+ :root[data-theme='light'] {
67
+ --hl-0: var(--light-hl-0);
68
+ --hl-1: var(--light-hl-1);
69
+ --hl-2: var(--light-hl-2);
70
+ --hl-3: var(--light-hl-3);
71
+ --hl-4: var(--light-hl-4);
72
+ --hl-5: var(--light-hl-5);
73
+ --hl-6: var(--light-hl-6);
74
+ --hl-7: var(--light-hl-7);
75
+ --hl-8: var(--light-hl-8);
76
+ --hl-9: var(--light-hl-9);
77
+ --hl-10: var(--light-hl-10);
78
+ --hl-11: var(--light-hl-11);
79
+ --hl-12: var(--light-hl-12);
80
+ --code-background: var(--light-code-background);
81
+ }
82
+
83
+ :root[data-theme='dark'] {
84
+ --hl-0: var(--dark-hl-0);
85
+ --hl-1: var(--dark-hl-1);
86
+ --hl-2: var(--dark-hl-2);
87
+ --hl-3: var(--dark-hl-3);
88
+ --hl-4: var(--dark-hl-4);
89
+ --hl-5: var(--dark-hl-5);
90
+ --hl-6: var(--dark-hl-6);
91
+ --hl-7: var(--dark-hl-7);
92
+ --hl-8: var(--dark-hl-8);
93
+ --hl-9: var(--dark-hl-9);
94
+ --hl-10: var(--dark-hl-10);
95
+ --hl-11: var(--dark-hl-11);
96
+ --hl-12: var(--dark-hl-12);
97
+ --code-background: var(--dark-code-background);
98
+ }
99
+
100
+ .hl-0 { color: var(--hl-0); }
101
+ .hl-1 { color: var(--hl-1); }
102
+ .hl-2 { color: var(--hl-2); }
103
+ .hl-3 { color: var(--hl-3); }
104
+ .hl-4 { color: var(--hl-4); }
105
+ .hl-5 { color: var(--hl-5); }
106
+ .hl-6 { color: var(--hl-6); }
107
+ .hl-7 { color: var(--hl-7); }
108
+ .hl-8 { color: var(--hl-8); }
109
+ .hl-9 { color: var(--hl-9); }
110
+ .hl-10 { color: var(--hl-10); }
111
+ .hl-11 { color: var(--hl-11); }
112
+ .hl-12 { color: var(--hl-12); }
113
+ pre, code, math[display='block'] { background: var(--code-background); }
@@ -0,0 +1,18 @@
1
+ (function() {
2
+ addIcons();
3
+ function addIcons() {
4
+ if (document.readyState === "loading") return document.addEventListener("DOMContentLoaded", addIcons);
5
+ const svg = document.body.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg"));
6
+ svg.innerHTML = `<symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Module" id="icon-1"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-module)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">M</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Module" id="icon-2"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-module)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">M</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Namespace" id="icon-4"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-namespace)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">N</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Enumeration" id="icon-8"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-enum)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">E</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Enumeration Member" id="icon-16"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-property)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">P</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Variable" id="icon-32"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-variable)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">V</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Function" id="icon-64"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">F</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Class" id="icon-128"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">C</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Interface" id="icon-256"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">I</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Constructor" id="icon-512"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-constructor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">C</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Property" id="icon-1024"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-property)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">P</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Method" id="icon-2048"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-method)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">M</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Function" id="icon-4096"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">F</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Index Signature" id="icon-8192"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-property)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">P</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Constructor" id="icon-16384"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-constructor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">C</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Property" id="icon-32768"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-property)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">P</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Type Alias" id="icon-65536"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">T</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Type Alias" id="icon-131072"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">T</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Accessor" id="icon-262144"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-accessor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">A</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Accessor" id="icon-524288"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-accessor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">A</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Accessor" id="icon-1048576"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-accessor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">A</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Type Alias" id="icon-2097152"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">T</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Reference" id="icon-4194304"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-reference)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">R</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Document" id="icon-8388608"><rect fill="var(--color-icon-background)" stroke="var(--color-document)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><g stroke="var(--color-icon-text)" fill="none" stroke-width="1.5"><polygon points="6,5 6,19 18,19, 18,10 13,5"></polygon><line x1="9" y1="9" x2="13" y2="9"></line><line x1="9" y1="12" x2="15" y2="12"></line><line x1="9" y1="15" x2="15" y2="15"></line></g></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Folder" id="icon-folder"><rect fill="var(--color-icon-background)" stroke="var(--color-document)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><g stroke="var(--color-icon-text)" fill="none" stroke-width="1.5"><polygon points="5,5 10,5 12,8 19,8 19,18 5,18"></polygon></g></symbol><symbol width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true" id="icon-chevronDown" class="tsd-no-select"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-icon-text)"></path></symbol><symbol width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" id="icon-chevronSmall" class="tsd-no-select"><path d="M1.5 5.50969L8 11.6609L14.5 5.50969L12.5466 3.66086L8 7.96494L3.45341 3.66086L1.5 5.50969Z" fill="var(--color-icon-text)"></path></symbol><symbol width="32" height="32" viewBox="0 0 32 32" aria-hidden="true" id="icon-checkbox" class="tsd-no-select"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></symbol><symbol width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" id="icon-menu" class="tsd-no-select"><rect x="1" y="3" width="14" height="2" fill="var(--color-icon-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-icon-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-icon-text)"></rect></symbol><symbol width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" id="icon-search" class="tsd-no-select"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-icon-text)"></path></symbol><symbol viewBox="0 0 24 24" aria-hidden="true" id="icon-anchor" class="tsd-no-select"><g stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></g></symbol><symbol xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" id="icon-alertNote" class="tsd-no-select"><path fill="var(--color-alert-note)" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></symbol><symbol width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" id="icon-alertTip" class="tsd-no-select"><path fill="var(--color-alert-tip)" d="M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z"></path></symbol><symbol width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" id="icon-alertImportant" class="tsd-no-select"><path fill="var(--color-alert-important)" d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></symbol><symbol width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" id="icon-alertWarning" class="tsd-no-select"><path fill="var(--color-alert-warning)" d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></symbol><symbol width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" id="icon-alertCaution" class="tsd-no-select"><path fill="var(--color-alert-caution)" d="M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></symbol>`;
7
+ svg.style.display = "none";
8
+ if (location.protocol === "file:") updateUseElements();
9
+ }
10
+
11
+ function updateUseElements() {
12
+ document.querySelectorAll("use").forEach(el => {
13
+ if (el.getAttribute("href").includes("#icon-")) {
14
+ el.setAttribute("href", el.getAttribute("href").replace(/.*#/, "#"));
15
+ }
16
+ });
17
+ }
18
+ })()
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg"><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Module" id="icon-1"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-module)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">M</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Module" id="icon-2"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-module)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">M</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Namespace" id="icon-4"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-namespace)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">N</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Enumeration" id="icon-8"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-enum)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">E</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Enumeration Member" id="icon-16"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-property)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">P</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Variable" id="icon-32"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-variable)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">V</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Function" id="icon-64"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">F</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Class" id="icon-128"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">C</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Interface" id="icon-256"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">I</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Constructor" id="icon-512"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-constructor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">C</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Property" id="icon-1024"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-property)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">P</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Method" id="icon-2048"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-method)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">M</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Function" id="icon-4096"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">F</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Index Signature" id="icon-8192"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-property)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">P</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Constructor" id="icon-16384"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-constructor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">C</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Property" id="icon-32768"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-property)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">P</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Type Alias" id="icon-65536"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">T</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Type Alias" id="icon-131072"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">T</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Accessor" id="icon-262144"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-accessor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">A</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Accessor" id="icon-524288"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-accessor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">A</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Accessor" id="icon-1048576"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-accessor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">A</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Type Alias" id="icon-2097152"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">T</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Reference" id="icon-4194304"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-reference)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dy="0.35em" text-anchor="middle">R</text></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Document" id="icon-8388608"><rect fill="var(--color-icon-background)" stroke="var(--color-document)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><g stroke="var(--color-icon-text)" fill="none" stroke-width="1.5"><polygon points="6,5 6,19 18,19, 18,10 13,5"></polygon><line x1="9" y1="9" x2="13" y2="9"></line><line x1="9" y1="12" x2="15" y2="12"></line><line x1="9" y1="15" x2="15" y2="15"></line></g></symbol><symbol class="tsd-kind-icon tsd-no-select" viewBox="0 0 24 24" aria-label="Folder" id="icon-folder"><rect fill="var(--color-icon-background)" stroke="var(--color-document)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><g stroke="var(--color-icon-text)" fill="none" stroke-width="1.5"><polygon points="5,5 10,5 12,8 19,8 19,18 5,18"></polygon></g></symbol><symbol width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true" id="icon-chevronDown" class="tsd-no-select"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-icon-text)"></path></symbol><symbol width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" id="icon-chevronSmall" class="tsd-no-select"><path d="M1.5 5.50969L8 11.6609L14.5 5.50969L12.5466 3.66086L8 7.96494L3.45341 3.66086L1.5 5.50969Z" fill="var(--color-icon-text)"></path></symbol><symbol width="32" height="32" viewBox="0 0 32 32" aria-hidden="true" id="icon-checkbox" class="tsd-no-select"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></symbol><symbol width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" id="icon-menu" class="tsd-no-select"><rect x="1" y="3" width="14" height="2" fill="var(--color-icon-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-icon-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-icon-text)"></rect></symbol><symbol width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" id="icon-search" class="tsd-no-select"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-icon-text)"></path></symbol><symbol viewBox="0 0 24 24" aria-hidden="true" id="icon-anchor" class="tsd-no-select"><g stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></g></symbol><symbol xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" id="icon-alertNote" class="tsd-no-select"><path fill="var(--color-alert-note)" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></symbol><symbol width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" id="icon-alertTip" class="tsd-no-select"><path fill="var(--color-alert-tip)" d="M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z"></path></symbol><symbol width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" id="icon-alertImportant" class="tsd-no-select"><path fill="var(--color-alert-important)" d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></symbol><symbol width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" id="icon-alertWarning" class="tsd-no-select"><path fill="var(--color-alert-warning)" d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></symbol><symbol width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" id="icon-alertCaution" class="tsd-no-select"><path fill="var(--color-alert-caution)" d="M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></symbol></svg>