hyperframes 0.8.49 → 0.8.50

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.
@@ -56074,6 +56074,40 @@ function isSceneLikeCompositionId(compositionId) {
56074
56074
  return true;
56075
56075
  }
56076
56076
 
56077
+ // ../parsers/dist/topLevelElements.js
56078
+ var NON_RENDERED_TAGS = /* @__PURE__ */ new Set(["script", "style", "template", "noscript", "link", "meta"]);
56079
+ var MEDIA_TAGS = /* @__PURE__ */ new Set(["video", "audio", "img"]);
56080
+ var TRACK_KINDS = ["video", "audio", "captions", "graphics"];
56081
+ function isSubCompositionHost(node) {
56082
+ return node.attrs["data-composition-src"] !== void 0 || node.attrs["data-composition-id"] !== void 0;
56083
+ }
56084
+ function isTimedElement(node) {
56085
+ const { attrs } = node;
56086
+ return attrs["data-start"] !== void 0 || attrs["data-track-index"] !== void 0 && attrs["data-duration"] !== void 0 || MEDIA_TAGS.has(node.tag.toLowerCase());
56087
+ }
56088
+ function topLevelElements(root) {
56089
+ const rows = [];
56090
+ const visit = (node) => {
56091
+ if (NON_RENDERED_TAGS.has(node.tag.toLowerCase())) return;
56092
+ if (isSubCompositionHost(node) || isTimedElement(node)) rows.push(node);
56093
+ else node.children.forEach(visit);
56094
+ };
56095
+ root.children.forEach(visit);
56096
+ return rows;
56097
+ }
56098
+ function trackKindOf(node) {
56099
+ const explicit = node.attrs["data-track-kind"]?.trim().toLowerCase();
56100
+ if (explicit && TRACK_KINDS.includes(explicit))
56101
+ return { kind: explicit, source: "attribute" };
56102
+ const tag = node.tag.toLowerCase();
56103
+ if (tag === "video" || tag === "audio") return { kind: tag, source: "tag" };
56104
+ if (isSubCompositionHost(node)) {
56105
+ const legacy = node.attrs["data-composition-id"] === "captions" || /(?:^|\s)caption[-_]/.test(node.attrs.class ?? "");
56106
+ return legacy ? { kind: "captions", source: "legacy-captions" } : { kind: "graphics", source: "sub-composition" };
56107
+ }
56108
+ return { kind: "graphics", source: "tag" };
56109
+ }
56110
+
56077
56111
  // ../lint/dist/index.js
56078
56112
  import { createHash } from "crypto";
56079
56113
  import { existsSync as existsSync22, readFileSync as readFileSync3, readdirSync as readdirSync3 } from "fs";
@@ -61641,6 +61675,152 @@ var slideshowRules = [
61641
61675
  return findings;
61642
61676
  }
61643
61677
  ];
