hyperframes 0.8.2 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.2" : "0.0.0-dev";
53
+ VERSION = true ? "0.8.3" : "0.0.0-dev";
54
54
  }
55
55
  });
56
56
 
@@ -56014,6 +56014,51 @@ var init_timingResolver = __esm({
56014
56014
  }
56015
56015
  });
56016
56016
 
56017
+ // ../core/dist/runtime/startExpression.js
56018
+ var init_startExpression = __esm({
56019
+ "../core/dist/runtime/startExpression.js"() {
56020
+ "use strict";
56021
+ init_compositionContract();
56022
+ }
56023
+ });
56024
+
56025
+ // ../core/dist/runtime/playbackRate.js
56026
+ function normalizePlaybackRate(raw) {
56027
+ return Number.isFinite(raw) && raw > 0 ? Math.max(0.1, Math.min(5, raw)) : 1;
56028
+ }
56029
+ function parseStrictFiniteTimingNumber(raw) {
56030
+ return parseNumeric2(raw);
56031
+ }
56032
+ function readElementPlaybackRate(el) {
56033
+ const authored = Number.parseFloat(el.getAttribute("data-playback-rate") ?? "");
56034
+ const raw = Number.isFinite(authored) && authored > 0 ? authored : typeof HTMLMediaElement !== "undefined" && el instanceof HTMLMediaElement ? el.defaultPlaybackRate : 1;
56035
+ return normalizePlaybackRate(raw);
56036
+ }
56037
+ function readMediaStart(el) {
56038
+ const parse9 = (raw) => {
56039
+ const value = parseStrictFiniteTimingNumber(raw);
56040
+ if (value == null)
56041
+ return null;
56042
+ return Number.isFinite(value) && value >= 0 ? value : null;
56043
+ };
56044
+ return parse9(el.getAttribute("data-playback-start")) ?? parse9(el.getAttribute("data-media-start")) ?? 0;
56045
+ }
56046
+ function resolveNaturalMediaTimelineDuration(el, sourceDuration) {
56047
+ return resolveNaturalMediaTimelineDurationFromValues(sourceDuration, readMediaStart(el), readElementPlaybackRate(el));
56048
+ }
56049
+ function resolveNaturalMediaTimelineDurationFromValues(sourceDuration, mediaStart, playbackRate) {
56050
+ if (!Number.isFinite(sourceDuration))
56051
+ return null;
56052
+ const remaining = Math.max(0, sourceDuration - mediaStart);
56053
+ return remaining / normalizePlaybackRate(playbackRate);
56054
+ }
56055
+ var init_playbackRate = __esm({
56056
+ "../core/dist/runtime/playbackRate.js"() {
56057
+ "use strict";
56058
+ init_startExpression();
56059
+ }
56060
+ });
56061
+
56017
56062
  // ../core/dist/compiler/timingCompiler.js
56018
56063
  function shouldClampMediaDuration(declaredDuration, maxDuration) {
56019
56064
  return declaredDuration > maxDuration + MEDIA_DURATION_CLAMP_EPSILON_SECONDS;
@@ -56031,6 +56076,11 @@ function hasAttr(tag, attr2) {
56031
56076
  function injectAttr(tag, attr2, value) {
56032
56077
  return tag.replace(/>$/, ` ${attr2}="${value}">`);
56033
56078
  }
56079
+ function setAttr(tag, attr2, value) {
56080
+ if (!hasAttr(tag, attr2))
56081
+ return injectAttr(tag, attr2, value);
56082
+ return tag.replace(new RegExp(`(${attr2}=["'])[^"']*(["'])`), `$1${value}$2`);
56083
+ }
56034
56084
  function maskInertRegions(html) {
56035
56085
  const stash = [];
56036
56086
  const masked = html.replace(INERT_REGION_RE, (region) => {
@@ -56059,12 +56109,14 @@ function compileTag(tag, isVideo2, generateId) {
56059
56109
  startStr = "0";
56060
56110
  }
56061
56111
  const start = parseFloat(startStr);
56062
- const mediaStartStr = getAttr(result, "data-media-start");
56063
- const mediaStart = mediaStartStr ? parseFloat(mediaStartStr) : 0;
56112
+ const attrReader = { getAttribute: (name) => getAttr(result, name) };
56113
+ const mediaStart = readMediaStart(attrReader);
56114
+ const playbackRate = readElementPlaybackRate(attrReader);
56064
56115
  if (!hasAttr(result, "data-end")) {
56065
56116
  const durationStr = getAttr(result, "data-duration");
56066
- if (durationStr !== null) {
56067
- const end = start + parseFloat(durationStr);
56117
+ const duration = parseStrictFiniteTimingNumber(durationStr);
56118
+ if (duration != null) {
56119
+ const end = start + duration;
56068
56120
  result = injectAttr(result, "data-end", String(end));
56069
56121
  } else if (id) {
56070
56122
  unresolved = {
@@ -56072,7 +56124,8 @@ function compileTag(tag, isVideo2, generateId) {
56072
56124
  tagName: isVideo2 ? "video" : "audio",
56073
56125
  src: getAttr(result, "src") ?? void 0,
56074
56126
  start,
56075
- mediaStart
56127
+ mediaStart,
56128
+ playbackRate
56076
56129
  };
56077
56130
  }
56078
56131
  }
@@ -56113,6 +56166,7 @@ function compileTimingAttrs(html) {
56113
56166
  tagName: "div",
56114
56167
  start: startStr ? parseFloat(startStr) : 0,
56115
56168
  mediaStart: 0,
56169
+ playbackRate: 1,
56116
56170
  compositionSrc: compositionSrc ?? void 0
56117
56171
  });
56118
56172
  }
@@ -56125,8 +56179,8 @@ function injectDurations(html, resolutions) {
56125
56179
  const idPattern = new RegExp(`(<[^>]*id=["']${escapeRegex2(id)}["'][^>]*>)`, "gi");
56126
56180
  html = html.replace(idPattern, (tag) => {
56127
56181
  let result = tag;
56128
- if (!hasAttr(result, "data-duration")) {
56129
- result = injectAttr(result, "data-duration", String(duration));
56182
+ if (parseStrictFiniteTimingNumber(getAttr(result, "data-duration")) == null) {
56183
+ result = setAttr(result, "data-duration", String(duration));
56130
56184
  }
56131
56185
  if (!hasAttr(result, "data-end")) {
56132
56186
  const startStr = getAttr(result, "data-start");
@@ -56152,19 +56206,20 @@ function extractResolvedMedia(html) {
56152
56206
  const durationStr = getAttr(tag, "data-duration");
56153
56207
  if (!id || durationStr === null)
56154
56208
  continue;
56155
- const duration = parseFloat(durationStr);
56156
- if (!Number.isFinite(duration) || duration <= 0)
56209
+ const duration = parseStrictFiniteTimingNumber(durationStr);
56210
+ if (duration == null || duration <= 0)
56157
56211
  continue;
56158
56212
  const isVideo2 = /^<video/i.test(tag);
56159
56213
  const startStr = getAttr(tag, "data-start");
56160
- const mediaStartStr = getAttr(tag, "data-media-start");
56214
+ const attrReader = { getAttribute: (name) => getAttr(tag, name) };
56161
56215
  resolved2.push({
56162
56216
  id,
56163
56217
  tagName: isVideo2 ? "video" : "audio",
56164
56218
  src: getAttr(tag, "src") ?? void 0,
56165
56219
  start: startStr !== null ? parseFloat(startStr) : 0,
56166
56220
  duration,
56167
- mediaStart: mediaStartStr ? parseFloat(mediaStartStr) : 0,
56221
+ mediaStart: readMediaStart(attrReader),
56222
+ playbackRate: readElementPlaybackRate(attrReader),
56168
56223
  loop: hasAttr(tag, "loop")
56169
56224
  });
56170
56225
  }
@@ -56187,6 +56242,7 @@ var MEDIA_DURATION_CLAMP_EPSILON_SECONDS, INERT_REGION_RE;
56187
56242
  var init_timingCompiler = __esm({
56188
56243
  "../core/dist/compiler/timingCompiler.js"() {
56189
56244
  "use strict";
56245
+ init_playbackRate();
56190
56246
  MEDIA_DURATION_CLAMP_EPSILON_SECONDS = 0.05;
56191
56247
  INERT_REGION_RE = /<!--[\s\S]*?-->|<script\b[\s\S]*?<\/script\s*>|<style\b[\s\S]*?<\/style\s*>/gi;
56192
56248
  }
@@ -56227,13 +56283,13 @@ function rewriteAssetPath(compSrcPath, relativePath, assetExists) {
56227
56283
  const normalized2 = resolve2("/", resolved2).slice(1);
56228
56284
  return normalized2;
56229
56285
  }
56230
- function rewriteAssetPaths(elements, compSrcPath, getAttr2, setAttr, assetExists) {
56286
+ function rewriteAssetPaths(elements, compSrcPath, getAttr2, setAttr2, assetExists) {
56231
56287
  for (const el of elements) {
56232
56288
  for (const attr2 of PATH_ATTRS) {
56233
56289
  const val = (getAttr2(el, attr2) || "").trim();
56234
56290
  const rewritten = rewriteAssetPath(compSrcPath, val, assetExists);
56235
56291
  if (rewritten !== val) {
56236
- setAttr(el, attr2, rewritten);
56292
+ setAttr2(el, attr2, rewritten);
56237
56293
  }
56238
56294
  }
56239
56295
  }
@@ -58602,7 +58658,7 @@ var RUNTIME_IIFE;
58602
58658
  var init_runtime_inline = __esm({
58603
58659
  "../core/dist/generated/runtime-inline.js"() {
58604
58660
  "use strict";
58605
- RUNTIME_IIFE = '"use strict";(()=>{var Uf=Object.create;var Ai=Object.defineProperty;var Wf=Object.getOwnPropertyDescriptor;var Vf=Object.getOwnPropertyNames;var zf=Object.getPrototypeOf,qf=Object.prototype.hasOwnProperty;var $f=(e,t,n)=>t in e?Ai(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ne=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var jf=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Vf(t))!qf.call(e,i)&&i!==n&&Ai(e,i,{get:()=>t[i],enumerable:!(r=Wf(t,i))||r.enumerable});return e};var Kf=(e,t,n)=>(n=e!=null?Uf(zf(e)):{},jf(t||!e||!e.__esModule?Ai(n,"default",{value:e,enumerable:!0}):n,e));var be=(e,t,n)=>$f(e,typeof t!="symbol"?t+"":t,n);var Gl=ne((wS,xo)=>{var Q=String,Hl=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}};xo.exports=Hl();xo.exports.createColors=Hl});var yo=ne(()=>{});var Tr=ne((RS,Wl)=>{"use strict";var Bl=Gl(),Ul=yo(),wn=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=Bl.isColorSupported);let r=c=>c,i=c=>c,o=c=>c;if(t){let{bold:c,gray:m,red:f}=Bl.createColors(!0);i=p=>c(f(p)),r=p=>m(p),Ul&&(o=p=>Ul(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 S=20,y=Math.max(0,this.column-S),_=Math.max(this.column+S,this.endColumn+S),R=c.slice(y,_),T=r(p.replace(/\\d/g," "))+c.slice(0,Math.min(this.column-1,S-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}};Wl.exports=wn;wn.default=wn});var So=ne((kS,zl)=>{"use strict";var u0=/(<)(\\/?style\\b)/gi,c0=/(<)(!--)/g;function ut(e){return typeof e!="string"||!e.includes("<")?e:e.replace(u0,"\\\\3c $2").replace(c0,"\\\\3c $2")}var Vl={after:`\n`,beforeClose:`\n`,beforeComment:`\n`,beforeDecl:`\n`,beforeOpen:" ",beforeRule:`\n`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function d0(e){return e[0].toUpperCase()+e.slice(1)}var _n=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(ut(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(ut(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(ut(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:ut(s)),this.stringify(l,r!==a||i)}}comment(t){let n=this.raw(t,"left","commentLeft"),r=this.raw(t,"right","commentRight");this.builder(ut("/*"+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(ut(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 Vl[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"+d0(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=Vl[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:ut(n))}}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(ut(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)}};zl.exports=_n;_n.default=_n});var Tn=ne((FS,ql)=>{"use strict";var f0=So();function vo(e,t){new f0(t).stringify(e)}ql.exports=vo;vo.default=vo});var Rr=ne((MS,Eo)=>{"use strict";Eo.exports.isClean=Symbol("isClean");Eo.exports.my=Symbol("my")});var Fn=ne((NS,$l)=>{"use strict";var m0=Tr(),p0=So(),h0=Tn(),{isClean:Rn,my:g0}=Rr();function Ao(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=>Ao(a,n)):(o==="object"&&i!==null&&(i=Ao(i)),n[r]=i)}return n}function Ze(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 kn=class{get proxyOf(){return this}constructor(t={}){this.raws={},this[Rn]=!1,this[g0]=!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=Ao(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 m0(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[Rn]=!0}markDirty(){if(this[Rn]){this[Rn]=!1;let t=this;for(;t=t.parent;)t[Rn]=!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(Ze(r,this.source.start),Ze(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=Ze(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:Ze(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:Ze(n,this.source.end)+1}:{column:r.column+1,line:r.line,offset:r.offset+1};if(t.word){let a=n.slice(Ze(n,this.source.start),Ze(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:Ze(n,t.start)}:t.index&&(r=this.positionInside(t.index)),t.end?i={column:t.end.column,line:t.end.line,offset:Ze(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 p0().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=h0){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)}};$l.exports=kn;kn.default=kn});var Nn=ne((LS,jl)=>{"use strict";var b0=Fn(),Mn=class extends b0{constructor(t){super(t),this.type="comment"}};jl.exports=Mn;Mn.default=Mn});var Dn=ne((DS,Kl)=>{"use strict";var x0=Fn(),Ln=class extends x0{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"}};Kl.exports=Ln;Ln.default=Ln});var ct=ne((IS,ru)=>{"use strict";var Yl=Nn(),Xl=Dn(),y0=Fn(),{isClean:Jl,my:Ql}=Rr(),Co,Zl,eu,wo;function tu(e){return e.map(t=>(t.nodes&&(t.nodes=tu(t.nodes)),delete t.source,t))}function nu(e){if(e[Jl]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)nu(t)}var We=class e extends y0{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=tu(Zl(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 Xl(t)]}else if(t.selector||t.selectors)t=[new wo(t)];else if(t.name)t=[new Co(t)];else if(t.text)t=[new Yl(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[Ql]||e.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[Jl]&&nu(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)}))}};We.registerParse=e=>{Zl=e};We.registerRule=e=>{wo=e};We.registerAtRule=e=>{Co=e};We.registerRoot=e=>{eu=e};ru.exports=We;We.default=We;We.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,Co.prototype):e.type==="rule"?Object.setPrototypeOf(e,wo.prototype):e.type==="decl"?Object.setPrototypeOf(e,Xl.prototype):e.type==="comment"?Object.setPrototypeOf(e,Yl.prototype):e.type==="root"&&Object.setPrototypeOf(e,eu.prototype),e[Ql]=!0,e.nodes&&e.nodes.forEach(t=>{We.rebuild(t)})}});var kr=ne((PS,ou)=>{"use strict";var iu=ct(),Vt=class extends iu{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)}};ou.exports=Vt;Vt.default=Vt;iu.registerAtRule(Vt)});var Fr=ne((OS,lu)=>{"use strict";var S0=ct(),au,su,Et=class extends S0{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new au(new su,this,t).stringify()}};Et.registerLazyResult=e=>{au=e};Et.registerProcessor=e=>{su=e};lu.exports=Et;Et.default=Et});var cu=ne((HS,uu)=>{var v0="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},A0=(e=21)=>{let t="",n=e|0;for(;n--;)t+=v0[Math.random()*64|0];return t};uu.exports={nanoid:A0,customAlphabet:E0}});var Mr=ne(()=>{});var Nr=ne(()=>{});var _o=ne(()=>{});var du=ne(()=>{});var Ro=ne((jS,pu)=>{"use strict";var{existsSync:C0,readFileSync:w0}=du(),{dirname:To,join:_0}=Mr(),{SourceMapConsumer:fu,SourceMapGenerator:mu}=Nr();function T0(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var In=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=To(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 T0(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=To(t),C0(t)))return this.mapFile=t,w0(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 mu.fromSourceMap(n).toString();if(n instanceof mu)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=_0(To(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)}};pu.exports=In;In.default=In});var Pn=ne((KS,yu)=>{"use strict";var{nanoid:R0}=cu(),{isAbsolute:Mo,resolve:No}=Mr(),{SourceMapConsumer:k0,SourceMapGenerator:F0}=Nr(),{fileURLToPath:hu,pathToFileURL:Lr}=_o(),gu=Tr(),M0=Ro(),ko=yo(),Fo=Symbol("lineToIndexCache"),N0=!!(k0&&F0),bu=!!(No&&Mo);function xu(e){if(e[Fo])return e[Fo];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[Fo]=n,n}var zt=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&&(!bu||/^\\w+:\\/\\//.test(n.from)||Mo(n.from)?this.file=n.from:this.file=No(n.from)),bu&&N0){let r=new M0(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 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 gu(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 gu(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&&(Lr&&(u.input.url=Lr(this.file).toString()),u.input.file=this.file),u}fromLineAndColumn(t,n){return xu(this)[t-1]+n-1}fromOffset(t){let n=xu(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:No(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;Mo(a.source)?s=Lr(a.source):s=new URL(a.source,this.map.consumer().sourceRoot||Lr(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(hu)u.file=hu(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}};yu.exports=zt;zt.default=zt;ko&&ko.registerInput&&ko.registerInput(zt)});var qt=ne((YS,Au)=>{"use strict";var Su=ct(),vu,Eu,dt=class extends Su{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 vu(new Eu,this,t).stringify()}};dt.registerLazyResult=e=>{vu=e};dt.registerProcessor=e=>{Eu=e};Au.exports=dt;dt.default=dt;Su.registerRoot(dt)});var Lo=ne((XS,Cu)=>{"use strict";var On={comma(e){return On.split(e,[","],!0)},space(e){let t=[" ",`\n`," "];return On.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}};Cu.exports=On;On.default=On});var Dr=ne((JS,_u)=>{"use strict";var wu=ct(),L0=Lo(),$t=class extends wu{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=[])}};_u.exports=$t;$t.default=$t;wu.registerRule($t)});var Ru=ne((QS,Tu)=>{"use strict";var D0=kr(),I0=Nn(),P0=Dn(),O0=Pn(),H0=Ro(),G0=qt(),B0=Dr();function Hn(e,t){if(Array.isArray(e))return e.map(i=>Hn(i));let{inputs:n,...r}=e;if(n){t=[];for(let i of n){let o={...i,__proto__:O0.prototype};o.map&&(o.map={...o.map,__proto__:H0.prototype}),t.push(o)}}if(r.nodes&&(r.nodes=e.nodes.map(i=>Hn(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 G0(r);if(r.type==="decl")return new P0(r);if(r.type==="rule")return new B0(r);if(r.type==="comment")return new I0(r);if(r.type==="atrule")return new D0(r);throw new Error("Unknown node type: "+e.type)}Tu.exports=Hn;Hn.default=Hn});var Io=ne((ZS,Du)=>{"use strict";var{dirname:Ir,relative:Fu,resolve:Mu,sep:Nu}=Mr(),{SourceMapConsumer:Lu,SourceMapGenerator:Pr}=Nr(),{pathToFileURL:ku}=_o(),U0=Pn(),W0=!!(Lu&&Pr),V0=!!(Ir&&Mu&&Fu&&Nu),Do=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||Ir(t.file),i;this.mapOpts.sourcesContent===!1?(i=new Lu(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(),V0&&W0&&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=Pr.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new Pr({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 Pr({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?Ir(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Ir(Mu(r,this.mapOpts.annotation)));let i=Fu(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 U0(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;Nu==="\\\\"&&(t=t.replace(/\\\\/g,"/"));let r=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,r),r}};Du.exports=Do});var Ou=ne((ev,Pu)=>{"use strict";var Or=/[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g,Hr=/[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g,z0=/.[\\r\\n"\'(/\\\\]/,Iu=/[\\da-f]/i;Pu.exports=function(t,n={}){let r=t.css.valueOf(),i=n.ignoreErrors,o,a,l,s,u,c,m,f,p,b,S=r.length,y=0,_=[],R=[],T=-1;function F(){return y}function N(w){throw t.error("Unclosed "+w,y)}function A(){return R.length===0&&y>=S}function v(w){if(R.length)return R.pop();if(y>=S)return;let M=w?w.ignoreUnclosed:!1;switch(o=r.charCodeAt(y),o){case 10:case 32:case 9:case 13:case 12:{s=y;do s+=1,o=r.charCodeAt(s);while(o===32||o===10||o===9||o===13||o===12);c=["space",r.slice(y,s)],y=s-1;break}case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let L=String.fromCharCode(o);c=[L,L,y];break}case 40:{if(b=_.length?_.pop()[1]:"",p=r.charCodeAt(y+1),b==="url"&&p!==39&&p!==34&&p!==32&&p!==10&&p!==9&&p!==12&&p!==13){s=y;do{if(m=!1,s=r.indexOf(")",s+1),s===-1)if(i||M){s=y;break}else N("bracket");for(f=s;r.charCodeAt(f-1)===92;)f-=1,m=!m}while(m);c=["brackets",r.slice(y,s+1),y,s],y=s}else y<=T?c=["(","(",y]:(s=r.indexOf(")",y+1),a=r.slice(y,s+1),s===-1||z0.test(a)?(T=s===-1?S:s,c=["(","(",y]):(c=["brackets",a,y,s],y=s));break}case 39:case 34:{u=o===39?"\'":\'"\',s=y;do{if(m=!1,s=r.indexOf(u,s+1),s===-1)if(i||M){s=y+1;break}else N("string");for(f=s;r.charCodeAt(f-1)===92;)f-=1,m=!m}while(m);c=["string",r.slice(y,s+1),y,s],y=s;break}case 64:{Or.lastIndex=y+1,Or.test(r),Or.lastIndex===0?s=r.length-1:s=Or.lastIndex-2,c=["at-word",r.slice(y,s+1),y,s],y=s;break}case 92:{for(s=y,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,Iu.test(r.charAt(s)))){for(;Iu.test(r.charAt(s+1));)s+=1;r.charCodeAt(s+1)===32&&(s+=1)}c=["word",r.slice(y,s+1),y,s],y=s;break}default:{o===47&&r.charCodeAt(y+1)===42?(s=r.indexOf("*/",y+2)+1,s===0&&(i||M?s=r.length:N("comment")),c=["comment",r.slice(y,s+1),y,s],y=s):(Hr.lastIndex=y+1,Hr.test(r),Hr.lastIndex===0?s=r.length-1:s=Hr.lastIndex-2,c=["word",r.slice(y,s+1),y,s],_.push(c),y=s);break}}return y++,c}function E(w){R.push(w)}return{back:E,endOfFile:A,nextToken:v,position:F}}});var Uu=ne((tv,Bu)=>{"use strict";var q0=kr(),$0=Nn(),j0=Dn(),K0=qt(),Hu=Dr(),Y0=Ou(),Gu={empty:!0,space:!0};function X0(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var Po=class{constructor(t){this.input=t,this.root=new K0,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 q0;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 $0;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=Y0(this.input)}decl(t,n){let r=new j0;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]||X0(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 Hu;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",!Gu[m]&&!Gu[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 Hu;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})}};Bu.exports=Po});var Br=ne((nv,Wu)=>{"use strict";var J0=ct(),Q0=Pn(),Z0=Uu();function Gr(e,t){let n=new Q0(e,t),r=new Z0(n);try{r.parse()}catch(i){throw i}return r.root}Wu.exports=Gr;Gr.default=Gr;J0.registerParse(Gr)});var Oo=ne((rv,Vu)=>{"use strict";var Gn=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}};Vu.exports=Gn;Gn.default=Gn});var Ur=ne((iv,zu)=>{"use strict";var eh=Oo(),Bn=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 eh(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(t=>t.type==="warning")}};zu.exports=Bn;Bn.default=Bn});var Ho=ne((ov,$u)=>{"use strict";var qu={};$u.exports=function(t){qu[t]||(qu[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))}});var Uo=ne((sv,Xu)=>{"use strict";var th=ct(),nh=Fr(),rh=Io(),ih=Br(),ju=Ur(),oh=qt(),ah=Tn(),{isClean:Ye,my:sh}=Rr(),av=Ho(),lh={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},uh={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},ch={Once:!0,postcssPlugin:!0,prepare:!0},jt=0;function Un(e){return typeof e=="object"&&typeof e.then=="function"}function Yu(e){let t=!1,n=lh[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,jt,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,jt,n+"Exit"]:[n,n+"Exit"]}function Ku(e){let t;return e.type==="document"?t=["Document",jt,"DocumentExit"]:e.type==="root"?t=["Root",jt,"RootExit"]:t=Yu(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Go(e){return e[Ye]=!1,e.nodes&&e.nodes.forEach(t=>Go(t)),e}var Bo={},ft=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=Go(n);else if(n instanceof e||n instanceof ju)i=Go(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=ih;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[sh]&&th.rebuild(i)}this.result=new ju(t,i,r),this.helpers={...Bo,postcss:Bo,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(!uh[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${n.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!ch[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(Un(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=[Ku(t)];for(;n.length>0;){let r=this.visitTick(n);if(Un(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 Un(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=ah;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 rh(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(Un(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(Un(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(Ku(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===jt){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=Yu(t);for(let r of n)if(r===jt)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()}};ft.registerPostcss=e=>{Bo=e};Xu.exports=ft;ft.default=ft;oh.registerLazyResult(ft);nh.registerLazyResult(ft)});var Qu=ne((uv,Ju)=>{"use strict";var dh=Io(),fh=Br(),mh=Ur(),ph=Tn(),lv=Ho(),Wn=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=fh;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=ph;this.result=new mh(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 dh(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[]}};Ju.exports=Wn;Wn.default=Wn});var ec=ne((cv,Zu)=>{"use strict";var hh=Fr(),gh=Uo(),bh=Qu(),xh=qt(),At=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 bh(this,t,n):new gh(this,t,n)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}};Zu.exports=At;At.default=At;xh.registerProcessor(At);hh.registerProcessor(At)});var lc=ne((dv,sc)=>{"use strict";var tc=kr(),nc=Nn(),yh=ct(),Sh=Tr(),rc=Dn(),ic=Fr(),vh=Ru(),Eh=Pn(),Ah=Uo(),Ch=Lo(),wh=Fn(),_h=Br(),Wo=ec(),Th=Ur(),oc=qt(),ac=Dr(),Rh=Tn(),kh=Oo();function ue(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Wo(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 Wo().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=Rh;ue.parse=_h;ue.fromJSON=vh;ue.list=Ch;ue.comment=e=>new nc(e);ue.atRule=e=>new tc(e);ue.decl=e=>new rc(e);ue.rule=e=>new ac(e);ue.root=e=>new oc(e);ue.document=e=>new ic(e);ue.CssSyntaxError=Sh;ue.Declaration=rc;ue.Container=yh;ue.Processor=Wo;ue.Document=ic;ue.Comment=nc;ue.Warning=kh;ue.AtRule=tc;ue.Result=Th;ue.Input=Eh;ue.Rule=ac;ue.Root=oc;ue.Node=wh;Ah.registerPostcss(ue);sc.exports=ue;ue.default=ue});function or(){return globalThis}function D(e,t){if(typeof window>"u")return;let n=or(),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 Yf=["seconds-time","rational-fps","seek-keep-playing","composition-manifest-v1"];function Xf(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 Jf(e){let t=Number.isFinite(e)&&e>0?e:30,n=Number.isInteger(t)?1:1e6,r=Math.round(t*n),i=Xf(r,n);return{numerator:r/i,denominator:n/i}}function Ci(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 ar(e){return{protocolVersion:1,capabilities:Yf,fps:Jf(e)}}function Qf(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function Ya(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=Ci(n.fps);return r===null||!Qf(n.capabilities)?{status:"unsupported",code:"invalid_protocol_metadata",receivedVersion:n.protocolVersion}:{status:"supported",fps:r,metadata:n}}var Xa=30;function Ja(e){Xa=Number.isFinite(e)&&e>0?e:30}function ye(e){try{window.parent.postMessage({...e,...ar(Xa)},"*")}catch(t){D("bridge.postMessage",t)}}var Zf={play:(e,t)=>t.onPlay(),pause:(e,t)=>t.onPause(),"stop-media":(e,t)=>t.onStopMedia(),seek:(e,t)=>t.onSeek(em(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=>nm(e)};function em(e,t){let n=Number(e.timeSeconds);if(Number.isFinite(n))return Math.max(0,n);let i=Ci(e.fps)??t.getCanonicalFps();return Math.max(0,Number(e.frame??0))/i}function tm(e){let t=Ya(e);return t.status!=="unsupported"?!1:(ye({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 nm(e){let t=e.selectors,n=e.duration||800;t&&rm(t,n)}function Qa(e){let t=n=>{let r=n.data;if(!r||r.source!=="hf-parent"||r.type!=="control"||tm(r))return;let i=r.action;if(typeof i!="string")return;let o=Zf[i];o&&o(r,e)};return window.addEventListener("message",t),ye({source:"hf-preview",type:"ready"}),t}function rm(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){D("bridge.flashElements.querySelector",r)}}var wi=null;function Za(e){wi=e}function Ne(e,t){if(wi)try{wi({source:"hf-preview",type:"analytics",event:e,properties:t??{}})}catch(n){D("runtime.analytics.site1",n)}}function im(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 Ft(e){return`--${im(e)}`}function es(e){let t=new Map;for(let n of e){let r=Ft(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 ns(){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,sn(i));let n=lr(),r={...t,...n};for(let i of e)Ti(i,r);return r}var ts=new Set;function rs(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 om(e,t){return t?.trim()||e.getAttribute("data-composition-id")?.trim()||e.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")?.trim()||"composition"}function am(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 sm(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=am(e);return r.length===0||r.some(i=>String(i)===String(n))?null:{id:e.id,value:n,allowed:r}}function Ti(e,t,n){if(!e)return;let r=rs(e);if(r.length===0)return;let i=om(e,n);for(let o of r){let a=sm(o,t);if(!a)continue;let l=`${i}|${a.id}|${String(a.value)}`;if(ts.has(l))continue;ts.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 sn(e){let t={};for(let n of rs(e))typeof n.id!="string"||!("default"in n)||(t[n.id]=n.default);return t}var _i="data-hf-css-vars";function sr(e){return"style"in e&&typeof e.style?.setProperty=="function"}function Ri(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=Ft(r);e.style.setProperty(o,String(i)),n.push(o)}n.length>0&&e.setAttribute(_i,n.join(" "))}function is(e,t,n){let r={};for(let[i,o]of Object.entries(t)){let a=Ft(i);((sr(e)?e.style.getPropertyValue(a):"")||(n?n.getComputedStyle(e).getPropertyValue(a):"")).trim()===""&&(r[i]=o)}return r}function os(e){if(!sr(e))return;let t=e.getAttribute(_i);if(t){for(let n of t.split(" "))n.startsWith("--")&&e.style.removeProperty(n);e.removeAttribute(_i)}}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=lr(),r=[];for(let i of t)r.push(...lm(i,n,e.defaultView));for(let i of es(r))console.warn(`composition variables ${i.join(", ")} collapse to the same CSS property ${Ft(i[0]??"")} \\u2014 rename one to avoid cross-talk`)}function lm(e,t,n){if(!sr(e))return[];let r=sn(e),i={};for(let[o,a]of Object.entries(r)){if(o in t)continue;let l=Ft(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 Ri(e,i),Object.keys(r)}function ss(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 lr(){if(typeof window>"u")return{};let e=window.__hfVariables;return!e||typeof e!="object"||Array.isArray(e)?{}:e}function ls(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){D("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){D("runtime.adapters.css.site1",f)}try{m.pause()}catch(f){D("runtime.adapters.css.site2",f)}}},a=u=>{for(let c of u)try{c.play()}catch(m){D("runtime.adapters.css.site3",m)}},l=u=>{for(let c of u)try{c.pause()}catch(m){D("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 us(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 cs(){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){D("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){D("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){D("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){D("runtime.adapters.animejs.site4",n)}},revert:()=>{}}}function fs(){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){D("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(ki(r))r.goToAndStop(t*1e3,!1);else if(Fi(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){D("runtime.adapters.lottie.site2",i)}},pause:()=>{let e=window.__hfLottie;if(!(!e||e.length===0))for(let t of e)try{(ki(t)||Fi(t))&&t.pause()}catch(n){D("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=um(r)}catch(o){D("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 um(e){return ki(e)?ds(e.totalFrames,e.frameRate):Fi(e)?Number.isFinite(e.duration)&&(e.duration??0)>0?e.duration??null:ds(e.totalFrames,e.frameRate):null}function ki(e){return typeof e=="object"&&e!==null&&typeof e.goToAndStop=="function"}function Fi(e){return typeof e=="object"&&e!==null&&typeof e.pause=="function"&&("totalFrames"in e||"duration"in e)}var Mi=-1,ur=new Set,Mt,Ni=0;function ms(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){D("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}));ur.add(i),i.then(o=>{ur.delete(i)&&o.status==="rejected"&&Mt===void 0&&(Mt={reason:o.reason})})}function cr(e){e!==Mi&&(Mi=e,ms(e))}function dr(e){Mi=e,ms(e)}function ps(){return Ni>0}async function Li(){Ni+=1;let e=Mt;try{for(await Promise.resolve();ur.size>0;){let r=(await Promise.all([...ur])).find(i=>i.status==="rejected");e===void 0&&r?.status==="rejected"&&(e={reason:r.reason})}let t=Mt;if(e===void 0&&(e=t),Mt===t&&(Mt=void 0),e)throw e.reason}finally{Ni-=1}}function hs(){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,cr(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 gs(){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 xs(){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 ys(){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 Ss(){return $e({name:"d3",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfD3;return Array.isArray(e)?e:[]},waitFor:e=>e.end()})}var cm=250;function vs(){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&&(ps()||(window.__hfTypegpuTime=e,dr(e)))},cm))};return{name:"typegpu",discover:()=>{},seek:o=>{e=Math.max(0,Number(o.time)||0),t=e,window.__hfTypegpuTime=e,cr(e)},pause:()=>{e==null&&(e=Math.max(0,t)),i()},play:()=>{r(),e=null},revert:()=>{r(),e=null,t=0}}}function Es(e){let t=e.nextElementSibling;if(t instanceof HTMLImageElement&&t.classList.contains("__render_frame__")&&t.complete&&t.naturalWidth>0)return t;if(e.id){let n=document.getElementById(`__render_frame_${e.id}__`);if(n instanceof HTMLImageElement&&n.complete&&n.naturalWidth>0)return n}return null}function As(){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=Es(n.source);if(o)return t.call(this,{...n,source:o},r,i)}return t.call(this,n,r,i)}}function Cs(){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=Es(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=y=>{let _=Number(y.currentTime);return Number.isFinite(_)&&_>0?_:0},c=(y,_)=>_<=0?y:y>=_?Math.max(0,y-_):y,m=(y,_)=>{let R=l.get(y);if(R)return R;let T={compositionTimeMs:_,animationTimeMs:e?c(u(y),_):u(y)};return l.set(y,T),T},f=(y,_)=>{if(!a.has(y)){a.add(y);let R=()=>{a.delete(y)};try{y.addEventListener("finish",R,{once:!0}),y.addEventListener("cancel",R,{once:!0})}catch(T){D("runtime.adapters.waapi.site4",T)}}m(y,_)},p=(y,_)=>{for(let R of y)f(R,_)},b=()=>{if(n||typeof Element>"u")return;let y=Element.prototype;if(typeof y.animate!="function"||y.__hfOriginalAnimate)return;let _=y.animate;try{Object.defineProperty(y,"__hfOriginalAnimate",{value:_,configurable:!0});let R=function(...T){let F=_.apply(this,T);return f(F,t),F};y.animate=R,r=y,i=_,o=R,n=!0}catch{}},S=y=>{let _=null;try{_=y.effect?.getComputedTiming?.()??null}catch(F){D("runtime.adapters.waapi.site4",F)}if(!_)return{};let R=Number(_.endTime);return Number.isFinite(R)?{endSeconds:(l.get(y)?.compositionTimeMs??0)/1e3+R/1e3}:{unbounded:!0}};return{name:"waapi",discover:()=>{e=!0,b(),p(s(),t)},seek:y=>{let _=Math.max(0,(Number(y.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),F=T.animationTimeMs+Math.max(0,_-T.compositionTimeMs);try{R.currentTime=F}catch(N){D("runtime.adapters.waapi.site1",N)}try{R.pause()}catch(N){D("runtime.adapters.waapi.site2",N)}}},pause:()=>{e||p(s(),t);for(let y of a)try{y.pause()}catch(_){D("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(y){D("runtime.adapters.waapi.site5",y)}r=void 0,i=void 0,o=void 0,n=!1},getInferredDurationSeconds:()=>{let y=0;for(let _ of s()){let R=S(_);R.endSeconds!=null&&(y=Math.max(y,R.endSeconds))}return y>0?y:null}}}function dm(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:Math.max(0,Math.min(1,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:Math.max(0,Math.min(1,n))}),i}function _s(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 fm(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 fr(e){let t=Number.parseFloat(e??"");return Number.isFinite(t)?t:void 0}function Ts(e,t){let n=fr(e.dataset.start)??0,r=fr(e.dataset.end),i=fr(e.dataset.duration),o=t;i!==void 0&&i>0?o=n+i:r!==void 0&&r>n&&(o=r);let a=fr(e.dataset.volume)??1,l=Math.max(0,Math.min(1,a));return{start:n,end:o,staticVolume:l}}function mm(e,t,n,r){let{start:i,end:o,staticVolume:a}=Ts(e,n);e.volume=a;let l=1/Math.min(60,Math.max(1,r)),s=Math.max(0,i),u=Math.min(n,o),c=[],m;for(let p=s;p<=u+1e-6;p=Math.min(u,p+l)){t(p);let b=Number(e.volume);if(Number.isFinite(b)){let S=Math.max(0,Math.min(1,b)),y={time:Number(p.toFixed(6)),volume:Number(S.toFixed(6))};fm(c,m,y,p===u),m=y}if(p===u)break}return c.some(p=>Math.abs(p.volume-a)>1e-4)?c:null}function Rs(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=mm(e,o,n,60);if(Number.isFinite(a)&&o(a),l){let{start:s,staticVolume:u}=Ts(e,n),c=dm(l,s,u);c.length>0&&r.set(e,c)}}var pr="data-fx-chain",i1=pr.slice(5),ks=1,ln=(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}),Di=(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}),mr=(e=-40,t=40,n=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:e,max:t,step:.1,default:n,automatable:!0}),Fs={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."},Ms=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[mr(-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:[ln("frequency","Frequency",1e3),mr(-40,40,0),Di(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[ln("frequency","Frequency",200,20,2e3),mr(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[ln("frequency","Frequency",4e3,500,2e4),mr(-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:[ln("frequency","Cutoff",300,20,2e4),Di(.707),Fs],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies \\u2014 darkens or muffles a track.",params:[ln("frequency","Cutoff",8e3,100,2e4),Di(.707),Fs],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:"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"}],Ii=new Map(Ms.map(e=>[e.id,e]));function un(e){return Ii.get(e)}var o1=Ms.map(e=>e.id);function cn(e,t){let n=Ii.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 ot=class extends Error{constructor(t){super(t),this.name="AudioFxChainError"}};function Ns(e){let t;try{t=JSON.parse(e)}catch(i){throw new ot(`Chain file is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new ot("Chain file must be a JSON object.");let n=t;if(n.version!==ks)throw new ot(`Unsupported chain version: ${String(n.version)}`);if(!Array.isArray(n.nodes))throw new ot("Chain file is missing a `nodes` array.");let r=n.nodes.map((i,o)=>{if(typeof i!="object"||i===null)throw new ot(`Node ${o} is not an object.`);let a=i;if(typeof a.type!="string"||!Ii.has(a.type))throw new ot(`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:cn(a.type,a.params??void 0)}});return{version:ks,nodes:r}}function dn(e){return e.nodes.filter(t=>t.enabled!==!1)}var Nt="data-automation",l1=Nt.slice(5),hr=1,pm=512,Qe=class extends Error{constructor(t){super(t),this.name="AudioAutomationError"}},Lt="volume";function mn(e){if(e===Lt)return{kind:"volume"};let t=e.split(".");if(t.length===3&&t[0]==="fx"&&t[1]===hm){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 hm="preset";var gm={min:0,max:1,step:.01,unit:"",label:"Amount",scale:"linear",default:1},gr={min:0,max:1,step:.01,unit:"",label:"Volume",scale:"linear",default:1};function Pi(e,t){let n=mn(e);if(!n)return null;if(n.kind==="volume")return gr;if(n.kind==="preset")return t?.nodes.some(l=>l.fromPreset===n.presetId)?{...gm,label:`${n.presetId} \\xB7 Amount`}:null;let r=t?.nodes.find(a=>a.id===n.nodeId);if(!r)return null;let i=un(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 fn(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 bm(e){let t=fn(e);return t===null||t===0?0:Math.min(1,Math.max(-1,t))}function Ls(e,t){let n=fn(e),r=fn(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 xm(e){let t=bm(e?.curve),n=Ls(e?.viaX,e?.viaY);return{...t?{curve:t}:{},...n?{viaX:n.x,viaY:n.y}:{}}}function ym(e,t){let n=fn(e?.t),r=fn(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,...xm(e)}}function Ds(e,t){let n=e.map(i=>ym(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,pm)}function Sm(e){let t=[];for(let n of e.lanes){if(!mn(n.target))continue;let r=n.target===Lt?gr:null,i=Ds(n.points??[],r);i.length>0&&t.push({target:n.target,points:i})}return{version:hr,lanes:t}}function Is(e,t){let n=[];for(let r of e.lanes){let i=Pi(r.target,t);if(!i)continue;let o=Ds(r.points,i);o.length>0&&n.push({target:r.target,points:o})}return{version:hr,lanes:n}}function br(e){let t;try{t=JSON.parse(e)}catch(i){throw new Qe(`Automation is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new Qe("Automation must be a JSON object.");let n=t;if(n.version!==hr)throw new Qe(`Unsupported automation version: ${String(n.version)}`);if(!Array.isArray(n.lanes))throw new Qe("Automation is missing a `lanes` array.");let r=n.lanes.map((i,o)=>{if(typeof i!="object"||i===null)throw new Qe(`Lane ${o} is not an object.`);let a=i;if(typeof a.target!="string"||!mn(a.target))throw new Qe(`Lane ${o} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new Qe(`Lane ${o} is missing a \\`points\\` array.`);return{target:a.target,points:a.points}});return Sm({version:hr,lanes:r})}function vm(e,t){return t?Math.pow(e,Math.pow(2,2*t)):e}function Em(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 Am(e,t,n){let{cx:r,cy:i,w:o}=Em(t,n),a=2-2*o,l=e*a-1+2*o*r,s=-e*a-2*o*r,u=Cm(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 Cm(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 wm(e,t){let n=Ls(t.viaX,t.viaY);return n?Am(Math.min(1,Math.max(0,e)),n.x,n.y):vm(e,t.curve)}function _m(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 pn(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:_m(s.v,u.v,wm((t-s.t)/c,s),n)}function Ps(e){return e.points.length<=1||e.points.every(t=>t.v===e.points[0].v)}function Os(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]=pn(e,t+l*s/(o-1),i);return a}var xr=new Map,Tm=64;function Rm(e){let t=xr.get(e);if(t!==void 0)return t;let n=null;try{n=br(e).lanes.find(r=>r.target===Lt)??null}catch{n=null}return xr.size>Tm&&xr.clear(),xr.set(e,n),n}function Hs(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(Nt):null)??"";if(!n)return null;let r=Rm(n);return!r||r.points.length===0?null:pn(r,t)}function Gs(e){return Number.isFinite(e)&&e>0?Math.max(.1,Math.min(5,e)):1}function je(e){let t=Number.parseFloat(e.getAttribute("data-playback-rate")??""),n=Number.isFinite(t)&&t>0?t:e instanceof HTMLMediaElement?e.defaultPlaybackRate:1;return Gs(n)}function Pt(e){let t=Number.parseFloat(e.getAttribute("data-playback-start")??e.getAttribute("data-media-start")??"");return Number.isFinite(t)&&t>=0?t:0}function Bs(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 Us(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=Number.parseFloat(a.dataset.playbackStart??a.dataset.mediaStart??"0")||0,u=je(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?l+f:Number.POSITIVE_INFINITY,b=Number.parseFloat(a.dataset.volume??""),S={el:a,start:l,mediaStart:s,duration:Number.isFinite(f)&&f>0?f:Number.POSITIVE_INFINITY,end:p,volume:Number.isFinite(b)?b:null,playbackRate:u,loop:c,sourceDuration:m};r.push(S),a.tagName==="VIDEO"&&i.push(S),Number.isFinite(p)&&(o=Math.max(o,p))}return{timedMediaEls:n,mediaClips:r,videoClips:i,maxMediaEnd:o}}var Oi=new WeakMap,hn=new WeakMap,Hi=new WeakSet,It=new WeakSet;function km(e){if(It.has(e))return;It.add(e);let t=()=>It.delete(e);e.addEventListener("playing",t,{once:!0}),e.addEventListener("pause",t,{once:!0}),e.addEventListener("error",t,{once:!0})}var Fm=3;function Mm(e){return e.error!=null||e.networkState===Fm}var Gi=new WeakMap;function Dt(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function Bi(e){Oi.delete(e),hn.delete(e),Hi.delete(e),Gi.delete(e)}function Ws(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=o&&n.sourceDuration!=null&&i>=n.mediaStart&&i<n.sourceDuration;if(e.timeSeconds>=n.start&&e.timeSeconds<n.end&&i>=0&&(!r.ended||n.loop||a||l)){if(n.loop&&n.sourceDuration!=null&&n.sourceDuration>0){let j=n.sourceDuration-n.mediaStart;j>0&&i>=n.sourceDuration&&(i=n.mediaStart+(i-n.mediaStart)%j)}let u=Dt(e.userVolume??1),c=Dt(n.volume??1),m=Gi.get(r),f=Dt(r.volume),p,b=Hs(r,e.timeSeconds-n.start);if(b!==null)p=Dt(b);else if(n.volumeKeyframes&&n.volumeKeyframes.length>0){let j=e.timeSeconds-n.start;p=Dt(_s(n.volumeKeyframes,j))}else m===void 0||Math.abs(f-m)>1e-4?p=f:p=c;let S=Dt(p*u);r.volume=S,Gi.set(r,S),e.onElementVolume?.(r,S),(t||e.isWebAudioOwned?.(r))&&(r.muted=!0),r.preload!=="auto"&&(r.preload="auto");try{r.playbackRate=n.playbackRate*e.playbackRate}catch(j){D("runtime.media.site1",j)}let y=.04,_=2,R=r.currentTime||0,T=Math.abs(R-i),F=i-R,N=Oi.get(r);Oi.set(r,F);let A=N===void 0,v=!A&&Math.abs(F-N)>.5,E=T>3,w=a&&T>.001||r.ended&&l&&T>.001||T>.5&&(A||v||E),M=r.tagName==="VIDEO"&&!r.paused,L=N!==void 0&&Math.abs(F-N)<.004,H=!1;if(!M&&!w&&!A&&L&&T>y){let j=(hn.get(r)??0)+1;hn.set(r,j),j>=_&&(H=!0,hn.set(r,0))}else T<=y&&hn.set(r,0);let z=!M&&e.forceSync&&T>.02;if(w||H||z){if(!(r.tagName==="VIDEO"&&r.id&&!!document.getElementById(`__render_frame_${r.id}__`))){try{r.currentTime=i}catch(k){D("runtime.media.site2",k)}if(Math.abs(r.currentTime-i)>.5&&!Hi.has(r)){Hi.add(r),r.load();try{r.currentTime=i}catch(k){D("runtime.media.site3",k)}}}It.delete(r)}a?r.paused||r.pause():e.playing&&r.paused&&!It.has(r)&&!Mm(r)?(km(r),r.play().catch(j=>{It.delete(r),(j&&typeof j=="object"&&"name"in j?String(j.name??""):"")==="NotAllowedError"&&e.onAutoplayBlocked?.()})):!e.playing&&!r.paused&&r.pause();continue}Bi(r),r.paused||r.pause()}}var Nm="hf-proxy",Vs="runtime_media_proxy_fallback",zs="runtime_media_proxy_unavailable",gn=new WeakSet,qs=new WeakSet;function yr(e){return e.currentSrc||e.src}function Ui(e){return window.__HF_EXPORT_RENDER_SEEK_CONFIG?!0:e instanceof HTMLVideoElement&&!!e.id&&!!document.getElementById(`__render_frame_${e.id}__`)}function Wi(e){let t=yr(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 Lm(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 Dm(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 Vi(e,t){return t[e]??Lm(e,t)??Dm(e,t)}function Im(e,t){let n=new URL(e,document.baseURI);return n.searchParams.set(Nm,t?t.hasAlpha?"vp8":"h264":"auto"),n.href}var Pm={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 vt(e,t,n){if(qs.has(e))return;qs.add(e);let r=Pm[t];ye({source:"hf-preview",type:"diagnostic",code:zs,details:{asset:n,codecName:null,reason:t,note:r}}),console.info(`[hyperframes] ${zs}: "${n}" (${t}): ${r}`)}function zi(e,t=null,n="reactive"){if(gn.has(e))return;let r=yr(e),i;try{i=Im(r,t)}catch(l){D("runtime.mediaProxy.swap",l),vt(e,"invalid_source_url",r);return}gn.add(e),Bi(e),e.src=i,e.load();let o=t?.codecName??null;ye({source:"hf-preview",type:"diagnostic",code:Vs,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] ${Vs}: "${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 $s(e){if(Ui(e)||!(e instanceof HTMLVideoElement)||gn.has(e))return;let t=window.__HF_MEDIA_CODEC_MAP__;if(!t)return;let n=Wi(e);if(n===null)return;let r=Vi(n,t);if(!r||!r.browserHostile)return;let i=r.representativeMime?e.canPlayType(r.representativeMime):"";i==="probably"||i==="maybe"||zi(e,r,"proactive")}function js(e){if(Ui(e)||!(e instanceof HTMLVideoElement)||e.videoWidth!==0)return;let t=yr(e);if(gn.has(e)){vt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=Wi(e);if(r===null){vt(e,"cross_origin",t);return}let i=Vi(r,n);if(i&&!i.browserHostile){vt(e,"browser_safe_codec",t);return}zi(e,i,"reactive")}function Ks(e){if(Ui(e)||!(e instanceof HTMLVideoElement))return;let t=yr(e);if(gn.has(e)){vt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=Wi(e);if(r===null){vt(e,"cross_origin",t);return}let i=Vi(r,n);if(i&&!i.browserHostile){vt(e,"browser_safe_codec",t);return}zi(e,i,"tertiary")}var Se=class extends Error{constructor(n,r=null){super(r==null?n:`${n} at line ${r}`);be(this,"lineNumber");this.name="CubeLutParseError",this.lineNumber=r}},Om=[0,0,0],Hm=[1,1,1],Sr=64;function Gm(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 at(e,t){let n=Number(e);if(!Number.isFinite(n))throw new Se(`Invalid number "${e}"`,t);return n}function Ys(e,t,n){if(e.length!==3)throw new Se(`${t} expects three numbers`,n);return[at(e[0],n),at(e[1],n),at(e[2],n)]}function Xs(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 Bm(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 Um(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 Wm(e){return/^[+-]?(?:\\d|\\.\\d)/.test(e)}function Js(e,t={}){let n=t.maxSize??Sr,r=null,i=Om,o=Hm,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=Gm(u[m]??"").trim();if(!p)continue;let b=p.split(/\\s+/),S=(b[0]??"").toUpperCase(),y=b.slice(1);if(S==="TITLE"){r=Um(p);continue}if(S==="DOMAIN_MIN"){i=Ys(y,S,f);continue}if(S==="DOMAIN_MAX"){o=Ys(y,S,f);continue}if(S==="LUT_3D_INPUT_RANGE"){if(y.length!==2)throw new Se(`${S} expects two numbers`,f);let _=at(y[0],f),R=at(y[1],f);if(R<=_)throw new Se("LUT_3D_INPUT_RANGE max must exceed min",f);i=[_,_,_],o=[R,R,R];continue}if(S==="LUT_1D_SIZE"){a=Xs(y[0],S,f);continue}if(S==="LUT_3D_SIZE"){if(l=Xs(y[0],S,f),l>n)throw new Se(`LUT_3D_SIZE ${l} exceeds max ${n}`,f);continue}if(!Wm(S)){if(S.startsWith("LUT_"))throw new Se(`Unsupported cube keyword ${S}`,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(at(b[0],f),at(b[1],f),at(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");Bm(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 Vm(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):0}function bn(e){return Math.round(Vm(e)*255)}function qi(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]=bn(e.data[s]??0),i[u+1]=bn(e.data[s+1]??0),i[u+2]=bn(e.data[s+2]??0),i[u+3]=255}return{width:n,height:r,data:i}}var Qs="rec709";var fe={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 Zs=["exposure","contrast","highlights","shadows","whites","blacks","temperature","tint","vibrance","saturation"],el=["shadows","midtones","highlights"],tl=["master","red","green","blue"],nl=["hueVsHue","hueVsSaturation","hueVsLuma"];var rl=["vignette","vignetteMidpoint","vignetteRoundness","vignetteFeather","grain","grainSize","grainRoughness"],il=["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 C1=fe.unit,w1=fe.signedUnit,_1=fe.effects;var Ke=1024,xn=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 ve(e,t){let n=e[t];if(n===void 0)throw new RangeError("Color curve points must be contiguous");return n}function zm(e){let t=[],n=[],r=ve(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=ve(n,0);if(e.length===2)return[i,i];let o=new Array(e.length);o[0]=ol(ve(t,0),ve(t,1),i,ve(n,1)),o[o.length-1]=ol(ve(t,t.length-1),ve(t,t.length-2),ve(n,n.length-1),ve(n,n.length-2));for(let a=1;a<e.length-1;a+=1){let l=ve(n,a-1),s=ve(n,a);if(l===0||s===0||Math.sign(l)!==Math.sign(s)){o[a]=0;continue}let u=ve(t,a-1),c=ve(t,a),m=2*c+u,f=c+2*u;o[a]=(m+f)/(m/l+f/s)}return o}function al(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 qm(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 $m(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 sl(e,t,n,r,i){qm(e,r,i);let o=zm(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>ve(e,l+1)[0];)l+=1;let c=ve(e,l),m=ve(e,l+1),f=$m(u,c,m,ve(o,l),ve(o,l+1));a[s]=Math.min(i,Math.max(r,f))}return a}function Ot(e,t=Ke){if(al(e,t),e.length>xn)throw new RangeError(`A color curve supports at most ${xn} 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 sl(e,t,n=>n/(t-1),0,1)}function ji(e,t,n,r=Ke){if(e.length<3)throw new RangeError("A hue curve requires at least three points");if(e.length>xn)throw new RangeError(`A hue curve supports at most ${xn} 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 al(l,r),sl(l,r,s=>s/r*360,t,n)}var yn="data-color-grading",Sn="data-hf-color-grading-source-hidden",Ar="data-hf-authored-opacity",fl="__hf_color_grading_",Km=Qs,Xi={exposure:0,contrast:0,highlights:0,shadows:0,whites:0,blacks:0,temperature:0,tint:0,vibrance:0,saturation:0},Ji={vignette:0,vignetteMidpoint:.5,vignetteRoundness:0,vignetteFeather:.65,grain:0,grainSize:.25,grainRoughness:.5},Qi={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 Cr=Zs,ml=el,pl=tl,hl=nl,eo=rl,to=il,ll={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:{...Xi,...n},details:{...Ji,...r},effects:{...Qi,...i}}}var no=[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",ll,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",ll,{...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})],Ym=new Map(no.map(e=>[e.id,e])),Xm=/^\\$(?:\\{([A-Za-z0-9_.:-]+)\\}|([A-Za-z0-9_.:-]+))$/,Jm={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}},Ht={hue:0,amount:0,level:0},cl={amount:fe.unit,level:fe.signedUnit},st=[[0,0],[1,1]],Gt=[],Qm={hueVsHue:fe.secondaryHueShift,hueVsSaturation:fe.signedUnit,hueVsLuma:fe.signedUnit},Ki={center:0,range:180,softness:0},Yi={min:0,max:1,softness:.05},Zm={vignette:fe.unit,vignetteMidpoint:fe.unit,vignetteRoundness:fe.signedUnit,vignetteFeather:fe.unit,grain:fe.unit,grainSize:fe.unit,grainRoughness:fe.unit},Zi=fe.unit,ep=fe.effects,gl=["blur","pixelate","chromaBleed","tapeDamage","filmArtifacts","halftone","twoInkPrint","ascii","dither","bloom","monoScreen","scanlines","chromaticAberration","crtCurvature","digitalGlitch","engraving","crosshatch","kuwahara"];var tp=no.filter(e=>gl.some(t=>e.effects[t]>1e-4)),D1=no.filter(e=>!tp.includes(e)),I1={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}},bl=[{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 np=/^#[0-9a-f]{6}$/i;function rp(e){return!Array.isArray(e)||e.length<2||e.length>6||!e.every(t=>typeof t=="string"&&np.test(t))?null:e.map(t=>t.toLowerCase())}function _e(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Er(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 Te(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?Er(n,t.min,t.max):0}function ro(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=_e(e)?e:{};return ml.reduce((n,r)=>{let i=_e(t[r])?t[r]:{};return n[r]={hue:ro(i.hue,Ht.hue),amount:Te(i.amount??Ht.amount,cl.amount),level:Te(i.level??Ht.level,cl.level)},n},{shadows:{...Ht},midtones:{...Ht},highlights:{...Ht}})}function op(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)?[Er(t,0,1),Er(n,0,1)]:null}function yl(e){return e.some((t,n)=>n>0&&t[0]===e[n-1]?.[0])}function ap(e){(e[0]?.[0]??0)>0&&e.unshift([0,0]),(e.at(-1)?.[0]??1)<1&&e.push([1,1])}function sp(e){if(!Array.isArray(e)||e.length<2)return st;let t=[];for(let n of e){let r=op(n);if(!r)return st;t.push(r)}return t.sort((n,r)=>n[0]-r[0]),yl(t)||(ap(t),t.length>16)?st:t}function lp(e){let t=_e(e)?e:{};return pl.reduce((n,r)=>(n[r]=sp(t[r]),n),{master:st,red:st,green:st,blue:st})}function up(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)?[ro(n),Er(r,t.min,t.max)]:null}function cp(e,t){if(!Array.isArray(e)||e.length<3||e.length>16)return Gt;let n=[];for(let r of e){let i=up(r,t);if(!i)return Gt;n.push(i)}return n.sort((r,i)=>r[0]-i[0]),yl(n)?Gt:n}function dp(e){let t=_e(e)?e:{};return hl.reduce((n,r)=>(n[r]=cp(t[r],Qm[r]),n),{hueVsHue:Gt,hueVsSaturation:Gt,hueVsLuma:Gt})}function dl(e){let t=_e(e)?e:{},n=Te(t.min??Yi.min,Zi),r=Te(t.max??Yi.max,Zi);return{min:Math.min(n,r),max:Math.max(n,r),softness:Te(t.softness??Yi.softness,fe.secondarySoftRangeSoftness)}}function fp(e){let t=_e(e)?e:{},n=Te(t.range??Ki.range,fe.secondaryHueRange);return{center:ro(t.center,Ki.center),range:n,softness:Te(t.softness??Ki.softness,{min:fe.secondaryHueSoftness.min,max:fe.secondaryHueCombinedMax-n})}}function mp(e){return{hueShift:Te(e.hueShift??0,fe.secondaryHueShift),saturation:Te(e.saturation??0,fe.signedUnit),luma:Te(e.luma??0,fe.signedUnit),temperature:Te(e.temperature??0,fe.signedUnit),tint:Te(e.tint??0,fe.signedUnit)}}function pp(e){return!_e(e)||!_e(e.key)||!_e(e.correction)?null:{enabled:e.enabled!==!1,key:{hue:fp(e.key.hue),saturation:dl(e.key.saturation),luma:dl(e.key.luma)},correction:mp(e.correction)}}function hp(e){if(!Array.isArray(e))return[];let t=[];for(let n of e.slice(0,4)){let r=pp(n);r&&t.push(r)}return t}function gp(e){if(e==null)return null;let t=String(e).trim();return t||null}function bp(e){if(e==null)return null;if(typeof e=="string"){let n=e.trim();return n?{src:n,intensity:1}:null}if(!_e(e))return null;let t=e.src;return typeof t!="string"||t.trim()===""?null:{src:t.trim(),intensity:xl(e.intensity,1)}}function xp(e){if(typeof e=="string"){let t=e.trim();if(!t)return null;if(t.startsWith("{"))try{let n=JSON.parse(t);return _e(n)?n:null}catch{return null}return{preset:t}}return _e(e)?e:null}function yp(e,t){let n=e.trim().match(Xm);if(!n)return e;let r=n[1]??n[2]??"";return r&&Object.hasOwn(t,r)?t[r]:e}function vr(e,t){if(typeof e=="string"){let r=yp(e,t);if(r!==e)return r;let i=e.trim();if(!i.startsWith("{"))return e;try{return vr(JSON.parse(i),t)}catch{return e}}if(Array.isArray(e))return e.map(r=>vr(r,t));if(!_e(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=vr(i,t);return n}function Sp(e){return e?Ym.get(e)??null:null}function wr(e){let t=xp(e);if(!t||t.enabled===!1)return null;let n=gp(t.preset),r=Sp(n),i=r?.adjust??Xi,o=r?.details??Ji,a=r?.effects??Qi,l=_e(t.adjust)?t.adjust:{},s=_e(t.details)?t.details:{},u=_e(t.effects)?t.effects:{},c=Cr.reduce((p,b)=>(p[b]=Te(l[b]??i[b],Jm[b]),p),{...Xi}),m=eo.reduce((p,b)=>(p[b]=Te(s[b]??o[b],Zm[b]),p),{...Ji}),f=to.reduce((p,b)=>(p[b]=Te(u[b]??a[b],ep[b]??Zi),p),{...Qi});return{enabled:!0,preset:n,intensity:xl(t.intensity,r?.intensity??1),adjust:c,wheels:ip(t.wheels),curves:lp(t.curves),hueCurves:dp(t.hueCurves),secondaries:hp(t.secondaries),details:m,effects:f,palette:rp(t.palette),lut:bp(t.lut),colorSpace:typeof t.colorSpace=="string"&&t.colorSpace.trim()?t.colorSpace.trim():Km}}function Sl(e,t){return wr(vr(e,t))}function vp(e){return ml.some(t=>Math.abs(e[t].amount)>1e-4||Math.abs(e[t].level)>1e-4)}function io(e){return pl.some(t=>e[t].some(([n,r])=>Math.abs(n-r)>1e-4))}function oo(e){return hl.some(t=>e[t].some(([,n])=>Math.abs(n)>1e-4))}function ao(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:Cr.some(n=>Math.abs(e.adjust[n])>1e-4)||(e.wheels?vp(e.wheels):!1)||(e.curves?io(e.curves):!1)||(e.hueCurves?oo(e.hueCurves):!1)||(e.secondaries?ao(e.secondaries):!1):!1}var Ep=["[data-hyperframes-ignore]","[data-hyperframes-picker-ignore]","[data-hf-ignore]","[data-no-inspect]","[data-no-pick]","[data-hyper-shader-loading]"].join(","),Ap=["[data-hyperframes-picker-block]","[data-hyper-shader-loading]"].join(",");function El(e){let t=!1,n=null,r=null,i=null,o=null;function a(v,E){try{window.dispatchEvent(new CustomEvent(v,{detail:E}))}catch(w){D("runtime.picker.site1",w)}}function l(v){i=v,a("hyperframe:picker:hovered",{elementInfo:i,isPickMode:t,timestamp:Date.now()})}function s(v){o=v,a("hyperframe:picker:selected",{elementInfo:o,isPickMode:t,timestamp:Date.now()})}function u(v){let E=v.ownerDocument.defaultView;if(!E)return!1;let w=v;for(;w&&w!==document.body&&w!==document.documentElement;){let M=E.getComputedStyle(w);if(M.display==="none"||M.visibility==="hidden"||M.pointerEvents==="none")return!0;let L=Number.parseFloat(M.opacity);if(Number.isFinite(L)&&L<=.01&&!w.hasAttribute(Sn))return!0;w=w.parentElement}return!1}function c(v){if(!v||v===document.body||v===document.documentElement)return!1;let E=v.tagName.toLowerCase();return!(E==="script"||E==="style"||E==="link"||E==="meta"||v.classList.contains("__hf-pick-highlight")||v.closest(Ep)||u(v))}function m(v){return!!v?.closest(Ap)}function f(v){let E=v;if(E.id)return`#${CSS.escape(E.id)}`;let w=v.getAttribute("data-composition-id");if(w)return`[data-composition-id="${CSS.escape(w)}"]`;let M=v.getAttribute("data-composition-src");if(M)return`[data-composition-src="${CSS.escape(M)}"]`;let L=v.getAttribute("data-track-index");if(L)return`[data-track-index="${CSS.escape(L)}"]`;let H=v.tagName.toLowerCase(),z=v.parentElement;if(!z)return H;let j=z.querySelectorAll(`:scope > ${H}`);if(j.length===1)return H;for(let k=0;k<j.length;k+=1)if(j[k]===v)return`${H}:nth-of-type(${k+1})`;return H}function p(v){let E=v.tagName.toLowerCase(),w=(v.textContent??"").trim().replace(/\\s+/g," "),M=(L,H)=>L.length>H?`${L.slice(0,H-1)}\\u2026`:L;return E==="h1"||E==="h2"||E==="h3"?"Heading":E==="p"||E==="span"||E==="div"?w.length>0?M(w,56):"Text":E==="img"?"Image":E==="video"?"Video":E==="audio"?"Audio":E==="svg"?"Shape":v.getAttribute("data-composition-src")?"Composition":E==="section"?"Section":`${E.charAt(0).toUpperCase()}${E.slice(1)}`}function b(v,E,w){let M=typeof w=="number"&&w>0?w:8,L=[];if(document.elementsFromPoint)L=document.elementsFromPoint(v,E);else if(document.elementFromPoint){let j=document.elementFromPoint(v,E);L=j?[j]:[]}if(m(L[0]??null))return[];let H={},z=[];for(let[j,k]of L.entries()){if(!c(k))continue;let B=`${k.tagName}::${k.id||""}::${j}`;if(!H[B]&&(H[B]=!0,z.push(k),z.length>=M))break}return z}function S(v){let E=v.getBoundingClientRect(),w={};for(let L of Array.from(v.attributes))L.name.startsWith("data-")&&(w[L.name]=L.value);return{id:v.id||null,tagName:v.tagName.toLowerCase(),selector:f(v),label:p(v),boundingBox:{x:E.left,y:E.top,width:E.width,height:E.height},textContent:v.textContent?v.textContent.trim().slice(0,200):null,src:v.getAttribute("src")||v.getAttribute("data-composition-src")||null,dataAttributes:w}}function y(v,E,w){return b(v,E,w).map(S)}function _(v){if(!t)return;let w=b(v.clientX,v.clientY,1)[0]??(v.target instanceof Element?v.target:null);if(!c(w)||n===w)return;n&&n.classList.remove("__hf-pick-highlight"),n=w,w.classList.add("__hf-pick-highlight");let M=S(w);l(M),e.postMessage({source:"hf-preview",type:"element-hovered",elementInfo:M})}function R(v){if(!t)return;v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation();let E=y(v.clientX,v.clientY,8);E.length!==0&&(l(E[0]??null),e.postMessage({source:"hf-preview",type:"element-pick-candidates",candidates:E,selectedIndex:0,point:{x:v.clientX,y:v.clientY}}))}function T(v){v.key==="Escape"&&(N(),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 N(){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 A(){window.__HF_PICKER_API={enable:F,disable:N,isActive:()=>t,getHovered:()=>i,getSelected:()=>o,getCandidatesAtPoint:(v,E,w)=>Number.isFinite(v)&&Number.isFinite(E)?y(v,E,w):[],pickAtPoint:(v,E,w)=>{if(!Number.isFinite(v)||!Number.isFinite(E))return null;let M=y(v,E,8);if(!M.length)return null;let L=Math.max(0,Math.min(M.length-1,Number(w??0))),H=M[L]??null;return H?(s(H),e.postMessage({source:"hf-preview",type:"element-picked",elementInfo:H}),N(),H):null},pickManyAtPoint:(v,E,w)=>{if(!Number.isFinite(v)||!Number.isFinite(E))return[];let M=y(v,E,8);if(!M.length)return[];let L=[],H=Array.isArray(w)?w:[0];for(let z of H){let j=Math.max(0,Math.min(M.length-1,Math.floor(Number(z)))),k=M[j];if(!k)continue;L.some(Z=>Z.selector===k.selector&&Z.tagName===k.tagName)||L.push(k)}return L.length?(s(L[0]??null),e.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:L}),N(),L):[]}},a("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:F,disablePickMode:N,installPickerApi:A}}var Cp=["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 Bt(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 Al(e,t,n=Cp){for(let r of n){let i=t.getPropertyValue(r);i&&e.setProperty(r,i)}}function vn(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&&D("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&&D("runtime.player.nonConformantVoid",{method:t,actual:typeof n})}function En(e,t,n){if(e){for(let r of Object.values(e))if(!(!r||r===t))try{n(r)}catch(i){D("runtime.player.site1",i)}}}function Cl(e,t,n,r){let i=Bt(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 wp(e,t,n,r,i){let o=[];En(e,t,a=>{Ue(a,"play"),o.push(a)});try{return Cl(t,n,r,i)}finally{for(let a of o)try{Ue(a,"pause")}catch(l){D("runtime.player.site2",l)}}}function _p(e,t){En(e,t,n=>{Ue(n,"play")})}function wl(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?.()??vn(n,"duration",0))||0);r>0&&Math.max(0,vn(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"),En(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"),En(e.getTimelineRegistry?.(),n,i=>{Ue(i,"pause")});let r=Math.max(0,vn(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=wp(e.getTimelineRegistry?.(),i,o,e.getCanonicalFps());e.onDeterministicSeek(l),r?.keepPlaying&&a?(typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),Ue(i,"play"),En(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?(_p(e.getTimelineRegistry?.(),i),Cl(i,n,o,r)):Bt(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:()=>vn(e.getTimeline(),"time",0),getDuration:()=>vn(e.getTimeline(),"duration",0),isPlaying:()=>e.getIsPlaying(),setPlaybackRate:n=>e.setPlaybackRate(n),getPlaybackRate:()=>e.getPlaybackRate()}}function _l(){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 Tp=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function lo(e){return e.id||e.getAttribute("data-hf-id")||null}function so(e){if(e==null)return null;let t=Number(e);return Number.isFinite(t)?t:null}function Rp(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 kp(e){if(!(e instanceof HTMLMediaElement)||!Number.isFinite(e.duration))return null;let t=so(e.getAttribute("data-playback-start"))??so(e.getAttribute("data-media-start"))??0;return e.duration>t?e.duration-t:null}function Fp(e,t,n,r){let i=so(e.getAttribute("data-duration"));return i!=null&&i>0?i:Rp(e,t)??kp(e)??Math.max(0,n-r)}function Mp(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 Tl(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||Tp.has(l.tagName))continue;let s=t.resolveStartForElement(l,0);if(Fp(l,n,r,s)<=0)continue;let u={id:lo(l)??`__clip-${a++}`,element:l,parentId:null,children:[]};i.set(l,u)}return Mp(i),{roots:Array.from(i.values()).filter(l=>l.parentId===null)}}var uo="css:root",Rl=["backdrop-filter","clip-path","filter","mask","mask-border-source","mask-image","perspective","rotate","scale","transform","translate","-webkit-mask-image"],Np=new Set([...Rl,"contain","isolation","mask-border","mix-blend-mode","opacity"]),Lp=new Set(["absolute","relative"]),Dp=new Set(["flex","inline-flex","grid","inline-grid"]),Ip=new Set(["layout","paint","strict","content"]),Pp=new Set(["size","inline-size"]);function Op(e){return e.position==="fixed"||e.position==="sticky"}function Hp(e,t){if(t.zIndex==="auto"||t.zIndex==="")return!1;if(Lp.has(t.position))return!0;let n=e.parentElement?e.ownerDocument.defaultView?.getComputedStyle(e.parentElement).display:null;return n!=null&&Dp.has(n)}function Gp(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:Rl.some(r=>{let i=e.getPropertyValue(r);return i!==""&&i!=="none"})}function Bp(e){return e.getPropertyValue("contain").split(/\\s+/).some(n=>Ip.has(n))?!0:Pp.has(e.getPropertyValue("container-type"))}function Up(e){return e.getPropertyValue("will-change").split(",").map(t=>t.trim()).some(t=>Np.has(t))}function Wp(e,t){return Op(t)||Hp(e,t)||Gp(t)||Bp(t)?!0:Up(t)}function Vp(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 _r(e){let t=e.ownerDocument.defaultView;if(!t)return uo;let n=e.parentElement;for(;n&&n!==e.ownerDocument.documentElement;){try{if(Wp(n,t.getComputedStyle(n)))return Vp(n)}catch{return uo}n=n.parentElement}return uo}var Ut=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),K1=Object.freeze([Ut.start,Ut.duration,Ut.trackIndex]),Y1=Object.freeze([Ut.derivedEnd]),X1=Object.freeze([Ut.derivedEnd,Ut.legacyTrack]);function Le(e){if(e==null||e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}var Fl=/^[A-Za-z0-9_.:-]+$/;function Ml(e,t){let n=e.charCodeAt(t);return n>=48&&n<=57}function kl(e,t){let n=t;for(;n>=0&&Ml(e,n);)n--;return n}function zp(e,t){let n=t;for(;n>=0&&(e[n]??"").trim()==="";)n--;return n}function qp(e){let t=e.length-1;if(!Ml(e,t))return null;let n=kl(e,t);return e[n]==="."&&(n=kl(e,n-1)),n+1}function $p(e){let t=qp(e);if(t==null)return null;let n=zp(e,t-1),r=e[n];if(r!=="+"&&r!=="-")return null;let i=e.slice(0,n).trim();if(!Fl.test(i))return null;let o=Number(e.slice(t));return Number.isFinite(o)?{refId:i,operator:r,magnitude:o}:null}function co(e){let t=(e??"").trim();if(!t)return null;let n=Le(t);if(n!=null)return{kind:"absolute",value:n};if(Fl.test(t))return{kind:"reference",refId:t,offset:0};let r=$p(t);return r?{kind:"reference",refId:r.refId,offset:r.operator==="-"?-r.magnitude:r.magnitude}:null}var jp="data-hf-authored-duration",Kp="data-hf-authored-end";function Yp(e){return Le(e.getAttribute("data-duration"))}function Xp(e){return Le(e.getAttribute("data-end"))}function Jp(e){return Le(e.getAttribute(jp))}function Qp(e){return Le(e.getAttribute(Kp))}function lt(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,S=Yp(f)??(n?Jp(f):null);if(S!=null&&S>0&&(b=S),b==null||b<=0){let y=Xp(f)??(n?Qp(f):null);if(y!=null){let _=m(f,0),R=y-_;Number.isFinite(R)&&R>0&&(b=R)}}if((b==null||b<=0)&&s(f)){let y=Le(f.getAttribute("data-playback-start"))??Le(f.getAttribute("data-media-start"))??0;Number.isFinite(f.duration)&&f.duration>y&&(b=(f.duration-y)/je(f))}if(b==null||b<=0){let y=f.getAttribute("data-composition-id");if(y){let _=t[y]??null;if(_&&typeof _.duration=="function")try{let R=Number(_.duration());Number.isFinite(R)&&R>0&&(b=R)}catch(R){D("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 S=f.parentElement?.closest("[data-composition-id]");return S?m(S,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 S=co(f.getAttribute("data-start"));if(!S){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 N=m(F,p);return i.set(f,N),N}}return i.set(f,p),p}if(S.kind==="absolute"){let F=Math.max(0,S.value),N=Math.max(0,c(f,p)+F);return i.set(f,N),N}let y=l(S.refId);if(!y)return i.set(f,p),p;let _=m(y,0),R=u(y);if(R==null||R<=0){let F=Math.max(0,_+S.offset);return i.set(f,F),F}let T=Math.max(0,_+R+S.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 fo(e){let t=e.trim().toLowerCase();return!(!t||t==="main"||t.includes("caption")||t.includes("ambient"))}var e0="data-hf-authored-duration",t0="data-hf-authored-end";function Re(e){if(e==null||e==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}function mo(e){return Re(e.getAttribute("data-duration"))??Re(e.getAttribute(e0))}function Nl(e){return Re(e.getAttribute("data-end"))??Re(e.getAttribute(t0))}function po(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 ho(...e){let t=e.filter(n=>Number.isFinite(n??null));return t.length===0?null:Math.max(...t)}function go(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 Cn(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 Ll(e){let t=e.getAttribute("src")??e.getAttribute("data-src");if(t)return Cn(t);let n=e.getAttribute("data-composition-src");if(n)return Cn(n);let r=e.querySelector("img[src], video[src], audio[src], source[src]");return r?Cn(r.getAttribute("src")):null}function n0(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 r0(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 i0(e){let t=e.textContent?.replace(/\\s+/g," ").trim();return t?t.length>32?`${t.slice(0,31)}...`:t:null}function An(e){let t=e.replace(/\\.[^.]+$/i,"").replace(/[-_]+/g," ").replace(/\\s+/g," ").trim();return t?t.replace(/\\b\\w/g,n=>n.toUpperCase()):e}function o0(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 An(i);let o=e.id;if(o)return An(o);let a=n0(e);if(a)return An(a);let l=r0(Ll(e));if(l)return An(l);let s=i0(e);return s||`${An(t)} ${n+1}`}function Dl(e){let n=window.__timelines??{},r=lt({timelineRegistry:n,includeAuthoredTimingAttrs:!0}),i=W=>{if(!W)return null;let P=n[W]??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=W=>{let P=Re(W.getAttribute("data-duration"));if(P!=null&&P>0)return P;let O=Re(W.getAttribute("data-playback-start"))??Re(W.getAttribute("data-media-start"))??0;return Number.isFinite(W.duration)&&W.duration>O?Math.max(0,(W.duration-O)/je(W)):null},a=()=>{let W=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(W.length===0)return null;let P=0;for(let O of W){let de=O.hasAttribute("data-hf-auto-start")?r.resolveStartForElement(O,0):Math.max(0,Number(O.getAttribute("data-start")??0)||0);if(!Number.isFinite(de))continue;let se=o(O);se==null||se<=0||(P=Math.max(P,Math.max(0,de)+se))}return P>0?P:null},l=(W,P)=>{let O=[],de=null,se=null,K=null,Y=W.parentElement;for(;Y;){let X=Y.getAttribute("data-composition-id");X&&(O.push(X),!K&&Y!==P&&(K=X),de==null&&(de=r.resolveStartForElement(Y,0)),se==null&&(se=Re(Y.getAttribute("data-duration"))??i(X)??null)),Y=Y.parentElement}return{parentCompositionId:K,compositionAncestors:O.reverse(),inheritedStart:de,inheritedDuration:se}},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),S=mo(s??document.body),y=ho(...u.filter(W=>W!==s).map(W=>{let P=r.resolveStartForElement(W,0),O=r.resolveDurationForElement(W)??i(W.getAttribute("data-composition-id"))??null;return!Number.isFinite(P)||O==null||O<=0?null:Math.max(0,P)+O})),_=y!=null?Math.max(0,y-Math.max(0,m)):null,R=typeof b=="number"&&Number.isFinite(b)&&b>0?b:null,T=typeof S=="number"&&Number.isFinite(S)&&S>0?S:null,F=typeof p=="number"&&Number.isFinite(p)&&p>0?p:null,N=typeof _=="number"&&Number.isFinite(_)&&_>0?_:null,A=ho(F,N),v=R!=null&&A!=null&&R>A+1,w=T??(v?A:ho(R,F,N))??null,L=(w!=null?m+w:null)??(typeof f=="number"&&Number.isFinite(f)&&f>0?f:null),H=(W,P)=>!Number.isFinite(P)||P<=0?0:L==null||!Number.isFinite(L)?P:!Number.isFinite(W)||W>=L?0:Math.max(0,Math.min(P,L-W)),z=[],j=[],k=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),B=0;for(let[W,P]of k.entries()){if(P===s||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(P.tagName))continue;let O=l(P,s),de=r.resolveStartForElement(P,O.inheritedStart??0),se=P.getAttribute("data-composition-id"),K=mo(P);if((K==null||K<=0)&&se&&se!==c&&(K=i(se)),(K==null||K<=0)&&P instanceof HTMLMediaElement){let he=Re(P.getAttribute("data-playback-start"))??Re(P.getAttribute("data-media-start"))??0;Number.isFinite(P.duration)&&P.duration>0&&(K=Math.max(0,P.duration-he))}if(K==null||K<=0){let he=O.inheritedDuration;if(he!=null&&he>0){let Pe=(O.inheritedStart??0)+he;K=Math.max(0,Pe-de)}}if(K==null||K<=0||(K=H(de,K),K<=0))continue;let Y=de+K;B=Math.max(B,Y);let X=P.tagName.toLowerCase(),ze=se&&se!==c?"composition":X==="video"?"video":X==="audio"?"audio":X==="img"?"image":"element";z.push({id:lo(P)??se??null,label:o0(P,ze,z.length),start:de,duration:K,track:go(P,W),zIndex:po(P),stackingContextId:_r(P),kind:ze,tagName:X,compositionId:P.getAttribute("data-composition-id"),compositionAncestors:O.compositionAncestors,parentCompositionId:O.parentCompositionId,nodePath:null,compositionSrc:Cn(P.getAttribute("data-composition-src")),playbackStart:Pt(P),playbackRate:je(P),assetUrl:Ll(P),timelineRole:P.getAttribute("data-timeline-role"),timelineLabel:P.getAttribute("data-timeline-label"),timelineGroup:P.getAttribute("data-timeline-group"),timelinePriority:Re(P.getAttribute("data-timeline-priority"))})}let Z=new Set(z.map(W=>W.id)),U=s?.getAttribute("data-composition-id")??null,V=U?n[U]??null:null;if(V&&s){let W=V;if(typeof W.getChildren=="function")try{let P=W.getChildren(!0,!0,!1)??[],O=new Map;for(let K of s.children){let Y=K;if(!Y.id)continue;let X=Y.tagName.toLowerCase();X==="script"||X==="style"||X==="link"||O.set(Y,{id:Y.id,start:1/0,end:-1/0})}let de=K=>{let Y=K;for(;Y;){if(O.has(Y))return Y;if(Y===s)return null;Y=Y.parentElement}return null};for(let K of P){if(typeof K.targets!="function"||typeof K.startTime!="function"||typeof K.duration!="function")continue;let Y=K.startTime(),X=K.parent;for(;X&&X!==V&&typeof X.startTime=="function";)Y+=X.startTime(),X=X.parent;let ze=Y+K.duration();if(!(!Number.isFinite(Y)||!Number.isFinite(ze)))for(let he of K.targets()){if(!(he instanceof Element))continue;let Rt=de(he);if(!Rt)continue;let Pe=O.get(Rt);Pe&&(Pe.start=Math.min(Pe.start,Y),Pe.end=Math.max(Pe.end,ze))}}let se=z.length>0?Math.max(...z.map(K=>K.track))+1:0;for(let[K,Y]of O){if(Y.start===1/0||Y.end===-1/0)continue;let X=K;if(Z.has(X.id))continue;let ze=Math.max(0,Y.end-Y.start);if(ze<=0)continue;let he=H(Y.start,ze);he<=0||(B=Math.max(B,Y.start+he),z.push({id:X.id,label:X.getAttribute("data-timeline-label")??X.getAttribute("data-label")??X.getAttribute("aria-label")??X.id,start:Y.start,duration:he,track:go(X,se),zIndex:po(X),stackingContextId:_r(X),kind:"element",tagName:X.tagName.toLowerCase(),compositionId:X.getAttribute("data-composition-id"),compositionAncestors:U?[U]:[],parentCompositionId:U,nodePath:null,compositionSrc:null,playbackStart:Pt(X),playbackRate:je(X),assetUrl:null,timelineRole:X.getAttribute("data-timeline-role"),timelineLabel:X.getAttribute("data-timeline-label"),timelineGroup:X.getAttribute("data-timeline-group"),timelinePriority:Re(X.getAttribute("data-timeline-priority"))}),Z.add(X.id))}}catch(P){D("runtime.timeline.site1",P)}}if(s&&w!=null&&w>0){let W=z.length>0?Math.max(...z.map(P=>P.track))+1:0;for(let P of s.children){let O=P;if(!O.id||Z.has(O.id))continue;let de=O.getAttribute("data-timeline-role");if(de!=="overlay"&&de!=="persistent-overlay")continue;let se=O.tagName.toLowerCase();if(se==="script"||se==="style"||se==="link"||se==="meta"||window.getComputedStyle(O).display==="none")continue;let Y=H(0,w);Y<=0||(B=Math.max(B,Y),z.push({id:O.id,label:O.getAttribute("data-timeline-label")??O.getAttribute("data-label")??O.getAttribute("aria-label")??O.id,start:0,duration:Y,track:go(O,W),zIndex:po(O),stackingContextId:_r(O),kind:"element",tagName:se,compositionId:O.getAttribute("data-composition-id"),compositionAncestors:U?[U]:[],parentCompositionId:U,nodePath:null,compositionSrc:null,playbackStart:Pt(O),playbackRate:je(O),assetUrl:null,timelineRole:de,timelineLabel:O.getAttribute("data-timeline-label"),timelineGroup:O.getAttribute("data-timeline-group"),timelinePriority:Re(O.getAttribute("data-timeline-priority"))}),Z.add(O.id))}}for(let W of u){if(W===s)continue;let P=W.getAttribute("data-composition-id");if(!P||!fo(P))continue;let O=r.resolveStartForElement(W,0),de=mo(W);if((de==null||de<=0)&&Nl(W)!=null){let X=Nl(W);de=Math.max(0,X-O)}let se=i(P),K=de&&de>0?de:se;if(K==null||K<=0)continue;let Y=H(O,K);Y<=0||j.push({id:P,label:W.getAttribute("data-label")??P,start:O,duration:Y,thumbnailUrl:Cn(W.getAttribute("data-thumbnail-url")),avatarName:null})}let q=Math.max(1,B||1,w??0),J=v&&T==null,Ae=J?Number.POSITIVE_INFINITY:Math.max(1,Math.ceil(q*Math.max(1,e.canonicalFps)));return{...ar(e.canonicalFps),source:"hf-preview",type:"timeline",compositionContractVersion:1,durationSeconds:J?Number.POSITIVE_INFINITY:q,durationInFrames:Ae,clips:z,scenes:j,compositionWidth:Re(s?.getAttribute("data-width"))??1920,compositionHeight:Re(s?.getAttribute("data-height"))??1080}}var bo="data-composition-id",a0="data-composition-src",s0=`[${bo}]`,AS=`[${a0}]`,Il="style",Pl="script",l0=\'link[rel="stylesheet"], link[rel="preconnect"]\';function Wt(e){return e?Array.from(e):[]}function Ol(e){let{contentNode:t,head:n,documentElement:r,hasTemplate:i,compositionId:o}=e,a=Wt(t.querySelectorAll(s0)),l=o?a.find(c=>c.getAttribute(bo)===o)??null:a[0]??null,s=(l??a[0])?.getAttribute(bo)?.trim()||"",u=i?null:n??null;return{innerRoot:l,authoredCompositionId:o||s||null,scriptCompositionId:s||o||null,authoredRootId:l?.getAttribute("id")?.trim()||null,styleSources:[...Wt(u?.querySelectorAll(Il)),...Wt(t.querySelectorAll(Il))],scriptSources:[...Wt(u?.querySelectorAll(Pl)),...Wt(t.querySelectorAll(Pl))],linkSources:Wt(n?.querySelectorAll(l0)),variableDefaultCarriers:[r,l].filter(c=>c!=null)}}var me=Kf(lc(),1),uc=me.default,fv=me.default.stringify,mv=me.default.fromJSON,pv=me.default.plugin,hv=me.default.parse,gv=me.default.list,bv=me.default.document,xv=me.default.comment,yv=me.default.atRule,Sv=me.default.rule,vv=me.default.decl,Ev=me.default.root,Av=me.default.CssSyntaxError,Cv=me.default.Declaration,wv=me.default.Container,_v=me.default.Processor,Tv=me.default.Document,Rv=me.default.Comment,kv=me.default.Warning,Fv=me.default.AtRule,Mv=me.default.Result,Nv=me.default.Input,Lv=me.default.Rule,Dv=me.default.Root,Iv=me.default.Node;var Vo="data-hf-authored-id",cc="data-hf-inner-root";function zo(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function qo(e){return e.replace(/\\\\/g,"\\\\\\\\").replace(/"/g,\'\\\\"\')}function Fh(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,Fh(t)])).filter(Boolean):[]}function Mh(e){return!!e&&/[\\w-]/.test(e)}function Nh(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(!Mh(m)){i+=n,l+=c.length;continue}}}i+=s}return i}function Lh(e,t){let n=t?.trim();return n?Nh(e,n,`[${Vo}="${qo(n)}"]`):e}function dc(e){return`${e}:not(:has([${cc}])), ${e} > [${cc}]`}function Dh(e,t,n,r,i,o){let a=Lh(e,r),l=Ih(a,t,n),s=l.trim();if(!s||s==="*")return e;if(/^(html|body|:root)$/i.test(s))return o?dc(t):e;let u=new RegExp(`\\\\[\\\\s*data-composition-id\\\\s*=\\\\s*(["\'])${zo(n)}\\\\1\\\\s*\\\\]`,"g");if(u.test(s))return s.replace(u,"").trim()===""?dc(t):l.replace(u,t);let c=l.match(/^\\s*/)?.[0]??"",m=l.match(/\\s*$/)?.[0]??"";if(i){let f=r?`[${Vo}="${qo(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 Ih(e,t,n){let r=zo(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 Ph=new Set(["keyframes","-webkit-keyframes","font-face"]);function Oh(e){return e?.type==="atrule"}function Hh(e){let t=e.parent;for(;t;){if(Oh(t)&&Ph.has(t.name.toLowerCase()))return!0;t=t.parent}return!1}function Gh(e){let t=e.parent;for(;t;){if(t.type==="rule")return!0;t=t.parent}return!1}function mc(e,t,n,r,i){let o=t.trim();if(!e||!o)return e;let a=n||`[data-composition-id="${qo(o)}"]`,l=uc.parse(e);return l.walkRules(s=>{Hh(s)||Gh(s)||(s.selectors=s.selectors.map(u=>Dh(u,a,o,r,i?.compoundAuthoredRoot,i?.scopeRootSelectors)))}),l.toResult({map:!1}).css}function et(e){return JSON.stringify(e).replace(/</g,"\\\\u003c")}function pc(e,t,n="[HyperFrames] composition script error:",r,i=t,o){let a=et(t),l=et(i),s=et(n),u=zo(t),c=et(o?.trim()||null),m=et(r??null),f=et(String.raw`\\[\\s*data-composition-id\\s*=\\s*(?:"${u}"|\'${u}\')\\s*\\]`),p=et(String.raw`\\s*\\[\\s*data-(?:start|duration)\\s*=\\s*(?:"[^"]*"|\'[^\']*\')\\s*\\]`),b=et(fc(o?.trim()||""));return`(function(){\n var __hfCompId = ${a};\n var __hfTimelineCompId = ${l};\n var __hfErrorLabel = ${s};\n var __hfAuthoredRootId = ${c};\n var __hfAuthoredRootAttr = ${et(Vo)};\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 return Reflect.get(target, prop, target);\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 Bh=["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 hc(e){let t=e.getAttribute("id")?.trim();for(let n of Bh)e.removeAttribute(n);t&&(e.removeAttribute("id"),e.setAttribute("data-hf-authored-id",t)),e.setAttribute("data-hf-inner-root","true")}var Uh=8e3,Wh=/^(?![a-zA-Z][a-zA-Z\\d+\\-.]*:)(?!\\/\\/)(?!\\/)(?!\\.\\.?\\/).+/,Vh=/\\burl\\(\\s*(["\']?)([^)"\']+)\\1\\s*\\)/g,zh=["src","href"];function qh(e){return!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")||e.startsWith("data:")||e.startsWith("#")||e.startsWith("/")}function xc(e,t){if(!t)return e;let n=e.trim();if(qh(n)||!n.startsWith("../")&&n!=="..")return e;try{return new URL(n,t).href}catch{return e}}function yc(e,t){return!t||!e?e:e.replace(Vh,(n,r,i)=>{let o=xc(i||"",t);return o===i?n:`url(${r||""}${o}${r||""})`})}function $h(e,t){for(let n of Array.from(e.querySelectorAll("[src], [href]")))for(let r of zh){let i=n.getAttribute(r);if(i==null)continue;let o=xc(i,t);o!==i&&n.setAttribute(r,o)}}function jh(e,t){for(let n of Array.from(e.querySelectorAll("[style]"))){let r=n.getAttribute("style");if(r==null)continue;let i=yc(r,t);i!==r&&n.setAttribute("style",i)}}function Kh(e,t){for(let n of Array.from(e.querySelectorAll("style"))){let r=n.textContent||"",i=yc(r,t);i!==r&&(n.textContent=i)}}function Sc(e,t){if(t){$h(e,t),jh(e,t),Kh(e,t);for(let n of Array.from(e.querySelectorAll("template")))Sc(n.content,t)}}function Yh(e,t){return`${e}__hf${t}`}var Xh=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"),Uh)});function $o(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.textContent=""}function gc(e){for(let t of Array.from(e.querySelectorAll("style, script")))t.remove()}function Jh(e){let t=document.importNode(e,!0);hc(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 Qh(e,t){let n=e.trim();if(!n)return e;try{return Wh.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 bc(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 Wr(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 Zh(e){let t=new Map;for(let n of e){let r=Wr(n).authoredCompositionId||"";r&&t.set(r,(t.get(r)||0)+1)}return t}function vc(e){let t=Wr(e).authoredCompositionId;return t?!!document.querySelector(`template#${CSS.escape(t)}-template`):!1}function eg(e){return!!e.querySelector(\'[data-hf-inner-root="true"]\')}function tg(e){return e.hasAttribute("data-composition-src")?!0:vc(e)?e.children.length===0||e.hasAttribute("data-hf-original-composition-id")?!0:eg(e):!1}function Ko(){return Array.from(document.querySelectorAll("[data-composition-src], [data-composition-id]")).filter(t=>t.hasAttribute("data-composition-src")?!0:vc(t))}function Ec(){let e=window.__hfVariablesByComp;if(!e)return;let t=new Set(Ko().map(n=>Wr(n).runtimeCompositionId).filter(n=>!!n));for(let n of Object.keys(e))t.has(n)||delete e[n]}function Ac(e,t=Zh(e)){let n=new Map,r=new Map;for(let i of e){let{authoredCompositionId:o,runtimeCompositionId:a}=Wr(i),l=tg(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?Yh(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 jo(e){let t=Ol({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&&bc(b,e.compositionUrl)||document.head.querySelector(`link[href="${CSS.escape(b)}"]`))continue;let S=f.cloneNode(!0);S instanceof HTMLLinkElement&&(S.href=b,document.head.appendChild(S),e.injectedLinks.push(S))}(f=>{for(let p of f){let b=p.cloneNode(!0);b instanceof HTMLStyleElement&&(i&&(b.textContent=mc(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 y=Qh(b,e.compositionUrl);return e.compositionUrl&&bc(y,e.compositionUrl)?null:{kind:"external",src:y,type:p}}let S=f.textContent?.trim()??"";return S?{kind:"inline",content:S,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),S=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),S&&e.host instanceof HTMLElement&&(e.host.style.height=S),n.hasAttribute("data-timeline-locked")&&e.host.setAttribute("data-timeline-locked","");let y=Jh(n);!e.authoredCompositionId&&i&&y.setAttribute("data-composition-id",i),gc(y),e.host.appendChild(y)}else if(e.hasTemplate){let f=document.importNode(r,!0);gc(f),e.host.appendChild(f)}else e.host.innerHTML=e.fallbackBodyInnerHtml;a&&ng(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=pc(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 Xh(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 Cc(e){let t=Ko();if(Ec(),t.length===0)return;let n=Ac(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`);$o(i),await jo({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 wc(e){let t=Ko();if(Ec(),t.length===0)return;let n=Ac(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}$o(i);try{let c=l!=null?document.querySelector(`template#${CSS.escape(l)}-template`):null;if(c){await jo({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");Sc(b,u);let S=(l?b.querySelector(`template#${CSS.escape(l)}-template`):null)??b.querySelector("template"),y=S?S.content:b.body;await jo({host:i,authoredCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,sourceNode:y,hasTemplate:!!S,fallbackBodyInnerHtml:b.body.innerHTML,compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,head:b.head,declaredVariableDefaults:sn(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"}}),$o(i)}}))}function ng(e,t,n){let i={...e.declaredVariableDefaults??(t instanceof Element?sn(t):{}),...ss(e.host)};Ti(e.variableDeclarer??(t instanceof Element?t:null),i,n),os(e.host),Object.keys(i).length>0?(window.__hfVariablesByComp||(window.__hfVariablesByComp={}),window.__hfVariablesByComp[n]=i,Ri(e.host,{...is(e.host,i,window),...lr()})):window.__hfVariablesByComp&&delete window.__hfVariablesByComp[n]}function Yo(e){let n=e.vars.data?.captionState;return n==="dim"||n==="active"?n:void 0}function rg(e){return e instanceof HTMLElement?e.dataset.captionWrapper!=="true"?e:e.querySelector(":scope > span")??null:null}function ig(){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 Xo(){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=ig();for(let r of t){let i=null;if(r.wordId&&(i=rg(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=>Yo(m)==="dim")??s.find(m=>Yo(m)===void 0),c=u?String(u.vars.color):"";for(let m of s)(Yo(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 Qo="data-hf-edit-base-x",Zo="data-hf-edit-base-y",Kt="data-hf-edit-original-translate",Vr=e=>{let t=parseFloat(e??"");return Number.isFinite(t)?t:0},ag=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},_c=/^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)px$/,Jo=(e,t)=>_c.test(e)&&_c.test(t)?`${parseFloat(e)+parseFloat(t)}px`:`calc(${e} + ${t})`,sg=(e,t,n)=>{if(!e||e==="none")return`${t} ${n}`;let[r,i,o]=ag(e);if(r===void 0)return`${t} ${n}`;if(i===void 0)return`${Jo(r,t)} ${n}`;let a=o===void 0?"":` ${o}`;return`${Jo(r,t)} ${Jo(i,n)}${a}`},lg=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""}},ea=new WeakMap;function cg(e,t){let n=ea.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=Vr(e.getAttribute("data-x"))-Vr(e.getAttribute(Qo)),i=Vr(e.getAttribute("data-y"))-Vr(e.getAttribute(Zo));e.hasAttribute(Kt)||e.setAttribute(Kt,ug(e)),n===void 0&&lg(e);let o=e.getAttribute(Kt)??"",a=sg(o,`${r}px`,`${i}px`);e.style.setProperty("translate",a),ea.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(`[${Kt}]:not([${Qo}]):not([${Zo}])`);for(let s=0;s<o.length;s++){let u=o[s];if(u===void 0||!i(u))continue;let c=u.getAttribute(Kt)??"";c===""?u.style.removeProperty("translate"):u.style.setProperty("translate",c),u.removeAttribute(Kt),ea.delete(u)}let a=e.querySelectorAll(`[${Qo}], [${Zo}]`),l=0;for(let s=0;s<a.length;s++){let u=a[s];u===void 0||!i(u)||(cg(u,t),l+=1)}return l}var Tc="__hfPositionEditsSeekReapplyWrapped",Rc=new WeakSet,kc=new WeakMap,Fc=new WeakMap;function Mc(e){let t=e,n=()=>{try{zr(t.document)}catch{}},r=m=>typeof m=="function"&&(Rc.has(m)||!!m[Tc]),i=m=>{Rc.add(m);try{Object.defineProperty(m,Tc,{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=kc.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 S=m[f],y=b?.set;return Object.defineProperty(m,f,{configurable:!0,enumerable:b?.enumerable??!0,get:()=>S,set:_=>{S=o(_),y?.call(m,_)}}),S=o(S),p??(p=new Set),p.add(f),kc.set(m,p),n(),!0},l=(m,f)=>{let p=Fc.get(t),b=Object.getOwnPropertyDescriptor(t,m);if(!p?.has(m)){if(b?.configurable===!1){let _=t[m];return _?a(_,f):!1}let y=t[m];Object.defineProperty(t,m,{configurable:!0,enumerable:b?.enumerable??!0,get:()=>y,set:_=>{y=_,y&&a(y,f)}}),p??(p=new Set),p.add(m),Fc.set(t,p)}let S=t[m];return S?a(S,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 qr(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 $r(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}var Nc=new Set(["img","video","audio","source"]);function dg(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 fg(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}function mg(e){return e.replace(/[;{}<>\\r\\n]/g,"")}function pg(e){if($r(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 ta(e,t){let n=e.closest("[data-composition-id]"),r=t.get(n);if(r)return r;let i=qr(e);return t.set(n,i),i}function hg(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 gg(e){return e.querySelector("[data-hf-root]")??e.getElementById("stage")??e.body?.firstElementChild??e.body}function bg(e,t){let n=new Set,r=gg(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=ta(i,t);for(let[a,l]of Object.entries(o)){let s=pg(l);s!==null&&i instanceof HTMLElement&&i.style.setProperty(`--${a}`,mg(s))}}}function na(e){let t=new Map;bg(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(!Nc.has(n.tagName.toLowerCase())){console.warn(`[hyperframes] Ignoring data-var-src on <${n.tagName.toLowerCase()}>: variable-bound src is only allowed on ${Array.from(Nc).join("/")}.`);continue}let i=dg(ta(n,t)[r]);if(i!==null){if(!fg(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=ta(n,t)[r];$r(i)&&hg(n,String(i))}}var tt=new Map,xg="data-hf-color-grading-canvas",yg="__hf_color_grading_canvas__";function Vc(){if(typeof MutationObserver>"u"||typeof document>"u")return;let e=document.documentElement;if(!e)return;let t=r=>{r instanceof HTMLElement&&(r.hasAttribute(Ar)||r.setAttribute(Ar,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 Sg=16,vg=4,Xt={enabled:!1,position:.5,softness:0,lineWidth:2},ra=["#000000","#ffffff"],Eg=["#1a1a1a","#f5f5dc"],Kn=3,Ag=Kn-1,Cg=5,ia=`${Ke}.0`,Lc=`${Ke-1}.0`,wg=`${Kn}.0`,_g=`${(Ag+.5)/Kn}`;function jr(e){let t=e.getAttribute(yn);return t==null?null:Sl(t,qr(e))}var Tg=["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`),Rg=["#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) * ${Lc};`," float lower = floor(position);",` float upper = min(lower + 1.0, ${Lc});`,` float y = (row + 0.5) / ${wg};`,` vec4 before = texture2D(u_advanced, vec2((lower + 0.5) / ${ia}, y));`,` vec4 after = texture2D(u_advanced, vec2((upper + 0.5) / ${ia}, y));`," return mix(before, after, position - lower);","}","vec4 advancedConfig(float index){",` return texture2D(u_advanced, vec2((index + 0.5) / ${ia}, ${_g}));`,"}","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`),kg=["#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`),Fg=["#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`),Mg=["#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 wt(e){return e instanceof HTMLVideoElement||e instanceof HTMLImageElement}function Dc(e){let t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function Ic(e,t,n){let r=e.createShader(n);return r?(e.shaderSource(r,t),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(D("runtime.colorGrading.compileShader",e.getShaderInfoLog(r)),e.deleteShader(r),null)):null}function Qr(e,t=Rg){let n=Ic(e,Tg,e.VERTEX_SHADER),r=Ic(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:(D("runtime.colorGrading.linkProgram",e.getProgramInfoLog(i)),e.deleteProgram(i),null)):null}function Kr(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 Ng(e,t){let n=Qr(e,kg);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 Lg(e,t){let n=Qr(e,Fg);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 Dg(e,t){let n=Qr(e,Mg);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=Kr(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 Xr(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 oa(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 Pc(e,t,n){t&&e.deleteProgram(t);for(let r of n)r&&e.deleteTexture(r)}function ua(e){let t=e.getContext("webgl",{alpha:!0,premultipliedAlpha:!1});if(!t)return null;let n=Qr(t),r=Kr(t),i=Kr(t,t.NEAREST),o=Kr(t,t.NEAREST);if(!n||!r||!i||!o)return Pc(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:oa(t,n,Cr),detailUniforms:oa(t,n,eo),effectUniforms:oa(t,n,to),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")}}):(Pc(t,n,[r,i,o]),null)}function Ig(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Pg(e){if(!Ig(e))return{...Xt};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,Xt.position,0,1),softness:t(e.softness,Xt.softness,0,.25),lineWidth:t(e.lineWidth,Xt.lineWidth,0,12)}}function zc(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 Zr(e){return e instanceof Error?e.message:"LUT failed to load"}function Og(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 qc(e){let t=e.id||e.currentSrc||e.getAttribute("src")||`${e.tagName}:${Array.prototype.indexOf.call(e.parentNode?.children??[],e)}`;return Og(t)}function ca(e){let t=zc(e);if("error"in t)return{state:"error",message:t.error};let n=tt.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=>Js(o,{maxSize:Sr})),i={state:"pending",promise:r};for(;tt.size>=Sg;){let o=tt.keys().next().value;if(!o)break;tt.delete(o)}return tt.set(t.href,i),r.then(o=>{tt.get(t.href)===i&&tt.set(t.href,{state:"ready",lut:o})},o=>{tt.get(t.href)===i&&tt.set(t.href,{state:"error",message:Zr(o)})}),i}function Oc(e,t,n){if(e.lut?.src===t)return e.lut;let r=qi(n),{gl:i,program:o}=e;try{return $c(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=Zr(a),e.lutLoadingSrc=null,D("runtime.colorGrading.uploadLut",a),null}}async function Hg(e){let t=ca(e);if(t.state==="ready")return t.lut;if(t.state==="pending")return t.promise;throw new Error(t.message)}function $c(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 Gg(e,t,n){let r=qi(n),{gl:i,program:o}=e;return $c(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 da(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 fa(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 Yr(e,t=!1){da(e),fa(e),Bg(e.gl,e.program),t&&e.gl.getExtension("WEBGL_lose_context")?.loseContext()}function Bg(e,t){e.deleteTexture(t.texture),e.deleteTexture(t.lutTexture),e.deleteTexture(t.advancedTexture),e.deleteBuffer(t.quad),e.deleteProgram(t.program)}function Ug(e){let t=ua(e.canvas);return t?(Yr(e),e.gl=t.gl,e.program=t.program,e.lut=null,e.lutLoadingSrc=null,e.lutError=null,e.effectError=null,!0):!1}function la(e){if(!e.sourceHidden)return;e.element.removeAttribute(Sn);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 Wg(e){if(e.effectTargets)return e.effectTargets;let{gl:t}=e,n=Ng(t,e.program.quad),r=qn(t),i=qn(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 Vg(e,t){return t.bloom||(t.bloom=qn(e.gl),e.effectError=t.bloom?null:"Framebuffer effects unavailable"),t.bloom}function Hc(e){let t=e.effectTargets;t?.bloom&&(Je(e.gl,t.bloom),t.bloom=null)}function zg(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=Lg(t,e.program.quad),o=Dg(t,e.program.quad),a=qn(t,n.HALF_FLOAT_OES,t.NEAREST),l=qn(t);return!i||!o||!a||!l?(qg(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 qg(e,t,n,r,i){t&&e.deleteProgram(t.program),n&&e.deleteProgram(n.program),r&&Je(e,r),i&&Je(e,i)}function jc(e,t,n,r,i){let o=Math.max(1,Math.ceil(r)),a=Math.max(1,Math.ceil(i));return Xr(e,t,o,a),Xr(e,n,o,a),{width:o,height:a}}function Jr(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),$n(e,t)}function $g(e,t,n,r,i,o,a){let l=jc(e,t.scratch,r,i/2,o/2),s=a/2;Jr(e,t.blurProgram,n,t.scratch,l,{x:1,y:0},s,!0,.5),Jr(e,t.blurProgram,t.scratch.texture,r,l,{x:0,y:1},s,!0)}function jg(e,t,n,r,i,o,a){let l=n;for(let s=0;s<Math.max(1,Math.floor(a));s++)Jr(e,t.blurProgram,l,t.scratch,i,{x:1,y:0},o),Jr(e,t.blurProgram,t.scratch.texture,r,i,{x:0,y:1},o),l=r.texture}function $n(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 Kg(e,t,n,r,i,o,a,l){Xr(e,t.moments,i.width,i.height),Xr(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),$n(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),$n(e,u)}function Yg(e,t,n,r){if(n<=0)return!1;let i=jc(e.gl,t.scratch,t.blur,r.width,r.height);return jg(e.gl,t,e.program.texture,t.blur,i,.75+Math.pow(n,1.35)*32,n>.55?3:2),!0}function Xg(e,t,n,r,i,o){if(n<=0)return Hc(e),null;o||Hc(e);let a=o?Vg(e,t):t.blur;return a?($g(e.gl,t,e.program.texture,a,i.width,i.height,r),a.texture):null}function Jg(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&&da(e),{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let l=Wg(e);if(!l)return{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let s=Yg(e,l,o,n),u=Xg(e,l,a,t.effects.bloomRadius,n,s);return{blurReady:s,bloomReady:u!==null,blurTexture:l.blur.texture,bloomTexture:u??i.texture}}function Qg(e,t,n,r,i,o,a){let l=t.effects.kuwahara;if(l<=0&&!o)return e.kuwaharaTargets&&a&&fa(e),{kuwaharaReady:!1,kuwaharaTexture:e.program.texture};let s=zg(e);return!s||l<=0?{kuwaharaReady:!1,kuwaharaTexture:s?.output.texture??e.program.texture}:(Kg(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 Kc(e,t,n,r,i={}){let o=i.releaseIdleTargets??!0;e.effectError=null;let a=Jg(e,t,n,o),l=Qg(e,t,n,r,a.blurReady,i.preserveKuwahara??!1,o);return{...a,...l}}function Zg(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=zc(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=ca(t);return i.state==="ready"?Oc(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||(Oc(e,r.href,o),De(e))},o=>{e.destroyed||e.grading.lut?.src.trim()!==t||(e.lut=null,e.lutError=Zr(o),e.lutLoadingSrc=null,De(e))})),null)}function Vn(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&&wt(n))return n;try{let r=document.querySelector(t);return r&&wt(r)?r:null}catch{return null}}if(e.hfId){let t=document.querySelector(`[data-hf-id="${CSS.escape(e.hfId)}"]`);if(t&&wt(t))return t}if(e.id){let t=document.getElementById(e.id);if(t&&wt(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&&wt(r)?r:null}catch{return null}}function Yc(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 Xc(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 Jc(e){if(!e.id)return null;let t=document.getElementById(`__render_frame_${e.id}__`);return t instanceof HTMLImageElement&&Xc(t)?t:null}function Gc(e){if(!(e instanceof HTMLVideoElement))return!1;let t=Jc(e);if(!t)return!1;let n=window.getComputedStyle(t);return n.display!=="none"&&n.visibility!=="hidden"}function eb(e){return e instanceof HTMLImageElement&&e.classList.contains("__render_frame__")}function tb(e,t){t.parentNode&&t.nextSibling!==e.canvas&&t.parentNode.insertBefore(e.canvas,t.nextSibling)}function Qc(e){if(e instanceof HTMLVideoElement){let t=Jc(e);if(t)return t}return Xc(e)?e:null}function Bc(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 nb(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=Bc(o,"x"),l=Bc(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 Zc(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=nb(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 rb(e,t){window.getComputedStyle(t).position==="static"&&(e.touchedParent||(e.touchedParent=t,e.parentInlinePosition=t.style.position||null),t.style.position="relative")}function Uc(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&&rb(e,i);let o=window.getComputedStyle(t);Al(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=Uc(n.offsetWidth,a.width),s=Uc(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 Yt(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 _t(e,t,n,r){e.set(r,(t*Ke+n)*4)}function mt(e,t){return Math.min(1,Math.max(1/255,(e*(127/t)+128)/255))}function aa(e,t,n){return e.length>=3?ji(e,t,n):new Float32Array(Ke)}function Ct(e,t){return e[t]??0}function ob(e,t,n){let r=Ot(t.red),i=Ot(t.green),o=Ot(t.blue),a=Ot(t.master),l=aa(n.hueVsHue,-180,180),s=aa(n.hueVsSaturation,-1,1),u=aa(n.hueVsLuma,-1,1);for(let c=0;c<Ke;c+=1)_t(e,0,c,[Ct(r,c),Ct(i,c),Ct(o,c),Ct(a,c)]),_t(e,1,c,[mt(Ct(l,c),180),mt(Ct(s,c),1),mt(Ct(u,c),1),1])}function ab(e,t,n){let r=n*Cg;_t(e,2,r,[t.key.hue.center/360,t.key.hue.range/180,t.key.hue.softness/180,1]),_t(e,2,r+1,[t.key.saturation.min,t.key.saturation.max,t.key.saturation.softness/.5,0]),_t(e,2,r+2,[t.key.luma.min,t.key.luma.max,t.key.luma.softness/.5,0]),_t(e,2,r+3,[mt(t.correction.hueShift,180),mt(t.correction.saturation,1),mt(t.correction.luma,1),mt(t.correction.temperature,1)]),_t(e,2,r+4,[mt(t.correction.tint,1),.5,.5,1])}function sb(e,t,n){let r=new Float32Array(Ke*Kn*4);ob(r,e,t);let i=0;for(let o of n)o.enabled&&(ab(r,o,i),i+=1);return r}var Wc=new WeakMap;function lb(e,t,n){let r=Wc.get(e);if(r?.hueCurves===t&&r.secondaries===n)return r.signature;let i=JSON.stringify([e,t,n]);return Wc.set(e,{hueCurves:t,secondaries:n,signature:i}),i}function ub(e,t,n,r){let{curves:i,hueCurves:o}=n,a=lb(i,o,r);if(t.advancedSignature===a)return;let l=Uint8Array.from(sb(i,o,r),bn);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,Kn,0,e.RGBA,e.UNSIGNED_BYTE,l),t.advancedSignature=a}function sa(e,t,n){e.uniform3f(t,n.hue/360,n.amount,n.level)}function ed(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,S=io(f),y=oo(p),_=ao(b)?b.reduce((F,N)=>F+Number(N.enabled),0):0;(S||y||_>0)&&ub(e,t,n,b),sa(e,t.shadowWheel,n.wheels.shadows),sa(e,t.midtoneWheel,n.wheels.midtones),sa(e,t.highlightWheel,n.wheels.highlights),e.uniform1f(t.rgbCurvesEnabled,S?1:0),e.uniform1f(t.hueCurvesEnabled,y?1:0),e.uniform1f(t.secondaryCount,_);for(let[F,N]of t.adjustUniforms)e.uniform1f(N,n.adjust[F]);for(let[F,N]of t.detailUniforms)e.uniform1f(N,n.details[F]);e.uniform1f(t.grainSeed,c),e.uniform1f(t.effectTime,m);for(let[F,N]of t.effectUniforms)e.uniform1f(N,n.effects[F]);let R=n.palette??(n.effects.engraving>0||n.effects.crosshatch>0?Eg:ra),T=R[R.length-1]??ra[1];e.uniform1f(t.paletteSize,R.length),Yt(e,t.palette0,R[0]??ra[0]),Yt(e,t.palette1,R[1]??T),Yt(e,t.palette2,R[2]??T),Yt(e,t.palette3,R[3]??T),Yt(e,t.palette4,R[4]??T),Yt(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 cb(e){if(!e.sourceHidden){let t=e.element.getAttribute(Ar);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(Sn,"true"),e.element.style.setProperty("opacity","0","important"),e.sourceHidden=!0}function nt(e){let t=bl.find(n=>n.path===e);if(!t)throw new Error(`Missing color-grading animation property: ${e}`);return t}var td=nt("intensity"),nd=nt("lut.intensity"),rd=nt("adjust.exposure"),id=nt("effects.kuwahara"),od=[["blur",nt("effects.blur")],["bloom",nt("effects.bloom")],["kuwahara",id],["pixelate",nt("effects.pixelate")],["ascii",nt("effects.ascii")],["dither",nt("effects.dither")]],ad=[td,nd,rd,...od.map(([,e])=>e)];function Tt(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 zn(e,t){return t!==null&&(vl(t)||ad.some(n=>Tt(e,n)!==null))}function db(e,t){let n=null;for(let[r,i]of od){let o=Tt(e,i);o!==null&&(n??(n={...t.effects}),n[r]=o)}return n}function fb(e){let{element:t,grading:n}=e,r=Tt(t,td),i=Tt(t,nd),o=Tt(t,rd),a=db(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 sd(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 ld(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=Qc(e.element);if(!t)return e.hasDrawn||(e.canvas.style.display="none"),!1;let n=Yc(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=eb(t);s&&tb(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=Zc(c.width,c.height,n.width,n.height,m.objectFit,m.objectPosition),{gl:p,program:b}=e;try{let S=fb(e),y=Zg(e);sd(p,b.texture,t);let _=Tt(e.element,id)!==null,R=Kc(e,S,c,f,{preserveKuwahara:_});p.bindFramebuffer(p.FRAMEBUFFER,null),p.viewport(0,0,c.width,c.height),p.useProgram(b.program),ld(p,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,N=e.grainSeed+Math.floor(F*60);return ed(p,b,S,y,R.blurReady,R.bloomReady,R.kuwaharaReady,e.compare,c,f,N,F),$n(p,b),cb(e),e.hasDrawn=!0,e.drawError=null,!0}catch(S){return e.drawError=S instanceof Error?S.message:"Shader draw failed",D("runtime.colorGrading.drawEntry",S),!1}}function mb(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 pb(){let e=document.createElement("canvas"),t=ua(e);return t?{canvas:e,...t,lut:null,effectTargets:null,kuwaharaTargets:null,effectError:null}:null}function hb(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 gb(e,t,n,r){let i=Qc(t);if(!i)return null;let o=Yc(i);if(!o)return null;let a=mb(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=Zc(a.width,a.height,o.width,o.height,s.objectFit,s.objectPosition);return sd(e.gl,e.program.texture,i),{dimensions:a,uv:u,effectTime:hb(t,r),grainSeed:qc(t)+(t instanceof HTMLVideoElement?Math.floor(t.currentTime*60):0)}}async function bb(e,t,n,r,i=!1){let o=gb(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=wr(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=Gg(e,f.lut.src,await Hg(f.lut.src))),p=e.lut),c.push({id:m.id,dataUrl:xb(e,f,p,a,l,s,u)})}catch(b){c.push({id:m.id,dataUrl:null,error:Zr(b)})}}return{...a,images:c}}function xb(e,t,n,r,i,o,a){let{canvas:l,gl:s,program:u}=e,c=Kc(e,t,r,i,{releaseIdleTargets:!1});return s.bindFramebuffer(s.FRAMEBUFFER,null),s.viewport(0,0,r.width,r.height),s.useProgram(u.program),ld(s,u,c),n||(e.lut=null),ed(s,u,t,n,c.blurReady,c.bloomReady,c.kuwaharaReady,Xt,r,i,o,a),$n(s,u),l.toDataURL("image/png")}function Xe(e,t,n,r){t.addEventListener(n,r),e.cleanup.push(()=>t.removeEventListener(n,r))}function yb(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 jn(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&&jn(e)});return}e.animationFrame=window.requestAnimationFrame(()=>{e.animationFrame=null,De(e),!e.destroyed&&!t.paused&&!t.ended&&jn(e)})}function Sb(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",()=>jn(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",la(e)}),Xe(e,e.canvas,"webglcontextrestored",()=>{if(e.contextLost=!1,!Ug(e)){e.contextLost=!0,e.drawError="WebGL context restore failed",la(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 vb(e){if(e.destroyed)return null;e.destroyed=!0,yb(e),e.resizeObserver?.disconnect();for(let t of e.cleanup)t();return e.cleanup.length=0,e.canvas.remove(),da(e),fa(e),la(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 ud(e,t){return e.removeAttribute("style"),t.id?e.id=`${fl}${t.id}`:e.removeAttribute("id"),e.className=yg,e.setAttribute(xg,"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 Eb(e){return ud(document.createElement("canvas"),e)}function cd(){let e=new WeakMap,t=new Set,n=[],r=null,i=null,o=Promise.resolve(),a=!1,l=(A,v,E)=>{let w=e.get(A);if(w)return w.grading=v,w.source=E,De(w),A instanceof HTMLVideoElement&&!A.paused&&jn(w),!0;let M=n.pop();if(M)ud(M.canvas,A);else{let H=Eb(A),z=ua(H);if(!z)return H.remove(),!1;M={canvas:H,gl:z.gl,program:z.program,effectTargets:null,kuwaharaTargets:null,effectError:null}}let L={element:A,...M,grading:v,compare:{...Xt},lut:null,lutLoadingSrc:null,lutError:null,drawError:null,effectTargets:null,kuwaharaTargets:null,effectError:null,source:E,animationFrame:null,videoFrameHandle:null,resizeObserver:null,cleanup:[],touchedParent:null,parentInlinePosition:null,sourceHidden:!1,sourceInlineOpacity:null,sourceInlineOpacityPriority:"",sourceOpacityForCanvas:window.getComputedStyle(A).opacity||"1",sourceVisibleForCanvas:window.getComputedStyle(A).visibility!=="hidden",hasDrawn:!1,contextLost:!1,grainSeed:qc(A),destroyed:!1};return e.set(A,L),t.add(A),Sb(L),De(L),A instanceof HTMLVideoElement&&!A.paused&&jn(L),!0},s=(A,v)=>{if(a)return!1;let E=Vn(A);if(!E)return!1;let w=e.get(E);if(!w){let M=jr(E);if(!zn(E,M)||!l(E,M,"attribute"))return!1;w=e.get(E)}return w?(w.compare=Pg(v),De(w),!0):!1},u=A=>{let v=e.get(A);if(!v)return;let E=vb(v);E&&(v.contextLost||n.length>=vg?Yr(E,!0):n.push(E)),e.delete(A),t.delete(A)},c=()=>{if(a)return 0;let A=new Set;document.querySelectorAll(`video[${yn}], img[${yn}]`).forEach(E=>{if(!wt(E))return;A.add(E);let w=jr(E);zn(E,w)&&(Dc(E)||Gc(E))?l(E,w,"attribute"):u(E)});for(let E of t){let w=e.get(E);w&&(!E.isConnected||w.source==="attribute"&&!A.has(E))&&u(E)}return t.size},m=()=>{if(a)return 0;let A=0;for(let v of t){let E=e.get(v);E&&De(E)&&(A+=1)}return A},f=async()=>{let A=new Set;for(let v of t){let E=e.get(v)?.grading.lut;if(!E?.src.trim()||(E.intensity??1)<=0)continue;let w=ca(E.src);w.state==="pending"&&A.add(w.promise)}return A.size>0&&await Promise.allSettled(A),m(),A.size},p=()=>{if(a)return 0;let A=0;for(let v of t){let E=e.get(v);!E||!ad.some(M=>Tt(v,M)!==null)||v instanceof HTMLVideoElement&&!v.paused&&!v.ended||De(E)&&(A+=1)}return A},b=(A,v)=>{if(a)return!1;let E=Vn(A);if(!E)return!1;let w=wr(v);return zn(E,w)?l(E,w,"live"):(u(E),!0)},S=(A,v)=>{if(!wt(A))return!1;let E=e.get(A);if(!E){if(!v)return!1;let w=jr(A);return zn(A,w)&&l(A,w,"attribute")}return E.sourceVisibleForCanvas=v,!v&&E.source==="attribute"&&u(A),!0},y=A=>{let v=Vn(A);if(!v)return{state:"missing",message:"Media not found"};let E=e.get(v);if(E)return E.effectError?{state:"unavailable",message:E.effectError}:E.drawError?{state:"unavailable",message:E.drawError}:E.lutError?{state:"unavailable",message:`LUT error: ${E.lutError}`}:E.grading.lut&&E.lutLoadingSrc?{state:"pending",message:"Loading LUT"}:E.canvas.style.display==="none"?{state:"pending",message:"Waiting for media frame"}:{state:"active",message:E.lut?"Shader + LUT active":"Shader active"};let w=jr(v);return zn(v,w)?!Dc(v)&&!Gc(v)?{state:"pending",message:"Waiting for visible media"}:{state:"unavailable",message:"WebGL unavailable"}:{state:"inactive",message:"No grading applied"}},_=async(A,v,E)=>{let w=async()=>{if(a||v.length===0)return null;let L=Vn(A);return!L||(i??(i=pb()),!i)?null:bb(i,L,v,E?.maxDimension,E?.useMediaTime)},M=o.then(w,w);return o=M.then(()=>{},()=>{}),M},R=A=>{let v=Vn(A);if(!(v instanceof HTMLVideoElement))return null;if(!v.paused)return()=>{};let E=v.currentTime,w=v.loop,M=v.muted;return v.loop=!0,v.muted=!0,(v.ended||Number.isFinite(v.duration)&&E>=v.duration)&&(v.currentTime=0),v.play().catch(()=>{}),()=>{v.pause(),v.loop=w,v.muted=M,v.currentTime=E}},T=()=>{if(!a){a=!0,r?.disconnect(),r=null;for(let A of t)u(A);for(let A of n)Yr(A,!0);n.length=0,i&&(Yr(i,!0),i=null)}};document.body&&(r=new MutationObserver(()=>c()),r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[yn]}));let F={refresh:c,redraw:m,redrawAnimated:p,waitForActiveLuts:f,setGrading:b,setCompare:s,setSourceVisibility:S,getStatus:y,renderPreviews:_,startPreviewPlayback:R,destroy:T},N=window;return N.__hf=N.__hf||{},N.__hf.colorGrading=F,c(),F}var ei=class{constructor(t){be(this,"_baseTime",0);be(this,"_playStartMs",null);be(this,"_rate",1);be(this,"_duration",1/0);be(this,"_nowMs");be(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 Ab=100,Cb=8,wb=4096,ma=e=>e;function _b(e,t,n){return!(!!e.curve||e.viaX!==void 0&&e.viaY!==void 0)&&t==="linear"&&!n}function Tb(e){let t=Math.ceil(e*Ab);return Math.min(wb,Math.max(Cb,t))}function Rb(e,t,n,r,i){let{scheduledAt:o,elapsed:a,rate:l}=r,s=i??ma,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(_b(c,n,i))return{kind:"ramp",time:f,value:s(m.v)};let S=Tb(b),y=Os(e,Math.max(c.t,a),m.t,S,n),_=new Float32Array(S);for(let R=0;R<S;R+=1)_[R]=s(y[R]??0);return{kind:"curve",time:p,duration:b,values:_}}function kb(e,t,n,r){let i=[];for(let a=0;a+1<e.points.length;a+=1){let l=Rb(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??ma)(pn(e,n.elapsed,t))}),i}function Fb(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 pa(e){for(let t of e)t.param.cancelScheduledValues(0)}function Yn(e,t){for(let n of e)typeof n.param.cancelAndHoldAtTime=="function"?n.param.cancelAndHoldAtTime(t):n.param.cancelScheduledValues(t)}function ha(e,t,n,r){if(t.points.length!==0)for(let i of e){if(pa([i]),Ps(t)){let o=(i.map??ma)(t.points[0].v);i.param.setValueAtTime(o,r.scheduledAt);continue}Fb(i.param,kb(t,n,r,i.map))}}function dd(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=mn(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=Pi(l.target,t);c&&(ha(u,l,c.scale,r),a.push(...u))}return a}function fd(e){return e.lanes.find(t=>t.target===Lt)??null}var Mb=`\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`,ga=new WeakMap;function ba(e){return md.has(e)}var md=new WeakSet;function xa(e){let t=ga.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(Mb)))}`;await e.audioWorklet.addModule(n),md.add(e)})().catch(n=>{throw ga.delete(e),n}),ga.set(e,t)),t}function Nb(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),ya=e=>e/1e3;function bd(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 xd(e){try{e.stop()}catch{}e.disconnect()}function Sa(e,t){return[{param:e},{param:t,map:n=>1-n}]}function yd(e,t,n){e.gain.value=n,t.gain.value=1-n}function va(e,t,n){return{input:e,output:e,update:t,automation:n,dispose:()=>e.disconnect()}}var Lb=new Set(["peaking","highpass","lowpass"]),pd=e=>Math.pow(10,e/20),Db=(e,t)=>{let n=e.createGain(),r=i=>{n.gain.value=pd(ce(i.gain))};return r(t),va(n,r,{gain:[{param:n.gain,map:pd}]})};function Xn(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),va(i,o,{frequency:[{param:i.frequency}],...Lb.has(e)?{q:[{param:i.Q}]}:{},...t?{gain:[{param:i.gain}]}:{}})}}function Ib(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 va(i,()=>{})}}function ti(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 Pb={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))},Ob=(e,t)=>{let n=e.createWaveShaper(),r=e.createGain(),i=e.createGain();r.connect(n).connect(i);let o=a=>{let l=Pb[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()}}},Hb=(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),yd(a,l,ce(u.mix))};return s(t),{input:n,output:r,update:s,automation:{time:[{param:i.delayTime,map:u=>Math.min(5,ya(u))}],feedback:[{param:o.gain}],mix:Sa(a.gain,l.gain)},dispose:()=>[n,r,i,o,a,l].forEach(u=>u.disconnect())}},Gb=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createDelay(.5),a=bd(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),yd(s,u,ce(m.mix))};return c(t),{input:r,output:i,update:c,automation:{delay:[{param:o.delayTime,map:ya}],depth:[{param:l.gain,map:ya}],speed:[{param:a.playbackRate}],mix:Sa(s.gain,u.gain)},dispose:()=>{xd(a),[r,i,o,l,s,u].forEach(m=>m.disconnect())}}},Bb=6,Ub=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createGain(),a=e.createGain(),l=bd(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<Bb;b++){let S=e.createBiquadFilter();S.type="allpass",S.Q.value=.7071,s.connect(S.frequency),f.connect(S),f=S,m.push(S)}l.connect(s),f.connect(u).connect(a),o.connect(c).connect(a),a.connect(i);let p=b=>{let S=1e3/Math.max(.1,ce(b.delay));for(let y of m)y.frequency.value=S;s.gain.value=S*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:()=>{xd(l),[r,i,o,a,s,u,c,...m].forEach(b=>b.disconnect())}}},Wb=(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=Nb(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())}},Vb={"gain-node":Db,"biquad-peaking":Xn("peaking",!0),"biquad-lowshelf":Xn("lowshelf",!0),"biquad-highshelf":Xn("highshelf",!0),"biquad-highpass":Xn("highpass",!1),"biquad-lowpass":Xn("lowpass",!1),"worklet-compressor":ti("hf-compressor"),"worklet-limiter":ti("hf-limiter"),"worklet-gate":ti("hf-gate"),"worklet-bitcrush":ti("hf-bitcrush"),waveshaper:Ob,"delay-feedback":Hb,"chorus-lfo":Gb,"allpass-phaser":Ub,convolver:Wb};function Sd(e){return e.nodes.some(t=>un(t.type)?.web.startsWith("worklet-")??!1)}function zb(e,t,n,r=0){let i=un(t);if(!i)throw new Error(`Unknown effect type: ${t}`);let o=cn(t,n);if((t==="highpass"||t==="lowpass")&&String(o.poles)==="1")return Ib(t)(e,o,r);let a=Vb[i.web];if(!a)throw new Error(`No Web Audio builder for ${i.web}`);return a(e,o,r)}function hd(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 gd(e){return dn(e).map(t=>{let n=cn(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 vd(e,t,n=0){var m;let r=e.createGain(),i=e.createGain(),o=[],a=[],l=hd(dn(t)),s=r;for(let f of l){let p=null;if(f.preset){let b=e.createGain(),S=e.createGain(),y=e.createGain(),_=e.createGain();y.gain.value=f.amount,S.gain.value=1-f.amount,s.connect(b),b.connect(S).connect(_),p={entry:b,wet:y,dry:S,join:_},s=b}for(let b of f.nodes){let S=zb(e,b.type,b.params??{},n);s.connect(S.input),s=S.output,o.push({...b.id?{id:b.id}:{},type:b.type,handle:S})}p&&f.preset&&(s.connect(p.wet).connect(p.join),a.push({id:f.preset,...p}),s=p.join)}s.connect(i);let u=gd(t),c={};for(let f of a)(c[m=f.id]??(c[m]=[])).push(...Sa(f.wet.gain,f.dry.gain));return{input:r,output:i,presets:c,nodes:o,update(f){if(gd(f)!==u)return!1;dn(f).forEach((b,S)=>{let y=o[S];y&&(y.handle.update(cn(b.type,b.params)),b.id===void 0?delete y.id:y.id=b.id)});let p=0;for(let b of hd(dn(f))){if(!b.preset)continue;let S=a[p++];!S||S.id!==b.preset||(S.wet.gain.value=b.amount,S.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:S}of a)f.disconnect(),p.disconnect(),b.disconnect(),S.disconnect();r.disconnect(),i.disconnect()}}}var Ed={version:1,nodes:[]},Ad={version:1,lanes:[]};function Cd(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(Nt):null)??"";if(!n)return Ad;try{return Is(br(n),t)}catch{return Ad}}function Jn(e){let t=(typeof e.getAttribute=="function"?e.getAttribute(pr):null)??"";if(!t)return{chain:Ed,raw:""};try{return{chain:Ns(t),raw:t}}catch{return{chain:Ed,raw:""}}}function wd(e){return Cd(e,Jn(e).chain)}function _d(e,t,n,r,i){let{chain:o}=Jn(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(Sd(T)&&!ba(e)){n.connect(r);let N=++u;xa(e).then(()=>{s||N!==u||y(Jn(t).chain)}).catch(()=>{});return}try{let N=vd(e,T,F);n.connect(N.input),N.output.connect(r),a=N}catch{n.connect(r)}},f=(T,F)=>{l=F&&a?dd(Cd(t,T),T,a.nodes,F,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}},S=T=>{let F=b();F&&(Yn(l,F.scheduledAt),f(T,F))},y=T=>{let F=b();Yn(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=Jn(t);l.length>0&&pa(l),!a||!a.update(T.chain)?y(T.chain):S(T.chain)}),_.observe(R,{attributes:!0,attributeFilter:[pr,Nt]})),{setRate:T=>{let F=b();s||!F||!Number.isFinite(T)||T<=0||T===F.rate||(p={...F,rate:T},Yn(l,F.scheduledAt),f(Jn(t).chain,p))},dispose:()=>{s=!0,_?.disconnect(),l.length>0&&Yn(l,typeof e.currentTime=="number"?e.currentTime:0),a?.dispose()}}}function Td(e){return!Number.isFinite(e)||e<=0?1:e}function qb(e,t){t||e.paused||!or().__hfDebug||console.debug("[hyperframes] webAudioTransport claimed fallback-playing element:",e.currentSrc||e.getAttribute("src")||"")}function $b(e,t){let{elapsed:n,mediaStart:r,scheduledAt:i,safeRate:o,clipDuration:a}=t,l=Number.isFinite(a)&&a>0,s=a*o;if(n>=0){let c=s-n;return l&&c<=0?!1:(l?e.start(0,n+r,c):e.start(0,n+r),!0)}let u=-n/o;return l?e.start(i+u,r,s):e.start(i+u,r),!0}function jb(e,t,n){let r=fd(wd(e));r&&ha([{param:t.gain}],r,gr.scale,n)}var ni=class{constructor(){be(this,"_ctx",null);be(this,"_bufferCache",new Map);be(this,"_failedSrcs",new Set);be(this,"_activeSources",[]);be(this,"_masterGain",null);be(this,"_rateAnchorCtx",0);be(this,"_rateAnchorComp",0);be(this,"_rate",1);be(this,"_paused",!0);be(this,"_playGeneration",0)}async init(){try{return this._ctx=new AudioContext,this._masterGain=this._ctx.createGain(),this._masterGain.connect(this._ctx.destination),!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 D("webAudioTransport.fetch",new Error(`${i.status} ${n}`)),null;r=await i.arrayBuffer()}catch(i){return D("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),D("webAudioTransport.decode",i),null}}startGeneration(){return this._playGeneration+=1,this._playGeneration}currentGeneration(){return this._playGeneration}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=Td(s),m=this._ctx.createBufferSource();m.buffer=n,m.playbackRate.value=c;let f=this._ctx.createGain();f.gain.value=a;let p=o-r,b=this._ctx.currentTime,S={scheduledAt:b,elapsed:p,rate:c},y=_d(this._ctx,t,m,f,S);if(f.connect(this._masterGain),jb(t,f,S),this._rate=c,this._rateAnchorCtx=b,this._rateAnchorComp=o,!$b(m,{elapsed:p,mediaStart:i,scheduledAt:b,safeRate:c,clipDuration:u}))return m.disconnect(),y?.dispose(),f.disconnect(),null;let _=t.muted;t.muted=!0,qb(t,_);let R={fx:y,el:t,sourceNode:m,gainNode:f,compositionStart:r,mediaStart:i,scheduledAt:b,priorMuted:_,bounded:Number.isFinite(u)&&u>0};return this._activeSources.push(R),this._paused=!1,m.addEventListener("ended",()=>{let T=this._activeSources.indexOf(R);if(T!==-1){this._activeSources.splice(T,1),t.muted=_;try{m.disconnect(),y?.dispose(),f.disconnect()}catch{}this._activeSources.length===0&&(this._paused=!0)}}),R}catch(c){return D("webAudioTransport.schedule",c),null}}setRate(t){let n=Td(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{r.sourceNode.playbackRate.value=n,r.fx?.setRate(n)}catch(i){D("webAudioTransport.setRate",i)}return!0}hasBoundedActiveSources(){return this._activeSources.some(t=>t.bounded)}stopAll(){for(let t of this._activeSources){try{t.sourceNode.stop(),t.sourceNode.disconnect(),t.fx?.dispose(),t.gainNode.disconnect()}catch{}t.el.muted=t.priorMuted}this._activeSources=[],this._paused=!0}setVolume(t){this._masterGain&&(this._masterGain.gain.value=Math.max(0,Math.min(1,t)))}setElementVolume(t,n){let r=Math.max(0,Math.min(1,n));for(let i of this._activeSources)if(i.el===t)try{i.gainNode.gain.value=r}catch(o){D("webAudioTransport.setElementVolume",o)}}setMuted(t){this._masterGain&&(this._masterGain.gain.value=t?0:1)}isActive(){return this._activeSources.length>0&&!this._paused}ownsElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t)}destroy(){if(this.stopAll(),this._bufferCache.clear(),this._failedSrcs.clear(),this._ctx)try{this._ctx.close()}catch{}this._ctx=null,this._masterGain=null}};var Rd="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 Kb=/^\\s*spring\\(\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+))\\s*\\)\\s*$/;function Fd(e){return Math.max(0,Math.min(1,e))}function Md(e){let t=Kb.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?Fd(n):null}function Nd(e,t){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let n=Fd(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 Yb=/^\\s*wiggle\\(\\s*(\\d+)\\s*,\\s*(easeOut|easeInOut|anticipate|uniform)\\s*(?:,\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?)\\s*)?\\)\\s*$/,Xb=Math.PI*2;function Jb(e){let t=Yb.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 Qb(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(Xb*t*e)}function Ld(e,t){let n=Jb(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=>Qb(a,n.wiggles,n.type,n.amplitude);return t?.set(r,o),o}var Zb=24,Dd=e=>e>=1?1:0,ex=e=>e,ri=String.raw`([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?)`,tx=new RegExp(String.raw`^\\s*M\\s*0\\s*,\\s*0\\s+C\\s*${ri}\\s*,\\s*${ri}\\s+${ri}\\s*,\\s*${ri}\\s+1\\s*,\\s*1\\s*$`,"i");function Id(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<Zb;l+=1){let s=(o+a)/2;Id(s,t,r)<e?o=s:a=s}return Id((o+a)/2,n,i)}function rx(e){let t=tx.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 ix(e,t){if(!e.startsWith("spring("))return null;let n=Md(e);if(n===null)return null;let r=t.get(n);if(r)return r;let i=o=>Nd(o,n);return t.set(n,i),i}function ox(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=rx(n);return i&&t.set(n,i),i}function Pd(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"?Dd:Ld(s,i)??ix(s,r)??ox(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)??ex)};e.parseEase=function(u,...c){return a(u,this,c)};let l=e.registerEase;if(typeof l=="function"){l("hold",Dd);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 Ea="data-hf-authored-duration",Aa="data-hf-authored-end",Od=!1;function rt(e){if(e){if(typeof e.pause!="function"){Od||(Od=!0,Ne("timeline_missing_pause",{}));return}try{e.pause()}catch(t){D("runtime.timeline.pause",t)}}}function ax(){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 Hd(){let e=_l();Za(ye),zr(document),na(document);let t=ax();e.canonicalFps=t.fps??e.canonicalFps,Ja(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){D("runtime.init.site1",d)}let c=new ei;e.transportClock=c;let m=new ni,f=!1;m.init().then(d=>{f=d});let p=()=>{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"}),D("runtime.autoMarker.install",h)}},b=()=>{let d=window.gsap;if(!d){u("custom_ease_missing_gsap","custom_ease_install_failed",{reason:"missing_gsap"});return}try{Pd(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"}),D("runtime.customEase.install",g)}};p(),b(),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){D("runtime.init.cssVariables",d)}window.__timelines=window.__timelines||{};let S=()=>{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=S()?.getAttribute("data-composition-id")??"root",h={};if(d.length===1)h[g]=d[0];else for(let x=0;x<d.length;x++)h[`tl-${x}`]=d[x];window.__timelines=h}let y=S();y&&!y.hasAttribute("data-start")&&y.setAttribute("data-start","0");let _=d=>{o.push(d)},R=(d,g,h)=>{let x=h??`${d}:${JSON.stringify(g)}`;a.has(x)||(a.add(x),ye({source:"hf-preview",type:"diagnostic",code:d,details:g}))},T=d=>{let g={scale:1,focusX:960,focusY:540},h=[],x=[],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:()=>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:()=>x,getRenderState:()=>({...C,time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying()})}},F=1/60,N=.75,A=.05,v=100,E=240,w=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??"")}},M=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"}},L=d=>{if(d==null||d.trim()==="")return null;let g=Number.parseFloat(d);return!Number.isFinite(g)||g<=0?null:`${g}px`},H=()=>S(),z=()=>{let d=H();if(!d)return;let g=L(d.getAttribute("data-width")),h=L(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)},j=()=>{let d=H(),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 x=h.getAttribute("data-duration"),C=h.getAttribute("data-end");x!=null&&!h.hasAttribute(Ea)&&h.setAttribute(Ea,x),C!=null&&!h.hasAttribute(Aa)&&h.setAttribute(Aa,C),h.removeAttribute("data-duration"),h.removeAttribute("data-end")}},k=()=>{let d=H();if(!d)return;d.style.position||(d.style.position="relative"),d.style.overflow="hidden";let g=L(d.getAttribute("data-width")),h=L(d.getAttribute("data-height"));g&&(d.style.width=g),h&&(d.style.height=h);let x=Array.from(d.children);for(let C of x){let I=C.tagName.toLowerCase();if(I==="script"||I==="style"||I==="link"||I==="meta"||!C.hasAttribute("data-start")||C.hasAttribute("data-hf-autostamped"))continue;let G=(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(G&&ee&&!C.hasAttribute("data-width")&&!C.hasAttribute("data-height")){let Ce=C.style.top,on=C.style.left,we=C.style.width,an=C.style.height;C.style.top="",C.style.left="",C.style.width="",C.style.height="";let ie=window.getComputedStyle(C);ie.top!=="auto"||ie.bottom!=="auto"||ie.left!=="auto"||ie.right!=="auto"||ie.width!=="0px"||ie.height!=="0px"||(C.style.top=Ce,C.style.left=on,C.style.width=we,C.style.height=an)}let $=window.getComputedStyle(C),le=$.position;if(le!=="absolute"&&le!=="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"),I!=="audio"){let Ce=L(C.getAttribute("data-width")),on=L(C.getAttribute("data-height")),we=$.width!=="0px"&&$.width!=="auto",an=$.height!=="0px"&&$.height!=="auto";Ce?!C.style.width&&!we&&(C.style.width=Ce):!C.style.width&&$.width==="0px"&&(C.style.width="100%"),on?!C.style.height&&!an&&(C.style.height=on):!C.style.height&&$.height==="0px"&&(C.style.height="100%")}}},B=(d,g=0,h)=>lt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:h?.includeAuthoredTimingAttrs??!0}).resolveStartForElement(d,g),Z=(d,g)=>lt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:g?.includeAuthoredTimingAttrs??!0}).resolveDurationForElement(d),U=d=>{let g=d.closest("[data-composition-id]"),h=g?B(g,0):null,x=g?Z(g,{includeAuthoredTimingAttrs:!0}):null;return{compositionRoot:g,inheritedStart:h,inheritedDuration:x}},V=d=>{let g=U(d),h=g.inheritedStart??0,x=Le(d.getAttribute("data-start"));if(d.hasAttribute("data-hf-auto-start")||x==null||h<=0)return B(d,h);let C=Le(d.getAttribute("data-duration")),I=g.inheritedDuration,G=I!=null&&I>0?h+I:null,ee=C!=null&&C>0?x+C:x;return(G==null?x>=h:x<G&&(ee>h||x===h))?x:h+x};window.__hfResolveMediaStartSeconds=V,o.push(()=>{window.__hfResolveMediaStartSeconds===V&&delete window.__hfResolveMediaStartSeconds});let q=(d,g)=>{let h=d.tagName.toLowerCase();if(h==="script"||h==="style"||h==="link"||h==="meta")return!1;let C=h==="video"||h==="audio"?V(d):B(d,0),I=Z(d),G=d.getAttribute("data-composition-id");if(G){let $=(window.__timelines??{})[G],le=null;if($&&typeof $.duration=="function"){let oe=Number($.duration());Number.isFinite(oe)&&oe>0&&(le=oe)}!(d.hasAttribute("data-duration")||d.hasAttribute("data-end")||d.hasAttribute(Ea)||d.hasAttribute(Aa))&&(I==null||I<=0)&&le!=null&&(I=le)}let ee=I!=null&&I>0?C+I:Number.POSITIVE_INFINITY;return g>=C&&(Number.isFinite(ee)?g<ee:!0)},J=!!document.querySelector("[data-composition-src]"),Ae=!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`)){Ae=!0;break}}}let W=!J&&!Ae,P=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}},O=d=>typeof d=="number"&&Number.isFinite(d)&&d>F,de=d=>{let g=Number(d.getAttribute("data-duration"));if(Number.isFinite(g)&&g>0)return g;let h=Number(d.getAttribute("data-playback-start")??d.getAttribute("data-media-start")??"0"),x=Number.isFinite(h)?Math.max(0,h):0;return Number.isFinite(d.duration)&&d.duration>x?Math.max(0,d.duration-x):null},se=()=>{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 x=V(h);if(!Number.isFinite(x))continue;let C=de(h);C==null||C<=F||(g=Math.max(g,Math.max(0,x)+C))}return g>F?g:null},K=()=>{let d=H();if(!d)return null;let g=window.__timelines??{},h=lt({timelineRegistry:g,includeAuthoredTimingAttrs:!0}),x=0,C=Number.parseFloat(d.getAttribute("data-duration")??"");Number.isFinite(C)&&C>0&&(x=C);let I=Array.from(d.querySelectorAll("[data-composition-id][data-start]"));for(let G of I){if(!(G instanceof Element)||G.parentElement?.closest("[data-composition-id]")!==d)continue;let $=h.resolveStartForElement(G,0),le=h.resolveDurationForElement(G);!Number.isFinite($)||le==null||le<=0||(x=Math.max(x,Math.max(0,$)+le))}return x>F?x:null},Y=()=>{let d=se();return typeof d!="number"||!Number.isFinite(d)||d<=F?null:d},X=d=>O(d)?Math.max(F,d*N):F,ze=()=>{let d=0;for(let g of e.deterministicAdapters){let h=g.getInferredDurationSeconds;if(typeof h!="function")continue;let x=null;try{x=h()}catch(C){D("runtime.init.adapterDuration",C)}typeof x=="number"&&Number.isFinite(x)&&x>0&&(d=Math.max(d,x))}return d>F?d:null},he=(d,g=0)=>{let h=P(d),x=Y(),C=K(),I=ze(),G=Math.max(x??0,C??0,I??0),ee=Number.isFinite(g)&&g>F?g:0,$=0;return O(h)?$=Math.max(h,G,ee):O(G)?$=Math.max(G,ee):$=ee,$>0?Math.max(0,$):0},Rt=()=>{let d=window.__timelines??{},g=ie=>{let te=Object.entries(d).filter(ae=>!!ae[1]&&typeof ae[1].play=="function"&&typeof ae[1].pause=="function");if(te.length!==1)return{timeline:null};let pe=te[0];if(!pe)return{timeline:null};let[ge,xe]=pe;return{timeline:xe,selectedTimelineIds:[ge],selectedDurationSeconds:P(xe),diagnostics:{code:"root_timeline_sole_registered_fallback",details:{reason:ie,soleTimelineId:ge}}}},h=lt({timelineRegistry:d,includeAuthoredTimingAttrs:!0}),x=Y(),C=K(),I=Math.max(x??0,C??0)||null,G=X(I),ee=ie=>{let te=document.querySelector(`[data-composition-id="${CSS.escape(ie)}"]`);return te?h.resolveStartForElement(te,0):0},$=ie=>{let te=window.gsap;if(!te||typeof te.timeline!="function")return null;let pe=te.timeline({paused:!0});for(let ge of ie)pe.add(ge.timeline,ee(ge.compositionId));return pe},le=(ie,te)=>{if(!O(ie))return null;let pe=window.gsap;if(!pe||typeof pe.timeline!="function")return null;let ge=pe.timeline({paused:!0});if(te)try{ge.add(te,0)}catch(ae){D("runtime.init.site2",ae)}let xe=ge;if(typeof xe.to=="function")try{xe.to({},{duration:ie})}catch(ae){D("runtime.init.site3",ae)}return ge},Me=(ie,te)=>{let pe=ie;if(typeof pe.getChildren!="function")return[];try{let ge=pe.getChildren(!0,!0,!0)??[];if(!Array.isArray(ge))return[];let xe=[];for(let ae of te)if(!ge.some(Be=>Be===ae.timeline))try{let Be=ee(ae.compositionId);ie.add(ae.timeline,Be),xe.push(ae.compositionId)}catch(Be){D("runtime.init.site4",Be)}return xe}catch{return[]}},oe=H(),re=oe?.getAttribute("data-composition-id")??null;if(!re)return g("root_missing_composition_id");let Ce=d[re]??null,we=(()=>{if(!oe)return[];let ie=new Set,te=Array.from(oe.querySelectorAll("[data-composition-id]")),pe=[];for(let ge of te){let xe=ge.getAttribute("data-composition-id");if(!xe||xe===re||ie.has(xe))continue;ie.add(xe);let ae=d[xe]??null;if(!ae||typeof ae.play!="function"||typeof ae.pause!="function")continue;let ke=P(ae);pe.push({compositionId:xe,timeline:ae,durationSeconds:ke??0})}return pe})(),an=ie=>{for(let te of ie){let pe=te.timeline;if(typeof pe.paused=="function")try{pe.paused(!1)}catch(ge){D("runtime.init.site5",ge)}}};if(we.length>0&&an(we),Ce){let ie=we.length>0?Me(Ce,we):[];if((we.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id=\'"+re+"\'])"))&&(Pe=!0),ie.length>0)try{let ae=Ce.time();Ce.seek(ae,!1)}catch{}let te=P(Ce);if(!O(te)&&we.length>0){let ae=we.map(Bf=>Bf.compositionId),ke=$(we),Be=P(ke);if(ke&&O(Be))return{timeline:ke,selectedTimelineIds:ae,selectedDurationSeconds:Be,mediaDurationFloorSeconds:x,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:re,rootDurationSeconds:te,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:G,selectedDurationSeconds:Be,mediaDurationFloorSeconds:x,authoredCompositionDurationFloorSeconds:C,selectedTimelineIds:ae,autoNestedChildren:ie}}};let vi=le(I??0,Ce),Ei=P(vi);if(vi&&O(Ei))return{timeline:vi,selectedTimelineIds:[re],selectedDurationSeconds:Ei,mediaDurationFloorSeconds:x,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:re,rootDurationSeconds:te,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:x,authoredCompositionDurationFloorSeconds:C,selectedDurationSeconds:Ei,selectedTimelineIds:[re],autoNestedChildren:ie}}}}if(!O(te)&&we.length===0){let ae=le(I??0,Ce),ke=P(ae);if(ae&&O(ke))return{timeline:ae,selectedTimelineIds:[re],selectedDurationSeconds:ke,mediaDurationFloorSeconds:x,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:re,rootDurationSeconds:te,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:x,authoredCompositionDurationFloorSeconds:C,selectedDurationSeconds:ke,selectedTimelineIds:[re]}}}}let pe=oe?.getAttribute("data-duration"),ge=pe?parseFloat(pe):null,xe=Math.max(O(ge)?ge:0,C??0);if(xe>0&&O(xe)&&O(te)&&xe>=te+.5){let ae=Ce;if(typeof ae.to=="function")try{ae.to({},{duration:0},xe)}catch(Be){D("runtime.init.site6",Be)}let ke=P(Ce);if(O(ke))return{timeline:Ce,selectedTimelineIds:[re],selectedDurationSeconds:ke,mediaDurationFloorSeconds:x,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:re,rootDurationSeconds:te,rootDeclaredDur:ge,authoredCompositionDurationFloorSeconds:C,newDur:ke}}}}return{timeline:Ce,selectedTimelineIds:[re],selectedDurationSeconds:te,mediaDurationFloorSeconds:x,diagnostics:ie.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:re,selectedDurationSeconds:te,autoNestedChildren:ie}}:void 0}}if(we.length>0){let ie=we.map(ge=>ge.compositionId),te=$(we),pe=P(te);if(te)return{timeline:te,selectedTimelineIds:ie,selectedDurationSeconds:pe,mediaDurationFloorSeconds:x,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:re,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:G,selectedDurationSeconds:pe,mediaDurationFloorSeconds:x,selectedTimelineIds:ie}}}}return g("root_composition_id_unmatched_in_registry")},Pe=!1,Sf=d=>{let g=window.gsap,h=d;if(!(!h||typeof h.getChildren!="function"||!g||typeof g.parseEase!="function"))for(let x of h.getChildren(!0,!0,!0)){let C=x,I=C.timeline;if(!I||!("_ease"in I)||typeof I._ease=="function")continue;let G=C.vars?.keyframes,$=(G&&!Array.isArray(G)?G.ease:void 0)??C.vars?.ease??"none";try{let le=g.parseEase($);typeof le=="function"&&(I._ease=le)}catch(le){Ne("keyframe_ease_repair_failed",{ease:typeof $=="string"?$:String($)}),D("runtime.keyframeEase.repair",le)}}},Zt=()=>{if(b(),!W)return!1;let d=e.capturedTimeline,g=P(d),h=O(g);if(d&&h&&Pe)return!1;let x=Rt();if(!x.timeline)return!1;if(d&&d===x.timeline)return typeof d.timeScale=="function"&&d.timeScale(e.playbackRate),!1;e.capturedTimeline=x.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate),Sf(e.capturedTimeline);let C=he(e.capturedTimeline,0);if(C<=0&&typeof e.capturedTimeline.progress=="function"&&(e.capturedTimeline.progress(1,!0),e.capturedTimeline.progress(0,!1),rt(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 G=Math.max(0,e.currentTime||0);e.capturedTimeline.totalTime(G,!1),rt(e.capturedTimeline)}let I=window.__hfStudioManualEditsApply;typeof I=="function"&&I(),zr(document)}if(x.diagnostics&&ye({source:"hf-preview",type:"diagnostic",code:x.diagnostics.code,details:x.diagnostics.details}),ye({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:x.selectedTimelineIds??[],selectedDurationSeconds:x.selectedDurationSeconds??null,mediaDurationFloorSeconds:x.mediaDurationFloorSeconds??null}}),window.parent!==window){let I=H(),G=C>0?C:0,ee=String(G>0?G:1),$=new Set,le=new Set(document.querySelectorAll("[data-start]")),Me=oe=>{let re=oe.parentElement;for(;re&&re!==I;){if(le.has(re))return!0;re=re.parentElement}return!1};if(e.capturedTimeline.getChildren)try{for(let oe of e.capturedTimeline.getChildren(!0))if(typeof oe.targets=="function")for(let re of oe.targets())re instanceof HTMLElement&&re!==I&&(re.hasAttribute("data-start")||Me(re)||$.has(re)||($.add(re),re.setAttribute("data-start","0"),re.setAttribute("data-duration",ee),re.setAttribute("data-hf-autostamped","1")))}catch{}if(I instanceof HTMLElement)for(let oe of I.querySelectorAll("[id]"))oe instanceof HTMLElement&&oe!==I&&(oe.hasAttribute("data-start")||Me(oe)||$.has(oe)||oe.tagName==="SCRIPT"||oe.tagName==="STYLE"||oe.tagName==="LINK"||($.add(oe),oe.setAttribute("data-start","0"),oe.setAttribute("data-duration",ee),oe.setAttribute("data-hf-autostamped","1")))}for(let I of en)er.delete(I),Oa(I);return!0};window.__hfForceTimelineRebind=()=>{Pe=!1,Zt(),hi(e.currentTime)};let vf=()=>{let d=H();if(!(d instanceof HTMLElement))return;let g=d.getBoundingClientRect(),h=Number(d.getAttribute("data-width")),x=Number(d.getAttribute("data-height")),C=window.getComputedStyle(d),I=Number.isFinite(h)&&h>0&&Number.isFinite(x)&&x>0,G=g.width<=0||g.height<=0||d.clientWidth<=0||d.clientHeight<=0;!I||!G||R("root_stage_layout_zero",{compositionId:d.getAttribute("data-composition-id")??null,declaredWidth:h,declaredHeight:x,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"}`)},Ef=()=>{e.tornDown||(l!=null&&window.cancelAnimationFrame(l),l=window.requestAnimationFrame(()=>{l=null,vf()}))},Af=()=>{r=d=>{let g=w(d.error??d.message).slice(0,E);if(!g)return;let h=M(g);ye({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=w(d.reason).slice(0,E);if(!g)return;let h=M(g);ye({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)},Cf=()=>{let d=Array.from(document.querySelectorAll("img, video, audio, source, link[rel=\'stylesheet\']"));for(let h of d){let x=()=>{if(!(h instanceof Element))return;let C=h.tagName.toLowerCase(),I=h.getAttribute("src")??h.getAttribute("href")??h.getAttribute("poster")??null,G=C==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";R(G,{tagName:C,assetUrl:I,currentSrc:(h instanceof HTMLImageElement||h instanceof HTMLMediaElement)&&h.currentSrc||null,readyState:h instanceof HTMLMediaElement?h.readyState:null,networkState:h instanceof HTMLMediaElement?h.networkState:null},`${G}:${C}:${I??"unknown"}`)};h.addEventListener("error",x),_(()=>{h.removeEventListener("error",x)})}let g=document.fonts;g&&g.ready.then(()=>{if(e.tornDown)return;let h=Array.from(g).filter(x=>x.status==="error").map(x=>x.family).filter(x=>!!x).slice(0,10);h.length!==0&&R("runtime_font_load_issue",{failedFamilies:h,totalFaces:Array.from(g).length},`runtime-font-load-issue:${h.join("|")}`)}).catch(()=>{})},wf=(d,g)=>{if(!d.timeline)return!1;let h=e.capturedTimeline;if(h&&h===d.timeline)return!1;let x=Math.max(0,e.currentTime||0),C=e.isPlaying;e.capturedTimeline=d.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);try{rt(e.capturedTimeline),typeof e.capturedTimeline.seek=="function"&&e.capturedTimeline.seek(x,!1),C&&typeof e.capturedTimeline.play=="function"&&e.capturedTimeline.play()}catch(I){D("runtime.init.site7",I)}return ye({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:g,previousTime:x,selectedTimelineIds:d.selectedTimelineIds??[],selectedDurationSeconds:d.selectedDurationSeconds??null,mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),!0},bt=null,La=!1,Da=!1,en=new Set,er=new WeakMap,tr=()=>{e.tornDown||(bt!=null&&window.clearTimeout(bt),bt=window.setTimeout(()=>{if(e.tornDown||(bt=null,Da&&window.__HF_EXPORT_RENDER_SEEK_CONFIG))return;let d=Rt();if(!d.timeline||!O(d.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){Zt()&&(xt(),Fe(!0));return}if(La)return;let h=P(e.capturedTimeline),x=d.selectedDurationSeconds??P(d.timeline);O(x)&&(!O(h)||x>=h+A)&&wf(d,"manual")&&(La=!0,ye({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:h??null,selectedDurationSeconds:x??null,selectedTimelineIds:d.selectedTimelineIds??[],mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),xt(),Fe(!0))},v))},Ia=d=>{d.currentTarget instanceof HTMLMediaElement&&js(d.currentTarget)},Pa=d=>{d.currentTarget instanceof HTMLMediaElement&&Ks(d.currentTarget)},_f=()=>{for(let d of en)d.removeEventListener("loadedmetadata",tr),d.removeEventListener("durationchange",tr),d.removeEventListener("loadedmetadata",Ia),d.removeEventListener("error",Pa);en.clear()},di=()=>{if(e.tornDown)return;let d=Array.from(document.querySelectorAll("video, audio"));for(let g of d){if(en.has(g))continue;en.add(g);let h=Number.parseFloat(g.dataset.volume??"");Number.isFinite(h)&&(g.volume=Math.max(0,Math.min(1,h))),g.addEventListener("loadedmetadata",tr),g.addEventListener("durationchange",tr),g.addEventListener("loadedmetadata",Ia),g.addEventListener("error",Pa),$s(g),g.preload!=="auto"&&(g.preload="auto"),g.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&g.load(),Oa(g)}},Oa=d=>{er.has(d)||Rs(d,e.capturedTimeline,he(e.capturedTimeline,0),er,{allowLiveTimelineSeek:!window.__HF_RENDER_CAPTURE_MODE})},fi=new WeakMap,Ha=d=>{let g=fi.get(d);if(g!==void 0)return g;let h=window.getComputedStyle(d).position,x=h==="static"||h==="relative"||h==="sticky";return fi.set(d,x),x},mi=new WeakMap,Tf=d=>{let g=mi.get(d);if(g!==void 0)return g;let h=d.querySelector("[data-start]")===null;return mi.set(d,h),h},Rf=()=>{fi=new WeakMap,mi=new WeakMap},pi=new WeakMap,nr=new WeakSet,hi=(d,g=Array.from(document.querySelectorAll("[data-start]")))=>{let h=H();for(let x of g){if(!(x instanceof HTMLElement))continue;if(x.hasAttribute("data-hidden")){nr.has(x)||(pi.set(x,x.style.getPropertyValue("display")),nr.add(x)),x.style.display="none",(x instanceof HTMLVideoElement||x instanceof HTMLImageElement)&&n?.setSourceVisibility(x,!1);continue}if(nr.has(x)){let I=pi.get(x);I?x.style.display=I:x.style.removeProperty("display"),pi.delete(x),nr.delete(x)}let C=q(x,d);if(C){let I=x.parentElement;for(;I&&I!==h;){if(I instanceof HTMLElement&&I.hasAttribute("data-start")&&!q(I,d)){C=!1;break}I=I.parentElement}}x.style.visibility=C?"visible":"hidden",(x instanceof HTMLVideoElement||x instanceof HTMLImageElement)&&n?.setSourceVisibility(x,C),C?Ha(x)&&x.style.removeProperty("display"):Ha(x)&&Tf(x)&&(x.style.display="none")}},Oe=()=>{let d=Us({shouldIncludeElement:h=>h.hasAttribute("data-start")||!!U(h).compositionRoot,resolveStartSeconds:h=>V(h),resolveDurationSeconds:h=>{let x=U(h),C=V(h),I=Number.parseFloat(h.dataset.playbackStart??h.dataset.mediaStart??"0")||0,G=x.inheritedStart!=null&&x.inheritedDuration!=null&&x.inheritedDuration>0?Math.max(0,x.inheritedStart+x.inheritedDuration-C):null,ee=Number.isFinite(h.duration)&&h.duration>I?Math.max(0,h.duration-I):null,$=Number.parseFloat(h.dataset.duration??""),le=Number.isFinite($)&&$>0?$:null;return Bs({isVideo:h.tagName==="VIDEO",sourceDuration:ee,hostRemaining:G,explicitDuration:le})}});for(let h of d.mediaClips){let x=er.get(h.el);x&&(h.volumeKeyframes=x)}let g=e.mediaForceSyncNextTick;g&&(e.mediaForceSyncNextTick=!1),e.nativeMediaSyncDisabled||Ws({clips:d.mediaClips,timeSeconds:e.currentTime,playing:e.isPlaying,playbackRate:e.playbackRate,outputMuted:e.mediaOutputMuted||!e.webAudioMediaDisabled&&!e.nativeMediaSyncDisabled&&m.isActive(),userMuted:e.bridgeMuted,userVolume:e.bridgeVolume,forceSync:g,onElementVolume:(h,x)=>m.setElementVolume(h,x),isWebAudioOwned:h=>m.ownsElement(h),onAutoplayBlocked:()=>{e.mediaAutoplayBlockedPosted||(e.mediaAutoplayBlockedPosted=!0,ye({source:"hf-preview",type:"media-autoplay-blocked"}))}}),hi(e.currentTime)},Fe=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,ye({source:"hf-preview",type:"state",frame:g,isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},gi="",Ga=0,kf=()=>{let d="";for(let g of document.querySelectorAll("[data-start]"))d+=`${g.id}:${g.tagName}|`;return d},xt=()=>{j(),z(),k();let d=H();if(d){let x=L(d.getAttribute("data-width")),C=L(d.getAttribute("data-height")),I=x?parseInt(x,10):0,G=C?parseInt(C,10):0;I>0&&G>0&&ye({source:"hf-preview",type:"stage-size",width:I,height:G})}Zt();let g=Dl({canonicalFps:e.canonicalFps});window.__clipManifest=g;let h=kf();if(gi!==h&&Rf(),!window.__clipTree||gi!==h){let x=window;window.__clipTree=Tl({startResolver:lt({timelineRegistry:x.__timelines??{},includeAuthoredTimingAttrs:!0}),timelineRegistry:x.__timelines??{},rootDuration:g.durationInFrames/e.canonicalFps}),gi=h}ye(g),Ef()},bi=d=>Number.isFinite(d)&&d>0?d:0,Ff=d=>{let g=bi(Number(d));if(g<=0)return;let h=H(),x=bi(Number.parseFloat(h?.getAttribute("data-duration")??"")),C=Math.max(Ga,bi(c.getDuration()),x);g<=C||(Ga=g,h?.setAttribute("data-duration",String(g)),c.setDuration(g),xt(),Fe(!0))},He=(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(x){D("runtime.init.site8",x)}if(d==="discover")try{h.seek({time:g,suppressEvents:!0})}catch(x){D("runtime.init.site9",x)}}},yt=()=>{window.__renderReady=!1},tn=null,nn=!0,Mf=()=>{let d=[];for(let g of e.deterministicAdapters){let h=g.getReadyPromise;if(typeof h=="function")try{let x=h();x&&d.push(x)}catch(x){D("runtime.init.adapterReady",x)}}return d},Nf=()=>{let d=Mf();if(d.length===0)return tn=null,nn=!0,!0;let g=d[0];if(!g)return!0;let h=d.length===1?g:Promise.all(d);return h!==tn&&(tn=h,nn=!1,Promise.resolve(h).then(()=>{tn===h&&(nn=!0,yt())},x=>{tn===h&&(nn=!0,D("runtime.init.adapterReady",x),yt())})),nn};if(W)Xo();else{let d={injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,injectedLinks:e.injectedCompLinks,parseDimensionPx:L,onDiagnostic:({code:g,details:h})=>{ye({source:"hf-preview",type:"diagnostic",code:g,details:h})}};wc(d).then(()=>Cc(d)).finally(()=>{W=!0,di(),Cf(),Xo(),na(document),yt()})}let rr=El({postMessage:d=>ye(d)});rr.installPickerApi(),hi(e.currentTime,Array.from(document.querySelectorAll("video[data-start], img[data-start]")));let qe=cd();n=qe,_(()=>{qe.destroy(),n=null});let xi=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 x of h)if(x instanceof HTMLMediaElement)try{x.playbackRate=e.playbackRate}catch(C){D("runtime.init.site10",C)}},Ba={play:()=>{let d=e.capturedTimeline;if(c.isPlaying())return;let g=he(d,0);if(g>0)c.setDuration(g),c.reachedEnd()&&(c.seek(0),e.currentTime=0,St(0));else{let h=H(),x=Number(h?.getAttribute("data-duration")??0);x>0&&c.setDuration(x)}rt(d),c.play()&&(e.isPlaying=!0,e.mediaForceSyncNextTick=!0,$a(c.now()),f&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&ja(),He("play"),Oe(),qe.redraw(),Fe(!0))},pause:()=>{if(!c.isPlaying())return;m.stopAll(),c.detachAudioSource(),c.pause(),e.isPlaying=!1,e.currentTime=c.now(),e.mediaForceSyncNextTick=!0,$a(e.currentTime);let d=e.capturedTimeline;rt(d),He("pause"),Oe(),qe.redraw(),Fe(!0)},seek:(d,g)=>{let h=Bt(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),c.detachAudioSource();let x=c.isPlaying();x&&c.pause(),c.seek(h),e.currentTime=c.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0;let C=e.capturedTimeline;if(rt(C),St(e.currentTime),He("pause"),g?.keepPlaying&&x){Ba.play();return}Oe(),qe.redraw(),Fe(!0)},renderSeek:(d,g)=>{Da=!0;let h=Bt(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,St(e.currentTime,{activateChildren:!0,suppressEvents:g?.suppressEvents}),He("pause"),Oe(),qe.redraw(),Fe(!0)},getTime:()=>c.now(),getDuration:()=>{let d=c.getDuration();return Number.isFinite(d)?d:0},isPlaying:()=>c.isPlaying(),setPlaybackRate:d=>{xi(d),c.setRate(e.playbackRate),Ka()},getPlaybackRate:()=>e.playbackRate},Ua=he(e.capturedTimeline,0);Ua>0&&c.setDuration(Ua);let Ge=wl({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:xi,getCanonicalFps:()=>e.canonicalFps,onSyncMedia:(d,g)=>{e.currentTime=Math.max(0,Number(d)||0),e.isPlaying!==g&&(e.mediaForceSyncNextTick=!0),e.isPlaying=g,Oe()},onStatePost:Fe,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(x){D("runtime.init.site11",x)}},onDeterministicPause:()=>He("pause"),onDeterministicPlay:()=>He("play"),onRenderFrameSeek:()=>{qe.redraw()},onShowNativeVideos:()=>{},getSafeDuration:()=>he(e.capturedTimeline,0),transport:Ba});window.__player=T(Ge),window.__playerReady=!0,Ne("composition_loaded",{duration:Ge.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),e.deterministicAdapters=[ws(),ls({resolveStartSeconds:d=>B(d,0)}),cs(),fs(),hs(),gs(),bs(),xs(),ys(),Ss(),vs(),us({getTimeline:()=>e.capturedTimeline})],As(),Cs(),window.__hfReseekGpu=d=>{let g=Math.max(0,Number(d)||0);window.__hfThreeTime=g,window.__hfTypegpuTime=g,dr(g)},window.__hfWaitForSeekCompletion=Li,o.push(()=>{window.__hfWaitForSeekCompletion===Li&&delete window.__hfWaitForSeekCompletion}),Af(),di(),He("discover");let Lf=()=>{let d=e.capturedTimeline,g=Zt();e.capturedTimeline&&(g||e.capturedTimeline!==d||!Ge._timeline)&&(Ge._timeline=e.capturedTimeline);let h=he(e.capturedTimeline,0);if(h>0&&c.setDuration(h),He("discover",e.currentTime),!e.capturedTimeline){let x=window.__timelines??{},C=Object.keys(x).filter(I=>x[I]);if(C.length>0){let G=H()?.getAttribute("data-composition-id")??null;R("root_timeline_unbound_registry_present",{reason:G?"root data-composition-id has no matching key in window.__timelines":"root composition element has no data-composition-id attribute",rootCompositionId:G,registeredTimelineKeys:C},"root_timeline_unbound_registry_present"),console.warn("[hyperframes] Root timeline not bound \\u2014 render will freeze at t=0. "+(G?`Root data-composition-id is "${G}" 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["${G??"<root-id>"}"] = tl).`)}}window.__renderReady=!0,xt(),Fe(!0)},kt=null,Df=()=>{if(kt)return;let d=()=>{window.removeEventListener("hf-timelines-built",d),kt=null,yt()};kt=d,window.addEventListener("hf-timelines-built",d)};_(()=>{kt&&(window.removeEventListener("hf-timelines-built",kt),kt=null)}),yt=()=>{if(!W){window.__renderReady=!1;return}if(window.__hfTimelinesBuilding){window.__renderReady=!1,Df();return}if(He("discover",e.currentTime),!Nf()){window.__renderReady=!1;return}Lf()},yt(),W&&setTimeout(()=>{yt()},0);let ir=0,yi=!1,If=(d,g,h,x)=>{try{let C=x?.suppressEvents===!0;rt(d),typeof d.totalTime=="function"?d.totalTime(g,C):d.seek(g,C)}catch(C){D(h,C)}},Pf=(d,g)=>{let h=window.__timelines??{},x=H()?.getAttribute("data-composition-id")??null;for(let[C,I]of Object.entries(h)){if(!I||C===x)continue;let G=document.querySelector(`[data-composition-id="${CSS.escape(C)}"]`);if(!G)continue;let ee=B(G,0);if(!Number.isFinite(ee))continue;let $=P(I),le=Pt(G)+Math.max(0,d-ee)*je(G),Me=Math.max(0,$!=null&&$>0?Math.min($,le):le);If(I,Me,"runtime.init.transport.childTimeline",g)}},Wa=d=>{let g=window.__timelines??{};for(let h of Object.values(g))if(!(!h||h===d))try{h.play()}catch(x){D("runtime.init.activateSiblings",x)}},Va=d=>typeof d=="object"&&d!==null,rn=new WeakMap,Of=["onStart","onUpdate","onComplete","onReverseComplete","onRepeat"],za=(d,g)=>{let h=d[g];if(typeof h!="function")return null;try{let x=Number(h.call(d));return Number.isFinite(x)?x:null}catch(x){return D("runtime.init.gsapCallbackDuration",x),null}},Hf=d=>{let g=rn.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(x){return D("runtime.init.gsapCallbackChildren",x),rn.set(d,!1),!1}if(!Array.isArray(h))return rn.set(d,!1),!1;for(let x of h){if(!Va(x))continue;let C=x.vars;if(!Va(C)||!Of.some($=>typeof C[$]=="function"))continue;let ee=za(x,"totalDuration")??za(x,"duration");if(ee!=null&&ee<=1e-6)return rn.set(d,!0),!0}return rn.set(d,!1),!1};function St(d,g){let h=e.capturedTimeline,x=g?.suppressEvents===!0;if(h){g?.activateChildren&&Wa(h);let C=h,I=d;if(typeof C.totalDuration=="function")try{let G=Number(C.totalDuration());Number.isFinite(G)&&G>0&&d>G&&(I=G)}catch(G){D("runtime.init.transport.clampDuration",G)}try{typeof h.totalTime=="function"?(h.totalTime(I,x),!x&&!Hf(h)&&(h.totalTime(I+.001,!0),h.totalTime(I,!0))):h.seek(I,x)}catch(G){D("runtime.init.transport.seek",G)}}Pf(d,g),h&&g?.activateChildren&&Wa(h);for(let C of e.deterministicAdapters)if(!(C.name==="gsap"&&h))try{C.seek({time:d,suppressEvents:x})}catch(I){D("runtime.init.transport.adapter",I)}}let Gf=()=>{try{return document.querySelector(`[${Rd}]`)!=null}catch{return!1}},qa=()=>{if(!(e.tornDown||yi)){yi=!0;try{if(e.transportRafId=window.requestAnimationFrame(qa),ir+=1,kd({tick:ir,isPlaying:c.isPlaying(),hasCapturedTimeline:e.capturedTimeline!=null,currentTimeSeconds:c.now()})){let g=e.capturedTimeline;if(Zt()){e.capturedTimeline&&!Ge._timeline&&(Ge._timeline=e.capturedTimeline),e.capturedTimeline&&e.capturedTimeline!==g&&rt(e.capturedTimeline);let h=he(e.capturedTimeline,0);h>0&&c.setDuration(h),xt()}}if(ir%20===0&&xt(),ir%30===0&&di(),e.capturedTimeline){let g=he(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 x of g){if(!(x instanceof HTMLMediaElement)||!x.isConnected)continue;let C=Number.parseFloat(x.dataset.start??""),I=Number.parseFloat(x.dataset.duration??""),G=Number.isFinite(I)&&I>0?C+I:1/0,ee=Number.parseFloat(x.dataset.playbackStart??x.dataset.mediaStart??"0")||0;if(Number.isFinite(C)&&e.currentTime>=C&&e.currentTime<G){x.paused?!x.error&&x.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&(c.attachAudioSource({currentTimeSeconds:e.currentTime}),h=!0):(c.attachAudioSource({el:x,compositionStart:C,mediaStart:ee}),h=!0);break}}!h&&c.hasAudioSource()&&c.detachAudioSource()}else c.hasAudioSource()&&c.detachAudioSource();let d=c.now();if(e.currentTime=d,(c.isPlaying()||!Gf())&&St(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,St(g)),He("pause"),Oe(),Fe(!0);return}c.isPlaying()&&Oe(),Fe(!1)}finally{yi=!1}}},$a=d=>{let g=document.querySelectorAll("video, audio");for(let h of g){if(!(h instanceof HTMLMediaElement)||!h.isConnected)continue;let x=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(x))continue;let C=Number.parseFloat(h.dataset.duration??""),I=Number.isFinite(C)&&C>0?x+C:1/0;if(d<x||d>=I)continue;let G=Number.parseFloat(h.dataset.playbackStart??h.dataset.mediaStart??"0")||0,ee=d-x+G;if(ee>=0)try{h.currentTime=ee}catch{}}},ja=()=>{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)continue;let x=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(x))continue;let C=Number.parseFloat(h.dataset.playbackStart??h.dataset.mediaStart??"0")||0,I=Number.parseFloat(h.dataset.volume??""),G=Number.isFinite(I)?I:1,ee=Number.parseFloat(h.dataset.duration??""),$=Number.isFinite(ee)&&ee>0?ee:Number.POSITIVE_INFINITY,le=h.closest("[data-composition-id]");if(le){let Me=B(le,0),oe=Z(le,{includeAuthoredTimingAttrs:!0});oe!=null&&oe>0&&($=Math.min($,Math.max(0,Me+oe-x)))}m.decodeAudioElement(h).then(Me=>{!Me||!c.isPlaying()||m.schedulePlayback(h,Me,x,C,c.now(),G*e.bridgeVolume,d,e.playbackRate,$)})}};function Ka(){m.setRate(e.playbackRate)&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&f&&c.isPlaying()&&m.hasBoundedActiveSources()&&(m.stopAll(),ja())}if(e.capturedTimeline){let d=he(e.capturedTimeline,0);d>0&&c.setDuration(d),rt(e.capturedTimeline)}Mc(window),e.transportRafId=window.requestAnimationFrame(qa),xt(),Fe(!0),e.controlBridgeHandler=Qa({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 x of h)x instanceof HTMLMediaElement&&(x.muted=g||x.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 x=parseFloat(h.dataset.volume??""),C=Number.isFinite(x)?x:1;h.volume=C*d}},onSetMediaOutputMuted:d=>{e.mediaOutputMuted=d;let g=d||e.bridgeMuted;m.setMuted(g);let h=document.querySelectorAll("video, audio");for(let x of h)x instanceof HTMLMediaElement&&(x.muted=g||x.defaultMuted)},onSetNativeMediaSyncDisabled:d=>{e.nativeMediaSyncDisabled!==d&&(e.nativeMediaSyncDisabled=d,e.mediaForceSyncNextTick=!0,d?(m.stopAll(),c.detachAudioSource()):Oe())},onSetWebAudioMediaDisabled:d=>{e.webAudioMediaDisabled!==d&&(e.webAudioMediaDisabled=d,e.mediaForceSyncNextTick=!0,d&&(m.stopAll(),c.detachAudioSource()),Oe())},onSetPlaybackRate:d=>{xi(d),e.transportClock&&e.transportClock.setRate(e.playbackRate),Ka()},onSetRootDuration:Ff,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,St(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,St(g)),He("pause"),Oe(),Fe(!0)}},onEnablePickMode:()=>rr.enablePickMode(),onDisablePickMode:()=>rr.disablePickMode(),getCanonicalFps:()=>e.canonicalFps});let Si=()=>{if(!e.tornDown){e.tornDown=!0,e.transportRafId!=null&&(window.cancelAnimationFrame(e.transportRafId),e.transportRafId=null),e.transportClock=null,m.destroy(),bt!=null&&(window.clearTimeout(bt),bt=null),l!=null&&(window.cancelAnimationFrame(l),l=null),_f(),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),rr.disablePickMode();for(let d of e.deterministicAdapters)if(!(!d||typeof d.revert!="function"))try{d.revert()}catch(g){D("runtime.init.site12",g)}e.deterministicAdapters=[];for(let d of o.splice(0))try{d()}catch(g){D("runtime.init.site13",g)}for(let d of e.injectedCompStyles)try{d.remove()}catch(g){D("runtime.init.site14",g)}e.injectedCompStyles=[];for(let d of e.injectedCompLinks)try{d.remove()}catch(g){D("runtime.init.site15",g)}e.injectedCompLinks=[];for(let d of e.injectedCompScripts)try{d.remove()}catch(g){D("runtime.init.site16",g)}e.injectedCompScripts=[],e.capturedTimeline=null,window.__hfRuntimeTeardown===Si&&(window.__hfRuntimeTeardown=null)}};window.__hfRuntimeTeardown=Si,e.beforeUnloadHandler=Si,window.addEventListener("beforeunload",e.beforeUnloadHandler)}var Gd=["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"],Ca=[[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 sx(e){if(e<=255)return Gd[e];let t=0,n=Ca.length-1;for(;t<=n;){let r=t+n>>1,i=Ca[r];if(e<i[0]){n=r-1;continue}if(e>i[1]){t=r+1;continue}return i[2]}return"L"}function lx(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=sx(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 S=u;S<c;S++)n[S]=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 Bd(e,t){let n=lx(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 ux=/[ \\t\\n\\r\\f]+/g,cx=/[\\t\\n\\r\\f]| {2,}|^ | $/;function dx(e){let t=e??"normal";return t==="pre-wrap"?{mode:t,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:t,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function fx(e){if(!cx.test(e))return e;let t=e.replace(ux," ");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 mx(e){return/[\\r\\f]/.test(e)?e.replace(/\\r\\n/g,`\n`).replace(/[\\r\\f]/g,`\n`):e.replace(/\\r\\n/g,`\n`)}var wa=null,px;function hx(){return wa===null&&(wa=new Intl.Segmenter(px,{granularity:"word"})),wa}var gx=/\\p{Script=Arabic}/u,ii=/\\p{M}/u,Kd=/\\p{Nd}/u;function Ud(e){return gx.test(e)}function Wd(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 Ve(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(Wd(i))return!0;t++;continue}}if(Wd(n))return!0}}return!1}function bx(e){let t=si(e);return t!==null&&(ai.has(t)||pt.has(t))}var xx=new Set(["\\xA0","\\u202F","\\u2060","\\uFEFF"]);function yx(e){return Ve(e)}function Sx(e){let t=si(e);return t!==null&&xx.has(t)}function oi(e){return!bx(e)&&!Sx(e)}var ai=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"]),Zn=new Set([\'"\',"(","[","{","\\u201C","\\u2018","\\xAB","\\u2039","\\uFF08","\\u3014","\\u3008","\\u300A","\\u300C","\\u300E","\\u3010","\\u3016","\\u3018","\\u301A"]),Ta=new Set(["\'","\\u2019"]),pt=new Set([".",",","!","?",":",";","\\u060C","\\u061B","\\u061F","\\u0964","\\u0965","\\u104A","\\u104B","\\u104C","\\u104D","\\u104F",")","]","}","%",\'"\',"\\u201D","\\u2019","\\xBB","\\u203A","\\u2026"]),vx=new Set([":",".","\\u060C","\\u061B"]),Ex=new Set(["\\u104F"]),Ax=new Set(["\\u201D","\\u2019","\\xBB","\\u203A","\\u300D","\\u300F","\\u3011","\\u300B","\\u3009","\\u3015","\\uFF09"]);function Cx(e){if(Ra(e))return!0;let t=!1;for(let n of e){if(pt.has(n)){t=!0;continue}if(!(t&&ii.test(n)))return!1}return t}function wx(e){for(let t of e)if(!ai.has(t)&&!pt.has(t))return!1;return e.length>0}function _x(e){if(Ra(e))return!0;for(let t of e)if(!Zn.has(t)&&!Ta.has(t)&&!ii.test(t))return!1;return e.length>0}function Ra(e){let t=!1;for(let n of e)if(!(n==="\\\\"||ii.test(n))){if(Zn.has(n)||pt.has(n)||Ta.has(n)){t=!0;continue}return!1}return t}function Yd(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 si(e){if(e.length===0)return null;let t=Yd(e,e.length);return e.slice(t)}function Tx(e){let t=Array.from(e),n=t.length;for(;n>0;){let r=t[n-1];if(ii.test(r)){n--;continue}if(Zn.has(r)||Ta.has(r)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function Rx(e,t,n){return n==="text"&&!t&&e.length===1&&e!=="-"&&e!=="\\u2014"?e:null}function Vd(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 zd(e,t){return e&&t!==null&&vx.has(t)}function kx(e){let t=si(e);return t!==null&&Ex.has(t)}function Fx(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 li(e){let t=e.length;for(;t>0;){let n=Yd(e,t),r=e.slice(n,t);if(Ax.has(r))return!0;if(!pt.has(r))return!1;t=n}return!1}function Mx(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 Nx=/[\\x20\\t\\n\\xA0\\xAD\\u200B\\u202F\\u2060\\uFEFF]/;function Ie(e){return e.length===1?e[0]:e.join("")}function Lx(e,t){let n=[];for(let r=e.length-1;r>=0;r--)n.push(e[r]);return n.push(t),Ie(n)}function Dx(e,t,n,r){if(!Nx.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=Mx(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 _a(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}var Ix=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function Px(e,t){let n=e.texts[t];return n.startsWith("www.")?!0:Ix.test(n)&&t+1<e.len&&e.kinds[t+1]==="text"&&e.texts[t+1]==="//"}function Ox(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}function Hx(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"||!Px(e,a))continue;let l=[t[a]],s=a+1;for(;s<e.len&&!_a(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 Gx(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]),!Ox(a))continue;let l=o+1;if(l>=e.len||_a(e.kinds[l]))continue;let s=[],u=e.starts[l],c=l;for(;c<e.len&&!_a(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 Bx=new Set([":","-","/","\\xD7",",",".","+","\\u2013","\\u2014"]),qd=/^[A-Za-z0-9_]+[,:;]*$/,$d=/[,:;]+$/;function Xd(e){for(let t of e)if(Kd.test(t))return!0;return!1}function Qn(e){if(e.length===0)return!1;for(let t of e)if(!(Kd.test(t)||Bx.has(t)))return!1;return!0}function Ux(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"&&Qn(a)&&Xd(a)){let s=[a],u=o+1;for(;u<e.len&&e.kinds[u]==="text"&&Qn(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 Wx(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&&qd.test(a)){let u=[a],c=$d.test(a),m=o+1;for(;c&&m<e.len&&e.kinds[m]==="text"&&e.isWordLike[m]&&qd.test(e.texts[m]);){let f=e.texts[m];u.push(f),c=$d.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 Vx(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||!Xd(c)||!Qn(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 zx(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 qx(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"||!Ve(t[o])||!Ve(t[o+1]))continue;let a=Tx(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 jd(e,t,n){let r=hx(),i=0,o=[],a=[],l=[],s=[],u=[],c=[],m=[],f=[],p=[],b=[],S=[],y=[];for(let A of r.segment(e))for(let v of Dx(A.segment,A.isWordLike??!1,A.index,n)){let B=function(){c[k]!==null&&(a[k]=[Vd(o,c,m,k)],c[k]=null),a[k].push(v.text),l[k]=l[k]||v.isWordLike,f[k]=f[k]||M,p[k]=p[k]||L,b[k]=z,S[k]=j,y[k]=zd(p[k],H)},E=v.kind==="text",w=Rx(v.text,v.isWordLike,v.kind),M=Ve(v.text),L=Ud(v.text),H=si(v.text),z=li(v.text),j=kx(v.text),k=i-1;t.carryCJKAfterClosingQuote&&E&&i>0&&s[k]==="text"&&M&&f[k]&&b[k]||E&&i>0&&s[k]==="text"&&wx(v.text)&&f[k]||E&&i>0&&s[k]==="text"&&S[k]?B():E&&i>0&&s[k]==="text"&&v.isWordLike&&L&&y[k]?(B(),l[k]=!0):w!==null&&i>0&&s[k]==="text"&&c[k]===w?m[k]=(m[k]??1)+1:E&&!v.isWordLike&&i>0&&s[k]==="text"&&(Cx(v.text)||v.text==="-"&&l[k])?B():(o[i]=v.text,a[i]=[v.text],l[i]=v.isWordLike,s[i]=v.kind,u[i]=v.start,c[i]=w,m[i]=w===null?0:1,f[i]=M,p[i]=L,b[i]=z,S[i]=j,y[i]=zd(L,H),i++)}for(let A=0;A<i;A++){if(c[A]!==null){o[A]=Vd(o,c,m,A);continue}o[A]=Ie(a[A])}for(let A=1;A<i;A++)s[A]==="text"&&!l[A]&&Ra(o[A])&&s[A-1]==="text"&&(o[A-1]+=o[A],l[A-1]=l[A-1]||l[A],o[A]="");let _=Array.from({length:i},()=>null),R=-1;for(let A=i-1;A>=0;A--){let v=o[A];if(v.length!==0){if(s[A]==="text"&&!l[A]&&_x(v)&&R>=0&&s[R]==="text"){let E=_[R]??[];E.push(v),_[R]=E,u[R]=u[A],o[A]="";continue}R=A}}for(let A=0;A<i;A++){let v=_[A];v!=null&&(o[A]=Lx(v,o[A]))}let T=0;for(let A=0;A<i;A++){let v=o[A];v.length!==0&&(T!==A&&(o[T]=v,l[T]=l[A],s[T]=s[A],u[T]=u[A]),T++)}o.length=T,l.length=T,s.length=T,u.length=T;let F=zx({len:T,texts:o,isWordLike:l,kinds:s,starts:u}),N=qx(Wx(Vx(Ux(Gx(Hx(F))))));for(let A=0;A<N.len-1;A++){let v=Fx(N.texts[A]);v!==null&&(N.kinds[A]!=="space"&&N.kinds[A]!=="preserved-space"||N.kinds[A+1]!=="text"||!Ud(N.texts[A+1])||(N.texts[A]=v.space,N.isWordLike[A]=!1,N.kinds[A]=N.kinds[A]==="preserved-space"?"preserved-space":"space",N.texts[A+1]=v.marks+N.texts[A+1],N.starts[A+1]=N.starts[A]+v.space.length))}return N}function $x(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 jx(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],S=e.starts[m];if(p==="text"){let y=yx(f),_=oi(f);if(o!==null&&s&&u){o.push(f),a=a||b,s=s||y,u=_;continue}c(),o=[f],a=b,l=S,s=y,u=_;continue}c(),t.push(f),n.push(b),r.push(p),i.push(S)}return c(),{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function Jd(e,t,n="normal",r="normal"){let i=dx(n),o=i.mode==="pre-wrap"?mx(e):fx(e);if(o.length===0)return{normalized:o,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let a=r==="keep-all"?jx(jd(o,t,i)):jd(o,t,i);return{normalized:o,chunks:$x(a,i),...a}}var Jt=null,Qd=new Map,Qt=null,Kx=96,Yx=/\\p{Emoji_Presentation}/u,Xx=/[\\p{Emoji_Presentation}\\p{Extended_Pictographic}\\p{Regional_Indicator}\\uFE0F\\u20E3]/u,ka=null,Zd=new Map;function Fa(){if(Jt!==null)return Jt;if(typeof OffscreenCanvas<"u")return Jt=new OffscreenCanvas(1,1).getContext("2d"),Jt;if(typeof document<"u")return Jt=document.createElement("canvas").getContext("2d"),Jt;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function Jx(e){let t=Qd.get(e);return t||(t=new Map,Qd.set(e,t)),t}function it(e,t){let n=t.get(e);return n===void 0&&(n={width:Fa().measureText(e).width,containsCJK:Ve(e)},t.set(e,n)),n}function gt(){if(Qt!==null)return Qt;if(typeof navigator>"u")return Qt={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Qt;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 Qt={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:r,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},Qt}function Qx(e){let t=e.match(/(\\d+(?:\\.\\d+)?)\\s*px/);return t?parseFloat(t[1]):16}function ef(){return ka===null&&(ka=new Intl.Segmenter(void 0,{granularity:"grapheme"})),ka}function Zx(e){return Yx.test(e)||e.includes("\\uFE0F")}function tf(e){return Xx.test(e)}function ey(e,t){let n=Zd.get(e);if(n!==void 0)return n;let r=Fa();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 Zd.set(e,n),n}function ty(e){let t=0,n=ef();for(let r of n.segment(e))Zx(r.segment)&&t++;return t}function ny(e,t){return t.emojiCount===void 0&&(t.emojiCount=ty(e)),t.emojiCount}function ht(e,t,n){return n===0?t.width:t.width-ny(e,t)*n}function nf(e,t,n,r,i){if(t.breakableFitAdvances!==void 0)return t.breakableFitAdvances;let o=ef(),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=it(m,n);c.push(ht(m,f,r))}return t.breakableFitAdvances=c,t.breakableFitAdvances}if(i==="pair-context"||a.length>Kx){let c=[],m=null,f=0;for(let p of a){let b=it(p,n),S=ht(p,b,r);if(m===null)c.push(S);else{let y=m+p,_=it(y,n);c.push(ht(y,_,r)-f)}m=p,f=S}return t.breakableFitAdvances=c,t.breakableFitAdvances}let l=[],s="",u=0;for(let c of a){s+=c;let m=it(s,n),f=ht(s,m,r);l.push(f-u),u=f}return t.breakableFitAdvances=l,t.breakableFitAdvances}function rf(e,t){let n=Fa();n.font=e;let r=Jx(e),i=Qx(e),o=t?ey(e,i):0;return{cache:r,fontSize:i,emojiCorrection:o}}function ry(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 of(e,t){if(t<=0)return 0;let n=e%t;return Math.abs(n)<=1e-6?t:t-n}function af(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 iy(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 sf(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 lf(e,t){if(t.segmentIndex>=e.widths.length)return-1;let n=iy(e,t.segmentIndex);return n<0?-1:sf(e,n,t)}function oy(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:sf(e,r,n)}function uf(e,t){return e.simpleLineWalkFastPath?cf(e,t):Ma(e,t)}function cf(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e;if(r.length===0)return 0;let l=gt().lineFitEpsilon,s=t+l,u=0,c=0,m=!1,f=0,p=0,b=0,S=0,y=-1,_=0;function R(){y=-1,_=0}function T(w=b,M=S,L=c){u++,n?.({startSegmentIndex:f,startGraphemeIndex:p,endSegmentIndex:w,endGraphemeIndex:M,width:L}),c=0,m=!1,R()}function F(w,M){m=!0,f=w,p=0,b=w+1,S=0,c=M}function N(w,M,L){m=!0,f=w,p=M,b=w,S=M+1,c=L}function A(w,M){if(!m){F(w,M);return}c+=M,b=w+1,S=0}function v(w,M){let L=o[w];for(let H=M;H<L.length;H++){let z=L[H];m?c+z>s?(T(),N(w,H,z)):(c+=z,b=w,S=H+1):N(w,H,z)}m&&b===w&&S===L.length&&(b=w+1,S=0)}let E=0;for(;E<r.length&&!(!m&&(E=ry(e,E),E>=r.length));){let w=r[E],M=i[E],L=M==="space"||M==="preserved-space"||M==="tab"||M==="zero-width-break"||M==="soft-hyphen";if(!m){w>t&&o[E]!==null?v(E,0):F(E,w),L&&(y=E+1,_=c-w),E++;continue}if(c+w>s){if(L){A(E,w),T(E+1,0,c-w),E++;continue}if(y>=0){if(b>y||b===y&&S>0){T();continue}T(y,0,_);continue}if(w>t&&o[E]!==null){T(),v(E,0),E++;continue}T();continue}A(E,w),L&&(y=E+1,_=c-w),E++}return m&&T(),u}function Ma(e,t,n){if(e.simpleLineWalkFastPath)return cf(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=gt(),f=m.lineFitEpsilon,p=t+f,b=0,S=0,y=!1,_=0,R=0,T=0,F=0,N=-1,A=0,v=0,E=null;function w(){N=-1,A=0,v=0,E=null}function M(U=T,V=F,q=S){b++,n?.({startSegmentIndex:_,startGraphemeIndex:R,endSegmentIndex:U,endGraphemeIndex:V,width:q}),S=0,y=!1,w()}function L(U,V){y=!0,_=U,R=0,T=U+1,F=0,S=V}function H(U,V,q){y=!0,_=U,R=V,T=U,F=V+1,S=q}function z(U,V){if(!y){L(U,V);return}S+=V,T=U+1,F=0}function j(U,V,q,J){if(!V)return;let Ae=U==="tab"?0:i[q],W=U==="tab"?J:o[q];N=q+1,A=S-J+Ae,v=S-J+W,E=U}function k(U,V){let q=l[U];for(let J=V;J<q.length;J++){let Ae=q[J];y?S+Ae>p?(M(),H(U,J,Ae)):(S+=Ae,T=U,F=J+1):H(U,J,Ae)}y&&T===U&&F===q.length&&(T=U+1,F=0)}function B(U){if(E!=="soft-hyphen")return!1;let V=l[U];if(V==null)return!1;let{fitCount:q,fittedWidth:J}=af(V,S,t,f,s);return q===0?!1:(S=J,T=U,F=q,w(),q===V.length?(T=U+1,F=0,!0):(M(U,q,J+s),k(U,q),!0))}function Z(U){b++,n?.({startSegmentIndex:U.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:U.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),w()}for(let U=0;U<c.length;U++){let V=c[U];if(V.startSegmentIndex===V.endSegmentIndex){Z(V);continue}y=!1,S=0,_=V.startSegmentIndex,R=0,T=V.startSegmentIndex,F=0,w();let q=V.startSegmentIndex;for(;q<V.endSegmentIndex;){let J=a[q],Ae=J==="space"||J==="preserved-space"||J==="tab"||J==="zero-width-break"||J==="soft-hyphen",W=J==="tab"?of(S,u):r[q];if(J==="soft-hyphen"){y&&(T=q+1,F=0,N=q+1,A=S+s,v=S+s,E=J),q++;continue}if(!y){W>t&&l[q]!==null?k(q,0):L(q,W),j(J,Ae,q,W),q++;continue}if(S+W>p){let O=S+(J==="tab"?0:i[q]),de=S+(J==="tab"?W:o[q]);if(E==="soft-hyphen"&&m.preferEarlySoftHyphenBreak&&A<=p){M(N,0,v);continue}if(E==="soft-hyphen"&&B(q)){q++;continue}if(Ae&&O<=p){z(q,W),M(q+1,0,de),q++;continue}if(N>=0&&A<=p){if(T>N||T===N&&F>0){M();continue}let se=N;M(se,0,v),q=se;continue}if(W>t&&l[q]!==null){M(),k(q,0),q++;continue}M();continue}z(q,W),j(J,Ae,q,W),q++}if(y){let J=N===V.consumedEndSegmentIndex?v:S;M(V.consumedEndSegmentIndex,0,J)}}return b}function df(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=gt(),p=f.lineFitEpsilon,b=r+p,S=0,y=!1,_=t.segmentIndex,R=t.graphemeIndex,T=-1,F=0,N=0,A=null;function v(){T=-1,F=0,N=0,A=null}function E(k=_,B=R,Z=S){return y?(t.segmentIndex=k,t.graphemeIndex=B,Z):null}function w(k,B){y=!0,_=k+1,R=0,S=B}function M(k,B,Z){y=!0,_=k,R=B+1,S=Z}function L(k,B){if(!y){w(k,B);return}S+=B,_=k+1,R=0}function H(k,B,Z,U){if(!B)return;let V=k==="tab"?0:a[Z],q=k==="tab"?U:l[Z];T=Z+1,F=S-U+V,N=S-U+q,A=k}function z(k,B){let Z=u[k];for(let U=B;U<Z.length;U++){let V=Z[U];if(!y)M(k,U,V);else{if(S+V>b)return E();S+=V,_=k,R=U+1}}return y&&_===k&&R===Z.length&&(_=k+1,R=0),null}function j(k){if(A!=="soft-hyphen"||T<0)return null;let B=u[k]??null;if(B!==null){let{fitCount:Z,fittedWidth:U}=af(B,S,r,p,c);if(Z===B.length)return S=U,_=k+1,R=0,v(),null;if(Z>0)return E(k,Z,U+c)}return F<=b?E(T,0,N):null}for(let k=t.segmentIndex;k<i.endSegmentIndex;k++){let B=s[k],Z=B==="space"||B==="preserved-space"||B==="tab"||B==="zero-width-break"||B==="soft-hyphen",U=k===t.segmentIndex?t.graphemeIndex:0,V=B==="tab"?of(S,m):o[k];if(B==="soft-hyphen"&&U===0){y&&(_=k+1,R=0,T=k+1,F=S+c,N=S+c,A=B);continue}if(!y){if(U>0){let J=z(k,U);if(J!==null)return J}else if(V>r&&u[k]!==null){let J=z(k,0);if(J!==null)return J}else w(k,V);H(B,Z,k,V);continue}if(S+V>b){let J=S+(B==="tab"?0:a[k]),Ae=S+(B==="tab"?V:l[k]);if(A==="soft-hyphen"&&f.preferEarlySoftHyphenBreak&&F<=b)return E(T,0,N);let W=j(k);if(W!==null)return W;if(Z&&J<=b)return L(k,V),E(k+1,0,Ae);if(T>=0&&F<=b)return _>T||_===T&&R>0?E():E(T,0,N);if(V>r&&u[k]!==null){let P=E();if(P!==null)return P;let O=z(k,0);if(O!==null)return O}return E()}L(k,V),H(B,Z,k,V)}return T===i.consumedEndSegmentIndex&&R===0?E(i.consumedEndSegmentIndex,0,N):E(i.consumedEndSegmentIndex,0,S)}function ay(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e,l=gt().lineFitEpsilon,s=n+l,u=0,c=!1,m=t.segmentIndex,f=t.graphemeIndex,p=-1,b=0;for(let S=t.segmentIndex;S<r.length;S++){let y=r[S],_=i[S],R=_==="space"||_==="preserved-space"||_==="tab"||_==="zero-width-break"||_==="soft-hyphen",T=S===t.segmentIndex?t.graphemeIndex:0,F=o[S];if(!c){if(T>0||y>n&&F!==null){let N=F,A=N[T];c=!0,u=A,m=S,f=T+1;for(let v=T+1;v<N.length;v++){let E=N[v];if(u+E>s)return t.segmentIndex=m,t.graphemeIndex=f,u;u+=E,m=S,f=v+1}m===S&&f===N.length&&(m=S+1,f=0)}else c=!0,u=y,m=S+1,f=0;R&&(p=S+1,b=u-y);continue}if(u+y>s)return R?(t.segmentIndex=S+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+=y,m=S+1,f=0,R&&(p=S+1,b=u-y)}return c?(t.segmentIndex=m,t.graphemeIndex=f,u):null}function sy(e,t,n){let r=lf(e,t);return r<0?null:e.simpleLineWalkFastPath?ay(e,t,n):df(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=lf(e,n);for(;o>=0;){let a=df(e,n,o,t);if(a===null)return{lineCount:r,maxLineWidth:i};r++,a>i&&(i=a),o=oy(e,o,n)}return{lineCount:r,maxLineWidth:i}}for(;;){let o=sy(e,n,t);if(o===null)return{lineCount:r,maxLineWidth:i};r++,o>i&&(i=o)}}var Na=null;function ly(){return Na===null&&(Na=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Na}function uy(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 cy(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=li(m),l=Zn.has(m)}function c(m,f){r.push(m),o=o||f;let p=li(m);m.length===1&&pt.has(m)?a=a||p:a=p,l=!1}for(let m of ly().segment(e)){let f=m.segment,p=Ve(f);if(r.length===0){u(f,m.index,p);continue}if(l||ai.has(f)||pt.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 dy(e){if(e.length<=1)return e;let t=[],n=[e[0].text],r=e[0].start,i=Ve(e[0].text),o=oi(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=Ve(s.text),c=oi(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 fy(e,t,n,r){let i=gt(),{cache:o,emojiCorrection:a}=rf(t,tf(e.normalized)),l=ht("-",it("-",o),a),u=ht(" ",it(" ",o),a)*8;if(e.len===0)return uy(n);let c=[],m=[],f=[],p=[],b=e.chunks.length<=1,S=n?[]:null,y=[],_=n?[]:null,R=Array.from({length:e.len});function T(v,E,w,M,L,H,z){L!=="text"&&L!=="space"&&L!=="zero-width-break"&&(b=!1),c.push(E),m.push(w),f.push(M),p.push(L),S?.push(H),y.push(z),_!==null&&_.push(v)}function F(v,E,w,M,L){let H=it(v,o),z=ht(v,H,a),j=E==="space"||E==="preserved-space"||E==="zero-width-break"?0:z,k=E==="space"||E==="zero-width-break"?0:z;if(L&&M&&v.length>1){let B="sum-graphemes";Qn(v)?B="pair-context":i.preferPrefixWidthsForBreakableRuns&&(B="segment-prefixes");let Z=nf(v,H,o,a,B);T(v,z,j,k,E,w,Z);return}T(v,z,j,k,E,w,null)}for(let v=0;v<e.len;v++){R[v]=c.length;let E=e.texts[v],w=e.isWordLike[v],M=e.kinds[v],L=e.starts[v];if(M==="soft-hyphen"){T(E,0,l,l,M,L,null);continue}if(M==="hard-break"){T(E,0,0,0,M,L,null);continue}if(M==="tab"){T(E,0,0,0,M,L,null);continue}let H=it(E,o);if(M==="text"&&H.containsCJK){let z=cy(E,i),j=r==="keep-all"?dy(z):z;for(let k=0;k<j.length;k++){let B=j[k];F(B.text,"text",L+B.start,w,r==="keep-all"||!Ve(B.text))}continue}F(E,M,L,w,!0)}let N=my(e.chunks,R,c.length),A=S===null?null:Bd(e.normalized,S);return _!==null?{widths:c,lineEndFitAdvances:m,lineEndPaintAdvances:f,kinds:p,simpleLineWalkFastPath:b,segLevels:A,breakableFitAdvances:y,discretionaryHyphenWidth:l,tabStopAdvance:u,chunks:N,segments:_}:{widths:c,lineEndFitAdvances:m,lineEndPaintAdvances:f,kinds:p,simpleLineWalkFastPath:b,segLevels:A,breakableFitAdvances:y,discretionaryHyphenWidth:l,tabStopAdvance:u,chunks:N}}function my(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 mf(e,t,n,r){let i=r?.wordBreak??"normal",o=Jd(e,gt(),r?.whiteSpace,i);return fy(o,t,n,i)}function ui(e,t,n){return mf(e,t,!1,n)}function pf(e,t,n){return mf(e,t,!0,n)}function ci(e,t,n){let r=uf(e,t);return{lineCount:r,height:r*n}}function py(e){return{width:e.width,start:{segmentIndex:e.startSegmentIndex,graphemeIndex:e.startGraphemeIndex},end:{segmentIndex:e.endSegmentIndex,graphemeIndex:e.endGraphemeIndex}}}function hy(e,t,n){return e.widths.length===0?0:Ma(e,t,r=>{n(py(r))})}function hf(e,t){return ff(e,t)}function gf(e){let t=0;return hy(e,Number.POSITIVE_INFINITY,n=>{n.width>t&&(t=n.width)}),t}var gy={maxWidth:1600,baseFontSize:78,minFontSize:42,fontWeight:900,fontFamily:"Outfit",step:2};function bf(e,t){let n={...gy,...t},r=1.2;for(let i=n.baseFontSize;i>=n.minFontSize;i-=n.step){let o=`${n.fontWeight} ${i}px ${n.fontFamily}`,a=ui(e,o),{lineCount:l}=ci(a,n.maxWidth,i*r);if(l<=1)return{fontSize:i,fits:!0}}return{fontSize:n.minFontSize,fits:!1}}var xf={prepare:ui,layout:ci,prepareWithSegments:pf,measureLineStats:hf,measureNaturalWidth:gf};window.__timelines=window.__timelines||{};Vc();window.__hyperframes={fitTextFontSize:bf,getVariables:ns,pretext:xf};function yf(){let e=window;e.__hyperframeRuntimeBootstrapped||(e.__hyperframeRuntimeBootstrapped=!0,Hd())}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",yf,{once:!0}):yf();})();\n';
58661
+ RUNTIME_IIFE = '"use strict";(()=>{var Vf=Object.create;var wi=Object.defineProperty;var zf=Object.getOwnPropertyDescriptor;var qf=Object.getOwnPropertyNames;var $f=Object.getPrototypeOf,jf=Object.prototype.hasOwnProperty;var Kf=(e,t,n)=>t in e?wi(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 Yf=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qf(t))!jf.call(e,i)&&i!==n&&wi(e,i,{get:()=>t[i],enumerable:!(r=zf(t,i))||r.enumerable});return e};var Xf=(e,t,n)=>(n=e!=null?Vf($f(e)):{},Yf(t||!e||!e.__esModule?wi(n,"default",{value:e,enumerable:!0}):n,e));var ge=(e,t,n)=>Kf(e,typeof t!="symbol"?t+"":t,n);var Wl=re((IS,yo)=>{var Q=String,Ul=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}};yo.exports=Ul();yo.exports.createColors=Ul});var So=re(()=>{});var Fr=re((HS,ql)=>{"use strict";var Vl=Wl(),zl=So(),Rn=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=Vl.isColorSupported);let r=c=>c,i=c=>c,o=c=>c;if(t){let{bold:c,gray:m,red:f}=Vl.createColors(!0);i=p=>c(f(p)),r=p=>m(p),zl&&(o=p=>zl(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 S=20,x=Math.max(0,this.column-S),_=Math.max(this.column+S,this.endColumn+S),R=c.slice(x,_),T=r(p.replace(/\\d/g," "))+c.slice(0,Math.min(this.column-1,S-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}};ql.exports=Rn;Rn.default=Rn});var vo=re((GS,jl)=>{"use strict";var p0=/(<)(\\/?style\\b)/gi,h0=/(<)(!--)/g;function ft(e){return typeof e!="string"||!e.includes("<")?e:e.replace(p0,"\\\\3c $2").replace(h0,"\\\\3c $2")}var $l={after:`\n`,beforeClose:`\n`,beforeComment:`\n`,beforeDecl:`\n`,beforeOpen:" ",beforeRule:`\n`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function g0(e){return e[0].toUpperCase()+e.slice(1)}var kn=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(ft(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(ft(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(ft(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:ft(s)),this.stringify(l,r!==a||i)}}comment(t){let n=this.raw(t,"left","commentLeft"),r=this.raw(t,"right","commentRight");this.builder(ft("/*"+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(ft(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 $l[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"+g0(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=$l[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:ft(n))}}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(ft(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)}};jl.exports=kn;kn.default=kn});var Fn=re((BS,Kl)=>{"use strict";var b0=vo();function Eo(e,t){new b0(t).stringify(e)}Kl.exports=Eo;Eo.default=Eo});var Mr=re((US,Ao)=>{"use strict";Ao.exports.isClean=Symbol("isClean");Ao.exports.my=Symbol("my")});var Nn=re((WS,Yl)=>{"use strict";var x0=Fr(),y0=vo(),S0=Fn(),{isClean:Mn,my:v0}=Mr();function Co(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=>Co(a,n)):(o==="object"&&i!==null&&(i=Co(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 Ln=class{get proxyOf(){return this}constructor(t={}){this.raws={},this[Mn]=!1,this[v0]=!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=Co(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 x0(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[Mn]=!0}markDirty(){if(this[Mn]){this[Mn]=!1;let t=this;for(;t=t.parent;)t[Mn]=!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 y0().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=S0){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)}};Yl.exports=Ln;Ln.default=Ln});var In=re((VS,Xl)=>{"use strict";var E0=Nn(),Dn=class extends E0{constructor(t){super(t),this.type="comment"}};Xl.exports=Dn;Dn.default=Dn});var On=re((zS,Jl)=>{"use strict";var A0=Nn(),Pn=class extends A0{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"}};Jl.exports=Pn;Pn.default=Pn});var mt=re((qS,au)=>{"use strict";var Ql=In(),Zl=On(),C0=Nn(),{isClean:eu,my:tu}=Mr(),wo,nu,ru,_o;function iu(e){return e.map(t=>(t.nodes&&(t.nodes=iu(t.nodes)),delete t.source,t))}function ou(e){if(e[eu]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)ou(t)}var We=class e extends C0{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=iu(nu(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 Zl(t)]}else if(t.selector||t.selectors)t=[new _o(t)];else if(t.name)t=[new wo(t)];else if(t.text)t=[new Ql(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[eu]&&ou(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)}))}};We.registerParse=e=>{nu=e};We.registerRule=e=>{_o=e};We.registerAtRule=e=>{wo=e};We.registerRoot=e=>{ru=e};au.exports=We;We.default=We;We.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,wo.prototype):e.type==="rule"?Object.setPrototypeOf(e,_o.prototype):e.type==="decl"?Object.setPrototypeOf(e,Zl.prototype):e.type==="comment"?Object.setPrototypeOf(e,Ql.prototype):e.type==="root"&&Object.setPrototypeOf(e,ru.prototype),e[tu]=!0,e.nodes&&e.nodes.forEach(t=>{We.rebuild(t)})}});var Lr=re(($S,lu)=>{"use strict";var su=mt(),qt=class extends su{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)}};lu.exports=qt;qt.default=qt;su.registerAtRule(qt)});var Nr=re((jS,du)=>{"use strict";var w0=mt(),uu,cu,wt=class extends w0{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new uu(new cu,this,t).stringify()}};wt.registerLazyResult=e=>{uu=e};wt.registerProcessor=e=>{cu=e};du.exports=wt;wt.default=wt});var mu=re((KS,fu)=>{var _0="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",T0=(e,t=21)=>(n=t)=>{let r="",i=n|0;for(;i--;)r+=e[Math.random()*e.length|0];return r},R0=(e=21)=>{let t="",n=e|0;for(;n--;)t+=_0[Math.random()*64|0];return t};fu.exports={nanoid:R0,customAlphabet:T0}});var Dr=re(()=>{});var Ir=re(()=>{});var To=re(()=>{});var pu=re(()=>{});var ko=re((rv,bu)=>{"use strict";var{existsSync:k0,readFileSync:F0}=pu(),{dirname:Ro,join:M0}=Dr(),{SourceMapConsumer:hu,SourceMapGenerator:gu}=Ir();function L0(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var Hn=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=Ro(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new hu(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 L0(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=Ro(t),k0(t)))return this.mapFile=t,F0(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 hu)return gu.fromSourceMap(n).toString();if(n instanceof gu)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=M0(Ro(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)}};bu.exports=Hn;Hn.default=Hn});var Gn=re((iv,Eu)=>{"use strict";var{nanoid:N0}=mu(),{isAbsolute:Lo,resolve:No}=Dr(),{SourceMapConsumer:D0,SourceMapGenerator:I0}=Ir(),{fileURLToPath:xu,pathToFileURL:Pr}=To(),yu=Fr(),P0=ko(),Fo=So(),Mo=Symbol("lineToIndexCache"),O0=!!(D0&&I0),Su=!!(No&&Lo);function vu(e){if(e[Mo])return e[Mo];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[Mo]=n,n}var $t=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&&(!Su||/^\\w+:\\/\\//.test(n.from)||Lo(n.from)?this.file=n.from:this.file=No(n.from)),Su&&O0){let r=new P0(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 "+N0(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 yu(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 yu(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&&(Pr&&(u.input.url=Pr(this.file).toString()),u.input.file=this.file),u}fromLineAndColumn(t,n){return vu(this)[t-1]+n-1}fromOffset(t){let n=vu(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:No(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;Lo(a.source)?s=Pr(a.source):s=new URL(a.source,this.map.consumer().sourceRoot||Pr(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(xu)u.file=xu(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}};Eu.exports=$t;$t.default=$t;Fo&&Fo.registerInput&&Fo.registerInput($t)});var jt=re((ov,_u)=>{"use strict";var Au=mt(),Cu,wu,pt=class extends Au{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 Cu(new wu,this,t).stringify()}};pt.registerLazyResult=e=>{Cu=e};pt.registerProcessor=e=>{wu=e};_u.exports=pt;pt.default=pt;Au.registerRoot(pt)});var Do=re((av,Tu)=>{"use strict";var Bn={comma(e){return Bn.split(e,[","],!0)},space(e){let t=[" ",`\n`," "];return Bn.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}};Tu.exports=Bn;Bn.default=Bn});var Or=re((sv,ku)=>{"use strict";var Ru=mt(),H0=Do(),Kt=class extends Ru{get selectors(){return H0.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=[])}};ku.exports=Kt;Kt.default=Kt;Ru.registerRule(Kt)});var Mu=re((lv,Fu)=>{"use strict";var G0=Lr(),B0=In(),U0=On(),W0=Gn(),V0=ko(),z0=jt(),q0=Or();function Un(e,t){if(Array.isArray(e))return e.map(i=>Un(i));let{inputs:n,...r}=e;if(n){t=[];for(let i of n){let o={...i,__proto__:W0.prototype};o.map&&(o.map={...o.map,__proto__:V0.prototype}),t.push(o)}}if(r.nodes&&(r.nodes=e.nodes.map(i=>Un(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 z0(r);if(r.type==="decl")return new U0(r);if(r.type==="rule")return new q0(r);if(r.type==="comment")return new B0(r);if(r.type==="atrule")return new G0(r);throw new Error("Unknown node type: "+e.type)}Fu.exports=Un;Un.default=Un});var Po=re((uv,Ou)=>{"use strict";var{dirname:Hr,relative:Nu,resolve:Du,sep:Iu}=Dr(),{SourceMapConsumer:Pu,SourceMapGenerator:Gr}=Ir(),{pathToFileURL:Lu}=To(),$0=Gn(),j0=!!(Pu&&Gr),K0=!!(Hr&&Du&&Nu&&Iu),Io=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||Hr(t.file),i;this.mapOpts.sourcesContent===!1?(i=new Pu(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(),K0&&j0&&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=Gr.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new Gr({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 Gr({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?Hr(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Hr(Du(r,this.mapOpts.annotation)));let i=Nu(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 $0(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(Lu){let r=Lu(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;Iu==="\\\\"&&(t=t.replace(/\\\\/g,"/"));let r=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,r),r}};Ou.exports=Io});var Bu=re((cv,Gu)=>{"use strict";var Br=/[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g,Ur=/[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g,Y0=/.[\\r\\n"\'(/\\\\]/,Hu=/[\\da-f]/i;Gu.exports=function(t,n={}){let r=t.css.valueOf(),i=n.ignoreErrors,o,a,l,s,u,c,m,f,p,b,S=r.length,x=0,_=[],R=[],T=-1;function F(){return x}function M(w){throw t.error("Unclosed "+w,x)}function A(){return R.length===0&&x>=S}function v(w){if(R.length)return R.pop();if(x>=S)return;let L=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 D=String.fromCharCode(o);c=[D,D,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||L){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?S: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||L){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:{Br.lastIndex=x+1,Br.test(r),Br.lastIndex===0?s=r.length-1:s=Br.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,Hu.test(r.charAt(s)))){for(;Hu.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||L?s=r.length:M("comment")),c=["comment",r.slice(x,s+1),x,s],x=s):(Ur.lastIndex=x+1,Ur.test(r),Ur.lastIndex===0?s=r.length-1:s=Ur.lastIndex-2,c=["word",r.slice(x,s+1),x,s],_.push(c),x=s);break}}return x++,c}function E(w){R.push(w)}return{back:E,endOfFile:A,nextToken:v,position:F}}});var zu=re((dv,Vu)=>{"use strict";var X0=Lr(),J0=In(),Q0=On(),Z0=jt(),Uu=Or(),eh=Bu(),Wu={empty:!0,space:!0};function th(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var Oo=class{constructor(t){this.input=t,this.root=new Z0,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 X0;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 J0;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=eh(this.input)}decl(t,n){let r=new Q0;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]||th(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 Uu;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",!Wu[m]&&!Wu[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 Uu;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})}};Vu.exports=Oo});var Vr=re((fv,qu)=>{"use strict";var nh=mt(),rh=Gn(),ih=zu();function Wr(e,t){let n=new rh(e,t),r=new ih(n);try{r.parse()}catch(i){throw i}return r.root}qu.exports=Wr;Wr.default=Wr;nh.registerParse(Wr)});var Ho=re((mv,$u)=>{"use strict";var Wn=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}};$u.exports=Wn;Wn.default=Wn});var zr=re((pv,ju)=>{"use strict";var oh=Ho(),Vn=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 oh(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(t=>t.type==="warning")}};ju.exports=Vn;Vn.default=Vn});var Go=re((hv,Yu)=>{"use strict";var Ku={};Yu.exports=function(t){Ku[t]||(Ku[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))}});var Wo=re((bv,Zu)=>{"use strict";var ah=mt(),sh=Nr(),lh=Po(),uh=Vr(),Xu=zr(),ch=jt(),dh=Fn(),{isClean:Ye,my:fh}=Mr(),gv=Go(),mh={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},ph={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},hh={Once:!0,postcssPlugin:!0,prepare:!0},Yt=0;function zn(e){return typeof e=="object"&&typeof e.then=="function"}function Qu(e){let t=!1,n=mh[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,Yt,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,Yt,n+"Exit"]:[n,n+"Exit"]}function Ju(e){let t;return e.type==="document"?t=["Document",Yt,"DocumentExit"]:e.type==="root"?t=["Root",Yt,"RootExit"]:t=Qu(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Bo(e){return e[Ye]=!1,e.nodes&&e.nodes.forEach(t=>Bo(t)),e}var Uo={},ht=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=Bo(n);else if(n instanceof e||n instanceof Xu)i=Bo(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=uh;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[fh]&&ah.rebuild(i)}this.result=new Xu(t,i,r),this.helpers={...Uo,postcss:Uo,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(!ph[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${n.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!hh[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(zn(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=[Ju(t)];for(;n.length>0;){let r=this.visitTick(n);if(zn(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 zn(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=dh;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 lh(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(zn(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(zn(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(Ju(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===Yt){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=Qu(t);for(let r of n)if(r===Yt)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()}};ht.registerPostcss=e=>{Uo=e};Zu.exports=ht;ht.default=ht;ch.registerLazyResult(ht);sh.registerLazyResult(ht)});var tc=re((yv,ec)=>{"use strict";var gh=Po(),bh=Vr(),xh=zr(),yh=Fn(),xv=Go(),qn=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=bh;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=yh;this.result=new xh(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 gh(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[]}};ec.exports=qn;qn.default=qn});var rc=re((Sv,nc)=>{"use strict";var Sh=Nr(),vh=Wo(),Eh=tc(),Ah=jt(),_t=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 Eh(this,t,n):new vh(this,t,n)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}};nc.exports=_t;_t.default=_t;Ah.registerProcessor(_t);Sh.registerProcessor(_t)});var dc=re((vv,cc)=>{"use strict";var ic=Lr(),oc=In(),Ch=mt(),wh=Fr(),ac=On(),sc=Nr(),_h=Mu(),Th=Gn(),Rh=Wo(),kh=Do(),Fh=Nn(),Mh=Vr(),Vo=rc(),Lh=zr(),lc=jt(),uc=Or(),Nh=Fn(),Dh=Ho();function le(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Vo(e)}le.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 Vo().version,l}let o;return Object.defineProperty(i,"postcss",{get(){return o||(o=i()),o}}),i.process=function(a,l,s){return le([i(s)]).process(a,l)},i};le.stringify=Nh;le.parse=Mh;le.fromJSON=_h;le.list=kh;le.comment=e=>new oc(e);le.atRule=e=>new ic(e);le.decl=e=>new ac(e);le.rule=e=>new uc(e);le.root=e=>new lc(e);le.document=e=>new sc(e);le.CssSyntaxError=wh;le.Declaration=ac;le.Container=Ch;le.Processor=Vo;le.Document=sc;le.Comment=oc;le.Warning=Dh;le.AtRule=ic;le.Result=Lh;le.Input=Th;le.Rule=uc;le.Root=lc;le.Node=Fh;Rh.registerPostcss(le);cc.exports=le;le.default=le});function ur(){return globalThis}function N(e,t){if(typeof window>"u")return;let n=ur(),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 Jf=["seconds-time","rational-fps","seek-keep-playing","composition-manifest-v1"];function Qf(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 Zf(e){let t=Number.isFinite(e)&&e>0?e:30,n=Number.isInteger(t)?1:1e6,r=Math.round(t*n),i=Qf(r,n);return{numerator:r/i,denominator:n/i}}function _i(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 cr(e){return{protocolVersion:1,capabilities:Jf,fps:Zf(e)}}function em(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function Qa(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=_i(n.fps);return r===null||!em(n.capabilities)?{status:"unsupported",code:"invalid_protocol_metadata",receivedVersion:n.protocolVersion}:{status:"supported",fps:r,metadata:n}}var Za=30;function es(e){Za=Number.isFinite(e)&&e>0?e:30}function ye(e){try{window.parent.postMessage({...e,...cr(Za)},"*")}catch(t){N("bridge.postMessage",t)}}var tm={play:(e,t)=>t.onPlay(),pause:(e,t)=>t.onPause(),"stop-media":(e,t)=>t.onStopMedia(),seek:(e,t)=>t.onSeek(nm(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=>im(e)};function nm(e,t){let n=Number(e.timeSeconds);if(Number.isFinite(n))return Math.max(0,n);let i=_i(e.fps)??t.getCanonicalFps();return Math.max(0,Number(e.frame??0))/i}function rm(e){let t=Qa(e);return t.status!=="unsupported"?!1:(ye({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 im(e){let t=e.selectors,n=e.duration||800;t&&om(t,n)}function ts(e){let t=n=>{let r=n.data;if(!r||r.source!=="hf-parent"||r.type!=="control"||rm(r))return;let i=r.action;if(typeof i!="string")return;let o=tm[i];o&&o(r,e)};return window.addEventListener("message",t),ye({source:"hf-preview",type:"ready"}),t}function om(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){N("bridge.flashElements.querySelector",r)}}var Ti=null;function ns(e){Ti=e}function Le(e,t){if(Ti)try{Ti({source:"hf-preview",type:"analytics",event:e,properties:t??{}})}catch(n){N("runtime.analytics.site1",n)}}function am(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 Nt(e){return`--${am(e)}`}function rs(e){let t=new Map;for(let n of e){let r=Nt(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 os(){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,un(i));let n=fr(),r={...t,...n};for(let i of e)ki(i,r);return r}var is=new Set;function as(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 sm(e,t){return t?.trim()||e.getAttribute("data-composition-id")?.trim()||e.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")?.trim()||"composition"}function lm(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 um(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=lm(e);return r.length===0||r.some(i=>String(i)===String(n))?null:{id:e.id,value:n,allowed:r}}function ki(e,t,n){if(!e)return;let r=as(e);if(r.length===0)return;let i=sm(e,n);for(let o of r){let a=um(o,t);if(!a)continue;let l=`${i}|${a.id}|${String(a.value)}`;if(is.has(l))continue;is.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 un(e){let t={};for(let n of as(e))typeof n.id!="string"||!("default"in n)||(t[n.id]=n.default);return t}var Ri="data-hf-css-vars";function dr(e){return"style"in e&&typeof e.style?.setProperty=="function"}function Fi(e,t){if(!dr(e))return;let n=[];for(let[r,i]of Object.entries(t))if(typeof i=="string"&&i!==""||typeof i=="number"){let o=Nt(r);e.style.setProperty(o,String(i)),n.push(o)}n.length>0&&e.setAttribute(Ri,n.join(" "))}function ss(e,t,n){let r={};for(let[i,o]of Object.entries(t)){let a=Nt(i);((dr(e)?e.style.getPropertyValue(a):"")||(n?n.getComputedStyle(e).getPropertyValue(a):"")).trim()===""&&(r[i]=o)}return r}function ls(e){if(!dr(e))return;let t=e.getAttribute(Ri);if(t){for(let n of t.split(" "))n.startsWith("--")&&e.style.removeProperty(n);e.removeAttribute(Ri)}}function us(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=fr(),r=[];for(let i of t)r.push(...cm(i,n,e.defaultView));for(let i of rs(r))console.warn(`composition variables ${i.join(", ")} collapse to the same CSS property ${Nt(i[0]??"")} \\u2014 rename one to avoid cross-talk`)}function cm(e,t,n){if(!dr(e))return[];let r=un(e),i={};for(let[o,a]of Object.entries(r)){if(o in t)continue;let l=Nt(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 Fi(e,i),Object.keys(r)}function cs(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 fr(){if(typeof window>"u")return{};let e=window.__hfVariables;return!e||typeof e!="object"||Array.isArray(e)?{}:e}function ds(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){N("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){N("runtime.adapters.css.site1",f)}try{m.pause()}catch(f){N("runtime.adapters.css.site2",f)}}},a=u=>{for(let c of u)try{c.play()}catch(m){N("runtime.adapters.css.site3",m)}},l=u=>{for(let c of u)try{c.pause()}catch(m){N("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 fs(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 ms(){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){N("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){N("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){N("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){N("runtime.adapters.animejs.site4",n)}},revert:()=>{}}}function hs(){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){N("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(Mi(r))r.goToAndStop(t*1e3,!1);else if(Li(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){N("runtime.adapters.lottie.site2",i)}},pause:()=>{let e=window.__hfLottie;if(!(!e||e.length===0))for(let t of e)try{(Mi(t)||Li(t))&&t.pause()}catch(n){N("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=dm(r)}catch(o){N("runtime.adapters.lottie.site4",o)}i!=null&&(n=!0,t=Math.max(t,i))}return n?t:null}}}function ps(e,t){return!Number.isFinite(e)||!e||e<=0||!Number.isFinite(t)||!t||t<=0?null:e/t}function dm(e){return Mi(e)?ps(e.totalFrames,e.frameRate):Li(e)?Number.isFinite(e.duration)&&(e.duration??0)>0?e.duration??null:ps(e.totalFrames,e.frameRate):null}function Mi(e){return typeof e=="object"&&e!==null&&typeof e.goToAndStop=="function"}function Li(e){return typeof e=="object"&&e!==null&&typeof e.pause=="function"&&("totalFrames"in e||"duration"in e)}var Ni=-1,mr=new Set,Dt,Di=0;function gs(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){N("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}));mr.add(i),i.then(o=>{mr.delete(i)&&o.status==="rejected"&&Dt===void 0&&(Dt={reason:o.reason})})}function pr(e){e!==Ni&&(Ni=e,gs(e))}function hr(e){Ni=e,gs(e)}function bs(){return Di>0}async function Ii(){Di+=1;let e=Dt;try{for(await Promise.resolve();mr.size>0;){let r=(await Promise.all([...mr])).find(i=>i.status==="rejected");e===void 0&&r?.status==="rejected"&&(e={reason:r.reason})}let t=Dt;if(e===void 0&&(e=t),Dt===t&&(Dt=void 0),e)throw e.reason}finally{Di-=1}}function xs(){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,pr(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 ys(){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 Ss(){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 vs(){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 Es(){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 As(){return $e({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 Cs(){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&&(bs()||(window.__hfTypegpuTime=e,hr(e)))},fm))};return{name:"typegpu",discover:()=>{},seek:o=>{e=Math.max(0,Number(o.time)||0),t=e,window.__hfTypegpuTime=e,pr(e)},pause:()=>{e==null&&(e=Math.max(0,t)),i()},play:()=>{r(),e=null},revert:()=>{r(),e=null,t=0}}}function ws(e){let t=e.nextElementSibling;if(t instanceof HTMLImageElement&&t.classList.contains("__render_frame__")&&t.complete&&t.naturalWidth>0)return t;if(e.id){let n=document.getElementById(`__render_frame_${e.id}__`);if(n instanceof HTMLImageElement&&n.complete&&n.naturalWidth>0)return n}return null}function _s(){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=ws(n.source);if(o)return t.call(this,{...n,source:o},r,i)}return t.call(this,n,r,i)}}function Ts(){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=ws(u);c&&(l[s]=c)}return o.apply(this,l)};a.__hfVideoPatched=!0,r[i]=a}}}function Rs(){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){N("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 F=_.apply(this,T);return f(F,t),F};x.animate=R,r=x,i=_,o=R,n=!0}catch{}},S=x=>{let _=null;try{_=x.effect?.getComputedTiming?.()??null}catch(F){N("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(),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),F=T.animationTimeMs+Math.max(0,_-T.compositionTimeMs);try{R.currentTime=F}catch(M){N("runtime.adapters.waapi.site1",M)}try{R.pause()}catch(M){N("runtime.adapters.waapi.site2",M)}}},pause:()=>{e||p(s(),t);for(let x of a)try{x.pause()}catch(_){N("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){N("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=S(_);R.endSeconds!=null&&(x=Math.max(x,R.endSeconds))}return x>0?x:null}}}var It=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),s1=Object.freeze([It.start,It.duration,It.trackIndex]),l1=Object.freeze([It.derivedEnd]),u1=Object.freeze([It.derivedEnd,It.legacyTrack]);function Ge(e){if(e==null||e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}var Fs=/^[A-Za-z0-9_.:-]+$/;function Ms(e,t){let n=e.charCodeAt(t);return n>=48&&n<=57}function ks(e,t){let n=t;for(;n>=0&&Ms(e,n);)n--;return n}function mm(e,t){let n=t;for(;n>=0&&(e[n]??"").trim()==="";)n--;return n}function pm(e){let t=e.length-1;if(!Ms(e,t))return null;let n=ks(e,t);return e[n]==="."&&(n=ks(e,n-1)),n+1}function hm(e){let t=pm(e);if(t==null)return null;let n=mm(e,t-1),r=e[n];if(r!=="+"&&r!=="-")return null;let i=e.slice(0,n).trim();if(!Fs.test(i))return null;let o=Number(e.slice(t));return Number.isFinite(o)?{refId:i,operator:r,magnitude:o}:null}function Pi(e){let t=(e??"").trim();if(!t)return null;let n=Ge(t);if(n!=null)return{kind:"absolute",value:n};if(Fs.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 Ls(e){return Number.isFinite(e)&&e>0?Math.max(.1,Math.min(5,e)):1}function ve(e){return Ge(e)}function Te(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 Ls(n)}function cn(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 Ze(e,t){return gm(t,cn(e),Te(e))}function gm(e,t,n){return Number.isFinite(e)?Math.max(0,e-t)/Ls(n):null}function bm(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:Math.max(0,Math.min(1,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:Math.max(0,Math.min(1,n))}),i}function Ns(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 ym(e){let t=Number.parseFloat(e??"");return Number.isFinite(t)?t:void 0}function Ds(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=ym(e.dataset.volume)??1,l=Math.max(0,Math.min(1,a));return{start:n,end:o,staticVolume:l}}function Sm(e,t,n,r){let{start:i,end:o,staticVolume:a}=Ds(e,n);e.volume=a;let l=1/Math.min(60,Math.max(1,r)),s=Math.max(0,i),u=Math.min(n,o),c=[],m;for(let p=s;p<=u+1e-6;p=Math.min(u,p+l)){t(p);let b=Number(e.volume);if(Number.isFinite(b)){let S=Math.max(0,Math.min(1,b)),x={time:Number(p.toFixed(6)),volume:Number(S.toFixed(6))};xm(c,m,x,p===u),m=x}if(p===u)break}return c.some(p=>Math.abs(p.volume-a)>1e-4)?c:null}function Is(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=Sm(e,o,n,60);if(Number.isFinite(a)&&o(a),l){let{start:s,staticVolume:u}=Ds(e,n),c=bm(l,s,u);c.length>0&&r.set(e,c)}}var br="data-fx-chain",x1=br.slice(5),Ps=1,dn=(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}),Oi=(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}),gr=(e=-40,t=40,n=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:e,max:t,step:.1,default:n,automatable:!0}),Os={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."},Hs=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[gr(-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:[dn("frequency","Frequency",1e3),gr(-40,40,0),Oi(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[dn("frequency","Frequency",200,20,2e3),gr(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[dn("frequency","Frequency",4e3,500,2e4),gr(-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:[dn("frequency","Cutoff",300,20,2e4),Oi(.707),Os],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies \\u2014 darkens or muffles a track.",params:[dn("frequency","Cutoff",8e3,100,2e4),Oi(.707),Os],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:"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"}],Hi=new Map(Hs.map(e=>[e.id,e]));function fn(e){return Hi.get(e)}var y1=Hs.map(e=>e.id);function mn(e,t){let n=Hi.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 lt=class extends Error{constructor(t){super(t),this.name="AudioFxChainError"}};function Gs(e){let t;try{t=JSON.parse(e)}catch(i){throw new lt(`Chain file is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new lt("Chain file must be a JSON object.");let n=t;if(n.version!==Ps)throw new lt(`Unsupported chain version: ${String(n.version)}`);if(!Array.isArray(n.nodes))throw new lt("Chain file is missing a `nodes` array.");let r=n.nodes.map((i,o)=>{if(typeof i!="object"||i===null)throw new lt(`Node ${o} is not an object.`);let a=i;if(typeof a.type!="string"||!Hi.has(a.type))throw new lt(`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:mn(a.type,a.params??void 0)}});return{version:Ps,nodes:r}}function pn(e){return e.nodes.filter(t=>t.enabled!==!1)}var Pt="data-automation",E1=Pt.slice(5),xr=1,vm=512,et=class extends Error{constructor(t){super(t),this.name="AudioAutomationError"}},Ot="volume";function gn(e){if(e===Ot)return{kind:"volume"};let t=e.split(".");if(t.length===3&&t[0]==="fx"&&t[1]===Em){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 Em="preset";var Am={min:0,max:1,step:.01,unit:"",label:"Amount",scale:"linear",default:1},yr={min:0,max:1,step:.01,unit:"",label:"Volume",scale:"linear",default:1};function Gi(e,t){let n=gn(e);if(!n)return null;if(n.kind==="volume")return yr;if(n.kind==="preset")return t?.nodes.some(l=>l.fromPreset===n.presetId)?{...Am,label:`${n.presetId} \\xB7 Amount`}:null;let r=t?.nodes.find(a=>a.id===n.nodeId);if(!r)return null;let i=fn(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 hn(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 Cm(e){let t=hn(e);return t===null||t===0?0:Math.min(1,Math.max(-1,t))}function Bs(e,t){let n=hn(e),r=hn(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 wm(e){let t=Cm(e?.curve),n=Bs(e?.viaX,e?.viaY);return{...t?{curve:t}:{},...n?{viaX:n.x,viaY:n.y}:{}}}function _m(e,t){let n=hn(e?.t),r=hn(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,...wm(e)}}function Us(e,t){let n=e.map(i=>_m(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,vm)}function Tm(e){let t=[];for(let n of e.lanes){if(!gn(n.target))continue;let r=n.target===Ot?yr:null,i=Us(n.points??[],r);i.length>0&&t.push({target:n.target,points:i})}return{version:xr,lanes:t}}function Ws(e,t){let n=[];for(let r of e.lanes){let i=Gi(r.target,t);if(!i)continue;let o=Us(r.points,i);o.length>0&&n.push({target:r.target,points:o})}return{version:xr,lanes:n}}function Sr(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!==xr)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"||!gn(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 Tm({version:xr,lanes:r})}function Rm(e,t){return t?Math.pow(e,Math.pow(2,2*t)):e}function km(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 Fm(e,t,n){let{cx:r,cy:i,w:o}=km(t,n),a=2-2*o,l=e*a-1+2*o*r,s=-e*a-2*o*r,u=Mm(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 Mm(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 Lm(e,t){let n=Bs(t.viaX,t.viaY);return n?Fm(Math.min(1,Math.max(0,e)),n.x,n.y):Rm(e,t.curve)}function Nm(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 bn(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:Nm(s.v,u.v,Lm((t-s.t)/c,s),n)}function Vs(e){return e.points.length<=1||e.points.every(t=>t.v===e.points[0].v)}function zs(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]=bn(e,t+l*s/(o-1),i);return a}var vr=new Map,Dm=64;function Im(e){let t=vr.get(e);if(t!==void 0)return t;let n=null;try{n=Sr(e).lanes.find(r=>r.target===Ot)??null}catch{n=null}return vr.size>Dm&&vr.clear(),vr.set(e,n),n}function qs(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(Pt):null)??"";if(!n)return null;let r=Im(n);return!r||r.points.length===0?null:bn(r,t)}function je(e){return cn(e)}function $s(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 js(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=Te(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,S=Number.parseFloat(a.dataset.volume??""),x={el:a,start:l,mediaStart:s,duration:p?f:Number.POSITIVE_INFINITY,end:b,volume:Number.isFinite(S)?S: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 Bi=new WeakMap,xn=new WeakMap,Ui=new WeakSet,Gt=new WeakSet;function Pm(e){if(Gt.has(e))return;Gt.add(e);let t=()=>Gt.delete(e);e.addEventListener("playing",t,{once:!0}),e.addEventListener("pause",t,{once:!0}),e.addEventListener("error",t,{once:!0})}var Om=3;function Hm(e){return e.error!=null||e.networkState===Om}var Wi=new WeakMap;function Ht(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function Vi(e){Bi.delete(e),xn.delete(e),Ui.delete(e),Wi.delete(e)}function Ks(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=o&&n.sourceDuration!=null&&i>=n.mediaStart&&i<n.sourceDuration;if(e.timeSeconds>=n.start&&e.timeSeconds<n.end&&i>=0&&(!r.ended||n.loop||a||l)){if(n.loop&&n.sourceDuration!=null&&n.sourceDuration>0){let j=n.sourceDuration-n.mediaStart;j>0&&i>=n.sourceDuration&&(i=n.mediaStart+(i-n.mediaStart)%j)}let u=Ht(e.userVolume??1),c=Ht(n.volume??1),m=Wi.get(r),f=Ht(r.volume),p,b=qs(r,e.timeSeconds-n.start);if(b!==null)p=Ht(b);else if(n.volumeKeyframes&&n.volumeKeyframes.length>0){let j=e.timeSeconds-n.start;p=Ht(Ns(n.volumeKeyframes,j))}else e.isWebAudioRouted?.(r)?p=c:m===void 0||Math.abs(f-m)>1e-4?p=f:p=c;let S=Ht(p*u);r.volume=S,Wi.set(r,S),e.onElementVolume?.(r,S,p),(t||e.isWebAudioOwned?.(r))&&(r.muted=!0),r.preload!=="auto"&&(r.preload="auto");try{r.playbackRate=n.playbackRate*e.playbackRate}catch(j){N("runtime.media.site1",j)}let x=.04,_=2,R=r.currentTime||0,T=Math.abs(R-i),F=i-R,M=Bi.get(r);Bi.set(r,F);let A=M===void 0,v=!A&&Math.abs(F-M)>.5,E=T>3,w=a&&T>.001||r.ended&&l&&T>.001||T>.5&&(A||v||E),L=r.tagName==="VIDEO"&&!r.paused,D=M!==void 0&&Math.abs(F-M)<.004,H=!1;if(!L&&!w&&!A&&D&&T>x){let j=(xn.get(r)??0)+1;xn.set(r,j),j>=_&&(H=!0,xn.set(r,0))}else T<=x&&xn.set(r,0);let z=!L&&e.forceSync&&T>.02;if(w||H||z){if(!(r.tagName==="VIDEO"&&r.id&&!!document.getElementById(`__render_frame_${r.id}__`))){try{r.currentTime=i}catch(k){N("runtime.media.site2",k)}if(Math.abs(r.currentTime-i)>.5&&!Ui.has(r)){Ui.add(r),r.load();try{r.currentTime=i}catch(k){N("runtime.media.site3",k)}}}Gt.delete(r)}a?r.paused||r.pause():e.playing&&r.paused&&!Gt.has(r)&&!Hm(r)?(Pm(r),r.play().catch(j=>{Gt.delete(r),(j&&typeof j=="object"&&"name"in j?String(j.name??""):"")==="NotAllowedError"&&e.onAutoplayBlocked?.()})):!e.playing&&!r.paused&&r.pause();continue}Vi(r),r.paused||r.pause()}}var Gm="hf-proxy",Ys="runtime_media_proxy_fallback",Xs="runtime_media_proxy_unavailable",yn=new WeakSet,Js=new WeakSet;function Er(e){return e.currentSrc||e.src}function zi(e){return window.__HF_EXPORT_RENDER_SEEK_CONFIG?!0:e instanceof HTMLVideoElement&&!!e.id&&!!document.getElementById(`__render_frame_${e.id}__`)}function qi(e){let t=Er(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 Bm(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 Um(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 $i(e,t){return t[e]??Bm(e,t)??Um(e,t)}function Wm(e,t){let n=new URL(e,document.baseURI);return n.searchParams.set(Gm,t?t.hasAlpha?"vp8":"h264":"auto"),n.href}var Vm={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 Ct(e,t,n){if(Js.has(e))return;Js.add(e);let r=Vm[t];ye({source:"hf-preview",type:"diagnostic",code:Xs,details:{asset:n,codecName:null,reason:t,note:r}}),console.info(`[hyperframes] ${Xs}: "${n}" (${t}): ${r}`)}function ji(e,t=null,n="reactive"){if(yn.has(e))return;let r=Er(e),i;try{i=Wm(r,t)}catch(l){N("runtime.mediaProxy.swap",l),Ct(e,"invalid_source_url",r);return}yn.add(e),Vi(e),e.src=i,e.load();let o=t?.codecName??null;ye({source:"hf-preview",type:"diagnostic",code:Ys,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] ${Ys}: "${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 Qs(e){if(zi(e)||!(e instanceof HTMLVideoElement)||yn.has(e))return;let t=window.__HF_MEDIA_CODEC_MAP__;if(!t)return;let n=qi(e);if(n===null)return;let r=$i(n,t);if(!r||!r.browserHostile)return;let i=r.representativeMime?e.canPlayType(r.representativeMime):"";i==="probably"||i==="maybe"||ji(e,r,"proactive")}function Zs(e){if(zi(e)||!(e instanceof HTMLVideoElement)||e.videoWidth!==0)return;let t=Er(e);if(yn.has(e)){Ct(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=qi(e);if(r===null){Ct(e,"cross_origin",t);return}let i=$i(r,n);if(i&&!i.browserHostile){Ct(e,"browser_safe_codec",t);return}ji(e,i,"reactive")}function el(e){if(zi(e)||!(e instanceof HTMLVideoElement))return;let t=Er(e);if(yn.has(e)){Ct(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=qi(e);if(r===null){Ct(e,"cross_origin",t);return}let i=$i(r,n);if(i&&!i.browserHostile){Ct(e,"browser_safe_codec",t);return}ji(e,i,"tertiary")}var Ee=class extends Error{constructor(n,r=null){super(r==null?n:`${n} at line ${r}`);ge(this,"lineNumber");this.name="CubeLutParseError",this.lineNumber=r}},zm=[0,0,0],qm=[1,1,1],Ar=64;function $m(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 ut(e,t){let n=Number(e);if(!Number.isFinite(n))throw new Ee(`Invalid number "${e}"`,t);return n}function tl(e,t,n){if(e.length!==3)throw new Ee(`${t} expects three numbers`,n);return[ut(e[0],n),ut(e[1],n),ut(e[2],n)]}function nl(e,t,n){if(!e)throw new Ee(`${t} expects a size`,n);let r=Number(e);if(!Number.isInteger(r)||r<2)throw new Ee(`${t} must be an integer greater than 1`,n);return r}function jm(e,t){if(t[0]<=e[0]||t[1]<=e[1]||t[2]<=e[2])throw new Ee("DOMAIN_MAX values must be greater than DOMAIN_MIN values")}function Km(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 Ym(e){return/^[+-]?(?:\\d|\\.\\d)/.test(e)}function rl(e,t={}){let n=t.maxSize??Ar,r=null,i=zm,o=qm,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=$m(u[m]??"").trim();if(!p)continue;let b=p.split(/\\s+/),S=(b[0]??"").toUpperCase(),x=b.slice(1);if(S==="TITLE"){r=Km(p);continue}if(S==="DOMAIN_MIN"){i=tl(x,S,f);continue}if(S==="DOMAIN_MAX"){o=tl(x,S,f);continue}if(S==="LUT_3D_INPUT_RANGE"){if(x.length!==2)throw new Ee(`${S} expects two numbers`,f);let _=ut(x[0],f),R=ut(x[1],f);if(R<=_)throw new Ee("LUT_3D_INPUT_RANGE max must exceed min",f);i=[_,_,_],o=[R,R,R];continue}if(S==="LUT_1D_SIZE"){a=nl(x[0],S,f);continue}if(S==="LUT_3D_SIZE"){if(l=nl(x[0],S,f),l>n)throw new Ee(`LUT_3D_SIZE ${l} exceeds max ${n}`,f);continue}if(!Ym(S)){if(S.startsWith("LUT_"))throw new Ee(`Unsupported cube keyword ${S}`,f);continue}if(!l)throw a?new Ee("1D cube LUTs are not supported yet",f):new Ee("LUT data appears before LUT_3D_SIZE",f);if(b.length!==3)throw new Ee("LUT data rows must contain three numbers",f);s.push(ut(b[0],f),ut(b[1],f),ut(b[2],f))}if(a&&l)throw new Ee("Mixed 1D and 3D cube LUTs are not supported yet");if(!l)throw a?new Ee("1D cube LUTs are not supported yet"):new Ee("Missing LUT_3D_SIZE");jm(i,o);let c=l*l*l;if(s.length!==c*3)throw new Ee(`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 Xm(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):0}function Sn(e){return Math.round(Xm(e)*255)}function Ki(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]=Sn(e.data[s]??0),i[u+1]=Sn(e.data[s+1]??0),i[u+2]=Sn(e.data[s+2]??0),i[u+3]=255}return{width:n,height:r,data:i}}var il="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 ol=["exposure","contrast","highlights","shadows","whites","blacks","temperature","tint","vibrance","saturation"],al=["shadows","midtones","highlights"],sl=["master","red","green","blue"],ll=["hueVsHue","hueVsSaturation","hueVsLuma"];var ul=["vignette","vignetteMidpoint","vignetteRoundness","vignetteFeather","grain","grainSize","grainRoughness"],cl=["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 H1=me.unit,G1=me.signedUnit,B1=me.effects;var Ke=1024,vn=16;function dl(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 Jm(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]=dl(Ae(t,0),Ae(t,1),i,Ae(n,1)),o[o.length-1]=dl(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 fl(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 Qm(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 Zm(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 ml(e,t,n,r,i){Qm(e,r,i);let o=Jm(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=Zm(u,c,m,Ae(o,l),Ae(o,l+1));a[s]=Math.min(i,Math.max(r,f))}return a}function Bt(e,t=Ke){if(fl(e,t),e.length>vn)throw new RangeError(`A color curve supports at most ${vn} 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 ml(e,t,n=>n/(t-1),0,1)}function Xi(e,t,n,r=Ke){if(e.length<3)throw new RangeError("A hue curve requires at least three points");if(e.length>vn)throw new RangeError(`A hue curve supports at most ${vn} 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 fl(l,r),ml(l,r,s=>s/r*360,t,n)}var En="data-color-grading",An="data-hf-color-grading-source-hidden",_r="data-hf-authored-opacity",xl="__hf_color_grading_",tp=il,Zi={exposure:0,contrast:0,highlights:0,shadows:0,whites:0,blacks:0,temperature:0,tint:0,vibrance:0,saturation:0},eo={vignette:0,vignetteMidpoint:.5,vignetteRoundness:0,vignetteFeather:.65,grain:0,grainSize:.25,grainRoughness:.5},to={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 Tr=ol,yl=al,Sl=sl,vl=ll,ro=ul,io=cl,pl={exposure:.03,contrast:-.12,highlights:-.1,shadows:.16,whites:-.04,blacks:.08,temperature:.13,vibrance:-.08,saturation:-.08},hl={vignette:.18};function Ce(e,t,n={},r={},i={},o=1){return{id:e,label:t,intensity:o,adjust:{...Zi,...n},details:{...eo,...r},effects:{...to,...i}}}var oo=[Ce("neutral","Neutral"),Ce("warm-daylight","Warm Daylight",{exposure:.06,contrast:.07,highlights:-.06,shadows:.08,temperature:.18,saturation:.08}),Ce("clean-studio","Clean Studio",{contrast:.08,highlights:-.08,shadows:.06,temperature:-.08,tint:.03,saturation:.04}),Ce("skin-soft","Skin Soft",{exposure:.04,contrast:-.03,highlights:-.12,shadows:.12,temperature:.08,tint:.02,saturation:.04}),Ce("food-pop","Food Pop",{exposure:.06,contrast:.1,shadows:.06,temperature:.14,vibrance:.1,saturation:.18}),Ce("night-lift","Night Lift",{exposure:.08,contrast:.08,highlights:-.18,shadows:.2,blacks:-.08,saturation:.04},{vignette:.12}),Ce("muted-editorial","Muted Editorial",{exposure:-.02,contrast:.08,highlights:-.08,shadows:.06,blacks:-.05,temperature:-.03,saturation:-.12},{vignette:.1}),Ce("vintage-wash","Vintage Wash",pl,hl),Ce("mono-clean","Mono Clean",{contrast:.12,highlights:-.04,shadows:.04,blacks:-.08,saturation:-1}),Ce("mono-fade","Mono Fade",{contrast:-.04,highlights:-.06,shadows:.1,blacks:.12,saturation:-1},{vignette:.08}),Ce("soft-boost","Soft Boost",{exposure:.06,contrast:-.04,highlights:-.14,shadows:.16,vibrance:.08,saturation:.1}),Ce("bright-pop","Bright Pop",{exposure:.12,contrast:.12,whites:.08,blacks:-.04,vibrance:.08,saturation:.14}),Ce("deep-contrast","Deep Contrast",{exposure:-.03,contrast:.2,highlights:-.08,shadows:-.08,blacks:-.12,saturation:.06}),Ce("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),Ce("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}),Ce("home-movie-8mm","8mm Home Movie",pl,{...hl,vignette:.28,vignetteMidpoint:.54,vignetteFeather:.72,grain:.34,grainSize:.18,grainRoughness:.72},{filmArtifacts:.62},.72),Ce("editorial-halftone","Editorial Halftone",{contrast:.04,saturation:.04},{},{halftone:.94,halftoneSize:.36}),Ce("two-ink-print","Two-Ink Print",{contrast:.08,highlights:-.06,shadows:.04},{},{twoInkPrint:1,twoInkPrintSize:.42})],np=new Map(oo.map(e=>[e.id,e])),rp=/^\\$(?:\\{([A-Za-z0-9_.:-]+)\\}|([A-Za-z0-9_.:-]+))$/,ip={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}},Ut={hue:0,amount:0,level:0},gl={amount:me.unit,level:me.signedUnit},ct=[[0,0],[1,1]],Wt=[],op={hueVsHue:me.secondaryHueShift,hueVsSaturation:me.signedUnit,hueVsLuma:me.signedUnit},Ji={center:0,range:180,softness:0},Qi={min:0,max:1,softness:.05},ap={vignette:me.unit,vignetteMidpoint:me.unit,vignetteRoundness:me.signedUnit,vignetteFeather:me.unit,grain:me.unit,grainSize:me.unit,grainRoughness:me.unit},no=me.unit,sp=me.effects,El=["blur","pixelate","chromaBleed","tapeDamage","filmArtifacts","halftone","twoInkPrint","ascii","dither","bloom","monoScreen","scanlines","chromaticAberration","crtCurvature","digitalGlitch","engraving","crosshatch","kuwahara"];var lp=oo.filter(e=>El.some(t=>e.effects[t]>1e-4)),K1=oo.filter(e=>!lp.includes(e)),Y1={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}},Al=[{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 up=/^#[0-9a-f]{6}$/i;function cp(e){return!Array.isArray(e)||e.length<2||e.length>6||!e.every(t=>typeof t=="string"&&up.test(t))?null:e.map(t=>t.toLowerCase())}function Re(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function wr(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,e)):0}function Cl(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?Math.min(1,Math.max(0,n)):t}function ke(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?wr(n,t.min,t.max):0}function ao(e,t=0){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?(n%360+360)%360:t}function dp(e){let t=Re(e)?e:{};return yl.reduce((n,r)=>{let i=Re(t[r])?t[r]:{};return n[r]={hue:ao(i.hue,Ut.hue),amount:ke(i.amount??Ut.amount,gl.amount),level:ke(i.level??Ut.level,gl.level)},n},{shadows:{...Ut},midtones:{...Ut},highlights:{...Ut}})}function fp(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)?[wr(t,0,1),wr(n,0,1)]:null}function wl(e){return e.some((t,n)=>n>0&&t[0]===e[n-1]?.[0])}function mp(e){(e[0]?.[0]??0)>0&&e.unshift([0,0]),(e.at(-1)?.[0]??1)<1&&e.push([1,1])}function pp(e){if(!Array.isArray(e)||e.length<2)return ct;let t=[];for(let n of e){let r=fp(n);if(!r)return ct;t.push(r)}return t.sort((n,r)=>n[0]-r[0]),wl(t)||(mp(t),t.length>16)?ct:t}function hp(e){let t=Re(e)?e:{};return Sl.reduce((n,r)=>(n[r]=pp(t[r]),n),{master:ct,red:ct,green:ct,blue:ct})}function gp(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)?[ao(n),wr(r,t.min,t.max)]:null}function bp(e,t){if(!Array.isArray(e)||e.length<3||e.length>16)return Wt;let n=[];for(let r of e){let i=gp(r,t);if(!i)return Wt;n.push(i)}return n.sort((r,i)=>r[0]-i[0]),wl(n)?Wt:n}function xp(e){let t=Re(e)?e:{};return vl.reduce((n,r)=>(n[r]=bp(t[r],op[r]),n),{hueVsHue:Wt,hueVsSaturation:Wt,hueVsLuma:Wt})}function bl(e){let t=Re(e)?e:{},n=ke(t.min??Qi.min,no),r=ke(t.max??Qi.max,no);return{min:Math.min(n,r),max:Math.max(n,r),softness:ke(t.softness??Qi.softness,me.secondarySoftRangeSoftness)}}function yp(e){let t=Re(e)?e:{},n=ke(t.range??Ji.range,me.secondaryHueRange);return{center:ao(t.center,Ji.center),range:n,softness:ke(t.softness??Ji.softness,{min:me.secondaryHueSoftness.min,max:me.secondaryHueCombinedMax-n})}}function Sp(e){return{hueShift:ke(e.hueShift??0,me.secondaryHueShift),saturation:ke(e.saturation??0,me.signedUnit),luma:ke(e.luma??0,me.signedUnit),temperature:ke(e.temperature??0,me.signedUnit),tint:ke(e.tint??0,me.signedUnit)}}function vp(e){return!Re(e)||!Re(e.key)||!Re(e.correction)?null:{enabled:e.enabled!==!1,key:{hue:yp(e.key.hue),saturation:bl(e.key.saturation),luma:bl(e.key.luma)},correction:Sp(e.correction)}}function Ep(e){if(!Array.isArray(e))return[];let t=[];for(let n of e.slice(0,4)){let r=vp(n);r&&t.push(r)}return t}function Ap(e){if(e==null)return null;let t=String(e).trim();return t||null}function Cp(e){if(e==null)return null;if(typeof e=="string"){let n=e.trim();return n?{src:n,intensity:1}:null}if(!Re(e))return null;let t=e.src;return typeof t!="string"||t.trim()===""?null:{src:t.trim(),intensity:Cl(e.intensity,1)}}function wp(e){if(typeof e=="string"){let t=e.trim();if(!t)return null;if(t.startsWith("{"))try{let n=JSON.parse(t);return Re(n)?n:null}catch{return null}return{preset:t}}return Re(e)?e:null}function _p(e,t){let n=e.trim().match(rp);if(!n)return e;let r=n[1]??n[2]??"";return r&&Object.hasOwn(t,r)?t[r]:e}function Cr(e,t){if(typeof e=="string"){let r=_p(e,t);if(r!==e)return r;let i=e.trim();if(!i.startsWith("{"))return e;try{return Cr(JSON.parse(i),t)}catch{return e}}if(Array.isArray(e))return e.map(r=>Cr(r,t));if(!Re(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=Cr(i,t);return n}function Tp(e){return e?np.get(e)??null:null}function Rr(e){let t=wp(e);if(!t||t.enabled===!1)return null;let n=Ap(t.preset),r=Tp(n),i=r?.adjust??Zi,o=r?.details??eo,a=r?.effects??to,l=Re(t.adjust)?t.adjust:{},s=Re(t.details)?t.details:{},u=Re(t.effects)?t.effects:{},c=Tr.reduce((p,b)=>(p[b]=ke(l[b]??i[b],ip[b]),p),{...Zi}),m=ro.reduce((p,b)=>(p[b]=ke(s[b]??o[b],ap[b]),p),{...eo}),f=io.reduce((p,b)=>(p[b]=ke(u[b]??a[b],sp[b]??no),p),{...to});return{enabled:!0,preset:n,intensity:Cl(t.intensity,r?.intensity??1),adjust:c,wheels:dp(t.wheels),curves:hp(t.curves),hueCurves:xp(t.hueCurves),secondaries:Ep(t.secondaries),details:m,effects:f,palette:cp(t.palette),lut:Cp(t.lut),colorSpace:typeof t.colorSpace=="string"&&t.colorSpace.trim()?t.colorSpace.trim():tp}}function _l(e,t){return Rr(Cr(e,t))}function Rp(e){return yl.some(t=>Math.abs(e[t].amount)>1e-4||Math.abs(e[t].level)>1e-4)}function so(e){return Sl.some(t=>e[t].some(([n,r])=>Math.abs(n-r)>1e-4))}function lo(e){return vl.some(t=>e[t].some(([,n])=>Math.abs(n)>1e-4))}function uo(e){return e.some(t=>t.enabled&&Object.values(t.correction).some(n=>Math.abs(n)>1e-4))}function Tl(e){return e?.enabled?Math.abs(e.details.vignette)>1e-4||Math.abs(e.details.grain)>1e-4||El.some(n=>Math.abs(e.effects[n])>1e-4)?!0:e.intensity===0?!1:e.lut&&e.lut.intensity!==0?!0:Tr.some(n=>Math.abs(e.adjust[n])>1e-4)||(e.wheels?Rp(e.wheels):!1)||(e.curves?so(e.curves):!1)||(e.hueCurves?lo(e.hueCurves):!1)||(e.secondaries?uo(e.secondaries):!1):!1}var kp=["[data-hyperframes-ignore]","[data-hyperframes-picker-ignore]","[data-hf-ignore]","[data-no-inspect]","[data-no-pick]","[data-hyper-shader-loading]"].join(","),Fp=["[data-hyperframes-picker-block]","[data-hyper-shader-loading]"].join(",");function Rl(e){let t=!1,n=null,r=null,i=null,o=null;function a(v,E){try{window.dispatchEvent(new CustomEvent(v,{detail:E}))}catch(w){N("runtime.picker.site1",w)}}function l(v){i=v,a("hyperframe:picker:hovered",{elementInfo:i,isPickMode:t,timestamp:Date.now()})}function s(v){o=v,a("hyperframe:picker:selected",{elementInfo:o,isPickMode:t,timestamp:Date.now()})}function u(v){let E=v.ownerDocument.defaultView;if(!E)return!1;let w=v;for(;w&&w!==document.body&&w!==document.documentElement;){let L=E.getComputedStyle(w);if(L.display==="none"||L.visibility==="hidden"||L.pointerEvents==="none")return!0;let D=Number.parseFloat(L.opacity);if(Number.isFinite(D)&&D<=.01&&!w.hasAttribute(An))return!0;w=w.parentElement}return!1}function c(v){if(!v||v===document.body||v===document.documentElement)return!1;let E=v.tagName.toLowerCase();return!(E==="script"||E==="style"||E==="link"||E==="meta"||v.classList.contains("__hf-pick-highlight")||v.closest(kp)||u(v))}function m(v){return!!v?.closest(Fp)}function f(v){let E=v;if(E.id)return`#${CSS.escape(E.id)}`;let w=v.getAttribute("data-composition-id");if(w)return`[data-composition-id="${CSS.escape(w)}"]`;let L=v.getAttribute("data-composition-src");if(L)return`[data-composition-src="${CSS.escape(L)}"]`;let D=v.getAttribute("data-track-index");if(D)return`[data-track-index="${CSS.escape(D)}"]`;let H=v.tagName.toLowerCase(),z=v.parentElement;if(!z)return H;let j=z.querySelectorAll(`:scope > ${H}`);if(j.length===1)return H;for(let k=0;k<j.length;k+=1)if(j[k]===v)return`${H}:nth-of-type(${k+1})`;return H}function p(v){let E=v.tagName.toLowerCase(),w=(v.textContent??"").trim().replace(/\\s+/g," "),L=(D,H)=>D.length>H?`${D.slice(0,H-1)}\\u2026`:D;return E==="h1"||E==="h2"||E==="h3"?"Heading":E==="p"||E==="span"||E==="div"?w.length>0?L(w,56):"Text":E==="img"?"Image":E==="video"?"Video":E==="audio"?"Audio":E==="svg"?"Shape":v.getAttribute("data-composition-src")?"Composition":E==="section"?"Section":`${E.charAt(0).toUpperCase()}${E.slice(1)}`}function b(v,E,w){let L=typeof w=="number"&&w>0?w:8,D=[];if(document.elementsFromPoint)D=document.elementsFromPoint(v,E);else if(document.elementFromPoint){let j=document.elementFromPoint(v,E);D=j?[j]:[]}if(m(D[0]??null))return[];let H={},z=[];for(let[j,k]of D.entries()){if(!c(k))continue;let B=`${k.tagName}::${k.id||""}::${j}`;if(!H[B]&&(H[B]=!0,z.push(k),z.length>=L))break}return z}function S(v){let E=v.getBoundingClientRect(),w={};for(let D of Array.from(v.attributes))D.name.startsWith("data-")&&(w[D.name]=D.value);return{id:v.id||null,tagName:v.tagName.toLowerCase(),selector:f(v),label:p(v),boundingBox:{x:E.left,y:E.top,width:E.width,height:E.height},textContent:v.textContent?v.textContent.trim().slice(0,200):null,src:v.getAttribute("src")||v.getAttribute("data-composition-src")||null,dataAttributes:w}}function x(v,E,w){return b(v,E,w).map(S)}function _(v){if(!t)return;let w=b(v.clientX,v.clientY,1)[0]??(v.target instanceof Element?v.target:null);if(!c(w)||n===w)return;n&&n.classList.remove("__hf-pick-highlight"),n=w,w.classList.add("__hf-pick-highlight");let L=S(w);l(L),e.postMessage({source:"hf-preview",type:"element-hovered",elementInfo:L})}function R(v){if(!t)return;v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation();let E=x(v.clientX,v.clientY,8);E.length!==0&&(l(E[0]??null),e.postMessage({source:"hf-preview",type:"element-pick-candidates",candidates:E,selectedIndex:0,point:{x:v.clientX,y:v.clientY}}))}function T(v){v.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 A(){window.__HF_PICKER_API={enable:F,disable:M,isActive:()=>t,getHovered:()=>i,getSelected:()=>o,getCandidatesAtPoint:(v,E,w)=>Number.isFinite(v)&&Number.isFinite(E)?x(v,E,w):[],pickAtPoint:(v,E,w)=>{if(!Number.isFinite(v)||!Number.isFinite(E))return null;let L=x(v,E,8);if(!L.length)return null;let D=Math.max(0,Math.min(L.length-1,Number(w??0))),H=L[D]??null;return H?(s(H),e.postMessage({source:"hf-preview",type:"element-picked",elementInfo:H}),M(),H):null},pickManyAtPoint:(v,E,w)=>{if(!Number.isFinite(v)||!Number.isFinite(E))return[];let L=x(v,E,8);if(!L.length)return[];let D=[],H=Array.isArray(w)?w:[0];for(let z of H){let j=Math.max(0,Math.min(L.length-1,Math.floor(Number(z)))),k=L[j];if(!k)continue;D.some(ee=>ee.selector===k.selector&&ee.tagName===k.tagName)||D.push(k)}return D.length?(s(D[0]??null),e.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:D}),M(),D):[]}},a("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:F,disablePickMode:M,installPickerApi:A}}var Mp=["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 Vt(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 kl(e,t,n=Mp){for(let r of n){let i=t.getPropertyValue(r);i&&e.setProperty(r,i)}}function Cn(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&&N("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&&N("runtime.player.nonConformantVoid",{method:t,actual:typeof n})}function wn(e,t,n){if(e){for(let r of Object.values(e))if(!(!r||r===t))try{n(r)}catch(i){N("runtime.player.site1",i)}}}function Fl(e,t,n,r){let i=Vt(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 Lp(e,t,n,r,i){let o=[];wn(e,t,a=>{Be(a,"play"),o.push(a)});try{return Fl(t,n,r,i)}finally{for(let a of o)try{Be(a,"pause")}catch(l){N("runtime.player.site2",l)}}}function Np(e,t){wn(e,t,n=>{Be(n,"play")})}function Ml(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?.()??Cn(n,"duration",0))||0);r>0&&Math.max(0,Cn(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"),wn(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"),wn(e.getTimelineRegistry?.(),n,i=>{Be(i,"pause")});let r=Math.max(0,Cn(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=Lp(e.getTimelineRegistry?.(),i,o,e.getCanonicalFps());e.onDeterministicSeek(l),r?.keepPlaying&&a?(typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),Be(i,"play"),wn(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?(Np(e.getTimelineRegistry?.(),i),Fl(i,n,o,r)):Vt(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:()=>Cn(e.getTimeline(),"time",0),getDuration:()=>Cn(e.getTimeline(),"duration",0),isPlaying:()=>e.getIsPlaying(),setPlaybackRate:n=>e.setPlaybackRate(n),getPlaybackRate:()=>e.getPlaybackRate()}}function Ll(){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 Dp=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function co(e){return e.id||e.getAttribute("data-hf-id")||null}function Ip(e){return ve(e)}function Pp(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 Op(e){return!(e instanceof HTMLMediaElement)||!Number.isFinite(e.duration)?null:Ze(e,e.duration)}function Hp(e,t,n,r){let i=Ip(e.getAttribute("data-duration"));return i!=null&&i>0?i:Pp(e,t)??Op(e)??Math.max(0,n-r)}function Gp(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 Nl(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||Dp.has(l.tagName))continue;let s=t.resolveStartForElement(l,0);if(Hp(l,n,r,s)<=0)continue;let u={id:co(l)??`__clip-${a++}`,element:l,parentId:null,children:[]};i.set(l,u)}return Gp(i),{roots:Array.from(i.values()).filter(l=>l.parentId===null)}}var fo="css:root",Dl=["backdrop-filter","clip-path","filter","mask","mask-border-source","mask-image","perspective","rotate","scale","transform","translate","-webkit-mask-image"],Bp=new Set([...Dl,"contain","isolation","mask-border","mix-blend-mode","opacity"]),Up=new Set(["absolute","relative"]),Wp=new Set(["flex","inline-flex","grid","inline-grid"]),Vp=new Set(["layout","paint","strict","content"]),zp=new Set(["size","inline-size"]);function qp(e){return e.position==="fixed"||e.position==="sticky"}function $p(e,t){if(t.zIndex==="auto"||t.zIndex==="")return!1;if(Up.has(t.position))return!0;let n=e.parentElement?e.ownerDocument.defaultView?.getComputedStyle(e.parentElement).display:null;return n!=null&&Wp.has(n)}function jp(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:Dl.some(r=>{let i=e.getPropertyValue(r);return i!==""&&i!=="none"})}function Kp(e){return e.getPropertyValue("contain").split(/\\s+/).some(n=>Vp.has(n))?!0:zp.has(e.getPropertyValue("container-type"))}function Yp(e){return e.getPropertyValue("will-change").split(",").map(t=>t.trim()).some(t=>Bp.has(t))}function Xp(e,t){return qp(t)||$p(e,t)||jp(t)||Kp(t)?!0:Yp(t)}function Jp(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 kr(e){let t=e.ownerDocument.defaultView;if(!t)return fo;let n=e.parentElement;for(;n&&n!==e.ownerDocument.documentElement;){try{if(Xp(n,t.getComputedStyle(n)))return Jp(n)}catch{return fo}n=n.parentElement}return fo}var Qp="data-hf-authored-duration",Zp="data-hf-authored-end";function e0(e){return Ge(e.getAttribute("data-duration"))}function t0(e){return Ge(e.getAttribute("data-end"))}function n0(e){return Ge(e.getAttribute(Qp))}function r0(e){return Ge(e.getAttribute(Zp))}function dt(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,S=e0(f)??(n?n0(f):null);if(S!=null&&S>0&&(b=S),b==null||b<=0){let x=t0(f)??(n?r0(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=cn(f);Number.isFinite(f.duration)&&f.duration>x&&(b=(f.duration-x)/Te(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){N("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 S=f.parentElement?.closest("[data-composition-id]");return S?m(S,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 S=Pi(f.getAttribute("data-start"));if(!S){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,p);return i.set(f,M),M}}return i.set(f,p),p}if(S.kind==="absolute"){let F=Math.max(0,S.value),M=Math.max(0,c(f,p)+F);return i.set(f,M),M}let x=l(S.refId);if(!x)return i.set(f,p),p;let _=m(x,0),R=u(x);if(R==null||R<=0){let F=Math.max(0,_+S.offset);return i.set(f,F),F}let T=Math.max(0,_+R+S.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 mo(e){let t=e.trim().toLowerCase();return!(!t||t==="main"||t.includes("caption")||t.includes("ambient"))}var o0="data-hf-authored-duration",a0="data-hf-authored-end";function Ue(e){return ve(e)}function po(e){return Ue(e.getAttribute("data-duration"))??Ue(e.getAttribute(o0))}function Il(e){return Ue(e.getAttribute("data-end"))??Ue(e.getAttribute(a0))}function ho(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 go(...e){let t=e.filter(n=>Number.isFinite(n??null));return t.length===0?null:Math.max(...t)}function bo(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 Tn(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 Pl(e){let t=e.getAttribute("src")??e.getAttribute("data-src");if(t)return Tn(t);let n=e.getAttribute("data-composition-src");if(n)return Tn(n);let r=e.querySelector("img[src], video[src], audio[src], source[src]");return r?Tn(r.getAttribute("src")):null}function s0(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 l0(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 u0(e){let t=e.textContent?.replace(/\\s+/g," ").trim();return t?t.length>32?`${t.slice(0,31)}...`:t:null}function _n(e){let t=e.replace(/\\.[^.]+$/i,"").replace(/[-_]+/g," ").replace(/\\s+/g," ").trim();return t?t.replace(/\\b\\w/g,n=>n.toUpperCase()):e}function c0(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 _n(i);let o=e.id;if(o)return _n(o);let a=s0(e);if(a)return _n(a);let l=l0(Pl(e));if(l)return _n(l);let s=u0(e);return s||`${_n(t)} ${n+1}`}function Ol(e){let n=window.__timelines??{},r=dt({timelineRegistry:n,includeAuthoredTimingAttrs:!0}),i=W=>{if(!W)return null;let P=n[W]??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=W=>{let P=Ue(W.getAttribute("data-duration"));return P!=null&&P>0?P:Number.isFinite(W.duration)?Ze(W,W.duration):null},a=()=>{let W=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(W.length===0)return null;let P=0;for(let O of W){let ce=O.hasAttribute("data-hf-auto-start")?r.resolveStartForElement(O,0):Math.max(0,Number(O.getAttribute("data-start")??0)||0);if(!Number.isFinite(ce))continue;let se=o(O);se==null||se<=0||(P=Math.max(P,Math.max(0,ce)+se))}return P>0?P:null},l=(W,P)=>{let O=[],ce=null,se=null,J=null,K=W.parentElement;for(;K;){let Y=K.getAttribute("data-composition-id");Y&&(O.push(Y),!J&&K!==P&&(J=Y),ce==null&&(ce=r.resolveStartForElement(K,0)),se==null&&(se=Ue(K.getAttribute("data-duration"))??i(Y)??null)),K=K.parentElement}return{parentCompositionId:J,compositionAncestors:O.reverse(),inheritedStart:ce,inheritedDuration:se}},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),S=po(s??document.body),x=go(...u.filter(W=>W!==s).map(W=>{let P=r.resolveStartForElement(W,0),O=r.resolveDurationForElement(W)??i(W.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 S=="number"&&Number.isFinite(S)&&S>0?S:null,F=typeof p=="number"&&Number.isFinite(p)&&p>0?p:null,M=typeof _=="number"&&Number.isFinite(_)&&_>0?_:null,A=go(F,M),v=R!=null&&A!=null&&R>A+1,w=T??(v?A:go(R,F,M))??null,D=(w!=null?m+w:null)??(typeof f=="number"&&Number.isFinite(f)&&f>0?f:null),H=(W,P)=>!Number.isFinite(P)||P<=0?0:D==null||!Number.isFinite(D)?P:!Number.isFinite(W)||W>=D?0:Math.max(0,Math.min(P,D-W)),z=[],j=[],k=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),B=0;for(let[W,P]of k.entries()){if(P===s||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(P.tagName))continue;let O=l(P,s),ce=r.resolveStartForElement(P,O.inheritedStart??0),se=P.getAttribute("data-composition-id"),J=po(P);if(J==null&&se&&se!==c&&(J=i(se)),J==null&&P instanceof HTMLMediaElement&&Number.isFinite(P.duration)&&(J=Ze(P,P.duration)),J==null){let xe=O.inheritedDuration;if(xe!=null&&xe>0){let Ie=(O.inheritedStart??0)+xe;J=Math.max(0,Ie-ce)}}if(J==null||J<=0||(J=H(ce,J),J<=0))continue;let K=ce+J;B=Math.max(B,K);let Y=P.tagName.toLowerCase(),ze=se&&se!==c?"composition":Y==="video"?"video":Y==="audio"?"audio":Y==="img"?"image":"element";z.push({id:co(P)??se??null,label:c0(P,ze,z.length),start:ce,duration:J,track:bo(P,W),zIndex:ho(P),stackingContextId:kr(P),kind:ze,tagName:Y,compositionId:P.getAttribute("data-composition-id"),compositionAncestors:O.compositionAncestors,parentCompositionId:O.parentCompositionId,nodePath:null,compositionSrc:Tn(P.getAttribute("data-composition-src")),playbackStart:je(P),playbackRate:Te(P),assetUrl:Pl(P),timelineRole:P.getAttribute("data-timeline-role"),timelineLabel:P.getAttribute("data-timeline-label"),timelineGroup:P.getAttribute("data-timeline-group"),timelinePriority:Ue(P.getAttribute("data-timeline-priority"))})}let ee=new Set(z.map(W=>W.id)),U=s?.getAttribute("data-composition-id")??null,V=U?n[U]??null:null;if(V&&s){let W=V;if(typeof W.getChildren=="function")try{let P=W.getChildren(!0,!0,!1)??[],O=new Map;for(let J of s.children){let K=J;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 ce=J=>{let K=J;for(;K;){if(O.has(K))return K;if(K===s)return null;K=K.parentElement}return null};for(let J of P){if(typeof J.targets!="function"||typeof J.startTime!="function"||typeof J.duration!="function")continue;let K=J.startTime(),Y=J.parent;for(;Y&&Y!==V&&typeof Y.startTime=="function";)K+=Y.startTime(),Y=Y.parent;let ze=K+J.duration();if(!(!Number.isFinite(K)||!Number.isFinite(ze)))for(let xe of J.targets()){if(!(xe instanceof Element))continue;let Mt=ce(xe);if(!Mt)continue;let Ie=O.get(Mt);Ie&&(Ie.start=Math.min(Ie.start,K),Ie.end=Math.max(Ie.end,ze))}}let se=z.length>0?Math.max(...z.map(J=>J.track))+1:0;for(let[J,K]of O){if(K.start===1/0||K.end===-1/0)continue;let Y=J;if(ee.has(Y.id))continue;let ze=Math.max(0,K.end-K.start);if(ze<=0)continue;let xe=H(K.start,ze);xe<=0||(B=Math.max(B,K.start+xe),z.push({id:Y.id,label:Y.getAttribute("data-timeline-label")??Y.getAttribute("data-label")??Y.getAttribute("aria-label")??Y.id,start:K.start,duration:xe,track:bo(Y,se),zIndex:ho(Y),stackingContextId:kr(Y),kind:"element",tagName:Y.tagName.toLowerCase(),compositionId:Y.getAttribute("data-composition-id"),compositionAncestors:U?[U]:[],parentCompositionId:U,nodePath:null,compositionSrc:null,playbackStart:je(Y),playbackRate:Te(Y),assetUrl:null,timelineRole:Y.getAttribute("data-timeline-role"),timelineLabel:Y.getAttribute("data-timeline-label"),timelineGroup:Y.getAttribute("data-timeline-group"),timelinePriority:Ue(Y.getAttribute("data-timeline-priority"))}),ee.add(Y.id))}}catch(P){N("runtime.timeline.site1",P)}}if(s&&w!=null&&w>0){let W=z.length>0?Math.max(...z.map(P=>P.track))+1:0;for(let P of s.children){let O=P;if(!O.id||ee.has(O.id))continue;let ce=O.getAttribute("data-timeline-role");if(ce!=="overlay"&&ce!=="persistent-overlay")continue;let se=O.tagName.toLowerCase();if(se==="script"||se==="style"||se==="link"||se==="meta"||window.getComputedStyle(O).display==="none")continue;let K=H(0,w);K<=0||(B=Math.max(B,K),z.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:bo(O,W),zIndex:ho(O),stackingContextId:kr(O),kind:"element",tagName:se,compositionId:O.getAttribute("data-composition-id"),compositionAncestors:U?[U]:[],parentCompositionId:U,nodePath:null,compositionSrc:null,playbackStart:je(O),playbackRate:Te(O),assetUrl:null,timelineRole:ce,timelineLabel:O.getAttribute("data-timeline-label"),timelineGroup:O.getAttribute("data-timeline-group"),timelinePriority:Ue(O.getAttribute("data-timeline-priority"))}),ee.add(O.id))}}for(let W of u){if(W===s)continue;let P=W.getAttribute("data-composition-id");if(!P||!mo(P))continue;let O=r.resolveStartForElement(W,0),ce=po(W);if((ce==null||ce<=0)&&Il(W)!=null){let Y=Il(W);ce=Math.max(0,Y-O)}let se=i(P),J=ce&&ce>0?ce:se;if(J==null||J<=0)continue;let K=H(O,J);K<=0||j.push({id:P,label:W.getAttribute("data-label")??P,start:O,duration:K,thumbnailUrl:Tn(W.getAttribute("data-thumbnail-url")),avatarName:null})}let q=Math.max(1,B||1,w??0),X=v&&T==null,we=X?Number.POSITIVE_INFINITY:Math.max(1,Math.ceil(q*Math.max(1,e.canonicalFps)));return{...cr(e.canonicalFps),source:"hf-preview",type:"timeline",compositionContractVersion:1,durationSeconds:X?Number.POSITIVE_INFINITY:q,durationInFrames:we,clips:z,scenes:j,compositionWidth:Ue(s?.getAttribute("data-width"))??1920,compositionHeight:Ue(s?.getAttribute("data-height"))??1080}}var xo="data-composition-id",d0="data-composition-src",f0=`[${xo}]`,NS=`[${d0}]`,Hl="style",Gl="script",m0=\'link[rel="stylesheet"], link[rel="preconnect"]\';function zt(e){return e?Array.from(e):[]}function Bl(e){let{contentNode:t,head:n,documentElement:r,hasTemplate:i,compositionId:o}=e,a=zt(t.querySelectorAll(f0)),l=o?a.find(c=>c.getAttribute(xo)===o)??null:a[0]??null,s=(l??a[0])?.getAttribute(xo)?.trim()||"",u=i?null:n??null;return{innerRoot:l,authoredCompositionId:o||s||null,scriptCompositionId:s||o||null,authoredRootId:l?.getAttribute("id")?.trim()||null,styleSources:[...zt(u?.querySelectorAll(Hl)),...zt(t.querySelectorAll(Hl))],scriptSources:[...zt(u?.querySelectorAll(Gl)),...zt(t.querySelectorAll(Gl))],linkSources:zt(n?.querySelectorAll(m0)),variableDefaultCarriers:[r,l].filter(c=>c!=null)}}var pe=Xf(dc(),1),fc=pe.default,Ev=pe.default.stringify,Av=pe.default.fromJSON,Cv=pe.default.plugin,wv=pe.default.parse,_v=pe.default.list,Tv=pe.default.document,Rv=pe.default.comment,kv=pe.default.atRule,Fv=pe.default.rule,Mv=pe.default.decl,Lv=pe.default.root,Nv=pe.default.CssSyntaxError,Dv=pe.default.Declaration,Iv=pe.default.Container,Pv=pe.default.Processor,Ov=pe.default.Document,Hv=pe.default.Comment,Gv=pe.default.Warning,Bv=pe.default.AtRule,Uv=pe.default.Result,Wv=pe.default.Input,Vv=pe.default.Rule,zv=pe.default.Root,qv=pe.default.Node;var zo="data-hf-authored-id",mc="data-hf-inner-root";function qo(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function $o(e){return e.replace(/\\\\/g,"\\\\\\\\").replace(/"/g,\'\\\\"\')}function Ih(e){return e&&e.replace(/[^a-zA-Z0-9_-]/g,n=>`\\\\${n}`).replace(/^-?\\d/,n=>`\\\\${n}`)}function hc(e){let t=e.trim();return t?Array.from(new Set([t,Ih(t)])).filter(Boolean):[]}function Ph(e){return!!e&&/[\\w-]/.test(e)}function Oh(e,t,n){let r=hc(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(!Ph(m)){i+=n,l+=c.length;continue}}}i+=s}return i}function Hh(e,t){let n=t?.trim();return n?Oh(e,n,`[${zo}="${$o(n)}"]`):e}function pc(e){return`${e}:not(:has([${mc}])), ${e} > [${mc}]`}function Gh(e,t,n,r,i,o){let a=Hh(e,r),l=Bh(a,t,n),s=l.trim();if(!s||s==="*")return e;if(/^(html|body|:root)$/i.test(s))return o?pc(t):e;let u=new RegExp(`\\\\[\\\\s*data-composition-id\\\\s*=\\\\s*(["\'])${qo(n)}\\\\1\\\\s*\\\\]`,"g");if(u.test(s))return s.replace(u,"").trim()===""?pc(t):l.replace(u,t);let c=l.match(/^\\s*/)?.[0]??"",m=l.match(/\\s*$/)?.[0]??"";if(i){let f=r?`[${zo}="${$o(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 Bh(e,t,n){let r=qo(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 Uh=new Set(["keyframes","-webkit-keyframes","font-face"]);function Wh(e){return e?.type==="atrule"}function Vh(e){let t=e.parent;for(;t;){if(Wh(t)&&Uh.has(t.name.toLowerCase()))return!0;t=t.parent}return!1}function zh(e){let t=e.parent;for(;t;){if(t.type==="rule")return!0;t=t.parent}return!1}function gc(e,t,n,r,i){let o=t.trim();if(!e||!o)return e;let a=n||`[data-composition-id="${$o(o)}"]`,l=fc.parse(e);return l.walkRules(s=>{Vh(s)||zh(s)||(s.selectors=s.selectors.map(u=>Gh(u,a,o,r,i?.compoundAuthoredRoot,i?.scopeRootSelectors)))}),l.toResult({map:!1}).css}function nt(e){return JSON.stringify(e).replace(/</g,"\\\\u003c")}function bc(e,t,n="[HyperFrames] composition script error:",r,i=t,o){let a=nt(t),l=nt(i),s=nt(n),u=qo(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(hc(o?.trim()||""));return`(function(){\n var __hfCompId = ${a};\n var __hfTimelineCompId = ${l};\n var __hfErrorLabel = ${s};\n var __hfAuthoredRootId = ${c};\n var __hfAuthoredRootAttr = ${nt(zo)};\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 return Reflect.get(target, prop, target);\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 qh=["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 xc(e){let t=e.getAttribute("id")?.trim();for(let n of qh)e.removeAttribute(n);t&&(e.removeAttribute("id"),e.setAttribute("data-hf-authored-id",t)),e.setAttribute("data-hf-inner-root","true")}var $h=8e3,jh=/^(?![a-zA-Z][a-zA-Z\\d+\\-.]*:)(?!\\/\\/)(?!\\/)(?!\\.\\.?\\/).+/,Kh=/\\burl\\(\\s*(["\']?)([^)"\']+)\\1\\s*\\)/g,Yh=["src","href"];function Xh(e){return!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")||e.startsWith("data:")||e.startsWith("#")||e.startsWith("/")}function vc(e,t){if(!t)return e;let n=e.trim();if(Xh(n)||!n.startsWith("../")&&n!=="..")return e;try{return new URL(n,t).href}catch{return e}}function Ec(e,t){return!t||!e?e:e.replace(Kh,(n,r,i)=>{let o=vc(i||"",t);return o===i?n:`url(${r||""}${o}${r||""})`})}function Jh(e,t){for(let n of Array.from(e.querySelectorAll("[src], [href]")))for(let r of Yh){let i=n.getAttribute(r);if(i==null)continue;let o=vc(i,t);o!==i&&n.setAttribute(r,o)}}function Qh(e,t){for(let n of Array.from(e.querySelectorAll("[style]"))){let r=n.getAttribute("style");if(r==null)continue;let i=Ec(r,t);i!==r&&n.setAttribute("style",i)}}function Zh(e,t){for(let n of Array.from(e.querySelectorAll("style"))){let r=n.textContent||"",i=Ec(r,t);i!==r&&(n.textContent=i)}}function Ac(e,t){if(t){Jh(e,t),Qh(e,t),Zh(e,t);for(let n of Array.from(e.querySelectorAll("template")))Ac(n.content,t)}}function eg(e,t){return`${e}__hf${t}`}var tg=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"),$h)});function jo(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.textContent=""}function yc(e){for(let t of Array.from(e.querySelectorAll("style, script")))t.remove()}function ng(e){let t=document.importNode(e,!0);xc(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 rg(e,t){let n=e.trim();if(!n)return e;try{return jh.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 Sc(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 qr(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 ig(e){let t=new Map;for(let n of e){let r=qr(n).authoredCompositionId||"";r&&t.set(r,(t.get(r)||0)+1)}return t}function Cc(e){let t=qr(e).authoredCompositionId;return t?!!document.querySelector(`template#${CSS.escape(t)}-template`):!1}function og(e){return!!e.querySelector(\'[data-hf-inner-root="true"]\')}function ag(e){return e.hasAttribute("data-composition-src")?!0:Cc(e)?e.children.length===0||e.hasAttribute("data-hf-original-composition-id")?!0:og(e):!1}function Yo(){return Array.from(document.querySelectorAll("[data-composition-src], [data-composition-id]")).filter(t=>t.hasAttribute("data-composition-src")?!0:Cc(t))}function wc(){let e=window.__hfVariablesByComp;if(!e)return;let t=new Set(Yo().map(n=>qr(n).runtimeCompositionId).filter(n=>!!n));for(let n of Object.keys(e))t.has(n)||delete e[n]}function _c(e,t=ig(e)){let n=new Map,r=new Map;for(let i of e){let{authoredCompositionId:o,runtimeCompositionId:a}=qr(i),l=ag(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?eg(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 Ko(e){let t=Bl({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&&Sc(b,e.compositionUrl)||document.head.querySelector(`link[href="${CSS.escape(b)}"]`))continue;let S=f.cloneNode(!0);S instanceof HTMLLinkElement&&(S.href=b,document.head.appendChild(S),e.injectedLinks.push(S))}(f=>{for(let p of f){let b=p.cloneNode(!0);b instanceof HTMLStyleElement&&(i&&(b.textContent=gc(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=rg(b,e.compositionUrl);return e.compositionUrl&&Sc(x,e.compositionUrl)?null:{kind:"external",src:x,type:p}}let S=f.textContent?.trim()??"";return S?{kind:"inline",content:S,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),S=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),S&&e.host instanceof HTMLElement&&(e.host.style.height=S),n.hasAttribute("data-timeline-locked")&&e.host.setAttribute("data-timeline-locked","");let x=ng(n);!e.authoredCompositionId&&i&&x.setAttribute("data-composition-id",i),yc(x),e.host.appendChild(x)}else if(e.hasTemplate){let f=document.importNode(r,!0);yc(f),e.host.appendChild(f)}else e.host.innerHTML=e.fallbackBodyInnerHtml;a&&sg(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=bc(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 tg(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 Tc(e){let t=Yo();if(wc(),t.length===0)return;let n=_c(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`);jo(i),await Ko({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 Rc(e){let t=Yo();if(wc(),t.length===0)return;let n=_c(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}jo(i);try{let c=l!=null?document.querySelector(`template#${CSS.escape(l)}-template`):null;if(c){await Ko({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");Ac(b,u);let S=(l?b.querySelector(`template#${CSS.escape(l)}-template`):null)??b.querySelector("template"),x=S?S.content:b.body;await Ko({host:i,authoredCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,sourceNode:x,hasTemplate:!!S,fallbackBodyInnerHtml:b.body.innerHTML,compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,head:b.head,declaredVariableDefaults:un(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"}}),jo(i)}}))}function sg(e,t,n){let i={...e.declaredVariableDefaults??(t instanceof Element?un(t):{}),...cs(e.host)};ki(e.variableDeclarer??(t instanceof Element?t:null),i,n),ls(e.host),Object.keys(i).length>0?(window.__hfVariablesByComp||(window.__hfVariablesByComp={}),window.__hfVariablesByComp[n]=i,Fi(e.host,{...ss(e.host,i,window),...fr()})):window.__hfVariablesByComp&&delete window.__hfVariablesByComp[n]}function Xo(e){let n=e.vars.data?.captionState;return n==="dim"||n==="active"?n:void 0}function lg(e){return e instanceof HTMLElement?e.dataset.captionWrapper!=="true"?e:e.querySelector(":scope > span")??null:null}function ug(){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 cg(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 Jo(){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=ug();for(let r of t){let i=null;if(r.wordId&&(i=lg(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=>Xo(m)==="dim")??s.find(m=>Xo(m)===void 0),c=u?String(u.vars.color):"";for(let m of s)(Xo(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=cg(i);e.set(l,o)}}}).catch(()=>{})}var Zo="data-hf-edit-base-x",ea="data-hf-edit-base-y",Xt="data-hf-edit-original-translate",$r=e=>{let t=parseFloat(e??"");return Number.isFinite(t)?t:0},dg=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},kc=/^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)px$/,Qo=(e,t)=>kc.test(e)&&kc.test(t)?`${parseFloat(e)+parseFloat(t)}px`:`calc(${e} + ${t})`,fg=(e,t,n)=>{if(!e||e==="none")return`${t} ${n}`;let[r,i,o]=dg(e);if(r===void 0)return`${t} ${n}`;if(i===void 0)return`${Qo(r,t)} ${n}`;let a=o===void 0?"":` ${o}`;return`${Qo(r,t)} ${Qo(i,n)}${a}`},mg=e=>{try{e.ownerDocument.defaultView?.gsap?.getProperty?.(e,"x")}catch{}},pg=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""}},ta=new WeakMap;function hg(e,t){let n=ta.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=$r(e.getAttribute("data-x"))-$r(e.getAttribute(Zo)),i=$r(e.getAttribute("data-y"))-$r(e.getAttribute(ea));e.hasAttribute(Xt)||e.setAttribute(Xt,pg(e)),n===void 0&&mg(e);let o=e.getAttribute(Xt)??"",a=fg(o,`${r}px`,`${i}px`);e.style.setProperty("translate",a),ta.set(e,e.style.getPropertyValue("translate"))}function jr(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(`[${Xt}]:not([${Zo}]):not([${ea}])`);for(let s=0;s<o.length;s++){let u=o[s];if(u===void 0||!i(u))continue;let c=u.getAttribute(Xt)??"";c===""?u.style.removeProperty("translate"):u.style.setProperty("translate",c),u.removeAttribute(Xt),ta.delete(u)}let a=e.querySelectorAll(`[${Zo}], [${ea}]`),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 Fc="__hfPositionEditsSeekReapplyWrapped",Mc=new WeakSet,Lc=new WeakMap,Nc=new WeakMap;function Dc(e){let t=e,n=()=>{try{jr(t.document)}catch{}},r=m=>typeof m=="function"&&(Mc.has(m)||!!m[Fc]),i=m=>{Mc.add(m);try{Object.defineProperty(m,Fc,{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=Lc.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 S=m[f],x=b?.set;return Object.defineProperty(m,f,{configurable:!0,enumerable:b?.enumerable??!0,get:()=>S,set:_=>{S=o(_),x?.call(m,_)}}),S=o(S),p??(p=new Set),p.add(f),Lc.set(m,p),n(),!0},l=(m,f)=>{let p=Nc.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),Nc.set(t,p)}let S=t[m];return S?a(S,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 Kr(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 Yr(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}var Ic=new Set(["img","video","audio","source"]);function gg(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 bg(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}function xg(e){return e.replace(/[;{}<>\\r\\n]/g,"")}function yg(e){if(Yr(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 na(e,t){let n=e.closest("[data-composition-id]"),r=t.get(n);if(r)return r;let i=Kr(e);return t.set(n,i),i}function Sg(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 vg(e){return e.querySelector("[data-hf-root]")??e.getElementById("stage")??e.body?.firstElementChild??e.body}function Eg(e,t){let n=new Set,r=vg(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=na(i,t);for(let[a,l]of Object.entries(o)){let s=yg(l);s!==null&&i instanceof HTMLElement&&i.style.setProperty(`--${a}`,xg(s))}}}function ra(e){let t=new Map;Eg(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(!Ic.has(n.tagName.toLowerCase())){console.warn(`[hyperframes] Ignoring data-var-src on <${n.tagName.toLowerCase()}>: variable-bound src is only allowed on ${Array.from(Ic).join("/")}.`);continue}let i=gg(na(n,t)[r]);if(i!==null){if(!bg(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=na(n,t)[r];Yr(i)&&Sg(n,String(i))}}var rt=new Map,Ag="data-hf-color-grading-canvas",Cg="__hf_color_grading_canvas__";function $c(){if(typeof MutationObserver>"u"||typeof document>"u")return;let e=document.documentElement;if(!e)return;let t=r=>{r instanceof HTMLElement&&(r.hasAttribute(_r)||r.setAttribute(_r,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 wg=16,_g=4,Qt={enabled:!1,position:.5,softness:0,lineWidth:2},ia=["#000000","#ffffff"],Tg=["#1a1a1a","#f5f5dc"],Jn=3,Rg=Jn-1,kg=5,oa=`${Ke}.0`,Pc=`${Ke-1}.0`,Fg=`${Jn}.0`,Mg=`${(Rg+.5)/Jn}`;function Xr(e){let t=e.getAttribute(En);return t==null?null:_l(t,Kr(e))}var Lg=["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`),Ng=["#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) * ${Pc};`," float lower = floor(position);",` float upper = min(lower + 1.0, ${Pc});`,` float y = (row + 0.5) / ${Fg};`,` vec4 before = texture2D(u_advanced, vec2((lower + 0.5) / ${oa}, y));`,` vec4 after = texture2D(u_advanced, vec2((upper + 0.5) / ${oa}, y));`," return mix(before, after, position - lower);","}","vec4 advancedConfig(float index){",` return texture2D(u_advanced, vec2((index + 0.5) / ${oa}, ${Mg}));`,"}","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`),Dg=["#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`),Ig=["#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`),Pg=["#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 Rt(e){return e instanceof HTMLVideoElement||e instanceof HTMLImageElement}function Oc(e){let t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function Hc(e,t,n){let r=e.createShader(n);return r?(e.shaderSource(r,t),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(N("runtime.colorGrading.compileShader",e.getShaderInfoLog(r)),e.deleteShader(r),null)):null}function ti(e,t=Ng){let n=Hc(e,Lg,e.VERTEX_SHADER),r=Hc(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:(N("runtime.colorGrading.linkProgram",e.getProgramInfoLog(i)),e.deleteProgram(i),null)):null}function Jr(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 Og(e,t){let n=ti(e,Dg);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 Hg(e,t){let n=ti(e,Ig);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 Gg(e,t){let n=ti(e,Pg);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 Kn(e,t=e.UNSIGNED_BYTE,n=e.LINEAR){let r=Jr(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 Zr(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 aa(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 Gc(e,t,n){t&&e.deleteProgram(t);for(let r of n)r&&e.deleteTexture(r)}function ca(e){let t=e.getContext("webgl",{alpha:!0,premultipliedAlpha:!1});if(!t)return null;let n=ti(t),r=Jr(t),i=Jr(t,t.NEAREST),o=Jr(t,t.NEAREST);if(!n||!r||!i||!o)return Gc(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:aa(t,n,Tr),detailUniforms:aa(t,n,ro),effectUniforms:aa(t,n,io),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")}}):(Gc(t,n,[r,i,o]),null)}function Bg(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ug(e){if(!Bg(e))return{...Qt};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,Qt.position,0,1),softness:t(e.softness,Qt.softness,0,.25),lineWidth:t(e.lineWidth,Qt.lineWidth,0,12)}}function jc(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 ni(e){return e instanceof Error?e.message:"LUT failed to load"}function Wg(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 Kc(e){let t=e.id||e.currentSrc||e.getAttribute("src")||`${e.tagName}:${Array.prototype.indexOf.call(e.parentNode?.children??[],e)}`;return Wg(t)}function da(e){let t=jc(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=>rl(o,{maxSize:Ar})),i={state:"pending",promise:r};for(;rt.size>=wg;){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:ni(o)})}),i}function Bc(e,t,n){if(e.lut?.src===t)return e.lut;let r=Ki(n),{gl:i,program:o}=e;try{return Yc(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=ni(a),e.lutLoadingSrc=null,N("runtime.colorGrading.uploadLut",a),null}}async function Vg(e){let t=da(e);if(t.state==="ready")return t.lut;if(t.state==="pending")return t.promise;throw new Error(t.message)}function Yc(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 zg(e,t,n){let r=Ki(n),{gl:i,program:o}=e;return Yc(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 fa(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 ma(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 Qr(e,t=!1){fa(e),ma(e),qg(e.gl,e.program),t&&e.gl.getExtension("WEBGL_lose_context")?.loseContext()}function qg(e,t){e.deleteTexture(t.texture),e.deleteTexture(t.lutTexture),e.deleteTexture(t.advancedTexture),e.deleteBuffer(t.quad),e.deleteProgram(t.program)}function $g(e){let t=ca(e.canvas);return t?(Qr(e),e.gl=t.gl,e.program=t.program,e.lut=null,e.lutLoadingSrc=null,e.lutError=null,e.effectError=null,!0):!1}function ua(e){if(!e.sourceHidden)return;e.element.removeAttribute(An);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 jg(e){if(e.effectTargets)return e.effectTargets;let{gl:t}=e,n=Og(t,e.program.quad),r=Kn(t),i=Kn(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 Kg(e,t){return t.bloom||(t.bloom=Kn(e.gl),e.effectError=t.bloom?null:"Framebuffer effects unavailable"),t.bloom}function Uc(e){let t=e.effectTargets;t?.bloom&&(Je(e.gl,t.bloom),t.bloom=null)}function Yg(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=Hg(t,e.program.quad),o=Gg(t,e.program.quad),a=Kn(t,n.HALF_FLOAT_OES,t.NEAREST),l=Kn(t);return!i||!o||!a||!l?(Xg(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 Xg(e,t,n,r,i){t&&e.deleteProgram(t.program),n&&e.deleteProgram(n.program),r&&Je(e,r),i&&Je(e,i)}function Xc(e,t,n,r,i){let o=Math.max(1,Math.ceil(r)),a=Math.max(1,Math.ceil(i));return Zr(e,t,o,a),Zr(e,n,o,a),{width:o,height:a}}function ei(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),Yn(e,t)}function Jg(e,t,n,r,i,o,a){let l=Xc(e,t.scratch,r,i/2,o/2),s=a/2;ei(e,t.blurProgram,n,t.scratch,l,{x:1,y:0},s,!0,.5),ei(e,t.blurProgram,t.scratch.texture,r,l,{x:0,y:1},s,!0)}function Qg(e,t,n,r,i,o,a){let l=n;for(let s=0;s<Math.max(1,Math.floor(a));s++)ei(e,t.blurProgram,l,t.scratch,i,{x:1,y:0},o),ei(e,t.blurProgram,t.scratch.texture,r,i,{x:0,y:1},o),l=r.texture}function Yn(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 Zg(e,t,n,r,i,o,a,l){Zr(e,t.moments,i.width,i.height),Zr(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),Yn(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),Yn(e,u)}function eb(e,t,n,r){if(n<=0)return!1;let i=Xc(e.gl,t.scratch,t.blur,r.width,r.height);return Qg(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 Uc(e),null;o||Uc(e);let a=o?Kg(e,t):t.blur;return a?(Jg(e.gl,t,e.program.texture,a,i.width,i.height,r),a.texture):null}function nb(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&&fa(e),{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let l=jg(e);if(!l)return{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let s=eb(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 rb(e,t,n,r,i,o,a){let l=t.effects.kuwahara;if(l<=0&&!o)return e.kuwaharaTargets&&a&&ma(e),{kuwaharaReady:!1,kuwaharaTexture:e.program.texture};let s=Yg(e);return!s||l<=0?{kuwaharaReady:!1,kuwaharaTexture:s?.output.texture??e.program.texture}:(Zg(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 Jc(e,t,n,r,i={}){let o=i.releaseIdleTargets??!0;e.effectError=null;let a=nb(e,t,n,o),l=rb(e,t,n,r,a.blurReady,i.preserveKuwahara??!1,o);return{...a,...l}}function ib(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=jc(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=da(t);return i.state==="ready"?Bc(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||(Bc(e,r.href,o),Ne(e))},o=>{e.destroyed||e.grading.lut?.src.trim()!==t||(e.lut=null,e.lutError=ni(o),e.lutLoadingSrc=null,Ne(e))})),null)}function $n(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&&Rt(n))return n;try{let r=document.querySelector(t);return r&&Rt(r)?r:null}catch{return null}}if(e.hfId){let t=document.querySelector(`[data-hf-id="${CSS.escape(e.hfId)}"]`);if(t&&Rt(t))return t}if(e.id){let t=document.getElementById(e.id);if(t&&Rt(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&&Rt(r)?r:null}catch{return null}}function Qc(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 Zc(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 ed(e){if(!e.id)return null;let t=document.getElementById(`__render_frame_${e.id}__`);return t instanceof HTMLImageElement&&Zc(t)?t:null}function Wc(e){if(!(e instanceof HTMLVideoElement))return!1;let t=ed(e);if(!t)return!1;let n=window.getComputedStyle(t);return n.display!=="none"&&n.visibility!=="hidden"}function ob(e){return e instanceof HTMLImageElement&&e.classList.contains("__render_frame__")}function ab(e,t){t.parentNode&&t.nextSibling!==e.canvas&&t.parentNode.insertBefore(e.canvas,t.nextSibling)}function td(e){if(e instanceof HTMLVideoElement){let t=ed(e);if(t)return t}return Zc(e)?e:null}function Vc(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 sb(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=Vc(o,"x"),l=Vc(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 nd(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=sb(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 lb(e,t){window.getComputedStyle(t).position==="static"&&(e.touchedParent||(e.touchedParent=t,e.parentInlinePosition=t.style.position||null),t.style.position="relative")}function zc(e,t){return Math.max(0,Math.round(e>0?e:t))}function ub(e,t){let{element:n,canvas:r}=e,i=n.parentElement;i&&lb(e,i);let o=window.getComputedStyle(t);kl(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=zc(n.offsetWidth,a.width),s=zc(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 Jt(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 kt(e,t,n,r){e.set(r,(t*Ke+n)*4)}function gt(e,t){return Math.min(1,Math.max(1/255,(e*(127/t)+128)/255))}function sa(e,t,n){return e.length>=3?Xi(e,t,n):new Float32Array(Ke)}function Tt(e,t){return e[t]??0}function cb(e,t,n){let r=Bt(t.red),i=Bt(t.green),o=Bt(t.blue),a=Bt(t.master),l=sa(n.hueVsHue,-180,180),s=sa(n.hueVsSaturation,-1,1),u=sa(n.hueVsLuma,-1,1);for(let c=0;c<Ke;c+=1)kt(e,0,c,[Tt(r,c),Tt(i,c),Tt(o,c),Tt(a,c)]),kt(e,1,c,[gt(Tt(l,c),180),gt(Tt(s,c),1),gt(Tt(u,c),1),1])}function db(e,t,n){let r=n*kg;kt(e,2,r,[t.key.hue.center/360,t.key.hue.range/180,t.key.hue.softness/180,1]),kt(e,2,r+1,[t.key.saturation.min,t.key.saturation.max,t.key.saturation.softness/.5,0]),kt(e,2,r+2,[t.key.luma.min,t.key.luma.max,t.key.luma.softness/.5,0]),kt(e,2,r+3,[gt(t.correction.hueShift,180),gt(t.correction.saturation,1),gt(t.correction.luma,1),gt(t.correction.temperature,1)]),kt(e,2,r+4,[gt(t.correction.tint,1),.5,.5,1])}function fb(e,t,n){let r=new Float32Array(Ke*Jn*4);cb(r,e,t);let i=0;for(let o of n)o.enabled&&(db(r,o,i),i+=1);return r}var qc=new WeakMap;function mb(e,t,n){let r=qc.get(e);if(r?.hueCurves===t&&r.secondaries===n)return r.signature;let i=JSON.stringify([e,t,n]);return qc.set(e,{hueCurves:t,secondaries:n,signature:i}),i}function pb(e,t,n,r){let{curves:i,hueCurves:o}=n,a=mb(i,o,r);if(t.advancedSignature===a)return;let l=Uint8Array.from(fb(i,o,r),Sn);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,Jn,0,e.RGBA,e.UNSIGNED_BYTE,l),t.advancedSignature=a}function la(e,t,n){e.uniform3f(t,n.hue/360,n.amount,n.level)}function rd(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,S=so(f),x=lo(p),_=uo(b)?b.reduce((F,M)=>F+Number(M.enabled),0):0;(S||x||_>0)&&pb(e,t,n,b),la(e,t.shadowWheel,n.wheels.shadows),la(e,t.midtoneWheel,n.wheels.midtones),la(e,t.highlightWheel,n.wheels.highlights),e.uniform1f(t.rgbCurvesEnabled,S?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?Tg:ia),T=R[R.length-1]??ia[1];e.uniform1f(t.paletteSize,R.length),Jt(e,t.palette0,R[0]??ia[0]),Jt(e,t.palette1,R[1]??T),Jt(e,t.palette2,R[2]??T),Jt(e,t.palette3,R[3]??T),Jt(e,t.palette4,R[4]??T),Jt(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 hb(e){if(!e.sourceHidden){let t=e.element.getAttribute(_r);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(An,"true"),e.element.style.setProperty("opacity","0","important"),e.sourceHidden=!0}function it(e){let t=Al.find(n=>n.path===e);if(!t)throw new Error(`Missing color-grading animation property: ${e}`);return t}var id=it("intensity"),od=it("lut.intensity"),ad=it("adjust.exposure"),sd=it("effects.kuwahara"),ld=[["blur",it("effects.blur")],["bloom",it("effects.bloom")],["kuwahara",sd],["pixelate",it("effects.pixelate")],["ascii",it("effects.ascii")],["dither",it("effects.dither")]],ud=[id,od,ad,...ld.map(([,e])=>e)];function Ft(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&&(Tl(t)||ud.some(n=>Ft(e,n)!==null))}function gb(e,t){let n=null;for(let[r,i]of ld){let o=Ft(e,i);o!==null&&(n??(n={...t.effects}),n[r]=o)}return n}function bb(e){let{element:t,grading:n}=e,r=Ft(t,id),i=Ft(t,od),o=Ft(t,ad),a=gb(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 cd(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 dd(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 Ne(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=Qc(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=ob(t);s&&ab(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=ub(e,r);if(!c)return!1;let m=window.getComputedStyle(r),f=nd(c.width,c.height,n.width,n.height,m.objectFit,m.objectPosition),{gl:p,program:b}=e;try{let S=bb(e),x=ib(e);cd(p,b.texture,t);let _=Ft(e.element,sd)!==null,R=Jc(e,S,c,f,{preserveKuwahara:_});p.bindFramebuffer(p.FRAMEBUFFER,null),p.viewport(0,0,c.width,c.height),p.useProgram(b.program),dd(p,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 rd(p,b,S,x,R.blurReady,R.bloomReady,R.kuwaharaReady,e.compare,c,f,M,F),Yn(p,b),hb(e),e.hasDrawn=!0,e.drawError=null,!0}catch(S){return e.drawError=S instanceof Error?S.message:"Shader draw failed",N("runtime.colorGrading.drawEntry",S),!1}}function xb(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 yb(){let e=document.createElement("canvas"),t=ca(e);return t?{canvas:e,...t,lut:null,effectTargets:null,kuwaharaTargets:null,effectError:null}:null}function Sb(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 vb(e,t,n,r){let i=td(t);if(!i)return null;let o=Qc(i);if(!o)return null;let a=xb(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=nd(a.width,a.height,o.width,o.height,s.objectFit,s.objectPosition);return cd(e.gl,e.program.texture,i),{dimensions:a,uv:u,effectTime:Sb(t,r),grainSeed:Kc(t)+(t instanceof HTMLVideoElement?Math.floor(t.currentTime*60):0)}}async function Eb(e,t,n,r,i=!1){let o=vb(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=Rr(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=zg(e,f.lut.src,await Vg(f.lut.src))),p=e.lut),c.push({id:m.id,dataUrl:Ab(e,f,p,a,l,s,u)})}catch(b){c.push({id:m.id,dataUrl:null,error:ni(b)})}}return{...a,images:c}}function Ab(e,t,n,r,i,o,a){let{canvas:l,gl:s,program:u}=e,c=Jc(e,t,r,i,{releaseIdleTargets:!1});return s.bindFramebuffer(s.FRAMEBUFFER,null),s.viewport(0,0,r.width,r.height),s.useProgram(u.program),dd(s,u,c),n||(e.lut=null),rd(s,u,t,n,c.blurReady,c.bloomReady,c.kuwaharaReady,Qt,r,i,o,a),Yn(s,u),l.toDataURL("image/png")}function Xe(e,t,n,r){t.addEventListener(n,r),e.cleanup.push(()=>t.removeEventListener(n,r))}function Cb(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 Xn(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,Ne(e),!e.destroyed&&!t.paused&&!t.ended&&Xn(e)});return}e.animationFrame=window.requestAnimationFrame(()=>{e.animationFrame=null,Ne(e),!e.destroyed&&!t.paused&&!t.ended&&Xn(e)})}function wb(e){let t=()=>{Ne(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",()=>Xn(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",ua(e)}),Xe(e,e.canvas,"webglcontextrestored",()=>{if(e.contextLost=!1,!$g(e)){e.contextLost=!0,e.drawError="WebGL context restore failed",ua(e);return}e.drawError=null,Ne(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(),Ne(e)}))});o.observe(e.element,{attributes:!0,attributeFilter:["style"]}),e.cleanup.push(()=>o.disconnect())}}function _b(e){if(e.destroyed)return null;e.destroyed=!0,Cb(e),e.resizeObserver?.disconnect();for(let t of e.cleanup)t();return e.cleanup.length=0,e.canvas.remove(),fa(e),ma(e),ua(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 fd(e,t){return e.removeAttribute("style"),t.id?e.id=`${xl}${t.id}`:e.removeAttribute("id"),e.className=Cg,e.setAttribute(Ag,"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 Tb(e){return fd(document.createElement("canvas"),e)}function md(){let e=new WeakMap,t=new Set,n=[],r=null,i=null,o=Promise.resolve(),a=!1,l=(A,v,E)=>{let w=e.get(A);if(w)return w.grading=v,w.source=E,Ne(w),A instanceof HTMLVideoElement&&!A.paused&&Xn(w),!0;let L=n.pop();if(L)fd(L.canvas,A);else{let H=Tb(A),z=ca(H);if(!z)return H.remove(),!1;L={canvas:H,gl:z.gl,program:z.program,effectTargets:null,kuwaharaTargets:null,effectError:null}}let D={element:A,...L,grading:v,compare:{...Qt},lut:null,lutLoadingSrc:null,lutError:null,drawError:null,effectTargets:null,kuwaharaTargets:null,effectError:null,source:E,animationFrame:null,videoFrameHandle:null,resizeObserver:null,cleanup:[],touchedParent:null,parentInlinePosition:null,sourceHidden:!1,sourceInlineOpacity:null,sourceInlineOpacityPriority:"",sourceOpacityForCanvas:window.getComputedStyle(A).opacity||"1",sourceVisibleForCanvas:window.getComputedStyle(A).visibility!=="hidden",hasDrawn:!1,contextLost:!1,grainSeed:Kc(A),destroyed:!1};return e.set(A,D),t.add(A),wb(D),Ne(D),A instanceof HTMLVideoElement&&!A.paused&&Xn(D),!0},s=(A,v)=>{if(a)return!1;let E=$n(A);if(!E)return!1;let w=e.get(E);if(!w){let L=Xr(E);if(!jn(E,L)||!l(E,L,"attribute"))return!1;w=e.get(E)}return w?(w.compare=Ug(v),Ne(w),!0):!1},u=A=>{let v=e.get(A);if(!v)return;let E=_b(v);E&&(v.contextLost||n.length>=_g?Qr(E,!0):n.push(E)),e.delete(A),t.delete(A)},c=()=>{if(a)return 0;let A=new Set;document.querySelectorAll(`video[${En}], img[${En}]`).forEach(E=>{if(!Rt(E))return;A.add(E);let w=Xr(E);jn(E,w)&&(Oc(E)||Wc(E))?l(E,w,"attribute"):u(E)});for(let E of t){let w=e.get(E);w&&(!E.isConnected||w.source==="attribute"&&!A.has(E))&&u(E)}return t.size},m=()=>{if(a)return 0;let A=0;for(let v of t){let E=e.get(v);E&&Ne(E)&&(A+=1)}return A},f=async()=>{let A=new Set;for(let v of t){let E=e.get(v)?.grading.lut;if(!E?.src.trim()||(E.intensity??1)<=0)continue;let w=da(E.src);w.state==="pending"&&A.add(w.promise)}return A.size>0&&await Promise.allSettled(A),m(),A.size},p=()=>{if(a)return 0;let A=0;for(let v of t){let E=e.get(v);!E||!ud.some(L=>Ft(v,L)!==null)||v instanceof HTMLVideoElement&&!v.paused&&!v.ended||Ne(E)&&(A+=1)}return A},b=(A,v)=>{if(a)return!1;let E=$n(A);if(!E)return!1;let w=Rr(v);return jn(E,w)?l(E,w,"live"):(u(E),!0)},S=(A,v)=>{if(!Rt(A))return!1;let E=e.get(A);if(!E){if(!v)return!1;let w=Xr(A);return jn(A,w)&&l(A,w,"attribute")}return E.sourceVisibleForCanvas=v,!v&&E.source==="attribute"&&u(A),!0},x=A=>{let v=$n(A);if(!v)return{state:"missing",message:"Media not found"};let E=e.get(v);if(E)return E.effectError?{state:"unavailable",message:E.effectError}:E.drawError?{state:"unavailable",message:E.drawError}:E.lutError?{state:"unavailable",message:`LUT error: ${E.lutError}`}:E.grading.lut&&E.lutLoadingSrc?{state:"pending",message:"Loading LUT"}:E.canvas.style.display==="none"?{state:"pending",message:"Waiting for media frame"}:{state:"active",message:E.lut?"Shader + LUT active":"Shader active"};let w=Xr(v);return jn(v,w)?!Oc(v)&&!Wc(v)?{state:"pending",message:"Waiting for visible media"}:{state:"unavailable",message:"WebGL unavailable"}:{state:"inactive",message:"No grading applied"}},_=async(A,v,E)=>{let w=async()=>{if(a||v.length===0)return null;let D=$n(A);return!D||(i??(i=yb()),!i)?null:Eb(i,D,v,E?.maxDimension,E?.useMediaTime)},L=o.then(w,w);return o=L.then(()=>{},()=>{}),L},R=A=>{let v=$n(A);if(!(v instanceof HTMLVideoElement))return null;if(!v.paused)return()=>{};let E=v.currentTime,w=v.loop,L=v.muted;return v.loop=!0,v.muted=!0,(v.ended||Number.isFinite(v.duration)&&E>=v.duration)&&(v.currentTime=0),v.play().catch(()=>{}),()=>{v.pause(),v.loop=w,v.muted=L,v.currentTime=E}},T=()=>{if(!a){a=!0,r?.disconnect(),r=null;for(let A of t)u(A);for(let A of n)Qr(A,!0);n.length=0,i&&(Qr(i,!0),i=null)}};document.body&&(r=new MutationObserver(()=>c()),r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[En]}));let F={refresh:c,redraw:m,redrawAnimated:p,waitForActiveLuts:f,setGrading:b,setCompare:s,setSourceVisibility:S,getStatus:x,renderPreviews:_,startPreviewPlayback:R,destroy:T},M=window;return M.__hf=M.__hf||{},M.__hf.colorGrading=F,c(),F}var ri=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 Rb=100,kb=8,Fb=4096,pa=e=>e;function Mb(e,t,n){return!(!!e.curve||e.viaX!==void 0&&e.viaY!==void 0)&&t==="linear"&&!n}function Lb(e){let t=Math.ceil(e*Rb);return Math.min(Fb,Math.max(kb,t))}function Nb(e,t,n,r,i){let{scheduledAt:o,elapsed:a,rate:l}=r,s=i??pa,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(Mb(c,n,i))return{kind:"ramp",time:f,value:s(m.v)};let S=Lb(b),x=zs(e,Math.max(c.t,a),m.t,S,n),_=new Float32Array(S);for(let R=0;R<S;R+=1)_[R]=s(x[R]??0);return{kind:"curve",time:p,duration:b,values:_}}function Db(e,t,n,r){let i=[];for(let a=0;a+1<e.points.length;a+=1){let l=Nb(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??pa)(bn(e,n.elapsed,t))}),i}function Ib(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 ha(e){for(let t of e)t.param.cancelScheduledValues(0)}function Qn(e,t){for(let n of e)typeof n.param.cancelAndHoldAtTime=="function"?n.param.cancelAndHoldAtTime(t):n.param.cancelScheduledValues(t)}function ga(e,t,n,r){if(t.points.length!==0)for(let i of e){if(ha([i]),Vs(t)){let o=(i.map??pa)(t.points[0].v);i.param.setValueAtTime(o,r.scheduledAt);continue}Ib(i.param,Db(t,n,r,i.map))}}function pd(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=gn(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=Gi(l.target,t);c&&(ga(u,l,c.scale,r),a.push(...u))}return a}function hd(e){return e.lanes.find(t=>t.target===Ot)??null}var Pb=`\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`,ba=new WeakMap;function xa(e){return gd.has(e)}var gd=new WeakSet;function ya(e){let t=ba.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(Pb)))}`;await e.audioWorklet.addModule(n),gd.add(e)})().catch(n=>{throw ba.delete(e),n}),ba.set(e,t)),t}function Ob(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 ue=e=>typeof e=="number"?e:Number(e??0),Sa=e=>e/1e3;function Sd(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 vd(e){try{e.stop()}catch{}e.disconnect()}function va(e,t){return[{param:e},{param:t,map:n=>1-n}]}function Ed(e,t,n){e.gain.value=n,t.gain.value=1-n}function Ea(e,t,n){return{input:e,output:e,update:t,automation:n,dispose:()=>e.disconnect()}}var Hb=new Set(["peaking","highpass","lowpass"]),bd=e=>Math.pow(10,e/20),Gb=(e,t)=>{let n=e.createGain(),r=i=>{n.gain.value=bd(ue(i.gain))};return r(t),Ea(n,r,{gain:[{param:n.gain,map:bd}]})};function Zn(e,t){return(n,r)=>{let i=n.createBiquadFilter();i.type=e;let o=a=>{i.frequency.value=ue(a.frequency),a.q!==void 0&&(i.Q.value=ue(a.q)),t&&(i.gain.value=ue(a.gain))};return o(r),Ea(i,o,{frequency:[{param:i.frequency}],...Hb.has(e)?{q:[{param:i.Q}]}:{},...t?{gain:[{param:i.gain}]}:{}})}}function Bb(e){return(t,n)=>{let r=Math.tan(Math.PI*ue(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 Ea(i,()=>{})}}function ii(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 Ub={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))},Wb=(e,t)=>{let n=e.createWaveShaper(),r=e.createGain(),i=e.createGain();r.connect(n).connect(i);let o=a=>{let l=Ub[String(a.type)]??Math.tanh,s=Math.pow(10,ue(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=ue(a.oversample)>=4?"4x":ue(a.oversample)>=2?"2x":"none",i.gain.value=Math.pow(10,ue(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()}}},Vb=(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,ue(u.time)/1e3),o.gain.value=ue(u.feedback),Ed(a,l,ue(u.mix))};return s(t),{input:n,output:r,update:s,automation:{time:[{param:i.delayTime,map:u=>Math.min(5,Sa(u))}],feedback:[{param:o.gain}],mix:va(a.gain,l.gain)},dispose:()=>[n,r,i,o,a,l].forEach(u=>u.disconnect())}},zb=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createDelay(.5),a=Sd(e,"sine",ue(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=ue(m.delay)/1e3,l.gain.value=ue(m.depth)/1e3,a.playbackRate.value=ue(m.speed),Ed(s,u,ue(m.mix))};return c(t),{input:r,output:i,update:c,automation:{delay:[{param:o.delayTime,map:Sa}],depth:[{param:l.gain,map:Sa}],speed:[{param:a.playbackRate}],mix:va(s.gain,u.gain)},dispose:()=>{vd(a),[r,i,o,l,s,u].forEach(m=>m.disconnect())}}},qb=6,$b=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createGain(),a=e.createGain(),l=Sd(e,String(t.type)==="1"?"sine":"triangle",ue(t.speed),n),s=e.createGain(),u=e.createGain(),c=e.createGain(),m=[];r.connect(o);let f=o;for(let b=0;b<qb;b++){let S=e.createBiquadFilter();S.type="allpass",S.Q.value=.7071,s.connect(S.frequency),f.connect(S),f=S,m.push(S)}l.connect(s),f.connect(u).connect(a),o.connect(c).connect(a),a.connect(i);let p=b=>{let S=1e3/Math.max(.1,ue(b.delay));for(let x of m)x.frequency.value=S;s.gain.value=S*ue(b.decay),l.playbackRate.value=ue(b.speed),o.gain.value=ue(b.in_gain),a.gain.value=ue(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:()=>{vd(l),[r,i,o,a,s,u,c,...m].forEach(b=>b.disconnect())}}},jb=(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=`${ue(u.size)}:${ue(u.damping)}`;if(c!==l){let m=Ob(e.sampleRate,ue(u.size),ue(u.damping)),f=e.createBuffer(1,m.length,e.sampleRate);f.getChannelData(0).set(m),i.buffer=f,l=c}o.gain.value=ue(u.wet),a.gain.value=ue(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())}},Kb={"gain-node":Gb,"biquad-peaking":Zn("peaking",!0),"biquad-lowshelf":Zn("lowshelf",!0),"biquad-highshelf":Zn("highshelf",!0),"biquad-highpass":Zn("highpass",!1),"biquad-lowpass":Zn("lowpass",!1),"worklet-compressor":ii("hf-compressor"),"worklet-limiter":ii("hf-limiter"),"worklet-gate":ii("hf-gate"),"worklet-bitcrush":ii("hf-bitcrush"),waveshaper:Wb,"delay-feedback":Vb,"chorus-lfo":zb,"allpass-phaser":$b,convolver:jb};function Ad(e){return e.nodes.some(t=>fn(t.type)?.web.startsWith("worklet-")??!1)}function Yb(e,t,n,r=0){let i=fn(t);if(!i)throw new Error(`Unknown effect type: ${t}`);let o=mn(t,n);if((t==="highpass"||t==="lowpass")&&String(o.poles)==="1")return Bb(t)(e,o,r);let a=Kb[i.web];if(!a)throw new Error(`No Web Audio builder for ${i.web}`);return a(e,o,r)}function xd(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 yd(e){return pn(e).map(t=>{let n=mn(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 Cd(e,t,n=0){var m;let r=e.createGain(),i=e.createGain(),o=[],a=[],l=xd(pn(t)),s=r;for(let f of l){let p=null;if(f.preset){let b=e.createGain(),S=e.createGain(),x=e.createGain(),_=e.createGain();x.gain.value=f.amount,S.gain.value=1-f.amount,s.connect(b),b.connect(S).connect(_),p={entry:b,wet:x,dry:S,join:_},s=b}for(let b of f.nodes){let S=Yb(e,b.type,b.params??{},n);s.connect(S.input),s=S.output,o.push({...b.id?{id:b.id}:{},type:b.type,handle:S})}p&&f.preset&&(s.connect(p.wet).connect(p.join),a.push({id:f.preset,...p}),s=p.join)}s.connect(i);let u=yd(t),c={};for(let f of a)(c[m=f.id]??(c[m]=[])).push(...va(f.wet.gain,f.dry.gain));return{input:r,output:i,presets:c,nodes:o,update(f){if(yd(f)!==u)return!1;pn(f).forEach((b,S)=>{let x=o[S];x&&(x.handle.update(mn(b.type,b.params)),b.id===void 0?delete x.id:x.id=b.id)});let p=0;for(let b of xd(pn(f))){if(!b.preset)continue;let S=a[p++];!S||S.id!==b.preset||(S.wet.gain.value=b.amount,S.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:S}of a)f.disconnect(),p.disconnect(),b.disconnect(),S.disconnect();r.disconnect(),i.disconnect()}}}var wd={version:1,nodes:[]},_d={version:1,lanes:[]};function Td(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(Pt):null)??"";if(!n)return _d;try{return Ws(Sr(n),t)}catch{return _d}}function er(e){let t=(typeof e.getAttribute=="function"?e.getAttribute(br):null)??"";if(!t)return{chain:wd,raw:""};try{return{chain:Gs(t),raw:t}}catch{return{chain:wd,raw:""}}}function Rd(e){return Td(e,er(e).chain)}function Aa(e,t,n,r,i){let{chain:o}=er(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(Ad(T)&&!xa(e)){n.connect(r);let M=++u;ya(e).then(()=>{s||M!==u||x(er(t).chain)}).catch(()=>{});return}try{let M=Cd(e,T,F);n.connect(M.input),M.output.connect(r),a=M}catch{n.connect(r)}},f=(T,F)=>{l=F&&a?pd(Td(t,T),T,a.nodes,F,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}},S=T=>{let F=b();F&&(Qn(l,F.scheduledAt),f(T,F))},x=T=>{let F=b();Qn(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=er(t);l.length>0&&ha(l),!a||!a.update(T.chain)?x(T.chain):S(T.chain)}),_.observe(R,{attributes:!0,attributeFilter:[br,Pt]})),{setRate:T=>{let F=b();s||!F||!Number.isFinite(T)||T<=0||T===F.rate||(p={...F,rate:T},Qn(l,F.scheduledAt),f(er(t).chain,p))},dispose:()=>{s=!0,_?.disconnect(),l.length>0&&Qn(l,typeof e.currentTime=="number"?e.currentTime:0),a?.dispose()}}}function Ca(e){return!Number.isFinite(e)||e<=0?1:e}function Xb(e,t){t||e.paused||!ur().__hfDebug||console.debug("[hyperframes] webAudioTransport claimed fallback-playing element:",e.currentSrc||e.getAttribute("src")||"")}function Jb(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 kd(e,t,n){let r=hd(Rd(e));r&&ga([{param:t.gain}],r,yr.scale,n)}function tr(e){return e.sourceKind==="buffer"}var oi=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,"_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 N("webAudioTransport.fetch",new Error(`${i.status} ${n}`)),null;r=await i.arrayBuffer()}catch(i){return N("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),N("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=Ca(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=Aa(this._ctx,t,s,c,p);c.connect(this._masterGain),kd(t,c,p),this._rate=u,this._rateAnchorCtx=m,this._rateAnchorComp=i;let S={fx:b,el:t,sourceNode:s,sourceKind:"media-element",gainNode:c,compositionStart:n,mediaStart:r,scheduledAt:m,priorMuted:t.muted,priorVolume:t.volume,mediaPlaybackRate:Te(t),bounded:!1};return t.volume=1,this._activeSources.push(S),this._paused=!1,S}catch(s){return N("webAudioTransport.mediaElementSource",s),null}}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=Ca(s),m=Te(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 S=o-r,x=this._ctx.currentTime,_={scheduledAt:x,elapsed:S,rate:c},R=Aa(this._ctx,t,p,b,_);if(b.connect(this._masterGain),kd(t,b,_),this._rate=c,this._rateAnchorCtx=x,this._rateAnchorComp=o,!Jb(p,{elapsed:S,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,Xb(t,T);let F={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(F),this._paused=!1,p.addEventListener("ended",()=>{let M=this._activeSources.indexOf(F);if(M!==-1){this._activeSources.splice(M,1),t.muted=T;try{p.disconnect(),R?.dispose(),b.disconnect()}catch{}this._activeSources.length===0&&(this._paused=!0)}}),F}catch(c){return N("webAudioTransport.schedule",c),null}}setRate(t){let n=Ca(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{tr(r)&&(r.sourceNode.playbackRate.value=n*r.mediaPlaybackRate),r.fx?.setRate(n)}catch(i){N("webAudioTransport.setRate",i)}return!0}hasBoundedActiveSources(){return this._activeSources.some(t=>tr(t)&&t.bounded)}stopAll(){for(let t of this._activeSources){try{tr(t)&&t.sourceNode.stop(),t.sourceNode.disconnect(),t.fx?.dispose(),t.gainNode.disconnect()}catch{}tr(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=Math.max(0,Math.min(1,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){N("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&&tr(n))}routesElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t)}destroy(){if(this.stopAll(),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 Fd="data-hf-studio-manual-edit-gesture";function Md(e){return!Number.isInteger(e.tick)||e.tick<=0||e.tick%60!==0?!1:!(e.isPlaying&&e.hasCapturedTimeline&&e.currentTimeSeconds<2)}var Qb=/^\\s*spring\\(\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+))\\s*\\)\\s*$/;function Ld(e){return Math.max(0,Math.min(1,e))}function Nd(e){let t=Qb.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?Ld(n):null}function Dd(e,t){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let n=Ld(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 Zb=/^\\s*wiggle\\(\\s*(\\d+)\\s*,\\s*(easeOut|easeInOut|anticipate|uniform)\\s*(?:,\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?)\\s*)?\\)\\s*$/,ex=Math.PI*2;function tx(e){let t=Zb.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 nx(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 Id(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=>nx(a,n.wiggles,n.type,n.amplitude);return t?.set(r,o),o}var rx=24,Pd=e=>e>=1?1:0,ix=e=>e,ai=String.raw`([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?)`,ox=new RegExp(String.raw`^\\s*M\\s*0\\s*,\\s*0\\s+C\\s*${ai}\\s*,\\s*${ai}\\s+${ai}\\s*,\\s*${ai}\\s+1\\s*,\\s*1\\s*$`,"i");function Od(e,t,n){let r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function ax(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<rx;l+=1){let s=(o+a)/2;Od(s,t,r)<e?o=s:a=s}return Od((o+a)/2,n,i)}function sx(e){let t=ox.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=>ax(a,n,r,i,o)}function lx(e,t){if(!e.startsWith("spring("))return null;let n=Nd(e);if(n===null)return null;let r=t.get(n);if(r)return r;let i=o=>Dd(o,n);return t.set(n,i),i}function ux(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=sx(n);return i&&t.set(n,i),i}function Hd(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"?Pd:Id(s,i)??lx(s,r)??ux(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)??ix)};e.parseEase=function(u,...c){return a(u,this,c)};let l=e.registerEase;if(typeof l=="function"){l("hold",Pd);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 wa="data-hf-authored-duration",_a="data-hf-authored-end",Gd=!1;function ot(e){if(e){if(typeof e.pause!="function"){Gd||(Gd=!0,Le("timeline_missing_pause",{}));return}try{e.pause()}catch(t){N("runtime.timeline.pause",t)}}}function cx(){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 Bd(){let e=Ll();ns(ye),jr(document),ra(document);let t=cx();e.canonicalFps=t.fps??e.canonicalFps,es(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),Le(g,h))};if(typeof window.__hfRuntimeTeardown=="function")try{window.__hfRuntimeTeardown()}catch(d){N("runtime.init.site1",d)}let c=new ri;e.transportClock=c;let m=new oi,f=!1;m.init().then(d=>{f=d});let p=()=>{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"}),N("runtime.autoMarker.install",h)}},b=()=>{let d=window.gsap;if(!d){u("custom_ease_missing_gsap","custom_ease_install_failed",{reason:"missing_gsap"});return}try{Hd(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"}),N("runtime.customEase.install",g)}};p(),b(),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{us(document)}catch(d){N("runtime.init.cssVariables",d)}window.__timelines=window.__timelines||{};let S=()=>{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=S()?.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=S();x&&!x.hasAttribute("data-start")&&x.setAttribute("data-start","0");let _=d=>{o.push(d)},R=(d,g,h)=>{let y=h??`${d}:${JSON.stringify(g)}`;a.has(y)||(a.add(y),ye({source:"hf-preview",type:"diagnostic",code:d,details:g}))},T=d=>{let g={scale:1,focusX:960,focusY:540},h=[],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:()=>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:()=>({...C,time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying()})}},F=1/60,M=.75,A=.05,v=100,E=240,w=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??"")}},L=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"}},D=d=>{if(d==null||d.trim()==="")return null;let g=Number.parseFloat(d);return!Number.isFinite(g)||g<=0?null:`${g}px`},H=()=>S(),z=()=>{let d=H();if(!d)return;let g=D(d.getAttribute("data-width")),h=D(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)},j=()=>{let d=H(),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"),C=h.getAttribute("data-end");y!=null&&!h.hasAttribute(wa)&&h.setAttribute(wa,y),C!=null&&!h.hasAttribute(_a)&&h.setAttribute(_a,C),h.removeAttribute("data-duration"),h.removeAttribute("data-end")}},k=()=>{let d=H();if(!d)return;d.style.position||(d.style.position="relative"),d.style.overflow="hidden";let g=D(d.getAttribute("data-width")),h=D(d.getAttribute("data-height"));g&&(d.style.width=g),h&&(d.style.height=h);let y=Array.from(d.children);for(let C of y){let I=C.tagName.toLowerCase();if(I==="script"||I==="style"||I==="link"||I==="meta"||!C.hasAttribute("data-start")||C.hasAttribute("data-hf-autostamped"))continue;let G=(C.style.top==="0px"||C.style.top==="0")&&(C.style.left==="0px"||C.style.left==="0")&&C.style.width==="100%"&&C.style.height==="100%",Z=/translate\\(\\s*-50%\\s*,\\s*-50%\\s*\\)/.test(C.style.transform);if(G&&Z&&!C.hasAttribute("data-width")&&!C.hasAttribute("data-height")){let Se=C.style.top,sn=C.style.left,_e=C.style.width,ln=C.style.height;C.style.top="",C.style.left="",C.style.width="",C.style.height="";let oe=window.getComputedStyle(C);oe.top!=="auto"||oe.bottom!=="auto"||oe.left!=="auto"||oe.right!=="auto"||oe.width!=="0px"||oe.height!=="0px"||(C.style.top=Se,C.style.left=sn,C.style.width=_e,C.style.height=ln)}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"),I!=="audio"){let Se=D(C.getAttribute("data-width")),sn=D(C.getAttribute("data-height")),_e=$.width!=="0px"&&$.width!=="auto",ln=$.height!=="0px"&&$.height!=="auto";Se?!C.style.width&&!_e&&(C.style.width=Se):!C.style.width&&$.width==="0px"&&(C.style.width="100%"),sn?!C.style.height&&!ln&&(C.style.height=sn):!C.style.height&&$.height==="0px"&&(C.style.height="100%")}}},B=(d,g=0,h)=>dt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:h?.includeAuthoredTimingAttrs??!0}).resolveStartForElement(d,g),ee=(d,g)=>dt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:g?.includeAuthoredTimingAttrs??!0}).resolveDurationForElement(d),U=d=>{let g=d.closest("[data-composition-id]"),h=g?B(g,0):null,y=g?ee(g,{includeAuthoredTimingAttrs:!0}):null;return{compositionRoot:g,inheritedStart:h,inheritedDuration:y}},V=d=>{let g=U(d),h=g.inheritedStart??0,y=Ge(d.getAttribute("data-start"));if(d.hasAttribute("data-hf-auto-start")||y==null||h<=0)return B(d,h);let C=ve(d.getAttribute("data-duration")),I=g.inheritedDuration,G=I!=null&&I>0?h+I:null,Z=C!=null&&C>0?y+C:y;return(G==null?y>=h:y<G&&(Z>h||y===h))?y:h+y};window.__hfResolveMediaStartSeconds=V,o.push(()=>{window.__hfResolveMediaStartSeconds===V&&delete window.__hfResolveMediaStartSeconds});let q=(d,g)=>{let h=d.tagName.toLowerCase();if(h==="script"||h==="style"||h==="link"||h==="meta")return!1;let C=h==="video"||h==="audio"?V(d):B(d,0),I=ee(d),G=d.getAttribute("data-composition-id");if(G){let $=(window.__timelines??{})[G],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(wa)||d.hasAttribute(_a))&&(I==null||I<=0)&&de!=null&&(I=de)}let Z=I!=null&&I>0?C+I:Number.POSITIVE_INFINITY;return g>=C&&(Number.isFinite(Z)?g<Z:!0)},X=!!document.querySelector("[data-composition-src]"),we=!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`)){we=!0;break}}}let W=!X&&!we,P=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}},O=d=>typeof d=="number"&&Number.isFinite(d)&&d>F,ce=d=>{let g=ve(d.getAttribute("data-duration"));return g!=null&&g>0?g:Number.isFinite(d.duration)?Ze(d,d.duration):null},se=()=>{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=V(h);if(!Number.isFinite(y))continue;let C=ce(h);C==null||C<=F||(g=Math.max(g,Math.max(0,y)+C))}return g>F?g:null},J=()=>{let d=H();if(!d)return null;let g=window.__timelines??{},h=dt({timelineRegistry:g,includeAuthoredTimingAttrs:!0}),y=0,C=ve(d.getAttribute("data-duration"));C!=null&&C>0&&(y=C);let I=Array.from(d.querySelectorAll("[data-composition-id][data-start]"));for(let G of I){if(!(G instanceof Element)||G.parentElement?.closest("[data-composition-id]")!==d)continue;let $=h.resolveStartForElement(G,0),de=h.resolveDurationForElement(G);!Number.isFinite($)||de==null||de<=0||(y=Math.max(y,Math.max(0,$)+de))}return y>F?y:null},K=()=>{let d=se();return typeof d!="number"||!Number.isFinite(d)||d<=F?null:d},Y=d=>O(d)?Math.max(F,d*M):F,ze=()=>{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(C){N("runtime.init.adapterDuration",C)}typeof y=="number"&&Number.isFinite(y)&&y>0&&(d=Math.max(d,y))}return d>F?d:null},xe=(d,g=0)=>{let h=P(d),y=K(),C=J(),I=ze(),G=Math.max(y??0,C??0,I??0),Z=Number.isFinite(g)&&g>F?g:0,$=0;return O(h)?$=Math.max(h,G,Z):O(G)?$=Math.max(G,Z):$=Z,$>0?Math.max(0,$):0},Mt=()=>{let d=window.__timelines??{},g=oe=>{let ne=Object.entries(d).filter(ae=>!!ae[1]&&typeof ae[1].play=="function"&&typeof ae[1].pause=="function");if(ne.length!==1)return{timeline:null};let he=ne[0];if(!he)return{timeline:null};let[be,fe]=he;return{timeline:fe,selectedTimelineIds:[be],selectedDurationSeconds:P(fe),diagnostics:{code:"root_timeline_sole_registered_fallback",details:{reason:oe,soleTimelineId:be}}}},h=dt({timelineRegistry:d,includeAuthoredTimingAttrs:!0}),y=K(),C=J(),I=Math.max(y??0,C??0)||null,G=Y(I),Z=oe=>{let ne=document.querySelector(`[data-composition-id="${CSS.escape(oe)}"]`);return ne?h.resolveStartForElement(ne,0):0},$=oe=>{let ne=window.gsap;if(!ne||typeof ne.timeline!="function")return null;let he=ne.timeline({paused:!0});for(let be of oe)he.add(be.timeline,Z(be.compositionId));return he},de=(oe,ne)=>{if(!O(oe))return null;let he=window.gsap;if(!he||typeof he.timeline!="function")return null;let be=he.timeline({paused:!0});if(ne)try{be.add(ne,0)}catch(ae){N("runtime.init.site2",ae)}let fe=be;if(typeof fe.to=="function")try{fe.to({},{duration:oe})}catch(ae){N("runtime.init.site3",ae)}return be},Me=(oe,ne)=>{let he=oe;if(typeof he.getChildren!="function")return[];try{let be=he.getChildren(!0,!0,!0)??[];if(!Array.isArray(be))return[];let fe=[];for(let ae of ne)if(!be.some(Qe=>Qe===ae.timeline))try{let Qe=Z(ae.compositionId);oe.add(ae.timeline,Qe),fe.push(ae.compositionId)}catch(Qe){N("runtime.init.site4",Qe)}return fe}catch{return[]}},ie=H(),te=ie?.getAttribute("data-composition-id")??null;if(!te)return g("root_missing_composition_id");let Se=d[te]??null,_e=(()=>{if(!ie)return[];let oe=new Set,ne=Array.from(ie.querySelectorAll("[data-composition-id]")),he=[];for(let be of ne){let fe=be.getAttribute("data-composition-id");if(!fe||fe===te||oe.has(fe))continue;oe.add(fe);let ae=d[fe]??null;if(!ae||typeof ae.play!="function"||typeof ae.pause!="function")continue;let st=P(ae);he.push({compositionId:fe,timeline:ae,durationSeconds:st??0})}return he})(),ln=oe=>{for(let ne of oe){let he=ne.timeline;if(typeof he.paused=="function")try{he.paused(!1)}catch(be){N("runtime.init.site5",be)}}};if(_e.length>0&&ln(_e),Se){let oe=_e.length>0?Me(Se,_e):[];if((_e.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id=\'"+te+"\'])"))&&(Ie=!0),oe.length>0)try{let fe=Se.time();Se.seek(fe,!1)}catch{}let ne=P(Se);if(!O(ne)&&_e.length>0){let fe=_e.map(Wf=>Wf.compositionId),ae=$(_e),st=P(ae);if(ae&&O(st))return{timeline:ae,selectedTimelineIds:fe,selectedDurationSeconds:st,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:te,rootDurationSeconds:ne,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:G,selectedDurationSeconds:st,mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:C,selectedTimelineIds:fe,autoNestedChildren:oe}}};let Qe=de(I??0,Se),Ci=P(Qe);if(Qe&&O(Ci))return{timeline:Qe,selectedTimelineIds:[te],selectedDurationSeconds:Ci,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:te,rootDurationSeconds:ne,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:C,selectedDurationSeconds:Ci,selectedTimelineIds:[te],autoNestedChildren:oe}}}}if(!O(ne)&&_e.length===0){let fe=de(I??0,Se),ae=P(fe);if(fe&&O(ae))return{timeline:fe,selectedTimelineIds:[te],selectedDurationSeconds:ae,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:te,rootDurationSeconds:ne,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:C,selectedDurationSeconds:ae,selectedTimelineIds:[te]}}}}let he=ve(ie?.getAttribute("data-duration")),be=Math.max(O(he)?he:0,C??0);if(be>0&&O(be)&&O(ne)&&be>=ne+.5){let fe=Se;if(typeof fe.to=="function")try{fe.to({},{duration:0},be)}catch(st){N("runtime.init.site6",st)}let ae=P(Se);if(O(ae))return{timeline:Se,selectedTimelineIds:[te],selectedDurationSeconds:ae,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:te,rootDurationSeconds:ne,rootDeclaredDur:he,authoredCompositionDurationFloorSeconds:C,newDur:ae}}}}return{timeline:Se,selectedTimelineIds:[te],selectedDurationSeconds:ne,mediaDurationFloorSeconds:y,diagnostics:oe.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:te,selectedDurationSeconds:ne,autoNestedChildren:oe}}:void 0}}if(_e.length>0){let oe=_e.map(be=>be.compositionId),ne=$(_e),he=P(ne);if(ne)return{timeline:ne,selectedTimelineIds:oe,selectedDurationSeconds:he,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:te,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:G,selectedDurationSeconds:he,mediaDurationFloorSeconds:y,selectedTimelineIds:oe}}}}return g("root_composition_id_unmatched_in_registry")},Ie=!1,Ef=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 C=y,I=C.timeline;if(!I||!("_ease"in I)||typeof I._ease=="function")continue;let G=C.vars?.keyframes,$=(G&&!Array.isArray(G)?G.ease:void 0)??C.vars?.ease??"none";try{let de=g.parseEase($);typeof de=="function"&&(I._ease=de)}catch(de){Le("keyframe_ease_repair_failed",{ease:typeof $=="string"?$:String($)}),N("runtime.keyframeEase.repair",de)}}},tn=()=>{if(b(),!W)return!1;let d=e.capturedTimeline,g=P(d),h=O(g);if(d&&h&&Ie)return!1;let y=Mt();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),Ef(e.capturedTimeline);let C=xe(e.capturedTimeline,0);if(C<=0&&typeof e.capturedTimeline.progress=="function"&&(e.capturedTimeline.progress(1,!0),e.capturedTimeline.progress(0,!1),ot(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 G=Math.max(0,e.currentTime||0);e.capturedTimeline.totalTime(G,!1),ot(e.capturedTimeline)}let I=window.__hfStudioManualEditsApply;typeof I=="function"&&I(),jr(document)}if(y.diagnostics&&ye({source:"hf-preview",type:"diagnostic",code:y.diagnostics.code,details:y.diagnostics.details}),ye({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:y.selectedTimelineIds??[],selectedDurationSeconds:y.selectedDurationSeconds??null,mediaDurationFloorSeconds:y.mediaDurationFloorSeconds??null}}),window.parent!==window){let I=H(),G=C>0?C:0,Z=String(G>0?G:1),$=new Set,de=new Set(document.querySelectorAll("[data-start]")),Me=ie=>{let te=ie.parentElement;for(;te&&te!==I;){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!==I&&(te.hasAttribute("data-start")||Me(te)||$.has(te)||($.add(te),te.setAttribute("data-start","0"),te.setAttribute("data-duration",Z),te.setAttribute("data-hf-autostamped","1")))}catch{}if(I instanceof HTMLElement)for(let ie of I.querySelectorAll("[id]"))ie instanceof HTMLElement&&ie!==I&&(ie.hasAttribute("data-start")||Me(ie)||$.has(ie)||ie.tagName==="SCRIPT"||ie.tagName==="STYLE"||ie.tagName==="LINK"||($.add(ie),ie.setAttribute("data-start","0"),ie.setAttribute("data-duration",Z),ie.setAttribute("data-hf-autostamped","1")))}for(let I of nn)ir.delete(I),Ba(I);return!0};window.__hfForceTimelineRebind=()=>{Ie=!1,tn(),xi(e.currentTime)};let Af=()=>{let d=H();if(!(d instanceof HTMLElement))return;let g=d.getBoundingClientRect(),h=Number(d.getAttribute("data-width")),y=Number(d.getAttribute("data-height")),C=window.getComputedStyle(d),I=Number.isFinite(h)&&h>0&&Number.isFinite(y)&&y>0,G=g.width<=0||g.height<=0||d.clientWidth<=0||d.clientHeight<=0;!I||!G||R("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:C.display,visibility:C.visibility,overflow:C.overflow},`root-stage-layout-zero:${d.getAttribute("data-composition-id")??"unknown"}`)},Cf=()=>{e.tornDown||(l!=null&&window.cancelAnimationFrame(l),l=window.requestAnimationFrame(()=>{l=null,Af()}))},wf=()=>{r=d=>{let g=w(d.error??d.message).slice(0,E);if(!g)return;let h=L(g);ye({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=w(d.reason).slice(0,E);if(!g)return;let h=L(g);ye({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)},_f=()=>{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 C=h.tagName.toLowerCase(),I=h.getAttribute("src")??h.getAttribute("href")??h.getAttribute("poster")??null,G=C==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";R(G,{tagName:C,assetUrl:I,currentSrc:(h instanceof HTMLImageElement||h instanceof HTMLMediaElement)&&h.currentSrc||null,readyState:h instanceof HTMLMediaElement?h.readyState:null,networkState:h instanceof HTMLMediaElement?h.networkState:null},`${G}:${C}:${I??"unknown"}`)};h.addEventListener("error",y),_(()=>{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&&R("runtime_font_load_issue",{failedFamilies:h,totalFaces:Array.from(g).length},`runtime-font-load-issue:${h.join("|")}`)}).catch(()=>{})},Tf=(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),C=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),C&&typeof e.capturedTimeline.play=="function"&&e.capturedTimeline.play()}catch(I){N("runtime.init.site7",I)}return ye({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},St=null,Pa=!1,Oa=!1,nn=new Set,ir=new WeakMap,or=()=>{e.tornDown||(St!=null&&window.clearTimeout(St),St=window.setTimeout(()=>{if(e.tornDown||(St=null,Oa&&window.__HF_EXPORT_RENDER_SEEK_CONFIG))return;let d=Mt();if(!d.timeline||!O(d.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){tn()&&(vt(),Fe(!0));return}if(Pa)return;let h=P(e.capturedTimeline),y=d.selectedDurationSeconds??P(d.timeline);O(y)&&(!O(h)||y>=h+A)&&Tf(d,"manual")&&(Pa=!0,ye({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}}),vt(),Fe(!0))},v))},Ha=d=>{d.currentTarget instanceof HTMLMediaElement&&Zs(d.currentTarget)},Ga=d=>{d.currentTarget instanceof HTMLMediaElement&&el(d.currentTarget)},Rf=()=>{for(let d of nn)d.removeEventListener("loadedmetadata",or),d.removeEventListener("durationchange",or),d.removeEventListener("loadedmetadata",Ha),d.removeEventListener("error",Ga);nn.clear()},pi=()=>{if(e.tornDown)return;let d=Array.from(document.querySelectorAll("video, audio"));for(let g of d){if(nn.has(g))continue;nn.add(g);let h=Number.parseFloat(g.dataset.volume??"");Number.isFinite(h)&&(g.volume=Math.max(0,Math.min(1,h))),g.addEventListener("loadedmetadata",or),g.addEventListener("durationchange",or),g.addEventListener("loadedmetadata",Ha),g.addEventListener("error",Ga),Qs(g),g.preload!=="auto"&&(g.preload="auto"),g.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&g.load(),Ba(g)}},Ba=d=>{ir.has(d)||Is(d,e.capturedTimeline,xe(e.capturedTimeline,0),ir,{allowLiveTimelineSeek:!window.__HF_RENDER_CAPTURE_MODE})},hi=new WeakMap,Ua=d=>{let g=hi.get(d);if(g!==void 0)return g;let h=window.getComputedStyle(d).position,y=h==="static"||h==="relative"||h==="sticky";return hi.set(d,y),y},gi=new WeakMap,kf=d=>{let g=gi.get(d);if(g!==void 0)return g;let h=d.querySelector("[data-start]")===null;return gi.set(d,h),h},Ff=()=>{hi=new WeakMap,gi=new WeakMap},bi=new WeakMap,ar=new WeakSet,xi=(d,g=Array.from(document.querySelectorAll("[data-start]")))=>{let h=H();for(let y of g){if(!(y instanceof HTMLElement))continue;if(y.hasAttribute("data-hidden")){ar.has(y)||(bi.set(y,y.style.getPropertyValue("display")),ar.add(y)),y.style.display="none",(y instanceof HTMLVideoElement||y instanceof HTMLImageElement)&&n?.setSourceVisibility(y,!1);continue}if(ar.has(y)){let I=bi.get(y);I?y.style.display=I:y.style.removeProperty("display"),bi.delete(y),ar.delete(y)}let C=q(y,d);if(C){let I=y.parentElement;for(;I&&I!==h;){if(I instanceof HTMLElement&&I.hasAttribute("data-start")&&!q(I,d)){C=!1;break}I=I.parentElement}}y.style.visibility=C?"visible":"hidden",(y instanceof HTMLVideoElement||y instanceof HTMLImageElement)&&n?.setSourceVisibility(y,C),C?Ua(y)&&y.style.removeProperty("display"):Ua(y)&&kf(y)&&(y.style.display="none")}},Pe=()=>{let d=js({shouldIncludeElement:h=>h.hasAttribute("data-start")||!!U(h).compositionRoot,resolveStartSeconds:h=>V(h),resolveDurationSeconds:h=>{let y=U(h),C=V(h),I=y.inheritedStart!=null&&y.inheritedDuration!=null&&y.inheritedDuration>0?Math.max(0,y.inheritedStart+y.inheritedDuration-C):null,G=Number.isFinite(h.duration)?Ze(h,h.duration):null,Z=ve(h.dataset.duration),$=Z!=null&&Z>0?Z:null;return $s({isVideo:h.tagName==="VIDEO",sourceDuration:G,hostRemaining:I,explicitDuration:$})}});for(let h of d.mediaClips){let y=ir.get(h.el);y&&(h.volumeKeyframes=y)}let g=e.mediaForceSyncNextTick;g&&(e.mediaForceSyncNextTick=!1),e.nativeMediaSyncDisabled||Ks({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,C)=>m.setElementVolume(h,C),isWebAudioOwned:h=>m.ownsElement(h),isWebAudioRouted:h=>m.routesElement(h),onAutoplayBlocked:()=>{e.mediaAutoplayBlockedPosted||(e.mediaAutoplayBlockedPosted=!0,ye({source:"hf-preview",type:"media-autoplay-blocked"}))}}),xi(e.currentTime)},Fe=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,ye({source:"hf-preview",type:"state",frame:g,isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},yi="",Wa=0,Mf=()=>{let d="";for(let g of document.querySelectorAll("[data-start]"))d+=`${g.id}:${g.tagName}|`;return d},vt=()=>{j(),z(),k();let d=H();if(d){let y=D(d.getAttribute("data-width")),C=D(d.getAttribute("data-height")),I=y?parseInt(y,10):0,G=C?parseInt(C,10):0;I>0&&G>0&&ye({source:"hf-preview",type:"stage-size",width:I,height:G})}tn();let g=Ol({canonicalFps:e.canonicalFps});window.__clipManifest=g;let h=Mf();if(yi!==h&&Ff(),!window.__clipTree||yi!==h){let y=window;window.__clipTree=Nl({startResolver:dt({timelineRegistry:y.__timelines??{},includeAuthoredTimingAttrs:!0}),timelineRegistry:y.__timelines??{},rootDuration:g.durationInFrames/e.canonicalFps}),yi=h}ye(g),Cf()},Si=d=>typeof d=="number"&&Number.isFinite(d)&&d>0?d:0,Lf=d=>{let g=Si(Number(d));if(g<=0)return;let h=H(),y=Si(ve(h?.getAttribute("data-duration"))),C=Math.max(Wa,Si(c.getDuration()),y);g<=C||(Wa=g,h?.setAttribute("data-duration",String(g)),c.setDuration(g),vt(),Fe(!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){N("runtime.init.site8",y)}if(d==="discover")try{h.seek({time:g,suppressEvents:!0})}catch(y){N("runtime.init.site9",y)}}},Et=()=>{window.__renderReady=!1},rn=null,on=!0,Nf=()=>{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){N("runtime.init.adapterReady",y)}}return d},Df=()=>{let d=Nf();if(d.length===0)return rn=null,on=!0,!0;let g=d[0];if(!g)return!0;let h=d.length===1?g:Promise.all(d);return h!==rn&&(rn=h,on=!1,Promise.resolve(h).then(()=>{rn===h&&(on=!0,Et())},y=>{rn===h&&(on=!0,N("runtime.init.adapterReady",y),Et())})),on};if(W)Jo();else{let d={injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,injectedLinks:e.injectedCompLinks,parseDimensionPx:D,onDiagnostic:({code:g,details:h})=>{ye({source:"hf-preview",type:"diagnostic",code:g,details:h})}};Rc(d).then(()=>Tc(d)).finally(()=>{W=!0,pi(),_f(),Jo(),ra(document),Et()})}let sr=Rl({postMessage:d=>ye(d)});sr.installPickerApi(),xi(e.currentTime,Array.from(document.querySelectorAll("video[data-start], img[data-start]")));let qe=md();n=qe,_(()=>{qe.destroy(),n=null});let vi=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(C){N("runtime.init.site10",C)}},Va={play:()=>{let d=e.capturedTimeline;if(c.isPlaying())return;let g=xe(d,0);if(g>0)c.setDuration(g),c.reachedEnd()&&(c.seek(0),e.currentTime=0,At(0));else{let h=H(),y=Number(h?.getAttribute("data-duration")??0);y>0&&c.setDuration(y)}ot(d),c.play()&&(e.isPlaying=!0,e.mediaForceSyncNextTick=!0,Ya(c.now()),f&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&Xa(),Oe("play"),Pe(),qe.redraw(),Fe(!0))},pause:()=>{if(!c.isPlaying())return;m.stopAll(),c.detachAudioSource(),c.pause(),e.isPlaying=!1,e.currentTime=c.now(),e.mediaForceSyncNextTick=!0,Ya(e.currentTime);let d=e.capturedTimeline;ot(d),Oe("pause"),Pe(),qe.redraw(),Fe(!0)},seek:(d,g)=>{let h=Vt(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 C=e.capturedTimeline;if(ot(C),At(e.currentTime),Oe("pause"),g?.keepPlaying&&y){Va.play();return}Pe(),qe.redraw(),Fe(!0)},renderSeek:(d,g)=>{Oa=!0;let h=Vt(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,At(e.currentTime,{activateChildren:!0,suppressEvents:g?.suppressEvents}),Oe("pause"),Pe(),qe.redraw(),Fe(!0)},getTime:()=>c.now(),getDuration:()=>{let d=c.getDuration();return Number.isFinite(d)?d:0},isPlaying:()=>c.isPlaying(),setPlaybackRate:d=>{vi(d),c.setRate(e.playbackRate),Ja()},getPlaybackRate:()=>e.playbackRate},za=xe(e.capturedTimeline,0);za>0&&c.setDuration(za);let He=Ml({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:vi,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:Fe,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){N("runtime.init.site11",y)}},onDeterministicPause:()=>Oe("pause"),onDeterministicPlay:()=>Oe("play"),onRenderFrameSeek:()=>{qe.redraw()},onShowNativeVideos:()=>{},getSafeDuration:()=>xe(e.capturedTimeline,0),transport:Va});window.__player=T(He),window.__playerReady=!0,Le("composition_loaded",{duration:He.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),e.deterministicAdapters=[Rs(),ds({resolveStartSeconds:d=>B(d,0)}),ms(),hs(),xs(),ys(),Ss(),vs(),Es(),As(),Cs(),fs({getTimeline:()=>e.capturedTimeline})],_s(),Ts(),window.__hfReseekGpu=d=>{let g=Math.max(0,Number(d)||0);window.__hfThreeTime=g,window.__hfTypegpuTime=g,hr(g)},window.__hfWaitForSeekCompletion=Ii,o.push(()=>{window.__hfWaitForSeekCompletion===Ii&&delete window.__hfWaitForSeekCompletion}),wf(),pi(),Oe("discover");let If=()=>{let d=e.capturedTimeline,g=tn();e.capturedTimeline&&(g||e.capturedTimeline!==d||!He._timeline)&&(He._timeline=e.capturedTimeline);let h=xe(e.capturedTimeline,0);if(h>0&&c.setDuration(h),Oe("discover",e.currentTime),!e.capturedTimeline){let y=window.__timelines??{},C=Object.keys(y).filter(I=>y[I]);if(C.length>0){let G=H()?.getAttribute("data-composition-id")??null;R("root_timeline_unbound_registry_present",{reason:G?"root data-composition-id has no matching key in window.__timelines":"root composition element has no data-composition-id attribute",rootCompositionId:G,registeredTimelineKeys:C},"root_timeline_unbound_registry_present"),console.warn("[hyperframes] Root timeline not bound \\u2014 render will freeze at t=0. "+(G?`Root data-composition-id is "${G}" 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["${G??"<root-id>"}"] = tl).`)}}window.__renderReady=!0,vt(),Fe(!0)},Lt=null,Pf=()=>{if(Lt)return;let d=()=>{window.removeEventListener("hf-timelines-built",d),Lt=null,Et()};Lt=d,window.addEventListener("hf-timelines-built",d)};_(()=>{Lt&&(window.removeEventListener("hf-timelines-built",Lt),Lt=null)}),Et=()=>{if(!W){window.__renderReady=!1;return}if(window.__hfTimelinesBuilding){window.__renderReady=!1,Pf();return}if(Oe("discover",e.currentTime),!Df()){window.__renderReady=!1;return}If()},Et(),W&&setTimeout(()=>{Et()},0);let lr=0,Ei=!1,Of=(d,g,h,y)=>{try{let C=y?.suppressEvents===!0;ot(d),typeof d.totalTime=="function"?d.totalTime(g,C):d.seek(g,C)}catch(C){N(h,C)}},Hf=(d,g)=>{let h=window.__timelines??{},y=H()?.getAttribute("data-composition-id")??null;for(let[C,I]of Object.entries(h)){if(!I||C===y)continue;let G=document.querySelector(`[data-composition-id="${CSS.escape(C)}"]`);if(!G)continue;let Z=B(G,0);if(!Number.isFinite(Z))continue;let $=P(I),de=je(G)+Math.max(0,d-Z)*Te(G),Me=Math.max(0,$!=null&&$>0?Math.min($,de):de);Of(I,Me,"runtime.init.transport.childTimeline",g)}},qa=d=>{let g=window.__timelines??{};for(let h of Object.values(g))if(!(!h||h===d))try{h.play()}catch(y){N("runtime.init.activateSiblings",y)}},$a=d=>typeof d=="object"&&d!==null,an=new WeakMap,Gf=["onStart","onUpdate","onComplete","onReverseComplete","onRepeat"],ja=(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 N("runtime.init.gsapCallbackDuration",y),null}},Bf=d=>{let g=an.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 N("runtime.init.gsapCallbackChildren",y),an.set(d,!1),!1}if(!Array.isArray(h))return an.set(d,!1),!1;for(let y of h){if(!$a(y))continue;let C=y.vars;if(!$a(C)||!Gf.some($=>typeof C[$]=="function"))continue;let Z=ja(y,"totalDuration")??ja(y,"duration");if(Z!=null&&Z<=1e-6)return an.set(d,!0),!0}return an.set(d,!1),!1};function At(d,g){let h=e.capturedTimeline,y=g?.suppressEvents===!0;if(h){g?.activateChildren&&qa(h);let C=h,I=d;if(typeof C.totalDuration=="function")try{let G=Number(C.totalDuration());Number.isFinite(G)&&G>0&&d>G&&(I=G)}catch(G){N("runtime.init.transport.clampDuration",G)}try{typeof h.totalTime=="function"?(h.totalTime(I,y),!y&&!Bf(h)&&(h.totalTime(I+.001,!0),h.totalTime(I,!0))):h.seek(I,y)}catch(G){N("runtime.init.transport.seek",G)}}Hf(d,g),h&&g?.activateChildren&&qa(h);for(let C of e.deterministicAdapters)if(!(C.name==="gsap"&&h))try{C.seek({time:d,suppressEvents:y})}catch(I){N("runtime.init.transport.adapter",I)}}let Uf=()=>{try{return document.querySelector(`[${Fd}]`)!=null}catch{return!1}},Ka=()=>{if(!(e.tornDown||Ei)){Ei=!0;try{if(e.transportRafId=window.requestAnimationFrame(Ka),lr+=1,Md({tick:lr,isPlaying:c.isPlaying(),hasCapturedTimeline:e.capturedTimeline!=null,currentTimeSeconds:c.now()})){let g=e.capturedTimeline;if(tn()){e.capturedTimeline&&!He._timeline&&(He._timeline=e.capturedTimeline),e.capturedTimeline&&e.capturedTimeline!==g&&ot(e.capturedTimeline);let h=xe(e.capturedTimeline,0);h>0&&c.setDuration(h),vt()}}if(lr%20===0&&vt(),lr%30===0&&pi(),e.capturedTimeline){let g=xe(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)continue;let C=Number.parseFloat(y.dataset.start??""),I=ve(y.dataset.duration),G=I!=null&&I>0?C+I:1/0,Z=je(y);if(Number.isFinite(C)&&e.currentTime>=C&&e.currentTime<G){y.paused?!y.error&&y.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&(c.attachAudioSource({currentTimeSeconds:e.currentTime}),h=!0):(c.attachAudioSource({el:y,compositionStart:C,mediaStart:Z}),h=!0);break}}!h&&c.hasAudioSource()&&c.detachAudioSource()}else c.hasAudioSource()&&c.detachAudioSource();let d=c.now();if(e.currentTime=d,(c.isPlaying()||!Uf())&&At(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,At(g)),Oe("pause"),Pe(),Fe(!0);return}c.isPlaying()&&Pe(),Fe(!1)}finally{Ei=!1}}},Ya=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 C=ve(h.dataset.duration),I=C!=null&&C>0?y+C:1/0;if(d<y||d>=I)continue;let G=je(h),Z=d-y+G;if(Z>=0)try{h.currentTime=Z}catch{}}},Xa=()=>{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)continue;let y=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(y))continue;let C=je(h),I=Number.parseFloat(h.dataset.volume??""),G=Number.isFinite(I)?I:1,Z=ve(h.dataset.duration),$=Z!=null&&Z>0?Z:Number.POSITIVE_INFINITY,de=h.closest("[data-composition-id]");if(de){let Me=B(de,0),ie=ee(de,{includeAuthoredTimingAttrs:!0});ie!=null&&ie>0&&($=Math.min($,Math.max(0,Me+ie-y)))}m.scheduleMediaElementPlayback(h,y,C,c.now(),G,d,e.playbackRate).then(Me=>{if(Me||!c.isPlaying())return;let ie=e.playbackRate*Te(h),te=h.hasAttribute("data-fx-chain")||h.hasAttribute("data-automation");if(Math.abs(ie-1)>1e-9){te&&(h.muted=!0);return}m.decodeAudioElement(h).then(Se=>{!Se||!c.isPlaying()||m.schedulePlayback(h,Se,y,C,c.now(),G,d,e.playbackRate,$)})})}};function Ja(){m.setRate(e.playbackRate)&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&f&&c.isPlaying()&&m.hasBoundedActiveSources()&&(m.stopAll(),Xa())}if(e.capturedTimeline){let d=xe(e.capturedTimeline,0);d>0&&c.setDuration(d),ot(e.capturedTimeline)}Dc(window),e.transportRafId=window.requestAnimationFrame(Ka),vt(),Fe(!0),e.controlBridgeHandler=ts({onPlay:()=>{He.play(),Le("composition_played",{time:He.getTime()})},onPause:()=>{He.pause(),Le("composition_paused",{time:He.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)=>{He.seek(d),Le("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??""),C=Number.isFinite(y)?y:1;h.volume=C*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=>{vi(d),e.transportClock&&e.transportClock.setRate(e.playbackRate),Ja()},onSetRootDuration:Lf,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,At(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,At(g)),Oe("pause"),Pe(),Fe(!0)}},onEnablePickMode:()=>sr.enablePickMode(),onDisablePickMode:()=>sr.disablePickMode(),getCanonicalFps:()=>e.canonicalFps});let Ai=()=>{if(!e.tornDown){e.tornDown=!0,e.transportRafId!=null&&(window.cancelAnimationFrame(e.transportRafId),e.transportRafId=null),e.transportClock=null,m.destroy(),St!=null&&(window.clearTimeout(St),St=null),l!=null&&(window.cancelAnimationFrame(l),l=null),Rf(),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),sr.disablePickMode();for(let d of e.deterministicAdapters)if(!(!d||typeof d.revert!="function"))try{d.revert()}catch(g){N("runtime.init.site12",g)}e.deterministicAdapters=[];for(let d of o.splice(0))try{d()}catch(g){N("runtime.init.site13",g)}for(let d of e.injectedCompStyles)try{d.remove()}catch(g){N("runtime.init.site14",g)}e.injectedCompStyles=[];for(let d of e.injectedCompLinks)try{d.remove()}catch(g){N("runtime.init.site15",g)}e.injectedCompLinks=[];for(let d of e.injectedCompScripts)try{d.remove()}catch(g){N("runtime.init.site16",g)}e.injectedCompScripts=[],e.capturedTimeline=null,window.__hfRuntimeTeardown===Ai&&(window.__hfRuntimeTeardown=null)}};window.__hfRuntimeTeardown=Ai,e.beforeUnloadHandler=Ai,window.addEventListener("beforeunload",e.beforeUnloadHandler)}var Ud=["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"],Ta=[[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 Ud[e];let t=0,n=Ta.length-1;for(;t<=n;){let r=t+n>>1,i=Ta[r];if(e<i[0]){n=r-1;continue}if(e>i[1]){t=r+1;continue}return i[2]}return"L"}function fx(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=dx(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 S=u;S<c;S++)n[S]=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 Wd(e,t){let n=fx(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 mx=/[ \\t\\n\\r\\f]+/g,px=/[\\t\\n\\r\\f]| {2,}|^ | $/;function hx(e){let t=e??"normal";return t==="pre-wrap"?{mode:t,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:t,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function gx(e){if(!px.test(e))return e;let t=e.replace(mx," ");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 Ra=null,xx;function yx(){return Ra===null&&(Ra=new Intl.Segmenter(xx,{granularity:"word"})),Ra}var Sx=/\\p{Script=Arabic}/u,si=/\\p{M}/u,Xd=/\\p{Nd}/u;function Vd(e){return Sx.test(e)}function zd(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 Ve(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(zd(i))return!0;t++;continue}}if(zd(n))return!0}}return!1}function vx(e){let t=ci(e);return t!==null&&(ui.has(t)||bt.has(t))}var Ex=new Set(["\\xA0","\\u202F","\\u2060","\\uFEFF"]);function Ax(e){return Ve(e)}function Cx(e){let t=ci(e);return t!==null&&Ex.has(t)}function li(e){return!vx(e)&&!Cx(e)}var ui=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"]),rr=new Set([\'"\',"(","[","{","\\u201C","\\u2018","\\xAB","\\u2039","\\uFF08","\\u3014","\\u3008","\\u300A","\\u300C","\\u300E","\\u3010","\\u3016","\\u3018","\\u301A"]),Fa=new Set(["\'","\\u2019"]),bt=new Set([".",",","!","?",":",";","\\u060C","\\u061B","\\u061F","\\u0964","\\u0965","\\u104A","\\u104B","\\u104C","\\u104D","\\u104F",")","]","}","%",\'"\',"\\u201D","\\u2019","\\xBB","\\u203A","\\u2026"]),wx=new Set([":",".","\\u060C","\\u061B"]),_x=new Set(["\\u104F"]),Tx=new Set(["\\u201D","\\u2019","\\xBB","\\u203A","\\u300D","\\u300F","\\u3011","\\u300B","\\u3009","\\u3015","\\uFF09"]);function Rx(e){if(Ma(e))return!0;let t=!1;for(let n of e){if(bt.has(n)){t=!0;continue}if(!(t&&si.test(n)))return!1}return t}function kx(e){for(let t of e)if(!ui.has(t)&&!bt.has(t))return!1;return e.length>0}function Fx(e){if(Ma(e))return!0;for(let t of e)if(!rr.has(t)&&!Fa.has(t)&&!si.test(t))return!1;return e.length>0}function Ma(e){let t=!1;for(let n of e)if(!(n==="\\\\"||si.test(n))){if(rr.has(n)||bt.has(n)||Fa.has(n)){t=!0;continue}return!1}return t}function Jd(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 ci(e){if(e.length===0)return null;let t=Jd(e,e.length);return e.slice(t)}function Mx(e){let t=Array.from(e),n=t.length;for(;n>0;){let r=t[n-1];if(si.test(r)){n--;continue}if(rr.has(r)||Fa.has(r)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function Lx(e,t,n){return n==="text"&&!t&&e.length===1&&e!=="-"&&e!=="\\u2014"?e:null}function qd(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 $d(e,t){return e&&t!==null&&wx.has(t)}function Nx(e){let t=ci(e);return t!==null&&_x.has(t)}function Dx(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 di(e){let t=e.length;for(;t>0;){let n=Jd(e,t),r=e.slice(n,t);if(Tx.has(r))return!0;if(!bt.has(r))return!1;t=n}return!1}function Ix(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 Px=/[\\x20\\t\\n\\xA0\\xAD\\u200B\\u202F\\u2060\\uFEFF]/;function De(e){return e.length===1?e[0]:e.join("")}function Ox(e,t){let n=[];for(let r=e.length-1;r>=0;r--)n.push(e[r]);return n.push(t),De(n)}function Hx(e,t,n,r){if(!Px.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=Ix(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:De(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:De(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 Gx=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function Bx(e,t){let n=e.texts[t];return n.startsWith("www.")?!0:Gx.test(n)&&t+1<e.len&&e.kinds[t+1]==="text"&&e.texts[t+1]==="//"}function Ux(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}function Wx(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"||!Bx(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]=De(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 Vx(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]),!Ux(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(De(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 zx=new Set([":","-","/","\\xD7",",",".","+","\\u2013","\\u2014"]),jd=/^[A-Za-z0-9_]+[,:;]*$/,Kd=/[,:;]+$/;function Qd(e){for(let t of e)if(Xd.test(t))return!0;return!1}function nr(e){if(e.length===0)return!1;for(let t of e)if(!(Xd.test(t)||zx.has(t)))return!1;return!0}function qx(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"&&nr(a)&&Qd(a)){let s=[a],u=o+1;for(;u<e.len&&e.kinds[u]==="text"&&nr(e.texts[u]);)s.push(e.texts[u]),u++;t.push(De(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 $x(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&&jd.test(a)){let u=[a],c=Kd.test(a),m=o+1;for(;c&&m<e.len&&e.kinds[m]==="text"&&e.isWordLike[m]&&jd.test(e.texts[m]);){let f=e.texts[m];u.push(f),c=Kd.test(f),m++}t.push(De(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 jx(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||!Qd(c)||!nr(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 Kx(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=De(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=De(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(De(a)),n.push(l),r.push(s),i.push(u)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function Yx(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"||!Ve(t[o])||!Ve(t[o+1]))continue;let a=Mx(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 Yd(e,t,n){let r=yx(),i=0,o=[],a=[],l=[],s=[],u=[],c=[],m=[],f=[],p=[],b=[],S=[],x=[];for(let A of r.segment(e))for(let v of Hx(A.segment,A.isWordLike??!1,A.index,n)){let B=function(){c[k]!==null&&(a[k]=[qd(o,c,m,k)],c[k]=null),a[k].push(v.text),l[k]=l[k]||v.isWordLike,f[k]=f[k]||L,p[k]=p[k]||D,b[k]=z,S[k]=j,x[k]=$d(p[k],H)},E=v.kind==="text",w=Lx(v.text,v.isWordLike,v.kind),L=Ve(v.text),D=Vd(v.text),H=ci(v.text),z=di(v.text),j=Nx(v.text),k=i-1;t.carryCJKAfterClosingQuote&&E&&i>0&&s[k]==="text"&&L&&f[k]&&b[k]||E&&i>0&&s[k]==="text"&&kx(v.text)&&f[k]||E&&i>0&&s[k]==="text"&&S[k]?B():E&&i>0&&s[k]==="text"&&v.isWordLike&&D&&x[k]?(B(),l[k]=!0):w!==null&&i>0&&s[k]==="text"&&c[k]===w?m[k]=(m[k]??1)+1:E&&!v.isWordLike&&i>0&&s[k]==="text"&&(Rx(v.text)||v.text==="-"&&l[k])?B():(o[i]=v.text,a[i]=[v.text],l[i]=v.isWordLike,s[i]=v.kind,u[i]=v.start,c[i]=w,m[i]=w===null?0:1,f[i]=L,p[i]=D,b[i]=z,S[i]=j,x[i]=$d(D,H),i++)}for(let A=0;A<i;A++){if(c[A]!==null){o[A]=qd(o,c,m,A);continue}o[A]=De(a[A])}for(let A=1;A<i;A++)s[A]==="text"&&!l[A]&&Ma(o[A])&&s[A-1]==="text"&&(o[A-1]+=o[A],l[A-1]=l[A-1]||l[A],o[A]="");let _=Array.from({length:i},()=>null),R=-1;for(let A=i-1;A>=0;A--){let v=o[A];if(v.length!==0){if(s[A]==="text"&&!l[A]&&Fx(v)&&R>=0&&s[R]==="text"){let E=_[R]??[];E.push(v),_[R]=E,u[R]=u[A],o[A]="";continue}R=A}}for(let A=0;A<i;A++){let v=_[A];v!=null&&(o[A]=Ox(v,o[A]))}let T=0;for(let A=0;A<i;A++){let v=o[A];v.length!==0&&(T!==A&&(o[T]=v,l[T]=l[A],s[T]=s[A],u[T]=u[A]),T++)}o.length=T,l.length=T,s.length=T,u.length=T;let F=Kx({len:T,texts:o,isWordLike:l,kinds:s,starts:u}),M=Yx($x(jx(qx(Vx(Wx(F))))));for(let A=0;A<M.len-1;A++){let v=Dx(M.texts[A]);v!==null&&(M.kinds[A]!=="space"&&M.kinds[A]!=="preserved-space"||M.kinds[A+1]!=="text"||!Vd(M.texts[A+1])||(M.texts[A]=v.space,M.isWordLike[A]=!1,M.kinds[A]=M.kinds[A]==="preserved-space"?"preserved-space":"space",M.texts[A+1]=v.marks+M.texts[A+1],M.starts[A+1]=M.starts[A]+v.space.length))}return M}function Xx(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 Jx(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(De(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],S=e.starts[m];if(p==="text"){let x=Ax(f),_=li(f);if(o!==null&&s&&u){o.push(f),a=a||b,s=s||x,u=_;continue}c(),o=[f],a=b,l=S,s=x,u=_;continue}c(),t.push(f),n.push(b),r.push(p),i.push(S)}return c(),{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}function Zd(e,t,n="normal",r="normal"){let i=hx(n),o=i.mode==="pre-wrap"?bx(e):gx(e);if(o.length===0)return{normalized:o,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let a=r==="keep-all"?Jx(Yd(o,t,i)):Yd(o,t,i);return{normalized:o,chunks:Xx(a,i),...a}}var Zt=null,ef=new Map,en=null,Qx=96,Zx=/\\p{Emoji_Presentation}/u,ey=/[\\p{Emoji_Presentation}\\p{Extended_Pictographic}\\p{Regional_Indicator}\\uFE0F\\u20E3]/u,La=null,tf=new Map;function Na(){if(Zt!==null)return Zt;if(typeof OffscreenCanvas<"u")return Zt=new OffscreenCanvas(1,1).getContext("2d"),Zt;if(typeof document<"u")return Zt=document.createElement("canvas").getContext("2d"),Zt;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function ty(e){let t=ef.get(e);return t||(t=new Map,ef.set(e,t)),t}function at(e,t){let n=t.get(e);return n===void 0&&(n={width:Na().measureText(e).width,containsCJK:Ve(e)},t.set(e,n)),n}function yt(){if(en!==null)return en;if(typeof navigator>"u")return en={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},en;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 en={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:r,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},en}function ny(e){let t=e.match(/(\\d+(?:\\.\\d+)?)\\s*px/);return t?parseFloat(t[1]):16}function nf(){return La===null&&(La=new Intl.Segmenter(void 0,{granularity:"grapheme"})),La}function ry(e){return Zx.test(e)||e.includes("\\uFE0F")}function rf(e){return ey.test(e)}function iy(e,t){let n=tf.get(e);if(n!==void 0)return n;let r=Na();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 tf.set(e,n),n}function oy(e){let t=0,n=nf();for(let r of n.segment(e))ry(r.segment)&&t++;return t}function ay(e,t){return t.emojiCount===void 0&&(t.emojiCount=oy(e)),t.emojiCount}function xt(e,t,n){return n===0?t.width:t.width-ay(e,t)*n}function of(e,t,n,r,i){if(t.breakableFitAdvances!==void 0)return t.breakableFitAdvances;let o=nf(),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(xt(m,f,r))}return t.breakableFitAdvances=c,t.breakableFitAdvances}if(i==="pair-context"||a.length>Qx){let c=[],m=null,f=0;for(let p of a){let b=at(p,n),S=xt(p,b,r);if(m===null)c.push(S);else{let x=m+p,_=at(x,n);c.push(xt(x,_,r)-f)}m=p,f=S}return t.breakableFitAdvances=c,t.breakableFitAdvances}let l=[],s="",u=0;for(let c of a){s+=c;let m=at(s,n),f=xt(s,m,r);l.push(f-u),u=f}return t.breakableFitAdvances=l,t.breakableFitAdvances}function af(e,t){let n=Na();n.font=e;let r=ty(e),i=ny(e),o=t?iy(e,i):0;return{cache:r,fontSize:i,emojiCorrection:o}}function sy(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 sf(e,t){if(t<=0)return 0;let n=e%t;return Math.abs(n)<=1e-6?t:t-n}function lf(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 ly(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 uf(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 cf(e,t){if(t.segmentIndex>=e.widths.length)return-1;let n=ly(e,t.segmentIndex);return n<0?-1:uf(e,n,t)}function uy(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:uf(e,r,n)}function df(e,t){return e.simpleLineWalkFastPath?ff(e,t):Da(e,t)}function ff(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e;if(r.length===0)return 0;let l=yt().lineFitEpsilon,s=t+l,u=0,c=0,m=!1,f=0,p=0,b=0,S=0,x=-1,_=0;function R(){x=-1,_=0}function T(w=b,L=S,D=c){u++,n?.({startSegmentIndex:f,startGraphemeIndex:p,endSegmentIndex:w,endGraphemeIndex:L,width:D}),c=0,m=!1,R()}function F(w,L){m=!0,f=w,p=0,b=w+1,S=0,c=L}function M(w,L,D){m=!0,f=w,p=L,b=w,S=L+1,c=D}function A(w,L){if(!m){F(w,L);return}c+=L,b=w+1,S=0}function v(w,L){let D=o[w];for(let H=L;H<D.length;H++){let z=D[H];m?c+z>s?(T(),M(w,H,z)):(c+=z,b=w,S=H+1):M(w,H,z)}m&&b===w&&S===D.length&&(b=w+1,S=0)}let E=0;for(;E<r.length&&!(!m&&(E=sy(e,E),E>=r.length));){let w=r[E],L=i[E],D=L==="space"||L==="preserved-space"||L==="tab"||L==="zero-width-break"||L==="soft-hyphen";if(!m){w>t&&o[E]!==null?v(E,0):F(E,w),D&&(x=E+1,_=c-w),E++;continue}if(c+w>s){if(D){A(E,w),T(E+1,0,c-w),E++;continue}if(x>=0){if(b>x||b===x&&S>0){T();continue}T(x,0,_);continue}if(w>t&&o[E]!==null){T(),v(E,0),E++;continue}T();continue}A(E,w),D&&(x=E+1,_=c-w),E++}return m&&T(),u}function Da(e,t,n){if(e.simpleLineWalkFastPath)return ff(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=yt(),f=m.lineFitEpsilon,p=t+f,b=0,S=0,x=!1,_=0,R=0,T=0,F=0,M=-1,A=0,v=0,E=null;function w(){M=-1,A=0,v=0,E=null}function L(U=T,V=F,q=S){b++,n?.({startSegmentIndex:_,startGraphemeIndex:R,endSegmentIndex:U,endGraphemeIndex:V,width:q}),S=0,x=!1,w()}function D(U,V){x=!0,_=U,R=0,T=U+1,F=0,S=V}function H(U,V,q){x=!0,_=U,R=V,T=U,F=V+1,S=q}function z(U,V){if(!x){D(U,V);return}S+=V,T=U+1,F=0}function j(U,V,q,X){if(!V)return;let we=U==="tab"?0:i[q],W=U==="tab"?X:o[q];M=q+1,A=S-X+we,v=S-X+W,E=U}function k(U,V){let q=l[U];for(let X=V;X<q.length;X++){let we=q[X];x?S+we>p?(L(),H(U,X,we)):(S+=we,T=U,F=X+1):H(U,X,we)}x&&T===U&&F===q.length&&(T=U+1,F=0)}function B(U){if(E!=="soft-hyphen")return!1;let V=l[U];if(V==null)return!1;let{fitCount:q,fittedWidth:X}=lf(V,S,t,f,s);return q===0?!1:(S=X,T=U,F=q,w(),q===V.length?(T=U+1,F=0,!0):(L(U,q,X+s),k(U,q),!0))}function ee(U){b++,n?.({startSegmentIndex:U.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:U.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),w()}for(let U=0;U<c.length;U++){let V=c[U];if(V.startSegmentIndex===V.endSegmentIndex){ee(V);continue}x=!1,S=0,_=V.startSegmentIndex,R=0,T=V.startSegmentIndex,F=0,w();let q=V.startSegmentIndex;for(;q<V.endSegmentIndex;){let X=a[q],we=X==="space"||X==="preserved-space"||X==="tab"||X==="zero-width-break"||X==="soft-hyphen",W=X==="tab"?sf(S,u):r[q];if(X==="soft-hyphen"){x&&(T=q+1,F=0,M=q+1,A=S+s,v=S+s,E=X),q++;continue}if(!x){W>t&&l[q]!==null?k(q,0):D(q,W),j(X,we,q,W),q++;continue}if(S+W>p){let O=S+(X==="tab"?0:i[q]),ce=S+(X==="tab"?W:o[q]);if(E==="soft-hyphen"&&m.preferEarlySoftHyphenBreak&&A<=p){L(M,0,v);continue}if(E==="soft-hyphen"&&B(q)){q++;continue}if(we&&O<=p){z(q,W),L(q+1,0,ce),q++;continue}if(M>=0&&A<=p){if(T>M||T===M&&F>0){L();continue}let se=M;L(se,0,v),q=se;continue}if(W>t&&l[q]!==null){L(),k(q,0),q++;continue}L();continue}z(q,W),j(X,we,q,W),q++}if(x){let X=M===V.consumedEndSegmentIndex?v:S;L(V.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=yt(),p=f.lineFitEpsilon,b=r+p,S=0,x=!1,_=t.segmentIndex,R=t.graphemeIndex,T=-1,F=0,M=0,A=null;function v(){T=-1,F=0,M=0,A=null}function E(k=_,B=R,ee=S){return x?(t.segmentIndex=k,t.graphemeIndex=B,ee):null}function w(k,B){x=!0,_=k+1,R=0,S=B}function L(k,B,ee){x=!0,_=k,R=B+1,S=ee}function D(k,B){if(!x){w(k,B);return}S+=B,_=k+1,R=0}function H(k,B,ee,U){if(!B)return;let V=k==="tab"?0:a[ee],q=k==="tab"?U:l[ee];T=ee+1,F=S-U+V,M=S-U+q,A=k}function z(k,B){let ee=u[k];for(let U=B;U<ee.length;U++){let V=ee[U];if(!x)L(k,U,V);else{if(S+V>b)return E();S+=V,_=k,R=U+1}}return x&&_===k&&R===ee.length&&(_=k+1,R=0),null}function j(k){if(A!=="soft-hyphen"||T<0)return null;let B=u[k]??null;if(B!==null){let{fitCount:ee,fittedWidth:U}=lf(B,S,r,p,c);if(ee===B.length)return S=U,_=k+1,R=0,v(),null;if(ee>0)return E(k,ee,U+c)}return F<=b?E(T,0,M):null}for(let k=t.segmentIndex;k<i.endSegmentIndex;k++){let B=s[k],ee=B==="space"||B==="preserved-space"||B==="tab"||B==="zero-width-break"||B==="soft-hyphen",U=k===t.segmentIndex?t.graphemeIndex:0,V=B==="tab"?sf(S,m):o[k];if(B==="soft-hyphen"&&U===0){x&&(_=k+1,R=0,T=k+1,F=S+c,M=S+c,A=B);continue}if(!x){if(U>0){let X=z(k,U);if(X!==null)return X}else if(V>r&&u[k]!==null){let X=z(k,0);if(X!==null)return X}else w(k,V);H(B,ee,k,V);continue}if(S+V>b){let X=S+(B==="tab"?0:a[k]),we=S+(B==="tab"?V:l[k]);if(A==="soft-hyphen"&&f.preferEarlySoftHyphenBreak&&F<=b)return E(T,0,M);let W=j(k);if(W!==null)return W;if(ee&&X<=b)return D(k,V),E(k+1,0,we);if(T>=0&&F<=b)return _>T||_===T&&R>0?E():E(T,0,M);if(V>r&&u[k]!==null){let P=E();if(P!==null)return P;let O=z(k,0);if(O!==null)return O}return E()}D(k,V),H(B,ee,k,V)}return T===i.consumedEndSegmentIndex&&R===0?E(i.consumedEndSegmentIndex,0,M):E(i.consumedEndSegmentIndex,0,S)}function cy(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e,l=yt().lineFitEpsilon,s=n+l,u=0,c=!1,m=t.segmentIndex,f=t.graphemeIndex,p=-1,b=0;for(let S=t.segmentIndex;S<r.length;S++){let x=r[S],_=i[S],R=_==="space"||_==="preserved-space"||_==="tab"||_==="zero-width-break"||_==="soft-hyphen",T=S===t.segmentIndex?t.graphemeIndex:0,F=o[S];if(!c){if(T>0||x>n&&F!==null){let M=F,A=M[T];c=!0,u=A,m=S,f=T+1;for(let v=T+1;v<M.length;v++){let E=M[v];if(u+E>s)return t.segmentIndex=m,t.graphemeIndex=f,u;u+=E,m=S,f=v+1}m===S&&f===M.length&&(m=S+1,f=0)}else c=!0,u=x,m=S+1,f=0;R&&(p=S+1,b=u-x);continue}if(u+x>s)return R?(t.segmentIndex=S+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=S+1,f=0,R&&(p=S+1,b=u-x)}return c?(t.segmentIndex=m,t.graphemeIndex=f,u):null}function dy(e,t,n){let r=cf(e,t);return r<0?null:e.simpleLineWalkFastPath?cy(e,t,n):mf(e,t,r,n)}function pf(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=cf(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=uy(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 Ia=null;function fy(){return Ia===null&&(Ia=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Ia}function my(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 py(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=di(m),l=rr.has(m)}function c(m,f){r.push(m),o=o||f;let p=di(m);m.length===1&&bt.has(m)?a=a||p:a=p,l=!1}for(let m of fy().segment(e)){let f=m.segment,p=Ve(f);if(r.length===0){u(f,m.index,p);continue}if(l||ui.has(f)||bt.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 hy(e){if(e.length<=1)return e;let t=[],n=[e[0].text],r=e[0].start,i=Ve(e[0].text),o=li(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=Ve(s.text),c=li(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 gy(e,t,n,r){let i=yt(),{cache:o,emojiCorrection:a}=af(t,rf(e.normalized)),l=xt("-",at("-",o),a),u=xt(" ",at(" ",o),a)*8;if(e.len===0)return my(n);let c=[],m=[],f=[],p=[],b=e.chunks.length<=1,S=n?[]:null,x=[],_=n?[]:null,R=Array.from({length:e.len});function T(v,E,w,L,D,H,z){D!=="text"&&D!=="space"&&D!=="zero-width-break"&&(b=!1),c.push(E),m.push(w),f.push(L),p.push(D),S?.push(H),x.push(z),_!==null&&_.push(v)}function F(v,E,w,L,D){let H=at(v,o),z=xt(v,H,a),j=E==="space"||E==="preserved-space"||E==="zero-width-break"?0:z,k=E==="space"||E==="zero-width-break"?0:z;if(D&&L&&v.length>1){let B="sum-graphemes";nr(v)?B="pair-context":i.preferPrefixWidthsForBreakableRuns&&(B="segment-prefixes");let ee=of(v,H,o,a,B);T(v,z,j,k,E,w,ee);return}T(v,z,j,k,E,w,null)}for(let v=0;v<e.len;v++){R[v]=c.length;let E=e.texts[v],w=e.isWordLike[v],L=e.kinds[v],D=e.starts[v];if(L==="soft-hyphen"){T(E,0,l,l,L,D,null);continue}if(L==="hard-break"){T(E,0,0,0,L,D,null);continue}if(L==="tab"){T(E,0,0,0,L,D,null);continue}let H=at(E,o);if(L==="text"&&H.containsCJK){let z=py(E,i),j=r==="keep-all"?hy(z):z;for(let k=0;k<j.length;k++){let B=j[k];F(B.text,"text",D+B.start,w,r==="keep-all"||!Ve(B.text))}continue}F(E,L,D,w,!0)}let M=by(e.chunks,R,c.length),A=S===null?null:Wd(e.normalized,S);return _!==null?{widths:c,lineEndFitAdvances:m,lineEndPaintAdvances:f,kinds:p,simpleLineWalkFastPath:b,segLevels:A,breakableFitAdvances:x,discretionaryHyphenWidth:l,tabStopAdvance:u,chunks:M,segments:_}:{widths:c,lineEndFitAdvances:m,lineEndPaintAdvances:f,kinds:p,simpleLineWalkFastPath:b,segLevels:A,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 hf(e,t,n,r){let i=r?.wordBreak??"normal",o=Zd(e,yt(),r?.whiteSpace,i);return gy(o,t,n,i)}function fi(e,t,n){return hf(e,t,!1,n)}function gf(e,t,n){return hf(e,t,!0,n)}function mi(e,t,n){let r=df(e,t);return{lineCount:r,height:r*n}}function xy(e){return{width:e.width,start:{segmentIndex:e.startSegmentIndex,graphemeIndex:e.startGraphemeIndex},end:{segmentIndex:e.endSegmentIndex,graphemeIndex:e.endGraphemeIndex}}}function yy(e,t,n){return e.widths.length===0?0:Da(e,t,r=>{n(xy(r))})}function bf(e,t){return pf(e,t)}function xf(e){let t=0;return yy(e,Number.POSITIVE_INFINITY,n=>{n.width>t&&(t=n.width)}),t}var Sy={maxWidth:1600,baseFontSize:78,minFontSize:42,fontWeight:900,fontFamily:"Outfit",step:2};function yf(e,t){let n={...Sy,...t},r=1.2;for(let i=n.baseFontSize;i>=n.minFontSize;i-=n.step){let o=`${n.fontWeight} ${i}px ${n.fontFamily}`,a=fi(e,o),{lineCount:l}=mi(a,n.maxWidth,i*r);if(l<=1)return{fontSize:i,fits:!0}}return{fontSize:n.minFontSize,fits:!1}}var Sf={prepare:fi,layout:mi,prepareWithSegments:gf,measureLineStats:bf,measureNaturalWidth:xf};window.__timelines=window.__timelines||{};$c();window.__hyperframes={fitTextFontSize:yf,getVariables:os,pretext:Sf};function vf(){let e=window;e.__hyperframeRuntimeBootstrapped||(e.__hyperframeRuntimeBootstrapped=!0,Bd())}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",vf,{once:!0}):vf();})();\n';
58606
58662
  }
58607
58663
  });
58608
58664
 
@@ -61985,14 +62041,6 @@ var init_getVariables = __esm({
61985
62041
  }
61986
62042
  });
61987
62043
 
61988
- // ../core/dist/runtime/startExpression.js
61989
- var init_startExpression = __esm({
61990
- "../core/dist/runtime/startExpression.js"() {
61991
- "use strict";
61992
- init_compositionContract();
61993
- }
61994
- });
61995
-
61996
62044
  // ../core/dist/runtime/globals.js
61997
62045
  function getDebugSurface() {
61998
62046
  return globalThis;
@@ -62052,6 +62100,7 @@ function normaliseEnvelope(keyframes, trackStart, baseVolume) {
62052
62100
  var init_mediaVolumeEnvelope = __esm({
62053
62101
  "../core/dist/runtime/mediaVolumeEnvelope.js"() {
62054
62102
  "use strict";
62103
+ init_playbackRate();
62055
62104
  }
62056
62105
  });
62057
62106
 
@@ -63066,22 +63115,7 @@ var init_audioAutomationVolume = __esm({
63066
63115
  }
63067
63116
  });
63068
63117
 
63069
- // ../core/dist/runtime/playbackRate.js
63070
- function normalizePlaybackRate(raw) {
63071
- return Number.isFinite(raw) && raw > 0 ? Math.max(0.1, Math.min(5, raw)) : 1;
63072
- }
63073
- var init_playbackRate = __esm({
63074
- "../core/dist/runtime/playbackRate.js"() {
63075
- "use strict";
63076
- }
63077
- });
63078
-
63079
63118
  // ../core/dist/runtime/media.js
63080
- function readElementPlaybackRate(el) {
63081
- const authored = Number.parseFloat(el.getAttribute("data-playback-rate") ?? "");
63082
- const raw = Number.isFinite(authored) && authored > 0 ? authored : el instanceof HTMLMediaElement ? el.defaultPlaybackRate : 1;
63083
- return normalizePlaybackRate(raw);
63084
- }
63085
63119
  var init_media = __esm({
63086
63120
  "../core/dist/runtime/media.js"() {
63087
63121
  "use strict";
@@ -63089,6 +63123,7 @@ var init_media = __esm({
63089
63123
  init_mediaVolumeEnvelope();
63090
63124
  init_audioAutomationVolume();
63091
63125
  init_playbackRate();
63126
+ init_playbackRate();
63092
63127
  }
63093
63128
  });
63094
63129
 
@@ -63144,7 +63179,7 @@ function createRuntimeStartTimeResolver(params) {
63144
63179
  }
63145
63180
  }
63146
63181
  if ((resolved2 == null || resolved2 <= 0) && isMediaElement2(element)) {
63147
- const playbackStart = parseNumeric2(element.getAttribute("data-playback-start")) ?? parseNumeric2(element.getAttribute("data-media-start")) ?? 0;
63182
+ const playbackStart = readMediaStart(element);
63148
63183
  if (Number.isFinite(element.duration) && element.duration > playbackStart) {
63149
63184
  resolved2 = (element.duration - playbackStart) / readElementPlaybackRate(element);
63150
63185
  }
@@ -63243,6 +63278,7 @@ var init_startResolver = __esm({
63243
63278
  "use strict";
63244
63279
  init_diagnostics();
63245
63280
  init_media();
63281
+ init_playbackRate();
63246
63282
  init_startExpression();
63247
63283
  AUTHORED_DURATION_ATTR = "data-hf-authored-duration";
63248
63284
  AUTHORED_END_ATTR = "data-hf-authored-end";
@@ -63654,6 +63690,7 @@ __export(dist_exports, {
63654
63690
  loadHyperframeRuntimeSource: () => loadHyperframeRuntimeSource,
63655
63691
  normalizeHfColorGrading: () => normalizeHfColorGrading,
63656
63692
  normalizeHfColorGradingWithVariables: () => normalizeHfColorGradingWithVariables,
63693
+ normalizePlaybackRate: () => normalizePlaybackRate,
63657
63694
  normalizeResolutionFlag: () => normalizeResolutionFlag,
63658
63695
  overdueCanaries: () => overdueCanaries,
63659
63696
  parseAnimatedGifMetadata: () => parseAnimatedGifMetadata,
@@ -63665,13 +63702,18 @@ __export(dist_exports, {
63665
63702
  parseNumeric: () => parseNumeric2,
63666
63703
  parseSlideshowManifest: () => parseSlideshowManifest,
63667
63704
  parseStartExpression: () => parseStartExpression2,
63705
+ parseStrictFiniteTimingNumber: () => parseStrictFiniteTimingNumber,
63668
63706
  quantizeTimeToFrame: () => quantizeTimeToFrame,
63669
63707
  queryByAttr: () => queryByAttr2,
63670
63708
  readClipTiming: () => readClipTiming2,
63709
+ readElementPlaybackRate: () => readElementPlaybackRate,
63710
+ readMediaStart: () => readMediaStart,
63671
63711
  redactKnownPaths: () => redactKnownPaths,
63672
63712
  redactTelemetryString: () => redactTelemetryString,
63673
63713
  removeElementFromHtml: () => removeElementFromHtml,
63674
63714
  resolveHfColorGradingVariables: () => resolveHfColorGradingVariables,
63715
+ resolveNaturalMediaTimelineDuration: () => resolveNaturalMediaTimelineDuration,
63716
+ resolveNaturalMediaTimelineDurationFromValues: () => resolveNaturalMediaTimelineDurationFromValues,
63675
63717
  resolveResolutionFlagPair: () => resolveResolutionFlagPair,
63676
63718
  resolveSlideshow: () => resolveSlideshow,
63677
63719
  resolveTimings: () => resolveTimings,
@@ -63728,6 +63770,7 @@ var init_dist3 = __esm({
63728
63770
  init_startExpression();
63729
63771
  init_compositionContract2();
63730
63772
  init_startResolver();
63773
+ init_playbackRate();
63731
63774
  init_validateVariables();
63732
63775
  init_registry();
63733
63776
  init_canary();
@@ -72010,6 +72053,20 @@ var init_referenceResolver = __esm({
72010
72053
  }
72011
72054
  });
72012
72055
 
72056
+ // ../engine/src/services/mediaTimelineWindow.ts
72057
+ function isKnownInactiveTimelineWindow(element, resolvedStart) {
72058
+ const duration = parseStrictFiniteTimingNumber(element.getAttribute("data-duration"));
72059
+ if (duration != null && duration <= 0) return true;
72060
+ const end = parseStrictFiniteTimingNumber(element.getAttribute("data-end"));
72061
+ return end != null && end <= resolvedStart;
72062
+ }
72063
+ var init_mediaTimelineWindow = __esm({
72064
+ "../engine/src/services/mediaTimelineWindow.ts"() {
72065
+ "use strict";
72066
+ init_dist3();
72067
+ }
72068
+ });
72069
+
72013
72070
  // ../engine/src/utils/urlDownloader.ts
72014
72071
  import {
72015
72072
  closeSync,
@@ -86748,14 +86805,17 @@ function parseVideoElements(html) {
86748
86805
  const startAttr = el.getAttribute("data-start");
86749
86806
  const endAttr = el.getAttribute("data-end");
86750
86807
  const durationAttr = el.getAttribute("data-duration");
86751
- const mediaStartAttr = el.getAttribute("data-media-start");
86808
+ const playbackRateAttr = el.getAttribute("data-playback-rate");
86752
86809
  const hasAudioAttr = el.getAttribute("data-has-audio");
86753
86810
  const start = startAttr ? resolveReferencedStart(document2, el, startCache, visiting) : 0;
86811
+ if (isKnownInactiveTimelineWindow(el, start)) continue;
86754
86812
  let end = 0;
86755
- if (endAttr) {
86756
- end = parseFloat(endAttr);
86757
- } else if (durationAttr) {
86758
- end = start + parseFloat(durationAttr);
86813
+ const authoredEnd = parseStrictFiniteTimingNumber(endAttr);
86814
+ const authoredDuration = parseStrictFiniteTimingNumber(durationAttr);
86815
+ if (authoredEnd != null) {
86816
+ end = authoredEnd;
86817
+ } else if (authoredDuration != null) {
86818
+ end = start + authoredDuration;
86759
86819
  } else {
86760
86820
  end = Infinity;
86761
86821
  }
@@ -86764,7 +86824,10 @@ function parseVideoElements(html) {
86764
86824
  src,
86765
86825
  start,
86766
86826
  end,
86767
- mediaStart: mediaStartAttr ? parseFloat(mediaStartAttr) : 0,
86827
+ mediaStart: readMediaStart(el),
86828
+ playbackRate: normalizePlaybackRate(
86829
+ playbackRateAttr ? parseFloat(playbackRateAttr) : Number.NaN
86830
+ ),
86768
86831
  loop: el.hasAttribute("loop"),
86769
86832
  hasAudio: hasAudioAttr === "true"
86770
86833
  });
@@ -86790,10 +86853,12 @@ function parseImageElements(html) {
86790
86853
  const durationAttr = el.getAttribute("data-duration");
86791
86854
  const start = startAttr ? resolveReferencedStart(document2, el, startCache, visiting) : 0;
86792
86855
  let end = 0;
86793
- if (endAttr) {
86794
- end = parseFloat(endAttr);
86795
- } else if (durationAttr) {
86796
- end = start + parseFloat(durationAttr);
86856
+ const authoredEnd = parseStrictFiniteTimingNumber(endAttr);
86857
+ const authoredDuration = parseStrictFiniteTimingNumber(durationAttr);
86858
+ if (authoredEnd != null) {
86859
+ end = authoredEnd;
86860
+ } else if (authoredDuration != null) {
86861
+ end = start + authoredDuration;
86797
86862
  } else {
86798
86863
  end = Infinity;
86799
86864
  }
@@ -86948,64 +87013,83 @@ function resolvePlayableVideoDuration(metadata) {
86948
87013
  return Number.isFinite(metadata.videoStreamDurationSeconds) && metadata.videoStreamDurationSeconds > 0 ? metadata.videoStreamDurationSeconds : metadata.durationSeconds;
86949
87014
  }
86950
87015
  function resolveTimelineExtractionWindow(video, resolvedDuration, timelineEnd, sourceDuration) {
87016
+ const playbackRate = normalizePlaybackRate(video.playbackRate ?? 1);
87017
+ const withTimelineDuration = (window3, timelineDurationSeconds) => playbackRate === 1 ? window3 : { ...window3, timelineDurationSeconds };
86951
87018
  if (timelineEnd === void 0) {
86952
- return {
86953
- compositionStart: video.start,
86954
- mediaStart: video.mediaStart,
86955
- durationSeconds: resolvedDuration
86956
- };
87019
+ return withTimelineDuration(
87020
+ {
87021
+ compositionStart: video.start,
87022
+ mediaStart: video.mediaStart,
87023
+ durationSeconds: resolvedDuration * playbackRate
87024
+ },
87025
+ resolvedDuration
87026
+ );
86957
87027
  }
86958
87028
  if (!Number.isFinite(timelineEnd)) {
86959
87029
  throw new Error(`Video extraction timelineEnd must be finite; got ${String(timelineEnd)}`);
86960
87030
  }
86961
87031
  const compositionStart = Math.max(0, video.start);
86962
87032
  const trimmedPreroll = compositionStart - video.start;
87033
+ const trimmedSourcePreroll = trimmedPreroll * playbackRate;
86963
87034
  const timelineDuration2 = Math.max(0, timelineEnd - compositionStart);
86964
87035
  const resolvedVisibleDuration = resolvedDuration - trimmedPreroll;
86965
87036
  const visibleDuration = Math.max(0, Math.min(resolvedVisibleDuration, timelineDuration2));
86966
- let mediaStart = video.mediaStart + trimmedPreroll;
87037
+ const visibleSourceDuration = visibleDuration * playbackRate;
87038
+ let mediaStart = video.mediaStart + trimmedSourcePreroll;
86967
87039
  if (visibleDuration > 0 && sourceDuration !== void 0) {
86968
87040
  const sourceRemaining = Math.max(0, sourceDuration - video.mediaStart);
86969
87041
  if (sourceRemaining > 0 && video.loop && Number.isFinite(video.end)) {
86970
- const phaseOffset = trimmedPreroll % sourceRemaining;
87042
+ const phaseOffset = trimmedSourcePreroll % sourceRemaining;
86971
87043
  const phaseRemaining = sourceRemaining - phaseOffset;
86972
- if (visibleDuration >= phaseRemaining) {
86973
- return {
86974
- compositionStart: video.start,
86975
- mediaStart: video.mediaStart,
86976
- durationSeconds: sourceRemaining,
86977
- preserveTimelinePhase: true
86978
- };
87044
+ if (visibleSourceDuration >= phaseRemaining) {
87045
+ return withTimelineDuration(
87046
+ {
87047
+ compositionStart: video.start,
87048
+ mediaStart: video.mediaStart,
87049
+ durationSeconds: sourceRemaining,
87050
+ preserveTimelinePhase: true
87051
+ },
87052
+ visibleDuration
87053
+ );
86979
87054
  }
86980
87055
  mediaStart = video.mediaStart + phaseOffset;
86981
87056
  } else if (sourceRemaining > 0) {
86982
- const sourceVisibleAfterPreroll = Math.max(0, sourceRemaining - trimmedPreroll);
86983
- if (visibleDuration <= sourceVisibleAfterPreroll) {
86984
- return {
86985
- compositionStart,
86986
- mediaStart,
86987
- durationSeconds: visibleDuration
86988
- };
87057
+ const sourceVisibleAfterPreroll = Math.max(0, sourceRemaining - trimmedSourcePreroll);
87058
+ if (visibleSourceDuration <= sourceVisibleAfterPreroll) {
87059
+ return withTimelineDuration(
87060
+ {
87061
+ compositionStart,
87062
+ mediaStart,
87063
+ durationSeconds: visibleSourceDuration
87064
+ },
87065
+ visibleDuration
87066
+ );
86989
87067
  }
86990
87068
  const extractionDuration = Math.min(
86991
87069
  sourceRemaining,
86992
87070
  Math.max(sourceVisibleAfterPreroll, FINAL_FRAME_LOGICAL_DURATION_SECONDS)
86993
87071
  );
86994
87072
  const extractionOffset = sourceRemaining - extractionDuration;
86995
- return {
86996
- compositionStart: video.start + extractionOffset,
86997
- mediaStart: video.mediaStart + extractionOffset,
86998
- durationSeconds: extractionDuration,
86999
- preserveTimelineEnd: true,
87000
- ensureFinalFrame: true
87001
- };
87073
+ return withTimelineDuration(
87074
+ {
87075
+ compositionStart: video.start + extractionOffset / playbackRate,
87076
+ mediaStart: video.mediaStart + extractionOffset,
87077
+ durationSeconds: extractionDuration,
87078
+ preserveTimelineEnd: true,
87079
+ ensureFinalFrame: true
87080
+ },
87081
+ visibleDuration
87082
+ );
87002
87083
  }
87003
87084
  }
87004
- return {
87005
- compositionStart,
87006
- mediaStart,
87007
- durationSeconds: visibleDuration
87008
- };
87085
+ return withTimelineDuration(
87086
+ {
87087
+ compositionStart,
87088
+ mediaStart,
87089
+ durationSeconds: visibleSourceDuration
87090
+ },
87091
+ visibleDuration
87092
+ );
87009
87093
  }
87010
87094
  async function resolveFinalFrameExtractionWindow(videoPath, video, metadata, window3, signal) {
87011
87095
  if (!window3.ensureFinalFrame) return window3;
@@ -87026,6 +87110,7 @@ async function resolveFinalFrameExtractionWindow(videoPath, video, metadata, win
87026
87110
  mediaStart: playableDuration - logicalDuration,
87027
87111
  extractionMediaStart: finalFrameTimestamp,
87028
87112
  durationSeconds: logicalDuration,
87113
+ ...window3.timelineDurationSeconds !== void 0 ? { timelineDurationSeconds: window3.timelineDurationSeconds } : {},
87029
87114
  preserveTimelineEnd: true,
87030
87115
  finalFrameOnly: true
87031
87116
  };
@@ -87048,11 +87133,9 @@ function resolveVideoExtractionWindow(video, metadata, timelineEnd) {
87048
87133
  `Video media start ${video.mediaStart}s is outside playable video duration ${playableDuration}s`
87049
87134
  );
87050
87135
  }
87051
- const resolvedDuration = resolveSegmentDuration(
87052
- video.end - video.start,
87053
- video.mediaStart,
87054
- playableDuration
87055
- );
87136
+ const playbackRate = normalizePlaybackRate(video.playbackRate ?? 1);
87137
+ const requestedTimelineDuration = video.end - video.start;
87138
+ const resolvedDuration = Number.isFinite(requestedTimelineDuration) && requestedTimelineDuration > 0 ? requestedTimelineDuration : resolveSegmentDuration(requestedTimelineDuration, video.mediaStart, playableDuration) / playbackRate;
87056
87139
  return resolveTimelineExtractionWindow(video, resolvedDuration, timelineEnd, playableDuration);
87057
87140
  }
87058
87141
  function resolveVideoExtractionDuration(video, metadata, timelineEnd) {
@@ -87629,7 +87712,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
87629
87712
  if (!window3.preserveTimelinePhase) {
87630
87713
  video.start = window3.compositionStart;
87631
87714
  if (!window3.preserveTimelineEnd) {
87632
- video.end = window3.compositionStart + videoDuration;
87715
+ video.end = window3.compositionStart + (window3.timelineDurationSeconds ?? videoDuration);
87633
87716
  }
87634
87717
  video.mediaStart = window3.mediaStart;
87635
87718
  }
@@ -87745,14 +87828,15 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
87745
87828
  phaseBreakdown: breakdown
87746
87829
  };
87747
87830
  }
87748
- function getFrameIndexAtTime(extracted, globalTime, videoStart, loop = false, mediaStart = 0, holdLastFrame = false) {
87831
+ function getFrameIndexAtTime(extracted, globalTime, videoStart, loop = false, mediaStart = 0, holdLastFrame = false, playbackRate = 1) {
87749
87832
  let localTime = globalTime - videoStart;
87750
87833
  if (localTime < 0) return null;
87751
- const loopDuration = Math.max(0, resolvePlayableVideoDuration(extracted.metadata) - mediaStart);
87834
+ const normalizedPlaybackRate = normalizePlaybackRate(playbackRate);
87835
+ const loopDuration = Math.max(0, resolvePlayableVideoDuration(extracted.metadata) - mediaStart) / normalizedPlaybackRate;
87752
87836
  if (loop && loopDuration > 0 && localTime >= loopDuration) {
87753
87837
  localTime %= loopDuration;
87754
87838
  }
87755
- const frameIndex = Math.floor(localTime * extracted.fps + 1e-9);
87839
+ const frameIndex = Math.floor(localTime * normalizedPlaybackRate * extracted.fps + 1e-9);
87756
87840
  if (frameIndex < 0 || extracted.totalFrames <= 0) return null;
87757
87841
  if (frameIndex >= extracted.totalFrames) {
87758
87842
  return loop || holdLastFrame ? extracted.totalFrames - 1 : null;
@@ -87778,7 +87862,9 @@ function createFrameLookupTable(videos, extracted) {
87778
87862
  for (const ext of extracted) extractedMap.set(ext.videoId, ext);
87779
87863
  for (const video of videos) {
87780
87864
  const ext = extractedMap.get(video.id);
87781
- if (ext) table.addVideo(ext, video.start, video.end, video.mediaStart, video.loop);
87865
+ if (ext) {
87866
+ table.addVideo(ext, video.start, video.end, video.mediaStart, video.loop, video.playbackRate);
87867
+ }
87782
87868
  }
87783
87869
  return table;
87784
87870
  }
@@ -87789,6 +87875,7 @@ var init_videoFrameExtractor = __esm({
87789
87875
  init_esm10();
87790
87876
  init_dist3();
87791
87877
  init_referenceResolver();
87878
+ init_mediaTimelineWindow();
87792
87879
  init_ffprobe();
87793
87880
  init_hdr();
87794
87881
  init_urlDownloader();
@@ -87822,8 +87909,15 @@ var init_videoFrameExtractor = __esm({
87822
87909
  activeVideoIds = /* @__PURE__ */ new Set();
87823
87910
  startCursor = 0;
87824
87911
  lastTime = null;
87825
- addVideo(extracted, start, end, mediaStart, loop = false) {
87826
- this.videos.set(extracted.videoId, { extracted, start, end, mediaStart, loop });
87912
+ addVideo(extracted, start, end, mediaStart, loop = false, playbackRate = 1) {
87913
+ this.videos.set(extracted.videoId, {
87914
+ extracted,
87915
+ start,
87916
+ end,
87917
+ mediaStart,
87918
+ loop,
87919
+ playbackRate: normalizePlaybackRate(playbackRate)
87920
+ });
87827
87921
  this.orderedVideos = Array.from(this.videos.entries()).map(([videoId, video]) => ({ videoId, ...video })).sort((a, b2) => a.start - b2.start);
87828
87922
  this.resetActiveState();
87829
87923
  }
@@ -87837,7 +87931,8 @@ var init_videoFrameExtractor = __esm({
87837
87931
  video.start,
87838
87932
  video.loop,
87839
87933
  video.mediaStart,
87840
- true
87934
+ true,
87935
+ video.playbackRate
87841
87936
  );
87842
87937
  return frameIndex == null ? null : video.extracted.framePaths.get(frameIndex) || null;
87843
87938
  }
@@ -87894,7 +87989,8 @@ var init_videoFrameExtractor = __esm({
87894
87989
  video.start,
87895
87990
  video.loop,
87896
87991
  video.mediaStart,
87897
- true
87992
+ true,
87993
+ video.playbackRate
87898
87994
  );
87899
87995
  if (frameIndex == null) continue;
87900
87996
  const framePath = video.extracted.framePaths.get(frameIndex);
@@ -88845,6 +88941,36 @@ function clampVolume(volume) {
88845
88941
  function formatFilterNumber(value) {
88846
88942
  return Number(value.toFixed(6)).toString();
88847
88943
  }
88944
+ function buildAtempoFilter(playbackRate) {
88945
+ let remaining = normalizePlaybackRate(playbackRate);
88946
+ if (Math.abs(remaining - 1) < 1e-9) return null;
88947
+ const stages = [];
88948
+ while (remaining < 0.5 - 1e-9) {
88949
+ stages.push(0.5);
88950
+ remaining /= 0.5;
88951
+ }
88952
+ while (remaining > 2 + 1e-9) {
88953
+ stages.push(2);
88954
+ remaining /= 2;
88955
+ }
88956
+ if (Math.abs(remaining - 1) >= 1e-9) stages.push(remaining);
88957
+ return stages.map((stage) => `atempo=${formatFilterNumber(stage)}`).join(",");
88958
+ }
88959
+ function preparedAudioOutputArgs(srcPath, playbackRate) {
88960
+ return stereoOutputArgs(srcPath).then((channelArgs) => {
88961
+ const filters2 = [];
88962
+ const outputArgs = [];
88963
+ if (channelArgs[0] === "-af" && channelArgs[1]) {
88964
+ filters2.push(channelArgs[1]);
88965
+ } else {
88966
+ outputArgs.push(...channelArgs);
88967
+ }
88968
+ const atempo = buildAtempoFilter(playbackRate);
88969
+ if (atempo) filters2.push(atempo);
88970
+ if (filters2.length > 0) outputArgs.push("-af", filters2.join(","));
88971
+ return outputArgs;
88972
+ });
88973
+ }
88848
88974
  function escapeExpressionCommas(expression) {
88849
88975
  return expression.replace(/\\/g, "\\\\").replace(/,/g, "\\,");
88850
88976
  }
@@ -89037,8 +89163,7 @@ function parseAudioElements(html) {
89037
89163
  const visiting = /* @__PURE__ */ new Set();
89038
89164
  const resolveStart4 = (el) => el.getAttribute("data-start") ? resolveReferencedStart(document2, el, startCache, visiting) : 0;
89039
89165
  const parseEnd = (raw) => {
89040
- const end = raw ? parseFloat(raw) : 0;
89041
- return Number.isFinite(end) ? end : 0;
89166
+ return parseStrictFiniteTimingNumber(raw) ?? 0;
89042
89167
  };
89043
89168
  const isHidden = (el) => {
89044
89169
  for (let current2 = el; current2; current2 = current2.parentElement) {
@@ -89047,7 +89172,7 @@ function parseAudioElements(html) {
89047
89172
  return false;
89048
89173
  };
89049
89174
  const build = (el, id, type) => {
89050
- const mediaStartAttr = el.getAttribute("data-media-start");
89175
+ const playbackRateAttr = el.getAttribute("data-playback-rate");
89051
89176
  const layerAttr = el.getAttribute("data-layer");
89052
89177
  const volumeAttr = el.getAttribute("data-volume");
89053
89178
  const fxChain = el.getAttribute(HF_AUDIO_FX_ATTR);
@@ -89057,7 +89182,10 @@ function parseAudioElements(html) {
89057
89182
  src: el.getAttribute("src"),
89058
89183
  start: resolveStart4(el),
89059
89184
  end: parseEnd(el.getAttribute("data-end")),
89060
- mediaStart: mediaStartAttr ? parseFloat(mediaStartAttr) : 0,
89185
+ mediaStart: readMediaStart(el),
89186
+ playbackRate: normalizePlaybackRate(
89187
+ playbackRateAttr ? parseFloat(playbackRateAttr) : Number.NaN
89188
+ ),
89061
89189
  layer: layerAttr ? parseInt(layerAttr) : 0,
89062
89190
  volume: volumeAttr ? parseFloat(volumeAttr) : 1,
89063
89191
  ...fxChain ? { fxChain } : {},
@@ -89068,11 +89196,13 @@ function parseAudioElements(html) {
89068
89196
  for (const el of document2.querySelectorAll("audio[id][src]")) {
89069
89197
  const id = el.getAttribute("id");
89070
89198
  if (!id || !el.getAttribute("src") || isHidden(el)) continue;
89199
+ if (isKnownInactiveTimelineWindow(el, resolveStart4(el))) continue;
89071
89200
  elements.push(build(el, id, "audio"));
89072
89201
  }
89073
89202
  for (const el of document2.querySelectorAll('video[id][src][data-has-audio="true"]')) {
89074
89203
  const id = el.getAttribute("id");
89075
89204
  if (!id || !el.getAttribute("src") || isHidden(el)) continue;
89205
+ if (isKnownInactiveTimelineWindow(el, resolveStart4(el))) continue;
89076
89206
  elements.push(build(el, `${id}-audio`, "video"));
89077
89207
  }
89078
89208
  return elements;
@@ -89081,11 +89211,17 @@ async function extractAudioFromVideo(videoPath, outputPath, options, signal, con
89081
89211
  const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG2.ffmpegProcessTimeout;
89082
89212
  const outputDir = dirname9(outputPath);
89083
89213
  if (!existsSync16(outputDir)) mkdirSync8(outputDir, { recursive: true });
89084
- const args = ["-i", videoPath];
89214
+ const playbackRate = normalizePlaybackRate(options?.playbackRate ?? 1);
89215
+ const args = [];
89085
89216
  if (options?.startTime !== void 0) args.push("-ss", String(options.startTime));
89086
- if (options?.duration !== void 0) args.push("-t", String(options.duration));
89087
- const channelArgs = await stereoOutputArgs(videoPath);
89088
- args.push("-vn", "-acodec", "pcm_s16le", "-ar", "48000", ...channelArgs, "-y", outputPath);
89217
+ if (options?.duration !== void 0) args.push("-t", String(options.duration * playbackRate));
89218
+ args.push("-i", videoPath);
89219
+ const outputArgs = await preparedAudioOutputArgs(videoPath, playbackRate);
89220
+ args.push("-vn", "-acodec", "pcm_s16le", "-ar", "48000", ...outputArgs);
89221
+ if (playbackRate !== 1 && options?.duration !== void 0) {
89222
+ args.push("-t", String(options.duration));
89223
+ }
89224
+ args.push("-y", outputPath);
89089
89225
  const result = await runFfmpeg(args, { signal, timeout: ffmpegProcessTimeout });
89090
89226
  if (signal?.aborted) {
89091
89227
  const failure = {
@@ -89115,26 +89251,27 @@ async function extractAudioFromVideo(videoPath, outputPath, options, signal, con
89115
89251
  }
89116
89252
  return { success: true, outputPath, durationMs: result.durationMs };
89117
89253
  }
89118
- async function prepareAudioTrack(srcPath, outputPath, mediaStart, duration, signal, config) {
89254
+ async function prepareAudioTrack(srcPath, outputPath, mediaStart, duration, playbackRate = 1, signal, config) {
89119
89255
  const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG2.ffmpegProcessTimeout;
89120
89256
  const outputDir = dirname9(outputPath);
89121
89257
  if (!existsSync16(outputDir)) mkdirSync8(outputDir, { recursive: true });
89122
- const channelArgs = await stereoOutputArgs(srcPath);
89258
+ const normalizedPlaybackRate = normalizePlaybackRate(playbackRate);
89259
+ const outputArgs = await preparedAudioOutputArgs(srcPath, normalizedPlaybackRate);
89123
89260
  const args = [
89124
89261
  "-ss",
89125
89262
  String(mediaStart),
89126
89263
  "-t",
89127
- String(duration),
89264
+ String(duration * normalizedPlaybackRate),
89128
89265
  "-i",
89129
89266
  srcPath,
89130
89267
  "-acodec",
89131
89268
  "pcm_s16le",
89132
89269
  "-ar",
89133
89270
  "48000",
89134
- ...channelArgs,
89135
- "-y",
89136
- outputPath
89271
+ ...outputArgs
89137
89272
  ];
89273
+ if (normalizedPlaybackRate !== 1) args.push("-t", String(duration));
89274
+ args.push("-y", outputPath);
89138
89275
  const result = await runFfmpeg(args, { signal, timeout: ffmpegProcessTimeout });
89139
89276
  if (signal?.aborted) {
89140
89277
  const failure2 = {
@@ -89400,7 +89537,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
89400
89537
  );
89401
89538
  return;
89402
89539
  }
89403
- const effectiveDuration = metadata.durationSeconds - element.mediaStart;
89540
+ const effectiveDuration = (metadata.durationSeconds - element.mediaStart) / normalizePlaybackRate(element.playbackRate ?? 1);
89404
89541
  element.end = element.start + (effectiveDuration > 0 ? effectiveDuration : metadata.durationSeconds);
89405
89542
  }
89406
89543
  let audioSrcPath = srcPath;
@@ -89411,7 +89548,8 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
89411
89548
  extractedPath,
89412
89549
  {
89413
89550
  startTime: element.mediaStart,
89414
- duration: element.end - element.start
89551
+ duration: element.end - element.start,
89552
+ playbackRate: element.playbackRate
89415
89553
  },
89416
89554
  effectiveSignal,
89417
89555
  config
@@ -89437,6 +89575,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
89437
89575
  trimmedPath,
89438
89576
  element.mediaStart,
89439
89577
  element.end - element.start,
89578
+ element.playbackRate,
89440
89579
  effectiveSignal,
89441
89580
  config
89442
89581
  );
@@ -89567,10 +89706,12 @@ var init_audioMixer = __esm({
89567
89706
  init_htmlTemplate();
89568
89707
  init_videoFrameExtractor();
89569
89708
  init_referenceResolver();
89709
+ init_mediaTimelineWindow();
89570
89710
  init_audioVolumeEnvelope();
89571
89711
  init_audioFx();
89572
89712
  init_audioAutomation();
89573
89713
  init_audioFxTail();
89714
+ init_dist3();
89574
89715
  init_audioFxRender();
89575
89716
  MIXED_AUDIO_FILENAME = "audio.m4a";
89576
89717
  MAX_VOLUME_SEGMENTS = 32;
@@ -121847,7 +121988,7 @@ function detectShaderTransitionUsage(html) {
121847
121988
  }
121848
121989
  return false;
121849
121990
  }
121850
- async function resolveMediaDuration(src, mediaStart, baseDir, downloadDir, tagName19, elementIdentity, log2) {
121991
+ async function resolveMediaDuration(src, mediaStart, playbackRate, baseDir, downloadDir, tagName19, elementIdentity, log2) {
121851
121992
  let filePath = src;
121852
121993
  if (isHttpUrl(src)) {
121853
121994
  if (!existsSync50(downloadDir)) mkdirSync23(downloadDir, { recursive: true });
@@ -121856,13 +121997,13 @@ async function resolveMediaDuration(src, mediaStart, baseDir, downloadDir, tagNa
121856
121997
  onTelemetry: logRemoteDownloadTelemetry
121857
121998
  });
121858
121999
  } catch {
121859
- return { duration: 0, resolvedPath: src };
122000
+ return { duration: null, resolvedPath: src };
121860
122001
  }
121861
122002
  } else if (!filePath.startsWith("/")) {
121862
122003
  filePath = join45(baseDir, filePath);
121863
122004
  }
121864
122005
  if (!existsSync50(filePath)) {
121865
- return { duration: 0, resolvedPath: filePath };
122006
+ return { duration: null, resolvedPath: filePath };
121866
122007
  }
121867
122008
  return withMediaProbeSlot(async () => {
121868
122009
  let profile;
@@ -121876,7 +122017,7 @@ async function resolveMediaDuration(src, mediaStart, baseDir, downloadDir, tagNa
121876
122017
  `[compile] Audio "${elementIdentity}" (${src}) is a text document, not a media file \u2014 the element is dropped from the render. Point it at a rendered media file.`
121877
122018
  );
121878
122019
  }
121879
- return { duration: 0, resolvedPath: filePath };
122020
+ return { duration: null, resolvedPath: filePath };
121880
122021
  }
121881
122022
  throw error;
121882
122023
  }
@@ -121888,12 +122029,15 @@ async function resolveMediaDuration(src, mediaStart, baseDir, downloadDir, tagNa
121888
122029
  try {
121889
122030
  metadata = await extractAudioMetadata(filePath);
121890
122031
  } catch {
121891
- return { duration: 0, resolvedPath: filePath };
122032
+ return { duration: null, resolvedPath: filePath };
121892
122033
  }
121893
122034
  }
121894
122035
  const fileDuration = metadata.durationSeconds;
121895
- const effectiveDuration = fileDuration - mediaStart;
121896
- const duration = effectiveDuration > 0 ? effectiveDuration : fileDuration;
122036
+ const duration = resolveNaturalMediaTimelineDurationFromValues(
122037
+ fileDuration,
122038
+ mediaStart,
122039
+ playbackRate
122040
+ );
121897
122041
  return { duration, resolvedPath: filePath };
121898
122042
  });
121899
122043
  }
@@ -121908,6 +122052,7 @@ async function compileHtmlFile(html, baseDir, downloadDir, log2) {
121908
122052
  (el) => resolveMediaDuration(
121909
122053
  el.src,
121910
122054
  el.mediaStart,
122055
+ el.playbackRate,
121911
122056
  baseDir,
121912
122057
  downloadDir,
121913
122058
  el.tagName,
@@ -121916,7 +122061,9 @@ async function compileHtmlFile(html, baseDir, downloadDir, log2) {
121916
122061
  ).then(({ duration }) => ({ id: el.id, duration }))
121917
122062
  )
121918
122063
  );
121919
- const resolutions = resolvedResults.filter((r2) => r2.duration > 0);
122064
+ const resolutions = resolvedResults.filter(
122065
+ (r2) => r2.duration != null && Number.isFinite(r2.duration)
122066
+ );
121920
122067
  let compiledHtml = resolutions.length > 0 ? injectDurations(staticCompiled, resolutions) : staticCompiled;
121921
122068
  const preResolved = extractResolvedMedia(compiledHtml);
121922
122069
  const clampResults = await Promise.all(
@@ -121924,6 +122071,7 @@ async function compileHtmlFile(html, baseDir, downloadDir, log2) {
121924
122071
  const { duration: maxDuration } = await resolveMediaDuration(
121925
122072
  el.src,
121926
122073
  el.mediaStart,
122074
+ el.playbackRate,
121927
122075
  baseDir,
121928
122076
  downloadDir,
121929
122077
  el.tagName,
@@ -121935,7 +122083,7 @@ async function compileHtmlFile(html, baseDir, downloadDir, log2) {
121935
122083
  );
121936
122084
  const clampList = [];
121937
122085
  for (const r2 of clampResults) {
121938
- if (r2.maxDuration > 0 && shouldClampResolvedMediaDuration(r2.tagName, r2.duration, r2.maxDuration)) {
122086
+ if (r2.maxDuration != null && shouldClampResolvedMediaDuration(r2.tagName, r2.duration, r2.maxDuration)) {
121939
122087
  clampList.push({ id: r2.id, duration: r2.maxDuration });
121940
122088
  log2?.warn(
121941
122089
  `[compile] Audio "${r2.id}" (${r2.src}) is ${r2.maxDuration.toFixed(2)}s but its data-duration is ${r2.duration.toFixed(2)}s \u2014 the slot is shortened to the media length. Set data-duration to ~${r2.maxDuration.toFixed(2)}s, trim data-media-start, or use a longer/looping source if that isn't intended.`
@@ -121962,8 +122110,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, parentOffset
121962
122110
  const srcPath = el.getAttribute("data-composition-src");
121963
122111
  if (!srcPath) continue;
121964
122112
  const elStart = parseFloat(el.getAttribute("data-start") || "0");
121965
- const elEndRaw = el.getAttribute("data-end");
121966
- const elEnd = elEndRaw ? parseFloat(elEndRaw) : Infinity;
122113
+ const elEnd = parseStrictFiniteTimingNumber(el.getAttribute("data-end")) ?? Infinity;
121967
122114
  const absoluteStart = parentOffset + elStart;
121968
122115
  const absoluteEnd = Math.min(parentEnd, isFinite(elEnd) ? parentOffset + elEnd : Infinity);
121969
122116
  const filePath = resolve31(projectDir, srcPath);
@@ -122811,9 +122958,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
122811
122958
  const rootEl = document2.querySelector("[data-composition-id]");
122812
122959
  const width = rootEl ? parseInt(rootEl.getAttribute("data-width") || "1080", 10) : 1080;
122813
122960
  const height = rootEl ? parseInt(rootEl.getAttribute("data-height") || "1920", 10) : 1920;
122814
- const staticDuration = rootEl ? parseFloat(
122815
- rootEl.getAttribute("data-duration") || rootEl.getAttribute("data-composition-duration") || "0"
122816
- ) : 0;
122961
+ const staticDuration = rootEl ? parseStrictFiniteTimingNumber(rootEl.getAttribute("data-duration")) ?? parseStrictFiniteTimingNumber(rootEl.getAttribute("data-composition-duration")) ?? 0 : 0;
122817
122962
  return {
122818
122963
  html,
122819
122964
  subCompositions,
@@ -122850,25 +122995,28 @@ async function discoverMediaFromBrowser(page) {
122850
122995
  mediaEls.forEach((el) => {
122851
122996
  const htmlEl = el;
122852
122997
  const isImage = htmlEl.tagName.toLowerCase() === "img";
122998
+ const tagName19 = isImage ? "image" : htmlEl.tagName.toLowerCase() === "video" ? "video" : "audio";
122853
122999
  const id = htmlEl.id || (isImage ? autoImageIds.get(htmlEl) : void 0);
122854
123000
  if (!id) return;
122855
123001
  const src = htmlEl.currentSrc || htmlEl.src || htmlEl.getAttribute("src") || "";
122856
123002
  const start = parseFloat(htmlEl.getAttribute("data-start") || "0");
122857
- const end = parseFloat(htmlEl.getAttribute("data-end") || "0");
122858
- const duration = parseFloat(htmlEl.getAttribute("data-duration") || "0");
122859
- const mediaStart = parseFloat(htmlEl.getAttribute("data-media-start") || "0");
123003
+ const endRaw = htmlEl.getAttribute("data-end");
123004
+ const durationRaw = htmlEl.getAttribute("data-duration");
123005
+ const playbackStartRaw = htmlEl.getAttribute("data-playback-start");
123006
+ const mediaStartRaw = htmlEl.getAttribute("data-media-start");
122860
123007
  const loop = htmlEl.hasAttribute("loop");
122861
123008
  const hasAudio = htmlEl.getAttribute("data-has-audio") === "true";
122862
123009
  const volume = parseFloat(htmlEl.getAttribute("data-volume") || "1");
122863
123010
  const muted = !isImage && (htmlEl.hasAttribute("muted") || htmlEl.muted);
122864
123011
  results.push({
122865
123012
  id,
122866
- tagName: isImage ? "image" : htmlEl.tagName.toLowerCase(),
123013
+ tagName: tagName19,
122867
123014
  src,
122868
123015
  start,
122869
- end,
122870
- duration,
122871
- mediaStart,
123016
+ endRaw,
123017
+ durationRaw,
123018
+ playbackStartRaw,
123019
+ mediaStartRaw,
122872
123020
  loop,
122873
123021
  hasAudio,
122874
123022
  volume,
@@ -122877,13 +123025,45 @@ async function discoverMediaFromBrowser(page) {
122877
123025
  });
122878
123026
  return results;
122879
123027
  });
122880
- return elements;
123028
+ return elements.map(({ endRaw, durationRaw, playbackStartRaw, mediaStartRaw, ...element }) => ({
123029
+ ...element,
123030
+ end: parseStrictFiniteTimingNumber(endRaw) ?? 0,
123031
+ duration: parseStrictFiniteTimingNumber(durationRaw) ?? 0,
123032
+ mediaStart: readMediaStart({
123033
+ getAttribute(name) {
123034
+ if (name === "data-playback-start") return playbackStartRaw;
123035
+ if (name === "data-media-start") return mediaStartRaw;
123036
+ return null;
123037
+ }
123038
+ })
123039
+ }));
122881
123040
  }
122882
123041
  async function discoverAudioVolumeAutomationFromTimeline(page, audioIds, compositionDuration, sampleFps) {
122883
123042
  if (audioIds.length === 0 || compositionDuration <= 0) return [];
122884
123043
  const sampleStep = 1 / Math.min(60, Math.max(1, sampleFps));
123044
+ const rawWindows = await page.evaluate((ids) => {
123045
+ return ids.flatMap((id) => {
123046
+ const el = document.getElementById(id) ?? document.getElementById(id.replace(/-audio$/, ""));
123047
+ if (!(el instanceof HTMLAudioElement) && !(el instanceof HTMLVideoElement)) return [];
123048
+ return [
123049
+ {
123050
+ id,
123051
+ startRaw: el.dataset.start ?? null,
123052
+ endRaw: el.dataset.end ?? null,
123053
+ durationRaw: el.dataset.duration ?? null
123054
+ }
123055
+ ];
123056
+ });
123057
+ }, audioIds);
123058
+ const clips = rawWindows.map(({ id, startRaw, endRaw, durationRaw }) => {
123059
+ const start = parseStrictFiniteTimingNumber(startRaw) ?? 0;
123060
+ const authoredDuration = parseStrictFiniteTimingNumber(durationRaw);
123061
+ const authoredEnd = parseStrictFiniteTimingNumber(endRaw);
123062
+ const end = authoredDuration != null && authoredDuration > 0 ? start + authoredDuration : authoredEnd != null && authoredEnd > start ? authoredEnd : compositionDuration;
123063
+ return { id, start, end };
123064
+ });
122885
123065
  return page.evaluate(
122886
- ({ ids, duration, step }) => {
123066
+ ({ clips: clips2, duration, step }) => {
122887
123067
  const results = [];
122888
123068
  const timelines = window.__timelines;
122889
123069
  if (!timelines) return results;
@@ -122899,13 +123079,9 @@ async function discoverAudioVolumeAutomationFromTimeline(page, audioIds, composi
122899
123079
  tl.seek(t2, true);
122900
123080
  }
122901
123081
  };
122902
- for (const id of ids) {
123082
+ for (const { id, start, end } of clips2) {
122903
123083
  const el = document.getElementById(id) ?? document.getElementById(id.replace(/-audio$/, ""));
122904
123084
  if (!(el instanceof HTMLAudioElement) && !(el instanceof HTMLVideoElement)) continue;
122905
- const start = Number.parseFloat(el.dataset.start ?? "0") || 0;
122906
- const endAttr = Number.parseFloat(el.dataset.end ?? "");
122907
- const durationAttr = Number.parseFloat(el.dataset.duration ?? "");
122908
- const end = Number.isFinite(durationAttr) && durationAttr > 0 ? start + durationAttr : Number.isFinite(endAttr) && endAttr > start ? endAttr : duration;
122909
123085
  const sampleStart = Math.max(0, start);
122910
123086
  const sampleEnd = Math.min(duration, end);
122911
123087
  const initialVolumeAttr = Number.parseFloat(el.dataset.volume ?? "");
@@ -122950,7 +123126,7 @@ async function discoverAudioVolumeAutomationFromTimeline(page, audioIds, composi
122950
123126
  seekTl(0);
122951
123127
  return results;
122952
123128
  },
122953
- { ids: audioIds, duration: compositionDuration, step: sampleStep }
123129
+ { clips, duration: compositionDuration, step: sampleStep }
122954
123130
  );
122955
123131
  }
122956
123132
  async function discoverVideoVisibilityFromTimeline(page, compositionDuration) {
@@ -123038,13 +123214,17 @@ async function resolveCompositionDurations(page, unresolved) {
123038
123214
  }
123039
123215
  const el = document.getElementById(id);
123040
123216
  if (el) {
123041
- const compDurAttr = el.getAttribute("data-duration") || el.getAttribute("data-composition-duration");
123042
- if (compDurAttr) {
123043
- const dur = parseFloat(compDurAttr);
123044
- if (dur > 0) {
123045
- resolved2.push({ id, duration: dur, source: "data-duration" });
123046
- continue;
123047
- }
123217
+ const durationRaw = el.getAttribute("data-duration");
123218
+ const compositionDurationRaw = el.getAttribute("data-composition-duration");
123219
+ if (durationRaw != null || compositionDurationRaw != null) {
123220
+ resolved2.push({
123221
+ id,
123222
+ duration: 0,
123223
+ source: "data-duration",
123224
+ ...durationRaw != null ? { durationRaw } : {},
123225
+ ...compositionDurationRaw != null ? { compositionDurationRaw } : {}
123226
+ });
123227
+ continue;
123048
123228
  }
123049
123229
  }
123050
123230
  resolved2.push({ id, duration: 0, source: "unresolved" });
@@ -123053,8 +123233,9 @@ async function resolveCompositionDurations(page, unresolved) {
123053
123233
  }, ids);
123054
123234
  const resolutions = [];
123055
123235
  for (const r2 of results) {
123056
- if (r2.duration > 0) {
123057
- resolutions.push({ id: r2.id, duration: r2.duration });
123236
+ const duration = parseStrictFiniteTimingNumber(r2.durationRaw) ?? parseStrictFiniteTimingNumber(r2.compositionDurationRaw) ?? r2.duration;
123237
+ if (duration != null && duration > 0) {
123238
+ resolutions.push({ id: r2.id, duration });
123058
123239
  }
123059
123240
  }
123060
123241
  return resolutions;