@tldraw/tlschema 5.4.0-next.b120f7febb0f → 5.4.0-next.ebc95cf01337
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-cjs/index.d.ts +119 -100
- package/dist-cjs/index.js +2 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/misc/b64Vecs.js.map +2 -2
- package/dist-cjs/records/TLPage.js +5 -0
- package/dist-cjs/records/TLPage.js.map +2 -2
- package/dist-esm/index.d.mts +119 -100
- package/dist-esm/index.mjs +3 -1
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/misc/b64Vecs.mjs.map +2 -2
- package/dist-esm/records/TLPage.mjs +5 -0
- package/dist-esm/records/TLPage.mjs.map +2 -2
- package/package.json +5 -5
- package/src/index.ts +1 -0
- package/src/misc/b64Vecs.ts +2 -11
- package/src/records/TLPage.ts +23 -0
package/dist-cjs/index.d.ts
CHANGED
|
@@ -1010,7 +1010,7 @@ export declare function createCustomRecordMigrationSequence(migrations: TLPropsM
|
|
|
1010
1010
|
*
|
|
1011
1011
|
* @public
|
|
1012
1012
|
*/
|
|
1013
|
-
export declare function createPresenceStateDerivation($user: Signal<null | TLUser>, opts?: CreatePresenceStateDerivationOpts): (store: TLStore) => Signal<null | TLInstancePresence
|
|
1013
|
+
export declare function createPresenceStateDerivation($user: Signal<null | TLUser>, opts?: CreatePresenceStateDerivationOpts): (store: TLStore) => Signal<null | TLInstancePresence>;
|
|
1014
1014
|
|
|
1015
1015
|
/** @public */
|
|
1016
1016
|
export declare interface CreatePresenceStateDerivationOpts {
|
|
@@ -1233,7 +1233,7 @@ export declare function createShapeValidator<Type extends string, Props extends
|
|
|
1233
1233
|
* })
|
|
1234
1234
|
* ```
|
|
1235
1235
|
*/
|
|
1236
|
-
export declare function createTLSchema({ shapes, bindings, assets, user, records, migrations }?: {
|
|
1236
|
+
export declare function createTLSchema({ shapes, bindings, assets, user, records, migrations, }?: {
|
|
1237
1237
|
assets?: Record<string, SchemaPropsInfo>;
|
|
1238
1238
|
bindings?: Record<string, SchemaPropsInfo>;
|
|
1239
1239
|
migrations?: readonly MigrationSequence[];
|
|
@@ -2414,6 +2414,25 @@ export declare function isDocument(record?: UnknownRecord): record is TLDocument
|
|
|
2414
2414
|
|
|
2415
2415
|
/* Excluded from this release type: isFontEntry */
|
|
2416
2416
|
|
|
2417
|
+
/**
|
|
2418
|
+
* Type guard to check if a record is a page.
|
|
2419
|
+
*
|
|
2420
|
+
* @param record - The record to check
|
|
2421
|
+
* @returns True if the record is a page, false otherwise
|
|
2422
|
+
*
|
|
2423
|
+
* @example
|
|
2424
|
+
* ```ts
|
|
2425
|
+
* const record = store.get('page:abc123')
|
|
2426
|
+
|
|
2427
|
+
* if (isPage(record)) {
|
|
2428
|
+
* console.log(`Page name: ${record.name}`)
|
|
2429
|
+
* }
|
|
2430
|
+
* ```
|
|
2431
|
+
*
|
|
2432
|
+
* @public
|
|
2433
|
+
*/
|
|
2434
|
+
export declare function isPage(record?: UnknownRecord): record is TLPage;
|
|
2435
|
+
|
|
2417
2436
|
/**
|
|
2418
2437
|
* Type guard to check if a string is a valid TLPageId.
|
|
2419
2438
|
*
|
|
@@ -2483,152 +2502,152 @@ export declare function isUserId(id: string): id is TLUserId;
|
|
|
2483
2502
|
|
|
2484
2503
|
/** @public */
|
|
2485
2504
|
export declare const LANGUAGES: readonly [{
|
|
2486
|
-
readonly label:
|
|
2487
|
-
readonly locale:
|
|
2505
|
+
readonly label: 'Bahasa Indonesia';
|
|
2506
|
+
readonly locale: 'id';
|
|
2488
2507
|
}, {
|
|
2489
|
-
readonly label:
|
|
2490
|
-
readonly locale:
|
|
2508
|
+
readonly label: 'Bahasa Melayu';
|
|
2509
|
+
readonly locale: 'ms';
|
|
2491
2510
|
}, {
|
|
2492
|
-
readonly label:
|
|
2493
|
-
readonly locale:
|
|
2511
|
+
readonly label: 'Català';
|
|
2512
|
+
readonly locale: 'ca';
|
|
2494
2513
|
}, {
|
|
2495
|
-
readonly label:
|
|
2496
|
-
readonly locale:
|
|
2514
|
+
readonly label: 'Čeština';
|
|
2515
|
+
readonly locale: 'cs';
|
|
2497
2516
|
}, {
|
|
2498
|
-
readonly label:
|
|
2499
|
-
readonly locale:
|
|
2517
|
+
readonly label: 'Danish';
|
|
2518
|
+
readonly locale: 'da';
|
|
2500
2519
|
}, {
|
|
2501
|
-
readonly label:
|
|
2502
|
-
readonly locale:
|
|
2520
|
+
readonly label: 'Deutsch';
|
|
2521
|
+
readonly locale: 'de';
|
|
2503
2522
|
}, {
|
|
2504
|
-
readonly label:
|
|
2505
|
-
readonly locale:
|
|
2523
|
+
readonly label: 'English';
|
|
2524
|
+
readonly locale: 'en';
|
|
2506
2525
|
}, {
|
|
2507
|
-
readonly label:
|
|
2508
|
-
readonly locale:
|
|
2526
|
+
readonly label: 'Español';
|
|
2527
|
+
readonly locale: 'es';
|
|
2509
2528
|
}, {
|
|
2510
|
-
readonly label:
|
|
2511
|
-
readonly locale:
|
|
2529
|
+
readonly label: 'Filipino';
|
|
2530
|
+
readonly locale: 'tl';
|
|
2512
2531
|
}, {
|
|
2513
|
-
readonly label:
|
|
2514
|
-
readonly locale:
|
|
2532
|
+
readonly label: 'Français';
|
|
2533
|
+
readonly locale: 'fr';
|
|
2515
2534
|
}, {
|
|
2516
|
-
readonly label:
|
|
2517
|
-
readonly locale:
|
|
2535
|
+
readonly label: 'Galego';
|
|
2536
|
+
readonly locale: 'gl';
|
|
2518
2537
|
}, {
|
|
2519
|
-
readonly label:
|
|
2520
|
-
readonly locale:
|
|
2538
|
+
readonly label: 'Hrvatski';
|
|
2539
|
+
readonly locale: 'hr';
|
|
2521
2540
|
}, {
|
|
2522
|
-
readonly label:
|
|
2523
|
-
readonly locale:
|
|
2541
|
+
readonly label: 'Italiano';
|
|
2542
|
+
readonly locale: 'it';
|
|
2524
2543
|
}, {
|
|
2525
|
-
readonly label:
|
|
2526
|
-
readonly locale:
|
|
2544
|
+
readonly label: 'Magyar';
|
|
2545
|
+
readonly locale: 'hu';
|
|
2527
2546
|
}, {
|
|
2528
|
-
readonly label:
|
|
2529
|
-
readonly locale:
|
|
2547
|
+
readonly label: 'Nederlands';
|
|
2548
|
+
readonly locale: 'nl';
|
|
2530
2549
|
}, {
|
|
2531
|
-
readonly label:
|
|
2532
|
-
readonly locale:
|
|
2550
|
+
readonly label: 'Norwegian';
|
|
2551
|
+
readonly locale: 'no';
|
|
2533
2552
|
}, {
|
|
2534
|
-
readonly label:
|
|
2535
|
-
readonly locale:
|
|
2553
|
+
readonly label: 'Polski';
|
|
2554
|
+
readonly locale: 'pl';
|
|
2536
2555
|
}, {
|
|
2537
|
-
readonly label:
|
|
2538
|
-
readonly locale:
|
|
2556
|
+
readonly label: 'Português - Brasil';
|
|
2557
|
+
readonly locale: 'pt-br';
|
|
2539
2558
|
}, {
|
|
2540
|
-
readonly label:
|
|
2541
|
-
readonly locale:
|
|
2559
|
+
readonly label: 'Português - Europeu';
|
|
2560
|
+
readonly locale: 'pt-pt';
|
|
2542
2561
|
}, {
|
|
2543
|
-
readonly label:
|
|
2544
|
-
readonly locale:
|
|
2562
|
+
readonly label: 'Română';
|
|
2563
|
+
readonly locale: 'ro';
|
|
2545
2564
|
}, {
|
|
2546
|
-
readonly label:
|
|
2547
|
-
readonly locale:
|
|
2565
|
+
readonly label: 'Slovenščina';
|
|
2566
|
+
readonly locale: 'sl';
|
|
2548
2567
|
}, {
|
|
2549
|
-
readonly label:
|
|
2550
|
-
readonly locale:
|
|
2568
|
+
readonly label: 'Somali';
|
|
2569
|
+
readonly locale: 'so';
|
|
2551
2570
|
}, {
|
|
2552
|
-
readonly label:
|
|
2553
|
-
readonly locale:
|
|
2571
|
+
readonly label: 'Suomi';
|
|
2572
|
+
readonly locale: 'fi';
|
|
2554
2573
|
}, {
|
|
2555
|
-
readonly label:
|
|
2556
|
-
readonly locale:
|
|
2574
|
+
readonly label: 'Svenska';
|
|
2575
|
+
readonly locale: 'sv';
|
|
2557
2576
|
}, {
|
|
2558
|
-
readonly label:
|
|
2559
|
-
readonly locale:
|
|
2577
|
+
readonly label: 'Tiếng Việt';
|
|
2578
|
+
readonly locale: 'vi';
|
|
2560
2579
|
}, {
|
|
2561
|
-
readonly label:
|
|
2562
|
-
readonly locale:
|
|
2580
|
+
readonly label: 'Türkçe';
|
|
2581
|
+
readonly locale: 'tr';
|
|
2563
2582
|
}, {
|
|
2564
|
-
readonly label:
|
|
2565
|
-
readonly locale:
|
|
2583
|
+
readonly label: 'Ελληνικά';
|
|
2584
|
+
readonly locale: 'el';
|
|
2566
2585
|
}, {
|
|
2567
|
-
readonly label:
|
|
2568
|
-
readonly locale:
|
|
2586
|
+
readonly label: 'Русский';
|
|
2587
|
+
readonly locale: 'ru';
|
|
2569
2588
|
}, {
|
|
2570
|
-
readonly label:
|
|
2571
|
-
readonly locale:
|
|
2589
|
+
readonly label: 'Українська';
|
|
2590
|
+
readonly locale: 'uk';
|
|
2572
2591
|
}, {
|
|
2573
|
-
readonly label:
|
|
2574
|
-
readonly locale:
|
|
2592
|
+
readonly label: 'עברית';
|
|
2593
|
+
readonly locale: 'he';
|
|
2575
2594
|
}, {
|
|
2576
|
-
readonly label:
|
|
2577
|
-
readonly locale:
|
|
2595
|
+
readonly label: 'اردو';
|
|
2596
|
+
readonly locale: 'ur';
|
|
2578
2597
|
}, {
|
|
2579
|
-
readonly label:
|
|
2580
|
-
readonly locale:
|
|
2598
|
+
readonly label: 'عربي';
|
|
2599
|
+
readonly locale: 'ar';
|
|
2581
2600
|
}, {
|
|
2582
|
-
readonly label:
|
|
2583
|
-
readonly locale:
|
|
2601
|
+
readonly label: 'فارسی';
|
|
2602
|
+
readonly locale: 'fa';
|
|
2584
2603
|
}, {
|
|
2585
|
-
readonly label:
|
|
2586
|
-
readonly locale:
|
|
2604
|
+
readonly label: 'नेपाली';
|
|
2605
|
+
readonly locale: 'ne';
|
|
2587
2606
|
}, {
|
|
2588
|
-
readonly label:
|
|
2589
|
-
readonly locale:
|
|
2607
|
+
readonly label: 'मराठी';
|
|
2608
|
+
readonly locale: 'mr';
|
|
2590
2609
|
}, {
|
|
2591
|
-
readonly label:
|
|
2592
|
-
readonly locale:
|
|
2610
|
+
readonly label: 'हिन्दी';
|
|
2611
|
+
readonly locale: 'hi-in';
|
|
2593
2612
|
}, {
|
|
2594
|
-
readonly label:
|
|
2595
|
-
readonly locale:
|
|
2613
|
+
readonly label: 'বাংলা';
|
|
2614
|
+
readonly locale: 'bn';
|
|
2596
2615
|
}, {
|
|
2597
|
-
readonly label:
|
|
2598
|
-
readonly locale:
|
|
2616
|
+
readonly label: 'ਪੰਜਾਬੀ';
|
|
2617
|
+
readonly locale: 'pa';
|
|
2599
2618
|
}, {
|
|
2600
|
-
readonly label:
|
|
2601
|
-
readonly locale:
|
|
2619
|
+
readonly label: 'ગુજરાતી';
|
|
2620
|
+
readonly locale: 'gu-in';
|
|
2602
2621
|
}, {
|
|
2603
|
-
readonly label:
|
|
2604
|
-
readonly locale:
|
|
2622
|
+
readonly label: 'தமிழ்';
|
|
2623
|
+
readonly locale: 'ta';
|
|
2605
2624
|
}, {
|
|
2606
|
-
readonly label:
|
|
2607
|
-
readonly locale:
|
|
2625
|
+
readonly label: 'తెలుగు';
|
|
2626
|
+
readonly locale: 'te';
|
|
2608
2627
|
}, {
|
|
2609
|
-
readonly label:
|
|
2610
|
-
readonly locale:
|
|
2628
|
+
readonly label: 'ಕನ್ನಡ';
|
|
2629
|
+
readonly locale: 'kn';
|
|
2611
2630
|
}, {
|
|
2612
|
-
readonly label:
|
|
2613
|
-
readonly locale:
|
|
2631
|
+
readonly label: 'മലയാളം';
|
|
2632
|
+
readonly locale: 'ml';
|
|
2614
2633
|
}, {
|
|
2615
|
-
readonly label:
|
|
2616
|
-
readonly locale:
|
|
2634
|
+
readonly label: 'ภาษาไทย';
|
|
2635
|
+
readonly locale: 'th';
|
|
2617
2636
|
}, {
|
|
2618
|
-
readonly label:
|
|
2619
|
-
readonly locale:
|
|
2637
|
+
readonly label: 'ភាសាខ្មែរ';
|
|
2638
|
+
readonly locale: 'km-kh';
|
|
2620
2639
|
}, {
|
|
2621
|
-
readonly label:
|
|
2622
|
-
readonly locale:
|
|
2640
|
+
readonly label: '한국어';
|
|
2641
|
+
readonly locale: 'ko-kr';
|
|
2623
2642
|
}, {
|
|
2624
|
-
readonly label:
|
|
2625
|
-
readonly locale:
|
|
2643
|
+
readonly label: '日本語';
|
|
2644
|
+
readonly locale: 'ja';
|
|
2626
2645
|
}, {
|
|
2627
|
-
readonly label:
|
|
2628
|
-
readonly locale:
|
|
2646
|
+
readonly label: '简体中文';
|
|
2647
|
+
readonly locale: 'zh-cn';
|
|
2629
2648
|
}, {
|
|
2630
|
-
readonly label:
|
|
2631
|
-
readonly locale:
|
|
2649
|
+
readonly label: '繁體中文 (台灣)';
|
|
2650
|
+
readonly locale: 'zh-tw';
|
|
2632
2651
|
}];
|
|
2633
2652
|
|
|
2634
2653
|
/**
|
package/dist-cjs/index.js
CHANGED
|
@@ -133,6 +133,7 @@ __export(index_exports, {
|
|
|
133
133
|
isCustomRecordId: () => import_TLCustomRecord.isCustomRecordId,
|
|
134
134
|
isDocument: () => import_TLDocument.isDocument,
|
|
135
135
|
isFontEntry: () => import_TLFontStyle.isFontEntry,
|
|
136
|
+
isPage: () => import_TLPage.isPage,
|
|
136
137
|
isPageId: () => import_TLPage.isPageId,
|
|
137
138
|
isShape: () => import_TLShape.isShape,
|
|
138
139
|
isShapeId: () => import_TLShape.isShapeId,
|
|
@@ -221,7 +222,7 @@ var import_translations = require("./translations/translations");
|
|
|
221
222
|
var import_b64Vecs = require("./misc/b64Vecs");
|
|
222
223
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
223
224
|
"@tldraw/tlschema",
|
|
224
|
-
"5.4.0-next.
|
|
225
|
+
"5.4.0-next.ebc95cf01337",
|
|
225
226
|
"cjs"
|
|
226
227
|
);
|
|
227
228
|
//# sourceMappingURL=index.js.map
|
package/dist-cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @fileoverview\n * Main entry point for the tldraw schema package. Exports the complete type system,\n * data structures, validation, and migrations for tldraw's persisted data.\n *\n * This package provides:\n * - Schema creation utilities (createTLSchema, defaultShapeSchemas, defaultBindingSchemas)\n * - All built-in shape types (TLGeoShape, TLTextShape, TLArrowShape, etc.)\n * - Asset management types and validators (TLImageAsset, TLVideoAsset, TLBookmarkAsset)\n * - Binding system for shape relationships (TLArrowBinding)\n * - Store integration types (TLStore, TLStoreProps, TLStoreSnapshot)\n * - Style properties for consistent styling (DefaultColorStyle, DefaultSizeStyle, etc.)\n * - Validation utilities and type guards\n * - Migration systems for schema evolution\n * - Geometry and utility types\n *\n * @example\n * ```ts\n * import { createTLSchema, defaultShapeSchemas, TLStore } from '@tldraw/tlschema'\n *\n * // Create a schema with default shapes\n * const schema = createTLSchema({\n * shapes: defaultShapeSchemas\n * })\n *\n * // Use with a store\n * const store = new Store({ schema })\n * ```\n *\n * @public\n */\n\nimport { registerTldrawLibraryVersion } from '@tldraw/utils'\nexport { assetIdValidator, createAssetValidator, type TLBaseAsset } from './assets/TLBaseAsset'\nexport {\n\tbookmarkAssetMigrations,\n\tbookmarkAssetProps,\n\ttype TLBookmarkAsset,\n} from './assets/TLBookmarkAsset'\nexport { imageAssetMigrations, imageAssetProps, type TLImageAsset } from './assets/TLImageAsset'\nexport { videoAssetMigrations, videoAssetProps, type TLVideoAsset } from './assets/TLVideoAsset'\nexport {\n\tarrowBindingMigrations,\n\tarrowBindingProps,\n\tarrowBindingVersions,\n\tElbowArrowSnap,\n\ttype TLArrowBinding,\n\ttype TLArrowBindingProps,\n} from './bindings/TLArrowBinding'\nexport {\n\tbindingIdValidator,\n\tcreateBindingValidator,\n\ttype TLBaseBinding,\n} from './bindings/TLBaseBinding'\nexport {\n\tcreatePresenceStateDerivation,\n\tgetDefaultUserPresence,\n\ttype CreatePresenceStateDerivationOpts,\n\ttype TLPresenceStateInfo,\n} from './createPresenceStateDerivation'\nexport {\n\tcreateTLSchema,\n\tdefaultAssetSchemas,\n\tdefaultBindingSchemas,\n\tdefaultShapeSchemas,\n\ttype SchemaPropsInfo,\n\ttype TLSchema,\n\ttype UserSchemaInfo,\n} from './createTLSchema'\nexport {\n\tboxModelValidator,\n\tvecModelValidator,\n\ttype BoxModel,\n\ttype VecModel,\n} from './misc/geometry-types'\nexport { idValidator } from './misc/id-validator'\nexport {\n\tcanvasUiColorTypeValidator,\n\tTL_CANVAS_UI_COLOR_TYPES,\n\ttype TLCanvasUiColor,\n} from './misc/TLColor'\nexport { TL_CURSOR_TYPES, type TLCursor, type TLCursorType } from './misc/TLCursor'\nexport { TL_HANDLE_TYPES, type TLHandle, type TLHandleType } from './misc/TLHandle'\nexport { opacityValidator, type TLOpacityType } from './misc/TLOpacity'\nexport { richTextValidator, toRichText, type TLRichText } from './misc/TLRichText'\nexport { scribbleValidator, TL_SCRIBBLE_STATES, type TLScribble } from './misc/TLScribble'\nexport {\n\tassetMigrations,\n\tAssetRecordType,\n\tcreateAssetPropsMigrationIds,\n\tcreateAssetPropsMigrationSequence,\n\tcreateAssetRecordType,\n\ttype TLAsset,\n\ttype TLAssetId,\n\ttype TLAssetPartial,\n\ttype TLAssetShape,\n\ttype TLDefaultAsset,\n\ttype TLGlobalAssetPropsMap,\n\ttype TLIndexedAssets,\n\ttype TLUnknownAsset,\n} from './records/TLAsset'\nexport {\n\tcreateBindingId,\n\tcreateBindingPropsMigrationIds,\n\tcreateBindingPropsMigrationSequence,\n\tisBinding,\n\tisBindingId,\n\trootBindingMigrations,\n\ttype TLBinding,\n\ttype TLBindingCreate,\n\ttype TLBindingId,\n\ttype TLBindingUpdate,\n\ttype TLDefaultBinding,\n\ttype TLGlobalBindingPropsMap,\n\ttype TLIndexedBindings,\n\ttype TLUnknownBinding,\n} from './records/TLBinding'\nexport { CameraRecordType, type TLCamera, type TLCameraId } from './records/TLCamera'\nexport {\n\tcommentReactionRecordConfig,\n\tcommentRecordConfig,\n\tcommentSchemaRecords,\n\tcommentThreadRecordConfig,\n\tcreateComment,\n\tcreateCommentId,\n\tcreateCommentReaction,\n\tcreateCommentReactionId,\n\tcreateCommentThread,\n\tcreateCommentThreadId,\n\tisCommentId,\n\tisCommentReactionId,\n\tisCommentThreadId,\n\ttype TLComment,\n\ttype TLCommentAnchor,\n\ttype TLCommentId,\n\ttype TLCommentReaction,\n\ttype TLCommentReactionId,\n\ttype TLCommentThread,\n\ttype TLCommentThreadId,\n} from './records/TLComment'\nexport {\n\tcreateCustomRecordId,\n\tcreateCustomRecordMigrationIds,\n\tcreateCustomRecordMigrationSequence,\n\tisCustomRecord,\n\tisCustomRecordId,\n\ttype CustomRecordInfo,\n} from './records/TLCustomRecord'\nexport {\n\tDocumentRecordType,\n\tisDocument,\n\tTLDOCUMENT_ID,\n\ttype TLDocument,\n} from './records/TLDocument'\nexport {\n\tpluckPreservingValues,\n\tTLINSTANCE_ID,\n\ttype TLInstance,\n\ttype TLInstanceId,\n} from './records/TLInstance'\nexport {\n\tisPageId,\n\tpageIdValidator,\n\tPageRecordType,\n\ttype TLPage,\n\ttype TLPageId,\n} from './records/TLPage'\nexport {\n\tInstancePageStateRecordType,\n\ttype TLInstancePageState,\n\ttype TLInstancePageStateId,\n} from './records/TLPageState'\nexport {\n\tPointerRecordType,\n\tTLPOINTER_ID,\n\ttype TLPointer,\n\ttype TLPointerId,\n} from './records/TLPointer'\nexport {\n\tInstancePresenceRecordType,\n\ttype TLInstancePresence,\n\ttype TLInstancePresenceID,\n} from './records/TLPresence'\nexport {\n\ttype TLCustomRecord,\n\ttype TLDefaultRecord,\n\ttype TLGlobalRecordPropsMap,\n\ttype TLIndexedRecords,\n\ttype TLRecord,\n} from './records/TLRecord'\nexport {\n\tcreateShapeId,\n\tcreateShapePropsMigrationIds,\n\tcreateShapePropsMigrationSequence,\n\tgetShapePropKeysByStyle,\n\tisShape,\n\tisShapeId,\n\trootShapeMigrations,\n\ttype ExtractShapeByProps,\n\ttype TLCreateShapePartial,\n\ttype TLDefaultShape,\n\ttype TLGlobalShapePropsMap,\n\ttype TLIndexedShapes,\n\ttype TLParentId,\n\ttype TLShape,\n\ttype TLShapeId,\n\ttype TLShapePartial,\n\ttype TLUnknownShape,\n} from './records/TLShape'\nexport {\n\tcreateUserId,\n\tcreateUserRecordType,\n\tisUserId,\n\tuserIdValidator,\n\tUserRecordType,\n\ttype TLUser,\n\ttype TLUserId,\n} from './records/TLUser'\nexport {\n\ttype RecordProps,\n\ttype RecordPropsType,\n\ttype TLPropsMigration,\n\ttype TLPropsMigrations,\n} from './recordsWithProps'\nexport { type ShapeWithCrop, type TLShapeCrop } from './shapes/ShapeWithCrop'\nexport {\n\tArrowShapeArrowheadEndStyle,\n\tArrowShapeArrowheadStartStyle,\n\tArrowShapeKindStyle,\n\tarrowShapeMigrations,\n\tarrowShapeProps,\n\tarrowShapeVersions,\n\ttype TLArrowShape,\n\ttype TLArrowShapeArrowheadStyle,\n\ttype TLArrowShapeKind,\n\ttype TLArrowShapeProps,\n} from './shapes/TLArrowShape'\nexport {\n\tcreateShapeValidator,\n\tparentIdValidator,\n\tshapeIdValidator,\n\ttype TLBaseShape,\n} from './shapes/TLBaseShape'\nexport {\n\tbookmarkShapeMigrations,\n\tbookmarkShapeProps,\n\ttype TLBookmarkShape,\n\ttype TLBookmarkShapeProps,\n} from './shapes/TLBookmarkShape'\nexport {\n\tcompressLegacySegments,\n\tdrawShapeMigrations,\n\tdrawShapeProps,\n\ttype TLDrawShape,\n\ttype TLDrawShapeProps,\n\ttype TLDrawShapeSegment,\n} from './shapes/TLDrawShape'\nexport {\n\tembedShapeMigrations,\n\tembedShapeProps,\n\ttype TLEmbedShape,\n\ttype TLEmbedShapeProps,\n} from './shapes/TLEmbedShape'\nexport {\n\tframeShapeMigrations,\n\tframeShapeProps,\n\ttype TLFrameShape,\n\ttype TLFrameShapeProps,\n} from './shapes/TLFrameShape'\nexport {\n\tGeoShapeGeoStyle,\n\tgeoShapeMigrations,\n\tgeoShapeProps,\n\ttype TLGeoShape,\n\ttype TLGeoShapeGeoStyle,\n\ttype TLGeoShapeProps,\n} from './shapes/TLGeoShape'\nexport {\n\tgroupShapeMigrations,\n\tgroupShapeProps,\n\ttype TLGroupShape,\n\ttype TLGroupShapeProps,\n} from './shapes/TLGroupShape'\nexport {\n\thighlightShapeMigrations,\n\thighlightShapeProps,\n\ttype TLHighlightShape,\n\ttype TLHighlightShapeProps,\n} from './shapes/TLHighlightShape'\nexport {\n\tImageShapeCrop,\n\timageShapeMigrations,\n\timageShapeProps,\n\ttype TLImageShape,\n\ttype TLImageShapeProps,\n} from './shapes/TLImageShape'\nexport {\n\tlineShapeMigrations,\n\tlineShapeProps,\n\tLineShapeSplineStyle,\n\ttype TLLineShape,\n\ttype TLLineShapePoint,\n\ttype TLLineShapeProps,\n\ttype TLLineShapeSplineStyle,\n} from './shapes/TLLineShape'\nexport {\n\tnoteShapeMigrations,\n\tnoteShapeProps,\n\ttype TLNoteShape,\n\ttype TLNoteShapeProps,\n} from './shapes/TLNoteShape'\nexport {\n\ttextShapeMigrations,\n\ttextShapeProps,\n\ttype TLTextShape,\n\ttype TLTextShapeProps,\n} from './shapes/TLTextShape'\nexport {\n\tvideoShapeMigrations,\n\tvideoShapeProps,\n\ttype TLVideoShape,\n\ttype TLVideoShapeProps,\n} from './shapes/TLVideoShape'\nexport { EnumStyleProp, StyleProp, type StylePropValue } from './styles/StyleProp'\nexport {\n\tDefaultColorStyle,\n\tregisterColorsFromThemes,\n\ttype TLDefaultColorStyle,\n} from './styles/TLColorStyle'\nexport { DefaultDashStyle, type TLDefaultDashStyle } from './styles/TLDashStyle'\nexport { DefaultFillStyle, type TLDefaultFillStyle } from './styles/TLFillStyle'\nexport { type TLFontFace, type TLFontFaceSource } from './styles/TLFontFace'\nexport {\n\tDefaultFontFamilies,\n\tDefaultFontStyle,\n\tisFontEntry,\n\tregisterFontsFromThemes,\n\ttype TLDefaultFontStyle,\n} from './styles/TLFontStyle'\nexport {\n\tDefaultHorizontalAlignStyle,\n\ttype TLDefaultHorizontalAlignStyle,\n} from './styles/TLHorizontalAlignStyle'\nexport { DefaultSizeStyle, type TLDefaultSizeStyle } from './styles/TLSizeStyle'\nexport { DefaultTextAlignStyle, type TLDefaultTextAlignStyle } from './styles/TLTextAlignStyle'\nexport {\n\ttype TLDefaultColor,\n\ttype TLRemovedDefaultThemeColors,\n\ttype TLTheme,\n\ttype TLThemeColors,\n\ttype TLThemeDefaultColors,\n\ttype TLThemeFont,\n\ttype TLThemeFonts,\n\ttype TLThemeId,\n\ttype TLThemes,\n\ttype TLThemeUiColorKeys,\n} from './styles/TLTheme'\nexport {\n\tDefaultVerticalAlignStyle,\n\ttype TLDefaultVerticalAlignStyle,\n} from './styles/TLVerticalAlignStyle'\nexport {\n\tcreateCachedUserResolve,\n\ttype TLAssetContext,\n\ttype TLAssetStore,\n\ttype TLSerializedStore,\n\ttype TLStore,\n\ttype TLStoreProps,\n\ttype TLStoreSchema,\n\ttype TLStoreSnapshot,\n\ttype TLUserStore,\n} from './TLStore'\nexport {\n\tgetDefaultTranslationLocale,\n\tLANGUAGES,\n\ttype TLLanguage,\n} from './translations/translations'\nexport { type SetValue } from './util-types'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n\nexport { DIM_2D, DIM_3D, b64Vecs } from './misc/b64Vecs'\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgCA,mBAA6C;AAC7C,yBAAyE;AACzE,6BAIO;AACP,0BAAyE;AACzE,0BAAyE;AACzE,4BAOO;AACP,2BAIO;AACP,2CAKO;AACP,4BAQO;AACP,4BAKO;AACP,0BAA4B;AAC5B,qBAIO;AACP,sBAAkE;AAClE,sBAAkE;AAClE,uBAAqD;AACrD,wBAA+D;AAC/D,wBAAuE;AACvE,qBAcO;AACP,uBAeO;AACP,sBAAiE;AACjE,uBAqBO;AACP,4BAOO;AACP,wBAKO;AACP,wBAKO;AACP,
|
|
4
|
+
"sourcesContent": ["/**\n * @fileoverview\n * Main entry point for the tldraw schema package. Exports the complete type system,\n * data structures, validation, and migrations for tldraw's persisted data.\n *\n * This package provides:\n * - Schema creation utilities (createTLSchema, defaultShapeSchemas, defaultBindingSchemas)\n * - All built-in shape types (TLGeoShape, TLTextShape, TLArrowShape, etc.)\n * - Asset management types and validators (TLImageAsset, TLVideoAsset, TLBookmarkAsset)\n * - Binding system for shape relationships (TLArrowBinding)\n * - Store integration types (TLStore, TLStoreProps, TLStoreSnapshot)\n * - Style properties for consistent styling (DefaultColorStyle, DefaultSizeStyle, etc.)\n * - Validation utilities and type guards\n * - Migration systems for schema evolution\n * - Geometry and utility types\n *\n * @example\n * ```ts\n * import { createTLSchema, defaultShapeSchemas, TLStore } from '@tldraw/tlschema'\n *\n * // Create a schema with default shapes\n * const schema = createTLSchema({\n * shapes: defaultShapeSchemas\n * })\n *\n * // Use with a store\n * const store = new Store({ schema })\n * ```\n *\n * @public\n */\n\nimport { registerTldrawLibraryVersion } from '@tldraw/utils'\nexport { assetIdValidator, createAssetValidator, type TLBaseAsset } from './assets/TLBaseAsset'\nexport {\n\tbookmarkAssetMigrations,\n\tbookmarkAssetProps,\n\ttype TLBookmarkAsset,\n} from './assets/TLBookmarkAsset'\nexport { imageAssetMigrations, imageAssetProps, type TLImageAsset } from './assets/TLImageAsset'\nexport { videoAssetMigrations, videoAssetProps, type TLVideoAsset } from './assets/TLVideoAsset'\nexport {\n\tarrowBindingMigrations,\n\tarrowBindingProps,\n\tarrowBindingVersions,\n\tElbowArrowSnap,\n\ttype TLArrowBinding,\n\ttype TLArrowBindingProps,\n} from './bindings/TLArrowBinding'\nexport {\n\tbindingIdValidator,\n\tcreateBindingValidator,\n\ttype TLBaseBinding,\n} from './bindings/TLBaseBinding'\nexport {\n\tcreatePresenceStateDerivation,\n\tgetDefaultUserPresence,\n\ttype CreatePresenceStateDerivationOpts,\n\ttype TLPresenceStateInfo,\n} from './createPresenceStateDerivation'\nexport {\n\tcreateTLSchema,\n\tdefaultAssetSchemas,\n\tdefaultBindingSchemas,\n\tdefaultShapeSchemas,\n\ttype SchemaPropsInfo,\n\ttype TLSchema,\n\ttype UserSchemaInfo,\n} from './createTLSchema'\nexport {\n\tboxModelValidator,\n\tvecModelValidator,\n\ttype BoxModel,\n\ttype VecModel,\n} from './misc/geometry-types'\nexport { idValidator } from './misc/id-validator'\nexport {\n\tcanvasUiColorTypeValidator,\n\tTL_CANVAS_UI_COLOR_TYPES,\n\ttype TLCanvasUiColor,\n} from './misc/TLColor'\nexport { TL_CURSOR_TYPES, type TLCursor, type TLCursorType } from './misc/TLCursor'\nexport { TL_HANDLE_TYPES, type TLHandle, type TLHandleType } from './misc/TLHandle'\nexport { opacityValidator, type TLOpacityType } from './misc/TLOpacity'\nexport { richTextValidator, toRichText, type TLRichText } from './misc/TLRichText'\nexport { scribbleValidator, TL_SCRIBBLE_STATES, type TLScribble } from './misc/TLScribble'\nexport {\n\tassetMigrations,\n\tAssetRecordType,\n\tcreateAssetPropsMigrationIds,\n\tcreateAssetPropsMigrationSequence,\n\tcreateAssetRecordType,\n\ttype TLAsset,\n\ttype TLAssetId,\n\ttype TLAssetPartial,\n\ttype TLAssetShape,\n\ttype TLDefaultAsset,\n\ttype TLGlobalAssetPropsMap,\n\ttype TLIndexedAssets,\n\ttype TLUnknownAsset,\n} from './records/TLAsset'\nexport {\n\tcreateBindingId,\n\tcreateBindingPropsMigrationIds,\n\tcreateBindingPropsMigrationSequence,\n\tisBinding,\n\tisBindingId,\n\trootBindingMigrations,\n\ttype TLBinding,\n\ttype TLBindingCreate,\n\ttype TLBindingId,\n\ttype TLBindingUpdate,\n\ttype TLDefaultBinding,\n\ttype TLGlobalBindingPropsMap,\n\ttype TLIndexedBindings,\n\ttype TLUnknownBinding,\n} from './records/TLBinding'\nexport { CameraRecordType, type TLCamera, type TLCameraId } from './records/TLCamera'\nexport {\n\tcommentReactionRecordConfig,\n\tcommentRecordConfig,\n\tcommentSchemaRecords,\n\tcommentThreadRecordConfig,\n\tcreateComment,\n\tcreateCommentId,\n\tcreateCommentReaction,\n\tcreateCommentReactionId,\n\tcreateCommentThread,\n\tcreateCommentThreadId,\n\tisCommentId,\n\tisCommentReactionId,\n\tisCommentThreadId,\n\ttype TLComment,\n\ttype TLCommentAnchor,\n\ttype TLCommentId,\n\ttype TLCommentReaction,\n\ttype TLCommentReactionId,\n\ttype TLCommentThread,\n\ttype TLCommentThreadId,\n} from './records/TLComment'\nexport {\n\tcreateCustomRecordId,\n\tcreateCustomRecordMigrationIds,\n\tcreateCustomRecordMigrationSequence,\n\tisCustomRecord,\n\tisCustomRecordId,\n\ttype CustomRecordInfo,\n} from './records/TLCustomRecord'\nexport {\n\tDocumentRecordType,\n\tisDocument,\n\tTLDOCUMENT_ID,\n\ttype TLDocument,\n} from './records/TLDocument'\nexport {\n\tpluckPreservingValues,\n\tTLINSTANCE_ID,\n\ttype TLInstance,\n\ttype TLInstanceId,\n} from './records/TLInstance'\nexport {\n\tisPage,\n\tisPageId,\n\tpageIdValidator,\n\tPageRecordType,\n\ttype TLPage,\n\ttype TLPageId,\n} from './records/TLPage'\nexport {\n\tInstancePageStateRecordType,\n\ttype TLInstancePageState,\n\ttype TLInstancePageStateId,\n} from './records/TLPageState'\nexport {\n\tPointerRecordType,\n\tTLPOINTER_ID,\n\ttype TLPointer,\n\ttype TLPointerId,\n} from './records/TLPointer'\nexport {\n\tInstancePresenceRecordType,\n\ttype TLInstancePresence,\n\ttype TLInstancePresenceID,\n} from './records/TLPresence'\nexport {\n\ttype TLCustomRecord,\n\ttype TLDefaultRecord,\n\ttype TLGlobalRecordPropsMap,\n\ttype TLIndexedRecords,\n\ttype TLRecord,\n} from './records/TLRecord'\nexport {\n\tcreateShapeId,\n\tcreateShapePropsMigrationIds,\n\tcreateShapePropsMigrationSequence,\n\tgetShapePropKeysByStyle,\n\tisShape,\n\tisShapeId,\n\trootShapeMigrations,\n\ttype ExtractShapeByProps,\n\ttype TLCreateShapePartial,\n\ttype TLDefaultShape,\n\ttype TLGlobalShapePropsMap,\n\ttype TLIndexedShapes,\n\ttype TLParentId,\n\ttype TLShape,\n\ttype TLShapeId,\n\ttype TLShapePartial,\n\ttype TLUnknownShape,\n} from './records/TLShape'\nexport {\n\tcreateUserId,\n\tcreateUserRecordType,\n\tisUserId,\n\tuserIdValidator,\n\tUserRecordType,\n\ttype TLUser,\n\ttype TLUserId,\n} from './records/TLUser'\nexport {\n\ttype RecordProps,\n\ttype RecordPropsType,\n\ttype TLPropsMigration,\n\ttype TLPropsMigrations,\n} from './recordsWithProps'\nexport { type ShapeWithCrop, type TLShapeCrop } from './shapes/ShapeWithCrop'\nexport {\n\tArrowShapeArrowheadEndStyle,\n\tArrowShapeArrowheadStartStyle,\n\tArrowShapeKindStyle,\n\tarrowShapeMigrations,\n\tarrowShapeProps,\n\tarrowShapeVersions,\n\ttype TLArrowShape,\n\ttype TLArrowShapeArrowheadStyle,\n\ttype TLArrowShapeKind,\n\ttype TLArrowShapeProps,\n} from './shapes/TLArrowShape'\nexport {\n\tcreateShapeValidator,\n\tparentIdValidator,\n\tshapeIdValidator,\n\ttype TLBaseShape,\n} from './shapes/TLBaseShape'\nexport {\n\tbookmarkShapeMigrations,\n\tbookmarkShapeProps,\n\ttype TLBookmarkShape,\n\ttype TLBookmarkShapeProps,\n} from './shapes/TLBookmarkShape'\nexport {\n\tcompressLegacySegments,\n\tdrawShapeMigrations,\n\tdrawShapeProps,\n\ttype TLDrawShape,\n\ttype TLDrawShapeProps,\n\ttype TLDrawShapeSegment,\n} from './shapes/TLDrawShape'\nexport {\n\tembedShapeMigrations,\n\tembedShapeProps,\n\ttype TLEmbedShape,\n\ttype TLEmbedShapeProps,\n} from './shapes/TLEmbedShape'\nexport {\n\tframeShapeMigrations,\n\tframeShapeProps,\n\ttype TLFrameShape,\n\ttype TLFrameShapeProps,\n} from './shapes/TLFrameShape'\nexport {\n\tGeoShapeGeoStyle,\n\tgeoShapeMigrations,\n\tgeoShapeProps,\n\ttype TLGeoShape,\n\ttype TLGeoShapeGeoStyle,\n\ttype TLGeoShapeProps,\n} from './shapes/TLGeoShape'\nexport {\n\tgroupShapeMigrations,\n\tgroupShapeProps,\n\ttype TLGroupShape,\n\ttype TLGroupShapeProps,\n} from './shapes/TLGroupShape'\nexport {\n\thighlightShapeMigrations,\n\thighlightShapeProps,\n\ttype TLHighlightShape,\n\ttype TLHighlightShapeProps,\n} from './shapes/TLHighlightShape'\nexport {\n\tImageShapeCrop,\n\timageShapeMigrations,\n\timageShapeProps,\n\ttype TLImageShape,\n\ttype TLImageShapeProps,\n} from './shapes/TLImageShape'\nexport {\n\tlineShapeMigrations,\n\tlineShapeProps,\n\tLineShapeSplineStyle,\n\ttype TLLineShape,\n\ttype TLLineShapePoint,\n\ttype TLLineShapeProps,\n\ttype TLLineShapeSplineStyle,\n} from './shapes/TLLineShape'\nexport {\n\tnoteShapeMigrations,\n\tnoteShapeProps,\n\ttype TLNoteShape,\n\ttype TLNoteShapeProps,\n} from './shapes/TLNoteShape'\nexport {\n\ttextShapeMigrations,\n\ttextShapeProps,\n\ttype TLTextShape,\n\ttype TLTextShapeProps,\n} from './shapes/TLTextShape'\nexport {\n\tvideoShapeMigrations,\n\tvideoShapeProps,\n\ttype TLVideoShape,\n\ttype TLVideoShapeProps,\n} from './shapes/TLVideoShape'\nexport { EnumStyleProp, StyleProp, type StylePropValue } from './styles/StyleProp'\nexport {\n\tDefaultColorStyle,\n\tregisterColorsFromThemes,\n\ttype TLDefaultColorStyle,\n} from './styles/TLColorStyle'\nexport { DefaultDashStyle, type TLDefaultDashStyle } from './styles/TLDashStyle'\nexport { DefaultFillStyle, type TLDefaultFillStyle } from './styles/TLFillStyle'\nexport { type TLFontFace, type TLFontFaceSource } from './styles/TLFontFace'\nexport {\n\tDefaultFontFamilies,\n\tDefaultFontStyle,\n\tisFontEntry,\n\tregisterFontsFromThemes,\n\ttype TLDefaultFontStyle,\n} from './styles/TLFontStyle'\nexport {\n\tDefaultHorizontalAlignStyle,\n\ttype TLDefaultHorizontalAlignStyle,\n} from './styles/TLHorizontalAlignStyle'\nexport { DefaultSizeStyle, type TLDefaultSizeStyle } from './styles/TLSizeStyle'\nexport { DefaultTextAlignStyle, type TLDefaultTextAlignStyle } from './styles/TLTextAlignStyle'\nexport {\n\ttype TLDefaultColor,\n\ttype TLRemovedDefaultThemeColors,\n\ttype TLTheme,\n\ttype TLThemeColors,\n\ttype TLThemeDefaultColors,\n\ttype TLThemeFont,\n\ttype TLThemeFonts,\n\ttype TLThemeId,\n\ttype TLThemes,\n\ttype TLThemeUiColorKeys,\n} from './styles/TLTheme'\nexport {\n\tDefaultVerticalAlignStyle,\n\ttype TLDefaultVerticalAlignStyle,\n} from './styles/TLVerticalAlignStyle'\nexport {\n\tcreateCachedUserResolve,\n\ttype TLAssetContext,\n\ttype TLAssetStore,\n\ttype TLSerializedStore,\n\ttype TLStore,\n\ttype TLStoreProps,\n\ttype TLStoreSchema,\n\ttype TLStoreSnapshot,\n\ttype TLUserStore,\n} from './TLStore'\nexport {\n\tgetDefaultTranslationLocale,\n\tLANGUAGES,\n\ttype TLLanguage,\n} from './translations/translations'\nexport { type SetValue } from './util-types'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n\nexport { DIM_2D, DIM_3D, b64Vecs } from './misc/b64Vecs'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/misc/b64Vecs.ts"],
|
|
4
|
-
"sourcesContent": ["import { VecModel } from './geometry-types'\n\n// Each point = 3 Float16s = 6 bytes = 8 base64 chars (legacy format)\nconst _POINT_B64_LENGTH = 8\n\n// First point in delta encoding = 3 Float32s = 12 bytes = 16 base64 chars\nconst FIRST_POINT_B64_LENGTH = 16\n\n// First point in 2D delta encoding = 2 Float32s = 8 bytes = 12 base64 chars (incl. padding)\nconst FIRST_POINT_2D_B64_LENGTH = 12\n\n// Pressure value supplied when decoding non-pressure (2D) paths\nconst DEFAULT_PRESSURE = 0.5\n\n/** Draw segment path encoded with 2 dimensions, XY \u2014 the constant pressure Z is dropped. @public */\nexport const DIM_2D = 2\n/** Draw segment path encoded with 3 dimensions, XYZ. @public */\nexport const DIM_3D = 3\n\n// O(1) lookup table for base64 decoding (maps char code -> 6-bit value)\nconst BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nconst B64_LOOKUP = new Uint8Array(128)\nfor (let i = 0; i < 64; i++) {\n\tB64_LOOKUP[BASE64_CHARS.charCodeAt(i)] = i\n}\n\n// Mask for one base64 sextet: the low 6 bits select an index into BASE64_CHARS (0\u201363).\nconst SIX_BIT_MASK = 0x3f\n// '=' padding character, appended on encode so the output length is a multiple of 4.\nconst PADDING_CHAR_CODE = '='.charCodeAt(0)\n\n// Precomputed powers of 2 for Float16 exponents (exp - 15, so indices 0-30 map to 2^-15 to 2^15)\nconst POW2 = new Float64Array(31)\nfor (let i = 0; i < 31; i++) {\n\tPOW2[i] = Math.pow(2, i - 15)\n}\nconst POW2_SUBNORMAL = Math.pow(2, -14) / 1024 // For subnormal numbers\n\n// Precomputed mantissa values: 1 + frac/1024 for all 1024 possible frac values\n// Avoids division in hot path\nconst MANTISSA = new Float64Array(1024)\nfor (let i = 0; i < 1024; i++) {\n\tMANTISSA[i] = 1 + i / 1024\n}\n\ndeclare global {\n\tinterface Uint8Array {\n\t\ttoBase64?(): string\n\t}\n\tinterface Uint8ArrayConstructor {\n\t\tfromBase64?(base64: string): Uint8Array\n\t}\n}\n\nfunction nativeGetFloat16(dataView: DataView, offset: number): number {\n\treturn (dataView as any).getFloat16(offset, true)\n}\nfunction fallbackGetFloat16(dataView: DataView, offset: number): number {\n\treturn float16BitsToNumber(dataView.getUint16(offset, true))\n}\n\nconst getFloat16 =\n\ttypeof (DataView.prototype as any).getFloat16 === 'function'\n\t\t? nativeGetFloat16\n\t\t: fallbackGetFloat16\n\nfunction nativeSetFloat16(dataView: DataView, offset: number, value: number): void {\n\t;(dataView as any).setFloat16(offset, value, true)\n}\nfunction fallbackSetFloat16(dataView: DataView, offset: number, value: number): void {\n\tdataView.setUint16(offset, numberToFloat16Bits(value), true)\n}\n\nconst setFloat16 =\n\ttypeof (DataView.prototype as any).setFloat16 === 'function'\n\t\t? nativeSetFloat16\n\t\t: fallbackSetFloat16\n\nfunction nativeBase64ToUint8Array(base64: string): Uint8Array {\n\treturn Uint8Array.fromBase64!(base64)\n}\n\n/** @internal */\nexport function fallbackBase64ToUint8Array(base64: string): Uint8Array {\n\t// Strip up to 2 '=' padding characters to determine the real byte count.\n\t// The 2D point layout (8 + 4(n-1) bytes) is not a multiple of 3, so encoded\n\t// paths can carry padding the original multiple-of-3-only decoder couldn't read.\n\tconst paddedLength = base64.length\n\tlet padding = 0\n\tif (paddedLength > 0 && base64.charCodeAt(paddedLength - 1) === PADDING_CHAR_CODE) {\n\t\tpadding++\n\t\tif (paddedLength > 1 && base64.charCodeAt(paddedLength - 2) === PADDING_CHAR_CODE) {\n\t\t\tpadding++\n\t\t}\n\t}\n\tconst numBytes = Math.floor((paddedLength * 3) / 4) - padding\n\tconst bytes = new Uint8Array(numBytes)\n\tlet byteIndex = 0\n\n\t// The reverse of encoding: each 4 chars are 4 six-bit values that pack back into\n\t// one 24-bit number, which we then read out as 3 bytes (& 255 keeps one byte).\n\tconst fullGroups = Math.floor((paddedLength - padding) / 4) * 4\n\tfor (let i = 0; i < fullGroups; i += 4) {\n\t\tconst c0 = B64_LOOKUP[base64.charCodeAt(i)]\n\t\tconst c1 = B64_LOOKUP[base64.charCodeAt(i + 1)]\n\t\tconst c2 = B64_LOOKUP[base64.charCodeAt(i + 2)]\n\t\tconst c3 = B64_LOOKUP[base64.charCodeAt(i + 3)]\n\n\t\tconst bitmap = (c0 << 18) | (c1 << 12) | (c2 << 6) | c3\n\n\t\tbytes[byteIndex++] = (bitmap >> 16) & 255 // top byte (bits 23\u201316)\n\t\tbytes[byteIndex++] = (bitmap >> 8) & 255 // middle byte (bits 15\u20138)\n\t\tbytes[byteIndex++] = bitmap & 255 // bottom byte (bits 7\u20130)\n\t}\n\n\t// Final group when padded: 3 valid chars -> 2 bytes, 2 valid chars -> 1 byte.\n\tif (padding === 1) {\n\t\tconst c0 = B64_LOOKUP[base64.charCodeAt(fullGroups)]\n\t\tconst c1 = B64_LOOKUP[base64.charCodeAt(fullGroups + 1)]\n\t\tconst c2 = B64_LOOKUP[base64.charCodeAt(fullGroups + 2)]\n\t\tconst bitmap = (c0 << 18) | (c1 << 12) | (c2 << 6)\n\t\tbytes[byteIndex++] = (bitmap >> 16) & 255\n\t\tbytes[byteIndex++] = (bitmap >> 8) & 255\n\t} else if (padding === 2) {\n\t\tconst c0 = B64_LOOKUP[base64.charCodeAt(fullGroups)]\n\t\tconst c1 = B64_LOOKUP[base64.charCodeAt(fullGroups + 1)]\n\t\tconst bitmap = (c0 << 18) | (c1 << 12)\n\t\tbytes[byteIndex++] = (bitmap >> 16) & 255\n\t}\n\n\treturn bytes\n}\n\nfunction nativeUint8ArrayToBase64(uint8Array: Uint8Array): string {\n\treturn uint8Array.toBase64!()\n}\n\n/** @internal */\nexport function fallbackUint8ArrayToBase64(uint8Array: Uint8Array): string {\n\tconst len = uint8Array.length\n\tconst fullGroups = Math.floor(len / 3) * 3\n\tlet result = ''\n\n\t// base64 represents 3 bytes (24 bits) as 4 characters of 6 bits each. For each\n\t// group of 3 bytes we pack them into one 24-bit number, then read it back out as\n\t// four 6-bit slices and use each slice (a value 0\u201363) to index into the 64-char\n\t// alphabet. `>> n` shifts the wanted slice down to the bottom; SIX_BIT_MASK then\n\t// discards everything above those 6 bits.\n\tfor (let i = 0; i < fullGroups; i += 3) {\n\t\tconst byte1 = uint8Array[i]\n\t\tconst byte2 = uint8Array[i + 1]\n\t\tconst byte3 = uint8Array[i + 2]\n\n\t\tconst bitmap = (byte1 << 16) | (byte2 << 8) | byte3\n\t\tresult +=\n\t\t\tBASE64_CHARS[(bitmap >> 18) & SIX_BIT_MASK] + // bits 23\u201318 (top sextet)\n\t\t\tBASE64_CHARS[(bitmap >> 12) & SIX_BIT_MASK] + // bits 17\u201312\n\t\t\tBASE64_CHARS[(bitmap >> 6) & SIX_BIT_MASK] + // bits 11\u20136\n\t\t\tBASE64_CHARS[bitmap & SIX_BIT_MASK] // bits 5\u20130 (bottom sextet)\n\t}\n\n\t// A trailing 1 or 2 bytes can't fill a whole 4-char group, so we emit only the\n\t// chars their bits cover and pad the rest with '=' to keep the length a multiple\n\t// of 4. Standard base64 \u2014 matches the native API and Node's Buffer, so a path\n\t// encoded by the fallback round-trips on a runtime that decodes with the native one.\n\tconst remaining = len - fullGroups\n\tif (remaining === 1) {\n\t\t// 8 bits \u2192 2 sextets (the 2nd only partly filled), then \"==\"\n\t\tconst bitmap = uint8Array[fullGroups] << 16\n\t\tresult +=\n\t\t\tBASE64_CHARS[(bitmap >> 18) & SIX_BIT_MASK] +\n\t\t\tBASE64_CHARS[(bitmap >> 12) & SIX_BIT_MASK] +\n\t\t\t'=='\n\t} else if (remaining === 2) {\n\t\t// 16 bits \u2192 3 sextets (the 3rd only partly filled), then \"=\"\n\t\tconst bitmap = (uint8Array[fullGroups] << 16) | (uint8Array[fullGroups + 1] << 8)\n\t\tresult +=\n\t\t\tBASE64_CHARS[(bitmap >> 18) & SIX_BIT_MASK] +\n\t\t\tBASE64_CHARS[(bitmap >> 12) & SIX_BIT_MASK] +\n\t\t\tBASE64_CHARS[(bitmap >> 6) & SIX_BIT_MASK] +\n\t\t\t'='\n\t}\n\n\treturn result\n}\n\n/**\n * Convert a Uint8Array to base64.\n * Processes bytes in groups of 3 to produce 4 base64 characters.\n *\n * @internal\n */\nconst uint8ArrayToBase64 =\n\ttypeof Uint8Array.prototype.toBase64 === 'function'\n\t\t? nativeUint8ArrayToBase64\n\t\t: fallbackUint8ArrayToBase64\n\n/**\n * Convert a base64 string to Uint8Array.\n *\n * @internal\n */\nconst base64ToUint8Array =\n\ttypeof Uint8Array.fromBase64 === 'function'\n\t\t? nativeBase64ToUint8Array\n\t\t: fallbackBase64ToUint8Array\n\n/**\n * Convert Float16 bits to a number using optimized lookup tables.\n * Handles normal numbers, subnormal numbers, zero, infinity, and NaN.\n *\n * @param bits - The 16-bit Float16 value to decode\n * @returns The decoded number value\n * @internal\n */\nexport function float16BitsToNumber(bits: number): number {\n\tconst sign = bits >> 15\n\tconst exp = (bits >> 10) & 0x1f\n\tconst frac = bits & 0x3ff\n\n\tif (exp === 0) {\n\t\t// Subnormal or zero - rare case\n\t\treturn sign ? -frac * POW2_SUBNORMAL : frac * POW2_SUBNORMAL\n\t}\n\tif (exp === 31) {\n\t\t// Infinity or NaN - very rare\n\t\treturn frac ? NaN : sign ? -Infinity : Infinity\n\t}\n\t// Normal case - two table lookups, one multiply, no division\n\tconst magnitude = POW2[exp] * MANTISSA[frac]\n\treturn sign ? -magnitude : magnitude\n}\n\n/**\n * Convert a number to Float16 bits.\n * Handles normal numbers, subnormal numbers, zero, infinity, and NaN.\n *\n * @param value - The number to encode as Float16\n * @returns The 16-bit Float16 representation of the number\n * @internal\n */\nexport function numberToFloat16Bits(value: number): number {\n\tif (value === 0) return Object.is(value, -0) ? 0x8000 : 0\n\tif (!Number.isFinite(value)) {\n\t\tif (Number.isNaN(value)) return 0x7e00\n\t\treturn value > 0 ? 0x7c00 : 0xfc00\n\t}\n\n\tconst sign = value < 0 ? 1 : 0\n\tvalue = Math.abs(value)\n\n\t// Find exponent and mantissa\n\tconst exp = Math.floor(Math.log2(value))\n\tlet expBiased = exp + 15\n\n\tif (expBiased >= 31) {\n\t\t// Overflow to infinity\n\t\treturn (sign << 15) | 0x7c00\n\t}\n\tif (expBiased <= 0) {\n\t\t// Subnormal or underflow\n\t\tconst frac = Math.round(value * Math.pow(2, 14) * 1024)\n\t\treturn (sign << 15) | (frac & 0x3ff)\n\t}\n\n\t// Normal number\n\tconst mantissa = value / Math.pow(2, exp) - 1\n\tlet frac = Math.round(mantissa * 1024)\n\n\t// Handle rounding overflow: if frac rounds to 1024, increment exponent\n\tif (frac >= 1024) {\n\t\tfrac = 0\n\t\texpBiased++\n\t\tif (expBiased >= 31) {\n\t\t\t// Overflow to infinity\n\t\t\treturn (sign << 15) | 0x7c00\n\t\t}\n\t}\n\n\treturn (sign << 15) | (expBiased << 10) | frac\n}\n\n/**\n * Utilities for encoding and decoding points using base64 and Float16 encoding.\n * Provides functions for converting between VecModel arrays and compact base64 strings,\n * as well as individual point encoding/decoding operations.\n *\n * @public\n */\nexport class b64Vecs {\n\t/**\n\t * Encode a single point (x, y, z) to 8 base64 characters using legacy Float16 encoding.\n\t * Each coordinate is encoded as a Float16 value, resulting in 6 bytes total.\n\t *\n\t * @param x - The x coordinate\n\t * @param y - The y coordinate\n\t * @param z - The z coordinate\n\t * @returns An 8-character base64 string representing the point\n\t * @internal\n\t */\n\tstatic _legacyEncodePoint(x: number, y: number, z: number): string {\n\t\tconst buffer = new Uint8Array(6)\n\t\tconst dataView = new DataView(buffer.buffer)\n\n\t\tsetFloat16(dataView, 0, x)\n\t\tsetFloat16(dataView, 2, y)\n\t\tsetFloat16(dataView, 4, z)\n\n\t\treturn uint8ArrayToBase64(buffer)\n\t}\n\n\t/**\n\t * Convert an array of VecModels to a base64 string using legacy Float16 encoding.\n\t * Uses Float16 encoding for each coordinate (x, y, z). If a point's z value is\n\t * undefined, it defaults to 0.5.\n\t *\n\t * @param points - An array of VecModel objects to encode\n\t * @returns A base64-encoded string containing all points\n\t * @internal Used only for migrations from legacy format\n\t */\n\tstatic _legacyEncodePoints(points: VecModel[]): string {\n\t\tif (points.length === 0) return ''\n\n\t\t// 3 Float16s per point = 6 bytes per point\n\t\tconst buffer = new Uint8Array(points.length * 6)\n\t\tconst dataView = new DataView(buffer.buffer)\n\n\t\tfor (let i = 0; i < points.length; i++) {\n\t\t\tconst p = points[i]\n\t\t\tconst offset = i * 6\n\t\t\tsetFloat16(dataView, offset, p.x)\n\t\t\tsetFloat16(dataView, offset + 2, p.y)\n\t\t\tsetFloat16(dataView, offset + 4, p.z ?? 0.5)\n\t\t}\n\n\t\treturn uint8ArrayToBase64(buffer)\n\t}\n\n\t/**\n\t * Convert a legacy base64 string back to an array of VecModels.\n\t * Decodes Float16-encoded coordinates (x, y, z) from the base64 string.\n\t *\n\t * @param base64 - The base64-encoded string containing point data\n\t * @returns An array of VecModel objects decoded from the string\n\t * @internal Used only for migrations from legacy format\n\t */\n\tstatic _legacyDecodePoints(base64: string): VecModel[] {\n\t\tconst bytes = base64ToUint8Array(base64)\n\t\tconst dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n\t\tconst result: VecModel[] = []\n\t\tfor (let offset = 0; offset < bytes.length; offset += 6) {\n\t\t\tresult.push({\n\t\t\t\tx: getFloat16(dataView, offset),\n\t\t\t\ty: getFloat16(dataView, offset + 2),\n\t\t\t\tz: getFloat16(dataView, offset + 4),\n\t\t\t})\n\t\t}\n\t\treturn result\n\t}\n\n\t/**\n\t * Encode an array of VecModels using delta encoding for improved precision.\n\t * The first point is stored as Float32 (high precision for absolute position),\n\t * subsequent points are stored as Float16 deltas from the previous point.\n\t * This provides full precision for the starting position and excellent precision\n\t * for deltas between consecutive points (which are typically small values).\n\t *\n\t * Format:\n\t * - First point: 3 Float32 values = 12 bytes = 16 base64 chars\n\t * - Delta points: 3 Float16 values each = 6 bytes = 8 base64 chars each\n\t *\n\t * @param points - An array of VecModel objects to encode\n\t * @param dim - Encoding dimension; `2` routes through the 2D variant (drops z), `3` (default) keeps x, y, z\n\t * @returns A base64-encoded string containing delta-encoded points\n\t * @public\n\t */\n\tstatic encodePoints(points: VecModel[], dim?: 2 | 3): string {\n\t\tif (dim === DIM_2D) return b64Vecs.encodePoints2D(points)\n\t\tif (points.length === 0) return ''\n\n\t\t// First point: 3 Float32s = 12 bytes\n\t\t// Remaining points: 3 Float16s each = 6 bytes each\n\t\tconst firstPointBytes = 12\n\t\tconst deltaBytes = (points.length - 1) * 6\n\t\tconst totalBytes = firstPointBytes + deltaBytes\n\n\t\tconst buffer = new Uint8Array(totalBytes)\n\t\tconst dataView = new DataView(buffer.buffer)\n\n\t\t// First point is stored as Float32 for full precision\n\t\tconst first = points[0]\n\t\tdataView.setFloat32(0, first.x, true) // little-endian\n\t\tdataView.setFloat32(4, first.y, true)\n\t\tdataView.setFloat32(8, first.z ?? 0.5, true)\n\n\t\t// Subsequent points are Float16 deltas from the previous point\n\t\tlet prevX = first.x\n\t\tlet prevY = first.y\n\t\tlet prevZ = first.z ?? 0.5\n\n\t\tfor (let i = 1; i < points.length; i++) {\n\t\t\tconst p = points[i]\n\t\t\tconst z = p.z ?? 0.5\n\n\t\t\tconst offset = firstPointBytes + (i - 1) * 6\n\t\t\tsetFloat16(dataView, offset, p.x - prevX)\n\t\t\tsetFloat16(dataView, offset + 2, p.y - prevY)\n\t\t\tsetFloat16(dataView, offset + 4, z - prevZ)\n\n\t\t\tprevX = p.x\n\t\t\tprevY = p.y\n\t\t\tprevZ = z\n\t\t}\n\n\t\treturn uint8ArrayToBase64(buffer)\n\t}\n\n\t/**\n\t * Decode a delta-encoded base64 string back to an array of absolute VecModels.\n\t * The first point is stored as Float32 (high precision), subsequent points are\n\t * Float16 deltas that are accumulated to reconstruct absolute positions.\n\t *\n\t * @param base64 - The base64-encoded string containing delta-encoded point data\n\t * @param dim - Encoding dimension; `2` expects x/y only (z supplied as 0.5), `3` (default) expects x/y/z\n\t * @returns An array of VecModel objects with absolute coordinates\n\t * @public\n\t */\n\tstatic decodePoints(base64: string, dim?: 2 | 3): VecModel[] {\n\t\tif (dim === DIM_2D) return b64Vecs.decodePoints2D(base64)\n\t\tif (base64.length === 0) return []\n\n\t\tconst bytes = base64ToUint8Array(base64)\n\t\tconst dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n\t\tconst result: VecModel[] = []\n\n\t\t// First point is Float32 (12 bytes)\n\t\tlet x = dataView.getFloat32(0, true)\n\t\tlet y = dataView.getFloat32(4, true)\n\t\tlet z = dataView.getFloat32(8, true)\n\t\tresult.push({ x, y, z })\n\n\t\t// Subsequent points are Float16 deltas - accumulate to get absolute positions\n\t\tconst firstPointBytes = 12\n\t\tfor (let offset = firstPointBytes; offset < bytes.length; offset += 6) {\n\t\t\tx += getFloat16(dataView, offset)\n\t\t\ty += getFloat16(dataView, offset + 2)\n\t\t\tz += getFloat16(dataView, offset + 4)\n\t\t\tresult.push({ x, y, z })\n\t\t}\n\n\t\treturn result\n\t}\n\n\t/**\n\t * Get the first point from a delta-encoded base64 string.\n\t * The first point is stored as Float32 for full precision.\n\t *\n\t * @param b64Points - The delta-encoded base64 string\n\t * @param dim - Encoding dimension; `2` expects x/y only (z supplied as 0.5), `3` (default) expects x/y/z\n\t * @returns The first point as a VecModel, or null if the string is too short\n\t * @public\n\t */\n\tstatic decodeFirstPoint(b64Points: string, dim?: 2 | 3): VecModel | null {\n\t\tif (dim === DIM_2D) return b64Vecs.decodeFirstPoint2D(b64Points)\n\t\t// First point needs 16 base64 chars (12 bytes as Float32)\n\t\tif (b64Points.length < FIRST_POINT_B64_LENGTH) return null\n\n\t\tconst bytes = base64ToUint8Array(b64Points.slice(0, FIRST_POINT_B64_LENGTH))\n\t\tconst dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n\n\t\treturn {\n\t\t\tx: dataView.getFloat32(0, true),\n\t\t\ty: dataView.getFloat32(4, true),\n\t\t\tz: dataView.getFloat32(8, true),\n\t\t}\n\t}\n\n\t/**\n\t * Get the last point from a delta-encoded base64 string.\n\t * Requires decoding all points to accumulate deltas.\n\t *\n\t * @param b64Points - The delta-encoded base64 string\n\t * @param dim - Encoding dimension; `2` expects x/y only (z supplied as 0.5), `3` (default) expects x/y/z\n\t * @returns The last point as a VecModel, or null if the string is too short\n\t * @public\n\t */\n\tstatic decodeLastPoint(b64Points: string, dim?: 2 | 3): VecModel | null {\n\t\tif (dim === DIM_2D) return b64Vecs.decodeLastPoint2D(b64Points)\n\t\tif (b64Points.length < FIRST_POINT_B64_LENGTH) return null\n\n\t\tconst bytes = base64ToUint8Array(b64Points)\n\t\tconst dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n\n\t\t// Start with first point (Float32)\n\t\tlet x = dataView.getFloat32(0, true)\n\t\tlet y = dataView.getFloat32(4, true)\n\t\tlet z = dataView.getFloat32(8, true)\n\n\t\t// Accumulate all Float16 deltas to get the last point\n\t\tconst firstPointBytes = 12\n\t\tfor (let offset = firstPointBytes; offset < bytes.length; offset += 6) {\n\t\t\tx += getFloat16(dataView, offset)\n\t\t\ty += getFloat16(dataView, offset + 2)\n\t\t\tz += getFloat16(dataView, offset + 4)\n\t\t}\n\n\t\treturn { x, y, z }\n\t}\n\n\t/**\n\t * Encode an array of VecModels as 2D delta-encoded points, dropping z entirely.\n\t * Use for draw shapes from devices that don't report pressure, where z is a\n\t * constant 0.5 and storing it wastes ~33% of per-point bytes.\n\t *\n\t * Format:\n\t * - First point: 2 Float32 values (x, y) = 8 bytes\n\t * - Delta points: 2 Float16 values (dx, dy) = 4 bytes each\n\t *\n\t * @param points - An array of VecModel objects to encode (z is discarded)\n\t * @returns A base64-encoded string containing 2D delta-encoded points\n\t * @public\n\t */\n\tstatic encodePoints2D(points: VecModel[]): string {\n\t\tif (points.length === 0) return ''\n\n\t\tconst firstPointBytes = 8\n\t\tconst deltaBytes = (points.length - 1) * 4\n\t\tconst buffer = new Uint8Array(firstPointBytes + deltaBytes)\n\t\tconst dataView = new DataView(buffer.buffer)\n\n\t\tconst first = points[0]\n\t\tdataView.setFloat32(0, first.x, true)\n\t\tdataView.setFloat32(4, first.y, true)\n\n\t\tlet prevX = first.x\n\t\tlet prevY = first.y\n\n\t\tfor (let i = 1; i < points.length; i++) {\n\t\t\tconst p = points[i]\n\t\t\tconst offset = firstPointBytes + (i - 1) * 4\n\t\t\tsetFloat16(dataView, offset, p.x - prevX)\n\t\t\tsetFloat16(dataView, offset + 2, p.y - prevY)\n\t\t\tprevX = p.x\n\t\t\tprevY = p.y\n\t\t}\n\n\t\treturn uint8ArrayToBase64(buffer)\n\t}\n\n\t/**\n\t * Decode a 2D delta-encoded base64 string back to an array of absolute VecModels.\n\t * The z coordinate is always set to 0.5 (the default pressure value) so downstream\n\t * consumers don't need a separate code path.\n\t *\n\t * @param base64 - The base64-encoded string containing 2D delta-encoded point data\n\t * @returns An array of VecModel objects with absolute (x, y) and z = 0.5\n\t * @public\n\t */\n\tstatic decodePoints2D(base64: string): VecModel[] {\n\t\tif (base64.length === 0) return []\n\n\t\tconst bytes = base64ToUint8Array(base64)\n\t\tconst dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n\t\tconst result: VecModel[] = []\n\n\t\tlet x = dataView.getFloat32(0, true)\n\t\tlet y = dataView.getFloat32(4, true)\n\t\tresult.push({ x, y, z: DEFAULT_PRESSURE })\n\n\t\tconst firstPointBytes = 8\n\t\tfor (let offset = firstPointBytes; offset < bytes.length; offset += 4) {\n\t\t\tx += getFloat16(dataView, offset)\n\t\t\ty += getFloat16(dataView, offset + 2)\n\t\t\tresult.push({ x, y, z: DEFAULT_PRESSURE })\n\t\t}\n\n\t\treturn result\n\t}\n\n\t/**\n\t * Get the first point from a 2D delta-encoded base64 string.\n\t *\n\t * @param b64Points - The 2D delta-encoded base64 string\n\t * @returns The first point with z = 0.5, or null if the string is too short\n\t * @public\n\t */\n\tstatic decodeFirstPoint2D(b64Points: string): VecModel | null {\n\t\tif (b64Points.length < FIRST_POINT_2D_B64_LENGTH) return null\n\n\t\tconst bytes = base64ToUint8Array(b64Points.slice(0, FIRST_POINT_2D_B64_LENGTH))\n\t\tconst dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n\n\t\treturn {\n\t\t\tx: dataView.getFloat32(0, true),\n\t\t\ty: dataView.getFloat32(4, true),\n\t\t\tz: DEFAULT_PRESSURE,\n\t\t}\n\t}\n\n\t/**\n\t * Get the last point from a 2D delta-encoded base64 string.\n\t * Requires decoding all points to accumulate deltas.\n\t *\n\t * @param b64Points - The 2D delta-encoded base64 string\n\t * @returns The last point with z = 0.5, or null if the string is too short\n\t * @public\n\t */\n\tstatic decodeLastPoint2D(b64Points: string): VecModel | null {\n\t\tif (b64Points.length < FIRST_POINT_2D_B64_LENGTH) return null\n\n\t\tconst bytes = base64ToUint8Array(b64Points)\n\t\tconst dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n\n\t\tlet x = dataView.getFloat32(0, true)\n\t\tlet y = dataView.getFloat32(4, true)\n\n\t\tconst firstPointBytes = 8\n\t\tfor (let offset = firstPointBytes; offset < bytes.length; offset += 4) {\n\t\t\tx += getFloat16(dataView, offset)\n\t\t\ty += getFloat16(dataView, offset + 2)\n\t\t}\n\n\t\treturn { x, y, z: DEFAULT_PRESSURE }\n\t}\n\n\t/**\n\t * Whether an encoded path contains only a single point (a \"dot\"), inferred from\n\t * the encoded length without decoding \u2014 cheap enough for the render path.\n\t *\n\t * The single-point length depends on the encoding dimension, so this takes the\n\t * segment's `dim`: a one-point path is `FIRST_POINT_B64_LENGTH` chars (3D) or\n\t * `FIRST_POINT_2D_B64_LENGTH` chars (2D). Keeping this beside the layout constants\n\t * is deliberate \u2014 it is the single source of truth for \"how long is one point\", so\n\t * callers never hard-code a length threshold (which silently breaks when a new\n\t * encoding is added).\n\t *\n\t * @param b64Points - The encoded path string\n\t * @param dim - Encoding dimension; `2` for (x, y), `3` (default) for (x, y, z)\n\t * @returns true if the path encodes exactly one point\n\t * @public\n\t */\n\tstatic isSinglePoint(b64Points: string, dim?: 2 | 3): boolean {\n\t\treturn b64Points.length <= (dim === DIM_2D ? FIRST_POINT_2D_B64_LENGTH : FIRST_POINT_B64_LENGTH)\n\t}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,MAAM,oBAAoB;AAG1B,MAAM,yBAAyB;AAG/B,MAAM,4BAA4B;AAGlC,MAAM,mBAAmB;AAGlB,MAAM,SAAS;AAEf,MAAM,SAAS;AAGtB,MAAM,eAAe;AACrB,MAAM,aAAa,IAAI,WAAW,GAAG;AACrC,SAAS,IAAI,GAAG,IAAI,IAAI,KAAK;AAC5B,aAAW,aAAa,WAAW,CAAC,CAAC,IAAI;AAC1C;AAGA,MAAM,eAAe;AAErB,MAAM,oBAAoB,IAAI,WAAW,CAAC;AAG1C,MAAM,OAAO,IAAI,aAAa,EAAE;AAChC,SAAS,IAAI,GAAG,IAAI,IAAI,KAAK;AAC5B,OAAK,CAAC,IAAI,KAAK,IAAI,GAAG,IAAI,EAAE;AAC7B;AACA,MAAM,iBAAiB,KAAK,IAAI,GAAG,GAAG,IAAI;AAI1C,MAAM,WAAW,IAAI,aAAa,IAAI;AACtC,SAAS,IAAI,GAAG,IAAI,MAAM,KAAK;AAC9B,WAAS,CAAC,IAAI,IAAI,IAAI;AACvB;
|
|
4
|
+
"sourcesContent": ["import { VecModel } from './geometry-types'\n\n// Each point = 3 Float16s = 6 bytes = 8 base64 chars (legacy format)\nconst _POINT_B64_LENGTH = 8\n\n// First point in delta encoding = 3 Float32s = 12 bytes = 16 base64 chars\nconst FIRST_POINT_B64_LENGTH = 16\n\n// First point in 2D delta encoding = 2 Float32s = 8 bytes = 12 base64 chars (incl. padding)\nconst FIRST_POINT_2D_B64_LENGTH = 12\n\n// Pressure value supplied when decoding non-pressure (2D) paths\nconst DEFAULT_PRESSURE = 0.5\n\n/** Draw segment path encoded with 2 dimensions, XY \u2014 the constant pressure Z is dropped. @public */\nexport const DIM_2D = 2\n/** Draw segment path encoded with 3 dimensions, XYZ. @public */\nexport const DIM_3D = 3\n\n// O(1) lookup table for base64 decoding (maps char code -> 6-bit value)\nconst BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nconst B64_LOOKUP = new Uint8Array(128)\nfor (let i = 0; i < 64; i++) {\n\tB64_LOOKUP[BASE64_CHARS.charCodeAt(i)] = i\n}\n\n// Mask for one base64 sextet: the low 6 bits select an index into BASE64_CHARS (0\u201363).\nconst SIX_BIT_MASK = 0x3f\n// '=' padding character, appended on encode so the output length is a multiple of 4.\nconst PADDING_CHAR_CODE = '='.charCodeAt(0)\n\n// Precomputed powers of 2 for Float16 exponents (exp - 15, so indices 0-30 map to 2^-15 to 2^15)\nconst POW2 = new Float64Array(31)\nfor (let i = 0; i < 31; i++) {\n\tPOW2[i] = Math.pow(2, i - 15)\n}\nconst POW2_SUBNORMAL = Math.pow(2, -14) / 1024 // For subnormal numbers\n\n// Precomputed mantissa values: 1 + frac/1024 for all 1024 possible frac values\n// Avoids division in hot path\nconst MANTISSA = new Float64Array(1024)\nfor (let i = 0; i < 1024; i++) {\n\tMANTISSA[i] = 1 + i / 1024\n}\n\nfunction nativeGetFloat16(dataView: DataView, offset: number): number {\n\treturn (dataView as any).getFloat16(offset, true)\n}\nfunction fallbackGetFloat16(dataView: DataView, offset: number): number {\n\treturn float16BitsToNumber(dataView.getUint16(offset, true))\n}\n\nconst getFloat16 =\n\ttypeof (DataView.prototype as any).getFloat16 === 'function'\n\t\t? nativeGetFloat16\n\t\t: fallbackGetFloat16\n\nfunction nativeSetFloat16(dataView: DataView, offset: number, value: number): void {\n\t;(dataView as any).setFloat16(offset, value, true)\n}\nfunction fallbackSetFloat16(dataView: DataView, offset: number, value: number): void {\n\tdataView.setUint16(offset, numberToFloat16Bits(value), true)\n}\n\nconst setFloat16 =\n\ttypeof (DataView.prototype as any).setFloat16 === 'function'\n\t\t? nativeSetFloat16\n\t\t: fallbackSetFloat16\n\nfunction nativeBase64ToUint8Array(base64: string): Uint8Array {\n\treturn Uint8Array.fromBase64(base64)\n}\n\n/** @internal */\nexport function fallbackBase64ToUint8Array(base64: string): Uint8Array {\n\t// Strip up to 2 '=' padding characters to determine the real byte count.\n\t// The 2D point layout (8 + 4(n-1) bytes) is not a multiple of 3, so encoded\n\t// paths can carry padding the original multiple-of-3-only decoder couldn't read.\n\tconst paddedLength = base64.length\n\tlet padding = 0\n\tif (paddedLength > 0 && base64.charCodeAt(paddedLength - 1) === PADDING_CHAR_CODE) {\n\t\tpadding++\n\t\tif (paddedLength > 1 && base64.charCodeAt(paddedLength - 2) === PADDING_CHAR_CODE) {\n\t\t\tpadding++\n\t\t}\n\t}\n\tconst numBytes = Math.floor((paddedLength * 3) / 4) - padding\n\tconst bytes = new Uint8Array(numBytes)\n\tlet byteIndex = 0\n\n\t// The reverse of encoding: each 4 chars are 4 six-bit values that pack back into\n\t// one 24-bit number, which we then read out as 3 bytes (& 255 keeps one byte).\n\tconst fullGroups = Math.floor((paddedLength - padding) / 4) * 4\n\tfor (let i = 0; i < fullGroups; i += 4) {\n\t\tconst c0 = B64_LOOKUP[base64.charCodeAt(i)]\n\t\tconst c1 = B64_LOOKUP[base64.charCodeAt(i + 1)]\n\t\tconst c2 = B64_LOOKUP[base64.charCodeAt(i + 2)]\n\t\tconst c3 = B64_LOOKUP[base64.charCodeAt(i + 3)]\n\n\t\tconst bitmap = (c0 << 18) | (c1 << 12) | (c2 << 6) | c3\n\n\t\tbytes[byteIndex++] = (bitmap >> 16) & 255 // top byte (bits 23\u201316)\n\t\tbytes[byteIndex++] = (bitmap >> 8) & 255 // middle byte (bits 15\u20138)\n\t\tbytes[byteIndex++] = bitmap & 255 // bottom byte (bits 7\u20130)\n\t}\n\n\t// Final group when padded: 3 valid chars -> 2 bytes, 2 valid chars -> 1 byte.\n\tif (padding === 1) {\n\t\tconst c0 = B64_LOOKUP[base64.charCodeAt(fullGroups)]\n\t\tconst c1 = B64_LOOKUP[base64.charCodeAt(fullGroups + 1)]\n\t\tconst c2 = B64_LOOKUP[base64.charCodeAt(fullGroups + 2)]\n\t\tconst bitmap = (c0 << 18) | (c1 << 12) | (c2 << 6)\n\t\tbytes[byteIndex++] = (bitmap >> 16) & 255\n\t\tbytes[byteIndex++] = (bitmap >> 8) & 255\n\t} else if (padding === 2) {\n\t\tconst c0 = B64_LOOKUP[base64.charCodeAt(fullGroups)]\n\t\tconst c1 = B64_LOOKUP[base64.charCodeAt(fullGroups + 1)]\n\t\tconst bitmap = (c0 << 18) | (c1 << 12)\n\t\tbytes[byteIndex++] = (bitmap >> 16) & 255\n\t}\n\n\treturn bytes\n}\n\nfunction nativeUint8ArrayToBase64(uint8Array: Uint8Array): string {\n\treturn uint8Array.toBase64()\n}\n\n/** @internal */\nexport function fallbackUint8ArrayToBase64(uint8Array: Uint8Array): string {\n\tconst len = uint8Array.length\n\tconst fullGroups = Math.floor(len / 3) * 3\n\tlet result = ''\n\n\t// base64 represents 3 bytes (24 bits) as 4 characters of 6 bits each. For each\n\t// group of 3 bytes we pack them into one 24-bit number, then read it back out as\n\t// four 6-bit slices and use each slice (a value 0\u201363) to index into the 64-char\n\t// alphabet. `>> n` shifts the wanted slice down to the bottom; SIX_BIT_MASK then\n\t// discards everything above those 6 bits.\n\tfor (let i = 0; i < fullGroups; i += 3) {\n\t\tconst byte1 = uint8Array[i]\n\t\tconst byte2 = uint8Array[i + 1]\n\t\tconst byte3 = uint8Array[i + 2]\n\n\t\tconst bitmap = (byte1 << 16) | (byte2 << 8) | byte3\n\t\tresult +=\n\t\t\tBASE64_CHARS[(bitmap >> 18) & SIX_BIT_MASK] + // bits 23\u201318 (top sextet)\n\t\t\tBASE64_CHARS[(bitmap >> 12) & SIX_BIT_MASK] + // bits 17\u201312\n\t\t\tBASE64_CHARS[(bitmap >> 6) & SIX_BIT_MASK] + // bits 11\u20136\n\t\t\tBASE64_CHARS[bitmap & SIX_BIT_MASK] // bits 5\u20130 (bottom sextet)\n\t}\n\n\t// A trailing 1 or 2 bytes can't fill a whole 4-char group, so we emit only the\n\t// chars their bits cover and pad the rest with '=' to keep the length a multiple\n\t// of 4. Standard base64 \u2014 matches the native API and Node's Buffer, so a path\n\t// encoded by the fallback round-trips on a runtime that decodes with the native one.\n\tconst remaining = len - fullGroups\n\tif (remaining === 1) {\n\t\t// 8 bits \u2192 2 sextets (the 2nd only partly filled), then \"==\"\n\t\tconst bitmap = uint8Array[fullGroups] << 16\n\t\tresult +=\n\t\t\tBASE64_CHARS[(bitmap >> 18) & SIX_BIT_MASK] +\n\t\t\tBASE64_CHARS[(bitmap >> 12) & SIX_BIT_MASK] +\n\t\t\t'=='\n\t} else if (remaining === 2) {\n\t\t// 16 bits \u2192 3 sextets (the 3rd only partly filled), then \"=\"\n\t\tconst bitmap = (uint8Array[fullGroups] << 16) | (uint8Array[fullGroups + 1] << 8)\n\t\tresult +=\n\t\t\tBASE64_CHARS[(bitmap >> 18) & SIX_BIT_MASK] +\n\t\t\tBASE64_CHARS[(bitmap >> 12) & SIX_BIT_MASK] +\n\t\t\tBASE64_CHARS[(bitmap >> 6) & SIX_BIT_MASK] +\n\t\t\t'='\n\t}\n\n\treturn result\n}\n\n/**\n * Convert a Uint8Array to base64.\n * Processes bytes in groups of 3 to produce 4 base64 characters.\n *\n * @internal\n */\nconst uint8ArrayToBase64 =\n\ttypeof Uint8Array.prototype.toBase64 === 'function'\n\t\t? nativeUint8ArrayToBase64\n\t\t: fallbackUint8ArrayToBase64\n\n/**\n * Convert a base64 string to Uint8Array.\n *\n * @internal\n */\nconst base64ToUint8Array =\n\ttypeof Uint8Array.fromBase64 === 'function'\n\t\t? nativeBase64ToUint8Array\n\t\t: fallbackBase64ToUint8Array\n\n/**\n * Convert Float16 bits to a number using optimized lookup tables.\n * Handles normal numbers, subnormal numbers, zero, infinity, and NaN.\n *\n * @param bits - The 16-bit Float16 value to decode\n * @returns The decoded number value\n * @internal\n */\nexport function float16BitsToNumber(bits: number): number {\n\tconst sign = bits >> 15\n\tconst exp = (bits >> 10) & 0x1f\n\tconst frac = bits & 0x3ff\n\n\tif (exp === 0) {\n\t\t// Subnormal or zero - rare case\n\t\treturn sign ? -frac * POW2_SUBNORMAL : frac * POW2_SUBNORMAL\n\t}\n\tif (exp === 31) {\n\t\t// Infinity or NaN - very rare\n\t\treturn frac ? NaN : sign ? -Infinity : Infinity\n\t}\n\t// Normal case - two table lookups, one multiply, no division\n\tconst magnitude = POW2[exp] * MANTISSA[frac]\n\treturn sign ? -magnitude : magnitude\n}\n\n/**\n * Convert a number to Float16 bits.\n * Handles normal numbers, subnormal numbers, zero, infinity, and NaN.\n *\n * @param value - The number to encode as Float16\n * @returns The 16-bit Float16 representation of the number\n * @internal\n */\nexport function numberToFloat16Bits(value: number): number {\n\tif (value === 0) return Object.is(value, -0) ? 0x8000 : 0\n\tif (!Number.isFinite(value)) {\n\t\tif (Number.isNaN(value)) return 0x7e00\n\t\treturn value > 0 ? 0x7c00 : 0xfc00\n\t}\n\n\tconst sign = value < 0 ? 1 : 0\n\tvalue = Math.abs(value)\n\n\t// Find exponent and mantissa\n\tconst exp = Math.floor(Math.log2(value))\n\tlet expBiased = exp + 15\n\n\tif (expBiased >= 31) {\n\t\t// Overflow to infinity\n\t\treturn (sign << 15) | 0x7c00\n\t}\n\tif (expBiased <= 0) {\n\t\t// Subnormal or underflow\n\t\tconst frac = Math.round(value * Math.pow(2, 14) * 1024)\n\t\treturn (sign << 15) | (frac & 0x3ff)\n\t}\n\n\t// Normal number\n\tconst mantissa = value / Math.pow(2, exp) - 1\n\tlet frac = Math.round(mantissa * 1024)\n\n\t// Handle rounding overflow: if frac rounds to 1024, increment exponent\n\tif (frac >= 1024) {\n\t\tfrac = 0\n\t\texpBiased++\n\t\tif (expBiased >= 31) {\n\t\t\t// Overflow to infinity\n\t\t\treturn (sign << 15) | 0x7c00\n\t\t}\n\t}\n\n\treturn (sign << 15) | (expBiased << 10) | frac\n}\n\n/**\n * Utilities for encoding and decoding points using base64 and Float16 encoding.\n * Provides functions for converting between VecModel arrays and compact base64 strings,\n * as well as individual point encoding/decoding operations.\n *\n * @public\n */\nexport class b64Vecs {\n\t/**\n\t * Encode a single point (x, y, z) to 8 base64 characters using legacy Float16 encoding.\n\t * Each coordinate is encoded as a Float16 value, resulting in 6 bytes total.\n\t *\n\t * @param x - The x coordinate\n\t * @param y - The y coordinate\n\t * @param z - The z coordinate\n\t * @returns An 8-character base64 string representing the point\n\t * @internal\n\t */\n\tstatic _legacyEncodePoint(x: number, y: number, z: number): string {\n\t\tconst buffer = new Uint8Array(6)\n\t\tconst dataView = new DataView(buffer.buffer)\n\n\t\tsetFloat16(dataView, 0, x)\n\t\tsetFloat16(dataView, 2, y)\n\t\tsetFloat16(dataView, 4, z)\n\n\t\treturn uint8ArrayToBase64(buffer)\n\t}\n\n\t/**\n\t * Convert an array of VecModels to a base64 string using legacy Float16 encoding.\n\t * Uses Float16 encoding for each coordinate (x, y, z). If a point's z value is\n\t * undefined, it defaults to 0.5.\n\t *\n\t * @param points - An array of VecModel objects to encode\n\t * @returns A base64-encoded string containing all points\n\t * @internal Used only for migrations from legacy format\n\t */\n\tstatic _legacyEncodePoints(points: VecModel[]): string {\n\t\tif (points.length === 0) return ''\n\n\t\t// 3 Float16s per point = 6 bytes per point\n\t\tconst buffer = new Uint8Array(points.length * 6)\n\t\tconst dataView = new DataView(buffer.buffer)\n\n\t\tfor (let i = 0; i < points.length; i++) {\n\t\t\tconst p = points[i]\n\t\t\tconst offset = i * 6\n\t\t\tsetFloat16(dataView, offset, p.x)\n\t\t\tsetFloat16(dataView, offset + 2, p.y)\n\t\t\tsetFloat16(dataView, offset + 4, p.z ?? 0.5)\n\t\t}\n\n\t\treturn uint8ArrayToBase64(buffer)\n\t}\n\n\t/**\n\t * Convert a legacy base64 string back to an array of VecModels.\n\t * Decodes Float16-encoded coordinates (x, y, z) from the base64 string.\n\t *\n\t * @param base64 - The base64-encoded string containing point data\n\t * @returns An array of VecModel objects decoded from the string\n\t * @internal Used only for migrations from legacy format\n\t */\n\tstatic _legacyDecodePoints(base64: string): VecModel[] {\n\t\tconst bytes = base64ToUint8Array(base64)\n\t\tconst dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n\t\tconst result: VecModel[] = []\n\t\tfor (let offset = 0; offset < bytes.length; offset += 6) {\n\t\t\tresult.push({\n\t\t\t\tx: getFloat16(dataView, offset),\n\t\t\t\ty: getFloat16(dataView, offset + 2),\n\t\t\t\tz: getFloat16(dataView, offset + 4),\n\t\t\t})\n\t\t}\n\t\treturn result\n\t}\n\n\t/**\n\t * Encode an array of VecModels using delta encoding for improved precision.\n\t * The first point is stored as Float32 (high precision for absolute position),\n\t * subsequent points are stored as Float16 deltas from the previous point.\n\t * This provides full precision for the starting position and excellent precision\n\t * for deltas between consecutive points (which are typically small values).\n\t *\n\t * Format:\n\t * - First point: 3 Float32 values = 12 bytes = 16 base64 chars\n\t * - Delta points: 3 Float16 values each = 6 bytes = 8 base64 chars each\n\t *\n\t * @param points - An array of VecModel objects to encode\n\t * @param dim - Encoding dimension; `2` routes through the 2D variant (drops z), `3` (default) keeps x, y, z\n\t * @returns A base64-encoded string containing delta-encoded points\n\t * @public\n\t */\n\tstatic encodePoints(points: VecModel[], dim?: 2 | 3): string {\n\t\tif (dim === DIM_2D) return b64Vecs.encodePoints2D(points)\n\t\tif (points.length === 0) return ''\n\n\t\t// First point: 3 Float32s = 12 bytes\n\t\t// Remaining points: 3 Float16s each = 6 bytes each\n\t\tconst firstPointBytes = 12\n\t\tconst deltaBytes = (points.length - 1) * 6\n\t\tconst totalBytes = firstPointBytes + deltaBytes\n\n\t\tconst buffer = new Uint8Array(totalBytes)\n\t\tconst dataView = new DataView(buffer.buffer)\n\n\t\t// First point is stored as Float32 for full precision\n\t\tconst first = points[0]\n\t\tdataView.setFloat32(0, first.x, true) // little-endian\n\t\tdataView.setFloat32(4, first.y, true)\n\t\tdataView.setFloat32(8, first.z ?? 0.5, true)\n\n\t\t// Subsequent points are Float16 deltas from the previous point\n\t\tlet prevX = first.x\n\t\tlet prevY = first.y\n\t\tlet prevZ = first.z ?? 0.5\n\n\t\tfor (let i = 1; i < points.length; i++) {\n\t\t\tconst p = points[i]\n\t\t\tconst z = p.z ?? 0.5\n\n\t\t\tconst offset = firstPointBytes + (i - 1) * 6\n\t\t\tsetFloat16(dataView, offset, p.x - prevX)\n\t\t\tsetFloat16(dataView, offset + 2, p.y - prevY)\n\t\t\tsetFloat16(dataView, offset + 4, z - prevZ)\n\n\t\t\tprevX = p.x\n\t\t\tprevY = p.y\n\t\t\tprevZ = z\n\t\t}\n\n\t\treturn uint8ArrayToBase64(buffer)\n\t}\n\n\t/**\n\t * Decode a delta-encoded base64 string back to an array of absolute VecModels.\n\t * The first point is stored as Float32 (high precision), subsequent points are\n\t * Float16 deltas that are accumulated to reconstruct absolute positions.\n\t *\n\t * @param base64 - The base64-encoded string containing delta-encoded point data\n\t * @param dim - Encoding dimension; `2` expects x/y only (z supplied as 0.5), `3` (default) expects x/y/z\n\t * @returns An array of VecModel objects with absolute coordinates\n\t * @public\n\t */\n\tstatic decodePoints(base64: string, dim?: 2 | 3): VecModel[] {\n\t\tif (dim === DIM_2D) return b64Vecs.decodePoints2D(base64)\n\t\tif (base64.length === 0) return []\n\n\t\tconst bytes = base64ToUint8Array(base64)\n\t\tconst dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n\t\tconst result: VecModel[] = []\n\n\t\t// First point is Float32 (12 bytes)\n\t\tlet x = dataView.getFloat32(0, true)\n\t\tlet y = dataView.getFloat32(4, true)\n\t\tlet z = dataView.getFloat32(8, true)\n\t\tresult.push({ x, y, z })\n\n\t\t// Subsequent points are Float16 deltas - accumulate to get absolute positions\n\t\tconst firstPointBytes = 12\n\t\tfor (let offset = firstPointBytes; offset < bytes.length; offset += 6) {\n\t\t\tx += getFloat16(dataView, offset)\n\t\t\ty += getFloat16(dataView, offset + 2)\n\t\t\tz += getFloat16(dataView, offset + 4)\n\t\t\tresult.push({ x, y, z })\n\t\t}\n\n\t\treturn result\n\t}\n\n\t/**\n\t * Get the first point from a delta-encoded base64 string.\n\t * The first point is stored as Float32 for full precision.\n\t *\n\t * @param b64Points - The delta-encoded base64 string\n\t * @param dim - Encoding dimension; `2` expects x/y only (z supplied as 0.5), `3` (default) expects x/y/z\n\t * @returns The first point as a VecModel, or null if the string is too short\n\t * @public\n\t */\n\tstatic decodeFirstPoint(b64Points: string, dim?: 2 | 3): VecModel | null {\n\t\tif (dim === DIM_2D) return b64Vecs.decodeFirstPoint2D(b64Points)\n\t\t// First point needs 16 base64 chars (12 bytes as Float32)\n\t\tif (b64Points.length < FIRST_POINT_B64_LENGTH) return null\n\n\t\tconst bytes = base64ToUint8Array(b64Points.slice(0, FIRST_POINT_B64_LENGTH))\n\t\tconst dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n\n\t\treturn {\n\t\t\tx: dataView.getFloat32(0, true),\n\t\t\ty: dataView.getFloat32(4, true),\n\t\t\tz: dataView.getFloat32(8, true),\n\t\t}\n\t}\n\n\t/**\n\t * Get the last point from a delta-encoded base64 string.\n\t * Requires decoding all points to accumulate deltas.\n\t *\n\t * @param b64Points - The delta-encoded base64 string\n\t * @param dim - Encoding dimension; `2` expects x/y only (z supplied as 0.5), `3` (default) expects x/y/z\n\t * @returns The last point as a VecModel, or null if the string is too short\n\t * @public\n\t */\n\tstatic decodeLastPoint(b64Points: string, dim?: 2 | 3): VecModel | null {\n\t\tif (dim === DIM_2D) return b64Vecs.decodeLastPoint2D(b64Points)\n\t\tif (b64Points.length < FIRST_POINT_B64_LENGTH) return null\n\n\t\tconst bytes = base64ToUint8Array(b64Points)\n\t\tconst dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n\n\t\t// Start with first point (Float32)\n\t\tlet x = dataView.getFloat32(0, true)\n\t\tlet y = dataView.getFloat32(4, true)\n\t\tlet z = dataView.getFloat32(8, true)\n\n\t\t// Accumulate all Float16 deltas to get the last point\n\t\tconst firstPointBytes = 12\n\t\tfor (let offset = firstPointBytes; offset < bytes.length; offset += 6) {\n\t\t\tx += getFloat16(dataView, offset)\n\t\t\ty += getFloat16(dataView, offset + 2)\n\t\t\tz += getFloat16(dataView, offset + 4)\n\t\t}\n\n\t\treturn { x, y, z }\n\t}\n\n\t/**\n\t * Encode an array of VecModels as 2D delta-encoded points, dropping z entirely.\n\t * Use for draw shapes from devices that don't report pressure, where z is a\n\t * constant 0.5 and storing it wastes ~33% of per-point bytes.\n\t *\n\t * Format:\n\t * - First point: 2 Float32 values (x, y) = 8 bytes\n\t * - Delta points: 2 Float16 values (dx, dy) = 4 bytes each\n\t *\n\t * @param points - An array of VecModel objects to encode (z is discarded)\n\t * @returns A base64-encoded string containing 2D delta-encoded points\n\t * @public\n\t */\n\tstatic encodePoints2D(points: VecModel[]): string {\n\t\tif (points.length === 0) return ''\n\n\t\tconst firstPointBytes = 8\n\t\tconst deltaBytes = (points.length - 1) * 4\n\t\tconst buffer = new Uint8Array(firstPointBytes + deltaBytes)\n\t\tconst dataView = new DataView(buffer.buffer)\n\n\t\tconst first = points[0]\n\t\tdataView.setFloat32(0, first.x, true)\n\t\tdataView.setFloat32(4, first.y, true)\n\n\t\tlet prevX = first.x\n\t\tlet prevY = first.y\n\n\t\tfor (let i = 1; i < points.length; i++) {\n\t\t\tconst p = points[i]\n\t\t\tconst offset = firstPointBytes + (i - 1) * 4\n\t\t\tsetFloat16(dataView, offset, p.x - prevX)\n\t\t\tsetFloat16(dataView, offset + 2, p.y - prevY)\n\t\t\tprevX = p.x\n\t\t\tprevY = p.y\n\t\t}\n\n\t\treturn uint8ArrayToBase64(buffer)\n\t}\n\n\t/**\n\t * Decode a 2D delta-encoded base64 string back to an array of absolute VecModels.\n\t * The z coordinate is always set to 0.5 (the default pressure value) so downstream\n\t * consumers don't need a separate code path.\n\t *\n\t * @param base64 - The base64-encoded string containing 2D delta-encoded point data\n\t * @returns An array of VecModel objects with absolute (x, y) and z = 0.5\n\t * @public\n\t */\n\tstatic decodePoints2D(base64: string): VecModel[] {\n\t\tif (base64.length === 0) return []\n\n\t\tconst bytes = base64ToUint8Array(base64)\n\t\tconst dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n\t\tconst result: VecModel[] = []\n\n\t\tlet x = dataView.getFloat32(0, true)\n\t\tlet y = dataView.getFloat32(4, true)\n\t\tresult.push({ x, y, z: DEFAULT_PRESSURE })\n\n\t\tconst firstPointBytes = 8\n\t\tfor (let offset = firstPointBytes; offset < bytes.length; offset += 4) {\n\t\t\tx += getFloat16(dataView, offset)\n\t\t\ty += getFloat16(dataView, offset + 2)\n\t\t\tresult.push({ x, y, z: DEFAULT_PRESSURE })\n\t\t}\n\n\t\treturn result\n\t}\n\n\t/**\n\t * Get the first point from a 2D delta-encoded base64 string.\n\t *\n\t * @param b64Points - The 2D delta-encoded base64 string\n\t * @returns The first point with z = 0.5, or null if the string is too short\n\t * @public\n\t */\n\tstatic decodeFirstPoint2D(b64Points: string): VecModel | null {\n\t\tif (b64Points.length < FIRST_POINT_2D_B64_LENGTH) return null\n\n\t\tconst bytes = base64ToUint8Array(b64Points.slice(0, FIRST_POINT_2D_B64_LENGTH))\n\t\tconst dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n\n\t\treturn {\n\t\t\tx: dataView.getFloat32(0, true),\n\t\t\ty: dataView.getFloat32(4, true),\n\t\t\tz: DEFAULT_PRESSURE,\n\t\t}\n\t}\n\n\t/**\n\t * Get the last point from a 2D delta-encoded base64 string.\n\t * Requires decoding all points to accumulate deltas.\n\t *\n\t * @param b64Points - The 2D delta-encoded base64 string\n\t * @returns The last point with z = 0.5, or null if the string is too short\n\t * @public\n\t */\n\tstatic decodeLastPoint2D(b64Points: string): VecModel | null {\n\t\tif (b64Points.length < FIRST_POINT_2D_B64_LENGTH) return null\n\n\t\tconst bytes = base64ToUint8Array(b64Points)\n\t\tconst dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n\n\t\tlet x = dataView.getFloat32(0, true)\n\t\tlet y = dataView.getFloat32(4, true)\n\n\t\tconst firstPointBytes = 8\n\t\tfor (let offset = firstPointBytes; offset < bytes.length; offset += 4) {\n\t\t\tx += getFloat16(dataView, offset)\n\t\t\ty += getFloat16(dataView, offset + 2)\n\t\t}\n\n\t\treturn { x, y, z: DEFAULT_PRESSURE }\n\t}\n\n\t/**\n\t * Whether an encoded path contains only a single point (a \"dot\"), inferred from\n\t * the encoded length without decoding \u2014 cheap enough for the render path.\n\t *\n\t * The single-point length depends on the encoding dimension, so this takes the\n\t * segment's `dim`: a one-point path is `FIRST_POINT_B64_LENGTH` chars (3D) or\n\t * `FIRST_POINT_2D_B64_LENGTH` chars (2D). Keeping this beside the layout constants\n\t * is deliberate \u2014 it is the single source of truth for \"how long is one point\", so\n\t * callers never hard-code a length threshold (which silently breaks when a new\n\t * encoding is added).\n\t *\n\t * @param b64Points - The encoded path string\n\t * @param dim - Encoding dimension; `2` for (x, y), `3` (default) for (x, y, z)\n\t * @returns true if the path encodes exactly one point\n\t * @public\n\t */\n\tstatic isSinglePoint(b64Points: string, dim?: 2 | 3): boolean {\n\t\treturn b64Points.length <= (dim === DIM_2D ? FIRST_POINT_2D_B64_LENGTH : FIRST_POINT_B64_LENGTH)\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,MAAM,oBAAoB;AAG1B,MAAM,yBAAyB;AAG/B,MAAM,4BAA4B;AAGlC,MAAM,mBAAmB;AAGlB,MAAM,SAAS;AAEf,M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AM;AAChC,WAAK,WAAW,UAAU,SAAS,CAAC;AAAA,IACrC;AAEA,WAAO,EAAE,GAAG,GAAG,GAAG,iBAAiB;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBA,OAAO,cAAc,WAAmB,KAAsB;AAC7D,WAAO,UAAU,WAAW,QAAQ,SAAS,4BAA4B;AAAA,EAC1E;AACD;",
|
|
6
6
|
"names": ["frac"]
|
|
7
7
|
}
|
|
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var TLPage_exports = {};
|
|
20
20
|
__export(TLPage_exports, {
|
|
21
21
|
PageRecordType: () => PageRecordType,
|
|
22
|
+
isPage: () => isPage,
|
|
22
23
|
isPageId: () => isPageId,
|
|
23
24
|
pageIdValidator: () => pageIdValidator,
|
|
24
25
|
pageMigrations: () => pageMigrations,
|
|
@@ -61,6 +62,10 @@ const PageRecordType = (0, import_store.createRecordType)("page", {
|
|
|
61
62
|
}).withDefaultProperties(() => ({
|
|
62
63
|
meta: {}
|
|
63
64
|
}));
|
|
65
|
+
function isPage(record) {
|
|
66
|
+
if (!record) return false;
|
|
67
|
+
return record.typeName === "page";
|
|
68
|
+
}
|
|
64
69
|
function isPageId(id) {
|
|
65
70
|
return PageRecordType.isId(id);
|
|
66
71
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/records/TLPage.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n\tBaseRecord,\n\tcreateMigrationIds,\n\tcreateRecordMigrationSequence,\n\tcreateRecordType,\n\tRecordId,\n} from '@tldraw/store'\nimport { IndexKey, JsonObject } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\nimport { idValidator } from '../misc/id-validator'\n\n/**\n * A page within a tldraw document. Pages are containers for shapes and provide\n * a way to organize content into separate canvases. Each document can have multiple\n * pages, and users can navigate between them.\n *\n * Pages have a name for identification, an index for ordering, and can store\n * custom metadata.\n *\n * @example\n * ```ts\n * const page: TLPage = {\n * id: 'page:page1',\n * typeName: 'page',\n * name: 'Page 1',\n * index: 'a1',\n * meta: { description: 'Main design page' }\n * }\n * ```\n *\n * @public\n */\nexport interface TLPage extends BaseRecord<'page', TLPageId> {\n\tname: string\n\tindex: IndexKey\n\tmeta: JsonObject\n}\n\n/**\n * A unique identifier for TLPage records.\n *\n * Page IDs follow the format 'page:' followed by a unique string identifier.\n *\n * @example\n * ```ts\n * const pageId: TLPageId = 'page:main'\n * const pageId2: TLPageId = createShapeId() // generates 'page:abc123'\n * ```\n *\n * @public\n */\nexport type TLPageId = RecordId<TLPage>\n\n/**\n * Validator for TLPageId values. Ensures the ID follows the correct\n * format for page records ('page:' prefix).\n *\n * @example\n * ```ts\n * const isValid = pageIdValidator.isValid('page:main') // true\n * const isValid2 = pageIdValidator.isValid('shape:abc') // false\n * ```\n *\n * @public\n */\nexport const pageIdValidator = idValidator<TLPageId>('page')\n\n/**\n * Runtime validator for TLPage records. Validates the structure and types\n * of all page properties to ensure data integrity.\n *\n * @example\n * ```ts\n * const page = { id: 'page:1', typeName: 'page', name: 'My Page', index: 'a1', meta: {} }\n * const isValid = pageValidator.isValid(page) // true\n * ```\n *\n * @public\n */\nexport const pageValidator: T.Validator<TLPage> = T.model(\n\t'page',\n\tT.object({\n\t\ttypeName: T.literal('page'),\n\t\tid: pageIdValidator,\n\t\tname: T.string,\n\t\tindex: T.indexKey,\n\t\tmeta: T.jsonValue as T.ObjectValidator<JsonObject>,\n\t})\n)\n\n/**\n * Migration version identifiers for TLPage records. Each version represents\n * a schema change that requires data transformation when loading older documents.\n *\n * @public\n */\nexport const pageVersions = createMigrationIds('com.tldraw.page', {\n\tAddMeta: 1,\n})\n\n/**\n * Migration sequence for TLPage records. Defines how to transform page\n * records between different schema versions, ensuring data compatibility.\n *\n * @example\n * ```ts\n * // Migrations are applied automatically when loading documents\n * const migratedPage = pageMigrations.migrate(oldPage, targetVersion)\n * ```\n *\n * @public\n */\nexport const pageMigrations = createRecordMigrationSequence({\n\tsequenceId: 'com.tldraw.page',\n\trecordType: 'page',\n\tsequence: [\n\t\t{\n\t\t\tid: pageVersions.AddMeta,\n\t\t\tup: (record: any) => {\n\t\t\t\trecord.meta = {}\n\t\t\t},\n\t\t},\n\t],\n})\n\n/**\n * The RecordType definition for TLPage records. Defines validation, scope,\n * and default properties for page records in the tldraw store.\n *\n * Pages are scoped to the document level, meaning they persist across sessions\n * and are shared in collaborative environments.\n *\n * @example\n * ```ts\n * const page = PageRecordType.create({\n * id: 'page:main',\n * name: 'Main Page',\n * index: 'a1'\n * })\n * ```\n *\n * @public\n */\nexport const PageRecordType = createRecordType<TLPage>('page', {\n\tvalidator: pageValidator,\n\tscope: 'document',\n}).withDefaultProperties(() => ({\n\tmeta: {},\n}))\n\n/**\n * Type guard to check if a string is a valid TLPageId.\n *\n * @param id - The string to check\n * @returns True if the ID is a valid page ID, false otherwise\n *\n * @example\n * ```ts\n * if (isPageId('page:main')) {\n * // TypeScript knows this is a TLPageId\n * console.log('Valid page ID')\n * }\n * ```\n *\n * @public\n */\nexport function isPageId(id: string): id is TLPageId {\n\treturn PageRecordType.isId(id)\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import {\n\tBaseRecord,\n\tcreateMigrationIds,\n\tcreateRecordMigrationSequence,\n\tcreateRecordType,\n\tRecordId,\n\tUnknownRecord,\n} from '@tldraw/store'\nimport { IndexKey, JsonObject } from '@tldraw/utils'\nimport { T } from '@tldraw/validate'\nimport { idValidator } from '../misc/id-validator'\n\n/**\n * A page within a tldraw document. Pages are containers for shapes and provide\n * a way to organize content into separate canvases. Each document can have multiple\n * pages, and users can navigate between them.\n *\n * Pages have a name for identification, an index for ordering, and can store\n * custom metadata.\n *\n * @example\n * ```ts\n * const page: TLPage = {\n * id: 'page:page1',\n * typeName: 'page',\n * name: 'Page 1',\n * index: 'a1',\n * meta: { description: 'Main design page' }\n * }\n * ```\n *\n * @public\n */\nexport interface TLPage extends BaseRecord<'page', TLPageId> {\n\tname: string\n\tindex: IndexKey\n\tmeta: JsonObject\n}\n\n/**\n * A unique identifier for TLPage records.\n *\n * Page IDs follow the format 'page:' followed by a unique string identifier.\n *\n * @example\n * ```ts\n * const pageId: TLPageId = 'page:main'\n * const pageId2: TLPageId = createShapeId() // generates 'page:abc123'\n * ```\n *\n * @public\n */\nexport type TLPageId = RecordId<TLPage>\n\n/**\n * Validator for TLPageId values. Ensures the ID follows the correct\n * format for page records ('page:' prefix).\n *\n * @example\n * ```ts\n * const isValid = pageIdValidator.isValid('page:main') // true\n * const isValid2 = pageIdValidator.isValid('shape:abc') // false\n * ```\n *\n * @public\n */\nexport const pageIdValidator = idValidator<TLPageId>('page')\n\n/**\n * Runtime validator for TLPage records. Validates the structure and types\n * of all page properties to ensure data integrity.\n *\n * @example\n * ```ts\n * const page = { id: 'page:1', typeName: 'page', name: 'My Page', index: 'a1', meta: {} }\n * const isValid = pageValidator.isValid(page) // true\n * ```\n *\n * @public\n */\nexport const pageValidator: T.Validator<TLPage> = T.model(\n\t'page',\n\tT.object({\n\t\ttypeName: T.literal('page'),\n\t\tid: pageIdValidator,\n\t\tname: T.string,\n\t\tindex: T.indexKey,\n\t\tmeta: T.jsonValue as T.ObjectValidator<JsonObject>,\n\t})\n)\n\n/**\n * Migration version identifiers for TLPage records. Each version represents\n * a schema change that requires data transformation when loading older documents.\n *\n * @public\n */\nexport const pageVersions = createMigrationIds('com.tldraw.page', {\n\tAddMeta: 1,\n})\n\n/**\n * Migration sequence for TLPage records. Defines how to transform page\n * records between different schema versions, ensuring data compatibility.\n *\n * @example\n * ```ts\n * // Migrations are applied automatically when loading documents\n * const migratedPage = pageMigrations.migrate(oldPage, targetVersion)\n * ```\n *\n * @public\n */\nexport const pageMigrations = createRecordMigrationSequence({\n\tsequenceId: 'com.tldraw.page',\n\trecordType: 'page',\n\tsequence: [\n\t\t{\n\t\t\tid: pageVersions.AddMeta,\n\t\t\tup: (record: any) => {\n\t\t\t\trecord.meta = {}\n\t\t\t},\n\t\t},\n\t],\n})\n\n/**\n * The RecordType definition for TLPage records. Defines validation, scope,\n * and default properties for page records in the tldraw store.\n *\n * Pages are scoped to the document level, meaning they persist across sessions\n * and are shared in collaborative environments.\n *\n * @example\n * ```ts\n * const page = PageRecordType.create({\n * id: 'page:main',\n * name: 'Main Page',\n * index: 'a1'\n * })\n * ```\n *\n * @public\n */\nexport const PageRecordType = createRecordType<TLPage>('page', {\n\tvalidator: pageValidator,\n\tscope: 'document',\n}).withDefaultProperties(() => ({\n\tmeta: {},\n}))\n\n/**\n * Type guard to check if a record is a page.\n *\n * @param record - The record to check\n * @returns True if the record is a page, false otherwise\n *\n * @example\n * ```ts\n * const record = store.get('page:abc123')\n\n * if (isPage(record)) {\n * console.log(`Page name: ${record.name}`)\n * }\n * ```\n *\n * @public\n */\nexport function isPage(record?: UnknownRecord): record is TLPage {\n\tif (!record) return false\n\treturn record.typeName === 'page'\n}\n\n/**\n * Type guard to check if a string is a valid TLPageId.\n *\n * @param id - The string to check\n * @returns True if the ID is a valid page ID, false otherwise\n *\n * @example\n * ```ts\n * if (isPageId('page:main')) {\n * // TypeScript knows this is a TLPageId\n * console.log('Valid page ID')\n * }\n * ```\n *\n * @public\n */\nexport function isPageId(id: string): id is TLPageId {\n\treturn PageRecordType.isId(id)\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAOO;AAEP,sBAAkB;AAClB,0BAA4B;AAwDrB,MAAM,sBAAkB,iCAAsB,MAAM;AAcpD,MAAM,gBAAqC,kBAAE;AAAA,EACnD;AAAA,EACA,kBAAE,OAAO;AAAA,IACR,UAAU,kBAAE,QAAQ,MAAM;AAAA,IAC1B,IAAI;AAAA,IACJ,MAAM,kBAAE;AAAA,IACR,OAAO,kBAAE;AAAA,IACT,MAAM,kBAAE;AAAA,EACT,CAAC;AACF;AAQO,MAAM,mBAAe,iCAAmB,mBAAmB;AAAA,EACjE,SAAS;AACV,CAAC;AAcM,MAAM,qBAAiB,4CAA8B;AAAA,EAC3D,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,IACT;AAAA,MACC,IAAI,aAAa;AAAA,MACjB,IAAI,CAAC,WAAgB;AACpB,eAAO,OAAO,CAAC;AAAA,MAChB;AAAA,IACD;AAAA,EACD;AACD,CAAC;AAoBM,MAAM,qBAAiB,+BAAyB,QAAQ;AAAA,EAC9D,WAAW;AAAA,EACX,OAAO;AACR,CAAC,EAAE,sBAAsB,OAAO;AAAA,EAC/B,MAAM,CAAC;AACR,EAAE;AAmBK,SAAS,OAAO,QAA0C;AAChE,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,OAAO,aAAa;AAC5B;AAkBO,SAAS,SAAS,IAA4B;AACpD,SAAO,eAAe,KAAK,EAAE;AAC9B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|