hyperframes 0.8.10 → 0.8.12
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/cli.js +812 -386
- package/dist/hyperframe-runtime.js +81 -32
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +81 -32
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/skills/hyperframes/SKILL.md +9 -9
- package/dist/studio/assets/{hyperframes-player-DoTrWV8q.js → hyperframes-player-B243szNa.js} +1 -1
- package/dist/studio/assets/{index-DV45YLqR.js → index-BTP86sD-.js} +1 -1
- package/dist/studio/assets/index-BZfUJ2He.js +431 -0
- package/dist/studio/assets/{index-BQs1fahB.js → index-DQ_lkuqY.js} +1 -1
- package/dist/studio/assets/index-yGhfxxoL.css +1 -0
- package/dist/studio/{chunk-ZALQ3CW7.js → chunk-6BT6DTB4.js} +2 -1
- package/dist/studio/{domEditingLayers-XRVXRTNX.js → domEditingLayers-URA7BLWE.js} +2 -2
- package/dist/studio/index.d.ts +84 -43
- package/dist/studio/index.html +2 -2
- package/dist/studio/index.js +6440 -5514
- package/dist/studio/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/studio/assets/index-Ba9zbpT9.css +0 -1
- package/dist/studio/assets/index-C6m2nHiX.js +0 -428
- /package/dist/studio/{chunk-ZALQ3CW7.js.map → chunk-6BT6DTB4.js.map} +0 -0
- /package/dist/studio/{domEditingLayers-XRVXRTNX.js.map → domEditingLayers-URA7BLWE.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -50,7 +50,7 @@ var VERSION;
|
|
|
50
50
|
var init_version = __esm({
|
|
51
51
|
"src/version.ts"() {
|
|
52
52
|
"use strict";
|
|
53
|
-
VERSION = true ? "0.8.
|
|
53
|
+
VERSION = true ? "0.8.12" : "0.0.0-dev";
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
|
|
@@ -660,6 +660,36 @@ var init_slideshow2 = __esm({
|
|
|
660
660
|
}
|
|
661
661
|
});
|
|
662
662
|
|
|
663
|
+
// ../core/dist/runtime/authoredTiming.js
|
|
664
|
+
function finiteNumber(value) {
|
|
665
|
+
if (value == null)
|
|
666
|
+
return null;
|
|
667
|
+
if (typeof value === "string" && value.trim() === "")
|
|
668
|
+
return null;
|
|
669
|
+
const parsed = typeof value === "number" ? value : Number(value);
|
|
670
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
671
|
+
}
|
|
672
|
+
function resolveAuthoredTimingWindow(values) {
|
|
673
|
+
const parsedStart = finiteNumber(values.start);
|
|
674
|
+
if (parsedStart == null)
|
|
675
|
+
return null;
|
|
676
|
+
const start = Math.max(0, parsedStart);
|
|
677
|
+
const publicDuration = finiteNumber(values.duration);
|
|
678
|
+
const preservedDuration = finiteNumber(values.authoredDuration);
|
|
679
|
+
const duration = publicDuration != null && publicDuration > 0 ? publicDuration : preservedDuration != null && preservedDuration > 0 ? preservedDuration : null;
|
|
680
|
+
if (duration != null)
|
|
681
|
+
return { start, duration, end: start + duration };
|
|
682
|
+
const publicEnd = finiteNumber(values.end);
|
|
683
|
+
const preservedEnd = finiteNumber(values.authoredEnd);
|
|
684
|
+
const end = publicEnd != null && publicEnd > start ? publicEnd : preservedEnd != null && preservedEnd > start ? preservedEnd : null;
|
|
685
|
+
return { start, duration: end == null ? null : end - start, end };
|
|
686
|
+
}
|
|
687
|
+
var init_authoredTiming = __esm({
|
|
688
|
+
"../core/dist/runtime/authoredTiming.js"() {
|
|
689
|
+
"use strict";
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
|
|
663
693
|
// ../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
|
|
664
694
|
var tslib_es6_exports = {};
|
|
665
695
|
__export(tslib_es6_exports, {
|
|
@@ -56274,13 +56304,55 @@ function assignMediaRenderIds(document2) {
|
|
|
56274
56304
|
taken.add(renderId);
|
|
56275
56305
|
el.setAttribute(MEDIA_RENDER_ID_ATTR, renderId);
|
|
56276
56306
|
}
|
|
56307
|
+
assignAudioGroupRenderIds(document2, taken);
|
|
56308
|
+
}
|
|
56309
|
+
function assignAudioGroupRenderIds(document2, taken) {
|
|
56310
|
+
const busesById = stampAudioGroupBuses(document2, taken);
|
|
56311
|
+
if (busesById.size === 0)
|
|
56312
|
+
return;
|
|
56313
|
+
for (const member of document2.querySelectorAll("audio[data-audio-group]")) {
|
|
56314
|
+
const groupId = member.getAttribute("data-audio-group");
|
|
56315
|
+
const buses = groupId ? busesById.get(groupId) : void 0;
|
|
56316
|
+
if (!groupId || !buses?.length)
|
|
56317
|
+
continue;
|
|
56318
|
+
const renderId = busForMember(member, groupId, buses)?.getAttribute(MEDIA_RENDER_ID_ATTR);
|
|
56319
|
+
if (renderId)
|
|
56320
|
+
member.setAttribute(AUDIO_GROUP_RENDER_ID_ATTR, renderId);
|
|
56321
|
+
}
|
|
56322
|
+
}
|
|
56323
|
+
function stampAudioGroupBuses(document2, taken) {
|
|
56324
|
+
const busesById = /* @__PURE__ */ new Map();
|
|
56325
|
+
for (const bus of document2.querySelectorAll(AUDIO_GROUP_SELECTOR)) {
|
|
56326
|
+
const id = bus.getAttribute("id");
|
|
56327
|
+
if (!id)
|
|
56328
|
+
continue;
|
|
56329
|
+
const renderId = bus.getAttribute(MEDIA_RENDER_ID_ATTR) ?? uniqueRenderId(id, taken);
|
|
56330
|
+
taken.add(renderId);
|
|
56331
|
+
bus.setAttribute(MEDIA_RENDER_ID_ATTR, renderId);
|
|
56332
|
+
const existing = busesById.get(id);
|
|
56333
|
+
if (existing)
|
|
56334
|
+
existing.push(bus);
|
|
56335
|
+
else
|
|
56336
|
+
busesById.set(id, [bus]);
|
|
56337
|
+
}
|
|
56338
|
+
return busesById;
|
|
56339
|
+
}
|
|
56340
|
+
function busForMember(member, groupId, buses) {
|
|
56341
|
+
if (buses.length === 1)
|
|
56342
|
+
return buses[0];
|
|
56343
|
+
const scope = member.closest?.("[data-composition-id]");
|
|
56344
|
+
if (!scope)
|
|
56345
|
+
return buses[0];
|
|
56346
|
+
return buses.find((candidate) => candidate.getAttribute("id") === groupId && candidate.closest?.("[data-composition-id]") === scope) ?? buses[0];
|
|
56277
56347
|
}
|
|
56278
|
-
var MEDIA_RENDER_ID_ATTR, MEDIA_SELECTOR;
|
|
56348
|
+
var MEDIA_RENDER_ID_ATTR, AUDIO_GROUP_RENDER_ID_ATTR, MEDIA_SELECTOR, AUDIO_GROUP_SELECTOR;
|
|
56279
56349
|
var init_mediaRenderIds = __esm({
|
|
56280
56350
|
"../core/dist/compiler/mediaRenderIds.js"() {
|
|
56281
56351
|
"use strict";
|
|
56282
56352
|
MEDIA_RENDER_ID_ATTR = "data-hf-render-id";
|
|
56353
|
+
AUDIO_GROUP_RENDER_ID_ATTR = "data-hf-group-render-id";
|
|
56283
56354
|
MEDIA_SELECTOR = "video[src], audio[src], img[src]";
|
|
56355
|
+
AUDIO_GROUP_SELECTOR = "hf-audio-group[id]";
|
|
56284
56356
|
}
|
|
56285
56357
|
});
|
|
56286
56358
|
|
|
@@ -58708,7 +58780,7 @@ var RUNTIME_IIFE;
|
|
|
58708
58780
|
var init_runtime_inline = __esm({
|
|
58709
58781
|
"../core/dist/generated/runtime-inline.js"() {
|
|
58710
58782
|
"use strict";
|
|
58711
|
-
RUNTIME_IIFE = '"use strict";(()=>{var lm=Object.create;var Li=Object.defineProperty;var um=Object.getOwnPropertyDescriptor;var cm=Object.getOwnPropertyNames;var dm=Object.getPrototypeOf,fm=Object.prototype.hasOwnProperty;var mm=(e,t,n)=>t in e?Li(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var re=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var pm=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cm(t))!fm.call(e,i)&&i!==n&&Li(e,i,{get:()=>t[i],enumerable:!(r=um(t,i))||r.enumerable});return e};var hm=(e,t,n)=>(n=e!=null?lm(dm(e)):{},pm(t||!e||!e.__esModule?Li(n,"default",{value:e,enumerable:!0}):n,e));var pe=(e,t,n)=>mm(e,typeof t!="symbol"?t+"":t,n);var iu=re((pS,ko)=>{var Q=String,ru=function(){return{isColorSupported:!1,reset:Q,bold:Q,dim:Q,italic:Q,underline:Q,inverse:Q,hidden:Q,strikethrough:Q,black:Q,red:Q,green:Q,yellow:Q,blue:Q,magenta:Q,cyan:Q,white:Q,gray:Q,bgBlack:Q,bgRed:Q,bgGreen:Q,bgYellow:Q,bgBlue:Q,bgMagenta:Q,bgCyan:Q,bgWhite:Q,blackBright:Q,redBright:Q,greenBright:Q,yellowBright:Q,blueBright:Q,magentaBright:Q,cyanBright:Q,whiteBright:Q,bgBlackBright:Q,bgRedBright:Q,bgGreenBright:Q,bgYellowBright:Q,bgBlueBright:Q,bgMagentaBright:Q,bgCyanBright:Q,bgWhiteBright:Q}};ko.exports=ru();ko.exports.createColors=ru});var Mo=re(()=>{});var Pr=re((bS,su)=>{"use strict";var ou=iu(),au=Mo(),Fn=class e extends Error{constructor(t,n,r,i,o,a){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),a&&(this.plugin=a),typeof n<"u"&&typeof r<"u"&&(typeof n=="number"?(this.line=n,this.column=r):(this.line=n.line,this.column=n.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,e)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(t){if(!this.source)return"";let n=this.source;t==null&&(t=ou.isColorSupported);let r=c=>c,i=c=>c,o=c=>c;if(t){let{bold:c,gray:m,red:f}=ou.createColors(!0);i=h=>c(f(h)),r=h=>m(h),au&&(o=h=>au(h))}let a=n.split(/\\r?\\n/),l=Math.max(this.line-3,0),s=Math.min(this.line+2,a.length),u=String(s).length;return a.slice(l,s).map((c,m)=>{let f=l+1+m,h=" "+(" "+f).slice(-u)+" | ";if(f===this.line){if(c.length>160){let v=20,x=Math.max(0,this.column-v),_=Math.max(this.column+v,this.endColumn+v),R=c.slice(x,_),T=r(h.replace(/\\d/g," "))+c.slice(0,Math.min(this.column-1,v-1)).replace(/[^\\t]/g," ");return i(">")+r(h)+o(R)+`\n `+T+i("^")}let b=r(h.replace(/\\d/g," "))+c.slice(0,this.column-1).replace(/[^\\t]/g," ");return i(">")+r(h)+o(c)+`\n `+b+i("^")}return" "+r(h)+o(c)}).join(`\n`)}toString(){let t=this.showSourceCode();return t&&(t=`\n\n`+t+`\n`),this.name+": "+this.message+t}};su.exports=Fn;Fn.default=Fn});var Fo=re((xS,uu)=>{"use strict";var Gh=/(<)(\\/?style\\b)/gi,Hh=/(<)(!--)/g;function ht(e){return typeof e!="string"||!e.includes("<")?e:e.replace(Gh,"\\\\3c $2").replace(Hh,"\\\\3c $2")}var lu={after:`\n`,beforeClose:`\n`,beforeComment:`\n`,beforeDecl:`\n`,beforeOpen:" ",beforeRule:`\n`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function Bh(e){return e[0].toUpperCase()+e.slice(1)}var Nn=class{constructor(t){this.builder=t}atrule(t,n){let r=t.raws,i="@"+t.name,o=t.params?this.rawValue(t,"params"):"";if(typeof r.afterName<"u"?i+=r.afterName:o&&(i+=" "),t.nodes)this.block(t,i+o);else{let a=(r.between||"")+(n?";":"");this.builder(ht(i+o+a),t)}}beforeAfter(t,n){let r;t.type==="decl"?r=this.raw(t,null,"beforeDecl"):t.type==="comment"?r=this.raw(t,null,"beforeComment"):n==="before"?r=this.raw(t,null,"beforeRule"):r=this.raw(t,null,"beforeClose");let i=t.parent,o=0;for(;i&&i.type!=="root";)o+=1,i=i.parent;if(r.includes(`\n`)){let a=this.raw(t,null,"indent");if(a.length)for(let l=0;l<o;l++)r+=a}return r}block(t,n){let r=this.raw(t,"between","beforeOpen");this.builder(ht(n+r)+"{",t,"start");let i;t.nodes&&t.nodes.length?(this.body(t),i=this.raw(t,"after")):i=this.raw(t,"after","emptyBody"),i&&this.builder(ht(i)),this.builder("}",t,"end")}body(t){let n=t.nodes,r=n.length-1;for(;r>0&&n[r].type==="comment";)r-=1;let i=this.raw(t,"semicolon"),o=t.type==="document";for(let a=0;a<n.length;a++){let l=n[a],s=this.raw(l,"before");s&&this.builder(o?s:ht(s)),this.stringify(l,r!==a||i)}}comment(t){let n=this.raw(t,"left","commentLeft"),r=this.raw(t,"right","commentRight");this.builder(ht("/*"+n+t.text+r+"*/"),t)}decl(t,n){let r=t.raws,i=this.raw(t,"between","colon"),o=t.prop+i+this.rawValue(t,"value");t.important&&(o+=r.important||" !important"),n&&(o+=";"),this.builder(ht(o),t)}document(t){this.body(t)}raw(t,n,r){let i;if(r||(r=n),n&&(i=t.raws[n],typeof i<"u"))return i;let o=t.parent;if(r==="before"&&(!o||o.type==="root"&&o.first===t||o&&o.type==="document"))return"";if(!o)return lu[r];let a=t.root(),l=a.rawCache||(a.rawCache={});if(typeof l[r]<"u")return l[r];if(r==="before"||r==="after")return this.beforeAfter(t,r);{let s="raw"+Bh(r);this[s]?i=this[s](a,t):a.walk(u=>{if(i=u.raws[n],typeof i<"u")return!1})}return typeof i>"u"&&(i=lu[r]),l[r]=i,i}rawBeforeClose(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return n=r.raws.after,n.includes(`\n`)&&(n=n.replace(/[^\\n]+$/,"")),!1}),n&&(n=n.replace(/\\S/g,"")),n}rawBeforeComment(t,n){let r;return t.walkComments(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeDecl"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeDecl(t,n){let r;return t.walkDecls(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeRule"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeOpen(t){let n;return t.walk(r=>{if(r.type!=="decl"&&(n=r.raws.between,typeof n<"u"))return!1}),n}rawBeforeRule(t){let n;return t.walk(r=>{if(r.nodes&&(r.parent!==t||t.first!==r)&&typeof r.raws.before<"u")return n=r.raws.before,n.includes(`\n`)&&(n=n.replace(/[^\\n]+$/,"")),!1}),n&&(n=n.replace(/\\S/g,"")),n}rawColon(t){let n;return t.walkDecls(r=>{if(typeof r.raws.between<"u")return n=r.raws.between.replace(/[^\\s:]/g,""),!1}),n}rawEmptyBody(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length===0&&(n=r.raws.after,typeof n<"u"))return!1}),n}rawIndent(t){if(t.raws.indent)return t.raws.indent;let n;return t.walk(r=>{let i=r.parent;if(i&&i!==t&&i.parent&&i.parent===t&&typeof r.raws.before<"u"){let o=r.raws.before.split(`\n`);return n=o[o.length-1],n=n.replace(/\\S/g,""),!1}}),n}rawSemicolon(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(n=r.raws.semicolon,typeof n<"u"))return!1}),n}rawValue(t,n){let r=t[n],i=t.raws[n];return i&&i.value===r?i.raw:r}root(t){if(this.body(t),t.raws.after){let n=t.raws.after,r=t.parent&&t.parent.type==="document";this.builder(r?n:ht(n))}}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(ht(t.raws.ownSemicolon),t,"end")}stringify(t,n){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,n)}};uu.exports=Nn;Nn.default=Nn});var Ln=re((yS,cu)=>{"use strict";var Uh=Fo();function No(e,t){new Uh(t).stringify(e)}cu.exports=No;No.default=No});var Or=re((vS,Lo)=>{"use strict";Lo.exports.isClean=Symbol("isClean");Lo.exports.my=Symbol("my")});var Pn=re((SS,du)=>{"use strict";var Wh=Pr(),Vh=Fo(),zh=Ln(),{isClean:Dn,my:qh}=Or();function Do(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r)||r==="proxyCache")continue;let i=e[r],o=typeof i;r==="parent"&&o==="object"?t&&(n[r]=t):r==="source"?n[r]=i:Array.isArray(i)?n[r]=i.map(a=>Do(a,n)):(o==="object"&&i!==null&&(i=Do(i)),n[r]=i)}return n}function rt(e,t){if(t&&typeof t.offset<"u")return t.offset;let n=1,r=1,i=0;for(let o=0;o<e.length;o++){if(r===t.line&&n===t.column){i=o;break}e[o]===`\n`?(n=1,r+=1):n+=1}return i}var In=class{get proxyOf(){return this}constructor(t={}){this.raws={},this[Dn]=!1,this[qh]=!0;for(let n in t)if(n==="nodes"){this.nodes=[];for(let r of t[n])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[n]=t[n]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\\n\\s{4}at /.test(t.stack)){let n=this.source;t.stack=t.stack.replace(/\\n\\s{4}at /,`$&${n.input.from}:${n.start.line}:${n.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let n in t)this[n]=t[n];return this}before(t){return this.parent.insertBefore(this,t),this}cleanRaws(t){delete this.raws.before,delete this.raws.after,t||delete this.raws.between}clone(t={}){let n=Do(this);for(let r in t)n[r]=t[r];return n}cloneAfter(t={}){let n=this.clone(t);return this.parent.insertAfter(this,n),n}cloneBefore(t={}){let n=this.clone(t);return this.parent.insertBefore(this,n),n}error(t,n={}){if(this.source){let{end:r,start:i}=this.rangeBy(n);return this.source.input.error(t,{column:i.column,line:i.line},{column:r.column,line:r.line},n)}return new Wh(t)}getProxyProcessor(){return{get(t,n){return n==="proxyOf"?t:n==="root"?()=>t.root().toProxy():t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="prop"||n==="value"||n==="name"||n==="params"||n==="important"||n==="text")&&t.markDirty()),!0}}}markClean(){this[Dn]=!0}markDirty(){if(this[Dn]){this[Dn]=!1;let t=this;for(;t=t.parent;)t[Dn]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t={}){let n=this.source.start;if(t.index)n=this.positionInside(t.index);else if(t.word){let r="document"in this.source.input?this.source.input.document:this.source.input.css,o=r.slice(rt(r,this.source.start),rt(r,this.source.end)).indexOf(t.word);o!==-1&&(n=this.positionInside(o))}return n}positionInside(t){let n=this.source.start.column,r=this.source.start.line,i="document"in this.source.input?this.source.input.document:this.source.input.css,o=rt(i,this.source.start),a=o+t;for(let l=o;l<a;l++)i[l]===`\n`?(n=1,r+=1):n+=1;return{column:n,line:r,offset:a}}prev(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t-1]}rangeBy(t={}){let n="document"in this.source.input?this.source.input.document:this.source.input.css,r={column:this.source.start.column,line:this.source.start.line,offset:rt(n,this.source.start)},i=this.source.end?{column:this.source.end.column+1,line:this.source.end.line,offset:typeof this.source.end.offset=="number"?this.source.end.offset:rt(n,this.source.end)+1}:{column:r.column+1,line:r.line,offset:r.offset+1};if(t.word){let a=n.slice(rt(n,this.source.start),rt(n,this.source.end)).indexOf(t.word);a!==-1&&(r=this.positionInside(a),i=this.positionInside(a+t.word.length))}else t.start?r={column:t.start.column,line:t.start.line,offset:rt(n,t.start)}:t.index&&(r=this.positionInside(t.index)),t.end?i={column:t.end.column,line:t.end.line,offset:rt(n,t.end)}:typeof t.endIndex=="number"?i=this.positionInside(t.endIndex):t.index&&(i=this.positionInside(t.index+1));return(i.line<r.line||i.line===r.line&&i.column<=r.column)&&(i={column:r.column+1,line:r.line,offset:r.offset+1}),{end:i,start:r}}raw(t,n){return new Vh().raw(this,t,n)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let n=this,r=!1;for(let i of t)i===this?r=!0:r?(this.parent.insertAfter(n,i),n=i):this.parent.insertBefore(n,i);r||this.remove()}return this}root(){let t=this;for(;t.parent&&t.parent.type!=="document";)t=t.parent;return t}toJSON(t,n){let r={},i=n==null;n=n||new Map;let o=0;for(let a in this){if(!Object.prototype.hasOwnProperty.call(this,a)||a==="parent"||a==="proxyCache")continue;let l=this[a];if(Array.isArray(l))r[a]=l.map(s=>typeof s=="object"&&s.toJSON?s.toJSON(null,n):s);else if(typeof l=="object"&&l.toJSON)r[a]=l.toJSON(null,n);else if(a==="source"){if(l==null)continue;let s=n.get(l.input);s==null&&(s=o,n.set(l.input,o),o++),r[a]={end:l.end,inputId:s,start:l.start}}else r[a]=l}return i&&(r.inputs=[...n.keys()].map(a=>a.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=zh){t.stringify&&(t=t.stringify);let n="";return t(this,r=>{n+=r}),n}warn(t,n,r={}){let i={node:this};for(let o in r)i[o]=r[o];return t.warn(n,i)}};du.exports=In;In.default=In});var Gn=re((AS,fu)=>{"use strict";var $h=Pn(),On=class extends $h{constructor(t){super(t),this.type="comment"}};fu.exports=On;On.default=On});var Bn=re((ES,mu)=>{"use strict";var jh=Pn(),Hn=class extends jh{get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}constructor(t){t&&typeof t.value<"u"&&typeof t.value!="string"&&(t={...t,value:String(t.value)}),super(t),this.type="decl"}};mu.exports=Hn;Hn.default=Hn});var gt=re((CS,Au)=>{"use strict";var pu=Gn(),hu=Bn(),Kh=Pn(),{isClean:gu,my:bu}=Or(),Io,xu,yu,Po;function vu(e){return e.map(t=>(t.nodes&&(t.nodes=vu(t.nodes)),delete t.source,t))}function Su(e){if(e[gu]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Su(t)}var Ve=class e extends Kh{get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}append(...t){for(let n of t){let r=this.normalize(n,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let n of this.nodes)n.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let n=this.getIterator(),r,i;for(;this.indexes[n]<this.proxyOf.nodes.length&&(r=this.indexes[n],i=t(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[n]+=1;return delete this.indexes[n],i}every(t){return this.nodes.every(t)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let t=this.lastEach;return this.indexes[t]=0,t}getProxyProcessor(){return{get(t,n){return n==="proxyOf"?t:t[n]?n==="each"||typeof n=="string"&&n.startsWith("walk")?(...r)=>t[n](...r.map(i=>typeof i=="function"?(o,a)=>i(o.toProxy(),a):i)):n==="every"||n==="some"?r=>t[n]((i,...o)=>r(i.toProxy(),...o)):n==="root"?()=>t.root().toProxy():n==="nodes"?t.nodes.map(r=>r.toProxy()):n==="first"||n==="last"?t[n].toProxy():t[n]:t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="name"||n==="params"||n==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,n){let r=this.index(t),i=this.normalize(n,this.proxyOf.nodes[r]).reverse();r=this.index(t);for(let a of i)this.proxyOf.nodes.splice(r+1,0,a);let o;for(let a in this.indexes)o=this.indexes[a],r<o&&(this.indexes[a]=o+i.length);return this.markDirty(),this}insertBefore(t,n){let r=this.index(t),i=r===0?"prepend":!1,o=this.normalize(n,this.proxyOf.nodes[r],i).reverse();r=this.index(t);for(let l of o)this.proxyOf.nodes.splice(r,0,l);let a;for(let l in this.indexes)a=this.indexes[l],r<=a&&(this.indexes[l]=a+o.length);return this.markDirty(),this}normalize(t,n){if(typeof t=="string")t=vu(xu(t).nodes);else if(typeof t>"u")t=[];else if(Array.isArray(t)){t=t.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"ignore")}else if(t.type)t=[t];else if(t.prop){if(typeof t.value>"u")throw new Error("Value field is missed in node creation");typeof t.value!="string"&&(t.value=String(t.value)),t=[new hu(t)]}else if(t.selector||t.selectors)t=[new Po(t)];else if(t.name)t=[new Io(t)];else if(t.text)t=[new pu(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[bu]||e.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[gu]&&Su(i),i.raws||(i.raws={}),typeof i.raws.before>"u"&&n&&typeof n.raws.before<"u"&&(i.raws.before=n.raws.before.replace(/\\S/g,"")),i.parent=this.proxyOf,i))}prepend(...t){t=t.reverse();for(let n of t){let r=this.normalize(n,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(t){return t.parent=this,this.proxyOf.nodes.push(t),this}removeAll(){for(let t of this.proxyOf.nodes)t.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(t){t=this.index(t),this.proxyOf.nodes[t].parent=void 0,this.proxyOf.nodes.splice(t,1);let n;for(let r in this.indexes)n=this.indexes[r],n>=t&&(this.indexes[r]=n-1);return this.markDirty(),this}replaceValues(t,n,r){return r||(r=n,n={}),this.walkDecls(i=>{n.props&&!n.props.includes(i.prop)||n.fast&&!i.value.includes(n.fast)||(i.value=i.value.replace(t,r))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((n,r)=>{let i;try{i=t(n,r)}catch(o){throw n.addToError(o)}return i!==!1&&n.walk&&(i=n.walk(t)),i})}walkAtRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&t.test(r.name))return n(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="atrule")return n(r,i)}))}walkComments(t){return this.walk((n,r)=>{if(n.type==="comment")return t(n,r)})}walkDecls(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&t.test(r.prop))return n(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="decl")return n(r,i)}))}walkRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&t.test(r.selector))return n(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="rule")return n(r,i)}))}};Ve.registerParse=e=>{xu=e};Ve.registerRule=e=>{Po=e};Ve.registerAtRule=e=>{Io=e};Ve.registerRoot=e=>{yu=e};Au.exports=Ve;Ve.default=Ve;Ve.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,Io.prototype):e.type==="rule"?Object.setPrototypeOf(e,Po.prototype):e.type==="decl"?Object.setPrototypeOf(e,hu.prototype):e.type==="comment"?Object.setPrototypeOf(e,pu.prototype):e.type==="root"&&Object.setPrototypeOf(e,yu.prototype),e[bu]=!0,e.nodes&&e.nodes.forEach(t=>{Ve.rebuild(t)})}});var Gr=re((wS,Cu)=>{"use strict";var Eu=gt(),$t=class extends Eu{constructor(t){super(t),this.type="atrule"}append(...t){return this.proxyOf.nodes||(this.nodes=[]),super.append(...t)}prepend(...t){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...t)}};Cu.exports=$t;$t.default=$t;Eu.registerAtRule($t)});var Hr=re((_S,Tu)=>{"use strict";var Yh=gt(),wu,_u,kt=class extends Yh{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new wu(new _u,this,t).stringify()}};kt.registerLazyResult=e=>{wu=e};kt.registerProcessor=e=>{_u=e};Tu.exports=kt;kt.default=kt});var ku=re((TS,Ru)=>{var Xh="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Jh=(e,t=21)=>(n=t)=>{let r="",i=n|0;for(;i--;)r+=e[Math.random()*e.length|0];return r},Qh=(e=21)=>{let t="",n=e|0;for(;n--;)t+=Xh[Math.random()*64|0];return t};Ru.exports={nanoid:Qh,customAlphabet:Jh}});var Br=re(()=>{});var Ur=re(()=>{});var Oo=re(()=>{});var Mu=re(()=>{});var Ho=re((PS,Lu)=>{"use strict";var{existsSync:Zh,readFileSync:e0}=Mu(),{dirname:Go,join:t0}=Br(),{SourceMapConsumer:Fu,SourceMapGenerator:Nu}=Ur();function n0(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var Un=class{constructor(t,n){if(n.map===!1)return;n.unsafeMap&&(this.unsafeMap=!0),this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let r=n.map?n.map.prev:void 0,i=this.loadMap(n.from,r);!this.mapFile&&n.from&&(this.mapFile=n.from),this.mapFile&&(this.root=Go(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new Fu(this.json||this.text)),this.consumerCache}decodeInline(t){let n=/^data:application\\/json;charset=utf-?8;base64,/,r=/^data:application\\/json;base64,/,i=/^data:application\\/json;charset=utf-?8,/,o=/^data:application\\/json,/,a=t.match(i)||t.match(o);if(a)return decodeURIComponent(t.substr(a[0].length));let l=t.match(n)||t.match(r);if(l)return n0(t.substr(l[0].length));let s=t.slice(22);throw s=s.slice(0,s.indexOf(",")),new Error("Unsupported source map encoding "+s)}getAnnotationURL(t){return t.replace(/^\\/\\*\\s*# sourceMappingURL=/,"").trim()}isMap(t){return typeof t!="object"?!1:typeof t.mappings=="string"||typeof t._mappings=="string"||Array.isArray(t.sections)}loadAnnotation(t){let n=t.match(/\\/\\*\\s*# sourceMappingURL=/g);if(!n)return;let r=t.lastIndexOf(n.pop()),i=t.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(t.substring(r,i)))}loadFile(t,n,r){if(!(!r&&!this.unsafeMap&&!/\\.map$/i.test(t))&&(this.root=Go(t),Zh(t)))return this.mapFile=t,e0(t,"utf-8").toString().trim()}loadMap(t,n){if(n===!1)return!1;if(n){if(typeof n=="string")return n;if(typeof n=="function"){let r=n(t);if(r){let i=this.loadFile(r,t,!0);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(n instanceof Fu)return Nu.fromSourceMap(n).toString();if(n instanceof Nu)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;t&&(r=t0(Go(t),r));let i=this.loadFile(r,t,!1);if(i)try{this.json=JSON.parse(i.replace(/^\\)]}\'[^\\n]*\\n/,""))}catch{return}return i}}}startWith(t,n){return t?t.substr(0,n.length)===n:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};Lu.exports=Un;Un.default=Un});var Wn=re((OS,Gu)=>{"use strict";var{nanoid:r0}=ku(),{isAbsolute:Wo,resolve:Vo}=Br(),{SourceMapConsumer:i0,SourceMapGenerator:o0}=Ur(),{fileURLToPath:Du,pathToFileURL:Wr}=Oo(),Iu=Pr(),a0=Ho(),Bo=Mo(),Uo=Symbol("lineToIndexCache"),s0=!!(i0&&o0),Pu=!!(Vo&&Wo);function Ou(e){if(e[Uo])return e[Uo];let t=e.css.split(`\n`),n=new Array(t.length),r=0;for(let i=0,o=t.length;i<o;i++)n[i]=r,r+=t[i].length+1;return e[Uo]=n,n}var jt=class{get from(){return this.file||this.id}constructor(t,n={}){if(t===null||typeof t>"u"||typeof t=="object"&&!t.toString)throw new Error(`PostCSS received ${t} instead of CSS string`);if(this.css=t.toString(),this.css[0]==="\\uFEFF"||this.css[0]==="\\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,this.document=this.css,n.document&&(this.document=n.document.toString()),n.from&&(!Pu||/^\\w+:\\/\\//.test(n.from)||Wo(n.from)?this.file=n.from:this.file=Vo(n.from)),Pu&&s0){let r=new a0(this.css,n);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+r0(6)+">"),this.map&&(this.map.file=this.from)}error(t,n,r,i={}){let o,a,l,s,u;if(n&&typeof n=="object"){let m=n,f=r;if(typeof m.offset=="number"){s=m.offset;let h=this.fromOffset(s);n=h.line,r=h.col}else n=m.line,r=m.column,s=this.fromLineAndColumn(n,r);if(typeof f.offset=="number"){l=f.offset;let h=this.fromOffset(l);a=h.line,o=h.col}else a=f.line,o=f.column,l=this.fromLineAndColumn(f.line,f.column)}else if(r)s=this.fromLineAndColumn(n,r);else{s=n;let m=this.fromOffset(s);n=m.line,r=m.col}let c=this.origin(n,r,a,o);return c?u=new Iu(t,c.endLine===void 0?c.line:{column:c.column,line:c.line},c.endLine===void 0?c.column:{column:c.endColumn,line:c.endLine},c.source,c.file,i.plugin):u=new Iu(t,a===void 0?n:{column:r,line:n},a===void 0?r:{column:o,line:a},this.css,this.file,i.plugin),u.input={column:r,endColumn:o,endLine:a,endOffset:l,line:n,offset:s,source:this.css},this.file&&(Wr&&(u.input.url=Wr(this.file).toString()),u.input.file=this.file),u}fromLineAndColumn(t,n){return Ou(this)[t-1]+n-1}fromOffset(t){let n=Ou(this),r=n[n.length-1],i=0;if(t>=r)i=n.length-1;else{let o=n.length-2,a;for(;i<o;)if(a=i+(o-i>>1),t<n[a])o=a-1;else if(t>=n[a+1])i=a+1;else{i=a;break}}return{col:t-n[i]+1,line:i+1}}mapResolve(t){return/^\\w+:\\/\\//.test(t)?t:Vo(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,n,r,i){if(!this.map)return!1;let o=this.map.consumer(),a=o.originalPositionFor({column:n,line:t});if(!a.source)return!1;let l;typeof r=="number"&&(l=o.originalPositionFor({column:i,line:r}));let s;Wo(a.source)?s=Wr(a.source):s=new URL(a.source,this.map.consumer().sourceRoot||Wr(this.map.mapFile));let u={column:a.column,endColumn:l&&l.column,endLine:l&&l.line,line:a.line,url:s.toString()};if(s.protocol==="file:")if(Du)u.file=Du(s);else throw new Error("file: protocol is not available in this PostCSS build");let c=o.sourceContentFor(a.source);return c&&(u.source=c),u}toJSON(){let t={};for(let n of["hasBOM","css","file","id"])this[n]!=null&&(t[n]=this[n]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}};Gu.exports=jt;jt.default=jt;Bo&&Bo.registerInput&&Bo.registerInput(jt)});var Kt=re((GS,Wu)=>{"use strict";var Hu=gt(),Bu,Uu,bt=class extends Hu{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,n,r){let i=super.normalize(t);if(n){if(r==="prepend")this.nodes.length>1?n.raws.before=this.nodes[1].raws.before:delete n.raws.before;else if(this.first!==n)for(let o of i)o.raws.before=n.raws.before}return i}removeChild(t,n){let r=this.index(t);return!n&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(t)}toResult(t={}){return new Bu(new Uu,this,t).stringify()}};bt.registerLazyResult=e=>{Bu=e};bt.registerProcessor=e=>{Uu=e};Wu.exports=bt;bt.default=bt;Hu.registerRoot(bt)});var zo=re((HS,Vu)=>{"use strict";var Vn={comma(e){return Vn.split(e,[","],!0)},space(e){let t=[" ",`\n`," "];return Vn.split(e,t)},split(e,t,n){let r=[],i="",o=!1,a=0,l=!1,s="",u=!1;for(let c of e)u?u=!1:c==="\\\\"?u=!0:l?c===s&&(l=!1):c===\'"\'||c==="\'"?(l=!0,s=c):c==="("?a+=1:c===")"?a>0&&(a-=1):a===0&&t.includes(c)&&(o=!0),o?(i!==""&&r.push(i.trim()),i="",o=!1):i+=c;return(n||i!=="")&&r.push(i.trim()),r}};Vu.exports=Vn;Vn.default=Vn});var Vr=re((BS,qu)=>{"use strict";var zu=gt(),l0=zo(),Yt=class extends zu{get selectors(){return l0.comma(this.selector)}set selectors(t){let n=this.selector?this.selector.match(/,\\s*/):null,r=n?n[0]:","+this.raw("between","beforeOpen");this.selector=t.join(r)}constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}};qu.exports=Yt;Yt.default=Yt;zu.registerRule(Yt)});var ju=re((US,$u)=>{"use strict";var u0=Gr(),c0=Gn(),d0=Bn(),f0=Wn(),m0=Ho(),p0=Kt(),h0=Vr();function zn(e,t){if(Array.isArray(e))return e.map(i=>zn(i));let{inputs:n,...r}=e;if(n){t=[];for(let i of n){let o={...i,__proto__:f0.prototype};o.map&&(o.map={...o.map,__proto__:m0.prototype}),t.push(o)}}if(r.nodes&&(r.nodes=e.nodes.map(i=>zn(i,t))),r.source){let{inputId:i,...o}=r.source;r.source=o,i!=null&&(r.source.input=t[i])}if(r.type==="root")return new p0(r);if(r.type==="decl")return new d0(r);if(r.type==="rule")return new h0(r);if(r.type==="comment")return new c0(r);if(r.type==="atrule")return new u0(r);throw new Error("Unknown node type: "+e.type)}$u.exports=zn;zn.default=zn});var $o=re((WS,Zu)=>{"use strict";var{dirname:zr,relative:Yu,resolve:Xu,sep:Ju}=Br(),{SourceMapConsumer:Qu,SourceMapGenerator:qr}=Ur(),{pathToFileURL:Ku}=Oo(),g0=Wn(),b0=!!(Qu&&qr),x0=!!(zr&&Xu&&Yu&&Ju),qo=class{constructor(t,n,r,i){this.stringify=t,this.mapOpts=r.map||{},this.root=n,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let t;this.isInline()?t="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?t=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?t=this.mapOpts.annotation(this.opts.to,this.root):t=this.outputFile()+".map";let n=`\n`;this.css.includes(`\\r\n`)&&(n=`\\r\n`),this.css+=n+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let n=this.toUrl(this.path(t.file)),r=t.root||zr(t.file),i;this.mapOpts.sourcesContent===!1?(i=new Qu(t.text),i.sourcesContent&&(i.sourcesContent=null)):i=t.consumer(),this.map.applySourceMap(i,n,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1){if(this.root){let t;for(let n=this.root.nodes.length-1;n>=0;n--)t=this.root.nodes[n],t.type==="comment"&&t.text.startsWith("# sourceMappingURL=")&&this.root.removeChild(n)}else if(this.css){let t;for(;(t=this.css.lastIndexOf("/*#"))!==-1;){let n=this.css.indexOf("*/",t+3);if(n===-1)break;for(;t>0&&this.css[t-1]===`\n`;)t--;this.css=this.css.slice(0,t)+this.css.slice(n+2)}}}}generate(){if(this.clearAnnotation(),x0&&b0&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,n=>{t+=n}),[t]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let t=this.previous()[0].consumer();t.file=this.outputFile(),this.map=qr.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new qr({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new qr({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,n=1,r="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},o,a;this.stringify(this.root,(l,s,u)=>{if(this.css+=l,s&&u!=="end"&&(i.generated.line=t,i.generated.column=n-1,s.source&&s.source.start?(i.source=this.sourcePath(s),i.original.line=s.source.start.line,i.original.column=s.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),a=l.match(/\\n/g),a?(t+=a.length,o=l.lastIndexOf(`\n`),n=l.length-o):n+=l.length,s&&u!=="start"){let c=s.parent||{raws:{}};(!(s.type==="decl"||s.type==="atrule"&&!s.nodes)||s!==c.last||c.raws.semicolon)&&(s.source&&s.source.end?(i.source=this.sourcePath(s),i.original.line=s.source.end.line,i.original.column=s.source.end.column-1,i.generated.line=t,i.generated.column=n-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=t,i.generated.column=n-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(t=>t.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let t=this.mapOpts.annotation;return typeof t<"u"&&t!==!0?!1:this.previous().length?this.previous().some(n=>n.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(t=>t.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(t){if(this.mapOpts.absolute||t.charCodeAt(0)===60||/^\\w+:\\/\\//.test(t))return t;let n=this.memoizedPaths.get(t);if(n)return n;let r=this.opts.to?zr(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=zr(Xu(r,this.mapOpts.annotation)));let i=Yu(r,t);return this.memoizedPaths.set(t,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(t=>{if(t.source&&t.source.input.map){let n=t.source.input.map;this.previousMaps.includes(n)||this.previousMaps.push(n)}});else{let t=new g0(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(n=>{if(n.source){let r=n.source.input.from;if(r&&!t[r]){t[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,n.source.input.css)}}});else if(this.css){let n=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(n,this.css)}}sourcePath(t){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(t.source.input.from):this.toUrl(this.path(t.source.input.from))}toBase64(t){return Buffer?Buffer.from(t).toString("base64"):window.btoa(unescape(encodeURIComponent(t)))}toFileUrl(t){let n=this.memoizedFileURLs.get(t);if(n)return n;if(Ku){let r=Ku(t).toString();return this.memoizedFileURLs.set(t,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let n=this.memoizedURLs.get(t);if(n)return n;Ju==="\\\\"&&(t=t.replace(/\\\\/g,"/"));let r=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,r),r}};Zu.exports=qo});var nc=re((VS,tc)=>{"use strict";var $r=/[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g,jr=/[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g,y0=/.[\\r\\n"\'(/\\\\]/,ec=/[\\da-f]/i;tc.exports=function(t,n={}){let r=t.css.valueOf(),i=n.ignoreErrors,o,a,l,s,u,c,m,f,h,b,v=r.length,x=0,_=[],R=[],T=-1;function F(){return x}function M(w){throw t.error("Unclosed "+w,x)}function E(){return R.length===0&&x>=v}function S(w){if(R.length)return R.pop();if(x>=v)return;let N=w?w.ignoreUnclosed:!1;switch(o=r.charCodeAt(x),o){case 10:case 32:case 9:case 13:case 12:{s=x;do s+=1,o=r.charCodeAt(s);while(o===32||o===10||o===9||o===13||o===12);c=["space",r.slice(x,s)],x=s-1;break}case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let I=String.fromCharCode(o);c=[I,I,x];break}case 40:{if(b=_.length?_.pop()[1]:"",h=r.charCodeAt(x+1),b==="url"&&h!==39&&h!==34&&h!==32&&h!==10&&h!==9&&h!==12&&h!==13){s=x;do{if(m=!1,s=r.indexOf(")",s+1),s===-1)if(i||N){s=x;break}else M("bracket");for(f=s;r.charCodeAt(f-1)===92;)f-=1,m=!m}while(m);c=["brackets",r.slice(x,s+1),x,s],x=s}else x<=T?c=["(","(",x]:(s=r.indexOf(")",x+1),a=r.slice(x,s+1),s===-1||y0.test(a)?(T=s===-1?v:s,c=["(","(",x]):(c=["brackets",a,x,s],x=s));break}case 39:case 34:{u=o===39?"\'":\'"\',s=x;do{if(m=!1,s=r.indexOf(u,s+1),s===-1)if(i||N){s=x+1;break}else M("string");for(f=s;r.charCodeAt(f-1)===92;)f-=1,m=!m}while(m);c=["string",r.slice(x,s+1),x,s],x=s;break}case 64:{$r.lastIndex=x+1,$r.test(r),$r.lastIndex===0?s=r.length-1:s=$r.lastIndex-2,c=["at-word",r.slice(x,s+1),x,s],x=s;break}case 92:{for(s=x,l=!0;r.charCodeAt(s+1)===92;)s+=1,l=!l;if(o=r.charCodeAt(s+1),l&&o!==47&&o!==32&&o!==10&&o!==9&&o!==13&&o!==12&&(s+=1,ec.test(r.charAt(s)))){for(;ec.test(r.charAt(s+1));)s+=1;r.charCodeAt(s+1)===32&&(s+=1)}c=["word",r.slice(x,s+1),x,s],x=s;break}default:{o===47&&r.charCodeAt(x+1)===42?(s=r.indexOf("*/",x+2)+1,s===0&&(i||N?s=r.length:M("comment")),c=["comment",r.slice(x,s+1),x,s],x=s):(jr.lastIndex=x+1,jr.test(r),jr.lastIndex===0?s=r.length-1:s=jr.lastIndex-2,c=["word",r.slice(x,s+1),x,s],_.push(c),x=s);break}}return x++,c}function A(w){R.push(w)}return{back:A,endOfFile:E,nextToken:S,position:F}}});var ac=re((zS,oc)=>{"use strict";var v0=Gr(),S0=Gn(),A0=Bn(),E0=Kt(),rc=Vr(),C0=nc(),ic={empty:!0,space:!0};function w0(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var jo=class{constructor(t){this.input=t,this.root=new E0,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let n=new v0;n.name=t[1].slice(1),n.name===""&&this.unnamedAtrule(n,t),this.init(n,t[2]);let r,i,o,a=!1,l=!1,s=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),r=t[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){n.source.end=this.getPosition(t[2]),n.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){l=!0;break}else if(r==="}"){if(s.length>0){for(o=s.length-1,i=s[o];i&&i[0]==="space";)i=s[--o];i&&(n.source.end=this.getPosition(i[3]||i[2]),n.source.end.offset++)}this.end(t);break}else s.push(t);else s.push(t);if(this.tokenizer.endOfFile()){a=!0;break}}n.raws.between=this.spacesAndCommentsFromEnd(s),s.length?(n.raws.afterName=this.spacesAndCommentsFromStart(s),this.raw(n,"params",s),a&&(t=s[s.length-1],n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++,this.spaces=n.raws.between,n.raws.between="")):(n.raws.afterName="",n.params=""),l&&(n.nodes=[],this.current=n)}checkMissedSemicolon(t){let n=this.colon(t);if(n===!1)return;let r=0,i;for(let o=n-1;o>=0&&(i=t[o],!(i[0]!=="space"&&(r+=1,r===2)));o--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(t){let n=0,r,i,o;for(let[a,l]of t.entries()){if(i=l,o=i[0],o==="("&&(n+=1),o===")"&&(n-=1),n===0&&o===":")if(!r)this.doubleColon(i);else{if(r[0]==="word"&&r[1]==="progid")continue;return a}r=i}return!1}comment(t){let n=new S0;this.init(n,t[2]),n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++;let r=t[1].slice(2,-2);if(!r.trim())n.text="",n.raws.left=r,n.raws.right="";else{let i=r.match(/^(\\s*)([^]*\\S)(\\s*)$/);n.text=i[2],n.raws.left=i[1],n.raws.right=i[3]}}createTokenizer(){this.tokenizer=C0(this.input)}decl(t,n){let r=new A0;this.init(r,t[0][2]);let i=t[t.length-1];for(i[0]===";"&&(this.semicolon=!0,t.pop()),r.source.end=this.getPosition(i[3]||i[2]||w0(t)),r.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),r.raws.before+=t.shift()[1];for(r.source.start=this.getPosition(t[0][2]),r.prop="";t.length;){let u=t[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=t.shift()[1]}r.raws.between="";let o;for(;t.length;)if(o=t.shift(),o[0]===":"){r.raws.between+=o[1];break}else o[0]==="word"&&/\\w/.test(o[1])&&this.unknownWord([o]),r.raws.between+=o[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let a=[],l;for(;t.length&&(l=t[0][0],!(l!=="space"&&l!=="comment"));)a.push(t.shift());this.precheckMissedSemicolon(t);for(let u=t.length-1;u>=0;u--){if(o=t[u],o[1].toLowerCase()==="!important"){r.important=!0;let c=this.stringFrom(t,u);c=this.spacesFromEnd(t)+c,c!==" !important"&&(r.raws.important=c);break}else if(o[1].toLowerCase()==="important"){let c=t.slice(0),m="";for(let f=u;f>0;f--){let h=c[f][0];if(m.trim().startsWith("!")&&h!=="space")break;m=c.pop()[1]+m}m.trim().startsWith("!")&&(r.important=!0,r.raws.important=m,t=c)}if(o[0]!=="space"&&o[0]!=="comment")break}t.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=a.map(u=>u[1]).join(""),a=[]),this.raw(r,"value",a.concat(t),n),r.value.includes(":")&&!n&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let n=new rc;this.init(n,t[2]),n.selector="",n.raws.between="",this.current=n}end(t){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(t){if(this.spaces+=t[1],this.current.nodes){let n=this.current.nodes[this.current.nodes.length-1];n&&n.type==="rule"&&!n.raws.ownSemicolon&&(n.raws.ownSemicolon=this.spaces,this.spaces="",n.source.end=this.getPosition(t[2]),n.source.end.offset+=n.raws.ownSemicolon.length)}}getPosition(t){let n=this.input.fromOffset(t);return{column:n.col,line:n.line,offset:t}}init(t,n){this.current.push(t),t.source={input:this.input,start:this.getPosition(n)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let n=!1,r=null,i=!1,o=null,a=[],l=t[1].startsWith("--"),s=[],u=t;for(;u;){if(r=u[0],s.push(u),r==="("||r==="[")o||(o=u),a.push(r==="("?")":"]");else if(l&&i&&r==="{")o||(o=u),a.push("}");else if(a.length===0)if(r===";")if(i){this.decl(s,l);return}else break;else if(r==="{"){this.rule(s);return}else if(r==="}"){this.tokenizer.back(s.pop()),n=!0;break}else r===":"&&(i=!0);else r===a[a.length-1]&&(a.pop(),a.length===0&&(o=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(n=!0),a.length>0&&this.unclosedBracket(o),n&&i){if(!l)for(;s.length&&(u=s[s.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(s.pop());this.decl(s,l)}else this.unknownWord(s)}parse(){let t;for(;!this.tokenizer.endOfFile();)switch(t=this.tokenizer.nextToken(),t[0]){case"space":this.spaces+=t[1];break;case";":this.freeSemicolon(t);break;case"}":this.end(t);break;case"comment":this.comment(t);break;case"at-word":this.atrule(t);break;case"{":this.emptyRule(t);break;default:this.other(t);break}this.endFile()}precheckMissedSemicolon(){}raw(t,n,r,i){let o,a,l=r.length,s="",u=!0,c,m;for(let f=0;f<l;f+=1)o=r[f],a=o[0],a==="space"&&f===l-1&&!i?u=!1:a==="comment"?(m=r[f-1]?r[f-1][0]:"empty",c=r[f+1]?r[f+1][0]:"empty",!ic[m]&&!ic[c]?s.slice(-1)===","?u=!1:s+=o[1]:u=!1):s+=o[1];if(!u){let f=r.reduce((h,b)=>h+b[1],"");t.raws[n]={raw:f,value:s}}t[n]=s}rule(t){t.pop();let n=new rc;this.init(n,t[0][2]),n.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(n,"selector",t),this.current=n}spacesAndCommentsFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],!(n!=="space"&&n!=="comment"));)r=t.pop()[1]+r;return r}spacesAndCommentsFromStart(t){let n,r="";for(;t.length&&(n=t[0][0],!(n!=="space"&&n!=="comment"));)r+=t.shift()[1];return r}spacesFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],n==="space");)r=t.pop()[1]+r;return r}stringFrom(t,n){let r="";for(let i=n;i<t.length;i++)r+=t[i][1];return t.splice(n,t.length-n),r}unclosedBlock(){let t=this.current.source.start;throw this.input.error("Unclosed block",t.line,t.column)}unclosedBracket(t){throw this.input.error("Unclosed bracket",{offset:t[2]},{offset:t[2]+1})}unexpectedClose(t){throw this.input.error("Unexpected }",{offset:t[2]},{offset:t[2]+1})}unknownWord(t){throw this.input.error("Unknown word "+t[0][1],{offset:t[0][2]},{offset:t[0][2]+t[0][1].length})}unnamedAtrule(t,n){throw this.input.error("At-rule without name",{offset:n[2]},{offset:n[2]+n[1].length})}};oc.exports=jo});var Yr=re((qS,sc)=>{"use strict";var _0=gt(),T0=Wn(),R0=ac();function Kr(e,t){let n=new T0(e,t),r=new R0(n);try{r.parse()}catch(i){throw i}return r.root}sc.exports=Kr;Kr.default=Kr;_0.registerParse(Kr)});var Ko=re(($S,lc)=>{"use strict";var qn=class{constructor(t,n={}){if(this.type="warning",this.text=t,n.node&&n.node.source){let r=n.node.rangeBy(n);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in n)this[r]=n[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};lc.exports=qn;qn.default=qn});var Xr=re((jS,uc)=>{"use strict";var k0=Ko(),$n=class{get content(){return this.css}constructor(t,n,r){this.processor=t,this.messages=[],this.root=n,this.opts=r,this.css="",this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new k0(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(t=>t.type==="warning")}};uc.exports=$n;$n.default=$n});var Yo=re((KS,dc)=>{"use strict";var cc={};dc.exports=function(t){cc[t]||(cc[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))}});var Qo=re((XS,hc)=>{"use strict";var M0=gt(),F0=Hr(),N0=$o(),L0=Yr(),fc=Xr(),D0=Kt(),I0=Ln(),{isClean:Je,my:P0}=Or(),YS=Yo(),O0={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},G0={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},H0={Once:!0,postcssPlugin:!0,prepare:!0},Xt=0;function jn(e){return typeof e=="object"&&typeof e.then=="function"}function pc(e){let t=!1,n=O0[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,Xt,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,Xt,n+"Exit"]:[n,n+"Exit"]}function mc(e){let t;return e.type==="document"?t=["Document",Xt,"DocumentExit"]:e.type==="root"?t=["Root",Xt,"RootExit"]:t=pc(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Xo(e){return e[Je]=!1,e.nodes&&e.nodes.forEach(t=>Xo(t)),e}var Jo={},xt=class e{get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}constructor(t,n,r){this.stringified=!1,this.processed=!1;let i;if(typeof n=="object"&&n!==null&&(n.type==="root"||n.type==="document"))i=Xo(n);else if(n instanceof e||n instanceof fc)i=Xo(n.root),n.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let o=L0;r.syntax&&(o=r.syntax.parse),r.parser&&(o=r.parser),o.parse&&(o=o.parse);try{i=o(n,r)}catch(a){this.processed=!0,this.error=a}i&&!i[P0]&&M0.rebuild(i)}this.result=new fc(t,i,r),this.helpers={...Jo,postcss:Jo,result:this.result},this.plugins=this.processor.plugins.map(o=>typeof o=="object"&&o.prepare?{...o,...o.prepare(this.result)}:o)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(t,n){let r=this.result.lastPlugin;try{n&&n.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin?(t.plugin=r.postcssPlugin,t.setMessage()):r.postcssVersion}catch(i){console&&console.error&&console.error(i)}return t}prepareVisitors(){this.listeners={};let t=(n,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([n,i])};for(let n of this.plugins)if(typeof n=="object")for(let r in n){if(!G0[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${n.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!H0[r])if(typeof n[r]=="object")for(let i in n[r])i==="*"?t(n,r,n[r][i]):t(n,r+"-"+i.toLowerCase(),n[r][i]);else typeof n[r]=="function"&&t(n,r,n[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let n=this.plugins[t],r=this.runOnRoot(n);if(jn(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Je];){t[Je]=!0;let n=[mc(t)];for(;n.length>0;){let r=this.visitTick(n);if(jn(r))try{await r}catch(i){let o=n[n.length-1].node;throw this.handleError(i,o)}}}if(this.listeners.OnceExit)for(let[n,r]of this.listeners.OnceExit){this.result.lastPlugin=n;try{if(t.type==="document"){let i=t.nodes.map(o=>r(o,this.helpers));await Promise.all(i)}else await r(t,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(t){this.result.lastPlugin=t;try{if(typeof t=="object"&&t.Once){if(this.result.root.type==="document"){let n=this.result.root.nodes.map(r=>t.Once(r,this.helpers));return jn(n[0])?Promise.all(n):n}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(n){throw this.handleError(n)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,n=I0;t.syntax&&(n=t.syntax.stringify),t.stringifier&&(n=t.stringifier),n.stringify&&(n=n.stringify);let r=this.result.root.source;if(t.map===void 0&&!(r&&r.input&&r.input.map)){let a="";return n(this.result.root,l=>{a+=l}),this.result.css=a,this.result}let o=new N0(n,this.result.root,this.result.opts).generate();return this.result.css=o[0],this.result.map=o[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let t of this.plugins){let n=this.runOnRoot(t);if(jn(n))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Je];)t[Je]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let n of t.nodes)this.visitSync(this.listeners.OnceExit,n);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,n){return this.async().then(t,n)}toString(){return this.css}visitSync(t,n){for(let[r,i]of t){this.result.lastPlugin=r;let o;try{o=i(n,this.helpers)}catch(a){throw this.handleError(a,n.proxyOf)}if(n.type!=="root"&&n.type!=="document"&&!n.parent)return!0;if(jn(o))throw this.getAsyncError()}}visitTick(t){let n=t[t.length-1],{node:r,visitors:i}=n;if(r.type!=="root"&&r.type!=="document"&&!r.parent){t.pop();return}if(i.length>0&&n.visitorIndex<i.length){let[a,l]=i[n.visitorIndex];n.visitorIndex+=1,n.visitorIndex===i.length&&(n.visitors=[],n.visitorIndex=0),this.result.lastPlugin=a;try{return l(r.toProxy(),this.helpers)}catch(s){throw this.handleError(s,r)}}if(n.iterator!==0){let a=n.iterator,l;for(;l=r.nodes[r.indexes[a]];)if(r.indexes[a]+=1,!l[Je]){l[Je]=!0,t.push(mc(l));return}n.iterator=0,delete r.indexes[a]}let o=n.events;for(;n.eventIndex<o.length;){let a=o[n.eventIndex];if(n.eventIndex+=1,a===Xt){r.nodes&&r.nodes.length&&(r[Je]=!0,n.iterator=r.getIterator());return}else if(this.listeners[a]){n.visitors=this.listeners[a];return}}t.pop()}walkSync(t){t[Je]=!0;let n=pc(t);for(let r of n)if(r===Xt)t.nodes&&t.each(i=>{i[Je]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,t.toProxy()))return}}warnings(){return this.sync().warnings()}};xt.registerPostcss=e=>{Jo=e};hc.exports=xt;xt.default=xt;D0.registerLazyResult(xt);F0.registerLazyResult(xt)});var bc=re((QS,gc)=>{"use strict";var B0=$o(),U0=Yr(),W0=Xr(),V0=Ln(),JS=Yo(),Kn=class{get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let t,n=U0;try{t=n(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}constructor(t,n,r){n=n.toString(),this.stringified=!1,this._processor=t,this._css=n,this._opts=r,this._map=void 0;let i=V0;this.result=new W0(this._processor,void 0,this._opts),this.result.css=n;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let a=new B0(i,void 0,this._opts,n);if(a.isMap()){let[l,s]=a.generate();l&&(this.result.css=l),s&&(this.result.map=s)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}sync(){if(this.error)throw this.error;return this.result}then(t,n){return this.async().then(t,n)}toString(){return this._css}warnings(){return[]}};gc.exports=Kn;Kn.default=Kn});var yc=re((ZS,xc)=>{"use strict";var z0=Hr(),q0=Qo(),$0=bc(),j0=Kt(),Mt=class{constructor(t=[]){this.version="8.5.14",this.plugins=this.normalize(t)}normalize(t){let n=[];for(let r of t)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))n=n.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)n.push(r);else if(typeof r=="function")n.push(r);else if(!(typeof r=="object"&&(r.parse||r.stringify)))throw new Error(r+" is not a PostCSS plugin");return n}process(t,n={}){return!this.plugins.length&&!n.parser&&!n.stringifier&&!n.syntax?new $0(this,t,n):new q0(this,t,n)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}};xc.exports=Mt;Mt.default=Mt;j0.registerProcessor(Mt);z0.registerProcessor(Mt)});var Tc=re((eA,_c)=>{"use strict";var vc=Gr(),Sc=Gn(),K0=gt(),Y0=Pr(),Ac=Bn(),Ec=Hr(),X0=ju(),J0=Wn(),Q0=Qo(),Z0=zo(),eg=Pn(),tg=Yr(),Zo=yc(),ng=Xr(),Cc=Kt(),wc=Vr(),rg=Ln(),ig=Ko();function ue(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Zo(e)}ue.plugin=function(t,n){let r=!1;function i(...a){console&&console.warn&&!r&&(r=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(t+`: \\u91CC\\u9762 postcss.plugin \\u88AB\\u5F03\\u7528. \\u8FC1\\u79FB\\u6307\\u5357:\nhttps://www.w3ctech.com/topic/2226`));let l=n(...a);return l.postcssPlugin=t,l.postcssVersion=new Zo().version,l}let o;return Object.defineProperty(i,"postcss",{get(){return o||(o=i()),o}}),i.process=function(a,l,s){return ue([i(s)]).process(a,l)},i};ue.stringify=rg;ue.parse=tg;ue.fromJSON=X0;ue.list=Z0;ue.comment=e=>new Sc(e);ue.atRule=e=>new vc(e);ue.decl=e=>new Ac(e);ue.rule=e=>new wc(e);ue.root=e=>new Cc(e);ue.document=e=>new Ec(e);ue.CssSyntaxError=Y0;ue.Declaration=Ac;ue.Container=K0;ue.Processor=Zo;ue.Document=Ec;ue.Comment=Sc;ue.Warning=ig;ue.AtRule=vc;ue.Result=ng;ue.Input=J0;ue.Rule=wc;ue.Root=Cc;ue.Node=eg;Q0.registerPostcss(ue);_c.exports=ue;ue.default=ue});function hr(){return globalThis}function L(e,t){if(typeof window>"u")return;let n=hr(),r=n.__hf?.onSwallowed;if(r)try{r({label:e,error:t})}catch(i){}(n.__hfDebug||n.__HYPERFRAMES_DEBUG)&&console.debug(`[hyperframes] ${e} swallowed:`,t)}var gm=["seconds-time","rational-fps","seek-keep-playing","composition-manifest-v1"];function bm(e,t){let n=Math.abs(e),r=Math.abs(t);for(;r!==0;){let i=n%r;n=r,r=i}return n||1}function xm(e){let t=Number.isFinite(e)&&e>0?e:30,n=Number.isInteger(t)?1:1e6,r=Math.round(t*n),i=bm(r,n);return{numerator:r/i,denominator:n/i}}function Di(e){if(typeof e!="object"||e===null)return null;let t=e;return!Number.isFinite(t.numerator)||!Number.isFinite(t.denominator)||(t.numerator??0)<=0||(t.denominator??0)<=0?null:Number(t.numerator)/Number(t.denominator)}function gr(e){return{protocolVersion:1,capabilities:gm,fps:xm(e)}}function ym(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function ds(e,t=30){if(typeof e!="object"||e===null)return{status:"legacy",fps:t};let n=e;if(n.protocolVersion===void 0)return{status:"legacy",fps:t};if(n.protocolVersion!==1)return{status:"unsupported",code:"unsupported_protocol_version",receivedVersion:n.protocolVersion};let r=Di(n.fps);return r===null||!ym(n.capabilities)?{status:"unsupported",code:"invalid_protocol_metadata",receivedVersion:n.protocolVersion}:{status:"supported",fps:r,metadata:n}}var fs=30;function ms(e){fs=Number.isFinite(e)&&e>0?e:30}function xe(e){try{window.parent.postMessage({...e,...gr(fs)},"*")}catch(t){L("bridge.postMessage",t)}}var vm={play:(e,t)=>t.onPlay(),pause:(e,t)=>t.onPause(),"stop-media":(e,t)=>t.onStopMedia(),seek:(e,t)=>t.onSeek(Sm(e,t),e.seekMode??"commit"),tick:(e,t)=>t.onTick(),"set-muted":(e,t)=>t.onSetMuted(!!e.muted),"set-volume":(e,t)=>t.onSetVolume(Math.max(0,Math.min(1,Number(e.volume??1)))),"set-media-output-muted":(e,t)=>t.onSetMediaOutputMuted(!!e.muted),"set-native-media-sync-disabled":(e,t)=>t.onSetNativeMediaSyncDisabled(!!e.disabled),"set-web-audio-media-disabled":(e,t)=>t.onSetWebAudioMediaDisabled(!!e.disabled),"set-playback-rate":(e,t)=>t.onSetPlaybackRate(Number(e.playbackRate??1)),"set-root-duration":(e,t)=>t.onSetRootDuration(Number(e.durationSeconds??0)),"set-color-grading":(e,t)=>t.onSetColorGrading(e.target??null,e.grading??null),"set-color-grading-compare":(e,t)=>t.onSetColorGradingCompare(e.target??null,e.compare??null),"enable-pick-mode":(e,t)=>t.onEnablePickMode(),"disable-pick-mode":(e,t)=>t.onDisablePickMode(),"flash-elements":e=>Em(e)};function Sm(e,t){let n=Number(e.timeSeconds);if(Number.isFinite(n))return Math.max(0,n);let i=Di(e.fps)??t.getCanonicalFps();return Math.max(0,Number(e.frame??0))/i}function Am(e){let t=ds(e);return t.status!=="unsupported"?!1:(xe({source:"hf-preview",type:"diagnostic",code:`runtime.protocol.${t.code}`,details:{receivedVersion:typeof t.receivedVersion=="string"||typeof t.receivedVersion=="number"?t.receivedVersion:null}}),!0)}function Em(e){let t=e.selectors,n=e.duration||800;t&&Cm(t,n)}function ps(e){let t=n=>{let r=n.data;if(!r||r.source!=="hf-parent"||r.type!=="control"||Am(r))return;let i=r.action;if(typeof i!="string")return;let o=vm[i];o&&o(r,e)};return window.addEventListener("message",t),xe({source:"hf-preview",type:"ready"}),t}function Cm(e,t){if(!document.getElementById("__hf-flash-styles")){let n=document.createElement("style");n.id="__hf-flash-styles",n.textContent=`\n .__hf-flash {\n outline: 2px solid rgba(59, 130, 246, 0.6) !important;\n outline-offset: 2px !important;\n animation: __hf-flash-pulse ${t}ms ease-out forwards !important;\n }\n @keyframes __hf-flash-pulse {\n 0% { outline-color: rgba(59, 130, 246, 0.8); }\n 100% { outline-color: transparent; }\n }\n `,document.head.appendChild(n)}for(let n of e)try{document.querySelectorAll(n).forEach(i=>{i.classList.add("__hf-flash"),setTimeout(()=>i.classList.remove("__hf-flash"),t)})}catch(r){L("bridge.flashElements.querySelector",r)}}var Ii=null;function hs(e){Ii=e}function Le(e,t){if(Ii)try{Ii({source:"hf-preview",type:"analytics",event:e,properties:t??{}})}catch(n){L("runtime.analytics.site1",n)}}function wm(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-"),n=0,r=t.length;for(;n<r&&t[n]==="-";)n++;for(;r>n&&t[r-1]==="-";)r--;let i=t.slice(n,r);return i.length>0?i:"node"}function Pt(e){return`--${wm(e)}`}function gs(e){let t=new Map;for(let n of e){let r=Pt(n),i=t.get(r);i?i.includes(n)||i.push(n):t.set(r,[n])}return[...t.values()].filter(n=>n.length>1)}function xs(){if(typeof document>"u")return{};let e=new Set;document.documentElement?.hasAttribute("data-composition-variables")&&e.add(document.documentElement);for(let i of Array.from(document.querySelectorAll("[data-composition-variables]")))e.add(i);let t={};for(let i of e)Object.assign(t,dn(i));let n=xr(),r={...t,...n};for(let i of e)Oi(i,r);return r}var bs=new Set;function ys(e){let t=e?.getAttribute("data-composition-variables");if(!t)return[];let n;try{n=JSON.parse(t)}catch{return[]}return Array.isArray(n)?n.filter(r=>!!r&&typeof r=="object"):[]}function _m(e,t){return t?.trim()||e.getAttribute("data-composition-id")?.trim()||e.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")?.trim()||"composition"}function Tm(e){return Array.isArray(e.options)?e.options.map(t=>t&&typeof t=="object"?t.value:t).filter(t=>typeof t=="string"||typeof t=="number"):[]}function Rm(e,t){if(typeof e.id!="string")return null;let n=t[e.id];if(n==null||"default"in e&&String(n)===String(e.default))return null;let r=Tm(e);return r.length===0||r.some(i=>String(i)===String(n))?null:{id:e.id,value:n,allowed:r}}function Oi(e,t,n){if(!e)return;let r=ys(e);if(r.length===0)return;let i=_m(e,n);for(let o of r){let a=Rm(o,t);if(!a)continue;let l=`${i}|${a.id}|${String(a.value)}`;if(bs.has(l))continue;bs.add(l);let s="default"in o?JSON.stringify(o.default):"the composition default";console.warn(`[hyperframes] runtime_unknown_enum_value: ${i} variable "${a.id}" got ${JSON.stringify(a.value)}, which is not a declared option (${a.allowed.join(", ")}). Rendering ${s} instead.`)}}function dn(e){let t={};for(let n of ys(e))typeof n.id!="string"||!("default"in n)||(t[n.id]=n.default);return t}var Pi="data-hf-css-vars";function br(e){return"style"in e&&typeof e.style?.setProperty=="function"}function Gi(e,t){if(!br(e))return;let n=[];for(let[r,i]of Object.entries(t))if(typeof i=="string"&&i!==""||typeof i=="number"){let o=Pt(r);e.style.setProperty(o,String(i)),n.push(o)}n.length>0&&e.setAttribute(Pi,n.join(" "))}function vs(e,t,n){let r={};for(let[i,o]of Object.entries(t)){let a=Pt(i);((br(e)?e.style.getPropertyValue(a):"")||(n?n.getComputedStyle(e).getPropertyValue(a):"")).trim()===""&&(r[i]=o)}return r}function Ss(e){if(!br(e))return;let t=e.getAttribute(Pi);if(t){for(let n of t.split(" "))n.startsWith("--")&&e.style.removeProperty(n);e.removeAttribute(Pi)}}function As(e){let t=new Set;e.documentElement?.hasAttribute("data-composition-variables")&&t.add(e.documentElement);for(let i of Array.from(e.querySelectorAll("[data-composition-variables]")))t.add(i);let n=xr(),r=[];for(let i of t)r.push(...km(i,n,e.defaultView));for(let i of gs(r))console.warn(`composition variables ${i.join(", ")} collapse to the same CSS property ${Pt(i[0]??"")} \\u2014 rename one to avoid cross-talk`)}function km(e,t,n){if(!br(e))return[];let r=dn(e),i={};for(let[o,a]of Object.entries(r)){if(o in t)continue;let l=Pt(o);(e.style.getPropertyValue(l)||(n?n.getComputedStyle(e).getPropertyValue(l):"")).trim()===""&&(i[o]=a)}for(let[o,a]of Object.entries(t))o in r&&(i[o]=a);return Gi(e,i),Object.keys(r)}function Es(e){let t=e.getAttribute("data-variable-values");if(!t)return{};let n;try{n=JSON.parse(t)}catch{return{}}return!n||typeof n!="object"||Array.isArray(n)?{}:n}function xr(){if(typeof window>"u")return{};let e=window.__hfVariables;return!e||typeof e!="object"||Array.isArray(e)?{}:e}function Cs(e){let t=[],n=u=>{if(typeof u.getAnimations!="function")return[];try{return u.getAnimations()}catch{return[]}},r=u=>e?.resolveStartSeconds?e.resolveStartSeconds(u):Number.parseFloat(u.getAttribute("data-start")??"0")||0,i=(u,c)=>{let m=null;try{m=u.effect?.getComputedTiming?.()??null}catch(h){L("runtime.adapters.css.site5",h)}if(!m)return{};let f=Number(m.endTime);return Number.isFinite(f)?{endSeconds:c+f/1e3}:{unbounded:!0}},o=(u,c)=>{for(let m of u){try{m.currentTime=c}catch(f){L("runtime.adapters.css.site1",f)}try{m.pause()}catch(f){L("runtime.adapters.css.site2",f)}}},a=u=>{for(let c of u)try{c.play()}catch(m){L("runtime.adapters.css.site3",m)}},l=u=>{for(let c of u)try{c.pause()}catch(m){L("runtime.adapters.css.site4",m)}},s=u=>{u.baseDelay?u.el.style.animationDelay=u.baseDelay:u.el.style.removeProperty("animation-delay"),u.basePlayState?u.el.style.animationPlayState=u.basePlayState:u.el.style.removeProperty("animation-play-state")};return{name:"css",discover:()=>{t=[];let u=document.querySelectorAll("*");for(let c of u){if(!(c instanceof HTMLElement))continue;let m=window.getComputedStyle(c);!m.animationName||m.animationName==="none"||t.push({el:c,baseDelay:c.style.animationDelay||"",basePlayState:c.style.animationPlayState||"",animations:n(c)})}},getInferredDurationSeconds:()=>{let u=0;for(let c of t){if(!c.el.isConnected)continue;let m=r(c.el);for(let f of n(c.el)){let h=i(f,m);h.endSeconds!=null&&(u=Math.max(u,h.endSeconds))}}return u>0?u:null},seek:u=>{let c=Number(u.time)||0;for(let m of t){if(!m.el.isConnected)continue;let f=r(m.el),h=Math.max(0,c-f)*1e3,b=m.animations;if(b.length>0){o(b,h);continue}m.el.style.animationPlayState="paused",m.el.style.animationDelay=`-${(h/1e3).toFixed(3)}s`}},pause:()=>{for(let u of t){if(!u.el.isConnected)continue;let c=u.animations;c.length>0&&l(c),s(u)}},play:()=>{for(let u of t)u.el.isConnected&&(s(u),a(u.animations))},revert:()=>{t=[]}}}function ws(e){return{name:"gsap",discover:()=>{},seek:t=>{let n=e.getTimeline();if(!n)return;n.pause();let r=Math.max(0,Number(t.time)||0),i=t.suppressEvents===!0;typeof n.totalTime=="function"?(n.totalTime(r+.001,!0),n.totalTime(r,i)):n.seek(r,i)},pause:()=>{let t=e.getTimeline();t&&t.pause()}}}function _s(){return{name:"animejs",discover:()=>{try{let e=window.anime;if(!e||typeof e.running>"u")return;let t=e.running;if(!Array.isArray(t)||t.length===0)return;let n=window.__hfAnime??[],r=new Set(n);for(let i of t)r.has(i)||n.push(i);window.__hfAnime=n}catch(e){L("runtime.adapters.animejs.site1",e)}},seek:e=>{let t=Math.max(0,(Number(e.time)||0)*1e3),n=window.__hfAnime;if(!(!n||n.length===0))for(let r of n)try{typeof r.seek=="function"&&r.seek(t)}catch(i){L("runtime.adapters.animejs.site2",i)}},pause:()=>{let e=window.__hfAnime;if(!(!e||e.length===0))for(let t of e)try{typeof t.pause=="function"&&t.pause()}catch(n){L("runtime.adapters.animejs.site3",n)}},play:()=>{let e=window.__hfAnime;if(!(!e||e.length===0))for(let t of e)try{typeof t.play=="function"&&t.play()}catch(n){L("runtime.adapters.animejs.site4",n)}},revert:()=>{}}}function Rs(){return{name:"lottie",discover:()=>{try{let e=window.lottie;if(e&&typeof e.getRegisteredAnimations=="function"){let t=e.getRegisteredAnimations();if(Array.isArray(t)&&t.length>0){let n=window.__hfLottie??[],r=new Set(n);for(let i of t)r.has(i)||n.push(i);window.__hfLottie=n}}}catch(e){L("runtime.adapters.lottie.site1",e)}},seek:e=>{let t=Math.max(0,Number(e.time)||0),n=window.__hfLottie;if(!(!n||n.length===0))for(let r of n)try{if(Hi(r))r.goToAndStop(t*1e3,!1);else if(Bi(r)){if(typeof r.setCurrentRawFrameValue=="function"){let i=r.totalFrames??0,o=r.frameRate??30,a=t*o;i>0&&r.setCurrentRawFrameValue(Math.min(a,i-1))}else if(typeof r.seek=="function"){let i=r.duration??1,o=Math.min(100,t/i*100);r.seek(o)}}}catch(i){L("runtime.adapters.lottie.site2",i)}},pause:()=>{let e=window.__hfLottie;if(!(!e||e.length===0))for(let t of e)try{(Hi(t)||Bi(t))&&t.pause()}catch(n){L("runtime.adapters.lottie.site3",n)}},revert:()=>{},getInferredDurationSeconds:()=>{let e=window.__hfLottie;if(!e||e.length===0)return null;let t=0,n=!1;for(let r of e){let i=null;try{i=Mm(r)}catch(o){L("runtime.adapters.lottie.site4",o)}i!=null&&(n=!0,t=Math.max(t,i))}return n?t:null}}}function Ts(e,t){return!Number.isFinite(e)||!e||e<=0||!Number.isFinite(t)||!t||t<=0?null:e/t}function Mm(e){return Hi(e)?Ts(e.totalFrames,e.frameRate):Bi(e)?Number.isFinite(e.duration)&&(e.duration??0)>0?e.duration??null:Ts(e.totalFrames,e.frameRate):null}function Hi(e){return typeof e=="object"&&e!==null&&typeof e.goToAndStop=="function"}function Bi(e){return typeof e=="object"&&e!==null&&typeof e.pause=="function"&&("totalFrames"in e||"duration"in e)}var Ui=-1,yr=new Set,Ot,Wi=0;function ks(e){let t=[],n=!0,r={time:e,waitUntil:o=>{if(!n)throw new Error("hf-seek waitUntil() must be called synchronously from the event listener");t.push(o)}};try{window.dispatchEvent(new CustomEvent("hf-seek",{detail:r}))}catch(o){L("runtime.adapters.seek-dispatch.site1",o)}finally{n=!1}if(t.length===0)return;let i=Promise.all(t).then(()=>({status:"fulfilled"})).catch(o=>({status:"rejected",reason:o}));yr.add(i),i.then(o=>{yr.delete(i)&&o.status==="rejected"&&Ot===void 0&&(Ot={reason:o.reason})})}function vr(e){e!==Ui&&(Ui=e,ks(e))}function Sr(e){Ui=e,ks(e)}function Ms(){return Wi>0}async function Vi(){Wi+=1;let e=Ot;try{for(await Promise.resolve();yr.size>0;){let r=(await Promise.all([...yr])).find(i=>i.status==="rejected");e===void 0&&r?.status==="rejected"&&(e={reason:r.reason})}let t=Ot;if(e===void 0&&(e=t),Ot===t&&(Ot=void 0),e)throw e.reason}finally{Wi-=1}}function Fs(){let e=null,t=0,n=null,r=null,i=null,o=null,a=()=>{if(typeof window>"u")return null;let c=window.THREE?.DefaultLoadingManager;return!c||typeof c!="object"||typeof c.itemsLoaded!="number"||typeof c.itemsTotal!="number"?null:c},l=u=>{o||u.itemsTotal<=u.itemsLoaded||(o=new Promise(c=>{u.onLoad=function(){try{i?.call(this)}finally{o=null,u.onLoad=i??null,c()}}}))},s=u=>{n!==u&&(n=u,r=u.onStart??null,i=u.onLoad??null,u.onStart=function(c,m,f){try{r?.call(this,c,m,f)}finally{l(u)}})};return{name:"three",discover:()=>{let u=a();u&&(s(u),l(u))},seek:u=>{e=Math.max(0,Number(u.time)||0),t=e,window.__hfThreeTime=e,vr(e)},pause:()=>{e==null&&(e=Math.max(0,t))},play:()=>{e=null},revert:()=>{e=null,t=0},getReadyPromise:()=>{let u=a();return!u||u.itemsTotal<=u.itemsLoaded?null:(o||l(u),o)}}}function Ke(e){let t=null,n=new WeakSet;return{name:e.name,discover:()=>{},seek:()=>{},pause:()=>{},play:()=>{},revert:()=>{},getReadyPromise:()=>{let r=e.getInstances();if(r.length===0)return null;let i=r.filter(o=>!n.has(o));return i.length===0?null:t||(t=Promise.allSettled(i.map(o=>e.waitFor(o).then(()=>{n.add(o)}))).then(()=>{t=null}),t)}}}function Ns(){return Ke({name:"mapbox",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfMapbox;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{if(e.loaded()){t();return}e.on("load",t)})})}function Ls(){return Ke({name:"leaflet",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfLeaflet;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>e.whenReady(t))})}function Ds(){return Ke({name:"google-maps",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfGoogleMaps;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{let n=e.addListener("tilesloaded",()=>{n.remove(),t()})})})}function Is(){return Ke({name:"maplibre",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfMaplibre;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{if(e.loaded()){t();return}e.on("load",t)})})}function Ps(){return Ke({name:"d3",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfD3;return Array.isArray(e)?e:[]},waitFor:e=>e.end()})}var Fm=250;function Os(){let e=null,t=0,n=null,r=()=>{n!==null&&(window.clearInterval(n),n=null)},i=()=>{n===null&&document.querySelector("[data-composition-id][data-requires-webgpu]")&&(n=window.setInterval(()=>{e!==null&&(Ms()||(window.__hfTypegpuTime=e,Sr(e)))},Fm))};return{name:"typegpu",discover:()=>{},seek:o=>{e=Math.max(0,Number(o.time)||0),t=e,window.__hfTypegpuTime=e,vr(e)},pause:()=>{e==null&&(e=Math.max(0,t)),i()},play:()=>{r(),e=null},revert:()=>{r(),e=null,t=0}}}var Gs="data-hf-render-id";function Nm(e){return e.getAttribute(Gs)||e.id||null}var Lm="__render_frame_",Dm="__";function Im(e){return`${Lm}${e}${Dm}`}function Pm(e){let t=Nm(e);return t?Im(t):null}function ct(e){let t=Pm(e);if(!t)return null;let n=document.getElementById(t);return n instanceof HTMLImageElement?n:null}function Hs(e){let t=e.nextElementSibling;if(t instanceof HTMLImageElement&&t.classList.contains("__render_frame__")&&t.complete&&t.naturalWidth>0)return t;let n=ct(e);return n&&n.complete&&n.naturalWidth>0?n:null}function Bs(){let e=globalThis.GPUQueue;if(!e?.prototype?.copyExternalImageToTexture)return;let t=e.prototype.copyExternalImageToTexture;e.prototype.copyExternalImageToTexture=function(n,r,i){if(n?.source instanceof HTMLVideoElement){let o=Hs(n.source);if(o)return t.call(this,{...n,source:o},r,i)}return t.call(this,n,r,i)}}function Us(){let e=[globalThis.WebGL2RenderingContext,globalThis.WebGLRenderingContext],t=["texImage2D","texSubImage2D"];for(let n of e){let r=n?.prototype;if(r)for(let i of t){let o=r[i];if(typeof o!="function"||o.__hfVideoPatched)continue;let a=function(...l){let s=l.length-1,u=l[s];if(u instanceof HTMLVideoElement){let c=Hs(u);c&&(l[s]=c)}return o.apply(this,l)};a.__hfVideoPatched=!0,r[i]=a}}}function Ws(){let e=!1,t=0,n=!1,r,i,o,a=new Set,l=new WeakMap,s=()=>{if(!document.getAnimations)return[];try{return document.getAnimations()}catch{return[]}},u=x=>{let _=Number(x.currentTime);return Number.isFinite(_)&&_>0?_:0},c=(x,_)=>_<=0?x:x>=_?Math.max(0,x-_):x,m=(x,_)=>{let R=l.get(x);if(R)return R;let T={compositionTimeMs:_,animationTimeMs:e?c(u(x),_):u(x)};return l.set(x,T),T},f=(x,_)=>{if(!a.has(x)){a.add(x);let R=()=>{a.delete(x)};try{x.addEventListener("finish",R,{once:!0}),x.addEventListener("cancel",R,{once:!0})}catch(T){L("runtime.adapters.waapi.site4",T)}}m(x,_)},h=(x,_)=>{for(let R of x)f(R,_)},b=()=>{if(n||typeof Element>"u")return;let x=Element.prototype;if(typeof x.animate!="function"||x.__hfOriginalAnimate)return;let _=x.animate;try{Object.defineProperty(x,"__hfOriginalAnimate",{value:_,configurable:!0});let R=function(...T){let F=_.apply(this,T);return f(F,t),F};x.animate=R,r=x,i=_,o=R,n=!0}catch{}},v=x=>{let _=null;try{_=x.effect?.getComputedTiming?.()??null}catch(F){L("runtime.adapters.waapi.site4",F)}if(!_)return{};let R=Number(_.endTime);return Number.isFinite(R)?{endSeconds:(l.get(x)?.compositionTimeMs??0)/1e3+R/1e3}:{unbounded:!0}};return{name:"waapi",discover:()=>{e=!0,b(),h(s(),t)},seek:x=>{let _=Math.max(0,(Number(x.time)||0)*1e3);t=_,(!e||a.size>0)&&h(s(),e?_:0);for(let R of a){let T=e?m(R,_):m(R,0),F=T.animationTimeMs+Math.max(0,_-T.compositionTimeMs);try{R.currentTime=F}catch(M){L("runtime.adapters.waapi.site1",M)}try{R.pause()}catch(M){L("runtime.adapters.waapi.site2",M)}}},pause:()=>{e||h(s(),t);for(let x of a)try{x.pause()}catch(_){L("runtime.adapters.waapi.site3",_)}},revert:()=>{if(a.clear(),l=new WeakMap,e=!1,t=0,r&&i&&o&&r.animate===o)try{r.animate=i,r.__hfOriginalAnimate===i&&delete r.__hfOriginalAnimate}catch(x){L("runtime.adapters.waapi.site5",x)}r=void 0,i=void 0,o=void 0,n=!1},getInferredDurationSeconds:()=>{let x=0;for(let _ of s()){let R=v(_);R.endSeconds!=null&&(x=Math.max(x,R.endSeconds))}return x>0?x:null}}}var zi=3.981071705534972;function He(e){return Number.isFinite(e)?Math.max(0,Math.min(zi,e)):1}function Vs(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function zs(e,t){let n=typeof HTMLMediaElement>"u"?void 0:Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,"volume"),r=n?.get,i=n?.set;if(!r||!i)return t();let o=Number(r.call(e));Object.defineProperty(e,"volume",{configurable:!0,get:()=>o,set:a=>{o=Number(a),i.call(e,Vs(o))}});try{return t()}finally{delete e.volume,i.call(e,Vs(o))}}var Gt=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),I1=Object.freeze([Gt.start,Gt.duration,Gt.trackIndex]),P1=Object.freeze([Gt.derivedEnd]),O1=Object.freeze([Gt.derivedEnd,Gt.legacyTrack]);function Be(e){if(e==null||e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}var $s=/^[A-Za-z0-9_.:-]+$/;function js(e,t){let n=e.charCodeAt(t);return n>=48&&n<=57}function qs(e,t){let n=t;for(;n>=0&&js(e,n);)n--;return n}function Om(e,t){let n=t;for(;n>=0&&(e[n]??"").trim()==="";)n--;return n}function Gm(e){let t=e.length-1;if(!js(e,t))return null;let n=qs(e,t);return e[n]==="."&&(n=qs(e,n-1)),n+1}function Hm(e){let t=Gm(e);if(t==null)return null;let n=Om(e,t-1),r=e[n];if(r!=="+"&&r!=="-")return null;let i=e.slice(0,n).trim();if(!$s.test(i))return null;let o=Number(e.slice(t));return Number.isFinite(o)?{refId:i,operator:r,magnitude:o}:null}function qi(e){let t=(e??"").trim();if(!t)return null;let n=Be(t);if(n!=null)return{kind:"absolute",value:n};if($s.test(t))return{kind:"reference",refId:t,offset:0};let r=Hm(t);return r?{kind:"reference",refId:r.refId,offset:r.operator==="-"?-r.magnitude:r.magnitude}:null}function Ks(e){return Number.isFinite(e)&&e>0?Math.max(.1,Math.min(5,e)):1}function ve(e){return Be(e)}function _e(e){let t=Number.parseFloat(e.getAttribute("data-playback-rate")??""),n=Number.isFinite(t)&&t>0?t:typeof HTMLMediaElement<"u"&&e instanceof HTMLMediaElement?e.defaultPlaybackRate:1;return Ks(n)}function fn(e){let t=n=>{let r=ve(n);return r==null?null:Number.isFinite(r)&&r>=0?r:null};return t(e.getAttribute("data-playback-start"))??t(e.getAttribute("data-media-start"))??0}function tt(e,t){return Bm(t,fn(e),_e(e))}function Bm(e,t,n){return Number.isFinite(e)?Math.max(0,e-t)/Ks(n):null}function Um(e,t,n){let r=e.filter(o=>Number.isFinite(o.time)&&Number.isFinite(o.volume)).map(o=>({time:Math.max(0,o.time-t),volume:He(o.volume)})).sort((o,a)=>o.time-a.time),i=[];for(let o of r){let a=i.at(-1);a&&Math.abs(a.time-o.time)<1e-9?a.volume=o.volume:i.push(o)}return i.length===0||i[0].time>0&&i.unshift({time:0,volume:He(n)}),i}function Ys(e,t){if(e.length===0)return 1;let n=0;for(;n<e.length-2&&t>=e[n+1].time;)n+=1;let r=e[n],i=e[n+1]??r,o=i.time-r.time,a=o<=0?0:Math.min(1,Math.max(0,(t-r.time)/o));return r.volume+(i.volume-r.volume)*a}function Wm(e,t,n,r){let i=e.at(-1);!i||Math.abs(i.volume-n.volume)>1e-4?(i&&t&&t.time>i.time&&e.push(t),e.push(n)):r&&n.time>i.time&&e.push(n)}function Vm(e){let t=Number.parseFloat(e??"");return Number.isFinite(t)?t:void 0}function Xs(e,t){let n=ve(e.dataset.start)??0,r=ve(e.dataset.end)??void 0,i=ve(e.dataset.duration)??void 0,o=t;i!==void 0&&i>0?o=n+i:r!==void 0&&r>n&&(o=r);let a=Vm(e.dataset.volume)??1;return{start:n,end:o,staticVolume:He(a)}}function zm(e,t,n,r){let{start:i,end:o,staticVolume:a}=Xs(e,n),l=1/Math.min(60,Math.max(1,r)),s=Math.max(0,i),u=Math.min(n,o),c=zs(e,()=>{e.volume=a;let f=[],h;for(let b=s;b<=u+1e-6;b=Math.min(u,b+l)){t(b);let v=Number(e.volume);if(Number.isFinite(v)){let x={time:Number(b.toFixed(6)),volume:Number(He(v).toFixed(6))};Wm(f,h,x,b===u),h=x}if(b===u)break}return f});return c.some(f=>Math.abs(f.volume-a)>1e-4)?c:null}function Js(e,t,n,r,i={}){if(i.allowLiveTimelineSeek===!1||!t||!(e instanceof HTMLAudioElement)&&!(e instanceof HTMLVideoElement)||n<=0)return;let o=s=>{try{typeof t.totalTime=="function"?t.totalTime(s,!0):typeof t.seek=="function"&&t.seek(s,!0)}catch{}},a=typeof t.totalTime=="function"?Number(t.totalTime()):typeof t.seek=="function"?Number(t.seek()):0,l=zm(e,o,n,60);if(Number.isFinite(a)&&o(a),l){let{start:s,staticVolume:u}=Xs(e,n),c=Um(l,s,u);c.length>0&&r.set(e,c)}}var pn="data-fx-chain",j1=pn.slice(5),Qs=1,mn=(e="frequency",t="Frequency",n=1e3,r=20,i=2e4)=>({kind:"number",key:e,label:t,unit:"Hz",min:r,max:i,step:1,default:n,scale:"log",automatable:!0}),$i=(e=.707,t="Bandwidth \\u2014 higher is narrower.")=>({kind:"number",key:"q",label:"Q",unit:"",min:.1,max:20,step:.01,default:e,scale:"log",automatable:!0,hint:t}),Ar=(e=-40,t=40,n=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:e,max:t,step:.1,default:n,automatable:!0}),Zs={kind:"enum",key:"poles",label:"Slope",options:[{value:"1",label:"6 dB/oct"},{value:"2",label:"12 dB/oct"}],default:"2",hint:"Two poles is the usual biquad; one pole is gentler."},el=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[Ar(-60,12,0)],web:"gain-node"},{id:"peaking",label:"Peaking EQ",group:"filter",description:"Boost or cut a band, leaving everything either side alone.",params:[mn("frequency","Frequency",1e3),Ar(-40,40,0),$i(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[mn("frequency","Frequency",200,20,2e3),Ar(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[mn("frequency","Frequency",4e3,500,2e4),Ar(-40,40,0)],web:"biquad-highshelf"},{id:"highpass",label:"High-pass",group:"filter",description:"Remove low frequencies \\u2014 the usual fix for rumble on a voice.",params:[mn("frequency","Cutoff",300,20,2e4),$i(.707),Zs],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies \\u2014 darkens or muffles a track.",params:[mn("frequency","Cutoff",8e3,100,2e4),$i(.707),Zs],web:"biquad-lowpass"},{id:"compressor",label:"Compressor",group:"dynamics",description:"Pull loud parts down so the quiet ones can come up.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-60,max:0,step:.5,default:-24,hint:"Level above which the compressor starts working."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:4},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:2e3,step:.1,default:20,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:250,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83,hint:"1 is a hard corner; higher eases into it."},{kind:"number",key:"makeup",label:"Makeup",unit:"dB",min:0,max:36,step:.1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1,hint:"Below 1 blends the dry signal back in."}],web:"worklet-compressor"},{id:"limiter",label:"Limiter",group:"dynamics",description:"Hard ceiling \\u2014 nothing gets past the limit.",params:[{kind:"number",key:"limit",label:"Ceiling",unit:"dB",min:-24,max:0,step:.1,default:-1},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.1,max:80,step:.1,default:5},{kind:"number",key:"release",label:"Release",unit:"ms",min:1,max:8e3,step:1,default:50,scale:"log"},{kind:"number",key:"level_out",label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0}],web:"worklet-limiter"},{id:"gate",label:"Noise Gate",group:"dynamics",description:"Silence the track when it drops below the threshold.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-80,max:0,step:.5,default:-35},{kind:"number",key:"range",label:"Range",unit:"dB",min:-80,max:0,step:.5,default:-24,hint:"How far down the gate pulls when closed."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:10},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:9e3,step:.1,default:1,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:100,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83}],web:"worklet-gate"},{id:"saturate",label:"Saturation",group:"nonlinear",description:"Soft-clip the waveform for warmth or outright distortion.",params:[{kind:"enum",key:"type",label:"Curve",options:[{value:"tanh",label:"Tanh"},{value:"atan",label:"Arctan"},{value:"cubic",label:"Cubic"},{value:"exp",label:"Exponential"},{value:"alg",label:"Algebraic"},{value:"quintic",label:"Quintic"},{value:"sin",label:"Sine"},{value:"erf",label:"Error function"},{value:"hard",label:"Hard clip"}],default:"tanh"},{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-40,max:0,step:.1,default:-6},{kind:"number",key:"output",automatable:!0,label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0},{kind:"number",key:"oversample",label:"Oversample",unit:"x",min:1,max:8,step:1,default:4,hint:"Higher costs more but keeps aliasing down."}],web:"waveshaper"},{id:"bitcrush",label:"Bitcrush",group:"nonlinear",description:"Drop bit depth and sample rate for a lo-fi, digital sound.",params:[{kind:"number",key:"bits",label:"Bit depth",unit:"bit",min:1,max:32,step:.1,default:8},{kind:"number",key:"samples",label:"Sample hold",unit:"x",min:1,max:250,step:1,default:1,hint:"Repeats each sample N times \\u2014 a crude downsample."},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-bitcrush"},{id:"pitchshift",label:"Pitch shift",group:"time",description:"Shifts pitch up or down without changing playback speed.",params:[{kind:"number",key:"semitones",label:"Semitones",unit:"st",min:-12,max:12,step:1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-pitchshift"},{id:"delay",label:"Delay",group:"time",description:"Repeating echoes behind the dry signal.",params:[{kind:"number",key:"time",automatable:!0,label:"Time",unit:"ms",min:1,max:5e3,step:1,default:250,scale:"log"},{kind:"number",key:"feedback",automatable:!0,label:"Feedback",unit:"",min:.01,max:.95,step:.01,default:.35},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.4}],web:"delay-feedback"},{id:"chorus",label:"Chorus",group:"time",description:"Detuned copies of the signal for width and thickness.",params:[{kind:"number",key:"delay",automatable:!0,label:"Delay",unit:"ms",min:1,max:100,step:.1,default:7},{kind:"number",key:"depth",automatable:!0,label:"Depth",unit:"ms",min:0,max:10,step:.01,default:2},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.01,max:10,step:.01,default:1},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.5}],web:"chorus-lfo"},{id:"phaser",label:"Phaser",group:"time",description:"Sweeping notches moving through the spectrum.",params:[{kind:"number",key:"in_gain",automatable:!0,label:"Input",unit:"",min:0,max:1,step:.01,default:.4},{kind:"number",key:"out_gain",automatable:!0,label:"Output",unit:"",min:0,max:2,step:.01,default:.74},{kind:"number",key:"delay",label:"Delay",unit:"ms",min:.1,max:5,step:.1,default:3},{kind:"number",key:"decay",label:"Decay",unit:"",min:0,max:.99,step:.01,default:.4},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.1,max:2,step:.01,default:.5},{kind:"enum",key:"type",label:"Waveform",options:[{value:"0",label:"Triangular"},{value:"1",label:"Sinusoidal"}],default:"0"}],web:"allpass-phaser"},{id:"reverb",label:"Reverb",group:"time",description:"Room tail. Both ends convolve the same generated impulse, so preview matches render.",params:[{kind:"number",key:"size",label:"Room size",unit:"",min:.05,max:1,step:.01,default:.7},{kind:"number",key:"damping",label:"Damping",unit:"",min:0,max:1,step:.01,default:.5,hint:"Higher rolls the top off the tail faster."},{kind:"number",key:"wet",automatable:!0,label:"Wet",unit:"",min:0,max:1,step:.01,default:.35},{kind:"number",key:"dry",automatable:!0,label:"Dry",unit:"",min:0,max:1,step:.01,default:.7}],web:"convolver"}],ji=new Map(el.map(e=>[e.id,e]));function hn(e){return ji.get(e)}var K1=el.map(e=>e.id);function gn(e,t){let n=ji.get(e);if(!n)return{};let r={};for(let i of n.params){let o=t?.[i.key];if(i.kind==="enum"){let l=i.options.some(s=>s.value===o);r[i.key]=l?o:i.default;continue}let a=typeof o=="number"?o:typeof o=="string"&&o.trim()!==""?Number(o):Number.NaN;r[i.key]=Number.isFinite(a)?Math.min(i.max,Math.max(i.min,a)):i.default}return r}var dt=class extends Error{constructor(t){super(t),this.name="AudioFxChainError"}};function tl(e){let t;try{t=JSON.parse(e)}catch(i){throw new dt(`Chain file is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new dt("Chain file must be a JSON object.");let n=t;if(n.version!==Qs)throw new dt(`Unsupported chain version: ${String(n.version)}`);if(!Array.isArray(n.nodes))throw new dt("Chain file is missing a `nodes` array.");let r=n.nodes.map((i,o)=>{if(typeof i!="object"||i===null)throw new dt(`Node ${o} is not an object.`);let a=i;if(typeof a.type!="string"||!ji.has(a.type))throw new dt(`Node ${o} has unknown effect type: ${String(a.type)}`);return{type:a.type,...typeof a.id=="string"&&a.id?{id:a.id}:{},...a.fromCarve===!0?{fromCarve:!0}:{},...typeof a.fromPreset=="string"&&a.fromPreset?{fromPreset:a.fromPreset}:{},...typeof a.label=="string"&&a.label?{label:a.label}:{},...typeof a.fromEq=="string"&&a.fromEq?{fromEq:a.fromEq}:{},...a.fromLeveller===!0?{fromLeveller:!0}:{},...typeof a.presetAmount=="number"&&Number.isFinite(a.presetAmount)?{presetAmount:Math.min(1,Math.max(0,a.presetAmount))}:{},enabled:a.enabled!==!1,params:gn(a.type,a.params??void 0)}});return{version:Qs,nodes:r}}function bn(e){return e.nodes.filter(t=>t.enabled!==!1)}var Tt="data-automation",Q1=Tt.slice(5),Er=1,qm=512,nt=class extends Error{constructor(t){super(t),this.name="AudioAutomationError"}},Ht="volume";function yn(e){if(e===Ht)return{kind:"volume"};let t=e.split(".");if(t.length===3&&t[0]==="fx"&&t[1]===$m){let i=t[2];return i?{kind:"preset",presetId:i}:null}if(t.length!==3||t[0]!=="fx")return null;let[,n,r]=t;return!n||!r?null:{kind:"fx",nodeId:n,param:r}}var $m="preset";var jm={min:0,max:1,step:.01,unit:"",label:"Amount",scale:"linear",default:1},Cr={min:0,max:zi,step:.01,unit:"",label:"Volume",scale:"linear",default:1};function Ki(e,t){let n=yn(e);if(!n)return null;if(n.kind==="volume")return Cr;if(n.kind==="preset")return t?.nodes.some(l=>l.fromPreset===n.presetId)?{...jm,label:`${n.presetId} \\xB7 Amount`}:null;let r=t?.nodes.find(a=>a.id===n.nodeId);if(!r)return null;let i=hn(r.type),o=i?.params.find(a=>a.key===n.param);return!o||o.kind!=="number"?null:{min:o.min,max:o.max,step:o.step,unit:o.unit,label:`${i?.label??r.type} \\xB7 ${o.label}`,scale:o.scale==="log"&&o.min>0?"log":"linear",default:o.default}}function xn(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null}function Km(e){let t=xn(e);return t===null||t===0?0:Math.min(1,Math.max(-1,t))}function nl(e,t){let n=xn(e),r=xn(t);if(n===null||r===null)return null;let i=l=>Math.min(.999,Math.max(.001,l)),o=i(n),a=i(r);return Math.abs(o-a)<1e-6?null:{x:o,y:a}}function Ym(e){let t=Km(e?.curve),n=nl(e?.viaX,e?.viaY);return{...t?{curve:t}:{},...n?{viaX:n.x,viaY:n.y}:{}}}function Xm(e,t){let n=xn(e?.t),r=xn(e?.v);if(n===null||r===null)return null;let i=t?Math.min(t.max,Math.max(t.min,r)):r;return{t:Math.max(0,n),v:i,...Ym(e)}}function rl(e,t){let n=e.map(i=>Xm(i,t)).filter(i=>i!==null).sort((i,o)=>i.t-o.t),r=[];for(let i of n)r.length>0&&r[r.length-1].t===i.t?r[r.length-1]=i:r.push(i);return r.slice(0,qm)}function Jm(e){let t=[];for(let n of e.lanes){if(!yn(n.target))continue;let r=n.target===Ht?Cr:null,i=rl(n.points??[],r);i.length>0&&t.push({target:n.target,points:i})}return{version:Er,lanes:t}}function il(e,t){let n=[];for(let r of e.lanes){let i=Ki(r.target,t);if(!i)continue;let o=rl(r.points,i);o.length>0&&n.push({target:r.target,points:o})}return{version:Er,lanes:n}}function wr(e){let t;try{t=JSON.parse(e)}catch(i){throw new nt(`Automation is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new nt("Automation must be a JSON object.");let n=t;if(n.version!==Er)throw new nt(`Unsupported automation version: ${String(n.version)}`);if(!Array.isArray(n.lanes))throw new nt("Automation is missing a `lanes` array.");let r=n.lanes.map((i,o)=>{if(typeof i!="object"||i===null)throw new nt(`Lane ${o} is not an object.`);let a=i;if(typeof a.target!="string"||!yn(a.target))throw new nt(`Lane ${o} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new nt(`Lane ${o} is missing a \\`points\\` array.`);return{target:a.target,points:a.points}});return Jm({version:Er,lanes:r})}function Qm(e,t){return t?Math.pow(e,Math.pow(2,2*t)):e}function Zm(e,t){let n=e-.5,r=t-.5,i=.999,o=1e6,a=n>0?n/(i-e):n<0?-n/(e-(1-i)):0,l=r>0?r/(i-t):r<0?-r/(t-(1-i)):0,s=Math.min(o,Math.max(1,a,l));return{cx:e+n/s,cy:t+r/s,w:s}}function ep(e,t,n){let{cx:r,cy:i,w:o}=Zm(t,n),a=2-2*o,l=e*a-1+2*o*r,s=-e*a-2*o*r,u=tp(l,s,e),c=1-u,m=c*c+2*o*u*c+u*u;return m>0?(2*o*i*u*c+u*u)/m:e}function tp(e,t,n){if(Math.abs(e)<1e-12)return Math.abs(t)<1e-12?n:-n/t;let r=Math.sqrt(Math.max(0,t*t-4*e*n)),i=(-t+r)/(2*e),o=(-t-r)/(2*e),a=l=>l>=-1e-9&&l<=1+1e-9;return a(i)?Math.min(1,Math.max(0,i)):a(o)?Math.min(1,Math.max(0,o)):n}function np(e,t){let n=nl(t.viaX,t.viaY);return n?ep(Math.min(1,Math.max(0,e)),n.x,n.y):Qm(e,t.curve)}function rp(e,t,n,r){return r==="log"&&e>0&&t>0?Math.exp(Math.log(e)+(Math.log(t)-Math.log(e))*n):e+(t-e)*n}function vn(e,t,n="linear"){let r=e.points;if(r.length===0)return 0;let i=r[0];if(t<=i.t)return i.v;let o=r[r.length-1];if(t>=o.t)return o.v;let a=0,l=r.length-1;for(;l-a>1;){let m=a+l>>1;r[m].t<=t?a=m:l=m}let s=r[a],u=r[l],c=u.t-s.t;return c<=0?u.v:rp(s.v,u.v,np((t-s.t)/c,s),n)}function ol(e){return e.points.length<=1||e.points.every(t=>t.v===e.points[0].v)}function al(e,t,n,r,i="linear"){let o=Math.max(2,Math.floor(r)),a=new Float32Array(o),l=n-t;for(let s=0;s<o;s+=1)a[s]=vn(e,t+l*s/(o-1),i);return a}var _r=new Map,ip=64;function op(e){let t=_r.get(e);if(t!==void 0)return t;let n=null;try{n=wr(e).lanes.find(r=>r.target===Ht)??null}catch{n=null}return _r.size>ip&&_r.clear(),_r.set(e,n),n}function sl(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(Tt):null)??"";if(!n)return null;let r=op(n);return!r||r.points.length===0?null:vn(r,t)}function Ye(e){return fn(e)}function ll(e){let t=e.isVideo?e.explicitDuration??e.sourceDuration:e.sourceDuration,n=(e.isVideo?[t,e.hostRemaining]:[t,e.hostRemaining,e.explicitDuration]).filter(r=>r!=null&&Number.isFinite(r)&&r>=0);return n.length>0?Math.min(...n):null}function ul(e){let t=Array.from(document.querySelectorAll("video, audio")),n=e?.shouldIncludeElement?t.filter(a=>e.shouldIncludeElement?.(a)):t.filter(a=>a.hasAttribute("data-start")),r=[],i=[],o=0;for(let a of n){let l=e?.resolveStartSeconds?e.resolveStartSeconds(a):Number.parseFloat(a.dataset.start??"0");if(!Number.isFinite(l))continue;let s=Ye(a),u=_e(a),c=a.loop,m=Number.isFinite(a.duration)&&a.duration>0?a.duration:null,f=e?.resolveDurationSeconds?.(a)??Number.parseFloat(a.dataset.duration??"");(!Number.isFinite(f)||f<0)&&m!=null&&(f=Math.max(0,(m-s)/u));let h=Number.isFinite(f)&&f>=0,b=h?l+f:Number.POSITIVE_INFINITY,v=Number.parseFloat(a.dataset.volume??""),x={el:a,start:l,mediaStart:s,duration:h?f:Number.POSITIVE_INFINITY,end:b,volume:Number.isFinite(v)?v:null,playbackRate:u,loop:c,sourceDuration:m};r.push(x),a.tagName==="VIDEO"&&i.push(x),Number.isFinite(b)&&(o=Math.max(o,b))}return{timedMediaEls:n,mediaClips:r,videoClips:i,maxMediaEnd:o}}var Xi=new WeakMap,Tr=new WeakMap,Sn=new WeakMap,Ji=new WeakSet,Bt=new WeakSet;function ap(e){if(Bt.has(e))return;Bt.add(e);let t=()=>Bt.delete(e);e.addEventListener("playing",t,{once:!0}),e.addEventListener("pause",t,{once:!0}),e.addEventListener("error",t,{once:!0})}var sp=3;function lp(e){return e.error!=null||e.networkState===sp}var Qi=new WeakMap;function Yi(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function Zi(e){Xi.delete(e),Tr.delete(e),Sn.delete(e),Ji.delete(e),Qi.delete(e)}function cl(e){let t=!!(e.outputMuted||e.userMuted);for(let n of e.clips){let{el:r}=n;if(!r.isConnected)continue;let i=(e.timeSeconds-n.start)*n.playbackRate+n.mediaStart,o=r.tagName==="VIDEO"&&!n.loop,a=o&&n.sourceDuration!=null&&i>=n.sourceDuration&&e.timeSeconds>=n.start&&e.timeSeconds<n.end;a&&n.sourceDuration!=null&&(i=n.sourceDuration);let l=Tr.get(r),s=r.tagName==="AUDIO"&&(l===void 0||i<l-.04),u=!n.loop&&n.sourceDuration!=null&&i>=n.mediaStart&&i<n.sourceDuration&&(o||s);if(e.timeSeconds>=n.start&&e.timeSeconds<n.end&&i>=0&&(!r.ended||n.loop||a||u)){if(Tr.set(r,i),n.loop&&n.sourceDuration!=null&&n.sourceDuration>0){let G=n.sourceDuration-n.mediaStart;G>0&&i>=n.sourceDuration&&(i=n.mediaStart+(i-n.mediaStart)%G)}let f=Yi(e.userVolume??1),h=He(n.volume??1),b=Qi.get(r),v=Yi(r.volume),x,_=sl(r,e.timeSeconds-n.start);if(_!==null)x=He(_);else if(n.volumeKeyframes&&n.volumeKeyframes.length>0){let G=e.timeSeconds-n.start;x=He(Ys(n.volumeKeyframes,G))}else e.isWebAudioRouted?.(r)?x=h:b===void 0?x=h>1?h:v:Math.abs(v-b)>1e-4?x=v:x=h;let R=e.isAudibleUnderSolo?!e.isAudibleUnderSolo(r):!1,T=r.closest("[data-hidden]")||R?0:Yi(x*f);r.volume=T,Qi.set(r,T),e.onElementVolume?.(r,T,x),(t||e.isWebAudioOwned?.(r))&&(r.muted=!0),r.preload!=="auto"&&(r.preload="auto");try{r.playbackRate=n.playbackRate*e.playbackRate}catch(G){L("runtime.media.site1",G)}let F=.04,M=2,E=r.currentTime||0,S=Math.abs(E-i),A=i-E,w=Xi.get(r);Xi.set(r,A);let N=w===void 0,I=!N&&Math.abs(A-w)>.5,W=S>3,U=r.tagName==="AUDIO"&&N&&E-i>F,oe=a&&S>.001||r.ended&&u&&S>.001||U||S>.5&&(N||I||W),k=r.tagName==="VIDEO"&&!r.paused,V=w!==void 0&&Math.abs(A-w)<.004,J=!1;if(!k&&!oe&&!N&&V&&S>F){let G=(Sn.get(r)??0)+1;Sn.set(r,G),G>=M&&(J=!0,Sn.set(r,0))}else S<=F&&Sn.set(r,0);let H=!k&&e.forceSync&&S>.02;if(oe||J||H){if(!(r.tagName==="VIDEO"&&!!ct(r))){try{r.currentTime=i}catch(z){L("runtime.media.site2",z)}if(Math.abs(r.currentTime-i)>.5&&!Ji.has(r)){Ji.add(r),r.load();try{r.currentTime=i}catch(z){L("runtime.media.site3",z)}}}Bt.delete(r)}a?r.paused||r.pause():e.playing&&r.paused&&!Bt.has(r)&&!lp(r)?(ap(r),r.play().catch(G=>{Bt.delete(r),(G&&typeof G=="object"&&"name"in G?String(G.name??""):"")==="NotAllowedError"&&e.onAutoplayBlocked?.()})):!e.playing&&!r.paused&&r.pause();continue}let m=e.timeSeconds>=n.start&&e.timeSeconds<n.end;Zi(r),m&&Tr.set(r,i),r.paused||r.pause()}}var up="hf-proxy",dl="runtime_media_proxy_fallback",fl="runtime_media_proxy_unavailable",An=new WeakSet,ml=new WeakSet;function Rr(e){return e.currentSrc||e.src}function eo(e){return window.__HF_EXPORT_RENDER_SEEK_CONFIG?!0:e instanceof HTMLVideoElement&&!!ct(e)}function to(e){let t=Rr(e);if(!t)return null;let n;try{n=new URL(t,document.baseURI)}catch{return null}if(n.origin!==window.location.origin)return null;try{return decodeURIComponent(n.pathname)}catch{return n.pathname}}function cp(e,t){let n=null;for(let r of Object.keys(t))e.endsWith(r)&&(n===null||r.length>n.length)&&(n=r);return n?t[n]??null:null}function dp(e,t){let n=e.normalize("NFC").toLowerCase(),r=-1,i=null,o=!1;for(let[a,l]of Object.entries(t)){let s=a.normalize("NFC").toLowerCase();n.endsWith(s)&&(s.length>r?(r=s.length,i=l,o=!1):s.length===r&&(o=!0))}return o?null:i}function no(e,t){return t[e]??cp(e,t)??dp(e,t)}function fp(e,t){let n=new URL(e,document.baseURI);return n.searchParams.set(up,t?t.hasAlpha?"vp8":"h264":"auto"),n.href}var mp={cross_origin:"video reports zero decodable width but its source is cross-origin; no local proxy can be served for it",proxy_playback_failed:"the authoring proxy itself failed to decode; render output is unaffected",browser_safe_codec:"the file errored but its codec is browser-decodable; a proxy cannot help (the file itself is likely corrupt)",invalid_source_url:"the media source URL is malformed and cannot be proxied"};function Rt(e,t,n){if(ml.has(e))return;ml.add(e);let r=mp[t];xe({source:"hf-preview",type:"diagnostic",code:fl,details:{asset:n,codecName:null,reason:t,note:r}}),console.info(`[hyperframes] ${fl}: "${n}" (${t}): ${r}`)}function ro(e,t=null,n="reactive"){if(An.has(e))return;let r=Rr(e),i;try{i=fp(r,t)}catch(l){L("runtime.mediaProxy.swap",l),Rt(e,"invalid_source_url",r);return}An.add(e),Zi(e),e.src=i,e.load();let o=t?.codecName??null;xe({source:"hf-preview",type:"diagnostic",code:dl,details:{asset:r,codecName:o,trigger:n,note:"render output is unaffected; only this preview element was swapped to an authoring proxy"}}),console.info(`[hyperframes] ${dl}: "${r}" uses a codec (${o??"unknown"}) this browser can\'t decode; auto-swapped to an authoring proxy for this preview only. Render output is unaffected.`)}function pl(e){if(eo(e)||!(e instanceof HTMLVideoElement)||An.has(e))return;let t=window.__HF_MEDIA_CODEC_MAP__;if(!t)return;let n=to(e);if(n===null)return;let r=no(n,t);if(!r||!r.browserHostile)return;let i=r.representativeMime?e.canPlayType(r.representativeMime):"";i==="probably"||i==="maybe"||ro(e,r,"proactive")}function hl(e){if(eo(e)||!(e instanceof HTMLVideoElement)||e.videoWidth!==0)return;let t=Rr(e);if(An.has(e)){Rt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=to(e);if(r===null){Rt(e,"cross_origin",t);return}let i=no(r,n);if(i&&!i.browserHostile){Rt(e,"browser_safe_codec",t);return}ro(e,i,"reactive")}function gl(e){if(eo(e)||!(e instanceof HTMLVideoElement))return;let t=Rr(e);if(An.has(e)){Rt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=to(e);if(r===null){Rt(e,"cross_origin",t);return}let i=no(r,n);if(i&&!i.browserHostile){Rt(e,"browser_safe_codec",t);return}ro(e,i,"tertiary")}var Se=class extends Error{constructor(n,r=null){super(r==null?n:`${n} at line ${r}`);pe(this,"lineNumber");this.name="CubeLutParseError",this.lineNumber=r}},pp=[0,0,0],hp=[1,1,1],kr=64;function gp(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];if(r===\'"\'&&(t=!t),r==="#"&&!t)return e.slice(0,n)}return e}function ft(e,t){let n=Number(e);if(!Number.isFinite(n))throw new Se(`Invalid number "${e}"`,t);return n}function bl(e,t,n){if(e.length!==3)throw new Se(`${t} expects three numbers`,n);return[ft(e[0],n),ft(e[1],n),ft(e[2],n)]}function xl(e,t,n){if(!e)throw new Se(`${t} expects a size`,n);let r=Number(e);if(!Number.isInteger(r)||r<2)throw new Se(`${t} must be an integer greater than 1`,n);return r}function bp(e,t){if(t[0]<=e[0]||t[1]<=e[1]||t[2]<=e[2])throw new Se("DOMAIN_MAX values must be greater than DOMAIN_MIN values")}function xp(e){let t=/^TITLE\\s+"([^"]*)"\\s*$/i.exec(e);if(t)return t[1]??null;let n=/^TITLE\\s+(.+)\\s*$/i.exec(e);return n&&(n[1]??"").trim()||null}function yp(e){return/^[+-]?(?:\\d|\\.\\d)/.test(e)}function yl(e,t={}){let n=t.maxSize??kr,r=null,i=pp,o=hp,a=null,l=null,s=[],u=e.replace(/^\\uFEFF/,"").split(/\\r?\\n/);for(let m=0;m<u.length;m++){let f=m+1,h=gp(u[m]??"").trim();if(!h)continue;let b=h.split(/\\s+/),v=(b[0]??"").toUpperCase(),x=b.slice(1);if(v==="TITLE"){r=xp(h);continue}if(v==="DOMAIN_MIN"){i=bl(x,v,f);continue}if(v==="DOMAIN_MAX"){o=bl(x,v,f);continue}if(v==="LUT_3D_INPUT_RANGE"){if(x.length!==2)throw new Se(`${v} expects two numbers`,f);let _=ft(x[0],f),R=ft(x[1],f);if(R<=_)throw new Se("LUT_3D_INPUT_RANGE max must exceed min",f);i=[_,_,_],o=[R,R,R];continue}if(v==="LUT_1D_SIZE"){a=xl(x[0],v,f);continue}if(v==="LUT_3D_SIZE"){if(l=xl(x[0],v,f),l>n)throw new Se(`LUT_3D_SIZE ${l} exceeds max ${n}`,f);continue}if(!yp(v)){if(v.startsWith("LUT_"))throw new Se(`Unsupported cube keyword ${v}`,f);continue}if(!l)throw a?new Se("1D cube LUTs are not supported yet",f):new Se("LUT data appears before LUT_3D_SIZE",f);if(b.length!==3)throw new Se("LUT data rows must contain three numbers",f);s.push(ft(b[0],f),ft(b[1],f),ft(b[2],f))}if(a&&l)throw new Se("Mixed 1D and 3D cube LUTs are not supported yet");if(!l)throw a?new Se("1D cube LUTs are not supported yet"):new Se("Missing LUT_3D_SIZE");bp(i,o);let c=l*l*l;if(s.length!==c*3)throw new Se(`Expected ${c} LUT rows for size ${l}, found ${s.length/3}`);return{title:r,size:l,domainMin:i,domainMax:o,data:new Float32Array(s)}}function vp(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):0}function En(e){return Math.round(vp(e)*255)}function io(e){let t=e.size,n=t*t,r=t,i=new Uint8Array(n*r*4);for(let o=0;o<t;o++)for(let a=0;a<t;a++)for(let l=0;l<t;l++){let s=((o*t+a)*t+l)*3,u=(a*n+o*t+l)*4;i[u]=En(e.data[s]??0),i[u+1]=En(e.data[s+1]??0),i[u+2]=En(e.data[s+2]??0),i[u+3]=255}return{width:n,height:r,data:i}}var vl="rec709";var me={hueDegrees:{min:0,max:360,inclusiveMax:!1},unit:{min:0,max:1},signedUnit:{min:-1,max:1},secondaryHueRange:{min:0,max:180},secondaryHueSoftness:{min:0,max:180},secondaryHueCombinedMax:180,secondarySoftRangeSoftness:{min:0,max:.5},secondaryHueShift:{min:-180,max:180},effects:{asciiStyle:{min:0,max:7},bloom:{min:0,max:3},bloomRadius:{min:1,max:100},monoScreenShape:{min:0,max:4}}};var Sl=["exposure","contrast","highlights","shadows","whites","blacks","temperature","tint","vibrance","saturation"],Al=["shadows","midtones","highlights"],El=["master","red","green","blue"],Cl=["hueVsHue","hueVsSaturation","hueVsLuma"];var wl=["vignette","vignetteMidpoint","vignetteRoundness","vignetteFeather","grain","grainSize","grainRoughness"],_l=["blur","pixelate","chromaBleed","tapeDamage","tapeTracking","tapeNoise","tapeSpeed","filmArtifacts","halftone","halftoneSize","twoInkPrint","twoInkPrintSize","ascii","asciiSize","asciiInvert","asciiStyle","asciiColor","asciiRotation","dither","ditherSize","bloom","bloomRadius","monoScreen","monoScreenSize","monoScreenAngle","monoScreenSpread","monoScreenShape","monoScreenInvert","scanlines","scanlineCount","scanlineSoftness","chromaticAberration","chromaticAngle","crtCurvature","digitalGlitch","digitalGlitchColorSplit","digitalGlitchLineTear","digitalGlitchPixelate","digitalGlitchBlockAmount","digitalGlitchBlockDisplacement","digitalGlitchBlockOpacity","digitalGlitchSpeed","engraving","engravingSpacing","engravingMinThickness","engravingMaxThickness","engravingAngle","engravingContrast","engravingSharpness","engravingWave","engravingWaveFrequency","crosshatch","crosshatchSpacing","crosshatchThickness","crosshatchAngle","crosshatchContrast","crosshatchEdges","crosshatchLineWeight","crosshatchWave","crosshatchWaveFrequency","kuwahara","kuwaharaRadius","kuwaharaSharpness","kuwaharaSaturation"];var bv=me.unit,xv=me.signedUnit,yv=me.effects;var Xe=1024,Cn=16;function Tl(e,t,n,r){let i=((2*e+t)*n-e*r)/(e+t);return Math.sign(i)!==Math.sign(n)?0:Math.sign(n)!==Math.sign(r)&&Math.abs(i)>3*Math.abs(n)?3*n:i}function Ae(e,t){let n=e[t];if(n===void 0)throw new RangeError("Color curve points must be contiguous");return n}function Sp(e){let t=[],n=[],r=Ae(e,0);for(let a of e.slice(1)){let l=a[0]-r[0];t.push(l),n.push((a[1]-r[1])/l),r=a}let i=Ae(n,0);if(e.length===2)return[i,i];let o=new Array(e.length);o[0]=Tl(Ae(t,0),Ae(t,1),i,Ae(n,1)),o[o.length-1]=Tl(Ae(t,t.length-1),Ae(t,t.length-2),Ae(n,n.length-1),Ae(n,n.length-2));for(let a=1;a<e.length-1;a+=1){let l=Ae(n,a-1),s=Ae(n,a);if(l===0||s===0||Math.sign(l)!==Math.sign(s)){o[a]=0;continue}let u=Ae(t,a-1),c=Ae(t,a),m=2*c+u,f=c+2*u;o[a]=(m+f)/(m/l+f/s)}return o}function Rl(e,t){if(e.length<2)throw new RangeError("A color curve requires at least two points");if(!Number.isInteger(t)||t<2)throw new RangeError("Curve LUT size must be at least 2");let n=Number.NEGATIVE_INFINITY;for(let[r,i]of e){if(!Number.isFinite(r)||!Number.isFinite(i))throw new TypeError("Color curve points must be finite");if(r<=n)throw new RangeError("Color curve inputs must be strictly increasing");n=r}}function Ap(e,t,n){if(!Number.isFinite(t)||!Number.isFinite(n)||t>=n)throw new RangeError("Curve output bounds must be finite and increasing");if(e.some(([,r])=>r<t||r>n))throw new RangeError(`Curve outputs must be between ${t} and ${n}`)}function Ep(e,t,n,r,i){let o=n[0]-t[0],a=Math.min(1,Math.max(0,(e-t[0])/o)),l=a*a,s=l*a;return(2*s-3*l+1)*t[1]+(s-2*l+a)*o*r+(-2*s+3*l)*n[1]+(s-l)*o*i}function kl(e,t,n,r,i){Ap(e,r,i);let o=Sp(e),a=new Float32Array(t),l=0;for(let s=0;s<t;s+=1){let u=n(s);for(;l<e.length-2&&u>Ae(e,l+1)[0];)l+=1;let c=Ae(e,l),m=Ae(e,l+1),f=Ep(u,c,m,Ae(o,l),Ae(o,l+1));a[s]=Math.min(i,Math.max(r,f))}return a}function Ut(e,t=Xe){if(Rl(e,t),e.length>Cn)throw new RangeError(`A color curve supports at most ${Cn} points`);if(e.some(([n])=>n<0||n>1))throw new RangeError("Color curve inputs must be between 0 and 1");if(e[0]?.[0]!==0||e[e.length-1]?.[0]!==1)throw new RangeError("Color curves must include input endpoints 0 and 1");return kl(e,t,n=>n/(t-1),0,1)}function ao(e,t,n,r=Xe){if(e.length<3)throw new RangeError("A hue curve requires at least three points");if(e.length>Cn)throw new RangeError(`A hue curve supports at most ${Cn} points`);let i=[...e].sort((s,u)=>s[0]-u[0]);for(let s=0;s<i.length;s+=1){let u=i[s];if(!u||u[0]<0||u[0]>=360)throw new RangeError("Hue curve inputs must be from 0 up to 360 degrees");if(s>0&&u[0]===i[s-1]?.[0])throw new RangeError("Hue curve inputs must be unique")}let o=i.slice(-2).map(([s,u])=>[s-360,u]),a=i.slice(0,2).map(([s,u])=>[s+360,u]),l=[...o,...i,...a];return Rl(l,r),kl(l,r,s=>s/r*360,t,n)}var wn="data-color-grading",_n="data-hf-color-grading-source-hidden",Nr="data-hf-authored-opacity",Dl="__hf_color_grading_",wp=vl,uo={exposure:0,contrast:0,highlights:0,shadows:0,whites:0,blacks:0,temperature:0,tint:0,vibrance:0,saturation:0},co={vignette:0,vignetteMidpoint:.5,vignetteRoundness:0,vignetteFeather:.65,grain:0,grainSize:.25,grainRoughness:.5},fo={blur:0,pixelate:0,chromaBleed:0,tapeDamage:0,tapeTracking:0,tapeNoise:1,tapeSpeed:.5,filmArtifacts:0,halftone:0,halftoneSize:0,twoInkPrint:0,twoInkPrintSize:0,ascii:0,asciiSize:5/76,asciiInvert:0,asciiStyle:0,asciiColor:1,asciiRotation:0,dither:0,ditherSize:0,bloom:0,bloomRadius:8,monoScreen:0,monoScreenSize:0,monoScreenAngle:0,monoScreenSpread:0,monoScreenShape:0,monoScreenInvert:0,scanlines:0,scanlineCount:0,scanlineSoftness:0,chromaticAberration:0,chromaticAngle:0,crtCurvature:0,digitalGlitch:0,digitalGlitchColorSplit:0,digitalGlitchLineTear:0,digitalGlitchPixelate:0,digitalGlitchBlockAmount:0,digitalGlitchBlockDisplacement:0,digitalGlitchBlockOpacity:0,digitalGlitchSpeed:0,engraving:0,engravingSpacing:7/17,engravingMinThickness:.2,engravingMaxThickness:3.2/7,engravingAngle:.25,engravingContrast:7/15,engravingSharpness:.59,engravingWave:.2,engravingWaveFrequency:2/9,crosshatch:0,crosshatchSpacing:7/25,crosshatchThickness:.25,crosshatchAngle:.25,crosshatchContrast:1/3,crosshatchEdges:.5,crosshatchLineWeight:0,crosshatchWave:.33,crosshatchWaveFrequency:2/9,kuwahara:0,kuwaharaRadius:1/7,kuwaharaSharpness:5/16,kuwaharaSaturation:.5};var Lr=Sl,Il=Al,Pl=El,Ol=Cl,po=wl,ho=_l,Ml={exposure:.03,contrast:-.12,highlights:-.1,shadows:.16,whites:-.04,blacks:.08,temperature:.13,vibrance:-.08,saturation:-.08},Fl={vignette:.18};function Ee(e,t,n={},r={},i={},o=1){return{id:e,label:t,intensity:o,adjust:{...uo,...n},details:{...co,...r},effects:{...fo,...i}}}var go=[Ee("neutral","Neutral"),Ee("warm-daylight","Warm Daylight",{exposure:.06,contrast:.07,highlights:-.06,shadows:.08,temperature:.18,saturation:.08}),Ee("clean-studio","Clean Studio",{contrast:.08,highlights:-.08,shadows:.06,temperature:-.08,tint:.03,saturation:.04}),Ee("skin-soft","Skin Soft",{exposure:.04,contrast:-.03,highlights:-.12,shadows:.12,temperature:.08,tint:.02,saturation:.04}),Ee("food-pop","Food Pop",{exposure:.06,contrast:.1,shadows:.06,temperature:.14,vibrance:.1,saturation:.18}),Ee("night-lift","Night Lift",{exposure:.08,contrast:.08,highlights:-.18,shadows:.2,blacks:-.08,saturation:.04},{vignette:.12}),Ee("muted-editorial","Muted Editorial",{exposure:-.02,contrast:.08,highlights:-.08,shadows:.06,blacks:-.05,temperature:-.03,saturation:-.12},{vignette:.1}),Ee("vintage-wash","Vintage Wash",Ml,Fl),Ee("mono-clean","Mono Clean",{contrast:.12,highlights:-.04,shadows:.04,blacks:-.08,saturation:-1}),Ee("mono-fade","Mono Fade",{contrast:-.04,highlights:-.06,shadows:.1,blacks:.12,saturation:-1},{vignette:.08}),Ee("soft-boost","Soft Boost",{exposure:.06,contrast:-.04,highlights:-.14,shadows:.16,vibrance:.08,saturation:.1}),Ee("bright-pop","Bright Pop",{exposure:.12,contrast:.12,whites:.08,blacks:-.04,vibrance:.08,saturation:.14}),Ee("deep-contrast","Deep Contrast",{exposure:-.03,contrast:.2,highlights:-.08,shadows:-.08,blacks:-.12,saturation:.06}),Ee("creator-camcorder","Creator Camcorder",{contrast:.08,highlights:-.05,shadows:.02,whites:.03,blacks:-.04,temperature:-.03,tint:-.015,vibrance:-.03,saturation:-.06},{vignette:.06,grain:.08,grainSize:.18,grainRoughness:.58},{chromaBleed:.55},.72),Ee("vhs-playback","VHS Playback",{contrast:-.04,saturation:-.08},{grain:.16,grainSize:.12,grainRoughness:.72},{tapeDamage:.82,tapeTracking:.85,tapeNoise:.3,tapeSpeed:.5,chromaBleed:.5,chromaticAberration:.18,scanlines:.35,scanlineCount:.17,scanlineSoftness:1,digitalGlitch:.32,digitalGlitchLineTear:.08,digitalGlitchSpeed:.5}),Ee("home-movie-8mm","8mm Home Movie",Ml,{...Fl,vignette:.28,vignetteMidpoint:.54,vignetteFeather:.72,grain:.34,grainSize:.18,grainRoughness:.72},{filmArtifacts:.62},.72),Ee("editorial-halftone","Editorial Halftone",{contrast:.04,saturation:.04},{},{halftone:.94,halftoneSize:.36}),Ee("two-ink-print","Two-Ink Print",{contrast:.08,highlights:-.06,shadows:.04},{},{twoInkPrint:1,twoInkPrintSize:.42})],_p=new Map(go.map(e=>[e.id,e])),Tp=/^\\$(?:\\{([A-Za-z0-9_.:-]+)\\}|([A-Za-z0-9_.:-]+))$/,Rp={exposure:{min:-2,max:2},contrast:{min:-1,max:1},highlights:{min:-1,max:1},shadows:{min:-1,max:1},whites:{min:-1,max:1},blacks:{min:-1,max:1},temperature:{min:-1,max:1},tint:{min:-1,max:1},vibrance:{min:-1,max:1},saturation:{min:-1,max:1}},Wt={hue:0,amount:0,level:0},Nl={amount:me.unit,level:me.signedUnit},mt=[[0,0],[1,1]],Vt=[],kp={hueVsHue:me.secondaryHueShift,hueVsSaturation:me.signedUnit,hueVsLuma:me.signedUnit},so={center:0,range:180,softness:0},lo={min:0,max:1,softness:.05},Mp={vignette:me.unit,vignetteMidpoint:me.unit,vignetteRoundness:me.signedUnit,vignetteFeather:me.unit,grain:me.unit,grainSize:me.unit,grainRoughness:me.unit},mo=me.unit,Fp=me.effects,Gl=["blur","pixelate","chromaBleed","tapeDamage","filmArtifacts","halftone","twoInkPrint","ascii","dither","bloom","monoScreen","scanlines","chromaticAberration","crtCurvature","digitalGlitch","engraving","crosshatch","kuwahara"];var Np=go.filter(e=>Gl.some(t=>e.effects[t]>1e-4)),Tv=go.filter(e=>!Np.includes(e)),Rv={blur:{blur:.45},pixelate:{pixelate:.55},bloom:{bloom:.55,bloomRadius:8},chromaBleed:{chromaBleed:.55},tapeDamage:{tapeDamage:.65,tapeTracking:.55,tapeNoise:.25,tapeSpeed:.5},filmArtifacts:{filmArtifacts:.55},scanlines:{scanlines:.35,scanlineCount:.17,scanlineSoftness:1},chromaticAberration:{chromaticAberration:.15,chromaticAngle:0},crtCurvature:{crtCurvature:.2},digitalGlitch:{digitalGlitch:.55,digitalGlitchColorSplit:.25,digitalGlitchLineTear:.25,digitalGlitchPixelate:.15,digitalGlitchBlockAmount:.5,digitalGlitchBlockDisplacement:.25,digitalGlitchBlockOpacity:0,digitalGlitchSpeed:.5},halftone:{halftone:.94,halftoneSize:.36},twoInkPrint:{twoInkPrint:1,twoInkPrintSize:.42},ascii:{ascii:1,asciiSize:5/76,asciiInvert:0,asciiStyle:0,asciiColor:1,asciiRotation:0},dither:{dither:1,ditherSize:.5},monoScreen:{monoScreen:1,monoScreenSize:.35,monoScreenAngle:.25,monoScreenSpread:.3,monoScreenShape:0,monoScreenInvert:0},engraving:{engraving:1,engravingSpacing:7/17,engravingMinThickness:.2,engravingMaxThickness:3.2/7,engravingAngle:.25,engravingContrast:7/15,engravingSharpness:.59,engravingWave:.2,engravingWaveFrequency:2/9},crosshatch:{crosshatch:1,crosshatchSpacing:7/25,crosshatchThickness:.25,crosshatchAngle:.25,crosshatchContrast:1/3,crosshatchEdges:.5,crosshatchLineWeight:0,crosshatchWave:.33,crosshatchWaveFrequency:2/9},kuwahara:{kuwahara:1,kuwaharaRadius:1/7,kuwaharaSharpness:5/16,kuwaharaSaturation:.5}},Hl=[{path:"intensity",name:"--hf-color-grading-intensity",min:0,max:1},{path:"lut.intensity",name:"--hf-color-grading-lut-intensity",min:0,max:1},{path:"adjust.exposure",name:"--hf-color-grading-exposure",min:-2,max:2},{path:"effects.blur",name:"--hf-color-grading-blur",min:0,max:1},{path:"effects.bloom",name:"--hf-color-grading-bloom",min:0,max:3},{path:"effects.kuwahara",name:"--hf-color-grading-kuwahara",min:0,max:1},{path:"effects.pixelate",name:"--hf-color-grading-pixelate",min:0,max:1},{path:"effects.ascii",name:"--hf-color-grading-ascii",min:0,max:1},{path:"effects.dither",name:"--hf-color-grading-dither",min:0,max:1}];var Lp=/^#[0-9a-f]{6}$/i;function Dp(e){return!Array.isArray(e)||e.length<2||e.length>6||!e.every(t=>typeof t=="string"&&Lp.test(t))?null:e.map(t=>t.toLowerCase())}function Te(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Fr(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,e)):0}function Bl(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?Math.min(1,Math.max(0,n)):t}function Re(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?Fr(n,t.min,t.max):0}function bo(e,t=0){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?(n%360+360)%360:t}function Ip(e){let t=Te(e)?e:{};return Il.reduce((n,r)=>{let i=Te(t[r])?t[r]:{};return n[r]={hue:bo(i.hue,Wt.hue),amount:Re(i.amount??Wt.amount,Nl.amount),level:Re(i.level??Wt.level,Nl.level)},n},{shadows:{...Wt},midtones:{...Wt},highlights:{...Wt}})}function Pp(e){if(!Array.isArray(e)||e.length!==2)return null;let t=Number(e[0]),n=Number(e[1]);return Number.isFinite(t)&&Number.isFinite(n)?[Fr(t,0,1),Fr(n,0,1)]:null}function Ul(e){return e.some((t,n)=>n>0&&t[0]===e[n-1]?.[0])}function Op(e){(e[0]?.[0]??0)>0&&e.unshift([0,0]),(e.at(-1)?.[0]??1)<1&&e.push([1,1])}function Gp(e){if(!Array.isArray(e)||e.length<2)return mt;let t=[];for(let n of e){let r=Pp(n);if(!r)return mt;t.push(r)}return t.sort((n,r)=>n[0]-r[0]),Ul(t)||(Op(t),t.length>16)?mt:t}function Hp(e){let t=Te(e)?e:{};return Pl.reduce((n,r)=>(n[r]=Gp(t[r]),n),{master:mt,red:mt,green:mt,blue:mt})}function Bp(e,t){if(!Array.isArray(e)||e.length!==2)return null;let n=Number(e[0]),r=Number(e[1]);return Number.isFinite(n)&&Number.isFinite(r)?[bo(n),Fr(r,t.min,t.max)]:null}function Up(e,t){if(!Array.isArray(e)||e.length<3||e.length>16)return Vt;let n=[];for(let r of e){let i=Bp(r,t);if(!i)return Vt;n.push(i)}return n.sort((r,i)=>r[0]-i[0]),Ul(n)?Vt:n}function Wp(e){let t=Te(e)?e:{};return Ol.reduce((n,r)=>(n[r]=Up(t[r],kp[r]),n),{hueVsHue:Vt,hueVsSaturation:Vt,hueVsLuma:Vt})}function Ll(e){let t=Te(e)?e:{},n=Re(t.min??lo.min,mo),r=Re(t.max??lo.max,mo);return{min:Math.min(n,r),max:Math.max(n,r),softness:Re(t.softness??lo.softness,me.secondarySoftRangeSoftness)}}function Vp(e){let t=Te(e)?e:{},n=Re(t.range??so.range,me.secondaryHueRange);return{center:bo(t.center,so.center),range:n,softness:Re(t.softness??so.softness,{min:me.secondaryHueSoftness.min,max:me.secondaryHueCombinedMax-n})}}function zp(e){return{hueShift:Re(e.hueShift??0,me.secondaryHueShift),saturation:Re(e.saturation??0,me.signedUnit),luma:Re(e.luma??0,me.signedUnit),temperature:Re(e.temperature??0,me.signedUnit),tint:Re(e.tint??0,me.signedUnit)}}function qp(e){return!Te(e)||!Te(e.key)||!Te(e.correction)?null:{enabled:e.enabled!==!1,key:{hue:Vp(e.key.hue),saturation:Ll(e.key.saturation),luma:Ll(e.key.luma)},correction:zp(e.correction)}}function $p(e){if(!Array.isArray(e))return[];let t=[];for(let n of e.slice(0,4)){let r=qp(n);r&&t.push(r)}return t}function jp(e){if(e==null)return null;let t=String(e).trim();return t||null}function Kp(e){if(e==null)return null;if(typeof e=="string"){let n=e.trim();return n?{src:n,intensity:1}:null}if(!Te(e))return null;let t=e.src;return typeof t!="string"||t.trim()===""?null:{src:t.trim(),intensity:Bl(e.intensity,1)}}function Yp(e){if(typeof e=="string"){let t=e.trim();if(!t)return null;if(t.startsWith("{"))try{let n=JSON.parse(t);return Te(n)?n:null}catch{return null}return{preset:t}}return Te(e)?e:null}function Xp(e,t){let n=e.trim().match(Tp);if(!n)return e;let r=n[1]??n[2]??"";return r&&Object.hasOwn(t,r)?t[r]:e}function Mr(e,t){if(typeof e=="string"){let r=Xp(e,t);if(r!==e)return r;let i=e.trim();if(!i.startsWith("{"))return e;try{return Mr(JSON.parse(i),t)}catch{return e}}if(Array.isArray(e))return e.map(r=>Mr(r,t));if(!Te(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=Mr(i,t);return n}function Jp(e){return e?_p.get(e)??null:null}function Dr(e){let t=Yp(e);if(!t||t.enabled===!1)return null;let n=jp(t.preset),r=Jp(n),i=r?.adjust??uo,o=r?.details??co,a=r?.effects??fo,l=Te(t.adjust)?t.adjust:{},s=Te(t.details)?t.details:{},u=Te(t.effects)?t.effects:{},c=Lr.reduce((h,b)=>(h[b]=Re(l[b]??i[b],Rp[b]),h),{...uo}),m=po.reduce((h,b)=>(h[b]=Re(s[b]??o[b],Mp[b]),h),{...co}),f=ho.reduce((h,b)=>(h[b]=Re(u[b]??a[b],Fp[b]??mo),h),{...fo});return{enabled:!0,preset:n,intensity:Bl(t.intensity,r?.intensity??1),adjust:c,wheels:Ip(t.wheels),curves:Hp(t.curves),hueCurves:Wp(t.hueCurves),secondaries:$p(t.secondaries),details:m,effects:f,palette:Dp(t.palette),lut:Kp(t.lut),colorSpace:typeof t.colorSpace=="string"&&t.colorSpace.trim()?t.colorSpace.trim():wp}}function Wl(e,t){return Dr(Mr(e,t))}function Qp(e){return Il.some(t=>Math.abs(e[t].amount)>1e-4||Math.abs(e[t].level)>1e-4)}function xo(e){return Pl.some(t=>e[t].some(([n,r])=>Math.abs(n-r)>1e-4))}function yo(e){return Ol.some(t=>e[t].some(([,n])=>Math.abs(n)>1e-4))}function vo(e){return e.some(t=>t.enabled&&Object.values(t.correction).some(n=>Math.abs(n)>1e-4))}function Vl(e){return e?.enabled?Math.abs(e.details.vignette)>1e-4||Math.abs(e.details.grain)>1e-4||Gl.some(n=>Math.abs(e.effects[n])>1e-4)?!0:e.intensity===0?!1:e.lut&&e.lut.intensity!==0?!0:Lr.some(n=>Math.abs(e.adjust[n])>1e-4)||(e.wheels?Qp(e.wheels):!1)||(e.curves?xo(e.curves):!1)||(e.hueCurves?yo(e.hueCurves):!1)||(e.secondaries?vo(e.secondaries):!1):!1}var Zp=["[data-hyperframes-ignore]","[data-hyperframes-picker-ignore]","[data-hf-ignore]","[data-no-inspect]","[data-no-pick]","[data-hyper-shader-loading]"].join(","),eh=["[data-hyperframes-picker-block]","[data-hyper-shader-loading]"].join(",");function zl(e){let t=!1,n=null,r=null,i=null,o=null;function a(S,A){try{window.dispatchEvent(new CustomEvent(S,{detail:A}))}catch(w){L("runtime.picker.site1",w)}}function l(S){i=S,a("hyperframe:picker:hovered",{elementInfo:i,isPickMode:t,timestamp:Date.now()})}function s(S){o=S,a("hyperframe:picker:selected",{elementInfo:o,isPickMode:t,timestamp:Date.now()})}function u(S){let A=S.ownerDocument.defaultView;if(!A)return!1;let w=S;for(;w&&w!==document.body&&w!==document.documentElement;){let N=A.getComputedStyle(w);if(N.display==="none"||N.visibility==="hidden"||N.pointerEvents==="none")return!0;let I=Number.parseFloat(N.opacity);if(Number.isFinite(I)&&I<=.01&&!w.hasAttribute(_n))return!0;w=w.parentElement}return!1}function c(S){if(!S||S===document.body||S===document.documentElement)return!1;let A=S.tagName.toLowerCase();return!(A==="script"||A==="style"||A==="link"||A==="meta"||S.classList.contains("__hf-pick-highlight")||S.closest(Zp)||u(S))}function m(S){return!!S?.closest(eh)}function f(S){let A=S;if(A.id)return`#${CSS.escape(A.id)}`;let w=S.getAttribute("data-composition-id");if(w)return`[data-composition-id="${CSS.escape(w)}"]`;let N=S.getAttribute("data-composition-src");if(N)return`[data-composition-src="${CSS.escape(N)}"]`;let I=S.getAttribute("data-track-index");if(I)return`[data-track-index="${CSS.escape(I)}"]`;let W=S.tagName.toLowerCase(),U=S.parentElement;if(!U)return W;let oe=U.querySelectorAll(`:scope > ${W}`);if(oe.length===1)return W;for(let k=0;k<oe.length;k+=1)if(oe[k]===S)return`${W}:nth-of-type(${k+1})`;return W}function h(S){let A=S.tagName.toLowerCase(),w=(S.textContent??"").trim().replace(/\\s+/g," "),N=(I,W)=>I.length>W?`${I.slice(0,W-1)}\\u2026`:I;return A==="h1"||A==="h2"||A==="h3"?"Heading":A==="p"||A==="span"||A==="div"?w.length>0?N(w,56):"Text":A==="img"?"Image":A==="video"?"Video":A==="audio"?"Audio":A==="svg"?"Shape":S.getAttribute("data-composition-src")?"Composition":A==="section"?"Section":`${A.charAt(0).toUpperCase()}${A.slice(1)}`}function b(S,A,w){let N=typeof w=="number"&&w>0?w:8,I=[];if(document.elementsFromPoint)I=document.elementsFromPoint(S,A);else if(document.elementFromPoint){let oe=document.elementFromPoint(S,A);I=oe?[oe]:[]}if(m(I[0]??null))return[];let W={},U=[];for(let[oe,k]of I.entries()){if(!c(k))continue;let V=`${k.tagName}::${k.id||""}::${oe}`;if(!W[V]&&(W[V]=!0,U.push(k),U.length>=N))break}return U}function v(S){let A=S.getBoundingClientRect(),w={};for(let I of Array.from(S.attributes))I.name.startsWith("data-")&&(w[I.name]=I.value);return{id:S.id||null,tagName:S.tagName.toLowerCase(),selector:f(S),label:h(S),boundingBox:{x:A.left,y:A.top,width:A.width,height:A.height},textContent:S.textContent?S.textContent.trim().slice(0,200):null,src:S.getAttribute("src")||S.getAttribute("data-composition-src")||null,dataAttributes:w}}function x(S,A,w){return b(S,A,w).map(v)}function _(S){if(!t)return;let w=b(S.clientX,S.clientY,1)[0]??(S.target instanceof Element?S.target:null);if(!c(w)||n===w)return;n&&n.classList.remove("__hf-pick-highlight"),n=w,w.classList.add("__hf-pick-highlight");let N=v(w);l(N),e.postMessage({source:"hf-preview",type:"element-hovered",elementInfo:N})}function R(S){if(!t)return;S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation();let A=x(S.clientX,S.clientY,8);A.length!==0&&(l(A[0]??null),e.postMessage({source:"hf-preview",type:"element-pick-candidates",candidates:A,selectedIndex:0,point:{x:S.clientX,y:S.clientY}}))}function T(S){S.key==="Escape"&&(M(),e.postMessage({source:"hf-preview",type:"pick-mode-cancelled"}))}function F(){t||(t=!0,r=document.createElement("style"),r.textContent=[".__hf-pick-highlight { outline: 2px solid #4f8cf7 !important; outline-offset: 2px; cursor: crosshair !important; }",".__hf-pick-active * { cursor: crosshair !important; }"].join(`\n`),document.head.appendChild(r),document.body.classList.add("__hf-pick-active"),document.addEventListener("mousemove",_,!0),document.addEventListener("click",R,!0),document.addEventListener("keydown",T,!0),a("hyperframe:picker:mode",{isPickMode:!0,timestamp:Date.now()}))}function M(){t&&(t=!1,n&&(n.classList.remove("__hf-pick-highlight"),n=null),r&&(r.remove(),r=null),document.body.classList.remove("__hf-pick-active"),document.removeEventListener("mousemove",_,!0),document.removeEventListener("click",R,!0),document.removeEventListener("keydown",T,!0),a("hyperframe:picker:mode",{isPickMode:!1,timestamp:Date.now()}))}function E(){window.__HF_PICKER_API={enable:F,disable:M,isActive:()=>t,getHovered:()=>i,getSelected:()=>o,getCandidatesAtPoint:(S,A,w)=>Number.isFinite(S)&&Number.isFinite(A)?x(S,A,w):[],pickAtPoint:(S,A,w)=>{if(!Number.isFinite(S)||!Number.isFinite(A))return null;let N=x(S,A,8);if(!N.length)return null;let I=Math.max(0,Math.min(N.length-1,Number(w??0))),W=N[I]??null;return W?(s(W),e.postMessage({source:"hf-preview",type:"element-picked",elementInfo:W}),M(),W):null},pickManyAtPoint:(S,A,w)=>{if(!Number.isFinite(S)||!Number.isFinite(A))return[];let N=x(S,A,8);if(!N.length)return[];let I=[],W=Array.isArray(w)?w:[0];for(let U of W){let oe=Math.max(0,Math.min(N.length-1,Math.floor(Number(U)))),k=N[oe];if(!k)continue;I.some(J=>J.selector===k.selector&&J.tagName===k.tagName)||I.push(k)}return I.length?(s(I[0]??null),e.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:I}),M(),I):[]}},a("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:F,disablePickMode:M,installPickerApi:E}}var th=["width","height","top","left","right","bottom","inset","object-fit","object-position","z-index","opacity","visibility","filter","mix-blend-mode","backdrop-filter","border-radius","overflow","clip-path","mask","mask-image","mask-size","mask-position","mask-repeat","transform","transform-origin","translate","rotate","scale","box-sizing"];function zt(e,t){let n=Number.isFinite(t)&&t>0?t:30,r=Number.isFinite(e)&&e>0?e:0;return Math.floor(r*n+1e-9)/n}function ql(e,t,n=th){for(let r of n){let i=t.getPropertyValue(r);i&&e.setProperty(r,i)}}function Tn(e,t,n){let r=e?.[t];return typeof r=="function"?Number(r.call(e))||n:typeof r=="number"&&Number.isFinite(r)?r:(r!=null&&L("runtime.player.nonConformantNum",{prop:t,actual:typeof r}),n)}function Ue(e,t){let n=e?.[t];if(typeof n=="function"){n.call(e);return}n!==void 0&&L("runtime.player.nonConformantVoid",{method:t,actual:typeof n})}function Rn(e,t,n){if(e){for(let r of Object.values(e))if(!(!r||r===t))try{n(r)}catch(i){L("runtime.player.site1",i)}}}function $l(e,t,n,r){let i=zt(t,n),o=r?.suppressEvents===!0;return Ue(e,"pause"),typeof e.totalTime=="function"?e.totalTime(i,o):typeof e.seek=="function"&&e.seek(i,o),i}function nh(e,t,n,r,i){let o=[];Rn(e,t,a=>{Ue(a,"play"),o.push(a)});try{return $l(t,n,r,i)}finally{for(let a of o)try{Ue(a,"pause")}catch(l){L("runtime.player.site2",l)}}}function rh(e,t){Rn(e,t,n=>{Ue(n,"play")})}function jl(e){let t=e.transport;return t?{_timeline:null,play:()=>t.play(),pause:()=>t.pause(),seek:(n,r)=>t.seek(n,r),renderSeek:(n,r)=>t.renderSeek(n,r),getTime:()=>t.getTime(),getDuration:()=>t.getDuration(),isPlaying:()=>t.isPlaying(),setPlaybackRate:n=>t.setPlaybackRate(n),getPlaybackRate:()=>t.getPlaybackRate()}:{_timeline:null,play:()=>{let n=e.getTimeline();if(!n||e.getIsPlaying())return;let r=Math.max(0,Number(e.getSafeDuration?.()??Tn(n,"duration",0))||0);r>0&&Math.max(0,Tn(n,"time",0))>=r&&(Ue(n,"pause"),typeof n.seek=="function"&&n.seek(0,!1),e.onDeterministicSeek(0),e.setIsPlaying(!1),e.onSyncMedia(0,!1),e.onRenderFrameSeek(0)),typeof n.timeScale=="function"&&n.timeScale(e.getPlaybackRate()),Ue(n,"play"),Rn(e.getTimelineRegistry?.(),n,i=>{typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),Ue(i,"play")}),e.onDeterministicPlay(),e.setIsPlaying(!0),e.onShowNativeVideos(),e.onStatePost(!0)},pause:()=>{let n=e.getTimeline();if(!n)return;Ue(n,"pause"),Rn(e.getTimelineRegistry?.(),n,i=>{Ue(i,"pause")});let r=Math.max(0,Tn(n,"time",0));e.onDeterministicSeek(r),e.onDeterministicPause(),e.setIsPlaying(!1),e.onSyncMedia(r,!1),e.onRenderFrameSeek(r),e.onStatePost(!0)},seek:(n,r)=>{let i=e.getTimeline();if(!i)return;let o=Math.max(0,Number(n)||0),a=e.getIsPlaying(),l=nh(e.getTimelineRegistry?.(),i,o,e.getCanonicalFps());e.onDeterministicSeek(l),r?.keepPlaying&&a?(typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),Ue(i,"play"),Rn(e.getTimelineRegistry?.(),i,s=>{typeof s.timeScale=="function"&&s.timeScale(e.getPlaybackRate()),Ue(s,"play")}),e.onDeterministicPlay(),e.onShowNativeVideos(),e.onSyncMedia(l,!0)):(e.setIsPlaying(!1),e.onSyncMedia(l,!1)),e.onRenderFrameSeek(l),e.onStatePost(!0)},renderSeek:(n,r)=>{let i=e.getTimeline(),o=e.getCanonicalFps(),a=i?(rh(e.getTimelineRegistry?.(),i),$l(i,n,o,r)):zt(Math.max(0,Number(n)||0),o);e.onDeterministicSeek(a,r),e.setIsPlaying(!1),e.onSyncMedia(a,!1),e.onRenderFrameSeek(a),e.onStatePost(!0)},getTime:()=>Tn(e.getTimeline(),"time",0),getDuration:()=>Tn(e.getTimeline(),"duration",0),isPlaying:()=>e.getIsPlaying(),setPlaybackRate:n=>e.setPlaybackRate(n),getPlaybackRate:()=>e.getPlaybackRate()}}function Kl(){return{capturedTimeline:null,isPlaying:!1,currentTime:0,deterministicAdapters:[],canonicalFps:30,bridgeMuted:!1,bridgeVolume:1,mediaOutputMuted:!1,nativeMediaSyncDisabled:!1,webAudioMediaDisabled:!1,mediaAutoplayBlockedPosted:!1,mediaForceSyncNextTick:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,controlBridgeHandler:null,beforeUnloadHandler:null,injectedCompStyles:[],injectedCompScripts:[],injectedCompLinks:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,transportClock:null,transportRafId:null}}var ih=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function So(e){return e.id||e.getAttribute("data-hf-id")||null}function oh(e){return ve(e)}function ah(e,t){let n=e.getAttribute("data-composition-id");if(!n)return null;let r=Number(t[n]?.duration?.());return Number.isFinite(r)&&r>0?r:null}function sh(e){return!(e instanceof HTMLMediaElement)||!Number.isFinite(e.duration)?null:tt(e,e.duration)}function lh(e,t,n,r){let i=oh(e.getAttribute("data-duration"));return i!=null&&i>0?i:ah(e,t)??sh(e)??Math.max(0,n-r)}function uh(e){for(let[t,n]of e){let r=t.parentElement;for(;r;){let i=e.get(r);if(i){n.parentId=i.id,i.children.push(n);break}r=r.parentElement}}}function Yl(e){let{startResolver:t,timelineRegistry:n,rootDuration:r}=e,i=new Map,o=document.querySelector("[data-composition-id]"),a=0;for(let l of document.querySelectorAll("[data-start]")){if(l===o||ih.has(l.tagName))continue;let s=t.resolveStartForElement(l,0);if(lh(l,n,r,s)<=0)continue;let u={id:So(l)??`__clip-${a++}`,element:l,parentId:null,children:[]};i.set(l,u)}return uh(i),{roots:Array.from(i.values()).filter(l=>l.parentId===null)}}var Ao="css:root",Xl=["backdrop-filter","clip-path","filter","mask","mask-border-source","mask-image","perspective","rotate","scale","transform","translate","-webkit-mask-image"],ch=new Set([...Xl,"contain","isolation","mask-border","mix-blend-mode","opacity"]),dh=new Set(["absolute","relative"]),fh=new Set(["flex","inline-flex","grid","inline-grid"]),mh=new Set(["layout","paint","strict","content"]),ph=new Set(["size","inline-size"]);function hh(e){return e.position==="fixed"||e.position==="sticky"}function gh(e,t){if(t.zIndex==="auto"||t.zIndex==="")return!1;if(dh.has(t.position))return!0;let n=e.parentElement?e.ownerDocument.defaultView?.getComputedStyle(e.parentElement).display:null;return n!=null&&fh.has(n)}function bh(e){let t=Number.parseFloat(e.opacity);if(Number.isFinite(t)&&t<1||e.getPropertyValue("isolation")==="isolate")return!0;let n=e.getPropertyValue("mix-blend-mode");return n&&n!=="normal"?!0:Xl.some(r=>{let i=e.getPropertyValue(r);return i!==""&&i!=="none"})}function xh(e){return e.getPropertyValue("contain").split(/\\s+/).some(n=>mh.has(n))?!0:ph.has(e.getPropertyValue("container-type"))}function yh(e){return e.getPropertyValue("will-change").split(",").map(t=>t.trim()).some(t=>ch.has(t))}function vh(e,t){return hh(t)||gh(e,t)||bh(t)||xh(t)?!0:yh(t)}function Sh(e){let t=[],n=e;for(;n?.parentElement;)t.push(Array.prototype.indexOf.call(n.parentElement.children,n)),n=n.parentElement;return`css:${t.reverse().join(".")}`}function Ir(e){let t=e.ownerDocument.defaultView;if(!t)return Ao;let n=e.parentElement;for(;n&&n!==e.ownerDocument.documentElement;){try{if(vh(n,t.getComputedStyle(n)))return Sh(n)}catch{return Ao}n=n.parentElement}return Ao}var Ah="data-hf-authored-duration",Eh="data-hf-authored-end";function Ch(e){return Be(e.getAttribute("data-duration"))}function wh(e){return Be(e.getAttribute("data-end"))}function _h(e){return Be(e.getAttribute(Ah))}function Th(e){return Be(e.getAttribute(Eh))}function pt(e){let t=e.timelineRegistry??{},n=e.includeAuthoredTimingAttrs??!1,r=e.documentRef??document,i=new WeakMap,o=new WeakMap,a=new Set,l=f=>{let h=r.getElementById(f);return h||(r.querySelector(`[data-composition-id="${CSS.escape(f)}"]`)??null)},s=f=>{let h=f.ownerDocument.defaultView?.HTMLMediaElement;return h?f instanceof h:typeof HTMLMediaElement<"u"&&f instanceof HTMLMediaElement},u=f=>{let h=o.get(f);if(h!==void 0)return h;let b=null,v=Ch(f)??(n?_h(f):null);if(v!=null&&v>0&&(b=v),b==null||b<=0){let x=wh(f)??(n?Th(f):null);if(x!=null){let _=m(f,0),R=x-_;Number.isFinite(R)&&R>0&&(b=R)}}if((b==null||b<=0)&&s(f)){let x=fn(f);Number.isFinite(f.duration)&&f.duration>x&&(b=(f.duration-x)/_e(f))}if(b==null||b<=0){let x=f.getAttribute("data-composition-id");if(x){let _=t[x]??null;if(_&&typeof _.duration=="function")try{let R=Number(_.duration());Number.isFinite(R)&&R>0&&(b=R)}catch(R){L("runtime.startResolver.site1",R)}}}return b!=null&&Number.isFinite(b)&&b>0?(o.set(f,b),b):(o.set(f,null),null)},c=(f,h)=>{if(f.hasAttribute("data-composition-id")){let v=f.parentElement?.closest("[data-composition-id]");return v?m(v,h):0}let b=f.closest("[data-composition-id]");return b?m(b,h):0},m=(f,h)=>{let b=i.get(f);if(b!==void 0)return b??h;if(a.has(f))return h;a.add(f);try{let v=qi(f.getAttribute("data-start"));if(!v){if(f.hasAttribute("data-composition-id")){let F=f.parentElement;if(F&&(F.hasAttribute("data-composition-src")||F.hasAttribute("data-composition-id")||F.hasAttribute("data-composition-file"))){let M=m(F,h);return i.set(f,M),M}}return i.set(f,h),h}if(v.kind==="absolute"){let F=Math.max(0,v.value),M=Math.max(0,c(f,h)+F);return i.set(f,M),M}let x=l(v.refId);if(!x)return i.set(f,h),h;let _=m(x,0),R=u(x);if(R==null||R<=0){let F=Math.max(0,_+v.offset);return i.set(f,F),F}let T=Math.max(0,_+R+v.offset);return i.set(f,T),T}finally{a.delete(f)}};return{resolveStartForElement:(f,h=0)=>m(f,Math.max(0,h)),resolveDurationForElement:f=>u(f)}}function Eo(e){let t=e.trim().toLowerCase();return!(!t||t==="main"||t.includes("caption")||t.includes("ambient"))}var kh="data-hf-authored-duration",Mh="data-hf-authored-end";function We(e){return ve(e)}function Co(e){return We(e.getAttribute("data-duration"))??We(e.getAttribute(kh))}function Jl(e){return We(e.getAttribute("data-end"))??We(e.getAttribute(Mh))}function wo(e){try{let t=e.style?.zIndex;if(t&&t!=="auto"){let n=parseInt(t,10);if(Number.isFinite(n))return n}return 0}catch{return 0}}function _o(...e){let t=e.filter(n=>Number.isFinite(n??null));return t.length===0?null:Math.max(...t)}function To(e,t){let n=e.getAttribute("data-track-index")??e.getAttribute("data-track");if(n==null)return t;let r=Number.parseInt(n,10);return Number.isFinite(r)?r:t}function Mn(e){let t=String(e??"").trim();if(!t)return null;let n=t.toLowerCase();if(n.startsWith("data:")||n.startsWith("javascript:"))return null;try{return new URL(t,document.baseURI).toString()}catch{return t}}function Ql(e){let t=e.getAttribute("src")??e.getAttribute("data-src");if(t)return Mn(t);let n=e.getAttribute("data-composition-src");if(n)return Mn(n);let r=e.querySelector("img[src], video[src], audio[src], source[src]");return r?Mn(r.getAttribute("src")):null}function Fh(e){let t=e.className;return typeof t!="string"?null:t.split(/\\s+/).map(n=>n.trim()).find(n=>n&&n!=="clip"&&!n.startsWith("__hf-"))??null}function Nh(e){if(!e)return null;try{return new URL(e,document.baseURI).pathname.split("/").filter(Boolean).at(-1)??null}catch{return e.split(/[\\\\/]/).filter(Boolean).at(-1)??null}}function Lh(e){let t=e.textContent?.replace(/\\s+/g," ").trim();return t?t.length>32?`${t.slice(0,31)}...`:t:null}function kn(e){let t=e.replace(/\\.[^.]+$/i,"").replace(/[-_]+/g," ").replace(/\\s+/g," ").trim();return t?t.replace(/\\b\\w/g,n=>n.toUpperCase()):e}function Dh(e,t,n){let r=e.getAttribute("data-timeline-label")??e.getAttribute("data-label")??e.getAttribute("aria-label")??null;if(r?.trim())return r.trim();let i=e.getAttribute("data-composition-id");if(i)return kn(i);let o=e.id;if(o)return kn(o);let a=Fh(e);if(a)return kn(a);let l=Nh(Ql(e));if(l)return kn(l);let s=Lh(e);return s||`${kn(t)} ${n+1}`}function Zl(e){let n=window.__timelines??{},r=pt({timelineRegistry:n,includeAuthoredTimingAttrs:!0}),i=q=>{if(!q)return null;let P=n[q]??null;if(!P||typeof P.duration!="function")return null;try{let O=Number(P.duration());return Number.isFinite(O)&&O>0?O:null}catch{return null}},o=q=>{let P=We(q.getAttribute("data-duration"));return P!=null&&P>0?P:Number.isFinite(q.duration)?tt(q,q.duration):null},a=()=>{let q=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(q.length===0)return null;let P=0;for(let O of q){let j=O.hasAttribute("data-hf-auto-start")?r.resolveStartForElement(O,0):Math.max(0,Number(O.getAttribute("data-start")??0)||0);if(!Number.isFinite(j))continue;let le=o(O);le==null||le<=0||(P=Math.max(P,Math.max(0,j)+le))}return P>0?P:null},l=(q,P)=>{let O=[],j=null,le=null,Z=null,K=q.parentElement;for(;K;){let Y=K.getAttribute("data-composition-id");Y&&(O.push(Y),!Z&&K!==P&&(Z=Y),j==null&&(j=r.resolveStartForElement(K,0)),le==null&&(le=We(K.getAttribute("data-duration"))??i(Y)??null)),K=K.parentElement}return{parentCompositionId:Z,compositionAncestors:O.reverse(),inheritedStart:j,inheritedDuration:le}},s=document.querySelector("[data-composition-id]"),u=Array.from(document.querySelectorAll("[data-composition-id]")),c=s?.getAttribute("data-composition-id")??null,m=s?r.resolveStartForElement(s,0):0,f=a(),h=f!=null?Math.max(0,f-Math.max(0,m)):null,b=i(c),v=Co(s??document.body),x=_o(...u.filter(q=>q!==s).map(q=>{let P=r.resolveStartForElement(q,0),O=r.resolveDurationForElement(q)??i(q.getAttribute("data-composition-id"))??null;return!Number.isFinite(P)||O==null||O<=0?null:Math.max(0,P)+O})),_=x!=null?Math.max(0,x-Math.max(0,m)):null,R=typeof b=="number"&&Number.isFinite(b)&&b>0?b:null,T=typeof v=="number"&&Number.isFinite(v)&&v>0?v:null,F=typeof h=="number"&&Number.isFinite(h)&&h>0?h:null,M=typeof _=="number"&&Number.isFinite(_)&&_>0?_:null,E=_o(F,M),S=R!=null&&E!=null&&R>E+1,w=T??(S?E:_o(R,F,M))??null,I=(w!=null?m+w:null)??(typeof f=="number"&&Number.isFinite(f)&&f>0?f:null),W=(q,P)=>!Number.isFinite(P)||P<=0?0:I==null||!Number.isFinite(I)?P:!Number.isFinite(q)||q>=I?0:Math.max(0,Math.min(P,I-q)),U=[],oe=[],k=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),V=0;for(let[q,P]of k.entries()){if(P===s||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(P.tagName))continue;let O=l(P,s),j=r.resolveStartForElement(P,O.inheritedStart??0),le=P.getAttribute("data-composition-id"),Z=Co(P);if(Z==null&&le&&le!==c&&(Z=i(le)),Z==null&&P instanceof HTMLMediaElement&&Number.isFinite(P.duration)&&(Z=tt(P,P.duration)),Z==null){let Fe=O.inheritedDuration;if(Fe!=null&&Fe>0){let $e=(O.inheritedStart??0)+Fe;Z=Math.max(0,$e-j)}}if(Z==null||Z<=0||(Z=W(j,Z),Z<=0))continue;let K=j+Z;V=Math.max(V,K);let Y=P.tagName.toLowerCase(),qe=le&&le!==c?"composition":Y==="video"?"video":Y==="audio"?"audio":Y==="img"?"image":"element";U.push({id:So(P)??le??null,label:Dh(P,qe,U.length),start:j,duration:Z,track:To(P,q),zIndex:wo(P),stackingContextId:Ir(P),kind:qe,tagName:Y,compositionId:P.getAttribute("data-composition-id"),compositionAncestors:O.compositionAncestors,parentCompositionId:O.parentCompositionId,nodePath:null,compositionSrc:Mn(P.getAttribute("data-composition-src")),playbackStart:Ye(P),playbackRate:_e(P),assetUrl:Ql(P),timelineRole:P.getAttribute("data-timeline-role"),timelineLabel:P.getAttribute("data-timeline-label"),timelineGroup:P.getAttribute("data-timeline-group"),timelinePriority:We(P.getAttribute("data-timeline-priority"))})}let J=new Set(U.map(q=>q.id)),H=s?.getAttribute("data-composition-id")??null,G=H?n[H]??null:null;if(G&&s){let q=G;if(typeof q.getChildren=="function")try{let P=q.getChildren(!0,!0,!1)??[],O=new Map;for(let Z of s.children){let K=Z;if(!K.id)continue;let Y=K.tagName.toLowerCase();Y==="script"||Y==="style"||Y==="link"||O.set(K,{id:K.id,start:1/0,end:-1/0})}let j=Z=>{let K=Z;for(;K;){if(O.has(K))return K;if(K===s)return null;K=K.parentElement}return null};for(let Z of P){if(typeof Z.targets!="function"||typeof Z.startTime!="function"||typeof Z.duration!="function")continue;let K=Z.startTime(),Y=Z.parent;for(;Y&&Y!==G&&typeof Y.startTime=="function";)K+=Y.startTime(),Y=Y.parent;let qe=K+Z.duration();if(!(!Number.isFinite(K)||!Number.isFinite(qe)))for(let Fe of Z.targets()){if(!(Fe instanceof Element))continue;let ke=j(Fe);if(!ke)continue;let $e=O.get(ke);$e&&($e.start=Math.min($e.start,K),$e.end=Math.max($e.end,qe))}}let le=U.length>0?Math.max(...U.map(Z=>Z.track))+1:0;for(let[Z,K]of O){if(K.start===1/0||K.end===-1/0)continue;let Y=Z;if(J.has(Y.id))continue;let qe=Math.max(0,K.end-K.start);if(qe<=0)continue;let Fe=W(K.start,qe);Fe<=0||(V=Math.max(V,K.start+Fe),U.push({id:Y.id,label:Y.getAttribute("data-timeline-label")??Y.getAttribute("data-label")??Y.getAttribute("aria-label")??Y.id,start:K.start,duration:Fe,track:To(Y,le),zIndex:wo(Y),stackingContextId:Ir(Y),kind:"element",tagName:Y.tagName.toLowerCase(),compositionId:Y.getAttribute("data-composition-id"),compositionAncestors:H?[H]:[],parentCompositionId:H,nodePath:null,compositionSrc:null,playbackStart:Ye(Y),playbackRate:_e(Y),assetUrl:null,timelineRole:Y.getAttribute("data-timeline-role"),timelineLabel:Y.getAttribute("data-timeline-label"),timelineGroup:Y.getAttribute("data-timeline-group"),timelinePriority:We(Y.getAttribute("data-timeline-priority"))}),J.add(Y.id))}}catch(P){L("runtime.timeline.site1",P)}}if(s&&w!=null&&w>0){let q=U.length>0?Math.max(...U.map(P=>P.track))+1:0;for(let P of s.children){let O=P;if(!O.id||J.has(O.id))continue;let j=O.getAttribute("data-timeline-role");if(j!=="overlay"&&j!=="persistent-overlay")continue;let le=O.tagName.toLowerCase();if(le==="script"||le==="style"||le==="link"||le==="meta"||window.getComputedStyle(O).display==="none")continue;let K=W(0,w);K<=0||(V=Math.max(V,K),U.push({id:O.id,label:O.getAttribute("data-timeline-label")??O.getAttribute("data-label")??O.getAttribute("aria-label")??O.id,start:0,duration:K,track:To(O,q),zIndex:wo(O),stackingContextId:Ir(O),kind:"element",tagName:le,compositionId:O.getAttribute("data-composition-id"),compositionAncestors:H?[H]:[],parentCompositionId:H,nodePath:null,compositionSrc:null,playbackStart:Ye(O),playbackRate:_e(O),assetUrl:null,timelineRole:j,timelineLabel:O.getAttribute("data-timeline-label"),timelineGroup:O.getAttribute("data-timeline-group"),timelinePriority:We(O.getAttribute("data-timeline-priority"))}),J.add(O.id))}}for(let q of u){if(q===s)continue;let P=q.getAttribute("data-composition-id");if(!P||!Eo(P))continue;let O=r.resolveStartForElement(q,0),j=Co(q);if((j==null||j<=0)&&Jl(q)!=null){let Y=Jl(q);j=Math.max(0,Y-O)}let le=i(P),Z=j&&j>0?j:le;if(Z==null||Z<=0)continue;let K=W(O,Z);K<=0||oe.push({id:P,label:q.getAttribute("data-label")??P,start:O,duration:K,thumbnailUrl:Mn(q.getAttribute("data-thumbnail-url")),avatarName:null})}let z=Math.max(1,V||1,w??0),X=S&&T==null,Ce=X?Number.POSITIVE_INFINITY:Math.max(1,Math.ceil(z*Math.max(1,e.canonicalFps)));return{...gr(e.canonicalFps),source:"hf-preview",type:"timeline",compositionContractVersion:1,durationSeconds:X?Number.POSITIVE_INFINITY:z,durationInFrames:Ce,clips:U,scenes:oe,compositionWidth:We(s?.getAttribute("data-width"))??1920,compositionHeight:We(s?.getAttribute("data-height"))??1080}}var Ro="data-composition-id",Ih="data-composition-src",Ph=`[${Ro}]`,fS=`[${Ih}]`,eu="style",tu="script",Oh=\'link[rel="stylesheet"], link[rel="preconnect"]\';function qt(e){return e?Array.from(e):[]}function nu(e){let{contentNode:t,head:n,documentElement:r,hasTemplate:i,compositionId:o}=e,a=qt(t.querySelectorAll(Ph)),l=o?a.find(c=>c.getAttribute(Ro)===o)??null:a[0]??null,s=(l??a[0])?.getAttribute(Ro)?.trim()||"",u=i?null:n??null;return{innerRoot:l,authoredCompositionId:o||s||null,scriptCompositionId:s||o||null,authoredRootId:l?.getAttribute("id")?.trim()||null,styleSources:[...qt(u?.querySelectorAll(eu)),...qt(t.querySelectorAll(eu))],scriptSources:[...qt(u?.querySelectorAll(tu)),...qt(t.querySelectorAll(tu))],linkSources:qt(n?.querySelectorAll(Oh)),variableDefaultCarriers:[r,l].filter(c=>c!=null)}}var he=hm(Tc(),1),Rc=he.default,tA=he.default.stringify,nA=he.default.fromJSON,rA=he.default.plugin,iA=he.default.parse,oA=he.default.list,aA=he.default.document,sA=he.default.comment,lA=he.default.atRule,uA=he.default.rule,cA=he.default.decl,dA=he.default.root,fA=he.default.CssSyntaxError,mA=he.default.Declaration,pA=he.default.Container,hA=he.default.Processor,gA=he.default.Document,bA=he.default.Comment,xA=he.default.Warning,yA=he.default.AtRule,vA=he.default.Result,SA=he.default.Input,AA=he.default.Rule,EA=he.default.Root,CA=he.default.Node;var ea="data-hf-authored-id",kc="data-hf-inner-root";function ta(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function na(e){return e.replace(/\\\\/g,"\\\\\\\\").replace(/"/g,\'\\\\"\')}function og(e){return e&&e.replace(/[^a-zA-Z0-9_-]/g,n=>`\\\\${n}`).replace(/^-?\\d/,n=>`\\\\${n}`)}function Fc(e){let t=e.trim();return t?Array.from(new Set([t,og(t)])).filter(Boolean):[]}function ag(e){return!!e&&/[\\w-]/.test(e)}function sg(e,t,n){let r=Fc(t).sort((l,s)=>s.length-l.length);if(r.length===0)return e;let i="",o=0,a=null;for(let l=0;l<e.length;l+=1){let s=e[l],u=l>0?e[l-1]:"";if(a){i+=s,s===a&&u!=="\\\\"&&(a=null);continue}if(s===\'"\'||s==="\'"){a=s,i+=s;continue}if(s==="["){o+=1,i+=s;continue}if(s==="]"){o=Math.max(0,o-1),i+=s;continue}if(s==="#"&&o===0){let c=r.find(m=>e.startsWith(m,l+1));if(c){let m=e[l+1+c.length];if(!ag(m)){i+=n,l+=c.length;continue}}}i+=s}return i}function lg(e,t){let n=t?.trim();return n?sg(e,n,`[${ea}="${na(n)}"]`):e}function Mc(e){return`${e}:not(:has([${kc}])), ${e} > [${kc}]`}function ug(e,t,n,r,i,o){let a=lg(e,r),l=cg(a,t,n),s=l.trim();if(!s||s==="*")return e;if(/^(html|body|:root)$/i.test(s))return o?Mc(t):e;let u=new RegExp(`\\\\[\\\\s*data-composition-id\\\\s*=\\\\s*(["\'])${ta(n)}\\\\1\\\\s*\\\\]`,"g");if(u.test(s))return s.replace(u,"").trim()===""?Mc(t):l.replace(u,t);let c=l.match(/^\\s*/)?.[0]??"",m=l.match(/\\s*$/)?.[0]??"";if(i){let f=r?`[${ea}="${na(r)}"]`:null;if(f&&s.startsWith(f)){let h=s.slice(f.length);return`${c}${t}${f}${h}${m}`}}return`${c}${t} ${s}${m}`}function cg(e,t,n){let r=ta(n),i=String.raw`\\[\\s*data-composition-id\\s*=\\s*(?:"${r}"|\'${r}\')\\s*\\]`,o=String.raw`\\s*\\[\\s*data-(?:start|duration)\\s*=\\s*(?:"[^"]*"|\'[^\']*\')\\s*\\]`;return e.replace(new RegExp(`${i}(?:${o})+`,"g"),t).replace(new RegExp(`(?:${o})+${i}`,"g"),t)}var dg=new Set(["keyframes","-webkit-keyframes","font-face"]);function fg(e){return e?.type==="atrule"}function mg(e){let t=e.parent;for(;t;){if(fg(t)&&dg.has(t.name.toLowerCase()))return!0;t=t.parent}return!1}function pg(e){let t=e.parent;for(;t;){if(t.type==="rule")return!0;t=t.parent}return!1}function Nc(e,t,n,r,i){let o=t.trim();if(!e||!o)return e;let a=n||`[data-composition-id="${na(o)}"]`,l=Rc.parse(e);return l.walkRules(s=>{mg(s)||pg(s)||(s.selectors=s.selectors.map(u=>ug(u,a,o,r,i?.compoundAuthoredRoot,i?.scopeRootSelectors)))}),l.toResult({map:!1}).css}function it(e){return JSON.stringify(e).replace(/</g,"\\\\u003c")}function Lc(e,t,n="[HyperFrames] composition script error:",r,i=t,o){let a=it(t),l=it(i),s=it(n),u=ta(t),c=it(o?.trim()||null),m=it(r??null),f=it(String.raw`\\[\\s*data-composition-id\\s*=\\s*(?:"${u}"|\'${u}\')\\s*\\]`),h=it(String.raw`\\s*\\[\\s*data-(?:start|duration)\\s*=\\s*(?:"[^"]*"|\'[^\']*\')\\s*\\]`),b=it(Fc(o?.trim()||""));return`(function(){\n var __hfCompId = ${a};\n var __hfTimelineCompId = ${l};\n var __hfErrorLabel = ${s};\n var __hfAuthoredRootId = ${c};\n var __hfAuthoredRootAttr = ${it(ea)};\n var __hfEscapeAttr = function(value) {\n return (value + "").replace(/\\\\\\\\/g, "\\\\\\\\\\\\\\\\").replace(/"/g, "\\\\\\\\\\\\"");\n };\n var __hfRootSelector = ${m} || (__hfCompId\n ? \'[data-composition-id="\' + __hfEscapeAttr(__hfCompId) + \'"]\'\n : "");\n var __hfRoot = null;\n var __hfRootSelectorPattern = ${f};\n var __hfTimingSelectorPattern = ${h};\n var __hfAuthoredRootIdForms = ${b};\n var __hfAuthoredRootSelector = __hfAuthoredRootId\n ? "[" + __hfAuthoredRootAttr + \'="\' + __hfEscapeAttr(__hfAuthoredRootId) + \'"]\'\n : "";\n var __hfIsSelectorNameChar = function(char) {\n return !!char && /[\\\\w-]/.test(char);\n };\n var __hfReplaceAuthoredRootIdSelectors = function(selector) {\n if (!__hfAuthoredRootSelector || !__hfAuthoredRootIdForms.length || typeof selector !== "string") {\n return selector;\n }\n var result = "";\n var bracketDepth = 0;\n var quote = null;\n for (var index = 0; index < selector.length; index += 1) {\n var char = selector[index];\n var previousChar = index > 0 ? selector[index - 1] : "";\n if (quote) {\n result += char;\n if (char === quote && previousChar !== "\\\\\\\\") {\n quote = null;\n }\n continue;\n }\n if (char === \'"\' || char === "\'") {\n quote = char;\n result += char;\n continue;\n }\n if (char === "[") {\n bracketDepth += 1;\n result += char;\n continue;\n }\n if (char === "]") {\n bracketDepth = Math.max(0, bracketDepth - 1);\n result += char;\n continue;\n }\n if (char === "#" && bracketDepth === 0) {\n var matchedForm = null;\n for (var formIndex = 0; formIndex < __hfAuthoredRootIdForms.length; formIndex += 1) {\n var form = __hfAuthoredRootIdForms[formIndex];\n if (selector.slice(index + 1, index + 1 + form.length) === form) {\n matchedForm = form;\n break;\n }\n }\n if (matchedForm) {\n var nextChar = selector[index + 1 + matchedForm.length];\n if (!__hfIsSelectorNameChar(nextChar)) {\n result += __hfAuthoredRootSelector;\n index += matchedForm.length;\n continue;\n }\n }\n }\n result += char;\n }\n return result;\n };\n var __hfNormalizeSelector = function(selector) {\n if (!__hfCompId || typeof selector !== "string") return selector;\n var normalized = selector\n .replace(new RegExp(__hfRootSelectorPattern + \'(?:\' + __hfTimingSelectorPattern + \')+\', \'g\'), __hfRootSelector)\n .replace(new RegExp(\'(?:\' + __hfTimingSelectorPattern + \')+\' + __hfRootSelectorPattern, \'g\'), __hfRootSelector);\n if (__hfAuthoredRootSelector) {\n normalized = __hfReplaceAuthoredRootIdSelectors(normalized);\n }\n return normalized;\n };\n var __hfFindRoot = function() {\n if (!__hfRoot && __hfRootSelector) {\n __hfRoot = window.document.querySelector(__hfRootSelector);\n }\n return __hfRoot;\n };\n var __hfContains = function(node) {\n var root = __hfFindRoot();\n return !root || node === root || root.contains(node);\n };\n var __hfQueryAll = function(selector) {\n var root = __hfFindRoot();\n if (!root || typeof selector !== "string") {\n return window.document.querySelectorAll(selector);\n }\n return Array.prototype.filter.call(window.document.querySelectorAll(__hfNormalizeSelector(selector)), function(node) {\n return __hfContains(node);\n });\n };\n var __hfQueryOne = function(selector) {\n var matches = __hfQueryAll(selector);\n return matches[0] || null;\n };\n var __hfGetElementById = function(id) {\n var found = window.document.getElementById(id);\n if (found && __hfContains(found)) return found;\n var root = __hfFindRoot();\n if (!root) return found || null;\n var idValue = id + "";\n if (__hfAuthoredRootId && __hfAuthoredRootId === idValue && root.getAttribute && root.getAttribute(__hfAuthoredRootAttr) === idValue) {\n return root;\n }\n if (root.id === idValue) return root;\n if (typeof root.querySelector !== "function") return null;\n try {\n var authoredRootMatch = root.querySelector(\'[\' + __hfAuthoredRootAttr + \'="\' + __hfEscapeAttr(idValue) + \'"]\');\n if (authoredRootMatch) return authoredRootMatch;\n } catch {}\n if (typeof CSS !== "undefined" && CSS && typeof CSS.escape === "function") {\n try {\n return root.querySelector("#" + CSS.escape(idValue)) || null;\n } catch {}\n }\n try {\n return root.querySelector(\'[id="\' + __hfEscapeAttr(idValue) + \'"]\') || null;\n } catch {}\n return null;\n };\n var __hfScopedDocument = typeof Proxy === "function"\n ? new Proxy(window.document, {\n get: function(target, prop, receiver) {\n if (prop === "querySelector") return __hfQueryOne;\n if (prop === "querySelectorAll") return __hfQueryAll;\n if (prop === "getElementById") return __hfGetElementById;\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" ? value.bind(target) : value;\n },\n })\n : window.document;\n var __hfTimelineRegistryProxy = null;\n var __hfGetTimelineRegistry = function() {\n window.__timelines = window.__timelines || {};\n if (!__hfCompId || __hfCompId === __hfTimelineCompId || typeof Proxy !== "function") {\n return window.__timelines;\n }\n if (!__hfTimelineRegistryProxy) {\n __hfTimelineRegistryProxy = new Proxy(window.__timelines, {\n get: function(target, prop, receiver) {\n if (prop !== __hfCompId) {\n return Reflect.get(target, prop, target);\n }\n var authoredValue = Reflect.get(target, prop, target);\n return authoredValue === undefined\n ? Reflect.get(target, __hfTimelineCompId, target)\n : authoredValue;\n },\n set: function(target, prop, value, receiver) {\n if (prop !== __hfCompId) {\n return Reflect.set(target, prop, value, target);\n }\n // The authored node remains in the compiled DOM when its local id\n // differs from the runtime mount id, so readiness legitimately sees\n // both compositions. Publish the same timeline under both identities\n // instead of replacing one with the other.\n var authoredSet = Reflect.set(target, __hfCompId, value, target);\n var runtimeSet = Reflect.set(target, __hfTimelineCompId, value, target);\n return authoredSet && runtimeSet;\n },\n });\n }\n return __hfTimelineRegistryProxy;\n };\n var __hfScopedWindow = typeof Proxy === "function"\n ? new Proxy(window, {\n get: function(target, prop, receiver) {\n if (prop === "__timelines") return __hfGetTimelineRegistry();\n // Inside a sub-composition, __hyperframes is passed as a bare script\n // param bound to the SCOPED variant (per-comp getVariables). But\n // authors routinely write the documented window.__hyperframes.\n // getVariables() form, which would otherwise fall through to the host\n // page\'s base __hyperframes and return the WRONG (or empty) variables\n // for this instance. Route it to the scoped variant too so both\n // spellings resolve to this composition\'s own variables.\n // (__hfScopedHyperframes is a hoisted var assigned below, before any\n // sub-comp script -- the only code that reads this -- runs.)\n if (prop === "__hyperframes") return __hfScopedHyperframes;\n // Native window methods must stay bound to the real window. Handed\n // back unbound, "this" at call time is this Proxy and Chrome rejects\n // it with "Illegal invocation", which broke window.addEventListener,\n // setTimeout, matchMedia and getComputedStyle inside every\n // sub-composition -- including the window.addEventListener("hf-seek",\n // ...) form the Three.js and TypeGPU adapters document. The sibling\n // document and gsap proxies here already bind.\n //\n // Only bind non-constructors. Function.prototype.bind drops static\n // members, so binding a class exposed on window (window.Texts and\n // friends) would silently strip its statics. Built-in methods have\n // no .prototype; classes and constructor functions do.\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" && value.prototype === undefined\n ? value.bind(target)\n : value;\n },\n set: function(target, prop, value, receiver) {\n if (prop === "__timelines") {\n // Common authoring boilerplate assigns the registry back to\n // itself (window.__timelines = window.__timelines || {}). The\n // getter above returns our proxy; do not replace the canonical\n // registry with that proxy or later wrappers will stack proxies.\n if (value === __hfTimelineRegistryProxy) return true;\n target.__timelines = value || {};\n __hfTimelineRegistryProxy = null;\n return true;\n }\n return Reflect.set(target, prop, value, target);\n },\n })\n : window;\n var __hfResolveGsapTarget = function(target) {\n if (typeof target !== "string") return target;\n return __hfQueryAll(target);\n };\n var __hfScopeTimeline = function(timeline) {\n if (!timeline || timeline.__hfScopedCompositionRoot === __hfFindRoot()) return timeline;\n ["to", "from", "fromTo", "set"].forEach(function(method) {\n var original = timeline[method];\n if (typeof original !== "function") return;\n timeline[method] = function(target) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(target);\n return original.apply(timeline, args);\n };\n });\n try {\n Object.defineProperty(timeline, "__hfScopedCompositionRoot", {\n value: __hfFindRoot(),\n configurable: true,\n });\n } catch {\n // Best-effort: timelines coming from user code may have a frozen target\n // or a non-extensible defineProperty path. Swallow \\u2014 the scoped root\n // is an enrichment, not a correctness invariant for playback.\n }\n return timeline;\n };\n var __hfBaseGsap = typeof gsap === "undefined" ? window.gsap : gsap;\n var __hfScopedGsap = !__hfBaseGsap || typeof Proxy !== "function"\n ? __hfBaseGsap\n : new Proxy(__hfBaseGsap, {\n get: function(target, prop, receiver) {\n if (prop === "timeline") {\n return function() {\n return __hfScopeTimeline(target.timeline.apply(target, arguments));\n };\n }\n if (prop === "to" || prop === "from" || prop === "fromTo" || prop === "set") {\n return function(firstArg) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(firstArg);\n return target[prop].apply(target, args);\n };\n }\n if (prop === "utils" && target.utils && typeof Proxy === "function") {\n return new Proxy(target.utils, {\n get: function(utilsTarget, utilsProp, utilsReceiver) {\n if (utilsProp === "toArray") {\n return function(firstArg) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(firstArg);\n return utilsTarget.toArray.apply(utilsTarget, args);\n };\n }\n if (utilsProp === "selector") {\n return function(base) {\n var baseEl = typeof base === "string" ? __hfQueryOne(base) : base;\n var root = baseEl || __hfFindRoot();\n return function(selector) {\n if (!root || typeof selector !== "string") return [];\n return Array.prototype.filter.call(\n window.document.querySelectorAll(__hfNormalizeSelector(selector)),\n function(node) {\n return node === root || (typeof root.contains === "function" && root.contains(node));\n },\n );\n };\n };\n }\n var value = Reflect.get(utilsTarget, utilsProp, utilsTarget);\n return typeof value === "function" ? value.bind(utilsTarget) : value;\n },\n });\n }\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" ? value.bind(target) : value;\n },\n });\n var __hfBaseHyperframes = window.__hyperframes;\n var __hfScopedHyperframes = !__hfBaseHyperframes\n ? __hfBaseHyperframes\n : Object.assign({}, __hfBaseHyperframes, {\n getVariables: function() {\n var byComp = window.__hfVariablesByComp;\n var scoped = byComp && __hfTimelineCompId ? byComp[__hfTimelineCompId] : null;\n return scoped ? Object.assign({}, scoped) : {};\n },\n });\n var __hfRun = function() {\n try {\n (function(document, gsap, window, __hyperframes) {\n${e.replace(/<\\/(script)/gi,"<\\\\/$1")}\n }).call(window, __hfScopedDocument, __hfScopedGsap, __hfScopedWindow, __hfScopedHyperframes);\n } catch (_err) {\n console.error(__hfErrorLabel, __hfCompId, _err);\n }\n };\n __hfFindRoot();\n __hfRun();\n})();`}var hg=["data-composition-id","data-composition-file","data-start","data-duration","data-end","data-track-index","data-track","data-composition-src","data-hf-authored-duration","data-hf-authored-end"];function Dc(e){let t=e.getAttribute("id")?.trim();for(let n of hg)e.removeAttribute(n);t&&(e.removeAttribute("id"),e.setAttribute("data-hf-authored-id",t)),e.setAttribute("data-hf-inner-root","true")}var gg=8e3,bg=/^(?![a-zA-Z][a-zA-Z\\d+\\-.]*:)(?!\\/\\/)(?!\\/)(?!\\.\\.?\\/).+/,xg=/\\burl\\(\\s*(["\']?)([^)"\']+)\\1\\s*\\)/g,yg=["src","href"];function vg(e){return!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")||e.startsWith("data:")||e.startsWith("#")||e.startsWith("/")}function Oc(e,t){if(!t)return e;let n=e.trim();if(vg(n)||!n.startsWith("../")&&n!=="..")return e;try{return new URL(n,t).href}catch{return e}}function Gc(e,t){return!t||!e?e:e.replace(xg,(n,r,i)=>{let o=Oc(i||"",t);return o===i?n:`url(${r||""}${o}${r||""})`})}function Sg(e,t){for(let n of Array.from(e.querySelectorAll("[src], [href]")))for(let r of yg){let i=n.getAttribute(r);if(i==null)continue;let o=Oc(i,t);o!==i&&n.setAttribute(r,o)}}function Ag(e,t){for(let n of Array.from(e.querySelectorAll("[style]"))){let r=n.getAttribute("style");if(r==null)continue;let i=Gc(r,t);i!==r&&n.setAttribute("style",i)}}function Eg(e,t){for(let n of Array.from(e.querySelectorAll("style"))){let r=n.textContent||"",i=Gc(r,t);i!==r&&(n.textContent=i)}}function Hc(e,t){if(t){Sg(e,t),Ag(e,t),Eg(e,t);for(let n of Array.from(e.querySelectorAll("template")))Hc(n.content,t)}}function Cg(e,t){return`${e}__hf${t}`}var wg=e=>new Promise(t=>{let n=!1,r=Date.now(),i=null,o=a=>{n||(n=!0,i!=null&&window.clearTimeout(i),t({status:a,elapsedMs:Math.max(0,Date.now()-r)}))};e.addEventListener("load",()=>o("load"),{once:!0}),e.addEventListener("error",()=>o("error"),{once:!0}),i=window.setTimeout(()=>o("timeout"),gg)});function ra(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.textContent=""}function Ic(e){for(let t of Array.from(e.querySelectorAll("style, script")))t.remove()}function _g(e){let t=document.importNode(e,!0);Dc(t);let n=t.getAttribute("data-width"),r=t.getAttribute("data-height");return t.style.width=n?`${n}px`:"100%",t.style.height=r?`${r}px`:"100%",t}function Tg(e,t){let n=e.trim();if(!n)return e;try{return bg.test(n)&&!n.startsWith("#")&&!n.startsWith("?")?new URL(n,document.baseURI).toString():t?new URL(n,t).toString():new URL(n,document.baseURI).toString()}catch{return e}}function Pc(e,t){try{let n=new URL(e),r=new URL(t);return n.search="",n.hash="",r.search="",r.hash="",n.href===r.href}catch{return!1}}function Jr(e){let t=(e.getAttribute("data-composition-id")||"").trim()||null;return{authoredCompositionId:(e.getAttribute("data-hf-original-composition-id")||t||"").trim()||null,runtimeCompositionId:t}}function Rg(e){let t=new Map;for(let n of e){let r=Jr(n).authoredCompositionId||"";r&&t.set(r,(t.get(r)||0)+1)}return t}function Bc(e){let t=Jr(e).authoredCompositionId;return t?!!document.querySelector(`template#${CSS.escape(t)}-template`):!1}function kg(e){return!!e.querySelector(\'[data-hf-inner-root="true"]\')}function Mg(e){return e.hasAttribute("data-composition-src")?!0:Bc(e)?e.children.length===0||e.hasAttribute("data-hf-original-composition-id")?!0:kg(e):!1}function oa(){return Array.from(document.querySelectorAll("[data-composition-src], [data-composition-id]")).filter(t=>t.hasAttribute("data-composition-src")?!0:Bc(t))}function Uc(){let e=window.__hfVariablesByComp;if(!e)return;let t=new Set(oa().map(n=>Jr(n).runtimeCompositionId).filter(n=>!!n));for(let n of Object.keys(e))t.has(n)||delete e[n]}function Wc(e,t=Rg(e)){let n=new Map,r=new Map;for(let i of e){let{authoredCompositionId:o,runtimeCompositionId:a}=Jr(i),l=Mg(i);if(!o){r.set(i,{authoredCompositionId:null,runtimeCompositionId:a});continue}let s=(t.get(o)||0)>1,u=a||o;if(l){let c=s?(n.get(o)||0)+1:0;s&&n.set(o,c),u=s?Cg(o,c):o,s?i.setAttribute("data-hf-original-composition-id",o):i.removeAttribute("data-hf-original-composition-id"),i.setAttribute("data-composition-id",u),a&&a!==u&&window.__hfVariablesByComp&&delete window.__hfVariablesByComp[a]}r.set(i,{authoredCompositionId:o,runtimeCompositionId:u})}return r}async function ia(e){let t=nu({contentNode:e.sourceNode,head:e.head,hasTemplate:e.hasTemplate,compositionId:e.authoredCompositionId}),n=t.innerRoot instanceof HTMLElement?t.innerRoot:null,r=n??e.sourceNode,i=t.authoredCompositionId,o=t.scriptCompositionId,a=e.runtimeCompositionId||null,l=t.authoredRootId,s=a?`[data-composition-id="${CSS.escape(a)}"]`:void 0;for(let f of t.linkSources){let h=(f.getAttribute("href")||"").trim();if(!h)continue;let b=e.compositionUrl?new URL(h,e.compositionUrl).href:h;if(e.compositionUrl&&Pc(b,e.compositionUrl)||document.head.querySelector(`link[href="${CSS.escape(b)}"]`))continue;let v=f.cloneNode(!0);v instanceof HTMLLinkElement&&(v.href=b,document.head.appendChild(v),e.injectedLinks.push(v))}(f=>{for(let h of f){let b=h.cloneNode(!0);b instanceof HTMLStyleElement&&(i&&(b.textContent=Nc(b.textContent||"",i,s,l,{scopeRootSelectors:!0})),document.head.appendChild(b),e.injectedStyles.push(b))}})(t.styleSources);let c=f=>{let h=f.getAttribute("type")?.trim()??"",b=f.getAttribute("src")?.trim()??"";if(b){let x=Tg(b,e.compositionUrl);return e.compositionUrl&&Pc(x,e.compositionUrl)?null:{kind:"external",src:x,type:h}}let v=f.textContent?.trim()??"";return v?{kind:"inline",content:v,type:h,scopeCompositionId:o}:null},m=t.scriptSources.map(c).filter(f=>f!==null);if(n){let f=n.getAttribute("data-width"),h=n.getAttribute("data-height"),b=e.parseDimensionPx(f),v=e.parseDimensionPx(h);f&&e.host.setAttribute("data-width",f),h&&e.host.setAttribute("data-height",h),b&&e.host instanceof HTMLElement&&(e.host.style.width=b),v&&e.host instanceof HTMLElement&&(e.host.style.height=v),n.hasAttribute("data-timeline-locked")&&e.host.setAttribute("data-timeline-locked","");let x=_g(n);!e.authoredCompositionId&&i&&x.setAttribute("data-composition-id",i),Ic(x),e.host.appendChild(x)}else if(e.hasTemplate){let f=document.importNode(r,!0);Ic(f),e.host.appendChild(f)}else e.host.innerHTML=e.fallbackBodyInnerHtml;a&&Fg(e,r,a);for(let f of m){let h=document.createElement("script");if(f.type&&(h.type=f.type),h.async=!1,f.kind==="external"?h.src=f.src:f.type.toLowerCase()==="module"?h.textContent=f.content:f.scopeCompositionId?h.textContent=Lc(f.content,f.scopeCompositionId,"[HyperFrames] composition script error:",s,a||f.scopeCompositionId,l):h.textContent=`(function(){${f.content}})();`,document.body.appendChild(h),e.injectedScripts.push(h),f.kind==="external"){let b=await wg(h);b.status!=="load"&&e.onDiagnostic?.({code:"external_composition_script_load_issue",details:{hostCompositionId:e.authoredCompositionId,runtimeCompositionId:e.runtimeCompositionId,hostCompositionSrc:e.hostCompositionSrc,resolvedScriptSrc:f.src,loadStatus:b.status,elapsedMs:b.elapsedMs}})}}}async function Vc(e){let t=oa();if(Uc(),t.length===0)return;let n=Wc(t),r=t.filter(i=>{if(i.hasAttribute("data-composition-src")||i.children.length>0)return!1;let o=n.get(i)?.authoredCompositionId;return o?!!document.querySelector(`template#${CSS.escape(o)}-template`):!1});if(r.length!==0)for(let i of r){let o=n.get(i),a=o?.authoredCompositionId;if(!a)continue;let l=document.querySelector(`template#${CSS.escape(a)}-template`);ra(i),await ia({host:i,authoredCompositionId:a,runtimeCompositionId:o?.runtimeCompositionId||a,hostCompositionSrc:`template#${a}-template`,sourceNode:l.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:null,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic})}}async function zc(e){let t=oa();if(Uc(),t.length===0)return;let n=Wc(t),r=t.filter(i=>i.hasAttribute("data-composition-src"));r.length!==0&&await Promise.all(r.map(async i=>{let o=i.getAttribute("data-composition-src");if(!o)return;let a=n.get(i),l=a?.authoredCompositionId||null,s=a?.runtimeCompositionId||l||null,u=null;try{u=new URL(o,document.baseURI)}catch{u=null}ra(i);try{let c=l!=null?document.querySelector(`template#${CSS.escape(l)}-template`):null;if(c){await ia({host:i,authoredCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,sourceNode:c.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic});return}let m=await fetch(o);if(!m.ok)throw new Error(`HTTP ${m.status}`);let f=await m.text(),b=new DOMParser().parseFromString(f,"text/html");Hc(b,u);let v=(l?b.querySelector(`template#${CSS.escape(l)}-template`):null)??b.querySelector("template"),x=v?v.content:b.body;await ia({host:i,authoredCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,sourceNode:x,hasTemplate:!!v,fallbackBodyInnerHtml:b.body.innerHTML,compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,head:b.head,declaredVariableDefaults:dn(b.documentElement),variableDeclarer:b.documentElement,onDiagnostic:e.onDiagnostic})}catch(c){e.onDiagnostic?.({code:"external_composition_load_failed",details:{hostCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,errorMessage:c instanceof Error?c.message:"unknown_error"}}),ra(i)}}))}function Fg(e,t,n){let i={...e.declaredVariableDefaults??(t instanceof Element?dn(t):{}),...Es(e.host)};Oi(e.variableDeclarer??(t instanceof Element?t:null),i,n),Ss(e.host),Object.keys(i).length>0?(window.__hfVariablesByComp||(window.__hfVariablesByComp={}),window.__hfVariablesByComp[n]=i,Gi(e.host,{...vs(e.host,i,window),...xr()})):window.__hfVariablesByComp&&delete window.__hfVariablesByComp[n]}function aa(e){let n=e.vars.data?.captionState;return n==="dim"||n==="active"?n:void 0}function Ng(e){return e instanceof HTMLElement?e.dataset.captionWrapper!=="true"?e:e.querySelector(":scope > span")??null:null}function Lg(){let e=[],t=document.querySelectorAll(".caption-group");for(let n of t)for(let r of n.children){if(!(r instanceof HTMLElement))continue;let i=r.dataset.captionWrapper==="true"?r.querySelector(":scope > span"):r.tagName==="SPAN"?r:null;i&&e.push(i)}return e}function Dg(e){let t=e.parentElement;if(t?.dataset.captionWrapper==="true")return t;let n=document.createElement("span");return n.style.display="inline-block",n.dataset.captionWrapper="true",e.parentNode?.insertBefore(n,e),n.appendChild(e),n}function sa(){let e=window.gsap;e&&document.querySelectorAll(".caption-group").length!==0&&fetch("caption-overrides.json").then(t=>t.ok?t.json():null).then(t=>{if(!t||!Array.isArray(t)||t.length===0)return;let n=Lg();for(let r of t){let i=null;if(r.wordId&&(i=Ng(document.getElementById(r.wordId))),!i&&r.wordIndex!==void 0&&(i=n[r.wordIndex]??null),!i)continue;let o={},a={};if(r.x!==void 0&&(o.x=r.x),r.y!==void 0&&(o.y=r.y),r.scale!==void 0&&(o.scale=r.scale),r.rotation!==void 0&&(o.rotation=r.rotation),r.opacity!==void 0&&(a.opacity=r.opacity),r.fontSize!==void 0&&(a.fontSize=`${r.fontSize}px`),r.fontWeight!==void 0&&(a.fontWeight=r.fontWeight),r.fontFamily!==void 0&&(a.fontFamily=r.fontFamily),r.activeColor||r.dimColor){let s=e.getTweensOf(i).filter(m=>m.vars.color!==void 0).sort((m,f)=>m.startTime()-f.startTime()),u=s.find(m=>aa(m)==="dim")??s.find(m=>aa(m)===void 0),c=u?String(u.vars.color):"";for(let m of s)(aa(m)??(String(m.vars.color)===c?"dim":"active"))==="dim"?r.dimColor&&(m.vars.color=r.dimColor):r.activeColor&&(m.vars.color=r.activeColor);r.dimColor&&e.set(i,{color:r.dimColor})}if(Object.keys(a).length>0&&e.set(i,a),Object.keys(o).length>0){let l=Dg(i);e.set(l,o)}}}).catch(()=>{})}var ua="data-hf-edit-base-x",ca="data-hf-edit-base-y",Jt="data-hf-edit-original-translate",Qr=e=>{let t=parseFloat(e??"");return Number.isFinite(t)?t:0},Ig=e=>{let t=[],n=0,r="";for(let i of e.trim())i==="("&&(n+=1),i===")"&&(n=Math.max(0,n-1)),/\\s/.test(i)&&n===0?(r&&t.push(r),r=""):r+=i;return r&&t.push(r),t},qc=/^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)px$/,la=(e,t)=>qc.test(e)&&qc.test(t)?`${parseFloat(e)+parseFloat(t)}px`:`calc(${e} + ${t})`,Pg=(e,t,n)=>{if(!e||e==="none")return`${t} ${n}`;let[r,i,o]=Ig(e);if(r===void 0)return`${t} ${n}`;if(i===void 0)return`${la(r,t)} ${n}`;let a=o===void 0?"":` ${o}`;return`${la(r,t)} ${la(i,n)}${a}`},Og=e=>{try{e.ownerDocument.defaultView?.gsap?.getProperty?.(e,"x")}catch{}},Gg=e=>{let t=e.style.getPropertyValue("translate").trim();if(t)return t==="none"?"":t;try{let n=e.ownerDocument.defaultView,r=n?n.getComputedStyle(e).getPropertyValue("translate").trim():"";return r==="none"?"":r}catch{return""}},da=new WeakMap;function Hg(e,t){let n=da.get(e);if(!t?.force&&n!==void 0&&e.style.getPropertyValue("translate")!==n){Le("position_edit_fold_skipped",{hfId:e.getAttribute("data-hf-id")});return}let r=Qr(e.getAttribute("data-x"))-Qr(e.getAttribute(ua)),i=Qr(e.getAttribute("data-y"))-Qr(e.getAttribute(ca));e.hasAttribute(Jt)||e.setAttribute(Jt,Gg(e)),n===void 0&&Og(e);let o=e.getAttribute(Jt)??"",a=Pg(o,`${r}px`,`${i}px`);e.style.setProperty("translate",a),da.set(e,e.style.getPropertyValue("translate"))}function Zr(e,t){let n=e.defaultView?.HTMLElement,r=e.defaultView?.SVGElement,i=s=>n||r?n!==void 0&&s instanceof n||r!==void 0&&s instanceof r:typeof s.style?.setProperty=="function",o=e.querySelectorAll(`[${Jt}]:not([${ua}]):not([${ca}])`);for(let s=0;s<o.length;s++){let u=o[s];if(u===void 0||!i(u))continue;let c=u.getAttribute(Jt)??"";c===""?u.style.removeProperty("translate"):u.style.setProperty("translate",c),u.removeAttribute(Jt),da.delete(u)}let a=e.querySelectorAll(`[${ua}], [${ca}]`),l=0;for(let s=0;s<a.length;s++){let u=a[s];u===void 0||!i(u)||(Hg(u,t),l+=1)}return l}var $c="__hfPositionEditsSeekReapplyWrapped",jc=new WeakSet,Kc=new WeakMap,Yc=new WeakMap;function Xc(e){let t=e,n=()=>{try{Zr(t.document)}catch{}},r=m=>typeof m=="function"&&(jc.has(m)||!!m[$c]),i=m=>{jc.add(m);try{Object.defineProperty(m,$c,{value:!0})}catch{}},o=m=>{if(typeof m!="function"||r(m))return m;let f=function(...h){let b=m.apply(this,h);return n(),b};return i(f),f},a=(m,f)=>{let h=Kc.get(m);if(h?.has(f))return!0;let b=Object.getOwnPropertyDescriptor(m,f);if(b?.configurable===!1){let _=m[f];return typeof _=="function"&&(m[f]=o(_),n()),!1}let v=m[f],x=b?.set;return Object.defineProperty(m,f,{configurable:!0,enumerable:b?.enumerable??!0,get:()=>v,set:_=>{v=o(_),x?.call(m,_)}}),v=o(v),h??(h=new Set),h.add(f),Kc.set(m,h),n(),!0},l=(m,f)=>{let h=Yc.get(t),b=Object.getOwnPropertyDescriptor(t,m);if(!h?.has(m)){if(b?.configurable===!1){let _=t[m];return _?a(_,f):!1}let x=t[m];Object.defineProperty(t,m,{configurable:!0,enumerable:b?.enumerable??!0,get:()=>x,set:_=>{x=_,x&&a(x,f)}}),h??(h=new Set),h.add(m),Yc.set(t,h)}let v=t[m];return v?a(v,f):!1},s=()=>{let m=l("__hf","seek"),f=l("__player","renderSeek");return m&&f};if(s())return;let u=120,c=t.setInterval(()=>{if(s()){t.clearInterval(c);return}u-=1,u<=0&&t.clearInterval(c)},50)}function ei(e){let t=window,r=e.closest("[data-composition-id]")?.getAttribute("data-composition-id")?.trim()??"",i=r?t.__hfVariablesByComp?.[r]:void 0;if(i)return i;let o=t.__hyperframes?.getVariables?.();return o&&typeof o=="object"?o:t.__hfVariables??{}}function ti(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function fa(e){let t=e.replace(/[\\u0000-\\u0020]/g,""),n=/^([a-z][a-z0-9+.-]*):/i.exec(t);if(!n)return!0;let r=n[1]?.toLowerCase();return r?r==="https"||r==="http"||r==="blob"?!0:r==="data"?/^data:image\\//i.test(t):!1:!1}var Jc=new Set(["img","video","audio","source"]);function Bg(e){if(typeof e=="string"&&e.length>0)return e;if(e!==null&&typeof e=="object"){let t=e.url;if(typeof t=="string"&&t.length>0)return t}return null}function Ug(e){return e.replace(/[;{}<>\\r\\n]/g,"")}function Wg(e){if(ti(e))return String(e);if(e!==null&&typeof e=="object"){let t=e.name;if(typeof t=="string"&&t.length>0)return t}return null}function ma(e,t){let n=e.closest("[data-composition-id]"),r=t.get(n);if(r)return r;let i=ei(e);return t.set(n,i),i}function Vg(e,t){if(e.childElementCount===0){e.textContent=t;return}let n=!1;for(let r of Array.from(e.childNodes))r.nodeType===Node.TEXT_NODE&&(r.nodeValue=n?"":t,n=!0);n||e.insertBefore(e.ownerDocument.createTextNode(t),e.firstChild)}function zg(e){return e.querySelector("[data-hf-root]")??e.getElementById("stage")??e.body?.firstElementChild??e.body}function qg(e,t){let n=new Set,r=zg(e);r&&n.add(r);for(let i of Array.from(e.querySelectorAll("[data-composition-id]")))n.add(i);for(let i of n){let o=ma(i,t);for(let[a,l]of Object.entries(o)){let s=Wg(l);s!==null&&i instanceof HTMLElement&&i.style.setProperty(`--${a}`,Ug(s))}}}function pa(e){let t=new Map;qg(e,t);for(let n of Array.from(e.querySelectorAll("[data-var-src]"))){let r=n.getAttribute("data-var-src")?.trim();if(!r)continue;if(!Jc.has(n.tagName.toLowerCase())){console.warn(`[hyperframes] Ignoring data-var-src on <${n.tagName.toLowerCase()}>: variable-bound src is only allowed on ${Array.from(Jc).join("/")}.`);continue}let i=Bg(ma(n,t)[r]);if(i!==null){if(!fa(i)){console.warn(`[hyperframes] Ignoring data-var-src="${r}": unsafe URL protocol.`);continue}n.setAttribute("src",i)}}for(let n of Array.from(e.querySelectorAll("[data-var-text]"))){let r=n.getAttribute("data-var-text")?.trim();if(!r)continue;let i=ma(n,t)[r];ti(i)&&Vg(n,String(i))}}var ha="hf-audio-group",Qc="data-audio-group",XA=`audio[${Qc}]`;function Qt(e){return typeof e.tagName!="string"||e.tagName.toLowerCase()!=="audio"||typeof e.getAttribute!="function"?null:e.getAttribute(Qc)||null}function Zc(e){let t="__hf-audio-group-inert";if(!e?.head||e.getElementById(t))return;let n=e.createElement("style");n.id=t,n.textContent=`${ha}{display:none!important}`,e.head.appendChild(n)}function Yn(e,t,n){return e.size===0||e.has(t)?!0:!!(n&&e.has(n))}var ot=new Map,$g="data-hf-color-grading-canvas",jg="__hf_color_grading_canvas__";function cd(){if(typeof MutationObserver>"u"||typeof document>"u")return;let e=document.documentElement;if(!e)return;let t=r=>{r instanceof HTMLElement&&(r.hasAttribute(Nr)||r.setAttribute(Nr,r.style.opacity))},n=r=>{if(r instanceof Element){r.matches("video, img")&&t(r);for(let i of r.querySelectorAll("video, img"))t(i)}};n(e),new MutationObserver(r=>{for(let i of r)for(let o of i.addedNodes)n(o)}).observe(e,{childList:!0,subtree:!0})}var Kg=16,Yg=4,en={enabled:!1,position:.5,softness:0,lineWidth:2},ga=["#000000","#ffffff"],Xg=["#1a1a1a","#f5f5dc"],tr=3,Jg=tr-1,Qg=5,ba=`${Xe}.0`,ed=`${Xe-1}.0`,Zg=`${tr}.0`,eb=`${(Jg+.5)/tr}`;function ni(e){let t=e.getAttribute(wn);return t==null?null:Wl(t,ei(e))}var tb=["attribute vec2 a_pos;","varying vec2 v_uv;","void main(){"," v_uv = a_pos * 0.5 + 0.5;"," gl_Position = vec4(a_pos, 0.0, 1.0);","}"].join(`\n`),nb=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_source;","uniform sampler2D u_blurSource;","uniform sampler2D u_bloomSource;","uniform sampler2D u_kuwaharaSource;","uniform sampler2D u_lut;","uniform sampler2D u_advanced;","uniform vec2 u_resolution;","uniform vec2 u_uvScale;","uniform vec2 u_uvOffset;","uniform float u_blurReady;","uniform float u_bloomReady;","uniform float u_kuwaharaReady;","uniform float u_lutEnabled;","uniform float u_lutSize;","uniform vec2 u_lutTextureSize;","uniform vec3 u_lutDomainMin;","uniform vec3 u_lutDomainMax;","uniform float u_lutIntensity;","uniform vec3 u_shadowWheel;","uniform vec3 u_midtoneWheel;","uniform vec3 u_highlightWheel;","uniform float u_rgbCurvesEnabled;","uniform float u_hueCurvesEnabled;","uniform float u_secondaryCount;","uniform float u_exposure;","uniform float u_contrast;","uniform float u_highlights;","uniform float u_shadows;","uniform float u_whites;","uniform float u_blacks;","uniform float u_temperature;","uniform float u_tint;","uniform float u_vibrance;","uniform float u_saturation;","uniform float u_vignette;","uniform float u_vignetteMidpoint;","uniform float u_vignetteRoundness;","uniform float u_vignetteFeather;","uniform float u_grain;","uniform float u_grainSize;","uniform float u_grainRoughness;","uniform float u_grainSeed;","uniform float u_effectTime;","uniform float u_blur;","uniform float u_bloom;","uniform float u_kuwahara;","uniform float u_pixelate;","uniform float u_chromaBleed;","uniform float u_tapeDamage;","uniform float u_tapeTracking;","uniform float u_tapeNoise;","uniform float u_tapeSpeed;","uniform float u_filmArtifacts;","uniform float u_halftone;","uniform float u_halftoneSize;","uniform float u_twoInkPrint;","uniform float u_twoInkPrintSize;","uniform float u_ascii;","uniform float u_asciiSize;","uniform float u_asciiInvert;","uniform float u_asciiStyle;","uniform float u_asciiColor;","uniform float u_asciiRotation;","uniform float u_dither;","uniform float u_ditherSize;","uniform float u_monoScreen;","uniform float u_monoScreenSize;","uniform float u_monoScreenAngle;","uniform float u_monoScreenSpread;","uniform float u_monoScreenShape;","uniform float u_monoScreenInvert;","uniform float u_scanlines;","uniform float u_scanlineCount;","uniform float u_scanlineSoftness;","uniform float u_chromaticAberration;","uniform float u_chromaticAngle;","uniform float u_crtCurvature;","uniform float u_digitalGlitch;","uniform float u_digitalGlitchColorSplit;","uniform float u_digitalGlitchLineTear;","uniform float u_digitalGlitchPixelate;","uniform float u_digitalGlitchBlockAmount;","uniform float u_digitalGlitchBlockDisplacement;","uniform float u_digitalGlitchBlockOpacity;","uniform float u_digitalGlitchSpeed;","uniform float u_engraving;","uniform float u_engravingSpacing;","uniform float u_engravingMinThickness;","uniform float u_engravingMaxThickness;","uniform float u_engravingAngle;","uniform float u_engravingContrast;","uniform float u_engravingSharpness;","uniform float u_engravingWave;","uniform float u_engravingWaveFrequency;","uniform float u_crosshatch;","uniform float u_crosshatchSpacing;","uniform float u_crosshatchThickness;","uniform float u_crosshatchAngle;","uniform float u_crosshatchContrast;","uniform float u_crosshatchEdges;","uniform float u_crosshatchLineWeight;","uniform float u_crosshatchWave;","uniform float u_crosshatchWaveFrequency;","uniform float u_paletteSize;","uniform vec3 u_palette0;","uniform vec3 u_palette1;","uniform vec3 u_palette2;","uniform vec3 u_palette3;","uniform vec3 u_palette4;","uniform vec3 u_palette5;","uniform float u_intensity;","uniform float u_compareEnabled;","uniform float u_comparePosition;","uniform float u_compareSoftness;","uniform float u_compareLineWidth;","const float PI = 3.14159265359;","float lumaOf(vec3 c){ return dot(c, vec3(0.2126, 0.7152, 0.0722)); }","float bt601Luma(vec3 c){ return dot(c, vec3(0.299, 0.587, 0.114)); }","float grainHash(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123); }","float digitalHash(vec2 p){"," vec2 q = mod(floor(p), 251.0);"," float x = mod(q.x * q.x * 157.0 + q.x * 89.0, 251.0);"," float y = mod(q.y * q.y * 113.0 + q.y * 47.0, 251.0);"," float xy = mod(q.x * q.y * 71.0, 251.0);"," return mod(x + y + xy + 19.0, 251.0) / 251.0;","}","float colorSaturation(vec3 c){ return max(max(c.r, c.g), c.b) - min(min(c.r, c.g), c.b); }","vec2 clampUv(vec2 uv){ return clamp(uv, vec2(0.0), vec2(1.0)); }","vec2 applyCrtWarp(vec2 uv){"," vec2 centered = uv * 2.0 - 1.0;"," float curvature = clamp(u_crtCurvature, 0.0, 1.0) * 0.5;"," float dist = dot(centered, centered);"," centered *= 1.0 + curvature * dist;"," return centered * 0.5 + 0.5;","}","vec4 sampleSource(vec2 uv){ return texture2D(u_source, clampUv(uv)); }","vec4 sampleBlur(vec2 uv){ return texture2D(u_blurSource, clampUv(uv)); }","vec3 sampleBloom(vec2 uv){ return texture2D(u_bloomSource, clampUv(uv)).rgb; }","vec3 sampleKuwahara(vec2 uv){"," vec2 displayUv = uv * u_uvScale + u_uvOffset;"," return texture2D(u_kuwaharaSource, clampUv(displayUv)).rgb;","}","vec4 samplePrepared(vec2 uv){"," vec4 base = sampleSource(uv);"," float blur = clamp(u_blur, 0.0, 1.0);"," if (blur > 0.0 && u_blurReady > 0.5) base = mix(base, sampleBlur(uv), blur);"," float kuwahara = clamp(u_kuwahara, 0.0, 1.0);"," if (kuwahara > 0.0 && u_kuwaharaReady > 0.5) {"," base.rgb = mix(base.rgb, sampleKuwahara(uv), kuwahara);"," }"," return base;","}","float tapeTrackingBand(float y, float center, float width){"," float offset = fract(y - center + 0.5) - 0.5;"," float triangle = max(0.0, 1.0 - abs(offset) / max(width, 0.0001));"," return triangle * triangle * (3.0 - 2.0 * triangle);","}","vec4 sampleMedia(vec2 uv){"," float pixel = clamp(u_pixelate, 0.0, 1.0);"," vec2 sampleUv = uv;"," if (pixel > 0.0) {"," float blockSize = mix(1.0, 48.0, pixel);"," vec2 cells = max(u_resolution / blockSize, vec2(1.0));"," sampleUv = (floor(clamp(uv, vec2(0.0), vec2(0.999999)) * cells) + 0.5) / cells;"," }"," float tapeDamage = clamp(u_tapeDamage, 0.0, 1.0);"," float tapeTracking = clamp(u_tapeTracking, 0.0, 1.0);"," float tapeNoise = clamp(u_tapeNoise, 0.0, 1.0);"," float tapeTime = u_effectTime * mix(0.0, 2.0, clamp(u_tapeSpeed, 0.0, 1.0));"," float tapeFrame = floor(tapeTime * 60.0);"," float tapeLine = floor(sampleUv.y * u_resolution.y * 0.5);"," float lineJitter = (digitalHash(vec2(tapeLine, floor(tapeFrame * 0.5))) - 0.5) * 1.8 * tapeNoise;"," float slowWobble = sin(sampleUv.y * 32.0 + tapeTime * 2.6) * 0.55;"," float headSwitch = smoothstep(0.88, 1.0, sampleUv.y) * sin(sampleUv.y * 240.0 + tapeTime * 8.0) * 4.0;"," float trackingShift = tapeTrackingBand(sampleUv.y, fract(0.08 + tapeTime * 0.083), 0.035);"," trackingShift -= tapeTrackingBand(sampleUv.y, fract(0.28 + tapeTime * 0.061), 0.03) * 0.8;"," trackingShift += tapeTrackingBand(sampleUv.y, fract(0.5 + tapeTime * 0.047), 0.04) * 0.75;"," trackingShift -= tapeTrackingBand(sampleUv.y, fract(0.72 + tapeTime * 0.037), 0.028) * 0.65;"," trackingShift += tapeTrackingBand(sampleUv.y, fract(0.89 + tapeTime * 0.029), 0.032) * 0.55;"," trackingShift *= tapeTracking * 48.0;"," float tapeShift = (lineJitter + slowWobble + headSwitch + trackingShift) * tapeDamage;"," float texelX = 1.0 / max(u_resolution.x * max(u_uvScale.x, 0.00001), 1.0);"," vec2 tapeUv = sampleUv + vec2(tapeShift * texelX, 0.0);"," vec4 base = samplePrepared(tapeUv);"," if (tapeDamage > 0.0) {"," vec2 lumaStep = vec2(texelX * mix(1.0, 3.5, tapeDamage), 0.0);"," vec3 leftTape = samplePrepared(tapeUv - lumaStep).rgb;"," vec3 rightTape = samplePrepared(tapeUv + lumaStep).rgb;"," float tapeLuma = (bt601Luma(leftTape) + bt601Luma(base.rgb) * 2.0 + bt601Luma(rightTape)) * 0.25;"," vec3 centerChroma = base.rgb - vec3(bt601Luma(base.rgb));"," vec3 tapeColor = vec3(tapeLuma) + centerChroma;"," vec3 ghost = samplePrepared(tapeUv - vec2(texelX * 12.0, 0.0)).rgb;"," tapeColor = mix(tapeColor, ghost, 0.045 * tapeDamage);"," float fineNoise = digitalHash(floor(gl_FragCoord.xy) + vec2(tapeFrame * 17.0, tapeFrame * 3.0)) - 0.5;"," float band = digitalHash(vec2(floor(sampleUv.y * 92.0), floor(tapeFrame / 3.0)));"," float dropout = smoothstep(0.985, 1.0, band) * (digitalHash(vec2(floor(sampleUv.x * 18.0), tapeLine)) - 0.5);"," tapeColor += (fineNoise * 0.035 + dropout * 0.12) * tapeDamage * tapeNoise;"," base.rgb = mix(base.rgb, clamp(tapeColor, 0.0, 1.0), tapeDamage);"," }"," float chromaBleed = clamp(u_chromaBleed, 0.0, 1.0);"," if (chromaBleed > 0.0) {"," float radius = mix(1.0, 4.0, chromaBleed);"," vec2 stepUv = vec2(texelX * radius, 0.0);"," vec3 c0 = base.rgb;"," vec3 c1 = samplePrepared(tapeUv - stepUv).rgb;"," vec3 c2 = samplePrepared(tapeUv + stepUv).rgb;"," vec3 c3 = samplePrepared(tapeUv - stepUv * 2.0).rgb;"," vec3 c4 = samplePrepared(tapeUv + stepUv * 2.0).rgb;"," float centerLuma = lumaOf(base.rgb);"," vec3 blurredChroma = ((c0 - vec3(lumaOf(c0))) * 6.0 + (c1 - vec3(lumaOf(c1))) * 4.0 + (c2 - vec3(lumaOf(c2))) * 4.0 + (c3 - vec3(lumaOf(c3))) + (c4 - vec3(lumaOf(c4)))) / 16.0;"," base.rgb = mix(base.rgb, clamp(vec3(centerLuma) + blurredChroma, 0.0, 1.0), chromaBleed);"," }"," return base;","}","vec4 sampleChromaticMedia(vec2 uv, vec4 center){"," float amount = clamp(u_chromaticAberration, 0.0, 1.0);"," if (amount <= 0.0) return center;"," float angle = clamp(u_chromaticAngle, 0.0, 1.0) * PI * 2.0;"," vec2 offset = vec2(cos(angle), sin(angle)) * amount * 0.02;"," vec4 positive = sampleMedia(uv + offset);"," vec4 negative = sampleMedia(uv - offset);"," vec3 split = vec3(positive.r, center.g, negative.b);"," return vec4(split, center.a);","}","vec3 sampleDigitalSplit(vec2 uv, vec2 block, float time, float amount){"," float split = amount * 0.06;"," float direction = digitalHash(block * 0.4 + vec2(floor(time * 3.7), floor(time * 5.3)));"," vec2 axis = direction > 0.66 ? vec2(1.0, 0.0) : direction > 0.33 ? vec2(0.0, 1.0) : vec2(0.7071);"," vec4 center = sampleMedia(uv);"," return vec3(sampleMedia(uv + axis * split).r, center.g, sampleMedia(uv - axis * split).b);","}","vec3 applyDigitalGlitch(vec2 uv, vec3 source){"," float amount = clamp(u_digitalGlitch, 0.0, 1.0);"," if (amount <= 0.0) return source;"," float colorSplit = clamp(u_digitalGlitchColorSplit, 0.0, 1.0) * 2.0;"," float lineTear = clamp(u_digitalGlitchLineTear, 0.0, 1.0) * 2.0;"," float pixelate = clamp(u_digitalGlitchPixelate, 0.0, 1.0) * 2.0;"," float blockAmount = clamp(u_digitalGlitchBlockAmount, 0.0, 1.0);"," float blockDisplacement = clamp(u_digitalGlitchBlockDisplacement, 0.0, 1.0) * 2.0;"," float blockOpacity = clamp(u_digitalGlitchBlockOpacity, 0.0, 1.0);"," float speed = clamp(u_digitalGlitchSpeed, 0.0, 1.0) * 2.0;"," float time = u_effectTime * speed;"," float blockCount = 8.0 + blockAmount * 60.0;"," vec2 block = floor(uv * blockCount);"," float randomA = digitalHash(block + vec2(floor(time * 7.3), floor(time * 11.1)));"," float randomB = digitalHash(block * 0.7 + vec2(17.3 + floor(time * 6.6), 29.1));"," float randomC = digitalHash(block + vec2(floor(time * 5.7) * 13.0, 41.0));"," float randomD = digitalHash(block * 1.3 + vec2(7.0, floor(time * 3.2) * 7.0));"," vec2 displaced = uv;"," if (blockDisplacement > 0.0 && blockOpacity > 0.0) {"," float threshold = 1.0 - blockDisplacement * 0.4;"," if (randomA > threshold) {"," displaced += vec2((randomB - 0.5) * blockDisplacement * 0.5, (randomC - 0.5) * blockDisplacement * 0.3);"," }"," if (randomD > 0.92 && blockDisplacement > 0.5) {"," displaced.x += (digitalHash(vec2(block.y, floor(time * 8.0))) - 0.5) * blockDisplacement;"," }"," displaced = mix(uv, displaced, blockOpacity);"," }"," if (lineTear > 0.0) {"," float row = floor(uv.y * (50.0 + lineTear * 150.0));"," float tearA = digitalHash(vec2(row * 7.3 + floor(time * 12.0 + row * 0.1) * 3.7, 13.0));"," float tearB = digitalHash(vec2(row * 13.7 + floor(time * 8.3) * 5.1, 31.0));"," if (tearA > 1.0 - lineTear * 0.5) displaced.x += (tearB - 0.5) * lineTear * 0.4;"," if (tearB > 0.95 && lineTear > 0.3) displaced.x += (tearA - 0.5) * lineTear * 0.8;"," }"," if (pixelate > 0.0) {"," float pixelRandom = digitalHash(block * 0.5 + vec2(floor(time * 4.9), 53.0));"," if (pixelRandom > 1.0 - pixelate * 0.35) {"," float cells = 4.0 + (1.0 - pixelRandom) * pixelate * 40.0;"," displaced = (floor(clampUv(displaced) * cells) + 0.5) / cells;"," }"," }"," displaced = clampUv(displaced);"," vec3 glitch = sampleDigitalSplit(displaced, block, time, colorSplit);"," if (blockDisplacement > 0.2 && blockOpacity > 0.0) {"," float corruption = digitalHash(block * 1.1 + vec2(floor(time * 11.9), 67.0));"," vec3 changed = glitch;"," if (corruption > 0.9) changed = 1.0 - glitch;"," else if (corruption > 0.85) changed = corruption > 0.875 ? glitch.gbr : glitch.brg;"," else if (corruption > 0.8) {"," float channel = digitalHash(block + vec2(73.0));"," if (channel > 0.66) changed.r = min(changed.r * 2.0, 1.0);"," else if (channel > 0.33) changed.g = min(changed.g * 2.0, 1.0);"," else changed.b = min(changed.b * 2.0, 1.0);"," }"," glitch = mix(glitch, changed, blockOpacity);"," }"," if (blockOpacity > 0.0) {"," float flash = digitalHash(block * 0.8 + vec2(floor(time * 14.7), 83.0));"," vec3 flashed = flash > 0.97 ? min(glitch * 1.8, vec3(1.0)) : flash > 0.94 ? glitch * 0.3 : glitch;"," glitch = mix(glitch, flashed, blockOpacity * 0.6);"," }"," if (lineTear > 0.1) {"," float interference = pow(sin(uv.y * (300.0 + randomA * 200.0) + time * 30.0) * 0.5 + 0.5, 6.0);"," glitch -= interference * 0.08 * lineTear;"," }"," return mix(source, clamp(glitch, 0.0, 1.0), amount);","}","float dustMask(vec2 uv, float frameBucket){"," vec2 grid = vec2(128.0, 72.0);"," vec2 cell = floor(uv * grid);"," vec2 local = fract(uv * grid) - 0.5;"," float chance = grainHash(cell + frameBucket * 19.13);"," float radius = mix(0.05, 0.34, grainHash(cell + 7.1));"," return step(0.9975, chance) * (1.0 - smoothstep(radius, radius + 0.08, length(local)));","}","float screenDot(vec2 p, float ink, float angle, float sharpness){"," float c = cos(angle);"," float s = sin(angle);"," vec2 q = mat2(c, -s, s, c) * p;"," vec2 d = fract(q) - 0.5;"," float radius = sqrt(clamp(ink, 0.0, 1.0)) * 0.68;"," float edge = mix(0.16, 0.025, sharpness);"," return 1.0 - smoothstep(radius - edge, radius + edge, length(d));","}","vec3 paletteColor(float index);","float monoScreenMask(vec2 local, float radius, float shape, float softness){"," vec2 centered = local - 0.5;"," float distanceToInk = length(centered);"," if (shape > 0.5 && shape < 1.5) distanceToInk = max(abs(centered.x), abs(centered.y));"," if (shape > 1.5 && shape < 2.5) distanceToInk = abs(centered.x) + abs(centered.y);"," if (shape > 2.5 && shape < 3.5) distanceToInk = max(abs(centered.x) * 0.86 + centered.y * 0.5, -centered.y);"," if (shape > 3.5) distanceToInk = abs(centered.y);"," float shapeRadius = shape > 3.5 ? radius * 0.45 : radius;"," return 1.0 - smoothstep(shapeRadius, shapeRadius + softness, distanceToInk);","}","vec3 applyMonoScreen(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float invert = step(0.5, u_monoScreenInvert);"," float coverage = mix(1.0 - lumaOf(source), lumaOf(source), invert);"," coverage = pow(clamp(coverage, 0.0, 1.0), mix(1.7, 0.58, clamp(u_monoScreenSpread, 0.0, 1.0)));"," float scale = max(min(u_resolution.x, u_resolution.y) / 540.0, 0.25);"," float cellPx = mix(4.0, 18.0, clamp(u_monoScreenSize, 0.0, 1.0)) * scale;"," float angle = clamp(u_monoScreenAngle, 0.0, 1.0) * PI * 0.5;"," float cosine = cos(angle);"," float sine = sin(angle);"," vec2 point = mat2(cosine, -sine, sine, cosine) * gl_FragCoord.xy / max(cellPx, 1.0);"," float radius = sqrt(coverage) * 0.68;"," float inkMask = monoScreenMask(fract(point), radius, floor(u_monoScreenShape + 0.5), 0.035);"," vec3 ink = paletteColor(0.0);"," vec3 paper = paletteColor(max(u_paletteSize - 1.0, 1.0));"," return mix(source, mix(paper, ink, inkMask), amount);","}","vec3 applyEngraving(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float spacing = mix(3.0, 20.0, clamp(u_engravingSpacing, 0.0, 1.0));"," float minThickness = mix(0.0, 2.0, clamp(u_engravingMinThickness, 0.0, 1.0));"," float maxThickness = mix(1.0, 8.0, clamp(u_engravingMaxThickness, 0.0, 1.0));"," float angle = clamp(u_engravingAngle, 0.0, 1.0) * PI;"," vec2 alongAxis = vec2(cos(angle), sin(angle));"," vec2 acrossAxis = vec2(-alongAxis.y, alongAxis.x);"," float along = dot(gl_FragCoord.xy, alongAxis);"," float across = dot(gl_FragCoord.xy, acrossAxis);"," float frequency = mix(1.0, 10.0, clamp(u_engravingWaveFrequency, 0.0, 1.0));"," float wave = sin(along * frequency * 0.01);"," across += wave * clamp(u_engravingWave, 0.0, 1.0) * 3.0;"," float lineIndex = floor(across / max(spacing, 1.0));"," float lineDistance = abs(fract(across / max(spacing, 1.0)) - 0.5) * spacing;"," float contrast = mix(0.5, 2.0, clamp(u_engravingContrast, 0.0, 1.0));"," float darkness = 1.0 - pow(clamp(lumaOf(source), 0.0, 1.0), contrast);"," float variation = mix(0.88, 1.12, digitalHash(vec2(lineIndex, 73.0)));"," float thickness = mix(minThickness, maxThickness, darkness) * variation;"," float edge = mix(1.0, 0.3, clamp(u_engravingSharpness, 0.0, 1.0));"," float inkMask = 1.0 - smoothstep(max(thickness * 0.5 - edge, 0.0), thickness * 0.5 + edge, lineDistance);"," inkMask *= smoothstep(0.015, 0.12, darkness);"," vec3 ink = paletteColor(0.0);"," vec3 paper = paletteColor(max(u_paletteSize - 1.0, 1.0));"," return mix(source, mix(paper, ink, inkMask), amount);","}","float crosshatchLine(vec2 pixel, float angle, float spacing, float thickness, float seed){"," vec2 alongAxis = vec2(cos(angle), sin(angle));"," vec2 acrossAxis = vec2(-alongAxis.y, alongAxis.x);"," float along = dot(pixel, alongAxis);"," float across = dot(pixel, acrossAxis);"," float frequency = mix(1.0, 10.0, clamp(u_crosshatchWaveFrequency, 0.0, 1.0));"," across += sin(along * frequency * 0.02 + u_effectTime + seed) * clamp(u_crosshatchWave, 0.0, 1.0) * 5.0;"," float lineIndex = floor(across / max(spacing, 1.0));"," float distanceToLine = abs(fract(across / max(spacing, 1.0)) - 0.5) * spacing;"," float variation = mix(1.0, 0.5 + digitalHash(vec2(lineIndex, seed)), clamp(u_crosshatchLineWeight, 0.0, 1.0));"," float halfWidth = thickness * variation * 0.5;"," return 1.0 - smoothstep(max(halfWidth - 0.5, 0.0), halfWidth + 0.5, distanceToLine);","}","float crosshatchEdge(vec2 uv){"," vec2 texel = 1.0 / max(u_resolution * u_uvScale, vec2(1.0));"," float tl = lumaOf(sampleMedia(uv + texel * vec2(-1.0, -1.0)).rgb);"," float tc = lumaOf(sampleMedia(uv + texel * vec2( 0.0, -1.0)).rgb);"," float tr = lumaOf(sampleMedia(uv + texel * vec2( 1.0, -1.0)).rgb);"," float ml = lumaOf(sampleMedia(uv + texel * vec2(-1.0, 0.0)).rgb);"," float mr = lumaOf(sampleMedia(uv + texel * vec2( 1.0, 0.0)).rgb);"," float bl = lumaOf(sampleMedia(uv + texel * vec2(-1.0, 1.0)).rgb);"," float bc = lumaOf(sampleMedia(uv + texel * vec2( 0.0, 1.0)).rgb);"," float br = lumaOf(sampleMedia(uv + texel * vec2( 1.0, 1.0)).rgb);"," float gx = -tl - 2.0 * ml - bl + tr + 2.0 * mr + br;"," float gy = -tl - 2.0 * tc - tr + bl + 2.0 * bc + br;"," return length(vec2(gx, gy));","}","vec3 applyCrosshatch(vec2 uv, vec3 source, float amount){"," if (amount <= 0.0) return source;"," float spacing = mix(5.0, 30.0, clamp(u_crosshatchSpacing, 0.0, 1.0));"," float thickness = mix(1.0, 5.0, clamp(u_crosshatchThickness, 0.0, 1.0));"," float baseAngle = -clamp(u_crosshatchAngle, 0.0, 1.0) * PI;"," float contrast = mix(0.5, 2.0, clamp(u_crosshatchContrast, 0.0, 1.0));"," float darkness = 1.0 - pow(clamp(lumaOf(source), 0.0, 1.0), contrast);"," vec3 ink = paletteColor(0.0);"," vec3 paper = paletteColor(max(u_paletteSize - 1.0, 1.0));"," vec3 result = paper;"," float layer = crosshatchLine(gl_FragCoord.xy, baseAngle, spacing, thickness, 1.0) * smoothstep(0.2, 0.4, darkness);"," result = mix(result, ink, layer);"," layer = crosshatchLine(gl_FragCoord.xy, baseAngle + PI * 0.5, spacing * 0.95, thickness * 0.9, 2.0) * smoothstep(0.4, 0.6, darkness);"," result = mix(result, ink, layer);"," layer = crosshatchLine(gl_FragCoord.xy, baseAngle + PI * 0.25, spacing * 0.9, thickness * 0.8, 3.0) * smoothstep(0.6, 0.8, darkness);"," result = mix(result, ink, layer);"," layer = crosshatchLine(gl_FragCoord.xy, baseAngle - PI * 0.25, spacing * 0.85, thickness * 0.7, 4.0) * smoothstep(0.75, 0.9, darkness);"," result = mix(result, ink, layer);"," result = mix(result, ink, smoothstep(0.9, 1.0, darkness) * 0.8);"," float edgeStrength = mix(0.0, 2.0, clamp(u_crosshatchEdges, 0.0, 1.0));"," float edge = smoothstep(0.1, 0.3, crosshatchEdge(uv)) * edgeStrength;"," result = mix(result, ink, clamp(edge, 0.0, 1.0));"," return mix(source, result, amount);","}","vec3 applyHalftone(vec3 source, float amount){"," if (amount <= 0.0) return source;"," vec3 cmy = 1.0 - source;"," float k = min(cmy.r, min(cmy.g, cmy.b));"," vec3 inks = max(cmy - vec3(k * 0.72), 0.0);"," float scale = min(u_resolution.x, u_resolution.y) / 540.0;"," float cellPx = mix(5.0, 14.0, clamp(u_halftoneSize, 0.0, 1.0)) * max(scale, 0.25);"," vec2 p = gl_FragCoord.xy / max(cellPx, 1.0);"," float cyan = screenDot(p, inks.r, 0.261799, 0.78);"," float magenta = screenDot(p, inks.g, 1.308997, 0.78);"," float yellow = screenDot(p, inks.b, 0.0, 0.78);"," float blackInk = screenDot(p, k, 0.785398, 0.82);"," vec3 printColor = vec3(0.975, 0.962, 0.925);"," printColor *= mix(vec3(1.0), vec3(0.05, 0.79, 0.86), cyan);"," printColor *= mix(vec3(1.0), vec3(0.91, 0.08, 0.48), magenta);"," printColor *= mix(vec3(1.0), vec3(0.98, 0.83, 0.08), yellow);"," printColor *= mix(vec3(1.0), vec3(0.035), blackInk * 0.92);"," return mix(source, printColor, amount);","}","vec3 applyTwoInkPrint(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float sourceLuma = lumaOf(source);"," float darkness = 1.0 - sourceLuma;"," float warmBias = clamp(source.r - (source.g + source.b) * 0.5, -0.35, 0.35);"," float coolBias = clamp((source.g + source.b) * 0.5 - source.r, -0.35, 0.35);"," float redTone = smoothstep(0.08, 0.72, darkness) * (1.0 - 0.68 * smoothstep(0.66, 1.0, darkness));"," float tealTone = smoothstep(0.30, 0.92, darkness);"," float redCoverage = clamp(redTone + warmBias * 1.35 - coolBias * 0.35, 0.0, 1.0);"," float tealCoverage = clamp(tealTone + coolBias * 1.1 - warmBias * 0.45, 0.0, 1.0);"," float scale = min(u_resolution.x, u_resolution.y) / 540.0;"," float cellPx = mix(4.5, 12.0, clamp(u_twoInkPrintSize, 0.0, 1.0)) * max(scale, 0.25);"," vec2 p = gl_FragCoord.xy / max(cellPx, 1.0);"," float redDot = screenDot(p, redCoverage, 0.261799, 0.84);"," float tealDot = screenDot(p + vec2(0.12, -0.08), tealCoverage, 1.308997, 0.84);"," float paperNoise = grainHash(floor(gl_FragCoord.xy * 0.5)) - 0.5;"," vec3 paper = vec3(0.955, 0.910, 0.795) + paperNoise * 0.018;"," vec3 vermilion = vec3(0.88, 0.13, 0.075);"," vec3 teal = vec3(0.035, 0.285, 0.355);"," vec3 overprint = vec3(0.045, 0.055, 0.052);"," vec3 printColor = paper * (1.0 - redDot) * (1.0 - tealDot);"," printColor += vermilion * redDot * (1.0 - tealDot);"," printColor += teal * (1.0 - redDot) * tealDot;"," printColor += overprint * redDot * tealDot;"," return mix(source, clamp(printColor, 0.0, 1.0), amount);","}","vec3 paletteColor(float index){"," if (index < 0.5) return u_palette0;"," if (index < 1.5) return u_palette1;"," if (index < 2.5) return u_palette2;"," if (index < 3.5) return u_palette3;"," if (index < 4.5) return u_palette4;"," return u_palette5;","}","float bayer4(vec2 point){"," vec2 cell = mod(floor(point), 4.0);"," if (cell.y < 0.5) {"," if (cell.x < 0.5) return 0.5 / 16.0;"," if (cell.x < 1.5) return 8.5 / 16.0;"," if (cell.x < 2.5) return 2.5 / 16.0;"," return 10.5 / 16.0;"," }"," if (cell.y < 1.5) {"," if (cell.x < 0.5) return 12.5 / 16.0;"," if (cell.x < 1.5) return 4.5 / 16.0;"," if (cell.x < 2.5) return 14.5 / 16.0;"," return 6.5 / 16.0;"," }"," if (cell.y < 2.5) {"," if (cell.x < 0.5) return 3.5 / 16.0;"," if (cell.x < 1.5) return 11.5 / 16.0;"," if (cell.x < 2.5) return 1.5 / 16.0;"," return 9.5 / 16.0;"," }"," if (cell.x < 0.5) return 15.5 / 16.0;"," if (cell.x < 1.5) return 7.5 / 16.0;"," if (cell.x < 2.5) return 13.5 / 16.0;"," return 5.5 / 16.0;","}","float standardAsciiSample(float brightness, vec2 grid){"," if (brightness < 0.1) return 0.0;"," if (brightness < 0.2) return grid.x == 2.0 && grid.y == 5.0 ? 1.0 : 0.0;"," if (brightness < 0.3) return grid.x == 2.0 && (grid.y == 2.0 || grid.y == 4.0) ? 1.0 : 0.0;"," if (brightness < 0.4) return (grid.y == 2.0 || grid.y == 4.0) && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.5) {"," bool cross = (grid.x == 2.0 && grid.y >= 2.0 && grid.y <= 4.0) || (grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0);"," bool diagonals = (grid.x == 1.0 || grid.x == 3.0) && (grid.y == 2.0 || grid.y == 4.0);"," return cross || diagonals ? 1.0 : 0.0;"," }"," if (brightness < 0.6) {"," bool ring = ((grid.y == 2.0 || grid.y == 4.0) && grid.x >= 1.0 && grid.x <= 3.0) || ((grid.x == 1.0 || grid.x == 3.0) && grid.y == 3.0);"," return ring ? 1.0 : 0.0;"," }"," bool outline = ((grid.y == 1.0 || grid.y == 5.0) && grid.x >= 1.0 && grid.x <= 3.0) || ((grid.x == 0.0 || grid.x == 4.0) && grid.y >= 2.0 && grid.y <= 4.0) || ((grid.x == 1.0 || grid.x == 3.0) && grid.y >= 1.0 && grid.y <= 5.0);"," if (brightness < 0.7) return outline ? 1.0 : 0.0;"," if (brightness < 0.8) {"," bool slash = abs(grid.x - 2.0) == abs(grid.y - 3.0) && grid.x >= 1.0 && grid.x <= 3.0;"," return outline || slash ? 1.0 : 0.0;"," }"," if (brightness < 0.9) {"," bool loops = ((grid.y == 1.0 || grid.y == 3.0 || grid.y == 5.0) && grid.x >= 1.0 && grid.x <= 3.0) || ((grid.x == 1.0 || grid.x == 3.0) && (grid.y == 2.0 || grid.y == 4.0));"," return loops ? 1.0 : 0.0;"," }"," return 1.0;","}","float asciiStyleSample(float style, float brightness, vec2 uv){"," vec2 grid = floor(uv * vec2(5.0, 7.0));"," if (style < 0.5) return standardAsciiSample(brightness, grid);"," if (style < 1.5) {"," float checker = mod(grid.x + grid.y, 2.0);"," float ruled = mod(grid.x, 2.0) == 0.0 || mod(grid.y, 2.0) == 0.0 ? 1.0 : 0.0;"," if (brightness < 0.125) return 0.0;"," if (brightness < 0.25) return checker == 0.0 ? 0.5 : 0.0;"," if (brightness < 0.375) return ruled * 0.6;"," if (brightness < 0.5) return checker == 0.0 ? 1.0 : 0.0;"," if (brightness < 0.625) return ruled > 0.5 ? 1.0 : 0.3;"," if (brightness < 0.75) return checker == 0.0 ? 1.0 : 0.7;"," if (brightness < 0.875) return ruled > 0.5 ? 1.0 : 0.85;"," return 1.0;"," }"," if (style < 2.5) {"," if (brightness < 0.14) return 0.0;"," if (brightness < 0.28) return grid.x == 2.0 && grid.y == 1.0 ? 1.0 : 0.0;"," if (brightness < 0.42) return grid.x == 2.0 && grid.y == 5.0 ? 1.0 : 0.0;"," if (brightness < 0.56) return grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.7) return (grid.x == 2.0 && grid.y >= 2.0 && grid.y <= 4.0) || (grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0) ? 1.0 : 0.0;"," if (brightness < 0.84) return abs(grid.x - 2.0) == abs(grid.y - 3.0) && grid.y >= 2.0 && grid.y <= 4.0 ? 1.0 : 0.0;"," return grid.x == 1.0 || grid.x == 3.0 || grid.y == 2.0 || grid.y == 4.0 ? 1.0 : 0.0;"," }"," if (style < 3.5) return grid.y >= 6.0 - brightness * 7.0 ? 1.0 : 0.0;"," if (style < 4.5) {"," vec2 dots = floor(uv * vec2(2.0, 4.0));"," if (brightness < 0.125) return 0.0;"," if (brightness < 0.25) return dots.y == 3.0 ? 1.0 : 0.0;"," if (brightness < 0.375) return dots.y >= 2.0 ? 1.0 : 0.0;"," if (brightness < 0.5) return dots.y >= 1.0 ? 1.0 : 0.0;"," if (brightness < 0.625) return dots.y >= 1.0 || dots.x == 1.0 ? 1.0 : 0.0;"," if (brightness < 0.75) return 1.0;"," if (brightness < 0.875) return mod(grid.x + grid.y, 2.0) < 1.5 ? 1.0 : 0.7;"," return 1.0;"," }"," if (style < 5.5) {"," if (brightness < 0.125) return 0.0;"," if (brightness < 0.25) return grid.x == 2.0 && grid.y == 3.0 ? 1.0 : 0.0;"," if (brightness < 0.375) return grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.5) return grid.x + grid.y == 5.0 || grid.x + grid.y == 6.0 ? 1.0 : 0.0;"," if (brightness < 0.625) return grid.x == 2.0 ? 1.0 : 0.0;"," if (brightness < 0.75) return abs(grid.x - grid.y / 1.4) < 0.7 && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.875) return grid.x == 2.0 || grid.y == 3.0 ? 1.0 : 0.0;"," return grid.x == 1.0 || grid.x == 3.0 || grid.y == 2.0 || grid.y == 4.0 ? 1.0 : 0.0;"," }"," if (style < 6.5) {"," bool top = grid.y == 0.0 && grid.x >= 1.0 && grid.x <= 3.0;"," bool topLeft = grid.x == 1.0 && grid.y <= 3.0;"," bool topRight = grid.x == 3.0 && grid.y <= 3.0;"," bool middle = grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0;"," bool bottomLeft = grid.x == 1.0 && grid.y >= 3.0;"," bool bottomRight = grid.x == 3.0 && grid.y >= 3.0;"," bool bottom = grid.y == 6.0 && grid.x >= 1.0 && grid.x <= 3.0;"," if (brightness < 0.1) return 0.0;"," if (brightness < 0.2) return topRight || bottomRight ? 1.0 : 0.0;"," if (brightness < 0.3) return top || topRight || middle || bottomLeft || bottom ? 1.0 : 0.0;"," if (brightness < 0.4) return top || topRight || middle || bottomRight || bottom ? 1.0 : 0.0;"," if (brightness < 0.5) return topLeft || middle || topRight || bottomRight ? 1.0 : 0.0;"," if (brightness < 0.6) return top || topLeft || middle || bottomRight || bottom ? 1.0 : 0.0;"," if (brightness < 0.7) return top || topLeft || middle || bottomLeft || bottomRight || bottom ? 1.0 : 0.0;"," if (brightness < 0.8) return top || topRight || bottomRight ? 1.0 : 0.0;"," if (brightness < 0.9) return top || topLeft || topRight || middle || bottomLeft || bottomRight || bottom ? 1.0 : 0.0;"," return top || topLeft || topRight || middle || bottomRight || bottom ? 1.0 : 0.0;"," }"," float slash = grid.x - grid.y;"," float backslash = grid.x + grid.y;"," if (brightness < 0.16) return 0.0;"," if (brightness < 0.33) return mod(slash, 3.0) < 0.5 ? 1.0 : 0.0;"," if (brightness < 0.5) return mod(slash, 2.0) < 0.5 ? 1.0 : 0.0;"," bool diagonalA = mod(slash, 2.0) < 0.5;"," bool diagonalB = mod(backslash, 2.0) < 0.5;"," if (brightness < 0.66) return diagonalA || diagonalB ? 1.0 : 0.0;"," if (brightness < 0.83) return mod(slash, 1.5) < 0.5 || mod(backslash, 1.5) < 0.5 ? 1.0 : 0.2;"," return mod(slash, 1.0) < 0.6 || mod(backslash, 1.0) < 0.6 ? 1.0 : 0.5;","}","vec3 rgbToHsv(vec3 color){"," float maximum = max(max(color.r, color.g), color.b);"," float minimum = min(min(color.r, color.g), color.b);"," float delta = maximum - minimum;"," float hue = 0.0;"," if (delta > 0.00001) {"," if (maximum == color.r) hue = mod((color.g - color.b) / delta, 6.0);"," else if (maximum == color.g) hue = (color.b - color.r) / delta + 2.0;"," else hue = (color.r - color.g) / delta + 4.0;"," hue = fract(hue / 6.0);"," }"," return vec3(hue, maximum > 0.00001 ? delta / maximum : 0.0, maximum);","}","vec3 hsvToRgb(vec3 color){"," vec3 bands = abs(fract(color.xxx + vec3(0.0, 0.6666667, 0.3333333)) * 6.0 - 3.0);"," return color.z * mix(vec3(1.0), clamp(bands - 1.0, 0.0, 1.0), color.y);","}","vec4 sampleAdvancedCurve(float coordinate, float row){",` float position = clamp(coordinate, 0.0, 1.0) * ${ed};`," float lower = floor(position);",` float upper = min(lower + 1.0, ${ed});`,` float y = (row + 0.5) / ${Zg};`,` vec4 before = texture2D(u_advanced, vec2((lower + 0.5) / ${ba}, y));`,` vec4 after = texture2D(u_advanced, vec2((upper + 0.5) / ${ba}, y));`," return mix(before, after, position - lower);","}","vec4 advancedConfig(float index){",` return texture2D(u_advanced, vec2((index + 0.5) / ${ba}, ${eb}));`,"}","vec3 wheelDirection(float hue){"," vec3 direction = hsvToRgb(vec3(fract(hue), 1.0, 1.0));"," direction -= vec3(lumaOf(direction));"," return direction / max(max(max(abs(direction.r), abs(direction.g)), abs(direction.b)), 0.0001);","}","vec3 applyTonalWheels(vec3 color){"," float luma = lumaOf(color);"," float shadows = 1.0 - smoothstep(0.0, 0.6, luma);"," float highlights = smoothstep(0.4, 1.0, luma);"," float midtones = max(0.0, 1.0 - shadows - highlights);"," float total = max(shadows + midtones + highlights, 0.0001);"," vec3 weights = vec3(shadows, midtones, highlights) / total;"," color += wheelDirection(u_shadowWheel.x) * u_shadowWheel.y * weights.x * 0.18;"," color += wheelDirection(u_midtoneWheel.x) * u_midtoneWheel.y * weights.y * 0.18;"," color += wheelDirection(u_highlightWheel.x) * u_highlightWheel.y * weights.z * 0.18;"," color += u_shadowWheel.z * weights.x * 0.25;"," color += u_midtoneWheel.z * weights.y * 0.25;"," color += u_highlightWheel.z * weights.z * 0.25;"," return color;","}","vec3 applyRgbCurves(vec3 color){"," if (u_rgbCurvesEnabled < 0.5) return color;"," vec3 master = vec3("," sampleAdvancedCurve(color.r, 0.0).a,"," sampleAdvancedCurve(color.g, 0.0).a,"," sampleAdvancedCurve(color.b, 0.0).a"," );"," return vec3("," sampleAdvancedCurve(master.r, 0.0).r,"," sampleAdvancedCurve(master.g, 0.0).g,"," sampleAdvancedCurve(master.b, 0.0).b"," );","}","float decodeSigned(float value){ return (value * 255.0 - 128.0) / 127.0; }","vec3 applyHueCurves(vec3 color){"," if (u_hueCurvesEnabled < 0.5) return color;"," vec3 hsv = rgbToHsv(clamp(color, 0.0, 1.0));"," vec3 curves = sampleAdvancedCurve(hsv.x, 1.0).rgb;"," float originalLuma = lumaOf(color);"," hsv.x = fract(hsv.x + decodeSigned(curves.r) * 0.5);"," hsv.y = clamp(hsv.y * max(0.0, 1.0 + decodeSigned(curves.g)), 0.0, 1.0);"," vec3 shifted = hsvToRgb(hsv);"," shifted += vec3(originalLuma - lumaOf(shifted) + decodeSigned(curves.b));"," return shifted;","}","float softRangeMask(float value, float minimum, float maximum, float softness){"," if (value < minimum) {"," if (softness <= 0.0) return 0.0;"," return smoothstep(minimum - softness, minimum, value);"," }"," if (value > maximum) {"," if (softness <= 0.0) return 0.0;"," return 1.0 - smoothstep(maximum, maximum + softness, value);"," }"," return 1.0;","}","float hueRangeMask(float hue, float saturation, vec3 key){"," float distance = abs(fract(hue - key.x + 0.5) - 0.5) * 360.0;"," float range = key.y * 180.0;"," float softness = key.z * 180.0;"," if (range < 179.999 && saturation < 0.001) return 0.0;"," if (distance <= range) return 1.0;"," if (softness <= 0.0) return 0.0;"," return 1.0 - smoothstep(range, range + softness, distance);","}","vec3 applySecondary(vec3 color, float index){"," float base = index * 5.0;"," vec4 hueKey = advancedConfig(base);"," vec4 saturationKey = advancedConfig(base + 1.0);"," vec4 lumaKey = advancedConfig(base + 2.0);"," vec4 correction = advancedConfig(base + 3.0);"," vec4 tintCorrection = advancedConfig(base + 4.0);"," vec3 hsv = rgbToHsv(clamp(color, 0.0, 1.0));"," float luma = lumaOf(color);"," float mask = hueRangeMask(hsv.x, hsv.y, hueKey.rgb);"," mask *= softRangeMask(hsv.y, saturationKey.x, saturationKey.y, saturationKey.z * 0.5);"," mask *= softRangeMask(luma, lumaKey.x, lumaKey.y, lumaKey.z * 0.5);"," if (mask <= 0.0) return color;"," hsv.x = fract(hsv.x + decodeSigned(correction.x) * 0.5);"," vec3 corrected = hsvToRgb(hsv);"," float correctedLuma = lumaOf(corrected);"," corrected = mix(vec3(correctedLuma), corrected, max(0.0, 1.0 + decodeSigned(correction.y)));"," corrected += vec3(decodeSigned(correction.z));"," float temperature = decodeSigned(correction.w);"," float tint = decodeSigned(tintCorrection.x);"," corrected.r += temperature * 0.08 + tint * 0.04;"," corrected.b -= temperature * 0.08 - tint * 0.04;"," corrected.g -= tint * 0.08;"," return mix(color, corrected, mask);","}","vec3 applyAdvancedGrade(vec3 color){"," color = applyTonalWheels(color);"," color = applyRgbCurves(color);"," color = applyHueCurves(color);"," if (u_secondaryCount > 0.5) color = applySecondary(color, 0.0);"," if (u_secondaryCount > 1.5) color = applySecondary(color, 1.0);"," if (u_secondaryCount > 2.5) color = applySecondary(color, 2.0);"," if (u_secondaryCount > 3.5) color = applySecondary(color, 3.0);"," return color;","}","vec3 sampleLut(float r, float g, float b){"," float size = max(u_lutSize, 2.0);"," float x = (r + b * size + 0.5) / max(u_lutTextureSize.x, 1.0);"," float y = (g + 0.5) / max(u_lutTextureSize.y, 1.0);"," return texture2D(u_lut, vec2(x, y)).rgb;","}","vec3 applyLut(vec3 color){"," if (u_lutEnabled < 0.5) return color;"," float size = max(u_lutSize, 2.0);"," vec3 span = max(u_lutDomainMax - u_lutDomainMin, vec3(0.00001));"," vec3 scaled = clamp((color - u_lutDomainMin) / span, 0.0, 1.0) * (size - 1.0);"," vec3 lo = floor(scaled);"," vec3 hi = min(lo + 1.0, vec3(size - 1.0));"," vec3 f = scaled - lo;"," vec3 c000 = sampleLut(lo.r, lo.g, lo.b);"," vec3 c100 = sampleLut(hi.r, lo.g, lo.b);"," vec3 c010 = sampleLut(lo.r, hi.g, lo.b);"," vec3 c110 = sampleLut(hi.r, hi.g, lo.b);"," vec3 c001 = sampleLut(lo.r, lo.g, hi.b);"," vec3 c101 = sampleLut(hi.r, lo.g, hi.b);"," vec3 c011 = sampleLut(lo.r, hi.g, hi.b);"," vec3 c111 = sampleLut(hi.r, hi.g, hi.b);"," vec3 c00 = mix(c000, c100, f.r);"," vec3 c10 = mix(c010, c110, f.r);"," vec3 c01 = mix(c001, c101, f.r);"," vec3 c11 = mix(c011, c111, f.r);"," vec3 c0 = mix(c00, c10, f.g);"," vec3 c1 = mix(c01, c11, f.g);"," vec3 lutColor = mix(c0, c1, f.b);"," return mix(color, lutColor, clamp(u_lutIntensity, 0.0, 1.0));","}","vec3 applyPrimaryGrade(vec3 color){"," color *= pow(2.0, u_exposure);"," float y = lumaOf(color);"," float shadowMask = 1.0 - smoothstep(0.0, 0.65, y);"," float highlightMask = smoothstep(0.35, 1.0, y);"," color += u_shadows * 0.35 * shadowMask;"," color += u_highlights * 0.35 * highlightMask;"," float blackPoint = clamp(u_blacks * 0.18, -0.18, 0.18);"," float whitePoint = clamp(1.0 - u_whites * 0.18, 0.82, 1.18);"," color = (color - blackPoint) / max(whitePoint - blackPoint, 0.2);"," color.r += u_temperature * 0.08 + u_tint * 0.04;"," color.b -= u_temperature * 0.08 - u_tint * 0.04;"," color.g -= u_tint * 0.08;"," color = (color - 0.5) * max(0.0, 1.0 + u_contrast) + 0.5;"," float satLuma = lumaOf(color);"," float currentSat = clamp(colorSaturation(color), 0.0, 1.0);"," float skinLike = smoothstep(0.02, 0.18, color.r - color.g) * smoothstep(0.0, 0.16, color.g - color.b) * smoothstep(0.18, 0.82, satLuma);"," float vibranceWeight = (1.0 - currentSat * 0.72) * mix(1.0, 0.55, skinLike);"," color = mix(vec3(satLuma), color, max(0.0, 1.0 + u_vibrance * vibranceWeight));"," color = mix(vec3(satLuma), color, max(0.0, 1.0 + u_saturation));"," return color;","}","vec3 applyColorGrade(vec3 color){"," color = applyPrimaryGrade(color);"," color = applyAdvancedGrade(color);"," return clamp(applyLut(clamp(color, 0.0, 1.0)), 0.0, 1.0);","}","vec3 applyDither(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float scale = max(min(u_resolution.x, u_resolution.y) / 540.0, 0.25);"," float pixelSize = mix(1.0, 5.0, clamp(u_ditherSize, 0.0, 1.0)) * scale;"," vec2 block = floor(gl_FragCoord.xy / max(pixelSize, 1.0));"," float levels = clamp(u_paletteSize, 2.0, 6.0);"," float index = floor(clamp(lumaOf(source) * (levels - 1.0) + bayer4(block), 0.0, levels - 1.0));"," return mix(source, paletteColor(index), amount);","}","vec2 asciiEdgeDirection(vec2 uv, vec2 stepUv){"," float topLeft = bt601Luma(sampleMedia(uv + vec2(-stepUv.x, -stepUv.y)).rgb);"," float top = bt601Luma(sampleMedia(uv + vec2(0.0, -stepUv.y)).rgb);"," float topRight = bt601Luma(sampleMedia(uv + vec2(stepUv.x, -stepUv.y)).rgb);"," float left = bt601Luma(sampleMedia(uv + vec2(-stepUv.x, 0.0)).rgb);"," float right = bt601Luma(sampleMedia(uv + vec2(stepUv.x, 0.0)).rgb);"," float bottomLeft = bt601Luma(sampleMedia(uv + vec2(-stepUv.x, stepUv.y)).rgb);"," float bottom = bt601Luma(sampleMedia(uv + vec2(0.0, stepUv.y)).rgb);"," float bottomRight = bt601Luma(sampleMedia(uv + stepUv).rgb);"," float x = -topLeft - 2.0 * left - bottomLeft + topRight + 2.0 * right + bottomRight;"," float y = -topLeft - 2.0 * top - topRight + bottomLeft + 2.0 * bottom + bottomRight;"," return vec2(x, y);","}","vec2 rotateAsciiUv(vec2 uv, float angle){"," float cosine = cos(angle);"," float sine = sin(angle);"," vec2 centered = uv - 0.5;"," return vec2(centered.x * cosine - centered.y * sine, centered.x * sine + centered.y * cosine) + 0.5;","}","vec3 applyAscii(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float scale = max(min(u_resolution.x, u_resolution.y) / 540.0, 0.25);"," float cellHeight = mix(4.0, 80.0, clamp(u_asciiSize, 0.0, 1.0)) * scale;"," vec2 cellSize = vec2(cellHeight);"," vec2 cell = floor(gl_FragCoord.xy / cellSize);"," vec2 cellVuv = (cell + 0.5) * cellSize / max(u_resolution, vec2(1.0));"," vec2 cellUv = (cellVuv - u_uvOffset) / u_uvScale;"," cellUv = applyCrtWarp(cellUv);"," vec3 cellColor = applyColorGrade(sampleMedia(cellUv).rgb);"," float brightness = bt601Luma(cellColor);"," float invert = step(0.5, u_asciiInvert);"," brightness = mix(brightness, 1.0 - brightness, invert);"," vec2 glyphUv = fract(gl_FragCoord.xy / cellSize);"," float rotation = clamp(u_asciiRotation, 0.0, 1.0);"," if (rotation > 0.0) {"," vec2 cellStepUv = cellSize / max(u_resolution * u_uvScale, vec2(1.0));"," vec2 edge = asciiEdgeDirection(cellUv, cellStepUv);"," if (length(edge) > 0.1) glyphUv = mix(glyphUv, rotateAsciiUv(glyphUv, atan(edge.y, edge.x)), rotation);"," }"," float ink = asciiStyleSample(floor(u_asciiStyle + 0.5), brightness, glyphUv);"," vec3 background = paletteColor(0.0);"," vec3 inkColor = mix(paletteColor(max(u_paletteSize - 1.0, 1.0)), cellColor, clamp(u_asciiColor, 0.0, 1.0));"," vec3 asciiColor = mix(background, inkColor, ink);"," return mix(source, asciiColor, amount);","}","vec3 applyScanlines(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float count = mix(50.0, 500.0, clamp(u_scanlineCount, 0.0, 1.0));"," float softness = clamp(u_scanlineSoftness, 0.0, 1.0);"," float wave = 0.5 + 0.5 * sin(v_uv.y * count * PI);"," float line = mix(1.0 - wave, pow(1.0 - wave, 2.2), softness);"," return source * (1.0 - line * amount);","}","void main(){"," vec2 uv = (v_uv - u_uvOffset) / u_uvScale;"," if (uv.x < 0.0 || uv.y < 0.0 || uv.x > 1.0 || uv.y > 1.0) {"," gl_FragColor = vec4(0.0);"," return;"," }"," vec4 originalSample = sampleSource(uv);"," uv = applyCrtWarp(uv);"," vec2 displayEdge = smoothstep(vec2(0.0), vec2(0.006), uv) * (1.0 - smoothstep(vec2(0.994), vec2(1.0), uv));"," float displayMask = displayEdge.x * displayEdge.y;"," vec4 sampleColor = sampleMedia(uv);"," sampleColor = sampleChromaticMedia(uv, sampleColor);"," sampleColor.rgb = applyDigitalGlitch(uv, sampleColor.rgb);"," vec3 original = originalSample.rgb;"," vec3 color = mix(sampleColor.rgb, applyColorGrade(sampleColor.rgb), u_intensity);"," float grainAmount = clamp(u_grain, 0.0, 1.0);"," if (grainAmount > 0.0) {"," float grainPixelSize = mix(1.0, 6.0, clamp(u_grainSize, 0.0, 1.0));"," vec2 grainCoord = floor(gl_FragCoord.xy / grainPixelSize) + vec2(u_grainSeed, u_grainSeed * 1.37);"," float grainBase = grainHash(grainCoord) - grainHash(grainCoord + vec2(19.19, 73.31));"," float grainFine = grainHash(gl_FragCoord.xy + vec2(u_grainSeed * 2.11, u_grainSeed * 0.71)) - 0.5;"," float grain = mix(grainBase * 0.7, grainBase + grainFine * 0.35, clamp(u_grainRoughness, 0.0, 1.0));"," float grainLuma = lumaOf(color);"," float grainMask = smoothstep(0.02, 0.55, grainLuma) * (1.0 - smoothstep(0.88, 1.0, grainLuma));"," color += grain * grainAmount * mix(0.025, 0.08, grainMask);"," }"," float filmArtifacts = clamp(u_filmArtifacts, 0.0, 1.0);"," if (filmArtifacts > 0.0) {"," float filmFrame = floor(u_grainSeed);"," float dust = dustMask(v_uv, floor(filmFrame / 3.0));"," float dustTone = grainHash(vec2(floor(filmFrame / 3.0), 8.0));"," color = mix(color, vec3(dustTone > 0.5 ? 0.95 : 0.02), dust * 0.72 * filmArtifacts);"," float scratchBucket = floor(filmFrame / 12.0);"," float scratchX = grainHash(vec2(scratchBucket, 4.2));"," float scratchLife = step(0.78, grainHash(vec2(scratchBucket, 8.4)));"," float scratch = (1.0 - smoothstep(0.0, 1.4 / max(u_resolution.x, 1.0), abs(v_uv.x - scratchX))) * scratchLife;"," color = mix(color, vec3(0.94, 0.88, 0.76), scratch * 0.28 * filmArtifacts);"," }"," color = applyMonoScreen(clamp(color, 0.0, 1.0), clamp(u_monoScreen, 0.0, 1.0));"," color = applyEngraving(clamp(color, 0.0, 1.0), clamp(u_engraving, 0.0, 1.0));"," color = applyCrosshatch(uv, clamp(color, 0.0, 1.0), clamp(u_crosshatch, 0.0, 1.0));"," color = applyHalftone(clamp(color, 0.0, 1.0), clamp(u_halftone, 0.0, 1.0));"," color = applyTwoInkPrint(clamp(color, 0.0, 1.0), clamp(u_twoInkPrint, 0.0, 1.0));"," color = applyDither(clamp(color, 0.0, 1.0), clamp(u_dither, 0.0, 1.0));"," color = applyAscii(clamp(color, 0.0, 1.0), clamp(u_ascii, 0.0, 1.0));"," if (u_bloomReady > 0.5 && u_bloom > 0.0) color += sampleBloom(uv) * u_bloom;"," color = applyScanlines(clamp(color, 0.0, 1.0), clamp(u_scanlines, 0.0, 1.0));"," vec2 vignetteAspect = u_resolution.x > u_resolution.y"," ? vec2(u_resolution.x / max(u_resolution.y, 1.0), 1.0)"," : vec2(1.0, u_resolution.y / max(u_resolution.x, 1.0));"," vec2 vignetteUv = abs((v_uv - vec2(0.5)) * 2.0) * vignetteAspect;"," float vignettePower = mix(8.0, 1.8, clamp(u_vignetteRoundness * 0.5 + 0.5, 0.0, 1.0));"," float vignetteDistance = pow(pow(vignetteUv.x, vignettePower) + pow(vignetteUv.y, vignettePower), 1.0 / vignettePower);"," float vignetteMidpoint = mix(0.22, 1.08, clamp(u_vignetteMidpoint, 0.0, 1.0));"," float vignetteFeather = mix(0.08, 0.72, clamp(u_vignetteFeather, 0.0, 1.0));"," float vignetteMask = smoothstep(vignetteMidpoint, vignetteMidpoint + vignetteFeather, vignetteDistance);"," color *= 1.0 - vignetteMask * clamp(u_vignette, 0.0, 1.0) * 0.75;"," float warpActive = step(0.0001, u_crtCurvature);"," color *= mix(1.0, displayMask, warpActive);"," vec3 graded = clamp(color, 0.0, 1.0);"," if (u_compareEnabled > 0.5) {"," float pos = clamp(u_comparePosition, 0.0, 1.0);"," float softness = max(u_compareSoftness, 0.00001);"," float afterMask = smoothstep(pos - softness, pos + softness, v_uv.x);"," vec3 splitColor = mix(original, graded, afterMask);"," float lineMask = 0.0;"," if (u_compareLineWidth > 0.0) {"," float lineWidth = max(u_compareLineWidth / max(u_resolution.x, 1.0), 0.00001);"," lineMask = 1.0 - smoothstep(lineWidth, lineWidth * 1.8, abs(v_uv.x - pos));"," }"," gl_FragColor = vec4(mix(splitColor, vec3(1.0), lineMask * 0.82), sampleColor.a);"," return;"," }"," gl_FragColor = vec4(graded, sampleColor.a);","}"].join(`\n`),rb=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_source;","uniform vec2 u_resolution;","uniform vec2 u_direction;","uniform float u_radius;","uniform float u_bloomPass;","uniform float u_threshold;","vec4 readSource(vec2 uv){"," vec4 color = texture2D(u_source, clamp(uv, vec2(0.0), vec2(1.0)));"," if (u_bloomPass > 0.5) {"," float luminance = dot(color.rgb, vec3(0.299, 0.587, 0.114));"," if (u_threshold >= 0.0 && luminance <= u_threshold) color.rgb = vec3(0.0);"," return vec4(color.rgb, 1.0);"," }"," color.rgb *= color.a;"," return color;","}","void main(){"," if (u_bloomPass > 0.5) {"," vec2 stepUv = u_direction * max(u_radius, 0.0) / max(u_resolution, vec2(1.0)) * 0.5;"," vec4 bloom = readSource(v_uv) * 0.227027;"," bloom += readSource(v_uv + stepUv) * 0.1945946;"," bloom += readSource(v_uv - stepUv) * 0.1945946;"," bloom += readSource(v_uv + stepUv * 2.0) * 0.1216216;"," bloom += readSource(v_uv - stepUv * 2.0) * 0.1216216;"," bloom += readSource(v_uv + stepUv * 3.0) * 0.054054;"," bloom += readSource(v_uv - stepUv * 3.0) * 0.054054;"," bloom += readSource(v_uv + stepUv * 4.0) * 0.016216;"," bloom += readSource(v_uv - stepUv * 4.0) * 0.016216;"," gl_FragColor = bloom;"," return;"," }"," vec2 stepUv = u_direction * max(u_radius, 0.0) / max(u_resolution, vec2(1.0)) / 12.0;"," vec4 color = readSource(v_uv) * 0.08077993;"," color += readSource(v_uv + stepUv * 1.0) * 0.07918038;"," color += readSource(v_uv - stepUv * 1.0) * 0.07918038;"," color += readSource(v_uv + stepUv * 2.0) * 0.07456928;"," color += readSource(v_uv - stepUv * 2.0) * 0.07456928;"," color += readSource(v_uv + stepUv * 3.0) * 0.06747307;"," color += readSource(v_uv - stepUv * 3.0) * 0.06747307;"," color += readSource(v_uv + stepUv * 4.0) * 0.05865827;"," color += readSource(v_uv - stepUv * 4.0) * 0.05865827;"," color += readSource(v_uv + stepUv * 5.0) * 0.04899551;"," color += readSource(v_uv - stepUv * 5.0) * 0.04899551;"," color += readSource(v_uv + stepUv * 6.0) * 0.03931982;"," color += readSource(v_uv - stepUv * 6.0) * 0.03931982;"," color += readSource(v_uv + stepUv * 7.0) * 0.03031761;"," color += readSource(v_uv - stepUv * 7.0) * 0.03031761;"," color += readSource(v_uv + stepUv * 8.0) * 0.02245983;"," color += readSource(v_uv - stepUv * 8.0) * 0.02245983;"," color += readSource(v_uv + stepUv * 9.0) * 0.01598624;"," color += readSource(v_uv - stepUv * 9.0) * 0.01598624;"," color += readSource(v_uv + stepUv * 10.0) * 0.01093238;"," color += readSource(v_uv - stepUv * 10.0) * 0.01093238;"," color += readSource(v_uv + stepUv * 11.0) * 0.00718308;"," color += readSource(v_uv - stepUv * 11.0) * 0.00718308;"," color += readSource(v_uv + stepUv * 12.0) * 0.00453456;"," color += readSource(v_uv - stepUv * 12.0) * 0.00453456;"," if (color.a > 0.0001) color.rgb /= color.a;"," gl_FragColor = color;","}"].join(`\n`),ib=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_source;","uniform sampler2D u_blurSource;","uniform vec2 u_texel;","uniform vec2 u_uvScale;","uniform vec2 u_uvOffset;","uniform float u_blurReady;","uniform float u_blur;","uniform float u_kuwaharaRadius;","vec3 readPrepared(vec2 displayUv){"," vec2 uv = (displayUv - u_uvOffset) / u_uvScale;"," vec3 color = texture2D(u_source, clamp(uv, vec2(0.0), vec2(1.0))).rgb;"," if (u_blurReady > 0.5 && u_blur > 0.0) {"," vec3 blurred = texture2D(u_blurSource, clamp(uv, vec2(0.0), vec2(1.0))).rgb;"," color = mix(color, blurred, clamp(u_blur, 0.0, 1.0));"," }"," return color;","}","void main(){"," float radius = floor(mix(2.0, 16.0, clamp(u_kuwaharaRadius, 0.0, 1.0)) + 0.5);"," vec3 sum = vec3(0.0);"," float sumSquares = 0.0;"," float count = 0.0;"," for (int offset = 0; offset <= 16; offset++) {"," if (float(offset) > radius) continue;"," vec3 color = readPrepared(v_uv + vec2(float(offset), 0.0) * u_texel);"," sum += color;"," sumSquares += dot(color, color) / 3.0;"," count += 1.0;"," }"," gl_FragColor = vec4(sum / count, sumSquares / count);","}"].join(`\n`),ob=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_kuwaharaMoments;","uniform vec2 u_texel;","uniform float u_kuwaharaRadius;","uniform float u_kuwaharaSharpness;","uniform float u_kuwaharaSaturation;","void main(){"," float radius = floor(mix(2.0, 16.0, clamp(u_kuwaharaRadius, 0.0, 1.0)) + 0.5);"," vec2 origins[4];"," origins[0] = vec2(-radius, -radius);"," origins[1] = vec2(0.0, -radius);"," origins[2] = vec2(-radius, 0.0);"," origins[3] = vec2(0.0, 0.0);"," vec3 means[4];"," float variances[4];"," float minVariance = 1.0;"," for (int quadrant = 0; quadrant < 4; quadrant++) {"," vec4 moment = vec4(0.0);"," float count = 0.0;"," for (int offset = 0; offset <= 16; offset++) {"," if (float(offset) > radius) continue;"," vec2 sampleOffset = origins[quadrant] + vec2(0.0, float(offset));"," moment += texture2D(u_kuwaharaMoments, clamp(v_uv + sampleOffset * u_texel, vec2(0.0), vec2(1.0)));"," count += 1.0;"," }"," moment /= count;"," vec3 mean = moment.rgb;"," float meanSquare = moment.a * 3.0;"," float variance = max(meanSquare - dot(mean, mean), 0.0);"," means[quadrant] = mean;"," variances[quadrant] = variance;"," minVariance = min(minVariance, variance);"," }"," float exponent = 1.0 + clamp(u_kuwaharaSharpness, 0.0, 1.0) * 8.0;"," vec3 result = vec3(0.0);"," float totalWeight = 0.0;"," for (int quadrant = 0; quadrant < 4; quadrant++) {"," float weight = pow((minVariance + 0.0001) / (variances[quadrant] + 0.0001), exponent);"," result += means[quadrant] * weight;"," totalWeight += weight;"," }"," result /= max(totalWeight, 0.0001);"," float luma = dot(result, vec3(0.2126, 0.7152, 0.0722));"," float saturation = clamp(u_kuwaharaSaturation, 0.0, 1.0) * 2.0;"," gl_FragColor = vec4(clamp(mix(vec3(luma), result, saturation), 0.0, 1.0), 1.0);","}"].join(`\n`);function Nt(e){return e instanceof HTMLVideoElement||e instanceof HTMLImageElement}function td(e){let t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function nd(e,t,n){let r=e.createShader(n);return r?(e.shaderSource(r,t),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(L("runtime.colorGrading.compileShader",e.getShaderInfoLog(r)),e.deleteShader(r),null)):null}function si(e,t=nb){let n=nd(e,tb,e.VERTEX_SHADER),r=nd(e,t,e.FRAGMENT_SHADER);if(!n||!r)return n&&e.deleteShader(n),r&&e.deleteShader(r),null;let i=e.createProgram();return i?(e.attachShader(i,n),e.attachShader(i,r),e.linkProgram(i),e.deleteShader(n),e.deleteShader(r),e.getProgramParameter(i,e.LINK_STATUS)?i:(L("runtime.colorGrading.linkProgram",e.getProgramInfoLog(i)),e.deleteProgram(i),null)):null}function ri(e,t=e.LINEAR,n=e.UNSIGNED_BYTE){let r=e.createTexture();return r?(e.bindTexture(e.TEXTURE_2D,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,n,null),r):null}function ab(e,t){let n=si(e,rb);return n?{program:n,quad:t,position:e.getAttribLocation(n,"a_pos"),source:e.getUniformLocation(n,"u_source"),resolution:e.getUniformLocation(n,"u_resolution"),direction:e.getUniformLocation(n,"u_direction"),radius:e.getUniformLocation(n,"u_radius"),bloomPass:e.getUniformLocation(n,"u_bloomPass"),threshold:e.getUniformLocation(n,"u_threshold")}:null}function sb(e,t){let n=si(e,ib);return n?{program:n,quad:t,position:e.getAttribLocation(n,"a_pos"),source:e.getUniformLocation(n,"u_source"),blurSource:e.getUniformLocation(n,"u_blurSource"),texel:e.getUniformLocation(n,"u_texel"),uvScale:e.getUniformLocation(n,"u_uvScale"),uvOffset:e.getUniformLocation(n,"u_uvOffset"),blurReady:e.getUniformLocation(n,"u_blurReady"),blur:e.getUniformLocation(n,"u_blur"),radius:e.getUniformLocation(n,"u_kuwaharaRadius")}:null}function lb(e,t){let n=si(e,ob);return n?{program:n,quad:t,position:e.getAttribLocation(n,"a_pos"),moments:e.getUniformLocation(n,"u_kuwaharaMoments"),texel:e.getUniformLocation(n,"u_texel"),radius:e.getUniformLocation(n,"u_kuwaharaRadius"),sharpness:e.getUniformLocation(n,"u_kuwaharaSharpness"),saturation:e.getUniformLocation(n,"u_kuwaharaSaturation")}:null}function Qn(e,t=e.UNSIGNED_BYTE,n=e.LINEAR){let r=ri(e,n,t),i=e.createFramebuffer();if(!r||!i)return r&&e.deleteTexture(r),i&&e.deleteFramebuffer(i),null;e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0);let o=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),o!==e.FRAMEBUFFER_COMPLETE?(e.deleteTexture(r),e.deleteFramebuffer(i),null):{texture:r,framebuffer:i,type:t,width:1,height:1}}function oi(e,t,n,r){t.width===n&&t.height===r||(t.width=n,t.height=r,e.bindTexture(e.TEXTURE_2D,t.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,r,0,e.RGBA,t.type,null))}function xa(e,t,n){let r=[];for(let i of n){let o=e.getUniformLocation(t,`u_${i}`);o!==null&&r.push([i,o])}return r}function rd(e,t,n){t&&e.deleteProgram(t);for(let r of n)r&&e.deleteTexture(r)}function Aa(e){let t=e.getContext("webgl",{alpha:!0,premultipliedAlpha:!1});if(!t)return null;let n=si(t),r=ri(t),i=ri(t,t.NEAREST),o=ri(t,t.NEAREST);if(!n||!r||!i||!o)return rd(t,n,[r,i,o]),null;let a=t.createBuffer();return a?(t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),t.STATIC_DRAW),{gl:t,program:{program:n,texture:r,lutTexture:i,advancedTexture:o,advancedSignature:null,quad:a,position:t.getAttribLocation(n,"a_pos"),source:t.getUniformLocation(n,"u_source"),blurSource:t.getUniformLocation(n,"u_blurSource"),bloomSource:t.getUniformLocation(n,"u_bloomSource"),kuwaharaSource:t.getUniformLocation(n,"u_kuwaharaSource"),lut:t.getUniformLocation(n,"u_lut"),advanced:t.getUniformLocation(n,"u_advanced"),resolution:t.getUniformLocation(n,"u_resolution"),uvScale:t.getUniformLocation(n,"u_uvScale"),uvOffset:t.getUniformLocation(n,"u_uvOffset"),blurReady:t.getUniformLocation(n,"u_blurReady"),bloomReady:t.getUniformLocation(n,"u_bloomReady"),kuwaharaReady:t.getUniformLocation(n,"u_kuwaharaReady"),lutEnabled:t.getUniformLocation(n,"u_lutEnabled"),lutSize:t.getUniformLocation(n,"u_lutSize"),lutTextureSize:t.getUniformLocation(n,"u_lutTextureSize"),lutDomainMin:t.getUniformLocation(n,"u_lutDomainMin"),lutDomainMax:t.getUniformLocation(n,"u_lutDomainMax"),lutIntensity:t.getUniformLocation(n,"u_lutIntensity"),shadowWheel:t.getUniformLocation(n,"u_shadowWheel"),midtoneWheel:t.getUniformLocation(n,"u_midtoneWheel"),highlightWheel:t.getUniformLocation(n,"u_highlightWheel"),rgbCurvesEnabled:t.getUniformLocation(n,"u_rgbCurvesEnabled"),hueCurvesEnabled:t.getUniformLocation(n,"u_hueCurvesEnabled"),secondaryCount:t.getUniformLocation(n,"u_secondaryCount"),adjustUniforms:xa(t,n,Lr),detailUniforms:xa(t,n,po),effectUniforms:xa(t,n,ho),grainSeed:t.getUniformLocation(n,"u_grainSeed"),effectTime:t.getUniformLocation(n,"u_effectTime"),paletteSize:t.getUniformLocation(n,"u_paletteSize"),palette0:t.getUniformLocation(n,"u_palette0"),palette1:t.getUniformLocation(n,"u_palette1"),palette2:t.getUniformLocation(n,"u_palette2"),palette3:t.getUniformLocation(n,"u_palette3"),palette4:t.getUniformLocation(n,"u_palette4"),palette5:t.getUniformLocation(n,"u_palette5"),intensity:t.getUniformLocation(n,"u_intensity"),compareEnabled:t.getUniformLocation(n,"u_compareEnabled"),comparePosition:t.getUniformLocation(n,"u_comparePosition"),compareSoftness:t.getUniformLocation(n,"u_compareSoftness"),compareLineWidth:t.getUniformLocation(n,"u_compareLineWidth")}}):(rd(t,n,[r,i,o]),null)}function ub(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function cb(e){if(!ub(e))return{...en};let t=(n,r,i,o)=>{let a=typeof n=="number"?n:Number(n);return Math.min(o,Math.max(i,Number.isFinite(a)?a:r))};return{enabled:e.enabled===!0,position:t(e.position,en.position,0,1),softness:t(e.softness,en.softness,0,.25),lineWidth:t(e.lineWidth,en.lineWidth,0,12)}}function dd(e){try{let t=new URL(e,document.baseURI);return t.protocol==="data:"?{href:t.href}:t.protocol!=="http:"&&t.protocol!=="https:"?{error:"LUT must be project-local or a data URL"}:t.origin!==window.location.origin?{error:"Remote LUT URLs are not supported"}:{href:t.href}}catch{return{error:"Invalid LUT URL"}}}function li(e){return e instanceof Error?e.message:"LUT failed to load"}function db(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0)%1e4}function fd(e){let t=e.id||e.currentSrc||e.getAttribute("src")||`${e.tagName}:${Array.prototype.indexOf.call(e.parentNode?.children??[],e)}`;return db(t)}function Ea(e){let t=dd(e);if("error"in t)return{state:"error",message:t.error};let n=ot.get(t.href);if(n)return n;let r=fetch(t.href,{credentials:"same-origin"}).then(o=>{if(!o.ok)throw new Error(`Failed to load LUT (${o.status})`);return o.text()}).then(o=>yl(o,{maxSize:kr})),i={state:"pending",promise:r};for(;ot.size>=Kg;){let o=ot.keys().next().value;if(!o)break;ot.delete(o)}return ot.set(t.href,i),r.then(o=>{ot.get(t.href)===i&&ot.set(t.href,{state:"ready",lut:o})},o=>{ot.get(t.href)===i&&ot.set(t.href,{state:"error",message:li(o)})}),i}function id(e,t,n){if(e.lut?.src===t)return e.lut;let r=io(n),{gl:i,program:o}=e;try{return md(i,o.lutTexture,r),e.lut={src:t,size:n.size,domainMin:n.domainMin,domainMax:n.domainMax,textureWidth:r.width,textureHeight:r.height},e.lutError=null,e.lutLoadingSrc=null,e.lut}catch(a){return e.lut=null,e.lutError=li(a),e.lutLoadingSrc=null,L("runtime.colorGrading.uploadLut",a),null}}async function fb(e){let t=Ea(e);if(t.state==="ready")return t.lut;if(t.state==="pending")return t.promise;throw new Error(t.message)}function md(e,t,n){e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data)}function mb(e,t,n){let r=io(n),{gl:i,program:o}=e;return md(i,o.lutTexture,r),{src:t,size:n.size,domainMin:n.domainMin,domainMax:n.domainMax,textureWidth:r.width,textureHeight:r.height}}function Ze(e,t){e.deleteTexture(t.texture),e.deleteFramebuffer(t.framebuffer)}function Ca(e){let t=e.effectTargets;t&&(e.gl.deleteProgram(t.blurProgram.program),Ze(e.gl,t.scratch),Ze(e.gl,t.blur),t.bloom&&Ze(e.gl,t.bloom),e.effectTargets=null)}function wa(e){let t=e.kuwaharaTargets;t&&(e.gl.deleteProgram(t.horizontalProgram.program),e.gl.deleteProgram(t.resolveProgram.program),Ze(e.gl,t.moments),Ze(e.gl,t.output),e.kuwaharaTargets=null)}function ii(e,t=!1){Ca(e),wa(e),pb(e.gl,e.program),t&&e.gl.getExtension("WEBGL_lose_context")?.loseContext()}function pb(e,t){e.deleteTexture(t.texture),e.deleteTexture(t.lutTexture),e.deleteTexture(t.advancedTexture),e.deleteBuffer(t.quad),e.deleteProgram(t.program)}function hb(e){let t=Aa(e.canvas);return t?(ii(e),e.gl=t.gl,e.program=t.program,e.lut=null,e.lutLoadingSrc=null,e.lutError=null,e.effectError=null,!0):!1}function Sa(e){if(!e.sourceHidden)return;e.element.removeAttribute(_n);let t=e.element.style.getPropertyValue("opacity"),n=e.element.style.getPropertyPriority("opacity");t==="0"&&n==="important"&&(e.sourceInlineOpacity===null?e.element.style.removeProperty("opacity"):e.element.style.setProperty("opacity",e.sourceInlineOpacity,e.sourceInlineOpacityPriority)),e.sourceHidden=!1}function gb(e){if(e.effectTargets)return e.effectTargets;let{gl:t}=e,n=ab(t,e.program.quad),r=Qn(t),i=Qn(t);return!n||!r||!i?(n&&t.deleteProgram(n.program),r&&Ze(t,r),i&&Ze(t,i),e.effectError="Framebuffer effects unavailable",null):(e.effectError=null,e.effectTargets={blurProgram:n,scratch:r,blur:i,bloom:null},e.effectTargets)}function bb(e,t){return t.bloom||(t.bloom=Qn(e.gl),e.effectError=t.bloom?null:"Framebuffer effects unavailable"),t.bloom}function od(e){let t=e.effectTargets;t?.bloom&&(Ze(e.gl,t.bloom),t.bloom=null)}function xb(e){if(e.kuwaharaTargets)return e.kuwaharaTargets;let{gl:t}=e,n=t.getExtension("OES_texture_half_float"),r=t.getExtension("EXT_color_buffer_half_float");if(!n||!r)return e.effectError="Kuwahara requires half-float framebuffer support",null;let i=sb(t,e.program.quad),o=lb(t,e.program.quad),a=Qn(t,n.HALF_FLOAT_OES,t.NEAREST),l=Qn(t);return!i||!o||!a||!l?(yb(t,i,o,a,l),e.effectError="Kuwahara framebuffer effects unavailable",null):(e.kuwaharaTargets={horizontalProgram:i,resolveProgram:o,moments:a,output:l},e.kuwaharaTargets)}function yb(e,t,n,r,i){t&&e.deleteProgram(t.program),n&&e.deleteProgram(n.program),r&&Ze(e,r),i&&Ze(e,i)}function pd(e,t,n,r,i){let o=Math.max(1,Math.ceil(r)),a=Math.max(1,Math.ceil(i));return oi(e,t,o,a),oi(e,n,o,a),{width:o,height:a}}function ai(e,t,n,r,i,o,a,l=!1,s=-1){e.bindFramebuffer(e.FRAMEBUFFER,r.framebuffer),e.viewport(0,0,i.width,i.height),e.useProgram(t.program),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,n),e.uniform1i(t.source,0),e.uniform2f(t.resolution,i.width,i.height),e.uniform2f(t.direction,o.x,o.y),e.uniform1f(t.radius,a),e.uniform1f(t.bloomPass,l?1:0),e.uniform1f(t.threshold,s),Zn(e,t)}function vb(e,t,n,r,i,o,a){let l=pd(e,t.scratch,r,i/2,o/2),s=a/2;ai(e,t.blurProgram,n,t.scratch,l,{x:1,y:0},s,!0,.5),ai(e,t.blurProgram,t.scratch.texture,r,l,{x:0,y:1},s,!0)}function Sb(e,t,n,r,i,o,a){let l=n;for(let s=0;s<Math.max(1,Math.floor(a));s++)ai(e,t.blurProgram,l,t.scratch,i,{x:1,y:0},o),ai(e,t.blurProgram,t.scratch.texture,r,i,{x:0,y:1},o),l=r.texture}function Zn(e,t){e.bindBuffer(e.ARRAY_BUFFER,t.quad),e.enableVertexAttribArray(t.position),e.vertexAttribPointer(t.position,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_STRIP,0,4)}function Ab(e,t,n,r,i,o,a,l){oi(e,t.moments,i.width,i.height),oi(e,t.output,i.width,i.height);let s=t.horizontalProgram;e.bindFramebuffer(e.FRAMEBUFFER,t.moments.framebuffer),e.viewport(0,0,i.width,i.height),e.useProgram(s.program),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,n),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,r),e.uniform1i(s.source,0),e.uniform1i(s.blurSource,1),e.uniform2f(s.texel,1/i.width,1/i.height),e.uniform2f(s.uvScale,o.scaleX,o.scaleY),e.uniform2f(s.uvOffset,o.offsetX,o.offsetY),e.uniform1f(s.blurReady,a?1:0),e.uniform1f(s.blur,l.blur),e.uniform1f(s.radius,l.kuwaharaRadius),Zn(e,s);let u=t.resolveProgram;e.bindFramebuffer(e.FRAMEBUFFER,t.output.framebuffer),e.useProgram(u.program),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t.moments.texture),e.uniform1i(u.moments,0),e.uniform2f(u.texel,1/i.width,1/i.height),e.uniform1f(u.radius,l.kuwaharaRadius),e.uniform1f(u.sharpness,l.kuwaharaSharpness),e.uniform1f(u.saturation,l.kuwaharaSaturation),Zn(e,u)}function Eb(e,t,n,r){if(n<=0)return!1;let i=pd(e.gl,t.scratch,t.blur,r.width,r.height);return Sb(e.gl,t,e.program.texture,t.blur,i,.75+Math.pow(n,1.35)*32,n>.55?3:2),!0}function Cb(e,t,n,r,i,o){if(n<=0)return od(e),null;o||od(e);let a=o?bb(e,t):t.blur;return a?(vb(e.gl,t,e.program.texture,a,i.width,i.height,r),a.texture):null}function wb(e,t,n,r){let{program:i}=e,o=t.effects.blur,a=t.effects.bloom;if(o<=0&&a<=0)return e.effectTargets&&r&&Ca(e),{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let l=gb(e);if(!l)return{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let s=Eb(e,l,o,n),u=Cb(e,l,a,t.effects.bloomRadius,n,s);return{blurReady:s,bloomReady:u!==null,blurTexture:l.blur.texture,bloomTexture:u??i.texture}}function _b(e,t,n,r,i,o,a){let l=t.effects.kuwahara;if(l<=0&&!o)return e.kuwaharaTargets&&a&&wa(e),{kuwaharaReady:!1,kuwaharaTexture:e.program.texture};let s=xb(e);return!s||l<=0?{kuwaharaReady:!1,kuwaharaTexture:s?.output.texture??e.program.texture}:(Ab(e.gl,s,e.program.texture,e.effectTargets?.blur.texture??e.program.texture,n,r,i,t.effects),{kuwaharaReady:!0,kuwaharaTexture:s.output.texture})}function hd(e,t,n,r,i={}){let o=i.releaseIdleTargets??!0;e.effectError=null;let a=wb(e,t,n,o),l=_b(e,t,n,r,a.blurReady,i.preserveKuwahara??!1,o);return{...a,...l}}function Tb(e){let t=e.grading.lut?.src.trim()??"",n=e.grading.lut?.intensity??1;if(!t||n<=0)return e.lut=null,e.lutLoadingSrc=null,e.lutError=null,null;let r=dd(t);if("error"in r)return e.lut=null,e.lutLoadingSrc=null,e.lutError=r.error,null;if(e.lut?.src===r.href)return e.lut;e.lut=null;let i=Ea(t);return i.state==="ready"?id(e,r.href,i.lut):i.state==="error"?(e.lutError=i.message,e.lutLoadingSrc=null,null):(e.lutLoadingSrc!==r.href&&(e.lutLoadingSrc=r.href,e.lutError=null,i.promise.then(o=>{e.destroyed||e.grading.lut?.src.trim()!==t||(id(e,r.href,o),De(e))},o=>{e.destroyed||e.grading.lut?.src.trim()!==t||(e.lut=null,e.lutError=li(o),e.lutLoadingSrc=null,De(e))})),null)}function Xn(e){if(!e)return null;if(typeof e=="string"){let t=e.trim();if(!t)return null;let n=document.getElementById(t.replace(/^#/,""));if(n&&Nt(n))return n;try{let r=document.querySelector(t);return r&&Nt(r)?r:null}catch{return null}}if(e.hfId){let t=document.querySelector(`[data-hf-id="${CSS.escape(e.hfId)}"]`);if(t&&Nt(t))return t}if(e.id){let t=document.getElementById(e.id);if(t&&Nt(t))return t}if(!e.selector)return null;try{let t=Array.from(document.querySelectorAll(e.selector)),n=Math.max(0,Math.floor(Number(e.selectorIndex??0)||0)),r=t[n]??null;return r&&Nt(r)?r:null}catch{return null}}function gd(e){return e instanceof HTMLVideoElement?e.videoWidth>0&&e.videoHeight>0?{width:e.videoWidth,height:e.videoHeight}:null:e instanceof HTMLImageElement&&e.naturalWidth>0&&e.naturalHeight>0?{width:e.naturalWidth,height:e.naturalHeight}:null}function bd(e){return e instanceof HTMLVideoElement?e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&e.videoWidth>0&&e.videoHeight>0:e instanceof HTMLImageElement?e.complete&&e.naturalWidth>0&&e.naturalHeight>0:!1}function xd(e){let t=ct(e);return t&&bd(t)?t:null}function ad(e){if(!(e instanceof HTMLVideoElement))return!1;let t=xd(e);if(!t)return!1;let n=window.getComputedStyle(t);return n.display!=="none"&&n.visibility!=="hidden"}function Rb(e){return e instanceof HTMLImageElement&&e.classList.contains("__render_frame__")}function kb(e,t){t.parentNode&&t.nextSibling!==e.canvas&&t.parentNode.insertBefore(e.canvas,t.nextSibling)}function yd(e){if(e instanceof HTMLVideoElement){let t=xd(e);if(t)return t}return bd(e)?e:null}function sd(e,t){let n=e.toLowerCase();if(n==="center")return .5;if(t==="x"){if(n==="left")return 0;if(n==="right")return 1}else{if(n==="top")return 0;if(n==="bottom")return 1}if(n.endsWith("%")){let r=Number.parseFloat(n);return Number.isFinite(r)?r/100:null}return null}function Mb(e){let t=e.trim().split(/\\s+/).filter(Boolean),n=.5,r=.5;for(let i=0;i<t.length;i++){let o=t[i]??"",a=sd(o,"x"),l=sd(o,"y");if(a!==null&&(o==="left"||o==="right"||o.endsWith("%")&&i===0)){n=a;continue}if(l!==null&&(o==="top"||o==="bottom"||o.endsWith("%")&&i>0)){r=l;continue}}return{x:n,y:r}}function vd(e,t,n,r,i,o){if(e<=0||t<=0||n<=0||r<=0)return{scaleX:1,scaleY:1,offsetX:0,offsetY:0};let a=i||"fill",l=e,s=t;if(a==="contain"||a==="cover"||a==="scale-down"){let f=a==="cover"?Math.max(e/n,t/r):Math.min(e/n,t/r);l=n*f,s=r*f,a==="scale-down"&&l>n&&s>r&&(l=n,s=r)}else a==="none"&&(l=n,s=r);let u=Mb(o||"center"),c=(e-l)*u.x/e,m=(t-s)*u.y/t;return{scaleX:l/e,scaleY:s/t,offsetX:c,offsetY:m}}function Fb(e,t){window.getComputedStyle(t).position==="static"&&(e.touchedParent||(e.touchedParent=t,e.parentInlinePosition=t.style.position||null),t.style.position="relative")}function ld(e,t){return Math.max(0,Math.round(e>0?e:t))}function Nb(e,t){let{element:n,canvas:r}=e,i=n.parentElement;i&&Fb(e,i);let o=window.getComputedStyle(t);ql(r.style,o),r.style.pointerEvents="none",r.style.position="absolute",r.style.inset="auto",r.style.left=`${n.offsetLeft}px`,r.style.top=`${n.offsetTop}px`,r.style.right="auto",r.style.bottom="auto",r.style.width=`${n.offsetWidth}px`,r.style.height=`${n.offsetHeight}px`,r.style.display="block",r.style.opacity=e.sourceOpacityForCanvas,r.style.visibility=e.sourceVisibleForCanvas?"visible":"hidden";let a=n.getBoundingClientRect(),l=ld(n.offsetWidth,a.width),s=ld(n.offsetHeight,a.height);if(l<=0||s<=0)return r.style.display="none",null;let u=Math.max(1,window.devicePixelRatio||1),c=Math.round(l*u),m=Math.round(s*u);return r.width!==c&&(r.width=c),r.height!==m&&(r.height=m),{width:c,height:m}}function Zt(e,t,n){e.uniform3f(t,Number.parseInt(n.slice(1,3),16)/255,Number.parseInt(n.slice(3,5),16)/255,Number.parseInt(n.slice(5,7),16)/255)}function Lt(e,t,n,r){e.set(r,(t*Xe+n)*4)}function yt(e,t){return Math.min(1,Math.max(1/255,(e*(127/t)+128)/255))}function ya(e,t,n){return e.length>=3?ao(e,t,n):new Float32Array(Xe)}function Ft(e,t){return e[t]??0}function Lb(e,t,n){let r=Ut(t.red),i=Ut(t.green),o=Ut(t.blue),a=Ut(t.master),l=ya(n.hueVsHue,-180,180),s=ya(n.hueVsSaturation,-1,1),u=ya(n.hueVsLuma,-1,1);for(let c=0;c<Xe;c+=1)Lt(e,0,c,[Ft(r,c),Ft(i,c),Ft(o,c),Ft(a,c)]),Lt(e,1,c,[yt(Ft(l,c),180),yt(Ft(s,c),1),yt(Ft(u,c),1),1])}function Db(e,t,n){let r=n*Qg;Lt(e,2,r,[t.key.hue.center/360,t.key.hue.range/180,t.key.hue.softness/180,1]),Lt(e,2,r+1,[t.key.saturation.min,t.key.saturation.max,t.key.saturation.softness/.5,0]),Lt(e,2,r+2,[t.key.luma.min,t.key.luma.max,t.key.luma.softness/.5,0]),Lt(e,2,r+3,[yt(t.correction.hueShift,180),yt(t.correction.saturation,1),yt(t.correction.luma,1),yt(t.correction.temperature,1)]),Lt(e,2,r+4,[yt(t.correction.tint,1),.5,.5,1])}function Ib(e,t,n){let r=new Float32Array(Xe*tr*4);Lb(r,e,t);let i=0;for(let o of n)o.enabled&&(Db(r,o,i),i+=1);return r}var ud=new WeakMap;function Pb(e,t,n){let r=ud.get(e);if(r?.hueCurves===t&&r.secondaries===n)return r.signature;let i=JSON.stringify([e,t,n]);return ud.set(e,{hueCurves:t,secondaries:n,signature:i}),i}function Ob(e,t,n,r){let{curves:i,hueCurves:o}=n,a=Pb(i,o,r);if(t.advancedSignature===a)return;let l=Uint8Array.from(Ib(i,o,r),En);e.activeTexture(e.TEXTURE5),e.bindTexture(e.TEXTURE_2D,t.advancedTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,Xe,tr,0,e.RGBA,e.UNSIGNED_BYTE,l),t.advancedSignature=a}function va(e,t,n){e.uniform3f(t,n.hue/360,n.amount,n.level)}function Sd(e,t,n,r,i,o,a,l,s,u,c,m){e.uniform1i(t.source,0),e.uniform1i(t.blurSource,1),e.uniform1i(t.lut,2),e.uniform1i(t.kuwaharaSource,3),e.uniform1i(t.bloomSource,4),e.uniform1i(t.advanced,5),e.uniform2f(t.resolution,s.width,s.height),e.uniform2f(t.uvScale,u.scaleX,u.scaleY),e.uniform2f(t.uvOffset,u.offsetX,u.offsetY),e.uniform1f(t.blurReady,i?1:0),e.uniform1f(t.bloomReady,o?1:0),e.uniform1f(t.kuwaharaReady,a?1:0),e.uniform1f(t.lutEnabled,r?1:0),e.uniform1f(t.lutSize,r?.size??2),e.uniform2f(t.lutTextureSize,r?.textureWidth??1,r?.textureHeight??1),e.uniform3f(t.lutDomainMin,r?.domainMin[0]??0,r?.domainMin[1]??0,r?.domainMin[2]??0),e.uniform3f(t.lutDomainMax,r?.domainMax[0]??1,r?.domainMax[1]??1,r?.domainMax[2]??1),e.uniform1f(t.lutIntensity,n.lut?.intensity??0);let{curves:f,hueCurves:h,secondaries:b}=n,v=xo(f),x=yo(h),_=vo(b)?b.reduce((F,M)=>F+Number(M.enabled),0):0;(v||x||_>0)&&Ob(e,t,n,b),va(e,t.shadowWheel,n.wheels.shadows),va(e,t.midtoneWheel,n.wheels.midtones),va(e,t.highlightWheel,n.wheels.highlights),e.uniform1f(t.rgbCurvesEnabled,v?1:0),e.uniform1f(t.hueCurvesEnabled,x?1:0),e.uniform1f(t.secondaryCount,_);for(let[F,M]of t.adjustUniforms)e.uniform1f(M,n.adjust[F]);for(let[F,M]of t.detailUniforms)e.uniform1f(M,n.details[F]);e.uniform1f(t.grainSeed,c),e.uniform1f(t.effectTime,m);for(let[F,M]of t.effectUniforms)e.uniform1f(M,n.effects[F]);let R=n.palette??(n.effects.engraving>0||n.effects.crosshatch>0?Xg:ga),T=R[R.length-1]??ga[1];e.uniform1f(t.paletteSize,R.length),Zt(e,t.palette0,R[0]??ga[0]),Zt(e,t.palette1,R[1]??T),Zt(e,t.palette2,R[2]??T),Zt(e,t.palette3,R[3]??T),Zt(e,t.palette4,R[4]??T),Zt(e,t.palette5,R[5]??T),e.uniform1f(t.intensity,n.intensity),e.uniform1f(t.compareEnabled,l.enabled?1:0),e.uniform1f(t.comparePosition,l.position),e.uniform1f(t.compareSoftness,l.softness),e.uniform1f(t.compareLineWidth,l.lineWidth)}function Gb(e){if(!e.sourceHidden){let t=e.element.getAttribute(Nr);t!==null?(e.sourceInlineOpacity=t===""?null:t,e.sourceInlineOpacityPriority=""):(e.sourceInlineOpacity=e.element.style.getPropertyValue("opacity")||null,e.sourceInlineOpacityPriority=e.element.style.getPropertyPriority("opacity"))}e.element.setAttribute(_n,"true"),e.element.style.setProperty("opacity","0","important"),e.sourceHidden=!0}function at(e){let t=Hl.find(n=>n.path===e);if(!t)throw new Error(`Missing color-grading animation property: ${e}`);return t}var Ad=at("intensity"),Ed=at("lut.intensity"),Cd=at("adjust.exposure"),wd=at("effects.kuwahara"),_d=[["blur",at("effects.blur")],["bloom",at("effects.bloom")],["kuwahara",wd],["pixelate",at("effects.pixelate")],["ascii",at("effects.ascii")],["dither",at("effects.dither")]],Td=[Ad,Ed,Cd,..._d.map(([,e])=>e)];function Dt(e,t){let n=e.style.getPropertyValue(t.name);if(!n)return null;let r=Number(n);return Number.isFinite(r)?Math.min(t.max,Math.max(t.min,r)):null}function Jn(e,t){return t!==null&&(Vl(t)||Td.some(n=>Dt(e,n)!==null))}function Hb(e,t){let n=null;for(let[r,i]of _d){let o=Dt(e,i);o!==null&&(n??(n={...t.effects}),n[r]=o)}return n}function Bb(e){let{element:t,grading:n}=e,r=Dt(t,Ad),i=Dt(t,Ed),o=Dt(t,Cd),a=Hb(t,n);if(![r,i,o].some(u=>u!==null)&&a===null)return n;let s={...n,adjust:o===null?n.adjust:{...n.adjust,exposure:o},effects:a??n.effects};return r!==null&&(s.intensity=r),n.lut&&i!==null&&(s.lut={...n.lut,intensity:i}),s}function Rd(e,t,n){e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)}function kd(e,t,n){let r=[t.texture,n.blurTexture,t.lutTexture,n.kuwaharaTexture,n.bloomTexture,t.advancedTexture];for(let[i,o]of r.entries())e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,o)}function De(e){if(e.destroyed||e.contextLost)return!1;let t=yd(e.element);if(!t)return e.hasDrawn||(e.canvas.style.display="none"),!1;let n=gd(t);if(!n)return!1;let r=t instanceof HTMLElement?t:e.element,i=e.element.style.getPropertyValue("opacity"),o=e.element.style.getPropertyPriority("opacity"),a=e.sourceHidden&&i==="0"&&o==="important",l=e.element.style.getPropertyValue("visibility"),s=Rb(t);s&&kb(e,t);let u=window.getComputedStyle(s?t:e.element);(s||!a)&&(e.sourceOpacityForCanvas=u.opacity||"1"),e.sourceVisibleForCanvas=(s||l!=="hidden")&&u.visibility!=="hidden";let c=Nb(e,r);if(!c)return!1;let m=window.getComputedStyle(r),f=vd(c.width,c.height,n.width,n.height,m.objectFit,m.objectPosition),{gl:h,program:b}=e;try{let v=Bb(e),x=Tb(e);Rd(h,b.texture,t);let _=Dt(e.element,wd)!==null,R=hd(e,v,c,f,{preserveKuwahara:_});h.bindFramebuffer(h.FRAMEBUFFER,null),h.viewport(0,0,c.width,c.height),h.useProgram(b.program),kd(h,b,R);let T=window.__player?.getTime?.(),F=typeof T=="number"&&Number.isFinite(T)?Math.max(0,T):e.element instanceof HTMLVideoElement?Math.max(0,e.element.currentTime):0,M=e.grainSeed+Math.floor(F*60);return Sd(h,b,v,x,R.blurReady,R.bloomReady,R.kuwaharaReady,e.compare,c,f,M,F),Zn(h,b),Gb(e),e.hasDrawn=!0,e.drawError=null,!0}catch(v){return e.drawError=v instanceof Error?v.message:"Shader draw failed",L("runtime.colorGrading.drawEntry",v),!1}}function Ub(e,t,n){let r=e.getBoundingClientRect(),i=e.offsetWidth||r.width||t.width,o=e.offsetHeight||r.height||t.height,a=Math.min(320,Math.max(64,Math.round(n??160))),l=i>0&&o>0?i/o:t.width/t.height;return l>=1?{width:a,height:Math.max(1,Math.round(a/l))}:{width:Math.max(1,Math.round(a*l)),height:a}}function Wb(){let e=document.createElement("canvas"),t=Aa(e);return t?{canvas:e,...t,lut:null,effectTargets:null,kuwaharaTargets:null,effectError:null}:null}function Vb(e,t){let n=t?void 0:window.__player?.getTime?.();return typeof n=="number"&&Number.isFinite(n)?Math.max(0,n):e instanceof HTMLVideoElement?Math.max(0,e.currentTime):0}function zb(e,t,n,r){let i=yd(t);if(!i)return null;let o=gd(i);if(!o)return null;let a=Ub(t,o,n);e.canvas.width=a.width,e.canvas.height=a.height;let l=i instanceof HTMLElement?i:t,s=window.getComputedStyle(l),u=vd(a.width,a.height,o.width,o.height,s.objectFit,s.objectPosition);return Rd(e.gl,e.program.texture,i),{dimensions:a,uv:u,effectTime:Vb(t,r),grainSeed:fd(t)+(t instanceof HTMLVideoElement?Math.floor(t.currentTime*60):0)}}async function qb(e,t,n,r,i=!1){let o=zb(e,t,r,i);if(!o)return null;let{dimensions:a,uv:l,grainSeed:s,effectTime:u}=o,c=[];for(let m of n.slice(0,32)){let f=Dr(m.grading);if(!f){c.push({id:m.id,dataUrl:null,error:"Invalid grading"});continue}let h=null;try{f.lut&&(e.lut?.src!==f.lut.src&&(e.lut=mb(e,f.lut.src,await fb(f.lut.src))),h=e.lut),c.push({id:m.id,dataUrl:$b(e,f,h,a,l,s,u)})}catch(b){c.push({id:m.id,dataUrl:null,error:li(b)})}}return{...a,images:c}}function $b(e,t,n,r,i,o,a){let{canvas:l,gl:s,program:u}=e,c=hd(e,t,r,i,{releaseIdleTargets:!1});return s.bindFramebuffer(s.FRAMEBUFFER,null),s.viewport(0,0,r.width,r.height),s.useProgram(u.program),kd(s,u,c),n||(e.lut=null),Sd(s,u,t,n,c.blurReady,c.bloomReady,c.kuwaharaReady,en,r,i,o,a),Zn(s,u),l.toDataURL("image/png")}function Qe(e,t,n,r){t.addEventListener(n,r),e.cleanup.push(()=>t.removeEventListener(n,r))}function jb(e){e.animationFrame!==null&&(window.cancelAnimationFrame(e.animationFrame),e.animationFrame=null),e.videoFrameHandle!==null&&e.element instanceof HTMLVideoElement&&(e.element.cancelVideoFrameCallback?.(e.videoFrameHandle),e.videoFrameHandle=null)}function er(e){if(e.destroyed||!(e.element instanceof HTMLVideoElement)||e.videoFrameHandle!==null||e.animationFrame!==null)return;let t=e.element,n=t;if(typeof n.requestVideoFrameCallback=="function"){e.videoFrameHandle=n.requestVideoFrameCallback(()=>{e.videoFrameHandle=null,De(e),!e.destroyed&&!t.paused&&!t.ended&&er(e)});return}e.animationFrame=window.requestAnimationFrame(()=>{e.animationFrame=null,De(e),!e.destroyed&&!t.paused&&!t.ended&&er(e)})}function Kb(e){let t=()=>{De(e)};if(Qe(e,e.element,"load",t),Qe(e,e.element,"loadedmetadata",t),Qe(e,e.element,"loadeddata",t),Qe(e,e.element,"seeked",t),Qe(e,e.element,"timeupdate",t),Qe(e,window,"resize",t),e.element instanceof HTMLVideoElement&&(Qe(e,e.element,"play",()=>er(e)),Qe(e,e.element,"pause",t)),Qe(e,e.canvas,"webglcontextlost",n=>{n.preventDefault(),e.contextLost=!0,e.drawError="WebGL context lost",e.canvas.style.display="none",Sa(e)}),Qe(e,e.canvas,"webglcontextrestored",()=>{if(e.contextLost=!1,!hb(e)){e.contextLost=!0,e.drawError="WebGL context restore failed",Sa(e);return}e.drawError=null,De(e)}),typeof ResizeObserver<"u"&&(e.resizeObserver=new ResizeObserver(t),e.resizeObserver.observe(e.element)),typeof MutationObserver<"u"){let n=()=>{let a=e.element.style;return`${a.transform}|${a.translate}|${a.rotate}|${a.scale}|${a.left}|${a.top}|${a.width}|${a.height}`},r=n(),i=!1,o=new MutationObserver(()=>{i||n()!==r&&(i=!0,requestAnimationFrame(()=>{i=!1,r=n(),De(e)}))});o.observe(e.element,{attributes:!0,attributeFilter:["style"]}),e.cleanup.push(()=>o.disconnect())}}function Yb(e){if(e.destroyed)return null;e.destroyed=!0,jb(e),e.resizeObserver?.disconnect();for(let t of e.cleanup)t();return e.cleanup.length=0,e.canvas.remove(),Ca(e),wa(e),Sa(e),e.touchedParent&&(e.parentInlinePosition===null?e.touchedParent.style.removeProperty("position"):e.touchedParent.style.position=e.parentInlinePosition),{canvas:e.canvas,gl:e.gl,program:e.program,effectTargets:null,kuwaharaTargets:null,effectError:null}}function Md(e,t){return e.removeAttribute("style"),t.id?e.id=`${Dl}${t.id}`:e.removeAttribute("id"),e.className=jg,e.setAttribute($g,"true"),e.setAttribute("data-hyperframes-ignore",""),e.setAttribute("data-hyperframes-picker-ignore",""),e.setAttribute("data-hf-ignore",""),e.setAttribute("aria-hidden","true"),e.style.pointerEvents="none",e.style.display="none",t.parentNode?.insertBefore(e,t.nextSibling),e}function Xb(e){return Md(document.createElement("canvas"),e)}function Fd(){let e=new WeakMap,t=new Set,n=[],r=null,i=null,o=Promise.resolve(),a=!1,l=(E,S,A)=>{let w=e.get(E);if(w)return w.grading=S,w.source=A,De(w),E instanceof HTMLVideoElement&&!E.paused&&er(w),!0;let N=n.pop();if(N)Md(N.canvas,E);else{let W=Xb(E),U=Aa(W);if(!U)return W.remove(),!1;N={canvas:W,gl:U.gl,program:U.program,effectTargets:null,kuwaharaTargets:null,effectError:null}}let I={element:E,...N,grading:S,compare:{...en},lut:null,lutLoadingSrc:null,lutError:null,drawError:null,effectTargets:null,kuwaharaTargets:null,effectError:null,source:A,animationFrame:null,videoFrameHandle:null,resizeObserver:null,cleanup:[],touchedParent:null,parentInlinePosition:null,sourceHidden:!1,sourceInlineOpacity:null,sourceInlineOpacityPriority:"",sourceOpacityForCanvas:window.getComputedStyle(E).opacity||"1",sourceVisibleForCanvas:window.getComputedStyle(E).visibility!=="hidden",hasDrawn:!1,contextLost:!1,grainSeed:fd(E),destroyed:!1};return e.set(E,I),t.add(E),Kb(I),De(I),E instanceof HTMLVideoElement&&!E.paused&&er(I),!0},s=(E,S)=>{if(a)return!1;let A=Xn(E);if(!A)return!1;let w=e.get(A);if(!w){let N=ni(A);if(!Jn(A,N)||!l(A,N,"attribute"))return!1;w=e.get(A)}return w?(w.compare=cb(S),De(w),!0):!1},u=E=>{let S=e.get(E);if(!S)return;let A=Yb(S);A&&(S.contextLost||n.length>=Yg?ii(A,!0):n.push(A)),e.delete(E),t.delete(E)},c=()=>{if(a)return 0;let E=new Set;document.querySelectorAll(`video[${wn}], img[${wn}]`).forEach(A=>{if(!Nt(A))return;E.add(A);let w=ni(A);Jn(A,w)&&(td(A)||ad(A))?l(A,w,"attribute"):u(A)});for(let A of t){let w=e.get(A);w&&(!A.isConnected||w.source==="attribute"&&!E.has(A))&&u(A)}return t.size},m=()=>{if(a)return 0;let E=0;for(let S of t){let A=e.get(S);A&&De(A)&&(E+=1)}return E},f=async()=>{let E=new Set;for(let S of t){let A=e.get(S)?.grading.lut;if(!A?.src.trim()||(A.intensity??1)<=0)continue;let w=Ea(A.src);w.state==="pending"&&E.add(w.promise)}return E.size>0&&await Promise.allSettled(E),m(),E.size},h=()=>{if(a)return 0;let E=0;for(let S of t){let A=e.get(S);!A||!Td.some(N=>Dt(S,N)!==null)||S instanceof HTMLVideoElement&&!S.paused&&!S.ended||De(A)&&(E+=1)}return E},b=(E,S)=>{if(a)return!1;let A=Xn(E);if(!A)return!1;let w=Dr(S);return Jn(A,w)?l(A,w,"live"):(u(A),!0)},v=(E,S)=>{if(!Nt(E))return!1;let A=e.get(E);if(!A){if(!S)return!1;let w=ni(E);return Jn(E,w)&&l(E,w,"attribute")}return A.sourceVisibleForCanvas=S,!S&&A.source==="attribute"&&u(E),!0},x=E=>{let S=Xn(E);if(!S)return{state:"missing",message:"Media not found"};let A=e.get(S);if(A)return A.effectError?{state:"unavailable",message:A.effectError}:A.drawError?{state:"unavailable",message:A.drawError}:A.lutError?{state:"unavailable",message:`LUT error: ${A.lutError}`}:A.grading.lut&&A.lutLoadingSrc?{state:"pending",message:"Loading LUT"}:A.canvas.style.display==="none"?{state:"pending",message:"Waiting for media frame"}:{state:"active",message:A.lut?"Shader + LUT active":"Shader active"};let w=ni(S);return Jn(S,w)?!td(S)&&!ad(S)?{state:"pending",message:"Waiting for visible media"}:{state:"unavailable",message:"WebGL unavailable"}:{state:"inactive",message:"No grading applied"}},_=async(E,S,A)=>{let w=async()=>{if(a||S.length===0)return null;let I=Xn(E);return!I||(i??(i=Wb()),!i)?null:qb(i,I,S,A?.maxDimension,A?.useMediaTime)},N=o.then(w,w);return o=N.then(()=>{},()=>{}),N},R=E=>{let S=Xn(E);if(!(S instanceof HTMLVideoElement))return null;if(!S.paused)return()=>{};let A=S.currentTime,w=S.loop,N=S.muted;return S.loop=!0,S.muted=!0,(S.ended||Number.isFinite(S.duration)&&A>=S.duration)&&(S.currentTime=0),S.play().catch(()=>{}),()=>{S.pause(),S.loop=w,S.muted=N,S.currentTime=A}},T=()=>{if(!a){a=!0,r?.disconnect(),r=null;for(let E of t)u(E);for(let E of n)ii(E,!0);n.length=0,i&&(ii(i,!0),i=null)}};document.body&&(r=new MutationObserver(()=>c()),r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[wn]}));let F={refresh:c,redraw:m,redrawAnimated:h,waitForActiveLuts:f,setGrading:b,setCompare:s,setSourceVisibility:v,getStatus:x,renderPreviews:_,startPreviewPlayback:R,destroy:T},M=window;return M.__hf=M.__hf||{},M.__hf.colorGrading=F,c(),F}var ui=class{constructor(t){pe(this,"_baseTime",0);pe(this,"_playStartMs",null);pe(this,"_rate",1);pe(this,"_duration",1/0);pe(this,"_nowMs");pe(this,"_audioSource",null);this._baseTime=t?.initialTime??0,this._rate=t?.rate??1,this._duration=t?.duration??1/0,this._nowMs=t?.nowMs??(()=>performance.now())}now(){if(this._playStartMs===null)return this._baseTime;if(this._audioSource){let r=null;if("currentTimeSeconds"in this._audioSource)r=this._audioSource.currentTimeSeconds;else{let{el:i,compositionStart:o,mediaStart:a}=this._audioSource;!i.paused&&Number.isFinite(i.currentTime)&&(r=(i.currentTime-a)/(i.playbackRate>0?i.playbackRate:1)*this._rate+o)}if(r!==null)return Number.isFinite(this._duration)&&r>=this._duration?this._duration:Math.max(0,r)}let t=(this._nowMs()-this._playStartMs)/1e3,n=this._baseTime+t*this._rate;return Number.isFinite(this._duration)&&n>=this._duration?this._duration:Math.max(0,n)}play(){return this._playStartMs!==null||Number.isFinite(this._duration)&&this._baseTime>=this._duration?!1:(this._playStartMs=this._nowMs(),!0)}pause(){return this._playStartMs===null?!1:(this._baseTime=this.now(),this._playStartMs=null,!0)}seek(t){let n=Number.isFinite(this._duration)?Math.max(0,Math.min(t,this._duration)):Math.max(0,t);this._baseTime=n,this._playStartMs!==null&&(this._playStartMs=this._nowMs())}isPlaying(){return this._playStartMs!==null}setRate(t){let n=Number.isFinite(t)&&t>0?Math.max(.1,Math.min(5,t)):1;this._playStartMs!==null&&(this._baseTime=this.now(),this._playStartMs=this._nowMs()),this._rate=n}getRate(){return this._rate}setDuration(t){this._duration=Number.isFinite(t)&&t>0?t:1/0,this._baseTime>this._duration&&(this._baseTime=this._duration)}getDuration(){return this._duration}attachAudioSource(t){this._audioSource=t}detachAudioSource(){this._audioSource&&this._playStartMs!==null&&(this._baseTime=this.now(),this._playStartMs=this._nowMs()),this._audioSource=null}hasAudioSource(){return this._audioSource!==null}getSource(){if(this._audioSource&&this._playStartMs!==null){if("currentTimeSeconds"in this._audioSource)return"audio";let{el:t}=this._audioSource;if(!t.paused&&Number.isFinite(t.currentTime))return"audio"}return"monotonic"}snapshot(){return{time:this.now(),playing:this.isPlaying(),rate:this._rate,duration:this._duration,source:this.getSource()}}reachedEnd(){return Number.isFinite(this._duration)&&this.now()>=this._duration}};var Jb=100,Qb=8,Zb=4096,_a=e=>e;function ex(e,t,n){return!(!!e.curve||e.viaX!==void 0&&e.viaY!==void 0)&&t==="linear"&&!n}function tx(e){let t=Math.ceil(e*Jb);return Math.min(Zb,Math.max(Qb,t))}function nx(e,t,n,r,i){let{scheduledAt:o,elapsed:a,rate:l}=r,s=i??_a,u=R=>o+(R-a)/l,c=e.points[t],m=e.points[t+1],f=u(m.t);if(f<=o)return null;let h=Math.max(o,u(c.t)),b=f-h;if(b<=0)return null;if(ex(c,n,i))return{kind:"ramp",time:f,value:s(m.v)};let v=tx(b),x=al(e,Math.max(c.t,a),m.t,v,n),_=new Float32Array(v);for(let R=0;R<v;R+=1)_[R]=s(x[R]??0);return{kind:"curve",time:h,duration:b,values:_}}function rx(e,t,n,r){let i=[];for(let a=0;a+1<e.points.length;a+=1){let l=nx(e,a,t,n,r);l&&i.push(l)}let o=i[0];return o?.kind==="curve"&&o.time<=n.scheduledAt||i.unshift({kind:"set",time:n.scheduledAt,value:(r??_a)(vn(e,n.elapsed,t))}),i}function ix(e,t){for(let n of t)if(n.kind==="set")e.setValueAtTime(n.value,n.time);else if(n.kind==="ramp")e.linearRampToValueAtTime(n.value,n.time);else try{e.setValueCurveAtTime(n.values,n.time,n.duration)}catch{let r=n.values[n.values.length-1]??0;e.linearRampToValueAtTime(r,n.time+n.duration)}}function Ta(e){for(let t of e)t.param.cancelScheduledValues(0)}function nr(e,t){for(let n of e)typeof n.param.cancelAndHoldAtTime=="function"?n.param.cancelAndHoldAtTime(t):n.param.cancelScheduledValues(t)}function Ra(e,t,n,r){if(t.points.length!==0)for(let i of e){if(Ta([i]),ol(t)){let o=(i.map??_a)(t.points[0].v);i.param.setValueAtTime(o,r.scheduledAt);continue}ix(i.param,rx(t,n,r,i.map))}}function Nd(e,t,n,r,i){let o=new Map(n.filter(l=>l.id).map(l=>[l.id,l.handle])),a=[];for(let l of e.lanes){let s=yn(l.target);if(!s)continue;let u=s.kind==="preset"?i?.[s.presetId]:s.kind==="fx"?o.get(s.nodeId)?.automation?.[s.param]:void 0;if(!u||u.length===0)continue;let c=Ki(l.target,t);c&&(Ra(u,l,c.scale,r),a.push(...u))}return a}function Ld(e){return e.lanes.find(t=>t.target===Ht)??null}var ox=`\nconst dbToLin = (db) => Math.pow(10, db / 20);\n\n/**\n * One-pole envelope followers, one per channel.\n *\n * Per channel matters: the followers advance once per sample, so a single shared\n * follower stepped once per channel per sample. On stereo that ran a 20 ms attack\n * as 10 ms, and gave the right channel a gain computed from an envelope that had\n * already traversed the left \\u2014 so the two channels ducked by different amounts\n * from the same input and the image pumped.\n */\nclass EnvBank {\n constructor(attackMs, releaseMs) { this.set(attackMs, releaseMs); this.values = []; }\n set(attackMs, releaseMs) {\n this.a = Math.exp(-1 / (sampleRate * Math.max(1e-5, attackMs / 1000)));\n this.r = Math.exp(-1 / (sampleRate * Math.max(1e-5, releaseMs / 1000)));\n }\n push(ch, x) {\n const prev = this.values[ch] ?? 0;\n const m = Math.abs(x);\n const c = m > prev ? this.a : this.r;\n const next = m + c * (prev - m);\n this.values[ch] = next;\n return next;\n }\n}\n\n/** Soft-knee gain computer in dB, matching acompressor\'s shape. */\nfunction kneeGain(envDb, thresholdDb, ratio, kneeDb) {\n const over = envDb - thresholdDb;\n if (kneeDb > 0 && over > -kneeDb && over < kneeDb) {\n const t = (over + kneeDb) / (2 * kneeDb);\n return -((1 - 1 / ratio) * kneeDb * t * t);\n }\n return over > 0 ? -(over * (1 - 1 / ratio)) : 0;\n}\n\n// log10/exp per sample is the single most expensive thing a dynamics processor\n// can do on the audio thread, and every sample below the knee needs neither:\n// its gain is exactly unity. Comparing envelopes in the linear domain lets the\n// quiet majority of samples skip the transcendentals entirely.\nconst LN10_OVER_20 = Math.LN10 / 20;\nconst dbToLinFast = (db) => Math.exp(db * LN10_OVER_20);\n\nclass HfCompressor extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 20, this.p.release ?? 250);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 20, this.p.release ?? 250);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const makeup = dbToLin(p.makeup ?? 0);\n const mix = p.mix ?? 1;\n // Knee is expressed as a ratio in FFmpeg; convert to dB width.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const thresholdDb = p.threshold ?? -24;\n const ratio = p.ratio ?? 4;\n // Below this the gain computer returns unity, so the sample needs no\n // logarithm at all.\n const kneeStartLin = dbToLin(thresholdDb - kneeDb);\n const dry = 1 - mix;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n // Per-channel follower, and the sub-knee shortcut: below the knee the\n // gain is exactly unity, so the sample needs no logarithm at all.\n const env = this.env.push(ch, x);\n if (env <= kneeStartLin) {\n out[n] = x * makeup * mix + x * dry;\n continue;\n }\n const envDb = 20 * Math.log10(env);\n const g = dbToLinFast(kneeGain(envDb, thresholdDb, ratio, kneeDb));\n out[n] = x * g * makeup * mix + x * dry;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-compressor", HfCompressor);\n\nclass HfLimiter extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 5, this.p.release ?? 50);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 5, this.p.release ?? 50);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const ceiling = dbToLin(this.p.limit ?? -1);\n const outGain = dbToLin(this.p.level_out ?? 0);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n // Only ever attenuate: a limiter that can raise level is a compressor.\n const g = env > ceiling ? ceiling / env : 1;\n out[n] = x * g * outGain;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-limiter", HfLimiter);\n\nclass HfGate extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 1, this.p.release ?? 100);\n this.gains = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 1, this.p.release ?? 100);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const threshold = dbToLin(p.threshold ?? -35);\n const floor = dbToLin(p.range ?? -24);\n const ratio = p.ratio ?? 10;\n // Knee is declared in the registry as a ratio, like the compressor\'s; a\n // hard threshold ignored it and chattered on material sitting right at the\n // gate point.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const kneeLin = dbToLin((p.threshold ?? -35) + kneeDb);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n let target = 1;\n // Above the threshold the gate is fully open; skip the pow entirely.\n if (env < threshold) {\n const under = env > 1e-9 ? threshold / env : 1e9;\n target = Math.max(floor, 1 / Math.pow(under, ratio - 1));\n if (!isFinite(target)) target = floor;\n }\n // Smooth toward the target so the gate does not click on every sample.\n const held = this.gains[ch] ?? 1;\n const c = target < held ? this.env.r : this.env.a;\n const smoothed = target + c * (held - target);\n this.gains[ch] = smoothed;\n out[n] = x * smoothed;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-gate", HfGate);\n\nclass HfBitcrush extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.holds = [];\n this.held = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const levels = Math.pow(2, (p.bits ?? 8) - 1);\n const step = Math.max(1, Math.round(p.samples ?? 1));\n const mix = p.mix ?? 1;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n if (this.held[ch] === undefined) this.held[ch] = 0;\n if (this.holds[ch] === undefined) this.holds[ch] = 0;\n for (let n = 0; n < inp.length; n++) {\n // Per channel: advancing one shared counter only on the last channel\n // left every earlier channel either unheld or frozen for a whole\n // 128-sample quantum, clicking once a block.\n if (this.holds[ch] === 0) this.held[ch] = Math.round(inp[n] * levels) / levels;\n out[n] = this.held[ch] * mix + inp[n] * (1 - mix);\n this.holds[ch] = (this.holds[ch] + 1) % step;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-bitcrush", HfBitcrush);\n\n/** Linear-interpolated read, \\`delaySamples\\` behind the write head. */\nfunction readTap(ring, write, delaySamples) {\n const len = ring.length;\n const pos = (write - 1 - delaySamples + len) % len;\n const i0 = Math.floor(pos);\n const frac = pos - i0;\n const i1 = (i0 + 1) % len;\n return ring[i0] * (1 - frac) + ring[i1] * frac;\n}\n\n/** Equal-power-ish crossfade, zero at a tap\'s reset point \\u2014 hides the splice. */\nfunction xfade(phase) {\n return Math.sin(Math.PI * phase);\n}\n\n/**\n * Dual-tap granular delay line: two read taps 180\\xB0 apart in a 100 ms grain,\n * each sweeping at a speed relative to the write head that shifts pitch\n * without changing duration. One tap is always fading in as the other fades\n * out, which hides the splice each tap makes when it wraps.\n *\n * write/phase are block-level state, advanced once per SAMPLE across all\n * channels together (not once per channel) \\u2014 advancing them inside the\n * per-channel loop would move the tap 2x/4x too fast on a stereo/quad input.\n */\nclass HfPitchshift extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.grain = Math.round(sampleRate * 0.1);\n this.buf = [];\n this.write = 0;\n this.phase = 0;\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const semitones = Math.max(-12, Math.min(12, p.semitones ?? 0));\n const mix = Math.max(0, Math.min(1, p.mix ?? 1));\n const ratio = Math.pow(2, semitones / 12);\n const grain = this.grain;\n const ringLen = grain * 2;\n const inc = (1 - ratio) / grain;\n const n = i[0] ? i[0].length : 0;\n for (let ch = 0; ch < i.length; ch++) {\n if (!this.buf[ch]) this.buf[ch] = new Float32Array(ringLen);\n }\n let write = this.write, phase = this.phase;\n for (let s = 0; s < n; s++) {\n phase += inc;\n phase -= Math.floor(phase);\n const phaseB = (phase + 0.5) % 1;\n const gA = xfade(phase), gB = xfade(phaseB);\n for (let ch = 0; ch < i.length; ch++) {\n const ring = this.buf[ch];\n const inp = i[ch], out = o[ch];\n const x = inp[s];\n ring[write] = x;\n const wet =\n readTap(ring, write, phase * grain) * gA + readTap(ring, write, phaseB * grain) * gB;\n out[s] = x * (1 - mix) + wet * mix;\n }\n write = (write + 1) % ringLen;\n }\n this.write = write;\n this.phase = phase;\n return true;\n }\n}\nregisterProcessor("hf-pitchshift", HfPitchshift);\n`,ka=new WeakMap;function Ma(e){return Dd.has(e)}var Dd=new WeakSet;function Fa(e){let t=ka.get(e);return t||(t=(async()=>{if(!e.audioWorklet)throw new Error("AudioWorklet is unavailable \\u2014 the page needs a secure context (https, localhost or file://)");let n=`data:text/javascript;base64,${btoa(String.fromCharCode(...new TextEncoder().encode(ox)))}`;await e.audioWorklet.addModule(n),Dd.add(e)})().catch(n=>{throw ka.delete(e),n}),ka.set(e,t)),t}function ax(e,t,n){let r=.6+Math.max(0,Math.min(1,t))*2.6,i=Math.max(1,Math.floor(e*r)),o=new Float32Array(i),a=Math.round(t*1e3)*2654435761+Math.round(n*1e3)*40503>>>0,l=()=>(a=a*1664525+1013904223>>>0,a/4294967295*2-1),s=Math.max(.001,1-Math.max(0,Math.min(1,n))),u=0,c=0;for(let f=0;f<i;f++){u+=s*(l()-u);let h=u*Math.pow(1-f/i,2.5);o[f]=h,c+=h*h}let m=Math.sqrt(c);if(m>0)for(let f=0;f<i;f++)o[f]=(o[f]??0)/m;return o}var ce=e=>typeof e=="number"?e:Number(e??0),Na=e=>e/1e3;function Gd(e,t,n,r){let i=Math.max(1,Math.round(e.sampleRate)),o=e.createBuffer(1,i,e.sampleRate),a=o.getChannelData(0);for(let u=0;u<i;u++){let c=u/i;a[u]=t==="sine"?Math.sin(2*Math.PI*c):4*Math.abs((c+.75)%1-.5)-1}let l=e.createBufferSource();l.buffer=o,l.loop=!0,l.playbackRate.value=n;let s=(r*n%1+1)%1*(i/e.sampleRate);return l.start(typeof e.currentTime=="number"?e.currentTime:0,s),l}function Hd(e){try{e.stop()}catch{}e.disconnect()}function La(e,t){return[{param:e},{param:t,map:n=>1-n}]}function Bd(e,t,n){e.gain.value=n,t.gain.value=1-n}function Da(e,t,n){return{input:e,output:e,update:t,automation:n,dispose:()=>e.disconnect()}}var sx=new Set(["peaking","highpass","lowpass"]),Id=e=>Math.pow(10,e/20),lx=(e,t)=>{let n=e.createGain(),r=i=>{n.gain.value=Id(ce(i.gain))};return r(t),Da(n,r,{gain:[{param:n.gain,map:Id}]})};function rr(e,t){return(n,r)=>{let i=n.createBiquadFilter();i.type=e;let o=a=>{i.frequency.value=ce(a.frequency),a.q!==void 0&&(i.Q.value=ce(a.q)),t&&(i.gain.value=ce(a.gain))};return o(r),Da(i,o,{frequency:[{param:i.frequency}],...sx.has(e)?{q:[{param:i.Q}]}:{},...t?{gain:[{param:i.gain}]}:{}})}}function ux(e){return(t,n)=>{let r=Math.tan(Math.PI*ce(n.frequency)/t.sampleRate),i=e==="highpass"?t.createIIRFilter([1/(1+r),-1/(1+r)],[1,(r-1)/(r+1)]):t.createIIRFilter([r/(1+r),r/(1+r)],[1,(r-1)/(r+1)]);return Da(i,()=>{})}}function ir(e){return(t,n)=>{let r=new AudioWorkletNode(t,e,{processorOptions:{...n}});return{input:r,output:r,update:i=>r.port.postMessage({...i}),dispose:()=>{r.port.postMessage({__hfDispose:!0}),r.disconnect()}}}}var cx={tanh:Math.tanh,atan:e=>2/Math.PI*Math.atan(Math.PI/2*e),cubic:e=>Math.abs(e)>=1?Math.sign(e):e-e**3/3,exp:e=>Math.sign(e)*(1-Math.exp(-Math.abs(e))),alg:e=>e/Math.sqrt(1+e*e),quintic:e=>Math.abs(e)>=1?Math.sign(e):e-e**5/5,sin:e=>Math.abs(e)>=1?Math.sign(e):Math.sin(Math.PI/2*e),erf:e=>Math.tanh(1.20211*e),hard:e=>Math.max(-1,Math.min(1,e))},dx=(e,t)=>{let n=e.createWaveShaper(),r=e.createGain(),i=e.createGain();r.connect(n).connect(i);let o=a=>{let l=cx[String(a.type)]??Math.tanh,s=Math.pow(10,ce(a.threshold)/20),u=8192,c=new Float32Array(u);for(let m=0;m<u;m++){let f=m/(u-1)*2-1;c[m]=l(f/Math.max(1e-6,s))*s}n.curve=c,n.oversample=ce(a.oversample)>=4?"4x":ce(a.oversample)>=2?"2x":"none",i.gain.value=Math.pow(10,ce(a.output)/20)};return o(t),{input:r,output:i,update:o,automation:{output:[{param:i.gain,map:a=>Math.pow(10,a/20)}]},dispose:()=>{r.disconnect(),n.disconnect(),i.disconnect()}}},fx=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createDelay(5),o=e.createGain(),a=e.createGain(),l=e.createGain();n.connect(i),i.connect(o),o.connect(i),i.connect(a).connect(r),n.connect(l).connect(r);let s=u=>{i.delayTime.value=Math.min(5,ce(u.time)/1e3),o.gain.value=ce(u.feedback),Bd(a,l,ce(u.mix))};return s(t),{input:n,output:r,update:s,automation:{time:[{param:i.delayTime,map:u=>Math.min(5,Na(u))}],feedback:[{param:o.gain}],mix:La(a.gain,l.gain)},dispose:()=>[n,r,i,o,a,l].forEach(u=>u.disconnect())}},mx=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createDelay(.5),a=Gd(e,"sine",ce(t.speed),n),l=e.createGain(),s=e.createGain(),u=e.createGain();a.connect(l).connect(o.delayTime),r.connect(o).connect(s).connect(i),r.connect(u).connect(i);let c=m=>{o.delayTime.value=ce(m.delay)/1e3,l.gain.value=ce(m.depth)/1e3,a.playbackRate.value=ce(m.speed),Bd(s,u,ce(m.mix))};return c(t),{input:r,output:i,update:c,automation:{delay:[{param:o.delayTime,map:Na}],depth:[{param:l.gain,map:Na}],speed:[{param:a.playbackRate}],mix:La(s.gain,u.gain)},dispose:()=>{Hd(a),[r,i,o,l,s,u].forEach(m=>m.disconnect())}}},px=6,hx=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createGain(),a=e.createGain(),l=Gd(e,String(t.type)==="1"?"sine":"triangle",ce(t.speed),n),s=e.createGain(),u=e.createGain(),c=e.createGain(),m=[];r.connect(o);let f=o;for(let b=0;b<px;b++){let v=e.createBiquadFilter();v.type="allpass",v.Q.value=.7071,s.connect(v.frequency),f.connect(v),f=v,m.push(v)}l.connect(s),f.connect(u).connect(a),o.connect(c).connect(a),a.connect(i);let h=b=>{let v=1e3/Math.max(.1,ce(b.delay));for(let x of m)x.frequency.value=v;s.gain.value=v*ce(b.decay),l.playbackRate.value=ce(b.speed),o.gain.value=ce(b.in_gain),a.gain.value=ce(b.out_gain),u.gain.value=1,c.gain.value=1};return h(t),{input:r,output:i,update:h,automation:{speed:[{param:l.playbackRate}],in_gain:[{param:o.gain}],out_gain:[{param:a.gain}]},dispose:()=>{Hd(l),[r,i,o,a,s,u,c,...m].forEach(b=>b.disconnect())}}},gx=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createConvolver(),o=e.createGain(),a=e.createGain();i.normalize=!1,n.connect(i).connect(o).connect(r),n.connect(a).connect(r);let l="",s=u=>{let c=`${ce(u.size)}:${ce(u.damping)}`;if(c!==l){let m=ax(e.sampleRate,ce(u.size),ce(u.damping)),f=e.createBuffer(1,m.length,e.sampleRate);f.getChannelData(0).set(m),i.buffer=f,l=c}o.gain.value=ce(u.wet),a.gain.value=ce(u.dry)};return s(t),{input:n,output:r,update:s,automation:{wet:[{param:o.gain}],dry:[{param:a.gain}]},dispose:()=>[n,r,i,o,a].forEach(u=>u.disconnect())}},bx={"gain-node":lx,"biquad-peaking":rr("peaking",!0),"biquad-lowshelf":rr("lowshelf",!0),"biquad-highshelf":rr("highshelf",!0),"biquad-highpass":rr("highpass",!1),"biquad-lowpass":rr("lowpass",!1),"worklet-compressor":ir("hf-compressor"),"worklet-limiter":ir("hf-limiter"),"worklet-gate":ir("hf-gate"),"worklet-bitcrush":ir("hf-bitcrush"),"worklet-pitchshift":ir("hf-pitchshift"),waveshaper:dx,"delay-feedback":fx,"chorus-lfo":mx,"allpass-phaser":hx,convolver:gx};function Ud(e){return e.nodes.some(t=>hn(t.type)?.web.startsWith("worklet-")??!1)}function xx(e,t,n,r=0){let i=hn(t);if(!i)throw new Error(`Unknown effect type: ${t}`);let o=gn(t,n);if((t==="highpass"||t==="lowpass")&&String(o.poles)==="1")return ux(t)(e,o,r);let a=bx[i.web];if(!a)throw new Error(`No Web Audio builder for ${i.web}`);return a(e,o,r)}function Pd(e){let t=[];for(let n of e){let r=n.fromPreset,i=t.at(-1);if(i&&i.preset===r)i.nodes.push(n);else{let o=typeof n.presetAmount=="number"?n.presetAmount:1;t.push({...r?{preset:r}:{},amount:Math.min(1,Math.max(0,o)),nodes:[n]})}}return t}function Od(e){return bn(e).map(t=>{let n=gn(t.type,t.params),r=n.poles!==void 0?`:${n.poles}`:"",i=String(n.poles)==="1"?`@${n.frequency}`:"",o=t.type==="phaser"?`~${n.type}`:"",a=t.fromPreset?`%${t.fromPreset}`:"";return`${t.type}${r}${i}${o}${a}`}).join("|")}function Wd(e,t,n=0){var m;let r=e.createGain(),i=e.createGain(),o=[],a=[],l=Pd(bn(t)),s=r;for(let f of l){let h=null;if(f.preset){let b=e.createGain(),v=e.createGain(),x=e.createGain(),_=e.createGain();x.gain.value=f.amount,v.gain.value=1-f.amount,s.connect(b),b.connect(v).connect(_),h={entry:b,wet:x,dry:v,join:_},s=b}for(let b of f.nodes){let v=xx(e,b.type,b.params??{},n);s.connect(v.input),s=v.output,o.push({...b.id?{id:b.id}:{},type:b.type,handle:v})}h&&f.preset&&(s.connect(h.wet).connect(h.join),a.push({id:f.preset,...h}),s=h.join)}s.connect(i);let u=Od(t),c={};for(let f of a)(c[m=f.id]??(c[m]=[])).push(...La(f.wet.gain,f.dry.gain));return{input:r,output:i,presets:c,nodes:o,update(f){if(Od(f)!==u)return!1;bn(f).forEach((b,v)=>{let x=o[v];x&&(x.handle.update(gn(b.type,b.params)),b.id===void 0?delete x.id:x.id=b.id)});let h=0;for(let b of Pd(bn(f))){if(!b.preset)continue;let v=a[h++];!v||v.id!==b.preset||(v.wet.gain.value=b.amount,v.dry.gain.value=1-b.amount)}return!0},dispose(){for(let{handle:f}of o)f.dispose();for(let{entry:f,wet:h,dry:b,join:v}of a)f.disconnect(),h.disconnect(),b.disconnect(),v.disconnect();r.disconnect(),i.disconnect()}}}var Vd={version:1,nodes:[]},zd={version:1,lanes:[]};function qd(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(Tt):null)??"";if(!n)return zd;try{return il(wr(n),t)}catch{return zd}}function or(e){let t=(typeof e.getAttribute=="function"?e.getAttribute(pn):null)??"";if(!t)return{chain:Vd,raw:""};try{return{chain:tl(t),raw:t}}catch{return{chain:Vd,raw:""}}}function $d(e){return qd(e,or(e).chain)}function ci(e,t,n,r,i){let{chain:o}=or(t),a=null,l=[],s=!1,u=0,c=()=>{try{a?(n.disconnect(a.input),a.output.disconnect(r),a.dispose()):n.disconnect(r)}catch{}a=null},m=(T,F)=>{if(T.nodes.length===0){n.connect(r);return}if(Ud(T)&&!Ma(e)){n.connect(r);let M=++u;Fa(e).then(()=>{s||M!==u||x(or(t).chain)}).catch(()=>{});return}try{let M=Wd(e,T,F);n.connect(M.input),M.output.connect(r),a=M}catch{n.connect(r)}},f=(T,F)=>{l=F&&a?Nd(qd(t,T),T,a.nodes,F,a.presets):[]},h=i?{...i}:null;m(o,h?.elapsed??0),f(o,h);let b=()=>{if(!h)return null;let T=typeof e.currentTime=="number"?e.currentTime:h.scheduledAt;return{scheduledAt:T,elapsed:h.elapsed+(T-h.scheduledAt)*h.rate,rate:h.rate}},v=T=>{let F=b();F&&(nr(l,F.scheduledAt),f(T,F))},x=T=>{let F=b();nr(l,F?.scheduledAt??0),c(),m(T,F?.elapsed??0),f(T,F)},_=null,R=t;return typeof MutationObserver<"u"&&typeof R?.nodeType=="number"&&(_=new MutationObserver(()=>{let T=or(t);l.length>0&&Ta(l),!a||!a.update(T.chain)?x(T.chain):v(T.chain)}),_.observe(R,{attributes:!0,attributeFilter:[pn,Tt]})),{setRate:T=>{let F=b();s||!F||!Number.isFinite(T)||T<=0||T===F.rate||(h={...F,rate:T},nr(l,F.scheduledAt),f(or(t).chain,h))},dispose:()=>{s=!0,_?.disconnect(),l.length>0&&nr(l,typeof e.currentTime=="number"?e.currentTime:0),a?.dispose()}}}function Ia(e){return!Number.isFinite(e)||e<=0?1:e}function yx(e,t){t||e.paused||!hr().__hfDebug||console.debug("[hyperframes] webAudioTransport claimed fallback-playing element:",e.currentSrc||e.getAttribute("src")||"")}function vx(e,t){let{elapsed:n,mediaStart:r,scheduledAt:i,globalRate:o,mediaRate:a,clipDuration:l}=t,s=Number.isFinite(l)&&l>0,u=l*a;if(n>=0){let m=n*a,f=u-m;return s&&f<=0?!1:(s?e.start(0,m+r,f):e.start(0,m+r),!0)}let c=-n/o;return s?e.start(i+c,r,u):e.start(i+c,r),!0}function Pa(e,t,n){let r=Ld($d(e));r&&Ra([{param:t.gain}],r,Cr.scale,n)}function ar(e){return e.sourceKind==="buffer"}var di=class{constructor(){pe(this,"_ctx",null);pe(this,"_bufferCache",new Map);pe(this,"_failedSrcs",new Set);pe(this,"_mediaElementSources",new WeakMap);pe(this,"_activeSources",[]);pe(this,"_masterGain",null);pe(this,"_masterVolume",1);pe(this,"_masterMuted",!1);pe(this,"_groups",new Map);pe(this,"_rateAnchorCtx",0);pe(this,"_rateAnchorComp",0);pe(this,"_rate",1);pe(this,"_paused",!0);pe(this,"_playGeneration",0);pe(this,"_soloed",new Set)}async init(){try{return this._ctx=new AudioContext,this._masterGain=this._ctx.createGain(),this._masterGain.connect(this._ctx.destination),this.applyMasterGain(),!0}catch{return!1}}get context(){return this._ctx}getTime(){return!this._ctx||this._paused?-1:this._rateAnchorComp+(this._ctx.currentTime-this._rateAnchorCtx)*this._rate}async decodeAudioElement(t){let n=t.currentSrc||t.getAttribute("src");if(!n)return null;if(this._bufferCache.has(n))return this._bufferCache.get(n);if(this._failedSrcs.has(n)||!this._ctx)return null;let r;try{let i=await fetch(n,{cache:"no-store"});if(!i.ok)return L("webAudioTransport.fetch",new Error(`${i.status} ${n}`)),null;r=await i.arrayBuffer()}catch(i){return L("webAudioTransport.fetch",i),null}try{let i=await this._ctx.decodeAudioData(r);return this._bufferCache.set(n,i),i}catch(i){return this._failedSrcs.add(n),L("webAudioTransport.decode",i),null}}startGeneration(){return this._playGeneration+=1,this._playGeneration}currentGeneration(){return this._playGeneration}connectThroughSolo(t,n,r,i,o){let a=t.createGain();return a.gain.value=Yn(this._soloed,r.id,Qt(r))?1:0,i.connect(a),a.connect(this.resolveDestination(r,o.scheduledAt,o.compositionTime,o.rate)??n),a}async scheduleMediaElementPlayback(t,n,r,i,o,a,l=1){if(!this._ctx||!this._masterGain||a!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),a!==this._playGeneration)return null;let s=this._mediaElementSources.get(t);s||(s=this._ctx.createMediaElementSource(t),this._mediaElementSources.set(t,s));let u=Ia(l),c=this._ctx.createGain();c.gain.value=o;let m=this._ctx.currentTime,f=i-n,h={scheduledAt:m,elapsed:f,rate:u},b=ci(this._ctx,t,s,c,h),v=this.connectThroughSolo(this._ctx,this._masterGain,t,c,{scheduledAt:m,compositionTime:i,rate:u});Pa(t,c,h),this._rate=u,this._rateAnchorCtx=m,this._rateAnchorComp=i;let x={fx:b,el:t,sourceNode:s,sourceKind:"media-element",gainNode:c,soloGain:v,compositionStart:n,mediaStart:r,scheduledAt:m,priorMuted:t.muted,priorVolume:t.volume,mediaPlaybackRate:_e(t),bounded:!1};return t.volume=1,this._activeSources.push(x),this._paused=!1,x}catch(s){return L("webAudioTransport.mediaElementSource",s),null}}groupInput(t,n,r){let i=this._groups.get(t);if(i)return i.input;if(!this._ctx||!this._masterGain)return null;let o=this._ctx.createGain(),a=this._ctx.createGain();a.connect(this._masterGain);let l=this._ctx.createAnalyser();l.fftSize=256,a.connect(l);let s=n.getElementById(t),u=this._ctx.createGain();u.gain.value=s?.hasAttribute("data-hidden")?0:1,u.connect(a);let c=ci(this._ctx,s??{getAttribute:()=>null},o,u,r);return s&&Pa(s,o,r),this._groups.set(t,{input:o,muteGain:u,analyser:l,levelBuf:new Float32Array(l.fftSize),dispose:()=>{try{c?.dispose(),o.disconnect(),u.disconnect(),a.disconnect(),l.disconnect()}catch{}}}),o}setGroupMuted(t,n){let r=this._groups.get(t);if(r)try{r.muteGain.gain.value=n?0:1}catch(i){L("webAudioTransport.setGroupMuted",i)}}groupIds(){return[...this._groups.keys()]}groupLevel(t){let n=this._groups.get(t);if(!n)return null;n.analyser.getFloatTimeDomainData(n.levelBuf);let r=0,i=!1;for(let o of n.levelBuf)r+=o*o,Math.abs(o)>=.99&&(i=!0);return{level:Math.sqrt(r/n.levelBuf.length),clipped:i}}resolveDestination(t,n,r,i){if(!this._masterGain)return null;let o=Qt(t);if(!o)return this._masterGain;let a={scheduledAt:n,elapsed:r,rate:i};return this.groupInput(o,t.ownerDocument,a)??this._masterGain}handleSourceEnded(t,n,r,i){let o=this._activeSources.indexOf(n);if(o!==-1){this._activeSources.splice(o,1),r.muted=i;try{t.disconnect(),n.fx?.dispose(),n.gainNode.disconnect(),n.soloGain.disconnect()}catch{}this._activeSources.length===0&&(this._paused=!0)}}async schedulePlayback(t,n,r,i,o,a,l,s=1,u=Number.POSITIVE_INFINITY){if(!this._ctx||!this._masterGain||l!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),l!==this._playGeneration)return null;let c=Ia(s),m=_e(t),f=c*m,h=this._ctx.createBufferSource();h.buffer=n,h.playbackRate.value=f;let b=this._ctx.createGain();b.gain.value=a;let v=o-r,x=this._ctx.currentTime,_={scheduledAt:x,elapsed:v,rate:c},R=ci(this._ctx,t,h,b,_),T=this.connectThroughSolo(this._ctx,this._masterGain,t,b,{scheduledAt:x,compositionTime:o,rate:c});if(Pa(t,b,_),this._rate=c,this._rateAnchorCtx=x,this._rateAnchorComp=o,!vx(h,{elapsed:v,mediaStart:i,scheduledAt:x,globalRate:c,mediaRate:m,clipDuration:u}))return h.disconnect(),R?.dispose(),b.disconnect(),T.disconnect(),null;let F=t.muted;t.muted=!0,yx(t,F);let M={fx:R,el:t,sourceNode:h,sourceKind:"buffer",gainNode:b,soloGain:T,compositionStart:r,mediaStart:i,scheduledAt:x,priorMuted:F,priorVolume:t.volume,mediaPlaybackRate:m,bounded:Number.isFinite(u)&&u>0};return this._activeSources.push(M),this._paused=!1,h.addEventListener("ended",()=>this.handleSourceEnded(h,M,t,F)),M}catch(c){return L("webAudioTransport.schedule",c),null}}setRate(t){let n=Ia(t);if(n===this._rate)return!1;this._ctx&&!this._paused&&(this._rateAnchorComp=this.getTime(),this._rateAnchorCtx=this._ctx.currentTime),this._rate=n;for(let r of this._activeSources)try{ar(r)&&(r.sourceNode.playbackRate.value=n*r.mediaPlaybackRate),r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate",i)}return!0}hasBoundedActiveSources(){return this._activeSources.some(t=>ar(t)&&t.bounded)}stopAll(){for(let t of this._activeSources){try{ar(t)&&t.sourceNode.stop(),t.sourceNode.disconnect(),t.fx?.dispose(),t.gainNode.disconnect(),t.soloGain.disconnect()}catch{}ar(t)?t.el.muted=t.priorMuted:t.el.volume=t.priorVolume}this._activeSources=[],this._paused=!0}setVolume(t){this._masterVolume=Math.max(0,Math.min(1,t)),this.applyMasterGain()}setElementVolume(t,n){let r=He(n);for(let i of this._activeSources)if(i.el===t)try{i.sourceKind==="media-element"&&(i.el.volume=1),i.gainNode.gain.value=r}catch(o){L("webAudioTransport.setElementVolume",o)}}setMuted(t){this._masterMuted=t,this.applyMasterGain()}applyMasterGain(){this._masterGain&&(this._masterGain.gain.value=this._masterMuted?0:this._masterVolume)}setSolo(t){this._soloed=t;for(let n of this._activeSources)try{n.soloGain.gain.value=Yn(this._soloed,n.el.id,Qt(n.el))?1:0}catch(r){L("webAudioTransport.setSolo",r)}}isActive(){return this._activeSources.length>0&&!this._paused}ownsElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t&&ar(n))}routesElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t)}destroy(){this.stopAll();for(let t of this._groups.values())t.dispose();if(this._groups.clear(),this._bufferCache.clear(),this._failedSrcs.clear(),this._mediaElementSources=new WeakMap,this._ctx)try{this._ctx.close()}catch{}this._ctx=null,this._masterGain=null,this._masterVolume=1,this._masterMuted=!1}};var jd="data-hf-studio-manual-edit-gesture";function Kd(e){return!Number.isInteger(e.tick)||e.tick<=0||e.tick%60!==0?!1:!(e.isPlaying&&e.hasCapturedTimeline&&e.currentTimeSeconds<2)}var Sx=/^\\s*spring\\(\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+))\\s*\\)\\s*$/;function Yd(e){return Math.max(0,Math.min(1,e))}function Xd(e){let t=Sx.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?Yd(n):null}function Jd(e,t){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let n=Yd(t),r=12-n*6,i=Math.PI*2*(1+n*1.5),o=1-Math.exp(-r)*Math.cos(i);return(1-Math.exp(-r*e)*Math.cos(i*e))/o}var Ax=/^\\s*wiggle\\(\\s*(\\d+)\\s*,\\s*(easeOut|easeInOut|anticipate|uniform)\\s*(?:,\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?)\\s*)?\\)\\s*$/,Ex=Math.PI*2;function Cx(e){let t=Ax.exec(e);if(!t)return null;let n=Number(t[1]);if(!Number.isSafeInteger(n)||n<1)return null;let r=t[2];if(r!=="easeOut"&&r!=="easeInOut"&&r!=="anticipate"&&r!=="uniform")return null;if(t[3]===void 0)return{wiggles:n,type:r};let i=Number(t[3]);return!Number.isFinite(i)||i<0||i>1?null:{wiggles:n,type:r,amplitude:i}}function wx(e,t,n,r){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let i=r??(n==="easeInOut"?.08:n==="uniform"?.14:n==="anticipate"?.12:.16),o=n==="easeInOut"?i*Math.sin(Math.PI*e):n==="uniform"?i:i*(1-e);return e+(n==="anticipate"?-1:1)*o*Math.sin(Ex*t*e)}function Qd(e,t){let n=Cx(e);if(!n)return null;let r=`${n.wiggles}:${n.type}:${n.amplitude??"default"}`,i=t?.get(r);if(i)return i;let o=a=>wx(a,n.wiggles,n.type,n.amplitude);return t?.set(r,o),o}var _x=24,Zd=e=>e>=1?1:0,Tx=e=>e,fi=String.raw`([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?)`,Rx=new RegExp(String.raw`^\\s*M\\s*0\\s*,\\s*0\\s+C\\s*${fi}\\s*,\\s*${fi}\\s+${fi}\\s*,\\s*${fi}\\s+1\\s*,\\s*1\\s*$`,"i");function ef(e,t,n){let r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function kx(e,t,n,r,i){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let o=0,a=1;for(let l=0;l<_x;l+=1){let s=(o+a)/2;ef(s,t,r)<e?o=s:a=s}return ef((o+a)/2,n,i)}function Mx(e){let t=Rx.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]),o=Number(t[4]);return Math.min(n,i)<0||Math.max(n,i)>1?null:a=>kx(a,n,r,i,o)}function Fx(e,t){if(!e.startsWith("spring("))return null;let n=Xd(e);if(n===null)return null;let r=t.get(n);if(r)return r;let i=o=>Jd(o,n);return t.set(n,i),i}function Nx(e,t){if(!e.startsWith("custom(")||!e.endsWith(")"))return null;let n=e.slice(7,-1),r=t.get(n);if(r)return r;let i=Mx(n);return i&&t.set(n,i),i}function tf(e){if(e.__hfCustomEaseInstalled)return!0;let t=e.parseEase;if(!t)return!1;let n=new Map,r=new Map,i=new Map,o=s=>typeof s!="string"?null:s==="hold"?Zd:Qd(s,i)??Fx(s,r)??Nx(s,n),a=(s,u,c=[])=>{let m=o(s);return m||(typeof s=="string"&&/^(?:hold|spring|wiggle|custom)(?:\\(|$)/.test(s.trim())&&Le("custom_ease_parse_failed",{ease:s}),t.call(u,s,...c)??Tx)};e.parseEase=function(u,...c){return a(u,this,c)};let l=e.registerEase;if(typeof l=="function"){l("hold",Zd);let s=u=>{let c=m=>m;c.config=(...m)=>a(`${u}(${m.join(",")})`,e),l(u,c)};s("spring"),s("wiggle"),s("custom")}return e.__hfCustomEaseInstalled=!0,!0}var Oa="data-hf-authored-duration",Ga="data-hf-authored-end",nf=!1;function st(e){if(e){if(typeof e.pause!="function"){nf||(nf=!0,Le("timeline_missing_pause",{}));return}try{e.pause()}catch(t){L("runtime.timeline.pause",t)}}}function Lx(){let e=window.__HF_EXPORT_RENDER_SEEK_CONFIG,t=e?.fps,n=e?.fpsSource,r=Number(t);return!e||t==null?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"missing"}:!Number.isFinite(r)||r<=0?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"invalid"}:{fps:r,source:n==="render-options"||n==="default"?n:"unknown",rawFpsSource:n,rawFps:t,fallbackReason:e.fpsFallbackReason}}function rf(){let e=Kl();hs(xe),Zr(document),pa(document),Zc(document);let t=Lx();e.canonicalFps=t.fps??e.canonicalFps,ms(e.canonicalFps),window.__HF_EXPORT_RENDER_SEEK_CONFIG&&console.info("[hyperframes] render runtime fps",{canonicalFps:e.canonicalFps,source:t.source,rawFpsSource:t.rawFpsSource,rawFps:t.rawFps,fallbackReason:t.fallbackReason});let n=null,r=null,i=null,o=[],a=new Set,l=null,s=new Set,u=(d,g,p)=>{s.has(d)||(s.add(d),Le(g,p))};if(typeof window.__hfRuntimeTeardown=="function")try{window.__hfRuntimeTeardown()}catch(d){L("runtime.init.site1",d)}let c=new ui;e.transportClock=c;let m=new di,f=!1;m.init().then(d=>{f=d});let h=new Set;window.__hf=window.__hf||{},window.__hf.setAudioSolo=d=>{h=new Set(d),m.setSolo(h)};let b=()=>{let d=window.gsap,g=window;if(!(!d?.registerPlugin||g.__hfAutoNoopRegistered))try{d.registerPlugin({name:"_auto",init:()=>!1}),g.__hfAutoNoopRegistered=!0}catch(p){u("auto_marker_install_failed","auto_marker_install_failed",{reason:"threw"}),L("runtime.autoMarker.install",p)}},v=()=>{let d=window.gsap;if(!d){u("custom_ease_missing_gsap","custom_ease_install_failed",{reason:"missing_gsap"});return}try{tf(d)||u("custom_ease_no_parse_ease","custom_ease_install_failed",{reason:"no_parseEase"})}catch(g){u("custom_ease_install_threw","custom_ease_install_failed",{reason:"threw"}),L("runtime.customEase.install",g)}};b(),v(),document.documentElement&&(document.documentElement.style.margin="0",document.documentElement.style.padding="0",document.documentElement.style.overflow="hidden"),document.body&&(document.body.style.margin="0",document.body.style.padding="0",document.body.style.overflow="hidden");try{As(document)}catch(d){L("runtime.init.cssVariables",d)}window.__timelines=window.__timelines||{};let x=()=>{let d=document.querySelector(\'[data-composition-id][data-root="true"]\');if(d instanceof HTMLElement)return d;let g=Array.from(document.querySelectorAll("[data-composition-id]"));return g.find(p=>!p.parentElement?.closest("[data-composition-id]"))??g[0]??null};if(Array.isArray(window.__timelines)){let d=window.__timelines,g=x()?.getAttribute("data-composition-id")??"root",p={};if(d.length===1)p[g]=d[0];else for(let y=0;y<d.length;y++)p[`tl-${y}`]=d[y];window.__timelines=p}let _=x();_&&!_.hasAttribute("data-start")&&_.setAttribute("data-start","0");let R=d=>{o.push(d)},T=(d,g,p)=>{let y=p??`${d}:${JSON.stringify(g)}`;a.has(y)||(a.add(y),xe({source:"hf-preview",type:"diagnostic",code:d,details:g}))},F=d=>{let g={scale:1,focusX:960,focusY:540},p=[],y=[],C={time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:d.play,pause:d.pause,seek:d.seek,getTime:d.getTime,getDuration:d.getDuration,isPlaying:d.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>g,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>p,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:d.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>y,getRenderState:()=>({...C,time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying()})}},M=1/60,E=.75,S=.05,A=100,w=240,N=d=>{if(d instanceof Error)return d.message||String(d);if(typeof d=="string")return d;try{return JSON.stringify(d)}catch{return String(d??"")}},I=d=>{let g=d.toLowerCase();return g.includes("cannot read properties of null")||g.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:g.includes("failed to execute \'queryselector\'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:g.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},W=d=>{if(d==null||d.trim()==="")return null;let g=Number.parseFloat(d);return!Number.isFinite(g)||g<=0?null:`${g}px`},U=()=>x(),oe=()=>{let d=U();if(!d)return;let g=W(d.getAttribute("data-width")),p=W(d.getAttribute("data-height"));g&&(d.style.width=g),p&&(d.style.height=p),g&&d.style.setProperty("--comp-width",g),p&&d.style.setProperty("--comp-height",p)},k=()=>{let d=U(),g=Array.from(document.querySelectorAll("[data-composition-id]")).filter(p=>p.hasAttribute("data-duration")||p.hasAttribute("data-end"));for(let p of g){if(d&&p===d)continue;let y=p.getAttribute("data-duration"),C=p.getAttribute("data-end");y!=null&&!p.hasAttribute(Oa)&&p.setAttribute(Oa,y),C!=null&&!p.hasAttribute(Ga)&&p.setAttribute(Ga,C),p.removeAttribute("data-duration"),p.removeAttribute("data-end")}},V=()=>{let d=U();if(!d)return;d.style.position||(d.style.position="relative"),d.style.overflow="hidden";let g=W(d.getAttribute("data-width")),p=W(d.getAttribute("data-height"));g&&(d.style.width=g),p&&(d.style.height=p);let y=Array.from(d.children);for(let C of y){let D=C.tagName.toLowerCase();if(D==="script"||D==="style"||D==="link"||D==="meta"||!C.hasAttribute("data-start")||C.hasAttribute("data-hf-autostamped"))continue;let B=(C.style.top==="0px"||C.style.top==="0")&&(C.style.left==="0px"||C.style.left==="0")&&C.style.width==="100%"&&C.style.height==="100%",ee=/translate\\(\\s*-50%\\s*,\\s*-50%\\s*\\)/.test(C.style.transform);if(B&&ee&&!C.hasAttribute("data-width")&&!C.hasAttribute("data-height")){let ye=C.style.top,un=C.style.left,we=C.style.width,cn=C.style.height;C.style.top="",C.style.left="",C.style.width="",C.style.height="";let ae=window.getComputedStyle(C);ae.top!=="auto"||ae.bottom!=="auto"||ae.left!=="auto"||ae.right!=="auto"||ae.width!=="0px"||ae.height!=="0px"||(C.style.top=ye,C.style.left=un,C.style.width=we,C.style.height=cn)}let $=window.getComputedStyle(C),de=$.position;if(de!=="absolute"&&de!=="fixed"&&(C.style.position="absolute"),!!C.style.top||!!C.style.bottom||$.top!=="auto"||$.bottom!=="auto"||(C.style.top="0"),!!C.style.left||!!C.style.right||$.left!=="auto"||$.right!=="auto"||(C.style.left="0"),D!=="audio"){let ye=W(C.getAttribute("data-width")),un=W(C.getAttribute("data-height")),we=$.width!=="0px"&&$.width!=="auto",cn=$.height!=="0px"&&$.height!=="auto";ye?!C.style.width&&!we&&(C.style.width=ye):!C.style.width&&$.width==="0px"&&(C.style.width="100%"),un?!C.style.height&&!cn&&(C.style.height=un):!C.style.height&&$.height==="0px"&&(C.style.height="100%")}}},J=(d,g=0,p)=>pt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:p?.includeAuthoredTimingAttrs??!0}).resolveStartForElement(d,g),H=(d,g)=>pt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:g?.includeAuthoredTimingAttrs??!0}).resolveDurationForElement(d),G=d=>{let g=d.closest("[data-composition-id]"),p=g?J(g,0):null,y=g?H(g,{includeAuthoredTimingAttrs:!0}):null;return{compositionRoot:g,inheritedStart:p,inheritedDuration:y}},z=d=>{let g=G(d),p=g.inheritedStart??0,y=Be(d.getAttribute("data-start"));if(d.hasAttribute("data-hf-auto-start")||y==null||p<=0)return J(d,p);let C=ve(d.getAttribute("data-duration")),D=g.inheritedDuration,B=D!=null&&D>0?p+D:null,ee=C!=null&&C>0?y+C:y;return(B==null?y>=p:y<B&&(ee>p||y===p))?y:p+y};window.__hfResolveMediaStartSeconds=z,o.push(()=>{window.__hfResolveMediaStartSeconds===z&&delete window.__hfResolveMediaStartSeconds});let X=(d,g)=>{let p=d.tagName.toLowerCase();if(p==="script"||p==="style"||p==="link"||p==="meta")return!1;let C=p==="video"||p==="audio"?z(d):J(d,0),D=H(d),B=d.getAttribute("data-composition-id");if(B){let $=(window.__timelines??{})[B],de=null;if($&&typeof $.duration=="function"){let ie=Number($.duration());Number.isFinite(ie)&&ie>0&&(de=ie)}!(d.hasAttribute("data-duration")||d.hasAttribute("data-end")||d.hasAttribute(Oa)||d.hasAttribute(Ga))&&(D==null||D<=0)&&de!=null&&(D=de)}let ee=D!=null&&D>0?C+D:Number.POSITIVE_INFINITY;return g>=C&&(Number.isFinite(ee)?g<ee:!0)},Ce=!!document.querySelector("[data-composition-src]"),q=!1;{let d=document.querySelectorAll("[data-composition-id]:not([data-composition-src])");for(let g of d){let p=g.getAttribute("data-composition-id");if(p&&g.children.length===0&&document.querySelector(`template#${CSS.escape(p)}-template`)){q=!0;break}}}let P=!Ce&&!q,O=d=>{if(!d||typeof d.duration!="function")return null;try{let g=Number(d.duration());return Number.isFinite(g)?Math.max(0,g):null}catch{return null}},j=d=>typeof d=="number"&&Number.isFinite(d)&&d>M,le=d=>{let g=ve(d.getAttribute("data-duration"));return g!=null&&g>0?g:Number.isFinite(d.duration)?tt(d,d.duration):null},Z=()=>{let d=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(d.length===0)return null;let g=0;for(let p of d){let y=z(p);if(!Number.isFinite(y))continue;let C=le(p);C==null||C<=M||(g=Math.max(g,Math.max(0,y)+C))}return g>M?g:null},K=()=>{let d=U();if(!d)return null;let g=window.__timelines??{},p=pt({timelineRegistry:g,includeAuthoredTimingAttrs:!0}),y=0,C=ve(d.getAttribute("data-duration"));C!=null&&C>0&&(y=C);let D=Array.from(d.querySelectorAll("[data-composition-id][data-start]"));for(let B of D){if(!(B instanceof Element)||B.parentElement?.closest("[data-composition-id]")!==d)continue;let $=p.resolveStartForElement(B,0),de=p.resolveDurationForElement(B);!Number.isFinite($)||de==null||de<=0||(y=Math.max(y,Math.max(0,$)+de))}return y>M?y:null},Y=()=>{let d=Z();return typeof d!="number"||!Number.isFinite(d)||d<=M?null:d},qe=d=>j(d)?Math.max(M,d*E):M,Fe=()=>{let d=0;for(let g of e.deterministicAdapters){let p=g.getInferredDurationSeconds;if(typeof p!="function")continue;let y=null;try{y=p()}catch(C){L("runtime.init.adapterDuration",C)}typeof y=="number"&&Number.isFinite(y)&&y>0&&(d=Math.max(d,y))}return d>M?d:null},ke=(d,g=0)=>{let p=O(d),y=Y(),C=K(),D=Fe(),B=Math.max(y??0,C??0,D??0),ee=Number.isFinite(g)&&g>M?g:0,$=0;return j(p)?$=Math.max(p,B,ee):j(B)?$=Math.max(B,ee):$=ee,$>0?Math.max(0,$):0},$e=()=>{let d=window.__timelines??{},g=ae=>{let ne=Object.entries(d).filter(se=>!!se[1]&&typeof se[1].play=="function"&&typeof se[1].pause=="function");if(ne.length!==1)return{timeline:null};let ge=ne[0];if(!ge)return{timeline:null};let[be,fe]=ge;return{timeline:fe,selectedTimelineIds:[be],selectedDurationSeconds:O(fe),diagnostics:{code:"root_timeline_sole_registered_fallback",details:{reason:ae,soleTimelineId:be}}}},p=pt({timelineRegistry:d,includeAuthoredTimingAttrs:!0}),y=Y(),C=K(),D=Math.max(y??0,C??0)||null,B=qe(D),ee=ae=>{let ne=document.querySelector(`[data-composition-id="${CSS.escape(ae)}"]`);return ne?p.resolveStartForElement(ne,0):0},$=ae=>{let ne=window.gsap;if(!ne||typeof ne.timeline!="function")return null;let ge=ne.timeline({paused:!0});for(let be of ae)ge.add(be.timeline,ee(be.compositionId));return ge},de=(ae,ne)=>{if(!j(ae))return null;let ge=window.gsap;if(!ge||typeof ge.timeline!="function")return null;let be=ge.timeline({paused:!0});if(ne)try{be.add(ne,0)}catch(se){L("runtime.init.site2",se)}let fe=be;if(typeof fe.to=="function")try{fe.to({},{duration:ae})}catch(se){L("runtime.init.site3",se)}return be},Ne=(ae,ne)=>{let ge=ae;if(typeof ge.getChildren!="function")return[];try{let be=ge.getChildren(!0,!0,!0)??[];if(!Array.isArray(be))return[];let fe=[];for(let se of ne)if(!be.some(et=>et===se.timeline))try{let et=ee(se.compositionId);ae.add(se.timeline,et),fe.push(se.compositionId)}catch(et){L("runtime.init.site4",et)}return fe}catch{return[]}},ie=U(),te=ie?.getAttribute("data-composition-id")??null;if(!te)return g("root_missing_composition_id");let ye=d[te]??null,we=(()=>{if(!ie)return[];let ae=new Set,ne=Array.from(ie.querySelectorAll("[data-composition-id]")),ge=[];for(let be of ne){let fe=be.getAttribute("data-composition-id");if(!fe||fe===te||ae.has(fe))continue;ae.add(fe);let se=d[fe]??null;if(!se||typeof se.play!="function"||typeof se.pause!="function")continue;let ut=O(se);ge.push({compositionId:fe,timeline:se,durationSeconds:ut??0})}return ge})(),cn=ae=>{for(let ne of ae){let ge=ne.timeline;if(typeof ge.paused=="function")try{ge.paused(!1)}catch(be){L("runtime.init.site5",be)}}};if(we.length>0&&cn(we),ye){let ae=we.length>0?Ne(ye,we):[];if((we.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id=\'"+te+"\'])"))&&(vi=!0),ae.length>0)try{let fe=ye.time();ye.seek(fe,!1)}catch{}let ne=O(ye);if(!j(ne)&&we.length>0){let fe=we.map(sm=>sm.compositionId),se=$(we),ut=O(se);if(se&&j(ut))return{timeline:se,selectedTimelineIds:fe,selectedDurationSeconds:ut,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:te,rootDurationSeconds:ne,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:B,selectedDurationSeconds:ut,mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:C,selectedTimelineIds:fe,autoNestedChildren:ae}}};let et=de(D??0,ye),Ni=O(et);if(et&&j(Ni))return{timeline:et,selectedTimelineIds:[te],selectedDurationSeconds:Ni,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:te,rootDurationSeconds:ne,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:C,selectedDurationSeconds:Ni,selectedTimelineIds:[te],autoNestedChildren:ae}}}}if(!j(ne)&&we.length===0){let fe=de(D??0,ye),se=O(fe);if(fe&&j(se))return{timeline:fe,selectedTimelineIds:[te],selectedDurationSeconds:se,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:te,rootDurationSeconds:ne,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:C,selectedDurationSeconds:se,selectedTimelineIds:[te]}}}}let ge=ve(ie?.getAttribute("data-duration")),be=Math.max(j(ge)?ge:0,C??0);if(be>0&&j(be)&&j(ne)&&be>=ne+.5){let fe=ye;if(typeof fe.to=="function")try{fe.to({},{duration:0},be)}catch(ut){L("runtime.init.site6",ut)}let se=O(ye);if(j(se))return{timeline:ye,selectedTimelineIds:[te],selectedDurationSeconds:se,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:te,rootDurationSeconds:ne,rootDeclaredDur:ge,authoredCompositionDurationFloorSeconds:C,newDur:se}}}}return{timeline:ye,selectedTimelineIds:[te],selectedDurationSeconds:ne,mediaDurationFloorSeconds:y,diagnostics:ae.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:te,selectedDurationSeconds:ne,autoNestedChildren:ae}}:void 0}}if(we.length>0){let ae=we.map(be=>be.compositionId),ne=$(we),ge=O(ne);if(ne)return{timeline:ne,selectedTimelineIds:ae,selectedDurationSeconds:ge,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:te,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:B,selectedDurationSeconds:ge,mediaDurationFloorSeconds:y,selectedTimelineIds:ae}}}}return g("root_composition_id_unmatched_in_registry")},vi=!1,Hf=d=>{let g=window.gsap,p=d;if(!(!p||typeof p.getChildren!="function"||!g||typeof g.parseEase!="function"))for(let y of p.getChildren(!0,!0,!0)){let C=y,D=C.timeline;if(!D||!("_ease"in D)||typeof D._ease=="function")continue;let B=C.vars?.keyframes,$=(B&&!Array.isArray(B)?B.ease:void 0)??C.vars?.ease??"none";try{let de=g.parseEase($);typeof de=="function"&&(D._ease=de)}catch(de){Le("keyframe_ease_repair_failed",{ease:typeof $=="string"?$:String($)}),L("runtime.keyframeEase.repair",de)}}},rn=()=>{if(v(),!P)return!1;let d=e.capturedTimeline,g=O(d),p=j(g);if(d&&p&&vi)return!1;let y=$e();if(!y.timeline)return!1;if(d&&d===y.timeline)return typeof d.timeScale=="function"&&d.timeScale(e.playbackRate),!1;e.capturedTimeline=y.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate),Hf(e.capturedTimeline);let C=ke(e.capturedTimeline,0);if(C<=0&&typeof e.capturedTimeline.progress=="function"&&(e.capturedTimeline.progress(1,!0),e.capturedTimeline.progress(0,!1),st(e.capturedTimeline)),C>0){try{c.setDuration(C)}catch{}if(typeof e.capturedTimeline.totalTime=="function"){typeof e.capturedTimeline.progress=="function"&&e.capturedTimeline.progress(1e-4,!0);let B=Math.max(0,e.currentTime||0);e.capturedTimeline.totalTime(B,!1),st(e.capturedTimeline)}let D=window.__hfStudioManualEditsApply;typeof D=="function"&&D(),Zr(document)}if(y.diagnostics&&xe({source:"hf-preview",type:"diagnostic",code:y.diagnostics.code,details:y.diagnostics.details}),xe({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:y.selectedTimelineIds??[],selectedDurationSeconds:y.selectedDurationSeconds??null,mediaDurationFloorSeconds:y.mediaDurationFloorSeconds??null}}),window.parent!==window){let D=U(),B=C>0?C:0,ee=String(B>0?B:1),$=new Set,de=new Set(document.querySelectorAll("[data-start]")),Ne=ie=>{let te=ie.parentElement;for(;te&&te!==D;){if(de.has(te))return!0;te=te.parentElement}return!1};if(e.capturedTimeline.getChildren)try{for(let ie of e.capturedTimeline.getChildren(!0))if(typeof ie.targets=="function")for(let te of ie.targets())te instanceof HTMLElement&&te!==D&&(te.hasAttribute("data-start")||Ne(te)||$.has(te)||($.add(te),te.setAttribute("data-start","0"),te.setAttribute("data-duration",ee),te.setAttribute("data-hf-autostamped","1")))}catch{}if(D instanceof HTMLElement)for(let ie of D.querySelectorAll("[id]"))ie instanceof HTMLElement&&ie!==D&&(ie.hasAttribute("data-start")||Ne(ie)||$.has(ie)||ie.tagName==="SCRIPT"||ie.tagName==="STYLE"||ie.tagName==="LINK"||($.add(ie),ie.setAttribute("data-start","0"),ie.setAttribute("data-duration",ee),ie.setAttribute("data-hf-autostamped","1")))}for(let D of on)ur.delete(D),Qa(D);return!0};window.__hfForceTimelineRebind=()=>{vi=!1,rn(),wi(e.currentTime)};let Bf=()=>{let d=U();if(!(d instanceof HTMLElement))return;let g=d.getBoundingClientRect(),p=Number(d.getAttribute("data-width")),y=Number(d.getAttribute("data-height")),C=window.getComputedStyle(d),D=Number.isFinite(p)&&p>0&&Number.isFinite(y)&&y>0,B=g.width<=0||g.height<=0||d.clientWidth<=0||d.clientHeight<=0;!D||!B||T("root_stage_layout_zero",{compositionId:d.getAttribute("data-composition-id")??null,declaredWidth:p,declaredHeight:y,rectWidth:Math.round(g.width),rectHeight:Math.round(g.height),clientWidth:d.clientWidth,clientHeight:d.clientHeight,display:C.display,visibility:C.visibility,overflow:C.overflow},`root-stage-layout-zero:${d.getAttribute("data-composition-id")??"unknown"}`)},Uf=()=>{e.tornDown||(l!=null&&window.cancelAnimationFrame(l),l=window.requestAnimationFrame(()=>{l=null,Bf()}))},Wf=()=>{r=d=>{let g=N(d.error??d.message).slice(0,w);if(!g)return;let p=I(g);xe({source:"hf-preview",type:"diagnostic",code:p.code,details:{category:p.category,message:g,filename:d.filename||null,line:Number.isFinite(d.lineno)?d.lineno:null,column:Number.isFinite(d.colno)?d.colno:null}})},i=d=>{let g=N(d.reason).slice(0,w);if(!g)return;let p=I(g);xe({source:"hf-preview",type:"diagnostic",code:`${p.code}_unhandled_rejection`,details:{category:`${p.category}-unhandled-rejection`,message:g}})},window.addEventListener("error",r),window.addEventListener("unhandledrejection",i)},Vf=()=>{let d=Array.from(document.querySelectorAll("img, video, audio, source, link[rel=\'stylesheet\']"));for(let p of d){let y=()=>{if(!(p instanceof Element))return;let C=p.tagName.toLowerCase(),D=p.getAttribute("src")??p.getAttribute("href")??p.getAttribute("poster")??null,B=C==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";T(B,{tagName:C,assetUrl:D,currentSrc:(p instanceof HTMLImageElement||p instanceof HTMLMediaElement)&&p.currentSrc||null,readyState:p instanceof HTMLMediaElement?p.readyState:null,networkState:p instanceof HTMLMediaElement?p.networkState:null},`${B}:${C}:${D??"unknown"}`)};p.addEventListener("error",y),R(()=>{p.removeEventListener("error",y)})}let g=document.fonts;g&&g.ready.then(()=>{if(e.tornDown)return;let p=Array.from(g).filter(y=>y.status==="error").map(y=>y.family).filter(y=>!!y).slice(0,10);p.length!==0&&T("runtime_font_load_issue",{failedFamilies:p,totalFaces:Array.from(g).length},`runtime-font-load-issue:${p.join("|")}`)}).catch(()=>{})},zf=(d,g)=>{if(!d.timeline)return!1;let p=e.capturedTimeline;if(p&&p===d.timeline)return!1;let y=Math.max(0,e.currentTime||0),C=e.isPlaying;e.capturedTimeline=d.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);try{st(e.capturedTimeline),typeof e.capturedTimeline.seek=="function"&&e.capturedTimeline.seek(y,!1),C&&typeof e.capturedTimeline.play=="function"&&e.capturedTimeline.play()}catch(D){L("runtime.init.site7",D)}return xe({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:g,previousTime:y,selectedTimelineIds:d.selectedTimelineIds??[],selectedDurationSeconds:d.selectedDurationSeconds??null,mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),!0},Et=null,Ka=!1,Ya=!1,on=new Set,ur=new WeakMap,cr=()=>{e.tornDown||(Et!=null&&window.clearTimeout(Et),Et=window.setTimeout(()=>{if(e.tornDown||(Et=null,Ya&&window.__HF_EXPORT_RENDER_SEEK_CONFIG))return;let d=$e();if(!d.timeline||!j(d.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){rn()&&(Ct(),Me(!0));return}if(Ka)return;let p=O(e.capturedTimeline),y=d.selectedDurationSeconds??O(d.timeline);j(y)&&(!j(p)||y>=p+S)&&zf(d,"manual")&&(Ka=!0,xe({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:p??null,selectedDurationSeconds:y??null,selectedTimelineIds:d.selectedTimelineIds??[],mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),Ct(),Me(!0))},A))},Xa=d=>{d.currentTarget instanceof HTMLMediaElement&&hl(d.currentTarget)},Ja=d=>{d.currentTarget instanceof HTMLMediaElement&&gl(d.currentTarget)},qf=()=>{for(let d of on)d.removeEventListener("loadedmetadata",cr),d.removeEventListener("durationchange",cr),d.removeEventListener("loadedmetadata",Xa),d.removeEventListener("error",Ja);on.clear()},Si=()=>{if(e.tornDown)return;let d=Array.from(document.querySelectorAll("video, audio"));for(let g of d){if(on.has(g))continue;on.add(g);let p=Number.parseFloat(g.dataset.volume??"");Number.isFinite(p)&&(g.volume=Math.max(0,Math.min(1,p))),g.addEventListener("loadedmetadata",cr),g.addEventListener("durationchange",cr),g.addEventListener("loadedmetadata",Xa),g.addEventListener("error",Ja),pl(g),g.preload!=="auto"&&(g.preload="auto"),g.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&g.load(),Qa(g)}},Qa=d=>{ur.has(d)||Js(d,e.capturedTimeline,ke(e.capturedTimeline,0),ur,{allowLiveTimelineSeek:!window.__HF_RENDER_CAPTURE_MODE})},Ai=new WeakMap,Za=d=>{let g=Ai.get(d);if(g!==void 0)return g;let p=window.getComputedStyle(d).position,y=p==="static"||p==="relative"||p==="sticky";return Ai.set(d,y),y},Ei=new WeakMap,$f=d=>{let g=Ei.get(d);if(g!==void 0)return g;let p=d.querySelector("[data-start]")===null;return Ei.set(d,p),p},jf=()=>{Ai=new WeakMap,Ei=new WeakMap},Ci=new WeakMap,dr=new WeakSet,fr=!1,es=d=>d.matches("audio[data-start]")||d.querySelector("audio[data-start]")!==null,ts=new WeakMap,Kf=()=>{for(let d of document.querySelectorAll(ha)){let g=d.hasAttribute("data-hidden");ts.get(d)!==g&&(ts.set(d,g),d.id&&m.setGroupMuted(d.id,g))}},wi=(d,g=Array.from(document.querySelectorAll("[data-start]")))=>{let p=U();for(let y of g){if(!(y instanceof HTMLElement))continue;if(y.hasAttribute("data-hidden")){dr.has(y)||(Ci.set(y,y.style.getPropertyValue("display")),dr.add(y),es(y)&&(fr=!0)),y.style.display="none",(y instanceof HTMLVideoElement||y instanceof HTMLImageElement)&&n?.setSourceVisibility(y,!1);continue}if(dr.has(y)){let D=Ci.get(y);D?y.style.display=D:y.style.removeProperty("display"),Ci.delete(y),dr.delete(y),es(y)&&(fr=!0)}let C=X(y,d);if(C){let D=y.parentElement;for(;D&&D!==p;){if(D instanceof HTMLElement&&D.hasAttribute("data-start")&&!X(D,d)){C=!1;break}D=D.parentElement}}y.style.visibility=C?"visible":"hidden",(y instanceof HTMLVideoElement||y instanceof HTMLImageElement)&&n?.setSourceVisibility(y,C),C?Za(y)&&y.style.removeProperty("display"):Za(y)&&$f(y)&&(y.style.display="none")}fr&&c.isPlaying()&&Mi(),fr=!1,Kf()},Pe=()=>{let d=ul({shouldIncludeElement:p=>p.hasAttribute("data-start")||!!G(p).compositionRoot,resolveStartSeconds:p=>z(p),resolveDurationSeconds:p=>{let y=G(p),C=z(p),D=y.inheritedStart!=null&&y.inheritedDuration!=null&&y.inheritedDuration>0?Math.max(0,y.inheritedStart+y.inheritedDuration-C):null,B=Number.isFinite(p.duration)?tt(p,p.duration):null,ee=ve(p.dataset.duration),$=ee!=null&&ee>0?ee:null;return ll({isVideo:p.tagName==="VIDEO",sourceDuration:B,hostRemaining:D,explicitDuration:$})}});for(let p of d.mediaClips){let y=ur.get(p.el);y&&(p.volumeKeyframes=y)}let g=e.mediaForceSyncNextTick;g&&(e.mediaForceSyncNextTick=!1),e.nativeMediaSyncDisabled||cl({clips:d.mediaClips,timeSeconds:e.currentTime,playing:e.isPlaying,playbackRate:e.playbackRate,outputMuted:e.mediaOutputMuted,userMuted:e.bridgeMuted,userVolume:e.bridgeVolume,forceSync:g,onElementVolume:(p,y,C)=>m.setElementVolume(p,C),isWebAudioOwned:p=>m.ownsElement(p),isWebAudioRouted:p=>m.routesElement(p),isAudibleUnderSolo:p=>Yn(h,p.id,Qt(p)),onAutoplayBlocked:()=>{e.mediaAutoplayBlockedPosted||(e.mediaAutoplayBlockedPosted=!0,xe({source:"hf-preview",type:"media-autoplay-blocked"}))}}),wi(e.currentTime)},Me=d=>{let g=Math.max(0,Math.round((e.currentTime||0)*e.canonicalFps)),p=Date.now();(d||g!==e.bridgeLastPostedFrame||e.isPlaying!==e.bridgeLastPostedPlaying||e.bridgeMuted!==e.bridgeLastPostedMuted||p-e.bridgeLastPostedAt>=e.bridgeMaxPostIntervalMs)&&(e.bridgeLastPostedFrame=g,e.bridgeLastPostedPlaying=e.isPlaying,e.bridgeLastPostedMuted=e.bridgeMuted,e.bridgeLastPostedAt=p,xe({source:"hf-preview",type:"state",frame:g,isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},_i="",ns=0,Yf=()=>{let d="";for(let g of document.querySelectorAll("[data-start]"))d+=`${g.id}:${g.tagName}|`;return d},Ct=()=>{k(),oe(),V();let d=U();if(d){let y=W(d.getAttribute("data-width")),C=W(d.getAttribute("data-height")),D=y?parseInt(y,10):0,B=C?parseInt(C,10):0;D>0&&B>0&&xe({source:"hf-preview",type:"stage-size",width:D,height:B})}rn();let g=Zl({canonicalFps:e.canonicalFps});window.__clipManifest=g;let p=Yf();if(_i!==p&&jf(),!window.__clipTree||_i!==p){let y=window;window.__clipTree=Yl({startResolver:pt({timelineRegistry:y.__timelines??{},includeAuthoredTimingAttrs:!0}),timelineRegistry:y.__timelines??{},rootDuration:g.durationInFrames/e.canonicalFps}),_i=p}xe(g),Uf()},Xf=()=>{let d=m.groupIds();if(d.length===0)return;let g=d.map(p=>{let y=m.groupLevel(p);return y?{groupId:p,...y}:null}).filter(p=>p!==null);g.length!==0&&xe({source:"hf-preview",type:"group-levels",levels:g})},Ti=d=>typeof d=="number"&&Number.isFinite(d)&&d>0?d:0,Jf=d=>{let g=Ti(Number(d));if(g<=0)return;let p=U(),y=Ti(ve(p?.getAttribute("data-duration"))),C=Math.max(ns,Ti(c.getDuration()),y);g<=C||(ns=g,p?.setAttribute("data-duration",String(g)),c.setDuration(g),Ct(),Me(!0))},Oe=(d,g=0)=>{for(let p of e.deterministicAdapters){try{d==="discover"&&p.discover(),d==="pause"&&p.pause(),d==="play"&&p.play&&p.play()}catch(y){L("runtime.init.site8",y)}if(d==="discover")try{p.seek({time:g,suppressEvents:!0})}catch(y){L("runtime.init.site9",y)}}},wt=()=>{window.__renderReady=!1},an=null,sn=!0,Qf=()=>{let d=[];for(let g of e.deterministicAdapters){let p=g.getReadyPromise;if(typeof p=="function")try{let y=p();y&&d.push(y)}catch(y){L("runtime.init.adapterReady",y)}}return d},Zf=()=>{let d=Qf();if(d.length===0)return an=null,sn=!0,!0;let g=d[0];if(!g)return!0;let p=d.length===1?g:Promise.all(d);return p!==an&&(an=p,sn=!1,Promise.resolve(p).then(()=>{an===p&&(sn=!0,wt())},y=>{an===p&&(sn=!0,L("runtime.init.adapterReady",y),wt())})),sn};if(P)sa();else{let d={injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,injectedLinks:e.injectedCompLinks,parseDimensionPx:W,onDiagnostic:({code:g,details:p})=>{xe({source:"hf-preview",type:"diagnostic",code:g,details:p})}};zc(d).then(()=>Vc(d)).finally(()=>{P=!0,Si(),Vf(),sa(),pa(document),wt()})}let mr=zl({postMessage:d=>xe(d)});mr.installPickerApi(),wi(e.currentTime,Array.from(document.querySelectorAll("video[data-start], img[data-start]")));let je=Fd();n=je,R(()=>{je.destroy(),n=null});let Ri=d=>{let g=Number(d);!Number.isFinite(g)||g<=0?e.playbackRate=1:e.playbackRate=Math.max(.1,Math.min(5,g)),e.mediaForceSyncNextTick=!0,e.capturedTimeline&&typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);let p=document.querySelectorAll("video, audio");for(let y of p)if(y instanceof HTMLMediaElement)try{y.playbackRate=e.playbackRate}catch(C){L("runtime.init.site10",C)}},rs={play:()=>{let d=e.capturedTimeline;if(c.isPlaying())return;let g=ke(d,0);if(g>0)c.setDuration(g),c.reachedEnd()&&(c.seek(0),e.currentTime=0,_t(0));else{let p=U(),y=Number(p?.getAttribute("data-duration")??0);y>0&&c.setDuration(y)}st(d),c.play()&&(e.isPlaying=!0,e.mediaForceSyncNextTick=!0,us(c.now()),f&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&Mi(),Oe("play"),Pe(),je.redraw(),Me(!0))},pause:()=>{if(!c.isPlaying())return;m.stopAll(),c.detachAudioSource(),c.pause(),e.isPlaying=!1,e.currentTime=c.now(),e.mediaForceSyncNextTick=!0,us(e.currentTime);let d=e.capturedTimeline;st(d),Oe("pause"),Pe(),je.redraw(),Me(!0)},seek:(d,g)=>{let p=zt(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),c.detachAudioSource();let y=c.isPlaying();y&&c.pause(),c.seek(p),e.currentTime=c.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0;let C=e.capturedTimeline;if(st(C),_t(e.currentTime),Oe("pause"),g?.keepPlaying&&y){rs.play();return}Pe(),je.redraw(),Me(!0)},renderSeek:(d,g)=>{Ya=!0;let p=zt(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),c.detachAudioSource(),c.isPlaying()&&c.pause(),c.seek(p),e.currentTime=c.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0,_t(e.currentTime,{activateChildren:!0,suppressEvents:g?.suppressEvents}),Oe("pause"),Pe(),je.redraw(),Me(!0)},getTime:()=>c.now(),getDuration:()=>{let d=c.getDuration();return Number.isFinite(d)?d:0},isPlaying:()=>c.isPlaying(),setPlaybackRate:d=>{Ri(d),c.setRate(e.playbackRate),cs()},getPlaybackRate:()=>e.playbackRate},is=ke(e.capturedTimeline,0);is>0&&c.setDuration(is);let Ge=jl({getTimeline:()=>e.capturedTimeline,setTimeline:d=>{e.capturedTimeline=d},getTimelineRegistry:()=>window.__timelines??{},getIsPlaying:()=>e.isPlaying,setIsPlaying:d=>{e.isPlaying!==d&&(e.mediaForceSyncNextTick=!0),e.isPlaying=d},getPlaybackRate:()=>e.playbackRate,setPlaybackRate:Ri,getCanonicalFps:()=>e.canonicalFps,onSyncMedia:(d,g)=>{e.currentTime=Math.max(0,Number(d)||0),e.isPlaying!==g&&(e.mediaForceSyncNextTick=!0),e.isPlaying=g,Pe()},onStatePost:Me,onDeterministicSeek:(d,g)=>{for(let p of e.deterministicAdapters)if(!(p.name==="gsap"&&e.capturedTimeline))try{p.seek({time:Number(d)||0,suppressEvents:g?.suppressEvents})}catch(y){L("runtime.init.site11",y)}},onDeterministicPause:()=>Oe("pause"),onDeterministicPlay:()=>Oe("play"),onRenderFrameSeek:()=>{je.redraw()},onShowNativeVideos:()=>{},getSafeDuration:()=>ke(e.capturedTimeline,0),transport:rs});window.__player=F(Ge),window.__playerReady=!0,Le("composition_loaded",{duration:Ge.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),e.deterministicAdapters=[Ws(),Cs({resolveStartSeconds:d=>J(d,0)}),_s(),Rs(),Fs(),Ns(),Ls(),Ds(),Is(),Ps(),Os(),ws({getTimeline:()=>e.capturedTimeline})],Bs(),Us(),window.__hfReseekGpu=d=>{let g=Math.max(0,Number(d)||0);window.__hfThreeTime=g,window.__hfTypegpuTime=g,Sr(g)},window.__hfWaitForSeekCompletion=Vi,o.push(()=>{window.__hfWaitForSeekCompletion===Vi&&delete window.__hfWaitForSeekCompletion}),Wf(),Si(),Oe("discover");let em=()=>{let d=e.capturedTimeline,g=rn();e.capturedTimeline&&(g||e.capturedTimeline!==d||!Ge._timeline)&&(Ge._timeline=e.capturedTimeline);let p=ke(e.capturedTimeline,0);if(p>0&&c.setDuration(p),Oe("discover",e.currentTime),!e.capturedTimeline){let y=window.__timelines??{},C=Object.keys(y).filter(D=>y[D]);if(C.length>0){let B=U()?.getAttribute("data-composition-id")??null;T("root_timeline_unbound_registry_present",{reason:B?"root data-composition-id has no matching key in window.__timelines":"root composition element has no data-composition-id attribute",rootCompositionId:B,registeredTimelineKeys:C},"root_timeline_unbound_registry_present"),console.warn("[hyperframes] Root timeline not bound \\u2014 render will freeze at t=0. "+(B?`Root data-composition-id is "${B}" but window.__timelines has no such key. `:"Root composition element has no data-composition-id. ")+`Registered timeline keys: [${C.join(", ")}]. Register the root timeline under its data-composition-id (window.__timelines["${B??"<root-id>"}"] = tl).`)}}window.__renderReady=!0,Ct(),Me(!0)},It=null,tm=()=>{if(It)return;let d=()=>{window.removeEventListener("hf-timelines-built",d),It=null,wt()};It=d,window.addEventListener("hf-timelines-built",d)};R(()=>{It&&(window.removeEventListener("hf-timelines-built",It),It=null)}),wt=()=>{if(!P){window.__renderReady=!1;return}if(window.__hfTimelinesBuilding){window.__renderReady=!1,tm();return}if(Oe("discover",e.currentTime),!Zf()){window.__renderReady=!1;return}em()},wt(),P&&setTimeout(()=>{wt()},0);let pr=0,ki=!1,nm=(d,g,p,y)=>{try{let C=y?.suppressEvents===!0;st(d),typeof d.totalTime=="function"?d.totalTime(g,C):d.seek(g,C)}catch(C){L(p,C)}},rm=(d,g)=>{let p=window.__timelines??{},y=U()?.getAttribute("data-composition-id")??null;for(let[C,D]of Object.entries(p)){if(!D||C===y)continue;let B=document.querySelector(`[data-composition-id="${CSS.escape(C)}"]`);if(!B)continue;let ee=J(B,0);if(!Number.isFinite(ee))continue;let $=O(D),de=Ye(B)+Math.max(0,d-ee)*_e(B),Ne=Math.max(0,$!=null&&$>0?Math.min($,de):de);nm(D,Ne,"runtime.init.transport.childTimeline",g)}},os=d=>{let g=window.__timelines??{};for(let p of Object.values(g))if(!(!p||p===d))try{p.play()}catch(y){L("runtime.init.activateSiblings",y)}},as=d=>typeof d=="object"&&d!==null,ln=new WeakMap,im=["onStart","onUpdate","onComplete","onReverseComplete","onRepeat"],ss=(d,g)=>{let p=d[g];if(typeof p!="function")return null;try{let y=Number(p.call(d));return Number.isFinite(y)?y:null}catch(y){return L("runtime.init.gsapCallbackDuration",y),null}},om=d=>{let g=ln.get(d);if(g!=null)return g;if(!("getChildren"in d)||typeof d.getChildren!="function")return!1;let p;try{p=d.getChildren(!0,!0,!0)}catch(y){return L("runtime.init.gsapCallbackChildren",y),ln.set(d,!1),!1}if(!Array.isArray(p))return ln.set(d,!1),!1;for(let y of p){if(!as(y))continue;let C=y.vars;if(!as(C)||!im.some($=>typeof C[$]=="function"))continue;let ee=ss(y,"totalDuration")??ss(y,"duration");if(ee!=null&&ee<=1e-6)return ln.set(d,!0),!0}return ln.set(d,!1),!1};function _t(d,g){let p=e.capturedTimeline,y=g?.suppressEvents===!0;if(p){g?.activateChildren&&os(p);let C=p,D=d;if(typeof C.totalDuration=="function")try{let B=Number(C.totalDuration());Number.isFinite(B)&&B>0&&d>B&&(D=B)}catch(B){L("runtime.init.transport.clampDuration",B)}try{typeof p.totalTime=="function"?(p.totalTime(D,y),!y&&!om(p)&&(p.totalTime(D+.001,!0),p.totalTime(D,!0))):p.seek(D,y)}catch(B){L("runtime.init.transport.seek",B)}}rm(d,g),p&&g?.activateChildren&&os(p);for(let C of e.deterministicAdapters)if(!(C.name==="gsap"&&p))try{C.seek({time:d,suppressEvents:y})}catch(D){L("runtime.init.transport.adapter",D)}}let am=()=>{try{return document.querySelector(`[${jd}]`)!=null}catch{return!1}},ls=()=>{if(!(e.tornDown||ki)){ki=!0;try{if(e.transportRafId=window.requestAnimationFrame(ls),pr+=1,Kd({tick:pr,isPlaying:c.isPlaying(),hasCapturedTimeline:e.capturedTimeline!=null,currentTimeSeconds:c.now()})){let g=e.capturedTimeline;if(rn()){e.capturedTimeline&&!Ge._timeline&&(Ge._timeline=e.capturedTimeline),e.capturedTimeline&&e.capturedTimeline!==g&&st(e.capturedTimeline);let p=ke(e.capturedTimeline,0);p>0&&c.setDuration(p),Ct()}}if(pr%20===0&&Ct(),pr%30===0&&Si(),c.isPlaying()&&Xf(),e.capturedTimeline){let g=ke(e.capturedTimeline,0);g>0&&(!c.isPlaying()||g>=c.getDuration())&&c.setDuration(g)}if(c.isPlaying()&&!e.mediaOutputMuted)if(!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&m.isActive()&&m.context){let g=m.getTime();g>=0&&c.attachAudioSource({currentTimeSeconds:g})}else{let g=document.querySelectorAll("audio[data-start]"),p=!1;for(let y of g){if(!(y instanceof HTMLMediaElement)||!y.isConnected||y.closest("[data-hidden]"))continue;let C=Number.parseFloat(y.dataset.start??""),D=ve(y.dataset.duration),B=D!=null&&D>0?C+D:1/0,ee=Ye(y);if(Number.isFinite(C)&&e.currentTime>=C&&e.currentTime<B){y.paused?!y.error&&y.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&(c.attachAudioSource({currentTimeSeconds:e.currentTime}),p=!0):(c.attachAudioSource({el:y,compositionStart:C,mediaStart:ee}),p=!0);break}}!p&&c.hasAudioSource()&&c.detachAudioSource()}else c.hasAudioSource()&&c.detachAudioSource();let d=c.now();if(e.currentTime=d,(c.isPlaying()||!am())&&_t(d),c.isPlaying()&&je.redrawAnimated(),c.isPlaying()&&c.reachedEnd()){m.stopAll(),c.detachAudioSource(),c.pause(),e.isPlaying=!1;let g=c.getDuration();Number.isFinite(g)&&(c.seek(g),e.currentTime=g,_t(g)),Oe("pause"),Pe(),Me(!0);return}c.isPlaying()&&Pe(),Me(!1)}finally{ki=!1}}},us=d=>{let g=document.querySelectorAll("video, audio");for(let p of g){if(!(p instanceof HTMLMediaElement)||!p.isConnected)continue;let y=Number.parseFloat(p.dataset.start??"");if(!Number.isFinite(y))continue;let C=ve(p.dataset.duration),D=C!=null&&C>0?y+C:1/0;if(d<y||d>=D)continue;let B=Ye(p),ee=d-y+B;if(ee>=0)try{p.currentTime=ee}catch{}}},Mi=()=>{if(e.nativeMediaSyncDisabled||e.webAudioMediaDisabled)return;let d=m.startGeneration(),g=document.querySelectorAll("audio[data-start]");for(let p of g){if(!(p instanceof HTMLMediaElement)||!p.isConnected||p.closest("[data-hidden]"))continue;let y=Number.parseFloat(p.dataset.start??"");if(!Number.isFinite(y))continue;let C=Ye(p),D=Number.parseFloat(p.dataset.volume??""),B=Number.isFinite(D)?D:1,ee=ve(p.dataset.duration),$=ee!=null&&ee>0?ee:Number.POSITIVE_INFINITY,de=p.closest("[data-composition-id]");if(de){let Ne=J(de,0),ie=H(de,{includeAuthoredTimingAttrs:!0});ie!=null&&ie>0&&($=Math.min($,Math.max(0,Ne+ie-y)))}m.scheduleMediaElementPlayback(p,y,C,c.now(),B,d,e.playbackRate).then(Ne=>{if(Ne||!c.isPlaying())return;let ie=e.playbackRate*_e(p),te=p.hasAttribute("data-fx-chain")||p.hasAttribute("data-automation");if(Math.abs(ie-1)>1e-9){te&&(p.muted=!0);return}m.decodeAudioElement(p).then(ye=>{!ye||!c.isPlaying()||m.schedulePlayback(p,ye,y,C,c.now(),B,d,e.playbackRate,$)})})}};function cs(){m.setRate(e.playbackRate)&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&f&&c.isPlaying()&&m.hasBoundedActiveSources()&&(m.stopAll(),Mi())}if(e.capturedTimeline){let d=ke(e.capturedTimeline,0);d>0&&c.setDuration(d),st(e.capturedTimeline)}Xc(window),e.transportRafId=window.requestAnimationFrame(ls),Ct(),Me(!0),e.controlBridgeHandler=ps({onPlay:()=>{Ge.play(),Le("composition_played",{time:Ge.getTime()})},onPause:()=>{Ge.pause(),Le("composition_paused",{time:Ge.getTime()})},onStopMedia:()=>{m.stopAll();let d=document.querySelectorAll("video, audio");for(let g of d)g instanceof HTMLMediaElement&&!g.paused&&g.pause()},onSeek:(d,g)=>{Ge.seek(d),Le("composition_seeked",{time:d})},onSetMuted:d=>{e.bridgeMuted=d;let g=d||e.mediaOutputMuted;m.setMuted(g);let p=document.querySelectorAll("video, audio");for(let y of p)y instanceof HTMLMediaElement&&(y.muted=g||y.defaultMuted)},onSetVolume:d=>{e.bridgeVolume=d,m.setVolume(d);let g=document.querySelectorAll("video, audio");for(let p of g){if(!(p instanceof HTMLMediaElement))continue;let y=parseFloat(p.dataset.volume??""),C=Number.isFinite(y)?y:1;p.volume=Math.max(0,Math.min(1,C*d))}},onSetMediaOutputMuted:d=>{e.mediaOutputMuted=d;let g=d||e.bridgeMuted;m.setMuted(g);let p=document.querySelectorAll("video, audio");for(let y of p)y instanceof HTMLMediaElement&&(y.muted=g||y.defaultMuted)},onSetNativeMediaSyncDisabled:d=>{e.nativeMediaSyncDisabled!==d&&(e.nativeMediaSyncDisabled=d,e.mediaForceSyncNextTick=!0,d?(m.stopAll(),c.detachAudioSource()):Pe())},onSetWebAudioMediaDisabled:d=>{e.webAudioMediaDisabled!==d&&(e.webAudioMediaDisabled=d,e.mediaForceSyncNextTick=!0,d&&(m.stopAll(),c.detachAudioSource()),Pe())},onSetPlaybackRate:d=>{Ri(d),e.transportClock&&e.transportClock.setRate(e.playbackRate),cs()},onSetRootDuration:Jf,onSetColorGrading:(d,g)=>{je.setGrading(d,g)},onSetColorGradingCompare:(d,g)=>{je.setCompare(d,g)},onTick:()=>{if(e.tornDown||!c.isPlaying())return;let d=c.now();if(e.currentTime=d,_t(d),c.reachedEnd()){m.stopAll(),c.detachAudioSource(),c.pause(),e.isPlaying=!1;let g=c.getDuration();Number.isFinite(g)&&(c.seek(g),e.currentTime=g,_t(g)),Oe("pause"),Pe(),Me(!0)}},onEnablePickMode:()=>mr.enablePickMode(),onDisablePickMode:()=>mr.disablePickMode(),getCanonicalFps:()=>e.canonicalFps});let Fi=()=>{if(!e.tornDown){e.tornDown=!0,e.transportRafId!=null&&(window.cancelAnimationFrame(e.transportRafId),e.transportRafId=null),e.transportClock=null,m.destroy(),Et!=null&&(window.clearTimeout(Et),Et=null),l!=null&&(window.cancelAnimationFrame(l),l=null),qf(),e.controlBridgeHandler&&(window.removeEventListener("message",e.controlBridgeHandler),e.controlBridgeHandler=null),r&&(window.removeEventListener("error",r),r=null),i&&(window.removeEventListener("unhandledrejection",i),i=null),e.beforeUnloadHandler&&(window.removeEventListener("beforeunload",e.beforeUnloadHandler),e.beforeUnloadHandler=null),mr.disablePickMode();for(let d of e.deterministicAdapters)if(!(!d||typeof d.revert!="function"))try{d.revert()}catch(g){L("runtime.init.site12",g)}e.deterministicAdapters=[];for(let d of o.splice(0))try{d()}catch(g){L("runtime.init.site13",g)}for(let d of e.injectedCompStyles)try{d.remove()}catch(g){L("runtime.init.site14",g)}e.injectedCompStyles=[];for(let d of e.injectedCompLinks)try{d.remove()}catch(g){L("runtime.init.site15",g)}e.injectedCompLinks=[];for(let d of e.injectedCompScripts)try{d.remove()}catch(g){L("runtime.init.site16",g)}e.injectedCompScripts=[],e.capturedTimeline=null,window.__hfRuntimeTeardown===Fi&&(window.__hfRuntimeTeardown=null)}};window.__hfRuntimeTeardown=Fi,e.beforeUnloadHandler=Fi,window.addEventListener("beforeunload",e.beforeUnloadHandler)}var of=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],Ha=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function Dx(e){if(e<=255)return of[e];let t=0,n=Ha.length-1;for(;t<=n;){let r=t+n>>1,i=Ha[r];if(e<i[0]){n=r-1;continue}if(e>i[1]){t=r+1;continue}return i[2]}return"L"}function Ix(e){let t=e.length;if(t===0)return null;let n=new Array(t),r=!1;for(let u=0;u<t;){let c=e.charCodeAt(u),m=c,f=1;if(c>=55296&&c<=56319&&u+1<t){let b=e.charCodeAt(u+1);b>=56320&&b<=57343&&(m=(c-55296<<10)+(b-56320)+65536,f=2)}let h=Dx(m);(h==="R"||h==="AL"||h==="AN")&&(r=!0);for(let b=0;b<f;b++)n[u+b]=h;u+=f}if(!r)return null;let i=0;for(let u=0;u<t;u++){let c=n[u];if(c==="L"){i=0;break}if(c==="R"||c==="AL"){i=1;break}}let o=new Int8Array(t);for(let u=0;u<t;u++)o[u]=i;let a=i&1?"R":"L",l=a,s=l;for(let u=0;u<t;u++)n[u]==="NSM"?n[u]=s:s=n[u];s=l;for(let u=0;u<t;u++){let c=n[u];c==="EN"?n[u]=s==="AL"?"AN":"EN":(c==="R"||c==="L"||c==="AL")&&(s=c)}for(let u=0;u<t;u++)n[u]==="AL"&&(n[u]="R");for(let u=1;u<t-1;u++)n[u]==="ES"&&n[u-1]==="EN"&&n[u+1]==="EN"&&(n[u]="EN"),n[u]==="CS"&&(n[u-1]==="EN"||n[u-1]==="AN")&&n[u+1]===n[u-1]&&(n[u]=n[u-1]);for(let u=0;u<t;u++){if(n[u]!=="EN")continue;let c;for(c=u-1;c>=0&&n[c]==="ET";c--)n[c]="EN";for(c=u+1;c<t&&n[c]==="ET";c++)n[c]="EN"}for(let u=0;u<t;u++){let c=n[u];(c==="WS"||c==="ES"||c==="ET"||c==="CS")&&(n[u]="ON")}s=l;for(let u=0;u<t;u++){let c=n[u];c==="EN"?n[u]=s==="L"?"L":"EN":(c==="R"||c==="L")&&(s=c)}for(let u=0;u<t;u++){if(n[u]!=="ON")continue;let c=u+1;for(;c<t&&n[c]==="ON";)c++;let m=u>0?n[u-1]:l,f=c<t?n[c]:l,h=m!=="L"?"R":"L";if(h===(f!=="L"?"R":"L"))for(let v=u;v<c;v++)n[v]=h;u=c-1}for(let u=0;u<t;u++)n[u]==="ON"&&(n[u]=a);for(let u=0;u<t;u++){let c=n[u];(o[u]&1)===0?c==="R"?o[u]++:(c==="AN"||c==="EN")&&(o[u]+=2):(c==="L"||c==="AN"||c==="EN")&&o[u]++}return o}function af(e,t){let n=Ix(e);if(n===null)return null;let r=new Int8Array(t.length);for(let i=0;i<t.length;i++)r[i]=n[t[i]];return r}var Px=/[ \\t\\n\\r\\f]+/g,Ox=/[\\t\\n\\r\\f]| {2,}|^ | $/;function Gx(e){let t=e??"normal";return t==="pre-wrap"?{mode:t,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:t,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function Hx(e){if(!Ox.test(e))return e;let t=e.replace(Px," ");return t.charCodeAt(0)===32&&(t=t.slice(1)),t.length>0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}function Bx(e){return/[\\r\\f]/.test(e)?e.replace(/\\r\\n/g,`\n`).replace(/[\\r\\f]/g,`\n`):e.replace(/\\r\\n/g,`\n`)}var Ba=null,Ux;function Wx(){return Ba===null&&(Ba=new Intl.Segmenter(Ux,{granularity:"word"})),Ba}var Vx=/\\p{Script=Arabic}/u,mi=/\\p{M}/u,pf=/\\p{Nd}/u;function sf(e){return Vx.test(e)}function lf(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519}function ze(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(!(n<12288)){if(n>=55296&&n<=56319&&t+1<e.length){let r=e.charCodeAt(t+1);if(r>=56320&&r<=57343){let i=(n-55296<<10)+(r-56320)+65536;if(lf(i))return!0;t++;continue}}if(lf(n))return!0}}return!1}function zx(e){let t=gi(e);return t!==null&&(hi.has(t)||vt.has(t))}var qx=new Set(["\\xA0","\\u202F","\\u2060","\\uFEFF"]);function $x(e){return ze(e)}function jx(e){let t=gi(e);return t!==null&&qx.has(t)}function pi(e){return!zx(e)&&!jx(e)}var hi=new Set(["\\uFF0C","\\uFF0E","\\uFF01","\\uFF1A","\\uFF1B","\\uFF1F","\\u3001","\\u3002","\\u30FB","\\uFF09","\\u3015","\\u3009","\\u300B","\\u300D","\\u300F","\\u3011","\\u3017","\\u3019","\\u301B","\\u30FC","\\u3005","\\u303B","\\u309D","\\u309E","\\u30FD","\\u30FE"]),lr=new Set([\'"\',"(","[","{","\\u201C","\\u2018","\\xAB","\\u2039","\\uFF08","\\u3014","\\u3008","\\u300A","\\u300C","\\u300E","\\u3010","\\u3016","\\u3018","\\u301A"]),Wa=new Set(["\'","\\u2019"]),vt=new Set([".",",","!","?",":",";","\\u060C","\\u061B","\\u061F","\\u0964","\\u0965","\\u104A","\\u104B","\\u104C","\\u104D","\\u104F",")","]","}","%",\'"\',"\\u201D","\\u2019","\\xBB","\\u203A","\\u2026"]),Kx=new Set([":",".","\\u060C","\\u061B"]),Yx=new Set(["\\u104F"]),Xx=new Set(["\\u201D","\\u2019","\\xBB","\\u203A","\\u300D","\\u300F","\\u3011","\\u300B","\\u3009","\\u3015","\\uFF09"]);function Jx(e){if(Va(e))return!0;let t=!1;for(let n of e){if(vt.has(n)){t=!0;continue}if(!(t&&mi.test(n)))return!1}return t}function Qx(e){for(let t of e)if(!hi.has(t)&&!vt.has(t))return!1;return e.length>0}function Zx(e){if(Va(e))return!0;for(let t of e)if(!lr.has(t)&&!Wa.has(t)&&!mi.test(t))return!1;return e.length>0}function Va(e){let t=!1;for(let n of e)if(!(n==="\\\\"||mi.test(n))){if(lr.has(n)||vt.has(n)||Wa.has(n)){t=!0;continue}return!1}return t}function hf(e,t){let n=t-1;if(n<=0)return Math.max(n,0);let r=e.charCodeAt(n);if(r<56320||r>57343)return n;let i=n-1;if(i<0)return n;let o=e.charCodeAt(i);return o>=55296&&o<=56319?i:n}function gi(e){if(e.length===0)return null;let t=hf(e,e.length);return e.slice(t)}function ey(e){let t=Array.from(e),n=t.length;for(;n>0;){let r=t[n-1];if(mi.test(r)){n--;continue}if(lr.has(r)||Wa.has(r)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function ty(e,t,n){return n==="text"&&!t&&e.length===1&&e!=="-"&&e!=="\\u2014"?e:null}function uf(e,t,n,r){let i=t[r],o=e[r];if(i==null)return o;let a=n[r];if(o.length===a)return o;let l=i.repeat(a);return e[r]=l,l}function cf(e,t){return e&&t!==null&&Kx.has(t)}function ny(e){let t=gi(e);return t!==null&&Yx.has(t)}function ry(e){if(e.length<2||e[0]!==" ")return null;let t=e.slice(1);return/^\\p{M}+$/u.test(t)?{space:" ",marks:t}:null}function bi(e){let t=e.length;for(;t>0;){let n=hf(e,t),r=e.slice(n,t);if(Xx.has(r))return!0;if(!vt.has(r))return!1;t=n}return!1}function iy(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===`\n`)return"hard-break"}return e===" "?"space":e==="\\xA0"||e==="\\u202F"||e==="\\u2060"||e==="\\uFEFF"?"glue":e==="\\u200B"?"zero-width-break":e==="\\xAD"?"soft-hyphen":"text"}var oy=/[\\x20\\t\\n\\xA0\\xAD\\u200B\\u202F\\u2060\\uFEFF]/;function Ie(e){return e.length===1?e[0]:e.join("")}function ay(e,t){let n=[];for(let r=e.length-1;r>=0;r--)n.push(e[r]);return n.push(t),Ie(n)}function sy(e,t,n,r){if(!oy.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];let i=[],o=null,a=[],l=n,s=!1,u=0;for(let c of e){let m=iy(c,r),f=m==="text"&&t;if(o!==null&&m===o&&f===s){a.push(c),u+=c.length;continue}o!==null&&i.push({text:Ie(a),isWordLike:s,kind:o,start:l}),o=m,a=[c],l=n+u,s=f,u+=c.length}return o!==null&&i.push({text:Ie(a),isWordLike:s,kind:o,start:l}),i}function Ua(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}var ly=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function uy(e,t){let n=e.texts[t];return n.startsWith("www.")?!0:ly.test(n)&&t+1<e.len&&e.kinds[t+1]==="text"&&e.texts[t+1]==="//"}function cy(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}function dy(e){let t=e.texts.slice(),n=e.isWordLike.slice(),r=e.kinds.slice(),i=e.starts.slice();for(let a=0;a<e.len;a++){if(r[a]!=="text"||!uy(e,a))continue;let l=[t[a]],s=a+1;for(;s<e.len&&!Ua(r[s]);){l.push(t[s]),n[a]=!0;let u=t[s].includes("?");if(r[s]="text",t[s]="",s++,u)break}t[a]=Ie(l)}let o=0;for(let a=0;a<t.length;a++){let l=t[a];l.length!==0&&(o!==a&&(t[o]=l,n[o]=n[a],r[o]=r[a],i[o]=i[a]),o++)}return t.length=o,n.length=o,r.length=o,i.length=o,{len:o,texts:t,isWordLike:n,kinds:r,starts:i}}function fy(e){let t=[],n=[],r=[],i=[];for(let o=0;o<e.len;o++){let a=e.texts[o];if(t.push(a),n.push(e.isWordLike[o]),r.push(e.kinds[o]),i.push(e.starts[o]),!cy(a))continue;let l=o+1;if(l>=e.len||Ua(e.kinds[l]))continue;let s=[],u=e.starts[l],c=l;for(;c<e.len&&!Ua(e.kinds[c]);)s.push(e.texts[c]),c++;s.length>0&&(t.push(Ie(s)),n.push(!0),r.push("text"),i.push(u),o=c-1)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}var my=new Set([":","-","/","\\xD7",",",".","+","\\u2013","\\u2014"]),df=/^[A-Za-z0-9_]+[,:;]*$/,ff=/[,:;]+$/;function gf(e){for(let t of e)if(pf.test(t))return!0;return!1}function sr(e){if(e.length===0)return!1;for(let t of e)if(!(pf.test(t)||my.has(t)))return!1;return!0}function py(e){let t=[],n=[],r=[],i=[];for(let o=0;o<e.len;o++){let a=e.texts[o],l=e.kinds[o];if(l==="text"&&sr(a)&&gf(a)){let s=[a],u=o+1;for(;u<e.len&&e.kinds[u]==="text"&&sr(e.texts[u]);)s.push(e.texts[u]),u++;t.push(Ie(s)),n.push(!0),r.push("text"),i.push(e.starts[o]),o=u-1;continue}t.push(a),n.push(e.isWordLike[o]),r.push(l),i.push(e.starts[o])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function hy(e){let t=[],n=[],r=[],i=[];for(let o=0;o<e.len;o++){let a=e.texts[o],l=e.kinds[o],s=e.isWordLike[o];if(l==="text"&&s&&df.test(a)){let u=[a],c=ff.test(a),m=o+1;for(;c&&m<e.len&&e.kinds[m]==="text"&&e.isWordLike[m]&&df.test(e.texts[m]);){let f=e.texts[m];u.push(f),c=ff.test(f),m++}t.push(Ie(u)),n.push(!0),r.push("text"),i.push(e.starts[o]),o=m-1;continue}t.push(a),n.push(s),r.push(l),i.push(e.starts[o])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function gy(e){let t=[],n=[],r=[],i=[];for(let o=0;o<e.len;o++){let a=e.texts[o];if(e.kinds[o]==="text"&&a.includes("-")){let l=a.split("-"),s=l.length>1;for(let u=0;u<l.length;u++){let c=l[u];if(!s)break;(c.length===0||!gf(c)||!sr(c))&&(s=!1)}if(s){let u=0;for(let c=0;c<l.length;c++){let m=l[c],f=c<l.length-1?`${m}-`:m;t.push(f),n.push(!0),r.push("text"),i.push(e.starts[o]+u),u+=f.length}continue}}t.push(a),n.push(e.isWordLike[o]),r.push(e.kinds[o]),i.push(e.starts[o])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function by(e){let t=[],n=[],r=[],i=[],o=0;for(;o<e.len;){let a=[e.texts[o]],l=e.isWordLike[o],s=e.kinds[o],u=e.starts[o];if(s==="glue"){let c=[a[0]],m=u;for(o++;o<e.len&&e.kinds[o]==="glue";)c.push(e.texts[o]),o++;let f=Ie(c);if(o<e.len&&e.kinds[o]==="text")a[0]=f,a.push(e.texts[o]),l=e.isWordLike[o],s="text",u=m,o++;else{t.push(f),n.push(!1),r.push("glue"),i.push(m);continue}}else o++;if(s==="text")for(;o<e.len&&e.kinds[o]==="glue";){let c=[];for(;o<e.len&&e.kinds[o]==="glue";)c.push(e.texts[o]),o++;let m=Ie(c);if(o<e.len&&e.kinds[o]==="text"){a.push(m,e.texts[o]),l=l||e.isWordLike[o],o++;continue}a.push(m)}t.push(Ie(a)),n.push(l),r.push(s),i.push(u)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function xy(e){let t=e.texts.slice(),n=e.isWordLike.slice(),r=e.kinds.slice(),i=e.starts.slice();for(let o=0;o<t.length-1;o++){if(r[o]!=="text"||r[o+1]!=="text"||!ze(t[o])||!ze(t[o+1]))continue;let a=ey(t[o]);a!==null&&(t[o]=a.head,t[o+1]=a.tail+t[o+1],i[o+1]=i[o]+a.head.length)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function mf(e,t,n){let r=Wx(),i=0,o=[],a=[],l=[],s=[],u=[],c=[],m=[],f=[],h=[],b=[],v=[],x=[];for(let E of r.segment(e))for(let S of sy(E.segment,E.isWordLike??!1,E.index,n)){let V=function(){c[k]!==null&&(a[k]=[uf(o,c,m,k)],c[k]=null),a[k].push(S.text),l[k]=l[k]||S.isWordLike,f[k]=f[k]||N,h[k]=h[k]||I,b[k]=U,v[k]=oe,x[k]=cf(h[k],W)},A=S.kind==="text",w=ty(S.text,S.isWordLike,S.kind),N=ze(S.text),I=sf(S.text),W=gi(S.text),U=bi(S.text),oe=ny(S.text),k=i-1;t.carryCJKAfterClosingQuote&&A&&i>0&&s[k]==="text"&&N&&f[k]&&b[k]||A&&i>0&&s[k]==="text"&&Qx(S.text)&&f[k]||A&&i>0&&s[k]==="text"&&v[k]?V():A&&i>0&&s[k]==="text"&&S.isWordLike&&I&&x[k]?(V(),l[k]=!0):w!==null&&i>0&&s[k]==="text"&&c[k]===w?m[k]=(m[k]??1)+1:A&&!S.isWordLike&&i>0&&s[k]==="text"&&(Jx(S.text)||S.text==="-"&&l[k])?V():(o[i]=S.text,a[i]=[S.text],l[i]=S.isWordLike,s[i]=S.kind,u[i]=S.start,c[i]=w,m[i]=w===null?0:1,f[i]=N,h[i]=I,b[i]=U,v[i]=oe,x[i]=cf(I,W),i++)}for(let E=0;E<i;E++){if(c[E]!==null){o[E]=uf(o,c,m,E);continue}o[E]=Ie(a[E])}for(let E=1;E<i;E++)s[E]==="text"&&!l[E]&&Va(o[E])&&s[E-1]==="text"&&(o[E-1]+=o[E],l[E-1]=l[E-1]||l[E],o[E]="");let _=Array.from({length:i},()=>null),R=-1;for(let E=i-1;E>=0;E--){let S=o[E];if(S.length!==0){if(s[E]==="text"&&!l[E]&&Zx(S)&&R>=0&&s[R]==="text"){let A=_[R]??[];A.push(S),_[R]=A,u[R]=u[E],o[E]="";continue}R=E}}for(let E=0;E<i;E++){let S=_[E];S!=null&&(o[E]=ay(S,o[E]))}let T=0;for(let E=0;E<i;E++){let S=o[E];S.length!==0&&(T!==E&&(o[T]=S,l[T]=l[E],s[T]=s[E],u[T]=u[E]),T++)}o.length=T,l.length=T,s.length=T,u.length=T;let F=by({len:T,texts:o,isWordLike:l,kinds:s,starts:u}),M=xy(hy(gy(py(fy(dy(F))))));for(let E=0;E<M.len-1;E++){let S=ry(M.texts[E]);S!==null&&(M.kinds[E]!=="space"&&M.kinds[E]!=="preserved-space"||M.kinds[E+1]!=="text"||!sf(M.texts[E+1])||(M.texts[E]=S.space,M.isWordLike[E]=!1,M.kinds[E]=M.kinds[E]==="preserved-space"?"preserved-space":"space",M.texts[E+1]=S.marks+M.texts[E+1],M.starts[E+1]=M.starts[E]+S.space.length))}return M}function yy(e,t){if(e.len===0)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];let n=[],r=0;for(let i=0;i<e.len;i++)e.kinds[i]==="hard-break"&&(n.push({startSegmentIndex:r,endSegmentIndex:i,consumedEndSegmentIndex:i+1}),r=i+1);return r<e.len&&n.push({startSegmentIndex:r,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),n}function vy(e){if(e.len<=1)return e;let t=[],n=[],r=[],i=[],o=null,a=!1,l=0,s=!1,u=!1;function c(){o!==null&&(t.push(Ie(o)),n.push(a),r.push("text"),i.push(l),o=null)}for(let m=0;m<e.len;m++){let f=e.texts[m],h=e.kinds[m],b=e.isWordLike[m],v=e.starts[m];if(h==="text"){let x=$x(f),_=pi(f);if(o!==null&&s&&u){o.push(f),a=a||b,s=s||x,u=_;continue}c(),o=[f],a=b,l=v,s=x,u=_;continue}c(),t.push(f),n.push(b),r.push(h),i.push(v)}return c(),{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function bf(e,t,n="normal",r="normal"){let i=Gx(n),o=i.mode==="pre-wrap"?Bx(e):Hx(e);if(o.length===0)return{normalized:o,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let a=r==="keep-all"?vy(mf(o,t,i)):mf(o,t,i);return{normalized:o,chunks:yy(a,i),...a}}var tn=null,xf=new Map,nn=null,Sy=96,Ay=/\\p{Emoji_Presentation}/u,Ey=/[\\p{Emoji_Presentation}\\p{Extended_Pictographic}\\p{Regional_Indicator}\\uFE0F\\u20E3]/u,za=null,yf=new Map;function qa(){if(tn!==null)return tn;if(typeof OffscreenCanvas<"u")return tn=new OffscreenCanvas(1,1).getContext("2d"),tn;if(typeof document<"u")return tn=document.createElement("canvas").getContext("2d"),tn;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function Cy(e){let t=xf.get(e);return t||(t=new Map,xf.set(e,t)),t}function lt(e,t){let n=t.get(e);return n===void 0&&(n={width:qa().measureText(e).width,containsCJK:ze(e)},t.set(e,n)),n}function At(){if(nn!==null)return nn;if(typeof navigator>"u")return nn={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},nn;let e=navigator.userAgent,n=navigator.vendor==="Apple Computer, Inc."&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),r=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return nn={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:r,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},nn}function wy(e){let t=e.match(/(\\d+(?:\\.\\d+)?)\\s*px/);return t?parseFloat(t[1]):16}function vf(){return za===null&&(za=new Intl.Segmenter(void 0,{granularity:"grapheme"})),za}function _y(e){return Ay.test(e)||e.includes("\\uFE0F")}function Sf(e){return Ey.test(e)}function Ty(e,t){let n=yf.get(e);if(n!==void 0)return n;let r=qa();r.font=e;let i=r.measureText("\\u{1F600}").width;if(n=0,i>t+.5&&typeof document<"u"&&document.body!==null){let o=document.createElement("span");o.style.font=e,o.style.display="inline-block",o.style.visibility="hidden",o.style.position="absolute",o.textContent="\\u{1F600}",document.body.appendChild(o);let a=o.getBoundingClientRect().width;document.body.removeChild(o),i-a>.5&&(n=i-a)}return yf.set(e,n),n}function Ry(e){let t=0,n=vf();for(let r of n.segment(e))_y(r.segment)&&t++;return t}function ky(e,t){return t.emojiCount===void 0&&(t.emojiCount=Ry(e)),t.emojiCount}function St(e,t,n){return n===0?t.width:t.width-ky(e,t)*n}function Af(e,t,n,r,i){if(t.breakableFitAdvances!==void 0)return t.breakableFitAdvances;let o=vf(),a=[];for(let c of o.segment(e))a.push(c.segment);if(a.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if(i==="sum-graphemes"){let c=[];for(let m of a){let f=lt(m,n);c.push(St(m,f,r))}return t.breakableFitAdvances=c,t.breakableFitAdvances}if(i==="pair-context"||a.length>Sy){let c=[],m=null,f=0;for(let h of a){let b=lt(h,n),v=St(h,b,r);if(m===null)c.push(v);else{let x=m+h,_=lt(x,n);c.push(St(x,_,r)-f)}m=h,f=v}return t.breakableFitAdvances=c,t.breakableFitAdvances}let l=[],s="",u=0;for(let c of a){s+=c;let m=lt(s,n),f=St(s,m,r);l.push(f-u),u=f}return t.breakableFitAdvances=l,t.breakableFitAdvances}function Ef(e,t){let n=qa();n.font=e;let r=Cy(e),i=wy(e),o=t?Ty(e,i):0;return{cache:r,fontSize:i,emojiCorrection:o}}function My(e,t){for(;t<e.widths.length;){let n=e.kinds[t];if(n!=="space"&&n!=="zero-width-break"&&n!=="soft-hyphen")break;t++}return t}function Cf(e,t){if(t<=0)return 0;let n=e%t;return Math.abs(n)<=1e-6?t:t-n}function wf(e,t,n,r,i){let o=0,a=t;for(;o<e.length;){let l=a+e[o];if((o+1<e.length?l+i:l)>n+r)break;a=l,o++}return{fitCount:o,fittedWidth:a}}function Fy(e,t){let n=0,r=e.chunks.length;for(;n<r;){let i=Math.floor((n+r)/2);t<e.chunks[i].consumedEndSegmentIndex?r=i:n=i+1}return n<e.chunks.length?n:-1}function _f(e,t,n){let r=n.segmentIndex;if(n.graphemeIndex>0)return t;let i=e.chunks[t];if(i.startSegmentIndex===i.endSegmentIndex&&r===i.startSegmentIndex)return n.segmentIndex=r,n.graphemeIndex=0,t;for(r<i.startSegmentIndex&&(r=i.startSegmentIndex);r<i.endSegmentIndex;){let o=e.kinds[r];if(o!=="space"&&o!=="zero-width-break"&&o!=="soft-hyphen")return n.segmentIndex=r,n.graphemeIndex=0,t;r++}return i.consumedEndSegmentIndex>=e.widths.length?-1:(n.segmentIndex=i.consumedEndSegmentIndex,n.graphemeIndex=0,t+1)}function Tf(e,t){if(t.segmentIndex>=e.widths.length)return-1;let n=Fy(e,t.segmentIndex);return n<0?-1:_f(e,n,t)}function Ny(e,t,n){if(n.segmentIndex>=e.widths.length)return-1;let r=t;for(;r<e.chunks.length&&n.segmentIndex>=e.chunks[r].consumedEndSegmentIndex;)r++;return r>=e.chunks.length?-1:_f(e,r,n)}function Rf(e,t){return e.simpleLineWalkFastPath?kf(e,t):$a(e,t)}function kf(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e;if(r.length===0)return 0;let l=At().lineFitEpsilon,s=t+l,u=0,c=0,m=!1,f=0,h=0,b=0,v=0,x=-1,_=0;function R(){x=-1,_=0}function T(w=b,N=v,I=c){u++,n?.({startSegmentIndex:f,startGraphemeIndex:h,endSegmentIndex:w,endGraphemeIndex:N,width:I}),c=0,m=!1,R()}function F(w,N){m=!0,f=w,h=0,b=w+1,v=0,c=N}function M(w,N,I){m=!0,f=w,h=N,b=w,v=N+1,c=I}function E(w,N){if(!m){F(w,N);return}c+=N,b=w+1,v=0}function S(w,N){let I=o[w];for(let W=N;W<I.length;W++){let U=I[W];m?c+U>s?(T(),M(w,W,U)):(c+=U,b=w,v=W+1):M(w,W,U)}m&&b===w&&v===I.length&&(b=w+1,v=0)}let A=0;for(;A<r.length&&!(!m&&(A=My(e,A),A>=r.length));){let w=r[A],N=i[A],I=N==="space"||N==="preserved-space"||N==="tab"||N==="zero-width-break"||N==="soft-hyphen";if(!m){w>t&&o[A]!==null?S(A,0):F(A,w),I&&(x=A+1,_=c-w),A++;continue}if(c+w>s){if(I){E(A,w),T(A+1,0,c-w),A++;continue}if(x>=0){if(b>x||b===x&&v>0){T();continue}T(x,0,_);continue}if(w>t&&o[A]!==null){T(),S(A,0),A++;continue}T();continue}E(A,w),I&&(x=A+1,_=c-w),A++}return m&&T(),u}function $a(e,t,n){if(e.simpleLineWalkFastPath)return kf(e,t,n);let{widths:r,lineEndFitAdvances:i,lineEndPaintAdvances:o,kinds:a,breakableFitAdvances:l,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:c}=e;if(r.length===0||c.length===0)return 0;let m=At(),f=m.lineFitEpsilon,h=t+f,b=0,v=0,x=!1,_=0,R=0,T=0,F=0,M=-1,E=0,S=0,A=null;function w(){M=-1,E=0,S=0,A=null}function N(H=T,G=F,z=v){b++,n?.({startSegmentIndex:_,startGraphemeIndex:R,endSegmentIndex:H,endGraphemeIndex:G,width:z}),v=0,x=!1,w()}function I(H,G){x=!0,_=H,R=0,T=H+1,F=0,v=G}function W(H,G,z){x=!0,_=H,R=G,T=H,F=G+1,v=z}function U(H,G){if(!x){I(H,G);return}v+=G,T=H+1,F=0}function oe(H,G,z,X){if(!G)return;let Ce=H==="tab"?0:i[z],q=H==="tab"?X:o[z];M=z+1,E=v-X+Ce,S=v-X+q,A=H}function k(H,G){let z=l[H];for(let X=G;X<z.length;X++){let Ce=z[X];x?v+Ce>h?(N(),W(H,X,Ce)):(v+=Ce,T=H,F=X+1):W(H,X,Ce)}x&&T===H&&F===z.length&&(T=H+1,F=0)}function V(H){if(A!=="soft-hyphen")return!1;let G=l[H];if(G==null)return!1;let{fitCount:z,fittedWidth:X}=wf(G,v,t,f,s);return z===0?!1:(v=X,T=H,F=z,w(),z===G.length?(T=H+1,F=0,!0):(N(H,z,X+s),k(H,z),!0))}function J(H){b++,n?.({startSegmentIndex:H.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:H.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),w()}for(let H=0;H<c.length;H++){let G=c[H];if(G.startSegmentIndex===G.endSegmentIndex){J(G);continue}x=!1,v=0,_=G.startSegmentIndex,R=0,T=G.startSegmentIndex,F=0,w();let z=G.startSegmentIndex;for(;z<G.endSegmentIndex;){let X=a[z],Ce=X==="space"||X==="preserved-space"||X==="tab"||X==="zero-width-break"||X==="soft-hyphen",q=X==="tab"?Cf(v,u):r[z];if(X==="soft-hyphen"){x&&(T=z+1,F=0,M=z+1,E=v+s,S=v+s,A=X),z++;continue}if(!x){q>t&&l[z]!==null?k(z,0):I(z,q),oe(X,Ce,z,q),z++;continue}if(v+q>h){let O=v+(X==="tab"?0:i[z]),j=v+(X==="tab"?q:o[z]);if(A==="soft-hyphen"&&m.preferEarlySoftHyphenBreak&&E<=h){N(M,0,S);continue}if(A==="soft-hyphen"&&V(z)){z++;continue}if(Ce&&O<=h){U(z,q),N(z+1,0,j),z++;continue}if(M>=0&&E<=h){if(T>M||T===M&&F>0){N();continue}let le=M;N(le,0,S),z=le;continue}if(q>t&&l[z]!==null){N(),k(z,0),z++;continue}N();continue}U(z,q),oe(X,Ce,z,q),z++}if(x){let X=M===G.consumedEndSegmentIndex?S:v;N(G.consumedEndSegmentIndex,0,X)}}return b}function Mf(e,t,n,r){let i=e.chunks[n];if(i.startSegmentIndex===i.endSegmentIndex)return t.segmentIndex=i.consumedEndSegmentIndex,t.graphemeIndex=0,0;let{widths:o,lineEndFitAdvances:a,lineEndPaintAdvances:l,kinds:s,breakableFitAdvances:u,discretionaryHyphenWidth:c,tabStopAdvance:m}=e,f=At(),h=f.lineFitEpsilon,b=r+h,v=0,x=!1,_=t.segmentIndex,R=t.graphemeIndex,T=-1,F=0,M=0,E=null;function S(){T=-1,F=0,M=0,E=null}function A(k=_,V=R,J=v){return x?(t.segmentIndex=k,t.graphemeIndex=V,J):null}function w(k,V){x=!0,_=k+1,R=0,v=V}function N(k,V,J){x=!0,_=k,R=V+1,v=J}function I(k,V){if(!x){w(k,V);return}v+=V,_=k+1,R=0}function W(k,V,J,H){if(!V)return;let G=k==="tab"?0:a[J],z=k==="tab"?H:l[J];T=J+1,F=v-H+G,M=v-H+z,E=k}function U(k,V){let J=u[k];for(let H=V;H<J.length;H++){let G=J[H];if(!x)N(k,H,G);else{if(v+G>b)return A();v+=G,_=k,R=H+1}}return x&&_===k&&R===J.length&&(_=k+1,R=0),null}function oe(k){if(E!=="soft-hyphen"||T<0)return null;let V=u[k]??null;if(V!==null){let{fitCount:J,fittedWidth:H}=wf(V,v,r,h,c);if(J===V.length)return v=H,_=k+1,R=0,S(),null;if(J>0)return A(k,J,H+c)}return F<=b?A(T,0,M):null}for(let k=t.segmentIndex;k<i.endSegmentIndex;k++){let V=s[k],J=V==="space"||V==="preserved-space"||V==="tab"||V==="zero-width-break"||V==="soft-hyphen",H=k===t.segmentIndex?t.graphemeIndex:0,G=V==="tab"?Cf(v,m):o[k];if(V==="soft-hyphen"&&H===0){x&&(_=k+1,R=0,T=k+1,F=v+c,M=v+c,E=V);continue}if(!x){if(H>0){let X=U(k,H);if(X!==null)return X}else if(G>r&&u[k]!==null){let X=U(k,0);if(X!==null)return X}else w(k,G);W(V,J,k,G);continue}if(v+G>b){let X=v+(V==="tab"?0:a[k]),Ce=v+(V==="tab"?G:l[k]);if(E==="soft-hyphen"&&f.preferEarlySoftHyphenBreak&&F<=b)return A(T,0,M);let q=oe(k);if(q!==null)return q;if(J&&X<=b)return I(k,G),A(k+1,0,Ce);if(T>=0&&F<=b)return _>T||_===T&&R>0?A():A(T,0,M);if(G>r&&u[k]!==null){let P=A();if(P!==null)return P;let O=U(k,0);if(O!==null)return O}return A()}I(k,G),W(V,J,k,G)}return T===i.consumedEndSegmentIndex&&R===0?A(i.consumedEndSegmentIndex,0,M):A(i.consumedEndSegmentIndex,0,v)}function Ly(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e,l=At().lineFitEpsilon,s=n+l,u=0,c=!1,m=t.segmentIndex,f=t.graphemeIndex,h=-1,b=0;for(let v=t.segmentIndex;v<r.length;v++){let x=r[v],_=i[v],R=_==="space"||_==="preserved-space"||_==="tab"||_==="zero-width-break"||_==="soft-hyphen",T=v===t.segmentIndex?t.graphemeIndex:0,F=o[v];if(!c){if(T>0||x>n&&F!==null){let M=F,E=M[T];c=!0,u=E,m=v,f=T+1;for(let S=T+1;S<M.length;S++){let A=M[S];if(u+A>s)return t.segmentIndex=m,t.graphemeIndex=f,u;u+=A,m=v,f=S+1}m===v&&f===M.length&&(m=v+1,f=0)}else c=!0,u=x,m=v+1,f=0;R&&(h=v+1,b=u-x);continue}if(u+x>s)return R?(t.segmentIndex=v+1,t.graphemeIndex=0,u):h>=0?m>h||m===h&&f>0?(t.segmentIndex=m,t.graphemeIndex=f,u):(t.segmentIndex=h,t.graphemeIndex=0,b):(t.segmentIndex=m,t.graphemeIndex=f,u);u+=x,m=v+1,f=0,R&&(h=v+1,b=u-x)}return c?(t.segmentIndex=m,t.graphemeIndex=f,u):null}function Dy(e,t,n){let r=Tf(e,t);return r<0?null:e.simpleLineWalkFastPath?Ly(e,t,n):Mf(e,t,r,n)}function Ff(e,t){if(e.widths.length===0)return{lineCount:0,maxLineWidth:0};let n={segmentIndex:0,graphemeIndex:0},r=0,i=0;if(!e.simpleLineWalkFastPath){let o=Tf(e,n);for(;o>=0;){let a=Mf(e,n,o,t);if(a===null)return{lineCount:r,maxLineWidth:i};r++,a>i&&(i=a),o=Ny(e,o,n)}return{lineCount:r,maxLineWidth:i}}for(;;){let o=Dy(e,n,t);if(o===null)return{lineCount:r,maxLineWidth:i};r++,o>i&&(i=o)}}var ja=null;function Iy(){return ja===null&&(ja=new Intl.Segmenter(void 0,{granularity:"grapheme"})),ja}function Py(e){return e?{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}:{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]}}function Oy(e,t){let n=[],r=[],i=0,o=!1,a=!1,l=!1;function s(){r.length!==0&&(n.push({text:r.length===1?r[0]:r.join(""),start:i}),r=[],o=!1,a=!1,l=!1)}function u(m,f,h){r=[m],i=f,o=h,a=bi(m),l=lr.has(m)}function c(m,f){r.push(m),o=o||f;let h=bi(m);m.length===1&&vt.has(m)?a=a||h:a=h,l=!1}for(let m of Iy().segment(e)){let f=m.segment,h=ze(f);if(r.length===0){u(f,m.index,h);continue}if(l||hi.has(f)||vt.has(f)||t.carryCJKAfterClosingQuote&&h&&a){c(f,h);continue}if(!o&&!h){c(f,h);continue}s(),u(f,m.index,h)}return s(),n}function Gy(e){if(e.length<=1)return e;let t=[],n=[e[0].text],r=e[0].start,i=ze(e[0].text),o=pi(e[0].text);function a(){t.push({text:n.length===1?n[0]:n.join(""),start:r})}for(let l=1;l<e.length;l++){let s=e[l],u=ze(s.text),c=pi(s.text);if(i&&o){n.push(s.text),i=i||u,o=c;continue}a(),n=[s.text],r=s.start,i=u,o=c}return a(),t}function Hy(e,t,n,r){let i=At(),{cache:o,emojiCorrection:a}=Ef(t,Sf(e.normalized)),l=St("-",lt("-",o),a),u=St(" ",lt(" ",o),a)*8;if(e.len===0)return Py(n);let c=[],m=[],f=[],h=[],b=e.chunks.length<=1,v=n?[]:null,x=[],_=n?[]:null,R=Array.from({length:e.len});function T(S,A,w,N,I,W,U){I!=="text"&&I!=="space"&&I!=="zero-width-break"&&(b=!1),c.push(A),m.push(w),f.push(N),h.push(I),v?.push(W),x.push(U),_!==null&&_.push(S)}function F(S,A,w,N,I){let W=lt(S,o),U=St(S,W,a),oe=A==="space"||A==="preserved-space"||A==="zero-width-break"?0:U,k=A==="space"||A==="zero-width-break"?0:U;if(I&&N&&S.length>1){let V="sum-graphemes";sr(S)?V="pair-context":i.preferPrefixWidthsForBreakableRuns&&(V="segment-prefixes");let J=Af(S,W,o,a,V);T(S,U,oe,k,A,w,J);return}T(S,U,oe,k,A,w,null)}for(let S=0;S<e.len;S++){R[S]=c.length;let A=e.texts[S],w=e.isWordLike[S],N=e.kinds[S],I=e.starts[S];if(N==="soft-hyphen"){T(A,0,l,l,N,I,null);continue}if(N==="hard-break"){T(A,0,0,0,N,I,null);continue}if(N==="tab"){T(A,0,0,0,N,I,null);continue}let W=lt(A,o);if(N==="text"&&W.containsCJK){let U=Oy(A,i),oe=r==="keep-all"?Gy(U):U;for(let k=0;k<oe.length;k++){let V=oe[k];F(V.text,"text",I+V.start,w,r==="keep-all"||!ze(V.text))}continue}F(A,N,I,w,!0)}let M=By(e.chunks,R,c.length),E=v===null?null:af(e.normalized,v);return _!==null?{widths:c,lineEndFitAdvances:m,lineEndPaintAdvances:f,kinds:h,simpleLineWalkFastPath:b,segLevels:E,breakableFitAdvances:x,discretionaryHyphenWidth:l,tabStopAdvance:u,chunks:M,segments:_}:{widths:c,lineEndFitAdvances:m,lineEndPaintAdvances:f,kinds:h,simpleLineWalkFastPath:b,segLevels:E,breakableFitAdvances:x,discretionaryHyphenWidth:l,tabStopAdvance:u,chunks:M}}function By(e,t,n){let r=[];for(let i=0;i<e.length;i++){let o=e[i],a=o.startSegmentIndex<t.length?t[o.startSegmentIndex]:n,l=o.endSegmentIndex<t.length?t[o.endSegmentIndex]:n,s=o.consumedEndSegmentIndex<t.length?t[o.consumedEndSegmentIndex]:n;r.push({startSegmentIndex:a,endSegmentIndex:l,consumedEndSegmentIndex:s})}return r}function Nf(e,t,n,r){let i=r?.wordBreak??"normal",o=bf(e,At(),r?.whiteSpace,i);return Hy(o,t,n,i)}function xi(e,t,n){return Nf(e,t,!1,n)}function Lf(e,t,n){return Nf(e,t,!0,n)}function yi(e,t,n){let r=Rf(e,t);return{lineCount:r,height:r*n}}function Uy(e){return{width:e.width,start:{segmentIndex:e.startSegmentIndex,graphemeIndex:e.startGraphemeIndex},end:{segmentIndex:e.endSegmentIndex,graphemeIndex:e.endGraphemeIndex}}}function Wy(e,t,n){return e.widths.length===0?0:$a(e,t,r=>{n(Uy(r))})}function Df(e,t){return Ff(e,t)}function If(e){let t=0;return Wy(e,Number.POSITIVE_INFINITY,n=>{n.width>t&&(t=n.width)}),t}var Vy={maxWidth:1600,baseFontSize:78,minFontSize:42,fontWeight:900,fontFamily:"Outfit",step:2};function Pf(e,t){let n={...Vy,...t},r=1.2;for(let i=n.baseFontSize;i>=n.minFontSize;i-=n.step){let o=`${n.fontWeight} ${i}px ${n.fontFamily}`,a=xi(e,o),{lineCount:l}=yi(a,n.maxWidth,i*r);if(l<=1)return{fontSize:i,fits:!0}}return{fontSize:n.minFontSize,fits:!1}}var Of={prepare:xi,layout:yi,prepareWithSegments:Lf,measureLineStats:Df,measureNaturalWidth:If};window.__timelines=window.__timelines||{};cd();window.__hyperframes={fitTextFontSize:Pf,getVariables:xs,pretext:Of};function Gf(){let e=window;e.__hyperframeRuntimeBootstrapped||(e.__hyperframeRuntimeBootstrapped=!0,rf())}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Gf,{once:!0}):Gf();})();\n';
|
|
58783
|
+
RUNTIME_IIFE = '"use strict";(()=>{var gm=Object.create;var Ui=Object.defineProperty;var bm=Object.getOwnPropertyDescriptor;var xm=Object.getOwnPropertyNames;var ym=Object.getPrototypeOf,vm=Object.prototype.hasOwnProperty;var Sm=(e,t,n)=>t in e?Ui(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ie=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Am=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of xm(t))!vm.call(e,i)&&i!==n&&Ui(e,i,{get:()=>t[i],enumerable:!(r=bm(t,i))||r.enumerable});return e};var Em=(e,t,n)=>(n=e!=null?gm(ym(e)):{},Am(t||!e||!e.__esModule?Ui(n,"default",{value:e,enumerable:!0}):n,e));var ge=(e,t,n)=>Sm(e,typeof t!="symbol"?t+"":t,n);var pu=ie((CS,Ho)=>{var Q=String,mu=function(){return{isColorSupported:!1,reset:Q,bold:Q,dim:Q,italic:Q,underline:Q,inverse:Q,hidden:Q,strikethrough:Q,black:Q,red:Q,green:Q,yellow:Q,blue:Q,magenta:Q,cyan:Q,white:Q,gray:Q,bgBlack:Q,bgRed:Q,bgGreen:Q,bgYellow:Q,bgBlue:Q,bgMagenta:Q,bgCyan:Q,bgWhite:Q,blackBright:Q,redBright:Q,greenBright:Q,yellowBright:Q,blueBright:Q,magentaBright:Q,cyanBright:Q,whiteBright:Q,bgBlackBright:Q,bgRedBright:Q,bgGreenBright:Q,bgYellowBright:Q,bgBlueBright:Q,bgMagentaBright:Q,bgCyanBright:Q,bgWhiteBright:Q}};Ho.exports=mu();Ho.exports.createColors=mu});var Bo=ie(()=>{});var Vr=ie((RS,bu)=>{"use strict";var hu=pu(),gu=Bo(),Pn=class e extends Error{constructor(t,n,r,i,o,a){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),a&&(this.plugin=a),typeof n<"u"&&typeof r<"u"&&(typeof n=="number"?(this.line=n,this.column=r):(this.line=n.line,this.column=n.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,e)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(t){if(!this.source)return"";let n=this.source;t==null&&(t=hu.isColorSupported);let r=c=>c,i=c=>c,o=c=>c;if(t){let{bold:c,gray:m,red:f}=hu.createColors(!0);i=p=>c(f(p)),r=p=>m(p),gu&&(o=p=>gu(p))}let a=n.split(/\\r?\\n/),l=Math.max(this.line-3,0),s=Math.min(this.line+2,a.length),u=String(s).length;return a.slice(l,s).map((c,m)=>{let f=l+1+m,p=" "+(" "+f).slice(-u)+" | ";if(f===this.line){if(c.length>160){let v=20,x=Math.max(0,this.column-v),_=Math.max(this.column+v,this.endColumn+v),R=c.slice(x,_),T=r(p.replace(/\\d/g," "))+c.slice(0,Math.min(this.column-1,v-1)).replace(/[^\\t]/g," ");return i(">")+r(p)+o(R)+`\n `+T+i("^")}let b=r(p.replace(/\\d/g," "))+c.slice(0,this.column-1).replace(/[^\\t]/g," ");return i(">")+r(p)+o(c)+`\n `+b+i("^")}return" "+r(p)+o(c)}).join(`\n`)}toString(){let t=this.showSourceCode();return t&&(t=`\n\n`+t+`\n`),this.name+": "+this.message+t}};bu.exports=Pn;Pn.default=Pn});var Uo=ie((kS,yu)=>{"use strict";var Uh=/(<)(\\/?style\\b)/gi,Wh=/(<)(!--)/g;function pt(e){return typeof e!="string"||!e.includes("<")?e:e.replace(Uh,"\\\\3c $2").replace(Wh,"\\\\3c $2")}var xu={after:`\n`,beforeClose:`\n`,beforeComment:`\n`,beforeDecl:`\n`,beforeOpen:" ",beforeRule:`\n`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function Vh(e){return e[0].toUpperCase()+e.slice(1)}var On=class{constructor(t){this.builder=t}atrule(t,n){let r=t.raws,i="@"+t.name,o=t.params?this.rawValue(t,"params"):"";if(typeof r.afterName<"u"?i+=r.afterName:o&&(i+=" "),t.nodes)this.block(t,i+o);else{let a=(r.between||"")+(n?";":"");this.builder(pt(i+o+a),t)}}beforeAfter(t,n){let r;t.type==="decl"?r=this.raw(t,null,"beforeDecl"):t.type==="comment"?r=this.raw(t,null,"beforeComment"):n==="before"?r=this.raw(t,null,"beforeRule"):r=this.raw(t,null,"beforeClose");let i=t.parent,o=0;for(;i&&i.type!=="root";)o+=1,i=i.parent;if(r.includes(`\n`)){let a=this.raw(t,null,"indent");if(a.length)for(let l=0;l<o;l++)r+=a}return r}block(t,n){let r=this.raw(t,"between","beforeOpen");this.builder(pt(n+r)+"{",t,"start");let i;t.nodes&&t.nodes.length?(this.body(t),i=this.raw(t,"after")):i=this.raw(t,"after","emptyBody"),i&&this.builder(pt(i)),this.builder("}",t,"end")}body(t){let n=t.nodes,r=n.length-1;for(;r>0&&n[r].type==="comment";)r-=1;let i=this.raw(t,"semicolon"),o=t.type==="document";for(let a=0;a<n.length;a++){let l=n[a],s=this.raw(l,"before");s&&this.builder(o?s:pt(s)),this.stringify(l,r!==a||i)}}comment(t){let n=this.raw(t,"left","commentLeft"),r=this.raw(t,"right","commentRight");this.builder(pt("/*"+n+t.text+r+"*/"),t)}decl(t,n){let r=t.raws,i=this.raw(t,"between","colon"),o=t.prop+i+this.rawValue(t,"value");t.important&&(o+=r.important||" !important"),n&&(o+=";"),this.builder(pt(o),t)}document(t){this.body(t)}raw(t,n,r){let i;if(r||(r=n),n&&(i=t.raws[n],typeof i<"u"))return i;let o=t.parent;if(r==="before"&&(!o||o.type==="root"&&o.first===t||o&&o.type==="document"))return"";if(!o)return xu[r];let a=t.root(),l=a.rawCache||(a.rawCache={});if(typeof l[r]<"u")return l[r];if(r==="before"||r==="after")return this.beforeAfter(t,r);{let s="raw"+Vh(r);this[s]?i=this[s](a,t):a.walk(u=>{if(i=u.raws[n],typeof i<"u")return!1})}return typeof i>"u"&&(i=xu[r]),l[r]=i,i}rawBeforeClose(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return n=r.raws.after,n.includes(`\n`)&&(n=n.replace(/[^\\n]+$/,"")),!1}),n&&(n=n.replace(/\\S/g,"")),n}rawBeforeComment(t,n){let r;return t.walkComments(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeDecl"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeDecl(t,n){let r;return t.walkDecls(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeRule"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeOpen(t){let n;return t.walk(r=>{if(r.type!=="decl"&&(n=r.raws.between,typeof n<"u"))return!1}),n}rawBeforeRule(t){let n;return t.walk(r=>{if(r.nodes&&(r.parent!==t||t.first!==r)&&typeof r.raws.before<"u")return n=r.raws.before,n.includes(`\n`)&&(n=n.replace(/[^\\n]+$/,"")),!1}),n&&(n=n.replace(/\\S/g,"")),n}rawColon(t){let n;return t.walkDecls(r=>{if(typeof r.raws.between<"u")return n=r.raws.between.replace(/[^\\s:]/g,""),!1}),n}rawEmptyBody(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length===0&&(n=r.raws.after,typeof n<"u"))return!1}),n}rawIndent(t){if(t.raws.indent)return t.raws.indent;let n;return t.walk(r=>{let i=r.parent;if(i&&i!==t&&i.parent&&i.parent===t&&typeof r.raws.before<"u"){let o=r.raws.before.split(`\n`);return n=o[o.length-1],n=n.replace(/\\S/g,""),!1}}),n}rawSemicolon(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(n=r.raws.semicolon,typeof n<"u"))return!1}),n}rawValue(t,n){let r=t[n],i=t.raws[n];return i&&i.value===r?i.raw:r}root(t){if(this.body(t),t.raws.after){let n=t.raws.after,r=t.parent&&t.parent.type==="document";this.builder(r?n:pt(n))}}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(pt(t.raws.ownSemicolon),t,"end")}stringify(t,n){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,n)}};yu.exports=On;On.default=On});var Gn=ie((MS,vu)=>{"use strict";var zh=Uo();function Wo(e,t){new zh(t).stringify(e)}vu.exports=Wo;Wo.default=Wo});var zr=ie((FS,Vo)=>{"use strict";Vo.exports.isClean=Symbol("isClean");Vo.exports.my=Symbol("my")});var Un=ie((NS,Su)=>{"use strict";var qh=Vr(),$h=Uo(),jh=Gn(),{isClean:Hn,my:Kh}=zr();function zo(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r)||r==="proxyCache")continue;let i=e[r],o=typeof i;r==="parent"&&o==="object"?t&&(n[r]=t):r==="source"?n[r]=i:Array.isArray(i)?n[r]=i.map(a=>zo(a,n)):(o==="object"&&i!==null&&(i=zo(i)),n[r]=i)}return n}function tt(e,t){if(t&&typeof t.offset<"u")return t.offset;let n=1,r=1,i=0;for(let o=0;o<e.length;o++){if(r===t.line&&n===t.column){i=o;break}e[o]===`\n`?(n=1,r+=1):n+=1}return i}var Bn=class{get proxyOf(){return this}constructor(t={}){this.raws={},this[Hn]=!1,this[Kh]=!0;for(let n in t)if(n==="nodes"){this.nodes=[];for(let r of t[n])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[n]=t[n]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\\n\\s{4}at /.test(t.stack)){let n=this.source;t.stack=t.stack.replace(/\\n\\s{4}at /,`$&${n.input.from}:${n.start.line}:${n.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let n in t)this[n]=t[n];return this}before(t){return this.parent.insertBefore(this,t),this}cleanRaws(t){delete this.raws.before,delete this.raws.after,t||delete this.raws.between}clone(t={}){let n=zo(this);for(let r in t)n[r]=t[r];return n}cloneAfter(t={}){let n=this.clone(t);return this.parent.insertAfter(this,n),n}cloneBefore(t={}){let n=this.clone(t);return this.parent.insertBefore(this,n),n}error(t,n={}){if(this.source){let{end:r,start:i}=this.rangeBy(n);return this.source.input.error(t,{column:i.column,line:i.line},{column:r.column,line:r.line},n)}return new qh(t)}getProxyProcessor(){return{get(t,n){return n==="proxyOf"?t:n==="root"?()=>t.root().toProxy():t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="prop"||n==="value"||n==="name"||n==="params"||n==="important"||n==="text")&&t.markDirty()),!0}}}markClean(){this[Hn]=!0}markDirty(){if(this[Hn]){this[Hn]=!1;let t=this;for(;t=t.parent;)t[Hn]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t={}){let n=this.source.start;if(t.index)n=this.positionInside(t.index);else if(t.word){let r="document"in this.source.input?this.source.input.document:this.source.input.css,o=r.slice(tt(r,this.source.start),tt(r,this.source.end)).indexOf(t.word);o!==-1&&(n=this.positionInside(o))}return n}positionInside(t){let n=this.source.start.column,r=this.source.start.line,i="document"in this.source.input?this.source.input.document:this.source.input.css,o=tt(i,this.source.start),a=o+t;for(let l=o;l<a;l++)i[l]===`\n`?(n=1,r+=1):n+=1;return{column:n,line:r,offset:a}}prev(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t-1]}rangeBy(t={}){let n="document"in this.source.input?this.source.input.document:this.source.input.css,r={column:this.source.start.column,line:this.source.start.line,offset:tt(n,this.source.start)},i=this.source.end?{column:this.source.end.column+1,line:this.source.end.line,offset:typeof this.source.end.offset=="number"?this.source.end.offset:tt(n,this.source.end)+1}:{column:r.column+1,line:r.line,offset:r.offset+1};if(t.word){let a=n.slice(tt(n,this.source.start),tt(n,this.source.end)).indexOf(t.word);a!==-1&&(r=this.positionInside(a),i=this.positionInside(a+t.word.length))}else t.start?r={column:t.start.column,line:t.start.line,offset:tt(n,t.start)}:t.index&&(r=this.positionInside(t.index)),t.end?i={column:t.end.column,line:t.end.line,offset:tt(n,t.end)}:typeof t.endIndex=="number"?i=this.positionInside(t.endIndex):t.index&&(i=this.positionInside(t.index+1));return(i.line<r.line||i.line===r.line&&i.column<=r.column)&&(i={column:r.column+1,line:r.line,offset:r.offset+1}),{end:i,start:r}}raw(t,n){return new $h().raw(this,t,n)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let n=this,r=!1;for(let i of t)i===this?r=!0:r?(this.parent.insertAfter(n,i),n=i):this.parent.insertBefore(n,i);r||this.remove()}return this}root(){let t=this;for(;t.parent&&t.parent.type!=="document";)t=t.parent;return t}toJSON(t,n){let r={},i=n==null;n=n||new Map;let o=0;for(let a in this){if(!Object.prototype.hasOwnProperty.call(this,a)||a==="parent"||a==="proxyCache")continue;let l=this[a];if(Array.isArray(l))r[a]=l.map(s=>typeof s=="object"&&s.toJSON?s.toJSON(null,n):s);else if(typeof l=="object"&&l.toJSON)r[a]=l.toJSON(null,n);else if(a==="source"){if(l==null)continue;let s=n.get(l.input);s==null&&(s=o,n.set(l.input,o),o++),r[a]={end:l.end,inputId:s,start:l.start}}else r[a]=l}return i&&(r.inputs=[...n.keys()].map(a=>a.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=jh){t.stringify&&(t=t.stringify);let n="";return t(this,r=>{n+=r}),n}warn(t,n,r={}){let i={node:this};for(let o in r)i[o]=r[o];return t.warn(n,i)}};Su.exports=Bn;Bn.default=Bn});var Vn=ie((LS,Au)=>{"use strict";var Yh=Un(),Wn=class extends Yh{constructor(t){super(t),this.type="comment"}};Au.exports=Wn;Wn.default=Wn});var qn=ie((DS,Eu)=>{"use strict";var Xh=Un(),zn=class extends Xh{get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}constructor(t){t&&typeof t.value<"u"&&typeof t.value!="string"&&(t={...t,value:String(t.value)}),super(t),this.type="decl"}};Eu.exports=zn;zn.default=zn});var ht=ie((IS,Nu)=>{"use strict";var wu=Vn(),Cu=qn(),Jh=Un(),{isClean:_u,my:Tu}=zr(),qo,Ru,ku,$o;function Mu(e){return e.map(t=>(t.nodes&&(t.nodes=Mu(t.nodes)),delete t.source,t))}function Fu(e){if(e[_u]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Fu(t)}var Ue=class e extends Jh{get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}append(...t){for(let n of t){let r=this.normalize(n,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let n of this.nodes)n.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let n=this.getIterator(),r,i;for(;this.indexes[n]<this.proxyOf.nodes.length&&(r=this.indexes[n],i=t(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[n]+=1;return delete this.indexes[n],i}every(t){return this.nodes.every(t)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let t=this.lastEach;return this.indexes[t]=0,t}getProxyProcessor(){return{get(t,n){return n==="proxyOf"?t:t[n]?n==="each"||typeof n=="string"&&n.startsWith("walk")?(...r)=>t[n](...r.map(i=>typeof i=="function"?(o,a)=>i(o.toProxy(),a):i)):n==="every"||n==="some"?r=>t[n]((i,...o)=>r(i.toProxy(),...o)):n==="root"?()=>t.root().toProxy():n==="nodes"?t.nodes.map(r=>r.toProxy()):n==="first"||n==="last"?t[n].toProxy():t[n]:t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="name"||n==="params"||n==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,n){let r=this.index(t),i=this.normalize(n,this.proxyOf.nodes[r]).reverse();r=this.index(t);for(let a of i)this.proxyOf.nodes.splice(r+1,0,a);let o;for(let a in this.indexes)o=this.indexes[a],r<o&&(this.indexes[a]=o+i.length);return this.markDirty(),this}insertBefore(t,n){let r=this.index(t),i=r===0?"prepend":!1,o=this.normalize(n,this.proxyOf.nodes[r],i).reverse();r=this.index(t);for(let l of o)this.proxyOf.nodes.splice(r,0,l);let a;for(let l in this.indexes)a=this.indexes[l],r<=a&&(this.indexes[l]=a+o.length);return this.markDirty(),this}normalize(t,n){if(typeof t=="string")t=Mu(Ru(t).nodes);else if(typeof t>"u")t=[];else if(Array.isArray(t)){t=t.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"ignore")}else if(t.type)t=[t];else if(t.prop){if(typeof t.value>"u")throw new Error("Value field is missed in node creation");typeof t.value!="string"&&(t.value=String(t.value)),t=[new Cu(t)]}else if(t.selector||t.selectors)t=[new $o(t)];else if(t.name)t=[new qo(t)];else if(t.text)t=[new wu(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[Tu]||e.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[_u]&&Fu(i),i.raws||(i.raws={}),typeof i.raws.before>"u"&&n&&typeof n.raws.before<"u"&&(i.raws.before=n.raws.before.replace(/\\S/g,"")),i.parent=this.proxyOf,i))}prepend(...t){t=t.reverse();for(let n of t){let r=this.normalize(n,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(t){return t.parent=this,this.proxyOf.nodes.push(t),this}removeAll(){for(let t of this.proxyOf.nodes)t.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(t){t=this.index(t),this.proxyOf.nodes[t].parent=void 0,this.proxyOf.nodes.splice(t,1);let n;for(let r in this.indexes)n=this.indexes[r],n>=t&&(this.indexes[r]=n-1);return this.markDirty(),this}replaceValues(t,n,r){return r||(r=n,n={}),this.walkDecls(i=>{n.props&&!n.props.includes(i.prop)||n.fast&&!i.value.includes(n.fast)||(i.value=i.value.replace(t,r))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((n,r)=>{let i;try{i=t(n,r)}catch(o){throw n.addToError(o)}return i!==!1&&n.walk&&(i=n.walk(t)),i})}walkAtRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&t.test(r.name))return n(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="atrule")return n(r,i)}))}walkComments(t){return this.walk((n,r)=>{if(n.type==="comment")return t(n,r)})}walkDecls(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&t.test(r.prop))return n(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="decl")return n(r,i)}))}walkRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&t.test(r.selector))return n(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="rule")return n(r,i)}))}};Ue.registerParse=e=>{Ru=e};Ue.registerRule=e=>{$o=e};Ue.registerAtRule=e=>{qo=e};Ue.registerRoot=e=>{ku=e};Nu.exports=Ue;Ue.default=Ue;Ue.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,qo.prototype):e.type==="rule"?Object.setPrototypeOf(e,$o.prototype):e.type==="decl"?Object.setPrototypeOf(e,Cu.prototype):e.type==="comment"?Object.setPrototypeOf(e,wu.prototype):e.type==="root"&&Object.setPrototypeOf(e,ku.prototype),e[Tu]=!0,e.nodes&&e.nodes.forEach(t=>{Ue.rebuild(t)})}});var qr=ie((PS,Du)=>{"use strict";var Lu=ht(),Kt=class extends Lu{constructor(t){super(t),this.type="atrule"}append(...t){return this.proxyOf.nodes||(this.nodes=[]),super.append(...t)}prepend(...t){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...t)}};Du.exports=Kt;Kt.default=Kt;Lu.registerAtRule(Kt)});var $r=ie((OS,Ou)=>{"use strict";var Qh=ht(),Iu,Pu,Rt=class extends Qh{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Iu(new Pu,this,t).stringify()}};Rt.registerLazyResult=e=>{Iu=e};Rt.registerProcessor=e=>{Pu=e};Ou.exports=Rt;Rt.default=Rt});var Hu=ie((GS,Gu)=>{var Zh="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",e0=(e,t=21)=>(n=t)=>{let r="",i=n|0;for(;i--;)r+=e[Math.random()*e.length|0];return r},t0=(e=21)=>{let t="",n=e|0;for(;n--;)t+=Zh[Math.random()*64|0];return t};Gu.exports={nanoid:t0,customAlphabet:e0}});var jr=ie(()=>{});var Kr=ie(()=>{});var jo=ie(()=>{});var Bu=ie(()=>{});var Yo=ie((jS,Vu)=>{"use strict";var{existsSync:n0,readFileSync:r0}=Bu(),{dirname:Ko,join:i0}=jr(),{SourceMapConsumer:Uu,SourceMapGenerator:Wu}=Kr();function o0(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var $n=class{constructor(t,n){if(n.map===!1)return;n.unsafeMap&&(this.unsafeMap=!0),this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let r=n.map?n.map.prev:void 0,i=this.loadMap(n.from,r);!this.mapFile&&n.from&&(this.mapFile=n.from),this.mapFile&&(this.root=Ko(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new Uu(this.json||this.text)),this.consumerCache}decodeInline(t){let n=/^data:application\\/json;charset=utf-?8;base64,/,r=/^data:application\\/json;base64,/,i=/^data:application\\/json;charset=utf-?8,/,o=/^data:application\\/json,/,a=t.match(i)||t.match(o);if(a)return decodeURIComponent(t.substr(a[0].length));let l=t.match(n)||t.match(r);if(l)return o0(t.substr(l[0].length));let s=t.slice(22);throw s=s.slice(0,s.indexOf(",")),new Error("Unsupported source map encoding "+s)}getAnnotationURL(t){return t.replace(/^\\/\\*\\s*# sourceMappingURL=/,"").trim()}isMap(t){return typeof t!="object"?!1:typeof t.mappings=="string"||typeof t._mappings=="string"||Array.isArray(t.sections)}loadAnnotation(t){let n=t.match(/\\/\\*\\s*# sourceMappingURL=/g);if(!n)return;let r=t.lastIndexOf(n.pop()),i=t.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(t.substring(r,i)))}loadFile(t,n,r){if(!(!r&&!this.unsafeMap&&!/\\.map$/i.test(t))&&(this.root=Ko(t),n0(t)))return this.mapFile=t,r0(t,"utf-8").toString().trim()}loadMap(t,n){if(n===!1)return!1;if(n){if(typeof n=="string")return n;if(typeof n=="function"){let r=n(t);if(r){let i=this.loadFile(r,t,!0);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(n instanceof Uu)return Wu.fromSourceMap(n).toString();if(n instanceof Wu)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;t&&(r=i0(Ko(t),r));let i=this.loadFile(r,t,!1);if(i)try{this.json=JSON.parse(i.replace(/^\\)]}\'[^\\n]*\\n/,""))}catch{return}return i}}}startWith(t,n){return t?t.substr(0,n.length)===n:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};Vu.exports=$n;$n.default=$n});var jn=ie((KS,Ku)=>{"use strict";var{nanoid:a0}=Hu(),{isAbsolute:Qo,resolve:Zo}=jr(),{SourceMapConsumer:s0,SourceMapGenerator:l0}=Kr(),{fileURLToPath:zu,pathToFileURL:Yr}=jo(),qu=Vr(),u0=Yo(),Xo=Bo(),Jo=Symbol("lineToIndexCache"),c0=!!(s0&&l0),$u=!!(Zo&&Qo);function ju(e){if(e[Jo])return e[Jo];let t=e.css.split(`\n`),n=new Array(t.length),r=0;for(let i=0,o=t.length;i<o;i++)n[i]=r,r+=t[i].length+1;return e[Jo]=n,n}var Yt=class{get from(){return this.file||this.id}constructor(t,n={}){if(t===null||typeof t>"u"||typeof t=="object"&&!t.toString)throw new Error(`PostCSS received ${t} instead of CSS string`);if(this.css=t.toString(),this.css[0]==="\\uFEFF"||this.css[0]==="\\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,this.document=this.css,n.document&&(this.document=n.document.toString()),n.from&&(!$u||/^\\w+:\\/\\//.test(n.from)||Qo(n.from)?this.file=n.from:this.file=Zo(n.from)),$u&&c0){let r=new u0(this.css,n);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+a0(6)+">"),this.map&&(this.map.file=this.from)}error(t,n,r,i={}){let o,a,l,s,u;if(n&&typeof n=="object"){let m=n,f=r;if(typeof m.offset=="number"){s=m.offset;let p=this.fromOffset(s);n=p.line,r=p.col}else n=m.line,r=m.column,s=this.fromLineAndColumn(n,r);if(typeof f.offset=="number"){l=f.offset;let p=this.fromOffset(l);a=p.line,o=p.col}else a=f.line,o=f.column,l=this.fromLineAndColumn(f.line,f.column)}else if(r)s=this.fromLineAndColumn(n,r);else{s=n;let m=this.fromOffset(s);n=m.line,r=m.col}let c=this.origin(n,r,a,o);return c?u=new qu(t,c.endLine===void 0?c.line:{column:c.column,line:c.line},c.endLine===void 0?c.column:{column:c.endColumn,line:c.endLine},c.source,c.file,i.plugin):u=new qu(t,a===void 0?n:{column:r,line:n},a===void 0?r:{column:o,line:a},this.css,this.file,i.plugin),u.input={column:r,endColumn:o,endLine:a,endOffset:l,line:n,offset:s,source:this.css},this.file&&(Yr&&(u.input.url=Yr(this.file).toString()),u.input.file=this.file),u}fromLineAndColumn(t,n){return ju(this)[t-1]+n-1}fromOffset(t){let n=ju(this),r=n[n.length-1],i=0;if(t>=r)i=n.length-1;else{let o=n.length-2,a;for(;i<o;)if(a=i+(o-i>>1),t<n[a])o=a-1;else if(t>=n[a+1])i=a+1;else{i=a;break}}return{col:t-n[i]+1,line:i+1}}mapResolve(t){return/^\\w+:\\/\\//.test(t)?t:Zo(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,n,r,i){if(!this.map)return!1;let o=this.map.consumer(),a=o.originalPositionFor({column:n,line:t});if(!a.source)return!1;let l;typeof r=="number"&&(l=o.originalPositionFor({column:i,line:r}));let s;Qo(a.source)?s=Yr(a.source):s=new URL(a.source,this.map.consumer().sourceRoot||Yr(this.map.mapFile));let u={column:a.column,endColumn:l&&l.column,endLine:l&&l.line,line:a.line,url:s.toString()};if(s.protocol==="file:")if(zu)u.file=zu(s);else throw new Error("file: protocol is not available in this PostCSS build");let c=o.sourceContentFor(a.source);return c&&(u.source=c),u}toJSON(){let t={};for(let n of["hasBOM","css","file","id"])this[n]!=null&&(t[n]=this[n]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}};Ku.exports=Yt;Yt.default=Yt;Xo&&Xo.registerInput&&Xo.registerInput(Yt)});var Xt=ie((YS,Qu)=>{"use strict";var Yu=ht(),Xu,Ju,gt=class extends Yu{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,n,r){let i=super.normalize(t);if(n){if(r==="prepend")this.nodes.length>1?n.raws.before=this.nodes[1].raws.before:delete n.raws.before;else if(this.first!==n)for(let o of i)o.raws.before=n.raws.before}return i}removeChild(t,n){let r=this.index(t);return!n&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(t)}toResult(t={}){return new Xu(new Ju,this,t).stringify()}};gt.registerLazyResult=e=>{Xu=e};gt.registerProcessor=e=>{Ju=e};Qu.exports=gt;gt.default=gt;Yu.registerRoot(gt)});var ea=ie((XS,Zu)=>{"use strict";var Kn={comma(e){return Kn.split(e,[","],!0)},space(e){let t=[" ",`\n`," "];return Kn.split(e,t)},split(e,t,n){let r=[],i="",o=!1,a=0,l=!1,s="",u=!1;for(let c of e)u?u=!1:c==="\\\\"?u=!0:l?c===s&&(l=!1):c===\'"\'||c==="\'"?(l=!0,s=c):c==="("?a+=1:c===")"?a>0&&(a-=1):a===0&&t.includes(c)&&(o=!0),o?(i!==""&&r.push(i.trim()),i="",o=!1):i+=c;return(n||i!=="")&&r.push(i.trim()),r}};Zu.exports=Kn;Kn.default=Kn});var Xr=ie((JS,tc)=>{"use strict";var ec=ht(),d0=ea(),Jt=class extends ec{get selectors(){return d0.comma(this.selector)}set selectors(t){let n=this.selector?this.selector.match(/,\\s*/):null,r=n?n[0]:","+this.raw("between","beforeOpen");this.selector=t.join(r)}constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}};tc.exports=Jt;Jt.default=Jt;ec.registerRule(Jt)});var rc=ie((QS,nc)=>{"use strict";var f0=qr(),m0=Vn(),p0=qn(),h0=jn(),g0=Yo(),b0=Xt(),x0=Xr();function Yn(e,t){if(Array.isArray(e))return e.map(i=>Yn(i));let{inputs:n,...r}=e;if(n){t=[];for(let i of n){let o={...i,__proto__:h0.prototype};o.map&&(o.map={...o.map,__proto__:g0.prototype}),t.push(o)}}if(r.nodes&&(r.nodes=e.nodes.map(i=>Yn(i,t))),r.source){let{inputId:i,...o}=r.source;r.source=o,i!=null&&(r.source.input=t[i])}if(r.type==="root")return new b0(r);if(r.type==="decl")return new p0(r);if(r.type==="rule")return new x0(r);if(r.type==="comment")return new m0(r);if(r.type==="atrule")return new f0(r);throw new Error("Unknown node type: "+e.type)}nc.exports=Yn;Yn.default=Yn});var na=ie((ZS,uc)=>{"use strict";var{dirname:Jr,relative:oc,resolve:ac,sep:sc}=jr(),{SourceMapConsumer:lc,SourceMapGenerator:Qr}=Kr(),{pathToFileURL:ic}=jo(),y0=jn(),v0=!!(lc&&Qr),S0=!!(Jr&&ac&&oc&&sc),ta=class{constructor(t,n,r,i){this.stringify=t,this.mapOpts=r.map||{},this.root=n,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let t;this.isInline()?t="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?t=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?t=this.mapOpts.annotation(this.opts.to,this.root):t=this.outputFile()+".map";let n=`\n`;this.css.includes(`\\r\n`)&&(n=`\\r\n`),this.css+=n+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let n=this.toUrl(this.path(t.file)),r=t.root||Jr(t.file),i;this.mapOpts.sourcesContent===!1?(i=new lc(t.text),i.sourcesContent&&(i.sourcesContent=null)):i=t.consumer(),this.map.applySourceMap(i,n,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1){if(this.root){let t;for(let n=this.root.nodes.length-1;n>=0;n--)t=this.root.nodes[n],t.type==="comment"&&t.text.startsWith("# sourceMappingURL=")&&this.root.removeChild(n)}else if(this.css){let t;for(;(t=this.css.lastIndexOf("/*#"))!==-1;){let n=this.css.indexOf("*/",t+3);if(n===-1)break;for(;t>0&&this.css[t-1]===`\n`;)t--;this.css=this.css.slice(0,t)+this.css.slice(n+2)}}}}generate(){if(this.clearAnnotation(),S0&&v0&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,n=>{t+=n}),[t]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let t=this.previous()[0].consumer();t.file=this.outputFile(),this.map=Qr.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new Qr({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Qr({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,n=1,r="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},o,a;this.stringify(this.root,(l,s,u)=>{if(this.css+=l,s&&u!=="end"&&(i.generated.line=t,i.generated.column=n-1,s.source&&s.source.start?(i.source=this.sourcePath(s),i.original.line=s.source.start.line,i.original.column=s.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),a=l.match(/\\n/g),a?(t+=a.length,o=l.lastIndexOf(`\n`),n=l.length-o):n+=l.length,s&&u!=="start"){let c=s.parent||{raws:{}};(!(s.type==="decl"||s.type==="atrule"&&!s.nodes)||s!==c.last||c.raws.semicolon)&&(s.source&&s.source.end?(i.source=this.sourcePath(s),i.original.line=s.source.end.line,i.original.column=s.source.end.column-1,i.generated.line=t,i.generated.column=n-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=t,i.generated.column=n-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(t=>t.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let t=this.mapOpts.annotation;return typeof t<"u"&&t!==!0?!1:this.previous().length?this.previous().some(n=>n.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(t=>t.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(t){if(this.mapOpts.absolute||t.charCodeAt(0)===60||/^\\w+:\\/\\//.test(t))return t;let n=this.memoizedPaths.get(t);if(n)return n;let r=this.opts.to?Jr(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Jr(ac(r,this.mapOpts.annotation)));let i=oc(r,t);return this.memoizedPaths.set(t,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(t=>{if(t.source&&t.source.input.map){let n=t.source.input.map;this.previousMaps.includes(n)||this.previousMaps.push(n)}});else{let t=new y0(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(n=>{if(n.source){let r=n.source.input.from;if(r&&!t[r]){t[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,n.source.input.css)}}});else if(this.css){let n=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(n,this.css)}}sourcePath(t){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(t.source.input.from):this.toUrl(this.path(t.source.input.from))}toBase64(t){return Buffer?Buffer.from(t).toString("base64"):window.btoa(unescape(encodeURIComponent(t)))}toFileUrl(t){let n=this.memoizedFileURLs.get(t);if(n)return n;if(ic){let r=ic(t).toString();return this.memoizedFileURLs.set(t,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let n=this.memoizedURLs.get(t);if(n)return n;sc==="\\\\"&&(t=t.replace(/\\\\/g,"/"));let r=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,r),r}};uc.exports=ta});var fc=ie((eA,dc)=>{"use strict";var Zr=/[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g,ei=/[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g,A0=/.[\\r\\n"\'(/\\\\]/,cc=/[\\da-f]/i;dc.exports=function(t,n={}){let r=t.css.valueOf(),i=n.ignoreErrors,o,a,l,s,u,c,m,f,p,b,v=r.length,x=0,_=[],R=[],T=-1;function M(){return x}function F(C){throw t.error("Unclosed "+C,x)}function E(){return R.length===0&&x>=v}function S(C){if(R.length)return R.pop();if(x>=v)return;let N=C?C.ignoreUnclosed:!1;switch(o=r.charCodeAt(x),o){case 10:case 32:case 9:case 13:case 12:{s=x;do s+=1,o=r.charCodeAt(s);while(o===32||o===10||o===9||o===13||o===12);c=["space",r.slice(x,s)],x=s-1;break}case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let I=String.fromCharCode(o);c=[I,I,x];break}case 40:{if(b=_.length?_.pop()[1]:"",p=r.charCodeAt(x+1),b==="url"&&p!==39&&p!==34&&p!==32&&p!==10&&p!==9&&p!==12&&p!==13){s=x;do{if(m=!1,s=r.indexOf(")",s+1),s===-1)if(i||N){s=x;break}else F("bracket");for(f=s;r.charCodeAt(f-1)===92;)f-=1,m=!m}while(m);c=["brackets",r.slice(x,s+1),x,s],x=s}else x<=T?c=["(","(",x]:(s=r.indexOf(")",x+1),a=r.slice(x,s+1),s===-1||A0.test(a)?(T=s===-1?v:s,c=["(","(",x]):(c=["brackets",a,x,s],x=s));break}case 39:case 34:{u=o===39?"\'":\'"\',s=x;do{if(m=!1,s=r.indexOf(u,s+1),s===-1)if(i||N){s=x+1;break}else F("string");for(f=s;r.charCodeAt(f-1)===92;)f-=1,m=!m}while(m);c=["string",r.slice(x,s+1),x,s],x=s;break}case 64:{Zr.lastIndex=x+1,Zr.test(r),Zr.lastIndex===0?s=r.length-1:s=Zr.lastIndex-2,c=["at-word",r.slice(x,s+1),x,s],x=s;break}case 92:{for(s=x,l=!0;r.charCodeAt(s+1)===92;)s+=1,l=!l;if(o=r.charCodeAt(s+1),l&&o!==47&&o!==32&&o!==10&&o!==9&&o!==13&&o!==12&&(s+=1,cc.test(r.charAt(s)))){for(;cc.test(r.charAt(s+1));)s+=1;r.charCodeAt(s+1)===32&&(s+=1)}c=["word",r.slice(x,s+1),x,s],x=s;break}default:{o===47&&r.charCodeAt(x+1)===42?(s=r.indexOf("*/",x+2)+1,s===0&&(i||N?s=r.length:F("comment")),c=["comment",r.slice(x,s+1),x,s],x=s):(ei.lastIndex=x+1,ei.test(r),ei.lastIndex===0?s=r.length-1:s=ei.lastIndex-2,c=["word",r.slice(x,s+1),x,s],_.push(c),x=s);break}}return x++,c}function A(C){R.push(C)}return{back:A,endOfFile:E,nextToken:S,position:M}}});var gc=ie((tA,hc)=>{"use strict";var E0=qr(),w0=Vn(),C0=qn(),_0=Xt(),mc=Xr(),T0=fc(),pc={empty:!0,space:!0};function R0(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var ra=class{constructor(t){this.input=t,this.root=new _0,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let n=new E0;n.name=t[1].slice(1),n.name===""&&this.unnamedAtrule(n,t),this.init(n,t[2]);let r,i,o,a=!1,l=!1,s=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),r=t[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){n.source.end=this.getPosition(t[2]),n.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){l=!0;break}else if(r==="}"){if(s.length>0){for(o=s.length-1,i=s[o];i&&i[0]==="space";)i=s[--o];i&&(n.source.end=this.getPosition(i[3]||i[2]),n.source.end.offset++)}this.end(t);break}else s.push(t);else s.push(t);if(this.tokenizer.endOfFile()){a=!0;break}}n.raws.between=this.spacesAndCommentsFromEnd(s),s.length?(n.raws.afterName=this.spacesAndCommentsFromStart(s),this.raw(n,"params",s),a&&(t=s[s.length-1],n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++,this.spaces=n.raws.between,n.raws.between="")):(n.raws.afterName="",n.params=""),l&&(n.nodes=[],this.current=n)}checkMissedSemicolon(t){let n=this.colon(t);if(n===!1)return;let r=0,i;for(let o=n-1;o>=0&&(i=t[o],!(i[0]!=="space"&&(r+=1,r===2)));o--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(t){let n=0,r,i,o;for(let[a,l]of t.entries()){if(i=l,o=i[0],o==="("&&(n+=1),o===")"&&(n-=1),n===0&&o===":")if(!r)this.doubleColon(i);else{if(r[0]==="word"&&r[1]==="progid")continue;return a}r=i}return!1}comment(t){let n=new w0;this.init(n,t[2]),n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++;let r=t[1].slice(2,-2);if(!r.trim())n.text="",n.raws.left=r,n.raws.right="";else{let i=r.match(/^(\\s*)([^]*\\S)(\\s*)$/);n.text=i[2],n.raws.left=i[1],n.raws.right=i[3]}}createTokenizer(){this.tokenizer=T0(this.input)}decl(t,n){let r=new C0;this.init(r,t[0][2]);let i=t[t.length-1];for(i[0]===";"&&(this.semicolon=!0,t.pop()),r.source.end=this.getPosition(i[3]||i[2]||R0(t)),r.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),r.raws.before+=t.shift()[1];for(r.source.start=this.getPosition(t[0][2]),r.prop="";t.length;){let u=t[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=t.shift()[1]}r.raws.between="";let o;for(;t.length;)if(o=t.shift(),o[0]===":"){r.raws.between+=o[1];break}else o[0]==="word"&&/\\w/.test(o[1])&&this.unknownWord([o]),r.raws.between+=o[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let a=[],l;for(;t.length&&(l=t[0][0],!(l!=="space"&&l!=="comment"));)a.push(t.shift());this.precheckMissedSemicolon(t);for(let u=t.length-1;u>=0;u--){if(o=t[u],o[1].toLowerCase()==="!important"){r.important=!0;let c=this.stringFrom(t,u);c=this.spacesFromEnd(t)+c,c!==" !important"&&(r.raws.important=c);break}else if(o[1].toLowerCase()==="important"){let c=t.slice(0),m="";for(let f=u;f>0;f--){let p=c[f][0];if(m.trim().startsWith("!")&&p!=="space")break;m=c.pop()[1]+m}m.trim().startsWith("!")&&(r.important=!0,r.raws.important=m,t=c)}if(o[0]!=="space"&&o[0]!=="comment")break}t.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=a.map(u=>u[1]).join(""),a=[]),this.raw(r,"value",a.concat(t),n),r.value.includes(":")&&!n&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let n=new mc;this.init(n,t[2]),n.selector="",n.raws.between="",this.current=n}end(t){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(t){if(this.spaces+=t[1],this.current.nodes){let n=this.current.nodes[this.current.nodes.length-1];n&&n.type==="rule"&&!n.raws.ownSemicolon&&(n.raws.ownSemicolon=this.spaces,this.spaces="",n.source.end=this.getPosition(t[2]),n.source.end.offset+=n.raws.ownSemicolon.length)}}getPosition(t){let n=this.input.fromOffset(t);return{column:n.col,line:n.line,offset:t}}init(t,n){this.current.push(t),t.source={input:this.input,start:this.getPosition(n)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let n=!1,r=null,i=!1,o=null,a=[],l=t[1].startsWith("--"),s=[],u=t;for(;u;){if(r=u[0],s.push(u),r==="("||r==="[")o||(o=u),a.push(r==="("?")":"]");else if(l&&i&&r==="{")o||(o=u),a.push("}");else if(a.length===0)if(r===";")if(i){this.decl(s,l);return}else break;else if(r==="{"){this.rule(s);return}else if(r==="}"){this.tokenizer.back(s.pop()),n=!0;break}else r===":"&&(i=!0);else r===a[a.length-1]&&(a.pop(),a.length===0&&(o=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(n=!0),a.length>0&&this.unclosedBracket(o),n&&i){if(!l)for(;s.length&&(u=s[s.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(s.pop());this.decl(s,l)}else this.unknownWord(s)}parse(){let t;for(;!this.tokenizer.endOfFile();)switch(t=this.tokenizer.nextToken(),t[0]){case"space":this.spaces+=t[1];break;case";":this.freeSemicolon(t);break;case"}":this.end(t);break;case"comment":this.comment(t);break;case"at-word":this.atrule(t);break;case"{":this.emptyRule(t);break;default:this.other(t);break}this.endFile()}precheckMissedSemicolon(){}raw(t,n,r,i){let o,a,l=r.length,s="",u=!0,c,m;for(let f=0;f<l;f+=1)o=r[f],a=o[0],a==="space"&&f===l-1&&!i?u=!1:a==="comment"?(m=r[f-1]?r[f-1][0]:"empty",c=r[f+1]?r[f+1][0]:"empty",!pc[m]&&!pc[c]?s.slice(-1)===","?u=!1:s+=o[1]:u=!1):s+=o[1];if(!u){let f=r.reduce((p,b)=>p+b[1],"");t.raws[n]={raw:f,value:s}}t[n]=s}rule(t){t.pop();let n=new mc;this.init(n,t[0][2]),n.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(n,"selector",t),this.current=n}spacesAndCommentsFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],!(n!=="space"&&n!=="comment"));)r=t.pop()[1]+r;return r}spacesAndCommentsFromStart(t){let n,r="";for(;t.length&&(n=t[0][0],!(n!=="space"&&n!=="comment"));)r+=t.shift()[1];return r}spacesFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],n==="space");)r=t.pop()[1]+r;return r}stringFrom(t,n){let r="";for(let i=n;i<t.length;i++)r+=t[i][1];return t.splice(n,t.length-n),r}unclosedBlock(){let t=this.current.source.start;throw this.input.error("Unclosed block",t.line,t.column)}unclosedBracket(t){throw this.input.error("Unclosed bracket",{offset:t[2]},{offset:t[2]+1})}unexpectedClose(t){throw this.input.error("Unexpected }",{offset:t[2]},{offset:t[2]+1})}unknownWord(t){throw this.input.error("Unknown word "+t[0][1],{offset:t[0][2]},{offset:t[0][2]+t[0][1].length})}unnamedAtrule(t,n){throw this.input.error("At-rule without name",{offset:n[2]},{offset:n[2]+n[1].length})}};hc.exports=ra});var ni=ie((nA,bc)=>{"use strict";var k0=ht(),M0=jn(),F0=gc();function ti(e,t){let n=new M0(e,t),r=new F0(n);try{r.parse()}catch(i){throw i}return r.root}bc.exports=ti;ti.default=ti;k0.registerParse(ti)});var ia=ie((rA,xc)=>{"use strict";var Xn=class{constructor(t,n={}){if(this.type="warning",this.text=t,n.node&&n.node.source){let r=n.node.rangeBy(n);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in n)this[r]=n[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};xc.exports=Xn;Xn.default=Xn});var ri=ie((iA,yc)=>{"use strict";var N0=ia(),Jn=class{get content(){return this.css}constructor(t,n,r){this.processor=t,this.messages=[],this.root=n,this.opts=r,this.css="",this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new N0(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(t=>t.type==="warning")}};yc.exports=Jn;Jn.default=Jn});var oa=ie((oA,Sc)=>{"use strict";var vc={};Sc.exports=function(t){vc[t]||(vc[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))}});var la=ie((sA,Cc)=>{"use strict";var L0=ht(),D0=$r(),I0=na(),P0=ni(),Ac=ri(),O0=Xt(),G0=Gn(),{isClean:Ye,my:H0}=zr(),aA=oa(),B0={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},U0={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},W0={Once:!0,postcssPlugin:!0,prepare:!0},Qt=0;function Qn(e){return typeof e=="object"&&typeof e.then=="function"}function wc(e){let t=!1,n=B0[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,Qt,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,Qt,n+"Exit"]:[n,n+"Exit"]}function Ec(e){let t;return e.type==="document"?t=["Document",Qt,"DocumentExit"]:e.type==="root"?t=["Root",Qt,"RootExit"]:t=wc(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function aa(e){return e[Ye]=!1,e.nodes&&e.nodes.forEach(t=>aa(t)),e}var sa={},bt=class e{get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}constructor(t,n,r){this.stringified=!1,this.processed=!1;let i;if(typeof n=="object"&&n!==null&&(n.type==="root"||n.type==="document"))i=aa(n);else if(n instanceof e||n instanceof Ac)i=aa(n.root),n.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let o=P0;r.syntax&&(o=r.syntax.parse),r.parser&&(o=r.parser),o.parse&&(o=o.parse);try{i=o(n,r)}catch(a){this.processed=!0,this.error=a}i&&!i[H0]&&L0.rebuild(i)}this.result=new Ac(t,i,r),this.helpers={...sa,postcss:sa,result:this.result},this.plugins=this.processor.plugins.map(o=>typeof o=="object"&&o.prepare?{...o,...o.prepare(this.result)}:o)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(t,n){let r=this.result.lastPlugin;try{n&&n.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin?(t.plugin=r.postcssPlugin,t.setMessage()):r.postcssVersion}catch(i){console&&console.error&&console.error(i)}return t}prepareVisitors(){this.listeners={};let t=(n,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([n,i])};for(let n of this.plugins)if(typeof n=="object")for(let r in n){if(!U0[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${n.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!W0[r])if(typeof n[r]=="object")for(let i in n[r])i==="*"?t(n,r,n[r][i]):t(n,r+"-"+i.toLowerCase(),n[r][i]);else typeof n[r]=="function"&&t(n,r,n[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let n=this.plugins[t],r=this.runOnRoot(n);if(Qn(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Ye];){t[Ye]=!0;let n=[Ec(t)];for(;n.length>0;){let r=this.visitTick(n);if(Qn(r))try{await r}catch(i){let o=n[n.length-1].node;throw this.handleError(i,o)}}}if(this.listeners.OnceExit)for(let[n,r]of this.listeners.OnceExit){this.result.lastPlugin=n;try{if(t.type==="document"){let i=t.nodes.map(o=>r(o,this.helpers));await Promise.all(i)}else await r(t,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(t){this.result.lastPlugin=t;try{if(typeof t=="object"&&t.Once){if(this.result.root.type==="document"){let n=this.result.root.nodes.map(r=>t.Once(r,this.helpers));return Qn(n[0])?Promise.all(n):n}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(n){throw this.handleError(n)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,n=G0;t.syntax&&(n=t.syntax.stringify),t.stringifier&&(n=t.stringifier),n.stringify&&(n=n.stringify);let r=this.result.root.source;if(t.map===void 0&&!(r&&r.input&&r.input.map)){let a="";return n(this.result.root,l=>{a+=l}),this.result.css=a,this.result}let o=new I0(n,this.result.root,this.result.opts).generate();return this.result.css=o[0],this.result.map=o[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let t of this.plugins){let n=this.runOnRoot(t);if(Qn(n))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Ye];)t[Ye]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let n of t.nodes)this.visitSync(this.listeners.OnceExit,n);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,n){return this.async().then(t,n)}toString(){return this.css}visitSync(t,n){for(let[r,i]of t){this.result.lastPlugin=r;let o;try{o=i(n,this.helpers)}catch(a){throw this.handleError(a,n.proxyOf)}if(n.type!=="root"&&n.type!=="document"&&!n.parent)return!0;if(Qn(o))throw this.getAsyncError()}}visitTick(t){let n=t[t.length-1],{node:r,visitors:i}=n;if(r.type!=="root"&&r.type!=="document"&&!r.parent){t.pop();return}if(i.length>0&&n.visitorIndex<i.length){let[a,l]=i[n.visitorIndex];n.visitorIndex+=1,n.visitorIndex===i.length&&(n.visitors=[],n.visitorIndex=0),this.result.lastPlugin=a;try{return l(r.toProxy(),this.helpers)}catch(s){throw this.handleError(s,r)}}if(n.iterator!==0){let a=n.iterator,l;for(;l=r.nodes[r.indexes[a]];)if(r.indexes[a]+=1,!l[Ye]){l[Ye]=!0,t.push(Ec(l));return}n.iterator=0,delete r.indexes[a]}let o=n.events;for(;n.eventIndex<o.length;){let a=o[n.eventIndex];if(n.eventIndex+=1,a===Qt){r.nodes&&r.nodes.length&&(r[Ye]=!0,n.iterator=r.getIterator());return}else if(this.listeners[a]){n.visitors=this.listeners[a];return}}t.pop()}walkSync(t){t[Ye]=!0;let n=wc(t);for(let r of n)if(r===Qt)t.nodes&&t.each(i=>{i[Ye]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,t.toProxy()))return}}warnings(){return this.sync().warnings()}};bt.registerPostcss=e=>{sa=e};Cc.exports=bt;bt.default=bt;O0.registerLazyResult(bt);D0.registerLazyResult(bt)});var Tc=ie((uA,_c)=>{"use strict";var V0=na(),z0=ni(),q0=ri(),$0=Gn(),lA=oa(),Zn=class{get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let t,n=z0;try{t=n(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}constructor(t,n,r){n=n.toString(),this.stringified=!1,this._processor=t,this._css=n,this._opts=r,this._map=void 0;let i=$0;this.result=new q0(this._processor,void 0,this._opts),this.result.css=n;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let a=new V0(i,void 0,this._opts,n);if(a.isMap()){let[l,s]=a.generate();l&&(this.result.css=l),s&&(this.result.map=s)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}sync(){if(this.error)throw this.error;return this.result}then(t,n){return this.async().then(t,n)}toString(){return this._css}warnings(){return[]}};_c.exports=Zn;Zn.default=Zn});var kc=ie((cA,Rc)=>{"use strict";var j0=$r(),K0=la(),Y0=Tc(),X0=Xt(),kt=class{constructor(t=[]){this.version="8.5.14",this.plugins=this.normalize(t)}normalize(t){let n=[];for(let r of t)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))n=n.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)n.push(r);else if(typeof r=="function")n.push(r);else if(!(typeof r=="object"&&(r.parse||r.stringify)))throw new Error(r+" is not a PostCSS plugin");return n}process(t,n={}){return!this.plugins.length&&!n.parser&&!n.stringifier&&!n.syntax?new Y0(this,t,n):new K0(this,t,n)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}};Rc.exports=kt;kt.default=kt;X0.registerProcessor(kt);j0.registerProcessor(kt)});var Oc=ie((dA,Pc)=>{"use strict";var Mc=qr(),Fc=Vn(),J0=ht(),Q0=Vr(),Nc=qn(),Lc=$r(),Z0=rc(),eg=jn(),tg=la(),ng=ea(),rg=Un(),ig=ni(),ua=kc(),og=ri(),Dc=Xt(),Ic=Xr(),ag=Gn(),sg=ia();function ue(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new ua(e)}ue.plugin=function(t,n){let r=!1;function i(...a){console&&console.warn&&!r&&(r=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(t+`: \\u91CC\\u9762 postcss.plugin \\u88AB\\u5F03\\u7528. \\u8FC1\\u79FB\\u6307\\u5357:\nhttps://www.w3ctech.com/topic/2226`));let l=n(...a);return l.postcssPlugin=t,l.postcssVersion=new ua().version,l}let o;return Object.defineProperty(i,"postcss",{get(){return o||(o=i()),o}}),i.process=function(a,l,s){return ue([i(s)]).process(a,l)},i};ue.stringify=ag;ue.parse=ig;ue.fromJSON=Z0;ue.list=ng;ue.comment=e=>new Fc(e);ue.atRule=e=>new Mc(e);ue.decl=e=>new Nc(e);ue.rule=e=>new Ic(e);ue.root=e=>new Dc(e);ue.document=e=>new Lc(e);ue.CssSyntaxError=Q0;ue.Declaration=Nc;ue.Container=J0;ue.Processor=ua;ue.Document=Lc;ue.Comment=Fc;ue.Warning=sg;ue.AtRule=Mc;ue.Result=og;ue.Input=eg;ue.Rule=Ic;ue.Root=Dc;ue.Node=rg;tg.registerPostcss(ue);Pc.exports=ue;ue.default=ue});function yr(){return globalThis}function L(e,t){if(typeof window>"u")return;let n=yr(),r=n.__hf?.onSwallowed;if(r)try{r({label:e,error:t})}catch(i){}(n.__hfDebug||n.__HYPERFRAMES_DEBUG)&&console.debug(`[hyperframes] ${e} swallowed:`,t)}var wm=["seconds-time","rational-fps","seek-keep-playing","composition-manifest-v1"];function Cm(e,t){let n=Math.abs(e),r=Math.abs(t);for(;r!==0;){let i=n%r;n=r,r=i}return n||1}function _m(e){let t=Number.isFinite(e)&&e>0?e:30,n=Number.isInteger(t)?1:1e6,r=Math.round(t*n),i=Cm(r,n);return{numerator:r/i,denominator:n/i}}function Wi(e){if(typeof e!="object"||e===null)return null;let t=e;return!Number.isFinite(t.numerator)||!Number.isFinite(t.denominator)||(t.numerator??0)<=0||(t.denominator??0)<=0?null:Number(t.numerator)/Number(t.denominator)}function vr(e){return{protocolVersion:1,capabilities:wm,fps:_m(e)}}function Tm(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function xs(e,t=30){if(typeof e!="object"||e===null)return{status:"legacy",fps:t};let n=e;if(n.protocolVersion===void 0)return{status:"legacy",fps:t};if(n.protocolVersion!==1)return{status:"unsupported",code:"unsupported_protocol_version",receivedVersion:n.protocolVersion};let r=Wi(n.fps);return r===null||!Tm(n.capabilities)?{status:"unsupported",code:"invalid_protocol_metadata",receivedVersion:n.protocolVersion}:{status:"supported",fps:r,metadata:n}}var ys=30;function vs(e){ys=Number.isFinite(e)&&e>0?e:30}function xe(e){try{window.parent.postMessage({...e,...vr(ys)},"*")}catch(t){L("bridge.postMessage",t)}}var Rm={play:(e,t)=>t.onPlay(),pause:(e,t)=>t.onPause(),"stop-media":(e,t)=>t.onStopMedia(),seek:(e,t)=>t.onSeek(km(e,t),e.seekMode??"commit"),tick:(e,t)=>t.onTick(),"set-muted":(e,t)=>t.onSetMuted(!!e.muted),"set-volume":(e,t)=>t.onSetVolume(Math.max(0,Math.min(1,Number(e.volume??1)))),"set-media-output-muted":(e,t)=>t.onSetMediaOutputMuted(!!e.muted),"set-native-media-sync-disabled":(e,t)=>t.onSetNativeMediaSyncDisabled(!!e.disabled),"set-web-audio-media-disabled":(e,t)=>t.onSetWebAudioMediaDisabled(!!e.disabled),"set-playback-rate":(e,t)=>t.onSetPlaybackRate(Number(e.playbackRate??1)),"set-root-duration":(e,t)=>t.onSetRootDuration(Number(e.durationSeconds??0)),"set-color-grading":(e,t)=>t.onSetColorGrading(e.target??null,e.grading??null),"set-color-grading-compare":(e,t)=>t.onSetColorGradingCompare(e.target??null,e.compare??null),"enable-pick-mode":(e,t)=>t.onEnablePickMode(),"disable-pick-mode":(e,t)=>t.onDisablePickMode(),"flash-elements":e=>Fm(e)};function km(e,t){let n=Number(e.timeSeconds);if(Number.isFinite(n))return Math.max(0,n);let i=Wi(e.fps)??t.getCanonicalFps();return Math.max(0,Number(e.frame??0))/i}function Mm(e){let t=xs(e);return t.status!=="unsupported"?!1:(xe({source:"hf-preview",type:"diagnostic",code:`runtime.protocol.${t.code}`,details:{receivedVersion:typeof t.receivedVersion=="string"||typeof t.receivedVersion=="number"?t.receivedVersion:null}}),!0)}function Fm(e){let t=e.selectors,n=e.duration||800;t&&Nm(t,n)}function Ss(e){let t=n=>{let r=n.data;if(!r||r.source!=="hf-parent"||r.type!=="control"||Mm(r))return;let i=r.action;if(typeof i!="string")return;let o=Rm[i];o&&o(r,e)};return window.addEventListener("message",t),xe({source:"hf-preview",type:"ready"}),t}function Nm(e,t){if(!document.getElementById("__hf-flash-styles")){let n=document.createElement("style");n.id="__hf-flash-styles",n.textContent=`\n .__hf-flash {\n outline: 2px solid rgba(59, 130, 246, 0.6) !important;\n outline-offset: 2px !important;\n animation: __hf-flash-pulse ${t}ms ease-out forwards !important;\n }\n @keyframes __hf-flash-pulse {\n 0% { outline-color: rgba(59, 130, 246, 0.8); }\n 100% { outline-color: transparent; }\n }\n `,document.head.appendChild(n)}for(let n of e)try{document.querySelectorAll(n).forEach(i=>{i.classList.add("__hf-flash"),setTimeout(()=>i.classList.remove("__hf-flash"),t)})}catch(r){L("bridge.flashElements.querySelector",r)}}var Vi=null;function As(e){Vi=e}function Ne(e,t){if(Vi)try{Vi({source:"hf-preview",type:"analytics",event:e,properties:t??{}})}catch(n){L("runtime.analytics.site1",n)}}function Lm(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-"),n=0,r=t.length;for(;n<r&&t[n]==="-";)n++;for(;r>n&&t[r-1]==="-";)r--;let i=t.slice(n,r);return i.length>0?i:"node"}function It(e){return`--${Lm(e)}`}function Es(e){let t=new Map;for(let n of e){let r=It(n),i=t.get(r);i?i.includes(n)||i.push(n):t.set(r,[n])}return[...t.values()].filter(n=>n.length>1)}function Cs(){if(typeof document>"u")return{};let e=new Set;document.documentElement?.hasAttribute("data-composition-variables")&&e.add(document.documentElement);for(let i of Array.from(document.querySelectorAll("[data-composition-variables]")))e.add(i);let t={};for(let i of e)Object.assign(t,pn(i));let n=Ar(),r={...t,...n};for(let i of e)qi(i,r);return r}var ws=new Set;function _s(e){let t=e?.getAttribute("data-composition-variables");if(!t)return[];let n;try{n=JSON.parse(t)}catch{return[]}return Array.isArray(n)?n.filter(r=>!!r&&typeof r=="object"):[]}function Dm(e,t){return t?.trim()||e.getAttribute("data-composition-id")?.trim()||e.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")?.trim()||"composition"}function Im(e){return Array.isArray(e.options)?e.options.map(t=>t&&typeof t=="object"?t.value:t).filter(t=>typeof t=="string"||typeof t=="number"):[]}function Pm(e,t){if(typeof e.id!="string")return null;let n=t[e.id];if(n==null||"default"in e&&String(n)===String(e.default))return null;let r=Im(e);return r.length===0||r.some(i=>String(i)===String(n))?null:{id:e.id,value:n,allowed:r}}function qi(e,t,n){if(!e)return;let r=_s(e);if(r.length===0)return;let i=Dm(e,n);for(let o of r){let a=Pm(o,t);if(!a)continue;let l=`${i}|${a.id}|${String(a.value)}`;if(ws.has(l))continue;ws.add(l);let s="default"in o?JSON.stringify(o.default):"the composition default";console.warn(`[hyperframes] runtime_unknown_enum_value: ${i} variable "${a.id}" got ${JSON.stringify(a.value)}, which is not a declared option (${a.allowed.join(", ")}). Rendering ${s} instead.`)}}function pn(e){let t={};for(let n of _s(e))typeof n.id!="string"||!("default"in n)||(t[n.id]=n.default);return t}var zi="data-hf-css-vars";function Sr(e){return"style"in e&&typeof e.style?.setProperty=="function"}function $i(e,t){if(!Sr(e))return;let n=[];for(let[r,i]of Object.entries(t))if(typeof i=="string"&&i!==""||typeof i=="number"){let o=It(r);e.style.setProperty(o,String(i)),n.push(o)}n.length>0&&e.setAttribute(zi,n.join(" "))}function Ts(e,t,n){let r={};for(let[i,o]of Object.entries(t)){let a=It(i);((Sr(e)?e.style.getPropertyValue(a):"")||(n?n.getComputedStyle(e).getPropertyValue(a):"")).trim()===""&&(r[i]=o)}return r}function Rs(e){if(!Sr(e))return;let t=e.getAttribute(zi);if(t){for(let n of t.split(" "))n.startsWith("--")&&e.style.removeProperty(n);e.removeAttribute(zi)}}function ks(e){let t=new Set;e.documentElement?.hasAttribute("data-composition-variables")&&t.add(e.documentElement);for(let i of Array.from(e.querySelectorAll("[data-composition-variables]")))t.add(i);let n=Ar(),r=[];for(let i of t)r.push(...Om(i,n,e.defaultView));for(let i of Es(r))console.warn(`composition variables ${i.join(", ")} collapse to the same CSS property ${It(i[0]??"")} \\u2014 rename one to avoid cross-talk`)}function Om(e,t,n){if(!Sr(e))return[];let r=pn(e),i={};for(let[o,a]of Object.entries(r)){if(o in t)continue;let l=It(o);(e.style.getPropertyValue(l)||(n?n.getComputedStyle(e).getPropertyValue(l):"")).trim()===""&&(i[o]=a)}for(let[o,a]of Object.entries(t))o in r&&(i[o]=a);return $i(e,i),Object.keys(r)}function Ms(e){let t=e.getAttribute("data-variable-values");if(!t)return{};let n;try{n=JSON.parse(t)}catch{return{}}return!n||typeof n!="object"||Array.isArray(n)?{}:n}function Ar(){if(typeof window>"u")return{};let e=window.__hfVariables;return!e||typeof e!="object"||Array.isArray(e)?{}:e}function Fs(e){let t=[],n=u=>{if(typeof u.getAnimations!="function")return[];try{return u.getAnimations()}catch{return[]}},r=u=>e?.resolveStartSeconds?e.resolveStartSeconds(u):Number.parseFloat(u.getAttribute("data-start")??"0")||0,i=(u,c)=>{let m=null;try{m=u.effect?.getComputedTiming?.()??null}catch(p){L("runtime.adapters.css.site5",p)}if(!m)return{};let f=Number(m.endTime);return Number.isFinite(f)?{endSeconds:c+f/1e3}:{unbounded:!0}},o=(u,c)=>{for(let m of u){try{m.currentTime=c}catch(f){L("runtime.adapters.css.site1",f)}try{m.pause()}catch(f){L("runtime.adapters.css.site2",f)}}},a=u=>{for(let c of u)try{c.play()}catch(m){L("runtime.adapters.css.site3",m)}},l=u=>{for(let c of u)try{c.pause()}catch(m){L("runtime.adapters.css.site4",m)}},s=u=>{u.baseDelay?u.el.style.animationDelay=u.baseDelay:u.el.style.removeProperty("animation-delay"),u.basePlayState?u.el.style.animationPlayState=u.basePlayState:u.el.style.removeProperty("animation-play-state")};return{name:"css",discover:()=>{t=[];let u=document.querySelectorAll("*");for(let c of u){if(!(c instanceof HTMLElement))continue;let m=window.getComputedStyle(c);!m.animationName||m.animationName==="none"||t.push({el:c,baseDelay:c.style.animationDelay||"",basePlayState:c.style.animationPlayState||"",animations:n(c)})}},getInferredDurationSeconds:()=>{let u=0;for(let c of t){if(!c.el.isConnected)continue;let m=r(c.el);for(let f of n(c.el)){let p=i(f,m);p.endSeconds!=null&&(u=Math.max(u,p.endSeconds))}}return u>0?u:null},seek:u=>{let c=Number(u.time)||0;for(let m of t){if(!m.el.isConnected)continue;let f=r(m.el),p=Math.max(0,c-f)*1e3,b=m.animations;if(b.length>0){o(b,p);continue}m.el.style.animationPlayState="paused",m.el.style.animationDelay=`-${(p/1e3).toFixed(3)}s`}},pause:()=>{for(let u of t){if(!u.el.isConnected)continue;let c=u.animations;c.length>0&&l(c),s(u)}},play:()=>{for(let u of t)u.el.isConnected&&(s(u),a(u.animations))},revert:()=>{t=[]}}}function Ns(e){return{name:"gsap",discover:()=>{},seek:t=>{let n=e.getTimeline();if(!n)return;n.pause();let r=Math.max(0,Number(t.time)||0),i=t.suppressEvents===!0;typeof n.totalTime=="function"?(n.totalTime(r+.001,!0),n.totalTime(r,i)):n.seek(r,i)},pause:()=>{let t=e.getTimeline();t&&t.pause()}}}function Ls(){return{name:"animejs",discover:()=>{try{let e=window.anime;if(!e||typeof e.running>"u")return;let t=e.running;if(!Array.isArray(t)||t.length===0)return;let n=window.__hfAnime??[],r=new Set(n);for(let i of t)r.has(i)||n.push(i);window.__hfAnime=n}catch(e){L("runtime.adapters.animejs.site1",e)}},seek:e=>{let t=Math.max(0,(Number(e.time)||0)*1e3),n=window.__hfAnime;if(!(!n||n.length===0))for(let r of n)try{typeof r.seek=="function"&&r.seek(t)}catch(i){L("runtime.adapters.animejs.site2",i)}},pause:()=>{let e=window.__hfAnime;if(!(!e||e.length===0))for(let t of e)try{typeof t.pause=="function"&&t.pause()}catch(n){L("runtime.adapters.animejs.site3",n)}},play:()=>{let e=window.__hfAnime;if(!(!e||e.length===0))for(let t of e)try{typeof t.play=="function"&&t.play()}catch(n){L("runtime.adapters.animejs.site4",n)}},revert:()=>{}}}function Is(){return{name:"lottie",discover:()=>{try{let e=window.lottie;if(e&&typeof e.getRegisteredAnimations=="function"){let t=e.getRegisteredAnimations();if(Array.isArray(t)&&t.length>0){let n=window.__hfLottie??[],r=new Set(n);for(let i of t)r.has(i)||n.push(i);window.__hfLottie=n}}}catch(e){L("runtime.adapters.lottie.site1",e)}},seek:e=>{let t=Math.max(0,Number(e.time)||0),n=window.__hfLottie;if(!(!n||n.length===0))for(let r of n)try{if(ji(r))r.goToAndStop(t*1e3,!1);else if(Ki(r)){if(typeof r.setCurrentRawFrameValue=="function"){let i=r.totalFrames??0,o=r.frameRate??30,a=t*o;i>0&&r.setCurrentRawFrameValue(Math.min(a,i-1))}else if(typeof r.seek=="function"){let i=r.duration??1,o=Math.min(100,t/i*100);r.seek(o)}}}catch(i){L("runtime.adapters.lottie.site2",i)}},pause:()=>{let e=window.__hfLottie;if(!(!e||e.length===0))for(let t of e)try{(ji(t)||Ki(t))&&t.pause()}catch(n){L("runtime.adapters.lottie.site3",n)}},revert:()=>{},getInferredDurationSeconds:()=>{let e=window.__hfLottie;if(!e||e.length===0)return null;let t=0,n=!1;for(let r of e){let i=null;try{i=Gm(r)}catch(o){L("runtime.adapters.lottie.site4",o)}i!=null&&(n=!0,t=Math.max(t,i))}return n?t:null}}}function Ds(e,t){return!Number.isFinite(e)||!e||e<=0||!Number.isFinite(t)||!t||t<=0?null:e/t}function Gm(e){return ji(e)?Ds(e.totalFrames,e.frameRate):Ki(e)?Number.isFinite(e.duration)&&(e.duration??0)>0?e.duration??null:Ds(e.totalFrames,e.frameRate):null}function ji(e){return typeof e=="object"&&e!==null&&typeof e.goToAndStop=="function"}function Ki(e){return typeof e=="object"&&e!==null&&typeof e.pause=="function"&&("totalFrames"in e||"duration"in e)}var Yi=-1,Er=new Set,Pt,Xi=0;function Ps(e){let t=[],n=!0,r={time:e,waitUntil:o=>{if(!n)throw new Error("hf-seek waitUntil() must be called synchronously from the event listener");t.push(o)}};try{window.dispatchEvent(new CustomEvent("hf-seek",{detail:r}))}catch(o){L("runtime.adapters.seek-dispatch.site1",o)}finally{n=!1}if(t.length===0)return;let i=Promise.all(t).then(()=>({status:"fulfilled"})).catch(o=>({status:"rejected",reason:o}));Er.add(i),i.then(o=>{Er.delete(i)&&o.status==="rejected"&&Pt===void 0&&(Pt={reason:o.reason})})}function wr(e){e!==Yi&&(Yi=e,Ps(e))}function Cr(e){Yi=e,Ps(e)}function Os(){return Xi>0}async function Ji(){Xi+=1;let e=Pt;try{for(await Promise.resolve();Er.size>0;){let r=(await Promise.all([...Er])).find(i=>i.status==="rejected");e===void 0&&r?.status==="rejected"&&(e={reason:r.reason})}let t=Pt;if(e===void 0&&(e=t),Pt===t&&(Pt=void 0),e)throw e.reason}finally{Xi-=1}}function Gs(){let e=null,t=0,n=null,r=null,i=null,o=null,a=()=>{if(typeof window>"u")return null;let c=window.THREE?.DefaultLoadingManager;return!c||typeof c!="object"||typeof c.itemsLoaded!="number"||typeof c.itemsTotal!="number"?null:c},l=u=>{o||u.itemsTotal<=u.itemsLoaded||(o=new Promise(c=>{u.onLoad=function(){try{i?.call(this)}finally{o=null,u.onLoad=i??null,c()}}}))},s=u=>{n!==u&&(n=u,r=u.onStart??null,i=u.onLoad??null,u.onStart=function(c,m,f){try{r?.call(this,c,m,f)}finally{l(u)}})};return{name:"three",discover:()=>{let u=a();u&&(s(u),l(u))},seek:u=>{e=Math.max(0,Number(u.time)||0),t=e,window.__hfThreeTime=e,wr(e)},pause:()=>{e==null&&(e=Math.max(0,t))},play:()=>{e=null},revert:()=>{e=null,t=0},getReadyPromise:()=>{let u=a();return!u||u.itemsTotal<=u.itemsLoaded?null:(o||l(u),o)}}}function $e(e){let t=null,n=new WeakSet;return{name:e.name,discover:()=>{},seek:()=>{},pause:()=>{},play:()=>{},revert:()=>{},getReadyPromise:()=>{let r=e.getInstances();if(r.length===0)return null;let i=r.filter(o=>!n.has(o));return i.length===0?null:t||(t=Promise.allSettled(i.map(o=>e.waitFor(o).then(()=>{n.add(o)}))).then(()=>{t=null}),t)}}}function Hs(){return $e({name:"mapbox",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfMapbox;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{if(e.loaded()){t();return}e.on("load",t)})})}function Bs(){return $e({name:"leaflet",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfLeaflet;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>e.whenReady(t))})}function Us(){return $e({name:"google-maps",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfGoogleMaps;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{let n=e.addListener("tilesloaded",()=>{n.remove(),t()})})})}function Ws(){return $e({name:"maplibre",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfMaplibre;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{if(e.loaded()){t();return}e.on("load",t)})})}function Vs(){return $e({name:"d3",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfD3;return Array.isArray(e)?e:[]},waitFor:e=>e.end()})}var Hm=250;function zs(){let e=null,t=0,n=null,r=()=>{n!==null&&(window.clearInterval(n),n=null)},i=()=>{n===null&&document.querySelector("[data-composition-id][data-requires-webgpu]")&&(n=window.setInterval(()=>{e!==null&&(Os()||(window.__hfTypegpuTime=e,Cr(e)))},Hm))};return{name:"typegpu",discover:()=>{},seek:o=>{e=Math.max(0,Number(o.time)||0),t=e,window.__hfTypegpuTime=e,wr(e)},pause:()=>{e==null&&(e=Math.max(0,t)),i()},play:()=>{r(),e=null},revert:()=>{r(),e=null,t=0}}}var hn="data-hf-render-id",qs="data-hf-group-render-id";function Bm(e){return e.getAttribute(hn)||e.id||null}var Um="__render_frame_",Wm="__";function Vm(e){return`${Um}${e}${Wm}`}function zm(e){let t=Bm(e);return t?Vm(t):null}function lt(e){let t=zm(e);if(!t)return null;let n=document.getElementById(t);return n instanceof HTMLImageElement?n:null}function $s(e){let t=e.nextElementSibling;if(t instanceof HTMLImageElement&&t.classList.contains("__render_frame__")&&t.complete&&t.naturalWidth>0)return t;let n=lt(e);return n&&n.complete&&n.naturalWidth>0?n:null}function js(){let e=globalThis.GPUQueue;if(!e?.prototype?.copyExternalImageToTexture)return;let t=e.prototype.copyExternalImageToTexture;e.prototype.copyExternalImageToTexture=function(n,r,i){if(n?.source instanceof HTMLVideoElement){let o=$s(n.source);if(o)return t.call(this,{...n,source:o},r,i)}return t.call(this,n,r,i)}}function Ks(){let e=[globalThis.WebGL2RenderingContext,globalThis.WebGLRenderingContext],t=["texImage2D","texSubImage2D"];for(let n of e){let r=n?.prototype;if(r)for(let i of t){let o=r[i];if(typeof o!="function"||o.__hfVideoPatched)continue;let a=function(...l){let s=l.length-1,u=l[s];if(u instanceof HTMLVideoElement){let c=$s(u);c&&(l[s]=c)}return o.apply(this,l)};a.__hfVideoPatched=!0,r[i]=a}}}function Ys(){let e=!1,t=0,n=!1,r,i,o,a=new Set,l=new WeakMap,s=()=>{if(!document.getAnimations)return[];try{return document.getAnimations()}catch{return[]}},u=x=>{let _=Number(x.currentTime);return Number.isFinite(_)&&_>0?_:0},c=(x,_)=>_<=0?x:x>=_?Math.max(0,x-_):x,m=(x,_)=>{let R=l.get(x);if(R)return R;let T={compositionTimeMs:_,animationTimeMs:e?c(u(x),_):u(x)};return l.set(x,T),T},f=(x,_)=>{if(!a.has(x)){a.add(x);let R=()=>{a.delete(x)};try{x.addEventListener("finish",R,{once:!0}),x.addEventListener("cancel",R,{once:!0})}catch(T){L("runtime.adapters.waapi.site4",T)}}m(x,_)},p=(x,_)=>{for(let R of x)f(R,_)},b=()=>{if(n||typeof Element>"u")return;let x=Element.prototype;if(typeof x.animate!="function"||x.__hfOriginalAnimate)return;let _=x.animate;try{Object.defineProperty(x,"__hfOriginalAnimate",{value:_,configurable:!0});let R=function(...T){let M=_.apply(this,T);return f(M,t),M};x.animate=R,r=x,i=_,o=R,n=!0}catch{}},v=x=>{let _=null;try{_=x.effect?.getComputedTiming?.()??null}catch(M){L("runtime.adapters.waapi.site4",M)}if(!_)return{};let R=Number(_.endTime);return Number.isFinite(R)?{endSeconds:(l.get(x)?.compositionTimeMs??0)/1e3+R/1e3}:{unbounded:!0}};return{name:"waapi",discover:()=>{e=!0,b(),p(s(),t)},seek:x=>{let _=Math.max(0,(Number(x.time)||0)*1e3);t=_,(!e||a.size>0)&&p(s(),e?_:0);for(let R of a){let T=e?m(R,_):m(R,0),M=T.animationTimeMs+Math.max(0,_-T.compositionTimeMs);try{R.currentTime=M}catch(F){L("runtime.adapters.waapi.site1",F)}try{R.pause()}catch(F){L("runtime.adapters.waapi.site2",F)}}},pause:()=>{e||p(s(),t);for(let x of a)try{x.pause()}catch(_){L("runtime.adapters.waapi.site3",_)}},revert:()=>{if(a.clear(),l=new WeakMap,e=!1,t=0,r&&i&&o&&r.animate===o)try{r.animate=i,r.__hfOriginalAnimate===i&&delete r.__hfOriginalAnimate}catch(x){L("runtime.adapters.waapi.site5",x)}r=void 0,i=void 0,o=void 0,n=!1},getInferredDurationSeconds:()=>{let x=0;for(let _ of s()){let R=v(_);R.endSeconds!=null&&(x=Math.max(x,R.endSeconds))}return x>0?x:null}}}var Qi=3.981071705534972;function Le(e){return Number.isFinite(e)?Math.max(0,Math.min(Qi,e)):1}function _r(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function Xs(e,t){let n=typeof HTMLMediaElement>"u"?void 0:Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,"volume"),r=n?.get,i=n?.set;if(!r||!i)return t();let o=Number(r.call(e));Object.defineProperty(e,"volume",{configurable:!0,get:()=>o,set:a=>{o=Number(a),i.call(e,_r(o))}});try{return t()}finally{delete e.volume,i.call(e,_r(o))}}var Ot=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),G1=Object.freeze([Ot.start,Ot.duration,Ot.trackIndex]),H1=Object.freeze([Ot.derivedEnd]),B1=Object.freeze([Ot.derivedEnd,Ot.legacyTrack]);function Gt(e){if(e==null||e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}var Qs=/^[A-Za-z0-9_.:-]+$/;function Zs(e,t){let n=e.charCodeAt(t);return n>=48&&n<=57}function Js(e,t){let n=t;for(;n>=0&&Zs(e,n);)n--;return n}function qm(e,t){let n=t;for(;n>=0&&(e[n]??"").trim()==="";)n--;return n}function $m(e){let t=e.length-1;if(!Zs(e,t))return null;let n=Js(e,t);return e[n]==="."&&(n=Js(e,n-1)),n+1}function jm(e){let t=$m(e);if(t==null)return null;let n=qm(e,t-1),r=e[n];if(r!=="+"&&r!=="-")return null;let i=e.slice(0,n).trim();if(!Qs.test(i))return null;let o=Number(e.slice(t));return Number.isFinite(o)?{refId:i,operator:r,magnitude:o}:null}function Zi(e){let t=(e??"").trim();if(!t)return null;let n=Gt(t);if(n!=null)return{kind:"absolute",value:n};if(Qs.test(t))return{kind:"reference",refId:t,offset:0};let r=jm(t);return r?{kind:"reference",refId:r.refId,offset:r.operator==="-"?-r.magnitude:r.magnitude}:null}function el(e){return Number.isFinite(e)&&e>0?Math.max(.1,Math.min(5,e)):1}function ye(e){return Gt(e)}function _e(e){let t=Number.parseFloat(e.getAttribute("data-playback-rate")??""),n=Number.isFinite(t)&&t>0?t:typeof HTMLMediaElement<"u"&&e instanceof HTMLMediaElement?e.defaultPlaybackRate:1;return el(n)}function gn(e){let t=n=>{let r=ye(n);return r==null?null:Number.isFinite(r)&&r>=0?r:null};return t(e.getAttribute("data-playback-start"))??t(e.getAttribute("data-media-start"))??0}function Ze(e,t){return Km(t,gn(e),_e(e))}function Km(e,t,n){return Number.isFinite(e)?Math.max(0,e-t)/el(n):null}function Ym(e,t,n){let r=e.filter(o=>Number.isFinite(o.time)&&Number.isFinite(o.volume)).map(o=>({time:Math.max(0,o.time-t),volume:Le(o.volume)})).sort((o,a)=>o.time-a.time),i=[];for(let o of r){let a=i.at(-1);a&&Math.abs(a.time-o.time)<1e-9?a.volume=o.volume:i.push(o)}return i.length===0||i[0].time>0&&i.unshift({time:0,volume:Le(n)}),i}function tl(e,t){if(e.length===0)return 1;let n=0;for(;n<e.length-2&&t>=e[n+1].time;)n+=1;let r=e[n],i=e[n+1]??r,o=i.time-r.time,a=o<=0?0:Math.min(1,Math.max(0,(t-r.time)/o));return r.volume+(i.volume-r.volume)*a}function Xm(e,t,n,r){let i=e.at(-1);!i||Math.abs(i.volume-n.volume)>1e-4?(i&&t&&t.time>i.time&&e.push(t),e.push(n)):r&&n.time>i.time&&e.push(n)}function Jm(e){let t=Number.parseFloat(e??"");return Number.isFinite(t)?t:void 0}function nl(e,t){let n=ye(e.dataset.start)??0,r=ye(e.dataset.end)??void 0,i=ye(e.dataset.duration)??void 0,o=t;i!==void 0&&i>0?o=n+i:r!==void 0&&r>n&&(o=r);let a=Jm(e.dataset.volume)??1;return{start:n,end:o,staticVolume:Le(a)}}function Qm(e,t,n,r){let{start:i,end:o,staticVolume:a}=nl(e,n),l=1/Math.min(60,Math.max(1,r)),s=Math.max(0,i),u=Math.min(n,o),c=Xs(e,()=>{e.volume=a;let f=[],p;for(let b=s;b<=u+1e-6;b=Math.min(u,b+l)){t(b);let v=Number(e.volume);if(Number.isFinite(v)){let x={time:Number(b.toFixed(6)),volume:Number(Le(v).toFixed(6))};Xm(f,p,x,b===u),p=x}if(b===u)break}return f});return c.some(f=>Math.abs(f.volume-a)>1e-4)?c:null}function rl(e,t,n,r,i={}){if(i.allowLiveTimelineSeek===!1||!t||!(e instanceof HTMLAudioElement)&&!(e instanceof HTMLVideoElement)||n<=0)return;let o=s=>{try{typeof t.totalTime=="function"?t.totalTime(s,!0):typeof t.seek=="function"&&t.seek(s,!0)}catch{}},a=typeof t.totalTime=="function"?Number(t.totalTime()):typeof t.seek=="function"?Number(t.seek()):0,l=Qm(e,o,n,60);if(Number.isFinite(a)&&o(a),l){let{start:s,staticVolume:u}=nl(e,n),c=Ym(l,s,u);c.length>0&&r.set(e,c)}}var xn="data-fx-chain",X1=xn.slice(5),il=1,bn=(e="frequency",t="Frequency",n=1e3,r=20,i=2e4)=>({kind:"number",key:e,label:t,unit:"Hz",min:r,max:i,step:1,default:n,scale:"log",automatable:!0}),eo=(e=.707,t="Bandwidth \\u2014 higher is narrower.")=>({kind:"number",key:"q",label:"Q",unit:"",min:.1,max:20,step:.01,default:e,scale:"log",automatable:!0,hint:t}),Tr=(e=-40,t=40,n=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:e,max:t,step:.1,default:n,automatable:!0}),ol={kind:"enum",key:"poles",label:"Slope",options:[{value:"1",label:"6 dB/oct"},{value:"2",label:"12 dB/oct"}],default:"2",hint:"Two poles is the usual biquad; one pole is gentler."},sl=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[Tr(-60,12,0)],web:"gain-node"},{id:"peaking",label:"Peaking EQ",group:"filter",description:"Boost or cut a band, leaving everything either side alone.",params:[bn("frequency","Frequency",1e3),Tr(-40,40,0),eo(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[bn("frequency","Frequency",200,20,2e3),Tr(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[bn("frequency","Frequency",4e3,500,2e4),Tr(-40,40,0)],web:"biquad-highshelf"},{id:"highpass",label:"High-pass",group:"filter",description:"Remove low frequencies \\u2014 the usual fix for rumble on a voice.",params:[bn("frequency","Cutoff",300,20,2e4),eo(.707),ol],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies \\u2014 darkens or muffles a track.",params:[bn("frequency","Cutoff",8e3,100,2e4),eo(.707),ol],web:"biquad-lowpass"},{id:"compressor",label:"Compressor",group:"dynamics",description:"Pull loud parts down so the quiet ones can come up.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-60,max:0,step:.5,default:-24,hint:"Level above which the compressor starts working."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:4},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:2e3,step:.1,default:20,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:250,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83,hint:"1 is a hard corner; higher eases into it."},{kind:"number",key:"makeup",label:"Makeup",unit:"dB",min:0,max:36,step:.1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1,hint:"Below 1 blends the dry signal back in."}],web:"worklet-compressor"},{id:"limiter",label:"Limiter",group:"dynamics",description:"Hard ceiling \\u2014 nothing gets past the limit.",params:[{kind:"number",key:"limit",label:"Ceiling",unit:"dB",min:-24,max:0,step:.1,default:-1},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.1,max:80,step:.1,default:5},{kind:"number",key:"release",label:"Release",unit:"ms",min:1,max:8e3,step:1,default:50,scale:"log"},{kind:"number",key:"level_out",label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0}],web:"worklet-limiter"},{id:"gate",label:"Noise Gate",group:"dynamics",description:"Silence the track when it drops below the threshold.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-80,max:0,step:.5,default:-35},{kind:"number",key:"range",label:"Range",unit:"dB",min:-80,max:0,step:.5,default:-24,hint:"How far down the gate pulls when closed."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:10},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:9e3,step:.1,default:1,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:100,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83}],web:"worklet-gate"},{id:"saturate",label:"Saturation",group:"nonlinear",description:"Soft-clip the waveform for warmth or outright distortion.",params:[{kind:"enum",key:"type",label:"Curve",options:[{value:"tanh",label:"Tanh"},{value:"atan",label:"Arctan"},{value:"cubic",label:"Cubic"},{value:"exp",label:"Exponential"},{value:"alg",label:"Algebraic"},{value:"quintic",label:"Quintic"},{value:"sin",label:"Sine"},{value:"erf",label:"Error function"},{value:"hard",label:"Hard clip"}],default:"tanh"},{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-40,max:0,step:.1,default:-6},{kind:"number",key:"output",automatable:!0,label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0},{kind:"number",key:"oversample",label:"Oversample",unit:"x",min:1,max:8,step:1,default:4,hint:"Higher costs more but keeps aliasing down."}],web:"waveshaper"},{id:"bitcrush",label:"Bitcrush",group:"nonlinear",description:"Drop bit depth and sample rate for a lo-fi, digital sound.",params:[{kind:"number",key:"bits",label:"Bit depth",unit:"bit",min:1,max:32,step:.1,default:8},{kind:"number",key:"samples",label:"Sample hold",unit:"x",min:1,max:250,step:1,default:1,hint:"Repeats each sample N times \\u2014 a crude downsample."},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-bitcrush"},{id:"pitchshift",label:"Pitch shift",group:"time",description:"Shifts pitch up or down without changing playback speed. Adds ~50 ms of latency.",params:[{kind:"number",key:"semitones",label:"Semitones",unit:"st",min:-12,max:12,step:1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-pitchshift"},{id:"delay",label:"Delay",group:"time",description:"Repeating echoes behind the dry signal.",params:[{kind:"number",key:"time",automatable:!0,label:"Time",unit:"ms",min:1,max:5e3,step:1,default:250,scale:"log"},{kind:"number",key:"feedback",automatable:!0,label:"Feedback",unit:"",min:.01,max:.95,step:.01,default:.35},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.4}],web:"delay-feedback"},{id:"chorus",label:"Chorus",group:"time",description:"Detuned copies of the signal for width and thickness.",params:[{kind:"number",key:"delay",automatable:!0,label:"Delay",unit:"ms",min:1,max:100,step:.1,default:7},{kind:"number",key:"depth",automatable:!0,label:"Depth",unit:"ms",min:0,max:10,step:.01,default:2},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.01,max:10,step:.01,default:1},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.5}],web:"chorus-lfo"},{id:"phaser",label:"Phaser",group:"time",description:"Sweeping notches moving through the spectrum.",params:[{kind:"number",key:"in_gain",automatable:!0,label:"Input",unit:"",min:0,max:1,step:.01,default:.4},{kind:"number",key:"out_gain",automatable:!0,label:"Output",unit:"",min:0,max:2,step:.01,default:.74},{kind:"number",key:"delay",label:"Delay",unit:"ms",min:.1,max:5,step:.1,default:3},{kind:"number",key:"decay",label:"Decay",unit:"",min:0,max:.99,step:.01,default:.4},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.1,max:2,step:.01,default:.5},{kind:"enum",key:"type",label:"Waveform",options:[{value:"0",label:"Triangular"},{value:"1",label:"Sinusoidal"}],default:"0"}],web:"allpass-phaser"},{id:"reverb",label:"Reverb",group:"time",description:"Room tail. Both ends convolve the same generated impulse, so preview matches render.",params:[{kind:"number",key:"size",label:"Room size",unit:"",min:.05,max:1,step:.01,default:.7},{kind:"number",key:"damping",label:"Damping",unit:"",min:0,max:1,step:.01,default:.5,hint:"Higher rolls the top off the tail faster."},{kind:"number",key:"wet",automatable:!0,label:"Wet",unit:"",min:0,max:1,step:.01,default:.35},{kind:"number",key:"dry",automatable:!0,label:"Dry",unit:"",min:0,max:1,step:.01,default:.7}],web:"convolver"}],to=new Map(sl.map(e=>[e.id,e]));function yn(e){return to.get(e)}var J1=sl.map(e=>e.id);function vn(e,t){let n=to.get(e);if(!n)return{};let r={};for(let i of n.params){let o=t?.[i.key];if(i.kind==="enum"){let l=i.options.some(s=>s.value===o);r[i.key]=l?o:i.default;continue}let a=typeof o=="number"?o:typeof o=="string"&&o.trim()!==""?Number(o):Number.NaN;r[i.key]=Number.isFinite(a)?Math.min(i.max,Math.max(i.min,a)):i.default}return r}var ut=class extends Error{constructor(t){super(t),this.name="AudioFxChainError"}};function ll(e){let t;try{t=JSON.parse(e)}catch(i){throw new ut(`Chain file is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new ut("Chain file must be a JSON object.");let n=t;if(n.version!==il)throw new ut(`Unsupported chain version: ${String(n.version)}`);if(!Array.isArray(n.nodes))throw new ut("Chain file is missing a `nodes` array.");let r=n.nodes.map(Zm);return{version:il,nodes:r}}function Sn(e){return e.nodes.filter(t=>t.enabled!==!1)}function Zm(e,t){if(typeof e!="object"||e===null)throw new ut(`Node ${t} is not an object.`);let n=e;if(typeof n.type!="string"||!to.has(n.type))throw new ut(`Node ${t} has unknown effect type: ${String(n.type)}`);return tp({type:n.type,id:Rr(n.id),fromCarve:al(n.fromCarve),fromPreset:Rr(n.fromPreset),label:Rr(n.label),fromEq:Rr(n.fromEq),fromLeveller:al(n.fromLeveller),presetAmount:ep(n.presetAmount),enabled:n.enabled!==!1,params:vn(n.type,n.params??void 0)})}function Rr(e){return typeof e=="string"&&e?e:void 0}function al(e){return e===!0?!0:void 0}function ep(e){if(!(typeof e!="number"||!Number.isFinite(e)))return Math.min(1,Math.max(0,e))}function tp(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}var _t="data-automation",tv=_t.slice(5),kr=1,np=512,et=class extends Error{constructor(t){super(t),this.name="AudioAutomationError"}},Ht="volume";function En(e){if(e===Ht)return{kind:"volume"};let t=e.split(".");if(t.length===3&&t[0]==="fx"&&t[1]===rp){let i=t[2];return i?{kind:"preset",presetId:i}:null}if(t.length!==3||t[0]!=="fx")return null;let[,n,r]=t;return!n||!r?null:{kind:"fx",nodeId:n,param:r}}var rp="preset";var ip={min:0,max:1,step:.01,unit:"",label:"Amount",scale:"linear",default:1},Mr={min:0,max:Qi,step:.01,unit:"",label:"Volume",scale:"linear",default:1};function no(e,t){let n=En(e);if(!n)return null;if(n.kind==="volume")return Mr;if(n.kind==="preset")return t?.nodes.some(l=>l.fromPreset===n.presetId)?{...ip,label:`${n.presetId} \\xB7 Amount`}:null;let r=t?.nodes.find(a=>a.id===n.nodeId);if(!r)return null;let i=yn(r.type),o=i?.params.find(a=>a.key===n.param);return!o||o.kind!=="number"?null:{min:o.min,max:o.max,step:o.step,unit:o.unit,label:`${i?.label??r.type} \\xB7 ${o.label}`,scale:o.scale==="log"&&o.min>0?"log":"linear",default:o.default}}function An(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null}function op(e){let t=An(e);return t===null||t===0?0:Math.min(1,Math.max(-1,t))}function ul(e,t){let n=An(e),r=An(t);if(n===null||r===null)return null;let i=l=>Math.min(.999,Math.max(.001,l)),o=i(n),a=i(r);return Math.abs(o-a)<1e-6?null:{x:o,y:a}}function ap(e){let t=op(e?.curve),n=ul(e?.viaX,e?.viaY);return{...t?{curve:t}:{},...n?{viaX:n.x,viaY:n.y}:{}}}function sp(e,t){let n=An(e?.t),r=An(e?.v);if(n===null||r===null)return null;let i=t?Math.min(t.max,Math.max(t.min,r)):r;return{t:Math.max(0,n),v:i,...ap(e)}}function cl(e,t){let n=e.map(i=>sp(i,t)).filter(i=>i!==null).sort((i,o)=>i.t-o.t),r=[];for(let i of n)r.length>0&&r[r.length-1].t===i.t?r[r.length-1]=i:r.push(i);return r.slice(0,np)}function lp(e){let t=[];for(let n of e.lanes){if(!En(n.target))continue;let r=n.target===Ht?Mr:null,i=cl(n.points??[],r);i.length>0&&t.push({target:n.target,points:i})}return{version:kr,lanes:t}}function dl(e,t){let n=[];for(let r of e.lanes){let i=no(r.target,t);if(!i)continue;let o=cl(r.points,i);o.length>0&&n.push({target:r.target,points:o})}return{version:kr,lanes:n}}function Fr(e){let t;try{t=JSON.parse(e)}catch(i){throw new et(`Automation is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new et("Automation must be a JSON object.");let n=t;if(n.version!==kr)throw new et(`Unsupported automation version: ${String(n.version)}`);if(!Array.isArray(n.lanes))throw new et("Automation is missing a `lanes` array.");let r=n.lanes.map((i,o)=>{if(typeof i!="object"||i===null)throw new et(`Lane ${o} is not an object.`);let a=i;if(typeof a.target!="string"||!En(a.target))throw new et(`Lane ${o} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new et(`Lane ${o} is missing a \\`points\\` array.`);return{target:a.target,points:a.points}});return lp({version:kr,lanes:r})}function up(e,t){return t?Math.pow(e,Math.pow(2,2*t)):e}function cp(e,t){let n=e-.5,r=t-.5,i=.999,o=1e6,a=n>0?n/(i-e):n<0?-n/(e-(1-i)):0,l=r>0?r/(i-t):r<0?-r/(t-(1-i)):0,s=Math.min(o,Math.max(1,a,l));return{cx:e+n/s,cy:t+r/s,w:s}}function dp(e,t,n){let{cx:r,cy:i,w:o}=cp(t,n),a=2-2*o,l=e*a-1+2*o*r,s=-e*a-2*o*r,u=fp(l,s,e),c=1-u,m=c*c+2*o*u*c+u*u;return m>0?(2*o*i*u*c+u*u)/m:e}function fp(e,t,n){if(Math.abs(e)<1e-12)return Math.abs(t)<1e-12?n:-n/t;let r=Math.sqrt(Math.max(0,t*t-4*e*n)),i=(-t+r)/(2*e),o=(-t-r)/(2*e),a=l=>l>=-1e-9&&l<=1+1e-9;return a(i)?Math.min(1,Math.max(0,i)):a(o)?Math.min(1,Math.max(0,o)):n}function mp(e,t){let n=ul(t.viaX,t.viaY);return n?dp(Math.min(1,Math.max(0,e)),n.x,n.y):up(e,t.curve)}function pp(e,t,n,r){return r==="log"&&e>0&&t>0?Math.exp(Math.log(e)+(Math.log(t)-Math.log(e))*n):e+(t-e)*n}function wn(e,t,n="linear"){let r=e.points;if(r.length===0)return 0;let i=r[0];if(t<=i.t)return i.v;let o=r[r.length-1];if(t>=o.t)return o.v;let a=0,l=r.length-1;for(;l-a>1;){let m=a+l>>1;r[m].t<=t?a=m:l=m}let s=r[a],u=r[l],c=u.t-s.t;return c<=0?u.v:pp(s.v,u.v,mp((t-s.t)/c,s),n)}function fl(e){return e.points.length<=1||e.points.every(t=>t.v===e.points[0].v)}function ml(e,t,n,r,i="linear"){let o=Math.max(2,Math.floor(r)),a=new Float32Array(o),l=n-t;for(let s=0;s<o;s+=1)a[s]=wn(e,t+l*s/(o-1),i);return a}var Nr=new Map,hp=64;function gp(e){let t=Nr.get(e);if(t!==void 0)return t;let n=null;try{n=Fr(e).lanes.find(r=>r.target===Ht)??null}catch{n=null}return Nr.size>hp&&Nr.clear(),Nr.set(e,n),n}function pl(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(_t):null)??"";if(!n)return null;let r=gp(n);return!r||r.points.length===0?null:wn(r,t)}var Bt="hf-audio-group",hl="data-audio-group";function ro(e){let t=e?.getAttribute("data-volume"),n=t?parseFloat(t):1;return Number.isFinite(n)?n:1}function io(e,t){let n=Array.from(e?.querySelectorAll?.(`${Bt}[${hn}]`)??[]).find(i=>i.getAttribute(hn)===t);if(n)return n;let r=e?.getElementById(t)??null;return r&&r.tagName?.toLowerCase()===Bt?r:null}function Lr(e,t){let n=t?.getAttribute?.(qs)??t?.getAttribute?.(hl);return n?io(e,n)?.hasAttribute("data-hidden")??!1:!1}function gl(e){return typeof e.tagName!="string"||e.tagName.toLowerCase()!=="audio"||typeof e.getAttribute!="function"?null:e.getAttribute(hl)||null}function bl(e){let t="__hf-audio-group-inert";if(!e?.head||e.getElementById(t))return;let n=e.createElement("style");n.id=t,n.textContent=`${Bt}{display:none!important}`,e.head.appendChild(n)}function je(e){return gn(e)}function xl(e){let t=e.isVideo?e.explicitDuration??e.sourceDuration:e.sourceDuration,n=(e.isVideo?[t,e.hostRemaining]:[t,e.hostRemaining,e.explicitDuration]).filter(r=>r!=null&&Number.isFinite(r)&&r>=0);return n.length>0?Math.min(...n):null}function yl(e){let t=Array.from(document.querySelectorAll("video, audio")),n=e?.shouldIncludeElement?t.filter(a=>e.shouldIncludeElement?.(a)):t.filter(a=>a.hasAttribute("data-start")),r=[],i=[],o=0;for(let a of n){let l=e?.resolveStartSeconds?e.resolveStartSeconds(a):Number.parseFloat(a.dataset.start??"0");if(!Number.isFinite(l))continue;let s=je(a),u=_e(a),c=a.loop,m=Number.isFinite(a.duration)&&a.duration>0?a.duration:null,f=e?.resolveDurationSeconds?.(a)??Number.parseFloat(a.dataset.duration??"");(!Number.isFinite(f)||f<0)&&m!=null&&(f=Math.max(0,(m-s)/u));let p=Number.isFinite(f)&&f>=0,b=p?l+f:Number.POSITIVE_INFINITY,v=Number.parseFloat(a.dataset.volume??""),x={el:a,start:l,mediaStart:s,duration:p?f:Number.POSITIVE_INFINITY,end:b,volume:Number.isFinite(v)?v:null,playbackRate:u,loop:c,sourceDuration:m};r.push(x),a.tagName==="VIDEO"&&i.push(x),Number.isFinite(b)&&(o=Math.max(o,b))}return{timedMediaEls:n,mediaClips:r,videoClips:i,maxMediaEnd:o}}var ao=new WeakMap,Dr=new WeakMap,Cn=new WeakMap,so=new WeakSet,Ut=new WeakSet;function bp(e){if(Ut.has(e))return;Ut.add(e);let t=()=>Ut.delete(e);e.addEventListener("playing",t,{once:!0}),e.addEventListener("pause",t,{once:!0}),e.addEventListener("error",t,{once:!0})}var xp=3;function yp(e){return e.error!=null||e.networkState===xp}var lo=new WeakMap;function oo(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function uo(e){ao.delete(e),Dr.delete(e),Cn.delete(e),so.delete(e),lo.delete(e)}function vl(e){let t=!!(e.outputMuted||e.userMuted);for(let n of e.clips){let{el:r}=n;if(!r.isConnected)continue;let i=(e.timeSeconds-n.start)*n.playbackRate+n.mediaStart,o=r.tagName==="VIDEO"&&!n.loop,a=o&&n.sourceDuration!=null&&i>=n.sourceDuration&&e.timeSeconds>=n.start&&e.timeSeconds<n.end;a&&n.sourceDuration!=null&&(i=n.sourceDuration);let l=Dr.get(r),s=r.tagName==="AUDIO"&&(l===void 0||i<l-.04),u=!n.loop&&n.sourceDuration!=null&&i>=n.mediaStart&&i<n.sourceDuration&&(o||s);if(e.timeSeconds>=n.start&&e.timeSeconds<n.end&&i>=0&&(!r.ended||n.loop||a||u)){if(Dr.set(r,i),n.loop&&n.sourceDuration!=null&&n.sourceDuration>0){let G=n.sourceDuration-n.mediaStart;G>0&&i>=n.sourceDuration&&(i=n.mediaStart+(i-n.mediaStart)%G)}let f=oo(e.userVolume??1),p=Le(n.volume??1),b=lo.get(r),v=oo(r.volume),x,_=pl(r,e.timeSeconds-n.start);if(_!==null)x=Le(_);else if(n.volumeKeyframes&&n.volumeKeyframes.length>0){let G=e.timeSeconds-n.start;x=Le(tl(n.volumeKeyframes,G))}else e.isWebAudioRouted?.(r)?x=p:b===void 0?x=p>1?p:v:Math.abs(v-b)>1e-4?x=v:x=p;let T=r.closest("[data-hidden]")!==null||Lr(r.ownerDocument,r)?0:oo(x*f);r.volume=T,lo.set(r,T),e.onElementVolume?.(r,T,x),(t||e.isWebAudioOwned?.(r))&&(r.muted=!0),r.preload!=="auto"&&(r.preload="auto");try{r.playbackRate=n.playbackRate*e.playbackRate}catch(G){L("runtime.media.site1",G)}let M=.04,F=2,E=r.currentTime||0,S=Math.abs(E-i),A=i-E,C=ao.get(r);ao.set(r,A);let N=C===void 0,I=!N&&Math.abs(A-C)>.5,W=S>3,U=r.tagName==="AUDIO"&&N&&E-i>M,oe=a&&S>.001||r.ended&&u&&S>.001||U||S>.5&&(N||I||W),k=r.tagName==="VIDEO"&&!r.paused,V=C!==void 0&&Math.abs(A-C)<.004,J=!1;if(!k&&!oe&&!N&&V&&S>M){let G=(Cn.get(r)??0)+1;Cn.set(r,G),G>=F&&(J=!0,Cn.set(r,0))}else S<=M&&Cn.set(r,0);let H=!k&&e.forceSync&&S>.02;if(oe||J||H){if(!(r.tagName==="VIDEO"&&!!lt(r))){try{r.currentTime=i}catch(z){L("runtime.media.site2",z)}if(Math.abs(r.currentTime-i)>.5&&!so.has(r)){so.add(r),r.load();try{r.currentTime=i}catch(z){L("runtime.media.site3",z)}}}Ut.delete(r)}a?r.paused||r.pause():e.playing&&r.paused&&!Ut.has(r)&&!yp(r)?(bp(r),r.play().catch(G=>{Ut.delete(r),(G&&typeof G=="object"&&"name"in G?String(G.name??""):"")==="NotAllowedError"&&e.onAutoplayBlocked?.()})):!e.playing&&!r.paused&&r.pause();continue}let m=e.timeSeconds>=n.start&&e.timeSeconds<n.end;uo(r),m&&Dr.set(r,i),r.paused||r.pause()}}var vp="hf-proxy",Sl="runtime_media_proxy_fallback",Al="runtime_media_proxy_unavailable",_n=new WeakSet,El=new WeakSet;function Ir(e){return e.currentSrc||e.src}function co(e){return window.__HF_EXPORT_RENDER_SEEK_CONFIG?!0:e instanceof HTMLVideoElement&&!!lt(e)}function fo(e){let t=Ir(e);if(!t)return null;let n;try{n=new URL(t,document.baseURI)}catch{return null}if(n.origin!==window.location.origin)return null;try{return decodeURIComponent(n.pathname)}catch{return n.pathname}}function Sp(e,t){let n=null;for(let r of Object.keys(t))e.endsWith(r)&&(n===null||r.length>n.length)&&(n=r);return n?t[n]??null:null}function Ap(e,t){let n=e.normalize("NFC").toLowerCase(),r=-1,i=null,o=!1;for(let[a,l]of Object.entries(t)){let s=a.normalize("NFC").toLowerCase();n.endsWith(s)&&(s.length>r?(r=s.length,i=l,o=!1):s.length===r&&(o=!0))}return o?null:i}function mo(e,t){return t[e]??Sp(e,t)??Ap(e,t)}function Ep(e,t){let n=new URL(e,document.baseURI);return n.searchParams.set(vp,t?t.hasAlpha?"vp8":"h264":"auto"),n.href}var wp={cross_origin:"video reports zero decodable width but its source is cross-origin; no local proxy can be served for it",proxy_playback_failed:"the authoring proxy itself failed to decode; render output is unaffected",browser_safe_codec:"the file errored but its codec is browser-decodable; a proxy cannot help (the file itself is likely corrupt)",invalid_source_url:"the media source URL is malformed and cannot be proxied"};function Tt(e,t,n){if(El.has(e))return;El.add(e);let r=wp[t];xe({source:"hf-preview",type:"diagnostic",code:Al,details:{asset:n,codecName:null,reason:t,note:r}}),console.info(`[hyperframes] ${Al}: "${n}" (${t}): ${r}`)}function po(e,t=null,n="reactive"){if(_n.has(e))return;let r=Ir(e),i;try{i=Ep(r,t)}catch(l){L("runtime.mediaProxy.swap",l),Tt(e,"invalid_source_url",r);return}_n.add(e),uo(e),e.src=i,e.load();let o=t?.codecName??null;xe({source:"hf-preview",type:"diagnostic",code:Sl,details:{asset:r,codecName:o,trigger:n,note:"render output is unaffected; only this preview element was swapped to an authoring proxy"}}),console.info(`[hyperframes] ${Sl}: "${r}" uses a codec (${o??"unknown"}) this browser can\'t decode; auto-swapped to an authoring proxy for this preview only. Render output is unaffected.`)}function wl(e){if(co(e)||!(e instanceof HTMLVideoElement)||_n.has(e))return;let t=window.__HF_MEDIA_CODEC_MAP__;if(!t)return;let n=fo(e);if(n===null)return;let r=mo(n,t);if(!r||!r.browserHostile)return;let i=r.representativeMime?e.canPlayType(r.representativeMime):"";i==="probably"||i==="maybe"||po(e,r,"proactive")}function Cl(e){if(co(e)||!(e instanceof HTMLVideoElement)||e.videoWidth!==0)return;let t=Ir(e);if(_n.has(e)){Tt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=fo(e);if(r===null){Tt(e,"cross_origin",t);return}let i=mo(r,n);if(i&&!i.browserHostile){Tt(e,"browser_safe_codec",t);return}po(e,i,"reactive")}function _l(e){if(co(e)||!(e instanceof HTMLVideoElement))return;let t=Ir(e);if(_n.has(e)){Tt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=fo(e);if(r===null){Tt(e,"cross_origin",t);return}let i=mo(r,n);if(i&&!i.browserHostile){Tt(e,"browser_safe_codec",t);return}po(e,i,"tertiary")}var Se=class extends Error{constructor(n,r=null){super(r==null?n:`${n} at line ${r}`);ge(this,"lineNumber");this.name="CubeLutParseError",this.lineNumber=r}},Cp=[0,0,0],_p=[1,1,1],Pr=64;function Tp(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];if(r===\'"\'&&(t=!t),r==="#"&&!t)return e.slice(0,n)}return e}function ct(e,t){let n=Number(e);if(!Number.isFinite(n))throw new Se(`Invalid number "${e}"`,t);return n}function Tl(e,t,n){if(e.length!==3)throw new Se(`${t} expects three numbers`,n);return[ct(e[0],n),ct(e[1],n),ct(e[2],n)]}function Rl(e,t,n){if(!e)throw new Se(`${t} expects a size`,n);let r=Number(e);if(!Number.isInteger(r)||r<2)throw new Se(`${t} must be an integer greater than 1`,n);return r}function Rp(e,t){if(t[0]<=e[0]||t[1]<=e[1]||t[2]<=e[2])throw new Se("DOMAIN_MAX values must be greater than DOMAIN_MIN values")}function kp(e){let t=/^TITLE\\s+"([^"]*)"\\s*$/i.exec(e);if(t)return t[1]??null;let n=/^TITLE\\s+(.+)\\s*$/i.exec(e);return n&&(n[1]??"").trim()||null}function Mp(e){return/^[+-]?(?:\\d|\\.\\d)/.test(e)}function kl(e,t={}){let n=t.maxSize??Pr,r=null,i=Cp,o=_p,a=null,l=null,s=[],u=e.replace(/^\\uFEFF/,"").split(/\\r?\\n/);for(let m=0;m<u.length;m++){let f=m+1,p=Tp(u[m]??"").trim();if(!p)continue;let b=p.split(/\\s+/),v=(b[0]??"").toUpperCase(),x=b.slice(1);if(v==="TITLE"){r=kp(p);continue}if(v==="DOMAIN_MIN"){i=Tl(x,v,f);continue}if(v==="DOMAIN_MAX"){o=Tl(x,v,f);continue}if(v==="LUT_3D_INPUT_RANGE"){if(x.length!==2)throw new Se(`${v} expects two numbers`,f);let _=ct(x[0],f),R=ct(x[1],f);if(R<=_)throw new Se("LUT_3D_INPUT_RANGE max must exceed min",f);i=[_,_,_],o=[R,R,R];continue}if(v==="LUT_1D_SIZE"){a=Rl(x[0],v,f);continue}if(v==="LUT_3D_SIZE"){if(l=Rl(x[0],v,f),l>n)throw new Se(`LUT_3D_SIZE ${l} exceeds max ${n}`,f);continue}if(!Mp(v)){if(v.startsWith("LUT_"))throw new Se(`Unsupported cube keyword ${v}`,f);continue}if(!l)throw a?new Se("1D cube LUTs are not supported yet",f):new Se("LUT data appears before LUT_3D_SIZE",f);if(b.length!==3)throw new Se("LUT data rows must contain three numbers",f);s.push(ct(b[0],f),ct(b[1],f),ct(b[2],f))}if(a&&l)throw new Se("Mixed 1D and 3D cube LUTs are not supported yet");if(!l)throw a?new Se("1D cube LUTs are not supported yet"):new Se("Missing LUT_3D_SIZE");Rp(i,o);let c=l*l*l;if(s.length!==c*3)throw new Se(`Expected ${c} LUT rows for size ${l}, found ${s.length/3}`);return{title:r,size:l,domainMin:i,domainMax:o,data:new Float32Array(s)}}function Fp(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):0}function Tn(e){return Math.round(Fp(e)*255)}function ho(e){let t=e.size,n=t*t,r=t,i=new Uint8Array(n*r*4);for(let o=0;o<t;o++)for(let a=0;a<t;a++)for(let l=0;l<t;l++){let s=((o*t+a)*t+l)*3,u=(a*n+o*t+l)*4;i[u]=Tn(e.data[s]??0),i[u+1]=Tn(e.data[s+1]??0),i[u+2]=Tn(e.data[s+2]??0),i[u+3]=255}return{width:n,height:r,data:i}}var Ml="rec709";var me={hueDegrees:{min:0,max:360,inclusiveMax:!1},unit:{min:0,max:1},signedUnit:{min:-1,max:1},secondaryHueRange:{min:0,max:180},secondaryHueSoftness:{min:0,max:180},secondaryHueCombinedMax:180,secondarySoftRangeSoftness:{min:0,max:.5},secondaryHueShift:{min:-180,max:180},effects:{asciiStyle:{min:0,max:7},bloom:{min:0,max:3},bloomRadius:{min:1,max:100},monoScreenShape:{min:0,max:4}}};var Fl=["exposure","contrast","highlights","shadows","whites","blacks","temperature","tint","vibrance","saturation"],Nl=["shadows","midtones","highlights"],Ll=["master","red","green","blue"],Dl=["hueVsHue","hueVsSaturation","hueVsLuma"];var Il=["vignette","vignetteMidpoint","vignetteRoundness","vignetteFeather","grain","grainSize","grainRoughness"],Pl=["blur","pixelate","chromaBleed","tapeDamage","tapeTracking","tapeNoise","tapeSpeed","filmArtifacts","halftone","halftoneSize","twoInkPrint","twoInkPrintSize","ascii","asciiSize","asciiInvert","asciiStyle","asciiColor","asciiRotation","dither","ditherSize","bloom","bloomRadius","monoScreen","monoScreenSize","monoScreenAngle","monoScreenSpread","monoScreenShape","monoScreenInvert","scanlines","scanlineCount","scanlineSoftness","chromaticAberration","chromaticAngle","crtCurvature","digitalGlitch","digitalGlitchColorSplit","digitalGlitchLineTear","digitalGlitchPixelate","digitalGlitchBlockAmount","digitalGlitchBlockDisplacement","digitalGlitchBlockOpacity","digitalGlitchSpeed","engraving","engravingSpacing","engravingMinThickness","engravingMaxThickness","engravingAngle","engravingContrast","engravingSharpness","engravingWave","engravingWaveFrequency","crosshatch","crosshatchSpacing","crosshatchThickness","crosshatchAngle","crosshatchContrast","crosshatchEdges","crosshatchLineWeight","crosshatchWave","crosshatchWaveFrequency","kuwahara","kuwaharaRadius","kuwaharaSharpness","kuwaharaSaturation"];var Cv=me.unit,_v=me.signedUnit,Tv=me.effects;var Ke=1024,Rn=16;function Ol(e,t,n,r){let i=((2*e+t)*n-e*r)/(e+t);return Math.sign(i)!==Math.sign(n)?0:Math.sign(n)!==Math.sign(r)&&Math.abs(i)>3*Math.abs(n)?3*n:i}function Ae(e,t){let n=e[t];if(n===void 0)throw new RangeError("Color curve points must be contiguous");return n}function Np(e){let t=[],n=[],r=Ae(e,0);for(let a of e.slice(1)){let l=a[0]-r[0];t.push(l),n.push((a[1]-r[1])/l),r=a}let i=Ae(n,0);if(e.length===2)return[i,i];let o=new Array(e.length);o[0]=Ol(Ae(t,0),Ae(t,1),i,Ae(n,1)),o[o.length-1]=Ol(Ae(t,t.length-1),Ae(t,t.length-2),Ae(n,n.length-1),Ae(n,n.length-2));for(let a=1;a<e.length-1;a+=1){let l=Ae(n,a-1),s=Ae(n,a);if(l===0||s===0||Math.sign(l)!==Math.sign(s)){o[a]=0;continue}let u=Ae(t,a-1),c=Ae(t,a),m=2*c+u,f=c+2*u;o[a]=(m+f)/(m/l+f/s)}return o}function Gl(e,t){if(e.length<2)throw new RangeError("A color curve requires at least two points");if(!Number.isInteger(t)||t<2)throw new RangeError("Curve LUT size must be at least 2");let n=Number.NEGATIVE_INFINITY;for(let[r,i]of e){if(!Number.isFinite(r)||!Number.isFinite(i))throw new TypeError("Color curve points must be finite");if(r<=n)throw new RangeError("Color curve inputs must be strictly increasing");n=r}}function Lp(e,t,n){if(!Number.isFinite(t)||!Number.isFinite(n)||t>=n)throw new RangeError("Curve output bounds must be finite and increasing");if(e.some(([,r])=>r<t||r>n))throw new RangeError(`Curve outputs must be between ${t} and ${n}`)}function Dp(e,t,n,r,i){let o=n[0]-t[0],a=Math.min(1,Math.max(0,(e-t[0])/o)),l=a*a,s=l*a;return(2*s-3*l+1)*t[1]+(s-2*l+a)*o*r+(-2*s+3*l)*n[1]+(s-l)*o*i}function Hl(e,t,n,r,i){Lp(e,r,i);let o=Np(e),a=new Float32Array(t),l=0;for(let s=0;s<t;s+=1){let u=n(s);for(;l<e.length-2&&u>Ae(e,l+1)[0];)l+=1;let c=Ae(e,l),m=Ae(e,l+1),f=Dp(u,c,m,Ae(o,l),Ae(o,l+1));a[s]=Math.min(i,Math.max(r,f))}return a}function Wt(e,t=Ke){if(Gl(e,t),e.length>Rn)throw new RangeError(`A color curve supports at most ${Rn} points`);if(e.some(([n])=>n<0||n>1))throw new RangeError("Color curve inputs must be between 0 and 1");if(e[0]?.[0]!==0||e[e.length-1]?.[0]!==1)throw new RangeError("Color curves must include input endpoints 0 and 1");return Hl(e,t,n=>n/(t-1),0,1)}function bo(e,t,n,r=Ke){if(e.length<3)throw new RangeError("A hue curve requires at least three points");if(e.length>Rn)throw new RangeError(`A hue curve supports at most ${Rn} points`);let i=[...e].sort((s,u)=>s[0]-u[0]);for(let s=0;s<i.length;s+=1){let u=i[s];if(!u||u[0]<0||u[0]>=360)throw new RangeError("Hue curve inputs must be from 0 up to 360 degrees");if(s>0&&u[0]===i[s-1]?.[0])throw new RangeError("Hue curve inputs must be unique")}let o=i.slice(-2).map(([s,u])=>[s-360,u]),a=i.slice(0,2).map(([s,u])=>[s+360,u]),l=[...o,...i,...a];return Gl(l,r),Hl(l,r,s=>s/r*360,t,n)}var kn="data-color-grading",Mn="data-hf-color-grading-source-hidden",Hr="data-hf-authored-opacity",zl="__hf_color_grading_",Pp=Ml,vo={exposure:0,contrast:0,highlights:0,shadows:0,whites:0,blacks:0,temperature:0,tint:0,vibrance:0,saturation:0},So={vignette:0,vignetteMidpoint:.5,vignetteRoundness:0,vignetteFeather:.65,grain:0,grainSize:.25,grainRoughness:.5},Ao={blur:0,pixelate:0,chromaBleed:0,tapeDamage:0,tapeTracking:0,tapeNoise:1,tapeSpeed:.5,filmArtifacts:0,halftone:0,halftoneSize:0,twoInkPrint:0,twoInkPrintSize:0,ascii:0,asciiSize:5/76,asciiInvert:0,asciiStyle:0,asciiColor:1,asciiRotation:0,dither:0,ditherSize:0,bloom:0,bloomRadius:8,monoScreen:0,monoScreenSize:0,monoScreenAngle:0,monoScreenSpread:0,monoScreenShape:0,monoScreenInvert:0,scanlines:0,scanlineCount:0,scanlineSoftness:0,chromaticAberration:0,chromaticAngle:0,crtCurvature:0,digitalGlitch:0,digitalGlitchColorSplit:0,digitalGlitchLineTear:0,digitalGlitchPixelate:0,digitalGlitchBlockAmount:0,digitalGlitchBlockDisplacement:0,digitalGlitchBlockOpacity:0,digitalGlitchSpeed:0,engraving:0,engravingSpacing:7/17,engravingMinThickness:.2,engravingMaxThickness:3.2/7,engravingAngle:.25,engravingContrast:7/15,engravingSharpness:.59,engravingWave:.2,engravingWaveFrequency:2/9,crosshatch:0,crosshatchSpacing:7/25,crosshatchThickness:.25,crosshatchAngle:.25,crosshatchContrast:1/3,crosshatchEdges:.5,crosshatchLineWeight:0,crosshatchWave:.33,crosshatchWaveFrequency:2/9,kuwahara:0,kuwaharaRadius:1/7,kuwaharaSharpness:5/16,kuwaharaSaturation:.5};var Br=Fl,ql=Nl,$l=Ll,jl=Dl,wo=Il,Co=Pl,Bl={exposure:.03,contrast:-.12,highlights:-.1,shadows:.16,whites:-.04,blacks:.08,temperature:.13,vibrance:-.08,saturation:-.08},Ul={vignette:.18};function Ee(e,t,n={},r={},i={},o=1){return{id:e,label:t,intensity:o,adjust:{...vo,...n},details:{...So,...r},effects:{...Ao,...i}}}var _o=[Ee("neutral","Neutral"),Ee("warm-daylight","Warm Daylight",{exposure:.06,contrast:.07,highlights:-.06,shadows:.08,temperature:.18,saturation:.08}),Ee("clean-studio","Clean Studio",{contrast:.08,highlights:-.08,shadows:.06,temperature:-.08,tint:.03,saturation:.04}),Ee("skin-soft","Skin Soft",{exposure:.04,contrast:-.03,highlights:-.12,shadows:.12,temperature:.08,tint:.02,saturation:.04}),Ee("food-pop","Food Pop",{exposure:.06,contrast:.1,shadows:.06,temperature:.14,vibrance:.1,saturation:.18}),Ee("night-lift","Night Lift",{exposure:.08,contrast:.08,highlights:-.18,shadows:.2,blacks:-.08,saturation:.04},{vignette:.12}),Ee("muted-editorial","Muted Editorial",{exposure:-.02,contrast:.08,highlights:-.08,shadows:.06,blacks:-.05,temperature:-.03,saturation:-.12},{vignette:.1}),Ee("vintage-wash","Vintage Wash",Bl,Ul),Ee("mono-clean","Mono Clean",{contrast:.12,highlights:-.04,shadows:.04,blacks:-.08,saturation:-1}),Ee("mono-fade","Mono Fade",{contrast:-.04,highlights:-.06,shadows:.1,blacks:.12,saturation:-1},{vignette:.08}),Ee("soft-boost","Soft Boost",{exposure:.06,contrast:-.04,highlights:-.14,shadows:.16,vibrance:.08,saturation:.1}),Ee("bright-pop","Bright Pop",{exposure:.12,contrast:.12,whites:.08,blacks:-.04,vibrance:.08,saturation:.14}),Ee("deep-contrast","Deep Contrast",{exposure:-.03,contrast:.2,highlights:-.08,shadows:-.08,blacks:-.12,saturation:.06}),Ee("creator-camcorder","Creator Camcorder",{contrast:.08,highlights:-.05,shadows:.02,whites:.03,blacks:-.04,temperature:-.03,tint:-.015,vibrance:-.03,saturation:-.06},{vignette:.06,grain:.08,grainSize:.18,grainRoughness:.58},{chromaBleed:.55},.72),Ee("vhs-playback","VHS Playback",{contrast:-.04,saturation:-.08},{grain:.16,grainSize:.12,grainRoughness:.72},{tapeDamage:.82,tapeTracking:.85,tapeNoise:.3,tapeSpeed:.5,chromaBleed:.5,chromaticAberration:.18,scanlines:.35,scanlineCount:.17,scanlineSoftness:1,digitalGlitch:.32,digitalGlitchLineTear:.08,digitalGlitchSpeed:.5}),Ee("home-movie-8mm","8mm Home Movie",Bl,{...Ul,vignette:.28,vignetteMidpoint:.54,vignetteFeather:.72,grain:.34,grainSize:.18,grainRoughness:.72},{filmArtifacts:.62},.72),Ee("editorial-halftone","Editorial Halftone",{contrast:.04,saturation:.04},{},{halftone:.94,halftoneSize:.36}),Ee("two-ink-print","Two-Ink Print",{contrast:.08,highlights:-.06,shadows:.04},{},{twoInkPrint:1,twoInkPrintSize:.42})],Op=new Map(_o.map(e=>[e.id,e])),Gp=/^\\$(?:\\{([A-Za-z0-9_.:-]+)\\}|([A-Za-z0-9_.:-]+))$/,Hp={exposure:{min:-2,max:2},contrast:{min:-1,max:1},highlights:{min:-1,max:1},shadows:{min:-1,max:1},whites:{min:-1,max:1},blacks:{min:-1,max:1},temperature:{min:-1,max:1},tint:{min:-1,max:1},vibrance:{min:-1,max:1},saturation:{min:-1,max:1}},Vt={hue:0,amount:0,level:0},Wl={amount:me.unit,level:me.signedUnit},dt=[[0,0],[1,1]],zt=[],Bp={hueVsHue:me.secondaryHueShift,hueVsSaturation:me.signedUnit,hueVsLuma:me.signedUnit},xo={center:0,range:180,softness:0},yo={min:0,max:1,softness:.05},Up={vignette:me.unit,vignetteMidpoint:me.unit,vignetteRoundness:me.signedUnit,vignetteFeather:me.unit,grain:me.unit,grainSize:me.unit,grainRoughness:me.unit},Eo=me.unit,Wp=me.effects,Kl=["blur","pixelate","chromaBleed","tapeDamage","filmArtifacts","halftone","twoInkPrint","ascii","dither","bloom","monoScreen","scanlines","chromaticAberration","crtCurvature","digitalGlitch","engraving","crosshatch","kuwahara"];var Vp=_o.filter(e=>Kl.some(t=>e.effects[t]>1e-4)),Iv=_o.filter(e=>!Vp.includes(e)),Pv={blur:{blur:.45},pixelate:{pixelate:.55},bloom:{bloom:.55,bloomRadius:8},chromaBleed:{chromaBleed:.55},tapeDamage:{tapeDamage:.65,tapeTracking:.55,tapeNoise:.25,tapeSpeed:.5},filmArtifacts:{filmArtifacts:.55},scanlines:{scanlines:.35,scanlineCount:.17,scanlineSoftness:1},chromaticAberration:{chromaticAberration:.15,chromaticAngle:0},crtCurvature:{crtCurvature:.2},digitalGlitch:{digitalGlitch:.55,digitalGlitchColorSplit:.25,digitalGlitchLineTear:.25,digitalGlitchPixelate:.15,digitalGlitchBlockAmount:.5,digitalGlitchBlockDisplacement:.25,digitalGlitchBlockOpacity:0,digitalGlitchSpeed:.5},halftone:{halftone:.94,halftoneSize:.36},twoInkPrint:{twoInkPrint:1,twoInkPrintSize:.42},ascii:{ascii:1,asciiSize:5/76,asciiInvert:0,asciiStyle:0,asciiColor:1,asciiRotation:0},dither:{dither:1,ditherSize:.5},monoScreen:{monoScreen:1,monoScreenSize:.35,monoScreenAngle:.25,monoScreenSpread:.3,monoScreenShape:0,monoScreenInvert:0},engraving:{engraving:1,engravingSpacing:7/17,engravingMinThickness:.2,engravingMaxThickness:3.2/7,engravingAngle:.25,engravingContrast:7/15,engravingSharpness:.59,engravingWave:.2,engravingWaveFrequency:2/9},crosshatch:{crosshatch:1,crosshatchSpacing:7/25,crosshatchThickness:.25,crosshatchAngle:.25,crosshatchContrast:1/3,crosshatchEdges:.5,crosshatchLineWeight:0,crosshatchWave:.33,crosshatchWaveFrequency:2/9},kuwahara:{kuwahara:1,kuwaharaRadius:1/7,kuwaharaSharpness:5/16,kuwaharaSaturation:.5}},Yl=[{path:"intensity",name:"--hf-color-grading-intensity",min:0,max:1},{path:"lut.intensity",name:"--hf-color-grading-lut-intensity",min:0,max:1},{path:"adjust.exposure",name:"--hf-color-grading-exposure",min:-2,max:2},{path:"effects.blur",name:"--hf-color-grading-blur",min:0,max:1},{path:"effects.bloom",name:"--hf-color-grading-bloom",min:0,max:3},{path:"effects.kuwahara",name:"--hf-color-grading-kuwahara",min:0,max:1},{path:"effects.pixelate",name:"--hf-color-grading-pixelate",min:0,max:1},{path:"effects.ascii",name:"--hf-color-grading-ascii",min:0,max:1},{path:"effects.dither",name:"--hf-color-grading-dither",min:0,max:1}];var zp=/^#[0-9a-f]{6}$/i;function qp(e){return!Array.isArray(e)||e.length<2||e.length>6||!e.every(t=>typeof t=="string"&&zp.test(t))?null:e.map(t=>t.toLowerCase())}function Te(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Gr(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,e)):0}function Xl(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?Math.min(1,Math.max(0,n)):t}function Re(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?Gr(n,t.min,t.max):0}function To(e,t=0){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?(n%360+360)%360:t}function $p(e){let t=Te(e)?e:{};return ql.reduce((n,r)=>{let i=Te(t[r])?t[r]:{};return n[r]={hue:To(i.hue,Vt.hue),amount:Re(i.amount??Vt.amount,Wl.amount),level:Re(i.level??Vt.level,Wl.level)},n},{shadows:{...Vt},midtones:{...Vt},highlights:{...Vt}})}function jp(e){if(!Array.isArray(e)||e.length!==2)return null;let t=Number(e[0]),n=Number(e[1]);return Number.isFinite(t)&&Number.isFinite(n)?[Gr(t,0,1),Gr(n,0,1)]:null}function Jl(e){return e.some((t,n)=>n>0&&t[0]===e[n-1]?.[0])}function Kp(e){(e[0]?.[0]??0)>0&&e.unshift([0,0]),(e.at(-1)?.[0]??1)<1&&e.push([1,1])}function Yp(e){if(!Array.isArray(e)||e.length<2)return dt;let t=[];for(let n of e){let r=jp(n);if(!r)return dt;t.push(r)}return t.sort((n,r)=>n[0]-r[0]),Jl(t)||(Kp(t),t.length>16)?dt:t}function Xp(e){let t=Te(e)?e:{};return $l.reduce((n,r)=>(n[r]=Yp(t[r]),n),{master:dt,red:dt,green:dt,blue:dt})}function Jp(e,t){if(!Array.isArray(e)||e.length!==2)return null;let n=Number(e[0]),r=Number(e[1]);return Number.isFinite(n)&&Number.isFinite(r)?[To(n),Gr(r,t.min,t.max)]:null}function Qp(e,t){if(!Array.isArray(e)||e.length<3||e.length>16)return zt;let n=[];for(let r of e){let i=Jp(r,t);if(!i)return zt;n.push(i)}return n.sort((r,i)=>r[0]-i[0]),Jl(n)?zt:n}function Zp(e){let t=Te(e)?e:{};return jl.reduce((n,r)=>(n[r]=Qp(t[r],Bp[r]),n),{hueVsHue:zt,hueVsSaturation:zt,hueVsLuma:zt})}function Vl(e){let t=Te(e)?e:{},n=Re(t.min??yo.min,Eo),r=Re(t.max??yo.max,Eo);return{min:Math.min(n,r),max:Math.max(n,r),softness:Re(t.softness??yo.softness,me.secondarySoftRangeSoftness)}}function eh(e){let t=Te(e)?e:{},n=Re(t.range??xo.range,me.secondaryHueRange);return{center:To(t.center,xo.center),range:n,softness:Re(t.softness??xo.softness,{min:me.secondaryHueSoftness.min,max:me.secondaryHueCombinedMax-n})}}function th(e){return{hueShift:Re(e.hueShift??0,me.secondaryHueShift),saturation:Re(e.saturation??0,me.signedUnit),luma:Re(e.luma??0,me.signedUnit),temperature:Re(e.temperature??0,me.signedUnit),tint:Re(e.tint??0,me.signedUnit)}}function nh(e){return!Te(e)||!Te(e.key)||!Te(e.correction)?null:{enabled:e.enabled!==!1,key:{hue:eh(e.key.hue),saturation:Vl(e.key.saturation),luma:Vl(e.key.luma)},correction:th(e.correction)}}function rh(e){if(!Array.isArray(e))return[];let t=[];for(let n of e.slice(0,4)){let r=nh(n);r&&t.push(r)}return t}function ih(e){if(e==null)return null;let t=String(e).trim();return t||null}function oh(e){if(e==null)return null;if(typeof e=="string"){let n=e.trim();return n?{src:n,intensity:1}:null}if(!Te(e))return null;let t=e.src;return typeof t!="string"||t.trim()===""?null:{src:t.trim(),intensity:Xl(e.intensity,1)}}function ah(e){if(typeof e=="string"){let t=e.trim();if(!t)return null;if(t.startsWith("{"))try{let n=JSON.parse(t);return Te(n)?n:null}catch{return null}return{preset:t}}return Te(e)?e:null}function sh(e,t){let n=e.trim().match(Gp);if(!n)return e;let r=n[1]??n[2]??"";return r&&Object.hasOwn(t,r)?t[r]:e}function Or(e,t){if(typeof e=="string"){let r=sh(e,t);if(r!==e)return r;let i=e.trim();if(!i.startsWith("{"))return e;try{return Or(JSON.parse(i),t)}catch{return e}}if(Array.isArray(e))return e.map(r=>Or(r,t));if(!Te(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=Or(i,t);return n}function lh(e){return e?Op.get(e)??null:null}function Ur(e){let t=ah(e);if(!t||t.enabled===!1)return null;let n=ih(t.preset),r=lh(n),i=r?.adjust??vo,o=r?.details??So,a=r?.effects??Ao,l=Te(t.adjust)?t.adjust:{},s=Te(t.details)?t.details:{},u=Te(t.effects)?t.effects:{},c=Br.reduce((p,b)=>(p[b]=Re(l[b]??i[b],Hp[b]),p),{...vo}),m=wo.reduce((p,b)=>(p[b]=Re(s[b]??o[b],Up[b]),p),{...So}),f=Co.reduce((p,b)=>(p[b]=Re(u[b]??a[b],Wp[b]??Eo),p),{...Ao});return{enabled:!0,preset:n,intensity:Xl(t.intensity,r?.intensity??1),adjust:c,wheels:$p(t.wheels),curves:Xp(t.curves),hueCurves:Zp(t.hueCurves),secondaries:rh(t.secondaries),details:m,effects:f,palette:qp(t.palette),lut:oh(t.lut),colorSpace:typeof t.colorSpace=="string"&&t.colorSpace.trim()?t.colorSpace.trim():Pp}}function Ql(e,t){return Ur(Or(e,t))}function uh(e){return ql.some(t=>Math.abs(e[t].amount)>1e-4||Math.abs(e[t].level)>1e-4)}function Ro(e){return $l.some(t=>e[t].some(([n,r])=>Math.abs(n-r)>1e-4))}function ko(e){return jl.some(t=>e[t].some(([,n])=>Math.abs(n)>1e-4))}function Mo(e){return e.some(t=>t.enabled&&Object.values(t.correction).some(n=>Math.abs(n)>1e-4))}function Zl(e){return e?.enabled?Math.abs(e.details.vignette)>1e-4||Math.abs(e.details.grain)>1e-4||Kl.some(n=>Math.abs(e.effects[n])>1e-4)?!0:e.intensity===0?!1:e.lut&&e.lut.intensity!==0?!0:Br.some(n=>Math.abs(e.adjust[n])>1e-4)||(e.wheels?uh(e.wheels):!1)||(e.curves?Ro(e.curves):!1)||(e.hueCurves?ko(e.hueCurves):!1)||(e.secondaries?Mo(e.secondaries):!1):!1}var ch=["[data-hyperframes-ignore]","[data-hyperframes-picker-ignore]","[data-hf-ignore]","[data-no-inspect]","[data-no-pick]","[data-hyper-shader-loading]"].join(","),dh=["[data-hyperframes-picker-block]","[data-hyper-shader-loading]"].join(",");function eu(e){let t=!1,n=null,r=null,i=null,o=null;function a(S,A){try{window.dispatchEvent(new CustomEvent(S,{detail:A}))}catch(C){L("runtime.picker.site1",C)}}function l(S){i=S,a("hyperframe:picker:hovered",{elementInfo:i,isPickMode:t,timestamp:Date.now()})}function s(S){o=S,a("hyperframe:picker:selected",{elementInfo:o,isPickMode:t,timestamp:Date.now()})}function u(S){let A=S.ownerDocument.defaultView;if(!A)return!1;let C=S;for(;C&&C!==document.body&&C!==document.documentElement;){let N=A.getComputedStyle(C);if(N.display==="none"||N.visibility==="hidden"||N.pointerEvents==="none")return!0;let I=Number.parseFloat(N.opacity);if(Number.isFinite(I)&&I<=.01&&!C.hasAttribute(Mn))return!0;C=C.parentElement}return!1}function c(S){if(!S||S===document.body||S===document.documentElement)return!1;let A=S.tagName.toLowerCase();return!(A==="script"||A==="style"||A==="link"||A==="meta"||S.classList.contains("__hf-pick-highlight")||S.closest(ch)||u(S))}function m(S){return!!S?.closest(dh)}function f(S){let A=S;if(A.id)return`#${CSS.escape(A.id)}`;let C=S.getAttribute("data-composition-id");if(C)return`[data-composition-id="${CSS.escape(C)}"]`;let N=S.getAttribute("data-composition-src");if(N)return`[data-composition-src="${CSS.escape(N)}"]`;let I=S.getAttribute("data-track-index");if(I)return`[data-track-index="${CSS.escape(I)}"]`;let W=S.tagName.toLowerCase(),U=S.parentElement;if(!U)return W;let oe=U.querySelectorAll(`:scope > ${W}`);if(oe.length===1)return W;for(let k=0;k<oe.length;k+=1)if(oe[k]===S)return`${W}:nth-of-type(${k+1})`;return W}function p(S){let A=S.tagName.toLowerCase(),C=(S.textContent??"").trim().replace(/\\s+/g," "),N=(I,W)=>I.length>W?`${I.slice(0,W-1)}\\u2026`:I;return A==="h1"||A==="h2"||A==="h3"?"Heading":A==="p"||A==="span"||A==="div"?C.length>0?N(C,56):"Text":A==="img"?"Image":A==="video"?"Video":A==="audio"?"Audio":A==="svg"?"Shape":S.getAttribute("data-composition-src")?"Composition":A==="section"?"Section":`${A.charAt(0).toUpperCase()}${A.slice(1)}`}function b(S,A,C){let N=typeof C=="number"&&C>0?C:8,I=[];if(document.elementsFromPoint)I=document.elementsFromPoint(S,A);else if(document.elementFromPoint){let oe=document.elementFromPoint(S,A);I=oe?[oe]:[]}if(m(I[0]??null))return[];let W={},U=[];for(let[oe,k]of I.entries()){if(!c(k))continue;let V=`${k.tagName}::${k.id||""}::${oe}`;if(!W[V]&&(W[V]=!0,U.push(k),U.length>=N))break}return U}function v(S){let A=S.getBoundingClientRect(),C={};for(let I of Array.from(S.attributes))I.name.startsWith("data-")&&(C[I.name]=I.value);return{id:S.id||null,tagName:S.tagName.toLowerCase(),selector:f(S),label:p(S),boundingBox:{x:A.left,y:A.top,width:A.width,height:A.height},textContent:S.textContent?S.textContent.trim().slice(0,200):null,src:S.getAttribute("src")||S.getAttribute("data-composition-src")||null,dataAttributes:C}}function x(S,A,C){return b(S,A,C).map(v)}function _(S){if(!t)return;let C=b(S.clientX,S.clientY,1)[0]??(S.target instanceof Element?S.target:null);if(!c(C)||n===C)return;n&&n.classList.remove("__hf-pick-highlight"),n=C,C.classList.add("__hf-pick-highlight");let N=v(C);l(N),e.postMessage({source:"hf-preview",type:"element-hovered",elementInfo:N})}function R(S){if(!t)return;S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation();let A=x(S.clientX,S.clientY,8);A.length!==0&&(l(A[0]??null),e.postMessage({source:"hf-preview",type:"element-pick-candidates",candidates:A,selectedIndex:0,point:{x:S.clientX,y:S.clientY}}))}function T(S){S.key==="Escape"&&(F(),e.postMessage({source:"hf-preview",type:"pick-mode-cancelled"}))}function M(){t||(t=!0,r=document.createElement("style"),r.textContent=[".__hf-pick-highlight { outline: 2px solid #4f8cf7 !important; outline-offset: 2px; cursor: crosshair !important; }",".__hf-pick-active * { cursor: crosshair !important; }"].join(`\n`),document.head.appendChild(r),document.body.classList.add("__hf-pick-active"),document.addEventListener("mousemove",_,!0),document.addEventListener("click",R,!0),document.addEventListener("keydown",T,!0),a("hyperframe:picker:mode",{isPickMode:!0,timestamp:Date.now()}))}function F(){t&&(t=!1,n&&(n.classList.remove("__hf-pick-highlight"),n=null),r&&(r.remove(),r=null),document.body.classList.remove("__hf-pick-active"),document.removeEventListener("mousemove",_,!0),document.removeEventListener("click",R,!0),document.removeEventListener("keydown",T,!0),a("hyperframe:picker:mode",{isPickMode:!1,timestamp:Date.now()}))}function E(){window.__HF_PICKER_API={enable:M,disable:F,isActive:()=>t,getHovered:()=>i,getSelected:()=>o,getCandidatesAtPoint:(S,A,C)=>Number.isFinite(S)&&Number.isFinite(A)?x(S,A,C):[],pickAtPoint:(S,A,C)=>{if(!Number.isFinite(S)||!Number.isFinite(A))return null;let N=x(S,A,8);if(!N.length)return null;let I=Math.max(0,Math.min(N.length-1,Number(C??0))),W=N[I]??null;return W?(s(W),e.postMessage({source:"hf-preview",type:"element-picked",elementInfo:W}),F(),W):null},pickManyAtPoint:(S,A,C)=>{if(!Number.isFinite(S)||!Number.isFinite(A))return[];let N=x(S,A,8);if(!N.length)return[];let I=[],W=Array.isArray(C)?C:[0];for(let U of W){let oe=Math.max(0,Math.min(N.length-1,Math.floor(Number(U)))),k=N[oe];if(!k)continue;I.some(J=>J.selector===k.selector&&J.tagName===k.tagName)||I.push(k)}return I.length?(s(I[0]??null),e.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:I}),F(),I):[]}},a("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:M,disablePickMode:F,installPickerApi:E}}var fh=["width","height","top","left","right","bottom","inset","object-fit","object-position","z-index","opacity","visibility","filter","mix-blend-mode","backdrop-filter","border-radius","overflow","clip-path","mask","mask-image","mask-size","mask-position","mask-repeat","transform","transform-origin","translate","rotate","scale","box-sizing"];function qt(e,t){let n=Number.isFinite(t)&&t>0?t:30,r=Number.isFinite(e)&&e>0?e:0;return Math.floor(r*n+1e-9)/n}function tu(e,t,n=fh){for(let r of n){let i=t.getPropertyValue(r);i&&e.setProperty(r,i)}}function Fn(e,t,n){let r=e?.[t];return typeof r=="function"?Number(r.call(e))||n:typeof r=="number"&&Number.isFinite(r)?r:(r!=null&&L("runtime.player.nonConformantNum",{prop:t,actual:typeof r}),n)}function Be(e,t){let n=e?.[t];if(typeof n=="function"){n.call(e);return}n!==void 0&&L("runtime.player.nonConformantVoid",{method:t,actual:typeof n})}function Nn(e,t,n){if(e){for(let r of Object.values(e))if(!(!r||r===t))try{n(r)}catch(i){L("runtime.player.site1",i)}}}function nu(e,t,n,r){let i=qt(t,n),o=r?.suppressEvents===!0;return Be(e,"pause"),typeof e.totalTime=="function"?e.totalTime(i,o):typeof e.seek=="function"&&e.seek(i,o),i}function mh(e,t,n,r,i){let o=[];Nn(e,t,a=>{Be(a,"play"),o.push(a)});try{return nu(t,n,r,i)}finally{for(let a of o)try{Be(a,"pause")}catch(l){L("runtime.player.site2",l)}}}function ph(e,t){Nn(e,t,n=>{Be(n,"play")})}function ru(e){let t=e.transport;return t?{_timeline:null,play:()=>t.play(),pause:()=>t.pause(),seek:(n,r)=>t.seek(n,r),renderSeek:(n,r)=>t.renderSeek(n,r),getTime:()=>t.getTime(),getDuration:()=>t.getDuration(),isPlaying:()=>t.isPlaying(),setPlaybackRate:n=>t.setPlaybackRate(n),getPlaybackRate:()=>t.getPlaybackRate()}:{_timeline:null,play:()=>{let n=e.getTimeline();if(!n||e.getIsPlaying())return;let r=Math.max(0,Number(e.getSafeDuration?.()??Fn(n,"duration",0))||0);r>0&&Math.max(0,Fn(n,"time",0))>=r&&(Be(n,"pause"),typeof n.seek=="function"&&n.seek(0,!1),e.onDeterministicSeek(0),e.setIsPlaying(!1),e.onSyncMedia(0,!1),e.onRenderFrameSeek(0)),typeof n.timeScale=="function"&&n.timeScale(e.getPlaybackRate()),Be(n,"play"),Nn(e.getTimelineRegistry?.(),n,i=>{typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),Be(i,"play")}),e.onDeterministicPlay(),e.setIsPlaying(!0),e.onShowNativeVideos(),e.onStatePost(!0)},pause:()=>{let n=e.getTimeline();if(!n)return;Be(n,"pause"),Nn(e.getTimelineRegistry?.(),n,i=>{Be(i,"pause")});let r=Math.max(0,Fn(n,"time",0));e.onDeterministicSeek(r),e.onDeterministicPause(),e.setIsPlaying(!1),e.onSyncMedia(r,!1),e.onRenderFrameSeek(r),e.onStatePost(!0)},seek:(n,r)=>{let i=e.getTimeline();if(!i)return;let o=Math.max(0,Number(n)||0),a=e.getIsPlaying(),l=mh(e.getTimelineRegistry?.(),i,o,e.getCanonicalFps());e.onDeterministicSeek(l),r?.keepPlaying&&a?(typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),Be(i,"play"),Nn(e.getTimelineRegistry?.(),i,s=>{typeof s.timeScale=="function"&&s.timeScale(e.getPlaybackRate()),Be(s,"play")}),e.onDeterministicPlay(),e.onShowNativeVideos(),e.onSyncMedia(l,!0)):(e.setIsPlaying(!1),e.onSyncMedia(l,!1)),e.onRenderFrameSeek(l),e.onStatePost(!0)},renderSeek:(n,r)=>{let i=e.getTimeline(),o=e.getCanonicalFps(),a=i?(ph(e.getTimelineRegistry?.(),i),nu(i,n,o,r)):qt(Math.max(0,Number(n)||0),o);e.onDeterministicSeek(a,r),e.setIsPlaying(!1),e.onSyncMedia(a,!1),e.onRenderFrameSeek(a),e.onStatePost(!0)},getTime:()=>Fn(e.getTimeline(),"time",0),getDuration:()=>Fn(e.getTimeline(),"duration",0),isPlaying:()=>e.getIsPlaying(),setPlaybackRate:n=>e.setPlaybackRate(n),getPlaybackRate:()=>e.getPlaybackRate()}}function iu(){return{capturedTimeline:null,isPlaying:!1,currentTime:0,deterministicAdapters:[],canonicalFps:30,bridgeMuted:!1,bridgeVolume:1,mediaOutputMuted:!1,nativeMediaSyncDisabled:!1,webAudioMediaDisabled:!1,mediaAutoplayBlockedPosted:!1,mediaForceSyncNextTick:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,controlBridgeHandler:null,beforeUnloadHandler:null,injectedCompStyles:[],injectedCompScripts:[],injectedCompLinks:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,transportClock:null,transportRafId:null}}var hh=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function Fo(e){return e.id||e.getAttribute("data-hf-id")||null}function gh(e){return ye(e)}function bh(e,t){let n=e.getAttribute("data-composition-id");if(!n)return null;let r=Number(t[n]?.duration?.());return Number.isFinite(r)&&r>0?r:null}function xh(e){return!(e instanceof HTMLMediaElement)||!Number.isFinite(e.duration)?null:Ze(e,e.duration)}function yh(e,t,n,r){let i=gh(e.getAttribute("data-duration"));return i!=null&&i>0?i:bh(e,t)??xh(e)??Math.max(0,n-r)}function vh(e){for(let[t,n]of e){let r=t.parentElement;for(;r;){let i=e.get(r);if(i){n.parentId=i.id,i.children.push(n);break}r=r.parentElement}}}function ou(e){let{startResolver:t,timelineRegistry:n,rootDuration:r}=e,i=new Map,o=document.querySelector("[data-composition-id]"),a=0;for(let l of document.querySelectorAll("[data-start]")){if(l===o||hh.has(l.tagName))continue;let s=t.resolveStartForElement(l,0);if(yh(l,n,r,s)<=0)continue;let u={id:Fo(l)??`__clip-${a++}`,element:l,parentId:null,children:[]};i.set(l,u)}return vh(i),{roots:Array.from(i.values()).filter(l=>l.parentId===null)}}function Ln(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;let t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:null}function $t(e){let t=Ln(e.start);if(t==null)return null;let n=Math.max(0,t),r=Ln(e.duration),i=Ln(e.authoredDuration),o=r!=null&&r>0?r:i!=null&&i>0?i:null;if(o!=null)return{start:n,duration:o,end:n+o};let a=Ln(e.end),l=Ln(e.authoredEnd),s=a!=null&&a>n?a:l!=null&&l>n?l:null;return{start:n,duration:s==null?null:s-n,end:s}}var No="css:root",au=["backdrop-filter","clip-path","filter","mask","mask-border-source","mask-image","perspective","rotate","scale","transform","translate","-webkit-mask-image"],Sh=new Set([...au,"contain","isolation","mask-border","mix-blend-mode","opacity"]),Ah=new Set(["absolute","relative"]),Eh=new Set(["flex","inline-flex","grid","inline-grid"]),wh=new Set(["layout","paint","strict","content"]),Ch=new Set(["size","inline-size"]);function _h(e){return e.position==="fixed"||e.position==="sticky"}function Th(e,t){if(t.zIndex==="auto"||t.zIndex==="")return!1;if(Ah.has(t.position))return!0;let n=e.parentElement?e.ownerDocument.defaultView?.getComputedStyle(e.parentElement).display:null;return n!=null&&Eh.has(n)}function Rh(e){let t=Number.parseFloat(e.opacity);if(Number.isFinite(t)&&t<1||e.getPropertyValue("isolation")==="isolate")return!0;let n=e.getPropertyValue("mix-blend-mode");return n&&n!=="normal"?!0:au.some(r=>{let i=e.getPropertyValue(r);return i!==""&&i!=="none"})}function kh(e){return e.getPropertyValue("contain").split(/\\s+/).some(n=>wh.has(n))?!0:Ch.has(e.getPropertyValue("container-type"))}function Mh(e){return e.getPropertyValue("will-change").split(",").map(t=>t.trim()).some(t=>Sh.has(t))}function Fh(e,t){return _h(t)||Th(e,t)||Rh(t)||kh(t)?!0:Mh(t)}function Nh(e){let t=[],n=e;for(;n?.parentElement;)t.push(Array.prototype.indexOf.call(n.parentElement.children,n)),n=n.parentElement;return`css:${t.reverse().join(".")}`}function Wr(e){let t=e.ownerDocument.defaultView;if(!t)return No;let n=e.parentElement;for(;n&&n!==e.ownerDocument.documentElement;){try{if(Fh(n,t.getComputedStyle(n)))return Nh(n)}catch{return No}n=n.parentElement}return No}function ft(e){let t=e.timelineRegistry??{},n=e.includeAuthoredTimingAttrs??!1,r=e.documentRef??document,i=new WeakMap,o=new WeakMap,a=new Set,l=f=>{let p=r.getElementById(f);return p||(r.querySelector(`[data-composition-id="${CSS.escape(f)}"]`)??null)},s=f=>{let p=f.ownerDocument.defaultView?.HTMLMediaElement;return p?f instanceof p:typeof HTMLMediaElement<"u"&&f instanceof HTMLMediaElement},u=f=>{let p=o.get(f);if(p!==void 0)return p;let b=null,v=$t({start:0,duration:f.getAttribute("data-duration"),authoredDuration:n?f.getAttribute("data-hf-authored-duration"):null});if(v?.duration!=null&&v.duration>0&&(b=v.duration),b==null||b<=0){let x=m(f,0),_=$t({start:x,end:f.getAttribute("data-end"),authoredEnd:n?f.getAttribute("data-hf-authored-end"):null});_?.duration!=null&&_.duration>0&&(b=_.duration)}if((b==null||b<=0)&&s(f)){let x=gn(f);Number.isFinite(f.duration)&&f.duration>x&&(b=(f.duration-x)/_e(f))}if(b==null||b<=0){let x=f.getAttribute("data-composition-id");if(x){let _=t[x]??null;if(_&&typeof _.duration=="function")try{let R=Number(_.duration());Number.isFinite(R)&&R>0&&(b=R)}catch(R){L("runtime.startResolver.site1",R)}}}return b!=null&&Number.isFinite(b)&&b>0?(o.set(f,b),b):(o.set(f,null),null)},c=(f,p)=>{if(f.hasAttribute("data-composition-id")){let v=f.parentElement?.closest("[data-composition-id]");return v?m(v,p):0}let b=f.closest("[data-composition-id]");return b?m(b,p):0},m=(f,p)=>{let b=i.get(f);if(b!==void 0)return b??p;if(a.has(f))return p;a.add(f);try{let v=Zi(f.getAttribute("data-start"));if(!v){if(f.hasAttribute("data-composition-id")){let M=f.parentElement;if(M&&(M.hasAttribute("data-composition-src")||M.hasAttribute("data-composition-id")||M.hasAttribute("data-composition-file"))){let F=m(M,p);return i.set(f,F),F}}return i.set(f,p),p}if(v.kind==="absolute"){let M=Math.max(0,v.value),F=Math.max(0,c(f,p)+M);return i.set(f,F),F}let x=l(v.refId);if(!x)return i.set(f,p),p;let _=m(x,0),R=u(x);if(R==null||R<=0){let M=Math.max(0,_+v.offset);return i.set(f,M),M}let T=Math.max(0,_+R+v.offset);return i.set(f,T),T}finally{a.delete(f)}};return{resolveStartForElement:(f,p=0)=>m(f,Math.max(0,p)),resolveDurationForElement:f=>u(f)}}function Lo(e){let t=e.trim().toLowerCase();return!(!t||t==="main"||t.includes("caption")||t.includes("ambient"))}function mt(e){return ye(e)}function Do(e){let t=e.getAttribute("data-duration"),n=e.getAttribute("data-hf-authored-duration"),r=$t({start:0,duration:t,authoredDuration:n})?.duration;return r??([t,n].map(mt).some(o=>o!=null&&o<=0)?0:null)}function su(e){return $t({start:0,end:e.getAttribute("data-end"),authoredEnd:e.getAttribute("data-hf-authored-end")})?.end??null}function Io(e){try{let t=e.style?.zIndex;if(t&&t!=="auto"){let n=parseInt(t,10);if(Number.isFinite(n))return n}return 0}catch{return 0}}function Po(...e){let t=e.filter(n=>Number.isFinite(n??null));return t.length===0?null:Math.max(...t)}function Oo(e,t){let n=e.getAttribute("data-track-index")??e.getAttribute("data-track");if(n==null)return t;let r=Number.parseInt(n,10);return Number.isFinite(r)?r:t}function In(e){let t=String(e??"").trim();if(!t)return null;let n=t.toLowerCase();if(n.startsWith("data:")||n.startsWith("javascript:"))return null;try{return new URL(t,document.baseURI).toString()}catch{return t}}function lu(e){let t=e.getAttribute("src")??e.getAttribute("data-src");if(t)return In(t);let n=e.getAttribute("data-composition-src");if(n)return In(n);let r=e.querySelector("img[src], video[src], audio[src], source[src]");return r?In(r.getAttribute("src")):null}function Dh(e){let t=e.className;return typeof t!="string"?null:t.split(/\\s+/).map(n=>n.trim()).find(n=>n&&n!=="clip"&&!n.startsWith("__hf-"))??null}function Ih(e){if(!e)return null;try{return new URL(e,document.baseURI).pathname.split("/").filter(Boolean).at(-1)??null}catch{return e.split(/[\\\\/]/).filter(Boolean).at(-1)??null}}function Ph(e){let t=e.textContent?.replace(/\\s+/g," ").trim();return t?t.length>32?`${t.slice(0,31)}...`:t:null}function Dn(e){let t=e.replace(/\\.[^.]+$/i,"").replace(/[-_]+/g," ").replace(/\\s+/g," ").trim();return t?t.replace(/\\b\\w/g,n=>n.toUpperCase()):e}function Oh(e,t,n){let r=e.getAttribute("data-timeline-label")??e.getAttribute("data-label")??e.getAttribute("aria-label")??null;if(r?.trim())return r.trim();let i=e.getAttribute("data-composition-id");if(i)return Dn(i);let o=e.id;if(o)return Dn(o);let a=Dh(e);if(a)return Dn(a);let l=Ih(lu(e));if(l)return Dn(l);let s=Ph(e);return s||`${Dn(t)} ${n+1}`}function uu(e){let n=window.__timelines??{},r=ft({timelineRegistry:n,includeAuthoredTimingAttrs:!0}),i=q=>{if(!q)return null;let P=n[q]??null;if(!P||typeof P.duration!="function")return null;try{let O=Number(P.duration());return Number.isFinite(O)&&O>0?O:null}catch{return null}},o=q=>{let P=mt(q.getAttribute("data-duration"));return P!=null&&P>0?P:Number.isFinite(q.duration)?Ze(q,q.duration):null},a=()=>{let q=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(q.length===0)return null;let P=0;for(let O of q){let j=O.hasAttribute("data-hf-auto-start")?r.resolveStartForElement(O,0):Math.max(0,Number(O.getAttribute("data-start")??0)||0);if(!Number.isFinite(j))continue;let le=o(O);le==null||le<=0||(P=Math.max(P,Math.max(0,j)+le))}return P>0?P:null},l=(q,P)=>{let O=[],j=null,le=null,Z=null,K=q.parentElement;for(;K;){let Y=K.getAttribute("data-composition-id");Y&&(O.push(Y),!Z&&K!==P&&(Z=Y),j==null&&(j=r.resolveStartForElement(K,0)),le==null&&(le=mt(K.getAttribute("data-duration"))??i(Y)??null)),K=K.parentElement}return{parentCompositionId:Z,compositionAncestors:O.reverse(),inheritedStart:j,inheritedDuration:le}},s=document.querySelector("[data-composition-id]"),u=Array.from(document.querySelectorAll("[data-composition-id]")),c=s?.getAttribute("data-composition-id")??null,m=s?r.resolveStartForElement(s,0):0,f=a(),p=f!=null?Math.max(0,f-Math.max(0,m)):null,b=i(c),v=Do(s??document.body),x=Po(...u.filter(q=>q!==s).map(q=>{let P=r.resolveStartForElement(q,0),O=r.resolveDurationForElement(q)??i(q.getAttribute("data-composition-id"))??null;return!Number.isFinite(P)||O==null||O<=0?null:Math.max(0,P)+O})),_=x!=null?Math.max(0,x-Math.max(0,m)):null,R=typeof b=="number"&&Number.isFinite(b)&&b>0?b:null,T=typeof v=="number"&&Number.isFinite(v)&&v>0?v:null,M=typeof p=="number"&&Number.isFinite(p)&&p>0?p:null,F=typeof _=="number"&&Number.isFinite(_)&&_>0?_:null,E=Po(M,F),S=R!=null&&E!=null&&R>E+1,C=T??(S?E:Po(R,M,F))??null,I=(C!=null?m+C:null)??(typeof f=="number"&&Number.isFinite(f)&&f>0?f:null),W=(q,P)=>!Number.isFinite(P)||P<=0?0:I==null||!Number.isFinite(I)?P:!Number.isFinite(q)||q>=I?0:Math.max(0,Math.min(P,I-q)),U=[],oe=[],k=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),V=0;for(let[q,P]of k.entries()){if(P===s||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(P.tagName))continue;let O=l(P,s),j=r.resolveStartForElement(P,O.inheritedStart??0),le=P.getAttribute("data-composition-id"),Z=Do(P);if(Z==null&&le&&le!==c&&(Z=i(le)),Z==null&&P instanceof HTMLMediaElement&&Number.isFinite(P.duration)&&(Z=Ze(P,P.duration)),Z==null){let Fe=O.inheritedDuration;if(Fe!=null&&Fe>0){let ze=(O.inheritedStart??0)+Fe;Z=Math.max(0,ze-j)}}if(Z==null||Z<=0||(Z=W(j,Z),Z<=0))continue;let K=j+Z;V=Math.max(V,K);let Y=P.tagName.toLowerCase(),Ve=le&&le!==c?"composition":Y==="video"?"video":Y==="audio"?"audio":Y==="img"?"image":"element";U.push({id:Fo(P)??le??null,label:Oh(P,Ve,U.length),start:j,duration:Z,track:Oo(P,q),zIndex:Io(P),stackingContextId:Wr(P),kind:Ve,tagName:Y,compositionId:P.getAttribute("data-composition-id"),compositionAncestors:O.compositionAncestors,parentCompositionId:O.parentCompositionId,nodePath:null,compositionSrc:In(P.getAttribute("data-composition-src")),playbackStart:je(P),playbackRate:_e(P),assetUrl:lu(P),timelineRole:P.getAttribute("data-timeline-role"),timelineLabel:P.getAttribute("data-timeline-label"),timelineGroup:P.getAttribute("data-timeline-group"),timelinePriority:mt(P.getAttribute("data-timeline-priority"))})}let J=new Set(U.map(q=>q.id)),H=s?.getAttribute("data-composition-id")??null,G=H?n[H]??null:null;if(G&&s){let q=G;if(typeof q.getChildren=="function")try{let P=q.getChildren(!0,!0,!1)??[],O=new Map;for(let Z of s.children){let K=Z;if(!K.id)continue;let Y=K.tagName.toLowerCase();Y==="script"||Y==="style"||Y==="link"||O.set(K,{id:K.id,start:1/0,end:-1/0})}let j=Z=>{let K=Z;for(;K;){if(O.has(K))return K;if(K===s)return null;K=K.parentElement}return null};for(let Z of P){if(typeof Z.targets!="function"||typeof Z.startTime!="function"||typeof Z.duration!="function")continue;let K=Z.startTime(),Y=Z.parent;for(;Y&&Y!==G&&typeof Y.startTime=="function";)K+=Y.startTime(),Y=Y.parent;let Ve=K+Z.duration();if(!(!Number.isFinite(K)||!Number.isFinite(Ve)))for(let Fe of Z.targets()){if(!(Fe instanceof Element))continue;let ke=j(Fe);if(!ke)continue;let ze=O.get(ke);ze&&(ze.start=Math.min(ze.start,K),ze.end=Math.max(ze.end,Ve))}}let le=U.length>0?Math.max(...U.map(Z=>Z.track))+1:0;for(let[Z,K]of O){if(K.start===1/0||K.end===-1/0)continue;let Y=Z;if(J.has(Y.id))continue;let Ve=Math.max(0,K.end-K.start);if(Ve<=0)continue;let Fe=W(K.start,Ve);Fe<=0||(V=Math.max(V,K.start+Fe),U.push({id:Y.id,label:Y.getAttribute("data-timeline-label")??Y.getAttribute("data-label")??Y.getAttribute("aria-label")??Y.id,start:K.start,duration:Fe,track:Oo(Y,le),zIndex:Io(Y),stackingContextId:Wr(Y),kind:"element",tagName:Y.tagName.toLowerCase(),compositionId:Y.getAttribute("data-composition-id"),compositionAncestors:H?[H]:[],parentCompositionId:H,nodePath:null,compositionSrc:null,playbackStart:je(Y),playbackRate:_e(Y),assetUrl:null,timelineRole:Y.getAttribute("data-timeline-role"),timelineLabel:Y.getAttribute("data-timeline-label"),timelineGroup:Y.getAttribute("data-timeline-group"),timelinePriority:mt(Y.getAttribute("data-timeline-priority"))}),J.add(Y.id))}}catch(P){L("runtime.timeline.site1",P)}}if(s&&C!=null&&C>0){let q=U.length>0?Math.max(...U.map(P=>P.track))+1:0;for(let P of s.children){let O=P;if(!O.id||J.has(O.id))continue;let j=O.getAttribute("data-timeline-role");if(j!=="overlay"&&j!=="persistent-overlay")continue;let le=O.tagName.toLowerCase();if(le==="script"||le==="style"||le==="link"||le==="meta"||window.getComputedStyle(O).display==="none")continue;let K=W(0,C);K<=0||(V=Math.max(V,K),U.push({id:O.id,label:O.getAttribute("data-timeline-label")??O.getAttribute("data-label")??O.getAttribute("aria-label")??O.id,start:0,duration:K,track:Oo(O,q),zIndex:Io(O),stackingContextId:Wr(O),kind:"element",tagName:le,compositionId:O.getAttribute("data-composition-id"),compositionAncestors:H?[H]:[],parentCompositionId:H,nodePath:null,compositionSrc:null,playbackStart:je(O),playbackRate:_e(O),assetUrl:null,timelineRole:j,timelineLabel:O.getAttribute("data-timeline-label"),timelineGroup:O.getAttribute("data-timeline-group"),timelinePriority:mt(O.getAttribute("data-timeline-priority"))}),J.add(O.id))}}for(let q of u){if(q===s)continue;let P=q.getAttribute("data-composition-id");if(!P||!Lo(P))continue;let O=r.resolveStartForElement(q,0),j=Do(q);if((j==null||j<=0)&&su(q)!=null){let Y=su(q);j=Math.max(0,Y-O)}let le=i(P),Z=j&&j>0?j:le;if(Z==null||Z<=0)continue;let K=W(O,Z);K<=0||oe.push({id:P,label:q.getAttribute("data-label")??P,start:O,duration:K,thumbnailUrl:In(q.getAttribute("data-thumbnail-url")),avatarName:null})}let z=Math.max(1,V||1,C??0),X=S&&T==null,we=X?Number.POSITIVE_INFINITY:Math.max(1,Math.ceil(z*Math.max(1,e.canonicalFps)));return{...vr(e.canonicalFps),source:"hf-preview",type:"timeline",compositionContractVersion:1,durationSeconds:X?Number.POSITIVE_INFINITY:z,durationInFrames:we,clips:U,scenes:oe,compositionWidth:mt(s?.getAttribute("data-width"))??1920,compositionHeight:mt(s?.getAttribute("data-height"))??1080}}var Go="data-composition-id",Gh="data-composition-src",Hh=`[${Go}]`,ES=`[${Gh}]`,cu="style",du="script",Bh=\'link[rel="stylesheet"], link[rel="preconnect"]\';function jt(e){return e?Array.from(e):[]}function fu(e){let{contentNode:t,head:n,documentElement:r,hasTemplate:i,compositionId:o}=e,a=jt(t.querySelectorAll(Hh)),l=o?a.find(c=>c.getAttribute(Go)===o)??null:a[0]??null,s=(l??a[0])?.getAttribute(Go)?.trim()||"",u=i?null:n??null;return{innerRoot:l,authoredCompositionId:o||s||null,scriptCompositionId:s||o||null,authoredRootId:l?.getAttribute("id")?.trim()||null,styleSources:[...jt(u?.querySelectorAll(cu)),...jt(t.querySelectorAll(cu))],scriptSources:[...jt(u?.querySelectorAll(du)),...jt(t.querySelectorAll(du))],linkSources:jt(n?.querySelectorAll(Bh)),variableDefaultCarriers:[r,l].filter(c=>c!=null)}}var pe=Em(Oc(),1),Gc=pe.default,fA=pe.default.stringify,mA=pe.default.fromJSON,pA=pe.default.plugin,hA=pe.default.parse,gA=pe.default.list,bA=pe.default.document,xA=pe.default.comment,yA=pe.default.atRule,vA=pe.default.rule,SA=pe.default.decl,AA=pe.default.root,EA=pe.default.CssSyntaxError,wA=pe.default.Declaration,CA=pe.default.Container,_A=pe.default.Processor,TA=pe.default.Document,RA=pe.default.Comment,kA=pe.default.Warning,MA=pe.default.AtRule,FA=pe.default.Result,NA=pe.default.Input,LA=pe.default.Rule,DA=pe.default.Root,IA=pe.default.Node;var ca="data-hf-authored-id",Hc="data-hf-inner-root";function da(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function fa(e){return e.replace(/\\\\/g,"\\\\\\\\").replace(/"/g,\'\\\\"\')}function lg(e){return e&&e.replace(/[^a-zA-Z0-9_-]/g,n=>`\\\\${n}`).replace(/^-?\\d/,n=>`\\\\${n}`)}function Uc(e){let t=e.trim();return t?Array.from(new Set([t,lg(t)])).filter(Boolean):[]}function ug(e){return!!e&&/[\\w-]/.test(e)}function cg(e,t,n){let r=Uc(t).sort((l,s)=>s.length-l.length);if(r.length===0)return e;let i="",o=0,a=null;for(let l=0;l<e.length;l+=1){let s=e[l],u=l>0?e[l-1]:"";if(a){i+=s,s===a&&u!=="\\\\"&&(a=null);continue}if(s===\'"\'||s==="\'"){a=s,i+=s;continue}if(s==="["){o+=1,i+=s;continue}if(s==="]"){o=Math.max(0,o-1),i+=s;continue}if(s==="#"&&o===0){let c=r.find(m=>e.startsWith(m,l+1));if(c){let m=e[l+1+c.length];if(!ug(m)){i+=n,l+=c.length;continue}}}i+=s}return i}function dg(e,t){let n=t?.trim();return n?cg(e,n,`[${ca}="${fa(n)}"]`):e}function Bc(e){return`${e}:not(:has([${Hc}])), ${e} > [${Hc}]`}function fg(e,t,n,r,i,o){let a=dg(e,r),l=mg(a,t,n),s=l.trim();if(!s||s==="*")return e;if(/^(html|body|:root)$/i.test(s))return o?Bc(t):e;let u=new RegExp(`\\\\[\\\\s*data-composition-id\\\\s*=\\\\s*(["\'])${da(n)}\\\\1\\\\s*\\\\]`,"g");if(u.test(s))return s.replace(u,"").trim()===""?Bc(t):l.replace(u,t);let c=l.match(/^\\s*/)?.[0]??"",m=l.match(/\\s*$/)?.[0]??"";if(i){let f=r?`[${ca}="${fa(r)}"]`:null;if(f&&s.startsWith(f)){let p=s.slice(f.length);return`${c}${t}${f}${p}${m}`}}return`${c}${t} ${s}${m}`}function mg(e,t,n){let r=da(n),i=String.raw`\\[\\s*data-composition-id\\s*=\\s*(?:"${r}"|\'${r}\')\\s*\\]`,o=String.raw`\\s*\\[\\s*data-(?:start|duration)\\s*=\\s*(?:"[^"]*"|\'[^\']*\')\\s*\\]`;return e.replace(new RegExp(`${i}(?:${o})+`,"g"),t).replace(new RegExp(`(?:${o})+${i}`,"g"),t)}var pg=new Set(["keyframes","-webkit-keyframes","font-face"]);function hg(e){return e?.type==="atrule"}function gg(e){let t=e.parent;for(;t;){if(hg(t)&&pg.has(t.name.toLowerCase()))return!0;t=t.parent}return!1}function bg(e){let t=e.parent;for(;t;){if(t.type==="rule")return!0;t=t.parent}return!1}function Wc(e,t,n,r,i){let o=t.trim();if(!e||!o)return e;let a=n||`[data-composition-id="${fa(o)}"]`,l=Gc.parse(e);return l.walkRules(s=>{gg(s)||bg(s)||(s.selectors=s.selectors.map(u=>fg(u,a,o,r,i?.compoundAuthoredRoot,i?.scopeRootSelectors)))}),l.toResult({map:!1}).css}function nt(e){return JSON.stringify(e).replace(/</g,"\\\\u003c")}function Vc(e,t,n="[HyperFrames] composition script error:",r,i=t,o){let a=nt(t),l=nt(i),s=nt(n),u=da(t),c=nt(o?.trim()||null),m=nt(r??null),f=nt(String.raw`\\[\\s*data-composition-id\\s*=\\s*(?:"${u}"|\'${u}\')\\s*\\]`),p=nt(String.raw`\\s*\\[\\s*data-(?:start|duration)\\s*=\\s*(?:"[^"]*"|\'[^\']*\')\\s*\\]`),b=nt(Uc(o?.trim()||""));return`(function(){\n var __hfCompId = ${a};\n var __hfTimelineCompId = ${l};\n var __hfErrorLabel = ${s};\n var __hfAuthoredRootId = ${c};\n var __hfAuthoredRootAttr = ${nt(ca)};\n var __hfEscapeAttr = function(value) {\n return (value + "").replace(/\\\\\\\\/g, "\\\\\\\\\\\\\\\\").replace(/"/g, "\\\\\\\\\\\\"");\n };\n var __hfRootSelector = ${m} || (__hfCompId\n ? \'[data-composition-id="\' + __hfEscapeAttr(__hfCompId) + \'"]\'\n : "");\n var __hfRoot = null;\n var __hfRootSelectorPattern = ${f};\n var __hfTimingSelectorPattern = ${p};\n var __hfAuthoredRootIdForms = ${b};\n var __hfAuthoredRootSelector = __hfAuthoredRootId\n ? "[" + __hfAuthoredRootAttr + \'="\' + __hfEscapeAttr(__hfAuthoredRootId) + \'"]\'\n : "";\n var __hfIsSelectorNameChar = function(char) {\n return !!char && /[\\\\w-]/.test(char);\n };\n var __hfReplaceAuthoredRootIdSelectors = function(selector) {\n if (!__hfAuthoredRootSelector || !__hfAuthoredRootIdForms.length || typeof selector !== "string") {\n return selector;\n }\n var result = "";\n var bracketDepth = 0;\n var quote = null;\n for (var index = 0; index < selector.length; index += 1) {\n var char = selector[index];\n var previousChar = index > 0 ? selector[index - 1] : "";\n if (quote) {\n result += char;\n if (char === quote && previousChar !== "\\\\\\\\") {\n quote = null;\n }\n continue;\n }\n if (char === \'"\' || char === "\'") {\n quote = char;\n result += char;\n continue;\n }\n if (char === "[") {\n bracketDepth += 1;\n result += char;\n continue;\n }\n if (char === "]") {\n bracketDepth = Math.max(0, bracketDepth - 1);\n result += char;\n continue;\n }\n if (char === "#" && bracketDepth === 0) {\n var matchedForm = null;\n for (var formIndex = 0; formIndex < __hfAuthoredRootIdForms.length; formIndex += 1) {\n var form = __hfAuthoredRootIdForms[formIndex];\n if (selector.slice(index + 1, index + 1 + form.length) === form) {\n matchedForm = form;\n break;\n }\n }\n if (matchedForm) {\n var nextChar = selector[index + 1 + matchedForm.length];\n if (!__hfIsSelectorNameChar(nextChar)) {\n result += __hfAuthoredRootSelector;\n index += matchedForm.length;\n continue;\n }\n }\n }\n result += char;\n }\n return result;\n };\n var __hfNormalizeSelector = function(selector) {\n if (!__hfCompId || typeof selector !== "string") return selector;\n var normalized = selector\n .replace(new RegExp(__hfRootSelectorPattern + \'(?:\' + __hfTimingSelectorPattern + \')+\', \'g\'), __hfRootSelector)\n .replace(new RegExp(\'(?:\' + __hfTimingSelectorPattern + \')+\' + __hfRootSelectorPattern, \'g\'), __hfRootSelector);\n if (__hfAuthoredRootSelector) {\n normalized = __hfReplaceAuthoredRootIdSelectors(normalized);\n }\n return normalized;\n };\n var __hfFindRoot = function() {\n if (!__hfRoot && __hfRootSelector) {\n __hfRoot = window.document.querySelector(__hfRootSelector);\n }\n return __hfRoot;\n };\n var __hfContains = function(node) {\n var root = __hfFindRoot();\n return !root || node === root || root.contains(node);\n };\n var __hfQueryAll = function(selector) {\n var root = __hfFindRoot();\n if (!root || typeof selector !== "string") {\n return window.document.querySelectorAll(selector);\n }\n return Array.prototype.filter.call(window.document.querySelectorAll(__hfNormalizeSelector(selector)), function(node) {\n return __hfContains(node);\n });\n };\n var __hfQueryOne = function(selector) {\n var matches = __hfQueryAll(selector);\n return matches[0] || null;\n };\n var __hfGetElementById = function(id) {\n var found = window.document.getElementById(id);\n if (found && __hfContains(found)) return found;\n var root = __hfFindRoot();\n if (!root) return found || null;\n var idValue = id + "";\n if (__hfAuthoredRootId && __hfAuthoredRootId === idValue && root.getAttribute && root.getAttribute(__hfAuthoredRootAttr) === idValue) {\n return root;\n }\n if (root.id === idValue) return root;\n if (typeof root.querySelector !== "function") return null;\n try {\n var authoredRootMatch = root.querySelector(\'[\' + __hfAuthoredRootAttr + \'="\' + __hfEscapeAttr(idValue) + \'"]\');\n if (authoredRootMatch) return authoredRootMatch;\n } catch {}\n if (typeof CSS !== "undefined" && CSS && typeof CSS.escape === "function") {\n try {\n return root.querySelector("#" + CSS.escape(idValue)) || null;\n } catch {}\n }\n try {\n return root.querySelector(\'[id="\' + __hfEscapeAttr(idValue) + \'"]\') || null;\n } catch {}\n return null;\n };\n var __hfScopedDocument = typeof Proxy === "function"\n ? new Proxy(window.document, {\n get: function(target, prop, receiver) {\n if (prop === "querySelector") return __hfQueryOne;\n if (prop === "querySelectorAll") return __hfQueryAll;\n if (prop === "getElementById") return __hfGetElementById;\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" ? value.bind(target) : value;\n },\n })\n : window.document;\n var __hfTimelineRegistryProxy = null;\n var __hfGetTimelineRegistry = function() {\n window.__timelines = window.__timelines || {};\n if (!__hfCompId || __hfCompId === __hfTimelineCompId || typeof Proxy !== "function") {\n return window.__timelines;\n }\n if (!__hfTimelineRegistryProxy) {\n __hfTimelineRegistryProxy = new Proxy(window.__timelines, {\n get: function(target, prop, receiver) {\n if (prop !== __hfCompId) {\n return Reflect.get(target, prop, target);\n }\n var authoredValue = Reflect.get(target, prop, target);\n return authoredValue === undefined\n ? Reflect.get(target, __hfTimelineCompId, target)\n : authoredValue;\n },\n set: function(target, prop, value, receiver) {\n if (prop !== __hfCompId) {\n return Reflect.set(target, prop, value, target);\n }\n // The authored node remains in the compiled DOM when its local id\n // differs from the runtime mount id, so readiness legitimately sees\n // both compositions. Publish the same timeline under both identities\n // instead of replacing one with the other.\n var authoredSet = Reflect.set(target, __hfCompId, value, target);\n var runtimeSet = Reflect.set(target, __hfTimelineCompId, value, target);\n return authoredSet && runtimeSet;\n },\n });\n }\n return __hfTimelineRegistryProxy;\n };\n var __hfScopedWindow = typeof Proxy === "function"\n ? new Proxy(window, {\n get: function(target, prop, receiver) {\n if (prop === "__timelines") return __hfGetTimelineRegistry();\n // Inside a sub-composition, __hyperframes is passed as a bare script\n // param bound to the SCOPED variant (per-comp getVariables). But\n // authors routinely write the documented window.__hyperframes.\n // getVariables() form, which would otherwise fall through to the host\n // page\'s base __hyperframes and return the WRONG (or empty) variables\n // for this instance. Route it to the scoped variant too so both\n // spellings resolve to this composition\'s own variables.\n // (__hfScopedHyperframes is a hoisted var assigned below, before any\n // sub-comp script -- the only code that reads this -- runs.)\n if (prop === "__hyperframes") return __hfScopedHyperframes;\n // Native window methods must stay bound to the real window. Handed\n // back unbound, "this" at call time is this Proxy and Chrome rejects\n // it with "Illegal invocation", which broke window.addEventListener,\n // setTimeout, matchMedia and getComputedStyle inside every\n // sub-composition -- including the window.addEventListener("hf-seek",\n // ...) form the Three.js and TypeGPU adapters document. The sibling\n // document and gsap proxies here already bind.\n //\n // Only bind non-constructors. Function.prototype.bind drops static\n // members, so binding a class exposed on window (window.Texts and\n // friends) would silently strip its statics. Built-in methods have\n // no .prototype; classes and constructor functions do.\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" && value.prototype === undefined\n ? value.bind(target)\n : value;\n },\n set: function(target, prop, value, receiver) {\n if (prop === "__timelines") {\n // Common authoring boilerplate assigns the registry back to\n // itself (window.__timelines = window.__timelines || {}). The\n // getter above returns our proxy; do not replace the canonical\n // registry with that proxy or later wrappers will stack proxies.\n if (value === __hfTimelineRegistryProxy) return true;\n target.__timelines = value || {};\n __hfTimelineRegistryProxy = null;\n return true;\n }\n return Reflect.set(target, prop, value, target);\n },\n })\n : window;\n var __hfResolveGsapTarget = function(target) {\n if (typeof target !== "string") return target;\n return __hfQueryAll(target);\n };\n var __hfScopeTimeline = function(timeline) {\n if (!timeline || timeline.__hfScopedCompositionRoot === __hfFindRoot()) return timeline;\n ["to", "from", "fromTo", "set"].forEach(function(method) {\n var original = timeline[method];\n if (typeof original !== "function") return;\n timeline[method] = function(target) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(target);\n return original.apply(timeline, args);\n };\n });\n try {\n Object.defineProperty(timeline, "__hfScopedCompositionRoot", {\n value: __hfFindRoot(),\n configurable: true,\n });\n } catch {\n // Best-effort: timelines coming from user code may have a frozen target\n // or a non-extensible defineProperty path. Swallow \\u2014 the scoped root\n // is an enrichment, not a correctness invariant for playback.\n }\n return timeline;\n };\n var __hfBaseGsap = typeof gsap === "undefined" ? window.gsap : gsap;\n var __hfScopedGsap = !__hfBaseGsap || typeof Proxy !== "function"\n ? __hfBaseGsap\n : new Proxy(__hfBaseGsap, {\n get: function(target, prop, receiver) {\n if (prop === "timeline") {\n return function() {\n return __hfScopeTimeline(target.timeline.apply(target, arguments));\n };\n }\n if (prop === "to" || prop === "from" || prop === "fromTo" || prop === "set") {\n return function(firstArg) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(firstArg);\n return target[prop].apply(target, args);\n };\n }\n if (prop === "utils" && target.utils && typeof Proxy === "function") {\n return new Proxy(target.utils, {\n get: function(utilsTarget, utilsProp, utilsReceiver) {\n if (utilsProp === "toArray") {\n return function(firstArg) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(firstArg);\n return utilsTarget.toArray.apply(utilsTarget, args);\n };\n }\n if (utilsProp === "selector") {\n return function(base) {\n var baseEl = typeof base === "string" ? __hfQueryOne(base) : base;\n var root = baseEl || __hfFindRoot();\n return function(selector) {\n if (!root || typeof selector !== "string") return [];\n return Array.prototype.filter.call(\n window.document.querySelectorAll(__hfNormalizeSelector(selector)),\n function(node) {\n return node === root || (typeof root.contains === "function" && root.contains(node));\n },\n );\n };\n };\n }\n var value = Reflect.get(utilsTarget, utilsProp, utilsTarget);\n return typeof value === "function" ? value.bind(utilsTarget) : value;\n },\n });\n }\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" ? value.bind(target) : value;\n },\n });\n var __hfBaseHyperframes = window.__hyperframes;\n var __hfScopedHyperframes = !__hfBaseHyperframes\n ? __hfBaseHyperframes\n : Object.assign({}, __hfBaseHyperframes, {\n getVariables: function() {\n var byComp = window.__hfVariablesByComp;\n var scoped = byComp && __hfTimelineCompId ? byComp[__hfTimelineCompId] : null;\n return scoped ? Object.assign({}, scoped) : {};\n },\n });\n var __hfRun = function() {\n try {\n (function(document, gsap, window, __hyperframes) {\n${e.replace(/<\\/(script)/gi,"<\\\\/$1")}\n }).call(window, __hfScopedDocument, __hfScopedGsap, __hfScopedWindow, __hfScopedHyperframes);\n } catch (_err) {\n console.error(__hfErrorLabel, __hfCompId, _err);\n }\n };\n __hfFindRoot();\n __hfRun();\n})();`}var xg=["data-composition-id","data-composition-file","data-start","data-duration","data-end","data-track-index","data-track","data-composition-src","data-hf-authored-duration","data-hf-authored-end"];function zc(e){let t=e.getAttribute("id")?.trim();for(let n of xg)e.removeAttribute(n);t&&(e.removeAttribute("id"),e.setAttribute("data-hf-authored-id",t)),e.setAttribute("data-hf-inner-root","true")}var yg=8e3,vg=/^(?![a-zA-Z][a-zA-Z\\d+\\-.]*:)(?!\\/\\/)(?!\\/)(?!\\.\\.?\\/).+/,Sg=/\\burl\\(\\s*(["\']?)([^)"\']+)\\1\\s*\\)/g,Ag=["src","href"];function Eg(e){return!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")||e.startsWith("data:")||e.startsWith("#")||e.startsWith("/")}function jc(e,t){if(!t)return e;let n=e.trim();if(Eg(n)||!n.startsWith("../")&&n!=="..")return e;try{return new URL(n,t).href}catch{return e}}function Kc(e,t){return!t||!e?e:e.replace(Sg,(n,r,i)=>{let o=jc(i||"",t);return o===i?n:`url(${r||""}${o}${r||""})`})}function wg(e,t){for(let n of Array.from(e.querySelectorAll("[src], [href]")))for(let r of Ag){let i=n.getAttribute(r);if(i==null)continue;let o=jc(i,t);o!==i&&n.setAttribute(r,o)}}function Cg(e,t){for(let n of Array.from(e.querySelectorAll("[style]"))){let r=n.getAttribute("style");if(r==null)continue;let i=Kc(r,t);i!==r&&n.setAttribute("style",i)}}function _g(e,t){for(let n of Array.from(e.querySelectorAll("style"))){let r=n.textContent||"",i=Kc(r,t);i!==r&&(n.textContent=i)}}function Yc(e,t){if(t){wg(e,t),Cg(e,t),_g(e,t);for(let n of Array.from(e.querySelectorAll("template")))Yc(n.content,t)}}function Tg(e,t){return`${e}__hf${t}`}var Rg=e=>new Promise(t=>{let n=!1,r=Date.now(),i=null,o=a=>{n||(n=!0,i!=null&&window.clearTimeout(i),t({status:a,elapsedMs:Math.max(0,Date.now()-r)}))};e.addEventListener("load",()=>o("load"),{once:!0}),e.addEventListener("error",()=>o("error"),{once:!0}),i=window.setTimeout(()=>o("timeout"),yg)});function ma(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.textContent=""}function qc(e){for(let t of Array.from(e.querySelectorAll("style, script")))t.remove()}function kg(e){let t=document.importNode(e,!0);zc(t);let n=t.getAttribute("data-width"),r=t.getAttribute("data-height");return t.style.width=n?`${n}px`:"100%",t.style.height=r?`${r}px`:"100%",t}function Mg(e,t){let n=e.trim();if(!n)return e;try{return vg.test(n)&&!n.startsWith("#")&&!n.startsWith("?")?new URL(n,document.baseURI).toString():t?new URL(n,t).toString():new URL(n,document.baseURI).toString()}catch{return e}}function $c(e,t){try{let n=new URL(e),r=new URL(t);return n.search="",n.hash="",r.search="",r.hash="",n.href===r.href}catch{return!1}}function ii(e){let t=(e.getAttribute("data-composition-id")||"").trim()||null;return{authoredCompositionId:(e.getAttribute("data-hf-original-composition-id")||t||"").trim()||null,runtimeCompositionId:t}}function Fg(e){let t=new Map;for(let n of e){let r=ii(n).authoredCompositionId||"";r&&t.set(r,(t.get(r)||0)+1)}return t}function Xc(e){let t=ii(e).authoredCompositionId;return t?!!document.querySelector(`template#${CSS.escape(t)}-template`):!1}function Ng(e){return!!e.querySelector(\'[data-hf-inner-root="true"]\')}function Lg(e){return e.hasAttribute("data-composition-src")?!0:Xc(e)?e.children.length===0||e.hasAttribute("data-hf-original-composition-id")?!0:Ng(e):!1}function ha(){return Array.from(document.querySelectorAll("[data-composition-src], [data-composition-id]")).filter(t=>t.hasAttribute("data-composition-src")?!0:Xc(t))}function Jc(){let e=window.__hfVariablesByComp;if(!e)return;let t=new Set(ha().map(n=>ii(n).runtimeCompositionId).filter(n=>!!n));for(let n of Object.keys(e))t.has(n)||delete e[n]}function Qc(e,t=Fg(e)){let n=new Map,r=new Map;for(let i of e){let{authoredCompositionId:o,runtimeCompositionId:a}=ii(i),l=Lg(i);if(!o){r.set(i,{authoredCompositionId:null,runtimeCompositionId:a});continue}let s=(t.get(o)||0)>1,u=a||o;if(l){let c=s?(n.get(o)||0)+1:0;s&&n.set(o,c),u=s?Tg(o,c):o,s?i.setAttribute("data-hf-original-composition-id",o):i.removeAttribute("data-hf-original-composition-id"),i.setAttribute("data-composition-id",u),a&&a!==u&&window.__hfVariablesByComp&&delete window.__hfVariablesByComp[a]}r.set(i,{authoredCompositionId:o,runtimeCompositionId:u})}return r}async function pa(e){let t=fu({contentNode:e.sourceNode,head:e.head,hasTemplate:e.hasTemplate,compositionId:e.authoredCompositionId}),n=t.innerRoot instanceof HTMLElement?t.innerRoot:null,r=n??e.sourceNode,i=t.authoredCompositionId,o=t.scriptCompositionId,a=e.runtimeCompositionId||null,l=t.authoredRootId,s=a?`[data-composition-id="${CSS.escape(a)}"]`:void 0;for(let f of t.linkSources){let p=(f.getAttribute("href")||"").trim();if(!p)continue;let b=e.compositionUrl?new URL(p,e.compositionUrl).href:p;if(e.compositionUrl&&$c(b,e.compositionUrl)||document.head.querySelector(`link[href="${CSS.escape(b)}"]`))continue;let v=f.cloneNode(!0);v instanceof HTMLLinkElement&&(v.href=b,document.head.appendChild(v),e.injectedLinks.push(v))}(f=>{for(let p of f){let b=p.cloneNode(!0);b instanceof HTMLStyleElement&&(i&&(b.textContent=Wc(b.textContent||"",i,s,l,{scopeRootSelectors:!0})),document.head.appendChild(b),e.injectedStyles.push(b))}})(t.styleSources);let c=f=>{let p=f.getAttribute("type")?.trim()??"",b=f.getAttribute("src")?.trim()??"";if(b){let x=Mg(b,e.compositionUrl);return e.compositionUrl&&$c(x,e.compositionUrl)?null:{kind:"external",src:x,type:p}}let v=f.textContent?.trim()??"";return v?{kind:"inline",content:v,type:p,scopeCompositionId:o}:null},m=t.scriptSources.map(c).filter(f=>f!==null);if(n){let f=n.getAttribute("data-width"),p=n.getAttribute("data-height"),b=e.parseDimensionPx(f),v=e.parseDimensionPx(p);f&&e.host.setAttribute("data-width",f),p&&e.host.setAttribute("data-height",p),b&&e.host instanceof HTMLElement&&(e.host.style.width=b),v&&e.host instanceof HTMLElement&&(e.host.style.height=v),n.hasAttribute("data-timeline-locked")&&e.host.setAttribute("data-timeline-locked","");let x=kg(n);!e.authoredCompositionId&&i&&x.setAttribute("data-composition-id",i),qc(x),e.host.appendChild(x)}else if(e.hasTemplate){let f=document.importNode(r,!0);qc(f),e.host.appendChild(f)}else e.host.innerHTML=e.fallbackBodyInnerHtml;a&&Dg(e,r,a);for(let f of m){let p=document.createElement("script");if(f.type&&(p.type=f.type),p.async=!1,f.kind==="external"?p.src=f.src:f.type.toLowerCase()==="module"?p.textContent=f.content:f.scopeCompositionId?p.textContent=Vc(f.content,f.scopeCompositionId,"[HyperFrames] composition script error:",s,a||f.scopeCompositionId,l):p.textContent=`(function(){${f.content}})();`,document.body.appendChild(p),e.injectedScripts.push(p),f.kind==="external"){let b=await Rg(p);b.status!=="load"&&e.onDiagnostic?.({code:"external_composition_script_load_issue",details:{hostCompositionId:e.authoredCompositionId,runtimeCompositionId:e.runtimeCompositionId,hostCompositionSrc:e.hostCompositionSrc,resolvedScriptSrc:f.src,loadStatus:b.status,elapsedMs:b.elapsedMs}})}}}async function Zc(e){let t=ha();if(Jc(),t.length===0)return;let n=Qc(t),r=t.filter(i=>{if(i.hasAttribute("data-composition-src")||i.children.length>0)return!1;let o=n.get(i)?.authoredCompositionId;return o?!!document.querySelector(`template#${CSS.escape(o)}-template`):!1});if(r.length!==0)for(let i of r){let o=n.get(i),a=o?.authoredCompositionId;if(!a)continue;let l=document.querySelector(`template#${CSS.escape(a)}-template`);ma(i),await pa({host:i,authoredCompositionId:a,runtimeCompositionId:o?.runtimeCompositionId||a,hostCompositionSrc:`template#${a}-template`,sourceNode:l.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:null,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic})}}async function ed(e){let t=ha();if(Jc(),t.length===0)return;let n=Qc(t),r=t.filter(i=>i.hasAttribute("data-composition-src"));r.length!==0&&await Promise.all(r.map(async i=>{let o=i.getAttribute("data-composition-src");if(!o)return;let a=n.get(i),l=a?.authoredCompositionId||null,s=a?.runtimeCompositionId||l||null,u=null;try{u=new URL(o,document.baseURI)}catch{u=null}ma(i);try{let c=l!=null?document.querySelector(`template#${CSS.escape(l)}-template`):null;if(c){await pa({host:i,authoredCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,sourceNode:c.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic});return}let m=await fetch(o);if(!m.ok)throw new Error(`HTTP ${m.status}`);let f=await m.text(),b=new DOMParser().parseFromString(f,"text/html");Yc(b,u);let v=(l?b.querySelector(`template#${CSS.escape(l)}-template`):null)??b.querySelector("template"),x=v?v.content:b.body;await pa({host:i,authoredCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,sourceNode:x,hasTemplate:!!v,fallbackBodyInnerHtml:b.body.innerHTML,compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,head:b.head,declaredVariableDefaults:pn(b.documentElement),variableDeclarer:b.documentElement,onDiagnostic:e.onDiagnostic})}catch(c){e.onDiagnostic?.({code:"external_composition_load_failed",details:{hostCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,errorMessage:c instanceof Error?c.message:"unknown_error"}}),ma(i)}}))}function Dg(e,t,n){let i={...e.declaredVariableDefaults??(t instanceof Element?pn(t):{}),...Ms(e.host)};qi(e.variableDeclarer??(t instanceof Element?t:null),i,n),Rs(e.host),Object.keys(i).length>0?(window.__hfVariablesByComp||(window.__hfVariablesByComp={}),window.__hfVariablesByComp[n]=i,$i(e.host,{...Ts(e.host,i,window),...Ar()})):window.__hfVariablesByComp&&delete window.__hfVariablesByComp[n]}function ga(e){let n=e.vars.data?.captionState;return n==="dim"||n==="active"?n:void 0}function Ig(e){return e instanceof HTMLElement?e.dataset.captionWrapper!=="true"?e:e.querySelector(":scope > span")??null:null}function Pg(){let e=[],t=document.querySelectorAll(".caption-group");for(let n of t)for(let r of n.children){if(!(r instanceof HTMLElement))continue;let i=r.dataset.captionWrapper==="true"?r.querySelector(":scope > span"):r.tagName==="SPAN"?r:null;i&&e.push(i)}return e}function Og(e){let t=e.parentElement;if(t?.dataset.captionWrapper==="true")return t;let n=document.createElement("span");return n.style.display="inline-block",n.dataset.captionWrapper="true",e.parentNode?.insertBefore(n,e),n.appendChild(e),n}function ba(){let e=window.gsap;e&&document.querySelectorAll(".caption-group").length!==0&&fetch("caption-overrides.json").then(t=>t.ok?t.json():null).then(t=>{if(!t||!Array.isArray(t)||t.length===0)return;let n=Pg();for(let r of t){let i=null;if(r.wordId&&(i=Ig(document.getElementById(r.wordId))),!i&&r.wordIndex!==void 0&&(i=n[r.wordIndex]??null),!i)continue;let o={},a={};if(r.x!==void 0&&(o.x=r.x),r.y!==void 0&&(o.y=r.y),r.scale!==void 0&&(o.scale=r.scale),r.rotation!==void 0&&(o.rotation=r.rotation),r.opacity!==void 0&&(a.opacity=r.opacity),r.fontSize!==void 0&&(a.fontSize=`${r.fontSize}px`),r.fontWeight!==void 0&&(a.fontWeight=r.fontWeight),r.fontFamily!==void 0&&(a.fontFamily=r.fontFamily),r.activeColor||r.dimColor){let s=e.getTweensOf(i).filter(m=>m.vars.color!==void 0).sort((m,f)=>m.startTime()-f.startTime()),u=s.find(m=>ga(m)==="dim")??s.find(m=>ga(m)===void 0),c=u?String(u.vars.color):"";for(let m of s)(ga(m)??(String(m.vars.color)===c?"dim":"active"))==="dim"?r.dimColor&&(m.vars.color=r.dimColor):r.activeColor&&(m.vars.color=r.activeColor);r.dimColor&&e.set(i,{color:r.dimColor})}if(Object.keys(a).length>0&&e.set(i,a),Object.keys(o).length>0){let l=Og(i);e.set(l,o)}}}).catch(()=>{})}var ya="data-hf-edit-base-x",va="data-hf-edit-base-y",Zt="data-hf-edit-original-translate",oi=e=>{let t=parseFloat(e??"");return Number.isFinite(t)?t:0},Gg=e=>{let t=[],n=0,r="";for(let i of e.trim())i==="("&&(n+=1),i===")"&&(n=Math.max(0,n-1)),/\\s/.test(i)&&n===0?(r&&t.push(r),r=""):r+=i;return r&&t.push(r),t},td=/^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)px$/,xa=(e,t)=>td.test(e)&&td.test(t)?`${parseFloat(e)+parseFloat(t)}px`:`calc(${e} + ${t})`,Hg=(e,t,n)=>{if(!e||e==="none")return`${t} ${n}`;let[r,i,o]=Gg(e);if(r===void 0)return`${t} ${n}`;if(i===void 0)return`${xa(r,t)} ${n}`;let a=o===void 0?"":` ${o}`;return`${xa(r,t)} ${xa(i,n)}${a}`},Bg=e=>{try{e.ownerDocument.defaultView?.gsap?.getProperty?.(e,"x")}catch{}},Ug=e=>{let t=e.style.getPropertyValue("translate").trim();if(t)return t==="none"?"":t;try{let n=e.ownerDocument.defaultView,r=n?n.getComputedStyle(e).getPropertyValue("translate").trim():"";return r==="none"?"":r}catch{return""}},Sa=new WeakMap;function Wg(e,t){let n=Sa.get(e);if(!t?.force&&n!==void 0&&e.style.getPropertyValue("translate")!==n){Ne("position_edit_fold_skipped",{hfId:e.getAttribute("data-hf-id")});return}let r=oi(e.getAttribute("data-x"))-oi(e.getAttribute(ya)),i=oi(e.getAttribute("data-y"))-oi(e.getAttribute(va));e.hasAttribute(Zt)||e.setAttribute(Zt,Ug(e)),n===void 0&&Bg(e);let o=e.getAttribute(Zt)??"",a=Hg(o,`${r}px`,`${i}px`);e.style.setProperty("translate",a),Sa.set(e,e.style.getPropertyValue("translate"))}function ai(e,t){let n=e.defaultView?.HTMLElement,r=e.defaultView?.SVGElement,i=s=>n||r?n!==void 0&&s instanceof n||r!==void 0&&s instanceof r:typeof s.style?.setProperty=="function",o=e.querySelectorAll(`[${Zt}]:not([${ya}]):not([${va}])`);for(let s=0;s<o.length;s++){let u=o[s];if(u===void 0||!i(u))continue;let c=u.getAttribute(Zt)??"";c===""?u.style.removeProperty("translate"):u.style.setProperty("translate",c),u.removeAttribute(Zt),Sa.delete(u)}let a=e.querySelectorAll(`[${ya}], [${va}]`),l=0;for(let s=0;s<a.length;s++){let u=a[s];u===void 0||!i(u)||(Wg(u,t),l+=1)}return l}var nd="__hfPositionEditsSeekReapplyWrapped",rd=new WeakSet,id=new WeakMap,od=new WeakMap;function ad(e){let t=e,n=()=>{try{ai(t.document)}catch{}},r=m=>typeof m=="function"&&(rd.has(m)||!!m[nd]),i=m=>{rd.add(m);try{Object.defineProperty(m,nd,{value:!0})}catch{}},o=m=>{if(typeof m!="function"||r(m))return m;let f=function(...p){let b=m.apply(this,p);return n(),b};return i(f),f},a=(m,f)=>{let p=id.get(m);if(p?.has(f))return!0;let b=Object.getOwnPropertyDescriptor(m,f);if(b?.configurable===!1){let _=m[f];return typeof _=="function"&&(m[f]=o(_),n()),!1}let v=m[f],x=b?.set;return Object.defineProperty(m,f,{configurable:!0,enumerable:b?.enumerable??!0,get:()=>v,set:_=>{v=o(_),x?.call(m,_)}}),v=o(v),p??(p=new Set),p.add(f),id.set(m,p),n(),!0},l=(m,f)=>{let p=od.get(t),b=Object.getOwnPropertyDescriptor(t,m);if(!p?.has(m)){if(b?.configurable===!1){let _=t[m];return _?a(_,f):!1}let x=t[m];Object.defineProperty(t,m,{configurable:!0,enumerable:b?.enumerable??!0,get:()=>x,set:_=>{x=_,x&&a(x,f)}}),p??(p=new Set),p.add(m),od.set(t,p)}let v=t[m];return v?a(v,f):!1},s=()=>{let m=l("__hf","seek"),f=l("__player","renderSeek");return m&&f};if(s())return;let u=120,c=t.setInterval(()=>{if(s()){t.clearInterval(c);return}u-=1,u<=0&&t.clearInterval(c)},50)}function si(e){let t=window,r=e.closest("[data-composition-id]")?.getAttribute("data-composition-id")?.trim()??"",i=r?t.__hfVariablesByComp?.[r]:void 0;if(i)return i;let o=t.__hyperframes?.getVariables?.();return o&&typeof o=="object"?o:t.__hfVariables??{}}function li(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Aa(e){let t=e.replace(/[\\u0000-\\u0020]/g,""),n=/^([a-z][a-z0-9+.-]*):/i.exec(t);if(!n)return!0;let r=n[1]?.toLowerCase();return r?r==="https"||r==="http"||r==="blob"?!0:r==="data"?/^data:image\\//i.test(t):!1:!1}var sd=new Set(["img","video","audio","source"]);function Vg(e){if(typeof e=="string"&&e.length>0)return e;if(e!==null&&typeof e=="object"){let t=e.url;if(typeof t=="string"&&t.length>0)return t}return null}function zg(e){return e.replace(/[;{}<>\\r\\n]/g,"")}function qg(e){if(li(e))return String(e);if(e!==null&&typeof e=="object"){let t=e.name;if(typeof t=="string"&&t.length>0)return t}return null}function Ea(e,t){let n=e.closest("[data-composition-id]"),r=t.get(n);if(r)return r;let i=si(e);return t.set(n,i),i}function $g(e,t){if(e.childElementCount===0){e.textContent=t;return}let n=!1;for(let r of Array.from(e.childNodes))r.nodeType===Node.TEXT_NODE&&(r.nodeValue=n?"":t,n=!0);n||e.insertBefore(e.ownerDocument.createTextNode(t),e.firstChild)}function jg(e){return e.querySelector("[data-hf-root]")??e.getElementById("stage")??e.body?.firstElementChild??e.body}function Kg(e,t){let n=new Set,r=jg(e);r&&n.add(r);for(let i of Array.from(e.querySelectorAll("[data-composition-id]")))n.add(i);for(let i of n){let o=Ea(i,t);for(let[a,l]of Object.entries(o)){let s=qg(l);s!==null&&i instanceof HTMLElement&&i.style.setProperty(`--${a}`,zg(s))}}}function wa(e){let t=new Map;Kg(e,t);for(let n of Array.from(e.querySelectorAll("[data-var-src]"))){let r=n.getAttribute("data-var-src")?.trim();if(!r)continue;if(!sd.has(n.tagName.toLowerCase())){console.warn(`[hyperframes] Ignoring data-var-src on <${n.tagName.toLowerCase()}>: variable-bound src is only allowed on ${Array.from(sd).join("/")}.`);continue}let i=Vg(Ea(n,t)[r]);if(i!==null){if(!Aa(i)){console.warn(`[hyperframes] Ignoring data-var-src="${r}": unsafe URL protocol.`);continue}n.setAttribute("src",i)}}for(let n of Array.from(e.querySelectorAll("[data-var-text]"))){let r=n.getAttribute("data-var-text")?.trim();if(!r)continue;let i=Ea(n,t)[r];li(i)&&$g(n,String(i))}}var rt=new Map,Yg="data-hf-color-grading-canvas",Xg="__hf_color_grading_canvas__";function xd(){if(typeof MutationObserver>"u"||typeof document>"u")return;let e=document.documentElement;if(!e)return;let t=r=>{r instanceof HTMLElement&&(r.hasAttribute(Hr)||r.setAttribute(Hr,r.style.opacity))},n=r=>{if(r instanceof Element){r.matches("video, img")&&t(r);for(let i of r.querySelectorAll("video, img"))t(i)}};n(e),new MutationObserver(r=>{for(let i of r)for(let o of i.addedNodes)n(o)}).observe(e,{childList:!0,subtree:!0})}var Jg=16,Qg=4,tn={enabled:!1,position:.5,softness:0,lineWidth:2},Ca=["#000000","#ffffff"],Zg=["#1a1a1a","#f5f5dc"],or=3,eb=or-1,tb=5,_a=`${Ke}.0`,ld=`${Ke-1}.0`,nb=`${or}.0`,rb=`${(eb+.5)/or}`;function ui(e){let t=e.getAttribute(kn);return t==null?null:Ql(t,si(e))}var ib=["attribute vec2 a_pos;","varying vec2 v_uv;","void main(){"," v_uv = a_pos * 0.5 + 0.5;"," gl_Position = vec4(a_pos, 0.0, 1.0);","}"].join(`\n`),ob=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_source;","uniform sampler2D u_blurSource;","uniform sampler2D u_bloomSource;","uniform sampler2D u_kuwaharaSource;","uniform sampler2D u_lut;","uniform sampler2D u_advanced;","uniform vec2 u_resolution;","uniform vec2 u_uvScale;","uniform vec2 u_uvOffset;","uniform float u_blurReady;","uniform float u_bloomReady;","uniform float u_kuwaharaReady;","uniform float u_lutEnabled;","uniform float u_lutSize;","uniform vec2 u_lutTextureSize;","uniform vec3 u_lutDomainMin;","uniform vec3 u_lutDomainMax;","uniform float u_lutIntensity;","uniform vec3 u_shadowWheel;","uniform vec3 u_midtoneWheel;","uniform vec3 u_highlightWheel;","uniform float u_rgbCurvesEnabled;","uniform float u_hueCurvesEnabled;","uniform float u_secondaryCount;","uniform float u_exposure;","uniform float u_contrast;","uniform float u_highlights;","uniform float u_shadows;","uniform float u_whites;","uniform float u_blacks;","uniform float u_temperature;","uniform float u_tint;","uniform float u_vibrance;","uniform float u_saturation;","uniform float u_vignette;","uniform float u_vignetteMidpoint;","uniform float u_vignetteRoundness;","uniform float u_vignetteFeather;","uniform float u_grain;","uniform float u_grainSize;","uniform float u_grainRoughness;","uniform float u_grainSeed;","uniform float u_effectTime;","uniform float u_blur;","uniform float u_bloom;","uniform float u_kuwahara;","uniform float u_pixelate;","uniform float u_chromaBleed;","uniform float u_tapeDamage;","uniform float u_tapeTracking;","uniform float u_tapeNoise;","uniform float u_tapeSpeed;","uniform float u_filmArtifacts;","uniform float u_halftone;","uniform float u_halftoneSize;","uniform float u_twoInkPrint;","uniform float u_twoInkPrintSize;","uniform float u_ascii;","uniform float u_asciiSize;","uniform float u_asciiInvert;","uniform float u_asciiStyle;","uniform float u_asciiColor;","uniform float u_asciiRotation;","uniform float u_dither;","uniform float u_ditherSize;","uniform float u_monoScreen;","uniform float u_monoScreenSize;","uniform float u_monoScreenAngle;","uniform float u_monoScreenSpread;","uniform float u_monoScreenShape;","uniform float u_monoScreenInvert;","uniform float u_scanlines;","uniform float u_scanlineCount;","uniform float u_scanlineSoftness;","uniform float u_chromaticAberration;","uniform float u_chromaticAngle;","uniform float u_crtCurvature;","uniform float u_digitalGlitch;","uniform float u_digitalGlitchColorSplit;","uniform float u_digitalGlitchLineTear;","uniform float u_digitalGlitchPixelate;","uniform float u_digitalGlitchBlockAmount;","uniform float u_digitalGlitchBlockDisplacement;","uniform float u_digitalGlitchBlockOpacity;","uniform float u_digitalGlitchSpeed;","uniform float u_engraving;","uniform float u_engravingSpacing;","uniform float u_engravingMinThickness;","uniform float u_engravingMaxThickness;","uniform float u_engravingAngle;","uniform float u_engravingContrast;","uniform float u_engravingSharpness;","uniform float u_engravingWave;","uniform float u_engravingWaveFrequency;","uniform float u_crosshatch;","uniform float u_crosshatchSpacing;","uniform float u_crosshatchThickness;","uniform float u_crosshatchAngle;","uniform float u_crosshatchContrast;","uniform float u_crosshatchEdges;","uniform float u_crosshatchLineWeight;","uniform float u_crosshatchWave;","uniform float u_crosshatchWaveFrequency;","uniform float u_paletteSize;","uniform vec3 u_palette0;","uniform vec3 u_palette1;","uniform vec3 u_palette2;","uniform vec3 u_palette3;","uniform vec3 u_palette4;","uniform vec3 u_palette5;","uniform float u_intensity;","uniform float u_compareEnabled;","uniform float u_comparePosition;","uniform float u_compareSoftness;","uniform float u_compareLineWidth;","const float PI = 3.14159265359;","float lumaOf(vec3 c){ return dot(c, vec3(0.2126, 0.7152, 0.0722)); }","float bt601Luma(vec3 c){ return dot(c, vec3(0.299, 0.587, 0.114)); }","float grainHash(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123); }","float digitalHash(vec2 p){"," vec2 q = mod(floor(p), 251.0);"," float x = mod(q.x * q.x * 157.0 + q.x * 89.0, 251.0);"," float y = mod(q.y * q.y * 113.0 + q.y * 47.0, 251.0);"," float xy = mod(q.x * q.y * 71.0, 251.0);"," return mod(x + y + xy + 19.0, 251.0) / 251.0;","}","float colorSaturation(vec3 c){ return max(max(c.r, c.g), c.b) - min(min(c.r, c.g), c.b); }","vec2 clampUv(vec2 uv){ return clamp(uv, vec2(0.0), vec2(1.0)); }","vec2 applyCrtWarp(vec2 uv){"," vec2 centered = uv * 2.0 - 1.0;"," float curvature = clamp(u_crtCurvature, 0.0, 1.0) * 0.5;"," float dist = dot(centered, centered);"," centered *= 1.0 + curvature * dist;"," return centered * 0.5 + 0.5;","}","vec4 sampleSource(vec2 uv){ return texture2D(u_source, clampUv(uv)); }","vec4 sampleBlur(vec2 uv){ return texture2D(u_blurSource, clampUv(uv)); }","vec3 sampleBloom(vec2 uv){ return texture2D(u_bloomSource, clampUv(uv)).rgb; }","vec3 sampleKuwahara(vec2 uv){"," vec2 displayUv = uv * u_uvScale + u_uvOffset;"," return texture2D(u_kuwaharaSource, clampUv(displayUv)).rgb;","}","vec4 samplePrepared(vec2 uv){"," vec4 base = sampleSource(uv);"," float blur = clamp(u_blur, 0.0, 1.0);"," if (blur > 0.0 && u_blurReady > 0.5) base = mix(base, sampleBlur(uv), blur);"," float kuwahara = clamp(u_kuwahara, 0.0, 1.0);"," if (kuwahara > 0.0 && u_kuwaharaReady > 0.5) {"," base.rgb = mix(base.rgb, sampleKuwahara(uv), kuwahara);"," }"," return base;","}","float tapeTrackingBand(float y, float center, float width){"," float offset = fract(y - center + 0.5) - 0.5;"," float triangle = max(0.0, 1.0 - abs(offset) / max(width, 0.0001));"," return triangle * triangle * (3.0 - 2.0 * triangle);","}","vec4 sampleMedia(vec2 uv){"," float pixel = clamp(u_pixelate, 0.0, 1.0);"," vec2 sampleUv = uv;"," if (pixel > 0.0) {"," float blockSize = mix(1.0, 48.0, pixel);"," vec2 cells = max(u_resolution / blockSize, vec2(1.0));"," sampleUv = (floor(clamp(uv, vec2(0.0), vec2(0.999999)) * cells) + 0.5) / cells;"," }"," float tapeDamage = clamp(u_tapeDamage, 0.0, 1.0);"," float tapeTracking = clamp(u_tapeTracking, 0.0, 1.0);"," float tapeNoise = clamp(u_tapeNoise, 0.0, 1.0);"," float tapeTime = u_effectTime * mix(0.0, 2.0, clamp(u_tapeSpeed, 0.0, 1.0));"," float tapeFrame = floor(tapeTime * 60.0);"," float tapeLine = floor(sampleUv.y * u_resolution.y * 0.5);"," float lineJitter = (digitalHash(vec2(tapeLine, floor(tapeFrame * 0.5))) - 0.5) * 1.8 * tapeNoise;"," float slowWobble = sin(sampleUv.y * 32.0 + tapeTime * 2.6) * 0.55;"," float headSwitch = smoothstep(0.88, 1.0, sampleUv.y) * sin(sampleUv.y * 240.0 + tapeTime * 8.0) * 4.0;"," float trackingShift = tapeTrackingBand(sampleUv.y, fract(0.08 + tapeTime * 0.083), 0.035);"," trackingShift -= tapeTrackingBand(sampleUv.y, fract(0.28 + tapeTime * 0.061), 0.03) * 0.8;"," trackingShift += tapeTrackingBand(sampleUv.y, fract(0.5 + tapeTime * 0.047), 0.04) * 0.75;"," trackingShift -= tapeTrackingBand(sampleUv.y, fract(0.72 + tapeTime * 0.037), 0.028) * 0.65;"," trackingShift += tapeTrackingBand(sampleUv.y, fract(0.89 + tapeTime * 0.029), 0.032) * 0.55;"," trackingShift *= tapeTracking * 48.0;"," float tapeShift = (lineJitter + slowWobble + headSwitch + trackingShift) * tapeDamage;"," float texelX = 1.0 / max(u_resolution.x * max(u_uvScale.x, 0.00001), 1.0);"," vec2 tapeUv = sampleUv + vec2(tapeShift * texelX, 0.0);"," vec4 base = samplePrepared(tapeUv);"," if (tapeDamage > 0.0) {"," vec2 lumaStep = vec2(texelX * mix(1.0, 3.5, tapeDamage), 0.0);"," vec3 leftTape = samplePrepared(tapeUv - lumaStep).rgb;"," vec3 rightTape = samplePrepared(tapeUv + lumaStep).rgb;"," float tapeLuma = (bt601Luma(leftTape) + bt601Luma(base.rgb) * 2.0 + bt601Luma(rightTape)) * 0.25;"," vec3 centerChroma = base.rgb - vec3(bt601Luma(base.rgb));"," vec3 tapeColor = vec3(tapeLuma) + centerChroma;"," vec3 ghost = samplePrepared(tapeUv - vec2(texelX * 12.0, 0.0)).rgb;"," tapeColor = mix(tapeColor, ghost, 0.045 * tapeDamage);"," float fineNoise = digitalHash(floor(gl_FragCoord.xy) + vec2(tapeFrame * 17.0, tapeFrame * 3.0)) - 0.5;"," float band = digitalHash(vec2(floor(sampleUv.y * 92.0), floor(tapeFrame / 3.0)));"," float dropout = smoothstep(0.985, 1.0, band) * (digitalHash(vec2(floor(sampleUv.x * 18.0), tapeLine)) - 0.5);"," tapeColor += (fineNoise * 0.035 + dropout * 0.12) * tapeDamage * tapeNoise;"," base.rgb = mix(base.rgb, clamp(tapeColor, 0.0, 1.0), tapeDamage);"," }"," float chromaBleed = clamp(u_chromaBleed, 0.0, 1.0);"," if (chromaBleed > 0.0) {"," float radius = mix(1.0, 4.0, chromaBleed);"," vec2 stepUv = vec2(texelX * radius, 0.0);"," vec3 c0 = base.rgb;"," vec3 c1 = samplePrepared(tapeUv - stepUv).rgb;"," vec3 c2 = samplePrepared(tapeUv + stepUv).rgb;"," vec3 c3 = samplePrepared(tapeUv - stepUv * 2.0).rgb;"," vec3 c4 = samplePrepared(tapeUv + stepUv * 2.0).rgb;"," float centerLuma = lumaOf(base.rgb);"," vec3 blurredChroma = ((c0 - vec3(lumaOf(c0))) * 6.0 + (c1 - vec3(lumaOf(c1))) * 4.0 + (c2 - vec3(lumaOf(c2))) * 4.0 + (c3 - vec3(lumaOf(c3))) + (c4 - vec3(lumaOf(c4)))) / 16.0;"," base.rgb = mix(base.rgb, clamp(vec3(centerLuma) + blurredChroma, 0.0, 1.0), chromaBleed);"," }"," return base;","}","vec4 sampleChromaticMedia(vec2 uv, vec4 center){"," float amount = clamp(u_chromaticAberration, 0.0, 1.0);"," if (amount <= 0.0) return center;"," float angle = clamp(u_chromaticAngle, 0.0, 1.0) * PI * 2.0;"," vec2 offset = vec2(cos(angle), sin(angle)) * amount * 0.02;"," vec4 positive = sampleMedia(uv + offset);"," vec4 negative = sampleMedia(uv - offset);"," vec3 split = vec3(positive.r, center.g, negative.b);"," return vec4(split, center.a);","}","vec3 sampleDigitalSplit(vec2 uv, vec2 block, float time, float amount){"," float split = amount * 0.06;"," float direction = digitalHash(block * 0.4 + vec2(floor(time * 3.7), floor(time * 5.3)));"," vec2 axis = direction > 0.66 ? vec2(1.0, 0.0) : direction > 0.33 ? vec2(0.0, 1.0) : vec2(0.7071);"," vec4 center = sampleMedia(uv);"," return vec3(sampleMedia(uv + axis * split).r, center.g, sampleMedia(uv - axis * split).b);","}","vec3 applyDigitalGlitch(vec2 uv, vec3 source){"," float amount = clamp(u_digitalGlitch, 0.0, 1.0);"," if (amount <= 0.0) return source;"," float colorSplit = clamp(u_digitalGlitchColorSplit, 0.0, 1.0) * 2.0;"," float lineTear = clamp(u_digitalGlitchLineTear, 0.0, 1.0) * 2.0;"," float pixelate = clamp(u_digitalGlitchPixelate, 0.0, 1.0) * 2.0;"," float blockAmount = clamp(u_digitalGlitchBlockAmount, 0.0, 1.0);"," float blockDisplacement = clamp(u_digitalGlitchBlockDisplacement, 0.0, 1.0) * 2.0;"," float blockOpacity = clamp(u_digitalGlitchBlockOpacity, 0.0, 1.0);"," float speed = clamp(u_digitalGlitchSpeed, 0.0, 1.0) * 2.0;"," float time = u_effectTime * speed;"," float blockCount = 8.0 + blockAmount * 60.0;"," vec2 block = floor(uv * blockCount);"," float randomA = digitalHash(block + vec2(floor(time * 7.3), floor(time * 11.1)));"," float randomB = digitalHash(block * 0.7 + vec2(17.3 + floor(time * 6.6), 29.1));"," float randomC = digitalHash(block + vec2(floor(time * 5.7) * 13.0, 41.0));"," float randomD = digitalHash(block * 1.3 + vec2(7.0, floor(time * 3.2) * 7.0));"," vec2 displaced = uv;"," if (blockDisplacement > 0.0 && blockOpacity > 0.0) {"," float threshold = 1.0 - blockDisplacement * 0.4;"," if (randomA > threshold) {"," displaced += vec2((randomB - 0.5) * blockDisplacement * 0.5, (randomC - 0.5) * blockDisplacement * 0.3);"," }"," if (randomD > 0.92 && blockDisplacement > 0.5) {"," displaced.x += (digitalHash(vec2(block.y, floor(time * 8.0))) - 0.5) * blockDisplacement;"," }"," displaced = mix(uv, displaced, blockOpacity);"," }"," if (lineTear > 0.0) {"," float row = floor(uv.y * (50.0 + lineTear * 150.0));"," float tearA = digitalHash(vec2(row * 7.3 + floor(time * 12.0 + row * 0.1) * 3.7, 13.0));"," float tearB = digitalHash(vec2(row * 13.7 + floor(time * 8.3) * 5.1, 31.0));"," if (tearA > 1.0 - lineTear * 0.5) displaced.x += (tearB - 0.5) * lineTear * 0.4;"," if (tearB > 0.95 && lineTear > 0.3) displaced.x += (tearA - 0.5) * lineTear * 0.8;"," }"," if (pixelate > 0.0) {"," float pixelRandom = digitalHash(block * 0.5 + vec2(floor(time * 4.9), 53.0));"," if (pixelRandom > 1.0 - pixelate * 0.35) {"," float cells = 4.0 + (1.0 - pixelRandom) * pixelate * 40.0;"," displaced = (floor(clampUv(displaced) * cells) + 0.5) / cells;"," }"," }"," displaced = clampUv(displaced);"," vec3 glitch = sampleDigitalSplit(displaced, block, time, colorSplit);"," if (blockDisplacement > 0.2 && blockOpacity > 0.0) {"," float corruption = digitalHash(block * 1.1 + vec2(floor(time * 11.9), 67.0));"," vec3 changed = glitch;"," if (corruption > 0.9) changed = 1.0 - glitch;"," else if (corruption > 0.85) changed = corruption > 0.875 ? glitch.gbr : glitch.brg;"," else if (corruption > 0.8) {"," float channel = digitalHash(block + vec2(73.0));"," if (channel > 0.66) changed.r = min(changed.r * 2.0, 1.0);"," else if (channel > 0.33) changed.g = min(changed.g * 2.0, 1.0);"," else changed.b = min(changed.b * 2.0, 1.0);"," }"," glitch = mix(glitch, changed, blockOpacity);"," }"," if (blockOpacity > 0.0) {"," float flash = digitalHash(block * 0.8 + vec2(floor(time * 14.7), 83.0));"," vec3 flashed = flash > 0.97 ? min(glitch * 1.8, vec3(1.0)) : flash > 0.94 ? glitch * 0.3 : glitch;"," glitch = mix(glitch, flashed, blockOpacity * 0.6);"," }"," if (lineTear > 0.1) {"," float interference = pow(sin(uv.y * (300.0 + randomA * 200.0) + time * 30.0) * 0.5 + 0.5, 6.0);"," glitch -= interference * 0.08 * lineTear;"," }"," return mix(source, clamp(glitch, 0.0, 1.0), amount);","}","float dustMask(vec2 uv, float frameBucket){"," vec2 grid = vec2(128.0, 72.0);"," vec2 cell = floor(uv * grid);"," vec2 local = fract(uv * grid) - 0.5;"," float chance = grainHash(cell + frameBucket * 19.13);"," float radius = mix(0.05, 0.34, grainHash(cell + 7.1));"," return step(0.9975, chance) * (1.0 - smoothstep(radius, radius + 0.08, length(local)));","}","float screenDot(vec2 p, float ink, float angle, float sharpness){"," float c = cos(angle);"," float s = sin(angle);"," vec2 q = mat2(c, -s, s, c) * p;"," vec2 d = fract(q) - 0.5;"," float radius = sqrt(clamp(ink, 0.0, 1.0)) * 0.68;"," float edge = mix(0.16, 0.025, sharpness);"," return 1.0 - smoothstep(radius - edge, radius + edge, length(d));","}","vec3 paletteColor(float index);","float monoScreenMask(vec2 local, float radius, float shape, float softness){"," vec2 centered = local - 0.5;"," float distanceToInk = length(centered);"," if (shape > 0.5 && shape < 1.5) distanceToInk = max(abs(centered.x), abs(centered.y));"," if (shape > 1.5 && shape < 2.5) distanceToInk = abs(centered.x) + abs(centered.y);"," if (shape > 2.5 && shape < 3.5) distanceToInk = max(abs(centered.x) * 0.86 + centered.y * 0.5, -centered.y);"," if (shape > 3.5) distanceToInk = abs(centered.y);"," float shapeRadius = shape > 3.5 ? radius * 0.45 : radius;"," return 1.0 - smoothstep(shapeRadius, shapeRadius + softness, distanceToInk);","}","vec3 applyMonoScreen(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float invert = step(0.5, u_monoScreenInvert);"," float coverage = mix(1.0 - lumaOf(source), lumaOf(source), invert);"," coverage = pow(clamp(coverage, 0.0, 1.0), mix(1.7, 0.58, clamp(u_monoScreenSpread, 0.0, 1.0)));"," float scale = max(min(u_resolution.x, u_resolution.y) / 540.0, 0.25);"," float cellPx = mix(4.0, 18.0, clamp(u_monoScreenSize, 0.0, 1.0)) * scale;"," float angle = clamp(u_monoScreenAngle, 0.0, 1.0) * PI * 0.5;"," float cosine = cos(angle);"," float sine = sin(angle);"," vec2 point = mat2(cosine, -sine, sine, cosine) * gl_FragCoord.xy / max(cellPx, 1.0);"," float radius = sqrt(coverage) * 0.68;"," float inkMask = monoScreenMask(fract(point), radius, floor(u_monoScreenShape + 0.5), 0.035);"," vec3 ink = paletteColor(0.0);"," vec3 paper = paletteColor(max(u_paletteSize - 1.0, 1.0));"," return mix(source, mix(paper, ink, inkMask), amount);","}","vec3 applyEngraving(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float spacing = mix(3.0, 20.0, clamp(u_engravingSpacing, 0.0, 1.0));"," float minThickness = mix(0.0, 2.0, clamp(u_engravingMinThickness, 0.0, 1.0));"," float maxThickness = mix(1.0, 8.0, clamp(u_engravingMaxThickness, 0.0, 1.0));"," float angle = clamp(u_engravingAngle, 0.0, 1.0) * PI;"," vec2 alongAxis = vec2(cos(angle), sin(angle));"," vec2 acrossAxis = vec2(-alongAxis.y, alongAxis.x);"," float along = dot(gl_FragCoord.xy, alongAxis);"," float across = dot(gl_FragCoord.xy, acrossAxis);"," float frequency = mix(1.0, 10.0, clamp(u_engravingWaveFrequency, 0.0, 1.0));"," float wave = sin(along * frequency * 0.01);"," across += wave * clamp(u_engravingWave, 0.0, 1.0) * 3.0;"," float lineIndex = floor(across / max(spacing, 1.0));"," float lineDistance = abs(fract(across / max(spacing, 1.0)) - 0.5) * spacing;"," float contrast = mix(0.5, 2.0, clamp(u_engravingContrast, 0.0, 1.0));"," float darkness = 1.0 - pow(clamp(lumaOf(source), 0.0, 1.0), contrast);"," float variation = mix(0.88, 1.12, digitalHash(vec2(lineIndex, 73.0)));"," float thickness = mix(minThickness, maxThickness, darkness) * variation;"," float edge = mix(1.0, 0.3, clamp(u_engravingSharpness, 0.0, 1.0));"," float inkMask = 1.0 - smoothstep(max(thickness * 0.5 - edge, 0.0), thickness * 0.5 + edge, lineDistance);"," inkMask *= smoothstep(0.015, 0.12, darkness);"," vec3 ink = paletteColor(0.0);"," vec3 paper = paletteColor(max(u_paletteSize - 1.0, 1.0));"," return mix(source, mix(paper, ink, inkMask), amount);","}","float crosshatchLine(vec2 pixel, float angle, float spacing, float thickness, float seed){"," vec2 alongAxis = vec2(cos(angle), sin(angle));"," vec2 acrossAxis = vec2(-alongAxis.y, alongAxis.x);"," float along = dot(pixel, alongAxis);"," float across = dot(pixel, acrossAxis);"," float frequency = mix(1.0, 10.0, clamp(u_crosshatchWaveFrequency, 0.0, 1.0));"," across += sin(along * frequency * 0.02 + u_effectTime + seed) * clamp(u_crosshatchWave, 0.0, 1.0) * 5.0;"," float lineIndex = floor(across / max(spacing, 1.0));"," float distanceToLine = abs(fract(across / max(spacing, 1.0)) - 0.5) * spacing;"," float variation = mix(1.0, 0.5 + digitalHash(vec2(lineIndex, seed)), clamp(u_crosshatchLineWeight, 0.0, 1.0));"," float halfWidth = thickness * variation * 0.5;"," return 1.0 - smoothstep(max(halfWidth - 0.5, 0.0), halfWidth + 0.5, distanceToLine);","}","float crosshatchEdge(vec2 uv){"," vec2 texel = 1.0 / max(u_resolution * u_uvScale, vec2(1.0));"," float tl = lumaOf(sampleMedia(uv + texel * vec2(-1.0, -1.0)).rgb);"," float tc = lumaOf(sampleMedia(uv + texel * vec2( 0.0, -1.0)).rgb);"," float tr = lumaOf(sampleMedia(uv + texel * vec2( 1.0, -1.0)).rgb);"," float ml = lumaOf(sampleMedia(uv + texel * vec2(-1.0, 0.0)).rgb);"," float mr = lumaOf(sampleMedia(uv + texel * vec2( 1.0, 0.0)).rgb);"," float bl = lumaOf(sampleMedia(uv + texel * vec2(-1.0, 1.0)).rgb);"," float bc = lumaOf(sampleMedia(uv + texel * vec2( 0.0, 1.0)).rgb);"," float br = lumaOf(sampleMedia(uv + texel * vec2( 1.0, 1.0)).rgb);"," float gx = -tl - 2.0 * ml - bl + tr + 2.0 * mr + br;"," float gy = -tl - 2.0 * tc - tr + bl + 2.0 * bc + br;"," return length(vec2(gx, gy));","}","vec3 applyCrosshatch(vec2 uv, vec3 source, float amount){"," if (amount <= 0.0) return source;"," float spacing = mix(5.0, 30.0, clamp(u_crosshatchSpacing, 0.0, 1.0));"," float thickness = mix(1.0, 5.0, clamp(u_crosshatchThickness, 0.0, 1.0));"," float baseAngle = -clamp(u_crosshatchAngle, 0.0, 1.0) * PI;"," float contrast = mix(0.5, 2.0, clamp(u_crosshatchContrast, 0.0, 1.0));"," float darkness = 1.0 - pow(clamp(lumaOf(source), 0.0, 1.0), contrast);"," vec3 ink = paletteColor(0.0);"," vec3 paper = paletteColor(max(u_paletteSize - 1.0, 1.0));"," vec3 result = paper;"," float layer = crosshatchLine(gl_FragCoord.xy, baseAngle, spacing, thickness, 1.0) * smoothstep(0.2, 0.4, darkness);"," result = mix(result, ink, layer);"," layer = crosshatchLine(gl_FragCoord.xy, baseAngle + PI * 0.5, spacing * 0.95, thickness * 0.9, 2.0) * smoothstep(0.4, 0.6, darkness);"," result = mix(result, ink, layer);"," layer = crosshatchLine(gl_FragCoord.xy, baseAngle + PI * 0.25, spacing * 0.9, thickness * 0.8, 3.0) * smoothstep(0.6, 0.8, darkness);"," result = mix(result, ink, layer);"," layer = crosshatchLine(gl_FragCoord.xy, baseAngle - PI * 0.25, spacing * 0.85, thickness * 0.7, 4.0) * smoothstep(0.75, 0.9, darkness);"," result = mix(result, ink, layer);"," result = mix(result, ink, smoothstep(0.9, 1.0, darkness) * 0.8);"," float edgeStrength = mix(0.0, 2.0, clamp(u_crosshatchEdges, 0.0, 1.0));"," float edge = smoothstep(0.1, 0.3, crosshatchEdge(uv)) * edgeStrength;"," result = mix(result, ink, clamp(edge, 0.0, 1.0));"," return mix(source, result, amount);","}","vec3 applyHalftone(vec3 source, float amount){"," if (amount <= 0.0) return source;"," vec3 cmy = 1.0 - source;"," float k = min(cmy.r, min(cmy.g, cmy.b));"," vec3 inks = max(cmy - vec3(k * 0.72), 0.0);"," float scale = min(u_resolution.x, u_resolution.y) / 540.0;"," float cellPx = mix(5.0, 14.0, clamp(u_halftoneSize, 0.0, 1.0)) * max(scale, 0.25);"," vec2 p = gl_FragCoord.xy / max(cellPx, 1.0);"," float cyan = screenDot(p, inks.r, 0.261799, 0.78);"," float magenta = screenDot(p, inks.g, 1.308997, 0.78);"," float yellow = screenDot(p, inks.b, 0.0, 0.78);"," float blackInk = screenDot(p, k, 0.785398, 0.82);"," vec3 printColor = vec3(0.975, 0.962, 0.925);"," printColor *= mix(vec3(1.0), vec3(0.05, 0.79, 0.86), cyan);"," printColor *= mix(vec3(1.0), vec3(0.91, 0.08, 0.48), magenta);"," printColor *= mix(vec3(1.0), vec3(0.98, 0.83, 0.08), yellow);"," printColor *= mix(vec3(1.0), vec3(0.035), blackInk * 0.92);"," return mix(source, printColor, amount);","}","vec3 applyTwoInkPrint(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float sourceLuma = lumaOf(source);"," float darkness = 1.0 - sourceLuma;"," float warmBias = clamp(source.r - (source.g + source.b) * 0.5, -0.35, 0.35);"," float coolBias = clamp((source.g + source.b) * 0.5 - source.r, -0.35, 0.35);"," float redTone = smoothstep(0.08, 0.72, darkness) * (1.0 - 0.68 * smoothstep(0.66, 1.0, darkness));"," float tealTone = smoothstep(0.30, 0.92, darkness);"," float redCoverage = clamp(redTone + warmBias * 1.35 - coolBias * 0.35, 0.0, 1.0);"," float tealCoverage = clamp(tealTone + coolBias * 1.1 - warmBias * 0.45, 0.0, 1.0);"," float scale = min(u_resolution.x, u_resolution.y) / 540.0;"," float cellPx = mix(4.5, 12.0, clamp(u_twoInkPrintSize, 0.0, 1.0)) * max(scale, 0.25);"," vec2 p = gl_FragCoord.xy / max(cellPx, 1.0);"," float redDot = screenDot(p, redCoverage, 0.261799, 0.84);"," float tealDot = screenDot(p + vec2(0.12, -0.08), tealCoverage, 1.308997, 0.84);"," float paperNoise = grainHash(floor(gl_FragCoord.xy * 0.5)) - 0.5;"," vec3 paper = vec3(0.955, 0.910, 0.795) + paperNoise * 0.018;"," vec3 vermilion = vec3(0.88, 0.13, 0.075);"," vec3 teal = vec3(0.035, 0.285, 0.355);"," vec3 overprint = vec3(0.045, 0.055, 0.052);"," vec3 printColor = paper * (1.0 - redDot) * (1.0 - tealDot);"," printColor += vermilion * redDot * (1.0 - tealDot);"," printColor += teal * (1.0 - redDot) * tealDot;"," printColor += overprint * redDot * tealDot;"," return mix(source, clamp(printColor, 0.0, 1.0), amount);","}","vec3 paletteColor(float index){"," if (index < 0.5) return u_palette0;"," if (index < 1.5) return u_palette1;"," if (index < 2.5) return u_palette2;"," if (index < 3.5) return u_palette3;"," if (index < 4.5) return u_palette4;"," return u_palette5;","}","float bayer4(vec2 point){"," vec2 cell = mod(floor(point), 4.0);"," if (cell.y < 0.5) {"," if (cell.x < 0.5) return 0.5 / 16.0;"," if (cell.x < 1.5) return 8.5 / 16.0;"," if (cell.x < 2.5) return 2.5 / 16.0;"," return 10.5 / 16.0;"," }"," if (cell.y < 1.5) {"," if (cell.x < 0.5) return 12.5 / 16.0;"," if (cell.x < 1.5) return 4.5 / 16.0;"," if (cell.x < 2.5) return 14.5 / 16.0;"," return 6.5 / 16.0;"," }"," if (cell.y < 2.5) {"," if (cell.x < 0.5) return 3.5 / 16.0;"," if (cell.x < 1.5) return 11.5 / 16.0;"," if (cell.x < 2.5) return 1.5 / 16.0;"," return 9.5 / 16.0;"," }"," if (cell.x < 0.5) return 15.5 / 16.0;"," if (cell.x < 1.5) return 7.5 / 16.0;"," if (cell.x < 2.5) return 13.5 / 16.0;"," return 5.5 / 16.0;","}","float standardAsciiSample(float brightness, vec2 grid){"," if (brightness < 0.1) return 0.0;"," if (brightness < 0.2) return grid.x == 2.0 && grid.y == 5.0 ? 1.0 : 0.0;"," if (brightness < 0.3) return grid.x == 2.0 && (grid.y == 2.0 || grid.y == 4.0) ? 1.0 : 0.0;"," if (brightness < 0.4) return (grid.y == 2.0 || grid.y == 4.0) && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.5) {"," bool cross = (grid.x == 2.0 && grid.y >= 2.0 && grid.y <= 4.0) || (grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0);"," bool diagonals = (grid.x == 1.0 || grid.x == 3.0) && (grid.y == 2.0 || grid.y == 4.0);"," return cross || diagonals ? 1.0 : 0.0;"," }"," if (brightness < 0.6) {"," bool ring = ((grid.y == 2.0 || grid.y == 4.0) && grid.x >= 1.0 && grid.x <= 3.0) || ((grid.x == 1.0 || grid.x == 3.0) && grid.y == 3.0);"," return ring ? 1.0 : 0.0;"," }"," bool outline = ((grid.y == 1.0 || grid.y == 5.0) && grid.x >= 1.0 && grid.x <= 3.0) || ((grid.x == 0.0 || grid.x == 4.0) && grid.y >= 2.0 && grid.y <= 4.0) || ((grid.x == 1.0 || grid.x == 3.0) && grid.y >= 1.0 && grid.y <= 5.0);"," if (brightness < 0.7) return outline ? 1.0 : 0.0;"," if (brightness < 0.8) {"," bool slash = abs(grid.x - 2.0) == abs(grid.y - 3.0) && grid.x >= 1.0 && grid.x <= 3.0;"," return outline || slash ? 1.0 : 0.0;"," }"," if (brightness < 0.9) {"," bool loops = ((grid.y == 1.0 || grid.y == 3.0 || grid.y == 5.0) && grid.x >= 1.0 && grid.x <= 3.0) || ((grid.x == 1.0 || grid.x == 3.0) && (grid.y == 2.0 || grid.y == 4.0));"," return loops ? 1.0 : 0.0;"," }"," return 1.0;","}","float asciiStyleSample(float style, float brightness, vec2 uv){"," vec2 grid = floor(uv * vec2(5.0, 7.0));"," if (style < 0.5) return standardAsciiSample(brightness, grid);"," if (style < 1.5) {"," float checker = mod(grid.x + grid.y, 2.0);"," float ruled = mod(grid.x, 2.0) == 0.0 || mod(grid.y, 2.0) == 0.0 ? 1.0 : 0.0;"," if (brightness < 0.125) return 0.0;"," if (brightness < 0.25) return checker == 0.0 ? 0.5 : 0.0;"," if (brightness < 0.375) return ruled * 0.6;"," if (brightness < 0.5) return checker == 0.0 ? 1.0 : 0.0;"," if (brightness < 0.625) return ruled > 0.5 ? 1.0 : 0.3;"," if (brightness < 0.75) return checker == 0.0 ? 1.0 : 0.7;"," if (brightness < 0.875) return ruled > 0.5 ? 1.0 : 0.85;"," return 1.0;"," }"," if (style < 2.5) {"," if (brightness < 0.14) return 0.0;"," if (brightness < 0.28) return grid.x == 2.0 && grid.y == 1.0 ? 1.0 : 0.0;"," if (brightness < 0.42) return grid.x == 2.0 && grid.y == 5.0 ? 1.0 : 0.0;"," if (brightness < 0.56) return grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.7) return (grid.x == 2.0 && grid.y >= 2.0 && grid.y <= 4.0) || (grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0) ? 1.0 : 0.0;"," if (brightness < 0.84) return abs(grid.x - 2.0) == abs(grid.y - 3.0) && grid.y >= 2.0 && grid.y <= 4.0 ? 1.0 : 0.0;"," return grid.x == 1.0 || grid.x == 3.0 || grid.y == 2.0 || grid.y == 4.0 ? 1.0 : 0.0;"," }"," if (style < 3.5) return grid.y >= 6.0 - brightness * 7.0 ? 1.0 : 0.0;"," if (style < 4.5) {"," vec2 dots = floor(uv * vec2(2.0, 4.0));"," if (brightness < 0.125) return 0.0;"," if (brightness < 0.25) return dots.y == 3.0 ? 1.0 : 0.0;"," if (brightness < 0.375) return dots.y >= 2.0 ? 1.0 : 0.0;"," if (brightness < 0.5) return dots.y >= 1.0 ? 1.0 : 0.0;"," if (brightness < 0.625) return dots.y >= 1.0 || dots.x == 1.0 ? 1.0 : 0.0;"," if (brightness < 0.75) return 1.0;"," if (brightness < 0.875) return mod(grid.x + grid.y, 2.0) < 1.5 ? 1.0 : 0.7;"," return 1.0;"," }"," if (style < 5.5) {"," if (brightness < 0.125) return 0.0;"," if (brightness < 0.25) return grid.x == 2.0 && grid.y == 3.0 ? 1.0 : 0.0;"," if (brightness < 0.375) return grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.5) return grid.x + grid.y == 5.0 || grid.x + grid.y == 6.0 ? 1.0 : 0.0;"," if (brightness < 0.625) return grid.x == 2.0 ? 1.0 : 0.0;"," if (brightness < 0.75) return abs(grid.x - grid.y / 1.4) < 0.7 && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.875) return grid.x == 2.0 || grid.y == 3.0 ? 1.0 : 0.0;"," return grid.x == 1.0 || grid.x == 3.0 || grid.y == 2.0 || grid.y == 4.0 ? 1.0 : 0.0;"," }"," if (style < 6.5) {"," bool top = grid.y == 0.0 && grid.x >= 1.0 && grid.x <= 3.0;"," bool topLeft = grid.x == 1.0 && grid.y <= 3.0;"," bool topRight = grid.x == 3.0 && grid.y <= 3.0;"," bool middle = grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0;"," bool bottomLeft = grid.x == 1.0 && grid.y >= 3.0;"," bool bottomRight = grid.x == 3.0 && grid.y >= 3.0;"," bool bottom = grid.y == 6.0 && grid.x >= 1.0 && grid.x <= 3.0;"," if (brightness < 0.1) return 0.0;"," if (brightness < 0.2) return topRight || bottomRight ? 1.0 : 0.0;"," if (brightness < 0.3) return top || topRight || middle || bottomLeft || bottom ? 1.0 : 0.0;"," if (brightness < 0.4) return top || topRight || middle || bottomRight || bottom ? 1.0 : 0.0;"," if (brightness < 0.5) return topLeft || middle || topRight || bottomRight ? 1.0 : 0.0;"," if (brightness < 0.6) return top || topLeft || middle || bottomRight || bottom ? 1.0 : 0.0;"," if (brightness < 0.7) return top || topLeft || middle || bottomLeft || bottomRight || bottom ? 1.0 : 0.0;"," if (brightness < 0.8) return top || topRight || bottomRight ? 1.0 : 0.0;"," if (brightness < 0.9) return top || topLeft || topRight || middle || bottomLeft || bottomRight || bottom ? 1.0 : 0.0;"," return top || topLeft || topRight || middle || bottomRight || bottom ? 1.0 : 0.0;"," }"," float slash = grid.x - grid.y;"," float backslash = grid.x + grid.y;"," if (brightness < 0.16) return 0.0;"," if (brightness < 0.33) return mod(slash, 3.0) < 0.5 ? 1.0 : 0.0;"," if (brightness < 0.5) return mod(slash, 2.0) < 0.5 ? 1.0 : 0.0;"," bool diagonalA = mod(slash, 2.0) < 0.5;"," bool diagonalB = mod(backslash, 2.0) < 0.5;"," if (brightness < 0.66) return diagonalA || diagonalB ? 1.0 : 0.0;"," if (brightness < 0.83) return mod(slash, 1.5) < 0.5 || mod(backslash, 1.5) < 0.5 ? 1.0 : 0.2;"," return mod(slash, 1.0) < 0.6 || mod(backslash, 1.0) < 0.6 ? 1.0 : 0.5;","}","vec3 rgbToHsv(vec3 color){"," float maximum = max(max(color.r, color.g), color.b);"," float minimum = min(min(color.r, color.g), color.b);"," float delta = maximum - minimum;"," float hue = 0.0;"," if (delta > 0.00001) {"," if (maximum == color.r) hue = mod((color.g - color.b) / delta, 6.0);"," else if (maximum == color.g) hue = (color.b - color.r) / delta + 2.0;"," else hue = (color.r - color.g) / delta + 4.0;"," hue = fract(hue / 6.0);"," }"," return vec3(hue, maximum > 0.00001 ? delta / maximum : 0.0, maximum);","}","vec3 hsvToRgb(vec3 color){"," vec3 bands = abs(fract(color.xxx + vec3(0.0, 0.6666667, 0.3333333)) * 6.0 - 3.0);"," return color.z * mix(vec3(1.0), clamp(bands - 1.0, 0.0, 1.0), color.y);","}","vec4 sampleAdvancedCurve(float coordinate, float row){",` float position = clamp(coordinate, 0.0, 1.0) * ${ld};`," float lower = floor(position);",` float upper = min(lower + 1.0, ${ld});`,` float y = (row + 0.5) / ${nb};`,` vec4 before = texture2D(u_advanced, vec2((lower + 0.5) / ${_a}, y));`,` vec4 after = texture2D(u_advanced, vec2((upper + 0.5) / ${_a}, y));`," return mix(before, after, position - lower);","}","vec4 advancedConfig(float index){",` return texture2D(u_advanced, vec2((index + 0.5) / ${_a}, ${rb}));`,"}","vec3 wheelDirection(float hue){"," vec3 direction = hsvToRgb(vec3(fract(hue), 1.0, 1.0));"," direction -= vec3(lumaOf(direction));"," return direction / max(max(max(abs(direction.r), abs(direction.g)), abs(direction.b)), 0.0001);","}","vec3 applyTonalWheels(vec3 color){"," float luma = lumaOf(color);"," float shadows = 1.0 - smoothstep(0.0, 0.6, luma);"," float highlights = smoothstep(0.4, 1.0, luma);"," float midtones = max(0.0, 1.0 - shadows - highlights);"," float total = max(shadows + midtones + highlights, 0.0001);"," vec3 weights = vec3(shadows, midtones, highlights) / total;"," color += wheelDirection(u_shadowWheel.x) * u_shadowWheel.y * weights.x * 0.18;"," color += wheelDirection(u_midtoneWheel.x) * u_midtoneWheel.y * weights.y * 0.18;"," color += wheelDirection(u_highlightWheel.x) * u_highlightWheel.y * weights.z * 0.18;"," color += u_shadowWheel.z * weights.x * 0.25;"," color += u_midtoneWheel.z * weights.y * 0.25;"," color += u_highlightWheel.z * weights.z * 0.25;"," return color;","}","vec3 applyRgbCurves(vec3 color){"," if (u_rgbCurvesEnabled < 0.5) return color;"," vec3 master = vec3("," sampleAdvancedCurve(color.r, 0.0).a,"," sampleAdvancedCurve(color.g, 0.0).a,"," sampleAdvancedCurve(color.b, 0.0).a"," );"," return vec3("," sampleAdvancedCurve(master.r, 0.0).r,"," sampleAdvancedCurve(master.g, 0.0).g,"," sampleAdvancedCurve(master.b, 0.0).b"," );","}","float decodeSigned(float value){ return (value * 255.0 - 128.0) / 127.0; }","vec3 applyHueCurves(vec3 color){"," if (u_hueCurvesEnabled < 0.5) return color;"," vec3 hsv = rgbToHsv(clamp(color, 0.0, 1.0));"," vec3 curves = sampleAdvancedCurve(hsv.x, 1.0).rgb;"," float originalLuma = lumaOf(color);"," hsv.x = fract(hsv.x + decodeSigned(curves.r) * 0.5);"," hsv.y = clamp(hsv.y * max(0.0, 1.0 + decodeSigned(curves.g)), 0.0, 1.0);"," vec3 shifted = hsvToRgb(hsv);"," shifted += vec3(originalLuma - lumaOf(shifted) + decodeSigned(curves.b));"," return shifted;","}","float softRangeMask(float value, float minimum, float maximum, float softness){"," if (value < minimum) {"," if (softness <= 0.0) return 0.0;"," return smoothstep(minimum - softness, minimum, value);"," }"," if (value > maximum) {"," if (softness <= 0.0) return 0.0;"," return 1.0 - smoothstep(maximum, maximum + softness, value);"," }"," return 1.0;","}","float hueRangeMask(float hue, float saturation, vec3 key){"," float distance = abs(fract(hue - key.x + 0.5) - 0.5) * 360.0;"," float range = key.y * 180.0;"," float softness = key.z * 180.0;"," if (range < 179.999 && saturation < 0.001) return 0.0;"," if (distance <= range) return 1.0;"," if (softness <= 0.0) return 0.0;"," return 1.0 - smoothstep(range, range + softness, distance);","}","vec3 applySecondary(vec3 color, float index){"," float base = index * 5.0;"," vec4 hueKey = advancedConfig(base);"," vec4 saturationKey = advancedConfig(base + 1.0);"," vec4 lumaKey = advancedConfig(base + 2.0);"," vec4 correction = advancedConfig(base + 3.0);"," vec4 tintCorrection = advancedConfig(base + 4.0);"," vec3 hsv = rgbToHsv(clamp(color, 0.0, 1.0));"," float luma = lumaOf(color);"," float mask = hueRangeMask(hsv.x, hsv.y, hueKey.rgb);"," mask *= softRangeMask(hsv.y, saturationKey.x, saturationKey.y, saturationKey.z * 0.5);"," mask *= softRangeMask(luma, lumaKey.x, lumaKey.y, lumaKey.z * 0.5);"," if (mask <= 0.0) return color;"," hsv.x = fract(hsv.x + decodeSigned(correction.x) * 0.5);"," vec3 corrected = hsvToRgb(hsv);"," float correctedLuma = lumaOf(corrected);"," corrected = mix(vec3(correctedLuma), corrected, max(0.0, 1.0 + decodeSigned(correction.y)));"," corrected += vec3(decodeSigned(correction.z));"," float temperature = decodeSigned(correction.w);"," float tint = decodeSigned(tintCorrection.x);"," corrected.r += temperature * 0.08 + tint * 0.04;"," corrected.b -= temperature * 0.08 - tint * 0.04;"," corrected.g -= tint * 0.08;"," return mix(color, corrected, mask);","}","vec3 applyAdvancedGrade(vec3 color){"," color = applyTonalWheels(color);"," color = applyRgbCurves(color);"," color = applyHueCurves(color);"," if (u_secondaryCount > 0.5) color = applySecondary(color, 0.0);"," if (u_secondaryCount > 1.5) color = applySecondary(color, 1.0);"," if (u_secondaryCount > 2.5) color = applySecondary(color, 2.0);"," if (u_secondaryCount > 3.5) color = applySecondary(color, 3.0);"," return color;","}","vec3 sampleLut(float r, float g, float b){"," float size = max(u_lutSize, 2.0);"," float x = (r + b * size + 0.5) / max(u_lutTextureSize.x, 1.0);"," float y = (g + 0.5) / max(u_lutTextureSize.y, 1.0);"," return texture2D(u_lut, vec2(x, y)).rgb;","}","vec3 applyLut(vec3 color){"," if (u_lutEnabled < 0.5) return color;"," float size = max(u_lutSize, 2.0);"," vec3 span = max(u_lutDomainMax - u_lutDomainMin, vec3(0.00001));"," vec3 scaled = clamp((color - u_lutDomainMin) / span, 0.0, 1.0) * (size - 1.0);"," vec3 lo = floor(scaled);"," vec3 hi = min(lo + 1.0, vec3(size - 1.0));"," vec3 f = scaled - lo;"," vec3 c000 = sampleLut(lo.r, lo.g, lo.b);"," vec3 c100 = sampleLut(hi.r, lo.g, lo.b);"," vec3 c010 = sampleLut(lo.r, hi.g, lo.b);"," vec3 c110 = sampleLut(hi.r, hi.g, lo.b);"," vec3 c001 = sampleLut(lo.r, lo.g, hi.b);"," vec3 c101 = sampleLut(hi.r, lo.g, hi.b);"," vec3 c011 = sampleLut(lo.r, hi.g, hi.b);"," vec3 c111 = sampleLut(hi.r, hi.g, hi.b);"," vec3 c00 = mix(c000, c100, f.r);"," vec3 c10 = mix(c010, c110, f.r);"," vec3 c01 = mix(c001, c101, f.r);"," vec3 c11 = mix(c011, c111, f.r);"," vec3 c0 = mix(c00, c10, f.g);"," vec3 c1 = mix(c01, c11, f.g);"," vec3 lutColor = mix(c0, c1, f.b);"," return mix(color, lutColor, clamp(u_lutIntensity, 0.0, 1.0));","}","vec3 applyPrimaryGrade(vec3 color){"," color *= pow(2.0, u_exposure);"," float y = lumaOf(color);"," float shadowMask = 1.0 - smoothstep(0.0, 0.65, y);"," float highlightMask = smoothstep(0.35, 1.0, y);"," color += u_shadows * 0.35 * shadowMask;"," color += u_highlights * 0.35 * highlightMask;"," float blackPoint = clamp(u_blacks * 0.18, -0.18, 0.18);"," float whitePoint = clamp(1.0 - u_whites * 0.18, 0.82, 1.18);"," color = (color - blackPoint) / max(whitePoint - blackPoint, 0.2);"," color.r += u_temperature * 0.08 + u_tint * 0.04;"," color.b -= u_temperature * 0.08 - u_tint * 0.04;"," color.g -= u_tint * 0.08;"," color = (color - 0.5) * max(0.0, 1.0 + u_contrast) + 0.5;"," float satLuma = lumaOf(color);"," float currentSat = clamp(colorSaturation(color), 0.0, 1.0);"," float skinLike = smoothstep(0.02, 0.18, color.r - color.g) * smoothstep(0.0, 0.16, color.g - color.b) * smoothstep(0.18, 0.82, satLuma);"," float vibranceWeight = (1.0 - currentSat * 0.72) * mix(1.0, 0.55, skinLike);"," color = mix(vec3(satLuma), color, max(0.0, 1.0 + u_vibrance * vibranceWeight));"," color = mix(vec3(satLuma), color, max(0.0, 1.0 + u_saturation));"," return color;","}","vec3 applyColorGrade(vec3 color){"," color = applyPrimaryGrade(color);"," color = applyAdvancedGrade(color);"," return clamp(applyLut(clamp(color, 0.0, 1.0)), 0.0, 1.0);","}","vec3 applyDither(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float scale = max(min(u_resolution.x, u_resolution.y) / 540.0, 0.25);"," float pixelSize = mix(1.0, 5.0, clamp(u_ditherSize, 0.0, 1.0)) * scale;"," vec2 block = floor(gl_FragCoord.xy / max(pixelSize, 1.0));"," float levels = clamp(u_paletteSize, 2.0, 6.0);"," float index = floor(clamp(lumaOf(source) * (levels - 1.0) + bayer4(block), 0.0, levels - 1.0));"," return mix(source, paletteColor(index), amount);","}","vec2 asciiEdgeDirection(vec2 uv, vec2 stepUv){"," float topLeft = bt601Luma(sampleMedia(uv + vec2(-stepUv.x, -stepUv.y)).rgb);"," float top = bt601Luma(sampleMedia(uv + vec2(0.0, -stepUv.y)).rgb);"," float topRight = bt601Luma(sampleMedia(uv + vec2(stepUv.x, -stepUv.y)).rgb);"," float left = bt601Luma(sampleMedia(uv + vec2(-stepUv.x, 0.0)).rgb);"," float right = bt601Luma(sampleMedia(uv + vec2(stepUv.x, 0.0)).rgb);"," float bottomLeft = bt601Luma(sampleMedia(uv + vec2(-stepUv.x, stepUv.y)).rgb);"," float bottom = bt601Luma(sampleMedia(uv + vec2(0.0, stepUv.y)).rgb);"," float bottomRight = bt601Luma(sampleMedia(uv + stepUv).rgb);"," float x = -topLeft - 2.0 * left - bottomLeft + topRight + 2.0 * right + bottomRight;"," float y = -topLeft - 2.0 * top - topRight + bottomLeft + 2.0 * bottom + bottomRight;"," return vec2(x, y);","}","vec2 rotateAsciiUv(vec2 uv, float angle){"," float cosine = cos(angle);"," float sine = sin(angle);"," vec2 centered = uv - 0.5;"," return vec2(centered.x * cosine - centered.y * sine, centered.x * sine + centered.y * cosine) + 0.5;","}","vec3 applyAscii(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float scale = max(min(u_resolution.x, u_resolution.y) / 540.0, 0.25);"," float cellHeight = mix(4.0, 80.0, clamp(u_asciiSize, 0.0, 1.0)) * scale;"," vec2 cellSize = vec2(cellHeight);"," vec2 cell = floor(gl_FragCoord.xy / cellSize);"," vec2 cellVuv = (cell + 0.5) * cellSize / max(u_resolution, vec2(1.0));"," vec2 cellUv = (cellVuv - u_uvOffset) / u_uvScale;"," cellUv = applyCrtWarp(cellUv);"," vec3 cellColor = applyColorGrade(sampleMedia(cellUv).rgb);"," float brightness = bt601Luma(cellColor);"," float invert = step(0.5, u_asciiInvert);"," brightness = mix(brightness, 1.0 - brightness, invert);"," vec2 glyphUv = fract(gl_FragCoord.xy / cellSize);"," float rotation = clamp(u_asciiRotation, 0.0, 1.0);"," if (rotation > 0.0) {"," vec2 cellStepUv = cellSize / max(u_resolution * u_uvScale, vec2(1.0));"," vec2 edge = asciiEdgeDirection(cellUv, cellStepUv);"," if (length(edge) > 0.1) glyphUv = mix(glyphUv, rotateAsciiUv(glyphUv, atan(edge.y, edge.x)), rotation);"," }"," float ink = asciiStyleSample(floor(u_asciiStyle + 0.5), brightness, glyphUv);"," vec3 background = paletteColor(0.0);"," vec3 inkColor = mix(paletteColor(max(u_paletteSize - 1.0, 1.0)), cellColor, clamp(u_asciiColor, 0.0, 1.0));"," vec3 asciiColor = mix(background, inkColor, ink);"," return mix(source, asciiColor, amount);","}","vec3 applyScanlines(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float count = mix(50.0, 500.0, clamp(u_scanlineCount, 0.0, 1.0));"," float softness = clamp(u_scanlineSoftness, 0.0, 1.0);"," float wave = 0.5 + 0.5 * sin(v_uv.y * count * PI);"," float line = mix(1.0 - wave, pow(1.0 - wave, 2.2), softness);"," return source * (1.0 - line * amount);","}","void main(){"," vec2 uv = (v_uv - u_uvOffset) / u_uvScale;"," if (uv.x < 0.0 || uv.y < 0.0 || uv.x > 1.0 || uv.y > 1.0) {"," gl_FragColor = vec4(0.0);"," return;"," }"," vec4 originalSample = sampleSource(uv);"," uv = applyCrtWarp(uv);"," vec2 displayEdge = smoothstep(vec2(0.0), vec2(0.006), uv) * (1.0 - smoothstep(vec2(0.994), vec2(1.0), uv));"," float displayMask = displayEdge.x * displayEdge.y;"," vec4 sampleColor = sampleMedia(uv);"," sampleColor = sampleChromaticMedia(uv, sampleColor);"," sampleColor.rgb = applyDigitalGlitch(uv, sampleColor.rgb);"," vec3 original = originalSample.rgb;"," vec3 color = mix(sampleColor.rgb, applyColorGrade(sampleColor.rgb), u_intensity);"," float grainAmount = clamp(u_grain, 0.0, 1.0);"," if (grainAmount > 0.0) {"," float grainPixelSize = mix(1.0, 6.0, clamp(u_grainSize, 0.0, 1.0));"," vec2 grainCoord = floor(gl_FragCoord.xy / grainPixelSize) + vec2(u_grainSeed, u_grainSeed * 1.37);"," float grainBase = grainHash(grainCoord) - grainHash(grainCoord + vec2(19.19, 73.31));"," float grainFine = grainHash(gl_FragCoord.xy + vec2(u_grainSeed * 2.11, u_grainSeed * 0.71)) - 0.5;"," float grain = mix(grainBase * 0.7, grainBase + grainFine * 0.35, clamp(u_grainRoughness, 0.0, 1.0));"," float grainLuma = lumaOf(color);"," float grainMask = smoothstep(0.02, 0.55, grainLuma) * (1.0 - smoothstep(0.88, 1.0, grainLuma));"," color += grain * grainAmount * mix(0.025, 0.08, grainMask);"," }"," float filmArtifacts = clamp(u_filmArtifacts, 0.0, 1.0);"," if (filmArtifacts > 0.0) {"," float filmFrame = floor(u_grainSeed);"," float dust = dustMask(v_uv, floor(filmFrame / 3.0));"," float dustTone = grainHash(vec2(floor(filmFrame / 3.0), 8.0));"," color = mix(color, vec3(dustTone > 0.5 ? 0.95 : 0.02), dust * 0.72 * filmArtifacts);"," float scratchBucket = floor(filmFrame / 12.0);"," float scratchX = grainHash(vec2(scratchBucket, 4.2));"," float scratchLife = step(0.78, grainHash(vec2(scratchBucket, 8.4)));"," float scratch = (1.0 - smoothstep(0.0, 1.4 / max(u_resolution.x, 1.0), abs(v_uv.x - scratchX))) * scratchLife;"," color = mix(color, vec3(0.94, 0.88, 0.76), scratch * 0.28 * filmArtifacts);"," }"," color = applyMonoScreen(clamp(color, 0.0, 1.0), clamp(u_monoScreen, 0.0, 1.0));"," color = applyEngraving(clamp(color, 0.0, 1.0), clamp(u_engraving, 0.0, 1.0));"," color = applyCrosshatch(uv, clamp(color, 0.0, 1.0), clamp(u_crosshatch, 0.0, 1.0));"," color = applyHalftone(clamp(color, 0.0, 1.0), clamp(u_halftone, 0.0, 1.0));"," color = applyTwoInkPrint(clamp(color, 0.0, 1.0), clamp(u_twoInkPrint, 0.0, 1.0));"," color = applyDither(clamp(color, 0.0, 1.0), clamp(u_dither, 0.0, 1.0));"," color = applyAscii(clamp(color, 0.0, 1.0), clamp(u_ascii, 0.0, 1.0));"," if (u_bloomReady > 0.5 && u_bloom > 0.0) color += sampleBloom(uv) * u_bloom;"," color = applyScanlines(clamp(color, 0.0, 1.0), clamp(u_scanlines, 0.0, 1.0));"," vec2 vignetteAspect = u_resolution.x > u_resolution.y"," ? vec2(u_resolution.x / max(u_resolution.y, 1.0), 1.0)"," : vec2(1.0, u_resolution.y / max(u_resolution.x, 1.0));"," vec2 vignetteUv = abs((v_uv - vec2(0.5)) * 2.0) * vignetteAspect;"," float vignettePower = mix(8.0, 1.8, clamp(u_vignetteRoundness * 0.5 + 0.5, 0.0, 1.0));"," float vignetteDistance = pow(pow(vignetteUv.x, vignettePower) + pow(vignetteUv.y, vignettePower), 1.0 / vignettePower);"," float vignetteMidpoint = mix(0.22, 1.08, clamp(u_vignetteMidpoint, 0.0, 1.0));"," float vignetteFeather = mix(0.08, 0.72, clamp(u_vignetteFeather, 0.0, 1.0));"," float vignetteMask = smoothstep(vignetteMidpoint, vignetteMidpoint + vignetteFeather, vignetteDistance);"," color *= 1.0 - vignetteMask * clamp(u_vignette, 0.0, 1.0) * 0.75;"," float warpActive = step(0.0001, u_crtCurvature);"," color *= mix(1.0, displayMask, warpActive);"," vec3 graded = clamp(color, 0.0, 1.0);"," if (u_compareEnabled > 0.5) {"," float pos = clamp(u_comparePosition, 0.0, 1.0);"," float softness = max(u_compareSoftness, 0.00001);"," float afterMask = smoothstep(pos - softness, pos + softness, v_uv.x);"," vec3 splitColor = mix(original, graded, afterMask);"," float lineMask = 0.0;"," if (u_compareLineWidth > 0.0) {"," float lineWidth = max(u_compareLineWidth / max(u_resolution.x, 1.0), 0.00001);"," lineMask = 1.0 - smoothstep(lineWidth, lineWidth * 1.8, abs(v_uv.x - pos));"," }"," gl_FragColor = vec4(mix(splitColor, vec3(1.0), lineMask * 0.82), sampleColor.a);"," return;"," }"," gl_FragColor = vec4(graded, sampleColor.a);","}"].join(`\n`),ab=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_source;","uniform vec2 u_resolution;","uniform vec2 u_direction;","uniform float u_radius;","uniform float u_bloomPass;","uniform float u_threshold;","vec4 readSource(vec2 uv){"," vec4 color = texture2D(u_source, clamp(uv, vec2(0.0), vec2(1.0)));"," if (u_bloomPass > 0.5) {"," float luminance = dot(color.rgb, vec3(0.299, 0.587, 0.114));"," if (u_threshold >= 0.0 && luminance <= u_threshold) color.rgb = vec3(0.0);"," return vec4(color.rgb, 1.0);"," }"," color.rgb *= color.a;"," return color;","}","void main(){"," if (u_bloomPass > 0.5) {"," vec2 stepUv = u_direction * max(u_radius, 0.0) / max(u_resolution, vec2(1.0)) * 0.5;"," vec4 bloom = readSource(v_uv) * 0.227027;"," bloom += readSource(v_uv + stepUv) * 0.1945946;"," bloom += readSource(v_uv - stepUv) * 0.1945946;"," bloom += readSource(v_uv + stepUv * 2.0) * 0.1216216;"," bloom += readSource(v_uv - stepUv * 2.0) * 0.1216216;"," bloom += readSource(v_uv + stepUv * 3.0) * 0.054054;"," bloom += readSource(v_uv - stepUv * 3.0) * 0.054054;"," bloom += readSource(v_uv + stepUv * 4.0) * 0.016216;"," bloom += readSource(v_uv - stepUv * 4.0) * 0.016216;"," gl_FragColor = bloom;"," return;"," }"," vec2 stepUv = u_direction * max(u_radius, 0.0) / max(u_resolution, vec2(1.0)) / 12.0;"," vec4 color = readSource(v_uv) * 0.08077993;"," color += readSource(v_uv + stepUv * 1.0) * 0.07918038;"," color += readSource(v_uv - stepUv * 1.0) * 0.07918038;"," color += readSource(v_uv + stepUv * 2.0) * 0.07456928;"," color += readSource(v_uv - stepUv * 2.0) * 0.07456928;"," color += readSource(v_uv + stepUv * 3.0) * 0.06747307;"," color += readSource(v_uv - stepUv * 3.0) * 0.06747307;"," color += readSource(v_uv + stepUv * 4.0) * 0.05865827;"," color += readSource(v_uv - stepUv * 4.0) * 0.05865827;"," color += readSource(v_uv + stepUv * 5.0) * 0.04899551;"," color += readSource(v_uv - stepUv * 5.0) * 0.04899551;"," color += readSource(v_uv + stepUv * 6.0) * 0.03931982;"," color += readSource(v_uv - stepUv * 6.0) * 0.03931982;"," color += readSource(v_uv + stepUv * 7.0) * 0.03031761;"," color += readSource(v_uv - stepUv * 7.0) * 0.03031761;"," color += readSource(v_uv + stepUv * 8.0) * 0.02245983;"," color += readSource(v_uv - stepUv * 8.0) * 0.02245983;"," color += readSource(v_uv + stepUv * 9.0) * 0.01598624;"," color += readSource(v_uv - stepUv * 9.0) * 0.01598624;"," color += readSource(v_uv + stepUv * 10.0) * 0.01093238;"," color += readSource(v_uv - stepUv * 10.0) * 0.01093238;"," color += readSource(v_uv + stepUv * 11.0) * 0.00718308;"," color += readSource(v_uv - stepUv * 11.0) * 0.00718308;"," color += readSource(v_uv + stepUv * 12.0) * 0.00453456;"," color += readSource(v_uv - stepUv * 12.0) * 0.00453456;"," if (color.a > 0.0001) color.rgb /= color.a;"," gl_FragColor = color;","}"].join(`\n`),sb=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_source;","uniform sampler2D u_blurSource;","uniform vec2 u_texel;","uniform vec2 u_uvScale;","uniform vec2 u_uvOffset;","uniform float u_blurReady;","uniform float u_blur;","uniform float u_kuwaharaRadius;","vec3 readPrepared(vec2 displayUv){"," vec2 uv = (displayUv - u_uvOffset) / u_uvScale;"," vec3 color = texture2D(u_source, clamp(uv, vec2(0.0), vec2(1.0))).rgb;"," if (u_blurReady > 0.5 && u_blur > 0.0) {"," vec3 blurred = texture2D(u_blurSource, clamp(uv, vec2(0.0), vec2(1.0))).rgb;"," color = mix(color, blurred, clamp(u_blur, 0.0, 1.0));"," }"," return color;","}","void main(){"," float radius = floor(mix(2.0, 16.0, clamp(u_kuwaharaRadius, 0.0, 1.0)) + 0.5);"," vec3 sum = vec3(0.0);"," float sumSquares = 0.0;"," float count = 0.0;"," for (int offset = 0; offset <= 16; offset++) {"," if (float(offset) > radius) continue;"," vec3 color = readPrepared(v_uv + vec2(float(offset), 0.0) * u_texel);"," sum += color;"," sumSquares += dot(color, color) / 3.0;"," count += 1.0;"," }"," gl_FragColor = vec4(sum / count, sumSquares / count);","}"].join(`\n`),lb=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_kuwaharaMoments;","uniform vec2 u_texel;","uniform float u_kuwaharaRadius;","uniform float u_kuwaharaSharpness;","uniform float u_kuwaharaSaturation;","void main(){"," float radius = floor(mix(2.0, 16.0, clamp(u_kuwaharaRadius, 0.0, 1.0)) + 0.5);"," vec2 origins[4];"," origins[0] = vec2(-radius, -radius);"," origins[1] = vec2(0.0, -radius);"," origins[2] = vec2(-radius, 0.0);"," origins[3] = vec2(0.0, 0.0);"," vec3 means[4];"," float variances[4];"," float minVariance = 1.0;"," for (int quadrant = 0; quadrant < 4; quadrant++) {"," vec4 moment = vec4(0.0);"," float count = 0.0;"," for (int offset = 0; offset <= 16; offset++) {"," if (float(offset) > radius) continue;"," vec2 sampleOffset = origins[quadrant] + vec2(0.0, float(offset));"," moment += texture2D(u_kuwaharaMoments, clamp(v_uv + sampleOffset * u_texel, vec2(0.0), vec2(1.0)));"," count += 1.0;"," }"," moment /= count;"," vec3 mean = moment.rgb;"," float meanSquare = moment.a * 3.0;"," float variance = max(meanSquare - dot(mean, mean), 0.0);"," means[quadrant] = mean;"," variances[quadrant] = variance;"," minVariance = min(minVariance, variance);"," }"," float exponent = 1.0 + clamp(u_kuwaharaSharpness, 0.0, 1.0) * 8.0;"," vec3 result = vec3(0.0);"," float totalWeight = 0.0;"," for (int quadrant = 0; quadrant < 4; quadrant++) {"," float weight = pow((minVariance + 0.0001) / (variances[quadrant] + 0.0001), exponent);"," result += means[quadrant] * weight;"," totalWeight += weight;"," }"," result /= max(totalWeight, 0.0001);"," float luma = dot(result, vec3(0.2126, 0.7152, 0.0722));"," float saturation = clamp(u_kuwaharaSaturation, 0.0, 1.0) * 2.0;"," gl_FragColor = vec4(clamp(mix(vec3(luma), result, saturation), 0.0, 1.0), 1.0);","}"].join(`\n`);function Ft(e){return e instanceof HTMLVideoElement||e instanceof HTMLImageElement}function ud(e){let t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function cd(e,t,n){let r=e.createShader(n);return r?(e.shaderSource(r,t),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(L("runtime.colorGrading.compileShader",e.getShaderInfoLog(r)),e.deleteShader(r),null)):null}function pi(e,t=ob){let n=cd(e,ib,e.VERTEX_SHADER),r=cd(e,t,e.FRAGMENT_SHADER);if(!n||!r)return n&&e.deleteShader(n),r&&e.deleteShader(r),null;let i=e.createProgram();return i?(e.attachShader(i,n),e.attachShader(i,r),e.linkProgram(i),e.deleteShader(n),e.deleteShader(r),e.getProgramParameter(i,e.LINK_STATUS)?i:(L("runtime.colorGrading.linkProgram",e.getProgramInfoLog(i)),e.deleteProgram(i),null)):null}function ci(e,t=e.LINEAR,n=e.UNSIGNED_BYTE){let r=e.createTexture();return r?(e.bindTexture(e.TEXTURE_2D,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,n,null),r):null}function ub(e,t){let n=pi(e,ab);return n?{program:n,quad:t,position:e.getAttribLocation(n,"a_pos"),source:e.getUniformLocation(n,"u_source"),resolution:e.getUniformLocation(n,"u_resolution"),direction:e.getUniformLocation(n,"u_direction"),radius:e.getUniformLocation(n,"u_radius"),bloomPass:e.getUniformLocation(n,"u_bloomPass"),threshold:e.getUniformLocation(n,"u_threshold")}:null}function cb(e,t){let n=pi(e,sb);return n?{program:n,quad:t,position:e.getAttribLocation(n,"a_pos"),source:e.getUniformLocation(n,"u_source"),blurSource:e.getUniformLocation(n,"u_blurSource"),texel:e.getUniformLocation(n,"u_texel"),uvScale:e.getUniformLocation(n,"u_uvScale"),uvOffset:e.getUniformLocation(n,"u_uvOffset"),blurReady:e.getUniformLocation(n,"u_blurReady"),blur:e.getUniformLocation(n,"u_blur"),radius:e.getUniformLocation(n,"u_kuwaharaRadius")}:null}function db(e,t){let n=pi(e,lb);return n?{program:n,quad:t,position:e.getAttribLocation(n,"a_pos"),moments:e.getUniformLocation(n,"u_kuwaharaMoments"),texel:e.getUniformLocation(n,"u_texel"),radius:e.getUniformLocation(n,"u_kuwaharaRadius"),sharpness:e.getUniformLocation(n,"u_kuwaharaSharpness"),saturation:e.getUniformLocation(n,"u_kuwaharaSaturation")}:null}function nr(e,t=e.UNSIGNED_BYTE,n=e.LINEAR){let r=ci(e,n,t),i=e.createFramebuffer();if(!r||!i)return r&&e.deleteTexture(r),i&&e.deleteFramebuffer(i),null;e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0);let o=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),o!==e.FRAMEBUFFER_COMPLETE?(e.deleteTexture(r),e.deleteFramebuffer(i),null):{texture:r,framebuffer:i,type:t,width:1,height:1}}function fi(e,t,n,r){t.width===n&&t.height===r||(t.width=n,t.height=r,e.bindTexture(e.TEXTURE_2D,t.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,r,0,e.RGBA,t.type,null))}function Ta(e,t,n){let r=[];for(let i of n){let o=e.getUniformLocation(t,`u_${i}`);o!==null&&r.push([i,o])}return r}function dd(e,t,n){t&&e.deleteProgram(t);for(let r of n)r&&e.deleteTexture(r)}function Fa(e){let t=e.getContext("webgl",{alpha:!0,premultipliedAlpha:!1});if(!t)return null;let n=pi(t),r=ci(t),i=ci(t,t.NEAREST),o=ci(t,t.NEAREST);if(!n||!r||!i||!o)return dd(t,n,[r,i,o]),null;let a=t.createBuffer();return a?(t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),t.STATIC_DRAW),{gl:t,program:{program:n,texture:r,lutTexture:i,advancedTexture:o,advancedSignature:null,quad:a,position:t.getAttribLocation(n,"a_pos"),source:t.getUniformLocation(n,"u_source"),blurSource:t.getUniformLocation(n,"u_blurSource"),bloomSource:t.getUniformLocation(n,"u_bloomSource"),kuwaharaSource:t.getUniformLocation(n,"u_kuwaharaSource"),lut:t.getUniformLocation(n,"u_lut"),advanced:t.getUniformLocation(n,"u_advanced"),resolution:t.getUniformLocation(n,"u_resolution"),uvScale:t.getUniformLocation(n,"u_uvScale"),uvOffset:t.getUniformLocation(n,"u_uvOffset"),blurReady:t.getUniformLocation(n,"u_blurReady"),bloomReady:t.getUniformLocation(n,"u_bloomReady"),kuwaharaReady:t.getUniformLocation(n,"u_kuwaharaReady"),lutEnabled:t.getUniformLocation(n,"u_lutEnabled"),lutSize:t.getUniformLocation(n,"u_lutSize"),lutTextureSize:t.getUniformLocation(n,"u_lutTextureSize"),lutDomainMin:t.getUniformLocation(n,"u_lutDomainMin"),lutDomainMax:t.getUniformLocation(n,"u_lutDomainMax"),lutIntensity:t.getUniformLocation(n,"u_lutIntensity"),shadowWheel:t.getUniformLocation(n,"u_shadowWheel"),midtoneWheel:t.getUniformLocation(n,"u_midtoneWheel"),highlightWheel:t.getUniformLocation(n,"u_highlightWheel"),rgbCurvesEnabled:t.getUniformLocation(n,"u_rgbCurvesEnabled"),hueCurvesEnabled:t.getUniformLocation(n,"u_hueCurvesEnabled"),secondaryCount:t.getUniformLocation(n,"u_secondaryCount"),adjustUniforms:Ta(t,n,Br),detailUniforms:Ta(t,n,wo),effectUniforms:Ta(t,n,Co),grainSeed:t.getUniformLocation(n,"u_grainSeed"),effectTime:t.getUniformLocation(n,"u_effectTime"),paletteSize:t.getUniformLocation(n,"u_paletteSize"),palette0:t.getUniformLocation(n,"u_palette0"),palette1:t.getUniformLocation(n,"u_palette1"),palette2:t.getUniformLocation(n,"u_palette2"),palette3:t.getUniformLocation(n,"u_palette3"),palette4:t.getUniformLocation(n,"u_palette4"),palette5:t.getUniformLocation(n,"u_palette5"),intensity:t.getUniformLocation(n,"u_intensity"),compareEnabled:t.getUniformLocation(n,"u_compareEnabled"),comparePosition:t.getUniformLocation(n,"u_comparePosition"),compareSoftness:t.getUniformLocation(n,"u_compareSoftness"),compareLineWidth:t.getUniformLocation(n,"u_compareLineWidth")}}):(dd(t,n,[r,i,o]),null)}function fb(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function mb(e){if(!fb(e))return{...tn};let t=(n,r,i,o)=>{let a=typeof n=="number"?n:Number(n);return Math.min(o,Math.max(i,Number.isFinite(a)?a:r))};return{enabled:e.enabled===!0,position:t(e.position,tn.position,0,1),softness:t(e.softness,tn.softness,0,.25),lineWidth:t(e.lineWidth,tn.lineWidth,0,12)}}function yd(e){try{let t=new URL(e,document.baseURI);return t.protocol==="data:"?{href:t.href}:t.protocol!=="http:"&&t.protocol!=="https:"?{error:"LUT must be project-local or a data URL"}:t.origin!==window.location.origin?{error:"Remote LUT URLs are not supported"}:{href:t.href}}catch{return{error:"Invalid LUT URL"}}}function hi(e){return e instanceof Error?e.message:"LUT failed to load"}function pb(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0)%1e4}function vd(e){let t=e.id||e.currentSrc||e.getAttribute("src")||`${e.tagName}:${Array.prototype.indexOf.call(e.parentNode?.children??[],e)}`;return pb(t)}function Na(e){let t=yd(e);if("error"in t)return{state:"error",message:t.error};let n=rt.get(t.href);if(n)return n;let r=fetch(t.href,{credentials:"same-origin"}).then(o=>{if(!o.ok)throw new Error(`Failed to load LUT (${o.status})`);return o.text()}).then(o=>kl(o,{maxSize:Pr})),i={state:"pending",promise:r};for(;rt.size>=Jg;){let o=rt.keys().next().value;if(!o)break;rt.delete(o)}return rt.set(t.href,i),r.then(o=>{rt.get(t.href)===i&&rt.set(t.href,{state:"ready",lut:o})},o=>{rt.get(t.href)===i&&rt.set(t.href,{state:"error",message:hi(o)})}),i}function fd(e,t,n){if(e.lut?.src===t)return e.lut;let r=ho(n),{gl:i,program:o}=e;try{return Sd(i,o.lutTexture,r),e.lut={src:t,size:n.size,domainMin:n.domainMin,domainMax:n.domainMax,textureWidth:r.width,textureHeight:r.height},e.lutError=null,e.lutLoadingSrc=null,e.lut}catch(a){return e.lut=null,e.lutError=hi(a),e.lutLoadingSrc=null,L("runtime.colorGrading.uploadLut",a),null}}async function hb(e){let t=Na(e);if(t.state==="ready")return t.lut;if(t.state==="pending")return t.promise;throw new Error(t.message)}function Sd(e,t,n){e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data)}function gb(e,t,n){let r=ho(n),{gl:i,program:o}=e;return Sd(i,o.lutTexture,r),{src:t,size:n.size,domainMin:n.domainMin,domainMax:n.domainMax,textureWidth:r.width,textureHeight:r.height}}function Je(e,t){e.deleteTexture(t.texture),e.deleteFramebuffer(t.framebuffer)}function La(e){let t=e.effectTargets;t&&(e.gl.deleteProgram(t.blurProgram.program),Je(e.gl,t.scratch),Je(e.gl,t.blur),t.bloom&&Je(e.gl,t.bloom),e.effectTargets=null)}function Da(e){let t=e.kuwaharaTargets;t&&(e.gl.deleteProgram(t.horizontalProgram.program),e.gl.deleteProgram(t.resolveProgram.program),Je(e.gl,t.moments),Je(e.gl,t.output),e.kuwaharaTargets=null)}function di(e,t=!1){La(e),Da(e),bb(e.gl,e.program),t&&e.gl.getExtension("WEBGL_lose_context")?.loseContext()}function bb(e,t){e.deleteTexture(t.texture),e.deleteTexture(t.lutTexture),e.deleteTexture(t.advancedTexture),e.deleteBuffer(t.quad),e.deleteProgram(t.program)}function xb(e){let t=Fa(e.canvas);return t?(di(e),e.gl=t.gl,e.program=t.program,e.lut=null,e.lutLoadingSrc=null,e.lutError=null,e.effectError=null,!0):!1}function Ma(e){if(!e.sourceHidden)return;e.element.removeAttribute(Mn);let t=e.element.style.getPropertyValue("opacity"),n=e.element.style.getPropertyPriority("opacity");t==="0"&&n==="important"&&(e.sourceInlineOpacity===null?e.element.style.removeProperty("opacity"):e.element.style.setProperty("opacity",e.sourceInlineOpacity,e.sourceInlineOpacityPriority)),e.sourceHidden=!1}function yb(e){if(e.effectTargets)return e.effectTargets;let{gl:t}=e,n=ub(t,e.program.quad),r=nr(t),i=nr(t);return!n||!r||!i?(n&&t.deleteProgram(n.program),r&&Je(t,r),i&&Je(t,i),e.effectError="Framebuffer effects unavailable",null):(e.effectError=null,e.effectTargets={blurProgram:n,scratch:r,blur:i,bloom:null},e.effectTargets)}function vb(e,t){return t.bloom||(t.bloom=nr(e.gl),e.effectError=t.bloom?null:"Framebuffer effects unavailable"),t.bloom}function md(e){let t=e.effectTargets;t?.bloom&&(Je(e.gl,t.bloom),t.bloom=null)}function Sb(e){if(e.kuwaharaTargets)return e.kuwaharaTargets;let{gl:t}=e,n=t.getExtension("OES_texture_half_float"),r=t.getExtension("EXT_color_buffer_half_float");if(!n||!r)return e.effectError="Kuwahara requires half-float framebuffer support",null;let i=cb(t,e.program.quad),o=db(t,e.program.quad),a=nr(t,n.HALF_FLOAT_OES,t.NEAREST),l=nr(t);return!i||!o||!a||!l?(Ab(t,i,o,a,l),e.effectError="Kuwahara framebuffer effects unavailable",null):(e.kuwaharaTargets={horizontalProgram:i,resolveProgram:o,moments:a,output:l},e.kuwaharaTargets)}function Ab(e,t,n,r,i){t&&e.deleteProgram(t.program),n&&e.deleteProgram(n.program),r&&Je(e,r),i&&Je(e,i)}function Ad(e,t,n,r,i){let o=Math.max(1,Math.ceil(r)),a=Math.max(1,Math.ceil(i));return fi(e,t,o,a),fi(e,n,o,a),{width:o,height:a}}function mi(e,t,n,r,i,o,a,l=!1,s=-1){e.bindFramebuffer(e.FRAMEBUFFER,r.framebuffer),e.viewport(0,0,i.width,i.height),e.useProgram(t.program),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,n),e.uniform1i(t.source,0),e.uniform2f(t.resolution,i.width,i.height),e.uniform2f(t.direction,o.x,o.y),e.uniform1f(t.radius,a),e.uniform1f(t.bloomPass,l?1:0),e.uniform1f(t.threshold,s),rr(e,t)}function Eb(e,t,n,r,i,o,a){let l=Ad(e,t.scratch,r,i/2,o/2),s=a/2;mi(e,t.blurProgram,n,t.scratch,l,{x:1,y:0},s,!0,.5),mi(e,t.blurProgram,t.scratch.texture,r,l,{x:0,y:1},s,!0)}function wb(e,t,n,r,i,o,a){let l=n;for(let s=0;s<Math.max(1,Math.floor(a));s++)mi(e,t.blurProgram,l,t.scratch,i,{x:1,y:0},o),mi(e,t.blurProgram,t.scratch.texture,r,i,{x:0,y:1},o),l=r.texture}function rr(e,t){e.bindBuffer(e.ARRAY_BUFFER,t.quad),e.enableVertexAttribArray(t.position),e.vertexAttribPointer(t.position,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLE_STRIP,0,4)}function Cb(e,t,n,r,i,o,a,l){fi(e,t.moments,i.width,i.height),fi(e,t.output,i.width,i.height);let s=t.horizontalProgram;e.bindFramebuffer(e.FRAMEBUFFER,t.moments.framebuffer),e.viewport(0,0,i.width,i.height),e.useProgram(s.program),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,n),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,r),e.uniform1i(s.source,0),e.uniform1i(s.blurSource,1),e.uniform2f(s.texel,1/i.width,1/i.height),e.uniform2f(s.uvScale,o.scaleX,o.scaleY),e.uniform2f(s.uvOffset,o.offsetX,o.offsetY),e.uniform1f(s.blurReady,a?1:0),e.uniform1f(s.blur,l.blur),e.uniform1f(s.radius,l.kuwaharaRadius),rr(e,s);let u=t.resolveProgram;e.bindFramebuffer(e.FRAMEBUFFER,t.output.framebuffer),e.useProgram(u.program),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t.moments.texture),e.uniform1i(u.moments,0),e.uniform2f(u.texel,1/i.width,1/i.height),e.uniform1f(u.radius,l.kuwaharaRadius),e.uniform1f(u.sharpness,l.kuwaharaSharpness),e.uniform1f(u.saturation,l.kuwaharaSaturation),rr(e,u)}function _b(e,t,n,r){if(n<=0)return!1;let i=Ad(e.gl,t.scratch,t.blur,r.width,r.height);return wb(e.gl,t,e.program.texture,t.blur,i,.75+Math.pow(n,1.35)*32,n>.55?3:2),!0}function Tb(e,t,n,r,i,o){if(n<=0)return md(e),null;o||md(e);let a=o?vb(e,t):t.blur;return a?(Eb(e.gl,t,e.program.texture,a,i.width,i.height,r),a.texture):null}function Rb(e,t,n,r){let{program:i}=e,o=t.effects.blur,a=t.effects.bloom;if(o<=0&&a<=0)return e.effectTargets&&r&&La(e),{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let l=yb(e);if(!l)return{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let s=_b(e,l,o,n),u=Tb(e,l,a,t.effects.bloomRadius,n,s);return{blurReady:s,bloomReady:u!==null,blurTexture:l.blur.texture,bloomTexture:u??i.texture}}function kb(e,t,n,r,i,o,a){let l=t.effects.kuwahara;if(l<=0&&!o)return e.kuwaharaTargets&&a&&Da(e),{kuwaharaReady:!1,kuwaharaTexture:e.program.texture};let s=Sb(e);return!s||l<=0?{kuwaharaReady:!1,kuwaharaTexture:s?.output.texture??e.program.texture}:(Cb(e.gl,s,e.program.texture,e.effectTargets?.blur.texture??e.program.texture,n,r,i,t.effects),{kuwaharaReady:!0,kuwaharaTexture:s.output.texture})}function Ed(e,t,n,r,i={}){let o=i.releaseIdleTargets??!0;e.effectError=null;let a=Rb(e,t,n,o),l=kb(e,t,n,r,a.blurReady,i.preserveKuwahara??!1,o);return{...a,...l}}function Mb(e){let t=e.grading.lut?.src.trim()??"",n=e.grading.lut?.intensity??1;if(!t||n<=0)return e.lut=null,e.lutLoadingSrc=null,e.lutError=null,null;let r=yd(t);if("error"in r)return e.lut=null,e.lutLoadingSrc=null,e.lutError=r.error,null;if(e.lut?.src===r.href)return e.lut;e.lut=null;let i=Na(t);return i.state==="ready"?fd(e,r.href,i.lut):i.state==="error"?(e.lutError=i.message,e.lutLoadingSrc=null,null):(e.lutLoadingSrc!==r.href&&(e.lutLoadingSrc=r.href,e.lutError=null,i.promise.then(o=>{e.destroyed||e.grading.lut?.src.trim()!==t||(fd(e,r.href,o),De(e))},o=>{e.destroyed||e.grading.lut?.src.trim()!==t||(e.lut=null,e.lutError=hi(o),e.lutLoadingSrc=null,De(e))})),null)}function er(e){if(!e)return null;if(typeof e=="string"){let t=e.trim();if(!t)return null;let n=document.getElementById(t.replace(/^#/,""));if(n&&Ft(n))return n;try{let r=document.querySelector(t);return r&&Ft(r)?r:null}catch{return null}}if(e.hfId){let t=document.querySelector(`[data-hf-id="${CSS.escape(e.hfId)}"]`);if(t&&Ft(t))return t}if(e.id){let t=document.getElementById(e.id);if(t&&Ft(t))return t}if(!e.selector)return null;try{let t=Array.from(document.querySelectorAll(e.selector)),n=Math.max(0,Math.floor(Number(e.selectorIndex??0)||0)),r=t[n]??null;return r&&Ft(r)?r:null}catch{return null}}function wd(e){return e instanceof HTMLVideoElement?e.videoWidth>0&&e.videoHeight>0?{width:e.videoWidth,height:e.videoHeight}:null:e instanceof HTMLImageElement&&e.naturalWidth>0&&e.naturalHeight>0?{width:e.naturalWidth,height:e.naturalHeight}:null}function Cd(e){return e instanceof HTMLVideoElement?e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&e.videoWidth>0&&e.videoHeight>0:e instanceof HTMLImageElement?e.complete&&e.naturalWidth>0&&e.naturalHeight>0:!1}function _d(e){let t=lt(e);return t&&Cd(t)?t:null}function pd(e){if(!(e instanceof HTMLVideoElement))return!1;let t=_d(e);if(!t)return!1;let n=window.getComputedStyle(t);return n.display!=="none"&&n.visibility!=="hidden"}function Fb(e){return e instanceof HTMLImageElement&&e.classList.contains("__render_frame__")}function Nb(e,t){t.parentNode&&t.nextSibling!==e.canvas&&t.parentNode.insertBefore(e.canvas,t.nextSibling)}function Td(e){if(e instanceof HTMLVideoElement){let t=_d(e);if(t)return t}return Cd(e)?e:null}function hd(e,t){let n=e.toLowerCase();if(n==="center")return .5;if(t==="x"){if(n==="left")return 0;if(n==="right")return 1}else{if(n==="top")return 0;if(n==="bottom")return 1}if(n.endsWith("%")){let r=Number.parseFloat(n);return Number.isFinite(r)?r/100:null}return null}function Lb(e){let t=e.trim().split(/\\s+/).filter(Boolean),n=.5,r=.5;for(let i=0;i<t.length;i++){let o=t[i]??"",a=hd(o,"x"),l=hd(o,"y");if(a!==null&&(o==="left"||o==="right"||o.endsWith("%")&&i===0)){n=a;continue}if(l!==null&&(o==="top"||o==="bottom"||o.endsWith("%")&&i>0)){r=l;continue}}return{x:n,y:r}}function Rd(e,t,n,r,i,o){if(e<=0||t<=0||n<=0||r<=0)return{scaleX:1,scaleY:1,offsetX:0,offsetY:0};let a=i||"fill",l=e,s=t;if(a==="contain"||a==="cover"||a==="scale-down"){let f=a==="cover"?Math.max(e/n,t/r):Math.min(e/n,t/r);l=n*f,s=r*f,a==="scale-down"&&l>n&&s>r&&(l=n,s=r)}else a==="none"&&(l=n,s=r);let u=Lb(o||"center"),c=(e-l)*u.x/e,m=(t-s)*u.y/t;return{scaleX:l/e,scaleY:s/t,offsetX:c,offsetY:m}}function Db(e,t){window.getComputedStyle(t).position==="static"&&(e.touchedParent||(e.touchedParent=t,e.parentInlinePosition=t.style.position||null),t.style.position="relative")}function gd(e,t){return Math.max(0,Math.round(e>0?e:t))}function Ib(e,t){let{element:n,canvas:r}=e,i=n.parentElement;i&&Db(e,i);let o=window.getComputedStyle(t);tu(r.style,o),r.style.pointerEvents="none",r.style.position="absolute",r.style.inset="auto",r.style.left=`${n.offsetLeft}px`,r.style.top=`${n.offsetTop}px`,r.style.right="auto",r.style.bottom="auto",r.style.width=`${n.offsetWidth}px`,r.style.height=`${n.offsetHeight}px`,r.style.display="block",r.style.opacity=e.sourceOpacityForCanvas,r.style.visibility=e.sourceVisibleForCanvas?"visible":"hidden";let a=n.getBoundingClientRect(),l=gd(n.offsetWidth,a.width),s=gd(n.offsetHeight,a.height);if(l<=0||s<=0)return r.style.display="none",null;let u=Math.max(1,window.devicePixelRatio||1),c=Math.round(l*u),m=Math.round(s*u);return r.width!==c&&(r.width=c),r.height!==m&&(r.height=m),{width:c,height:m}}function en(e,t,n){e.uniform3f(t,Number.parseInt(n.slice(1,3),16)/255,Number.parseInt(n.slice(3,5),16)/255,Number.parseInt(n.slice(5,7),16)/255)}function Nt(e,t,n,r){e.set(r,(t*Ke+n)*4)}function xt(e,t){return Math.min(1,Math.max(1/255,(e*(127/t)+128)/255))}function Ra(e,t,n){return e.length>=3?bo(e,t,n):new Float32Array(Ke)}function Mt(e,t){return e[t]??0}function Pb(e,t,n){let r=Wt(t.red),i=Wt(t.green),o=Wt(t.blue),a=Wt(t.master),l=Ra(n.hueVsHue,-180,180),s=Ra(n.hueVsSaturation,-1,1),u=Ra(n.hueVsLuma,-1,1);for(let c=0;c<Ke;c+=1)Nt(e,0,c,[Mt(r,c),Mt(i,c),Mt(o,c),Mt(a,c)]),Nt(e,1,c,[xt(Mt(l,c),180),xt(Mt(s,c),1),xt(Mt(u,c),1),1])}function Ob(e,t,n){let r=n*tb;Nt(e,2,r,[t.key.hue.center/360,t.key.hue.range/180,t.key.hue.softness/180,1]),Nt(e,2,r+1,[t.key.saturation.min,t.key.saturation.max,t.key.saturation.softness/.5,0]),Nt(e,2,r+2,[t.key.luma.min,t.key.luma.max,t.key.luma.softness/.5,0]),Nt(e,2,r+3,[xt(t.correction.hueShift,180),xt(t.correction.saturation,1),xt(t.correction.luma,1),xt(t.correction.temperature,1)]),Nt(e,2,r+4,[xt(t.correction.tint,1),.5,.5,1])}function Gb(e,t,n){let r=new Float32Array(Ke*or*4);Pb(r,e,t);let i=0;for(let o of n)o.enabled&&(Ob(r,o,i),i+=1);return r}var bd=new WeakMap;function Hb(e,t,n){let r=bd.get(e);if(r?.hueCurves===t&&r.secondaries===n)return r.signature;let i=JSON.stringify([e,t,n]);return bd.set(e,{hueCurves:t,secondaries:n,signature:i}),i}function Bb(e,t,n,r){let{curves:i,hueCurves:o}=n,a=Hb(i,o,r);if(t.advancedSignature===a)return;let l=Uint8Array.from(Gb(i,o,r),Tn);e.activeTexture(e.TEXTURE5),e.bindTexture(e.TEXTURE_2D,t.advancedTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,Ke,or,0,e.RGBA,e.UNSIGNED_BYTE,l),t.advancedSignature=a}function ka(e,t,n){e.uniform3f(t,n.hue/360,n.amount,n.level)}function kd(e,t,n,r,i,o,a,l,s,u,c,m){e.uniform1i(t.source,0),e.uniform1i(t.blurSource,1),e.uniform1i(t.lut,2),e.uniform1i(t.kuwaharaSource,3),e.uniform1i(t.bloomSource,4),e.uniform1i(t.advanced,5),e.uniform2f(t.resolution,s.width,s.height),e.uniform2f(t.uvScale,u.scaleX,u.scaleY),e.uniform2f(t.uvOffset,u.offsetX,u.offsetY),e.uniform1f(t.blurReady,i?1:0),e.uniform1f(t.bloomReady,o?1:0),e.uniform1f(t.kuwaharaReady,a?1:0),e.uniform1f(t.lutEnabled,r?1:0),e.uniform1f(t.lutSize,r?.size??2),e.uniform2f(t.lutTextureSize,r?.textureWidth??1,r?.textureHeight??1),e.uniform3f(t.lutDomainMin,r?.domainMin[0]??0,r?.domainMin[1]??0,r?.domainMin[2]??0),e.uniform3f(t.lutDomainMax,r?.domainMax[0]??1,r?.domainMax[1]??1,r?.domainMax[2]??1),e.uniform1f(t.lutIntensity,n.lut?.intensity??0);let{curves:f,hueCurves:p,secondaries:b}=n,v=Ro(f),x=ko(p),_=Mo(b)?b.reduce((M,F)=>M+Number(F.enabled),0):0;(v||x||_>0)&&Bb(e,t,n,b),ka(e,t.shadowWheel,n.wheels.shadows),ka(e,t.midtoneWheel,n.wheels.midtones),ka(e,t.highlightWheel,n.wheels.highlights),e.uniform1f(t.rgbCurvesEnabled,v?1:0),e.uniform1f(t.hueCurvesEnabled,x?1:0),e.uniform1f(t.secondaryCount,_);for(let[M,F]of t.adjustUniforms)e.uniform1f(F,n.adjust[M]);for(let[M,F]of t.detailUniforms)e.uniform1f(F,n.details[M]);e.uniform1f(t.grainSeed,c),e.uniform1f(t.effectTime,m);for(let[M,F]of t.effectUniforms)e.uniform1f(F,n.effects[M]);let R=n.palette??(n.effects.engraving>0||n.effects.crosshatch>0?Zg:Ca),T=R[R.length-1]??Ca[1];e.uniform1f(t.paletteSize,R.length),en(e,t.palette0,R[0]??Ca[0]),en(e,t.palette1,R[1]??T),en(e,t.palette2,R[2]??T),en(e,t.palette3,R[3]??T),en(e,t.palette4,R[4]??T),en(e,t.palette5,R[5]??T),e.uniform1f(t.intensity,n.intensity),e.uniform1f(t.compareEnabled,l.enabled?1:0),e.uniform1f(t.comparePosition,l.position),e.uniform1f(t.compareSoftness,l.softness),e.uniform1f(t.compareLineWidth,l.lineWidth)}function Ub(e){if(!e.sourceHidden){let t=e.element.getAttribute(Hr);t!==null?(e.sourceInlineOpacity=t===""?null:t,e.sourceInlineOpacityPriority=""):(e.sourceInlineOpacity=e.element.style.getPropertyValue("opacity")||null,e.sourceInlineOpacityPriority=e.element.style.getPropertyPriority("opacity"))}e.element.setAttribute(Mn,"true"),e.element.style.setProperty("opacity","0","important"),e.sourceHidden=!0}function it(e){let t=Yl.find(n=>n.path===e);if(!t)throw new Error(`Missing color-grading animation property: ${e}`);return t}var Md=it("intensity"),Fd=it("lut.intensity"),Nd=it("adjust.exposure"),Ld=it("effects.kuwahara"),Dd=[["blur",it("effects.blur")],["bloom",it("effects.bloom")],["kuwahara",Ld],["pixelate",it("effects.pixelate")],["ascii",it("effects.ascii")],["dither",it("effects.dither")]],Id=[Md,Fd,Nd,...Dd.map(([,e])=>e)];function Lt(e,t){let n=e.style.getPropertyValue(t.name);if(!n)return null;let r=Number(n);return Number.isFinite(r)?Math.min(t.max,Math.max(t.min,r)):null}function tr(e,t){return t!==null&&(Zl(t)||Id.some(n=>Lt(e,n)!==null))}function Wb(e,t){let n=null;for(let[r,i]of Dd){let o=Lt(e,i);o!==null&&(n??(n={...t.effects}),n[r]=o)}return n}function Vb(e){let{element:t,grading:n}=e,r=Lt(t,Md),i=Lt(t,Fd),o=Lt(t,Nd),a=Wb(t,n);if(![r,i,o].some(u=>u!==null)&&a===null)return n;let s={...n,adjust:o===null?n.adjust:{...n.adjust,exposure:o},effects:a??n.effects};return r!==null&&(s.intensity=r),n.lut&&i!==null&&(s.lut={...n.lut,intensity:i}),s}function Pd(e,t,n){e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)}function Od(e,t,n){let r=[t.texture,n.blurTexture,t.lutTexture,n.kuwaharaTexture,n.bloomTexture,t.advancedTexture];for(let[i,o]of r.entries())e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,o)}function De(e){if(e.destroyed||e.contextLost)return!1;let t=Td(e.element);if(!t)return e.hasDrawn||(e.canvas.style.display="none"),!1;let n=wd(t);if(!n)return!1;let r=t instanceof HTMLElement?t:e.element,i=e.element.style.getPropertyValue("opacity"),o=e.element.style.getPropertyPriority("opacity"),a=e.sourceHidden&&i==="0"&&o==="important",l=e.element.style.getPropertyValue("visibility"),s=Fb(t);s&&Nb(e,t);let u=window.getComputedStyle(s?t:e.element);(s||!a)&&(e.sourceOpacityForCanvas=u.opacity||"1"),e.sourceVisibleForCanvas=(s||l!=="hidden")&&u.visibility!=="hidden";let c=Ib(e,r);if(!c)return!1;let m=window.getComputedStyle(r),f=Rd(c.width,c.height,n.width,n.height,m.objectFit,m.objectPosition),{gl:p,program:b}=e;try{let v=Vb(e),x=Mb(e);Pd(p,b.texture,t);let _=Lt(e.element,Ld)!==null,R=Ed(e,v,c,f,{preserveKuwahara:_});p.bindFramebuffer(p.FRAMEBUFFER,null),p.viewport(0,0,c.width,c.height),p.useProgram(b.program),Od(p,b,R);let T=window.__player?.getTime?.(),M=typeof T=="number"&&Number.isFinite(T)?Math.max(0,T):e.element instanceof HTMLVideoElement?Math.max(0,e.element.currentTime):0,F=e.grainSeed+Math.floor(M*60);return kd(p,b,v,x,R.blurReady,R.bloomReady,R.kuwaharaReady,e.compare,c,f,F,M),rr(p,b),Ub(e),e.hasDrawn=!0,e.drawError=null,!0}catch(v){return e.drawError=v instanceof Error?v.message:"Shader draw failed",L("runtime.colorGrading.drawEntry",v),!1}}function zb(e,t,n){let r=e.getBoundingClientRect(),i=e.offsetWidth||r.width||t.width,o=e.offsetHeight||r.height||t.height,a=Math.min(320,Math.max(64,Math.round(n??160))),l=i>0&&o>0?i/o:t.width/t.height;return l>=1?{width:a,height:Math.max(1,Math.round(a/l))}:{width:Math.max(1,Math.round(a*l)),height:a}}function qb(){let e=document.createElement("canvas"),t=Fa(e);return t?{canvas:e,...t,lut:null,effectTargets:null,kuwaharaTargets:null,effectError:null}:null}function $b(e,t){let n=t?void 0:window.__player?.getTime?.();return typeof n=="number"&&Number.isFinite(n)?Math.max(0,n):e instanceof HTMLVideoElement?Math.max(0,e.currentTime):0}function jb(e,t,n,r){let i=Td(t);if(!i)return null;let o=wd(i);if(!o)return null;let a=zb(t,o,n);e.canvas.width=a.width,e.canvas.height=a.height;let l=i instanceof HTMLElement?i:t,s=window.getComputedStyle(l),u=Rd(a.width,a.height,o.width,o.height,s.objectFit,s.objectPosition);return Pd(e.gl,e.program.texture,i),{dimensions:a,uv:u,effectTime:$b(t,r),grainSeed:vd(t)+(t instanceof HTMLVideoElement?Math.floor(t.currentTime*60):0)}}async function Kb(e,t,n,r,i=!1){let o=jb(e,t,r,i);if(!o)return null;let{dimensions:a,uv:l,grainSeed:s,effectTime:u}=o,c=[];for(let m of n.slice(0,32)){let f=Ur(m.grading);if(!f){c.push({id:m.id,dataUrl:null,error:"Invalid grading"});continue}let p=null;try{f.lut&&(e.lut?.src!==f.lut.src&&(e.lut=gb(e,f.lut.src,await hb(f.lut.src))),p=e.lut),c.push({id:m.id,dataUrl:Yb(e,f,p,a,l,s,u)})}catch(b){c.push({id:m.id,dataUrl:null,error:hi(b)})}}return{...a,images:c}}function Yb(e,t,n,r,i,o,a){let{canvas:l,gl:s,program:u}=e,c=Ed(e,t,r,i,{releaseIdleTargets:!1});return s.bindFramebuffer(s.FRAMEBUFFER,null),s.viewport(0,0,r.width,r.height),s.useProgram(u.program),Od(s,u,c),n||(e.lut=null),kd(s,u,t,n,c.blurReady,c.bloomReady,c.kuwaharaReady,tn,r,i,o,a),rr(s,u),l.toDataURL("image/png")}function Xe(e,t,n,r){t.addEventListener(n,r),e.cleanup.push(()=>t.removeEventListener(n,r))}function Xb(e){e.animationFrame!==null&&(window.cancelAnimationFrame(e.animationFrame),e.animationFrame=null),e.videoFrameHandle!==null&&e.element instanceof HTMLVideoElement&&(e.element.cancelVideoFrameCallback?.(e.videoFrameHandle),e.videoFrameHandle=null)}function ir(e){if(e.destroyed||!(e.element instanceof HTMLVideoElement)||e.videoFrameHandle!==null||e.animationFrame!==null)return;let t=e.element,n=t;if(typeof n.requestVideoFrameCallback=="function"){e.videoFrameHandle=n.requestVideoFrameCallback(()=>{e.videoFrameHandle=null,De(e),!e.destroyed&&!t.paused&&!t.ended&&ir(e)});return}e.animationFrame=window.requestAnimationFrame(()=>{e.animationFrame=null,De(e),!e.destroyed&&!t.paused&&!t.ended&&ir(e)})}function Jb(e){let t=()=>{De(e)};if(Xe(e,e.element,"load",t),Xe(e,e.element,"loadedmetadata",t),Xe(e,e.element,"loadeddata",t),Xe(e,e.element,"seeked",t),Xe(e,e.element,"timeupdate",t),Xe(e,window,"resize",t),e.element instanceof HTMLVideoElement&&(Xe(e,e.element,"play",()=>ir(e)),Xe(e,e.element,"pause",t)),Xe(e,e.canvas,"webglcontextlost",n=>{n.preventDefault(),e.contextLost=!0,e.drawError="WebGL context lost",e.canvas.style.display="none",Ma(e)}),Xe(e,e.canvas,"webglcontextrestored",()=>{if(e.contextLost=!1,!xb(e)){e.contextLost=!0,e.drawError="WebGL context restore failed",Ma(e);return}e.drawError=null,De(e)}),typeof ResizeObserver<"u"&&(e.resizeObserver=new ResizeObserver(t),e.resizeObserver.observe(e.element)),typeof MutationObserver<"u"){let n=()=>{let a=e.element.style;return`${a.transform}|${a.translate}|${a.rotate}|${a.scale}|${a.left}|${a.top}|${a.width}|${a.height}`},r=n(),i=!1,o=new MutationObserver(()=>{i||n()!==r&&(i=!0,requestAnimationFrame(()=>{i=!1,r=n(),De(e)}))});o.observe(e.element,{attributes:!0,attributeFilter:["style"]}),e.cleanup.push(()=>o.disconnect())}}function Qb(e){if(e.destroyed)return null;e.destroyed=!0,Xb(e),e.resizeObserver?.disconnect();for(let t of e.cleanup)t();return e.cleanup.length=0,e.canvas.remove(),La(e),Da(e),Ma(e),e.touchedParent&&(e.parentInlinePosition===null?e.touchedParent.style.removeProperty("position"):e.touchedParent.style.position=e.parentInlinePosition),{canvas:e.canvas,gl:e.gl,program:e.program,effectTargets:null,kuwaharaTargets:null,effectError:null}}function Gd(e,t){return e.removeAttribute("style"),t.id?e.id=`${zl}${t.id}`:e.removeAttribute("id"),e.className=Xg,e.setAttribute(Yg,"true"),e.setAttribute("data-hyperframes-ignore",""),e.setAttribute("data-hyperframes-picker-ignore",""),e.setAttribute("data-hf-ignore",""),e.setAttribute("aria-hidden","true"),e.style.pointerEvents="none",e.style.display="none",t.parentNode?.insertBefore(e,t.nextSibling),e}function Zb(e){return Gd(document.createElement("canvas"),e)}function Hd(){let e=new WeakMap,t=new Set,n=[],r=null,i=null,o=Promise.resolve(),a=!1,l=(E,S,A)=>{let C=e.get(E);if(C)return C.grading=S,C.source=A,De(C),E instanceof HTMLVideoElement&&!E.paused&&ir(C),!0;let N=n.pop();if(N)Gd(N.canvas,E);else{let W=Zb(E),U=Fa(W);if(!U)return W.remove(),!1;N={canvas:W,gl:U.gl,program:U.program,effectTargets:null,kuwaharaTargets:null,effectError:null}}let I={element:E,...N,grading:S,compare:{...tn},lut:null,lutLoadingSrc:null,lutError:null,drawError:null,effectTargets:null,kuwaharaTargets:null,effectError:null,source:A,animationFrame:null,videoFrameHandle:null,resizeObserver:null,cleanup:[],touchedParent:null,parentInlinePosition:null,sourceHidden:!1,sourceInlineOpacity:null,sourceInlineOpacityPriority:"",sourceOpacityForCanvas:window.getComputedStyle(E).opacity||"1",sourceVisibleForCanvas:window.getComputedStyle(E).visibility!=="hidden",hasDrawn:!1,contextLost:!1,grainSeed:vd(E),destroyed:!1};return e.set(E,I),t.add(E),Jb(I),De(I),E instanceof HTMLVideoElement&&!E.paused&&ir(I),!0},s=(E,S)=>{if(a)return!1;let A=er(E);if(!A)return!1;let C=e.get(A);if(!C){let N=ui(A);if(!tr(A,N)||!l(A,N,"attribute"))return!1;C=e.get(A)}return C?(C.compare=mb(S),De(C),!0):!1},u=E=>{let S=e.get(E);if(!S)return;let A=Qb(S);A&&(S.contextLost||n.length>=Qg?di(A,!0):n.push(A)),e.delete(E),t.delete(E)},c=()=>{if(a)return 0;let E=new Set;document.querySelectorAll(`video[${kn}], img[${kn}]`).forEach(A=>{if(!Ft(A))return;E.add(A);let C=ui(A);tr(A,C)&&(ud(A)||pd(A))?l(A,C,"attribute"):u(A)});for(let A of t){let C=e.get(A);C&&(!A.isConnected||C.source==="attribute"&&!E.has(A))&&u(A)}return t.size},m=()=>{if(a)return 0;let E=0;for(let S of t){let A=e.get(S);A&&De(A)&&(E+=1)}return E},f=async()=>{let E=new Set;for(let S of t){let A=e.get(S)?.grading.lut;if(!A?.src.trim()||(A.intensity??1)<=0)continue;let C=Na(A.src);C.state==="pending"&&E.add(C.promise)}return E.size>0&&await Promise.allSettled(E),m(),E.size},p=()=>{if(a)return 0;let E=0;for(let S of t){let A=e.get(S);!A||!Id.some(N=>Lt(S,N)!==null)||S instanceof HTMLVideoElement&&!S.paused&&!S.ended||De(A)&&(E+=1)}return E},b=(E,S)=>{if(a)return!1;let A=er(E);if(!A)return!1;let C=Ur(S);return tr(A,C)?l(A,C,"live"):(u(A),!0)},v=(E,S)=>{if(!Ft(E))return!1;let A=e.get(E);if(!A){if(!S)return!1;let C=ui(E);return tr(E,C)&&l(E,C,"attribute")}return A.sourceVisibleForCanvas=S,!S&&A.source==="attribute"&&u(E),!0},x=E=>{let S=er(E);if(!S)return{state:"missing",message:"Media not found"};let A=e.get(S);if(A)return A.effectError?{state:"unavailable",message:A.effectError}:A.drawError?{state:"unavailable",message:A.drawError}:A.lutError?{state:"unavailable",message:`LUT error: ${A.lutError}`}:A.grading.lut&&A.lutLoadingSrc?{state:"pending",message:"Loading LUT"}:A.canvas.style.display==="none"?{state:"pending",message:"Waiting for media frame"}:{state:"active",message:A.lut?"Shader + LUT active":"Shader active"};let C=ui(S);return tr(S,C)?!ud(S)&&!pd(S)?{state:"pending",message:"Waiting for visible media"}:{state:"unavailable",message:"WebGL unavailable"}:{state:"inactive",message:"No grading applied"}},_=async(E,S,A)=>{let C=async()=>{if(a||S.length===0)return null;let I=er(E);return!I||(i??(i=qb()),!i)?null:Kb(i,I,S,A?.maxDimension,A?.useMediaTime)},N=o.then(C,C);return o=N.then(()=>{},()=>{}),N},R=E=>{let S=er(E);if(!(S instanceof HTMLVideoElement))return null;if(!S.paused)return()=>{};let A=S.currentTime,C=S.loop,N=S.muted;return S.loop=!0,S.muted=!0,(S.ended||Number.isFinite(S.duration)&&A>=S.duration)&&(S.currentTime=0),S.play().catch(()=>{}),()=>{S.pause(),S.loop=C,S.muted=N,S.currentTime=A}},T=()=>{if(!a){a=!0,r?.disconnect(),r=null;for(let E of t)u(E);for(let E of n)di(E,!0);n.length=0,i&&(di(i,!0),i=null)}};document.body&&(r=new MutationObserver(()=>c()),r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[kn]}));let M={refresh:c,redraw:m,redrawAnimated:p,waitForActiveLuts:f,setGrading:b,setCompare:s,setSourceVisibility:v,getStatus:x,renderPreviews:_,startPreviewPlayback:R,destroy:T},F=window;return F.__hf=F.__hf||{},F.__hf.colorGrading=M,c(),M}var gi=class{constructor(t){ge(this,"_baseTime",0);ge(this,"_playStartMs",null);ge(this,"_rate",1);ge(this,"_duration",1/0);ge(this,"_nowMs");ge(this,"_audioSource",null);this._baseTime=t?.initialTime??0,this._rate=t?.rate??1,this._duration=t?.duration??1/0,this._nowMs=t?.nowMs??(()=>performance.now())}now(){if(this._playStartMs===null)return this._baseTime;if(this._audioSource){let r=null;if("currentTimeSeconds"in this._audioSource)r=this._audioSource.currentTimeSeconds;else{let{el:i,compositionStart:o,mediaStart:a}=this._audioSource;!i.paused&&Number.isFinite(i.currentTime)&&(r=(i.currentTime-a)/(i.playbackRate>0?i.playbackRate:1)*this._rate+o)}if(r!==null)return Number.isFinite(this._duration)&&r>=this._duration?this._duration:Math.max(0,r)}let t=(this._nowMs()-this._playStartMs)/1e3,n=this._baseTime+t*this._rate;return Number.isFinite(this._duration)&&n>=this._duration?this._duration:Math.max(0,n)}play(){return this._playStartMs!==null||Number.isFinite(this._duration)&&this._baseTime>=this._duration?!1:(this._playStartMs=this._nowMs(),!0)}pause(){return this._playStartMs===null?!1:(this._baseTime=this.now(),this._playStartMs=null,!0)}seek(t){let n=Number.isFinite(this._duration)?Math.max(0,Math.min(t,this._duration)):Math.max(0,t);this._baseTime=n,this._playStartMs!==null&&(this._playStartMs=this._nowMs())}isPlaying(){return this._playStartMs!==null}setRate(t){let n=Number.isFinite(t)&&t>0?Math.max(.1,Math.min(5,t)):1;this._playStartMs!==null&&(this._baseTime=this.now(),this._playStartMs=this._nowMs()),this._rate=n}getRate(){return this._rate}setDuration(t){this._duration=Number.isFinite(t)&&t>0?t:1/0,this._baseTime>this._duration&&(this._baseTime=this._duration)}getDuration(){return this._duration}attachAudioSource(t){this._audioSource=t}detachAudioSource(){this._audioSource&&this._playStartMs!==null&&(this._baseTime=this.now(),this._playStartMs=this._nowMs()),this._audioSource=null}hasAudioSource(){return this._audioSource!==null}getSource(){if(this._audioSource&&this._playStartMs!==null){if("currentTimeSeconds"in this._audioSource)return"audio";let{el:t}=this._audioSource;if(!t.paused&&Number.isFinite(t.currentTime))return"audio"}return"monotonic"}snapshot(){return{time:this.now(),playing:this.isPlaying(),rate:this._rate,duration:this._duration,source:this.getSource()}}reachedEnd(){return Number.isFinite(this._duration)&&this.now()>=this._duration}};var ex=100,tx=8,nx=4096,Ia=e=>e;function rx(e,t,n){return!(!!e.curve||e.viaX!==void 0&&e.viaY!==void 0)&&t==="linear"&&!n}function ix(e){let t=Math.ceil(e*ex);return Math.min(nx,Math.max(tx,t))}function ox(e,t,n,r,i){let{scheduledAt:o,elapsed:a,rate:l}=r,s=i??Ia,u=R=>o+(R-a)/l,c=e.points[t],m=e.points[t+1],f=u(m.t);if(f<=o)return null;let p=Math.max(o,u(c.t)),b=f-p;if(b<=0)return null;if(rx(c,n,i))return{kind:"ramp",time:f,value:s(m.v)};let v=ix(b),x=ml(e,Math.max(c.t,a),m.t,v,n),_=new Float32Array(v);for(let R=0;R<v;R+=1)_[R]=s(x[R]??0);return{kind:"curve",time:p,duration:b,values:_}}function ax(e,t,n,r){let i=[];for(let a=0;a+1<e.points.length;a+=1){let l=ox(e,a,t,n,r);l&&i.push(l)}let o=i[0];return o?.kind==="curve"&&o.time<=n.scheduledAt||i.unshift({kind:"set",time:n.scheduledAt,value:(r??Ia)(wn(e,n.elapsed,t))}),i}function sx(e,t){for(let n of t)if(n.kind==="set")e.setValueAtTime(n.value,n.time);else if(n.kind==="ramp")e.linearRampToValueAtTime(n.value,n.time);else try{e.setValueCurveAtTime(n.values,n.time,n.duration)}catch{let r=n.values[n.values.length-1]??0;e.linearRampToValueAtTime(r,n.time+n.duration)}}function ar(e){for(let t of e)t.param.cancelScheduledValues(0)}function nn(e,t){for(let n of e)typeof n.param.cancelAndHoldAtTime=="function"?n.param.cancelAndHoldAtTime(t):n.param.cancelScheduledValues(t)}function Pa(e,t,n,r){if(t.points.length!==0)for(let i of e){if(ar([i]),fl(t)){let o=(i.map??Ia)(t.points[0].v);i.param.setValueAtTime(o,r.scheduledAt);continue}sx(i.param,ax(t,n,r,i.map))}}function Bd(e,t,n,r,i){let o=new Map(n.filter(l=>l.id).map(l=>[l.id,l.handle])),a=[];for(let l of e.lanes){let s=En(l.target);if(!s)continue;let u=s.kind==="preset"?i?.[s.presetId]:s.kind==="fx"?o.get(s.nodeId)?.automation?.[s.param]:void 0;if(!u||u.length===0)continue;let c=no(l.target,t);c&&(Pa(u,l,c.scale,r),a.push(...u))}return a}function Ud(e){return e.lanes.find(t=>t.target===Ht)??null}var lx=`\nconst dbToLin = (db) => Math.pow(10, db / 20);\n\n/**\n * One-pole envelope followers, one per channel.\n *\n * Per channel matters: the followers advance once per sample, so a single shared\n * follower stepped once per channel per sample. On stereo that ran a 20 ms attack\n * as 10 ms, and gave the right channel a gain computed from an envelope that had\n * already traversed the left \\u2014 so the two channels ducked by different amounts\n * from the same input and the image pumped.\n */\nclass EnvBank {\n constructor(attackMs, releaseMs) { this.set(attackMs, releaseMs); this.values = []; }\n set(attackMs, releaseMs) {\n this.a = Math.exp(-1 / (sampleRate * Math.max(1e-5, attackMs / 1000)));\n this.r = Math.exp(-1 / (sampleRate * Math.max(1e-5, releaseMs / 1000)));\n }\n push(ch, x) {\n const prev = this.values[ch] ?? 0;\n const m = Math.abs(x);\n const c = m > prev ? this.a : this.r;\n const next = m + c * (prev - m);\n this.values[ch] = next;\n return next;\n }\n}\n\n/** Soft-knee gain computer in dB, matching acompressor\'s shape. */\nfunction kneeGain(envDb, thresholdDb, ratio, kneeDb) {\n const over = envDb - thresholdDb;\n if (kneeDb > 0 && over > -kneeDb && over < kneeDb) {\n const t = (over + kneeDb) / (2 * kneeDb);\n return -((1 - 1 / ratio) * kneeDb * t * t);\n }\n return over > 0 ? -(over * (1 - 1 / ratio)) : 0;\n}\n\n// log10/exp per sample is the single most expensive thing a dynamics processor\n// can do on the audio thread, and every sample below the knee needs neither:\n// its gain is exactly unity. Comparing envelopes in the linear domain lets the\n// quiet majority of samples skip the transcendentals entirely.\nconst LN10_OVER_20 = Math.LN10 / 20;\nconst dbToLinFast = (db) => Math.exp(db * LN10_OVER_20);\n\nclass HfCompressor extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 20, this.p.release ?? 250);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 20, this.p.release ?? 250);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const makeup = dbToLin(p.makeup ?? 0);\n const mix = p.mix ?? 1;\n // Knee is expressed as a ratio in FFmpeg; convert to dB width.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const thresholdDb = p.threshold ?? -24;\n const ratio = p.ratio ?? 4;\n // Below this the gain computer returns unity, so the sample needs no\n // logarithm at all.\n const kneeStartLin = dbToLin(thresholdDb - kneeDb);\n const dry = 1 - mix;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n // Per-channel follower, and the sub-knee shortcut: below the knee the\n // gain is exactly unity, so the sample needs no logarithm at all.\n const env = this.env.push(ch, x);\n if (env <= kneeStartLin) {\n out[n] = x * makeup * mix + x * dry;\n continue;\n }\n const envDb = 20 * Math.log10(env);\n const g = dbToLinFast(kneeGain(envDb, thresholdDb, ratio, kneeDb));\n out[n] = x * g * makeup * mix + x * dry;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-compressor", HfCompressor);\n\nclass HfLimiter extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 5, this.p.release ?? 50);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 5, this.p.release ?? 50);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const ceiling = dbToLin(this.p.limit ?? -1);\n const outGain = dbToLin(this.p.level_out ?? 0);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n // Only ever attenuate: a limiter that can raise level is a compressor.\n const g = env > ceiling ? ceiling / env : 1;\n out[n] = x * g * outGain;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-limiter", HfLimiter);\n\nclass HfGate extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 1, this.p.release ?? 100);\n this.gains = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 1, this.p.release ?? 100);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const threshold = dbToLin(p.threshold ?? -35);\n const floor = dbToLin(p.range ?? -24);\n const ratio = p.ratio ?? 10;\n // Knee is declared in the registry as a ratio, like the compressor\'s; a\n // hard threshold ignored it and chattered on material sitting right at the\n // gate point.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const kneeLin = dbToLin((p.threshold ?? -35) + kneeDb);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n let target = 1;\n // Above the threshold the gate is fully open; skip the pow entirely.\n if (env < threshold) {\n const under = env > 1e-9 ? threshold / env : 1e9;\n target = Math.max(floor, 1 / Math.pow(under, ratio - 1));\n if (!isFinite(target)) target = floor;\n }\n // Smooth toward the target so the gate does not click on every sample.\n const held = this.gains[ch] ?? 1;\n const c = target < held ? this.env.r : this.env.a;\n const smoothed = target + c * (held - target);\n this.gains[ch] = smoothed;\n out[n] = x * smoothed;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-gate", HfGate);\n\nclass HfBitcrush extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.holds = [];\n this.held = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const levels = Math.pow(2, (p.bits ?? 8) - 1);\n const step = Math.max(1, Math.round(p.samples ?? 1));\n const mix = p.mix ?? 1;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n if (this.held[ch] === undefined) this.held[ch] = 0;\n if (this.holds[ch] === undefined) this.holds[ch] = 0;\n for (let n = 0; n < inp.length; n++) {\n // Per channel: advancing one shared counter only on the last channel\n // left every earlier channel either unheld or frozen for a whole\n // 128-sample quantum, clicking once a block.\n if (this.holds[ch] === 0) this.held[ch] = Math.round(inp[n] * levels) / levels;\n out[n] = this.held[ch] * mix + inp[n] * (1 - mix);\n this.holds[ch] = (this.holds[ch] + 1) % step;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-bitcrush", HfBitcrush);\n\n/** Linear-interpolated read, \\`delaySamples\\` behind the write head. */\nfunction readTap(ring, write, delaySamples) {\n const len = ring.length;\n const pos = (write - 1 - delaySamples + len) % len;\n const i0 = Math.floor(pos);\n const frac = pos - i0;\n const i1 = (i0 + 1) % len;\n return ring[i0] * (1 - frac) + ring[i1] * frac;\n}\n\n/** Equal-power-ish crossfade, zero at a tap\'s reset point \\u2014 hides the splice. */\nfunction xfade(phase) {\n return Math.sin(Math.PI * phase);\n}\n\n/**\n * Dual-tap granular delay line: two read taps 180\\xB0 apart in a 100 ms grain,\n * each sweeping at a speed relative to the write head that shifts pitch\n * without changing duration. One tap is always fading in as the other fades\n * out, which hides the splice each tap makes when it wraps.\n *\n * write/phase are block-level state, advanced once per SAMPLE across all\n * channels together (not once per channel) \\u2014 advancing them inside the\n * per-channel loop would move the tap 2x/4x too fast on a stereo/quad input.\n */\nclass HfPitchshift extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.grain = Math.round(sampleRate * 0.1);\n this.buf = [];\n this.write = 0;\n this.phase = 0;\n // Samples written so far, capped at one grain. The taps read up to a grain\n // behind the write head, so until this fills they would read the ring\'s\n // zeros \\u2014 the head of every clip came out attenuated or silent.\n this.filled = 0;\n // How much of the wet (pitch-shifted) path is currently in the output, and\n // where it is heading. Crossing between dry and wet is a ~50 ms jump in the\n // signal, so it is RAMPED rather than switched: a hard swap either way is a\n // click. Ramping in both directions is also what lets a node return to true\n // bypass at semitones 0 \\u2014 a one-way latch left preview stuck with the delay\n // that the render, building a fresh node from the attribute, does not have.\n this.wet = 0;\n this.wetTarget = 0;\n // ~15 ms one-pole, short enough to feel immediate on a slider drag and long\n // enough that the splice is inaudible.\n this.wetCoef = Math.exp(-1 / (sampleRate * 0.015));\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const semitones = Math.max(-12, Math.min(12, p.semitones ?? 0));\n const mix = Math.max(0, Math.min(1, p.mix ?? 1));\n const grain = this.grain;\n const ringLen = grain * 2;\n const n = i[0] ? i[0].length : 0;\n for (let ch = 0; ch < i.length; ch++) {\n if (!this.buf[ch]) this.buf[ch] = new Float32Array(ringLen);\n }\n\n // Nothing to shift, or mixed fully out. The grain delay is ~grain/2\n // whatever the ratio, so at semitones=0 this degenerated into a pure 50 ms\n // delay of the signal \\u2014 while the copy for that exact setting reads\n // "Unchanged pitch".\n this.wetTarget = semitones === 0 ? 0 : mix;\n\n // Fully dry AND settled: take the cheap transparent path. The ring keeps\n // filling, so a later shift does not start cold.\n if (this.wetTarget === 0 && this.wet < 1e-4) {\n this.wet = 0;\n let w = this.write;\n for (let s = 0; s < n; s++) {\n for (let ch = 0; ch < i.length; ch++) {\n const x = i[ch][s];\n this.buf[ch][w] = x;\n o[ch][s] = x;\n }\n w = (w + 1) % ringLen;\n }\n this.write = w;\n this.filled = Math.min(grain, this.filled + n);\n return true;\n }\n\n const ratio = Math.pow(2, semitones / 12);\n const inc = (1 - ratio) / grain;\n let write = this.write, phase = this.phase, filled = this.filled, wetNow = this.wet;\n const target = this.wetTarget, coef = this.wetCoef;\n for (let s = 0; s < n; s++) {\n phase += inc;\n phase -= Math.floor(phase);\n const phaseB = (phase + 0.5) % 1;\n const gA = xfade(phase), gB = xfade(phaseB);\n // Ramp the wet path in as the ring fills rather than reading zeros:\n // 100 ms of unshifted audio at the head of a clip beats 50 ms of silence.\n const warm = filled >= grain ? 1 : filled / grain;\n wetNow = target + coef * (wetNow - target);\n const wetMix = wetNow * warm;\n for (let ch = 0; ch < i.length; ch++) {\n const ring = this.buf[ch];\n const inp = i[ch], out = o[ch];\n const x = inp[s];\n ring[write] = x;\n const wet =\n readTap(ring, write, phase * grain) * gA + readTap(ring, write, phaseB * grain) * gB;\n out[s] = x * (1 - wetMix) + wet * wetMix;\n }\n write = (write + 1) % ringLen;\n if (filled < grain) filled++;\n }\n this.write = write;\n this.phase = phase;\n this.filled = filled;\n this.wet = wetNow;\n return true;\n }\n}\nregisterProcessor("hf-pitchshift", HfPitchshift);\n`,Oa=new WeakMap;function Ga(e){return Wd.has(e)}var Wd=new WeakSet;function Ha(e){let t=Oa.get(e);return t||(t=(async()=>{if(!e.audioWorklet)throw new Error("AudioWorklet is unavailable \\u2014 the page needs a secure context (https, localhost or file://)");let n=`data:text/javascript;base64,${btoa(String.fromCharCode(...new TextEncoder().encode(lx)))}`;await e.audioWorklet.addModule(n),Wd.add(e)})().catch(n=>{throw Oa.delete(e),n}),Oa.set(e,t)),t}function ux(e,t,n){let r=.6+Math.max(0,Math.min(1,t))*2.6,i=Math.max(1,Math.floor(e*r)),o=new Float32Array(i),a=Math.round(t*1e3)*2654435761+Math.round(n*1e3)*40503>>>0,l=()=>(a=a*1664525+1013904223>>>0,a/4294967295*2-1),s=Math.max(.001,1-Math.max(0,Math.min(1,n))),u=0,c=0;for(let f=0;f<i;f++){u+=s*(l()-u);let p=u*Math.pow(1-f/i,2.5);o[f]=p,c+=p*p}let m=Math.sqrt(c);if(m>0)for(let f=0;f<i;f++)o[f]=(o[f]??0)/m;return o}var ce=e=>typeof e=="number"?e:Number(e??0),Ba=e=>e/1e3;function $d(e,t,n,r){let i=Math.max(1,Math.round(e.sampleRate)),o=e.createBuffer(1,i,e.sampleRate),a=o.getChannelData(0);for(let u=0;u<i;u++){let c=u/i;a[u]=t==="sine"?Math.sin(2*Math.PI*c):4*Math.abs((c+.75)%1-.5)-1}let l=e.createBufferSource();l.buffer=o,l.loop=!0,l.playbackRate.value=n;let s=(r*n%1+1)%1*(i/e.sampleRate);return l.start(typeof e.currentTime=="number"?e.currentTime:0,s),l}function jd(e){try{e.stop()}catch{}e.disconnect()}function Ua(e,t){return[{param:e},{param:t,map:n=>1-n}]}function Kd(e,t,n){e.gain.value=n,t.gain.value=1-n}function Wa(e,t,n){return{input:e,output:e,update:t,automation:n,dispose:()=>e.disconnect()}}var cx=new Set(["peaking","highpass","lowpass"]),Vd=e=>Math.pow(10,e/20),dx=(e,t)=>{let n=e.createGain(),r=i=>{n.gain.value=Vd(ce(i.gain))};return r(t),Wa(n,r,{gain:[{param:n.gain,map:Vd}]})};function sr(e,t){return(n,r)=>{let i=n.createBiquadFilter();i.type=e;let o=a=>{i.frequency.value=ce(a.frequency),a.q!==void 0&&(i.Q.value=ce(a.q)),t&&(i.gain.value=ce(a.gain))};return o(r),Wa(i,o,{frequency:[{param:i.frequency}],...cx.has(e)?{q:[{param:i.Q}]}:{},...t?{gain:[{param:i.gain}]}:{}})}}function fx(e){return(t,n)=>{let r=Math.tan(Math.PI*ce(n.frequency)/t.sampleRate),i=e==="highpass"?t.createIIRFilter([1/(1+r),-1/(1+r)],[1,(r-1)/(r+1)]):t.createIIRFilter([r/(1+r),r/(1+r)],[1,(r-1)/(r+1)]);return Wa(i,()=>{})}}function lr(e){return(t,n)=>{let r=new AudioWorkletNode(t,e,{processorOptions:{...n}});return{input:r,output:r,update:i=>r.port.postMessage({...i}),dispose:()=>{r.port.postMessage({__hfDispose:!0}),r.disconnect()}}}}var mx={tanh:Math.tanh,atan:e=>2/Math.PI*Math.atan(Math.PI/2*e),cubic:e=>Math.abs(e)>=1?Math.sign(e):e-e**3/3,exp:e=>Math.sign(e)*(1-Math.exp(-Math.abs(e))),alg:e=>e/Math.sqrt(1+e*e),quintic:e=>Math.abs(e)>=1?Math.sign(e):e-e**5/5,sin:e=>Math.abs(e)>=1?Math.sign(e):Math.sin(Math.PI/2*e),erf:e=>Math.tanh(1.20211*e),hard:e=>Math.max(-1,Math.min(1,e))},px=(e,t)=>{let n=e.createWaveShaper(),r=e.createGain(),i=e.createGain();r.connect(n).connect(i);let o=a=>{let l=mx[String(a.type)]??Math.tanh,s=Math.pow(10,ce(a.threshold)/20),u=8192,c=new Float32Array(u);for(let m=0;m<u;m++){let f=m/(u-1)*2-1;c[m]=l(f/Math.max(1e-6,s))*s}n.curve=c,n.oversample=ce(a.oversample)>=4?"4x":ce(a.oversample)>=2?"2x":"none",i.gain.value=Math.pow(10,ce(a.output)/20)};return o(t),{input:r,output:i,update:o,automation:{output:[{param:i.gain,map:a=>Math.pow(10,a/20)}]},dispose:()=>{r.disconnect(),n.disconnect(),i.disconnect()}}},hx=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createDelay(5),o=e.createGain(),a=e.createGain(),l=e.createGain();n.connect(i),i.connect(o),o.connect(i),i.connect(a).connect(r),n.connect(l).connect(r);let s=u=>{i.delayTime.value=Math.min(5,ce(u.time)/1e3),o.gain.value=ce(u.feedback),Kd(a,l,ce(u.mix))};return s(t),{input:n,output:r,update:s,automation:{time:[{param:i.delayTime,map:u=>Math.min(5,Ba(u))}],feedback:[{param:o.gain}],mix:Ua(a.gain,l.gain)},dispose:()=>[n,r,i,o,a,l].forEach(u=>u.disconnect())}},gx=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createDelay(.5),a=$d(e,"sine",ce(t.speed),n),l=e.createGain(),s=e.createGain(),u=e.createGain();a.connect(l).connect(o.delayTime),r.connect(o).connect(s).connect(i),r.connect(u).connect(i);let c=m=>{o.delayTime.value=ce(m.delay)/1e3,l.gain.value=ce(m.depth)/1e3,a.playbackRate.value=ce(m.speed),Kd(s,u,ce(m.mix))};return c(t),{input:r,output:i,update:c,automation:{delay:[{param:o.delayTime,map:Ba}],depth:[{param:l.gain,map:Ba}],speed:[{param:a.playbackRate}],mix:Ua(s.gain,u.gain)},dispose:()=>{jd(a),[r,i,o,l,s,u].forEach(m=>m.disconnect())}}},bx=6,xx=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createGain(),a=e.createGain(),l=$d(e,String(t.type)==="1"?"sine":"triangle",ce(t.speed),n),s=e.createGain(),u=e.createGain(),c=e.createGain(),m=[];r.connect(o);let f=o;for(let b=0;b<bx;b++){let v=e.createBiquadFilter();v.type="allpass",v.Q.value=.7071,s.connect(v.frequency),f.connect(v),f=v,m.push(v)}l.connect(s),f.connect(u).connect(a),o.connect(c).connect(a),a.connect(i);let p=b=>{let v=1e3/Math.max(.1,ce(b.delay));for(let x of m)x.frequency.value=v;s.gain.value=v*ce(b.decay),l.playbackRate.value=ce(b.speed),o.gain.value=ce(b.in_gain),a.gain.value=ce(b.out_gain),u.gain.value=1,c.gain.value=1};return p(t),{input:r,output:i,update:p,automation:{speed:[{param:l.playbackRate}],in_gain:[{param:o.gain}],out_gain:[{param:a.gain}]},dispose:()=>{jd(l),[r,i,o,a,s,u,c,...m].forEach(b=>b.disconnect())}}},yx=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createConvolver(),o=e.createGain(),a=e.createGain();i.normalize=!1,n.connect(i).connect(o).connect(r),n.connect(a).connect(r);let l="",s=u=>{let c=`${ce(u.size)}:${ce(u.damping)}`;if(c!==l){let m=ux(e.sampleRate,ce(u.size),ce(u.damping)),f=e.createBuffer(1,m.length,e.sampleRate);f.getChannelData(0).set(m),i.buffer=f,l=c}o.gain.value=ce(u.wet),a.gain.value=ce(u.dry)};return s(t),{input:n,output:r,update:s,automation:{wet:[{param:o.gain}],dry:[{param:a.gain}]},dispose:()=>[n,r,i,o,a].forEach(u=>u.disconnect())}},vx={"gain-node":dx,"biquad-peaking":sr("peaking",!0),"biquad-lowshelf":sr("lowshelf",!0),"biquad-highshelf":sr("highshelf",!0),"biquad-highpass":sr("highpass",!1),"biquad-lowpass":sr("lowpass",!1),"worklet-compressor":lr("hf-compressor"),"worklet-limiter":lr("hf-limiter"),"worklet-gate":lr("hf-gate"),"worklet-bitcrush":lr("hf-bitcrush"),"worklet-pitchshift":lr("hf-pitchshift"),waveshaper:px,"delay-feedback":hx,"chorus-lfo":gx,"allpass-phaser":xx,convolver:yx};function Yd(e){return e.nodes.some(t=>yn(t.type)?.web.startsWith("worklet-")??!1)}function Sx(e,t,n,r=0){let i=yn(t);if(!i)throw new Error(`Unknown effect type: ${t}`);let o=vn(t,n);if((t==="highpass"||t==="lowpass")&&String(o.poles)==="1")return fx(t)(e,o,r);let a=vx[i.web];if(!a)throw new Error(`No Web Audio builder for ${i.web}`);return a(e,o,r)}function zd(e){let t=[];for(let n of e){let r=n.fromPreset,i=t.at(-1);if(i&&i.preset===r)i.nodes.push(n);else{let o=typeof n.presetAmount=="number"?n.presetAmount:1;t.push({...r?{preset:r}:{},amount:Math.min(1,Math.max(0,o)),nodes:[n]})}}return t}function qd(e){return Sn(e).map(t=>{let n=vn(t.type,t.params),r=n.poles!==void 0?`:${n.poles}`:"",i=String(n.poles)==="1"?`@${n.frequency}`:"",o=t.type==="phaser"?`~${n.type}`:"",a=t.fromPreset?`%${t.fromPreset}`:"";return`${t.type}${r}${i}${o}${a}`}).join("|")}function Xd(e,t,n=0){var m;let r=e.createGain(),i=e.createGain(),o=[],a=[],l=zd(Sn(t)),s=r;for(let f of l){let p=null;if(f.preset){let b=e.createGain(),v=e.createGain(),x=e.createGain(),_=e.createGain();x.gain.value=f.amount,v.gain.value=1-f.amount,s.connect(b),b.connect(v).connect(_),p={entry:b,wet:x,dry:v,join:_},s=b}for(let b of f.nodes){let v=Sx(e,b.type,b.params??{},n);s.connect(v.input),s=v.output,o.push({...b.id?{id:b.id}:{},type:b.type,handle:v})}p&&f.preset&&(s.connect(p.wet).connect(p.join),a.push({id:f.preset,...p}),s=p.join)}s.connect(i);let u=qd(t),c={};for(let f of a)(c[m=f.id]??(c[m]=[])).push(...Ua(f.wet.gain,f.dry.gain));return{input:r,output:i,presets:c,nodes:o,update(f){if(qd(f)!==u)return!1;Sn(f).forEach((b,v)=>{let x=o[v];x&&(x.handle.update(vn(b.type,b.params)),b.id===void 0?delete x.id:x.id=b.id)});let p=0;for(let b of zd(Sn(f))){if(!b.preset)continue;let v=a[p++];!v||v.id!==b.preset||(v.wet.gain.value=b.amount,v.dry.gain.value=1-b.amount)}return!0},dispose(){for(let{handle:f}of o)f.dispose();for(let{entry:f,wet:p,dry:b,join:v}of a)f.disconnect(),p.disconnect(),b.disconnect(),v.disconnect();r.disconnect(),i.disconnect()}}}var Jd={version:1,nodes:[]},Qd={version:1,lanes:[]};function Zd(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(_t):null)??"";if(!n)return Qd;try{return dl(Fr(n),t)}catch{return Qd}}function rn(e){let t=(typeof e.getAttribute=="function"?e.getAttribute(xn):null)??"";if(!t)return{chain:Jd,raw:""};try{return{chain:ll(t),raw:t}}catch{return{chain:Jd,raw:""}}}function ef(e){return Zd(e,rn(e).chain)}function bi(e,t,n,r,i){let{chain:o}=rn(t),a=null,l=[],s=!1,u=0,c=()=>{try{a?(n.disconnect(a.input),a.output.disconnect(r),a.dispose()):n.disconnect(r)}catch{}a=null},m=(T,M)=>{if(T.nodes.length===0){n.connect(r);return}if(Yd(T)&&!Ga(e)){n.connect(r);let F=++u;Ha(e).then(()=>{s||F!==u||x(rn(t).chain)}).catch(()=>{});return}try{let F=Xd(e,T,M);n.connect(F.input),F.output.connect(r),a=F}catch{n.connect(r)}},f=(T,M)=>{l=M&&a?Bd(Zd(t,T),T,a.nodes,M,a.presets):[]},p=i?{...i}:null;m(o,p?.elapsed??0),f(o,p);let b=()=>{if(!p)return null;let T=typeof e.currentTime=="number"?e.currentTime:p.scheduledAt;return{scheduledAt:T,elapsed:p.elapsed+(T-p.scheduledAt)*p.rate,rate:p.rate}},v=T=>{let M=b();M&&(nn(l,M.scheduledAt),f(T,M))},x=T=>{let M=b();nn(l,M?.scheduledAt??0),c(),m(T,M?.elapsed??0),f(T,M)},_=null,R=t;return typeof MutationObserver<"u"&&typeof R?.nodeType=="number"&&(_=new MutationObserver(()=>{let T=rn(t);l.length>0&&ar(l),!a||!a.update(T.chain)?x(T.chain):v(T.chain)}),_.observe(R,{attributes:!0,attributeFilter:[xn,_t]})),{reanchor:T=>{if(s)return;let M=b();M&&nn(l,M.scheduledAt),p={...T},f(rn(t).chain,p)},setRate:T=>{let M=b();s||!M||!Number.isFinite(T)||T<=0||T===M.rate||(p={...M,rate:T},nn(l,M.scheduledAt),f(rn(t).chain,p))},dispose:()=>{s=!0,_?.disconnect(),l.length>0&&nn(l,typeof e.currentTime=="number"?e.currentTime:0),a?.dispose()}}}function Va(e){return!Number.isFinite(e)||e<=0?1:e}function tf(e){return Le(e)}function Ax(e,t){t||e.paused||!yr().__hfDebug||console.debug("[hyperframes] webAudioTransport claimed fallback-playing element:",e.currentSrc||e.getAttribute("src")||"")}function Ex(e,t){let{elapsed:n,mediaStart:r,scheduledAt:i,globalRate:o,mediaRate:a,clipDuration:l}=t,s=Number.isFinite(l)&&l>0,u=l*a;if(n>=0){let m=n*a,f=u-m;return s&&f<=0?!1:(s?e.start(0,m+r,f):e.start(0,m+r),!0)}let c=-n/o;return s?e.start(i+c,r,u):e.start(i+c,r),!0}function xi(e,t,n){let r=Ud(ef(e));r&&Pa([{param:t.gain}],r,Mr.scale,n)}function ur(e){return e.sourceKind==="buffer"}var yi=class{constructor(){ge(this,"_ctx",null);ge(this,"_bufferCache",new Map);ge(this,"_failedSrcs",new Set);ge(this,"_mediaElementSources",new WeakMap);ge(this,"_activeSources",[]);ge(this,"_masterGain",null);ge(this,"_masterVolume",1);ge(this,"_masterMuted",!1);ge(this,"_groups",new Map);ge(this,"_rateAnchorCtx",0);ge(this,"_rateAnchorComp",0);ge(this,"_rate",1);ge(this,"_paused",!0);ge(this,"_playGeneration",0)}async init(){try{return this._ctx=new AudioContext,this._masterGain=this._ctx.createGain(),this._masterGain.connect(this._ctx.destination),this.applyMasterGain(),!0}catch{return!1}}get context(){return this._ctx}getTime(){return!this._ctx||this._paused?-1:this._rateAnchorComp+(this._ctx.currentTime-this._rateAnchorCtx)*this._rate}async decodeAudioElement(t){let n=t.currentSrc||t.getAttribute("src");if(!n)return null;if(this._bufferCache.has(n))return this._bufferCache.get(n);if(this._failedSrcs.has(n)||!this._ctx)return null;let r;try{let i=await fetch(n,{cache:"no-store"});if(!i.ok)return L("webAudioTransport.fetch",new Error(`${i.status} ${n}`)),null;r=await i.arrayBuffer()}catch(i){return L("webAudioTransport.fetch",i),null}try{let i=await this._ctx.decodeAudioData(r);return this._bufferCache.set(n,i),i}catch(i){return this._failedSrcs.add(n),L("webAudioTransport.decode",i),null}}startGeneration(){return this._playGeneration+=1,this._playGeneration}currentGeneration(){return this._playGeneration}async scheduleMediaElementPlayback(t,n,r,i,o,a,l=1){if(!this._ctx||!this._masterGain||a!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),a!==this._playGeneration)return null;let s=this._mediaElementSources.get(t);s||(s=this._ctx.createMediaElementSource(t),this._mediaElementSources.set(t,s));let u=Va(l),c=this._ctx.createGain();c.gain.value=o;let m=this._ctx.currentTime,f=i-n,p={scheduledAt:m,elapsed:f,rate:u},b=bi(this._ctx,t,s,c,p);c.connect(this.resolveDestination(t,m,i,u)??this._masterGain),xi(t,c,p),this._rate=u,this._rateAnchorCtx=m,this._rateAnchorComp=i;let v={fx:b,el:t,sourceNode:s,sourceKind:"media-element",gainNode:c,compositionStart:n,mediaStart:r,scheduledAt:m,priorMuted:t.muted,priorVolume:t.volume,mediaPlaybackRate:_e(t),bounded:!1};return t.volume=1,this._activeSources.push(v),this._paused=!1,v}catch(s){return L("webAudioTransport.mediaElementSource",s),null}}groupInput(t,n,r){let i=this._groups.get(t);if(i){if(i.generation!==this._playGeneration)try{i.reanchor(r),i.generation=this._playGeneration}catch(f){L("webAudioTransport.groupReanchor",f)}return i.input}if(!this._ctx||!this._masterGain)return null;let o=this._ctx.createGain(),a=this._ctx.createGain();a.connect(this._masterGain);let l=()=>io(n,t),s=l(),u=this._ctx.createGain();u.gain.value=s?.hasAttribute("data-hidden")?0:1,u.connect(a);let c=this._ctx.createGain();c.gain.value=tf(ro(s)),c.connect(u);let m=bi(this._ctx,s??{getAttribute:()=>null},o,c,r);return s&&xi(s,c,r),this._groups.set(t,{input:o,fader:c,muteGain:u,fx:m,generation:this._playGeneration,reanchor:f=>{ar([{param:c.gain}]);let p=l();c.gain.value=tf(ro(p)),u.gain.value=p?.hasAttribute("data-hidden")?0:1,m?.reanchor(f),p&&xi(p,c,f)},dispose:()=>{try{m?.dispose(),o.disconnect(),c.disconnect(),u.disconnect(),a.disconnect()}catch{}}}),o}setGroupMuted(t,n){let r=this._groups.get(t);if(r)try{r.muteGain.gain.value=n?0:1}catch(i){L("webAudioTransport.setGroupMuted",i)}}resolveDestination(t,n,r,i){if(!this._masterGain)return null;let o=gl(t);if(!o)return this._masterGain;let a={scheduledAt:n,elapsed:r,rate:i};return this.groupInput(o,t.ownerDocument,a)??this._masterGain}handleSourceEnded(t,n,r,i){let o=this._activeSources.indexOf(n);if(o!==-1){this._activeSources.splice(o,1),r.muted=i;try{t.disconnect(),n.fx?.dispose(),n.gainNode.disconnect()}catch{}this._activeSources.length===0&&(this._paused=!0)}}async schedulePlayback(t,n,r,i,o,a,l,s=1,u=Number.POSITIVE_INFINITY){if(!this._ctx||!this._masterGain||l!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),l!==this._playGeneration)return null;let c=Va(s),m=_e(t),f=c*m,p=this._ctx.createBufferSource();p.buffer=n,p.playbackRate.value=f;let b=this._ctx.createGain();b.gain.value=a;let v=o-r,x=this._ctx.currentTime,_={scheduledAt:x,elapsed:v,rate:c},R=bi(this._ctx,t,p,b,_);if(b.connect(this.resolveDestination(t,x,o,c)??this._masterGain),xi(t,b,_),this._rate=c,this._rateAnchorCtx=x,this._rateAnchorComp=o,!Ex(p,{elapsed:v,mediaStart:i,scheduledAt:x,globalRate:c,mediaRate:m,clipDuration:u}))return p.disconnect(),R?.dispose(),b.disconnect(),null;let T=t.muted;t.muted=!0,Ax(t,T);let M={fx:R,el:t,sourceNode:p,sourceKind:"buffer",gainNode:b,compositionStart:r,mediaStart:i,scheduledAt:x,priorMuted:T,priorVolume:t.volume,mediaPlaybackRate:m,bounded:Number.isFinite(u)&&u>0};return this._activeSources.push(M),this._paused=!1,p.addEventListener("ended",()=>this.handleSourceEnded(p,M,t,T)),M}catch(c){return L("webAudioTransport.schedule",c),null}}setRate(t){let n=Va(t);if(n===this._rate)return!1;this._ctx&&!this._paused&&(this._rateAnchorComp=this.getTime(),this._rateAnchorCtx=this._ctx.currentTime),this._rate=n;for(let r of this._activeSources)try{ur(r)&&(r.sourceNode.playbackRate.value=n*r.mediaPlaybackRate),r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate",i)}for(let r of this._groups.values())try{r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate.group",i)}return!0}hasBoundedActiveSources(){return this._activeSources.some(t=>ur(t)&&t.bounded)}stopAll(){for(let t of this._activeSources){try{ur(t)&&t.sourceNode.stop(),t.sourceNode.disconnect(),t.fx?.dispose(),t.gainNode.disconnect()}catch{}ur(t)?t.el.muted=t.priorMuted:t.el.volume=t.priorVolume}this._activeSources=[],this._paused=!0}setVolume(t){this._masterVolume=Math.max(0,Math.min(1,t)),this.applyMasterGain()}setElementVolume(t,n){let r=Le(n);for(let i of this._activeSources)if(i.el===t)try{i.sourceKind==="media-element"&&(i.el.volume=1),i.gainNode.gain.value=r}catch(o){L("webAudioTransport.setElementVolume",o)}}setMuted(t){this._masterMuted=t,this.applyMasterGain()}applyMasterGain(){this._masterGain&&(this._masterGain.gain.value=this._masterMuted?0:this._masterVolume)}isActive(){return this._activeSources.length>0&&!this._paused}ownsElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t&&ur(n))}routesElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t)}destroy(){this.stopAll();for(let t of this._groups.values())t.dispose();if(this._groups.clear(),this._bufferCache.clear(),this._failedSrcs.clear(),this._mediaElementSources=new WeakMap,this._ctx)try{this._ctx.close()}catch{}this._ctx=null,this._masterGain=null,this._masterVolume=1,this._masterMuted=!1}};var nf="data-hf-studio-manual-edit-gesture";function rf(e){return!Number.isInteger(e.tick)||e.tick<=0||e.tick%60!==0?!1:!(e.isPlaying&&e.hasCapturedTimeline&&e.currentTimeSeconds<2)}var wx=/^\\s*spring\\(\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+))\\s*\\)\\s*$/;function of(e){return Math.max(0,Math.min(1,e))}function af(e){let t=wx.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?of(n):null}function sf(e,t){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let n=of(t),r=12-n*6,i=Math.PI*2*(1+n*1.5),o=1-Math.exp(-r)*Math.cos(i);return(1-Math.exp(-r*e)*Math.cos(i*e))/o}var Cx=/^\\s*wiggle\\(\\s*(\\d+)\\s*,\\s*(easeOut|easeInOut|anticipate|uniform)\\s*(?:,\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?)\\s*)?\\)\\s*$/,_x=Math.PI*2;function Tx(e){let t=Cx.exec(e);if(!t)return null;let n=Number(t[1]);if(!Number.isSafeInteger(n)||n<1)return null;let r=t[2];if(r!=="easeOut"&&r!=="easeInOut"&&r!=="anticipate"&&r!=="uniform")return null;if(t[3]===void 0)return{wiggles:n,type:r};let i=Number(t[3]);return!Number.isFinite(i)||i<0||i>1?null:{wiggles:n,type:r,amplitude:i}}function Rx(e,t,n,r){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let i=r??(n==="easeInOut"?.08:n==="uniform"?.14:n==="anticipate"?.12:.16),o=n==="easeInOut"?i*Math.sin(Math.PI*e):n==="uniform"?i:i*(1-e);return e+(n==="anticipate"?-1:1)*o*Math.sin(_x*t*e)}function lf(e,t){let n=Tx(e);if(!n)return null;let r=`${n.wiggles}:${n.type}:${n.amplitude??"default"}`,i=t?.get(r);if(i)return i;let o=a=>Rx(a,n.wiggles,n.type,n.amplitude);return t?.set(r,o),o}var kx=24,uf=e=>e>=1?1:0,Mx=e=>e,vi=String.raw`([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?)`,Fx=new RegExp(String.raw`^\\s*M\\s*0\\s*,\\s*0\\s+C\\s*${vi}\\s*,\\s*${vi}\\s+${vi}\\s*,\\s*${vi}\\s+1\\s*,\\s*1\\s*$`,"i");function cf(e,t,n){let r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function Nx(e,t,n,r,i){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let o=0,a=1;for(let l=0;l<kx;l+=1){let s=(o+a)/2;cf(s,t,r)<e?o=s:a=s}return cf((o+a)/2,n,i)}function Lx(e){let t=Fx.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]),o=Number(t[4]);return Math.min(n,i)<0||Math.max(n,i)>1?null:a=>Nx(a,n,r,i,o)}function Dx(e,t){if(!e.startsWith("spring("))return null;let n=af(e);if(n===null)return null;let r=t.get(n);if(r)return r;let i=o=>sf(o,n);return t.set(n,i),i}function Ix(e,t){if(!e.startsWith("custom(")||!e.endsWith(")"))return null;let n=e.slice(7,-1),r=t.get(n);if(r)return r;let i=Lx(n);return i&&t.set(n,i),i}function df(e){if(e.__hfCustomEaseInstalled)return!0;let t=e.parseEase;if(!t)return!1;let n=new Map,r=new Map,i=new Map,o=s=>typeof s!="string"?null:s==="hold"?uf:lf(s,i)??Dx(s,r)??Ix(s,n),a=(s,u,c=[])=>{let m=o(s);return m||(typeof s=="string"&&/^(?:hold|spring|wiggle|custom)(?:\\(|$)/.test(s.trim())&&Ne("custom_ease_parse_failed",{ease:s}),t.call(u,s,...c)??Mx)};e.parseEase=function(u,...c){return a(u,this,c)};let l=e.registerEase;if(typeof l=="function"){l("hold",uf);let s=u=>{let c=m=>m;c.config=(...m)=>a(`${u}(${m.join(",")})`,e),l(u,c)};s("spring"),s("wiggle"),s("custom")}return e.__hfCustomEaseInstalled=!0,!0}var za="data-hf-authored-duration",qa="data-hf-authored-end",ff=!1;function ot(e){if(e){if(typeof e.pause!="function"){ff||(ff=!0,Ne("timeline_missing_pause",{}));return}try{e.pause()}catch(t){L("runtime.timeline.pause",t)}}}function Px(){let e=window.__HF_EXPORT_RENDER_SEEK_CONFIG,t=e?.fps,n=e?.fpsSource,r=Number(t);return!e||t==null?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"missing"}:!Number.isFinite(r)||r<=0?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"invalid"}:{fps:r,source:n==="render-options"||n==="default"?n:"unknown",rawFpsSource:n,rawFps:t,fallbackReason:e.fpsFallbackReason}}function mf(){let e=iu();As(xe),ai(document),wa(document),bl(document);let t=Px();e.canonicalFps=t.fps??e.canonicalFps,vs(e.canonicalFps),window.__HF_EXPORT_RENDER_SEEK_CONFIG&&console.info("[hyperframes] render runtime fps",{canonicalFps:e.canonicalFps,source:t.source,rawFpsSource:t.rawFpsSource,rawFps:t.rawFps,fallbackReason:t.fallbackReason});let n=null,r=null,i=null,o=[],a=new Set,l=null,s=new Set,u=(d,g,h)=>{s.has(d)||(s.add(d),Ne(g,h))};if(typeof window.__hfRuntimeTeardown=="function")try{window.__hfRuntimeTeardown()}catch(d){L("runtime.init.site1",d)}let c=new gi;e.transportClock=c;let m=new yi,f=!1;m.init().then(d=>{f=d}),window.__hf=window.__hf||{};let p=d=>d.closest("[data-hidden]")!==null||Lr(d.ownerDocument,d),b=()=>{let d=window.gsap,g=window;if(!(!d?.registerPlugin||g.__hfAutoNoopRegistered))try{d.registerPlugin({name:"_auto",init:()=>!1}),g.__hfAutoNoopRegistered=!0}catch(h){u("auto_marker_install_failed","auto_marker_install_failed",{reason:"threw"}),L("runtime.autoMarker.install",h)}},v=()=>{let d=window.gsap;if(!d){u("custom_ease_missing_gsap","custom_ease_install_failed",{reason:"missing_gsap"});return}try{df(d)||u("custom_ease_no_parse_ease","custom_ease_install_failed",{reason:"no_parseEase"})}catch(g){u("custom_ease_install_threw","custom_ease_install_failed",{reason:"threw"}),L("runtime.customEase.install",g)}};b(),v(),document.documentElement&&(document.documentElement.style.margin="0",document.documentElement.style.padding="0",document.documentElement.style.overflow="hidden"),document.body&&(document.body.style.margin="0",document.body.style.padding="0",document.body.style.overflow="hidden");try{ks(document)}catch(d){L("runtime.init.cssVariables",d)}window.__timelines=window.__timelines||{};let x=()=>{let d=document.querySelector(\'[data-composition-id][data-root="true"]\');if(d instanceof HTMLElement)return d;let g=Array.from(document.querySelectorAll("[data-composition-id]"));return g.find(h=>!h.parentElement?.closest("[data-composition-id]"))??g[0]??null};if(Array.isArray(window.__timelines)){let d=window.__timelines,g=x()?.getAttribute("data-composition-id")??"root",h={};if(d.length===1)h[g]=d[0];else for(let y=0;y<d.length;y++)h[`tl-${y}`]=d[y];window.__timelines=h}let _=x();_&&!_.hasAttribute("data-start")&&_.setAttribute("data-start","0");let R=d=>{o.push(d)},T=(d,g,h)=>{let y=h??`${d}:${JSON.stringify(g)}`;a.has(y)||(a.add(y),xe({source:"hf-preview",type:"diagnostic",code:d,details:g}))},M=d=>{let g={scale:1,focusX:960,focusY:540},h=[],y=[],w={time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:d.play,pause:d.pause,seek:d.seek,getTime:d.getTime,getDuration:d.getDuration,isPlaying:d.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>g,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>h,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:d.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>y,getRenderState:()=>({...w,time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying()})}},F=1/60,E=.75,S=.05,A=100,C=240,N=d=>{if(d instanceof Error)return d.message||String(d);if(typeof d=="string")return d;try{return JSON.stringify(d)}catch{return String(d??"")}},I=d=>{let g=d.toLowerCase();return g.includes("cannot read properties of null")||g.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:g.includes("failed to execute \'queryselector\'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:g.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},W=d=>{if(d==null||d.trim()==="")return null;let g=Number.parseFloat(d);return!Number.isFinite(g)||g<=0?null:`${g}px`},U=()=>x(),oe=()=>{let d=U();if(!d)return;let g=W(d.getAttribute("data-width")),h=W(d.getAttribute("data-height"));g&&(d.style.width=g),h&&(d.style.height=h),g&&d.style.setProperty("--comp-width",g),h&&d.style.setProperty("--comp-height",h)},k=()=>{let d=U(),g=Array.from(document.querySelectorAll("[data-composition-id]")).filter(h=>h.hasAttribute("data-duration")||h.hasAttribute("data-end"));for(let h of g){if(d&&h===d)continue;let y=h.getAttribute("data-duration"),w=h.getAttribute("data-end");y!=null&&!h.hasAttribute(za)&&h.setAttribute(za,y),w!=null&&!h.hasAttribute(qa)&&h.setAttribute(qa,w),h.removeAttribute("data-duration"),h.removeAttribute("data-end")}},V=()=>{let d=U();if(!d)return;d.style.position||(d.style.position="relative"),d.style.overflow="hidden";let g=W(d.getAttribute("data-width")),h=W(d.getAttribute("data-height"));g&&(d.style.width=g),h&&(d.style.height=h);let y=Array.from(d.children);for(let w of y){let D=w.tagName.toLowerCase();if(D==="script"||D==="style"||D==="link"||D==="meta"||!w.hasAttribute("data-start")||w.hasAttribute("data-hf-autostamped"))continue;let B=(w.style.top==="0px"||w.style.top==="0")&&(w.style.left==="0px"||w.style.left==="0")&&w.style.width==="100%"&&w.style.height==="100%",te=/translate\\(\\s*-50%\\s*,\\s*-50%\\s*\\)/.test(w.style.transform);if(B&&te&&!w.hasAttribute("data-width")&&!w.hasAttribute("data-height")){let ne=w.style.top,fn=w.style.left,Ce=w.style.width,mn=w.style.height;w.style.top="",w.style.left="",w.style.width="",w.style.height="";let ae=window.getComputedStyle(w);ae.top!=="auto"||ae.bottom!=="auto"||ae.left!=="auto"||ae.right!=="auto"||ae.width!=="0px"||ae.height!=="0px"||(w.style.top=ne,w.style.left=fn,w.style.width=Ce,w.style.height=mn)}let $=window.getComputedStyle(w),de=$.position;if(de!=="absolute"&&de!=="fixed"&&(w.style.position="absolute"),!!w.style.top||!!w.style.bottom||$.top!=="auto"||$.bottom!=="auto"||(w.style.top="0"),!!w.style.left||!!w.style.right||$.left!=="auto"||$.right!=="auto"||(w.style.left="0"),D!=="audio"){let ne=W(w.getAttribute("data-width")),fn=W(w.getAttribute("data-height")),Ce=$.width!=="0px"&&$.width!=="auto",mn=$.height!=="0px"&&$.height!=="auto";ne?!w.style.width&&!Ce&&(w.style.width=ne):!w.style.width&&$.width==="0px"&&(w.style.width="100%"),fn?!w.style.height&&!mn&&(w.style.height=fn):!w.style.height&&$.height==="0px"&&(w.style.height="100%")}}},J=(d,g=0,h)=>ft({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:h?.includeAuthoredTimingAttrs??!0}).resolveStartForElement(d,g),H=(d,g)=>ft({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:g?.includeAuthoredTimingAttrs??!0}).resolveDurationForElement(d),G=d=>{let g=d.closest("[data-composition-id]"),h=g?J(g,0):null,y=g?H(g,{includeAuthoredTimingAttrs:!0}):null;return{compositionRoot:g,inheritedStart:h,inheritedDuration:y}},z=d=>{let g=G(d),h=g.inheritedStart??0,y=Gt(d.getAttribute("data-start"));if(d.hasAttribute("data-hf-auto-start")||y==null||h<=0)return J(d,h);let w=ye(d.getAttribute("data-duration")),D=g.inheritedDuration,B=D!=null&&D>0?h+D:null,te=w!=null&&w>0?y+w:y;return(B==null?y>=h:y<B&&(te>h||y===h))?y:h+y};window.__hfResolveMediaStartSeconds=z,o.push(()=>{window.__hfResolveMediaStartSeconds===z&&delete window.__hfResolveMediaStartSeconds});let X=(d,g)=>{let h=d.tagName.toLowerCase();if(h==="script"||h==="style"||h==="link"||h==="meta")return!1;let w=h==="video"||h==="audio"?z(d):J(d,0),D=H(d),B=d.getAttribute("data-composition-id");if(B){let $=(window.__timelines??{})[B],de=null;if($&&typeof $.duration=="function"){let ve=Number($.duration());Number.isFinite(ve)&&ve>0&&(de=ve)}!(d.hasAttribute("data-duration")||d.hasAttribute("data-end")||d.hasAttribute(za)||d.hasAttribute(qa))&&(D==null||D<=0)&&de!=null&&(D=de)}let te=D!=null&&D>0?w+D:Number.POSITIVE_INFINITY;return g>=w&&(Number.isFinite(te)?g<te:!0)},we=!!document.querySelector("[data-composition-src]"),q=!1;{let d=document.querySelectorAll("[data-composition-id]:not([data-composition-src])");for(let g of d){let h=g.getAttribute("data-composition-id");if(h&&g.children.length===0&&document.querySelector(`template#${CSS.escape(h)}-template`)){q=!0;break}}}let P=!we&&!q,O=d=>{if(!d||typeof d.duration!="function")return null;try{let g=Number(d.duration());return Number.isFinite(g)?Math.max(0,g):null}catch{return null}},j=d=>typeof d=="number"&&Number.isFinite(d)&&d>F,le=d=>{let g=ye(d.getAttribute("data-duration"));return g!=null&&g>0?g:Number.isFinite(d.duration)?Ze(d,d.duration):null},Z=()=>{let d=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(d.length===0)return null;let g=0;for(let h of d){let y=z(h);if(!Number.isFinite(y))continue;let w=le(h);w==null||w<=F||(g=Math.max(g,Math.max(0,y)+w))}return g>F?g:null},K=()=>{let d=U();if(!d)return null;let g=window.__timelines??{},h=ft({timelineRegistry:g,includeAuthoredTimingAttrs:!0}),y=0,w=ye(d.getAttribute("data-duration"));w!=null&&w>0&&(y=w);let D=Array.from(d.querySelectorAll("[data-composition-id][data-start]"));for(let B of D){if(!(B instanceof Element)||B.parentElement?.closest("[data-composition-id]")!==d)continue;let $=h.resolveStartForElement(B,0),de=h.resolveDurationForElement(B);!Number.isFinite($)||de==null||de<=0||(y=Math.max(y,Math.max(0,$)+de))}return y>F?y:null},Y=()=>{let d=Z();return typeof d!="number"||!Number.isFinite(d)||d<=F?null:d},Ve=d=>j(d)?Math.max(F,d*E):F,Fe=()=>{let d=0;for(let g of e.deterministicAdapters){let h=g.getInferredDurationSeconds;if(typeof h!="function")continue;let y=null;try{y=h()}catch(w){L("runtime.init.adapterDuration",w)}typeof y=="number"&&Number.isFinite(y)&&y>0&&(d=Math.max(d,y))}return d>F?d:null},ke=(d,g=0)=>{let h=O(d),y=Y(),w=K(),D=Fe(),B=Math.max(y??0,w??0,D??0),te=Number.isFinite(g)&&g>F?g:0,$=0;return j(h)?$=Math.max(h,B,te):j(B)?$=Math.max(B,te):$=te,$>0?Math.max(0,$):0},ze=()=>{let d=window.__timelines??{},g=ae=>{let re=Object.entries(d).filter(se=>!!se[1]&&typeof se[1].play=="function"&&typeof se[1].pause=="function");if(re.length!==1)return{timeline:null};let he=re[0];if(!he)return{timeline:null};let[be,fe]=he;return{timeline:fe,selectedTimelineIds:[be],selectedDurationSeconds:O(fe),diagnostics:{code:"root_timeline_sole_registered_fallback",details:{reason:ae,soleTimelineId:be}}}},h=ft({timelineRegistry:d,includeAuthoredTimingAttrs:!0}),y=Y(),w=K(),D=Math.max(y??0,w??0)||null,B=Ve(D),te=ae=>{let re=document.querySelector(`[data-composition-id="${CSS.escape(ae)}"]`);return re?h.resolveStartForElement(re,0):0},$=ae=>{let re=window.gsap;if(!re||typeof re.timeline!="function")return null;let he=re.timeline({paused:!0});for(let be of ae)he.add(be.timeline,te(be.compositionId));return he},de=(ae,re)=>{if(!j(ae))return null;let he=window.gsap;if(!he||typeof he.timeline!="function")return null;let be=he.timeline({paused:!0});if(re)try{be.add(re,0)}catch(se){L("runtime.init.site2",se)}let fe=be;if(typeof fe.to=="function")try{fe.to({},{duration:ae})}catch(se){L("runtime.init.site3",se)}return be},He=(ae,re)=>{let he=ae;if(typeof he.getChildren!="function")return[];try{let be=he.getChildren(!0,!0,!0)??[];if(!Array.isArray(be))return[];let fe=[];for(let se of re)if(!be.some(Qe=>Qe===se.timeline))try{let Qe=te(se.compositionId);ae.add(se.timeline,Qe),fe.push(se.compositionId)}catch(Qe){L("runtime.init.site4",Qe)}return fe}catch{return[]}},ve=U(),ee=ve?.getAttribute("data-composition-id")??null;if(!ee)return g("root_missing_composition_id");let ne=d[ee]??null,Ce=(()=>{if(!ve)return[];let ae=new Set,re=Array.from(ve.querySelectorAll("[data-composition-id]")),he=[];for(let be of re){let fe=be.getAttribute("data-composition-id");if(!fe||fe===ee||ae.has(fe))continue;ae.add(fe);let se=d[fe]??null;if(!se||typeof se.play!="function"||typeof se.pause!="function")continue;let st=O(se);he.push({compositionId:fe,timeline:se,durationSeconds:st??0})}return he})(),mn=ae=>{for(let re of ae){let he=re.timeline;if(typeof he.paused=="function")try{he.paused(!1)}catch(be){L("runtime.init.site5",be)}}};if(Ce.length>0&&mn(Ce),ne){let ae=Ce.length>0?He(ne,Ce):[];if((Ce.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id=\'"+ee+"\'])"))&&(Ri=!0),ae.length>0)try{let fe=ne.time();ne.seek(fe,!1)}catch{}let re=O(ne);if(!j(re)&&Ce.length>0){let fe=Ce.map(hm=>hm.compositionId),se=$(Ce),st=O(se);if(se&&j(st))return{timeline:se,selectedTimelineIds:fe,selectedDurationSeconds:st,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:ee,rootDurationSeconds:re,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:B,selectedDurationSeconds:st,mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedTimelineIds:fe,autoNestedChildren:ae}}};let Qe=de(D??0,ne),Bi=O(Qe);if(Qe&&j(Bi))return{timeline:Qe,selectedTimelineIds:[ee],selectedDurationSeconds:Bi,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:ee,rootDurationSeconds:re,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:Bi,selectedTimelineIds:[ee],autoNestedChildren:ae}}}}if(!j(re)&&Ce.length===0){let fe=de(D??0,ne),se=O(fe);if(fe&&j(se))return{timeline:fe,selectedTimelineIds:[ee],selectedDurationSeconds:se,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:ee,rootDurationSeconds:re,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:se,selectedTimelineIds:[ee]}}}}let he=ye(ve?.getAttribute("data-duration")),be=Math.max(j(he)?he:0,w??0);if(be>0&&j(be)&&j(re)&&be>=re+.5){let fe=ne;if(typeof fe.to=="function")try{fe.to({},{duration:0},be)}catch(st){L("runtime.init.site6",st)}let se=O(ne);if(j(se))return{timeline:ne,selectedTimelineIds:[ee],selectedDurationSeconds:se,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:ee,rootDurationSeconds:re,rootDeclaredDur:he,authoredCompositionDurationFloorSeconds:w,newDur:se}}}}return{timeline:ne,selectedTimelineIds:[ee],selectedDurationSeconds:re,mediaDurationFloorSeconds:y,diagnostics:ae.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:ee,selectedDurationSeconds:re,autoNestedChildren:ae}}:void 0}}if(Ce.length>0){let ae=Ce.map(be=>be.compositionId),re=$(Ce),he=O(re);if(re)return{timeline:re,selectedTimelineIds:ae,selectedDurationSeconds:he,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:ee,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:B,selectedDurationSeconds:he,mediaDurationFloorSeconds:y,selectedTimelineIds:ae}}}}return g("root_composition_id_unmatched_in_registry")},Ri=!1,Kf=d=>{let g=window.gsap,h=d;if(!(!h||typeof h.getChildren!="function"||!g||typeof g.parseEase!="function"))for(let y of h.getChildren(!0,!0,!0)){let w=y,D=w.timeline;if(!D||!("_ease"in D)||typeof D._ease=="function")continue;let B=w.vars?.keyframes,$=(B&&!Array.isArray(B)?B.ease:void 0)??w.vars?.ease??"none";try{let de=g.parseEase($);typeof de=="function"&&(D._ease=de)}catch(de){Ne("keyframe_ease_repair_failed",{ease:typeof $=="string"?$:String($)}),L("runtime.keyframeEase.repair",de)}}},sn=()=>{if(v(),!P)return!1;let d=e.capturedTimeline,g=O(d),h=j(g);if(d&&h&&Ri)return!1;let y=ze();if(!y.timeline)return!1;if(d&&d===y.timeline)return typeof d.timeScale=="function"&&d.timeScale(e.playbackRate),!1;e.capturedTimeline=y.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate),Kf(e.capturedTimeline);let w=ke(e.capturedTimeline,0);if(w<=0&&typeof e.capturedTimeline.progress=="function"&&(e.capturedTimeline.progress(1,!0),e.capturedTimeline.progress(0,!1),ot(e.capturedTimeline)),w>0){try{c.setDuration(w)}catch{}if(typeof e.capturedTimeline.totalTime=="function"){typeof e.capturedTimeline.progress=="function"&&e.capturedTimeline.progress(1e-4,!0);let B=Math.max(0,e.currentTime||0);e.capturedTimeline.totalTime(B,!1),ot(e.capturedTimeline)}let D=window.__hfStudioManualEditsApply;typeof D=="function"&&D(),ai(document)}if(y.diagnostics&&xe({source:"hf-preview",type:"diagnostic",code:y.diagnostics.code,details:y.diagnostics.details}),xe({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:y.selectedTimelineIds??[],selectedDurationSeconds:y.selectedDurationSeconds??null,mediaDurationFloorSeconds:y.mediaDurationFloorSeconds??null}}),window.parent!==window){let D=U(),B=w>0?w:0,te=String(B>0?B:1),$=new Set,de=ee=>ee.tagName.toLowerCase()===Bt,He=new Set(document.querySelectorAll("[data-start]")),ve=ee=>{let ne=ee.parentElement;for(;ne&&ne!==D;){if(He.has(ne))return!0;ne=ne.parentElement}return!1};if(e.capturedTimeline.getChildren)try{for(let ee of e.capturedTimeline.getChildren(!0))if(typeof ee.targets=="function")for(let ne of ee.targets())ne instanceof HTMLElement&&ne!==D&&(de(ne)||ne.hasAttribute("data-start")||ve(ne)||$.has(ne)||($.add(ne),ne.setAttribute("data-start","0"),ne.setAttribute("data-duration",te),ne.setAttribute("data-hf-autostamped","1")))}catch{}if(D instanceof HTMLElement)for(let ee of D.querySelectorAll("[id]"))ee instanceof HTMLElement&&ee!==D&&(ee.hasAttribute("data-start")||ve(ee)||$.has(ee)||ee.tagName==="SCRIPT"||ee.tagName==="STYLE"||ee.tagName==="LINK"||de(ee)||($.add(ee),ee.setAttribute("data-start","0"),ee.setAttribute("data-duration",te),ee.setAttribute("data-hf-autostamped","1")))}for(let D of ln)fr.delete(D),os(D);return!0};window.__hfForceTimelineRebind=()=>{Ri=!1,sn(),Li(e.currentTime)};let Yf=()=>{let d=U();if(!(d instanceof HTMLElement))return;let g=d.getBoundingClientRect(),h=Number(d.getAttribute("data-width")),y=Number(d.getAttribute("data-height")),w=window.getComputedStyle(d),D=Number.isFinite(h)&&h>0&&Number.isFinite(y)&&y>0,B=g.width<=0||g.height<=0||d.clientWidth<=0||d.clientHeight<=0;!D||!B||T("root_stage_layout_zero",{compositionId:d.getAttribute("data-composition-id")??null,declaredWidth:h,declaredHeight:y,rectWidth:Math.round(g.width),rectHeight:Math.round(g.height),clientWidth:d.clientWidth,clientHeight:d.clientHeight,display:w.display,visibility:w.visibility,overflow:w.overflow},`root-stage-layout-zero:${d.getAttribute("data-composition-id")??"unknown"}`)},Xf=()=>{e.tornDown||(l!=null&&window.cancelAnimationFrame(l),l=window.requestAnimationFrame(()=>{l=null,Yf()}))},Jf=()=>{r=d=>{let g=N(d.error??d.message).slice(0,C);if(!g)return;let h=I(g);xe({source:"hf-preview",type:"diagnostic",code:h.code,details:{category:h.category,message:g,filename:d.filename||null,line:Number.isFinite(d.lineno)?d.lineno:null,column:Number.isFinite(d.colno)?d.colno:null}})},i=d=>{let g=N(d.reason).slice(0,C);if(!g)return;let h=I(g);xe({source:"hf-preview",type:"diagnostic",code:`${h.code}_unhandled_rejection`,details:{category:`${h.category}-unhandled-rejection`,message:g}})},window.addEventListener("error",r),window.addEventListener("unhandledrejection",i)},Qf=()=>{let d=Array.from(document.querySelectorAll("img, video, audio, source, link[rel=\'stylesheet\']"));for(let h of d){let y=()=>{if(!(h instanceof Element))return;let w=h.tagName.toLowerCase(),D=h.getAttribute("src")??h.getAttribute("href")??h.getAttribute("poster")??null,B=w==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";T(B,{tagName:w,assetUrl:D,currentSrc:(h instanceof HTMLImageElement||h instanceof HTMLMediaElement)&&h.currentSrc||null,readyState:h instanceof HTMLMediaElement?h.readyState:null,networkState:h instanceof HTMLMediaElement?h.networkState:null},`${B}:${w}:${D??"unknown"}`)};h.addEventListener("error",y),R(()=>{h.removeEventListener("error",y)})}let g=document.fonts;g&&g.ready.then(()=>{if(e.tornDown)return;let h=Array.from(g).filter(y=>y.status==="error").map(y=>y.family).filter(y=>!!y).slice(0,10);h.length!==0&&T("runtime_font_load_issue",{failedFamilies:h,totalFaces:Array.from(g).length},`runtime-font-load-issue:${h.join("|")}`)}).catch(()=>{})},Zf=(d,g)=>{if(!d.timeline)return!1;let h=e.capturedTimeline;if(h&&h===d.timeline)return!1;let y=Math.max(0,e.currentTime||0),w=e.isPlaying;e.capturedTimeline=d.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);try{ot(e.capturedTimeline),typeof e.capturedTimeline.seek=="function"&&e.capturedTimeline.seek(y,!1),w&&typeof e.capturedTimeline.play=="function"&&e.capturedTimeline.play()}catch(D){L("runtime.init.site7",D)}return xe({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:g,previousTime:y,selectedTimelineIds:d.selectedTimelineIds??[],selectedDurationSeconds:d.selectedDurationSeconds??null,mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),!0},At=null,ts=!1,ns=!1,ln=new Set,fr=new WeakMap,mr=()=>{e.tornDown||(At!=null&&window.clearTimeout(At),At=window.setTimeout(()=>{if(e.tornDown||(At=null,ns&&window.__HF_EXPORT_RENDER_SEEK_CONFIG))return;let d=ze();if(!d.timeline||!j(d.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){sn()&&(Et(),Me(!0));return}if(ts)return;let h=O(e.capturedTimeline),y=d.selectedDurationSeconds??O(d.timeline);j(y)&&(!j(h)||y>=h+S)&&Zf(d,"manual")&&(ts=!0,xe({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:h??null,selectedDurationSeconds:y??null,selectedTimelineIds:d.selectedTimelineIds??[],mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),Et(),Me(!0))},A))},rs=d=>{d.currentTarget instanceof HTMLMediaElement&&Cl(d.currentTarget)},is=d=>{d.currentTarget instanceof HTMLMediaElement&&_l(d.currentTarget)},em=()=>{for(let d of ln)d.removeEventListener("loadedmetadata",mr),d.removeEventListener("durationchange",mr),d.removeEventListener("loadedmetadata",rs),d.removeEventListener("error",is);ln.clear()},ki=()=>{if(e.tornDown)return;let d=Array.from(document.querySelectorAll("video, audio"));for(let g of d){if(ln.has(g))continue;ln.add(g);let h=Number.parseFloat(g.dataset.volume??"");Number.isFinite(h)&&(g.volume=Math.max(0,Math.min(1,h))),g.addEventListener("loadedmetadata",mr),g.addEventListener("durationchange",mr),g.addEventListener("loadedmetadata",rs),g.addEventListener("error",is),wl(g),g.preload!=="auto"&&(g.preload="auto"),g.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&g.load(),os(g)}},os=d=>{fr.has(d)||rl(d,e.capturedTimeline,ke(e.capturedTimeline,0),fr,{allowLiveTimelineSeek:!window.__HF_RENDER_CAPTURE_MODE})},Mi=new WeakMap,as=d=>{let g=Mi.get(d);if(g!==void 0)return g;let h=window.getComputedStyle(d).position,y=h==="static"||h==="relative"||h==="sticky";return Mi.set(d,y),y},Fi=new WeakMap,tm=d=>{let g=Fi.get(d);if(g!==void 0)return g;let h=d.querySelector("[data-start]")===null;return Fi.set(d,h),h},nm=()=>{Mi=new WeakMap,Fi=new WeakMap},Ni=new WeakMap,pr=new WeakSet,hr=!1,ss=d=>d.matches("audio[data-start]")||d.querySelector("audio[data-start]")!==null,ls=new WeakMap,gr=!0,rm=()=>{if(gr){gr=!1;for(let d of document.querySelectorAll(Bt)){let g=d.hasAttribute("data-hidden");ls.get(d)!==g&&(ls.set(d,g),d.id&&m.setGroupMuted(d.id,g))}}},Li=(d,g=Array.from(document.querySelectorAll("[data-start]")))=>{let h=U();for(let y of g){if(!(y instanceof HTMLElement))continue;if(y.hasAttribute("data-hidden")){pr.has(y)||(Ni.set(y,y.style.getPropertyValue("display")),pr.add(y),ss(y)&&(hr=!0),gr=!0),y.style.display="none",(y instanceof HTMLVideoElement||y instanceof HTMLImageElement)&&n?.setSourceVisibility(y,!1);continue}if(pr.has(y)){let D=Ni.get(y);D?y.style.display=D:y.style.removeProperty("display"),Ni.delete(y),pr.delete(y),ss(y)&&(hr=!0),gr=!0}let w=X(y,d);if(w){let D=y.parentElement;for(;D&&D!==h;){if(D instanceof HTMLElement&&D.hasAttribute("data-start")&&!X(D,d)){w=!1;break}D=D.parentElement}}y.style.visibility=w?"visible":"hidden",(y instanceof HTMLVideoElement||y instanceof HTMLImageElement)&&n?.setSourceVisibility(y,w),w?as(y)&&y.style.removeProperty("display"):as(y)&&tm(y)&&(y.style.display="none")}hr&&c.isPlaying()&&(m.stopAll(),Gi()),hr=!1,rm()},Pe=()=>{let d=yl({shouldIncludeElement:h=>h.hasAttribute("data-start")||!!G(h).compositionRoot,resolveStartSeconds:h=>z(h),resolveDurationSeconds:h=>{let y=G(h),w=z(h),D=y.inheritedStart!=null&&y.inheritedDuration!=null&&y.inheritedDuration>0?Math.max(0,y.inheritedStart+y.inheritedDuration-w):null,B=Number.isFinite(h.duration)?Ze(h,h.duration):null,te=ye(h.dataset.duration),$=te!=null&&te>0?te:null;return xl({isVideo:h.tagName==="VIDEO",sourceDuration:B,hostRemaining:D,explicitDuration:$})}});for(let h of d.mediaClips){let y=fr.get(h.el);y&&(h.volumeKeyframes=y)}let g=e.mediaForceSyncNextTick;g&&(e.mediaForceSyncNextTick=!1),e.nativeMediaSyncDisabled||vl({clips:d.mediaClips,timeSeconds:e.currentTime,playing:e.isPlaying,playbackRate:e.playbackRate,outputMuted:e.mediaOutputMuted,userMuted:e.bridgeMuted,userVolume:e.bridgeVolume,forceSync:g,onElementVolume:(h,y,w)=>m.setElementVolume(h,w),isWebAudioOwned:h=>m.ownsElement(h),isWebAudioRouted:h=>m.routesElement(h),onAutoplayBlocked:()=>{e.mediaAutoplayBlockedPosted||(e.mediaAutoplayBlockedPosted=!0,xe({source:"hf-preview",type:"media-autoplay-blocked"}))}}),Li(e.currentTime)},Me=d=>{let g=Math.max(0,Math.round((e.currentTime||0)*e.canonicalFps)),h=Date.now();(d||g!==e.bridgeLastPostedFrame||e.isPlaying!==e.bridgeLastPostedPlaying||e.bridgeMuted!==e.bridgeLastPostedMuted||h-e.bridgeLastPostedAt>=e.bridgeMaxPostIntervalMs)&&(e.bridgeLastPostedFrame=g,e.bridgeLastPostedPlaying=e.isPlaying,e.bridgeLastPostedMuted=e.bridgeMuted,e.bridgeLastPostedAt=h,xe({source:"hf-preview",type:"state",frame:g,isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},Di="",us=0,im=()=>{let d="";for(let g of document.querySelectorAll("[data-start]"))d+=`${g.id}:${g.tagName}|`;return d},Et=()=>{k(),oe(),V();let d=U();if(d){let y=W(d.getAttribute("data-width")),w=W(d.getAttribute("data-height")),D=y?parseInt(y,10):0,B=w?parseInt(w,10):0;D>0&&B>0&&xe({source:"hf-preview",type:"stage-size",width:D,height:B})}sn();let g=uu({canonicalFps:e.canonicalFps});window.__clipManifest=g;let h=im();if(Di!==h&&nm(),!window.__clipTree||Di!==h){let y=window;window.__clipTree=ou({startResolver:ft({timelineRegistry:y.__timelines??{},includeAuthoredTimingAttrs:!0}),timelineRegistry:y.__timelines??{},rootDuration:g.durationInFrames/e.canonicalFps}),Di=h}xe(g),Xf()},Ii=d=>typeof d=="number"&&Number.isFinite(d)&&d>0?d:0,om=d=>{let g=Ii(Number(d));if(g<=0)return;let h=U(),y=Ii(ye(h?.getAttribute("data-duration"))),w=Math.max(us,Ii(c.getDuration()),y);g<=w||(us=g,h?.setAttribute("data-duration",String(g)),c.setDuration(g),Et(),Me(!0))},Oe=(d,g=0)=>{for(let h of e.deterministicAdapters){try{d==="discover"&&h.discover(),d==="pause"&&h.pause(),d==="play"&&h.play&&h.play()}catch(y){L("runtime.init.site8",y)}if(d==="discover")try{h.seek({time:g,suppressEvents:!0})}catch(y){L("runtime.init.site9",y)}}},wt=()=>{window.__renderReady=!1},un=null,cn=!0,am=()=>{let d=[];for(let g of e.deterministicAdapters){let h=g.getReadyPromise;if(typeof h=="function")try{let y=h();y&&d.push(y)}catch(y){L("runtime.init.adapterReady",y)}}return d},sm=()=>{let d=am();if(d.length===0)return un=null,cn=!0,!0;let g=d[0];if(!g)return!0;let h=d.length===1?g:Promise.all(d);return h!==un&&(un=h,cn=!1,Promise.resolve(h).then(()=>{un===h&&(cn=!0,wt())},y=>{un===h&&(cn=!0,L("runtime.init.adapterReady",y),wt())})),cn};if(P)ba();else{let d={injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,injectedLinks:e.injectedCompLinks,parseDimensionPx:W,onDiagnostic:({code:g,details:h})=>{xe({source:"hf-preview",type:"diagnostic",code:g,details:h})}};ed(d).then(()=>Zc(d)).finally(()=>{P=!0,ki(),Qf(),ba(),wa(document),wt()})}let br=eu({postMessage:d=>xe(d)});br.installPickerApi(),Li(e.currentTime,Array.from(document.querySelectorAll("video[data-start], img[data-start]")));let qe=Hd();n=qe,R(()=>{qe.destroy(),n=null});let Pi=d=>{let g=Number(d);!Number.isFinite(g)||g<=0?e.playbackRate=1:e.playbackRate=Math.max(.1,Math.min(5,g)),e.mediaForceSyncNextTick=!0,e.capturedTimeline&&typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);let h=document.querySelectorAll("video, audio");for(let y of h)if(y instanceof HTMLMediaElement)try{y.playbackRate=e.playbackRate}catch(w){L("runtime.init.site10",w)}},cs={play:()=>{let d=e.capturedTimeline;if(c.isPlaying())return;let g=ke(d,0);if(g>0)c.setDuration(g),c.reachedEnd()&&(c.seek(0),e.currentTime=0,Ct(0));else{let h=U(),y=Number(h?.getAttribute("data-duration")??0);y>0&&c.setDuration(y)}ot(d),c.play()&&(e.isPlaying=!0,e.mediaForceSyncNextTick=!0,gs(c.now()),f&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&Gi(),Oe("play"),Pe(),qe.redraw(),Me(!0))},pause:()=>{if(!c.isPlaying())return;m.stopAll(),c.detachAudioSource(),c.pause(),e.isPlaying=!1,e.currentTime=c.now(),e.mediaForceSyncNextTick=!0,gs(e.currentTime);let d=e.capturedTimeline;ot(d),Oe("pause"),Pe(),qe.redraw(),Me(!0)},seek:(d,g)=>{let h=qt(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),c.detachAudioSource();let y=c.isPlaying();y&&c.pause(),c.seek(h),e.currentTime=c.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0;let w=e.capturedTimeline;if(ot(w),Ct(e.currentTime),Oe("pause"),g?.keepPlaying&&y){cs.play();return}Pe(),qe.redraw(),Me(!0)},renderSeek:(d,g)=>{ns=!0;let h=qt(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),c.detachAudioSource(),c.isPlaying()&&c.pause(),c.seek(h),e.currentTime=c.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0,Ct(e.currentTime,{activateChildren:!0,suppressEvents:g?.suppressEvents}),Oe("pause"),Pe(),qe.redraw(),Me(!0)},getTime:()=>c.now(),getDuration:()=>{let d=c.getDuration();return Number.isFinite(d)?d:0},isPlaying:()=>c.isPlaying(),setPlaybackRate:d=>{Pi(d),c.setRate(e.playbackRate),bs()},getPlaybackRate:()=>e.playbackRate},ds=ke(e.capturedTimeline,0);ds>0&&c.setDuration(ds);let Ge=ru({getTimeline:()=>e.capturedTimeline,setTimeline:d=>{e.capturedTimeline=d},getTimelineRegistry:()=>window.__timelines??{},getIsPlaying:()=>e.isPlaying,setIsPlaying:d=>{e.isPlaying!==d&&(e.mediaForceSyncNextTick=!0),e.isPlaying=d},getPlaybackRate:()=>e.playbackRate,setPlaybackRate:Pi,getCanonicalFps:()=>e.canonicalFps,onSyncMedia:(d,g)=>{e.currentTime=Math.max(0,Number(d)||0),e.isPlaying!==g&&(e.mediaForceSyncNextTick=!0),e.isPlaying=g,Pe()},onStatePost:Me,onDeterministicSeek:(d,g)=>{for(let h of e.deterministicAdapters)if(!(h.name==="gsap"&&e.capturedTimeline))try{h.seek({time:Number(d)||0,suppressEvents:g?.suppressEvents})}catch(y){L("runtime.init.site11",y)}},onDeterministicPause:()=>Oe("pause"),onDeterministicPlay:()=>Oe("play"),onRenderFrameSeek:()=>{qe.redraw()},onShowNativeVideos:()=>{},getSafeDuration:()=>ke(e.capturedTimeline,0),transport:cs});window.__player=M(Ge),window.__playerReady=!0,Ne("composition_loaded",{duration:Ge.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),e.deterministicAdapters=[Ys(),Fs({resolveStartSeconds:d=>J(d,0)}),Ls(),Is(),Gs(),Hs(),Bs(),Us(),Ws(),Vs(),zs(),Ns({getTimeline:()=>e.capturedTimeline})],js(),Ks(),window.__hfReseekGpu=d=>{let g=Math.max(0,Number(d)||0);window.__hfThreeTime=g,window.__hfTypegpuTime=g,Cr(g)},window.__hfWaitForSeekCompletion=Ji,o.push(()=>{window.__hfWaitForSeekCompletion===Ji&&delete window.__hfWaitForSeekCompletion}),Jf(),ki(),Oe("discover");let lm=()=>{let d=e.capturedTimeline,g=sn();e.capturedTimeline&&(g||e.capturedTimeline!==d||!Ge._timeline)&&(Ge._timeline=e.capturedTimeline);let h=ke(e.capturedTimeline,0);if(h>0&&c.setDuration(h),Oe("discover",e.currentTime),!e.capturedTimeline){let y=window.__timelines??{},w=Object.keys(y).filter(D=>y[D]);if(w.length>0){let B=U()?.getAttribute("data-composition-id")??null;T("root_timeline_unbound_registry_present",{reason:B?"root data-composition-id has no matching key in window.__timelines":"root composition element has no data-composition-id attribute",rootCompositionId:B,registeredTimelineKeys:w},"root_timeline_unbound_registry_present"),console.warn("[hyperframes] Root timeline not bound \\u2014 render will freeze at t=0. "+(B?`Root data-composition-id is "${B}" but window.__timelines has no such key. `:"Root composition element has no data-composition-id. ")+`Registered timeline keys: [${w.join(", ")}]. Register the root timeline under its data-composition-id (window.__timelines["${B??"<root-id>"}"] = tl).`)}}window.__renderReady=!0,Et(),Me(!0)},Dt=null,um=()=>{if(Dt)return;let d=()=>{window.removeEventListener("hf-timelines-built",d),Dt=null,wt()};Dt=d,window.addEventListener("hf-timelines-built",d)};R(()=>{Dt&&(window.removeEventListener("hf-timelines-built",Dt),Dt=null)}),wt=()=>{if(!P){window.__renderReady=!1;return}if(window.__hfTimelinesBuilding){window.__renderReady=!1,um();return}if(Oe("discover",e.currentTime),!sm()){window.__renderReady=!1;return}lm()},wt(),P&&setTimeout(()=>{wt()},0);let xr=0,Oi=!1,cm=(d,g,h,y)=>{try{let w=y?.suppressEvents===!0;ot(d),typeof d.totalTime=="function"?d.totalTime(g,w):d.seek(g,w)}catch(w){L(h,w)}},dm=(d,g)=>{let h=window.__timelines??{},y=U()?.getAttribute("data-composition-id")??null;for(let[w,D]of Object.entries(h)){if(!D||w===y)continue;let B=document.querySelector(`[data-composition-id="${CSS.escape(w)}"]`);if(!B)continue;let te=J(B,0);if(!Number.isFinite(te))continue;let $=O(D),de=je(B)+Math.max(0,d-te)*_e(B),He=Math.max(0,$!=null&&$>0?Math.min($,de):de);cm(D,He,"runtime.init.transport.childTimeline",g)}},fs=d=>{let g=window.__timelines??{};for(let h of Object.values(g))if(!(!h||h===d))try{h.play()}catch(y){L("runtime.init.activateSiblings",y)}},ms=d=>typeof d=="object"&&d!==null,dn=new WeakMap,fm=["onStart","onUpdate","onComplete","onReverseComplete","onRepeat"],ps=(d,g)=>{let h=d[g];if(typeof h!="function")return null;try{let y=Number(h.call(d));return Number.isFinite(y)?y:null}catch(y){return L("runtime.init.gsapCallbackDuration",y),null}},mm=d=>{let g=dn.get(d);if(g!=null)return g;if(!("getChildren"in d)||typeof d.getChildren!="function")return!1;let h;try{h=d.getChildren(!0,!0,!0)}catch(y){return L("runtime.init.gsapCallbackChildren",y),dn.set(d,!1),!1}if(!Array.isArray(h))return dn.set(d,!1),!1;for(let y of h){if(!ms(y))continue;let w=y.vars;if(!ms(w)||!fm.some($=>typeof w[$]=="function"))continue;let te=ps(y,"totalDuration")??ps(y,"duration");if(te!=null&&te<=1e-6)return dn.set(d,!0),!0}return dn.set(d,!1),!1};function Ct(d,g){let h=e.capturedTimeline,y=g?.suppressEvents===!0;if(h){g?.activateChildren&&fs(h);let w=h,D=d;if(typeof w.totalDuration=="function")try{let B=Number(w.totalDuration());Number.isFinite(B)&&B>0&&d>B&&(D=B)}catch(B){L("runtime.init.transport.clampDuration",B)}try{typeof h.totalTime=="function"?(h.totalTime(D,y),!y&&!mm(h)&&(h.totalTime(D+.001,!0),h.totalTime(D,!0))):h.seek(D,y)}catch(B){L("runtime.init.transport.seek",B)}}dm(d,g),h&&g?.activateChildren&&fs(h);for(let w of e.deterministicAdapters)if(!(w.name==="gsap"&&h))try{w.seek({time:d,suppressEvents:y})}catch(D){L("runtime.init.transport.adapter",D)}}let pm=()=>{try{return document.querySelector(`[${nf}]`)!=null}catch{return!1}},hs=()=>{if(!(e.tornDown||Oi)){Oi=!0;try{if(e.transportRafId=window.requestAnimationFrame(hs),xr+=1,rf({tick:xr,isPlaying:c.isPlaying(),hasCapturedTimeline:e.capturedTimeline!=null,currentTimeSeconds:c.now()})){let g=e.capturedTimeline;if(sn()){e.capturedTimeline&&!Ge._timeline&&(Ge._timeline=e.capturedTimeline),e.capturedTimeline&&e.capturedTimeline!==g&&ot(e.capturedTimeline);let h=ke(e.capturedTimeline,0);h>0&&c.setDuration(h),Et()}}if(xr%20===0&&Et(),xr%30===0&&ki(),e.capturedTimeline){let g=ke(e.capturedTimeline,0);g>0&&(!c.isPlaying()||g>=c.getDuration())&&c.setDuration(g)}if(c.isPlaying()&&!e.mediaOutputMuted)if(!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&m.isActive()&&m.context){let g=m.getTime();g>=0&&c.attachAudioSource({currentTimeSeconds:g})}else{let g=document.querySelectorAll("audio[data-start]"),h=!1;for(let y of g){if(!(y instanceof HTMLMediaElement)||!y.isConnected||p(y))continue;let w=Number.parseFloat(y.dataset.start??""),D=ye(y.dataset.duration),B=D!=null&&D>0?w+D:1/0,te=je(y);if(Number.isFinite(w)&&e.currentTime>=w&&e.currentTime<B){y.paused?!y.error&&y.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&(c.attachAudioSource({currentTimeSeconds:e.currentTime}),h=!0):(c.attachAudioSource({el:y,compositionStart:w,mediaStart:te}),h=!0);break}}!h&&c.hasAudioSource()&&c.detachAudioSource()}else c.hasAudioSource()&&c.detachAudioSource();let d=c.now();if(e.currentTime=d,(c.isPlaying()||!pm())&&Ct(d),c.isPlaying()&&qe.redrawAnimated(),c.isPlaying()&&c.reachedEnd()){m.stopAll(),c.detachAudioSource(),c.pause(),e.isPlaying=!1;let g=c.getDuration();Number.isFinite(g)&&(c.seek(g),e.currentTime=g,Ct(g)),Oe("pause"),Pe(),Me(!0);return}c.isPlaying()&&Pe(),Me(!1)}finally{Oi=!1}}},gs=d=>{let g=document.querySelectorAll("video, audio");for(let h of g){if(!(h instanceof HTMLMediaElement)||!h.isConnected)continue;let y=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(y))continue;let w=ye(h.dataset.duration),D=w!=null&&w>0?y+w:1/0;if(d<y||d>=D)continue;let B=je(h),te=d-y+B;if(te>=0)try{h.currentTime=te}catch{}}},Gi=()=>{if(e.nativeMediaSyncDisabled||e.webAudioMediaDisabled)return;let d=m.startGeneration(),g=document.querySelectorAll("audio[data-start]");for(let h of g){if(!(h instanceof HTMLMediaElement)||!h.isConnected||p(h))continue;let y=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(y))continue;let w=je(h),D=Number.parseFloat(h.dataset.volume??""),B=Number.isFinite(D)?D:1,te=ye(h.dataset.duration),$=te!=null&&te>0?te:Number.POSITIVE_INFINITY,de=h.closest("[data-composition-id]");if(de){let He=J(de,0),ve=H(de,{includeAuthoredTimingAttrs:!0});ve!=null&&ve>0&&($=Math.min($,Math.max(0,He+ve-y)))}m.scheduleMediaElementPlayback(h,y,w,c.now(),B,d,e.playbackRate).then(He=>{if(He||!c.isPlaying())return;let ve=e.playbackRate*_e(h),ee=h.hasAttribute("data-fx-chain")||h.hasAttribute("data-automation");if(Math.abs(ve-1)>1e-9){ee&&(h.muted=!0);return}m.decodeAudioElement(h).then(ne=>{!ne||!c.isPlaying()||m.schedulePlayback(h,ne,y,w,c.now(),B,d,e.playbackRate,$)})})}};function bs(){m.setRate(e.playbackRate)&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&f&&c.isPlaying()&&m.hasBoundedActiveSources()&&(m.stopAll(),Gi())}if(e.capturedTimeline){let d=ke(e.capturedTimeline,0);d>0&&c.setDuration(d),ot(e.capturedTimeline)}ad(window),e.transportRafId=window.requestAnimationFrame(hs),Et(),Me(!0),e.controlBridgeHandler=Ss({onPlay:()=>{Ge.play(),Ne("composition_played",{time:Ge.getTime()})},onPause:()=>{Ge.pause(),Ne("composition_paused",{time:Ge.getTime()})},onStopMedia:()=>{m.stopAll();let d=document.querySelectorAll("video, audio");for(let g of d)g instanceof HTMLMediaElement&&!g.paused&&g.pause()},onSeek:(d,g)=>{Ge.seek(d),Ne("composition_seeked",{time:d})},onSetMuted:d=>{e.bridgeMuted=d;let g=d||e.mediaOutputMuted;m.setMuted(g);let h=document.querySelectorAll("video, audio");for(let y of h)y instanceof HTMLMediaElement&&(y.muted=g||y.defaultMuted)},onSetVolume:d=>{e.bridgeVolume=d,m.setVolume(d);let g=document.querySelectorAll("video, audio");for(let h of g){if(!(h instanceof HTMLMediaElement))continue;let y=parseFloat(h.dataset.volume??""),w=Number.isFinite(y)?y:1;h.volume=_r(w*d)}},onSetMediaOutputMuted:d=>{e.mediaOutputMuted=d;let g=d||e.bridgeMuted;m.setMuted(g);let h=document.querySelectorAll("video, audio");for(let y of h)y instanceof HTMLMediaElement&&(y.muted=g||y.defaultMuted)},onSetNativeMediaSyncDisabled:d=>{e.nativeMediaSyncDisabled!==d&&(e.nativeMediaSyncDisabled=d,e.mediaForceSyncNextTick=!0,d?(m.stopAll(),c.detachAudioSource()):Pe())},onSetWebAudioMediaDisabled:d=>{e.webAudioMediaDisabled!==d&&(e.webAudioMediaDisabled=d,e.mediaForceSyncNextTick=!0,d&&(m.stopAll(),c.detachAudioSource()),Pe())},onSetPlaybackRate:d=>{Pi(d),e.transportClock&&e.transportClock.setRate(e.playbackRate),bs()},onSetRootDuration:om,onSetColorGrading:(d,g)=>{qe.setGrading(d,g)},onSetColorGradingCompare:(d,g)=>{qe.setCompare(d,g)},onTick:()=>{if(e.tornDown||!c.isPlaying())return;let d=c.now();if(e.currentTime=d,Ct(d),c.reachedEnd()){m.stopAll(),c.detachAudioSource(),c.pause(),e.isPlaying=!1;let g=c.getDuration();Number.isFinite(g)&&(c.seek(g),e.currentTime=g,Ct(g)),Oe("pause"),Pe(),Me(!0)}},onEnablePickMode:()=>br.enablePickMode(),onDisablePickMode:()=>br.disablePickMode(),getCanonicalFps:()=>e.canonicalFps});let Hi=()=>{if(!e.tornDown){e.tornDown=!0,e.transportRafId!=null&&(window.cancelAnimationFrame(e.transportRafId),e.transportRafId=null),e.transportClock=null,m.destroy(),At!=null&&(window.clearTimeout(At),At=null),l!=null&&(window.cancelAnimationFrame(l),l=null),em(),e.controlBridgeHandler&&(window.removeEventListener("message",e.controlBridgeHandler),e.controlBridgeHandler=null),r&&(window.removeEventListener("error",r),r=null),i&&(window.removeEventListener("unhandledrejection",i),i=null),e.beforeUnloadHandler&&(window.removeEventListener("beforeunload",e.beforeUnloadHandler),e.beforeUnloadHandler=null),br.disablePickMode();for(let d of e.deterministicAdapters)if(!(!d||typeof d.revert!="function"))try{d.revert()}catch(g){L("runtime.init.site12",g)}e.deterministicAdapters=[];for(let d of o.splice(0))try{d()}catch(g){L("runtime.init.site13",g)}for(let d of e.injectedCompStyles)try{d.remove()}catch(g){L("runtime.init.site14",g)}e.injectedCompStyles=[];for(let d of e.injectedCompLinks)try{d.remove()}catch(g){L("runtime.init.site15",g)}e.injectedCompLinks=[];for(let d of e.injectedCompScripts)try{d.remove()}catch(g){L("runtime.init.site16",g)}e.injectedCompScripts=[],e.capturedTimeline=null,window.__hfRuntimeTeardown===Hi&&(window.__hfRuntimeTeardown=null)}};window.__hfRuntimeTeardown=Hi,e.beforeUnloadHandler=Hi,window.addEventListener("beforeunload",e.beforeUnloadHandler)}var pf=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],$a=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function Ox(e){if(e<=255)return pf[e];let t=0,n=$a.length-1;for(;t<=n;){let r=t+n>>1,i=$a[r];if(e<i[0]){n=r-1;continue}if(e>i[1]){t=r+1;continue}return i[2]}return"L"}function Gx(e){let t=e.length;if(t===0)return null;let n=new Array(t),r=!1;for(let u=0;u<t;){let c=e.charCodeAt(u),m=c,f=1;if(c>=55296&&c<=56319&&u+1<t){let b=e.charCodeAt(u+1);b>=56320&&b<=57343&&(m=(c-55296<<10)+(b-56320)+65536,f=2)}let p=Ox(m);(p==="R"||p==="AL"||p==="AN")&&(r=!0);for(let b=0;b<f;b++)n[u+b]=p;u+=f}if(!r)return null;let i=0;for(let u=0;u<t;u++){let c=n[u];if(c==="L"){i=0;break}if(c==="R"||c==="AL"){i=1;break}}let o=new Int8Array(t);for(let u=0;u<t;u++)o[u]=i;let a=i&1?"R":"L",l=a,s=l;for(let u=0;u<t;u++)n[u]==="NSM"?n[u]=s:s=n[u];s=l;for(let u=0;u<t;u++){let c=n[u];c==="EN"?n[u]=s==="AL"?"AN":"EN":(c==="R"||c==="L"||c==="AL")&&(s=c)}for(let u=0;u<t;u++)n[u]==="AL"&&(n[u]="R");for(let u=1;u<t-1;u++)n[u]==="ES"&&n[u-1]==="EN"&&n[u+1]==="EN"&&(n[u]="EN"),n[u]==="CS"&&(n[u-1]==="EN"||n[u-1]==="AN")&&n[u+1]===n[u-1]&&(n[u]=n[u-1]);for(let u=0;u<t;u++){if(n[u]!=="EN")continue;let c;for(c=u-1;c>=0&&n[c]==="ET";c--)n[c]="EN";for(c=u+1;c<t&&n[c]==="ET";c++)n[c]="EN"}for(let u=0;u<t;u++){let c=n[u];(c==="WS"||c==="ES"||c==="ET"||c==="CS")&&(n[u]="ON")}s=l;for(let u=0;u<t;u++){let c=n[u];c==="EN"?n[u]=s==="L"?"L":"EN":(c==="R"||c==="L")&&(s=c)}for(let u=0;u<t;u++){if(n[u]!=="ON")continue;let c=u+1;for(;c<t&&n[c]==="ON";)c++;let m=u>0?n[u-1]:l,f=c<t?n[c]:l,p=m!=="L"?"R":"L";if(p===(f!=="L"?"R":"L"))for(let v=u;v<c;v++)n[v]=p;u=c-1}for(let u=0;u<t;u++)n[u]==="ON"&&(n[u]=a);for(let u=0;u<t;u++){let c=n[u];(o[u]&1)===0?c==="R"?o[u]++:(c==="AN"||c==="EN")&&(o[u]+=2):(c==="L"||c==="AN"||c==="EN")&&o[u]++}return o}function hf(e,t){let n=Gx(e);if(n===null)return null;let r=new Int8Array(t.length);for(let i=0;i<t.length;i++)r[i]=n[t[i]];return r}var Hx=/[ \\t\\n\\r\\f]+/g,Bx=/[\\t\\n\\r\\f]| {2,}|^ | $/;function Ux(e){let t=e??"normal";return t==="pre-wrap"?{mode:t,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:t,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function Wx(e){if(!Bx.test(e))return e;let t=e.replace(Hx," ");return t.charCodeAt(0)===32&&(t=t.slice(1)),t.length>0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}function Vx(e){return/[\\r\\f]/.test(e)?e.replace(/\\r\\n/g,`\n`).replace(/[\\r\\f]/g,`\n`):e.replace(/\\r\\n/g,`\n`)}var ja=null,zx;function qx(){return ja===null&&(ja=new Intl.Segmenter(zx,{granularity:"word"})),ja}var $x=/\\p{Script=Arabic}/u,Si=/\\p{M}/u,Ef=/\\p{Nd}/u;function gf(e){return $x.test(e)}function bf(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519}function We(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(!(n<12288)){if(n>=55296&&n<=56319&&t+1<e.length){let r=e.charCodeAt(t+1);if(r>=56320&&r<=57343){let i=(n-55296<<10)+(r-56320)+65536;if(bf(i))return!0;t++;continue}}if(bf(n))return!0}}return!1}function jx(e){let t=wi(e);return t!==null&&(Ei.has(t)||yt.has(t))}var Kx=new Set(["\\xA0","\\u202F","\\u2060","\\uFEFF"]);function Yx(e){return We(e)}function Xx(e){let t=wi(e);return t!==null&&Kx.has(t)}function Ai(e){return!jx(e)&&!Xx(e)}var Ei=new Set(["\\uFF0C","\\uFF0E","\\uFF01","\\uFF1A","\\uFF1B","\\uFF1F","\\u3001","\\u3002","\\u30FB","\\uFF09","\\u3015","\\u3009","\\u300B","\\u300D","\\u300F","\\u3011","\\u3017","\\u3019","\\u301B","\\u30FC","\\u3005","\\u303B","\\u309D","\\u309E","\\u30FD","\\u30FE"]),dr=new Set([\'"\',"(","[","{","\\u201C","\\u2018","\\xAB","\\u2039","\\uFF08","\\u3014","\\u3008","\\u300A","\\u300C","\\u300E","\\u3010","\\u3016","\\u3018","\\u301A"]),Ya=new Set(["\'","\\u2019"]),yt=new Set([".",",","!","?",":",";","\\u060C","\\u061B","\\u061F","\\u0964","\\u0965","\\u104A","\\u104B","\\u104C","\\u104D","\\u104F",")","]","}","%",\'"\',"\\u201D","\\u2019","\\xBB","\\u203A","\\u2026"]),Jx=new Set([":",".","\\u060C","\\u061B"]),Qx=new Set(["\\u104F"]),Zx=new Set(["\\u201D","\\u2019","\\xBB","\\u203A","\\u300D","\\u300F","\\u3011","\\u300B","\\u3009","\\u3015","\\uFF09"]);function ey(e){if(Xa(e))return!0;let t=!1;for(let n of e){if(yt.has(n)){t=!0;continue}if(!(t&&Si.test(n)))return!1}return t}function ty(e){for(let t of e)if(!Ei.has(t)&&!yt.has(t))return!1;return e.length>0}function ny(e){if(Xa(e))return!0;for(let t of e)if(!dr.has(t)&&!Ya.has(t)&&!Si.test(t))return!1;return e.length>0}function Xa(e){let t=!1;for(let n of e)if(!(n==="\\\\"||Si.test(n))){if(dr.has(n)||yt.has(n)||Ya.has(n)){t=!0;continue}return!1}return t}function wf(e,t){let n=t-1;if(n<=0)return Math.max(n,0);let r=e.charCodeAt(n);if(r<56320||r>57343)return n;let i=n-1;if(i<0)return n;let o=e.charCodeAt(i);return o>=55296&&o<=56319?i:n}function wi(e){if(e.length===0)return null;let t=wf(e,e.length);return e.slice(t)}function ry(e){let t=Array.from(e),n=t.length;for(;n>0;){let r=t[n-1];if(Si.test(r)){n--;continue}if(dr.has(r)||Ya.has(r)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function iy(e,t,n){return n==="text"&&!t&&e.length===1&&e!=="-"&&e!=="\\u2014"?e:null}function xf(e,t,n,r){let i=t[r],o=e[r];if(i==null)return o;let a=n[r];if(o.length===a)return o;let l=i.repeat(a);return e[r]=l,l}function yf(e,t){return e&&t!==null&&Jx.has(t)}function oy(e){let t=wi(e);return t!==null&&Qx.has(t)}function ay(e){if(e.length<2||e[0]!==" ")return null;let t=e.slice(1);return/^\\p{M}+$/u.test(t)?{space:" ",marks:t}:null}function Ci(e){let t=e.length;for(;t>0;){let n=wf(e,t),r=e.slice(n,t);if(Zx.has(r))return!0;if(!yt.has(r))return!1;t=n}return!1}function sy(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===`\n`)return"hard-break"}return e===" "?"space":e==="\\xA0"||e==="\\u202F"||e==="\\u2060"||e==="\\uFEFF"?"glue":e==="\\u200B"?"zero-width-break":e==="\\xAD"?"soft-hyphen":"text"}var ly=/[\\x20\\t\\n\\xA0\\xAD\\u200B\\u202F\\u2060\\uFEFF]/;function Ie(e){return e.length===1?e[0]:e.join("")}function uy(e,t){let n=[];for(let r=e.length-1;r>=0;r--)n.push(e[r]);return n.push(t),Ie(n)}function cy(e,t,n,r){if(!ly.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];let i=[],o=null,a=[],l=n,s=!1,u=0;for(let c of e){let m=sy(c,r),f=m==="text"&&t;if(o!==null&&m===o&&f===s){a.push(c),u+=c.length;continue}o!==null&&i.push({text:Ie(a),isWordLike:s,kind:o,start:l}),o=m,a=[c],l=n+u,s=f,u+=c.length}return o!==null&&i.push({text:Ie(a),isWordLike:s,kind:o,start:l}),i}function Ka(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}var dy=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function fy(e,t){let n=e.texts[t];return n.startsWith("www.")?!0:dy.test(n)&&t+1<e.len&&e.kinds[t+1]==="text"&&e.texts[t+1]==="//"}function my(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}function py(e){let t=e.texts.slice(),n=e.isWordLike.slice(),r=e.kinds.slice(),i=e.starts.slice();for(let a=0;a<e.len;a++){if(r[a]!=="text"||!fy(e,a))continue;let l=[t[a]],s=a+1;for(;s<e.len&&!Ka(r[s]);){l.push(t[s]),n[a]=!0;let u=t[s].includes("?");if(r[s]="text",t[s]="",s++,u)break}t[a]=Ie(l)}let o=0;for(let a=0;a<t.length;a++){let l=t[a];l.length!==0&&(o!==a&&(t[o]=l,n[o]=n[a],r[o]=r[a],i[o]=i[a]),o++)}return t.length=o,n.length=o,r.length=o,i.length=o,{len:o,texts:t,isWordLike:n,kinds:r,starts:i}}function hy(e){let t=[],n=[],r=[],i=[];for(let o=0;o<e.len;o++){let a=e.texts[o];if(t.push(a),n.push(e.isWordLike[o]),r.push(e.kinds[o]),i.push(e.starts[o]),!my(a))continue;let l=o+1;if(l>=e.len||Ka(e.kinds[l]))continue;let s=[],u=e.starts[l],c=l;for(;c<e.len&&!Ka(e.kinds[c]);)s.push(e.texts[c]),c++;s.length>0&&(t.push(Ie(s)),n.push(!0),r.push("text"),i.push(u),o=c-1)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}var gy=new Set([":","-","/","\\xD7",",",".","+","\\u2013","\\u2014"]),vf=/^[A-Za-z0-9_]+[,:;]*$/,Sf=/[,:;]+$/;function Cf(e){for(let t of e)if(Ef.test(t))return!0;return!1}function cr(e){if(e.length===0)return!1;for(let t of e)if(!(Ef.test(t)||gy.has(t)))return!1;return!0}function by(e){let t=[],n=[],r=[],i=[];for(let o=0;o<e.len;o++){let a=e.texts[o],l=e.kinds[o];if(l==="text"&&cr(a)&&Cf(a)){let s=[a],u=o+1;for(;u<e.len&&e.kinds[u]==="text"&&cr(e.texts[u]);)s.push(e.texts[u]),u++;t.push(Ie(s)),n.push(!0),r.push("text"),i.push(e.starts[o]),o=u-1;continue}t.push(a),n.push(e.isWordLike[o]),r.push(l),i.push(e.starts[o])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function xy(e){let t=[],n=[],r=[],i=[];for(let o=0;o<e.len;o++){let a=e.texts[o],l=e.kinds[o],s=e.isWordLike[o];if(l==="text"&&s&&vf.test(a)){let u=[a],c=Sf.test(a),m=o+1;for(;c&&m<e.len&&e.kinds[m]==="text"&&e.isWordLike[m]&&vf.test(e.texts[m]);){let f=e.texts[m];u.push(f),c=Sf.test(f),m++}t.push(Ie(u)),n.push(!0),r.push("text"),i.push(e.starts[o]),o=m-1;continue}t.push(a),n.push(s),r.push(l),i.push(e.starts[o])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function yy(e){let t=[],n=[],r=[],i=[];for(let o=0;o<e.len;o++){let a=e.texts[o];if(e.kinds[o]==="text"&&a.includes("-")){let l=a.split("-"),s=l.length>1;for(let u=0;u<l.length;u++){let c=l[u];if(!s)break;(c.length===0||!Cf(c)||!cr(c))&&(s=!1)}if(s){let u=0;for(let c=0;c<l.length;c++){let m=l[c],f=c<l.length-1?`${m}-`:m;t.push(f),n.push(!0),r.push("text"),i.push(e.starts[o]+u),u+=f.length}continue}}t.push(a),n.push(e.isWordLike[o]),r.push(e.kinds[o]),i.push(e.starts[o])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function vy(e){let t=[],n=[],r=[],i=[],o=0;for(;o<e.len;){let a=[e.texts[o]],l=e.isWordLike[o],s=e.kinds[o],u=e.starts[o];if(s==="glue"){let c=[a[0]],m=u;for(o++;o<e.len&&e.kinds[o]==="glue";)c.push(e.texts[o]),o++;let f=Ie(c);if(o<e.len&&e.kinds[o]==="text")a[0]=f,a.push(e.texts[o]),l=e.isWordLike[o],s="text",u=m,o++;else{t.push(f),n.push(!1),r.push("glue"),i.push(m);continue}}else o++;if(s==="text")for(;o<e.len&&e.kinds[o]==="glue";){let c=[];for(;o<e.len&&e.kinds[o]==="glue";)c.push(e.texts[o]),o++;let m=Ie(c);if(o<e.len&&e.kinds[o]==="text"){a.push(m,e.texts[o]),l=l||e.isWordLike[o],o++;continue}a.push(m)}t.push(Ie(a)),n.push(l),r.push(s),i.push(u)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function Sy(e){let t=e.texts.slice(),n=e.isWordLike.slice(),r=e.kinds.slice(),i=e.starts.slice();for(let o=0;o<t.length-1;o++){if(r[o]!=="text"||r[o+1]!=="text"||!We(t[o])||!We(t[o+1]))continue;let a=ry(t[o]);a!==null&&(t[o]=a.head,t[o+1]=a.tail+t[o+1],i[o+1]=i[o]+a.head.length)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function Af(e,t,n){let r=qx(),i=0,o=[],a=[],l=[],s=[],u=[],c=[],m=[],f=[],p=[],b=[],v=[],x=[];for(let E of r.segment(e))for(let S of cy(E.segment,E.isWordLike??!1,E.index,n)){let V=function(){c[k]!==null&&(a[k]=[xf(o,c,m,k)],c[k]=null),a[k].push(S.text),l[k]=l[k]||S.isWordLike,f[k]=f[k]||N,p[k]=p[k]||I,b[k]=U,v[k]=oe,x[k]=yf(p[k],W)},A=S.kind==="text",C=iy(S.text,S.isWordLike,S.kind),N=We(S.text),I=gf(S.text),W=wi(S.text),U=Ci(S.text),oe=oy(S.text),k=i-1;t.carryCJKAfterClosingQuote&&A&&i>0&&s[k]==="text"&&N&&f[k]&&b[k]||A&&i>0&&s[k]==="text"&&ty(S.text)&&f[k]||A&&i>0&&s[k]==="text"&&v[k]?V():A&&i>0&&s[k]==="text"&&S.isWordLike&&I&&x[k]?(V(),l[k]=!0):C!==null&&i>0&&s[k]==="text"&&c[k]===C?m[k]=(m[k]??1)+1:A&&!S.isWordLike&&i>0&&s[k]==="text"&&(ey(S.text)||S.text==="-"&&l[k])?V():(o[i]=S.text,a[i]=[S.text],l[i]=S.isWordLike,s[i]=S.kind,u[i]=S.start,c[i]=C,m[i]=C===null?0:1,f[i]=N,p[i]=I,b[i]=U,v[i]=oe,x[i]=yf(I,W),i++)}for(let E=0;E<i;E++){if(c[E]!==null){o[E]=xf(o,c,m,E);continue}o[E]=Ie(a[E])}for(let E=1;E<i;E++)s[E]==="text"&&!l[E]&&Xa(o[E])&&s[E-1]==="text"&&(o[E-1]+=o[E],l[E-1]=l[E-1]||l[E],o[E]="");let _=Array.from({length:i},()=>null),R=-1;for(let E=i-1;E>=0;E--){let S=o[E];if(S.length!==0){if(s[E]==="text"&&!l[E]&&ny(S)&&R>=0&&s[R]==="text"){let A=_[R]??[];A.push(S),_[R]=A,u[R]=u[E],o[E]="";continue}R=E}}for(let E=0;E<i;E++){let S=_[E];S!=null&&(o[E]=uy(S,o[E]))}let T=0;for(let E=0;E<i;E++){let S=o[E];S.length!==0&&(T!==E&&(o[T]=S,l[T]=l[E],s[T]=s[E],u[T]=u[E]),T++)}o.length=T,l.length=T,s.length=T,u.length=T;let M=vy({len:T,texts:o,isWordLike:l,kinds:s,starts:u}),F=Sy(xy(yy(by(hy(py(M))))));for(let E=0;E<F.len-1;E++){let S=ay(F.texts[E]);S!==null&&(F.kinds[E]!=="space"&&F.kinds[E]!=="preserved-space"||F.kinds[E+1]!=="text"||!gf(F.texts[E+1])||(F.texts[E]=S.space,F.isWordLike[E]=!1,F.kinds[E]=F.kinds[E]==="preserved-space"?"preserved-space":"space",F.texts[E+1]=S.marks+F.texts[E+1],F.starts[E+1]=F.starts[E]+S.space.length))}return F}function Ay(e,t){if(e.len===0)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];let n=[],r=0;for(let i=0;i<e.len;i++)e.kinds[i]==="hard-break"&&(n.push({startSegmentIndex:r,endSegmentIndex:i,consumedEndSegmentIndex:i+1}),r=i+1);return r<e.len&&n.push({startSegmentIndex:r,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),n}function Ey(e){if(e.len<=1)return e;let t=[],n=[],r=[],i=[],o=null,a=!1,l=0,s=!1,u=!1;function c(){o!==null&&(t.push(Ie(o)),n.push(a),r.push("text"),i.push(l),o=null)}for(let m=0;m<e.len;m++){let f=e.texts[m],p=e.kinds[m],b=e.isWordLike[m],v=e.starts[m];if(p==="text"){let x=Yx(f),_=Ai(f);if(o!==null&&s&&u){o.push(f),a=a||b,s=s||x,u=_;continue}c(),o=[f],a=b,l=v,s=x,u=_;continue}c(),t.push(f),n.push(b),r.push(p),i.push(v)}return c(),{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function _f(e,t,n="normal",r="normal"){let i=Ux(n),o=i.mode==="pre-wrap"?Vx(e):Wx(e);if(o.length===0)return{normalized:o,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let a=r==="keep-all"?Ey(Af(o,t,i)):Af(o,t,i);return{normalized:o,chunks:Ay(a,i),...a}}var on=null,Tf=new Map,an=null,wy=96,Cy=/\\p{Emoji_Presentation}/u,_y=/[\\p{Emoji_Presentation}\\p{Extended_Pictographic}\\p{Regional_Indicator}\\uFE0F\\u20E3]/u,Ja=null,Rf=new Map;function Qa(){if(on!==null)return on;if(typeof OffscreenCanvas<"u")return on=new OffscreenCanvas(1,1).getContext("2d"),on;if(typeof document<"u")return on=document.createElement("canvas").getContext("2d"),on;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function Ty(e){let t=Tf.get(e);return t||(t=new Map,Tf.set(e,t)),t}function at(e,t){let n=t.get(e);return n===void 0&&(n={width:Qa().measureText(e).width,containsCJK:We(e)},t.set(e,n)),n}function St(){if(an!==null)return an;if(typeof navigator>"u")return an={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},an;let e=navigator.userAgent,n=navigator.vendor==="Apple Computer, Inc."&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),r=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return an={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:r,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},an}function Ry(e){let t=e.match(/(\\d+(?:\\.\\d+)?)\\s*px/);return t?parseFloat(t[1]):16}function kf(){return Ja===null&&(Ja=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Ja}function ky(e){return Cy.test(e)||e.includes("\\uFE0F")}function Mf(e){return _y.test(e)}function My(e,t){let n=Rf.get(e);if(n!==void 0)return n;let r=Qa();r.font=e;let i=r.measureText("\\u{1F600}").width;if(n=0,i>t+.5&&typeof document<"u"&&document.body!==null){let o=document.createElement("span");o.style.font=e,o.style.display="inline-block",o.style.visibility="hidden",o.style.position="absolute",o.textContent="\\u{1F600}",document.body.appendChild(o);let a=o.getBoundingClientRect().width;document.body.removeChild(o),i-a>.5&&(n=i-a)}return Rf.set(e,n),n}function Fy(e){let t=0,n=kf();for(let r of n.segment(e))ky(r.segment)&&t++;return t}function Ny(e,t){return t.emojiCount===void 0&&(t.emojiCount=Fy(e)),t.emojiCount}function vt(e,t,n){return n===0?t.width:t.width-Ny(e,t)*n}function Ff(e,t,n,r,i){if(t.breakableFitAdvances!==void 0)return t.breakableFitAdvances;let o=kf(),a=[];for(let c of o.segment(e))a.push(c.segment);if(a.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if(i==="sum-graphemes"){let c=[];for(let m of a){let f=at(m,n);c.push(vt(m,f,r))}return t.breakableFitAdvances=c,t.breakableFitAdvances}if(i==="pair-context"||a.length>wy){let c=[],m=null,f=0;for(let p of a){let b=at(p,n),v=vt(p,b,r);if(m===null)c.push(v);else{let x=m+p,_=at(x,n);c.push(vt(x,_,r)-f)}m=p,f=v}return t.breakableFitAdvances=c,t.breakableFitAdvances}let l=[],s="",u=0;for(let c of a){s+=c;let m=at(s,n),f=vt(s,m,r);l.push(f-u),u=f}return t.breakableFitAdvances=l,t.breakableFitAdvances}function Nf(e,t){let n=Qa();n.font=e;let r=Ty(e),i=Ry(e),o=t?My(e,i):0;return{cache:r,fontSize:i,emojiCorrection:o}}function Ly(e,t){for(;t<e.widths.length;){let n=e.kinds[t];if(n!=="space"&&n!=="zero-width-break"&&n!=="soft-hyphen")break;t++}return t}function Lf(e,t){if(t<=0)return 0;let n=e%t;return Math.abs(n)<=1e-6?t:t-n}function Df(e,t,n,r,i){let o=0,a=t;for(;o<e.length;){let l=a+e[o];if((o+1<e.length?l+i:l)>n+r)break;a=l,o++}return{fitCount:o,fittedWidth:a}}function Dy(e,t){let n=0,r=e.chunks.length;for(;n<r;){let i=Math.floor((n+r)/2);t<e.chunks[i].consumedEndSegmentIndex?r=i:n=i+1}return n<e.chunks.length?n:-1}function If(e,t,n){let r=n.segmentIndex;if(n.graphemeIndex>0)return t;let i=e.chunks[t];if(i.startSegmentIndex===i.endSegmentIndex&&r===i.startSegmentIndex)return n.segmentIndex=r,n.graphemeIndex=0,t;for(r<i.startSegmentIndex&&(r=i.startSegmentIndex);r<i.endSegmentIndex;){let o=e.kinds[r];if(o!=="space"&&o!=="zero-width-break"&&o!=="soft-hyphen")return n.segmentIndex=r,n.graphemeIndex=0,t;r++}return i.consumedEndSegmentIndex>=e.widths.length?-1:(n.segmentIndex=i.consumedEndSegmentIndex,n.graphemeIndex=0,t+1)}function Pf(e,t){if(t.segmentIndex>=e.widths.length)return-1;let n=Dy(e,t.segmentIndex);return n<0?-1:If(e,n,t)}function Iy(e,t,n){if(n.segmentIndex>=e.widths.length)return-1;let r=t;for(;r<e.chunks.length&&n.segmentIndex>=e.chunks[r].consumedEndSegmentIndex;)r++;return r>=e.chunks.length?-1:If(e,r,n)}function Of(e,t){return e.simpleLineWalkFastPath?Gf(e,t):Za(e,t)}function Gf(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e;if(r.length===0)return 0;let l=St().lineFitEpsilon,s=t+l,u=0,c=0,m=!1,f=0,p=0,b=0,v=0,x=-1,_=0;function R(){x=-1,_=0}function T(C=b,N=v,I=c){u++,n?.({startSegmentIndex:f,startGraphemeIndex:p,endSegmentIndex:C,endGraphemeIndex:N,width:I}),c=0,m=!1,R()}function M(C,N){m=!0,f=C,p=0,b=C+1,v=0,c=N}function F(C,N,I){m=!0,f=C,p=N,b=C,v=N+1,c=I}function E(C,N){if(!m){M(C,N);return}c+=N,b=C+1,v=0}function S(C,N){let I=o[C];for(let W=N;W<I.length;W++){let U=I[W];m?c+U>s?(T(),F(C,W,U)):(c+=U,b=C,v=W+1):F(C,W,U)}m&&b===C&&v===I.length&&(b=C+1,v=0)}let A=0;for(;A<r.length&&!(!m&&(A=Ly(e,A),A>=r.length));){let C=r[A],N=i[A],I=N==="space"||N==="preserved-space"||N==="tab"||N==="zero-width-break"||N==="soft-hyphen";if(!m){C>t&&o[A]!==null?S(A,0):M(A,C),I&&(x=A+1,_=c-C),A++;continue}if(c+C>s){if(I){E(A,C),T(A+1,0,c-C),A++;continue}if(x>=0){if(b>x||b===x&&v>0){T();continue}T(x,0,_);continue}if(C>t&&o[A]!==null){T(),S(A,0),A++;continue}T();continue}E(A,C),I&&(x=A+1,_=c-C),A++}return m&&T(),u}function Za(e,t,n){if(e.simpleLineWalkFastPath)return Gf(e,t,n);let{widths:r,lineEndFitAdvances:i,lineEndPaintAdvances:o,kinds:a,breakableFitAdvances:l,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:c}=e;if(r.length===0||c.length===0)return 0;let m=St(),f=m.lineFitEpsilon,p=t+f,b=0,v=0,x=!1,_=0,R=0,T=0,M=0,F=-1,E=0,S=0,A=null;function C(){F=-1,E=0,S=0,A=null}function N(H=T,G=M,z=v){b++,n?.({startSegmentIndex:_,startGraphemeIndex:R,endSegmentIndex:H,endGraphemeIndex:G,width:z}),v=0,x=!1,C()}function I(H,G){x=!0,_=H,R=0,T=H+1,M=0,v=G}function W(H,G,z){x=!0,_=H,R=G,T=H,M=G+1,v=z}function U(H,G){if(!x){I(H,G);return}v+=G,T=H+1,M=0}function oe(H,G,z,X){if(!G)return;let we=H==="tab"?0:i[z],q=H==="tab"?X:o[z];F=z+1,E=v-X+we,S=v-X+q,A=H}function k(H,G){let z=l[H];for(let X=G;X<z.length;X++){let we=z[X];x?v+we>p?(N(),W(H,X,we)):(v+=we,T=H,M=X+1):W(H,X,we)}x&&T===H&&M===z.length&&(T=H+1,M=0)}function V(H){if(A!=="soft-hyphen")return!1;let G=l[H];if(G==null)return!1;let{fitCount:z,fittedWidth:X}=Df(G,v,t,f,s);return z===0?!1:(v=X,T=H,M=z,C(),z===G.length?(T=H+1,M=0,!0):(N(H,z,X+s),k(H,z),!0))}function J(H){b++,n?.({startSegmentIndex:H.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:H.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),C()}for(let H=0;H<c.length;H++){let G=c[H];if(G.startSegmentIndex===G.endSegmentIndex){J(G);continue}x=!1,v=0,_=G.startSegmentIndex,R=0,T=G.startSegmentIndex,M=0,C();let z=G.startSegmentIndex;for(;z<G.endSegmentIndex;){let X=a[z],we=X==="space"||X==="preserved-space"||X==="tab"||X==="zero-width-break"||X==="soft-hyphen",q=X==="tab"?Lf(v,u):r[z];if(X==="soft-hyphen"){x&&(T=z+1,M=0,F=z+1,E=v+s,S=v+s,A=X),z++;continue}if(!x){q>t&&l[z]!==null?k(z,0):I(z,q),oe(X,we,z,q),z++;continue}if(v+q>p){let O=v+(X==="tab"?0:i[z]),j=v+(X==="tab"?q:o[z]);if(A==="soft-hyphen"&&m.preferEarlySoftHyphenBreak&&E<=p){N(F,0,S);continue}if(A==="soft-hyphen"&&V(z)){z++;continue}if(we&&O<=p){U(z,q),N(z+1,0,j),z++;continue}if(F>=0&&E<=p){if(T>F||T===F&&M>0){N();continue}let le=F;N(le,0,S),z=le;continue}if(q>t&&l[z]!==null){N(),k(z,0),z++;continue}N();continue}U(z,q),oe(X,we,z,q),z++}if(x){let X=F===G.consumedEndSegmentIndex?S:v;N(G.consumedEndSegmentIndex,0,X)}}return b}function Hf(e,t,n,r){let i=e.chunks[n];if(i.startSegmentIndex===i.endSegmentIndex)return t.segmentIndex=i.consumedEndSegmentIndex,t.graphemeIndex=0,0;let{widths:o,lineEndFitAdvances:a,lineEndPaintAdvances:l,kinds:s,breakableFitAdvances:u,discretionaryHyphenWidth:c,tabStopAdvance:m}=e,f=St(),p=f.lineFitEpsilon,b=r+p,v=0,x=!1,_=t.segmentIndex,R=t.graphemeIndex,T=-1,M=0,F=0,E=null;function S(){T=-1,M=0,F=0,E=null}function A(k=_,V=R,J=v){return x?(t.segmentIndex=k,t.graphemeIndex=V,J):null}function C(k,V){x=!0,_=k+1,R=0,v=V}function N(k,V,J){x=!0,_=k,R=V+1,v=J}function I(k,V){if(!x){C(k,V);return}v+=V,_=k+1,R=0}function W(k,V,J,H){if(!V)return;let G=k==="tab"?0:a[J],z=k==="tab"?H:l[J];T=J+1,M=v-H+G,F=v-H+z,E=k}function U(k,V){let J=u[k];for(let H=V;H<J.length;H++){let G=J[H];if(!x)N(k,H,G);else{if(v+G>b)return A();v+=G,_=k,R=H+1}}return x&&_===k&&R===J.length&&(_=k+1,R=0),null}function oe(k){if(E!=="soft-hyphen"||T<0)return null;let V=u[k]??null;if(V!==null){let{fitCount:J,fittedWidth:H}=Df(V,v,r,p,c);if(J===V.length)return v=H,_=k+1,R=0,S(),null;if(J>0)return A(k,J,H+c)}return M<=b?A(T,0,F):null}for(let k=t.segmentIndex;k<i.endSegmentIndex;k++){let V=s[k],J=V==="space"||V==="preserved-space"||V==="tab"||V==="zero-width-break"||V==="soft-hyphen",H=k===t.segmentIndex?t.graphemeIndex:0,G=V==="tab"?Lf(v,m):o[k];if(V==="soft-hyphen"&&H===0){x&&(_=k+1,R=0,T=k+1,M=v+c,F=v+c,E=V);continue}if(!x){if(H>0){let X=U(k,H);if(X!==null)return X}else if(G>r&&u[k]!==null){let X=U(k,0);if(X!==null)return X}else C(k,G);W(V,J,k,G);continue}if(v+G>b){let X=v+(V==="tab"?0:a[k]),we=v+(V==="tab"?G:l[k]);if(E==="soft-hyphen"&&f.preferEarlySoftHyphenBreak&&M<=b)return A(T,0,F);let q=oe(k);if(q!==null)return q;if(J&&X<=b)return I(k,G),A(k+1,0,we);if(T>=0&&M<=b)return _>T||_===T&&R>0?A():A(T,0,F);if(G>r&&u[k]!==null){let P=A();if(P!==null)return P;let O=U(k,0);if(O!==null)return O}return A()}I(k,G),W(V,J,k,G)}return T===i.consumedEndSegmentIndex&&R===0?A(i.consumedEndSegmentIndex,0,F):A(i.consumedEndSegmentIndex,0,v)}function Py(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e,l=St().lineFitEpsilon,s=n+l,u=0,c=!1,m=t.segmentIndex,f=t.graphemeIndex,p=-1,b=0;for(let v=t.segmentIndex;v<r.length;v++){let x=r[v],_=i[v],R=_==="space"||_==="preserved-space"||_==="tab"||_==="zero-width-break"||_==="soft-hyphen",T=v===t.segmentIndex?t.graphemeIndex:0,M=o[v];if(!c){if(T>0||x>n&&M!==null){let F=M,E=F[T];c=!0,u=E,m=v,f=T+1;for(let S=T+1;S<F.length;S++){let A=F[S];if(u+A>s)return t.segmentIndex=m,t.graphemeIndex=f,u;u+=A,m=v,f=S+1}m===v&&f===F.length&&(m=v+1,f=0)}else c=!0,u=x,m=v+1,f=0;R&&(p=v+1,b=u-x);continue}if(u+x>s)return R?(t.segmentIndex=v+1,t.graphemeIndex=0,u):p>=0?m>p||m===p&&f>0?(t.segmentIndex=m,t.graphemeIndex=f,u):(t.segmentIndex=p,t.graphemeIndex=0,b):(t.segmentIndex=m,t.graphemeIndex=f,u);u+=x,m=v+1,f=0,R&&(p=v+1,b=u-x)}return c?(t.segmentIndex=m,t.graphemeIndex=f,u):null}function Oy(e,t,n){let r=Pf(e,t);return r<0?null:e.simpleLineWalkFastPath?Py(e,t,n):Hf(e,t,r,n)}function Bf(e,t){if(e.widths.length===0)return{lineCount:0,maxLineWidth:0};let n={segmentIndex:0,graphemeIndex:0},r=0,i=0;if(!e.simpleLineWalkFastPath){let o=Pf(e,n);for(;o>=0;){let a=Hf(e,n,o,t);if(a===null)return{lineCount:r,maxLineWidth:i};r++,a>i&&(i=a),o=Iy(e,o,n)}return{lineCount:r,maxLineWidth:i}}for(;;){let o=Oy(e,n,t);if(o===null)return{lineCount:r,maxLineWidth:i};r++,o>i&&(i=o)}}var es=null;function Gy(){return es===null&&(es=new Intl.Segmenter(void 0,{granularity:"grapheme"})),es}function Hy(e){return e?{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}:{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]}}function By(e,t){let n=[],r=[],i=0,o=!1,a=!1,l=!1;function s(){r.length!==0&&(n.push({text:r.length===1?r[0]:r.join(""),start:i}),r=[],o=!1,a=!1,l=!1)}function u(m,f,p){r=[m],i=f,o=p,a=Ci(m),l=dr.has(m)}function c(m,f){r.push(m),o=o||f;let p=Ci(m);m.length===1&&yt.has(m)?a=a||p:a=p,l=!1}for(let m of Gy().segment(e)){let f=m.segment,p=We(f);if(r.length===0){u(f,m.index,p);continue}if(l||Ei.has(f)||yt.has(f)||t.carryCJKAfterClosingQuote&&p&&a){c(f,p);continue}if(!o&&!p){c(f,p);continue}s(),u(f,m.index,p)}return s(),n}function Uy(e){if(e.length<=1)return e;let t=[],n=[e[0].text],r=e[0].start,i=We(e[0].text),o=Ai(e[0].text);function a(){t.push({text:n.length===1?n[0]:n.join(""),start:r})}for(let l=1;l<e.length;l++){let s=e[l],u=We(s.text),c=Ai(s.text);if(i&&o){n.push(s.text),i=i||u,o=c;continue}a(),n=[s.text],r=s.start,i=u,o=c}return a(),t}function Wy(e,t,n,r){let i=St(),{cache:o,emojiCorrection:a}=Nf(t,Mf(e.normalized)),l=vt("-",at("-",o),a),u=vt(" ",at(" ",o),a)*8;if(e.len===0)return Hy(n);let c=[],m=[],f=[],p=[],b=e.chunks.length<=1,v=n?[]:null,x=[],_=n?[]:null,R=Array.from({length:e.len});function T(S,A,C,N,I,W,U){I!=="text"&&I!=="space"&&I!=="zero-width-break"&&(b=!1),c.push(A),m.push(C),f.push(N),p.push(I),v?.push(W),x.push(U),_!==null&&_.push(S)}function M(S,A,C,N,I){let W=at(S,o),U=vt(S,W,a),oe=A==="space"||A==="preserved-space"||A==="zero-width-break"?0:U,k=A==="space"||A==="zero-width-break"?0:U;if(I&&N&&S.length>1){let V="sum-graphemes";cr(S)?V="pair-context":i.preferPrefixWidthsForBreakableRuns&&(V="segment-prefixes");let J=Ff(S,W,o,a,V);T(S,U,oe,k,A,C,J);return}T(S,U,oe,k,A,C,null)}for(let S=0;S<e.len;S++){R[S]=c.length;let A=e.texts[S],C=e.isWordLike[S],N=e.kinds[S],I=e.starts[S];if(N==="soft-hyphen"){T(A,0,l,l,N,I,null);continue}if(N==="hard-break"){T(A,0,0,0,N,I,null);continue}if(N==="tab"){T(A,0,0,0,N,I,null);continue}let W=at(A,o);if(N==="text"&&W.containsCJK){let U=By(A,i),oe=r==="keep-all"?Uy(U):U;for(let k=0;k<oe.length;k++){let V=oe[k];M(V.text,"text",I+V.start,C,r==="keep-all"||!We(V.text))}continue}M(A,N,I,C,!0)}let F=Vy(e.chunks,R,c.length),E=v===null?null:hf(e.normalized,v);return _!==null?{widths:c,lineEndFitAdvances:m,lineEndPaintAdvances:f,kinds:p,simpleLineWalkFastPath:b,segLevels:E,breakableFitAdvances:x,discretionaryHyphenWidth:l,tabStopAdvance:u,chunks:F,segments:_}:{widths:c,lineEndFitAdvances:m,lineEndPaintAdvances:f,kinds:p,simpleLineWalkFastPath:b,segLevels:E,breakableFitAdvances:x,discretionaryHyphenWidth:l,tabStopAdvance:u,chunks:F}}function Vy(e,t,n){let r=[];for(let i=0;i<e.length;i++){let o=e[i],a=o.startSegmentIndex<t.length?t[o.startSegmentIndex]:n,l=o.endSegmentIndex<t.length?t[o.endSegmentIndex]:n,s=o.consumedEndSegmentIndex<t.length?t[o.consumedEndSegmentIndex]:n;r.push({startSegmentIndex:a,endSegmentIndex:l,consumedEndSegmentIndex:s})}return r}function Uf(e,t,n,r){let i=r?.wordBreak??"normal",o=_f(e,St(),r?.whiteSpace,i);return Wy(o,t,n,i)}function _i(e,t,n){return Uf(e,t,!1,n)}function Wf(e,t,n){return Uf(e,t,!0,n)}function Ti(e,t,n){let r=Of(e,t);return{lineCount:r,height:r*n}}function zy(e){return{width:e.width,start:{segmentIndex:e.startSegmentIndex,graphemeIndex:e.startGraphemeIndex},end:{segmentIndex:e.endSegmentIndex,graphemeIndex:e.endGraphemeIndex}}}function qy(e,t,n){return e.widths.length===0?0:Za(e,t,r=>{n(zy(r))})}function Vf(e,t){return Bf(e,t)}function zf(e){let t=0;return qy(e,Number.POSITIVE_INFINITY,n=>{n.width>t&&(t=n.width)}),t}var $y={maxWidth:1600,baseFontSize:78,minFontSize:42,fontWeight:900,fontFamily:"Outfit",step:2};function qf(e,t){let n={...$y,...t},r=1.2;for(let i=n.baseFontSize;i>=n.minFontSize;i-=n.step){let o=`${n.fontWeight} ${i}px ${n.fontFamily}`,a=_i(e,o),{lineCount:l}=Ti(a,n.maxWidth,i*r);if(l<=1)return{fontSize:i,fits:!0}}return{fontSize:n.minFontSize,fits:!1}}var $f={prepare:_i,layout:Ti,prepareWithSegments:Wf,measureLineStats:Vf,measureNaturalWidth:zf};window.__timelines=window.__timelines||{};xd();window.__hyperframes={fitTextFontSize:qf,getVariables:Cs,pretext:$f};function jf(){let e=window;e.__hyperframeRuntimeBootstrapped||(e.__hyperframeRuntimeBootstrapped=!0,mf())}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",jf,{once:!0}):jf();})();\n';
|
|
58712
58784
|
}
|
|
58713
58785
|
});
|
|
58714
58786
|
|
|
@@ -62211,37 +62283,54 @@ function parseAudioFxChain(json) {
|
|
|
62211
62283
|
if (!Array.isArray(obj.nodes)) {
|
|
62212
62284
|
throw new AudioFxChainError("Chain file is missing a `nodes` array.");
|
|
62213
62285
|
}
|
|
62214
|
-
const nodes = obj.nodes.map(
|
|
62215
|
-
if (typeof n2 !== "object" || n2 === null) {
|
|
62216
|
-
throw new AudioFxChainError(`Node ${i2} is not an object.`);
|
|
62217
|
-
}
|
|
62218
|
-
const node = n2;
|
|
62219
|
-
if (typeof node.type !== "string" || !BY_ID.has(node.type)) {
|
|
62220
|
-
throw new AudioFxChainError(`Node ${i2} has unknown effect type: ${String(node.type)}`);
|
|
62221
|
-
}
|
|
62222
|
-
return {
|
|
62223
|
-
type: node.type,
|
|
62224
|
-
...typeof node.id === "string" && node.id ? { id: node.id } : {},
|
|
62225
|
-
...node.fromCarve === true ? { fromCarve: true } : {},
|
|
62226
|
-
// Both survive the round trip or a preset stops being able to find its
|
|
62227
|
-
// own nodes after a reload: re-applying would stack a second copy and
|
|
62228
|
-
// the rack would lose the grouping it braces them with.
|
|
62229
|
-
...typeof node.fromPreset === "string" && node.fromPreset ? { fromPreset: node.fromPreset } : {},
|
|
62230
|
-
...typeof node.label === "string" && node.label ? { label: node.label } : {},
|
|
62231
|
-
...typeof node.fromEq === "string" && node.fromEq ? { fromEq: node.fromEq } : {},
|
|
62232
|
-
...node.fromLeveller === true ? { fromLeveller: true } : {},
|
|
62233
|
-
// Clamped on the way in: the blend is two gains in opposition, and a value
|
|
62234
|
-
// outside 0..1 makes the dry leg negative rather than simply loud.
|
|
62235
|
-
...typeof node.presetAmount === "number" && Number.isFinite(node.presetAmount) ? { presetAmount: Math.min(1, Math.max(0, node.presetAmount)) } : {},
|
|
62236
|
-
enabled: node.enabled !== false,
|
|
62237
|
-
params: normalizeAudioFxParams(node.type, node.params ?? void 0)
|
|
62238
|
-
};
|
|
62239
|
-
});
|
|
62286
|
+
const nodes = obj.nodes.map(parseAudioFxNode);
|
|
62240
62287
|
return { version: HF_AUDIO_FX_CHAIN_VERSION, nodes };
|
|
62241
62288
|
}
|
|
62242
62289
|
function enabledAudioFxNodes(chain) {
|
|
62243
62290
|
return chain.nodes.filter((n2) => n2.enabled !== false);
|
|
62244
62291
|
}
|
|
62292
|
+
function parseAudioFxNode(n2, i2) {
|
|
62293
|
+
if (typeof n2 !== "object" || n2 === null) {
|
|
62294
|
+
throw new AudioFxChainError(`Node ${i2} is not an object.`);
|
|
62295
|
+
}
|
|
62296
|
+
const node = n2;
|
|
62297
|
+
if (typeof node.type !== "string" || !BY_ID.has(node.type)) {
|
|
62298
|
+
throw new AudioFxChainError(`Node ${i2} has unknown effect type: ${String(node.type)}`);
|
|
62299
|
+
}
|
|
62300
|
+
return withoutUndefined({
|
|
62301
|
+
type: node.type,
|
|
62302
|
+
id: nonEmptyString(node.id),
|
|
62303
|
+
fromCarve: onlyTrue(node.fromCarve),
|
|
62304
|
+
// fromPreset and label both survive the round trip or a preset stops being
|
|
62305
|
+
// able to find its own nodes after a reload: re-applying would stack a
|
|
62306
|
+
// second copy and the rack would lose the grouping it braces them with.
|
|
62307
|
+
fromPreset: nonEmptyString(node.fromPreset),
|
|
62308
|
+
label: nonEmptyString(node.label),
|
|
62309
|
+
fromEq: nonEmptyString(node.fromEq),
|
|
62310
|
+
fromLeveller: onlyTrue(node.fromLeveller),
|
|
62311
|
+
presetAmount: clampedPresetAmount(node.presetAmount),
|
|
62312
|
+
enabled: node.enabled !== false,
|
|
62313
|
+
params: normalizeAudioFxParams(node.type, node.params ?? void 0)
|
|
62314
|
+
});
|
|
62315
|
+
}
|
|
62316
|
+
function nonEmptyString(value) {
|
|
62317
|
+
return typeof value === "string" && value ? value : void 0;
|
|
62318
|
+
}
|
|
62319
|
+
function onlyTrue(value) {
|
|
62320
|
+
return value === true ? true : void 0;
|
|
62321
|
+
}
|
|
62322
|
+
function clampedPresetAmount(value) {
|
|
62323
|
+
if (typeof value !== "number" || !Number.isFinite(value))
|
|
62324
|
+
return void 0;
|
|
62325
|
+
return Math.min(1, Math.max(0, value));
|
|
62326
|
+
}
|
|
62327
|
+
function withoutUndefined(obj) {
|
|
62328
|
+
for (const key2 of Object.keys(obj)) {
|
|
62329
|
+
if (obj[key2] === void 0)
|
|
62330
|
+
delete obj[key2];
|
|
62331
|
+
}
|
|
62332
|
+
return obj;
|
|
62333
|
+
}
|
|
62245
62334
|
var HF_AUDIO_FX_ATTR, HF_AUDIO_FX_DATA_KEY, HF_AUDIO_FX_CHAIN_VERSION, freq, qParam, gainDb, poles, HF_AUDIO_FX, BY_ID, HF_AUDIO_FX_IDS, AudioFxChainError;
|
|
62246
62335
|
var init_audioFx = __esm({
|
|
62247
62336
|
"../core/dist/audioFx.js"() {
|
|
@@ -62658,7 +62747,12 @@ var init_audioFx = __esm({
|
|
|
62658
62747
|
id: "pitchshift",
|
|
62659
62748
|
label: "Pitch shift",
|
|
62660
62749
|
group: "time",
|
|
62661
|
-
|
|
62750
|
+
// The granular algorithm reads from a 100 ms grain, so its output runs a
|
|
62751
|
+
// constant ~50 ms behind its input and nothing in the graph subtracts that
|
|
62752
|
+
// — there is no latency/pre-roll concept here yet. It is inaudible on its
|
|
62753
|
+
// own and audible against picture or against an unshifted track, so it is
|
|
62754
|
+
// stated rather than hidden. `semitones: 0` bypasses the node entirely.
|
|
62755
|
+
description: "Shifts pitch up or down without changing playback speed. Adds ~50 ms of latency.",
|
|
62662
62756
|
params: [
|
|
62663
62757
|
{
|
|
62664
62758
|
kind: "number",
|
|
@@ -63214,6 +63308,61 @@ var init_audioAutomationVolume = __esm({
|
|
|
63214
63308
|
}
|
|
63215
63309
|
});
|
|
63216
63310
|
|
|
63311
|
+
// ../core/dist/audioGroups.js
|
|
63312
|
+
function readAudioGroupVolume(el) {
|
|
63313
|
+
const raw = el?.getAttribute("data-volume");
|
|
63314
|
+
const parsed = raw ? parseFloat(raw) : 1;
|
|
63315
|
+
return Number.isFinite(parsed) ? parsed : 1;
|
|
63316
|
+
}
|
|
63317
|
+
function buildGroup(id, memberIds, el) {
|
|
63318
|
+
const fxChain = el?.getAttribute(HF_AUDIO_FX_ATTR);
|
|
63319
|
+
const automation = el?.getAttribute(HF_AUDIO_AUTOMATION_ATTR);
|
|
63320
|
+
return {
|
|
63321
|
+
id,
|
|
63322
|
+
label: el?.getAttribute("data-label") || id,
|
|
63323
|
+
memberIds,
|
|
63324
|
+
...fxChain ? { fxChain } : {},
|
|
63325
|
+
...automation ? { automation } : {},
|
|
63326
|
+
volume: readAudioGroupVolume(el),
|
|
63327
|
+
hidden: el?.hasAttribute("data-hidden") ?? false
|
|
63328
|
+
};
|
|
63329
|
+
}
|
|
63330
|
+
function resolveAudioGroups(root) {
|
|
63331
|
+
const membersByGroup = /* @__PURE__ */ new Map();
|
|
63332
|
+
for (const member of root.querySelectorAll(`audio[${HF_AUDIO_GROUP_ATTR}]`)) {
|
|
63333
|
+
const groupId = member.getAttribute(AUDIO_GROUP_RENDER_ID_ATTR) ?? member.getAttribute(HF_AUDIO_GROUP_ATTR);
|
|
63334
|
+
if (!groupId || !member.id)
|
|
63335
|
+
continue;
|
|
63336
|
+
const members = membersByGroup.get(groupId);
|
|
63337
|
+
if (members)
|
|
63338
|
+
members.push(member.id);
|
|
63339
|
+
else
|
|
63340
|
+
membersByGroup.set(groupId, [member.id]);
|
|
63341
|
+
}
|
|
63342
|
+
const groupElements = /* @__PURE__ */ new Map();
|
|
63343
|
+
for (const el of root.querySelectorAll(HF_AUDIO_GROUP_TAG)) {
|
|
63344
|
+
const key2 = el.getAttribute(MEDIA_RENDER_ID_ATTR) ?? el.id;
|
|
63345
|
+
if (key2)
|
|
63346
|
+
groupElements.set(key2, el);
|
|
63347
|
+
}
|
|
63348
|
+
const groups = [];
|
|
63349
|
+
for (const [id, memberIds] of membersByGroup) {
|
|
63350
|
+
groups.push(buildGroup(id, memberIds, groupElements.get(id)));
|
|
63351
|
+
}
|
|
63352
|
+
return groups;
|
|
63353
|
+
}
|
|
63354
|
+
var HF_AUDIO_GROUP_TAG, HF_AUDIO_GROUP_ATTR;
|
|
63355
|
+
var init_audioGroups = __esm({
|
|
63356
|
+
"../core/dist/audioGroups.js"() {
|
|
63357
|
+
"use strict";
|
|
63358
|
+
init_audioFx();
|
|
63359
|
+
init_mediaRenderIds();
|
|
63360
|
+
init_audioAutomation();
|
|
63361
|
+
HF_AUDIO_GROUP_TAG = "hf-audio-group";
|
|
63362
|
+
HF_AUDIO_GROUP_ATTR = "data-audio-group";
|
|
63363
|
+
}
|
|
63364
|
+
});
|
|
63365
|
+
|
|
63217
63366
|
// ../core/dist/runtime/media.js
|
|
63218
63367
|
var init_media = __esm({
|
|
63219
63368
|
"../core/dist/runtime/media.js"() {
|
|
@@ -63223,24 +63372,13 @@ var init_media = __esm({
|
|
|
63223
63372
|
init_audioAutomationVolume();
|
|
63224
63373
|
init_playbackRate();
|
|
63225
63374
|
init_audioGain();
|
|
63375
|
+
init_audioGroups();
|
|
63226
63376
|
init_renderFrameSibling();
|
|
63227
63377
|
init_playbackRate();
|
|
63228
63378
|
}
|
|
63229
63379
|
});
|
|
63230
63380
|
|
|
63231
63381
|
// ../core/dist/runtime/startResolver.js
|
|
63232
|
-
function parseDurationAttr(element) {
|
|
63233
|
-
return parseNumeric2(element.getAttribute("data-duration"));
|
|
63234
|
-
}
|
|
63235
|
-
function parseEndAttr(element) {
|
|
63236
|
-
return parseNumeric2(element.getAttribute("data-end"));
|
|
63237
|
-
}
|
|
63238
|
-
function parseAuthoredDurationAttr(element) {
|
|
63239
|
-
return parseNumeric2(element.getAttribute(AUTHORED_DURATION_ATTR));
|
|
63240
|
-
}
|
|
63241
|
-
function parseAuthoredEndAttr(element) {
|
|
63242
|
-
return parseNumeric2(element.getAttribute(AUTHORED_END_ATTR));
|
|
63243
|
-
}
|
|
63244
63382
|
function createRuntimeStartTimeResolver(params) {
|
|
63245
63383
|
const timelineRegistry = params.timelineRegistry ?? {};
|
|
63246
63384
|
const includeAuthoredTimingAttrs = params.includeAuthoredTimingAttrs ?? false;
|
|
@@ -63265,18 +63403,23 @@ function createRuntimeStartTimeResolver(params) {
|
|
|
63265
63403
|
if (cached3 !== void 0)
|
|
63266
63404
|
return cached3;
|
|
63267
63405
|
let resolved2 = null;
|
|
63268
|
-
const
|
|
63269
|
-
|
|
63270
|
-
|
|
63406
|
+
const durationTiming = resolveAuthoredTimingWindow({
|
|
63407
|
+
start: 0,
|
|
63408
|
+
duration: element.getAttribute("data-duration"),
|
|
63409
|
+
authoredDuration: includeAuthoredTimingAttrs ? element.getAttribute("data-hf-authored-duration") : null
|
|
63410
|
+
});
|
|
63411
|
+
if (durationTiming?.duration != null && durationTiming.duration > 0) {
|
|
63412
|
+
resolved2 = durationTiming.duration;
|
|
63271
63413
|
}
|
|
63272
63414
|
if (resolved2 == null || resolved2 <= 0) {
|
|
63273
|
-
const
|
|
63274
|
-
|
|
63275
|
-
|
|
63276
|
-
|
|
63277
|
-
|
|
63278
|
-
|
|
63279
|
-
|
|
63415
|
+
const start = resolveStartForElementInternal(element, 0);
|
|
63416
|
+
const endTiming = resolveAuthoredTimingWindow({
|
|
63417
|
+
start,
|
|
63418
|
+
end: element.getAttribute("data-end"),
|
|
63419
|
+
authoredEnd: includeAuthoredTimingAttrs ? element.getAttribute("data-hf-authored-end") : null
|
|
63420
|
+
});
|
|
63421
|
+
if (endTiming?.duration != null && endTiming.duration > 0) {
|
|
63422
|
+
resolved2 = endTiming.duration;
|
|
63280
63423
|
}
|
|
63281
63424
|
}
|
|
63282
63425
|
if ((resolved2 == null || resolved2 <= 0) && isMediaElement2(element)) {
|
|
@@ -63373,16 +63516,14 @@ function createRuntimeStartTimeResolver(params) {
|
|
|
63373
63516
|
resolveDurationForElement: (element) => resolveDurationForElement(element)
|
|
63374
63517
|
};
|
|
63375
63518
|
}
|
|
63376
|
-
var AUTHORED_DURATION_ATTR, AUTHORED_END_ATTR;
|
|
63377
63519
|
var init_startResolver = __esm({
|
|
63378
63520
|
"../core/dist/runtime/startResolver.js"() {
|
|
63379
63521
|
"use strict";
|
|
63380
63522
|
init_diagnostics();
|
|
63523
|
+
init_authoredTiming();
|
|
63381
63524
|
init_media();
|
|
63382
63525
|
init_playbackRate();
|
|
63383
63526
|
init_startExpression();
|
|
63384
|
-
AUTHORED_DURATION_ATTR = "data-hf-authored-duration";
|
|
63385
|
-
AUTHORED_END_ATTR = "data-hf-authored-end";
|
|
63386
63527
|
}
|
|
63387
63528
|
});
|
|
63388
63529
|
|
|
@@ -63685,6 +63826,7 @@ var init_canaryRegistry = __esm({
|
|
|
63685
63826
|
// ../core/dist/index.js
|
|
63686
63827
|
var dist_exports = {};
|
|
63687
63828
|
__export(dist_exports, {
|
|
63829
|
+
AUDIO_GROUP_RENDER_ID_ATTR: () => AUDIO_GROUP_RENDER_ID_ATTR,
|
|
63688
63830
|
BASE_STYLES: () => BASE_STYLES,
|
|
63689
63831
|
CANARIES: () => CANARIES,
|
|
63690
63832
|
CANONICAL_AUTHORED_TIMING_ATTRIBUTES: () => CANONICAL_AUTHORED_TIMING_ATTRIBUTES2,
|
|
@@ -63809,6 +63951,7 @@ __export(dist_exports, {
|
|
|
63809
63951
|
redactTelemetryString: () => redactTelemetryString,
|
|
63810
63952
|
removeElementFromHtml: () => removeElementFromHtml,
|
|
63811
63953
|
renderFrameIdForRenderId: () => renderFrameIdForRenderId,
|
|
63954
|
+
resolveAuthoredTimingWindow: () => resolveAuthoredTimingWindow,
|
|
63812
63955
|
resolveHfColorGradingVariables: () => resolveHfColorGradingVariables,
|
|
63813
63956
|
resolveNaturalMediaTimelineDuration: () => resolveNaturalMediaTimelineDuration,
|
|
63814
63957
|
resolveNaturalMediaTimelineDurationFromValues: () => resolveNaturalMediaTimelineDurationFromValues,
|
|
@@ -63837,6 +63980,7 @@ var init_dist3 = __esm({
|
|
|
63837
63980
|
"../core/dist/index.js"() {
|
|
63838
63981
|
"use strict";
|
|
63839
63982
|
init_slideshow2();
|
|
63983
|
+
init_authoredTiming();
|
|
63840
63984
|
init_core_types();
|
|
63841
63985
|
init_base();
|
|
63842
63986
|
init_constants2();
|
|
@@ -69343,18 +69487,13 @@ async function prepareFrameForCapture(session, frameIndex, time) {
|
|
|
69343
69487
|
}
|
|
69344
69488
|
return { quantizedTime, seekMs, beforeCaptureMs };
|
|
69345
69489
|
}
|
|
69346
|
-
|
|
69347
|
-
const schedule = await page.evaluate(
|
|
69348
|
-
() => Array.from(document.querySelectorAll("[data-start]")).map((el) => ({
|
|
69349
|
-
start: parseFloat(el.dataset.start || ""),
|
|
69350
|
-
dur: parseFloat(el.dataset.duration || "")
|
|
69351
|
-
}))
|
|
69352
|
-
);
|
|
69490
|
+
function computeAuthoredClipBoundaryFrames(schedule, fps) {
|
|
69353
69491
|
const frames = /* @__PURE__ */ new Set();
|
|
69354
|
-
for (const
|
|
69355
|
-
|
|
69356
|
-
|
|
69357
|
-
|
|
69492
|
+
for (const rawTiming of schedule) {
|
|
69493
|
+
const timing2 = resolveAuthoredTimingWindow(rawTiming);
|
|
69494
|
+
if (!timing2) continue;
|
|
69495
|
+
const edges = [Math.round(timing2.start * fps)];
|
|
69496
|
+
if (timing2.end != null) edges.push(Math.round(timing2.end * fps));
|
|
69358
69497
|
for (const e3 of edges) {
|
|
69359
69498
|
for (const f3 of [e3 - 1, e3, e3 + 1]) {
|
|
69360
69499
|
if (f3 >= 0) frames.add(f3);
|
|
@@ -69363,6 +69502,18 @@ async function computeClipBoundaryFrames(page, fps) {
|
|
|
69363
69502
|
}
|
|
69364
69503
|
return frames;
|
|
69365
69504
|
}
|
|
69505
|
+
async function computeClipBoundaryFrames(page, fps) {
|
|
69506
|
+
const schedule = await page.evaluate(
|
|
69507
|
+
() => Array.from(document.querySelectorAll("[data-start]")).map((el) => ({
|
|
69508
|
+
start: el.getAttribute("data-start"),
|
|
69509
|
+
duration: el.getAttribute("data-duration"),
|
|
69510
|
+
authoredDuration: el.getAttribute("data-hf-authored-duration"),
|
|
69511
|
+
end: el.getAttribute("data-end"),
|
|
69512
|
+
authoredEnd: el.getAttribute("data-hf-authored-end")
|
|
69513
|
+
}))
|
|
69514
|
+
);
|
|
69515
|
+
return computeAuthoredClipBoundaryFrames(schedule, fps);
|
|
69516
|
+
}
|
|
69366
69517
|
function isStaticDedupFrameAnalysisSafe(totalFrames) {
|
|
69367
69518
|
return Number.isFinite(totalFrames) && Number.isSafeInteger(totalFrames) && totalFrames > 0 && totalFrames <= MAX_STATIC_DEDUP_ANALYSIS_FRAMES;
|
|
69368
69519
|
}
|
|
@@ -69484,62 +69635,157 @@ async function computeStaticFrameSet(page, fps) {
|
|
|
69484
69635
|
reason: eligible ? "eligible" : reasons.join("+")
|
|
69485
69636
|
};
|
|
69486
69637
|
}
|
|
69487
|
-
function
|
|
69488
|
-
const span = b2 - a;
|
|
69489
|
-
const lengthScaledPoints = span > 0 ? Math.ceil(span / STATIC_VERIFY_REFERENCE_STRIDE) + 1 : 1;
|
|
69490
|
-
const perRun = Math.max(3, sampleCount, lengthScaledPoints);
|
|
69491
|
-
const stride = span > 0 ? Math.max(1, Math.floor(span / (perRun - 1))) : 1;
|
|
69492
|
-
const pts = /* @__PURE__ */ new Set();
|
|
69493
|
-
for (let f3 = a; f3 <= b2; f3 += stride) pts.add(f3);
|
|
69494
|
-
pts.add(b2);
|
|
69495
|
-
return [...pts].sort((x3, y) => x3 - y);
|
|
69496
|
-
}
|
|
69497
|
-
async function verifyStaticFramesSafe(session, page, staticFrames, fps, sampleCount) {
|
|
69498
|
-
const frames = [...staticFrames].sort((a, b2) => a - b2);
|
|
69499
|
-
if (frames.length === 0) return null;
|
|
69500
|
-
const deadline = Date.now() + STATIC_VERIFY_MAX_MS;
|
|
69638
|
+
function contiguousStaticRuns(frames) {
|
|
69501
69639
|
const runs = [];
|
|
69502
|
-
for (const
|
|
69503
|
-
const last = runs
|
|
69504
|
-
if (last &&
|
|
69505
|
-
else runs.push({ a:
|
|
69640
|
+
for (const frame of frames) {
|
|
69641
|
+
const last = runs.at(-1);
|
|
69642
|
+
if (last && frame === last.b + 1) last.b = frame;
|
|
69643
|
+
else runs.push({ a: frame, b: frame });
|
|
69506
69644
|
}
|
|
69645
|
+
return runs;
|
|
69646
|
+
}
|
|
69647
|
+
function mandatoryRunComparisons(anchor, end) {
|
|
69648
|
+
const points = /* @__PURE__ */ new Set();
|
|
69649
|
+
for (let frame = anchor + STATIC_VERIFY_REFERENCE_STRIDE; frame < end; frame += STATIC_VERIFY_REFERENCE_STRIDE) {
|
|
69650
|
+
points.add(frame);
|
|
69651
|
+
}
|
|
69652
|
+
points.add(end);
|
|
69653
|
+
return [...points].sort((left, right) => left - right);
|
|
69654
|
+
}
|
|
69655
|
+
function planStaticVerification(staticFrames, sampleFloor) {
|
|
69656
|
+
const frames = [...staticFrames].sort((left, right) => left - right);
|
|
69657
|
+
const allRuns = contiguousStaticRuns(frames).map(({ a, b: b2 }) => {
|
|
69658
|
+
const comparisons = mandatoryRunComparisons(a - 1, b2);
|
|
69659
|
+
const frameCount = b2 - a + 1;
|
|
69660
|
+
return {
|
|
69661
|
+
a,
|
|
69662
|
+
b: b2,
|
|
69663
|
+
anchor: a - 1,
|
|
69664
|
+
comparisons,
|
|
69665
|
+
frameCount,
|
|
69666
|
+
netSavings: frameCount - comparisons.length - 1
|
|
69667
|
+
};
|
|
69668
|
+
});
|
|
69669
|
+
const runs = allRuns.filter((run2) => run2.anchor >= 0 && run2.netSavings > 0);
|
|
69670
|
+
const skippedRuns = allRuns.filter((run2) => run2.anchor < 0 || run2.netSavings <= 0).map((run2) => ({ a: run2.a, b: run2.b, reason: "unprofitable" }));
|
|
69671
|
+
const normalizedSampleFloor = Number.isFinite(sampleFloor) ? Math.max(1, Math.floor(sampleFloor)) : 1;
|
|
69672
|
+
const effectiveSampleFloor = Math.min(
|
|
69673
|
+
normalizedSampleFloor,
|
|
69674
|
+
STATIC_VERIFY_MAX_GLOBAL_SAMPLE_FLOOR
|
|
69675
|
+
);
|
|
69676
|
+
const comparisonCount = () => runs.reduce((sum, run2) => sum + run2.comparisons.length, 0);
|
|
69677
|
+
while (comparisonCount() < effectiveSampleFloor) {
|
|
69678
|
+
const candidates = runs.filter((run2) => run2.frameCount > run2.comparisons.length + 2).flatMap((run2) => {
|
|
69679
|
+
const points = [run2.anchor, ...run2.comparisons];
|
|
69680
|
+
return points.slice(1).map((right, index) => ({
|
|
69681
|
+
run: run2,
|
|
69682
|
+
left: points[index],
|
|
69683
|
+
right,
|
|
69684
|
+
width: right - points[index]
|
|
69685
|
+
}));
|
|
69686
|
+
}).filter((gap) => gap.width > 1).sort(
|
|
69687
|
+
(left, right) => right.width - left.width || left.run.a - right.run.a || left.left - right.left
|
|
69688
|
+
);
|
|
69689
|
+
const selected = candidates[0];
|
|
69690
|
+
if (!selected) break;
|
|
69691
|
+
selected.run.comparisons.push(Math.floor((selected.left + selected.right) / 2));
|
|
69692
|
+
selected.run.comparisons.sort((left, right) => left - right);
|
|
69693
|
+
selected.run.netSavings = selected.run.frameCount - selected.run.comparisons.length - 1;
|
|
69694
|
+
}
|
|
69695
|
+
runs.sort((left, right) => right.netSavings - left.netSavings || left.a - right.a);
|
|
69696
|
+
const plannedComparisons = comparisonCount();
|
|
69697
|
+
return {
|
|
69698
|
+
runs,
|
|
69699
|
+
skippedRuns,
|
|
69700
|
+
effectiveSampleFloor,
|
|
69701
|
+
predictedFrames: frames.length,
|
|
69702
|
+
verifiedCandidateFrames: runs.reduce((sum, run2) => sum + run2.frameCount, 0),
|
|
69703
|
+
plannedAnchors: runs.length,
|
|
69704
|
+
plannedComparisons,
|
|
69705
|
+
plannedScreenshots: runs.length + plannedComparisons
|
|
69706
|
+
};
|
|
69707
|
+
}
|
|
69708
|
+
async function verifyStaticFramesSafe(session, page, staticFrames, fps, sampleCount, dependencies = {}) {
|
|
69709
|
+
const plan2 = planStaticVerification(staticFrames, sampleCount);
|
|
69710
|
+
const now = dependencies.now ?? Date.now;
|
|
69711
|
+
const capture2 = dependencies.capture ?? pageScreenshotCapture;
|
|
69712
|
+
const startedAt = now();
|
|
69713
|
+
const deadline = startedAt + STATIC_VERIFY_MAX_MS;
|
|
69714
|
+
const verifiedFrames = /* @__PURE__ */ new Set();
|
|
69715
|
+
const stats = {
|
|
69716
|
+
plannedRuns: plan2.runs.length,
|
|
69717
|
+
completedRuns: 0,
|
|
69718
|
+
plannedAnchors: plan2.plannedAnchors,
|
|
69719
|
+
completedAnchors: 0,
|
|
69720
|
+
plannedComparisons: plan2.plannedComparisons,
|
|
69721
|
+
completedComparisons: 0,
|
|
69722
|
+
seeks: 0,
|
|
69723
|
+
screenshots: 0,
|
|
69724
|
+
byteComparisons: 0,
|
|
69725
|
+
elapsedMs: 0,
|
|
69726
|
+
predictedFrames: plan2.predictedFrames,
|
|
69727
|
+
verifiedFrames: 0,
|
|
69728
|
+
unverifiedFrames: plan2.predictedFrames
|
|
69729
|
+
};
|
|
69730
|
+
const finish = (outcome, badFrame) => ({
|
|
69731
|
+
outcome,
|
|
69732
|
+
verifiedFrames,
|
|
69733
|
+
...badFrame == null ? {} : { badFrame },
|
|
69734
|
+
stats
|
|
69735
|
+
});
|
|
69736
|
+
if (plan2.runs.length === 0) return finish("unprofitable");
|
|
69507
69737
|
const seekToFrame = async (frameIdx) => {
|
|
69738
|
+
stats.seeks++;
|
|
69508
69739
|
const t2 = quantizeTimeToFrame(frameIdx / fps, fps);
|
|
69509
69740
|
await page.evaluate((tt3) => {
|
|
69510
69741
|
const hf = window.__hf;
|
|
69511
69742
|
if (hf && typeof hf.seek === "function") hf.seek(tt3, { suppressEvents: true });
|
|
69512
69743
|
}, t2);
|
|
69513
69744
|
};
|
|
69745
|
+
const hardCap = Math.max(
|
|
69746
|
+
STATIC_VERIFY_MIN_SCREENSHOT_CAP,
|
|
69747
|
+
plan2.effectiveSampleFloor * STATIC_VERIFY_SAMPLE_CAP_MULTIPLIER,
|
|
69748
|
+
Math.ceil(plan2.predictedFrames / STATIC_VERIFY_REFERENCE_STRIDE) * 3 + plan2.runs.length
|
|
69749
|
+
);
|
|
69514
69750
|
const seekCapture = async (frameIdx) => {
|
|
69751
|
+
if (now() >= deadline) return "time_budget";
|
|
69752
|
+
if (stats.screenshots >= hardCap) return "count_budget";
|
|
69515
69753
|
await seekToFrame(frameIdx);
|
|
69516
|
-
|
|
69754
|
+
stats.screenshots++;
|
|
69755
|
+
return capture2(page, session.options);
|
|
69517
69756
|
};
|
|
69518
|
-
const hardCap = Math.max(
|
|
69519
|
-
sampleCount * 8,
|
|
69520
|
-
400,
|
|
69521
|
-
Math.ceil(frames.length / STATIC_VERIFY_REFERENCE_STRIDE) * 3 + runs.length
|
|
69522
|
-
);
|
|
69523
69757
|
try {
|
|
69524
|
-
|
|
69525
|
-
|
|
69526
|
-
|
|
69527
|
-
|
|
69528
|
-
|
|
69529
|
-
const anchorBuf = await seekCapture(anchor);
|
|
69530
|
-
spent++;
|
|
69531
|
-
for (const f3 of computeStaticVerificationPoints(a, b2, sampleCount)) {
|
|
69532
|
-
if (Date.now() >= deadline) return { badFrame: f3, budgetExhausted: true };
|
|
69758
|
+
for (const run2 of plan2.runs) {
|
|
69759
|
+
const anchorBuf = await seekCapture(run2.anchor);
|
|
69760
|
+
if (typeof anchorBuf === "string") return finish(anchorBuf, run2.a);
|
|
69761
|
+
stats.completedAnchors++;
|
|
69762
|
+
for (const f3 of run2.comparisons) {
|
|
69533
69763
|
const cur = await seekCapture(f3);
|
|
69534
|
-
|
|
69535
|
-
|
|
69536
|
-
|
|
69537
|
-
|
|
69538
|
-
|
|
69539
|
-
|
|
69764
|
+
if (typeof cur === "string") return finish(cur, f3);
|
|
69765
|
+
stats.completedComparisons++;
|
|
69766
|
+
stats.byteComparisons++;
|
|
69767
|
+
if (!anchorBuf.equals(cur)) {
|
|
69768
|
+
verifiedFrames.clear();
|
|
69769
|
+
stats.verifiedFrames = 0;
|
|
69770
|
+
stats.unverifiedFrames = plan2.predictedFrames;
|
|
69771
|
+
return finish("mismatch", f3);
|
|
69772
|
+
}
|
|
69773
|
+
}
|
|
69774
|
+
stats.completedRuns++;
|
|
69775
|
+
for (let frame = run2.a; frame <= run2.b; frame++) verifiedFrames.add(frame);
|
|
69776
|
+
stats.verifiedFrames = verifiedFrames.size;
|
|
69777
|
+
stats.unverifiedFrames = plan2.predictedFrames - verifiedFrames.size;
|
|
69778
|
+
}
|
|
69779
|
+
return finish("verified");
|
|
69780
|
+
} catch {
|
|
69781
|
+
verifiedFrames.clear();
|
|
69782
|
+
stats.verifiedFrames = 0;
|
|
69783
|
+
stats.unverifiedFrames = plan2.predictedFrames;
|
|
69784
|
+
return finish("infrastructure");
|
|
69540
69785
|
} finally {
|
|
69541
69786
|
await seekToFrame(0).catch(() => {
|
|
69542
69787
|
});
|
|
69788
|
+
stats.elapsedMs = Math.max(0, now() - startedAt);
|
|
69543
69789
|
}
|
|
69544
69790
|
}
|
|
69545
69791
|
async function armStaticDedup(session, page, logInitPhase) {
|
|
@@ -69575,17 +69821,38 @@ async function armStaticDedup(session, page, logInitPhase) {
|
|
|
69575
69821
|
}
|
|
69576
69822
|
const rawSamples = Number(process.env.HF_STATIC_DEDUP_SAMPLES ?? "24");
|
|
69577
69823
|
const samples = Number.isFinite(rawSamples) && rawSamples >= 1 ? rawSamples : 24;
|
|
69578
|
-
|
|
69579
|
-
if (
|
|
69580
|
-
session.
|
|
69824
|
+
session.staticDedupPredictedCount = stats.staticFrameSet.size;
|
|
69825
|
+
if (process.env.HF_STATIC_DEDUP_VERIFY === "false") {
|
|
69826
|
+
session.staticFrames = stats.staticFrameSet;
|
|
69581
69827
|
logInitPhase(
|
|
69582
|
-
|
|
69828
|
+
`static-frame dedup: ${stats.staticFrameSet.size}/${stats.totalFrames} frame(s) reusable (verification explicitly disabled)`
|
|
69583
69829
|
);
|
|
69584
69830
|
return;
|
|
69585
69831
|
}
|
|
69586
|
-
|
|
69832
|
+
const verdict = await verifyStaticFramesSafe(session, page, stats.staticFrameSet, fps, samples);
|
|
69833
|
+
session.staticDedupVerification = verdict;
|
|
69834
|
+
if (verdict.outcome === "mismatch" || verdict.outcome === "infrastructure") {
|
|
69835
|
+
session.staticDedupSkipReason = "verification_failed";
|
|
69836
|
+
logInitPhase(
|
|
69837
|
+
verdict.outcome === "mismatch" ? `static-frame dedup: disabled (verification mismatch at predicted-static frame ${verdict.badFrame})` : "static-frame dedup: disabled (verification infrastructure failure)"
|
|
69838
|
+
);
|
|
69839
|
+
return;
|
|
69840
|
+
}
|
|
69841
|
+
if (verdict.outcome === "unprofitable") {
|
|
69842
|
+
session.staticDedupSkipReason = "unprofitable";
|
|
69843
|
+
logInitPhase("static-frame dedup: disabled (verification cost cannot save captures)");
|
|
69844
|
+
return;
|
|
69845
|
+
}
|
|
69846
|
+
if (verdict.verifiedFrames.size === 0) {
|
|
69847
|
+
session.staticDedupSkipReason = "verification_budget";
|
|
69848
|
+
logInitPhase(
|
|
69849
|
+
`static-frame dedup: disabled (${verdict.outcome} before frame ${verdict.badFrame}; no run fully verified)`
|
|
69850
|
+
);
|
|
69851
|
+
return;
|
|
69852
|
+
}
|
|
69853
|
+
session.staticFrames = verdict.verifiedFrames;
|
|
69587
69854
|
logInitPhase(
|
|
69588
|
-
`static-frame dedup: ${
|
|
69855
|
+
`static-frame dedup: ${verdict.verifiedFrames.size}/${stats.staticFrameSet.size} predicted frame(s) reusable (outcome=${verdict.outcome}, runs=${verdict.stats.completedRuns}/${verdict.stats.plannedRuns}, screenshots=${verdict.stats.screenshots}, seeks=${verdict.stats.seeks}, elapsedMs=${verdict.stats.elapsedMs})`
|
|
69589
69856
|
);
|
|
69590
69857
|
}
|
|
69591
69858
|
async function computeTimelineAtRiskFrames(page, fps) {
|
|
@@ -69652,8 +69919,9 @@ async function captureFrameCore(session, frameIndex, time) {
|
|
|
69652
69919
|
const { page, options } = session;
|
|
69653
69920
|
const startTime = Date.now();
|
|
69654
69921
|
const absFrameIndex = Math.floor(time * fpsToNumber(options.fps) + 1e-9);
|
|
69655
|
-
if (session.staticFrames?.has(absFrameIndex) && session.lastFrameBuffer) {
|
|
69922
|
+
if (session.staticFrames?.has(absFrameIndex) && session.lastFrameBuffer && session.lastFrameAbsoluteIndex === absFrameIndex - 1) {
|
|
69656
69923
|
session.staticDedupCount = (session.staticDedupCount ?? 0) + 1;
|
|
69924
|
+
session.lastFrameAbsoluteIndex = absFrameIndex;
|
|
69657
69925
|
return {
|
|
69658
69926
|
buffer: session.lastFrameBuffer,
|
|
69659
69927
|
quantizedTime: quantizeTimeToFrame(time, fpsToNumber(options.fps)),
|
|
@@ -69740,7 +70008,10 @@ async function captureFrameCore(session, frameIndex, time) {
|
|
|
69740
70008
|
session.capturePerf.screenshotMs += screenshotMs;
|
|
69741
70009
|
session.capturePerf.totalMs += captureTimeMs;
|
|
69742
70010
|
session.capturePerf.frameMs.push(captureTimeMs);
|
|
69743
|
-
if (session.staticFrames)
|
|
70011
|
+
if (session.staticFrames) {
|
|
70012
|
+
session.lastFrameBuffer = screenshotBuffer;
|
|
70013
|
+
session.lastFrameAbsoluteIndex = absFrameIndex;
|
|
70014
|
+
}
|
|
69744
70015
|
return { buffer: screenshotBuffer, quantizedTime, captureTimeMs };
|
|
69745
70016
|
} catch (captureError) {
|
|
69746
70017
|
if (session.isInitialized) {
|
|
@@ -69923,6 +70194,7 @@ async function discardWarmupCapture(session, frameIndex = 0, time = 0, innerCapt
|
|
|
69923
70194
|
const noDamageBefore = session.beginFrameNoDamageCount;
|
|
69924
70195
|
const dedupCountBefore = session.staticDedupCount;
|
|
69925
70196
|
const lastFrameBufferBefore = session.lastFrameBuffer;
|
|
70197
|
+
const lastFrameAbsoluteIndexBefore = session.lastFrameAbsoluteIndex;
|
|
69926
70198
|
try {
|
|
69927
70199
|
await innerCapture(session, frameIndex, time);
|
|
69928
70200
|
} finally {
|
|
@@ -69931,6 +70203,7 @@ async function discardWarmupCapture(session, frameIndex = 0, time = 0, innerCapt
|
|
|
69931
70203
|
session.beginFrameNoDamageCount = noDamageBefore;
|
|
69932
70204
|
session.staticDedupCount = dedupCountBefore;
|
|
69933
70205
|
session.lastFrameBuffer = lastFrameBufferBefore;
|
|
70206
|
+
session.lastFrameAbsoluteIndex = lastFrameAbsoluteIndexBefore;
|
|
69934
70207
|
}
|
|
69935
70208
|
}
|
|
69936
70209
|
async function closeCaptureSession(session) {
|
|
@@ -69988,6 +70261,7 @@ function prepareCaptureSessionForReuse(session, outputDir, onBeforeCapture) {
|
|
|
69988
70261
|
session.beginFrameHasDamageCount = 0;
|
|
69989
70262
|
session.beginFrameNoDamageCount = 0;
|
|
69990
70263
|
session.lastFrameBuffer = void 0;
|
|
70264
|
+
session.lastFrameAbsoluteIndex = void 0;
|
|
69991
70265
|
session.staticDedupCount = 0;
|
|
69992
70266
|
}
|
|
69993
70267
|
async function getCompositionDuration(session) {
|
|
@@ -70081,9 +70355,17 @@ function getCapturePerfSummary(session) {
|
|
|
70081
70355
|
warnings: cloneCaptureWarnings(session.warnings),
|
|
70082
70356
|
staticDedupReused: session.staticDedupCount ?? 0,
|
|
70083
70357
|
staticDedupEnabled: session.staticDedupEnabled ?? false,
|
|
70084
|
-
// armed ⟺ a non-empty static set survived verification
|
|
70358
|
+
// armed ⟺ a non-empty static set survived verification.
|
|
70085
70359
|
staticDedupArmed: (session.staticFrames?.size ?? 0) > 0,
|
|
70086
|
-
staticDedupPredicted: session.
|
|
70360
|
+
staticDedupPredicted: session.staticDedupPredictedCount ?? 0,
|
|
70361
|
+
staticDedupVerified: session.staticFrames?.size ?? 0,
|
|
70362
|
+
staticDedupVerificationOutcome: session.staticDedupVerification?.outcome,
|
|
70363
|
+
staticDedupVerificationPlannedRuns: session.staticDedupVerification?.stats.plannedRuns,
|
|
70364
|
+
staticDedupVerificationCompletedRuns: session.staticDedupVerification?.stats.completedRuns,
|
|
70365
|
+
staticDedupVerificationScreenshots: session.staticDedupVerification?.stats.screenshots,
|
|
70366
|
+
staticDedupVerificationSeeks: session.staticDedupVerification?.stats.seeks,
|
|
70367
|
+
staticDedupVerificationComparisons: session.staticDedupVerification?.stats.byteComparisons,
|
|
70368
|
+
staticDedupVerificationElapsedMs: session.staticDedupVerification?.stats.elapsedMs,
|
|
70087
70369
|
staticDedupSkipReason: session.staticDedupSkipReason,
|
|
70088
70370
|
beginFrameNoDamage: session.beginFrameNoDamageCount,
|
|
70089
70371
|
beginFrameHasDamage: session.beginFrameHasDamageCount,
|
|
@@ -70098,7 +70380,7 @@ function getCapturePerfSummary(session) {
|
|
|
70098
70380
|
deNcprFallbacks: session.deNcprFallbacks ?? 0
|
|
70099
70381
|
};
|
|
70100
70382
|
}
|
|
70101
|
-
var DrawElementVerificationError, BROWSER_CONSOLE_BUFFER_SIZE, CAPTURE_SESSION_CLOSE_TIMEOUT_MS, LOCKED_WARMUP_TICKS, realSleep, BEGIN_FRAME_CAPTURE_HEADROOM_INTERVALS, BEGIN_FRAME_COMMIT_LEAD_INTERVALS, BEGIN_FRAME_PROBE_LEAD_INTERVALS, HF_READY_DIAGNOSTIC_EXPR, LIVE_MAP_MARKERS, MAX_STATIC_DEDUP_ANALYSIS_FRAMES, STATIC_VERIFY_REFERENCE_STRIDE, STATIC_VERIFY_MAX_MS;
|
|
70383
|
+
var DrawElementVerificationError, BROWSER_CONSOLE_BUFFER_SIZE, CAPTURE_SESSION_CLOSE_TIMEOUT_MS, LOCKED_WARMUP_TICKS, realSleep, BEGIN_FRAME_CAPTURE_HEADROOM_INTERVALS, BEGIN_FRAME_COMMIT_LEAD_INTERVALS, BEGIN_FRAME_PROBE_LEAD_INTERVALS, HF_READY_DIAGNOSTIC_EXPR, LIVE_MAP_MARKERS, MAX_STATIC_DEDUP_ANALYSIS_FRAMES, STATIC_VERIFY_REFERENCE_STRIDE, STATIC_VERIFY_MAX_MS, STATIC_VERIFY_MIN_SCREENSHOT_CAP, STATIC_VERIFY_SAMPLE_CAP_MULTIPLIER, STATIC_VERIFY_MAX_GLOBAL_SAMPLE_FLOOR;
|
|
70102
70384
|
var init_frameCapture = __esm({
|
|
70103
70385
|
"../engine/src/services/frameCapture.ts"() {
|
|
70104
70386
|
"use strict";
|
|
@@ -70163,6 +70445,9 @@ var init_frameCapture = __esm({
|
|
|
70163
70445
|
MAX_STATIC_DEDUP_ANALYSIS_FRAMES = 1e6;
|
|
70164
70446
|
STATIC_VERIFY_REFERENCE_STRIDE = 24;
|
|
70165
70447
|
STATIC_VERIFY_MAX_MS = 15e3;
|
|
70448
|
+
STATIC_VERIFY_MIN_SCREENSHOT_CAP = 400;
|
|
70449
|
+
STATIC_VERIFY_SAMPLE_CAP_MULTIPLIER = 8;
|
|
70450
|
+
STATIC_VERIFY_MAX_GLOBAL_SAMPLE_FLOOR = STATIC_VERIFY_MIN_SCREENSHOT_CAP / STATIC_VERIFY_SAMPLE_CAP_MULTIPLIER;
|
|
70166
70451
|
}
|
|
70167
70452
|
});
|
|
70168
70453
|
|
|
@@ -80372,6 +80657,73 @@ function findCarveUngroupedSourcesFindings(ctx) {
|
|
|
80372
80657
|
}
|
|
80373
80658
|
return findings;
|
|
80374
80659
|
}
|
|
80660
|
+
function findAudioGroupNoMembersFindings(ctx) {
|
|
80661
|
+
const memberGroupIds = new Set(
|
|
80662
|
+
ctx.tags.filter((tag) => tag.name === "audio").map((tag) => readAttr(tag.raw, "data-audio-group")).filter((id) => Boolean(id))
|
|
80663
|
+
);
|
|
80664
|
+
if (memberGroupIds.size === 0) return [];
|
|
80665
|
+
const mayHaveCrossFileMembers = ctx.tags.some(
|
|
80666
|
+
(tag) => Boolean(readAttr(tag.raw, "data-composition-src"))
|
|
80667
|
+
);
|
|
80668
|
+
const declaredGroupIds = new Set(
|
|
80669
|
+
ctx.tags.filter((tag) => tag.name === "hf-audio-group").map((tag) => readAttr(tag.raw, "id")).filter((id) => Boolean(id))
|
|
80670
|
+
);
|
|
80671
|
+
const unmatchedMemberGroupIds = [...memberGroupIds].filter((id) => !declaredGroupIds.has(id));
|
|
80672
|
+
const findings = [];
|
|
80673
|
+
for (const tag of ctx.tags) {
|
|
80674
|
+
if (tag.name !== "hf-audio-group") continue;
|
|
80675
|
+
const elementId = readAttr(tag.raw, "id");
|
|
80676
|
+
if (!elementId) continue;
|
|
80677
|
+
if (memberGroupIds.has(elementId)) continue;
|
|
80678
|
+
if (mayHaveCrossFileMembers) continue;
|
|
80679
|
+
const nearby = unmatchedMemberGroupIds.filter((id) => id !== elementId);
|
|
80680
|
+
const suffix = nearby.length > 0 ? ` Clips in this file name ${nearby.map((id) => `"${id}"`).join(", ")} instead.` : "";
|
|
80681
|
+
findings.push({
|
|
80682
|
+
code: "audio_group_no_members",
|
|
80683
|
+
severity: "error",
|
|
80684
|
+
message: `#${elementId} is an audio group no clip belongs to, so its fader, effect chain and automation are dropped.${suffix}`,
|
|
80685
|
+
elementId,
|
|
80686
|
+
fixHint: `Add \`data-audio-group="${elementId}"\` to the clips this bus is for, or delete the bus.`,
|
|
80687
|
+
snippet: truncateSnippet(tag.raw)
|
|
80688
|
+
});
|
|
80689
|
+
}
|
|
80690
|
+
return findings;
|
|
80691
|
+
}
|
|
80692
|
+
function findAudioGroupTimingAttrFindings(ctx) {
|
|
80693
|
+
const findings = [];
|
|
80694
|
+
for (const tag of ctx.tags) {
|
|
80695
|
+
if (tag.name !== "hf-audio-group") continue;
|
|
80696
|
+
const present = AUDIO_GROUP_TIMING_ATTRS.filter((attr2) => hasAttrName(tag.raw, attr2));
|
|
80697
|
+
if (present.length === 0) continue;
|
|
80698
|
+
const elementId = readAttr(tag.raw, "id") || void 0;
|
|
80699
|
+
findings.push({
|
|
80700
|
+
code: "audio_group_timing_attrs",
|
|
80701
|
+
severity: "warning",
|
|
80702
|
+
message: `${elementId ? `#${elementId}` : "This audio group"} carries ${present.map((attr2) => `\`${attr2}\``).join(", ")}, which a bus has no use for \u2014 its members carry the timing and its automation clock is composition time.`,
|
|
80703
|
+
elementId,
|
|
80704
|
+
fixHint: `Remove ${present.map((attr2) => `\`${attr2}\``).join(", ")} from the group element.`,
|
|
80705
|
+
snippet: truncateSnippet(tag.raw)
|
|
80706
|
+
});
|
|
80707
|
+
}
|
|
80708
|
+
return findings;
|
|
80709
|
+
}
|
|
80710
|
+
function findAudioGroupCarveAttrFindings(ctx) {
|
|
80711
|
+
const findings = [];
|
|
80712
|
+
for (const tag of ctx.tags) {
|
|
80713
|
+
if (tag.name !== "hf-audio-group") continue;
|
|
80714
|
+
if (!hasAttrName(tag.raw, "data-fx-carve")) continue;
|
|
80715
|
+
const elementId = readAttr(tag.raw, "id") || void 0;
|
|
80716
|
+
findings.push({
|
|
80717
|
+
code: "audio_group_carve_attr",
|
|
80718
|
+
severity: "warning",
|
|
80719
|
+
message: `${elementId ? `#${elementId}` : "This audio group"} carries \`data-fx-carve\`, which belongs on the clip being carved \u2014 a bus has no audio of its own to level-match against, and a carve here stacks with any its members already have.`,
|
|
80720
|
+
elementId,
|
|
80721
|
+
fixHint: "Remove `data-fx-carve` and the `fromCarve` nodes it wrote into this bus's `data-fx-chain`, and carve the bed clip instead.",
|
|
80722
|
+
snippet: truncateSnippet(tag.raw)
|
|
80723
|
+
});
|
|
80724
|
+
}
|
|
80725
|
+
return findings;
|
|
80726
|
+
}
|
|
80375
80727
|
async function loadParseGsapScript() {
|
|
80376
80728
|
const mod = await Promise.resolve().then(() => (init_gsapParserAcorn(), gsapParserAcorn_exports));
|
|
80377
80729
|
return mod.parseGsapScriptAcorn;
|
|
@@ -82051,7 +82403,7 @@ function isSnippetFragment(html) {
|
|
|
82051
82403
|
if (!firstTag) return false;
|
|
82052
82404
|
return /\bdata-hf-snippet\b/.test(firstTag[0]);
|
|
82053
82405
|
}
|
|
82054
|
-
var import_postcss_selector_parser, COMPOSITION_ID_IN_CSS_PATTERN, TIMELINE_REGISTRY_INIT_PATTERN, TIMELINE_REGISTRY_OBJECT_LITERAL_PATTERN, TIMELINE_REGISTRY_ASSIGN_PATTERN, WINDOW_TIMELINE_ASSIGN_PATTERN, INVALID_SCRIPT_CLOSE_PATTERN, TIMELINE_REGISTRY_KEY_PATTERN, TIMELINE_REGISTRY_OBJECT_OPEN_PATTERN, TIMELINE_REGISTRY_OBJECT_ENTRY_PATTERN, VISIBLE_MARKUP_COMMENT_PATTERN, VISIBLE_MARKUP_COMMENT_PROTECTED_BLOCK_PATTERN, coreRules, mediaRules, SCENE_BOUNDARY_EPSILON_SECONDS, UNRESOLVED_TARGET, gsapWindowsCache, CONFLICTING_TRANSLATE_PROPS, CONFLICTING_SCALE_PROPS, RELATIVE_TWEEN_VALUE, TRANSFORM_SENSITIVE_READ, TRANSFORM_INVARIANT_READ, CALLBACK_MEASUREMENT_PATTERN, NUMBER_METHODS, gsapRules, captionRules, MAX_COMPOSITION_LINES, MAX_TIMED_ELEMENTS_PER_TRACK, TRACK_DENSITY_EXEMPT_TAGS, CAPTION_CUE_TOKEN, HEAVY_OVERLAY_ELEMENT_COUNT_WARN, HEAVY_OVERLAY_EXEMPT_TAGS, HEAVY_OVERLAY_CSS_PATTERN, INLINE_STYLE_DISPLAY_NONE_PATTERN, compositionRules, adapterRules, TEXTURE_BASE_CLASS, TEXTURE_CLASS_PREFIX, textureRules, GENERIC_FAMILIES, fontRules, slideshowRules, RULE_GROUPS, LINT_RULE_COUNT, LINT_RULE_GROUP_COUNTS, PROBE_TIMEOUT_MS, PROBE_CONCURRENCY, AUDIO_EXTENSIONS, MASK_IMAGE_URL_RE;
|
|
82406
|
+
var import_postcss_selector_parser, COMPOSITION_ID_IN_CSS_PATTERN, TIMELINE_REGISTRY_INIT_PATTERN, TIMELINE_REGISTRY_OBJECT_LITERAL_PATTERN, TIMELINE_REGISTRY_ASSIGN_PATTERN, WINDOW_TIMELINE_ASSIGN_PATTERN, INVALID_SCRIPT_CLOSE_PATTERN, TIMELINE_REGISTRY_KEY_PATTERN, TIMELINE_REGISTRY_OBJECT_OPEN_PATTERN, TIMELINE_REGISTRY_OBJECT_ENTRY_PATTERN, VISIBLE_MARKUP_COMMENT_PATTERN, VISIBLE_MARKUP_COMMENT_PROTECTED_BLOCK_PATTERN, coreRules, mediaRules, AUDIO_GROUP_TIMING_ATTRS, SCENE_BOUNDARY_EPSILON_SECONDS, UNRESOLVED_TARGET, gsapWindowsCache, CONFLICTING_TRANSLATE_PROPS, CONFLICTING_SCALE_PROPS, RELATIVE_TWEEN_VALUE, TRANSFORM_SENSITIVE_READ, TRANSFORM_INVARIANT_READ, CALLBACK_MEASUREMENT_PATTERN, NUMBER_METHODS, gsapRules, captionRules, MAX_COMPOSITION_LINES, MAX_TIMED_ELEMENTS_PER_TRACK, TRACK_DENSITY_EXEMPT_TAGS, CAPTION_CUE_TOKEN, HEAVY_OVERLAY_ELEMENT_COUNT_WARN, HEAVY_OVERLAY_EXEMPT_TAGS, HEAVY_OVERLAY_CSS_PATTERN, INLINE_STYLE_DISPLAY_NONE_PATTERN, compositionRules, adapterRules, TEXTURE_BASE_CLASS, TEXTURE_CLASS_PREFIX, textureRules, GENERIC_FAMILIES, fontRules, slideshowRules, RULE_GROUPS, LINT_RULE_COUNT, LINT_RULE_GROUP_COUNTS, PROBE_TIMEOUT_MS, PROBE_CONCURRENCY, AUDIO_EXTENSIONS, MASK_IMAGE_URL_RE;
|
|
82055
82407
|
var init_dist4 = __esm({
|
|
82056
82408
|
"../lint/dist/index.js"() {
|
|
82057
82409
|
"use strict";
|
|
@@ -82742,8 +83094,15 @@ var init_dist4 = __esm({
|
|
|
82742
83094
|
// audio_volume_tween_overrides_gain
|
|
82743
83095
|
findVolumeTweenOverridesGainFindings,
|
|
82744
83096
|
// audio_carve_ungrouped_sources
|
|
82745
|
-
findCarveUngroupedSourcesFindings
|
|
83097
|
+
findCarveUngroupedSourcesFindings,
|
|
83098
|
+
// audio_group_no_members
|
|
83099
|
+
findAudioGroupNoMembersFindings,
|
|
83100
|
+
// audio_group_timing_attrs
|
|
83101
|
+
findAudioGroupTimingAttrFindings,
|
|
83102
|
+
// audio_group_carve_attr
|
|
83103
|
+
findAudioGroupCarveAttrFindings
|
|
82746
83104
|
];
|
|
83105
|
+
AUDIO_GROUP_TIMING_ATTRS = ["data-start", "data-duration", "data-track-index"];
|
|
82747
83106
|
SCENE_BOUNDARY_EPSILON_SECONDS = 0.05;
|
|
82748
83107
|
UNRESOLVED_TARGET = "__unresolved__";
|
|
82749
83108
|
gsapWindowsCache = /* @__PURE__ */ new Map();
|
|
@@ -86305,6 +86664,7 @@ var init_htmlParityContract = __esm({
|
|
|
86305
86664
|
// ../core/dist/compiler/index.js
|
|
86306
86665
|
var compiler_exports = {};
|
|
86307
86666
|
__export(compiler_exports, {
|
|
86667
|
+
AUDIO_GROUP_RENDER_ID_ATTR: () => AUDIO_GROUP_RENDER_ID_ATTR,
|
|
86308
86668
|
CSS_URL_RE: () => CSS_URL_RE,
|
|
86309
86669
|
FLATTENED_INNER_ROOT_STRIP_ATTRS: () => FLATTENED_INNER_ROOT_STRIP_ATTRS,
|
|
86310
86670
|
MEDIA_RENDER_ID_ATTR: () => MEDIA_RENDER_ID_ATTR,
|
|
@@ -88607,31 +88967,32 @@ var init_wavChunks = __esm({
|
|
|
88607
88967
|
// ../engine/src/services/audioVolumeEnvelope.ts
|
|
88608
88968
|
import { readFileSync as readFileSync6, renameSync as renameSync3, writeFileSync as writeFileSync5 } from "fs";
|
|
88609
88969
|
import { randomBytes } from "crypto";
|
|
88970
|
+
function readFmtChunk(buffer, body) {
|
|
88971
|
+
const format = buffer.readUInt16LE(body);
|
|
88972
|
+
const bits = buffer.readUInt16LE(body + 14);
|
|
88973
|
+
const float = format === FLOAT_FORMAT;
|
|
88974
|
+
if (!float && format !== PCM_FORMAT) return null;
|
|
88975
|
+
if (bits !== (float ? 32 : 16)) return null;
|
|
88976
|
+
const numChannels = buffer.readUInt16LE(body + 2);
|
|
88977
|
+
if (numChannels < 1) return null;
|
|
88978
|
+
return { numChannels, sampleRate: buffer.readUInt32LE(body + 4), float };
|
|
88979
|
+
}
|
|
88980
|
+
function isRiffWave(buffer) {
|
|
88981
|
+
return buffer.length >= 12 && buffer.toString("ascii", 0, 4) === "RIFF" && buffer.toString("ascii", 8, 12) === "WAVE";
|
|
88982
|
+
}
|
|
88610
88983
|
function parseWavLayout(buffer) {
|
|
88611
|
-
if (buffer
|
|
88612
|
-
if (buffer.toString("ascii", 8, 12) !== "WAVE") return null;
|
|
88984
|
+
if (!isRiffWave(buffer)) return null;
|
|
88613
88985
|
let fmt = null;
|
|
88614
88986
|
let data2 = null;
|
|
88615
88987
|
for (const { id, body, size } of riffChunks(buffer)) {
|
|
88616
88988
|
if (id === "fmt " && body + 16 <= buffer.length) {
|
|
88617
|
-
|
|
88618
|
-
fmt = {
|
|
88619
|
-
numChannels: buffer.readUInt16LE(body + 2),
|
|
88620
|
-
sampleRate: buffer.readUInt32LE(body + 4),
|
|
88621
|
-
bitsPerSample: buffer.readUInt16LE(body + 14)
|
|
88622
|
-
};
|
|
88989
|
+
fmt = readFmtChunk(buffer, body);
|
|
88623
88990
|
} else if (id === "data") {
|
|
88624
88991
|
data2 = { offset: body, size: Math.min(size, buffer.length - body) };
|
|
88625
88992
|
}
|
|
88626
88993
|
}
|
|
88627
88994
|
if (!fmt || !data2) return null;
|
|
88628
|
-
|
|
88629
|
-
return {
|
|
88630
|
-
numChannels: fmt.numChannels,
|
|
88631
|
-
sampleRate: fmt.sampleRate,
|
|
88632
|
-
dataOffset: data2.offset,
|
|
88633
|
-
dataSize: data2.size
|
|
88634
|
-
};
|
|
88995
|
+
return { ...fmt, dataOffset: data2.offset, dataSize: data2.size };
|
|
88635
88996
|
}
|
|
88636
88997
|
function createEnvelopeWalker(keyframes, trackStart, baseVolume) {
|
|
88637
88998
|
const envelope = normaliseEnvelope(keyframes, trackStart, baseVolume);
|
|
@@ -88651,6 +89012,23 @@ function createEnvelopeWalker(keyframes, trackStart, baseVolume) {
|
|
|
88651
89012
|
return a.volume + (b2.volume - a.volume) * progress;
|
|
88652
89013
|
};
|
|
88653
89014
|
}
|
|
89015
|
+
function scaleSamples(buffer, layout2, gainAt) {
|
|
89016
|
+
const { numChannels, sampleRate, dataOffset, dataSize, float } = layout2;
|
|
89017
|
+
const bytesPerSample = float ? 4 : 2;
|
|
89018
|
+
const frameBytes = numChannels * bytesPerSample;
|
|
89019
|
+
const frameCount = Math.floor(dataSize / frameBytes);
|
|
89020
|
+
const scaleOne = float ? (at4, gain) => buffer.writeFloatLE(buffer.readFloatLE(at4) * gain, at4) : (at4, gain) => {
|
|
89021
|
+
const scaled = Math.round(buffer.readInt16LE(at4) * gain);
|
|
89022
|
+
buffer.writeInt16LE(scaled < -32768 ? -32768 : scaled > 32767 ? 32767 : scaled, at4);
|
|
89023
|
+
};
|
|
89024
|
+
for (let frame = 0; frame < frameCount; frame += 1) {
|
|
89025
|
+
const gain = gainAt(frame / sampleRate);
|
|
89026
|
+
const base2 = dataOffset + frame * frameBytes;
|
|
89027
|
+
for (let channel = 0; channel < numChannels; channel += 1) {
|
|
89028
|
+
scaleOne(base2 + channel * bytesPerSample, gain);
|
|
89029
|
+
}
|
|
89030
|
+
}
|
|
89031
|
+
}
|
|
88654
89032
|
function applyVolumeEnvelopeToWav(wavPath, keyframes, trackStart, baseVolume) {
|
|
88655
89033
|
const gainAt = createEnvelopeWalker(keyframes, trackStart, baseVolume);
|
|
88656
89034
|
if (!gainAt) return false;
|
|
@@ -88658,19 +89036,7 @@ function applyVolumeEnvelopeToWav(wavPath, keyframes, trackStart, baseVolume) {
|
|
|
88658
89036
|
const buffer = readFileSync6(wavPath);
|
|
88659
89037
|
const layout2 = parseWavLayout(buffer);
|
|
88660
89038
|
if (!layout2) return false;
|
|
88661
|
-
|
|
88662
|
-
const bytesPerSample = SUPPORTED_BITS / 8;
|
|
88663
|
-
const frameBytes = numChannels * bytesPerSample;
|
|
88664
|
-
const frameCount = Math.floor(dataSize / frameBytes);
|
|
88665
|
-
for (let frame = 0; frame < frameCount; frame += 1) {
|
|
88666
|
-
const gain = gainAt(frame / sampleRate);
|
|
88667
|
-
const base2 = dataOffset + frame * frameBytes;
|
|
88668
|
-
for (let channel = 0; channel < numChannels; channel += 1) {
|
|
88669
|
-
const at4 = base2 + channel * bytesPerSample;
|
|
88670
|
-
const scaled = Math.round(buffer.readInt16LE(at4) * gain);
|
|
88671
|
-
buffer.writeInt16LE(scaled < -32768 ? -32768 : scaled > 32767 ? 32767 : scaled, at4);
|
|
88672
|
-
}
|
|
88673
|
-
}
|
|
89039
|
+
scaleSamples(buffer, layout2, gainAt);
|
|
88674
89040
|
const tempPath = `${wavPath}.${randomBytes(6).toString("hex")}.tmp`;
|
|
88675
89041
|
writeFileSync5(tempPath, buffer);
|
|
88676
89042
|
renameSync3(tempPath, wavPath);
|
|
@@ -88679,14 +89045,14 @@ function applyVolumeEnvelopeToWav(wavPath, keyframes, trackStart, baseVolume) {
|
|
|
88679
89045
|
return false;
|
|
88680
89046
|
}
|
|
88681
89047
|
}
|
|
88682
|
-
var PCM_FORMAT,
|
|
89048
|
+
var PCM_FORMAT, FLOAT_FORMAT;
|
|
88683
89049
|
var init_audioVolumeEnvelope = __esm({
|
|
88684
89050
|
"../engine/src/services/audioVolumeEnvelope.ts"() {
|
|
88685
89051
|
"use strict";
|
|
88686
89052
|
init_mediaVolumeEnvelope();
|
|
88687
89053
|
init_wavChunks();
|
|
88688
89054
|
PCM_FORMAT = 1;
|
|
88689
|
-
|
|
89055
|
+
FLOAT_FORMAT = 3;
|
|
88690
89056
|
}
|
|
88691
89057
|
});
|
|
88692
89058
|
|
|
@@ -88752,60 +89118,6 @@ var init_audioFxTail = __esm({
|
|
|
88752
89118
|
}
|
|
88753
89119
|
});
|
|
88754
89120
|
|
|
88755
|
-
// ../core/dist/audioGroups.js
|
|
88756
|
-
function parseGroupVolume(el) {
|
|
88757
|
-
const raw = el?.getAttribute("data-volume");
|
|
88758
|
-
const parsed = raw ? parseFloat(raw) : 1;
|
|
88759
|
-
return Number.isFinite(parsed) ? parsed : 1;
|
|
88760
|
-
}
|
|
88761
|
-
function buildGroup(id, memberIds, el) {
|
|
88762
|
-
const fxChain = el?.getAttribute(HF_AUDIO_FX_ATTR);
|
|
88763
|
-
const automation = el?.getAttribute(HF_AUDIO_AUTOMATION_ATTR);
|
|
88764
|
-
return {
|
|
88765
|
-
id,
|
|
88766
|
-
label: el?.getAttribute("data-label") || id,
|
|
88767
|
-
memberIds,
|
|
88768
|
-
...fxChain ? { fxChain } : {},
|
|
88769
|
-
...automation ? { automation } : {},
|
|
88770
|
-
volume: parseGroupVolume(el),
|
|
88771
|
-
hidden: el?.hasAttribute("data-hidden") ?? false
|
|
88772
|
-
};
|
|
88773
|
-
}
|
|
88774
|
-
function resolveAudioGroups(root) {
|
|
88775
|
-
const membersByGroup = /* @__PURE__ */ new Map();
|
|
88776
|
-
for (const member of root.querySelectorAll(MEMBER_SELECTOR)) {
|
|
88777
|
-
const groupId = member.getAttribute(HF_AUDIO_GROUP_ATTR);
|
|
88778
|
-
if (!groupId || !member.id)
|
|
88779
|
-
continue;
|
|
88780
|
-
const members = membersByGroup.get(groupId);
|
|
88781
|
-
if (members)
|
|
88782
|
-
members.push(member.id);
|
|
88783
|
-
else
|
|
88784
|
-
membersByGroup.set(groupId, [member.id]);
|
|
88785
|
-
}
|
|
88786
|
-
const groupElements = /* @__PURE__ */ new Map();
|
|
88787
|
-
for (const el of root.querySelectorAll(HF_AUDIO_GROUP_TAG)) {
|
|
88788
|
-
if (el.id)
|
|
88789
|
-
groupElements.set(el.id, el);
|
|
88790
|
-
}
|
|
88791
|
-
const groups = [];
|
|
88792
|
-
for (const [id, memberIds] of membersByGroup) {
|
|
88793
|
-
groups.push(buildGroup(id, memberIds, groupElements.get(id)));
|
|
88794
|
-
}
|
|
88795
|
-
return groups;
|
|
88796
|
-
}
|
|
88797
|
-
var HF_AUDIO_GROUP_TAG, HF_AUDIO_GROUP_ATTR, MEMBER_SELECTOR;
|
|
88798
|
-
var init_audioGroups = __esm({
|
|
88799
|
-
"../core/dist/audioGroups.js"() {
|
|
88800
|
-
"use strict";
|
|
88801
|
-
init_audioFx();
|
|
88802
|
-
init_audioAutomation();
|
|
88803
|
-
HF_AUDIO_GROUP_TAG = "hf-audio-group";
|
|
88804
|
-
HF_AUDIO_GROUP_ATTR = "data-audio-group";
|
|
88805
|
-
MEMBER_SELECTOR = `audio[${HF_AUDIO_GROUP_ATTR}]`;
|
|
88806
|
-
}
|
|
88807
|
-
});
|
|
88808
|
-
|
|
88809
89121
|
// ../core/dist/generated/audio-fx-runtime-inline.js
|
|
88810
89122
|
function getAudioFxRuntimeScript() {
|
|
88811
89123
|
return AUDIO_FX_RUNTIME_IIFE;
|
|
@@ -88814,7 +89126,7 @@ var AUDIO_FX_RUNTIME_IIFE;
|
|
|
88814
89126
|
var init_audio_fx_runtime_inline = __esm({
|
|
88815
89127
|
"../core/dist/generated/audio-fx-runtime-inline.js"() {
|
|
88816
89128
|
"use strict";
|
|
88817
|
-
AUDIO_FX_RUNTIME_IIFE = '"use strict";(()=>{var pe="data-fx-chain",ct=pe.slice(5),$=1,M=(e="frequency",t="Frequency",n=1e3,o=20,a=2e4)=>({kind:"number",key:e,label:t,unit:"Hz",min:o,max:a,step:1,default:n,scale:"log",automatable:!0}),R=(e=.707,t="Bandwidth \\u2014 higher is narrower.")=>({kind:"number",key:"q",label:"Q",unit:"",min:.1,max:20,step:.01,default:e,scale:"log",automatable:!0,hint:t}),D=(e=-40,t=40,n=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:e,max:t,step:.1,default:n,automatable:!0}),X={kind:"enum",key:"poles",label:"Slope",options:[{value:"1",label:"6 dB/oct"},{value:"2",label:"12 dB/oct"}],default:"2",hint:"Two poles is the usual biquad; one pole is gentler."},W=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[D(-60,12,0)],web:"gain-node"},{id:"peaking",label:"Peaking EQ",group:"filter",description:"Boost or cut a band, leaving everything either side alone.",params:[M("frequency","Frequency",1e3),D(-40,40,0),R(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[M("frequency","Frequency",200,20,2e3),D(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[M("frequency","Frequency",4e3,500,2e4),D(-40,40,0)],web:"biquad-highshelf"},{id:"highpass",label:"High-pass",group:"filter",description:"Remove low frequencies \\u2014 the usual fix for rumble on a voice.",params:[M("frequency","Cutoff",300,20,2e4),R(.707),X],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies \\u2014 darkens or muffles a track.",params:[M("frequency","Cutoff",8e3,100,2e4),R(.707),X],web:"biquad-lowpass"},{id:"compressor",label:"Compressor",group:"dynamics",description:"Pull loud parts down so the quiet ones can come up.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-60,max:0,step:.5,default:-24,hint:"Level above which the compressor starts working."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:4},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:2e3,step:.1,default:20,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:250,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83,hint:"1 is a hard corner; higher eases into it."},{kind:"number",key:"makeup",label:"Makeup",unit:"dB",min:0,max:36,step:.1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1,hint:"Below 1 blends the dry signal back in."}],web:"worklet-compressor"},{id:"limiter",label:"Limiter",group:"dynamics",description:"Hard ceiling \\u2014 nothing gets past the limit.",params:[{kind:"number",key:"limit",label:"Ceiling",unit:"dB",min:-24,max:0,step:.1,default:-1},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.1,max:80,step:.1,default:5},{kind:"number",key:"release",label:"Release",unit:"ms",min:1,max:8e3,step:1,default:50,scale:"log"},{kind:"number",key:"level_out",label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0}],web:"worklet-limiter"},{id:"gate",label:"Noise Gate",group:"dynamics",description:"Silence the track when it drops below the threshold.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-80,max:0,step:.5,default:-35},{kind:"number",key:"range",label:"Range",unit:"dB",min:-80,max:0,step:.5,default:-24,hint:"How far down the gate pulls when closed."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:10},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:9e3,step:.1,default:1,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:100,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83}],web:"worklet-gate"},{id:"saturate",label:"Saturation",group:"nonlinear",description:"Soft-clip the waveform for warmth or outright distortion.",params:[{kind:"enum",key:"type",label:"Curve",options:[{value:"tanh",label:"Tanh"},{value:"atan",label:"Arctan"},{value:"cubic",label:"Cubic"},{value:"exp",label:"Exponential"},{value:"alg",label:"Algebraic"},{value:"quintic",label:"Quintic"},{value:"sin",label:"Sine"},{value:"erf",label:"Error function"},{value:"hard",label:"Hard clip"}],default:"tanh"},{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-40,max:0,step:.1,default:-6},{kind:"number",key:"output",automatable:!0,label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0},{kind:"number",key:"oversample",label:"Oversample",unit:"x",min:1,max:8,step:1,default:4,hint:"Higher costs more but keeps aliasing down."}],web:"waveshaper"},{id:"bitcrush",label:"Bitcrush",group:"nonlinear",description:"Drop bit depth and sample rate for a lo-fi, digital sound.",params:[{kind:"number",key:"bits",label:"Bit depth",unit:"bit",min:1,max:32,step:.1,default:8},{kind:"number",key:"samples",label:"Sample hold",unit:"x",min:1,max:250,step:1,default:1,hint:"Repeats each sample N times \\u2014 a crude downsample."},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-bitcrush"},{id:"pitchshift",label:"Pitch shift",group:"time",description:"Shifts pitch up or down without changing playback speed.",params:[{kind:"number",key:"semitones",label:"Semitones",unit:"st",min:-12,max:12,step:1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-pitchshift"},{id:"delay",label:"Delay",group:"time",description:"Repeating echoes behind the dry signal.",params:[{kind:"number",key:"time",automatable:!0,label:"Time",unit:"ms",min:1,max:5e3,step:1,default:250,scale:"log"},{kind:"number",key:"feedback",automatable:!0,label:"Feedback",unit:"",min:.01,max:.95,step:.01,default:.35},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.4}],web:"delay-feedback"},{id:"chorus",label:"Chorus",group:"time",description:"Detuned copies of the signal for width and thickness.",params:[{kind:"number",key:"delay",automatable:!0,label:"Delay",unit:"ms",min:1,max:100,step:.1,default:7},{kind:"number",key:"depth",automatable:!0,label:"Depth",unit:"ms",min:0,max:10,step:.01,default:2},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.01,max:10,step:.01,default:1},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.5}],web:"chorus-lfo"},{id:"phaser",label:"Phaser",group:"time",description:"Sweeping notches moving through the spectrum.",params:[{kind:"number",key:"in_gain",automatable:!0,label:"Input",unit:"",min:0,max:1,step:.01,default:.4},{kind:"number",key:"out_gain",automatable:!0,label:"Output",unit:"",min:0,max:2,step:.01,default:.74},{kind:"number",key:"delay",label:"Delay",unit:"ms",min:.1,max:5,step:.1,default:3},{kind:"number",key:"decay",label:"Decay",unit:"",min:0,max:.99,step:.01,default:.4},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.1,max:2,step:.01,default:.5},{kind:"enum",key:"type",label:"Waveform",options:[{value:"0",label:"Triangular"},{value:"1",label:"Sinusoidal"}],default:"0"}],web:"allpass-phaser"},{id:"reverb",label:"Reverb",group:"time",description:"Room tail. Both ends convolve the same generated impulse, so preview matches render.",params:[{kind:"number",key:"size",label:"Room size",unit:"",min:.05,max:1,step:.01,default:.7},{kind:"number",key:"damping",label:"Damping",unit:"",min:0,max:1,step:.01,default:.5,hint:"Higher rolls the top off the tail faster."},{kind:"number",key:"wet",automatable:!0,label:"Wet",unit:"",min:0,max:1,step:.01,default:.35},{kind:"number",key:"dry",automatable:!0,label:"Dry",unit:"",min:0,max:1,step:.01,default:.7}],web:"convolver"}],O=new Map(W.map(e=>[e.id,e]));function F(e){return O.get(e)}var dt=W.map(e=>e.id);function k(e,t){let n=O.get(e);if(!n)return{};let o={};for(let a of n.params){let i=t?.[a.key];if(a.kind==="enum"){let s=a.options.some(l=>l.value===i);o[a.key]=s?i:a.default;continue}let r=typeof i=="number"?i:typeof i=="string"&&i.trim()!==""?Number(i):Number.NaN;o[a.key]=Number.isFinite(r)?Math.min(a.max,Math.max(a.min,r)):a.default}return o}var A=class extends Error{constructor(t){super(t),this.name="AudioFxChainError"}};function j(e){let t;try{t=JSON.parse(e)}catch(a){throw new A(`Chain file is not valid JSON: ${a.message}`)}if(typeof t!="object"||t===null)throw new A("Chain file must be a JSON object.");let n=t;if(n.version!==$)throw new A(`Unsupported chain version: ${String(n.version)}`);if(!Array.isArray(n.nodes))throw new A("Chain file is missing a `nodes` array.");let o=n.nodes.map((a,i)=>{if(typeof a!="object"||a===null)throw new A(`Node ${i} is not an object.`);let r=a;if(typeof r.type!="string"||!O.has(r.type))throw new A(`Node ${i} has unknown effect type: ${String(r.type)}`);return{type:r.type,...typeof r.id=="string"&&r.id?{id:r.id}:{},...r.fromCarve===!0?{fromCarve:!0}:{},...typeof r.fromPreset=="string"&&r.fromPreset?{fromPreset:r.fromPreset}:{},...typeof r.label=="string"&&r.label?{label:r.label}:{},...typeof r.fromEq=="string"&&r.fromEq?{fromEq:r.fromEq}:{},...r.fromLeveller===!0?{fromLeveller:!0}:{},...typeof r.presetAmount=="number"&&Number.isFinite(r.presetAmount)?{presetAmount:Math.min(1,Math.max(0,r.presetAmount))}:{},enabled:r.enabled!==!1,params:k(r.type,r.params??void 0)}});return{version:$,nodes:o}}function H(e){return e.nodes.filter(t=>t.enabled!==!1)}var fe=`\nconst dbToLin = (db) => Math.pow(10, db / 20);\n\n/**\n * One-pole envelope followers, one per channel.\n *\n * Per channel matters: the followers advance once per sample, so a single shared\n * follower stepped once per channel per sample. On stereo that ran a 20 ms attack\n * as 10 ms, and gave the right channel a gain computed from an envelope that had\n * already traversed the left \\u2014 so the two channels ducked by different amounts\n * from the same input and the image pumped.\n */\nclass EnvBank {\n constructor(attackMs, releaseMs) { this.set(attackMs, releaseMs); this.values = []; }\n set(attackMs, releaseMs) {\n this.a = Math.exp(-1 / (sampleRate * Math.max(1e-5, attackMs / 1000)));\n this.r = Math.exp(-1 / (sampleRate * Math.max(1e-5, releaseMs / 1000)));\n }\n push(ch, x) {\n const prev = this.values[ch] ?? 0;\n const m = Math.abs(x);\n const c = m > prev ? this.a : this.r;\n const next = m + c * (prev - m);\n this.values[ch] = next;\n return next;\n }\n}\n\n/** Soft-knee gain computer in dB, matching acompressor\'s shape. */\nfunction kneeGain(envDb, thresholdDb, ratio, kneeDb) {\n const over = envDb - thresholdDb;\n if (kneeDb > 0 && over > -kneeDb && over < kneeDb) {\n const t = (over + kneeDb) / (2 * kneeDb);\n return -((1 - 1 / ratio) * kneeDb * t * t);\n }\n return over > 0 ? -(over * (1 - 1 / ratio)) : 0;\n}\n\n// log10/exp per sample is the single most expensive thing a dynamics processor\n// can do on the audio thread, and every sample below the knee needs neither:\n// its gain is exactly unity. Comparing envelopes in the linear domain lets the\n// quiet majority of samples skip the transcendentals entirely.\nconst LN10_OVER_20 = Math.LN10 / 20;\nconst dbToLinFast = (db) => Math.exp(db * LN10_OVER_20);\n\nclass HfCompressor extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 20, this.p.release ?? 250);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 20, this.p.release ?? 250);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const makeup = dbToLin(p.makeup ?? 0);\n const mix = p.mix ?? 1;\n // Knee is expressed as a ratio in FFmpeg; convert to dB width.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const thresholdDb = p.threshold ?? -24;\n const ratio = p.ratio ?? 4;\n // Below this the gain computer returns unity, so the sample needs no\n // logarithm at all.\n const kneeStartLin = dbToLin(thresholdDb - kneeDb);\n const dry = 1 - mix;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n // Per-channel follower, and the sub-knee shortcut: below the knee the\n // gain is exactly unity, so the sample needs no logarithm at all.\n const env = this.env.push(ch, x);\n if (env <= kneeStartLin) {\n out[n] = x * makeup * mix + x * dry;\n continue;\n }\n const envDb = 20 * Math.log10(env);\n const g = dbToLinFast(kneeGain(envDb, thresholdDb, ratio, kneeDb));\n out[n] = x * g * makeup * mix + x * dry;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-compressor", HfCompressor);\n\nclass HfLimiter extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 5, this.p.release ?? 50);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 5, this.p.release ?? 50);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const ceiling = dbToLin(this.p.limit ?? -1);\n const outGain = dbToLin(this.p.level_out ?? 0);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n // Only ever attenuate: a limiter that can raise level is a compressor.\n const g = env > ceiling ? ceiling / env : 1;\n out[n] = x * g * outGain;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-limiter", HfLimiter);\n\nclass HfGate extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 1, this.p.release ?? 100);\n this.gains = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 1, this.p.release ?? 100);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const threshold = dbToLin(p.threshold ?? -35);\n const floor = dbToLin(p.range ?? -24);\n const ratio = p.ratio ?? 10;\n // Knee is declared in the registry as a ratio, like the compressor\'s; a\n // hard threshold ignored it and chattered on material sitting right at the\n // gate point.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const kneeLin = dbToLin((p.threshold ?? -35) + kneeDb);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n let target = 1;\n // Above the threshold the gate is fully open; skip the pow entirely.\n if (env < threshold) {\n const under = env > 1e-9 ? threshold / env : 1e9;\n target = Math.max(floor, 1 / Math.pow(under, ratio - 1));\n if (!isFinite(target)) target = floor;\n }\n // Smooth toward the target so the gate does not click on every sample.\n const held = this.gains[ch] ?? 1;\n const c = target < held ? this.env.r : this.env.a;\n const smoothed = target + c * (held - target);\n this.gains[ch] = smoothed;\n out[n] = x * smoothed;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-gate", HfGate);\n\nclass HfBitcrush extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.holds = [];\n this.held = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const levels = Math.pow(2, (p.bits ?? 8) - 1);\n const step = Math.max(1, Math.round(p.samples ?? 1));\n const mix = p.mix ?? 1;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n if (this.held[ch] === undefined) this.held[ch] = 0;\n if (this.holds[ch] === undefined) this.holds[ch] = 0;\n for (let n = 0; n < inp.length; n++) {\n // Per channel: advancing one shared counter only on the last channel\n // left every earlier channel either unheld or frozen for a whole\n // 128-sample quantum, clicking once a block.\n if (this.holds[ch] === 0) this.held[ch] = Math.round(inp[n] * levels) / levels;\n out[n] = this.held[ch] * mix + inp[n] * (1 - mix);\n this.holds[ch] = (this.holds[ch] + 1) % step;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-bitcrush", HfBitcrush);\n\n/** Linear-interpolated read, \\`delaySamples\\` behind the write head. */\nfunction readTap(ring, write, delaySamples) {\n const len = ring.length;\n const pos = (write - 1 - delaySamples + len) % len;\n const i0 = Math.floor(pos);\n const frac = pos - i0;\n const i1 = (i0 + 1) % len;\n return ring[i0] * (1 - frac) + ring[i1] * frac;\n}\n\n/** Equal-power-ish crossfade, zero at a tap\'s reset point \\u2014 hides the splice. */\nfunction xfade(phase) {\n return Math.sin(Math.PI * phase);\n}\n\n/**\n * Dual-tap granular delay line: two read taps 180\\xB0 apart in a 100 ms grain,\n * each sweeping at a speed relative to the write head that shifts pitch\n * without changing duration. One tap is always fading in as the other fades\n * out, which hides the splice each tap makes when it wraps.\n *\n * write/phase are block-level state, advanced once per SAMPLE across all\n * channels together (not once per channel) \\u2014 advancing them inside the\n * per-channel loop would move the tap 2x/4x too fast on a stereo/quad input.\n */\nclass HfPitchshift extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.grain = Math.round(sampleRate * 0.1);\n this.buf = [];\n this.write = 0;\n this.phase = 0;\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const semitones = Math.max(-12, Math.min(12, p.semitones ?? 0));\n const mix = Math.max(0, Math.min(1, p.mix ?? 1));\n const ratio = Math.pow(2, semitones / 12);\n const grain = this.grain;\n const ringLen = grain * 2;\n const inc = (1 - ratio) / grain;\n const n = i[0] ? i[0].length : 0;\n for (let ch = 0; ch < i.length; ch++) {\n if (!this.buf[ch]) this.buf[ch] = new Float32Array(ringLen);\n }\n let write = this.write, phase = this.phase;\n for (let s = 0; s < n; s++) {\n phase += inc;\n phase -= Math.floor(phase);\n const phaseB = (phase + 0.5) % 1;\n const gA = xfade(phase), gB = xfade(phaseB);\n for (let ch = 0; ch < i.length; ch++) {\n const ring = this.buf[ch];\n const inp = i[ch], out = o[ch];\n const x = inp[s];\n ring[write] = x;\n const wet =\n readTap(ring, write, phase * grain) * gA + readTap(ring, write, phaseB * grain) * gB;\n out[s] = x * (1 - mix) + wet * mix;\n }\n write = (write + 1) % ringLen;\n }\n this.write = write;\n this.phase = phase;\n return true;\n }\n}\nregisterProcessor("hf-pitchshift", HfPitchshift);\n`,B=new WeakMap;var he=new WeakSet;function S(e){let t=B.get(e);return t||(t=(async()=>{if(!e.audioWorklet)throw new Error("AudioWorklet is unavailable \\u2014 the page needs a secure context (https, localhost or file://)");let n=`data:text/javascript;base64,${btoa(String.fromCharCode(...new TextEncoder().encode(fe)))}`;await e.audioWorklet.addModule(n),he.add(e)})().catch(n=>{throw B.delete(e),n}),B.set(e,t)),t}function be(e,t,n){let o=.6+Math.max(0,Math.min(1,t))*2.6,a=Math.max(1,Math.floor(e*o)),i=new Float32Array(a),r=Math.round(t*1e3)*2654435761+Math.round(n*1e3)*40503>>>0,s=()=>(r=r*1664525+1013904223>>>0,r/4294967295*2-1),l=Math.max(.001,1-Math.max(0,Math.min(1,n))),u=0,c=0;for(let d=0;d<a;d++){u+=l*(s()-u);let b=u*Math.pow(1-d/a,2.5);i[d]=b,c+=b*b}let m=Math.sqrt(c);if(m>0)for(let d=0;d<a;d++)i[d]=(i[d]??0)/m;return i}var h=e=>typeof e=="number"?e:Number(e??0),G=e=>e/1e3;function K(e,t,n,o){let a=Math.max(1,Math.round(e.sampleRate)),i=e.createBuffer(1,a,e.sampleRate),r=i.getChannelData(0);for(let u=0;u<a;u++){let c=u/a;r[u]=t==="sine"?Math.sin(2*Math.PI*c):4*Math.abs((c+.75)%1-.5)-1}let s=e.createBufferSource();s.buffer=i,s.loop=!0,s.playbackRate.value=n;let l=(o*n%1+1)%1*(a/e.sampleRate);return s.start(typeof e.currentTime=="number"?e.currentTime:0,l),s}function Q(e){try{e.stop()}catch{}e.disconnect()}function I(e,t){return[{param:e},{param:t,map:n=>1-n}]}function Z(e,t,n){e.gain.value=n,t.gain.value=1-n}function E(e,t,n){return{input:e,output:e,update:t,automation:n,dispose:()=>e.disconnect()}}var ge=new Set(["peaking","highpass","lowpass"]),z=e=>Math.pow(10,e/20),xe=(e,t)=>{let n=e.createGain(),o=a=>{n.gain.value=z(h(a.gain))};return o(t),E(n,o,{gain:[{param:n.gain,map:z}]})};function P(e,t){return(n,o)=>{let a=n.createBiquadFilter();a.type=e;let i=r=>{a.frequency.value=h(r.frequency),r.q!==void 0&&(a.Q.value=h(r.q)),t&&(a.gain.value=h(r.gain))};return i(o),E(a,i,{frequency:[{param:a.frequency}],...ge.has(e)?{q:[{param:a.Q}]}:{},...t?{gain:[{param:a.gain}]}:{}})}}function Ae(e){return(t,n)=>{let o=Math.tan(Math.PI*h(n.frequency)/t.sampleRate),a=e==="highpass"?t.createIIRFilter([1/(1+o),-1/(1+o)],[1,(o-1)/(o+1)]):t.createIIRFilter([o/(1+o),o/(1+o)],[1,(o-1)/(o+1)]);return E(a,()=>{})}}function T(e){return(t,n)=>{let o=new AudioWorkletNode(t,e,{processorOptions:{...n}});return{input:o,output:o,update:a=>o.port.postMessage({...a}),dispose:()=>{o.port.postMessage({__hfDispose:!0}),o.disconnect()}}}}var ye={tanh:Math.tanh,atan:e=>2/Math.PI*Math.atan(Math.PI/2*e),cubic:e=>Math.abs(e)>=1?Math.sign(e):e-e**3/3,exp:e=>Math.sign(e)*(1-Math.exp(-Math.abs(e))),alg:e=>e/Math.sqrt(1+e*e),quintic:e=>Math.abs(e)>=1?Math.sign(e):e-e**5/5,sin:e=>Math.abs(e)>=1?Math.sign(e):Math.sin(Math.PI/2*e),erf:e=>Math.tanh(1.20211*e),hard:e=>Math.max(-1,Math.min(1,e))},ke=(e,t)=>{let n=e.createWaveShaper(),o=e.createGain(),a=e.createGain();o.connect(n).connect(a);let i=r=>{let s=ye[String(r.type)]??Math.tanh,l=Math.pow(10,h(r.threshold)/20),u=8192,c=new Float32Array(u);for(let m=0;m<u;m++){let d=m/(u-1)*2-1;c[m]=s(d/Math.max(1e-6,l))*l}n.curve=c,n.oversample=h(r.oversample)>=4?"4x":h(r.oversample)>=2?"2x":"none",a.gain.value=Math.pow(10,h(r.output)/20)};return i(t),{input:o,output:a,update:i,automation:{output:[{param:a.gain,map:r=>Math.pow(10,r/20)}]},dispose:()=>{o.disconnect(),n.disconnect(),a.disconnect()}}},ve=(e,t)=>{let n=e.createGain(),o=e.createGain(),a=e.createDelay(5),i=e.createGain(),r=e.createGain(),s=e.createGain();n.connect(a),a.connect(i),i.connect(a),a.connect(r).connect(o),n.connect(s).connect(o);let l=u=>{a.delayTime.value=Math.min(5,h(u.time)/1e3),i.gain.value=h(u.feedback),Z(r,s,h(u.mix))};return l(t),{input:n,output:o,update:l,automation:{time:[{param:a.delayTime,map:u=>Math.min(5,G(u))}],feedback:[{param:i.gain}],mix:I(r.gain,s.gain)},dispose:()=>[n,o,a,i,r,s].forEach(u=>u.disconnect())}},we=(e,t,n)=>{let o=e.createGain(),a=e.createGain(),i=e.createDelay(.5),r=K(e,"sine",h(t.speed),n),s=e.createGain(),l=e.createGain(),u=e.createGain();r.connect(s).connect(i.delayTime),o.connect(i).connect(l).connect(a),o.connect(u).connect(a);let c=m=>{i.delayTime.value=h(m.delay)/1e3,s.gain.value=h(m.depth)/1e3,r.playbackRate.value=h(m.speed),Z(l,u,h(m.mix))};return c(t),{input:o,output:a,update:c,automation:{delay:[{param:i.delayTime,map:G}],depth:[{param:s.gain,map:G}],speed:[{param:r.playbackRate}],mix:I(l.gain,u.gain)},dispose:()=>{Q(r),[o,a,i,s,l,u].forEach(m=>m.disconnect())}}},Me=6,Fe=(e,t,n)=>{let o=e.createGain(),a=e.createGain(),i=e.createGain(),r=e.createGain(),s=K(e,String(t.type)==="1"?"sine":"triangle",h(t.speed),n),l=e.createGain(),u=e.createGain(),c=e.createGain(),m=[];o.connect(i);let d=i;for(let p=0;p<Me;p++){let f=e.createBiquadFilter();f.type="allpass",f.Q.value=.7071,l.connect(f.frequency),d.connect(f),d=f,m.push(f)}s.connect(l),d.connect(u).connect(r),i.connect(c).connect(r),r.connect(a);let b=p=>{let f=1e3/Math.max(.1,h(p.delay));for(let g of m)g.frequency.value=f;l.gain.value=f*h(p.decay),s.playbackRate.value=h(p.speed),i.gain.value=h(p.in_gain),r.gain.value=h(p.out_gain),u.gain.value=1,c.gain.value=1};return b(t),{input:o,output:a,update:b,automation:{speed:[{param:s.playbackRate}],in_gain:[{param:i.gain}],out_gain:[{param:r.gain}]},dispose:()=>{Q(s),[o,a,i,r,l,u,c,...m].forEach(p=>p.disconnect())}}},He=(e,t)=>{let n=e.createGain(),o=e.createGain(),a=e.createConvolver(),i=e.createGain(),r=e.createGain();a.normalize=!1,n.connect(a).connect(i).connect(o),n.connect(r).connect(o);let s="",l=u=>{let c=`${h(u.size)}:${h(u.damping)}`;if(c!==s){let m=be(e.sampleRate,h(u.size),h(u.damping)),d=e.createBuffer(1,m.length,e.sampleRate);d.getChannelData(0).set(m),a.buffer=d,s=c}i.gain.value=h(u.wet),r.gain.value=h(u.dry)};return l(t),{input:n,output:o,update:l,automation:{wet:[{param:i.gain}],dry:[{param:r.gain}]},dispose:()=>[n,o,a,i,r].forEach(u=>u.disconnect())}},Pe={"gain-node":xe,"biquad-peaking":P("peaking",!0),"biquad-lowshelf":P("lowshelf",!0),"biquad-highshelf":P("highshelf",!0),"biquad-highpass":P("highpass",!1),"biquad-lowpass":P("lowpass",!1),"worklet-compressor":T("hf-compressor"),"worklet-limiter":T("hf-limiter"),"worklet-gate":T("hf-gate"),"worklet-bitcrush":T("hf-bitcrush"),"worklet-pitchshift":T("hf-pitchshift"),waveshaper:ke,"delay-feedback":ve,"chorus-lfo":we,"allpass-phaser":Fe,convolver:He};function ee(e){return e.nodes.some(t=>F(t.type)?.web.startsWith("worklet-")??!1)}function Te(e,t,n,o=0){let a=F(t);if(!a)throw new Error(`Unknown effect type: ${t}`);let i=k(t,n);if((t==="highpass"||t==="lowpass")&&String(i.poles)==="1")return Ae(t)(e,i,o);let r=Pe[a.web];if(!r)throw new Error(`No Web Audio builder for ${a.web}`);return r(e,i,o)}function Y(e){let t=[];for(let n of e){let o=n.fromPreset,a=t.at(-1);if(a&&a.preset===o)a.nodes.push(n);else{let i=typeof n.presetAmount=="number"?n.presetAmount:1;t.push({...o?{preset:o}:{},amount:Math.min(1,Math.max(0,i)),nodes:[n]})}}return t}function J(e){return H(e).map(t=>{let n=k(t.type,t.params),o=n.poles!==void 0?`:${n.poles}`:"",a=String(n.poles)==="1"?`@${n.frequency}`:"",i=t.type==="phaser"?`~${n.type}`:"",r=t.fromPreset?`%${t.fromPreset}`:"";return`${t.type}${o}${a}${i}${r}`}).join("|")}function te(e,t,n=0){var m;let o=e.createGain(),a=e.createGain(),i=[],r=[],s=Y(H(t)),l=o;for(let d of s){let b=null;if(d.preset){let p=e.createGain(),f=e.createGain(),g=e.createGain(),w=e.createGain();g.gain.value=d.amount,f.gain.value=1-d.amount,l.connect(p),p.connect(f).connect(w),b={entry:p,wet:g,dry:f,join:w},l=p}for(let p of d.nodes){let f=Te(e,p.type,p.params??{},n);l.connect(f.input),l=f.output,i.push({...p.id?{id:p.id}:{},type:p.type,handle:f})}b&&d.preset&&(l.connect(b.wet).connect(b.join),r.push({id:d.preset,...b}),l=b.join)}l.connect(a);let u=J(t),c={};for(let d of r)(c[m=d.id]??(c[m]=[])).push(...I(d.wet.gain,d.dry.gain));return{input:o,output:a,presets:c,nodes:i,update(d){if(J(d)!==u)return!1;H(d).forEach((p,f)=>{let g=i[f];g&&(g.handle.update(k(p.type,p.params)),p.id===void 0?delete g.id:g.id=p.id)});let b=0;for(let p of Y(H(d))){if(!p.preset)continue;let f=r[b++];!f||f.id!==p.preset||(f.wet.gain.value=p.amount,f.dry.gain.value=1-p.amount)}return!0},dispose(){for(let{handle:d}of i)d.dispose();for(let{entry:d,wet:b,dry:p,join:f}of r)d.disconnect(),b.disconnect(),p.disconnect(),f.disconnect();o.disconnect(),a.disconnect()}}}var ne=3.981071705534972;var Ne="data-automation",kt=Ne.slice(5),C=1,_e=512,x=class extends Error{constructor(t){super(t),this.name="AudioAutomationError"}},L="volume";function _(e){if(e===L)return{kind:"volume"};let t=e.split(".");if(t.length===3&&t[0]==="fx"&&t[1]===De){let a=t[2];return a?{kind:"preset",presetId:a}:null}if(t.length!==3||t[0]!=="fx")return null;let[,n,o]=t;return!n||!o?null:{kind:"fx",nodeId:n,param:o}}function ae(e,t){return`fx.${e}.${t}`}var De="preset";var Ce={min:0,max:1,step:.01,unit:"",label:"Amount",scale:"linear",default:1},oe={min:0,max:ne,step:.01,unit:"",label:"Volume",scale:"linear",default:1};function q(e,t){let n=_(e);if(!n)return null;if(n.kind==="volume")return oe;if(n.kind==="preset")return t?.nodes.some(s=>s.fromPreset===n.presetId)?{...Ce,label:`${n.presetId} \\xB7 Amount`}:null;let o=t?.nodes.find(r=>r.id===n.nodeId);if(!o)return null;let a=F(o.type),i=a?.params.find(r=>r.key===n.param);return!i||i.kind!=="number"?null:{min:i.min,max:i.max,step:i.step,unit:i.unit,label:`${a?.label??o.type} \\xB7 ${i.label}`,scale:i.scale==="log"&&i.min>0?"log":"linear",default:i.default}}function N(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null}function Re(e){let t=N(e);return t===null||t===0?0:Math.min(1,Math.max(-1,t))}function re(e,t){let n=N(e),o=N(t);if(n===null||o===null)return null;let a=s=>Math.min(.999,Math.max(.001,s)),i=a(n),r=a(o);return Math.abs(i-r)<1e-6?null:{x:i,y:r}}function Oe(e){let t=Re(e?.curve),n=re(e?.viaX,e?.viaY);return{...t?{curve:t}:{},...n?{viaX:n.x,viaY:n.y}:{}}}function Be(e,t){let n=N(e?.t),o=N(e?.v);if(n===null||o===null)return null;let a=t?Math.min(t.max,Math.max(t.min,o)):o;return{t:Math.max(0,n),v:a,...Oe(e)}}function ie(e,t){let n=e.map(a=>Be(a,t)).filter(a=>a!==null).sort((a,i)=>a.t-i.t),o=[];for(let a of n)o.length>0&&o[o.length-1].t===a.t?o[o.length-1]=a:o.push(a);return o.slice(0,_e)}function Se(e){let t=[];for(let n of e.lanes){if(!_(n.target))continue;let o=n.target===L?oe:null,a=ie(n.points??[],o);a.length>0&&t.push({target:n.target,points:a})}return{version:C,lanes:t}}function se(e,t){let n=[];for(let o of e.lanes){let a=q(o.target,t);if(!a)continue;let i=ie(o.points,a);i.length>0&&n.push({target:o.target,points:i})}return{version:C,lanes:n}}function ue(e){let t;try{t=JSON.parse(e)}catch(a){throw new x(`Automation is not valid JSON: ${a.message}`)}if(typeof t!="object"||t===null)throw new x("Automation must be a JSON object.");let n=t;if(n.version!==C)throw new x(`Unsupported automation version: ${String(n.version)}`);if(!Array.isArray(n.lanes))throw new x("Automation is missing a `lanes` array.");let o=n.lanes.map((a,i)=>{if(typeof a!="object"||a===null)throw new x(`Lane ${i} is not an object.`);let r=a;if(typeof r.target!="string"||!_(r.target))throw new x(`Lane ${i} has an unreadable target: ${String(r.target)}`);if(!Array.isArray(r.points))throw new x(`Lane ${i} is missing a \\`points\\` array.`);return{target:r.target,points:r.points}});return Se({version:C,lanes:o})}function Ge(e,t){return t?Math.pow(e,Math.pow(2,2*t)):e}function Ie(e,t){let n=e-.5,o=t-.5,a=.999,i=1e6,r=n>0?n/(a-e):n<0?-n/(e-(1-a)):0,s=o>0?o/(a-t):o<0?-o/(t-(1-a)):0,l=Math.min(i,Math.max(1,r,s));return{cx:e+n/l,cy:t+o/l,w:l}}function Ee(e,t,n){let{cx:o,cy:a,w:i}=Ie(t,n),r=2-2*i,s=e*r-1+2*i*o,l=-e*r-2*i*o,u=Le(s,l,e),c=1-u,m=c*c+2*i*u*c+u*u;return m>0?(2*i*a*u*c+u*u)/m:e}function Le(e,t,n){if(Math.abs(e)<1e-12)return Math.abs(t)<1e-12?n:-n/t;let o=Math.sqrt(Math.max(0,t*t-4*e*n)),a=(-t+o)/(2*e),i=(-t-o)/(2*e),r=s=>s>=-1e-9&&s<=1+1e-9;return r(a)?Math.min(1,Math.max(0,a)):r(i)?Math.min(1,Math.max(0,i)):n}function qe(e,t){let n=re(t.viaX,t.viaY);return n?Ee(Math.min(1,Math.max(0,e)),n.x,n.y):Ge(e,t.curve)}function Ve(e,t,n,o){return o==="log"&&e>0&&t>0?Math.exp(Math.log(e)+(Math.log(t)-Math.log(e))*n):e+(t-e)*n}function V(e,t,n="linear"){let o=e.points;if(o.length===0)return 0;let a=o[0];if(t<=a.t)return a.v;let i=o[o.length-1];if(t>=i.t)return i.v;let r=0,s=o.length-1;for(;s-r>1;){let m=r+s>>1;o[m].t<=t?r=m:s=m}let l=o[r],u=o[s],c=u.t-l.t;return c<=0?u.v:Ve(l.v,u.v,qe((t-l.t)/c,l),n)}function le(e){return e.points.length<=1||e.points.every(t=>t.v===e.points[0].v)}function ce(e,t,n,o,a="linear"){let i=Math.max(2,Math.floor(o)),r=new Float32Array(i),s=n-t;for(let l=0;l<i;l+=1)r[l]=V(e,t+s*l/(i-1),a);return r}var Ue=100,$e=8,Xe=4096,U=e=>e;function We(e,t,n){return!(!!e.curve||e.viaX!==void 0&&e.viaY!==void 0)&&t==="linear"&&!n}function je(e){let t=Math.ceil(e*Ue);return Math.min(Xe,Math.max($e,t))}function ze(e,t,n,o,a){let{scheduledAt:i,elapsed:r,rate:s}=o,l=a??U,u=v=>i+(v-r)/s,c=e.points[t],m=e.points[t+1],d=u(m.t);if(d<=i)return null;let b=Math.max(i,u(c.t)),p=d-b;if(p<=0)return null;if(We(c,n,a))return{kind:"ramp",time:d,value:l(m.v)};let f=je(p),g=ce(e,Math.max(c.t,r),m.t,f,n),w=new Float32Array(f);for(let v=0;v<f;v+=1)w[v]=l(g[v]??0);return{kind:"curve",time:b,duration:p,values:w}}function Ye(e,t,n,o){let a=[];for(let r=0;r+1<e.points.length;r+=1){let s=ze(e,r,t,n,o);s&&a.push(s)}let i=a[0];return i?.kind==="curve"&&i.time<=n.scheduledAt||a.unshift({kind:"set",time:n.scheduledAt,value:(o??U)(V(e,n.elapsed,t))}),a}function Je(e,t){for(let n of t)if(n.kind==="set")e.setValueAtTime(n.value,n.time);else if(n.kind==="ramp")e.linearRampToValueAtTime(n.value,n.time);else try{e.setValueCurveAtTime(n.values,n.time,n.duration)}catch{let o=n.values[n.values.length-1]??0;e.linearRampToValueAtTime(o,n.time+n.duration)}}function Ke(e){for(let t of e)t.param.cancelScheduledValues(0)}function Qe(e,t,n,o){if(t.points.length!==0)for(let a of e){if(Ke([a]),le(t)){let i=(a.map??U)(t.points[0].v);a.param.setValueAtTime(i,o.scheduledAt);continue}Je(a.param,Ye(t,n,o,a.map))}}function de(e,t,n,o,a){let i=new Map(n.filter(s=>s.id).map(s=>[s.id,s.handle])),r=[];for(let s of e.lanes){let l=_(s.target);if(!l)continue;let u=l.kind==="preset"?a?.[l.presetId]:l.kind==="fx"?i.get(l.nodeId)?.automation?.[l.param]:void 0;if(!u||u.length===0)continue;let c=q(s.target,t);c&&(Qe(u,s,c.scale,o),r.push(...u))}return r}var Ze=5,et=.001;function y(e,t,n){let o=Number(k(e.type,e.params)[t]??0);if(!e.id||!n)return Number.isFinite(o)?o:0;let a=n.lanes.find(i=>i.target===ae(e.id??"",t));return!a||a.points.length===0?Number.isFinite(o)?o:0:a.points.reduce((i,r)=>Math.max(i,r.v),-1/0)}function tt(e,t){let n=Math.min(5,e/1e3);if(n<=0)return 0;let o=Math.max(0,Math.min(.999,t));return o<=0?n:Math.ceil(Math.log(et)/Math.log(o))*n}function nt(e,t){return y(e,"wet",t)>0?.6+Math.max(0,Math.min(1,y(e,"size",t)))*2.6:0}function at(e,t){return y(e,"mix",t)>0?tt(y(e,"time",t),y(e,"feedback",t)):0}function ot(e,t){return y(e,"mix",t)>0?y(e,"delay",t)/1e3:0}function rt(e,t){return y(e,"mix",t)>0?.2:0}function it(e,t){if(e.enabled===!1)return 0;switch(e.type){case"reverb":return nt(e,t);case"delay":return at(e,t);case"chorus":return ot(e,t);case"pitchshift":return rt(e,t);default:return 0}}function me(e,t){let n=e.nodes.reduce((o,a)=>o+it(a,t),0);return Math.min(Ze,n)}function st(e,t,n,o,a){let i=e.createBuffer(n,o,a);for(let r=0;r<n;r++){let s=t[r];s&&i.getChannelData(r).set(s)}return i}function ut(e){let t=[];for(let n=0;n<e.numberOfChannels;n++)t.push(new Float32Array(e.getChannelData(n)));return t}async function lt(e,t,n,o){let a=j(n),i=Math.max(1,e.length),r=e[0]?.length??0;if(r===0)return e;let s=o?se(ue(o),a):null,l=Math.ceil(me(a,s??void 0)*t),u=new OfflineAudioContext(i,r+l,t);ee(a)&&await S(u);let c=u.createBufferSource();c.buffer=st(u,e,i,r,t);let m=te(u,a);return s&&de(s,a,m.nodes,{scheduledAt:0,elapsed:0,rate:1},m.presets),c.connect(m.input),m.output.connect(u.destination),c.start(),ut(await u.startRendering())}window.__HF_AUDIO_FX={render:lt};})();\n';
|
|
89129
|
+
AUDIO_FX_RUNTIME_IIFE = '"use strict";(()=>{var fe="data-fx-chain",ft=fe.slice(5),X=1,M=(e="frequency",t="Frequency",n=1e3,o=20,a=2e4)=>({kind:"number",key:e,label:t,unit:"Hz",min:o,max:a,step:1,default:n,scale:"log",automatable:!0}),O=(e=.707,t="Bandwidth \\u2014 higher is narrower.")=>({kind:"number",key:"q",label:"Q",unit:"",min:.1,max:20,step:.01,default:e,scale:"log",automatable:!0,hint:t}),R=(e=-40,t=40,n=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:e,max:t,step:.1,default:n,automatable:!0}),W={kind:"enum",key:"poles",label:"Slope",options:[{value:"1",label:"6 dB/oct"},{value:"2",label:"12 dB/oct"}],default:"2",hint:"Two poles is the usual biquad; one pole is gentler."},z=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[R(-60,12,0)],web:"gain-node"},{id:"peaking",label:"Peaking EQ",group:"filter",description:"Boost or cut a band, leaving everything either side alone.",params:[M("frequency","Frequency",1e3),R(-40,40,0),O(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[M("frequency","Frequency",200,20,2e3),R(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[M("frequency","Frequency",4e3,500,2e4),R(-40,40,0)],web:"biquad-highshelf"},{id:"highpass",label:"High-pass",group:"filter",description:"Remove low frequencies \\u2014 the usual fix for rumble on a voice.",params:[M("frequency","Cutoff",300,20,2e4),O(.707),W],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies \\u2014 darkens or muffles a track.",params:[M("frequency","Cutoff",8e3,100,2e4),O(.707),W],web:"biquad-lowpass"},{id:"compressor",label:"Compressor",group:"dynamics",description:"Pull loud parts down so the quiet ones can come up.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-60,max:0,step:.5,default:-24,hint:"Level above which the compressor starts working."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:4},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:2e3,step:.1,default:20,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:250,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83,hint:"1 is a hard corner; higher eases into it."},{kind:"number",key:"makeup",label:"Makeup",unit:"dB",min:0,max:36,step:.1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1,hint:"Below 1 blends the dry signal back in."}],web:"worklet-compressor"},{id:"limiter",label:"Limiter",group:"dynamics",description:"Hard ceiling \\u2014 nothing gets past the limit.",params:[{kind:"number",key:"limit",label:"Ceiling",unit:"dB",min:-24,max:0,step:.1,default:-1},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.1,max:80,step:.1,default:5},{kind:"number",key:"release",label:"Release",unit:"ms",min:1,max:8e3,step:1,default:50,scale:"log"},{kind:"number",key:"level_out",label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0}],web:"worklet-limiter"},{id:"gate",label:"Noise Gate",group:"dynamics",description:"Silence the track when it drops below the threshold.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-80,max:0,step:.5,default:-35},{kind:"number",key:"range",label:"Range",unit:"dB",min:-80,max:0,step:.5,default:-24,hint:"How far down the gate pulls when closed."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:10},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:9e3,step:.1,default:1,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:100,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83}],web:"worklet-gate"},{id:"saturate",label:"Saturation",group:"nonlinear",description:"Soft-clip the waveform for warmth or outright distortion.",params:[{kind:"enum",key:"type",label:"Curve",options:[{value:"tanh",label:"Tanh"},{value:"atan",label:"Arctan"},{value:"cubic",label:"Cubic"},{value:"exp",label:"Exponential"},{value:"alg",label:"Algebraic"},{value:"quintic",label:"Quintic"},{value:"sin",label:"Sine"},{value:"erf",label:"Error function"},{value:"hard",label:"Hard clip"}],default:"tanh"},{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-40,max:0,step:.1,default:-6},{kind:"number",key:"output",automatable:!0,label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0},{kind:"number",key:"oversample",label:"Oversample",unit:"x",min:1,max:8,step:1,default:4,hint:"Higher costs more but keeps aliasing down."}],web:"waveshaper"},{id:"bitcrush",label:"Bitcrush",group:"nonlinear",description:"Drop bit depth and sample rate for a lo-fi, digital sound.",params:[{kind:"number",key:"bits",label:"Bit depth",unit:"bit",min:1,max:32,step:.1,default:8},{kind:"number",key:"samples",label:"Sample hold",unit:"x",min:1,max:250,step:1,default:1,hint:"Repeats each sample N times \\u2014 a crude downsample."},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-bitcrush"},{id:"pitchshift",label:"Pitch shift",group:"time",description:"Shifts pitch up or down without changing playback speed. Adds ~50 ms of latency.",params:[{kind:"number",key:"semitones",label:"Semitones",unit:"st",min:-12,max:12,step:1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-pitchshift"},{id:"delay",label:"Delay",group:"time",description:"Repeating echoes behind the dry signal.",params:[{kind:"number",key:"time",automatable:!0,label:"Time",unit:"ms",min:1,max:5e3,step:1,default:250,scale:"log"},{kind:"number",key:"feedback",automatable:!0,label:"Feedback",unit:"",min:.01,max:.95,step:.01,default:.35},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.4}],web:"delay-feedback"},{id:"chorus",label:"Chorus",group:"time",description:"Detuned copies of the signal for width and thickness.",params:[{kind:"number",key:"delay",automatable:!0,label:"Delay",unit:"ms",min:1,max:100,step:.1,default:7},{kind:"number",key:"depth",automatable:!0,label:"Depth",unit:"ms",min:0,max:10,step:.01,default:2},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.01,max:10,step:.01,default:1},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.5}],web:"chorus-lfo"},{id:"phaser",label:"Phaser",group:"time",description:"Sweeping notches moving through the spectrum.",params:[{kind:"number",key:"in_gain",automatable:!0,label:"Input",unit:"",min:0,max:1,step:.01,default:.4},{kind:"number",key:"out_gain",automatable:!0,label:"Output",unit:"",min:0,max:2,step:.01,default:.74},{kind:"number",key:"delay",label:"Delay",unit:"ms",min:.1,max:5,step:.1,default:3},{kind:"number",key:"decay",label:"Decay",unit:"",min:0,max:.99,step:.01,default:.4},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.1,max:2,step:.01,default:.5},{kind:"enum",key:"type",label:"Waveform",options:[{value:"0",label:"Triangular"},{value:"1",label:"Sinusoidal"}],default:"0"}],web:"allpass-phaser"},{id:"reverb",label:"Reverb",group:"time",description:"Room tail. Both ends convolve the same generated impulse, so preview matches render.",params:[{kind:"number",key:"size",label:"Room size",unit:"",min:.05,max:1,step:.01,default:.7},{kind:"number",key:"damping",label:"Damping",unit:"",min:0,max:1,step:.01,default:.5,hint:"Higher rolls the top off the tail faster."},{kind:"number",key:"wet",automatable:!0,label:"Wet",unit:"",min:0,max:1,step:.01,default:.35},{kind:"number",key:"dry",automatable:!0,label:"Dry",unit:"",min:0,max:1,step:.01,default:.7}],web:"convolver"}],B=new Map(z.map(e=>[e.id,e]));function F(e){return B.get(e)}var bt=z.map(e=>e.id);function w(e,t){let n=B.get(e);if(!n)return{};let o={};for(let a of n.params){let i=t?.[a.key];if(a.kind==="enum"){let s=a.options.some(l=>l.value===i);o[a.key]=s?i:a.default;continue}let r=typeof i=="number"?i:typeof i=="string"&&i.trim()!==""?Number(i):Number.NaN;o[a.key]=Number.isFinite(r)?Math.min(a.max,Math.max(a.min,r)):a.default}return o}var A=class extends Error{constructor(t){super(t),this.name="AudioFxChainError"}};function Y(e){let t;try{t=JSON.parse(e)}catch(a){throw new A(`Chain file is not valid JSON: ${a.message}`)}if(typeof t!="object"||t===null)throw new A("Chain file must be a JSON object.");let n=t;if(n.version!==X)throw new A(`Unsupported chain version: ${String(n.version)}`);if(!Array.isArray(n.nodes))throw new A("Chain file is missing a `nodes` array.");let o=n.nodes.map(be);return{version:X,nodes:o}}function H(e){return e.nodes.filter(t=>t.enabled!==!1)}function be(e,t){if(typeof e!="object"||e===null)throw new A(`Node ${t} is not an object.`);let n=e;if(typeof n.type!="string"||!B.has(n.type))throw new A(`Node ${t} has unknown effect type: ${String(n.type)}`);return xe({type:n.type,id:C(n.id),fromCarve:j(n.fromCarve),fromPreset:C(n.fromPreset),label:C(n.label),fromEq:C(n.fromEq),fromLeveller:j(n.fromLeveller),presetAmount:ge(n.presetAmount),enabled:n.enabled!==!1,params:w(n.type,n.params??void 0)})}function C(e){return typeof e=="string"&&e?e:void 0}function j(e){return e===!0?!0:void 0}function ge(e){if(!(typeof e!="number"||!Number.isFinite(e)))return Math.min(1,Math.max(0,e))}function xe(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}var Ae=`\nconst dbToLin = (db) => Math.pow(10, db / 20);\n\n/**\n * One-pole envelope followers, one per channel.\n *\n * Per channel matters: the followers advance once per sample, so a single shared\n * follower stepped once per channel per sample. On stereo that ran a 20 ms attack\n * as 10 ms, and gave the right channel a gain computed from an envelope that had\n * already traversed the left \\u2014 so the two channels ducked by different amounts\n * from the same input and the image pumped.\n */\nclass EnvBank {\n constructor(attackMs, releaseMs) { this.set(attackMs, releaseMs); this.values = []; }\n set(attackMs, releaseMs) {\n this.a = Math.exp(-1 / (sampleRate * Math.max(1e-5, attackMs / 1000)));\n this.r = Math.exp(-1 / (sampleRate * Math.max(1e-5, releaseMs / 1000)));\n }\n push(ch, x) {\n const prev = this.values[ch] ?? 0;\n const m = Math.abs(x);\n const c = m > prev ? this.a : this.r;\n const next = m + c * (prev - m);\n this.values[ch] = next;\n return next;\n }\n}\n\n/** Soft-knee gain computer in dB, matching acompressor\'s shape. */\nfunction kneeGain(envDb, thresholdDb, ratio, kneeDb) {\n const over = envDb - thresholdDb;\n if (kneeDb > 0 && over > -kneeDb && over < kneeDb) {\n const t = (over + kneeDb) / (2 * kneeDb);\n return -((1 - 1 / ratio) * kneeDb * t * t);\n }\n return over > 0 ? -(over * (1 - 1 / ratio)) : 0;\n}\n\n// log10/exp per sample is the single most expensive thing a dynamics processor\n// can do on the audio thread, and every sample below the knee needs neither:\n// its gain is exactly unity. Comparing envelopes in the linear domain lets the\n// quiet majority of samples skip the transcendentals entirely.\nconst LN10_OVER_20 = Math.LN10 / 20;\nconst dbToLinFast = (db) => Math.exp(db * LN10_OVER_20);\n\nclass HfCompressor extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 20, this.p.release ?? 250);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 20, this.p.release ?? 250);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const makeup = dbToLin(p.makeup ?? 0);\n const mix = p.mix ?? 1;\n // Knee is expressed as a ratio in FFmpeg; convert to dB width.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const thresholdDb = p.threshold ?? -24;\n const ratio = p.ratio ?? 4;\n // Below this the gain computer returns unity, so the sample needs no\n // logarithm at all.\n const kneeStartLin = dbToLin(thresholdDb - kneeDb);\n const dry = 1 - mix;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n // Per-channel follower, and the sub-knee shortcut: below the knee the\n // gain is exactly unity, so the sample needs no logarithm at all.\n const env = this.env.push(ch, x);\n if (env <= kneeStartLin) {\n out[n] = x * makeup * mix + x * dry;\n continue;\n }\n const envDb = 20 * Math.log10(env);\n const g = dbToLinFast(kneeGain(envDb, thresholdDb, ratio, kneeDb));\n out[n] = x * g * makeup * mix + x * dry;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-compressor", HfCompressor);\n\nclass HfLimiter extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 5, this.p.release ?? 50);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 5, this.p.release ?? 50);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const ceiling = dbToLin(this.p.limit ?? -1);\n const outGain = dbToLin(this.p.level_out ?? 0);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n // Only ever attenuate: a limiter that can raise level is a compressor.\n const g = env > ceiling ? ceiling / env : 1;\n out[n] = x * g * outGain;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-limiter", HfLimiter);\n\nclass HfGate extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 1, this.p.release ?? 100);\n this.gains = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 1, this.p.release ?? 100);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const threshold = dbToLin(p.threshold ?? -35);\n const floor = dbToLin(p.range ?? -24);\n const ratio = p.ratio ?? 10;\n // Knee is declared in the registry as a ratio, like the compressor\'s; a\n // hard threshold ignored it and chattered on material sitting right at the\n // gate point.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const kneeLin = dbToLin((p.threshold ?? -35) + kneeDb);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n let target = 1;\n // Above the threshold the gate is fully open; skip the pow entirely.\n if (env < threshold) {\n const under = env > 1e-9 ? threshold / env : 1e9;\n target = Math.max(floor, 1 / Math.pow(under, ratio - 1));\n if (!isFinite(target)) target = floor;\n }\n // Smooth toward the target so the gate does not click on every sample.\n const held = this.gains[ch] ?? 1;\n const c = target < held ? this.env.r : this.env.a;\n const smoothed = target + c * (held - target);\n this.gains[ch] = smoothed;\n out[n] = x * smoothed;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-gate", HfGate);\n\nclass HfBitcrush extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.holds = [];\n this.held = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const levels = Math.pow(2, (p.bits ?? 8) - 1);\n const step = Math.max(1, Math.round(p.samples ?? 1));\n const mix = p.mix ?? 1;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n if (this.held[ch] === undefined) this.held[ch] = 0;\n if (this.holds[ch] === undefined) this.holds[ch] = 0;\n for (let n = 0; n < inp.length; n++) {\n // Per channel: advancing one shared counter only on the last channel\n // left every earlier channel either unheld or frozen for a whole\n // 128-sample quantum, clicking once a block.\n if (this.holds[ch] === 0) this.held[ch] = Math.round(inp[n] * levels) / levels;\n out[n] = this.held[ch] * mix + inp[n] * (1 - mix);\n this.holds[ch] = (this.holds[ch] + 1) % step;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-bitcrush", HfBitcrush);\n\n/** Linear-interpolated read, \\`delaySamples\\` behind the write head. */\nfunction readTap(ring, write, delaySamples) {\n const len = ring.length;\n const pos = (write - 1 - delaySamples + len) % len;\n const i0 = Math.floor(pos);\n const frac = pos - i0;\n const i1 = (i0 + 1) % len;\n return ring[i0] * (1 - frac) + ring[i1] * frac;\n}\n\n/** Equal-power-ish crossfade, zero at a tap\'s reset point \\u2014 hides the splice. */\nfunction xfade(phase) {\n return Math.sin(Math.PI * phase);\n}\n\n/**\n * Dual-tap granular delay line: two read taps 180\\xB0 apart in a 100 ms grain,\n * each sweeping at a speed relative to the write head that shifts pitch\n * without changing duration. One tap is always fading in as the other fades\n * out, which hides the splice each tap makes when it wraps.\n *\n * write/phase are block-level state, advanced once per SAMPLE across all\n * channels together (not once per channel) \\u2014 advancing them inside the\n * per-channel loop would move the tap 2x/4x too fast on a stereo/quad input.\n */\nclass HfPitchshift extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.grain = Math.round(sampleRate * 0.1);\n this.buf = [];\n this.write = 0;\n this.phase = 0;\n // Samples written so far, capped at one grain. The taps read up to a grain\n // behind the write head, so until this fills they would read the ring\'s\n // zeros \\u2014 the head of every clip came out attenuated or silent.\n this.filled = 0;\n // How much of the wet (pitch-shifted) path is currently in the output, and\n // where it is heading. Crossing between dry and wet is a ~50 ms jump in the\n // signal, so it is RAMPED rather than switched: a hard swap either way is a\n // click. Ramping in both directions is also what lets a node return to true\n // bypass at semitones 0 \\u2014 a one-way latch left preview stuck with the delay\n // that the render, building a fresh node from the attribute, does not have.\n this.wet = 0;\n this.wetTarget = 0;\n // ~15 ms one-pole, short enough to feel immediate on a slider drag and long\n // enough that the splice is inaudible.\n this.wetCoef = Math.exp(-1 / (sampleRate * 0.015));\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const semitones = Math.max(-12, Math.min(12, p.semitones ?? 0));\n const mix = Math.max(0, Math.min(1, p.mix ?? 1));\n const grain = this.grain;\n const ringLen = grain * 2;\n const n = i[0] ? i[0].length : 0;\n for (let ch = 0; ch < i.length; ch++) {\n if (!this.buf[ch]) this.buf[ch] = new Float32Array(ringLen);\n }\n\n // Nothing to shift, or mixed fully out. The grain delay is ~grain/2\n // whatever the ratio, so at semitones=0 this degenerated into a pure 50 ms\n // delay of the signal \\u2014 while the copy for that exact setting reads\n // "Unchanged pitch".\n this.wetTarget = semitones === 0 ? 0 : mix;\n\n // Fully dry AND settled: take the cheap transparent path. The ring keeps\n // filling, so a later shift does not start cold.\n if (this.wetTarget === 0 && this.wet < 1e-4) {\n this.wet = 0;\n let w = this.write;\n for (let s = 0; s < n; s++) {\n for (let ch = 0; ch < i.length; ch++) {\n const x = i[ch][s];\n this.buf[ch][w] = x;\n o[ch][s] = x;\n }\n w = (w + 1) % ringLen;\n }\n this.write = w;\n this.filled = Math.min(grain, this.filled + n);\n return true;\n }\n\n const ratio = Math.pow(2, semitones / 12);\n const inc = (1 - ratio) / grain;\n let write = this.write, phase = this.phase, filled = this.filled, wetNow = this.wet;\n const target = this.wetTarget, coef = this.wetCoef;\n for (let s = 0; s < n; s++) {\n phase += inc;\n phase -= Math.floor(phase);\n const phaseB = (phase + 0.5) % 1;\n const gA = xfade(phase), gB = xfade(phaseB);\n // Ramp the wet path in as the ring fills rather than reading zeros:\n // 100 ms of unshifted audio at the head of a clip beats 50 ms of silence.\n const warm = filled >= grain ? 1 : filled / grain;\n wetNow = target + coef * (wetNow - target);\n const wetMix = wetNow * warm;\n for (let ch = 0; ch < i.length; ch++) {\n const ring = this.buf[ch];\n const inp = i[ch], out = o[ch];\n const x = inp[s];\n ring[write] = x;\n const wet =\n readTap(ring, write, phase * grain) * gA + readTap(ring, write, phaseB * grain) * gB;\n out[s] = x * (1 - wetMix) + wet * wetMix;\n }\n write = (write + 1) % ringLen;\n if (filled < grain) filled++;\n }\n this.write = write;\n this.phase = phase;\n this.filled = filled;\n this.wet = wetNow;\n return true;\n }\n}\nregisterProcessor("hf-pitchshift", HfPitchshift);\n`,S=new WeakMap;var ye=new WeakSet;function G(e){let t=S.get(e);return t||(t=(async()=>{if(!e.audioWorklet)throw new Error("AudioWorklet is unavailable \\u2014 the page needs a secure context (https, localhost or file://)");let n=`data:text/javascript;base64,${btoa(String.fromCharCode(...new TextEncoder().encode(Ae)))}`;await e.audioWorklet.addModule(n),ye.add(e)})().catch(n=>{throw S.delete(e),n}),S.set(e,t)),t}function we(e,t,n){let o=.6+Math.max(0,Math.min(1,t))*2.6,a=Math.max(1,Math.floor(e*o)),i=new Float32Array(a),r=Math.round(t*1e3)*2654435761+Math.round(n*1e3)*40503>>>0,s=()=>(r=r*1664525+1013904223>>>0,r/4294967295*2-1),l=Math.max(.001,1-Math.max(0,Math.min(1,n))),u=0,d=0;for(let c=0;c<a;c++){u+=l*(s()-u);let b=u*Math.pow(1-c/a,2.5);i[c]=b,d+=b*b}let m=Math.sqrt(d);if(m>0)for(let c=0;c<a;c++)i[c]=(i[c]??0)/m;return i}var f=e=>typeof e=="number"?e:Number(e??0),I=e=>e/1e3;function Z(e,t,n,o){let a=Math.max(1,Math.round(e.sampleRate)),i=e.createBuffer(1,a,e.sampleRate),r=i.getChannelData(0);for(let u=0;u<a;u++){let d=u/a;r[u]=t==="sine"?Math.sin(2*Math.PI*d):4*Math.abs((d+.75)%1-.5)-1}let s=e.createBufferSource();s.buffer=i,s.loop=!0,s.playbackRate.value=n;let l=(o*n%1+1)%1*(a/e.sampleRate);return s.start(typeof e.currentTime=="number"?e.currentTime:0,l),s}function ee(e){try{e.stop()}catch{}e.disconnect()}function L(e,t){return[{param:e},{param:t,map:n=>1-n}]}function te(e,t,n){e.gain.value=n,t.gain.value=1-n}function E(e,t,n){return{input:e,output:e,update:t,automation:n,dispose:()=>e.disconnect()}}var ke=new Set(["peaking","highpass","lowpass"]),J=e=>Math.pow(10,e/20),ve=(e,t)=>{let n=e.createGain(),o=a=>{n.gain.value=J(f(a.gain))};return o(t),E(n,o,{gain:[{param:n.gain,map:J}]})};function P(e,t){return(n,o)=>{let a=n.createBiquadFilter();a.type=e;let i=r=>{a.frequency.value=f(r.frequency),r.q!==void 0&&(a.Q.value=f(r.q)),t&&(a.gain.value=f(r.gain))};return i(o),E(a,i,{frequency:[{param:a.frequency}],...ke.has(e)?{q:[{param:a.Q}]}:{},...t?{gain:[{param:a.gain}]}:{}})}}function Me(e){return(t,n)=>{let o=Math.tan(Math.PI*f(n.frequency)/t.sampleRate),a=e==="highpass"?t.createIIRFilter([1/(1+o),-1/(1+o)],[1,(o-1)/(o+1)]):t.createIIRFilter([o/(1+o),o/(1+o)],[1,(o-1)/(o+1)]);return E(a,()=>{})}}function T(e){return(t,n)=>{let o=new AudioWorkletNode(t,e,{processorOptions:{...n}});return{input:o,output:o,update:a=>o.port.postMessage({...a}),dispose:()=>{o.port.postMessage({__hfDispose:!0}),o.disconnect()}}}}var Fe={tanh:Math.tanh,atan:e=>2/Math.PI*Math.atan(Math.PI/2*e),cubic:e=>Math.abs(e)>=1?Math.sign(e):e-e**3/3,exp:e=>Math.sign(e)*(1-Math.exp(-Math.abs(e))),alg:e=>e/Math.sqrt(1+e*e),quintic:e=>Math.abs(e)>=1?Math.sign(e):e-e**5/5,sin:e=>Math.abs(e)>=1?Math.sign(e):Math.sin(Math.PI/2*e),erf:e=>Math.tanh(1.20211*e),hard:e=>Math.max(-1,Math.min(1,e))},He=(e,t)=>{let n=e.createWaveShaper(),o=e.createGain(),a=e.createGain();o.connect(n).connect(a);let i=r=>{let s=Fe[String(r.type)]??Math.tanh,l=Math.pow(10,f(r.threshold)/20),u=8192,d=new Float32Array(u);for(let m=0;m<u;m++){let c=m/(u-1)*2-1;d[m]=s(c/Math.max(1e-6,l))*l}n.curve=d,n.oversample=f(r.oversample)>=4?"4x":f(r.oversample)>=2?"2x":"none",a.gain.value=Math.pow(10,f(r.output)/20)};return i(t),{input:o,output:a,update:i,automation:{output:[{param:a.gain,map:r=>Math.pow(10,r/20)}]},dispose:()=>{o.disconnect(),n.disconnect(),a.disconnect()}}},Pe=(e,t)=>{let n=e.createGain(),o=e.createGain(),a=e.createDelay(5),i=e.createGain(),r=e.createGain(),s=e.createGain();n.connect(a),a.connect(i),i.connect(a),a.connect(r).connect(o),n.connect(s).connect(o);let l=u=>{a.delayTime.value=Math.min(5,f(u.time)/1e3),i.gain.value=f(u.feedback),te(r,s,f(u.mix))};return l(t),{input:n,output:o,update:l,automation:{time:[{param:a.delayTime,map:u=>Math.min(5,I(u))}],feedback:[{param:i.gain}],mix:L(r.gain,s.gain)},dispose:()=>[n,o,a,i,r,s].forEach(u=>u.disconnect())}},Te=(e,t,n)=>{let o=e.createGain(),a=e.createGain(),i=e.createDelay(.5),r=Z(e,"sine",f(t.speed),n),s=e.createGain(),l=e.createGain(),u=e.createGain();r.connect(s).connect(i.delayTime),o.connect(i).connect(l).connect(a),o.connect(u).connect(a);let d=m=>{i.delayTime.value=f(m.delay)/1e3,s.gain.value=f(m.depth)/1e3,r.playbackRate.value=f(m.speed),te(l,u,f(m.mix))};return d(t),{input:o,output:a,update:d,automation:{delay:[{param:i.delayTime,map:I}],depth:[{param:s.gain,map:I}],speed:[{param:r.playbackRate}],mix:L(l.gain,u.gain)},dispose:()=>{ee(r),[o,a,i,s,l,u].forEach(m=>m.disconnect())}}},Ne=6,_e=(e,t,n)=>{let o=e.createGain(),a=e.createGain(),i=e.createGain(),r=e.createGain(),s=Z(e,String(t.type)==="1"?"sine":"triangle",f(t.speed),n),l=e.createGain(),u=e.createGain(),d=e.createGain(),m=[];o.connect(i);let c=i;for(let p=0;p<Ne;p++){let h=e.createBiquadFilter();h.type="allpass",h.Q.value=.7071,l.connect(h.frequency),c.connect(h),c=h,m.push(h)}s.connect(l),c.connect(u).connect(r),i.connect(d).connect(r),r.connect(a);let b=p=>{let h=1e3/Math.max(.1,f(p.delay));for(let g of m)g.frequency.value=h;l.gain.value=h*f(p.decay),s.playbackRate.value=f(p.speed),i.gain.value=f(p.in_gain),r.gain.value=f(p.out_gain),u.gain.value=1,d.gain.value=1};return b(t),{input:o,output:a,update:b,automation:{speed:[{param:s.playbackRate}],in_gain:[{param:i.gain}],out_gain:[{param:r.gain}]},dispose:()=>{ee(s),[o,a,i,r,l,u,d,...m].forEach(p=>p.disconnect())}}},Re=(e,t)=>{let n=e.createGain(),o=e.createGain(),a=e.createConvolver(),i=e.createGain(),r=e.createGain();a.normalize=!1,n.connect(a).connect(i).connect(o),n.connect(r).connect(o);let s="",l=u=>{let d=`${f(u.size)}:${f(u.damping)}`;if(d!==s){let m=we(e.sampleRate,f(u.size),f(u.damping)),c=e.createBuffer(1,m.length,e.sampleRate);c.getChannelData(0).set(m),a.buffer=c,s=d}i.gain.value=f(u.wet),r.gain.value=f(u.dry)};return l(t),{input:n,output:o,update:l,automation:{wet:[{param:i.gain}],dry:[{param:r.gain}]},dispose:()=>[n,o,a,i,r].forEach(u=>u.disconnect())}},Ce={"gain-node":ve,"biquad-peaking":P("peaking",!0),"biquad-lowshelf":P("lowshelf",!0),"biquad-highshelf":P("highshelf",!0),"biquad-highpass":P("highpass",!1),"biquad-lowpass":P("lowpass",!1),"worklet-compressor":T("hf-compressor"),"worklet-limiter":T("hf-limiter"),"worklet-gate":T("hf-gate"),"worklet-bitcrush":T("hf-bitcrush"),"worklet-pitchshift":T("hf-pitchshift"),waveshaper:He,"delay-feedback":Pe,"chorus-lfo":Te,"allpass-phaser":_e,convolver:Re};function ne(e){return e.nodes.some(t=>F(t.type)?.web.startsWith("worklet-")??!1)}function De(e,t,n,o=0){let a=F(t);if(!a)throw new Error(`Unknown effect type: ${t}`);let i=w(t,n);if((t==="highpass"||t==="lowpass")&&String(i.poles)==="1")return Me(t)(e,i,o);let r=Ce[a.web];if(!r)throw new Error(`No Web Audio builder for ${a.web}`);return r(e,i,o)}function K(e){let t=[];for(let n of e){let o=n.fromPreset,a=t.at(-1);if(a&&a.preset===o)a.nodes.push(n);else{let i=typeof n.presetAmount=="number"?n.presetAmount:1;t.push({...o?{preset:o}:{},amount:Math.min(1,Math.max(0,i)),nodes:[n]})}}return t}function Q(e){return H(e).map(t=>{let n=w(t.type,t.params),o=n.poles!==void 0?`:${n.poles}`:"",a=String(n.poles)==="1"?`@${n.frequency}`:"",i=t.type==="phaser"?`~${n.type}`:"",r=t.fromPreset?`%${t.fromPreset}`:"";return`${t.type}${o}${a}${i}${r}`}).join("|")}function ae(e,t,n=0){var m;let o=e.createGain(),a=e.createGain(),i=[],r=[],s=K(H(t)),l=o;for(let c of s){let b=null;if(c.preset){let p=e.createGain(),h=e.createGain(),g=e.createGain(),v=e.createGain();g.gain.value=c.amount,h.gain.value=1-c.amount,l.connect(p),p.connect(h).connect(v),b={entry:p,wet:g,dry:h,join:v},l=p}for(let p of c.nodes){let h=De(e,p.type,p.params??{},n);l.connect(h.input),l=h.output,i.push({...p.id?{id:p.id}:{},type:p.type,handle:h})}b&&c.preset&&(l.connect(b.wet).connect(b.join),r.push({id:c.preset,...b}),l=b.join)}l.connect(a);let u=Q(t),d={};for(let c of r)(d[m=c.id]??(d[m]=[])).push(...L(c.wet.gain,c.dry.gain));return{input:o,output:a,presets:d,nodes:i,update(c){if(Q(c)!==u)return!1;H(c).forEach((p,h)=>{let g=i[h];g&&(g.handle.update(w(p.type,p.params)),p.id===void 0?delete g.id:g.id=p.id)});let b=0;for(let p of K(H(c))){if(!p.preset)continue;let h=r[b++];!h||h.id!==p.preset||(h.wet.gain.value=p.amount,h.dry.gain.value=1-p.amount)}return!0},dispose(){for(let{handle:c}of i)c.dispose();for(let{entry:c,wet:b,dry:p,join:h}of r)c.disconnect(),b.disconnect(),p.disconnect(),h.disconnect();o.disconnect(),a.disconnect()}}}var oe=3.981071705534972;var Oe="data-automation",Ht=Oe.slice(5),D=1,Be=512,x=class extends Error{constructor(t){super(t),this.name="AudioAutomationError"}},q="volume";function _(e){if(e===q)return{kind:"volume"};let t=e.split(".");if(t.length===3&&t[0]==="fx"&&t[1]===Se){let a=t[2];return a?{kind:"preset",presetId:a}:null}if(t.length!==3||t[0]!=="fx")return null;let[,n,o]=t;return!n||!o?null:{kind:"fx",nodeId:n,param:o}}function ie(e,t){return`fx.${e}.${t}`}var Se="preset";var Ge={min:0,max:1,step:.01,unit:"",label:"Amount",scale:"linear",default:1},re={min:0,max:oe,step:.01,unit:"",label:"Volume",scale:"linear",default:1};function V(e,t){let n=_(e);if(!n)return null;if(n.kind==="volume")return re;if(n.kind==="preset")return t?.nodes.some(s=>s.fromPreset===n.presetId)?{...Ge,label:`${n.presetId} \\xB7 Amount`}:null;let o=t?.nodes.find(r=>r.id===n.nodeId);if(!o)return null;let a=F(o.type),i=a?.params.find(r=>r.key===n.param);return!i||i.kind!=="number"?null:{min:i.min,max:i.max,step:i.step,unit:i.unit,label:`${a?.label??o.type} \\xB7 ${i.label}`,scale:i.scale==="log"&&i.min>0?"log":"linear",default:i.default}}function N(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null}function Ie(e){let t=N(e);return t===null||t===0?0:Math.min(1,Math.max(-1,t))}function se(e,t){let n=N(e),o=N(t);if(n===null||o===null)return null;let a=s=>Math.min(.999,Math.max(.001,s)),i=a(n),r=a(o);return Math.abs(i-r)<1e-6?null:{x:i,y:r}}function Le(e){let t=Ie(e?.curve),n=se(e?.viaX,e?.viaY);return{...t?{curve:t}:{},...n?{viaX:n.x,viaY:n.y}:{}}}function Ee(e,t){let n=N(e?.t),o=N(e?.v);if(n===null||o===null)return null;let a=t?Math.min(t.max,Math.max(t.min,o)):o;return{t:Math.max(0,n),v:a,...Le(e)}}function ue(e,t){let n=e.map(a=>Ee(a,t)).filter(a=>a!==null).sort((a,i)=>a.t-i.t),o=[];for(let a of n)o.length>0&&o[o.length-1].t===a.t?o[o.length-1]=a:o.push(a);return o.slice(0,Be)}function qe(e){let t=[];for(let n of e.lanes){if(!_(n.target))continue;let o=n.target===q?re:null,a=ue(n.points??[],o);a.length>0&&t.push({target:n.target,points:a})}return{version:D,lanes:t}}function le(e,t){let n=[];for(let o of e.lanes){let a=V(o.target,t);if(!a)continue;let i=ue(o.points,a);i.length>0&&n.push({target:o.target,points:i})}return{version:D,lanes:n}}function de(e){let t;try{t=JSON.parse(e)}catch(a){throw new x(`Automation is not valid JSON: ${a.message}`)}if(typeof t!="object"||t===null)throw new x("Automation must be a JSON object.");let n=t;if(n.version!==D)throw new x(`Unsupported automation version: ${String(n.version)}`);if(!Array.isArray(n.lanes))throw new x("Automation is missing a `lanes` array.");let o=n.lanes.map((a,i)=>{if(typeof a!="object"||a===null)throw new x(`Lane ${i} is not an object.`);let r=a;if(typeof r.target!="string"||!_(r.target))throw new x(`Lane ${i} has an unreadable target: ${String(r.target)}`);if(!Array.isArray(r.points))throw new x(`Lane ${i} is missing a \\`points\\` array.`);return{target:r.target,points:r.points}});return qe({version:D,lanes:o})}function Ve(e,t){return t?Math.pow(e,Math.pow(2,2*t)):e}function Ue(e,t){let n=e-.5,o=t-.5,a=.999,i=1e6,r=n>0?n/(a-e):n<0?-n/(e-(1-a)):0,s=o>0?o/(a-t):o<0?-o/(t-(1-a)):0,l=Math.min(i,Math.max(1,r,s));return{cx:e+n/l,cy:t+o/l,w:l}}function $e(e,t,n){let{cx:o,cy:a,w:i}=Ue(t,n),r=2-2*i,s=e*r-1+2*i*o,l=-e*r-2*i*o,u=Xe(s,l,e),d=1-u,m=d*d+2*i*u*d+u*u;return m>0?(2*i*a*u*d+u*u)/m:e}function Xe(e,t,n){if(Math.abs(e)<1e-12)return Math.abs(t)<1e-12?n:-n/t;let o=Math.sqrt(Math.max(0,t*t-4*e*n)),a=(-t+o)/(2*e),i=(-t-o)/(2*e),r=s=>s>=-1e-9&&s<=1+1e-9;return r(a)?Math.min(1,Math.max(0,a)):r(i)?Math.min(1,Math.max(0,i)):n}function We(e,t){let n=se(t.viaX,t.viaY);return n?$e(Math.min(1,Math.max(0,e)),n.x,n.y):Ve(e,t.curve)}function je(e,t,n,o){return o==="log"&&e>0&&t>0?Math.exp(Math.log(e)+(Math.log(t)-Math.log(e))*n):e+(t-e)*n}function U(e,t,n="linear"){let o=e.points;if(o.length===0)return 0;let a=o[0];if(t<=a.t)return a.v;let i=o[o.length-1];if(t>=i.t)return i.v;let r=0,s=o.length-1;for(;s-r>1;){let m=r+s>>1;o[m].t<=t?r=m:s=m}let l=o[r],u=o[s],d=u.t-l.t;return d<=0?u.v:je(l.v,u.v,We((t-l.t)/d,l),n)}function ce(e){return e.points.length<=1||e.points.every(t=>t.v===e.points[0].v)}function me(e,t,n,o,a="linear"){let i=Math.max(2,Math.floor(o)),r=new Float32Array(i),s=n-t;for(let l=0;l<i;l+=1)r[l]=U(e,t+s*l/(i-1),a);return r}var ze=100,Ye=8,Je=4096,$=e=>e;function Ke(e,t,n){return!(!!e.curve||e.viaX!==void 0&&e.viaY!==void 0)&&t==="linear"&&!n}function Qe(e){let t=Math.ceil(e*ze);return Math.min(Je,Math.max(Ye,t))}function Ze(e,t,n,o,a){let{scheduledAt:i,elapsed:r,rate:s}=o,l=a??$,u=k=>i+(k-r)/s,d=e.points[t],m=e.points[t+1],c=u(m.t);if(c<=i)return null;let b=Math.max(i,u(d.t)),p=c-b;if(p<=0)return null;if(Ke(d,n,a))return{kind:"ramp",time:c,value:l(m.v)};let h=Qe(p),g=me(e,Math.max(d.t,r),m.t,h,n),v=new Float32Array(h);for(let k=0;k<h;k+=1)v[k]=l(g[k]??0);return{kind:"curve",time:b,duration:p,values:v}}function et(e,t,n,o){let a=[];for(let r=0;r+1<e.points.length;r+=1){let s=Ze(e,r,t,n,o);s&&a.push(s)}let i=a[0];return i?.kind==="curve"&&i.time<=n.scheduledAt||a.unshift({kind:"set",time:n.scheduledAt,value:(o??$)(U(e,n.elapsed,t))}),a}function tt(e,t){for(let n of t)if(n.kind==="set")e.setValueAtTime(n.value,n.time);else if(n.kind==="ramp")e.linearRampToValueAtTime(n.value,n.time);else try{e.setValueCurveAtTime(n.values,n.time,n.duration)}catch{let o=n.values[n.values.length-1]??0;e.linearRampToValueAtTime(o,n.time+n.duration)}}function nt(e){for(let t of e)t.param.cancelScheduledValues(0)}function at(e,t,n,o){if(t.points.length!==0)for(let a of e){if(nt([a]),ce(t)){let i=(a.map??$)(t.points[0].v);a.param.setValueAtTime(i,o.scheduledAt);continue}tt(a.param,et(t,n,o,a.map))}}function pe(e,t,n,o,a){let i=new Map(n.filter(s=>s.id).map(s=>[s.id,s.handle])),r=[];for(let s of e.lanes){let l=_(s.target);if(!l)continue;let u=l.kind==="preset"?a?.[l.presetId]:l.kind==="fx"?i.get(l.nodeId)?.automation?.[l.param]:void 0;if(!u||u.length===0)continue;let d=V(s.target,t);d&&(at(u,s,d.scale,o),r.push(...u))}return r}var ot=5,it=.001;function y(e,t,n){let o=Number(w(e.type,e.params)[t]??0);if(!e.id||!n)return Number.isFinite(o)?o:0;let a=n.lanes.find(i=>i.target===ie(e.id??"",t));return!a||a.points.length===0?Number.isFinite(o)?o:0:a.points.reduce((i,r)=>Math.max(i,r.v),-1/0)}function rt(e,t){let n=Math.min(5,e/1e3);if(n<=0)return 0;let o=Math.max(0,Math.min(.999,t));return o<=0?n:Math.ceil(Math.log(it)/Math.log(o))*n}function st(e,t){return y(e,"wet",t)>0?.6+Math.max(0,Math.min(1,y(e,"size",t)))*2.6:0}function ut(e,t){return y(e,"mix",t)>0?rt(y(e,"time",t),y(e,"feedback",t)):0}function lt(e,t){return y(e,"mix",t)>0?y(e,"delay",t)/1e3:0}function dt(e,t){return y(e,"mix",t)>0?.2:0}function ct(e,t){if(e.enabled===!1)return 0;switch(e.type){case"reverb":return st(e,t);case"delay":return ut(e,t);case"chorus":return lt(e,t);case"pitchshift":return dt(e,t);default:return 0}}function he(e,t){let n=e.nodes.reduce((o,a)=>o+ct(a,t),0);return Math.min(ot,n)}function mt(e,t,n,o,a){let i=e.createBuffer(n,o,a);for(let r=0;r<n;r++){let s=t[r];s&&i.getChannelData(r).set(s)}return i}function pt(e){let t=[];for(let n=0;n<e.numberOfChannels;n++)t.push(new Float32Array(e.getChannelData(n)));return t}async function ht(e,t,n,o){let a=Y(n),i=Math.max(1,e.length),r=e[0]?.length??0;if(r===0)return e;let s=o?le(de(o),a):null,l=Math.ceil(he(a,s??void 0)*t),u=new OfflineAudioContext(i,r+l,t);ne(a)&&await G(u);let d=u.createBufferSource();d.buffer=mt(u,e,i,r,t);let m=ae(u,a);return s&&pe(s,a,m.nodes,{scheduledAt:0,elapsed:0,rate:1},m.presets),d.connect(m.input),m.output.connect(u.destination),d.start(),pt(await u.startRendering())}window.__HF_AUDIO_FX={render:ht};})();\n';
|
|
88818
89130
|
}
|
|
88819
89131
|
});
|
|
88820
89132
|
|
|
@@ -88846,7 +89158,12 @@ function readWav(path2) {
|
|
|
88846
89158
|
}
|
|
88847
89159
|
const { format, channels, sampleRate, bits, data: data2 } = readWavChunks(buf);
|
|
88848
89160
|
if (!data2) throw new AudioFxRenderError(`WAV has no data chunk: ${path2}`);
|
|
88849
|
-
return {
|
|
89161
|
+
return {
|
|
89162
|
+
samples: decodeSamples(data2, format, bits, path2),
|
|
89163
|
+
sampleRate,
|
|
89164
|
+
channels,
|
|
89165
|
+
float: format === 3 && bits === 32
|
|
89166
|
+
};
|
|
88850
89167
|
}
|
|
88851
89168
|
function decodeSamples(data2, format, bits, path2) {
|
|
88852
89169
|
if (format === 3 && bits === 32) {
|
|
@@ -88864,24 +89181,29 @@ function decodeSamples(data2, format, bits, path2) {
|
|
|
88864
89181
|
}
|
|
88865
89182
|
throw new AudioFxRenderError(`Unsupported WAV format ${format}/${bits}-bit: ${path2}`);
|
|
88866
89183
|
}
|
|
88867
|
-
function writeWav(path2, samples, sampleRate, channels = 1) {
|
|
89184
|
+
function writeWav(path2, samples, sampleRate, channels = 1, float = false) {
|
|
88868
89185
|
const n2 = samples.length;
|
|
88869
|
-
const
|
|
89186
|
+
const bytesPerSample = float ? 4 : 2;
|
|
89187
|
+
const bytes = n2 * bytesPerSample;
|
|
88870
89188
|
const buf = Buffer.alloc(44 + bytes);
|
|
88871
89189
|
buf.write("RIFF", 0, "ascii");
|
|
88872
89190
|
buf.writeUInt32LE(36 + bytes, 4);
|
|
88873
89191
|
buf.write("WAVE", 8, "ascii");
|
|
88874
89192
|
buf.write("fmt ", 12, "ascii");
|
|
88875
89193
|
buf.writeUInt32LE(16, 16);
|
|
88876
|
-
buf.writeUInt16LE(1, 20);
|
|
89194
|
+
buf.writeUInt16LE(float ? 3 : 1, 20);
|
|
88877
89195
|
buf.writeUInt16LE(channels, 22);
|
|
88878
89196
|
buf.writeUInt32LE(sampleRate, 24);
|
|
88879
|
-
buf.writeUInt32LE(sampleRate * channels *
|
|
88880
|
-
buf.writeUInt16LE(channels *
|
|
88881
|
-
buf.writeUInt16LE(16, 34);
|
|
89197
|
+
buf.writeUInt32LE(sampleRate * channels * bytesPerSample, 28);
|
|
89198
|
+
buf.writeUInt16LE(channels * bytesPerSample, 32);
|
|
89199
|
+
buf.writeUInt16LE(float ? 32 : 16, 34);
|
|
88882
89200
|
buf.write("data", 36, "ascii");
|
|
88883
89201
|
buf.writeUInt32LE(bytes, 40);
|
|
88884
89202
|
for (let i2 = 0; i2 < n2; i2++) {
|
|
89203
|
+
if (float) {
|
|
89204
|
+
buf.writeFloatLE(samples[i2] ?? 0, 44 + i2 * 4);
|
|
89205
|
+
continue;
|
|
89206
|
+
}
|
|
88885
89207
|
const v2 = Math.max(-1, Math.min(1, samples[i2] ?? 0));
|
|
88886
89208
|
buf.writeInt16LE(Math.round(v2 * 32767), 44 + i2 * 2);
|
|
88887
89209
|
}
|
|
@@ -88921,7 +89243,7 @@ async function applyAudioFxChain(inputWav, chain, outputWav, options) {
|
|
|
88921
89243
|
if (!existsSync15(inputWav)) {
|
|
88922
89244
|
throw new AudioFxRenderError(`Audio FX input is missing: ${inputWav}`);
|
|
88923
89245
|
}
|
|
88924
|
-
const { samples, sampleRate, channels } = readWav(inputWav);
|
|
89246
|
+
const { samples, sampleRate, channels, float } = readWav(inputWav);
|
|
88925
89247
|
const planes = deinterleave(samples, channels);
|
|
88926
89248
|
if ((planes[0]?.length ?? 0) === 0) return { path: inputWav, envelopeBaked: false };
|
|
88927
89249
|
const hostDir = mkdtempSync2(join13(tmpdir2(), "hf-fx-host-"));
|
|
@@ -88937,100 +89259,20 @@ async function applyAudioFxChain(inputWav, chain, outputWav, options) {
|
|
|
88937
89259
|
writeFileSync6(hostPage, "<!doctype html><meta charset=utf-8><title>audio fx</title>");
|
|
88938
89260
|
await page.goto(pathToFileURL(hostPage).href, { waitUntil: "domcontentloaded" });
|
|
88939
89261
|
await page.addScriptTag({ content: getAudioFxRuntimeScript() });
|
|
88940
|
-
await page
|
|
88941
|
-
|
|
88942
|
-
|
|
88943
|
-
|
|
88944
|
-
|
|
88945
|
-
|
|
88946
|
-
for (let p2 = 0; p2 < planes.length; p2 += 1) {
|
|
88947
|
-
const plane = planes[p2];
|
|
88948
|
-
if (!plane) continue;
|
|
88949
|
-
const bytes = Buffer.from(plane.buffer, plane.byteOffset, plane.length * 4);
|
|
88950
|
-
for (let at4 = 0; at4 < bytes.length; at4 += TRANSFER_BYTES) {
|
|
88951
|
-
await page.evaluate(
|
|
88952
|
-
([index, b64]) => {
|
|
88953
|
-
const bin = atob(b64);
|
|
88954
|
-
const chunk = new Uint8Array(bin.length);
|
|
88955
|
-
for (let i2 = 0; i2 < bin.length; i2++) chunk[i2] = bin.charCodeAt(i2);
|
|
88956
|
-
window.__HF_FX_IO?.in[index]?.push(chunk);
|
|
88957
|
-
},
|
|
88958
|
-
[p2, bytes.subarray(at4, at4 + TRANSFER_BYTES).toString("base64")]
|
|
88959
|
-
);
|
|
88960
|
-
}
|
|
88961
|
-
}
|
|
88962
|
-
const outLengths = await page.evaluate(
|
|
88963
|
-
async ([rate, chainJson, automationJson]) => {
|
|
88964
|
-
const w3 = window;
|
|
88965
|
-
const io = w3.__HF_FX_IO;
|
|
88966
|
-
if (!w3.__HF_AUDIO_FX || !io) throw new Error("audio FX runtime failed to load");
|
|
88967
|
-
const inPlanes = io.in.map((chunks) => {
|
|
88968
|
-
const bytes = new Uint8Array(chunks.reduce((n2, c3) => n2 + c3.length, 0));
|
|
88969
|
-
let at4 = 0;
|
|
88970
|
-
for (const chunk of chunks) {
|
|
88971
|
-
bytes.set(chunk, at4);
|
|
88972
|
-
at4 += chunk.length;
|
|
88973
|
-
}
|
|
88974
|
-
return new Float32Array(bytes.buffer);
|
|
88975
|
-
});
|
|
88976
|
-
io.in = [];
|
|
88977
|
-
io.out = await w3.__HF_AUDIO_FX.render(
|
|
88978
|
-
inPlanes,
|
|
88979
|
-
rate,
|
|
88980
|
-
chainJson,
|
|
88981
|
-
automationJson || void 0
|
|
88982
|
-
);
|
|
88983
|
-
return io.out.map((plane) => plane.length);
|
|
88984
|
-
},
|
|
88985
|
-
[
|
|
88986
|
-
sampleRate,
|
|
88987
|
-
JSON.stringify(chain),
|
|
88988
|
-
options.automation ? serializeAutomation(options.automation) : ""
|
|
88989
|
-
]
|
|
89262
|
+
await sendPlanesToPage(page, planes);
|
|
89263
|
+
const outLengths = await renderPlanesInPage(
|
|
89264
|
+
page,
|
|
89265
|
+
sampleRate,
|
|
89266
|
+
chain,
|
|
89267
|
+
options.automation ? serializeAutomation(options.automation) : ""
|
|
88990
89268
|
);
|
|
88991
|
-
const outPlanes =
|
|
88992
|
-
for (let p2 = 0; p2 < outLengths.length; p2 += 1) {
|
|
88993
|
-
const byteLength = (outLengths[p2] ?? 0) * 4;
|
|
88994
|
-
const parts = [];
|
|
88995
|
-
for (let at4 = 0; at4 < byteLength; at4 += TRANSFER_BYTES) {
|
|
88996
|
-
const b64 = await page.evaluate(
|
|
88997
|
-
([index, offset2, limit]) => {
|
|
88998
|
-
const plane = window.__HF_FX_IO?.out[index];
|
|
88999
|
-
if (!plane) return "";
|
|
89000
|
-
const u8 = new Uint8Array(
|
|
89001
|
-
plane.buffer,
|
|
89002
|
-
plane.byteOffset + offset2,
|
|
89003
|
-
Math.min(limit, plane.length * 4 - offset2)
|
|
89004
|
-
);
|
|
89005
|
-
let s2 = "";
|
|
89006
|
-
const CHUNK = 32768;
|
|
89007
|
-
for (let i2 = 0; i2 < u8.length; i2 += CHUNK) {
|
|
89008
|
-
s2 += String.fromCharCode.apply(
|
|
89009
|
-
null,
|
|
89010
|
-
u8.subarray(i2, i2 + CHUNK)
|
|
89011
|
-
);
|
|
89012
|
-
}
|
|
89013
|
-
return btoa(s2);
|
|
89014
|
-
},
|
|
89015
|
-
[p2, at4, TRANSFER_BYTES]
|
|
89016
|
-
);
|
|
89017
|
-
parts.push(Buffer.from(b64, "base64"));
|
|
89018
|
-
}
|
|
89019
|
-
const buf = Buffer.concat(parts);
|
|
89020
|
-
outPlanes.push(
|
|
89021
|
-
new Float32Array(buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength))
|
|
89022
|
-
);
|
|
89023
|
-
}
|
|
89269
|
+
const outPlanes = await readPlanesFromPage(page, outLengths);
|
|
89024
89270
|
if (outPlanes.length === 0 || (outPlanes[0]?.length ?? 0) === 0) {
|
|
89025
89271
|
throw new AudioFxRenderError(`Audio FX produced no samples for track ${options.trackId}`);
|
|
89026
89272
|
}
|
|
89027
|
-
const gainAt = options.envelope
|
|
89028
|
-
options.envelope.keyframes,
|
|
89029
|
-
options.envelope.trackStart,
|
|
89030
|
-
options.envelope.baseVolume
|
|
89031
|
-
) : null;
|
|
89273
|
+
const gainAt = envelopeWalkerFor(options.envelope);
|
|
89032
89274
|
if (gainAt) applyEnvelopeToPlanes(outPlanes, sampleRate, gainAt);
|
|
89033
|
-
writeWav(outputWav, interleave(outPlanes), sampleRate, outPlanes.length);
|
|
89275
|
+
writeWav(outputWav, interleave(outPlanes), sampleRate, outPlanes.length, float);
|
|
89034
89276
|
return { path: outputWav, envelopeBaked: gainAt !== null };
|
|
89035
89277
|
} finally {
|
|
89036
89278
|
await page.close().catch(() => void 0);
|
|
@@ -89045,6 +89287,89 @@ async function applyAudioFxChain(inputWav, chain, outputWav, options) {
|
|
|
89045
89287
|
await lease?.release().catch(() => void 0);
|
|
89046
89288
|
}
|
|
89047
89289
|
}
|
|
89290
|
+
async function sendPlanesToPage(page, planes) {
|
|
89291
|
+
await page.evaluate((count) => {
|
|
89292
|
+
window.__HF_FX_IO = {
|
|
89293
|
+
in: Array.from({ length: count }, () => []),
|
|
89294
|
+
out: []
|
|
89295
|
+
};
|
|
89296
|
+
}, planes.length);
|
|
89297
|
+
for (let p2 = 0; p2 < planes.length; p2 += 1) {
|
|
89298
|
+
const plane = planes[p2];
|
|
89299
|
+
if (!plane) continue;
|
|
89300
|
+
const bytes = Buffer.from(plane.buffer, plane.byteOffset, plane.length * 4);
|
|
89301
|
+
for (let at4 = 0; at4 < bytes.length; at4 += TRANSFER_BYTES) {
|
|
89302
|
+
await page.evaluate(
|
|
89303
|
+
([index, b64]) => {
|
|
89304
|
+
const bin = atob(b64);
|
|
89305
|
+
const chunk = new Uint8Array(bin.length);
|
|
89306
|
+
for (let i2 = 0; i2 < bin.length; i2++) chunk[i2] = bin.charCodeAt(i2);
|
|
89307
|
+
window.__HF_FX_IO?.in[index]?.push(chunk);
|
|
89308
|
+
},
|
|
89309
|
+
[p2, bytes.subarray(at4, at4 + TRANSFER_BYTES).toString("base64")]
|
|
89310
|
+
);
|
|
89311
|
+
}
|
|
89312
|
+
}
|
|
89313
|
+
}
|
|
89314
|
+
async function renderPlanesInPage(page, sampleRate, chain, automationJson) {
|
|
89315
|
+
return await page.evaluate(
|
|
89316
|
+
async ([rate, chainJson, automation]) => {
|
|
89317
|
+
const w3 = window;
|
|
89318
|
+
const io = w3.__HF_FX_IO;
|
|
89319
|
+
if (!w3.__HF_AUDIO_FX || !io) throw new Error("audio FX runtime failed to load");
|
|
89320
|
+
const inPlanes = io.in.map((chunks) => {
|
|
89321
|
+
const bytes = new Uint8Array(chunks.reduce((n2, c3) => n2 + c3.length, 0));
|
|
89322
|
+
let at4 = 0;
|
|
89323
|
+
for (const chunk of chunks) {
|
|
89324
|
+
bytes.set(chunk, at4);
|
|
89325
|
+
at4 += chunk.length;
|
|
89326
|
+
}
|
|
89327
|
+
return new Float32Array(bytes.buffer);
|
|
89328
|
+
});
|
|
89329
|
+
io.in = [];
|
|
89330
|
+
io.out = await w3.__HF_AUDIO_FX.render(inPlanes, rate, chainJson, automation || void 0);
|
|
89331
|
+
return io.out.map((plane) => plane.length);
|
|
89332
|
+
},
|
|
89333
|
+
[sampleRate, JSON.stringify(chain), automationJson]
|
|
89334
|
+
);
|
|
89335
|
+
}
|
|
89336
|
+
async function readPlaneFromPage(page, index, byteLength) {
|
|
89337
|
+
const parts = [];
|
|
89338
|
+
for (let at4 = 0; at4 < byteLength; at4 += TRANSFER_BYTES) {
|
|
89339
|
+
const b64 = await page.evaluate(
|
|
89340
|
+
([plane_index, offset2, limit]) => {
|
|
89341
|
+
const plane = window.__HF_FX_IO?.out[plane_index];
|
|
89342
|
+
if (!plane) return "";
|
|
89343
|
+
const u8 = new Uint8Array(
|
|
89344
|
+
plane.buffer,
|
|
89345
|
+
plane.byteOffset + offset2,
|
|
89346
|
+
Math.min(limit, plane.length * 4 - offset2)
|
|
89347
|
+
);
|
|
89348
|
+
let s2 = "";
|
|
89349
|
+
const CHUNK = 32768;
|
|
89350
|
+
for (let i2 = 0; i2 < u8.length; i2 += CHUNK) {
|
|
89351
|
+
s2 += String.fromCharCode.apply(null, u8.subarray(i2, i2 + CHUNK));
|
|
89352
|
+
}
|
|
89353
|
+
return btoa(s2);
|
|
89354
|
+
},
|
|
89355
|
+
[index, at4, TRANSFER_BYTES]
|
|
89356
|
+
);
|
|
89357
|
+
parts.push(Buffer.from(b64, "base64"));
|
|
89358
|
+
}
|
|
89359
|
+
const buf = Buffer.concat(parts);
|
|
89360
|
+
return new Float32Array(buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength));
|
|
89361
|
+
}
|
|
89362
|
+
async function readPlanesFromPage(page, outLengths) {
|
|
89363
|
+
const outPlanes = [];
|
|
89364
|
+
for (let p2 = 0; p2 < outLengths.length; p2 += 1) {
|
|
89365
|
+
outPlanes.push(await readPlaneFromPage(page, p2, (outLengths[p2] ?? 0) * 4));
|
|
89366
|
+
}
|
|
89367
|
+
return outPlanes;
|
|
89368
|
+
}
|
|
89369
|
+
function envelopeWalkerFor(envelope) {
|
|
89370
|
+
if (!envelope) return null;
|
|
89371
|
+
return createEnvelopeWalker(envelope.keyframes, envelope.trackStart, envelope.baseVolume);
|
|
89372
|
+
}
|
|
89048
89373
|
var AudioFxRenderError, TRANSFER_BYTES;
|
|
89049
89374
|
var init_audioFxRender = __esm({
|
|
89050
89375
|
"../engine/src/services/audioFxRender.ts"() {
|
|
@@ -89068,9 +89393,16 @@ var init_audioFxRender = __esm({
|
|
|
89068
89393
|
// ../engine/src/services/audioMixer.ts
|
|
89069
89394
|
import { closeSync as closeSync2, existsSync as existsSync16, mkdirSync as mkdirSync8, mkdtempSync as mkdtempSync3, openSync as openSync2, rmSync as rmSync6, writeFileSync as writeFileSync7 } from "fs";
|
|
89070
89395
|
import { join as join14, dirname as dirname9 } from "path";
|
|
89396
|
+
function memberGroupKey(el) {
|
|
89397
|
+
return el.getAttribute(AUDIO_GROUP_RENDER_ID_ATTR) ?? el.getAttribute(HF_AUDIO_GROUP_ATTR);
|
|
89398
|
+
}
|
|
89071
89399
|
function clampVolume(volume) {
|
|
89072
89400
|
return clampAudioGain(volume);
|
|
89073
89401
|
}
|
|
89402
|
+
function safePathSegment(id, fallbackIndex) {
|
|
89403
|
+
const cleaned = id.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
89404
|
+
return `${cleaned || "group"}-${fallbackIndex}`;
|
|
89405
|
+
}
|
|
89074
89406
|
function formatFilterNumber(value) {
|
|
89075
89407
|
return Number(value.toFixed(6)).toString();
|
|
89076
89408
|
}
|
|
@@ -89308,7 +89640,7 @@ function parseAudioElements(html) {
|
|
|
89308
89640
|
resolveAudioGroups(document2).map((group) => [group.id, group])
|
|
89309
89641
|
);
|
|
89310
89642
|
const memberGroupHidden = (el) => {
|
|
89311
|
-
const groupId = el
|
|
89643
|
+
const groupId = memberGroupKey(el);
|
|
89312
89644
|
return groupId ? groupsById.get(groupId)?.hidden ?? false : false;
|
|
89313
89645
|
};
|
|
89314
89646
|
const build = (el, id, type) => {
|
|
@@ -89317,7 +89649,7 @@ function parseAudioElements(html) {
|
|
|
89317
89649
|
const volumeAttr = el.getAttribute("data-volume");
|
|
89318
89650
|
const fxChain = el.getAttribute(HF_AUDIO_FX_ATTR);
|
|
89319
89651
|
const automation = el.getAttribute(HF_AUDIO_AUTOMATION_ATTR);
|
|
89320
|
-
const groupId = type === "audio" ? el
|
|
89652
|
+
const groupId = type === "audio" ? memberGroupKey(el) : null;
|
|
89321
89653
|
const group = groupId ? groupsById.get(groupId) : void 0;
|
|
89322
89654
|
return {
|
|
89323
89655
|
id,
|
|
@@ -89613,17 +89945,21 @@ async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal,
|
|
|
89613
89945
|
const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG2.ffmpegProcessTimeout;
|
|
89614
89946
|
const outputDir = dirname9(outputPath);
|
|
89615
89947
|
if (!existsSync16(outputDir)) mkdirSync8(outputDir, { recursive: true });
|
|
89616
|
-
const
|
|
89948
|
+
const buildInputFilters = (ignoreKeyframes) => memberTracks.map((track, i2) => {
|
|
89617
89949
|
const delayMs = Math.round(track.start * 1e3);
|
|
89618
89950
|
const trimDuration = track.end - track.start + (track.tailSeconds ?? 0);
|
|
89619
|
-
const volumeFilter = buildVolumeExpression(track);
|
|
89620
|
-
return `[${i2}:a]atrim=0:${formatFilterNumber(trimDuration)},${volumeFilter},adelay=${delayMs}|${delayMs},apad,atrim=0:${formatFilterNumber(totalDuration)}[a${i2}]`;
|
|
89951
|
+
const volumeFilter = buildVolumeExpression(track, ignoreKeyframes);
|
|
89952
|
+
return `[${i2}:a]atrim=0:${formatFilterNumber(trimDuration)},${volumeFilter},adelay=${delayMs}|${delayMs},apad,asetpts=N/SR/TB,atrim=0:${formatFilterNumber(totalDuration)}[a${i2}]`;
|
|
89621
89953
|
});
|
|
89622
89954
|
const mixInputs = memberTracks.map((_, i2) => `[a${i2}]`).join("");
|
|
89623
|
-
const runOnce = async (
|
|
89624
|
-
const
|
|
89625
|
-
|
|
89626
|
-
//
|
|
89955
|
+
const runOnce = async (useNormalize2, ignoreKeyframes = false) => {
|
|
89956
|
+
const inputFilters = buildInputFilters(ignoreKeyframes);
|
|
89957
|
+
const mixFilter = useNormalize2 ? `${mixInputs}amix=inputs=${memberTracks.length}:duration=longest:dropout_transition=0:normalize=0[out]` : (
|
|
89958
|
+
// Every member is padded and trimmed to totalDuration above, and
|
|
89959
|
+
// dropout_transition=0 keeps all N inputs active for that whole span.
|
|
89960
|
+
// amix's default normalize therefore divides by exactly N throughout;
|
|
89961
|
+
// compensate by THIS group's own member count — never the render's
|
|
89962
|
+
// global track count.
|
|
89627
89963
|
`${mixInputs}amix=inputs=${memberTracks.length}:duration=longest:dropout_transition=0[mixed];[mixed]volume=${formatFilterNumber(memberTracks.length)}[out]`
|
|
89628
89964
|
);
|
|
89629
89965
|
const filterComplex = [...inputFilters, mixFilter].join(";");
|
|
@@ -89644,8 +89980,15 @@ async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal,
|
|
|
89644
89980
|
scriptPath,
|
|
89645
89981
|
"-map",
|
|
89646
89982
|
"[out]",
|
|
89983
|
+
// Float, not pcm_s16le: `normalize=0` sums the members at unity, so any
|
|
89984
|
+
// over-unity sum hard-clipped at ±1 in the intermediate — BEFORE the
|
|
89985
|
+
// group's FX chain and its fader ran. Pulling the group down, or the
|
|
89986
|
+
// Giant preset's compressor, then operated on distortion. Preview
|
|
89987
|
+
// cannot reproduce it (its bus is float), and it only shows up in the
|
|
89988
|
+
// export. Both readers downstream take float: `readWav` (format 3) and
|
|
89989
|
+
// `applyVolumeEnvelopeToWav`.
|
|
89647
89990
|
"-acodec",
|
|
89648
|
-
"
|
|
89991
|
+
"pcm_f32le",
|
|
89649
89992
|
"-ar",
|
|
89650
89993
|
"48000",
|
|
89651
89994
|
"-t",
|
|
@@ -89664,14 +90007,25 @@ async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal,
|
|
|
89664
90007
|
rmSync6(scriptDir, { recursive: true, force: true });
|
|
89665
90008
|
}
|
|
89666
90009
|
};
|
|
89667
|
-
let
|
|
90010
|
+
let useNormalize = true;
|
|
90011
|
+
let result = await runOnce(useNormalize);
|
|
89668
90012
|
if (!result.success && groupNormalizeOptionUnsupported(result.stderr)) {
|
|
89669
|
-
|
|
90013
|
+
useNormalize = false;
|
|
90014
|
+
result = await runOnce(useNormalize);
|
|
90015
|
+
}
|
|
90016
|
+
let degradedAutomation = false;
|
|
90017
|
+
const hasAutomation = memberTracks.some((track) => (track.volumeKeyframes?.length ?? 0) > 0);
|
|
90018
|
+
if (!result.success && !signal?.aborted && hasAutomation) {
|
|
90019
|
+
const retry = await runOnce(useNormalize, true);
|
|
90020
|
+
if (retry.success) {
|
|
90021
|
+
result = retry;
|
|
90022
|
+
degradedAutomation = true;
|
|
90023
|
+
}
|
|
89670
90024
|
}
|
|
89671
90025
|
if (signal?.aborted) return { success: false, error: "Group sub-mix cancelled" };
|
|
89672
90026
|
if (!result.success)
|
|
89673
90027
|
return { success: false, error: formatFfmpegError(result.exitCode, result.stderr) };
|
|
89674
|
-
return { success: true };
|
|
90028
|
+
return { success: true, degradedAutomation };
|
|
89675
90029
|
}
|
|
89676
90030
|
async function processCompositionAudio(elements, baseDir, workDir, outputPath, totalDuration, signal, config, compiledDir) {
|
|
89677
90031
|
const startMs = Date.now();
|
|
@@ -89915,71 +90269,94 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
89915
90269
|
};
|
|
89916
90270
|
};
|
|
89917
90271
|
if (failures.length > 0) return bail();
|
|
90272
|
+
const groupsDegradedAutomation = [];
|
|
90273
|
+
let groupIndex = -1;
|
|
89918
90274
|
for (const [groupId, memberTracks] of groupTracks) {
|
|
90275
|
+
groupIndex += 1;
|
|
89919
90276
|
const meta = groupMeta.get(groupId);
|
|
89920
90277
|
if (!meta) continue;
|
|
89921
|
-
const
|
|
89922
|
-
const
|
|
89923
|
-
|
|
89924
|
-
|
|
89925
|
-
|
|
89926
|
-
|
|
89927
|
-
|
|
89928
|
-
|
|
89929
|
-
|
|
90278
|
+
const pathId = safePathSegment(groupId, groupIndex);
|
|
90279
|
+
const groupWavPath = join14(workDir, `group-${pathId}.wav`);
|
|
90280
|
+
try {
|
|
90281
|
+
const subMix = await mixGroupMembers(
|
|
90282
|
+
memberTracks,
|
|
90283
|
+
groupWavPath,
|
|
90284
|
+
totalDuration,
|
|
90285
|
+
effectiveSignal,
|
|
90286
|
+
config
|
|
90287
|
+
);
|
|
90288
|
+
if (!subMix.success) {
|
|
90289
|
+
failures.push({
|
|
90290
|
+
stage: "mix",
|
|
90291
|
+
reason: "ffmpeg_failed",
|
|
90292
|
+
owner: "system",
|
|
90293
|
+
retryable: false,
|
|
90294
|
+
elementId: groupId,
|
|
90295
|
+
detail: boundedDetail(
|
|
90296
|
+
`Group sub-mix failed for group ${groupId}: ${subMix.error ?? "unknown"}`
|
|
90297
|
+
)
|
|
90298
|
+
});
|
|
90299
|
+
continue;
|
|
90300
|
+
}
|
|
90301
|
+
if (subMix.degradedAutomation) groupsDegradedAutomation.push(groupId);
|
|
90302
|
+
const automation = meta.automation ? resolveAutomation(
|
|
90303
|
+
parseAutomation(meta.automation),
|
|
90304
|
+
meta.fxChain ? parseAudioFxChain(meta.fxChain) : void 0
|
|
90305
|
+
) : null;
|
|
90306
|
+
const laneKeyframes = automation ? volumeLaneKeyframes(automation, 0, totalDuration) : null;
|
|
90307
|
+
const envelope = laneKeyframes && laneKeyframes.length > 0 ? { keyframes: laneKeyframes, trackStart: 0, baseVolume: meta.volume } : null;
|
|
90308
|
+
let groupSrcPath = groupWavPath;
|
|
90309
|
+
let bakedEnvelope = false;
|
|
90310
|
+
if (meta.fxChain) {
|
|
90311
|
+
const chain = parseAudioFxChain(meta.fxChain);
|
|
90312
|
+
const fxResult = await applyAudioFxChain(
|
|
90313
|
+
groupSrcPath,
|
|
90314
|
+
chain,
|
|
90315
|
+
join14(workDir, `group-${pathId}-fx.wav`),
|
|
90316
|
+
{
|
|
90317
|
+
trackId: groupId,
|
|
90318
|
+
signal: effectiveSignal,
|
|
90319
|
+
...automation ? { automation } : {},
|
|
90320
|
+
...envelope ? { envelope } : {}
|
|
90321
|
+
}
|
|
90322
|
+
);
|
|
90323
|
+
groupSrcPath = fxResult.path;
|
|
90324
|
+
bakedEnvelope = fxResult.envelopeBaked;
|
|
90325
|
+
}
|
|
90326
|
+
if (envelope && !bakedEnvelope) {
|
|
90327
|
+
bakedEnvelope = applyVolumeEnvelopeToWav(
|
|
90328
|
+
groupSrcPath,
|
|
90329
|
+
envelope.keyframes,
|
|
90330
|
+
envelope.trackStart,
|
|
90331
|
+
envelope.baseVolume
|
|
90332
|
+
);
|
|
90333
|
+
}
|
|
90334
|
+
tracks.push({
|
|
90335
|
+
id: groupId,
|
|
90336
|
+
srcPath: groupSrcPath,
|
|
90337
|
+
start: 0,
|
|
90338
|
+
end: totalDuration,
|
|
90339
|
+
mediaStart: 0,
|
|
90340
|
+
duration: totalDuration,
|
|
90341
|
+
volume: bakedEnvelope ? 1 : meta.volume,
|
|
90342
|
+
// Same fallback an ungrouped track gets: when the envelope could not be
|
|
90343
|
+
// baked into the samples, hand the keyframes to the outer mix's volume
|
|
90344
|
+
// expression instead of dropping the group's automation on the floor.
|
|
90345
|
+
...bakedEnvelope || !laneKeyframes?.length ? {} : { volumeKeyframes: laneKeyframes }
|
|
90346
|
+
});
|
|
90347
|
+
} catch (err) {
|
|
90348
|
+
if (err instanceof AudioFxRenderError) throw err;
|
|
89930
90349
|
failures.push({
|
|
89931
90350
|
stage: "mix",
|
|
89932
|
-
reason: "
|
|
90351
|
+
reason: "internal",
|
|
89933
90352
|
owner: "system",
|
|
89934
90353
|
retryable: false,
|
|
89935
90354
|
elementId: groupId,
|
|
89936
90355
|
detail: boundedDetail(
|
|
89937
|
-
`
|
|
90356
|
+
`Audio processing failed for group ${groupId}: ${err instanceof Error ? err.message : String(err)}`
|
|
89938
90357
|
)
|
|
89939
90358
|
});
|
|
89940
|
-
continue;
|
|
89941
|
-
}
|
|
89942
|
-
const automation = meta.automation ? resolveAutomation(
|
|
89943
|
-
parseAutomation(meta.automation),
|
|
89944
|
-
meta.fxChain ? parseAudioFxChain(meta.fxChain) : void 0
|
|
89945
|
-
) : null;
|
|
89946
|
-
const laneKeyframes = automation ? volumeLaneKeyframes(automation, 0, totalDuration) : null;
|
|
89947
|
-
const envelope = laneKeyframes && laneKeyframes.length > 0 ? { keyframes: laneKeyframes, trackStart: 0, baseVolume: meta.volume } : null;
|
|
89948
|
-
let groupSrcPath = groupWavPath;
|
|
89949
|
-
let bakedEnvelope = false;
|
|
89950
|
-
if (meta.fxChain) {
|
|
89951
|
-
const chain = parseAudioFxChain(meta.fxChain);
|
|
89952
|
-
const fxResult = await applyAudioFxChain(
|
|
89953
|
-
groupSrcPath,
|
|
89954
|
-
chain,
|
|
89955
|
-
join14(workDir, `group-${groupId}-fx.wav`),
|
|
89956
|
-
{
|
|
89957
|
-
trackId: groupId,
|
|
89958
|
-
signal: effectiveSignal,
|
|
89959
|
-
...automation ? { automation } : {},
|
|
89960
|
-
...envelope ? { envelope } : {}
|
|
89961
|
-
}
|
|
89962
|
-
);
|
|
89963
|
-
groupSrcPath = fxResult.path;
|
|
89964
|
-
bakedEnvelope = fxResult.envelopeBaked;
|
|
89965
|
-
}
|
|
89966
|
-
if (envelope && !bakedEnvelope) {
|
|
89967
|
-
bakedEnvelope = applyVolumeEnvelopeToWav(
|
|
89968
|
-
groupSrcPath,
|
|
89969
|
-
envelope.keyframes,
|
|
89970
|
-
envelope.trackStart,
|
|
89971
|
-
envelope.baseVolume
|
|
89972
|
-
);
|
|
89973
90359
|
}
|
|
89974
|
-
tracks.push({
|
|
89975
|
-
id: groupId,
|
|
89976
|
-
srcPath: groupSrcPath,
|
|
89977
|
-
start: 0,
|
|
89978
|
-
end: totalDuration,
|
|
89979
|
-
mediaStart: 0,
|
|
89980
|
-
duration: totalDuration,
|
|
89981
|
-
volume: bakedEnvelope ? 1 : meta.volume
|
|
89982
|
-
});
|
|
89983
90360
|
}
|
|
89984
90361
|
if (failures.length > 0) return bail();
|
|
89985
90362
|
const mixResult = await mixAudioTracks(tracks, outputPath, totalDuration, signal, config);
|
|
@@ -89987,10 +90364,15 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
89987
90364
|
rmSync6(workDir, { recursive: true, force: true });
|
|
89988
90365
|
} catch {
|
|
89989
90366
|
}
|
|
90367
|
+
const degradedNote = groupsDegradedAutomation.length > 0 ? `Volume automation exceeded this ffmpeg build's expression limits in group(s) ${groupsDegradedAutomation.join(", ")}; rendered at base volume` : void 0;
|
|
89990
90368
|
return {
|
|
89991
90369
|
...mixResult,
|
|
89992
90370
|
durationMs: Date.now() - startMs,
|
|
89993
|
-
|
|
90371
|
+
// Both, when both degraded. `mixResult.error ?? degradedNote` reported only
|
|
90372
|
+
// the outer mix and dropped the one that names which GROUPS lost their
|
|
90373
|
+
// members' automation — two different losses, and the operator needs to
|
|
90374
|
+
// hear about the one they can act on.
|
|
90375
|
+
error: [mixResult.error, degradedNote].filter(Boolean).join("; ") || void 0
|
|
89994
90376
|
};
|
|
89995
90377
|
}
|
|
89996
90378
|
var MIXED_AUDIO_FILENAME, MAX_VOLUME_SEGMENTS, VOLUME_SIMPLIFY_EPSILON, STEREO_CHANNEL_FILTER, CURVED_SEGMENT_SAMPLES_PER_SEC;
|
|
@@ -90014,6 +90396,7 @@ var init_audioMixer = __esm({
|
|
|
90014
90396
|
init_audioFxTail();
|
|
90015
90397
|
init_dist3();
|
|
90016
90398
|
init_audioGroups();
|
|
90399
|
+
init_dist3();
|
|
90017
90400
|
init_audioFxRender();
|
|
90018
90401
|
MIXED_AUDIO_FILENAME = "audio.m4a";
|
|
90019
90402
|
MAX_VOLUME_SEGMENTS = 32;
|
|
@@ -102729,7 +103112,7 @@ function studioManualEditsRenderRuntime(manifestContent, activeCompositionPath)
|
|
|
102729
103112
|
const ORIGINAL_ROTATE_ATTR = "data-hf-studio-original-rotate";
|
|
102730
103113
|
const WRAPPED_SEEK_PROP = "__hfStudioManualEditsWrapped";
|
|
102731
103114
|
const ROTATION_TRANSFORM_ORIGIN = "center center";
|
|
102732
|
-
const
|
|
103115
|
+
const finiteNumber2 = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
102733
103116
|
const objectRecord = (value) => value && typeof value === "object" ? value : null;
|
|
102734
103117
|
const runtimeWindow = window;
|
|
102735
103118
|
const parsedManifest = (() => {
|
|
@@ -102848,7 +103231,7 @@ function studioManualEditsRenderRuntime(manifestContent, activeCompositionPath)
|
|
|
102848
103231
|
const matches2 = querySelectorCandidates(selector).filter(
|
|
102849
103232
|
(element) => elementMatchesSourceFile(element, sourceFile)
|
|
102850
103233
|
);
|
|
102851
|
-
const selectorIndex =
|
|
103234
|
+
const selectorIndex = finiteNumber2(targetRecord.selectorIndex) ?? 0;
|
|
102852
103235
|
return matches2[Math.max(0, Math.floor(selectorIndex))] ?? null;
|
|
102853
103236
|
} catch {
|
|
102854
103237
|
return null;
|
|
@@ -102864,8 +103247,8 @@ function studioManualEditsRenderRuntime(manifestContent, activeCompositionPath)
|
|
|
102864
103247
|
return `calc(${original} + ${rotationValue})`;
|
|
102865
103248
|
};
|
|
102866
103249
|
const applyPathOffset = (element, edit) => {
|
|
102867
|
-
const x3 =
|
|
102868
|
-
const y =
|
|
103250
|
+
const x3 = finiteNumber2(edit.x);
|
|
103251
|
+
const y = finiteNumber2(edit.y);
|
|
102869
103252
|
if (x3 == null || y == null) return;
|
|
102870
103253
|
preparePathOffsetBase(element);
|
|
102871
103254
|
element.setAttribute(PATH_OFFSET_ATTR, "true");
|
|
@@ -102886,8 +103269,8 @@ function studioManualEditsRenderRuntime(manifestContent, activeCompositionPath)
|
|
|
102886
103269
|
);
|
|
102887
103270
|
};
|
|
102888
103271
|
const applyBoxSize = (element, edit) => {
|
|
102889
|
-
const width =
|
|
102890
|
-
const height =
|
|
103272
|
+
const width = finiteNumber2(edit.width);
|
|
103273
|
+
const height = finiteNumber2(edit.height);
|
|
102891
103274
|
if (width == null || height == null || width <= 0 || height <= 0) return;
|
|
102892
103275
|
const rounded = {
|
|
102893
103276
|
width: Math.round(Math.max(1, width)),
|
|
@@ -102914,7 +103297,7 @@ function studioManualEditsRenderRuntime(manifestContent, activeCompositionPath)
|
|
|
102914
103297
|
}
|
|
102915
103298
|
};
|
|
102916
103299
|
const applyRotation = (element, edit) => {
|
|
102917
|
-
const angle =
|
|
103300
|
+
const angle = finiteNumber2(edit.angle);
|
|
102918
103301
|
if (angle == null) return;
|
|
102919
103302
|
prepareRotationBase(element);
|
|
102920
103303
|
element.setAttribute(ROTATION_ATTR, "true");
|
|
@@ -103026,14 +103409,14 @@ function studioMotionRenderRuntime(manifestContent, activeCompositionPath) {
|
|
|
103026
103409
|
const ORIGINAL_OPACITY_ATTR = "data-hf-studio-motion-original-opacity";
|
|
103027
103410
|
const ORIGINAL_VISIBILITY_ATTR = "data-hf-studio-motion-original-visibility";
|
|
103028
103411
|
const objectRecord = (value) => value && typeof value === "object" ? value : null;
|
|
103029
|
-
const
|
|
103412
|
+
const finiteNumber2 = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
103030
103413
|
const runtimeWindow = window;
|
|
103031
103414
|
const parseMotionValues = (value) => {
|
|
103032
103415
|
const record = objectRecord(value);
|
|
103033
103416
|
if (!record) return null;
|
|
103034
103417
|
const parsed = {};
|
|
103035
103418
|
for (const key2 of ["x", "y", "scale", "rotation", "opacity", "autoAlpha"]) {
|
|
103036
|
-
const next =
|
|
103419
|
+
const next = finiteNumber2(record[key2]);
|
|
103037
103420
|
if (next != null) parsed[key2] = next;
|
|
103038
103421
|
}
|
|
103039
103422
|
return Object.keys(parsed).length > 0 ? parsed : null;
|
|
@@ -103088,7 +103471,7 @@ function studioMotionRenderRuntime(manifestContent, activeCompositionPath) {
|
|
|
103088
103471
|
const selector = typeof targetRecord.selector === "string" ? targetRecord.selector : "";
|
|
103089
103472
|
if (!selector) return null;
|
|
103090
103473
|
try {
|
|
103091
|
-
const selectorIndex = Math.max(0, Math.floor(
|
|
103474
|
+
const selectorIndex = Math.max(0, Math.floor(finiteNumber2(targetRecord.selectorIndex) ?? 0));
|
|
103092
103475
|
return querySelectorCandidates(selector).filter(
|
|
103093
103476
|
(element) => elementMatchesSourceFile(element, sourceFile)
|
|
103094
103477
|
)[selectorIndex] ?? null;
|
|
@@ -103157,8 +103540,8 @@ function studioMotionRenderRuntime(manifestContent, activeCompositionPath) {
|
|
|
103157
103540
|
if (!targetRecord) continue;
|
|
103158
103541
|
const target = resolveTarget(targetRecord);
|
|
103159
103542
|
if (!target || typeof timeline.fromTo !== "function") continue;
|
|
103160
|
-
const start =
|
|
103161
|
-
const duration =
|
|
103543
|
+
const start = finiteNumber2(motion.start);
|
|
103544
|
+
const duration = finiteNumber2(motion.duration);
|
|
103162
103545
|
if (start == null || duration == null || start < 0 || duration <= 0) continue;
|
|
103163
103546
|
const from = parseMotionValues(motion.from);
|
|
103164
103547
|
const to = parseMotionValues(motion.to);
|
|
@@ -117026,12 +117409,49 @@ function aggregateDedup(perfs) {
|
|
|
117026
117409
|
const skipReasons = armed ? [] : [
|
|
117027
117410
|
...new Set(perfs.map((p2) => p2.staticDedupSkipReason).filter((r2) => !!r2))
|
|
117028
117411
|
].sort();
|
|
117412
|
+
const verificationPerfs = perfs.filter((perf) => perf.staticDedupVerificationOutcome);
|
|
117413
|
+
const verificationOutcomes = [
|
|
117414
|
+
...new Set(
|
|
117415
|
+
verificationPerfs.map((perf) => perf.staticDedupVerificationOutcome).filter((outcome) => outcome != null)
|
|
117416
|
+
)
|
|
117417
|
+
].sort();
|
|
117029
117418
|
return {
|
|
117030
117419
|
enabled: perfs.some((p2) => p2.staticDedupEnabled),
|
|
117031
117420
|
armed,
|
|
117032
117421
|
predictedFrames: perfs.reduce((sum, p2) => sum + (p2.staticDedupPredicted ?? 0), 0),
|
|
117033
117422
|
reusedFrames: perfs.reduce((sum, p2) => sum + (p2.staticDedupReused ?? 0), 0),
|
|
117034
|
-
skipReason: skipReasons.length > 0 ? skipReasons.join("|") : void 0
|
|
117423
|
+
skipReason: skipReasons.length > 0 ? skipReasons.join("|") : void 0,
|
|
117424
|
+
...verificationPerfs.length === 0 ? {} : {
|
|
117425
|
+
verifiedFrames: verificationPerfs.reduce(
|
|
117426
|
+
(sum, perf) => sum + (perf.staticDedupVerified ?? 0),
|
|
117427
|
+
0
|
|
117428
|
+
),
|
|
117429
|
+
verificationOutcomes,
|
|
117430
|
+
plannedRuns: verificationPerfs.reduce(
|
|
117431
|
+
(sum, perf) => sum + (perf.staticDedupVerificationPlannedRuns ?? 0),
|
|
117432
|
+
0
|
|
117433
|
+
),
|
|
117434
|
+
completedRuns: verificationPerfs.reduce(
|
|
117435
|
+
(sum, perf) => sum + (perf.staticDedupVerificationCompletedRuns ?? 0),
|
|
117436
|
+
0
|
|
117437
|
+
),
|
|
117438
|
+
screenshots: verificationPerfs.reduce(
|
|
117439
|
+
(sum, perf) => sum + (perf.staticDedupVerificationScreenshots ?? 0),
|
|
117440
|
+
0
|
|
117441
|
+
),
|
|
117442
|
+
seeks: verificationPerfs.reduce(
|
|
117443
|
+
(sum, perf) => sum + (perf.staticDedupVerificationSeeks ?? 0),
|
|
117444
|
+
0
|
|
117445
|
+
),
|
|
117446
|
+
comparisons: verificationPerfs.reduce(
|
|
117447
|
+
(sum, perf) => sum + (perf.staticDedupVerificationComparisons ?? 0),
|
|
117448
|
+
0
|
|
117449
|
+
),
|
|
117450
|
+
verificationElapsedMs: verificationPerfs.reduce(
|
|
117451
|
+
(sum, perf) => sum + (perf.staticDedupVerificationElapsedMs ?? 0),
|
|
117452
|
+
0
|
|
117453
|
+
)
|
|
117454
|
+
}
|
|
117035
117455
|
};
|
|
117036
117456
|
}
|
|
117037
117457
|
function aggregateBeginFrameReuse(perfs) {
|
|
@@ -131377,13 +131797,13 @@ function parseServerFps(value) {
|
|
|
131377
131797
|
const parsed = parseFps(value);
|
|
131378
131798
|
return parsed.ok ? parsed.value : DEFAULT_SERVER_FPS;
|
|
131379
131799
|
}
|
|
131380
|
-
function
|
|
131800
|
+
function nonEmptyString2(value) {
|
|
131381
131801
|
if (typeof value !== "string") return void 0;
|
|
131382
131802
|
const trimmed = value.trim();
|
|
131383
131803
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
131384
131804
|
}
|
|
131385
131805
|
function parseOutputCandidate(body) {
|
|
131386
|
-
return
|
|
131806
|
+
return nonEmptyString2(body.outputPath) ?? nonEmptyString2(body.output) ?? null;
|
|
131387
131807
|
}
|
|
131388
131808
|
function parseServerQuality(value) {
|
|
131389
131809
|
return value === "draft" || value === "standard" || value === "high" ? value : "high";
|
|
@@ -131415,7 +131835,7 @@ function parseRenderOptions(body) {
|
|
|
131415
131835
|
const debug = body.debug === true;
|
|
131416
131836
|
const strictness = body.bestEffort === false ? "strict" : "best-effort";
|
|
131417
131837
|
const outputPath = parseOutputCandidate(body);
|
|
131418
|
-
const entryFile =
|
|
131838
|
+
const entryFile = nonEmptyString2(body.entryFile);
|
|
131419
131839
|
const format = parseServerFormat(body.format);
|
|
131420
131840
|
const outputDynamicRange = parseServerOutputDynamicRange(body.outputDynamicRange) ?? fromRenderHdrMode(parseLegacyServerHdrMode(body.hdrMode));
|
|
131421
131841
|
const videoFrameFormat = isVideoFrameFormat(body.videoFrameFormat) ? body.videoFrameFormat : void 0;
|
|
@@ -131508,7 +131928,7 @@ function validateOutputResolutionOverride(body) {
|
|
|
131508
131928
|
return void 0;
|
|
131509
131929
|
}
|
|
131510
131930
|
function prepareProjectDirectory(projectDir, options) {
|
|
131511
|
-
const candidate =
|
|
131931
|
+
const candidate = nonEmptyString2(projectDir);
|
|
131512
131932
|
if (!candidate) return null;
|
|
131513
131933
|
const absProjectDir = resolve35(candidate);
|
|
131514
131934
|
if (!existsSync59(absProjectDir) || !statSync19(absProjectDir).isDirectory()) {
|
|
@@ -131523,7 +131943,7 @@ function prepareProjectDirectory(projectDir, options) {
|
|
|
131523
131943
|
async function resolveInlineRenderHtml(body) {
|
|
131524
131944
|
const inlineHtml = typeof body.html === "string" ? body.html : "";
|
|
131525
131945
|
if (inlineHtml) return { html: inlineHtml };
|
|
131526
|
-
const previewUrl =
|
|
131946
|
+
const previewUrl = nonEmptyString2(body.previewUrl);
|
|
131527
131947
|
if (!previewUrl)
|
|
131528
131948
|
return { error: "Missing render source: provide projectDir, previewUrl, or html" };
|
|
131529
131949
|
try {
|
|
@@ -135957,7 +136377,13 @@ import { streamSSE as streamSSE4 } from "hono/streaming";
|
|
|
135957
136377
|
import { existsSync as existsSync70, readFileSync as readFileSync43, writeFileSync as writeFileSync27, statSync as statSync25, unlinkSync as unlinkSync6 } from "fs";
|
|
135958
136378
|
import { resolve as resolve38, join as join79, basename as basename11 } from "path";
|
|
135959
136379
|
async function loadStudioProducer() {
|
|
135960
|
-
|
|
136380
|
+
if (!isDevMode()) return await Promise.resolve().then(() => (init_src2(), src_exports2));
|
|
136381
|
+
if (!process.versions.bun) {
|
|
136382
|
+
throw new Error(
|
|
136383
|
+
"Studio dev-mode rendering requires bun (the producer is loaded from TypeScript source, which Node cannot resolve). Restart the studio with `bun run studio`."
|
|
136384
|
+
);
|
|
136385
|
+
}
|
|
136386
|
+
return await Promise.resolve().then(() => (init_src2(), src_exports2));
|
|
135961
136387
|
}
|
|
135962
136388
|
function resolveDistDir() {
|
|
135963
136389
|
return resolveStudioBundle().dir;
|