61678
+ var INLINE_TEXT_TAGS = /* @__PURE__ */ new Set([
61679
+ "br",
61680
+ "wbr",
61681
+ "b",
61682
+ "i",
61683
+ "u",
61684
+ "s",
61685
+ "em",
61686
+ "strong",
61687
+ "small",
61688
+ "sub",
61689
+ "sup",
61690
+ "mark",
61691
+ "span",
61692
+ "a",
61693
+ "code",
61694
+ "abbr"
61695
+ ]);
61696
+ var OPAQUE_TAGS = /* @__PURE__ */ new Set([
61697
+ "svg",
61698
+ "canvas",
61699
+ "picture",
61700
+ "video",
61701
+ "audio",
61702
+ "select",
61703
+ "textarea",
61704
+ "iframe",
61705
+ "object"
61706
+ ]);
61707
+ var NON_LAYOUT_TAGS = /* @__PURE__ */ new Set(["style", "script", "template", "noscript"]);
61708
+ var MEDIA_TAGS2 = /* @__PURE__ */ new Set(["img", "video", "audio"]);
61709
+ var NODE_ATTRS = [
61710
+ "id",
61711
+ "class",
61712
+ "data-start",
61713
+ "data-duration",
61714
+ "data-end",
61715
+ "data-track",
61716
+ "data-track-index",
61717
+ "data-track-kind",
61718
+ "data-composition-id",
61719
+ "data-composition-src"
61720
+ ];
61721
+ function toNode(open) {
61722
+ const attrs = {};
61723
+ for (const name of NODE_ATTRS) attrs[name] = readDecodedAttr(open.raw, name) ?? void 0;
61724
+ return { tag: open.name, attrs, children: [], open };
61725
+ }
61726
+ function enclosing(stack, root, index) {
61727
+ let top = stack.at(-1);
61728
+ while (top && stack.length > 1 && index >= top.end) {
61729
+ stack.pop();
61730
+ top = stack.at(-1);
61731
+ }
61732
+ return top?.node ?? root;
61733
+ }
61734
+ function buildTree(ctx) {
61735
+ const { rootTag } = ctx;
61736
+ const rootEnd = rootTag?.closeIndex;
61737
+ if (!rootTag || rootEnd == null) return null;
61738
+ const root = toNode(rootTag);
61739
+ const stack = [{ node: root, end: rootEnd }];
61740
+ for (const tag of ctx.tags.filter((t) => t.index > rootTag.index && t.index < rootEnd)) {
61741
+ const node = toNode(tag);
61742
+ enclosing(stack, root, tag.index).children.push(node);
61743
+ if (tag.closeIndex != null) stack.push({ node, end: tag.closeIndex });
61744
+ }
61745
+ return root;
61746
+ }
61747
+ function hasNestedStructure(node) {
61748
+ if (OPAQUE_TAGS.has(node.tag)) return null;
61749
+ for (const child of node.children) {
61750
+ if (NON_LAYOUT_TAGS.has(child.tag)) continue;
61751
+ if (!INLINE_TEXT_TAGS.has(child.tag)) return child;
61752
+ const deeper = hasNestedStructure(child);
61753
+ if (deeper) return deeper;
61754
+ }
61755
+ return null;
61756
+ }
61757
+ var describe = (node) => `<${node.tag}${node.attrs.id ? ` id="${node.attrs.id}"` : ""}>`;
61758
+ function nestedStructureFindings(rows, severity) {
61759
+ return rows.flatMap((row) => {
61760
+ const nested = isSubCompositionHost(row) ? null : hasNestedStructure(row);
61761
+ if (!nested) return [];
61762
+ return [
61763
+ {
61764
+ code: "nested_structure_needs_subcomposition",
61765
+ severity,
61766
+ message: `${describe(row)} is a timeline element that contains nested ${describe(nested)}. The timeline shows one row per top-level element, and the root composition is built only from sub-compositions.`,
61767
+ elementId: row.attrs.id,
61768
+ fixHint: `Move ${describe(row)} and its contents into a sub-composition file and mount it with data-composition-src.`
61769
+ }
61770
+ ];
61771
+ });
61772
+ }
61773
+ function missingDurationFindings(rows, severity) {
61774
+ const intendedClip = (row) => !MEDIA_TAGS2.has(row.tag) || row.attrs["data-start"] !== void 0 || row.attrs["data-track-index"] !== void 0;
61775
+ return rows.filter(
61776
+ (row) => row.attrs["data-duration"] === void 0 && row.attrs["data-end"] === void 0 && !isSubCompositionHost(row) && intendedClip(row)
61777
+ ).map((row) => {
61778
+ const isMedia = MEDIA_TAGS2.has(row.tag);
61779
+ return {
61780
+ code: isMedia ? "media_missing_duration" : "timeline_element_missing_timing",
61781
+ severity,
61782
+ message: isMedia ? `${describe(row)} is media on the timeline without data-duration, so its clip has no length.` : `${describe(row)} is a timeline element without data-duration, so the timeline cannot draw where it ends.`,
61783
+ elementId: row.attrs.id,
61784
+ fixHint: `Add data-duration (in seconds) to ${describe(row)}.`
61785
+ };
61786
+ });
61787
+ }
61788
+ function captionFindings(rows, severity) {
61789
+ const captionRows = rows.filter((row) => trackKindOf(row).kind === "captions");
61790
+ const findings = captionRows.filter((row) => trackKindOf(row).source === "legacy-captions").map((row) => ({
61791
+ code: "caption_track_kind_missing",
61792
+ severity,
61793
+ message: `${describe(row)} looks like captions but is not marked as such, so the timeline cannot group it on the caption track.`,
61794
+ elementId: row.attrs.id,
61795
+ fixHint: `Add data-track-kind="captions" to ${describe(row)}.`
61796
+ }));
61797
+ const lanes = new Set(
61798
+ captionRows.flatMap((row) => row.attrs["data-track-index"] ?? row.attrs["data-track"] ?? [])
61799
+ );
61800
+ if (lanes.size > 1) {
61801
+ findings.push({
61802
+ code: "multiple_caption_tracks",
61803
+ severity,
61804
+ message: `Captions are spread across ${lanes.size} timeline tracks. Keep all captions on one track.`,
61805
+ fixHint: "Give every caption element the same data-track-index."
61806
+ });
61807
+ }
61808
+ return findings;
61809
+ }
61810
+ var structureRules = [
61811
+ (ctx) => {
61812
+ if (ctx.options.isSubComposition) return [];
61813
+ const root = buildTree(ctx);
61814
+ if (!root) return [];
61815
+ const severity = ctx.options.host === "studio" ? "error" : "warning";
61816
+ const rows = topLevelElements(root);
61817
+ return [
61818
+ ...nestedStructureFindings(rows, severity),
61819
+ ...missingDurationFindings(rows, severity),
61820
+ ...captionFindings(rows, severity)
61821
+ ];
61822
+ }
61823
+ ];
61644
61824
  var RULE_GROUPS = [
61645
61825
  { group: "core", rules: coreRules },
61646
61826
  { group: "media", rules: mediaRules },
@@ -61650,7 +61830,8 @@ var RULE_GROUPS = [
61650
61830
  { group: "adapters", rules: adapterRules },
61651
61831
  { group: "textures", rules: textureRules },
61652
61832
  { group: "fonts", rules: fontRules },
61653
- { group: "slideshow", rules: slideshowRules }
61833
+ { group: "slideshow", rules: slideshowRules },
61834
+ { group: "structure", rules: structureRules }
61654
61835
  ];
61655
61836
  var LINT_RULE_COUNT = RULE_GROUPS.reduce((n, g) => n + g.rules.length, 0);
61656
61837
  var LINT_RULE_GROUP_COUNTS = Object.fromEntries(
@@ -62008,7 +62189,7 @@ function resolveCssAssetCandidates(projectDir, url, htmlCompSrcPath, cssRootRela
62008
62189
  }
62009
62190
  return resolveLocalAssetCandidates(projectDir, url);
62010
62191
  }
62011
- async function lintProject(projectDir, entryFile) {
62192
+ async function lintProject(projectDir, entryFile, hostOptions = {}) {
62012
62193
  const indexPath = entryFile ? resolve4(entryFile) : resolve4(projectDir, "index.html");
62013
62194
  if (entryFile && !isWithinProjectRoot(projectDir, indexPath)) {
62014
62195
  throw new Error(`Explicit lint entry is outside the project directory: ${entryFile}`);
@@ -62021,6 +62202,7 @@ async function lintProject(projectDir, entryFile) {
62021
62202
  let totalInfos = 0;
62022
62203
  const rootHtml = readFileSync3(indexPath, "utf-8");
62023
62204
  const rootResult = await lintHyperframeHtml(rootHtml, {
62205
+ ...hostOptions,
62024
62206
  filePath: indexPath,
62025
62207
  externalStyles: collectExternalStyles(projectDir, rootHtml, rootCompSrcPath)
62026
62208
  });
@@ -62052,6 +62234,7 @@ async function lintProject(projectDir, entryFile) {
62052
62234
  allHtmlSources.push({ html, compSrcPath });
62053
62235
  if (isSnippetFragment(html)) continue;
62054
62236
  const result2 = await lintHyperframeHtml(html, {
62237
+ ...hostOptions,
62055
62238
  filePath,
62056
62239
  isSubComposition: true,
62057
62240
  externalStyles: collectExternalStyles(projectDir, html, compSrcPath)
@@ -1,4 +1,4 @@
1
- var we=Object.defineProperty;var Ae=(s,i,e)=>i in s?we(s,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[i]=e;var u=(s,i,e)=>Ae(s,typeof i!="symbol"?i+"":i,e);import{r as ue,i as w,a as he,b as Ee,c as Te,s as Ce,d as Re}from"./index-Bgmx2h7W.js";function Se(s){return s.hasRuntime||s.runtimeInjected?!1:!!(s.hasNestedCompositions||s.hasTimelines&&s.attempts>=5)}function $(s){return typeof s=="object"&&s!==null}function xe(s){return $(s)&&typeof s.getDuration=="function"}function Le(s){return $(s)&&typeof s.duration=="function"&&typeof s.time=="function"&&typeof s.seek=="function"&&typeof s.play=="function"&&typeof s.pause=="function"}function Me(s){if(!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(s))throw new Error(`Invalid HyperFrames runtime version: ${s}`);return`https://cdn.jsdelivr.net/npm/@hyperframes/core@${s}/dist/hyperframe.runtime.iife.js`}const H=typeof __HYPERFRAMES_RUNTIME_CDN_URL__=="string"?__HYPERFRAMES_RUNTIME_CDN_URL__:Me("0.0.0-dev");function V(s){if(s===null)return null;const i=Number.parseInt(s,10);return Number.isFinite(i)&&i>0?i:null}function De(s){const i=(s==null?void 0:s.querySelector("[data-composition-id][data-width][data-height]"))??(s==null?void 0:s.querySelector("[data-width][data-height]"));if(!i)return null;const e=V(i.getAttribute("data-width")),t=V(i.getAttribute("data-height"));return e!==null&&t!==null?{width:e,height:t}:null}class Pe{constructor(i,e){u(this,"_interval",null);u(this,"_runtimeInjected",!1);this._iframe=i,this._callbacks=e}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let i=0;this._interval=setInterval(()=>{var e;i++;try{const t=this._iframe.contentWindow;if(!t)return;const r=!!(t.__hf||t.__player),n=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!((e=this._iframe.contentDocument)!=null&&e.querySelector("[data-composition-src]"));if(Se({hasRuntime:r,hasTimelines:n,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:i})){this._injectRuntime();return}if(this._runtimeInjected&&!r)return;const d=this._resolvePlaybackDurationAdapter(t);if(d&&d.getDuration()>0){this.stop();const c=De(this._iframe.contentDocument);this._callbacks.onReady({duration:d.getDuration(),adapter:d,compositionSize:c});return}}catch{}i>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{const i=this._iframe.contentWindow;return i?this._resolveDirectTimelineAdapterFromWindow(i):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(i){return this._resolveDirectTimelineAdapterFromWindow(i)}hasRuntimeBridge(i){return Reflect.get(i,"__hf")!==void 0||$(Reflect.get(i,"__player"))}_injectRuntime(){var i,e;this._runtimeInjected=!0;try{const t=this._iframe.contentDocument;if(!t)return;const r=t.createElement("script");r.src=H,(t.head||t.documentElement).appendChild(r),(e=(i=this._callbacks).onRuntimeInjected)==null||e.call(i)}catch{}}_resolveDirectTimelineAdapterFromWindow(i){var d,c;if(this.hasRuntimeBridge(i))return null;const e=Reflect.get(i,"__timelines");if(!$(e))return null;const t=Object.keys(e);if(t.length===0)return null;const r=(c=(d=this._iframe.contentDocument)==null?void 0:d.querySelector("[data-composition-id]"))==null?void 0:c.getAttribute("data-composition-id"),n=r&&r in e?r:t[t.length-1],o=e[n];return Le(o)?o:null}_resolvePlaybackDurationAdapter(i){const e=Reflect.get(i,"__player");if(xe(e))return{kind:"runtime",getDuration:()=>e.getDuration()};const t=this._resolveDirectTimelineAdapterFromWindow(i);return t?{kind:"direct-timeline",timeline:t,getDuration:()=>t.duration()}:null}}const ke=`
1
+ var we=Object.defineProperty;var Ae=(s,i,e)=>i in s?we(s,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[i]=e;var u=(s,i,e)=>Ae(s,typeof i!="symbol"?i+"":i,e);import{r as ue,i as w,a as he,b as Ee,c as Te,s as Ce,d as Re}from"./index-n2ml4tUn.js";function Se(s){return s.hasRuntime||s.runtimeInjected?!1:!!(s.hasNestedCompositions||s.hasTimelines&&s.attempts>=5)}function $(s){return typeof s=="object"&&s!==null}function xe(s){return $(s)&&typeof s.getDuration=="function"}function Le(s){return $(s)&&typeof s.duration=="function"&&typeof s.time=="function"&&typeof s.seek=="function"&&typeof s.play=="function"&&typeof s.pause=="function"}function Me(s){if(!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(s))throw new Error(`Invalid HyperFrames runtime version: ${s}`);return`https://cdn.jsdelivr.net/npm/@hyperframes/core@${s}/dist/hyperframe.runtime.iife.js`}const H=typeof __HYPERFRAMES_RUNTIME_CDN_URL__=="string"?__HYPERFRAMES_RUNTIME_CDN_URL__:Me("0.0.0-dev");function V(s){if(s===null)return null;const i=Number.parseInt(s,10);return Number.isFinite(i)&&i>0?i:null}function De(s){const i=(s==null?void 0:s.querySelector("[data-composition-id][data-width][data-height]"))??(s==null?void 0:s.querySelector("[data-width][data-height]"));if(!i)return null;const e=V(i.getAttribute("data-width")),t=V(i.getAttribute("data-height"));return e!==null&&t!==null?{width:e,height:t}:null}class Pe{constructor(i,e){u(this,"_interval",null);u(this,"_runtimeInjected",!1);this._iframe=i,this._callbacks=e}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let i=0;this._interval=setInterval(()=>{var e;i++;try{const t=this._iframe.contentWindow;if(!t)return;const r=!!(t.__hf||t.__player),n=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!((e=this._iframe.contentDocument)!=null&&e.querySelector("[data-composition-src]"));if(Se({hasRuntime:r,hasTimelines:n,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:i})){this._injectRuntime();return}if(this._runtimeInjected&&!r)return;const d=this._resolvePlaybackDurationAdapter(t);if(d&&d.getDuration()>0){this.stop();const c=De(this._iframe.contentDocument);this._callbacks.onReady({duration:d.getDuration(),adapter:d,compositionSize:c});return}}catch{}i>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{const i=this._iframe.contentWindow;return i?this._resolveDirectTimelineAdapterFromWindow(i):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(i){return this._resolveDirectTimelineAdapterFromWindow(i)}hasRuntimeBridge(i){return Reflect.get(i,"__hf")!==void 0||$(Reflect.get(i,"__player"))}_injectRuntime(){var i,e;this._runtimeInjected=!0;try{const t=this._iframe.contentDocument;if(!t)return;const r=t.createElement("script");r.src=H,(t.head||t.documentElement).appendChild(r),(e=(i=this._callbacks).onRuntimeInjected)==null||e.call(i)}catch{}}_resolveDirectTimelineAdapterFromWindow(i){var d,c;if(this.hasRuntimeBridge(i))return null;const e=Reflect.get(i,"__timelines");if(!$(e))return null;const t=Object.keys(e);if(t.length===0)return null;const r=(c=(d=this._iframe.contentDocument)==null?void 0:d.querySelector("[data-composition-id]"))==null?void 0:c.getAttribute("data-composition-id"),n=r&&r in e?r:t[t.length-1],o=e[n];return Le(o)?o:null}_resolvePlaybackDurationAdapter(i){const e=Reflect.get(i,"__player");if(xe(e))return{kind:"runtime",getDuration:()=>e.getDuration()};const t=this._resolveDirectTimelineAdapterFromWindow(i);return t?{kind:"direct-timeline",timeline:t,getDuration:()=>t.duration()}:null}}const ke=`
2
2
  :host {
3
3
  display: block;
4
4
  position: relative;
@@ -1 +1 @@
1
- import{g as P}from"./index-Bgmx2h7W.js";function j(c,d){for(var s=0;s<d.length;s++){const a=d[s];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in c)){const l=Object.getOwnPropertyDescriptor(a,i);l&&Object.defineProperty(c,i,l.get?l:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}))}var v={},w;function k(){if(w)return v;w=1,Object.defineProperty(v,"__esModule",{value:!0}),v.default=d;var c=window.OfflineAudioContext||window.webkitOfflineAudioContext;function d(e){var r=a(e);return r.start(0),[i,y,O(e.sampleRate),s].reduce(function(t,o){return o(t)},r.buffer.getChannelData(0))}function s(e){return e.sort(function(r,t){return t.count-r.count}).splice(0,5)[0].tempo}function a(e){var r=e.length,t=e.numberOfChannels,o=e.sampleRate,n=new c(t,r,o),u=n.createBufferSource();u.buffer=e;var f=n.createBiquadFilter();return f.type="lowpass",u.connect(f),f.connect(n.destination),u}function i(e){for(var r=[],t=.9,o=.3,n=15;r.length<n&&t>=o;)r=l(e,t),t-=.05;if(r.length<n)throw new Error("Could not find enough samples for a reliable detection.");return r}function l(e,r){for(var t=[],o=0,n=e.length;o<n;o+=1)e[o]>r&&(t.push(o),o+=1e4);return t}function y(e){var r=[];return e.forEach(function(t,o){for(var n=function(x){var g=e[o+x]-t,_=r.some(function(h){if(h.interval===g)return h.count+=1});_||r.push({interval:g,count:1})},u=0;u<10;u+=1)n(u)}),r}function O(e){return function(r){var t=[];return r.forEach(function(o){if(o.interval!==0){for(var n=60/(o.interval/e);n<90;)n*=2;for(;n>180;)n/=2;n=Math.round(n);var u=t.some(function(f){if(f.tempo===n)return f.count+=o.count});u||t.push({tempo:n,count:o.count})}}),t}}return v}var p,b;function q(){return b||(b=1,p=k().default),p}var m=q();const A=P(m),D=j({__proto__:null,default:A},[m]);export{D as i};
1
+ import{g as P}from"./index-n2ml4tUn.js";function j(c,d){for(var s=0;s<d.length;s++){const a=d[s];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in c)){const l=Object.getOwnPropertyDescriptor(a,i);l&&Object.defineProperty(c,i,l.get?l:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}))}var v={},w;function k(){if(w)return v;w=1,Object.defineProperty(v,"__esModule",{value:!0}),v.default=d;var c=window.OfflineAudioContext||window.webkitOfflineAudioContext;function d(e){var r=a(e);return r.start(0),[i,y,O(e.sampleRate),s].reduce(function(t,o){return o(t)},r.buffer.getChannelData(0))}function s(e){return e.sort(function(r,t){return t.count-r.count}).splice(0,5)[0].tempo}function a(e){var r=e.length,t=e.numberOfChannels,o=e.sampleRate,n=new c(t,r,o),u=n.createBufferSource();u.buffer=e;var f=n.createBiquadFilter();return f.type="lowpass",u.connect(f),f.connect(n.destination),u}function i(e){for(var r=[],t=.9,o=.3,n=15;r.length<n&&t>=o;)r=l(e,t),t-=.05;if(r.length<n)throw new Error("Could not find enough samples for a reliable detection.");return r}function l(e,r){for(var t=[],o=0,n=e.length;o<n;o+=1)e[o]>r&&(t.push(o),o+=1e4);return t}function y(e){var r=[];return e.forEach(function(t,o){for(var n=function(x){var g=e[o+x]-t,_=r.some(function(h){if(h.interval===g)return h.count+=1});_||r.push({interval:g,count:1})},u=0;u<10;u+=1)n(u)}),r}function O(e){return function(r){var t=[];return r.forEach(function(o){if(o.interval!==0){for(var n=60/(o.interval/e);n<90;)n*=2;for(;n>180;)n/=2;n=Math.round(n);var u=t.some(function(f){if(f.tempo===n)return f.count+=o.count});u||t.push({tempo:n,count:o.count})}}),t}}return v}var p,b;function q(){return b||(b=1,p=k().default),p}var m=q();const A=P(m),D=j({__proto__:null,default:A},[m]);export{D as i};
@@ -1,4 +1,4 @@
1
- import{n as Qi}from"./index-Bgmx2h7W.js";/*!
1
+ import{n as Qi}from"./index-n2ml4tUn.js";/*!
2
2
  * Copyright (c) 2026-present, Vanilagy and contributors
3
3
  *
4
4
  * This Source Code Form is subject to the terms of the Mozilla Public