tiny-essentials 1.29.1 → 1.29.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/changelog/1/29/2.md +82 -0
  2. package/dist/v1/TinyBasicsEs.min.js +1 -1
  3. package/dist/v1/TinyEssentials.min.js +1 -1
  4. package/dist/v1/TinyFetchLoader.min.js +1 -0
  5. package/dist/v1/TinyImageLoader.min.js +1 -0
  6. package/dist/v1/TinyMediaCache.min.js +1 -0
  7. package/dist/v1/TinyMediaLoader.min.js +1 -0
  8. package/dist/v1/basics/index.cjs +5 -0
  9. package/dist/v1/basics/index.d.mts +2 -1
  10. package/dist/v1/basics/index.d.mts.map +1 -1
  11. package/dist/v1/basics/index.mjs +2 -1
  12. package/dist/v1/basics/media/youtube.cjs +275 -0
  13. package/dist/v1/basics/media/youtube.d.mts +107 -0
  14. package/dist/v1/basics/media/youtube.d.mts.map +1 -0
  15. package/dist/v1/basics/media/youtube.mjs +214 -0
  16. package/dist/v1/index.cjs +13 -0
  17. package/dist/v1/index.d.mts +6 -1
  18. package/dist/v1/index.d.mts.map +1 -1
  19. package/dist/v1/index.mjs +7 -2
  20. package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.cjs +0 -1
  21. package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.d.mts +0 -1
  22. package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.d.mts.map +1 -1
  23. package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.mjs +0 -1
  24. package/dist/v1/libs/fs/plugins/OPFS/index.cjs +0 -8
  25. package/dist/v1/libs/fs/plugins/OPFS/index.d.mts +0 -8
  26. package/dist/v1/libs/fs/plugins/OPFS/index.d.mts.map +1 -1
  27. package/dist/v1/libs/fs/plugins/OPFS/index.mjs +0 -8
  28. package/dist/v1/libs/html/TinyHtml.cjs +1 -1
  29. package/dist/v1/libs/html/TinyHtml.d.mts +2 -2
  30. package/dist/v1/libs/html/TinyHtml.d.mts.map +1 -1
  31. package/dist/v1/libs/html/TinyHtml.mjs +1 -1
  32. package/dist/v1/libs/html/loader/TinyMediaLoader.cjs +1999 -0
  33. package/dist/v1/libs/html/loader/TinyMediaLoader.d.mts +999 -0
  34. package/dist/v1/libs/html/loader/TinyMediaLoader.d.mts.map +1 -0
  35. package/dist/v1/libs/html/loader/TinyMediaLoader.mjs +1852 -0
  36. package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.cjs +77 -0
  37. package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.d.mts +103 -0
  38. package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.d.mts.map +1 -0
  39. package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.mjs +67 -0
  40. package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.cjs +630 -0
  41. package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.d.mts +138 -0
  42. package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.d.mts.map +1 -0
  43. package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.mjs +576 -0
  44. package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.cjs +70 -0
  45. package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.d.mts +100 -0
  46. package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.d.mts.map +1 -0
  47. package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.mjs +60 -0
  48. package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.cjs +946 -0
  49. package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.d.mts +67 -0
  50. package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.d.mts.map +1 -0
  51. package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.mjs +896 -0
  52. package/dist/v1/libs/html/loader/formats/TinyFetchLoader.cjs +225 -0
  53. package/dist/v1/libs/html/loader/formats/TinyFetchLoader.d.mts +149 -0
  54. package/dist/v1/libs/html/loader/formats/TinyFetchLoader.d.mts.map +1 -0
  55. package/dist/v1/libs/html/loader/formats/TinyFetchLoader.mjs +197 -0
  56. package/dist/v1/libs/html/loader/formats/TinyImageLoader.cjs +1454 -0
  57. package/dist/v1/libs/html/loader/formats/TinyImageLoader.d.mts +200 -0
  58. package/dist/v1/libs/html/loader/formats/TinyImageLoader.d.mts.map +1 -0
  59. package/dist/v1/libs/html/loader/formats/TinyImageLoader.mjs +1317 -0
  60. package/dist/v1/libs/html/loader/probe/TinyImageProbe.cjs +668 -0
  61. package/dist/v1/libs/html/loader/probe/TinyImageProbe.d.mts +83 -0
  62. package/dist/v1/libs/html/loader/probe/TinyImageProbe.d.mts.map +1 -0
  63. package/dist/v1/libs/html/loader/probe/TinyImageProbe.mjs +626 -0
  64. package/dist/v1/libs/html/loader/utils/TinyBufferReader.cjs +277 -0
  65. package/dist/v1/libs/html/loader/utils/TinyBufferReader.d.mts +118 -0
  66. package/dist/v1/libs/html/loader/utils/TinyBufferReader.d.mts.map +1 -0
  67. package/dist/v1/libs/html/loader/utils/TinyBufferReader.mjs +247 -0
  68. package/dist/v1/libs/html/loader/utils/TinyIsoBox.cjs +128 -0
  69. package/dist/v1/libs/html/loader/utils/TinyIsoBox.d.mts +49 -0
  70. package/dist/v1/libs/html/loader/utils/TinyIsoBox.d.mts.map +1 -0
  71. package/dist/v1/libs/html/loader/utils/TinyIsoBox.mjs +116 -0
  72. package/dist/v1/libs/html/loader/utils/TinyMediaCache.cjs +796 -0
  73. package/dist/v1/libs/html/loader/utils/TinyMediaCache.d.mts +354 -0
  74. package/dist/v1/libs/html/loader/utils/TinyMediaCache.d.mts.map +1 -0
  75. package/dist/v1/libs/html/loader/utils/TinyMediaCache.mjs +734 -0
  76. package/dist/v1/libs/html/loader/utils/TinyMediaMirror.cjs +302 -0
  77. package/dist/v1/libs/html/loader/utils/TinyMediaMirror.d.mts +256 -0
  78. package/dist/v1/libs/html/loader/utils/TinyMediaMirror.d.mts.map +1 -0
  79. package/dist/v1/libs/html/loader/utils/TinyMediaMirror.mjs +280 -0
  80. package/dist/v1/libs/html/loader/utils/TinyMediaProgress.cjs +194 -0
  81. package/dist/v1/libs/html/loader/utils/TinyMediaProgress.d.mts +138 -0
  82. package/dist/v1/libs/html/loader/utils/TinyMediaProgress.d.mts.map +1 -0
  83. package/dist/v1/libs/html/loader/utils/TinyMediaProgress.mjs +175 -0
  84. package/dist/v1/libs/tools/TinyPkgExportValidator.cjs +359 -55
  85. package/dist/v1/libs/tools/TinyPkgExportValidator.d.mts +64 -6
  86. package/dist/v1/libs/tools/TinyPkgExportValidator.d.mts.map +1 -1
  87. package/dist/v1/libs/tools/TinyPkgExportValidator.mjs +320 -57
  88. package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.cjs +0 -1
  89. package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.d.mts +0 -1
  90. package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.d.mts.map +1 -1
  91. package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.mjs +0 -1
  92. package/dist/v1/webTemplates/bootstrap/5.3/scss/background/_background-grid.scss +15 -0
  93. package/dist/v1/webTemplates/bootstrap/5.3/scss/components/buttons/_buttons-contrast.scss +208 -0
  94. package/dist/v1/webTemplates/bootstrap/5.3/scss/components/buttons/_buttons-ghost.scss +89 -0
  95. package/dist/v1/webTemplates/bootstrap/5.3/scss/components/icon/_cube-icon.scss +65 -0
  96. package/dist/v1/webTemplates/bootstrap/5.3/scss/components/icon/_sphere-pulse.scss +39 -0
  97. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_badges.scss +90 -0
  98. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_bootstrap-overrides.scss +495 -0
  99. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_buttons.scss +390 -0
  100. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_colors.scss +213 -0
  101. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_effects.scss +153 -0
  102. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_forms-tones.scss +69 -0
  103. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_forms.scss +323 -0
  104. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_global.scss +31 -0
  105. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_links.scss +47 -0
  106. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_tables.scss +25 -0
  107. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_theme.scss +21 -0
  108. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_tokens.scss +161 -0
  109. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_utilities.scss +81 -0
  110. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_variables.scss +63 -0
  111. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_form-tone-mixins.scss +236 -0
  112. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_sizing.scss +68 -0
  113. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_tone-mixins.scss +392 -0
  114. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_typography.scss +112 -0
  115. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/background/_tiny_gradient_1.scss +131 -0
  116. package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/colors/_pink.scss +47 -0
  117. package/docs/v1/Exports.md +33 -2
  118. package/docs/v1/README.md +9 -0
  119. package/docs/v1/basics/youtube.md +204 -0
  120. package/docs/v1/libs/html/loader/TinyFetchLoader.md +114 -0
  121. package/docs/v1/libs/html/loader/TinyImageLoader.md +141 -0
  122. package/docs/v1/libs/html/loader/TinyMediaCache.md +166 -0
  123. package/docs/v1/libs/html/loader/TinyMediaLoader.md +300 -0
  124. package/docs/v1/libs/tools/TinyPkgExportValidator.md +55 -0
  125. package/docs/v1/webTemplates/bootstrap/5.3/DeepStrap.md +177 -0
  126. package/package.json +244 -8
  127. /package/dist/v1/webTemplates/bootstrap/5.3/scss/input/{Placeholder-Colors-Fix.scss → _placeholder-colors-fix.scss} +0 -0
  128. /package/dist/v1/webTemplates/bootstrap/5.3/scss/spacing/{Spacing-Plus.scss → _spacing-plus.scss} +0 -0
@@ -0,0 +1,128 @@
1
+ 'use strict';
2
+
3
+ var TinyBufferReader = require('./TinyBufferReader.cjs');
4
+
5
+ /**
6
+ * @fileoverview ISO base media file format (ISO/IEC 14496-12) box utilities.
7
+ * Shared by the image and video probes, since HEIC, AVIF, MP4 and MOV all
8
+ * use the same box tree.
9
+ */
10
+
11
+ /**
12
+ * Represents a parsed ISO BMFF box header.
13
+ * @typedef {Object} IsoBox
14
+ * @property {string} type - The 4-character box type.
15
+ * @property {number} start - The offset of the first header byte.
16
+ * @property {number} dataStart - The offset of the first payload byte.
17
+ * @property {number} dataEnd - The offset after the last payload byte.
18
+ * @property {number} end - The offset after the box.
19
+ */
20
+
21
+ /**
22
+ * The boxes whose payload is a plain list of child boxes.
23
+ * @type {ReadonlySet<string>}
24
+ */
25
+ const CONTAINERS = new Set([
26
+ 'moov',
27
+ 'trak',
28
+ 'mdia',
29
+ 'minf',
30
+ 'stbl',
31
+ 'edts',
32
+ 'dinf',
33
+ 'udta',
34
+ 'mvex',
35
+ 'moof',
36
+ 'traf',
37
+ 'iprp',
38
+ 'ipco',
39
+ 'mfra',
40
+ 'skip',
41
+ 'jxl ',
42
+ ]);
43
+
44
+ /**
45
+ * The boxes that start with a 4-byte version/flag field before their children.
46
+ * @type {ReadonlySet<string>}
47
+ */
48
+ const FULL_BOX_CONTAINERS = new Set(['meta']);
49
+
50
+ /**
51
+ * Reads the header of the box starting at the current reader offset.
52
+ * @param {import('./TinyBufferReader.mjs').default} reader - The binary cursor used for reading.
53
+ * @param {number} end - The absolute offset marking the end of the readable buffer.
54
+ * @returns {IsoBox} The parsed box header containing metadata about the box.
55
+ * @throws {TinyNeedMoreData} If the buffer is truncated and cannot provide the full header or payload size.
56
+ */
57
+ function readBox(reader, end) {
58
+ const start = reader.offset;
59
+ const size = reader.uint32();
60
+ const type = reader.ascii(4);
61
+ let headerSize = 8;
62
+ let total = size;
63
+ if (size === 1) {
64
+ total = reader.uint64();
65
+ headerSize = 16;
66
+ } else if (size === 0) {
67
+ total = end - start;
68
+ }
69
+ if (total < headerSize || start + total > end) {
70
+ throw new TinyBufferReader.TinyNeedMoreData();
71
+ }
72
+ return {
73
+ type,
74
+ start,
75
+ dataStart: start + headerSize,
76
+ dataEnd: start + total,
77
+ end: start + total,
78
+ };
79
+ }
80
+
81
+ /**
82
+ * A generator that iterates over all sibling boxes within the specified byte range.
83
+ * @param {import('./TinyBufferReader.mjs').default} reader - The binary cursor used for reading.
84
+ * @param {number} start - The absolute offset where the sequence of boxes begins.
85
+ * @param {number} end - The absolute offset marking the end of the range.
86
+ * @yields {IsoBox} Every complete ISO box found in the specified range.
87
+ */
88
+ function* boxes(reader, start, end) {
89
+ let cursor = start;
90
+ while (cursor + 8 <= end) {
91
+ reader.seek(cursor);
92
+ const box = readBox(reader, end);
93
+ yield box;
94
+ cursor = box.end;
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Recursively searches through the box tree for the first box that matches one of the specified types.
100
+ * @param {import('./TinyBufferReader.mjs').default} reader - The binary cursor used for reading.
101
+ * @param {number} start - The absolute offset where the search begins.
102
+ * @param {number} end - The absolute offset marking the end of the search range.
103
+ * @param {ReadonlySet<string>} types - A set of 4-character box types to match against.
104
+ * @param {number} [depth] - The current recursion depth, used to prevent infinite loops or stack overflows.
105
+ * @returns {IsoBox|null} The first matching box header found, or null if no match exists within the range.
106
+ */
107
+ function findBox(reader, start, end, types, depth = 0) {
108
+ if (depth > 8) {
109
+ return null;
110
+ }
111
+ for (const box of boxes(reader, start, end)) {
112
+ if (types.has(box.type)) {
113
+ return box;
114
+ }
115
+ if (CONTAINERS.has(box.type) || FULL_BOX_CONTAINERS.has(box.type)) {
116
+ const skip = FULL_BOX_CONTAINERS.has(box.type) ? 4 : 0;
117
+ const found = findBox(reader, box.dataStart + skip, box.dataEnd, types, depth + 1);
118
+ if (found) {
119
+ return found;
120
+ }
121
+ }
122
+ }
123
+ return null;
124
+ }
125
+
126
+ exports.boxes = boxes;
127
+ exports.findBox = findBox;
128
+ exports.readBox = readBox;
@@ -0,0 +1,49 @@
1
+ export type IsoBox = {
2
+ /**
3
+ * - The 4-character box type.
4
+ */
5
+ type: string;
6
+ /**
7
+ * - The offset of the first header byte.
8
+ */
9
+ start: number;
10
+ /**
11
+ * - The offset of the first payload byte.
12
+ */
13
+ dataStart: number;
14
+ /**
15
+ * - The offset after the last payload byte.
16
+ */
17
+ dataEnd: number;
18
+ /**
19
+ * - The offset after the box.
20
+ */
21
+ end: number;
22
+ };
23
+ /**
24
+ * Reads the header of the box starting at the current reader offset.
25
+ * @param {import('./TinyBufferReader.mjs').default} reader - The binary cursor used for reading.
26
+ * @param {number} end - The absolute offset marking the end of the readable buffer.
27
+ * @returns {IsoBox} The parsed box header containing metadata about the box.
28
+ * @throws {TinyNeedMoreData} If the buffer is truncated and cannot provide the full header or payload size.
29
+ */
30
+ export declare function readBox(reader: import('./TinyBufferReader.mjs').default, end: number): IsoBox;
31
+ /**
32
+ * A generator that iterates over all sibling boxes within the specified byte range.
33
+ * @param {import('./TinyBufferReader.mjs').default} reader - The binary cursor used for reading.
34
+ * @param {number} start - The absolute offset where the sequence of boxes begins.
35
+ * @param {number} end - The absolute offset marking the end of the range.
36
+ * @yields {IsoBox} Every complete ISO box found in the specified range.
37
+ */
38
+ export declare function boxes(reader: import('./TinyBufferReader.mjs').default, start: number, end: number): Generator<IsoBox, void, unknown>;
39
+ /**
40
+ * Recursively searches through the box tree for the first box that matches one of the specified types.
41
+ * @param {import('./TinyBufferReader.mjs').default} reader - The binary cursor used for reading.
42
+ * @param {number} start - The absolute offset where the search begins.
43
+ * @param {number} end - The absolute offset marking the end of the search range.
44
+ * @param {ReadonlySet<string>} types - A set of 4-character box types to match against.
45
+ * @param {number} [depth] - The current recursion depth, used to prevent infinite loops or stack overflows.
46
+ * @returns {IsoBox|null} The first matching box header found, or null if no match exists within the range.
47
+ */
48
+ export declare function findBox(reader: import('./TinyBufferReader.mjs').default, start: number, end: number, types: ReadonlySet<string>, depth?: number): IsoBox | null;
49
+ //# sourceMappingURL=TinyIsoBox.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TinyIsoBox.d.mts","sourceRoot":"","sources":["../../../../../../src/v1/libs/html/loader/utils/TinyIsoBox.mjs"],"names":[],"mappings":"AASG,YAAkB,MAAM,GACxB;;;;IAAmB,IAAI,EAAZ,MAAM,CACjB;;;;IAAmB,KAAK,EAAb,MAAM,CACjB;;;;IAAmB,SAAS,EAAjB,MAAM,CACjB;;;;IAAmB,OAAO,EAAf,MAAM,CACjB;;;;IAAmB,GAAG,EAAX,MAAM,CACnB;CAAA,CAAA;AA+BD;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,MAAM,EALnB,OAAO,wBAAwB,EAAE,OAKd,EAAE,GAAG,EAJxB,MAIwB,GAHtB,MAAM,CAyBlB;AAED;;;;;;GAMG;AACH,wBAAiB,KAAK,CAAC,MAAM,EALlB,OAAO,wBAAwB,EAAE,OAKf,EAAE,KAAK,EAJzB,MAIyB,EAAE,GAAG,EAH9B,MAG8B,oCAQxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAPnB,OAAO,wBAAwB,EAAE,OAOd,EAAE,KAAK,EAN1B,MAM0B,EAAE,GAAG,EAL/B,MAK+B,EAAE,KAAK,EAJtC,WAAW,CAAC,MAAM,CAIoB,EAAE,KAAK,AAHrD,CACA,EADQ,MAGiD,GAF/C,MAAM,GAAC,IAAI,CAmBvB"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * @fileoverview ISO base media file format (ISO/IEC 14496-12) box utilities.
3
+ * Shared by the image and video probes, since HEIC, AVIF, MP4 and MOV all
4
+ * use the same box tree.
5
+ */
6
+ import { TinyNeedMoreData } from './TinyBufferReader.mjs';
7
+ /**
8
+ * Represents a parsed ISO BMFF box header.
9
+ * @typedef {Object} IsoBox
10
+ * @property {string} type - The 4-character box type.
11
+ * @property {number} start - The offset of the first header byte.
12
+ * @property {number} dataStart - The offset of the first payload byte.
13
+ * @property {number} dataEnd - The offset after the last payload byte.
14
+ * @property {number} end - The offset after the box.
15
+ */
16
+ /**
17
+ * The boxes whose payload is a plain list of child boxes.
18
+ * @type {ReadonlySet<string>}
19
+ */
20
+ const CONTAINERS = new Set([
21
+ 'moov',
22
+ 'trak',
23
+ 'mdia',
24
+ 'minf',
25
+ 'stbl',
26
+ 'edts',
27
+ 'dinf',
28
+ 'udta',
29
+ 'mvex',
30
+ 'moof',
31
+ 'traf',
32
+ 'iprp',
33
+ 'ipco',
34
+ 'mfra',
35
+ 'skip',
36
+ 'jxl ',
37
+ ]);
38
+ /**
39
+ * The boxes that start with a 4-byte version/flag field before their children.
40
+ * @type {ReadonlySet<string>}
41
+ */
42
+ const FULL_BOX_CONTAINERS = new Set(['meta']);
43
+ /**
44
+ * Reads the header of the box starting at the current reader offset.
45
+ * @param {import('./TinyBufferReader.mjs').default} reader - The binary cursor used for reading.
46
+ * @param {number} end - The absolute offset marking the end of the readable buffer.
47
+ * @returns {IsoBox} The parsed box header containing metadata about the box.
48
+ * @throws {TinyNeedMoreData} If the buffer is truncated and cannot provide the full header or payload size.
49
+ */
50
+ export function readBox(reader, end) {
51
+ const start = reader.offset;
52
+ const size = reader.uint32();
53
+ const type = reader.ascii(4);
54
+ let headerSize = 8;
55
+ let total = size;
56
+ if (size === 1) {
57
+ total = reader.uint64();
58
+ headerSize = 16;
59
+ }
60
+ else if (size === 0) {
61
+ total = end - start;
62
+ }
63
+ if (total < headerSize || start + total > end) {
64
+ throw new TinyNeedMoreData();
65
+ }
66
+ return {
67
+ type,
68
+ start,
69
+ dataStart: start + headerSize,
70
+ dataEnd: start + total,
71
+ end: start + total,
72
+ };
73
+ }
74
+ /**
75
+ * A generator that iterates over all sibling boxes within the specified byte range.
76
+ * @param {import('./TinyBufferReader.mjs').default} reader - The binary cursor used for reading.
77
+ * @param {number} start - The absolute offset where the sequence of boxes begins.
78
+ * @param {number} end - The absolute offset marking the end of the range.
79
+ * @yields {IsoBox} Every complete ISO box found in the specified range.
80
+ */
81
+ export function* boxes(reader, start, end) {
82
+ let cursor = start;
83
+ while (cursor + 8 <= end) {
84
+ reader.seek(cursor);
85
+ const box = readBox(reader, end);
86
+ yield box;
87
+ cursor = box.end;
88
+ }
89
+ }
90
+ /**
91
+ * Recursively searches through the box tree for the first box that matches one of the specified types.
92
+ * @param {import('./TinyBufferReader.mjs').default} reader - The binary cursor used for reading.
93
+ * @param {number} start - The absolute offset where the search begins.
94
+ * @param {number} end - The absolute offset marking the end of the search range.
95
+ * @param {ReadonlySet<string>} types - A set of 4-character box types to match against.
96
+ * @param {number} [depth] - The current recursion depth, used to prevent infinite loops or stack overflows.
97
+ * @returns {IsoBox|null} The first matching box header found, or null if no match exists within the range.
98
+ */
99
+ export function findBox(reader, start, end, types, depth = 0) {
100
+ if (depth > 8) {
101
+ return null;
102
+ }
103
+ for (const box of boxes(reader, start, end)) {
104
+ if (types.has(box.type)) {
105
+ return box;
106
+ }
107
+ if (CONTAINERS.has(box.type) || FULL_BOX_CONTAINERS.has(box.type)) {
108
+ const skip = FULL_BOX_CONTAINERS.has(box.type) ? 4 : 0;
109
+ const found = findBox(reader, box.dataStart + skip, box.dataEnd, types, depth + 1);
110
+ if (found) {
111
+ return found;
112
+ }
113
+ }
114
+ }
115
+ return null;
116
+ }